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.
@@ -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.
@@ -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}`),
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "runline",
3
- "version": "0.26.0",
3
+ "version": "0.27.0",
4
4
  "description": "Code mode for agents \u2014 turn any API or command into a callable action",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",