@lmctl-ai/lmctl 0.2.38 → 0.2.39
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 +16 -0
- package/bin/lmbee +2 -0
- package/bin/lmscript +3 -0
- package/build-info.json +1 -0
- package/dist/cli/index.js +485 -460
- package/dist/cli/schema.sql +0 -169
- package/dist/cli/script.js +246 -246
- package/dist/lmbee.js +960 -0
- package/dist/lmscript.js +388 -0
- package/dist/public/app.js +379 -0
- package/dist/public/index.html +78 -0
- package/dist/public/styles.css +160 -0
- package/dist/schema.sql +455 -0
- package/dist/vendor-webui/index.html +18 -0
- package/dist/vendor-webui/local.js +231 -0
- package/dist/vendor-webui/styles.css +1852 -0
- package/package.json +11 -7
- package/dist/cli/batch.d.ts +0 -2
- package/dist/cli/busy-evidence.d.ts +0 -27
- package/dist/cli/chat-cycle.d.ts +0 -59
- package/dist/cli/chat-exec.d.ts +0 -91
- package/dist/cli/chat-policy.d.ts +0 -22
- package/dist/cli/chat.d.ts +0 -14
- package/dist/cli/code-resolver.d.ts +0 -8
- package/dist/cli/common.d.ts +0 -57
- package/dist/cli/context.d.ts +0 -12
- package/dist/cli/cost.d.ts +0 -2
- package/dist/cli/export.d.ts +0 -2
- package/dist/cli/hello.d.ts +0 -10
- package/dist/cli/index.d.ts +0 -3
- package/dist/cli/infra.d.ts +0 -78
- package/dist/cli/init.d.ts +0 -8
- package/dist/cli/intent-input.d.ts +0 -16
- package/dist/cli/intent-match.d.ts +0 -30
- package/dist/cli/intent-sessions.d.ts +0 -24
- package/dist/cli/intent-team.d.ts +0 -25
- package/dist/cli/intent.d.ts +0 -22
- package/dist/cli/ls.d.ts +0 -2
- package/dist/cli/mailbox-cli.d.ts +0 -6
- package/dist/cli/managed.d.ts +0 -62
- package/dist/cli/mcp-install.d.ts +0 -23
- package/dist/cli/mcp.d.ts +0 -2
- package/dist/cli/model.d.ts +0 -21
- package/dist/cli/paths.d.ts +0 -50
- package/dist/cli/plan-wizard.d.ts +0 -42
- package/dist/cli/plan.d.ts +0 -20
- package/dist/cli/queue-delivery.d.ts +0 -122
- package/dist/cli/quickrun.d.ts +0 -14
- package/dist/cli/ratelimit.d.ts +0 -2
- package/dist/cli/remote-fetch.d.ts +0 -7
- package/dist/cli/run-queries.d.ts +0 -82
- package/dist/cli/running.d.ts +0 -5
- package/dist/cli/save-script.d.ts +0 -41
- package/dist/cli/script.d.ts +0 -6
- package/dist/cli/seed-flight.d.ts +0 -2
- package/dist/cli/self-identity.d.ts +0 -25
- package/dist/cli/session-idle.d.ts +0 -118
- package/dist/cli/status.d.ts +0 -22
- package/dist/cli/tail.d.ts +0 -18
- package/dist/cli/target-resolver.d.ts +0 -139
- package/dist/cli/team-status.d.ts +0 -91
- package/dist/cli/teamfile-compat.d.ts +0 -116
- package/dist/cli/teamfile-store.d.ts +0 -18
- package/dist/cli/teamfile-template.d.ts +0 -47
- package/dist/cli/template-env.d.ts +0 -25
- package/dist/cli/terminal-lock.d.ts +0 -25
- package/dist/cli/terminal.d.ts +0 -23
- package/dist/cli/time-filter.d.ts +0 -10
- package/dist/cli/update-notifier.d.ts +0 -11
- package/dist/cli/version-util.d.ts +0 -23
- package/dist/config/seed_templates.d.ts +0 -1
- package/dist/db/backfill-event-log.d.ts +0 -26
- package/dist/db/delegation.d.ts +0 -37
- package/dist/db/escalation_vocab.d.ts +0 -45
- package/dist/db/event-log.d.ts +0 -40
- package/dist/db/index.d.ts +0 -1213
- package/dist/db/inflight-acquire.d.ts +0 -70
- package/dist/db/invocation-event-projections.d.ts +0 -65
- package/dist/db/ledger-identity.test.d.ts +0 -1
- package/dist/db/live-event-projections.d.ts +0 -92
- package/dist/db/migrate.d.ts +0 -51
- package/dist/db/open-readonly.d.ts +0 -2
- package/dist/db/process-liveness.d.ts +0 -37
- package/dist/db/sqlite.d.ts +0 -53
- package/dist/db/sqlite.test.d.ts +0 -1
- package/dist/db/terminal-lock.d.ts +0 -14
- package/dist/db/tracked-invocation-reconcile.d.ts +0 -52
- package/dist/db/tracked-invocation.d.ts +0 -116
- package/dist/mcp/dispatch.d.ts +0 -45
- package/dist/mcp/mediation.d.ts +0 -128
- package/dist/mcp/path-warning.d.ts +0 -7
- package/dist/mcp/server.d.ts +0 -63
- package/dist/mcp/tools.d.ts +0 -24
- package/dist/providers/adapter.d.ts +0 -271
- package/dist/providers/adapters/agy-adapter.d.ts +0 -18
- package/dist/providers/adapters/claude-adapter.d.ts +0 -20
- package/dist/providers/adapters/codex-adapter.d.ts +0 -22
- package/dist/providers/adapters/copilot-adapter.d.ts +0 -16
- package/dist/providers/adapters/dsh-adapter.d.ts +0 -89
- package/dist/providers/adapters/gemini-adapter.d.ts +0 -44
- package/dist/providers/adapters/hermes-adapter.d.ts +0 -71
- package/dist/providers/adapters/index.d.ts +0 -35
- package/dist/providers/adapters/kimi-adapter.d.ts +0 -16
- package/dist/providers/adapters/lmplayer-adapter.d.ts +0 -14
- package/dist/providers/adapters/opencode-adapter.d.ts +0 -11
- package/dist/providers/adapters/pi-adapter.d.ts +0 -17
- package/dist/providers/adapters/print-turn.d.ts +0 -29
- package/dist/providers/adapters/qwen-adapter.d.ts +0 -11
- package/dist/providers/agy.d.ts +0 -32
- package/dist/providers/base-adapter.d.ts +0 -110
- package/dist/providers/base.d.ts +0 -12
- package/dist/providers/binary-check.d.ts +0 -102
- package/dist/providers/bundle.d.ts +0 -124
- package/dist/providers/claude-mock.d.ts +0 -90
- package/dist/providers/claude.d.ts +0 -21
- package/dist/providers/codex-config.d.ts +0 -15
- package/dist/providers/codex.d.ts +0 -25
- package/dist/providers/config/init-config.d.ts +0 -59
- package/dist/providers/config/init-edit.d.ts +0 -3
- package/dist/providers/config/init-file.d.ts +0 -20
- package/dist/providers/config/init-write.d.ts +0 -2
- package/dist/providers/config/model-selection-lint.d.ts +0 -70
- package/dist/providers/config/team-config.d.ts +0 -184
- package/dist/providers/config/types.d.ts +0 -146
- package/dist/providers/config/user-config.d.ts +0 -88
- package/dist/providers/copilot.d.ts +0 -21
- package/dist/providers/debug.d.ts +0 -128
- package/dist/providers/dsh-sidecar.d.ts +0 -65
- package/dist/providers/dsh-zstd.d.ts +0 -27
- package/dist/providers/dsh.d.ts +0 -37
- package/dist/providers/frontmatter.d.ts +0 -46
- package/dist/providers/gemini-session-reader.d.ts +0 -151
- package/dist/providers/gemini.d.ts +0 -39
- package/dist/providers/hermes.d.ts +0 -90
- package/dist/providers/index.d.ts +0 -423
- package/dist/providers/kimi.d.ts +0 -37
- package/dist/providers/model-catalog.d.ts +0 -145
- package/dist/providers/model-suggestions.d.ts +0 -4
- package/dist/providers/one-shot-timeout.d.ts +0 -1
- package/dist/providers/opencode-config.d.ts +0 -62
- package/dist/providers/opencode.d.ts +0 -40
- package/dist/providers/parsers/acp.d.ts +0 -71
- package/dist/providers/parsers/codex-app-server.d.ts +0 -60
- package/dist/providers/parsers/stream-json.d.ts +0 -57
- package/dist/providers/passive-readers/agy.d.ts +0 -155
- package/dist/providers/passive-readers/copilot.d.ts +0 -173
- package/dist/providers/passive-readers/dsh.d.ts +0 -34
- package/dist/providers/passive-readers/kimi.d.ts +0 -44
- package/dist/providers/passive-readers/opencode.d.ts +0 -89
- package/dist/providers/passive-readers/qwen.d.ts +0 -151
- package/dist/providers/passive-readers/shared.d.ts +0 -138
- package/dist/providers/passive-session-reader.d.ts +0 -188
- package/dist/providers/path-utils.d.ts +0 -1
- package/dist/providers/pi.d.ts +0 -32
- package/dist/providers/pricing.d.ts +0 -107
- package/dist/providers/qwen.d.ts +0 -22
- package/dist/providers/ratelimit/agy.d.ts +0 -22
- package/dist/providers/ratelimit/claude-auth.d.ts +0 -13
- package/dist/providers/ratelimit/claude.d.ts +0 -6
- package/dist/providers/ratelimit/codex.d.ts +0 -7
- package/dist/providers/ratelimit/kimi-auth.d.ts +0 -15
- package/dist/providers/ratelimit/kimi.d.ts +0 -6
- package/dist/providers/ratelimit/schema.d.ts +0 -28
- package/dist/providers/ratelimit-readings.d.ts +0 -19
- package/dist/providers/registry.d.ts +0 -31
- package/dist/providers/resume.d.ts +0 -43
- package/dist/providers/seed-instruction.d.ts +0 -3
- package/dist/providers/self-session-env.d.ts +0 -21
- package/dist/providers/session-limit.d.ts +0 -9
- package/dist/providers/strip-ansi.d.ts +0 -5
- package/dist/providers/transport-errors.d.ts +0 -94
- package/dist/providers/transport-lifecycle.d.ts +0 -63
- package/dist/providers/transport-wrappers.d.ts +0 -110
- package/dist/providers/transports/acp-profiles/config-option-step.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/copilot.d.ts +0 -12
- package/dist/providers/transports/acp-profiles/gemini.d.ts +0 -22
- package/dist/providers/transports/acp-profiles/hermes.d.ts +0 -27
- package/dist/providers/transports/acp-profiles/index.d.ts +0 -19
- package/dist/providers/transports/acp-profiles/kimi.d.ts +0 -24
- package/dist/providers/transports/acp-profiles/opencode.d.ts +0 -26
- package/dist/providers/transports/acp-profiles/types.d.ts +0 -258
- package/dist/providers/transports/acp-rpc.d.ts +0 -18
- package/dist/providers/transports/acp.d.ts +0 -217
- package/dist/providers/transports/codex-app-server.d.ts +0 -190
- package/dist/providers/transports/hold-open.d.ts +0 -120
- package/dist/providers/transports/manager.d.ts +0 -21
- package/dist/providers/transports/stream-json.d.ts +0 -162
- package/dist/providers/transports/types.d.ts +0 -56
- package/dist/providers/types.d.ts +0 -154
- package/dist/providers/yolo-contract.d.ts +0 -131
- package/dist/script/adapter.d.ts +0 -107
- package/dist/script/batch-script.d.ts +0 -7
- package/dist/script/index.d.ts +0 -3
- package/dist/script/init-environment.d.ts +0 -8
- package/dist/script/lmbee-module.d.ts +0 -2
- package/dist/script/lmscript.d.ts +0 -647
- package/dist/shared/policy.d.ts +0 -74
- package/dist/shared-lib/db.d.ts +0 -25
- package/dist/shared-lib/passive-session-reader.d.ts +0 -2
- package/dist/shared-lib/provider-parse.d.ts +0 -6
- package/dist/templates/basedir.d.ts +0 -52
- package/dist/uri/lmctl_uri.d.ts +0 -38
|
@@ -1,647 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* LMScript - A lightweight prototype scripting language implemented in TypeScript.
|
|
3
|
-
*
|
|
4
|
-
* Requirements Met:
|
|
5
|
-
* 1. Single file: Self-contained implementation (Lexer, Parser, Static Checker, Interpreter, Host API) with zero dependencies.
|
|
6
|
-
* 2. Scan all and check before execution: In-memory AST validation upfront. Zero intermediate files generated.
|
|
7
|
-
* 3. Language features: Top-level functions, flow control (if/else, while, for, break, continue, return), tuple & destructuring assignment: (a, b) = [1, 2], dot notation (data.key), object literals { key: val }, and negative indexing arr[-1].
|
|
8
|
-
* 4. Predefined functions implemented in TypeScript:
|
|
9
|
-
* - File I/O: read_file, write_file, append_file, read_lines, read_json, write_json, read_csv, write_csv, file_exists, delete_file, mkdir, rmdir, copy_file, move_file, basename, dirname, path_join, abs_path.
|
|
10
|
-
* - Data structures:
|
|
11
|
-
* * List/Array: list, len, push, pop, shift, unshift, insert, remove_at, slice, concat, reverse, sort, contains, index_of, join, unique, flatten, first, last, is_empty, sum, avg.
|
|
12
|
-
* * Hash/Map: hash, keys, values, entries, from_entries, has_key, get, set, delete_key, merge, clone, clear, size. ("map" is deliberately unimplemented, not an empty-hash constructor -- reserved for a future higher-order array-transform function.)
|
|
13
|
-
* - JSON processing: data = json(out), json_parse, json_parse_safe, json_stringify, pluck, filter_by, find_by.
|
|
14
|
-
* - Regex: regex_test/test, regex_match/match/search, regex_find_all/findall, regex_replace, split_regex -- patterns are plain strings compiled via the host RegExp engine.
|
|
15
|
-
* - Environment & time: env, getenv, set_env, now, timestamp, date, strftime, date_format.
|
|
16
|
-
* - Null handling: coalesce, if_null, default_to, if_else (expression-level ternary).
|
|
17
|
-
* - System & Process: system() returning SystemResult, prompt_human() for attended terminal pause/handoff.
|
|
18
|
-
* - Comprehensive string operations (split, lines, words, join, trim, upper, lower, contains, replace, slice, etc.).
|
|
19
|
-
* - First-class function values: a bare reference to an already-declared function name (user or host) is a
|
|
20
|
-
* callable FunctionRef, assignable to a variable (`g = dbl; g(4);`) -- a NAMED reference, not a lexical
|
|
21
|
-
* closure; calling through a non-identifier expression (e.g. `arr[0](x)`) is not supported.
|
|
22
|
-
* 5. Register new functions: API allowing host TypeScript functions to be registered and checked statically.
|
|
23
|
-
*
|
|
24
|
-
* Security & Authority Model:
|
|
25
|
-
* LMScript executes with full operator authority (no sandbox). File I/O operations (read_file,
|
|
26
|
-
* write_file, etc.) and shell processes (system()) execute with the local permissions and environment
|
|
27
|
-
* of the invoking user. Scripts should only be accepted and run from trusted operator sources.
|
|
28
|
-
*/
|
|
29
|
-
export interface SourceLocation {
|
|
30
|
-
line: number;
|
|
31
|
-
column: number;
|
|
32
|
-
file?: string;
|
|
33
|
-
}
|
|
34
|
-
export interface Diagnostic {
|
|
35
|
-
message: string;
|
|
36
|
-
line: number;
|
|
37
|
-
column: number;
|
|
38
|
-
severity: "error" | "warning";
|
|
39
|
-
file?: string;
|
|
40
|
-
}
|
|
41
|
-
export declare class LMScriptError extends Error {
|
|
42
|
-
readonly message: string;
|
|
43
|
-
readonly line: number;
|
|
44
|
-
readonly column: number;
|
|
45
|
-
readonly stage: "LEXER" | "PARSER" | "CHECKER" | "RUNTIME";
|
|
46
|
-
readonly file?: string;
|
|
47
|
-
constructor(message: string, line: number, column: number, stage: "LEXER" | "PARSER" | "CHECKER" | "RUNTIME", file?: string);
|
|
48
|
-
}
|
|
49
|
-
export declare class LMScriptExit extends Error {
|
|
50
|
-
readonly isControlFlow = true;
|
|
51
|
-
readonly exitCode: number;
|
|
52
|
-
constructor(exitCode?: number);
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Formats a diagnostic with a visual code snippet and caret pointer.
|
|
56
|
-
*/
|
|
57
|
-
export declare function formatDiagnostic(diag: Diagnostic, source?: string): string;
|
|
58
|
-
/**
|
|
59
|
-
* Result record returned by `system()`.
|
|
60
|
-
*
|
|
61
|
-
* Invariants & Contract Guarantees:
|
|
62
|
-
* 1. Strict Completion: `system()` is strictly a completion primitive and always awaits
|
|
63
|
-
* process exit. It does not return running or detached processes.
|
|
64
|
-
* 2. Null-No-Overload: `code: null` strictly denotes abnormal termination (killed by signal
|
|
65
|
-
* or timed out). `code: null` NEVER means "still running" or "detached".
|
|
66
|
-
* 3. Future Background Decoupling: Any future non-blocking background handle will be a separate
|
|
67
|
-
* discriminated record (`{ kind: 'process', pid, started_at }`) with dedicated wait/poll
|
|
68
|
-
* primitives, rather than overloading `SystemResult` with nullable fields. Handles carry
|
|
69
|
-
* `started_at` timestamp to protect against PID recycling.
|
|
70
|
-
*/
|
|
71
|
-
export interface SystemResult {
|
|
72
|
-
stdout: string;
|
|
73
|
-
stderr: string;
|
|
74
|
-
code: number | null;
|
|
75
|
-
signal: string | null;
|
|
76
|
-
timed_out: boolean;
|
|
77
|
-
duration_ms: number;
|
|
78
|
-
pid: number | null;
|
|
79
|
-
}
|
|
80
|
-
export declare function createSystemResult(stdout: string, stderr: string, code: number | null, signal?: string | null, timedOut?: boolean, durationMs?: number, pid?: number | null): SystemResult;
|
|
81
|
-
export declare function shellQuote(value: any): string;
|
|
82
|
-
export declare function systemSync(cmd: string | any[], timeoutMs?: number): SystemResult;
|
|
83
|
-
/**
|
|
84
|
-
* Safely parses JSON string with preamble and markdown fence recovery.
|
|
85
|
-
* Returns `fallback` (defaulting to null) on parse failure rather than throwing.
|
|
86
|
-
*/
|
|
87
|
-
export declare function safeParseJson(raw: any, fallback?: any): any;
|
|
88
|
-
/**
|
|
89
|
-
* Synchronous operator prompt on terminal stdin.
|
|
90
|
-
* Returns the entered string (with trailing newline stripped), or null if stdin is closed/non-interactive.
|
|
91
|
-
*/
|
|
92
|
-
export declare function promptHumanSync(question?: any): string | null;
|
|
93
|
-
/**
|
|
94
|
-
* Asynchronous operator prompt on terminal or provided input/output stream.
|
|
95
|
-
* Returns the entered string, or null if stdin is closed or non-interactive without pending data.
|
|
96
|
-
*/
|
|
97
|
-
export declare function promptHumanAsync(question?: any, inStream?: any, outStream?: any): Promise<string | null>;
|
|
98
|
-
export declare function parseCsv(text: string, hasHeader?: boolean, delimiter?: string): any[];
|
|
99
|
-
export declare function stringifyCsv(data: any[], delimiter?: string): string;
|
|
100
|
-
export type TokenType = "FN" | "LET" | "IF" | "ELSE" | "WHILE" | "FOR" | "RETURN" | "BREAK" | "CONTINUE" | "TRUE" | "FALSE" | "NULL" | "PARALLEL" | "SYNC" | "IMPORT" | "IDENTIFIER" | "NUMBER" | "STRING" | "FSTRING_START" | "FSTRING_TEXT" | "FSTRING_FIELD_START" | "FSTRING_FIELD_END" | "FSTRING_END" | "PLUS" | "MINUS" | "STAR" | "SLASH" | "PERCENT" | "ASSIGN" | "EQUAL" | "NOT_EQUAL" | "LESS" | "LESS_EQUAL" | "GREATER" | "GREATER_EQUAL" | "AND" | "OR" | "NOT" | "DOT" | "COLON" | "LPAREN" | "RPAREN" | "LBRACE" | "RBRACE" | "LBRACKET" | "RBRACKET" | "COMMA" | "SEMICOLON" | "EOF";
|
|
101
|
-
export interface Token {
|
|
102
|
-
type: TokenType;
|
|
103
|
-
value: string;
|
|
104
|
-
literal?: any;
|
|
105
|
-
line: number;
|
|
106
|
-
column: number;
|
|
107
|
-
offset?: number;
|
|
108
|
-
endOffset?: number;
|
|
109
|
-
endLine?: number;
|
|
110
|
-
endColumn?: number;
|
|
111
|
-
stringLiteral?: {
|
|
112
|
-
prefix: string;
|
|
113
|
-
raw: boolean;
|
|
114
|
-
triple: boolean;
|
|
115
|
-
formatted: boolean;
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
export declare class Lexer {
|
|
119
|
-
readonly diagnostics: Diagnostic[];
|
|
120
|
-
private formattedDepth;
|
|
121
|
-
private readonly modes;
|
|
122
|
-
private readonly source;
|
|
123
|
-
private readonly length;
|
|
124
|
-
private readonly file?;
|
|
125
|
-
private pos;
|
|
126
|
-
private line;
|
|
127
|
-
private column;
|
|
128
|
-
constructor(source: string, file?: string);
|
|
129
|
-
tokenize(): Token[];
|
|
130
|
-
private position;
|
|
131
|
-
private spannedToken;
|
|
132
|
-
private scanTokens;
|
|
133
|
-
private readNextToken;
|
|
134
|
-
private peek;
|
|
135
|
-
private peekNext;
|
|
136
|
-
private advance;
|
|
137
|
-
private match;
|
|
138
|
-
private isDigit;
|
|
139
|
-
private isAlpha;
|
|
140
|
-
private isAlphaNumeric;
|
|
141
|
-
private skipWhitespaceAndComments;
|
|
142
|
-
private readNumber;
|
|
143
|
-
private readString;
|
|
144
|
-
private consumeStringNewline;
|
|
145
|
-
private readModernEscape;
|
|
146
|
-
private readModernString;
|
|
147
|
-
private readIdentifier;
|
|
148
|
-
}
|
|
149
|
-
export type BinaryOp = "+" | "-" | "*" | "/" | "%" | "==" | "!=" | "<" | "<=" | ">" | ">=" | "&&" | "||";
|
|
150
|
-
export type UnaryOp = "!" | "-";
|
|
151
|
-
export interface NodeBase {
|
|
152
|
-
line: number;
|
|
153
|
-
column: number;
|
|
154
|
-
file?: string;
|
|
155
|
-
}
|
|
156
|
-
export type Expr = LiteralExpr | InterpolatedStringExpr | IdentifierExpr | AssignExpr | IndexAssignExpr | TupleAssignExpr | UnaryExpr | BinaryExpr | CallExpr | ArrayExpr | IndexExpr | GroupingExpr | TupleExpr | ObjectExpr | ParallelExpr;
|
|
157
|
-
export interface ParallelExpr extends NodeBase {
|
|
158
|
-
kind: "ParallelExpr";
|
|
159
|
-
tasks: CallExpr[];
|
|
160
|
-
}
|
|
161
|
-
export interface LiteralExpr extends NodeBase {
|
|
162
|
-
kind: "LiteralExpr";
|
|
163
|
-
value: any;
|
|
164
|
-
}
|
|
165
|
-
export interface InterpolationField extends NodeBase {
|
|
166
|
-
expression: Expr;
|
|
167
|
-
offset?: number;
|
|
168
|
-
endOffset?: number;
|
|
169
|
-
}
|
|
170
|
-
export interface InterpolatedStringExpr extends NodeBase {
|
|
171
|
-
kind: "InterpolatedStringExpr";
|
|
172
|
-
parts: (string | InterpolationField)[];
|
|
173
|
-
}
|
|
174
|
-
export interface IdentifierExpr extends NodeBase {
|
|
175
|
-
kind: "IdentifierExpr";
|
|
176
|
-
name: string;
|
|
177
|
-
}
|
|
178
|
-
export interface AssignExpr extends NodeBase {
|
|
179
|
-
kind: "AssignExpr";
|
|
180
|
-
target: string;
|
|
181
|
-
value: Expr;
|
|
182
|
-
}
|
|
183
|
-
export interface IndexAssignExpr extends NodeBase {
|
|
184
|
-
kind: "IndexAssignExpr";
|
|
185
|
-
target: Expr;
|
|
186
|
-
index: Expr;
|
|
187
|
-
value: Expr;
|
|
188
|
-
}
|
|
189
|
-
export interface TupleAssignExpr extends NodeBase {
|
|
190
|
-
kind: "TupleAssignExpr";
|
|
191
|
-
targets: string[];
|
|
192
|
-
value: Expr;
|
|
193
|
-
}
|
|
194
|
-
export interface UnaryExpr extends NodeBase {
|
|
195
|
-
kind: "UnaryExpr";
|
|
196
|
-
operator: UnaryOp;
|
|
197
|
-
operand: Expr;
|
|
198
|
-
}
|
|
199
|
-
export interface BinaryExpr extends NodeBase {
|
|
200
|
-
kind: "BinaryExpr";
|
|
201
|
-
operator: BinaryOp;
|
|
202
|
-
left: Expr;
|
|
203
|
-
right: Expr;
|
|
204
|
-
}
|
|
205
|
-
export interface CallExpr extends NodeBase {
|
|
206
|
-
kind: "CallExpr";
|
|
207
|
-
callee: string;
|
|
208
|
-
args: Expr[];
|
|
209
|
-
}
|
|
210
|
-
export interface ArrayExpr extends NodeBase {
|
|
211
|
-
kind: "ArrayExpr";
|
|
212
|
-
elements: Expr[];
|
|
213
|
-
}
|
|
214
|
-
export interface IndexExpr extends NodeBase {
|
|
215
|
-
kind: "IndexExpr";
|
|
216
|
-
target: Expr;
|
|
217
|
-
index: Expr;
|
|
218
|
-
}
|
|
219
|
-
export interface GroupingExpr extends NodeBase {
|
|
220
|
-
kind: "GroupingExpr";
|
|
221
|
-
expression: Expr;
|
|
222
|
-
}
|
|
223
|
-
export interface TupleExpr extends NodeBase {
|
|
224
|
-
kind: "TupleExpr";
|
|
225
|
-
elements: Expr[];
|
|
226
|
-
}
|
|
227
|
-
export interface ObjectProperty {
|
|
228
|
-
key: string;
|
|
229
|
-
value: Expr;
|
|
230
|
-
}
|
|
231
|
-
export interface ObjectExpr extends NodeBase {
|
|
232
|
-
kind: "ObjectExpr";
|
|
233
|
-
properties: ObjectProperty[];
|
|
234
|
-
}
|
|
235
|
-
export type Stmt = ImportStmt | FunctionDeclStmt | VarDeclStmt | TupleVarDeclStmt | IfStmt | WhileStmt | ForStmt | ReturnStmt | BreakStmt | ContinueStmt | SyncAssignStmt | SyncIndexAssignStmt | SyncCallStmt | ExprStmt | BlockStmt;
|
|
236
|
-
export interface ImportStmt extends NodeBase {
|
|
237
|
-
kind: "ImportStmt";
|
|
238
|
-
path: string;
|
|
239
|
-
}
|
|
240
|
-
export interface SyncAssignStmt extends NodeBase {
|
|
241
|
-
kind: "SyncAssignStmt";
|
|
242
|
-
target: string;
|
|
243
|
-
value: Expr;
|
|
244
|
-
}
|
|
245
|
-
export interface SyncIndexAssignStmt extends NodeBase {
|
|
246
|
-
kind: "SyncIndexAssignStmt";
|
|
247
|
-
target: Expr;
|
|
248
|
-
index: Expr;
|
|
249
|
-
value: Expr;
|
|
250
|
-
}
|
|
251
|
-
export interface SyncCallStmt extends NodeBase {
|
|
252
|
-
kind: "SyncCallStmt";
|
|
253
|
-
call: CallExpr;
|
|
254
|
-
}
|
|
255
|
-
export interface FunctionDeclStmt extends NodeBase {
|
|
256
|
-
kind: "FunctionDeclStmt";
|
|
257
|
-
name: string;
|
|
258
|
-
params: string[];
|
|
259
|
-
body: BlockStmt;
|
|
260
|
-
}
|
|
261
|
-
export interface VarDeclStmt extends NodeBase {
|
|
262
|
-
kind: "VarDeclStmt";
|
|
263
|
-
name: string;
|
|
264
|
-
initializer?: Expr;
|
|
265
|
-
}
|
|
266
|
-
export interface TupleVarDeclStmt extends NodeBase {
|
|
267
|
-
kind: "TupleVarDeclStmt";
|
|
268
|
-
names: string[];
|
|
269
|
-
initializer: Expr;
|
|
270
|
-
}
|
|
271
|
-
export interface IfStmt extends NodeBase {
|
|
272
|
-
kind: "IfStmt";
|
|
273
|
-
condition: Expr;
|
|
274
|
-
thenBranch: Stmt;
|
|
275
|
-
elseBranch?: Stmt;
|
|
276
|
-
}
|
|
277
|
-
export interface WhileStmt extends NodeBase {
|
|
278
|
-
kind: "WhileStmt";
|
|
279
|
-
condition: Expr;
|
|
280
|
-
body: Stmt;
|
|
281
|
-
}
|
|
282
|
-
export interface ForStmt extends NodeBase {
|
|
283
|
-
kind: "ForStmt";
|
|
284
|
-
init?: Stmt;
|
|
285
|
-
condition?: Expr;
|
|
286
|
-
update?: Expr;
|
|
287
|
-
body: Stmt;
|
|
288
|
-
}
|
|
289
|
-
export interface ReturnStmt extends NodeBase {
|
|
290
|
-
kind: "ReturnStmt";
|
|
291
|
-
value?: Expr;
|
|
292
|
-
}
|
|
293
|
-
export interface BreakStmt extends NodeBase {
|
|
294
|
-
kind: "BreakStmt";
|
|
295
|
-
}
|
|
296
|
-
export interface ContinueStmt extends NodeBase {
|
|
297
|
-
kind: "ContinueStmt";
|
|
298
|
-
}
|
|
299
|
-
export interface ExprStmt extends NodeBase {
|
|
300
|
-
kind: "ExprStmt";
|
|
301
|
-
expr: Expr;
|
|
302
|
-
}
|
|
303
|
-
export interface BlockStmt extends NodeBase {
|
|
304
|
-
kind: "BlockStmt";
|
|
305
|
-
statements: Stmt[];
|
|
306
|
-
}
|
|
307
|
-
export interface Program extends NodeBase {
|
|
308
|
-
kind: "Program";
|
|
309
|
-
statements: Stmt[];
|
|
310
|
-
}
|
|
311
|
-
export declare function attachSourceFile(node: any, file: string): void;
|
|
312
|
-
export declare class Parser {
|
|
313
|
-
private readonly tokens;
|
|
314
|
-
private current;
|
|
315
|
-
private readonly file?;
|
|
316
|
-
constructor(tokens: Token[], file?: string);
|
|
317
|
-
parse(): Program;
|
|
318
|
-
private parseDeclaration;
|
|
319
|
-
private parseImportStmt;
|
|
320
|
-
private parseFunctionDecl;
|
|
321
|
-
private parseVarDecl;
|
|
322
|
-
private parseStatement;
|
|
323
|
-
private parseSyncStatement;
|
|
324
|
-
private parseIfStatement;
|
|
325
|
-
private parseWhileStatement;
|
|
326
|
-
private parseForStatement;
|
|
327
|
-
private parseReturnStatement;
|
|
328
|
-
private parseBreakStatement;
|
|
329
|
-
private parseContinueStatement;
|
|
330
|
-
private parseBlockBody;
|
|
331
|
-
private parseExpressionStatement;
|
|
332
|
-
parseExpression(): Expr;
|
|
333
|
-
private parseAssignment;
|
|
334
|
-
private parseLogicalOr;
|
|
335
|
-
private parseLogicalAnd;
|
|
336
|
-
private parseEquality;
|
|
337
|
-
private parseRelational;
|
|
338
|
-
private parseAdditive;
|
|
339
|
-
private parseMultiplicative;
|
|
340
|
-
private parseUnary;
|
|
341
|
-
private parseCallAndIndex;
|
|
342
|
-
private parsePrimary;
|
|
343
|
-
private parseFormattedString;
|
|
344
|
-
private validateFieldExpression;
|
|
345
|
-
private match;
|
|
346
|
-
private check;
|
|
347
|
-
private advance;
|
|
348
|
-
private isAtEnd;
|
|
349
|
-
private peek;
|
|
350
|
-
private previous;
|
|
351
|
-
private consume;
|
|
352
|
-
private consumeOptionalSemicolon;
|
|
353
|
-
}
|
|
354
|
-
export declare const STDLIB_SOURCE = "# LMScript Standard Library (std.lms)\n\n# String Utilities\nfn is_blank(s) {\n if (s == null) {\n return true;\n }\n return len(trim(s)) == 0;\n}\n\n# Array Utilities\nfn chunk(arr, size) {\n if (size <= 0) {\n return [];\n }\n res = [];\n current = [];\n for (i = 0; i < len(arr); i = i + 1) {\n push(current, arr[i]);\n if (len(current) == size) {\n push(res, current);\n current = [];\n }\n }\n if (len(current) > 0) {\n push(res, current);\n }\n return res;\n}\n\nfn compact(arr) {\n res = [];\n for (i = 0; i < len(arr); i = i + 1) {\n item = arr[i];\n if (item != null) {\n push(res, item);\n }\n }\n return res;\n}\n\nfn zip(arr1, arr2) {\n res = [];\n limit = len(arr1);\n if (len(arr2) < limit) {\n limit = len(arr2);\n }\n for (i = 0; i < limit; i = i + 1) {\n push(res, [arr1[i], arr2[i]]);\n }\n return res;\n}\n\nfn enumerate(arr) {\n res = [];\n for (i = 0; i < len(arr); i = i + 1) {\n push(res, [i, arr[i]]);\n }\n return res;\n}\n\nfn take(arr, n) {\n res = [];\n limit = n;\n if (limit > len(arr)) {\n limit = len(arr);\n }\n for (i = 0; i < limit; i = i + 1) {\n push(res, arr[i]);\n }\n return res;\n}\n\nfn drop(arr, n) {\n res = [];\n start = n;\n if (start < 0) {\n start = 0;\n }\n for (i = start; i < len(arr); i = i + 1) {\n push(res, arr[i]);\n }\n return res;\n}\n\n# Math Utilities\nfn clamp(val, low, high) {\n if (val < low) {\n return low;\n }\n if (val > high) {\n return high;\n }\n return val;\n}\n";
|
|
355
|
-
export declare function getStdlibProgram(): Program;
|
|
356
|
-
export interface CheckOptions {
|
|
357
|
-
/** Inspect literal built-in read paths against the current filesystem. No script evaluation. */
|
|
358
|
-
checkFiles?: boolean;
|
|
359
|
-
/** Pre-defined global variable names available without declaration (e.g. args, ARGV) */
|
|
360
|
-
globals?: string[];
|
|
361
|
-
/** File path of the script being checked/executed */
|
|
362
|
-
file?: string;
|
|
363
|
-
/** Base directory for resolving relative imports (defaults to process.cwd() or path.dirname(file)) */
|
|
364
|
-
baseDir?: string;
|
|
365
|
-
/** Disable implicit standard library inclusion */
|
|
366
|
-
noStdlib?: boolean;
|
|
367
|
-
/** Custom module resolver for virtual files / test isolation */
|
|
368
|
-
moduleResolver?: (specifier: string, fromFile?: string) => {
|
|
369
|
-
path: string;
|
|
370
|
-
source: string;
|
|
371
|
-
};
|
|
372
|
-
/** Custom stderr output writer for runtime error logs */
|
|
373
|
-
stderr?: (text: string) => void;
|
|
374
|
-
}
|
|
375
|
-
export type CompileOptions = CheckOptions;
|
|
376
|
-
export declare function compileProgram(source: string, options?: CompileOptions): {
|
|
377
|
-
program: Program;
|
|
378
|
-
loadedFiles: string[];
|
|
379
|
-
diagnostics: Diagnostic[];
|
|
380
|
-
};
|
|
381
|
-
export interface FunctionSignature {
|
|
382
|
-
name: string;
|
|
383
|
-
paramCount: number;
|
|
384
|
-
params: string[];
|
|
385
|
-
isHost: boolean;
|
|
386
|
-
isStdlib?: boolean;
|
|
387
|
-
file?: string;
|
|
388
|
-
line: number;
|
|
389
|
-
column: number;
|
|
390
|
-
}
|
|
391
|
-
export type HostFunctionArity = number | {
|
|
392
|
-
min: number;
|
|
393
|
-
max?: number;
|
|
394
|
-
};
|
|
395
|
-
type CheckableHostFunction = {
|
|
396
|
-
arity?: HostFunctionArity;
|
|
397
|
-
readsFile?: boolean;
|
|
398
|
-
isContainerMutation?: boolean;
|
|
399
|
-
};
|
|
400
|
-
export declare class StaticChecker {
|
|
401
|
-
private diagnostics;
|
|
402
|
-
private readonly hostFunctions;
|
|
403
|
-
private readonly options;
|
|
404
|
-
private readonly functions;
|
|
405
|
-
private currentScope;
|
|
406
|
-
private loopDepth;
|
|
407
|
-
private inFunction;
|
|
408
|
-
hasConcurrency: boolean;
|
|
409
|
-
constructor(hostFunctions: Map<string, CheckableHostFunction>, options?: CheckOptions);
|
|
410
|
-
check(program: Program): Diagnostic[];
|
|
411
|
-
private addError;
|
|
412
|
-
private collectFunction;
|
|
413
|
-
private checkStmt;
|
|
414
|
-
private checkReadPath;
|
|
415
|
-
private checkExpr;
|
|
416
|
-
}
|
|
417
|
-
export declare class ReturnSignal {
|
|
418
|
-
readonly value: any;
|
|
419
|
-
constructor(value: any);
|
|
420
|
-
}
|
|
421
|
-
export declare class BreakSignal {
|
|
422
|
-
}
|
|
423
|
-
export declare class ContinueSignal {
|
|
424
|
-
}
|
|
425
|
-
/**
|
|
426
|
-
* First-class function value (operator ruling, 2026-09-29, Rule 2 -- "if it
|
|
427
|
-
* is just how it came out, it is worth fixing": no stated design rationale
|
|
428
|
-
* anywhere separated function names from the variable namespace; it was an
|
|
429
|
-
* omission of scope, not a deliberate tradeoff). A bare reference to an
|
|
430
|
-
* already-declared function name (user `fn` or host) evaluates to one of
|
|
431
|
-
* these, which can be assigned, stored, and called through a variable --
|
|
432
|
-
* `g = dbl; g(4);` now works. Deliberately a NAMED reference, not a true
|
|
433
|
-
* lexical closure over an enclosing scope: nothing in the reported gaps
|
|
434
|
-
* (map/filter/reduce/etc. over top-level named functions) needs closures,
|
|
435
|
-
* and adding them is a materially bigger, separate change.
|
|
436
|
-
*/
|
|
437
|
-
export declare class FunctionRef {
|
|
438
|
-
readonly name: string;
|
|
439
|
-
constructor(name: string);
|
|
440
|
-
toString(): string;
|
|
441
|
-
}
|
|
442
|
-
export declare class Environment {
|
|
443
|
-
private static nextId;
|
|
444
|
-
readonly id: number;
|
|
445
|
-
private readonly values;
|
|
446
|
-
readonly parent?: Environment;
|
|
447
|
-
/**
|
|
448
|
-
* True only for the environment a function CALL creates (invokeNamed's
|
|
449
|
-
* fnEnv) -- never for a plain nested block (if/while/for body). Marks
|
|
450
|
-
* where `set()`'s upward search for an EXISTING binding must stop.
|
|
451
|
-
*
|
|
452
|
-
* Real incident, 2026-09-29 (operator finding): `fn f(x) { outer = 1; }`
|
|
453
|
-
* silently mutated an outer/global `outer` whenever one already existed,
|
|
454
|
-
* purely because the name collided -- "dynamic scoping with implicit
|
|
455
|
-
* global mutation," math's words, and no `local`/`my`/`let` to defend
|
|
456
|
-
* against it (a *working* `let` already existed in the grammar, but was
|
|
457
|
-
* entirely undocumented, which is why it went unnoticed). A name that
|
|
458
|
-
* happens to already exist as a global is not evidence the function
|
|
459
|
-
* meant to reference it. `set()` now treats a name not yet bound WITHIN
|
|
460
|
-
* the current function's own scope chain as a fresh function-local,
|
|
461
|
-
* matching every language cited for comparison (Perl's `my`, JS's
|
|
462
|
-
* function/`let` scoping, Python's function-scope-by-default) --
|
|
463
|
-
* without this flag, an if/while/for block's `set()` calls would ALSO
|
|
464
|
-
* stop at their own Environment, breaking ordinary control flow (e.g.
|
|
465
|
-
* `if (true) { x = 2; }` updating a `x` declared earlier in the SAME
|
|
466
|
-
* function must keep working).
|
|
467
|
-
*/
|
|
468
|
-
readonly isFunctionBoundary: boolean;
|
|
469
|
-
constructor(parent?: Environment, isFunctionBoundary?: boolean);
|
|
470
|
-
resolveBinding(name: string): {
|
|
471
|
-
env: Environment;
|
|
472
|
-
name: string;
|
|
473
|
-
} | undefined;
|
|
474
|
-
define(name: string, value: any): void;
|
|
475
|
-
get(name: string): any;
|
|
476
|
-
has(name: string): boolean;
|
|
477
|
-
set(name: string, value: any): void;
|
|
478
|
-
}
|
|
479
|
-
export declare class AsyncLock {
|
|
480
|
-
private holderTaskId?;
|
|
481
|
-
private depth;
|
|
482
|
-
private readonly waiters;
|
|
483
|
-
acquire(taskId?: number, timeoutMs?: number): Promise<void>;
|
|
484
|
-
release(): void;
|
|
485
|
-
withLock<T>(action: () => Promise<T>, taskId?: number, timeoutMs?: number): Promise<T>;
|
|
486
|
-
}
|
|
487
|
-
export declare class AsyncLockManager {
|
|
488
|
-
private readonly bindingLocks;
|
|
489
|
-
private readonly objectLocks;
|
|
490
|
-
getBindingLock(bindingKey: string): AsyncLock;
|
|
491
|
-
getObjectLock(target: object): AsyncLock;
|
|
492
|
-
}
|
|
493
|
-
export type HostFunction = (...args: any[]) => any;
|
|
494
|
-
export interface FunctionDoc {
|
|
495
|
-
name: string;
|
|
496
|
-
category: string;
|
|
497
|
-
module?: string;
|
|
498
|
-
signature: string;
|
|
499
|
-
description: string;
|
|
500
|
-
parameters?: Array<{
|
|
501
|
-
name: string;
|
|
502
|
-
type: string;
|
|
503
|
-
description: string;
|
|
504
|
-
}>;
|
|
505
|
-
returns?: {
|
|
506
|
-
type: string;
|
|
507
|
-
description: string;
|
|
508
|
-
};
|
|
509
|
-
example?: string;
|
|
510
|
-
}
|
|
511
|
-
export interface ScriptModule {
|
|
512
|
-
name: string;
|
|
513
|
-
description?: string;
|
|
514
|
-
docs?: FunctionDoc[];
|
|
515
|
-
register?: (engine: LMScript, context?: any) => void;
|
|
516
|
-
}
|
|
517
|
-
export interface HostFunctionMeta {
|
|
518
|
-
fn: HostFunction;
|
|
519
|
-
arity?: HostFunctionArity;
|
|
520
|
-
description?: string;
|
|
521
|
-
readsFile?: boolean;
|
|
522
|
-
isDefault?: boolean;
|
|
523
|
-
isContainerMutation?: boolean;
|
|
524
|
-
doc?: FunctionDoc;
|
|
525
|
-
}
|
|
526
|
-
export declare class Interpreter {
|
|
527
|
-
private globalEnv;
|
|
528
|
-
private readonly userFunctions;
|
|
529
|
-
private readonly hostFunctions;
|
|
530
|
-
private readonly stdout;
|
|
531
|
-
private readonly stderr?;
|
|
532
|
-
private readonly lockManager;
|
|
533
|
-
private readonly isAsync;
|
|
534
|
-
private nextTaskId;
|
|
535
|
-
private readonly initialGlobals?;
|
|
536
|
-
private callDepth;
|
|
537
|
-
private readonly asyncCallDepth;
|
|
538
|
-
private readonly recordedErrors;
|
|
539
|
-
constructor(hostFunctions: Map<string, HostFunctionMeta>, stdout?: (text: string) => void, isAsync?: boolean, initialGlobals?: Map<string, any>, stderr?: (text: string) => void);
|
|
540
|
-
evaluateProgram(program: Program): any;
|
|
541
|
-
private execStmt;
|
|
542
|
-
private evalExpr;
|
|
543
|
-
/** A call's callee name is normally used directly -- but if it names
|
|
544
|
-
* neither a declared user function nor a host function, it may be a
|
|
545
|
-
* variable holding a first-class FunctionRef (`g = dbl; g(4);`), in which
|
|
546
|
-
* case the actual function to invoke is the ref's name instead. */
|
|
547
|
-
private resolveCallTarget;
|
|
548
|
-
private invokeNamed;
|
|
549
|
-
private resolveIdentifier;
|
|
550
|
-
private isTruthy;
|
|
551
|
-
evaluateProgramAsync(program: Program): Promise<any>;
|
|
552
|
-
private execStmtAsync;
|
|
553
|
-
private evalExprAsync;
|
|
554
|
-
private invokeCallAsync;
|
|
555
|
-
getRecordedErrors(): string[];
|
|
556
|
-
}
|
|
557
|
-
export interface ExecutionResult {
|
|
558
|
-
success: boolean;
|
|
559
|
-
value?: any;
|
|
560
|
-
exitCode?: number;
|
|
561
|
-
diagnostics: Diagnostic[];
|
|
562
|
-
output: string[];
|
|
563
|
-
errors?: string[];
|
|
564
|
-
}
|
|
565
|
-
export declare const LANGUAGE_DOCS: FunctionDoc[];
|
|
566
|
-
export declare const BUILTIN_FUNCTION_DOCS: FunctionDoc[];
|
|
567
|
-
export declare const STDLIB_FUNCTION_DOCS: FunctionDoc[];
|
|
568
|
-
/**
|
|
569
|
-
* Real C/Perl/Python printf-style substitution for sprintf()/printf()
|
|
570
|
-
* (math.lmctl, 2026-09-29, defect B: sprintf/printf were aliased onto
|
|
571
|
-
* format(), which is Python str.format brace syntax -- `sprintf("%s=%s",
|
|
572
|
-
* a, b)` silently returned the literal template unsubstituted, because "%s"
|
|
573
|
-
* is not a brace placeholder. "%s is the ONLY reason anyone reaches for the
|
|
574
|
-
* name sprintf" -- so these two entry points get their OWN real % syntax,
|
|
575
|
-
* format() keeps braces. Deliberately minimal: %s/%d/%f/%%, no width/
|
|
576
|
-
* precision/padding modifiers -- add more only against a concrete need.
|
|
577
|
-
* Extra args with no corresponding %-directive are silently unused,
|
|
578
|
-
* matching real printf (not folded into a "no directives -> space-join"
|
|
579
|
-
* fallback, which would just be a second silently-wrong behavior).
|
|
580
|
-
*/
|
|
581
|
-
export declare function printfFormat(template: any, args: any[]): string;
|
|
582
|
-
export declare class LMScript {
|
|
583
|
-
private readonly hostFunctions;
|
|
584
|
-
private readonly functionDocs;
|
|
585
|
-
private readonly registeredModules;
|
|
586
|
-
private readonly functionOriginModule;
|
|
587
|
-
private currentRegisteringModule;
|
|
588
|
-
private outputLogs;
|
|
589
|
-
isAsyncMode: boolean;
|
|
590
|
-
constructor();
|
|
591
|
-
private registerDefaultDocs;
|
|
592
|
-
registerFunctionDoc(doc: FunctionDoc): this;
|
|
593
|
-
registerModule(module: ScriptModule, context?: any): this;
|
|
594
|
-
getModules(): ScriptModule[];
|
|
595
|
-
getModule(name: string): ScriptModule | undefined;
|
|
596
|
-
getFunctionsByModule(moduleName: string): FunctionDoc[];
|
|
597
|
-
getFunctionDocs(): FunctionDoc[];
|
|
598
|
-
getFunctionDoc(name: string): FunctionDoc | undefined;
|
|
599
|
-
getFunctionCategories(): string[];
|
|
600
|
-
getFunctionsByCategory(category: string): FunctionDoc[];
|
|
601
|
-
/**
|
|
602
|
-
* Requirement 4: Predefined functions implemented in TypeScript.
|
|
603
|
-
* Includes File I/O, Lists/Arrays, Hashes/Maps, JSON, Shell, and Strings.
|
|
604
|
-
*/
|
|
605
|
-
private registerPredefinedFunctions;
|
|
606
|
-
/**
|
|
607
|
-
* Requirement 5: Register new TypeScript functions into the runtime.
|
|
608
|
-
*/
|
|
609
|
-
registerFunction(name: string, fn: HostFunction, arity?: HostFunctionArity, descriptionOrOptions?: string | {
|
|
610
|
-
description?: string;
|
|
611
|
-
isDefault?: boolean;
|
|
612
|
-
isContainerMutation?: boolean;
|
|
613
|
-
doc?: FunctionDoc;
|
|
614
|
-
allowOverwrite?: boolean;
|
|
615
|
-
module?: string;
|
|
616
|
-
}, isDefault?: boolean, isContainerMutation?: boolean): this;
|
|
617
|
-
getFunctionOriginModule(name: string): string | undefined;
|
|
618
|
-
private readonly initialGlobals;
|
|
619
|
-
setGlobal(name: string, value: any): this;
|
|
620
|
-
getGlobal(name: string): any;
|
|
621
|
-
/**
|
|
622
|
-
* Requirement 2: Scan all and check before execution without generating intermediate files.
|
|
623
|
-
*/
|
|
624
|
-
scanAndCheck(source: string, options?: CompileOptions): {
|
|
625
|
-
ast: Program | null;
|
|
626
|
-
diagnostics: Diagnostic[];
|
|
627
|
-
hasConcurrency: boolean;
|
|
628
|
-
};
|
|
629
|
-
/**
|
|
630
|
-
* Complete execution pipeline:
|
|
631
|
-
* 1. Scans and parses source.
|
|
632
|
-
* 2. Runs static checker upfront.
|
|
633
|
-
* 3. If any static errors are found, aborts immediately WITHOUT executing.
|
|
634
|
-
* 4. If checks pass, executes AST in-memory.
|
|
635
|
-
*/
|
|
636
|
-
run(source: string, options?: CompileOptions): ExecutionResult;
|
|
637
|
-
/**
|
|
638
|
-
* Asynchronous execution pipeline supporting parallel tasks and sync statements.
|
|
639
|
-
*/
|
|
640
|
-
runAsync(source: string, options?: CompileOptions): Promise<ExecutionResult>;
|
|
641
|
-
private lastRecordedErrors;
|
|
642
|
-
getRecordedErrors(): string[];
|
|
643
|
-
hasFunction(name: string): boolean;
|
|
644
|
-
getRegisteredFunctions(): string[];
|
|
645
|
-
}
|
|
646
|
-
export declare function runDemoSuite(): Promise<boolean>;
|
|
647
|
-
export {};
|