@agentsmarket/pipeline-runtime 0.5.5 → 0.5.6

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.
@@ -33,11 +33,19 @@ export interface PipelineCapabilities {
33
33
  has_composition: boolean;
34
34
  has_when: boolean;
35
35
  has_retry: boolean;
36
- capabilities_schema_version: 1;
36
+ /**
37
+ * The pipeline runs commands on the machine that executes it. A buyer must
38
+ * see this BEFORE buying: on their own machine those commands touch their
39
+ * tokens, their secrets and their network.
40
+ */
41
+ has_shell: boolean;
42
+ capabilities_schema_version: 2;
37
43
  }
38
44
  export interface PipelineStageLikeForCaps {
39
45
  id?: string;
40
46
  provider?: string;
47
+ /** A shell stage runs a command on the machine that executes the pipeline. */
48
+ shell?: unknown;
41
49
  uses?: unknown;
42
50
  working_dir?: string;
43
51
  output_format?: string;
@@ -36,9 +36,19 @@ export function analyzeCapabilities(spec) {
36
36
  has_composition: deriveHasComposition(stages),
37
37
  has_when: deriveHasWhen(stages),
38
38
  has_retry: deriveHasRetry(stages),
39
- capabilities_schema_version: 1,
39
+ has_shell: deriveHasShell(stages),
40
+ capabilities_schema_version: 2,
40
41
  };
41
42
  }
43
+ /** A stage with a `shell:` runs a command — where it runs is the host's problem. */
44
+ function deriveHasShell(stages) {
45
+ return stages.some((s) => {
46
+ const shell = s.shell;
47
+ if (typeof shell === 'string')
48
+ return shell.trim().length > 0;
49
+ return shell !== undefined && shell !== null;
50
+ });
51
+ }
42
52
  function deriveNetwork(stages) {
43
53
  let hasLLM = false;
44
54
  let hasSkill = false;
@@ -5,10 +5,12 @@
5
5
  * Useful for: running tests, linting, formatting, refactoring tools that
6
6
  * live on the local machine.
7
7
  *
8
- * **Server-side is REJECTED.** Cloudflare Workers cannot spawn child
9
- * processes. A pipeline with shell stages works only via `pipeline call
10
- * --local`. The server explicitly throws `ShellStageUnsupportedError` so
11
- * the user gets a clear 400 instead of a confusing 500.
8
+ * **Hosts that cannot spawn are REJECTED by their executor.** Cloudflare
9
+ * Workers have no child processes, so the server supplies a
10
+ * `ThrowingShellExecutor` whose reason says so. The runtime only asks
11
+ * whether an executor exists — whether it can actually run the command is the
12
+ * executor's own answer, which is what lets a sandboxed server work without a
13
+ * change here.
12
14
  *
13
15
  * **Execution model:**
14
16
  * - `spawn(cmd, args, { shell: false })` — no shell interpretation, args
@@ -5,10 +5,12 @@
5
5
  * Useful for: running tests, linting, formatting, refactoring tools that
6
6
  * live on the local machine.
7
7
  *
8
- * **Server-side is REJECTED.** Cloudflare Workers cannot spawn child
9
- * processes. A pipeline with shell stages works only via `pipeline call
10
- * --local`. The server explicitly throws `ShellStageUnsupportedError` so
11
- * the user gets a clear 400 instead of a confusing 500.
8
+ * **Hosts that cannot spawn are REJECTED by their executor.** Cloudflare
9
+ * Workers have no child processes, so the server supplies a
10
+ * `ThrowingShellExecutor` whose reason says so. The runtime only asks
11
+ * whether an executor exists — whether it can actually run the command is the
12
+ * executor's own answer, which is what lets a sandboxed server work without a
13
+ * change here.
12
14
  *
13
15
  * **Execution model:**
14
16
  * - `spawn(cmd, args, { shell: false })` — no shell interpretation, args
package/dist/stages.js CHANGED
@@ -472,12 +472,13 @@ correctionHint) {
472
472
  throw new StageBadConfigError(`Stage '${stage.id}' requires one of: 'shell' (shell stage, CLI --local only), 'uses' (skill stage), 'model'+'prompt' (LLM stage), 'loop' (M6.2 iterative executor), or just 'prompt' with default model`);
473
473
  }
474
474
  if (hasShell) {
475
+ // Whether this environment can spawn processes is the executor's call, not
476
+ // the runtime's: only the executor knows if it lives behind a sandbox. A
477
+ // host with no shell capability supplies `ThrowingShellExecutor` and gets
478
+ // the same clear error with its own reason.
475
479
  if (!deps.shellExecutor) {
476
480
  throw new ShellStageUnsupportedError(stage.id, 'no shell executor is configured for this run');
477
481
  }
478
- if (!deps.isLocal) {
479
- throw new ShellStageUnsupportedError(stage.id, 'shell stages require CLI invocation with --local; the server cannot spawn child processes');
480
- }
481
482
  const spec = normalizeShellStage(stage.shell);
482
483
  if (!spec) {
483
484
  throw new StageBadConfigError(`Stage '${stage.id}' has a malformed 'shell' spec (expected string or { cmd, args?, cwd?, timeout_ms? })`);
@@ -513,6 +514,13 @@ correctionHint) {
513
514
  if (e instanceof ShellStageTimeoutError) {
514
515
  throw new StageBadConfigError(`Stage '${stage.id}' ${e.message}`);
515
516
  }
517
+ // The executor may not know which stage it was called for — it is handed
518
+ // a command, not a stage. The runtime does know, so the stage id is
519
+ // filled in here: an error that says "<unknown>" tells the reader
520
+ // nothing about which stage to look at.
521
+ if (e instanceof ShellStageUnsupportedError && e.stageId === '<unknown>') {
522
+ throw new ShellStageUnsupportedError(stage.id, e.reason);
523
+ }
516
524
  throw e;
517
525
  }
518
526
  finally {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsmarket/pipeline-runtime",
3
- "version": "0.5.5",
3
+ "version": "0.5.6",
4
4
  "description": "Runtime for executing PIPELINE.md workflows (multi-skill orchestration). Provider-agnostic (MiniMax, Claude, OpenAI).",
5
5
  "license": "MIT",
6
6
  "type": "module",