qlogicagent 2.20.6 → 2.20.8

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 (183) hide show
  1. package/README.md +27 -54
  2. package/dist/agent-contract.js +1 -1
  3. package/dist/agent.js +42 -41
  4. package/dist/cli.js +1 -1
  5. package/dist/host-contract.js +1 -1
  6. package/dist/index.js +539 -565
  7. package/dist/orchestration.js +14 -14
  8. package/dist/project-memory-host.js +30 -33
  9. package/dist/protocol.js +1 -1
  10. package/dist/types/agent/memory-recall-context.d.ts +7 -0
  11. package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +2 -0
  12. package/dist/types/agent/tool-loop/direct-response-contract.d.ts +12 -0
  13. package/dist/types/agent/tool-loop/final-status-stream-suppressor.d.ts +22 -0
  14. package/dist/types/agent/tool-loop/loop-helpers.d.ts +2 -2
  15. package/dist/types/agent/tool-loop.d.ts +5 -1
  16. package/dist/types/agent/types.d.ts +27 -15
  17. package/dist/types/cli/acp-commands.d.ts +1 -1
  18. package/dist/types/cli/acp-extended-handlers.d.ts +13 -3
  19. package/dist/types/cli/agent-runtime-session-state.d.ts +1 -0
  20. package/dist/types/cli/base-tool-bootstrap.d.ts +0 -7
  21. package/dist/types/cli/community-skill-installer.d.ts +2 -0
  22. package/dist/types/cli/core-tool-coordinator.d.ts +0 -3
  23. package/dist/types/cli/core-tools/registry.d.ts +1 -4
  24. package/dist/types/cli/handlers/config-handler.d.ts +0 -1
  25. package/dist/types/cli/handlers/goal-handler.d.ts +24 -0
  26. package/dist/types/cli/handlers/memory-handler.d.ts +1 -2
  27. package/dist/types/cli/handlers/skill-curator-handler.d.ts +8 -0
  28. package/dist/types/cli/handlers/turn-handler.d.ts +9 -12
  29. package/dist/types/cli/memory-candidate-service.d.ts +1 -8
  30. package/dist/types/cli/memory-coordinator.d.ts +1 -13
  31. package/dist/types/cli/product-acp-params.d.ts +1 -0
  32. package/dist/types/cli/provider-core-facade.d.ts +2 -30
  33. package/dist/types/cli/rpc-registry.d.ts +2 -4
  34. package/dist/types/cli/runtime-hook-bootstrap.d.ts +1 -2
  35. package/dist/types/cli/stdio-acp-request-host.d.ts +1 -2
  36. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -2
  37. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -7
  38. package/dist/types/cli/stdio-runtime-services.d.ts +1 -8
  39. package/dist/types/cli/stdio-server.d.ts +0 -4
  40. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +0 -4
  41. package/dist/types/cli/tool-bootstrap.d.ts +0 -17
  42. package/dist/types/contracts/memory-recall-packet.d.ts +31 -0
  43. package/dist/types/contracts/memory-response-contract.d.ts +2 -0
  44. package/dist/types/contracts/tool-execution-evidence.d.ts +8 -0
  45. package/dist/types/contracts/tool-name.d.ts +10 -0
  46. package/dist/types/contracts/turn-event.d.ts +36 -3
  47. package/dist/types/host-contract/acp-content.d.ts +45 -0
  48. package/dist/types/host-contract/index.d.ts +65 -48
  49. package/dist/types/orchestration/agent-instance.d.ts +21 -1
  50. package/dist/types/orchestration/agent-roster.d.ts +14 -15
  51. package/dist/types/orchestration/dag-scheduler.d.ts +4 -0
  52. package/dist/types/orchestration/goal-context-envelope.d.ts +7 -0
  53. package/dist/types/orchestration/goal-loop-coordinator.d.ts +55 -12
  54. package/dist/types/orchestration/goal-mode-adapters.d.ts +13 -1
  55. package/dist/types/orchestration/goal-run-persistence.d.ts +9 -2
  56. package/dist/types/orchestration/goal-run-types.d.ts +127 -13
  57. package/dist/types/orchestration/index.d.ts +1 -1
  58. package/dist/types/orchestration/product-persistence.d.ts +10 -1
  59. package/dist/types/orchestration/product-planner.d.ts +3 -3
  60. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +1 -0
  61. package/dist/types/orchestration/workflow/data-item.d.ts +1 -1
  62. package/dist/types/orchestration/workflow/expression.d.ts +1 -2
  63. package/dist/types/orchestration/workflow/workflow-patch.d.ts +1 -2
  64. package/dist/types/orchestration/workflow/workflow-render.d.ts +1 -2
  65. package/dist/types/project-memory-host.d.ts +1 -0
  66. package/dist/types/protocol/agent-contract.d.ts +10 -8
  67. package/dist/types/protocol/methods.d.ts +2 -19
  68. package/dist/types/protocol/notifications.d.ts +1 -1
  69. package/dist/types/protocol/wire/acp-agent-management.d.ts +48 -6
  70. package/dist/types/protocol/wire/acp-protocol.d.ts +11 -24
  71. package/dist/types/protocol/wire/agent-methods.d.ts +5 -142
  72. package/dist/types/protocol/wire/chat-types.d.ts +50 -0
  73. package/dist/types/protocol/wire/index.d.ts +2 -2
  74. package/dist/types/protocol/wire/notification-payloads.d.ts +73 -122
  75. package/dist/types/protocol/wire/thread-protocol.d.ts +4 -40
  76. package/dist/types/runtime/community/community-consent-client.d.ts +0 -13
  77. package/dist/types/runtime/context/context-compression-strategies.d.ts +29 -0
  78. package/dist/types/runtime/context/context-envelope.d.ts +3 -0
  79. package/dist/types/runtime/execution/dream-agent.d.ts +4 -5
  80. package/dist/types/runtime/execution/mcp-capability-selection.d.ts +54 -0
  81. package/dist/types/runtime/execution/memory-decay.d.ts +1 -1
  82. package/dist/types/runtime/execution/search-result-quality.d.ts +22 -0
  83. package/dist/types/runtime/execution/streaming-tool-executor.d.ts +2 -0
  84. package/dist/types/runtime/execution/tool-result-storage.d.ts +44 -0
  85. package/dist/types/runtime/hooks/memory-hooks.d.ts +3 -2
  86. package/dist/types/runtime/infra/agent-paths.d.ts +0 -8
  87. package/dist/types/runtime/infra/default-path-service.d.ts +0 -2
  88. package/dist/types/runtime/infra/llmrouter-managed-inference.d.ts +54 -1
  89. package/dist/types/runtime/infra/media-persistence.d.ts +6 -36
  90. package/dist/types/runtime/memory/implicit-extraction.d.ts +7 -15
  91. package/dist/types/runtime/memory/memory-recall-attribution.d.ts +24 -0
  92. package/dist/types/runtime/ports/agent-runtime-ports.d.ts +14 -0
  93. package/dist/types/runtime/ports/index.d.ts +1 -3
  94. package/dist/types/runtime/ports/memory-provider.d.ts +2 -19
  95. package/dist/types/runtime/ports/memory-writer.d.ts +1 -1
  96. package/dist/types/runtime/ports/path-service.d.ts +0 -2
  97. package/dist/types/runtime/prompt/capability-routing-policy.d.ts +13 -0
  98. package/dist/types/runtime/prompt/environment-context.d.ts +3 -6
  99. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +8 -13
  100. package/dist/types/runtime/prompt/tool-necessity-policy.d.ts +12 -0
  101. package/dist/types/skills/mcp/mcp-manager.d.ts +29 -4
  102. package/dist/types/skills/memory/host-memory-provider.d.ts +3 -9
  103. package/dist/types/skills/memory/memdir.d.ts +1 -1
  104. package/dist/types/skills/memory/memory-content-safety.d.ts +1 -0
  105. package/dist/types/skills/permissions/hook-runner.d.ts +3 -3
  106. package/dist/types/skills/portable-tool.d.ts +5 -0
  107. package/dist/types/skills/skill-system/skill-lifecycle.d.ts +1 -0
  108. package/dist/types/skills/tools/exec-tool.d.ts +1 -5
  109. package/dist/types/skills/tools/shell/command-compatibility.d.ts +3 -0
  110. package/dist/types/skills/tools/shell/index.d.ts +4 -3
  111. package/dist/types/skills/tools/shell/shell-exec.d.ts +15 -8
  112. package/dist/types/skills/tools/shell/shell-provider.d.ts +26 -0
  113. package/dist/types/transport/acp-server.d.ts +4 -1
  114. package/dist/types/transport/host-community-client.d.ts +0 -1
  115. package/dist/types/transport/host-request-client.d.ts +1 -0
  116. package/dist/types/transport/host-run-state-client.d.ts +1 -1
  117. package/dist/workflow-host.js +6 -6
  118. package/package.json +4 -3
  119. package/dist/skills/mcp/astraclaw-native-mcp-server.js +0 -12
  120. package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +0 -9
  121. package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +0 -7
  122. package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +0 -7
  123. package/dist/types/cli/core-tools/config-tool-service.d.ts +0 -13
  124. package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +0 -7
  125. package/dist/types/cli/core-tools/monitor-tool-service.d.ts +0 -6
  126. package/dist/types/cli/dev-tool-bootstrap.d.ts +0 -9
  127. package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +0 -7
  128. package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +0 -8
  129. package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +0 -81
  130. package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +0 -59
  131. package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +0 -7
  132. package/dist/types/cli/handlers/media-handler.d.ts +0 -19
  133. package/dist/types/cli/handlers/skills-handler.d.ts +0 -37
  134. package/dist/types/cli/industrial-runtime-store.d.ts +0 -16
  135. package/dist/types/cli/media-capability-schema.d.ts +0 -49
  136. package/dist/types/cli/media-file-api-service.d.ts +0 -73
  137. package/dist/types/cli/media-file-tool-service.d.ts +0 -13
  138. package/dist/types/cli/media-inline.d.ts +0 -31
  139. package/dist/types/cli/media-runtime-facade.d.ts +0 -51
  140. package/dist/types/cli/media-understanding.d.ts +0 -102
  141. package/dist/types/cli/skill-invocation-service.d.ts +0 -10
  142. package/dist/types/cli/skill-tools-bootstrap.d.ts +0 -35
  143. package/dist/types/cli/skills-query-service.d.ts +0 -41
  144. package/dist/types/cli/tool-bootstrap-media-registration.d.ts +0 -20
  145. package/dist/types/cli/turn-media-setup.d.ts +0 -34
  146. package/dist/types/cli/turn-preview-browser-setup.d.ts +0 -15
  147. package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +0 -33
  148. package/dist/types/runtime/infra/builtin-skills-seed.d.ts +0 -31
  149. package/dist/types/runtime/infra/checkpoint-backend.d.ts +0 -9
  150. package/dist/types/runtime/infra/industrial-runtime-session-server.d.ts +0 -20
  151. package/dist/types/runtime/infra/migrate-project-skills.d.ts +0 -24
  152. package/dist/types/runtime/infra/project-skill-manifest.d.ts +0 -21
  153. package/dist/types/runtime/infra/skill-resolver.d.ts +0 -74
  154. package/dist/types/runtime/infra/worktree-backend.d.ts +0 -86
  155. package/dist/types/runtime/ports/checkpoint-contracts.d.ts +0 -19
  156. package/dist/types/runtime/ports/worktree-contracts.d.ts +0 -22
  157. package/dist/types/skills/mcp/astraclaw-native-mcp-server.d.ts +0 -1
  158. package/dist/types/skills/memory/memory-tool.d.ts +0 -87
  159. package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
  160. package/dist/types/skills/tools/config-tool.d.ts +0 -61
  161. package/dist/types/skills/tools/file-management-tool.d.ts +0 -90
  162. package/dist/types/skills/tools/image-generate-tool.d.ts +0 -98
  163. package/dist/types/skills/tools/instructions-tool.d.ts +0 -65
  164. package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
  165. package/dist/types/skills/tools/media-cancel-tool.d.ts +0 -30
  166. package/dist/types/skills/tools/media-understand-tool.d.ts +0 -28
  167. package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
  168. package/dist/types/skills/tools/music-generate-tool.d.ts +0 -80
  169. package/dist/types/skills/tools/notebook-edit-tool.d.ts +0 -15
  170. package/dist/types/skills/tools/preview-browser-tool.d.ts +0 -136
  171. package/dist/types/skills/tools/repo-map-tool.d.ts +0 -52
  172. package/dist/types/skills/tools/skill-tool.d.ts +0 -142
  173. package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
  174. package/dist/types/skills/tools/stt-tool.d.ts +0 -33
  175. package/dist/types/skills/tools/subagent-decision-tool.d.ts +0 -15
  176. package/dist/types/skills/tools/three-d-generate-tool.d.ts +0 -46
  177. package/dist/types/skills/tools/tts-tool.d.ts +0 -50
  178. package/dist/types/skills/tools/video-edit-tool.d.ts +0 -72
  179. package/dist/types/skills/tools/video-generate-tool.d.ts +0 -162
  180. package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
  181. package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
  182. package/dist/types/skills/tools/voice-clone-tool.d.ts +0 -40
  183. package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
@@ -11,6 +11,8 @@
11
11
  * 3. Add event name string in agent-events.ts (if WS-relayed)
12
12
  */
13
13
  import type { DelegationError } from "./gateway-rpc.js";
14
+ import type { ThreadItem, ThreadItemEvent } from "../../host-contract/index.js";
15
+ import type { ToolIdentity } from "./chat-types.js";
14
16
  /** Identifies which agent produced this notification (main or teammate). */
15
17
  export interface AgentSource {
16
18
  id: string;
@@ -25,21 +27,11 @@ export interface WireTokenUsage {
25
27
  cacheRead?: number;
26
28
  cacheWrite?: number;
27
29
  }
28
- /** Embedded thread item for clients using the Thread protocol. */
29
- export interface NotificationThreadItem {
30
- id: string;
31
- type: string;
32
- role: "user" | "assistant" | "system";
33
- text?: string;
34
- toolName?: string;
35
- toolCallId?: string;
36
- arguments?: string;
37
- output?: string;
38
- approved?: boolean;
39
- strategy?: string;
40
- createdAt: string;
41
- }
42
- export type MediaResultType = "image" | "tts" | "video" | "music" | "3d";
30
+ /** Embedded canonical item; never a second notification-only item shape. */
31
+ export type NotificationThreadItem = ThreadItem;
32
+ /** One live notification carrying the exact envelope written to the Host journal. */
33
+ export type ThreadItemNotification = ThreadItemEvent;
34
+ export type MediaResultType = "image" | "tts" | "video" | "music" | "3d" | "file";
43
35
  export type ArtifactType = "code" | "file" | "image" | "document" | "diagram" | "table";
44
36
  /** Turn started — always emitted first. */
45
37
  export interface TurnStartNotification {
@@ -81,6 +73,16 @@ export interface TurnRecoveryNotification {
81
73
  detail?: string;
82
74
  item?: NotificationThreadItem;
83
75
  }
76
+ /**
77
+ * 作废本回合已发出但随后被丢弃的助手文本(后缀截断)。语义与边界见
78
+ * `contracts/turn-event.ts` 的 `text_rollback` 变体;消费端只执行截断,不推断截断点。
79
+ */
80
+ export interface TurnTextRollbackNotification {
81
+ turnId: string;
82
+ /** 保留的助手文本长度,UTF-16 code unit,按全部文本段逻辑拼接计算。 */
83
+ keepLength: number;
84
+ reason: string;
85
+ }
84
86
  export type TurnFileChangeStatus = "added" | "modified" | "deleted" | "renamed" | "moved" | "copied" | "unchanged";
85
87
  export interface TurnFileChangeRecord {
86
88
  path: string;
@@ -112,6 +114,7 @@ export interface TurnToolCallNotification {
112
114
  turnId: string;
113
115
  callId: string;
114
116
  name: string;
117
+ displayName?: string;
115
118
  arguments?: string;
116
119
  inputSummary?: string;
117
120
  item?: NotificationThreadItem;
@@ -177,6 +180,8 @@ export interface TurnMemoryRecallNotification {
177
180
  count: number;
178
181
  /** Truncated texts of the memories actually injected (post-cap), for the expanded list. */
179
182
  titles: string[];
183
+ /** Content-free canonical memory ids used to compare evidence across recall routes. */
184
+ memoryIds?: string[];
180
185
  /** Content-free identifiers for the injected memory layers. */
181
186
  sources?: string[];
182
187
  }
@@ -240,64 +245,12 @@ export interface TurnMediaResultNotification {
240
245
  width?: number;
241
246
  height?: number;
242
247
  mimeType?: string;
248
+ filename?: string;
249
+ size?: number;
243
250
  billingUnit?: string;
244
251
  billingQuantity?: number;
245
252
  taskId?: string;
246
253
  }
247
- /** Async media generation progress. */
248
- export interface TurnMediaProgressNotification {
249
- turnId: string;
250
- taskId: string;
251
- mediaType: MediaResultType;
252
- percent: number;
253
- status: string;
254
- provider?: string;
255
- }
256
- /** Structured media provider usage for non-token billed image/video/audio calls. */
257
- export interface TurnMediaUsageNotification {
258
- usageId: string;
259
- turnId: string;
260
- mediaType: MediaResultType | string;
261
- provider: string;
262
- model: string;
263
- billingUnit: string;
264
- billingQuantity: number;
265
- }
266
- /** Capability preflight decision for media requests. */
267
- export interface TurnMediaCapabilityCheckNotification {
268
- turnId: string;
269
- mediaType: MediaResultType | string;
270
- provider: string;
271
- model: string;
272
- mode: string;
273
- allowed: boolean;
274
- reason?: string;
275
- capabilities: {
276
- modes: string[];
277
- source: string;
278
- limits: Record<string, unknown>;
279
- features: Record<string, unknown>;
280
- };
281
- }
282
- /** Media files auto-downloaded to local storage. */
283
- export interface TurnMediaPersistedNotification {
284
- turnId: string;
285
- files: Array<{
286
- remoteUrl: string;
287
- localPath: string;
288
- bytes: number;
289
- mimeType: string;
290
- }>;
291
- /**
292
- * URLs that FAILED to persist locally this turn (result keeps the remote URL / dangling temp
293
- * path, which may expire). Present only when at least one file failed — persistence stays
294
- * fail-open, but the degradation is surfaced instead of silently swallowed.
295
- */
296
- failures?: Array<{
297
- remoteUrl: string;
298
- error?: string;
299
- }>;
300
- }
301
254
  /** Task state change. */
302
255
  export interface TurnTaskUpdatedNotification {
303
256
  turnId: string;
@@ -351,9 +304,32 @@ export interface TurnHeartbeatNotification {
351
304
  message: string;
352
305
  }
353
306
  /** Structured telemetry for a tool use batch. */
307
+ export interface ToolCallExecutionEvidence {
308
+ sequence: number;
309
+ callId: string;
310
+ name: string;
311
+ identity: ToolIdentity;
312
+ status: "running" | "succeeded" | "failed" | "blocked";
313
+ arguments?: string;
314
+ error?: string;
315
+ failureKind?: "policy_blocked" | "semantic_quality_failed" | "timeout" | "mcp_start_failed" | "mcp_unavailable" | "tool_execution_failed";
316
+ }
317
+ export interface FinalAnswerEvidence {
318
+ schemaVersion: 1;
319
+ requirement: "not-required" | "fresh-tool-evidence";
320
+ disposition: "not-required" | "grounded" | "blocked-no-tool-evidence" | "blocked-no-successful-evidence";
321
+ successfulCallIds: string[];
322
+ failedCallIds: string[];
323
+ blockedCallIds: string[];
324
+ reason: string;
325
+ }
354
326
  export interface TurnToolUseSummaryNotification {
355
327
  turnId: string;
356
- telemetrySource?: "agent" | "agent-synthetic";
328
+ telemetrySource?: "agent";
329
+ ledgerSchemaVersion: 4;
330
+ toolCalls: ToolCallExecutionEvidence[];
331
+ routingEvidence?: CapabilityRoutingEvidence;
332
+ finalAnswerEvidence: FinalAnswerEvidence;
357
333
  availableToolNames: string[];
358
334
  enabledToolNames: string[];
359
335
  toolCallNames: string[];
@@ -363,16 +339,28 @@ export interface TurnToolUseSummaryNotification {
363
339
  }>;
364
340
  }
365
341
  /** Structured telemetry for why the enabled tool surface changed within a turn. */
342
+ export interface CapabilityRoutingEvidence {
343
+ schemaVersion: 1;
344
+ owner: "structured-planner" | "direct-response" | "mcp-capability" | "typed-builtin" | "pinned-skill" | "host-skill-discovery";
345
+ source: "structured-planner" | "direct-response" | "semantic-directory" | "continuation" | "explicit" | "semantic-web-evidence" | "typed-directory" | "typed-builtin" | "pinned-skill" | "host-skill-discovery";
346
+ selectedNamespaces: string[];
347
+ matchedFeatures: string[];
348
+ score?: number;
349
+ runnerUpScore?: number;
350
+ availableToolCount: number;
351
+ exposedToolCount: number;
352
+ }
366
353
  export interface TurnToolSelectionPolicyNotification {
367
354
  turnId: string;
368
355
  policyId: string;
369
- intent: "benchmark_state_maintenance" | "fresh_evidence" | "verification" | "final_answer" | "tool_recovery" | "lifecycle_reconciliation";
356
+ intent: "capability_routing" | "benchmark_state_maintenance" | "fresh_evidence" | "verification" | "final_answer" | "tool_recovery" | "lifecycle_reconciliation";
370
357
  reason: string;
371
358
  availableToolNames: string[];
372
359
  enabledToolNamesBefore: string[];
373
360
  enabledToolNamesAfter: string[];
374
361
  suppressedToolNames: string[];
375
362
  nextAction: string;
363
+ routingEvidence?: CapabilityRoutingEvidence;
376
364
  }
377
365
  /** Queryable long-horizon turn lifecycle telemetry. */
378
366
  export interface TurnLifecycleNotification {
@@ -642,6 +630,17 @@ export interface ProductTaskFailedNotification {
642
630
  attempt: number;
643
631
  terminalState: "failed" | "cancelled";
644
632
  }
633
+ /** Automatic abnormal-worker handoff receipt for one stable task. */
634
+ export interface ProductTaskHandoffNotification {
635
+ productId: string;
636
+ taskId: string;
637
+ from: string;
638
+ to: string;
639
+ reason: string;
640
+ /** Attempt number that the replacement worker will execute. */
641
+ attempt: number;
642
+ timestamp: string;
643
+ }
645
644
  /** Product checkpoint saved. */
646
645
  export interface ProductCheckpointedNotification {
647
646
  productId: string;
@@ -930,47 +929,6 @@ export interface WorkflowRunFailedNotification {
930
929
  error: string;
931
930
  outcome?: unknown;
932
931
  }
933
- export interface GoalRunStateChangedNotification {
934
- goalRunId: string;
935
- status: "running" | "ended";
936
- pauseState: "running" | "draining" | "paused";
937
- endReason?: "done" | "stopped" | "failed";
938
- }
939
- export interface GoalPhaseBoundaryNotification {
940
- goalRunId: string;
941
- phaseIndex: number;
942
- deltas: {
943
- criterionId: string;
944
- newStatus: string;
945
- }[];
946
- nextPreview?: string;
947
- migrationNote?: string;
948
- }
949
- export interface GoalGoalEditedNotification {
950
- goalRunId: string;
951
- newVersion: number;
952
- }
953
- export interface GoalMessageQueuedNotification {
954
- goalRunId: string;
955
- queuedCount: number;
956
- }
957
- export interface GoalAcceptanceUpdatedNotification {
958
- goalRunId: string;
959
- criterionId: string;
960
- status: string;
961
- }
962
- export interface GoalRoundMessageNotification {
963
- goalRunId: string;
964
- message: {
965
- messageId: string;
966
- platform: string;
967
- userId?: string;
968
- type: string;
969
- content: string;
970
- timestamp: string;
971
- source: string;
972
- };
973
- }
974
932
  export interface MentionDelegateStartedNotification {
975
933
  parentSessionId: string;
976
934
  parentMessageId: string;
@@ -1014,6 +972,7 @@ export interface NotificationMethodMap {
1014
972
  "turn.end": TurnEndNotification;
1015
973
  "turn.error": TurnErrorNotification;
1016
974
  "turn.recovery": TurnRecoveryNotification;
975
+ "turn.text_rollback": TurnTextRollbackNotification;
1017
976
  "turn.file_changes": TurnFileChangesNotification;
1018
977
  "turn.tool_call": TurnToolCallNotification;
1019
978
  "turn.tool_result": TurnToolResultNotification;
@@ -1033,10 +992,6 @@ export interface NotificationMethodMap {
1033
992
  "turn.subagent_decision": TurnSubagentDecisionNotification;
1034
993
  "turn.annotations": TurnAnnotationsNotification;
1035
994
  "turn.media_result": TurnMediaResultNotification;
1036
- "turn.media_progress": TurnMediaProgressNotification;
1037
- "turn.media_usage": TurnMediaUsageNotification;
1038
- "turn.media_capability_check": TurnMediaCapabilityCheckNotification;
1039
- "turn.media_persisted": TurnMediaPersistedNotification;
1040
995
  "turn.task_updated": TurnTaskUpdatedNotification;
1041
996
  "turn.todos_updated": TurnTodosUpdatedNotification;
1042
997
  "task.updated": TaskUpdatedNotification;
@@ -1060,6 +1015,7 @@ export interface NotificationMethodMap {
1060
1015
  "session.recovery_pending": SessionRecoveryPendingNotification;
1061
1016
  "permission.rule_updated": PermissionRuleUpdatedNotification;
1062
1017
  "team.member.notification": TeamMemberNotification;
1018
+ "thread.item": ThreadItemNotification;
1063
1019
  "turn.usage_update": TurnUsageUpdateNotification;
1064
1020
  "pong": PongNotification;
1065
1021
  "solo.progress": SoloProgressNotification;
@@ -1071,6 +1027,7 @@ export interface NotificationMethodMap {
1071
1027
  "product.taskStarted": ProductTaskStartedNotification;
1072
1028
  "product.taskCompleted": ProductTaskCompletedNotification;
1073
1029
  "product.taskFailed": ProductTaskFailedNotification;
1030
+ "product.taskHandoff": ProductTaskHandoffNotification;
1074
1031
  "product.checkpointed": ProductCheckpointedNotification;
1075
1032
  "product.budgetWarning": ProductBudgetWarningNotification;
1076
1033
  "product.budgetExceeded": ProductBudgetExceededNotification;
@@ -1086,12 +1043,6 @@ export interface NotificationMethodMap {
1086
1043
  "product.leaderMessage": ProductLeaderMessageNotification;
1087
1044
  "product.planningAsk": ProductPlanningAskNotification;
1088
1045
  "plan.interrupted": PlanInterruptedNotification;
1089
- "goal.run_state_changed": GoalRunStateChangedNotification;
1090
- "goal.phase_boundary": GoalPhaseBoundaryNotification;
1091
- "goal.goal_edited": GoalGoalEditedNotification;
1092
- "goal.message_queued": GoalMessageQueuedNotification;
1093
- "goal.acceptance_updated": GoalAcceptanceUpdatedNotification;
1094
- "goal.round_message": GoalRoundMessageNotification;
1095
1046
  "mention.delegate_started": MentionDelegateStartedNotification;
1096
1047
  "mention.delegate_activity": MentionDelegateActivityNotification;
1097
1048
  "mention.delegate_settled": MentionDelegateSettledNotification;
@@ -1,42 +1,6 @@
1
- /**
2
- * Thread Protocol Codex app-server style three-layer abstraction.
3
- *
4
- * Thread → Turn → Item
5
- *
6
- * Thread: persistent conversation container (maps to a session)
7
- * Turn: one user request → agent response cycle
8
- * Item: individual components within a turn (message, tool_call, tool_result, etc.)
9
- *
10
- * This module defines the wire types. The existing `agent.turn` RPC continues
11
- * to work; these types provide the foundation for `thread/*` methods.
12
- */
13
- export type ItemType = "message" | "tool_call" | "tool_result" | "tool_blocked" | "recovery" | "plan_update";
14
- export type ItemRole = "user" | "assistant" | "system";
15
- /** A single atomic event within a turn. */
16
- export interface ThreadItem {
17
- /** Unique item ID. */
18
- id: string;
19
- /** Item type (discriminator). */
20
- type: ItemType;
21
- /** Role of the actor. */
22
- role: ItemRole;
23
- /** Text content (for message items). */
24
- text?: string;
25
- /** Tool name (for tool_call / tool_result items). */
26
- toolName?: string;
27
- /** Tool call ID (LLM-assigned). */
28
- toolCallId?: string;
29
- /** Serialized arguments (for tool_call). */
30
- arguments?: string;
31
- /** Tool output (for tool_result). */
32
- output?: string;
33
- /** Whether the tool was approved. */
34
- approved?: boolean;
35
- /** Recovery strategy used (for recovery items). */
36
- strategy?: string;
37
- /** Timestamp (ISO 8601). */
38
- createdAt: string;
39
- }
1
+ /** Thread/Turn containers and RPC shapes. The Item envelope itself is owned by Host contract. */
2
+ import type { ThreadItem } from "../../host-contract/index.js";
3
+ export type { ThreadItem, ThreadItemDomain, ThreadItemEvent, ThreadItemRole, ThreadItemState, ThreadItemType, } from "../../host-contract/index.js";
40
4
  export type TurnStatus = "pending" | "in_progress" | "completed" | "failed" | "aborted";
41
5
  /** Represents one user request → agent response cycle. */
42
6
  export interface ThreadTurn {
@@ -82,7 +46,7 @@ export interface Thread {
82
46
  lastActiveAt: string;
83
47
  }
84
48
  /**
85
- * `initialize` request params — superset of agent.hello.
49
+ * `initialize` request params.
86
50
  * Sent by host as the first message after transport connects.
87
51
  */
88
52
  export interface InitializeParams {
@@ -1,16 +1,5 @@
1
1
  import type { ConfigPort } from "../ports/index.js";
2
2
  import type { HostCommunityClient } from "../../transport/host-community-client.js";
3
- export interface CommunityRuntimeResolution {
4
- id: string;
5
- platform: string;
6
- version: string;
7
- downloadUrl: string;
8
- /** sha256 hex digest — verified client-side before placing the binary. */
9
- checksum: string;
10
- sizeBytes: number;
11
- format: "executable" | "zip" | "tar.gz";
12
- entrypoint?: string;
13
- }
14
3
  export type CommunityInstallRiskTier = "R0" | "R1" | "R2" | "R3";
15
4
  export type CommunityInstallSourceTier = "official" | "community";
16
5
  export type CommunityInstallTrustStage = "quarantine" | "trial" | "trusted";
@@ -59,8 +48,6 @@ export interface CommunityConsentClient {
59
48
  /** List a resource's published versions for the version/rollback menu (WS-B3). The
60
49
  * default client always implements it; optional so lightweight mocks may omit it. */
61
50
  listResourceVersions?(resourceId: string): Promise<CommunityResourceVersion[]>;
62
- /** Resolve a vetted runtime binary (e.g. officecli) for this platform → Hub-signed download. */
63
- resolveRuntime(id: string, platform: string): Promise<CommunityRuntimeResolution>;
64
51
  }
65
52
  export declare function createCommunityConsentClient(options: CommunityConsentClientOptions): CommunityConsentClient;
66
53
  /** Supervised desktop path: the Runtime Host owns refresh and performs authenticated Hub reads. */
@@ -1,9 +1,16 @@
1
+ import type { ContextAnchor } from "../../protocol/wire/chat-types.js";
1
2
  export interface CompressibleMessage {
2
3
  role: string;
3
4
  content?: string | unknown;
4
5
  tool_call_id?: string;
5
6
  tool_calls?: unknown;
6
7
  name?: string;
8
+ /** Optional canonical protocol coordinates used by compaction receipts. */
9
+ threadId?: string;
10
+ turnId?: string;
11
+ itemId?: string;
12
+ /** Structured anchors survive compaction without relying on prose reconstruction. */
13
+ contextAnchors?: ContextAnchor[];
7
14
  }
8
15
  export interface CompressionResult {
9
16
  messages: CompressibleMessage[];
@@ -36,6 +43,28 @@ export interface AsyncCompressionStrategy extends CompressionStrategy {
36
43
  export declare function isAsyncCompressionStrategy(s: CompressionStrategy): s is AsyncCompressionStrategy;
37
44
  /** Caller-provided LLM summarization function (wired by Hub). */
38
45
  export type SummarizeFn = (messages: CompressibleMessage[], instruction: string) => Promise<string>;
46
+ export declare const CONTEXT_CAPSULE_MARKER = "[Context capsule v1]";
47
+ export interface ContextCompactionReceipt {
48
+ version: 1;
49
+ sourceMessageCount: number;
50
+ sourceItemIds: string[];
51
+ firstItemId?: string;
52
+ lastItemId?: string;
53
+ priorDigest?: string;
54
+ tokensBefore: number;
55
+ digest: string;
56
+ }
57
+ export interface ContextCapsule {
58
+ receipt: ContextCompactionReceipt;
59
+ state: {
60
+ summary: string;
61
+ userRequests: string[];
62
+ anchors: Partial<Record<ContextAnchor["category"], string[]>>;
63
+ };
64
+ }
65
+ /** Compression is a persistence boundary: credentials are redacted before any LLM or capsule sees them. */
66
+ export declare function redactCompressionSecrets(input: string): string;
67
+ export declare function parseContextCapsule(message: CompressibleMessage | undefined): ContextCapsule | undefined;
39
68
  export declare class SlidingWindowStrategy implements CompressionStrategy {
40
69
  private estimateTokens;
41
70
  constructor(estimateTokens: (msg: CompressibleMessage) => number);
@@ -0,0 +1,3 @@
1
+ import type { ContextEnvelope } from "../../protocol/wire/chat-types.js";
2
+ /** Validate, bound and redact the Host context before it enters a transcript or compaction capsule. */
3
+ export declare function sanitizeContextEnvelope(input: unknown): ContextEnvelope | undefined;
@@ -69,8 +69,8 @@ export interface DreamRunResult {
69
69
  * Allowed:
70
70
  * - read_file, grep, glob, search — unrestricted read-only tools
71
71
  * - bash — only read-only commands (ls, grep, cat, find, stat, wc, head, tail)
72
- * - memory the memdir writer (routes through the gateway projectMemory proxy)
73
- * - raw write/edit/patch — denied (memory writes must go through the `memory` tool)
72
+ * - Host project_memory MCP tool the sole project-memory writer
73
+ * - raw write/edit/patch — denied (project-memory writes stay Host-owned)
74
74
  * - Everything else — denied
75
75
  */
76
76
  export declare function canUseDreamTool(memoryRoot: string, restriction: DreamToolRestriction): DreamToolVerdict;
@@ -78,9 +78,8 @@ export declare function canUseDreamTool(memoryRoot: string, restriction: DreamTo
78
78
  * Canonical catalog tool names advertised to the dream sub-agent. This trims the
79
79
  * full manifest (dozens of irrelevant tools) down to what dream actually uses.
80
80
  * Every name here MUST be allowed by canUseDreamTool — raw write/edit/patch are
81
- * intentionally absent (canUseDreamTool hard-denies them); the `memory` tool is
82
- * the sole sanctioned memdir writer and routes through the gateway proxy
83
- * (dream-memdir-migration).
81
+ * intentionally absent (canUseDreamTool hard-denies them); Host project memory
82
+ * is the sole sanctioned memdir writer.
84
83
  */
85
84
  export declare const DREAM_ALLOWED_TOOLS: Set<string>;
86
85
  /**
@@ -0,0 +1,54 @@
1
+ import type { ChatMessage, LLMTransport, ToolDefinition } from "../../agent/types.js";
2
+ export interface CapabilityRouterClient {
3
+ transport: LLMTransport;
4
+ apiKey: string;
5
+ model: string;
6
+ }
7
+ export interface McpCapabilitySelection {
8
+ aliases: string[];
9
+ toolNames: ReadonlySet<string>;
10
+ source: "semantic-directory";
11
+ evidence: {
12
+ namespaces: string[];
13
+ matchedFeatures: string[];
14
+ };
15
+ }
16
+ export type McpCapabilityRoutingOutcome = {
17
+ status: "selected";
18
+ selection: McpCapabilitySelection;
19
+ } | {
20
+ status: "none";
21
+ reason: string;
22
+ } | {
23
+ status: "ambiguous";
24
+ reason: string;
25
+ } | {
26
+ status: "unavailable";
27
+ reason: string;
28
+ };
29
+ export interface ResolveMcpCapabilitySelectionInput {
30
+ userText: string;
31
+ messages: readonly ChatMessage[];
32
+ tools: readonly ToolDefinition[];
33
+ client: CapabilityRouterClient | null;
34
+ signal?: AbortSignal;
35
+ }
36
+ /**
37
+ * Select optional MCP capabilities using a model over the live structured tool
38
+ * directory and recent conversation. No user-text keyword, alias, regular
39
+ * expression, or connector-name gate participates in the decision.
40
+ *
41
+ * When routing is unavailable, invalid, or uncertain, this function abstains.
42
+ * The caller then exposes the complete authorized tool surface so the primary
43
+ * model can still make its native semantic choice; an optimization failure must
44
+ * never turn an installed capability into an apparent absence.
45
+ */
46
+ export declare function resolveMcpCapabilitySelection(input: ResolveMcpCapabilitySelectionInput): Promise<McpCapabilitySelection | undefined>;
47
+ /**
48
+ * Resolve one semantic routing attempt without collapsing abstention, ambiguity,
49
+ * invalid output, and transport failure into the same undefined value. Callers
50
+ * can use this typed outcome to request a semantic second opinion without
51
+ * adding text classifiers or connector-specific fallbacks.
52
+ */
53
+ export declare function resolveMcpCapabilityRoute(input: ResolveMcpCapabilitySelectionInput): Promise<McpCapabilityRoutingOutcome>;
54
+ export declare function selectCapabilityToolSurface(tools: readonly ToolDefinition[], selection: McpCapabilitySelection | undefined): ToolDefinition[];
@@ -67,7 +67,7 @@ export interface DecayCycleResult {
67
67
  *
68
68
  * Lifecycle:
69
69
  * 1. Check time gate (24h default)
70
- * 2. Call local memory provider decay
70
+ * 2. Call the Host-backed memory provider
71
71
  * 3. Mark completion timestamp
72
72
  */
73
73
  export declare function runDecayCycle(deps: DecayCycleDeps): Promise<DecayCycleResult>;
@@ -0,0 +1,22 @@
1
+ export type SearchResultQuality = {
2
+ status: "pass";
3
+ matchedAnchors: string[];
4
+ authority: "matched" | "not-requested";
5
+ } | {
6
+ status: "fail";
7
+ requiredAnchors: string[];
8
+ reason: "top-result-anchor-miss" | "authoritative-source-unresolved" | "no-results" | "typed-quality-missing";
9
+ } | {
10
+ status: "indeterminate";
11
+ reason: "not-astra-search" | "typed-indeterminate";
12
+ };
13
+ /**
14
+ * Consumes qlogic-web-core's typed search-owner verdict. Agent execution does
15
+ * not rerank results or recreate query semantics; a missing verdict from the
16
+ * first-party Astra Search contract fails closed instead of activating a
17
+ * second consumer-side quality policy.
18
+ */
19
+ export declare function assessSearchResultQuality(input: {
20
+ toolName: string;
21
+ payload: unknown;
22
+ }): SearchResultQuality;
@@ -30,6 +30,8 @@ export interface StreamingToolExecutorConfig {
30
30
  sessionId: string;
31
31
  /** Turn workspace/cwd - routes oversized tool-result spillover to the session data dir. */
32
32
  projectRoot?: string;
33
+ /** Per-turn typed context budget and required skill-resource state. */
34
+ contextState?: unknown;
33
35
  turnId: string;
34
36
  log: AgentLogger;
35
37
  signal?: AbortSignal;
@@ -36,6 +36,36 @@ export declare const TOOL_RESULT_CLEARED_MESSAGE = "[Old tool result content cle
36
36
  export type ContentReplacementState = {
37
37
  seenIds: Set<string>;
38
38
  replacements: Map<string, string>;
39
+ contextPolicies: Map<string, ToolResultContextPolicy>;
40
+ contextSizes: Map<string, number>;
41
+ skillReadiness: Map<string, SkillReadinessActivation>;
42
+ };
43
+ export type ToolResultContextPolicy = {
44
+ kind: "skill_core" | "skill_resource" | "data";
45
+ retention: "required" | "compactable";
46
+ budgetClass: "instructions" | "evidence" | "bulk";
47
+ };
48
+ export type ToolResultContextBudget = {
49
+ maxItemChars: number;
50
+ maxAggregateChars: number;
51
+ };
52
+ type SkillReadinessResource = {
53
+ path: string;
54
+ label: string;
55
+ requiresNext?: boolean;
56
+ };
57
+ type SkillReadinessSet = {
58
+ id: string;
59
+ minReads: number;
60
+ resources: SkillReadinessResource[];
61
+ };
62
+ type PendingSkillReadinessSet = SkillReadinessSet & {
63
+ readPaths: Set<string>;
64
+ nextSets: SkillReadinessSet[];
65
+ };
66
+ type SkillReadinessActivation = {
67
+ skillName: string;
68
+ pendingSets: PendingSkillReadinessSet[];
39
69
  };
40
70
  export type PersistedToolResult = {
41
71
  filepath: string;
@@ -44,6 +74,20 @@ export type PersistedToolResult = {
44
74
  hasMore: boolean;
45
75
  };
46
76
  export declare function createContentReplacementState(): ContentReplacementState;
77
+ export declare function toolResultContextPolicy(details: Record<string, unknown> | undefined): ToolResultContextPolicy;
78
+ export declare function toolResultContextBudget(policy: ToolResultContextPolicy): ToolResultContextBudget;
79
+ export declare function requiredContextBudgetViolation(state: ContentReplacementState | undefined, details: Record<string, unknown> | undefined, contentSize: number): string | undefined;
80
+ export declare function registerToolResultContext(state: ContentReplacementState | undefined, toolCallId: string, details: Record<string, unknown> | undefined, contentSize?: number): void;
81
+ export declare function skillReadinessBlockReason(state: ContentReplacementState | undefined, toolName: string): string | undefined;
82
+ /**
83
+ * Re-apply required Host instruction context after generic compression stages.
84
+ * Existing tool messages are restored in place; if a whole tool exchange was removed,
85
+ * a system capsule is inserted so wire-level tool-call pairing stays valid.
86
+ */
87
+ export declare function restoreRequiredContextMessages(messagesBefore: MessageLike[], messagesAfter: MessageLike[], state: ContentReplacementState): {
88
+ messages: MessageLike[];
89
+ recoveredCount: number;
90
+ };
47
91
  export declare function generatePreview(content: string, maxBytes: number): {
48
92
  preview: string;
49
93
  hasMore: boolean;
@@ -79,8 +79,9 @@ export declare function createMemoryPrefetchState(): MemoryPrefetchState;
79
79
  * - memory.after_recall: reuse accounting off the post-cap injected ids + log
80
80
  *
81
81
  * CC parity additions:
82
- * - LRU dedup via surfacedPaths (filterDuplicateMemoryAttachments)
83
- * - Session byte limit (MAX_SESSION_BYTES = 60KB)
82
+ * - Repeated L2 evidence remains available on every turn; surfacedPaths only
83
+ * prevents charging the unique-session byte budget twice for the same id
84
+ * - Unique session byte limit (MAX_SESSION_BYTES = 60KB)
84
85
  * - Async prefetch (non-blocking promise, abort-aware)
85
86
  *
86
87
  * Returns a cleanup function to unregister.
@@ -40,8 +40,6 @@ export declare function ensureUserAgentHome(): string;
40
40
  export declare function getUserCredentialsPath(): string;
41
41
  /** `~/.qlogicagent/plugins/` — device-scoped. */
42
42
  export declare function getUserPluginsDir(): string;
43
- /** `~/.qlogicagent/skills/` — device-scoped single global skill store. */
44
- export declare function getUserSkillsDir(): string;
45
43
  /** `~/.qlogicagent/profiles/<owner>/settings.json` */
46
44
  export declare function getUserSettingsPath(): string;
47
45
  /** `~/.qlogicagent/cache/` */
@@ -50,10 +48,6 @@ export declare function getUserCacheDir(): string;
50
48
  export declare function getUserDebugLogsDir(): string;
51
49
  /** `~/.qlogicagent/plugin-cache/` — device-scoped (download cache for installs). */
52
50
  export declare function getUserPluginCacheDir(): string;
53
- /** `~/.qlogicagent/mcp.json` — device-scoped installed MCP server definitions.
54
- * The gateway's preinstall writes here too (its mcp-config.ts mirrors this path) — keeping both
55
- * sides on the device level is what makes the preinstalled github MCP visible to every login. */
56
- export declare function getUserMcpConfigPath(): string;
57
51
  /** `~/.qlogicagent/marketplace.json` — device-scoped marketplace sources. */
58
52
  export declare function getUserMarketplaceConfigPath(): string;
59
53
  /** `~/.qlogicagent/profiles/<owner>/workflows/` */
@@ -68,8 +62,6 @@ export declare function getProjectAgentDir(cwd: string): string;
68
62
  export declare function getProjectWorkflowsDir(cwd: string): string;
69
63
  /** `<cwd>/.qlogicagent/plugins/` */
70
64
  export declare function getProjectPluginsDir(cwd: string): string;
71
- /** `<cwd>/.qlogicagent/skills-disabled.json` — per-project skill opt-out (mute) list. */
72
- export declare function getProjectSkillDisabledPath(cwd: string): string;
73
65
  /** `<cwd>/.qlogicagent/settings.json` */
74
66
  export declare function getProjectSettingsPath(cwd: string): string;
75
67
  /** `<cwd>/.qlogicagent/INSTRUCTIONS.md` */