runline 0.25.0 → 0.27.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/dist/core/engine.d.ts +2 -0
- package/dist/core/engine.js +13 -2
- package/dist/plugin/types.d.ts +7 -0
- package/dist/sdk.d.ts +2 -0
- package/package.json +1 -1
package/dist/core/engine.d.ts
CHANGED
|
@@ -8,6 +8,8 @@ export interface ExecuteResult {
|
|
|
8
8
|
export interface EngineOptions {
|
|
9
9
|
timeoutMs?: number;
|
|
10
10
|
memoryLimitBytes?: number;
|
|
11
|
+
/** Delivered to every action's `ctx.context` for this run. */
|
|
12
|
+
context?: unknown;
|
|
11
13
|
}
|
|
12
14
|
/**
|
|
13
15
|
* One resolved action call, observed at the engine's dispatch point.
|
package/dist/core/engine.js
CHANGED
|
@@ -161,6 +161,16 @@ export class ExecutionEngine {
|
|
|
161
161
|
try {
|
|
162
162
|
acquired = this.acquire(shape, () => new Worker(buildWorkerSource(pluginNames, helpData), {
|
|
163
163
|
eval: true,
|
|
164
|
+
// Empty by construction: without an `env` option the worker
|
|
165
|
+
// inherits a copy of the host's entire environment, and
|
|
166
|
+
// Runline lives inside credential-bearing hosts (vex's
|
|
167
|
+
// server process, the pi agent process). Bodies hold a real
|
|
168
|
+
// `require` and a live `process`, so an inherited env is one
|
|
169
|
+
// line of agent code away from every host secret. Nothing
|
|
170
|
+
// in the worker needs an environment: actions execute
|
|
171
|
+
// host-side, connection configs are hydrated host-side, and
|
|
172
|
+
// ferrosearch is required by absolute path.
|
|
173
|
+
env: {},
|
|
164
174
|
resourceLimits: { maxOldGenerationSizeMb: memoryLimitMb },
|
|
165
175
|
}));
|
|
166
176
|
}
|
|
@@ -233,7 +243,7 @@ export class ExecutionEngine {
|
|
|
233
243
|
logs.push(`[${msg.level}] ${msg.line}`);
|
|
234
244
|
}
|
|
235
245
|
else if (msg.t === "invoke") {
|
|
236
|
-
this.invokeAction(msg.path, msg.args).then((value) => {
|
|
246
|
+
this.invokeAction(msg.path, msg.args, options?.context).then((value) => {
|
|
237
247
|
let serialized;
|
|
238
248
|
try {
|
|
239
249
|
serialized = toPlainJson(value);
|
|
@@ -295,7 +305,7 @@ export class ExecutionEngine {
|
|
|
295
305
|
reply({ t: "run", runId, body });
|
|
296
306
|
});
|
|
297
307
|
}
|
|
298
|
-
async invokeAction(path, rawArgs) {
|
|
308
|
+
async invokeAction(path, rawArgs, context) {
|
|
299
309
|
// A call written with no arguments reaches the action as `{}`, not
|
|
300
310
|
// `undefined`, so plugins can read `input.foo` without guarding.
|
|
301
311
|
const args = normalizeActionInput(rawArgs);
|
|
@@ -307,6 +317,7 @@ export class ExecutionEngine {
|
|
|
307
317
|
const connection = this.resolveConnection(plugin);
|
|
308
318
|
const ctx = {
|
|
309
319
|
connection,
|
|
320
|
+
context,
|
|
310
321
|
log: {
|
|
311
322
|
info: (msg) => console.log(`[${plugin.name}] ${msg}`),
|
|
312
323
|
warn: (msg) => console.warn(`[${plugin.name}] ${msg}`),
|
package/dist/plugin/types.d.ts
CHANGED
|
@@ -51,6 +51,13 @@ export interface ConnectionConfig {
|
|
|
51
51
|
}
|
|
52
52
|
export interface ActionContext {
|
|
53
53
|
connection: ConnectionConfig;
|
|
54
|
+
/**
|
|
55
|
+
* Opaque per-run value from the embedder's `execute()` options.
|
|
56
|
+
* Host-supplied and invisible to worker code, so actions may
|
|
57
|
+
* derive authority from it (e.g. per-call identity on a shared
|
|
58
|
+
* engine). Absent when the embedder passed none.
|
|
59
|
+
*/
|
|
60
|
+
context?: unknown;
|
|
54
61
|
log: {
|
|
55
62
|
info(msg: string): void;
|
|
56
63
|
warn(msg: string): void;
|
package/dist/sdk.d.ts
CHANGED
|
@@ -24,6 +24,8 @@ export interface RunlineOptions {
|
|
|
24
24
|
export interface RunlineExecuteOptions {
|
|
25
25
|
timeoutMs?: number;
|
|
26
26
|
memoryLimitBytes?: number;
|
|
27
|
+
/** Delivered to every action's `ctx.context` for this run. */
|
|
28
|
+
context?: unknown;
|
|
27
29
|
}
|
|
28
30
|
export declare class Runline {
|
|
29
31
|
private _registry;
|