qlogicagent 2.20.2 → 2.20.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-contract.js +1 -1
- package/dist/agent.js +39 -35
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/host-session-collection-contract.js +1 -1
- package/dist/index.js +624 -549
- package/dist/memory-category-contract.js +1 -0
- package/dist/orchestration.js +1 -1
- package/dist/project-memory-host.js +21 -21
- package/dist/protocol.js +1 -1
- package/dist/skill-category-contract.js +1 -0
- package/dist/skills/builtin/web-research/SKILL.md +37 -0
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +1 -1
- package/dist/tunables.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +6 -9
- package/dist/types/agent/memory-recall-injection.d.ts +1 -6
- package/dist/types/agent/tool-loop/agent-argument-normalizer.d.ts +12 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +8 -0
- package/dist/types/agent/tool-loop.d.ts +5 -0
- package/dist/types/agent/types.d.ts +5 -0
- package/dist/types/cli/acp-extended-handlers.d.ts +11 -9
- package/dist/types/cli/acp-session-handlers.d.ts +1 -1
- package/dist/types/cli/acp-session-host.d.ts +8 -0
- package/dist/types/cli/agent-runtime-bootstrap.d.ts +7 -1
- package/dist/types/cli/agent-runtime-session-state.d.ts +23 -6
- package/dist/types/cli/atomic-text-file.d.ts +31 -0
- package/dist/types/cli/background-context-capsule.d.ts +12 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +1 -0
- package/dist/types/cli/cli-acp-request-handler.d.ts +3 -1
- package/dist/types/cli/community-workflow-installer.d.ts +1 -1
- package/dist/types/cli/core-tool-coordinator.d.ts +1 -0
- package/dist/types/cli/core-tools/agent-tool-service.d.ts +17 -1
- package/dist/types/cli/dev-tool-bootstrap.d.ts +3 -2
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +1 -0
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +3 -1
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +81 -0
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +59 -0
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +2 -0
- package/dist/types/cli/handlers/community-handler.d.ts +2 -0
- package/dist/types/cli/handlers/dream-handler.d.ts +1 -1
- package/dist/types/cli/handlers/memory-handler.d.ts +2 -14
- package/dist/types/cli/handlers/product-handler.d.ts +6 -24
- package/dist/types/cli/handlers/turn-handler.d.ts +1 -0
- package/dist/types/cli/idle-dream-coordinator.d.ts +9 -5
- package/dist/types/cli/memory-background-coordinator.d.ts +26 -0
- package/dist/types/cli/memory-candidate-service.d.ts +2 -3
- package/dist/types/cli/memory-coordinator.d.ts +12 -8
- package/dist/types/cli/permission-bootstrap.d.ts +10 -1
- package/dist/types/cli/product-acp-params.d.ts +29 -0
- package/dist/types/cli/resolved-agent-cache.d.ts +18 -7
- package/dist/types/cli/rpc-registry.d.ts +2 -1
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +2 -0
- package/dist/types/cli/stdio-acp-request-host.d.ts +7 -4
- package/dist/types/cli/stdio-agent-session-bootstrap.d.ts +8 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +4 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +1 -0
- package/dist/types/cli/stdio-server.d.ts +53 -16
- package/dist/types/cli/stdio-session-runtime-coordinator.d.ts +0 -2
- package/dist/types/cli/task-distillation-coordinator.d.ts +42 -14
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +14 -4
- package/dist/types/cli/tool-bootstrap.d.ts +2 -1
- package/dist/types/cli/turn-core.d.ts +4 -0
- package/dist/types/cli/turn-lifecycle.d.ts +1 -0
- package/dist/types/contracts/hooks.d.ts +3 -2
- package/dist/types/contracts/turn-event.d.ts +7 -0
- package/dist/types/host-contract/index.d.ts +144 -14
- package/dist/types/host-contract/memory-category.d.ts +8 -0
- package/dist/types/host-contract/skill-category.d.ts +5 -0
- package/dist/types/host-session-collection-contract.d.ts +1 -0
- package/dist/types/orchestration/agent-instance.d.ts +15 -0
- package/dist/types/orchestration/dag-scheduler.d.ts +18 -0
- package/dist/types/orchestration/delegate-approval-policy.d.ts +8 -0
- package/dist/types/orchestration/goal-acceptance.d.ts +2 -5
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +4 -2
- package/dist/types/orchestration/goal-mode-adapters.d.ts +16 -0
- package/dist/types/orchestration/goal-run-types.d.ts +6 -1
- package/dist/types/orchestration/product-budget.d.ts +35 -16
- package/dist/types/orchestration/product-persistence.d.ts +5 -14
- package/dist/types/orchestration/product-planner.d.ts +38 -0
- package/dist/types/orchestration/product-worktree.d.ts +4 -2
- package/dist/types/orchestration/solo-evaluator.d.ts +42 -2
- package/dist/types/orchestration/solo-spec-builder.d.ts +3 -0
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +6 -0
- package/dist/types/orchestration/testing/run-state-client-double.d.ts +13 -0
- package/dist/types/orchestration/workflow/builtin-capabilities.d.ts +3 -0
- package/dist/types/orchestration/workflow/capability-catalog.d.ts +31 -0
- package/dist/types/orchestration/workflow/cron-schedule.d.ts +3 -4
- package/dist/types/orchestration/workflow/expression.d.ts +2 -1
- package/dist/types/orchestration/workflow/n8n-import.d.ts +3 -0
- package/dist/types/orchestration/workflow/node-registry.d.ts +2 -2
- package/dist/types/orchestration/workflow/node-schema.d.ts +20 -4
- package/dist/types/orchestration/workflow/params-schema.d.ts +7 -6
- package/dist/types/orchestration/workflow/qla-executor-host.d.ts +4 -1
- package/dist/types/orchestration/workflow/run-history-store.d.ts +33 -3
- package/dist/types/orchestration/workflow/semantic-acceptance.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-authoring.d.ts +74 -0
- package/dist/types/orchestration/workflow/workflow-bundle.d.ts +4 -0
- package/dist/types/orchestration/workflow/workflow-controller.d.ts +16 -4
- package/dist/types/orchestration/workflow/workflow-edit-context.d.ts +46 -0
- package/dist/types/orchestration/workflow/workflow-intent-contract.d.ts +56 -0
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +7 -0
- package/dist/types/orchestration/workflow/workflow-runtime.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-scheduler.d.ts +11 -0
- package/dist/types/orchestration/workflow/workflow-store.d.ts +5 -0
- package/dist/types/orchestration/workflow/workflow-template-setup.d.ts +65 -0
- package/dist/types/orchestration/workflow/workflow-trigger.d.ts +4 -0
- package/dist/types/orchestration/workflow-chat-builder.d.ts +105 -20
- package/dist/types/orchestration/worktree-task-prompt.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +49 -8
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +97 -9
- package/dist/types/protocol/wire/acp-protocol.d.ts +7 -1
- package/dist/types/protocol/wire/agent-methods.d.ts +15 -1
- package/dist/types/protocol/wire/index.d.ts +2 -4
- package/dist/types/protocol/wire/memory-provider-lifecycle.d.ts +1 -39
- package/dist/types/protocol/wire/notification-payloads.d.ts +96 -1
- package/dist/types/protocol/wire/web-capability.d.ts +2 -2
- package/dist/types/runtime/community/community-consent-client.d.ts +3 -0
- package/dist/types/runtime/config/tunable-defaults.d.ts +0 -6
- package/dist/types/runtime/execution/bounded-output-tail.d.ts +7 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +8 -5
- package/dist/types/runtime/execution/dream-category-context.d.ts +3 -3
- package/dist/types/runtime/execution/structured-tool-progress.d.ts +21 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +20 -8
- package/dist/types/runtime/infra/background-tasks.d.ts +5 -1
- package/dist/types/runtime/infra/cloud-auth-host-authority.d.ts +4 -0
- package/dist/types/runtime/infra/llmrouter-access-token.d.ts +0 -1
- package/dist/types/runtime/infra/subagent-turn-snapshot.d.ts +32 -0
- package/dist/types/runtime/infra/turn-telemetry-store.d.ts +22 -0
- package/dist/types/runtime/memory/implicit-extraction.d.ts +23 -7
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -5
- package/dist/types/runtime/ports/index.d.ts +2 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +31 -16
- package/dist/types/runtime/ports/memory-writer.d.ts +55 -6
- package/dist/types/runtime/ports/permission-contracts.d.ts +2 -0
- package/dist/types/runtime/ports/tool-contracts.d.ts +3 -1
- package/dist/types/runtime/prompt/identity-section.d.ts +2 -0
- package/dist/types/runtime/session/session-permission-store.d.ts +6 -0
- package/dist/types/runtime/tasks/task-types.d.ts +2 -0
- package/dist/types/skills/memory/host-memory-provider.d.ts +59 -9
- package/dist/types/skills/memory/memory-tool.d.ts +3 -1
- package/dist/types/skills/memory/task-distillation.d.ts +22 -3
- package/dist/types/skills/permissions/hook-runner.d.ts +8 -0
- package/dist/types/skills/permissions/operation-classifier.d.ts +7 -0
- package/dist/types/skills/skill-system/skill-category.d.ts +10 -0
- package/dist/types/skills/tools/agent-tool.d.ts +13 -21
- package/dist/types/skills/tools/edit-tool.d.ts +10 -2
- package/dist/types/skills/tools/exec-tool.d.ts +2 -2
- package/dist/types/skills/tools/file-text-snapshot.d.ts +24 -0
- package/dist/types/skills/tools/lsp-tool.d.ts +1 -1
- package/dist/types/skills/tools/patch-tool.d.ts +10 -3
- package/dist/types/skills/tools/read-tool.d.ts +23 -1
- package/dist/types/skills/tools/repo-map-tool.d.ts +52 -0
- package/dist/types/skills/tools/search-tool.d.ts +10 -1
- package/dist/types/skills/tools/shell/index.d.ts +1 -2
- package/dist/types/skills/tools/shell/shell-command.d.ts +1 -1
- package/dist/types/skills/tools/shell/shell-exec.d.ts +2 -2
- package/dist/types/skills/tools/shell/task-output.d.ts +12 -3
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +15 -0
- package/dist/types/skills/tools/task-tool.d.ts +16 -2
- package/dist/types/skills/tools/write-tool.d.ts +2 -1
- package/dist/types/transport/acp-server.d.ts +1 -0
- package/dist/types/transport/host-cloud-auth-client.d.ts +10 -0
- package/dist/types/transport/host-community-client.d.ts +8 -0
- package/dist/types/transport/host-run-state-client.d.ts +6 -0
- package/dist/types/workflow-host.d.ts +8 -1
- package/dist/workflow-host.js +9 -9
- package/package.json +25 -6
- package/dist/types/cli/tool-bootstrap-web-registration.d.ts +0 -14
- package/dist/types/orchestration/tool-cascade.d.ts +0 -49
- package/dist/types/protocol/wire/channel-ingress.d.ts +0 -29
- package/dist/types/protocol/wire/channel.d.ts +0 -89
- package/dist/types/runtime/infra/native-mcp-config-sync.d.ts +0 -16
- package/dist/types/runtime/memory/categories.d.ts +0 -5
- package/dist/types/runtime/memory/recall-category-filter.d.ts +0 -42
- package/dist/types/runtime/ports/source-provider.d.ts +0 -39
- package/dist/types/runtime/ports/web-search-contracts.d.ts +0 -21
- package/dist/types/server/search-svc.d.ts +0 -1
- package/dist/types/skills/memory/local-embedding.d.ts +0 -80
- package/dist/types/skills/memory/memory-config-resolver.d.ts +0 -4
- package/dist/types/skills/memory/memory-embedding-config.d.ts +0 -31
- package/dist/types/skills/tools/web-answer-tool.d.ts +0 -27
- package/dist/types/skills/tools/web-fetch-tool.d.ts +0 -80
- package/dist/types/skills/tools/web-research-tool.d.ts +0 -48
- package/dist/types/skills/tools/web-search-tool.d.ts +0 -46
- package/dist/types/skills/web-search/brave-source.d.ts +0 -3
- package/dist/types/skills/web-search/crawl4ai-extractor.d.ts +0 -16
- package/dist/types/skills/web-search/embedding-rerank.d.ts +0 -13
- package/dist/types/skills/web-search/exa-source.d.ts +0 -3
- package/dist/types/skills/web-search/multi-source-backend.d.ts +0 -23
- package/dist/types/skills/web-search/redis-source-cache.d.ts +0 -6
- package/dist/types/skills/web-search/search-svc-source.d.ts +0 -5
- package/dist/types/skills/web-search/searxng-source.d.ts +0 -4
- package/dist/types/skills/web-search/serper-source.d.ts +0 -3
- package/dist/types/skills/web-search/source-factory.d.ts +0 -6
- package/dist/types/skills/web-search/stability.d.ts +0 -26
- package/dist/types/skills/web-search/web-tunable-resolver.d.ts +0 -16
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Task distillation coordinator (R3 wiring) — 候选采集/空闲窗蒸馏/晋升通知。
|
|
3
3
|
* 纯逻辑在 skills/memory/task-distillation.ts;本模块只做依赖装配与生命周期:
|
|
4
|
-
* ·
|
|
4
|
+
* · captureTurn: 回合完成屏障内只持久化候选;embedding 留给可抢占后台
|
|
5
|
+
* · enrichCandidate: 后台补充 embedding;被前台抢占也不影响已持久化候选
|
|
5
6
|
* · runPass: idle 空闲窗(stdio-server onIdle 并联)与 memory.distill RPC 共用入口
|
|
6
7
|
* · 蒸馏产物: category=procedure 进长期记忆(tag distilled@v1+sig),召回自然带出;
|
|
7
8
|
* LLM 摘要(dream 同款小模型)失败时降级确定性模板 —— 蒸馏永不因模型不可用而丢样本。
|
|
8
|
-
* · 晋升(spec:唯一技能入口)
|
|
9
|
+
* · 晋升(spec:唯一技能入口):复用量只用于发现候选;Host 的来源证据与跨会话前台结果验证是硬门槛。
|
|
9
10
|
*/
|
|
10
11
|
import { type PromotionMetrics, type CandidateStoreFile, type PromotionProposal, type ProcedureUsageStoreFile, type PromotionStoreFile } from "../skills/memory/task-distillation.js";
|
|
11
12
|
import type { HostCapabilityClient } from "../transport/host-capability-client.js";
|
|
13
|
+
import type { ProcedureVerificationEvidence } from "../host-contract/index.js";
|
|
12
14
|
/** [A4] addProcedure 落库回执分类(见 TaskDistillationDeps.addProcedure)。 */
|
|
13
15
|
export type AddProcedureOutcome = "created" | "merged" | "rejected" | "retryable-failure";
|
|
14
16
|
export interface TaskDistillationDeps {
|
|
@@ -16,25 +18,35 @@ export interface TaskDistillationDeps {
|
|
|
16
18
|
hostCapabilityClient: () => HostCapabilityClient | undefined;
|
|
17
19
|
/** 签名 embedding;null=不可用(候选照存但不参与聚类,宁严勿松)。
|
|
18
20
|
* B3(X7):number[](非 Float32Array)——host 模式下 embedText 结果跨 x/host.request JSON wire。 */
|
|
19
|
-
embed: (text: string) => Promise<number[] | null>;
|
|
21
|
+
embed: (text: string, signal?: AbortSignal) => Promise<number[] | null>;
|
|
20
22
|
/** [A4] 落库回执四分类(由 ingestExtracted 的结构化 items 归并):
|
|
21
23
|
* created = 真实新落库 → 标 distilled + 发通知(只有它发);
|
|
22
24
|
* merged = 近重复合并/已入提案管道 —— 合法成功,标 distilled 不通知;
|
|
23
25
|
* rejected = 安全闸拒/冲突 —— 终态,候选标 rejected 不再重试;
|
|
24
26
|
* retryable-failure = RPC 抛错/环境未就绪 —— 候选保持 pending 等下轮。 */
|
|
25
|
-
addProcedure: (text: string, tags: string[]
|
|
27
|
+
addProcedure: (text: string, tags: string[], evidence: {
|
|
28
|
+
candidateIds: string[];
|
|
29
|
+
idempotencyKey: string;
|
|
30
|
+
}) => Promise<AddProcedureOutcome>;
|
|
26
31
|
/** 小模型摘要(dream 同款);null/失败 → 降级模板 */
|
|
27
|
-
llmExtract?: (prompt: string) => Promise<string | null>;
|
|
32
|
+
llmExtract?: (prompt: string, signal?: AbortSignal) => Promise<string | null>;
|
|
28
33
|
/** 晋升扫描数据源:全部 distilled 条目 {id,text,accessCount,importance} */
|
|
29
34
|
listDistilled: () => Promise<Array<{
|
|
30
35
|
id: string;
|
|
31
36
|
text: string;
|
|
32
37
|
accessCount: number;
|
|
33
38
|
importance: number;
|
|
39
|
+
verification: ProcedureVerificationEvidence;
|
|
34
40
|
}>>;
|
|
35
|
-
/**
|
|
36
|
-
|
|
37
|
-
|
|
41
|
+
/** Exact archived-aware recovery probe; unlike listDistilled this does not hide retired rows. */
|
|
42
|
+
readDistilledProcedure: (procedureId: string) => Promise<{
|
|
43
|
+
id: string;
|
|
44
|
+
text: string;
|
|
45
|
+
accessCount: number;
|
|
46
|
+
importance: number;
|
|
47
|
+
isArchived: boolean;
|
|
48
|
+
verification: ProcedureVerificationEvidence;
|
|
49
|
+
} | null>;
|
|
38
50
|
/** [A10] 升格窄 Saga(Host 协调,memory proxy promoteDistilledProcedure):
|
|
39
51
|
* create+verify → archive → proposal accepted,幂等/补偿/续跑在 Host;
|
|
40
52
|
* 大脑传入推理产物(渲染并校验过的 SKILL.md 全文、确定性 skillName、标题/计数/auto)。 */
|
|
@@ -54,6 +66,17 @@ export interface TaskDistillationDeps {
|
|
|
54
66
|
proposalAccepted: boolean;
|
|
55
67
|
};
|
|
56
68
|
}>;
|
|
69
|
+
demoteProcedure: (input: {
|
|
70
|
+
procedureId: string;
|
|
71
|
+
}) => Promise<{
|
|
72
|
+
outcome: "completed" | "already-completed";
|
|
73
|
+
skillName: string;
|
|
74
|
+
steps: {
|
|
75
|
+
skillDeleted: boolean;
|
|
76
|
+
memoryUnarchived: boolean;
|
|
77
|
+
proposalReverted: boolean;
|
|
78
|
+
};
|
|
79
|
+
}>;
|
|
57
80
|
/** [X7] procedure-usage.json 读:store-owner 归 gateway,经 x/host proxy(自动档跨-session 数据源)。 */
|
|
58
81
|
readProcedureUsage: () => Promise<ProcedureUsageStoreFile>;
|
|
59
82
|
/** [X7] task-distill-candidates.json 读/写:store-owner 归 gateway;大脑侧裁剪(capCandidateStore)后经 proxy 写。 */
|
|
@@ -78,17 +101,22 @@ export interface DistillPassResult {
|
|
|
78
101
|
promotionsNotified: number;
|
|
79
102
|
pendingCandidates: number;
|
|
80
103
|
}
|
|
104
|
+
export declare function resolveCandidateEmbedding(embed: (text: string, signal?: AbortSignal) => Promise<number[] | null>, text: string, timeoutMs?: number, signal?: AbortSignal): Promise<number[] | null>;
|
|
81
105
|
export declare class TaskDistillationCoordinator {
|
|
82
106
|
private readonly deps;
|
|
83
107
|
private readonly turnIndexBySession;
|
|
108
|
+
private candidateMutationTail;
|
|
84
109
|
constructor(deps: TaskDistillationDeps);
|
|
85
110
|
private requireCapability;
|
|
86
|
-
|
|
87
|
-
|
|
111
|
+
private withCandidateMutation;
|
|
112
|
+
/** 回合完成屏障内的轻量持久化。Host 写成功后进程回收也不会丢候选。 */
|
|
113
|
+
captureTurn(input: RecordTurnInput): Promise<string | null>;
|
|
114
|
+
/** Cancellable embedding enhancement for a candidate already owned by Host. */
|
|
115
|
+
enrichCandidate(candidateId: string, promptHead: string, signal?: AbortSignal): Promise<void>;
|
|
88
116
|
/** 空闲窗/手动共用的蒸馏 pass。 */
|
|
89
|
-
runPass(reason: "idle" | "manual"): Promise<DistillPassResult>;
|
|
117
|
+
runPass(reason: "idle" | "manual", signal?: AbortSignal): Promise<DistillPassResult>;
|
|
90
118
|
private renderProcedure;
|
|
91
|
-
/** 晋升扫描(spec:技能的唯一产生入口)
|
|
119
|
+
/** 晋升扫描(spec:技能的唯一产生入口):候选先过发现阈值,再以 Host 能力验证作为硬门槛。
|
|
92
120
|
* V3.1:提议是持久待办(promotion-proposals.json),UI 双入口消费;activity 仅作日志。 */
|
|
93
121
|
private scanPromotions;
|
|
94
122
|
listProposals(): Promise<PromotionProposal[]>;
|
|
@@ -104,12 +132,12 @@ export declare class TaskDistillationCoordinator {
|
|
|
104
132
|
* 该窗口失败即双向死角(重跑撞 already exists,demote 缺 skillName 找不到目标)。 */
|
|
105
133
|
promote(procedureId: string, opts?: {
|
|
106
134
|
auto?: boolean;
|
|
107
|
-
}): Promise<{
|
|
135
|
+
}, signal?: AbortSignal): Promise<{
|
|
108
136
|
ok: boolean;
|
|
109
137
|
skillName?: string;
|
|
110
138
|
error?: string;
|
|
111
139
|
}>;
|
|
112
|
-
/**
|
|
140
|
+
/** 降格的跨存储事务、补偿与崩溃续跑全部由 Host saga 持有。 */
|
|
113
141
|
demote(procedureId: string): Promise<{
|
|
114
142
|
ok: boolean;
|
|
115
143
|
error?: string;
|
|
@@ -36,13 +36,25 @@ export declare function registerLocalCoreTools(context: LocalCoreToolRegistratio
|
|
|
36
36
|
export declare function validateExecCommand(command: string, workdir: string, groupMode?: boolean): string | null;
|
|
37
37
|
/** office/pdf 文档扩展名 → mime;非文档返回 undefined。导出仅为单测。 */
|
|
38
38
|
export declare function documentMimeForExtension(ext: string): string | undefined;
|
|
39
|
+
interface GrepBackendOptions {
|
|
40
|
+
fileGlob?: string;
|
|
41
|
+
caseInsensitive?: boolean;
|
|
42
|
+
contextLines?: number;
|
|
43
|
+
headLimit?: number;
|
|
44
|
+
offset?: number;
|
|
45
|
+
includePath?: (candidate: string) => boolean;
|
|
46
|
+
}
|
|
39
47
|
export interface RipgrepGrepOutcome {
|
|
40
48
|
matches: Array<{
|
|
41
49
|
path: string;
|
|
42
50
|
line: number;
|
|
43
51
|
text: string;
|
|
52
|
+
contextBefore?: string[];
|
|
53
|
+
contextAfter?: string[];
|
|
44
54
|
}>;
|
|
45
55
|
truncated: boolean;
|
|
56
|
+
totalMatches?: number;
|
|
57
|
+
totalMatchesKnown: boolean;
|
|
46
58
|
/** Model-facing incompleteness note (search tool appends it to content). */
|
|
47
59
|
note?: string;
|
|
48
60
|
}
|
|
@@ -56,7 +68,5 @@ export interface RipgrepGrepOutcome {
|
|
|
56
68
|
export declare function resolveRipgrepOutcome(err: (Error & {
|
|
57
69
|
killed?: boolean;
|
|
58
70
|
code?: number | string | null;
|
|
59
|
-
}) | null, stdout: string, options:
|
|
60
|
-
|
|
61
|
-
offset?: number;
|
|
62
|
-
}): RipgrepGrepOutcome | null;
|
|
71
|
+
}) | null, stdout: string, options: Pick<GrepBackendOptions, "headLimit" | "offset" | "contextLines" | "includePath">): RipgrepGrepOutcome | null;
|
|
72
|
+
export {};
|
|
@@ -53,7 +53,7 @@ export interface BootstrapConfig {
|
|
|
53
53
|
log?: AgentLogger;
|
|
54
54
|
/** Called during foreground shell execution with incremental progress. */
|
|
55
55
|
onExecProgress?(progress: ExecProgress): void;
|
|
56
|
-
/**
|
|
56
|
+
/** Optional Host model resolver for locally compiled model-backed tools such as media understanding. */
|
|
57
57
|
resolveClientForPurpose?(purpose: ModelPurpose): {
|
|
58
58
|
transport: LLMTransport;
|
|
59
59
|
apiKey: string;
|
|
@@ -61,6 +61,7 @@ export interface BootstrapConfig {
|
|
|
61
61
|
} | null;
|
|
62
62
|
getTaskScopeKey?(): string | undefined;
|
|
63
63
|
getCurrentTurnId?(): string | undefined;
|
|
64
|
+
isGroupSecurityMode?(): boolean;
|
|
64
65
|
sendNotification?(method: string, params: Record<string, unknown>): void;
|
|
65
66
|
loadTunableOverrides?(): Promise<Record<string, unknown>>;
|
|
66
67
|
}
|
|
@@ -18,12 +18,16 @@ export interface TurnCoreRequest {
|
|
|
18
18
|
refreshTools?: () => ToolDefinition[];
|
|
19
19
|
/** Mid-turn guidance drain (运行中引导) — forwarded to the tool loop. */
|
|
20
20
|
drainPendingGuidance?: () => string[];
|
|
21
|
+
/** Session-scoped background result drain — forwarded to the tool loop. */
|
|
22
|
+
drainPendingTaskNotifications?: () => string[];
|
|
21
23
|
/** Sanitize tool-result media the main model can't consume — forwarded to the tool loop. */
|
|
22
24
|
sanitizeToolResultMedia?: (message: Record<string, unknown>) => Promise<void>;
|
|
23
25
|
/** Persist each model-visible tool-stream message to the transcript — forwarded to the tool loop. */
|
|
24
26
|
persistTurnMessage?: (message: ChatMessage) => void;
|
|
25
27
|
systemPrompt: string;
|
|
26
28
|
config: TurnConfig;
|
|
29
|
+
/** Epoch/identity guard supplied by the session lifecycle owner. */
|
|
30
|
+
isTurnCurrent?: () => boolean;
|
|
27
31
|
}
|
|
28
32
|
export interface TurnCoreAgent {
|
|
29
33
|
run(request: TurnCoreRequest, signal?: AbortSignal): AsyncIterable<TurnEvent>;
|
|
@@ -83,6 +83,8 @@ export interface HookContextMap {
|
|
|
83
83
|
};
|
|
84
84
|
"turn.completed": HookTurnContext & {
|
|
85
85
|
outcomeId?: string;
|
|
86
|
+
prompt?: string;
|
|
87
|
+
response?: string;
|
|
86
88
|
};
|
|
87
89
|
"turn.failed": HookTurnContext & {
|
|
88
90
|
code?: string;
|
|
@@ -118,9 +120,8 @@ export interface HookContextMap {
|
|
|
118
120
|
category?: string | null;
|
|
119
121
|
source?: string;
|
|
120
122
|
label?: string;
|
|
123
|
+
metadata?: Record<string, unknown>;
|
|
121
124
|
}>;
|
|
122
|
-
preferredCategories?: string[];
|
|
123
|
-
deprioritizedCategories?: string[];
|
|
124
125
|
};
|
|
125
126
|
"memory.after_recall": HookTurnContext & {
|
|
126
127
|
blockCount?: number;
|
|
@@ -110,6 +110,13 @@ export type TurnEvent = {
|
|
|
110
110
|
name: string;
|
|
111
111
|
reason: string;
|
|
112
112
|
}>;
|
|
113
|
+
argumentCorrections?: {
|
|
114
|
+
roleAlias: number;
|
|
115
|
+
promptAlias: number;
|
|
116
|
+
backgroundAlias: number;
|
|
117
|
+
agentValue: number;
|
|
118
|
+
backgroundValue: number;
|
|
119
|
+
};
|
|
113
120
|
} | {
|
|
114
121
|
type: "lifecycle";
|
|
115
122
|
turnId: string;
|
|
@@ -17,6 +17,7 @@ export { MODEL_PURPOSES, type ModelPurpose } from "@xiaozhiclaw/module-sdk/model
|
|
|
17
17
|
export type { HostSessionCollectionDelta, HostSessionCollectionScope, HostSessionCollectionSnapshot, HostSessionLifecycle, HostSessionProviderDiagnostic, HostSessionSummary, HostSessionTitleSource, NativeTranscript, NativeTranscriptMessage, } from "../host-session-collection-contract.js";
|
|
18
18
|
export { isHostSessionCollectionDelta, isHostSessionCollectionSnapshot, isNativeTranscript, } from "../host-session-collection-contract.js";
|
|
19
19
|
export * from "./provider-profile.js";
|
|
20
|
+
export * from "./memory-category.js";
|
|
20
21
|
/** agent 逻辑身份(小智自身也是一个 agentId="qlogicagent")。自身 vs 第三方仅由此值决定(F2)。 */
|
|
21
22
|
export type AgentId = string;
|
|
22
23
|
/** 确定性派生的项目主键(freeze §11.4#2,抄 VSCode getWorkspaceId)。绝不随机、绝不裸路径。 */
|
|
@@ -512,29 +513,24 @@ export interface MemoryRecord {
|
|
|
512
513
|
createdAt?: string;
|
|
513
514
|
updatedAt?: string;
|
|
514
515
|
}
|
|
515
|
-
/**
|
|
516
|
+
/** Exact durable-memory match used by the Host storage contract. */
|
|
516
517
|
export interface MemoryMatch {
|
|
517
518
|
ids?: string[];
|
|
518
519
|
query?: string;
|
|
519
520
|
}
|
|
520
521
|
/**
|
|
521
|
-
*
|
|
522
|
-
* 小智可为默认写入/解释者,但非唯一 owner;任意 peer 经 host 读写(P2:写入必带 byAgent)。
|
|
523
|
-
* 是 memory MCP 能力模块(freeze §3.7)的 store-owner;三张脸(MCP 面/UI-API 面/brain proxy 面 X7)
|
|
524
|
-
* 都是 thin adapter,唯一写者恒为本服务(脸数≠拷贝数,M-1)。
|
|
522
|
+
* Minimal durable-store contract implemented only by Runtime.
|
|
525
523
|
*
|
|
526
|
-
*
|
|
527
|
-
*
|
|
528
|
-
* 但 agent 只能经 projectMemory X7 语义代理访问,与 VSCode ext host 经 main IFileService proxy 同构。
|
|
524
|
+
* `memories.db` is the single L2 authority. Project/file memory is a separate L1
|
|
525
|
+
* surface and never acts as a fallback for this service.
|
|
529
526
|
*/
|
|
530
527
|
export interface MemoryProfileService {
|
|
531
528
|
atlas(query: MemoryQuery): MemoryRecord[];
|
|
532
529
|
read(source: string, target: string): MemoryRecord | undefined;
|
|
533
|
-
/**
|
|
530
|
+
/** Every signed store write records the responsible Agent. */
|
|
534
531
|
write(record: MemoryRecord, byAgent: AgentId): void;
|
|
535
532
|
delete(match: MemoryMatch): void;
|
|
536
533
|
consolidate(candidates: MemoryRecord[], source: string): void;
|
|
537
|
-
promote(proposal: unknown): void;
|
|
538
534
|
}
|
|
539
535
|
/** [S1 补定] 首启进度状态。 */
|
|
540
536
|
export interface OnboardingState {
|
|
@@ -589,6 +585,15 @@ export interface RunState {
|
|
|
589
585
|
status: string;
|
|
590
586
|
events?: RunEvent[];
|
|
591
587
|
checkpoint?: unknown;
|
|
588
|
+
/**
|
|
589
|
+
* Rollback history ids, oldest first — ids only, never the snapshots.
|
|
590
|
+
*
|
|
591
|
+
* The store already retains the last 20 named checkpoints, but `RunState` used to carry just the
|
|
592
|
+
* head, so every read surface could only ever report one. A run reopened from history then showed a
|
|
593
|
+
* single-entry timeline and could only roll back to the newest point, silently losing the rest.
|
|
594
|
+
* Snapshots stay out: status/list readers want the timeline, not 20 full Product states.
|
|
595
|
+
*/
|
|
596
|
+
checkpointIds?: string[];
|
|
592
597
|
openedAt: string;
|
|
593
598
|
updatedAt: string;
|
|
594
599
|
}
|
|
@@ -601,6 +606,18 @@ export interface RunState {
|
|
|
601
606
|
export interface RunStateStore {
|
|
602
607
|
/** Optional caller-selected domain id keeps Solo/Product/Goal public ids identical to host run ids. */
|
|
603
608
|
openRun(kind: "solo" | "product" | "goal", owner: SessionContext, runId?: RunId): RunId;
|
|
609
|
+
/**
|
|
610
|
+
* Atomic open + first checkpoint: the run becomes addressable ONLY once it already carries a snapshot.
|
|
611
|
+
*
|
|
612
|
+
* `openRun` followed by a separate `checkpoint` is two round trips, and a failure between them leaves
|
|
613
|
+
* an enveloped run with `checkpoint === undefined`. Readers that project a whole project's run list
|
|
614
|
+
* cannot tolerate that shape, so one such remnant permanently breaks the entire list for that project.
|
|
615
|
+
* Writers that always have their first snapshot in hand MUST use this instead of open+checkpoint.
|
|
616
|
+
*
|
|
617
|
+
* Idempotent in the same way as `openRun` (same kind + projectId + owner session re-uses the run);
|
|
618
|
+
* on re-use the snapshot is applied as a normal checkpoint.
|
|
619
|
+
*/
|
|
620
|
+
openRunWithCheckpoint(kind: "solo" | "product" | "goal", owner: SessionContext, snapshot: unknown, runId?: RunId, checkpointId?: string): RunId;
|
|
604
621
|
recordEvent(runId: RunId, ev: RunEvent): void;
|
|
605
622
|
/** product/solo 检查点 */
|
|
606
623
|
checkpoint(runId: RunId, snapshot: unknown, checkpointId?: string): void;
|
|
@@ -789,12 +806,42 @@ export declare const DELEGATE_WIRE_METHODS: {
|
|
|
789
806
|
export interface HostNotificationSink {
|
|
790
807
|
notify(eventName: string, payload: unknown): void;
|
|
791
808
|
}
|
|
809
|
+
/** Durable hand-off from a completed foreground turn to the background semantic
|
|
810
|
+
* extractor. The Host owns this operational queue; the Agent owns extraction. */
|
|
811
|
+
export interface HostMemoryExtractionTurnInput {
|
|
812
|
+
sessionId: string;
|
|
813
|
+
turnId: string;
|
|
814
|
+
priorUserMessage?: string;
|
|
815
|
+
userMessage: string;
|
|
816
|
+
assistantMessage: string;
|
|
817
|
+
}
|
|
818
|
+
export interface HostPendingMemoryExtractionTurn extends HostMemoryExtractionTurnInput {
|
|
819
|
+
id: string;
|
|
820
|
+
attempts: number;
|
|
821
|
+
lastError: string;
|
|
822
|
+
leaseOwner: string;
|
|
823
|
+
leasedUntil: number;
|
|
824
|
+
createdAt: number;
|
|
825
|
+
updatedAt: number;
|
|
826
|
+
}
|
|
792
827
|
/**
|
|
793
828
|
* [X7] qlogicagent 大脑经 x/host.request 可调用的 memory proxy 精确方法面。
|
|
794
829
|
* gateway 白名单与 qla HostMemoryProvider 都必须直接消费此常量,禁止两仓手抄后漂移。
|
|
795
830
|
*/
|
|
796
|
-
export declare const HOST_MEMORY_PROXY_METHODS: readonly ["search", "addText", "embedText", "ingestExtracted", "proposeExtracted", "consumePendingProposals", "feedback", "findRelatedEvents", "synthesizeTimeline", "getActivitySummary", "getAllProfiles", "setProfile", "getAtlas", "setMemoryArchived", "triggerDecay", "resolveConflicts", "readProcedureUsage", "writeProcedureUsage", "readDistillCandidates", "writeDistillCandidates", "readPromotionProposals", "writePromotionProposals", "listActiveMemoriesByTag", "promoteDistilledProcedure", "recordInjectedAccess"];
|
|
831
|
+
export declare const HOST_MEMORY_PROXY_METHODS: readonly ["search", "addText", "embedText", "ingestExtracted", "proposeExtracted", "consumePendingProposals", "feedback", "findRelatedEvents", "synthesizeTimeline", "getActivitySummary", "getAllProfiles", "setProfile", "getAtlas", "setMemoryArchived", "triggerDecay", "resolveConflicts", "readProcedureUsage", "writeProcedureUsage", "readDistillCandidates", "writeDistillCandidates", "readPromotionProposals", "writePromotionProposals", "listActiveMemoriesByTag", "readDistilledProcedure", "promoteDistilledProcedure", "demoteDistilledProcedure", "recordInjectedAccess", "recordRecallOutcome", "enqueueExtractionTurn", "claimPendingExtractionTurns", "completeExtractionTurn", "releaseExtractionTurn", "recordExtractionTurnFailure"];
|
|
797
832
|
export type HostMemoryProxyMethod = (typeof HOST_MEMORY_PROXY_METHODS)[number];
|
|
833
|
+
/** Host-computed proof that a distilled procedure is a repeatable capability.
|
|
834
|
+
* Source executions prove how it was learned; helped use rows prove that the
|
|
835
|
+
* distilled procedure itself subsequently worked in foreground turns. */
|
|
836
|
+
export interface ProcedureVerificationEvidence {
|
|
837
|
+
sourceSuccessCount: number;
|
|
838
|
+
sourceDistinctSessions: number;
|
|
839
|
+
sourceDistinctPrompts: number;
|
|
840
|
+
successfulUseCount: number;
|
|
841
|
+
successfulUseSessions: number;
|
|
842
|
+
harmfulUseCount: number;
|
|
843
|
+
passed: boolean;
|
|
844
|
+
}
|
|
798
845
|
/** Project-scoped Markdown memory face. Gateway resolves cwd/project from the supervised caller. */
|
|
799
846
|
export declare const HOST_PROJECT_MEMORY_PROXY_METHODS: readonly ["initialize", "getIndex", "addToIndex", "replaceInIndex", "removeFromIndex", "createFile", "writeFile", "readFile", "deleteFile", "listFiles", "searchLocal"];
|
|
800
847
|
export type HostProjectMemoryProxyMethod = (typeof HOST_PROJECT_MEMORY_PROXY_METHODS)[number];
|
|
@@ -882,6 +929,37 @@ export type HostProjectRequestParams = {
|
|
|
882
929
|
primaryWorkflowId?: string;
|
|
883
930
|
};
|
|
884
931
|
};
|
|
932
|
+
export type HostSubagentType = "general" | "explore" | "plan" | "code" | "research" | "verify";
|
|
933
|
+
export interface HostDelegationTelemetrySummary {
|
|
934
|
+
schemaVersion: 1;
|
|
935
|
+
launched: number;
|
|
936
|
+
completed: number;
|
|
937
|
+
failed: number;
|
|
938
|
+
cancelled: number;
|
|
939
|
+
backgroundCount: number;
|
|
940
|
+
automaticDeliveryCount: number;
|
|
941
|
+
byAgentType: Partial<Record<HostSubagentType, number>>;
|
|
942
|
+
decisionCounts: {
|
|
943
|
+
adopted: number;
|
|
944
|
+
partiallyAdopted: number;
|
|
945
|
+
rejected: number;
|
|
946
|
+
unreported: number;
|
|
947
|
+
};
|
|
948
|
+
argumentCorrections: {
|
|
949
|
+
roleAlias: number;
|
|
950
|
+
promptAlias: number;
|
|
951
|
+
backgroundAlias: number;
|
|
952
|
+
agentValue: number;
|
|
953
|
+
backgroundValue: number;
|
|
954
|
+
};
|
|
955
|
+
durationMs: {
|
|
956
|
+
total: number;
|
|
957
|
+
max: number;
|
|
958
|
+
};
|
|
959
|
+
tokenUsage: {
|
|
960
|
+
total: number;
|
|
961
|
+
};
|
|
962
|
+
}
|
|
885
963
|
export interface HostTurnTelemetryInput {
|
|
886
964
|
model?: string;
|
|
887
965
|
provider?: string;
|
|
@@ -902,6 +980,7 @@ export interface HostTurnTelemetryInput {
|
|
|
902
980
|
changedPathsPreview?: string[];
|
|
903
981
|
hasTurnFileChanges?: boolean;
|
|
904
982
|
};
|
|
983
|
+
delegationSummary?: HostDelegationTelemetrySummary;
|
|
905
984
|
}
|
|
906
985
|
/** Minimal, non-message-text evidence returned to the agent-side pure distiller. */
|
|
907
986
|
export interface HostDistillableFeedbackEvent {
|
|
@@ -1082,7 +1161,38 @@ export interface HostSkillInvocationResult {
|
|
|
1082
1161
|
/** 单文件读取上限;host 在解码前按 bytes 检查。 */
|
|
1083
1162
|
export declare const HOST_SKILL_FILE_MAX_BYTES: number;
|
|
1084
1163
|
/** [X7-P] 单一 agent→host 一元请求通道的服务域。 */
|
|
1085
|
-
export type HostRequestService = "memory" | "projectMemory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project" | "runState" | "provider";
|
|
1164
|
+
export type HostRequestService = "memory" | "projectMemory" | "profile" | "preview" | "capability" | "session" | "feedback" | "project" | "runState" | "provider" | "community" | "cloudAuth";
|
|
1165
|
+
/** Host-owned authenticated Hub reads. The Agent never receives or refreshes the desktop session. */
|
|
1166
|
+
export declare const HOST_COMMUNITY_PROXY_METHODS: readonly ["resolveInstall", "listResourceVersions", "resolveRuntime"];
|
|
1167
|
+
export type HostCommunityProxyMethod = typeof HOST_COMMUNITY_PROXY_METHODS[number];
|
|
1168
|
+
export type HostCommunityRequestParams = {
|
|
1169
|
+
service: "community";
|
|
1170
|
+
method: "resolveInstall";
|
|
1171
|
+
params: {
|
|
1172
|
+
resourceId: string;
|
|
1173
|
+
version?: string;
|
|
1174
|
+
};
|
|
1175
|
+
} | {
|
|
1176
|
+
service: "community";
|
|
1177
|
+
method: "listResourceVersions";
|
|
1178
|
+
params: {
|
|
1179
|
+
resourceId: string;
|
|
1180
|
+
};
|
|
1181
|
+
} | {
|
|
1182
|
+
service: "community";
|
|
1183
|
+
method: "resolveRuntime";
|
|
1184
|
+
params: {
|
|
1185
|
+
id: string;
|
|
1186
|
+
platform: string;
|
|
1187
|
+
};
|
|
1188
|
+
};
|
|
1189
|
+
/** Narrow account-session probe for supervised runtimes; no credential material crosses the wire. */
|
|
1190
|
+
export declare const HOST_CLOUD_AUTH_PROXY_METHODS: readonly ["probeSession"];
|
|
1191
|
+
export type HostCloudAuthRequestParams = {
|
|
1192
|
+
service: "cloudAuth";
|
|
1193
|
+
method: "probeSession";
|
|
1194
|
+
params: Record<string, never>;
|
|
1195
|
+
};
|
|
1086
1196
|
/** Read-only Provider projection exposed by the Gateway Host to supervised qlogicagent compute. */
|
|
1087
1197
|
export declare const HOST_PROVIDER_PROXY_METHODS: readonly ["list", "get", "diagnose"];
|
|
1088
1198
|
export type HostProviderProxyMethod = typeof HOST_PROVIDER_PROXY_METHODS[number];
|
|
@@ -1210,6 +1320,12 @@ export type HostMemoryRequestParams = {
|
|
|
1210
1320
|
service: "memory";
|
|
1211
1321
|
method: HostMemoryProxyMethod;
|
|
1212
1322
|
params: unknown[];
|
|
1323
|
+
/**
|
|
1324
|
+
* Optional supervised-session selector for background mutations. The Host
|
|
1325
|
+
* validates that this session belongs to the calling supervised Agent before
|
|
1326
|
+
* using it as evidence provenance; it is never trusted as storage authority.
|
|
1327
|
+
*/
|
|
1328
|
+
sessionId?: string;
|
|
1213
1329
|
};
|
|
1214
1330
|
export type HostProjectMemoryRequestParams = {
|
|
1215
1331
|
service: "projectMemory";
|
|
@@ -1360,7 +1476,7 @@ export type HostFeedbackRequestParams = {
|
|
|
1360
1476
|
};
|
|
1361
1477
|
};
|
|
1362
1478
|
/** Agent-originated semantic run-state operations. Owner/project/cwd are resolved by Gateway scope. */
|
|
1363
|
-
export declare const HOST_RUN_STATE_PROXY_METHODS: readonly ["open", "recordEvent", "checkpoint", "get", "list", "delete", "getCheckpoint", "listCheckpoints", "restoreCheckpoint"];
|
|
1479
|
+
export declare const HOST_RUN_STATE_PROXY_METHODS: readonly ["open", "openWithCheckpoint", "recordEvent", "checkpoint", "get", "list", "delete", "getCheckpoint", "listCheckpoints", "restoreCheckpoint"];
|
|
1364
1480
|
export type HostRunStateProxyMethod = typeof HOST_RUN_STATE_PROXY_METHODS[number];
|
|
1365
1481
|
export type HostRunStateRequestParams = {
|
|
1366
1482
|
service: "runState";
|
|
@@ -1371,6 +1487,19 @@ export type HostRunStateRequestParams = {
|
|
|
1371
1487
|
projectId: ProjectId;
|
|
1372
1488
|
sessionId: CanonicalSessionId;
|
|
1373
1489
|
};
|
|
1490
|
+
}
|
|
1491
|
+
/** Atomic open + first checkpoint — see RunStateStore.openRunWithCheckpoint for why open+checkpoint is unsafe. */
|
|
1492
|
+
| {
|
|
1493
|
+
service: "runState";
|
|
1494
|
+
method: "openWithCheckpoint";
|
|
1495
|
+
params: {
|
|
1496
|
+
runId: RunId;
|
|
1497
|
+
kind: "solo" | "product" | "goal";
|
|
1498
|
+
projectId: ProjectId;
|
|
1499
|
+
snapshot: unknown;
|
|
1500
|
+
checkpointId?: string;
|
|
1501
|
+
sessionId: CanonicalSessionId;
|
|
1502
|
+
};
|
|
1374
1503
|
} | {
|
|
1375
1504
|
service: "runState";
|
|
1376
1505
|
method: "recordEvent";
|
|
@@ -1642,7 +1771,7 @@ export type HostPreviewRequestParams = {
|
|
|
1642
1771
|
* [X7-P] 跨进程 HostRequest 判别联合。memory/profile/preview 共用 `x/host.request`,
|
|
1643
1772
|
* service + method 二级分派;preview 的 method 与 payload 在类型层保持逐动作关联。
|
|
1644
1773
|
*/
|
|
1645
|
-
export type HostRequestParams = HostMemoryRequestParams | HostProjectMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams | HostRunStateRequestParams | HostProviderRequestParams;
|
|
1774
|
+
export type HostRequestParams = HostMemoryRequestParams | HostProjectMemoryRequestParams | HostProfileRequestParams | HostPreviewRequestParams | HostCapabilityRequestParams | HostSessionRequestParams | HostFeedbackRequestParams | HostProjectRequestParams | HostRunStateRequestParams | HostProviderRequestParams | HostCommunityRequestParams | HostCloudAuthRequestParams;
|
|
1646
1775
|
/** initialize 声明的真实已装配 host-request 服务;version 只接受冻结版本 1。 */
|
|
1647
1776
|
export type HostRequestCapability = {
|
|
1648
1777
|
version: 1;
|
|
@@ -1694,3 +1823,4 @@ export declare function supportsHostRequestService(capability: unknown, service:
|
|
|
1694
1823
|
* protocol→host-contract 模块环,check-architecture-boundaries top-level-cycles 抓出)。
|
|
1695
1824
|
*/
|
|
1696
1825
|
export { segmentForFts, segmentTextForFts } from "./fts-segment.js";
|
|
1826
|
+
export { HUB_SKILL_CATEGORIES, HUB_SKILL_CATEGORY_LABELS, isHubSkillCategory, type HubSkillCategory, } from "./skill-category.js";
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Host-owned taxonomy shared by every long-term-memory producer and consumer. */
|
|
2
|
+
export declare const LONG_TERM_MEMORY_CATEGORIES: readonly ["fact", "preference", "insight", "lesson", "decision", "plan", "event", "pattern", "context", "procedure", "general"];
|
|
3
|
+
export type LongTermMemoryCategory = (typeof LONG_TERM_MEMORY_CATEGORIES)[number];
|
|
4
|
+
/** Logical relation between an atomic claim slot and its structured value. */
|
|
5
|
+
export declare const MEMORY_CLAIM_RELATIONS: readonly ["equals", "includes", "excludes"];
|
|
6
|
+
export type MemoryClaimRelation = (typeof MEMORY_CLAIM_RELATIONS)[number];
|
|
7
|
+
export declare function normalizeLongTermMemoryCategory(value: unknown, fallback?: LongTermMemoryCategory): LongTermMemoryCategory;
|
|
8
|
+
export declare function normalizeMemoryClaimRelation(value: unknown, fallback?: MemoryClaimRelation): MemoryClaimRelation;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
/** Host-owned taxonomy shared by skill promotion, persistence, and UI. */
|
|
2
|
+
export declare const HUB_SKILL_CATEGORIES: readonly ["efficiency", "dev", "cloud", "data", "industrial", "marketing", "ecommerce", "procurement", "hr", "accounting", "finance", "legal", "lifestyle"];
|
|
3
|
+
export type HubSkillCategory = (typeof HUB_SKILL_CATEGORIES)[number];
|
|
4
|
+
export declare const HUB_SKILL_CATEGORY_LABELS: Readonly<Record<HubSkillCategory, string>>;
|
|
5
|
+
export declare function isHubSkillCategory(value: unknown): value is HubSkillCategory;
|
|
@@ -23,6 +23,7 @@ export interface HostSessionSummary {
|
|
|
23
23
|
title?: string;
|
|
24
24
|
titleSource?: HostSessionTitleSource;
|
|
25
25
|
lastActiveAt: string;
|
|
26
|
+
pinnedAt?: string;
|
|
26
27
|
lifecycle: HostSessionLifecycle;
|
|
27
28
|
/** Host-authorized mutation surface. Renderer commands are a projection of this list. */
|
|
28
29
|
availableCommands: HostSessionCommand[];
|
|
@@ -172,6 +172,21 @@ export declare class ProductOrchestrator {
|
|
|
172
172
|
private consultLeaderAfterFailure;
|
|
173
173
|
private applyDagMutationsToSession;
|
|
174
174
|
private finishProduct;
|
|
175
|
+
/**
|
|
176
|
+
* Durable persistence failed → the run is over. Declaring that is not enough: the in-flight work has
|
|
177
|
+
* to actually stop.
|
|
178
|
+
*
|
|
179
|
+
* This used to only set phase and stop the checkpoint timer, so with 3 parallel tasks the run went
|
|
180
|
+
* "failed" for the client while the other 2 kept executing for up to their full timeout — still
|
|
181
|
+
* writing worktrees and still issuing EXPLICIT checkpoints (`stop()` only cancels the periodic
|
|
182
|
+
* timer, it does not block direct writes). The persisted state then drifted into phase=failed with
|
|
183
|
+
* tasks=completed, `finishProduct` never ran, and the session stayed in the map forever.
|
|
184
|
+
*
|
|
185
|
+
* `session.cancelled` is the existing single flag that closes all of that: it makes in-flight tasks
|
|
186
|
+
* treat their outcome as non-failure, aborts the retry loops, and short-circuits the post-task
|
|
187
|
+
* checkpoint + scheduleNext. Kept synchronous (14 call sites, several inside sync paths) — the
|
|
188
|
+
* per-task `finally` already tears down each task worktree, so no async cleanup is needed here.
|
|
189
|
+
*/
|
|
175
190
|
private failRunStatePersistence;
|
|
176
191
|
private publishNotification;
|
|
177
192
|
private emitDagTopology;
|
|
@@ -92,6 +92,16 @@ export declare class DagScheduler {
|
|
|
92
92
|
changedFiles?: string[];
|
|
93
93
|
acceptanceUnverified?: boolean;
|
|
94
94
|
}): void;
|
|
95
|
+
/**
|
|
96
|
+
* Mark failed. Terminal states are immutable: a node that already completed, was skipped, or
|
|
97
|
+
* already failed is left untouched.
|
|
98
|
+
*
|
|
99
|
+
* Without this guard markFailed was the one lifecycle transition with no precondition (markRunning /
|
|
100
|
+
* markCompleted / markSkipped all have one), so teardown and replay — which both call it on whatever
|
|
101
|
+
* task an instance last held — could rewrite a real success as a failure, erase its output, and then
|
|
102
|
+
* propagateSkips() would block the downstream that success had unlocked. Keeping the FIRST error also
|
|
103
|
+
* stops a late generic rejection ("gateway torn down") from burying the actual diagnosis.
|
|
104
|
+
*/
|
|
95
105
|
markFailed(id: string, error: string): void;
|
|
96
106
|
markPaused(id: string): void;
|
|
97
107
|
resumePaused(id: string): void;
|
|
@@ -126,6 +136,14 @@ export declare class DagScheduler {
|
|
|
126
136
|
*/
|
|
127
137
|
resetForReplay(id: string): string[];
|
|
128
138
|
/** Merge patch into node.params. Node must be pending. */
|
|
139
|
+
/**
|
|
140
|
+
* Merge patch into node.params. Allowed while the node is pending OR failed.
|
|
141
|
+
*
|
|
142
|
+
* "failed" is included because that is exactly when the leader refines a task: the node is not
|
|
143
|
+
* executing, and retryNode resets it to pending anyway, so the patch lands on the DAG that gets
|
|
144
|
+
* checkpointed. Holding such patches outside the node instead (a per-call scratch map) meant a
|
|
145
|
+
* refinement made in one consultation was gone by the next, and the retry re-ran the failing text.
|
|
146
|
+
*/
|
|
129
147
|
updateNodeParams(id: string, patch: Record<string, unknown>): void;
|
|
130
148
|
/** Add an explicit edge. Validates no cycle. Validates ports exist on source. */
|
|
131
149
|
addEdge(edge: Edge): void;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unattended orchestration runs are explicitly launched by the user and already inherit the
|
|
3
|
+
* Host-projected permission scope. Approve only the current operation; never widen the persisted
|
|
4
|
+
* permission policy. If the provider cannot offer a one-shot approval, fail closed.
|
|
5
|
+
*/
|
|
6
|
+
export declare function selectUnattendedApprovalOptionId(options: Array<Record<string, unknown>>): string;
|
|
7
|
+
/** Planning-only delegates must never execute tools; answer explicitly so the provider cannot hang. */
|
|
8
|
+
export declare function selectPlanningRejectionOptionId(options: Array<Record<string, unknown>>): string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AcceptanceChecklist, AcceptanceEvidence, AcceptanceStatus } from "./goal-run-types.js";
|
|
1
|
+
import type { AcceptanceChecklist, AcceptanceCriterion, AcceptanceEvidence, AcceptanceStatus } from "./goal-run-types.js";
|
|
2
2
|
/** Return a NEW checklist with one criterion's status flipped. Never mutates the input.
|
|
3
3
|
* Monotonicity contract: a criterion that already `passed` may only revert to `failed` via a
|
|
4
4
|
* deterministic verify REGRESSION (allowRegression=true). Any other downgrade of a passed criterion
|
|
@@ -14,7 +14,4 @@ export declare function unreachableCoversRemaining(checklist: AcceptanceChecklis
|
|
|
14
14
|
reason: string;
|
|
15
15
|
}[]): boolean;
|
|
16
16
|
/** Derive a new immutable checklist version on goal-edit. Dropped criteria -> superseded. */
|
|
17
|
-
export declare function newChecklistVersion(prev: AcceptanceChecklist, nextCriteria:
|
|
18
|
-
id: string;
|
|
19
|
-
criterion: string;
|
|
20
|
-
}[]): AcceptanceChecklist;
|
|
17
|
+
export declare function newChecklistVersion(prev: AcceptanceChecklist, nextCriteria: Pick<AcceptanceCriterion, "id" | "criterion" | "verify" | "evidenceSource">[]): AcceptanceChecklist;
|
|
@@ -43,16 +43,17 @@ export declare class GoalLoopCoordinator {
|
|
|
43
43
|
private readonly deps;
|
|
44
44
|
private seq;
|
|
45
45
|
private opChain;
|
|
46
|
-
private
|
|
46
|
+
private activePhase;
|
|
47
47
|
private readonly persistenceContext;
|
|
48
48
|
constructor(deps: GoalLoopCoordinatorDeps);
|
|
49
49
|
private serialize;
|
|
50
50
|
private notify;
|
|
51
51
|
private append;
|
|
52
52
|
private persist;
|
|
53
|
-
/**
|
|
53
|
+
/** Durably reserve a goal-run without entering the leader lane. Returns the goalRunId immediately. */
|
|
54
54
|
start(goal: string, agentPool: string[]): Promise<string>;
|
|
55
55
|
private startImpl;
|
|
56
|
+
private ensureChecklistInitializedImpl;
|
|
56
57
|
/** Load the run; seed `seq` so a fresh instance (post-crash) keeps appending monotonically. */
|
|
57
58
|
private load;
|
|
58
59
|
enqueueMessage(goalRunId: string, text: string): Promise<void>;
|
|
@@ -87,6 +88,7 @@ export declare class GoalLoopCoordinator {
|
|
|
87
88
|
/** Drive phases until the run ends or is paused. Not serialized: it only calls the serialized
|
|
88
89
|
* runOnePhase in a loop, so a concurrent pause/stop is observed at the next boundary. */
|
|
89
90
|
runToCompletion(goalRunId: string): Promise<PersistedGoalRunState>;
|
|
91
|
+
private publishRoundMessage;
|
|
90
92
|
/** Pause: abort the in-flight phase IMMEDIATELY (before serialize) so it drains fast and the mutex
|
|
91
93
|
* frees quickly, then persist the paused state. If the in-flight phase is the one being aborted, it
|
|
92
94
|
* drains via its abort handler and persists `paused` itself (runOnePhaseImpl's catch); pauseImpl then
|