qlogicagent 2.17.9 → 2.18.1

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 (78) hide show
  1. package/dist/agent.js +21 -21
  2. package/dist/cli.js +1 -1566
  3. package/dist/index.js +445 -421
  4. package/dist/orchestration.js +7 -7
  5. package/dist/protocol.js +1 -1
  6. package/dist/skills/builtin/desktop-screenshot/SKILL.md +62 -0
  7. package/dist/skills/builtin/office-doc-reading/SKILL.md +19 -0
  8. package/dist/skills/mcp/astraclaw-native-mcp-server.js +7 -6
  9. package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +18 -0
  10. package/dist/types/agent/tool-loop/loop-helpers.d.ts +9 -0
  11. package/dist/types/agent/tool-loop.d.ts +14 -5
  12. package/dist/types/agent/types.d.ts +5 -0
  13. package/dist/types/cli/acp-session-handlers.d.ts +8 -1
  14. package/dist/types/cli/acp-session-host.d.ts +5 -1
  15. package/dist/types/cli/default-project-bootstrap.d.ts +33 -0
  16. package/dist/types/cli/handlers/agents-handler.d.ts +9 -0
  17. package/dist/types/cli/handlers/config-handler.d.ts +5 -0
  18. package/dist/types/cli/handlers/files-handler.d.ts +7 -0
  19. package/dist/types/cli/handlers/session-handler.d.ts +49 -0
  20. package/dist/types/cli/handlers/turn-handler.d.ts +77 -0
  21. package/dist/types/cli/media-understanding.d.ts +45 -0
  22. package/dist/types/cli/permission-rule-persistence.d.ts +16 -0
  23. package/dist/types/cli/session-context.d.ts +5 -1
  24. package/dist/types/cli/stdio-acp-request-host.d.ts +1 -1
  25. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -0
  26. package/dist/types/cli/stdio-server.d.ts +17 -1
  27. package/dist/types/cli/tool-bootstrap-core-registration.d.ts +2 -0
  28. package/dist/types/cli/turn-core.d.ts +2 -0
  29. package/dist/types/orchestration/agent-instance.d.ts +4 -0
  30. package/dist/types/orchestration/delegation-coordinator.d.ts +10 -0
  31. package/dist/types/orchestration/product-persistence.d.ts +4 -0
  32. package/dist/types/orchestration/workflow/capability-catalog.d.ts +1 -1
  33. package/dist/types/orchestration/workflow/workflow-controller.d.ts +1 -1
  34. package/dist/types/orchestration/workflow/workflow-runtime.d.ts +1 -1
  35. package/dist/types/protocol/notifications.d.ts +1 -1
  36. package/dist/types/protocol/wire/acp-agent-management.d.ts +16 -0
  37. package/dist/types/protocol/wire/agent-events.d.ts +2 -2
  38. package/dist/types/protocol/wire/agent-methods.d.ts +3 -0
  39. package/dist/types/protocol/wire/index.d.ts +1 -1
  40. package/dist/types/protocol/wire/notification-payloads.d.ts +26 -0
  41. package/dist/types/runtime/execution/turn-progress-notifier.d.ts +16 -0
  42. package/dist/types/runtime/infra/acp-detector.d.ts +40 -6
  43. package/dist/types/runtime/infra/acp-protocol-adapter.d.ts +14 -0
  44. package/dist/types/runtime/infra/agent-process.d.ts +16 -0
  45. package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +2 -2
  46. package/dist/types/runtime/infra/builtin-skills-seed.d.ts +31 -0
  47. package/dist/types/runtime/infra/llmrouter-catalog.d.ts +26 -6
  48. package/dist/types/runtime/infra/model-registry.d.ts +43 -2
  49. package/dist/types/runtime/infra/project-data-gc.d.ts +7 -1
  50. package/dist/types/runtime/infra/skill-resolver.d.ts +15 -0
  51. package/dist/types/runtime/infra/user-dirs.d.ts +21 -0
  52. package/dist/types/runtime/permission-model.d.ts +1 -1
  53. package/dist/types/runtime/ports/permission-contracts.d.ts +5 -2
  54. package/dist/types/runtime/prompt/environment-context.d.ts +24 -2
  55. package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +1 -2
  56. package/dist/types/runtime/prompt/identity-section.d.ts +17 -0
  57. package/dist/types/runtime/session/inbound-upload-persistence.d.ts +20 -0
  58. package/dist/types/runtime/session/native/claude-session-source.d.ts +23 -0
  59. package/dist/types/runtime/session/native/codex-index.d.ts +21 -0
  60. package/dist/types/runtime/session/native/codex-session-source.d.ts +31 -0
  61. package/dist/types/runtime/session/native/cwd-normalize.d.ts +53 -0
  62. package/dist/types/runtime/session/native/ephemeral-rollout-sweep.d.ts +13 -0
  63. package/dist/types/runtime/session/native/native-cwd-agents.d.ts +17 -0
  64. package/dist/types/runtime/session/native/native-session-source.d.ts +89 -0
  65. package/dist/types/runtime/session/native/native-title.d.ts +1 -0
  66. package/dist/types/runtime/session/native/register-builtin-sources.d.ts +1 -0
  67. package/dist/types/runtime/session/session-recovery.d.ts +58 -0
  68. package/dist/types/runtime/session/session-types.d.ts +30 -0
  69. package/dist/types/skills/permissions/hook-runner.d.ts +9 -0
  70. package/dist/types/skills/permissions/settings-watcher.d.ts +7 -0
  71. package/dist/types/skills/tools/exec-tool.d.ts +1 -1
  72. package/dist/types/skills/tools/shell/command-classification.d.ts +1 -0
  73. package/dist/types/skills/tools/shell/index.d.ts +3 -3
  74. package/dist/types/skills/tools/shell/powershell-provider.d.ts +8 -3
  75. package/dist/types/skills/tools/shell/shell-exec.d.ts +18 -0
  76. package/dist/types/skills/tools/shell/shell-provider.d.ts +67 -5
  77. package/dist/types/transport/acp-server.d.ts +6 -0
  78. package/package.json +4 -1
@@ -6,7 +6,7 @@ import type { CliAcpRequestHandlerHost } from "./cli-acp-request-handler.js";
6
6
  * (`this: any`), so members it touches must be forwarded here explicitly;
7
7
  * see TURN_PIPELINE_HOST_MEMBERS for the regression-tested list.
8
8
  */
9
- export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTurn" | "acpSessionMeta" | "currentHooks" | "currentSessionId" | "currentTurnId" | "memoryPrefetchState" | "permissionChecker" | "sessionHistory" | "sessionLlmConfig" | "sessionState" | "cancelIdleDreamTimer" | "disposeSessionRuntime" | "enableIdleDream" | "ensureDefaultProject" | "ensureModelRegistryHydrated" | "getActiveProjectRoot" | "log" | "sendNotification" | "setActiveWorkdir"> & {
9
+ export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTurn" | "acpSessionMeta" | "acpSessionMetaBySession" | "currentHooks" | "currentSessionId" | "currentTurnId" | "memoryPrefetchState" | "permissionChecker" | "sessionHistory" | "sessionLlmConfig" | "sessionState" | "cancelIdleDreamTimer" | "disposeSessionRuntime" | "enableIdleDream" | "ensureDefaultProject" | "ensureModelRegistryHydrated" | "getActiveProjectRoot" | "log" | "sendNotification" | "setActiveWorkdir"> & {
10
10
  currentModel: string | undefined;
11
11
  lastAssistantMessageForExtract: string | undefined;
12
12
  lastUserMessageForAutoExtract: string | undefined;
@@ -3,6 +3,9 @@ import type { ModelPurpose } from "../runtime/infra/model-registry.js";
3
3
  import type { RpcHandlerHosts } from "./rpc-registry.js";
4
4
  type DirectStdioRpcHost = RpcHandlerHosts["config"] & RpcHandlerHosts["control"] & RpcHandlerHosts["files"] & RpcHandlerHosts["skills"] & RpcHandlerHosts["project"] & RpcHandlerHosts["community"] & RpcHandlerHosts["settings"] & RpcHandlerHosts["petConfirm"] & {
5
5
  currentTurnId?: string;
6
+ /** Mid-turn guidance queue (运行中引导) — shared between handleTurnGuide and the tool loop's drain. */
7
+ pendingTurnGuidance?: string[];
8
+ getActiveProjectRoot(): string;
6
9
  readonly multiAgentHandlerHost: RpcHandlerHosts["multiAgent"];
7
10
  readonly workflowHandlerHost: RpcHandlerHosts["workflow"];
8
11
  };
@@ -39,6 +42,7 @@ type StdioRpcAdapterSource = DirectStdioRpcHost & {
39
42
  sendError: NonNullable<RpcHandlerHosts["session"]["sendError"]>;
40
43
  createDreamHandlerHost(): RpcHandlerHosts["dream"];
41
44
  };
45
+ export declare function createTurnHost(host: StdioRpcAdapterSource): RpcHandlerHosts["turn"];
42
46
  /**
43
47
  * Build the per-domain handler-host bundle the RPC registry binds to.
44
48
  *
@@ -25,7 +25,7 @@ import { type MultiAgentHandlerHost } from "./multi-agent-handler-host.js";
25
25
  import type { WorkflowHandlerHost } from "./handlers/workflow-handler.js";
26
26
  import { SessionHistoryCoordinator } from "./session-history-coordinator.js";
27
27
  import { PetConfirmCoordinator } from "./pet-confirm-coordinator.js";
28
- import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, ProjectMemoryStore } from "../runtime/ports/index.js";
28
+ import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, PermissionMode, ProjectMemoryStore } from "../runtime/ports/index.js";
29
29
  export interface StdioServerConfig {
30
30
  verbose: boolean;
31
31
  transport?: Transport;
@@ -106,6 +106,13 @@ export declare class StdioServer {
106
106
  set currentSessionId(v: string);
107
107
  get currentTurnId(): string;
108
108
  set currentTurnId(v: string);
109
+ /**
110
+ * Mid-turn guidance queue (运行中引导). Reset per turn by runTurnPipeline, pushed by
111
+ * handleTurnGuide (via the turn host proxy), drained each round by the tool loop.
112
+ * Declared as a real field so the proxy in createTurnHost has a shared backing store
113
+ * (turn pipeline and handleTurnGuide must see the SAME array).
114
+ */
115
+ pendingTurnGuidance: string[];
109
116
  /** LH-10: an explicit cancel of a session stops the background tasks that
110
117
  * session launched — the forked agent + the exec processes it spawned —
111
118
  * instead of leaving them running as zombies. Keyed by session id, which is
@@ -117,9 +124,18 @@ export declare class StdioServer {
117
124
  set sessionLlmConfig(v: SessionLlmConfig);
118
125
  get acpSessionMeta(): Record<string, unknown> | null;
119
126
  set acpSessionMeta(v: Record<string, unknown> | null);
127
+ get acpSessionMetaBySession(): Map<string, Record<string, unknown>>;
120
128
  get currentHooks(): import("../contracts/hooks.js").HookRegistry | null;
121
129
  get permissionChecker(): AgentRuntimeSessionState["permissionChecker"];
122
130
  private set permissionChecker(value);
131
+ /**
132
+ * config.update 权限热应用:写盘的同时立即更新活的 rule engine,
133
+ * 当前会话(乃至运行中 turn)的下一次工具调用就按新模式判定——
134
+ * 不再等下一轮 _meta 或重启。settings-watcher 仍监听文件作为外部改动兜底。
135
+ */
136
+ applyPermissionConfig(perm: {
137
+ mode: PermissionMode;
138
+ }): void;
123
139
  private set mcpManager(value);
124
140
  get memoryProvider(): MemoryHandlerProvider | null;
125
141
  set memoryProvider(value: MemoryHandlerProvider | null);
@@ -30,3 +30,5 @@ export declare function setGroupSecurityMode(enabled: boolean): void;
30
30
  export declare const localCoreToolRegistrationModule: import("../runtime/ports/tool-contracts.js").ToolRegistrationModule<LocalCoreToolRegistrationContext>;
31
31
  export declare function registerLocalCoreTools(context: LocalCoreToolRegistrationContext): void;
32
32
  export declare function validateExecCommand(command: string, workdir: string, groupMode?: boolean): string | null;
33
+ /** office/pdf 文档扩展名 → mime;非文档返回 undefined。导出仅为单测。 */
34
+ export declare function documentMimeForExtension(ext: string): string | undefined;
@@ -16,6 +16,8 @@ export interface TurnCoreRequest {
16
16
  tools: ToolDefinition[];
17
17
  /** Live tool-manifest rebuild for same-turn activation (forwarded to the loop). */
18
18
  refreshTools?: () => ToolDefinition[];
19
+ /** Mid-turn guidance drain (运行中引导) — forwarded to the tool loop. */
20
+ drainPendingGuidance?: () => string[];
19
21
  systemPrompt: string;
20
22
  config: TurnConfig;
21
23
  }
@@ -121,6 +121,10 @@ export declare class ProductOrchestrator {
121
121
  */
122
122
  replayTask(productId: string, taskId: string): Promise<void>;
123
123
  /** Get product status. */
124
+ /** P2-1: the native (codex/claude) session id captured for a delegation's single worker, so the
125
+ * DelegationCoordinator can resume it on the next same-(chat×agent) delegation. undefined for a
126
+ * multi-instance product, an own agent, or before the worker's first task settles. */
127
+ getDelegationNativeSessionId(productId: string): string | undefined;
124
128
  getStatus(productId: string): ProductStatus | null;
125
129
  /** Live DAG progress snapshot for a product (for the planner's execution-phase leader). */
126
130
  getProgressSnapshot(productId: string): {
@@ -15,6 +15,16 @@ type DelegationStatus = "running" | "completed" | "failed" | "cancelled";
15
15
  export declare class DelegationCoordinator {
16
16
  private readonly deps;
17
17
  private readonly active;
18
+ /** Per-(chat×agent) tail promise — the next same-conversation delegation chains after it so they run
19
+ * strictly sequentially (single writer to the shared reused worktree + native session). One entry per
20
+ * active (chat×agent) pair (keyed, overwritten — not per-delegation), so it stays bounded. */
21
+ private readonly convChains;
22
+ /** Per-(chat×agent) native (codex/claude) session id — the background analogue of the foreground U5
23
+ * convergence. Seeded from the first delegation's captured session id; passed as resumeNativeSessionId on
24
+ * every subsequent same-conversation delegation so context accumulates (git AND non-git projects).
25
+ * In-memory (one entry per active pair); an engine restart resets it → the next delegation starts fresh,
26
+ * same as a cold foreground turn whose pool was evicted. */
27
+ private readonly nativeSessions;
18
28
  constructor(deps: DelegationDeps);
19
29
  /** Active + recent delegations for this project (x/mention.list). */
20
30
  list(): {
@@ -30,6 +30,10 @@ export interface PersistedProductState {
30
30
  * PlanningSession is strings / arrays / plain objects (no functions, dates, or class instances).
31
31
  */
32
32
  leaderDialogue?: PlanningSession;
33
+ /** P2-1: run tasks in the project cwd instead of per-task worktrees (see
34
+ * ProductCreateParams.runInProjectCwd) — persisted so a delegation resumed after an engine restart
35
+ * keeps running in the project cwd, not a fresh isolated worktree. */
36
+ runInProjectCwd?: boolean;
33
37
  }
34
38
  export interface ProductPersistenceOptions {
35
39
  pathService?: PathService;
@@ -35,7 +35,7 @@ export interface CapabilityCatalogDeps {
35
35
  projectRoot: string;
36
36
  }
37
37
  /** Enumerate every capability a workflow in `projectRoot` can reference right now. */
38
- export declare function buildCapabilityCatalog(deps: CapabilityCatalogDeps): CapabilityEntry[];
38
+ export declare function buildCapabilityCatalog(deps: CapabilityCatalogDeps): Promise<CapabilityEntry[]>;
39
39
  /**
40
40
  * Compact catalog text for the AI graph builder's system prompt: category headers + `id — desc`
41
41
  * lines, hard-capped per category so huge tool sets don't blow the prompt (the agent uses the
@@ -215,5 +215,5 @@ export declare function defaultRuntimeFactory(opts: {
215
215
  checkpoint?: (workflowId: string, runId: string) => RunCheckpoint | undefined;
216
216
  now?: () => Date;
217
217
  /** Per-node lifecycle for live canvas coloring; workflowId comes from the run ctx. */
218
- emitNodeStatus?: (workflowId: string, nodeId: string, status: NodeRunStatus) => void;
218
+ emitNodeStatus?: (workflowId: string, nodeId: string, status: NodeRunStatus, error?: string) => void;
219
219
  }): RuntimeFactory;
@@ -96,7 +96,7 @@ export interface WorkflowRuntimeOptions {
96
96
  */
97
97
  preserveCheckpoint?: boolean;
98
98
  /** Per-node lifecycle callback for live status (canvas coloring). Fire-and-forget, not durable. */
99
- onNodeStatus?: (nodeId: string, status: "running" | "completed" | "failed") => void;
99
+ onNodeStatus?: (nodeId: string, status: "running" | "completed" | "failed", error?: string) => void;
100
100
  }
101
101
  export declare class WorkflowRuntime {
102
102
  private def;
@@ -6,4 +6,4 @@
6
6
  * This file re-exports the wire types.
7
7
  * Internal consumers import from this file — zero churn.
8
8
  */
9
- export type { AgentSource, AgentsErrorNotification, AgentsStatusNotification, ArtifactType, MediaResultType, MemoryDecayCompletedNotification, MemoryUpdatedNotification, NotificationMethod, NotificationMethodMap, NotificationThreadItem, PermissionRuleUpdatedNotification, PlanInterruptedNotification, PongNotification, ProductAgentActivityNotification, ProductBudgetUpdateNotification, ProductBudgetWarningNotification, ProductCheckpointedNotification, ProductCompletedNotification, ProductDagTopologyNotification, ProductMembersNotification, ProductPlanFailedNotification, ProductPlanningDeltaNotification, ProductPlanReadyNotification, ProductTaskCompletedNotification, ProductTaskFailedNotification, ProductTaskOutputDeltaNotification, ProductTaskStartedNotification, ProjectArchivedNotification, ProjectCreatedNotification, ProjectDeletedNotification, ProjectRenamedNotification, ProjectSwitchedNotification, ProjectUnarchivedNotification, SessionInfoNotification, SoloAgentDeltaNotification, SoloAgentUsageNotification, SoloEvaluationNotification, SoloProgressNotification, TeamMemberNotification, ToolApprovalRequestNotification, TurnAnnotationsNotification, TurnArtifactNotification, TurnAskUserNotification, TurnDeltaNotification, TurnEndNotification, TurnErrorNotification, TurnExecProgressNotification, TurnHeartbeatNotification, TurnMediaPersistedNotification, TurnMediaProgressNotification, TurnMediaResultNotification, TurnPlanUpdateNotification, TurnReasoningDeltaNotification, TurnRecoveryNotification, TurnSidechainCompletedNotification, TurnSidechainStartedNotification, TurnSkillInstructionNotification, TurnStartNotification, TurnSubagentDeltaNotification, TurnSuggestionsNotification, TurnTaskUpdatedNotification, TurnTodosUpdatedNotification, TurnToolBlockedNotification, TurnToolCallNotification, TurnToolResultNotification, TurnToolUseSummaryNotification, TurnUsageUpdateNotification, WireTokenUsage, } from "./wire/index.js";
9
+ export type { AgentSource, AgentsErrorNotification, AgentsStatusNotification, ArtifactType, MediaResultType, MemoryDecayCompletedNotification, MemoryUpdatedNotification, NotificationMethod, NotificationMethodMap, NotificationThreadItem, PermissionRuleUpdatedNotification, PlanInterruptedNotification, PongNotification, ProductAgentActivityNotification, ProductBudgetUpdateNotification, ProductBudgetWarningNotification, ProductCheckpointedNotification, ProductCompletedNotification, ProductDagTopologyNotification, ProductMembersNotification, ProductPlanFailedNotification, ProductPlanningDeltaNotification, ProductPlanReadyNotification, ProductTaskCompletedNotification, ProductTaskFailedNotification, ProductTaskOutputDeltaNotification, ProductTaskStartedNotification, ProjectArchivedNotification, ProjectCreatedNotification, ProjectDeletedNotification, ProjectRenamedNotification, ProjectSwitchedNotification, ProjectUnarchivedNotification, SessionInfoNotification, SessionRecoveryPendingNotification, SoloAgentDeltaNotification, SoloAgentUsageNotification, SoloEvaluationNotification, SoloProgressNotification, TeamMemberNotification, ToolApprovalRequestNotification, TurnAnnotationsNotification, TurnArtifactNotification, TurnAskUserNotification, TurnDeltaNotification, TurnEndNotification, TurnErrorNotification, TurnExecProgressNotification, TurnHeartbeatNotification, TurnMediaPersistedNotification, TurnMediaProgressNotification, TurnMediaResultNotification, TurnPlanUpdateNotification, TurnProgressNotification, TurnReasoningDeltaNotification, TurnRecoveryNotification, TurnSidechainCompletedNotification, TurnSidechainStartedNotification, TurnSkillInstructionNotification, TurnStartNotification, TurnSubagentDeltaNotification, TurnSuggestionsNotification, TurnTaskUpdatedNotification, TurnTodosUpdatedNotification, TurnToolBlockedNotification, TurnToolCallNotification, TurnToolResultNotification, TurnToolUseSummaryNotification, TurnUsageUpdateNotification, WireTokenUsage, } from "./wire/index.js";
@@ -337,6 +337,22 @@ export interface ProductCreateParams {
337
337
  maxTotalTokens?: number;
338
338
  maxDuration?: number;
339
339
  };
340
+ /**
341
+ * P2-1: run ALL tasks directly in the project cwd (`cwd`) instead of isolated per-task git worktrees.
342
+ * Set by DelegationCoordinator so a background @mention shares the project workspace exactly like
343
+ * foreground @codex — its native session then lives under a STABLE cwd (git or not) and resumes across
344
+ * delegations. Omitted everywhere else (per-task worktree isolation stays the default for parallel
345
+ * product/goal/solo tasks).
346
+ */
347
+ runInProjectCwd?: boolean;
348
+ /**
349
+ * P2-1: native (codex/claude) session id to RESUME for this delegation (ACP session/load), so repeated
350
+ * background @mention to the same (chat×agent) accumulates context — the background analogue of the
351
+ * foreground U4 resume. The DelegationCoordinator tracks it per (chat×agent): undefined on the first
352
+ * delegation (→ fresh session, whose id it then captures), the prior id thereafter. Validated by `has()`
353
+ * before use, so a stale id falls back to a fresh session. Git-independent (id, not cwd, drives reuse).
354
+ */
355
+ resumeNativeSessionId?: string;
340
356
  }
341
357
  /**
342
358
  * product.plan RPC params — starts an interactive planning session.
@@ -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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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"];
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"];
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.tool_use_summary", "turn.tool_selection_policy", "turn.lifecycle", "turn.document_maintenance", "turn.artifact_contract", "turn.usage_update", "team.member.notification", "session.info", "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", "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", "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", "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. */
@@ -20,6 +20,8 @@ export interface AgentCapabilities {
20
20
  supportsResume: boolean;
21
21
  supportsUsageUpdate: boolean;
22
22
  skillsDirs?: string[];
23
+ /** 会话历史来源:native-cwd=有本地按 cwd 可发现的原生会话;省略/own=只显示自有会话 */
24
+ sessionHistory?: "native-cwd" | "own";
23
25
  }
24
26
  /** Descriptor for a discovered or registered agent. */
25
27
  export interface AgentDescriptor {
@@ -719,6 +721,7 @@ export interface AgentRpcMethodMap extends GatewayRpcMethodMap {
719
721
  params: {
720
722
  modelId: string;
721
723
  enabled: boolean;
724
+ purpose?: string;
722
725
  };
723
726
  result: {
724
727
  ok: true;
@@ -6,7 +6,7 @@ export { type ChatMessage, type ChatMessageRole, type LocalizedToolText, type Th
6
6
  export { type AgentCapabilities, type AgentCategory, type AgentConfig, type AgentDescriptor, type AgentProtocol, type AgentRpcMethodMap, type AgentStatus, type CustomAgentDef, type ProductInstanceDef, type ProductPhase, type ProductStatus, type ProductSummary, type ProductTaskDef, type ProductTaskStatus, type SoloAgentResult, type SoloAgentState, type SoloState, type SoloStatus, } from "./agent-methods.js";
7
7
  export type * from "./acp-agent-management.js";
8
8
  export { AGENT_TEAM_WS_EVENT_NAMES, AGENT_WS_EVENT_NAMES, ALL_AGENT_WS_EVENT_NAMES, type AgentTeamWsEventName, type AgentWsEventName, type AllAgentWsEventName, } from "./agent-events.js";
9
- export { type AgentSource, type AgentsErrorNotification, type AgentsStatusNotification, type ArtifactType, type MediaResultType, type MemoryDecayCompletedNotification, type MemoryUpdatedNotification, type NotificationMethod, type NotificationMethodMap, type NotificationThreadItem, type PermissionRuleUpdatedNotification, type PlanInterruptedNotification, type PongNotification, type ProductBudgetUpdateNotification, type ProductBudgetWarningNotification, type ProductCheckpointedNotification, type ProductCompletedNotification, type ProductDagTopologyNotification, type ProductTaskCompletedNotification, type ProductTaskFailedNotification, type ProductTaskOutputDeltaNotification, type ProductMembersNotification, type ProductAgentActivityNotification, type ProductTaskStartedNotification, type ProjectArchivedNotification, type ProjectCreatedNotification, type ProjectDeletedNotification, type ProjectRenamedNotification, type ProjectSwitchedNotification, type ProjectUnarchivedNotification, type SessionInfoNotification, type SoloAgentDeltaNotification, type SoloAgentUsageNotification, type SoloEvaluationNotification, type SoloProgressNotification, type TeamMemberNotification, type ToolApprovalRequestNotification, type TurnAnnotationsNotification, type TurnArtifactContractNotification, type TurnArtifactNotification, type TurnAskUserNotification, type TurnDeltaNotification, type TurnEndNotification, type TurnErrorNotification, type TurnExecProgressNotification, type TurnHeartbeatNotification, type TurnMediaPersistedNotification, type TurnMediaProgressNotification, type TurnMediaResultNotification, type TurnPlanUpdateNotification, type TurnReasoningDeltaNotification, type TurnRecoveryNotification, type TurnSidechainCompletedNotification, type TurnSidechainStartedNotification, type TurnSkillAcquisitionNeededNotification, type TurnSkillInstructionNotification, type TurnStartNotification, type TurnSubagentDeltaNotification, type TurnSubagentEndedNotification, type TurnSubagentStartedNotification, type TurnSuggestionsNotification, type TurnTaskUpdatedNotification, type TurnTodosUpdatedNotification, type TurnToolBlockedNotification, type TurnToolCallNotification, type TurnToolResultNotification, type TurnToolUseSummaryNotification, type TurnUsageUpdateNotification, type WireTokenUsage, type ProductPlanReadyNotification, type ProductPlanFailedNotification, type ProductPlanningDeltaNotification, type PetSoulReadyNotification, type PetReactionNotification, type PetGrowthNotification, type PetStateNotification, type PetConfirmNotification, type WorkflowDeletedNotification, type WorkflowRecordNotification, type WorkflowRunCompletedNotification, type WorkflowRunFailedNotification, type WorkflowRunStartedNotification, } from "./notification-payloads.js";
9
+ export { type AgentSource, type AgentsErrorNotification, type AgentsStatusNotification, type ArtifactType, type MediaResultType, type MemoryDecayCompletedNotification, type MemoryUpdatedNotification, type NotificationMethod, type NotificationMethodMap, type NotificationThreadItem, type PermissionRuleUpdatedNotification, type PlanInterruptedNotification, type PongNotification, type ProductBudgetUpdateNotification, type ProductBudgetWarningNotification, type ProductCheckpointedNotification, type ProductCompletedNotification, type ProductDagTopologyNotification, type ProductTaskCompletedNotification, type ProductTaskFailedNotification, type ProductTaskOutputDeltaNotification, type ProductMembersNotification, type ProductAgentActivityNotification, type ProductTaskStartedNotification, type ProjectArchivedNotification, type ProjectCreatedNotification, type ProjectDeletedNotification, type ProjectRenamedNotification, type ProjectSwitchedNotification, type ProjectUnarchivedNotification, type SessionInfoNotification, type SessionRecoveryPendingNotification, type SoloAgentDeltaNotification, type SoloAgentUsageNotification, type SoloEvaluationNotification, type SoloProgressNotification, type TeamMemberNotification, type ToolApprovalRequestNotification, type TurnAnnotationsNotification, type TurnArtifactContractNotification, type TurnArtifactNotification, type TurnAskUserNotification, type TurnDeltaNotification, type TurnEndNotification, type TurnErrorNotification, type TurnExecProgressNotification, type TurnHeartbeatNotification, type TurnMediaPersistedNotification, type TurnMediaProgressNotification, type TurnMediaResultNotification, type TurnPlanUpdateNotification, type TurnProgressNotification, type TurnReasoningDeltaNotification, type TurnRecoveryNotification, type TurnSidechainCompletedNotification, type TurnSidechainStartedNotification, type TurnSkillAcquisitionNeededNotification, type TurnSkillInstructionNotification, type TurnStartNotification, type TurnSubagentDeltaNotification, type TurnSubagentEndedNotification, type TurnSubagentStartedNotification, type TurnSuggestionsNotification, type TurnTaskUpdatedNotification, type TurnTodosUpdatedNotification, type TurnToolBlockedNotification, type TurnToolCallNotification, type TurnToolResultNotification, type TurnToolUseSummaryNotification, type TurnUsageUpdateNotification, type WireTokenUsage, type ProductPlanReadyNotification, type ProductPlanFailedNotification, type ProductPlanningDeltaNotification, type PetSoulReadyNotification, type PetReactionNotification, type PetGrowthNotification, type PetStateNotification, type PetConfirmNotification, type WorkflowDeletedNotification, type WorkflowRecordNotification, type WorkflowRunCompletedNotification, type WorkflowRunFailedNotification, type WorkflowRunStartedNotification, } from "./notification-payloads.js";
10
10
  export { ACP_EXTENDED_METHODS, ACP_EXTENDED_SESSION_UPDATE_TYPES, ACP_METHODS, ACP_PROTOCOL_VERSION, ACP_SESSION_UPDATE_TYPES, isAcpJsonRpcNotification, isAcpJsonRpcRequest, isAcpJsonRpcResponse, isExtendedSessionUpdateType, isStandardSessionUpdateType, parseAcpMessage, type AcpAgentCapabilities, type AcpAgentMessageChunkPayload, type AcpAgentThoughtChunkPayload, type AcpConfigOptionDescriptor, type AcpConfigOptionUpdatePayload, type AcpContentBlock, type AcpEndTurnPayload, type AcpExtendedMethod, type AcpExtendedSessionUpdateType, type AcpFsReadTextFileParams, type AcpFsReadTextFileResult, type AcpFsWriteTextFileParams, type AcpFsWriteTextFileResult, type AcpHostCapabilities, type AcpInitializeParams, type AcpInitializeResult, type AcpJsonRpcError, type AcpJsonRpcMessage, type AcpJsonRpcNotification, type AcpJsonRpcRequest, type AcpJsonRpcResponse, type AcpMode, type AcpPermissionOption, type AcpPermissionRequestParams, type AcpPermissionRequestResult, type AcpPlanPayload, type AcpSessionCancelParams, type AcpSessionCloseParams, type AcpSessionMeta, type AcpSessionLoadParams, type AcpSessionModeState, type AcpSessionNewParams, type AcpSessionNewResult, type AcpSessionPromptParams, type AcpSessionPromptResult, type AcpSessionSetConfigParams, type AcpSessionUpdateNotification, type AcpSessionUpdateType, type AcpStandardMethod, type AcpStandardSessionUpdateType, type AcpStopReason, type AcpToolCallPayload, type AcpToolCallUpdatePayload, type AcpUsage, type AcpUsageUpdatePayload, type AcpXSessionInfoPayload, type AcpXSkillInstructionPayload, } from "./acp-protocol.js";
11
11
  export { type ApprovalRequiredToolContract, type ModelSelectionReason, type PendingPromptContract, type RuntimeCapabilitySummaryContract, type RuntimeSessionContract, type SessionIdentityContract, } from "./session.js";
12
12
  export { type GatewayChannelExecutionEgressContract, type GatewayChannelExecutionEgressKind, type GatewayChannelExecutionIngressBindingContract, type GatewayChannelExecutionIngressSource, } from "./channel-ingress.js";
@@ -284,6 +284,20 @@ export interface TurnExecProgressNotification {
284
284
  totalLines: number;
285
285
  totalBytes: number;
286
286
  }
287
+ /**
288
+ * Throttled long-turn progress (IM channel feedback). Emitted at most once per throttle
289
+ * interval while a turn keeps running tools; gateway/IM bridge renders it as a short
290
+ * progress line. Desktop UIs already show the tool stream and may ignore it.
291
+ */
292
+ export interface TurnProgressNotification {
293
+ turnId: string;
294
+ /** Milliseconds since the turn started. */
295
+ elapsedMs: number;
296
+ /** Tool results observed so far this turn. */
297
+ toolCalls: number;
298
+ /** Name of the most recently completed tool. */
299
+ lastTool: string;
300
+ }
287
301
  /** Generic progress heartbeat. */
288
302
  export interface TurnHeartbeatNotification {
289
303
  turnId: string;
@@ -466,6 +480,16 @@ export interface MemoryDecayCompletedNotification {
466
480
  archived: number;
467
481
  durationMs: number;
468
482
  }
483
+ /** L3 启动扫描发现的待恢复会话(崩溃残留的 in-flight turn,session-lifecycle-recovery)。 */
484
+ export interface SessionRecoveryPendingNotification {
485
+ sessions: Array<{
486
+ sessionId: string;
487
+ turnId: string;
488
+ startedAt: string;
489
+ lastUserPreview?: string;
490
+ hadSideEffectTool: boolean;
491
+ }>;
492
+ }
469
493
  /** Session metadata changed. */
470
494
  export interface SessionInfoNotification {
471
495
  sessionId: string;
@@ -1002,6 +1026,7 @@ export interface NotificationMethodMap {
1002
1026
  "turn.todos_updated": TurnTodosUpdatedNotification;
1003
1027
  "task.updated": TaskUpdatedNotification;
1004
1028
  "turn.exec_progress": TurnExecProgressNotification;
1029
+ "turn.progress": TurnProgressNotification;
1005
1030
  "turn.heartbeat": TurnHeartbeatNotification;
1006
1031
  "turn.tool_use_summary": TurnToolUseSummaryNotification;
1007
1032
  "turn.tool_selection_policy": TurnToolSelectionPolicyNotification;
@@ -1018,6 +1043,7 @@ export interface NotificationMethodMap {
1018
1043
  "memory.decay.completed": MemoryDecayCompletedNotification;
1019
1044
  "skills.updated": SkillsUpdatedNotification;
1020
1045
  "session.info": SessionInfoNotification;
1046
+ "session.recovery_pending": SessionRecoveryPendingNotification;
1021
1047
  "permission.rule_updated": PermissionRuleUpdatedNotification;
1022
1048
  "team.member.notification": TeamMemberNotification;
1023
1049
  "turn.usage_update": TurnUsageUpdateNotification;
@@ -0,0 +1,16 @@
1
+ /**
2
+ * 长任务进度通知(IM 渠道体验):IM 里看不到工具流,超过 minIntervalMs 的轮次
3
+ * 以节流方式发 turn.progress,由 gateway/IM 桥接渲染成一条简短进度文本。
4
+ * 桌面端 UI 已有工具流展示,gateway 可按渠道选择忽略此通知。
5
+ */
6
+ export interface TurnProgressNotifierOptions {
7
+ turnId: string;
8
+ send: (method: string, params: Record<string, unknown>) => void;
9
+ /** 两条进度通知的最小间隔;默认 10s。 */
10
+ minIntervalMs?: number;
11
+ now?: () => number;
12
+ }
13
+ export interface TurnProgressNotifier {
14
+ onToolResult(toolName: string): void;
15
+ }
16
+ export declare function createTurnProgressNotifier(options: TurnProgressNotifierOptions): TurnProgressNotifier;
@@ -6,13 +6,14 @@
6
6
  *
7
7
  * Reference: AionUI AcpDetector + ACP_BACKENDS_ALL registry.
8
8
  */
9
- import type { AcpBackendConfig, AgentDescriptor, AgentConfigStoreData, AuthPreference } from "../../protocol/wire/acp-agent-management.js";
9
+ import type { AcpBackendConfig, AgentDescriptor, CustomAgentDef, AgentConfigStoreData, AuthPreference } from "../../protocol/wire/acp-agent-management.js";
10
10
  export declare const ACP_BACKENDS: Record<string, AcpBackendConfig>;
11
11
  export declare const AGENT_CATALOG_IDS: readonly ["claude", "codex", "gemini", "copilot", "cursor", "qwen", "kimi", "glm", "opencode", "kiro", "qoder", "openclaw", "hermes"];
12
12
  /** Merged catalog entry (base ACP config + grid/install metadata) for one id. */
13
13
  export declare function getCatalogEntry(id: string): AcpBackendConfig | undefined;
14
14
  /** Ordered curated catalog: base ACP config merged with grid/install metadata. */
15
15
  export declare function getAgentCatalog(): AcpBackendConfig[];
16
+ export declare function buildInternalAgentDescriptors(): AgentDescriptor[];
16
17
  export declare function resolveWindowsCopilotLoader(): string | null;
17
18
  export declare function getNpmInstallPackageName(command: string | undefined): string | null;
18
19
  export declare function compareSemverVersions(a: string, b: string): number;
@@ -134,6 +135,24 @@ export declare function resolveCatalogKeyEnv(entry: AcpBackendConfig | undefined
134
135
  * Returns [] when not in account mode (or the agent has no account path — claude is coerced to auto).
135
136
  */
136
137
  export declare function resolveSuppressEnvKeys(entry: AcpBackendConfig | undefined, mode: AuthPreference, sources?: CatalogKeySources): string[];
138
+ /**
139
+ * Build a backend's descriptor from already-resolved cliPath/version (+ the caller-resolved
140
+ * hasConfig flag). Shared by AcpDetector's sync and async detection paths so they can never drift
141
+ * (status rules, copilot's version-required gate, etc.) — extracted to a standalone, IO-free, pure
142
+ * function (not a class method) so it is directly unit-testable without spawning a real CLI.
143
+ *
144
+ * sessionHistory (Task 1.2, third-party native session discovery): "native-cwd" only for an
145
+ * INSTALLED (status "available") codex or claude backend — the two agents whose native CWD-scoped
146
+ * session stores we've actually adapted to. Every other case — not-installed codex/claude, any other
147
+ * backend regardless of install state — falls back to "own". Unadapted agents ALWAYS get "own"; this
148
+ * is a hard invariant, not a default that later widens implicitly.
149
+ */
150
+ export declare function assembleBackendDescriptor(backend: AcpBackendConfig, cliPath: string | null, version: string | null, hasConfig: boolean): AgentDescriptor;
151
+ /** Build a user-registered custom agent's descriptor. Extracted to a standalone, IO-free, pure
152
+ * function for the same testability reason as {@link assembleBackendDescriptor}. Custom agents are
153
+ * never adapted for native session discovery — regardless of what id/name the user gives them —
154
+ * so sessionHistory is always "own" (the hard own-by-default invariant). */
155
+ export declare function assembleCustomAgentDescriptor(custom: CustomAgentDef, cliPath: string | null, hasConfig: boolean): AgentDescriptor;
137
156
  export declare class AcpDetector {
138
157
  private cache;
139
158
  private configStore;
@@ -165,20 +184,20 @@ export declare class AcpDetector {
165
184
  */
166
185
  scanAsync(force?: boolean): Promise<AgentDescriptor[]>;
167
186
  private runScanAsync;
168
- /** Return cached results without IO. */
187
+ /**
188
+ * Return cached results without IO. 冷缓存时后台预热(scanAsync)并返回 [],
189
+ * 绝不在 RPC 路径上同步 scan —— 同步探测(11-18s+)会饿死单线程引擎循环
190
+ * (x/product.confirm 60s 超时的根因)。调用方按"稍后再查"处理空列表。
191
+ */
169
192
  list(): AgentDescriptor[];
170
193
  /** Clear the detection cache. */
171
194
  clearCache(): void;
172
195
  private detectBackend;
173
196
  /** Async, NON-BLOCKING twin of {@link detectBackend} — identical detection, async probes. */
174
197
  private detectBackendAsync;
175
- /** Build a backend's descriptor from already-resolved cliPath/version. Shared by the sync and async
176
- * detection paths so they can never drift (status rules, copilot's version-required gate, etc.). */
177
- private assembleBackendDescriptor;
178
198
  private detectCustomAgent;
179
199
  /** Async, NON-BLOCKING twin of {@link detectCustomAgent}. */
180
200
  private detectCustomAgentAsync;
181
- private assembleCustomAgentDescriptor;
182
201
  private hasAgentConfig;
183
202
  /**
184
203
  * Descriptor for qlogicagent participating in Solo/Product as a self-hosted ACP agent.
@@ -197,6 +216,21 @@ export declare class AcpDetector {
197
216
  * Returns null if the agent is not available.
198
217
  */
199
218
  buildExternalDescriptor(agentId: string): import("../../protocol/wire/acp-agent-management.js").ExternalAgentDescriptor | null;
219
+ /**
220
+ * Async, NON-BLOCKING twin of {@link buildExternalDescriptor} — identical output for the same
221
+ * detector state, but resolves the agent list via {@link scanAsync} (a real probe, awaited, when
222
+ * the cache is cold) instead of the sync {@link list}'s cache-or-empty shortcut. Load-bearing for
223
+ * `agents.warm` (agents-handler.ts): the sync path's detect calls are cache-fronted today, but
224
+ * that non-blocking guarantee is an implementation detail of `list()` — routing the RPC path
225
+ * through this method instead makes "never synchronously probe on this path" an explicit
226
+ * contract that can't silently regress if `list()`'s internals change later.
227
+ */
228
+ buildExternalDescriptorAsync(agentId: string): Promise<import("../../protocol/wire/acp-agent-management.js").ExternalAgentDescriptor | null>;
229
+ /** Shared descriptor-assembly logic for {@link buildExternalDescriptor} and
230
+ * {@link buildExternalDescriptorAsync} — everything AFTER "locate this agentId's AgentDescriptor
231
+ * in an already-resolved list", so the sync/async twins can never drift on behavior, only on how
232
+ * they obtain `agents`. */
233
+ private assembleExternalDescriptorFromAgents;
200
234
  /**
201
235
  * Whether an agent is ready to compete in Solo/Product: installed/available AND configured.
202
236
  * qlogicagent self-resolves from the owner profile (always ready). External agents need a usable
@@ -151,7 +151,20 @@ export declare class AcpProtocolAdapter {
151
151
  mcpServers?: McpServerConfig[];
152
152
  additionalDirectories?: string[];
153
153
  systemPrompt?: string;
154
+ /** Platform/managed model to select over ACP after session/new (see selectSessionModel). */
155
+ model?: string;
154
156
  }): Promise<AcpSessionResult>;
157
+ /**
158
+ * Select the platform/managed model over ACP after session/new. External CLIs (notably
159
+ * claude-code-acp) default to their OWN model (e.g. Sonnet 4.5) and merely EXPOSE the injected
160
+ * ANTHROPIC_MODEL/OPENAI_MODEL as an "available" option — they do NOT select it. Left on the default,
161
+ * the first prompt fails ("issue with the selected model …") because the platform shelf has no such
162
+ * model, and it surfaces as a cryptic "Agent process stdio closed". Best-effort: when the agent
163
+ * advertised its models, only switch if it offers `desired` and isn't already on it; otherwise attempt
164
+ * anyway and swallow rejection (the session still exists on its default model — the wrong-model prompt
165
+ * error is the backstop). Uses the generic sendRequest because the SDK has no typed set_model yet.
166
+ */
167
+ private selectSessionModel;
155
168
  /**
156
169
  * Send a prompt to a running ACP session (session/prompt). Content streams back via session/update
157
170
  * notifications during execution; the response carries only { stopReason, usage? }. On timeout the
@@ -165,6 +178,7 @@ export declare class AcpProtocolAdapter {
165
178
  resumeSession(_child: ChildProcess, sessionId: string, options?: {
166
179
  cwd?: string;
167
180
  mcpServers?: McpServerConfig[];
181
+ model?: string;
168
182
  }): Promise<AcpSessionResult>;
169
183
  /**
170
184
  * Translate an ACP notification into qlogicagent's internal format.
@@ -52,6 +52,14 @@ export interface AgentProcessConfig {
52
52
  mcpServers?: McpServerConfig[];
53
53
  /** System prompt to inject into ACP session. */
54
54
  systemPrompt?: string;
55
+ /**
56
+ * Cut 5 — RESUME a third-party native session (ACP session/load, replays history) instead of
57
+ * creating a fresh one. The id is the agent's OWN native session id (codex rollout id / claude
58
+ * UUID). Only honored when the agent advertised loadSession at initialize (handle.supportsResume);
59
+ * otherwise spawn throws — we never silently open a blank session ("fake continuation" is forbidden
60
+ * by the Phase 2 design).
61
+ */
62
+ resumeSessionId?: string;
55
63
  }
56
64
  export declare function buildExternalAcpSpawnCommand(cliPath: string, acpArgs: string[]): {
57
65
  command: string;
@@ -160,6 +168,7 @@ export declare function applyExternalDescriptorEnv(env: Record<string, string>,
160
168
  env?: Record<string, string>;
161
169
  suppressEnvKeys?: string[];
162
170
  }): Record<string, string>;
171
+ export declare function buildChildEnv(config: AgentProcessConfig): Record<string, string>;
163
172
  /**
164
173
  * Build LLM-related environment variables for an external ACP teammate.
165
174
  *
@@ -295,6 +304,13 @@ export declare class AgentProcessManager {
295
304
  isAlive(memberId: string): boolean;
296
305
  /** Get usage tracker for an ACP agent (returns null for internal agents). */
297
306
  getUsageTracker(memberId: string): AcpUsageTracker | null;
307
+ /**
308
+ * The agent-assigned native session id (from ACP session/new or session/load) for a pooled member,
309
+ * once its session exists — undefined before creation. For native-cwd agents (codex/claude) this is
310
+ * the id under which the agent persists its OWN transcript (e.g. claude's ~/.claude uuid), distinct
311
+ * from the engine/stream id; used to converge on a single session identity (own/native unification).
312
+ */
313
+ getNativeSessionId(memberId: string): string | undefined;
298
314
  /**
299
315
  * Feed token usage into the tracker from a child notification (Tier 1). Handles all three shapes a
300
316
  * child may use so the tracker is actually populated:
@@ -20,11 +20,11 @@ export declare function buildAstraClawCapabilitiesSystemPrompt(input: {
20
20
  mcpAvailable: boolean;
21
21
  availableToolNames?: Iterable<string>;
22
22
  currentEnvironment?: string;
23
- }): string | undefined;
23
+ }): Promise<string | undefined>;
24
24
  export declare function buildAstraClawCapabilitiesPromptPreamble(input: {
25
25
  projectRoot: string;
26
26
  mcpAvailable: boolean;
27
27
  availableToolNames?: Iterable<string>;
28
28
  currentEnvironment?: string;
29
- }): string | undefined;
29
+ }): Promise<string | undefined>;
30
30
  export declare function handleAstraClawCapabilityToolCall(input: AstraClawCapabilityToolInput): Promise<AstraClawCapabilityToolResult>;
@@ -0,0 +1,31 @@
1
+ export interface SeedBuiltinSkillsOptions {
2
+ /** Global skill store dir (getUserSkillsDir()). Each skill lands at <storeDir>/<name>/SKILL.md. */
3
+ storeDir: string;
4
+ /** Override the shipped builtin-skills source dir; defaults to the packaged skills/builtin. */
5
+ builtinDir?: string;
6
+ }
7
+ export interface SeedBuiltinSkillsResult {
8
+ /** Names of skills newly copied this run (empty when all already present or source missing). */
9
+ seeded: string[];
10
+ }
11
+ /**
12
+ * Locate the shipped skills/builtin directory from a module directory.
13
+ *
14
+ * The module dir differs by packaging mode — crucially, the production build is an esbuild
15
+ * BUNDLE: this module is inlined into dist/cli.js, so at runtime import.meta.url resolves to
16
+ * dist/cli.js itself, NOT dist/runtime/infra/... Probe candidates in order:
17
+ * 1. hereDir/skills/builtin — bundle: hereDir = dist/ → dist/skills/builtin
18
+ * (build.mjs copies skills/builtin there).
19
+ * 2. hereDir/../../skills/builtin — unbundled dist module at dist/runtime/infra/.
20
+ * 3. hereDir/../../../skills/builtin — dev/tsx/vitest: src/runtime/infra → repo-root skills/builtin.
21
+ * Returns the first candidate that exists, or undefined when none does (stripped-down build).
22
+ * Exported pure (hereDir in → path out) so tests can drive it against synthetic layouts.
23
+ */
24
+ export declare function resolveBuiltinDirFrom(hereDir: string): string | undefined;
25
+ /**
26
+ * Copy each builtin skill directory into the store only when its target does not yet exist.
27
+ * Idempotent: a second run with everything already present returns { seeded: [] }.
28
+ * Missing builtinDir is not an error — returns { seeded: [] } so a stripped-down build
29
+ * (or a local checkout without the assets) never blocks startup.
30
+ */
31
+ export declare function seedBuiltinSkills(options: SeedBuiltinSkillsOptions): SeedBuiltinSkillsResult;
@@ -1,4 +1,4 @@
1
- import type { ModelCapabilityProfile, ModelEntry, ModelRegistry, ReasoningMode } from "./model-registry.js";
1
+ import type { ModelCapabilityProfile, ModelEntry, ModelPurpose, ModelRegistry, ReasoningMode } from "./model-registry.js";
2
2
  import type { ConfigPort } from "../ports/index.js";
3
3
  export declare const LLMROUTER_CATALOG_UNAVAILABLE_MESSAGE = "\u65E0\u6CD5\u8FDE\u63A5 llmrouter \u6A21\u578B\u76EE\u5F55";
4
4
  export declare const LLMROUTER_PROVIDER_ID = "llmrouter";
@@ -97,14 +97,34 @@ export declare function refreshRegistryFromLlmrouterApiKey(registry: ModelRegist
97
97
  forceCatalog?: boolean;
98
98
  }): Promise<ModelEntry[]>;
99
99
  export declare function resetLlmrouterCatalogClientCache(): void;
100
+ export interface DefaultBindingsResult {
101
+ /** 本次真正写入的绑定(用途 → modelId)。 */
102
+ applied: Array<{
103
+ purpose: ModelPurpose;
104
+ modelId: string;
105
+ }>;
106
+ /** 跳过的用途 + 原因(已有配置不覆盖 / 该用途 llmrouter 无可用模型)。 */
107
+ skipped: Array<{
108
+ purpose: ModelPurpose;
109
+ reason: "already-bound" | "no-model";
110
+ }>;
111
+ }
100
112
  /**
101
- * 零配置默认模型:全新安装(无 textGeneration binding)且网关注入了设备账号推理 key 时,
102
- * 自动把默认文本模型设为一个 DeepSeek(经 llmrouter)。调用方需先刷新过目录(this.models 里要有
103
- * `llmrouter:deepseek-*` 条目)。已有 binding 则尊重用户配置、不覆盖。返回是否设置了默认。
113
+ * 零配置默认绑定:给一组「安全」用途补上 llmrouter 默认模型 —— **只补空白**,已有 binding 的用途一律
114
+ * 不动(尊重用户/老配置)。每用途三级挑选:①服务端推荐(模型 capability_profile.default_for 声明本
115
+ * 用途)优先 → ②回退硬编码偏好子串(DEFAULT_BINDING_PREFERENCES,向后兼容) ③再回退该用途第一个
116
+ * 可用模型;都没有则不绑。**「哪些用途该默认绑」是客户端产品边界(安全白名单),「每用途选哪个模型」
117
+ * 交服务端** —— 两层职责分离,llmrouter 换模型客户端零发版跟随。
104
118
  *
105
- * key 不在此注册 —— ModelRegistry 取 llmrouter key 时会回退到 QLOGIC_LLMROUTER_INFERENCE_KEY env。
119
+ * 触发场景:①agent 启动(设备账号推理 key 注入后,stdio-server) ②刷新目录后(settings refresh)
120
+ * ③手动添加 llmrouter key。"有没有 llmrouter 可用"由 listModels 结果隐含——refresh 成功(key 有效)
121
+ * 才有 llmrouter 模型条目;无则每个用途 no-model 跳过、不绑。key 不在此注册(ModelRegistry 取 llmrouter
122
+ * key 时回退到 QLOGIC_LLMROUTER_INFERENCE_KEY env 或用户 key)。调用方需先刷新过目录。
106
123
  */
107
- export declare function ensureLlmrouterDefaultBinding(registry: ModelRegistry, configPort?: ConfigPort): boolean;
124
+ export declare function ensureLlmrouterDefaultBindings(registry: ModelRegistry, opts?: {
125
+ requireInferenceKey?: boolean;
126
+ configPort?: ConfigPort;
127
+ }): DefaultBindingsResult;
108
128
  export declare function toModelEntry(model: LlmrouterCatalogModel): ModelEntry | null;
109
129
  export declare function toModelEntries(model: LlmrouterCatalogModel): ModelEntry[];
110
130
  export {};