@h1r-ai/croche 0.0.0-stage → 0.5.1

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.
Files changed (105) hide show
  1. package/LICENSE +32 -0
  2. package/README.md +1184 -2
  3. package/THIRD-PARTY-NOTICES +5824 -0
  4. package/dist/archive.d.ts +47 -0
  5. package/dist/archive.js +217 -0
  6. package/dist/atomic-replace.d.ts +18 -0
  7. package/dist/atomic-replace.js +39 -0
  8. package/dist/commands.d.ts +56 -0
  9. package/dist/commands.js +1 -0
  10. package/dist/control.d.ts +62 -0
  11. package/dist/control.js +269 -0
  12. package/dist/core-abi.d.ts +110 -0
  13. package/dist/core-abi.js +1 -0
  14. package/dist/core-bindgen.d.ts +413 -0
  15. package/dist/core-bindgen.js +1533 -0
  16. package/dist/core-runtime.d.ts +214 -0
  17. package/dist/core-runtime.js +837 -0
  18. package/dist/core-wasm-bytes.d.ts +4 -0
  19. package/dist/core-wasm-bytes.js +5 -0
  20. package/dist/core-wasm.d.ts +16 -0
  21. package/dist/core-wasm.js +63 -0
  22. package/dist/debug.d.ts +26 -0
  23. package/dist/debug.js +171 -0
  24. package/dist/file-lock.d.ts +46 -0
  25. package/dist/file-lock.js +300 -0
  26. package/dist/images.d.ts +53 -0
  27. package/dist/images.js +179 -0
  28. package/dist/index.d.ts +14 -0
  29. package/dist/index.js +9 -0
  30. package/dist/markers.d.ts +1 -0
  31. package/dist/markers.js +1 -0
  32. package/dist/node.d.ts +46 -0
  33. package/dist/node.js +281 -0
  34. package/dist/project-core.d.ts +79 -0
  35. package/dist/project-core.js +261 -0
  36. package/dist/project-session.d.ts +44 -0
  37. package/dist/project-session.js +143 -0
  38. package/dist/project-types.d.ts +97 -0
  39. package/dist/project-types.js +1 -0
  40. package/dist/project-wire.d.ts +19 -0
  41. package/dist/project-wire.js +39 -0
  42. package/dist/sse.d.ts +19 -0
  43. package/dist/sse.js +53 -0
  44. package/dist/storage.d.ts +24 -0
  45. package/dist/storage.js +32 -0
  46. package/dist/stream-branch.d.ts +47 -0
  47. package/dist/stream-branch.js +107 -0
  48. package/dist/stream-hub.d.ts +207 -0
  49. package/dist/stream-hub.js +210 -0
  50. package/dist/stream.d.ts +3 -0
  51. package/dist/stream.js +5 -0
  52. package/dist/types.d.ts +928 -0
  53. package/dist/types.js +8 -0
  54. package/dist/wiki.d.ts +15 -0
  55. package/dist/wiki.js +25 -0
  56. package/docs/CODING-AGENT.md +96 -0
  57. package/docs/DEBUGGER.md +230 -0
  58. package/docs/S2-IMPLEMENTATION.md +585 -0
  59. package/docs/SKILL.md +337 -0
  60. package/docs/skills/croche/agents/openai.yaml +4 -0
  61. package/docs/skills/croche/references/agents.md +78 -0
  62. package/docs/skills/croche/references/first-turn.md +74 -0
  63. package/docs/skills/croche/references/tools.md +43 -0
  64. package/docs/skills/croche-cli/SKILL.md +158 -0
  65. package/docs/skills/croche-cli/agents/openai.yaml +4 -0
  66. package/docs/skills/croche-cli/references/powershell.md +47 -0
  67. package/docs/skills/croche-config/SKILL.md +152 -0
  68. package/docs/skills/croche-config/agents/openai.yaml +4 -0
  69. package/docs/skills/croche-config/references/models.md +12 -0
  70. package/docs/skills/croche-platforms/SKILL.md +55 -0
  71. package/docs/skills/croche-platforms/agents/openai.yaml +4 -0
  72. package/docs/skills/croche-platforms/references/android.md +185 -0
  73. package/docs/skills/croche-platforms/references/ios.md +165 -0
  74. package/docs/skills/croche-platforms/references/react-native.md +50 -0
  75. package/docs/skills/croche-platforms/references/web-backend.md +58 -0
  76. package/docs/skills/croche-troubleshoot/SKILL.md +72 -0
  77. package/docs/skills/croche-troubleshoot/agents/openai.yaml +4 -0
  78. package/docs/skills/croche-troubleshoot/references/recovery.md +31 -0
  79. package/package.json +52 -4
  80. package/src/archive.ts +188 -0
  81. package/src/atomic-replace.ts +43 -0
  82. package/src/commands.ts +62 -0
  83. package/src/control.ts +179 -0
  84. package/src/core-abi.ts +52 -0
  85. package/src/core-bindgen.ts +1557 -0
  86. package/src/core-runtime.ts +750 -0
  87. package/src/core-wasm-bytes.ts +5 -0
  88. package/src/core-wasm.ts +57 -0
  89. package/src/debug.ts +160 -0
  90. package/src/file-lock.ts +269 -0
  91. package/src/images.ts +174 -0
  92. package/src/index.ts +15 -0
  93. package/src/markers.ts +1 -0
  94. package/src/node.ts +194 -0
  95. package/src/project-core.ts +231 -0
  96. package/src/project-session.ts +118 -0
  97. package/src/project-types.ts +77 -0
  98. package/src/project-wire.ts +39 -0
  99. package/src/sse.ts +57 -0
  100. package/src/storage.ts +30 -0
  101. package/src/stream-branch.ts +112 -0
  102. package/src/stream-hub.ts +249 -0
  103. package/src/stream.ts +7 -0
  104. package/src/types.ts +838 -0
  105. package/src/wiki.ts +25 -0
@@ -0,0 +1,413 @@
1
+ /**
2
+ * The JSON transition ABI (`croche_step`) for tools that still drive the Core step by step.
3
+ * @param {string} input
4
+ * @returns {string}
5
+ */
6
+ export declare function step(input: any): string;
7
+ /**
8
+ * Cancellation of one operation.
9
+ */
10
+ export declare class WasmCancel {
11
+ static __wrap(ptr: any): any;
12
+ __destroy_into_raw(): any;
13
+ free(): void;
14
+ /**
15
+ * @returns {boolean}
16
+ */
17
+ isCancelled(): boolean;
18
+ constructor();
19
+ cancel(): void;
20
+ /**
21
+ * Calls `callback` once on cancellation (at once if already cancelled).
22
+ * @param {Function} callback
23
+ */
24
+ onCancel(callback: any): void;
25
+ }
26
+ /**
27
+ * `Croche`: the project, open (#377 6078466532). Its agents are `WasmRuntime`s.
28
+ */
29
+ export declare class WasmProject {
30
+ static __wrap(ptr: any): any;
31
+ __destroy_into_raw(): any;
32
+ free(): void;
33
+ /**
34
+ * `Croche.deleteStore` (R8). `pals` as `open` takes it; `options`: JSON `{host, user?,
35
+ * config, agent?}`, `config` the bundled config (its declared agents). Resolves once every
36
+ * delete has returned; nothing was deleted when it rejects with `store_busy`.
37
+ * @param {Function} pals
38
+ * @param {string} options
39
+ * @returns {Promise<any>}
40
+ */
41
+ static deleteStore(pals: any, options: any): any;
42
+ /**
43
+ * The Croche user id (`usr_…`): null until an open agent has registered.
44
+ * @returns {string | undefined}
45
+ */
46
+ crocheUserId(): string | undefined;
47
+ /**
48
+ * @returns {string | undefined}
49
+ */
50
+ installationId(): string | undefined;
51
+ /**
52
+ * JSON `{instance?, fresh?, config?}`. Core validates admission, including not-built paths.
53
+ * @param {string | null | undefined} id
54
+ * @param {string} options
55
+ * @returns {Promise<any>}
56
+ */
57
+ agentWithOptions(id: any, options: any): any;
58
+ /**
59
+ * `pals`: `(agentId: string) => CrocheHost`, the host `WasmRuntime.open` takes, one per
60
+ * agent store. `options`: JSON `{host, user?, config, handlers, language? (the host passes the device's preferred one when the app
61
+ * gives none), runtime?:
62
+ * {streaming?, backgroundSync?, maintenanceIntervalMs?}}`. `debug` and `usage` observe
63
+ * every agent from its open.
64
+ * @param {Function} pals
65
+ * @param {string} options
66
+ * @param {Function | null} [debug]
67
+ * @param {Function | null} [usage]
68
+ * @returns {Promise<any>}
69
+ */
70
+ static open(pals: any, options: any, debug: any, usage: any): any;
71
+ /**
72
+ * @returns {string | undefined}
73
+ */
74
+ user(): string | undefined;
75
+ /**
76
+ * Resolves to that agent's `WasmRuntime`; `config` is the code override as JSON.
77
+ * @param {string | null} [id]
78
+ * @param {string | null} [config]
79
+ * @returns {Promise<any>}
80
+ */
81
+ agent(id: any, config: any): any;
82
+ /**
83
+ * Closes every agent, then the project.
84
+ * @returns {Promise<any>}
85
+ */
86
+ close(): any;
87
+ /**
88
+ * JSON `app_config_applied` without overrides: which base the agents take.
89
+ * @returns {string}
90
+ */
91
+ applied(): string;
92
+ /**
93
+ * JSON array of the declared agent ids.
94
+ * @returns {string}
95
+ */
96
+ agentIds(): string;
97
+ }
98
+ /**
99
+ * One Croche Runtime. Results and events are JSON strings.
100
+ */
101
+ export declare class WasmRuntime {
102
+ static __wrap(ptr: any): any;
103
+ __destroy_into_raw(): any;
104
+ free(): void;
105
+ /**
106
+ * Throws when the Runtime is closed or its storage failed.
107
+ */
108
+ checkOpen(): void;
109
+ /**
110
+ * Stops the running turn only; sends held behind it run, together, as the next turn. It
111
+ * stops at the call; the promise resolves once the stop is durable.
112
+ * @returns {Promise<any>}
113
+ */
114
+ cancelTurn(): any;
115
+ /**
116
+ * Delivers the agent's scheduled notes that are due, as one turn (JSON result).
117
+ * @returns {Promise<any>}
118
+ */
119
+ deliverDue(): any;
120
+ /**
121
+ * `list` or `export` (JSON).
122
+ * @param {string} op
123
+ * @returns {string}
124
+ */
125
+ memoryRead(op: any): string;
126
+ /**
127
+ * @param {string} path
128
+ * @returns {boolean}
129
+ */
130
+ wikiRemove(path: any): boolean;
131
+ /**
132
+ * JSON `[{path, title, snippet, score}]`, best first.
133
+ * @param {string} query
134
+ * @param {number} limit
135
+ * @returns {string}
136
+ */
137
+ wikiSearch(query: any, limit: any): string;
138
+ /**
139
+ * The turn archive's records of `from..=to` (F20), as `{records}`. Internal: the SDK does
140
+ * not expose it; `memory history` (B3) reads through the same effect.
141
+ * @param {number} from
142
+ * @param {number} to
143
+ * @returns {Promise<any>}
144
+ */
145
+ archiveRead(from: any, to: any): any;
146
+ /**
147
+ * Drops the sends held behind the running turn (each ends `cancelled`); resolves how many,
148
+ * once the held record no longer lists them.
149
+ * @returns {Promise<any>}
150
+ */
151
+ clearQueued(): any;
152
+ /**
153
+ * @returns {Promise<any>}
154
+ */
155
+ memoryClear(): any;
156
+ /**
157
+ * @param {string} id
158
+ * @param {number} from_seq
159
+ * @param {Function} captured
160
+ * @returns {Promise<any>}
161
+ */
162
+ readOutcome(id: any, from_seq: any, captured: any): any;
163
+ /**
164
+ * @param {number} amount
165
+ * @param {boolean} absolute
166
+ * @param {string | null} [id]
167
+ * @returns {Promise<any>}
168
+ */
169
+ adjustBudget(amount: any, absolute: any, id: any): any;
170
+ /**
171
+ * Deletes archived turns for real: all, or `from..=to`. Internal (B3 forget-scrubbing).
172
+ * @param {number | null} [from]
173
+ * @param {number | null} [to]
174
+ * @returns {Promise<any>}
175
+ */
176
+ archiveClear(from: any, to: any): any;
177
+ /**
178
+ * @param {string} id
179
+ * @returns {Promise<any>}
180
+ */
181
+ memoryDelete(id: any): any;
182
+ /**
183
+ * JSON array of names, or null.
184
+ * @returns {string | undefined}
185
+ */
186
+ visibleTools(): string | undefined;
187
+ /**
188
+ * This user's own documents (stored with their state): resolves to JSON
189
+ * `{documents, bytes}` once durable.
190
+ * @param {string} docs
191
+ * @returns {Promise<any>}
192
+ */
193
+ wikiPutUser(docs: any): any;
194
+ /**
195
+ * Transitional (Keel, #354): today's turn-result send, until the TS SDK moves to the
196
+ * receipt `send` (S2). Not public API: absent from the SDK's types.
197
+ * @param {string} input
198
+ * @param {Function | null | undefined} on_event
199
+ * @param {WasmCancel} cancel
200
+ * @param {string | null} [response_format]
201
+ * @returns {Promise<any>}
202
+ */
203
+ sendForResult(input: any, on_event: any, cancel: any, response_format: any): any;
204
+ /**
205
+ * JSON `{cleared}` once durable.
206
+ * @returns {Promise<any>}
207
+ */
208
+ wikiClearUser(): any;
209
+ /**
210
+ * @param {number} id
211
+ */
212
+ closeProjection(id: any): void;
213
+ /**
214
+ * JSON `{removed}` once durable.
215
+ * @param {string} path
216
+ * @returns {Promise<any>}
217
+ */
218
+ wikiRemoveUser(path: any): any;
219
+ /**
220
+ * @param {boolean} enabled
221
+ * @returns {Promise<any>}
222
+ */
223
+ memorySetEnabled(enabled: any): any;
224
+ /**
225
+ * @param {Function | null | undefined} observer
226
+ * @param {boolean} full
227
+ */
228
+ setDebugObserver(observer: any, full: any): void;
229
+ /**
230
+ * @param {Function | null} [observer]
231
+ */
232
+ setUsageObserver(observer: any): void;
233
+ /**
234
+ * @param {Function | null} [observer]
235
+ */
236
+ setMemoryObserver(observer: any): void;
237
+ /**
238
+ * ABI only, for the legacy `CrocheRuntime.setTools(declarations)` until the host moves to
239
+ * the factory agent; never in a public type. Refused on a factory agent. Deleted by
240
+ * 2026-10-16 (Keel #381 6079439608, delete-list item 12).
241
+ * @param {string} tools
242
+ */
243
+ setToolDeclarations(tools: any): void;
244
+ /**
245
+ * Runs a Core command that has no input of its own: sync, flush, clear_history.
246
+ * @param {string} command
247
+ * @returns {Promise<any>}
248
+ */
249
+ run(command: any): any;
250
+ /**
251
+ * @returns {string | undefined}
252
+ */
253
+ mode(): string | undefined;
254
+ /**
255
+ * @returns {string | undefined}
256
+ */
257
+ name(): string | undefined;
258
+ /**
259
+ * `options`: `{storageKey?, streaming?, backgroundSync?, maintenanceIntervalMs?}`.
260
+ * `debug` and `usage` observe from the start, open included.
261
+ * @param {CrocheHost} host
262
+ * @param {string} config
263
+ * @param {string} options
264
+ * @param {Function | null} [debug]
265
+ * @param {Function | null} [usage]
266
+ * @returns {Promise<any>}
267
+ */
268
+ static open(host: any, config: any, options: any, debug: any, usage: any): any;
269
+ /**
270
+ * Accepts the input durably and resolves with its receipt JSON, `{id, status, seq}` (see
271
+ * `Runtime::send`). `cancel` applies only before acceptance. `response_format`: structured
272
+ * output as JSON text (see `SendOptions::response_format`).
273
+ * @param {string} input
274
+ * @param {Function | null | undefined} on_event
275
+ * @param {WasmCancel} cancel
276
+ * @param {string | null} [response_format]
277
+ * @returns {Promise<any>}
278
+ */
279
+ send(input: any, on_event: any, cancel: any, response_format: any): any;
280
+ /**
281
+ * @returns {Promise<any>}
282
+ */
283
+ tick(): any;
284
+ /**
285
+ * @returns {Promise<any>}
286
+ */
287
+ close(): any;
288
+ /**
289
+ * Cancels input `id` (`Runtime::cancel`); resolves once durable. Rejects `unknown_id` or
290
+ * `closed` with the Core's error.
291
+ * @param {string} id
292
+ * @returns {Promise<any>}
293
+ */
294
+ cancel(id: any): any;
295
+ /**
296
+ * @returns {string}
297
+ */
298
+ logId(): string;
299
+ /**
300
+ * Selection and projection filtering belong entirely to Core.
301
+ * @param {string} selection
302
+ * @param {Function} on_event
303
+ * @returns {number}
304
+ */
305
+ select(selection: any, on_event: any): any;
306
+ /**
307
+ * @returns {boolean}
308
+ */
309
+ created(): boolean;
310
+ /**
311
+ * @param {number} id
312
+ * @param {number | null | undefined} before
313
+ * @param {number} limit
314
+ * @returns {Promise<any>}
315
+ */
316
+ history(id: any, before: any, limit: any): any;
317
+ /**
318
+ * @returns {string}
319
+ */
320
+ inspect(): string;
321
+ /**
322
+ * The canonical stream observer, called before the app projection.
323
+ * @param {Function} on_event
324
+ * @param {Function} on_end
325
+ */
326
+ observe(on_event: any, on_end: any): void;
327
+ /**
328
+ * @returns {number | undefined}
329
+ */
330
+ wakeAt(): any;
331
+ /**
332
+ * @returns {string}
333
+ */
334
+ agentId(): string;
335
+ /**
336
+ * @returns {string | undefined}
337
+ */
338
+ instance(): string | undefined;
339
+ /**
340
+ * @param {boolean} force
341
+ * @returns {Promise<any>}
342
+ */
343
+ maintain(force: any): any;
344
+ /**
345
+ * @param {string | null} [mode]
346
+ * @returns {Promise<any>}
347
+ */
348
+ setMode(mode: any): any;
349
+ /**
350
+ * @param {string} docs
351
+ */
352
+ wikiPut(docs: any): void;
353
+ /**
354
+ * Replaces every wiki document (`[{path, markdown, agents?}]` as JSON); JSON
355
+ * `{documents, bytes, digest}`.
356
+ * @param {string} docs
357
+ * @returns {string}
358
+ */
359
+ wikiSet(docs: any): string;
360
+ /**
361
+ * @returns {boolean}
362
+ */
363
+ isClosed(): boolean;
364
+ /**
365
+ * The agent's pending scheduled notes (JSON `{pending: [{id, at, note}], due}`).
366
+ * @returns {string}
367
+ */
368
+ schedules(): string;
369
+ /**
370
+ * `visible`: a JSON array of tool names, or null for every tool. Resolves to undefined.
371
+ * @param {string | null} [visible]
372
+ * @returns {Promise<any>}
373
+ */
374
+ setTools(visible: any): any;
375
+ unobserve(): void;
376
+ /**
377
+ * JSON `[{path, title, summary?, characters, parts}]`.
378
+ * @param {string | null} [folder]
379
+ * @returns {string}
380
+ */
381
+ wikiList(folder: any): string;
382
+ /**
383
+ * JSON `{path, title, part, parts, text}`, or `null`.
384
+ * @param {string} path
385
+ * @param {number} part
386
+ * @returns {string}
387
+ */
388
+ wikiRead(path: any, part: any): string;
389
+ }
390
+ /**
391
+ * Where the host delivers a response: `head` once, then `chunk` per read.
392
+ */
393
+ export declare class WasmSink {
394
+ static __wrap(ptr: any): any;
395
+ __destroy_into_raw(): any;
396
+ free(): void;
397
+ /**
398
+ * `headers`: `[name, value]` pairs.
399
+ * @param {number} status
400
+ * @param {Array<any>} headers
401
+ */
402
+ head(status: any, headers: any): void;
403
+ /**
404
+ * One read of the body. False: the Runtime wants no more; stop reading.
405
+ * @param {Uint8Array} bytes
406
+ * @returns {boolean}
407
+ */
408
+ chunk(bytes: any): boolean;
409
+ }
410
+ declare function initSync(module: any): any;
411
+ declare function __wbg_init(module_or_path: any): Promise<any>;
412
+ export { initSync };
413
+ export default __wbg_init;