@alpacakit/agents 0.1.0-beta.31 → 0.1.0-beta.36

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.
Files changed (68) hide show
  1. package/README.md +40 -10
  2. package/dist/agents/claude.d.ts +9 -2
  3. package/dist/agents/claude.d.ts.map +1 -1
  4. package/dist/agents/claude.js +35 -5
  5. package/dist/agents/codex.d.ts +1 -1
  6. package/dist/agents/codex.d.ts.map +1 -1
  7. package/dist/agents/codex.js +19 -1
  8. package/dist/core/error.d.ts +25 -0
  9. package/dist/core/error.d.ts.map +1 -1
  10. package/dist/core/error.js +15 -0
  11. package/dist/core/node-controlled-exec.d.ts.map +1 -1
  12. package/dist/core/node-controlled-exec.js +31 -8
  13. package/dist/core/node-ports.d.ts.map +1 -1
  14. package/dist/core/node-ports.js +20 -0
  15. package/dist/core/ports.d.ts +5 -0
  16. package/dist/core/ports.d.ts.map +1 -1
  17. package/dist/fleet/policy.d.ts.map +1 -1
  18. package/dist/fleet/policy.js +3 -0
  19. package/dist/host/availability.d.ts +56 -0
  20. package/dist/host/availability.d.ts.map +1 -0
  21. package/dist/host/availability.js +177 -0
  22. package/dist/host/command-doctor.d.ts +4 -0
  23. package/dist/host/command-doctor.d.ts.map +1 -0
  24. package/dist/host/command-doctor.js +21 -0
  25. package/dist/index.d.ts +10 -8
  26. package/dist/index.d.ts.map +1 -1
  27. package/dist/index.js +4 -3
  28. package/dist/internal/controlled-process/host-controller.d.ts +3 -2
  29. package/dist/internal/controlled-process/host-controller.d.ts.map +1 -1
  30. package/dist/internal/controlled-process/host-controller.js +63 -23
  31. package/dist/internal/controlled-process/input-transport.d.ts +17 -0
  32. package/dist/internal/controlled-process/input-transport.d.ts.map +1 -0
  33. package/dist/internal/controlled-process/input-transport.js +188 -0
  34. package/dist/internal/controlled-process/lifecycle.d.ts +1 -1
  35. package/dist/internal/controlled-process/lifecycle.d.ts.map +1 -1
  36. package/dist/internal/controlled-process/lifecycle.js +1 -0
  37. package/dist/internal/controlled-process/schema.d.ts +2 -2
  38. package/dist/internal/controlled-process/schema.js +1 -1
  39. package/dist/internal/controlled-process/shim-runtime.d.ts.map +1 -1
  40. package/dist/internal/controlled-process/shim-runtime.js +43 -4
  41. package/dist/internal/controlled-process/supervisor-coordinator.d.ts.map +1 -1
  42. package/dist/internal/controlled-process/supervisor-coordinator.js +4 -2
  43. package/dist/internal/controlled-process/supervisor-model.d.ts +24 -2
  44. package/dist/internal/controlled-process/supervisor-model.d.ts.map +1 -1
  45. package/dist/internal/controlled-process/supervisor-runtime.d.ts.map +1 -1
  46. package/dist/internal/controlled-process/supervisor-runtime.js +116 -15
  47. package/dist/internal/controlled-process/supervisor-schema.d.ts +66 -3
  48. package/dist/internal/controlled-process/supervisor-schema.d.ts.map +1 -1
  49. package/dist/internal/controlled-process/supervisor-schema.js +31 -3
  50. package/dist/internal/controlled-process/supervisor-values.d.ts +5 -0
  51. package/dist/internal/controlled-process/supervisor-values.d.ts.map +1 -1
  52. package/dist/internal/controlled-process/supervisor-values.js +5 -0
  53. package/dist/internal/controlled-process/values.d.ts +4 -4
  54. package/dist/internal/controlled-process/values.js +4 -4
  55. package/dist/kernel/cli-agent.d.ts +3 -0
  56. package/dist/kernel/cli-agent.d.ts.map +1 -1
  57. package/dist/kernel/cli-agent.js +8 -19
  58. package/dist/kernel/definition.d.ts +2 -0
  59. package/dist/kernel/definition.d.ts.map +1 -1
  60. package/dist/kernel/facets.d.ts +5 -0
  61. package/dist/kernel/facets.d.ts.map +1 -1
  62. package/dist/kernel/facets.js +5 -0
  63. package/dist/kernel/runtime.d.ts +2 -1
  64. package/dist/kernel/runtime.d.ts.map +1 -1
  65. package/dist/kernel/runtime.js +4 -1
  66. package/dist/structured/run-structured.d.ts.map +1 -1
  67. package/dist/structured/run-structured.js +2 -5
  68. package/package.json +2 -2
package/README.md CHANGED
@@ -65,6 +65,13 @@ for await (const event of handle.events) {
65
65
  const result = await handle; // await handle === await handle.result
66
66
  ```
67
67
 
68
+ For an isolated Claude Code invocation, construct the adapter with
69
+ `claude({ customizations: "disabled" })`. It passes `--safe-mode`,
70
+ `--strict-mcp-config`, and `--no-session-persistence`, so Claude does not load
71
+ the user's CLAUDE.md, skills, plugins, hooks, MCP servers, or custom commands;
72
+ authentication remains available and the session is not persisted. Plain
73
+ `claude()` keeps the CLI's inherited customization behavior.
74
+
68
75
  ### Controlled child lifecycle
69
76
 
70
77
  Embedding hosts that need durable custody of CLI workers create a
@@ -114,6 +121,21 @@ termination through that controller exactly once. The supervisor owns signal
114
121
  escalation and reports either authenticated absence or a typed unkillable
115
122
  reason, so the runtime never falls back to direct process signaling.
116
123
 
124
+ Prompt bytes use the v2 controlled-process protocol. The bounded control
125
+ frame carries only a UTF-8 byte length and SHA-256 digest; a dedicated data FD
126
+ streams the bytes through the supervisor and shim to worker stdin with
127
+ backpressure. A process is not ready until the shim has verified the exact
128
+ length and digest and worker stdin has closed successfully. The old protocol
129
+ that embedded stdin in the JSON bootstrap is not accepted. Launch transfer
130
+ uses the configured host-idle timeout as its deadline, so a peer that never
131
+ consumes stdin cannot leave the launch pending indefinitely.
132
+
133
+ Launch transport failures throw `AgentError` with code
134
+ `controlled_process_launch`. Its data contains the stable `failureCode`,
135
+ `retryability`, transfer `stage`, and declared/observed byte counts, so hosts
136
+ can route permanent contract failures separately from transient pipe or early
137
+ exit failures without parsing messages.
138
+
117
139
  A naturally completed worker includes its exact `{ code, signal }` as
118
140
  `workerExit`. Abort-driven termination may complete with `workerExit: null`;
119
141
  pre-exec lifecycle failure rejects `spawn` before a process handle is returned.
@@ -144,6 +166,9 @@ const { output } = await runtime.agent("claude").run({
144
166
  `agent.run({ ..., contract })` returns an awaitable handle: `await` it
145
167
  for the result, or iterate `.events` to stream every repair attempt's run
146
168
  events as they happen (`for await (const event of handle.events) …`).
169
+ Default repair attempts send only the invalid block, concise diagnostics, and
170
+ a request for the original required shape; they do not repeat the original
171
+ task or contract text.
147
172
 
148
173
  ## Failover across credentials and agents
149
174
 
@@ -253,19 +278,24 @@ Family-specific conventions (a fixed path env var + a keyring service)
253
278
  belong in the consumer's own convention module, not in this package — they
254
279
  are a plain instance of the same preset shape.
255
280
 
256
- ## Host plane: skills & MCP (operator)
281
+ ## Host plane: execution availability, skills & MCP (operator)
282
+
283
+ Agents expose an optional `agent.availability` facet for ambient execution
284
+ readiness. CLI definitions receive a PATH-only default; Claude and Codex also
285
+ run their vendor authentication-status commands with the bound `HostContext`
286
+ environment unchanged. The result distinguishes runnable, unavailable, and
287
+ indeterminate states and includes definition-owned remediation where relevant.
257
288
 
258
- Agents expose optional `agent.skills` / `agent.mcp` / `agent.doctor`
259
- facets for provisioning and health checks. This surface is still
260
- aspirational: the first slice covers Claude local-dir skills and
261
- Claude / Codex stdio MCP registration; broad inventory and availability
262
- listing are in progress.
289
+ The separate optional `agent.skills` / `agent.mcp` / `agent.doctor` facets
290
+ cover provisioning and health checks. Claude local-dir skills and Claude /
291
+ Codex stdio MCP registration are implemented; broad inventory listing for
292
+ installed skills and MCP servers remains in progress.
263
293
 
264
294
  ## Package entries
265
295
 
266
296
  | Entry | Contents |
267
297
  |---|---|
268
- | `.` | runtime, fleet, structured output, auth materials, guards, errors, and every extension point |
298
+ | `.` | runtime, ambient execution availability, fleet, structured output, auth materials, guards, errors, and every extension point |
269
299
  | `/config` | machine-local profile / agent-settings / fleet-state storage |
270
300
  | `/config/xdg` | XDG Base Directory config-root preset (general apps) |
271
301
  | `/config/extension` | custom agent-config kinds (`defineAgentConfigType`) |
@@ -276,9 +306,9 @@ listing are in progress.
276
306
  ## Status
277
307
 
278
308
  Implemented: kernel (runtime, run handle, guards, classification), CLI
279
- blueprint with built-in `claude()` / `codex()`, structured output with
280
- repair, fleet with cooldown / auth-mark stores, auth materials and secret
281
- resolvers, `openaiCompatible` (engine port; the built-in HTTP
309
+ blueprint with built-in `claude()` / `codex()`, ambient execution availability,
310
+ structured output with repair, fleet with cooldown / auth-mark stores, auth
311
+ materials and secret resolvers, `openaiCompatible` (engine port; the built-in HTTP
282
312
  chat-completions engine is the dependency-free default), and the first
283
313
  host-plane skill / MCP implementations (Claude local-dir skills plus
284
314
  Claude / Codex stdio MCP registration). Not yet implemented: the
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Built-in claude adapter (v1 E1/E2 argv kept verbatim):
2
+ * Built-in claude CLI contract:
3
3
  * `claude -p [--model m] [--effort e] --output-format stream-json
4
4
  * --permission-mode <mode> [tool args] --verbose`, prompt on stdin.
5
5
  * Read-only grants map to `--allowedTools` (`Bash(cmd:*)` for shell
@@ -16,5 +16,12 @@ export declare const CLAUDE_API_KEY_ENV_VAR = "ANTHROPIC_API_KEY";
16
16
  * the same stream format.
17
17
  */
18
18
  export declare function structuredQuotaMatcher(): FailureMatcher;
19
- export declare function claude(): AgentDefinition<"claude">;
19
+ export type ClaudeOptions = {
20
+ /**
21
+ * `disabled` prevents loading user customizations while retaining auth and
22
+ * disables session persistence. The default `inherit` preserves CLI behavior.
23
+ */
24
+ readonly customizations?: "inherit" | "disabled";
25
+ };
26
+ export declare function claude(options?: ClaudeOptions): AgentDefinition<"claude">;
20
27
  //# sourceMappingURL=claude.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/agents/claude.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA6CH,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAC7D,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAwJ1D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,cAAc,CA0CvD;AAoSD,wBAAgB,MAAM,IAAI,eAAe,CAAC,QAAQ,CAAC,CAyDlD"}
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/agents/claude.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8CH,OAAO,EACL,KAAK,cAAc,EAEpB,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,yBAAyB,sBAAsB,CAAC;AAC7D,eAAO,MAAM,sBAAsB,sBAAsB,CAAC;AAsK1D;;;;;GAKG;AACH,wBAAgB,sBAAsB,IAAI,cAAc,CA0CvD;AAoSD,MAAM,MAAM,aAAa,GAAG;IAC1B;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,SAAS,GAAG,UAAU,CAAC;CAClD,CAAC;AAEF,wBAAgB,MAAM,CAAC,OAAO,GAAE,aAAkB,GAAG,eAAe,CAAC,QAAQ,CAAC,CA2E7E"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Built-in claude adapter (v1 E1/E2 argv kept verbatim):
2
+ * Built-in claude CLI contract:
3
3
  * `claude -p [--model m] [--effort e] --output-format stream-json
4
4
  * --permission-mode <mode> [tool args] --verbose`, prompt on stdin.
5
5
  * Read-only grants map to `--allowedTools` (`Bash(cmd:*)` for shell
@@ -15,6 +15,7 @@ import { isErrnoCode } from "../core/fs.js";
15
15
  import { readBoolean, readJsonRecord, readNumber, readRecord, readString, readUnknownRecord, } from "../core/json.js";
16
16
  import { AGENT_EVENT_TYPE } from "../core/run.js";
17
17
  import { TEXT_ENCODING } from "../core/values.js";
18
+ import { cliAvailability } from "../host/availability.js";
18
19
  import { INSTALL_STATUS, MCP_TRANSPORT, SKILL_SOURCE_KIND, } from "../host/capabilities.js";
19
20
  import { withStagedGithubDirectory, } from "../host/github-dir.js";
20
21
  import { listMcpServersViaCli } from "../host/mcp-list.js";
@@ -39,9 +40,13 @@ const CLAUDE = {
39
40
  verbose: "--verbose",
40
41
  tools: "--tools",
41
42
  allowedTools: "--allowedTools",
43
+ safeMode: "--safe-mode",
44
+ strictMcpConfig: "--strict-mcp-config",
45
+ noSessionPersistence: "--no-session-persistence",
42
46
  },
43
47
  auth: {
44
48
  statusArgs: ["auth", "status", "--json"],
49
+ loginArgs: ["auth", "login", "--claudeai"],
45
50
  },
46
51
  mcp: {
47
52
  addJson: "add-json",
@@ -97,13 +102,20 @@ function grantToToolArg(grant) {
97
102
  ? `Bash(${grant.command}:*)`
98
103
  : grant.name;
99
104
  }
100
- function sharedArgs(ctx) {
105
+ function sharedArgs(ctx, customizations) {
101
106
  return [
102
107
  CLAUDE.cli.prompt,
103
108
  ...(ctx.model === null ? [] : [CLAUDE.cli.model, ctx.model]),
104
109
  ...(ctx.effort === null ? [] : [CLAUDE.cli.effort, ctx.effort]),
105
110
  CLAUDE.cli.outputFormat,
106
111
  CLAUDE.cli.streamJson,
112
+ ...(customizations === "disabled"
113
+ ? [
114
+ CLAUDE.cli.safeMode,
115
+ CLAUDE.cli.strictMcpConfig,
116
+ CLAUDE.cli.noSessionPersistence,
117
+ ]
118
+ : []),
107
119
  ];
108
120
  }
109
121
  function parseClaudeLine(line) {
@@ -426,19 +438,20 @@ async function removeClaudeMcp(ctx, name, options) {
426
438
  async function listClaudeMcp(ctx) {
427
439
  return listMcpServersViaCli(ctx, { command: CLAUDE.command });
428
440
  }
429
- export function claude() {
441
+ export function claude(options = {}) {
442
+ const customizations = options.customizations ?? "inherit";
430
443
  return defineCliAgent({
431
444
  id: CLAUDE.id,
432
445
  command: CLAUDE.command,
433
446
  args: {
434
447
  [SANDBOX_MODE.full]: (_sandbox, ctx) => [
435
- ...sharedArgs(ctx),
448
+ ...sharedArgs(ctx, customizations),
436
449
  CLAUDE.cli.permissionMode,
437
450
  CLAUDE.cli.bypassPermissions,
438
451
  CLAUDE.cli.verbose,
439
452
  ],
440
453
  [SANDBOX_MODE.readOnly]: (sandbox, ctx) => [
441
- ...sharedArgs(ctx),
454
+ ...sharedArgs(ctx, customizations),
442
455
  CLAUDE.cli.permissionMode,
443
456
  CLAUDE.cli.defaultPermissionMode,
444
457
  ...(sandbox.grants.length === 0
@@ -455,6 +468,23 @@ export function claude() {
455
468
  classify: [structuredQuotaMatcher()],
456
469
  // F6: Claude CLI can report a structured quota rejection on exit 0.
457
470
  classifyOnSuccess: [structuredQuotaMatcher()],
471
+ availability: cliAvailability({
472
+ command: CLAUDE.command,
473
+ commandMissingRemediation: {
474
+ detail: "Install Claude Code and ensure `claude` is on PATH.",
475
+ command: null,
476
+ },
477
+ authentication: {
478
+ args: CLAUDE.auth.statusArgs,
479
+ remediation: {
480
+ detail: "Sign in to Claude Code.",
481
+ command: {
482
+ executable: CLAUDE.command,
483
+ args: CLAUDE.auth.loginArgs,
484
+ },
485
+ },
486
+ },
487
+ }),
458
488
  auth: {
459
489
  [AUTH_MATERIAL_KIND.homeDir]: homeDirHandler,
460
490
  [AUTH_MATERIAL_KIND.apiKey]: envVarAuthMaterial({
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Built-in codex adapter (v1 E1/E2 argv kept verbatim):
2
+ * Built-in codex CLI contract:
3
3
  * `codex exec [--model m] [-c model_reasoning_effort="e"] --json
4
4
  * --skip-git-repo-check --sandbox <mode> -C <workspace>`, prompt on
5
5
  * stdin. Codex sandboxing is filesystem-level, so read-only grants have
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/agents/codex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAwCH,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AA6GtD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAepD;AAiND,wBAAgB,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC,CAoEhD"}
1
+ {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src/agents/codex.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAyCH,OAAO,EAAE,KAAK,cAAc,EAAqB,MAAM,uBAAuB,CAAC;AAG/E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG/D,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,qBAAqB,mBAAmB,CAAC;AA6GtD;;;;GAIG;AACH,wBAAgB,mBAAmB,IAAI,cAAc,CAepD;AAiND,wBAAgB,KAAK,IAAI,eAAe,CAAC,OAAO,CAAC,CAqFhD"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Built-in codex adapter (v1 E1/E2 argv kept verbatim):
2
+ * Built-in codex CLI contract:
3
3
  * `codex exec [--model m] [-c model_reasoning_effort="e"] --json
4
4
  * --skip-git-repo-check --sandbox <mode> -C <workspace>`, prompt on
5
5
  * stdin. Codex sandboxing is filesystem-level, so read-only grants have
@@ -14,6 +14,7 @@ import { CODEX_APP_SERVER_METHOD } from "../codex/protocol.js";
14
14
  import { AGENT_ERROR_CODE, AgentError, AUTH_FAILURE_REASON, } from "../core/error.js";
15
15
  import { readJsonRecord, readRecord, readString } from "../core/json.js";
16
16
  import { AGENT_EVENT_TYPE } from "../core/run.js";
17
+ import { cliAvailability } from "../host/availability.js";
17
18
  import { INSTALL_STATUS, MCP_SCOPE, MCP_TRANSPORT, SKILL_SOURCE_KIND, } from "../host/capabilities.js";
18
19
  import { runHostCommand } from "../host/run-command.js";
19
20
  import { parseCooldownHint } from "../kernel/classify.js";
@@ -315,6 +316,23 @@ export function codex() {
315
316
  readString(record, CODEX.json.field.type) ===
316
317
  CODEX.json.event.turnCompleted);
317
318
  },
319
+ availability: cliAvailability({
320
+ command: CODEX.command,
321
+ commandMissingRemediation: {
322
+ detail: "Install Codex and ensure `codex` is on PATH.",
323
+ command: null,
324
+ },
325
+ authentication: {
326
+ args: CODEX.auth.statusArgs,
327
+ remediation: {
328
+ detail: "Sign in to Codex.",
329
+ command: {
330
+ executable: CODEX.command,
331
+ args: CODEX.auth.oauthLoginArgs,
332
+ },
333
+ },
334
+ },
335
+ }),
318
336
  auth: {
319
337
  [AUTH_MATERIAL_KIND.homeDir]: envVarAuthMaterial({
320
338
  set: (material) => ({ [CODEX_HOME_ENV_VAR]: material.path }),
@@ -13,6 +13,7 @@ export declare const AGENT_ERROR_CODE: {
13
13
  readonly limit: "limit";
14
14
  readonly cancelled: "cancelled";
15
15
  readonly outputRejected: "output_rejected";
16
+ readonly controlledProcessLaunch: "controlled_process_launch";
16
17
  readonly failed: "failed";
17
18
  };
18
19
  export type AgentErrorCode = (typeof AGENT_ERROR_CODE)[keyof typeof AGENT_ERROR_CODE];
@@ -23,6 +24,7 @@ export declare const AGENT_FAILURE_CLASS: {
23
24
  export type AgentFailureClass = (typeof AGENT_FAILURE_CLASS)[keyof typeof AGENT_FAILURE_CLASS];
24
25
  export declare const AGENT_INFRASTRUCTURE_FAILURE_CODE: {
25
26
  readonly controlledProcessLifecycle: "controlled_process_lifecycle";
27
+ readonly controlledProcessLaunch: "controlled_process_launch";
26
28
  };
27
29
  export type AgentInfrastructureFailureCode = (typeof AGENT_INFRASTRUCTURE_FAILURE_CODE)[keyof typeof AGENT_INFRASTRUCTURE_FAILURE_CODE];
28
30
  export type AgentFailureCode = AgentErrorCode | AgentInfrastructureFailureCode;
@@ -69,6 +71,28 @@ export type Issue = {
69
71
  code: string;
70
72
  message: string;
71
73
  };
74
+ export declare const CONTROLLED_PROCESS_LAUNCH_FAILURE_CODE: {
75
+ readonly inputEarlyEof: "input_early_eof";
76
+ readonly inputOverrun: "input_overrun";
77
+ readonly inputDigestMismatch: "input_digest_mismatch";
78
+ readonly inputWriteFailed: "input_write_failed";
79
+ readonly inputTransferTimeout: "input_transfer_timeout";
80
+ readonly workerExited: "worker_exited_during_launch";
81
+ readonly protocolViolation: "protocol_violation";
82
+ };
83
+ export type ControlledProcessLaunchFailureCode = (typeof CONTROLLED_PROCESS_LAUNCH_FAILURE_CODE)[keyof typeof CONTROLLED_PROCESS_LAUNCH_FAILURE_CODE];
84
+ export declare const CONTROLLED_PROCESS_LAUNCH_FAILURE_RETRYABILITY: {
85
+ readonly permanent: "permanent";
86
+ readonly transient: "transient";
87
+ };
88
+ export type ControlledProcessLaunchFailureRetryability = (typeof CONTROLLED_PROCESS_LAUNCH_FAILURE_RETRYABILITY)[keyof typeof CONTROLLED_PROCESS_LAUNCH_FAILURE_RETRYABILITY];
89
+ export type ControlledProcessLaunchFailureData = {
90
+ readonly failureCode: ControlledProcessLaunchFailureCode;
91
+ readonly retryability: ControlledProcessLaunchFailureRetryability;
92
+ readonly stage: "host_to_supervisor" | "supervisor_to_shim" | "shim_to_worker" | "control_protocol";
93
+ readonly expectedBytes: number | null;
94
+ readonly actualBytes: number | null;
95
+ };
72
96
  export type AgentErrorData = {
73
97
  [AGENT_ERROR_CODE.invalidInput]: {
74
98
  reason: string;
@@ -100,6 +124,7 @@ export type AgentErrorData = {
100
124
  issues: Issue[];
101
125
  attempts: number;
102
126
  };
127
+ [AGENT_ERROR_CODE.controlledProcessLaunch]: ControlledProcessLaunchFailureData;
103
128
  [AGENT_ERROR_CODE.failed]: {
104
129
  exitCode: number | null;
105
130
  stdoutTail: string | null;
@@ -1 +1 @@
1
- {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/core/error.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,eAAO,MAAM,gBAAgB;;;;;;;;;;;CAWnB,CAAC;AAEX,MAAM,MAAM,cAAc,GACxB,CAAC,OAAO,gBAAgB,CAAC,CAAC,MAAM,OAAO,gBAAgB,CAAC,CAAC;AAE3D,eAAO,MAAM,mBAAmB;;;CAGtB,CAAC;AAEX,MAAM,MAAM,iBAAiB,GAC3B,CAAC,OAAO,mBAAmB,CAAC,CAAC,MAAM,OAAO,mBAAmB,CAAC,CAAC;AAEjE,eAAO,MAAM,iCAAiC;;CAEpC,CAAC;AAEX,MAAM,MAAM,8BAA8B,GACxC,CAAC,OAAO,iCAAiC,CAAC,CAAC,MAAM,OAAO,iCAA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EAAE,MAAM,GAAG,IAAI,CAAC;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAE5B,MAAM,CAAC,YAAY,CAAC,CAAC,SAAS,cAAc,EAC1C,WAAW,EAAE,CAAC,GACb,YAAY,CAAC,CAAC,CAAC;IAIlB,MAAM,CAAC,qBAAqB,CAAC,CAAC,SAAS,cAAc,EACnD,WAAW,EAAE,8BAA8B,GAC1C,YAAY,CAAC,CAAC,CAAC;gBAIN,OAAO,EAAE,iBAAiB,CAAC,CAAC,CAAC;CAoB1C;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EACnD,KAAK,EAAE,OAAO,EACd,IAAI,CAAC,EAAE,CAAC,GACP,KAAK,IAAI,UAAU,CAAC,CAAC,CAAC,CAQxB;AAED,0EAA0E;AAC1E,wBAAgB,eAAe,CAAC,CAAC,SAAS,cAAc,EACtD,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,QAAQ,EAAE;IACR,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,OAAO,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;CACpB,GACA,UAAU,CAAC,CAAC,CAAC,CAYf"}
@@ -13,6 +13,7 @@ export const AGENT_ERROR_CODE = {
13
13
  limit: "limit",
14
14
  cancelled: "cancelled",
15
15
  outputRejected: "output_rejected",
16
+ controlledProcessLaunch: "controlled_process_launch",
16
17
  failed: "failed",
17
18
  };
18
19
  export const AGENT_FAILURE_CLASS = {
@@ -21,6 +22,7 @@ export const AGENT_FAILURE_CLASS = {
21
22
  };
22
23
  export const AGENT_INFRASTRUCTURE_FAILURE_CODE = {
23
24
  controlledProcessLifecycle: "controlled_process_lifecycle",
25
+ controlledProcessLaunch: "controlled_process_launch",
24
26
  };
25
27
  export function agentFailure(failureCode) {
26
28
  return {
@@ -56,6 +58,19 @@ export const TIMEOUT_KIND = {
56
58
  total: "total",
57
59
  idle: "idle",
58
60
  };
61
+ export const CONTROLLED_PROCESS_LAUNCH_FAILURE_CODE = {
62
+ inputEarlyEof: "input_early_eof",
63
+ inputOverrun: "input_overrun",
64
+ inputDigestMismatch: "input_digest_mismatch",
65
+ inputWriteFailed: "input_write_failed",
66
+ inputTransferTimeout: "input_transfer_timeout",
67
+ workerExited: "worker_exited_during_launch",
68
+ protocolViolation: "protocol_violation",
69
+ };
70
+ export const CONTROLLED_PROCESS_LAUNCH_FAILURE_RETRYABILITY = {
71
+ permanent: "permanent",
72
+ transient: "transient",
73
+ };
59
74
  const AGENT_ERROR_BRAND = Symbol.for("@alpacakit/agents.AgentError");
60
75
  export class AgentError extends Error {
61
76
  code;
@@ -1 +1 @@
1
- {"version":3,"file":"node-controlled-exec.d.ts","sourceRoot":"","sources":["../../src/core/node-controlled-exec.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAajC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CA0BhB"}
1
+ {"version":3,"file":"node-controlled-exec.d.ts","sourceRoot":"","sources":["../../src/core/node-controlled-exec.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EACV,cAAc,EACd,qBAAqB,EACtB,MAAM,yBAAyB,CAAC;AAmBjC,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,qBAAqB,GAC7B,cAAc,CAgDhB"}
@@ -1,5 +1,7 @@
1
1
  import path from "node:path";
2
2
  import { launchControlledProcess, recoverControlledProcess, } from "../internal/controlled-process/host-controller.js";
3
+ import { ControlledProcessLaunchError } from "../internal/controlled-process/input-transport.js";
4
+ import { AGENT_ERROR_CODE, AGENT_INFRASTRUCTURE_FAILURE_CODE, AgentError, infrastructureFailure, } from "./error.js";
3
5
  import { withNodeBinFirst } from "./node-ports.js";
4
6
  const PACKAGE_ROOT = path.resolve(import.meta.dirname, "../..");
5
7
  const SUPERVISOR_ENTRY_PATH = path.join(PACKAGE_ROOT, "dist/internal/controlled-process/supervisor-entry.js");
@@ -7,14 +9,35 @@ const SHIM_ENTRY_PATH = path.join(PACKAGE_ROOT, "dist/internal/controlled-proces
7
9
  export function createControlledExec(options) {
8
10
  return {
9
11
  spawn: async (worker, lifecycle) => {
10
- const process = await launchControlledProcess({
11
- supervisorEntryPath: SUPERVISOR_ENTRY_PATH,
12
- shimEntryPath: SHIM_ENTRY_PATH,
13
- runtimeDirectory: options.runtimeDirectory,
14
- worker: { ...worker, env: withNodeBinFirst(worker.env) },
15
- timing: options.termination,
16
- lifecycle,
17
- });
12
+ let process;
13
+ try {
14
+ process = await launchControlledProcess({
15
+ supervisorEntryPath: SUPERVISOR_ENTRY_PATH,
16
+ shimEntryPath: SHIM_ENTRY_PATH,
17
+ runtimeDirectory: options.runtimeDirectory,
18
+ worker: { ...worker, env: withNodeBinFirst(worker.env) },
19
+ timing: options.termination,
20
+ lifecycle,
21
+ });
22
+ }
23
+ catch (error) {
24
+ if (!(error instanceof ControlledProcessLaunchError)) {
25
+ throw error;
26
+ }
27
+ throw new AgentError({
28
+ code: AGENT_ERROR_CODE.controlledProcessLaunch,
29
+ classification: infrastructureFailure(AGENT_INFRASTRUCTURE_FAILURE_CODE.controlledProcessLaunch),
30
+ message: error.message,
31
+ data: {
32
+ failureCode: error.failure.code,
33
+ retryability: error.failure.retryability,
34
+ stage: error.failure.stage,
35
+ expectedBytes: error.failure.expectedBytes,
36
+ actualBytes: error.failure.actualBytes,
37
+ },
38
+ cause: error,
39
+ });
40
+ }
18
41
  return {
19
42
  chunks: process.chunks,
20
43
  completion: process.completion,
@@ -1 +1 @@
1
- {"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../src/core/node-ports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,KAAK,EACL,IAAI,EAIJ,UAAU,EAGX,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,WAAW,EAAE,KAOzB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAEvB,CAAC;AAoBF,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AAyGD,eAAO,MAAM,QAAQ,EAAE,IAGtB,CAAC"}
1
+ {"version":3,"file":"node-ports.d.ts","sourceRoot":"","sources":["../../src/core/node-ports.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EACV,KAAK,EACL,IAAI,EAIJ,UAAU,EAGX,MAAM,YAAY,CAAC;AAOpB,eAAO,MAAM,WAAW,EAAE,KAOzB,CAAC;AAEF,eAAO,MAAM,SAAS,EAAE,UAEvB,CAAC;AAoBF,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC1B,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAUxB;AA+HD,eAAO,MAAM,QAAQ,EAAE,IAGtB,CAAC"}
@@ -49,8 +49,12 @@ export function withNodeBinFirst(env) {
49
49
  return { ...env, [key]: [nodeBinDir, ...rest].join(path.delimiter) };
50
50
  }
51
51
  function spawnProcess(options) {
52
+ if (options.processGroup === true && process.platform === "win32") {
53
+ throw new Error("Process-group execution is not supported on Windows.");
54
+ }
52
55
  const child = spawn(options.command, options.args, {
53
56
  cwd: options.cwd,
57
+ detached: options.processGroup === true,
54
58
  env: withNodeBinFirst(options.env),
55
59
  stdio: ["pipe", "pipe", "pipe"],
56
60
  });
@@ -103,11 +107,27 @@ function spawnProcess(options) {
103
107
  child.stdin.end();
104
108
  },
105
109
  kill: (signal) => {
110
+ if (options.processGroup === true && child.pid !== undefined) {
111
+ try {
112
+ process.kill(-child.pid, signal);
113
+ }
114
+ catch (error) {
115
+ if (!isErrnoCode(error, "ESRCH")) {
116
+ throw error;
117
+ }
118
+ }
119
+ return;
120
+ }
106
121
  child.kill(signal);
107
122
  },
108
123
  awaitTerminationEscalation: () => termination,
109
124
  };
110
125
  }
126
+ function isErrnoCode(error, code) {
127
+ return (error instanceof Error &&
128
+ "code" in error &&
129
+ error.code === code);
130
+ }
111
131
  function isExecutable(candidate) {
112
132
  return new Promise((resolve) => {
113
133
  access(candidate, constants.X_OK, (error) => {
@@ -23,6 +23,11 @@ export type ExecSpawnOptions = {
23
23
  cwd: string;
24
24
  env: Record<string, string>;
25
25
  stdin: string | null;
26
+ /**
27
+ * Start an independent process group and signal that group from kill().
28
+ * The built-in Node adapter rejects this option on Windows.
29
+ */
30
+ processGroup?: boolean;
26
31
  };
27
32
  /** Interactive spawn: stdin stays open for incremental writes. */
28
33
  export type InteractiveExecSpawnOptions = ExecSpawnOptions & {
@@ -1 +1 @@
1
- {"version":3,"file":"ports.d.ts","sourceRoot":"","sources":["../../src/core/ports.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,KAAK,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEhE,YAAY,EACV,KAAK,EACL,UAAU,EACV,cAAc,EACd,eAAe,GAChB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,SAAS,GAAG;IAAE,OAAO,EAAE,aAAa,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjE,MAAM,MAAM,QAAQ,GAAG;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AAEtE,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,E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AC,SAAS,CACzE,CAAC;AAEF,MAAM,MAAM,aAAa,GAAG,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,CAAC;AAE9D,yEAAyE;AACzE,eAAO,MAAM,yBAAyB,UAAY,CAAC;AACnD,eAAO,MAAM,4BAA4B,SAAU,CAAC;AAEpD,eAAO,MAAM,oBAAoB,EAAE,aAoBlC,CAAC;AAEF,wBAAgB,oBAAoB,CAClC,SAAS,EAAE,OAAO,CAAC,aAAa,CAAC,GAAG,SAAS,GAC5C,aAAa,CAEf"}
@@ -44,6 +44,9 @@ export const defaultFailurePolicy = {
44
44
  [AGENT_ERROR_CODE.limit]: { kind: FAILURE_ACTION_KIND.terminal },
45
45
  [AGENT_ERROR_CODE.failed]: { kind: FAILURE_ACTION_KIND.terminal },
46
46
  [AGENT_ERROR_CODE.outputRejected]: { kind: FAILURE_ACTION_KIND.terminal },
47
+ [AGENT_ERROR_CODE.controlledProcessLaunch]: {
48
+ kind: FAILURE_ACTION_KIND.terminal,
49
+ },
47
50
  };
48
51
  export function resolveFailurePolicy(overrides) {
49
52
  return { ...defaultFailurePolicy, ...overrides };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Agent execution availability (ambient, not profile-bound). Definitions own
3
+ * vendor-specific probes and remediation; the runtime only binds HostContext.
4
+ */
5
+ import type { HostContext } from "./context.js";
6
+ export declare const AGENT_AVAILABILITY_STATUS: {
7
+ readonly runnable: "runnable";
8
+ readonly unavailable: "unavailable";
9
+ readonly indeterminate: "indeterminate";
10
+ };
11
+ export declare const AGENT_UNAVAILABLE_REASON: {
12
+ readonly commandMissing: "command_missing";
13
+ readonly authenticationRequired: "authentication_required";
14
+ };
15
+ export declare const AGENT_INDETERMINATE_REASON: {
16
+ readonly probeTimeout: "probe_timeout";
17
+ readonly probeFault: "probe_fault";
18
+ };
19
+ export type AgentRemediation = {
20
+ readonly detail: string;
21
+ readonly command: {
22
+ readonly executable: string;
23
+ readonly args: readonly string[];
24
+ } | null;
25
+ };
26
+ export type AgentAvailability = {
27
+ readonly status: typeof AGENT_AVAILABILITY_STATUS.runnable;
28
+ } | {
29
+ readonly status: typeof AGENT_AVAILABILITY_STATUS.unavailable;
30
+ readonly reason: typeof AGENT_UNAVAILABLE_REASON.commandMissing | typeof AGENT_UNAVAILABLE_REASON.authenticationRequired;
31
+ readonly remediation: AgentRemediation | null;
32
+ } | {
33
+ readonly status: typeof AGENT_AVAILABILITY_STATUS.indeterminate;
34
+ readonly reason: typeof AGENT_INDETERMINATE_REASON.probeTimeout | typeof AGENT_INDETERMINATE_REASON.probeFault;
35
+ readonly detail: string;
36
+ };
37
+ export interface AgentAvailabilityCapability {
38
+ probe(ctx: HostContext): Promise<AgentAvailability>;
39
+ }
40
+ /** The single bounded default for CLI availability subprocesses. */
41
+ export declare const DEFAULT_AGENT_AVAILABILITY_PROBE_TIMEOUT_MS = 30000;
42
+ export type CliAvailabilityOptions = {
43
+ readonly command: string;
44
+ readonly commandMissingRemediation: AgentRemediation | null;
45
+ readonly authentication?: {
46
+ readonly args: readonly string[];
47
+ readonly remediation: AgentRemediation | null;
48
+ };
49
+ readonly timeoutMs?: number;
50
+ };
51
+ /**
52
+ * Build a CLI definition-side availability capability. With no
53
+ * authentication command this is the generic PATH-only default.
54
+ */
55
+ export declare function cliAvailability(options: CliAvailabilityOptions): AgentAvailabilityCapability;
56
+ //# sourceMappingURL=availability.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"availability.d.ts","sourceRoot":"","sources":["../../src/host/availability.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAEhD,eAAO,MAAM,yBAAyB;;;;CAI5B,CAAC;AAEX,eAAO,MAAM,wBAAwB;;;CAG3B,CAAC;AAEX,eAAO,MAAM,0BAA0B;;;CAG7B,CAAC;AAEX,MAAM,MAAM,gBAAgB,GAAG;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAA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