@thaodangspace/argos 0.0.0-stage → 0.1.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 (55) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +45 -2
  3. package/dist/args.d.ts +21 -0
  4. package/dist/args.d.ts.map +1 -0
  5. package/dist/args.js +86 -0
  6. package/dist/args.js.map +1 -0
  7. package/dist/commands/actions.d.ts +8 -0
  8. package/dist/commands/actions.d.ts.map +1 -0
  9. package/dist/commands/actions.js +89 -0
  10. package/dist/commands/actions.js.map +1 -0
  11. package/dist/commands/doctor.d.ts +12 -0
  12. package/dist/commands/doctor.d.ts.map +1 -0
  13. package/dist/commands/doctor.js +187 -0
  14. package/dist/commands/doctor.js.map +1 -0
  15. package/dist/commands/run.d.ts +5 -0
  16. package/dist/commands/run.d.ts.map +1 -0
  17. package/dist/commands/run.js +65 -0
  18. package/dist/commands/run.js.map +1 -0
  19. package/dist/commands/runs.d.ts +7 -0
  20. package/dist/commands/runs.d.ts.map +1 -0
  21. package/dist/commands/runs.js +113 -0
  22. package/dist/commands/runs.js.map +1 -0
  23. package/dist/commands/schedule.d.ts +15 -0
  24. package/dist/commands/schedule.d.ts.map +1 -0
  25. package/dist/commands/schedule.js +320 -0
  26. package/dist/commands/schedule.js.map +1 -0
  27. package/dist/commands/serve.d.ts +29 -0
  28. package/dist/commands/serve.d.ts.map +1 -0
  29. package/dist/commands/serve.js +200 -0
  30. package/dist/commands/serve.js.map +1 -0
  31. package/dist/commands/validate.d.ts +23 -0
  32. package/dist/commands/validate.d.ts.map +1 -0
  33. package/dist/commands/validate.js +185 -0
  34. package/dist/commands/validate.js.map +1 -0
  35. package/dist/commands/worktree.d.ts +11 -0
  36. package/dist/commands/worktree.d.ts.map +1 -0
  37. package/dist/commands/worktree.js +92 -0
  38. package/dist/commands/worktree.js.map +1 -0
  39. package/dist/index.d.ts +13 -0
  40. package/dist/index.d.ts.map +1 -0
  41. package/dist/index.js +41 -0
  42. package/dist/index.js.map +1 -0
  43. package/dist/main.d.ts +5 -0
  44. package/dist/main.d.ts.map +1 -0
  45. package/dist/main.js +61 -0
  46. package/dist/main.js.map +1 -0
  47. package/dist/output.d.ts +38 -0
  48. package/dist/output.d.ts.map +1 -0
  49. package/dist/output.js +114 -0
  50. package/dist/output.js.map +1 -0
  51. package/dist/rpc-command.d.ts +12 -0
  52. package/dist/rpc-command.d.ts.map +1 -0
  53. package/dist/rpc-command.js +34 -0
  54. package/dist/rpc-command.js.map +1 -0
  55. package/package.json +52 -4
package/dist/main.js ADDED
@@ -0,0 +1,61 @@
1
+ /** The `argos` command dispatcher (FR25). No storage import anywhere on this path. */
2
+ import { parseArgs } from "./args.js";
3
+ import { cancelCommand, decideCommand, retryCommand, rmCommand } from "./commands/actions.js";
4
+ import { doctorCommand } from "./commands/doctor.js";
5
+ import { gatesCommand, lsCommand, statusCommand } from "./commands/runs.js";
6
+ import { runCommand } from "./commands/run.js";
7
+ import { scheduleCommand } from "./commands/schedule.js";
8
+ import { validateCommand } from "./commands/validate.js";
9
+ import { worktreeCommand } from "./commands/worktree.js";
10
+ import { EXIT_OK, EXIT_RUNTIME, REQUIRED_NODE_VERSION, USAGE, nodeVersionOk, processIo, } from "./output.js";
11
+ /** Run one CLI invocation and return its exit code (0/1/2/3). */
12
+ export async function runCli(argv, io = processIo) {
13
+ const args = parseArgs(argv);
14
+ if (args.help) {
15
+ io.stdout(USAGE);
16
+ return EXIT_OK;
17
+ }
18
+ if (args.command === undefined) {
19
+ io.stderr(USAGE);
20
+ return EXIT_RUNTIME;
21
+ }
22
+ if (!nodeVersionOk()) {
23
+ io.stderr(`argos: Node ${process.versions.node} is too old; Argos needs ${REQUIRED_NODE_VERSION} (built-in SQLite)\n`);
24
+ return EXIT_RUNTIME;
25
+ }
26
+ switch (args.command) {
27
+ case "validate":
28
+ return validateCommand(args, io);
29
+ case "run":
30
+ return runCommand(args, io);
31
+ case "ls":
32
+ return lsCommand(args, io);
33
+ case "status":
34
+ return statusCommand(args, io);
35
+ case "gates":
36
+ return gatesCommand(args, io);
37
+ case "decide":
38
+ return decideCommand(args, io);
39
+ case "cancel":
40
+ return cancelCommand(args, io);
41
+ case "retry":
42
+ return retryCommand(args, io);
43
+ case "rm":
44
+ return rmCommand(args, io);
45
+ case "worktree":
46
+ return worktreeCommand(args, io);
47
+ case "schedule":
48
+ return scheduleCommand(args, io);
49
+ case "doctor":
50
+ return doctorCommand(args, io);
51
+ case "serve": {
52
+ // Lazy: `argos run` must never load the durable host (or SQLite) into its process (FR3).
53
+ const module = await import("./commands/serve.js");
54
+ return module.serveCommand(args, io);
55
+ }
56
+ default:
57
+ io.stderr(`argos: unknown command "${args.command}"\n\n${USAGE}`);
58
+ return EXIT_RUNTIME;
59
+ }
60
+ }
61
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"main.js","sourceRoot":"","sources":["../src/main.ts"],"names":[],"mappings":"AAAA,sFAAsF;AAEtF,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAC9F,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EACL,OAAO,EACP,YAAY,EACZ,qBAAqB,EACrB,KAAK,EACL,aAAa,EACb,SAAS,GAEV,MAAM,aAAa,CAAC;AAErB,iEAAiE;AACjE,MAAM,CAAC,KAAK,UAAU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AC7B,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,UAAU;YACb,OAAO,eAAe,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACnC,KAAK,QAAQ;YACX,OAAO,aAAa,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACjC,KAAK,OAAO,EAAE,CAAC;YACb,yFAAyF;YACzF,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;YACnD,OAAO,MAAM,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACvC,CAAC;QACD;YACE,EAAE,CAAC,MAAM,CAAC,2BAA2B,IAAI,CAAC,OAAO,QAAQ,KAAK,EAAE,CAAC,CAAC;YAClE,OAAO,YAAY,CAAC;IACxB,CAAC;AACH,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Output, error, and exit-code conventions shared by every CLI command.
3
+ *
4
+ * Exit codes (documented in `AGENTS.md` and `argos --help`):
5
+ * 0 success
6
+ * 1 usage / runtime failure (including a bad flag, a missing server when not `run`, storage)
7
+ * 2 playbook validation failure (`validate`, or `run` refusing an invalid playbook)
8
+ * 3 unauthorized or unreachable server
9
+ */
10
+ import { RpcClientError } from "@thaodangspace/argos-core/rpc";
11
+ export interface CliIo {
12
+ stdout(text: string): void;
13
+ stderr(text: string): void;
14
+ }
15
+ export declare const processIo: CliIo;
16
+ export declare const EXIT_OK = 0;
17
+ export declare const EXIT_RUNTIME = 1;
18
+ export declare const EXIT_VALIDATION = 2;
19
+ export declare const EXIT_UNREACHABLE = 3;
20
+ /** Minimum Node for the built-in SQLite the durable host uses: unflagged from 22.13. */
21
+ export declare const REQUIRED_NODE_VERSION = ">=22.13";
22
+ export declare function nodeVersionOk(version?: string): boolean;
23
+ export declare function printJson(io: CliIo, value: unknown): void;
24
+ /** A JSON error body for `--json`; the same shape as the RPC `ErrorResponse`. */
25
+ export declare function printJsonError(io: CliIo, code: string, message: string): void;
26
+ export declare function fail(io: CliIo, message: string): number;
27
+ /** True for the errors that mean "the playbook itself is wrong" (exit 2, not 1). */
28
+ export declare function isValidationCode(code: string): boolean;
29
+ /** Human text for an RPC failure, with the actionable next step the spec asks for (FR3). */
30
+ export declare function describeRpcError(error: RpcClientError, baseUrl: string, home: string): string;
31
+ /** Map any thrown value to `{ code, message, exitCode }` (no stack traces in output). */
32
+ export declare function classifyFailure(error: unknown): {
33
+ code: string;
34
+ message: string;
35
+ exitCode: number;
36
+ };
37
+ export declare const USAGE = "argos \u2014 durable YAML playbooks for Paseo agents\n\nUsage:\n argos validate [path] [--home dir] [--json]\n argos run <playbook> [--input k=v ...] [--cwd dir] [--isolation none|worktree] [--json]\n argos ls [--schedule <id>] [--json]\n argos status <runId> [--json]\n argos gates [--json]\n argos decide <runId> <gateId> <decision> [--comment text] [--json]\n argos cancel <runId> [--json]\n argos retry <runId> <stepId> [--json]\n argos rm <runId> [--json]\n argos worktree rm <runId> [--force] [--delete-branch] [--json]\n argos worktree gc --older-than <n>(s|m|h|d) [--dry-run] [--force] [--delete-branch] [--json]\n argos schedule add <playbook> --cron <expr> [--id <id>] [--tz <zone>] [--cwd dir]\n [--input k=v ...] [--isolation none|worktree] [--overlap skip|allow]\n [--catch-up all|0|<n>(s|m|h|d)] [--keep <n>|all] [--paused] [--json]\n argos schedule edit <id> [--cron <expr>] [--tz <zone>] [--cwd dir] [--input k=v ...]\n [--isolation none|worktree] [--overlap skip|allow]\n [--catch-up all|0|<n>(s|m|h|d)] [--keep <n>|all] [--json]\n argos schedule ls|show <id>|pause <id>|resume <id>|run <id>|rm <id> [--json]\n argos serve [--port N] [--home dir] [--json]\n argos doctor [--home dir] [--port N] [--json]\n\nEnvironment:\n ARGOS_HOME state directory (default ~/.argos)\n ARGOS_PORT RPC port on 127.0.0.1 (default 7676)\n ARGOS_PASEO_URL Paseo daemon URL (argos serve only)\n ARGOS_FAKE_PASEO=1 test-only deterministic executor (argos serve only)\n\nExit codes: 0 success, 1 usage/runtime, 2 validation failure, 3 unauthorized/unreachable.\n";
38
+ //# sourceMappingURL=output.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAGH,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE/D,MAAM,WAAW,KAAK;IACpB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;CAC5B;AAED,eAAO,MAAM,SAAS,EAAE,KAOvB,CAAC;AAEF,eAAO,MAAM,OAAO,IAAI,CAAC;AACzB,eAAO,MAAM,YAAY,IAAI,CAAC;AAC9B,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,gBAAgB,IAAI,CAAC;AAElC,wFAAwF;AACxF,eAAO,MAAM,qBAAqB,YAAY,CAAC;AAE/C,wBAAgB,aAAa,CAAC,OAAO,GAAE,MAA8B,GAAG,OAAO,CAI9E;AAED,wBAAgB,SAAS,CAAC,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI,CAEzD;AAED,iFAAiF;AACjF,wBAAgB,cAAc,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAE7E;AAED,wBAAgB,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,CAGvD;AAED,oFAAoF;AACpF,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAOtD;AAED,4FAA4F;AAC5F,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ7F;AAED,yFAAyF;AACzF,wBAAgB,eAAe,CAAC,KAAK,EAAE,OAAO,GAAG;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAoBA;AAED,eAAO,MAAM,KAAK,woDA+BjB,CAAC"}
package/dist/output.js ADDED
@@ -0,0 +1,114 @@
1
+ /**
2
+ * Output, error, and exit-code conventions shared by every CLI command.
3
+ *
4
+ * Exit codes (documented in `AGENTS.md` and `argos --help`):
5
+ * 0 success
6
+ * 1 usage / runtime failure (including a bad flag, a missing server when not `run`, storage)
7
+ * 2 playbook validation failure (`validate`, or `run` refusing an invalid playbook)
8
+ * 3 unauthorized or unreachable server
9
+ */
10
+ import { isArgosError } from "@thaodangspace/argos-core";
11
+ import { RpcClientError } from "@thaodangspace/argos-core/rpc";
12
+ export const processIo = {
13
+ stdout: (text) => {
14
+ process.stdout.write(text);
15
+ },
16
+ stderr: (text) => {
17
+ process.stderr.write(text);
18
+ },
19
+ };
20
+ export const EXIT_OK = 0;
21
+ export const EXIT_RUNTIME = 1;
22
+ export const EXIT_VALIDATION = 2;
23
+ export const EXIT_UNREACHABLE = 3;
24
+ /** Minimum Node for the built-in SQLite the durable host uses: unflagged from 22.13. */
25
+ export const REQUIRED_NODE_VERSION = ">=22.13";
26
+ export function nodeVersionOk(version = process.versions.node) {
27
+ const [major, minor] = version.split(".").map((part) => Number.parseInt(part, 10));
28
+ if (!Number.isInteger(major) || !Number.isInteger(minor))
29
+ return false;
30
+ return major > 22 || (major === 22 && minor >= 13);
31
+ }
32
+ export function printJson(io, value) {
33
+ io.stdout(`${JSON.stringify(value, null, 2)}\n`);
34
+ }
35
+ /** A JSON error body for `--json`; the same shape as the RPC `ErrorResponse`. */
36
+ export function printJsonError(io, code, message) {
37
+ printJson(io, { error: { code, message } });
38
+ }
39
+ export function fail(io, message) {
40
+ io.stderr(`argos: ${message}\n`);
41
+ return EXIT_RUNTIME;
42
+ }
43
+ /** True for the errors that mean "the playbook itself is wrong" (exit 2, not 1). */
44
+ export function isValidationCode(code) {
45
+ return (code === "playbook_invalid" ||
46
+ code === "playbook_cycle" ||
47
+ code === "playbook_missing" ||
48
+ code === "model_unavailable");
49
+ }
50
+ /** Human text for an RPC failure, with the actionable next step the spec asks for (FR3). */
51
+ export function describeRpcError(error, baseUrl, home) {
52
+ if (error.unreachable) {
53
+ return `cannot reach the argos server at ${baseUrl} (${error.message}); start it with \`argos serve\``;
54
+ }
55
+ if (error.unauthorized) {
56
+ return `unauthorized: ${error.message}; check ${home}/token or run \`argos doctor\``;
57
+ }
58
+ return `${error.code}: ${error.message}`;
59
+ }
60
+ /** Map any thrown value to `{ code, message, exitCode }` (no stack traces in output). */
61
+ export function classifyFailure(error) {
62
+ if (error instanceof RpcClientError) {
63
+ return {
64
+ code: error.unreachable ? "unreachable" : error.code,
65
+ message: error.message,
66
+ exitCode: error.unreachable || error.unauthorized ? EXIT_UNREACHABLE : EXIT_RUNTIME,
67
+ };
68
+ }
69
+ if (isArgosError(error)) {
70
+ return {
71
+ code: error.code,
72
+ message: error.message,
73
+ exitCode: isValidationCode(error.code) ? EXIT_VALIDATION : EXIT_RUNTIME,
74
+ };
75
+ }
76
+ return {
77
+ code: "internal_error",
78
+ message: error instanceof Error ? error.message : String(error),
79
+ exitCode: EXIT_RUNTIME,
80
+ };
81
+ }
82
+ export const USAGE = `argos — durable YAML playbooks for Paseo agents
83
+
84
+ Usage:
85
+ argos validate [path] [--home dir] [--json]
86
+ argos run <playbook> [--input k=v ...] [--cwd dir] [--isolation none|worktree] [--json]
87
+ argos ls [--schedule <id>] [--json]
88
+ argos status <runId> [--json]
89
+ argos gates [--json]
90
+ argos decide <runId> <gateId> <decision> [--comment text] [--json]
91
+ argos cancel <runId> [--json]
92
+ argos retry <runId> <stepId> [--json]
93
+ argos rm <runId> [--json]
94
+ argos worktree rm <runId> [--force] [--delete-branch] [--json]
95
+ argos worktree gc --older-than <n>(s|m|h|d) [--dry-run] [--force] [--delete-branch] [--json]
96
+ argos schedule add <playbook> --cron <expr> [--id <id>] [--tz <zone>] [--cwd dir]
97
+ [--input k=v ...] [--isolation none|worktree] [--overlap skip|allow]
98
+ [--catch-up all|0|<n>(s|m|h|d)] [--keep <n>|all] [--paused] [--json]
99
+ argos schedule edit <id> [--cron <expr>] [--tz <zone>] [--cwd dir] [--input k=v ...]
100
+ [--isolation none|worktree] [--overlap skip|allow]
101
+ [--catch-up all|0|<n>(s|m|h|d)] [--keep <n>|all] [--json]
102
+ argos schedule ls|show <id>|pause <id>|resume <id>|run <id>|rm <id> [--json]
103
+ argos serve [--port N] [--home dir] [--json]
104
+ argos doctor [--home dir] [--port N] [--json]
105
+
106
+ Environment:
107
+ ARGOS_HOME state directory (default ~/.argos)
108
+ ARGOS_PORT RPC port on 127.0.0.1 (default 7676)
109
+ ARGOS_PASEO_URL Paseo daemon URL (argos serve only)
110
+ ARGOS_FAKE_PASEO=1 test-only deterministic executor (argos serve only)
111
+
112
+ Exit codes: 0 success, 1 usage/runtime, 2 validation failure, 3 unauthorized/unreachable.
113
+ `;
114
+ //# sourceMappingURL=output.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"output.js","sourceRoot":"","sources":["../src/output.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,2BAA2B,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAO/D,MAAM,CAAC,MAAM,SAAS,GAAU;IAC9B,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;IACD,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE;QACf,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAC7B,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AACzB,MAAM,CAAC,MAAM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ACtB,OAAO,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;QAC/D,QAAQ,EAAE,YAAY;KACvB,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BpB,CAAC"}
@@ -0,0 +1,12 @@
1
+ /** Shared RPC command plumbing: one client per command, one place for error mapping. */
2
+ import { RpcClient } from "@thaodangspace/argos-core/rpc";
3
+ import { type CliIo } from "./output.js";
4
+ export interface RpcCommandResult {
5
+ /** The stable `--json` shape. */
6
+ readonly jsonValue: unknown;
7
+ /** Concise human output (a trailing newline is added when missing). */
8
+ readonly human: string;
9
+ }
10
+ /** Open the client, run one action, and render either success or a mapped failure. */
11
+ export declare function withRpc(io: CliIo, json: boolean, action: (client: RpcClient) => Promise<RpcCommandResult>): Promise<number>;
12
+ //# sourceMappingURL=rpc-command.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-command.d.ts","sourceRoot":"","sources":["../src/rpc-command.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,EAAE,SAAS,EAAkB,MAAM,+BAA+B,CAAC;AAE1E,OAAO,EAUL,KAAK,KAAK,EACX,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,gBAAgB;IAC/B,iCAAiC;IACjC,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;CACxB;AAED,sFAAsF;AACtF,wBAAsB,OAAO,CAC3B,EAAE,EAAE,KAAK,EACT,IAAI,EAAE,OAAO,EACb,MAAM,EAAE,CAAC,MAAM,EAAE,SAAS,KAAK,OAAO,CAAC,gBAAgB,CAAC,GACvD,OAAO,CAAC,MAAM,CAAC,CAoBjB"}
@@ -0,0 +1,34 @@
1
+ /** Shared RPC command plumbing: one client per command, one place for error mapping. */
2
+ import { RpcClient, RpcClientError } from "@thaodangspace/argos-core/rpc";
3
+ import { EXIT_OK, EXIT_RUNTIME, EXIT_UNREACHABLE, EXIT_VALIDATION, classifyFailure, describeRpcError, isValidationCode, printJson, printJsonError, } from "./output.js";
4
+ /** Open the client, run one action, and render either success or a mapped failure. */
5
+ export async function withRpc(io, json, action) {
6
+ const client = new RpcClient();
7
+ try {
8
+ const result = await action(client);
9
+ if (json)
10
+ printJson(io, result.jsonValue);
11
+ else
12
+ io.stdout(result.human.endsWith("\n") ? result.human : `${result.human}\n`);
13
+ return EXIT_OK;
14
+ }
15
+ catch (error) {
16
+ if (error instanceof RpcClientError) {
17
+ const message = describeRpcError(error, client.baseUrl, client.home);
18
+ if (json)
19
+ printJsonError(io, error.unreachable ? "unreachable" : error.code, message);
20
+ else
21
+ io.stderr(`argos: ${message}\n`);
22
+ if (error.unreachable || error.unauthorized)
23
+ return EXIT_UNREACHABLE;
24
+ return isValidationCode(error.code) ? EXIT_VALIDATION : EXIT_RUNTIME;
25
+ }
26
+ const failure = classifyFailure(error);
27
+ if (json)
28
+ printJsonError(io, failure.code, failure.message);
29
+ else
30
+ io.stderr(`argos: ${failure.message}\n`);
31
+ return failure.exitCode;
32
+ }
33
+ }
34
+ //# sourceMappingURL=rpc-command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-command.js","sourceRoot":"","sources":["../src/rpc-command.ts"],"names":[],"mappings":"AAAA,wFAAwF;AAExF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,+BAA+B,CAAC;AAE1E,OAAO,EACL,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,SAAS,EACT,cAAc,GAEf,MAAM,aAAa,CAAC;AASrB,sFAAsF;AACtF,MAAM,CAAC,KAAK,UAAU,OAAO,CAC3B,EAAS,EACT,IAAa,EACb,MAAwD;IAExD,MAAM,MAAM,G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O,CAAC,QAAQ,CAAC;IAC1B,CAAC;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,54 @@
1
1
  {
2
2
  "name": "@thaodangspace/argos",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "type": "module",
5
+ "description": "Durable YAML playbook engine CLI for Paseo agents",
6
+ "license": "MIT",
7
+ "keywords": [
8
+ "argos",
9
+ "paseo",
10
+ "playbook",
11
+ "workflow",
12
+ "orchestration",
13
+ "cli"
14
+ ],
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/thaodangspace/argos.git",
18
+ "directory": "packages/cli"
19
+ },
20
+ "homepage": "https://github.com/thaodangspace/argos#readme",
21
+ "bugs": {
22
+ "url": "https://github.com/thaodangspace/argos/issues"
23
+ },
24
+ "engines": {
25
+ "node": ">=22.13"
26
+ },
27
+ "publishConfig": {
28
+ "access": "public"
29
+ },
30
+ "exports": {
31
+ ".": {
32
+ "types": "./dist/index.d.ts",
33
+ "import": "./dist/index.js"
34
+ }
35
+ },
36
+ "bin": {
37
+ "argos": "dist/index.js"
38
+ },
39
+ "files": [
40
+ "dist",
41
+ "!dist/.tsbuildinfo"
42
+ ],
43
+ "scripts": {
44
+ "build": "tsc -b",
45
+ "postbuild": "node scripts/make-bin-executable.mjs",
46
+ "prepublishOnly": "npm run build",
47
+ "test": "vitest run",
48
+ "typecheck": "tsc -b",
49
+ "typecheck:tests": "tsc --noEmit -p tsconfig.test.json"
50
+ },
51
+ "dependencies": {
52
+ "@thaodangspace/argos-core": "0.1.0"
53
+ }
54
+ }