qlogicagent 2.18.6 → 2.18.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent.js +30 -30
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -0
- package/dist/index.js +538 -528
- package/dist/orchestration.js +4 -4
- package/dist/permissions.js +1 -1
- package/dist/plugin-marketplace-compute.js +1 -0
- package/dist/protocol.js +1 -1
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +4 -4
- package/dist/tunables.js +1 -0
- package/dist/types/agent/runtime-vars.d.ts +1 -2
- package/dist/types/agent/tool-loop.d.ts +6 -0
- package/dist/types/agent/tool-loop.test-harness.d.ts +20 -0
- package/dist/types/agent/types.d.ts +2 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +7 -0
- package/dist/types/cli/acp-extended-host-adapter.d.ts +2 -0
- package/dist/types/cli/acp-session-host.d.ts +15 -2
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/community-skill-installer.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +4 -0
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +3 -1
- package/dist/types/cli/core-tools/config-tool-service.d.ts +7 -5
- package/dist/types/cli/default-project-bootstrap.d.ts +1 -0
- package/dist/types/cli/handlers/agents-handler.d.ts +4 -1
- package/dist/types/cli/handlers/community-handler.d.ts +2 -0
- package/dist/types/cli/handlers/config-handler.d.ts +2 -15
- package/dist/types/cli/handlers/pet-handler.d.ts +3 -2
- package/dist/types/cli/handlers/session-handler.d.ts +1 -1
- package/dist/types/cli/handlers/skills-handler.d.ts +12 -10
- package/dist/types/cli/handlers/solo-handler.d.ts +3 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +47 -33
- package/dist/types/cli/handlers/workflow-handler.d.ts +6 -0
- package/dist/types/cli/mcp-bootstrap.d.ts +0 -2
- package/dist/types/cli/media-inline.d.ts +14 -0
- package/dist/types/cli/media-understanding.d.ts +65 -8
- package/dist/types/cli/memory-coordinator.d.ts +8 -0
- package/dist/types/cli/multi-agent-handler-host.d.ts +2 -0
- package/dist/types/cli/permission-bootstrap.d.ts +2 -0
- package/dist/types/cli/pet-runtime.d.ts +0 -1
- package/dist/types/cli/plugin-bootstrap.d.ts +2 -1
- package/dist/types/cli/product-coordinator.d.ts +4 -1
- package/dist/types/cli/rpc-registry.d.ts +1 -3
- package/dist/types/cli/runtime-watcher-bootstrap.d.ts +0 -2
- package/dist/types/cli/session-context.d.ts +4 -2
- package/dist/types/cli/skill-invocation-service.d.ts +2 -0
- package/dist/types/cli/skill-tools-bootstrap.d.ts +2 -0
- package/dist/types/cli/skills-query-service.d.ts +2 -1
- package/dist/types/cli/stdio-acp-protocol-coordinator.d.ts +9 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +11 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +1 -1
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +6 -0
- package/dist/types/cli/stdio-runtime-services.d.ts +6 -1
- package/dist/types/cli/stdio-server.d.ts +33 -4
- package/dist/types/cli/task-distillation-coordinator.d.ts +9 -4
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +3 -0
- package/dist/types/cli/tool-bootstrap-media-registration.d.ts +10 -0
- package/dist/types/cli/tool-bootstrap-web-registration.d.ts +1 -0
- package/dist/types/cli/tool-bootstrap.d.ts +9 -0
- package/dist/types/cli/turn-core.d.ts +2 -0
- package/dist/types/cli/turn-preview-browser-setup.d.ts +15 -0
- package/dist/types/cli/turn-project-router.d.ts +1 -1
- package/dist/types/cli/workflow-host-adapter.d.ts +2 -0
- package/dist/types/contracts/structured-planner.d.ts +2 -0
- package/dist/types/host-contract/index.d.ts +1475 -0
- package/dist/types/host-contract/project-id.d.ts +5 -0
- package/dist/types/host-contract/provider-profile.d.ts +46 -0
- package/dist/types/orchestration/agent-instance.d.ts +6 -0
- package/dist/types/orchestration/delegation-coordinator.d.ts +40 -0
- package/dist/types/orchestration/goal-mode-adapters.d.ts +3 -0
- package/dist/types/orchestration/product-planner.d.ts +3 -0
- package/dist/types/orchestration/solo-evaluator.d.ts +19 -5
- package/dist/types/orchestration/solo-persistence.d.ts +2 -0
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +4 -0
- package/dist/types/permissions.d.ts +2 -0
- package/dist/types/protocol/methods.d.ts +0 -199
- package/dist/types/protocol/wire/acp-protocol.d.ts +16 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +1 -173
- package/dist/types/protocol/wire/chat-types.d.ts +6 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +13 -3
- package/dist/types/runtime/execution/dream-agent.d.ts +9 -8
- package/dist/types/runtime/infra/agent-paths.d.ts +3 -3
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +1 -1
- package/dist/types/runtime/infra/clixml-sanitize.d.ts +16 -0
- package/dist/types/runtime/infra/external-agent-approvals.d.ts +18 -0
- package/dist/types/runtime/infra/feedback-distillation.d.ts +3 -1
- package/dist/types/runtime/infra/feedback-host-authority.d.ts +4 -0
- package/dist/types/runtime/infra/llmrouter-catalog.d.ts +2 -13
- package/dist/types/runtime/infra/model-registry.d.ts +3 -1
- package/dist/types/runtime/infra/project-authority-facade.d.ts +11 -0
- package/dist/types/runtime/infra/project-host-authority.d.ts +10 -0
- package/dist/types/runtime/ports/memory-provider.d.ts +11 -7
- package/dist/types/runtime/ports/tool-contracts.d.ts +2 -0
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +2 -2
- package/dist/types/runtime/session/session-persistence.d.ts +29 -10
- package/dist/types/runtime/session/session-recovery.d.ts +4 -0
- package/dist/types/runtime/session/session-summary.d.ts +3 -1
- package/dist/types/runtime/session/session-transcript-store.d.ts +7 -0
- package/dist/types/skills/memory/host-memory-provider.d.ts +148 -0
- package/dist/types/skills/memory/local-memory-provider.d.ts +19 -10
- package/dist/types/skills/memory/task-distillation.d.ts +6 -0
- package/dist/types/skills/plugins/plugin-marketplace.d.ts +23 -57
- package/dist/types/skills/tools/media-understand-tool.d.ts +28 -0
- package/dist/types/skills/tools/preview-browser-tool.d.ts +136 -0
- package/dist/types/skills/tools/shell/task-output.d.ts +10 -1
- package/dist/types/skills/tools/skill-tool.d.ts +1 -1
- package/dist/types/skills/web-search/brave-source.d.ts +2 -1
- package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +3 -2
- package/dist/types/skills/web-search/exa-source.d.ts +2 -1
- package/dist/types/skills/web-search/search-svc-source.d.ts +4 -3
- package/dist/types/skills/web-search/searxng-source.d.ts +3 -1
- package/dist/types/skills/web-search/serper-source.d.ts +2 -1
- package/dist/types/skills/web-search/source-factory.d.ts +2 -1
- package/dist/types/skills/web-search/web-tunable-resolver.d.ts +16 -0
- package/dist/types/test-support/global-home-setup.d.ts +2 -0
- package/dist/types/transport/acp-server.d.ts +29 -0
- package/dist/types/transport/delegate-client.d.ts +82 -0
- package/dist/types/transport/host-capability-client.d.ts +21 -0
- package/dist/types/transport/host-feedback-client.d.ts +25 -0
- package/dist/types/transport/host-profile-client.d.ts +19 -0
- package/dist/types/transport/host-project-client.d.ts +16 -0
- package/dist/types/transport/host-request-client.d.ts +38 -0
- package/dist/types/transport/host-session-client.d.ts +29 -0
- package/dist/types/tunables.d.ts +2 -0
- package/package.json +26 -3
- package/dist/types/cli/handlers/settings-handler.d.ts +0 -19
- package/dist/types/cli/permission-rule-persistence.d.ts +0 -16
- package/dist/types/cli/tunable-store.d.ts +0 -26
- package/dist/types/skills/permissions/settings-watcher.d.ts +0 -26
- /package/dist/types/{skills/memory → host-contract}/fts-segment.d.ts +0 -0
|
@@ -0,0 +1,1475 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Gateway Host 接口冻结稿(契约包)—— 单一事实源:docs/agent-supervision-interfaces-freeze.md
|
|
3
|
+
*
|
|
4
|
+
* 本文件是 freeze §0-§4/§3.5 的 TypeScript 落型(2026-07-09 冻结,G3′/A1-A3 已闭环;
|
|
5
|
+
* 2026-07-10 Route B 补遗 X1-X7 入约:§13 通知 sink + host-state wire、ProfileConfigService keyId
|
|
6
|
+
* 正名 + revealKey、MemoryProfileService 库面收口——单一事实源 agent-supervision-authority-migration-spec.md)。
|
|
7
|
+
* 消费方:xiaozhiclaw-runtime gateway(实现方)+ qlogicagent agent 侧(GatewayDelegateRelay client)。
|
|
8
|
+
* 冻结纪律:接口不随实现漂移;任何字段/签名改动必须回评审(review-gate-checklist),
|
|
9
|
+
* S2 施工 lane 不得自行修改本文件。
|
|
10
|
+
*
|
|
11
|
+
* 标注 [S1 补定] 的辅助类型是 freeze 引用但未给定义的最小结构,属 S1 评审点,
|
|
12
|
+
* 其字段以 freeze 正文/recon 注释为据;实现 lane 负责与现状 store 形状做映射。
|
|
13
|
+
*/
|
|
14
|
+
export * from "./provider-profile.js";
|
|
15
|
+
/** agent 逻辑身份(小智自身也是一个 agentId="qlogicagent")。自身 vs 第三方仅由此值决定(F2)。 */
|
|
16
|
+
export type AgentId = string;
|
|
17
|
+
/** 确定性派生的项目主键(freeze §11.4#2,抄 VSCode getWorkspaceId)。绝不随机、绝不裸路径。 */
|
|
18
|
+
export type ProjectId = string;
|
|
19
|
+
/** 会话稳定身份(创建即恒定,session-identity-alignment-spec)。 */
|
|
20
|
+
export type CanonicalSessionId = string;
|
|
21
|
+
/**
|
|
22
|
+
* Gateway-resolved model purposes. This is the single vocabulary shared by
|
|
23
|
+
* profile materialization and the agent-side model registry.
|
|
24
|
+
*/
|
|
25
|
+
export declare const MODEL_PURPOSES: readonly ["textGeneration", "smallModel", "stt", "tts", "imageGeneration", "imageUnderstanding", "videoGeneration", "videoUnderstanding", "threeDGeneration", "embedding", "voiceClone", "musicGeneration", "realtimeAudio", "realtimeVideo"];
|
|
26
|
+
export type ModelPurpose = (typeof MODEL_PURPOSES)[number];
|
|
27
|
+
/** 能力实例种类。 */
|
|
28
|
+
export type MemberKind = "chat" | "product-leader" | "product-worker" | "goal-leader" | "solo-racer" | "workflow-node";
|
|
29
|
+
/**
|
|
30
|
+
* 能力实例的结构化 handle(freeze §11.4#3,抄 VSCode ExtensionRunningLocation)。可判等、可字符串化。
|
|
31
|
+
* 取代今天各特性自造的 memberId 串(chat-* / product-*:*:* / goal-*:leader / solo-* / workflow-agent-*)。
|
|
32
|
+
*/
|
|
33
|
+
export interface MemberHandle {
|
|
34
|
+
kind: MemberKind;
|
|
35
|
+
/** 归属上下文:canonicalSessionId | productId | goalRunId | workflowRunId */
|
|
36
|
+
owner: string;
|
|
37
|
+
/** 人类可读名(instance 名/leader/worker 等) */
|
|
38
|
+
name: string;
|
|
39
|
+
/** 实例序号(≈ VSCode affinity;同种多实例区分) */
|
|
40
|
+
seq: number;
|
|
41
|
+
}
|
|
42
|
+
/** 稳定字符串键(路由/日志/存储用)。字段含分隔符即 fail-loud,绝不静默错路由。 */
|
|
43
|
+
export declare function memberKey(h: MemberHandle): string;
|
|
44
|
+
export declare function memberEquals(a: MemberHandle, b: MemberHandle): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* 一次委派/回合所需的会话上下文,由 SessionProjectService 解析后传入 Supervisor。
|
|
47
|
+
* cwd/resumeNativeId 不再由调用点各自拼装,而是从会话面权威解析。
|
|
48
|
+
*/
|
|
49
|
+
export interface SessionContext {
|
|
50
|
+
canonicalSessionId: CanonicalSessionId;
|
|
51
|
+
projectId: ProjectId;
|
|
52
|
+
/** 项目/worktree 工作目录 */
|
|
53
|
+
cwd: string;
|
|
54
|
+
/** 仅 native-cwd agent(codex/claude)有意义(freeze §11.4#5:传输层重连令牌,不承担状态恢复) */
|
|
55
|
+
resumeNativeId?: string;
|
|
56
|
+
}
|
|
57
|
+
/** sendTurn 的统一返回(freeze §11.1:消灭"外部对象 / 内部字符串"双形态)。 */
|
|
58
|
+
export interface TurnResult {
|
|
59
|
+
content: string;
|
|
60
|
+
stopReason?: string;
|
|
61
|
+
usage?: {
|
|
62
|
+
inputTokens?: number;
|
|
63
|
+
outputTokens?: number;
|
|
64
|
+
};
|
|
65
|
+
/** 仅诊断,永不进入下游解析输入 */
|
|
66
|
+
diagnostics?: unknown;
|
|
67
|
+
}
|
|
68
|
+
/** agent 实例存活/失败状态(freeze §5.1 判活 + §5.3 fail-loud)。 */
|
|
69
|
+
export type AgentInstanceState = "starting" | "ready" | "busy" | "unresponsive" | "exited";
|
|
70
|
+
/**
|
|
71
|
+
* 结构化失败归类(freeze §4 E3:失败一律结构化明示,不得降级成裸 error 串)。
|
|
72
|
+
* UNKNOWN = 无法归类时的显式兜底:禁止硬塞错误 code,也禁止因归不了类降级成裸串。
|
|
73
|
+
*/
|
|
74
|
+
export type LifecycleCode = "CANCELLED" | "PROCESS_EXIT" | "HEARTBEAT_TIMEOUT" | "TURN_TIMEOUT" | "UNKNOWN";
|
|
75
|
+
/**
|
|
76
|
+
* 确定性派生 projectId —— host-contract leaf 内的唯一实现(project-id.ts):
|
|
77
|
+
* sha256(resolve(workspaceDir).toLowerCase()).hex[:16]。
|
|
78
|
+
* 两端(gateway/agent)共用同一实现,零协商对齐;绝不允许第二份实现(否则 projectData 键漂移=数据全丢)。
|
|
79
|
+
*/
|
|
80
|
+
export { deriveProjectId } from "./project-id.js";
|
|
81
|
+
/** 三态鉴权(llmrouter 注 sk-qllm / direct 厂商 key / oauth)解析后的结果,注入 spawn env。 */
|
|
82
|
+
export interface ResolvedCredentials {
|
|
83
|
+
mode: "llmrouter" | "direct" | "oauth";
|
|
84
|
+
env: Record<string, string>;
|
|
85
|
+
}
|
|
86
|
+
export interface AgentSpec {
|
|
87
|
+
/** 决定 self-descriptor(cliPath=process.execPath)还是第三方 descriptor(F2) */
|
|
88
|
+
agentId: AgentId;
|
|
89
|
+
/** cwd/resume 由此来(不再由调用点拼) */
|
|
90
|
+
session: SessionContext;
|
|
91
|
+
systemPrompt?: string;
|
|
92
|
+
/** Gateway materialized, session-scoped non-secret model/permission profile. */
|
|
93
|
+
profile?: ResolvedSpawnProfile;
|
|
94
|
+
/** 三态鉴权由 CredentialResolver 按 agentId 解析后显式传入(freeze §6.2);不糊在 envOverrides,明文不进事件/日志 */
|
|
95
|
+
credentials?: ResolvedCredentials;
|
|
96
|
+
/** 仅非密的运行覆盖(如 solo 自身分支 QLOGICAGENT_WORKTREE_WORKDIR/SOLO_LEAN) */
|
|
97
|
+
envOverrides?: Record<string, string>;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* 回合输入内容块(多模态)。**精确镜像 `AcpContentBlock`**(acp-protocol.ts:249)——
|
|
101
|
+
* 覆盖 text/image/video/audio/file 全五类;评审纠正:早期 text/image/resource 偏窄漏了 video/audio/file。
|
|
102
|
+
* 随 ACP block union 演进则同步扩(单一事实源=acp-protocol.ts)。
|
|
103
|
+
*/
|
|
104
|
+
export type ContentBlock = {
|
|
105
|
+
type: "text";
|
|
106
|
+
text: string;
|
|
107
|
+
} | {
|
|
108
|
+
type: "image";
|
|
109
|
+
url: string;
|
|
110
|
+
mimeType?: string;
|
|
111
|
+
} | {
|
|
112
|
+
type: "video";
|
|
113
|
+
url: string;
|
|
114
|
+
mimeType?: string;
|
|
115
|
+
} | {
|
|
116
|
+
type: "audio";
|
|
117
|
+
url: string;
|
|
118
|
+
mimeType?: string;
|
|
119
|
+
} | {
|
|
120
|
+
type: "file";
|
|
121
|
+
fileId: string;
|
|
122
|
+
mimeType?: string;
|
|
123
|
+
size?: number;
|
|
124
|
+
};
|
|
125
|
+
/**
|
|
126
|
+
* 每回合上下文(2026-07-09 S3 综合补遗 A1;权威形状 = agent 侧 buildSessionMeta + turnId)。
|
|
127
|
+
* 现瘦 sendTurn(prompt:string) 收不下这些(executeTurn:632 实证)→ 富签名。
|
|
128
|
+
* 列已核实的承重字段,实现期随 buildSessionMeta 真实形状对齐收紧类型。
|
|
129
|
+
*/
|
|
130
|
+
export interface PerTurnMeta {
|
|
131
|
+
turnId?: string;
|
|
132
|
+
permissions?: unknown;
|
|
133
|
+
reasoning?: unknown;
|
|
134
|
+
assistantId?: string;
|
|
135
|
+
activeSkills?: string[];
|
|
136
|
+
attachments?: unknown[];
|
|
137
|
+
mcpServers?: unknown[];
|
|
138
|
+
[k: string]: unknown;
|
|
139
|
+
}
|
|
140
|
+
/** sendTurn 富输入(S3 综合补遗 A1:取代裸 prompt:string,承多模态内容块 + per-turn meta)。 */
|
|
141
|
+
export interface TurnInput {
|
|
142
|
+
messages: ContentBlock[];
|
|
143
|
+
meta?: PerTurnMeta;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 中立监督每个 agent 进程(小智自身 + 第三方对等),不嵌套。
|
|
147
|
+
* 判活=ACK 响应性(freeze §5.1,内部实现,不暴露方法名清单)。失败=结构化事件(§5.3),不静默杀。
|
|
148
|
+
*
|
|
149
|
+
* 不变式(冻结):
|
|
150
|
+
* - F1 单注册:一个 memberKey(handle) 至多一个实例(池化种类按 key 复用)。
|
|
151
|
+
* - F2 自身/第三方唯一由 agentId 决定;调用点不得再各自决定进程形态。
|
|
152
|
+
* - F3 结构隔离(§11.4#4):host 与 agent 引导入口物理不同、互不派生;删除运行时"拒 qlogicagent"闸。
|
|
153
|
+
* - F4 判活单轨(§5.1):仅 ACK 响应性,无 agent 心跳、无方法名豁免清单;unresponsive 是状态非杀。
|
|
154
|
+
* - F5 leader 硬约束(§11.4#6):kind∈{product-leader,goal-leader} 时 agentId 必须 ="qlogicagent",接口层硬校验拒第三方。
|
|
155
|
+
* - F6 判活地板 = "任意协议消息计活"(§6.3);我方 agent 可另加 ping 作补充、不作地板。
|
|
156
|
+
*/
|
|
157
|
+
export interface AgentSupervisor {
|
|
158
|
+
/** 确保 handle 对应实例在跑(不在则 spawn,池化种类复用)。能力 endpoint 由 CapabilityService 统一注入(C2)。 */
|
|
159
|
+
ensure(handle: MemberHandle, spec: AgentSpec): Promise<void>;
|
|
160
|
+
/**
|
|
161
|
+
* 向实例发一个回合,流式事件经 subscribe 回流,最终 resolve 统一 TurnResult。取代 processManager.sendTask。
|
|
162
|
+
* (S3 综合补遗 A1)input 富签名:承多模态内容块 + per-turn meta(permissions/reasoning/assistantId/
|
|
163
|
+
* activeSkills/attachments/mcpServers);裸 prompt:string 会丢这些回合上下文。
|
|
164
|
+
*/
|
|
165
|
+
sendTurn(handle: MemberHandle, input: TurnInput, opts?: {
|
|
166
|
+
timeoutMs?: number;
|
|
167
|
+
signal?: AbortSignal;
|
|
168
|
+
}): Promise<TurnResult>;
|
|
169
|
+
/**
|
|
170
|
+
* 订阅实例的回合/生命周期事件(delta/tool/approval/media/relay/state)。见 §4 事件契约。
|
|
171
|
+
* (S3 综合补遗 A4)granularity:leader 用 "coarse"(省 delta,只收 tool/approval/lifecycle/media/turn 终态,
|
|
172
|
+
* 背压砍到控制面);ws/UI 用 "full"(逐 delta 全保真)。缺省 "full"。
|
|
173
|
+
*/
|
|
174
|
+
subscribe(handle: MemberHandle, sink: SupervisorEventSink, opts?: {
|
|
175
|
+
granularity?: "full" | "coarse";
|
|
176
|
+
}): () => void;
|
|
177
|
+
/**
|
|
178
|
+
* 审批应答入口(2026-07-09 补遗#3,VSCode 实证):应答方法必须挂连接持有者,绝不挂事件面。
|
|
179
|
+
* VSCode 对齐:IAgent 事件流出(onDidSessionProgress/pending_confirmation)+ 应答方法流入
|
|
180
|
+
* (respondToPermissionRequest(requestId, approved),agentService.ts:1457;UI→进程全链
|
|
181
|
+
* agentSideEffects.ts:1013)。optionId 不透明透传(E2)。
|
|
182
|
+
*/
|
|
183
|
+
respondApproval(handle: MemberHandle, approvalId: string, optionId: string): void;
|
|
184
|
+
/** 取消当前回合(不杀进程)。 */
|
|
185
|
+
cancel(handle: MemberHandle): Promise<void>;
|
|
186
|
+
/** 停止并回收实例(用户主动关闭 / 会话结束)。 */
|
|
187
|
+
stop(handle: MemberHandle): Promise<void>;
|
|
188
|
+
/** 查询状态(判活为内部 ACK 响应性,超时置 "unresponsive" 交 fail-loud,不自动静默杀)。 */
|
|
189
|
+
getState(handle: MemberHandle): AgentInstanceState;
|
|
190
|
+
}
|
|
191
|
+
/** [S1 补定] 生命周期记录事件(recordLifecycle 参数);与 §4 onLifecycle 同族。 */
|
|
192
|
+
export interface LifecycleEvent {
|
|
193
|
+
state: AgentInstanceState | "cancelled";
|
|
194
|
+
/** ISO 时间戳 */
|
|
195
|
+
at: string;
|
|
196
|
+
reason?: string;
|
|
197
|
+
code?: LifecycleCode;
|
|
198
|
+
}
|
|
199
|
+
export interface SessionMeta {
|
|
200
|
+
canonicalSessionId: CanonicalSessionId;
|
|
201
|
+
projectId: ProjectId;
|
|
202
|
+
/** 主 agent(创建即锁定,severe 禁中途切换) */
|
|
203
|
+
agentId: AgentId;
|
|
204
|
+
cwd: string;
|
|
205
|
+
/** 每 native agent 的原生会话 id 映射(现状单 nativeBinding 由 importer 迁入,见 N2) */
|
|
206
|
+
nativeSessionIds?: Record<AgentId, string>;
|
|
207
|
+
lifecycle: string;
|
|
208
|
+
}
|
|
209
|
+
export interface NativeSessionSummary {
|
|
210
|
+
nativeId: string;
|
|
211
|
+
cwd: string;
|
|
212
|
+
updatedAt: number;
|
|
213
|
+
title?: string;
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* 原生会话索引提供者(codex-index 上移网关):按 agentId 读该 agent 的 native 会话目录(~/.codex 等)。
|
|
217
|
+
* 语义 = 索引/发现,NOT transcript owner(freeze §9 边界)。home/env 由 AgentDescriptor/CredentialResolver 供。
|
|
218
|
+
* qlogicagent 不再承担读取点(否则 session plane 又漏回 agent)。
|
|
219
|
+
*/
|
|
220
|
+
export interface NativeSessionIndexProvider {
|
|
221
|
+
/** 仅 native-cwd 后端(codex/claude)有 provider */
|
|
222
|
+
agentId: AgentId;
|
|
223
|
+
listNativeSessions(ctx: {
|
|
224
|
+
projectId: ProjectId;
|
|
225
|
+
cwd: string;
|
|
226
|
+
}): NativeSessionSummary[];
|
|
227
|
+
resolveNativeResumeId(sessionId: CanonicalSessionId, ctx: {
|
|
228
|
+
cwd: string;
|
|
229
|
+
}): string | undefined;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* 拥有会话存储 + 项目作用域 + agentId 绑定 + canonical↔native 映射 + 生命周期状态。
|
|
233
|
+
* 唯一权威(不与 qlogicagent 并存)。崩溃恢复靠网关持有并重放(freeze §11.4#5)。
|
|
234
|
+
*
|
|
235
|
+
* 不变式(冻结):
|
|
236
|
+
* - S1 绑定权威唯一在网关;canonical id 创建即恒定。
|
|
237
|
+
* - S2 projectId 确定性派生(deriveProjectId),同一 cwd/URI 两端算出同值。
|
|
238
|
+
* - S3 resume 只是传输层重连令牌:状态恢复靠 replayStateTo 重放,不压在 resumeNativeId 上。
|
|
239
|
+
* - S4 native transcript 不接管:网关只持 canonical↔native 映射;codex ~/.codex rollout 归 agent 自己。
|
|
240
|
+
* - S5 无归属会话不默认归小智:listSessions 绝不把"无 agentId"会话塞进小智桶;要么显式绑定要么 fail-loud。
|
|
241
|
+
*/
|
|
242
|
+
export interface SessionProjectService {
|
|
243
|
+
/** 确定性派生 projectId(必须 = deriveProjectId 唯一实现)。 */
|
|
244
|
+
deriveProjectId(cwdOrWorkspaceUri: string): ProjectId;
|
|
245
|
+
/**
|
|
246
|
+
* 会话创建写点(2026-07-09 补遗#1,VSCode 实证):会话进入宿主权威存储的唯一入口。
|
|
247
|
+
* VSCode 对齐:host-owned 状态创建全程显式方法(agentService.ts:1655 createSession /
|
|
248
|
+
* workspacesManagementMainService.ts:45 createUntitledWorkspace),无一处隐式内部创建。
|
|
249
|
+
* 同时承担 projectId→cwd 注册表登记(补遗#4:填充折叠进创建写点,抄 doEnterWorkspace 内调
|
|
250
|
+
* registerWorkspaceBackup;不设独立 registerProjectRoot 契约方法)。幂等;同 id 异 projectId/cwd → throw。
|
|
251
|
+
*/
|
|
252
|
+
createSession(sessionId: CanonicalSessionId, projectId: ProjectId, cwd: string): void;
|
|
253
|
+
/** 会话首轮锁定主 agent(创建即恒定,严禁中途切换)。权威落此,不再落 qlogicagent metadata。 */
|
|
254
|
+
bindSessionAgent(sessionId: CanonicalSessionId, agentId: AgentId): void;
|
|
255
|
+
/** 路由权威:已绑定会话永远返回其主 agent,忽略请求方携带值(反前端漂移)。 */
|
|
256
|
+
resolveAgent(sessionId: CanonicalSessionId, requestedAgentId?: AgentId): AgentId;
|
|
257
|
+
/** 解析一次委派/回合所需的完整会话上下文(供 Supervisor.ensure 用)。 */
|
|
258
|
+
resolveContext(sessionId: CanonicalSessionId): SessionContext;
|
|
259
|
+
/** canonical↔native 映射:resume 时取 agent 自持会话的原生 id(仅 codex/claude)。 */
|
|
260
|
+
getNativeResumeId(sessionId: CanonicalSessionId, agentId: AgentId): string | undefined;
|
|
261
|
+
/**
|
|
262
|
+
* canonical↔native 映射回填写点(2026-07-09 补遗#2,VSCode 实证):native id 由 agent 运行期产生、
|
|
263
|
+
* relay 在观察点回填。VSCode 对齐:跨边界的运行期 id 回填用显式 accept 方法
|
|
264
|
+
* ($acceptTerminalProcessId(stableId, runtimeId),extHost.protocol.ts:3159);同进程侧的
|
|
265
|
+
* native→canonical 反向路由缓存照 codexAgent.ts:574 留 relay 内存,不进本契约。
|
|
266
|
+
* 幂等;同 (sessionId,agentId) 异 nativeId → throw(身份恒定)。
|
|
267
|
+
*/
|
|
268
|
+
recordNativeSessionId(sessionId: CanonicalSessionId, agentId: AgentId, nativeId: string): void;
|
|
269
|
+
/** 会话列表:按 项目 + agentId 分区(前端分区面的权威来源)。 */
|
|
270
|
+
listSessions(filter: {
|
|
271
|
+
projectId?: ProjectId;
|
|
272
|
+
agentId?: AgentId | "*";
|
|
273
|
+
}): SessionMeta[];
|
|
274
|
+
/** 生命周期:记录/恢复(崩溃后网关重放订阅/激活状态给重生 agent)。 */
|
|
275
|
+
recordLifecycle(sessionId: CanonicalSessionId, ev: LifecycleEvent): void;
|
|
276
|
+
replayStateTo(handle: MemberHandle, sessionId: CanonicalSessionId): Promise<void>;
|
|
277
|
+
}
|
|
278
|
+
export interface CapabilityEndpoint {
|
|
279
|
+
/** 唯一规范名(astraclaw_capabilities;不再双别名,C1) */
|
|
280
|
+
serverName: string;
|
|
281
|
+
transport: "stdio" | "ipc";
|
|
282
|
+
/** 网关稳定 endpoint */
|
|
283
|
+
address: string;
|
|
284
|
+
/** 演进用 */
|
|
285
|
+
version?: string;
|
|
286
|
+
/** token 放 ref、不放明文;由 gateway/CredentialResolver 解析。qlogicagent 只消费、不维护 registry。 */
|
|
287
|
+
auth?: {
|
|
288
|
+
kind: "none";
|
|
289
|
+
} | {
|
|
290
|
+
kind: "bearerRef";
|
|
291
|
+
ref: string;
|
|
292
|
+
};
|
|
293
|
+
}
|
|
294
|
+
/** [S1 补定] 已装技能引用(host 注册表成员)。 */
|
|
295
|
+
export interface SkillRef {
|
|
296
|
+
name: string;
|
|
297
|
+
description?: string;
|
|
298
|
+
version?: string;
|
|
299
|
+
enabled: boolean;
|
|
300
|
+
/** provenance(catalog 安装 / 本地创建 / 晋升产物等) */
|
|
301
|
+
source?: string;
|
|
302
|
+
}
|
|
303
|
+
/** [S1 补定] MCP 连接器引用。 */
|
|
304
|
+
export interface ConnectorRef {
|
|
305
|
+
serverName: string;
|
|
306
|
+
tools: string[];
|
|
307
|
+
transport?: string;
|
|
308
|
+
}
|
|
309
|
+
/** [S1 补定] host 管理的安装请求(装一次,全员共享;VSCode 扩展模型)。 */
|
|
310
|
+
export interface InstallRequest {
|
|
311
|
+
kind: "skill" | "mcp";
|
|
312
|
+
id: string;
|
|
313
|
+
version?: string;
|
|
314
|
+
source?: string;
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* 拥有已装技能 + MCP 连接器的注册表 + 内容;对网关监督的每个 agent(含小智)统一注入一个能力 endpoint。
|
|
318
|
+
*
|
|
319
|
+
* 不变式(冻结):
|
|
320
|
+
* - C1 单注册:能力 server 唯一规范名,绝不注册第二别名。
|
|
321
|
+
* - C2 注入点唯一:能力注入只在 Supervisor spawn 处经本服务一处发生。
|
|
322
|
+
* - C3 内容 host 持有、使用 agent 侧:技能内容/连接器 config 归网关注册表;执行仍在 agent、经此 endpoint。
|
|
323
|
+
*/
|
|
324
|
+
export interface CapabilityService {
|
|
325
|
+
/** 供 Supervisor 在 spawn 每个 agent 时统一注入的能力接入点(对小智自己也走同一 endpoint)。 */
|
|
326
|
+
getEndpoint(forAgent: AgentId, session: SessionContext): CapabilityEndpoint;
|
|
327
|
+
/** 已装技能注册表(host 持有;装一次共享)。 */
|
|
328
|
+
listSkills(session: SessionContext): SkillRef[];
|
|
329
|
+
viewSkill(name: string): {
|
|
330
|
+
name: string;
|
|
331
|
+
content: string;
|
|
332
|
+
};
|
|
333
|
+
/** MCP 连接器:发现 + 调用(mcp_connectors_list / mcp_tool_call 的后端)。 */
|
|
334
|
+
listConnectors(session: SessionContext): ConnectorRef[];
|
|
335
|
+
callConnector(toolName: string, args: unknown): Promise<{
|
|
336
|
+
content: unknown;
|
|
337
|
+
details?: unknown;
|
|
338
|
+
imageUrls?: string[];
|
|
339
|
+
}>;
|
|
340
|
+
/** host 管理的安装(装一次,全员共享)。 */
|
|
341
|
+
install(ref: InstallRequest): Promise<void>;
|
|
342
|
+
uninstall(id: string): Promise<void>;
|
|
343
|
+
}
|
|
344
|
+
/** CredentialResolver —— 三态鉴权解析(G1)。token 传 ref,明文不进事件/日志。 */
|
|
345
|
+
export interface CredentialResolver {
|
|
346
|
+
resolve(agentId: AgentId, ownerId: string): ResolvedCredentials;
|
|
347
|
+
/** bearerRef → 实际 token,仅在注入 spawn env 的边界解引用 */
|
|
348
|
+
deref(ref: string): string;
|
|
349
|
+
}
|
|
350
|
+
/** [Route B X5] 单把 key 的 wire 视图(keyId 寻址;key 材料只给掩码,明文走 revealKey)。 */
|
|
351
|
+
export interface ProviderKeyInfo {
|
|
352
|
+
keyId: string;
|
|
353
|
+
/** 掩码展示(maskApiKey 语义);明文绝不进列表面 */
|
|
354
|
+
masked: string;
|
|
355
|
+
enabled: boolean;
|
|
356
|
+
label?: string;
|
|
357
|
+
}
|
|
358
|
+
/** [S1 补定] 供应商信息(settings 域,spec §15)。 */
|
|
359
|
+
export interface ProviderInfo {
|
|
360
|
+
id: string;
|
|
361
|
+
name?: string;
|
|
362
|
+
hasKey: boolean;
|
|
363
|
+
enabled: boolean;
|
|
364
|
+
/** [Route B X5] keyId 级子清单(一 provider 多 key);B2 profile lane 按 wire 真实形状收紧(X3) */
|
|
365
|
+
keys?: ProviderKeyInfo[];
|
|
366
|
+
}
|
|
367
|
+
/** settings.addKey 的原子提交选项;只承载非密元数据/替换策略。 */
|
|
368
|
+
export interface ProfileAddKeyOptions {
|
|
369
|
+
label?: string;
|
|
370
|
+
replaceExisting?: boolean;
|
|
371
|
+
}
|
|
372
|
+
/** [S1 补定] 模型信息(settings 域)。 */
|
|
373
|
+
export interface ModelInfo {
|
|
374
|
+
id: string;
|
|
375
|
+
provider: string;
|
|
376
|
+
enabled: boolean;
|
|
377
|
+
active?: boolean;
|
|
378
|
+
}
|
|
379
|
+
/** [S1 补定] 用途绑定(哪个模型干哪件事:textGen/small/理解/stt/embedding…,spec §13)。 */
|
|
380
|
+
export interface PurposeBinding {
|
|
381
|
+
purpose: ModelPurpose;
|
|
382
|
+
model: string;
|
|
383
|
+
}
|
|
384
|
+
/** UI/store projection of a persisted permission rule. */
|
|
385
|
+
export interface PermissionRule {
|
|
386
|
+
id: string;
|
|
387
|
+
pattern: string;
|
|
388
|
+
action: "allow" | "deny" | "ask";
|
|
389
|
+
}
|
|
390
|
+
/** Session-effective permission rule; mirrors the agent permission engine exactly. */
|
|
391
|
+
export interface EffectivePermissionRule {
|
|
392
|
+
pattern: string;
|
|
393
|
+
pathPrefix?: string;
|
|
394
|
+
behavior: "allow" | "ask" | "deny";
|
|
395
|
+
reason?: string;
|
|
396
|
+
source?: string;
|
|
397
|
+
requireOp?: "commandNetworkEgress";
|
|
398
|
+
}
|
|
399
|
+
export interface EffectivePermissionConfig {
|
|
400
|
+
mode: "default" | "auto" | "full_access";
|
|
401
|
+
rules: EffectivePermissionRule[];
|
|
402
|
+
}
|
|
403
|
+
/** Public host-owned permission policy projection; deliberately excludes rules, keys and tunables. */
|
|
404
|
+
export interface PermissionPolicy {
|
|
405
|
+
mode: EffectivePermissionConfig["mode"];
|
|
406
|
+
}
|
|
407
|
+
/** A single non-secret binding materialized for a model purpose. */
|
|
408
|
+
export interface ResolvedModelBinding {
|
|
409
|
+
model: string;
|
|
410
|
+
provider: string;
|
|
411
|
+
routing?: string;
|
|
412
|
+
credRef?: string;
|
|
413
|
+
baseUrl?: string;
|
|
414
|
+
}
|
|
415
|
+
/** Complete non-secret profile materialized by the gateway at a session boundary. */
|
|
416
|
+
export interface ResolvedSpawnProfile {
|
|
417
|
+
bindings: Partial<Record<ModelPurpose, ResolvedModelBinding>>;
|
|
418
|
+
permissions: EffectivePermissionConfig;
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* ProfileConfigService —— 完整 profile/config 域(spec §13/§15)。
|
|
422
|
+
* 吸收今天转发主 adapter 的 settings.* + config.* + assistants.*,全改网关本地处理。
|
|
423
|
+
* 三作用域:用户全局 / per-agent(三态鉴权)/ 项目覆盖(值按作用域分,抄 VSCode ConfigurationTarget)。
|
|
424
|
+
* agent 只接收 resolveForSpawn 现算好的绑定,不再自算(ensureLlmrouterDefaultBindings 上移这里)。
|
|
425
|
+
*/
|
|
426
|
+
export interface ProfileConfigService {
|
|
427
|
+
getOverview(ownerId: string): {
|
|
428
|
+
providers: ProviderInfo[];
|
|
429
|
+
models: ModelInfo[];
|
|
430
|
+
bindings: PurposeBinding[];
|
|
431
|
+
injectedKeys: string[];
|
|
432
|
+
};
|
|
433
|
+
listProviders(ownerId: string): ProviderInfo[];
|
|
434
|
+
/**
|
|
435
|
+
* [Route B X5 正名] keyId 粒度(wire 真实粒度;一 provider 多 key,原 provider 级签名是 S1 臆造面)。
|
|
436
|
+
* 返回新铸 keyId。prepare 阶段完成目录解析/候选探针,commit 阶段重读最新 settings 后只做一次
|
|
437
|
+
* 原子替换;失败不改变旧文件/旧 key enabled 状态。[X4 过渡] 本刀仍按 legacy 形态把材料直存
|
|
438
|
+
* settings.json,ref 化另批完成。明文绝不进入日志、事件或通知。
|
|
439
|
+
* 默认 bindings 保持 gateway resolve-on-read;addKey 不隐式改 purposes,direct provider 也不自动绑空用途。
|
|
440
|
+
*/
|
|
441
|
+
addKey(ownerId: string, provider: string, key: string, options?: ProfileAddKeyOptions): Promise<string>;
|
|
442
|
+
/** [X5] 按 keyId 删单把 key(池空随之删;llmrouter env 注入位特例落 injectedKeys 偏好)。false=未找到(不写盘)。 */
|
|
443
|
+
removeKey(ownerId: string, keyId: string): boolean;
|
|
444
|
+
validateKey(ownerId: string, provider: string): Promise<boolean>;
|
|
445
|
+
/** [X5] 按 keyId 启停单把 key。false=未找到(不写盘)。 */
|
|
446
|
+
toggleKey(ownerId: string, keyId: string, on: boolean): boolean;
|
|
447
|
+
/**
|
|
448
|
+
* [Route B X4] UI 显式索取明文(wire settings.getKey/copyKey 的唯一后端;剪贴板副作用移前端)。
|
|
449
|
+
* 红线:返回值绝不经 HostNotificationSink 广播、绝不落日志/事件;ref 期在此边界 deref(VSCode
|
|
450
|
+
* ISecretStorageService 同构:main 持密文,显式 API 解密返回调用方)。未找到 throw(fail-loud)。
|
|
451
|
+
*/
|
|
452
|
+
revealKey(ownerId: string, keyId: string): string;
|
|
453
|
+
listModels(ownerId: string): ModelInfo[];
|
|
454
|
+
setActiveModel(ownerId: string, model: string): void;
|
|
455
|
+
getActiveModel(ownerId: string): string;
|
|
456
|
+
getPurposeBindings(ownerId: string): PurposeBinding[];
|
|
457
|
+
setBinding(ownerId: string, purpose: string, model: string): void;
|
|
458
|
+
getTunables(ownerId: string): Record<string, unknown>;
|
|
459
|
+
updateTunable(ownerId: string, key: string, value: unknown): void;
|
|
460
|
+
clearTunable(ownerId: string, key: string): void;
|
|
461
|
+
/**
|
|
462
|
+
* Persist the fixed "always allow this directory" rule. Callers supply only the path;
|
|
463
|
+
* pattern/behavior/reason are host policy and never cross the agent wire.
|
|
464
|
+
*/
|
|
465
|
+
appendDirectoryAllowRule(ownerId: string, pathPrefix: string): void;
|
|
466
|
+
getPermissionRules(ownerId: string): PermissionRule[];
|
|
467
|
+
/** Read the user-global (A-domain) policy used by the public permission selector. */
|
|
468
|
+
getPermissionPolicy(ownerId: string): PermissionPolicy;
|
|
469
|
+
/** Replace only A-domain permissions.mode; rules and unrelated settings remain byte-semantically intact. */
|
|
470
|
+
updatePermissionMode(ownerId: string, mode: PermissionPolicy["mode"]): PermissionPolicy;
|
|
471
|
+
getAgentConfig(agentId: AgentId, ownerId: string): {
|
|
472
|
+
authPreference: "managed" | "account" | "userKey";
|
|
473
|
+
gatewayUrl?: string;
|
|
474
|
+
apiKeyRef?: string;
|
|
475
|
+
};
|
|
476
|
+
/** apiKey 存 ref */
|
|
477
|
+
setAgentConfig(agentId: AgentId, ownerId: string, patch: Partial<{
|
|
478
|
+
authPreference: string;
|
|
479
|
+
gatewayUrl: string;
|
|
480
|
+
apiKeyRef: string;
|
|
481
|
+
}>): void;
|
|
482
|
+
resolveForSpawn(agentId: AgentId, session: SessionContext): ResolvedSpawnProfile;
|
|
483
|
+
}
|
|
484
|
+
/** [S1 补定] 记忆查询(memory 域;实现 lane 与 memories.db 形状映射)。 */
|
|
485
|
+
export interface MemoryQuery {
|
|
486
|
+
query?: string;
|
|
487
|
+
category?: string;
|
|
488
|
+
limit?: number;
|
|
489
|
+
days?: number;
|
|
490
|
+
}
|
|
491
|
+
/** [S1 补定] 记忆记录(最小契约面;byAgent 为 M-3 写入署名)。 */
|
|
492
|
+
export interface MemoryRecord {
|
|
493
|
+
id: string;
|
|
494
|
+
content: string;
|
|
495
|
+
category?: string;
|
|
496
|
+
tags?: string[];
|
|
497
|
+
byAgent?: AgentId;
|
|
498
|
+
createdAt?: string;
|
|
499
|
+
updatedAt?: string;
|
|
500
|
+
}
|
|
501
|
+
/** [S1 补定] 记忆匹配条件(delete 用)。 */
|
|
502
|
+
export interface MemoryMatch {
|
|
503
|
+
ids?: string[];
|
|
504
|
+
query?: string;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* MemoryProfileService —— 记忆 + profile 数据(spec §14)。
|
|
508
|
+
* 小智可为默认写入/解释者,但非唯一 owner;任意 peer 经 host 读写(P2:写入必带 byAgent)。
|
|
509
|
+
* 是 memory MCP 能力模块(freeze §3.7)的 store-owner;三张脸(MCP 面/UI-API 面/brain proxy 面 X7)
|
|
510
|
+
* 都是 thin adapter,唯一写者恒为本服务(脸数≠拷贝数,M-1)。
|
|
511
|
+
*
|
|
512
|
+
* [Route B X6 裁决] 本服务只管 **A 域库面**(memories.db + 附件 + 晋升/蒸馏 JSON + 用户级 INDEX.md
|
|
513
|
+
* 派生渲染)。C 域 memdir(`<cwd>/.qlogicagent/memory/`)从 memory host-state **剥离**,归"项目文件面"
|
|
514
|
+
* (进用户仓的项目文件,类 .vscode/,非 host store):UI-API 的 memdir 分支由 gateway 文件服务本地应答
|
|
515
|
+
* (VSCode main IFileService 同构),agent 侧 qla 直接 fs 操作如常。`read(source, target)` 的 memdir
|
|
516
|
+
* 两义剥除——source 只指库内来源标识,绝不再指 memdir 文件。
|
|
517
|
+
*/
|
|
518
|
+
export interface MemoryProfileService {
|
|
519
|
+
atlas(query: MemoryQuery): MemoryRecord[];
|
|
520
|
+
read(source: string, target: string): MemoryRecord | undefined;
|
|
521
|
+
/** 显式记录写入者(M-3) */
|
|
522
|
+
write(record: MemoryRecord, byAgent: AgentId): void;
|
|
523
|
+
delete(match: MemoryMatch): void;
|
|
524
|
+
consolidate(candidates: MemoryRecord[], source: string): void;
|
|
525
|
+
promote(proposal: unknown): void;
|
|
526
|
+
}
|
|
527
|
+
/** [S1 补定] 首启进度状态。 */
|
|
528
|
+
export interface OnboardingState {
|
|
529
|
+
completed: boolean;
|
|
530
|
+
step?: string;
|
|
531
|
+
startedAt?: string;
|
|
532
|
+
completedAt?: string;
|
|
533
|
+
}
|
|
534
|
+
/** 开场行动卡(freeze §3.5:actor 必须显式声明,不再隐式=主程序,P3)。 */
|
|
535
|
+
export interface ActionCard {
|
|
536
|
+
id: string;
|
|
537
|
+
label: string;
|
|
538
|
+
actor: AgentId;
|
|
539
|
+
}
|
|
540
|
+
/** OnboardingService —— 首启"认识你"(spec §14,host-owned)。 */
|
|
541
|
+
export interface OnboardingService {
|
|
542
|
+
getState(ownerId: string): OnboardingState;
|
|
543
|
+
advance(ownerId: string, step: string): OnboardingState;
|
|
544
|
+
}
|
|
545
|
+
/** ActionSurfaceService —— 开场行动卡(spec §14,host-owned)。 */
|
|
546
|
+
export interface ActionSurfaceService {
|
|
547
|
+
listActions(session: SessionContext): ActionCard[];
|
|
548
|
+
}
|
|
549
|
+
/**
|
|
550
|
+
* GatewayDelegateRelay —— 机制 B 的 gateway-routed delegate 唯一入口(6 处 spawn 点改调这里,P4)。
|
|
551
|
+
* 编排(小智)发 delegate → 网关解析 session/cred/capability → Supervisor.ensure+sendTurn → 事件回流。
|
|
552
|
+
* reconnect 后向重生实例 replay 状态(与 SessionProjectService.replayStateTo 协同;O3 场景 7)。
|
|
553
|
+
*/
|
|
554
|
+
export interface GatewayDelegateRelay {
|
|
555
|
+
delegate(from: MemberHandle | "user", to: {
|
|
556
|
+
handle: MemberHandle;
|
|
557
|
+
agentId: AgentId;
|
|
558
|
+
},
|
|
559
|
+
/** (S3 综合补遗 A1)富输入,与 sendTurn/x_delegate 一致;禁降回纯文本(评审:relay 若停 prompt:string 则富输入到此塌成文本) */
|
|
560
|
+
input: TurnInput, session: SessionContext, opts?: {
|
|
561
|
+
timeoutMs?: number;
|
|
562
|
+
signal?: AbortSignal;
|
|
563
|
+
granularity?: "full" | "coarse";
|
|
564
|
+
systemPrompt?: string;
|
|
565
|
+
}): Promise<TurnResult>;
|
|
566
|
+
subscribe(handle: MemberHandle, sink: SupervisorEventSink, opts?: {
|
|
567
|
+
granularity?: "full" | "coarse";
|
|
568
|
+
}): () => void;
|
|
569
|
+
}
|
|
570
|
+
export type RunId = string;
|
|
571
|
+
/** [S1 补定] 运行事件(由 relay/supervisor 生命周期喂)。 */
|
|
572
|
+
export interface RunEvent {
|
|
573
|
+
/** ISO 时间戳 */
|
|
574
|
+
at: string;
|
|
575
|
+
type: string;
|
|
576
|
+
member?: MemberHandle;
|
|
577
|
+
payload?: unknown;
|
|
578
|
+
}
|
|
579
|
+
/** [S1 补定] 运行状态(UI 权威读)。 */
|
|
580
|
+
export interface RunState {
|
|
581
|
+
runId: RunId;
|
|
582
|
+
kind: "solo" | "product" | "goal";
|
|
583
|
+
projectId: ProjectId;
|
|
584
|
+
owner: SessionContext;
|
|
585
|
+
status: string;
|
|
586
|
+
events?: RunEvent[];
|
|
587
|
+
checkpoint?: unknown;
|
|
588
|
+
openedAt: string;
|
|
589
|
+
updatedAt: string;
|
|
590
|
+
}
|
|
591
|
+
/**
|
|
592
|
+
* RunStateStore —— Solo/Product/Goal 运行状态归属(A6,Core Host 一等公民)。
|
|
593
|
+
* "跑到哪了"的记录归 host,由 GatewayDelegateRelay + Supervisor 生命周期事件喂;
|
|
594
|
+
* qlogicagent 崩溃/重启进度不丢、UI 从宿主权威读。
|
|
595
|
+
* leader 大脑逻辑(怎么规划、派谁)仍留 qlogicagent,只写"计划"、不持久化"进度记录"(P5)。
|
|
596
|
+
*/
|
|
597
|
+
export interface RunStateStore {
|
|
598
|
+
openRun(kind: "solo" | "product" | "goal", owner: SessionContext): RunId;
|
|
599
|
+
recordEvent(runId: RunId, ev: RunEvent): void;
|
|
600
|
+
/** product/solo 检查点 */
|
|
601
|
+
checkpoint(runId: RunId, snapshot: unknown): void;
|
|
602
|
+
getRun(runId: RunId): RunState;
|
|
603
|
+
listRuns(filter: {
|
|
604
|
+
projectId: ProjectId;
|
|
605
|
+
kind?: string;
|
|
606
|
+
}): RunState[];
|
|
607
|
+
}
|
|
608
|
+
export interface EvBase {
|
|
609
|
+
/** 由 relay 合成(今天线上无 handle,只有 agentId+sessionId+delegationId 关联;R1) */
|
|
610
|
+
member: MemberHandle;
|
|
611
|
+
sessionId: string;
|
|
612
|
+
turnId: string;
|
|
613
|
+
requestId?: string;
|
|
614
|
+
}
|
|
615
|
+
/**
|
|
616
|
+
* 不变式(冻结):
|
|
617
|
+
* - E1 归属:回合事件必须带 (member, sessionId, turnId, requestId?);实例级 lifecycle 可省 turnId/sessionId,
|
|
618
|
+
* 但必须带 member + state。member 由 relay 合成(委派事件要归属到委派成员,不能寄生宿主 agentId,R1)。
|
|
619
|
+
* - E2 审批/media/lifecycle 均过网关边界,不走进程内直传;审批应答 optionId 不透明透传。
|
|
620
|
+
* - E3 失败一律 onLifecycle 结构化明示(code+diagnostics+retriable),不得降级成裸 error 串、不静默杀;
|
|
621
|
+
* cancel 是显式 state:"cancelled" 非 "RPC aborted" 串。
|
|
622
|
+
* - E4 reconnect 要重放回合事件(S3 replayStateTo),今天只重放状态快照(R7)。
|
|
623
|
+
* - E5 relay 漏项 R1-R8 是 cutover 施工项(behind 本冻结接口,非开放设计题;清单见 findings §3)。
|
|
624
|
+
*/
|
|
625
|
+
export interface SupervisorEventSink {
|
|
626
|
+
/** turn.delta / turn.reasoning_delta(字段=delta,非 text) */
|
|
627
|
+
onDelta(e: EvBase & {
|
|
628
|
+
delta: string;
|
|
629
|
+
reasoning?: boolean;
|
|
630
|
+
}): void;
|
|
631
|
+
/** onTool 拆成 call/result 两事件、callId 配对(旧单 {name,status} 是错形状;R2)。 */
|
|
632
|
+
onToolCall(e: EvBase & {
|
|
633
|
+
callId: string;
|
|
634
|
+
name: string;
|
|
635
|
+
arguments?: string;
|
|
636
|
+
inputSummary?: string;
|
|
637
|
+
startedAt?: string;
|
|
638
|
+
}): void;
|
|
639
|
+
/**
|
|
640
|
+
* ⚠ name = relay 经 callId 从配对 tool_call 回填的 canonical name;不可信任原始 tool_result.name
|
|
641
|
+
* ——实测塌成通用 "tool"(真名只在 call 侧;entry.ts:233 `ev?.name ?? "tool"`,findings R2)。
|
|
642
|
+
*/
|
|
643
|
+
onToolResult(e: EvBase & {
|
|
644
|
+
callId: string;
|
|
645
|
+
name: string;
|
|
646
|
+
ok: boolean;
|
|
647
|
+
error?: string;
|
|
648
|
+
outputPreview?: string;
|
|
649
|
+
finishedAt?: string;
|
|
650
|
+
}): void;
|
|
651
|
+
/**
|
|
652
|
+
* 审批:options[].optionId 是不透明、按审批种类而异的串(approved/cancel/abort/approved-execpolicy-amendment…);
|
|
653
|
+
* 应答走 AgentSupervisor.respondApproval(handle, approvalId, optionId) 原样透传——sink 是纯事件流出面,
|
|
654
|
+
* 不承载应答入口(2026-07-09 补遗#3:应答方法挂连接持有者,VSCode IAgent 同构)。
|
|
655
|
+
*/
|
|
656
|
+
onApprovalRequest(e: EvBase & {
|
|
657
|
+
approvalId: string;
|
|
658
|
+
callId: string;
|
|
659
|
+
toolName: string;
|
|
660
|
+
arguments?: string;
|
|
661
|
+
message?: string;
|
|
662
|
+
category?: string;
|
|
663
|
+
options: Array<{
|
|
664
|
+
optionId: string;
|
|
665
|
+
name: string;
|
|
666
|
+
kind: string;
|
|
667
|
+
}>;
|
|
668
|
+
}): void;
|
|
669
|
+
/**
|
|
670
|
+
* media:统一 {mediaType,url,model,provider}(非 imageUrls[])。⚠R3:external agent 今天不发此事件
|
|
671
|
+
* (codex 图像漏成 tool_call),cutover 必须补 agents.prompt.media relay,否则 external media 无一等来源。
|
|
672
|
+
*/
|
|
673
|
+
onMedia(e: EvBase & {
|
|
674
|
+
mediaType: string;
|
|
675
|
+
url: string;
|
|
676
|
+
model?: string;
|
|
677
|
+
provider?: string;
|
|
678
|
+
}): void;
|
|
679
|
+
/**
|
|
680
|
+
* 通用透传(S3 综合补遗 A3):承接今天 mapSessionUpdate 的 x_relay→relay 分支
|
|
681
|
+
* (acp-adapter.ts:824-850 的 tool_use_summary/task_updated/recovery/ask_user/instructions 等)。
|
|
682
|
+
* supervisor handleNotification 的 default:break(agent-supervisor.ts:742)会整块丢弃这些→前端富遥测/
|
|
683
|
+
* 编排面板全空;此口保前端契约不破。eventName=原方法名,payload 原样。
|
|
684
|
+
* **边界(评审)**:onRelay **只做非权威遥测透传,不承载控制语义**(控制/终态/审批走各自一等事件,不许经此绕行);
|
|
685
|
+
* payload 必须走红线脱敏(明文凭据/密钥不出)+ 大小上限(超限截断,防大帧 DoS)。
|
|
686
|
+
*/
|
|
687
|
+
onRelay(e: EvBase & {
|
|
688
|
+
eventName: string;
|
|
689
|
+
payload: unknown;
|
|
690
|
+
}): void;
|
|
691
|
+
/**
|
|
692
|
+
* 回合终态 + agent 实例态。⚠R4/R5:今天线上的 turn.error 是裸串(丢 code/diagnostics/retriable);
|
|
693
|
+
* adapter 内部已有 code+diagnostics 但 external relay 无 error 分支 → 冻结要求补齐。
|
|
694
|
+
* agent 实例四态今天无一等事件(只有连接时 agent-status),F4/F6/fail-loud 要求补。
|
|
695
|
+
* UNKNOWN 兜底语义见 LifecycleCode。
|
|
696
|
+
*/
|
|
697
|
+
onLifecycle(e: {
|
|
698
|
+
member: MemberHandle;
|
|
699
|
+
sessionId?: string;
|
|
700
|
+
turnId?: string;
|
|
701
|
+
state: AgentInstanceState | "cancelled";
|
|
702
|
+
reason?: string;
|
|
703
|
+
retriable?: boolean;
|
|
704
|
+
code?: LifecycleCode;
|
|
705
|
+
diagnostics?: {
|
|
706
|
+
pid?: number;
|
|
707
|
+
exitCode?: number | null;
|
|
708
|
+
signal?: string | null;
|
|
709
|
+
stderrTail?: string;
|
|
710
|
+
lastEventName?: string;
|
|
711
|
+
timedOutAfterMs?: number;
|
|
712
|
+
idleMs?: number;
|
|
713
|
+
};
|
|
714
|
+
}): void;
|
|
715
|
+
}
|
|
716
|
+
/** delegate 关联主键:leader 铸、gateway 校验唯一(T3/T4)。 */
|
|
717
|
+
export type DelegationId = string;
|
|
718
|
+
/** `x/delegate` 请求参数(agent→host,起一个 worker 回合,resolve TurnResult,隐式订阅该 delegation)。 */
|
|
719
|
+
export interface DelegateRequestParams {
|
|
720
|
+
delegationId: DelegationId;
|
|
721
|
+
/** F5 leader 硬校验在 gateway 侧,不信任此处传入(T4) */
|
|
722
|
+
to: {
|
|
723
|
+
handle: MemberHandle;
|
|
724
|
+
agentId: AgentId;
|
|
725
|
+
};
|
|
726
|
+
input: TurnInput;
|
|
727
|
+
session: SessionContext;
|
|
728
|
+
/** Persona/instructions applied when the gateway registers or resumes the delegated session. */
|
|
729
|
+
systemPrompt?: string;
|
|
730
|
+
opts?: {
|
|
731
|
+
timeoutMs?: number;
|
|
732
|
+
granularity?: "full" | "coarse";
|
|
733
|
+
};
|
|
734
|
+
}
|
|
735
|
+
/** 回流事件种类(与 §4 SupervisorEventSink 方法 1:1,T10 无损镜像)。 */
|
|
736
|
+
export type DelegateEventKind = "delta" | "tool_call" | "tool_result" | "approval_request" | "media" | "relay" | "lifecycle";
|
|
737
|
+
/**
|
|
738
|
+
* `x/delegate.update` 帧(host→agent 通知,一事件一帧;不复用反向 session/update,T2)。
|
|
739
|
+
* event = 对应 SupervisorEventSink 事件去掉 member 后的对象(member 提到帧级,E1)。
|
|
740
|
+
*/
|
|
741
|
+
export interface DelegateUpdateFrame {
|
|
742
|
+
delegationId: DelegationId;
|
|
743
|
+
/** gateway 铸,每 delegation 单调;消费方校验连续,丢帧/乱序 fail-loud(T3/T6) */
|
|
744
|
+
seq: number;
|
|
745
|
+
/** 权威成员(E1,= to.handle;禁宿主盖名 R1) */
|
|
746
|
+
member: MemberHandle;
|
|
747
|
+
kind: DelegateEventKind;
|
|
748
|
+
/** 载荷镜像对应 sink 事件(去 member);sink 接口即权威形状 */
|
|
749
|
+
event: unknown;
|
|
750
|
+
}
|
|
751
|
+
/** `x/delegate.respond`(agent→host 通知,leader 来源审批应答;UI 来源走现有 ws approval-response,T8)。 */
|
|
752
|
+
export interface DelegateRespondParams {
|
|
753
|
+
delegationId: DelegationId;
|
|
754
|
+
approvalId: string;
|
|
755
|
+
/** 不透明透传(E2) */
|
|
756
|
+
optionId: string;
|
|
757
|
+
}
|
|
758
|
+
/** `x/delegate.cancel`(agent→host 通知,取消回合不杀进程;终态出显式 cancelled,E3)。 */
|
|
759
|
+
export interface DelegateCancelParams {
|
|
760
|
+
delegationId: DelegationId;
|
|
761
|
+
reason?: string;
|
|
762
|
+
}
|
|
763
|
+
/** wire 方法名(x/ 族;方法约定 acp-protocol.ts:42-80,非 x_ session-update 类型)。 */
|
|
764
|
+
export declare const DELEGATE_WIRE_METHODS: {
|
|
765
|
+
readonly request: "x/delegate";
|
|
766
|
+
readonly update: "x/delegate.update";
|
|
767
|
+
readonly respond: "x/delegate.respond";
|
|
768
|
+
readonly cancel: "x/delegate.cancel";
|
|
769
|
+
};
|
|
770
|
+
/**
|
|
771
|
+
* [X1] Host 领域变更通知 sink —— 挂 **store-owner 服务层**,不挂 RPC handler(brain proxy/MCP 写路径
|
|
772
|
+
* 不经 handler,挂 handler 会漏通知;挂 owner 则 UI 写/brain 写/MCP 写全覆盖)。
|
|
773
|
+
* 装配期由 host-services 注入 gateway 事件总线(emitGatewayEvent→broadcast);服务 mutation 成功后调用。
|
|
774
|
+
* 事件名与今天线上帧逐字一致(memory.updated / skills.updated / turn.memory_written / system.activity,
|
|
775
|
+
* GatewayEventMap 既有键)——前端契约不破。
|
|
776
|
+
* 红线:payload 走脱敏(明文凭据/密钥绝不入,X4)+ 大小上限(同 onRelay 纪律)。
|
|
777
|
+
* VSCode 对照:变更事件挂 main 侧状态 owner(IWorkspaceContextService.onDidChangeWorkspaceFolders),
|
|
778
|
+
* 主动推送($acceptWorkspaceData),不挂请求处理器。
|
|
779
|
+
*/
|
|
780
|
+
export interface HostNotificationSink {
|
|
781
|
+
notify(eventName: string, payload: unknown): void;
|
|
782
|
+
}
|
|
783
|
+
/**
|
|
784
|
+
* [X7] qlogicagent 大脑经 x/host.request 可调用的 memory proxy 精确方法面。
|
|
785
|
+
* gateway 白名单与 qla HostMemoryProvider 都必须直接消费此常量,禁止两仓手抄后漂移。
|
|
786
|
+
*/
|
|
787
|
+
export declare const HOST_MEMORY_PROXY_METHODS: readonly ["search", "addText", "embedText", "ingestExtracted", "proposeExtracted", "consumePendingProposals", "feedback", "findRelatedEvents", "synthesizeTimeline", "getActivitySummary", "getAllProfiles", "setProfile", "getAtlas", "setMemoryArchived", "triggerDecay", "resolveConflicts"];
|
|
788
|
+
export type HostMemoryProxyMethod = (typeof HOST_MEMORY_PROXY_METHODS)[number];
|
|
789
|
+
/** [X7-C1a] Capability 大脑代理当前只开放两个只读方法;写面与 connector 尚未入约。 */
|
|
790
|
+
export declare const HOST_CAPABILITY_PROXY_METHODS: readonly ["getSkillSnapshot", "readSkillFile", "recordSkillInvocation", "commitSkillMutation", "applyCuratorPlan", "prepareSkillInstall", "finalizeSkillInstall"];
|
|
791
|
+
export type HostCapabilityProxyMethod = (typeof HOST_CAPABILITY_PROXY_METHODS)[number];
|
|
792
|
+
/**
|
|
793
|
+
* [S3-Session-X7] Agent compute may submit only durable session results and load a
|
|
794
|
+
* resume view. Generic metadata patches and filesystem access are deliberately absent.
|
|
795
|
+
*/
|
|
796
|
+
export declare const HOST_SESSION_PROXY_METHODS: readonly ["loadForResume", "appendTranscript", "updateTitle", "saveState", "saveTaskSummary", "groupSplit"];
|
|
797
|
+
export type HostSessionProxyMethod = (typeof HOST_SESSION_PROXY_METHODS)[number];
|
|
798
|
+
/**
|
|
799
|
+
* [S3-D2-X7] Feedback/telemetry compute may use only these business operations. The
|
|
800
|
+
* gateway owns every durable file and the reliable upload state machine; generic file,
|
|
801
|
+
* object-patch, owner-id, and upload-batch mutation surfaces are intentionally absent.
|
|
802
|
+
*/
|
|
803
|
+
export declare const HOST_FEEDBACK_PROXY_METHODS: readonly ["commitTurnTelemetry", "listDistillableFeedback", "markFeedbackDistilled", "runUploadSweep"];
|
|
804
|
+
export type HostFeedbackProxyMethod = (typeof HOST_FEEDBACK_PROXY_METHODS)[number];
|
|
805
|
+
/** Project registry X7 is intentionally business-shaped; no generic registry/file patches. */
|
|
806
|
+
export declare const HOST_PROJECT_PROXY_METHODS: readonly ["getSnapshot", "create", "switch", "update"];
|
|
807
|
+
export type HostProjectProxyMethod = (typeof HOST_PROJECT_PROXY_METHODS)[number];
|
|
808
|
+
export type HostProjectType = "default" | "personal" | "group" | "solo" | "product" | "automation";
|
|
809
|
+
export interface HostProjectInfo {
|
|
810
|
+
id: ProjectId;
|
|
811
|
+
name: string;
|
|
812
|
+
workspaceDir: string;
|
|
813
|
+
type: HostProjectType;
|
|
814
|
+
status: "active" | "archived";
|
|
815
|
+
groupId?: string;
|
|
816
|
+
createdAt: string;
|
|
817
|
+
updatedAt: string;
|
|
818
|
+
planStatus?: "creating" | "running" | "completed" | "failed" | "cancelled";
|
|
819
|
+
planAgents?: string[];
|
|
820
|
+
planWinnerId?: string;
|
|
821
|
+
leaderSessionId?: string;
|
|
822
|
+
primaryWorkflowId?: string;
|
|
823
|
+
}
|
|
824
|
+
export type HostProjectSnapshotResult = {
|
|
825
|
+
activeProjectId: ProjectId | null;
|
|
826
|
+
projects: HostProjectInfo[];
|
|
827
|
+
};
|
|
828
|
+
export type HostProjectMutationResult = {
|
|
829
|
+
ok: true;
|
|
830
|
+
project: HostProjectInfo;
|
|
831
|
+
deduplicated?: boolean;
|
|
832
|
+
};
|
|
833
|
+
export type HostProjectRequestParams = {
|
|
834
|
+
service: "project";
|
|
835
|
+
method: "getSnapshot";
|
|
836
|
+
params: Record<string, never>;
|
|
837
|
+
} | {
|
|
838
|
+
service: "project";
|
|
839
|
+
method: "create";
|
|
840
|
+
params: {
|
|
841
|
+
name: string;
|
|
842
|
+
workspaceDir?: string;
|
|
843
|
+
type?: Exclude<HostProjectType, "default">;
|
|
844
|
+
groupId?: string;
|
|
845
|
+
};
|
|
846
|
+
} | {
|
|
847
|
+
service: "project";
|
|
848
|
+
method: "switch";
|
|
849
|
+
params: {
|
|
850
|
+
projectIdOrQuery: string;
|
|
851
|
+
};
|
|
852
|
+
} | {
|
|
853
|
+
service: "project";
|
|
854
|
+
method: "update";
|
|
855
|
+
params: {
|
|
856
|
+
projectId: ProjectId;
|
|
857
|
+
planStatus?: HostProjectInfo["planStatus"];
|
|
858
|
+
planAgents?: string[];
|
|
859
|
+
planWinnerId?: string;
|
|
860
|
+
leaderSessionId?: string;
|
|
861
|
+
primaryWorkflowId?: string;
|
|
862
|
+
};
|
|
863
|
+
};
|
|
864
|
+
export interface HostTurnTelemetryInput {
|
|
865
|
+
model?: string;
|
|
866
|
+
provider?: string;
|
|
867
|
+
agentMode?: "chat" | "solo" | "product" | "workflow" | "unknown";
|
|
868
|
+
sourceChannel?: string;
|
|
869
|
+
usage?: {
|
|
870
|
+
inputTokens?: number;
|
|
871
|
+
outputTokens?: number;
|
|
872
|
+
totalTokens?: number;
|
|
873
|
+
};
|
|
874
|
+
toolSummary?: {
|
|
875
|
+
calledTools: string[];
|
|
876
|
+
failedTools: string[];
|
|
877
|
+
blockedTools: string[];
|
|
878
|
+
};
|
|
879
|
+
fileContext?: {
|
|
880
|
+
changedFileCount?: number;
|
|
881
|
+
changedPathsPreview?: string[];
|
|
882
|
+
hasTurnFileChanges?: boolean;
|
|
883
|
+
};
|
|
884
|
+
}
|
|
885
|
+
/** Minimal, non-message-text evidence returned to the agent-side pure distiller. */
|
|
886
|
+
export interface HostDistillableFeedbackEvent {
|
|
887
|
+
feedbackId: string;
|
|
888
|
+
rating: "up" | "down";
|
|
889
|
+
reason?: "missed_requirement" | "incomplete" | "broken_file_link_or_panel" | "code_or_test_failed" | "factually_wrong" | "too_verbose" | "too_short" | "wrong_style" | "other";
|
|
890
|
+
state: "active";
|
|
891
|
+
sessionId: string;
|
|
892
|
+
turnId: string;
|
|
893
|
+
}
|
|
894
|
+
export interface HostFeedbackSweepResult {
|
|
895
|
+
uploaded: number;
|
|
896
|
+
queued: number;
|
|
897
|
+
retried: number;
|
|
898
|
+
exhausted: number;
|
|
899
|
+
}
|
|
900
|
+
export interface HostSessionToolCall {
|
|
901
|
+
id: string;
|
|
902
|
+
type: "function";
|
|
903
|
+
function: {
|
|
904
|
+
name: string;
|
|
905
|
+
arguments: string;
|
|
906
|
+
};
|
|
907
|
+
}
|
|
908
|
+
/** Leaf contract copy of the persisted message wire shape; importing protocol here would cycle. */
|
|
909
|
+
export interface HostSessionMessage {
|
|
910
|
+
role: "system" | "user" | "assistant" | "tool";
|
|
911
|
+
content: string | null;
|
|
912
|
+
tool_calls?: HostSessionToolCall[];
|
|
913
|
+
tool_call_id?: string;
|
|
914
|
+
name?: string;
|
|
915
|
+
is_error?: boolean;
|
|
916
|
+
reasoning_content?: string;
|
|
917
|
+
toolReferences?: string[];
|
|
918
|
+
thinkingBlocks?: Array<{
|
|
919
|
+
thinking: string;
|
|
920
|
+
signature: string;
|
|
921
|
+
}>;
|
|
922
|
+
imageUrls?: string[];
|
|
923
|
+
imageDetail?: "auto" | "low" | "high" | "xhigh";
|
|
924
|
+
imagePixelLimit?: {
|
|
925
|
+
minPixels?: number;
|
|
926
|
+
maxPixels?: number;
|
|
927
|
+
};
|
|
928
|
+
videoUrls?: string[];
|
|
929
|
+
videoFps?: number;
|
|
930
|
+
audioFormat?: "mp3" | "wav" | "aac" | "m4a";
|
|
931
|
+
audioUrls?: string[];
|
|
932
|
+
fileIds?: Array<{
|
|
933
|
+
id: string;
|
|
934
|
+
mimeType?: string;
|
|
935
|
+
size?: number;
|
|
936
|
+
}>;
|
|
937
|
+
blocks?: Array<Record<string, unknown>>;
|
|
938
|
+
attachmentEntries?: Array<Record<string, unknown>>;
|
|
939
|
+
timestamp?: string;
|
|
940
|
+
turnId?: string;
|
|
941
|
+
usage?: {
|
|
942
|
+
inputTokens?: number;
|
|
943
|
+
outputTokens?: number;
|
|
944
|
+
totalTokens?: number;
|
|
945
|
+
};
|
|
946
|
+
displayMetadata?: Record<string, unknown>;
|
|
947
|
+
}
|
|
948
|
+
export interface HostSessionResumeMetadata {
|
|
949
|
+
sessionId: string;
|
|
950
|
+
projectId: string;
|
|
951
|
+
createdAt: string;
|
|
952
|
+
lastActiveAt: string;
|
|
953
|
+
turnCount: number;
|
|
954
|
+
messageCount: number;
|
|
955
|
+
type?: "personal" | "group";
|
|
956
|
+
title?: string;
|
|
957
|
+
agentId?: string;
|
|
958
|
+
model?: string;
|
|
959
|
+
taskSummary?: string;
|
|
960
|
+
carryoverSummary?: string;
|
|
961
|
+
previousSessionId?: string;
|
|
962
|
+
pinnedAt?: string;
|
|
963
|
+
archivedAt?: string;
|
|
964
|
+
sealedAt?: string;
|
|
965
|
+
}
|
|
966
|
+
export type HostSessionLoadForResumeResult = {
|
|
967
|
+
session: null | {
|
|
968
|
+
metadata: HostSessionResumeMetadata;
|
|
969
|
+
messages: HostSessionMessage[];
|
|
970
|
+
corruptLines?: number;
|
|
971
|
+
};
|
|
972
|
+
};
|
|
973
|
+
export type HostSessionAppendResult = {
|
|
974
|
+
status: "appended" | "duplicate" | "session-deleted";
|
|
975
|
+
messageCount: number;
|
|
976
|
+
};
|
|
977
|
+
export type HostSessionMutationResult = {
|
|
978
|
+
status: "updated" | "duplicate" | "session-deleted";
|
|
979
|
+
};
|
|
980
|
+
export type HostSessionGroupSplitResult = HostSessionMutationResult & {
|
|
981
|
+
nextSessionId?: string;
|
|
982
|
+
};
|
|
983
|
+
/** skill-lifecycle.json 的真实记录形状;扩展 provenance 字段必须原样往返。 */
|
|
984
|
+
export interface HostSkillLifecycleRecord {
|
|
985
|
+
name: string;
|
|
986
|
+
state: "active" | "stale" | "archived";
|
|
987
|
+
createdAt: string;
|
|
988
|
+
lastUsedAt?: string;
|
|
989
|
+
lastViewedAt?: string;
|
|
990
|
+
lastPatchedAt?: string;
|
|
991
|
+
staleAt?: string;
|
|
992
|
+
archivedAt?: string;
|
|
993
|
+
pinned: boolean;
|
|
994
|
+
useCount: number;
|
|
995
|
+
positiveCount?: number;
|
|
996
|
+
negativeCount?: number;
|
|
997
|
+
source: "learned" | "created" | "installed" | "promoted";
|
|
998
|
+
resourceType?: string;
|
|
999
|
+
launcherRequired?: boolean;
|
|
1000
|
+
manualReviewRequired?: boolean;
|
|
1001
|
+
sourceTier?: "official" | "community";
|
|
1002
|
+
riskTier?: "R0" | "R1" | "R2" | "R3";
|
|
1003
|
+
artifactDigest?: string;
|
|
1004
|
+
registryResourceId?: string;
|
|
1005
|
+
registryVersion?: string;
|
|
1006
|
+
registrySourceTier?: "official" | "community";
|
|
1007
|
+
registryRiskTier?: "R0" | "R1" | "R2" | "R3";
|
|
1008
|
+
registryEffectiveRiskTier?: "R0" | "R1" | "R2" | "R3";
|
|
1009
|
+
registryKeptSignalAt?: string;
|
|
1010
|
+
[extra: string]: unknown;
|
|
1011
|
+
}
|
|
1012
|
+
/** Gateway 对同一技能 store 的只读快照条目。active 只叠加全局/项目禁用,不叠 turn 工具条件。 */
|
|
1013
|
+
export interface HostSkillSnapshotEntry {
|
|
1014
|
+
name: string;
|
|
1015
|
+
filePath: string;
|
|
1016
|
+
baseDir: string;
|
|
1017
|
+
fileRevision: string;
|
|
1018
|
+
globallyDisabled: boolean;
|
|
1019
|
+
projectDisabled: boolean;
|
|
1020
|
+
active: boolean;
|
|
1021
|
+
systemGenerated: boolean;
|
|
1022
|
+
description?: string;
|
|
1023
|
+
version?: string;
|
|
1024
|
+
category?: string;
|
|
1025
|
+
author?: string;
|
|
1026
|
+
requiredTools?: string[];
|
|
1027
|
+
environments?: string[];
|
|
1028
|
+
source?: HostSkillLifecycleRecord["source"];
|
|
1029
|
+
registryVersion?: string;
|
|
1030
|
+
}
|
|
1031
|
+
/** profiles/<owner>/skill-bundles 中现有 bundle 的真实公开字段。 */
|
|
1032
|
+
export interface HostSkillBundleSnapshot {
|
|
1033
|
+
name: string;
|
|
1034
|
+
skills: string[];
|
|
1035
|
+
filePath: string;
|
|
1036
|
+
}
|
|
1037
|
+
export type HostSkillSnapshotResponse = {
|
|
1038
|
+
revision: string;
|
|
1039
|
+
notModified: true;
|
|
1040
|
+
} | {
|
|
1041
|
+
revision: string;
|
|
1042
|
+
notModified: false;
|
|
1043
|
+
skills: HostSkillSnapshotEntry[];
|
|
1044
|
+
lifecycle: HostSkillLifecycleRecord[];
|
|
1045
|
+
bundles: HostSkillBundleSnapshot[];
|
|
1046
|
+
};
|
|
1047
|
+
export interface HostSkillFileResponse {
|
|
1048
|
+
name: string;
|
|
1049
|
+
relativePath: string;
|
|
1050
|
+
content: string;
|
|
1051
|
+
baseDir: string;
|
|
1052
|
+
revision: string;
|
|
1053
|
+
}
|
|
1054
|
+
export interface HostSkillInvocationResult {
|
|
1055
|
+
name: string;
|
|
1056
|
+
lastUsedAt: string;
|
|
1057
|
+
useCount: number;
|
|
1058
|
+
positiveCount: number;
|
|
1059
|
+
negativeCount: number;
|
|
1060
|
+
}
|
|
1061
|
+
/** 单文件读取上限;host 在解码前按 bytes 检查。 */
|
|
1062
|
+
export declare const HOST_SKILL_FILE_MAX_BYTES: number;
|
|
1063
|
+
/** [X7-P] 单一 agent→host 一元请求通道的服务域。 */
|
|
1064
|
+
export type HostRequestService = "memory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project";
|
|
1065
|
+
/** Preview Browser 的七个允许动作;tool 与 gateway 必须消费此单源。 */
|
|
1066
|
+
export declare const PREVIEW_BROWSER_ACTIONS: readonly ["navigate", "snapshot", "click", "type", "screenshot", "console", "network"];
|
|
1067
|
+
export type PreviewBrowserAction = (typeof PREVIEW_BROWSER_ACTIONS)[number];
|
|
1068
|
+
/** 每个 preview action 的精确 payload;禁止把任意 Electron IPC method/params 暴露给 agent。 */
|
|
1069
|
+
export interface PreviewBrowserActionParams {
|
|
1070
|
+
navigate: {
|
|
1071
|
+
url: string;
|
|
1072
|
+
viewId?: string;
|
|
1073
|
+
};
|
|
1074
|
+
snapshot: {
|
|
1075
|
+
viewId?: string;
|
|
1076
|
+
};
|
|
1077
|
+
click: {
|
|
1078
|
+
ref: string;
|
|
1079
|
+
viewId?: string;
|
|
1080
|
+
};
|
|
1081
|
+
type: {
|
|
1082
|
+
ref: string;
|
|
1083
|
+
text: string;
|
|
1084
|
+
submit?: boolean;
|
|
1085
|
+
viewId?: string;
|
|
1086
|
+
};
|
|
1087
|
+
screenshot: {
|
|
1088
|
+
viewId?: string;
|
|
1089
|
+
};
|
|
1090
|
+
console: {
|
|
1091
|
+
viewId?: string;
|
|
1092
|
+
};
|
|
1093
|
+
network: {
|
|
1094
|
+
viewId?: string;
|
|
1095
|
+
};
|
|
1096
|
+
}
|
|
1097
|
+
/** preview_browser tool 的判别联合参数;action 与 payload 字段保持关联。 */
|
|
1098
|
+
export type PreviewBrowserToolParams = {
|
|
1099
|
+
[Action in PreviewBrowserAction]: {
|
|
1100
|
+
action: Action;
|
|
1101
|
+
} & PreviewBrowserActionParams[Action];
|
|
1102
|
+
}[PreviewBrowserAction];
|
|
1103
|
+
/** preview owner 回传的共享结果面。 */
|
|
1104
|
+
export interface PreviewBrowserDriveResult {
|
|
1105
|
+
text?: string;
|
|
1106
|
+
screenshotB64?: string;
|
|
1107
|
+
error?: string;
|
|
1108
|
+
details?: unknown;
|
|
1109
|
+
}
|
|
1110
|
+
export type HostMemoryRequestParams = {
|
|
1111
|
+
service: "memory";
|
|
1112
|
+
method: HostMemoryProxyMethod;
|
|
1113
|
+
params: unknown[];
|
|
1114
|
+
};
|
|
1115
|
+
export type HostSessionRequestParams = {
|
|
1116
|
+
service: "session";
|
|
1117
|
+
method: "loadForResume";
|
|
1118
|
+
params: {
|
|
1119
|
+
sessionId: string;
|
|
1120
|
+
projectId?: ProjectId;
|
|
1121
|
+
includeMessages?: boolean;
|
|
1122
|
+
};
|
|
1123
|
+
} | {
|
|
1124
|
+
service: "session";
|
|
1125
|
+
method: "appendTranscript";
|
|
1126
|
+
params: {
|
|
1127
|
+
sessionId: string;
|
|
1128
|
+
turnId: string;
|
|
1129
|
+
messageId: string;
|
|
1130
|
+
sequence: number;
|
|
1131
|
+
message: HostSessionMessage;
|
|
1132
|
+
usage?: {
|
|
1133
|
+
inputTokens?: number;
|
|
1134
|
+
outputTokens?: number;
|
|
1135
|
+
totalTokens?: number;
|
|
1136
|
+
};
|
|
1137
|
+
displayMetadata?: Record<string, unknown>;
|
|
1138
|
+
};
|
|
1139
|
+
} | {
|
|
1140
|
+
service: "session";
|
|
1141
|
+
method: "updateTitle";
|
|
1142
|
+
params: {
|
|
1143
|
+
sessionId: string;
|
|
1144
|
+
operationId: string;
|
|
1145
|
+
title: string;
|
|
1146
|
+
};
|
|
1147
|
+
} | {
|
|
1148
|
+
service: "session";
|
|
1149
|
+
method: "saveState";
|
|
1150
|
+
params: {
|
|
1151
|
+
sessionId: string;
|
|
1152
|
+
turnId: string;
|
|
1153
|
+
operationId: string;
|
|
1154
|
+
model?: string;
|
|
1155
|
+
usage: {
|
|
1156
|
+
turnCount: number;
|
|
1157
|
+
totalInputTokens: number;
|
|
1158
|
+
totalOutputTokens: number;
|
|
1159
|
+
};
|
|
1160
|
+
};
|
|
1161
|
+
} | {
|
|
1162
|
+
service: "session";
|
|
1163
|
+
method: "saveTaskSummary";
|
|
1164
|
+
params: {
|
|
1165
|
+
sessionId: string;
|
|
1166
|
+
operationId: string;
|
|
1167
|
+
summary: string;
|
|
1168
|
+
generatedAtTurn: number;
|
|
1169
|
+
};
|
|
1170
|
+
} | {
|
|
1171
|
+
service: "session";
|
|
1172
|
+
method: "groupSplit";
|
|
1173
|
+
params: {
|
|
1174
|
+
sessionId: string;
|
|
1175
|
+
operationId: string;
|
|
1176
|
+
reason: "idle" | "turn-limit";
|
|
1177
|
+
expectedLastActiveAt?: string;
|
|
1178
|
+
expectedTurnCount?: number;
|
|
1179
|
+
};
|
|
1180
|
+
};
|
|
1181
|
+
export type HostFeedbackRequestParams = {
|
|
1182
|
+
service: "feedback";
|
|
1183
|
+
method: "commitTurnTelemetry";
|
|
1184
|
+
params: {
|
|
1185
|
+
projectId: ProjectId;
|
|
1186
|
+
sessionId: string;
|
|
1187
|
+
turnId: string;
|
|
1188
|
+
telemetry: HostTurnTelemetryInput;
|
|
1189
|
+
};
|
|
1190
|
+
} | {
|
|
1191
|
+
service: "feedback";
|
|
1192
|
+
method: "listDistillableFeedback";
|
|
1193
|
+
params: {
|
|
1194
|
+
projectId: ProjectId;
|
|
1195
|
+
};
|
|
1196
|
+
} | {
|
|
1197
|
+
service: "feedback";
|
|
1198
|
+
method: "markFeedbackDistilled";
|
|
1199
|
+
params: {
|
|
1200
|
+
projectId: ProjectId;
|
|
1201
|
+
turnId: string;
|
|
1202
|
+
clusterKey: string;
|
|
1203
|
+
idempotencyKey: string;
|
|
1204
|
+
};
|
|
1205
|
+
} | {
|
|
1206
|
+
service: "feedback";
|
|
1207
|
+
method: "runUploadSweep";
|
|
1208
|
+
params: {
|
|
1209
|
+
projectId: ProjectId;
|
|
1210
|
+
};
|
|
1211
|
+
};
|
|
1212
|
+
/** Agent-originated profile store calls. UI/provider surfaces are intentionally excluded. */
|
|
1213
|
+
export declare const HOST_PROFILE_PROXY_METHODS: readonly ["getTunables", "updateTunable", "clearTunable", "appendDirectoryAllowRule"];
|
|
1214
|
+
export type HostProfileProxyMethod = typeof HOST_PROFILE_PROXY_METHODS[number];
|
|
1215
|
+
/**
|
|
1216
|
+
* Profile proxy envelopes use positional args and never carry ownerId. The gateway injects the
|
|
1217
|
+
* authenticated owner at dispatch. Directory approval policy is likewise host-owned: the agent
|
|
1218
|
+
* may provide only pathPrefix, never pattern/behavior/reason.
|
|
1219
|
+
*/
|
|
1220
|
+
export type HostProfileRequestParams = {
|
|
1221
|
+
service: "profile";
|
|
1222
|
+
method: "getTunables";
|
|
1223
|
+
params: [];
|
|
1224
|
+
} | {
|
|
1225
|
+
service: "profile";
|
|
1226
|
+
method: "updateTunable";
|
|
1227
|
+
params: [key: string, value: unknown];
|
|
1228
|
+
} | {
|
|
1229
|
+
service: "profile";
|
|
1230
|
+
method: "clearTunable";
|
|
1231
|
+
params: [key: string];
|
|
1232
|
+
} | {
|
|
1233
|
+
service: "profile";
|
|
1234
|
+
method: "appendDirectoryAllowRule";
|
|
1235
|
+
params: [pathPrefix: string];
|
|
1236
|
+
};
|
|
1237
|
+
/** Capability C1a 只读请求。projectId 由 gateway 项目注册表解析,agent 不得传 cwd/ownerId。 */
|
|
1238
|
+
export interface HostGetSkillSnapshotParams {
|
|
1239
|
+
projectId?: ProjectId;
|
|
1240
|
+
knownRevision?: string;
|
|
1241
|
+
}
|
|
1242
|
+
export interface HostReadSkillFileParams {
|
|
1243
|
+
name: string;
|
|
1244
|
+
relativePath?: string;
|
|
1245
|
+
expectedRevision?: string;
|
|
1246
|
+
}
|
|
1247
|
+
export interface HostRecordSkillInvocationParams {
|
|
1248
|
+
name: string;
|
|
1249
|
+
success: boolean;
|
|
1250
|
+
}
|
|
1251
|
+
/** One structured C2 write entrypoint. Content edits are CAS-only; null means create-if-absent. */
|
|
1252
|
+
export type HostSkillMutation = {
|
|
1253
|
+
kind: "create";
|
|
1254
|
+
name: string;
|
|
1255
|
+
content: string;
|
|
1256
|
+
source?: "created" | "learned";
|
|
1257
|
+
supportingFile?: {
|
|
1258
|
+
relativePath: string;
|
|
1259
|
+
content: string;
|
|
1260
|
+
};
|
|
1261
|
+
} | {
|
|
1262
|
+
kind: "editContent";
|
|
1263
|
+
name: string;
|
|
1264
|
+
expectedRevision: string;
|
|
1265
|
+
content: string;
|
|
1266
|
+
} | {
|
|
1267
|
+
kind: "editSupportingFile";
|
|
1268
|
+
name: string;
|
|
1269
|
+
relativePath: string;
|
|
1270
|
+
expectedRevision: string | null;
|
|
1271
|
+
content: string;
|
|
1272
|
+
} | {
|
|
1273
|
+
kind: "delete";
|
|
1274
|
+
name: string;
|
|
1275
|
+
} | {
|
|
1276
|
+
kind: "setGlobalDisabled";
|
|
1277
|
+
name: string;
|
|
1278
|
+
disabled: boolean;
|
|
1279
|
+
} | {
|
|
1280
|
+
kind: "setProjectDisabled";
|
|
1281
|
+
name: string;
|
|
1282
|
+
projectId: ProjectId;
|
|
1283
|
+
disabled: boolean;
|
|
1284
|
+
} | {
|
|
1285
|
+
kind: "setPinned";
|
|
1286
|
+
name: string;
|
|
1287
|
+
pinned: boolean;
|
|
1288
|
+
} | {
|
|
1289
|
+
kind: "promote";
|
|
1290
|
+
name: string;
|
|
1291
|
+
};
|
|
1292
|
+
export interface HostCommitSkillMutationParams {
|
|
1293
|
+
mutation: HostSkillMutation;
|
|
1294
|
+
}
|
|
1295
|
+
export type HostSkillMutationResult = {
|
|
1296
|
+
kind: "create";
|
|
1297
|
+
name: string;
|
|
1298
|
+
revision: string;
|
|
1299
|
+
changed: true;
|
|
1300
|
+
} | {
|
|
1301
|
+
kind: "editContent";
|
|
1302
|
+
name: string;
|
|
1303
|
+
revision: string;
|
|
1304
|
+
changed: true;
|
|
1305
|
+
} | {
|
|
1306
|
+
kind: "editSupportingFile";
|
|
1307
|
+
name: string;
|
|
1308
|
+
revision: string;
|
|
1309
|
+
changed: true;
|
|
1310
|
+
} | {
|
|
1311
|
+
kind: "delete";
|
|
1312
|
+
name: string;
|
|
1313
|
+
deleted: true;
|
|
1314
|
+
} | {
|
|
1315
|
+
kind: "setGlobalDisabled";
|
|
1316
|
+
name: string;
|
|
1317
|
+
disabled: boolean;
|
|
1318
|
+
changed: boolean;
|
|
1319
|
+
} | {
|
|
1320
|
+
kind: "setProjectDisabled";
|
|
1321
|
+
name: string;
|
|
1322
|
+
disabled: boolean;
|
|
1323
|
+
changed: boolean;
|
|
1324
|
+
} | {
|
|
1325
|
+
kind: "setPinned";
|
|
1326
|
+
name: string;
|
|
1327
|
+
pinned: boolean;
|
|
1328
|
+
changed: boolean;
|
|
1329
|
+
} | {
|
|
1330
|
+
kind: "promote";
|
|
1331
|
+
name: string;
|
|
1332
|
+
promoted: true;
|
|
1333
|
+
changed: boolean;
|
|
1334
|
+
};
|
|
1335
|
+
export type HostSkillLifecycleState = HostSkillLifecycleRecord["state"];
|
|
1336
|
+
export interface HostCuratorTransition {
|
|
1337
|
+
name: string;
|
|
1338
|
+
from: HostSkillLifecycleState;
|
|
1339
|
+
to: HostSkillLifecycleState;
|
|
1340
|
+
}
|
|
1341
|
+
export interface HostApplyCuratorPlanParams {
|
|
1342
|
+
expectedRevision: string;
|
|
1343
|
+
transitions: HostCuratorTransition[];
|
|
1344
|
+
}
|
|
1345
|
+
export interface HostApplyCuratorPlanResult {
|
|
1346
|
+
revision: string;
|
|
1347
|
+
changed: boolean;
|
|
1348
|
+
transitioned: HostCuratorTransition[];
|
|
1349
|
+
}
|
|
1350
|
+
export type HostSkillInstallRiskTier = "R0" | "R1" | "R2" | "R3";
|
|
1351
|
+
export interface HostPrepareSkillInstallParams {
|
|
1352
|
+
name: string;
|
|
1353
|
+
version: string;
|
|
1354
|
+
checksum: string;
|
|
1355
|
+
sizeBytes: number;
|
|
1356
|
+
allowReplace: boolean;
|
|
1357
|
+
provenance: {
|
|
1358
|
+
sourceTier: "official" | "community";
|
|
1359
|
+
resourceRiskTier: HostSkillInstallRiskTier;
|
|
1360
|
+
effectiveRiskTier: HostSkillInstallRiskTier;
|
|
1361
|
+
};
|
|
1362
|
+
}
|
|
1363
|
+
export interface HostPrepareSkillInstallResult {
|
|
1364
|
+
installationId: string;
|
|
1365
|
+
artifactPath: string;
|
|
1366
|
+
contentDir: string;
|
|
1367
|
+
expiresAt: string;
|
|
1368
|
+
}
|
|
1369
|
+
export interface HostFinalizeSkillInstallParams {
|
|
1370
|
+
installationId: string;
|
|
1371
|
+
action: "adopt" | "discard";
|
|
1372
|
+
}
|
|
1373
|
+
export type HostFinalizeSkillInstallResult = {
|
|
1374
|
+
action: "discard";
|
|
1375
|
+
discarded: true;
|
|
1376
|
+
} | {
|
|
1377
|
+
action: "adopt";
|
|
1378
|
+
resourceId: string;
|
|
1379
|
+
version: string;
|
|
1380
|
+
skillName: string;
|
|
1381
|
+
installDir: string;
|
|
1382
|
+
checksum: string;
|
|
1383
|
+
replaced: boolean;
|
|
1384
|
+
};
|
|
1385
|
+
export type HostCapabilityRequestParams = {
|
|
1386
|
+
service: "capability";
|
|
1387
|
+
method: "getSkillSnapshot";
|
|
1388
|
+
params: HostGetSkillSnapshotParams;
|
|
1389
|
+
} | {
|
|
1390
|
+
service: "capability";
|
|
1391
|
+
method: "readSkillFile";
|
|
1392
|
+
params: HostReadSkillFileParams;
|
|
1393
|
+
} | {
|
|
1394
|
+
service: "capability";
|
|
1395
|
+
method: "recordSkillInvocation";
|
|
1396
|
+
params: HostRecordSkillInvocationParams;
|
|
1397
|
+
} | {
|
|
1398
|
+
service: "capability";
|
|
1399
|
+
method: "commitSkillMutation";
|
|
1400
|
+
params: HostCommitSkillMutationParams;
|
|
1401
|
+
} | {
|
|
1402
|
+
service: "capability";
|
|
1403
|
+
method: "applyCuratorPlan";
|
|
1404
|
+
params: HostApplyCuratorPlanParams;
|
|
1405
|
+
} | {
|
|
1406
|
+
service: "capability";
|
|
1407
|
+
method: "prepareSkillInstall";
|
|
1408
|
+
params: HostPrepareSkillInstallParams;
|
|
1409
|
+
} | {
|
|
1410
|
+
service: "capability";
|
|
1411
|
+
method: "finalizeSkillInstall";
|
|
1412
|
+
params: HostFinalizeSkillInstallParams;
|
|
1413
|
+
};
|
|
1414
|
+
export type HostPreviewRequestParams = {
|
|
1415
|
+
[Action in PreviewBrowserAction]: {
|
|
1416
|
+
service: "preview";
|
|
1417
|
+
method: Action;
|
|
1418
|
+
/** sessionId is injected by the turn backend for Electron pane attribution; it is not agent input. */
|
|
1419
|
+
params: PreviewBrowserActionParams[Action] & {
|
|
1420
|
+
sessionId?: string;
|
|
1421
|
+
};
|
|
1422
|
+
};
|
|
1423
|
+
}[PreviewBrowserAction];
|
|
1424
|
+
/**
|
|
1425
|
+
* [X7-P] 跨进程 HostRequest 判别联合。memory/profile/preview 共用 `x/host.request`,
|
|
1426
|
+
* service + method 二级分派;preview 的 method 与 payload 在类型层保持逐动作关联。
|
|
1427
|
+
*/
|
|
1428
|
+
export type HostRequestParams = HostMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams;
|
|
1429
|
+
/** initialize 声明的真实已装配 host-request 服务;version 只接受冻结版本 1。 */
|
|
1430
|
+
export type HostRequestCapability = {
|
|
1431
|
+
version: 1;
|
|
1432
|
+
services: HostRequestService[];
|
|
1433
|
+
};
|
|
1434
|
+
/** [X7-P] wire 方法名(x/ 族),旧 HostState 名称不保留兼容别名。 */
|
|
1435
|
+
export declare const HOST_REQUEST_WIRE_METHODS: {
|
|
1436
|
+
readonly request: "x/host.request";
|
|
1437
|
+
};
|
|
1438
|
+
export declare function isHostSkillSnapshotResponse(value: unknown): value is HostSkillSnapshotResponse;
|
|
1439
|
+
export declare function isHostSkillFileResponse(value: unknown): value is HostSkillFileResponse;
|
|
1440
|
+
export declare function isHostSkillInvocationResult(value: unknown): value is HostSkillInvocationResult;
|
|
1441
|
+
export declare function isHostSkillMutationResult(value: unknown): value is HostSkillMutationResult;
|
|
1442
|
+
export declare function isHostApplyCuratorPlanResult(value: unknown): value is HostApplyCuratorPlanResult;
|
|
1443
|
+
export declare function isHostPrepareSkillInstallResult(value: unknown): value is HostPrepareSkillInstallResult;
|
|
1444
|
+
export declare function isHostFinalizeSkillInstallResult(value: unknown): value is HostFinalizeSkillInstallResult;
|
|
1445
|
+
export declare function isHostSessionLoadForResumeResult(value: unknown): value is HostSessionLoadForResumeResult;
|
|
1446
|
+
export declare function isHostSessionAppendResult(value: unknown): value is HostSessionAppendResult;
|
|
1447
|
+
export declare function isHostSessionMutationResult(value: unknown): value is HostSessionMutationResult;
|
|
1448
|
+
export declare function isHostSessionGroupSplitResult(value: unknown): value is HostSessionGroupSplitResult;
|
|
1449
|
+
/** Runtime wire guard used by the gateway before service dispatch. */
|
|
1450
|
+
export declare function isHostRequestParams(value: unknown): value is HostRequestParams;
|
|
1451
|
+
export declare function isHostFeedbackCommitResult(value: unknown): value is {
|
|
1452
|
+
ok: true;
|
|
1453
|
+
};
|
|
1454
|
+
export declare function isHostDistillableFeedbackResult(value: unknown): value is {
|
|
1455
|
+
events: HostDistillableFeedbackEvent[];
|
|
1456
|
+
};
|
|
1457
|
+
export declare function isHostFeedbackMarkResult(value: unknown): value is {
|
|
1458
|
+
ok: true;
|
|
1459
|
+
updated: boolean;
|
|
1460
|
+
};
|
|
1461
|
+
export declare function isHostFeedbackSweepResult(value: unknown): value is HostFeedbackSweepResult;
|
|
1462
|
+
export declare function isHostProjectSnapshotResult(value: unknown): value is HostProjectSnapshotResult;
|
|
1463
|
+
export declare function isHostProjectMutationResult(value: unknown): value is HostProjectMutationResult;
|
|
1464
|
+
/** Exact version + exact service-discriminant capability check; no prefix/coercion fallback. */
|
|
1465
|
+
export declare function supportsHostRequestService(capability: unknown, service: unknown): boolean;
|
|
1466
|
+
/**
|
|
1467
|
+
* [X7 检索单源] FTS 分词 —— memories.db 的写侧(text_seg 列)与查侧(FTS 查询)**必须同一实现**,
|
|
1468
|
+
* 漂移即召回静默清零(fts-segment.ts 文件头铁律)。B3 后唯一写者=gateway(runtime 仓),故经本契约包共享
|
|
1469
|
+
* 单一实现(先例:deriveProjectId 同款 re-export);qla 侧 LocalMemoryStore 与 gateway memory-profile-sqlite
|
|
1470
|
+
* 引用同一份,零复刻。纯函数零依赖(仅正则)。
|
|
1471
|
+
* 实现体落在本契约模块内(src/host-contract/fts-segment.ts)而非 re-export skills——host-contract 是
|
|
1472
|
+
* leaf(acp-protocol.ts 文件头依赖此不变式;反向 re-export 曾闭合 host-contract→skills→runtime→
|
|
1473
|
+
* protocol→host-contract 模块环,check-architecture-boundaries top-level-cycles 抓出)。
|
|
1474
|
+
*/
|
|
1475
|
+
export { segmentForFts, segmentTextForFts } from "./fts-segment.js";
|