@voiden/runner 2.1.1 → 2.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/CHANGELOG.md +6 -0
- package/bundled-runners/versions.json +6 -6
- package/bundled-runners/voiden-faker-runner.js +6 -13
- package/dist/discovery.d.ts +11 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +54 -0
- package/dist/discovery.js.map +1 -0
- package/dist/index.js +263 -111
- package/dist/index.js.map +1 -1
- package/dist/lib.d.ts +19 -0
- package/dist/lib.d.ts.map +1 -0
- package/dist/lib.js +19 -0
- package/dist/lib.js.map +1 -0
- package/dist/mcpInstall.d.ts +48 -0
- package/dist/mcpInstall.d.ts.map +1 -0
- package/dist/mcpInstall.js +194 -0
- package/dist/mcpInstall.js.map +1 -0
- package/dist/plugins/registry.d.ts +8 -1
- package/dist/plugins/registry.d.ts.map +1 -1
- package/dist/plugins/registry.js +13 -2
- package/dist/plugins/registry.js.map +1 -1
- package/dist/plugins/store.d.ts +28 -1
- package/dist/plugins/store.d.ts.map +1 -1
- package/dist/plugins/store.js +46 -9
- package/dist/plugins/store.js.map +1 -1
- package/dist/plugins/versionInfo.d.ts +15 -0
- package/dist/plugins/versionInfo.d.ts.map +1 -0
- package/dist/plugins/versionInfo.js +18 -0
- package/dist/plugins/versionInfo.js.map +1 -0
- package/dist/resultBlock.d.ts +31 -0
- package/dist/resultBlock.d.ts.map +1 -0
- package/dist/resultBlock.js +121 -0
- package/dist/resultBlock.js.map +1 -0
- package/dist/runner.d.ts +11 -0
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +61 -2
- package/dist/runner.js.map +1 -1
- package/dist/runtimeVars.js +3 -3
- package/dist/runtimeVars.js.map +1 -1
- package/dist/skillContent.d.ts +8 -0
- package/dist/skillContent.d.ts.map +1 -0
- package/dist/skillContent.js +42 -0
- package/dist/skillContent.js.map +1 -0
- package/package.json +10 -1
package/dist/plugins/registry.js
CHANGED
|
@@ -17,7 +17,7 @@ import { homedir } from 'os';
|
|
|
17
17
|
import { existsSync, statSync, readFileSync } from 'fs';
|
|
18
18
|
import { pathToFileURL } from 'url';
|
|
19
19
|
import { getRegistry } from './registryCache.js';
|
|
20
|
-
import { getInstalledVersion } from './store.js';
|
|
20
|
+
import { getInstalledVersion, isPluginUninstalled } from './store.js';
|
|
21
21
|
// ─── Runner paths (priority: bundled-at-build-time > user cache > download) ───
|
|
22
22
|
const RUNNER_CACHE_DIR = join(homedir(), '.voiden', 'extensions');
|
|
23
23
|
// A failed/interrupted download can leave a 0-byte file behind; treat that as
|
|
@@ -69,14 +69,25 @@ function getBundledVersions() {
|
|
|
69
69
|
export function getBundledVersion(pluginId) {
|
|
70
70
|
return getBundledVersions()[pluginId];
|
|
71
71
|
}
|
|
72
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* The version actually present locally — cached download takes priority over
|
|
74
|
+
* the bundled copy. Returns undefined once explicitly uninstalled, even
|
|
75
|
+
* though a bundled file may still physically exist on disk — uninstalled
|
|
76
|
+
* bundled plugins are treated as unavailable, not just "using the bundled
|
|
77
|
+
* version", so `plugin list`/version checks correctly show "not installed".
|
|
78
|
+
*/
|
|
73
79
|
export function getCoreRunnerVersion(pluginId) {
|
|
80
|
+
if (isPluginUninstalled(pluginId))
|
|
81
|
+
return undefined;
|
|
74
82
|
return getInstalledVersion(pluginId) ?? getBundledVersion(pluginId);
|
|
75
83
|
}
|
|
76
84
|
export function getCoreRunnerPath(pluginId) {
|
|
77
85
|
return join(RUNNER_CACHE_DIR, pluginId, 'runner.js');
|
|
78
86
|
}
|
|
87
|
+
/** False once explicitly uninstalled, even if a bundled or cached file still exists on disk. */
|
|
79
88
|
export function hasCoreRunner(pluginId) {
|
|
89
|
+
if (isPluginUninstalled(pluginId))
|
|
90
|
+
return false;
|
|
80
91
|
return !!getBundledRunnerPath(pluginId) || isValidRunnerFile(getCoreRunnerPath(pluginId));
|
|
81
92
|
}
|
|
82
93
|
export function getCoreRunnerImportUrl(pluginId) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,WAAW,EAAsB,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;
|
|
1
|
+
{"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/plugins/registry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAA;AACnC,OAAO,EAAE,WAAW,EAAsB,MAAM,oBAAoB,CAAA;AACpE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAA;AAErE,iFAAiF;AACjF,MAAM,gBAAgB,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,YAAY,CAAC,CAAA;AAEjE,8EAA8E;AAC9E,iFAAiF;AACjF,SAAS,iBAAiB,CAAC,IAAY;IACrC,IAAI,CAAC;QACH,OAAO,UAAU,CAAC,IAAI,CAAC,IAAI,QAAQ,CAAC,IAAI,CAAC,CAAC,IAAI,GAAG,CAAC,CAAA;IACpD,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,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,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,EAAE;QACd,WAAW,EAAE,KAAK,CAAC,WAAW;QAC9B,IAAI,EAAE,KAAK,CAAC,IAAI;QAChB,WAAW,EAAE,KAAK,CAAC,WAAW,IAAI,GAAG,KAAK,CAAC,EAAE,YAAY;QACzD,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,sBAAsB,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS;KACnF,CAAA;AACH,CAAC;AAED,4EAA4E;AAC5E,MAAM,CAAC,KAAK,UAAU,cAAc;IAClC,MAAM,OAAO,GAAG,MAAM,WAAW,EAAE,CAAA;IACnC,OAAO,OAAO;SACX,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC;SAC/C,GAAG,CAAC,kBAAkB,CAAC,CAAA;AAC5B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAY;IAC3C,MAAM,OAAO,GAAG,MAAM,cAAc,EAAE,CAAA;IACtC,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAA;AAC7C,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,eAAe;IACnC,OAAO,CAAC,MAAM,cAAc,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAA;AACpD,CAAC"}
|
package/dist/plugins/store.d.ts
CHANGED
|
@@ -7,17 +7,44 @@ export interface InstalledPlugin {
|
|
|
7
7
|
installedAt: string;
|
|
8
8
|
/** Runner bundle version that was downloaded — compared against the registry to detect updates */
|
|
9
9
|
version?: string;
|
|
10
|
+
/**
|
|
11
|
+
* True when explicitly removed via `plugin uninstall` — distinct from just
|
|
12
|
+
* being disabled. Needed because core plugins can have a runner file
|
|
13
|
+
* present (bundled, or a leftover cached download) even after uninstall;
|
|
14
|
+
* without this flag there's no way to tell "explicitly uninstalled" apart
|
|
15
|
+
* from "never touched" (which also reads as enabled by default for core
|
|
16
|
+
* plugins — see loader.ts isCorePluginEnabled).
|
|
17
|
+
*/
|
|
18
|
+
uninstalled?: boolean;
|
|
10
19
|
}
|
|
11
20
|
export interface PluginStore {
|
|
12
21
|
installedPlugins: Record<string, InstalledPlugin>;
|
|
13
22
|
}
|
|
14
23
|
export declare const STORE_DIR: string;
|
|
15
24
|
export declare function readStore(): PluginStore;
|
|
25
|
+
/** True only when explicitly uninstalled — never-touched plugins return false. */
|
|
26
|
+
export declare function isPluginUninstalled(name: string): boolean;
|
|
16
27
|
export declare function installPlugin(name: string, version?: string): boolean;
|
|
17
28
|
/** Records the runner bundle version for an installed plugin (used by `plugin update`). */
|
|
18
29
|
export declare function setPluginVersion(name: string, version: string): void;
|
|
30
|
+
/** Returns undefined once explicitly uninstalled, even if a stale version was recorded. */
|
|
19
31
|
export declare function getInstalledVersion(name: string): string | undefined;
|
|
20
|
-
|
|
32
|
+
/**
|
|
33
|
+
* Marks a plugin as explicitly uninstalled — keeps a record (rather than
|
|
34
|
+
* deleting it) so it reads as disabled/unavailable, not "never touched"
|
|
35
|
+
* (which defaults to enabled for core plugins — see loader.ts isCorePluginEnabled).
|
|
36
|
+
*
|
|
37
|
+
* `impliedInstalled` should be true when the caller already knows `name` is a
|
|
38
|
+
* real, currently-active core plugin (bundled) even though it has no store
|
|
39
|
+
* record yet — bundled plugins are enabled by default without ever going
|
|
40
|
+
* through `plugin install`, so "no record" doesn't mean "not installed" the
|
|
41
|
+
* way it does for community plugins. Without this, uninstalling a
|
|
42
|
+
* never-explicitly-touched bundled plugin would report "not installed" and
|
|
43
|
+
* do nothing, even though the plugin is clearly active.
|
|
44
|
+
*
|
|
45
|
+
* Returns true only if the plugin was actually installed/active before this call.
|
|
46
|
+
*/
|
|
47
|
+
export declare function uninstallPlugin(name: string, impliedInstalled?: boolean): boolean;
|
|
21
48
|
export declare function setPluginEnabled(name: string, enabled: boolean): void;
|
|
22
49
|
export declare function getEnabledPlugins(): InstalledPlugin[];
|
|
23
50
|
export declare function getAllInstalledPlugins(): InstalledPlugin[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/plugins/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/plugins/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAMH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,OAAO,CAAA;IAChB,WAAW,EAAE,MAAM,CAAA;IACnB,kGAAkG;IAClG,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;CACtB;AAED,MAAM,WAAW,WAAW;IAC1B,gBAAgB,EAAE,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAA;CAClD;AAED,eAAO,MAAM,SAAS,QAA6B,CAAA;AAOnD,wBAAgB,SAAS,IAAI,WAAW,CAOvC;AAOD,kFAAkF;AAClF,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAkBrE;AAED,2FAA2F;AAC3F,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAcpE;AAED,2FAA2F;AAC3F,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAGpE;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,gBAAgB,UAAQ,GAAG,OAAO,CAc/E;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAarE;AAED,wBAAgB,iBAAiB,IAAI,eAAe,EAAE,CAGrD;AAED,wBAAgB,sBAAsB,IAAI,eAAe,EAAE,CAE1D"}
|
package/dist/plugins/store.js
CHANGED
|
@@ -23,15 +23,24 @@ function writeStore(store) {
|
|
|
23
23
|
mkdirSync(STORE_DIR, { recursive: true });
|
|
24
24
|
writeFileSync(STORE_PATH, JSON.stringify(store, null, 2) + '\n', 'utf-8');
|
|
25
25
|
}
|
|
26
|
+
/** True only when explicitly uninstalled — never-touched plugins return false. */
|
|
27
|
+
export function isPluginUninstalled(name) {
|
|
28
|
+
return !!readStore().installedPlugins[name]?.uninstalled;
|
|
29
|
+
}
|
|
26
30
|
export function installPlugin(name, version) {
|
|
27
31
|
const store = readStore();
|
|
28
|
-
const
|
|
32
|
+
const existing = store.installedPlugins[name];
|
|
33
|
+
// A record marked `uninstalled` doesn't count as "already installed" — this
|
|
34
|
+
// is what lets re-installing a previously-uninstalled plugin actually take
|
|
35
|
+
// effect instead of being treated as a no-op.
|
|
36
|
+
const alreadyInstalled = !!existing && !existing.uninstalled;
|
|
29
37
|
if (!alreadyInstalled) {
|
|
30
38
|
store.installedPlugins[name] = {
|
|
31
39
|
name,
|
|
32
40
|
enabled: true,
|
|
33
|
-
installedAt: new Date().toISOString(),
|
|
41
|
+
installedAt: existing?.installedAt ?? new Date().toISOString(),
|
|
34
42
|
version,
|
|
43
|
+
uninstalled: false,
|
|
35
44
|
};
|
|
36
45
|
writeStore(store);
|
|
37
46
|
}
|
|
@@ -50,19 +59,45 @@ export function setPluginVersion(name, version) {
|
|
|
50
59
|
}
|
|
51
60
|
else {
|
|
52
61
|
store.installedPlugins[name].version = version;
|
|
62
|
+
store.installedPlugins[name].uninstalled = false;
|
|
53
63
|
}
|
|
54
64
|
writeStore(store);
|
|
55
65
|
}
|
|
66
|
+
/** Returns undefined once explicitly uninstalled, even if a stale version was recorded. */
|
|
56
67
|
export function getInstalledVersion(name) {
|
|
57
|
-
|
|
68
|
+
const record = readStore().installedPlugins[name];
|
|
69
|
+
return record?.uninstalled ? undefined : record?.version;
|
|
58
70
|
}
|
|
59
|
-
|
|
71
|
+
/**
|
|
72
|
+
* Marks a plugin as explicitly uninstalled — keeps a record (rather than
|
|
73
|
+
* deleting it) so it reads as disabled/unavailable, not "never touched"
|
|
74
|
+
* (which defaults to enabled for core plugins — see loader.ts isCorePluginEnabled).
|
|
75
|
+
*
|
|
76
|
+
* `impliedInstalled` should be true when the caller already knows `name` is a
|
|
77
|
+
* real, currently-active core plugin (bundled) even though it has no store
|
|
78
|
+
* record yet — bundled plugins are enabled by default without ever going
|
|
79
|
+
* through `plugin install`, so "no record" doesn't mean "not installed" the
|
|
80
|
+
* way it does for community plugins. Without this, uninstalling a
|
|
81
|
+
* never-explicitly-touched bundled plugin would report "not installed" and
|
|
82
|
+
* do nothing, even though the plugin is clearly active.
|
|
83
|
+
*
|
|
84
|
+
* Returns true only if the plugin was actually installed/active before this call.
|
|
85
|
+
*/
|
|
86
|
+
export function uninstallPlugin(name, impliedInstalled = false) {
|
|
60
87
|
const store = readStore();
|
|
61
|
-
|
|
88
|
+
const existing = store.installedPlugins[name];
|
|
89
|
+
const wasInstalled = existing ? !existing.uninstalled : impliedInstalled;
|
|
90
|
+
if (!existing && !impliedInstalled)
|
|
62
91
|
return false;
|
|
63
|
-
|
|
92
|
+
store.installedPlugins[name] = {
|
|
93
|
+
name,
|
|
94
|
+
enabled: false,
|
|
95
|
+
installedAt: existing?.installedAt ?? new Date().toISOString(),
|
|
96
|
+
version: undefined,
|
|
97
|
+
uninstalled: true,
|
|
98
|
+
};
|
|
64
99
|
writeStore(store);
|
|
65
|
-
return
|
|
100
|
+
return wasInstalled;
|
|
66
101
|
}
|
|
67
102
|
export function setPluginEnabled(name, enabled) {
|
|
68
103
|
const store = readStore();
|
|
@@ -75,14 +110,16 @@ export function setPluginEnabled(name, enabled) {
|
|
|
75
110
|
}
|
|
76
111
|
else {
|
|
77
112
|
store.installedPlugins[name].enabled = enabled;
|
|
113
|
+
if (enabled)
|
|
114
|
+
store.installedPlugins[name].uninstalled = false;
|
|
78
115
|
}
|
|
79
116
|
writeStore(store);
|
|
80
117
|
}
|
|
81
118
|
export function getEnabledPlugins() {
|
|
82
119
|
const store = readStore();
|
|
83
|
-
return Object.values(store.installedPlugins).filter(p => p.enabled);
|
|
120
|
+
return Object.values(store.installedPlugins).filter(p => p.enabled && !p.uninstalled);
|
|
84
121
|
}
|
|
85
122
|
export function getAllInstalledPlugins() {
|
|
86
|
-
return Object.values(readStore().installedPlugins);
|
|
123
|
+
return Object.values(readStore().installedPlugins).filter(p => !p.uninstalled);
|
|
87
124
|
}
|
|
88
125
|
//# sourceMappingURL=store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/plugins/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,IAAI,CAAA;
|
|
1
|
+
{"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/plugins/store.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAA;AAC5B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAA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;IAC/B,MAAM,KAAK,GAAG,SAAS,EAAE,CAAA;IACzB,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;AACvF,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAA;AAChF,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installed-plugin lookup for the run-time block-version check (runner.ts).
|
|
3
|
+
* Thin wrapper over the existing core/community plugin state — no new store,
|
|
4
|
+
* just a single call site for "what's installed, and is it enabled" that
|
|
5
|
+
* works for both core and community plugins (both are recorded in the same
|
|
6
|
+
* ~/.voiden/plugins.json store; `isCorePluginEnabled`'s default-true-when-absent
|
|
7
|
+
* behaviour only matters when no version is present either, so it's safe to
|
|
8
|
+
* reuse for community plugins here).
|
|
9
|
+
*/
|
|
10
|
+
export interface InstalledPluginInfo {
|
|
11
|
+
version?: string;
|
|
12
|
+
enabled?: boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare function getInstalledPluginInfo(pluginId: string): InstalledPluginInfo | undefined;
|
|
15
|
+
//# sourceMappingURL=versionInfo.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionInfo.d.ts","sourceRoot":"","sources":["../../src/plugins/versionInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,mBAAmB;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS,CAIxF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Installed-plugin lookup for the run-time block-version check (runner.ts).
|
|
3
|
+
* Thin wrapper over the existing core/community plugin state — no new store,
|
|
4
|
+
* just a single call site for "what's installed, and is it enabled" that
|
|
5
|
+
* works for both core and community plugins (both are recorded in the same
|
|
6
|
+
* ~/.voiden/plugins.json store; `isCorePluginEnabled`'s default-true-when-absent
|
|
7
|
+
* behaviour only matters when no version is present either, so it's safe to
|
|
8
|
+
* reuse for community plugins here).
|
|
9
|
+
*/
|
|
10
|
+
import { getCoreRunnerVersion } from './registry.js';
|
|
11
|
+
import { isCorePluginEnabled } from './loader.js';
|
|
12
|
+
export function getInstalledPluginInfo(pluginId) {
|
|
13
|
+
const version = getCoreRunnerVersion(pluginId);
|
|
14
|
+
if (!version)
|
|
15
|
+
return undefined;
|
|
16
|
+
return { version, enabled: isCorePluginEnabled(pluginId) };
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=versionInfo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"versionInfo.js","sourceRoot":"","sources":["../../src/plugins/versionInfo.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAOjD,MAAM,UAAU,sBAAsB,CAAC,QAAgB;IACrD,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAA;IAC9C,IAAI,CAAC,OAAO;QAAE,OAAO,SAAS,CAAA;IAC9B,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAmB,CAAC,QAAQ,CAAC,EAAE,CAAA;AAC5D,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result write-back — records a request's execution result directly into the
|
|
3
|
+
* .void file it came from, as a new `response` block placed right after the
|
|
4
|
+
* `request` block it belongs to.
|
|
5
|
+
*
|
|
6
|
+
* This is new: voiden-runner has never modified .void files before (see
|
|
7
|
+
* README: "The .void files themselves are never modified"). It exists so an
|
|
8
|
+
* MCP-driven agent can close the loop — write a request, run it, and have the
|
|
9
|
+
* real result recorded in the file instead of only ever seeing console/JSON
|
|
10
|
+
* output.
|
|
11
|
+
*
|
|
12
|
+
* No file locking is used (matches the rest of the codebase — the Electron
|
|
13
|
+
* app's own files:write is a bare fs.writeFile too). If the target file is
|
|
14
|
+
* open with unsaved edits in Voiden at the same time, the next manual save
|
|
15
|
+
* there can silently overwrite this write, or this write can clobber those
|
|
16
|
+
* edits. Callers (the MCP server, the skill) should treat this as a known
|
|
17
|
+
* limitation, not something this function guards against.
|
|
18
|
+
*/
|
|
19
|
+
import type { RunResult } from './types.js';
|
|
20
|
+
/** Build a fenced `response` block's raw text for the given result. */
|
|
21
|
+
export declare function buildResponseBlockText(result: RunResult, requestUid: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Insert or replace the `response` block for `requestUid` in `filePath`.
|
|
24
|
+
* - If a `response` block already exists for this request in the same
|
|
25
|
+
* section (i.e. before the next request-separator, or EOF), it's replaced.
|
|
26
|
+
* - Otherwise the new block is inserted immediately after the request block.
|
|
27
|
+
*
|
|
28
|
+
* Throws if no `request` block with a matching `uid` exists in the file.
|
|
29
|
+
*/
|
|
30
|
+
export declare function upsertResponseBlock(filePath: string, requestUid: string, result: RunResult): void;
|
|
31
|
+
//# sourceMappingURL=resultBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultBlock.d.ts","sourceRoot":"","sources":["../src/resultBlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAKH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AAkD3C,uEAAuE;AACvE,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CA2BpF;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,GAAG,IAAI,CA4BjG"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Result write-back — records a request's execution result directly into the
|
|
3
|
+
* .void file it came from, as a new `response` block placed right after the
|
|
4
|
+
* `request` block it belongs to.
|
|
5
|
+
*
|
|
6
|
+
* This is new: voiden-runner has never modified .void files before (see
|
|
7
|
+
* README: "The .void files themselves are never modified"). It exists so an
|
|
8
|
+
* MCP-driven agent can close the loop — write a request, run it, and have the
|
|
9
|
+
* real result recorded in the file instead of only ever seeing console/JSON
|
|
10
|
+
* output.
|
|
11
|
+
*
|
|
12
|
+
* No file locking is used (matches the rest of the codebase — the Electron
|
|
13
|
+
* app's own files:write is a bare fs.writeFile too). If the target file is
|
|
14
|
+
* open with unsaved edits in Voiden at the same time, the next manual save
|
|
15
|
+
* there can silently overwrite this write, or this write can clobber those
|
|
16
|
+
* edits. Callers (the MCP server, the skill) should treat this as a known
|
|
17
|
+
* limitation, not something this function guards against.
|
|
18
|
+
*/
|
|
19
|
+
import { readFileSync, writeFileSync } from 'fs';
|
|
20
|
+
import { randomUUID } from 'crypto';
|
|
21
|
+
import YAML from 'yaml';
|
|
22
|
+
const MAX_BODY_CHARS = 20_000;
|
|
23
|
+
// Same fence shape as parser.ts's regex, but tracking raw text offsets too
|
|
24
|
+
// (parser.ts only returns parsed Block[], with no position info) since we
|
|
25
|
+
// need to splice the source text rather than just read it.
|
|
26
|
+
const FENCE_RE = /^```void\n([\s\S]*?)^```/gm;
|
|
27
|
+
function scanFences(content) {
|
|
28
|
+
const matches = [];
|
|
29
|
+
const re = new RegExp(FENCE_RE.source, FENCE_RE.flags);
|
|
30
|
+
let m;
|
|
31
|
+
while ((m = re.exec(content)) !== null) {
|
|
32
|
+
const start = m.index;
|
|
33
|
+
const end = start + m[0].length;
|
|
34
|
+
const body = m[1];
|
|
35
|
+
const lines = body.trim().split('\n');
|
|
36
|
+
let type;
|
|
37
|
+
let uid;
|
|
38
|
+
let requestUid;
|
|
39
|
+
if (lines[0]?.trim() === '---') {
|
|
40
|
+
const headerEnd = lines.indexOf('---', 1);
|
|
41
|
+
if (headerEnd !== -1) {
|
|
42
|
+
try {
|
|
43
|
+
const parsed = YAML.parse(lines.slice(1, headerEnd).join('\n'));
|
|
44
|
+
type = parsed?.type;
|
|
45
|
+
uid = parsed?.attrs?.uid;
|
|
46
|
+
requestUid = parsed?.attrs?.requestUid;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
// Malformed fence — treat as opaque (type/uid stay undefined), matching
|
|
50
|
+
// parser.ts's own tolerance for blocks it can't parse.
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
matches.push({ start, end, type, uid, requestUid });
|
|
55
|
+
}
|
|
56
|
+
return matches;
|
|
57
|
+
}
|
|
58
|
+
/** Build a fenced `response` block's raw text for the given result. */
|
|
59
|
+
export function buildResponseBlockText(result, requestUid) {
|
|
60
|
+
let body = result.body;
|
|
61
|
+
let truncated = false;
|
|
62
|
+
if (typeof body === 'string' && body.length > MAX_BODY_CHARS) {
|
|
63
|
+
body = body.slice(0, MAX_BODY_CHARS);
|
|
64
|
+
truncated = true;
|
|
65
|
+
}
|
|
66
|
+
const attrs = {
|
|
67
|
+
uid: randomUUID(),
|
|
68
|
+
requestUid,
|
|
69
|
+
capturedAt: new Date().toISOString(),
|
|
70
|
+
success: result.success,
|
|
71
|
+
};
|
|
72
|
+
if (result.status !== undefined)
|
|
73
|
+
attrs.status = result.status;
|
|
74
|
+
if (result.statusText !== undefined)
|
|
75
|
+
attrs.statusText = result.statusText;
|
|
76
|
+
attrs.durationMs = result.durationMs;
|
|
77
|
+
if (result.size !== undefined)
|
|
78
|
+
attrs.size = result.size;
|
|
79
|
+
if (result.requestHeaders)
|
|
80
|
+
attrs.requestHeaders = result.requestHeaders;
|
|
81
|
+
if (result.requestBody)
|
|
82
|
+
attrs.requestBody = result.requestBody;
|
|
83
|
+
if (result.responseHeaders)
|
|
84
|
+
attrs.responseHeaders = result.responseHeaders;
|
|
85
|
+
if (body !== undefined)
|
|
86
|
+
attrs.body = body;
|
|
87
|
+
if (truncated)
|
|
88
|
+
attrs.truncated = true;
|
|
89
|
+
if (result.error)
|
|
90
|
+
attrs.error = result.error;
|
|
91
|
+
const yamlText = YAML.stringify({ type: 'response', attrs });
|
|
92
|
+
return '```void\n---\n' + yamlText + '---\n```';
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Insert or replace the `response` block for `requestUid` in `filePath`.
|
|
96
|
+
* - If a `response` block already exists for this request in the same
|
|
97
|
+
* section (i.e. before the next request-separator, or EOF), it's replaced.
|
|
98
|
+
* - Otherwise the new block is inserted immediately after the request block.
|
|
99
|
+
*
|
|
100
|
+
* Throws if no `request` block with a matching `uid` exists in the file.
|
|
101
|
+
*/
|
|
102
|
+
export function upsertResponseBlock(filePath, requestUid, result) {
|
|
103
|
+
const content = readFileSync(filePath, 'utf-8');
|
|
104
|
+
const fences = scanFences(content);
|
|
105
|
+
const requestFence = fences.find(f => f.type === 'request' && f.uid === requestUid);
|
|
106
|
+
if (!requestFence) {
|
|
107
|
+
throw new Error(`No request block with uid "${requestUid}" found in ${filePath}`);
|
|
108
|
+
}
|
|
109
|
+
const nextSeparator = fences.find(f => f.type === 'request-separator' && f.start > requestFence.end);
|
|
110
|
+
const sectionEnd = nextSeparator ? nextSeparator.start : content.length;
|
|
111
|
+
const existingResponse = fences.find(f => f.type === 'response'
|
|
112
|
+
&& f.requestUid === requestUid
|
|
113
|
+
&& f.start > requestFence.end
|
|
114
|
+
&& f.start < sectionEnd);
|
|
115
|
+
const blockText = buildResponseBlockText(result, requestUid);
|
|
116
|
+
const newContent = existingResponse
|
|
117
|
+
? content.slice(0, existingResponse.start) + blockText + content.slice(existingResponse.end)
|
|
118
|
+
: content.slice(0, requestFence.end) + '\n\n' + blockText + content.slice(requestFence.end);
|
|
119
|
+
writeFileSync(filePath, newContent, 'utf-8');
|
|
120
|
+
}
|
|
121
|
+
//# sourceMappingURL=resultBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resultBlock.js","sourceRoot":"","sources":["../src/resultBlock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAA;AACnC,OAAO,IAAI,MAAM,MAAM,CAAA;AAGvB,MAAM,cAAc,GAAG,MAAM,CAAA;AAE7B,2EAA2E;AAC3E,0EAA0E;AAC1E,2DAA2D;AAC3D,MAAM,QAAQ,GAAG,4BAA4B,CAAA;AAY7C,SAAS,UAAU,CAAC,OAAe;IACjC,MAAM,OAAO,GAAiB,EAAE,CAAA;IAChC,MAAM,EAAE,GAAG,IAAI,MAAM,CAAC,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,KAAK,CAAC,CAAA;IACtD,IAAI,CAAyB,CAAA;IAC7B,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC;QACvC,MAAM,KAAK,GAAG,CAAC,CAAC,KAAK,CAAA;QACrB,MAAM,GAAG,GAAG,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,MAAM,CAAA;QAC/B,MAAM,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,CAAA;QACjB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAA;QACrC,IAAI,IAAwB,CAAA;QAC5B,IAAI,GAAuB,CAAA;QAC3B,IAAI,UAA8B,CAAA;QAClC,IAAI,KAAK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E,UAAU,EAAE,OAAO,CAAC,CAAA;AAC9C,CAAC"}
|
package/dist/runner.d.ts
CHANGED
|
@@ -16,6 +16,15 @@
|
|
|
16
16
|
* 3. Map PipelineResponse → RunResult
|
|
17
17
|
*/
|
|
18
18
|
import type { RunResult } from './types.js';
|
|
19
|
+
export interface RawRequestInfo {
|
|
20
|
+
url: string;
|
|
21
|
+
method: string;
|
|
22
|
+
headers: Record<string, string>;
|
|
23
|
+
body?: string;
|
|
24
|
+
}
|
|
25
|
+
/** Public alias — lets callers (e.g. the MCP server's list_requests tool) preview
|
|
26
|
+
* a section's method/url without executing anything. */
|
|
27
|
+
export declare function getRequestPreview(blocks: any[]): RawRequestInfo;
|
|
19
28
|
export interface RunOptions {
|
|
20
29
|
env?: Record<string, string>;
|
|
21
30
|
verbose?: boolean;
|
|
@@ -28,6 +37,8 @@ export interface RunOptions {
|
|
|
28
37
|
* when running multiple files.
|
|
29
38
|
*/
|
|
30
39
|
activePlugins?: string[];
|
|
40
|
+
/** Run only the section whose request-separator label matches exactly, instead of every section in the file. */
|
|
41
|
+
sectionLabel?: string;
|
|
31
42
|
}
|
|
32
43
|
export interface SectionResult {
|
|
33
44
|
label?: string;
|
package/dist/runner.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"runner.d.ts","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAYH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAA;AA0D3C,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAM,MAAM,CAAA;IACf,MAAM,EAAG,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAC/B,IAAI,CAAC,EAAI,MAAM,CAAA;CAChB;AAED;yDACyD;AACzD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,cAAc,CAE/D;AA+FD,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAU,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IACpC,OAAO,CAAC,EAAM,OAAO,CAAA;IACrB,WAAW,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IACjC,qGAAqG;IACrG,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,MAAM,EAAE,CAAA;IACxB,gHAAgH;IAChH,YAAY,CAAC,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,CAAA;CAClB;AAED,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAQ,aAAa,EAAE,CAAA;IAC9B,aAAa,EAAE,MAAM,EAAE,CAAA;CACxB;AAED,wBAAsB,WAAW,CAC/B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE,UAAe,GACvB,OAAO,CAAC,aAAa,CAAC,CA8IxB"}
|
package/dist/runner.js
CHANGED
|
@@ -17,11 +17,52 @@
|
|
|
17
17
|
*/
|
|
18
18
|
import { readFileSync } from 'fs';
|
|
19
19
|
import { parseVoidFileSections } from './parser.js';
|
|
20
|
-
import { requestOrchestrator } from '@voiden/executors';
|
|
20
|
+
import { requestOrchestrator, classifyBlockVersion } from '@voiden/executors';
|
|
21
21
|
import { createCliElectron } from './cliElectron.js';
|
|
22
22
|
import { loadEnabledPlugins } from './plugins/loader.js';
|
|
23
|
+
import { getInstalledPluginInfo } from './plugins/versionInfo.js';
|
|
23
24
|
import { normalizeBlocks } from './blockSchemaRegistry.js';
|
|
24
25
|
import { extractRuntimeVarRows, captureRuntimeVars } from './runtimeVars.js';
|
|
26
|
+
// ─── Declared plugin+version check (tagged blocks only — legacy files with no
|
|
27
|
+
// pluginId attr are skipped entirely, unchanged behaviour) ────────────────────
|
|
28
|
+
//
|
|
29
|
+
// Runs before a section is executed. Any non-"ok" status — missing, disabled,
|
|
30
|
+
// or a different version than what saved the block — stops execution with a
|
|
31
|
+
// specific, actionable error instead of the generic "no plugin could build a
|
|
32
|
+
// request" fallback in the shared orchestrator. This is what makes execution
|
|
33
|
+
// deterministic: a file always runs against the exact plugin version it was
|
|
34
|
+
// authored with, never silently against whatever happens to be installed.
|
|
35
|
+
function checkBlockVersions(blocks) {
|
|
36
|
+
for (const block of blocks) {
|
|
37
|
+
const pluginId = block?.attrs?.pluginId;
|
|
38
|
+
const pluginVersion = block?.attrs?.pluginVersion;
|
|
39
|
+
if (!pluginId || !pluginVersion)
|
|
40
|
+
continue;
|
|
41
|
+
const installed = getInstalledPluginInfo(pluginId);
|
|
42
|
+
const status = classifyBlockVersion({ pluginId, pluginVersion, blockType: block.type }, installed);
|
|
43
|
+
if (status === 'ok')
|
|
44
|
+
continue;
|
|
45
|
+
throw new Error(formatVersionError(block.type, pluginId, pluginVersion, status, installed));
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function formatVersionError(blockType, pluginId, pluginVersion, status, installed) {
|
|
49
|
+
switch (status) {
|
|
50
|
+
case 'not-installed':
|
|
51
|
+
return (`Block "${blockType}" requires plugin "${pluginId}" v${pluginVersion}, which is not installed.\n` +
|
|
52
|
+
` Run: voiden-runner plugin install ${pluginId}@${pluginVersion}`);
|
|
53
|
+
case 'disabled':
|
|
54
|
+
return (`Plugin "${pluginId}" is installed but disabled.\n` +
|
|
55
|
+
` Run: voiden-runner plugin enable ${pluginId}`);
|
|
56
|
+
case 'version-mismatch':
|
|
57
|
+
return (`Block "${blockType}" requires ${pluginId} v${pluginVersion}, but v${installed?.version} is installed.\n` +
|
|
58
|
+
` Run: voiden-runner plugin install ${pluginId}@${pluginVersion}`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** Public alias — lets callers (e.g. the MCP server's list_requests tool) preview
|
|
62
|
+
* a section's method/url without executing anything. */
|
|
63
|
+
export function getRequestPreview(blocks) {
|
|
64
|
+
return extractRawRequest(blocks);
|
|
65
|
+
}
|
|
25
66
|
function extractRawRequest(blocks) {
|
|
26
67
|
const req = blocks.find((b) => b.type === 'request');
|
|
27
68
|
let url = '';
|
|
@@ -108,7 +149,24 @@ export async function runVoidFile(filePath, options = {}) {
|
|
|
108
149
|
// Use pre-loaded plugins if provided (multi-file session), otherwise load fresh.
|
|
109
150
|
const activePlugins = options.activePlugins ?? await loadEnabledPlugins(verbose, skipPlugins);
|
|
110
151
|
const content = readFileSync(filePath, 'utf-8');
|
|
111
|
-
const
|
|
152
|
+
const allSections = parseVoidFileSections(content);
|
|
153
|
+
const sections = options.sectionLabel
|
|
154
|
+
? allSections.filter(s => s.label === options.sectionLabel)
|
|
155
|
+
: allSections;
|
|
156
|
+
if (options.sectionLabel && sections.length === 0 && allSections.length > 0) {
|
|
157
|
+
return {
|
|
158
|
+
results: [{
|
|
159
|
+
result: {
|
|
160
|
+
protocol: 'unknown',
|
|
161
|
+
url: '',
|
|
162
|
+
success: false,
|
|
163
|
+
durationMs: 0,
|
|
164
|
+
error: `No section labelled "${options.sectionLabel}" found in ${filePath}`,
|
|
165
|
+
},
|
|
166
|
+
}],
|
|
167
|
+
activePlugins,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
112
170
|
if (sections.length === 0) {
|
|
113
171
|
return {
|
|
114
172
|
results: [{
|
|
@@ -147,6 +205,7 @@ export async function runVoidFile(filePath, options = {}) {
|
|
|
147
205
|
// failed PipelineResponse rather than throwing, so we handle both paths.
|
|
148
206
|
let response;
|
|
149
207
|
try {
|
|
208
|
+
checkBlockVersions(normalizedBlocks);
|
|
150
209
|
response = await requestOrchestrator.executeRequest(editor, ipcAdapter);
|
|
151
210
|
}
|
|
152
211
|
catch (err) {
|
package/dist/runner.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"runner.js","sourceRoot":"","sources":["../src/runner.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAA;AACjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACnD,OAAO,EAAE,mBAAmB,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAA;AAE7E,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAA;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAA;AAC1D,OAAO,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAA;AAI5E,+EAA+E;AAC/E,gFAAgF;AAChF,EAAE;AACF,8EAA8E;AAC9E,4EAA4E;AAC5E,6EAA6E;AAC7E,6EAA6E;AAC7E,4EAA4E;AAC5E,0EAA0E;AAC1E,SAAS,kBAAkB,CAAC,MAAa;IACvC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;QAC3B,MAAM,QAAQ,GAAG,KAAK,EAAE,KAAK,EAAE,QAAQ,CAAA;QACvC,MAAM,aAAa,GAAG,KAAK,EAAE,KAAK,EAAE,aAAa,CAAA;QACjD,IAAI,CAAC,QAAQ,IAAI,CAAC,aAAa;YAAE,SAAQ;QAEzC,MAAM,SA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= /\{\{\s*process\.([^}]+)\s*\}\}/g;
|
|
|
230
230
|
function procReplace(text, vars) {
|
|
231
231
|
if (!text || typeof text !== 'string')
|
|
232
232
|
return text;
|
|
233
|
-
return text.replace(PROCESS_RE, (
|
|
233
|
+
return text.replace(PROCESS_RE, (match, path) => {
|
|
234
234
|
const v = byPath(vars, path.trim());
|
|
235
235
|
return v !== undefined && v !== null
|
|
236
236
|
? (typeof v === 'object' ? JSON.stringify(v) : String(v))
|
|
237
|
-
:
|
|
237
|
+
: match;
|
|
238
238
|
});
|
|
239
239
|
}
|
|
240
240
|
function procReplacePreserve(text, vars) {
|
|
@@ -243,7 +243,7 @@ function procReplacePreserve(text, vars) {
|
|
|
243
243
|
const single = text.trim().match(/^\{\{\s*process\.([^}]+)\s*\}\}$/);
|
|
244
244
|
if (single) {
|
|
245
245
|
const v = byPath(vars, single[1].trim());
|
|
246
|
-
return v !== undefined && v !== null ? v :
|
|
246
|
+
return v !== undefined && v !== null ? v : text;
|
|
247
247
|
}
|
|
248
248
|
return procReplace(text, vars);
|
|
249
249
|
}
|