@mojir/dvala 0.0.9 → 0.0.10
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/dist/cli/cli.js +71 -23
- package/dist/cli/src/evaluator/effectTypes.d.ts +19 -1
- package/dist/cli/src/evaluator/suspension.d.ts +6 -0
- package/dist/cli/src/evaluator/trampoline.d.ts +5 -0
- package/dist/debug.esm.js +1 -1
- package/dist/debug.esm.js.map +1 -1
- package/dist/debug.js +1 -1
- package/dist/debug.js.map +1 -1
- package/dist/dvala.iife.js +1 -1
- package/dist/dvala.iife.js.map +1 -1
- package/dist/full.esm.js +1 -1
- package/dist/full.esm.js.map +1 -1
- package/dist/full.js +1 -1
- package/dist/full.js.map +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/mcp-server/server.js +116 -69
- package/dist/mcp-server/src/evaluator/effectTypes.d.ts +19 -1
- package/dist/mcp-server/src/evaluator/suspension.d.ts +6 -0
- package/dist/mcp-server/src/evaluator/trampoline.d.ts +5 -0
- package/dist/modules/src/evaluator/effectTypes.d.ts +19 -1
- package/dist/modules/src/evaluator/suspension.d.ts +6 -0
- package/dist/modules/src/evaluator/trampoline.d.ts +5 -0
- package/dist/modules/src/index.d.ts +2 -0
- package/dist/modules/src/retrigger.d.ts +39 -0
- package/dist/src/evaluator/effectTypes.d.ts +19 -1
- package/dist/src/evaluator/suspension.d.ts +6 -0
- package/dist/src/evaluator/trampoline.d.ts +5 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/retrigger.d.ts +39 -0
- package/dist/testFramework.esm.js +1 -1
- package/dist/testFramework.esm.js.map +1 -1
- package/dist/testFramework.js +1 -1
- package/dist/testFramework.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Standalone `retrigger()` function for resuming suspended continuations
|
|
3
|
+
* by re-firing the original effect to the host handlers.
|
|
4
|
+
*
|
|
5
|
+
* The primary API for running Dvala programs is `createDvala()` from `./createDvala`.
|
|
6
|
+
*/
|
|
7
|
+
import type { Any } from './interface';
|
|
8
|
+
import type { DvalaModule } from './builtin/modules/interface';
|
|
9
|
+
import type { Handlers, RunResult, Snapshot } from './evaluator/effectTypes';
|
|
10
|
+
/**
|
|
11
|
+
* Options for `retrigger()` — resume a suspended continuation by re-firing
|
|
12
|
+
* the original effect to the host handlers.
|
|
13
|
+
*/
|
|
14
|
+
export interface RetriggerOptions {
|
|
15
|
+
bindings?: Record<string, Any>;
|
|
16
|
+
handlers?: Handlers;
|
|
17
|
+
modules?: DvalaModule[];
|
|
18
|
+
maxSnapshots?: number;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Resume a suspended continuation by re-triggering the original effect.
|
|
22
|
+
*
|
|
23
|
+
* Takes a `Snapshot` from a previous `RunResult` of type `'suspended'` and
|
|
24
|
+
* re-dispatches the original effect (captured in `snapshot.effectName` /
|
|
25
|
+
* `snapshot.effectArgs`) to the registered host handlers. The handler then
|
|
26
|
+
* calls `resume(value)`, `fail()`, or `suspend()` as normal.
|
|
27
|
+
*
|
|
28
|
+
* Throws if the snapshot has no captured effect (i.e. suspension occurred
|
|
29
|
+
* outside of an effect handler, such as in a parallel/race branch).
|
|
30
|
+
*
|
|
31
|
+
* Always resolves — never rejects. May return `completed`, `suspended`
|
|
32
|
+
* (if the handler suspends again), or `error`.
|
|
33
|
+
*
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const { snapshot } = suspendedResult
|
|
36
|
+
* const next = await retrigger(snapshot, { handlers })
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
export declare function retrigger(snapshot: Snapshot, options?: RetriggerOptions): Promise<RunResult>;
|