feat(forge): add the pull request panel and worktree Sessions

The forge panel shows the pull requests a Session created or pushed in a
right-sidebar tab, with a Session header button and branch label, and lets
a new Session start in its own Git worktree from the New Session options
row. The forge bundle ships the panel with the forge registry, the GitHub
provider, the Session bindings, and an isolated worktree service.

The panel listens to the agent-controller/admission stage. It holds the
first message of a Session with a worktree request while it creates and
enters the worktree as Agent maintenance, and refuses messages while the
worktree the Session works in is gone. A failed or stopped creation
returns the message to the composer: the card above the composer shows the
failure, sending again retries with a new branch name, and Continue
without a worktree withdraws the request. A removed worktree can be
checked out again or left for the source checkout. A message that enters
without admission still gets its worktree at the first step proposal.
This commit is contained in:
Yichen Jiang committed 2026-10-20 11:49:51 +08:00
1 parent 7c586e5b4c
commit fc43a2d507
147 files changed
+12984 -135

No files matched your search

+7
View File
@@ -119,6 +119,7 @@ export const SERVICE_PAGE: Record<string, string> = {
workingDirectory: 'working-directory.md',
worktrees: 'worktrees.md',
forge: 'forge.md',
forgePanel: 'forge.md',
forgeSession: 'forge.md',
sessionController: 'session.md',
sessionSkillCatalog: 'skills.md',
@@ -365,10 +366,16 @@ export const LINK_MAP: Readonly<Record<string, string>> = {
CreateAgentOptions: 'core.md',
CreateWorktreeRequest: 'worktrees.md',
CreatedWorktree: 'worktrees.md',
CreateWorktreePhase: 'worktrees.md',
RestoreWorktreeRequest: 'worktrees.md',
RestoredWorktree: 'worktrees.md',
ChangeRequestListener: 'forge.md',
ChangeRequestRef: 'forge.md',
ChangeRequestUpdate: 'forge.md',
ForgeBranches: 'forge.md',
ForgePanelState: 'forge.md',
ForgeProvider: 'forge.md',
ForgeReadiness: 'forge.md',
ForgeRepository: 'forge.md',
SessionChangeRequest: 'forge.md',
SessionChangeRequestsListener: 'forge.md',
+10 -2
View File
@@ -184,7 +184,7 @@ const SERVICE_ROLES: ServiceRole[] = [
title: 'Code host change requests',
mode: 'seam',
implementations: ['experimental-forge-github'],
consumers: ['experimental-forge-session'],
consumers: ['experimental-forge-session', 'experimental-client-ui-forge'],
note: 'Providers map remote and change request URLs, look up change requests by head branch, and read status in batches; watchers of one change request share one polling loop.',
},
{
@@ -192,7 +192,15 @@ const SERVICE_ROLES: ServiceRole[] = [
pkg: 'experimental-forge-session',
title: 'Session change request bindings',
mode: 'service',
note: 'A host-only projection derives bindings from shell results and binding records; push results trigger head-branch discovery, and Session watchers poll bound change requests through the forge registry.',
consumers: ['experimental-client-ui-forge'],
note: 'A Session projection derives bindings from shell results and binding records and publishes their URLs without status to clients; push results trigger head-branch discovery, and Session watchers poll bound change requests through the forge registry.',
},
{
key: 'forgePanel',
pkg: 'experimental-client-ui-forge',
title: 'Forge panel Remote',
mode: 'service',
note: 'Streams one panel state per followed Session: a read-only Git inspection in the Session sandbox, the recognized code host and its sign-in, and the bound change requests with polled status.',
},
{
key: 'worktrees',
+30
View File
@@ -140,6 +140,36 @@ describe('optional bundles', () => {
}
})
it('offers the forge panel as one disabled bundle with its registry, provider, bindings, panel, and isolated worktree service', () => {
const name = '@deepseek-ai/dsh-experimental-forge-bundle'
expect(OPTIONAL_BUNDLES).toContain(name)
for (const template of Object.values(PROFILE_TEMPLATES)) expect(template.bundles).not.toContain(name)
const rows = flattenRows(composeEntries([...shipped, bundle(name).patches]))
for (const moduleName of [
'@deepseek-ai/dsh-experimental-forge',
'@deepseek-ai/dsh-experimental-forge-github',
'@deepseek-ai/dsh-experimental-forge-session',
'@deepseek-ai/dsh-experimental-client-ui-forge',
'@deepseek-ai/dsh-experimental-worktree',
]) {
expect(flattenRows(composeEntries(shipped)).some(row => row.name === moduleName)).toBe(false)
expect(rows.filter(row => row.name === moduleName && row.disabled !== true)).toHaveLength(1)
}
const group = composeEntries([...shipped, bundle(name).patches]).find(row => row.id === 'optional-forge-panel')
expect(group?.isolate).toEqual({ worktrees: true })
})
it('composes the forge panel beside Git Worktrees with one worktree service each', () => {
const composed = composeEntries([
...shipped,
bundle('@deepseek-ai/dsh-experimental-tool-worktree').patches,
bundle('@deepseek-ai/dsh-experimental-forge-bundle').patches,
], (message) => { throw new Error(message) })
const topLevelIds = composed.flatMap(entry => typeof entry.id === 'string' ? [entry.id] : [])
expect(topLevelIds).toHaveLength(new Set(topLevelIds).size)
expect(flattenRows(composed).filter(row => row.name === '@deepseek-ai/dsh-experimental-worktree')).toHaveLength(2)
})
it('ships all five lightweight bundles without selecting them in a default template', () => {
const defaults = Object.values(PROFILE_TEMPLATES).flatMap(template => template.bundles)
for (const name of lightweight) {
+2
View File
@@ -62,6 +62,7 @@ describe('release families', () => {
'@deepseek-ai/dsh-experimental-client-ui-agent-team',
'@deepseek-ai/dsh-experimental-client-ui-claude-code-mods',
'@deepseek-ai/dsh-experimental-client-ui-cot-translation',
'@deepseek-ai/dsh-experimental-client-ui-forge',
'@deepseek-ai/dsh-experimental-client-ui-voice-input',
'@deepseek-ai/dsh-experimental-computer-use-cua-driver-mcp',
'@deepseek-ai/dsh-experimental-computer-use-cua-driver-native',
@@ -69,6 +70,7 @@ describe('release families', () => {
'@deepseek-ai/dsh-cua-bundle',
'@deepseek-ai/dsh-experimental-cua-macos',
'@deepseek-ai/dsh-cua',
'@deepseek-ai/dsh-experimental-forge-bundle',
'@deepseek-ai/dsh-experimental-forge-github',
'@deepseek-ai/dsh-experimental-forge-session',
'@deepseek-ai/dsh-experimental-forge',
+85
View File
@@ -2591,6 +2591,91 @@
"doc": "docs/subsystems/core.md",
"symbol": "AdmissionDecision",
"source": "packages/core/agent-controller/src/types.ts"
},
{
"doc": "docs/subsystems/worktrees.md",
"symbol": "CreateWorktreePhase",
"source": "packages/experimental/worktree/src/types.ts"
},
{
"doc": "docs/subsystems/worktrees.md",
"symbol": "RestoreWorktreeRequest",
"source": "packages/experimental/worktree/src/types.ts"
},
{
"doc": "docs/subsystems/worktrees.md",
"symbol": "RestoredWorktree",
"source": "packages/experimental/worktree/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeReadiness",
"source": "packages/experimental/forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeCheckout",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeCheckoutState",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeSessionWorktree",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "WorktreeRecord",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeWorktreeBlocker",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeWorktreeCreation",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeWorktreeFailure",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeAdmissionRefusal",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeMissingWorktree",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgePanelWorktree",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgePanelChangeRequest",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgePanelState",
"source": "packages/experimental/client-ui-forge/src/types.ts"
},
{
"doc": "docs/subsystems/forge.md",
"symbol": "ForgeBranches",
"source": "packages/experimental/client-ui-forge/src/types.ts"
}
]
}
@@ -61,6 +61,8 @@ const SENTENCE_MODEL_EXPERIENCE: Readonly<Record<string, SentenceContract>> = {
'packages/ssh/ssh-helper-runtime': { kind: 'none', reason: 'The private executable carrier registers no model-facing content; its providers and consumers own operation results.' },
'packages/experimental/forge': { kind: 'none', reason: 'Providers and watchers exchange code host status without contributing model context.' },
'packages/experimental/forge-github': { kind: 'none', reason: 'The provider reads pull request status for host-side watchers without contributing model context.' },
'packages/experimental/client-ui-forge': { kind: 'indirect', reason: 'Switching a Session directory from the panel reaches the model through the working-directory notice; inspection and status stay on the host.' },
'packages/experimental/forge-bundle': { kind: 'none', reason: 'Composes the forge packages and panel without adding a model tool or prompt.' },
'packages/experimental/forge-session': { kind: 'none', reason: 'Bindings, discovery records, and polled status stay on the host; binding records never enter model requests.' },
'packages/experimental/worktree': { kind: 'indirect', reason: 'The worktree tool renders creation results; the working-directory service owns model-visible directory context.' },
'packages/ssh/ssh': { kind: 'none', reason: 'The connection owner transports private provider operations; consumers own all model-facing content.' },