qlogicagent 2.20.6 → 2.20.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -54
- package/dist/agent-contract.js +1 -1
- package/dist/agent.js +42 -41
- package/dist/cli.js +1 -1
- package/dist/host-contract.js +1 -1
- package/dist/index.js +539 -565
- package/dist/orchestration.js +14 -14
- package/dist/project-memory-host.js +30 -33
- package/dist/protocol.js +1 -1
- package/dist/types/agent/memory-recall-context.d.ts +7 -0
- package/dist/types/agent/tool-loop/artifact-final-contract.d.ts +2 -0
- package/dist/types/agent/tool-loop/direct-response-contract.d.ts +12 -0
- package/dist/types/agent/tool-loop/final-status-stream-suppressor.d.ts +22 -0
- package/dist/types/agent/tool-loop/loop-helpers.d.ts +2 -2
- package/dist/types/agent/tool-loop.d.ts +5 -1
- package/dist/types/agent/types.d.ts +27 -15
- package/dist/types/cli/acp-commands.d.ts +1 -1
- package/dist/types/cli/acp-extended-handlers.d.ts +13 -3
- package/dist/types/cli/agent-runtime-session-state.d.ts +1 -0
- package/dist/types/cli/base-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/community-skill-installer.d.ts +2 -0
- package/dist/types/cli/core-tool-coordinator.d.ts +0 -3
- package/dist/types/cli/core-tools/registry.d.ts +1 -4
- package/dist/types/cli/handlers/config-handler.d.ts +0 -1
- package/dist/types/cli/handlers/goal-handler.d.ts +24 -0
- package/dist/types/cli/handlers/memory-handler.d.ts +1 -2
- package/dist/types/cli/handlers/skill-curator-handler.d.ts +8 -0
- package/dist/types/cli/handlers/turn-handler.d.ts +9 -12
- package/dist/types/cli/memory-candidate-service.d.ts +1 -8
- package/dist/types/cli/memory-coordinator.d.ts +1 -13
- package/dist/types/cli/product-acp-params.d.ts +1 -0
- package/dist/types/cli/provider-core-facade.d.ts +2 -30
- package/dist/types/cli/rpc-registry.d.ts +2 -4
- package/dist/types/cli/runtime-hook-bootstrap.d.ts +1 -2
- package/dist/types/cli/stdio-acp-request-host.d.ts +1 -2
- package/dist/types/cli/stdio-rpc-handler-hosts.d.ts +0 -2
- package/dist/types/cli/stdio-runtime-bootstrap.d.ts +0 -7
- package/dist/types/cli/stdio-runtime-services.d.ts +1 -8
- package/dist/types/cli/stdio-server.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap-core-registration.d.ts +0 -4
- package/dist/types/cli/tool-bootstrap.d.ts +0 -17
- package/dist/types/contracts/memory-recall-packet.d.ts +31 -0
- package/dist/types/contracts/memory-response-contract.d.ts +2 -0
- package/dist/types/contracts/tool-execution-evidence.d.ts +8 -0
- package/dist/types/contracts/tool-name.d.ts +10 -0
- package/dist/types/contracts/turn-event.d.ts +36 -3
- package/dist/types/host-contract/acp-content.d.ts +45 -0
- package/dist/types/host-contract/index.d.ts +65 -48
- package/dist/types/orchestration/agent-instance.d.ts +21 -1
- package/dist/types/orchestration/agent-roster.d.ts +14 -15
- package/dist/types/orchestration/dag-scheduler.d.ts +4 -0
- package/dist/types/orchestration/goal-context-envelope.d.ts +7 -0
- package/dist/types/orchestration/goal-loop-coordinator.d.ts +55 -12
- package/dist/types/orchestration/goal-mode-adapters.d.ts +13 -1
- package/dist/types/orchestration/goal-run-persistence.d.ts +9 -2
- package/dist/types/orchestration/goal-run-types.d.ts +127 -13
- package/dist/types/orchestration/index.d.ts +1 -1
- package/dist/types/orchestration/product-persistence.d.ts +10 -1
- package/dist/types/orchestration/product-planner.d.ts +3 -3
- package/dist/types/orchestration/testing/delegate-test-bridge.d.ts +1 -0
- package/dist/types/orchestration/workflow/data-item.d.ts +1 -1
- package/dist/types/orchestration/workflow/expression.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-patch.d.ts +1 -2
- package/dist/types/orchestration/workflow/workflow-render.d.ts +1 -2
- package/dist/types/project-memory-host.d.ts +1 -0
- package/dist/types/protocol/agent-contract.d.ts +10 -8
- package/dist/types/protocol/methods.d.ts +2 -19
- package/dist/types/protocol/notifications.d.ts +1 -1
- package/dist/types/protocol/wire/acp-agent-management.d.ts +48 -6
- package/dist/types/protocol/wire/acp-protocol.d.ts +11 -24
- package/dist/types/protocol/wire/agent-methods.d.ts +5 -142
- package/dist/types/protocol/wire/chat-types.d.ts +50 -0
- package/dist/types/protocol/wire/index.d.ts +2 -2
- package/dist/types/protocol/wire/notification-payloads.d.ts +73 -122
- package/dist/types/protocol/wire/thread-protocol.d.ts +4 -40
- package/dist/types/runtime/community/community-consent-client.d.ts +0 -13
- package/dist/types/runtime/context/context-compression-strategies.d.ts +29 -0
- package/dist/types/runtime/context/context-envelope.d.ts +3 -0
- package/dist/types/runtime/execution/dream-agent.d.ts +4 -5
- package/dist/types/runtime/execution/mcp-capability-selection.d.ts +54 -0
- package/dist/types/runtime/execution/memory-decay.d.ts +1 -1
- package/dist/types/runtime/execution/search-result-quality.d.ts +22 -0
- package/dist/types/runtime/execution/streaming-tool-executor.d.ts +2 -0
- package/dist/types/runtime/execution/tool-result-storage.d.ts +44 -0
- package/dist/types/runtime/hooks/memory-hooks.d.ts +3 -2
- package/dist/types/runtime/infra/agent-paths.d.ts +0 -8
- package/dist/types/runtime/infra/default-path-service.d.ts +0 -2
- package/dist/types/runtime/infra/llmrouter-managed-inference.d.ts +54 -1
- package/dist/types/runtime/infra/media-persistence.d.ts +6 -36
- package/dist/types/runtime/memory/implicit-extraction.d.ts +7 -15
- package/dist/types/runtime/memory/memory-recall-attribution.d.ts +24 -0
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +14 -0
- package/dist/types/runtime/ports/index.d.ts +1 -3
- package/dist/types/runtime/ports/memory-provider.d.ts +2 -19
- package/dist/types/runtime/ports/memory-writer.d.ts +1 -1
- package/dist/types/runtime/ports/path-service.d.ts +0 -2
- package/dist/types/runtime/prompt/capability-routing-policy.d.ts +13 -0
- package/dist/types/runtime/prompt/environment-context.d.ts +3 -6
- package/dist/types/runtime/prompt/fresh-workspace-evidence.d.ts +8 -13
- package/dist/types/runtime/prompt/tool-necessity-policy.d.ts +12 -0
- package/dist/types/skills/mcp/mcp-manager.d.ts +29 -4
- package/dist/types/skills/memory/host-memory-provider.d.ts +3 -9
- package/dist/types/skills/memory/memdir.d.ts +1 -1
- package/dist/types/skills/memory/memory-content-safety.d.ts +1 -0
- package/dist/types/skills/permissions/hook-runner.d.ts +3 -3
- package/dist/types/skills/portable-tool.d.ts +5 -0
- package/dist/types/skills/skill-system/skill-lifecycle.d.ts +1 -0
- package/dist/types/skills/tools/exec-tool.d.ts +1 -5
- package/dist/types/skills/tools/shell/command-compatibility.d.ts +3 -0
- package/dist/types/skills/tools/shell/index.d.ts +4 -3
- package/dist/types/skills/tools/shell/shell-exec.d.ts +15 -8
- package/dist/types/skills/tools/shell/shell-provider.d.ts +26 -0
- package/dist/types/transport/acp-server.d.ts +4 -1
- package/dist/types/transport/host-community-client.d.ts +0 -1
- package/dist/types/transport/host-request-client.d.ts +1 -0
- package/dist/types/transport/host-run-state-client.d.ts +1 -1
- package/dist/workflow-host.js +6 -6
- package/package.json +4 -3
- package/dist/skills/mcp/astraclaw-native-mcp-server.js +0 -12
- package/dist/types/cli/core-tools/checkpoint-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/core-tools/checkpoint-tool-service.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/config-tool-service.d.ts +0 -13
- package/dist/types/cli/core-tools/monitor-tool-bootstrap.d.ts +0 -7
- package/dist/types/cli/core-tools/monitor-tool-service.d.ts +0 -6
- package/dist/types/cli/dev-tool-bootstrap.d.ts +0 -9
- package/dist/types/cli/dev-tools/dev-tool-bootstrap-service.d.ts +0 -7
- package/dist/types/cli/dev-tools/dev-tool-registry.d.ts +0 -8
- package/dist/types/cli/dev-tools/incremental-repo-map.d.ts +0 -81
- package/dist/types/cli/dev-tools/lsp-supervisor.d.ts +0 -59
- package/dist/types/cli/dev-tools/lsp-tool-service.d.ts +0 -7
- package/dist/types/cli/handlers/media-handler.d.ts +0 -19
- package/dist/types/cli/handlers/skills-handler.d.ts +0 -37
- package/dist/types/cli/industrial-runtime-store.d.ts +0 -16
- package/dist/types/cli/media-capability-schema.d.ts +0 -49
- package/dist/types/cli/media-file-api-service.d.ts +0 -73
- package/dist/types/cli/media-file-tool-service.d.ts +0 -13
- package/dist/types/cli/media-inline.d.ts +0 -31
- package/dist/types/cli/media-runtime-facade.d.ts +0 -51
- package/dist/types/cli/media-understanding.d.ts +0 -102
- package/dist/types/cli/skill-invocation-service.d.ts +0 -10
- package/dist/types/cli/skill-tools-bootstrap.d.ts +0 -35
- package/dist/types/cli/skills-query-service.d.ts +0 -41
- package/dist/types/cli/tool-bootstrap-media-registration.d.ts +0 -20
- package/dist/types/cli/turn-media-setup.d.ts +0 -34
- package/dist/types/cli/turn-preview-browser-setup.d.ts +0 -15
- package/dist/types/runtime/infra/astraclaw-capabilities.d.ts +0 -33
- package/dist/types/runtime/infra/builtin-skills-seed.d.ts +0 -31
- package/dist/types/runtime/infra/checkpoint-backend.d.ts +0 -9
- package/dist/types/runtime/infra/industrial-runtime-session-server.d.ts +0 -20
- package/dist/types/runtime/infra/migrate-project-skills.d.ts +0 -24
- package/dist/types/runtime/infra/project-skill-manifest.d.ts +0 -21
- package/dist/types/runtime/infra/skill-resolver.d.ts +0 -74
- package/dist/types/runtime/infra/worktree-backend.d.ts +0 -86
- package/dist/types/runtime/ports/checkpoint-contracts.d.ts +0 -19
- package/dist/types/runtime/ports/worktree-contracts.d.ts +0 -22
- package/dist/types/skills/mcp/astraclaw-native-mcp-server.d.ts +0 -1
- package/dist/types/skills/memory/memory-tool.d.ts +0 -87
- package/dist/types/skills/tools/checkpoint-tool.d.ts +0 -66
- package/dist/types/skills/tools/config-tool.d.ts +0 -61
- package/dist/types/skills/tools/file-management-tool.d.ts +0 -90
- package/dist/types/skills/tools/image-generate-tool.d.ts +0 -98
- package/dist/types/skills/tools/instructions-tool.d.ts +0 -65
- package/dist/types/skills/tools/lsp-tool.d.ts +0 -153
- package/dist/types/skills/tools/media-cancel-tool.d.ts +0 -30
- package/dist/types/skills/tools/media-understand-tool.d.ts +0 -28
- package/dist/types/skills/tools/monitor-tool.d.ts +0 -113
- package/dist/types/skills/tools/music-generate-tool.d.ts +0 -80
- package/dist/types/skills/tools/notebook-edit-tool.d.ts +0 -15
- package/dist/types/skills/tools/preview-browser-tool.d.ts +0 -136
- package/dist/types/skills/tools/repo-map-tool.d.ts +0 -52
- package/dist/types/skills/tools/skill-tool.d.ts +0 -142
- package/dist/types/skills/tools/sleep-tool.d.ts +0 -49
- package/dist/types/skills/tools/stt-tool.d.ts +0 -33
- package/dist/types/skills/tools/subagent-decision-tool.d.ts +0 -15
- package/dist/types/skills/tools/three-d-generate-tool.d.ts +0 -46
- package/dist/types/skills/tools/tts-tool.d.ts +0 -50
- package/dist/types/skills/tools/video-edit-tool.d.ts +0 -72
- package/dist/types/skills/tools/video-generate-tool.d.ts +0 -162
- package/dist/types/skills/tools/video-merge-tool.d.ts +0 -105
- package/dist/types/skills/tools/video-upscale-tool.d.ts +0 -45
- package/dist/types/skills/tools/voice-clone-tool.d.ts +0 -40
- package/dist/types/skills/tools/worktree-tool.d.ts +0 -69
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
* Handles: the shared turn pipeline (runTurnPipeline) + thread.user_response (ask-user answers).
|
|
4
4
|
*/
|
|
5
5
|
import { type ModelPurpose } from "../../runtime/infra/model-registry.js";
|
|
6
|
-
import { type UnderstandMediaKind } from "../media-understanding.js";
|
|
7
6
|
import { type InstructionFileInfo } from "../../runtime/prompt/instruction-loader.js";
|
|
8
7
|
import type { HookRegistry } from "../../contracts/hooks.js";
|
|
9
8
|
export { isStructuredPlannerSystemPrompt } from "../../contracts/structured-planner.js";
|
|
@@ -11,6 +10,7 @@ import type { AppendMessageOutcome } from "../../runtime/session/session-transcr
|
|
|
11
10
|
import type { PermissionMetadataResolver, ToolCatalog } from "../../runtime/ports/index.js";
|
|
12
11
|
import type { ChatMessage, TokenUsage, ToolDefinition, TurnConfig } from "../../agent/types.js";
|
|
13
12
|
import type { AgentRpcRequest } from "../../protocol/wire/agent-rpc.js";
|
|
13
|
+
type UnderstandMediaKind = "image" | "video" | "audio";
|
|
14
14
|
interface PendingAskUserRequest {
|
|
15
15
|
resolve(answers: Record<string, string> | null): void;
|
|
16
16
|
}
|
|
@@ -19,7 +19,6 @@ export interface TurnControlHandlerHost {
|
|
|
19
19
|
permissionChecker?: PermissionMetadataResolver | null;
|
|
20
20
|
toolCatalog?: ToolCatalog;
|
|
21
21
|
pendingAskUser: Map<string, PendingAskUserRequest>;
|
|
22
|
-
configureTurnMedia?(config: Record<string, unknown> | undefined, turnId: string): void;
|
|
23
22
|
log(message: string): void;
|
|
24
23
|
sendResponse(id: string | number, result?: unknown, error?: unknown): void;
|
|
25
24
|
/** Mid-turn guidance queue (运行中引导) — drained by the tool loop each round. */
|
|
@@ -111,13 +110,11 @@ export declare function getLatestUserTextForTurn(messages: readonly ChatMessage[
|
|
|
111
110
|
/**
|
|
112
111
|
* Insert a SYSTEM-role context message immediately BEFORE the last user message (LLM view only).
|
|
113
112
|
*
|
|
114
|
-
* Used for
|
|
115
|
-
*
|
|
113
|
+
* Used for user-selected Host Skill instructions: the model must load the Skill for THIS turn, but
|
|
114
|
+
* the selection directive must NOT be parsed as part of the user's literal request. The completion-
|
|
116
115
|
* verification heuristics (final-marker extraction, explicit required-file checks, explicit-artifact
|
|
117
|
-
* counting, round/tool budget sizing) all scan `role === "user"` content only
|
|
118
|
-
*
|
|
119
|
-
* becomes a phantom user-requested completion marker, and the skill's example file paths inflate the
|
|
120
|
-
* artifact count and budgets. A system message keeps the model bound to the instructions while being
|
|
116
|
+
* counting, round/tool budget sizing) all scan `role === "user"` content only. A system message
|
|
117
|
+
* keeps the model bound to the Host loading directive while being
|
|
121
118
|
* invisible to those user-intent scans. The original array/objects are never mutated.
|
|
122
119
|
*/
|
|
123
120
|
export declare function injectSkillContextBeforeLastUser(messages: ChatMessage[], skillContext: string): ChatMessage[];
|
|
@@ -137,8 +134,8 @@ export declare function injectSkillContextBeforeLastUser(messages: ChatMessage[]
|
|
|
137
134
|
* Two-layer memory INDEX block for the per-turn conversation channel (global
|
|
138
135
|
* owner cheat-sheet first, then project notes; injected before the last user
|
|
139
136
|
* message next to the domain block). Living here instead of the system prompt
|
|
140
|
-
* is deliberate: INDEX content changes whenever
|
|
141
|
-
* a volatile system-prompt section every
|
|
137
|
+
* is deliberate: INDEX content changes whenever Host project memory is updated,
|
|
138
|
+
* and as a volatile system-prompt section every update re-encoded the byte-stable
|
|
142
139
|
* prefix plus the whole conversation history on the next turn. In the per-turn
|
|
143
140
|
* channel only the tail changes — the cached prefix survives.
|
|
144
141
|
*/
|
|
@@ -169,11 +166,11 @@ export interface MediaUnderstandingPlan {
|
|
|
169
166
|
/**
|
|
170
167
|
* Detect the media modalities the resolved main model can't consume, STRIP the media fields (a text-only
|
|
171
168
|
* model 400s on multimodal content), and PLAN what to tell the model: which refs to call the understanding
|
|
172
|
-
* tool on, and which kinds it must honestly report as unreadable (no
|
|
169
|
+
* tool on, and which kinds it must honestly report as unreadable (no Host Media MCP tool projected, or every
|
|
173
170
|
* ref is a non-addressable data:/oversized URL). It does NOT transcribe and does NOT touch the message
|
|
174
171
|
* text — the plan is surfaced via a model-only notice so the model calls image_understand /
|
|
175
172
|
* video_understand / stt itself, exactly as it would for an in-message media path; the user's bubble
|
|
176
|
-
* stays clean.
|
|
173
|
+
* stays clean. Understanding executes through the Host-projected Media MCP tool.
|
|
177
174
|
*
|
|
178
175
|
* Reliability note: unlike the eager path, this DEPENDS on the model calling the tool — the medium is not
|
|
179
176
|
* transcribed anywhere, so if the model ignores the notice the understanding does not happen this turn
|
|
@@ -9,7 +9,7 @@ interface MemoryLlmClient {
|
|
|
9
9
|
};
|
|
10
10
|
}
|
|
11
11
|
/** Model purposes the memory pipeline can resolve (text + multimodal). */
|
|
12
|
-
export type MemoryModelPurpose = "smallModel" | "textGeneration"
|
|
12
|
+
export type MemoryModelPurpose = "smallModel" | "textGeneration";
|
|
13
13
|
export interface MemoryCandidateHost {
|
|
14
14
|
memoryProvider?: {
|
|
15
15
|
search?(query: string, userId: string, options?: {
|
|
@@ -20,13 +20,6 @@ export interface MemoryCandidateHost {
|
|
|
20
20
|
score?: number;
|
|
21
21
|
metadata?: Record<string, unknown>;
|
|
22
22
|
}>>;
|
|
23
|
-
/** Read an uploaded attachment's bytes (for multimodal understanding). */
|
|
24
|
-
readAttachmentBytes?(id: string): Promise<{
|
|
25
|
-
bytes: Buffer;
|
|
26
|
-
mimeType: string;
|
|
27
|
-
} | null>;
|
|
28
|
-
/** Persist the understood/extracted text back on the attachment row. */
|
|
29
|
-
setAttachmentText?(id: string, text: string): void;
|
|
30
23
|
} | null;
|
|
31
24
|
resolveClientForPurpose?(purpose: MemoryModelPurpose): MemoryLlmClient | null;
|
|
32
25
|
}
|
|
@@ -2,13 +2,12 @@ import { type HostRequestRequester } from "../skills/memory/host-memory-provider
|
|
|
2
2
|
import { type MemoryPrefetchState } from "../runtime/hooks/memory-hooks.js";
|
|
3
3
|
import type { HookRegistry } from "../contracts/hooks.js";
|
|
4
4
|
import type { RuntimeLogger } from "../runtime/hooks/hook-registry.js";
|
|
5
|
-
import type { MemoryDreamRuntimeProvider, MemoryExtractionQueue, MemoryHandlerProvider, MemoryLearningSink, MemoryProvider, MemoryRuntimeHookProvider
|
|
5
|
+
import type { MemoryDreamRuntimeProvider, MemoryExtractionQueue, MemoryHandlerProvider, MemoryLearningSink, MemoryProvider, MemoryRuntimeHookProvider } from "../runtime/ports/index.js";
|
|
6
6
|
import type { LLMTransport } from "./provider-core-facade.js";
|
|
7
7
|
export interface MemoryProviderState {
|
|
8
8
|
recallProvider: MemoryProvider;
|
|
9
9
|
runtimeHookProvider: MemoryRuntimeHookProvider;
|
|
10
10
|
learningSink: MemoryLearningSink;
|
|
11
|
-
toolProvider: MemoryToolProvider;
|
|
12
11
|
handlerProvider: MemoryHandlerProvider;
|
|
13
12
|
dreamProvider: MemoryDreamRuntimeProvider;
|
|
14
13
|
extractionQueue: MemoryExtractionQueue;
|
|
@@ -39,14 +38,3 @@ export interface RegisterMemoryRuntimeHooksDeps {
|
|
|
39
38
|
sendNotification?: (method: string, params: Record<string, unknown>) => void;
|
|
40
39
|
}
|
|
41
40
|
export declare function registerMemoryRuntimeHooks(deps: RegisterMemoryRuntimeHooksDeps): MemoryProviderState;
|
|
42
|
-
export interface RegisterMemoryToolDeps {
|
|
43
|
-
memdir: ProjectMemoryStore;
|
|
44
|
-
getMemdir?: () => ProjectMemoryStore;
|
|
45
|
-
memoryProvider: MemoryToolProvider | null;
|
|
46
|
-
memoryUserId: string;
|
|
47
|
-
sessionId?: string;
|
|
48
|
-
getTurnId?: () => string;
|
|
49
|
-
toolCatalog: ToolCatalog;
|
|
50
|
-
sendNotification?: (method: string, params: Record<string, unknown>) => void;
|
|
51
|
-
}
|
|
52
|
-
export declare function registerMemoryTool(deps: RegisterMemoryToolDeps): void;
|
|
@@ -18,6 +18,7 @@ export declare function assertProductTasks(value: unknown, field?: string): void
|
|
|
18
18
|
export declare function assertProductBudget(value: unknown, field?: string): void;
|
|
19
19
|
export declare function assertProductId(params: Record<string, unknown>): string;
|
|
20
20
|
export declare function assertProductTaskId(params: Record<string, unknown>): string;
|
|
21
|
+
export declare function assertProductDagMutation(params: Record<string, unknown>): void;
|
|
21
22
|
/**
|
|
22
23
|
* `x/product.create` — the orchestrator builds the DAG straight from these.
|
|
23
24
|
*
|
|
@@ -1,31 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
export { MediaClient, ProviderRegistry, createLLMClient, isAsyncMediaTransport, type LLMTransport, type MediaCapability, type MediaRequest, type MediaResult, type ProviderToolAPI, };
|
|
4
|
-
export declare function normalizeMediaProviderId(providerId: string): string;
|
|
5
|
-
export declare function resolveMediaApiKey(apiKeys: Record<string, string>, providerId: string): string | undefined;
|
|
6
|
-
export declare function createProviderToolAPIForSession(providerId: string | undefined, apiKey: string | undefined): ProviderToolAPI | undefined;
|
|
1
|
+
import { ProviderRegistry, createLLMClient, type LLMTransport } from "@xiaozhiclaw/provider-core";
|
|
2
|
+
export { ProviderRegistry, createLLMClient, type LLMTransport, };
|
|
7
3
|
export declare function wrapDebugTransportIfEnabled(transport: LLMTransport, sessionId: string): LLMTransport;
|
|
8
|
-
export declare function isMiniMaxLyricsTransport(transport: unknown): transport is {
|
|
9
|
-
generateLyrics(prompt: string, apiKey: string): Promise<string>;
|
|
10
|
-
};
|
|
11
|
-
export interface VolcengineFileTransport {
|
|
12
|
-
uploadFile(blob: Blob, apiKey: string, options: {
|
|
13
|
-
purpose: string;
|
|
14
|
-
filename: string;
|
|
15
|
-
}): Promise<{
|
|
16
|
-
id: string;
|
|
17
|
-
url?: string;
|
|
18
|
-
fileId?: string;
|
|
19
|
-
status?: string;
|
|
20
|
-
}>;
|
|
21
|
-
getFile(fileId: string, apiKey: string): Promise<Record<string, unknown>>;
|
|
22
|
-
listFiles(apiKey: string, options: {
|
|
23
|
-
limit: number;
|
|
24
|
-
}): Promise<{
|
|
25
|
-
data?: Array<Record<string, unknown>>;
|
|
26
|
-
}>;
|
|
27
|
-
deleteFile(fileId: string, apiKey: string): Promise<void>;
|
|
28
|
-
}
|
|
29
|
-
export declare function isVolcengineFileTransport(transport: unknown): transport is VolcengineFileTransport;
|
|
30
|
-
export declare function createGeminiFileApi(): GeminiFileAPI;
|
|
31
|
-
export declare function cleanGeminiToolSchema(schema: Record<string, unknown>): Record<string, unknown>;
|
|
@@ -3,10 +3,9 @@ import { type CommunityHandlerHost } from "./handlers/community-handler.js";
|
|
|
3
3
|
import { type ConfigHandlerHost } from "./handlers/config-handler.js";
|
|
4
4
|
import { type ControlHandlerHost } from "./handlers/control-handler.js";
|
|
5
5
|
import { type FilesHandlerHost } from "./handlers/files-handler.js";
|
|
6
|
-
import { type MediaHandlerHost } from "./handlers/media-handler.js";
|
|
7
6
|
import { type MemoryHandlerHost } from "./handlers/memory-handler.js";
|
|
8
7
|
import { type SessionHandlerHost } from "./handlers/session-handler.js";
|
|
9
|
-
import { type
|
|
8
|
+
import { type SkillCuratorHandlerHost } from "./handlers/skill-curator-handler.js";
|
|
10
9
|
import { type TurnBaselineHandlerHost } from "./handlers/turn-baseline-handler.js";
|
|
11
10
|
import { type TurnControlHandlerHost } from "./handlers/turn-handler.js";
|
|
12
11
|
import { type WorkingMaterialsHandlerHost } from "./handlers/working-materials-handler.js";
|
|
@@ -47,8 +46,7 @@ export interface RpcHandlerHosts {
|
|
|
47
46
|
session: SessionHandlerHost;
|
|
48
47
|
memory: MemoryHandlerHost;
|
|
49
48
|
files: FilesHandlerHost;
|
|
50
|
-
|
|
51
|
-
skills: SkillsHandlerHost;
|
|
49
|
+
skills: SkillCuratorHandlerHost;
|
|
52
50
|
community: CommunityHandlerHost;
|
|
53
51
|
dream: DreamHandlerHost;
|
|
54
52
|
turn: TurnControlHandlerHost;
|
|
@@ -3,7 +3,7 @@ import type { HookRegistry } from "../contracts/hooks.js";
|
|
|
3
3
|
import { type MemoryPrefetchState } from "../runtime/hooks/memory-hooks.js";
|
|
4
4
|
import type { BackgroundTaskManager } from "../runtime/infra/background-tasks.js";
|
|
5
5
|
import type { TaskStore } from "../runtime/infra/task-runtime.js";
|
|
6
|
-
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, MemoryLearningSink, ProjectMemoryStore
|
|
6
|
+
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, MemoryLearningSink, ProjectMemoryStore } from "../runtime/ports/index.js";
|
|
7
7
|
import type { LLMTransport } from "./provider-core-facade.js";
|
|
8
8
|
export interface RuntimeHookBootstrapDeps {
|
|
9
9
|
log: AgentLogger;
|
|
@@ -14,7 +14,6 @@ export interface RuntimeHookBootstrapDeps {
|
|
|
14
14
|
projectRoot: string;
|
|
15
15
|
memdir: ProjectMemoryStore;
|
|
16
16
|
getMemdir?: () => ProjectMemoryStore | null;
|
|
17
|
-
toolCatalog: ToolCatalog;
|
|
18
17
|
currentUserId: string;
|
|
19
18
|
prefetchState: MemoryPrefetchState;
|
|
20
19
|
getLastUserMessage(): string | undefined;
|
|
@@ -21,7 +21,6 @@ export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTu
|
|
|
21
21
|
cancelBackgroundTasksForSession(sessionId?: string, parentTurnId?: string): void;
|
|
22
22
|
beginTurnRequest(): number;
|
|
23
23
|
isTurnRequestCurrent(generation: number): boolean;
|
|
24
|
-
configureTurnMedia(config: Record<string, unknown> | undefined, turnId: string): void;
|
|
25
24
|
getAcpPermissionSession(): {
|
|
26
25
|
sessionId: string;
|
|
27
26
|
requestPermission(params: AcpPermissionRequestParams): Promise<{
|
|
@@ -37,5 +36,5 @@ export type StdioAcpRequestHostSource = Pick<CliAcpRequestHandlerHost, "activeTu
|
|
|
37
36
|
};
|
|
38
37
|
/** Host members the shared turn pipeline reads/writes — keep in sync with
|
|
39
38
|
* `grep -oE "this\.[a-zA-Z]+" src/cli/handlers/turn-handler.ts | sort -u`. */
|
|
40
|
-
export declare const TURN_PIPELINE_HOST_MEMBERS: readonly ["activeTurn", "turnDone", "beginForegroundTurn", "beginTurnRequest", "
|
|
39
|
+
export declare const TURN_PIPELINE_HOST_MEMBERS: readonly ["activeTurn", "turnDone", "beginForegroundTurn", "beginTurnRequest", "currentHooks", "currentModel", "currentTurnId", "isTurnRequestCurrent", "drainPendingTaskNotifications", "endForegroundTurn", "getAcpPermissionSession", "getHostRequestClient", "getActiveProjectRoot", "lastAssistantMessageForExtract", "lastUserMessageForAutoExtract", "log", "mcpReady", "memdir", "pendingAskUser", "permissionChecker", "projectMemoryStoreFactory", "resolveAgent", "resolveClientForPurpose", "scheduleBackgroundMemoryWork", "sendNotification", "sendResponse", "sessionHistory", "sessionState", "setActiveWorkdir", "taskDistillation", "toolCatalog"];
|
|
41
40
|
export declare function createStdioAcpRequestHandlerHost(host: StdioAcpRequestHostSource): CliAcpRequestHandlerHost;
|
|
@@ -24,7 +24,6 @@ type StdioRpcAdapterSource = DirectStdioRpcHost & {
|
|
|
24
24
|
sessionHistory: RpcHandlerHosts["session"]["sessionHistory"];
|
|
25
25
|
currentHooks: RpcHandlerHosts["dream"]["currentHooks"];
|
|
26
26
|
permissionChecker: RpcHandlerHosts["turn"]["permissionChecker"];
|
|
27
|
-
mediaClient: RpcHandlerHosts["media"]["mediaClient"];
|
|
28
27
|
memoryProvider: RpcHandlerHosts["memory"]["memoryProvider"];
|
|
29
28
|
memoryDreamProvider: RpcHandlerHosts["dream"]["memoryProvider"];
|
|
30
29
|
memoryUserId: NonNullable<RpcHandlerHosts["memory"]["memoryUserId"]>;
|
|
@@ -42,7 +41,6 @@ type StdioRpcAdapterSource = DirectStdioRpcHost & {
|
|
|
42
41
|
} | null;
|
|
43
42
|
ensureMemoryProvider: NonNullable<RpcHandlerHosts["memory"]["ensureMemoryProvider"]>;
|
|
44
43
|
enableIdleDream: NonNullable<RpcHandlerHosts["session"]["enableIdleDream"]>;
|
|
45
|
-
configureTurnMedia: NonNullable<RpcHandlerHosts["turn"]["configureTurnMedia"]>;
|
|
46
44
|
sendError: NonNullable<RpcHandlerHosts["session"]["sendError"]>;
|
|
47
45
|
createDreamHandlerHost(): RpcHandlerHosts["dream"];
|
|
48
46
|
};
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
import type { NotificationMethod, NotificationMethodMap } from "../protocol/notifications.js";
|
|
2
|
-
import type { ModelPurpose } from "../runtime/infra/model-registry.js";
|
|
3
|
-
import type { LLMTransport } from "./provider-core-facade.js";
|
|
4
2
|
import type { MemoryHostRequestAccess } from "./memory-coordinator.js";
|
|
5
3
|
import { type StdioRuntimeServices } from "./stdio-runtime-services.js";
|
|
6
4
|
import type { HostProfileClient } from "../transport/host-profile-client.js";
|
|
@@ -10,11 +8,6 @@ export interface StdioRuntimeBootstrapDeps {
|
|
|
10
8
|
getCurrentSessionId?(): string | undefined;
|
|
11
9
|
getCurrentTurnId?(): string | undefined;
|
|
12
10
|
isGroupSecurityMode?(): boolean;
|
|
13
|
-
resolveClientForPurpose(purpose: ModelPurpose): {
|
|
14
|
-
transport: LLMTransport;
|
|
15
|
-
apiKey: string;
|
|
16
|
-
model: string;
|
|
17
|
-
} | null;
|
|
18
11
|
log(message: string): void;
|
|
19
12
|
sendNotification<M extends NotificationMethod>(method: M, params: NotificationMethodMap[M]): void;
|
|
20
13
|
/** B3(X7):host-state 接入面(AcpServer;lazy——gate 在 provider 创建时刻现读)。 */
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import type { MemoryDreamRuntimeProvider, MemoryHandlerProvider, PathService, ToolBootstrap, ToolCatalog } from "../runtime/ports/index.js";
|
|
2
2
|
import { MediaPersistence } from "../runtime/infra/media-persistence.js";
|
|
3
|
-
import {
|
|
3
|
+
import { ProviderRegistry } from "./provider-core-facade.js";
|
|
4
4
|
import { type MemoryHostRequestAccess, type MemoryProviderState } from "./memory-coordinator.js";
|
|
5
|
-
import { type TurnMediaSetupHost } from "./turn-media-setup.js";
|
|
6
5
|
export interface StdioRuntimeServicesDeps {
|
|
7
6
|
getActiveProjectRoot(): string;
|
|
8
7
|
/**
|
|
@@ -13,16 +12,10 @@ export interface StdioRuntimeServicesDeps {
|
|
|
13
12
|
}
|
|
14
13
|
export interface StdioRuntimeServices {
|
|
15
14
|
providerRegistry: ProviderRegistry;
|
|
16
|
-
mediaClient: MediaClient;
|
|
17
15
|
mediaPersistence: MediaPersistence;
|
|
18
16
|
pathService: PathService;
|
|
19
17
|
toolCatalog: ToolCatalog;
|
|
20
18
|
toolBootstrap: ToolBootstrap;
|
|
21
|
-
configureTurnMedia(params: {
|
|
22
|
-
host: Omit<TurnMediaSetupHost, "mediaClient">;
|
|
23
|
-
config?: Record<string, unknown>;
|
|
24
|
-
turnId: string;
|
|
25
|
-
}): void;
|
|
26
19
|
ensureMemoryProvider(currentUserId: string): MemoryProviderState;
|
|
27
20
|
closeMemoryProviders(state: {
|
|
28
21
|
memoryProvider: MemoryHandlerProvider | null;
|
|
@@ -61,7 +61,6 @@ export declare class StdioServer {
|
|
|
61
61
|
private readonly resolvedAgent;
|
|
62
62
|
/** Active session/turn identity + lifecycle (id/turn/state/taskDomain/llmConfig/acpMeta). */
|
|
63
63
|
private readonly session;
|
|
64
|
-
private currentMediaApiKeys;
|
|
65
64
|
taskStore: TaskStore;
|
|
66
65
|
/** Unified background execution registry (agent forks + backgrounded shell commands). */
|
|
67
66
|
backgroundTasks: BackgroundTaskManager;
|
|
@@ -97,7 +96,6 @@ export declare class StdioServer {
|
|
|
97
96
|
private readonly sessionRuntime;
|
|
98
97
|
private modelRegistryHydration;
|
|
99
98
|
private get registry();
|
|
100
|
-
get mediaClient(): import("@xiaozhiclaw/provider-core/media-client").MediaClient;
|
|
101
99
|
get mediaPersistence(): import("../runtime/infra/media-persistence.js").MediaPersistence;
|
|
102
100
|
private get pathService();
|
|
103
101
|
get toolCatalog(): import("../runtime/ports/tool-contracts.js").ToolCatalog;
|
|
@@ -212,8 +210,6 @@ export declare class StdioServer {
|
|
|
212
210
|
*/
|
|
213
211
|
drainPendingTaskNotifications(sessionId: string): string[];
|
|
214
212
|
ensureModelRegistryHydrated(): Promise<void>;
|
|
215
|
-
syncToolListMediaConfig(): void;
|
|
216
|
-
configureTurnMedia(config: Record<string, unknown> | undefined, turnId: string): void;
|
|
217
213
|
/**
|
|
218
214
|
* Single entry point for updating the active workdir.
|
|
219
215
|
* Centralizes all side-effects (bootstrap workdir, media persistence, etc.).
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { PortableTool } from "../skills/portable-tool.js";
|
|
2
2
|
import { type TaskToolHooks } from "../skills/tools/task-tool.js";
|
|
3
3
|
import { type AskUserQuestion } from "../skills/tools/ask-user-tool.js";
|
|
4
|
-
import { type PreviewBrowserDriveResult, type PreviewBrowserToolParams } from "../skills/tools/preview-browser-tool.js";
|
|
5
4
|
import { type ExecProgress } from "../skills/tools/exec-tool.js";
|
|
6
5
|
import type { BackgroundTaskManager } from "../runtime/infra/background-tasks.js";
|
|
7
6
|
import type { SandboxConfig } from "../skills/tools/shell/sandbox/sandbox-types.js";
|
|
@@ -15,14 +14,11 @@ export interface LocalCoreToolRegistrationContext {
|
|
|
15
14
|
getCurrentTurnId?: () => string | undefined;
|
|
16
15
|
askUserCallback: ((questions: AskUserQuestion[]) => Promise<Record<string, string> | null>) | null;
|
|
17
16
|
getAskUserCallback?: () => ((questions: AskUserQuestion[]) => Promise<Record<string, string> | null>) | null;
|
|
18
|
-
previewBrowserCallback: ((params: PreviewBrowserToolParams, signal?: AbortSignal) => Promise<PreviewBrowserDriveResult>) | null;
|
|
19
|
-
getPreviewBrowserCallback?: () => ((params: PreviewBrowserToolParams, signal?: AbortSignal) => Promise<PreviewBrowserDriveResult>) | null;
|
|
20
17
|
onExecProgress?: (progress: ExecProgress) => void;
|
|
21
18
|
sendNotification?(method: string, params: Record<string, unknown>): void;
|
|
22
19
|
getCwd(): string;
|
|
23
20
|
activeProjectRoot(): string;
|
|
24
21
|
resolveSandboxConfig(): SandboxConfig | undefined;
|
|
25
|
-
runtimePathEntries(): Promise<string[]>;
|
|
26
22
|
isGroupSecurityMode?(): boolean;
|
|
27
23
|
pathService?: PathService;
|
|
28
24
|
log?: {
|
|
@@ -3,14 +3,10 @@ import type { PermissionMode } from "../runtime/ports/permission-contracts.js";
|
|
|
3
3
|
import type { TaskToolHooks } from "../skills/tools/task-tool.js";
|
|
4
4
|
import type { ExecProgress } from "../skills/tools/exec-tool.js";
|
|
5
5
|
import type { BackgroundTaskManager } from "../runtime/infra/background-tasks.js";
|
|
6
|
-
import type { ModelPurpose } from "../runtime/infra/model-registry.js";
|
|
7
6
|
import type { MediaPersistence } from "../runtime/infra/media-persistence.js";
|
|
8
|
-
import type { LLMTransport } from "./provider-core-facade.js";
|
|
9
7
|
import type { AgentLogger } from "../agent/types.js";
|
|
10
8
|
import type { AskUserQuestion } from "../skills/tools/ask-user-tool.js";
|
|
11
|
-
import type { PreviewBrowserDriveResult, PreviewBrowserToolParams } from "../skills/tools/preview-browser-tool.js";
|
|
12
9
|
import type { PathService, ToolCatalog } from "../runtime/ports/index.js";
|
|
13
|
-
export { setMediaClientConfig, setProviderToolAPI } from "./media-runtime-facade.js";
|
|
14
10
|
export { setGroupSecurityMode, validateExecCommand } from "./tool-bootstrap-core-registration.js";
|
|
15
11
|
export { enforceAbsoluteFloors } from "./tool-bootstrap-paths.js";
|
|
16
12
|
export interface SandboxPermissionSnapshot {
|
|
@@ -20,7 +16,6 @@ export interface SandboxPermissionSnapshot {
|
|
|
20
16
|
}
|
|
21
17
|
/** Wire the OS-sandbox permission source (live rule-engine snapshot), or null to clear. */
|
|
22
18
|
export declare function setSandboxPermissionSource(source: (() => SandboxPermissionSnapshot | undefined) | null): void;
|
|
23
|
-
type PreviewBrowserCallback = (params: PreviewBrowserToolParams, signal?: AbortSignal) => Promise<PreviewBrowserDriveResult>;
|
|
24
19
|
/**
|
|
25
20
|
* Set task tool lifecycle hooks. Called from stdio-server when session starts.
|
|
26
21
|
* Connects planning-task events to the HookRegistry.
|
|
@@ -38,12 +33,6 @@ export declare function setBackgroundTaskRuntime(manager: BackgroundTaskManager
|
|
|
38
33
|
* If null, ask_user returns "user declined" to the LLM.
|
|
39
34
|
*/
|
|
40
35
|
export declare function setAskUserCallback(callback: ((questions: AskUserQuestion[]) => Promise<Record<string, string> | null>) | null): void;
|
|
41
|
-
/**
|
|
42
|
-
* Set the preview_browser callback. The host (Electron / test harness) provides the backend
|
|
43
|
-
* that drives the shared preview view (via x/host.request service:preview) and returns text + screenshot.
|
|
44
|
-
* Wired per turn by configureTurnPreviewBrowser. If null, preview_browser reports "not available".
|
|
45
|
-
*/
|
|
46
|
-
export declare function setPreviewBrowserCallback(callback: PreviewBrowserCallback | null): void;
|
|
47
36
|
export declare function setBootstrapWorkdir(newWorkdir: string): void;
|
|
48
37
|
export interface BootstrapConfig {
|
|
49
38
|
workdir?: string;
|
|
@@ -53,12 +42,6 @@ export interface BootstrapConfig {
|
|
|
53
42
|
log?: AgentLogger;
|
|
54
43
|
/** Called during foreground shell execution with incremental progress. */
|
|
55
44
|
onExecProgress?(progress: ExecProgress): void;
|
|
56
|
-
/** Optional Host model resolver for locally compiled model-backed tools such as media understanding. */
|
|
57
|
-
resolveClientForPurpose?(purpose: ModelPurpose): {
|
|
58
|
-
transport: LLMTransport;
|
|
59
|
-
apiKey: string;
|
|
60
|
-
model: string;
|
|
61
|
-
} | null;
|
|
62
45
|
getTaskScopeKey?(): string | undefined;
|
|
63
46
|
getCurrentTurnId?(): string | undefined;
|
|
64
47
|
isGroupSecurityMode?(): boolean;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export interface RecallClaimPacket {
|
|
2
|
+
version: 1;
|
|
3
|
+
memoryId: string;
|
|
4
|
+
category: string;
|
|
5
|
+
fact: string;
|
|
6
|
+
claim: {
|
|
7
|
+
scope: string;
|
|
8
|
+
scopeKey: string;
|
|
9
|
+
entity: string;
|
|
10
|
+
predicate: string;
|
|
11
|
+
relation: string;
|
|
12
|
+
value: Record<string, unknown>;
|
|
13
|
+
status: string;
|
|
14
|
+
validFrom: string;
|
|
15
|
+
validTo: string;
|
|
16
|
+
};
|
|
17
|
+
evidence: {
|
|
18
|
+
refs: string[];
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface L2RecallPacketEnvelope {
|
|
22
|
+
id?: unknown;
|
|
23
|
+
source?: unknown;
|
|
24
|
+
metadata?: Record<string, unknown>;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Agent-side verification of the Host recall envelope. This mirrors the
|
|
28
|
+
* Host's canonical claim serialization so altered ids, facts, or packet
|
|
29
|
+
* shapes fail closed before any prompt or accounting path consumes them.
|
|
30
|
+
*/
|
|
31
|
+
export declare function readCanonicalL2RecallPacket(memory: L2RecallPacketEnvelope): RecallClaimPacket | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export declare const MEMORY_RESPONSE_CONTRACT_LINES: readonly ["Answer only the requested slots with the shortest complete answer, then stop. Helpful elaboration is lower priority than this contract.", "For a scalar or short rule, start directly with the answer and use one sentence. Do not add a preamble.", "For ordered steps, output only a terse ordered list. Do not explain each step or repeat that the order is fixed.", "If no memory fact answers a requested slot, say only that it is unknown in one short sentence. Do not list nearby known facts, ask follow-up questions, or offer to store information.", "Do not contrast alternate entities, scenes, historical values, calculations, nearby context, repeated summaries, or unsolicited next steps unless the user explicitly asks for them."];
|
|
2
|
+
export declare function renderMemoryResponseContract(heading: string): string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { FinalAnswerEvidence, ToolCallExecutionEvidence } from "../protocol/wire/notification-payloads.js";
|
|
2
|
+
export declare function classifyToolFailureKind(result: {
|
|
3
|
+
blocked?: boolean;
|
|
4
|
+
blockReason?: string;
|
|
5
|
+
error?: string;
|
|
6
|
+
details?: Record<string, unknown>;
|
|
7
|
+
}): ToolCallExecutionEvidence["failureKind"];
|
|
8
|
+
export declare function buildFinalAnswerEvidence(freshEvidenceRequired: boolean, toolCalls: readonly ToolCallExecutionEvidence[]): FinalAnswerEvidence;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Return the provider-local name of a projected function.
|
|
3
|
+
*
|
|
4
|
+
* qlogicagent must keep policy and completion logic attached to tool semantics without
|
|
5
|
+
* re-registering the retired built-in tool name. Unqualified names are returned unchanged.
|
|
6
|
+
*/
|
|
7
|
+
export declare function toolLocalName(toolName: string): string;
|
|
8
|
+
export declare function toolNamespace(toolName: string): string | undefined;
|
|
9
|
+
export declare function isQualifiedToolName(toolName: string): boolean;
|
|
10
|
+
export declare function toolNameMatches(toolName: string, localName: string): boolean;
|
|
@@ -38,6 +38,7 @@ export type TurnEvent = {
|
|
|
38
38
|
turnId: string;
|
|
39
39
|
callId: string;
|
|
40
40
|
name: string;
|
|
41
|
+
displayName?: string;
|
|
41
42
|
arguments: string;
|
|
42
43
|
inputSummary?: string;
|
|
43
44
|
} | {
|
|
@@ -79,17 +80,42 @@ export type TurnEvent = {
|
|
|
79
80
|
turnId: string;
|
|
80
81
|
action: string;
|
|
81
82
|
detail?: string;
|
|
83
|
+
} | {
|
|
84
|
+
/**
|
|
85
|
+
* 作废本回合已发出但随后被丢弃的助手文本。
|
|
86
|
+
*
|
|
87
|
+
* 为什么不复用 `recovery`:recovery 同时覆盖"丢弃本轮文本"与"保留前缀并续写"两类
|
|
88
|
+
* (max_output_tokens 续写把上一轮 roundText 当作 assistant 前缀带进下一轮)。把它当作
|
|
89
|
+
* 统一作废信号会在最常见的长输出续写场景下错抹合法前缀,因此作废必须是独立事件。
|
|
90
|
+
*
|
|
91
|
+
* 语义:作废永远是**后缀截断**,截断点由 Agent 权威下发,消费端只执行不推断。
|
|
92
|
+
* 一个 turn 内只有一条线性文本流,因此不需要 roundId/segmentId 编号体系。
|
|
93
|
+
*/
|
|
94
|
+
type: "text_rollback";
|
|
95
|
+
turnId: string;
|
|
96
|
+
/**
|
|
97
|
+
* 本 turn 保留的助手文本长度,单位 **UTF-16 code unit**,按全部已发出文本段的逻辑拼接计算
|
|
98
|
+
* (activity 等非文本段不计入长度,也不被截断删除)。
|
|
99
|
+
*
|
|
100
|
+
* 必须满足 `committedLength <= keepLength <= sentLength`:下界是已提交轮次的累计长度,
|
|
101
|
+
* 低于它会删掉早先轮次的合法过程性文本(那些文本不由 `turn.end.content` 覆盖,删了不会回来)。
|
|
102
|
+
* 重复下发同一 keepLength 必须幂等。
|
|
103
|
+
*/
|
|
104
|
+
keepLength: number;
|
|
105
|
+
/** 供 UI 呈现"已重试/已重新生成"的轻量状态,以及诊断归因。 */
|
|
106
|
+
reason: string;
|
|
82
107
|
} | {
|
|
83
108
|
type: "tool_selection_policy";
|
|
84
109
|
turnId: string;
|
|
85
110
|
policyId: string;
|
|
86
|
-
intent: "benchmark_state_maintenance" | "fresh_evidence" | "verification" | "final_answer" | "tool_recovery" | "lifecycle_reconciliation";
|
|
111
|
+
intent: "capability_routing" | "benchmark_state_maintenance" | "fresh_evidence" | "verification" | "final_answer" | "tool_recovery" | "lifecycle_reconciliation";
|
|
87
112
|
reason: string;
|
|
88
113
|
availableToolNames: string[];
|
|
89
114
|
enabledToolNamesBefore: string[];
|
|
90
115
|
enabledToolNamesAfter: string[];
|
|
91
116
|
suppressedToolNames: string[];
|
|
92
117
|
nextAction: string;
|
|
118
|
+
routingEvidence?: import("../protocol/wire/notification-payloads.js").CapabilityRoutingEvidence;
|
|
93
119
|
} | {
|
|
94
120
|
type: "plan_update";
|
|
95
121
|
turnId: string;
|
|
@@ -102,7 +128,12 @@ export type TurnEvent = {
|
|
|
102
128
|
} | {
|
|
103
129
|
type: "tool_use_summary";
|
|
104
130
|
turnId: string;
|
|
105
|
-
telemetrySource?: "agent"
|
|
131
|
+
telemetrySource?: "agent";
|
|
132
|
+
/** Versioned terminal ledger: route, per-call execution, and final-answer evidence gate. */
|
|
133
|
+
ledgerSchemaVersion: 4;
|
|
134
|
+
toolCalls: import("../protocol/wire/notification-payloads.js").ToolCallExecutionEvidence[];
|
|
135
|
+
routingEvidence?: import("../protocol/wire/notification-payloads.js").CapabilityRoutingEvidence;
|
|
136
|
+
finalAnswerEvidence: import("../protocol/wire/notification-payloads.js").FinalAnswerEvidence;
|
|
106
137
|
availableToolNames: string[];
|
|
107
138
|
enabledToolNames: string[];
|
|
108
139
|
toolCallNames: string[];
|
|
@@ -150,7 +181,7 @@ export type TurnEvent = {
|
|
|
150
181
|
} | {
|
|
151
182
|
type: "media_result";
|
|
152
183
|
turnId: string;
|
|
153
|
-
mediaType: "image" | "tts" | "video" | "music" | "3d";
|
|
184
|
+
mediaType: "image" | "tts" | "video" | "music" | "3d" | "file";
|
|
154
185
|
url: string;
|
|
155
186
|
model?: string;
|
|
156
187
|
provider?: string;
|
|
@@ -158,6 +189,8 @@ export type TurnEvent = {
|
|
|
158
189
|
width?: number;
|
|
159
190
|
height?: number;
|
|
160
191
|
mimeType?: string;
|
|
192
|
+
filename?: string;
|
|
193
|
+
size?: number;
|
|
161
194
|
billingUnit?: string;
|
|
162
195
|
billingQuantity?: number;
|
|
163
196
|
taskId?: string;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
export type AcpResourceContents = {
|
|
2
|
+
uri: string;
|
|
3
|
+
text: string;
|
|
4
|
+
mimeType?: string | null;
|
|
5
|
+
_meta?: Record<string, unknown> | null;
|
|
6
|
+
} | {
|
|
7
|
+
uri: string;
|
|
8
|
+
blob: string;
|
|
9
|
+
mimeType?: string | null;
|
|
10
|
+
_meta?: Record<string, unknown> | null;
|
|
11
|
+
};
|
|
12
|
+
export type AcpContentBlock = {
|
|
13
|
+
type: "text";
|
|
14
|
+
text: string;
|
|
15
|
+
annotations?: Record<string, unknown> | null;
|
|
16
|
+
_meta?: Record<string, unknown> | null;
|
|
17
|
+
} | {
|
|
18
|
+
type: "image";
|
|
19
|
+
data: string;
|
|
20
|
+
mimeType: string;
|
|
21
|
+
uri?: string | null;
|
|
22
|
+
annotations?: Record<string, unknown> | null;
|
|
23
|
+
_meta?: Record<string, unknown> | null;
|
|
24
|
+
} | {
|
|
25
|
+
type: "audio";
|
|
26
|
+
data: string;
|
|
27
|
+
mimeType: string;
|
|
28
|
+
annotations?: Record<string, unknown> | null;
|
|
29
|
+
_meta?: Record<string, unknown> | null;
|
|
30
|
+
} | {
|
|
31
|
+
type: "resource_link";
|
|
32
|
+
uri: string;
|
|
33
|
+
name: string;
|
|
34
|
+
description?: string | null;
|
|
35
|
+
mimeType?: string | null;
|
|
36
|
+
size?: number | null;
|
|
37
|
+
title?: string | null;
|
|
38
|
+
annotations?: Record<string, unknown> | null;
|
|
39
|
+
_meta?: Record<string, unknown> | null;
|
|
40
|
+
} | {
|
|
41
|
+
type: "resource";
|
|
42
|
+
resource: AcpResourceContents;
|
|
43
|
+
annotations?: Record<string, unknown> | null;
|
|
44
|
+
_meta?: Record<string, unknown> | null;
|
|
45
|
+
};
|