qlogicagent 2.20.1 → 2.20.3
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/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 +49 -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 +111 -12
- 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/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/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-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
|
@@ -8,13 +8,15 @@
|
|
|
8
8
|
* 单一事实源:docs/agent-supervision-authority-migration-spec.md §3.1;契约 host-contract §13
|
|
9
9
|
* (HostRequestParams;wire 形态 = { service:"memory", method, params:<位置参数数组> })。
|
|
10
10
|
*
|
|
11
|
-
* 【PROXY 共享面(
|
|
11
|
+
* 【PROXY 共享面(以 host-contract 常量为准;两仓照此表,一字不差)】
|
|
12
12
|
* search / addText / embedText / ingestExtracted / proposeExtracted / consumePendingProposals /
|
|
13
13
|
* feedback / findRelatedEvents / synthesizeTimeline / getActivitySummary / getAllProfiles /
|
|
14
14
|
* setProfile / getAtlas / setMemoryArchived / triggerDecay / resolveConflicts
|
|
15
15
|
* [A9] 追加 listActiveMemoriesByTag(晋升扫描全量列举;无窗/无 clamp/无上限)。
|
|
16
|
-
* [A10] 追加 promoteDistilledProcedure
|
|
16
|
+
* [A10] 追加 readDistilledProcedure / promoteDistilledProcedure / demoteDistilledProcedure
|
|
17
|
+
* (精确恢复读与升/降格窄 Saga;幂等/补偿/续跑在 Host)。
|
|
17
18
|
* [A7] 追加 recordInjectedAccess(注入后记账:search 去记账后 access_count 的唯一召回侧写点)。
|
|
19
|
+
* 后台提取交接由 enqueue/list/complete/failure 四法持久化;重启不丢完成回合。
|
|
18
20
|
*
|
|
19
21
|
* 面外方法 = fail-loud throw(护栏抓漏):gate 开时 UI RPC 面(atlas 富查询/update/attachments/
|
|
20
22
|
* proposals 消费等)由 gateway host-native 应答,**不该**再落到 qla 的 provider;到达此处 = 路由/
|
|
@@ -24,9 +26,9 @@
|
|
|
24
26
|
* userId 参数原样透传(多租户前缀语义归 gateway store-owner)。
|
|
25
27
|
* 纪律:fail-loud;单轨(创建时刻一次选型,非每调用分支);零 mock。
|
|
26
28
|
*/
|
|
27
|
-
import type { HostRequestParams } from "../../host-contract/index.js";
|
|
29
|
+
import type { HostMemoryExtractionTurnInput, HostPendingMemoryExtractionTurn, HostRequestParams } from "../../host-contract/index.js";
|
|
28
30
|
import type { CandidateStoreFile, ProcedureUsageStoreFile, PromotionStoreFile } from "./task-distillation.js";
|
|
29
|
-
import type { MemoryActivitySummary, MemoryAtlasResult, MemoryConsolidationWriteResult, MemoryDreamRuntimeProvider, MemoryExtractionItem, MemoryHandlerProvider, MemoryIngestOptions, MemoryLearningSink, MemoryRuntimeHookProvider, MemorySearchOptions, MemorySearchResult, MemoryToolProvider } from "../../runtime/ports/index.js";
|
|
31
|
+
import type { MemoryActivitySummary, MemoryAtlasResult, MemoryConsolidationWriteResult, MemoryDreamRuntimeProvider, MemoryExtractionItem, MemoryHandlerProvider, MemoryIngestOptions, MemoryLearningSink, MemoryExtractionQueue, MemoryRuntimeHookProvider, MemorySearchOptions, MemorySearchResult, MemoryToolProvider } from "../../runtime/ports/index.js";
|
|
30
32
|
/**
|
|
31
33
|
* 最小转发口(结构化契约,由 coordinator-owned HostRequestClient 满足)。
|
|
32
34
|
* 只取 request 一个方法:provider 不持有判活/连接生命周期(那归协议 coordinator/client)。
|
|
@@ -41,12 +43,12 @@ export interface HostMemoryProviderConfig {
|
|
|
41
43
|
/** x/host.request client; its service gate runs before send. */
|
|
42
44
|
client: HostRequestRequester;
|
|
43
45
|
}
|
|
44
|
-
export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, MemoryLearningSink, MemoryToolProvider, MemoryHandlerProvider, MemoryDreamRuntimeProvider {
|
|
46
|
+
export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, MemoryExtractionQueue, MemoryLearningSink, MemoryToolProvider, MemoryHandlerProvider, MemoryDreamRuntimeProvider {
|
|
45
47
|
private readonly config;
|
|
46
48
|
readonly providerId = "qmemory-host";
|
|
47
49
|
constructor(config: HostMemoryProviderConfig);
|
|
48
50
|
/**
|
|
49
|
-
*
|
|
51
|
+
* 全部 memory proxy 方法统一转发:wire 形态 = { service:"memory", method, params:<位置参数数组> }(契约 §13)。
|
|
50
52
|
* 尾部 undefined 剔除:JSON 会把数组里的 undefined 序列化成 null,gateway 侧按位展开时
|
|
51
53
|
* null ≠ undefined 会击穿方法默认参(如 days=7)——省略实参才能让默认参生效。
|
|
52
54
|
*/
|
|
@@ -61,9 +63,26 @@ export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, Me
|
|
|
61
63
|
memoriesAdded: number;
|
|
62
64
|
}>;
|
|
63
65
|
/** R3 蒸馏签名 embedding(gateway 调 llmrouter 现算);null = 不可用,调用方降级不炸。 */
|
|
64
|
-
embedText(text: string): Promise<number[] | null>;
|
|
66
|
+
embedText(text: string, signal?: AbortSignal): Promise<number[] | null>;
|
|
65
67
|
ingestExtracted(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
66
68
|
proposeExtracted(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
69
|
+
enqueueExtractionTurn(input: HostMemoryExtractionTurnInput, userId: string): Promise<{
|
|
70
|
+
jobId: string;
|
|
71
|
+
created: boolean;
|
|
72
|
+
}>;
|
|
73
|
+
claimPendingExtractionTurns(userId: string, workerId: string, options?: {
|
|
74
|
+
limit?: number;
|
|
75
|
+
leaseMs?: number;
|
|
76
|
+
}): Promise<HostPendingMemoryExtractionTurn[]>;
|
|
77
|
+
completeExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
78
|
+
deleted: boolean;
|
|
79
|
+
}>;
|
|
80
|
+
releaseExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
81
|
+
released: boolean;
|
|
82
|
+
}>;
|
|
83
|
+
recordExtractionTurnFailure(jobId: string, userId: string, workerId: string, error: string): Promise<{
|
|
84
|
+
updated: boolean;
|
|
85
|
+
}>;
|
|
67
86
|
consumePendingProposals(userId: string, opts?: {
|
|
68
87
|
now?: number;
|
|
69
88
|
ttlMs?: number;
|
|
@@ -74,7 +93,10 @@ export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, Me
|
|
|
74
93
|
expiredIds: string[];
|
|
75
94
|
pendingLeft: number;
|
|
76
95
|
}>;
|
|
77
|
-
feedback(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"
|
|
96
|
+
feedback(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
|
|
97
|
+
sessionId?: string;
|
|
98
|
+
silent?: boolean;
|
|
99
|
+
}): Promise<{
|
|
78
100
|
affected: number;
|
|
79
101
|
}>;
|
|
80
102
|
findRelatedEvents(text: string, userId: string, options?: {
|
|
@@ -125,6 +147,13 @@ export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, Me
|
|
|
125
147
|
accessCount: number;
|
|
126
148
|
importance: number;
|
|
127
149
|
}>>;
|
|
150
|
+
readDistilledProcedure(userId: string, procedureId: string, tag: string): Promise<{
|
|
151
|
+
id: string;
|
|
152
|
+
text: string;
|
|
153
|
+
accessCount: number;
|
|
154
|
+
importance: number;
|
|
155
|
+
isArchived: boolean;
|
|
156
|
+
} | null>;
|
|
128
157
|
/** [A10] 升格窄 Saga(Host 协调):create+verify → archive → proposal accepted 三步
|
|
129
158
|
* 横跨 Capability/Memory 两个 Host 存储,幂等(procedureId+确定性 skillName)、逐步
|
|
130
159
|
* 补偿、崩溃续跑全在 Host;大脑只做推理与提案后单调此法。 */
|
|
@@ -144,10 +173,31 @@ export declare class HostMemoryProvider implements MemoryRuntimeHookProvider, Me
|
|
|
144
173
|
proposalAccepted: boolean;
|
|
145
174
|
};
|
|
146
175
|
}>;
|
|
176
|
+
demoteDistilledProcedure(input: {
|
|
177
|
+
procedureId: string;
|
|
178
|
+
}): Promise<{
|
|
179
|
+
outcome: "completed" | "already-completed";
|
|
180
|
+
skillName: string;
|
|
181
|
+
steps: {
|
|
182
|
+
skillDeleted: boolean;
|
|
183
|
+
memoryUnarchived: boolean;
|
|
184
|
+
proposalReverted: boolean;
|
|
185
|
+
};
|
|
186
|
+
}>;
|
|
147
187
|
/** [A7] 注入后访问记账:上报本轮真实进 prompt 的 L2 id 集(memory.after_recall 的
|
|
148
188
|
* post-cap 名单)。Host 是 access_count/last_accessed_at 的唯一写者;search() 已不再
|
|
149
189
|
* 命中即记 —— 漏调此法只会低估复用,绝不虚增。 */
|
|
150
|
-
recordInjectedAccess(memoryIds: string[], userId: string
|
|
190
|
+
recordInjectedAccess(memoryIds: string[], userId: string, context?: {
|
|
191
|
+
sessionId: string;
|
|
192
|
+
turnId: string;
|
|
193
|
+
}): Promise<{
|
|
194
|
+
affected: number;
|
|
195
|
+
}>;
|
|
196
|
+
recordRecallOutcome(userId: string, input: {
|
|
197
|
+
sessionId: string;
|
|
198
|
+
turnId: string;
|
|
199
|
+
event: "used" | "helped" | "harmed" | "unattributed";
|
|
200
|
+
}): Promise<{
|
|
151
201
|
affected: number;
|
|
152
202
|
}>;
|
|
153
203
|
/** 本 provider 不持有 db 句柄/文件资源;close 为 no-op(shutdown 链 closeMemoryProviders 会调)。 */
|
|
@@ -49,7 +49,7 @@ export declare const MEMORY_TOOL_SCHEMA: {
|
|
|
49
49
|
};
|
|
50
50
|
readonly category: {
|
|
51
51
|
readonly type: "string";
|
|
52
|
-
readonly enum:
|
|
52
|
+
readonly enum: string[];
|
|
53
53
|
readonly description: "For 'remember': categorize the memory (helps with future recall precision).";
|
|
54
54
|
};
|
|
55
55
|
};
|
|
@@ -81,5 +81,7 @@ export interface MemoryToolExecutorDeps {
|
|
|
81
81
|
/** Runtime memory provider for temporal/feedback (typed narrow for advanced ops). */
|
|
82
82
|
localProvider?: MemoryToolLocalProvider;
|
|
83
83
|
userId: string;
|
|
84
|
+
/** Owning foreground session for user-visible memory mutations. */
|
|
85
|
+
sessionId?: string;
|
|
84
86
|
}
|
|
85
87
|
export declare function executeMemoryTool(params: MemoryToolParams, deps: MemoryToolExecutorDeps): Promise<MemoryToolResult>;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*
|
|
5
5
|
* 蒸馏对象 = "费了劲才做成的任务的做法"(程序性配方),绝不是每轮都跑:
|
|
6
6
|
* 候选采集(回合完成,轻量) → 空闲窗聚类(签名 embedding,宁严勿松) →
|
|
7
|
-
* 簇 ≥ 重复阈值才产 1 条 procedure 记忆 →
|
|
7
|
+
* 簇 ≥ 重复阈值才产 1 条 procedure 记忆 → 通过来源与前台结果验证后才可晋升技能。
|
|
8
8
|
* 成功闸不用 LLM 自评:正常终态 + 同 session 近窗内未被"重做"(在线否决)。
|
|
9
9
|
* 与 feedback-distillation(反馈域)无关 —— 这里蒸馏的是任务执行模式。
|
|
10
10
|
*
|
|
@@ -14,13 +14,15 @@
|
|
|
14
14
|
* proxy 的 read/write{DistillCandidates,PromotionProposals,ProcedureUsage} 存取,本文件只提供
|
|
15
15
|
* 采集/聚类/晋升的确定性算法。单一事实源 docs/agent-supervision-authority-migration-spec.md。
|
|
16
16
|
*/
|
|
17
|
+
import { type HubSkillCategory } from "../skill-system/skill-category.js";
|
|
18
|
+
import type { ProcedureVerificationEvidence } from "../../host-contract/index.js";
|
|
17
19
|
/** 同模式判定的余弦下限。错聚有害(把不同任务蒸成一份配方),漏聚无害(下次再攒)。 */
|
|
18
20
|
export declare const TASK_DISTILL_CLUSTER_SIM = 0.86;
|
|
19
21
|
/** 在线否决窗口:同 session 内距离 ≤N 回合出现高相似任务 = 前一次疑似被重做(纠正信号)。 */
|
|
20
22
|
export declare const TASK_DISTILL_REDO_WINDOW_TURNS = 3;
|
|
21
23
|
/** 候选滚动上限(jsonl 只保留最近 N 条,防无界增长)。 */
|
|
22
24
|
export declare const TASK_DISTILL_MAX_CANDIDATES = 200;
|
|
23
|
-
/**
|
|
25
|
+
/** 晋升候选发现阈值:procedure 实际进入 prompt(注入闸后)≥N 次。
|
|
24
26
|
* [A7 重标定] 记账点已从 before_recall(检索命中)移到实际注入之后:旧口径把 dream/
|
|
25
27
|
* planner brief/写入去重探测等 8 条非召回链路的 search 命中都算成"复用",恒 ≥ 真实值;
|
|
26
28
|
* 新口径 = 模型真看到过的次数。阈值数值保留 3:设计意图本就是"真实复用 3 次",旧记账
|
|
@@ -42,7 +44,7 @@ export interface TaskCandidate {
|
|
|
42
44
|
toolSequence: string[];
|
|
43
45
|
durationMs: number;
|
|
44
46
|
at: number;
|
|
45
|
-
/** 签名 embedding
|
|
47
|
+
/** 签名 embedding(优先用于语义聚类);缺失时仅允许跨会话的严格同配方聚类。 */
|
|
46
48
|
embedding?: number[];
|
|
47
49
|
status: "pending" | "rejected" | "distilled";
|
|
48
50
|
}
|
|
@@ -80,6 +82,9 @@ export interface CollectResult {
|
|
|
80
82
|
* 跨 session 或距离更远的相似 = 模式重复,恰是蒸馏想要的信号,全部保留。
|
|
81
83
|
*/
|
|
82
84
|
export declare function collectCandidate(store: CandidateStoreFile, input: CollectInput): CollectResult;
|
|
85
|
+
/** Attach a background-produced embedding to an already durable candidate while
|
|
86
|
+
* preserving the same-session redo rejection rule used by inline collection. */
|
|
87
|
+
export declare function attachCandidateEmbedding(store: CandidateStoreFile, candidateId: string, embedding: number[]): string[];
|
|
83
88
|
export declare function clusterCandidates(store: CandidateStoreFile): TaskCandidate[][];
|
|
84
89
|
/** 压缩工具序列:去连续重复,保顺序。 */
|
|
85
90
|
export declare function compressToolSequence(seq: readonly string[]): string[];
|
|
@@ -89,6 +94,8 @@ export declare function renderProcedureFallback(cluster: readonly TaskCandidate[
|
|
|
89
94
|
export type PromotionStatus = "proposed" | "accepted" | "dismissed" | "reverted";
|
|
90
95
|
export interface PromotionProposal {
|
|
91
96
|
procedureId: string;
|
|
97
|
+
/** Host/Hub 单一技能分类;候选展示与最终 SKILL.md 使用同一枚举。 */
|
|
98
|
+
category: HubSkillCategory;
|
|
92
99
|
/** 配方首行(展示用) */
|
|
93
100
|
title: string;
|
|
94
101
|
accessCount: number;
|
|
@@ -102,6 +109,8 @@ export interface PromotionProposal {
|
|
|
102
109
|
auto?: boolean;
|
|
103
110
|
/** 自动升格的开场确认卡已读(「知道了」) */
|
|
104
111
|
acknowledgedAt?: number;
|
|
112
|
+
/** Host 根据来源成功样本与前台真实结果账计算;缺失或 passed=false 均不得升格。 */
|
|
113
|
+
verification: ProcedureVerificationEvidence;
|
|
105
114
|
}
|
|
106
115
|
export interface PromotionStoreFile {
|
|
107
116
|
proposals: PromotionProposal[];
|
|
@@ -111,9 +120,13 @@ export interface PromotionStoreFile {
|
|
|
111
120
|
export declare function upsertProposal(store: PromotionStoreFile, input: {
|
|
112
121
|
procedureId: string;
|
|
113
122
|
title: string;
|
|
123
|
+
category: HubSkillCategory;
|
|
114
124
|
accessCount: number;
|
|
115
125
|
now: number;
|
|
126
|
+
verification: ProcedureVerificationEvidence;
|
|
116
127
|
}): boolean;
|
|
128
|
+
/** One-way migration for proposals written before category became a Host contract. */
|
|
129
|
+
export declare function migratePromotionProposalCategories(store: PromotionStoreFile): boolean;
|
|
117
130
|
export declare function resolveProposal(store: PromotionStoreFile, procedureId: string, status: "accepted" | "dismissed", now: number): boolean;
|
|
118
131
|
/** 降格:accepted → reverted(区分"暂不";降格率=reverted/accepted 家族)。 */
|
|
119
132
|
export declare function revertProposal(store: PromotionStoreFile, procedureId: string, now: number): PromotionProposal | null;
|
|
@@ -156,6 +169,12 @@ export interface PromotionMetrics {
|
|
|
156
169
|
/** 手动阶段仪表(拍板③):接受率=accepted 家族/已决样本;降格率=reverted/accepted 家族。
|
|
157
170
|
* 任何时刻降格率回升超限即自动退回手动档(autoEnabled 现算,无粘滞)。 */
|
|
158
171
|
export declare function computePromotionMetrics(proposals: readonly PromotionProposal[]): PromotionMetrics;
|
|
172
|
+
/**
|
|
173
|
+
* Release acceptance may bypass only the historical manual-decision calibration wait.
|
|
174
|
+
* The real access/session/negative-feedback gates remain enforced by
|
|
175
|
+
* qualifiesForAutoPromotion, and the flag is process-scoped by the isolated harness.
|
|
176
|
+
*/
|
|
177
|
+
export declare function isAutoPromotionCalibrationEnabled(metrics: Pick<PromotionMetrics, "autoEnabled">, env?: Readonly<Record<string, string | undefined>>): boolean;
|
|
159
178
|
/** 自动档严阈值(拍板④):复用 ≥5 + 跨 ≥3 session + 零负反馈。
|
|
160
179
|
* [A7] 三个输入如今全部以"实际注入 prompt"为记账点:accessCount 来自 Host 的
|
|
161
180
|
* recordInjectedAccess(post-cap 名单),sessions 来自 after_recall 侧的
|
|
@@ -51,6 +51,13 @@ export interface PermissionCheckerDeps {
|
|
|
51
51
|
persistPermissionRule?: (rule: {
|
|
52
52
|
pathPrefix: string;
|
|
53
53
|
}) => void | Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Persist a directory allow-rule for this canonical session. Unlike the user-level
|
|
56
|
+
* persistent option, this record is restored only when the same session resumes.
|
|
57
|
+
*/
|
|
58
|
+
persistSessionPermissionRule?: (rule: {
|
|
59
|
+
pathPrefix: string;
|
|
60
|
+
}) => void | Promise<void>;
|
|
54
61
|
}
|
|
55
62
|
export declare class PermissionChecker {
|
|
56
63
|
private readonly ruleEngine;
|
|
@@ -66,6 +73,7 @@ export declare class PermissionChecker {
|
|
|
66
73
|
private readonly sessionId;
|
|
67
74
|
private readonly getTurnId;
|
|
68
75
|
private readonly persistPermissionRule;
|
|
76
|
+
private readonly persistSessionPermissionRule;
|
|
69
77
|
private unregisterHook;
|
|
70
78
|
/** Tool meta cache — populated from ToolDefinition[] at agent creation */
|
|
71
79
|
private toolMetaCache;
|
|
@@ -32,6 +32,13 @@ export interface ClassifyContext {
|
|
|
32
32
|
*/
|
|
33
33
|
export declare const SHELL_TOOL_NAMES: Set<string>;
|
|
34
34
|
export declare function isWithinWorkspace(resolved: string, root: string): boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Resolve symlinks/junctions for the existing portion of a target path. For a
|
|
37
|
+
* not-yet-created leaf, resolve the nearest existing ancestor and append the
|
|
38
|
+
* missing suffix. This keeps permission classification aligned with where the
|
|
39
|
+
* filesystem operation will actually land.
|
|
40
|
+
*/
|
|
41
|
+
export declare function canonicalizePathForBoundary(input: string): string;
|
|
35
42
|
/**
|
|
36
43
|
* 提取 shell 命令引用的路径(重定向目标 + Unix/Windows/相对路径),解析为绝对路径。
|
|
37
44
|
* 移植自 exec validateCommand;win32 下把 /c/Users → C:\Users;跳过单字母 flag(/c /s …);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HubSkillCategory } from "../../host-contract/skill-category.js";
|
|
2
|
+
export { HUB_SKILL_CATEGORIES, HUB_SKILL_CATEGORY_LABELS, isHubSkillCategory, type HubSkillCategory, } from "../../host-contract/skill-category.js";
|
|
3
|
+
/**
|
|
4
|
+
* Offline-safe domain selection. Keyword matches are deliberately narrow; an
|
|
5
|
+
* unclassified general procedure belongs to general productivity rather than
|
|
6
|
+
* inventing a pseudo category that the Hub/UI cannot render.
|
|
7
|
+
*/
|
|
8
|
+
export declare function classifyProcedureCategory(text: string): HubSkillCategory;
|
|
9
|
+
/** Read an exact allowlisted category only from the leading YAML frontmatter. */
|
|
10
|
+
export declare function extractRenderedSkillCategory(markdown: string): HubSkillCategory | null;
|
|
@@ -7,17 +7,16 @@ export declare const AGENT_TOOL_NAME: "agent";
|
|
|
7
7
|
export type BuiltInAgentType = "general" | "explore" | "plan" | "code" | "research" | "verify";
|
|
8
8
|
export declare const BUILT_IN_AGENT_TYPES: BuiltInAgentType[];
|
|
9
9
|
export interface AgentToolParams {
|
|
10
|
-
/**
|
|
11
|
-
agent
|
|
12
|
-
/**
|
|
10
|
+
/** Optional specialization. The engine defaults to a generalist. */
|
|
11
|
+
agent?: BuiltInAgentType;
|
|
12
|
+
/** Focused objective for the sub-agent. Context is supplied automatically. */
|
|
13
13
|
prompt: string;
|
|
14
|
-
/**
|
|
14
|
+
/** Legacy direct-call options. They are intentionally hidden from the model schema. */
|
|
15
15
|
description?: string;
|
|
16
|
-
/** Max turns override (default varies by agent type). */
|
|
17
16
|
maxTurns?: number;
|
|
18
|
-
/** Run in background
|
|
17
|
+
/** Run in background. Defaults to true so the parent can keep working. */
|
|
19
18
|
background?: boolean;
|
|
20
|
-
/**
|
|
19
|
+
/** Deprecated compatibility field; forks receive a bounded capsule automatically. */
|
|
21
20
|
inheritContext?: boolean;
|
|
22
21
|
}
|
|
23
22
|
export declare const AGENT_TOOL_SCHEMA: {
|
|
@@ -32,34 +31,27 @@ export declare const AGENT_TOOL_SCHEMA: {
|
|
|
32
31
|
readonly type: "string";
|
|
33
32
|
readonly description: string;
|
|
34
33
|
};
|
|
35
|
-
readonly description: {
|
|
36
|
-
readonly type: "string";
|
|
37
|
-
readonly description: "Short description (3-7 words) for status tracking.";
|
|
38
|
-
};
|
|
39
|
-
readonly maxTurns: {
|
|
40
|
-
readonly type: "number";
|
|
41
|
-
readonly description: "Max turns for the sub-agent. Defaults: general=200, explore=50, plan=80, code=200, research=30, verify=40.";
|
|
42
|
-
};
|
|
43
34
|
readonly background: {
|
|
44
35
|
readonly type: "boolean";
|
|
45
36
|
readonly description: string;
|
|
46
37
|
};
|
|
47
|
-
readonly inheritContext: {
|
|
48
|
-
readonly type: "boolean";
|
|
49
|
-
readonly description: string;
|
|
50
|
-
};
|
|
51
38
|
};
|
|
52
|
-
readonly required: readonly ["
|
|
39
|
+
readonly required: readonly ["prompt"];
|
|
53
40
|
readonly additionalProperties: false;
|
|
54
41
|
};
|
|
55
42
|
export interface AgentResult {
|
|
56
|
-
/** Foreground: synthetic fork id. Background: real TaskStore task id
|
|
43
|
+
/** Foreground: synthetic fork id. Background: real TaskStore task id used for correlation/status. */
|
|
57
44
|
agentId: string;
|
|
58
45
|
status: "completed" | "running" | "failed";
|
|
59
46
|
output?: string;
|
|
60
47
|
error?: string;
|
|
61
48
|
maxTurnsReached?: boolean;
|
|
62
49
|
tokensUsed?: number;
|
|
50
|
+
uiAcceptanceEvidence?: Array<{
|
|
51
|
+
source: "fork_verify";
|
|
52
|
+
status: "passed";
|
|
53
|
+
summary: string;
|
|
54
|
+
}>;
|
|
63
55
|
}
|
|
64
56
|
/**
|
|
65
57
|
* Host-provided fork execution backend.
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
import { type TextFileReadResult, type TextFileWriteOptions } from "./file-text-snapshot.js";
|
|
2
3
|
export declare const EDIT_TOOL_NAME: "edit";
|
|
3
4
|
export interface EditToolParams {
|
|
4
5
|
path: string;
|
|
5
6
|
oldText: string;
|
|
6
7
|
newText: string;
|
|
8
|
+
expectedHash?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare const EDIT_TOOL_SCHEMA: {
|
|
9
11
|
readonly type: "object";
|
|
@@ -20,17 +22,23 @@ export declare const EDIT_TOOL_SCHEMA: {
|
|
|
20
22
|
readonly type: "string";
|
|
21
23
|
readonly description: "New text to replace the old text with.";
|
|
22
24
|
};
|
|
25
|
+
readonly expectedHash: {
|
|
26
|
+
readonly type: "string";
|
|
27
|
+
readonly description: "Optional sha256 hash returned by read. The edit is rejected if the file changed since that read.";
|
|
28
|
+
};
|
|
23
29
|
};
|
|
24
30
|
readonly required: readonly ["path", "oldText", "newText"];
|
|
25
31
|
};
|
|
26
32
|
/** Deps injected by the host runtime for file editing. */
|
|
27
33
|
export interface EditToolDeps {
|
|
28
34
|
/** Read file content as text. */
|
|
29
|
-
readFile(path: string): Promise<
|
|
35
|
+
readFile(path: string): Promise<TextFileReadResult>;
|
|
30
36
|
/** Write content back. */
|
|
31
|
-
writeFile(path: string, content: string): Promise<void>;
|
|
37
|
+
writeFile(path: string, content: string, options?: TextFileWriteOptions): Promise<void>;
|
|
32
38
|
/** Resolve a relative path to absolute. */
|
|
33
39
|
resolvePath(input: string): string;
|
|
40
|
+
/** Validate access to the resolved path. Null means allowed. */
|
|
41
|
+
validatePath?(path: string): string | null;
|
|
34
42
|
/**
|
|
35
43
|
* Check for concurrent modification before writing.
|
|
36
44
|
* The host tracks when each file was last read vs last modified on disk.
|
|
@@ -54,9 +54,9 @@ export interface ExecToolOutput {
|
|
|
54
54
|
export interface ExecProgress {
|
|
55
55
|
type: "exec_progress";
|
|
56
56
|
output: string;
|
|
57
|
-
|
|
57
|
+
progressSnapshot: string;
|
|
58
58
|
elapsedTimeSeconds: number;
|
|
59
|
-
|
|
59
|
+
visibleLines: number;
|
|
60
60
|
totalBytes: number;
|
|
61
61
|
taskId?: string;
|
|
62
62
|
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export type TextFileEncoding = "utf8" | "utf16le" | "utf16be";
|
|
2
|
+
export type TextFileEol = "\n" | "\r\n" | "\r";
|
|
3
|
+
export interface TextFileFormat {
|
|
4
|
+
encoding: TextFileEncoding;
|
|
5
|
+
bom: boolean;
|
|
6
|
+
eol: TextFileEol;
|
|
7
|
+
}
|
|
8
|
+
export interface TextFileSnapshot {
|
|
9
|
+
text: string;
|
|
10
|
+
/** SHA-256 of the exact on-disk bytes, including any BOM. */
|
|
11
|
+
contentHash: string;
|
|
12
|
+
format: TextFileFormat;
|
|
13
|
+
}
|
|
14
|
+
export interface TextFileWriteOptions {
|
|
15
|
+
/** Reject the write if the current on-disk byte hash differs. */
|
|
16
|
+
expectedHash?: string;
|
|
17
|
+
/** Atomically fail instead of replacing an existing destination. */
|
|
18
|
+
createOnly?: boolean;
|
|
19
|
+
/** Explicit output format, used when moving a file to a new path. */
|
|
20
|
+
format?: TextFileFormat;
|
|
21
|
+
}
|
|
22
|
+
export type TextFileReadResult = string | TextFileSnapshot;
|
|
23
|
+
export declare function textFromReadResult(result: TextFileReadResult): string;
|
|
24
|
+
export declare function snapshotFromReadResult(result: TextFileReadResult): TextFileSnapshot | undefined;
|
|
@@ -139,7 +139,7 @@ export interface LspToolDeps {
|
|
|
139
139
|
character?: number;
|
|
140
140
|
newName?: string;
|
|
141
141
|
includeContext?: boolean;
|
|
142
|
-
}): Promise<LspResult>;
|
|
142
|
+
}, signal?: AbortSignal): Promise<LspResult>;
|
|
143
143
|
/** Check if file exists and get its size */
|
|
144
144
|
statFile?(filePath: string): Promise<{
|
|
145
145
|
exists: boolean;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
import { type TextFileReadResult, type TextFileWriteOptions } from "./file-text-snapshot.js";
|
|
2
3
|
export declare const PATCH_TOOL_NAME: "patch";
|
|
3
4
|
export interface PatchToolParams {
|
|
4
5
|
/** V4A unified diff or simple find-replace */
|
|
@@ -28,11 +29,17 @@ export interface PatchResult {
|
|
|
28
29
|
errors: string[];
|
|
29
30
|
}
|
|
30
31
|
export interface PatchToolDeps {
|
|
31
|
-
readFile(path: string): Promise<
|
|
32
|
-
writeFile(path: string, content: string): Promise<void
|
|
33
|
-
|
|
32
|
+
readFile(path: string): Promise<TextFileReadResult>;
|
|
33
|
+
writeFile(path: string, content: string, options?: TextFileWriteOptions): Promise<void | {
|
|
34
|
+
contentHash: string;
|
|
35
|
+
}>;
|
|
36
|
+
deleteFile(path: string, options?: Pick<TextFileWriteOptions, "expectedHash">): Promise<void>;
|
|
34
37
|
fileExists(path: string): Promise<boolean>;
|
|
35
38
|
resolvePath(input: string): string;
|
|
39
|
+
/** Validate access to a resolved patch target. Null means allowed. */
|
|
40
|
+
validatePath?(path: string): string | null;
|
|
41
|
+
/** Reject stale explicit-read observations before parsing/mutating targets. */
|
|
42
|
+
checkConcurrentModification?(path: string): string | null;
|
|
36
43
|
}
|
|
37
44
|
export type MatchStrategy = "exact" | "line_trimmed" | "whitespace_normalized" | "indentation_flexible" | "escape_normalized" | "trimmed_boundary" | "unicode_normalized" | "block_anchor" | "context_aware";
|
|
38
45
|
interface MatchResult {
|
|
@@ -4,6 +4,7 @@ export interface ReadToolParams {
|
|
|
4
4
|
path: string;
|
|
5
5
|
offset?: number;
|
|
6
6
|
limit?: number;
|
|
7
|
+
includeMetadata?: boolean;
|
|
7
8
|
}
|
|
8
9
|
export declare const READ_TOOL_SCHEMA: {
|
|
9
10
|
readonly type: "object";
|
|
@@ -20,6 +21,10 @@ export declare const READ_TOOL_SCHEMA: {
|
|
|
20
21
|
readonly type: "number";
|
|
21
22
|
readonly description: "Maximum number of lines to read. Default/max: 2000.";
|
|
22
23
|
};
|
|
24
|
+
readonly includeMetadata: {
|
|
25
|
+
readonly type: "boolean";
|
|
26
|
+
readonly description: "Scan to EOF to return an exact totalLines and sha256 contentHash. Default false for low-latency large-file windows.";
|
|
27
|
+
};
|
|
23
28
|
};
|
|
24
29
|
readonly required: readonly ["path"];
|
|
25
30
|
};
|
|
@@ -27,9 +32,26 @@ export type ReadResultType = "text" | "image" | "binary_rejected";
|
|
|
27
32
|
/** Deps injected by the host runtime for file reading. */
|
|
28
33
|
export interface ReadToolDeps {
|
|
29
34
|
/** Read file content. Return string for text, image path for images, or rejection. */
|
|
30
|
-
readFile(path: string
|
|
35
|
+
readFile(path: string, window?: {
|
|
36
|
+
offset: number;
|
|
37
|
+
limit: number;
|
|
38
|
+
maxBytes: number;
|
|
39
|
+
scanToEnd?: boolean;
|
|
40
|
+
}): Promise<{
|
|
31
41
|
type: "text";
|
|
32
42
|
text: string;
|
|
43
|
+
} | {
|
|
44
|
+
type: "text_window";
|
|
45
|
+
text: string;
|
|
46
|
+
totalLines?: number;
|
|
47
|
+
startLine: number;
|
|
48
|
+
endLine: number;
|
|
49
|
+
hasMore: boolean;
|
|
50
|
+
fileSizeBytes: number;
|
|
51
|
+
scannedBytes: number;
|
|
52
|
+
contentHash?: string;
|
|
53
|
+
metadataComplete: boolean;
|
|
54
|
+
truncatedByBytes: boolean;
|
|
33
55
|
} | {
|
|
34
56
|
type: "image";
|
|
35
57
|
localPath: string;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { PortableTool } from "../portable-tool.js";
|
|
2
|
+
export declare const REPO_MAP_TOOL_NAME: "repo_map";
|
|
3
|
+
export type RepoMapRefreshMode = "full" | "incremental";
|
|
4
|
+
export type RepoMapSymbolKind = "class" | "function" | "interface" | "type" | "enum" | "constant";
|
|
5
|
+
export interface RepoMapSymbol {
|
|
6
|
+
kind: RepoMapSymbolKind;
|
|
7
|
+
name: string;
|
|
8
|
+
line: number;
|
|
9
|
+
}
|
|
10
|
+
export interface RepoMapFile {
|
|
11
|
+
path: string;
|
|
12
|
+
symbols: RepoMapSymbol[];
|
|
13
|
+
/** Conservative import/module specifiers; a lightweight navigation graph, not compiler resolution. */
|
|
14
|
+
dependencies?: string[];
|
|
15
|
+
}
|
|
16
|
+
export interface RepoMapMetadata {
|
|
17
|
+
mode: RepoMapRefreshMode;
|
|
18
|
+
scannedFiles: number;
|
|
19
|
+
changedFiles: number;
|
|
20
|
+
generation: number;
|
|
21
|
+
totalFiles: number;
|
|
22
|
+
matchedFiles: number;
|
|
23
|
+
truncated: boolean;
|
|
24
|
+
partial?: boolean;
|
|
25
|
+
stale?: boolean;
|
|
26
|
+
warning?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface RepoMapResult {
|
|
29
|
+
files: RepoMapFile[];
|
|
30
|
+
metadata: RepoMapMetadata;
|
|
31
|
+
}
|
|
32
|
+
export interface RepoMapQuery {
|
|
33
|
+
query?: string;
|
|
34
|
+
path?: string;
|
|
35
|
+
maxFiles?: number;
|
|
36
|
+
forceFull?: boolean;
|
|
37
|
+
}
|
|
38
|
+
export interface RepoMapService {
|
|
39
|
+
getMap(query?: RepoMapQuery): Promise<RepoMapResult>;
|
|
40
|
+
}
|
|
41
|
+
export interface RepoMapToolParams {
|
|
42
|
+
query?: string;
|
|
43
|
+
path?: string;
|
|
44
|
+
maxFiles?: number;
|
|
45
|
+
refresh?: boolean;
|
|
46
|
+
}
|
|
47
|
+
export interface RepoMapToolDeps {
|
|
48
|
+
workspaceRoot: string;
|
|
49
|
+
repoMap: RepoMapService;
|
|
50
|
+
maxResultChars?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function createRepoMapTool(deps: RepoMapToolDeps): PortableTool<RepoMapToolParams>;
|
|
@@ -62,7 +62,9 @@ export interface SearchContentResult {
|
|
|
62
62
|
}
|
|
63
63
|
export interface SearchOutput {
|
|
64
64
|
mode: SearchMode;
|
|
65
|
-
totalMatches
|
|
65
|
+
totalMatches?: number;
|
|
66
|
+
returnedMatches: number;
|
|
67
|
+
totalMatchesKnown: boolean;
|
|
66
68
|
truncated: boolean;
|
|
67
69
|
fileResults?: SearchFileResult[];
|
|
68
70
|
contentResults?: SearchContentResult[];
|
|
@@ -78,9 +80,11 @@ export interface SearchToolDeps {
|
|
|
78
80
|
glob(pattern: string, options: {
|
|
79
81
|
cwd: string;
|
|
80
82
|
limit: number;
|
|
83
|
+
offset?: number;
|
|
81
84
|
}): Promise<{
|
|
82
85
|
files: string[];
|
|
83
86
|
truncated: boolean;
|
|
87
|
+
totalMatches?: number;
|
|
84
88
|
}>;
|
|
85
89
|
/**
|
|
86
90
|
* Search file contents using regex.
|
|
@@ -105,6 +109,9 @@ export interface SearchToolDeps {
|
|
|
105
109
|
contextAfter?: string[];
|
|
106
110
|
}>;
|
|
107
111
|
truncated: boolean;
|
|
112
|
+
/** Exact match count before pagination, omitted if the backend stopped early. */
|
|
113
|
+
totalMatches?: number;
|
|
114
|
+
totalMatchesKnown?: boolean;
|
|
108
115
|
/**
|
|
109
116
|
* Optional incompleteness note from the backend (e.g. the search process was
|
|
110
117
|
* killed by timeout/output cap). Appended verbatim to the model-visible
|
|
@@ -114,5 +121,7 @@ export interface SearchToolDeps {
|
|
|
114
121
|
}>;
|
|
115
122
|
/** Resolve relative path to absolute. If omitted, cwd is used. */
|
|
116
123
|
resolvePath?(input: string): string;
|
|
124
|
+
/** Validate access to the resolved search root. Null means allowed. */
|
|
125
|
+
validatePath?(path: string): string | null;
|
|
117
126
|
}
|
|
118
127
|
export declare function createSearchTool(deps: SearchToolDeps): PortableTool<SearchToolParams>;
|
|
@@ -10,9 +10,8 @@ export { getDestructiveCommandWarning, getPowerShellDestructiveCommandWarning, }
|
|
|
10
10
|
export type { CommandSemanticResult } from "./command-semantics.js";
|
|
11
11
|
export { interpretCommandResult } from "./command-semantics.js";
|
|
12
12
|
export { TaskOutput, getTaskOutputDir, setTaskOutputDir, getTaskOutputPath, MAX_TASK_OUTPUT_BYTES, } from "./task-output.js";
|
|
13
|
-
export type { ProgressCallback } from "./task-output.js";
|
|
14
13
|
export type { ExecResult, ShellCommand } from "./shell-command.js";
|
|
15
14
|
export { wrapSpawn, createAbortedCommand, createFailedCommand, } from "./shell-command.js";
|
|
16
15
|
export { subprocessEnv } from "./subprocess-env.js";
|
|
17
|
-
export { exec, getCwd, setCwd, initCwd, getOriginalCwd, setShellProvider, getShellProvider, getActiveShellInfo, } from "./shell-exec.js";
|
|
16
|
+
export { exec, getCwd, setCwd, initCwd, runWithCwd, getOriginalCwd, setShellProvider, getShellProvider, getActiveShellInfo, } from "./shell-exec.js";
|
|
18
17
|
export type { ExecOptions } from "./shell-exec.js";
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ShellProvider, ShellType } from "./shell-provider.js";
|
|
2
2
|
import { type ShellCommand } from "./shell-command.js";
|
|
3
|
-
import { type ProgressCallback } from "./task-output.js";
|
|
4
3
|
import type { SandboxConfig } from "./sandbox/sandbox-types.js";
|
|
5
4
|
export type { ExecResult } from "./shell-command.js";
|
|
6
5
|
export declare function getCwd(): string;
|
|
@@ -9,9 +8,10 @@ export declare function setCwd(path: string, relativeTo?: string, opts?: {
|
|
|
9
8
|
}): boolean;
|
|
10
9
|
export declare function getOriginalCwd(): string;
|
|
11
10
|
export declare function initCwd(cwd: string): void;
|
|
11
|
+
/** Bind shell and relative file-tool CWD state to one async turn. */
|
|
12
|
+
export declare function runWithCwd<T>(cwd: string, action: () => Promise<T>): Promise<T>;
|
|
12
13
|
export interface ExecOptions {
|
|
13
14
|
timeout?: number;
|
|
14
|
-
onProgress?: ProgressCallback;
|
|
15
15
|
/** When true, `cd` in the command does NOT update the session CWD. */
|
|
16
16
|
preventCwdChanges?: boolean;
|
|
17
17
|
shouldAutoBackground?: boolean;
|