runline 0.26.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 +3 -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
|
@@ -243,7 +243,7 @@ export class ExecutionEngine {
|
|
|
243
243
|
logs.push(`[${msg.level}] ${msg.line}`);
|
|
244
244
|
}
|
|
245
245
|
else if (msg.t === "invoke") {
|
|
246
|
-
this.invokeAction(msg.path, msg.args).then((value) => {
|
|
246
|
+
this.invokeAction(msg.path, msg.args, options?.context).then((value) => {
|
|
247
247
|
let serialized;
|
|
248
248
|
try {
|
|
249
249
|
serialized = toPlainJson(value);
|
|
@@ -305,7 +305,7 @@ export class ExecutionEngine {
|
|
|
305
305
|
reply({ t: "run", runId, body });
|
|
306
306
|
});
|
|
307
307
|
}
|
|
308
|
-
async invokeAction(path, rawArgs) {
|
|
308
|
+
async invokeAction(path, rawArgs, context) {
|
|
309
309
|
// A call written with no arguments reaches the action as `{}`, not
|
|
310
310
|
// `undefined`, so plugins can read `input.foo` without guarding.
|
|
311
311
|
const args = normalizeActionInput(rawArgs);
|
|
@@ -317,6 +317,7 @@ export class ExecutionEngine {
|
|
|
317
317
|
const connection = this.resolveConnection(plugin);
|
|
318
318
|
const ctx = {
|
|
319
319
|
connection,
|
|
320
|
+
context,
|
|
320
321
|
log: {
|
|
321
322
|
info: (msg) => console.log(`[${plugin.name}] ${msg}`),
|
|
322
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;
|