@plurnk/plurnk-execs 0.1.0 → 0.2.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/README.md +6 -4
- package/SPEC.md +81 -36
- package/dist/BaseExecutor.d.ts +9 -0
- package/dist/BaseExecutor.d.ts.map +1 -0
- package/dist/BaseExecutor.js +18 -0
- package/dist/BaseExecutor.js.map +1 -0
- package/dist/SubprocessExecutor.d.ts +7 -0
- package/dist/SubprocessExecutor.d.ts.map +1 -0
- package/dist/SubprocessExecutor.js +59 -0
- package/dist/SubprocessExecutor.js.map +1 -0
- package/dist/TelemetryEvent.d.ts +18 -0
- package/dist/TelemetryEvent.d.ts.map +1 -0
- package/dist/TelemetryEvent.js +2 -0
- package/dist/TelemetryEvent.js.map +1 -0
- package/dist/discover.d.ts +3 -0
- package/dist/discover.d.ts.map +1 -0
- package/dist/discover.js +92 -0
- package/dist/discover.js.map +1 -0
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +36 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +8 -5
- package/dist/types.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -9,10 +9,12 @@ Framework + contract for `@plurnk/plurnk-execs-*` runtime executor packages. Con
|
|
|
9
9
|
|
|
10
10
|
## Exports
|
|
11
11
|
|
|
12
|
-
- `
|
|
13
|
-
- `
|
|
14
|
-
- `
|
|
15
|
-
- `
|
|
12
|
+
- `BaseExecutor` — abstract base a `@plurnk/plurnk-execs-*` sibling subclasses: declares its output channels and implements `run(args) → ExecResult`.
|
|
13
|
+
- `SubprocessExecutor` — concrete `BaseExecutor` for subprocess runtimes (sh/node/python): spawns via `resolveRuntime`, streams stdout/stderr, honors cancellation, reports exit code. Siblings subclass it.
|
|
14
|
+
- `discover(options?)` — scans `node_modules/@plurnk/` for `plurnk.kind === "exec"` packages and builds the runtime-tag registry (fail-hard on tag collision).
|
|
15
|
+
- `ExecArgs`, `ExecResult`, `ChannelDecl`, `ChannelState`, `ExecutorMetadata`, `ExecInfo`, `ExecRegistry`, `Discovery`, `DiscoverOptions` — contract types.
|
|
16
|
+
- `TelemetryEvent`, `ContentOffset`, `LogCoordinate` — local mirror of grammar's telemetry envelope (the `emit` sink's payload).
|
|
17
|
+
- `resolveRuntime(runtime, command)`, `isKnownRuntime(runtime)`, `KNOWN_RUNTIMES`, `SpawnArgs`, `RuntimeResolver` — subprocess-family helper for the consumer's legacy spawn path (§4).
|
|
16
18
|
|
|
17
19
|
## Tests
|
|
18
20
|
|
package/SPEC.md
CHANGED
|
@@ -1,77 +1,122 @@
|
|
|
1
1
|
# plurnk-execs — Specification
|
|
2
2
|
|
|
3
|
-
Contract for `@plurnk/plurnk-execs-*` sibling packages — runtime executors that plurnk-service's `exec://` scheme dispatches to. Audience: implementer of a runtime executor. Consumer: [plurnk-service](https://github.com/plurnk/plurnk-service) (SPEC.md §6.8, §10).
|
|
3
|
+
Contract for `@plurnk/plurnk-execs-*` sibling packages — runtime executors that plurnk-service's `exec://` scheme dispatches to. Audience: implementer of a runtime executor. Consumer: [plurnk-service](https://github.com/plurnk/plurnk-service) (SPEC.md §6.8, §10). Contract shape settled in plurnk-service#174.
|
|
4
4
|
|
|
5
5
|
## §1 Role
|
|
6
6
|
|
|
7
|
-
A runtime executor handles one or more EXEC `runtime` slot values
|
|
7
|
+
A runtime executor handles one or more EXEC `runtime` slot values (`sh`, `node`, `python`, `search`, `news`, …). It is a `BaseExecutor` subclass that declares its output channels and implements `run()`; the framework discovers it from its `package.json` `plurnk` block. The consuming scheme owns all I/O and lifecycle machinery (db, channels, subscriptions, AbortController bridging, wake-on-completion) and hands the executor sinks — the executor stays stateless across runs beyond its construction metadata.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
The framework ships `SubprocessExecutor` (§4), the concrete `BaseExecutor` for subprocess runtimes (sh/node/python). plurnk-service's exec scheme still consumes the lower-level `resolveRuntime` / `SpawnArgs` helper on its legacy `streamShellCommand` path; its migration onto `SubprocessExecutor` is phased and on service's own timeline (plurnk-service#174 Q2). Both paths coexist until that cutover.
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
## §2 Executor contract
|
|
12
12
|
|
|
13
13
|
```ts
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
abstract class BaseExecutor {
|
|
15
|
+
readonly runtime: string; // matched tag — "sh" / "search" / "news" / …
|
|
16
|
+
readonly glyph: string;
|
|
17
|
+
constructor(metadata: { runtime: string; glyph: string });
|
|
18
|
+
|
|
19
|
+
// Channels this executor writes to; the scheme seeds the exec entry from
|
|
20
|
+
// these (§2.1). Subprocess runtimes declare { stdout, stderr }; search
|
|
21
|
+
// declares { results }.
|
|
22
|
+
abstract get channels(): Readonly<Record<string, ChannelDecl>>;
|
|
23
|
+
|
|
24
|
+
abstract run(args: ExecArgs): Promise<ExecResult>;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
interface ChannelDecl { mimetype: string; defaultState?: ChannelState; }
|
|
28
|
+
type ChannelState = "active" | "closed" | "errored";
|
|
29
|
+
|
|
30
|
+
interface ExecArgs {
|
|
31
|
+
runtime: string; // matched tag; multi-tag executors branch on it
|
|
32
|
+
command: string; // EXEC body: shell line / source / search query
|
|
33
|
+
cwd: string | null; // subprocess working dir; null/ignored for logical runtimes
|
|
34
|
+
signal: AbortSignal; // cancellation — executors must honor it
|
|
35
|
+
write: (channel: string, chunk: string) => void; // write a chunk to a declared channel
|
|
36
|
+
setState: (channel: string, state: ChannelState) => void; // drive a declared channel's lifecycle
|
|
37
|
+
emit: (event: TelemetryEvent) => void; // emit telemetry/error (§2.2)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
interface ExecResult {
|
|
41
|
+
status: number; // 200 ok / 499 aborted / 500 error
|
|
42
|
+
exitCode?: number; // subprocess family only
|
|
18
43
|
}
|
|
19
44
|
```
|
|
20
45
|
|
|
21
|
-
|
|
46
|
+
`run()` must not throw for an expected runtime failure: surface it through `emit` + an `errored` channel state + a non-200 `status`.
|
|
22
47
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
| any other | `{ cmd: runtime, args: ["-c", command], useShell: false }` (conservative fallback) |
|
|
48
|
+
### §2.1 Channel topology is executor-declared
|
|
49
|
+
|
|
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
|
+
|
|
52
|
+
### §2.2 Telemetry
|
|
29
53
|
|
|
30
|
-
`
|
|
54
|
+
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).
|
|
31
55
|
|
|
32
|
-
`
|
|
56
|
+
- `source`: `"exec:<runtime>"` (e.g. `"exec:search"`) or `"scheme:exec"`.
|
|
57
|
+
- `kind`: producer-minted — `runtime_not_configured`, `spawn_failed`, `exited_nonzero`, `aborted`, and runtime-specific kinds (search: `searxng_unreachable`, `searxng_http_<n>`).
|
|
58
|
+
- `message`: terse, factual. `position`: typically null at the runtime layer.
|
|
33
59
|
|
|
34
|
-
|
|
60
|
+
The envelope is mirrored locally (`TelemetryEvent`, `ContentOffset`, `LogCoordinate`) so the framework needs no `@plurnk/plurnk-grammar` dependency; grammar's `dist/schema/TelemetryEvent.json` is the source of truth.
|
|
35
61
|
|
|
36
|
-
|
|
62
|
+
## §3 Discovery
|
|
63
|
+
|
|
64
|
+
`discover(options?) → { registry }`. Scans `<cwd>/node_modules/@plurnk/` (or explicit `packageDirs`) for packages declaring `plurnk.kind === "exec"`, and registers each runtime tag from `plurnk.runtimes[]`:
|
|
37
65
|
|
|
38
66
|
```json
|
|
39
67
|
{
|
|
40
|
-
"name": "@plurnk/plurnk-execs
|
|
68
|
+
"name": "@plurnk/plurnk-execs-search",
|
|
41
69
|
"plurnk": {
|
|
42
70
|
"kind": "exec",
|
|
43
71
|
"runtimes": [
|
|
44
|
-
{ "name": "
|
|
45
|
-
{ "name": "
|
|
72
|
+
{ "name": "search", "glyph": "🔎" },
|
|
73
|
+
{ "name": "news", "glyph": "📰" }
|
|
46
74
|
]
|
|
47
75
|
}
|
|
48
76
|
}
|
|
49
77
|
```
|
|
50
78
|
|
|
51
|
-
|
|
79
|
+
A package may claim multiple tags backed by one handler. Tags form a **flat global namespace**; `registry` maps tag → `{ runtime, glyph, packageName }`. Unlike plurnk-mimetypes (last-loaded wins), a tag **collision is fail-hard**: two packages claiming the same runtime is an unresolvable install ambiguity the operator must fix.
|
|
80
|
+
|
|
81
|
+
Each runtime exports its `BaseExecutor` subclass; the consumer instantiates it per matched tag with the tag + glyph from the registry. (Module-export convention for the subclass settles as the first siblings ship.)
|
|
82
|
+
|
|
83
|
+
## §4 Subprocess helper (legacy path)
|
|
84
|
+
|
|
85
|
+
`resolveRuntime(runtime, command) → SpawnArgs` and `isKnownRuntime(runtime)` / `KNOWN_RUNTIMES` translate a subprocess runtime tag into `node:child_process.spawn` arguments:
|
|
86
|
+
|
|
87
|
+
```ts
|
|
88
|
+
interface SpawnArgs { cmd: string; args: string[]; useShell: boolean; }
|
|
89
|
+
```
|
|
52
90
|
|
|
53
|
-
|
|
91
|
+
| Runtime | Spawn |
|
|
92
|
+
|---|---|
|
|
93
|
+
| `""` / `"sh"` / `"bash"` | `{ cmd: command, args: [], useShell: true }` |
|
|
94
|
+
| `"node"` | `{ cmd: "node", args: ["-e", command], useShell: false }` |
|
|
95
|
+
| `"python"` / `"python3"` | `{ cmd: "python3", args: ["-c", command], useShell: false }` |
|
|
96
|
+
| any other | `{ cmd: runtime, args: ["-c", command], useShell: false }` (conservative fallback) |
|
|
54
97
|
|
|
55
|
-
|
|
98
|
+
`resolveRuntime` never throws; consumers gate unknown runtimes with `isKnownRuntime` and return 501 before invoking.
|
|
56
99
|
|
|
57
|
-
|
|
100
|
+
The framework wraps this in **`SubprocessExecutor extends BaseExecutor`** — declares `{ stdout, stderr }` channels and implements `run()` (spawn via `resolveRuntime`, stream into the channels, honor `signal`, `emit` `spawn_failed` on a failed start, return `{ status, exitCode }`). The `plurnk-execs-sh` / `-node` / `-python` siblings subclass it and differ only in their claimed `runtimes[]` tags. plurnk-service consumes `resolveRuntime` directly on its legacy path today and adopts `SubprocessExecutor` when it migrates.
|
|
58
101
|
|
|
59
|
-
|
|
102
|
+
## §5 Consumer surface (plurnk-service)
|
|
60
103
|
|
|
61
|
-
|
|
62
|
-
2. Calls `resolveRuntime(runtime, command)` to get `SpawnArgs`.
|
|
63
|
-
3. Passes args to `node:child_process.spawn` and manages the subprocess lifecycle (channels, AbortController, subscription registry, wake-on-completion).
|
|
104
|
+
Per plurnk-service#174, the exec scheme:
|
|
64
105
|
|
|
65
|
-
|
|
106
|
+
1. Resolves the runtime tag against the discovery registry; routes `search` (and future siblings) through the executor's `run()`.
|
|
107
|
+
2. Seeds the exec entry's channels from `executor.channels`.
|
|
108
|
+
3. Provides the `write` / `setState` / `emit` sinks bound to its channel-write, channel-state, and engine-telemetry machinery; bridges its AbortController to `args.signal`; maps the `ExecResult` to close-status + wake summary.
|
|
109
|
+
4. Keeps the legacy `streamShellCommand` path (via `resolveRuntime`) for subprocess runtimes until the `SubprocessExecutor` migration.
|
|
66
110
|
|
|
67
|
-
## §
|
|
111
|
+
## §6 Forbidden (for siblings)
|
|
68
112
|
|
|
69
113
|
| ❌ |
|
|
70
114
|
|---|
|
|
71
115
|
| Database access |
|
|
72
116
|
| Imports from `@plurnk/plurnk-service/*` |
|
|
73
|
-
| Mutating
|
|
74
|
-
| Holding state across `run` calls beyond
|
|
117
|
+
| Mutating `ExecArgs` |
|
|
118
|
+
| Holding state across `run` calls beyond construction metadata |
|
|
75
119
|
| Reading runtime output via `console.*` |
|
|
76
|
-
| Ignoring
|
|
77
|
-
|
|
|
120
|
+
| Ignoring `args.signal` |
|
|
121
|
+
| Writing to an undeclared channel |
|
|
122
|
+
| Spawning processes outside the runtime's domain (e.g. an HTTP/search runtime spawning subprocesses) |
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ChannelDecl, ExecArgs, ExecResult, ExecutorMetadata } from "./types.ts";
|
|
2
|
+
export default abstract class BaseExecutor {
|
|
3
|
+
readonly runtime: string;
|
|
4
|
+
readonly glyph: string;
|
|
5
|
+
constructor({ runtime, glyph }: ExecutorMetadata);
|
|
6
|
+
abstract get channels(): Readonly<Record<string, ChannelDecl>>;
|
|
7
|
+
abstract run(args: ExecArgs): Promise<ExecResult>;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=BaseExecutor.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// Base class for runtime executors (parallel to plurnk-mimetypes' BaseHandler).
|
|
2
|
+
// A `@plurnk/plurnk-execs-*` sibling subclasses this and implements `run()`.
|
|
3
|
+
// The framework instantiates one executor per matched runtime tag, injecting
|
|
4
|
+
// the tag + glyph from the package's `plurnk.runtimes[]` manifest entry.
|
|
5
|
+
//
|
|
6
|
+
// The consuming scheme owns all I/O and lifecycle machinery (db, channels,
|
|
7
|
+
// subscriptions, AbortController bridging, wake-on-completion). The executor
|
|
8
|
+
// receives sinks via ExecArgs and nothing more — it stays stateless across
|
|
9
|
+
// runs beyond its construction metadata (SPEC §5).
|
|
10
|
+
export default class BaseExecutor {
|
|
11
|
+
runtime;
|
|
12
|
+
glyph;
|
|
13
|
+
constructor({ runtime, glyph }) {
|
|
14
|
+
this.runtime = runtime;
|
|
15
|
+
this.glyph = glyph;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=BaseExecutor.js.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import BaseExecutor from "./BaseExecutor.ts";
|
|
2
|
+
import type { ChannelDecl, ExecArgs, ExecResult } from "./types.ts";
|
|
3
|
+
export default class SubprocessExecutor extends BaseExecutor {
|
|
4
|
+
get channels(): Readonly<Record<string, ChannelDecl>>;
|
|
5
|
+
run({ runtime, command, cwd, signal, write, setState, emit }: ExecArgs): Promise<ExecResult>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=SubprocessExecutor.d.ts.map
|
|
@@ -0,0 +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"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import BaseExecutor from "./BaseExecutor.js";
|
|
3
|
+
import { resolveRuntime } from "./runtime.js";
|
|
4
|
+
// Concrete BaseExecutor for subprocess runtimes (sh, node, python, …). Spawns
|
|
5
|
+
// via resolveRuntime, streams the process's stdout/stderr into the declared
|
|
6
|
+
// channels, honors cancellation, and reports the exit code. The sibling
|
|
7
|
+
// packages (plurnk-execs-sh / -node / -python) subclass this and differ only
|
|
8
|
+
// in which runtime tags they claim in their `plurnk.runtimes[]` manifest.
|
|
9
|
+
//
|
|
10
|
+
// This is the destination of plurnk-service's legacy `streamShellCommand`
|
|
11
|
+
// (service#174 Q2): the scheme migrates onto it on its own timeline; until
|
|
12
|
+
// then both paths coexist.
|
|
13
|
+
export default class SubprocessExecutor extends BaseExecutor {
|
|
14
|
+
get channels() {
|
|
15
|
+
return {
|
|
16
|
+
stdout: { mimetype: "text/stream" },
|
|
17
|
+
stderr: { mimetype: "text/stream" },
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
run({ runtime, command, cwd, signal, write, setState, emit }) {
|
|
21
|
+
const { cmd, args, useShell } = resolveRuntime(runtime, command);
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
// Abort and close both fire on signal-kill; settle exactly once so
|
|
24
|
+
// channel state isn't transitioned twice.
|
|
25
|
+
let settled = false;
|
|
26
|
+
const finish = (result, state) => {
|
|
27
|
+
if (settled)
|
|
28
|
+
return;
|
|
29
|
+
settled = true;
|
|
30
|
+
setState("stdout", state);
|
|
31
|
+
setState("stderr", state);
|
|
32
|
+
resolve(result);
|
|
33
|
+
};
|
|
34
|
+
const child = spawn(cmd, args, { shell: useShell, signal, cwd: cwd ?? undefined });
|
|
35
|
+
child.stdout?.on("data", (chunk) => write("stdout", chunk.toString("utf8")));
|
|
36
|
+
child.stderr?.on("data", (chunk) => write("stderr", chunk.toString("utf8")));
|
|
37
|
+
child.on("error", (err) => {
|
|
38
|
+
if (err.code === "ABORT_ERR") {
|
|
39
|
+
finish({ status: 499, exitCode: -1 }, "errored");
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
// The process could not be started — a framework-level failure
|
|
43
|
+
// the model benefits from seeing as telemetry (a nonzero exit,
|
|
44
|
+
// by contrast, is the program's own result and lives on stderr).
|
|
45
|
+
emit({ source: `exec:${runtime}`, kind: "spawn_failed", message: err.message });
|
|
46
|
+
finish({ status: 500, exitCode: -1 }, "errored");
|
|
47
|
+
});
|
|
48
|
+
child.on("close", (code, killedBySignal) => {
|
|
49
|
+
if (killedBySignal !== null) {
|
|
50
|
+
finish({ status: 499, exitCode: code ?? -1 }, "errored");
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
const ok = code === 0;
|
|
54
|
+
finish({ status: ok ? 200 : 500, exitCode: code ?? -1 }, ok ? "closed" : "errored");
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=SubprocessExecutor.js.map
|
|
@@ -0,0 +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,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC;gBAC1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C,IAAI,cAAc,KAAK,IAAI,EAAE,CAAC;oBAC1B,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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export interface TelemetryEvent {
|
|
2
|
+
readonly source: string;
|
|
3
|
+
readonly kind: string;
|
|
4
|
+
readonly message?: string | null;
|
|
5
|
+
readonly position?: ContentOffset | LogCoordinate | null;
|
|
6
|
+
readonly [k: string]: unknown;
|
|
7
|
+
}
|
|
8
|
+
export interface ContentOffset {
|
|
9
|
+
readonly type: "content-offset";
|
|
10
|
+
readonly line: number;
|
|
11
|
+
readonly column: number;
|
|
12
|
+
}
|
|
13
|
+
export interface LogCoordinate {
|
|
14
|
+
readonly type: "log-coordinate";
|
|
15
|
+
readonly coordinate: string;
|
|
16
|
+
readonly op?: string;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=TelemetryEvent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TelemetryEvent.d.ts","sourceRoot":"","sources":["../src/TelemetryEvent.ts"],"names":[],"mappings":"AAWA,MAAM,WAAW,cAAc;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,QAAQ,CAAC,EAAE,aAAa,GAAG,aAAa,GAAG,IAAI,CAAC;IACzD,QAAQ,EAAE,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACjC;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,aAAa;IAC1B,QAAQ,CAAC,IAAI,EAAE,gBAAgB,CAAC;IAChC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;CACxB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TelemetryEvent.js","sourceRoot":"","sources":["../src/TelemetryEvent.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.d.ts","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAY,MAAM,YAAY,CAAC;AAkBvE,wBAAsB,QAAQ,CAAC,OAAO,GAAE,eAAoB,GAAG,OAAO,CAAC,SAAS,CAAC,CAkBhF"}
|
package/dist/discover.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import fs from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
// Scan installed executor packages and build the runtime-tag registry the
|
|
4
|
+
// consuming scheme dispatches on. Parallel to plurnk-mimetypes' discover().
|
|
5
|
+
//
|
|
6
|
+
// Default scan target: `<cwd>/node_modules/@plurnk/`. Tests and unusual
|
|
7
|
+
// layouts can pass `packageDirs` explicitly to skip the scan.
|
|
8
|
+
//
|
|
9
|
+
// A package is recognized as an executor when its `package.json` declares
|
|
10
|
+
// `plurnk.kind === "exec"` and exposes one or more runtime tags via
|
|
11
|
+
// `plurnk.runtimes: { name, glyph? }[]` (SPEC §3). Each entry registers its
|
|
12
|
+
// tag separately; one package can claim many tags backed by the same handler
|
|
13
|
+
// (e.g. the search sibling claims `search`, `news`, `images`, …).
|
|
14
|
+
//
|
|
15
|
+
// Tags are a flat global namespace. Unlike plurnk-mimetypes (last-loaded
|
|
16
|
+
// wins), a tag collision here is a FAIL-HARD install error: two packages
|
|
17
|
+
// claiming the same runtime is an unresolvable ambiguity the operator must
|
|
18
|
+
// fix (SPEC §3, plurnk-execs#1).
|
|
19
|
+
export async function discover(options = {}) {
|
|
20
|
+
const dirs = options.packageDirs ?? await defaultPackageDirs(options.cwd ?? process.cwd());
|
|
21
|
+
const registry = new Map();
|
|
22
|
+
for (const dir of dirs) {
|
|
23
|
+
for (const info of await readExecInfos(dir)) {
|
|
24
|
+
const existing = registry.get(info.runtime);
|
|
25
|
+
if (existing !== undefined) {
|
|
26
|
+
throw new Error(`exec runtime collision: '${info.runtime}' claimed by both `
|
|
27
|
+
+ `${existing.packageName} and ${info.packageName}`);
|
|
28
|
+
}
|
|
29
|
+
registry.set(info.runtime, info);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return { registry };
|
|
33
|
+
}
|
|
34
|
+
async function defaultPackageDirs(cwd) {
|
|
35
|
+
const scope = path.join(cwd, "node_modules", "@plurnk");
|
|
36
|
+
let entries;
|
|
37
|
+
try {
|
|
38
|
+
entries = await fs.readdir(scope, { withFileTypes: true });
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return [];
|
|
42
|
+
}
|
|
43
|
+
return entries
|
|
44
|
+
.filter((entry) => entry.isDirectory())
|
|
45
|
+
.map((entry) => path.join(scope, entry.name));
|
|
46
|
+
}
|
|
47
|
+
// Produce one ExecInfo per declared runtime tag. Returns [] for non-executor
|
|
48
|
+
// packages or invalid declarations.
|
|
49
|
+
async function readExecInfos(dir) {
|
|
50
|
+
const pkgPath = path.join(dir, "package.json");
|
|
51
|
+
let raw;
|
|
52
|
+
try {
|
|
53
|
+
raw = await fs.readFile(pkgPath, "utf-8");
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return [];
|
|
57
|
+
}
|
|
58
|
+
let pkg;
|
|
59
|
+
try {
|
|
60
|
+
pkg = JSON.parse(raw);
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
if (typeof pkg !== "object" || pkg === null)
|
|
66
|
+
return [];
|
|
67
|
+
const record = pkg;
|
|
68
|
+
const plurnk = record.plurnk;
|
|
69
|
+
if (typeof plurnk !== "object" || plurnk === null)
|
|
70
|
+
return [];
|
|
71
|
+
const plurnkRec = plurnk;
|
|
72
|
+
if (plurnkRec.kind !== "exec")
|
|
73
|
+
return [];
|
|
74
|
+
if (!Array.isArray(plurnkRec.runtimes))
|
|
75
|
+
return [];
|
|
76
|
+
const packageName = typeof record.name === "string" ? record.name : "";
|
|
77
|
+
const infos = [];
|
|
78
|
+
for (const entry of plurnkRec.runtimes) {
|
|
79
|
+
if (typeof entry !== "object" || entry === null)
|
|
80
|
+
continue;
|
|
81
|
+
const e = entry;
|
|
82
|
+
if (typeof e.name !== "string" || e.name === "")
|
|
83
|
+
continue;
|
|
84
|
+
infos.push({
|
|
85
|
+
runtime: e.name,
|
|
86
|
+
glyph: typeof e.glyph === "string" ? e.glyph : "",
|
|
87
|
+
packageName,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
return infos;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=discover.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discover.js","sourceRoot":"","sources":["../src/discover.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAClC,OAAO,IAAI,MAAM,WAAW,CAAC;AAG7B,0EAA0E;AAC1E,4EAA4E;AAC5E,E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OAAO,EAAE,CAAC;IAElD,MAAM,WAAW,GAAG,OAAO,MAAM,CAAC,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC;IACvE,MAAM,KAAK,GAAe,EAAE,CAAC;IAC7B,KAAK,MAAM,KAAK,IAAI,SAAS,CAAC,QAAQ,EAAE,CAAC;QACrC,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI;YAAE,SAAS;QAC1D,MAAM,CAAC,GAAG,KAAgC,CAAC;QAC3C,IAAI,OAAO,CAAC,CAAC,IAAI,KAAK,QAAQ,IAAI,CAAC,CAAC,IAAI,KAAK,EAAE;YAAE,SAAS;QAC1D,KAAK,CAAC,IAAI,CAAC;YACP,OAAO,EAAE,CAAC,CAAC,IAAI;YACf,KAAK,EAAE,OAAO,CAAC,CAAC,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE;YACjD,WAAW;SACd,CAAC,CAAC;IACP,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { default as BaseExecutor } from "./BaseExecutor.ts";
|
|
2
|
+
export { default as SubprocessExecutor } from "./SubprocessExecutor.ts";
|
|
3
|
+
export { discover } from "./discover.ts";
|
|
2
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";
|
|
6
|
+
export type { TelemetryEvent, ContentOffset, LogCoordinate } from "./TelemetryEvent.ts";
|
|
3
7
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
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"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
// Framework surface
|
|
2
|
+
export { default as BaseExecutor } from "./BaseExecutor.js";
|
|
3
|
+
export { default as SubprocessExecutor } from "./SubprocessExecutor.js";
|
|
4
|
+
export { discover } from "./discover.js";
|
|
5
|
+
// Runtime-tag → spawn-args helper (subprocess family; legacy scheme path)
|
|
1
6
|
export { KNOWN_RUNTIMES, isKnownRuntime, resolveRuntime } from "./runtime.js";
|
|
2
7
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,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;AAEzC,0EAA0E;AAC1E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
import type { TelemetryEvent } from "./TelemetryEvent.ts";
|
|
2
|
+
export type ChannelState = "active" | "closed" | "errored";
|
|
3
|
+
export interface ChannelDecl {
|
|
4
|
+
mimetype: string;
|
|
5
|
+
defaultState?: ChannelState;
|
|
6
|
+
}
|
|
7
|
+
export interface ExecutorMetadata {
|
|
8
|
+
runtime: string;
|
|
9
|
+
glyph: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ExecArgs {
|
|
12
|
+
runtime: string;
|
|
13
|
+
command: string;
|
|
14
|
+
cwd: string | null;
|
|
15
|
+
signal: AbortSignal;
|
|
16
|
+
write: (channel: string, chunk: string) => void;
|
|
17
|
+
setState: (channel: string, state: ChannelState) => void;
|
|
18
|
+
emit: (event: TelemetryEvent) => void;
|
|
19
|
+
}
|
|
20
|
+
export interface ExecResult {
|
|
21
|
+
status: number;
|
|
22
|
+
exitCode?: number;
|
|
23
|
+
}
|
|
24
|
+
export interface ExecInfo {
|
|
25
|
+
runtime: string;
|
|
26
|
+
glyph: string;
|
|
27
|
+
packageName: string;
|
|
28
|
+
}
|
|
29
|
+
export type ExecRegistry = ReadonlyMap<string, ExecInfo>;
|
|
30
|
+
export interface Discovery {
|
|
31
|
+
registry: ExecRegistry;
|
|
32
|
+
}
|
|
33
|
+
export interface DiscoverOptions {
|
|
34
|
+
cwd?: string;
|
|
35
|
+
packageDirs?: string[];
|
|
36
|
+
}
|
|
1
37
|
export interface SpawnArgs {
|
|
2
38
|
/** Command to invoke (e.g. "node", "python3", or — when useShell — the raw command). */
|
|
3
39
|
cmd: string;
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"
|
|
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,CAAC;IAGzD,IAAI,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;CACzC;AAKD,MAAM,WAAW,UAAU;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AAGD,MAAM,WAAW,QAAQ;IACrB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;CACvB;AAID,MAAM,MAAM,YAAY,GAAG,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;AAEzD,MAAM,WAAW,SAAS;IACtB,QAAQ,EAAE,YAAY,CAAC;CAC1B;AAED,MAAM,WAAW,eAAe;IAG5B,GAAG,CAAC,EAAE,MAAM,CAAC;IAGb,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;CAC1B;AAID,MAAM,WAAW,SAAS;IACtB,wFAAwF;IACxF,GAAG,EAAE,MAAM,CAAC;IACZ,kCAAkC;IAClC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,mGAAmG;IACnG,QAAQ,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,eAAe,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,KAAK,SAAS,CAAC"}
|
package/dist/types.js
CHANGED
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
// Runtime executor contract. Each `@plurnk/plurnk-execs-*` sibling declares
|
|
2
|
-
// one or more runtime tags (`sh`, `bash`, `python`, `search`,
|
|
3
|
-
//
|
|
2
|
+
// one or more runtime tags (`sh`, `bash`, `python`, `search`, `news`, …) in
|
|
3
|
+
// its `package.json` `plurnk.runtimes[]` block, and provides a BaseExecutor
|
|
4
|
+
// subclass implementing the dispatch for those tags.
|
|
4
5
|
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
6
|
+
// The framework surface is `BaseExecutor.run()` + `discover()`. The runtime
|
|
7
|
+
// tag → spawn-args translator (`SpawnArgs` / `resolveRuntime`) is retained as
|
|
8
|
+
// a subprocess-family helper: plurnk-service's exec scheme still consumes it
|
|
9
|
+
// on its legacy subprocess path until the deferred SubprocessExecutor
|
|
10
|
+
// migration (service#174 Q2). See SPEC.md.
|
|
8
11
|
export {};
|
|
9
12
|
//# sourceMappingURL=types.js.map
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,4EAA4E;AAC5E,4EAA4E;AAC5E,qDAAqD;AACrD,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,sEAAsE;AACtE,2CAA2C"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plurnk/plurnk-execs",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.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",
|