@sanqianx/claude-ai-workbench 0.13.2 → 0.13.4
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/LICENSE +201 -201
- package/README.md +156 -156
- package/apps/agent-terminal/app.css +652 -613
- package/apps/agent-terminal/app.js +143 -67
- package/apps/agent-terminal/conversation-composer.js +44 -0
- package/apps/agent-terminal/index.html +172 -170
- package/apps/agent-terminal/panel-host-proof.html +152 -152
- package/apps/agent-terminal/panel-proof-content.html +41 -41
- package/apps/agent-terminal/right-workspace-dock.css +189 -159
- package/apps/agent-terminal/right-workspace-dock.js +652 -521
- package/apps/agent-terminal/user-question-card.js +68 -0
- package/apps/ai-profile-settings-host/index.html +25 -25
- package/apps/ai-profile-settings-host/page.css +1 -1
- package/apps/ai-profile-settings-host/page.js +113 -113
- package/apps/minimal-test-host/README.md +15 -15
- package/apps/minimal-test-host/host.css +2 -2
- package/apps/minimal-test-host/host.js +35 -35
- package/apps/minimal-test-host/index.html +58 -58
- package/apps/minimal-test-host/optional-mock/fault-injection.js +15 -15
- package/docs/sdk/FILE_LAYOUT.md +31 -31
- package/docs/sdk/INTEGRATION.md +126 -126
- package/docs/sdk/README.md +21 -21
- package/docs/sdk/SESSION_EVENTS.md +15 -13
- package/docs/sdk/openapi.yaml +16 -1
- package/package.json +1 -1
- package/packages/client/README.md +29 -29
- package/packages/client/index.d.ts +122 -122
- package/packages/client/index.js +260 -260
- package/packages/client/package.json +2 -2
- package/packages/contracts/README.md +9 -9
- package/packages/contracts/index.d.ts +519 -517
- package/packages/contracts/index.js +312 -312
- package/packages/contracts/package.json +1 -1
- package/packages/core/README.md +8 -8
- package/packages/core/index.d.ts +76 -76
- package/packages/core/index.js +222 -222
- package/packages/core/package.json +2 -2
- package/packages/server/README.md +17 -17
- package/packages/server/bin/agent-terminal-server.js +42 -42
- package/packages/server/bin/claude-workbench.js +225 -225
- package/packages/server/index.d.ts +171 -171
- package/packages/server/index.js +230 -230
- package/packages/server/lib/agent-discovery.js +133 -133
- package/packages/server/lib/agent-registry.js +143 -143
- package/packages/server/lib/agent-spawn-env.js +17 -17
- package/packages/server/lib/attachment-store.js +78 -78
- package/packages/server/lib/bridges/app-server-bridge.js +373 -373
- package/packages/server/lib/bridges/opencode-server-bridge.js +506 -506
- package/packages/server/lib/capture-settings-store.js +35 -35
- package/packages/server/lib/claude-history-recovery.js +87 -87
- package/packages/server/lib/cli-session-recovery.js +28 -28
- package/packages/server/lib/context-resolver.js +55 -55
- package/packages/server/lib/conversation-capture.js +51 -51
- package/packages/server/lib/delegation-phase-store.js +357 -357
- package/packages/server/lib/delegation-store.js +474 -468
- package/packages/server/lib/diagnostics.js +32 -32
- package/packages/server/lib/drivers/cli-json-runner.js +974 -974
- package/packages/server/lib/drivers/codex-driver.js +1461 -1442
- package/packages/server/lib/drivers/opencode-driver.js +1554 -1554
- package/packages/server/lib/drivers/zcode-driver.js +1250 -1250
- package/packages/server/lib/drivers/zcode-profile-runtime.js +71 -71
- package/packages/server/lib/event-stream.js +138 -138
- package/packages/server/lib/folder-picker.js +623 -623
- package/packages/server/lib/http-handler.js +339 -339
- package/packages/server/lib/json-file.js +26 -26
- package/packages/server/lib/knowledge-context.js +33 -33
- package/packages/server/lib/model-detection.js +295 -295
- package/packages/server/lib/parent-context.js +44 -0
- package/packages/server/lib/profile-store.js +283 -283
- package/packages/server/lib/project-store.js +102 -102
- package/packages/server/lib/runtime-loader.js +120 -120
- package/packages/server/lib/session-archive-store.js +53 -53
- package/packages/server/lib/session-history.js +612 -612
- package/packages/server/lib/system-doctor.js +125 -125
- package/packages/server/lib/ui-preferences-store.js +48 -48
- package/packages/server/lib/user-questions.js +67 -0
- package/packages/server/lib/workbench-service.js +1696 -1675
- package/packages/server/package.json +2 -2
- package/packages/ui/README.md +30 -30
- package/packages/ui/ai-profile-settings.d.ts +45 -45
- package/packages/ui/ai-profile-settings.js +283 -283
- package/packages/ui/claude-terminal.d.ts +31 -31
- package/packages/ui/claude-terminal.js +343 -343
- package/packages/ui/index.d.ts +18 -18
- package/packages/ui/index.js +51 -51
- package/packages/ui/package.json +2 -2
- package/packages/ui/theme.css +13 -13
- package/src/assets/claude-prompts.json +21 -21
- package/src/backend/http/ai-profile-routes.js +61 -61
- package/src/backend/http/claude-routes.js +170 -170
- package/src/backend/http/node-helpers.js +45 -45
- package/src/backend/index.js +21 -21
- package/src/backend/lib/ai-adapter.js +144 -144
- package/src/backend/lib/ai-profile-store.js +259 -259
- package/src/backend/lib/ai-vendor-presets.js +83 -83
- package/src/backend/lib/ai-workspace.js +140 -140
- package/src/backend/lib/automation-config.js +253 -253
- package/src/backend/lib/claude-cli-runner.js +2408 -2392
- package/src/backend/lib/data-dir.js +169 -169
- package/src/backend/lib/llm-client.js +176 -176
- package/src/backend/lib/model-context-windows.js +82 -82
- package/src/backend/lib/native-task-control.js +217 -217
- package/src/backend/lib/native-task-history-index.js +475 -475
- package/src/backend/lib/native-task-history-reader.js +526 -526
- package/src/backend/lib/native-task-messages.js +457 -457
- package/src/backend/lib/native-task-registry.js +325 -325
- package/src/backend/lib/native-task-runtime.js +242 -242
- package/src/backend/lib/native-task-trace.js +440 -440
- package/src/backend/lib/native-task-transcript.js +393 -393
- package/src/backend/lib/prompt-registry.js +166 -166
- package/src/backend/lib/runtime-config.js +121 -121
- package/src/backend/lib/sdk-session-stream.js +143 -143
- package/src/backend/lib/sdk-turn-stream.js +16 -16
- package/src/backend/lib/store-scope.js +131 -131
- package/src/backend/lib/task-identity.js +104 -104
- package/src/backend/lib/task-state-projection.js +58 -58
- package/src/index.js +7 -7
- package/src/sdk-wave-a.ts +1 -1
- package/src/sdk-wave-b.ts +1 -1
- package/src/sdk-wave-c.ts +1 -1
- package/src/sdk-wave-d.ts +1 -1
- package/src/sdk-wave-e.ts +1 -1
|
@@ -1,58 +1,58 @@
|
|
|
1
|
-
<!doctype html>
|
|
2
|
-
<html lang="zh-CN">
|
|
3
|
-
<head>
|
|
4
|
-
<meta charset="utf-8">
|
|
5
|
-
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
-
<title>Claude AI Workbench · Minimal Test Host</title>
|
|
7
|
-
<link rel="stylesheet" href="/reference-ui/dist/claude-ai-workbench-theme.css">
|
|
8
|
-
<link rel="stylesheet" href="/packages/ui/theme.css">
|
|
9
|
-
<link rel="stylesheet" href="host.css">
|
|
10
|
-
<script src="/packages/client/index.js"></script>
|
|
11
|
-
<script src="/packages/ui/ai-profile-settings.js"></script>
|
|
12
|
-
<script src="/reference-ui/dist/claude-workbench-core.js"></script>
|
|
13
|
-
<script src="/reference-ui/dist/claude-workbench-pane.js"></script>
|
|
14
|
-
</head>
|
|
15
|
-
<body>
|
|
16
|
-
<div class="app">
|
|
17
|
-
<header>
|
|
18
|
-
<div><h1>Claude AI Workbench</h1><p>Minimal Test Host · 真实 Runtime 为默认链路</p></div>
|
|
19
|
-
<div class="badges"><span id="serverBadge" class="badge">Server…</span><span id="runtimeBadge" class="badge">Runtime…</span><span id="modeBadge" class="badge real">REAL</span><button id="refreshBtn">刷新</button><button id="profilesBtn">AI Profiles</button><button id="acceptBtn" class="primary">运行验收</button></div>
|
|
20
|
-
</header>
|
|
21
|
-
<main class="layout">
|
|
22
|
-
<aside class="panel sidebar">
|
|
23
|
-
<div class="panel-title">Test Contexts</div>
|
|
24
|
-
<div class="panel-body">
|
|
25
|
-
<div id="contexts"></div>
|
|
26
|
-
<label>AI Profile<select id="profileSelect"><option value="">选择 Profile</option></select></label>
|
|
27
|
-
<div class="button-grid"><button id="mountBtn">Mount</button><button id="unmountBtn">Unmount</button><button id="remountBtn">Remount</button><button id="stressBtn">A/B ×20</button><button id="mockBtn" class="wide">Enable Optional Fault Injection</button></div>
|
|
28
|
-
<p class="hint">浏览器只发送 workspaceRef;绝对工作目录由 Server 白名单解析。</p>
|
|
29
|
-
</div>
|
|
30
|
-
</aside>
|
|
31
|
-
<section id="workbenchMount" class="workbench"></section>
|
|
32
|
-
<aside class="panel inspector">
|
|
33
|
-
<div class="panel-title">Runtime Inspector <button id="clearBtn">清空</button></div>
|
|
34
|
-
<div class="panel-body">
|
|
35
|
-
<dl id="metrics"></dl>
|
|
36
|
-
<h3>Raw SSE / Lifecycle Events</h3>
|
|
37
|
-
<pre id="eventLog"></pre>
|
|
38
|
-
<h3>Acceptance Report</h3>
|
|
39
|
-
<pre id="reportLog">尚未运行</pre>
|
|
40
|
-
<button id="exportBtn">导出报告 JSON</button>
|
|
41
|
-
</div>
|
|
42
|
-
</aside>
|
|
43
|
-
</main>
|
|
44
|
-
</div>
|
|
45
|
-
<div id="profileDrawer" class="drawer" aria-hidden="true">
|
|
46
|
-
<section class="drawer-box" role="dialog" aria-modal="true" aria-labelledby="profileDrawerTitle">
|
|
47
|
-
<header class="drawer-head">
|
|
48
|
-
<strong id="profileDrawerTitle">AI 模型配置</strong>
|
|
49
|
-
<button id="closeProfiles" type="button">关闭</button>
|
|
50
|
-
</header>
|
|
51
|
-
<div class="drawer-content">
|
|
52
|
-
<ai-profile-settings id="profileSettings"></ai-profile-settings>
|
|
53
|
-
</div>
|
|
54
|
-
</section>
|
|
55
|
-
</div>
|
|
56
|
-
<script src="host.js"></script>
|
|
57
|
-
</body>
|
|
58
|
-
</html>
|
|
1
|
+
<!doctype html>
|
|
2
|
+
<html lang="zh-CN">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8">
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<title>Claude AI Workbench · Minimal Test Host</title>
|
|
7
|
+
<link rel="stylesheet" href="/reference-ui/dist/claude-ai-workbench-theme.css">
|
|
8
|
+
<link rel="stylesheet" href="/packages/ui/theme.css">
|
|
9
|
+
<link rel="stylesheet" href="host.css">
|
|
10
|
+
<script src="/packages/client/index.js"></script>
|
|
11
|
+
<script src="/packages/ui/ai-profile-settings.js"></script>
|
|
12
|
+
<script src="/reference-ui/dist/claude-workbench-core.js"></script>
|
|
13
|
+
<script src="/reference-ui/dist/claude-workbench-pane.js"></script>
|
|
14
|
+
</head>
|
|
15
|
+
<body>
|
|
16
|
+
<div class="app">
|
|
17
|
+
<header>
|
|
18
|
+
<div><h1>Claude AI Workbench</h1><p>Minimal Test Host · 真实 Runtime 为默认链路</p></div>
|
|
19
|
+
<div class="badges"><span id="serverBadge" class="badge">Server…</span><span id="runtimeBadge" class="badge">Runtime…</span><span id="modeBadge" class="badge real">REAL</span><button id="refreshBtn">刷新</button><button id="profilesBtn">AI Profiles</button><button id="acceptBtn" class="primary">运行验收</button></div>
|
|
20
|
+
</header>
|
|
21
|
+
<main class="layout">
|
|
22
|
+
<aside class="panel sidebar">
|
|
23
|
+
<div class="panel-title">Test Contexts</div>
|
|
24
|
+
<div class="panel-body">
|
|
25
|
+
<div id="contexts"></div>
|
|
26
|
+
<label>AI Profile<select id="profileSelect"><option value="">选择 Profile</option></select></label>
|
|
27
|
+
<div class="button-grid"><button id="mountBtn">Mount</button><button id="unmountBtn">Unmount</button><button id="remountBtn">Remount</button><button id="stressBtn">A/B ×20</button><button id="mockBtn" class="wide">Enable Optional Fault Injection</button></div>
|
|
28
|
+
<p class="hint">浏览器只发送 workspaceRef;绝对工作目录由 Server 白名单解析。</p>
|
|
29
|
+
</div>
|
|
30
|
+
</aside>
|
|
31
|
+
<section id="workbenchMount" class="workbench"></section>
|
|
32
|
+
<aside class="panel inspector">
|
|
33
|
+
<div class="panel-title">Runtime Inspector <button id="clearBtn">清空</button></div>
|
|
34
|
+
<div class="panel-body">
|
|
35
|
+
<dl id="metrics"></dl>
|
|
36
|
+
<h3>Raw SSE / Lifecycle Events</h3>
|
|
37
|
+
<pre id="eventLog"></pre>
|
|
38
|
+
<h3>Acceptance Report</h3>
|
|
39
|
+
<pre id="reportLog">尚未运行</pre>
|
|
40
|
+
<button id="exportBtn">导出报告 JSON</button>
|
|
41
|
+
</div>
|
|
42
|
+
</aside>
|
|
43
|
+
</main>
|
|
44
|
+
</div>
|
|
45
|
+
<div id="profileDrawer" class="drawer" aria-hidden="true">
|
|
46
|
+
<section class="drawer-box" role="dialog" aria-modal="true" aria-labelledby="profileDrawerTitle">
|
|
47
|
+
<header class="drawer-head">
|
|
48
|
+
<strong id="profileDrawerTitle">AI 模型配置</strong>
|
|
49
|
+
<button id="closeProfiles" type="button">关闭</button>
|
|
50
|
+
</header>
|
|
51
|
+
<div class="drawer-content">
|
|
52
|
+
<ai-profile-settings id="profileSettings"></ai-profile-settings>
|
|
53
|
+
</div>
|
|
54
|
+
</section>
|
|
55
|
+
</div>
|
|
56
|
+
<script src="host.js"></script>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
(function(global){
|
|
2
|
-
global.createFaultInjectionAdapter=function createFaultInjectionAdapter(options={}){
|
|
3
|
-
const sessions=new Map(),streams=new Set();let requests=0,sequence=0;
|
|
4
|
-
const raw=event=>{options.onRaw?.(event);return event};
|
|
5
|
-
return{
|
|
6
|
-
async listSessions(context){requests++;try{return[...sessions.values()].filter(s=>s.contextId===context.contextId).map(s=>s.summary)}finally{requests--}},
|
|
7
|
-
async startSession(context){const sessionId=`mock-${context.contextId}-${Date.now().toString(36)}`;const summary={sessionId,contextId:context.contextId,title:'Fault injection session',active:true,state:'idle',model:'mock-model',aiProfileId:context.aiProfileId||'mock-profile'};sessions.set(sessionId,{contextId:context.contextId,summary,events:[]});return summary},
|
|
8
|
-
async loadSession(sessionId){const s=sessions.get(sessionId);return{session:s.summary,events:s.events,permission:null,permissionMode:'default',tokenUsage:{used:0,total:1000,hasUsage:false}}},
|
|
9
|
-
subscribe(sessionId,onEvent){const record={sessionId,onEvent,closed:false};streams.add(record);return()=>{record.closed=true;streams.delete(record)}},
|
|
10
|
-
async send(args){const s=sessions.get(args.sessionId);const emit=(type,extra={},forced)=>{const event=raw({type,sessionId:args.sessionId,contextId:s.contextId,sequence:forced||++sequence,at:new Date().toISOString(),...extra});s.events.push(event);for(const stream of streams)if(!stream.closed&&stream.sessionId===args.sessionId)stream.onEvent(event)};emit('claude/user-prompt',{text:args.text});emit('claude/text-start',{id:'answer'});emit('claude/text-delta',{id:'answer',text:'Fault '});emit('claude/text-delta',{id:'answer',text:'duplicate ignored'},sequence);emit('claude/text-delta',{id:'answer',text:'injection active. '});setTimeout(()=>emit('claude/result',{id:'answer',result:'Fault injection active. Duplicate sequence was ignored.'}),30)},
|
|
11
|
-
async resolvePermission(){},async abort(){},async setPermissionMode(){},
|
|
12
|
-
resourceCounts(){return{streams:streams.size,requests,reconnects:0}},destroy(){streams.clear()}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
})(window);
|
|
1
|
+
(function(global){
|
|
2
|
+
global.createFaultInjectionAdapter=function createFaultInjectionAdapter(options={}){
|
|
3
|
+
const sessions=new Map(),streams=new Set();let requests=0,sequence=0;
|
|
4
|
+
const raw=event=>{options.onRaw?.(event);return event};
|
|
5
|
+
return{
|
|
6
|
+
async listSessions(context){requests++;try{return[...sessions.values()].filter(s=>s.contextId===context.contextId).map(s=>s.summary)}finally{requests--}},
|
|
7
|
+
async startSession(context){const sessionId=`mock-${context.contextId}-${Date.now().toString(36)}`;const summary={sessionId,contextId:context.contextId,title:'Fault injection session',active:true,state:'idle',model:'mock-model',aiProfileId:context.aiProfileId||'mock-profile'};sessions.set(sessionId,{contextId:context.contextId,summary,events:[]});return summary},
|
|
8
|
+
async loadSession(sessionId){const s=sessions.get(sessionId);return{session:s.summary,events:s.events,permission:null,permissionMode:'default',tokenUsage:{used:0,total:1000,hasUsage:false}}},
|
|
9
|
+
subscribe(sessionId,onEvent){const record={sessionId,onEvent,closed:false};streams.add(record);return()=>{record.closed=true;streams.delete(record)}},
|
|
10
|
+
async send(args){const s=sessions.get(args.sessionId);const emit=(type,extra={},forced)=>{const event=raw({type,sessionId:args.sessionId,contextId:s.contextId,sequence:forced||++sequence,at:new Date().toISOString(),...extra});s.events.push(event);for(const stream of streams)if(!stream.closed&&stream.sessionId===args.sessionId)stream.onEvent(event)};emit('claude/user-prompt',{text:args.text});emit('claude/text-start',{id:'answer'});emit('claude/text-delta',{id:'answer',text:'Fault '});emit('claude/text-delta',{id:'answer',text:'duplicate ignored'},sequence);emit('claude/text-delta',{id:'answer',text:'injection active. '});setTimeout(()=>emit('claude/result',{id:'answer',result:'Fault injection active. Duplicate sequence was ignored.'}),30)},
|
|
11
|
+
async resolvePermission(){},async abort(){},async setPermissionMode(){},
|
|
12
|
+
resourceCounts(){return{streams:streams.size,requests,reconnects:0}},destroy(){streams.clear()}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
})(window);
|
package/docs/sdk/FILE_LAYOUT.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
# SDK 文件布局
|
|
2
|
-
|
|
3
|
-
```text
|
|
4
|
-
claude-ai-workbench/
|
|
5
|
-
├─ packages/ # 可发布 SDK 源码
|
|
6
|
-
│ ├─ contracts/ # 公共类型、常量和输入标准化
|
|
7
|
-
│ ├─ client/ # 浏览器/Node REST + SSE Client
|
|
8
|
-
│ ├─ core/ # 终端状态机、上下文隔离、会话生命周期
|
|
9
|
-
│ ├─ ui/
|
|
10
|
-
│ │ ├─ ai-profile-settings.js # AI Profile 默认入口
|
|
11
|
-
│ │ ├─ ai-profile-settings.d.ts
|
|
12
|
-
│ │ ├─ claude-terminal.js # 产品级 Claude Code 终端入口
|
|
13
|
-
│ │ ├─ claude-terminal.d.ts
|
|
14
|
-
│ │ └─ theme.css
|
|
15
|
-
│ └─ server/ # REST/SSE Server 与 CLI
|
|
16
|
-
├─ apps/
|
|
17
|
-
│ ├─ ai-profile-settings-host/ # AI Profile 独立接入示例
|
|
18
|
-
│ ├─ claude-terminal-host/ # 无调试面板的终端接入示例
|
|
19
|
-
│ └─ minimal-test-host/ # 内部验收、故障注入和原始事件检查
|
|
20
|
-
├─ docs/sdk/ # 对外文档和 OpenAPI
|
|
21
|
-
├─ scripts/ # 校验与 SDK 打包
|
|
22
|
-
└─ dist/sdk/ # 自动生成的 tgz 与 SHA-256 manifest
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
## 边界规则
|
|
26
|
-
|
|
27
|
-
1. 产品宿主只使用 `contracts`、`client`、`core`、`ui` 的公共入口,不复制组件源码。
|
|
28
|
-
2. `claude-terminal` 不创建 Client、不写死 API 地址、不读取凭据;宿主注入 Client 和 `WorkbenchContext`。
|
|
29
|
-
3. `minimal-test-host` 是内部 QA 工具,不是产品界面;运行指标、Raw SSE、故障注入不得进入终端组件。
|
|
30
|
-
4. API Key 只通过 credential 接口或临时测试请求进入 Server,公开 Profile 永不返回明文。
|
|
31
|
-
5. `dist/sdk/` 每次发布重新生成,不手工修改。
|
|
1
|
+
# SDK 文件布局
|
|
2
|
+
|
|
3
|
+
```text
|
|
4
|
+
claude-ai-workbench/
|
|
5
|
+
├─ packages/ # 可发布 SDK 源码
|
|
6
|
+
│ ├─ contracts/ # 公共类型、常量和输入标准化
|
|
7
|
+
│ ├─ client/ # 浏览器/Node REST + SSE Client
|
|
8
|
+
│ ├─ core/ # 终端状态机、上下文隔离、会话生命周期
|
|
9
|
+
│ ├─ ui/
|
|
10
|
+
│ │ ├─ ai-profile-settings.js # AI Profile 默认入口
|
|
11
|
+
│ │ ├─ ai-profile-settings.d.ts
|
|
12
|
+
│ │ ├─ claude-terminal.js # 产品级 Claude Code 终端入口
|
|
13
|
+
│ │ ├─ claude-terminal.d.ts
|
|
14
|
+
│ │ └─ theme.css
|
|
15
|
+
│ └─ server/ # REST/SSE Server 与 CLI
|
|
16
|
+
├─ apps/
|
|
17
|
+
│ ├─ ai-profile-settings-host/ # AI Profile 独立接入示例
|
|
18
|
+
│ ├─ claude-terminal-host/ # 无调试面板的终端接入示例
|
|
19
|
+
│ └─ minimal-test-host/ # 内部验收、故障注入和原始事件检查
|
|
20
|
+
├─ docs/sdk/ # 对外文档和 OpenAPI
|
|
21
|
+
├─ scripts/ # 校验与 SDK 打包
|
|
22
|
+
└─ dist/sdk/ # 自动生成的 tgz 与 SHA-256 manifest
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## 边界规则
|
|
26
|
+
|
|
27
|
+
1. 产品宿主只使用 `contracts`、`client`、`core`、`ui` 的公共入口,不复制组件源码。
|
|
28
|
+
2. `claude-terminal` 不创建 Client、不写死 API 地址、不读取凭据;宿主注入 Client 和 `WorkbenchContext`。
|
|
29
|
+
3. `minimal-test-host` 是内部 QA 工具,不是产品界面;运行指标、Raw SSE、故障注入不得进入终端组件。
|
|
30
|
+
4. API Key 只通过 credential 接口或临时测试请求进入 Server,公开 Profile 永不返回明文。
|
|
31
|
+
5. `dist/sdk/` 每次发布重新生成,不手工修改。
|
package/docs/sdk/INTEGRATION.md
CHANGED
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
# SDK 接入说明
|
|
2
|
-
|
|
3
|
-
## 1. 安装
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
npm install @claude-ai-workbench/contracts@0.2.0 \
|
|
7
|
-
@claude-ai-workbench/client@0.2.0 \
|
|
8
|
-
@claude-ai-workbench/core@0.2.0 \
|
|
9
|
-
@claude-ai-workbench/ui@0.2.0
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
运行服务的机器另行安装:
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm install @claude-ai-workbench/server@0.2.0
|
|
16
|
-
```
|
|
17
|
-
|
|
18
|
-
## 2. 启动 Server
|
|
19
|
-
|
|
20
|
-
```powershell
|
|
21
|
-
$env:CLAUDE_AI_WORKBENCH_DATA_DIR = 'D:\data\claude-workbench'
|
|
22
|
-
$env:CLAUDE_WORKBENCH_PORT = '5760'
|
|
23
|
-
npx claude-workbench-server
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Node.js 也可直接嵌入:
|
|
27
|
-
|
|
28
|
-
```js
|
|
29
|
-
const { createWorkbenchServer } = require("@claude-ai-workbench/server");
|
|
30
|
-
const app = createWorkbenchServer({ dataDir: "D:/data/claude-workbench", serveHost: false });
|
|
31
|
-
app.server.listen(5760, "127.0.0.1");
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
## 3. 接入 Claude Code 终端
|
|
35
|
-
|
|
36
|
-
```js
|
|
37
|
-
import "@claude-ai-workbench/ui/theme.css";
|
|
38
|
-
import "@claude-ai-workbench/ui/claude-terminal";
|
|
39
|
-
import { createClaudeWorkbenchClient } from "@claude-ai-workbench/client";
|
|
40
|
-
|
|
41
|
-
const client = createClaudeWorkbenchClient({
|
|
42
|
-
apiBase: "http://127.0.0.1:5760/api/claude-workbench/v1",
|
|
43
|
-
});
|
|
44
|
-
const terminal = document.querySelector("#terminal");
|
|
45
|
-
|
|
46
|
-
terminal.client = client;
|
|
47
|
-
terminal.context = {
|
|
48
|
-
contextId: "project-42",
|
|
49
|
-
contextType: "project",
|
|
50
|
-
displayName: "知识库项目",
|
|
51
|
-
workspaceRef: "registered-workspace-42",
|
|
52
|
-
aiProfileId: "claude-sonnet",
|
|
53
|
-
};
|
|
54
|
-
|
|
55
|
-
terminal.addEventListener("terminal-error", ({ detail }) => console.error(detail));
|
|
56
|
-
terminal.addEventListener("terminal-command", event => {
|
|
57
|
-
if (event.detail.command === "config") {
|
|
58
|
-
event.preventDefault();
|
|
59
|
-
openHostSettings();
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
|
-
window.addEventListener("beforeunload", () => {
|
|
63
|
-
terminal.destroy();
|
|
64
|
-
client.destroy();
|
|
65
|
-
});
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
```html
|
|
69
|
-
<claude-workbench-pane id="terminal"></claude-workbench-pane>
|
|
70
|
-
```
|
|
71
|
-
|
|
72
|
-
`workspaceRef` 是 Server 白名单中注册的工作区标识,不能由浏览器传入任意绝对路径。切换项目时只需重新赋值 `terminal.context`;Core 会中止旧请求、关闭旧 SSE,并隔离新旧上下文事件。
|
|
73
|
-
|
|
74
|
-
快捷命令不是前端常量。Core 会调用 `GET /sessions/{sessionId}/commands`,从当前 Claude Code 运行时读取内置命令、Skills、Plugins 和 MCP 命令;输入 `/` 后可搜索,选中后仍可补充参数再发送。`terminal-command` 是可取消事件,宿主只在确实需要接管某个命令时调用 `preventDefault()`。
|
|
75
|
-
|
|
76
|
-
图片默认支持点击选择、拖入和从剪贴板粘贴,格式为 JPEG、PNG、GIF、WebP;单张上限 10 MiB,一次最多 20 张且总计不超过 20 MiB。组件将 Base64 图片交给 Client,Server 验证真实文件签名并保存到产品数据目录的 `attachments/`,会话事件只保存可读取的附件 URL,不保存用户图片的 Base64 副本。宿主要使用自有文件选择器时可拦截:
|
|
77
|
-
|
|
78
|
-
```js
|
|
79
|
-
terminal.addEventListener("terminal-attach-request", async event => {
|
|
80
|
-
event.preventDefault();
|
|
81
|
-
const files = await openHostImagePicker();
|
|
82
|
-
await event.detail.addFiles(files);
|
|
83
|
-
});
|
|
84
|
-
```
|
|
85
|
-
|
|
86
|
-
不使用 UI 时,可直接调用同一公共 API:
|
|
87
|
-
|
|
88
|
-
```js
|
|
89
|
-
const commands = await client.listCommands(sessionId);
|
|
90
|
-
await client.send({
|
|
91
|
-
sessionId,
|
|
92
|
-
text: "说明这张图",
|
|
93
|
-
attachments: [{ name: "screen.png", mediaType: "image/png", data: base64 }],
|
|
94
|
-
});
|
|
95
|
-
```
|
|
96
|
-
|
|
97
|
-
## 4. 接入 AI Profile UI
|
|
98
|
-
|
|
99
|
-
```js
|
|
100
|
-
import "@claude-ai-workbench/ui";
|
|
101
|
-
import "@claude-ai-workbench/ui/theme.css";
|
|
102
|
-
```
|
|
103
|
-
|
|
104
|
-
```html
|
|
105
|
-
<ai-profile-list id="profileList"></ai-profile-list>
|
|
106
|
-
<ai-profile-editor id="profileEditor"></ai-profile-editor>
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
AI Profile UI 只发布 `profile-save`、`profile-test`、`profile-edit`、`profile-delete` 等 DOM 事件,宿主用 Client 完成持久化。测试连接不会保存;只有 `saveProfile` 和 `setCredential` 会写入产品数据目录。
|
|
110
|
-
|
|
111
|
-
## 5. 不使用 npm 的浏览器接入
|
|
112
|
-
|
|
113
|
-
按以下顺序加载静态文件:
|
|
114
|
-
|
|
115
|
-
```html
|
|
116
|
-
<link rel="stylesheet" href="/vendor/claude-workbench/ui/theme.css">
|
|
117
|
-
<script src="/vendor/claude-workbench/client/index.js"></script>
|
|
118
|
-
<script src="/vendor/claude-workbench/core/index.js"></script>
|
|
119
|
-
<script src="/vendor/claude-workbench/ui/claude-terminal.js"></script>
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
加载后可使用全局函数 `createClaudeWorkbenchClient`、全局对象 `ClaudeWorkbenchCore` 和 `<claude-workbench-pane>`。
|
|
123
|
-
|
|
124
|
-
## 6. 非 JavaScript 程序接入
|
|
125
|
-
|
|
126
|
-
C++、C#、Java 等程序直接按 [openapi.yaml](openapi.yaml) 调用 JSON REST API。OpenAPI 相当于语言无关的接口头文件;UI 仍由 WebView 或浏览器宿主加载。
|
|
1
|
+
# SDK 接入说明
|
|
2
|
+
|
|
3
|
+
## 1. 安装
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm install @claude-ai-workbench/contracts@0.2.0 \
|
|
7
|
+
@claude-ai-workbench/client@0.2.0 \
|
|
8
|
+
@claude-ai-workbench/core@0.2.0 \
|
|
9
|
+
@claude-ai-workbench/ui@0.2.0
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
运行服务的机器另行安装:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
npm install @claude-ai-workbench/server@0.2.0
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## 2. 启动 Server
|
|
19
|
+
|
|
20
|
+
```powershell
|
|
21
|
+
$env:CLAUDE_AI_WORKBENCH_DATA_DIR = 'D:\data\claude-workbench'
|
|
22
|
+
$env:CLAUDE_WORKBENCH_PORT = '5760'
|
|
23
|
+
npx claude-workbench-server
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
Node.js 也可直接嵌入:
|
|
27
|
+
|
|
28
|
+
```js
|
|
29
|
+
const { createWorkbenchServer } = require("@claude-ai-workbench/server");
|
|
30
|
+
const app = createWorkbenchServer({ dataDir: "D:/data/claude-workbench", serveHost: false });
|
|
31
|
+
app.server.listen(5760, "127.0.0.1");
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## 3. 接入 Claude Code 终端
|
|
35
|
+
|
|
36
|
+
```js
|
|
37
|
+
import "@claude-ai-workbench/ui/theme.css";
|
|
38
|
+
import "@claude-ai-workbench/ui/claude-terminal";
|
|
39
|
+
import { createClaudeWorkbenchClient } from "@claude-ai-workbench/client";
|
|
40
|
+
|
|
41
|
+
const client = createClaudeWorkbenchClient({
|
|
42
|
+
apiBase: "http://127.0.0.1:5760/api/claude-workbench/v1",
|
|
43
|
+
});
|
|
44
|
+
const terminal = document.querySelector("#terminal");
|
|
45
|
+
|
|
46
|
+
terminal.client = client;
|
|
47
|
+
terminal.context = {
|
|
48
|
+
contextId: "project-42",
|
|
49
|
+
contextType: "project",
|
|
50
|
+
displayName: "知识库项目",
|
|
51
|
+
workspaceRef: "registered-workspace-42",
|
|
52
|
+
aiProfileId: "claude-sonnet",
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
terminal.addEventListener("terminal-error", ({ detail }) => console.error(detail));
|
|
56
|
+
terminal.addEventListener("terminal-command", event => {
|
|
57
|
+
if (event.detail.command === "config") {
|
|
58
|
+
event.preventDefault();
|
|
59
|
+
openHostSettings();
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
window.addEventListener("beforeunload", () => {
|
|
63
|
+
terminal.destroy();
|
|
64
|
+
client.destroy();
|
|
65
|
+
});
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
```html
|
|
69
|
+
<claude-workbench-pane id="terminal"></claude-workbench-pane>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
`workspaceRef` 是 Server 白名单中注册的工作区标识,不能由浏览器传入任意绝对路径。切换项目时只需重新赋值 `terminal.context`;Core 会中止旧请求、关闭旧 SSE,并隔离新旧上下文事件。
|
|
73
|
+
|
|
74
|
+
快捷命令不是前端常量。Core 会调用 `GET /sessions/{sessionId}/commands`,从当前 Claude Code 运行时读取内置命令、Skills、Plugins 和 MCP 命令;输入 `/` 后可搜索,选中后仍可补充参数再发送。`terminal-command` 是可取消事件,宿主只在确实需要接管某个命令时调用 `preventDefault()`。
|
|
75
|
+
|
|
76
|
+
图片默认支持点击选择、拖入和从剪贴板粘贴,格式为 JPEG、PNG、GIF、WebP;单张上限 10 MiB,一次最多 20 张且总计不超过 20 MiB。组件将 Base64 图片交给 Client,Server 验证真实文件签名并保存到产品数据目录的 `attachments/`,会话事件只保存可读取的附件 URL,不保存用户图片的 Base64 副本。宿主要使用自有文件选择器时可拦截:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
terminal.addEventListener("terminal-attach-request", async event => {
|
|
80
|
+
event.preventDefault();
|
|
81
|
+
const files = await openHostImagePicker();
|
|
82
|
+
await event.detail.addFiles(files);
|
|
83
|
+
});
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
不使用 UI 时,可直接调用同一公共 API:
|
|
87
|
+
|
|
88
|
+
```js
|
|
89
|
+
const commands = await client.listCommands(sessionId);
|
|
90
|
+
await client.send({
|
|
91
|
+
sessionId,
|
|
92
|
+
text: "说明这张图",
|
|
93
|
+
attachments: [{ name: "screen.png", mediaType: "image/png", data: base64 }],
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## 4. 接入 AI Profile UI
|
|
98
|
+
|
|
99
|
+
```js
|
|
100
|
+
import "@claude-ai-workbench/ui";
|
|
101
|
+
import "@claude-ai-workbench/ui/theme.css";
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
```html
|
|
105
|
+
<ai-profile-list id="profileList"></ai-profile-list>
|
|
106
|
+
<ai-profile-editor id="profileEditor"></ai-profile-editor>
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
AI Profile UI 只发布 `profile-save`、`profile-test`、`profile-edit`、`profile-delete` 等 DOM 事件,宿主用 Client 完成持久化。测试连接不会保存;只有 `saveProfile` 和 `setCredential` 会写入产品数据目录。
|
|
110
|
+
|
|
111
|
+
## 5. 不使用 npm 的浏览器接入
|
|
112
|
+
|
|
113
|
+
按以下顺序加载静态文件:
|
|
114
|
+
|
|
115
|
+
```html
|
|
116
|
+
<link rel="stylesheet" href="/vendor/claude-workbench/ui/theme.css">
|
|
117
|
+
<script src="/vendor/claude-workbench/client/index.js"></script>
|
|
118
|
+
<script src="/vendor/claude-workbench/core/index.js"></script>
|
|
119
|
+
<script src="/vendor/claude-workbench/ui/claude-terminal.js"></script>
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
加载后可使用全局函数 `createClaudeWorkbenchClient`、全局对象 `ClaudeWorkbenchCore` 和 `<claude-workbench-pane>`。
|
|
123
|
+
|
|
124
|
+
## 6. 非 JavaScript 程序接入
|
|
125
|
+
|
|
126
|
+
C++、C#、Java 等程序直接按 [openapi.yaml](openapi.yaml) 调用 JSON REST API。OpenAPI 相当于语言无关的接口头文件;UI 仍由 WebView 或浏览器宿主加载。
|
package/docs/sdk/README.md
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
# Claude AI Workbench SDK
|
|
2
|
-
|
|
3
|
-
SDK 由五个同版本 npm 包组成:
|
|
4
|
-
|
|
5
|
-
| 包 | 职责 | 类比 C++ |
|
|
6
|
-
|---|---|---|
|
|
7
|
-
| `@claude-ai-workbench/contracts` | 公共数据类型与常量 | 公共头文件 |
|
|
8
|
-
| `@claude-ai-workbench/client` | REST/SSE Client | 调用封装库 |
|
|
9
|
-
| `@claude-ai-workbench/core` | 终端状态机与会话生命周期 | 无 UI 业务内核 |
|
|
10
|
-
| `@claude-ai-workbench/ui` | AI Profile 与 Claude Terminal Web Components | UI 控件库 |
|
|
11
|
-
| `@claude-ai-workbench/server` | REST/SSE 服务与 CLI | 后台服务进程 |
|
|
12
|
-
|
|
13
|
-
API 固定使用版本前缀 `/api/claude-workbench/v1`。执行:
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm run sdk:check
|
|
17
|
-
npm run sdk:pack
|
|
18
|
-
npm run verify
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
详细接入见 [INTEGRATION.md](INTEGRATION.md),文件职责见 [FILE_LAYOUT.md](FILE_LAYOUT.md),语言无关接口见 [openapi.yaml](openapi.yaml)。
|
|
1
|
+
# Claude AI Workbench SDK
|
|
2
|
+
|
|
3
|
+
SDK 由五个同版本 npm 包组成:
|
|
4
|
+
|
|
5
|
+
| 包 | 职责 | 类比 C++ |
|
|
6
|
+
|---|---|---|
|
|
7
|
+
| `@claude-ai-workbench/contracts` | 公共数据类型与常量 | 公共头文件 |
|
|
8
|
+
| `@claude-ai-workbench/client` | REST/SSE Client | 调用封装库 |
|
|
9
|
+
| `@claude-ai-workbench/core` | 终端状态机与会话生命周期 | 无 UI 业务内核 |
|
|
10
|
+
| `@claude-ai-workbench/ui` | AI Profile 与 Claude Terminal Web Components | UI 控件库 |
|
|
11
|
+
| `@claude-ai-workbench/server` | REST/SSE 服务与 CLI | 后台服务进程 |
|
|
12
|
+
|
|
13
|
+
API 固定使用版本前缀 `/api/claude-workbench/v1`。执行:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm run sdk:check
|
|
17
|
+
npm run sdk:pack
|
|
18
|
+
npm run verify
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
详细接入见 [INTEGRATION.md](INTEGRATION.md),文件职责见 [FILE_LAYOUT.md](FILE_LAYOUT.md),语言无关接口见 [openapi.yaml](openapi.yaml)。
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
# Session activity subscriptions
|
|
2
|
-
|
|
3
|
-
`
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
1
|
+
# Session activity subscriptions
|
|
2
|
+
|
|
3
|
+
Structured user questions use `claude/permission-request` with `kind: "question"` and a `questions` array. Each question has `id`, `question`, `options`, `multiSelect`, and `allowCustom`. Render a choice form rather than an allow/deny prompt. Nothing is selected or submitted automatically. Use `client.resolvePermission({sessionId, requestId, allow: true, answers: { [questionId]: [selectedLabel] }})`; custom text is an answer value. Missing, empty, incomplete, or foreign answers return 400 and leave the request pending. Read the current `permission` from `loadSession` when restoring a page, because the original request may be outside the latest history page. Closing a tab or refreshing does not answer a question. Stopping the turn emits a cancelled resolution without inventing answers. Claude SDK and Codex app-server native reply formats are translated by their owning drivers; UI callers never construct native payloads.
|
|
4
|
+
|
|
5
|
+
`GET /sessions/changes?contextId=<id>&after=<revision>` streams SSE session summaries. The client exposes `subscribeSessionChanges(contextId, callback, onError, { afterRevision })`. Embedded hosts may supply their existing EventSource-compatible WebSocket transport; standalone pages use native SSE.
|
|
6
|
+
|
|
7
|
+
An initial `workbench/sessions-snapshot` contains `sessions` (including archived records) and `revision`. Subsequent `workbench/session-changed` messages contain `session`, `contextId`, and `revision`; `deleted: true` removes that session. Cursors outside the retained revision window produce `workbench/resync`. Re-read one full snapshot after that marker. Reconnection does not resend input.
|
|
8
|
+
|
|
9
|
+
Session summaries include `tasks` and `backgroundTaskCount`. Task records use actual SDK task IDs, `parentSessionId`, optional `toolUseId`, `description`, `status`, `summary`, `usage`, and `lastToolName`. The per-session stream persists `claude/task-started`, `claude/task-progress`, `claude/task-updated`, and `claude/task-notification` events. Parent tool IDs distinguish child output from foreground output. Terminal task statuses cannot be reopened by late running events.
|
|
10
|
+
|
|
11
|
+
`claude/turn-end` closes the foreground reply. For Claude SDK streaming input this may occur at `end_turn` before its aggregate `result`, which can wait for background tasks. The input queue and event reader remain alive while tasks run. When foreground and tasks are both idle, the query is collected after 30 seconds; the next input resumes the same native session. Changing provider/model while a task runs is rejected.
|
|
12
|
+
|
|
13
|
+
Bound native agent tasks also persist evidence rows in the same journal: `claude/native-trace` (sanitized in-process hook facts), `claude/native-task-state` (ownership/status projections) and `claude/native-task-transcript` (a snapshot of a bound agent's transcript read through the SDK's public `getSubagentMessages` at a real terminal signal, or at the bounded turn-end sweep). Transcript rows carry `source: "sdk-public-read"`, fixed content-free `read` reason codes when a read cannot happen honestly, byte-bounded `chunk` markers, and normalized redacted entries/tool steps/usage - a snapshot read, never a claim of per-token streaming. These rows are part of the single-session stream's named event vocabulary: the standalone client subscribes to `claude/native-trace`, `claude/native-task-state`, `claude/native-task-transcript` and `claude/task-interrupted` like every other chat event, so SDK consumers receive the native facts in real time. They are additionally read back through the two read-only native-task history APIs (`GET /sessions/:id/native-tasks`, `POST /sessions/:id/native-tasks/history`), which page them without dispatching input.
|
|
14
|
+
|
|
15
|
+
Set `inputOrigin: "agent-delegation"` explicitly when creating a Leader-dispatched session and on its input options. A delegated session cannot reclassify itself as human. Browser composers identify human input; unmarked legacy/API records remain unknown. This provenance follows the durable capture event key through the event bridge. No task is inferred from prose claiming that an agent is running. Drivers advertise `capabilities.backgroundTasks`; unsupported drivers show the limitation explicitly.
|
package/docs/sdk/openapi.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
openapi: 3.1.0
|
|
2
2
|
info:
|
|
3
3
|
title: Claude AI Workbench API
|
|
4
|
-
version: 0.13.
|
|
4
|
+
version: 0.13.4
|
|
5
5
|
description: Versioned local API for AI Profile, credential and Claude Code session management.
|
|
6
6
|
servers:
|
|
7
7
|
- url: http://127.0.0.1:5760/api/claude-workbench/v1
|
|
@@ -482,6 +482,7 @@ paths:
|
|
|
482
482
|
storeScope: { type: string, format: uuid }
|
|
483
483
|
contextId: { type: string, pattern: "^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$" }
|
|
484
484
|
requestId: { type: string, maxLength: 256, description: Caller-chosen idempotency key for this command within the scope. }
|
|
485
|
+
contextMode: { type: string, enum: [parent-snapshot], description: Freeze parent conversation context on first acceptance; retries reuse the private snapshot. }
|
|
485
486
|
text: { type: string, minLength: 1, maxLength: 200000, description: The command text. Trimmed server-side; the hash of the normalized command covers every execution-affecting choice. }
|
|
486
487
|
agentId: { type: string, description: Defaults to claude-code; agents without a reserved-identity driver answer 501 before anything is reserved. }
|
|
487
488
|
aiProfileId: { type: [string, "null"], description: Omitted inherits the parent's profile; null explicitly selects the agent's own login. }
|
|
@@ -612,8 +613,16 @@ paths:
|
|
|
612
613
|
properties:
|
|
613
614
|
allow: { type: boolean }
|
|
614
615
|
message: { type: string }
|
|
616
|
+
answers:
|
|
617
|
+
type: object
|
|
618
|
+
description: Explicit answers to a pending structured question, keyed by its question IDs.
|
|
619
|
+
additionalProperties:
|
|
620
|
+
type: array
|
|
621
|
+
minItems: 1
|
|
622
|
+
items: { type: string, minLength: 1 }
|
|
615
623
|
responses:
|
|
616
624
|
"200": { description: Permission resolved }
|
|
625
|
+
"400": { description: Incomplete or invalid question answers; the question remains pending }
|
|
617
626
|
/sessions/{sessionId}/abort:
|
|
618
627
|
parameters:
|
|
619
628
|
- $ref: "#/components/parameters/SessionId"
|
|
@@ -1116,6 +1125,12 @@ components:
|
|
|
1116
1125
|
type: object
|
|
1117
1126
|
required: [delegation, phase, outcome, dispatch, child]
|
|
1118
1127
|
properties:
|
|
1128
|
+
context:
|
|
1129
|
+
type: object
|
|
1130
|
+
required: [mode, truncated]
|
|
1131
|
+
properties:
|
|
1132
|
+
mode: { type: string, const: parent-snapshot }
|
|
1133
|
+
truncated: { type: boolean }
|
|
1119
1134
|
delegation: { $ref: "#/components/schemas/DelegationCommandRecord" }
|
|
1120
1135
|
phase: { type: string, enum: [reserved, child-created, child-create-failed, dispatching, dispatched, dispatch-unknown] }
|
|
1121
1136
|
outcome: { type: string, enum: [not-started, not-dispatched, pending, dispatched, unknown] }
|
package/package.json
CHANGED