@pi-oxide/pi-host-web 0.8.0 → 0.9.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/dist/index-C8phwA2v.js +867 -0
- package/dist/index.js +2 -2
- package/dist/sdk/bindings/index.js +1 -1
- package/package.json +2 -1
- package/pi_host_web.d.ts +24 -11
- package/pi_host_web.js +12 -0
- package/pi_host_web_bg.wasm +0 -0
- package/pi_host_web_bg.wasm.d.ts +2 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var U = Object.defineProperty;
|
|
2
2
|
var H = (t, e, s) => e in t ? U(t, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : t[e] = s;
|
|
3
3
|
var b = (t, e, s) => H(t, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
-
import { l as S, h as _, b as G, g as P, i as F, e as K, o as Q, c as X, r as V, w as Y, m as Z, n as ee } from "./index-
|
|
5
|
-
import { C as _t, a as yt, N as bt, f as xt, j as wt, k as St, s as kt, t as vt, v as Rt } from "./index-
|
|
4
|
+
import { l as S, h as _, b as G, g as P, i as F, e as K, o as Q, c as X, r as V, w as Y, m as Z, n as ee } from "./index-C8phwA2v.js";
|
|
5
|
+
import { C as _t, a as yt, N as bt, f as xt, j as wt, k as St, s as kt, t as vt, v as Rt } from "./index-C8phwA2v.js";
|
|
6
6
|
import { zodToJsonSchema as te } from "zod-to-json-schema";
|
|
7
7
|
class se {
|
|
8
8
|
constructor() {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as o, b as a, d as t, i as e, j as n, p as l, r as u, q as p, u as i, v as H, w as g } from "../../index-
|
|
1
|
+
import { H as o, b as a, d as t, i as e, j as n, p as l, r as u, q as p, u as i, v as H, w as g } from "../../index-C8phwA2v.js";
|
|
2
2
|
export {
|
|
3
3
|
o as HostAgent,
|
|
4
4
|
a as HostError,
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
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.9.0",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"repository": {
|
|
11
11
|
"type": "git",
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
"README.md",
|
|
20
20
|
"LICENSE",
|
|
21
21
|
"dist/bindings.d.ts",
|
|
22
|
+
"dist/index-C8phwA2v.js",
|
|
22
23
|
"dist/index-CAp51VNq.js",
|
|
23
24
|
"dist/index-Is-rTdaY.js",
|
|
24
25
|
"dist/index.d.ts",
|
package/pi_host_web.d.ts
CHANGED
|
@@ -113,7 +113,7 @@ export interface LlmContext {
|
|
|
113
113
|
export interface LlmError {
|
|
114
114
|
code: string;
|
|
115
115
|
message: string;
|
|
116
|
-
details?:
|
|
116
|
+
details?: unknown;
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
export interface Model {
|
|
@@ -144,8 +144,8 @@ export interface ModelCost {
|
|
|
144
144
|
}
|
|
145
145
|
|
|
146
146
|
export interface PersistData {
|
|
147
|
-
T?:
|
|
148
|
-
A?:
|
|
147
|
+
T?: unknown[];
|
|
148
|
+
A?: Record<string, unknown>;
|
|
149
149
|
turn_number?: number;
|
|
150
150
|
host_artifacts?: [string, string][];
|
|
151
151
|
budget?: ContextProjectionBudget;
|
|
@@ -176,6 +176,12 @@ export interface ToolCall {
|
|
|
176
176
|
arguments: ToolArguments;
|
|
177
177
|
}
|
|
178
178
|
|
|
179
|
+
export interface ToolCallPreparation {
|
|
180
|
+
tool_call_id: ToolCallId;
|
|
181
|
+
transform: ToolCallTransform;
|
|
182
|
+
permission: ToolCallPermission;
|
|
183
|
+
}
|
|
184
|
+
|
|
179
185
|
export interface ToolDefinition {
|
|
180
186
|
name: ToolName;
|
|
181
187
|
label: string;
|
|
@@ -231,7 +237,7 @@ export interface UserMessage {
|
|
|
231
237
|
timestamp: number;
|
|
232
238
|
}
|
|
233
239
|
|
|
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" };
|
|
240
|
+
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; tool_name: ToolName; result: ToolResult; args?: ToolArguments; 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" };
|
|
235
241
|
|
|
236
242
|
export type AgentMessage = ({ role: "user" } & UserMessage) | ({ role: "assistant" } & AssistantMessage) | ({ role: "tool_result" } & ToolResultMessage);
|
|
237
243
|
|
|
@@ -243,15 +249,15 @@ export type ChangeMarkerDto = { type: "compaction_applied" } | { type: "new_arti
|
|
|
243
249
|
|
|
244
250
|
export type Content = ({ type: "text" } & TextContent) | ({ type: "image" } & ImageContent) | ({ type: "tool_call" } & ToolCall);
|
|
245
251
|
|
|
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:
|
|
252
|
+
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: Record<string, unknown> } | { kind: "tool_call_end"; tool_call_id: ToolCallId };
|
|
247
253
|
|
|
248
254
|
export type ExecutionMode = "parallel" | "sequential";
|
|
249
255
|
|
|
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 };
|
|
256
|
+
export type HostDirective = { type: "stream_llm"; context: LlmContext } | { type: "prepare_tool_calls"; calls: ToolCall[] } | { 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
257
|
|
|
252
|
-
export type JsonSchema =
|
|
258
|
+
export type JsonSchema = Record<string, unknown>;
|
|
253
259
|
|
|
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:
|
|
260
|
+
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: Record<string, unknown> } | { kind: "done" } | { kind: "error"; message: string };
|
|
255
261
|
|
|
256
262
|
export type LlmResult = { Ok: AssistantMessage } | { Err: { error: LlmError; aborted: boolean } };
|
|
257
263
|
|
|
@@ -271,11 +277,15 @@ export type StopReason = "end_turn" | "max_tokens" | "tool_use" | "aborted" | "e
|
|
|
271
277
|
|
|
272
278
|
export type ThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
|
|
273
279
|
|
|
274
|
-
export type ToolArguments =
|
|
280
|
+
export type ToolArguments = unknown;
|
|
275
281
|
|
|
276
282
|
export type ToolCallId = string;
|
|
277
283
|
|
|
278
|
-
export type
|
|
284
|
+
export type ToolCallPermission = { type: "allow" } | { type: "block"; reason: string };
|
|
285
|
+
|
|
286
|
+
export type ToolCallTransform = { type: "none" } | { type: "rewrite_args"; arguments: ToolArguments };
|
|
287
|
+
|
|
288
|
+
export type ToolDetails = Record<string, unknown>;
|
|
279
289
|
|
|
280
290
|
export type ToolName = string;
|
|
281
291
|
|
|
@@ -312,6 +322,8 @@ export function hostFeedLlmChunk(handle: number, chunk: LlmChunk): TurnResultRes
|
|
|
312
322
|
|
|
313
323
|
export function hostLlmDone(handle: number, result: LlmResult): TurnResultResult;
|
|
314
324
|
|
|
325
|
+
export function hostPrepareToolCalls(handle: number, preparations_json: string): TurnResultResult;
|
|
326
|
+
|
|
315
327
|
export function hostReadArtifact(handle: number, artifact_id: string): string;
|
|
316
328
|
|
|
317
329
|
export function hostReset(handle: number): EmptyResult;
|
|
@@ -349,7 +361,6 @@ export interface InitOutput {
|
|
|
349
361
|
readonly hostSearchArtifacts: (a: number, b: number, c: number) => [number, number, number];
|
|
350
362
|
readonly restoreHostState: (a: any) => any;
|
|
351
363
|
readonly restoreHostStateFromJson: (a: number, b: number) => any;
|
|
352
|
-
readonly setLogLevel: (a: number, b: number) => void;
|
|
353
364
|
readonly createHostAgent: (a: any, b: any) => any;
|
|
354
365
|
readonly destroyHostAgent: (a: number) => any;
|
|
355
366
|
readonly getHostAgentPersistData: (a: number) => any;
|
|
@@ -358,6 +369,7 @@ export interface InitOutput {
|
|
|
358
369
|
readonly hostContinueTurn: (a: number) => any;
|
|
359
370
|
readonly hostFeedLlmChunk: (a: number, b: any) => any;
|
|
360
371
|
readonly hostLlmDone: (a: number, b: any) => any;
|
|
372
|
+
readonly hostPrepareToolCalls: (a: number, b: number, c: number) => any;
|
|
361
373
|
readonly hostReset: (a: number) => any;
|
|
362
374
|
readonly hostSteer: (a: number, b: any) => any;
|
|
363
375
|
readonly hostToolCancelled: (a: number, b: number, c: number, d: any) => any;
|
|
@@ -365,6 +377,7 @@ export interface InitOutput {
|
|
|
365
377
|
readonly hostToolFailed: (a: number, b: any, c: any) => any;
|
|
366
378
|
readonly restoreHostAgent: (a: any, b: any) => any;
|
|
367
379
|
readonly startTurn: (a: number, b: any) => any;
|
|
380
|
+
readonly setLogLevel: (a: number, b: number) => void;
|
|
368
381
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
369
382
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
370
383
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
package/pi_host_web.js
CHANGED
|
@@ -128,6 +128,18 @@ export function hostLlmDone(handle, result) {
|
|
|
128
128
|
return ret;
|
|
129
129
|
}
|
|
130
130
|
|
|
131
|
+
/**
|
|
132
|
+
* @param {number} handle
|
|
133
|
+
* @param {string} preparations_json
|
|
134
|
+
* @returns {TurnResultResult}
|
|
135
|
+
*/
|
|
136
|
+
export function hostPrepareToolCalls(handle, preparations_json) {
|
|
137
|
+
const ptr0 = passStringToWasm0(preparations_json, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
138
|
+
const len0 = WASM_VECTOR_LEN;
|
|
139
|
+
const ret = wasm.hostPrepareToolCalls(handle, ptr0, len0);
|
|
140
|
+
return ret;
|
|
141
|
+
}
|
|
142
|
+
|
|
131
143
|
/**
|
|
132
144
|
* @param {number} handle
|
|
133
145
|
* @param {string} artifact_id
|
package/pi_host_web_bg.wasm
CHANGED
|
Binary file
|
package/pi_host_web_bg.wasm.d.ts
CHANGED
|
@@ -10,7 +10,6 @@ export const hostReadArtifact: (a: number, b: number, c: number) => [number, num
|
|
|
10
10
|
export const hostSearchArtifacts: (a: number, b: number, c: number) => [number, number, number];
|
|
11
11
|
export const restoreHostState: (a: any) => any;
|
|
12
12
|
export const restoreHostStateFromJson: (a: number, b: number) => any;
|
|
13
|
-
export const setLogLevel: (a: number, b: number) => void;
|
|
14
13
|
export const createHostAgent: (a: any, b: any) => any;
|
|
15
14
|
export const destroyHostAgent: (a: number) => any;
|
|
16
15
|
export const getHostAgentPersistData: (a: number) => any;
|
|
@@ -19,6 +18,7 @@ export const hostAcceptCompaction: (a: number, b: number, c: number, d: number,
|
|
|
19
18
|
export const hostContinueTurn: (a: number) => any;
|
|
20
19
|
export const hostFeedLlmChunk: (a: number, b: any) => any;
|
|
21
20
|
export const hostLlmDone: (a: number, b: any) => any;
|
|
21
|
+
export const hostPrepareToolCalls: (a: number, b: number, c: number) => any;
|
|
22
22
|
export const hostReset: (a: number) => any;
|
|
23
23
|
export const hostSteer: (a: number, b: any) => any;
|
|
24
24
|
export const hostToolCancelled: (a: number, b: number, c: number, d: any) => any;
|
|
@@ -26,6 +26,7 @@ export const hostToolDone: (a: number, b: any, c: any) => any;
|
|
|
26
26
|
export const hostToolFailed: (a: number, b: any, c: any) => any;
|
|
27
27
|
export const restoreHostAgent: (a: any, b: any) => any;
|
|
28
28
|
export const startTurn: (a: number, b: any) => any;
|
|
29
|
+
export const setLogLevel: (a: number, b: number) => void;
|
|
29
30
|
export const __wbindgen_malloc: (a: number, b: number) => number;
|
|
30
31
|
export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
31
32
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|