nanocodex 0.1.1 → 0.3.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 +170 -6
- package/actions/events.mjs +105 -22
- package/actions/index.mjs +4 -0
- package/actions/session.d.mts +14 -2
- package/actions/session.mjs +24 -1
- package/actions/turn.d.mts +22 -3
- package/actions/turn.mjs +10 -0
- package/browser/Agent.d.mts +5 -5
- package/browser/Agent.mjs +31 -6
- package/browser/host.mjs +51 -7
- package/browser/index.d.mts +5 -0
- package/index.d.mts +5 -0
- package/internal.mjs +237 -21
- package/node/Agent.d.mts +3 -7
- package/node/Agent.mjs +48 -8
- package/node/host.mjs +78 -13
- package/node/index.d.mts +5 -0
- package/package.json +3 -3
- package/pkg-node/nanocodex.d.ts +84 -29
- package/pkg-node/nanocodex.js +221 -63
- package/pkg-node/nanocodex_bg.wasm +0 -0
- package/pkg-node/nanocodex_bg.wasm.d.ts +10 -2
- package/pkg-web/nanocodex.d.ts +94 -31
- package/pkg-web/nanocodex.js +220 -63
- package/pkg-web/nanocodex_bg.wasm +0 -0
- package/pkg-web/nanocodex_bg.wasm.d.ts +10 -2
- package/runtime/code-runtime.mjs +35 -12
- package/types.d.mts +67 -2
- package/scripts/check-package.mjs +0 -38
package/pkg-web/nanocodex.d.ts
CHANGED
|
@@ -2,13 +2,21 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* JavaScript binding over the shared Rust agent lifecycle.
|
|
6
6
|
*/
|
|
7
7
|
export class Nanocodex {
|
|
8
8
|
free(): void;
|
|
9
9
|
[Symbol.dispose](): void;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
11
|
+
* Compacts retained history immediately without fabricating a user prompt.
|
|
12
|
+
*
|
|
13
|
+
* # Errors
|
|
14
|
+
*
|
|
15
|
+
* Throws when compaction or the agent driver fails.
|
|
16
|
+
*/
|
|
17
|
+
compact(): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* Forks the latest safe committed model boundary.
|
|
12
20
|
*
|
|
13
21
|
* # Errors
|
|
14
22
|
*
|
|
@@ -16,41 +24,63 @@ export class Nanocodex {
|
|
|
16
24
|
*/
|
|
17
25
|
fork(): Promise<Nanocodex>;
|
|
18
26
|
/**
|
|
19
|
-
*
|
|
27
|
+
* Forks from an exact completed historical turn.
|
|
20
28
|
*
|
|
21
29
|
* # Errors
|
|
22
30
|
*
|
|
23
|
-
* Rejects if the
|
|
24
|
-
* driver stops.
|
|
31
|
+
* Rejects if the result belongs to another agent or the driver stopped.
|
|
25
32
|
*/
|
|
26
|
-
forkFrom(
|
|
33
|
+
forkFrom(result: TurnResult): Promise<Nanocodex>;
|
|
27
34
|
/**
|
|
28
|
-
*
|
|
35
|
+
* Builds an agent from its JavaScript JSON configuration.
|
|
29
36
|
*
|
|
30
37
|
* # Errors
|
|
31
38
|
*
|
|
32
|
-
* Throws when the JSON or
|
|
39
|
+
* Throws when the JSON or agent policy is invalid.
|
|
33
40
|
*/
|
|
34
41
|
constructor(config_json: string);
|
|
35
42
|
/**
|
|
36
|
-
*
|
|
43
|
+
* Accepts a text prompt and returns its independently awaitable turn.
|
|
37
44
|
*
|
|
38
45
|
* # Errors
|
|
39
46
|
*
|
|
40
|
-
* Throws when the prompt is empty
|
|
47
|
+
* Throws when the prompt is empty.
|
|
41
48
|
*/
|
|
42
49
|
prompt(instruction: string): Turn;
|
|
43
50
|
/**
|
|
44
|
-
*
|
|
51
|
+
* Accepts browser-safe multimodal input encoded as JSON.
|
|
45
52
|
*
|
|
46
53
|
* # Errors
|
|
47
54
|
*
|
|
48
|
-
* Throws for malformed
|
|
49
|
-
* stopped driver.
|
|
55
|
+
* Throws for malformed, empty, or local-filesystem input.
|
|
50
56
|
*/
|
|
51
57
|
promptContent(content_json: string): Turn;
|
|
52
58
|
/**
|
|
53
|
-
*
|
|
59
|
+
* Enables or disables priority processing for subsequently accepted turns.
|
|
60
|
+
*
|
|
61
|
+
* # Errors
|
|
62
|
+
*
|
|
63
|
+
* Rejects after the driver stops.
|
|
64
|
+
*/
|
|
65
|
+
setFastMode(enabled: boolean): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Changes the reasoning effort for subsequently accepted turns.
|
|
68
|
+
*
|
|
69
|
+
* # Errors
|
|
70
|
+
*
|
|
71
|
+
* Rejects an invalid effort or a stopped driver.
|
|
72
|
+
*/
|
|
73
|
+
setThinking(thinking: string): Promise<void>;
|
|
74
|
+
/**
|
|
75
|
+
* Gracefully stops the driver and joins every resource owned by this agent.
|
|
76
|
+
*
|
|
77
|
+
* # Errors
|
|
78
|
+
*
|
|
79
|
+
* Rejects when the driver had already stopped or cleanup fails.
|
|
80
|
+
*/
|
|
81
|
+
shutdown(): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Starts a clean sibling with the same private agent policy.
|
|
54
84
|
*
|
|
55
85
|
* # Errors
|
|
56
86
|
*
|
|
@@ -58,75 +88,108 @@ export class Nanocodex {
|
|
|
58
88
|
*/
|
|
59
89
|
spawn(): Promise<Nanocodex>;
|
|
60
90
|
/**
|
|
61
|
-
*
|
|
91
|
+
* Returns the stable `UUIDv7` session identity.
|
|
62
92
|
*/
|
|
63
93
|
readonly sessionId: string;
|
|
64
94
|
}
|
|
65
95
|
|
|
66
96
|
/**
|
|
67
|
-
*
|
|
97
|
+
* JavaScript binding over one shared Rust turn.
|
|
68
98
|
*/
|
|
69
99
|
export class Turn {
|
|
70
100
|
private constructor();
|
|
71
101
|
free(): void;
|
|
72
102
|
[Symbol.dispose](): void;
|
|
73
103
|
/**
|
|
74
|
-
*
|
|
104
|
+
* Cancels this exact active or queued turn.
|
|
75
105
|
*
|
|
76
106
|
* # Errors
|
|
77
107
|
*
|
|
78
|
-
* Rejects if the turn is already terminal or
|
|
108
|
+
* Rejects if the turn is already terminal or its driver stopped.
|
|
79
109
|
*/
|
|
80
110
|
cancel(): Promise<void>;
|
|
81
111
|
/**
|
|
82
|
-
*
|
|
112
|
+
* Waits for the final assistant message.
|
|
83
113
|
*
|
|
84
114
|
* # Errors
|
|
85
115
|
*
|
|
86
|
-
* Rejects when the model run
|
|
87
|
-
* await the same pending turn concurrently.
|
|
116
|
+
* Rejects when the model run or driver fails.
|
|
88
117
|
*/
|
|
89
|
-
result(): Promise<
|
|
118
|
+
result(): Promise<TurnResult>;
|
|
90
119
|
/**
|
|
91
|
-
*
|
|
120
|
+
* Injects text input at the active turn's next safe model boundary.
|
|
92
121
|
*
|
|
93
122
|
* # Errors
|
|
94
123
|
*
|
|
95
|
-
* Rejects
|
|
96
|
-
* or a stopped driver.
|
|
124
|
+
* Rejects if the turn is not active or its driver stopped.
|
|
97
125
|
*/
|
|
98
126
|
steer(instruction: string): Promise<void>;
|
|
99
127
|
/**
|
|
100
|
-
*
|
|
101
|
-
* turn's next safe model boundary.
|
|
128
|
+
* Injects browser-safe multimodal input at the active turn's next boundary.
|
|
102
129
|
*
|
|
103
130
|
* # Errors
|
|
104
131
|
*
|
|
105
|
-
* Rejects
|
|
106
|
-
* queued or terminal turn, a full steer queue, or a stopped driver.
|
|
132
|
+
* Rejects malformed input or a turn that is no longer active.
|
|
107
133
|
*/
|
|
108
134
|
steerContent(content_json: string): Promise<void>;
|
|
109
135
|
}
|
|
110
136
|
|
|
137
|
+
/**
|
|
138
|
+
* JavaScript binding over one completed Rust turn result.
|
|
139
|
+
*/
|
|
140
|
+
export class TurnResult {
|
|
141
|
+
private constructor();
|
|
142
|
+
free(): void;
|
|
143
|
+
[Symbol.dispose](): void;
|
|
144
|
+
/**
|
|
145
|
+
* Serializes this completed boundary's resumable session snapshot.
|
|
146
|
+
*
|
|
147
|
+
* # Errors
|
|
148
|
+
*
|
|
149
|
+
* Throws when serialization fails.
|
|
150
|
+
*/
|
|
151
|
+
snapshot(): string;
|
|
152
|
+
/**
|
|
153
|
+
* Serializes exact aggregate usage for this completed logical turn.
|
|
154
|
+
*
|
|
155
|
+
* # Errors
|
|
156
|
+
*
|
|
157
|
+
* Throws when serialization fails.
|
|
158
|
+
*/
|
|
159
|
+
usage(): string;
|
|
160
|
+
/**
|
|
161
|
+
* Returns the final assistant message.
|
|
162
|
+
*/
|
|
163
|
+
readonly finalMessage: string;
|
|
164
|
+
}
|
|
165
|
+
|
|
111
166
|
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
112
167
|
|
|
113
168
|
export interface InitOutput {
|
|
114
169
|
readonly memory: WebAssembly.Memory;
|
|
115
170
|
readonly __wbg_nanocodex_free: (a: number, b: number) => void;
|
|
116
171
|
readonly __wbg_turn_free: (a: number, b: number) => void;
|
|
172
|
+
readonly __wbg_turnresult_free: (a: number, b: number) => void;
|
|
173
|
+
readonly nanocodex_compact: (a: number) => any;
|
|
117
174
|
readonly nanocodex_fork: (a: number) => any;
|
|
118
175
|
readonly nanocodex_forkFrom: (a: number, b: number) => any;
|
|
119
176
|
readonly nanocodex_new: (a: number, b: number) => [number, number, number];
|
|
120
177
|
readonly nanocodex_prompt: (a: number, b: number, c: number) => [number, number, number];
|
|
121
178
|
readonly nanocodex_promptContent: (a: number, b: number, c: number) => [number, number, number];
|
|
122
179
|
readonly nanocodex_sessionId: (a: number) => [number, number];
|
|
180
|
+
readonly nanocodex_setFastMode: (a: number, b: number) => any;
|
|
181
|
+
readonly nanocodex_setThinking: (a: number, b: number, c: number) => any;
|
|
182
|
+
readonly nanocodex_shutdown: (a: number) => any;
|
|
123
183
|
readonly nanocodex_spawn: (a: number) => any;
|
|
124
184
|
readonly turn_cancel: (a: number) => any;
|
|
125
185
|
readonly turn_result: (a: number) => any;
|
|
126
186
|
readonly turn_steer: (a: number, b: number, c: number) => any;
|
|
127
187
|
readonly turn_steerContent: (a: number, b: number, c: number) => any;
|
|
128
|
-
readonly
|
|
129
|
-
readonly
|
|
188
|
+
readonly turnresult_finalMessage: (a: number) => [number, number];
|
|
189
|
+
readonly turnresult_snapshot: (a: number) => [number, number, number, number];
|
|
190
|
+
readonly turnresult_usage: (a: number) => [number, number, number, number];
|
|
191
|
+
readonly wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___wasm_bindgen_6c97e59ea7837008___JsValue__core_9b3796e30d99ddb7___result__Result_____wasm_bindgen_6c97e59ea7837008___JsError___true_: (a: number, b: number, c: any) => [number, number];
|
|
192
|
+
readonly wasm_bindgen_6c97e59ea7837008___convert__closures_____invoke___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined___js_sys_d57619d9eac2c6da___Function_fn_wasm_bindgen_6c97e59ea7837008___JsValue_____wasm_bindgen_6c97e59ea7837008___sys__Undefined_______true_: (a: number, b: number, c: any, d: any) => void;
|
|
130
193
|
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
131
194
|
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
132
195
|
readonly __wbindgen_exn_store: (a: number) => void;
|