qlogicagent 2.18.5 → 2.18.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/README.md +382 -382
  2. package/dist/agent.js +30 -30
  3. package/dist/cli.js +1 -1
  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/host-contract.js +1 -0
  7. package/dist/index.js +536 -525
  8. package/dist/orchestration.js +4 -4
  9. package/dist/permissions.js +1 -1
  10. package/dist/plugin-marketplace-compute.js +1 -0
  11. package/dist/protocol.js +1 -1
  12. package/dist/runtime/infra/mcp-bridge-server.js +275 -275
  13. package/dist/skills/builtin/desktop-screenshot/SKILL.md +62 -62
  14. package/dist/skills/builtin/office-doc-reading/SKILL.md +19 -19
  15. package/dist/skills/mcp/astraclaw-native-mcp-server.js +4 -4
  16. package/dist/tunables.js +1 -0
  17. package/dist/types/agent/runtime-vars.d.ts +1 -2
  18. package/dist/types/agent/tool-loop.d.ts +13 -0
  19. package/dist/types/agent/tool-loop.test-harness.d.ts +20 -0
  20. package/dist/types/agent/types.d.ts +8 -0
  21. package/dist/types/cli/acp-extended-handlers.d.ts +7 -0
  22. package/dist/types/cli/acp-extended-host-adapter.d.ts +2 -0
  23. package/dist/types/cli/acp-session-host.d.ts +15 -2
  24. package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
  25. package/dist/types/cli/community-skill-installer.d.ts +2 -0
  26. package/dist/types/cli/core-tool-coordinator.d.ts +4 -0
  27. package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +3 -1
  28. package/dist/types/cli/core-tools/config-tool-service.d.ts +7 -5
  29. package/dist/types/cli/default-project-bootstrap.d.ts +1 -0
  30. package/dist/types/cli/dream-host-adapter.d.ts +1 -0
  31. package/dist/types/cli/handlers/agents-handler.d.ts +4 -1
  32. package/dist/types/cli/handlers/community-handler.d.ts +2 -0
  33. package/dist/types/cli/handlers/config-handler.d.ts +2 -15
  34. package/dist/types/cli/handlers/dream-handler.d.ts +4 -0
  35. package/dist/types/cli/handlers/pet-handler.d.ts +3 -2
  36. package/dist/types/cli/handlers/session-handler.d.ts +1 -1
  37. package/dist/types/cli/handlers/skills-handler.d.ts +12 -10
  38. package/dist/types/cli/handlers/solo-handler.d.ts +3 -0
  39. package/dist/types/cli/handlers/turn-handler.d.ts +46 -32
  40. package/dist/types/cli/handlers/workflow-handler.d.ts +6 -0
  41. package/dist/types/cli/mcp-bootstrap.d.ts +0 -2
  42. package/dist/types/cli/media-inline.d.ts +31 -0
  43. package/dist/types/cli/media-understanding.d.ts +65 -8
  44. package/dist/types/cli/memory-coordinator.d.ts +8 -0
  45. package/dist/types/cli/multi-agent-handler-host.d.ts +2 -0
  46. package/dist/types/cli/permission-bootstrap.d.ts +2 -0
  47. package/dist/types/cli/pet-runtime.d.ts +0 -1
  48. package/dist/types/cli/plugin-bootstrap.d.ts +2 -1
  49. package/dist/types/cli/product-coordinator.d.ts +4 -1
  50. package/dist/types/cli/rpc-registry.d.ts +1 -3
  51. package/dist/types/cli/runtime-watcher-bootstrap.d.ts +0 -2
  52. package/dist/types/cli/session-context.d.ts +4 -2
  53. package/dist/types/cli/skill-invocation-service.d.ts +2 -0
  54. package/dist/types/cli/skill-tools-bootstrap.d.ts +2 -0
  55. package/dist/types/cli/skills-query-service.d.ts +2 -1
  56. package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +9 -0
  57. package/dist/types/cli/stdio-acp-request-host.d.ts +11 -2
  58. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -1
  59. package/dist/types/cli/stdio-runtime-bootstrap.d.ts +6 -0
  60. package/dist/types/cli/stdio-runtime-services.d.ts +6 -1
  61. package/dist/types/cli/stdio-server.d.ts +33 -4
  62. package/dist/types/cli/task-distillation-coordinator.d.ts +9 -4
  63. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +3 -0
  64. package/dist/types/cli/tool-bootstrap-media-registration.d.ts +10 -0
  65. package/dist/types/cli/tool-bootstrap-web-registration.d.ts +1 -0
  66. package/dist/types/cli/tool-bootstrap.d.ts +9 -0
  67. package/dist/types/cli/turn-core.d.ts +4 -0
  68. package/dist/types/cli/turn-preview-browser-setup.d.ts +15 -0
  69. package/dist/types/cli/turn-project-router.d.ts +1 -1
  70. package/dist/types/cli/workflow-host-adapter.d.ts +2 -0
  71. package/dist/types/host-contract/index.d.ts +1475 -0
  72. package/dist/types/host-contract/project-id.d.ts +5 -0
  73. package/dist/types/host-contract/provider-profile.d.ts +46 -0
  74. package/dist/types/orchestration/agent-instance.d.ts +6 -0
  75. package/dist/types/orchestration/delegation-coordinator.d.ts +40 -0
  76. package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -0
  77. package/dist/types/orchestration/product-planner.d.ts +3 -0
  78. package/dist/types/orchestration/solo-evaluator.d.ts +18 -3
  79. package/dist/types/orchestration/solo-persistence.d.ts +2 -0
  80. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +4 -0
  81. package/dist/types/permissions.d.ts +2 -0
  82. package/dist/types/protocol/methods.d.ts +0 -199
  83. package/dist/types/protocol/wire/acp-protocol.d.ts +16 -1
  84. package/dist/types/protocol/wire/agent-methods.d.ts +1 -173
  85. package/dist/types/protocol/wire/chat-types.d.ts +6 -0
  86. package/dist/types/runtime/config/tunable-defaults.d.ts +13 -3
  87. package/dist/types/runtime/execution/dream-agent.d.ts +9 -8
  88. package/dist/types/runtime/infra/agent-paths.d.ts +3 -3
  89. package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +1 -1
  90. package/dist/types/runtime/infra/clixml-sanitize.d.ts +16 -0
  91. package/dist/types/runtime/infra/external-agent-approvals.d.ts +18 -0
  92. package/dist/types/runtime/infra/feedback-distillation.d.ts +3 -1
  93. package/dist/types/runtime/infra/feedback-host-authority.d.ts +4 -0
  94. package/dist/types/runtime/infra/llmrouter-catalog.d.ts +2 -13
  95. package/dist/types/runtime/infra/model-registry.d.ts +3 -1
  96. package/dist/types/runtime/infra/project-authority-facade.d.ts +11 -0
  97. package/dist/types/runtime/infra/project-host-authority.d.ts +10 -0
  98. package/dist/types/runtime/ports/memory-provider.d.ts +11 -7
  99. package/dist/types/runtime/ports/tool-contracts.d.ts +2 -0
  100. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +2 -2
  101. package/dist/types/runtime/session/session-catalog.d.ts +12 -0
  102. package/dist/types/runtime/session/session-persistence.d.ts +30 -11
  103. package/dist/types/runtime/session/session-recovery.d.ts +4 -0
  104. package/dist/types/runtime/session/session-summary.d.ts +3 -1
  105. package/dist/types/runtime/session/session-transcript-store.d.ts +7 -0
  106. package/dist/types/skills/memory/host-memory-provider.d.ts +148 -0
  107. package/dist/types/skills/memory/local-memory-provider.d.ts +20 -11
  108. package/dist/types/skills/memory/local-store.d.ts +5 -2
  109. package/dist/types/skills/memory/task-distillation.d.ts +6 -0
  110. package/dist/types/skills/plugins/plugin-marketplace.d.ts +23 -57
  111. package/dist/types/skills/tools/media-understand-tool.d.ts +28 -0
  112. package/dist/types/skills/tools/preview-browser-tool.d.ts +136 -0
  113. package/dist/types/skills/tools/shell/task-output.d.ts +10 -1
  114. package/dist/types/skills/tools/skill-tool.d.ts +1 -1
  115. package/dist/types/skills/web-search/brave-source.d.ts +2 -1
  116. package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +3 -2
  117. package/dist/types/skills/web-search/exa-source.d.ts +2 -1
  118. package/dist/types/skills/web-search/search-svc-source.d.ts +4 -3
  119. package/dist/types/skills/web-search/searxng-source.d.ts +3 -1
  120. package/dist/types/skills/web-search/serper-source.d.ts +2 -1
  121. package/dist/types/skills/web-search/source-factory.d.ts +2 -1
  122. package/dist/types/skills/web-search/web-tunable-resolver.d.ts +16 -0
  123. package/dist/types/test-support/global-home-setup.d.ts +2 -0
  124. package/dist/types/transport/acp-server.d.ts +29 -0
  125. package/dist/types/transport/delegate-client.d.ts +82 -0
  126. package/dist/types/transport/host-capability-client.d.ts +21 -0
  127. package/dist/types/transport/host-feedback-client.d.ts +25 -0
  128. package/dist/types/transport/host-profile-client.d.ts +19 -0
  129. package/dist/types/transport/host-project-client.d.ts +16 -0
  130. package/dist/types/transport/host-request-client.d.ts +38 -0
  131. package/dist/types/transport/host-session-client.d.ts +29 -0
  132. package/dist/types/tunables.d.ts +2 -0
  133. package/dist/vendor/hatch-pet/LICENSE.txt +201 -201
  134. package/dist/vendor/hatch-pet/NOTICE.md +25 -25
  135. package/dist/vendor/hatch-pet/references/animation-rows.md +29 -29
  136. package/dist/vendor/hatch-pet/references/codex-pet-contract.md +35 -35
  137. package/dist/vendor/hatch-pet/references/qa-rubric.md +66 -66
  138. package/dist/vendor/hatch-pet/scripts/compose_atlas.py +169 -169
  139. package/dist/vendor/hatch-pet/scripts/derive_running_left_from_running_right.py +150 -150
  140. package/dist/vendor/hatch-pet/scripts/extract_strip_frames.py +408 -408
  141. package/dist/vendor/hatch-pet/scripts/inspect_frames.py +256 -256
  142. package/dist/vendor/hatch-pet/scripts/make_contact_sheet.py +96 -96
  143. package/dist/vendor/hatch-pet/scripts/prepare_pet_run.py +834 -834
  144. package/dist/vendor/hatch-pet/scripts/render_animation_previews.py +78 -78
  145. package/dist/vendor/hatch-pet/scripts/validate_atlas.py +157 -157
  146. package/package.json +25 -2
  147. package/dist/types/cli/handlers/settings-handler.d.ts +0 -19
  148. package/dist/types/cli/permission-rule-persistence.d.ts +0 -16
  149. package/dist/types/cli/tunable-store.d.ts +0 -26
  150. package/dist/types/skills/permissions/settings-watcher.d.ts +0 -26
  151. /package/dist/types/{skills/memory → host-contract}/fts-segment.d.ts +0 -0
@@ -2,7 +2,7 @@
2
2
  * Agent RPC Method Map — complete typed contract for ALL agent JSON-RPC methods.
3
3
  *
4
4
  * This extends GatewayRpcMethodMap (26 methods Gateway directly calls) with all
5
- * additional agent-specific methods (thread, memory, config, agents, solo, product, etc.).
5
+ * additional agent-specific methods (thread, memory, agents, solo, product, etc.).
6
6
  *
7
7
  * Consumers use this for fully typed RPC clients:
8
8
  * import type { AgentRpcMethodMap } from "qlogicagent/protocol";
@@ -375,22 +375,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
375
375
  }>;
376
376
  };
377
377
  };
378
- "config.get": {
379
- params: {
380
- keys?: string[];
381
- };
382
- result: {
383
- config: Record<string, unknown>;
384
- };
385
- };
386
- "config.update": {
387
- params: {
388
- updates: Record<string, unknown>;
389
- };
390
- result: {
391
- ok: boolean;
392
- };
393
- };
394
378
  "todos.list": {
395
379
  params: {
396
380
  sessionId?: string;
@@ -661,144 +645,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
661
645
  model?: string;
662
646
  };
663
647
  };
664
- "settings.listProviders": {
665
- params: undefined;
666
- result: {
667
- providers: Array<{
668
- id: string;
669
- displayName: string;
670
- baseUrl: string;
671
- modelCount: number;
672
- }>;
673
- };
674
- };
675
- "settings.addKey": {
676
- params: {
677
- providerId: string;
678
- key: string;
679
- label?: string;
680
- };
681
- result: {
682
- keyId: string;
683
- providerId: string;
684
- };
685
- };
686
- "settings.removeKey": {
687
- params: {
688
- keyId: string;
689
- };
690
- result: {
691
- ok: true;
692
- };
693
- };
694
- "settings.getKey": {
695
- params: {
696
- keyId: string;
697
- };
698
- result: {
699
- key: string;
700
- };
701
- };
702
- "settings.copyKey": {
703
- params: {
704
- keyId: string;
705
- };
706
- result: {
707
- ok: true;
708
- };
709
- };
710
- "settings.toggleKey": {
711
- params: {
712
- keyId: string;
713
- enabled: boolean;
714
- };
715
- result: {
716
- ok: true;
717
- };
718
- };
719
- "settings.toggleModel": {
720
- params: {
721
- modelId: string;
722
- enabled: boolean;
723
- purpose?: string;
724
- };
725
- result: {
726
- ok: true;
727
- };
728
- };
729
- "settings.listModels": {
730
- params: {
731
- purpose?: string;
732
- provider?: string;
733
- };
734
- result: {
735
- models: unknown[];
736
- grouped: Record<string, unknown[]>;
737
- };
738
- };
739
- "settings.setActiveModel": {
740
- params: {
741
- purpose: string;
742
- modelId: string;
743
- };
744
- result: {
745
- ok: true;
746
- };
747
- };
748
- "settings.getActiveModel": {
749
- params: {
750
- purpose: string;
751
- };
752
- result: {
753
- model: {
754
- id: string;
755
- provider: string;
756
- model: string;
757
- displayName: string;
758
- routeIntents: string[];
759
- capabilityProfile?: Record<string, unknown>;
760
- enabled: boolean;
761
- } | null;
762
- available: boolean;
763
- };
764
- };
765
- "settings.getOverview": {
766
- params: undefined;
767
- result: {
768
- providers: Array<{
769
- providerId: string;
770
- baseUrl?: string;
771
- keyCount: number;
772
- healthyKeys: number;
773
- totalKeys: number;
774
- }>;
775
- purposes: Record<string, {
776
- bound: boolean;
777
- modelId?: string;
778
- modelName?: string;
779
- available: boolean;
780
- }>;
781
- };
782
- };
783
- "settings.refreshModels": {
784
- params: undefined;
785
- result: {
786
- ok: true;
787
- catalogRefreshed?: boolean;
788
- };
789
- };
790
- "settings.validateKey": {
791
- params: {
792
- providerId: string;
793
- apiKey: string;
794
- baseUrl?: string;
795
- };
796
- result: {
797
- valid: boolean;
798
- status: number;
799
- error?: string;
800
- };
801
- };
802
648
  "provider.list": {
803
649
  params: undefined;
804
650
  result: {
@@ -816,24 +662,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
816
662
  }>;
817
663
  };
818
664
  };
819
- "config.tunables": {
820
- params: undefined;
821
- result: {
822
- defaults: Record<string, unknown>;
823
- overrides: Record<string, unknown>;
824
- };
825
- };
826
- "config.updateTunable": {
827
- params: {
828
- key: string;
829
- value?: unknown;
830
- };
831
- result: {
832
- ok: true;
833
- key: string;
834
- value: unknown;
835
- };
836
- };
837
665
  "community.resolveInstall": {
838
666
  params: {
839
667
  resourceId: string;
@@ -36,6 +36,12 @@ export interface ChatMessage {
36
36
  tool_call_id?: string;
37
37
  /** For tool result messages — tool name. */
38
38
  name?: string;
39
+ /** Tool-result error flag (AP2) — propagated so every transport can signal failure to the model. */
40
+ is_error?: boolean;
41
+ /** OpenAI-chat reasoning content (GLM/DeepSeek) carried across tool-call rounds on the assistant message. */
42
+ reasoning_content?: string;
43
+ /** Anthropic tool_reference metadata for tool_result blocks. */
44
+ toolReferences?: string[];
39
45
  /** Anthropic thinking blocks — must be passed back to API in subsequent requests. */
40
46
  thinkingBlocks?: ThinkingBlock[];
41
47
  /** Image URLs for vision-capable models. */
@@ -4,12 +4,12 @@
4
4
  * ALL configurable constants that external apps (Electron UI, CLI config)
5
5
  * may want to read or override are defined here. This enables:
6
6
  *
7
- * 1. A future `config.tunables` RPC endpoint for visual editing
7
+ * 1. Private X7 host profile tooling and local runtime consumers
8
8
  * 2. Serialization to JSON for persistence (settings.json)
9
9
  * 3. Environment variable overrides via QLOGICAGENT_* prefix
10
10
  *
11
11
  * Consumers import individual constants from this module.
12
- * The full shape is exported as `TunableDefaults` interface for RPC typing.
12
+ * The full shape is exported as `TunableDefaults` for the private host profile contract.
13
13
  *
14
14
  * Grouping follows subsystem boundaries.
15
15
  */
@@ -165,7 +165,7 @@ export declare const DREAM_COOLDOWN_MS = 14400000;
165
165
  export declare const DREAM_MAX_DURATION_MS = 300000;
166
166
  /**
167
167
  * Full typed shape of all tunable defaults.
168
- * Used by `config.tunables` RPC for external app visualization.
168
+ * Used by private X7 host profile tooling and local runtime consumers.
169
169
  */
170
170
  export interface TunableDefaults {
171
171
  maxRoundsLimit: number;
@@ -241,3 +241,13 @@ export interface TunableDefaults {
241
241
  * Use this for RPC serialization and external app display.
242
242
  */
243
243
  export declare function getTunableDefaults(): TunableDefaults;
244
+ export type TunableKey = keyof TunableDefaults;
245
+ /** Validate a tunable name against the one authoritative defaults table. */
246
+ export declare function validateTunableKey(key: string): string | null;
247
+ /**
248
+ * Validate an already-coerced update. Error text deliberately reports only the declared/received
249
+ * types and never interpolates the rejected value (some string tunables are credentials).
250
+ */
251
+ export declare function validateTunableUpdate(key: string, value: unknown): string | null;
252
+ /** Coerce a string toward a declared scalar type; unknown keys and unsafe numbers stay unchanged. */
253
+ export declare function coerceTunableValue(key: string, value: unknown): unknown;
@@ -212,8 +212,9 @@ export interface DreamRunDeps {
212
212
  feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
213
213
  affected: number;
214
214
  }>;
215
- /** Recent activity summary for temporal context injection into Dream. */
216
- getActivitySummary?(userId: string, days?: number): {
215
+ /** Recent activity summary for temporal context injection into Dream.
216
+ * B3(X7)异步化:16 host-state proxy 方法(host 模式经 x/host.request 跨进程) */
217
+ getActivitySummary?(userId: string, days?: number): Promise<{
217
218
  dailyCounts: Array<{
218
219
  date: string;
219
220
  count: number;
@@ -224,13 +225,13 @@ export interface DreamRunDeps {
224
225
  importance: number;
225
226
  date: string;
226
227
  }>;
227
- };
228
- /** Synthesize a timeline narrative for a time range. */
229
- synthesizeTimeline?(userId: string, startMs: number, endMs: number): string;
230
- /** Get/set user profile entries. */
228
+ }>;
229
+ /** Synthesize a timeline narrative for a time range. B3(X7)异步化。 */
230
+ synthesizeTimeline?(userId: string, startMs: number, endMs: number): Promise<string>;
231
+ /** Get/set user profile entries. B3(X7):setProfile/getAllProfiles 异步化(16 面);getProfile 面外保持同步。 */
231
232
  getProfile?(userId: string, key: string): string | null;
232
- setProfile?(userId: string, key: string, value: string): void;
233
- getAllProfiles?(userId: string): Record<string, string>;
233
+ setProfile?(userId: string, key: string, value: string): Promise<void>;
234
+ getAllProfiles?(userId: string): Promise<Record<string, string>>;
234
235
  /** Drain consolidation backlog: resolve conflicts + promote corroborated pending claims. */
235
236
  resolveConflicts?(userId: string, opts?: {
236
237
  minEvidenceToPromote?: number;
@@ -5,6 +5,7 @@
5
5
  * `<project>/.qlogicagent/` (project-level) must go through these
6
6
  * helpers so the dot-dir name is defined in exactly one place.
7
7
  */
8
+ export { deriveProjectId } from "../../host-contract/project-id.js";
8
9
  /** Dot-directory name used for both user-level and project-level storage. */
9
10
  export declare const AGENT_DOT_DIR = ".qlogicagent";
10
11
  /**
@@ -14,10 +15,9 @@ export declare const AGENT_DOT_DIR = ".qlogicagent";
14
15
  * keeps the id length-safe on Windows (260-char path limit) while staying collision-free in
15
16
  * practice. NOTE: deliberately NO ctime salt (VS Code salts single-folder ids so recreating a folder
16
17
  * yields fresh state — a footgun for us; we want a recreated/rebound folder to map back to its data).
17
- * This is a leaf helper (crypto + path only) so project-store and project-data-paths can both import
18
- * it without a dependency cycle.
18
+ * The implementation is owned by host-contract/project-id.ts so the shared contract remains a leaf;
19
+ * this module re-exports the same function for existing path-helper consumers.
19
20
  */
20
- export declare function deriveProjectId(workspaceDir: string): string;
21
21
  /** `~/.qlogicagent/` (or QLOGICAGENT_HOME override) */
22
22
  export declare function getUserAgentHome(): string;
23
23
  export declare function resolveActiveOwnerUserId(): string;
@@ -1,6 +1,6 @@
1
1
  import type { ToolCatalog } from "../ports/index.js";
2
2
  export declare const ASTRACLAW_CAPABILITIES_SERVER_NAME = "astraclaw_capabilities";
3
- export declare const ASTRACLAW_CAPABILITIES_SERVER_ALIASES: readonly ["astraclaw_capabilities", "astraclaw"];
3
+ export declare const ASTRACLAW_CAPABILITIES_RETIRED_SERVER_NAMES: readonly ["astraclaw"];
4
4
  export interface AstraClawCapabilityToolInput {
5
5
  tool: string;
6
6
  args: Record<string, unknown>;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * De-serialize Windows PowerShell 5.1 CLIXML noise back to readable text.
3
+ *
4
+ * When PS 5.1's stderr is a redirected pipe (a spawned child) and a native command writes to stderr —
5
+ * or PS itself raises Write-Error / throw — it appends a `#< CLIXML\n<Objs …>…</Objs>` block that
6
+ * serializes the error/progress streams. Left raw, the model sees XML garbage and assumes its output
7
+ * was "swallowed", then flails. This replaces each CLIXML block with the decoded human-readable
8
+ * strings (`<S>…</S>` — the error/warning text), dropping the `<Obj>` progress/type-name scaffolding.
9
+ * A native command's own stderr already appears RAW before the block, so this only RECOVERS the
10
+ * PowerShell-native errors that would otherwise live solely inside the CLIXML. Non-PowerShell output
11
+ * (no CLIXML marker) is returned unchanged, so it is safe to call on any exec output — bash included.
12
+ *
13
+ * Callers pass a COMPLETE snapshot of the output (a full stdout/stderr string or a whole-file read),
14
+ * never a mid-stream chunk: an incomplete `<Objs>` block would not match and would be left raw.
15
+ */
16
+ export declare function sanitizePowerShellClixml(text: string): string;
@@ -30,6 +30,24 @@ export interface ApprovalForwardDeps {
30
30
  sendNotification?: (method: string, params: Record<string, unknown>) => void;
31
31
  timeoutMs?: number;
32
32
  }
33
+ /**
34
+ * 激活层(S3c §1.1)delegate 路径的审批决议:输入是 SupervisorEventSink.onApprovalRequest 的已翻译
35
+ * 形状(toolName/options 已扁平,非 ACP 原始 session/request_permission params)。决议序与旧路径
36
+ * forwardExternalApproval 逐条对齐:①AstraClaw 只读能力自批 ②有交互上下文 → forward()发 UI 卡 +
37
+ * 同一 PENDING registry 等 agents.approvalResponse ③无上下文/超时 → reject 回退。返回最终 optionId
38
+ * (不透明,E2);调用方拿它走 x/delegate.respond(gateway 唯一应答口 respondApproval)。
39
+ */
40
+ export declare function decideExternalApproval(input: {
41
+ agentId: string;
42
+ approvalId: string;
43
+ toolName?: string;
44
+ options: Array<Record<string, unknown>>;
45
+ /** 有流式回合上下文(turnId 在)才值得转 UI 卡;否则直接回退 reject。 */
46
+ hasInteractiveContext: boolean;
47
+ /** 发 agents.prompt.approval UI 卡(形状归属调用方;只在需要用户决议时调用)。 */
48
+ forward: () => void;
49
+ timeoutMs?: number;
50
+ }): Promise<string>;
33
51
  /**
34
52
  * Drive one interactive approval for an external agent: forward the ACP session/request_permission
35
53
  * to the user (agents.prompt.approval), await the decision, and return the chosen optionId. Falls
@@ -1,4 +1,5 @@
1
1
  import type { FeedbackEvent } from "./feedback-event-store.js";
2
+ type DistillableFeedback = Pick<FeedbackEvent, "feedbackId" | "rating" | "reason" | "state" | "sessionId" | "turnId">;
2
3
  /** Minimum corroborating active events before a cluster becomes a proposal (mini-design §3.4). */
3
4
  export declare const MIN_EVIDENCE = 2;
4
5
  export interface FeedbackDistillationCandidate {
@@ -27,4 +28,5 @@ export interface FeedbackDistillationCandidate {
27
28
  * (retracted / replaced are filtered — §11.1). Clusters below MIN_EVIDENCE are dropped. Output is
28
29
  * sorted by clusterKey for deterministic ordering across runs.
29
30
  */
30
- export declare function distillFeedback(events: FeedbackEvent[]): FeedbackDistillationCandidate[];
31
+ export declare function distillFeedback(events: DistillableFeedback[]): FeedbackDistillationCandidate[];
32
+ export {};
@@ -0,0 +1,4 @@
1
+ import type { HostFeedbackClient } from "../../transport/host-feedback-client.js";
2
+ /** Process-lifetime binding installed by stdio-server after ACP initialize capability negotiation. */
3
+ export declare function configureHostFeedbackAuthority(resolver: () => HostFeedbackClient | undefined): void;
4
+ export declare function getHostFeedbackAuthority(): HostFeedbackClient | undefined;
@@ -1,5 +1,6 @@
1
1
  import type { ModelCapabilityProfile, ModelEntry, ModelPurpose, ModelRegistry, ReasoningMode } from "./model-registry.js";
2
2
  import type { ConfigPort } from "../ports/index.js";
3
+ import { type ProviderCatalogDef } from "../../host-contract/provider-profile.js";
3
4
  export declare const LLMROUTER_CATALOG_UNAVAILABLE_MESSAGE = "\u65E0\u6CD5\u8FDE\u63A5 llmrouter \u6A21\u578B\u76EE\u5F55";
4
5
  export declare const LLMROUTER_PROVIDER_ID = "llmrouter";
5
6
  export declare const LLMROUTER_PROVIDER_NAME = "LLMRouter";
@@ -19,19 +20,7 @@ export declare class LlmrouterAuthError extends Error {
19
20
  readonly status: number;
20
21
  constructor(status: number, message?: string);
21
22
  }
22
- export interface LlmrouterCatalogProvider {
23
- id: string;
24
- name?: string;
25
- displayName?: string;
26
- group?: string;
27
- baseUrl?: string;
28
- base_url?: string;
29
- transport?: string;
30
- authType?: string;
31
- apiKeyEnvVars?: string[];
32
- models?: Array<{
33
- id?: string;
34
- }>;
23
+ export interface LlmrouterCatalogProvider extends ProviderCatalogDef {
35
24
  }
36
25
  export interface LlmrouterCatalogModel {
37
26
  id: string;
@@ -1,7 +1,8 @@
1
+ import { MODEL_PURPOSES, type ModelPurpose } from "../../host-contract/index.js";
1
2
  import { type KeyConfig, type KeyHandle, type LoadBalanceStrategy, type PoolStatus, type ProviderPoolConfig } from "./key-pool.js";
2
3
  export type RegistryChangeCallback = () => void;
3
4
  export type ReasoningMode = "none" | "adaptive" | "collapsed" | "effort";
4
- export type ModelPurpose = "textGeneration" | "smallModel" | "stt" | "tts" | "imageGeneration" | "imageUnderstanding" | "videoGeneration" | "videoUnderstanding" | "threeDGeneration" | "embedding" | "voiceClone" | "musicGeneration" | "realtimeAudio" | "realtimeVideo";
5
+ export { MODEL_PURPOSES, type ModelPurpose };
5
6
  export interface ModelInfo {
6
7
  id: string;
7
8
  name?: string;
@@ -97,6 +98,7 @@ export interface ResolvedModel {
97
98
  baseUrl?: string;
98
99
  keyHandle: KeyHandle;
99
100
  }
101
+ /** @deprecated Use MODEL_PURPOSES; retained as a compatibility alias. */
100
102
  export declare const ALL_PURPOSES: ModelPurpose[];
101
103
  export declare class ModelRegistry {
102
104
  private keyPool;
@@ -0,0 +1,11 @@
1
+ /** Business mutations choose gateway X7 when negotiated, otherwise the standalone local store. */
2
+ import type { ProjectInfo, ProjectType } from "../../protocol/methods.js";
3
+ export declare function createProjectAuthoritative(params: {
4
+ name: string;
5
+ workspaceDir?: string;
6
+ type?: ProjectType;
7
+ groupId?: string;
8
+ skipAutoSwitch?: boolean;
9
+ }): Promise<ProjectInfo>;
10
+ export declare function updateProjectAuthoritative(projectId: string, patch: Partial<Pick<ProjectInfo, "planStatus" | "planAgents" | "planWinnerId" | "leaderSessionId" | "primaryWorkflowId">>): Promise<ProjectInfo | null>;
11
+ export declare function switchProjectAuthoritative(projectIdOrQuery: string): Promise<ProjectInfo | null>;
@@ -0,0 +1,10 @@
1
+ /** In-memory ExtHost-style project proxy. Durable registry bytes remain gateway-owned. */
2
+ import type { HostProjectInfo, HostProjectSnapshotResult } from "../../host-contract/index.js";
3
+ import type { HostProjectClient } from "../../transport/host-project-client.js";
4
+ export declare function configureHostProjectAuthority(resolver: () => HostProjectClient | undefined): void;
5
+ export declare function hasHostProjectAuthority(): boolean;
6
+ export declare function hydrateHostProjectSnapshot(): Promise<void>;
7
+ export declare function readHostProjectSnapshot(): HostProjectSnapshotResult | undefined;
8
+ export declare function createHostProject(params: Parameters<HostProjectClient["create"]>[0]): Promise<HostProjectInfo>;
9
+ export declare function switchHostProject(projectIdOrQuery: string): Promise<HostProjectInfo>;
10
+ export declare function updateHostProject(projectId: string, patch: Parameters<HostProjectClient["update"]>[1]): Promise<HostProjectInfo>;
@@ -64,7 +64,8 @@ export interface MemoryToolLocalProvider {
64
64
  category?: string;
65
65
  importance?: number;
66
66
  }): Promise<unknown>;
67
- synthesizeTimeline(userId: string, startMs: number, endMs: number): string;
67
+ /** B3(X7)异步化:16 host-state proxy 方法(host 模式经 x/host.request 跨进程) */
68
+ synthesizeTimeline(userId: string, startMs: number, endMs: number): Promise<string>;
68
69
  feedback(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
69
70
  affected: number;
70
71
  }>;
@@ -124,8 +125,10 @@ export interface MemoryUpdatePatch {
124
125
  tags?: string[];
125
126
  }
126
127
  export interface MemoryHandlerProvider extends MemoryProvider {
127
- getAtlas?(userId: string, options?: Record<string, unknown>): MemoryAtlasResult;
128
- getActivitySummary?(userId: string, days: number): MemoryActivitySummary;
128
+ /** B3(X7)异步化:16 host-state proxy 方法(host 模式经 x/host.request 跨进程) */
129
+ getAtlas?(userId: string, options?: Record<string, unknown>): Promise<MemoryAtlasResult>;
130
+ /** B3(X7)异步化:16 面 host-state proxy 方法。 */
131
+ getActivitySummary?(userId: string, days: number): Promise<MemoryActivitySummary>;
129
132
  observeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
130
133
  proposeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
131
134
  ingestExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
@@ -188,11 +191,12 @@ export interface MemoryDreamProvider {
188
191
  feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"): Promise<{
189
192
  affected: number;
190
193
  }>;
191
- getActivitySummary?(userId: string, days?: number): MemoryActivitySummary;
192
- synthesizeTimeline?(userId: string, startMs: number, endMs: number): string;
194
+ /** B3(X7)异步化:以下四个 16 host-state proxy 方法签名统一 Promise(host 模式经 x/host.request 跨进程) */
195
+ getActivitySummary?(userId: string, days?: number): Promise<MemoryActivitySummary>;
196
+ synthesizeTimeline?(userId: string, startMs: number, endMs: number): Promise<string>;
193
197
  getProfile?(userId: string, key: string): string | null;
194
- setProfile?(userId: string, key: string, value: string): void;
195
- getAllProfiles?(userId: string): Record<string, string>;
198
+ setProfile?(userId: string, key: string, value: string): Promise<void>;
199
+ getAllProfiles?(userId: string): Promise<Record<string, string>>;
196
200
  }
197
201
  export interface MemoryDecayProvider {
198
202
  triggerDecay(userId: string): Promise<{
@@ -67,6 +67,8 @@ export interface ToolBootstrapConfig {
67
67
  getCurrentTurnId?(): string | undefined;
68
68
  sendNotification?(method: string, params: Record<string, unknown>): void;
69
69
  onExecProgress?(progress: ToolBootstrapProgress): void;
70
+ /** Lazy host-owned tunable overrides; web registration must not call it until first invoke. */
71
+ loadTunableOverrides?(): Promise<Record<string, unknown>>;
70
72
  }
71
73
  export interface ToolBootstrap {
72
74
  getAllBaseTools(config?: ToolBootstrapConfig): RuntimeToolContract[];
@@ -11,8 +11,8 @@ export interface ToolNameLike {
11
11
  }
12
12
  export interface FreshWorkspaceEvidencePolicy {
13
13
  requiresFreshTool: boolean;
14
- reason?: "file-read" | "memory-mutation" | "media-generation" | "directory-list" | "content-search" | "shell" | "web";
15
- mediaKind?: "image" | "tts" | "music";
14
+ reason?: "file-read" | "memory-mutation" | "media-generation" | "media-understanding" | "directory-list" | "content-search" | "shell" | "web";
15
+ mediaKind?: "image" | "video" | "tts" | "music";
16
16
  allowedToolNames: string[];
17
17
  }
18
18
  export declare function getFreshWorkspaceEvidencePolicy(messages: readonly PromptMessageLike[] | string): FreshWorkspaceEvidencePolicy;
@@ -1,6 +1,18 @@
1
1
  import type { SessionListEntry } from "./session-types.js";
2
2
  export declare function listSessions(limit: number | undefined, projectRoot: string): Promise<SessionListEntry[]>;
3
3
  export declare function deleteSession(sessionId: string, projectRoot: string): Promise<void>;
4
+ /**
5
+ * Authoritative "already ours" id set for the lazy-migration discovery scan: every session id and
6
+ * bound native id recorded for `agentId` in this project — including ARCHIVED records, which the
7
+ * list pipeline filters out of its window.
8
+ *
9
+ * listSessions' windowed result must NOT be used for discovery dedup: it truncates (limit) and
10
+ * post-filters (archived), so an adopted session pushed out of the window would be "re-discovered"
11
+ * as a second entry — and a resume on that duplicate would fork a second canonical record for the
12
+ * same native conversation. This enumerates metadata.json only (no transcript counting), and
13
+ * callers only pay for it when the scan actually yielded candidates.
14
+ */
15
+ export declare function collectAdoptedNativeIds(agentId: string, projectRoot: string): Promise<Set<string>>;
4
16
  /**
5
17
  * ⚠️ Destructive cascade with NO user-visible confirmation: every pruned session goes through
6
18
  * deleteSession, which permanently removes its transcript + metadata + checkpoints + uploads.
@@ -1,16 +1,35 @@
1
1
  /**
2
- * Compatibility facade for session persistence.
2
+ * Session persistence authority facade.
3
3
  *
4
- * The implementation lives in focused modules:
5
- * - session-transcript-store.ts: append-only transcript JSONL
6
- * - session-metadata-store.ts: metadata schema, migration, atomic writes
7
- * - session-resume.ts: resume assembly
8
- * - session-catalog.ts: list/delete/prune
9
- * - session-summary.ts: title and task-summary generation
4
+ * When gateway advertises Session X7, durable reads/writes go through HostSessionClient. Without
5
+ * that capability (gate-off/tests/standalone), the legacy local implementation remains the inert
6
+ * compatibility path. A single call never writes both stores.
10
7
  */
11
- export { appendMessage } from "./session-transcript-store.js";
12
- export { getSessionMetadata, readSessionMetadata, saveSessionState, updateSessionMetadata, } from "./session-metadata-store.js";
13
- export { loadSessionForResume } from "./session-resume.js";
14
- export { deleteSession, listSessions, pruneOldSessions } from "./session-catalog.js";
8
+ import type { ChatMessage } from "../../protocol/wire/index.js";
9
+ import type { HostSessionClient } from "../../transport/host-session-client.js";
10
+ import { type AppendMessageOutcome } from "./session-transcript-store.js";
11
+ import { getSessionMetadata, readSessionMetadata } from "./session-metadata-store.js";
12
+ import type { MessageDisplayMetadata, PersistedSession, SessionMetadataPatch, SessionStateSaveMetadata, SessionUsageSnapshot, TokenUsage } from "./session-types.js";
13
+ export declare function configureHostSessionPersistence(resolver: () => HostSessionClient | undefined): void;
14
+ export declare function isHostSessionPersistenceActive(): boolean;
15
+ export declare function requestHostGroupSplit(sessionId: string, operationId: string, reason: "idle" | "turn-limit", cas?: {
16
+ expectedLastActiveAt?: string;
17
+ expectedTurnCount?: number;
18
+ }): Promise<{
19
+ status: "updated" | "duplicate" | "session-deleted";
20
+ nextSessionId?: string;
21
+ } | undefined>;
22
+ export declare function appendMessage(sessionId: string, message: ChatMessage, projectRoot: string, turnId?: string, metadata?: {
23
+ usage?: TokenUsage;
24
+ displayMetadata?: MessageDisplayMetadata;
25
+ }): Promise<AppendMessageOutcome>;
26
+ export declare function waitForSessionPersistenceAppends(sessionId: string, projectRoot: string): Promise<void>;
27
+ export declare function loadSessionForResume(sessionId: string, projectRoot: string, options?: {
28
+ includeDisplayMetadata?: boolean;
29
+ }): Promise<PersistedSession | null>;
30
+ export declare function saveSessionState(sessionId: string, usageSnapshot: SessionUsageSnapshot, metadata: SessionStateSaveMetadata, projectRoot: string): Promise<void>;
31
+ export declare function updateSessionMetadata(sessionId: string, patch: SessionMetadataPatch, projectRoot: string): Promise<import("./session-types.js").SessionMetadata | null>;
32
+ export { getSessionMetadata, readSessionMetadata };
33
+ export { collectAdoptedNativeIds, deleteSession, listSessions, pruneOldSessions } from "./session-catalog.js";
15
34
  export { generateSessionTitle, maybeGenerateTaskSummary, shouldGenerateTaskSummary, } from "./session-summary.js";
16
35
  export { SESSION_SCHEMA_VERSION, type MessageDisplayMetadata, type PersistedChatMessage, type PersistedSession, type SessionListEntry, type SessionMetadata, type TaskSummaryDeps, } from "./session-types.js";
@@ -38,6 +38,8 @@ export declare function enumerateSessionMetadataFiles(): Promise<SessionMetaLoca
38
38
  * 直接原子改写 metadata.json(不经 updateSessionMetadata 的 projectRoot 解析)。返回清理数。
39
39
  */
40
40
  export declare function clearAllInflightMarkers(): Promise<number>;
41
+ /** 读同目录 transcript.jsonl 最后一条 assistant 消息的 ts(毫秒)。无则 null。 */
42
+ declare function readLastAssistantTs(metadataPath: string): Promise<number | null>;
41
43
  export interface CrashedTurnInfo {
42
44
  sessionId: string;
43
45
  turnId: string;
@@ -55,4 +57,6 @@ export interface CrashedTurnInfo {
55
57
  * - 否则:保留标记 + 递增中断计数,收进待恢复列表(交给 UI 让用户手动续)。
56
58
  */
57
59
  export declare function scanForCrashedTurns(): Promise<CrashedTurnInfo[]>;
60
+ /** Test-only escape hatch: readLastAssistantTs is otherwise module-private (Cut 5.2). */
61
+ export declare const __test_readLastAssistantTs: typeof readLastAssistantTs;
58
62
  export {};
@@ -2,4 +2,6 @@ import type { ChatMessage } from "../../protocol/wire/index.js";
2
2
  import type { SessionMetadata, TaskSummaryDeps } from "./session-types.js";
3
3
  export declare function shouldGenerateTaskSummary(metadata: SessionMetadata): boolean;
4
4
  export declare function generateSessionTitle(userMessage: string, deps: TaskSummaryDeps): Promise<string | null>;
5
- export declare function maybeGenerateTaskSummary(sessionId: string, metadata: SessionMetadata, recentMessages: ChatMessage[], deps: TaskSummaryDeps, projectRoot: string): Promise<string | null>;
5
+ export declare function maybeGenerateTaskSummary(sessionId: string, metadata: SessionMetadata, recentMessages: ChatMessage[], deps: TaskSummaryDeps, projectRoot: string, persist?: (summary: string, generatedAtTurn: number) => Promise<void>): Promise<string | null>;
6
+ declare function buildDigestContext(recentMessages: ChatMessage[]): string;
7
+ export { buildDigestContext as __test_buildDigestContext };
@@ -17,6 +17,13 @@ export declare function appendMessage(sessionId: string, message: ChatMessage, p
17
17
  usage?: TokenUsage;
18
18
  displayMetadata?: MessageDisplayMetadata;
19
19
  }): Promise<AppendMessageOutcome>;
20
+ /**
21
+ * Public drain: await all queued transcript appends for one session to hit disk. Wraps the
22
+ * composite-key `waitForTranscriptAppends` (the queue is keyed by projectRoot+sessionId, not
23
+ * sessionId alone). Call before a process kill / cold-restart test — reading the file does NOT
24
+ * flush a same-process fire-and-forget tail (Cut 8).
25
+ */
26
+ export declare function waitForSessionTranscriptAppends(sessionId: string, projectRoot: string): Promise<void>;
20
27
  export declare function countTranscriptMessages(sessionId: string, projectRoot: string): Promise<number | null>;
21
28
  export declare function loadTranscript(sessionId: string, projectRoot: string, options?: {
22
29
  includeDisplayMetadata?: boolean;