@thaodangspace/argos 0.0.0-stage → 0.1.1
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.
- package/LICENSE +21 -0
- package/README.md +51 -2
- package/dist/args.d.ts +21 -0
- package/dist/args.d.ts.map +1 -0
- package/dist/args.js +94 -0
- package/dist/args.js.map +1 -0
- package/dist/commands/actions.d.ts +13 -0
- package/dist/commands/actions.d.ts.map +1 -0
- package/dist/commands/actions.js +112 -0
- package/dist/commands/actions.js.map +1 -0
- package/dist/commands/db.d.ts +12 -0
- package/dist/commands/db.d.ts.map +1 -0
- package/dist/commands/db.js +122 -0
- package/dist/commands/db.js.map +1 -0
- package/dist/commands/doctor.d.ts +12 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +213 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/run.d.ts +5 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/run.js +78 -0
- package/dist/commands/run.js.map +1 -0
- package/dist/commands/runs.d.ts +7 -0
- package/dist/commands/runs.d.ts.map +1 -0
- package/dist/commands/runs.js +146 -0
- package/dist/commands/runs.js.map +1 -0
- package/dist/commands/schedule.d.ts +15 -0
- package/dist/commands/schedule.d.ts.map +1 -0
- package/dist/commands/schedule.js +337 -0
- package/dist/commands/schedule.js.map +1 -0
- package/dist/commands/serve.d.ts +37 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/commands/serve.js +340 -0
- package/dist/commands/serve.js.map +1 -0
- package/dist/commands/validate.d.ts +23 -0
- package/dist/commands/validate.d.ts.map +1 -0
- package/dist/commands/validate.js +185 -0
- package/dist/commands/validate.js.map +1 -0
- package/dist/commands/worktree.d.ts +11 -0
- package/dist/commands/worktree.d.ts.map +1 -0
- package/dist/commands/worktree.js +92 -0
- package/dist/commands/worktree.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +41 -0
- package/dist/index.js.map +1 -0
- package/dist/main.d.ts +5 -0
- package/dist/main.d.ts.map +1 -0
- package/dist/main.js +66 -0
- package/dist/main.js.map +1 -0
- package/dist/output.d.ts +50 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +203 -0
- package/dist/output.js.map +1 -0
- package/dist/rpc-command.d.ts +12 -0
- package/dist/rpc-command.d.ts.map +1 -0
- package/dist/rpc-command.js +34 -0
- package/dist/rpc-command.js.map +1 -0
- package/dist/ui-dir.d.ts +23 -0
- package/dist/ui-dir.d.ts.map +1 -0
- package/dist/ui-dir.js +51 -0
- package/dist/ui-dir.js.map +1 -0
- package/package.json +53 -4
- package/ui/_app/immutable/assets/0.Y-Ej83kR.css +1 -0
- package/ui/_app/immutable/assets/2.D2FEqQBh.css +1 -0
- package/ui/_app/immutable/assets/3.CI7aeD9i.css +1 -0
- package/ui/_app/immutable/assets/StartRunDialog.BbbZvJfB.css +1 -0
- package/ui/_app/immutable/assets/runs.CU5wtnW2.css +1 -0
- package/ui/_app/immutable/chunks/BKHbyffl.js +3 -0
- package/ui/_app/immutable/chunks/BeG5AxKI.js +3 -0
- package/ui/_app/immutable/chunks/Beqi9dRN.js +72 -0
- package/ui/_app/immutable/chunks/Buwi_lQz.js +2 -0
- package/ui/_app/immutable/chunks/CV2Ptlrp.js +1 -0
- package/ui/_app/immutable/chunks/CtbaNJav.js +1 -0
- package/ui/_app/immutable/chunks/D8sQwgC_.js +55 -0
- package/ui/_app/immutable/chunks/DclECHGd.js +1 -0
- package/ui/_app/immutable/entry/app.DPg5reEl.js +2 -0
- package/ui/_app/immutable/entry/payload.DSmR2FwN.js +1 -0
- package/ui/_app/immutable/entry/start.iWBP-EvH.js +2 -0
- package/ui/_app/immutable/nodes/0.Cu8SyVzm.js +1 -0
- package/ui/_app/immutable/nodes/1.Bga_qdeZ.js +1 -0
- package/ui/_app/immutable/nodes/2.CKNrkmzJ.js +1 -0
- package/ui/_app/immutable/nodes/3.OrFQ8OoI.js +1 -0
- package/ui/_app/version.json +1 -0
- package/ui/build.json +5 -0
- package/ui/index.html +45 -0
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `argos serve` (FR2/FR25) — the **only** process that opens `$ARGOS_HOME/argos.sqlite`.
|
|
3
|
+
*
|
|
4
|
+
* It builds the executor registry (`paseo` always, `hc` when a real herdr-core answers inside the
|
|
5
|
+
* 5 s probe or when the test-only `ARGOS_FAKE_EXECUTOR=hc` selects the deterministic fake), opens
|
|
6
|
+
* `ArgosHost` (pid file + SQLite + `resume()`), ensures the bearer token, starts the loopback RPC
|
|
7
|
+
* server, prints one stderr line naming the registry, and waits for SIGINT/SIGTERM to close both
|
|
8
|
+
* gracefully. The host is retried once on a transient open failure; `storage_locked` and
|
|
9
|
+
* `executor_unavailable` are never retried because another live process owns the home and a
|
|
10
|
+
* missing adapter does not appear by waiting.
|
|
11
|
+
*/
|
|
12
|
+
import { resolve } from "node:path";
|
|
13
|
+
import { argosHome, isArgosError } from "@thaodangspace/argos-core";
|
|
14
|
+
import { DEFAULT_EXECUTOR_ID, EXECUTOR_IDS, executorIdFor, } from "@thaodangspace/argos-core/rpc";
|
|
15
|
+
import { ArgosHost, createRpcServer, } from "@thaodangspace/argos-core/rpc/server";
|
|
16
|
+
import { ModelCatalog, createAgentStepExecutor, createFakeStepExecutor, createPaseoPort, fakeProviderCatalog, } from "@thaodangspace/argos-core/paseo";
|
|
17
|
+
import { FAKE_HC_VERSION, HC_PROTOCOL_GENERATION, HcCatalog, createFakeHcPort, createHcClient, createHcStepExecutor, } from "@thaodangspace/argos-core/hc";
|
|
18
|
+
import { flag, rejectUnknownFlags } from "../args.js";
|
|
19
|
+
import { inspectUi, resolveUiDir } from "../ui-dir.js";
|
|
20
|
+
import { EXIT_RUNTIME, REQUIRED_NODE_VERSION, nodeVersionOk, } from "../output.js";
|
|
21
|
+
/**
|
|
22
|
+
* The single stderr line `argos serve` prints per fire (FR10.4), including its newline.
|
|
23
|
+
*
|
|
24
|
+
* It carries the schedule id, the ISO fire time, the status, and then either the run the fire
|
|
25
|
+
* started or the error code that refused it. It never contains an input value — and the event it
|
|
26
|
+
* reads has no inputs at all.
|
|
27
|
+
*/
|
|
28
|
+
export function formatScheduleFireLine(event) {
|
|
29
|
+
const head = `[argos] schedule ${event.scheduleId} ${new Date(event.fireAt).toISOString()} ${event.status}`;
|
|
30
|
+
const tail = event.runId !== undefined
|
|
31
|
+
? ` run ${event.runId}`
|
|
32
|
+
: event.errorCode !== undefined && event.errorCode !== null
|
|
33
|
+
? ` ${event.errorCode}`
|
|
34
|
+
: event.count !== undefined
|
|
35
|
+
? ` ${event.count}`
|
|
36
|
+
: "";
|
|
37
|
+
return `${head}${tail}\n`;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* FR9/NFR: the one stderr line `argos serve` prints at startup listing the registry, e.g.
|
|
41
|
+
* `[argos] executors: paseo (default), hc`. Ids only — never a path, a token, or an input value.
|
|
42
|
+
*/
|
|
43
|
+
export function formatExecutorLine(executors) {
|
|
44
|
+
const listed = executors.map((executor) => (executor.default ? `${executor.id} (default)` : executor.id));
|
|
45
|
+
return `[argos] executors: ${listed.length === 0 ? "(none)" : listed.join(", ")}\n`;
|
|
46
|
+
}
|
|
47
|
+
function configuredPort(value) {
|
|
48
|
+
const raw = value ?? process.env["ARGOS_PORT"];
|
|
49
|
+
if (raw === undefined)
|
|
50
|
+
return 7676;
|
|
51
|
+
const parsed = Number.parseInt(raw, 10);
|
|
52
|
+
return Number.isInteger(parsed) && parsed >= 0 ? parsed : 7676;
|
|
53
|
+
}
|
|
54
|
+
function delay(ms) {
|
|
55
|
+
return new Promise((resolve) => {
|
|
56
|
+
setTimeout(resolve, ms);
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
/** Bound startup catalog discovery so a down daemon cannot block `argos serve`. */
|
|
60
|
+
function within(promise, ms) {
|
|
61
|
+
return new Promise((resolve, reject) => {
|
|
62
|
+
const timer = setTimeout(() => {
|
|
63
|
+
reject(new Error(`no answer within ${ms} ms`));
|
|
64
|
+
}, ms);
|
|
65
|
+
timer.unref?.();
|
|
66
|
+
promise.then((value) => {
|
|
67
|
+
clearTimeout(timer);
|
|
68
|
+
resolve(value);
|
|
69
|
+
}, (error) => {
|
|
70
|
+
clearTimeout(timer);
|
|
71
|
+
reject(error instanceof Error ? error : new Error(String(error)));
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
/** Open once, then once more after a short pause unless the home is owned by a live process. */
|
|
76
|
+
async function openHost(options) {
|
|
77
|
+
try {
|
|
78
|
+
return await ArgosHost.open(options);
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
// Neither an owned home nor an unusable default executor gets better by trying again: both are
|
|
82
|
+
// decided before anything is opened/created, and a retry would only delay the same refusal.
|
|
83
|
+
if (isArgosError(error) && (error.code === "storage_locked" || error.code === "executor_unavailable")) {
|
|
84
|
+
throw error;
|
|
85
|
+
}
|
|
86
|
+
await delay(250);
|
|
87
|
+
return ArgosHost.open(options);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/** FR9: the same 5 s bound the provider catalog uses, so a down core never blocks startup. */
|
|
91
|
+
const HC_PROBE_TIMEOUT_MS = 5_000;
|
|
92
|
+
function errorText(error) {
|
|
93
|
+
return error instanceof Error ? error.message : String(error);
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* FR9/FR16: the `hc` half of the executor registry.
|
|
97
|
+
*
|
|
98
|
+
* - `ARGOS_FAKE_EXECUTOR=hc` (test only) registers the deterministic fake port, file-backed under
|
|
99
|
+
* `ARGOS_FAKE_HC_DIR` (else `$ARGOS_HOME`) so a restarted `argos serve` adopts the terminals its
|
|
100
|
+
* predecessor created. No socket is opened and no real core is probed.
|
|
101
|
+
* - Otherwise a real core is probed inside {@link HC_PROBE_TIMEOUT_MS}: `hello` (protocol
|
|
102
|
+
* generation 1) then `server.status`, then `templates.list` for the `hc/<template>` catalog. A
|
|
103
|
+
* down/incompatible/missing core is a **warning**, never a startup failure: the registry simply
|
|
104
|
+
* does not advertise `hc`, and every other substrate keeps working.
|
|
105
|
+
*
|
|
106
|
+
* With `ARGOS_FAKE_PASEO=1` and no `ARGOS_FAKE_EXECUTOR`, `hc` is deliberately absent: a test-only
|
|
107
|
+
* server must not depend on whatever core happens to run on the machine.
|
|
108
|
+
*/
|
|
109
|
+
async function buildHcRegistration(home, io) {
|
|
110
|
+
if (process.env["ARGOS_FAKE_EXECUTOR"] === "hc") {
|
|
111
|
+
io.stderr("[argos] ARGOS_FAKE_EXECUTOR=hc: using the deterministic herdr-core test executor\n");
|
|
112
|
+
const fakeDir = process.env["ARGOS_FAKE_HC_DIR"];
|
|
113
|
+
const port = createFakeHcPort({ statePath: resolve(fakeDir ?? home) });
|
|
114
|
+
const catalog = HcCatalog.fromTemplates(await port.templatesList());
|
|
115
|
+
return {
|
|
116
|
+
executor: createHcStepExecutor({ port, catalog, home }),
|
|
117
|
+
catalog,
|
|
118
|
+
info: { reachable: true, version: FAKE_HC_VERSION },
|
|
119
|
+
close: async () => undefined,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
if (process.env["ARGOS_FAKE_PASEO"] === "1")
|
|
123
|
+
return undefined;
|
|
124
|
+
const client = createHcClient();
|
|
125
|
+
try {
|
|
126
|
+
const hello = await within(client.hello(), HC_PROBE_TIMEOUT_MS);
|
|
127
|
+
if (hello.generation !== HC_PROTOCOL_GENERATION) {
|
|
128
|
+
throw new Error(`the core speaks protocol generation ${hello.generation}; Argos needs ${HC_PROTOCOL_GENERATION}`);
|
|
129
|
+
}
|
|
130
|
+
const status = await within(client.serverStatus(), HC_PROBE_TIMEOUT_MS);
|
|
131
|
+
const catalog = await within(HcCatalog.load(client), HC_PROBE_TIMEOUT_MS);
|
|
132
|
+
return {
|
|
133
|
+
executor: createHcStepExecutor({ port: client, catalog, home }),
|
|
134
|
+
catalog,
|
|
135
|
+
info: {
|
|
136
|
+
reachable: true,
|
|
137
|
+
...(status.version.length === 0 ? {} : { version: status.version }),
|
|
138
|
+
},
|
|
139
|
+
close: () => client.close(),
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
catch (error) {
|
|
143
|
+
io.stderr(`[argos] warning: herdr-core is not available (${errorText(error)}); the hc executor is not registered\n`);
|
|
144
|
+
await client.close().catch(() => undefined);
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
async function buildDependencies(home, io, defaultExecutor) {
|
|
149
|
+
const hc = await buildHcRegistration(home, io);
|
|
150
|
+
// The registry additions of a registered `hc`: its executor, its template catalog, and the
|
|
151
|
+
// reachability `/info` reports. `paseo` stays `options.executor` and its own catalog option, so
|
|
152
|
+
// the two descriptors must be **merged**, not spread over each other.
|
|
153
|
+
const hcExecutors = hc === undefined ? {} : { hc: hc.executor };
|
|
154
|
+
const hcCatalogs = hc === undefined ? {} : { hc: hc.catalog };
|
|
155
|
+
const hcInfo = hc === undefined ? {} : { hc: hc.info };
|
|
156
|
+
const closeHc = hc === undefined ? async () => undefined : hc.close;
|
|
157
|
+
try {
|
|
158
|
+
if (process.env["ARGOS_FAKE_PASEO"] === "1") {
|
|
159
|
+
io.stderr("[argos] ARGOS_FAKE_PASEO=1: using the deterministic test-only executor\n");
|
|
160
|
+
const catalog = ModelCatalog.fromSnapshot(fakeProviderCatalog());
|
|
161
|
+
// File-backed by default so a restarted `argos serve` adopts the fake agents it created in
|
|
162
|
+
// its previous lifetime (Phase 10 D17). `ARGOS_FAKE_PASEO_DIR` moves the state elsewhere.
|
|
163
|
+
const fakeDir = process.env["ARGOS_FAKE_PASEO_DIR"];
|
|
164
|
+
const host = await openHost({
|
|
165
|
+
home,
|
|
166
|
+
executor: createFakeStepExecutor({
|
|
167
|
+
statePath: fakeDir === undefined ? home : resolve(fakeDir),
|
|
168
|
+
}),
|
|
169
|
+
modelCatalog: catalog,
|
|
170
|
+
defaultExecutor,
|
|
171
|
+
executorInfo: { paseo: { reachable: true }, ...hcInfo },
|
|
172
|
+
executors: hcExecutors,
|
|
173
|
+
catalogs: hcCatalogs,
|
|
174
|
+
// FR10.4: registered before the first tick, so a catch-up fire during `open()` still prints.
|
|
175
|
+
onScheduleFire: (event) => io.stderr(formatScheduleFireLine(event)),
|
|
176
|
+
});
|
|
177
|
+
return {
|
|
178
|
+
host,
|
|
179
|
+
probe: { mode: "fake", snapshot: async () => fakeProviderCatalog() },
|
|
180
|
+
close: closeHc,
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
const paseo = createPaseoPort();
|
|
184
|
+
let catalog;
|
|
185
|
+
let catalogError;
|
|
186
|
+
try {
|
|
187
|
+
catalog = await within(ModelCatalog.load(paseo), HC_PROBE_TIMEOUT_MS);
|
|
188
|
+
}
|
|
189
|
+
catch (error) {
|
|
190
|
+
catalogError = errorText(error);
|
|
191
|
+
io.stderr(`[argos] warning: could not load the provider catalog (${catalogError}); runs will fail until the daemon is reachable\n`);
|
|
192
|
+
}
|
|
193
|
+
const executor = createAgentStepExecutor({
|
|
194
|
+
port: paseo,
|
|
195
|
+
...(catalog === undefined ? {} : { catalog }),
|
|
196
|
+
});
|
|
197
|
+
const host = await openHost({
|
|
198
|
+
home,
|
|
199
|
+
executor,
|
|
200
|
+
...(catalog === undefined ? {} : { modelCatalog: catalog }),
|
|
201
|
+
defaultExecutor,
|
|
202
|
+
// FR9: paseo's own reachability, so `argos doctor` can show every registered substrate.
|
|
203
|
+
executorInfo: {
|
|
204
|
+
paseo: catalog === undefined
|
|
205
|
+
? {
|
|
206
|
+
reachable: false,
|
|
207
|
+
error: "the Paseo provider catalog could not be loaded",
|
|
208
|
+
}
|
|
209
|
+
: { reachable: true },
|
|
210
|
+
...hcInfo,
|
|
211
|
+
},
|
|
212
|
+
executors: hcExecutors,
|
|
213
|
+
catalogs: hcCatalogs,
|
|
214
|
+
onScheduleFire: (event) => io.stderr(formatScheduleFireLine(event)),
|
|
215
|
+
});
|
|
216
|
+
return {
|
|
217
|
+
host,
|
|
218
|
+
probe: {
|
|
219
|
+
url: paseo.url,
|
|
220
|
+
mode: "live",
|
|
221
|
+
snapshot: () => paseo.providersSnapshot(),
|
|
222
|
+
},
|
|
223
|
+
close: async () => {
|
|
224
|
+
try {
|
|
225
|
+
await paseo.close();
|
|
226
|
+
}
|
|
227
|
+
finally {
|
|
228
|
+
await closeHc();
|
|
229
|
+
}
|
|
230
|
+
},
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
catch (error) {
|
|
234
|
+
// A failed open must not leak the hc socket this process already opened.
|
|
235
|
+
await closeHc().catch(() => undefined);
|
|
236
|
+
throw error;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
export async function serveCommand(args, io) {
|
|
240
|
+
const unknown = rejectUnknownFlags(args, ["port", "home", "default-executor"]);
|
|
241
|
+
if (unknown !== undefined) {
|
|
242
|
+
io.stderr(`argos: ${unknown}\n`);
|
|
243
|
+
return EXIT_RUNTIME;
|
|
244
|
+
}
|
|
245
|
+
if (!nodeVersionOk()) {
|
|
246
|
+
io.stderr(`argos: Node ${process.versions.node} is too old; Argos needs ${REQUIRED_NODE_VERSION} (built-in SQLite)\n`);
|
|
247
|
+
return EXIT_RUNTIME;
|
|
248
|
+
}
|
|
249
|
+
const homeFlag = flag(args, "home");
|
|
250
|
+
const home = resolve(homeFlag ?? argosHome());
|
|
251
|
+
const portFlag = flag(args, "port");
|
|
252
|
+
if (portFlag !== undefined && !/^\d+$/.test(portFlag)) {
|
|
253
|
+
io.stderr("argos: --port must be a non-negative integer\n");
|
|
254
|
+
return EXIT_RUNTIME;
|
|
255
|
+
}
|
|
256
|
+
const port = configuredPort(portFlag);
|
|
257
|
+
// FR16: `--default-executor`, else `ARGOS_EXECUTOR`, else `paseo` (the flag wins). A value that is
|
|
258
|
+
// not an executor at all is refused here, before anything is opened; a known id the registry does
|
|
259
|
+
// not carry is refused by `ArgosHost.open` with `executor_unavailable`, naming the id and the
|
|
260
|
+
// registered set. Either way no home, pid file, or database is touched.
|
|
261
|
+
const executorValue = flag(args, "default-executor") ?? process.env["ARGOS_EXECUTOR"];
|
|
262
|
+
const resolvedExecutor = executorValue === undefined ? DEFAULT_EXECUTOR_ID : executorIdFor(executorValue);
|
|
263
|
+
if (resolvedExecutor === undefined) {
|
|
264
|
+
io.stderr(`argos: --default-executor ${JSON.stringify(executorValue ?? "")} is unknown: use one of ${EXECUTOR_IDS.join(", ")}\n`);
|
|
265
|
+
return EXIT_RUNTIME;
|
|
266
|
+
}
|
|
267
|
+
const defaultExecutor = resolvedExecutor;
|
|
268
|
+
let dependencies;
|
|
269
|
+
try {
|
|
270
|
+
dependencies = await buildDependencies(home, io, defaultExecutor);
|
|
271
|
+
// FR9/NFR Observability: one stderr line naming the registry and the default. `--json` keeps
|
|
272
|
+
// stdout to its single receipt line, so this never disturbs the startup contract.
|
|
273
|
+
io.stderr(formatExecutorLine(dependencies.host.executors));
|
|
274
|
+
// Spec FR18: `ARGOS_UI_DIR` → the UI copied into the package. A configured directory that is
|
|
275
|
+
// missing its shell is a warning (API-only), never a startup failure.
|
|
276
|
+
const uiDir = resolveUiDir(process.env);
|
|
277
|
+
const ui = inspectUi(uiDir);
|
|
278
|
+
if (uiDir !== undefined && ui === undefined) {
|
|
279
|
+
io.stderr(`[argos] warning: no UI at ${uiDir} (missing index.html); serving the API only\n`);
|
|
280
|
+
}
|
|
281
|
+
const server = await createRpcServer({
|
|
282
|
+
host: dependencies.host,
|
|
283
|
+
home,
|
|
284
|
+
port,
|
|
285
|
+
cwd: process.cwd(),
|
|
286
|
+
paseo: dependencies.probe,
|
|
287
|
+
...(ui === undefined ? {} : { ui: { dir: ui.dir } }),
|
|
288
|
+
});
|
|
289
|
+
if (ui !== undefined) {
|
|
290
|
+
io.stderr(`[argos] ui ${ui.dir}${ui.buildId === undefined ? "" : ` (build ${ui.buildId})`}\n`);
|
|
291
|
+
}
|
|
292
|
+
if (args.json) {
|
|
293
|
+
io.stdout(`${JSON.stringify({ port: server.port, home, pid: process.pid })}\n`);
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
io.stdout(`[argos] listening on ${server.url} (home ${home}, pid ${process.pid})\n`);
|
|
297
|
+
}
|
|
298
|
+
// FR10.4: the fire line is already wired through `ArgosHost.open` (`onScheduleFire`), so a
|
|
299
|
+
// catch-up fire that runs while the host opens is announced too. A JSON `serve` still keeps
|
|
300
|
+
// stdout to one line.
|
|
301
|
+
return await new Promise((resolve) => {
|
|
302
|
+
let stopping = false;
|
|
303
|
+
const shutdown = () => {
|
|
304
|
+
if (stopping)
|
|
305
|
+
return;
|
|
306
|
+
stopping = true;
|
|
307
|
+
void (async () => {
|
|
308
|
+
try {
|
|
309
|
+
await server.close();
|
|
310
|
+
}
|
|
311
|
+
finally {
|
|
312
|
+
try {
|
|
313
|
+
await dependencies?.host.close();
|
|
314
|
+
}
|
|
315
|
+
finally {
|
|
316
|
+
await dependencies?.close().catch(() => undefined);
|
|
317
|
+
resolve(0);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
})();
|
|
321
|
+
};
|
|
322
|
+
process.once("SIGINT", shutdown);
|
|
323
|
+
process.once("SIGTERM", shutdown);
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
catch (error) {
|
|
327
|
+
const code = isArgosError(error) ? error.code : "internal_error";
|
|
328
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
329
|
+
await dependencies?.host.close().catch(() => undefined);
|
|
330
|
+
await dependencies?.close().catch(() => undefined);
|
|
331
|
+
if (args.json) {
|
|
332
|
+
io.stderr(`${JSON.stringify({ error: { code, message } })}\n`);
|
|
333
|
+
}
|
|
334
|
+
else {
|
|
335
|
+
io.stderr(`argos: ${code}: ${message}\n`);
|
|
336
|
+
}
|
|
337
|
+
return EXIT_RUNTIME;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=serve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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AAE,OAAO,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC;QACjE,CAAC;aAAM,CAAC;YACN,EAAE,CAAC,MAAM,CAAC,UAAU,IAAI,KAAK,OAAO,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,YAAY,CAAC;IACtB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `argos validate [path]` (FR25, FR12) — loader only: no server, no SQLite, no side effects.
|
|
3
|
+
*
|
|
4
|
+
* With no argument it validates every playbook discovered under the current directory (the same
|
|
5
|
+
* `.argos/playbooks` / `.paseo/plugins/playbooks` roots the engine uses) plus the global library in
|
|
6
|
+
* `$ARGOS_HOME/playbooks` (`--home`, else `ARGOS_HOME`, else `~/.argos`). A file argument is
|
|
7
|
+
* validated as that exact file, with the repository root inferred from the standard directory
|
|
8
|
+
* layout; a directory argument is treated as a repository root, unless it is itself a playbooks
|
|
9
|
+
* directory or a loose folder of YAML files. Every error keeps its file and step id, and the
|
|
10
|
+
* command exits 2 when at least one playbook is invalid.
|
|
11
|
+
*/
|
|
12
|
+
import type { ValidateReport } from "@thaodangspace/argos-core/rpc";
|
|
13
|
+
import type { ParsedArgs } from "../args.js";
|
|
14
|
+
import { type CliIo } from "../output.js";
|
|
15
|
+
interface ValidationResult {
|
|
16
|
+
readonly report: ValidateReport;
|
|
17
|
+
readonly repoDir: string;
|
|
18
|
+
}
|
|
19
|
+
/** Run the loader over every candidate and collect every failure (never stop at the first). */
|
|
20
|
+
export declare function validatePlaybooks(pathArg: string | undefined, cwd?: string, home?: string): ValidationResult;
|
|
21
|
+
export declare function validateCommand(args: ParsedArgs, io: CliIo): number;
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=validate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/commands/validate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAYH,OAAO,KAAK,EAGV,cAAc,EAEf,MAAM,+BAA+B,CAAC;AAEvC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAE7C,OAAO,EAKL,KAAK,KAAK,EACX,MAAM,cAAc,CAAC;AAQtB,UAAU,gBAAgB;IACxB,QAAQ,CAAC,MAAM,EAAE,cAAc,CAAC;IAChC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAqED,+FAA+F;AAC/F,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,GAAG,SAAS,EAC3B,GAAG,GAAE,MAAsB,EAC3B,IAAI,GAAE,MAAoB,GACzB,gBAAgB,CAoElB;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,GAAG,MAAM,CA6CnE"}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `argos validate [path]` (FR25, FR12) — loader only: no server, no SQLite, no side effects.
|
|
3
|
+
*
|
|
4
|
+
* With no argument it validates every playbook discovered under the current directory (the same
|
|
5
|
+
* `.argos/playbooks` / `.paseo/plugins/playbooks` roots the engine uses) plus the global library in
|
|
6
|
+
* `$ARGOS_HOME/playbooks` (`--home`, else `ARGOS_HOME`, else `~/.argos`). A file argument is
|
|
7
|
+
* validated as that exact file, with the repository root inferred from the standard directory
|
|
8
|
+
* layout; a directory argument is treated as a repository root, unless it is itself a playbooks
|
|
9
|
+
* directory or a loose folder of YAML files. Every error keeps its file and step id, and the
|
|
10
|
+
* command exits 2 when at least one playbook is invalid.
|
|
11
|
+
*/
|
|
12
|
+
import { existsSync, readdirSync, statSync } from "node:fs";
|
|
13
|
+
import { basename, dirname, extname, join, relative, resolve, sep } from "node:path";
|
|
14
|
+
import { argosHome, errorLocation, isArgosError } from "@thaodangspace/argos-core";
|
|
15
|
+
import { discoverPlaybooks, loadPlaybook, } from "@thaodangspace/argos-core/playbook";
|
|
16
|
+
import { flag, rejectUnknownFlags } from "../args.js";
|
|
17
|
+
import { EXIT_OK, EXIT_RUNTIME, EXIT_VALIDATION, printJson, } from "../output.js";
|
|
18
|
+
const YAML_EXTENSIONS = new Set([".yaml", ".yml"]);
|
|
19
|
+
const ROOT_MARKERS = [
|
|
20
|
+
"/.argos/playbooks",
|
|
21
|
+
"/.paseo/plugins/playbooks",
|
|
22
|
+
];
|
|
23
|
+
function toPosix(path) {
|
|
24
|
+
return path.split(sep).join("/");
|
|
25
|
+
}
|
|
26
|
+
/** The repository root a standard playbooks path belongs to. */
|
|
27
|
+
function inferRepoRoot(file) {
|
|
28
|
+
const posix = toPosix(file);
|
|
29
|
+
for (const marker of ROOT_MARKERS) {
|
|
30
|
+
const index = posix.indexOf(marker);
|
|
31
|
+
if (index > 0)
|
|
32
|
+
return posix.slice(0, index);
|
|
33
|
+
}
|
|
34
|
+
return dirname(file);
|
|
35
|
+
}
|
|
36
|
+
function yamlFiles(directory) {
|
|
37
|
+
return readdirSync(directory)
|
|
38
|
+
.filter((name) => YAML_EXTENSIONS.has(extname(name)))
|
|
39
|
+
.map((name) => join(directory, name))
|
|
40
|
+
.filter((file) => statSync(file).isFile())
|
|
41
|
+
.sort();
|
|
42
|
+
}
|
|
43
|
+
function candidatesFor(target, home) {
|
|
44
|
+
const absolute = resolve(target);
|
|
45
|
+
if (!existsSync(absolute)) {
|
|
46
|
+
throw new Error(`path not found: ${target}`);
|
|
47
|
+
}
|
|
48
|
+
const info = statSync(absolute);
|
|
49
|
+
if (info.isFile()) {
|
|
50
|
+
const id = basename(absolute, extname(absolute));
|
|
51
|
+
return {
|
|
52
|
+
repoDir: inferRepoRoot(absolute),
|
|
53
|
+
candidates: [{ entry: { id, file: absolute, root: "" }, explicit: true }],
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (!info.isDirectory()) {
|
|
57
|
+
throw new Error(`not a file or directory: ${target}`);
|
|
58
|
+
}
|
|
59
|
+
const discovered = discoverPlaybooks(absolute, home);
|
|
60
|
+
if (discovered.length > 0) {
|
|
61
|
+
return {
|
|
62
|
+
repoDir: absolute,
|
|
63
|
+
candidates: discovered.map((entry) => ({ entry, explicit: false })),
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
const files = yamlFiles(absolute);
|
|
67
|
+
const explicit = files.map((file) => ({
|
|
68
|
+
entry: { id: basename(file, extname(file)), file, root: "" },
|
|
69
|
+
explicit: true,
|
|
70
|
+
}));
|
|
71
|
+
return { repoDir: inferRepoRoot(absolute), candidates: explicit };
|
|
72
|
+
}
|
|
73
|
+
function displayPath(repoDir, file) {
|
|
74
|
+
const path = relative(resolve(repoDir), resolve(file));
|
|
75
|
+
return path === "" || path.startsWith("..") ? resolve(file) : toPosix(path);
|
|
76
|
+
}
|
|
77
|
+
/** Run the loader over every candidate and collect every failure (never stop at the first). */
|
|
78
|
+
export function validatePlaybooks(pathArg, cwd = process.cwd(), home = argosHome()) {
|
|
79
|
+
const root = resolve(cwd);
|
|
80
|
+
const { repoDir, candidates } = pathArg === undefined
|
|
81
|
+
? {
|
|
82
|
+
repoDir: root,
|
|
83
|
+
candidates: discoverPlaybooks(root, home).map((entry) => ({
|
|
84
|
+
entry,
|
|
85
|
+
explicit: false,
|
|
86
|
+
})),
|
|
87
|
+
}
|
|
88
|
+
: candidatesFor(resolve(root, pathArg), home);
|
|
89
|
+
const playbooks = [];
|
|
90
|
+
const errors = [];
|
|
91
|
+
const warnings = [];
|
|
92
|
+
for (const candidate of candidates) {
|
|
93
|
+
try {
|
|
94
|
+
const ir = loadPlaybook(repoDir, candidate.entry.id, candidate.explicit
|
|
95
|
+
? { file: candidate.entry.file, home, warnings }
|
|
96
|
+
: { home, warnings });
|
|
97
|
+
playbooks.push({
|
|
98
|
+
id: ir.id,
|
|
99
|
+
file: displayPath(repoDir, candidate.entry.file),
|
|
100
|
+
hash: ir.hash,
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
catch (error) {
|
|
104
|
+
const file = isArgosError(error) && error.file !== undefined ? error.file : candidate.entry.file;
|
|
105
|
+
const code = isArgosError(error) ? error.code : "playbook_invalid";
|
|
106
|
+
const errorStepId = isArgosError(error) ? (error.stepId ?? null) : null;
|
|
107
|
+
const issues = isArgosError(error) ? (error.issues ?? []) : [];
|
|
108
|
+
if (issues.length > 0) {
|
|
109
|
+
// FR1.4: one `errors[]` entry per schema issue, so every typo is named in one run.
|
|
110
|
+
for (const issue of issues) {
|
|
111
|
+
errors.push({
|
|
112
|
+
file: displayPath(repoDir, file),
|
|
113
|
+
stepId: issue.stepId ?? errorStepId,
|
|
114
|
+
code,
|
|
115
|
+
message: `${issue.path}: ${issue.message}`,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
121
|
+
const prefix = errorLocation(file, errorStepId ?? undefined);
|
|
122
|
+
errors.push({
|
|
123
|
+
file: displayPath(repoDir, file),
|
|
124
|
+
stepId: errorStepId,
|
|
125
|
+
code,
|
|
126
|
+
message: message.startsWith(prefix) ? message.slice(prefix.length) : message,
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
repoDir,
|
|
132
|
+
report: {
|
|
133
|
+
valid: errors.length === 0,
|
|
134
|
+
playbooks,
|
|
135
|
+
errors,
|
|
136
|
+
warnings: warnings.map((warning) => ({ ...warning, file: displayPath(repoDir, warning.file) })),
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
export function validateCommand(args, io) {
|
|
141
|
+
const unknown = rejectUnknownFlags(args, ["home"]);
|
|
142
|
+
if (unknown !== undefined) {
|
|
143
|
+
io.stderr(`argos: ${unknown}\n`);
|
|
144
|
+
return EXIT_RUNTIME;
|
|
145
|
+
}
|
|
146
|
+
if (args.positionals.length > 1) {
|
|
147
|
+
io.stderr("argos: validate takes at most one path\n");
|
|
148
|
+
return EXIT_RUNTIME;
|
|
149
|
+
}
|
|
150
|
+
// Same precedence as `argos serve`: `--home`, else `ARGOS_HOME`, else `~/.argos`, so a local
|
|
151
|
+
// check and a running server agree on the global playbook library.
|
|
152
|
+
const homeFlag = flag(args, "home");
|
|
153
|
+
const home = resolve(homeFlag ?? argosHome());
|
|
154
|
+
let result;
|
|
155
|
+
try {
|
|
156
|
+
result = validatePlaybooks(args.positionals[0], process.cwd(), home);
|
|
157
|
+
}
|
|
158
|
+
catch (error) {
|
|
159
|
+
io.stderr(`argos: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
160
|
+
return EXIT_RUNTIME;
|
|
161
|
+
}
|
|
162
|
+
if (args.json) {
|
|
163
|
+
printJson(io, result.report);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
for (const playbook of result.report.playbooks) {
|
|
167
|
+
io.stdout(`ok ${playbook.id} ${playbook.file} ${playbook.hash}\n`);
|
|
168
|
+
}
|
|
169
|
+
for (const error of result.report.errors) {
|
|
170
|
+
const location = error.stepId === null ? error.file : `${error.file}: step ${error.stepId}`;
|
|
171
|
+
io.stdout(`FAIL ${location}: ${error.code}: ${error.message}\n`);
|
|
172
|
+
}
|
|
173
|
+
// FR7.1: warnings print after the errors and never change the exit code.
|
|
174
|
+
for (const warning of result.report.warnings) {
|
|
175
|
+
const location = warning.stepId === null ? warning.file : `${warning.file}: step ${warning.stepId}`;
|
|
176
|
+
io.stdout(`WARN ${location}: ${warning.code}: ${warning.message}\n`);
|
|
177
|
+
}
|
|
178
|
+
const total = result.report.playbooks.length + result.report.errors.length;
|
|
179
|
+
io.stdout(result.report.valid
|
|
180
|
+
? `${result.report.playbooks.length} playbook(s) valid\n`
|
|
181
|
+
: `${result.report.errors.length} of ${total} playbook(s) invalid\n`);
|
|
182
|
+
}
|
|
183
|
+
return result.report.valid ? EXIT_OK : EXIT_VALIDATION;
|
|
184
|
+
}
|
|
185
|
+
//# sourceMappingURL=validate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC;QAC3E,EAAE,CAAC,MAAM,CACP,MAAM,CAAC,MAAM,CAAC,KAAK;YACjB,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,sBAAsB;YACzD,CAAC,CAAC,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,OAAO,KAAK,wBAAwB,CACvE,CAAC;IACJ,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC;AACzD,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `argos worktree rm|gc` (FR4.6) — manual cleanup of `$ARGOS_HOME/worktrees`.
|
|
3
|
+
*
|
|
4
|
+
* The sub-command is parsed by hand (the same shape as the rest of the CLI: no dependency), and
|
|
5
|
+
* every request goes through `argos serve`: the CLI never touches a working tree or SQLite. The
|
|
6
|
+
* server derives the path and branch from the run record (FR4.4), so nothing here ever sends a path.
|
|
7
|
+
*/
|
|
8
|
+
import { type ParsedArgs } from "../args.js";
|
|
9
|
+
import { type CliIo } from "../output.js";
|
|
10
|
+
export declare function worktreeCommand(args: ParsedArgs, io: CliIo): Promise<number>;
|
|
11
|
+
//# sourceMappingURL=worktree.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"worktree.d.ts","sourceRoot":"","sources":["../../src/commands/worktree.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAqC,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAChF,OAAO,EAAgB,KAAK,KAAK,EAAE,MAAM,cAAc,CAAC;AAGxD,wBAAsB,eAAe,CAAC,IAAI,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,GAAG,OAAO,CAAC,MAAM,CAAC,CAMlF"}
|