@synsema/wasm 0.6.47 → 0.6.49
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 +7 -6
- package/index.d.ts +20 -0
- package/index.mjs +4 -0
- package/package.json +1 -1
- package/synsema.wasm +0 -0
package/README.md
CHANGED
|
@@ -112,15 +112,16 @@ an error). Works in `run`, `test`, `handle` and their `*Async` forms.
|
|
|
112
112
|
### Sealed receipts: `auditor` (v0.6.46)
|
|
113
113
|
|
|
114
114
|
The engine accepts `auditor` (an X25519 public key in base64url, from `synsema receipt keygen`) and
|
|
115
|
-
`
|
|
116
|
-
`receipt`.
|
|
115
|
+
`sealedBytes` (4096–16777216, default 65536) in `run()`/`runAsync()` and returns the sealed receipt
|
|
116
|
+
in `receipt`. `test` and `handle` build no receipt: an `auditor` or `sealedBytes` there is an
|
|
117
|
+
error (`auditor: only run seals a receipt`). Before v0.6.49 `run()`/`runAsync()` did not
|
|
118
|
+
pass `auditor` on.
|
|
117
119
|
|
|
118
120
|
```js
|
|
119
|
-
import { Synsema
|
|
121
|
+
import { Synsema } from "@synsema/wasm";
|
|
120
122
|
const syn = await Synsema.loadNode();
|
|
121
|
-
|
|
122
|
-
const
|
|
123
|
-
const r = inst.call({ op: "run", source: code, filename: "app.syn", labels: true, auditor: AUDITOR_PUBLIC_KEY, host: offersOf(host) });
|
|
123
|
+
await syn.ready();
|
|
124
|
+
const r = syn.run(code, { filename: "app.syn", labels: true, auditor: AUDITOR_PUBLIC_KEY });
|
|
124
125
|
r.receipt; // the receipt object: write it as one JSON line for `synsema receipt verify` / `open`
|
|
125
126
|
```
|
|
126
127
|
|
package/index.d.ts
CHANGED
|
@@ -133,6 +133,14 @@ export interface RunOptions {
|
|
|
133
133
|
trusted?: Record<string, string>;
|
|
134
134
|
/** El techo de los módulos de confianza, con la gramática de `ceiling` (`"stdout,declassify=clientes"`). */
|
|
135
135
|
trustedCeiling?: string;
|
|
136
|
+
/**
|
|
137
|
+
* v0.6.46 — la pública X25519 (base64url, de `synsema receipt keygen`) del auditor que designa el
|
|
138
|
+
* host: `run`/`runAsync` devuelven el recibo sellado de la corrida en `RunResult.receipt` (lo de
|
|
139
|
+
* una rama privada va cifrado para el auditor). Sólo `run`; `test` y `handle` no arman recibo, y un `auditor` (o `sealedBytes`) ahí es un error.
|
|
140
|
+
*/
|
|
141
|
+
auditor?: string;
|
|
142
|
+
/** Con `auditor`: los bytes del bloque sellado (4096–16777216, default 65536). */
|
|
143
|
+
sealedBytes?: number;
|
|
136
144
|
}
|
|
137
145
|
|
|
138
146
|
export interface AuditEntry {
|
|
@@ -142,6 +150,8 @@ export interface AuditEntry {
|
|
|
142
150
|
reason: string;
|
|
143
151
|
/** "program" (the program asked or called) or "runtime" (an ambient host grant, e.g. time/llm under a ceiling). */
|
|
144
152
|
origin: "program" | "runtime";
|
|
153
|
+
/** v0.6.49 — dentro de una tool de confianza, `"trusted:<módulo>"` (como el `context` del audit nativo). */
|
|
154
|
+
context?: string;
|
|
145
155
|
}
|
|
146
156
|
|
|
147
157
|
export interface RunResult {
|
|
@@ -165,6 +175,12 @@ export interface RunResult {
|
|
|
165
175
|
* del operador: el programa (y el cliente) ven en `errors` un texto fijo, porque cuál sitio cortó lo eligió el
|
|
166
176
|
* dato privado. No se lo devuelvas al modelo ni al cliente. */
|
|
167
177
|
operator_detail?: string;
|
|
178
|
+
/**
|
|
179
|
+
* Con `auditor`: el recibo sellado (un objeto). Escribilo como UNA línea JSON para
|
|
180
|
+
* `synsema receipt verify` / `synsema receipt open`. Sin recibo no hay salida: si no se pudo
|
|
181
|
+
* armar, `ok` es false y `errors` lo dice.
|
|
182
|
+
*/
|
|
183
|
+
receipt?: Record<string, unknown>;
|
|
168
184
|
}
|
|
169
185
|
|
|
170
186
|
export interface TestResult {
|
|
@@ -212,6 +228,8 @@ export type ModuleSource = WebAssembly.Module | Uint8Array | ArrayBuffer | URL |
|
|
|
212
228
|
export declare function readModule(src: ModuleSource): Promise<WebAssembly.Module>;
|
|
213
229
|
export declare function offersOf(host?: Host): Record<string, boolean>;
|
|
214
230
|
export declare function sleepSync(secs: number): void;
|
|
231
|
+
/** Despacha una llamada del módulo (`kind`, `payload`) a los hooks síncronos de `host`; es lo que usan `run`/`test`/`handle`. */
|
|
232
|
+
export declare function dispatchHostSync(host: Host | undefined, kind: string, payload: any): any;
|
|
215
233
|
export declare function instantiate(
|
|
216
234
|
module: WebAssembly.Module,
|
|
217
235
|
hostCall: (kind: string, payload: any) => any,
|
|
@@ -234,6 +252,8 @@ export declare function instantiateSync(
|
|
|
234
252
|
|
|
235
253
|
export declare class Synsema {
|
|
236
254
|
constructor(module: WebAssembly.Module, opts?: LoadOptions);
|
|
255
|
+
/** El módulo compilado (para `instantiate`/`instantiateSync` con un despacho propio). */
|
|
256
|
+
readonly module: WebAssembly.Module;
|
|
237
257
|
static load(src: ModuleSource, opts?: LoadOptions): Promise<Synsema>;
|
|
238
258
|
/**
|
|
239
259
|
* Node: carga el `synsema.wasm` que trae el paquete (sin resolver rutas; anda en Next, rutas
|
package/index.mjs
CHANGED
|
@@ -386,6 +386,10 @@ function requestOf(op, source, opts = {}) {
|
|
|
386
386
|
// v0.6.46 (E3b): módulos de confianza del embebedor y su techo.
|
|
387
387
|
if (opts.trusted) r.trusted = opts.trusted;
|
|
388
388
|
if (opts.trustedCeiling) r.trusted_ceiling = opts.trustedCeiling;
|
|
389
|
+
// v0.6.49 (B1): el recibo sellado. Antes no se reenviaban y `run()` volvía sin `receipt`;
|
|
390
|
+
// `!= null` por lo mismo que los límites: un valor inválido llega al motor, que lo rechaza.
|
|
391
|
+
if (opts.auditor != null) r.auditor = opts.auditor;
|
|
392
|
+
if (opts.sealedBytes != null) r.sealed_bytes = opts.sealedBytes;
|
|
389
393
|
return r;
|
|
390
394
|
}
|
|
391
395
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@synsema/wasm",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.49",
|
|
4
4
|
"description": "Synsema — the programming language for AI agents — embedded as WebAssembly: run .syn programs inside browsers, Node/Bun/Deno and edge runtimes, lending them http/kv/llm from your app",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
package/synsema.wasm
CHANGED
|
Binary file
|