@plurnk/plurnk-execs 0.2.0 → 0.4.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/SPEC.md CHANGED
@@ -49,7 +49,41 @@ interface ExecResult {
49
49
 
50
50
  The executor declares its channels; the consuming scheme seeds the exec entry from `executor.channels` rather than from a static scheme-level manifest (plurnk-service#174 Q1). This keeps channel names honest — `search` exposes `{ results: { mimetype: "application/json" } }`, and the model reads `exec://<coord>/EXEC#results` instead of an overloaded `#stdout`. `write` / `setState` are generic over channel name; writing to an undeclared channel is a contract violation.
51
51
 
52
- ### §2.2 Telemetry
52
+ ### §2.2 Availability probe
53
+
54
+ ```ts
55
+ interface RuntimeAvailability { available: boolean; detail?: string; }
56
+
57
+ abstract class BaseExecutor {
58
+ async probe(): Promise<RuntimeAvailability> { return { available: true }; } // default: available
59
+ }
60
+ ```
61
+
62
+ `probe()` reports whether the runtime's *environment* is usable here — distinct from whether the *package* is installed (`discover()`). Pure / in-process runtimes (node, sqlite) inherit the available default; runtimes depending on an external binary (`python` → `python3 --version`) or config (`search` → `SEARXNG_URL`) override. `SubprocessExecutor` probes its `binary` getter (`null` = always available).
63
+
64
+ Consumer contract (plurnk-service#181): probe **once at boot, per package** (not per tag — stamp all of a package's tags with the one result), **concurrently under a per-probe timeout**, and **cache**. `probe()` MAY reject; the consumer treats rejection as `{ available: false, detail: <error> }`, so a buggy probe degrades only its runtime. The model is offered a positive list of available runtimes; an attempt at an unavailable one returns **501 carrying `detail`** (so `detail` is model-facing — terse and actionable). A configured default runtime that probes unavailable is a **fail-hard boot error**.
65
+
66
+ ### §2.3 Effect (proposal gating)
67
+
68
+ ```ts
69
+ type Effect = "pure" | "read" | "host";
70
+
71
+ abstract class BaseExecutor {
72
+ effect(target: string | null): Effect { return "host"; } // default: conservative
73
+ }
74
+ ```
75
+
76
+ `effect()` classifies an invocation's side effect so the consumer can gate the proposal lifecycle per runtime (service#182). The executor declares the **fact**; the consumer owns the **policy** (an `effect → propose/auto` map, deployment-tunable: default `host → propose`, `read`/`pure → auto`).
77
+
78
+ - **`host`** — runs code / mutates the host (subprocess; file-backed sqlite) → propose.
79
+ - **`read`** — observes external state, no host mutation (search) → auto.
80
+ - **`pure`** — no observable side effect (sqlite `:memory:`, transforms) → auto.
81
+
82
+ `effect()` MUST be **pure, synchronous, and cheap** — it runs on the dispatch hot path at propose time. It classifies the **target only** (known pre-`run()`); it MUST NOT inspect the command (parsing SQL/shell to judge intent is a sandbox-escape footgun) and MUST NOT do I/O. Default `host` is conservative — anything unclassifiable is proposed (fail-safe, the mirror of `probe()`'s fail-open default).
83
+
84
+ For `exec`, per-runtime `effect()` supersedes the static `Exec.manifest.flags.proposes`. Auto-run (`read`/`pure`) runtimes may run **inline** — synchronous return rather than entry-then-read-next-turn — while still landing the result as a re-readable entry.
85
+
86
+ ### §2.4 Telemetry
53
87
 
54
88
  Runtime failures are emitted as a grammar `TelemetryEvent` via the `emit` sink (plurnk-service#174 Q3); the scheme routes it to the engine's telemetry buffer — the same path grammar's `parse_error` takes. Events are not encoded into `stderr` (that pollutes program output) nor returned on `ExecResult` (that loses mid-run events).
55
89
 
@@ -1,9 +1,11 @@
1
- import type { ChannelDecl, ExecArgs, ExecResult, ExecutorMetadata } from "./types.ts";
1
+ import type { ChannelDecl, Effect, ExecArgs, ExecResult, ExecutorMetadata, RuntimeAvailability } from "./types.ts";
2
2
  export default abstract class BaseExecutor {
3
3
  readonly runtime: string;
4
4
  readonly glyph: string;
5
5
  constructor({ runtime, glyph }: ExecutorMetadata);
6
6
  abstract get channels(): Readonly<Record<string, ChannelDecl>>;
7
7
  abstract run(args: ExecArgs): Promise<ExecResult>;
8
+ probe(): Promise<RuntimeAvailability>;
9
+ effect(_target: string | null): Effect;
8
10
  }
9
11
  //# sourceMappingURL=BaseExecutor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseExecutor.d.ts","sourceRoot":"","sources":["../src/BaseExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAWtF,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,gBAAgB;IAUhD,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAO/D,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CACpD"}
1
+ {"version":3,"file":"BaseExecutor.d.ts","sourceRoot":"","sources":["../src/BaseExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAWnH,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,YAAY;IACtC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBAEX,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,gBAAgB;IAUhD,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC;IAO/D,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;IAY3C,KAAK,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAW3C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;CAGzC"}
@@ -14,5 +14,28 @@ export default class BaseExecutor {
14
14
  this.runtime = runtime;
15
15
  this.glyph = glyph;
16
16
  }
17
+ // Whether this runtime's execution environment is usable in the current
18
+ // deployment. Default: available (pure / in-process runtimes — e.g. node,
19
+ // sqlite, where the daemon itself satisfies the dependency). Subclasses
20
+ // that depend on an external binary or external config override.
21
+ //
22
+ // The consumer probes once at boot, per package, runs probes concurrently
23
+ // under a per-probe timeout, and caches the result. Unlike `run()`, this
24
+ // MAY reject — the consumer treats a rejection as `{ available: false }` —
25
+ // but returning a crafted `{ available: false, detail }` for an expected
26
+ // miss gives a better model-facing reason than a raw error.
27
+ async probe() {
28
+ return { available: true };
29
+ }
30
+ // Side-effect class of an invocation against `target` (the parsed EXEC
31
+ // target — what run() receives as cwd), for the consumer's proposal-gating
32
+ // policy (service#182). MUST be pure, synchronous, and cheap — it runs on
33
+ // the dispatch hot path at propose time: classify the target only, NEVER
34
+ // the command (parsing SQL/shell to judge intent is a sandbox-escape
35
+ // footgun). Default `host` is the conservative, fail-safe end — anything we
36
+ // can't classify is treated as host code-execution and proposed.
37
+ effect(_target) {
38
+ return "host";
39
+ }
17
40
  }
18
41
  //# sourceMappingURL=BaseExecutor.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"BaseExecutor.js","sourceRoot":"","sources":["../src/BaseExecutor.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,mDAAmD;AACnD,MAAM,CAAC,OAAO,OAAgB,YAAY;IAC7B,OAAO,CAAS;IAChB,KAAK,CAAS;IAEvB,YAAY,EAAE,OAAO,EAAE,KAAK,EAAoB;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;CAeJ"}
1
+ {"version":3,"file":"BaseExecutor.js","sourceRoot":"","sources":["../src/BaseExecutor.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,6EAA6E;AAC7E,6EAA6E;AAC7E,yEAAyE;AACzE,EAAE;AACF,2EAA2E;AAC3E,6EAA6E;AAC7E,2EAA2E;AAC3E,mDAAmD;AACnD,MAAM,CAAC,OAAO,OAAgB,YAAY;IAC7B,OAAO,CAAS;IAChB,KAAK,CAAS;IAEvB,YAAY,EAAE,OAAO,EAAE,KAAK,EAAoB;QAC5C,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;QACvB,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACvB,CAAC;IAgBD,wEAAwE;IACxE,0EAA0E;IAC1E,wEAAwE;IACxE,iEAAiE;IACjE,EAAE;IACF,0EAA0E;IAC1E,yEAAyE;IACzE,2EAA2E;IAC3E,yEAAyE;IACzE,4DAA4D;IAC5D,KAAK,CAAC,KAAK;QACP,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC;IAC/B,CAAC;IAED,uEAAuE;IACvE,2EAA2E;IAC3E,0EAA0E;IAC1E,yEAAyE;IACzE,qEAAqE;IACrE,4EAA4E;IAC5E,iEAAiE;IACjE,MAAM,CAAC,OAAsB;QACzB,OAAO,MAAM,CAAC;IAClB,CAAC;CACJ"}
@@ -1,7 +1,10 @@
1
1
  import BaseExecutor from "./BaseExecutor.ts";
2
- import type { ChannelDecl, ExecArgs, ExecResult } from "./types.ts";
2
+ import type { ChannelDecl, Effect, ExecArgs, ExecResult, RuntimeAvailability } from "./types.ts";
3
3
  export default class SubprocessExecutor extends BaseExecutor {
4
4
  get channels(): Readonly<Record<string, ChannelDecl>>;
5
+ protected get binary(): string | null;
6
+ effect(_target: string | null): Effect;
7
+ probe(): Promise<RuntimeAvailability>;
5
8
  run({ runtime, command, cwd, signal, write, setState, emit }: ExecArgs): Promise<ExecResult>;
6
9
  }
7
10
  //# sourceMappingURL=SubprocessExecutor.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"SubprocessExecutor.d.ts","sourceRoot":"","sources":["../src/SubprocessExecutor.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAWpE,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,YAAY;IACxD,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAKpD;IAED,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAwC/F"}
1
+ {"version":3,"file":"SubprocessExecutor.d.ts","sourceRoot":"","sources":["../src/SubprocessExecutor.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAE7C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAgBjG,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,YAAY;IACxD,IAAI,QAAQ,IAAI,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,CAAC,CAKpD;IAKD,SAAS,KAAK,MAAM,IAAI,MAAM,GAAG,IAAI,CAEpC;IAGQ,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM;IAIhC,KAAK,IAAI,OAAO,CAAC,mBAAmB,CAAC;IAqBpD,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,EAAE,QAAQ,GAAG,OAAO,CAAC,UAAU,CAAC;CAgE/F"}
@@ -1,6 +1,10 @@
1
1
  import { spawn } from "node:child_process";
2
2
  import BaseExecutor from "./BaseExecutor.js";
3
3
  import { resolveRuntime } from "./runtime.js";
4
+ // Grace period between SIGTERM and SIGKILL when tearing down an aborted process
5
+ // group — long enough for a well-behaved process to clean up, bounded so a
6
+ // process ignoring SIGTERM can't wedge cancellation.
7
+ const ABORT_GRACE_MS = 2000;
4
8
  // Concrete BaseExecutor for subprocess runtimes (sh, node, python, …). Spawns
5
9
  // via resolveRuntime, streams the process's stdout/stderr into the declared
6
10
  // channels, honors cancellation, and reports the exit code. The sibling
@@ -17,36 +21,96 @@ export default class SubprocessExecutor extends BaseExecutor {
17
21
  stderr: { mimetype: "text/stream" },
18
22
  };
19
23
  }
24
+ // The executable this runtime depends on, for probe(). `null` = nothing to
25
+ // check (always available — e.g. node, where the daemon already IS the
26
+ // runtime). Subclasses naming an external interpreter override this.
27
+ get binary() {
28
+ return null;
29
+ }
30
+ // Subprocess runtimes execute code on the host — always `host`.
31
+ effect(_target) {
32
+ return "host";
33
+ }
34
+ async probe() {
35
+ const bin = this.binary;
36
+ if (bin === null)
37
+ return { available: true };
38
+ return new Promise((resolve) => {
39
+ let settled = false;
40
+ const done = (r) => { if (!settled) {
41
+ settled = true;
42
+ resolve(r);
43
+ } };
44
+ let out = "";
45
+ const child = spawn(bin, ["--version"], { signal: AbortSignal.timeout(3000) });
46
+ child.stdout?.on("data", (chunk) => { out += chunk.toString("utf8"); });
47
+ child.on("error", (err) => done({
48
+ available: false,
49
+ detail: err.code === "ABORT_ERR"
50
+ ? `${bin} probe timed out`
51
+ : `${bin} not found on PATH`,
52
+ }));
53
+ child.on("close", (code) => done(code === 0
54
+ ? { available: true, detail: out.trim().split("\n")[0] || undefined }
55
+ : { available: false, detail: `${bin} --version exited ${code}` }));
56
+ });
57
+ }
20
58
  run({ runtime, command, cwd, signal, write, setState, emit }) {
21
59
  const { cmd, args, useShell } = resolveRuntime(runtime, command);
22
60
  return new Promise((resolve) => {
23
- // Abort and close both fire on signal-kill; settle exactly once so
24
- // channel state isn't transitioned twice.
61
+ // Already cancelled before we start don't launch a doomed process.
62
+ if (signal.aborted) {
63
+ setState("stdout", "errored");
64
+ setState("stderr", "errored");
65
+ resolve({ status: 499, exitCode: -1 });
66
+ return;
67
+ }
25
68
  let settled = false;
69
+ let killTimer;
70
+ // `detached` makes the child its own process-group leader, so abort
71
+ // can signal the WHOLE group (`-pid`) — reaching shell grandchildren
72
+ // (e.g. the `sleep` in `sh -c "sleep 30"`) that a bare SIGTERM to the
73
+ // direct child orphans, leaking the process and its stdout pipe. We
74
+ // drive cancellation manually rather than via spawn's `signal`
75
+ // option, which only kills the direct child (plurnk-execs#4).
76
+ const child = spawn(cmd, args, { shell: useShell, cwd: cwd ?? undefined, detached: true });
77
+ const killGroup = (sig) => {
78
+ if (child.pid === undefined)
79
+ return;
80
+ try {
81
+ process.kill(-child.pid, sig);
82
+ }
83
+ catch { /* group already gone */ }
84
+ };
85
+ const onAbort = () => {
86
+ killGroup("SIGTERM");
87
+ // Escalate if the group ignores SIGTERM. `close` fires once the
88
+ // pipes drain, which now happens because the grandchildren die.
89
+ killTimer = setTimeout(() => killGroup("SIGKILL"), ABORT_GRACE_MS);
90
+ };
26
91
  const finish = (result, state) => {
27
92
  if (settled)
28
93
  return;
29
94
  settled = true;
95
+ if (killTimer)
96
+ clearTimeout(killTimer);
97
+ signal.removeEventListener("abort", onAbort);
30
98
  setState("stdout", state);
31
99
  setState("stderr", state);
32
100
  resolve(result);
33
101
  };
34
- const child = spawn(cmd, args, { shell: useShell, signal, cwd: cwd ?? undefined });
102
+ signal.addEventListener("abort", onAbort, { once: true });
35
103
  child.stdout?.on("data", (chunk) => write("stdout", chunk.toString("utf8")));
36
104
  child.stderr?.on("data", (chunk) => write("stderr", chunk.toString("utf8")));
37
105
  child.on("error", (err) => {
38
- if (err.code === "ABORT_ERR") {
39
- finish({ status: 499, exitCode: -1 }, "errored");
40
- return;
41
- }
42
106
  // The process could not be started — a framework-level failure
43
107
  // the model benefits from seeing as telemetry (a nonzero exit,
44
108
  // by contrast, is the program's own result and lives on stderr).
45
109
  emit({ source: `exec:${runtime}`, kind: "spawn_failed", message: err.message });
46
110
  finish({ status: 500, exitCode: -1 }, "errored");
47
111
  });
48
- child.on("close", (code, killedBySignal) => {
49
- if (killedBySignal !== null) {
112
+ child.on("close", (code) => {
113
+ if (signal.aborted) {
50
114
  finish({ status: 499, exitCode: code ?? -1 }, "errored");
51
115
  return;
52
116
  }
@@ -1 +1 @@
1
- {"version":3,"file":"SubprocessExecutor.js","sourceRoot":"","sources":["../src/SubprocessExecutor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,YAAY,MAAM,mBAAmB,CAAC;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9C,8EAA8E;AAC9E,4EAA4E;AAC5E,wEAAwE;AACxE,6EAA6E;AAC7E,0EAA0E;AAC1E,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,2BAA2B;AAC3B,MAAM,CAAC,OAAO,OAAO,kBAAmB,SAAQ,YAAY;IACxD,IAAI,QAAQ;QACR,OAAO;YACH,MAAM,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;YACnC,MAAM,EAAE,EAAE,QAAQ,EAAE,aAAa,EAAE;SACtC,CAAC;IACN,CAAC;IAED,GAAG,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAY;QAClE,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,QAAQ,EAAE,GAAG,cAAc,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACjE,OAAO,IAAI,OAAO,CAAa,CAAC,OAAO,EAAE,EAAE;YACvC,mEAAmE;YACnE,0CAA0C;YAC1C,IAAI,OAAO,GAAG,KAAK,CAAC;YACpB,MAAM,MAAM,GAAG,CAAC,MAAkB,EAAE,KAA2B,EAAQ,EAAE;gBACrE,IAAI,OAAO;oBAAE,OAAO;gBACpB,OAAO,GAAG,IAAI,CAAC;gBACf,QAAQ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AE,CAAC,KAAK,CAAC,QAAQ,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC;YAErF,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;gBACtB,+DAA+D;gBAC/D,+DAA+D;gBAC/D,iEAAiE;gBACjE,IAAI,CAAC,EAAE,MAAM,EAAE,QAAQ,OAAO,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAChF,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;YACrD,CAAC,CAAC,CAAC;YAEH,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,IAAI,EAAE,EAAE;gBACvB,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;oBACjB,MAAM,CAAC,EAAE,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,SAAS,CAAC,CAAC;oBACzD,OAAO;gBACX,CAAC;gBACD,MAAM,EAAE,GAAG,IAAI,KAAK,CAAC,CAAC;gBACtB,MAAM,CAAC,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC;YACxF,CAAC,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC;CACJ"}
package/dist/index.d.ts CHANGED
@@ -2,6 +2,6 @@ export { default as BaseExecutor } from "./BaseExecutor.ts";
2
2
  export { default as SubprocessExecutor } from "./SubprocessExecutor.ts";
3
3
  export { discover } from "./discover.ts";
4
4
  export { KNOWN_RUNTIMES, isKnownRuntime, resolveRuntime } from "./runtime.ts";
5
- export type { ChannelState, ChannelDecl, ExecutorMetadata, ExecArgs, ExecResult, ExecInfo, ExecRegistry, Discovery, DiscoverOptions, SpawnArgs, RuntimeResolver, } from "./types.ts";
5
+ export type { ChannelState, ChannelDecl, ExecutorMetadata, ExecArgs, ExecResult, Effect, RuntimeAvailability, ExecInfo, ExecRegistry, Discovery, DiscoverOptions, SpawnArgs, RuntimeResolver, } from "./types.ts";
6
6
  export type { TelemetryEvent, ContentOffset, LogCoordinate } from "./TelemetryEvent.ts";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9E,YAAY,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,eAAe,GAClB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAGzC,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAG9E,YAAY,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,EACT,eAAe,GAClB,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC"}
package/dist/types.d.ts CHANGED
@@ -21,6 +21,11 @@ export interface ExecResult {
21
21
  status: number;
22
22
  exitCode?: number;
23
23
  }
24
+ export type Effect = "pure" | "read" | "host";
25
+ export interface RuntimeAvailability {
26
+ available: boolean;
27
+ detail?: string;
28
+ }
24
29
  export interface ExecInfo {
25
30
  runtime: string;
26
31
  glyph: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAI1D,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAM3D,MAAM,WAAW,WAAW;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC/B;AAKD,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACjB;AAOD,MAAM,WAAW,QAAQ;IAGrB,OAAO,EAAE,MAAM,CAAC;IAEhB,OAAO,EAAE,MAAM,CAAC;IAGhB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAEnB,MAAM,EAAE,WAAW,CAAC;IAEpB,KAAK,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEhD,QAAQ,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,YAAY,KAAK,IAAI,CA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AAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plurnk/plurnk-execs",
3
- "version": "0.2.0",
3
+ "version": "0.4.0",
4
4
  "description": "Framework + contract for the @plurnk/plurnk-execs-* runtime executor family.",
5
5
  "keywords": ["plurnk", "exec", "runtime", "executor"],
6
6
  "homepage": "https://github.com/plurnk/plurnk-execs#readme",