@plurnk/plurnk-execs 1.3.12 → 1.5.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/.env.defaults +4 -0
- package/README.md +78 -36
- package/SPEC.md +386 -260
- package/dist/BaseExecutor.d.ts.map +1 -1
- package/dist/BaseExecutor.js +12 -13
- package/dist/BaseExecutor.js.map +1 -1
- package/dist/ErrorDetail.d.ts +8 -0
- package/dist/ErrorDetail.d.ts.map +1 -0
- package/dist/ErrorDetail.js +25 -0
- package/dist/ErrorDetail.js.map +1 -0
- package/dist/Notice.d.ts +3 -0
- package/dist/Notice.d.ts.map +1 -0
- package/dist/Notice.js +2 -0
- package/dist/Notice.js.map +1 -0
- package/dist/RuntimeTag.d.ts +5 -0
- package/dist/RuntimeTag.d.ts.map +1 -0
- package/dist/RuntimeTag.js +28 -0
- package/dist/RuntimeTag.js.map +1 -0
- package/dist/SubprocessExecutor.d.ts +1 -1
- package/dist/SubprocessExecutor.d.ts.map +1 -1
- package/dist/SubprocessExecutor.js +67 -20
- package/dist/SubprocessExecutor.js.map +1 -1
- package/dist/advertise.d.ts +4 -0
- package/dist/advertise.d.ts.map +1 -1
- package/dist/advertise.js +4 -2
- package/dist/advertise.js.map +1 -1
- package/dist/discover.d.ts.map +1 -1
- package/dist/discover.js +52 -84
- package/dist/discover.js.map +1 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -6
- package/dist/index.js.map +1 -1
- package/dist/policy.d.ts +1 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +21 -20
- package/dist/policy.js.map +1 -1
- package/dist/runtime.js +1 -1
- package/dist/runtime.js.map +1 -1
- package/dist/tokenizeArgv.d.ts +5 -0
- package/dist/tokenizeArgv.d.ts.map +1 -0
- package/dist/tokenizeArgv.js +69 -0
- package/dist/tokenizeArgv.js.map +1 -0
- package/dist/types.d.ts +6 -4
- package/dist/types.d.ts.map +1 -1
- package/package.json +11 -15
- package/dist/TelemetryEvent.d.ts +0 -18
- package/dist/TelemetryEvent.d.ts.map +0 -1
- package/dist/TelemetryEvent.js +0 -2
- package/dist/TelemetryEvent.js.map +0 -1
package/dist/discover.js
CHANGED
|
@@ -12,74 +12,51 @@ import { createRequire } from "node:module";
|
|
|
12
12
|
import { pathToFileURL } from "node:url";
|
|
13
13
|
import Meta from "@plurnk/plurnk-meta";
|
|
14
14
|
import Policy from "./policy.js";
|
|
15
|
-
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
//
|
|
19
|
-
// detached re-export stays callable.
|
|
15
|
+
import RuntimeTag from "./RuntimeTag.js";
|
|
16
|
+
// Build the flat runtime-tag registry from installed executor packages
|
|
17
|
+
// ({§executor-discovery}). `index.ts` re-exports `Discover.scan` as discover;
|
|
18
|
+
// internal calls retain the class binding so that detached export stays usable.
|
|
20
19
|
//
|
|
21
20
|
// Default scan target: every installed package under `<cwd>/node_modules` —
|
|
22
21
|
// scope-agnostic, so third-party executors (`@acme/foo`) are discovered too,
|
|
23
22
|
// not just `@plurnk/*`. Tests and unusual layouts can pass `packageDirs`
|
|
24
23
|
// explicitly to skip the scan.
|
|
25
24
|
//
|
|
26
|
-
//
|
|
27
|
-
//
|
|
28
|
-
// discovered but not registered, returned in `Discovery.skipped` for the
|
|
29
|
-
// consumer to note. Off by default — no regression.
|
|
30
|
-
//
|
|
31
|
-
// A package is recognized as an executor when its `package.json` declares
|
|
32
|
-
// `plurnk.kind === "exec"` and exposes one or more runtime tags. Tags come from
|
|
33
|
-
// one of two sources (SPEC §3):
|
|
25
|
+
// Trust precedes executable hooks ({§executor-trust}). A package is recognized
|
|
26
|
+
// only when its manifest declares `plurnk.kind === "exec"`; tags come from:
|
|
34
27
|
// - STATIC: `plurnk.runtimes: { name, glyph?, example?, documentation? }[]` —
|
|
35
|
-
//
|
|
36
|
-
// - DYNAMIC: `plurnk.runtimesModule: "<
|
|
37
|
-
//
|
|
38
|
-
// module's `runtimes` (or default) export is a hook discover() imports and
|
|
39
|
-
// calls at scan time to materialize the decls. Executed only for TRUSTED
|
|
40
|
-
// packages — the trust gate runs first, so an untrusted package's hook is
|
|
41
|
-
// never imported (plurnk-execs#10). A declared-but-broken hook is fail-hard.
|
|
28
|
+
// tags known at publish time.
|
|
29
|
+
// - DYNAMIC: `plurnk.runtimesModule: "<export-subpath>"` — a trusted hook that
|
|
30
|
+
// returns deployment-configured declarations ({§executor-dynamic-runtimes}).
|
|
42
31
|
// Each decl registers its tag separately; one package can claim many tags
|
|
43
|
-
// backed by the same
|
|
44
|
-
//
|
|
45
|
-
// (plurnk-execs#7); `documentation` is the fuller markdown a consumer can serve
|
|
46
|
-
// on demand — sourced from a `docs/<tag>.md` file in the package (the docs
|
|
47
|
-
// convention), falling back to the inline `documentation` manifest field.
|
|
48
|
-
// execs carries both; how they reach the model is the consumer's. Package-level
|
|
49
|
-
// `plurnk.attribution` (string | string[]) is surfaced raw on each tag too
|
|
50
|
-
// (plurnk-service#249).
|
|
32
|
+
// backed by the same default export. Example, documentation, and attribution
|
|
33
|
+
// projection are defined by {§executor-runtime-declaration}.
|
|
51
34
|
//
|
|
52
|
-
// Tags
|
|
53
|
-
//
|
|
54
|
-
// claiming the same runtime is an unresolvable ambiguity the operator must
|
|
55
|
-
// fix (SPEC §3, plurnk-execs#1).
|
|
35
|
+
// Tags occupy one flat namespace. Two packages claiming one tag are a fail-hard
|
|
36
|
+
// installation ambiguity.
|
|
56
37
|
export default class Discover {
|
|
57
38
|
static async scan(options = {}) {
|
|
58
39
|
const dirs = options.packageDirs ?? await Discover.#defaultPackageDirs(options.cwd ?? process.cwd());
|
|
59
40
|
const registry = new Map();
|
|
41
|
+
const packageAttributions = new Map();
|
|
60
42
|
const skipped = new Set();
|
|
61
43
|
const disabled = new Set();
|
|
62
44
|
for (const dir of dirs) {
|
|
63
45
|
const manifest = await Discover.#readExecManifest(dir);
|
|
64
46
|
if (manifest === null)
|
|
65
47
|
continue; // not an exec package
|
|
66
|
-
//
|
|
67
|
-
//
|
|
68
|
-
// imported: an untrusted third-party package is discovered but not
|
|
69
|
-
// registered, and its code is never executed. Recorded for the
|
|
70
|
-
// consumer's telemetry note, never crashed on.
|
|
48
|
+
// Trust is enforced before any dynamic runtime hook is imported
|
|
49
|
+
// ({§executor-trust}).
|
|
71
50
|
if (!Meta.isTrusted(manifest.packageName)) {
|
|
72
51
|
skipped.add(manifest.packageName);
|
|
73
52
|
continue;
|
|
74
53
|
}
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
//
|
|
80
|
-
//
|
|
81
|
-
// per-workspace client layer is the consumer's to intersect via
|
|
82
|
-
// the exported Policy, same parser.
|
|
54
|
+
const tags = Meta.normalizeAttribution(manifest.plurnk.attribution, manifest.packageName);
|
|
55
|
+
const attribution = Discover.#attributionProjection(manifest.plurnk.attribution, tags);
|
|
56
|
+
let admitted = false;
|
|
57
|
+
for (const info of await Discover.#readExecInfos(dir, manifest, attribution)) {
|
|
58
|
+
// Boot policy removes a tag before registration; consumer-owned
|
|
59
|
+
// layers can reuse the same parser ({§executor-policy}).
|
|
83
60
|
if (!Policy.isEnabled(info.runtime)) {
|
|
84
61
|
disabled.add(info.runtime);
|
|
85
62
|
continue;
|
|
@@ -90,22 +67,21 @@ export default class Discover {
|
|
|
90
67
|
+ `${existing.packageName} and ${info.packageName}`);
|
|
91
68
|
}
|
|
92
69
|
registry.set(info.runtime, info);
|
|
70
|
+
admitted = true;
|
|
93
71
|
}
|
|
72
|
+
if (admitted && tags.length > 0)
|
|
73
|
+
packageAttributions.set(manifest.packageName, tags);
|
|
94
74
|
}
|
|
95
|
-
return { registry, skipped: [...skipped].sort(), disabled: [...disabled].sort() };
|
|
75
|
+
return { registry, packageAttributions, skipped: [...skipped].sort(), disabled: [...disabled].sort() };
|
|
96
76
|
}
|
|
97
|
-
// Enumerate
|
|
98
|
-
//
|
|
99
|
-
// so a THIRD PARTY can publish an executor under their own scope (`@acme/foo`)
|
|
100
|
-
// and have it discovered with no involvement from us; `#readExecInfos` keeps
|
|
101
|
-
// only the packages that declare `plurnk.kind === "exec"`.
|
|
77
|
+
// Enumerate scoped and unscoped packages under the nearest node_modules;
|
|
78
|
+
// `#readExecManifest` retains only declared executor packages.
|
|
102
79
|
static async #defaultPackageDirs(cwd) {
|
|
103
80
|
const nm = Meta.nearestNodeModules(cwd) ?? path.join(path.resolve(cwd), "node_modules");
|
|
104
81
|
return (await Meta.packageDirs(nm)).map((c) => c.dir).toSorted();
|
|
105
82
|
}
|
|
106
83
|
// Read a package's `package.json` and return its manifest iff it declares
|
|
107
|
-
// `plurnk.kind === "exec"`
|
|
108
|
-
// a package shipping an exec AND a scheme face (#483; plurnk-execs-mcp).
|
|
84
|
+
// the exact `plurnk.kind === "exec"` family identity.
|
|
109
85
|
// Returns null for non-executor packages, a missing or malformed
|
|
110
86
|
// `package.json` — discover() silently skips those (they are not "skipped by
|
|
111
87
|
// trust", just not exec packages).
|
|
@@ -131,32 +107,24 @@ export default class Discover {
|
|
|
131
107
|
if (typeof plurnk !== "object" || plurnk === null)
|
|
132
108
|
return null;
|
|
133
109
|
const plurnkRec = plurnk;
|
|
134
|
-
|
|
135
|
-
if (kind !== "exec" && !(Array.isArray(kind) && kind.includes("exec")))
|
|
110
|
+
if (!Meta.declaresKind(plurnkRec, "exec"))
|
|
136
111
|
return null;
|
|
137
112
|
return { packageName: typeof record.name === "string" ? record.name : "", plurnk: plurnkRec };
|
|
138
113
|
}
|
|
139
|
-
// Produce one ExecInfo per
|
|
140
|
-
|
|
141
|
-
// declared.
|
|
142
|
-
static async #readExecInfos(dir, { packageName, plurnk }) {
|
|
143
|
-
// Package-level attribution, surfaced raw (plurnk-service#249); every tag
|
|
144
|
-
// of the package carries the same value. The consumer owns the policy.
|
|
145
|
-
const rawAttr = plurnk.attribution;
|
|
146
|
-
const attribution = typeof rawAttr === "string" || Array.isArray(rawAttr) ? rawAttr : undefined;
|
|
114
|
+
// Produce one ExecInfo per static or dynamic runtime declaration.
|
|
115
|
+
static async #readExecInfos(dir, { packageName, plurnk }, attribution) {
|
|
147
116
|
const infos = [];
|
|
148
117
|
for (const decl of await Discover.#runtimeDecls(dir, packageName, plurnk)) {
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
//
|
|
155
|
-
// convention); the inline `documentation` field is the fallback.
|
|
118
|
+
const e = typeof decl === "object" && decl !== null
|
|
119
|
+
? decl
|
|
120
|
+
: {};
|
|
121
|
+
const runtime = RuntimeTag.assert(e.name, packageName);
|
|
122
|
+
// A package doc file wins over inline documentation
|
|
123
|
+
// ({§executor-runtime-declaration}).
|
|
156
124
|
const inlineDoc = typeof e.documentation === "string" ? e.documentation : "";
|
|
157
|
-
const documentation = await Discover.#readDocFile(dir,
|
|
125
|
+
const documentation = await Discover.#readDocFile(dir, runtime) ?? inlineDoc;
|
|
158
126
|
infos.push({
|
|
159
|
-
runtime
|
|
127
|
+
runtime,
|
|
160
128
|
glyph: typeof e.glyph === "string" ? e.glyph : "",
|
|
161
129
|
example: typeof e.example === "string" ? e.example : "",
|
|
162
130
|
documentation,
|
|
@@ -166,10 +134,15 @@ export default class Discover {
|
|
|
166
134
|
}
|
|
167
135
|
return infos;
|
|
168
136
|
}
|
|
169
|
-
//
|
|
170
|
-
//
|
|
171
|
-
|
|
172
|
-
|
|
137
|
+
// The package map is canonical. This preserves the shipped descriptor shape
|
|
138
|
+
// without preserving a second validation policy.
|
|
139
|
+
static #attributionProjection(raw, tags) {
|
|
140
|
+
if (raw === undefined || raw === null)
|
|
141
|
+
return undefined;
|
|
142
|
+
return typeof raw === "string" ? raw : [...tags];
|
|
143
|
+
}
|
|
144
|
+
// Static declarations win over a dynamic export when both are present
|
|
145
|
+
// ({§executor-dynamic-runtimes}).
|
|
173
146
|
static async #runtimeDecls(dir, packageName, plurnk) {
|
|
174
147
|
if (Array.isArray(plurnk.runtimes))
|
|
175
148
|
return plurnk.runtimes;
|
|
@@ -178,14 +151,9 @@ export default class Discover {
|
|
|
178
151
|
return Discover.#loadDynamicRuntimes(dir, packageName, mod);
|
|
179
152
|
return [];
|
|
180
153
|
}
|
|
181
|
-
// Import
|
|
182
|
-
//
|
|
183
|
-
//
|
|
184
|
-
// (dist) layouts on one mechanism. Fail-hard on every failure — an
|
|
185
|
-
// unloadable module, a missing/non-function export, or a non-array return
|
|
186
|
-
// is a contract violation by a trusted package (its own packaging or
|
|
187
|
-
// config), surfaced with the cause, never swallowed. The trust gate in
|
|
188
|
-
// scan() guarantees this only runs for trusted packages.
|
|
154
|
+
// Import an admitted package's hook through its export map. Hook loading,
|
|
155
|
+
// shape, execution, and result failures are fail-hard
|
|
156
|
+
// ({§executor-dynamic-runtimes}).
|
|
189
157
|
static async #loadDynamicRuntimes(dir, packageName, rel) {
|
|
190
158
|
if (!rel.startsWith("./"))
|
|
191
159
|
throw new Error(`exec runtimes hook invalid: ${packageName} -> ${rel} must be an export subpath like "./runtimes"`);
|
package/dist/discover.js.map
CHANGED
|
@@ -1 +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;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,qBAAqB,CAAC;
|
|
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;AAC7B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,IAAI,MAAM,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AAK,CAAC,EAAE,CAAC;YACxB,MAAM,IAAI,KAAK,CAAC,4CAA4C,WAAW,OAAO,GAAG,EAAE,CAAC,CAAC;QACzF,CAAC;QACD,OAAO,KAAsB,CAAC;IAClC,CAAC;IAED,2EAA2E;IAC3E,0EAA0E;IAC1E,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,GAAW,EAAE,GAAW;QAC9C,IAAI,CAAC;YACD,OAAO,MAAM,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAG,KAAK,CAAC,EAAE,OAAO,CAAC,CAAC;QAC3E,CAAC;QAAC,MAAM,CAAC;YACL,OAAO,IAAI,CAAC;QAChB,CAAC;IACL,CAAC;CACJ"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import Discover from "./discover.ts";
|
|
2
2
|
export { default as BaseExecutor } from "./BaseExecutor.ts";
|
|
3
3
|
export { default as SubprocessExecutor } from "./SubprocessExecutor.ts";
|
|
4
|
+
export { default as ErrorDetail, ERROR_DETAIL_LIMIT } from "./ErrorDetail.ts";
|
|
5
|
+
export { CommandSyntaxError, tokenizeArgv } from "./tokenizeArgv.ts";
|
|
6
|
+
export { default as RuntimeTag } from "./RuntimeTag.ts";
|
|
4
7
|
export declare const discover: typeof Discover.scan;
|
|
5
8
|
export { default as Policy } from "./policy.ts";
|
|
6
9
|
export { default as Advertise } from "./advertise.ts";
|
|
10
|
+
export { Results } from "@plurnk/plurnk-schemes";
|
|
11
|
+
export type { ProblemDetails, SchemeResult } from "@plurnk/plurnk-schemes";
|
|
12
|
+
export { renderJsonResult } from "@plurnk/plurnk-contracts";
|
|
7
13
|
export type { ChannelState, ChannelDecl, ExecutorMetadata, ExecArgs, ExecResult, Effect, RuntimeAvailability, RuntimeDecl, RuntimesHook, ExecInfo, ExecRegistry, Discovery, DiscoverOptions, SpawnArgs, } from "./types.ts";
|
|
8
|
-
export type {
|
|
14
|
+
export type { Notice, NoticeLevel, ContentOffset, LogCoordinate } from "./Notice.ts";
|
|
15
|
+
export type { PluginAttributionContext, PluginAttributionDeclaration, PluginAttributionSource, } from "@plurnk/plurnk-meta";
|
|
9
16
|
//# 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":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAGrC,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAKxD,eAAO,MAAM,QAAQ,sBAAgB,CAAC;AAMtC,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAIhD,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAItD,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AACjD,YAAY,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,YAAY,EACR,YAAY,EACZ,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,UAAU,EACV,MAAM,EACN,mBAAmB,EACnB,WAAW,EACX,YAAY,EACZ,QAAQ,EACR,YAAY,EACZ,SAAS,EACT,eAAe,EACf,SAAS,GACZ,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,MAAM,EAAE,WAAW,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACrF,YAAY,EACR,wBAAwB,EACxB,4BAA4B,EAC5B,uBAAuB,GAC1B,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -2,18 +2,23 @@ import Discover from "./discover.js";
|
|
|
2
2
|
// Framework surface
|
|
3
3
|
export { default as BaseExecutor } from "./BaseExecutor.js";
|
|
4
4
|
export { default as SubprocessExecutor } from "./SubprocessExecutor.js";
|
|
5
|
-
|
|
5
|
+
export { default as ErrorDetail, ERROR_DETAIL_LIMIT } from "./ErrorDetail.js";
|
|
6
|
+
export { CommandSyntaxError, tokenizeArgv } from "./tokenizeArgv.js";
|
|
7
|
+
export { default as RuntimeTag } from "./RuntimeTag.js";
|
|
8
|
+
// Discovery ({§executor-discovery}). The behavior lives on `Discover`; the
|
|
6
9
|
// documented `discover()` entry is its `scan` static, re-exported here so the
|
|
7
10
|
// public contract and the consumer's import stay unchanged.
|
|
8
11
|
export const discover = Discover.scan;
|
|
9
|
-
//
|
|
12
|
+
// Subtractive runtime policy ({§executor-policy}). `discover()` applies it as the
|
|
10
13
|
// daemon boot layer; the consumer reuses the same parser for the per-workspace
|
|
11
14
|
// client layer — Policy.enabledAcross(tag, [serviceEnv, clientLayer]) — so the
|
|
12
15
|
// cascade is byte-identical at both tiers.
|
|
13
16
|
export { default as Policy } from "./policy.js";
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
// permitted" line instead of silent absence, which the model reads as unknown
|
|
17
|
-
// availability and fills by confabulating runtimes (execs#24).
|
|
17
|
+
// Frozen 1.x compatibility export ({§executor-advertise-compat}). It has no
|
|
18
|
+
// production consumer and owns no capability filtering or presentation.
|
|
18
19
|
export { default as Advertise } from "./advertise.js";
|
|
20
|
+
// Universal operation-result helpers. Executors return the same result shape as
|
|
21
|
+
// schemes; the consuming daemon validates it at the plugin boundary.
|
|
22
|
+
export { Results } from "@plurnk/plurnk-schemes";
|
|
23
|
+
export { renderJsonResult } from "@plurnk/plurnk-contracts";
|
|
19
24
|
//# 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":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,oBAAoB;AACpB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,QAAQ,MAAM,eAAe,CAAC;AAErC,oBAAoB;AACpB,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AACxE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC9E,OAAO,EAAE,kBAAkB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAExD,2EAA2E;AAC3E,8EAA8E;AAC9E,4DAA4D;AAC5D,MAAM,CAAC,MAAM,QAAQ,GAAG,QAAQ,CAAC,IAAI,CAAC;AAEtC,kFAAkF;AAClF,+EAA+E;AAC/E,+EAA+E;AAC/E,2CAA2C;AAC3C,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,aAAa,CAAC;AAEhD,4EAA4E;AAC5E,wEAAwE;AACxE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEtD,gFAAgF;AAChF,qEAAqE;AACrE,OAAO,EAAE,OAAO,EAAE,MAAM,wBAAwB,CAAC;AAEjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/policy.d.ts
CHANGED
package/dist/policy.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAkBA,MAAM,CAAC,OAAO,OAAO,MAAM;;IACvB,MAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAKjC;IAaD,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAe,GAAG,OAAO,CAS5F;IAKD,MAAM,CAAC,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,GAAG,OAAO,CAE5F;CACJ"}
|
package/dist/policy.js
CHANGED
|
@@ -1,31 +1,32 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
4
|
-
// the consumer can honor "a client may freely activate any registered
|
|
5
|
-
// capability" (§3.2) while the registered set itself is bounded per layer.
|
|
1
|
+
// Subtractive runtime registration policy ({§executor-policy}). A disabled tag
|
|
2
|
+
// is absent from the registry. Consumers may reuse the same parser for narrower
|
|
3
|
+
// workspace layers.
|
|
6
4
|
//
|
|
7
5
|
// Grammar (the `PLURNK_EXECS_*` namespace — same at every tier):
|
|
8
6
|
// PLURNK_EXECS_<TAG>=0 | false surgical kill-switch for one tag
|
|
9
7
|
// PLURNK_EXECS_ONLY=a,b,c allowlist — a tag not listed is disabled
|
|
10
8
|
// The two compose within a layer (a listed tag can still be individually
|
|
11
|
-
// killed). `
|
|
9
|
+
// killed). `only` is not an admissible runtime tag because it names this
|
|
10
|
+
// allowlist key ({§executor-runtime-declaration}).
|
|
12
11
|
//
|
|
13
|
-
// PURELY SUBTRACTIVE
|
|
14
|
-
//
|
|
15
|
-
// only ever narrow. The client can never re-enable a tag the service disabled,
|
|
16
|
-
// structurally, not by a policed rule.
|
|
12
|
+
// PURELY SUBTRACTIVE: intersecting layers means no downstream layer can restore
|
|
13
|
+
// a tag removed upstream.
|
|
17
14
|
//
|
|
18
|
-
// `env` is
|
|
19
|
-
//
|
|
20
|
-
|
|
21
|
-
// tiers — the consumer feeds the client's map straight to these methods.
|
|
15
|
+
// `env` is one policy layer: `process.env` at discovery, or any consumer-owned
|
|
16
|
+
// map using the same `PLURNK_EXECS_*` grammar.
|
|
17
|
+
import RuntimeTag from "./RuntimeTag.js";
|
|
22
18
|
export default class Policy {
|
|
19
|
+
static isKey(key) {
|
|
20
|
+
const prefix = "PLURNK_EXECS_";
|
|
21
|
+
if (key.slice(0, prefix.length).toUpperCase() !== prefix)
|
|
22
|
+
return false;
|
|
23
|
+
const suffix = key.slice(prefix.length).toLowerCase();
|
|
24
|
+
return suffix === "only" || RuntimeTag.is(suffix);
|
|
25
|
+
}
|
|
23
26
|
// Read a PLURNK_EXECS_<suffix> key case-INSENSITIVELY. The env-var
|
|
24
|
-
// convention is uppercase, but
|
|
25
|
-
//
|
|
26
|
-
//
|
|
27
|
-
// the key the way the mcp config already folds server names. Direct hit
|
|
28
|
-
// first (the common uppercase form), then a folded scan.
|
|
27
|
+
// convention is uppercase, but matching is case-insensitive so a natural
|
|
28
|
+
// lowercase tag spelling does not silently miss. Try the conventional form
|
|
29
|
+
// first, then scan folded keys.
|
|
29
30
|
static #read(env, suffix) {
|
|
30
31
|
const key = `PLURNK_EXECS_${suffix.toUpperCase()}`;
|
|
31
32
|
if (key in env)
|
|
@@ -38,7 +39,7 @@ export default class Policy {
|
|
|
38
39
|
if (off === "0" || off?.toLowerCase() === "false")
|
|
39
40
|
return false;
|
|
40
41
|
const only = Policy.#read(env, "ONLY");
|
|
41
|
-
if (only) {
|
|
42
|
+
if (only !== undefined) {
|
|
42
43
|
const allow = new Set(only.split(",").map((s) => s.trim().toLowerCase()).filter(Boolean));
|
|
43
44
|
if (!allow.has(tag.toLowerCase()))
|
|
44
45
|
return false;
|
package/dist/policy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../src/policy.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,gFAAgF;AAChF,oBAAoB;AACpB,EAAE;AACF,iEAAiE;AACjE,oEAAoE;AACpE,4EAA4E;AAC5E,yEAAyE;AACzE,yEAAyE;AACzE,mDAAmD;AACnD,EAAE;AACF,gFAAgF;AAChF,0BAA0B;AAC1B,EAAE;AACF,+EAA+E;AAC/E,+CAA+C;AAC/C,OAAO,UAAU,MAAM,iBAAiB,CAAC;AAEzC,MAAM,CAAC,OAAO,OAAO,MAAM;IACvB,MAAM,CAAC,KAAK,CAAC,GAAW;QACpB,MAAM,MAAM,GAAG,eAAe,CAAC;QAC/B,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QACvE,MAAM,MAAM,GAAG,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACtD,OAAO,MAAM,KAAK,MAAM,IAAI,UAAU,CAAC,E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AAK,CAAC;QACpD,CAAC;QACD,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,mEAAmE;IACnE,yEAAyE;IACzE,iDAAiD;IACjD,MAAM,CAAC,aAAa,CAAC,GAAW,EAAE,MAAiD;QAC/E,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC,CAAC;IACjE,CAAC;CACJ"}
|
package/dist/runtime.js
CHANGED
|
@@ -3,7 +3,7 @@ export default class Runtime {
|
|
|
3
3
|
static resolve(runtime, command, target = null) {
|
|
4
4
|
const shell = runtime === "" || runtime === "sh" || runtime === "bash";
|
|
5
5
|
// With a target the program IS the target and the body is its stdin
|
|
6
|
-
// (
|
|
6
|
+
// ({§executor-subprocess-routing}): a shell runs the target as a command line (`-c`, so
|
|
7
7
|
// the shell tokenizes it — we don't); any other runtime runs it as a
|
|
8
8
|
// single script-file positional. No target → the body is the program,
|
|
9
9
|
// inline (`-c`/`-e`), as before.
|
package/dist/runtime.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAIhE,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,OAAe,EAAE,MAAM,GAAkB,IAAI;QACzE,MAAM,KAAK,GAAG,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,IAAI,IAAI,OAAO,KAAK,MAAM,CAAC;QACvE,oEAAoE;QACpE,
|
|
1
|
+
{"version":3,"file":"runtime.js","sourceRoot":"","sources":["../src/runtime.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAIhE,MAAM,CAAC,OAAO,OAAO,OAAO;IACxB,MAAM,CAAC,OAAO,CAAC,OAAe,EAAE,OAAe,EAAE,MAAM,GAAkB,IAAI;QACzE,MAAM,KAAK,GAAG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.ts","sourceRoot":"","sources":["../src/tokenizeArgv.ts"],"names":[],"mappings":"AAIA,qBAAa,kBAAmB,SAAQ,KAAK;IAChC,IAAI,SAAwB;CACxC;AAED,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAoCpD"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
// Split a command string into argv the way a POSIX shell tokenizes words,
|
|
2
|
+
// honoring single quotes, double quotes, and backslash escapes, without
|
|
3
|
+
// variable or command expansion. Direct-spawn executors use this to preserve
|
|
4
|
+
// familiar CLI spelling without passing the command through a shell.
|
|
5
|
+
export class CommandSyntaxError extends Error {
|
|
6
|
+
name = "CommandSyntaxError";
|
|
7
|
+
}
|
|
8
|
+
export function tokenizeArgv(input) {
|
|
9
|
+
const args = [];
|
|
10
|
+
let cur = "";
|
|
11
|
+
let inArg = false;
|
|
12
|
+
let i = 0;
|
|
13
|
+
const n = input.length;
|
|
14
|
+
while (i < n) {
|
|
15
|
+
const c = input[i];
|
|
16
|
+
if (c === "'") {
|
|
17
|
+
inArg = true;
|
|
18
|
+
i++;
|
|
19
|
+
while (i < n && input[i] !== "'") {
|
|
20
|
+
cur += input[i];
|
|
21
|
+
i++;
|
|
22
|
+
}
|
|
23
|
+
if (i >= n)
|
|
24
|
+
throw new CommandSyntaxError("unterminated single quote");
|
|
25
|
+
i++;
|
|
26
|
+
}
|
|
27
|
+
else if (c === '"') {
|
|
28
|
+
inArg = true;
|
|
29
|
+
i++;
|
|
30
|
+
while (i < n && input[i] !== '"') {
|
|
31
|
+
if (input[i] === "\\" && i + 1 < n && (input[i + 1] === '"' || input[i + 1] === "\\")) {
|
|
32
|
+
cur += input[i + 1];
|
|
33
|
+
i += 2;
|
|
34
|
+
}
|
|
35
|
+
else {
|
|
36
|
+
cur += input[i];
|
|
37
|
+
i++;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
if (i >= n)
|
|
41
|
+
throw new CommandSyntaxError("unterminated double quote");
|
|
42
|
+
i++;
|
|
43
|
+
}
|
|
44
|
+
else if (c === "\\") {
|
|
45
|
+
if (i + 1 >= n)
|
|
46
|
+
throw new CommandSyntaxError("trailing backslash");
|
|
47
|
+
cur += input[i + 1];
|
|
48
|
+
inArg = true;
|
|
49
|
+
i += 2;
|
|
50
|
+
}
|
|
51
|
+
else if (c === " " || c === "\t" || c === "\n" || c === "\r") {
|
|
52
|
+
if (inArg) {
|
|
53
|
+
args.push(cur);
|
|
54
|
+
cur = "";
|
|
55
|
+
inArg = false;
|
|
56
|
+
}
|
|
57
|
+
i++;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
cur += c;
|
|
61
|
+
inArg = true;
|
|
62
|
+
i++;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (inArg)
|
|
66
|
+
args.push(cur);
|
|
67
|
+
return args;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=tokenizeArgv.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokenizeArgv.js","sourceRoot":"","sources":["../src/tokenizeArgv.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,wEAAwE;AACxE,6EAA6E;AAC7E,qEAAqE;AACrE,MAAM,OAAO,kBAAmB,SAAQ,KAAK;IAChC,IAAI,GAAG,oBAAoB,CAAC;CACxC;AAED,MAAM,UAAU,YAAY,CAAC,KAAa;IACtC,MAAM,IAAI,GAAa,EAAE,CAAC;IAC1B,IAAI,GAAG,GAAG,EAAE,CAAC;IACb,IAAI,KAAK,GAAG,KAAK,CAAC;IAClB,IAAI,CAAC,GAAG,CAAC,CAAC;IACV,MAAM,CAAC,GAAG,KAAK,CAAC,MAAM,CAAC;IACvB,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACX,MAAM,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC;QACnB,IAAI,CAAC,KAAK,GAAG,EAAE,CAAC;YACZ,KAAK,GAAG,IAAI,CAAC;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AAC,CAAC,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC;YAAC,CAAC,IAAI,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAC7D,IAAI,KAAK,EAAE,CAAC;gBAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBAAC,GAAG,GAAG,EAAE,CAAC;gBAAC,KAAK,GAAG,KAAK,CAAC;YAAC,CAAC;YACvD,CAAC,EAAE,CAAC;QACR,CAAC;aAAM,CAAC;YACJ,GAAG,IAAI,CAAC,CAAC;YAAC,KAAK,GAAG,IAAI,CAAC;YAAC,CAAC,EAAE,CAAC;QAChC,CAAC;IACL,CAAC;IACD,IAAI,KAAK;QAAE,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC;AAChB,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SchemeResult } from "@plurnk/plurnk-schemes";
|
|
2
|
+
import type { PackageAttributions } from "@plurnk/plurnk-meta";
|
|
3
|
+
import type { Notice } from "./Notice.ts";
|
|
2
4
|
export type ChannelState = "active" | "closed" | "errored";
|
|
3
5
|
export interface ChannelDecl {
|
|
4
6
|
mimetype: string;
|
|
@@ -17,14 +19,13 @@ export interface ExecArgs {
|
|
|
17
19
|
signal: AbortSignal;
|
|
18
20
|
write: (channel: string, chunk: string, mimetype?: string) => void;
|
|
19
21
|
setState: (channel: string, state: ChannelState) => void;
|
|
20
|
-
emit: (
|
|
22
|
+
emit: (notice: Notice) => void;
|
|
21
23
|
entry?: (path: string, content: string | null, opts: {
|
|
22
24
|
tags: string[];
|
|
23
25
|
mimetype?: string;
|
|
24
26
|
}) => Promise<string>;
|
|
25
27
|
}
|
|
26
|
-
export interface ExecResult {
|
|
27
|
-
status: number;
|
|
28
|
+
export interface ExecResult extends SchemeResult {
|
|
28
29
|
exitCode?: number;
|
|
29
30
|
}
|
|
30
31
|
export type Effect = "pure" | "read" | "host";
|
|
@@ -50,6 +51,7 @@ export type RuntimesHook = () => RuntimeDecl[] | Promise<RuntimeDecl[]>;
|
|
|
50
51
|
export type ExecRegistry = ReadonlyMap<string, ExecInfo>;
|
|
51
52
|
export interface Discovery {
|
|
52
53
|
registry: ExecRegistry;
|
|
54
|
+
packageAttributions: PackageAttributions;
|
|
53
55
|
skipped: string[];
|
|
54
56
|
disabled: string[];
|
|
55
57
|
}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC/D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAI1C,MAAM,MAAM,YAAY,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAC;AAG3D,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;IAKhB,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IAWnB,MAAM,EAAE,MAAM,GAAG,IAAI,CAAC;IAMtB,GAAG,CAAC,EA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