@deepstrike/sdk 0.2.70 → 0.2.72
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 +57 -41
- package/dist/advanced/public.d.ts +24 -0
- package/dist/advanced/public.js +18 -0
- package/dist/agent-facade.d.ts +96 -0
- package/dist/agent-facade.js +317 -0
- package/dist/agent-ir.d.ts +11 -5
- package/dist/agent-ir.js +42 -26
- package/dist/canonical-prefix-allowlist.d.ts +6 -0
- package/dist/canonical-prefix-allowlist.js +30 -0
- package/dist/evals/public.d.ts +50 -0
- package/dist/evals/public.js +25 -0
- package/dist/guardrail.d.ts +4 -1
- package/dist/handoff-target.d.ts +2 -0
- package/dist/handoff-target.js +7 -1
- package/dist/index.d.ts +14 -30
- package/dist/index.js +7 -16
- package/dist/kernel.d.ts +2 -2
- package/dist/knowledge/public.d.ts +2 -0
- package/dist/knowledge/public.js +1 -1
- package/dist/knowledge/source.d.ts +7 -0
- package/dist/knowledge/source.js +20 -1
- package/dist/memory/protocols.d.ts +2 -2
- package/dist/projection-pairs.d.ts +43 -0
- package/dist/projection-pairs.js +9 -0
- package/dist/providers/anthropic-adapter.d.ts +2 -2
- package/dist/providers/anthropic.d.ts +4 -4
- package/dist/providers/base.d.ts +5 -5
- package/dist/providers/content-normalization.d.ts +4 -4
- package/dist/providers/gemini-adapter.d.ts +2 -2
- package/dist/providers/gemini.d.ts +3 -3
- package/dist/providers/ollama-adapter.d.ts +2 -2
- package/dist/providers/ollama.d.ts +2 -2
- package/dist/providers/openai-chat.d.ts +4 -4
- package/dist/providers/openai-responses-adapter.d.ts +2 -2
- package/dist/providers/openai-responses.d.ts +2 -2
- package/dist/providers/openai.d.ts +4 -4
- package/dist/providers/protocol-adapter.d.ts +2 -2
- package/dist/providers/protocol-capabilities.d.ts +1 -0
- package/dist/providers/protocol-capabilities.js +3 -0
- package/dist/providers/public.d.ts +4 -2
- package/dist/providers/public.js +2 -1
- package/dist/providers/replay-validator.d.ts +3 -3
- package/dist/runtime/archive.d.ts +7 -7
- package/dist/runtime/canonical-kernel-step.d.ts +2 -2
- package/dist/runtime/context-manager.d.ts +56 -0
- package/dist/runtime/context-manager.js +112 -0
- package/dist/runtime/eval.d.ts +2 -2
- package/dist/runtime/kernel-step.d.ts +5 -5
- package/dist/runtime/provider-replay.d.ts +2 -2
- package/dist/runtime/public.d.ts +22 -0
- package/dist/runtime/public.js +11 -0
- package/dist/runtime/replay-fixture.d.ts +3 -3
- package/dist/runtime/replay-fixture.js +1 -1
- package/dist/runtime/replay-provider.d.ts +4 -4
- package/dist/runtime/replay-provider.js +1 -1
- package/dist/runtime/runner.d.ts +17 -5
- package/dist/runtime/runner.js +110 -37
- package/dist/runtime/session-log.d.ts +1 -1
- package/dist/runtime/session-repair.d.ts +2 -2
- package/dist/runtime/workflow-control-flow.d.ts +1 -1
- package/dist/runtime/workflow-control-flow.js +16 -2
- package/dist/runtime-classification.d.ts +161 -0
- package/dist/runtime-classification.js +66 -0
- package/dist/runtime-language.d.ts +32 -0
- package/dist/runtime-language.js +51 -0
- package/dist/skill.d.ts +31 -5
- package/dist/types/agent.d.ts +17 -4
- package/dist/types.d.ts +22 -12
- package/dist/workflow/definition.d.ts +19 -0
- package/dist/workflow/definition.js +29 -0
- package/dist/workflow/public.d.ts +3 -1
- package/dist/workflow/public.js +1 -0
- package/package.json +23 -2
- package/dist/compat/anthropic/mcp.d.ts +0 -15
- package/dist/compat/anthropic/mcp.js +0 -10
- package/dist/compat/openai/agent.d.ts +0 -34
- package/dist/compat/openai/agent.js +0 -24
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage, RenderedContext, ToolOutputBlock, ToolResultPart, ToolSchema, ToolCall, ProviderReplay } from "../types.js";
|
|
2
2
|
import type { ResolvedProviderRuntime } from "./model-registry.js";
|
|
3
3
|
export declare class ContentValidationError extends Error {
|
|
4
4
|
constructor(message: string);
|
|
@@ -16,7 +16,7 @@ export interface CanonicalToolResult {
|
|
|
16
16
|
}
|
|
17
17
|
export type CanonicalMessageBlock = ToolOutputBlock | CanonicalToolResult;
|
|
18
18
|
export interface CanonicalMessage {
|
|
19
|
-
readonly role:
|
|
19
|
+
readonly role: ModelMessage["role"];
|
|
20
20
|
readonly blocks: readonly CanonicalMessageBlock[];
|
|
21
21
|
/** `blocks` remains authoritative; this only preserves an observable wire-shape distinction. */
|
|
22
22
|
readonly contentForm?: "text" | "blocks";
|
|
@@ -43,7 +43,7 @@ export declare function projectToolOutputToText(blocks: readonly ToolOutputBlock
|
|
|
43
43
|
export declare function normalizeToolResultPart(part: ToolResultPart): CanonicalToolResult;
|
|
44
44
|
/** Attach process-local blocks only within the operation that produced them. */
|
|
45
45
|
export declare function attachToolOutputOverlay(context: RenderedContext, overlay: ReadonlyMap<string, readonly ToolOutputBlock[]>): RenderedContext;
|
|
46
|
-
export declare function normalizeCanonicalContext(context: RenderedContext, replayForMessage?: (message:
|
|
46
|
+
export declare function normalizeCanonicalContext(context: RenderedContext, replayForMessage?: (message: ModelMessage) => ProviderReplay | undefined): CanonicalRenderedContext;
|
|
47
47
|
/** Full-tree validation uses the resolved operation capabilities. Unknown stays unknown/fail-open. */
|
|
48
48
|
export declare function validateCanonicalAdapterInput(input: CanonicalAdapterInput): void;
|
|
49
49
|
export declare function normalizeCanonicalAdapterInput(input: {
|
|
@@ -51,6 +51,6 @@ export declare function normalizeCanonicalAdapterInput(input: {
|
|
|
51
51
|
tools: readonly ToolSchema[];
|
|
52
52
|
resolved: ResolvedProviderRuntime<unknown>;
|
|
53
53
|
extensions?: Readonly<Record<string, unknown>>;
|
|
54
|
-
replayForMessage?: (message:
|
|
54
|
+
replayForMessage?: (message: ModelMessage) => ProviderReplay | undefined;
|
|
55
55
|
}): CanonicalAdapterInput;
|
|
56
56
|
export declare function normalizeToolResultContent(callId: string, output: string, isError: boolean, contentParts: readonly ToolOutputBlock[] | undefined): CanonicalToolResult;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Content, GenerateContentRequest, GenerateContentResponse, ModelParams, Tool } from "@google/generative-ai";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelMessage, ProviderUsage } from "../types.js";
|
|
3
3
|
import type { CanonicalAdapterInput } from "./content-normalization.js";
|
|
4
4
|
import { type AdapterDecodeInput, type AdapterOutput, type AdapterStreamInput, type CanonicalStopReason, type ProtocolAdapter } from "./protocol-adapter.js";
|
|
5
5
|
export interface GeminiRequestPlan {
|
|
@@ -23,7 +23,7 @@ export declare class GeminiAdapter implements ProtocolAdapter<GeminiRequestPlan,
|
|
|
23
23
|
readonly protocolCapabilities: import("./protocol-capabilities.js").ProtocolRuntimeCapabilities;
|
|
24
24
|
buildRequest(input: CanonicalAdapterInput): GeminiRequestPlan;
|
|
25
25
|
decodeComplete(raw: GenerateContentResponse, _input: AdapterDecodeInput): {
|
|
26
|
-
message:
|
|
26
|
+
message: ModelMessage;
|
|
27
27
|
};
|
|
28
28
|
createStreamState(input: AdapterStreamInput): GeminiStreamState;
|
|
29
29
|
pushStreamChunk(chunk: GenerateContentResponse, state: GeminiStreamState): AdapterOutput;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { PreparedProviderRequest, ProviderRunState as PreparedRunState } from "../types.js";
|
|
2
2
|
import { type Content } from "@google/generative-ai";
|
|
3
|
-
import type {
|
|
3
|
+
import type { ModelMessage, RenderedContext, ToolSchema, StreamEvent, LLMProvider, RuntimePolicy, PromptMeasurement, ProviderTransportTelemetry } from "../types.js";
|
|
4
4
|
import { type CanonicalAdapterInput } from "./content-normalization.js";
|
|
5
5
|
type ResolvedGeminiRuntime = CanonicalAdapterInput["resolved"];
|
|
6
|
-
export declare function buildContents(turns:
|
|
6
|
+
export declare function buildContents(turns: ModelMessage[]): Content[];
|
|
7
7
|
export declare class GeminiProvider implements LLMProvider {
|
|
8
8
|
private readonly model;
|
|
9
9
|
private resolvedRuntime?;
|
|
@@ -24,7 +24,7 @@ export declare class GeminiProvider implements LLMProvider {
|
|
|
24
24
|
runtimePolicy(): RuntimePolicy;
|
|
25
25
|
bindResolvedRuntime(resolved: ResolvedGeminiRuntime): void;
|
|
26
26
|
private adapterInput;
|
|
27
|
-
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<
|
|
27
|
+
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<ModelMessage>;
|
|
28
28
|
prepareRequest(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState): PreparedProviderRequest;
|
|
29
29
|
stream(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState, signal?: AbortSignal): AsyncIterable<StreamEvent>;
|
|
30
30
|
private streamPlan;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage, ProviderUsage } from "../types.js";
|
|
2
2
|
import type { CanonicalAdapterInput } from "./content-normalization.js";
|
|
3
3
|
import { type AdapterDecodeInput, type AdapterOutput, type AdapterStreamInput, type CanonicalStopReason, type ProtocolAdapter } from "./protocol-adapter.js";
|
|
4
4
|
export interface OllamaMessage {
|
|
@@ -54,7 +54,7 @@ export declare class OllamaAdapter implements ProtocolAdapter<OllamaRequest, Oll
|
|
|
54
54
|
readonly protocolCapabilities: import("./protocol-capabilities.js").ProtocolRuntimeCapabilities;
|
|
55
55
|
buildRequest(input: CanonicalAdapterInput): OllamaRequest;
|
|
56
56
|
decodeComplete(raw: OllamaChunk, _input: AdapterDecodeInput): {
|
|
57
|
-
message:
|
|
57
|
+
message: ModelMessage;
|
|
58
58
|
};
|
|
59
59
|
createStreamState(input: AdapterStreamInput): OllamaStreamState;
|
|
60
60
|
pushStreamChunk(chunk: OllamaChunk, state: OllamaStreamState): AdapterOutput;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { PreparedProviderRequest, ProviderRunState as PreparedRunState } from "../types.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelMessage, RenderedContext, ToolSchema, StreamEvent, LLMProvider, RuntimePolicy, ProviderTransportTelemetry } from "../types.js";
|
|
3
3
|
import { type CanonicalAdapterInput } from "./content-normalization.js";
|
|
4
4
|
type ResolvedOllamaRuntime = CanonicalAdapterInput["resolved"];
|
|
5
5
|
export declare class OllamaProvider implements LLMProvider {
|
|
@@ -15,7 +15,7 @@ export declare class OllamaProvider implements LLMProvider {
|
|
|
15
15
|
runtimePolicy(): RuntimePolicy;
|
|
16
16
|
bindResolvedRuntime(resolved: ResolvedOllamaRuntime): void;
|
|
17
17
|
private adapterInput;
|
|
18
|
-
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<
|
|
18
|
+
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<ModelMessage>;
|
|
19
19
|
prepareRequest(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState): PreparedProviderRequest;
|
|
20
20
|
stream(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState, signal?: AbortSignal): AsyncIterable<StreamEvent>;
|
|
21
21
|
private streamPlan;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type OpenAI from "openai";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelMessage, ProviderDescriptor, ProviderReplay, ProviderUsage, RenderedContext, ToolCall, ToolSchema } from "../types.js";
|
|
3
3
|
import { ThinkingTagStreamExtractor } from "./base.js";
|
|
4
4
|
import type { CanonicalAdapterInput } from "./content-normalization.js";
|
|
5
5
|
import { type ReplayabilityAssessment } from "./replay-validator.js";
|
|
@@ -41,7 +41,7 @@ export declare class OpenAIChatAdapter implements ProtocolAdapter<OpenAIChatRequ
|
|
|
41
41
|
readonly protocolCapabilities: import("./protocol-capabilities.js").ProtocolRuntimeCapabilities;
|
|
42
42
|
buildRequest(input: CanonicalAdapterInput, dialect?: OpenAIChatWireDialect): OpenAIChatRequestPlan;
|
|
43
43
|
decodeComplete(raw: Record<string, any>, input: AdapterDecodeInput, dialect?: OpenAIChatWireDialect): {
|
|
44
|
-
message:
|
|
44
|
+
message: ModelMessage;
|
|
45
45
|
replay?: ProviderReplay;
|
|
46
46
|
};
|
|
47
47
|
createStreamState(input: AdapterStreamInput, dialect?: OpenAIChatWireDialect): OpenAIChatStreamState;
|
|
@@ -60,6 +60,6 @@ export declare class OpenAIChatAdapter implements ProtocolAdapter<OpenAIChatRequ
|
|
|
60
60
|
buildMessages(context: RenderedContext, options?: OpenAIChatBuildMessageOptions): OpenAI.ChatCompletionMessageParam[];
|
|
61
61
|
assessReasoning(context: RenderedContext): ReplayabilityAssessment;
|
|
62
62
|
normalizeToolCalls(toolCalls?: OpenAI.ChatCompletionMessageToolCall[]): ToolCall[];
|
|
63
|
-
rememberReplayFields(message: Pick<
|
|
64
|
-
peekReplayFields(message: Pick<
|
|
63
|
+
rememberReplayFields(message: Pick<ModelMessage, "content" | "toolCalls">, fields: Record<string, unknown>): void;
|
|
64
|
+
peekReplayFields(message: Pick<ModelMessage, "content" | "toolCalls">): Record<string, unknown> | undefined;
|
|
65
65
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage, ProviderUsage, RenderedContext, ToolCall, ToolSchema } from "../types.js";
|
|
2
2
|
import type { CanonicalAdapterInput } from "./content-normalization.js";
|
|
3
3
|
import { type AdapterDecodeInput, type AdapterOutput, type AdapterStreamInput, type CanonicalStopReason, type ProtocolAdapter } from "./protocol-adapter.js";
|
|
4
4
|
export interface OpenAIResponsesRunState {
|
|
@@ -23,7 +23,7 @@ export declare class OpenAIResponsesAdapter implements ProtocolAdapter<OpenAIRes
|
|
|
23
23
|
readonly protocolCapabilities: import("./protocol-capabilities.js").ProtocolRuntimeCapabilities;
|
|
24
24
|
buildRequest(input: CanonicalAdapterInput, state?: OpenAIResponsesRunState): OpenAIResponsesRequestPlan;
|
|
25
25
|
decodeComplete(raw: Record<string, any>, _input: AdapterDecodeInput): {
|
|
26
|
-
message:
|
|
26
|
+
message: ModelMessage;
|
|
27
27
|
};
|
|
28
28
|
createStreamState(input: AdapterStreamInput, _state?: OpenAIResponsesRunState): OpenAIResponsesStreamState;
|
|
29
29
|
pushStreamChunk(chunk: OpenAIResponsesStreamChunk, state: OpenAIResponsesStreamState): AdapterOutput;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PreparedProviderRequest, ProviderRunState as PreparedRunState } from "../types.js";
|
|
2
2
|
import OpenAI from "openai";
|
|
3
|
-
import type { LLMProvider,
|
|
3
|
+
import type { LLMProvider, ModelMessage, PromptMeasurement, ProviderRunState, ProviderTransportTelemetry, RenderedContext, RuntimePolicy, StreamEvent, ToolSchema } from "../types.js";
|
|
4
4
|
import { CircuitBreaker } from "./base.js";
|
|
5
5
|
import { type CanonicalAdapterInput } from "./content-normalization.js";
|
|
6
6
|
import { OpenAIResponsesAdapter, type OpenAIResponsesRunState } from "./openai-responses-adapter.js";
|
|
@@ -25,7 +25,7 @@ export declare class OpenAIResponsesProvider implements LLMProvider {
|
|
|
25
25
|
bindResolvedRuntime(resolved: ResolvedOpenAIResponsesRuntime): void;
|
|
26
26
|
createRunState(): OpenAIResponsesRunState;
|
|
27
27
|
private adapterInput;
|
|
28
|
-
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<
|
|
28
|
+
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<ModelMessage>;
|
|
29
29
|
/** spc_024-05: native preflight via the official Responses input-token count endpoint. Counts
|
|
30
30
|
* the exact create request plan (stateful `previous_response_id` continuation included) —
|
|
31
31
|
* native measurement belongs to the verified official endpoint, not the wire protocol. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { PreparedProviderRequest, ProviderRunState as PreparedRunState } from "../types.js";
|
|
2
2
|
import OpenAI from "openai";
|
|
3
|
-
import type { LLMProvider,
|
|
3
|
+
import type { LLMProvider, ModelMessage, ProviderDescriptor, ProviderReplay, ProviderTransportTelemetry, RenderedContext, ReplayabilityAssessment, RuntimePolicy, StreamEvent, ToolSchema } from "../types.js";
|
|
4
4
|
import { CircuitBreaker } from "./base.js";
|
|
5
5
|
import { type CanonicalAdapterInput } from "./content-normalization.js";
|
|
6
6
|
import { OpenAIChatAdapter } from "./openai-chat.js";
|
|
@@ -39,11 +39,11 @@ export declare class OpenAIChatProvider implements LLMProvider {
|
|
|
39
39
|
/** P4-S1: transport facts of the most recent execution. Host evidence only (B7). */
|
|
40
40
|
private lastTelemetry;
|
|
41
41
|
peekTransportTelemetry(): ProviderTransportTelemetry | undefined;
|
|
42
|
-
peekProviderReplay(message: Pick<
|
|
43
|
-
seedProviderReplay(message: Pick<
|
|
42
|
+
peekProviderReplay(message: Pick<ModelMessage, "content" | "toolCalls">): ProviderReplay | undefined;
|
|
43
|
+
seedProviderReplay(message: Pick<ModelMessage, "content" | "toolCalls">, replay: ProviderReplay): void;
|
|
44
44
|
private rememberReplay;
|
|
45
45
|
private adapterInput;
|
|
46
|
-
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<
|
|
46
|
+
complete(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>): Promise<ModelMessage>;
|
|
47
47
|
prepareRequest(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState): PreparedProviderRequest;
|
|
48
48
|
stream(context: RenderedContext, tools: ToolSchema[], extensions?: Record<string, unknown>, state?: PreparedRunState, signal?: AbortSignal): AsyncIterable<StreamEvent>;
|
|
49
49
|
private streamPlan;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage, ProviderReplay, ProviderRunState, ProviderUsage, StreamEvent } from "../types.js";
|
|
2
2
|
import type { CanonicalAdapterInput } from "./content-normalization.js";
|
|
3
3
|
import type { GenerationProtocol, ProtocolRuntimeCapabilities } from "./protocol-capabilities.js";
|
|
4
4
|
export { GEMINI_PROTOCOL_CAPABILITIES, OLLAMA_PROTOCOL_CAPABILITIES, } from "./protocol-capabilities.js";
|
|
@@ -19,7 +19,7 @@ export interface ProtocolAdapter<TRequest, TCompleteResponse, TStreamChunk, TStr
|
|
|
19
19
|
readonly protocolCapabilities: ProtocolRuntimeCapabilities;
|
|
20
20
|
buildRequest(input: CanonicalAdapterInput): TRequest;
|
|
21
21
|
decodeComplete(raw: TCompleteResponse, input: AdapterDecodeInput): {
|
|
22
|
-
message:
|
|
22
|
+
message: ModelMessage;
|
|
23
23
|
replay?: ProviderReplay;
|
|
24
24
|
};
|
|
25
25
|
createStreamState(input: AdapterStreamInput): TStreamState;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export type InputModality = "text" | "image" | "audio" | "video" | "file";
|
|
2
2
|
export type OutputModality = "text" | "image" | "audio" | "embedding";
|
|
3
3
|
export type GenerationProtocol = "anthropic-messages" | "openai-chat" | "openai-responses" | "gemini" | "ollama-chat";
|
|
4
|
+
export declare const GENERATION_PROTOCOLS: readonly GenerationProtocol[];
|
|
4
5
|
export interface ProtocolRuntimeCapabilities {
|
|
5
6
|
acceptedInputModalities: readonly InputModality[];
|
|
6
7
|
emittedOutputModalities: readonly OutputModality[];
|
|
@@ -20,8 +20,10 @@ export { ContentPolicyError, contentDispositionFor } from "./content-policy.js";
|
|
|
20
20
|
export type { ContentDisposition, ContentPlacement } from "./content-policy.js";
|
|
21
21
|
export { CapabilityRouter } from "./capability-router.js";
|
|
22
22
|
export type { CapabilityRequirement, CapabilityRouteResult } from "./capability-router.js";
|
|
23
|
-
export { createProviderRequestPlan, createProviderRequestPlanForProvider, estimateProviderPromptTokens, measurementForPlan, normalizeProviderUsage, priceProviderUsage, recordPromptMeasurement } from "./request-plan.js";
|
|
24
|
-
export type { CostObservation, NormalizedProviderUsage, PricingSnapshot, ProviderRequestEndpoint, ProviderRequestPlan, RecordedPromptMeasurement } from "./request-plan.js";
|
|
23
|
+
export { createProviderRequestPlan, createProviderRequestPlanForProvider, estimateProviderPromptTokens, measurementForPlan, normalizeProviderUsage, priceProviderUsage, recordPromptMeasurement, resolveProviderRoute } from "./request-plan.js";
|
|
24
|
+
export type { CostObservation, NormalizedProviderUsage, PricingSnapshot, ProviderRequestEndpoint, ProviderRequestPlan, RecordedPromptMeasurement, ResolvedProviderRoute } from "./request-plan.js";
|
|
25
|
+
export { FULL_FOOTPRINT_USAGE_ACCOUNTING_POLICY, providerAttemptToRecord } from "../runtime/execution-evidence.js";
|
|
26
|
+
export type { InvocationOutcome, ModelInvocation, ProviderAttempt, ProviderAttemptRecord, ProviderAttemptStatus, UsageAccountingPolicy, ModelUsageSettlement } from "../runtime/execution-evidence.js";
|
|
25
27
|
export { CredentialResolutionError, OAuthCredentialResolver, redactCredential, resolveCredential } from "./credentials.js";
|
|
26
28
|
export type { CredentialOptions, CredentialRequest, CredentialResolver, OAuthAccessToken, OAuthCredentialResolverOptions, OAuthRefreshRequest, ProviderCredential, } from "./credentials.js";
|
|
27
29
|
export { DynamicModelCatalog, StaticModelCatalog } from "./model-catalog.js";
|
package/dist/providers/public.js
CHANGED
|
@@ -16,7 +16,8 @@ export { ProviderError, classifyProviderError, } from "./provider-error.js";
|
|
|
16
16
|
export { endpointProfiles } from "./endpoints.js";
|
|
17
17
|
export { ContentPolicyError, contentDispositionFor } from "./content-policy.js";
|
|
18
18
|
export { CapabilityRouter } from "./capability-router.js";
|
|
19
|
-
export { createProviderRequestPlan, createProviderRequestPlanForProvider, estimateProviderPromptTokens, measurementForPlan, normalizeProviderUsage, priceProviderUsage, recordPromptMeasurement } from "./request-plan.js";
|
|
19
|
+
export { createProviderRequestPlan, createProviderRequestPlanForProvider, estimateProviderPromptTokens, measurementForPlan, normalizeProviderUsage, priceProviderUsage, recordPromptMeasurement, resolveProviderRoute } from "./request-plan.js";
|
|
20
|
+
export { FULL_FOOTPRINT_USAGE_ACCOUNTING_POLICY, providerAttemptToRecord } from "../runtime/execution-evidence.js";
|
|
20
21
|
export { CredentialResolutionError, OAuthCredentialResolver, redactCredential, resolveCredential } from "./credentials.js";
|
|
21
22
|
export { DynamicModelCatalog, StaticModelCatalog } from "./model-catalog.js";
|
|
22
23
|
export { modelRegistry, resolveEffectiveCapability } from "./model-registry.js";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage, ProviderDescriptor, ProviderReplay, RenderedContext, ReplayabilityAssessment } from "../types.js";
|
|
2
2
|
export type { ReplayabilityAssessment };
|
|
3
3
|
export declare class ProviderReplayValidationError extends Error {
|
|
4
4
|
constructor(message: string);
|
|
@@ -20,7 +20,7 @@ export interface OpenAIChatReplayValidationOptions {
|
|
|
20
20
|
* rather than fail outright.
|
|
21
21
|
*/
|
|
22
22
|
degradeMissingReasoning?: boolean;
|
|
23
|
-
replayForAssistant?: (message: Pick<
|
|
23
|
+
replayForAssistant?: (message: Pick<ModelMessage, "content" | "toolCalls">) => ProviderReplay | Record<string, unknown> | undefined;
|
|
24
24
|
}
|
|
25
25
|
export declare function validateOpenAIChatReplay(context: RenderedContext, options?: OpenAIChatReplayValidationOptions): void;
|
|
26
26
|
/**
|
|
@@ -29,4 +29,4 @@ export declare function validateOpenAIChatReplay(context: RenderedContext, optio
|
|
|
29
29
|
* embedder decide per-candidate whether to keep thinking on, disable it, or
|
|
30
30
|
* skip the candidate — before sending.
|
|
31
31
|
*/
|
|
32
|
-
export declare function assessReasoningReplay(turns:
|
|
32
|
+
export declare function assessReasoningReplay(turns: ModelMessage[], options: Pick<OpenAIChatReplayValidationOptions, "replayForAssistant">): ReplayabilityAssessment;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ModelMessage } from "../types.js";
|
|
2
2
|
export interface ArchiveStore {
|
|
3
|
-
write(sessionId: string, seq: number, messages:
|
|
4
|
-
read(archiveRef: string): Promise<
|
|
3
|
+
write(sessionId: string, seq: number, messages: ModelMessage[]): Promise<string>;
|
|
4
|
+
read(archiveRef: string): Promise<ModelMessage[]>;
|
|
5
5
|
}
|
|
6
6
|
export declare class NullArchiveStore implements ArchiveStore {
|
|
7
|
-
write(_sessionId: string, _seq: number, _messages:
|
|
8
|
-
read(_archiveRef: string): Promise<
|
|
7
|
+
write(_sessionId: string, _seq: number, _messages: ModelMessage[]): Promise<string>;
|
|
8
|
+
read(_archiveRef: string): Promise<ModelMessage[]>;
|
|
9
9
|
}
|
|
10
10
|
export declare class FileArchiveStore implements ArchiveStore {
|
|
11
11
|
private readonly root;
|
|
12
12
|
constructor(root: string);
|
|
13
|
-
write(sessionId: string, seq: number, messages:
|
|
14
|
-
read(archiveRef: string): Promise<
|
|
13
|
+
write(sessionId: string, seq: number, messages: ModelMessage[]): Promise<string>;
|
|
14
|
+
read(archiveRef: string): Promise<ModelMessage[]>;
|
|
15
15
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CanonicalKernelInstance, CanonicalRestoreCost } from "../kernel.js";
|
|
2
|
-
import type {
|
|
2
|
+
import type { ModelMessage } from "../types.js";
|
|
3
3
|
import { type InstalledCheckpoint, type KernelJournal } from "./kernel-journal.js";
|
|
4
4
|
import { type KernelObservation, type KernelRunnerAction } from "./kernel-step.js";
|
|
5
5
|
export declare const MAX_CHAIN_POSITION = 1000000000000;
|
|
@@ -120,7 +120,7 @@ export declare class CanonicalRunnerRuntime {
|
|
|
120
120
|
isTerminal(): boolean;
|
|
121
121
|
recoveryContentBytes(): number;
|
|
122
122
|
preservedRefs(): string[];
|
|
123
|
-
drainNewMessages():
|
|
123
|
+
drainNewMessages(): ModelMessage[];
|
|
124
124
|
drainHostObservations(): KernelObservationLike[];
|
|
125
125
|
terminal(): Record<string, unknown> | undefined;
|
|
126
126
|
localSubagentsSpawned(): number;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export type ContextItemKind = "core" | "task" | "skill" | "memory" | "knowledge" | "workflow";
|
|
2
|
+
export type ContextItemScope = "run" | "session" | "step" | "turn";
|
|
3
|
+
export interface ContextItem {
|
|
4
|
+
id: string;
|
|
5
|
+
kind: ContextItemKind;
|
|
6
|
+
content: string;
|
|
7
|
+
scope: ContextItemScope;
|
|
8
|
+
priority: number;
|
|
9
|
+
tokenCost?: number;
|
|
10
|
+
confidence?: number;
|
|
11
|
+
expiresAt?: number;
|
|
12
|
+
pinned?: boolean;
|
|
13
|
+
source: {
|
|
14
|
+
type: string;
|
|
15
|
+
id?: string;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface ContextManagerOptions {
|
|
19
|
+
maxTokens: number;
|
|
20
|
+
responseReserveTokens?: number;
|
|
21
|
+
now?: () => number;
|
|
22
|
+
onEvent?: (event: ContextLedgerEvent) => void;
|
|
23
|
+
}
|
|
24
|
+
export type ContextLedgerEventKind = "context_added" | "context_removed" | "context_expired" | "context_selected";
|
|
25
|
+
export interface ContextLedgerEvent {
|
|
26
|
+
kind: ContextLedgerEventKind;
|
|
27
|
+
itemId?: string;
|
|
28
|
+
source?: ContextItem["source"];
|
|
29
|
+
fingerprint: string;
|
|
30
|
+
at: number;
|
|
31
|
+
}
|
|
32
|
+
export interface ContextSnapshot {
|
|
33
|
+
items: ContextItem[];
|
|
34
|
+
selected: ContextItem[];
|
|
35
|
+
usedTokens: number;
|
|
36
|
+
availableTokens: number;
|
|
37
|
+
fingerprint: string;
|
|
38
|
+
}
|
|
39
|
+
export declare function estimateContextTokens(content: string): number;
|
|
40
|
+
/** Host-side context budget and lifecycle manager. Kernel context remains the execution authority. */
|
|
41
|
+
export declare class ContextManager {
|
|
42
|
+
private readonly items;
|
|
43
|
+
private readonly now;
|
|
44
|
+
private readonly budget;
|
|
45
|
+
private readonly onEvent?;
|
|
46
|
+
constructor(options: ContextManagerOptions);
|
|
47
|
+
upsert(item: ContextItem): void;
|
|
48
|
+
remove(id: string): void;
|
|
49
|
+
expire(now?: number): string[];
|
|
50
|
+
select(now?: number): ContextItem[];
|
|
51
|
+
snapshot(now?: number): ContextSnapshot;
|
|
52
|
+
fingerprint(now?: number): string;
|
|
53
|
+
private selectWithoutEvents;
|
|
54
|
+
private emit;
|
|
55
|
+
private fingerprintOf;
|
|
56
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export function estimateContextTokens(content) {
|
|
3
|
+
return Math.max(1, Math.ceil(content.length / 4));
|
|
4
|
+
}
|
|
5
|
+
/** Host-side context budget and lifecycle manager. Kernel context remains the execution authority. */
|
|
6
|
+
export class ContextManager {
|
|
7
|
+
items = new Map();
|
|
8
|
+
now;
|
|
9
|
+
budget;
|
|
10
|
+
onEvent;
|
|
11
|
+
constructor(options) {
|
|
12
|
+
if (!Number.isSafeInteger(options.maxTokens) || options.maxTokens < 1)
|
|
13
|
+
throw new RangeError("maxTokens must be a safe integer >= 1");
|
|
14
|
+
const reserve = options.responseReserveTokens ?? 0;
|
|
15
|
+
if (!Number.isSafeInteger(reserve) || reserve < 0 || reserve >= options.maxTokens)
|
|
16
|
+
throw new RangeError("responseReserveTokens must be >= 0 and lower than maxTokens");
|
|
17
|
+
this.budget = options.maxTokens - reserve;
|
|
18
|
+
this.now = options.now ?? Date.now;
|
|
19
|
+
this.onEvent = options.onEvent;
|
|
20
|
+
}
|
|
21
|
+
upsert(item) {
|
|
22
|
+
const tokenCost = item.tokenCost ?? estimateContextTokens(item.content);
|
|
23
|
+
if (!Number.isSafeInteger(tokenCost) || tokenCost < 1)
|
|
24
|
+
throw new RangeError(`context item "${item.id}" has invalid tokenCost`);
|
|
25
|
+
this.items.set(item.id, { ...item, tokenCost });
|
|
26
|
+
this.emit({ kind: "context_added", itemId: item.id, source: item.source });
|
|
27
|
+
}
|
|
28
|
+
remove(id) {
|
|
29
|
+
const item = this.items.get(id);
|
|
30
|
+
if (!item)
|
|
31
|
+
return;
|
|
32
|
+
this.items.delete(id);
|
|
33
|
+
this.emit({ kind: "context_removed", itemId: id, source: item.source });
|
|
34
|
+
}
|
|
35
|
+
expire(now = this.now()) {
|
|
36
|
+
const removed = [];
|
|
37
|
+
for (const [id, item] of this.items) {
|
|
38
|
+
if (item.expiresAt !== undefined && item.expiresAt <= now && !item.pinned) {
|
|
39
|
+
this.items.delete(id);
|
|
40
|
+
removed.push(id);
|
|
41
|
+
this.emit({ kind: "context_expired", itemId: id, source: item.source });
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return removed;
|
|
45
|
+
}
|
|
46
|
+
select(now = this.now()) {
|
|
47
|
+
this.expire(now);
|
|
48
|
+
const selected = this.selectWithoutEvents();
|
|
49
|
+
this.emit({ kind: "context_selected" });
|
|
50
|
+
return selected;
|
|
51
|
+
}
|
|
52
|
+
snapshot(now = this.now()) {
|
|
53
|
+
this.expire(now);
|
|
54
|
+
const items = [...this.items.values()];
|
|
55
|
+
const selected = this.select(now);
|
|
56
|
+
const usedTokens = selected.reduce((sum, item) => sum + (item.tokenCost ?? estimateContextTokens(item.content)), 0);
|
|
57
|
+
return {
|
|
58
|
+
items,
|
|
59
|
+
selected,
|
|
60
|
+
usedTokens,
|
|
61
|
+
availableTokens: Math.max(0, this.budget - usedTokens),
|
|
62
|
+
fingerprint: this.fingerprint(now),
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
fingerprint(now = this.now()) {
|
|
66
|
+
this.expire(now);
|
|
67
|
+
return this.fingerprintOf(this.selectWithoutEvents());
|
|
68
|
+
}
|
|
69
|
+
selectWithoutEvents() {
|
|
70
|
+
const candidates = [...this.items.values()].sort((left, right) => Number(Boolean(right.pinned)) - Number(Boolean(left.pinned))
|
|
71
|
+
|| right.priority - left.priority
|
|
72
|
+
|| (right.confidence ?? 0) - (left.confidence ?? 0)
|
|
73
|
+
|| left.id.localeCompare(right.id));
|
|
74
|
+
const selected = [];
|
|
75
|
+
let usedTokens = 0;
|
|
76
|
+
for (const item of candidates) {
|
|
77
|
+
const cost = item.tokenCost ?? estimateContextTokens(item.content);
|
|
78
|
+
if (usedTokens + cost > this.budget && !item.pinned)
|
|
79
|
+
continue;
|
|
80
|
+
selected.push(item);
|
|
81
|
+
usedTokens += cost;
|
|
82
|
+
}
|
|
83
|
+
return selected;
|
|
84
|
+
}
|
|
85
|
+
emit(event) {
|
|
86
|
+
try {
|
|
87
|
+
this.onEvent?.({ ...event, fingerprint: this.fingerprintOf(this.selectWithoutEvents()), at: this.now() });
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
// Ledger observers are diagnostic only; a faulty sink must never reject context admission.
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
fingerprintOf(selected) {
|
|
94
|
+
const hash = createHash("sha256");
|
|
95
|
+
for (const item of selected) {
|
|
96
|
+
hash.update(JSON.stringify({
|
|
97
|
+
id: item.id,
|
|
98
|
+
kind: item.kind,
|
|
99
|
+
content: item.content,
|
|
100
|
+
scope: item.scope,
|
|
101
|
+
priority: item.priority,
|
|
102
|
+
tokenCost: item.tokenCost ?? estimateContextTokens(item.content),
|
|
103
|
+
confidence: item.confidence ?? null,
|
|
104
|
+
expiresAt: item.expiresAt ?? null,
|
|
105
|
+
pinned: Boolean(item.pinned),
|
|
106
|
+
source: { type: item.source.type, id: item.source.id ?? null },
|
|
107
|
+
}));
|
|
108
|
+
hash.update("\n");
|
|
109
|
+
}
|
|
110
|
+
return `ctx-${hash.digest("hex")}`;
|
|
111
|
+
}
|
|
112
|
+
}
|
package/dist/runtime/eval.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* The judge is a single LLM call: build the eval prompt → stream → parse verdict. No retry loop,
|
|
10
10
|
* no skill extraction, no loop state. Use `AttemptLoop` if you want the retry/refine flow.
|
|
11
11
|
*/
|
|
12
|
-
import type { LLMProvider,
|
|
12
|
+
import type { LLMProvider, ModelMessage } from "../types.js";
|
|
13
13
|
export interface Criterion {
|
|
14
14
|
/** The criterion text the judge evaluates against. */
|
|
15
15
|
text: string;
|
|
@@ -52,7 +52,7 @@ export interface JudgeArgs {
|
|
|
52
52
|
* Exposed in case a caller wants to render the prompt without calling the LLM (e.g., dry-run cost
|
|
53
53
|
* estimation, fixture generation). For the common case, use `judge()`.
|
|
54
54
|
*/
|
|
55
|
-
export declare function buildEvalMessages(goal: string, criteria: Criterion[], result: string):
|
|
55
|
+
export declare function buildEvalMessages(goal: string, criteria: Criterion[], result: string): ModelMessage[];
|
|
56
56
|
/** Parse a Verdict from raw judge-LLM text. Throws on schema mismatch. */
|
|
57
57
|
export declare function parseVerdict(text: string): Verdict;
|
|
58
58
|
/** The JSON Schema the kernel expects judge output to conform to. */
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { EntropySample,
|
|
1
|
+
import type { EntropySample, ModelMessage, RenderedContext, TaskUpdate, ToolCall, ToolExecutionResult, ToolSchema } from "../types.js";
|
|
2
2
|
import type { SkillMetadata } from "../skills/loader.js";
|
|
3
3
|
import type { RollbackReason } from "./session-log.js";
|
|
4
4
|
export declare const CANONICAL_CONTENT_PARTS_PREFIX = "[[deepstrike-content-parts]]";
|
|
@@ -15,7 +15,7 @@ export interface KernelLoopResult {
|
|
|
15
15
|
termination: string;
|
|
16
16
|
turnsUsed: number;
|
|
17
17
|
totalTokensUsed: number;
|
|
18
|
-
finalMessage?:
|
|
18
|
+
finalMessage?: ModelMessage;
|
|
19
19
|
/** ③ loop-agent: the kernel-adjudicated after-round decision (absent on non-loop runs). */
|
|
20
20
|
paceDecision?: PaceDecision;
|
|
21
21
|
}
|
|
@@ -76,7 +76,7 @@ export type KernelRunnerAction = {
|
|
|
76
76
|
} | {
|
|
77
77
|
kind: "archive_page_out";
|
|
78
78
|
effectId: string;
|
|
79
|
-
archived?:
|
|
79
|
+
archived?: ModelMessage[];
|
|
80
80
|
handleId?: string;
|
|
81
81
|
payload?: {
|
|
82
82
|
content: string;
|
|
@@ -213,7 +213,7 @@ export declare function archivePresentationFromObservations(observations: readon
|
|
|
213
213
|
};
|
|
214
214
|
export declare function toolSchemaToKernel(schema: ToolSchema): Record<string, unknown>;
|
|
215
215
|
export declare function skillMetadataToKernel(skill: SkillMetadata): Record<string, unknown>;
|
|
216
|
-
export declare function messageToKernelMessage(message:
|
|
216
|
+
export declare function messageToKernelMessage(message: ModelMessage): Record<string, unknown>;
|
|
217
217
|
export declare function toolResultToKernel(result: ToolExecutionResult): Record<string, unknown>;
|
|
218
218
|
export declare function taskUpdateToKernel(update: TaskUpdate): Record<string, unknown>;
|
|
219
219
|
export declare function capabilityTool(schema: ToolSchema): Record<string, unknown>;
|
|
@@ -223,5 +223,5 @@ export declare function capabilityCommandMount(capability: Record<string, unknow
|
|
|
223
223
|
export declare function capabilityCommandUnmount(capabilityKind: string, id: string): Record<string, unknown>;
|
|
224
224
|
/** Camel-case an `entropy_sample` kernel observation into the SDK's `EntropySample`. */
|
|
225
225
|
export declare function entropySampleFromObservation(obs: KernelObservation): EntropySample;
|
|
226
|
-
export declare function kernelMessageToSdk(raw: Record<string, unknown>):
|
|
226
|
+
export declare function kernelMessageToSdk(raw: Record<string, unknown>): ModelMessage;
|
|
227
227
|
export declare function renderedContextToSdk(raw: Record<string, unknown>): RenderedContext;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import type { LLMProvider,
|
|
1
|
+
import type { LLMProvider, ModelMessage, ProviderDescriptor, ProviderReplay, RenderedContext, ReplayabilityAssessment, ToolCall } from "../types.js";
|
|
2
2
|
import type { SessionEvent } from "./session-log.js";
|
|
3
3
|
export declare class ProviderReplayProtocolMismatchError extends Error {
|
|
4
4
|
readonly code: "provider_replay_protocol_mismatch";
|
|
5
5
|
constructor(provider: string, storedProtocol: string, resolvedProtocol: string);
|
|
6
6
|
}
|
|
7
|
-
export declare function assistantReplayKey(message: Pick<
|
|
7
|
+
export declare function assistantReplayKey(message: Pick<ModelMessage, "content" | "toolCalls">): string;
|
|
8
8
|
/**
|
|
9
9
|
* A stored replay may only be seeded into a provider speaking the same wire
|
|
10
10
|
* protocol. On a cross-protocol fallback (provider A -> provider B) the
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** Runtime subpath: host execution primitives intentionally outside the root quick-start API. */
|
|
2
|
+
export { RuntimeRunner, collectText } from "./runner.js";
|
|
3
|
+
export { ContextManager, estimateContextTokens } from "./context-manager.js";
|
|
4
|
+
export type { ContextItem, ContextItemKind, ContextItemScope, ContextLedgerEvent, ContextLedgerEventKind, ContextManagerOptions, ContextSnapshot, } from "./context-manager.js";
|
|
5
|
+
export type { RuntimeOptions } from "./runner.js";
|
|
6
|
+
export { runAgent, runFanout } from "./facade.js";
|
|
7
|
+
export type { RunAgentOptions, RunFanoutOptions } from "./facade.js";
|
|
8
|
+
export { InMemorySessionLog, FileSessionLog } from "./session-log.js";
|
|
9
|
+
export type { SessionLog, SessionEvent, SessionEventKind } from "./session-log.js";
|
|
10
|
+
export { projectAgentRun, projectAgentContext, projectAgentCapabilities, projectAgentGovernance, projectAgentDelegation } from "../agent-ir.js";
|
|
11
|
+
export type { AgentDescriptor } from "../agent-ir.js";
|
|
12
|
+
export { FileKernelJournal, InMemoryKernelJournal, JournalCasConflictError, JournalIntegrityError, JournalIoError, } from "./kernel-journal.js";
|
|
13
|
+
export type { CheckpointCandidate, InstalledCheckpoint, JournalAppendReceipt, JournalEntry, JournalHead, JournalPruneReceipt, JournalRecordInput, KernelJournal, } from "./kernel-journal.js";
|
|
14
|
+
export { diagnoseKernelJournal } from "./kernel-doctor.js";
|
|
15
|
+
export type { KernelJournalDiagnosis } from "./kernel-doctor.js";
|
|
16
|
+
export type { ContextPrepared } from "./context.js";
|
|
17
|
+
export { createContextPreparationAdapter, createNativeContextPreparationAdapter } from "./context.js";
|
|
18
|
+
export type { ContextPrepareJson, ContextVerifyJson, ContextProviderPreparationRequest } from "./context.js";
|
|
19
|
+
export { createEvolutionRuntimeAdapter, createNativeEvolutionRuntimeAdapter, EvolutionRuntime } from "./evolution.js";
|
|
20
|
+
export type { EvolutionStore } from "./evolution.js";
|
|
21
|
+
export { FULL_FOOTPRINT_USAGE_ACCOUNTING_POLICY, providerAttemptToRecord } from "./execution-evidence.js";
|
|
22
|
+
export type { InvocationOutcome, ModelInvocation, ProviderAttempt, ProviderAttemptRecord, ProviderAttemptStatus, UsageAccountingPolicy, ModelUsageSettlement } from "./execution-evidence.js";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/** Runtime subpath: host execution primitives intentionally outside the root quick-start API. */
|
|
2
|
+
export { RuntimeRunner, collectText } from "./runner.js";
|
|
3
|
+
export { ContextManager, estimateContextTokens } from "./context-manager.js";
|
|
4
|
+
export { runAgent, runFanout } from "./facade.js";
|
|
5
|
+
export { InMemorySessionLog, FileSessionLog } from "./session-log.js";
|
|
6
|
+
export { projectAgentRun, projectAgentContext, projectAgentCapabilities, projectAgentGovernance, projectAgentDelegation } from "../agent-ir.js";
|
|
7
|
+
export { FileKernelJournal, InMemoryKernelJournal, JournalCasConflictError, JournalIntegrityError, JournalIoError, } from "./kernel-journal.js";
|
|
8
|
+
export { diagnoseKernelJournal } from "./kernel-doctor.js";
|
|
9
|
+
export { createContextPreparationAdapter, createNativeContextPreparationAdapter } from "./context.js";
|
|
10
|
+
export { createEvolutionRuntimeAdapter, createNativeEvolutionRuntimeAdapter, EvolutionRuntime } from "./evolution.js";
|
|
11
|
+
export { FULL_FOOTPRINT_USAGE_ACCOUNTING_POLICY, providerAttemptToRecord } from "./execution-evidence.js";
|
|
@@ -6,13 +6,13 @@
|
|
|
6
6
|
* pulls the assistant turns in order, so the fixture is just "a prior session log + the messages
|
|
7
7
|
* the LLM produced". No new on-disk format.
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
9
|
+
import type { ModelMessage } from "../types.js";
|
|
10
10
|
import type { SessionEvent } from "./session-log.js";
|
|
11
11
|
/**
|
|
12
12
|
* Extract the ordered list of assistant Messages from a recorded session log.
|
|
13
13
|
*
|
|
14
14
|
* Walks `llm_completed` events (which is what the runner appends for every LLM call) and produces
|
|
15
|
-
* one
|
|
15
|
+
* one ModelMessage per event. Pass the result directly to `new ReplayProvider(messages)`.
|
|
16
16
|
*
|
|
17
17
|
* Accepts both wire shapes the SDK uses interchangeably:
|
|
18
18
|
* - in-memory: `{ toolCalls }` (camelCase)
|
|
@@ -23,4 +23,4 @@ import type { SessionEvent } from "./session-log.js";
|
|
|
23
23
|
*/
|
|
24
24
|
export declare function extractRecordedMessages(events: Array<{
|
|
25
25
|
event: SessionEvent;
|
|
26
|
-
} | SessionEvent>):
|
|
26
|
+
} | SessionEvent>): ModelMessage[];
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* Extract the ordered list of assistant Messages from a recorded session log.
|
|
11
11
|
*
|
|
12
12
|
* Walks `llm_completed` events (which is what the runner appends for every LLM call) and produces
|
|
13
|
-
* one
|
|
13
|
+
* one ModelMessage per event. Pass the result directly to `new ReplayProvider(messages)`.
|
|
14
14
|
*
|
|
15
15
|
* Accepts both wire shapes the SDK uses interchangeably:
|
|
16
16
|
* - in-memory: `{ toolCalls }` (camelCase)
|