@cerbur/clutch-dsh-worktree 0.1.5 → 0.1.7
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/README.md +167 -24
- package/README.zh.md +141 -19
- package/cordis.patch.yml +21 -0
- package/lib/client/WorktreeContext.d.ts.map +1 -1
- package/lib/client/WorktreeContext.js +2 -2
- package/lib/client/WorktreeContext.js.map +1 -1
- package/lib/client/WorktreeHeroContext.d.ts +1 -1
- package/lib/client/WorktreeHeroContext.js +1 -1
- package/lib/client/WorktreeSurface.d.ts +2 -2
- package/lib/client/WorktreeSurface.d.ts.map +1 -1
- package/lib/client/WorktreeSurface.js +592 -124
- package/lib/client/WorktreeSurface.js.map +1 -1
- package/lib/client/entry.d.ts.map +1 -1
- package/lib/client/entry.js +87 -2
- package/lib/client/entry.js.map +1 -1
- package/lib/client/index.d.ts +3 -0
- package/lib/client/index.d.ts.map +1 -1
- package/lib/client/index.js +2 -0
- package/lib/client/index.js.map +1 -1
- package/lib/client/locales.d.ts +82 -0
- package/lib/client/locales.d.ts.map +1 -1
- package/lib/client/locales.js +84 -2
- package/lib/client/locales.js.map +1 -1
- package/lib/client/session-view.d.ts +34 -0
- package/lib/client/session-view.d.ts.map +1 -1
- package/lib/client/session-view.js +119 -1
- package/lib/client/session-view.js.map +1 -1
- package/lib/client/virtual-workspace-membership.js +1 -1
- package/lib/client/virtual-workspace-membership.js.map +1 -1
- package/lib/client/worktree-connection.d.ts +6 -2
- package/lib/client/worktree-connection.d.ts.map +1 -1
- package/lib/client/worktree-connection.js +8 -0
- package/lib/client/worktree-connection.js.map +1 -1
- package/lib/client/worktree-error-copy.d.ts +2 -0
- package/lib/client/worktree-error-copy.d.ts.map +1 -1
- package/lib/client/worktree-error-copy.js +22 -0
- package/lib/client/worktree-error-copy.js.map +1 -1
- package/lib/client/worktree-expand-state.d.ts +33 -0
- package/lib/client/worktree-expand-state.d.ts.map +1 -0
- package/lib/client/worktree-expand-state.js +83 -0
- package/lib/client/worktree-expand-state.js.map +1 -0
- package/lib/client/worktree-permission-icon.d.ts +7 -0
- package/lib/client/worktree-permission-icon.d.ts.map +1 -0
- package/lib/client/worktree-permission-icon.js +119 -0
- package/lib/client/worktree-permission-icon.js.map +1 -0
- package/lib/client/worktree-permission.d.ts +21 -0
- package/lib/client/worktree-permission.d.ts.map +1 -0
- package/lib/client/worktree-permission.js +70 -0
- package/lib/client/worktree-permission.js.map +1 -0
- package/lib/client/worktree-session-fork.d.ts +65 -0
- package/lib/client/worktree-session-fork.d.ts.map +1 -0
- package/lib/client/worktree-session-fork.js +174 -0
- package/lib/client/worktree-session-fork.js.map +1 -0
- package/lib/client/worktree-session-order.d.ts +36 -0
- package/lib/client/worktree-session-order.d.ts.map +1 -0
- package/lib/client/worktree-session-order.js +215 -0
- package/lib/client/worktree-session-order.js.map +1 -0
- package/lib/client/worktree-session-position.d.ts +2 -0
- package/lib/client/worktree-session-position.d.ts.map +1 -0
- package/lib/client/worktree-session-position.js +11 -0
- package/lib/client/worktree-session-position.js.map +1 -0
- package/lib/client/worktree-session.d.ts +34 -1
- package/lib/client/worktree-session.d.ts.map +1 -1
- package/lib/client/worktree-session.js +98 -2
- package/lib/client/worktree-session.js.map +1 -1
- package/lib/client/worktree-surface-dialogs.d.ts +1 -1
- package/lib/client/worktree-surface-dialogs.d.ts.map +1 -1
- package/lib/client/worktree-surface-dialogs.js +30 -13
- package/lib/client/worktree-surface-dialogs.js.map +1 -1
- package/lib/client/worktree-surface-rows.d.ts +4 -4
- package/lib/client/worktree-surface-rows.d.ts.map +1 -1
- package/lib/client/worktree-surface-rows.js +132 -47
- package/lib/client/worktree-surface-rows.js.map +1 -1
- package/lib/client/worktree-surface-selectors.d.ts +18 -0
- package/lib/client/worktree-surface-selectors.d.ts.map +1 -1
- package/lib/client/worktree-surface-selectors.js +62 -0
- package/lib/client/worktree-surface-selectors.js.map +1 -1
- package/lib/client/worktree-surface-types.d.ts +73 -3
- package/lib/client/worktree-surface-types.d.ts.map +1 -1
- package/lib/client/worktree-view-actions.d.ts +11 -3
- package/lib/client/worktree-view-actions.d.ts.map +1 -1
- package/lib/client/worktree-view-actions.js +31 -2
- package/lib/client/worktree-view-actions.js.map +1 -1
- package/lib/client/worktree-view-errors.d.ts +10 -0
- package/lib/client/worktree-view-errors.d.ts.map +1 -1
- package/lib/client/worktree-view-errors.js +22 -1
- package/lib/client/worktree-view-errors.js.map +1 -1
- package/lib/client/worktree-view-read.d.ts +8 -0
- package/lib/client/worktree-view-read.d.ts.map +1 -1
- package/lib/client/worktree-view-read.js +19 -0
- package/lib/client/worktree-view-read.js.map +1 -1
- package/lib/client.js +2047 -264
- package/lib/client.js.map +1 -1
- package/lib/contract/index.contract.js +16 -0
- package/lib/contract/index.contract.js.map +1 -1
- package/lib/contract/index.d.ts +26 -2
- package/lib/contract/index.d.ts.map +1 -1
- package/lib/contract/index.js +8 -0
- package/lib/contract/index.js.map +1 -1
- package/lib/contract/worktree-permission.d.ts +73 -0
- package/lib/contract/worktree-permission.d.ts.map +1 -0
- package/lib/contract/worktree-permission.js +32 -0
- package/lib/contract/worktree-permission.js.map +1 -0
- package/lib/host/index.d.ts +4 -0
- package/lib/host/index.d.ts.map +1 -1
- package/lib/host/index.js +2 -0
- package/lib/host/index.js.map +1 -1
- package/lib/host/remote.d.ts +2 -2
- package/lib/host/remote.d.ts.map +1 -1
- package/lib/host/remote.js +9 -1
- package/lib/host/remote.js.map +1 -1
- package/lib/host/service.d.ts +10 -1
- package/lib/host/service.d.ts.map +1 -1
- package/lib/host/service.js +48 -2
- package/lib/host/service.js.map +1 -1
- package/lib/host/worktree-permission-manager.d.ts +14 -0
- package/lib/host/worktree-permission-manager.d.ts.map +1 -0
- package/lib/host/worktree-permission-manager.js +111 -0
- package/lib/host/worktree-permission-manager.js.map +1 -0
- package/lib/host/worktree-permission.d.ts +38 -0
- package/lib/host/worktree-permission.d.ts.map +1 -0
- package/lib/host/worktree-permission.js +156 -0
- package/lib/host/worktree-permission.js.map +1 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +2 -1
- package/lib/index.js.map +1 -1
- package/lib/manage/manager-support.d.ts +2 -0
- package/lib/manage/manager-support.d.ts.map +1 -1
- package/lib/manage/manager-support.js +9 -0
- package/lib/manage/manager-support.js.map +1 -1
- package/lib/manage/manager-worktrees.d.ts +10 -1
- package/lib/manage/manager-worktrees.d.ts.map +1 -1
- package/lib/manage/manager-worktrees.js +121 -5
- package/lib/manage/manager-worktrees.js.map +1 -1
- package/lib/manage/manager.d.ts +8 -1
- package/lib/manage/manager.d.ts.map +1 -1
- package/lib/manage/manager.js +7 -1
- package/lib/manage/manager.js.map +1 -1
- package/lib/manage/worktree-permission.d.ts +3 -0
- package/lib/manage/worktree-permission.d.ts.map +1 -0
- package/lib/manage/worktree-permission.js +3 -0
- package/lib/manage/worktree-permission.js.map +1 -0
- package/lib/provider/git.d.ts +2 -0
- package/lib/provider/git.d.ts.map +1 -1
- package/lib/provider/git.js +23 -1
- package/lib/provider/git.js.map +1 -1
- package/lib/provider/index.d.ts +1 -1
- package/lib/provider/index.d.ts.map +1 -1
- package/lib/provider/index.js +1 -1
- package/lib/provider/index.js.map +1 -1
- package/lib/provider/sidecar-schema.d.ts +1 -1
- package/lib/provider/sidecar-schema.d.ts.map +1 -1
- package/lib/provider/sidecar-schema.js +33 -37
- package/lib/provider/sidecar-schema.js.map +1 -1
- package/lib/provider/sidecar.d.ts.map +1 -1
- package/lib/provider/sidecar.js +3 -1
- package/lib/provider/sidecar.js.map +1 -1
- package/lib/provider/types.d.ts +9 -1
- package/lib/provider/types.d.ts.map +1 -1
- package/lib/provider/types.js +2 -1
- package/lib/provider/types.js.map +1 -1
- package/lib/typert.host.js +214 -21
- package/lib/typert.remote-client.d.ts +9 -1
- package/lib/typert.remote-client.d.ts.map +1 -1
- package/lib/typert.remote-client.js +214 -21
- package/package.json +30 -30
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
// These lists are deliberately independent of the interfaces so omissions or accidental expansion fail at type-check time.
|
|
3
3
|
const expectedManagerKeys = [
|
|
4
4
|
'listWorktrees',
|
|
5
|
+
'listImportCandidates',
|
|
5
6
|
'listBranches',
|
|
6
7
|
'createWorktree',
|
|
8
|
+
'importWorktree',
|
|
7
9
|
'removeWorktree',
|
|
8
10
|
'insertWorktreeBefore',
|
|
9
11
|
'listBindings',
|
|
@@ -11,15 +13,21 @@ const expectedManagerKeys = [
|
|
|
11
13
|
];
|
|
12
14
|
const expectedRemoteKeys = [
|
|
13
15
|
'listWorktrees',
|
|
16
|
+
'listImportCandidates',
|
|
14
17
|
'listBranches',
|
|
15
18
|
'createWorktree',
|
|
19
|
+
'importWorktree',
|
|
16
20
|
'removeWorktree',
|
|
17
21
|
'insertWorktreeBefore',
|
|
18
22
|
'listBindings',
|
|
19
23
|
'bindSession',
|
|
24
|
+
'ensureWorktreePermission',
|
|
25
|
+
'normalizeDetachedWorktreePermissions',
|
|
20
26
|
];
|
|
21
27
|
const managerKeysMatchSpec = true;
|
|
22
28
|
const remoteKeysMatchSpec = true;
|
|
29
|
+
const importManagerMethodsAreRequired = true;
|
|
30
|
+
const importRemoteMethodsAreRequired = true;
|
|
23
31
|
// 这些编译契约 fixture 固定公开 DTO 的最小可构造形状;它们不导出,也不充当运行时 validator。
|
|
24
32
|
// These compile-contract fixtures pin the minimum constructible public DTO shapes; they are neither exported nor used as runtime validators.
|
|
25
33
|
const worktree = {
|
|
@@ -27,8 +35,13 @@ const worktree = {
|
|
|
27
35
|
workspaceId: 'ws_example',
|
|
28
36
|
absolutePath: '/tmp/dsh/worktree/wt_example',
|
|
29
37
|
branch: 'feature/example',
|
|
38
|
+
source: 'plugin',
|
|
30
39
|
status: 'active',
|
|
31
40
|
};
|
|
41
|
+
const importCandidate = {
|
|
42
|
+
absolutePath: '/tmp/external/worktree',
|
|
43
|
+
branch: 'feature/external',
|
|
44
|
+
};
|
|
32
45
|
const branch = {
|
|
33
46
|
name: 'feature/example',
|
|
34
47
|
isCurrent: false,
|
|
@@ -44,9 +57,12 @@ const binding = {
|
|
|
44
57
|
// `void` only satisfies no-unused checks; the contract proofs are the type assignments above.
|
|
45
58
|
void managerKeysMatchSpec;
|
|
46
59
|
void remoteKeysMatchSpec;
|
|
60
|
+
void importManagerMethodsAreRequired;
|
|
61
|
+
void importRemoteMethodsAreRequired;
|
|
47
62
|
void expectedManagerKeys;
|
|
48
63
|
void expectedRemoteKeys;
|
|
49
64
|
void worktree;
|
|
65
|
+
void importCandidate;
|
|
50
66
|
void branch;
|
|
51
67
|
void binding;
|
|
52
68
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.contract.js","sourceRoot":"","sources":["../../src/contract/index.contract.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.contract.js","sourceRoot":"","sources":["../../src/contract/index.contract.ts"],"names":[],"mappings":"AASA,iDAAiD;AACjD,2HAA2H;AAC3H,MAAM,mBAAmB,GAAG;IAC1B,eAAe;IACf,sBAAsB;IACtB,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,cAAc;IACd,aAAa;CACL,CAAC;AACX,MAAM,kBAAkB,GAAG;IACzB,eAAe;IACf,sBAAsB;IACtB,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,cAAc;IACd,aAAa;IACb,0BAA0B;IAC1B,sCAAsC;CAC9B,CAAC;AA6BX,MAAM,oBAAoB,GAAyB,IAAI,CAAC;AACxD,MAAM,mBAAmB,GAAwB,IAAI,CAAC;AACtD,MAAM,+BAA+B,GAAoC,IAAI,CAAC;AAC9E,MAAM,8BAA8B,GAAmC,IAAI,CAAC;AAE5E,4DAA4D;AAC5D,6IAA6I;AAC7I,MAAM,QAAQ,GAAmB;IAC/B,UAAU,EAAE,YAAY;IACxB,WAAW,EAAE,YAAY;IACzB,YAAY,EAAE,8BAA8B;IAC5C,MAAM,EAAE,iBAAiB;IACzB,MAAM,EAAE,QAAQ;IAChB,MAAM,EAAE,QAAQ;CACjB,CAAC;AACF,MAAM,eAAe,GAA4B;IAC/C,YAAY,EAAE,wBAAwB;IACtC,MAAM,EAAE,kBAAkB;CAC3B,CAAC;AACF,MAAM,MAAM,GAAiB;IAC3B,IAAI,EAAE,iBAAiB;IACvB,SAAS,EAAE,KAAK;IAChB,UAAU,EAAE,KAAK;CAClB,CAAC;AACF,MAAM,OAAO,GAAmB;IAC9B,WAAW,EAAE,YAAY;IACzB,UAAU,EAAE,YAAY;IACxB,SAAS,EAAE,iBAAiB;IAC5B,MAAM,EAAE,QAAQ;CACjB,CAAC;AAEF,8CAA8C;AAC9C,8FAA8F;AAC9F,KAAK,oBAAoB,CAAC;AAC1B,KAAK,mBAAmB,CAAC;AACzB,KAAK,+BAA+B,CAAC;AACrC,KAAK,8BAA8B,CAAC;AACpC,KAAK,mBAAmB,CAAC;AACzB,KAAK,kBAAkB,CAAC;AACxB,KAAK,QAAQ,CAAC;AACd,KAAK,eAAe,CAAC;AACrB,KAAK,MAAM,CAAC;AACZ,KAAK,OAAO,CAAC"}
|
package/lib/contract/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { WorktreePermissionNormalizationRequest, WorktreePermissionRequest, WorktreePermissionResult } from './worktree-permission.js';
|
|
1
2
|
/**
|
|
2
3
|
* 插件的稳定、浏览器安全契约层;这里只定义领域值与服务形状,不依赖 Git、sidecar 或 Node runtime。
|
|
3
4
|
* Stable, browser-safe contract layer for the plugin; it defines domain values and service shapes without Git, sidecar, or Node runtime dependencies.
|
|
@@ -8,7 +9,7 @@
|
|
|
8
9
|
* 跨 Host/浏览器边界保持稳定的领域错误码;新增、删除或重命名成员都属于公开契约变更。
|
|
9
10
|
* Stable domain error codes shared across the Host/browser boundary; adding, removing, or renaming a member is a public contract change.
|
|
10
11
|
*/
|
|
11
|
-
export declare const WORKTREE_ERROR_CODES: readonly ["WORKSPACE_NOT_FOUND", "WORKSPACE_NOT_GIT_REPOSITORY", "GIT_NOT_INSTALLED", "WORKTREE_REQUIRES_INITIAL_COMMIT", "WORKTREE_BRANCH_CONFLICT", "WORKTREE_NOT_FOUND", "WORKTREE_ORDER_INVALID", "WORKTREE_REMOVED", "SESSION_NOT_FOUND", "SESSION_CWD_MISMATCH", "SESSION_ALREADY_BOUND", "SIDECAR_UNAVAILABLE", "SIDECAR_CORRUPT", "SIDECAR_SYNC_REQUIRED", "GIT_OPERATION_FAILED"];
|
|
12
|
+
export declare const WORKTREE_ERROR_CODES: readonly ["WORKSPACE_NOT_FOUND", "WORKSPACE_NOT_GIT_REPOSITORY", "GIT_NOT_INSTALLED", "WORKTREE_REQUIRES_INITIAL_COMMIT", "WORKTREE_BRANCH_CONFLICT", "WORKTREE_NOT_FOUND", "WORKTREE_ORDER_INVALID", "WORKTREE_REMOVED", "WORKTREE_IMPORT_INVALID", "WORKTREE_ALREADY_MANAGED", "SESSION_NOT_FOUND", "SESSION_CWD_MISMATCH", "SESSION_ALREADY_BOUND", "SIDECAR_UNAVAILABLE", "SIDECAR_CORRUPT", "SIDECAR_SYNC_REQUIRED", "GIT_OPERATION_FAILED", "WORKTREE_PERMISSION_BINDING_REQUIRED"];
|
|
12
13
|
export type WorktreeErrorCode = (typeof WORKTREE_ERROR_CODES)[number];
|
|
13
14
|
export type WorkspaceId = string;
|
|
14
15
|
export type WorktreeId = string;
|
|
@@ -18,6 +19,8 @@ export type SessionId = string;
|
|
|
18
19
|
* Persisted Worktree lifecycle; `removed` records remain available to detached relations and repair flows.
|
|
19
20
|
*/
|
|
20
21
|
export type WorktreeStatus = 'active' | 'removed';
|
|
22
|
+
export type WorktreeSource = 'plugin' | 'external';
|
|
23
|
+
export * from './worktree-permission.js';
|
|
21
24
|
/** Runtime-only Git health projection; this value is never persisted in the sidecar. */
|
|
22
25
|
export type WorktreeHealth = 'ready' | 'repair';
|
|
23
26
|
/**
|
|
@@ -34,10 +37,15 @@ export interface WorktreeRecord {
|
|
|
34
37
|
readonly workspaceId: WorkspaceId;
|
|
35
38
|
readonly absolutePath: string;
|
|
36
39
|
readonly branch: string;
|
|
40
|
+
readonly source: WorktreeSource;
|
|
37
41
|
readonly status: WorktreeStatus;
|
|
38
42
|
/** Runtime-only; never written to the sidecar. */
|
|
39
43
|
readonly health?: WorktreeHealth;
|
|
40
44
|
}
|
|
45
|
+
export interface WorktreeImportCandidate {
|
|
46
|
+
readonly absolutePath: string;
|
|
47
|
+
readonly branch: string;
|
|
48
|
+
}
|
|
41
49
|
/**
|
|
42
50
|
* 面向分支选择器的 Git 投影;`isCurrent` 指主 Workspace,`checkedOut` 覆盖任意已注册 worktree。
|
|
43
51
|
* Git projection for branch selection; `isCurrent` identifies the main Workspace and `checkedOut` covers any registered worktree.
|
|
@@ -88,6 +96,9 @@ export interface WorktreeManager {
|
|
|
88
96
|
listWorktrees(input: {
|
|
89
97
|
workspaceId: WorkspaceId;
|
|
90
98
|
}): Promise<readonly WorktreeRecord[]>;
|
|
99
|
+
listImportCandidates(input: {
|
|
100
|
+
readonly workspaceId: string;
|
|
101
|
+
}): Promise<readonly WorktreeImportCandidate[]>;
|
|
91
102
|
/**
|
|
92
103
|
* 列出本地分支及其主 Workspace/任意 worktree checkout 状态。
|
|
93
104
|
* Lists local branches together with their main-Workspace and any-worktree checkout state.
|
|
@@ -107,6 +118,10 @@ export interface WorktreeManager {
|
|
|
107
118
|
branch: string;
|
|
108
119
|
newBranch?: string;
|
|
109
120
|
}): Promise<WorktreeRecord>;
|
|
121
|
+
importWorktree(input: {
|
|
122
|
+
readonly workspaceId: string;
|
|
123
|
+
readonly absolutePath: string;
|
|
124
|
+
}): Promise<WorktreeRecord>;
|
|
110
125
|
/**
|
|
111
126
|
* 删除 Git Worktree 后保留 record,并将其 active bindings 转为 detached;不会删除任何 DSH Session。
|
|
112
127
|
* Removes the Git Worktree while retaining its record and detaching active bindings; no DSH Session is deleted.
|
|
@@ -146,7 +161,7 @@ export interface WorktreeManager {
|
|
|
146
161
|
* Browser Remote 可调用的方法白名单;runtime cwd 解析刻意不进入该边界。
|
|
147
162
|
* Allowlist of Browser Remote methods; runtime cwd resolution is intentionally excluded from this boundary.
|
|
148
163
|
*/
|
|
149
|
-
export declare const WORKTREE_REMOTE_METHODS: readonly ["listWorktrees", "listBranches", "createWorktree", "removeWorktree", "insertWorktreeBefore", "listBindings", "bindSession"];
|
|
164
|
+
export declare const WORKTREE_REMOTE_METHODS: readonly ["listWorktrees", "listImportCandidates", "listBranches", "createWorktree", "importWorktree", "removeWorktree", "insertWorktreeBefore", "listBindings", "bindSession", "ensureWorktreePermission", "normalizeDetachedWorktreePermissions"];
|
|
150
165
|
export type WorktreeRemoteMethod = (typeof WORKTREE_REMOTE_METHODS)[number];
|
|
151
166
|
/**
|
|
152
167
|
* Remote 的可辨识结果:已知领域失败作为数据返回,未知或未分类异常仍由 Host 抛出。
|
|
@@ -167,6 +182,9 @@ export interface WorktreeRemoteManager {
|
|
|
167
182
|
listWorktrees(input: {
|
|
168
183
|
workspaceId: WorkspaceId;
|
|
169
184
|
}): Promise<WorktreeRemoteResult<readonly WorktreeRecord[]>>;
|
|
185
|
+
listImportCandidates(input: {
|
|
186
|
+
workspaceId: WorkspaceId;
|
|
187
|
+
}): Promise<WorktreeRemoteResult<readonly WorktreeImportCandidate[]>>;
|
|
170
188
|
listBranches(input: {
|
|
171
189
|
workspaceId: WorkspaceId;
|
|
172
190
|
}): Promise<WorktreeRemoteResult<readonly BranchRecord[]>>;
|
|
@@ -175,6 +193,10 @@ export interface WorktreeRemoteManager {
|
|
|
175
193
|
branch: string;
|
|
176
194
|
newBranch?: string;
|
|
177
195
|
}): Promise<WorktreeRemoteResult<WorktreeRecord>>;
|
|
196
|
+
importWorktree(input: {
|
|
197
|
+
workspaceId: WorkspaceId;
|
|
198
|
+
absolutePath: string;
|
|
199
|
+
}): Promise<WorktreeRemoteResult<WorktreeRecord>>;
|
|
178
200
|
removeWorktree(input: {
|
|
179
201
|
workspaceId: WorkspaceId;
|
|
180
202
|
worktreeId: WorktreeId;
|
|
@@ -192,5 +214,7 @@ export interface WorktreeRemoteManager {
|
|
|
192
214
|
worktreeId: WorktreeId;
|
|
193
215
|
sessionId: SessionId;
|
|
194
216
|
}): Promise<WorktreeRemoteResult<SessionBinding>>;
|
|
217
|
+
ensureWorktreePermission(input: WorktreePermissionRequest): Promise<WorktreeRemoteResult<WorktreePermissionResult>>;
|
|
218
|
+
normalizeDetachedWorktreePermissions(input: WorktreePermissionNormalizationRequest): Promise<WorktreeRemoteResult<WorktreePermissionResult>>;
|
|
195
219
|
}
|
|
196
220
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,sCAAsC,EACtC,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,0BAA0B,CAAC;AAElC;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,oBAAoB,2dAmBtB,CAAC;AAEZ,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,oBAAoB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC;AACjC,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC;AAChC,MAAM,MAAM,SAAS,GAAG,MAAM,CAAC;AAE/B;;;GAGG;AACH,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,SAAS,CAAC;AAElD,MAAM,MAAM,cAAc,GAAG,QAAQ,GAAG,UAAU,CAAC;AAEnD,cAAc,0BAA0B,CAAC;AAEzC,wFAAwF;AACxF,MAAM,MAAM,cAAc,GAAG,O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KAAK,EAAE,yBAAyB,GAC/B,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,CAAC;IAE3D,oCAAoC,CAClC,KAAK,EAAE,sCAAsC,GAC5C,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC,CAAC;CAC5D"}
|
package/lib/contract/index.js
CHANGED
|
@@ -17,6 +17,8 @@ export const WORKTREE_ERROR_CODES = Object.freeze([
|
|
|
17
17
|
'WORKTREE_NOT_FOUND',
|
|
18
18
|
'WORKTREE_ORDER_INVALID',
|
|
19
19
|
'WORKTREE_REMOVED',
|
|
20
|
+
'WORKTREE_IMPORT_INVALID',
|
|
21
|
+
'WORKTREE_ALREADY_MANAGED',
|
|
20
22
|
'SESSION_NOT_FOUND',
|
|
21
23
|
'SESSION_CWD_MISMATCH',
|
|
22
24
|
'SESSION_ALREADY_BOUND',
|
|
@@ -24,7 +26,9 @@ export const WORKTREE_ERROR_CODES = Object.freeze([
|
|
|
24
26
|
'SIDECAR_CORRUPT',
|
|
25
27
|
'SIDECAR_SYNC_REQUIRED',
|
|
26
28
|
'GIT_OPERATION_FAILED',
|
|
29
|
+
'WORKTREE_PERMISSION_BINDING_REQUIRED',
|
|
27
30
|
]);
|
|
31
|
+
export * from './worktree-permission.js';
|
|
28
32
|
/**
|
|
29
33
|
* 创建错误 DTO 而不抛出异常,供 Host 将已识别的领域失败投影到 Remote result。
|
|
30
34
|
* Creates an error DTO without throwing, allowing the Host to project recognized domain failures into a Remote result.
|
|
@@ -38,11 +42,15 @@ export function createWorktreeError(code, message, details = {}) {
|
|
|
38
42
|
*/
|
|
39
43
|
export const WORKTREE_REMOTE_METHODS = Object.freeze([
|
|
40
44
|
'listWorktrees',
|
|
45
|
+
'listImportCandidates',
|
|
41
46
|
'listBranches',
|
|
42
47
|
'createWorktree',
|
|
48
|
+
'importWorktree',
|
|
43
49
|
'removeWorktree',
|
|
44
50
|
'insertWorktreeBefore',
|
|
45
51
|
'listBindings',
|
|
46
52
|
'bindSession',
|
|
53
|
+
'ensureWorktreePermission',
|
|
54
|
+
'normalizeDetachedWorktreePermissions',
|
|
47
55
|
]);
|
|
48
56
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/contract/index.ts"],"names":[],"mappings":"AAMA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,MAAM,CAAC,MAAM,CAAC;IAChD,qBAAqB;IACrB,8BAA8B;IAC9B,mBAAmB;IACnB,kCAAkC;IAClC,0BAA0B;IAC1B,oBAAoB;IACpB,wBAAwB;IACxB,kBAAkB;IAClB,yBAAyB;IACzB,0BAA0B;IAC1B,mBAAmB;IACnB,sBAAsB;IACtB,uBAAuB;IACvB,qBAAqB;IACrB,iBAAiB;IACjB,uBAAuB;IACvB,sBAAsB;IACtB,sCAAsC;CAC9B,CAAC,CAAC;AAgBZ,cAAc,0BAA0B,CAAC;AAmEzC;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAuB,EACvB,OAAe,EACf,UAAgC,EAAE;IAElC,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;AACpC,CAAC;AA2ED;;;GAGG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,CAAC;IACnD,eAAe;IACf,sBAAsB;IACtB,cAAc;IACd,gBAAgB;IAChB,gBAAgB;IAChB,gBAAgB;IAChB,sBAAsB;IACtB,cAAc;IACd,aAAa;IACb,0BAA0B;IAC1B,sCAAsC;CAC9B,CAAC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe Worktree permission vocabulary. DSH runtime services are
|
|
3
|
+
* intentionally absent; the Host adapts them to these plain values.
|
|
4
|
+
*/
|
|
5
|
+
export declare const WORKTREE_FULL_ACCESS_PRESET: "worktree-full-access";
|
|
6
|
+
export type WorktreePermissionBinding = 'active' | 'detached' | 'main' | 'unbound';
|
|
7
|
+
export type WorktreePermissionSandboxMode = 'read-only' | 'workspace-write' | 'danger-full-access';
|
|
8
|
+
export type WorktreePermissionApprovalPolicy = 'ask' | 'never';
|
|
9
|
+
export interface WorktreePermissionCurrentState {
|
|
10
|
+
readonly preset?: string;
|
|
11
|
+
readonly sandboxMode?: WorktreePermissionSandboxMode;
|
|
12
|
+
readonly approvalPolicy?: WorktreePermissionApprovalPolicy;
|
|
13
|
+
/** True when the current process has observed an explicit native UI choice. */
|
|
14
|
+
readonly explicitUserOverride: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface WorktreePermissionCapability {
|
|
17
|
+
readonly permissionService: boolean;
|
|
18
|
+
readonly fullPreset: boolean;
|
|
19
|
+
readonly workspaceWrite: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface WorktreePermissionDecisionInput {
|
|
22
|
+
readonly binding: WorktreePermissionBinding;
|
|
23
|
+
readonly current: WorktreePermissionCurrentState;
|
|
24
|
+
readonly capability: WorktreePermissionCapability;
|
|
25
|
+
}
|
|
26
|
+
export type WorktreePermissionDecision = {
|
|
27
|
+
readonly kind: 'apply-full';
|
|
28
|
+
readonly preset: typeof WORKTREE_FULL_ACCESS_PRESET;
|
|
29
|
+
} | {
|
|
30
|
+
readonly kind: 'preserve-user-restriction';
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'unverified';
|
|
33
|
+
} | {
|
|
34
|
+
readonly kind: 'fallback-workspace-write';
|
|
35
|
+
} | {
|
|
36
|
+
readonly kind: 'normalize-workspace-write';
|
|
37
|
+
} | {
|
|
38
|
+
readonly kind: 'no-op';
|
|
39
|
+
};
|
|
40
|
+
export type WorktreePermissionStatus = 'full-applied' | 'already-full' | 'confirmation-required' | 'fallback-workspace-write' | 'user-restricted' | 'unverified' | 'normalized-workspace-write' | 'no-op';
|
|
41
|
+
export interface WorktreePermissionResult {
|
|
42
|
+
readonly status: WorktreePermissionStatus;
|
|
43
|
+
readonly preset?: string;
|
|
44
|
+
readonly sandboxMode?: WorktreePermissionSandboxMode;
|
|
45
|
+
readonly approvalPolicy?: WorktreePermissionApprovalPolicy;
|
|
46
|
+
/** Session IDs considered by a detached-worktree normalization batch. */
|
|
47
|
+
readonly sessionIds?: readonly string[];
|
|
48
|
+
readonly retryable: boolean;
|
|
49
|
+
}
|
|
50
|
+
export interface WorktreePermissionRequest {
|
|
51
|
+
readonly workspaceId: string;
|
|
52
|
+
readonly worktreeId: string;
|
|
53
|
+
readonly sessionId: string;
|
|
54
|
+
readonly binding?: WorktreePermissionBinding;
|
|
55
|
+
readonly confirmed?: boolean;
|
|
56
|
+
}
|
|
57
|
+
export interface WorktreePermissionNormalizationRequest {
|
|
58
|
+
readonly workspaceId: string;
|
|
59
|
+
readonly worktreeId: string;
|
|
60
|
+
}
|
|
61
|
+
/** Browser-facing permission operation; it accepts no arbitrary DSH policy. */
|
|
62
|
+
export interface WorktreePermissionManager {
|
|
63
|
+
ensureWorktreePermission(input: WorktreePermissionRequest): Promise<WorktreePermissionResult>;
|
|
64
|
+
normalizeDetachedWorktreePermissions(input: WorktreePermissionNormalizationRequest): Promise<WorktreePermissionResult>;
|
|
65
|
+
}
|
|
66
|
+
/** Host-only adapter used by the Host composition layer. */
|
|
67
|
+
export interface WorktreePermissionPort {
|
|
68
|
+
ensure(input: WorktreePermissionRequest): Promise<WorktreePermissionResult>;
|
|
69
|
+
normalize(input: WorktreePermissionRequest): Promise<WorktreePermissionResult>;
|
|
70
|
+
}
|
|
71
|
+
/** Decide one permission transition without reading or mutating DSH state. */
|
|
72
|
+
export declare function decideWorktreePermission(input: WorktreePermissionDecisionInput): WorktreePermissionDecision;
|
|
73
|
+
//# sourceMappingURL=worktree-permission.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-permission.d.ts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BAAsB;IACrC,MAAM,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;IAC5E,SAAS,CAAC,KAAK,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAChF;AASD,8EAA8E;AAC9E,wBAAgB,wBAAwB,CACtC,KAAK,EAAE,+BAA+B,GACrC,0BAA0B,CAiB5B"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Browser-safe Worktree permission vocabulary. DSH runtime services are
|
|
3
|
+
* intentionally absent; the Host adapts them to these plain values.
|
|
4
|
+
*/
|
|
5
|
+
export const WORKTREE_FULL_ACCESS_PRESET = 'worktree-full-access';
|
|
6
|
+
function isFullAccess(current) {
|
|
7
|
+
return (current.preset === WORKTREE_FULL_ACCESS_PRESET ||
|
|
8
|
+
current.sandboxMode === 'danger-full-access');
|
|
9
|
+
}
|
|
10
|
+
/** Decide one permission transition without reading or mutating DSH state. */
|
|
11
|
+
export function decideWorktreePermission(input) {
|
|
12
|
+
if (input.binding === 'main' || input.binding === 'unbound')
|
|
13
|
+
return { kind: 'no-op' };
|
|
14
|
+
if (input.binding === 'detached') {
|
|
15
|
+
return isFullAccess(input.current)
|
|
16
|
+
? { kind: 'normalize-workspace-write' }
|
|
17
|
+
: { kind: 'no-op' };
|
|
18
|
+
}
|
|
19
|
+
if (input.current.explicitUserOverride)
|
|
20
|
+
return { kind: 'preserve-user-restriction' };
|
|
21
|
+
if (isFullAccess(input.current))
|
|
22
|
+
return { kind: 'no-op' };
|
|
23
|
+
if (!input.capability.permissionService)
|
|
24
|
+
return { kind: 'unverified' };
|
|
25
|
+
if (input.capability.fullPreset) {
|
|
26
|
+
return { kind: 'apply-full', preset: WORKTREE_FULL_ACCESS_PRESET };
|
|
27
|
+
}
|
|
28
|
+
if (input.capability.workspaceWrite)
|
|
29
|
+
return { kind: 'fallback-workspace-write' };
|
|
30
|
+
return { kind: 'unverified' };
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=worktree-permission.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree-permission.js","sourceRoot":"","sources":["../../src/contract/worktree-permission.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,CAAC,MAAM,2BAA2B,GAAG,sBAA+B,CAAC;AAsF3E,SAAS,YAAY,CAAC,OAAuC;IAC3D,OAAO,CACL,OAAO,CAAC,MAAM,KAAK,2BAA2B;QAC9C,OAAO,CAAC,WAAW,KAAK,oBAAoB,CAC7C,CAAC;AACJ,CAAC;AAED,8EAA8E;AAC9E,MAAM,UAAU,wBAAwB,CACtC,KAAsC;IAEtC,IAAI,KAAK,CAAC,OAAO,KAAK,MAAM,IAAI,KAAK,CAAC,OAAO,KAAK,SAAS;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAEtF,IAAI,KAAK,CAAC,OAAO,KAAK,UAAU,EAAE,CAAC;QACjC,OAAO,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;YAChC,CAAC,CAAC,EAAE,IAAI,EAAE,2BAA2B,EAAE;YACvC,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IACxB,CAAC;IAED,IAAI,KAAK,CAAC,OAAO,CAAC,oBAAoB;QAAE,OAAO,EAAE,IAAI,EAAE,2BAA2B,EAAE,CAAC;IACrF,IAAI,YAAY,CAAC,KAAK,CAAC,OAAO,CAAC;QAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC1D,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,iBAAiB;QAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;IACvE,IAAI,KAAK,CAAC,UAAU,CAAC,UAAU,EAAE,CAAC;QAChC,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,EAAE,2BAA2B,EAAE,CAAC;IACrE,CAAC;IACD,IAAI,KAAK,CAAC,UAAU,CAAC,cAAc;QAAE,OAAO,EAAE,IAAI,EAAE,0BAA0B,EAAE,CAAC;IACjF,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,CAAC;AAChC,CAAC"}
|
package/lib/host/index.d.ts
CHANGED
|
@@ -13,4 +13,8 @@ export type { DshHostReadContext } from './dsh-read-adapter.js';
|
|
|
13
13
|
export { createWorktreeRemoteProjection } from './remote.js';
|
|
14
14
|
export { WorktreeRemoteService } from './service.js';
|
|
15
15
|
export type { WorktreeHostConfig } from './service.js';
|
|
16
|
+
export { createDshWorktreePermissionAdapter, } from './worktree-permission.js';
|
|
17
|
+
export type { DshWorktreePermissionAdapterOptions } from './worktree-permission.js';
|
|
18
|
+
export { createWorktreePermissionManager, } from './worktree-permission-manager.js';
|
|
19
|
+
export type { WorktreePermissionManagerOptions } from './worktree-permission-manager.js';
|
|
16
20
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/host/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,YAAY,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAChE,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AACrD,YAAY,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAClC,YAAY,EAAE,mCAAmC,EAAE,MAAM,0BAA0B,CAAC;AACpF,OAAO,EACL,+BAA+B,GAChC,MAAM,kCAAkC,CAAC;AAC1C,YAAY,EAAE,gCAAgC,EAAE,MAAM,kCAAkC,CAAC"}
|
package/lib/host/index.js
CHANGED
|
@@ -11,4 +11,6 @@
|
|
|
11
11
|
export { DshHostReadAdapter } from './dsh-read-adapter.js';
|
|
12
12
|
export { createWorktreeRemoteProjection } from './remote.js';
|
|
13
13
|
export { WorktreeRemoteService } from './service.js';
|
|
14
|
+
export { createDshWorktreePermissionAdapter, } from './worktree-permission.js';
|
|
15
|
+
export { createWorktreePermissionManager, } from './worktree-permission-manager.js';
|
|
14
16
|
//# sourceMappingURL=index.js.map
|
package/lib/host/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/host/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAE3D,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAC;AAErD,OAAO,EACL,kCAAkC,GACnC,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,+BAA+B,GAChC,MAAM,kCAAkC,CAAC"}
|
package/lib/host/remote.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type WorktreeManager, type WorktreeRemoteManager } from '../contract/index.js';
|
|
1
|
+
import { type WorktreeManager, type WorktreePermissionManager, type WorktreeRemoteManager } from '../contract/index.js';
|
|
2
2
|
/**
|
|
3
3
|
* 将 Host 内的 Manage 能力投影为 DSH Remote 可传输的 plain-JSON contract。
|
|
4
4
|
*
|
|
@@ -12,5 +12,5 @@ import { type WorktreeManager, type WorktreeRemoteManager } from '../contract/in
|
|
|
12
12
|
* @param manager - Host 内已组合完成的用例接口。 / Fully composed Host use-case port.
|
|
13
13
|
* @returns 可供生成 Remote 暴露的安全投影。 / Safe projection for generated Remote export.
|
|
14
14
|
*/
|
|
15
|
-
export declare function createWorktreeRemoteProjection(manager: WorktreeManager): WorktreeRemoteManager;
|
|
15
|
+
export declare function createWorktreeRemoteProjection(manager: WorktreeManager, permissions?: WorktreePermissionManager): WorktreeRemoteManager;
|
|
16
16
|
//# sourceMappingURL=remote.d.ts.map
|
package/lib/host/remote.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/host/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAkC9B;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,
|
|
1
|
+
{"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../src/host/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,eAAe,EACpB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAE3B,MAAM,sBAAsB,CAAC;AAkC9B;;;;;;;;;;;;GAYG;AACH,wBAAgB,8BAA8B,CAC5C,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,yBAAyB,GACtC,qBAAqB,CA+BvB"}
|
package/lib/host/remote.js
CHANGED
|
@@ -42,11 +42,13 @@ async function project(operation) {
|
|
|
42
42
|
* @param manager - Host 内已组合完成的用例接口。 / Fully composed Host use-case port.
|
|
43
43
|
* @returns 可供生成 Remote 暴露的安全投影。 / Safe projection for generated Remote export.
|
|
44
44
|
*/
|
|
45
|
-
export function createWorktreeRemoteProjection(manager) {
|
|
45
|
+
export function createWorktreeRemoteProjection(manager, permissions) {
|
|
46
46
|
return {
|
|
47
47
|
listWorktrees: (input) => project(() => manager.listWorktrees(input)),
|
|
48
|
+
listImportCandidates: (input) => project(() => manager.listImportCandidates(input)),
|
|
48
49
|
listBranches: (input) => project(() => manager.listBranches(input)),
|
|
49
50
|
createWorktree: (input) => project(() => manager.createWorktree(input)),
|
|
51
|
+
importWorktree: (input) => project(() => manager.importWorktree(input)),
|
|
50
52
|
removeWorktree: (input) => project(async () => {
|
|
51
53
|
await manager.removeWorktree(input);
|
|
52
54
|
// `void` 没有 JSON 表示,因此成功删除在 wire contract 中显式投影为 null。
|
|
@@ -57,6 +59,12 @@ export function createWorktreeRemoteProjection(manager) {
|
|
|
57
59
|
insertWorktreeBefore: (input) => project(() => manager.insertWorktreeBefore(input)),
|
|
58
60
|
listBindings: (input) => project(() => manager.listBindings(input)),
|
|
59
61
|
bindSession: (input) => project(() => manager.bindSession(input)),
|
|
62
|
+
ensureWorktreePermission: (input) => project(() => permissions === undefined
|
|
63
|
+
? Promise.resolve({ status: 'unverified', retryable: true })
|
|
64
|
+
: permissions.ensureWorktreePermission(input)),
|
|
65
|
+
normalizeDetachedWorktreePermissions: (input) => project(() => permissions === undefined
|
|
66
|
+
? Promise.resolve({ status: 'unverified', sessionIds: [], retryable: true })
|
|
67
|
+
: permissions.normalizeDetachedWorktreePermissions(input)),
|
|
60
68
|
};
|
|
61
69
|
}
|
|
62
70
|
//# sourceMappingURL=remote.js.map
|
package/lib/host/remote.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/host/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,
|
|
1
|
+
{"version":3,"file":"remote.js","sourceRoot":"","sources":["../../src/host/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GAMpB,MAAM,sBAAsB,CAAC;AAE9B,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAS,oBAAoB,CAAC,CAAC;AAEjE,SAAS,eAAe,CAAC,KAAc;IACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACtF,MAAM,SAAS,GAAG,KAA+B,CAAC;IAClD,OAAO,CACL,OAAO,SAAS,CAAC,IAAI,KAAK,QAAQ;QAClC,kBAAkB,CAAC,GAAG,CAAC,SAAS,CAAC,IAAI,CAAC;QACtC,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ;QACrC,OAAO,SAAS,CAAC,OAAO,KAAK,QAAQ;QACrC,SAAS,CAAC,OAAO,KAAK,IAAI;QAC1B,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,CAClC,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,OAAO,CAAQ,SAA+B;IAC3D,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,SAAS,EAAE,EAAE,CAAC;IAChD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,mDAAmD;QACnD,yDAAyD;QACzD,+EAA+E;QAC/E,qFAAqF;QACrF,oCAAoC;QACpC,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC;YAAE,MAAM,KAAK,CAAC;QACzC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,O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,WAAW,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,OAAO,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACjE,wBAAwB,EAAE,CAAC,KAAK,EAAE,EAAE,CAClC,OAAO,CAAC,GAAG,EAAE,CACX,WAAW,KAAK,SAAS;YACvB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YAC5D,CAAC,CAAC,WAAW,CAAC,wBAAwB,CAAC,KAAK,CAAC,CAChD;QACH,oCAAoC,EAAE,CAAC,KAAK,EAAE,EAAE,CAC9C,OAAO,CAAC,GAAG,EAAE,CACX,WAAW,KAAK,SAAS;YACvB,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,UAAU,EAAE,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;YAC5E,CAAC,CAAC,WAAW,CAAC,oCAAoC,CAAC,KAAK,CAAC,CAC5D;KACJ,CAAC;AACJ,CAAC"}
|
package/lib/host/service.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Context } from '@deepseek-ai/cordis';
|
|
2
2
|
import { TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
3
|
-
import type { BranchRecord, SessionBinding, WorktreeId, WorktreeRecord, WorktreeRemoteResult } from '../contract/index.js';
|
|
3
|
+
import type { BranchRecord, SessionBinding, WorktreeId, WorktreeRecord, WorktreeImportCandidate, WorktreePermissionRequest, WorktreePermissionNormalizationRequest, WorktreePermissionResult, WorkspaceId, WorktreeRemoteResult } from '../contract/index.js';
|
|
4
4
|
/**
|
|
5
5
|
* Host composition 所需且由 DSH bundle 注入的配置。
|
|
6
6
|
* Configuration supplied by the DSH bundle to the Host composition.
|
|
@@ -33,6 +33,9 @@ export declare class WorktreeRemoteService extends TypertRemoteService {
|
|
|
33
33
|
listWorktrees(input: {
|
|
34
34
|
readonly workspaceId: string;
|
|
35
35
|
}): Promise<WorktreeRemoteResult<readonly WorktreeRecord[]>>;
|
|
36
|
+
listImportCandidates(input: {
|
|
37
|
+
readonly workspaceId: WorkspaceId;
|
|
38
|
+
}): Promise<WorktreeRemoteResult<readonly WorktreeImportCandidate[]>>;
|
|
36
39
|
listBranches(input: {
|
|
37
40
|
readonly workspaceId: string;
|
|
38
41
|
}): Promise<WorktreeRemoteResult<readonly BranchRecord[]>>;
|
|
@@ -41,6 +44,10 @@ export declare class WorktreeRemoteService extends TypertRemoteService {
|
|
|
41
44
|
readonly branch: string;
|
|
42
45
|
readonly newBranch?: string;
|
|
43
46
|
}): Promise<WorktreeRemoteResult<WorktreeRecord>>;
|
|
47
|
+
importWorktree(input: {
|
|
48
|
+
readonly workspaceId: WorkspaceId;
|
|
49
|
+
readonly absolutePath: string;
|
|
50
|
+
}): Promise<WorktreeRemoteResult<WorktreeRecord>>;
|
|
44
51
|
removeWorktree(input: {
|
|
45
52
|
readonly workspaceId: string;
|
|
46
53
|
readonly worktreeId: string;
|
|
@@ -58,6 +65,8 @@ export declare class WorktreeRemoteService extends TypertRemoteService {
|
|
|
58
65
|
readonly worktreeId: string;
|
|
59
66
|
readonly sessionId: string;
|
|
60
67
|
}): Promise<WorktreeRemoteResult<SessionBinding>>;
|
|
68
|
+
ensureWorktreePermission(input: WorktreePermissionRequest): Promise<WorktreeRemoteResult<WorktreePermissionResult>>;
|
|
69
|
+
normalizeDetachedWorktreePermissions(input: WorktreePermissionNormalizationRequest): Promise<WorktreeRemoteResult<WorktreePermissionResult>>;
|
|
61
70
|
}
|
|
62
71
|
export default WorktreeRemoteService;
|
|
63
72
|
//# sourceMappingURL=service.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../../src/host/service.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAq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GAC/B,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;IAK1D,oCAAoC,CAClC,KAAK,EAAE,sCAAsC,GAC5C,OAAO,CAAC,oBAAoB,CAAC,wBAAwB,CAAC,CAAC;CAG3D;AAED,eAAe,qBAAqB,CAAC"}
|
package/lib/host/service.js
CHANGED
|
@@ -36,6 +36,8 @@ import { Remote, TypertRemoteService } from '@deepseek-ai/dsh-typert-protocol';
|
|
|
36
36
|
import { createWorktreeManager } from '../manage/index.js';
|
|
37
37
|
import { DshHostReadAdapter, } from './dsh-read-adapter.js';
|
|
38
38
|
import { createWorktreeRemoteProjection } from './remote.js';
|
|
39
|
+
import { createDshWorktreePermissionAdapter, } from './worktree-permission.js';
|
|
40
|
+
import { createWorktreePermissionManager } from './worktree-permission-manager.js';
|
|
39
41
|
/**
|
|
40
42
|
* Worktree plugin 的真实 composition root。
|
|
41
43
|
*
|
|
@@ -52,29 +54,41 @@ let WorktreeRemoteService = (() => {
|
|
|
52
54
|
let _classSuper = TypertRemoteService;
|
|
53
55
|
let _instanceExtraInitializers = [];
|
|
54
56
|
let _listWorktrees_decorators;
|
|
57
|
+
let _listImportCandidates_decorators;
|
|
55
58
|
let _listBranches_decorators;
|
|
56
59
|
let _createWorktree_decorators;
|
|
60
|
+
let _importWorktree_decorators;
|
|
57
61
|
let _removeWorktree_decorators;
|
|
58
62
|
let _insertWorktreeBefore_decorators;
|
|
59
63
|
let _listBindings_decorators;
|
|
60
64
|
let _bindSession_decorators;
|
|
65
|
+
let _ensureWorktreePermission_decorators;
|
|
66
|
+
let _normalizeDetachedWorktreePermissions_decorators;
|
|
61
67
|
return class WorktreeRemoteService extends _classSuper {
|
|
62
68
|
static {
|
|
63
69
|
const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(_classSuper[Symbol.metadata] ?? null) : void 0;
|
|
64
70
|
_listWorktrees_decorators = [Remote];
|
|
71
|
+
_listImportCandidates_decorators = [Remote];
|
|
65
72
|
_listBranches_decorators = [Remote];
|
|
66
73
|
_createWorktree_decorators = [Remote];
|
|
74
|
+
_importWorktree_decorators = [Remote];
|
|
67
75
|
_removeWorktree_decorators = [Remote];
|
|
68
76
|
_insertWorktreeBefore_decorators = [Remote];
|
|
69
77
|
_listBindings_decorators = [Remote];
|
|
70
78
|
_bindSession_decorators = [Remote];
|
|
79
|
+
_ensureWorktreePermission_decorators = [Remote];
|
|
80
|
+
_normalizeDetachedWorktreePermissions_decorators = [Remote];
|
|
71
81
|
__esDecorate(this, null, _listWorktrees_decorators, { kind: "method", name: "listWorktrees", static: false, private: false, access: { has: obj => "listWorktrees" in obj, get: obj => obj.listWorktrees }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
82
|
+
__esDecorate(this, null, _listImportCandidates_decorators, { kind: "method", name: "listImportCandidates", static: false, private: false, access: { has: obj => "listImportCandidates" in obj, get: obj => obj.listImportCandidates }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
72
83
|
__esDecorate(this, null, _listBranches_decorators, { kind: "method", name: "listBranches", static: false, private: false, access: { has: obj => "listBranches" in obj, get: obj => obj.listBranches }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
73
84
|
__esDecorate(this, null, _createWorktree_decorators, { kind: "method", name: "createWorktree", static: false, private: false, access: { has: obj => "createWorktree" in obj, get: obj => obj.createWorktree }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
85
|
+
__esDecorate(this, null, _importWorktree_decorators, { kind: "method", name: "importWorktree", static: false, private: false, access: { has: obj => "importWorktree" in obj, get: obj => obj.importWorktree }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
74
86
|
__esDecorate(this, null, _removeWorktree_decorators, { kind: "method", name: "removeWorktree", static: false, private: false, access: { has: obj => "removeWorktree" in obj, get: obj => obj.removeWorktree }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
75
87
|
__esDecorate(this, null, _insertWorktreeBefore_decorators, { kind: "method", name: "insertWorktreeBefore", static: false, private: false, access: { has: obj => "insertWorktreeBefore" in obj, get: obj => obj.insertWorktreeBefore }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
76
88
|
__esDecorate(this, null, _listBindings_decorators, { kind: "method", name: "listBindings", static: false, private: false, access: { has: obj => "listBindings" in obj, get: obj => obj.listBindings }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
77
89
|
__esDecorate(this, null, _bindSession_decorators, { kind: "method", name: "bindSession", static: false, private: false, access: { has: obj => "bindSession" in obj, get: obj => obj.bindSession }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
90
|
+
__esDecorate(this, null, _ensureWorktreePermission_decorators, { kind: "method", name: "ensureWorktreePermission", static: false, private: false, access: { has: obj => "ensureWorktreePermission" in obj, get: obj => obj.ensureWorktreePermission }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
91
|
+
__esDecorate(this, null, _normalizeDetachedWorktreePermissions_decorators, { kind: "method", name: "normalizeDetachedWorktreePermissions", static: false, private: false, access: { has: obj => "normalizeDetachedWorktreePermissions" in obj, get: obj => obj.normalizeDetachedWorktreePermissions }, metadata: _metadata }, null, _instanceExtraInitializers);
|
|
78
92
|
if (_metadata) Object.defineProperty(this, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata });
|
|
79
93
|
}
|
|
80
94
|
// Cordis 在实例化前保证这三个只读 Host 服务可用;这里不注入任何 DSH mutation API。
|
|
@@ -89,9 +103,29 @@ let WorktreeRemoteService = (() => {
|
|
|
89
103
|
*/
|
|
90
104
|
constructor(ctx, config) {
|
|
91
105
|
super(ctx, 'worktreeManager');
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
const dsh = new DshHostReadAdapter(ctx);
|
|
107
|
+
const manager = createWorktreeManager({
|
|
108
|
+
dsh,
|
|
94
109
|
dshHome: config.dshHome,
|
|
110
|
+
});
|
|
111
|
+
// Permission presets are an optional DSH capability. Read them through a
|
|
112
|
+
// structural seam so an older profile can still mount this plugin and
|
|
113
|
+
// report `unverified` instead of failing during composition.
|
|
114
|
+
const optionalServices = {
|
|
115
|
+
permissionPresets: ctx.get('permissionPresets'),
|
|
116
|
+
sandboxPolicy: ctx.get('sandboxPolicy'),
|
|
117
|
+
};
|
|
118
|
+
const permissionAdapter = createDshWorktreePermissionAdapter({
|
|
119
|
+
sessions: {
|
|
120
|
+
get: (sessionId) => ctx.sessions.get(sessionId),
|
|
121
|
+
},
|
|
122
|
+
permissionPresets: optionalServices.permissionPresets,
|
|
123
|
+
sandboxPolicy: optionalServices.sandboxPolicy,
|
|
124
|
+
});
|
|
125
|
+
this.remote = createWorktreeRemoteProjection(manager, createWorktreePermissionManager({
|
|
126
|
+
manager,
|
|
127
|
+
dsh,
|
|
128
|
+
permissions: permissionAdapter,
|
|
95
129
|
}));
|
|
96
130
|
}
|
|
97
131
|
// 这些方法保持为薄边界,生成的 Typert 描述符只看到 contract-safe 签名;错误归一化
|
|
@@ -102,12 +136,18 @@ let WorktreeRemoteService = (() => {
|
|
|
102
136
|
listWorktrees(input) {
|
|
103
137
|
return this.remote.listWorktrees(input);
|
|
104
138
|
}
|
|
139
|
+
listImportCandidates(input) {
|
|
140
|
+
return this.remote.listImportCandidates(input);
|
|
141
|
+
}
|
|
105
142
|
listBranches(input) {
|
|
106
143
|
return this.remote.listBranches(input);
|
|
107
144
|
}
|
|
108
145
|
createWorktree(input) {
|
|
109
146
|
return this.remote.createWorktree(input);
|
|
110
147
|
}
|
|
148
|
+
importWorktree(input) {
|
|
149
|
+
return this.remote.importWorktree(input);
|
|
150
|
+
}
|
|
111
151
|
removeWorktree(input) {
|
|
112
152
|
return this.remote.removeWorktree(input);
|
|
113
153
|
}
|
|
@@ -120,6 +160,12 @@ let WorktreeRemoteService = (() => {
|
|
|
120
160
|
bindSession(input) {
|
|
121
161
|
return this.remote.bindSession(input);
|
|
122
162
|
}
|
|
163
|
+
ensureWorktreePermission(input) {
|
|
164
|
+
return this.remote.ensureWorktreePermission(input);
|
|
165
|
+
}
|
|
166
|
+
normalizeDetachedWorktreePermissions(input) {
|
|
167
|
+
return this.remote.normalizeDetachedWorktreePermissions(input);
|
|
168
|
+
}
|
|
123
169
|
};
|
|
124
170
|
})();
|
|
125
171
|
export { WorktreeRemoteService };
|
package/lib/host/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/host/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../../src/host/service.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,OAAO,EAAE,MAAM,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAe/E,OAAO,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAC3D,OAAO,EACL,kBAAkB,GAEnB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,8BAA8B,EAAE,MAAM,aAAa,CAAC;AAC7D,OAAO,EACL,kCAAkC,GAEnC,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AAWnF;;;;;;;;;;;GAWG;IACU,qBAAqB;sBAAS,mBAAmB;;;;;;;;;;;;;iBAAjD,qBAAsB,SAAQ,WAAmB;;;yCAsD3D,MAAM;gDAON,MAAM;wCAON,MAAM;0CAON,MAAM;0CASN,MAAM;0CAQN,MAAM;gDAQN,MAAM;wCASN,MAAM;uCAON,MAAM;oDASN,MAAM;gEAON,MAAM;YA7EP,0LAAA,aAAa,6DAIZ;YAGD,+MAAA,oBAAoB,6DAInB;YAGD,uLAAA,YAAY,6DAIX;YAGD,6LAAA,cAAc,6DAMb;YAGD,6LAAA,cAAc,6DAKb;YAGD,6LAAA,cAAc,6DAKb;YAGD,+MAAA,oBAAoB,6DAMnB;YAGD,uLAAA,YA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