qlogicagent 2.24.1 → 2.24.2

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.
Files changed (297) hide show
  1. package/README.md +52 -324
  2. package/dist/agent.js +38 -43
  3. package/dist/cli.js +7 -7
  4. package/dist/default-project-knowledge/INSTRUCTIONS.md +7 -7
  5. package/dist/default-project-knowledge/rules/project-workflow.md +6 -6
  6. package/dist/index.js +265 -1018
  7. package/dist/orchestration.js +10 -10
  8. package/dist/types/agent/runtime-vars.d.ts +1 -16
  9. package/dist/types/agent/tool-loop/compression-pipeline.d.ts +0 -2
  10. package/dist/types/agent/tool-loop.d.ts +0 -6
  11. package/dist/types/agent/types.d.ts +3 -22
  12. package/dist/types/cli/acp-commands.d.ts +4 -5
  13. package/dist/types/cli/acp-message-router.d.ts +1 -2
  14. package/dist/types/cli/acp-session-handlers.d.ts +6 -12
  15. package/dist/types/cli/acp-session-host.d.ts +5 -48
  16. package/dist/types/cli/adapter-launch-config.d.ts +14 -0
  17. package/dist/types/cli/agent-runtime-bootstrap.d.ts +2 -23
  18. package/dist/types/cli/agent-runtime-session-state.d.ts +1 -6
  19. package/dist/types/cli/base-tool-bootstrap.d.ts +0 -2
  20. package/dist/types/cli/cli-acp-request-handler.d.ts +3 -5
  21. package/dist/types/cli/core-tool-coordinator.d.ts +0 -4
  22. package/dist/types/cli/core-tools/agent-tool-service.d.ts +0 -3
  23. package/dist/types/cli/core-tools/fork-system-prompt.d.ts +1 -5
  24. package/dist/types/cli/handlers/files-handler.d.ts +0 -6
  25. package/dist/types/cli/handlers/turn-handler.d.ts +7 -83
  26. package/dist/types/cli/main.d.ts +2 -4
  27. package/dist/types/cli/permission-approval-bridge.d.ts +2 -6
  28. package/dist/types/cli/permission-bootstrap.d.ts +2 -12
  29. package/dist/types/cli/plugin-bootstrap.d.ts +2 -4
  30. package/dist/types/cli/runtime-hook-bootstrap.d.ts +0 -21
  31. package/dist/types/cli/session-context.d.ts +4 -14
  32. package/dist/types/cli/session-coordinator.d.ts +1 -9
  33. package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +2 -9
  34. package/dist/types/cli/stdio-acp-request-host.d.ts +3 -15
  35. package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +3 -23
  36. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -8
  37. package/dist/types/cli/stdio-runtime-services.d.ts +2 -13
  38. package/dist/types/cli/stdio-server.d.ts +6 -128
  39. package/dist/types/cli/tool-bootstrap.d.ts +4 -8
  40. package/dist/types/cli/tool-catalog.d.ts +2 -2
  41. package/dist/types/cli/tool-invoker-factory.d.ts +0 -2
  42. package/dist/types/cli/tool-registry-adapter.d.ts +3 -7
  43. package/dist/types/cli/tool-result-processor.d.ts +0 -1
  44. package/dist/types/cli/turn-core.d.ts +6 -10
  45. package/dist/types/cli/turn-event-forwarder.d.ts +6 -3
  46. package/dist/types/cli/turn-lifecycle.d.ts +0 -3
  47. package/dist/types/cli/turn-project-router.d.ts +0 -7
  48. package/dist/types/contracts/hooks.d.ts +1 -20
  49. package/dist/types/contracts/tool-execution-evidence.d.ts +20 -1
  50. package/dist/types/contracts/turn-event.d.ts +2 -2
  51. package/dist/types/orchestration/index.d.ts +1 -1
  52. package/dist/types/protocol/notifications.d.ts +2 -9
  53. package/dist/types/protocol/wire/acp-protocol.d.ts +12 -186
  54. package/dist/types/protocol/wire/capability-transport.d.ts +0 -2
  55. package/dist/types/protocol/wire/index.d.ts +2 -10
  56. package/dist/types/protocol/wire/notification-payloads.d.ts +4 -989
  57. package/dist/types/protocol/wire/thread-protocol.d.ts +24 -3
  58. package/dist/types/runtime/config/tunable-defaults.d.ts +3 -75
  59. package/dist/types/runtime/execution/forked-agent.d.ts +2 -5
  60. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +0 -2
  61. package/dist/types/runtime/execution/tool-result-storage.d.ts +13 -4
  62. package/dist/types/runtime/infra/agent-paths.d.ts +4 -54
  63. package/dist/types/runtime/infra/agent-project-projection.d.ts +20 -0
  64. package/dist/types/runtime/infra/background-tasks.d.ts +3 -3
  65. package/dist/types/runtime/infra/default-path-service.d.ts +0 -7
  66. package/dist/types/runtime/infra/llmrouter-catalog.d.ts +1 -1
  67. package/dist/types/runtime/infra/model-registry.d.ts +6 -9
  68. package/dist/types/runtime/infra/project-store.d.ts +3 -3
  69. package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +54 -7
  70. package/dist/types/runtime/infra/task-runtime.d.ts +1 -1
  71. package/dist/types/runtime/ports/agent-runtime-ports.d.ts +1 -3
  72. package/dist/types/runtime/ports/index.d.ts +0 -4
  73. package/dist/types/runtime/ports/path-service.d.ts +1 -9
  74. package/dist/types/runtime/ports/tool-contracts.d.ts +0 -1
  75. package/dist/types/runtime/session/agent-session-projection.d.ts +37 -0
  76. package/dist/types/runtime/tasks/task-types.d.ts +2 -25
  77. package/dist/types/skills/mcp/mcp-manager.d.ts +2 -2
  78. package/dist/types/skills/plugins/plugin-loader.d.ts +1 -1
  79. package/dist/types/skills/skill-system/skill-category.d.ts +4 -2
  80. package/dist/types/skills/tools.d.ts +1 -18
  81. package/dist/types/test-support/project-store-fixture.d.ts +4 -4
  82. package/dist/types/transport/acp-event-emitter.d.ts +1 -20
  83. package/dist/types/transport/acp-server.d.ts +8 -88
  84. package/package.json +4 -96
  85. package/dist/agent-contract.js +0 -1
  86. package/dist/host-contract.js +0 -1
  87. package/dist/host-session-collection-contract.js +0 -1
  88. package/dist/memory-category-contract.js +0 -1
  89. package/dist/permissions.js +0 -1
  90. package/dist/plugin-marketplace-compute.js +0 -1
  91. package/dist/project-memory-host.js +0 -38
  92. package/dist/protocol.js +0 -1
  93. package/dist/skill-category-contract.js +0 -1
  94. package/dist/tunables.js +0 -1
  95. package/dist/types/agent/memory-recall-context.d.ts +0 -22
  96. package/dist/types/agent/memory-recall-injection.d.ts +0 -32
  97. package/dist/types/cli/acp-extended-handlers.d.ts +0 -110
  98. package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -20
  99. package/dist/types/cli/community-resource-installer.d.ts +0 -39
  100. package/dist/types/cli/community-skill-installer.d.ts +0 -18
  101. package/dist/types/cli/community-workflow-installer.d.ts +0 -29
  102. package/dist/types/cli/default-project-bootstrap.d.ts +0 -12
  103. package/dist/types/cli/dream-host-adapter.d.ts +0 -24
  104. package/dist/types/cli/gateway-rpc-connection.d.ts +0 -50
  105. package/dist/types/cli/handlers/community-handler.d.ts +0 -14
  106. package/dist/types/cli/handlers/config-handler.d.ts +0 -19
  107. package/dist/types/cli/handlers/control-handler.d.ts +0 -29
  108. package/dist/types/cli/handlers/dream-handler.d.ts +0 -41
  109. package/dist/types/cli/handlers/goal-handler.d.ts +0 -66
  110. package/dist/types/cli/handlers/memory-handler.d.ts +0 -23
  111. package/dist/types/cli/handlers/product-handler.d.ts +0 -35
  112. package/dist/types/cli/handlers/session-handler.d.ts +0 -29
  113. package/dist/types/cli/handlers/skill-curator-handler.d.ts +0 -8
  114. package/dist/types/cli/handlers/solo-handler.d.ts +0 -25
  115. package/dist/types/cli/handlers/turn-baseline-handler.d.ts +0 -8
  116. package/dist/types/cli/handlers/workflow-compute-handler.d.ts +0 -8
  117. package/dist/types/cli/handlers/working-materials-handler.d.ts +0 -9
  118. package/dist/types/cli/idle-dream-coordinator.d.ts +0 -57
  119. package/dist/types/cli/memory-background-coordinator.d.ts +0 -26
  120. package/dist/types/cli/memory-candidate-service.d.ts +0 -75
  121. package/dist/types/cli/memory-coordinator.d.ts +0 -40
  122. package/dist/types/cli/multi-agent-handler-host.d.ts +0 -16
  123. package/dist/types/cli/multi-agent-state-coordinator.d.ts +0 -8
  124. package/dist/types/cli/orchestration-memory-context.d.ts +0 -23
  125. package/dist/types/cli/product-acp-params.d.ts +0 -30
  126. package/dist/types/cli/product-coordinator.d.ts +0 -21
  127. package/dist/types/cli/project-memory-store-factory.d.ts +0 -12
  128. package/dist/types/cli/project-template-seeder.d.ts +0 -5
  129. package/dist/types/cli/rpc-registry.d.ts +0 -56
  130. package/dist/types/cli/session-history-coordinator.d.ts +0 -8
  131. package/dist/types/cli/session-query-service.d.ts +0 -27
  132. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -56
  133. package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -17
  134. package/dist/types/cli/task-distillation-coordinator.d.ts +0 -146
  135. package/dist/types/cli/turn-ask-user-setup.d.ts +0 -24
  136. package/dist/types/cli/turn-suggestion-generator.d.ts +0 -15
  137. package/dist/types/contracts/memory-recall-packet.d.ts +0 -31
  138. package/dist/types/contracts/memory-response-contract.d.ts +0 -2
  139. package/dist/types/host-contract/fts-segment.d.ts +0 -20
  140. package/dist/types/host-contract/index.d.ts +0 -1819
  141. package/dist/types/host-contract/memory-category.d.ts +0 -8
  142. package/dist/types/host-contract/skill-category.d.ts +0 -5
  143. package/dist/types/host-session-collection-contract.d.ts +0 -65
  144. package/dist/types/orchestration/agent-instance.d.ts +0 -215
  145. package/dist/types/orchestration/agent-roster.d.ts +0 -32
  146. package/dist/types/orchestration/dag-scheduler.d.ts +0 -219
  147. package/dist/types/orchestration/delegate-approval-policy.d.ts +0 -8
  148. package/dist/types/orchestration/delegate-bridge.d.ts +0 -8
  149. package/dist/types/orchestration/goal-acceptance.d.ts +0 -17
  150. package/dist/types/orchestration/goal-context-envelope.d.ts +0 -7
  151. package/dist/types/orchestration/goal-loop-coordinator.d.ts +0 -151
  152. package/dist/types/orchestration/goal-mode-adapters.d.ts +0 -152
  153. package/dist/types/orchestration/goal-run-persistence.d.ts +0 -21
  154. package/dist/types/orchestration/goal-run-types.d.ts +0 -225
  155. package/dist/types/orchestration/planner-memory-brief.d.ts +0 -39
  156. package/dist/types/orchestration/product-budget.d.ts +0 -94
  157. package/dist/types/orchestration/product-checkpoint.d.ts +0 -50
  158. package/dist/types/orchestration/product-dag-mutation-applier.d.ts +0 -10
  159. package/dist/types/orchestration/product-persistence.d.ts +0 -90
  160. package/dist/types/orchestration/product-planner.d.ts +0 -332
  161. package/dist/types/orchestration/product-run-coordinator.d.ts +0 -49
  162. package/dist/types/orchestration/product-worktree.d.ts +0 -19
  163. package/dist/types/orchestration/run-state-host-authority.d.ts +0 -7
  164. package/dist/types/orchestration/solo-evaluator.d.ts +0 -179
  165. package/dist/types/orchestration/solo-persistence.d.ts +0 -47
  166. package/dist/types/orchestration/solo-spec-builder.d.ts +0 -58
  167. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +0 -23
  168. package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +0 -7
  169. package/dist/types/orchestration/testing/run-state-client-double.d.ts +0 -13
  170. package/dist/types/orchestration/workflow/budget-permission-gate.d.ts +0 -94
  171. package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +0 -3
  172. package/dist/types/orchestration/workflow/builtin-executors.d.ts +0 -18
  173. package/dist/types/orchestration/workflow/capability-catalog.d.ts +0 -72
  174. package/dist/types/orchestration/workflow/cron-schedule.d.ts +0 -36
  175. package/dist/types/orchestration/workflow/data-item.d.ts +0 -39
  176. package/dist/types/orchestration/workflow/expression.d.ts +0 -60
  177. package/dist/types/orchestration/workflow/host-executors.d.ts +0 -15
  178. package/dist/types/orchestration/workflow/n8n-expression.d.ts +0 -48
  179. package/dist/types/orchestration/workflow/n8n-import.d.ts +0 -64
  180. package/dist/types/orchestration/workflow/n8n-template-compat.d.ts +0 -5
  181. package/dist/types/orchestration/workflow/node-registry.d.ts +0 -32
  182. package/dist/types/orchestration/workflow/node-schema.d.ts +0 -249
  183. package/dist/types/orchestration/workflow/params-schema.d.ts +0 -69
  184. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +0 -63
  185. package/dist/types/orchestration/workflow/run-checkpoint-store.d.ts +0 -53
  186. package/dist/types/orchestration/workflow/run-history-store.d.ts +0 -103
  187. package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +0 -65
  188. package/dist/types/orchestration/workflow/trigger-validation.d.ts +0 -22
  189. package/dist/types/orchestration/workflow/workflow-audit-store.d.ts +0 -31
  190. package/dist/types/orchestration/workflow/workflow-authoring.d.ts +0 -74
  191. package/dist/types/orchestration/workflow/workflow-bundle.d.ts +0 -51
  192. package/dist/types/orchestration/workflow/workflow-controller.d.ts +0 -237
  193. package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +0 -46
  194. package/dist/types/orchestration/workflow/workflow-error.d.ts +0 -28
  195. package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +0 -56
  196. package/dist/types/orchestration/workflow/workflow-patch.d.ts +0 -122
  197. package/dist/types/orchestration/workflow/workflow-render.d.ts +0 -40
  198. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +0 -184
  199. package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +0 -122
  200. package/dist/types/orchestration/workflow/workflow-store.d.ts +0 -85
  201. package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +0 -65
  202. package/dist/types/orchestration/workflow/workflow-trigger.d.ts +0 -43
  203. package/dist/types/orchestration/workflow-chat-builder.d.ts +0 -152
  204. package/dist/types/orchestration/worktree-task-prompt.d.ts +0 -1
  205. package/dist/types/permissions.d.ts +0 -4
  206. package/dist/types/project-memory-host.d.ts +0 -4
  207. package/dist/types/protocol/agent-contract.d.ts +0 -93
  208. package/dist/types/protocol/methods.d.ts +0 -645
  209. package/dist/types/protocol/wire/acp-agent-management.d.ts +0 -533
  210. package/dist/types/protocol/wire/agent-events.d.ts +0 -1
  211. package/dist/types/protocol/wire/agent-methods.d.ts +0 -500
  212. package/dist/types/protocol/wire/agent-rpc.d.ts +0 -100
  213. package/dist/types/protocol/wire/gateway-contract.d.ts +0 -61
  214. package/dist/types/protocol/wire/gateway-rpc.d.ts +0 -1177
  215. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +0 -31
  216. package/dist/types/protocol/wire/turn.d.ts +0 -208
  217. package/dist/types/runtime/community/autonomy-budget.d.ts +0 -26
  218. package/dist/types/runtime/community/community-consent-client.d.ts +0 -55
  219. package/dist/types/runtime/community/package-materialize.d.ts +0 -19
  220. package/dist/types/runtime/community/ranged-download.d.ts +0 -21
  221. package/dist/types/runtime/community/registry-signature.d.ts +0 -48
  222. package/dist/types/runtime/execution/dream-agent.d.ts +0 -273
  223. package/dist/types/runtime/execution/dream-category-context.d.ts +0 -47
  224. package/dist/types/runtime/execution/memory-decay.d.ts +0 -73
  225. package/dist/types/runtime/execution/turn-progress-notifier.d.ts +0 -16
  226. package/dist/types/runtime/hooks/memory-hooks.d.ts +0 -111
  227. package/dist/types/runtime/infra/acp-host-handler.d.ts +0 -31
  228. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +0 -209
  229. package/dist/types/runtime/infra/acp-usage-tracker.d.ts +0 -46
  230. package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +0 -4
  231. package/dist/types/runtime/infra/feedback-distillation-worker.d.ts +0 -20
  232. package/dist/types/runtime/infra/feedback-distillation.d.ts +0 -32
  233. package/dist/types/runtime/infra/feedback-event-store.d.ts +0 -179
  234. package/dist/types/runtime/infra/feedback-host-authority.d.ts +0 -4
  235. package/dist/types/runtime/infra/feedback-outbox.d.ts +0 -26
  236. package/dist/types/runtime/infra/feedback-redaction.d.ts +0 -71
  237. package/dist/types/runtime/infra/feedback-upload-client.d.ts +0 -39
  238. package/dist/types/runtime/infra/feedback-upload-worker.d.ts +0 -11
  239. package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +0 -17
  240. package/dist/types/runtime/infra/project-authority-facade.d.ts +0 -11
  241. package/dist/types/runtime/infra/project-data-paths.d.ts +0 -24
  242. package/dist/types/runtime/infra/project-host-authority.d.ts +0 -11
  243. package/dist/types/runtime/infra/project-instructions-store.d.ts +0 -30
  244. package/dist/types/runtime/infra/turn-baseline-store.d.ts +0 -102
  245. package/dist/types/runtime/infra/turn-telemetry-store.d.ts +0 -100
  246. package/dist/types/runtime/infra/working-materials-store.d.ts +0 -29
  247. package/dist/types/runtime/memory/find-relevant-memories.d.ts +0 -26
  248. package/dist/types/runtime/memory/implicit-extraction.d.ts +0 -69
  249. package/dist/types/runtime/memory/memory-recall-attribution.d.ts +0 -24
  250. package/dist/types/runtime/ports/memory-provider.d.ts +0 -219
  251. package/dist/types/runtime/ports/memory-recall-source.d.ts +0 -14
  252. package/dist/types/runtime/ports/memory-writer.d.ts +0 -70
  253. package/dist/types/runtime/ports/project-memory-store.d.ts +0 -49
  254. package/dist/types/runtime/prompt/host-skill-directory.d.ts +0 -16
  255. package/dist/types/runtime/session/group-session-split.d.ts +0 -38
  256. package/dist/types/runtime/session/inbound-upload-persistence.d.ts +0 -47
  257. package/dist/types/runtime/session/session-catalog.d.ts +0 -12
  258. package/dist/types/runtime/session/session-deletion-guard.d.ts +0 -4
  259. package/dist/types/runtime/session/session-locator.d.ts +0 -26
  260. package/dist/types/runtime/session/session-metadata-store.d.ts +0 -8
  261. package/dist/types/runtime/session/session-paths.d.ts +0 -8
  262. package/dist/types/runtime/session/session-permission-store.d.ts +0 -6
  263. package/dist/types/runtime/session/session-persistence.d.ts +0 -37
  264. package/dist/types/runtime/session/session-recovery.d.ts +0 -62
  265. package/dist/types/runtime/session/session-resource-key.d.ts +0 -28
  266. package/dist/types/runtime/session/session-resume.d.ts +0 -9
  267. package/dist/types/runtime/session/session-schema.d.ts +0 -10
  268. package/dist/types/runtime/session/session-summary.d.ts +0 -7
  269. package/dist/types/runtime/session/session-title.d.ts +0 -9
  270. package/dist/types/runtime/session/session-transcript-store.d.ts +0 -30
  271. package/dist/types/runtime/session/session-types.d.ts +0 -113
  272. package/dist/types/runtime/session/session-write-queue.d.ts +0 -3
  273. package/dist/types/skills/memory/host-memory-provider.d.ts +0 -235
  274. package/dist/types/skills/memory/memdir.d.ts +0 -111
  275. package/dist/types/skills/memory/memory-content-safety.d.ts +0 -1
  276. package/dist/types/skills/memory/memory-vector-utils.d.ts +0 -2
  277. package/dist/types/skills/memory/task-distillation.d.ts +0 -183
  278. package/dist/types/skills/plugins/plugin-marketplace.d.ts +0 -43
  279. package/dist/types/skills/skill-system/skill-bundles.d.ts +0 -8
  280. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +0 -89
  281. package/dist/types/test-support/run-state-authority-setup.d.ts +0 -1
  282. package/dist/types/transport/delegate-client.d.ts +0 -82
  283. package/dist/types/transport/host-capability-client.d.ts +0 -21
  284. package/dist/types/transport/host-cloud-auth-client.d.ts +0 -10
  285. package/dist/types/transport/host-community-client.d.ts +0 -7
  286. package/dist/types/transport/host-feedback-client.d.ts +0 -25
  287. package/dist/types/transport/host-profile-client.d.ts +0 -19
  288. package/dist/types/transport/host-project-client.d.ts +0 -16
  289. package/dist/types/transport/host-request-client.d.ts +0 -42
  290. package/dist/types/transport/host-run-state-client.d.ts +0 -23
  291. package/dist/types/transport/host-session-client.d.ts +0 -30
  292. package/dist/types/tunables.d.ts +0 -2
  293. package/dist/types/workflow-host.d.ts +0 -38
  294. package/dist/workflow-host.js +0 -11
  295. /package/dist/types/{host-contract → protocol/wire}/acp-content.d.ts +0 -0
  296. /package/dist/types/{host-contract → runtime/infra}/project-id.d.ts +0 -0
  297. /package/dist/types/{host-contract → runtime/infra}/provider-profile.d.ts +0 -0
@@ -1,1819 +0,0 @@
1
- /**
2
- * Public Gateway Host contract consumed by xiaozhiclaw-runtime and qlogicagent.
3
- * This file is the executable contract authority; current composition roots and tests are the
4
- * implementation evidence. Historical migration drafts are not compatibility contracts.
5
- */
6
- import { type ModelPurpose } from "@xiaozhiclaw/module-sdk/model-access";
7
- import type { CapabilityRequirementV1 } from "@xiaozhiclaw/module-sdk";
8
- import type { AcpContentBlock } from "./acp-content.js";
9
- import type { NativeTranscript } from "../host-session-collection-contract.js";
10
- export { MODEL_PURPOSES, type ModelPurpose } from "@xiaozhiclaw/module-sdk/model-access";
11
- export type { HostSessionCollectionDelta, HostSessionCollectionScope, HostSessionCollectionSnapshot, HostSessionLifecycle, HostSessionProviderDiagnostic, HostSessionSummary, HostSessionTitleSource, NativeTranscript, NativeTranscriptMessage, } from "../host-session-collection-contract.js";
12
- export { isHostSessionCollectionDelta, isHostSessionCollectionSnapshot, isNativeTranscript, } from "../host-session-collection-contract.js";
13
- export * from "./provider-profile.js";
14
- export * from "./memory-category.js";
15
- export type { AcpContentBlock, AcpResourceContents } from "./acp-content.js";
16
- /** agent 逻辑身份(小智自身也是一个 agentId="qlogicagent")。自身 vs 第三方仅由此值决定(F2)。 */
17
- export type AgentId = string;
18
- /** 确定性派生的项目主键(current contract,抄 VSCode getWorkspaceId)。绝不随机、绝不裸路径。 */
19
- export type ProjectId = string;
20
- /** 会话稳定身份(创建即恒定,session-identity-alignment-spec)。 */
21
- export type CanonicalSessionId = string;
22
- /** 能力实例种类。 */
23
- export type MemberKind = "chat" | "product-leader" | "product-worker" | "goal-leader" | "solo-racer" | "workflow-node";
24
- /**
25
- * 能力实例的结构化 handle(current contract,抄 VSCode ExtensionRunningLocation)。可判等、可字符串化。
26
- * 取代今天各特性自造的 memberId 串(chat-* / product-*:*:* / goal-*:leader / solo-* / workflow-agent-*)。
27
- */
28
- export interface MemberHandle {
29
- kind: MemberKind;
30
- /** 归属上下文:canonicalSessionId | productId | goalRunId | workflowRunId */
31
- owner: string;
32
- /** 人类可读名(instance 名/leader/worker 等) */
33
- name: string;
34
- /** 实例序号(≈ VSCode affinity;同种多实例区分) */
35
- seq: number;
36
- }
37
- /** 稳定字符串键(路由/日志/存储用)。字段含分隔符即 fail-loud,绝不静默错路由。 */
38
- export declare function memberKey(h: MemberHandle): string;
39
- export declare function memberEquals(a: MemberHandle, b: MemberHandle): boolean;
40
- /**
41
- * 一次委派/回合所需的会话上下文,由 SessionProjectService 解析后传入 Supervisor。
42
- * cwd/resumeNativeId 不再由调用点各自拼装,而是从会话面权威解析。
43
- */
44
- export interface SessionContext {
45
- canonicalSessionId: CanonicalSessionId;
46
- projectId: ProjectId;
47
- /** 项目/worktree 工作目录 */
48
- cwd: string;
49
- /** 仅 native-cwd agent(codex/claude)有意义(current contract:传输层重连令牌,不承担状态恢复) */
50
- resumeNativeId?: string;
51
- }
52
- /** sendTurn 的统一返回(current contract:消灭"外部对象 / 内部字符串"双形态)。 */
53
- export interface TurnResult {
54
- content: string;
55
- stopReason?: string;
56
- usage?: {
57
- inputTokens?: number;
58
- outputTokens?: number;
59
- };
60
- /** 仅诊断,永不进入下游解析输入 */
61
- diagnostics?: unknown;
62
- }
63
- /** agent 实例存活/失败状态(current contract 判活 + §5.3 fail-loud)。 */
64
- export type AgentInstanceState = "starting" | "ready" | "busy" | "unresponsive" | "exited";
65
- /**
66
- * 结构化失败归类(current contract E3:失败一律结构化明示,不得降级成裸 error 串)。
67
- * UNKNOWN = 无法归类时的显式兜底:禁止硬塞错误 code,也禁止因归不了类降级成裸串。
68
- */
69
- export declare const LIFECYCLE_CODES: readonly ["CANCELLED", "PROCESS_EXIT", "HEARTBEAT_TIMEOUT", "TURN_TIMEOUT", "PROTOCOL_MISMATCH", "UNKNOWN"];
70
- export type LifecycleCode = (typeof LIFECYCLE_CODES)[number];
71
- /**
72
- * 确定性派生 projectId —— host-contract leaf 内的唯一实现(project-id.ts):
73
- * sha256(resolve(workspaceDir).toLowerCase()).hex[:16]。
74
- * 两端(gateway/agent)共用同一实现,零协商对齐;绝不允许第二份实现(否则 projectData 键漂移=数据全丢)。
75
- */
76
- export { deriveProjectId } from "./project-id.js";
77
- /** 三态鉴权(llmrouter 注 sk-qllm / direct 厂商 key / oauth)解析后的结果,注入 spawn env。 */
78
- export interface ResolvedCredentials {
79
- mode: "llmrouter" | "direct" | "oauth";
80
- env: Record<string, string>;
81
- }
82
- export interface AgentSpec {
83
- /** 决定 self-descriptor(cliPath=process.execPath)还是第三方 descriptor(F2) */
84
- agentId: AgentId;
85
- /** cwd/resume 由此来(不再由调用点拼) */
86
- session: SessionContext;
87
- systemPrompt?: string;
88
- /** Gateway materialized, session-scoped non-secret model/permission profile. */
89
- profile?: ResolvedSpawnProfile;
90
- /** 三态鉴权由 CredentialResolver 按 agentId 解析后显式传入(current contract);不糊在 envOverrides,明文不进事件/日志 */
91
- credentials?: ResolvedCredentials;
92
- /** 仅非密的运行覆盖(如 solo 自身分支 QLOGICAGENT_WORKTREE_WORKDIR/SOLO_LEAN) */
93
- envOverrides?: Record<string, string>;
94
- }
95
- /** 回合输入内容块直接引用官方 ACP wire 单一事实源。 */
96
- export type ContentBlock = AcpContentBlock;
97
- /**
98
- * 每回合上下文(2026-07-09 S3 综合补遗 A1;权威形状 = agent 侧 buildSessionMeta + turnId)。
99
- * 现瘦 sendTurn(prompt:string) 收不下这些(executeTurn:632 实证)→ 富签名。
100
- * 列已核实的承重字段,实现期随 buildSessionMeta 真实形状对齐收紧类型。
101
- */
102
- export interface PerTurnMeta {
103
- turnId?: string;
104
- permissions?: unknown;
105
- reasoning?: unknown;
106
- assistantId?: string;
107
- activeSkills?: string[];
108
- attachments?: unknown[];
109
- mcpServers?: unknown[];
110
- [k: string]: unknown;
111
- }
112
- /** sendTurn 富输入(S3 综合补遗 A1:取代裸 prompt:string,承多模态内容块 + per-turn meta)。 */
113
- export interface TurnInput {
114
- messages: ContentBlock[];
115
- meta?: PerTurnMeta;
116
- }
117
- /**
118
- * 中立监督每个 agent 进程(小智自身 + 第三方对等),不嵌套。
119
- * 判活=ACK 响应性(current contract,内部实现,不暴露方法名清单)。失败=结构化事件(§5.3),不静默杀。
120
- *
121
- * 不变式(冻结):
122
- * - F1 单注册:一个 memberKey(handle) 至多一个实例(池化种类按 key 复用)。
123
- * - F2 自身/第三方唯一由 agentId 决定;调用点不得再各自决定进程形态。
124
- * - F3 结构隔离(§11.4#4):host 与 agent 引导入口物理不同、互不派生;删除运行时"拒 qlogicagent"闸。
125
- * - F4 判活单轨(§5.1):仅 ACK 响应性,无 agent 心跳、无方法名豁免清单;unresponsive 是状态非杀。
126
- * - F5 leader 约束(§11.4#6):product-leader 固定 qlogicagent;goal-leader 取 Gateway canonical session owner。
127
- * - F6 判活地板 = "任意协议消息计活"(§6.3);我方 agent 可另加 ping 作补充、不作地板。
128
- */
129
- export interface AgentSupervisor {
130
- /** 确保 handle 对应实例在跑(不在则 spawn,池化种类复用)。Host capabilities 由 session-bound projection 注入。 */
131
- ensure(handle: MemberHandle, spec: AgentSpec): Promise<void>;
132
- /**
133
- * 向实例发一个回合,流式事件经 subscribe 回流,最终 resolve 统一 TurnResult。取代 processManager.sendTask。
134
- * (S3 综合补遗 A1)input 富签名:承多模态内容块 + per-turn meta(permissions/reasoning/assistantId/
135
- * activeSkills/attachments/mcpServers);裸 prompt:string 会丢这些回合上下文。
136
- */
137
- sendTurn(handle: MemberHandle, input: TurnInput, opts?: {
138
- timeoutMs?: number;
139
- signal?: AbortSignal;
140
- }): Promise<TurnResult>;
141
- /**
142
- * 订阅实例的回合/生命周期事件(delta/tool/approval/media/relay/state)。见 §4 事件契约。
143
- * (S3 综合补遗 A4)granularity:leader 用 "coarse"(省 delta,只收 tool/approval/lifecycle/media/turn 终态,
144
- * 背压砍到控制面);ws/UI 用 "full"(逐 delta 全保真)。缺省 "full"。
145
- */
146
- subscribe(handle: MemberHandle, sink: SupervisorEventSink, opts?: {
147
- granularity?: "full" | "coarse";
148
- }): () => void;
149
- /**
150
- * 审批应答入口(2026-07-09 补遗#3,VSCode 实证):应答方法必须挂连接持有者,绝不挂事件面。
151
- * VSCode 对齐:IAgent 事件流出(onDidSessionProgress/pending_confirmation)+ 应答方法流入
152
- * (respondToPermissionRequest(requestId, approved),agentService.ts:1457;UI→进程全链
153
- * agentSideEffects.ts:1013)。optionId 不透明透传(E2)。
154
- */
155
- respondApproval(handle: MemberHandle, approvalId: string, optionId: string): void;
156
- /** 取消当前回合(不杀进程)。 */
157
- cancel(handle: MemberHandle): Promise<void>;
158
- /** 停止并回收实例(用户主动关闭 / 会话结束)。 */
159
- stop(handle: MemberHandle): Promise<void>;
160
- /** 查询状态(判活为内部 ACK 响应性,超时置 "unresponsive" 交 fail-loud,不自动静默杀)。 */
161
- getState(handle: MemberHandle): AgentInstanceState;
162
- }
163
- /** [S1 补定] 生命周期记录事件(recordLifecycle 参数);与 §4 onLifecycle 同族。 */
164
- export interface LifecycleEvent {
165
- state: AgentInstanceState | "cancelled";
166
- /** ISO 时间戳 */
167
- at: string;
168
- reason?: string;
169
- code?: LifecycleCode;
170
- }
171
- export interface SessionMeta {
172
- canonicalSessionId: CanonicalSessionId;
173
- projectId: ProjectId;
174
- /** 主 agent(创建即锁定,severe 禁中途切换) */
175
- agentId: AgentId;
176
- cwd: string;
177
- /** 每 native agent 的原生会话 id 映射(现状旧单值映射由 importer 迁入,见 N2) */
178
- nativeSessionIds?: Record<AgentId, string>;
179
- lifecycle: string;
180
- }
181
- export interface NativeSessionSummary {
182
- nativeId: string;
183
- cwd: string;
184
- updatedAt: number;
185
- title?: string;
186
- }
187
- export interface NativeProjectContext {
188
- projectId: ProjectId;
189
- cwd: string;
190
- }
191
- export interface NativeSessionRef {
192
- agentId: AgentId;
193
- projectId: ProjectId;
194
- nativeId: string;
195
- }
196
- export interface NativeSessionDetail extends NativeSessionSummary {
197
- createdAt?: number;
198
- messageCount?: number;
199
- }
200
- export interface NativeSessionProvider {
201
- readonly agentId: AgentId;
202
- list(ctx: NativeProjectContext): Promise<NativeSessionSummary[]>;
203
- get(nativeId: string, ctx: NativeProjectContext): Promise<NativeSessionDetail | undefined>;
204
- loadTranscript(nativeId: string, ctx: NativeProjectContext): Promise<NativeTranscript>;
205
- exists(nativeId: string, ctx: NativeProjectContext): Promise<boolean>;
206
- }
207
- export type ProjectAgentSessionEntry = {
208
- source: "host";
209
- canonicalSessionId: CanonicalSessionId;
210
- nativeRef?: NativeSessionRef;
211
- title?: string;
212
- } | {
213
- source: "native-unadopted";
214
- nativeRef: NativeSessionRef;
215
- title?: string;
216
- };
217
- /**
218
- * 拥有会话存储 + 项目作用域 + agentId 绑定 + canonical↔native 映射 + 生命周期状态。
219
- * 唯一权威(不与 qlogicagent 并存)。崩溃恢复靠网关持有并重放(current contract)。
220
- *
221
- * 不变式(冻结):
222
- * - S1 绑定权威唯一在网关;canonical id 创建即恒定。
223
- * - S2 projectId 确定性派生(deriveProjectId),同一 cwd/URI 两端算出同值。
224
- * - S3 resume 只是传输层重连令牌:状态恢复靠 replayStateTo 重放,不压在 resumeNativeId 上。
225
- * - S4 native transcript 不接管:网关只持 canonical↔native 映射;codex ~/.codex rollout 归 agent 自己。
226
- * - S5 无归属会话不默认归小智:listSessions 绝不把"无 agentId"会话塞进小智桶;要么显式绑定要么 fail-loud。
227
- */
228
- export interface SessionProjectService {
229
- /** 确定性派生 projectId(必须 = deriveProjectId 唯一实现)。 */
230
- deriveProjectId(cwdOrWorkspaceUri: string): ProjectId;
231
- /**
232
- * 会话创建写点(2026-07-09 补遗#1,VSCode 实证):会话进入宿主权威存储的唯一入口。
233
- * VSCode 对齐:host-owned 状态创建全程显式方法(agentService.ts:1655 createSession /
234
- * workspacesManagementMainService.ts:45 createUntitledWorkspace),无一处隐式内部创建。
235
- * 同时承担 projectId→cwd 注册表登记(补遗#4:填充折叠进创建写点,抄 doEnterWorkspace 内调
236
- * registerWorkspaceBackup;不设独立 registerProjectRoot 契约方法)。幂等;同 id 异 projectId/cwd → throw。
237
- */
238
- createSession(sessionId: CanonicalSessionId, projectId: ProjectId, cwd: string): void;
239
- /** 会话首轮锁定主 agent(创建即恒定,严禁中途切换)。权威落此,不再落 qlogicagent metadata。 */
240
- bindSessionAgent(sessionId: CanonicalSessionId, agentId: AgentId): void;
241
- /** 路由权威:已绑定会话永远返回其主 agent,忽略请求方携带值(反前端漂移)。 */
242
- resolveAgent(sessionId: CanonicalSessionId, requestedAgentId?: AgentId): AgentId;
243
- /** 解析一次委派/回合所需的完整会话上下文(供 Supervisor.ensure 用)。 */
244
- resolveContext(sessionId: CanonicalSessionId): SessionContext;
245
- /** canonical↔native 映射:resume 时取 agent 自持会话的原生 id(仅 codex/claude)。 */
246
- getNativeResumeId(sessionId: CanonicalSessionId, agentId: AgentId): string | undefined;
247
- /**
248
- * canonical↔native 映射回填写点(2026-07-09 补遗#2,VSCode 实证):native id 由 agent 运行期产生、
249
- * relay 在观察点回填。VSCode 对齐:跨边界的运行期 id 回填用显式 accept 方法
250
- * ($acceptTerminalProcessId(stableId, runtimeId),extHost.protocol.ts:3159);同进程侧的
251
- * native→canonical 反向路由缓存照 codexAgent.ts:574 留 relay 内存,不进本契约。
252
- * 幂等;同 (sessionId,agentId) 异 nativeId → throw(身份恒定)。
253
- */
254
- recordNativeSessionId(sessionId: CanonicalSessionId, agentId: AgentId, nativeId: string): void;
255
- /** 会话列表:按 项目 + agentId 分区(前端分区面的权威来源)。 */
256
- listSessions(filter: {
257
- projectId?: ProjectId;
258
- agentId?: AgentId | "*";
259
- }): SessionMeta[];
260
- /** 生命周期:记录/恢复(崩溃后网关重放订阅/激活状态给重生 agent)。 */
261
- recordLifecycle(sessionId: CanonicalSessionId, ev: LifecycleEvent): void;
262
- replayStateTo(handle: MemberHandle, sessionId: CanonicalSessionId): Promise<void>;
263
- }
264
- /** CredentialResolver —— 三态鉴权解析(G1)。token 传 ref,明文不进事件/日志。 */
265
- export interface CredentialResolver {
266
- resolve(agentId: AgentId, ownerId: string): ResolvedCredentials;
267
- /** bearerRef → 实际 token,仅在注入 spawn env 的边界解引用 */
268
- deref(ref: string): string;
269
- }
270
- /** 单把 key 的 wire 视图(keyId 寻址;key 材料只给掩码,明文走 revealKey)。 */
271
- export interface ProviderKeyInfo {
272
- keyId: string;
273
- /** 掩码展示(maskApiKey 语义);明文绝不进列表面 */
274
- masked: string;
275
- enabled: boolean;
276
- label?: string;
277
- }
278
- /** [S1 补定] 供应商信息(settings 域,spec §15)。 */
279
- export interface ProviderInfo {
280
- id: string;
281
- name?: string;
282
- hasKey: boolean;
283
- enabled: boolean;
284
- /** keyId 级子清单;一个 provider 可以配置多把 key。 */
285
- keys?: ProviderKeyInfo[];
286
- }
287
- /** settings.addKey 的原子提交选项;只承载非密元数据/替换策略。 */
288
- export interface ProfileAddKeyOptions {
289
- label?: string;
290
- replaceExisting?: boolean;
291
- }
292
- /** [S1 补定] 模型信息(settings 域)。 */
293
- export interface ModelInfo {
294
- id: string;
295
- provider: string;
296
- enabled: boolean;
297
- active?: boolean;
298
- }
299
- /** [S1 补定] 用途绑定(哪个模型干哪件事:textGen/small/理解/stt/embedding…,spec §13)。 */
300
- export interface PurposeBinding {
301
- purpose: ModelPurpose;
302
- model: string;
303
- }
304
- /** UI/store projection of a persisted permission rule. */
305
- export interface PermissionRule {
306
- id: string;
307
- pattern: string;
308
- action: "allow" | "deny" | "ask";
309
- }
310
- /** Session-effective permission rule; mirrors the agent permission engine exactly. */
311
- export interface EffectivePermissionRule {
312
- pattern: string;
313
- pathPrefix?: string;
314
- behavior: "allow" | "ask" | "deny";
315
- reason?: string;
316
- source?: string;
317
- requireOp?: "commandNetworkEgress";
318
- }
319
- export interface EffectivePermissionConfig {
320
- mode: "default" | "auto" | "full_access";
321
- rules: EffectivePermissionRule[];
322
- }
323
- /** Public host-owned permission policy projection; deliberately excludes rules, keys and tunables. */
324
- export interface PermissionPolicy {
325
- mode: EffectivePermissionConfig["mode"];
326
- }
327
- /** A single non-secret binding materialized for a model purpose. */
328
- export interface ResolvedModelBinding {
329
- model: string;
330
- provider: string;
331
- routing?: string;
332
- credRef?: string;
333
- baseUrl?: string;
334
- }
335
- /** Complete non-secret profile materialized by the gateway at a session boundary. */
336
- export interface ResolvedSpawnProfile {
337
- bindings: Partial<Record<ModelPurpose, ResolvedModelBinding>>;
338
- permissions: EffectivePermissionConfig;
339
- }
340
- /**
341
- * ProfileConfigService —— 完整 profile/config 域(spec §13/§15)。
342
- * 吸收今天转发主 adapter 的 settings.* + config.* + assistants.*,全改网关本地处理。
343
- * 三作用域:用户全局 / per-agent(三态鉴权)/ 项目覆盖(值按作用域分,抄 VSCode ConfigurationTarget)。
344
- * agent 只接收 resolveForSpawn 现算好的绑定,不再自算(ensureLlmrouterDefaultBindings 上移这里)。
345
- */
346
- export interface ProfileConfigService {
347
- getOverview(ownerId: string): {
348
- providers: ProviderInfo[];
349
- models: ModelInfo[];
350
- bindings: PurposeBinding[];
351
- injectedKeys: string[];
352
- };
353
- listProviders(ownerId: string): ProviderInfo[];
354
- /**
355
- * keyId 粒度;一个 provider 可以配置多把 key。
356
- * 返回新铸 keyId。prepare 阶段完成目录解析/候选探针,commit 阶段重读最新 settings 后只做一次
357
- * 原子替换;失败不改变旧文件/旧 key enabled 状态。[X4 过渡] 本刀仍按 legacy 形态把材料直存
358
- * settings.json,ref 化另批完成。明文绝不进入日志、事件或通知。
359
- * 默认 bindings 保持 gateway resolve-on-read;addKey 不隐式改 purposes,direct provider 也不自动绑空用途。
360
- */
361
- addKey(ownerId: string, provider: string, key: string, options?: ProfileAddKeyOptions): Promise<string>;
362
- /** [X5] 按 keyId 删单把 key(池空随之删;llmrouter env 注入位特例落 injectedKeys 偏好)。false=未找到(不写盘)。 */
363
- removeKey(ownerId: string, keyId: string): boolean;
364
- validateKey(ownerId: string, provider: string): Promise<boolean>;
365
- /** [X5] 按 keyId 启停单把 key。false=未找到(不写盘)。 */
366
- toggleKey(ownerId: string, keyId: string, on: boolean): boolean;
367
- /**
368
- * UI 显式索取明文;剪贴板副作用由前端负责。
369
- * 红线:返回值绝不经 HostNotificationSink 广播、绝不落日志/事件;ref 期在此边界 deref(VSCode
370
- * ISecretStorageService 同构:main 持密文,显式 API 解密返回调用方)。未找到 throw(fail-loud)。
371
- */
372
- revealKey(ownerId: string, keyId: string): string;
373
- listModels(ownerId: string): ModelInfo[];
374
- setActiveModel(ownerId: string, model: string): void;
375
- getActiveModel(ownerId: string): string;
376
- getPurposeBindings(ownerId: string): PurposeBinding[];
377
- setBinding(ownerId: string, purpose: string, model: string): void;
378
- getTunables(ownerId: string): Record<string, unknown>;
379
- updateTunable(ownerId: string, key: string, value: unknown): void;
380
- clearTunable(ownerId: string, key: string): void;
381
- /**
382
- * Persist the fixed "always allow this directory" rule. Callers supply only the path;
383
- * pattern/behavior/reason are host policy and never cross the agent wire.
384
- */
385
- appendDirectoryAllowRule(ownerId: string, pathPrefix: string): void;
386
- getPermissionRules(ownerId: string): PermissionRule[];
387
- /** Read the user-global (A-domain) policy used by the public permission selector. */
388
- getPermissionPolicy(ownerId: string): PermissionPolicy;
389
- /** Replace only A-domain permissions.mode; rules and unrelated settings remain byte-semantically intact. */
390
- updatePermissionMode(ownerId: string, mode: PermissionPolicy["mode"]): PermissionPolicy;
391
- getAgentConfig(agentId: AgentId, ownerId: string): {
392
- authPreference: "managed" | "account" | "userKey";
393
- gatewayUrl?: string;
394
- apiKeyRef?: string;
395
- };
396
- /** apiKey 存 ref */
397
- setAgentConfig(agentId: AgentId, ownerId: string, patch: Partial<{
398
- authPreference: string;
399
- gatewayUrl: string;
400
- apiKeyRef: string;
401
- }>): void;
402
- resolveForSpawn(agentId: AgentId, session: SessionContext): ResolvedSpawnProfile;
403
- }
404
- /**
405
- * Resident L2 categories are already rendered into the global memory index.
406
- * Every foreground recall surface must exclude the same groups so automatic
407
- * injection and explicit memory_search share one authoritative candidate pool.
408
- */
409
- export declare const MEMORY_RESIDENT_TAG_GROUPS: readonly [readonly ["onboarding-v1", "preference"], readonly ["onboarding-v1", "boundary"], readonly ["onboarding-v1", "workspace"], readonly ["onboarding-v1", "identity"]];
410
- /** [S1 补定] 记忆查询(memory 域;实现 lane 与 memories.db 形状映射)。 */
411
- export interface MemoryQuery {
412
- query?: string;
413
- category?: string;
414
- limit?: number;
415
- days?: number;
416
- }
417
- /** [S1 补定] 记忆记录(最小契约面;byAgent 为 M-3 写入署名)。 */
418
- export interface MemoryRecord {
419
- id: string;
420
- content: string;
421
- category?: string;
422
- tags?: string[];
423
- byAgent?: AgentId;
424
- createdAt?: string;
425
- updatedAt?: string;
426
- }
427
- /** Exact durable-memory match used by the Host storage contract. */
428
- export interface MemoryMatch {
429
- ids?: string[];
430
- query?: string;
431
- }
432
- /**
433
- * Minimal durable-store contract implemented only by Runtime.
434
- *
435
- * `memories.db` is the single L2 authority. Project/file memory is a separate L1
436
- * surface and never acts as a fallback for this service.
437
- */
438
- export interface MemoryProfileService {
439
- atlas(query: MemoryQuery): MemoryRecord[];
440
- read(source: string, target: string): MemoryRecord | undefined;
441
- /** Every signed store write records the responsible Agent. */
442
- write(record: MemoryRecord, byAgent: AgentId): void;
443
- delete(match: MemoryMatch): void;
444
- consolidate(candidates: MemoryRecord[], source: string): void;
445
- }
446
- /** [S1 补定] 首启进度状态。 */
447
- export interface OnboardingState {
448
- completed: boolean;
449
- step?: string;
450
- startedAt?: string;
451
- completedAt?: string;
452
- }
453
- /** OnboardingService —— 首启"认识你"(spec §14,host-owned)。 */
454
- export interface OnboardingService {
455
- getState(ownerId: string): OnboardingState;
456
- advance(ownerId: string, step: string): OnboardingState;
457
- }
458
- /**
459
- * GatewayDelegateRelay —— 机制 B 的 gateway-routed delegate 唯一入口(6 处 spawn 点改调这里,P4)。
460
- * 编排(小智)发 delegate → 网关解析 session/cred/capability → Supervisor.ensure+sendTurn → 事件回流。
461
- * reconnect 后向重生实例 replay 状态(与 SessionProjectService.replayStateTo 协同;O3 场景 7)。
462
- */
463
- export interface GatewayDelegateRelay {
464
- delegate(from: MemberHandle | "user", to: {
465
- handle: MemberHandle;
466
- agentId: AgentId;
467
- },
468
- /** (S3 综合补遗 A1)富输入,与 sendTurn/x_delegate 一致;禁降回纯文本(评审:relay 若停 prompt:string 则富输入到此塌成文本) */
469
- input: TurnInput, session: SessionContext, opts?: {
470
- timeoutMs?: number;
471
- signal?: AbortSignal;
472
- granularity?: "full" | "coarse";
473
- systemPrompt?: string;
474
- modelId?: string;
475
- }): Promise<TurnResult>;
476
- subscribe(handle: MemberHandle, sink: SupervisorEventSink, opts?: {
477
- granularity?: "full" | "coarse";
478
- }): () => void;
479
- }
480
- export type RunId = string;
481
- /**
482
- * Host-wide durable activity protocol.
483
- *
484
- * Thread is the durable conversation/session, Turn is one bounded unit of work, and Item is the
485
- * only append-only fact carried by persistence and live delivery. Domain-specific projections
486
- * (chat, Solo, Product, Goal, workflow) must derive from this envelope instead of defining another
487
- * event transport.
488
- */
489
- export declare const THREAD_ITEM_PROTOCOL_VERSION: 1;
490
- export type ThreadItemDomain = "chat" | "solo" | "product" | "goal" | "workflow" | "system";
491
- export type ThreadItemType = "message" | "state" | "plan" | "task" | "checklist" | "budget" | "input_request" | "summary" | "tool_call" | "tool_result" | "artifact" | "receipt";
492
- export type ThreadItemRole = "user" | "assistant" | "system" | "tool";
493
- export type ThreadItemState = "pending" | "in_progress" | "completed" | "failed" | "blocked" | "cancelled";
494
- export interface ThreadItem {
495
- /** Stable id used for live/cold replay de-duplication. */
496
- id: string;
497
- /** Cross-domain rendering category. */
498
- type: ThreadItemType;
499
- /** Namespaced semantic discriminator, for example `goal.phase_assessed`. */
500
- kind: string;
501
- domain: ThreadItemDomain;
502
- role: ThreadItemRole;
503
- state: ThreadItemState;
504
- /** Optional user-visible text. Structured domain data remains in data. */
505
- text?: string;
506
- data: Record<string, unknown>;
507
- }
508
- export interface ThreadItemEvent {
509
- schemaVersion: typeof THREAD_ITEM_PROTOCOL_VERSION;
510
- at: string;
511
- /** Assigned by the producer and checked against Host append order by projections. */
512
- sequence?: number;
513
- threadId: string;
514
- turnId: string;
515
- item: ThreadItem;
516
- }
517
- /** The RunState journal stores the same canonical envelope delivered live. */
518
- export type RunEvent = ThreadItemEvent;
519
- /** [S1 补定] 运行状态(UI 权威读)。 */
520
- export interface RunState {
521
- runId: RunId;
522
- kind: "solo" | "product" | "goal";
523
- projectId: ProjectId;
524
- owner: SessionContext;
525
- status: string;
526
- events?: RunEvent[];
527
- checkpoint?: unknown;
528
- /**
529
- * Rollback history ids, oldest first — ids only, never the snapshots.
530
- *
531
- * The store already retains the last 20 named checkpoints, but `RunState` used to carry just the
532
- * head, so every read surface could only ever report one. A run reopened from history then showed a
533
- * single-entry timeline and could only roll back to the newest point, silently losing the rest.
534
- * Snapshots stay out: status/list readers want the timeline, not 20 full Product states.
535
- */
536
- checkpointIds?: string[];
537
- openedAt: string;
538
- updatedAt: string;
539
- }
540
- /**
541
- * RunStateStore —— Solo/Product/Goal 运行状态归属(A6,Core Host 一等公民)。
542
- * "跑到哪了"的记录归 host,由 GatewayDelegateRelay + Supervisor 生命周期事件喂;
543
- * qlogicagent 崩溃/重启进度不丢、UI 从宿主权威读。
544
- * leader 大脑逻辑(怎么规划、派谁)仍留 qlogicagent,只写"计划"、不持久化"进度记录"(P5)。
545
- */
546
- export interface RunStateStore {
547
- /** Optional caller-selected domain id keeps Solo/Product/Goal public ids identical to host run ids. */
548
- openRun(kind: "solo" | "product" | "goal", owner: SessionContext, runId?: RunId): RunId;
549
- /**
550
- * Atomic open + first checkpoint: the run becomes addressable ONLY once it already carries a snapshot.
551
- *
552
- * `openRun` followed by a separate `checkpoint` is two round trips, and a failure between them leaves
553
- * an enveloped run with `checkpoint === undefined`. Readers that project a whole project's run list
554
- * cannot tolerate that shape, so one such remnant permanently breaks the entire list for that project.
555
- * Writers that always have their first snapshot in hand MUST use this instead of open+checkpoint.
556
- *
557
- * Idempotent in the same way as `openRun` (same kind + projectId + owner session re-uses the run);
558
- * on re-use the snapshot is applied as a normal checkpoint.
559
- */
560
- openRunWithCheckpoint(kind: "solo" | "product" | "goal", owner: SessionContext, snapshot: unknown, runId?: RunId, checkpointId?: string): RunId;
561
- recordEvent(runId: RunId, ev: RunEvent): void;
562
- /** product/solo 检查点 */
563
- checkpoint(runId: RunId, snapshot: unknown, checkpointId?: string): void;
564
- getCheckpoint(runId: RunId, checkpointId: string): unknown | undefined;
565
- listCheckpoints(runId: RunId): string[];
566
- restoreCheckpoint(runId: RunId, checkpointId: string): unknown | undefined;
567
- getRun(runId: RunId): RunState;
568
- listRuns(filter: {
569
- projectId: ProjectId;
570
- kind?: string;
571
- }): RunState[];
572
- deleteRun(runId: RunId): boolean;
573
- }
574
- export interface EvBase {
575
- /** 由 relay 合成(今天线上无 handle,只有 agentId+sessionId+delegationId 关联;R1) */
576
- member: MemberHandle;
577
- sessionId: string;
578
- turnId: string;
579
- requestId?: string;
580
- }
581
- /**
582
- * 不变式(冻结):
583
- * - E1 归属:回合事件必须带 (member, sessionId, turnId, requestId?);实例级 lifecycle 可省 turnId/sessionId,
584
- * 但必须带 member + state。member 由 relay 合成(委派事件要归属到委派成员,不能寄生宿主 agentId,R1)。
585
- * - E2 审批/media/lifecycle 均过网关边界,不走进程内直传;审批应答 optionId 不透明透传。
586
- * - E3 失败一律 onLifecycle 结构化明示(code+diagnostics+retriable),不得降级成裸 error 串、不静默杀;
587
- * cancel 是显式 state:"cancelled" 非 "RPC aborted" 串。
588
- * - E4 reconnect 要重放回合事件(S3 replayStateTo),今天只重放状态快照(R7)。
589
- * - E5 relay 漏项 R1-R8 是 cutover 施工项(behind 本冻结接口,非开放设计题;清单见 findings §3)。
590
- */
591
- export interface SupervisorEventSink {
592
- /** turn.delta / turn.reasoning_delta(字段=delta,非 text) */
593
- onDelta(e: EvBase & {
594
- delta: string;
595
- reasoning?: boolean;
596
- }): void;
597
- /** onTool 拆成 call/result 两事件、callId 配对(旧单 {name,status} 是错形状;R2)。 */
598
- onToolCall(e: EvBase & {
599
- callId: string;
600
- name: string;
601
- displayName?: string;
602
- arguments?: string;
603
- inputSummary?: string;
604
- startedAt?: string;
605
- }): void;
606
- /**
607
- * ⚠ name = relay 经 callId 从配对 tool_call 回填的 canonical name;不可信任原始 tool_result.name
608
- * ——实测塌成通用 "tool"(真名只在 call 侧;entry.ts:233 `ev?.name ?? "tool"`,findings R2)。
609
- */
610
- onToolResult(e: EvBase & {
611
- callId: string;
612
- name: string;
613
- displayName?: string;
614
- ok: boolean;
615
- error?: string;
616
- outputPreview?: string;
617
- finishedAt?: string;
618
- }): void;
619
- /**
620
- * 审批:options[].optionId 是不透明、按审批种类而异的串(approved/cancel/abort/approved-execpolicy-amendment…);
621
- * 应答走 AgentSupervisor.respondApproval(handle, approvalId, optionId) 原样透传——sink 是纯事件流出面,
622
- * 不承载应答入口(2026-07-09 补遗#3:应答方法挂连接持有者,VSCode IAgent 同构)。
623
- */
624
- onApprovalRequest(e: EvBase & {
625
- approvalId: string;
626
- callId: string;
627
- toolName: string;
628
- arguments?: string;
629
- message?: string;
630
- category?: string;
631
- /** Host-normalized concise explanation shown before the decision controls. */
632
- summary?: string;
633
- /** Exact scope affected by a remembered permission option. */
634
- scopeTarget?: {
635
- kind: "directory";
636
- path: string;
637
- };
638
- /** Raw operation input retained behind an explicit details disclosure. */
639
- details?: {
640
- format: "command" | "json" | "text";
641
- content: string;
642
- };
643
- options: Array<{
644
- optionId: string;
645
- name: string;
646
- kind: string;
647
- }>;
648
- }): void;
649
- /**
650
- * Provider media and Host-sent attachments arrive as first-class lifecycle events, never only as
651
- * generic tool output or a path embedded in assistant text.
652
- */
653
- onMedia(e: EvBase & {
654
- mediaType: string;
655
- url: string;
656
- model?: string;
657
- provider?: string;
658
- filename?: string;
659
- mimeType?: string;
660
- size?: number;
661
- }): void;
662
- /**
663
- * 通用透传(S3 综合补遗 A3):承接今天 mapSessionUpdate 的 x_relay→relay 分支
664
- * (acp-adapter.ts:824-850 的 tool_use_summary/task_updated/recovery/ask_user/instructions 等)。
665
- * supervisor handleNotification 的 default:break(agent-supervisor.ts:742)会整块丢弃这些→前端富遥测/
666
- * 编排面板全空;此口保前端契约不破。eventName=原方法名,payload 原样。
667
- * **边界(评审)**:onRelay **只做非权威遥测透传,不承载控制语义**(控制/终态/审批走各自一等事件,不许经此绕行);
668
- * payload 必须走红线脱敏(明文凭据/密钥不出)+ 大小上限(超限截断,防大帧 DoS)。
669
- */
670
- onRelay(e: EvBase & {
671
- eventName: string;
672
- payload: unknown;
673
- }): void;
674
- /**
675
- * 回合终态 + agent 实例态。⚠R4/R5:今天线上的 turn.error 是裸串(丢 code/diagnostics/retriable);
676
- * adapter 内部已有 code+diagnostics 但 external relay 无 error 分支 → 冻结要求补齐。
677
- * agent 实例四态今天无一等事件(只有连接时 agent-status),F4/F6/fail-loud 要求补。
678
- * UNKNOWN 兜底语义见 LifecycleCode。
679
- */
680
- onLifecycle(e: {
681
- member: MemberHandle;
682
- sessionId?: string;
683
- turnId?: string;
684
- state: AgentInstanceState | "cancelled";
685
- reason?: string;
686
- retriable?: boolean;
687
- code?: LifecycleCode;
688
- diagnostics?: {
689
- pid?: number;
690
- exitCode?: number | null;
691
- signal?: string | null;
692
- stderrTail?: string;
693
- lastEventName?: string;
694
- timedOutAfterMs?: number;
695
- idleMs?: number;
696
- };
697
- }): void;
698
- }
699
- /** delegate 关联主键:leader 铸、gateway 校验唯一(T3/T4)。 */
700
- export type DelegationId = string;
701
- /** `x/delegate` 请求参数(agent→host,起一个 worker 回合,resolve TurnResult,隐式订阅该 delegation)。 */
702
- export interface DelegateRequestParams {
703
- delegationId: DelegationId;
704
- /** Product leader 硬约束由 Gateway 校验;Goal leader 身份由 canonical session owner 预先解析。 */
705
- to: {
706
- handle: MemberHandle;
707
- agentId: AgentId;
708
- };
709
- input: TurnInput;
710
- session: SessionContext;
711
- /** Persona/instructions applied when the gateway registers or resumes the delegated session. */
712
- systemPrompt?: string;
713
- opts?: {
714
- timeoutMs?: number;
715
- granularity?: "full" | "coarse";
716
- modelId?: string;
717
- };
718
- }
719
- /** 回流事件种类(与 §4 SupervisorEventSink 方法 1:1,T10 无损镜像)。 */
720
- export type DelegateEventKind = "delta" | "tool_call" | "tool_result" | "approval_request" | "media" | "relay" | "lifecycle";
721
- /**
722
- * `x/delegate.update` 帧(host→agent 通知,一事件一帧;不复用反向 session/update,T2)。
723
- * event = 对应 SupervisorEventSink 事件去掉 member 后的对象(member 提到帧级,E1)。
724
- */
725
- export interface DelegateUpdateFrame {
726
- delegationId: DelegationId;
727
- /** gateway 铸,每 delegation 单调;消费方校验连续,丢帧/乱序 fail-loud(T3/T6) */
728
- seq: number;
729
- /** 权威成员(E1,= to.handle;禁宿主盖名 R1) */
730
- member: MemberHandle;
731
- kind: DelegateEventKind;
732
- /** 载荷镜像对应 sink 事件(去 member);sink 接口即权威形状 */
733
- event: unknown;
734
- }
735
- /** `x/delegate.respond`(agent→host 通知,leader 来源审批应答;UI 来源走现有 ws approval-response,T8)。 */
736
- export interface DelegateRespondParams {
737
- delegationId: DelegationId;
738
- approvalId: string;
739
- /** 不透明透传(E2) */
740
- optionId: string;
741
- }
742
- /** `x/delegate.cancel`(agent→host 通知,取消回合不杀进程;终态出显式 cancelled,E3)。 */
743
- export interface DelegateCancelParams {
744
- delegationId: DelegationId;
745
- reason?: string;
746
- }
747
- /** wire 方法名(x/ 族;方法约定 acp-protocol.ts:42-80,非 x_ session-update 类型)。 */
748
- export declare const DELEGATE_WIRE_METHODS: {
749
- readonly request: "x/delegate";
750
- readonly update: "x/delegate.update";
751
- readonly respond: "x/delegate.respond";
752
- readonly cancel: "x/delegate.cancel";
753
- };
754
- /**
755
- * [X1] Host 领域变更通知 sink —— 挂 **store-owner 服务层**,不挂 RPC handler(brain proxy/MCP 写路径
756
- * 不经 handler,挂 handler 会漏通知;挂 owner 则 UI 写/brain 写/MCP 写全覆盖)。
757
- * 装配期由 host-services 注入 gateway 事件总线(emitGatewayEvent→broadcast);服务 mutation 成功后调用。
758
- * 事件名与今天线上帧逐字一致(memory.updated / skills.updated / turn.memory_written / system.activity,
759
- * GatewayEventMap 既有键)——前端契约不破。
760
- * 红线:payload 走脱敏(明文凭据/密钥绝不入,X4)+ 大小上限(同 onRelay 纪律)。
761
- * VSCode 对照:变更事件挂 main 侧状态 owner(IWorkspaceContextService.onDidChangeWorkspaceFolders),
762
- * 主动推送($acceptWorkspaceData),不挂请求处理器。
763
- */
764
- export interface HostNotificationSink {
765
- notify(eventName: string, payload: unknown): void;
766
- }
767
- /** Durable hand-off from a completed foreground turn to the background semantic
768
- * extractor. The Host owns this operational queue; the Agent owns extraction. */
769
- export interface HostMemoryExtractionTurnInput {
770
- sessionId: string;
771
- turnId: string;
772
- priorUserMessage?: string;
773
- userMessage: string;
774
- assistantMessage: string;
775
- }
776
- export interface HostPendingMemoryExtractionTurn extends HostMemoryExtractionTurnInput {
777
- id: string;
778
- attempts: number;
779
- lastError: string;
780
- leaseOwner: string;
781
- leasedUntil: number;
782
- createdAt: number;
783
- updatedAt: number;
784
- }
785
- /**
786
- * [X7] qlogicagent 大脑经 x/host.request 可调用的 memory proxy 精确方法面。
787
- * gateway 白名单与 qla HostMemoryProvider 都必须直接消费此常量,禁止两仓手抄后漂移。
788
- */
789
- export declare const HOST_MEMORY_PROXY_METHODS: readonly ["search", "embedText", "ingestExtracted", "proposeExtracted", "consumePendingProposals", "feedback", "findRelatedEvents", "synthesizeTimeline", "getActivitySummary", "getAllProfiles", "setProfile", "getAtlas", "setMemoryArchived", "triggerDecay", "resolveConflicts", "readProcedureUsage", "writeProcedureUsage", "readDistillCandidates", "writeDistillCandidates", "readPromotionProposals", "writePromotionProposals", "listActiveMemoriesByTag", "readDistilledProcedure", "promoteDistilledProcedure", "demoteDistilledProcedure", "recordInjectedAccess", "recordRecallOutcome", "enqueueExtractionTurn", "claimPendingExtractionTurns", "completeExtractionTurn", "releaseExtractionTurn", "recordExtractionTurnFailure"];
790
- export type HostMemoryProxyMethod = (typeof HOST_MEMORY_PROXY_METHODS)[number];
791
- /** Host-computed proof that a distilled procedure is a repeatable capability.
792
- * Source executions prove how it was learned; helped use rows prove that the
793
- * distilled procedure itself subsequently worked in foreground turns. */
794
- export interface ProcedureVerificationEvidence {
795
- sourceSuccessCount: number;
796
- sourceDistinctSessions: number;
797
- sourceDistinctPrompts: number;
798
- successfulUseCount: number;
799
- successfulUseSessions: number;
800
- harmfulUseCount: number;
801
- passed: boolean;
802
- }
803
- /** Project-scoped Markdown memory face. Gateway resolves cwd/project from the supervised caller. */
804
- export declare const HOST_PROJECT_MEMORY_PROXY_METHODS: readonly ["initialize", "getIndex", "addToIndex", "replaceInIndex", "removeFromIndex", "createFile", "writeFile", "readFile", "deleteFile", "listFiles", "searchLocal"];
805
- export type HostProjectMemoryProxyMethod = (typeof HOST_PROJECT_MEMORY_PROXY_METHODS)[number];
806
- export interface HostProjectMemoryIndexSnapshot {
807
- raw: string;
808
- prompt: string;
809
- usage: {
810
- chars: number;
811
- lines: number;
812
- percent: number;
813
- };
814
- }
815
- /** [X7-C1a] Capability 大脑代理当前只开放两个只读方法;写面与 connector 尚未入约。 */
816
- export declare const HOST_CAPABILITY_PROXY_METHODS: readonly ["getSkillSnapshot", "readSkillFile", "recordSkillInvocation", "commitSkillMutation", "applyCuratorPlan", "prepareSkillInstall", "finalizeSkillInstall"];
817
- export type HostCapabilityProxyMethod = (typeof HOST_CAPABILITY_PROXY_METHODS)[number];
818
- /**
819
- * [S3-Session-X7] Agent compute may submit only durable session results and load a
820
- * resume view. Generic metadata patches and filesystem access are deliberately absent.
821
- */
822
- export declare const HOST_SESSION_PROXY_METHODS: readonly ["loadForResume", "appendTranscript", "updateTitle", "saveState", "saveTaskSummary", "groupSplit"];
823
- export type HostSessionProxyMethod = (typeof HOST_SESSION_PROXY_METHODS)[number];
824
- /**
825
- * [S3-D2-X7] Feedback/telemetry compute may use only these business operations. The
826
- * gateway owns every durable file and the reliable upload state machine; generic file,
827
- * object-patch, owner-id, and upload-batch mutation surfaces are intentionally absent.
828
- */
829
- export declare const HOST_FEEDBACK_PROXY_METHODS: readonly ["commitTurnTelemetry", "listDistillableFeedback", "markFeedbackDistilled", "runUploadSweep"];
830
- export type HostFeedbackProxyMethod = (typeof HOST_FEEDBACK_PROXY_METHODS)[number];
831
- /** Project registry X7 is intentionally business-shaped; no generic registry/file patches. */
832
- export declare const HOST_PROJECT_PROXY_METHODS: readonly ["getSnapshot", "create", "switch", "update"];
833
- export type HostProjectProxyMethod = (typeof HOST_PROJECT_PROXY_METHODS)[number];
834
- export type HostProjectType = "default" | "personal" | "group" | "solo" | "product" | "automation";
835
- export interface HostProjectInfo {
836
- id: ProjectId;
837
- name: string;
838
- workspaceDir: string;
839
- type: HostProjectType;
840
- status: "active" | "archived";
841
- groupId?: string;
842
- createdAt: string;
843
- updatedAt: string;
844
- planStatus?: "creating" | "running" | "completed" | "failed" | "cancelled";
845
- planAgents?: string[];
846
- planWinnerId?: string;
847
- leaderSessionId?: string;
848
- primaryWorkflowId?: string;
849
- }
850
- export type HostProjectSnapshotResult = {
851
- activeProjectId: ProjectId | null;
852
- projects: HostProjectInfo[];
853
- };
854
- export type HostProjectMutationResult = {
855
- ok: true;
856
- project: HostProjectInfo;
857
- deduplicated?: boolean;
858
- };
859
- export type HostProjectRequestParams = {
860
- service: "project";
861
- method: "getSnapshot";
862
- params: Record<string, never>;
863
- } | {
864
- service: "project";
865
- method: "create";
866
- params: {
867
- name: string;
868
- workspaceDir?: string;
869
- type?: Exclude<HostProjectType, "default">;
870
- groupId?: string;
871
- };
872
- } | {
873
- service: "project";
874
- method: "switch";
875
- params: {
876
- projectIdOrQuery: string;
877
- };
878
- } | {
879
- service: "project";
880
- method: "update";
881
- params: {
882
- projectId: ProjectId;
883
- planStatus?: HostProjectInfo["planStatus"];
884
- planAgents?: string[];
885
- planWinnerId?: string;
886
- leaderSessionId?: string;
887
- primaryWorkflowId?: string;
888
- };
889
- };
890
- export type HostSubagentType = "general" | "explore" | "plan" | "code" | "research" | "verify";
891
- export interface HostDelegationTelemetrySummary {
892
- schemaVersion: 1;
893
- launched: number;
894
- completed: number;
895
- failed: number;
896
- cancelled: number;
897
- backgroundCount: number;
898
- automaticDeliveryCount: number;
899
- byAgentType: Partial<Record<HostSubagentType, number>>;
900
- decisionCounts: {
901
- adopted: number;
902
- partiallyAdopted: number;
903
- rejected: number;
904
- unreported: number;
905
- };
906
- argumentCorrections: {
907
- roleAlias: number;
908
- promptAlias: number;
909
- backgroundAlias: number;
910
- agentValue: number;
911
- backgroundValue: number;
912
- };
913
- durationMs: {
914
- total: number;
915
- max: number;
916
- };
917
- tokenUsage: {
918
- total: number;
919
- };
920
- }
921
- export interface HostTurnTelemetryInput {
922
- model?: string;
923
- provider?: string;
924
- agentMode?: "chat" | "solo" | "product" | "workflow" | "unknown";
925
- sourceChannel?: string;
926
- usage?: {
927
- inputTokens?: number;
928
- outputTokens?: number;
929
- totalTokens?: number;
930
- };
931
- toolSummary?: {
932
- calledTools: string[];
933
- failedTools: string[];
934
- blockedTools: string[];
935
- };
936
- fileContext?: {
937
- changedFileCount?: number;
938
- changedPathsPreview?: string[];
939
- hasTurnFileChanges?: boolean;
940
- };
941
- delegationSummary?: HostDelegationTelemetrySummary;
942
- capabilityContext?: {
943
- skillDirectoryProjected: boolean;
944
- skillDirectoryRevision?: `sha256:${string}`;
945
- skillDirectoryChars?: number;
946
- };
947
- }
948
- /** Minimal, non-message-text evidence returned to the agent-side pure distiller. */
949
- export interface HostDistillableFeedbackEvent {
950
- feedbackId: string;
951
- rating: "up" | "down";
952
- reason?: "missed_requirement" | "incomplete" | "broken_file_link_or_panel" | "code_or_test_failed" | "factually_wrong" | "too_verbose" | "too_short" | "wrong_style" | "other";
953
- state: "active";
954
- sessionId: string;
955
- turnId: string;
956
- }
957
- export interface HostFeedbackSweepResult {
958
- uploaded: number;
959
- queued: number;
960
- retried: number;
961
- exhausted: number;
962
- }
963
- export interface HostSessionToolCall {
964
- id: string;
965
- type: "function";
966
- function: {
967
- name: string;
968
- arguments: string;
969
- };
970
- }
971
- /** Leaf contract copy of the persisted message wire shape; importing protocol here would cycle. */
972
- export interface HostSessionMessage {
973
- role: "system" | "user" | "assistant" | "tool";
974
- content: string | null;
975
- threadId?: string;
976
- turnId?: string;
977
- itemId?: string;
978
- contextAnchors?: Array<{
979
- category: "objective" | "acceptance" | "decision" | "constraint" | "task" | "blocker" | "artifact";
980
- value: string;
981
- }>;
982
- tool_calls?: HostSessionToolCall[];
983
- tool_call_id?: string;
984
- name?: string;
985
- is_error?: boolean;
986
- reasoning_content?: string;
987
- toolReferences?: string[];
988
- thinkingBlocks?: Array<{
989
- thinking: string;
990
- signature: string;
991
- }>;
992
- imageUrls?: string[];
993
- contentBlocks?: Array<Record<string, unknown>>;
994
- structuredContent?: Record<string, unknown>;
995
- mcpMeta?: Record<string, unknown>;
996
- mcpIsError?: boolean;
997
- imageDetail?: "auto" | "low" | "high" | "xhigh";
998
- imagePixelLimit?: {
999
- minPixels?: number;
1000
- maxPixels?: number;
1001
- };
1002
- videoUrls?: string[];
1003
- videoFps?: number;
1004
- audioFormat?: "mp3" | "wav" | "aac" | "m4a";
1005
- audioUrls?: string[];
1006
- fileIds?: Array<{
1007
- id: string;
1008
- mimeType?: string;
1009
- size?: number;
1010
- }>;
1011
- blocks?: Array<Record<string, unknown>>;
1012
- attachmentEntries?: Array<Record<string, unknown>>;
1013
- timestamp?: string;
1014
- usage?: {
1015
- inputTokens?: number;
1016
- outputTokens?: number;
1017
- totalTokens?: number;
1018
- };
1019
- displayMetadata?: Record<string, unknown>;
1020
- }
1021
- export interface HostSessionResumeMetadata {
1022
- sessionId: string;
1023
- projectId: string;
1024
- createdAt: string;
1025
- lastActiveAt: string;
1026
- turnCount: number;
1027
- messageCount: number;
1028
- type?: "personal" | "group";
1029
- title?: string;
1030
- agentId?: string;
1031
- model?: string;
1032
- taskSummary?: string;
1033
- carryoverSummary?: string;
1034
- previousSessionId?: string;
1035
- pinnedAt?: string;
1036
- archivedAt?: string;
1037
- sealedAt?: string;
1038
- }
1039
- export type HostSessionLoadForResumeResult = {
1040
- session: null | {
1041
- metadata: HostSessionResumeMetadata;
1042
- messages: HostSessionMessage[];
1043
- corruptLines?: number;
1044
- };
1045
- };
1046
- export type HostSessionAppendResult = {
1047
- status: "appended" | "duplicate" | "session-deleted";
1048
- messageCount: number;
1049
- };
1050
- export type HostSessionMutationResult = {
1051
- status: "updated" | "duplicate" | "session-deleted";
1052
- };
1053
- export type HostSessionGroupSplitResult = HostSessionMutationResult & {
1054
- nextSessionId?: string;
1055
- };
1056
- /** skill-lifecycle.json 的真实记录形状;扩展 provenance 字段必须原样往返。 */
1057
- export interface HostSkillLifecycleRecord {
1058
- name: string;
1059
- state: "active" | "stale" | "archived";
1060
- createdAt: string;
1061
- lastUsedAt?: string;
1062
- lastViewedAt?: string;
1063
- lastPatchedAt?: string;
1064
- staleAt?: string;
1065
- archivedAt?: string;
1066
- pinned: boolean;
1067
- useCount: number;
1068
- positiveCount?: number;
1069
- negativeCount?: number;
1070
- source: "learned" | "created" | "installed" | "promoted";
1071
- resourceType?: string;
1072
- launcherRequired?: boolean;
1073
- manualReviewRequired?: boolean;
1074
- sourceTier?: "official" | "community";
1075
- riskTier?: "R0" | "R1" | "R2" | "R3";
1076
- artifactDigest?: string;
1077
- /** Deterministic digest of the installed file tree, used to prove it was not edited locally. */
1078
- contentTreeDigest?: string;
1079
- registryResourceId?: string;
1080
- registryVersion?: string;
1081
- registrySourceTier?: "official" | "community";
1082
- registryRiskTier?: "R0" | "R1" | "R2" | "R3";
1083
- registryEffectiveRiskTier?: "R0" | "R1" | "R2" | "R3";
1084
- registryKeptSignalAt?: string;
1085
- /** Short, verified model-routing metadata. It describes when the Skill is useful, not how to run it. */
1086
- routingSummary?: string;
1087
- /** Optional catalog grouping metadata; it never triggers invocation. */
1088
- capabilityClass?: string;
1089
- [extra: string]: unknown;
1090
- }
1091
- /** Gateway 对同一技能 store 的只读快照条目。active 只叠加全局/项目禁用,不叠 turn 工具条件。 */
1092
- export interface HostSkillSnapshotEntry {
1093
- name: string;
1094
- filePath: string;
1095
- baseDir: string;
1096
- fileRevision: string;
1097
- globallyDisabled: boolean;
1098
- projectDisabled: boolean;
1099
- active: boolean;
1100
- systemGenerated: boolean;
1101
- description?: string;
1102
- version?: string;
1103
- category?: string;
1104
- author?: string;
1105
- environments?: string[];
1106
- source?: HostSkillLifecycleRecord["source"];
1107
- registryVersion?: string;
1108
- }
1109
- /** profiles/<owner>/skill-bundles 中现有 bundle 的真实公开字段。 */
1110
- export interface HostSkillBundleSnapshot {
1111
- name: string;
1112
- skills: string[];
1113
- filePath: string;
1114
- }
1115
- export type HostSkillSnapshotResponse = {
1116
- revision: string;
1117
- notModified: true;
1118
- } | {
1119
- revision: string;
1120
- notModified: false;
1121
- skills: HostSkillSnapshotEntry[];
1122
- lifecycle: HostSkillLifecycleRecord[];
1123
- bundles: HostSkillBundleSnapshot[];
1124
- };
1125
- export interface HostSkillFileResponse {
1126
- name: string;
1127
- relativePath: string;
1128
- content: string;
1129
- baseDir: string;
1130
- revision: string;
1131
- }
1132
- export interface HostSkillInvocationResult {
1133
- name: string;
1134
- lastUsedAt: string;
1135
- useCount: number;
1136
- positiveCount: number;
1137
- negativeCount: number;
1138
- }
1139
- /** 单文件读取上限;host 在解码前按 bytes 检查。 */
1140
- export declare const HOST_SKILL_FILE_MAX_BYTES: number;
1141
- /** [X7-P] 单一 agent→host 一元请求通道的服务域。 */
1142
- export type HostRequestService = "memory" | "projectMemory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project" | "runState" | "provider" | "community" | "cloudAuth";
1143
- /** Host-owned authenticated Hub reads. The Agent never receives or refreshes the desktop session. */
1144
- export declare const HOST_COMMUNITY_PROXY_METHODS: readonly ["resolveInstall", "listResourceVersions"];
1145
- export type HostCommunityProxyMethod = typeof HOST_COMMUNITY_PROXY_METHODS[number];
1146
- export type HostCommunityRequestParams = {
1147
- service: "community";
1148
- method: "resolveInstall";
1149
- params: {
1150
- resourceId: string;
1151
- version?: string;
1152
- };
1153
- } | {
1154
- service: "community";
1155
- method: "listResourceVersions";
1156
- params: {
1157
- resourceId: string;
1158
- };
1159
- };
1160
- /** Narrow account-session probe for supervised runtimes; no credential material crosses the wire. */
1161
- export declare const HOST_CLOUD_AUTH_PROXY_METHODS: readonly ["probeSession"];
1162
- export type HostCloudAuthRequestParams = {
1163
- service: "cloudAuth";
1164
- method: "probeSession";
1165
- params: Record<string, never>;
1166
- };
1167
- /** Read-only Provider projection exposed by the Gateway Host to supervised qlogicagent compute. */
1168
- export declare const HOST_PROVIDER_PROXY_METHODS: readonly ["list", "get", "diagnose"];
1169
- export type HostProviderProxyMethod = typeof HOST_PROVIDER_PROXY_METHODS[number];
1170
- export type HostAgentProviderState = "installed" | "auth_required" | "ready" | "disabled" | "incompatible" | "unresponsive" | "failed";
1171
- export type HostAgentProviderDiagnosticState = HostAgentProviderState | "not_installed";
1172
- export type HostAgentProviderDiagnosticStage = "install" | "manifest" | "auth" | "launch" | "initialize" | "models" | "native_sessions" | "request";
1173
- export type HostAgentProviderModelAuthority = {
1174
- kind: "provider";
1175
- enumeration: "protocol" | "implicit-default";
1176
- } | {
1177
- kind: "host";
1178
- managedPurposes: string[];
1179
- };
1180
- export interface HostAgentProviderDiagnostic {
1181
- providerId: string;
1182
- state: HostAgentProviderDiagnosticState;
1183
- stage: HostAgentProviderDiagnosticStage;
1184
- code: string;
1185
- message: string;
1186
- retryable: boolean;
1187
- providerVersion?: string;
1188
- payloadVersion?: string;
1189
- }
1190
- export interface HostAgentProviderSnapshot {
1191
- providerId: string;
1192
- displayName: string;
1193
- version: string;
1194
- state: HostAgentProviderState;
1195
- capabilities: {
1196
- execution: {
1197
- streaming: boolean;
1198
- approvals: boolean;
1199
- cancellation: boolean;
1200
- resume: boolean;
1201
- };
1202
- auth: {
1203
- modes: Array<"account" | "userKey" | "managed">;
1204
- terminal: boolean;
1205
- logout: boolean;
1206
- };
1207
- models: HostAgentProviderModelAuthority;
1208
- nativeSessions: {
1209
- discover: boolean;
1210
- transcript: boolean;
1211
- resume: boolean;
1212
- };
1213
- diagnostics: {
1214
- readiness: true;
1215
- version: true;
1216
- structuredErrors: true;
1217
- };
1218
- };
1219
- diagnostic?: HostAgentProviderDiagnostic;
1220
- }
1221
- export interface HostAgentProviderListResult {
1222
- revision: number;
1223
- providers: HostAgentProviderSnapshot[];
1224
- }
1225
- export interface HostAgentProviderGetResult {
1226
- revision: number;
1227
- provider: HostAgentProviderSnapshot | null;
1228
- }
1229
- export type HostProviderRequestParams = {
1230
- service: "provider";
1231
- method: "list";
1232
- params: [];
1233
- } | {
1234
- service: "provider";
1235
- method: "get" | "diagnose";
1236
- params: [providerId: string];
1237
- };
1238
- /** Preview Browser 的七个允许动作;tool 与 gateway 必须消费此单源。 */
1239
- export declare const PREVIEW_BROWSER_ACTIONS: readonly ["navigate", "snapshot", "click", "type", "screenshot", "console", "network"];
1240
- export type PreviewBrowserAction = (typeof PREVIEW_BROWSER_ACTIONS)[number];
1241
- export declare const PREVIEW_BROWSER_MUTATION_ACTIONS: readonly ["navigate", "click", "type"];
1242
- export declare const PREVIEW_BROWSER_READ_ACTIONS: readonly ["snapshot", "screenshot", "console", "network"];
1243
- /** Canonical identity for a built-in preview WebContentsView. */
1244
- export type PreviewTargetKey = `preview:${number}`;
1245
- export declare function isPreviewTargetKey(value: unknown): value is PreviewTargetKey;
1246
- /** 每个 preview action 的精确 payload;禁止把任意 Electron IPC method/params 暴露给 agent。 */
1247
- export interface PreviewBrowserActionParams {
1248
- navigate: {
1249
- url: string;
1250
- viewId?: string;
1251
- };
1252
- snapshot: {
1253
- viewId?: string;
1254
- };
1255
- click: {
1256
- ref: string;
1257
- viewId?: string;
1258
- };
1259
- type: {
1260
- ref: string;
1261
- text: string;
1262
- submit?: boolean;
1263
- viewId?: string;
1264
- };
1265
- screenshot: {
1266
- viewId?: string;
1267
- };
1268
- console: {
1269
- viewId?: string;
1270
- };
1271
- network: {
1272
- viewId?: string;
1273
- };
1274
- }
1275
- /** preview_browser tool 的判别联合参数;action 与 payload 字段保持关联。 */
1276
- export type PreviewBrowserToolParams = {
1277
- [Action in PreviewBrowserAction]: {
1278
- action: Action;
1279
- } & PreviewBrowserActionParams[Action];
1280
- }[PreviewBrowserAction];
1281
- /** preview owner 回传的共享结果面。 */
1282
- export interface PreviewBrowserDriveResult {
1283
- text?: string;
1284
- screenshotB64?: string;
1285
- error?: string;
1286
- details?: unknown;
1287
- targetKey?: PreviewTargetKey;
1288
- refGeneration?: number;
1289
- }
1290
- export type HostMemoryRequestParams = {
1291
- service: "memory";
1292
- method: HostMemoryProxyMethod;
1293
- params: unknown[];
1294
- /**
1295
- * Optional supervised-session selector for background mutations. The Host
1296
- * validates that this session belongs to the calling supervised Agent before
1297
- * using it as evidence provenance; it is never trusted as storage authority.
1298
- */
1299
- sessionId?: string;
1300
- };
1301
- export type HostProjectMemoryRequestParams = {
1302
- service: "projectMemory";
1303
- method: "initialize" | "getIndex" | "listFiles";
1304
- params: {
1305
- sessionId: string;
1306
- };
1307
- } | {
1308
- service: "projectMemory";
1309
- method: "addToIndex";
1310
- params: {
1311
- sessionId: string;
1312
- content: string;
1313
- };
1314
- } | {
1315
- service: "projectMemory";
1316
- method: "replaceInIndex";
1317
- params: {
1318
- sessionId: string;
1319
- oldText: string;
1320
- newText: string;
1321
- };
1322
- } | {
1323
- service: "projectMemory";
1324
- method: "removeFromIndex";
1325
- params: {
1326
- sessionId: string;
1327
- oldText: string;
1328
- };
1329
- } | {
1330
- service: "projectMemory";
1331
- method: "createFile" | "writeFile";
1332
- params: {
1333
- sessionId: string;
1334
- name: string;
1335
- content: string;
1336
- };
1337
- } | {
1338
- service: "projectMemory";
1339
- method: "readFile" | "deleteFile";
1340
- params: {
1341
- sessionId: string;
1342
- name: string;
1343
- };
1344
- } | {
1345
- service: "projectMemory";
1346
- method: "searchLocal";
1347
- params: {
1348
- sessionId: string;
1349
- query: string;
1350
- };
1351
- };
1352
- export type HostSessionRequestParams = {
1353
- service: "session";
1354
- method: "loadForResume";
1355
- params: {
1356
- sessionId: string;
1357
- projectId?: ProjectId;
1358
- includeMessages?: boolean;
1359
- };
1360
- } | {
1361
- service: "session";
1362
- method: "appendTranscript";
1363
- params: {
1364
- sessionId: string;
1365
- turnId: string;
1366
- messageId: string;
1367
- sequence: number;
1368
- message: HostSessionMessage;
1369
- usage?: {
1370
- inputTokens?: number;
1371
- outputTokens?: number;
1372
- totalTokens?: number;
1373
- };
1374
- displayMetadata?: Record<string, unknown>;
1375
- };
1376
- } | {
1377
- service: "session";
1378
- method: "updateTitle";
1379
- params: {
1380
- sessionId: string;
1381
- operationId: string;
1382
- title: string;
1383
- };
1384
- } | {
1385
- service: "session";
1386
- method: "saveState";
1387
- params: {
1388
- sessionId: string;
1389
- turnId: string;
1390
- operationId: string;
1391
- model?: string;
1392
- usage: {
1393
- turnCount: number;
1394
- totalInputTokens: number;
1395
- totalOutputTokens: number;
1396
- };
1397
- };
1398
- } | {
1399
- service: "session";
1400
- method: "saveTaskSummary";
1401
- params: {
1402
- sessionId: string;
1403
- operationId: string;
1404
- summary: string;
1405
- generatedAtTurn: number;
1406
- };
1407
- } | {
1408
- service: "session";
1409
- method: "groupSplit";
1410
- params: {
1411
- sessionId: string;
1412
- operationId: string;
1413
- reason: "idle" | "turn-limit";
1414
- expectedLastActiveAt?: string;
1415
- expectedTurnCount?: number;
1416
- };
1417
- };
1418
- export type HostFeedbackRequestParams = {
1419
- service: "feedback";
1420
- method: "commitTurnTelemetry";
1421
- params: {
1422
- projectId: ProjectId;
1423
- sessionId: string;
1424
- turnId: string;
1425
- telemetry: HostTurnTelemetryInput;
1426
- };
1427
- } | {
1428
- service: "feedback";
1429
- method: "listDistillableFeedback";
1430
- params: {
1431
- projectId: ProjectId;
1432
- };
1433
- } | {
1434
- service: "feedback";
1435
- method: "markFeedbackDistilled";
1436
- params: {
1437
- projectId: ProjectId;
1438
- turnId: string;
1439
- clusterKey: string;
1440
- idempotencyKey: string;
1441
- };
1442
- } | {
1443
- service: "feedback";
1444
- method: "runUploadSweep";
1445
- params: {
1446
- projectId: ProjectId;
1447
- };
1448
- };
1449
- /** Agent-originated semantic run-state operations. Owner/project/cwd are resolved by Gateway scope. */
1450
- export declare const HOST_RUN_STATE_PROXY_METHODS: readonly ["open", "openWithCheckpoint", "recordEvent", "checkpoint", "get", "list", "delete", "getCheckpoint", "listCheckpoints", "restoreCheckpoint"];
1451
- export type HostRunStateProxyMethod = typeof HOST_RUN_STATE_PROXY_METHODS[number];
1452
- export type HostRunStateRequestParams = {
1453
- service: "runState";
1454
- method: "open";
1455
- params: {
1456
- runId: RunId;
1457
- kind: "solo" | "product" | "goal";
1458
- projectId: ProjectId;
1459
- sessionId: CanonicalSessionId;
1460
- };
1461
- }
1462
- /** Atomic open + first checkpoint — see RunStateStore.openRunWithCheckpoint for why open+checkpoint is unsafe. */
1463
- | {
1464
- service: "runState";
1465
- method: "openWithCheckpoint";
1466
- params: {
1467
- runId: RunId;
1468
- kind: "solo" | "product" | "goal";
1469
- projectId: ProjectId;
1470
- snapshot: unknown;
1471
- checkpointId?: string;
1472
- sessionId: CanonicalSessionId;
1473
- };
1474
- } | {
1475
- service: "runState";
1476
- method: "recordEvent";
1477
- params: {
1478
- runId: RunId;
1479
- event: RunEvent;
1480
- sessionId: CanonicalSessionId;
1481
- };
1482
- } | {
1483
- service: "runState";
1484
- method: "checkpoint";
1485
- params: {
1486
- runId: RunId;
1487
- checkpointId?: string;
1488
- snapshot: unknown;
1489
- sessionId: CanonicalSessionId;
1490
- };
1491
- } | {
1492
- service: "runState";
1493
- method: "get";
1494
- params: {
1495
- runId: RunId;
1496
- sessionId: CanonicalSessionId;
1497
- };
1498
- } | {
1499
- service: "runState";
1500
- method: "list";
1501
- params: {
1502
- projectId: ProjectId;
1503
- kind?: "solo" | "product" | "goal";
1504
- sessionId: CanonicalSessionId;
1505
- };
1506
- } | {
1507
- service: "runState";
1508
- method: "delete";
1509
- params: {
1510
- runId: RunId;
1511
- sessionId: CanonicalSessionId;
1512
- };
1513
- } | {
1514
- service: "runState";
1515
- method: "getCheckpoint" | "restoreCheckpoint";
1516
- params: {
1517
- runId: RunId;
1518
- checkpointId: string;
1519
- sessionId: CanonicalSessionId;
1520
- };
1521
- } | {
1522
- service: "runState";
1523
- method: "listCheckpoints";
1524
- params: {
1525
- runId: RunId;
1526
- sessionId: CanonicalSessionId;
1527
- };
1528
- };
1529
- /** Agent-originated profile store calls. UI/provider surfaces are intentionally excluded. */
1530
- export declare const HOST_PROFILE_PROXY_METHODS: readonly ["getTunables", "updateTunable", "clearTunable", "appendDirectoryAllowRule"];
1531
- export type HostProfileProxyMethod = typeof HOST_PROFILE_PROXY_METHODS[number];
1532
- /**
1533
- * Profile proxy envelopes use positional args and never carry ownerId. The gateway injects the
1534
- * authenticated owner at dispatch. Directory approval policy is likewise host-owned: the agent
1535
- * may provide only pathPrefix, never pattern/behavior/reason.
1536
- */
1537
- export type HostProfileRequestParams = {
1538
- service: "profile";
1539
- method: "getTunables";
1540
- params: [];
1541
- } | {
1542
- service: "profile";
1543
- method: "updateTunable";
1544
- params: [key: string, value: unknown];
1545
- } | {
1546
- service: "profile";
1547
- method: "clearTunable";
1548
- params: [key: string];
1549
- } | {
1550
- service: "profile";
1551
- method: "appendDirectoryAllowRule";
1552
- params: [pathPrefix: string];
1553
- };
1554
- /** Capability C1a 只读请求。projectId 由 gateway 项目注册表解析,agent 不得传 cwd/ownerId。 */
1555
- export interface HostGetSkillSnapshotParams {
1556
- projectId?: ProjectId;
1557
- knownRevision?: string;
1558
- }
1559
- export interface HostReadSkillFileParams {
1560
- name: string;
1561
- relativePath?: string;
1562
- expectedRevision?: string;
1563
- }
1564
- export interface HostRecordSkillInvocationParams {
1565
- name: string;
1566
- success: boolean;
1567
- }
1568
- /** One structured C2 write entrypoint. Content edits are CAS-only; null means create-if-absent. */
1569
- export type HostSkillMutation = {
1570
- kind: "create";
1571
- name: string;
1572
- content: string;
1573
- source?: "created" | "learned";
1574
- supportingFile?: {
1575
- relativePath: string;
1576
- content: string;
1577
- };
1578
- } | {
1579
- kind: "editContent";
1580
- name: string;
1581
- expectedRevision: string;
1582
- content: string;
1583
- } | {
1584
- kind: "editSupportingFile";
1585
- name: string;
1586
- relativePath: string;
1587
- expectedRevision: string | null;
1588
- content: string;
1589
- } | {
1590
- kind: "delete";
1591
- name: string;
1592
- } | {
1593
- kind: "setGlobalDisabled";
1594
- name: string;
1595
- disabled: boolean;
1596
- } | {
1597
- kind: "setProjectDisabled";
1598
- name: string;
1599
- projectId: ProjectId;
1600
- disabled: boolean;
1601
- } | {
1602
- kind: "setPinned";
1603
- name: string;
1604
- pinned: boolean;
1605
- } | {
1606
- kind: "promote";
1607
- name: string;
1608
- };
1609
- export interface HostCommitSkillMutationParams {
1610
- mutation: HostSkillMutation;
1611
- }
1612
- export type HostSkillMutationResult = {
1613
- kind: "create";
1614
- name: string;
1615
- revision: string;
1616
- changed: true;
1617
- } | {
1618
- kind: "editContent";
1619
- name: string;
1620
- revision: string;
1621
- changed: true;
1622
- } | {
1623
- kind: "editSupportingFile";
1624
- name: string;
1625
- revision: string;
1626
- changed: true;
1627
- } | {
1628
- kind: "delete";
1629
- name: string;
1630
- deleted: true;
1631
- } | {
1632
- kind: "setGlobalDisabled";
1633
- name: string;
1634
- disabled: boolean;
1635
- changed: boolean;
1636
- } | {
1637
- kind: "setProjectDisabled";
1638
- name: string;
1639
- disabled: boolean;
1640
- changed: boolean;
1641
- } | {
1642
- kind: "setPinned";
1643
- name: string;
1644
- pinned: boolean;
1645
- changed: boolean;
1646
- } | {
1647
- kind: "promote";
1648
- name: string;
1649
- promoted: true;
1650
- changed: boolean;
1651
- };
1652
- export type HostSkillLifecycleState = HostSkillLifecycleRecord["state"];
1653
- export interface HostCuratorTransition {
1654
- name: string;
1655
- from: HostSkillLifecycleState;
1656
- to: HostSkillLifecycleState;
1657
- }
1658
- export interface HostApplyCuratorPlanParams {
1659
- expectedRevision: string;
1660
- transitions: HostCuratorTransition[];
1661
- }
1662
- export interface HostApplyCuratorPlanResult {
1663
- revision: string;
1664
- changed: boolean;
1665
- transitioned: HostCuratorTransition[];
1666
- }
1667
- export type HostSkillInstallRiskTier = "R0" | "R1" | "R2" | "R3";
1668
- export type HostSkillReplacementPolicy = "managed-unmodified" | "user-confirmed";
1669
- export interface HostSkillCredentialDescriptor {
1670
- key: string;
1671
- label: string;
1672
- envKey: string;
1673
- placeholder?: string;
1674
- secret?: boolean;
1675
- helpUrl?: string;
1676
- }
1677
- export interface HostPrepareSkillInstallParams {
1678
- name: string;
1679
- version: string;
1680
- checksum: string;
1681
- sizeBytes: number;
1682
- allowReplace: boolean;
1683
- /** Required whenever allowReplace=true; automated callers must use managed-unmodified. */
1684
- replacementPolicy?: HostSkillReplacementPolicy;
1685
- provenance: {
1686
- sourceTier: "official" | "community";
1687
- resourceRiskTier: HostSkillInstallRiskTier;
1688
- effectiveRiskTier: HostSkillInstallRiskTier;
1689
- };
1690
- manifestSchemaVersion: 18;
1691
- manifestDigest: `sha256:${string}`;
1692
- requiredCapabilities: CapabilityRequirementV1[];
1693
- /** Optional in the wire contract for compatibility with schema-18 callers predating secure setup. */
1694
- credentials?: HostSkillCredentialDescriptor[];
1695
- /** Verified catalog terms used only for installed Skill recall. */
1696
- searchTerms?: string[];
1697
- /** Verified, single-line routing summary projected in the complete Skill directory. */
1698
- routingSummary?: string;
1699
- /** Optional catalog grouping metadata; it is never an invocation rule. */
1700
- capabilityClass?: string;
1701
- }
1702
- export interface HostPrepareSkillInstallResult {
1703
- installationId: string;
1704
- artifactPath: string;
1705
- contentDir: string;
1706
- expiresAt: string;
1707
- }
1708
- export interface HostFinalizeSkillInstallParams {
1709
- installationId: string;
1710
- action: "adopt" | "discard";
1711
- }
1712
- export type HostFinalizeSkillInstallResult = {
1713
- action: "discard";
1714
- discarded: true;
1715
- } | {
1716
- action: "adopt";
1717
- resourceId: string;
1718
- version: string;
1719
- skillName: string;
1720
- installDir: string;
1721
- checksum: string;
1722
- replaced: boolean;
1723
- };
1724
- export type HostCapabilityRequestParams = {
1725
- service: "capability";
1726
- method: "getSkillSnapshot";
1727
- params: HostGetSkillSnapshotParams;
1728
- } | {
1729
- service: "capability";
1730
- method: "readSkillFile";
1731
- params: HostReadSkillFileParams;
1732
- } | {
1733
- service: "capability";
1734
- method: "recordSkillInvocation";
1735
- params: HostRecordSkillInvocationParams;
1736
- } | {
1737
- service: "capability";
1738
- method: "commitSkillMutation";
1739
- params: HostCommitSkillMutationParams;
1740
- } | {
1741
- service: "capability";
1742
- method: "applyCuratorPlan";
1743
- params: HostApplyCuratorPlanParams;
1744
- } | {
1745
- service: "capability";
1746
- method: "prepareSkillInstall";
1747
- params: HostPrepareSkillInstallParams;
1748
- } | {
1749
- service: "capability";
1750
- method: "finalizeSkillInstall";
1751
- params: HostFinalizeSkillInstallParams;
1752
- };
1753
- export type HostPreviewRequestParams = {
1754
- [Action in PreviewBrowserAction]: {
1755
- service: "preview";
1756
- method: Action;
1757
- /** sessionId is injected by the turn backend for Electron pane attribution; it is not agent input. */
1758
- params: PreviewBrowserActionParams[Action] & {
1759
- sessionId?: string;
1760
- };
1761
- };
1762
- }[PreviewBrowserAction];
1763
- /**
1764
- * [X7-P] 跨进程 HostRequest 判别联合。memory/profile/preview 共用 `x/host.request`,
1765
- * service + method 二级分派;preview 的 method 与 payload 在类型层保持逐动作关联。
1766
- */
1767
- export type HostRequestParams = HostMemoryRequestParams | HostProjectMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams | HostRunStateRequestParams | HostProviderRequestParams | HostCommunityRequestParams | HostCloudAuthRequestParams;
1768
- /** initialize 声明的真实已装配 host-request 服务;version 只接受冻结版本 1。 */
1769
- export type HostRequestCapability = {
1770
- version: 1;
1771
- services: HostRequestService[];
1772
- };
1773
- /** [X7-P] wire 方法名(x/ 族),旧 HostState 名称不保留兼容别名。 */
1774
- export declare const HOST_REQUEST_WIRE_METHODS: {
1775
- readonly request: "x/host.request";
1776
- };
1777
- export declare function isHostSkillSnapshotResponse(value: unknown): value is HostSkillSnapshotResponse;
1778
- export declare function isHostSkillFileResponse(value: unknown): value is HostSkillFileResponse;
1779
- export declare function isHostSkillInvocationResult(value: unknown): value is HostSkillInvocationResult;
1780
- export declare function isHostSkillMutationResult(value: unknown): value is HostSkillMutationResult;
1781
- export declare function isHostApplyCuratorPlanResult(value: unknown): value is HostApplyCuratorPlanResult;
1782
- export declare function isHostPrepareSkillInstallResult(value: unknown): value is HostPrepareSkillInstallResult;
1783
- export declare function isHostFinalizeSkillInstallResult(value: unknown): value is HostFinalizeSkillInstallResult;
1784
- export declare function isHostAgentProviderDiagnostic(value: unknown): value is HostAgentProviderDiagnostic;
1785
- export declare function isHostAgentProviderSnapshot(value: unknown): value is HostAgentProviderSnapshot;
1786
- export declare function isHostAgentProviderListResult(value: unknown): value is HostAgentProviderListResult;
1787
- export declare function isHostAgentProviderGetResult(value: unknown): value is HostAgentProviderGetResult;
1788
- export declare function isHostSessionLoadForResumeResult(value: unknown): value is HostSessionLoadForResumeResult;
1789
- export declare function isHostSessionAppendResult(value: unknown): value is HostSessionAppendResult;
1790
- export declare function isHostSessionMutationResult(value: unknown): value is HostSessionMutationResult;
1791
- export declare function isHostSessionGroupSplitResult(value: unknown): value is HostSessionGroupSplitResult;
1792
- /** Runtime wire guard used by the gateway before service dispatch. */
1793
- export declare function isHostRequestParams(value: unknown): value is HostRequestParams;
1794
- export declare function isHostFeedbackCommitResult(value: unknown): value is {
1795
- ok: true;
1796
- };
1797
- export declare function isHostDistillableFeedbackResult(value: unknown): value is {
1798
- events: HostDistillableFeedbackEvent[];
1799
- };
1800
- export declare function isHostFeedbackMarkResult(value: unknown): value is {
1801
- ok: true;
1802
- updated: boolean;
1803
- };
1804
- export declare function isHostFeedbackSweepResult(value: unknown): value is HostFeedbackSweepResult;
1805
- export declare function isHostProjectSnapshotResult(value: unknown): value is HostProjectSnapshotResult;
1806
- export declare function isHostProjectMutationResult(value: unknown): value is HostProjectMutationResult;
1807
- /** Exact version + exact service-discriminant capability check; no prefix/coercion fallback. */
1808
- export declare function supportsHostRequestService(capability: unknown, service: unknown): boolean;
1809
- /**
1810
- * [X7 检索单源] FTS 分词 —— memories.db 的写侧(text_seg 列)与查侧(FTS 查询)**必须同一实现**,
1811
- * 漂移即召回静默清零(fts-segment.ts 文件头铁律)。B3 后唯一写者=gateway(runtime 仓),故经本契约包共享
1812
- * 单一实现(先例:deriveProjectId 同款 re-export);qla 侧(今天是 memdir 的 FTS 面)与 gateway
1813
- * memory-profile-sqlite 引用同一份,零复刻。纯函数零依赖(仅正则)。
1814
- * 实现体落在本契约模块内(src/host-contract/fts-segment.ts)而非 re-export skills——host-contract 是
1815
- * leaf(acp-protocol.ts 文件头依赖此不变式;反向 re-export 曾闭合 host-contract→skills→runtime→
1816
- * protocol→host-contract 模块环,check-architecture-boundaries top-level-cycles 抓出)。
1817
- */
1818
- export { segmentForFts, segmentTextForFts } from "./fts-segment.js";
1819
- export { HUB_SKILL_CATEGORIES, HUB_SKILL_CATEGORY_LABELS, isHubSkillCategory, type HubSkillCategory, } from "./skill-category.js";