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,22 +1,19 @@
|
|
|
1
1
|
import type { MemoryWriter } from "./memory-writer.js";
|
|
2
|
+
import type { MemoryClaimRelation } from "../../host-contract/memory-category.js";
|
|
2
3
|
export interface MemorySearchOptions {
|
|
3
4
|
limit?: number;
|
|
4
|
-
minScore?: number;
|
|
5
|
-
preferredCategories?: string[];
|
|
6
5
|
llmConfig?: unknown;
|
|
6
|
+
/** Foreground-turn identity. When present, Host records every considered
|
|
7
|
+
* candidate and applies the task-relevance injection decision. */
|
|
8
|
+
recallContext?: {
|
|
9
|
+
sessionId: string;
|
|
10
|
+
turnId: string;
|
|
11
|
+
};
|
|
7
12
|
/** Drop hits whose tags contain ALL strings of any group (resident-layer exclusion). */
|
|
8
13
|
excludeTagGroups?: string[][];
|
|
9
14
|
}
|
|
10
15
|
export interface MemorySearchResult {
|
|
11
|
-
blockId: string;
|
|
12
|
-
/** [A8] REQUIRED — host guarantees id === blockId on every search hit. When id/content
|
|
13
|
-
* were optional, the {blockId,text} ↔ {id,path,content} drift silently type-checked:
|
|
14
|
-
* the LRU dedup key was always "" (dedup dead) and byte accounting always 0. */
|
|
15
16
|
id: string;
|
|
16
|
-
/** Historical field: L2 hits never carry a path (kept optional for legacy readers). */
|
|
17
|
-
path?: string;
|
|
18
|
-
text: string;
|
|
19
|
-
/** [A8] REQUIRED — host guarantees content === text on every search hit (see id). */
|
|
20
17
|
content: string;
|
|
21
18
|
score: number;
|
|
22
19
|
source?: string;
|
|
@@ -26,6 +23,8 @@ export interface MemoryIngestOptions {
|
|
|
26
23
|
llmConfig?: unknown;
|
|
27
24
|
source?: string;
|
|
28
25
|
sessionId?: string;
|
|
26
|
+
/** Transport-only cancellation; adapters must not serialize this into Host business params. */
|
|
27
|
+
requestSignal?: AbortSignal;
|
|
29
28
|
}
|
|
30
29
|
export interface MemoryExtractionItem {
|
|
31
30
|
text: string;
|
|
@@ -35,6 +34,14 @@ export interface MemoryExtractionItem {
|
|
|
35
34
|
source?: string;
|
|
36
35
|
event_date?: string;
|
|
37
36
|
tags?: string[];
|
|
37
|
+
/** Atomic claim identity produced by the evidence extractor and validated again by Host. */
|
|
38
|
+
claim?: {
|
|
39
|
+
scope: "global" | "project" | "session";
|
|
40
|
+
entity: string;
|
|
41
|
+
predicate: string;
|
|
42
|
+
relation: MemoryClaimRelation;
|
|
43
|
+
value: Record<string, unknown>;
|
|
44
|
+
};
|
|
38
45
|
/** Ids of already-uploaded attachments to link to this memory on commit. */
|
|
39
46
|
attachmentIds?: string[];
|
|
40
47
|
/** Evidence trail for distillation-style sources (feedback — §10): audit refs + crash-safe dedup key. */
|
|
@@ -43,6 +50,8 @@ export interface MemoryExtractionItem {
|
|
|
43
50
|
refs: string[];
|
|
44
51
|
idempotencyKey: string;
|
|
45
52
|
};
|
|
53
|
+
/** The source turn explicitly retracts or replaces an earlier decision. */
|
|
54
|
+
correction?: boolean;
|
|
46
55
|
}
|
|
47
56
|
export interface MemoryConsolidationWriteResult {
|
|
48
57
|
memoriesAdded?: number;
|
|
@@ -77,9 +86,12 @@ export interface MemoryToolLocalProvider {
|
|
|
77
86
|
category?: string;
|
|
78
87
|
importance?: number;
|
|
79
88
|
}): Promise<unknown>;
|
|
80
|
-
/** B3(X7)异步化:
|
|
89
|
+
/** B3(X7)异步化:Host 契约方法(host 模式经 x/host.request 跨进程)。 */
|
|
81
90
|
synthesizeTimeline(userId: string, startMs: number, endMs: number): Promise<string>;
|
|
82
|
-
feedback(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"
|
|
91
|
+
feedback(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
|
|
92
|
+
sessionId?: string;
|
|
93
|
+
silent?: boolean;
|
|
94
|
+
}): Promise<{
|
|
83
95
|
affected: number;
|
|
84
96
|
}>;
|
|
85
97
|
}
|
|
@@ -138,9 +150,9 @@ export interface MemoryUpdatePatch {
|
|
|
138
150
|
tags?: string[];
|
|
139
151
|
}
|
|
140
152
|
export interface MemoryHandlerProvider extends MemoryProvider {
|
|
141
|
-
/** B3(X7)异步化:
|
|
153
|
+
/** B3(X7)异步化:Host 契约方法(host 模式经 x/host.request 跨进程)。 */
|
|
142
154
|
getAtlas?(userId: string, options?: Record<string, unknown>): Promise<MemoryAtlasResult>;
|
|
143
|
-
/** B3(X7)异步化:
|
|
155
|
+
/** B3(X7)异步化:Host 契约方法。 */
|
|
144
156
|
getActivitySummary?(userId: string, days: number): Promise<MemoryActivitySummary>;
|
|
145
157
|
observeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
146
158
|
proposeExtracted?(items: MemoryExtractionItem[], userId: string, options?: MemoryIngestOptions): Promise<MemoryConsolidationWriteResult>;
|
|
@@ -201,10 +213,13 @@ export interface MemoryDreamProvider {
|
|
|
201
213
|
}): Promise<{
|
|
202
214
|
proposalsAdded?: number;
|
|
203
215
|
}>;
|
|
204
|
-
feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"
|
|
216
|
+
feedback?(memoryIds: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
|
|
217
|
+
sessionId?: string;
|
|
218
|
+
silent?: boolean;
|
|
219
|
+
}): Promise<{
|
|
205
220
|
affected: number;
|
|
206
221
|
}>;
|
|
207
|
-
/** B3(X7)
|
|
222
|
+
/** B3(X7)异步化:以下 Host 契约方法签名统一 Promise(host 模式经 x/host.request 跨进程)。 */
|
|
208
223
|
getActivitySummary?(userId: string, days?: number): Promise<MemoryActivitySummary>;
|
|
209
224
|
synthesizeTimeline?(userId: string, startMs: number, endMs: number): Promise<string>;
|
|
210
225
|
getProfile?(userId: string, key: string): string | null;
|
|
@@ -1,21 +1,70 @@
|
|
|
1
|
+
import type { HostMemoryExtractionTurnInput, HostPendingMemoryExtractionTurn, MemoryClaimRelation } from "../../host-contract/index.js";
|
|
1
2
|
export interface MemoryWriteMetadata {
|
|
2
3
|
source?: string;
|
|
3
4
|
category?: string;
|
|
4
5
|
importance?: number;
|
|
5
6
|
eventDate?: string;
|
|
7
|
+
sessionId?: string;
|
|
6
8
|
[key: string]: unknown;
|
|
7
9
|
}
|
|
10
|
+
export interface StructuredMemoryClaim {
|
|
11
|
+
scope: "global" | "project" | "session";
|
|
12
|
+
entity: string;
|
|
13
|
+
predicate: string;
|
|
14
|
+
relation: MemoryClaimRelation;
|
|
15
|
+
value: Record<string, unknown>;
|
|
16
|
+
}
|
|
17
|
+
export interface MemoryWriterExtractionItem {
|
|
18
|
+
text: string;
|
|
19
|
+
category?: string;
|
|
20
|
+
importance?: number;
|
|
21
|
+
confidence?: number;
|
|
22
|
+
event_date?: string;
|
|
23
|
+
tags?: string[];
|
|
24
|
+
claim?: StructuredMemoryClaim;
|
|
25
|
+
evidence?: {
|
|
26
|
+
kind: string;
|
|
27
|
+
refs: string[];
|
|
28
|
+
idempotencyKey: string;
|
|
29
|
+
};
|
|
30
|
+
/** The source turn explicitly retracts or replaces an earlier decision. */
|
|
31
|
+
correction?: boolean;
|
|
32
|
+
}
|
|
8
33
|
export interface MemoryWriter {
|
|
9
34
|
addText(text: string, userId: string, metadata?: MemoryWriteMetadata): Promise<unknown>;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
35
|
+
ingestExtracted?(items: MemoryWriterExtractionItem[], userId: string, metadata?: MemoryWriteMetadata): Promise<{
|
|
36
|
+
memoriesAdded?: number;
|
|
37
|
+
items?: Array<{
|
|
38
|
+
outcome: "created" | "merged" | "conflicted" | "pending" | "rejected";
|
|
39
|
+
}>;
|
|
40
|
+
}>;
|
|
41
|
+
proposeExtracted?(items: MemoryWriterExtractionItem[], userId: string, metadata?: MemoryWriteMetadata): Promise<{
|
|
15
42
|
proposalsAdded?: number;
|
|
16
43
|
}>;
|
|
17
44
|
findRelatedEvents?(text: string, userId: string): Promise<Array<{
|
|
18
45
|
id: string;
|
|
19
46
|
}>>;
|
|
20
|
-
feedback?(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong"
|
|
47
|
+
feedback?(ids: string[], signal: "useful" | "irrelevant" | "outdated" | "wrong", context?: {
|
|
48
|
+
sessionId?: string;
|
|
49
|
+
silent?: boolean;
|
|
50
|
+
}): Promise<unknown>;
|
|
51
|
+
}
|
|
52
|
+
export interface MemoryExtractionQueue {
|
|
53
|
+
enqueueExtractionTurn(input: HostMemoryExtractionTurnInput, userId: string): Promise<{
|
|
54
|
+
jobId: string;
|
|
55
|
+
created: boolean;
|
|
56
|
+
}>;
|
|
57
|
+
claimPendingExtractionTurns(userId: string, workerId: string, options?: {
|
|
58
|
+
limit?: number;
|
|
59
|
+
leaseMs?: number;
|
|
60
|
+
}): Promise<HostPendingMemoryExtractionTurn[]>;
|
|
61
|
+
completeExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
62
|
+
deleted: boolean;
|
|
63
|
+
}>;
|
|
64
|
+
releaseExtractionTurn(jobId: string, userId: string, workerId: string): Promise<{
|
|
65
|
+
released: boolean;
|
|
66
|
+
}>;
|
|
67
|
+
recordExtractionTurnFailure(jobId: string, userId: string, workerId: string, error: string): Promise<{
|
|
68
|
+
updated: boolean;
|
|
69
|
+
}>;
|
|
21
70
|
}
|
|
@@ -116,6 +116,8 @@ export interface PermissionRuleEnginePort {
|
|
|
116
116
|
setMode(mode: PermissionMode): void;
|
|
117
117
|
getRules(): readonly PermissionRuleEntry[];
|
|
118
118
|
replaceRules(rules: PermissionRuleEntry[]): void;
|
|
119
|
+
/** Session-approved writable roots used by the OS sandbox projection. */
|
|
120
|
+
getAllowedWriteDirectories?(): string[];
|
|
119
121
|
}
|
|
120
122
|
export interface PermissionApprovalResolver {
|
|
121
123
|
resolveApproval(response: ApprovalResponse): void;
|
|
@@ -48,8 +48,9 @@ export interface ToolCatalog {
|
|
|
48
48
|
}
|
|
49
49
|
export interface ToolBootstrapProgress {
|
|
50
50
|
output: string;
|
|
51
|
+
progressSnapshot: string;
|
|
51
52
|
elapsedTimeSeconds: number;
|
|
52
|
-
|
|
53
|
+
visibleLines: number;
|
|
53
54
|
totalBytes: number;
|
|
54
55
|
}
|
|
55
56
|
export interface ToolBootstrapConfig {
|
|
@@ -65,6 +66,7 @@ export interface ToolBootstrapConfig {
|
|
|
65
66
|
};
|
|
66
67
|
getTaskScopeKey?(): string | undefined;
|
|
67
68
|
getCurrentTurnId?(): string | undefined;
|
|
69
|
+
isGroupSecurityMode?(): boolean;
|
|
68
70
|
sendNotification?(method: string, params: Record<string, unknown>): void;
|
|
69
71
|
onExecProgress?(progress: ToolBootstrapProgress): void;
|
|
70
72
|
/** Lazy host-owned tunable overrides; web registration must not call it until first invoke. */
|
|
@@ -13,5 +13,7 @@ export interface IdentityInfo {
|
|
|
13
13
|
provider?: string;
|
|
14
14
|
/** 本轮解析出的真实模型 id */
|
|
15
15
|
model?: string;
|
|
16
|
+
/** Exact tool names enabled for this turn; capability claims are derived from these. */
|
|
17
|
+
availableToolNames?: readonly string[];
|
|
16
18
|
}
|
|
17
19
|
export declare function createIdentitySection(info: IdentityInfo): SystemPromptSection;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export interface SessionPermissionStorePathOptions {
|
|
2
|
+
/** Test-only path override; production always uses the centralized session directory. */
|
|
3
|
+
sessionDir?: string;
|
|
4
|
+
}
|
|
5
|
+
export declare function loadSessionAllowedDirectories(sessionId: string, projectRoot: string, options?: SessionPermissionStorePathOptions): string[];
|
|
6
|
+
export declare function appendSessionAllowedDirectory(sessionId: string, projectRoot: string, pathPrefix: string, options?: SessionPermissionStorePathOptions): Promise<void>;
|
|
@@ -64,6 +64,8 @@ export interface TaskStateBase {
|
|
|
64
64
|
* the client and agent mint turn ids in separate namespaces (they never match),
|
|
65
65
|
* but the session id is shared across the boundary. */
|
|
66
66
|
launchSessionId?: string;
|
|
67
|
+
/** Root turn that launched this task. */
|
|
68
|
+
launchTurnId?: string;
|
|
67
69
|
/** Execution depth (0 = root). */
|
|
68
70
|
depth: number;
|
|
69
71
|
/** Maximum turns before forced stop. */
|
|
@@ -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
|
}
|