@usine/agents 0.3.0 → 0.4.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.
Files changed (94) hide show
  1. package/README.md +92 -30
  2. package/dist/child-host/child-host.d.ts +60 -0
  3. package/dist/child-host/child-host.d.ts.map +1 -0
  4. package/dist/child-host/child-host.js +84 -0
  5. package/dist/child-host/child-host.js.map +1 -0
  6. package/dist/child-host/command.d.ts +11 -0
  7. package/dist/child-host/command.d.ts.map +1 -0
  8. package/dist/child-host/command.js +26 -0
  9. package/dist/child-host/command.js.map +1 -0
  10. package/dist/pi/authentication.d.ts +11 -2
  11. package/dist/pi/authentication.d.ts.map +1 -1
  12. package/dist/pi/authentication.js +15 -2
  13. package/dist/pi/authentication.js.map +1 -1
  14. package/dist/pi/children.d.ts +1 -4
  15. package/dist/pi/children.d.ts.map +1 -1
  16. package/dist/pi/children.js +1 -4
  17. package/dist/pi/children.js.map +1 -1
  18. package/dist/pi/claude.d.ts +8 -9
  19. package/dist/pi/claude.d.ts.map +1 -1
  20. package/dist/pi/claude.js +366 -50
  21. package/dist/pi/claude.js.map +1 -1
  22. package/dist/pi/codex/account.d.ts +3 -3
  23. package/dist/pi/codex/account.d.ts.map +1 -1
  24. package/dist/pi/codex/account.js +5 -5
  25. package/dist/pi/codex/account.js.map +1 -1
  26. package/dist/pi/codex/app-server.d.ts +19 -7
  27. package/dist/pi/codex/app-server.d.ts.map +1 -1
  28. package/dist/pi/codex/app-server.js +41 -36
  29. package/dist/pi/codex/app-server.js.map +1 -1
  30. package/dist/pi/codex/codec.d.ts +35 -13
  31. package/dist/pi/codex/codec.d.ts.map +1 -1
  32. package/dist/pi/codex/codec.js +42 -15
  33. package/dist/pi/codex/codec.js.map +1 -1
  34. package/dist/pi/codex/codex.d.ts +0 -1
  35. package/dist/pi/codex/codex.d.ts.map +1 -1
  36. package/dist/pi/codex/codex.js +75 -14
  37. package/dist/pi/codex/codex.js.map +1 -1
  38. package/dist/pi/conversation.d.ts +29 -12
  39. package/dist/pi/conversation.d.ts.map +1 -1
  40. package/dist/pi/conversation.js +54 -18
  41. package/dist/pi/conversation.js.map +1 -1
  42. package/dist/pi/pi.d.ts +1 -4
  43. package/dist/pi/pi.d.ts.map +1 -1
  44. package/dist/pi/pi.js +24 -175
  45. package/dist/pi/pi.js.map +1 -1
  46. package/dist/pi/sdk.d.ts +11 -15
  47. package/dist/pi/sdk.d.ts.map +1 -1
  48. package/dist/pi/sdk.js +35 -53
  49. package/dist/pi/sdk.js.map +1 -1
  50. package/dist/pi/session.d.ts +13 -14
  51. package/dist/pi/session.d.ts.map +1 -1
  52. package/dist/pi/session.js +63 -24
  53. package/dist/pi/session.js.map +1 -1
  54. package/dist/pi/turns.d.ts +7 -7
  55. package/dist/pi/turns.d.ts.map +1 -1
  56. package/dist/pi/turns.js +22 -9
  57. package/dist/pi/turns.js.map +1 -1
  58. package/dist/pi/usage.d.ts +29 -15
  59. package/dist/pi/usage.d.ts.map +1 -1
  60. package/dist/pi/usage.js +48 -24
  61. package/dist/pi/usage.js.map +1 -1
  62. package/dist/preflight/command.d.ts +16 -3
  63. package/dist/preflight/command.d.ts.map +1 -1
  64. package/dist/preflight/command.js +30 -17
  65. package/dist/preflight/command.js.map +1 -1
  66. package/dist/preflight/preflight.d.ts +10 -5
  67. package/dist/preflight/preflight.d.ts.map +1 -1
  68. package/dist/preflight/preflight.js +52 -25
  69. package/dist/preflight/preflight.js.map +1 -1
  70. package/dist/prompt.d.ts +12 -9
  71. package/dist/prompt.d.ts.map +1 -1
  72. package/dist/prompt.js +33 -4
  73. package/dist/prompt.js.map +1 -1
  74. package/dist/protocol/codex.d.ts +4 -7
  75. package/dist/protocol/codex.d.ts.map +1 -1
  76. package/dist/protocol/codex.js +1 -1
  77. package/dist/protocol/codex.js.map +1 -1
  78. package/dist/runtime.d.ts +100 -55
  79. package/dist/runtime.d.ts.map +1 -1
  80. package/dist/runtime.js +108 -27
  81. package/dist/runtime.js.map +1 -1
  82. package/package.json +22 -10
  83. package/dist/pi/live.d.ts +0 -4
  84. package/dist/pi/live.d.ts.map +0 -1
  85. package/dist/pi/live.js +0 -11
  86. package/dist/pi/live.js.map +0 -1
  87. package/dist/pi/subagents.d.ts +0 -29
  88. package/dist/pi/subagents.d.ts.map +0 -1
  89. package/dist/pi/subagents.js +0 -120
  90. package/dist/pi/subagents.js.map +0 -1
  91. package/dist/pi/thinking.d.ts +0 -8
  92. package/dist/pi/thinking.d.ts.map +0 -1
  93. package/dist/pi/thinking.js +0 -15
  94. package/dist/pi/thinking.js.map +0 -1
@@ -1,7 +1,20 @@
1
- import { HarnessUnavailableError } from "@usine/core/agent/capability";
1
+ import type { Harness } from "@usine/core/agent/brain";
2
+ import { HarnessUnavailableError, type HarnessCapability } from "@usine/core/agent/capability";
2
3
  import { Effect } from "effect";
3
4
  import { ChildProcessSpawner } from "effect/unstable/process";
5
+ import type { ChildHost } from "../child-host/child-host.ts";
4
6
  import { SessionOperationError } from "../runtime.ts";
5
- /** Runs a bounded readiness command without retaining its potentially sensitive diagnostics. */
6
- export declare const probeCommand: (harness: "claude" | "codex" | "pi", capability: "binary" | "login" | "version", command: string, args: readonly string[]) => Effect.Effect<string, HarnessUnavailableError | SessionOperationError, ChildProcessSpawner.ChildProcessSpawner>;
7
+ /** Returns the error for a readiness command that exited non-zero; the message includes the command but not its output. */
8
+ export declare const probeFailed: (harness: Harness, capability: HarnessCapability, command: string, args: ReadonlyArray<string>) => HarnessUnavailableError;
9
+ /**
10
+ * Runs a readiness command on `host` with a 30-second timeout and returns its trimmed stdout and
11
+ * exit code; stderr is discarded. If the remote host is unreachable or the command times out, fails
12
+ * with `SessionOperationError`.
13
+ */
14
+ export declare const probeOutput: (host: import("../child-host/child-host.ts").LocalProcess | import("../child-host/child-host.ts").RemoteShell, environment: Readonly<Record<string, string>>, harness: "claude" | "codex" | "pi", capability: "binary" | "login" | "version", command: string, args: readonly string[]) => Effect.Effect<{
15
+ stdout: string;
16
+ exitCode: ChildProcessSpawner.ExitCode;
17
+ }, HarnessUnavailableError | SessionOperationError, ChildProcessSpawner.ChildProcessSpawner>;
18
+ /** Runs a readiness command and returns its trimmed stdout. Fails with `HarnessUnavailableError` if the command exits non-zero. */
19
+ export declare const probeCommand: (host: ChildHost, environment: Readonly<Record<string, string>>, harness: Harness, capability: HarnessCapability, command: string, args: ReadonlyArray<string>) => Effect.Effect<string, HarnessUnavailableError | SessionOperationError, ChildProcessSpawner.ChildProcessSpawner>;
7
20
  //# sourceMappingURL=command.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAA0B,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAgB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAE5E,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAEtD,gGAAgG;AAChG,eAAO,MAAM,YAAY,+OAmDvB,CAAC"}
1
+ {"version":3,"file":"command.d.ts","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,uBAAuB,EAAE,KAAK,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAE7D,OAAO,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAWtD,2HAA2H;AAC3H,eAAO,MAAM,WAAW,YACb,OAAO,cACJ,iBAAiB,WACpB,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,4BAMzB,CAAC;AAEL;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;4FAsDtB,CAAC;AAEH,mIAAmI;AACnI,eAAO,MAAM,YAAY,SACjB,SAAS,eACF,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,WACpC,OAAO,cACJ,iBAAiB,WACpB,MAAM,QACT,aAAa,CAAC,MAAM,CAAC,oHAQ1B,CAAC"}
@@ -1,35 +1,44 @@
1
1
  import { HarnessUnavailableError } from "@usine/core/agent/capability";
2
2
  import { Effect, Option, Stream } from "effect";
3
- import { ChildProcess, ChildProcessSpawner } from "effect/unstable/process";
4
- import { homedir } from "node:os";
3
+ import { ChildProcessSpawner } from "effect/unstable/process";
4
+ import { hostCommand } from "../child-host/command.js";
5
5
  import { SessionOperationError } from "../runtime.js";
6
- /** Runs a bounded readiness command without retaining its potentially sensitive diagnostics. */
7
- export const probeCommand = Effect.fn("HarnessPreflight.command")(function* (harness, capability, command, args) {
8
- yield* Effect.annotateCurrentSpan({ harness, capability });
6
+ /** The exit code OpenSSH returns if it cannot connect or run the remote command. */
7
+ const SSH_FAILURE = 255;
8
+ /** Returns the error for a readiness command that exited non-zero; the message includes the command but not its output. */
9
+ export const probeFailed = (harness, capability, command, args) => new HarnessUnavailableError({
10
+ harness,
11
+ capability,
12
+ message: `${command} ${args.join(" ")} failed. Check the ${harness} installation and login on the worker.`,
13
+ });
14
+ /**
15
+ * Runs a readiness command on `host` with a 30-second timeout and returns its trimmed stdout and
16
+ * exit code; stderr is discarded. If the remote host is unreachable or the command times out, fails
17
+ * with `SessionOperationError`.
18
+ */
19
+ export const probeOutput = Effect.fn("HarnessPreflight.command")(function* (host, environment, harness, capability, command, args) {
20
+ yield* Effect.annotateCurrentSpan({ harness, capability, host: host._tag });
9
21
  const spawner = yield* ChildProcessSpawner.ChildProcessSpawner;
10
22
  return yield* Effect.scoped(Effect.gen(function* () {
11
- const handle = yield* spawner.spawn(ChildProcess.make(command, args, {
12
- cwd: homedir(),
13
- detached: false,
14
- forceKillAfter: "2 seconds",
15
- }));
23
+ const handle = yield* spawner.spawn(hostCommand(host, { environment, command, args }, { detached: false, forceKillAfter: "2 seconds" }));
16
24
  const [stdout, , exitCode] = yield* Effect.all([
17
25
  handle.stdout.pipe(Stream.decodeText(), Stream.mkString),
18
26
  handle.stderr.pipe(Stream.runDrain),
19
27
  handle.exitCode,
20
28
  ], { concurrency: "unbounded" });
21
- if (exitCode !== 0)
22
- return yield* new HarnessUnavailableError({
23
- harness,
24
- capability,
25
- message: `${command} ${args.join(" ")} failed; check the Worker's ${harness} installation and login`,
29
+ if (host._tag === "RemoteShell" && exitCode === SSH_FAILURE)
30
+ return yield* new SessionOperationError({
31
+ operation: "launch",
32
+ sessionId: Option.none(),
33
+ message: `Can't reach ${host.destination} to run ${command}`,
34
+ cause: new Error(`${host.ssh.command} exited with code ${SSH_FAILURE}`),
26
35
  });
27
- return stdout.trim();
36
+ return { stdout: stdout.trim(), exitCode };
28
37
  })).pipe(Effect.timeout("30 seconds"), Effect.catchTags({
29
38
  PlatformError: () => new HarnessUnavailableError({
30
39
  harness,
31
40
  capability,
32
- message: `Worker cannot execute ${command}`,
41
+ message: `The worker can't run ${command}`,
33
42
  }),
34
43
  TimeoutError: (cause) => new SessionOperationError({
35
44
  operation: "launch",
@@ -39,4 +48,8 @@ export const probeCommand = Effect.fn("HarnessPreflight.command")(function* (har
39
48
  }),
40
49
  }));
41
50
  });
51
+ /** Runs a readiness command and returns its trimmed stdout. Fails with `HarnessUnavailableError` if the command exits non-zero. */
52
+ export const probeCommand = (host, environment, harness, capability, command, args) => probeOutput(host, environment, harness, capability, command, args).pipe(Effect.flatMap(({ stdout, exitCode }) => exitCode === 0
53
+ ? Effect.succeed(stdout)
54
+ : Effect.fail(probeFailed(harness, capability, command, args))));
42
55
  //# sourceMappingURL=command.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"command.js","sourceRoot":"","sources":["../../src/preflight/command.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB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,MAAM,EAAE,QAAQ,EAAE,EAAE,EAAE,CACtC,QAAQ,KAAK,CAAC;IACZ,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC;IACxB,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC,CACjE,CACF,CAAC"}
@@ -1,13 +1,18 @@
1
1
  import type { BrainSpec } from "@usine/core/agent/brain";
2
2
  import { HarnessReady, HarnessUnavailableError } from "@usine/core/agent/capability";
3
3
  import { Effect } from "effect";
4
+ import type { ChildHost } from "../child-host/child-host.ts";
4
5
  import { SessionOperationError } from "../runtime.ts";
5
6
  import { CodexAppServer } from "../pi/codex/app-server.ts";
6
7
  import { PiSdk } from "../pi/sdk.ts";
7
- /** Baseline Codex CLI version used by the pinned app-server protocol conformance gate. */
8
+ /** The Codex CLI version of the pinned app-server protocol package used by the conformance check. */
8
9
  export declare const CODEX_CLI_VERSION = "0.144.0";
9
- /** Verifies a rostered brain through supplied process and SDK services; starts no prompt. */
10
- export declare const verifyHarness: (brain: BrainSpec) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner | CodexAppServer | PiSdk>;
11
- /** Checks only the requested brain using the worker user's configuration, without running a prompt or logging in. */
12
- export declare const preflight: (brain: BrainSpec) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner>;
10
+ /**
11
+ * Checks `brain` on `host` without starting a prompt; each check process gets `environment` as its
12
+ * complete local environment, or on top of the remote host's environment (ADR 0011). Fails with
13
+ * `HarnessUnavailableError` for Pi on a remote host.
14
+ */
15
+ export declare const verifyHarness: (brain: BrainSpec, host: import("../child-host/child-host.ts").LocalProcess | import("../child-host/child-host.ts").RemoteShell, environment: Readonly<Record<string, string>>) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner | CodexAppServer | PiSdk>;
16
+ /** Checks only `brain` on `host`, with `environment` and the Worker user's configuration; does not run a prompt or log in. */
17
+ export declare const preflight: (brain: BrainSpec, host: ChildHost, environment: Readonly<Record<string, string>>) => Effect.Effect<HarnessReady, HarnessUnavailableError | SessionOperationError, import("effect/unstable/process/ChildProcessSpawner").ChildProcessSpawner>;
13
18
  //# sourceMappingURL=preflight.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AACrF,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAEhD,OAAO,EAAE,qBAAqB,EAAoB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,cAAc,EAAsB,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAyB,MAAM,cAAc,CAAC;AAG5D,0FAA0F;AAC1F,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAW3C,6FAA6F;AAC7F,eAAO,MAAM,aAAa,wMA4GzB,CAAC;AAEF,qHAAqH;AACrH,eAAO,MAAM,SAAS,UAAW,SAAS,4JACgD,CAAC"}
1
+ {"version":3,"file":"preflight.d.ts","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AACzD,OAAO,EAEL,YAAY,EACZ,uBAAuB,EACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,MAAM,EAAkB,MAAM,QAAQ,CAAC;AAEhD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,qBAAqB,EAAoB,MAAM,eAAe,CAAC;AACxE,OAAO,EAAE,cAAc,EAAsB,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EAAE,KAAK,EAAyB,MAAM,cAAc,CAAC;AAG5D,qGAAqG;AACrG,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAe3C;;;;GAIG;AACH,eAAO,MAAM,aAAa,qWA0IzB,CAAC;AAEF,8HAA8H;AAC9H,eAAO,MAAM,SAAS,UACb,SAAS,QACV,SAAS,eACF,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,4JAK5C,CAAC"}
@@ -1,42 +1,55 @@
1
- import { HarnessReady, HarnessUnavailableError } from "@usine/core/agent/capability";
1
+ import { HarnessReady, HarnessUnavailableError, } from "@usine/core/agent/capability";
2
2
  import { Effect, Option, Schema } from "effect";
3
3
  import { homedir } from "node:os";
4
4
  import { SessionOperationError, WorkingDirectory } from "../runtime.js";
5
5
  import { CodexAppServer, codexAppServerLive } from "../pi/codex/app-server.js";
6
6
  import { initializeCodex, verifyCodexAccount } from "../pi/codex/account.js";
7
7
  import { PiSdk, piSdkLive, usePiStart } from "../pi/sdk.js";
8
- import { probeCommand } from "./command.js";
9
- /** Baseline Codex CLI version used by the pinned app-server protocol conformance gate. */
8
+ import { probeCommand, probeFailed, probeOutput } from "./command.js";
9
+ /** The Codex CLI version of the pinned app-server protocol package used by the conformance check. */
10
10
  export const CODEX_CLI_VERSION = "0.144.0";
11
- // Additional exact builds require generated-type review and the live contracts.
11
+ // Each additional version needs a review of its generated types and a run of the live contracts.
12
12
  const supportedCodexVersions = [CODEX_CLI_VERSION, "0.153.4"];
13
13
  const ClaudeAuthentication = Schema.Struct({
14
14
  loggedIn: Schema.Boolean,
15
15
  authMethod: Schema.String,
16
16
  apiProvider: Schema.String,
17
17
  });
18
- /** Verifies a rostered brain through supplied process and SDK services; starts no prompt. */
19
- export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (brain) {
20
- yield* Effect.annotateCurrentSpan({ harness: brain.harness, model: brain.model });
18
+ const decodeClaudeAuthentication = Schema.decodeUnknownOption(Schema.fromJsonString(ClaudeAuthentication));
19
+ const CLAUDE_AUTH_STATUS = ["auth", "status", "--json"];
20
+ /**
21
+ * Checks `brain` on `host` without starting a prompt; each check process gets `environment` as its
22
+ * complete local environment, or on top of the remote host's environment (ADR 0011). Fails with
23
+ * `HarnessUnavailableError` for Pi on a remote host.
24
+ */
25
+ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (brain, host, environment) {
26
+ yield* Effect.annotateCurrentSpan({
27
+ harness: brain.harness,
28
+ model: brain.model,
29
+ host: host._tag,
30
+ });
21
31
  const loginError = (message) => new HarnessUnavailableError({
22
32
  harness: brain.harness,
23
33
  capability: "login",
24
34
  message,
25
35
  });
36
+ const probe = (capability, command, args) => probeCommand(host, environment, brain.harness, capability, command, args);
26
37
  switch (brain.harness) {
27
38
  case "codex": {
28
- const version = yield* probeCommand("codex", "binary", "codex", ["--version"]);
39
+ const version = yield* probe("binary", "codex", ["--version"]);
29
40
  if (!supportedCodexVersions.some((supported) => version === `codex-cli ${supported}`))
30
41
  return yield* new HarnessUnavailableError({
31
42
  harness: "codex",
32
43
  capability: "version",
33
- message: `Worker has ${/^codex-cli [0-9]+\.[0-9]+\.[0-9]+$/u.test(version) ? version : "an unrecognized Codex version"}; supported Codex CLI versions: ${supportedCodexVersions.join(", ")}`,
44
+ message: `The worker has ${/^codex-cli [0-9]+\.[0-9]+\.[0-9]+$/u.test(version) ? version : "an unrecognized Codex version"}. Install a supported Codex CLI version: ${supportedCodexVersions.join(", ")}.`,
34
45
  });
35
46
  yield* Effect.scoped(Effect.gen(function* () {
36
47
  const server = yield* CodexAppServer;
37
48
  const connection = yield* server.open({
38
49
  cwd: WorkingDirectory.make(homedir()),
39
50
  sessionId: Option.none(),
51
+ environment,
52
+ host,
40
53
  });
41
54
  yield* initializeCodex(connection);
42
55
  yield* verifyCodexAccount(connection, brain.model);
@@ -44,37 +57,50 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
44
57
  break;
45
58
  }
46
59
  case "claude": {
47
- yield* probeCommand("claude", "binary", "claude", ["--version"]);
48
- const response = yield* probeCommand("claude", "login", "claude", [
49
- "auth",
50
- "status",
51
- "--json",
52
- ]);
53
- const auth = yield* Schema.decodeUnknownEffect(Schema.fromJsonString(ClaudeAuthentication))(response).pipe(Effect.mapError(() => loginError("Claude returned an unrecognized login status")));
54
- if (!auth.loggedIn || auth.authMethod !== "claude.ai" || auth.apiProvider !== "firstParty")
55
- return yield* loginError("Claude requires a subscription login; run claude auth login on the Worker");
60
+ yield* probe("binary", "claude", ["--version"]);
61
+ const status = yield* probeOutput(host, environment, "claude", "login", "claude", CLAUDE_AUTH_STATUS);
62
+ // Claude prints the same status and exits 1 when not logged in.
63
+ const auth = status.exitCode === 0 || status.exitCode === 1
64
+ ? decodeClaudeAuthentication(status.stdout)
65
+ : Option.none();
66
+ if (Option.isNone(auth))
67
+ return yield* status.exitCode === 0
68
+ ? loginError("Claude returned an unrecognized login status")
69
+ : probeFailed("claude", "login", "claude", CLAUDE_AUTH_STATUS);
70
+ const { loggedIn, authMethod, apiProvider } = auth.value;
71
+ if (status.exitCode !== 0 ||
72
+ !loggedIn ||
73
+ authMethod !== "claude.ai" ||
74
+ apiProvider !== "firstParty")
75
+ return yield* loginError("Claude Code needs a subscription login. Run claude auth login on the worker.");
56
76
  break;
57
77
  }
58
78
  case "pi": {
59
- // Pi is the SDK installed with this run host, not a separate CLI binary.
79
+ if (host._tag === "RemoteShell")
80
+ return yield* new HarnessUnavailableError({
81
+ harness: "pi",
82
+ capability: "binary",
83
+ message: "Pi children run only on local workers",
84
+ });
85
+ // Pi runs from the SDK installed with this process, not from a CLI binary.
60
86
  const sdk = yield* PiSdk;
61
87
  yield* usePiStart((signal) => sdk.start({
62
88
  cwd: homedir(),
89
+ environment: Option.none(),
63
90
  extensions: [],
64
- model: Option.some(brain.model),
91
+ model: brain.model,
65
92
  signal,
66
93
  thinkingLevel: brain.effort,
67
- toolMode: "repository",
68
94
  }), (cause) => new SessionOperationError({
69
95
  operation: "launch",
70
96
  sessionId: Option.none(),
71
- message: `Pi could not check authentication for ${brain.model}`,
97
+ message: `Can't check Pi authentication for "${brain.model}"`,
72
98
  cause,
73
99
  }), (acquired) => Effect.gen(function* () {
74
100
  const result = acquired.result;
75
101
  yield* Effect.sync(acquired.dispose);
76
102
  if (result._tag !== "Started" || result.pool !== "apiKeys")
77
- return yield* loginError(`Pi child model ${brain.model} requires an available model, supported effort, and API-key authentication`);
103
+ return yield* loginError(`Pi child model "${brain.model}" is unavailable, doesn't support effort ${brain.effort}, or doesn't use an API key`);
78
104
  }));
79
105
  break;
80
106
  }
@@ -82,6 +108,7 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
82
108
  yield* Effect.logInfo("Worker harness verified", {
83
109
  harness: brain.harness,
84
110
  model: brain.model,
111
+ host: host._tag,
85
112
  });
86
113
  return new HarnessReady({ harness: brain.harness });
87
114
  }, (effect, brain) => effect.pipe(Effect.timeout("60 seconds"), Effect.catchTag("TimeoutError", (cause) => new SessionOperationError({
@@ -95,6 +122,6 @@ export const verifyHarness = Effect.fn("HarnessPreflight.verify")(function* (bra
95
122
  errorTag: error._tag,
96
123
  message: error.message,
97
124
  }))));
98
- /** Checks only the requested brain using the worker user's configuration, without running a prompt or logging in. */
99
- export const preflight = (brain) => verifyHarness(brain).pipe(Effect.provide(codexAppServerLive), Effect.provide(piSdkLive));
125
+ /** Checks only `brain` on `host`, with `environment` and the Worker user's configuration; does not run a prompt or log in. */
126
+ export const preflight = (brain, host, environment) => verifyHarness(brain, host, environment).pipe(Effect.provide(codexAppServerLive), Effect.provide(piSdkLive));
100
127
  //# sourceMappingURL=preflight.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"preflight.js","sourceRoot":"","sources":["../../src/preflight/preflight.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAA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ACxB,SAAS,EAAE,QAAQ;IACnB,SAAS,EAAE,MAAM,CAAC,IAAI,EAAE;IACxB,OAAO,EAAE,GAAG,KAAK,CAAC,OAAO,4BAA4B;IACrD,KAAK;CACN,CAAC,CACL,EACD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,MAAM,CAAC,QAAQ,CAAC,iCAAiC,EAAE;IACjD,OAAO,EAAE,KAAK,CAAC,OAAO;IACtB,KAAK,EAAE,KAAK,CAAC,KAAK;IAClB,QAAQ,EAAE,KAAK,CAAC,IAAI;IACpB,OAAO,EAAE,KAAK,CAAC,OAAO;CACvB,CAAC,CACH,CACF,CACJ,CAAC;AAEF,8HAA8H;AAC9H,MAAM,CAAC,MAAM,SAAS,GAAG,CACvB,KAAgB,EAChB,IAAe,EACf,WAA6C,EAC7C,EAAE,CACF,aAAa,CAAC,KAAK,EAAE,IAAI,EAAE,WAAW,CAAC,CAAC,IAAI,CAC1C,MAAM,CAAC,OAAO,CAAC,kBAAkB,CAAC,EAClC,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAC1B,CAAC"}
package/dist/prompt.d.ts CHANGED
@@ -1,26 +1,29 @@
1
- import type { AgentPersona, AgentName } from "@usine/core/agent";
1
+ import { type AgentPersona, type AgentName } from "@usine/core/agent";
2
2
  import type { AttemptTask } from "@usine/core/attempt";
3
+ import type { SalvagePushed } from "@usine/core/attempt/salvage";
3
4
  import type { RepositoryName } from "@usine/core/repository";
4
- import type { Schema } from "effect";
5
- /** The recorded trigger context, Agent instructions, and effective task presented to the parent. */
5
+ import { Option, type Schema } from "effect";
6
+ /** The trigger context, Agent instructions, and task for the parent prompt. */
6
7
  export interface PromptParts {
7
8
  readonly repository: RepositoryName;
8
9
  readonly payload: Schema.Json;
9
10
  readonly agent: AgentName;
10
11
  readonly persona: AgentPersona;
11
12
  readonly task: AttemptTask;
13
+ /** The previous Attempt's salvage checked out in the workspace, if the Run is retrying. */
14
+ readonly resume: Option.Option<SalvagePushed>;
15
+ /** The previous Attempt's salvage that conflicts with the current revision and is not in the workspace. */
16
+ readonly conflictingSalvage: Option.Option<SalvagePushed>;
12
17
  }
13
- /** The Agent's standing instructions and the focused task the parent delegates to a child. */
18
+ /** The Agent instructions and delegated task for a child prompt. */
14
19
  export interface ChildPromptParts {
15
20
  readonly agent: AgentName;
16
21
  readonly persona: AgentPersona;
17
- /** Free text authored by the parent model, not the rendered loop task. */
22
+ /** Free text written by the parent model, not the rendered Loop task. */
18
23
  readonly task: string;
19
24
  }
20
- /** The attribution line every GitHub comment or review written by an Agent ends with. */
21
- export declare const githubSignature: (agent: AgentName) => string;
22
- /** Builds the parent's instructions from the saved payload, effective task, and Agent persona, including GitHub attribution. */
25
+ /** Returns the parent's instructions, including GitHub attribution. */
23
26
  export declare const assemblePrompt: (parts: PromptParts) => string;
24
- /** Builds a child's instructions from the delegated task and Agent persona, including GitHub attribution. */
27
+ /** Returns a child's instructions, including GitHub attribution. */
25
28
  export declare const assembleChildPrompt: (parts: ChildPromptParts) => string;
26
29
  //# sourceMappingURL=prompt.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAErC,oGAAoG;AACpG,MAAM,WAAW,WAAW;IAC1B,QAAQ,CAAC,UAAU,EAAE,cAAc,CAAC;IACpC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC;IAC9B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,Q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AQ,CAAC,kBAAkB,EAAE,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;CAC3D;AAED,oEAAoE;AACpE,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,OAAO,EAAE,YAAY,CAAC;IAC/B,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAqCD,uEAAuE;AACvE,eAAO,MAAM,cAAc,UAAW,WAAW,KAAG,MAuBtC,CAAC;AAEf,oEAAoE;AACpE,eAAO,MAAM,mBAAmB,UAAW,gBAAgB,KAAG,MAahD,CAAC"}
package/dist/prompt.js CHANGED
@@ -1,5 +1,15 @@
1
- /** The attribution line every GitHub comment or review written by an Agent ends with. */
2
- export const githubSignature = (agent) => `— usine agent: ${agent}`;
1
+ import { githubSignature } from "@usine/core/agent";
2
+ import { Option } from "effect";
3
+ import { BLOCKED_MARKER, QUESTION_MARKER } from "./runtime.js";
4
+ const completionInstructions = [
5
+ "# Task completion",
6
+ "",
7
+ "Run gates, tests, and CI watches in the foreground. If a tool starts background work, wait for its result and finish every dependent step before returning your final answer.",
8
+ "Do not end a turn promising to resume after a background notification. Your final answer returns control to the caller and may end the Attempt and remove its worktree. Push all commits that must survive before returning.",
9
+ "A running command or pending CI check is unfinished work, not a blocker. Keep waiting and complete the task. For a genuine blocker, record the exact blocker on the issue or pull request and report which work remains incomplete.",
10
+ `For an unresolved blocker, start your final answer with exactly ${BLOCKED_MARKER} on its own line, followed by the exact blocker and incomplete work. This reserved marker reports a failed Attempt. A child's report that starts with the marker fails the Attempt: return it verbatim as your own final answer. Use an ordinary final answer only after completing the task.`,
11
+ `When the work needs a decision that only the operator can make, post the question on the task's issue or pull request when it has one, then start your final answer with exactly ${QUESTION_MARKER} on its own line, followed by the question and the options you see. This reserved marker ends the Attempt and asks the operator; usine does not run this task again on the same Item until the operator answers or the Item changes. Return a child's report that starts with this marker verbatim as your own final answer.`,
12
+ ];
3
13
  const githubInstructions = (agent) => [
4
14
  "# GitHub identity",
5
15
  "",
@@ -9,11 +19,26 @@ const githubInstructions = (agent) => [
9
19
  "Append this signature to every GitHub comment, issue, pull request, or review you publish:",
10
20
  githubSignature(agent),
11
21
  ];
12
- /** Builds the parent's instructions from the saved payload, effective task, and Agent persona, including GitHub attribution. */
22
+ const resumeLines = (parts) => [
23
+ ...Option.match(parts.resume, {
24
+ onNone: () => [],
25
+ onSome: ({ ref, commit }) => [
26
+ `Resumes from: ${ref} at ${commit}, the previous Attempt's unfinished work, checked out at HEAD. Its last commit is an automatic work-in-progress snapshot. Continue from this state instead of starting over.`,
27
+ ],
28
+ }),
29
+ ...Option.match(parts.conflictingSalvage, {
30
+ onNone: () => [],
31
+ onSome: ({ ref, commit }) => [
32
+ `Previous work: ${ref} at ${commit}, the previous Attempt's unfinished work, conflicts with the current revision, so the checkout starts without it. Fetch that branch to reuse parts of it.`,
33
+ ],
34
+ }),
35
+ ];
36
+ /** Returns the parent's instructions, including GitHub attribution. */
13
37
  export const assemblePrompt = (parts) => [
14
38
  "# Run context",
15
39
  "",
16
40
  `Repository: ${parts.repository}`,
41
+ ...resumeLines(parts),
17
42
  "",
18
43
  "Payload snapshot:",
19
44
  "```json",
@@ -28,9 +53,11 @@ export const assemblePrompt = (parts) => [
28
53
  "",
29
54
  parts.task,
30
55
  "",
56
+ ...completionInstructions,
57
+ "",
31
58
  ...githubInstructions(parts.agent),
32
59
  ].join("\n");
33
- /** Builds a child's instructions from the delegated task and Agent persona, including GitHub attribution. */
60
+ /** Returns a child's instructions, including GitHub attribution. */
34
61
  export const assembleChildPrompt = (parts) => [
35
62
  "# Agent persona",
36
63
  "",
@@ -40,6 +67,8 @@ export const assembleChildPrompt = (parts) => [
40
67
  "",
41
68
  parts.task,
42
69
  "",
70
+ ...completionInstructions,
71
+ "",
43
72
  ...githubInstructions(parts.agent),
44
73
  ].join("\n");
45
74
  //# sourceMappingURL=prompt.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAsBA,yFAAyF;AACzF,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAgB,EAAU,EAAE,CAAC,kBAAkB,KAAK,EAAE,CAAC;AAEvF,MAAM,kBAAkB,GAAG,CAAC,KAAgB,EAAyB,EAAE,CAAC;IACtE,mBAAmB;IACnB,EAAE;IACF,sGAAsG;IACtG,iKAAiK;IACjK,mOAAmO;IACnO,4FAA4F;IAC5F,eAAe,CAAC,KAAK,CAAC;CACvB,CAAC;AAEF,gIAAgI;AAChI,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,KAAkB,EAAU,EAAE,CAC3D;IACE,eAAe;IACf,EAAE;IACF,eAAe,KAAK,CAAC,UAAU,EAAE;IACjC,EAAE;IACF,mBAAmB;IACnB,SAAS;IACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3C,KAAK;IACL,EAAE;IACF,iBAAiB;IACjB,EAAE;IACF,KAAK,CAAC,OAAO;IACb,EAAE;IACF,QAAQ;IACR,EAAE;IACF,KAAK,CAAC,IAAI;IACV,EAAE;IACF,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;CACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEf,6GAA6G;AAC7G,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAuB,EAAU,EAAE,CACrE;IACE,iBAAiB;IACjB,EAAE;IACF,KAAK,CAAC,OAAO;IACb,EAAE;IACF,kBAAkB;IAClB,EAAE;IACF,KAAK,CAAC,IAAI;IACV,EAAE;IACF,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;CACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"prompt.js","sourceRoot":"","sources":["../src/prompt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE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F,mBAAmB;IACnB,SAAS;IACT,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,SAAS,EAAE,CAAC,CAAC;IAC3C,KAAK;IACL,EAAE;IACF,iBAAiB;IACjB,EAAE;IACF,KAAK,CAAC,OAAO;IACb,EAAE;IACF,QAAQ;IACR,EAAE;IACF,KAAK,CAAC,IAAI;IACV,EAAE;IACF,GAAG,sBAAsB;IACzB,EAAE;IACF,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;CACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEf,oEAAoE;AACpE,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,KAAuB,EAAU,EAAE,CACrE;IACE,iBAAiB;IACjB,EAAE;IACF,KAAK,CAAC,OAAO;IACb,EAAE;IACF,kBAAkB;IAClB,EAAE;IACF,KAAK,CAAC,IAAI;IACV,EAAE;IACF,GAAG,sBAAsB;IACzB,EAAE;IACF,GAAG,kBAAkB,CAAC,KAAK,CAAC,KAAK,CAAC;CACnC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC"}
@@ -1,12 +1,9 @@
1
1
  import { Schema } from "effect";
2
2
  /**
3
- * The request shapes usine sends to the Codex app server, restated from
4
- * `@pwrdrvr/codex-app-server-protocol@0.144.0` (codex-cli 0.144.0) because
5
- * that package resolves only under bundler-style resolution.
6
- * This is the baseline protocol. Additional supported CLI builds are verified
7
- * against their generated types and the live steering/interruption contracts.
8
- * `protocol-conformance/check.ts` compiles against the baseline package and fails
9
- * `pnpm check` when these shapes drift.
3
+ * Request types sent to the Codex app server, copied from
4
+ * `@pwrdrvr/codex-app-server-protocol@0.144.0` (codex-cli 0.144.0) because that package resolves
5
+ * only under bundler module resolution. `protocol-conformance/check.ts` fails `pnpm check` if these
6
+ * types drift from the package.
10
7
  */
11
8
  export interface InitializeParams {
12
9
  readonly clientInfo: {
@@ -1 +1 @@
1
- {"version":3,"file":"codex.d.ts","sourceRoot":"","sources":["../../src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AAQ,CAAC,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,GAAG,YAAY,GAAG,WAAW,GAAG,IAAI,CAAC;IACtE,QAAQ,CAAC,aAAa,CAAC,EAAE;QAAE,QAAQ,CAAC,IAAI,EAAE,kBAAkB,CAAA;KAAE,GAAG,IAAI,CAAC;IACtE,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;CAC1C;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB;AAGD,eAAO,MAAM,eAAe;;;;;EAG1B,CAAC;AACH,eAAO,MAAM,cAAc;;EAA4D,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { Schema } from "effect";
2
- // Only authentication mode crosses this boundary; account identity is never logged.
2
+ // Decodes only the authentication type, so account identity is never logged.
3
3
  export const AccountResponse = Schema.Struct({
4
4
  account: Schema.NullOr(Schema.Struct({ type: Schema.String })),
5
5
  requiresOpenaiAuth: Schema.Boolean,
@@ -1 +1 @@
1
- {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/protocol/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAkEhC,oFAAoF;AACpF,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,kBAAkB,EAAE,MAAM,CAAC,OAAO;CACnC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}
1
+ {"version":3,"file":"codex.js","sourceRoot":"","sources":["../../src/protocol/codex.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AA+DhC,6EAA6E;AAC7E,MAAM,CAAC,MAAM,eAAe,GAAG,MAAM,CAAC,MAAM,CAAC;IAC3C,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC;IAC9D,kBAAkB,EAAE,MAAM,CAAC,OAAO;CACnC,CAAC,CAAC;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC"}