qlogicagent 2.18.2 → 2.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/agent.js +38 -24
  2. package/dist/cli.js +1 -1
  3. package/dist/index.js +553 -485
  4. package/dist/orchestration.js +11 -11
  5. package/dist/protocol.js +1 -1
  6. package/dist/skills/mcp/astraclaw-native-mcp-server.js +8 -6
  7. package/dist/types/agent/memory-recall-injection.d.ts +2 -1
  8. package/dist/types/agent/tool-loop/budget-continuation-policy.d.ts +4 -0
  9. package/dist/types/agent/tool-loop/completion-action-policy.d.ts +9 -1
  10. package/dist/types/cli/credential-vault.d.ts +6 -0
  11. package/dist/types/cli/handlers/community-handler.d.ts +1 -2
  12. package/dist/types/cli/handlers/memory-handler.d.ts +7 -0
  13. package/dist/types/cli/handlers/turn-handler.d.ts +50 -1
  14. package/dist/types/cli/memory-coordinator.d.ts +4 -0
  15. package/dist/types/cli/pet-runtime.d.ts +2 -0
  16. package/dist/types/cli/rpc-registry.d.ts +11 -0
  17. package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
  18. package/dist/types/cli/skill-tools-bootstrap.d.ts +5 -0
  19. package/dist/types/cli/stdio-acp-request-host.d.ts +2 -1
  20. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -0
  21. package/dist/types/cli/stdio-server.d.ts +4 -0
  22. package/dist/types/cli/task-distillation-coordinator.d.ts +79 -0
  23. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +24 -0
  24. package/dist/types/cli/turn-core.d.ts +0 -6
  25. package/dist/types/cli/turn-project-router.d.ts +9 -0
  26. package/dist/types/contracts/hooks.d.ts +3 -0
  27. package/dist/types/contracts/turn-event.d.ts +8 -4
  28. package/dist/types/orchestration/agent-instance.d.ts +4 -0
  29. package/dist/types/orchestration/context/reactive-compact.d.ts +4 -6
  30. package/dist/types/orchestration/error-handling/retry-loop.d.ts +0 -22
  31. package/dist/types/orchestration/goal-loop-coordinator.d.ts +6 -0
  32. package/dist/types/orchestration/goal-mode-adapters.d.ts +20 -1
  33. package/dist/types/orchestration/goal-run-types.d.ts +10 -0
  34. package/dist/types/orchestration/skill-improvement.d.ts +7 -2
  35. package/dist/types/orchestration/workflow/run-history-store.d.ts +2 -0
  36. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +8 -0
  37. package/dist/types/protocol/methods.d.ts +0 -26
  38. package/dist/types/protocol/wire/acp-agent-management.d.ts +3 -0
  39. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  40. package/dist/types/protocol/wire/agent-methods.d.ts +0 -11
  41. package/dist/types/protocol/wire/gateway-rpc.d.ts +1 -0
  42. package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +3 -0
  43. package/dist/types/protocol/wire/notification-payloads.d.ts +27 -0
  44. package/dist/types/runtime/community/community-consent-client.d.ts +0 -21
  45. package/dist/types/runtime/config/tunable-defaults.d.ts +6 -0
  46. package/dist/types/runtime/execution/memory-decay.d.ts +5 -1
  47. package/dist/types/runtime/hooks/context-compression.d.ts +5 -0
  48. package/dist/types/runtime/hooks/memory-hooks.d.ts +16 -0
  49. package/dist/types/runtime/infra/acp-detector.d.ts +8 -0
  50. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +10 -0
  51. package/dist/types/runtime/infra/agent-paths.d.ts +9 -7
  52. package/dist/types/runtime/infra/agent-process.d.ts +6 -0
  53. package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +9 -6
  54. package/dist/types/runtime/infra/checkpoint-backend.d.ts +1 -1
  55. package/dist/types/runtime/infra/migrate-device-scope.d.ts +49 -0
  56. package/dist/types/runtime/infra/project-data-paths.d.ts +4 -3
  57. package/dist/types/runtime/infra/project-skill-manifest.d.ts +3 -2
  58. package/dist/types/runtime/infra/working-materials-store.d.ts +8 -14
  59. package/dist/types/runtime/pet/pet-profile-service.d.ts +7 -0
  60. package/dist/types/runtime/pet/petdex-forge-service.d.ts +3 -1
  61. package/dist/types/runtime/ports/memory-provider.d.ts +23 -0
  62. package/dist/types/runtime/ports/project-memory-store.d.ts +2 -0
  63. package/dist/types/runtime/prompt/environment-context.d.ts +15 -3
  64. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +7 -0
  65. package/dist/types/runtime/prompt/instruction-loader.d.ts +0 -1
  66. package/dist/types/runtime/session/inbound-upload-persistence.d.ts +4 -0
  67. package/dist/types/runtime/session/session-catalog.d.ts +8 -0
  68. package/dist/types/runtime/session/session-resume.d.ts +5 -0
  69. package/dist/types/runtime/session/session-transcript-store.d.ts +8 -1
  70. package/dist/types/skills/mcp/mcp-manager.d.ts +25 -1
  71. package/dist/types/skills/memory/fts-segment.d.ts +20 -0
  72. package/dist/types/skills/memory/local-memory-provider.d.ts +66 -4
  73. package/dist/types/skills/memory/local-store-records.d.ts +6 -1
  74. package/dist/types/skills/memory/local-store.d.ts +63 -10
  75. package/dist/types/skills/memory/memdir.d.ts +17 -4
  76. package/dist/types/skills/memory/memory-consolidation.d.ts +7 -0
  77. package/dist/types/skills/memory/proposal-consumer.d.ts +51 -0
  78. package/dist/types/skills/memory/sqlite-memory-mappers.d.ts +2 -1
  79. package/dist/types/skills/memory/sqlite-memory-schema.d.ts +9 -1
  80. package/dist/types/skills/memory/task-distillation.d.ts +148 -0
  81. package/dist/types/skills/tools/search-tool.d.ts +6 -0
  82. package/dist/types/skills/tools/shell/task-output.d.ts +2 -0
  83. package/package.json +3 -2
  84. package/dist/types/agent/tool-loop/skill-instruction-policy.d.ts +0 -7
  85. package/dist/types/agent/tool-loop/tool-guardrails.d.ts +0 -24
  86. package/dist/types/cli/tool-bootstrap-community-registration.d.ts +0 -9
  87. package/dist/types/cli/turn-skill-autopersist.d.ts +0 -22
  88. package/dist/types/runtime/community/community-discovery-cache.d.ts +0 -24
  89. package/dist/types/runtime/community/community-discovery-coordinator.d.ts +0 -33
  90. package/dist/types/runtime/hooks/community-discovery-hook.d.ts +0 -18
  91. package/dist/types/skills/tools/community-seek-tool.d.ts +0 -49
@@ -59,6 +59,9 @@ export interface NodeRunStats {
59
59
  cacheHit: boolean;
60
60
  /** Final per-node disposition (errorPort/continue keep the run alive but mark failed). */
61
61
  status: "completed" | "failed";
62
+ /** Engine-imposed limit surfaced on this node (e.g. a loop forced out at its iteration cap) —
63
+ * rendered into the run history so caps are visible in the run record, never silent. */
64
+ warning?: string;
62
65
  }
63
66
  export interface RunResult {
64
67
  status: "completed" | "failed" | "paused";
@@ -156,6 +159,11 @@ export declare class WorkflowRuntime {
156
159
  /** Loop entry: fire the "loop" port once to kick the first iteration. */
157
160
  private enterLoop;
158
161
  private decideLoopBack;
162
+ /** A loop forced out at its maxIterations cap (the scheduler marks error="loop_cap_reached:N",
163
+ * which previously had NO consumer — the run just took the "done" port as if the loop finished
164
+ * naturally). Surface it as a node-level warning: a warn log line + a trace entry the run history
165
+ * renders (run-history-store.buildNodeRecords), so the engine-imposed cap is visible in the record. */
166
+ private surfaceLoopCap;
159
167
  /** Loop again? No condition → loop until the scheduler's maxIterations cap. */
160
168
  private evalLoopCondition;
161
169
  /** Collect inputs for a node from completed upstream outputs along forward data edges. */
@@ -342,28 +342,6 @@ export interface ConfigUpdateResult {
342
342
  reason: string;
343
343
  }>;
344
344
  }
345
- export interface CommunityMatchRegistryParams {
346
- intent: string;
347
- topK?: 1 | 2 | 3;
348
- preferOfficial?: boolean;
349
- }
350
- export interface CommunityRegistryMatchResult {
351
- id: string;
352
- type: string;
353
- title: string;
354
- summary: string;
355
- capabilityTags: string[];
356
- sourceTier: CommunityInstallSourceTier;
357
- trustStage: CommunityInstallTrustStage;
358
- resourceRiskTier: CommunityInstallRiskTier;
359
- effectiveRiskTier: CommunityInstallRiskTier;
360
- latestVersion: string | null;
361
- canonical: true;
362
- }
363
- export interface CommunityMatchRegistryResult {
364
- ok: boolean;
365
- matches: CommunityRegistryMatchResult[];
366
- }
367
345
  export type CommunityInstallRiskTier = "R0" | "R1" | "R2" | "R3";
368
346
  export type CommunityInstallSourceTier = "official" | "community";
369
347
  export type CommunityInstallTrustStage = "quarantine" | "trial" | "trusted";
@@ -660,10 +638,6 @@ export interface RpcMethodMap {
660
638
  params: ConfigUpdateParams;
661
639
  result: ConfigUpdateResult;
662
640
  };
663
- "community.matchRegistry": {
664
- params: CommunityMatchRegistryParams;
665
- result: CommunityMatchRegistryResult;
666
- };
667
641
  "community.resolveInstall": {
668
642
  params: CommunityResolveInstallParams;
669
643
  result: CommunityResolveInstallResult;
@@ -243,6 +243,9 @@ export interface SoloSpecJudgeParams {
243
243
  export interface SoloSpecJudgeResult {
244
244
  ok: boolean;
245
245
  issues: string[];
246
+ /** True when ok=true came from a SKIPPED judgement (no LLM / judge call failed) — an unjudged
247
+ * soft-gate pass, not a real "spec reviewed OK". Fail-open stays, but honestly labeled. */
248
+ judgeSkipped?: boolean;
246
249
  }
247
250
  /** x/workflow.chat RPC params(M4 自动化页对话式搭图/改图)。history 含到本轮的完整对话;
248
251
  * currentWorkflow 为已有图的渲染文本(改图上下文,前端从 store 提供)。 */
@@ -13,7 +13,7 @@
13
13
  * Turn-lifecycle events relayed to the Control UI WebSocket.
14
14
  * These are the "chat session" events that every UI client needs.
15
15
  */
16
- export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut"];
16
+ export declare const AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "turn.memory_recall", "turn.memory_written", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut"];
17
17
  /**
18
18
  * Agent Team events (Solo Mode, Product Mode, Plan lifecycle).
19
19
  * Relayed to the UI's team/orchestration panel.
@@ -23,7 +23,7 @@ export declare const AGENT_TEAM_WS_EVENT_NAMES: readonly ["solo.progress", "solo
23
23
  * All agent notifications that Gateway should relay to WS clients.
24
24
  * Union of session events + team events.
25
25
  */
26
- export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut", "solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted", "goal.run_state_changed", "goal.phase_boundary", "goal.goal_edited", "goal.message_queued", "goal.acceptance_updated"];
26
+ export declare const ALL_AGENT_WS_EVENT_NAMES: readonly ["turn.start", "turn.delta", "turn.end", "turn.error", "turn.recovery", "turn.file_changes", "turn.tool_call", "turn.tool_result", "turn.tool_blocked", "turn.reasoning_delta", "turn.approval_request", "turn.skill_instruction", "turn.ask_user", "turn.media_result", "turn.media_progress", "turn.media_usage", "turn.media_capability_check", "turn.plan_update", "turn.suggestions", "turn.sidechain_started", "turn.subagent_started", "turn.subagent_delta", "turn.subagent_ended", "turn.sidechain_completed", "turn.task_updated", "turn.todos_updated", "turn.exec_progress", "turn.progress", "turn.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "session.recovery_pending", "memory.updated", "skills.updated", "turn.memory_recall", "turn.memory_written", "pet.soul_ready", "pet.reaction", "pet.growth", "pet.state", "pet.confirm", "pet.asset.updated", "system.activity", "workflow.created", "workflow.updated", "workflow.deleted", "workflow.runStarted", "workflow.runCompleted", "workflow.runFailed", "workflow.nodeStatus", "workflow.triggerDropped", "workflow.alert", "workflow.approvalRequested", "workflow.approvalTimedOut", "solo.progress", "solo.specProgress", "solo.agentDelta", "solo.agentActivity", "solo.agentUsage", "solo.evaluation", "product.taskStarted", "product.taskOutput", "product.members", "product.agentActivity", "product.taskCompleted", "product.taskFailed", "product.budgetUpdate", "product.budgetWarning", "product.checkpointed", "product.completed", "product.dagTopology", "plan.interrupted", "goal.run_state_changed", "goal.phase_boundary", "goal.goal_edited", "goal.message_queued", "goal.acceptance_updated"];
27
27
  /** Type-level event name for session events. */
28
28
  export type AgentWsEventName = (typeof AGENT_WS_EVENT_NAMES)[number];
29
29
  /** Type-level event name for team events. */
@@ -835,17 +835,6 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
835
835
  value: unknown;
836
836
  };
837
837
  };
838
- "community.matchRegistry": {
839
- params: {
840
- intent: string;
841
- topK?: 1 | 2 | 3;
842
- preferOfficial?: boolean;
843
- };
844
- result: {
845
- ok: boolean;
846
- matches: Array<Record<string, unknown>>;
847
- };
848
- };
849
838
  "community.resolveInstall": {
850
839
  params: {
851
840
  resourceId: string;
@@ -115,6 +115,7 @@ export interface GatewayRpcMethodMap {
115
115
  limit?: number;
116
116
  projectId?: string;
117
117
  archived?: boolean;
118
+ agentId?: string;
118
119
  };
119
120
  result: {
120
121
  sessions: Array<{
@@ -58,6 +58,9 @@ export interface MemorySearchOptions {
58
58
  llmConfig?: MemoryLlmConfig;
59
59
  /** Categories to boost during reranking (e.g. ["lesson", "preference"]). */
60
60
  preferredCategories?: string[];
61
+ /** Drop hits whose tags contain ALL strings of any group (resident-layer exclusion:
62
+ * entries already injected verbatim via the global INDEX must not be recalled again). */
63
+ excludeTagGroups?: string[][];
61
64
  }
62
65
  export interface MemoryIngestOptions {
63
66
  llmConfig?: MemoryLlmConfig;
@@ -163,6 +163,22 @@ export interface TurnSuggestionsNotification {
163
163
  action?: string;
164
164
  }>;
165
165
  }
166
+ /** Memory recall visibility (Part B): fired when turn-time recall injected memories,
167
+ * so the UI can render a "based on N memories" disclosure row (recall was invisible before). */
168
+ export interface TurnMemoryRecallNotification {
169
+ sessionId: string;
170
+ turnId: string;
171
+ count: number;
172
+ /** Truncated texts of the memories actually injected (post-cap), for the expanded list. */
173
+ titles: string[];
174
+ }
175
+ /** Memory write visibility (Part B): fired on the synchronous agent-remember tool path.
176
+ * Dream/async consolidation deliberately does NOT emit this (it surfaces via next-turn recall). */
177
+ export interface TurnMemoryWrittenNotification {
178
+ items: Array<{
179
+ title: string;
180
+ }>;
181
+ }
166
182
  /** Sidechain started execution. */
167
183
  export interface TurnSidechainStartedNotification {
168
184
  turnId: string;
@@ -250,6 +266,15 @@ export interface TurnMediaPersistedNotification {
250
266
  bytes: number;
251
267
  mimeType: string;
252
268
  }>;
269
+ /**
270
+ * URLs that FAILED to persist locally this turn (result keeps the remote URL / dangling temp
271
+ * path, which may expire). Present only when at least one file failed — persistence stays
272
+ * fail-open, but the degradation is surfaced instead of silently swallowed.
273
+ */
274
+ failures?: Array<{
275
+ remoteUrl: string;
276
+ error?: string;
277
+ }>;
253
278
  }
254
279
  /** Task state change. */
255
280
  export interface TurnTaskUpdatedNotification {
@@ -1011,6 +1036,8 @@ export interface NotificationMethodMap {
1011
1036
  "turn.reasoning_delta": TurnReasoningDeltaNotification;
1012
1037
  "turn.plan_update": TurnPlanUpdateNotification;
1013
1038
  "turn.suggestions": TurnSuggestionsNotification;
1039
+ "turn.memory_recall": TurnMemoryRecallNotification;
1040
+ "turn.memory_written": TurnMemoryWrittenNotification;
1014
1041
  "turn.sidechain_started": TurnSidechainStartedNotification;
1015
1042
  "turn.subagent_delta": TurnSubagentDeltaNotification;
1016
1043
  "turn.sidechain_completed": TurnSidechainCompletedNotification;
@@ -7,26 +7,6 @@ export interface CommunityRuntimeResolution {
7
7
  checksum: string;
8
8
  sizeBytes: number;
9
9
  }
10
- export interface CommunityRegistryMatchInput {
11
- intent: string;
12
- topK?: number;
13
- preferOfficial?: boolean;
14
- }
15
- export interface CommunityRegistryMatchResult {
16
- id: string;
17
- type: string;
18
- title: string;
19
- summary: string;
20
- /** RESOURCE_CATEGORIES key(search 表演锚点;hub match 返回 ResourceView.category)。 */
21
- category: string | null;
22
- capabilityTags: string[];
23
- sourceTier: CommunityInstallSourceTier;
24
- trustStage: CommunityInstallTrustStage;
25
- resourceRiskTier: CommunityInstallRiskTier;
26
- effectiveRiskTier: CommunityInstallRiskTier;
27
- latestVersion: string | null;
28
- canonical: true;
29
- }
30
10
  export type CommunityInstallRiskTier = "R0" | "R1" | "R2" | "R3";
31
11
  export type CommunityInstallSourceTier = "official" | "community";
32
12
  export type CommunityInstallTrustStage = "quarantine" | "trial" | "trusted";
@@ -71,7 +51,6 @@ export interface CommunityConsentClientOptions {
71
51
  clientVersion?: string;
72
52
  }
73
53
  export interface CommunityConsentClient {
74
- matchRegistry(input: CommunityRegistryMatchInput): Promise<CommunityRegistryMatchResult[]>;
75
54
  resolveInstall(resourceId: string, version?: string): Promise<CommunityInstallResolution>;
76
55
  /** List a resource's published versions for the version/rollback menu (WS-B3). The
77
56
  * default client always implements it; optional so lightweight mocks may omit it. */
@@ -143,6 +143,12 @@ export declare const TASK_PANEL_GRACE_MS = 30000;
143
143
  export declare const MEMORY_PREFETCH_MAX_SESSION_BYTES: number;
144
144
  /** Max results per memory recall query. */
145
145
  export declare const MEMORY_PREFETCH_LIMIT_PER_RECALL = 10;
146
+ /** Min hybrid score for recall injection. The old 0.1 default was a no-op filter —
147
+ * top-10 got injected wholesale and weak matches crowded the per-turn byte budget. */
148
+ export declare const MEMORY_RECALL_MIN_SCORE = 0.35;
149
+ /** Adaptive cliff cutoff: stop taking results when the next score drops by more than
150
+ * this ratio vs the previous one (2 relevant hits -> inject 2, don't pad to 10). */
151
+ export declare const MEMORY_RECALL_CLIFF_RATIO = 0.4;
146
152
  /** LRU dedup set size for surfaced memory entries. */
147
153
  export declare const MEMORY_MAX_SURFACED_ENTRIES = 100;
148
154
  /** Min hours between dream consolidation runs. */
@@ -49,8 +49,12 @@ export interface DecayCycleDeps {
49
49
  };
50
50
  }
51
51
  export interface DecayCycleResult {
52
- /** Whether decay actually ran (false = skipped by gate). */
52
+ /** Whether decay actually ran (false = skipped by gate OR failed — see `failed`). */
53
53
  ran: boolean;
54
+ /** True when the cycle was ATTEMPTED and errored — distinguishes a failure from a cooldown skip. */
55
+ failed?: boolean;
56
+ /** Failure reason, present when failed=true. */
57
+ error?: string;
54
58
  /** Number of memories whose importance was reduced. */
55
59
  decayed: number;
56
60
  /** Number of memories archived (below threshold). */
@@ -8,6 +8,11 @@ export declare function estimateTokens(msg: CompressibleMessage): number;
8
8
  export declare function estimateTotalTokens(messages: CompressibleMessage[]): number;
9
9
  export declare function getCompressionMetrics(): import("../context/context-compression-strategies.js").CompressionMetricsSnapshot;
10
10
  export declare function getContextEngineRegistry(): ContextEngineRegistry;
11
+ /**
12
+ * Prefixed onto the sync fallback when the LLM summarize call failed — the model
13
+ * (and anyone reading the compressed history) must know this stretch is low-fidelity.
14
+ */
15
+ export declare const DEGRADED_SUMMARY_MARKER = "[summary degraded: LLM summarization failed]";
11
16
  /**
12
17
  * Create a summarization callback using an injected LLM transport.
13
18
  * For CLI mode: uses the same transport that powers the agent loop.
@@ -7,6 +7,12 @@ export declare const MEMORY_PREFETCH_CONFIG: {
7
7
  readonly LIMIT_PER_RECALL: 10;
8
8
  readonly MAX_SURFACED_ENTRIES: 100;
9
9
  };
10
+ /**
11
+ * Fallback for hosts that don't inject deps.procedureTag. MUST stay equal to
12
+ * skills/memory/task-distillation PROCEDURE_TAG (runtime cannot import skills
13
+ * per the architecture boundary; task-distillation.test.ts asserts equality).
14
+ */
15
+ export declare const PROCEDURE_TAG_FALLBACK = "distilled@v1";
10
16
  export interface MemoryHooksDeps {
11
17
  /** QMemory adapter (MemoryProvider with search/health). */
12
18
  memoryProvider?: MemoryProvider;
@@ -25,6 +31,16 @@ export interface MemoryHooksDeps {
25
31
  getLastAssistantMessage?: () => string | undefined;
26
32
  /** Background LLM for implicit extraction. If provided, enables Layer 2. */
27
33
  llmExtract?: (prompt: string) => Promise<string | null>;
34
+ /** Part B write visibility: forwards turn.memory_written on auto-extract commits. */
35
+ sendNotification?: (method: string, params: Record<string, unknown>) => void;
36
+ /** V3.2 usage 仪表:procedure 复用的 session 维度与负反馈计数落盘目录。 */
37
+ profileMemoryDir?: () => string;
38
+ /** V3.2: tag marking a distilled procedure memory (recall filter). cli injects so runtime never imports skills. */
39
+ procedureTag?: string;
40
+ /** V3.2: record distilled procedures recalled this turn (positive reuse signal). cli-injected. */
41
+ recordProcedureRecalls?: (procedureIds: string[], sessionId: string) => void;
42
+ /** V3.2: record negative feedback against distilled procedures (failed turn). cli-injected. */
43
+ recordProcedureNegatives?: (procedureIds: string[]) => void;
28
44
  }
29
45
  /** Session-scoped state for dedup and byte budget (CC parity). */
30
46
  export interface MemoryPrefetchState {
@@ -155,6 +155,9 @@ export declare function assembleBackendDescriptor(backend: AcpBackendConfig, cli
155
155
  export declare function assembleCustomAgentDescriptor(custom: CustomAgentDef, cliPath: string | null, hasConfig: boolean): AgentDescriptor;
156
156
  export declare class AcpDetector {
157
157
  private cache;
158
+ /** Last scan that COMPLETED, surviving clearCache() and failed rescans. list() prefers this
159
+ * over an empty [] so a transient probe failure never reads as "no agents installed". */
160
+ private lastGoodScan;
158
161
  private configStore;
159
162
  private keySources;
160
163
  /** Shared in-flight async scan so concurrent scanAsync() callers (startup warm + a racing RPC)
@@ -188,6 +191,11 @@ export declare class AcpDetector {
188
191
  * Return cached results without IO. 冷缓存时后台预热(scanAsync)并返回 [],
189
192
  * 绝不在 RPC 路径上同步 scan —— 同步探测(11-18s+)会饿死单线程引擎循环
190
193
  * (x/product.confirm 60s 超时的根因)。调用方按"稍后再查"处理空列表。
194
+ *
195
+ * A background-scan failure is reported (console.error), never swallowed: a swallowed
196
+ * failure made list() return [] forever and downstream (product planning) treated
197
+ * "scan failed" as "no agents installed". When the fresh cache is gone but an older
198
+ * scan succeeded, that stale-but-real result is returned instead of [].
191
199
  */
192
200
  list(): AgentDescriptor[];
193
201
  /** Clear the detection cache. */
@@ -114,6 +114,8 @@ export declare class AcpProtocolAdapter {
114
114
  private child;
115
115
  private onNotification;
116
116
  private hostHandler;
117
+ /** Sessions whose session/set_model FAILED — running on the agent's default model, not the managed one. */
118
+ private modelMismatches;
117
119
  /**
118
120
  * Attach to a child process's stdio for ACP communication.
119
121
  * Constructs the official ClientSideConnection over the child's stdin/stdout. The connection's
@@ -172,6 +174,14 @@ export declare class AcpProtocolAdapter {
172
174
  * error is the backstop). Uses the generic sendRequest because the SDK has no typed set_model yet.
173
175
  */
174
176
  private selectSessionModel;
177
+ /**
178
+ * The recorded session/set_model failure for a session, if any — the session is alive but on
179
+ * the agent's DEFAULT model instead of the managed/platform one (wrong vendor/billing/capability).
180
+ */
181
+ getModelMismatch(sessionId: string): {
182
+ desired: string;
183
+ error: string;
184
+ } | undefined;
175
185
  /**
176
186
  * Send a prompt to a running ACP session (session/prompt). Content streams back via session/update
177
187
  * notifications during execution; the response carries only { stopReason, usage? }. On timeout the
@@ -26,9 +26,9 @@ export declare function getOwnerProfileDir(ownerUserId?: string): string;
26
26
  export declare function getProfileMemoryDir(ownerUserId?: string): string;
27
27
  /** Dir name for our per-project companion data (sessions/checkpoints/uploads). */
28
28
  export declare const PROJECT_DATA_DIRNAME = "projectData";
29
- /** Root of the projectData tree for the current owner. */
29
+ /** Root of the projectData tree on this device (`~/.qlogicagent/projectData/`). */
30
30
  export declare function getProjectDataRoot(): string;
31
- /** `profiles/<owner>/projectData/<projectId>/` (projectId is the path-derived key). */
31
+ /** `~/.qlogicagent/projectData/<projectId>/` (projectId is the path-derived key). */
32
32
  export declare function getProjectDataDirById(projectId: string): string;
33
33
  /**
34
34
  * Ensure the user agent home directory exists and is writable.
@@ -38,9 +38,9 @@ export declare function getProjectDataDirById(projectId: string): string;
38
38
  export declare function ensureUserAgentHome(): string;
39
39
  /** `~/.qlogicagent/profiles/<owner>/.credentials.json` */
40
40
  export declare function getUserCredentialsPath(): string;
41
- /** `~/.qlogicagent/profiles/<owner>/plugins/` */
41
+ /** `~/.qlogicagent/plugins/` — device-scoped. */
42
42
  export declare function getUserPluginsDir(): string;
43
- /** `~/.qlogicagent/profiles/<owner>/skills/` */
43
+ /** `~/.qlogicagent/skills/` — device-scoped single global skill store. */
44
44
  export declare function getUserSkillsDir(): string;
45
45
  /** `~/.qlogicagent/profiles/<owner>/settings.json` */
46
46
  export declare function getUserSettingsPath(): string;
@@ -48,11 +48,13 @@ export declare function getUserSettingsPath(): string;
48
48
  export declare function getUserCacheDir(): string;
49
49
  /** `~/.qlogicagent/debug-logs/` */
50
50
  export declare function getUserDebugLogsDir(): string;
51
- /** `~/.qlogicagent/profiles/<owner>/plugin-cache/` */
51
+ /** `~/.qlogicagent/plugin-cache/` — device-scoped (download cache for installs). */
52
52
  export declare function getUserPluginCacheDir(): string;
53
- /** `~/.qlogicagent/profiles/<owner>/mcp.json` */
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. */
54
56
  export declare function getUserMcpConfigPath(): string;
55
- /** `~/.qlogicagent/profiles/<owner>/marketplace.json` */
57
+ /** `~/.qlogicagent/marketplace.json` — device-scoped marketplace sources. */
56
58
  export declare function getUserMarketplaceConfigPath(): string;
57
59
  /** `~/.qlogicagent/profiles/<owner>/workflows/` */
58
60
  export declare function getUserWorkflowsDir(): string;
@@ -291,6 +291,12 @@ export declare class AgentProcessManager {
291
291
  * Uses the ACP protocol adapter for lifecycle management.
292
292
  */
293
293
  private spawnAcpAgent;
294
+ /**
295
+ * Surface a recorded session/set_model failure: the session is alive but runs the agent's
296
+ * DEFAULT model instead of the managed/platform one (wrong vendor/billing/capability). Same
297
+ * agents.error channel as the other spawn/restart failures.
298
+ */
299
+ private reportModelMismatch;
294
300
  private syncNativeMcpConfig;
295
301
  /** Kill a specific child agent process. */
296
302
  kill(memberId: string): void;
@@ -8,6 +8,15 @@ export interface AstraClawCapabilityToolInput {
8
8
  availableToolNames?: Iterable<string>;
9
9
  currentEnvironment?: string;
10
10
  toolCatalog?: ToolCatalog;
11
+ /**
12
+ * Configured MCP servers serving NO tools this session (invalid config / connect failure).
13
+ * Disclosed in mcp_connectors_list so a failed server is visibly missing, not silently absent.
14
+ */
15
+ mcpServerFailures?: Array<{
16
+ name: string;
17
+ phase?: string;
18
+ error: string;
19
+ }>;
11
20
  }
12
21
  export type AstraClawCapabilityToolResult = {
13
22
  handled: false;
@@ -21,10 +30,4 @@ export declare function buildAstraClawCapabilitiesSystemPrompt(input: {
21
30
  availableToolNames?: Iterable<string>;
22
31
  currentEnvironment?: string;
23
32
  }): Promise<string | undefined>;
24
- export declare function buildAstraClawCapabilitiesPromptPreamble(input: {
25
- projectRoot: string;
26
- mcpAvailable: boolean;
27
- availableToolNames?: Iterable<string>;
28
- currentEnvironment?: string;
29
- }): Promise<string | undefined>;
30
33
  export declare function handleAstraClawCapabilityToolCall(input: AstraClawCapabilityToolInput): Promise<AstraClawCapabilityToolResult>;
@@ -2,7 +2,7 @@
2
2
  * Local Checkpoint Backend — git-based shadow repo implementation.
3
3
  *
4
4
  * Creates and manages checkpoint snapshots in the centralized companion store
5
- * `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/checkpoints/<sessionId>/`
5
+ * `~/.qlogicagent/projectData/<projectId>/checkpoints/<sessionId>/`
6
6
  * (NOT inside the user's workspace) using a shadow git repository independent of the user's .git.
7
7
  */
8
8
  import type { CheckpointBackend } from "../ports/checkpoint-contracts.js";
@@ -0,0 +1,49 @@
1
+ /**
2
+ * One-shot migration: fold legacy PER-PROFILE install assets into the device-level store.
3
+ *
4
+ * 设计裁定:安装的插件/技能/MCP 是【设备资产】,跟随机器;只有会话/记忆/设置/偏好随登录身份
5
+ * (owner profile)。历史版本把 skills/plugins/mcp.json/skill-lifecycle.json 挂在
6
+ * profiles/<owner>/ 下,登录切身份 → 引擎换 profile → 已装插件"消失"、预装跨身份失效。
7
+ *
8
+ * 折并规则(活跃 owner 的 profile 先处理,它的副本优先):
9
+ * - skills/<name>: 设备层缺 → 整目录 rename 进设备 store;同名且 SKILL.md 内容一致 → 丢弃
10
+ * profile 副本;同名不同内容 → 原地保留 + 大声告警(绝不静默覆盖)。
11
+ * - plugins/<name>: 设备层缺 → rename;同名 → 原地保留 + 告警(插件目录内容不可比对)。
12
+ * - skill-lifecycle.json: 按技能名合并进设备层 store(先到优先),消费掉的文件改名
13
+ * `*.migrated-to-device` 留痕。
14
+ * - mcp.json: 服务器按名合并(先到优先、绝不覆盖已有键),消费掉的文件同样改名留痕。
15
+ * - marketplace.json: 设备层缺 → rename 采用;已有 → 原地保留 + 告警。
16
+ * - skills-disabled.json(全局静音表): 与技能 store 同为设备资产 —— 各 profile 取【并集】合入
17
+ * 设备层(保守方向:任何身份下停放/静音过的技能绝不因迁移静默点亮;agent 自建技能的
18
+ * "默认停放"正是靠这张表,漏并会让它们在别的身份下全部亮起)。消费掉的文件改名留痕。
19
+ * - plugin-cache/、cache/community-installs/: 纯下载缓存,直接删除。
20
+ *
21
+ * 会话伴生数据(第二批裁定,对齐 codex/VS Code —— 会话也随设备):
22
+ * - projectData/<pid>/: 设备层缺该 pid → 整目录 rename;同 pid 跨 profile(同一 workspace 在
23
+ * 多身份下用过,path-derived id 相同)→ 结构化合并:sessions/、checkpoints/、uploads/ 的
24
+ * 子项按【uuid 名】跳已存在(同名=同一会话的陈旧副本,活跃身份先到先得);sessions/.deleted
25
+ * 墓碑按文件名并集;project.json back-ref 先到先得(输家副本可安全删除,注册表每次写都会重生成)。
26
+ * 未能并尽的残留原地保留 + 计入 conflicts(绝不静默销毁)。
27
+ * - projects.json(注册表): 按项目 id 合并(先到先得);activeProjectId 继承第一个有效值
28
+ * (活跃身份优先)。折并须在 rebuildIndexFromBackrefs 之前跑 —— 否则自愈会先用空注册表
29
+ * 重建、丢掉 active 指针等索引态。
30
+ *
31
+ * 幂等:按目录状态驱动(profile 里没有遗留 → 全程 no-op),每次启动同步段调用都安全。
32
+ */
33
+ export interface DeviceScopeMigrationResult {
34
+ movedSkills: string[];
35
+ movedPlugins: string[];
36
+ /** projectData/<pid> trees moved or merged into the device store. */
37
+ movedProjects: string[];
38
+ /** Same-name different-content entries left in place (loud warning emitted). */
39
+ conflicts: string[];
40
+ /** Profile files (lifecycle/mcp/marketplace/registry/mute) whose content was folded into the device store. */
41
+ mergedFiles: string[];
42
+ }
43
+ /**
44
+ * Fold every profile's legacy install assets into the device-level store. Bounded (rename-based),
45
+ * idempotent, best-effort with loud per-item diagnostics. Call from the SYNCHRONOUS bootstrap
46
+ * section BEFORE anything reads the skill store — on an upgraded machine every installed skill
47
+ * still lives under profiles/ until this runs.
48
+ */
49
+ export declare function migrateDeviceScopeInstalls(): DeviceScopeMigrationResult;
@@ -2,17 +2,18 @@
2
2
  * Project Data Paths — centralized location for our per-project COMPANION data (the "account
3
3
  * book"): session transcripts/metadata, checkpoint shadow repos, uploaded attachments, deletion
4
4
  * tombstones. Mirrors VS Code's workspaceStorage: this data is OURS and lives in a centralized,
5
- * per-project-id, physically-isolated dir under the owner profile — NEVER inside the user's
5
+ * per-project-id, physically-isolated dir at the DEVICE level — NEVER inside the user's
6
6
  * workspace folder. The workspace folder holds only user work product (code/docs/generated media).
7
+ * 设备级(用户裁定,对齐 codex/VS Code):会话数据跟随机器;登录身份只属于云同步/计费层。
7
8
  *
8
- * ~/.qlogicagent/profiles/<owner>/projectData/<projectId>/{sessions,checkpoints,uploads}/
9
+ * ~/.qlogicagent/projectData/<projectId>/{sessions,checkpoints,uploads}/
9
10
  *
10
11
  * projectId is the PATH-DERIVED key (deriveProjectId(workspaceDir), see agent-paths) — the
11
12
  * mainstream model (VS Code / cc-haha): same folder → same id, deterministic, recomputable, no
12
13
  * central-registry dependency for the storage key. Deleting a project = `rm` projectData/<id>/.
13
14
  */
14
15
  export { getProjectDataDirById, getProjectDataRoot } from "./agent-paths.js";
15
- /** `~/.qlogicagent/profiles/<owner>/projectData/<projectId>/` for a projectId or workspaceDir. */
16
+ /** `~/.qlogicagent/projectData/<projectId>/` for a projectId or workspaceDir. */
16
17
  export declare function getProjectDataDir(projectIdOrWorkspaceDir: string): string;
17
18
  /** `projectData/<id>/sessions/` */
18
19
  export declare function getProjectDataSessionsRoot(projectIdOrWorkspaceDir: string): string;
@@ -2,9 +2,10 @@
2
2
  * Skill mute registries — under the single-store model, EVERY skill is global. There is no
3
3
  * project-scoped / opt-in concept; instead there are two opt-OUT mute lists:
4
4
  *
5
- * - owner-level (~/.qlogicagent/profiles/<owner>/skills-disabled.json) — off in EVERY project
5
+ * - device-level (~/.qlogicagent/skills-disabled.json) — off in EVERY project
6
6
  * (the plugin card's on/off switch; also where agent-learned skills land, disabled, until the
7
- * user reviews and enables them).
7
+ * user reviews and enables them). 与技能 store 同域:插件及其开关都是设备资产,登录身份切换
8
+ * 不得改变哪些技能是开着的(此前 per-owner 键控会让 A 身份停放的技能在 B 身份下点亮)。
8
9
  * - per-project (<cwd>/.qlogicagent/skills-disabled.json) — off in THIS project only
9
10
  * (the "project skills" opt-out, to cut down which skills an agent sees in a given project).
10
11
  *
@@ -17,19 +17,13 @@ export declare function getWorkingMaterials(projectId: string, sessionId: string
17
17
  items: WorkingMaterialItem[];
18
18
  missing: WorkingMaterialItem[];
19
19
  }>;
20
- export declare function replaceWorkingMaterials(projectId: string, sessionId: string, items: unknown[]): Promise<{
20
+ export interface WorkingMaterialsWriteResult {
21
21
  ok: true;
22
22
  items: WorkingMaterialItem[];
23
- }>;
24
- export declare function upsertWorkingMaterial(projectId: string, sessionId: string, item: unknown): Promise<{
25
- ok: true;
26
- items: WorkingMaterialItem[];
27
- }>;
28
- export declare function removeWorkingMaterial(projectId: string, sessionId: string, id: string): Promise<{
29
- ok: true;
30
- items: WorkingMaterialItem[];
31
- }>;
32
- export declare function reorderWorkingMaterials(projectId: string, sessionId: string, ids: string[]): Promise<{
33
- ok: true;
34
- items: WorkingMaterialItem[];
35
- }>;
23
+ /** 超过上限被淘汰的项;非空时调用方/UI 必须告知用户(绝不静默丢用户 pin 的数据)。 */
24
+ dropped?: WorkingMaterialItem[];
25
+ }
26
+ export declare function replaceWorkingMaterials(projectId: string, sessionId: string, items: unknown[]): Promise<WorkingMaterialsWriteResult>;
27
+ export declare function upsertWorkingMaterial(projectId: string, sessionId: string, item: unknown): Promise<WorkingMaterialsWriteResult>;
28
+ export declare function removeWorkingMaterial(projectId: string, sessionId: string, id: string): Promise<WorkingMaterialsWriteResult>;
29
+ export declare function reorderWorkingMaterials(projectId: string, sessionId: string, ids: string[]): Promise<WorkingMaterialsWriteResult>;
@@ -81,6 +81,13 @@ export declare class PetProfileService {
81
81
  private readonly profilePath;
82
82
  constructor(ownerUserId: string);
83
83
  loadProfile(): PetProfile;
84
+ /**
85
+ * Load the profile for a read-modify-write cycle. A corrupt profile file must
86
+ * never be replaced by a rebuilt default — throw so the caller fails loudly
87
+ * instead of silently destroying the user's pet data.
88
+ */
89
+ private loadProfileForWrite;
90
+ private readProfileState;
84
91
  updateSoul(soul: PetSoul | null): PetProfile;
85
92
  updatePreferences(update: Partial<PetPreferences>): PetProfile;
86
93
  saveJourneySnapshot(snapshot: JourneySnapshot): PetProfile;
@@ -9,7 +9,9 @@ export interface PetdexForgePackageOutput extends PetdexForgeOutput {
9
9
  validationPath: string;
10
10
  productionRunPath: string;
11
11
  }
12
- export declare function forgePetdexAsset(input: PetdexForgeRequest, generateImage: GeneratePetdexImage, options?: PetdexProductionOptions): Promise<PetdexForgeOutput>;
12
+ export declare function forgePetdexAsset(input: PetdexForgeRequest, generateImage: GeneratePetdexImage, options?: PetdexProductionOptions): Promise<PetdexForgeOutput & {
13
+ qaSkippedJobs?: string[];
14
+ }>;
13
15
  export declare function forgePetdexAssetPackage(params: {
14
16
  input: PetdexForgeRequest;
15
17
  outputDir: string;
@@ -4,6 +4,8 @@ export interface MemorySearchOptions {
4
4
  minScore?: number;
5
5
  preferredCategories?: string[];
6
6
  llmConfig?: unknown;
7
+ /** Drop hits whose tags contain ALL strings of any group (resident-layer exclusion). */
8
+ excludeTagGroups?: string[][];
7
9
  }
8
10
  export interface MemorySearchResult {
9
11
  blockId: string;
@@ -157,6 +159,27 @@ export interface MemoryHandlerProvider extends MemoryProvider {
157
159
  } | null>;
158
160
  /** Persist understood/extracted text on an attachment row. */
159
161
  setAttachmentText?(id: string, text: string): void;
162
+ /** Factual proposals for the candidate surface: pending (default) awaiting
163
+ * corroboration, or expired (read-only history of what timed out). */
164
+ listPendingProposals?(userId: string, limit?: number, status?: "pending" | "expired"): Array<{
165
+ id: string;
166
+ text: string;
167
+ category: string;
168
+ importance: number;
169
+ confidence: number;
170
+ source: string;
171
+ tags: string[];
172
+ createdAt: number;
173
+ }>;
174
+ /** UI resolution of one pending proposal: confirm commits it with manual authority; dismiss rejects it. */
175
+ resolveProposal?(userId: string, proposalId: string, action: "confirm" | "dismiss"): Promise<boolean>;
176
+ /** Evidence-laddered backlog consumption (corroborated commit / feedback solo / TTL expiry). */
177
+ consumePendingProposals?(userId: string): Promise<{
178
+ committed: number;
179
+ merged: number;
180
+ expiredIds: string[];
181
+ pendingLeft: number;
182
+ }>;
160
183
  }
161
184
  export interface MemoryDreamProvider {
162
185
  search(query: string, userId: string, options?: {
@@ -41,4 +41,6 @@ export interface ProjectMemoryStore {
41
41
  export interface ProjectMemoryStoreFactory {
42
42
  getRootPath(projectRoot: string): string;
43
43
  create(projectRoot: string): ProjectMemoryStore;
44
+ /** Read the user-level global memory INDEX for prompt injection (null when absent/empty). */
45
+ readUserIndexForPrompt(): string | null;
44
46
  }