@synsema/wasm 0.6.48 → 0.6.50
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 +24 -1
- 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
|
@@ -129,10 +129,21 @@ export interface RunOptions {
|
|
|
129
129
|
* código escrito por un modelo, bajo un `ceiling` sin `declassify`, publique sólo lo que la
|
|
130
130
|
* política de una persona publica. Los argumentos de una task de confianza son datos (una task
|
|
131
131
|
* o una lambda entre ellos es error).
|
|
132
|
+
*
|
|
133
|
+
* v0.6.50 — `{ nombre: { source, templates: { "r.html": texto } } }` le da a la tool sus
|
|
134
|
+
* templates: dentro de ella `render`/`include`/`layout` resuelven sólo contra éstos.
|
|
132
135
|
*/
|
|
133
|
-
trusted?: Record<string, string>;
|
|
136
|
+
trusted?: Record<string, string | { source: string; templates?: Record<string, string> }>;
|
|
134
137
|
/** El techo de los módulos de confianza, con la gramática de `ceiling` (`"stdout,declassify=clientes"`). */
|
|
135
138
|
trustedCeiling?: string;
|
|
139
|
+
/**
|
|
140
|
+
* v0.6.46 — la pública X25519 (base64url, de `synsema receipt keygen`) del auditor que designa el
|
|
141
|
+
* host: `run`/`runAsync` devuelven el recibo sellado de la corrida en `RunResult.receipt` (lo de
|
|
142
|
+
* 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.
|
|
143
|
+
*/
|
|
144
|
+
auditor?: string;
|
|
145
|
+
/** Con `auditor`: los bytes del bloque sellado (4096–16777216, default 65536). */
|
|
146
|
+
sealedBytes?: number;
|
|
136
147
|
}
|
|
137
148
|
|
|
138
149
|
export interface AuditEntry {
|
|
@@ -142,6 +153,8 @@ export interface AuditEntry {
|
|
|
142
153
|
reason: string;
|
|
143
154
|
/** "program" (the program asked or called) or "runtime" (an ambient host grant, e.g. time/llm under a ceiling). */
|
|
144
155
|
origin: "program" | "runtime";
|
|
156
|
+
/** v0.6.49 — dentro de una tool de confianza, `"trusted:<módulo>"` (como el `context` del audit nativo). */
|
|
157
|
+
context?: string;
|
|
145
158
|
}
|
|
146
159
|
|
|
147
160
|
export interface RunResult {
|
|
@@ -165,6 +178,12 @@ export interface RunResult {
|
|
|
165
178
|
* del operador: el programa (y el cliente) ven en `errors` un texto fijo, porque cuál sitio cortó lo eligió el
|
|
166
179
|
* dato privado. No se lo devuelvas al modelo ni al cliente. */
|
|
167
180
|
operator_detail?: string;
|
|
181
|
+
/**
|
|
182
|
+
* Con `auditor`: el recibo sellado (un objeto). Escribilo como UNA línea JSON para
|
|
183
|
+
* `synsema receipt verify` / `synsema receipt open`. Sin recibo no hay salida: si no se pudo
|
|
184
|
+
* armar, `ok` es false y `errors` lo dice.
|
|
185
|
+
*/
|
|
186
|
+
receipt?: Record<string, unknown>;
|
|
168
187
|
}
|
|
169
188
|
|
|
170
189
|
export interface TestResult {
|
|
@@ -212,6 +231,8 @@ export type ModuleSource = WebAssembly.Module | Uint8Array | ArrayBuffer | URL |
|
|
|
212
231
|
export declare function readModule(src: ModuleSource): Promise<WebAssembly.Module>;
|
|
213
232
|
export declare function offersOf(host?: Host): Record<string, boolean>;
|
|
214
233
|
export declare function sleepSync(secs: number): void;
|
|
234
|
+
/** Despacha una llamada del módulo (`kind`, `payload`) a los hooks síncronos de `host`; es lo que usan `run`/`test`/`handle`. */
|
|
235
|
+
export declare function dispatchHostSync(host: Host | undefined, kind: string, payload: any): any;
|
|
215
236
|
export declare function instantiate(
|
|
216
237
|
module: WebAssembly.Module,
|
|
217
238
|
hostCall: (kind: string, payload: any) => any,
|
|
@@ -234,6 +255,8 @@ export declare function instantiateSync(
|
|
|
234
255
|
|
|
235
256
|
export declare class Synsema {
|
|
236
257
|
constructor(module: WebAssembly.Module, opts?: LoadOptions);
|
|
258
|
+
/** El módulo compilado (para `instantiate`/`instantiateSync` con un despacho propio). */
|
|
259
|
+
readonly module: WebAssembly.Module;
|
|
237
260
|
static load(src: ModuleSource, opts?: LoadOptions): Promise<Synsema>;
|
|
238
261
|
/**
|
|
239
262
|
* 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.50",
|
|
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
|