@pi-oxide/extension-js 0.10.1 → 0.10.3

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.
@@ -1,115 +0,0 @@
1
- import { z } from 'zod';
2
-
3
- export interface Command {
4
- action: string;
5
- params: unknown;
6
- call_id?: number;
7
- runId?: string;
8
- }
9
- export type AsyncError = {
10
- message: string;
11
- code: string;
12
- category?: string;
13
- };
14
- export type AsyncResponse<T = unknown> = {
15
- ok: true;
16
- value: T;
17
- } | {
18
- ok: false;
19
- error: AsyncError;
20
- };
21
- export interface ToolDocParam {
22
- name: string;
23
- type: string;
24
- required: boolean;
25
- description: string;
26
- }
27
- export interface ToolDoc {
28
- action: string;
29
- namespace: string;
30
- description: string;
31
- params: ToolDocParam[];
32
- returns: {
33
- type: string;
34
- description: string;
35
- };
36
- errorCode: string;
37
- errorCategory?: string;
38
- }
39
- export interface ToolDefinition<P, R> {
40
- action: string;
41
- namespace: string;
42
- description: string;
43
- params: z.ZodSchema<P>;
44
- returns: z.ZodSchema<R>;
45
- handler: (params: P, callId?: number, runId?: string, signal?: AbortSignal) => Promise<R>;
46
- paramTypes: ToolDocParam[];
47
- returnType?: string;
48
- returnDoc: string;
49
- errorCode: string;
50
- errorCategory?: string;
51
- }
52
- export type ExecutionContextId = string;
53
- export type CallContext = {
54
- action: string;
55
- callId?: number;
56
- runId?: string;
57
- signal?: AbortSignal;
58
- };
59
- export type JsCallSpec<P, R> = {
60
- action: string;
61
- namespace: string;
62
- name: string;
63
- description: string;
64
- params: z.ZodSchema<P>;
65
- returns: z.ZodSchema<R>;
66
- fields?: string[];
67
- aliases?: Array<{
68
- namespace: string;
69
- name: string;
70
- fields?: string[];
71
- }>;
72
- owner: ExecutionContextId;
73
- handler: (params: P, ctx: CallContext) => Promise<R>;
74
- errorCode: string;
75
- errorCategory?: string;
76
- paramTypes?: ToolDocParam[];
77
- returnType?: string;
78
- returnDoc?: string;
79
- };
80
- export type SerializableJsCallManifestEntry = {
81
- action: string;
82
- namespace: string;
83
- name: string;
84
- publicName: string;
85
- description: string;
86
- fields: string[] | null;
87
- aliases: Array<{
88
- namespace: string;
89
- name: string;
90
- fields: string[] | null;
91
- }> | null;
92
- owner: ExecutionContextId;
93
- paramsDoc: ToolDocParam[];
94
- returnsDoc: {
95
- type: string;
96
- description: string;
97
- };
98
- errorCode: string;
99
- errorCategory?: string;
100
- };
101
- export declare function setRunnerAbortController(controller: AbortController | null): void;
102
- export declare function getRunnerSignal(): AbortSignal | undefined;
103
- export declare function throwIfAborted(): void;
104
- export declare function registerJsCall<P, R>(spec: JsCallSpec<P, R>): void;
105
- export declare function getTool(action: string): ToolDefinition<unknown, unknown> | undefined;
106
- export declare function clearRegistry(): void;
107
- export declare function freezeJsRegistry(): void;
108
- export declare function clearJsRegistry(): void;
109
- export declare function getSerializableJsManifest(): SerializableJsCallManifestEntry[];
110
- /** Convert a serializable manifest entry to the shape expected by WASM registerJsCall/registerJsCallBatch. */
111
- export declare function manifestEntryToWasm(entry: SerializableJsCallManifestEntry): Record<string, unknown>;
112
- /** Rust/WASM often passes BTreeMap params as a JS Map; Zod object schemas need plain objects. */
113
- export declare function coerceWasmParams(params: unknown): unknown;
114
- export declare function dispatchTool(action: string, params: unknown, callId?: number, runId?: string, signal?: AbortSignal): Promise<AsyncResponse>;
115
- export declare function listTools(): ToolDoc[];