@maiaos/cli 0.1.0-canary.11 → 0.1.0-canary.13

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.
@@ -17,12 +17,15 @@ const probePayloads = (dependencies) => Effect.all([
17
17
  probe(dependencies.loadAgent, (module) => typeof module.runMaiaAgent === "function"),
18
18
  ]).pipe(Effect.map(([cliPayload, agent]) => ({ agent, cliPayload })));
19
19
  const formatInstallation = (checks) => `Maia doctor failed\n${checks
20
- .map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed; next: reinstall Maia"}`)
20
+ .map((check) => ` ${check.code} (this machine): ${check.ok ? "ok" : "failed; next: reinstall Maia"}`)
21
21
  .join("\n")}\n`;
22
22
  const writeInstallationFailure = (output) => {
23
23
  const { arguments_, checks, input } = output;
24
24
  const result = {
25
- checks: checks.map((check) => check.ok ? check : { ...check, next: "reinstall Maia" }),
25
+ checks: checks.map((check) => ({
26
+ ...(check.ok ? check : { ...check, next: "reinstall Maia" }),
27
+ scope: "machine",
28
+ })),
26
29
  command: "doctor",
27
30
  ok: false,
28
31
  version: input.version,
package/dist/cli/cli.d.ts CHANGED
@@ -2,6 +2,7 @@ import * as Effect from "effect/Effect";
2
2
  import type * as Scope from "effect/Scope";
3
3
  import { type CliDependencies, type CliIo } from "../command-line/index.js";
4
4
  import type { CliNodeConnector } from "../local-node/index.js";
5
+ import type { SshLayer } from "../remote-node/index.js";
5
6
  export type { CliDependencies, CliErrorOutput, CliIo, CliSuccessOutput, CliSuccessResult, } from "../command-line/index.js";
6
7
  export type { CliHelpResult, CliVersionResult } from "../command-tree/index.js";
7
8
  export type { CliStatusResult } from "../status/index.js";
@@ -12,6 +13,6 @@ export type CliRemoteNode = {
12
13
  export type CliDependencyResolver = (profile: string | undefined, remote?: CliRemoteNode) => CliDependencies;
13
14
  type CliDependencySource = CliDependencies | CliDependencyResolver;
14
15
  export declare const makeCli: (dependencies: CliDependencySource) => (arguments_: readonly string[], version: string, io: CliIo) => Effect.Effect<number>;
15
- export declare const makeCliDependencies: (connector?: CliNodeConnector) => CliDependencyResolver;
16
+ export declare const makeCliDependencies: (connector?: CliNodeConnector, ssh?: SshLayer) => CliDependencyResolver;
16
17
  export declare const runCli: (arguments_: readonly string[], version: string, io: CliIo) => Effect.Effect<number>;
17
18
  //# sourceMappingURL=cli.d.ts.map
package/dist/cli/cli.js CHANGED
@@ -513,19 +513,20 @@ const makeDefaultCliDependencies = (binding) => ({
513
513
  }),
514
514
  ...lazyDependencies(loadStatus, (module, node) => module.makeStatusClient(node), { ...binding, names: ["createMonitorBootstrap", "readStatus"] }),
515
515
  });
516
- const remoteConnector = (remote, local) => {
516
+ const remoteConnector = (remote, local, ssh) => {
517
517
  const cache = {};
518
518
  return (options) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => {
519
519
  cache.connector ??= module.makeRemoteNodeConnector({
520
520
  ...(local === undefined ? {} : { local }),
521
521
  name: remote.name,
522
522
  scope: remote.scope,
523
+ ...(ssh === undefined ? {} : { ssh }),
523
524
  });
524
525
  return cache.connector(options);
525
526
  }));
526
527
  };
527
528
  const remoteSignIn = (remote, binding) => (connection) => Effect.promise(loadRemoteNode).pipe(Effect.flatMap((module) => module.remoteVendorLogin({ ...binding, name: remote.name })(connection)));
528
- export const makeCliDependencies = (connector) => (profile, remote) => {
529
+ export const makeCliDependencies = (connector, ssh) => (profile, remote) => {
529
530
  const binding = {
530
531
  ...(connector === undefined ? {} : { connector }),
531
532
  ...(profile === undefined ? {} : { profile }),
@@ -535,7 +536,7 @@ export const makeCliDependencies = (connector) => (profile, remote) => {
535
536
  : {
536
537
  ...makeDefaultCliDependencies({
537
538
  ...binding,
538
- connector: remoteConnector(remote, connector),
539
+ connector: remoteConnector(remote, connector, ssh),
539
540
  remote: true,
540
541
  }),
541
542
  runVendorLogin: remoteSignIn(remote, binding),
@@ -23,13 +23,20 @@ const unreachable = (name, reason) => new MaiaClientError("transport_failure", r
23
23
  retryable: true,
24
24
  },
25
25
  });
26
+ const unknownNode = (name) => new MaiaClientError("transport_failure", "no Node has this name", {
27
+ remoteError: {
28
+ code: "invalid_argument",
29
+ message: `No Node is named '${name}'; see maia node list.`,
30
+ retryable: false,
31
+ },
32
+ });
26
33
  export const readRemoteNode = (connector, options, name) => Effect.gen(function* () {
27
34
  const local = yield* connector(options);
28
35
  const messageId = yield* newCliIdentifier("request");
29
36
  const listed = yield* local.client.listRemoteNodes({}, { messageId });
30
37
  const node = listed.nodes.find((candidate) => candidate.name === name);
31
38
  if (node === undefined)
32
- return yield* Effect.fail(unreachable(name, "no Node has this name; see maia node list."));
39
+ return yield* Effect.fail(unknownNode(name));
33
40
  return node;
34
41
  });
35
42
  const spawnBridge = (node) => ChildProcess.make("ssh", sshCommandArguments({
@@ -14,7 +14,9 @@ const unavailableError = (cause) => {
14
14
  const remote = Predicate.hasProperty(error, "remoteError")
15
15
  ? protocolErrorSchema.safeParse(error.remoteError)
16
16
  : undefined;
17
- return remote?.success === true && remote.data.code === "node_unavailable"
17
+ return remote?.success === true &&
18
+ (remote.data.code === "node_unavailable" ||
19
+ remote.data.code === "invalid_argument")
18
20
  ? remote.data
19
21
  : createUnavailableError();
20
22
  };
@@ -5,9 +5,13 @@ export type DoctorCheck = {
5
5
  readonly next?: string;
6
6
  readonly ok: boolean;
7
7
  };
8
+ export type DoctorScope = "machine" | "node";
8
9
  export type CliDoctorResult = {
9
- readonly checks: readonly DoctorCheck[];
10
+ readonly checks: readonly (DoctorCheck & {
11
+ readonly scope: DoctorScope;
12
+ })[];
10
13
  readonly command: "doctor";
14
+ readonly node?: string;
11
15
  readonly ok: boolean;
12
16
  readonly version: string;
13
17
  };
@@ -1,6 +1,6 @@
1
1
  import * as Effect from "effect/Effect";
2
2
  import * as Option from "effect/Option";
3
- import { requireNoArguments, writeSuccess, } from "../command-line/index.js";
3
+ import { LOCAL_NODE, requireNoArguments, writeSuccess, } from "../command-line/index.js";
4
4
  const EXIT_FAILED = 70;
5
5
  const vendorWords = (executor) => executor === "codex-cli"
6
6
  ? { integration: "codex", login: "codex" }
@@ -71,8 +71,8 @@ const nodeChecks = (detected, connections) => {
71
71
  ]),
72
72
  ];
73
73
  };
74
- const formatDoctor = (result) => `Maia doctor ${result.ok ? "ok" : "failed"}\n${result.checks
75
- .map((check) => ` ${check.code}: ${check.ok ? "ok" : "failed"}${check.detail === undefined ? "" : ` (${check.detail})`}${check.ok || check.next === undefined ? "" : `; next: ${check.next}`}\n`)
74
+ const formatDoctor = (result) => `Maia doctor ${result.ok ? "ok" : "failed"}${result.node === undefined ? "" : ` (Node ${result.node})`}\n${result.checks
75
+ .map((check) => ` ${check.code}${check.scope === "machine" ? " (this machine)" : ""}: ${check.ok ? "ok" : "failed"}${check.detail === undefined ? "" : ` (${check.detail})`}${check.ok || check.next === undefined ? "" : `; next: ${check.next}`}\n`)
76
76
  .join("")}`;
77
77
  const readLifecycle = (dependencies) => Effect.map(Effect.option(Effect.map(Effect.suspend(() => dependencies.readStatus()), (node) => node.lifecycle)), Option.getOrUndefined);
78
78
  const nodeCheck = (lifecycle) => lifecycle === undefined
@@ -100,8 +100,14 @@ export const runDoctor = (tokens, context) => Effect.gen(function* () {
100
100
  const checks = yield* readChecks(context);
101
101
  const ok = checks.every((check) => check.ok);
102
102
  const result = {
103
- checks,
103
+ checks: checks.map((check) => ({
104
+ ...check,
105
+ scope: check.code === "cli" ? "machine" : "node",
106
+ })),
104
107
  command: "doctor",
108
+ ...(context.node === undefined || context.node === LOCAL_NODE
109
+ ? {}
110
+ : { node: context.node }),
105
111
  ok,
106
112
  version: context.version,
107
113
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maiaos/cli",
3
- "version": "0.1.0-canary.11",
3
+ "version": "0.1.0-canary.13",
4
4
  "description": "The maia CLI and MCP server: start, drive, observe and stop swarms of Claude Code and Codex agents from a terminal, a script or another agent.",
5
5
  "keywords": [
6
6
  "maia",
@@ -64,9 +64,9 @@
64
64
  "dependencies": {
65
65
  "@earendil-works/pi-tui": "1.0.0",
66
66
  "@effect/platform-node-shared": "4.0.0",
67
- "@maiaos/agent": "0.1.0-canary.11",
68
- "@maiaos/client-core": "0.1.0-canary.11",
69
- "@maiaos/sdk": "0.1.0-canary.11",
67
+ "@maiaos/agent": "0.1.0-canary.13",
68
+ "@maiaos/client-core": "0.1.0-canary.13",
69
+ "@maiaos/sdk": "0.1.0-canary.13",
70
70
  "effect": "4.0.0"
71
71
  },
72
72
  "scripts": {