qlogicagent 2.19.1 → 2.19.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (76) hide show
  1. package/dist/agent-contract.js +1 -1
  2. package/dist/cli.js +1 -1
  3. package/dist/host-contract.js +1 -1
  4. package/dist/host-session-collection-contract.js +1 -0
  5. package/dist/index.js +478 -505
  6. package/dist/pet-host.js +8 -8
  7. package/dist/project-memory-host.js +23 -23
  8. package/dist/protocol.js +1 -1
  9. package/dist/types/cli/acp-commands.d.ts +1 -1
  10. package/dist/types/cli/acp-extended-handlers.d.ts +2 -8
  11. package/dist/types/cli/acp-extended-host-adapter.d.ts +0 -11
  12. package/dist/types/cli/acp-session-host.d.ts +2 -0
  13. package/dist/types/cli/core-tool-coordinator.d.ts +0 -9
  14. package/dist/types/cli/default-project-bootstrap.d.ts +2 -32
  15. package/dist/types/cli/handlers/session-handler.d.ts +0 -43
  16. package/dist/types/cli/handlers/solo-handler.d.ts +3 -14
  17. package/dist/types/cli/multi-agent-handler-host.d.ts +3 -16
  18. package/dist/types/cli/product-coordinator.d.ts +3 -14
  19. package/dist/types/cli/rpc-registry.d.ts +0 -2
  20. package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -1
  21. package/dist/types/cli/stdio-server.d.ts +1 -2
  22. package/dist/types/host-contract/index.d.ts +110 -18
  23. package/dist/types/host-session-collection-contract.d.ts +61 -0
  24. package/dist/types/orchestration/agent-instance.d.ts +4 -11
  25. package/dist/types/orchestration/agent-roster.d.ts +4 -4
  26. package/dist/types/orchestration/delegate-bridge.d.ts +8 -0
  27. package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -3
  28. package/dist/types/orchestration/product-persistence.d.ts +0 -4
  29. package/dist/types/orchestration/product-planner.d.ts +4 -6
  30. package/dist/types/orchestration/solo-evaluator.d.ts +2 -5
  31. package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +2 -1
  32. package/dist/types/orchestration/testing/host-agent-provider-directory-fixture.d.ts +7 -0
  33. package/dist/types/orchestration/workflow/qla-executor-host.d.ts +1 -1
  34. package/dist/types/protocol/agent-contract.d.ts +9 -3
  35. package/dist/types/protocol/methods.d.ts +20 -38
  36. package/dist/types/protocol/notifications.d.ts +1 -1
  37. package/dist/types/protocol/wire/acp-agent-management.d.ts +2 -190
  38. package/dist/types/protocol/wire/acp-protocol.d.ts +0 -4
  39. package/dist/types/protocol/wire/agent-methods.d.ts +1 -243
  40. package/dist/types/protocol/wire/gateway-rpc.d.ts +343 -15
  41. package/dist/types/protocol/wire/index.d.ts +3 -3
  42. package/dist/types/protocol/wire/notification-payloads.d.ts +48 -134
  43. package/dist/types/runtime/infra/host-agent-provider-directory.d.ts +17 -0
  44. package/dist/types/runtime/infra/project-authority-facade.d.ts +1 -1
  45. package/dist/types/runtime/infra/project-data-paths.d.ts +2 -1
  46. package/dist/types/runtime/infra/project-host-authority.d.ts +3 -2
  47. package/dist/types/runtime/infra/project-store.d.ts +4 -39
  48. package/dist/types/runtime/session/session-catalog.d.ts +0 -12
  49. package/dist/types/runtime/session/session-persistence.d.ts +1 -1
  50. package/dist/types/runtime/session/session-resource-key.d.ts +1 -1
  51. package/dist/types/runtime/session/session-types.d.ts +0 -23
  52. package/dist/types/transport/acp-server.d.ts +2 -10
  53. package/dist/workflow-host.js +10 -10
  54. package/package.json +8 -1
  55. package/dist/types/cli/agent-config-coordinator.d.ts +0 -27
  56. package/dist/types/cli/agent-config-runtime.d.ts +0 -11
  57. package/dist/types/cli/agent-status-notifier.d.ts +0 -11
  58. package/dist/types/cli/handlers/agents-handler.d.ts +0 -126
  59. package/dist/types/cli/handlers/project-handler.d.ts +0 -36
  60. package/dist/types/cli/project-command-service.d.ts +0 -28
  61. package/dist/types/orchestration/delegation-coordinator.d.ts +0 -100
  62. package/dist/types/runtime/infra/acp-detector.d.ts +0 -273
  63. package/dist/types/runtime/infra/agent-config-store.d.ts +0 -30
  64. package/dist/types/runtime/infra/agent-install-runner.d.ts +0 -80
  65. package/dist/types/runtime/infra/external-agent-approvals.d.ts +0 -59
  66. package/dist/types/runtime/infra/migrate-device-scope.d.ts +0 -49
  67. package/dist/types/runtime/infra/project-data-gc.d.ts +0 -15
  68. package/dist/types/runtime/session/native/claude-session-source.d.ts +0 -23
  69. package/dist/types/runtime/session/native/codex-index.d.ts +0 -21
  70. package/dist/types/runtime/session/native/codex-session-source.d.ts +0 -31
  71. package/dist/types/runtime/session/native/cwd-normalize.d.ts +0 -53
  72. package/dist/types/runtime/session/native/ephemeral-rollout-sweep.d.ts +0 -13
  73. package/dist/types/runtime/session/native/native-cwd-agents.d.ts +0 -17
  74. package/dist/types/runtime/session/native/native-session-source.d.ts +0 -89
  75. package/dist/types/runtime/session/native/native-title.d.ts +0 -1
  76. package/dist/types/runtime/session/native/register-builtin-sources.d.ts +0 -1
@@ -11,6 +11,9 @@
11
11
  * 标注 [S1 补定] 的辅助类型是 freeze 引用但未给定义的最小结构,属 S1 评审点,
12
12
  * 其字段以 freeze 正文/recon 注释为据;实现 lane 负责与现状 store 形状做映射。
13
13
  */
14
+ import type { NativeTranscript } from "../host-session-collection-contract.js";
15
+ export type { HostSessionCollectionDelta, HostSessionCollectionScope, HostSessionCollectionSnapshot, HostSessionLifecycle, HostSessionProviderDiagnostic, HostSessionSummary, HostSessionTitleSource, NativeTranscript, NativeTranscriptMessage, } from "../host-session-collection-contract.js";
16
+ export { isHostSessionCollectionDelta, isHostSessionCollectionSnapshot, isNativeTranscript, } from "../host-session-collection-contract.js";
14
17
  export * from "./provider-profile.js";
15
18
  /** agent 逻辑身份(小智自身也是一个 agentId="qlogicagent")。自身 vs 第三方仅由此值决定(F2)。 */
16
19
  export type AgentId = string;
@@ -203,7 +206,7 @@ export interface SessionMeta {
203
206
  /** 主 agent(创建即锁定,severe 禁中途切换) */
204
207
  agentId: AgentId;
205
208
  cwd: string;
206
- /** 每 native agent 的原生会话 id 映射(现状单 nativeBinding 由 importer 迁入,见 N2) */
209
+ /** 每 native agent 的原生会话 id 映射(现状旧单值映射由 importer 迁入,见 N2) */
207
210
  nativeSessionIds?: Record<AgentId, string>;
208
211
  lifecycle: string;
209
212
  }
@@ -213,22 +216,36 @@ export interface NativeSessionSummary {
213
216
  updatedAt: number;
214
217
  title?: string;
215
218
  }
216
- /**
217
- * 原生会话索引提供者(codex-index 上移网关):按 agentId 读该 agent 的 native 会话目录(~/.codex 等)。
218
- * 语义 = 索引/发现,NOT transcript owner(freeze §9 边界)。home/env 由 AgentDescriptor/CredentialResolver 供。
219
- * qlogicagent 不再承担读取点(否则 session plane 又漏回 agent)。
220
- */
221
- export interface NativeSessionIndexProvider {
222
- /** 仅 native-cwd 后端(codex/claude)有 provider */
219
+ export interface NativeProjectContext {
220
+ projectId: ProjectId;
221
+ cwd: string;
222
+ }
223
+ export interface NativeSessionRef {
223
224
  agentId: AgentId;
224
- listNativeSessions(ctx: {
225
- projectId: ProjectId;
226
- cwd: string;
227
- }): NativeSessionSummary[];
228
- resolveNativeResumeId(sessionId: CanonicalSessionId, ctx: {
229
- cwd: string;
230
- }): string | undefined;
225
+ projectId: ProjectId;
226
+ nativeId: string;
231
227
  }
228
+ export interface NativeSessionDetail extends NativeSessionSummary {
229
+ createdAt?: number;
230
+ messageCount?: number;
231
+ }
232
+ export interface NativeSessionProvider {
233
+ readonly agentId: AgentId;
234
+ list(ctx: NativeProjectContext): Promise<NativeSessionSummary[]>;
235
+ get(nativeId: string, ctx: NativeProjectContext): Promise<NativeSessionDetail | undefined>;
236
+ loadTranscript(nativeId: string, ctx: NativeProjectContext): Promise<NativeTranscript>;
237
+ exists(nativeId: string, ctx: NativeProjectContext): Promise<boolean>;
238
+ }
239
+ export type ProjectAgentSessionEntry = {
240
+ source: "host";
241
+ canonicalSessionId: CanonicalSessionId;
242
+ nativeRef?: NativeSessionRef;
243
+ title?: string;
244
+ } | {
245
+ source: "native-unadopted";
246
+ nativeRef: NativeSessionRef;
247
+ title?: string;
248
+ };
232
249
  /**
233
250
  * 拥有会话存储 + 项目作用域 + agentId 绑定 + canonical↔native 映射 + 生命周期状态。
234
251
  * 唯一权威(不与 qlogicagent 并存)。崩溃恢复靠网关持有并重放(freeze §11.4#5)。
@@ -674,7 +691,7 @@ export interface SupervisorEventSink {
674
691
  }): void;
675
692
  /**
676
693
  * media:统一 {mediaType,url,model,provider}(非 imageUrls[])。⚠R3:external agent 今天不发此事件
677
- * (codex 图像漏成 tool_call),cutover 必须补 agents.prompt.media relay,否则 external media 无一等来源。
694
+ * Provider media must arrive as a first-class lifecycle event, never only as a generic tool call.
678
695
  */
679
696
  onMedia(e: EvBase & {
680
697
  mediaType: string;
@@ -1079,7 +1096,78 @@ export interface HostSkillInvocationResult {
1079
1096
  /** 单文件读取上限;host 在解码前按 bytes 检查。 */
1080
1097
  export declare const HOST_SKILL_FILE_MAX_BYTES: number;
1081
1098
  /** [X7-P] 单一 agent→host 一元请求通道的服务域。 */
1082
- export type HostRequestService = "memory" | "projectMemory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project" | "runState" | "pet";
1099
+ export type HostRequestService = "memory" | "projectMemory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project" | "runState" | "pet" | "provider";
1100
+ /** Read-only Provider projection exposed by the Gateway Host to supervised qlogicagent compute. */
1101
+ export declare const HOST_PROVIDER_PROXY_METHODS: readonly ["list", "get", "diagnose"];
1102
+ export type HostProviderProxyMethod = typeof HOST_PROVIDER_PROXY_METHODS[number];
1103
+ export type HostAgentProviderState = "installed" | "auth_required" | "ready" | "disabled" | "incompatible" | "unresponsive" | "failed";
1104
+ export type HostAgentProviderDiagnosticState = HostAgentProviderState | "not_installed";
1105
+ export type HostAgentProviderDiagnosticStage = "install" | "manifest" | "auth" | "launch" | "initialize" | "models" | "native_sessions" | "request";
1106
+ export type HostAgentProviderModelAuthority = {
1107
+ kind: "provider";
1108
+ enumeration: "protocol" | "implicit-default";
1109
+ } | {
1110
+ kind: "host";
1111
+ managedPurposes: string[];
1112
+ };
1113
+ export interface HostAgentProviderDiagnostic {
1114
+ providerId: string;
1115
+ state: HostAgentProviderDiagnosticState;
1116
+ stage: HostAgentProviderDiagnosticStage;
1117
+ code: string;
1118
+ message: string;
1119
+ retryable: boolean;
1120
+ providerVersion?: string;
1121
+ payloadVersion?: string;
1122
+ }
1123
+ export interface HostAgentProviderSnapshot {
1124
+ providerId: string;
1125
+ displayName: string;
1126
+ version: string;
1127
+ state: HostAgentProviderState;
1128
+ capabilities: {
1129
+ execution: {
1130
+ streaming: boolean;
1131
+ approvals: boolean;
1132
+ cancellation: boolean;
1133
+ resume: boolean;
1134
+ };
1135
+ auth: {
1136
+ modes: Array<"account" | "userKey" | "managed">;
1137
+ terminal: boolean;
1138
+ logout: boolean;
1139
+ };
1140
+ models: HostAgentProviderModelAuthority;
1141
+ nativeSessions: {
1142
+ discover: boolean;
1143
+ transcript: boolean;
1144
+ resume: boolean;
1145
+ };
1146
+ diagnostics: {
1147
+ readiness: true;
1148
+ version: true;
1149
+ structuredErrors: true;
1150
+ };
1151
+ };
1152
+ diagnostic?: HostAgentProviderDiagnostic;
1153
+ }
1154
+ export interface HostAgentProviderListResult {
1155
+ revision: number;
1156
+ providers: HostAgentProviderSnapshot[];
1157
+ }
1158
+ export interface HostAgentProviderGetResult {
1159
+ revision: number;
1160
+ provider: HostAgentProviderSnapshot | null;
1161
+ }
1162
+ export type HostProviderRequestParams = {
1163
+ service: "provider";
1164
+ method: "list";
1165
+ params: [];
1166
+ } | {
1167
+ service: "provider";
1168
+ method: "get" | "diagnose";
1169
+ params: [providerId: string];
1170
+ };
1083
1171
  /** Preview Browser 的七个允许动作;tool 与 gateway 必须消费此单源。 */
1084
1172
  export declare const PREVIEW_BROWSER_ACTIONS: readonly ["navigate", "snapshot", "click", "type", "screenshot", "console", "network"];
1085
1173
  export type PreviewBrowserAction = (typeof PREVIEW_BROWSER_ACTIONS)[number];
@@ -1584,7 +1672,7 @@ export type HostPreviewRequestParams = {
1584
1672
  * [X7-P] 跨进程 HostRequest 判别联合。memory/profile/preview 共用 `x/host.request`,
1585
1673
  * service + method 二级分派;preview 的 method 与 payload 在类型层保持逐动作关联。
1586
1674
  */
1587
- export type HostRequestParams = HostMemoryRequestParams | HostProjectMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams | HostRunStateRequestParams | HostPetRequestParams;
1675
+ export type HostRequestParams = HostMemoryRequestParams | HostProjectMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams | HostRunStateRequestParams | HostPetRequestParams | HostProviderRequestParams;
1588
1676
  /** initialize 声明的真实已装配 host-request 服务;version 只接受冻结版本 1。 */
1589
1677
  export type HostRequestCapability = {
1590
1678
  version: 1;
@@ -1601,6 +1689,10 @@ export declare function isHostSkillMutationResult(value: unknown): value is Host
1601
1689
  export declare function isHostApplyCuratorPlanResult(value: unknown): value is HostApplyCuratorPlanResult;
1602
1690
  export declare function isHostPrepareSkillInstallResult(value: unknown): value is HostPrepareSkillInstallResult;
1603
1691
  export declare function isHostFinalizeSkillInstallResult(value: unknown): value is HostFinalizeSkillInstallResult;
1692
+ export declare function isHostAgentProviderDiagnostic(value: unknown): value is HostAgentProviderDiagnostic;
1693
+ export declare function isHostAgentProviderSnapshot(value: unknown): value is HostAgentProviderSnapshot;
1694
+ export declare function isHostAgentProviderListResult(value: unknown): value is HostAgentProviderListResult;
1695
+ export declare function isHostAgentProviderGetResult(value: unknown): value is HostAgentProviderGetResult;
1604
1696
  export declare function isHostSessionLoadForResumeResult(value: unknown): value is HostSessionLoadForResumeResult;
1605
1697
  export declare function isHostSessionAppendResult(value: unknown): value is HostSessionAppendResult;
1606
1698
  export declare function isHostSessionMutationResult(value: unknown): value is HostSessionMutationResult;
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Browser-safe Host session collection protocol.
3
+ *
4
+ * This is the common protocol layer shared by Gateway and renderer clients. It intentionally has
5
+ * no Node/runtime imports; Host services and native Providers remain behind the Gateway facade.
6
+ */
7
+ import type { AgentId, CanonicalSessionId, NativeSessionRef, ProjectId } from "./host-contract/index.js";
8
+ export type HostSessionTitleSource = "prompt" | "generated" | "user" | "native" | "repaired";
9
+ export type HostSessionLifecycle = "active" | "archived" | "source-missing" | "resume-unavailable";
10
+ export type HostSessionCollectionScope = {
11
+ kind: "project";
12
+ projectId: ProjectId;
13
+ } | {
14
+ kind: "workspace-tree";
15
+ };
16
+ export interface HostSessionSummary {
17
+ resourceId: string;
18
+ canonicalSessionId?: CanonicalSessionId;
19
+ source: "host" | "native-unadopted";
20
+ projectId: ProjectId;
21
+ agentId: AgentId;
22
+ title?: string;
23
+ titleSource?: HostSessionTitleSource;
24
+ lastActiveAt: string;
25
+ lifecycle: HostSessionLifecycle;
26
+ nativeRef?: NativeSessionRef;
27
+ }
28
+ export interface HostSessionProviderDiagnostic {
29
+ agentId: AgentId;
30
+ projectId: ProjectId;
31
+ code: string;
32
+ message: string;
33
+ lastGoodRevision?: number;
34
+ }
35
+ export interface HostSessionCollectionSnapshot {
36
+ revision: number;
37
+ scopeGeneration: number;
38
+ items: HostSessionSummary[];
39
+ diagnostics: HostSessionProviderDiagnostic[];
40
+ }
41
+ export interface HostSessionCollectionDelta {
42
+ revision: number;
43
+ scopeGeneration: number;
44
+ addedOrUpdated?: HostSessionSummary[];
45
+ removed?: string[];
46
+ diagnostics?: HostSessionProviderDiagnostic[];
47
+ }
48
+ /** Provider-owned transcript wire shape. The renderer consumes this exact shape through Host RPC. */
49
+ export interface NativeTranscriptMessage {
50
+ id?: string;
51
+ role: "user" | "assistant" | "tool";
52
+ content: unknown;
53
+ createdAt?: string;
54
+ }
55
+ export interface NativeTranscript {
56
+ messages: NativeTranscriptMessage[];
57
+ diagnostics?: unknown[];
58
+ }
59
+ export declare function isNativeTranscript(value: unknown): value is NativeTranscript;
60
+ export declare function isHostSessionCollectionSnapshot(value: unknown): value is HostSessionCollectionSnapshot;
61
+ export declare function isHostSessionCollectionDelta(value: unknown): value is HostSessionCollectionDelta;
@@ -11,13 +11,12 @@
11
11
  * 4. product.resume → load state, resume scheduling
12
12
  * 5. product.checkpoint → manual checkpoint
13
13
  */
14
- import type { AcpDetector } from "../runtime/infra/acp-detector.js";
15
- import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
14
+ import type { HostAgentProviderDirectory } from "../runtime/infra/host-agent-provider-directory.js";
16
15
  import type { ProductPhase, ProductCreateParams, ProductStatus, ProductSummary } from "../protocol/wire/acp-agent-management.js";
17
16
  import { type PlannerMemoryContext } from "./planner-memory-brief.js";
18
17
  import type { DagMutation } from "./product-planner.js";
19
18
  import type { ProductLeaderCoordinator } from "./product-run-coordinator.js";
20
- import type { DelegateBridge } from "./delegation-coordinator.js";
19
+ import type { DelegateBridge } from "./delegate-bridge.js";
21
20
  export type { ProductLeaderCoordinator } from "./product-run-coordinator.js";
22
21
  export interface ProductCallbacks {
23
22
  log?: {
@@ -85,12 +84,11 @@ export declare function buildTaskContextPrompt(upstream: {
85
84
  output: string;
86
85
  }[], prompt: string): string;
87
86
  export declare class ProductOrchestrator {
88
- private acpDetector;
89
- private configStore;
87
+ private providerDirectory;
90
88
  private callbacks;
91
89
  private leaderCoordinator?;
92
90
  private sessions;
93
- constructor(acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: ProductCallbacks, leaderCoordinator?: ProductLeaderCoordinator | undefined);
91
+ constructor(providerDirectory: HostAgentProviderDirectory, callbacks?: ProductCallbacks, leaderCoordinator?: ProductLeaderCoordinator | undefined);
94
92
  setLeaderCoordinator(leaderCoordinator: ProductLeaderCoordinator): void;
95
93
  /** (a) Owner global cheat-sheet source for member dispatches (cli-injected;
96
94
  * orchestration never imports skills directly). */
@@ -143,11 +141,6 @@ export declare class ProductOrchestrator {
143
141
  * targets a successful-but-wrong task and re-runs forward from it in place.
144
142
  */
145
143
  replayTask(productId: string, taskId: string): Promise<void>;
146
- /** Get product status. */
147
- /** P2-1: the native (codex/claude) session id captured for a delegation's single worker, so the
148
- * DelegationCoordinator can resume it on the next same-(chat×agent) delegation. undefined for a
149
- * multi-instance product, an own agent, or before the worker's first task settles. */
150
- getDelegationNativeSessionId(productId: string): string | undefined;
151
144
  getStatus(productId: string): ProductStatus | null;
152
145
  /** Live DAG progress snapshot for a product (for the planner's execution-phase leader). */
153
146
  getProgressSnapshot(productId: string): {
@@ -1,5 +1,5 @@
1
- import type { AgentRosterEntry, AgentConfigStoreData } from "../protocol/wire/acp-agent-management.js";
2
- import { type AcpDetector } from "../runtime/infra/acp-detector.js";
1
+ import type { HostAgentProviderListResult } from "../host-contract/index.js";
2
+ import type { AgentRosterEntry } from "../protocol/wire/acp-agent-management.js";
3
3
  /** Build the team roster the leader sees during planning: every ready agent with a coarse
4
4
  * strengths hint + its backing model. Leader-only soft hints — NOT a capability contract.
5
5
  *
@@ -14,7 +14,7 @@ import { type AcpDetector } from "../runtime/infra/acp-detector.js";
14
14
  * The leader `qlogicagent` (小智) is ALWAYS present (universal coordinator / fallback executor) — appended
15
15
  * if not already in the roster, so the leader always has ≥1 valid assignee even when the user's picks turn
16
16
  * out unready (or when the pool is empty). */
17
- export declare function buildAgentRoster(detector: AcpDetector, _configStore: AgentConfigStoreData | null, allowedAgents?: string[], options?: {
17
+ export declare function buildAgentRoster(snapshot: Readonly<HostAgentProviderListResult>, allowedAgents?: string[], options?: {
18
18
  injectLeader?: boolean;
19
19
  }): AgentRosterEntry[];
20
20
  /**
@@ -25,7 +25,7 @@ export declare function buildAgentRoster(detector: AcpDetector, _configStore: Ag
25
25
  */
26
26
  export declare function computeUnavailablePicks(allowedAgents: string[] | undefined, rosterIds: readonly string[]): string[];
27
27
  /** buildAgentRoster + the diagnostics of which picked workers were dropped as unavailable. */
28
- export declare function buildAgentRosterWithDiagnostics(detector: AcpDetector, configStore: AgentConfigStoreData | null, allowedAgents?: string[], options?: {
28
+ export declare function buildAgentRosterWithDiagnostics(snapshot: Readonly<HostAgentProviderListResult>, allowedAgents?: string[], options?: {
29
29
  injectLeader?: boolean;
30
30
  }): {
31
31
  roster: AgentRosterEntry[];
@@ -0,0 +1,8 @@
1
+ import type { DelegateRequestParams, SupervisorEventSink, TurnResult } from "../host-contract/index.js";
2
+ /** Authority-neutral transport used by the six orchestration stations to call Gateway-owned workers. */
3
+ export interface DelegateBridge {
4
+ isSupported(): boolean;
5
+ send(params: DelegateRequestParams, sink: SupervisorEventSink): Promise<TurnResult>;
6
+ cancel(delegationId: string): void;
7
+ respond(delegationId: string, approvalId: string, optionId: string): void;
8
+ }
@@ -1,5 +1,5 @@
1
- import type { AcpDetector } from "../runtime/infra/acp-detector.js";
2
- import type { DelegateBridge } from "./delegation-coordinator.js";
1
+ import type { HostAgentProviderDirectory } from "../runtime/infra/host-agent-provider-directory.js";
2
+ import type { DelegateBridge } from "./delegate-bridge.js";
3
3
  import { type PlannerMemoryContext } from "./planner-memory-brief.js";
4
4
  import type { ProductOrchestrator } from "./agent-instance.js";
5
5
  import type { LeaderPort, PhaseRunnerPort } from "./goal-loop-coordinator.js";
@@ -49,7 +49,7 @@ export declare function takeGoalPhaseChangedFiles(productId: string): string[];
49
49
  export declare function extractJson<T>(text: string): T;
50
50
  export interface LeaderAdapterDeps {
51
51
  /** Resolves the leader's external ACP descriptor (product-planner.ts:583). */
52
- acpDetector: AcpDetector;
52
+ providerDirectory: HostAgentProviderDirectory;
53
53
  /** Catalog id of the leader agent (e.g. "qlogicagent"). */
54
54
  leaderAgentId: string;
55
55
  /** Project workspaceDir — the leader process cwd. */
@@ -27,10 +27,6 @@ export interface PersistedProductState {
27
27
  * PlanningSession is strings / arrays / plain objects (no functions, dates, or class instances).
28
28
  */
29
29
  leaderDialogue?: PlanningSession;
30
- /** P2-1: run tasks in the project cwd instead of per-task worktrees (see
31
- * ProductCreateParams.runInProjectCwd) — persisted so a delegation resumed after an engine restart
32
- * keeps running in the project cwd, not a fresh isolated worktree. */
33
- runInProjectCwd?: boolean;
34
30
  }
35
31
  export interface ProductPersistenceOptions {
36
32
  pathService?: PathService;
@@ -23,9 +23,8 @@
23
23
  * - CrewAI: checkpoint serialization (mid-task state)
24
24
  * - LangGraph: durable execution (persist after each node)
25
25
  */
26
- import type { AcpDetector } from "../runtime/infra/acp-detector.js";
27
- import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
28
- import type { DelegateBridge } from "./delegation-coordinator.js";
26
+ import type { HostAgentProviderDirectory } from "../runtime/infra/host-agent-provider-directory.js";
27
+ import type { DelegateBridge } from "./delegate-bridge.js";
29
28
  import type { ProductPlanParams, ProductPlan, ProductConfirmParams } from "../protocol/wire/acp-agent-management.js";
30
29
  export type PlanningPhase = "planning" | "awaiting_confirmation" | "confirmed" | "executing" | "paused" | "completed" | "cancelled";
31
30
  export interface PlanningMessage {
@@ -105,11 +104,10 @@ export interface DagMutation {
105
104
  details?: Record<string, unknown>;
106
105
  }
107
106
  export declare class ProductPlanner {
108
- private acpDetector;
109
- private configStore;
107
+ private providerDirectory;
110
108
  private callbacks;
111
109
  private sessions;
112
- constructor(acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: PlannerCallbacks);
110
+ constructor(providerDirectory: HostAgentProviderDirectory, callbacks?: PlannerCallbacks);
113
111
  /**
114
112
  * Start an interactive planning session (Phase 1).
115
113
  * Spawns the leader agent and begins multi-turn dialogue.
@@ -18,9 +18,7 @@
18
18
  *
19
19
  * Degradation: if K agents fail but ≥1 succeeds, session remains interactive.
20
20
  */
21
- import type { AcpDetector } from "../runtime/infra/acp-detector.js";
22
- import type { AgentConfigStore } from "../runtime/infra/agent-config-store.js";
23
- import type { DelegateBridge } from "./delegation-coordinator.js";
21
+ import type { DelegateBridge } from "./delegate-bridge.js";
24
22
  import type { SoloState, SoloAgentState, SoloEvaluation, SoloStatus, SoloStartParams, SoloSelectParams, SoloSpec } from "../protocol/wire/acp-agent-management.js";
25
23
  export declare function deriveSoloDelegateProjectId(registeredProjectRoot: string): string;
26
24
  export interface SoloCallbacks {
@@ -75,10 +73,9 @@ export declare function buildEvaluationPrompt(originalTask: string, spec: SoloSp
75
73
  diff?: string;
76
74
  }>): string;
77
75
  export declare class SoloEvaluator {
78
- private configStore;
79
76
  private callbacks;
80
77
  private sessions;
81
- constructor(_acpDetector: AcpDetector, configStore: AgentConfigStore | null, callbacks?: SoloCallbacks);
78
+ constructor(callbacks?: SoloCallbacks);
82
79
  /** Persist current session data to disk (fire-and-forget). */
83
80
  private persistSession;
84
81
  /** Restore sessions from disk (call once at startup). */
@@ -1,7 +1,8 @@
1
- import type { DelegateBridge } from "../delegation-coordinator.js";
1
+ import type { DelegateBridge } from "../delegate-bridge.js";
2
2
  interface LegacyTurnFixture {
3
3
  sendTask(memberId: string, prompt: string, options?: {
4
4
  timeout?: number;
5
+ session?: unknown;
5
6
  }): Promise<unknown>;
6
7
  getUsageTracker?(memberId: string): {
7
8
  getUsage(): {
@@ -0,0 +1,7 @@
1
+ import type { HostAgentProviderState } from "../../host-contract/index.js";
2
+ import type { HostAgentProviderDirectory } from "../../runtime/infra/host-agent-provider-directory.js";
3
+ export interface HostProviderDirectoryFixtureOptions {
4
+ states?: Readonly<Record<string, HostAgentProviderState | "not_installed">>;
5
+ diagnostics?: Readonly<Record<string, string>>;
6
+ }
7
+ export declare function makeHostAgentProviderDirectoryFixture(options?: HostProviderDirectoryFixtureOptions): HostAgentProviderDirectory;
@@ -3,7 +3,7 @@
3
3
  * with qlogicagent's actual capabilities. No mocks, no stubs (plan §1.5).
4
4
  *
5
5
  * Boundary capabilities (runAgent / invokeMcp / sendChannel) are injected so this file stays
6
- * decoupled from the handler host that owns processManager/acpDetector and the xiaozhiclaw channel
6
+ * decoupled from the handler host that owns Gateway delegation and the xiaozhiclaw channel
7
7
  * callback. Tool invocation goes straight through the single-source-of-truth tool registry
8
8
  * (`findTool`). fail-loud everywhere: unknown tool, missing channel host, or any rejection throws.
9
9
  */
@@ -1,5 +1,5 @@
1
1
  import type { NotificationMethodMap } from "./wire/notification-payloads.js";
2
- export declare const AGENT_CONTRACT_VERSION: 3;
2
+ export declare const AGENT_CONTRACT_VERSION: 4;
3
3
  export declare const AGENT_EVENT_SCHEMA_VERSION: 1;
4
4
  export declare const AGENT_TERMINAL_STATES: readonly ["completed", "failed", "cancelled"];
5
5
  export type TerminalState = (typeof AGENT_TERMINAL_STATES)[number];
@@ -12,6 +12,9 @@ export declare const AGENT_EVENT_REQUIRED_KEYS: {
12
12
  readonly "product.taskStarted": readonly ["productId", "taskId", "assignee", "attempt"];
13
13
  readonly "product.taskCompleted": readonly ["productId", "taskId", "result", "attempt"];
14
14
  readonly "product.taskFailed": readonly ["productId", "taskId", "error", "attempt", "terminalState"];
15
+ readonly "mention.delegate_started": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision"];
16
+ readonly "mention.delegate_activity": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision"];
17
+ readonly "mention.delegate_settled": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision", "status"];
15
18
  };
16
19
  export type AgentWsEventName = (typeof AGENT_WS_EVENT_NAMES)[number];
17
20
  export type AgentTeamWsEventName = (typeof AGENT_TEAM_WS_EVENT_NAMES)[number];
@@ -26,17 +29,20 @@ export interface AgentEventEnvelope<K extends AgentEventName = AgentEventName> {
26
29
  payload: AgentEventPayloadMap[K];
27
30
  }
28
31
  export declare const AGENT_CONTRACT_DESCRIPTOR: {
29
- readonly version: 3;
32
+ readonly version: 4;
30
33
  readonly eventSchemaVersion: 1;
31
34
  readonly eventNames: 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", "product.planReady", "product.planningDelta", "product.leaderMessage", "product.planFailed", "product.planningAsk", "goal.run_state_changed", "goal.phase_boundary", "goal.goal_edited", "goal.message_queued", "goal.acceptance_updated", "goal.round_message", "mention.delegate_started", "mention.delegate_activity", "mention.delegate_settled"];
32
35
  readonly eventRequiredKeys: {
33
36
  readonly "product.taskStarted": readonly ["productId", "taskId", "assignee", "attempt"];
34
37
  readonly "product.taskCompleted": readonly ["productId", "taskId", "result", "attempt"];
35
38
  readonly "product.taskFailed": readonly ["productId", "taskId", "error", "attempt", "terminalState"];
39
+ readonly "mention.delegate_started": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision"];
40
+ readonly "mention.delegate_activity": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision"];
41
+ readonly "mention.delegate_settled": readonly ["parentSessionId", "parentMessageId", "bindingId", "executionSessionId", "delegationId", "sequence", "providerId", "revision", "status"];
36
42
  };
37
43
  readonly terminalStates: readonly ["completed", "failed", "cancelled"];
38
44
  };
39
- export declare const AGENT_CONTRACT_HASH: "495d6c1122d9ff8da40427e0809710e6e8a1a6663a4128c1ad9865707dd63147";
45
+ export declare const AGENT_CONTRACT_HASH: "23e967b8afdc32d4f8663cf50a1e86e07e658b4d63a6c657f043b62be0c81ec3";
40
46
  export interface AgentContractIdentity {
41
47
  version: typeof AGENT_CONTRACT_VERSION;
42
48
  hash: typeof AGENT_CONTRACT_HASH;
@@ -7,8 +7,8 @@
7
7
  * Reference: Codex app-server RPC, Claude Code JSON-RPC, GitHub Copilot Agent API.
8
8
  */
9
9
  import type { ChatMessage, LocalizedToolText, ToolCapabilityCategory } from "./wire/chat-types.js";
10
- import type { AgentDescriptor, AgentConfig, GatewayRpcMethodMap, RpcProjectInfo, RpcProjectType, RpcProjectStatus, SoloStatus, ProductStatus, ProductSummary } from "./wire/index.js";
11
- import type { AgentsScanParams, AgentsConfigParams, AgentsSetConfigParams, AgentsGetConfigParams, AgentsRemoveConfigParams, AgentsSetGatewayParams, SoloStartParams, SoloIdParams, SoloSelectParams, SoloDeleteParams, SoloMessageParams, SoloEvaluateParams, SoloEvaluation, ProductCreateParams, ProductPlanParams, ProductPlan, ProductConfirmParams, ProductMessageParams, ProductIdParams, ProductDeleteParams, ProductReplayParams } from "./wire/acp-agent-management.js";
10
+ import type { GatewayRpcMethodMap, RpcProjectInfo, RpcProjectType, RpcProjectStatus, SoloStatus, ProductStatus, ProductSummary } from "./wire/index.js";
11
+ import type { SoloStartParams, SoloIdParams, SoloSelectParams, SoloDeleteParams, SoloMessageParams, SoloEvaluateParams, SoloEvaluation, ProductCreateParams, ProductPlanParams, ProductPlan, ProductConfirmParams, ProductMessageParams, ProductIdParams, ProductDeleteParams, ProductReplayParams } from "./wire/acp-agent-management.js";
12
12
  export interface InitializeParams {
13
13
  protocolVersion: string;
14
14
  host?: {
@@ -381,6 +381,8 @@ export type ProjectCreateParams = GatewayRpcMethodMap["project.create"]["params"
381
381
  export type ProjectCreateResult = GatewayRpcMethodMap["project.create"]["result"];
382
382
  export type ProjectListParams = GatewayRpcMethodMap["project.list"]["params"];
383
383
  export type ProjectListResult = GatewayRpcMethodMap["project.list"]["result"];
384
+ export type ProjectDetachParams = GatewayRpcMethodMap["project.detach"]["params"];
385
+ export type ProjectDetachResult = GatewayRpcMethodMap["project.detach"]["result"];
384
386
  export type ProjectDeleteParams = GatewayRpcMethodMap["project.delete"]["params"];
385
387
  export type ProjectDeleteResult = GatewayRpcMethodMap["project.delete"]["result"];
386
388
  export type ProjectRenameParams = GatewayRpcMethodMap["project.rename"]["params"];
@@ -403,6 +405,10 @@ export type SessionDeleteParams = GatewayRpcMethodMap["session.delete"]["params"
403
405
  export type SessionDeleteResult = GatewayRpcMethodMap["session.delete"]["result"];
404
406
  export type SessionArchiveParams = GatewayRpcMethodMap["session.archive"]["params"];
405
407
  export type SessionArchiveResult = GatewayRpcMethodMap["session.archive"]["result"];
408
+ export type SessionLoadNativeTranscriptParams = GatewayRpcMethodMap["session.loadNativeTranscript"]["params"];
409
+ export type SessionLoadNativeTranscriptResult = GatewayRpcMethodMap["session.loadNativeTranscript"]["result"];
410
+ export type SessionAdoptNativeParams = GatewayRpcMethodMap["session.adoptNative"]["params"];
411
+ export type SessionAdoptNativeResult = GatewayRpcMethodMap["session.adoptNative"]["result"];
406
412
  export type InstructionsListParams = GatewayRpcMethodMap["instructions.list"]["params"];
407
413
  export type InstructionsListResult = GatewayRpcMethodMap["instructions.list"]["result"];
408
414
  export type InstructionsReadParams = GatewayRpcMethodMap["instructions.read"]["params"];
@@ -524,42 +530,6 @@ export interface RpcMethodMap {
524
530
  params: undefined;
525
531
  result: AgentPingResult;
526
532
  };
527
- "agents.scan": {
528
- params: AgentsScanParams;
529
- result: AgentDescriptor[];
530
- };
531
- "agents.list": {
532
- params: undefined;
533
- result: AgentDescriptor[];
534
- };
535
- "agents.config": {
536
- params: AgentsConfigParams;
537
- result: {
538
- ok: true;
539
- };
540
- };
541
- "agents.setConfig": {
542
- params: AgentsSetConfigParams;
543
- result: {
544
- ok: true;
545
- };
546
- };
547
- "agents.getConfig": {
548
- params: AgentsGetConfigParams;
549
- result: AgentConfig | null;
550
- };
551
- "agents.removeConfig": {
552
- params: AgentsRemoveConfigParams;
553
- result: {
554
- ok: true;
555
- };
556
- };
557
- "agents.setGateway": {
558
- params: AgentsSetGatewayParams;
559
- result: {
560
- ok: true;
561
- };
562
- };
563
533
  "solo.start": {
564
534
  params: SoloStartParams;
565
535
  result: {
@@ -695,6 +665,10 @@ export interface RpcMethodMap {
695
665
  params: ProjectListParams;
696
666
  result: ProjectListResult;
697
667
  };
668
+ "project.detach": {
669
+ params: ProjectDetachParams;
670
+ result: ProjectDetachResult;
671
+ };
698
672
  "project.delete": {
699
673
  params: ProjectDeleteParams;
700
674
  result: ProjectDeleteResult;
@@ -747,6 +721,14 @@ export interface RpcMethodMap {
747
721
  params: SessionArchiveParams;
748
722
  result: SessionArchiveResult;
749
723
  };
724
+ "session.loadNativeTranscript": {
725
+ params: SessionLoadNativeTranscriptParams;
726
+ result: SessionLoadNativeTranscriptResult;
727
+ };
728
+ "session.adoptNative": {
729
+ params: SessionAdoptNativeParams;
730
+ result: SessionAdoptNativeResult;
731
+ };
750
732
  "instructions.list": {
751
733
  params: InstructionsListParams;
752
734
  result: InstructionsListResult;
@@ -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, ProductLeaderMessageNotification, ProductPlanningAskNotification, 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, GoalRoundMessageNotification, MentionDelegateStartedNotification, MentionDelegateActivityNotification, MentionDelegateSettledNotification, } from "./wire/index.js";
9
+ export type { AgentSource, ArtifactType, MediaResultType, MemoryDecayCompletedNotification, MemoryUpdatedNotification, NotificationMethod, NotificationMethodMap, NotificationThreadItem, PermissionRuleUpdatedNotification, PlanInterruptedNotification, PongNotification, ProductAgentActivityNotification, ProductBudgetUpdateNotification, ProductBudgetWarningNotification, ProductCheckpointedNotification, ProductCompletedNotification, ProductDagTopologyNotification, ProductMembersNotification, ProductPlanFailedNotification, ProductPlanningDeltaNotification, ProductPlanReadyNotification, ProductLeaderMessageNotification, ProductPlanningAskNotification, 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, GoalRoundMessageNotification, MentionDelegateStartedNotification, MentionDelegateActivityNotification, MentionDelegateSettledNotification, } from "./wire/index.js";