nanocodex 0.2.0 → 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 +72 -13
- package/actions/events.mjs +105 -22
- package/actions/index.mjs +2 -0
- package/actions/session.d.mts +7 -1
- package/actions/session.mjs +10 -0
- package/actions/turn.d.mts +18 -5
- package/actions/turn.mjs +7 -2
- package/browser/Agent.d.mts +0 -3
- package/browser/Agent.mjs +12 -2
- package/browser/host.mjs +11 -7
- package/browser/index.d.mts +4 -0
- package/index.d.mts +4 -0
- package/internal.mjs +225 -24
- package/node/Agent.d.mts +0 -5
- package/node/Agent.mjs +9 -2
- package/node/host.mjs +33 -12
- package/node/index.d.mts +4 -0
- package/package.json +3 -3
- package/pkg-node/nanocodex.d.ts +69 -38
- package/pkg-node/nanocodex.js +193 -89
- package/pkg-node/nanocodex_bg.wasm +0 -0
- package/pkg-node/nanocodex_bg.wasm.d.ts +7 -2
- package/pkg-web/nanocodex.d.ts +76 -40
- package/pkg-web/nanocodex.js +191 -88
- package/pkg-web/nanocodex_bg.wasm +0 -0
- package/pkg-web/nanocodex_bg.wasm.d.ts +7 -2
- package/runtime/code-runtime.mjs +29 -12
- package/types.d.mts +38 -3
- package/scripts/check-package.mjs +0 -38
package/pkg-node/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,57 +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.
|
|
54
60
|
*
|
|
55
61
|
* # Errors
|
|
56
62
|
*
|
|
57
|
-
* Rejects after the
|
|
63
|
+
* Rejects after the driver stops.
|
|
58
64
|
*/
|
|
59
65
|
setFastMode(enabled: boolean): Promise<void>;
|
|
60
66
|
/**
|
|
61
|
-
*
|
|
67
|
+
* Changes the reasoning effort for subsequently accepted turns.
|
|
62
68
|
*
|
|
63
69
|
* # Errors
|
|
64
70
|
*
|
|
65
|
-
* Rejects an
|
|
71
|
+
* Rejects an invalid effort or a stopped driver.
|
|
66
72
|
*/
|
|
67
73
|
setThinking(thinking: string): Promise<void>;
|
|
68
74
|
/**
|
|
69
|
-
*
|
|
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.
|
|
70
84
|
*
|
|
71
85
|
* # Errors
|
|
72
86
|
*
|
|
@@ -74,60 +88,77 @@ export class Nanocodex {
|
|
|
74
88
|
*/
|
|
75
89
|
spawn(): Promise<Nanocodex>;
|
|
76
90
|
/**
|
|
77
|
-
*
|
|
91
|
+
* Returns the stable `UUIDv7` session identity.
|
|
78
92
|
*/
|
|
79
93
|
readonly sessionId: string;
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
/**
|
|
83
|
-
*
|
|
97
|
+
* JavaScript binding over one shared Rust turn.
|
|
84
98
|
*/
|
|
85
99
|
export class Turn {
|
|
86
100
|
private constructor();
|
|
87
101
|
free(): void;
|
|
88
102
|
[Symbol.dispose](): void;
|
|
89
103
|
/**
|
|
90
|
-
*
|
|
104
|
+
* Cancels this exact active or queued turn.
|
|
91
105
|
*
|
|
92
106
|
* # Errors
|
|
93
107
|
*
|
|
94
|
-
* Rejects if the turn is already terminal or
|
|
108
|
+
* Rejects if the turn is already terminal or its driver stopped.
|
|
95
109
|
*/
|
|
96
110
|
cancel(): Promise<void>;
|
|
97
111
|
/**
|
|
98
|
-
*
|
|
112
|
+
* Waits for the final assistant message.
|
|
99
113
|
*
|
|
100
114
|
* # Errors
|
|
101
115
|
*
|
|
102
|
-
* Rejects when the model run
|
|
103
|
-
* await the same pending turn concurrently.
|
|
116
|
+
* Rejects when the model run or driver fails.
|
|
104
117
|
*/
|
|
105
|
-
result(): Promise<
|
|
118
|
+
result(): Promise<TurnResult>;
|
|
106
119
|
/**
|
|
107
|
-
*
|
|
120
|
+
* Injects text input at the active turn's next safe model boundary.
|
|
108
121
|
*
|
|
109
122
|
* # Errors
|
|
110
123
|
*
|
|
111
|
-
*
|
|
124
|
+
* Rejects if the turn is not active or its driver stopped.
|
|
112
125
|
*/
|
|
113
|
-
|
|
126
|
+
steer(instruction: string): Promise<void>;
|
|
114
127
|
/**
|
|
115
|
-
*
|
|
128
|
+
* Injects browser-safe multimodal input at the active turn's next boundary.
|
|
116
129
|
*
|
|
117
130
|
* # Errors
|
|
118
131
|
*
|
|
119
|
-
* Rejects
|
|
120
|
-
* or a stopped driver.
|
|
132
|
+
* Rejects malformed input or a turn that is no longer active.
|
|
121
133
|
*/
|
|
122
|
-
|
|
134
|
+
steerContent(content_json: string): Promise<void>;
|
|
135
|
+
}
|
|
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;
|
|
123
144
|
/**
|
|
124
|
-
*
|
|
125
|
-
* turn's next safe model boundary.
|
|
145
|
+
* Serializes this completed boundary's resumable session snapshot.
|
|
126
146
|
*
|
|
127
147
|
* # Errors
|
|
128
148
|
*
|
|
129
|
-
*
|
|
130
|
-
* queued or terminal turn, a full steer queue, or a stopped driver.
|
|
149
|
+
* Throws when serialization fails.
|
|
131
150
|
*/
|
|
132
|
-
|
|
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;
|
|
133
164
|
}
|