nanocodex 0.4.0 → 0.6.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 +944 -78
- package/actions/events.mjs +14 -25
- package/actions/index.d.mts +1 -0
- package/actions/index.mjs +11 -1
- package/actions/session.d.mts +29 -1
- package/actions/session.mjs +22 -0
- package/actions/turn.d.mts +15 -6
- package/actions/turn.mjs +10 -0
- package/actions/voice.d.mts +26 -0
- package/actions/voice.mjs +54 -0
- package/browser/Agent.d.mts +41 -24
- package/browser/Agent.mjs +7 -84
- package/browser/ChatGptSubscription.d.mts +7 -0
- package/browser/ChatGptSubscription.mjs +19 -0
- package/browser/InlineAgent.mjs +267 -0
- package/browser/Transport.d.mts +80 -0
- package/browser/Transport.mjs +63 -0
- package/browser/Voice.d.mts +86 -0
- package/browser/Voice.mjs +316 -0
- package/browser/VoiceSession.mjs +763 -0
- package/browser/WorkerAgent.d.mts +65 -0
- package/browser/WorkerAgent.mjs +1467 -0
- package/browser/agent.worker.mjs +3 -0
- package/browser/config.d.mts +36 -0
- package/browser/config.mjs +439 -0
- package/browser/engine.mjs +13 -0
- package/browser/harness.mjs +55 -0
- package/browser/host.d.mts +33 -5
- package/browser/host.mjs +320 -26
- package/browser/hostManagedWebSocket.d.mts +14 -0
- package/browser/hostManagedWebSocket.mjs +110 -0
- package/browser/index.d.mts +64 -1
- package/browser/index.mjs +22 -1
- package/browser/indexeddb-durability-store.mjs +210 -0
- package/browser/workspace.d.mts +16 -0
- package/browser/workspace.mjs +107 -0
- package/cloud/Client.d.mts +83 -0
- package/cloud/Client.mjs +231 -0
- package/cloud/Decorator.d.mts +31 -0
- package/cloud/Decorator.mjs +37 -0
- package/cloud/Dialog.d.mts +113 -0
- package/cloud/Dialog.mjs +366 -0
- package/cloud/Errors.d.mts +22 -0
- package/cloud/Errors.mjs +39 -0
- package/cloud/Principal.d.mts +26 -0
- package/cloud/Principal.mjs +88 -0
- package/cloud/RemoteProvider.mjs +88 -0
- package/cloud/Transport.d.mts +47 -0
- package/cloud/Transport.mjs +454 -0
- package/cloud/actions/account.d.mts +9 -0
- package/cloud/actions/account.mjs +19 -0
- package/cloud/actions/agent.d.mts +18 -0
- package/cloud/actions/agent.mjs +429 -0
- package/cloud/actions/connection.d.mts +133 -0
- package/cloud/actions/connection.mjs +580 -0
- package/cloud/actions/grant.d.mts +10 -0
- package/cloud/actions/grant.mjs +12 -0
- package/cloud/actions/index.d.mts +7 -0
- package/cloud/actions/index.mjs +7 -0
- package/cloud/actions/machineUsd.d.mts +23 -0
- package/cloud/actions/machineUsd.mjs +37 -0
- package/cloud/actions/model.d.mts +12 -0
- package/cloud/actions/model.mjs +50 -0
- package/cloud/actions/mpp.d.mts +28 -0
- package/cloud/actions/mpp.mjs +39 -0
- package/cloud/index.d.mts +30 -0
- package/cloud/index.mjs +9 -0
- package/cloud/internal.mjs +533 -0
- package/cloud/mercator.mjs +108 -0
- package/cloud/server/HostPrincipal.d.mts +34 -0
- package/cloud/server/HostPrincipal.mjs +202 -0
- package/cloud/server/index.d.mts +1 -0
- package/cloud/server/index.mjs +1 -0
- package/cloud/types.d.mts +212 -0
- package/cloudflare/Agent.d.mts +136 -0
- package/cloudflare/Agent.mjs +784 -0
- package/cloudflare/egress-subject.mjs +19 -0
- package/cloudflare/egress.d.mts +41 -0
- package/cloudflare/egress.mjs +119 -0
- package/cloudflare/event-socket.mjs +316 -0
- package/cloudflare/index.d.mts +7 -0
- package/cloudflare/index.mjs +6 -0
- package/host/Agent.d.mts +55 -0
- package/host/Agent.mjs +1 -0
- package/host/index.d.mts +71 -0
- package/host/index.mjs +10 -0
- package/index.d.mts +46 -0
- package/index.mjs +11 -0
- package/internal.mjs +673 -61
- package/managed/Agent.d.mts +459 -0
- package/managed/Agent.mjs +1824 -0
- package/managed/ManagedError.d.mts +9 -0
- package/managed/ManagedError.mjs +8 -0
- package/managed/README.md +244 -0
- package/managed/Voice.mjs +209 -0
- package/managed/index.d.mts +22 -0
- package/managed/index.mjs +2 -0
- package/managed/internal.mjs +119 -0
- package/node/Agent.d.mts +35 -8
- package/node/Agent.mjs +116 -25
- package/node/ChatGptSubscription.d.mts +9 -0
- package/node/ChatGptSubscription.mjs +17 -0
- package/node/Transport.d.mts +41 -0
- package/node/Transport.mjs +46 -0
- package/node/host.mjs +99 -17
- package/node/index.d.mts +45 -1
- package/node/index.mjs +16 -1
- package/node/workspace.d.mts +10 -0
- package/node/workspace.mjs +198 -0
- package/package.json +145 -11
- package/pkg-node/nanocodex.d.ts +523 -11
- package/pkg-node/nanocodex.js +2038 -179
- package/pkg-node/nanocodex_bg.wasm.d.ts +100 -29
- package/pkg-web/.nanocodex-bindgen-stamp +6 -0
- package/pkg-web/nanocodex-build.json +1 -0
- package/pkg-web/nanocodex.d.ts +623 -40
- package/pkg-web/nanocodex.js +2031 -178
- package/pkg-web/nanocodex_bg.js +2667 -0
- package/pkg-web/nanocodex_bg.wasm +0 -0
- package/pkg-web/nanocodex_bg.wasm.d.ts +100 -29
- package/pkg-web/nanocodex_worker.js +9 -0
- package/runtime/chatgpt-subscription.mjs +212 -0
- package/runtime/cloudflare-durability-store.d.mts +26 -0
- package/runtime/cloudflare-durability-store.mjs +14 -0
- package/runtime/code-evaluator.worker.mjs +137 -0
- package/runtime/code-runtime.mjs +1 -243
- package/runtime/durability-store.d.mts +85 -0
- package/runtime/durability-store.mjs +752 -0
- package/runtime/durability.mjs +174 -0
- package/runtime/managed-transport.mjs +461 -0
- package/runtime/mcp-runtime.mjs +534 -0
- package/runtime/postgres-durability-store.d.mts +64 -0
- package/runtime/postgres-durability-store.mjs +581 -0
- package/runtime/quickjs-evaluator.d.mts +17 -0
- package/runtime/quickjs-evaluator.mjs +236 -0
- package/runtime/response-controls.mjs +42 -0
- package/runtime/response-lanes.mjs +72 -0
- package/runtime/responses-transport.mjs +22 -0
- package/runtime/subagents.d.mts +107 -0
- package/runtime/subagents.mjs +54 -0
- package/runtime/subscription-store.d.mts +8 -0
- package/runtime/subscription-store.mjs +42 -0
- package/runtime/tempo-provider.d.mts +125 -0
- package/runtime/tempo-provider.mjs +264 -0
- package/runtime/tool-configuration.mjs +1 -0
- package/runtime/tool-router.mjs +1 -0
- package/runtime/utf8.mjs +1 -0
- package/runtime/worker-evaluator.mjs +162 -0
- package/runtime/workspace.d.mts +1 -0
- package/runtime/workspace.mjs +1 -0
- package/tools/Tools.d.mts +56 -0
- package/tools/Tools.mjs +136 -0
- package/tools/artifact.d.mts +1 -0
- package/tools/artifact.mjs +1 -0
- package/tools/attachment.mjs +1 -0
- package/tools/bash.d.mts +1 -0
- package/tools/bash.mjs +1 -0
- package/tools/browser/accountInfo.mjs +795 -0
- package/tools/browser/browserBuffer.mjs +18 -0
- package/tools/browser/browserCompiler.mjs +155 -0
- package/tools/browser/browserEgress.mjs +161 -0
- package/tools/browser/browserPython.mjs +133 -0
- package/tools/browser/browserShell.mjs +1075 -0
- package/tools/browser/browserSprintf.mjs +4 -0
- package/tools/browser/browserSsh.mjs +201 -0
- package/tools/browser/browserZlib.mjs +136 -0
- package/tools/browser/compiler.worker.mjs +160 -0
- package/tools/browser/devTunnelsSshBrowser.mjs +13 -0
- package/tools/browser/index.d.mts +209 -0
- package/tools/browser/index.mjs +174 -0
- package/tools/browser/opfsGit.mjs +248 -0
- package/tools/browser/python.worker.mjs +114 -0
- package/tools/browser/threadGit.mjs +197 -0
- package/tools/browser/unsupportedNodeRsa.mjs +5 -0
- package/tools/browser/workspace.mjs +83 -0
- package/tools/dataset.d.mts +1 -0
- package/tools/dataset.mjs +1 -0
- package/tools/datasetContract.mjs +1 -0
- package/tools/datasetEngine.mjs +1 -0
- package/tools/hostedCatalog.d.mts +1 -0
- package/tools/hostedCatalog.mjs +1 -0
- package/tools/index.d.mts +49 -0
- package/tools/index.mjs +19 -0
- package/tools/namedTool.mjs +1 -0
- package/tools/repository-workspace.d.mts +1 -0
- package/tools/repository-workspace.mjs +1 -0
- package/tools/ssh.d.mts +1 -0
- package/tools/ssh.mjs +1 -0
- package/tools/standard.mjs +1 -0
- package/tools/standardDescriptions.mjs +1 -0
- package/types.d.mts +431 -16
- package/worker/ChatGptSubscription.d.mts +9 -0
- package/worker/ChatGptSubscription.mjs +29 -0
- package/worker/index.d.mts +18 -0
- package/worker/index.mjs +5 -0
- package/pkg-node/nanocodex_bg.wasm +0 -0
package/runtime/code-runtime.mjs
CHANGED
|
@@ -1,243 +1 @@
|
|
|
1
|
-
export
|
|
2
|
-
const stores = new Map();
|
|
3
|
-
let nextCallId = 1;
|
|
4
|
-
const definitions = [];
|
|
5
|
-
const configuredTools = [];
|
|
6
|
-
|
|
7
|
-
for (const [name, tool] of Object.entries(toolConfiguration)) {
|
|
8
|
-
if (!tool || typeof tool.handler !== "function") {
|
|
9
|
-
throw new TypeError(`tool ${name} requires a handler function`);
|
|
10
|
-
}
|
|
11
|
-
configuredTools.push(Object.freeze({ handler: tool.handler, name }));
|
|
12
|
-
definitions.push(deepFreeze({
|
|
13
|
-
type: "function",
|
|
14
|
-
name,
|
|
15
|
-
description: tool.description || "Application-defined tool.",
|
|
16
|
-
strict: false,
|
|
17
|
-
parameters: jsonSnapshot(tool.parameters || {
|
|
18
|
-
type: "object",
|
|
19
|
-
additionalProperties: true,
|
|
20
|
-
}, `tool ${name} parameters`),
|
|
21
|
-
}));
|
|
22
|
-
}
|
|
23
|
-
Object.freeze(configuredTools);
|
|
24
|
-
Object.freeze(definitions);
|
|
25
|
-
const encodedDefinitions = JSON.stringify(definitions);
|
|
26
|
-
const toolByName = new Map(configuredTools.map((tool) => [tool.name, tool]));
|
|
27
|
-
|
|
28
|
-
async function executeTool(name, encodedInput, sessionId = "default", callId = "tool") {
|
|
29
|
-
const tool = toolByName.get(name);
|
|
30
|
-
if (!tool) return encodeToolOutput(`unknown application tool: ${name}`, false, null);
|
|
31
|
-
let input;
|
|
32
|
-
try {
|
|
33
|
-
input = JSON.parse(encodedInput);
|
|
34
|
-
} catch (error) {
|
|
35
|
-
return encodeToolOutput(`invalid tool input: ${errorMessage(error)}`, false, null);
|
|
36
|
-
}
|
|
37
|
-
try {
|
|
38
|
-
const result = await tool.handler(input, { sessionId, parentCallId: "", callId });
|
|
39
|
-
return encodeToolOutput(outputBody(result), true, clone(result) ?? null);
|
|
40
|
-
} catch (error) {
|
|
41
|
-
return encodeToolOutput(errorMessage(error), false, null);
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
async function executeCode(source, sessionId = "default", parentCallId = "exec") {
|
|
46
|
-
const startedAt = performance.now();
|
|
47
|
-
const content = [];
|
|
48
|
-
const stored = stores.get(sessionId) || new Map();
|
|
49
|
-
stores.set(sessionId, stored);
|
|
50
|
-
const nestedCalls = [];
|
|
51
|
-
const tools = Object.create(null);
|
|
52
|
-
for (const { handler, name } of configuredTools) {
|
|
53
|
-
tools[name] = async (input) => {
|
|
54
|
-
const callId = `${parentCallId}/code-${nextCallId++}`;
|
|
55
|
-
const toolStartedAt = performance.now();
|
|
56
|
-
const startedAfterNs = Math.max(
|
|
57
|
-
0,
|
|
58
|
-
Math.round((toolStartedAt - startedAt) * 1_000_000),
|
|
59
|
-
);
|
|
60
|
-
const recordedInput = clone(input) ?? null;
|
|
61
|
-
try {
|
|
62
|
-
const result = await handler(input, { sessionId, parentCallId, callId });
|
|
63
|
-
nestedCalls.push({
|
|
64
|
-
call_id: callId,
|
|
65
|
-
name,
|
|
66
|
-
input: recordedInput,
|
|
67
|
-
output: outputBody(result),
|
|
68
|
-
success: true,
|
|
69
|
-
started_after_ns: startedAfterNs,
|
|
70
|
-
duration_ns: elapsedNs(toolStartedAt),
|
|
71
|
-
});
|
|
72
|
-
return result;
|
|
73
|
-
} catch (error) {
|
|
74
|
-
nestedCalls.push({
|
|
75
|
-
call_id: callId,
|
|
76
|
-
name,
|
|
77
|
-
input: recordedInput,
|
|
78
|
-
output: errorMessage(error),
|
|
79
|
-
success: false,
|
|
80
|
-
started_after_ns: startedAfterNs,
|
|
81
|
-
duration_ns: elapsedNs(toolStartedAt),
|
|
82
|
-
});
|
|
83
|
-
throw error;
|
|
84
|
-
}
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
Object.freeze(tools);
|
|
88
|
-
const AsyncFunction = Object.getPrototypeOf(async function () {}).constructor;
|
|
89
|
-
const EXIT = Symbol("exit");
|
|
90
|
-
|
|
91
|
-
function text(value) {
|
|
92
|
-
content.push({ type: "input_text", text: stringify(value) });
|
|
93
|
-
}
|
|
94
|
-
function image(value, detail = "auto") {
|
|
95
|
-
if (typeof value === "string") {
|
|
96
|
-
content.push({ type: "input_image", image_url: value, detail });
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (!value || typeof value !== "object" || typeof value.image_url !== "string") {
|
|
100
|
-
throw new TypeError("image() requires an image URL or image item");
|
|
101
|
-
}
|
|
102
|
-
content.push({
|
|
103
|
-
type: "input_image",
|
|
104
|
-
image_url: value.image_url,
|
|
105
|
-
detail: value.detail == null ? detail : value.detail,
|
|
106
|
-
});
|
|
107
|
-
}
|
|
108
|
-
function generatedImage(result) {
|
|
109
|
-
if (!result || typeof result !== "object" || typeof result.image_url !== "string") {
|
|
110
|
-
throw new TypeError("generatedImage() requires an image generation result");
|
|
111
|
-
}
|
|
112
|
-
image(result.image_url, "high");
|
|
113
|
-
if (typeof result.output_hint === "string" && result.output_hint) text(result.output_hint);
|
|
114
|
-
}
|
|
115
|
-
function store(key, value) {
|
|
116
|
-
if (typeof key !== "string") throw new TypeError("store key must be a string");
|
|
117
|
-
stored.set(key, clone(value));
|
|
118
|
-
}
|
|
119
|
-
function load(key) {
|
|
120
|
-
return stored.has(key) ? clone(stored.get(key)) : undefined;
|
|
121
|
-
}
|
|
122
|
-
function exit() {
|
|
123
|
-
throw EXIT;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
try {
|
|
127
|
-
const script = new AsyncFunction(
|
|
128
|
-
"tools",
|
|
129
|
-
"ALL_TOOLS",
|
|
130
|
-
"text",
|
|
131
|
-
"image",
|
|
132
|
-
"generatedImage",
|
|
133
|
-
"store",
|
|
134
|
-
"load",
|
|
135
|
-
"exit",
|
|
136
|
-
"require",
|
|
137
|
-
"console",
|
|
138
|
-
source,
|
|
139
|
-
);
|
|
140
|
-
try {
|
|
141
|
-
await script(
|
|
142
|
-
tools,
|
|
143
|
-
definitions,
|
|
144
|
-
text,
|
|
145
|
-
image,
|
|
146
|
-
generatedImage,
|
|
147
|
-
store,
|
|
148
|
-
load,
|
|
149
|
-
exit,
|
|
150
|
-
extras.require,
|
|
151
|
-
extras.console || console,
|
|
152
|
-
);
|
|
153
|
-
} catch (error) {
|
|
154
|
-
if (error !== EXIT) throw error;
|
|
155
|
-
}
|
|
156
|
-
return JSON.stringify({
|
|
157
|
-
output: withStatus("Script completed", startedAt, content),
|
|
158
|
-
success: true,
|
|
159
|
-
nested_calls: nestedCalls,
|
|
160
|
-
});
|
|
161
|
-
} catch (error) {
|
|
162
|
-
return JSON.stringify({
|
|
163
|
-
output: `Script failed\nWall time ${wallTime(startedAt)} seconds\nOutput:\n${errorMessage(error)}`,
|
|
164
|
-
success: false,
|
|
165
|
-
nested_calls: nestedCalls,
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
return Object.freeze({
|
|
171
|
-
executeCode,
|
|
172
|
-
executeTool,
|
|
173
|
-
toolDefinitions: () => encodedDefinitions,
|
|
174
|
-
reset() {
|
|
175
|
-
stores.clear();
|
|
176
|
-
},
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
function encodeToolOutput(output, success, codeModeValue) {
|
|
181
|
-
return JSON.stringify({
|
|
182
|
-
output,
|
|
183
|
-
success,
|
|
184
|
-
code_mode_value: codeModeValue,
|
|
185
|
-
metadata: null,
|
|
186
|
-
process_trace: null,
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
function outputBody(value) {
|
|
191
|
-
if (Array.isArray(value) && value.every((item) => item?.type === "input_text" || item?.type === "input_image")) {
|
|
192
|
-
return clone(value);
|
|
193
|
-
}
|
|
194
|
-
return stringify(value);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
function stringify(value) {
|
|
198
|
-
if (typeof value === "string") return value;
|
|
199
|
-
if (value === undefined) return "undefined";
|
|
200
|
-
try {
|
|
201
|
-
return JSON.stringify(value);
|
|
202
|
-
} catch {
|
|
203
|
-
return String(value);
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function clone(value) {
|
|
208
|
-
if (typeof globalThis.structuredClone === "function") return structuredClone(value);
|
|
209
|
-
return value === undefined ? undefined : JSON.parse(JSON.stringify(value));
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
function jsonSnapshot(value, label) {
|
|
213
|
-
try {
|
|
214
|
-
return JSON.parse(JSON.stringify(value));
|
|
215
|
-
} catch (error) {
|
|
216
|
-
throw new TypeError(`${label} must be JSON-serializable`, { cause: error });
|
|
217
|
-
}
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
function deepFreeze(value) {
|
|
221
|
-
if (!value || typeof value !== "object" || Object.isFrozen(value)) return value;
|
|
222
|
-
for (const child of Object.values(value)) deepFreeze(child);
|
|
223
|
-
return Object.freeze(value);
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
function errorMessage(error) {
|
|
227
|
-
if (error && (error.stack || error.message)) return error.stack || error.message;
|
|
228
|
-
return String(error);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
function elapsedNs(startedAt) {
|
|
232
|
-
return Math.max(0, Math.round((performance.now() - startedAt) * 1_000_000));
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
function wallTime(startedAt) {
|
|
236
|
-
return ((performance.now() - startedAt) / 1_000).toFixed(1);
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
function withStatus(status, startedAt, content) {
|
|
240
|
-
const heading = `${status}\nWall time ${wallTime(startedAt)} seconds\nOutput:\n`;
|
|
241
|
-
if (!content.length) return heading;
|
|
242
|
-
return [{ type: "input_text", text: heading }, ...content];
|
|
243
|
-
}
|
|
1
|
+
export * from "nanocodex-tools/runtime/code-runtime";
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
DurabilityAcquiredState,
|
|
3
|
+
DurabilityAcquireRequest,
|
|
4
|
+
DurabilityReplaceRequest,
|
|
5
|
+
DurabilityReplaceResult,
|
|
6
|
+
DurabilityFence,
|
|
7
|
+
DurabilityExportCursor,
|
|
8
|
+
DurabilityExportPageRequest,
|
|
9
|
+
DurabilityPortableStatePage,
|
|
10
|
+
DurabilityPortableStateArchive,
|
|
11
|
+
DurabilityPortableStore,
|
|
12
|
+
DurabilityRevision,
|
|
13
|
+
DurabilitySqliteQuery,
|
|
14
|
+
DurabilitySqliteRow,
|
|
15
|
+
DurabilitySqliteTransaction,
|
|
16
|
+
DurabilitySqliteValue,
|
|
17
|
+
DurabilityStore,
|
|
18
|
+
DurabilityStoredState,
|
|
19
|
+
MemoryDurabilityStore,
|
|
20
|
+
SqliteDurabilityStoreOptions,
|
|
21
|
+
} from "../types.mjs";
|
|
22
|
+
|
|
23
|
+
export declare const sqliteDurabilitySchema: readonly string[];
|
|
24
|
+
|
|
25
|
+
export declare class DurabilityImportConflictError extends Error {
|
|
26
|
+
override readonly name: "DurabilityImportConflictError";
|
|
27
|
+
readonly expectedRevision: import("../types.mjs").DurabilityRevision | undefined;
|
|
28
|
+
readonly actualRevision: import("../types.mjs").DurabilityRevision | undefined;
|
|
29
|
+
constructor(
|
|
30
|
+
stateId: string,
|
|
31
|
+
expectedRevision?: import("../types.mjs").DurabilityRevision,
|
|
32
|
+
actualRevision?: import("../types.mjs").DurabilityRevision,
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export declare function durabilityRevision(
|
|
37
|
+
/** Numbers must be nonnegative safe integers; use exact decimal text for larger values. */
|
|
38
|
+
value: string | bigint | number,
|
|
39
|
+
): import("../types.mjs").DurabilityRevision;
|
|
40
|
+
|
|
41
|
+
/** Returns SHA-256 over the UTF-8 JSON tuple `[revision, payload]`. */
|
|
42
|
+
export declare function durabilityStateDigest(
|
|
43
|
+
state: import("../types.mjs").DurabilityStoredState,
|
|
44
|
+
): Promise<string>;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Atomically fences the source owner and exports one coherent JSON-safe state.
|
|
48
|
+
* Do not resume the source provider after beginning a cutover.
|
|
49
|
+
*/
|
|
50
|
+
export declare function exportDurabilityState(
|
|
51
|
+
store: import("../types.mjs").DurabilityStore,
|
|
52
|
+
stateId: string,
|
|
53
|
+
): Promise<import("../types.mjs").DurabilityPortableStateArchive>;
|
|
54
|
+
|
|
55
|
+
/** Restores an exact archive and its stable state identity into an empty destination. */
|
|
56
|
+
export declare function importDurabilityState(
|
|
57
|
+
store: import("../types.mjs").DurabilityPortableStore,
|
|
58
|
+
archive: import("../types.mjs").DurabilityPortableStateArchive,
|
|
59
|
+
): Promise<import("../types.mjs").DurabilityStoredState>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Fences the source once and returns a deterministic page of its exact `to` revision.
|
|
63
|
+
* `from` is exclusive, `to` is inclusive, and `cursor` resumes the same payload export.
|
|
64
|
+
* Nonzero ranges must supply `fromDigest` so every page carries the exact lineage proof.
|
|
65
|
+
*/
|
|
66
|
+
export declare function exportDurabilityStatePage(
|
|
67
|
+
store: import("../types.mjs").DurabilityStore,
|
|
68
|
+
stateId: string,
|
|
69
|
+
request: import("../types.mjs").DurabilityExportPageRequest,
|
|
70
|
+
): Promise<import("../types.mjs").DurabilityPortableStatePage>;
|
|
71
|
+
|
|
72
|
+
/** Imports a complete contiguous page set iff the destination still has the exact state at `from`. */
|
|
73
|
+
export declare function importDurabilityStatePages(
|
|
74
|
+
store: import("../types.mjs").DurabilityPortableStore,
|
|
75
|
+
pages: Iterable<import("../types.mjs").DurabilityPortableStatePage> | AsyncIterable<import("../types.mjs").DurabilityPortableStatePage>,
|
|
76
|
+
): Promise<import("../types.mjs").DurabilityStoredState>;
|
|
77
|
+
|
|
78
|
+
export declare function createMemoryDurabilityStore(
|
|
79
|
+
stateId: string,
|
|
80
|
+
initial?: import("../types.mjs").DurabilityStoredState,
|
|
81
|
+
): import("../types.mjs").MemoryDurabilityStore;
|
|
82
|
+
|
|
83
|
+
export declare function createSqliteDurabilityStore(
|
|
84
|
+
options: import("../types.mjs").SqliteDurabilityStoreOptions,
|
|
85
|
+
): import("../types.mjs").DurabilityPortableStore;
|