@xiaozhiclaw/qlogicagent-core 0.4.1 → 0.6.0
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 +85 -5
- package/dist/index.js +10 -10
- package/dist/types/contracts/chat.d.ts +8 -21
- package/dist/types/contracts/tool-execution-evidence.d.ts +3 -2
- package/dist/types/contracts/turn-config.d.ts +26 -0
- package/dist/types/contracts/turn-event.d.ts +2 -1
- package/dist/types/contracts/usage.d.ts +2 -2
- package/dist/types/embedded/business-contracts.d.ts +6 -39
- package/dist/types/embedded/business-tool-adapter.d.ts +37 -0
- package/dist/types/embedded/cloud-agent.d.ts +7 -0
- package/dist/types/embedded/cloud-task.d.ts +4 -2
- package/dist/types/embedded/content-blocks.d.ts +7 -105
- package/dist/types/embedded/context-projection.d.ts +3 -0
- package/dist/types/embedded/contracts.d.ts +21 -1
- package/dist/types/embedded/index.d.ts +6 -3
- package/dist/types/runtime/ports/model-transport-contracts.d.ts +3 -1
- package/package.json +1 -1
- package/dist/types/agent/types.d.ts +0 -164
- package/dist/types/runtime/ports/agent-runtime-ports.d.ts +0 -67
- package/dist/types/runtime/ports/index.d.ts +0 -5
- package/dist/types/runtime/ports/tool-call-contracts.d.ts +0 -20
|
@@ -35,7 +35,7 @@ export interface ContextEnvelope {
|
|
|
35
35
|
itemId: string;
|
|
36
36
|
anchors: ContextAnchor[];
|
|
37
37
|
}
|
|
38
|
-
/**
|
|
38
|
+
/** Transport-supplied signed reasoning, preserved for subsequent model rounds. */
|
|
39
39
|
export interface ThinkingBlock {
|
|
40
40
|
thinking: string;
|
|
41
41
|
signature: string;
|
|
@@ -68,11 +68,11 @@ export interface ChatMessage {
|
|
|
68
68
|
name?: string;
|
|
69
69
|
/** Tool-result error flag propagated so every transport can signal failure to the model. */
|
|
70
70
|
is_error?: boolean;
|
|
71
|
-
/**
|
|
71
|
+
/** Transport-supplied reasoning carried across tool-call rounds. */
|
|
72
72
|
reasoning_content?: string;
|
|
73
|
-
/**
|
|
73
|
+
/** Transport-supplied result references. */
|
|
74
74
|
toolReferences?: string[];
|
|
75
|
-
/**
|
|
75
|
+
/** Original signed reasoning, passed back unchanged through the transport. */
|
|
76
76
|
thinkingBlocks?: ThinkingBlock[];
|
|
77
77
|
/** Image URLs for vision-capable models. */
|
|
78
78
|
imageUrls?: string[];
|
|
@@ -86,14 +86,9 @@ export interface ChatMessage {
|
|
|
86
86
|
mcpIsError?: boolean;
|
|
87
87
|
/** Image detail level: 'auto' | 'low' | 'high' | 'xhigh'. */
|
|
88
88
|
imageDetail?: "auto" | "low" | "high" | "xhigh";
|
|
89
|
-
/** Max image pixels budget (Volcengine image_pixel_limit). */
|
|
90
|
-
imagePixelLimit?: {
|
|
91
|
-
minPixels?: number;
|
|
92
|
-
maxPixels?: number;
|
|
93
|
-
};
|
|
94
89
|
/** Video URLs for video-understanding models. */
|
|
95
90
|
videoUrls?: string[];
|
|
96
|
-
/**
|
|
91
|
+
/** Sampling hint interpreted and validated by the injected transport. */
|
|
97
92
|
videoFps?: number;
|
|
98
93
|
/** Audio format hint: 'mp3' | 'wav' | 'aac' | 'm4a'. */
|
|
99
94
|
audioFormat?: "mp3" | "wav" | "aac" | "m4a";
|
|
@@ -105,17 +100,9 @@ export interface ChatMessage {
|
|
|
105
100
|
mimeType?: string;
|
|
106
101
|
size?: number;
|
|
107
102
|
}>;
|
|
108
|
-
/** UI-facing structured blocks persisted with transcripts; ignored by model transports. */
|
|
109
|
-
blocks?: Array<Record<string, unknown>>;
|
|
110
|
-
/**
|
|
111
|
-
* Structured attachment entries (product UI: element/browserView/file/image/…),
|
|
112
|
-
* persisted with the transcript and surfaced to the UI as chips. Opaque to the agent and ignored
|
|
113
|
-
* by model transports — the model-facing context is derived product-side and appended transiently
|
|
114
|
-
* to the LLM message, never stored here.
|
|
115
|
-
*/
|
|
116
|
-
attachmentEntries?: Array<Record<string, unknown>>;
|
|
117
103
|
}
|
|
118
|
-
|
|
104
|
+
/** Product vocabulary; Core neither classifies tools nor restricts new categories. */
|
|
105
|
+
export type ToolCapabilityCategory = string;
|
|
119
106
|
export interface LocalizedToolText {
|
|
120
107
|
key: string;
|
|
121
108
|
fallback: string;
|
|
@@ -129,7 +116,7 @@ export interface ToolIdentity {
|
|
|
129
116
|
schemaVersion: 1;
|
|
130
117
|
wireName: string;
|
|
131
118
|
logicalName: string;
|
|
132
|
-
family:
|
|
119
|
+
family: string;
|
|
133
120
|
owner: "product";
|
|
134
121
|
serverId?: string;
|
|
135
122
|
capabilityId: string;
|
|
@@ -3,11 +3,12 @@ export interface ToolCallExecutionEvidence {
|
|
|
3
3
|
sequence: number;
|
|
4
4
|
callId: string;
|
|
5
5
|
name: string;
|
|
6
|
-
identity
|
|
6
|
+
/** Product-authored identity only; absence is not inferred from a wire name. */
|
|
7
|
+
identity?: ToolIdentity;
|
|
7
8
|
status: "running" | "succeeded" | "failed" | "blocked";
|
|
8
9
|
arguments?: string;
|
|
9
10
|
error?: string;
|
|
10
|
-
failureKind?: "policy_blocked" | "
|
|
11
|
+
failureKind?: "policy_blocked" | "tool_execution_failed";
|
|
11
12
|
}
|
|
12
13
|
export declare function classifyToolFailureKind(result: {
|
|
13
14
|
blocked?: boolean;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Execution and model controls supplied by the SaaS product. Credentials belong to its injected transport. */
|
|
2
|
+
export interface TurnConfig {
|
|
3
|
+
model?: string;
|
|
4
|
+
/** Undefined means no Core-imposed round ceiling. */
|
|
5
|
+
maxRounds?: number;
|
|
6
|
+
temperature?: number;
|
|
7
|
+
contextWindowTokens?: number;
|
|
8
|
+
maxOutputTokens?: number;
|
|
9
|
+
toolChoice?: "auto" | "none" | "required";
|
|
10
|
+
/** Zero or undefined uses maxRounds. */
|
|
11
|
+
maxTurns?: number;
|
|
12
|
+
/** Zero permits unlimited concurrent tool execution. */
|
|
13
|
+
maxConcurrentTools?: number;
|
|
14
|
+
streamRequired?: boolean;
|
|
15
|
+
reasoning?: {
|
|
16
|
+
effort: "auto" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
17
|
+
includeEncryptedReasoning?: boolean;
|
|
18
|
+
};
|
|
19
|
+
promptCacheKey?: string;
|
|
20
|
+
promptCacheRetention?: "in_memory" | "24h";
|
|
21
|
+
serviceTier?: "auto" | "default" | "flex" | "priority";
|
|
22
|
+
/** Executable calls accepted from one model response; resets each round. */
|
|
23
|
+
maxToolCalls?: number;
|
|
24
|
+
parallelToolCalls?: boolean;
|
|
25
|
+
textVerbosity?: "low" | "medium" | "high";
|
|
26
|
+
}
|
|
@@ -21,13 +21,14 @@ export type TurnEvent = {
|
|
|
21
21
|
name: string;
|
|
22
22
|
displayName?: string;
|
|
23
23
|
arguments: string;
|
|
24
|
-
inputSummary?: string;
|
|
25
24
|
} | {
|
|
26
25
|
type: "end";
|
|
27
26
|
turnId: string;
|
|
28
27
|
content: string;
|
|
29
28
|
/** Adapter lifecycle only; it is not a semantic task-success claim. */
|
|
30
29
|
turnStatus?: "completed" | "stopped";
|
|
30
|
+
/** Product-requested pause at a durable model-ready boundary. */
|
|
31
|
+
stopReason?: "paused";
|
|
31
32
|
/** Task success remains unverified unless a higher-level product workflow proves it. */
|
|
32
33
|
taskOutcome?: "unverified";
|
|
33
34
|
usage?: WireTokenUsage;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export type WireUsageSource =
|
|
1
|
+
/** Opaque provenance supplied by the product transport, not a Core billing classification. */
|
|
2
|
+
export type WireUsageSource = string;
|
|
3
3
|
export interface WireUsageRecord {
|
|
4
4
|
schemaVersion: 1;
|
|
5
5
|
source: WireUsageSource;
|
|
@@ -1,43 +1,10 @@
|
|
|
1
1
|
import type { ToolDefinition } from "./contracts.js";
|
|
2
|
-
/**
|
|
2
|
+
/** Product-owned context. Core does not require any particular domain, resources or roles. */
|
|
3
3
|
export interface BusinessAssistantContext {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
operations: Array<{
|
|
9
|
-
id: string;
|
|
10
|
-
description: string;
|
|
11
|
-
prerequisites: string[];
|
|
12
|
-
}>;
|
|
13
|
-
};
|
|
14
|
-
enterprise: {
|
|
15
|
-
configurationRevision: string;
|
|
16
|
-
configuration: Record<string, unknown>;
|
|
17
|
-
dataSources: Array<{
|
|
18
|
-
id: string;
|
|
19
|
-
state: "ready" | "missing" | "unavailable";
|
|
20
|
-
reference?: string;
|
|
21
|
-
}>;
|
|
22
|
-
};
|
|
23
|
-
employee: {
|
|
24
|
-
permissionRevision: string;
|
|
25
|
-
allowedOperations: string[];
|
|
26
|
-
};
|
|
27
|
-
knowledge: {
|
|
28
|
-
revision: string;
|
|
29
|
-
skill: string;
|
|
30
|
-
examples: Array<{
|
|
31
|
-
operation: string;
|
|
32
|
-
input: string;
|
|
33
|
-
expectedOutcome: string;
|
|
34
|
-
evidenceReference: string;
|
|
35
|
-
}>;
|
|
36
|
-
exceptions: Array<{
|
|
37
|
-
code: string;
|
|
38
|
-
handling: string;
|
|
39
|
-
}>;
|
|
40
|
-
};
|
|
4
|
+
/** Explicit trusted instructions from the product; no other context field becomes a system instruction. */
|
|
5
|
+
instructions?: string;
|
|
6
|
+
/** JSON-serializable facts, revisions and references whose names and meanings belong to the product. */
|
|
7
|
+
[section: string]: unknown;
|
|
41
8
|
}
|
|
42
9
|
export interface BusinessGoal {
|
|
43
10
|
id: string;
|
|
@@ -64,7 +31,7 @@ export interface BusinessGoalEvidence {
|
|
|
64
31
|
export interface BusinessGoalOutcome extends BusinessGoalEvidence {
|
|
65
32
|
status: "satisfied" | "incomplete";
|
|
66
33
|
}
|
|
67
|
-
/**
|
|
34
|
+
/** Check only the transport shape; product validation and authorization stay outside Core. */
|
|
68
35
|
export declare function validateBusinessAssistantContext(value: BusinessAssistantContext, tools: ToolDefinition[]): void;
|
|
69
36
|
export declare function validateBusinessGoal(goal: BusinessGoal): void;
|
|
70
37
|
export declare function verifyBusinessGoalEvidence(goal: BusinessGoal, evidence: BusinessGoalEvidence): BusinessGoalOutcome;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { ToolResult } from "./contracts.js";
|
|
2
|
+
import { type CloudToolInvocation, type CloudToolWait } from "./cloud-agent.js";
|
|
3
|
+
/** External job state is supplied by its product owner; Core owns no job queue or polling policy. */
|
|
4
|
+
export type BusinessToolObservation = {
|
|
5
|
+
kind: "result";
|
|
6
|
+
result: ToolResult;
|
|
7
|
+
} | {
|
|
8
|
+
kind: "pending";
|
|
9
|
+
reference: string;
|
|
10
|
+
progress?: Record<string, unknown>;
|
|
11
|
+
resources?: string[];
|
|
12
|
+
} | {
|
|
13
|
+
kind: "unknown";
|
|
14
|
+
reference: string;
|
|
15
|
+
detail?: string;
|
|
16
|
+
};
|
|
17
|
+
export interface BusinessToolPort {
|
|
18
|
+
/** Persist/deduplicate by the complete original invocation before acknowledging a job.
|
|
19
|
+
* Forward invocation.taskBudget unchanged to every paid generation endpoint.
|
|
20
|
+
*/
|
|
21
|
+
submit(invocation: Readonly<CloudToolInvocation>, signal?: AbortSignal): Promise<BusinessToolObservation>;
|
|
22
|
+
/** Query the original invocation only. Absence/unknown is never permission to submit again. */
|
|
23
|
+
query(invocation: Readonly<CloudToolInvocation>, signal?: AbortSignal): Promise<BusinessToolObservation>;
|
|
24
|
+
/** Product cancellation is a request, not proof that a job or its charge did not execute. */
|
|
25
|
+
cancel?(invocation: Readonly<CloudToolInvocation>, signal?: AbortSignal): Promise<BusinessToolObservation>;
|
|
26
|
+
}
|
|
27
|
+
export interface BusinessToolAdapter {
|
|
28
|
+
invoke(invocation: CloudToolInvocation, signal?: AbortSignal): Promise<ToolResult | CloudToolWait>;
|
|
29
|
+
/** Resume an external wait or reconcile an interrupted submission by querying its original operation. */
|
|
30
|
+
resolve(invocation: CloudToolInvocation, signal?: AbortSignal): Promise<ToolResult | CloudToolWait>;
|
|
31
|
+
cancel(invocation: CloudToolInvocation, signal?: AbortSignal): Promise<ToolResult | CloudToolWait>;
|
|
32
|
+
}
|
|
33
|
+
export declare function createBusinessToolAdapter(options: {
|
|
34
|
+
port: BusinessToolPort;
|
|
35
|
+
/** Durable product progress/resource projection. Awaited before acknowledging any observation. */
|
|
36
|
+
observe?(invocation: Readonly<CloudToolInvocation>, observation: Readonly<BusinessToolObservation>): Promise<void>;
|
|
37
|
+
}): BusinessToolAdapter;
|
|
@@ -5,7 +5,9 @@ import { type AgentContentBlock } from "./content-blocks.js";
|
|
|
5
5
|
import type { CreateEmbeddedAgentOptions, ToolResult, TurnCheckpoint, TurnEvent, TurnRequest, LLMRequest } from "./contracts.js";
|
|
6
6
|
export interface CloudExecutionContext {
|
|
7
7
|
applicationId: string;
|
|
8
|
+
/** Opaque product data namespace, such as a personal workspace; it need not represent an organization. */
|
|
8
9
|
tenantId: string;
|
|
10
|
+
/** Product-defined user or service identity; Core does not require an employee role. */
|
|
9
11
|
actorId: string;
|
|
10
12
|
scopeId: string;
|
|
11
13
|
definitionVersion: string;
|
|
@@ -58,6 +60,8 @@ export type CloudTurnEvent = TurnEvent | {
|
|
|
58
60
|
export interface CloudToolReceipt {
|
|
59
61
|
invocation: CloudToolInvocation;
|
|
60
62
|
result: ToolResult;
|
|
63
|
+
/** Original wait identity, retained in the same receipt for lost-acknowledgement recovery. */
|
|
64
|
+
wait?: CloudToolWait["wait"];
|
|
61
65
|
}
|
|
62
66
|
/** Only the product may supply reconciled receipts; this function never executes tools. */
|
|
63
67
|
export declare function completeCloudToolCheckpoint(input: CloudCheckpoint, receipts: CloudToolReceipt[]): CloudCheckpoint;
|
|
@@ -77,6 +81,9 @@ export interface CloudAgentOptions extends Omit<CreateEmbeddedAgentOptions, "too
|
|
|
77
81
|
checkpoints?: {
|
|
78
82
|
save(checkpoint: CloudCheckpoint): Promise<void>;
|
|
79
83
|
};
|
|
84
|
+
/** Product-owned pause intent. Checked after saving a safe model-ready boundary;
|
|
85
|
+
* an in-flight inference or atomic tool operation is never interrupted as a pause. */
|
|
86
|
+
shouldPause?(context: Readonly<CloudExecutionContext>, checkpoint: Readonly<CloudCheckpoint>): Promise<boolean>;
|
|
80
87
|
/** Awaited before a successful result is acknowledged or another model step starts. */
|
|
81
88
|
onToolResult?(invocation: CloudToolInvocation, result: ToolResult): Promise<void>;
|
|
82
89
|
onWait?(invocation: CloudToolInvocation, wait: CloudToolWait["wait"]): Promise<void>;
|
|
@@ -82,8 +82,8 @@ export interface CloudTaskRuntimeOptions {
|
|
|
82
82
|
resolveGoal?(task: CloudTaskSnapshot): Promise<BusinessGoal | undefined>;
|
|
83
83
|
/** Feed independently checked evidence back through the same loop; no separate correction runner. */
|
|
84
84
|
goalFeedback?(task: CloudTaskSnapshot, outcome: BusinessGoalOutcome): Promise<ChatMessage[]>;
|
|
85
|
-
authorize(context: CloudExecutionContext, action: "create" | "read" | "execute" | "cancel" | "complete_wait" | "recover" | "append_input"): Promise<void>;
|
|
86
|
-
/** Validate
|
|
85
|
+
authorize(context: CloudExecutionContext, action: "create" | "read" | "execute" | "cancel" | "complete_wait" | "recover" | "append_input" | "resume"): Promise<void>;
|
|
86
|
+
/** Validate product-authorized approval/input or query the original external job; never trust browser results. */
|
|
87
87
|
authorizeCompletion(task: CloudTaskSnapshot, waitId: string, result: ToolResult): Promise<void>;
|
|
88
88
|
/** Required for interrupted model calls or unresolved effects. The product proves billing/retry safety. */
|
|
89
89
|
authorizeRecovery?(task: CloudTaskSnapshot, receipts: CloudToolReceipt[]): Promise<ModelRecoveryProof[] | void>;
|
|
@@ -101,6 +101,8 @@ export interface CloudTaskRuntime {
|
|
|
101
101
|
/** Called by the existing product worker, independently from browser subscriptions. */
|
|
102
102
|
execute(context: CloudExecutionContext, id: string, workerSignal?: AbortSignal): Promise<void>;
|
|
103
103
|
cancel(context: CloudExecutionContext, id: string): Promise<CloudTaskSnapshot>;
|
|
104
|
+
/** Resume a durable pause without a new user input, identity or budget. */
|
|
105
|
+
resume(context: CloudExecutionContext, id: string): Promise<CloudTaskSnapshot>;
|
|
104
106
|
/** Continue a resolved task on explicit user input, preserving its identity and original budgets. */
|
|
105
107
|
appendInput(context: CloudExecutionContext, id: string, input: {
|
|
106
108
|
id: string;
|
|
@@ -1,111 +1,13 @@
|
|
|
1
|
-
/**
|
|
2
|
-
export
|
|
3
|
-
export type AgentEngineeringFormat = "dxf" | "dwg" | "step" | "stp" | "glb" | "gltf";
|
|
4
|
-
export type AgentEngineeringPreviewMode = "direct" | "browser_conversion" | "external_conversion_required";
|
|
5
|
-
export type AgentEngineeringParseStatus = "parsed" | "partial" | "conversion_required";
|
|
6
|
-
export interface AgentEngineeringMetadata {
|
|
7
|
-
format: AgentEngineeringFormat;
|
|
8
|
-
previewMode: AgentEngineeringPreviewMode;
|
|
9
|
-
parseStatus: AgentEngineeringParseStatus;
|
|
10
|
-
summary: string;
|
|
11
|
-
}
|
|
12
|
-
export type AgentAttachmentKind = "image" | "spreadsheet" | "presentation" | "document" | "engineering_2d" | "engineering_3d" | "file";
|
|
13
|
-
export interface AgentAttachment {
|
|
14
|
-
id: string;
|
|
15
|
-
kind: AgentAttachmentKind;
|
|
16
|
-
fileName: string;
|
|
17
|
-
mimeType: string;
|
|
18
|
-
byteSize: number;
|
|
19
|
-
downloadUrl: string;
|
|
20
|
-
expiresAt: string;
|
|
21
|
-
note: string;
|
|
22
|
-
engineering: AgentEngineeringMetadata | null;
|
|
23
|
-
}
|
|
24
|
-
export interface AgentInputAttachmentEvidence {
|
|
25
|
-
id: string;
|
|
26
|
-
kind: "engineering_2d" | "engineering_3d" | "file";
|
|
27
|
-
fileName: string;
|
|
28
|
-
mimeType: string;
|
|
29
|
-
byteSize: number;
|
|
30
|
-
engineering: AgentEngineeringMetadata | null;
|
|
31
|
-
extractedText: string;
|
|
32
|
-
}
|
|
33
|
-
export interface AgentAttachmentContentBlock {
|
|
34
|
-
id: string;
|
|
35
|
-
type: "attachment";
|
|
36
|
-
attachment: AgentAttachment;
|
|
37
|
-
}
|
|
38
|
-
export interface AgentChoiceContentBlock {
|
|
1
|
+
/** Product-defined presentation payload. Core only owns its transport identity. */
|
|
2
|
+
export interface AgentContentBlock {
|
|
39
3
|
id: string;
|
|
40
|
-
type:
|
|
41
|
-
|
|
42
|
-
selection: "single" | "multiple";
|
|
43
|
-
options: Array<{
|
|
44
|
-
id: string;
|
|
45
|
-
label: string;
|
|
46
|
-
description: string;
|
|
47
|
-
}>;
|
|
48
|
-
required: boolean;
|
|
49
|
-
minSelections: number;
|
|
50
|
-
maxSelections: number;
|
|
51
|
-
submitLabel: string;
|
|
4
|
+
type: string;
|
|
5
|
+
[key: string]: unknown;
|
|
52
6
|
}
|
|
53
|
-
export type AgentTableCell = string | number | boolean | null;
|
|
54
|
-
export interface AgentTableContentBlock {
|
|
55
|
-
id: string;
|
|
56
|
-
type: "table";
|
|
57
|
-
title: string;
|
|
58
|
-
caption: string;
|
|
59
|
-
columns: Array<{
|
|
60
|
-
key: string;
|
|
61
|
-
label: string;
|
|
62
|
-
align: "start" | "center" | "end";
|
|
63
|
-
}>;
|
|
64
|
-
rows: Array<Record<string, AgentTableCell>>;
|
|
65
|
-
}
|
|
66
|
-
export interface AgentDiagramContentBlock {
|
|
67
|
-
id: string;
|
|
68
|
-
type: "diagram";
|
|
69
|
-
title: string;
|
|
70
|
-
direction: "horizontal" | "vertical";
|
|
71
|
-
nodes: Array<{
|
|
72
|
-
id: string;
|
|
73
|
-
label: string;
|
|
74
|
-
description: string;
|
|
75
|
-
tone: "neutral" | "info" | "success" | "warning" | "danger";
|
|
76
|
-
}>;
|
|
77
|
-
edges: Array<{
|
|
78
|
-
from: string;
|
|
79
|
-
to: string;
|
|
80
|
-
label: string;
|
|
81
|
-
}>;
|
|
82
|
-
}
|
|
83
|
-
export type AgentContentBlock = AgentAttachmentContentBlock | AgentChoiceContentBlock | AgentTableContentBlock | AgentDiagramContentBlock;
|
|
84
|
-
export interface StandardPresentationToolDefinition {
|
|
85
|
-
type: "function";
|
|
86
|
-
function: {
|
|
87
|
-
name: StandardPresentationToolName;
|
|
88
|
-
description: string;
|
|
89
|
-
parameters: Record<string, unknown>;
|
|
90
|
-
};
|
|
91
|
-
}
|
|
92
|
-
export declare const standardPresentationToolNames: readonly ["response_present_choice", "response_present_table", "response_present_diagram"];
|
|
93
|
-
export type StandardPresentationToolName = typeof standardPresentationToolNames[number];
|
|
94
|
-
export declare const standardPresentationToolDefinitions: StandardPresentationToolDefinition[];
|
|
95
7
|
export declare class AgentContentBlockValidationError extends Error {
|
|
96
8
|
constructor(message: string);
|
|
97
9
|
}
|
|
10
|
+
/** Check the envelope without interpreting product types, fields or UI constraints. */
|
|
98
11
|
export declare function parseAgentContentBlock(value: unknown): AgentContentBlock;
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
contentBlocks: AgentContentBlock[];
|
|
102
|
-
};
|
|
103
|
-
export interface EngineeringFileAnalysis {
|
|
104
|
-
format: AgentEngineeringFormat;
|
|
105
|
-
status: AgentEngineeringParseStatus;
|
|
106
|
-
previewMode: AgentEngineeringPreviewMode;
|
|
107
|
-
metadata: Record<string, unknown>;
|
|
108
|
-
extractedText: string;
|
|
109
|
-
}
|
|
110
|
-
export declare function isEngineeringFile(fileName: string): boolean;
|
|
111
|
-
export declare function analyzeEngineeringFile(fileName: string, bytes: Uint8Array): EngineeringFileAnalysis | null;
|
|
12
|
+
/** Standard MCP evidence stays in tool receipts; product presentations also reach the result projection. */
|
|
13
|
+
export declare function parsePresentationBlocks(blocks: Array<AgentContentBlock | Record<string, unknown>>): AgentContentBlock[];
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { ChatMessage, EmbeddedRuntimeOptions, ModelContextPreparation, ModelContextProjection } from "./contracts.js";
|
|
2
|
+
/** Reuse the canonical fallback after product retrieval; token estimates are advisory. */
|
|
3
|
+
export declare function prepareSlidingWindowContext(messages: readonly ChatMessage[], context: ModelContextPreparation, countMessageTokens?: EmbeddedRuntimeOptions["countMessageTokens"]): ModelContextProjection;
|
|
@@ -17,7 +17,7 @@ import type { ToolResult } from '../contracts/tool-result.js';
|
|
|
17
17
|
export type { WireUsageRecord as UsageRecord, WireUsageSource as UsageSource } from '../contracts/usage.js';
|
|
18
18
|
export type TokenUsage = import('../contracts/usage.js').WireTokenUsage;
|
|
19
19
|
export type TurnEvent = import('../contracts/turn-event.js').TurnEvent;
|
|
20
|
-
export type TurnConfig =
|
|
20
|
+
export type TurnConfig = import('../contracts/turn-config.js').TurnConfig;
|
|
21
21
|
/** All three must be true on a thrown transport error before core can retry a model request. */
|
|
22
22
|
export interface ModelRetryAuthorization {
|
|
23
23
|
retryable: boolean;
|
|
@@ -49,12 +49,32 @@ export interface TurnRequest {
|
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
51
|
export interface EmbeddedRuntimeOptions {
|
|
52
|
+
/** Product-owned retrieval and model context projection before each inference.
|
|
53
|
+
* Original tool receipts remain complete; checkpoints retain the projected context.
|
|
54
|
+
* Keep task facts and complete tool call/result groups, and honour cancellation.
|
|
55
|
+
*/
|
|
56
|
+
prepareContext?: (messages: readonly ChatMessage[], context: ModelContextPreparation) => Promise<ModelContextProjection>;
|
|
57
|
+
/** Model-aware message measurement; the fallback is an advisory estimate. */
|
|
58
|
+
countMessageTokens?: (message: Readonly<ChatMessage>, model: string) => number;
|
|
52
59
|
/** Product-owned model projection; receipts retain the full result. Return undefined to keep it. */
|
|
53
60
|
projectToolResult?: (message: Readonly<ChatMessage>) => Promise<string | undefined>;
|
|
54
61
|
/** Evidence or new questions supplied by the product before accepting a model's final answer. */
|
|
55
62
|
reviewCompletion?: (messages: readonly ChatMessage[], answer: string) => Promise<ChatMessage[]>;
|
|
56
63
|
onCheckpoint?: (checkpoint: TurnCheckpoint) => Promise<void>;
|
|
57
64
|
}
|
|
65
|
+
export interface ModelContextPreparation {
|
|
66
|
+
model: string;
|
|
67
|
+
/** Context capacity after reserving configured output; Infinity when capacity metadata is disabled. */
|
|
68
|
+
inputBudgetTokens: number;
|
|
69
|
+
sessionId: string;
|
|
70
|
+
turnId: string;
|
|
71
|
+
signal?: AbortSignal;
|
|
72
|
+
}
|
|
73
|
+
export interface ModelContextProjection {
|
|
74
|
+
messages: ChatMessage[];
|
|
75
|
+
droppedCount: number;
|
|
76
|
+
strategy: string;
|
|
77
|
+
}
|
|
58
78
|
export interface TurnCheckpoint {
|
|
59
79
|
turnId: string;
|
|
60
80
|
sessionId: string;
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
export { createEmbeddedAgent } from "./embedded-agent.js";
|
|
2
|
+
export { prepareSlidingWindowContext } from "./context-projection.js";
|
|
2
3
|
export { corePackageVersion } from "./package-version.js";
|
|
3
|
-
export { AgentContentBlockValidationError,
|
|
4
|
-
export type { ContextAnchor, ContextEnvelope, SemanticToolCapability, ToolIdentity, UsageRecord, UsageSource, AgentLogger, ChatMessage, CreateEmbeddedAgentOptions, EmbeddedAgent, EmbeddedRuntimeOptions, LLMChunk, LLMRequest, LLMTransport, ModelRetryAuthorization, ToolDefinition, ToolInvoker, ToolInvocationContext, ToolResult, TurnCheckpoint, TokenUsage, TurnConfig, TurnEvent, TurnRequest, } from "./contracts.js";
|
|
4
|
+
export { AgentContentBlockValidationError, parseAgentContentBlock, } from "./content-blocks.js";
|
|
5
|
+
export type { ContextAnchor, ContextEnvelope, SemanticToolCapability, ToolIdentity, UsageRecord, UsageSource, AgentLogger, ChatMessage, CreateEmbeddedAgentOptions, EmbeddedAgent, EmbeddedRuntimeOptions, ModelContextPreparation, ModelContextProjection, LLMChunk, LLMRequest, LLMTransport, ModelRetryAuthorization, ToolDefinition, ToolInvoker, ToolInvocationContext, ToolResult, TurnCheckpoint, TokenUsage, TurnConfig, TurnEvent, TurnRequest, } from "./contracts.js";
|
|
5
6
|
export type { ModelOperation, ModelRecoveryProof } from "./model-operation.js";
|
|
6
7
|
export type { TaskMonetaryBudget } from "../runtime/ports/model-transport-contracts.js";
|
|
7
8
|
export type { BusinessAssistantContext, BusinessGoal, BusinessGoalEvidence, BusinessGoalOutcome } from "./business-contracts.js";
|
|
9
|
+
export { createBusinessToolAdapter } from "./business-tool-adapter.js";
|
|
10
|
+
export type { BusinessToolAdapter, BusinessToolPort, BusinessToolObservation } from "./business-tool-adapter.js";
|
|
8
11
|
export { createCloudAgent, completeCloudToolCheckpoint, canonicalCloudValue } from "./cloud-agent.js";
|
|
9
12
|
export type { CloudAgent, CloudAgentOptions, CloudCheckpoint, CloudExecutionContext, CloudToolInvocation, CloudToolReceipt, CloudToolWait, CloudTurnEvent, CloudTurnRequest, } from "./cloud-agent.js";
|
|
10
13
|
export { createCloudTaskRuntime } from "./cloud-task.js";
|
|
11
14
|
export type { CloudTaskStore, CloudTaskSnapshot, CloudTaskStatus, CloudTaskClaim, CloudTaskEvent, CloudTaskEventPayload, CloudTaskRuntime, CloudTaskRuntimeOptions, } from "./cloud-task.js";
|
|
12
|
-
export type {
|
|
15
|
+
export type { AgentContentBlock } from "./content-blocks.js";
|
|
@@ -4,7 +4,9 @@ import type { ModelOperation, ModelRecoveryProof } from "../../embedded/model-op
|
|
|
4
4
|
/** Immutable product task ceiling, enforced by the model service's financial authority. */
|
|
5
5
|
export interface TaskMonetaryBudget {
|
|
6
6
|
id: string;
|
|
7
|
-
|
|
7
|
+
/** Currency or accounting unit accepted by the product's financial authority. */
|
|
8
|
+
currency: string;
|
|
9
|
+
/** Positive exact decimal; precision/range are owned by that financial authority. */
|
|
8
10
|
maxAmount: string;
|
|
9
11
|
}
|
|
10
12
|
export interface LLMRequest {
|