@pi-oxide/pi-host-web 0.3.0 → 0.4.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/package.json +36 -5
- package/pi_host_web.d.ts +98 -197
- package/pi_host_web.js +224 -97
- package/pi_host_web_bg.wasm +0 -0
- package/sdk/agent.ts +274 -0
- package/sdk/artifacts.ts +35 -0
- package/sdk/context.ts +4 -0
- package/sdk/errors.ts +24 -0
- package/sdk/events.ts +52 -0
- package/sdk/index.d.ts +17 -39
- package/sdk/index.js +86 -191
- package/sdk/index.ts +53 -0
- package/sdk/init.ts +58 -0
- package/sdk/internal/engine.ts +614 -0
- package/sdk/internal/events.ts +241 -0
- package/sdk/internal/providers/anthropic.ts +440 -0
- package/sdk/internal/providers/openai.ts +177 -0
- package/sdk/internal/providers/types.ts +64 -0
- package/sdk/internal/stores/indexedDb.ts +24 -0
- package/sdk/internal/stores/persistence.ts +71 -0
- package/sdk/internal/tools/artifact.ts +24 -0
- package/sdk/internal/tools/browser.ts +449 -0
- package/sdk/internal/tools/browserRuntime.ts +48 -0
- package/sdk/internal/tools/liveRuntime.ts +151 -0
- package/sdk/internal/tools/registry.ts +174 -0
- package/sdk/internal/tools/service.ts +157 -0
- package/sdk/model.ts +35 -0
- package/sdk/react/index.ts +1 -0
- package/sdk/react/useAgent.ts +334 -0
- package/sdk/snapshot.ts +25 -0
- package/sdk/stores.ts +72 -0
- package/sdk/tools.ts +47 -0
- package/sdk/types.ts +252 -0
package/package.json
CHANGED
|
@@ -5,18 +5,45 @@
|
|
|
5
5
|
"Irving Ou <irving@pi-oxide.dev>"
|
|
6
6
|
],
|
|
7
7
|
"description": "WASM host for pi-core. Browser FileSystem Access API, fetch(), JS event loop.",
|
|
8
|
-
"version": "0.
|
|
8
|
+
"version": "0.4.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
12
|
-
"url": "
|
|
12
|
+
"url": "https://github.com/pi-oxide/pi-oxide"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
15
|
"pi_host_web_bg.wasm",
|
|
16
16
|
"pi_host_web.js",
|
|
17
17
|
"pi_host_web.d.ts",
|
|
18
18
|
"sdk/index.js",
|
|
19
|
-
"sdk/index.d.ts"
|
|
19
|
+
"sdk/index.d.ts",
|
|
20
|
+
"sdk/agent.ts",
|
|
21
|
+
"sdk/artifacts.ts",
|
|
22
|
+
"sdk/context.ts",
|
|
23
|
+
"sdk/errors.ts",
|
|
24
|
+
"sdk/events.ts",
|
|
25
|
+
"sdk/index.ts",
|
|
26
|
+
"sdk/init.ts",
|
|
27
|
+
"sdk/internal/engine.ts",
|
|
28
|
+
"sdk/internal/events.ts",
|
|
29
|
+
"sdk/internal/providers/anthropic.ts",
|
|
30
|
+
"sdk/internal/providers/openai.ts",
|
|
31
|
+
"sdk/internal/providers/types.ts",
|
|
32
|
+
"sdk/internal/stores/indexedDb.ts",
|
|
33
|
+
"sdk/internal/stores/persistence.ts",
|
|
34
|
+
"sdk/internal/tools/artifact.ts",
|
|
35
|
+
"sdk/internal/tools/browser.ts",
|
|
36
|
+
"sdk/internal/tools/browserRuntime.ts",
|
|
37
|
+
"sdk/internal/tools/liveRuntime.ts",
|
|
38
|
+
"sdk/internal/tools/registry.ts",
|
|
39
|
+
"sdk/internal/tools/service.ts",
|
|
40
|
+
"sdk/model.ts",
|
|
41
|
+
"sdk/react/index.ts",
|
|
42
|
+
"sdk/react/useAgent.ts",
|
|
43
|
+
"sdk/snapshot.ts",
|
|
44
|
+
"sdk/stores.ts",
|
|
45
|
+
"sdk/tools.ts",
|
|
46
|
+
"sdk/types.ts"
|
|
20
47
|
],
|
|
21
48
|
"main": "pi_host_web.js",
|
|
22
49
|
"types": "pi_host_web.d.ts",
|
|
@@ -25,13 +52,17 @@
|
|
|
25
52
|
],
|
|
26
53
|
"exports": {
|
|
27
54
|
".": {
|
|
28
|
-
"import": "./sdk/index.
|
|
29
|
-
"types": "./sdk/index.
|
|
55
|
+
"import": "./sdk/index.ts",
|
|
56
|
+
"types": "./sdk/index.ts"
|
|
30
57
|
},
|
|
31
58
|
"./raw": {
|
|
32
59
|
"import": "./pi_host_web.js",
|
|
33
60
|
"types": "./pi_host_web.d.ts"
|
|
34
61
|
},
|
|
62
|
+
"./react": {
|
|
63
|
+
"import": "./sdk/react/index.ts",
|
|
64
|
+
"types": "./sdk/react/index.ts"
|
|
65
|
+
},
|
|
35
66
|
"./package.json": "./package.json"
|
|
36
67
|
}
|
|
37
68
|
}
|
package/pi_host_web.d.ts
CHANGED
|
@@ -10,30 +10,20 @@ export interface AgentOptions {
|
|
|
10
10
|
system_prompt: string;
|
|
11
11
|
model: Model;
|
|
12
12
|
thinking_level?: ThinkingLevel;
|
|
13
|
-
tools?: ToolDefinition[];
|
|
14
13
|
steering_mode?: QueueMode;
|
|
15
14
|
follow_up_mode?: QueueMode;
|
|
16
|
-
tool_execution_mode?:
|
|
15
|
+
tool_execution_mode?: ExecutionMode;
|
|
17
16
|
session_id?: SessionId;
|
|
18
|
-
messages?: AgentMessage[];
|
|
19
|
-
session_state?: SessionState | null;
|
|
20
17
|
}
|
|
21
18
|
|
|
22
|
-
export interface
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
tools: ToolDefinition[];
|
|
27
|
-
messages: AgentMessage[];
|
|
28
|
-
is_streaming: boolean;
|
|
29
|
-
streaming_message?: AgentMessage;
|
|
30
|
-
pending_tool_calls: string[];
|
|
31
|
-
error_message?: string;
|
|
19
|
+
export interface ArtifactSearchResult {
|
|
20
|
+
id: string;
|
|
21
|
+
snippet: string;
|
|
22
|
+
match_count: number;
|
|
32
23
|
}
|
|
33
24
|
|
|
34
|
-
export interface
|
|
35
|
-
|
|
36
|
-
actual_input_tokens: number;
|
|
25
|
+
export interface ArtifactSearchResults {
|
|
26
|
+
results: ArtifactSearchResult[];
|
|
37
27
|
}
|
|
38
28
|
|
|
39
29
|
export interface AssistantMessage {
|
|
@@ -47,49 +37,30 @@ export interface AssistantMessage {
|
|
|
47
37
|
usage: TokenUsage;
|
|
48
38
|
}
|
|
49
39
|
|
|
50
|
-
export interface BranchSummary {
|
|
51
|
-
summary: string;
|
|
52
|
-
details?: JsonSchema;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
40
|
export interface ContextProjectionBudget {
|
|
56
|
-
max_tool_result_chars
|
|
57
|
-
max_context_tokens
|
|
58
|
-
default_preview_chars: number;
|
|
41
|
+
max_tool_result_chars?: number;
|
|
42
|
+
max_context_tokens?: number;
|
|
59
43
|
microcompact_after_turns?: number;
|
|
60
44
|
compaction_threshold?: number;
|
|
61
45
|
}
|
|
62
46
|
|
|
63
|
-
export interface
|
|
64
|
-
|
|
65
|
-
replacements: ContextReplacement[];
|
|
66
|
-
dropped_messages: number;
|
|
67
|
-
needs_compaction?: boolean;
|
|
68
|
-
cache_breakpoints?: number[];
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
export interface ContextProjectionState {
|
|
72
|
-
replacements: Record<string, ContextReplacement>;
|
|
73
|
-
last_api_usage?: ApiUsageSnapshot | null;
|
|
74
|
-
turns_since_compaction?: number;
|
|
47
|
+
export interface CreateHostAgentOutput {
|
|
48
|
+
handle: number;
|
|
75
49
|
}
|
|
76
50
|
|
|
77
|
-
export interface
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
original_chars: number;
|
|
82
|
-
preview_chars: number;
|
|
83
|
-
strategy: ContextStrategy;
|
|
51
|
+
export interface CreateHostAgentResult {
|
|
52
|
+
ok: boolean;
|
|
53
|
+
data?: CreateHostAgentOutput;
|
|
54
|
+
error?: ErrorDto;
|
|
84
55
|
}
|
|
85
56
|
|
|
86
|
-
export interface
|
|
57
|
+
export interface CreateHostStateOutput {
|
|
87
58
|
handle: number;
|
|
88
59
|
}
|
|
89
60
|
|
|
90
|
-
export interface
|
|
61
|
+
export interface CreateHostStateResult {
|
|
91
62
|
ok: boolean;
|
|
92
|
-
data?:
|
|
63
|
+
data?: CreateHostStateOutput;
|
|
93
64
|
error?: ErrorDto;
|
|
94
65
|
}
|
|
95
66
|
|
|
@@ -118,13 +89,13 @@ export interface EstimateTokensResult {
|
|
|
118
89
|
error?: ErrorDto;
|
|
119
90
|
}
|
|
120
91
|
|
|
121
|
-
export interface
|
|
122
|
-
|
|
92
|
+
export interface HostStatePersistDataOutput {
|
|
93
|
+
state: PersistData;
|
|
123
94
|
}
|
|
124
95
|
|
|
125
|
-
export interface
|
|
96
|
+
export interface HostStatePersistDataResult {
|
|
126
97
|
ok: boolean;
|
|
127
|
-
data?:
|
|
98
|
+
data?: HostStatePersistDataOutput;
|
|
128
99
|
error?: ErrorDto;
|
|
129
100
|
}
|
|
130
101
|
|
|
@@ -172,87 +143,19 @@ export interface ModelCost {
|
|
|
172
143
|
cache_write: number;
|
|
173
144
|
}
|
|
174
145
|
|
|
175
|
-
export interface
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
export interface ProjectionInput {
|
|
186
|
-
system_prompt: string;
|
|
187
|
-
messages: AgentMessage[];
|
|
188
|
-
budget: ContextProjectionBudget;
|
|
189
|
-
state: ContextProjectionState;
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
export interface ProjectionOutput {
|
|
193
|
-
projected_messages: AgentMessage[];
|
|
194
|
-
updated_state: ContextProjectionState;
|
|
195
|
-
report: ContextProjectionReport;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
export interface ProjectionResult {
|
|
199
|
-
ok: boolean;
|
|
200
|
-
data?: ProjectionOutput;
|
|
201
|
-
error?: ErrorDto;
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
export interface SessionBranchOutput {
|
|
205
|
-
entries: SessionEntry[];
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export interface SessionBranchResult {
|
|
209
|
-
ok: boolean;
|
|
210
|
-
data?: SessionBranchOutput;
|
|
211
|
-
error?: ErrorDto;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
export interface SessionEntry {
|
|
215
|
-
id: string;
|
|
216
|
-
parent_id?: string;
|
|
217
|
-
kind: EntryKind;
|
|
218
|
-
timestamp: number;
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
export interface SessionState {
|
|
222
|
-
entries: SessionEntry[];
|
|
223
|
-
leaf_id: string;
|
|
224
|
-
name?: string;
|
|
146
|
+
export interface PersistData {
|
|
147
|
+
T?: Value;
|
|
148
|
+
A?: Value;
|
|
149
|
+
turn_number?: number;
|
|
150
|
+
host_artifacts?: [string, string][];
|
|
151
|
+
budget?: ContextProjectionBudget;
|
|
152
|
+
system_prompt?: string;
|
|
153
|
+
compaction_prompt?: string;
|
|
225
154
|
}
|
|
226
155
|
|
|
227
|
-
export interface
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
export interface SessionStateResult {
|
|
232
|
-
ok: boolean;
|
|
233
|
-
data?: SessionStateOutput;
|
|
234
|
-
error?: ErrorDto;
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
export interface StateOutput {
|
|
238
|
-
state: AgentState;
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
export interface StateResult {
|
|
242
|
-
ok: boolean;
|
|
243
|
-
data?: StateOutput;
|
|
244
|
-
error?: ErrorDto;
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
export interface StepOutput {
|
|
248
|
-
events: AgentEvent[];
|
|
249
|
-
actions: AgentAction[];
|
|
250
|
-
}
|
|
251
|
-
|
|
252
|
-
export interface StepResult {
|
|
253
|
-
ok: boolean;
|
|
254
|
-
data?: StepOutput;
|
|
255
|
-
error?: ErrorDto;
|
|
156
|
+
export interface StartTurnInput {
|
|
157
|
+
prompt: AgentMessage;
|
|
158
|
+
tools?: ToolDefinition[];
|
|
256
159
|
}
|
|
257
160
|
|
|
258
161
|
export interface TextContent {
|
|
@@ -279,6 +182,7 @@ export interface ToolDefinition {
|
|
|
279
182
|
description: string;
|
|
280
183
|
parameters: JsonSchema;
|
|
281
184
|
execution_mode?: ExecutionMode;
|
|
185
|
+
tool_run_mode?: ToolRunMode;
|
|
282
186
|
}
|
|
283
187
|
|
|
284
188
|
export interface ToolError {
|
|
@@ -301,15 +205,6 @@ export interface ToolResult {
|
|
|
301
205
|
terminate?: boolean;
|
|
302
206
|
}
|
|
303
207
|
|
|
304
|
-
export interface ToolResultContext {
|
|
305
|
-
content_kind: ContentKind;
|
|
306
|
-
strategy: ContextStrategy;
|
|
307
|
-
original_chars: number;
|
|
308
|
-
truncated_by_tool: boolean;
|
|
309
|
-
path?: string;
|
|
310
|
-
exit_code?: number;
|
|
311
|
-
}
|
|
312
|
-
|
|
313
208
|
export interface ToolResultMessage {
|
|
314
209
|
tool_call_id: ToolCallId;
|
|
315
210
|
tool_name: ToolName;
|
|
@@ -319,14 +214,24 @@ export interface ToolResultMessage {
|
|
|
319
214
|
timestamp: number;
|
|
320
215
|
}
|
|
321
216
|
|
|
217
|
+
export interface TurnResultOutput {
|
|
218
|
+
events: AgentEvent[];
|
|
219
|
+
directives: HostDirective[];
|
|
220
|
+
markers?: ChangeMarkerDto[];
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
export interface TurnResultResult {
|
|
224
|
+
ok: boolean;
|
|
225
|
+
data?: TurnResultOutput;
|
|
226
|
+
error?: ErrorDto;
|
|
227
|
+
}
|
|
228
|
+
|
|
322
229
|
export interface UserMessage {
|
|
323
230
|
content: Content[];
|
|
324
231
|
timestamp: number;
|
|
325
232
|
}
|
|
326
233
|
|
|
327
|
-
export type
|
|
328
|
-
|
|
329
|
-
export type AgentEvent = { type: "agent_start" } | { type: "agent_end"; messages: AgentMessage[] } | { type: "turn_start" } | { type: "turn_end"; message: AgentMessage; tool_results: ToolResultMessage[] } | { type: "message_start"; message: AgentMessage } | { type: "message_update"; message: AgentMessage; delta: ContentDelta } | { type: "message_end"; message: AgentMessage } | { type: "tool_execution_start"; tool_call_id: ToolCallId; tool_name: ToolName; args?: ToolArguments } | { type: "tool_execution_update"; tool_call_id: ToolCallId; stream: ToolOutputStream; chunk: string; sequence: number; timestamp: number } | { type: "tool_execution_end"; tool_call_id: ToolCallId; result: ToolResult; is_error: boolean } | { type: "tool_execution_cancelled"; tool_call_id: ToolCallId; reason: CancelReason } | { type: "queue_update"; steer: AgentMessage[]; follow_up: AgentMessage[] } | { type: "save_point"; had_pending_writes: boolean } | { type: "settled" };
|
|
234
|
+
export type AgentEvent = { type: "agent_start" } | { type: "agent_end" } | { type: "turn_start" } | { type: "turn_end"; message: AgentMessage; tool_results: ToolResultMessage[] } | { type: "message_start"; message: AgentMessage } | { type: "message_update"; message: AgentMessage; delta: ContentDelta } | { type: "message_end"; message: AgentMessage } | { type: "tool_execution_start"; tool_call_id: ToolCallId; tool_name: ToolName; args?: ToolArguments } | { type: "tool_execution_update"; tool_call_id: ToolCallId; stream: ToolOutputStream; chunk: string; sequence: number; timestamp: number } | { type: "tool_execution_end"; tool_call_id: ToolCallId; result: ToolResult; is_error: boolean } | { type: "tool_execution_cancelled"; tool_call_id: ToolCallId; reason: CancelReason } | { type: "queue_update"; steer: AgentMessage[]; follow_up: AgentMessage[] } | { type: "save_point"; had_pending_writes: boolean } | { type: "settled" };
|
|
330
235
|
|
|
331
236
|
export type AgentMessage = ({ role: "user" } & UserMessage) | ({ role: "assistant" } & AssistantMessage) | ({ role: "tool_result" } & ToolResultMessage);
|
|
332
237
|
|
|
@@ -334,18 +239,16 @@ export type ApiName = string;
|
|
|
334
239
|
|
|
335
240
|
export type CancelReason = { type: "user_requested" } | { type: "timeout" } | { type: "agent_aborted" } | { type: "dependency_failed"; cause_tool_call_id: ToolCallId };
|
|
336
241
|
|
|
242
|
+
export type ChangeMarkerDto = { type: "compaction_applied" } | { type: "new_artifacts"; entry_ids: string[] };
|
|
243
|
+
|
|
337
244
|
export type Content = ({ type: "text" } & TextContent) | ({ type: "image" } & ImageContent) | ({ type: "tool_call" } & ToolCall);
|
|
338
245
|
|
|
339
246
|
export type ContentDelta = { kind: "text_start" } | { kind: "text_delta"; text: string } | { kind: "text_end" } | { kind: "thinking_start" } | { kind: "thinking_delta"; text: string } | { kind: "thinking_end" } | { kind: "tool_call_start"; tool_call: ToolCall } | { kind: "tool_call_delta"; tool_call_id: ToolCallId; delta: Value } | { kind: "tool_call_end"; tool_call_id: ToolCallId };
|
|
340
247
|
|
|
341
|
-
export type ContentKind = "file_read" | "command_output" | "diff" | "search_results" | "directory_listing" | "generic_text";
|
|
342
|
-
|
|
343
|
-
export type ContextStrategy = { type: "keep_full" } | { type: "head"; max_chars: number } | { type: "tail"; max_chars: number } | { type: "head_tail"; head_chars: number; tail_chars: number } | { type: "drop_if_old" } | { type: "microcompacted" };
|
|
344
|
-
|
|
345
|
-
export type EntryKind = ({ type: "message" } & {} & AgentMessage) | { type: "compaction"; summary: string; first_kept_entry_id: string; tokens_before: number; details?: JsonSchema } | { type: "branch_summary"; summary: string; details?: JsonSchema } | { type: "model_change"; provider: string; model_id: string } | ({ type: "thinking_level_change" } & ThinkingLevel) | { type: "custom"; custom_type: string; data?: JsonSchema };
|
|
346
|
-
|
|
347
248
|
export type ExecutionMode = "parallel" | "sequential";
|
|
348
249
|
|
|
250
|
+
export type HostDirective = { type: "stream_llm"; context: LlmContext } | { type: "execute_tools"; calls: ToolCall[] } | { type: "cancel_tools"; tool_call_ids: ToolCallId[]; reason: CancelReason } | { type: "persist" } | { type: "summarize"; context: LlmContext } | { type: "finished" } | { type: "wait_for_input"; mode: WaitMode };
|
|
251
|
+
|
|
349
252
|
export type JsonSchema = Value;
|
|
350
253
|
|
|
351
254
|
export type LlmChunk = ({ kind: "start" } & {} & AssistantMessage) | { kind: "text_delta"; text: string } | { kind: "thinking_delta"; text: string } | { kind: "tool_call_delta"; tool_call_id: ToolCallId; delta: Value } | { kind: "done" } | { kind: "error"; message: string };
|
|
@@ -358,10 +261,6 @@ export type ModelName = string;
|
|
|
358
261
|
|
|
359
262
|
export type ModelProvider = "open_ai" | "anthropic" | "google" | "ollama" | "custom";
|
|
360
263
|
|
|
361
|
-
export type Phase = "idle" | "streaming" | "wait_for_input";
|
|
362
|
-
|
|
363
|
-
export type PromptRequest = AgentMessage | { text: string };
|
|
364
|
-
|
|
365
264
|
export type ProviderName = string;
|
|
366
265
|
|
|
367
266
|
export type QueueMode = "one_at_a_time" | "all";
|
|
@@ -378,96 +277,98 @@ export type ToolCallId = string;
|
|
|
378
277
|
|
|
379
278
|
export type ToolDetails = Value;
|
|
380
279
|
|
|
381
|
-
export type ToolDonePayload = { error: ToolError } | { result: ToolResult } | ToolResult;
|
|
382
|
-
|
|
383
|
-
export type ToolExecutionMode = "parallel" | "sequential";
|
|
384
|
-
|
|
385
280
|
export type ToolName = string;
|
|
386
281
|
|
|
387
282
|
export type ToolOutputStream = "stdout" | "stderr" | "status";
|
|
388
283
|
|
|
284
|
+
export type ToolRunMode = "immediate" | "deferred";
|
|
285
|
+
|
|
389
286
|
export type WaitMode = "steering" | "follow_up" | "any";
|
|
390
287
|
|
|
391
288
|
|
|
392
|
-
export function
|
|
289
|
+
export function createHostAgent(options: AgentOptions, budget: ContextProjectionBudget): CreateHostAgentResult;
|
|
290
|
+
|
|
291
|
+
export function createHostState(_budget: ContextProjectionBudget): CreateHostStateResult;
|
|
393
292
|
|
|
394
|
-
export function
|
|
293
|
+
export function destroyHostAgent(handle: number): EmptyResult;
|
|
395
294
|
|
|
396
|
-
export function
|
|
295
|
+
export function destroyHostState(handle: number): EmptyResult;
|
|
397
296
|
|
|
398
297
|
export function estimateTokens(input: EstimateTokensInput): EstimateTokensResult;
|
|
399
298
|
|
|
400
299
|
export function estimateTokensForText(text: string): EstimateTokensResult;
|
|
401
300
|
|
|
402
|
-
export function
|
|
301
|
+
export function getHostAgentPersistData(handle: number): HostStatePersistDataResult;
|
|
403
302
|
|
|
404
|
-
export function
|
|
303
|
+
export function getHostStatePersistData(handle: number): HostStatePersistDataResult;
|
|
405
304
|
|
|
406
|
-
export function
|
|
305
|
+
export function hostAbort(handle: number): TurnResultResult;
|
|
407
306
|
|
|
408
|
-
export function
|
|
307
|
+
export function hostAcceptCompaction(handle: number, summary: string, _compacted_entry_ids: string[]): TurnResultResult;
|
|
409
308
|
|
|
410
|
-
export function
|
|
309
|
+
export function hostContinueTurn(handle: number): TurnResultResult;
|
|
411
310
|
|
|
412
|
-
export function
|
|
311
|
+
export function hostFeedLlmChunk(handle: number, chunk: LlmChunk): TurnResultResult;
|
|
413
312
|
|
|
414
|
-
export function
|
|
313
|
+
export function hostLlmDone(handle: number, result: LlmResult): TurnResultResult;
|
|
415
314
|
|
|
416
|
-
export function
|
|
315
|
+
export function hostReadArtifact(handle: number, artifact_id: string): string;
|
|
417
316
|
|
|
418
|
-
export function
|
|
317
|
+
export function hostReset(handle: number): EmptyResult;
|
|
419
318
|
|
|
420
|
-
export function
|
|
319
|
+
export function hostSearchArtifacts(handle: number, query: string): ArtifactSearchResults;
|
|
421
320
|
|
|
422
|
-
export function
|
|
321
|
+
export function hostSteer(handle: number, message: AgentMessage): TurnResultResult;
|
|
423
322
|
|
|
424
|
-
export function
|
|
323
|
+
export function hostToolCancelled(handle: number, tool_call_id: string, reason: CancelReason): TurnResultResult;
|
|
425
324
|
|
|
426
|
-
export function
|
|
325
|
+
export function hostToolDone(handle: number, id: ToolCallId, result: ToolResult): TurnResultResult;
|
|
427
326
|
|
|
428
|
-
export function
|
|
327
|
+
export function restoreHostAgent(options: AgentOptions, data: PersistData): CreateHostAgentResult;
|
|
429
328
|
|
|
430
|
-
export function
|
|
329
|
+
export function restoreHostState(data: PersistData): CreateHostStateResult;
|
|
431
330
|
|
|
432
|
-
export function
|
|
331
|
+
export function restoreHostStateFromJson(json: string): CreateHostStateResult;
|
|
433
332
|
|
|
434
|
-
export function
|
|
333
|
+
export function setLogLevel(level: string): void;
|
|
435
334
|
|
|
436
|
-
export function
|
|
335
|
+
export function startTurn(handle: number, input: StartTurnInput): TurnResultResult;
|
|
437
336
|
|
|
438
337
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
439
338
|
|
|
440
339
|
export interface InitOutput {
|
|
441
340
|
readonly memory: WebAssembly.Memory;
|
|
442
|
-
readonly
|
|
443
|
-
readonly
|
|
444
|
-
readonly destroyAgent: (a: number) => any;
|
|
341
|
+
readonly createHostState: (a: any) => any;
|
|
342
|
+
readonly destroyHostState: (a: number) => any;
|
|
445
343
|
readonly estimateTokens: (a: any) => any;
|
|
446
344
|
readonly estimateTokensForText: (a: number, b: number) => any;
|
|
447
|
-
readonly
|
|
448
|
-
readonly
|
|
449
|
-
readonly
|
|
450
|
-
readonly
|
|
451
|
-
readonly
|
|
452
|
-
readonly
|
|
453
|
-
readonly
|
|
454
|
-
readonly
|
|
455
|
-
readonly
|
|
456
|
-
readonly
|
|
457
|
-
readonly
|
|
458
|
-
readonly
|
|
459
|
-
readonly
|
|
460
|
-
readonly
|
|
345
|
+
readonly getHostStatePersistData: (a: number) => any;
|
|
346
|
+
readonly hostReadArtifact: (a: number, b: number, c: number) => [number, number, number, number];
|
|
347
|
+
readonly hostSearchArtifacts: (a: number, b: number, c: number) => [number, number, number];
|
|
348
|
+
readonly restoreHostState: (a: any) => any;
|
|
349
|
+
readonly restoreHostStateFromJson: (a: number, b: number) => any;
|
|
350
|
+
readonly createHostAgent: (a: any, b: any) => any;
|
|
351
|
+
readonly destroyHostAgent: (a: number) => any;
|
|
352
|
+
readonly getHostAgentPersistData: (a: number) => any;
|
|
353
|
+
readonly hostAbort: (a: number) => any;
|
|
354
|
+
readonly hostAcceptCompaction: (a: number, b: number, c: number, d: number, e: number) => any;
|
|
355
|
+
readonly hostContinueTurn: (a: number) => any;
|
|
356
|
+
readonly hostFeedLlmChunk: (a: number, b: any) => any;
|
|
357
|
+
readonly hostLlmDone: (a: number, b: any) => any;
|
|
358
|
+
readonly hostReset: (a: number) => any;
|
|
359
|
+
readonly hostSteer: (a: number, b: any) => any;
|
|
360
|
+
readonly hostToolCancelled: (a: number, b: number, c: number, d: any) => any;
|
|
361
|
+
readonly hostToolDone: (a: number, b: any, c: any) => any;
|
|
362
|
+
readonly restoreHostAgent: (a: any, b: any) => any;
|
|
363
|
+
readonly startTurn: (a: number, b: any) => any;
|
|
461
364
|
readonly setLogLevel: (a: number, b: number) => void;
|
|
462
|
-
readonly setSessionState: (a: number, b: any) => any;
|
|
463
|
-
readonly state: (a: number) => any;
|
|
464
|
-
readonly steer: (a: number, b: any) => any;
|
|
465
365
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
466
366
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
467
367
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
468
368
|
readonly __wbindgen_exn_store: (a: number) => void;
|
|
469
369
|
readonly __externref_table_alloc: () => number;
|
|
470
370
|
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
371
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
471
372
|
readonly __wbindgen_start: () => void;
|
|
472
373
|
}
|
|
473
374
|
|