dsh-git-worktree 0.1.2 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +93 -0
- package/LICENSE +21 -21
- package/README.md +187 -43
- package/README.zh.md +187 -41
- package/cordis.patch.yml +7 -7
- package/lib/adapters/lookup.d.ts +4 -2
- package/lib/adapters/lookup.js +31 -3
- package/lib/adapters/lookup.js.map +1 -1
- package/lib/adapters/registry.js +41 -0
- package/lib/adapters/registry.js.map +1 -1
- package/lib/adapters/safe-file.js +34 -4
- package/lib/adapters/safe-file.js.map +1 -1
- package/lib/client/WorktreeCreateRow.d.ts +7 -0
- package/lib/client/WorktreeCreateRow.js +26 -0
- package/lib/client/WorktreeCreateRow.js.map +1 -0
- package/lib/client/WorktreeReviewRow.d.ts +11 -0
- package/lib/client/WorktreeReviewRow.js +67 -0
- package/lib/client/WorktreeReviewRow.js.map +1 -0
- package/lib/client/actions.d.ts +86 -0
- package/lib/client/actions.js +35 -0
- package/lib/client/actions.js.map +1 -0
- package/lib/client/console-remote/adapter.d.ts +3 -0
- package/lib/client/console-remote/adapter.js +61 -0
- package/lib/client/console-remote/adapter.js.map +1 -0
- package/lib/client/console-remote/index.d.ts +18 -0
- package/lib/client/console-remote/index.js +17 -0
- package/lib/client/console-remote/index.js.map +1 -0
- package/lib/client/index.d.ts +17 -0
- package/lib/client/index.js +44 -0
- package/lib/client/index.js.map +1 -0
- package/lib/client/model.d.ts +68 -0
- package/lib/client/model.js +127 -0
- package/lib/client/model.js.map +1 -0
- package/lib/client/pre-session/PreSessionWorktreeToggle.d.ts +16 -0
- package/lib/client/pre-session/PreSessionWorktreeToggle.js +128 -0
- package/lib/client/pre-session/PreSessionWorktreeToggle.js.map +1 -0
- package/lib/client/pre-session/controller.d.ts +42 -0
- package/lib/client/pre-session/controller.js +149 -0
- package/lib/client/pre-session/controller.js.map +1 -0
- package/lib/client/pre-session/index.d.ts +15 -0
- package/lib/client/pre-session/index.js +16 -0
- package/lib/client/pre-session/index.js.map +1 -0
- package/lib/client/review-console/ReviewActions.d.ts +15 -0
- package/lib/client/review-console/ReviewActions.js +234 -0
- package/lib/client/review-console/ReviewActions.js.map +1 -0
- package/lib/client/review-console/WorktreeReviewPanel.d.ts +20 -0
- package/lib/client/review-console/WorktreeReviewPanel.js +75 -0
- package/lib/client/review-console/WorktreeReviewPanel.js.map +1 -0
- package/lib/client/review-console/index.d.ts +8 -0
- package/lib/client/review-console/index.js +22 -0
- package/lib/client/review-console/index.js.map +1 -0
- package/lib/client/review-console/review-console.styles.d.ts +1 -0
- package/lib/client/review-console/review-console.styles.js +81 -0
- package/lib/client/review-console/review-console.styles.js.map +1 -0
- package/lib/client/review-console/status-events.d.ts +3 -0
- package/lib/client/review-console/status-events.js +6 -0
- package/lib/client/review-console/status-events.js.map +1 -0
- package/lib/client/styles.d.ts +1 -0
- package/lib/client/styles.js +78 -0
- package/lib/client/styles.js.map +1 -0
- package/lib/client/target-console/TargetStatusAction.d.ts +7 -0
- package/lib/client/target-console/TargetStatusAction.js +46 -0
- package/lib/client/target-console/TargetStatusAction.js.map +1 -0
- package/lib/client/target-console/WorktreeConsoleView.d.ts +9 -0
- package/lib/client/target-console/WorktreeConsoleView.js +362 -0
- package/lib/client/target-console/WorktreeConsoleView.js.map +1 -0
- package/lib/client/target-console/WorktreeReviewStatus.d.ts +9 -0
- package/lib/client/target-console/WorktreeReviewStatus.js +125 -0
- package/lib/client/target-console/WorktreeReviewStatus.js.map +1 -0
- package/lib/client/target-console/index.d.ts +14 -0
- package/lib/client/target-console/index.js +23 -0
- package/lib/client/target-console/index.js.map +1 -0
- package/lib/client/target-console/target-console.styles.d.ts +1 -0
- package/lib/client/target-console/target-console.styles.js +130 -0
- package/lib/client/target-console/target-console.styles.js.map +1 -0
- package/lib/client.js +6902 -0
- package/lib/commands.d.ts +2 -4
- package/lib/commands.js +69 -28
- package/lib/commands.js.map +1 -1
- package/lib/console-contract.d.ts +253 -0
- package/lib/console-contract.js +86 -0
- package/lib/console-contract.js.map +1 -0
- package/lib/console-host/control-plane.d.ts +31 -0
- package/lib/console-host/control-plane.js +502 -0
- package/lib/console-host/control-plane.js.map +1 -0
- package/lib/console-host/errors.d.ts +6 -0
- package/lib/console-host/errors.js +31 -0
- package/lib/console-host/errors.js.map +1 -0
- package/lib/console-host/projection.d.ts +12 -0
- package/lib/console-host/projection.js +136 -0
- package/lib/console-host/projection.js.map +1 -0
- package/lib/console-host/review-diff.d.ts +18 -0
- package/lib/console-host/review-diff.js +176 -0
- package/lib/console-host/review-diff.js.map +1 -0
- package/lib/console-host/service.d.ts +26 -0
- package/lib/console-host/service.js +143 -0
- package/lib/console-host/service.js.map +1 -0
- package/lib/console-remote/descriptors.d.ts +3 -0
- package/lib/console-remote/descriptors.js +105 -0
- package/lib/console-remote/descriptors.js.map +1 -0
- package/lib/console-remote/remote.d.ts +29 -0
- package/lib/console-remote/remote.js +4 -0
- package/lib/console-remote/remote.js.map +1 -0
- package/lib/console-remote/schemas.d.ts +29 -0
- package/lib/console-remote/schemas.js +145 -0
- package/lib/console-remote/schemas.js.map +1 -0
- package/lib/console-remote/typert.d.ts +3 -0
- package/lib/console-remote/typert.js +14 -0
- package/lib/console-remote/typert.js.map +1 -0
- package/lib/index.d.ts +26 -8
- package/lib/index.js +28 -10
- package/lib/index.js.map +1 -1
- package/lib/managed-worktree-path.d.ts +14 -13
- package/lib/managed-worktree-path.js +32 -22
- package/lib/managed-worktree-path.js.map +1 -1
- package/lib/ports.d.ts +39 -1
- package/lib/session-checkout-apply.d.ts +54 -1
- package/lib/session-checkout-apply.js +318 -28
- package/lib/session-checkout-apply.js.map +1 -1
- package/lib/session-checkout-module.js +1098 -36
- package/lib/session-checkout-module.js.map +1 -1
- package/lib/session-target-context.d.ts +6 -0
- package/lib/session-target-context.js +16 -0
- package/lib/session-target-context.js.map +1 -0
- package/lib/tools.d.ts +6 -6
- package/lib/tools.js +107 -218
- package/lib/tools.js.map +1 -1
- package/lib/types.d.ts +57 -11
- package/lib/types.js +6 -6
- package/lib/types.js.map +1 -1
- package/package.json +116 -69
- package/scripts/check-publish.mjs +193 -0
- package/scripts/clean-lib.mjs +7 -0
- package/scripts/dev-dsh-lib.mjs +509 -0
- package/scripts/dev-dsh.mjs +95 -0
- package/scripts/dsh-source-runner.mjs +14 -0
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { booleanSchema, checkoutIdSchema, commitMessageSchema, createResponseSchema, currentResponseSchema, inspectResponseSchema, listResponseSchema, mutationResponseSchema, optionalBooleanSchema, outcomeSchema, preflightResponseSchema, retainedModeSchema, retentionSchema, reviewDiffResponseSchema, reviewIdSchema, revisionSchema, sessionIdSchema, } from './schemas.js';
|
|
2
|
+
const PACKAGE = 'dsh-git-worktree';
|
|
3
|
+
const SERVICE = 'gitWorktree';
|
|
4
|
+
const AGENT_WIRE_TYPE = '@deepseek-ai/dsh-session/types#SessionId';
|
|
5
|
+
const agentParameter = {
|
|
6
|
+
name: 'agent',
|
|
7
|
+
wire: 'agentId',
|
|
8
|
+
source: 'lookup',
|
|
9
|
+
lookup: 'agent',
|
|
10
|
+
codec: { mode: 'strict', typeSymbol: AGENT_WIRE_TYPE, schema: sessionIdSchema },
|
|
11
|
+
};
|
|
12
|
+
function json(name, schema, typeSymbol, acceptsUndefined = false) {
|
|
13
|
+
return {
|
|
14
|
+
name,
|
|
15
|
+
wire: name,
|
|
16
|
+
source: 'json',
|
|
17
|
+
...(acceptsUndefined ? { acceptsUndefined: true } : {}),
|
|
18
|
+
codec: { mode: 'strict', typeSymbol, schema },
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
function descriptor(method, parameters, resultSchema, resultType) {
|
|
22
|
+
return {
|
|
23
|
+
id: `${PACKAGE}#${SERVICE}/${method}`,
|
|
24
|
+
service: SERVICE,
|
|
25
|
+
namespace: SERVICE,
|
|
26
|
+
method,
|
|
27
|
+
invocation: { kind: 'direct' },
|
|
28
|
+
parameters: [agentParameter, ...parameters],
|
|
29
|
+
result: { mode: 'strict', typeSymbol: `${PACKAGE}/console-contract#${resultType}`, schema: resultSchema },
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
export const WORKTREE_CONSOLE_DESCRIPTORS = Object.freeze([
|
|
33
|
+
descriptor('current', [], outcomeSchema(currentResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleCurrentResponse>'),
|
|
34
|
+
descriptor('list', [
|
|
35
|
+
json('needsAttention', optionalBooleanSchema, 'boolean | undefined', true),
|
|
36
|
+
json('includeDelivered', optionalBooleanSchema, 'boolean | undefined', true),
|
|
37
|
+
], outcomeSchema(listResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleListResponse>'),
|
|
38
|
+
descriptor('create', [], outcomeSchema(createResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleCreateResponse>'),
|
|
39
|
+
descriptor('inspect', [
|
|
40
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleInspectRequest.checkoutId`),
|
|
41
|
+
], outcomeSchema(inspectResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleInspectResponse>'),
|
|
42
|
+
descriptor('reviewDiff', [
|
|
43
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleReviewDiffRequest.checkoutId`),
|
|
44
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleReviewDiffRequest.expectedRevision`),
|
|
45
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleReviewDiffRequest.expectedReviewId`),
|
|
46
|
+
], outcomeSchema(reviewDiffResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleReviewDiffResponse>'),
|
|
47
|
+
descriptor('preflight', [
|
|
48
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsolePreflightRequest.checkoutId`),
|
|
49
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsolePreflightRequest.expectedRevision`),
|
|
50
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsolePreflightRequest.expectedReviewId`),
|
|
51
|
+
], outcomeSchema(preflightResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsolePreflightResponse>'),
|
|
52
|
+
descriptor('preview', [
|
|
53
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsolePreviewRequest.checkoutId`),
|
|
54
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsolePreviewRequest.expectedRevision`),
|
|
55
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsolePreviewRequest.expectedReviewId`),
|
|
56
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
57
|
+
descriptor('resumeRevision', [
|
|
58
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleResumeRevisionRequest.checkoutId`),
|
|
59
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleResumeRevisionRequest.expectedRevision`),
|
|
60
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleResumeRevisionRequest.expectedReviewId`),
|
|
61
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
62
|
+
descriptor('rollbackPreview', [
|
|
63
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleRollbackPreviewRequest.checkoutId`),
|
|
64
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleRollbackPreviewRequest.expectedRevision`),
|
|
65
|
+
json('resumeRevision', optionalBooleanSchema, `${PACKAGE}/console-contract#WorktreeConsoleRollbackPreviewRequest.resumeRevision`, true),
|
|
66
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
67
|
+
descriptor('discard', [
|
|
68
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleDiscardRequest.checkoutId`),
|
|
69
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleDiscardRequest.expectedRevision`),
|
|
70
|
+
json('confirmDirty', booleanSchema, 'boolean'),
|
|
71
|
+
json('rollbackPreview', optionalBooleanSchema, `${PACKAGE}/console-contract#WorktreeConsoleDiscardRequest.rollbackPreview`, true),
|
|
72
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
73
|
+
descriptor('finalize', [
|
|
74
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizeRequest.checkoutId`),
|
|
75
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizeRequest.expectedRevision`),
|
|
76
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizeRequest.expectedReviewId`),
|
|
77
|
+
json('commitMessage', commitMessageSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizeRequest.commitMessage`),
|
|
78
|
+
json('retention', retentionSchema, `${PACKAGE}/types#WorktreeRetentionMode`),
|
|
79
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
80
|
+
descriptor('finalizePreview', [
|
|
81
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizePreviewRequest.checkoutId`),
|
|
82
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizePreviewRequest.expectedRevision`),
|
|
83
|
+
json('expectedReviewId', reviewIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizePreviewRequest.expectedReviewId`),
|
|
84
|
+
json('commitMessage', commitMessageSchema, `${PACKAGE}/console-contract#WorktreeConsoleFinalizePreviewRequest.commitMessage`),
|
|
85
|
+
json('retention', retentionSchema, `${PACKAGE}/types#WorktreeRetentionMode`),
|
|
86
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
87
|
+
descriptor('setRetention', [
|
|
88
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleSetRetentionRequest.checkoutId`),
|
|
89
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleSetRetentionRequest.expectedRevision`),
|
|
90
|
+
json('retention', retainedModeSchema, `${PACKAGE}/console-contract#WorktreeConsoleSetRetentionRequest.retention`),
|
|
91
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
92
|
+
descriptor('retryCleanup', [
|
|
93
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleRetryCleanupRequest.checkoutId`),
|
|
94
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleRetryCleanupRequest.expectedRevision`),
|
|
95
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
96
|
+
descriptor('beginNextIteration', [
|
|
97
|
+
json('checkoutId', checkoutIdSchema, `${PACKAGE}/console-contract#WorktreeConsoleBeginNextIterationRequest.checkoutId`),
|
|
98
|
+
json('expectedRevision', revisionSchema, `${PACKAGE}/console-contract#WorktreeConsoleBeginNextIterationRequest.expectedRevision`),
|
|
99
|
+
], outcomeSchema(mutationResponseSchema), 'WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>'),
|
|
100
|
+
]);
|
|
101
|
+
export const WORKTREE_CONSOLE_REMOTE = Object.freeze({
|
|
102
|
+
package: PACKAGE,
|
|
103
|
+
descriptors: WORKTREE_CONSOLE_DESCRIPTORS,
|
|
104
|
+
});
|
|
105
|
+
//# sourceMappingURL=descriptors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptors.js","sourceRoot":"","sources":["../../src/console-remote/descriptors.ts"],"names":[],"mappings":"AACA,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,sBAAsB,EACtB,qBAAqB,EACrB,aAAa,EACb,uBAAuB,EACvB,kBAAkB,EAClB,eAAe,EACf,wBAAwB,EACxB,cAAc,EACd,cAAc,EACd,eAAe,GAChB,MAAM,cAAc,CAAA;AAErB,MAAM,OAAO,GAAG,kBAAkB,CAAA;AAClC,MAAM,OAAO,GAAG,aAAa,CAAA;AAC7B,MAAM,eAAe,GAAG,0CAA0C,CAAA;AAElE,MAAM,cAAc,GAAkC;IACpD,IAAI,EAAE,OAAO;IACb,IAAI,EAAE,SAAS;IACf,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,OAAO;IACf,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,EAAE,eAAe,EAAE;CAChF,CAAA;AAED,SAAS,IAAI,CAAC,IAAY,EAAE,MAA0C,EAAE,UAAkB,EAAE,gBAAgB,GAAG,KAAK;IAClH,OAAO;QACL,IAAI;QACJ,IAAI,EAAE,IAAI;QACV,MAAM,EAAE,MAAM;QACd,GAAG,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,IAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAChE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,EAAE;KAC9C,CAAA;AACH,CAAC;AAED,SAAS,UAAU,CACjB,MAAc,EACd,UAAoD,EACpD,YAAgD,EAChD,UAAkB;IAElB,OAAO;QACL,EAAE,EAAE,G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W,EAAE,eAAe,EAAE,GAAG,OAAO,8BAA8B,CAAC;KAC7E,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAAE,yDAAyD,CAAC;IACpG,UAAU,CAAC,cAAc,EAAE;QACzB,IAAI,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,iEAAiE,CAAC;QACjH,IAAI,CAAC,kBAAkB,EAAE,cAAc,EAAE,GAAG,OAAO,uEAAuE,CAAC;QAC3H,IAAI,CAAC,WAAW,EAAE,kBAAkB,EAAE,GAAG,OAAO,gEAAgE,CAAC;KAClH,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAAE,yDAAyD,CAAC;IACpG,UAAU,CAAC,cAAc,EAAE;QACzB,IAAI,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,iEAAiE,CAAC;QACjH,IAAI,CAAC,kBAAkB,EAAE,cAAc,EAAE,GAAG,OAAO,uEAAuE,CAAC;KAC5H,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAAE,yDAAyD,CAAC;IACpG,UAAU,CAAC,oBAAoB,EAAE;QAC/B,IAAI,CAAC,YAAY,EAAE,gBAAgB,EAAE,GAAG,OAAO,uEAAuE,CAAC;QACvH,IAAI,CAAC,kBAAkB,EAAE,cAAc,EAAE,GAAG,OAAO,6EAA6E,CAAC;KAClI,EAAE,aAAa,CAAC,sBAAsB,CAAC,EAAE,yDAAyD,CAAC;CACrG,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAA6B,MAAM,CAAC,MAAM,CAAC;IAC7E,OAAO,EAAE,OAAO;IAChB,WAAW,EAAE,4BAA4B;CAC1C,CAAC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { RemoteResult, TypertRemoteNamespace } from '@deepseek-ai/dsh-typert-protocol';
|
|
2
|
+
import type { WorktreeConsoleCreateResponse, WorktreeConsoleCurrentResponse, WorktreeConsoleInspectResponse, WorktreeConsoleListResponse, WorktreeConsoleMutationResponse, WorktreeConsoleOutcome, WorktreeConsolePreflightResponse, WorktreeConsoleReviewDiffResponse } from '../console-contract.js';
|
|
3
|
+
import type { WorktreeRetentionMode } from '../types.js';
|
|
4
|
+
import { WORKTREE_CONSOLE_REMOTE } from './descriptors.js';
|
|
5
|
+
export type GitWorktreeRemote = TypertRemoteNamespace<'gitWorktree'>;
|
|
6
|
+
export default WORKTREE_CONSOLE_REMOTE;
|
|
7
|
+
export { WORKTREE_CONSOLE_DESCRIPTORS, WORKTREE_CONSOLE_REMOTE } from './descriptors.js';
|
|
8
|
+
declare module '@deepseek-ai/dsh-typert-protocol' {
|
|
9
|
+
interface TypertRemoteMap {
|
|
10
|
+
'gitWorktree/current': (agentId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleCurrentResponse>>>;
|
|
11
|
+
'gitWorktree/list': (agentId: string, needsAttention?: boolean, includeDelivered?: boolean) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleListResponse>>>;
|
|
12
|
+
'gitWorktree/create': (agentId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleCreateResponse>>>;
|
|
13
|
+
'gitWorktree/inspect': (agentId: string, checkoutId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleInspectResponse>>>;
|
|
14
|
+
'gitWorktree/reviewDiff': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleReviewDiffResponse>>>;
|
|
15
|
+
'gitWorktree/preflight': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsolePreflightResponse>>>;
|
|
16
|
+
'gitWorktree/preview': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
17
|
+
'gitWorktree/resumeRevision': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
18
|
+
'gitWorktree/rollbackPreview': (agentId: string, checkoutId: string, expectedRevision: number, resumeRevision?: boolean) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
19
|
+
'gitWorktree/discard': (agentId: string, checkoutId: string, expectedRevision: number, confirmDirty: boolean, rollbackPreview?: boolean) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
20
|
+
'gitWorktree/finalize': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string, commitMessage: string, retention: WorktreeRetentionMode) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
21
|
+
'gitWorktree/finalizePreview': (agentId: string, checkoutId: string, expectedRevision: number, expectedReviewId: string, commitMessage: string, retention: WorktreeRetentionMode) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
22
|
+
'gitWorktree/setRetention': (agentId: string, checkoutId: string, expectedRevision: number, retention: Exclude<WorktreeRetentionMode, 'cleanup'>) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
23
|
+
'gitWorktree/retryCleanup': (agentId: string, checkoutId: string, expectedRevision: number) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
24
|
+
'gitWorktree/beginNextIteration': (agentId: string, checkoutId: string, expectedRevision: number) => Promise<RemoteResult<WorktreeConsoleOutcome<WorktreeConsoleMutationResponse>>>;
|
|
25
|
+
}
|
|
26
|
+
interface TypertRemoteNamespaceMap {
|
|
27
|
+
gitWorktree: TypertRemoteNamespace<'gitWorktree'>;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/console-remote/remote.ts"],"names":[],"mappings":"AAYA,OAAO,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA;AAI1D,eAAe,uBAAuB,CAAA;AACtC,OAAO,EAAE,4BAA4B,EAAE,uBAAuB,EAAE,MAAM,kBAAkB,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type WorktreeConsoleCreateResponse, type WorktreeConsoleCurrentResponse, type WorktreeConsoleInspectResponse, type WorktreeConsoleListResponse, type WorktreeConsoleMutationResponse, type WorktreeConsoleOutcome, type WorktreeConsolePreflightResponse, type WorktreeConsoleReviewDiffResponse } from '../console-contract.js';
|
|
3
|
+
export declare const sessionIdSchema: z.ZodString;
|
|
4
|
+
export declare const checkoutIdSchema: z.ZodString;
|
|
5
|
+
export declare const reviewIdSchema: z.ZodString;
|
|
6
|
+
export declare const commitMessageSchema: z.ZodString;
|
|
7
|
+
export declare const revisionSchema: z.ZodNumber;
|
|
8
|
+
export declare const oidSchema: z.ZodUnion<readonly [z.ZodLiteral<"unversioned">, z.ZodString]>;
|
|
9
|
+
export declare const booleanSchema: z.ZodBoolean;
|
|
10
|
+
export declare const optionalBooleanSchema: z.ZodUnion<readonly [z.ZodBoolean, z.ZodUndefined]>;
|
|
11
|
+
export declare const retentionSchema: z.ZodEnum<{
|
|
12
|
+
cleanup: "cleanup";
|
|
13
|
+
retain_24h: "retain_24h";
|
|
14
|
+
retain_3d: "retain_3d";
|
|
15
|
+
retain_manual: "retain_manual";
|
|
16
|
+
}>;
|
|
17
|
+
export declare const retainedModeSchema: z.ZodEnum<{
|
|
18
|
+
retain_24h: "retain_24h";
|
|
19
|
+
retain_3d: "retain_3d";
|
|
20
|
+
retain_manual: "retain_manual";
|
|
21
|
+
}>;
|
|
22
|
+
export declare function outcomeSchema<T>(value: z.ZodType<T>): z.ZodType<WorktreeConsoleOutcome<T>>;
|
|
23
|
+
export declare const currentResponseSchema: z.ZodType<WorktreeConsoleCurrentResponse>;
|
|
24
|
+
export declare const createResponseSchema: z.ZodType<WorktreeConsoleCreateResponse>;
|
|
25
|
+
export declare const inspectResponseSchema: z.ZodType<WorktreeConsoleInspectResponse>;
|
|
26
|
+
export declare const listResponseSchema: z.ZodType<WorktreeConsoleListResponse>;
|
|
27
|
+
export declare const mutationResponseSchema: z.ZodType<WorktreeConsoleMutationResponse>;
|
|
28
|
+
export declare const preflightResponseSchema: z.ZodType<WorktreeConsolePreflightResponse>;
|
|
29
|
+
export declare const reviewDiffResponseSchema: z.ZodType<WorktreeConsoleReviewDiffResponse>;
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { WORKTREE_CONSOLE_ERROR_CODES, WORKTREE_CONSOLE_TARGET_STATES, } from '../console-contract.js';
|
|
3
|
+
const strict = (shape) => z.object(shape).strict();
|
|
4
|
+
export const sessionIdSchema = z.string().min(1);
|
|
5
|
+
export const checkoutIdSchema = z.string().min(1).refine(value => !value.includes('..') && !/[\\/\0]/u.test(value), 'unsafe checkout id');
|
|
6
|
+
export const reviewIdSchema = z.string().min(1);
|
|
7
|
+
export const commitMessageSchema = z.string().trim().min(1).max(500);
|
|
8
|
+
export const revisionSchema = z.number().int().nonnegative();
|
|
9
|
+
export const oidSchema = z.union([
|
|
10
|
+
z.literal('unversioned'),
|
|
11
|
+
z.string().regex(/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/iu),
|
|
12
|
+
]);
|
|
13
|
+
export const booleanSchema = z.boolean();
|
|
14
|
+
export const optionalBooleanSchema = z.union([booleanSchema, z.undefined()]);
|
|
15
|
+
export const retentionSchema = z.enum(['cleanup', 'retain_24h', 'retain_3d', 'retain_manual']);
|
|
16
|
+
export const retainedModeSchema = z.enum(['retain_24h', 'retain_3d', 'retain_manual']);
|
|
17
|
+
const projectSchema = strict({ id: z.string().min(1), name: z.string().min(1) });
|
|
18
|
+
const validationItemSchema = strict({
|
|
19
|
+
command: z.string(),
|
|
20
|
+
status: z.enum(['passed', 'failed', 'not_run']),
|
|
21
|
+
summary: z.string().optional(),
|
|
22
|
+
});
|
|
23
|
+
const reviewSchema = strict({
|
|
24
|
+
reviewId: reviewIdSchema,
|
|
25
|
+
revision: revisionSchema,
|
|
26
|
+
iteration: z.number().int().nonnegative(),
|
|
27
|
+
preparedAt: z.number().finite(),
|
|
28
|
+
summary: z.string(),
|
|
29
|
+
validationStatus: z.enum(['passed', 'failed', 'partial', 'not_run']),
|
|
30
|
+
validationSummary: z.string().optional(),
|
|
31
|
+
tests: z.array(validationItemSchema),
|
|
32
|
+
changedFiles: z.array(z.string()),
|
|
33
|
+
suggestedCommitMessage: z.string().min(1),
|
|
34
|
+
});
|
|
35
|
+
const capabilitiesSchema = strict({
|
|
36
|
+
create: z.boolean(),
|
|
37
|
+
open: z.boolean(),
|
|
38
|
+
inspect: z.boolean(),
|
|
39
|
+
discard: z.boolean(),
|
|
40
|
+
preflight: z.boolean(),
|
|
41
|
+
preview: z.boolean(),
|
|
42
|
+
resumeRevision: z.boolean(),
|
|
43
|
+
rollbackPreview: z.boolean(),
|
|
44
|
+
finalize: z.boolean(),
|
|
45
|
+
finalizePreview: z.boolean(),
|
|
46
|
+
setRetention: z.boolean(),
|
|
47
|
+
retryCleanup: z.boolean(),
|
|
48
|
+
beginNextIteration: z.boolean(),
|
|
49
|
+
});
|
|
50
|
+
const targetSummarySchema = strict({
|
|
51
|
+
project: projectSchema,
|
|
52
|
+
checkoutId: checkoutIdSchema.nullable(),
|
|
53
|
+
sourceSessionId: sessionIdSchema,
|
|
54
|
+
ownerSessionId: sessionIdSchema,
|
|
55
|
+
targetSessionId: sessionIdSchema.nullable(),
|
|
56
|
+
iteration: z.number().int().nonnegative(),
|
|
57
|
+
revision: revisionSchema,
|
|
58
|
+
state: z.enum(WORKTREE_CONSOLE_TARGET_STATES),
|
|
59
|
+
phase: z.enum(['local', 'preparing', 'ready', 'applying', 'mutating', 'recovery_required', 'finalized', 'retained', 'discarded']),
|
|
60
|
+
dirty: z.boolean(),
|
|
61
|
+
currentOid: oidSchema,
|
|
62
|
+
commitOid: oidSchema.nullable(),
|
|
63
|
+
retention: retainedModeSchema.optional(),
|
|
64
|
+
retainedAt: z.number().finite().optional(),
|
|
65
|
+
expiresAt: z.number().finite().nullable().optional(),
|
|
66
|
+
cleanupMessage: z.string().optional(),
|
|
67
|
+
review: reviewSchema.optional(),
|
|
68
|
+
reviewSlot: z.enum(['available', 'waiting']).optional(),
|
|
69
|
+
reviewSlotOwnerSessionId: sessionIdSchema.optional(),
|
|
70
|
+
previewRecovery: strict({
|
|
71
|
+
reason: z.enum(['stale_local', 'preview_modified']),
|
|
72
|
+
attemptedAction: z.enum(['rollback_preview', 'finalize_preview', 'discard']),
|
|
73
|
+
}).optional(),
|
|
74
|
+
capabilities: capabilitiesSchema,
|
|
75
|
+
});
|
|
76
|
+
const targetDetailsSchema = targetSummarySchema.extend({
|
|
77
|
+
managedRoot: z.string().min(1).nullable(),
|
|
78
|
+
sourceOid: oidSchema,
|
|
79
|
+
currentBranch: z.string().nullable(),
|
|
80
|
+
}).strict();
|
|
81
|
+
const consoleErrorSchema = strict({
|
|
82
|
+
code: z.enum(WORKTREE_CONSOLE_ERROR_CODES),
|
|
83
|
+
message: z.string(),
|
|
84
|
+
details: z.record(z.string(), z.union([z.string(), z.number(), z.boolean(), z.null()])).optional(),
|
|
85
|
+
});
|
|
86
|
+
export function outcomeSchema(value) {
|
|
87
|
+
return z.discriminatedUnion('ok', [
|
|
88
|
+
strict({ ok: z.literal(true), value }),
|
|
89
|
+
strict({ ok: z.literal(false), error: consoleErrorSchema }),
|
|
90
|
+
]);
|
|
91
|
+
}
|
|
92
|
+
export const currentResponseSchema = strict({ target: targetDetailsSchema });
|
|
93
|
+
export const createResponseSchema = strict({
|
|
94
|
+
target: targetDetailsSchema,
|
|
95
|
+
targetSessionId: sessionIdSchema,
|
|
96
|
+
managedRoot: z.string().min(1),
|
|
97
|
+
});
|
|
98
|
+
export const inspectResponseSchema = strict({ target: targetDetailsSchema });
|
|
99
|
+
export const listResponseSchema = strict({ project: projectSchema, worktrees: z.array(targetSummarySchema) });
|
|
100
|
+
export const mutationResponseSchema = strict({
|
|
101
|
+
target: targetSummarySchema,
|
|
102
|
+
changedFiles: z.array(z.string()).optional(),
|
|
103
|
+
commitOid: oidSchema.nullable().optional(),
|
|
104
|
+
});
|
|
105
|
+
const diffFileSchema = strict({
|
|
106
|
+
path: z.string(),
|
|
107
|
+
previousPath: z.string().optional(),
|
|
108
|
+
status: z.enum(['added', 'modified', 'deleted', 'renamed', 'binary']),
|
|
109
|
+
patch: z.string().nullable(),
|
|
110
|
+
truncated: z.boolean(),
|
|
111
|
+
});
|
|
112
|
+
const preflightFactsSchema = {
|
|
113
|
+
localModified: z.literal(false),
|
|
114
|
+
checkoutId: checkoutIdSchema,
|
|
115
|
+
reviewId: reviewIdSchema,
|
|
116
|
+
revision: revisionSchema,
|
|
117
|
+
configuredBaseOid: oidSchema,
|
|
118
|
+
effectiveBaseOid: oidSchema,
|
|
119
|
+
baseStrategy: z.enum(['recorded_base', 'isolated_contains_local_head', 'local_contains_isolated_head']),
|
|
120
|
+
localBranch: z.string().nullable(),
|
|
121
|
+
localHeadOid: oidSchema,
|
|
122
|
+
isolatedHeadOid: oidSchema,
|
|
123
|
+
changedFiles: z.array(z.string()),
|
|
124
|
+
};
|
|
125
|
+
const preflightSchema = z.union([
|
|
126
|
+
strict({ status: z.enum(['ready', 'local_advanced', 'already_in_local']), ...preflightFactsSchema }),
|
|
127
|
+
strict({ status: z.literal('conflict'), ...preflightFactsSchema, conflictingFiles: z.array(z.string()) }),
|
|
128
|
+
strict({
|
|
129
|
+
status: z.literal('blocked'),
|
|
130
|
+
localModified: z.literal(false),
|
|
131
|
+
checkoutId: z.string(),
|
|
132
|
+
reviewId: reviewIdSchema.nullable(),
|
|
133
|
+
revision: revisionSchema,
|
|
134
|
+
reason: z.enum(['not_owner', 'not_ready_for_review', 'stale_target', 'stale_isolated', 'project_acceptance_busy', 'checkout_unavailable', 'git_error']),
|
|
135
|
+
message: z.string(),
|
|
136
|
+
}),
|
|
137
|
+
]);
|
|
138
|
+
export const preflightResponseSchema = strict({ preflight: preflightSchema });
|
|
139
|
+
export const reviewDiffResponseSchema = strict({
|
|
140
|
+
reviewId: reviewIdSchema,
|
|
141
|
+
revision: revisionSchema,
|
|
142
|
+
files: z.array(diffFileSchema).max(200),
|
|
143
|
+
truncated: z.boolean(),
|
|
144
|
+
});
|
|
145
|
+
//# sourceMappingURL=schemas.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../src/console-remote/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AACvB,OAAO,EACL,4BAA4B,EAC5B,8BAA8B,GAS/B,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,GAAG,CAAkC,KAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,CAAA;AAEtF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAChD,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,oBAAoB,CAAC,CAAA;AACzI,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;AAC/C,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC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uBAAuB,GAAgD,MAAM,CAAC,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC,CAAA;AAE1H,MAAM,CAAC,MAAM,wBAAwB,GAAiD,MAAM,CAAC;IAC3F,QAAQ,EAAE,cAAc;IACxB,QAAQ,EAAE,cAAc;IACxB,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC;IACvC,SAAS,EAAE,CAAC,CAAC,OAAO,EAAE;CACvB,CAAC,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { WORKTREE_CONSOLE_DESCRIPTORS } from './descriptors.js';
|
|
2
|
+
/** Manual strict Host contribution discovered by the official Typert Loader through `./typert`. */
|
|
3
|
+
export const TYPERT = Object.freeze({
|
|
4
|
+
package: 'dsh-git-worktree',
|
|
5
|
+
face: 'host',
|
|
6
|
+
schemas: [],
|
|
7
|
+
model: {
|
|
8
|
+
services: [],
|
|
9
|
+
events: [],
|
|
10
|
+
objects: [],
|
|
11
|
+
},
|
|
12
|
+
invocations: WORKTREE_CONSOLE_DESCRIPTORS,
|
|
13
|
+
});
|
|
14
|
+
//# sourceMappingURL=typert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typert.js","sourceRoot":"","sources":["../../src/console-remote/typert.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAA;AAE/D,mGAAmG;AACnG,MAAM,CAAC,MAAM,MAAM,GAAuB,MAAM,CAAC,MAAM,CAAC;IACtD,OAAO,EAAE,kBAAkB;IAC3B,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,EAAE;IACX,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,EAAE;KACZ;IACD,WAAW,EAAE,4BAA4B;CAC1C,CAAC,CAAA"}
|
package/lib/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-git-worktree plugin entry. The session-checkout domain (state machine,
|
|
3
3
|
* apply engine, ports) is Domi-ported and host-agnostic; this file is the DSH
|
|
4
|
-
* plugin face: exports the domain error type and
|
|
5
|
-
*
|
|
6
|
-
* `/worktree`
|
|
4
|
+
* plugin face: exports the domain error type and module contract, builds the
|
|
5
|
+
* DSH adapters, mounts the state machine, and registers safe model tools,
|
|
6
|
+
* human `/worktree` acceptance commands, and Session Target runtime context.
|
|
7
7
|
* @module dsh-git-worktree
|
|
8
8
|
*/
|
|
9
9
|
import type { Context } from '@deepseek-ai/cordis';
|
|
@@ -29,6 +29,7 @@ export interface ManageManagedWorktreeInput {
|
|
|
29
29
|
action: 'cleanup_retained' | 'retry_cleanup' | 'set_retention' | 'discard';
|
|
30
30
|
retention?: Exclude<WorktreeRetentionMode, 'cleanup'>;
|
|
31
31
|
confirmDirty?: boolean;
|
|
32
|
+
rollbackPreview?: boolean;
|
|
32
33
|
}
|
|
33
34
|
export interface ListManagedWorktreesInput {
|
|
34
35
|
projectId?: string;
|
|
@@ -44,19 +45,35 @@ export interface MarkReadyForReviewInput {
|
|
|
44
45
|
tests: WorktreeValidationItem[];
|
|
45
46
|
suggestedCommitMessage: string;
|
|
46
47
|
}
|
|
48
|
+
/** Handoff data used by the client to create the authoritative isolated Workspace/Session. */
|
|
49
|
+
export interface IsolatedTargetLaunch {
|
|
50
|
+
targetSessionId: string;
|
|
51
|
+
managedRoot: string;
|
|
52
|
+
target: SessionTargetView;
|
|
53
|
+
}
|
|
47
54
|
/** Complete core interface the session-checkout module exposes to business callers. */
|
|
48
55
|
export interface SessionCheckoutModule {
|
|
49
56
|
inspect(sessionId: string): Promise<SessionTargetView>;
|
|
57
|
+
/** Synchronous registry snapshot for replay-stable model runtime context. */
|
|
58
|
+
runtimeContext(sessionId: string): string;
|
|
50
59
|
/** Read-only sync preflight; modifies no Local, worktree, registry, review state, or Git refs. */
|
|
51
60
|
preflight?(sessionId: string, expectedRevision: number): Promise<WorktreeApplyPreflightView>;
|
|
52
61
|
/** Cross-module mutation under the same exclusive lock as bind/apply/discard/cleanup. */
|
|
53
62
|
runExclusiveSessionMutation<T>(sessionId: string, operation: (target: SessionTargetView) => Promise<T>): Promise<T>;
|
|
54
63
|
bind(sessionId: string, choice: SessionTargetBindChoice): Promise<SessionTargetView>;
|
|
55
|
-
/**
|
|
56
|
-
|
|
64
|
+
/** Reserve a distinct owner session and checkout without changing the source session cwd/identity. */
|
|
65
|
+
createIsolatedTarget(sourceSessionId: string, targetSessionId: string): Promise<IsolatedTargetLaunch>;
|
|
66
|
+
/** Recreate a cleaned delivered owner's immutable cwd as the next isolated iteration. */
|
|
67
|
+
beginNextIteration(sessionId: string, expectedRevision: number): Promise<SessionTargetView>;
|
|
68
|
+
/** Invalidate an unsynced review and resume the same iteration without touching Local. */
|
|
69
|
+
resumeRevision(sessionId: string, expectedRevision: number, expectedReviewId: string): Promise<SessionTargetView>;
|
|
57
70
|
markReadyForReview(sessionId: string, input: MarkReadyForReviewInput): Promise<SessionTargetView>;
|
|
58
71
|
operate(input: SessionCheckoutOperation): Promise<SessionCheckoutOperationResult>;
|
|
59
72
|
listManagedWorktrees(input?: ListManagedWorktreesInput): Promise<ManagedWorktreeSummaryView[]>;
|
|
73
|
+
/** Caller-scoped list for model and human session surfaces. */
|
|
74
|
+
listManagedWorktreesForSession(sessionId: string, input?: Omit<ListManagedWorktreesInput, 'projectId'>): Promise<ManagedWorktreeSummaryView[]>;
|
|
75
|
+
/** Caller-scoped management; never treats persisted owner ids as authorization. */
|
|
76
|
+
manageManagedWorktreeForSession(sessionId: string, input: ManageManagedWorktreeInput): Promise<ManagedWorktreeSummaryView>;
|
|
60
77
|
/** Main-owned read-only cleanup inspection; writes no registry, refs, or directories. */
|
|
61
78
|
inspectManagedWorktreeCleanup(input?: ListManagedWorktreesInput): Promise<ManagedWorktreeSummaryView[]>;
|
|
62
79
|
bulkCleanupManagedWorktrees(candidates: BulkCleanupManagedWorktreeCandidate[]): Promise<BulkCleanupManagedWorktreesResult>;
|
|
@@ -66,11 +83,12 @@ export interface SessionCheckoutModule {
|
|
|
66
83
|
cleanupExpiredRetained(now?: number): Promise<string[]>;
|
|
67
84
|
reconcile(): Promise<SessionCheckoutReconcileSummary>;
|
|
68
85
|
}
|
|
86
|
+
export * from './console-contract.js';
|
|
69
87
|
export declare const inject: string[];
|
|
70
88
|
/**
|
|
71
|
-
* Mount the plugin: DSH adapters, the session-checkout module,
|
|
72
|
-
*
|
|
73
|
-
*
|
|
89
|
+
* Mount the plugin: DSH adapters, the session-checkout module, safe worktree
|
|
90
|
+
* tools, human acceptance command, dynamic target context, startup recovery,
|
|
91
|
+
* and the retention-expiry timer.
|
|
74
92
|
*/
|
|
75
93
|
export declare function apply(ctx: Context, config?: {
|
|
76
94
|
stateDir?: string;
|
package/lib/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* dsh-git-worktree plugin entry. The session-checkout domain (state machine,
|
|
3
3
|
* apply engine, ports) is Domi-ported and host-agnostic; this file is the DSH
|
|
4
|
-
* plugin face: exports the domain error type and
|
|
5
|
-
*
|
|
6
|
-
* `/worktree`
|
|
4
|
+
* plugin face: exports the domain error type and module contract, builds the
|
|
5
|
+
* DSH adapters, mounts the state machine, and registers safe model tools,
|
|
6
|
+
* human `/worktree` acceptance commands, and Session Target runtime context.
|
|
7
7
|
* @module dsh-git-worktree
|
|
8
8
|
*/
|
|
9
9
|
/** Stable domain failure raised by the session-checkout state machine and its adapters. */
|
|
@@ -32,6 +32,11 @@ import { createSessionCheckoutApplyEngine } from './session-checkout-apply.js';
|
|
|
32
32
|
import { createSessionCheckoutModule } from './session-checkout-module.js';
|
|
33
33
|
import { registerTools } from './tools.js';
|
|
34
34
|
import { registerWorktreeCommand } from './commands.js';
|
|
35
|
+
import { registerSessionTargetContext } from './session-target-context.js';
|
|
36
|
+
import { createWorktreeConsoleControlPlane } from './console-host/control-plane.js';
|
|
37
|
+
import { createGitWorktreeReviewDiffReader } from './console-host/review-diff.js';
|
|
38
|
+
import { WorktreeConsoleService } from './console-host/service.js';
|
|
39
|
+
export * from './console-contract.js';
|
|
35
40
|
const name = 'git-worktree';
|
|
36
41
|
// Named export: the loader reads inject/apply named exports as plugin
|
|
37
42
|
// metadata. A bare function export mounts with no injection list, and the
|
|
@@ -54,26 +59,39 @@ function resolveStateDir(config) {
|
|
|
54
59
|
}
|
|
55
60
|
const RETENTION_MAINTENANCE_INTERVAL_MS = 15 * 60 * 1000;
|
|
56
61
|
/**
|
|
57
|
-
* Mount the plugin: DSH adapters, the session-checkout module,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
62
|
+
* Mount the plugin: DSH adapters, the session-checkout module, safe worktree
|
|
63
|
+
* tools, human acceptance command, dynamic target context, startup recovery,
|
|
64
|
+
* and the retention-expiry timer.
|
|
60
65
|
*/
|
|
61
66
|
export function apply(ctx, config = {}) {
|
|
62
67
|
const stateDir = resolveStateDir(config);
|
|
63
68
|
mkdirSync(stateDir, { recursive: true });
|
|
64
69
|
const hooksPath = join(stateDir, 'disabled-git-hooks');
|
|
65
70
|
mkdirSync(hooksPath, { recursive: true });
|
|
71
|
+
const lookup = createDshLookupPort(ctx);
|
|
72
|
+
const git = createDshGitPort(ctx, { hooksPath });
|
|
73
|
+
const files = createNodeFilesPort();
|
|
74
|
+
const registry = new AtomicJsonCheckoutRegistry(join(stateDir, 'managed-checkouts.json'));
|
|
66
75
|
const module = createSessionCheckoutModule({
|
|
67
|
-
lookup
|
|
68
|
-
git
|
|
69
|
-
files
|
|
70
|
-
registry
|
|
76
|
+
lookup,
|
|
77
|
+
git,
|
|
78
|
+
files,
|
|
79
|
+
registry,
|
|
71
80
|
applyEngine: createSessionCheckoutApplyEngine(),
|
|
72
81
|
managedCheckoutsRoot: stateDir,
|
|
73
82
|
createCheckoutId: randomUUID,
|
|
74
83
|
});
|
|
84
|
+
new WorktreeConsoleService(ctx, createWorktreeConsoleControlPlane({
|
|
85
|
+
module,
|
|
86
|
+
lookup,
|
|
87
|
+
files,
|
|
88
|
+
registry,
|
|
89
|
+
git,
|
|
90
|
+
reviewDiff: createGitWorktreeReviewDiffReader(),
|
|
91
|
+
}));
|
|
75
92
|
registerTools(ctx, module);
|
|
76
93
|
registerWorktreeCommand(ctx, module);
|
|
94
|
+
registerSessionTargetContext(ctx, module);
|
|
77
95
|
// Startup recovery plus periodic expiry of retained worktrees. cordis's
|
|
78
96
|
// typed Events map omits the runtime 'ready' event; the events service's
|
|
79
97
|
// loose runtime signature covers it.
|
package/lib/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,2FAA2F;AAC3F,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA0B;IAEvC;;;OAGG;IACH,YAAY,IAA8B,EAAE,OAAe;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH,2FAA2F;AAC3F,MAAM,OAAO,oBAAqB,SAAQ,KAAK;IACpC,IAAI,CAA0B;IAEvC;;;OAGG;IACH,YAAY,IAA8B,EAAE,OAAe;QACzD,KAAK,CAAC,OAAO,CAAC,CAAA;QACd,IAAI,CAAC,IAAI,GAAG,sBAAsB,CAAA;QAClC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;CACF;AA6ED,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AACxC,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,S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CAAC,CAAA;IAC1B,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IACpC,4BAA4B,CAAC,GAAG,EAAE,MAAM,CAAC,CAAA;IAEzC,wEAAwE;IACxE,yEAAyE;IACzE,qCAAqC;IACrC,MAAM,gBAAgB,GAAG,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,EAAE;QACnD,KAAK,MAAM,CAAC,SAAS,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACtC,OAAO,CAAC,IAAI,CAAC,sCAAsC,EAAE,KAAK,CAAC,CAAA;QAC7D,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;IACF,MAAM,cAAc,GAAG,WAAW,CAAC,GAAG,EAAE;QACtC,KAAK,MAAM,CAAC,sBAAsB,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;YACnD,OAAO,CAAC,IAAI,CAAC,0DAA0D,EAAE,KAAK,CAAC,CAAA;QACjF,CAAC,CAAC,CAAA;IACJ,CAAC,EAAE,iCAAiC,CAAC,CAAA;IACrC,cAAc,CAAC,KAAK,EAAE,EAAE,CAAA;IACxB,GAAG,CAAC,MAAM,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE;QACpB,gBAAgB,EAAE,CAAA;QAClB,aAAa,CAAC,cAAc,CAAC,CAAA;IAC/B,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export declare function sanitizeManagedWorktreeLabel(
|
|
1
|
+
/** Convert a canonical repository basename into one safe, readable path segment. */
|
|
2
|
+
export declare function sanitizeManagedWorktreeLabel(rawName: string | undefined): string;
|
|
3
|
+
/** Stable fallback partition that distinguishes repositories sharing one basename. */
|
|
4
|
+
export declare function createManagedWorktreeRepositoryKey(canonicalGitRoot: string): string;
|
|
5
|
+
/** Physical basename: repository identity + trusted checkout identity only. */
|
|
3
6
|
export declare function createManagedWorktreeDirectoryName(input: {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
iteration?: number;
|
|
7
|
+
repositoryName: string;
|
|
8
|
+
checkoutId: string;
|
|
9
|
+
identityLength?: number;
|
|
8
10
|
}): string;
|
|
9
11
|
export interface ManagedWorktreePathCandidates {
|
|
10
12
|
siblingContainer: string;
|
|
11
13
|
siblingRoot: string;
|
|
14
|
+
fallbackContainer: string;
|
|
12
15
|
fallbackRoot: string;
|
|
13
16
|
}
|
|
14
17
|
/**
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
+
* Generate one collision-length candidate without touching the filesystem.
|
|
19
|
+
* The caller probes 8/12/full checkout identities and chooses the first path
|
|
20
|
+
* that does not already exist.
|
|
18
21
|
*/
|
|
19
22
|
export declare function createManagedWorktreePathCandidates(input: {
|
|
20
23
|
localGitRoot: string;
|
|
21
24
|
managedCheckoutsRoot: string;
|
|
22
25
|
repositoryKey: string;
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
checkoutId?: string;
|
|
26
|
-
iteration?: number;
|
|
26
|
+
checkoutId: string;
|
|
27
|
+
identityLength?: number;
|
|
27
28
|
}): ManagedWorktreePathCandidates;
|