@agent-phonon/protocol 0.9.0 → 0.10.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/README.md +35 -1
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/native-version.d.ts +6 -0
- package/dist/native-version.d.ts.map +1 -0
- package/dist/native-version.js +41 -0
- package/dist/native-version.js.map +1 -0
- package/dist/schemas/capabilities.d.ts +9 -0
- package/dist/schemas/capabilities.d.ts.map +1 -1
- package/dist/schemas/capabilities.js +3 -0
- package/dist/schemas/capabilities.js.map +1 -1
- package/dist/schemas/common.d.ts +4 -4
- package/dist/schemas/common.d.ts.map +1 -1
- package/dist/schemas/common.js +9 -0
- package/dist/schemas/common.js.map +1 -1
- package/dist/schemas/compression.d.ts +191 -0
- package/dist/schemas/compression.d.ts.map +1 -0
- package/dist/schemas/compression.js +18 -0
- package/dist/schemas/compression.js.map +1 -0
- package/dist/schemas/conversation-archive.d.ts +1021 -0
- package/dist/schemas/conversation-archive.d.ts.map +1 -0
- package/dist/schemas/conversation-archive.js +148 -0
- package/dist/schemas/conversation-archive.js.map +1 -0
- package/dist/schemas/conversation-board.d.ts +428 -0
- package/dist/schemas/conversation-board.d.ts.map +1 -0
- package/dist/schemas/conversation-board.js +32 -0
- package/dist/schemas/conversation-board.js.map +1 -0
- package/dist/schemas/conversation-message.d.ts +658 -0
- package/dist/schemas/conversation-message.d.ts.map +1 -0
- package/dist/schemas/conversation-message.js +42 -0
- package/dist/schemas/conversation-message.js.map +1 -0
- package/dist/schemas/conversation-workflow.d.ts +1201 -0
- package/dist/schemas/conversation-workflow.d.ts.map +1 -0
- package/dist/schemas/conversation-workflow.js +68 -0
- package/dist/schemas/conversation-workflow.js.map +1 -0
- package/dist/schemas/device.d.ts +198 -2
- package/dist/schemas/device.d.ts.map +1 -1
- package/dist/schemas/device.js +29 -1
- package/dist/schemas/device.js.map +1 -1
- package/dist/schemas/discovery.d.ts +107 -0
- package/dist/schemas/discovery.d.ts.map +1 -1
- package/dist/schemas/discovery.js +2 -0
- package/dist/schemas/discovery.js.map +1 -1
- package/dist/schemas/document.d.ts +56 -26
- package/dist/schemas/document.d.ts.map +1 -1
- package/dist/schemas/document.js +11 -0
- package/dist/schemas/document.js.map +1 -1
- package/dist/schemas/employee.d.ts +139 -0
- package/dist/schemas/employee.d.ts.map +1 -0
- package/dist/schemas/employee.js +17 -0
- package/dist/schemas/employee.js.map +1 -0
- package/dist/schemas/env.d.ts +15 -15
- package/dist/schemas/env.d.ts.map +1 -1
- package/dist/schemas/env.js +1 -1
- package/dist/schemas/env.js.map +1 -1
- package/dist/schemas/file.d.ts +6 -6
- package/dist/schemas/hook.d.ts +4 -4
- package/dist/schemas/interaction.d.ts +363 -2
- package/dist/schemas/interaction.d.ts.map +1 -1
- package/dist/schemas/interaction.js +28 -1
- package/dist/schemas/interaction.js.map +1 -1
- package/dist/schemas/jsonrpc.d.ts +19 -19
- package/dist/schemas/maintenance.d.ts +822 -0
- package/dist/schemas/maintenance.d.ts.map +1 -0
- package/dist/schemas/maintenance.js +166 -0
- package/dist/schemas/maintenance.js.map +1 -0
- package/dist/schemas/managed-mcp.d.ts +116 -0
- package/dist/schemas/managed-mcp.d.ts.map +1 -0
- package/dist/schemas/managed-mcp.js +23 -0
- package/dist/schemas/managed-mcp.js.map +1 -0
- package/dist/schemas/methods.d.ts +22195 -2371
- package/dist/schemas/methods.d.ts.map +1 -1
- package/dist/schemas/methods.js +181 -6
- package/dist/schemas/methods.js.map +1 -1
- package/dist/schemas/native-stop.d.ts +162 -0
- package/dist/schemas/native-stop.d.ts.map +1 -0
- package/dist/schemas/native-stop.js +14 -0
- package/dist/schemas/native-stop.js.map +1 -0
- package/dist/schemas/policy.d.ts +61 -2
- package/dist/schemas/policy.d.ts.map +1 -1
- package/dist/schemas/policy.js +33 -0
- package/dist/schemas/policy.js.map +1 -1
- package/dist/schemas/project-coordination.d.ts +1956 -0
- package/dist/schemas/project-coordination.d.ts.map +1 -0
- package/dist/schemas/project-coordination.js +81 -0
- package/dist/schemas/project-coordination.js.map +1 -0
- package/dist/schemas/project.d.ts +771 -53
- package/dist/schemas/project.d.ts.map +1 -1
- package/dist/schemas/project.js +60 -5
- package/dist/schemas/project.js.map +1 -1
- package/dist/schemas/reasoning.d.ts +26 -0
- package/dist/schemas/reasoning.d.ts.map +1 -0
- package/dist/schemas/reasoning.js +10 -0
- package/dist/schemas/reasoning.js.map +1 -0
- package/dist/schemas/schedule.d.ts +14653 -4527
- package/dist/schemas/schedule.d.ts.map +1 -1
- package/dist/schemas/schedule.js +55 -8
- package/dist/schemas/schedule.js.map +1 -1
- package/dist/schemas/session.d.ts +1558 -49
- package/dist/schemas/session.d.ts.map +1 -1
- package/dist/schemas/session.js +27 -16
- package/dist/schemas/session.js.map +1 -1
- package/dist/schemas/skill.d.ts +1009 -8
- package/dist/schemas/skill.d.ts.map +1 -1
- package/dist/schemas/skill.js +39 -0
- package/dist/schemas/skill.js.map +1 -1
- package/dist/schemas/stream.d.ts +1060 -67
- package/dist/schemas/stream.d.ts.map +1 -1
- package/dist/schemas/stream.js +18 -3
- package/dist/schemas/stream.js.map +1 -1
- package/dist/schemas/workflow.d.ts +2764 -255
- package/dist/schemas/workflow.d.ts.map +1 -1
- package/dist/schemas/workflow.js +69 -1
- package/dist/schemas/workflow.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +12 -0
- package/src/native-version.ts +30 -0
- package/src/schemas/capabilities.ts +3 -0
- package/src/schemas/common.ts +9 -0
- package/src/schemas/compression.ts +19 -0
- package/src/schemas/conversation-archive.ts +155 -0
- package/src/schemas/conversation-board.ts +36 -0
- package/src/schemas/conversation-message.ts +46 -0
- package/src/schemas/conversation-workflow.ts +62 -0
- package/src/schemas/device.ts +32 -1
- package/src/schemas/discovery.ts +2 -0
- package/src/schemas/document.ts +13 -0
- package/src/schemas/employee.ts +19 -0
- package/src/schemas/env.ts +1 -1
- package/src/schemas/interaction.ts +32 -1
- package/src/schemas/maintenance.ts +204 -0
- package/src/schemas/managed-mcp.ts +25 -0
- package/src/schemas/methods.ts +208 -1
- package/src/schemas/native-stop.ts +16 -0
- package/src/schemas/policy.ts +33 -0
- package/src/schemas/project-coordination.ts +90 -0
- package/src/schemas/project.ts +72 -5
- package/src/schemas/reasoning.ts +13 -0
- package/src/schemas/schedule.ts +63 -8
- package/src/schemas/session.ts +30 -18
- package/src/schemas/skill.ts +52 -0
- package/src/schemas/stream.ts +22 -3
- package/src/schemas/workflow.ts +82 -1
package/src/schemas/methods.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import { RunResolveParams, RunResolveResult } from "./schedule.js";
|
|
3
|
+
import { ManagedMcpConfigureParams, ManagedMcpStatusParams, ManagedMcpStatusResult } from "./managed-mcp.js";
|
|
2
4
|
import {
|
|
3
5
|
ConnectHelloParams,
|
|
4
6
|
ConnectWelcomeResult,
|
|
@@ -27,18 +29,30 @@ import {
|
|
|
27
29
|
SessionTerminateResult,
|
|
28
30
|
SessionStatusParams,
|
|
29
31
|
SessionStatusResult,
|
|
32
|
+
SessionRecoverParams,
|
|
33
|
+
SessionRecoverResult,
|
|
30
34
|
SessionListParams,
|
|
31
35
|
SessionListResult,
|
|
32
36
|
} from "./session.js";
|
|
33
|
-
import { StreamEvent, StreamAckParams } from "./stream.js";import {
|
|
37
|
+
import { StreamEvent, StreamAckParams, StreamReplayParams, StreamReplayResult } from "./stream.js";import {
|
|
34
38
|
HookFiredParams,
|
|
35
39
|
HookResolveParams,
|
|
36
40
|
HookResolveResult,
|
|
37
41
|
} from "./hook.js";
|
|
42
|
+
import { EmployeeProfileApplyParams,EmployeeProfileStatusParams,EmployeeProfileStatusResult } from "./employee.js";
|
|
43
|
+
import { ConversationBoardParams, ConversationBoardResult } from "./conversation-board.js";
|
|
44
|
+
import { ConversationWorkflowParams, ConversationWorkflowResult } from "./conversation-workflow.js";
|
|
45
|
+
import { ConversationMessageParams, ConversationMessageResult } from "./conversation-message.js";
|
|
46
|
+
import { ProjectCoordinationParams, ProjectCoordinationResult, ProjectCoordinationEvidenceParams, ProjectCoordinationEvidenceResult } from "./project-coordination.js";
|
|
47
|
+
import { ConversationArchiveAppendParams, ConversationArchiveAppendResult, ConversationArchiveReadParams, ConversationArchiveReadResult, ConversationArchiveStatusParams, ConversationArchiveStatusResult, ConversationArchiveEntitiesParams, ConversationArchiveEntitiesResult } from "./conversation-archive.js";
|
|
48
|
+
import { ConversationArchiveBlob, ConversationArchiveBlobWriteParams, ConversationArchiveBlobStatusResult, ConversationArchiveBlobReadParams, ConversationArchiveBlobReadResult } from "./conversation-archive.js";
|
|
49
|
+
import { CompressionStatusParams, CompressionReceipt } from "./compression.js";
|
|
38
50
|
import { DocumentSendParams, DocumentSendResult, DocumentPrepareUploadParams, DocumentPrepareUploadResult } from "./document.js";
|
|
39
51
|
import {
|
|
40
52
|
InteractionRequestParams,
|
|
41
53
|
InteractionRequestResult,
|
|
54
|
+
InteractionStatusParams,
|
|
55
|
+
InteractionStatusResult,
|
|
42
56
|
InteractionResponseParams,
|
|
43
57
|
InteractionCancelParams,
|
|
44
58
|
InteractionCancelResult,
|
|
@@ -46,6 +60,7 @@ import {
|
|
|
46
60
|
import {
|
|
47
61
|
ProjectCreateParams,
|
|
48
62
|
ProjectCreateResult,
|
|
63
|
+
ProjectProvisionParams,ProjectProvisionStatusParams,ProjectProvisionStatusResult,
|
|
49
64
|
ProjectListParams,
|
|
50
65
|
ProjectListResult,
|
|
51
66
|
ProjectGetParams,
|
|
@@ -66,11 +81,20 @@ import {
|
|
|
66
81
|
GitLogParams, GitLogResult,
|
|
67
82
|
GitPushParams, GitPushResult,
|
|
68
83
|
GitStatusParams, GitStatusResult,
|
|
84
|
+
GitOriginParams,GitOriginResult,
|
|
85
|
+
WorktreeProvisionParams,WorktreeProvisionStatusParams,WorktreeProvisionStatusResult,
|
|
69
86
|
ProjectExecParams, ProjectExecResult,
|
|
70
87
|
} from "./project.js";
|
|
71
88
|
import {
|
|
72
89
|
SkillInstallParams,
|
|
73
90
|
SkillInstallResult,
|
|
91
|
+
SkillInstallStatusParams,
|
|
92
|
+
SkillInstallStatusResult,
|
|
93
|
+
SkillInstallFenceParams,
|
|
94
|
+
SkillInstallFenceResult,
|
|
95
|
+
SkillPublishParams,
|
|
96
|
+
SkillUnpublishParams,
|
|
97
|
+
SkillUnpublishResult,
|
|
74
98
|
SkillUninstallParams,
|
|
75
99
|
SkillUninstallResult,
|
|
76
100
|
SkillListParams,
|
|
@@ -97,8 +121,15 @@ import {
|
|
|
97
121
|
WorkflowRunResult,
|
|
98
122
|
WorkflowStatusParams,
|
|
99
123
|
WorkflowStatusResult,
|
|
124
|
+
WorkflowInputParams,WorkflowInputReceipt,WorkflowInputStatusParams,WorkflowInputStatusResult,
|
|
125
|
+
WorkflowResultParams,
|
|
126
|
+
WorkflowResultPage,
|
|
100
127
|
WorkflowCancelParams,
|
|
128
|
+
WorkflowDispatchCancelParams,
|
|
129
|
+
WorkflowDispatchCancelResult,
|
|
101
130
|
WorkflowCancelResult,
|
|
131
|
+
WorkflowPauseParams,
|
|
132
|
+
WorkflowPauseResult,
|
|
102
133
|
WorkflowListParams,
|
|
103
134
|
WorkflowListResult,
|
|
104
135
|
WorkflowEvent,
|
|
@@ -111,6 +142,17 @@ import {
|
|
|
111
142
|
WorkflowArtifactsListResult,
|
|
112
143
|
WorkflowResumeParams,
|
|
113
144
|
} from "./workflow.js";
|
|
145
|
+
import {
|
|
146
|
+
MaintenanceTargetsParams, MaintenanceTargetsResult,
|
|
147
|
+
MaintenanceDiagnoseParams, MaintenanceDiagnoseResult,
|
|
148
|
+
MaintenanceConfigGetParams, MaintenanceConfigGetResult,
|
|
149
|
+
MaintenanceConfigPatchParams, MaintenanceConfigPatchResult,
|
|
150
|
+
MaintenanceConfigEditParams, MaintenanceConfigEditResult,
|
|
151
|
+
MaintenanceRollbackParams, MaintenanceRollbackResult,
|
|
152
|
+
MaintenancePackageUpdateParams, MaintenancePackageUpdateResult,
|
|
153
|
+
MaintenanceServiceStatusParams, MaintenanceServiceStatusResult,
|
|
154
|
+
MaintenanceServiceRestartParams, MaintenanceServiceRestartResult,
|
|
155
|
+
} from "./maintenance.js";
|
|
114
156
|
import {
|
|
115
157
|
ScheduleCreateParams,
|
|
116
158
|
ScheduleCreateResult,
|
|
@@ -159,6 +201,8 @@ import {
|
|
|
159
201
|
const z_void = z.undefined();
|
|
160
202
|
|
|
161
203
|
export const METHODS = {
|
|
204
|
+
"mcp.configure": { direction: "s2p", kind: "request", params: ManagedMcpConfigureParams, result: ManagedMcpStatusResult },
|
|
205
|
+
"mcp.status": { direction: "s2p", kind: "request", params: ManagedMcpStatusParams, result: ManagedMcpStatusResult },
|
|
162
206
|
// --- 握手(phonon 拨出后先发)---
|
|
163
207
|
"connect.hello": {
|
|
164
208
|
direction: "p2s",
|
|
@@ -193,6 +237,44 @@ export const METHODS = {
|
|
|
193
237
|
result: DeviceFsListResult,
|
|
194
238
|
},
|
|
195
239
|
|
|
240
|
+
// --- 宿主机确定性维护面(即使外部 Agent 全部不可用仍可调用)---
|
|
241
|
+
"maintenance.targets": {
|
|
242
|
+
direction: "s2p", kind: "request",
|
|
243
|
+
params: MaintenanceTargetsParams, result: MaintenanceTargetsResult,
|
|
244
|
+
},
|
|
245
|
+
"maintenance.diagnose": {
|
|
246
|
+
direction: "s2p", kind: "request",
|
|
247
|
+
params: MaintenanceDiagnoseParams, result: MaintenanceDiagnoseResult,
|
|
248
|
+
},
|
|
249
|
+
"maintenance.config.get": {
|
|
250
|
+
direction: "s2p", kind: "request",
|
|
251
|
+
params: MaintenanceConfigGetParams, result: MaintenanceConfigGetResult,
|
|
252
|
+
},
|
|
253
|
+
"maintenance.config.patch": {
|
|
254
|
+
direction: "s2p", kind: "request",
|
|
255
|
+
params: MaintenanceConfigPatchParams, result: MaintenanceConfigPatchResult,
|
|
256
|
+
},
|
|
257
|
+
"maintenance.config.edit": {
|
|
258
|
+
direction: "s2p", kind: "request",
|
|
259
|
+
params: MaintenanceConfigEditParams, result: MaintenanceConfigEditResult,
|
|
260
|
+
},
|
|
261
|
+
"maintenance.rollback": {
|
|
262
|
+
direction: "s2p", kind: "request",
|
|
263
|
+
params: MaintenanceRollbackParams, result: MaintenanceRollbackResult,
|
|
264
|
+
},
|
|
265
|
+
"maintenance.package.update": {
|
|
266
|
+
direction: "s2p", kind: "request",
|
|
267
|
+
params: MaintenancePackageUpdateParams, result: MaintenancePackageUpdateResult,
|
|
268
|
+
},
|
|
269
|
+
"maintenance.service.status": {
|
|
270
|
+
direction: "s2p", kind: "request",
|
|
271
|
+
params: MaintenanceServiceStatusParams, result: MaintenanceServiceStatusResult,
|
|
272
|
+
},
|
|
273
|
+
"maintenance.service.restart": {
|
|
274
|
+
direction: "s2p", kind: "request",
|
|
275
|
+
params: MaintenanceServiceRestartParams, result: MaintenanceServiceRestartResult,
|
|
276
|
+
},
|
|
277
|
+
|
|
196
278
|
// --- 发现(server 查询;phonon 主动推变更)---
|
|
197
279
|
"discovery.list": {
|
|
198
280
|
direction: "s2p",
|
|
@@ -214,6 +296,30 @@ export const METHODS = {
|
|
|
214
296
|
},
|
|
215
297
|
|
|
216
298
|
// --- session 原语(server 下发)---
|
|
299
|
+
"conversation.archive.append": {
|
|
300
|
+
direction: "s2p", kind: "request",
|
|
301
|
+
params: ConversationArchiveAppendParams, result: ConversationArchiveAppendResult,
|
|
302
|
+
},
|
|
303
|
+
"conversation.archive.read": {
|
|
304
|
+
direction: "s2p", kind: "request",
|
|
305
|
+
params: ConversationArchiveReadParams, result: ConversationArchiveReadResult,
|
|
306
|
+
},
|
|
307
|
+
"conversation.archive.status": {
|
|
308
|
+
direction: "s2p", kind: "request",
|
|
309
|
+
params: ConversationArchiveStatusParams, result: ConversationArchiveStatusResult,
|
|
310
|
+
},
|
|
311
|
+
"conversation.archive.entities": {
|
|
312
|
+
direction: "s2p", kind: "request", params: ConversationArchiveEntitiesParams, result: ConversationArchiveEntitiesResult,
|
|
313
|
+
},
|
|
314
|
+
"conversation.archive.blob.write": {
|
|
315
|
+
direction: "s2p", kind: "request", params: ConversationArchiveBlobWriteParams, result: ConversationArchiveBlobStatusResult,
|
|
316
|
+
},
|
|
317
|
+
"conversation.archive.blob.status": {
|
|
318
|
+
direction: "s2p", kind: "request", params: ConversationArchiveBlob, result: ConversationArchiveBlobStatusResult,
|
|
319
|
+
},
|
|
320
|
+
"conversation.archive.blob.read": {
|
|
321
|
+
direction: "s2p", kind: "request", params: ConversationArchiveBlobReadParams, result: ConversationArchiveBlobReadResult,
|
|
322
|
+
},
|
|
217
323
|
"session.create": {
|
|
218
324
|
direction: "s2p",
|
|
219
325
|
kind: "request",
|
|
@@ -238,6 +344,9 @@ export const METHODS = {
|
|
|
238
344
|
params: SessionCompressParams,
|
|
239
345
|
result: SessionCompressResult,
|
|
240
346
|
},
|
|
347
|
+
"session.compression.status": {
|
|
348
|
+
direction: "s2p", kind: "request", params: CompressionStatusParams, result: CompressionReceipt,
|
|
349
|
+
},
|
|
241
350
|
"session.switchModel": {
|
|
242
351
|
direction: "s2p",
|
|
243
352
|
kind: "request",
|
|
@@ -262,6 +371,10 @@ export const METHODS = {
|
|
|
262
371
|
params: SessionStatusParams,
|
|
263
372
|
result: SessionStatusResult,
|
|
264
373
|
},
|
|
374
|
+
"session.recover": {
|
|
375
|
+
direction: "s2p", kind: "request",
|
|
376
|
+
params: SessionRecoverParams, result: SessionRecoverResult,
|
|
377
|
+
},
|
|
265
378
|
"session.list": {
|
|
266
379
|
direction: "s2p",
|
|
267
380
|
kind: "request",
|
|
@@ -283,6 +396,12 @@ export const METHODS = {
|
|
|
283
396
|
params: StreamAckParams,
|
|
284
397
|
result: z_void,
|
|
285
398
|
},
|
|
399
|
+
"stream.replay": {
|
|
400
|
+
direction: "s2p",
|
|
401
|
+
kind: "request",
|
|
402
|
+
params: StreamReplayParams,
|
|
403
|
+
result: StreamReplayResult,
|
|
404
|
+
},
|
|
286
405
|
|
|
287
406
|
// --- hook / HITL ---
|
|
288
407
|
"hook.fired": {
|
|
@@ -319,6 +438,22 @@ export const METHODS = {
|
|
|
319
438
|
params: InteractionRequestParams,
|
|
320
439
|
result: InteractionRequestResult,
|
|
321
440
|
},
|
|
441
|
+
"conversation.board": {
|
|
442
|
+
direction: "p2s", kind: "request", params: ConversationBoardParams, result: ConversationBoardResult,
|
|
443
|
+
},
|
|
444
|
+
"conversation.workflow": {
|
|
445
|
+
direction:"p2s",kind:"request",params:ConversationWorkflowParams,result:ConversationWorkflowResult,
|
|
446
|
+
},
|
|
447
|
+
"conversation.message": {
|
|
448
|
+
// History/read are read-only and retain the same current-turn, controller-owned group scope.
|
|
449
|
+
direction: "p2s", kind: "request", params: ConversationMessageParams, result: ConversationMessageResult,
|
|
450
|
+
},
|
|
451
|
+
"project.coordination": {
|
|
452
|
+
direction: "p2s", kind: "request", params: ProjectCoordinationParams, result: ProjectCoordinationResult,
|
|
453
|
+
},
|
|
454
|
+
"project.coordination.evidence": {
|
|
455
|
+
direction:"p2s",kind:"request",params:ProjectCoordinationEvidenceParams,result:ProjectCoordinationEvidenceResult,
|
|
456
|
+
},
|
|
322
457
|
"interaction.response": {
|
|
323
458
|
direction: "s2p",
|
|
324
459
|
kind: "notification", // 异步/非阻塞回填走这条
|
|
@@ -331,6 +466,15 @@ export const METHODS = {
|
|
|
331
466
|
params: InteractionCancelParams,
|
|
332
467
|
result: InteractionCancelResult,
|
|
333
468
|
},
|
|
469
|
+
"interaction.status": {
|
|
470
|
+
direction: "s2p", kind: "request", params: InteractionStatusParams, result: InteractionStatusResult,
|
|
471
|
+
},
|
|
472
|
+
"employee.profile.apply": {
|
|
473
|
+
direction:"s2p",kind:"request",params:EmployeeProfileApplyParams,result:EmployeeProfileStatusResult,
|
|
474
|
+
},
|
|
475
|
+
"employee.profile.status": {
|
|
476
|
+
direction:"s2p",kind:"request",params:EmployeeProfileStatusParams,result:EmployeeProfileStatusResult,
|
|
477
|
+
},
|
|
334
478
|
|
|
335
479
|
// --- 项目管理(目录 + Git;server 下发,D23)---
|
|
336
480
|
"project.create": {
|
|
@@ -345,6 +489,12 @@ export const METHODS = {
|
|
|
345
489
|
params: ProjectListParams,
|
|
346
490
|
result: ProjectListResult,
|
|
347
491
|
},
|
|
492
|
+
"project.provision": {
|
|
493
|
+
direction:"s2p",kind:"request",params:ProjectProvisionParams,result:ProjectProvisionStatusResult,
|
|
494
|
+
},
|
|
495
|
+
"project.provision.status": {
|
|
496
|
+
direction:"s2p",kind:"request",params:ProjectProvisionStatusParams,result:ProjectProvisionStatusResult,
|
|
497
|
+
},
|
|
348
498
|
"project.get": {
|
|
349
499
|
direction: "s2p",
|
|
350
500
|
kind: "request",
|
|
@@ -407,6 +557,13 @@ export const METHODS = {
|
|
|
407
557
|
direction: "s2p", kind: "request",
|
|
408
558
|
params: GitStatusParams, result: GitStatusResult,
|
|
409
559
|
},
|
|
560
|
+
"project.git.origin": {direction:"s2p",kind:"request",params:GitOriginParams,result:GitOriginResult},
|
|
561
|
+
"project.worktree.provision": {
|
|
562
|
+
direction: "s2p", kind: "request", params: WorktreeProvisionParams, result: WorktreeProvisionStatusResult,
|
|
563
|
+
},
|
|
564
|
+
"project.worktree.provision.status": {
|
|
565
|
+
direction: "s2p", kind: "request", params: WorktreeProvisionStatusParams, result: WorktreeProvisionStatusResult,
|
|
566
|
+
},
|
|
410
567
|
"project.exec": {
|
|
411
568
|
direction: "s2p", kind: "request",
|
|
412
569
|
params: ProjectExecParams, result: ProjectExecResult,
|
|
@@ -471,6 +628,30 @@ export const METHODS = {
|
|
|
471
628
|
params: SkillInstallParams,
|
|
472
629
|
result: SkillInstallResult,
|
|
473
630
|
},
|
|
631
|
+
"skill.install.status": {
|
|
632
|
+
direction: "s2p",
|
|
633
|
+
kind: "request",
|
|
634
|
+
params: SkillInstallStatusParams,
|
|
635
|
+
result: SkillInstallStatusResult,
|
|
636
|
+
},
|
|
637
|
+
"skill.install.fence": {
|
|
638
|
+
direction:"s2p",
|
|
639
|
+
kind:"request",
|
|
640
|
+
params:SkillInstallFenceParams,
|
|
641
|
+
result:SkillInstallFenceResult,
|
|
642
|
+
},
|
|
643
|
+
"skill.publish": {
|
|
644
|
+
direction: "s2p",
|
|
645
|
+
kind: "request",
|
|
646
|
+
params: SkillPublishParams,
|
|
647
|
+
result: SkillInstallResult,
|
|
648
|
+
},
|
|
649
|
+
"skill.unpublish": {
|
|
650
|
+
direction: "s2p",
|
|
651
|
+
kind: "request",
|
|
652
|
+
params: SkillUnpublishParams,
|
|
653
|
+
result: SkillUnpublishResult,
|
|
654
|
+
},
|
|
474
655
|
"skill.uninstall": {
|
|
475
656
|
direction: "s2p",
|
|
476
657
|
kind: "request",
|
|
@@ -503,12 +684,32 @@ export const METHODS = {
|
|
|
503
684
|
params: WorkflowStatusParams,
|
|
504
685
|
result: WorkflowStatusResult,
|
|
505
686
|
},
|
|
687
|
+
"workflow.input": {direction:"s2p",kind:"request",params:WorkflowInputParams,result:WorkflowInputReceipt},
|
|
688
|
+
"workflow.input.status": {direction:"s2p",kind:"request",params:WorkflowInputStatusParams,result:WorkflowInputStatusResult},
|
|
689
|
+
"workflow.result": {
|
|
690
|
+
direction: "s2p",
|
|
691
|
+
kind: "request",
|
|
692
|
+
params: WorkflowResultParams,
|
|
693
|
+
result: WorkflowResultPage,
|
|
694
|
+
},
|
|
506
695
|
"workflow.cancel": {
|
|
507
696
|
direction: "s2p",
|
|
508
697
|
kind: "request",
|
|
509
698
|
params: WorkflowCancelParams,
|
|
510
699
|
result: WorkflowCancelResult,
|
|
511
700
|
},
|
|
701
|
+
"workflow.dispatch.cancel": {
|
|
702
|
+
direction:"s2p",
|
|
703
|
+
kind:"request",
|
|
704
|
+
params:WorkflowDispatchCancelParams,
|
|
705
|
+
result:WorkflowDispatchCancelResult,
|
|
706
|
+
},
|
|
707
|
+
"workflow.pause": {
|
|
708
|
+
direction: "s2p",
|
|
709
|
+
kind: "request",
|
|
710
|
+
params: WorkflowPauseParams,
|
|
711
|
+
result: WorkflowPauseResult,
|
|
712
|
+
},
|
|
512
713
|
"workflow.list": {
|
|
513
714
|
direction: "s2p",
|
|
514
715
|
kind: "request",
|
|
@@ -615,6 +816,12 @@ export const METHODS = {
|
|
|
615
816
|
params: RunGetParams,
|
|
616
817
|
result: RunGetResult,
|
|
617
818
|
},
|
|
819
|
+
"run.resolve": {
|
|
820
|
+
direction: "s2p",
|
|
821
|
+
kind: "request",
|
|
822
|
+
params: RunResolveParams,
|
|
823
|
+
result: RunResolveResult,
|
|
824
|
+
},
|
|
618
825
|
"run.events.subscribe": {
|
|
619
826
|
direction: "s2p",
|
|
620
827
|
kind: "request",
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SessionId,Timestamp } from "./common.js";
|
|
3
|
+
|
|
4
|
+
export const NativeStopTarget = z.object({
|
|
5
|
+
version:z.literal(1),sessionId:SessionId,turnId:z.string().optional(),nodeId:z.string().optional(),
|
|
6
|
+
state:z.enum(["pending","confirmed","unknown"]),observedAt:Timestamp,
|
|
7
|
+
confirmation:z.enum(["not_started","process_tree_exit","native_terminal"]).optional(),
|
|
8
|
+
reasonCode:z.string().max(128).optional(),
|
|
9
|
+
}).strict().refine(value=>value.state!=="confirmed"||value.confirmation!==undefined);
|
|
10
|
+
export type NativeStopTarget=z.infer<typeof NativeStopTarget>;
|
|
11
|
+
export const NativeStopProof=z.object({
|
|
12
|
+
version:z.literal(1),state:z.enum(["pending","confirmed","unknown"]),
|
|
13
|
+
targets:z.array(NativeStopTarget).max(256),observedAt:Timestamp,
|
|
14
|
+
reasonCode:z.string().max(128).optional(),
|
|
15
|
+
}).strict().refine(value=>value.state!=="confirmed"||value.targets.every(target=>target.state==="confirmed"));
|
|
16
|
+
export type NativeStopProof=z.infer<typeof NativeStopProof>;
|
package/src/schemas/policy.ts
CHANGED
|
@@ -23,12 +23,45 @@ export const TenantPolicy = z.object({
|
|
|
23
23
|
allowGlobalSkillInstall: z.boolean().default(false),
|
|
24
24
|
/** 是否允许从 url 安装 skill(供应链入口,危险)。默认 false。 */
|
|
25
25
|
allowUrlSkillInstall: z.boolean().default(false),
|
|
26
|
+
/** 是否允许从本地任意路径安装 skill(localPath 源,可复制任意目录 → 任意读)。默认 false。 */
|
|
27
|
+
allowLocalPathSkillInstall: z.boolean().default(false),
|
|
28
|
+
/** Explicit human-owned recovery permission; never implied by trustLocal. */
|
|
29
|
+
allowSkillRecovery:z.boolean().default(false),
|
|
26
30
|
/** 是否允许物理删盘(project.remove deleteFiles / worktree force 等)。默认 false。 */
|
|
27
31
|
allowDeleteFiles: z.boolean().default(false),
|
|
28
32
|
/** document.send 是否允许发送项目/worktree 目录之外的文件。默认 false(project-scoped)。 */
|
|
29
33
|
allowExternalDocuments: z.boolean().default(false),
|
|
30
34
|
/** env.list reveal=true 是否允许返回环境变量明文。默认 false(只能脱敏查看)。 */
|
|
31
35
|
allowEnvReveal: z.boolean().default(false),
|
|
36
|
+
/** 是否允许 env.set/env.delete 修改设备本地环境变量。默认 false。 */
|
|
37
|
+
allowEnvWrite: z.boolean().default(false),
|
|
38
|
+
/**
|
|
39
|
+
* 是否允许 project.exec 跨设备执行任意命令(A2/A3)。默认 false(严格)。
|
|
40
|
+
* exec 能指定任意 binary 且继承环境,等同设备远程代码执行——必须独立 gate,
|
|
41
|
+
* 不能只靠 allowedMethods。trustLocal(单机自用)下默认开。
|
|
42
|
+
*/
|
|
43
|
+
allowExec: z.boolean().default(false),
|
|
44
|
+
/** Host-level creation/editing of isolated employee profiles. Never implied by trustLocal. */
|
|
45
|
+
allowEmployeeProfiles:z.boolean().default(false),
|
|
46
|
+
/** Explicit host consent for new controlled-root workspaces, never arbitrary path adoption. */
|
|
47
|
+
allowProjectProvision:z.boolean().default(false),
|
|
48
|
+
/** Separate durable Phonon history; never implied by project or filesystem access. */
|
|
49
|
+
allowConversationArchives: z.boolean().default(false),
|
|
50
|
+
/** Per configured server authority and tenant; no automatic history eviction. */
|
|
51
|
+
maxConversationArchiveBytes: z.number().int().positive().safe().default(10 * 1024 * 1024 * 1024),
|
|
52
|
+
/**
|
|
53
|
+
* 是否允许 device.fs.* 浏览整个文件系统(A4)。默认 true(保留能力)。
|
|
54
|
+
* 设为 false 可把 device.fs.list/roots 锁到 allowedProjectRoots;需要锁定的部署可关。
|
|
55
|
+
*/
|
|
56
|
+
allowDeviceFsBrowse: z.boolean().default(true),
|
|
57
|
+
/** 是否允许只读宿主机维护诊断/读取脱敏配置。默认 false。 */
|
|
58
|
+
allowMaintenanceRead: z.boolean().default(false),
|
|
59
|
+
/** 是否允许修改本地预注册的 JSON 配置(自动备份 + 乐观锁)。默认 false。 */
|
|
60
|
+
allowMaintenanceConfigWrite: z.boolean().default(false),
|
|
61
|
+
/** 是否允许更新本地预注册的用户态 npm/pnpm 包。默认 false。 */
|
|
62
|
+
allowMaintenancePackageUpdate: z.boolean().default(false),
|
|
63
|
+
/** 是否允许重启本地预注册的服务。默认 false。 */
|
|
64
|
+
allowMaintenanceServiceRestart: z.boolean().default(false),
|
|
32
65
|
/** 单文件上传上限(字节);超出走 prepare_upload 或拒绝。 */
|
|
33
66
|
maxUploadBytes: z.number().int().positive().optional(),
|
|
34
67
|
/** 敏感路径黑名单(即使在 allowedProjectRoots 内也拒绝,如 .ssh/.aws/.env)。 */
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
const id = z.string().uuid().transform(value => value.toLowerCase());
|
|
4
|
+
const position = z.string().regex(/^(0|[1-9][0-9]{0,17})$/);
|
|
5
|
+
export const CoordinationActivity = z.object({
|
|
6
|
+
summary: z.string().trim().max(500), phase: z.enum(["planning", "working", "validating", "blocked", "idle", "completed"]),
|
|
7
|
+
impact: z.array(z.string().trim().min(1).max(240)).max(16), dependencies: z.string().max(1000).default(""),
|
|
8
|
+
}).strict().refine(value=>new TextEncoder().encode(JSON.stringify(value)).length<=16000,"Activity exceeds the encoded byte limit");
|
|
9
|
+
export const AgentCoordinationInput = z.discriminatedUnion("operation", [
|
|
10
|
+
z.object({ operation: z.literal("presence") }).strict(),
|
|
11
|
+
z.object({ operation: z.literal("peers"), after: position.default("0") }).strict(),
|
|
12
|
+
z.object({ operation: z.literal("activity"), requestId: id, baseRevision: z.number().int().nonnegative(), activity: CoordinationActivity }).strict(),
|
|
13
|
+
z.object({ operation: z.literal("send"), requestId: id, recipientId: id, kind: z.enum(["intent", "question", "notice", "request", "result"]),
|
|
14
|
+
text: z.string().trim().min(1).max(4000), references: z.array(z.string().trim().min(1).max(512)).max(8).default([]), inReplyTo: id.optional() }).strict(),
|
|
15
|
+
z.object({ operation: z.literal("inbox"), after: position.default("0") }).strict(),
|
|
16
|
+
z.object({ operation: z.literal("acknowledge"), messageIds: z.array(id).min(1).max(32).refine(values => new Set(values).size === values.length) }).strict(),
|
|
17
|
+
z.object({ operation: z.literal("receipt"), requestId: id }).strict(),
|
|
18
|
+
z.object({ operation: z.literal("leave") }).strict(),
|
|
19
|
+
]).refine(value=>new TextEncoder().encode(JSON.stringify(value)).length<=24000,"Coordination action exceeds the encoded byte limit");
|
|
20
|
+
export type AgentCoordinationInput = z.infer<typeof AgentCoordinationInput>;
|
|
21
|
+
// Device-owned metadata, deliberately outside the model-facing action union.
|
|
22
|
+
const receiveBoundary = z.enum(["before_model", "after_tools"]);
|
|
23
|
+
const receiveEvidence = z.enum(["context_hook", "provider_payload"]);
|
|
24
|
+
export const CoordinationReceiveReport = z.discriminatedUnion("mode", [
|
|
25
|
+
z.object({ version: z.literal(1), mode: z.literal("tool_polling") }).strict(),
|
|
26
|
+
z.object({ version: z.literal(1), mode: z.literal("runtime_pending"), boundary: receiveBoundary,
|
|
27
|
+
evidence: receiveEvidence, visibility: z.enum(["hidden", "collapsed"]) }).strict(),
|
|
28
|
+
z.object({ version: z.literal(1), mode: z.literal("runtime_checkpoint"), boundary: receiveBoundary,
|
|
29
|
+
evidence: receiveEvidence, visibility: z.enum(["hidden", "collapsed"]) }).strict(),
|
|
30
|
+
]);
|
|
31
|
+
export type CoordinationReceiveReport = z.infer<typeof CoordinationReceiveReport>;
|
|
32
|
+
export const CoordinationReceiveState = z.object({ report: CoordinationReceiveReport,
|
|
33
|
+
reportedAt: z.string().datetime(), current: z.boolean(),
|
|
34
|
+
}).strict();
|
|
35
|
+
export const ProjectCoordinationParams = z.object({ sourceKind: z.enum(["native", "dev"]), runId: id,
|
|
36
|
+
workflowId: z.string().min(1).max(512), sessionId: z.string().min(1).max(512), turnId: z.string().min(1).max(512), action: AgentCoordinationInput,
|
|
37
|
+
receive: CoordinationReceiveReport.optional(),
|
|
38
|
+
evidenceVersion: z.literal(1).optional(),
|
|
39
|
+
workspaceVersion: z.literal(1).optional(),
|
|
40
|
+
}).strict();
|
|
41
|
+
export type ProjectCoordinationParams = z.infer<typeof ProjectCoordinationParams>;
|
|
42
|
+
const workspaceText = (limit: number) => z.string().min(1).max(limit).refine(value =>
|
|
43
|
+
new TextEncoder().encode(value).length <= limit && !/[\x00-\x1f\x7f-\x9f]/.test(value));
|
|
44
|
+
export const CoordinationWorkspace = z.discriminatedUnion("state", [
|
|
45
|
+
z.object({ state: z.literal("current"), deviceId: id, runtimeWorkspaceId: workspaceText(4096),
|
|
46
|
+
path: workspaceText(4096), repositoryRoot: workspaceText(4096), branch: workspaceText(1024),
|
|
47
|
+
isWorktree: z.boolean(), worktreeId: workspaceText(512).optional(), detached: z.boolean(),
|
|
48
|
+
head: z.string().regex(/^[a-f0-9]{40,64}$/).optional(), observedAt: z.string().datetime(), checkedAt: z.string().datetime(),
|
|
49
|
+
}).strict(),
|
|
50
|
+
z.object({ state: z.enum(["unavailable", "unsupported", "notGit"]), deviceId: id.nullable(), checkedAt: z.string().datetime(),
|
|
51
|
+
reasonCode: z.string().regex(/^[a-z0-9_]{1,64}$/).optional(),
|
|
52
|
+
}).strict(),
|
|
53
|
+
]);
|
|
54
|
+
export type CoordinationWorkspace = z.infer<typeof CoordinationWorkspace>;
|
|
55
|
+
const Participant = z.object({ id, position, projectId: id, ownerId: z.string(), deviceId: id.nullable(), agentId: z.string(),
|
|
56
|
+
agentKind: z.enum(["agent", "de"]), sourceKind: z.enum(["native", "dev", "mcp"]), sessionId: z.string(), label: z.string(),
|
|
57
|
+
activity: CoordinationActivity, activityRevision: z.number().int().nonnegative(), lastSeenAt: z.string().nullable(),
|
|
58
|
+
deviceName: z.string().nullable().optional(), runtimeState: z.string().nullable().optional(),
|
|
59
|
+
receive: CoordinationReceiveState.optional(),
|
|
60
|
+
workspace: CoordinationWorkspace.optional(),
|
|
61
|
+
presence: z.enum(["active", "stale", "offline", "ended"]),
|
|
62
|
+
}).strict();
|
|
63
|
+
const Message = z.object({ id, position, senderId: id, recipientId: id, kind: z.enum(["intent", "question", "notice", "request", "result"]),
|
|
64
|
+
text: z.string().max(4000), references: z.array(z.string()).max(8), inReplyTo: id.nullable(), depth: z.number().int().min(0).max(6),
|
|
65
|
+
createdAt: z.string().nullable(), expiresAt: z.string().nullable(), state: z.enum(["stored", "received", "withdrawn", "expired"]), receivedAt: z.string().nullable(),
|
|
66
|
+
contentAvailable: z.boolean().optional(),
|
|
67
|
+
}).strict();
|
|
68
|
+
export const ProjectCoordinationResult = z.object({ self: Participant.optional(), participants: z.array(Participant).max(32).optional(),
|
|
69
|
+
receiveReporting: z.literal(1).optional(),
|
|
70
|
+
evidenceVersion: z.literal(1).optional(),
|
|
71
|
+
workspaceVersion: z.literal(1).optional(),
|
|
72
|
+
deliveryOffers: z.array(z.object({messageId:id,deliveryId:id}).strict()).max(32).optional(),
|
|
73
|
+
messages: z.array(Message).max(32).optional(), message: Message.optional(), next: position.nullable().optional(),
|
|
74
|
+
status: z.enum(["recorded", "not_found", "left"]).optional(), requestId: id.optional(), participantId: id.optional(), replayed: z.boolean().optional(),
|
|
75
|
+
}).strict();
|
|
76
|
+
export type ProjectCoordinationResult = z.infer<typeof ProjectCoordinationResult>;
|
|
77
|
+
|
|
78
|
+
export const CoordinationRuntimeEvidence = z.object({deliveryId:id,boundaryId:id,
|
|
79
|
+
contentHash:z.string().regex(/^[0-9a-f]{64}$/),state:z.enum(["offered","context_hook","provider_payload"])}).strict();
|
|
80
|
+
export const ProjectCoordinationEvidenceParams = z.object({version:z.literal(1),
|
|
81
|
+
reports:z.array(CoordinationRuntimeEvidence).min(1).max(8).refine(rows=>new Set(rows.map(row=>row.deliveryId)).size===rows.length),
|
|
82
|
+
}).strict();
|
|
83
|
+
export type ProjectCoordinationEvidenceParams = z.infer<typeof ProjectCoordinationEvidenceParams>;
|
|
84
|
+
export const ProjectCoordinationEvidenceResult = z.object({version:z.literal(1),
|
|
85
|
+
receipts:z.array(z.discriminatedUnion("status",[
|
|
86
|
+
z.object({deliveryId:id,status:z.literal("recorded"),state:z.enum(["offered","context_hook","provider_payload"])}).strict(),
|
|
87
|
+
z.object({deliveryId:id,status:z.literal("rejected"),reason:z.enum(["unavailable","mismatch"])}).strict(),
|
|
88
|
+
])).max(8),
|
|
89
|
+
}).strict();
|
|
90
|
+
export type ProjectCoordinationEvidenceResult = z.infer<typeof ProjectCoordinationEvidenceResult>;
|
package/src/schemas/project.ts
CHANGED
|
@@ -5,17 +5,22 @@ import { ProjectId, Timestamp } from "./common.js";
|
|
|
5
5
|
* 项目管理协议(design D23)。
|
|
6
6
|
*
|
|
7
7
|
* 一个项目 = 一个目录 + Git。所有 session 必须绑定一个项目(projectId)。
|
|
8
|
-
*
|
|
9
|
-
*
|
|
8
|
+
* 项目对应本机目录,但注册的 projectId 归属连接 namespace;其他 tenant 的标识及
|
|
9
|
+
* 未映射的旧记录不能自动借用。本机用户显式共享目录不等于 API 授予跨 namespace 权限。
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
12
|
/** 项目描述。 */
|
|
13
13
|
export const ProjectDescriptor = z.object({
|
|
14
14
|
projectId: ProjectId,
|
|
15
|
+
/** Creator connection namespace. Missing means an unmapped legacy record, not implicit ownership. */
|
|
16
|
+
namespace: z.string().optional(),
|
|
17
|
+
/** Internal employee home, not a Registry project binding. */
|
|
18
|
+
employeeId:z.string().uuid().optional(),
|
|
15
19
|
/** 展示名。 */
|
|
16
20
|
name: z.string().min(1),
|
|
17
21
|
/** 项目目录的绝对路径(设备本地)。 */
|
|
18
22
|
path: z.string().min(1),
|
|
23
|
+
directoryIdentity:z.string().regex(/^dir:[a-f0-9]+:[a-f0-9]+$/).max(96).optional(),
|
|
19
24
|
/** 是否已 git init。 */
|
|
20
25
|
git: z.boolean().default(true),
|
|
21
26
|
/** 当前分支(若有)。 */
|
|
@@ -40,7 +45,8 @@ export const ProjectCreateParams = z.object({
|
|
|
40
45
|
git: z.boolean().default(true),
|
|
41
46
|
/** 可选:初始化时设置的远端。 */
|
|
42
47
|
remote: z.string().optional(),
|
|
43
|
-
|
|
48
|
+
existingDirectoryIdentity:z.string().regex(/^dir:[a-f0-9]+:[a-f0-9]+$/).max(96).optional(),
|
|
49
|
+
}).refine(value=>value.existingDirectoryIdentity===undefined||!!value.path&&value.git===false&&value.remote===undefined&&value.name.length<=120,"Existing directory registration needs a path, no Git initialization and a bounded name");
|
|
44
50
|
export type ProjectCreateParams = z.infer<typeof ProjectCreateParams>;
|
|
45
51
|
|
|
46
52
|
export const ProjectCreateResult = z.object({
|
|
@@ -48,6 +54,40 @@ export const ProjectCreateResult = z.object({
|
|
|
48
54
|
});
|
|
49
55
|
export type ProjectCreateResult = z.infer<typeof ProjectCreateResult>;
|
|
50
56
|
|
|
57
|
+
const provisionIdentity=z.string().regex(/^[pw]:[a-f0-9]+:[a-f0-9]+$/).max(80);
|
|
58
|
+
export const ProjectProvisionParams=z.object({clientRequestId:z.string().uuid(),name:z.string().min(1).max(120),expectedReceiverID:z.string().uuid()}).strict();
|
|
59
|
+
export type ProjectProvisionParams=z.infer<typeof ProjectProvisionParams>;
|
|
60
|
+
export const ProjectProvisionStatusParams=ProjectProvisionParams.pick({clientRequestId:true,expectedReceiverID:true}).strict();
|
|
61
|
+
export type ProjectProvisionStatusParams=z.infer<typeof ProjectProvisionStatusParams>;
|
|
62
|
+
const provisionStatus={clientRequestId:z.string().uuid(),receiverID:z.string().uuid()};
|
|
63
|
+
export const ProjectProvisionStatusResult=z.discriminatedUnion("state",[
|
|
64
|
+
z.object({...provisionStatus,state:z.literal("not_found"),found:z.literal(false),outcomeKnown:z.literal(false)}).strict(),
|
|
65
|
+
z.object({...provisionStatus,state:z.literal("prepared"),found:z.literal(true),outcomeKnown:z.literal(false),dispatchClaimed:z.literal(false)}).strict(),
|
|
66
|
+
z.object({...provisionStatus,state:z.enum(["dispatched","unknown"]),found:z.literal(true),outcomeKnown:z.literal(false),dispatchClaimed:z.literal(true)}).strict(),
|
|
67
|
+
z.object({...provisionStatus,state:z.literal("failed"),found:z.literal(true),outcomeKnown:z.literal(true),dispatchClaimed:z.literal(true),reasonCode:z.literal("creation_refused")}).strict(),
|
|
68
|
+
z.object({...provisionStatus,state:z.literal("confirmed"),found:z.literal(true),outcomeKnown:z.literal(true),dispatchClaimed:z.literal(true),
|
|
69
|
+
project:ProjectDescriptor,rootIdentity:provisionIdentity,workspaceIdentity:provisionIdentity}).strict(),
|
|
70
|
+
]);
|
|
71
|
+
export type ProjectProvisionStatusResult=z.infer<typeof ProjectProvisionStatusResult>;
|
|
72
|
+
|
|
73
|
+
// A durable, controller-owned linked checkout registered as an independent workspace.
|
|
74
|
+
const worktreeProvisionScope={clientRequestId:z.string().uuid(),expectedReceiverID:z.string().uuid(),projectId:ProjectId};
|
|
75
|
+
export const WorktreeProvisionParams=z.object({...worktreeProvisionScope,name:z.string().min(1).max(120),
|
|
76
|
+
baseBranch:z.string().min(1).max(255),newBranch:z.string().min(1).max(255)}).strict();
|
|
77
|
+
export type WorktreeProvisionParams=z.infer<typeof WorktreeProvisionParams>;
|
|
78
|
+
export const WorktreeProvisionStatusParams=z.object(worktreeProvisionScope).strict();
|
|
79
|
+
export type WorktreeProvisionStatusParams=z.infer<typeof WorktreeProvisionStatusParams>;
|
|
80
|
+
const worktreeProvisionReply={clientRequestId:z.string().uuid(),receiverID:z.string().uuid(),projectId:ProjectId};
|
|
81
|
+
export const WorktreeProvisionStatusResult=z.discriminatedUnion('state',[
|
|
82
|
+
z.object({...worktreeProvisionReply,state:z.literal('not_found'),found:z.literal(false),outcomeKnown:z.literal(false)}).strict(),
|
|
83
|
+
z.object({...worktreeProvisionReply,state:z.literal('prepared'),found:z.literal(true),outcomeKnown:z.literal(false),dispatchClaimed:z.literal(false)}).strict(),
|
|
84
|
+
z.object({...worktreeProvisionReply,state:z.enum(['dispatched','unknown']),found:z.literal(true),outcomeKnown:z.literal(false),dispatchClaimed:z.literal(true)}).strict(),
|
|
85
|
+
z.object({...worktreeProvisionReply,state:z.literal('failed'),found:z.literal(true),outcomeKnown:z.literal(true),dispatchClaimed:z.literal(true),reasonCode:z.literal('creation_refused')}).strict(),
|
|
86
|
+
z.object({...worktreeProvisionReply,state:z.literal('confirmed'),found:z.literal(true),outcomeKnown:z.literal(true),dispatchClaimed:z.literal(true),
|
|
87
|
+
workspace:ProjectDescriptor,directoryIdentity:z.string().regex(/^dir:[a-f0-9]+:[a-f0-9]+$/),baseCommit:z.string().regex(/^[a-f0-9]{40,64}$/),branch:z.string().min(1).max(255)}).strict(),
|
|
88
|
+
]);
|
|
89
|
+
export type WorktreeProvisionStatusResult=z.infer<typeof WorktreeProvisionStatusResult>;
|
|
90
|
+
|
|
51
91
|
// --- project.list ---
|
|
52
92
|
export const ProjectListParams = z.object({}).default({});
|
|
53
93
|
export type ProjectListParams = z.infer<typeof ProjectListParams>;
|
|
@@ -328,6 +368,16 @@ export const GitPushResult = z.object({
|
|
|
328
368
|
});
|
|
329
369
|
export type GitPushResult = z.infer<typeof GitPushResult>;
|
|
330
370
|
|
|
371
|
+
// --- project.git.origin ---
|
|
372
|
+
export const GitOriginParams=z.object({projectId:ProjectId}).strict();
|
|
373
|
+
export const GitOriginResult=z.object({projectId:ProjectId,path:z.string().min(1).max(4096),repositoryRoot:z.string().min(1).max(4096),observedAt:Timestamp,
|
|
374
|
+
origin:z.discriminatedUnion('state',[
|
|
375
|
+
z.object({state:z.literal('configured'),url:z.string().min(1).max(2048)}).strict(),
|
|
376
|
+
z.object({state:z.enum(['missing','unsupported'])}).strict(),
|
|
377
|
+
]),
|
|
378
|
+
}).strict();
|
|
379
|
+
export type GitOriginResult=z.infer<typeof GitOriginResult>;
|
|
380
|
+
|
|
331
381
|
// --- project.git.status ---
|
|
332
382
|
export const GitStatusParams = z.object({
|
|
333
383
|
projectId: ProjectId,
|
|
@@ -339,12 +389,27 @@ export const GitFileStatus = z.object({
|
|
|
339
389
|
/** 文件路径(相对 cwd) */
|
|
340
390
|
path: z.string(),
|
|
341
391
|
/** 索引区状态(git status --porcelain 第 1 位) */
|
|
342
|
-
index: z.enum(["unmodified", "modified", "added", "deleted", "renamed", "copied", "untracked"]),
|
|
392
|
+
index: z.enum(["unmodified", "modified", "added", "deleted", "renamed", "copied", "untracked", "unmerged", "typeChanged"]),
|
|
343
393
|
/** 工作区状态(第 2 位) */
|
|
344
|
-
worktree: z.enum(["unmodified", "modified", "added", "deleted", "renamed", "copied", "untracked"]),
|
|
394
|
+
worktree: z.enum(["unmodified", "modified", "added", "deleted", "renamed", "copied", "untracked", "unmerged", "typeChanged"]),
|
|
345
395
|
});
|
|
346
396
|
export type GitFileStatus = z.infer<typeof GitFileStatus>;
|
|
347
397
|
|
|
398
|
+
export const GitWorkspaceObservation = z.object({
|
|
399
|
+
projectId: ProjectId,
|
|
400
|
+
worktreeId: z.string().min(1).optional(),
|
|
401
|
+
path: z.string().min(1).max(4096),
|
|
402
|
+
repositoryRoot: z.string().min(1).max(4096),
|
|
403
|
+
isWorktree: z.boolean(),
|
|
404
|
+
detached: z.boolean(),
|
|
405
|
+
head: z.string().regex(/^[a-f0-9]{40,64}$/).optional(),
|
|
406
|
+
observedAt: Timestamp,
|
|
407
|
+
changedFileCount: z.number().int().nonnegative(),
|
|
408
|
+
trackedChangedFileCount: z.number().int().nonnegative(),
|
|
409
|
+
untrackedFileCount: z.number().int().nonnegative(),
|
|
410
|
+
}).strict().refine(value => value.changedFileCount === value.trackedChangedFileCount + value.untrackedFileCount);
|
|
411
|
+
export type GitWorkspaceObservation = z.infer<typeof GitWorkspaceObservation>;
|
|
412
|
+
|
|
348
413
|
export const GitStatusResult = z.object({
|
|
349
414
|
branch: z.string(),
|
|
350
415
|
/** 是否 dirty(有任何未提交改动) */
|
|
@@ -354,6 +419,8 @@ export const GitStatusResult = z.object({
|
|
|
354
419
|
behind: z.number().int().nonnegative().optional(),
|
|
355
420
|
upstream: z.string().optional(),
|
|
356
421
|
files: z.array(GitFileStatus),
|
|
422
|
+
/** Live, bounded device observation. Older peers may omit it. */
|
|
423
|
+
workspace: GitWorkspaceObservation.optional(),
|
|
357
424
|
});
|
|
358
425
|
export type GitStatusResult = z.infer<typeof GitStatusResult>;
|
|
359
426
|
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
|
|
3
|
+
export const ReasoningLevel = z.enum(["low", "standard", "high", "xhigh", "max"]);
|
|
4
|
+
export type ReasoningLevel = z.infer<typeof ReasoningLevel>;
|
|
5
|
+
// null explicitly removes Phonon's override; omission preserves legacy behavior.
|
|
6
|
+
export const TurnReasoning = z.object({ level: ReasoningLevel.nullable() }).strict();
|
|
7
|
+
export type TurnReasoning = z.infer<typeof TurnReasoning>;
|
|
8
|
+
export const ReasoningConfirmation = z.object({
|
|
9
|
+
requestedLevel: ReasoningLevel.nullable(),
|
|
10
|
+
nativeValue: z.enum(["off","none","minimal","low","medium","high","xhigh","max","ultra","auto","adaptive"]).nullable(),
|
|
11
|
+
effectiveLevel: ReasoningLevel.optional(),
|
|
12
|
+
}).strict();
|
|
13
|
+
export type ReasoningConfirmation = z.infer<typeof ReasoningConfirmation>;
|