@opencode/codemode 0.0.0-dev-98 → 0.0.0-dev-106
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/data.d.ts +5 -4
- package/dist/data.js +7 -4
- package/dist/interpreter/callback.d.ts +10 -10
- package/dist/interpreter/callback.js +43 -31
- package/dist/interpreter/errors.d.ts +1 -1
- package/dist/interpreter/errors.js +9 -13
- package/dist/interpreter/execute.js +24 -21
- package/dist/interpreter/extensions.js +12 -4
- package/dist/interpreter/generators.js +162 -19
- package/dist/interpreter/globals.js +11 -8
- package/dist/interpreter/interpreter.d.ts +18 -13
- package/dist/interpreter/interpreter.js +1325 -1147
- package/dist/interpreter/intrinsics.js +1 -2
- package/dist/interpreter/model.d.ts +0 -6
- package/dist/interpreter/model.js +0 -5
- package/dist/interpreter/native.d.ts +7 -8
- package/dist/interpreter/native.js +4 -10
- package/dist/interpreter/objects.d.ts +47 -21
- package/dist/interpreter/objects.js +33 -12
- package/dist/interpreter/promises.d.ts +10 -53
- package/dist/interpreter/promises.js +196 -402
- package/dist/interpreter/runner.d.ts +184 -0
- package/dist/interpreter/runner.js +472 -0
- package/dist/stdlib/array.d.ts +3 -3
- package/dist/stdlib/array.js +106 -102
- package/dist/stdlib/bytes.d.ts +3 -3
- package/dist/stdlib/bytes.js +46 -41
- package/dist/stdlib/collections.d.ts +5 -5
- package/dist/stdlib/collections.js +160 -165
- package/dist/stdlib/date.d.ts +1 -1
- package/dist/stdlib/date.js +28 -20
- package/dist/stdlib/headers.d.ts +1 -1
- package/dist/stdlib/headers.js +14 -19
- package/dist/stdlib/iterator.d.ts +1 -1
- package/dist/stdlib/iterator.js +140 -122
- package/dist/stdlib/json.js +9 -12
- package/dist/stdlib/math.js +10 -10
- package/dist/stdlib/number.d.ts +2 -2
- package/dist/stdlib/object.d.ts +1 -1
- package/dist/stdlib/object.js +21 -22
- package/dist/stdlib/regexp.d.ts +1 -1
- package/dist/stdlib/regexp.js +2 -3
- package/dist/stdlib/string.d.ts +1 -1
- package/dist/stdlib/string.js +18 -20
- package/dist/stdlib/url.d.ts +5 -5
- package/dist/stdlib/url.js +32 -33
- package/dist/stdlib/value.d.ts +2 -2
- package/dist/stdlib/web.d.ts +2 -2
- package/package.json +1 -1
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import type { Program, TaggedTemplateExpression } from "acorn";
|
|
2
|
-
import {
|
|
2
|
+
import type { Context } from "effect";
|
|
3
3
|
import { type Json } from "../data.js";
|
|
4
4
|
import { type ToolRuntime } from "../tool-runtime.js";
|
|
5
|
+
import { type AstNode } from "./model.js";
|
|
5
6
|
import { type Builtins } from "./intrinsics.js";
|
|
6
|
-
import { type Cursor, Arr,
|
|
7
|
-
import {
|
|
8
|
-
/** One program execution: the tool bridge,
|
|
7
|
+
import { type Cursor, Arr, type Value } from "./objects.js";
|
|
8
|
+
import { type Eval, Runner } from "./runner.js";
|
|
9
|
+
/** One program execution: the tool bridge, job queue, captured logs, and the global scope built once. */
|
|
9
10
|
export declare class Interpreter<R> {
|
|
10
11
|
readonly tools: ToolRuntime<R>;
|
|
11
|
-
readonly
|
|
12
|
+
readonly runner: Runner<R>;
|
|
12
13
|
readonly builtins: Builtins;
|
|
13
14
|
readonly logs: Array<string>;
|
|
14
15
|
/** Template objects by site: a tag sees the same `strings` array every time its literal is evaluated, as in JS. */
|
|
@@ -16,16 +17,20 @@ export declare class Interpreter<R> {
|
|
|
16
17
|
private readonly root;
|
|
17
18
|
constructor(options: {
|
|
18
19
|
readonly tools: ToolRuntime<R>;
|
|
19
|
-
|
|
20
|
+
/** The caller's services, which host work runs with. */
|
|
21
|
+
readonly services: Context.Context<R>;
|
|
20
22
|
readonly builtins: Builtins;
|
|
21
23
|
readonly logs?: Array<string>;
|
|
22
24
|
readonly globals?: (ctx: Interpreter<R>) => ReadonlyArray<readonly [string, Value]>;
|
|
23
25
|
});
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
/** The program's body, as the first job: its completion value, copied out for the host. */
|
|
27
|
+
main(program: Program): Eval<Json | undefined>;
|
|
28
|
+
/** Calls into the program; a built-in passes its own call site so failures inside are located there. */
|
|
29
|
+
call(callable: Value, thisValue: Value, args: Array<Value>, site?: AstNode): Eval<Value>;
|
|
30
|
+
/** Await: suspends the innermost async body until `value` settles. */
|
|
31
|
+
awaitValue(value: Value): Eval<Value>;
|
|
32
|
+
iterate(value: Value): Eval<Cursor | undefined>;
|
|
33
|
+
iterateDirect(value: Value): Cursor;
|
|
34
|
+
/** Runs one host call to completion before any other job: arguments cross as JSON, the result comes back as values. */
|
|
35
|
+
tool(run: ToolRuntime<R>["search"], args: Array<Value>): Generator<import("./runner.js").Signal, Value, import("effect/Schema").Json | undefined>;
|
|
31
36
|
}
|