@opencode/codemode 2.0.3 → 2.0.4
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/codemode.d.ts +3 -0
- package/dist/codemode.js +12 -1
- package/dist/data.d.ts +14 -21
- package/dist/data.js +72 -140
- package/dist/extension.d.ts +11 -0
- package/dist/extension.js +9 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/interpreter/callback.d.ts +20 -0
- package/dist/interpreter/{runner.js → callback.js} +14 -14
- package/dist/interpreter/errors.d.ts +12 -5
- package/dist/interpreter/errors.js +66 -54
- package/dist/interpreter/execute.d.ts +2 -2
- package/dist/interpreter/execute.js +15 -15
- package/dist/interpreter/extensions.d.ts +8 -0
- package/dist/interpreter/extensions.js +155 -0
- package/dist/interpreter/generators.d.ts +2 -3
- package/dist/interpreter/generators.js +10 -10
- package/dist/interpreter/globals.d.ts +4 -12
- package/dist/interpreter/globals.js +56 -49
- package/dist/interpreter/interpreter.d.ts +34 -0
- package/dist/interpreter/{runtime.js → interpreter.js} +250 -215
- package/dist/interpreter/intrinsics.d.ts +5 -5
- package/dist/interpreter/intrinsics.js +16 -10
- package/dist/interpreter/limits.d.ts +10 -0
- package/dist/interpreter/limits.js +19 -0
- package/dist/interpreter/model.d.ts +27 -14
- package/dist/interpreter/model.js +22 -14
- package/dist/interpreter/native.d.ts +12 -13
- package/dist/interpreter/native.js +17 -16
- package/dist/interpreter/objects.d.ts +55 -48
- package/dist/interpreter/objects.js +64 -44
- package/dist/interpreter/promises.d.ts +13 -15
- package/dist/interpreter/promises.js +89 -85
- package/dist/interpreter/references.d.ts +1 -2
- package/dist/interpreter/references.js +18 -16
- package/dist/interpreter/scope.js +6 -6
- package/dist/openapi/types.d.ts +1 -1
- package/dist/stdlib/array.d.ts +3 -4
- package/dist/stdlib/array.js +115 -110
- package/dist/stdlib/bytes.d.ts +10 -0
- package/dist/stdlib/bytes.js +228 -0
- package/dist/stdlib/collections.d.ts +4 -4
- package/dist/stdlib/collections.js +89 -89
- package/dist/stdlib/console.d.ts +5 -3
- package/dist/stdlib/console.js +30 -37
- package/dist/stdlib/date.d.ts +2 -2
- package/dist/stdlib/date.js +35 -35
- package/dist/stdlib/json.d.ts +3 -3
- package/dist/stdlib/json.js +29 -67
- package/dist/stdlib/math.d.ts +3 -3
- package/dist/stdlib/math.js +17 -21
- package/dist/stdlib/number.d.ts +3 -3
- package/dist/stdlib/number.js +32 -36
- package/dist/stdlib/object.d.ts +5 -5
- package/dist/stdlib/object.js +59 -62
- package/dist/stdlib/regexp.d.ts +7 -8
- package/dist/stdlib/regexp.js +40 -48
- package/dist/stdlib/string.d.ts +2 -2
- package/dist/stdlib/string.js +110 -88
- package/dist/stdlib/url.d.ts +4 -6
- package/dist/stdlib/url.js +86 -90
- package/dist/stdlib/value.d.ts +3 -3
- package/dist/stdlib/value.js +26 -24
- package/dist/stdlib/web.d.ts +4 -4
- package/dist/stdlib/web.js +22 -8
- package/dist/tool-runtime.d.ts +12 -5
- package/dist/tool-runtime.js +25 -11
- package/package.json +1 -1
- package/dist/interpreter/runner.d.ts +0 -28
- package/dist/interpreter/runtime.d.ts +0 -19
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { Effect } from "effect";
|
|
2
|
-
import type { Prototypes } from "./intrinsics.js";
|
|
3
|
-
import { type AstNode } from "./model.js";
|
|
4
|
-
import { Callable, ProgramPromise } from "./objects.js";
|
|
5
|
-
export type IteratorCursor<R> = {
|
|
6
|
-
readonly next: Effect.Effect<{
|
|
7
|
-
readonly done: boolean;
|
|
8
|
-
readonly value: unknown;
|
|
9
|
-
}, unknown, R>;
|
|
10
|
-
readonly close: Effect.Effect<void, unknown, R>;
|
|
11
|
-
};
|
|
12
|
-
/** Everything a native function needs from the realm: calling back into the program and its intrinsic objects. */
|
|
13
|
-
export type Runner<R> = {
|
|
14
|
-
readonly invokeCallable: (callable: unknown, thisValue: unknown, args: Array<unknown>, node: AstNode) => Effect.Effect<unknown, unknown, R>;
|
|
15
|
-
readonly settlePromise: (promise: ProgramPromise) => Effect.Effect<unknown, unknown, never>;
|
|
16
|
-
readonly syncIterator: (value: unknown, node: AstNode) => Effect.Effect<IteratorCursor<R> | undefined, unknown, R>;
|
|
17
|
-
readonly prototypes: Prototypes;
|
|
18
|
-
};
|
|
19
|
-
export declare const preserveConsumerError: <A, R>(cursor: IteratorCursor<R>, effect: Effect.Effect<A, unknown, R>) => Effect.Effect<A, unknown, R>;
|
|
20
|
-
/**
|
|
21
|
-
* ToPrimitive: calls `valueOf`/`toString` in hint order and returns the first primitive result. Dates treat the
|
|
22
|
-
* default hint as "string", like their `Symbol.toPrimitive`.
|
|
23
|
-
*/
|
|
24
|
-
export declare const toPrimitive: <R>(runner: Runner<R>, value: unknown, hint: "number" | "string" | "default", node: AstNode) => Effect.Effect<unknown, unknown, R>;
|
|
25
|
-
export declare const toPrimitiveString: <R>(runner: Runner<R>, value: unknown, node: AstNode) => Effect.Effect<string, unknown, R>;
|
|
26
|
-
export declare const toPrimitiveNumber: <R>(runner: Runner<R>, value: unknown, node: AstNode) => Effect.Effect<number, unknown, R>;
|
|
27
|
-
export declare const isSupportedCallback: (value: unknown) => value is Callable;
|
|
28
|
-
export declare const applyCollectionCallback: <R>(runner: Runner<R>, callback: unknown, name: string, node: AstNode) => ((args: Array<unknown>) => Effect.Effect<unknown, unknown, R>);
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import type { Program } from "acorn";
|
|
2
|
-
import { Effect } from "effect";
|
|
3
|
-
import type { Prototypes } from "./intrinsics.js";
|
|
4
|
-
import { type Host } from "./globals.js";
|
|
5
|
-
import { type Runner } from "./runner.js";
|
|
6
|
-
import { PromiseRuntime } from "./promises.js";
|
|
7
|
-
/** One program execution: the tool bridge, promise scheduler, captured logs, and the global scope built once. */
|
|
8
|
-
export declare class Runtime<R> {
|
|
9
|
-
readonly executeTool: (path: ReadonlyArray<string>, args: Array<unknown>) => Effect.Effect<unknown, unknown, R>;
|
|
10
|
-
readonly search: (args: Array<unknown>) => Effect.Effect<unknown, unknown, R>;
|
|
11
|
-
readonly toolKeys: (path: ReadonlyArray<string>) => ReadonlyArray<string>;
|
|
12
|
-
readonly promises: PromiseRuntime<R>;
|
|
13
|
-
readonly prototypes: Prototypes;
|
|
14
|
-
readonly logs: Array<string>;
|
|
15
|
-
readonly runner: Runner<R>;
|
|
16
|
-
private readonly root;
|
|
17
|
-
constructor(executeTool: (path: ReadonlyArray<string>, args: Array<unknown>) => Effect.Effect<unknown, unknown, R>, search: (args: Array<unknown>) => Effect.Effect<unknown, unknown, R>, toolKeys: (path: ReadonlyArray<string>) => ReadonlyArray<string>, promises: PromiseRuntime<R>, prototypes: Prototypes, logs?: Array<string>, extraGlobals?: (host: Host<R>) => ReadonlyArray<readonly [string, unknown]>);
|
|
18
|
-
run(program: Program): Effect.Effect<unknown, unknown, R>;
|
|
19
|
-
}
|