@deepstrike/wasm-kernel 0.1.6
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/deepstrike_wasm.d.ts +233 -0
- package/deepstrike_wasm.js +9 -0
- package/deepstrike_wasm_bg.js +861 -0
- package/deepstrike_wasm_bg.wasm +0 -0
- package/package.json +19 -0
|
@@ -0,0 +1,233 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Discriminated union for runtime observations:
|
|
5
|
+
* - `\"compressed\"` → `action`, `rhoAfter`
|
|
6
|
+
*/
|
|
7
|
+
export interface LoopObservation {
|
|
8
|
+
kind: string;
|
|
9
|
+
action?: string;
|
|
10
|
+
rhoAfter?: number;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Discriminated union; inspect `kind`:
|
|
15
|
+
* - `\"call_llm\"` → `messages`, `tools` (includes meta-tools when configured)
|
|
16
|
+
* - `\"execute_tools\"` → `calls`
|
|
17
|
+
* - `\"done\"` → `result`
|
|
18
|
+
*/
|
|
19
|
+
export interface LoopAction {
|
|
20
|
+
kind: string;
|
|
21
|
+
messages?: Message[];
|
|
22
|
+
tools?: ToolSchema[];
|
|
23
|
+
calls?: ToolCall[];
|
|
24
|
+
result?: LoopResult;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface ContentPartObj {
|
|
28
|
+
type: string;
|
|
29
|
+
text?: string;
|
|
30
|
+
url?: string;
|
|
31
|
+
data?: string;
|
|
32
|
+
mediaType?: string;
|
|
33
|
+
detail?: string;
|
|
34
|
+
callId?: string;
|
|
35
|
+
output?: string;
|
|
36
|
+
isError?: boolean;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface Criterion {
|
|
40
|
+
text: string;
|
|
41
|
+
required: boolean;
|
|
42
|
+
weight?: number;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export interface CriterionResult {
|
|
46
|
+
criterion: string;
|
|
47
|
+
passed: boolean;
|
|
48
|
+
score: number;
|
|
49
|
+
feedback: string;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface EvalPipelineAction {
|
|
53
|
+
kind: string;
|
|
54
|
+
messages?: Message[];
|
|
55
|
+
passed?: boolean;
|
|
56
|
+
overallScore?: number;
|
|
57
|
+
feedback?: string;
|
|
58
|
+
details?: CriterionResult[];
|
|
59
|
+
skillCandidate?: SkillCandidate;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export interface EvalPipelineOptions {
|
|
63
|
+
extractSkillOnPass?: boolean;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export interface GovernanceVerdict {
|
|
67
|
+
kind: string;
|
|
68
|
+
reason?: string;
|
|
69
|
+
retryAfterMs?: number;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export interface LoopPolicy {
|
|
73
|
+
maxTokens: number;
|
|
74
|
+
maxTurns?: number;
|
|
75
|
+
maxTotalTokens?: number;
|
|
76
|
+
timeoutMs?: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface LoopResult {
|
|
80
|
+
termination: string;
|
|
81
|
+
finalMessage?: Message;
|
|
82
|
+
turnsUsed: number;
|
|
83
|
+
totalTokensUsed: number;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface Message {
|
|
87
|
+
role: string;
|
|
88
|
+
content: string;
|
|
89
|
+
contentParts?: ContentPartObj[];
|
|
90
|
+
tokenCount?: number;
|
|
91
|
+
toolCalls?: ToolCall[];
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export interface RuntimeSignal {
|
|
95
|
+
id: string;
|
|
96
|
+
/**
|
|
97
|
+
* \"cron\" | \"gateway\" | \"heartbeat\" | \"custom\
|
|
98
|
+
*/
|
|
99
|
+
source: string;
|
|
100
|
+
/**
|
|
101
|
+
* \"event\" | \"job\" | \"alert\
|
|
102
|
+
*/
|
|
103
|
+
signalType: string;
|
|
104
|
+
/**
|
|
105
|
+
* \"low\" | \"normal\" | \"high\" | \"critical\
|
|
106
|
+
*/
|
|
107
|
+
urgency: string;
|
|
108
|
+
summary: string;
|
|
109
|
+
payload: string;
|
|
110
|
+
dedupeKey?: string;
|
|
111
|
+
timestampMs: number;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export interface RuntimeTask {
|
|
115
|
+
goal: string;
|
|
116
|
+
criteria?: string[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface SkillCandidate {
|
|
120
|
+
name: string;
|
|
121
|
+
description: string;
|
|
122
|
+
whenToUse?: string;
|
|
123
|
+
content: string;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
export interface SkillMetadata {
|
|
127
|
+
name: string;
|
|
128
|
+
description?: string;
|
|
129
|
+
whenToUse?: string;
|
|
130
|
+
allowedTools?: string[];
|
|
131
|
+
effort?: number;
|
|
132
|
+
estimatedTokens?: number;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export interface ToolCall {
|
|
136
|
+
id: string;
|
|
137
|
+
name: string;
|
|
138
|
+
arguments: string;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export interface ToolResult {
|
|
142
|
+
callId: string;
|
|
143
|
+
output: string;
|
|
144
|
+
isError?: boolean;
|
|
145
|
+
tokenCount?: number;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export interface ToolSchema {
|
|
149
|
+
name: string;
|
|
150
|
+
description: string;
|
|
151
|
+
parameters: string;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
|
|
155
|
+
export class ContextEngine {
|
|
156
|
+
free(): void;
|
|
157
|
+
[Symbol.dispose](): void;
|
|
158
|
+
addAssistantMessage(content: string, tokens: number): void;
|
|
159
|
+
addSystemMessage(content: string, tokens: number): void;
|
|
160
|
+
addUserMessage(content: string, tokens: number): void;
|
|
161
|
+
compress(): number;
|
|
162
|
+
constructor(max_tokens: number);
|
|
163
|
+
pressure(): number;
|
|
164
|
+
render(): Message[];
|
|
165
|
+
setAvailableSkills(skills: SkillMetadata[]): void;
|
|
166
|
+
totalTokens(): number;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export class EvalPipeline {
|
|
170
|
+
free(): void;
|
|
171
|
+
[Symbol.dispose](): void;
|
|
172
|
+
feedEvalResult(content: string): EvalPipelineAction;
|
|
173
|
+
feedOutcome(goal: string, criteria: Criterion[], result: string, attempt: number): EvalPipelineAction;
|
|
174
|
+
isIdle(): boolean;
|
|
175
|
+
constructor(options: EvalPipelineOptions);
|
|
176
|
+
reset(): void;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
export class Governance {
|
|
180
|
+
free(): void;
|
|
181
|
+
[Symbol.dispose](): void;
|
|
182
|
+
blockTool(name: string): void;
|
|
183
|
+
evaluate(tool_name: string, args_json: string): GovernanceVerdict;
|
|
184
|
+
constructor();
|
|
185
|
+
setTime(now_ms: number): void;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
export class LoopStateMachine {
|
|
189
|
+
free(): void;
|
|
190
|
+
[Symbol.dispose](): void;
|
|
191
|
+
/**
|
|
192
|
+
* Pre-populate the memory partition with a long-term memory snippet.
|
|
193
|
+
* Must be called before `start`. Use for seeding known context from past sessions.
|
|
194
|
+
* `tokens` is a caller-supplied estimate; pass at least 1.
|
|
195
|
+
*/
|
|
196
|
+
addMemoryMessage(content: string, tokens: number): void;
|
|
197
|
+
/**
|
|
198
|
+
* Prepend a system-level instruction to the context. Must be called before `start`.
|
|
199
|
+
* `tokens` is a caller-supplied estimate (use `content.length / 4` if unsure).
|
|
200
|
+
* The renderer skips messages with `tokens == 0`, so always pass at least 1.
|
|
201
|
+
*/
|
|
202
|
+
addSystemMessage(content: string, tokens: number): void;
|
|
203
|
+
feedLlmResponse(message: Message): LoopAction;
|
|
204
|
+
feedTimeout(): LoopAction;
|
|
205
|
+
feedToolResults(results: ToolResult[]): LoopAction;
|
|
206
|
+
isTerminal(): boolean;
|
|
207
|
+
constructor(policy: LoopPolicy);
|
|
208
|
+
pressure(): number;
|
|
209
|
+
render(): Message[];
|
|
210
|
+
setAvailableSkills(skills: SkillMetadata[]): void;
|
|
211
|
+
setKnowledgeEnabled(enabled: boolean): void;
|
|
212
|
+
setMemoryEnabled(enabled: boolean): void;
|
|
213
|
+
setTools(tools: ToolSchema[]): void;
|
|
214
|
+
start(task: RuntimeTask): LoopAction;
|
|
215
|
+
takeObservations(): LoopObservation[];
|
|
216
|
+
readonly turn: number;
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export class SignalRouter {
|
|
220
|
+
free(): void;
|
|
221
|
+
[Symbol.dispose](): void;
|
|
222
|
+
clearDedup(): void;
|
|
223
|
+
depth(): number;
|
|
224
|
+
/**
|
|
225
|
+
* Ingest a signal. Returns disposition: "ignore"|"observe"|"queue"|"run"|"interrupt"|"interrupt_now"|"dropped"
|
|
226
|
+
*/
|
|
227
|
+
ingest(signal: RuntimeSignal, is_running: boolean): string;
|
|
228
|
+
constructor(max_queue_size: number);
|
|
229
|
+
/**
|
|
230
|
+
* Pull the next queued signal (highest priority first).
|
|
231
|
+
*/
|
|
232
|
+
next(): RuntimeSignal | undefined;
|
|
233
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/* @ts-self-types="./deepstrike_wasm.d.ts" */
|
|
2
|
+
import * as wasm from "./deepstrike_wasm_bg.wasm";
|
|
3
|
+
import { __wbg_set_wasm } from "./deepstrike_wasm_bg.js";
|
|
4
|
+
|
|
5
|
+
__wbg_set_wasm(wasm);
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
ContextEngine, EvalPipeline, Governance, LoopStateMachine, SignalRouter
|
|
9
|
+
} from "./deepstrike_wasm_bg.js";
|
|
@@ -0,0 +1,861 @@
|
|
|
1
|
+
export class ContextEngine {
|
|
2
|
+
__destroy_into_raw() {
|
|
3
|
+
const ptr = this.__wbg_ptr;
|
|
4
|
+
this.__wbg_ptr = 0;
|
|
5
|
+
ContextEngineFinalization.unregister(this);
|
|
6
|
+
return ptr;
|
|
7
|
+
}
|
|
8
|
+
free() {
|
|
9
|
+
const ptr = this.__destroy_into_raw();
|
|
10
|
+
wasm.__wbg_contextengine_free(ptr, 0);
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @param {string} content
|
|
14
|
+
* @param {number} tokens
|
|
15
|
+
*/
|
|
16
|
+
addAssistantMessage(content, tokens) {
|
|
17
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
18
|
+
const len0 = WASM_VECTOR_LEN;
|
|
19
|
+
wasm.contextengine_addAssistantMessage(this.__wbg_ptr, ptr0, len0, tokens);
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @param {string} content
|
|
23
|
+
* @param {number} tokens
|
|
24
|
+
*/
|
|
25
|
+
addSystemMessage(content, tokens) {
|
|
26
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
27
|
+
const len0 = WASM_VECTOR_LEN;
|
|
28
|
+
wasm.contextengine_addSystemMessage(this.__wbg_ptr, ptr0, len0, tokens);
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* @param {string} content
|
|
32
|
+
* @param {number} tokens
|
|
33
|
+
*/
|
|
34
|
+
addUserMessage(content, tokens) {
|
|
35
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
36
|
+
const len0 = WASM_VECTOR_LEN;
|
|
37
|
+
wasm.contextengine_addUserMessage(this.__wbg_ptr, ptr0, len0, tokens);
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* @returns {number}
|
|
41
|
+
*/
|
|
42
|
+
compress() {
|
|
43
|
+
const ret = wasm.contextengine_compress(this.__wbg_ptr);
|
|
44
|
+
return ret >>> 0;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* @param {number} max_tokens
|
|
48
|
+
*/
|
|
49
|
+
constructor(max_tokens) {
|
|
50
|
+
const ret = wasm.contextengine_new(max_tokens);
|
|
51
|
+
this.__wbg_ptr = ret;
|
|
52
|
+
ContextEngineFinalization.register(this, this.__wbg_ptr, this);
|
|
53
|
+
return this;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* @returns {number}
|
|
57
|
+
*/
|
|
58
|
+
pressure() {
|
|
59
|
+
const ret = wasm.contextengine_pressure(this.__wbg_ptr);
|
|
60
|
+
return ret;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @returns {Message[]}
|
|
64
|
+
*/
|
|
65
|
+
render() {
|
|
66
|
+
try {
|
|
67
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
68
|
+
wasm.contextengine_render(retptr, this.__wbg_ptr);
|
|
69
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
70
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
71
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
72
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
73
|
+
return v1;
|
|
74
|
+
} finally {
|
|
75
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* @param {SkillMetadata[]} skills
|
|
80
|
+
*/
|
|
81
|
+
setAvailableSkills(skills) {
|
|
82
|
+
const ptr0 = passArrayJsValueToWasm0(skills, wasm.__wbindgen_export);
|
|
83
|
+
const len0 = WASM_VECTOR_LEN;
|
|
84
|
+
wasm.contextengine_setAvailableSkills(this.__wbg_ptr, ptr0, len0);
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* @returns {number}
|
|
88
|
+
*/
|
|
89
|
+
totalTokens() {
|
|
90
|
+
const ret = wasm.contextengine_totalTokens(this.__wbg_ptr);
|
|
91
|
+
return ret >>> 0;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
if (Symbol.dispose) ContextEngine.prototype[Symbol.dispose] = ContextEngine.prototype.free;
|
|
95
|
+
|
|
96
|
+
export class EvalPipeline {
|
|
97
|
+
__destroy_into_raw() {
|
|
98
|
+
const ptr = this.__wbg_ptr;
|
|
99
|
+
this.__wbg_ptr = 0;
|
|
100
|
+
EvalPipelineFinalization.unregister(this);
|
|
101
|
+
return ptr;
|
|
102
|
+
}
|
|
103
|
+
free() {
|
|
104
|
+
const ptr = this.__destroy_into_raw();
|
|
105
|
+
wasm.__wbg_evalpipeline_free(ptr, 0);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @param {string} content
|
|
109
|
+
* @returns {EvalPipelineAction}
|
|
110
|
+
*/
|
|
111
|
+
feedEvalResult(content) {
|
|
112
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
113
|
+
const len0 = WASM_VECTOR_LEN;
|
|
114
|
+
const ret = wasm.evalpipeline_feedEvalResult(this.__wbg_ptr, ptr0, len0);
|
|
115
|
+
return takeObject(ret);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* @param {string} goal
|
|
119
|
+
* @param {Criterion[]} criteria
|
|
120
|
+
* @param {string} result
|
|
121
|
+
* @param {number} attempt
|
|
122
|
+
* @returns {EvalPipelineAction}
|
|
123
|
+
*/
|
|
124
|
+
feedOutcome(goal, criteria, result, attempt) {
|
|
125
|
+
const ptr0 = passStringToWasm0(goal, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
126
|
+
const len0 = WASM_VECTOR_LEN;
|
|
127
|
+
const ptr1 = passArrayJsValueToWasm0(criteria, wasm.__wbindgen_export);
|
|
128
|
+
const len1 = WASM_VECTOR_LEN;
|
|
129
|
+
const ptr2 = passStringToWasm0(result, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
130
|
+
const len2 = WASM_VECTOR_LEN;
|
|
131
|
+
const ret = wasm.evalpipeline_feedOutcome(this.__wbg_ptr, ptr0, len0, ptr1, len1, ptr2, len2, attempt);
|
|
132
|
+
return takeObject(ret);
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* @returns {boolean}
|
|
136
|
+
*/
|
|
137
|
+
isIdle() {
|
|
138
|
+
const ret = wasm.evalpipeline_isIdle(this.__wbg_ptr);
|
|
139
|
+
return ret !== 0;
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* @param {EvalPipelineOptions} options
|
|
143
|
+
*/
|
|
144
|
+
constructor(options) {
|
|
145
|
+
const ret = wasm.evalpipeline_new(addHeapObject(options));
|
|
146
|
+
this.__wbg_ptr = ret;
|
|
147
|
+
EvalPipelineFinalization.register(this, this.__wbg_ptr, this);
|
|
148
|
+
return this;
|
|
149
|
+
}
|
|
150
|
+
reset() {
|
|
151
|
+
wasm.evalpipeline_reset(this.__wbg_ptr);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
if (Symbol.dispose) EvalPipeline.prototype[Symbol.dispose] = EvalPipeline.prototype.free;
|
|
155
|
+
|
|
156
|
+
export class Governance {
|
|
157
|
+
__destroy_into_raw() {
|
|
158
|
+
const ptr = this.__wbg_ptr;
|
|
159
|
+
this.__wbg_ptr = 0;
|
|
160
|
+
GovernanceFinalization.unregister(this);
|
|
161
|
+
return ptr;
|
|
162
|
+
}
|
|
163
|
+
free() {
|
|
164
|
+
const ptr = this.__destroy_into_raw();
|
|
165
|
+
wasm.__wbg_governance_free(ptr, 0);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* @param {string} name
|
|
169
|
+
*/
|
|
170
|
+
blockTool(name) {
|
|
171
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
172
|
+
const len0 = WASM_VECTOR_LEN;
|
|
173
|
+
wasm.governance_blockTool(this.__wbg_ptr, ptr0, len0);
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @param {string} tool_name
|
|
177
|
+
* @param {string} args_json
|
|
178
|
+
* @returns {GovernanceVerdict}
|
|
179
|
+
*/
|
|
180
|
+
evaluate(tool_name, args_json) {
|
|
181
|
+
const ptr0 = passStringToWasm0(tool_name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
182
|
+
const len0 = WASM_VECTOR_LEN;
|
|
183
|
+
const ptr1 = passStringToWasm0(args_json, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
184
|
+
const len1 = WASM_VECTOR_LEN;
|
|
185
|
+
const ret = wasm.governance_evaluate(this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
186
|
+
return takeObject(ret);
|
|
187
|
+
}
|
|
188
|
+
constructor() {
|
|
189
|
+
const ret = wasm.governance_new();
|
|
190
|
+
this.__wbg_ptr = ret;
|
|
191
|
+
GovernanceFinalization.register(this, this.__wbg_ptr, this);
|
|
192
|
+
return this;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* @param {number} now_ms
|
|
196
|
+
*/
|
|
197
|
+
setTime(now_ms) {
|
|
198
|
+
wasm.governance_setTime(this.__wbg_ptr, now_ms);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (Symbol.dispose) Governance.prototype[Symbol.dispose] = Governance.prototype.free;
|
|
202
|
+
|
|
203
|
+
export class LoopStateMachine {
|
|
204
|
+
__destroy_into_raw() {
|
|
205
|
+
const ptr = this.__wbg_ptr;
|
|
206
|
+
this.__wbg_ptr = 0;
|
|
207
|
+
LoopStateMachineFinalization.unregister(this);
|
|
208
|
+
return ptr;
|
|
209
|
+
}
|
|
210
|
+
free() {
|
|
211
|
+
const ptr = this.__destroy_into_raw();
|
|
212
|
+
wasm.__wbg_loopstatemachine_free(ptr, 0);
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Pre-populate the memory partition with a long-term memory snippet.
|
|
216
|
+
* Must be called before `start`. Use for seeding known context from past sessions.
|
|
217
|
+
* `tokens` is a caller-supplied estimate; pass at least 1.
|
|
218
|
+
* @param {string} content
|
|
219
|
+
* @param {number} tokens
|
|
220
|
+
*/
|
|
221
|
+
addMemoryMessage(content, tokens) {
|
|
222
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
223
|
+
const len0 = WASM_VECTOR_LEN;
|
|
224
|
+
wasm.loopstatemachine_addMemoryMessage(this.__wbg_ptr, ptr0, len0, tokens);
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* Prepend a system-level instruction to the context. Must be called before `start`.
|
|
228
|
+
* `tokens` is a caller-supplied estimate (use `content.length / 4` if unsure).
|
|
229
|
+
* The renderer skips messages with `tokens == 0`, so always pass at least 1.
|
|
230
|
+
* @param {string} content
|
|
231
|
+
* @param {number} tokens
|
|
232
|
+
*/
|
|
233
|
+
addSystemMessage(content, tokens) {
|
|
234
|
+
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
235
|
+
const len0 = WASM_VECTOR_LEN;
|
|
236
|
+
wasm.loopstatemachine_addSystemMessage(this.__wbg_ptr, ptr0, len0, tokens);
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* @param {Message} message
|
|
240
|
+
* @returns {LoopAction}
|
|
241
|
+
*/
|
|
242
|
+
feedLlmResponse(message) {
|
|
243
|
+
try {
|
|
244
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
245
|
+
wasm.loopstatemachine_feedLlmResponse(retptr, this.__wbg_ptr, addHeapObject(message));
|
|
246
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
247
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
248
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
249
|
+
if (r2) {
|
|
250
|
+
throw takeObject(r1);
|
|
251
|
+
}
|
|
252
|
+
return takeObject(r0);
|
|
253
|
+
} finally {
|
|
254
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* @returns {LoopAction}
|
|
259
|
+
*/
|
|
260
|
+
feedTimeout() {
|
|
261
|
+
const ret = wasm.loopstatemachine_feedTimeout(this.__wbg_ptr);
|
|
262
|
+
return takeObject(ret);
|
|
263
|
+
}
|
|
264
|
+
/**
|
|
265
|
+
* @param {ToolResult[]} results
|
|
266
|
+
* @returns {LoopAction}
|
|
267
|
+
*/
|
|
268
|
+
feedToolResults(results) {
|
|
269
|
+
const ptr0 = passArrayJsValueToWasm0(results, wasm.__wbindgen_export);
|
|
270
|
+
const len0 = WASM_VECTOR_LEN;
|
|
271
|
+
const ret = wasm.loopstatemachine_feedToolResults(this.__wbg_ptr, ptr0, len0);
|
|
272
|
+
return takeObject(ret);
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @returns {boolean}
|
|
276
|
+
*/
|
|
277
|
+
isTerminal() {
|
|
278
|
+
const ret = wasm.loopstatemachine_isTerminal(this.__wbg_ptr);
|
|
279
|
+
return ret !== 0;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* @param {LoopPolicy} policy
|
|
283
|
+
*/
|
|
284
|
+
constructor(policy) {
|
|
285
|
+
const ret = wasm.loopstatemachine_new(addHeapObject(policy));
|
|
286
|
+
this.__wbg_ptr = ret;
|
|
287
|
+
LoopStateMachineFinalization.register(this, this.__wbg_ptr, this);
|
|
288
|
+
return this;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* @returns {number}
|
|
292
|
+
*/
|
|
293
|
+
pressure() {
|
|
294
|
+
const ret = wasm.loopstatemachine_pressure(this.__wbg_ptr);
|
|
295
|
+
return ret;
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* @returns {Message[]}
|
|
299
|
+
*/
|
|
300
|
+
render() {
|
|
301
|
+
try {
|
|
302
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
303
|
+
wasm.loopstatemachine_render(retptr, this.__wbg_ptr);
|
|
304
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
305
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
306
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
307
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
308
|
+
return v1;
|
|
309
|
+
} finally {
|
|
310
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* @param {SkillMetadata[]} skills
|
|
315
|
+
*/
|
|
316
|
+
setAvailableSkills(skills) {
|
|
317
|
+
const ptr0 = passArrayJsValueToWasm0(skills, wasm.__wbindgen_export);
|
|
318
|
+
const len0 = WASM_VECTOR_LEN;
|
|
319
|
+
wasm.loopstatemachine_setAvailableSkills(this.__wbg_ptr, ptr0, len0);
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* @param {boolean} enabled
|
|
323
|
+
*/
|
|
324
|
+
setKnowledgeEnabled(enabled) {
|
|
325
|
+
wasm.loopstatemachine_setKnowledgeEnabled(this.__wbg_ptr, enabled);
|
|
326
|
+
}
|
|
327
|
+
/**
|
|
328
|
+
* @param {boolean} enabled
|
|
329
|
+
*/
|
|
330
|
+
setMemoryEnabled(enabled) {
|
|
331
|
+
wasm.loopstatemachine_setMemoryEnabled(this.__wbg_ptr, enabled);
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* @param {ToolSchema[]} tools
|
|
335
|
+
*/
|
|
336
|
+
setTools(tools) {
|
|
337
|
+
try {
|
|
338
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
339
|
+
const ptr0 = passArrayJsValueToWasm0(tools, wasm.__wbindgen_export);
|
|
340
|
+
const len0 = WASM_VECTOR_LEN;
|
|
341
|
+
wasm.loopstatemachine_setTools(retptr, this.__wbg_ptr, ptr0, len0);
|
|
342
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
343
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
344
|
+
if (r1) {
|
|
345
|
+
throw takeObject(r0);
|
|
346
|
+
}
|
|
347
|
+
} finally {
|
|
348
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
349
|
+
}
|
|
350
|
+
}
|
|
351
|
+
/**
|
|
352
|
+
* @param {RuntimeTask} task
|
|
353
|
+
* @returns {LoopAction}
|
|
354
|
+
*/
|
|
355
|
+
start(task) {
|
|
356
|
+
const ret = wasm.loopstatemachine_start(this.__wbg_ptr, addHeapObject(task));
|
|
357
|
+
return takeObject(ret);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* @returns {LoopObservation[]}
|
|
361
|
+
*/
|
|
362
|
+
takeObservations() {
|
|
363
|
+
try {
|
|
364
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
365
|
+
wasm.loopstatemachine_takeObservations(retptr, this.__wbg_ptr);
|
|
366
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
367
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
368
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
369
|
+
wasm.__wbindgen_export4(r0, r1 * 4, 4);
|
|
370
|
+
return v1;
|
|
371
|
+
} finally {
|
|
372
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* @returns {number}
|
|
377
|
+
*/
|
|
378
|
+
get turn() {
|
|
379
|
+
const ret = wasm.loopstatemachine_turn(this.__wbg_ptr);
|
|
380
|
+
return ret >>> 0;
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
if (Symbol.dispose) LoopStateMachine.prototype[Symbol.dispose] = LoopStateMachine.prototype.free;
|
|
384
|
+
|
|
385
|
+
export class SignalRouter {
|
|
386
|
+
__destroy_into_raw() {
|
|
387
|
+
const ptr = this.__wbg_ptr;
|
|
388
|
+
this.__wbg_ptr = 0;
|
|
389
|
+
SignalRouterFinalization.unregister(this);
|
|
390
|
+
return ptr;
|
|
391
|
+
}
|
|
392
|
+
free() {
|
|
393
|
+
const ptr = this.__destroy_into_raw();
|
|
394
|
+
wasm.__wbg_signalrouter_free(ptr, 0);
|
|
395
|
+
}
|
|
396
|
+
clearDedup() {
|
|
397
|
+
wasm.signalrouter_clearDedup(this.__wbg_ptr);
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* @returns {number}
|
|
401
|
+
*/
|
|
402
|
+
depth() {
|
|
403
|
+
const ret = wasm.signalrouter_depth(this.__wbg_ptr);
|
|
404
|
+
return ret >>> 0;
|
|
405
|
+
}
|
|
406
|
+
/**
|
|
407
|
+
* Ingest a signal. Returns disposition: "ignore"|"observe"|"queue"|"run"|"interrupt"|"interrupt_now"|"dropped"
|
|
408
|
+
* @param {RuntimeSignal} signal
|
|
409
|
+
* @param {boolean} is_running
|
|
410
|
+
* @returns {string}
|
|
411
|
+
*/
|
|
412
|
+
ingest(signal, is_running) {
|
|
413
|
+
let deferred1_0;
|
|
414
|
+
let deferred1_1;
|
|
415
|
+
try {
|
|
416
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
417
|
+
wasm.signalrouter_ingest(retptr, this.__wbg_ptr, addHeapObject(signal), is_running);
|
|
418
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
419
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
420
|
+
deferred1_0 = r0;
|
|
421
|
+
deferred1_1 = r1;
|
|
422
|
+
return getStringFromWasm0(r0, r1);
|
|
423
|
+
} finally {
|
|
424
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
425
|
+
wasm.__wbindgen_export4(deferred1_0, deferred1_1, 1);
|
|
426
|
+
}
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* @param {number} max_queue_size
|
|
430
|
+
*/
|
|
431
|
+
constructor(max_queue_size) {
|
|
432
|
+
const ret = wasm.signalrouter_new(max_queue_size);
|
|
433
|
+
this.__wbg_ptr = ret;
|
|
434
|
+
SignalRouterFinalization.register(this, this.__wbg_ptr, this);
|
|
435
|
+
return this;
|
|
436
|
+
}
|
|
437
|
+
/**
|
|
438
|
+
* Pull the next queued signal (highest priority first).
|
|
439
|
+
* @returns {RuntimeSignal | undefined}
|
|
440
|
+
*/
|
|
441
|
+
next() {
|
|
442
|
+
const ret = wasm.signalrouter_next(this.__wbg_ptr);
|
|
443
|
+
return takeObject(ret);
|
|
444
|
+
}
|
|
445
|
+
}
|
|
446
|
+
if (Symbol.dispose) SignalRouter.prototype[Symbol.dispose] = SignalRouter.prototype.free;
|
|
447
|
+
export function __wbg_Error_bce6d499ff0a4aff(arg0, arg1) {
|
|
448
|
+
const ret = Error(getStringFromWasm0(arg0, arg1));
|
|
449
|
+
return addHeapObject(ret);
|
|
450
|
+
}
|
|
451
|
+
export function __wbg_Number_b7972a139bfbfdf0(arg0) {
|
|
452
|
+
const ret = Number(getObject(arg0));
|
|
453
|
+
return ret;
|
|
454
|
+
}
|
|
455
|
+
export function __wbg_String_8564e559799eccda(arg0, arg1) {
|
|
456
|
+
const ret = String(getObject(arg1));
|
|
457
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
458
|
+
const len1 = WASM_VECTOR_LEN;
|
|
459
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
460
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
461
|
+
}
|
|
462
|
+
export function __wbg___wbindgen_boolean_get_2304fb8c853028c8(arg0) {
|
|
463
|
+
const v = getObject(arg0);
|
|
464
|
+
const ret = typeof(v) === 'boolean' ? v : undefined;
|
|
465
|
+
return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
|
|
466
|
+
}
|
|
467
|
+
export function __wbg___wbindgen_debug_string_edece8177ad01481(arg0, arg1) {
|
|
468
|
+
const ret = debugString(getObject(arg1));
|
|
469
|
+
const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
470
|
+
const len1 = WASM_VECTOR_LEN;
|
|
471
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
472
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
473
|
+
}
|
|
474
|
+
export function __wbg___wbindgen_in_07056af4f902c445(arg0, arg1) {
|
|
475
|
+
const ret = getObject(arg0) in getObject(arg1);
|
|
476
|
+
return ret;
|
|
477
|
+
}
|
|
478
|
+
export function __wbg___wbindgen_is_function_5cd60d5cf78b4eef(arg0) {
|
|
479
|
+
const ret = typeof(getObject(arg0)) === 'function';
|
|
480
|
+
return ret;
|
|
481
|
+
}
|
|
482
|
+
export function __wbg___wbindgen_is_object_b4593df85baada48(arg0) {
|
|
483
|
+
const val = getObject(arg0);
|
|
484
|
+
const ret = typeof(val) === 'object' && val !== null;
|
|
485
|
+
return ret;
|
|
486
|
+
}
|
|
487
|
+
export function __wbg___wbindgen_is_undefined_35bb9f4c7fd651d5(arg0) {
|
|
488
|
+
const ret = getObject(arg0) === undefined;
|
|
489
|
+
return ret;
|
|
490
|
+
}
|
|
491
|
+
export function __wbg___wbindgen_jsval_loose_eq_0ad77b7717db155c(arg0, arg1) {
|
|
492
|
+
const ret = getObject(arg0) == getObject(arg1);
|
|
493
|
+
return ret;
|
|
494
|
+
}
|
|
495
|
+
export function __wbg___wbindgen_number_get_f73a1244370fcc2c(arg0, arg1) {
|
|
496
|
+
const obj = getObject(arg1);
|
|
497
|
+
const ret = typeof(obj) === 'number' ? obj : undefined;
|
|
498
|
+
getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
|
|
499
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
|
|
500
|
+
}
|
|
501
|
+
export function __wbg___wbindgen_string_get_d109740c0d18f4d7(arg0, arg1) {
|
|
502
|
+
const obj = getObject(arg1);
|
|
503
|
+
const ret = typeof(obj) === 'string' ? obj : undefined;
|
|
504
|
+
var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
505
|
+
var len1 = WASM_VECTOR_LEN;
|
|
506
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
|
|
507
|
+
getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
|
|
508
|
+
}
|
|
509
|
+
export function __wbg___wbindgen_throw_9c31b086c2b26051(arg0, arg1) {
|
|
510
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
511
|
+
}
|
|
512
|
+
export function __wbg_call_13665d9f14390edc() { return handleError(function (arg0, arg1) {
|
|
513
|
+
const ret = getObject(arg0).call(getObject(arg1));
|
|
514
|
+
return addHeapObject(ret);
|
|
515
|
+
}, arguments); }
|
|
516
|
+
export function __wbg_done_54b8da57023b7ed2(arg0) {
|
|
517
|
+
const ret = getObject(arg0).done;
|
|
518
|
+
return ret;
|
|
519
|
+
}
|
|
520
|
+
export function __wbg_getRandomValues_ef12552bf5acd2fe() { return handleError(function (arg0, arg1) {
|
|
521
|
+
globalThis.crypto.getRandomValues(getArrayU8FromWasm0(arg0, arg1));
|
|
522
|
+
}, arguments); }
|
|
523
|
+
export function __wbg_get_3e9a707ab7d352eb() { return handleError(function (arg0, arg1) {
|
|
524
|
+
const ret = Reflect.get(getObject(arg0), getObject(arg1));
|
|
525
|
+
return addHeapObject(ret);
|
|
526
|
+
}, arguments); }
|
|
527
|
+
export function __wbg_get_unchecked_1dfe6d05ad91d9b7(arg0, arg1) {
|
|
528
|
+
const ret = getObject(arg0)[arg1 >>> 0];
|
|
529
|
+
return addHeapObject(ret);
|
|
530
|
+
}
|
|
531
|
+
export function __wbg_get_with_ref_key_6412cf3094599694(arg0, arg1) {
|
|
532
|
+
const ret = getObject(arg0)[getObject(arg1)];
|
|
533
|
+
return addHeapObject(ret);
|
|
534
|
+
}
|
|
535
|
+
export function __wbg_instanceof_ArrayBuffer_53db37b06f6b9afe(arg0) {
|
|
536
|
+
let result;
|
|
537
|
+
try {
|
|
538
|
+
result = getObject(arg0) instanceof ArrayBuffer;
|
|
539
|
+
} catch (_) {
|
|
540
|
+
result = false;
|
|
541
|
+
}
|
|
542
|
+
const ret = result;
|
|
543
|
+
return ret;
|
|
544
|
+
}
|
|
545
|
+
export function __wbg_instanceof_Uint8Array_abd07d4bd221d50b(arg0) {
|
|
546
|
+
let result;
|
|
547
|
+
try {
|
|
548
|
+
result = getObject(arg0) instanceof Uint8Array;
|
|
549
|
+
} catch (_) {
|
|
550
|
+
result = false;
|
|
551
|
+
}
|
|
552
|
+
const ret = result;
|
|
553
|
+
return ret;
|
|
554
|
+
}
|
|
555
|
+
export function __wbg_isArray_94898ed3aad6947b(arg0) {
|
|
556
|
+
const ret = Array.isArray(getObject(arg0));
|
|
557
|
+
return ret;
|
|
558
|
+
}
|
|
559
|
+
export function __wbg_isSafeInteger_01e964d144ad3a55(arg0) {
|
|
560
|
+
const ret = Number.isSafeInteger(getObject(arg0));
|
|
561
|
+
return ret;
|
|
562
|
+
}
|
|
563
|
+
export function __wbg_iterator_1441b47f341dc34f() {
|
|
564
|
+
const ret = Symbol.iterator;
|
|
565
|
+
return addHeapObject(ret);
|
|
566
|
+
}
|
|
567
|
+
export function __wbg_length_2591a0f4f659a55c(arg0) {
|
|
568
|
+
const ret = getObject(arg0).length;
|
|
569
|
+
return ret;
|
|
570
|
+
}
|
|
571
|
+
export function __wbg_length_56fcd3e2b7e0299d(arg0) {
|
|
572
|
+
const ret = getObject(arg0).length;
|
|
573
|
+
return ret;
|
|
574
|
+
}
|
|
575
|
+
export function __wbg_new_02d162bc6cf02f60() {
|
|
576
|
+
const ret = new Object();
|
|
577
|
+
return addHeapObject(ret);
|
|
578
|
+
}
|
|
579
|
+
export function __wbg_new_310879b66b6e95e1() {
|
|
580
|
+
const ret = new Array();
|
|
581
|
+
return addHeapObject(ret);
|
|
582
|
+
}
|
|
583
|
+
export function __wbg_new_7ddec6de44ff8f5d(arg0) {
|
|
584
|
+
const ret = new Uint8Array(getObject(arg0));
|
|
585
|
+
return addHeapObject(ret);
|
|
586
|
+
}
|
|
587
|
+
export function __wbg_next_2a4e19f4f5083b0f(arg0) {
|
|
588
|
+
const ret = getObject(arg0).next;
|
|
589
|
+
return addHeapObject(ret);
|
|
590
|
+
}
|
|
591
|
+
export function __wbg_next_6429a146bf756f93() { return handleError(function (arg0) {
|
|
592
|
+
const ret = getObject(arg0).next();
|
|
593
|
+
return addHeapObject(ret);
|
|
594
|
+
}, arguments); }
|
|
595
|
+
export function __wbg_prototypesetcall_5f9bdc8d75e07276(arg0, arg1, arg2) {
|
|
596
|
+
Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
|
|
597
|
+
}
|
|
598
|
+
export function __wbg_set_6be42768c690e380(arg0, arg1, arg2) {
|
|
599
|
+
getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
|
|
600
|
+
}
|
|
601
|
+
export function __wbg_set_78ea6a19f4818587(arg0, arg1, arg2) {
|
|
602
|
+
getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
|
|
603
|
+
}
|
|
604
|
+
export function __wbg_value_9cc0518af87a489c(arg0) {
|
|
605
|
+
const ret = getObject(arg0).value;
|
|
606
|
+
return addHeapObject(ret);
|
|
607
|
+
}
|
|
608
|
+
export function __wbindgen_cast_0000000000000001(arg0) {
|
|
609
|
+
// Cast intrinsic for `F64 -> Externref`.
|
|
610
|
+
const ret = arg0;
|
|
611
|
+
return addHeapObject(ret);
|
|
612
|
+
}
|
|
613
|
+
export function __wbindgen_cast_0000000000000002(arg0, arg1) {
|
|
614
|
+
// Cast intrinsic for `Ref(String) -> Externref`.
|
|
615
|
+
const ret = getStringFromWasm0(arg0, arg1);
|
|
616
|
+
return addHeapObject(ret);
|
|
617
|
+
}
|
|
618
|
+
export function __wbindgen_object_clone_ref(arg0) {
|
|
619
|
+
const ret = getObject(arg0);
|
|
620
|
+
return addHeapObject(ret);
|
|
621
|
+
}
|
|
622
|
+
export function __wbindgen_object_drop_ref(arg0) {
|
|
623
|
+
takeObject(arg0);
|
|
624
|
+
}
|
|
625
|
+
const ContextEngineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
626
|
+
? { register: () => {}, unregister: () => {} }
|
|
627
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_contextengine_free(ptr, 1));
|
|
628
|
+
const EvalPipelineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
629
|
+
? { register: () => {}, unregister: () => {} }
|
|
630
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_evalpipeline_free(ptr, 1));
|
|
631
|
+
const GovernanceFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
632
|
+
? { register: () => {}, unregister: () => {} }
|
|
633
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_governance_free(ptr, 1));
|
|
634
|
+
const LoopStateMachineFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
635
|
+
? { register: () => {}, unregister: () => {} }
|
|
636
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_loopstatemachine_free(ptr, 1));
|
|
637
|
+
const SignalRouterFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
638
|
+
? { register: () => {}, unregister: () => {} }
|
|
639
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_signalrouter_free(ptr, 1));
|
|
640
|
+
|
|
641
|
+
function addHeapObject(obj) {
|
|
642
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
643
|
+
const idx = heap_next;
|
|
644
|
+
heap_next = heap[idx];
|
|
645
|
+
|
|
646
|
+
heap[idx] = obj;
|
|
647
|
+
return idx;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
function debugString(val) {
|
|
651
|
+
// primitive types
|
|
652
|
+
const type = typeof val;
|
|
653
|
+
if (type == 'number' || type == 'boolean' || val == null) {
|
|
654
|
+
return `${val}`;
|
|
655
|
+
}
|
|
656
|
+
if (type == 'string') {
|
|
657
|
+
return `"${val}"`;
|
|
658
|
+
}
|
|
659
|
+
if (type == 'symbol') {
|
|
660
|
+
const description = val.description;
|
|
661
|
+
if (description == null) {
|
|
662
|
+
return 'Symbol';
|
|
663
|
+
} else {
|
|
664
|
+
return `Symbol(${description})`;
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (type == 'function') {
|
|
668
|
+
const name = val.name;
|
|
669
|
+
if (typeof name == 'string' && name.length > 0) {
|
|
670
|
+
return `Function(${name})`;
|
|
671
|
+
} else {
|
|
672
|
+
return 'Function';
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
// objects
|
|
676
|
+
if (Array.isArray(val)) {
|
|
677
|
+
const length = val.length;
|
|
678
|
+
let debug = '[';
|
|
679
|
+
if (length > 0) {
|
|
680
|
+
debug += debugString(val[0]);
|
|
681
|
+
}
|
|
682
|
+
for(let i = 1; i < length; i++) {
|
|
683
|
+
debug += ', ' + debugString(val[i]);
|
|
684
|
+
}
|
|
685
|
+
debug += ']';
|
|
686
|
+
return debug;
|
|
687
|
+
}
|
|
688
|
+
// Test for built-in
|
|
689
|
+
const builtInMatches = /\[object ([^\]]+)\]/.exec(toString.call(val));
|
|
690
|
+
let className;
|
|
691
|
+
if (builtInMatches && builtInMatches.length > 1) {
|
|
692
|
+
className = builtInMatches[1];
|
|
693
|
+
} else {
|
|
694
|
+
// Failed to match the standard '[object ClassName]'
|
|
695
|
+
return toString.call(val);
|
|
696
|
+
}
|
|
697
|
+
if (className == 'Object') {
|
|
698
|
+
// we're a user defined class or Object
|
|
699
|
+
// JSON.stringify avoids problems with cycles, and is generally much
|
|
700
|
+
// easier than looping through ownProperties of `val`.
|
|
701
|
+
try {
|
|
702
|
+
return 'Object(' + JSON.stringify(val) + ')';
|
|
703
|
+
} catch (_) {
|
|
704
|
+
return 'Object';
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
// errors
|
|
708
|
+
if (val instanceof Error) {
|
|
709
|
+
return `${val.name}: ${val.message}\n${val.stack}`;
|
|
710
|
+
}
|
|
711
|
+
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
712
|
+
return className;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
function dropObject(idx) {
|
|
716
|
+
if (idx < 1028) return;
|
|
717
|
+
heap[idx] = heap_next;
|
|
718
|
+
heap_next = idx;
|
|
719
|
+
}
|
|
720
|
+
|
|
721
|
+
function getArrayJsValueFromWasm0(ptr, len) {
|
|
722
|
+
ptr = ptr >>> 0;
|
|
723
|
+
const mem = getDataViewMemory0();
|
|
724
|
+
const result = [];
|
|
725
|
+
for (let i = ptr; i < ptr + 4 * len; i += 4) {
|
|
726
|
+
result.push(takeObject(mem.getUint32(i, true)));
|
|
727
|
+
}
|
|
728
|
+
return result;
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
function getArrayU8FromWasm0(ptr, len) {
|
|
732
|
+
ptr = ptr >>> 0;
|
|
733
|
+
return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
|
|
734
|
+
}
|
|
735
|
+
|
|
736
|
+
let cachedDataViewMemory0 = null;
|
|
737
|
+
function getDataViewMemory0() {
|
|
738
|
+
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
|
|
739
|
+
cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
|
|
740
|
+
}
|
|
741
|
+
return cachedDataViewMemory0;
|
|
742
|
+
}
|
|
743
|
+
|
|
744
|
+
function getStringFromWasm0(ptr, len) {
|
|
745
|
+
return decodeText(ptr >>> 0, len);
|
|
746
|
+
}
|
|
747
|
+
|
|
748
|
+
let cachedUint8ArrayMemory0 = null;
|
|
749
|
+
function getUint8ArrayMemory0() {
|
|
750
|
+
if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
|
|
751
|
+
cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
|
|
752
|
+
}
|
|
753
|
+
return cachedUint8ArrayMemory0;
|
|
754
|
+
}
|
|
755
|
+
|
|
756
|
+
function getObject(idx) { return heap[idx]; }
|
|
757
|
+
|
|
758
|
+
function handleError(f, args) {
|
|
759
|
+
try {
|
|
760
|
+
return f.apply(this, args);
|
|
761
|
+
} catch (e) {
|
|
762
|
+
wasm.__wbindgen_export3(addHeapObject(e));
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
let heap = new Array(1024).fill(undefined);
|
|
767
|
+
heap.push(undefined, null, true, false);
|
|
768
|
+
|
|
769
|
+
let heap_next = heap.length;
|
|
770
|
+
|
|
771
|
+
function isLikeNone(x) {
|
|
772
|
+
return x === undefined || x === null;
|
|
773
|
+
}
|
|
774
|
+
|
|
775
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
776
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
777
|
+
const mem = getDataViewMemory0();
|
|
778
|
+
for (let i = 0; i < array.length; i++) {
|
|
779
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
780
|
+
}
|
|
781
|
+
WASM_VECTOR_LEN = array.length;
|
|
782
|
+
return ptr;
|
|
783
|
+
}
|
|
784
|
+
|
|
785
|
+
function passStringToWasm0(arg, malloc, realloc) {
|
|
786
|
+
if (realloc === undefined) {
|
|
787
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
788
|
+
const ptr = malloc(buf.length, 1) >>> 0;
|
|
789
|
+
getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
|
|
790
|
+
WASM_VECTOR_LEN = buf.length;
|
|
791
|
+
return ptr;
|
|
792
|
+
}
|
|
793
|
+
|
|
794
|
+
let len = arg.length;
|
|
795
|
+
let ptr = malloc(len, 1) >>> 0;
|
|
796
|
+
|
|
797
|
+
const mem = getUint8ArrayMemory0();
|
|
798
|
+
|
|
799
|
+
let offset = 0;
|
|
800
|
+
|
|
801
|
+
for (; offset < len; offset++) {
|
|
802
|
+
const code = arg.charCodeAt(offset);
|
|
803
|
+
if (code > 0x7F) break;
|
|
804
|
+
mem[ptr + offset] = code;
|
|
805
|
+
}
|
|
806
|
+
if (offset !== len) {
|
|
807
|
+
if (offset !== 0) {
|
|
808
|
+
arg = arg.slice(offset);
|
|
809
|
+
}
|
|
810
|
+
ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
|
|
811
|
+
const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
|
|
812
|
+
const ret = cachedTextEncoder.encodeInto(arg, view);
|
|
813
|
+
|
|
814
|
+
offset += ret.written;
|
|
815
|
+
ptr = realloc(ptr, len, offset, 1) >>> 0;
|
|
816
|
+
}
|
|
817
|
+
|
|
818
|
+
WASM_VECTOR_LEN = offset;
|
|
819
|
+
return ptr;
|
|
820
|
+
}
|
|
821
|
+
|
|
822
|
+
function takeObject(idx) {
|
|
823
|
+
const ret = getObject(idx);
|
|
824
|
+
dropObject(idx);
|
|
825
|
+
return ret;
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
829
|
+
cachedTextDecoder.decode();
|
|
830
|
+
const MAX_SAFARI_DECODE_BYTES = 2146435072;
|
|
831
|
+
let numBytesDecoded = 0;
|
|
832
|
+
function decodeText(ptr, len) {
|
|
833
|
+
numBytesDecoded += len;
|
|
834
|
+
if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
|
|
835
|
+
cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
836
|
+
cachedTextDecoder.decode();
|
|
837
|
+
numBytesDecoded = len;
|
|
838
|
+
}
|
|
839
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
840
|
+
}
|
|
841
|
+
|
|
842
|
+
const cachedTextEncoder = new TextEncoder();
|
|
843
|
+
|
|
844
|
+
if (!('encodeInto' in cachedTextEncoder)) {
|
|
845
|
+
cachedTextEncoder.encodeInto = function (arg, view) {
|
|
846
|
+
const buf = cachedTextEncoder.encode(arg);
|
|
847
|
+
view.set(buf);
|
|
848
|
+
return {
|
|
849
|
+
read: arg.length,
|
|
850
|
+
written: buf.length
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
}
|
|
854
|
+
|
|
855
|
+
let WASM_VECTOR_LEN = 0;
|
|
856
|
+
|
|
857
|
+
|
|
858
|
+
let wasm;
|
|
859
|
+
export function __wbg_set_wasm(val) {
|
|
860
|
+
wasm = val;
|
|
861
|
+
}
|
|
Binary file
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@deepstrike/wasm-kernel",
|
|
3
|
+
"type": "module",
|
|
4
|
+
"description": "WebAssembly bindings for DeepStrike runtime kernel",
|
|
5
|
+
"version": "0.1.6",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"files": [
|
|
8
|
+
"deepstrike_wasm_bg.wasm",
|
|
9
|
+
"deepstrike_wasm.js",
|
|
10
|
+
"deepstrike_wasm_bg.js",
|
|
11
|
+
"deepstrike_wasm.d.ts"
|
|
12
|
+
],
|
|
13
|
+
"main": "deepstrike_wasm.js",
|
|
14
|
+
"types": "deepstrike_wasm.d.ts",
|
|
15
|
+
"sideEffects": [
|
|
16
|
+
"./deepstrike_wasm.js",
|
|
17
|
+
"./snippets/*"
|
|
18
|
+
]
|
|
19
|
+
}
|