bazilion 0.17.0 → 0.18.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.
- package/dist/cli.js +336 -67
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +1770 -151
- package/dist/daemon.js.map +1 -1
- package/dist/migrations/0001_init.sql +107 -0
- package/dist/web/client/assets/{ChatPane-BI3QVX2A.js → ChatPane-CAYS_fIQ.js} +1 -1
- package/dist/web/client/assets/ConfirmDialog-BzIiABOP.js +1 -0
- package/dist/web/client/assets/{FieldRow-swJ5qn2h.js → FieldRow-W_54rw5c.js} +1 -1
- package/dist/web/client/assets/{ProductionTeamPolicyEditor-LGw1UuF-.js → ProductionTeamPolicyEditor-DNXVX8Lz.js} +2 -2
- package/dist/web/client/assets/{ProfileCommunicationEditor-raoau_YB.js → ProfileCommunicationEditor-DN0fOzqn.js} +1 -1
- package/dist/web/client/assets/{ResultSourceConversation-BEwkhFog.js → ResultSourceConversation-DoU4tOWc.js} +1 -1
- package/dist/web/client/assets/TeamTabs-BmTZRI4T.js +1 -0
- package/dist/web/client/assets/{TemplatesTabs-BX5hhEJ7.js → TemplatesTabs-Bs_OXKwx.js} +1 -1
- package/dist/web/client/assets/{UnsavedChangesGuard-CVJtmR1D.js → UnsavedChangesGuard-CPRtFReU.js} +1 -1
- package/dist/web/client/assets/{_id-DmEVZIlx.js → _id-CxAB4TDr.js} +1 -1
- package/dist/web/client/assets/{_id-DHqq2W34.js → _id-DL4tJFQB.js} +1 -1
- package/dist/web/client/assets/{_id-BQPOE3gj.js → _id-DR9eFC17.js} +1 -1
- package/dist/web/client/assets/{_id-BkYrUP0R.js → _id-Dbmei5tg.js} +1 -1
- package/dist/web/client/assets/{_id-CriixlZD.js → _id-ybF-pqmr.js} +1 -1
- package/dist/web/client/assets/{activity-Bzr8R18n.js → activity-oUyy77jD.js} +1 -1
- package/dist/web/client/assets/{agents-13oafeOA.js → agents-D_TrEqAg.js} +1 -1
- package/dist/web/client/assets/{agents-DF4NALmJ.js → agents-DkjJp7JP.js} +1 -1
- package/dist/web/client/assets/{approvals-DsG0Ijls.js → approvals-DhOerWdt.js} +1 -1
- package/dist/web/client/assets/{attention-DG7K25mz.js → attention-DGwiF-Jy.js} +1 -1
- package/dist/web/client/assets/chevron-right-DSa4xPTs.js +1 -0
- package/dist/web/client/assets/{config-DAaDbFhS.js → config-BJ2ZzHPR.js} +1 -1
- package/dist/web/client/assets/{inbox-C9e7QjsX.js → inbox-BUElnGep.js} +1 -1
- package/dist/web/client/assets/{index-Dsstm2hf.js → index-Bi-HxcPG.js} +2 -2
- package/dist/web/client/assets/{learning-23arTd21.js → learning-BiTHNwB3.js} +1 -1
- package/dist/web/client/assets/login-BmcZvAH2.js +1 -0
- package/dist/web/client/assets/{mcp-Cdx9qAl8.js → mcp-Cwk9V82W.js} +1 -1
- package/dist/web/client/assets/{members-fotOz4rR.js → members-CHDNabFh.js} +1 -1
- package/dist/web/client/assets/{memory-C7UznVot.js → memory-Cx_Fpd4e.js} +1 -1
- package/dist/web/client/assets/{policy-CactLW1X.js → policy-C0nMdwcG.js} +1 -1
- package/dist/web/client/assets/{results-DqEuYnQH.js → results-Bz3jASs-.js} +1 -1
- package/dist/web/client/assets/{review-CnBSYclb.js → review-AK9WGmpv.js} +1 -1
- package/dist/web/client/assets/routes-DsMY_6oy.js +1 -0
- package/dist/web/client/assets/{services-xEANwZAu.js → services-DItA6fJ7.js} +1 -1
- package/dist/web/client/assets/{skills-CamV6wYM.js → skills-DbNV2vgL.js} +1 -1
- package/dist/web/client/assets/{teams-B12dMSjW.js → teams-D83scDxw.js} +1 -1
- package/dist/web/client/assets/{teams-CbH43zSG.js → teams-DAny1ypN.js} +1 -1
- package/dist/web/client/assets/{telegram-muIql4u-.js → telegram-BOmf9vUh.js} +1 -1
- package/dist/web/client/assets/{tokens-DGFmApdF.js → tokens-DBGH6Bw5.js} +1 -1
- package/dist/web/client/assets/{triggers-D8n3sCBW.js → triggers-D1_pseI3.js} +1 -1
- package/dist/web/client/assets/verifications-CBTo-FyV.js +2 -0
- package/dist/web/client/assets/{welcome-CMHWRZhs.js → welcome-DAfPOm15.js} +1 -1
- package/dist/web/client/assets/{x-BGCHwZOH.js → x-CWY-gUaM.js} +1 -1
- package/dist/web/server/assets/{TeamTabs-DQXh-3ij.js → TeamTabs-Dg4v6x0-.js} +4 -0
- package/dist/web/server/assets/{_id-DDyA9CGX.js → _id--onriuvj.js} +1 -1
- package/dist/web/server/assets/{_id-XkxlX036.js → _id--zoh1vv7.js} +1 -1
- package/dist/web/server/assets/{_id-Dw3gKOGv.js → _id-6p-mDmI8.js} +1 -1
- package/dist/web/server/assets/{_id-CPfILjMa.js → _id-DptBl3X8.js} +1 -1
- package/dist/web/server/assets/{_id-DtJn-yzu.js → _id-EAjRXNbD.js} +2 -2
- package/dist/web/server/assets/{_id-DSPFJMzf.js → _id-dUnXL-My2.js} +1 -1
- package/dist/web/server/assets/{_tanstack-start-manifest_v-vOXRfKJD.js → _tanstack-start-manifest_v-B3M-dfRO.js} +90 -79
- package/dist/web/server/assets/{activity-pYQPT3QT.js → activity-C5jpoEQI.js} +1 -1
- package/dist/web/server/assets/{activity-BX1jZBPQ.js → activity-Cu7zKPGD.js} +1 -1
- package/dist/web/server/assets/{activity-bozPMU2v.js → activity-Dn50vkQP.js} +2 -2
- package/dist/web/server/assets/{agents-BKBfW700.js → agents-RE6aYOb-.js} +1 -1
- package/dist/web/server/assets/{agents-CVCfxnE2.js → agents-nAOx_H7s.js} +1 -1
- package/dist/web/server/assets/{approvals-C3ya6B6U.js → approvals-DhHxIDrL.js} +1 -1
- package/dist/web/server/assets/{attention-l28hGCHS.js → attention-CBWzWRni.js} +1 -1
- package/dist/web/server/assets/{auth-AvDFNeOv.js → auth-tB3i6cFd.js} +1 -1
- package/dist/web/server/assets/{config-BWKn4XII.js → config-D1k_tTAw.js} +1 -1
- package/dist/web/server/assets/{daemon-client-Cgx-YW4l.js → daemon-client-C7qjQ2iO.js} +15 -0
- package/dist/web/server/assets/{git-review-f_uta4Mx.js → git-review-Bf5ABFJg.js} +1 -1
- package/dist/web/server/assets/{inbox-BBZiOOQs.js → inbox-Dw4pTevh.js} +1 -1
- package/dist/web/server/assets/{learning-CheVay1i.js → learning-CF8ZzFVD.js} +1 -1
- package/dist/web/server/assets/{mcp-DCBDmNtQ.js → mcp-D5dmBT82.js} +1 -1
- package/dist/web/server/assets/{members-C5FQruRZ.js → members-Bd0OtiTr.js} +1 -1
- package/dist/web/server/assets/{members-C2He8mrU.js → members-CvwEN9pm.js} +1 -1
- package/dist/web/server/assets/{members-C_2xB9pr.js → members-xSXoYUOd.js} +2 -2
- package/dist/web/server/assets/{memory-rmiFNj7T.js → memory-CcPK7um7.js} +1 -1
- package/dist/web/server/assets/{memory-BTcmf0sD.js → memory-UP6AsRkO.js} +2 -2
- package/dist/web/server/assets/{memory-4tI-UbOf.js → memory-lo2vHRNw.js} +1 -1
- package/dist/web/server/assets/{policy-C3D2Q1EA.js → policy-B62WXIFo.js} +1 -1
- package/dist/web/server/assets/{policy-BGILKGHz.js → policy-Bze9Krhg.js} +2 -2
- package/dist/web/server/assets/{policy-DS7LGe--.js → policy-Dh6wd2wN.js} +1 -1
- package/dist/web/server/assets/{results-_6K_zXQS.js → results-BFqs2iOu.js} +1 -1
- package/dist/web/server/assets/{results-C6H42tjq.js → results-BWnu3gXP.js} +1 -1
- package/dist/web/server/assets/{results-Cgx7SrFt.js → results-CzZk50Fu.js} +2 -2
- package/dist/web/server/assets/{review-DHhiL-JQ.js → review-DUe3vHPU.js} +2 -2
- package/dist/web/server/assets/{review-DSTMCwP4.js → review-c_-cFi7H.js} +1 -1
- package/dist/web/server/assets/{router-ElARvZzI.js → router-Deq94UJQ.js} +33 -26
- package/dist/web/server/assets/{routes-BgMvLvS-.js → routes-CVKkvFVv.js} +1 -1
- package/dist/web/server/assets/{services-yHZroxsi.js → services-CEr61xb5.js} +1 -1
- package/dist/web/server/assets/{skills--bIKID1Q.js → skills-BImC3LTO.js} +1 -1
- package/dist/web/server/assets/{teams-BbRfuVXY.js → teams-8zEIo08E.js} +1 -1
- package/dist/web/server/assets/{teams--a956vWL.js → teams-D-yaAWLV.js} +1 -1
- package/dist/web/server/assets/{telegram-4kMxRtVZ.js → telegram-CGl_LFtJ.js} +1 -1
- package/dist/web/server/assets/{tokens-BYwTN9JZ.js → tokens-cB-uf7qm.js} +1 -1
- package/dist/web/server/assets/{triggers-BM6mzLuH.js → triggers-CtSj79L0.js} +1 -1
- package/dist/web/server/assets/verification-B5QjcpIo.js +97 -0
- package/dist/web/server/assets/verifications-BfQsfwSE.js +268 -0
- package/dist/web/server/assets/verifications-CUq_6ZqL.js +26 -0
- package/dist/web/server/server.js +51 -35
- package/dist/worker.js +178 -4
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
- package/dist/web/client/assets/ConfirmDialog-Qam6Ut08.js +0 -1
- package/dist/web/client/assets/TeamTabs-BDdTLGIf.js +0 -1
- package/dist/web/client/assets/chevron-right-DFqFHtLy.js +0 -1
- package/dist/web/client/assets/login-BIXnBsuj.js +0 -1
- package/dist/web/client/assets/routes-COxMuwVz.js +0 -1
package/dist/cli.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import { defineCommand as
|
|
4
|
+
import { defineCommand as defineCommand37, runCommand, showUsage } from "citty";
|
|
5
5
|
|
|
6
6
|
// package.json
|
|
7
7
|
var package_default = {
|
|
8
8
|
name: "bazilion",
|
|
9
|
-
version: "0.
|
|
9
|
+
version: "0.18.0",
|
|
10
10
|
description: "Multi-agent runtime CLI \u2014 spawn LLM agents, manage profiles/teams/skills, and run the local daemon.",
|
|
11
11
|
license: "MIT",
|
|
12
12
|
repository: {
|
|
@@ -188,6 +188,21 @@ function createClient(cfg) {
|
|
|
188
188
|
input
|
|
189
189
|
)
|
|
190
190
|
},
|
|
191
|
+
/**
|
|
192
|
+
* Specialist verification of a captured code change (BAZ-044).
|
|
193
|
+
*
|
|
194
|
+
* Creating a request does not execute anything: the verification state machine claims and runs
|
|
195
|
+
* it, and a blocked capture comes back as a typed blocker rather than an error.
|
|
196
|
+
*/
|
|
197
|
+
verifications: (teamId) => {
|
|
198
|
+
const base = `/api/teams/${encodeURIComponent(teamId)}/verifications`;
|
|
199
|
+
return {
|
|
200
|
+
list: () => request("GET", base),
|
|
201
|
+
show: (requestId) => request("GET", `${base}/${encodeURIComponent(requestId)}`),
|
|
202
|
+
create: (input) => request("POST", base, input),
|
|
203
|
+
cancel: (requestId) => request("POST", `${base}/${encodeURIComponent(requestId)}/cancel`)
|
|
204
|
+
};
|
|
205
|
+
},
|
|
191
206
|
/** Read-only Git change review and bounded source snapshots (BAZ-042). */
|
|
192
207
|
repositoryReview: (teamId) => {
|
|
193
208
|
const base = `/api/teams/${encodeURIComponent(teamId)}/review`;
|
|
@@ -2290,6 +2305,42 @@ function invalidateRestoredCodingEvidence(db, payload, targetHome) {
|
|
|
2290
2305
|
WHERE state = 'retained' AND expires_at <= ?`
|
|
2291
2306
|
).run(restoredAt, restoredAt);
|
|
2292
2307
|
db.prepare("DELETE FROM source_snapshots WHERE expires_at <= ?").run(restoredAt);
|
|
2308
|
+
db.prepare("DELETE FROM verification_requests WHERE expires_at <= ?").run(restoredAt);
|
|
2309
|
+
db.prepare(
|
|
2310
|
+
`UPDATE verification_requests SET state = 'blocked'
|
|
2311
|
+
WHERE state IN ('pending', 'awaiting_approval')
|
|
2312
|
+
AND NOT EXISTS (SELECT 1 FROM source_snapshots snapshot
|
|
2313
|
+
WHERE snapshot.snapshot_id = verification_requests.snapshot_id
|
|
2314
|
+
AND snapshot.team_id = verification_requests.team_id
|
|
2315
|
+
AND snapshot.expires_at > ?)`
|
|
2316
|
+
).run(restoredAt);
|
|
2317
|
+
db.prepare(
|
|
2318
|
+
`UPDATE verification_attempts
|
|
2319
|
+
SET state = 'uncertain', finished_at = ?, lease_owner = NULL, lease_expires_at = NULL,
|
|
2320
|
+
error = 'execution was interrupted by a backup restore'
|
|
2321
|
+
WHERE finished_at IS NULL`
|
|
2322
|
+
).run(restoredAt);
|
|
2323
|
+
const invalidated = db.prepare(
|
|
2324
|
+
`SELECT DISTINCT attempt.request_id AS request_id
|
|
2325
|
+
FROM verification_check_outcomes outcome
|
|
2326
|
+
JOIN verification_attempts attempt ON attempt.id = outcome.attempt_id
|
|
2327
|
+
WHERE outcome.state IN ('succeeded', 'failed', 'timed_out', 'cancelled')`
|
|
2328
|
+
).all();
|
|
2329
|
+
db.prepare(
|
|
2330
|
+
`UPDATE verification_check_outcomes
|
|
2331
|
+
SET state = 'unknown', command_id = NULL, exit_code = NULL, finished_at = ?
|
|
2332
|
+
WHERE state IN ('succeeded', 'failed', 'timed_out', 'cancelled', 'not_executed')`
|
|
2333
|
+
).run(restoredAt);
|
|
2334
|
+
const reopen = db.prepare(`UPDATE verification_requests SET state = 'uncertain' WHERE id = ?`);
|
|
2335
|
+
const invalidateAttempt = db.prepare(
|
|
2336
|
+
`UPDATE verification_attempts
|
|
2337
|
+
SET state = 'uncertain', error = 'evidence was invalidated by a backup restore'
|
|
2338
|
+
WHERE request_id = ? AND state IN ('completed', 'failed')`
|
|
2339
|
+
);
|
|
2340
|
+
for (const row2 of invalidated) {
|
|
2341
|
+
invalidateAttempt.run(row2.request_id);
|
|
2342
|
+
reopen.run(row2.request_id);
|
|
2343
|
+
}
|
|
2293
2344
|
db.prepare("UPDATE workspace_writers SET state = 'recovery', recovery_mode = 'restored'").run();
|
|
2294
2345
|
const teams = db.prepare("SELECT id FROM teams").all();
|
|
2295
2346
|
const rebase = db.prepare("UPDATE workspace_writers SET root_path = ? WHERE team_id = ?");
|
|
@@ -2371,7 +2422,7 @@ function pauseRestoredUserQueue(database) {
|
|
|
2371
2422
|
// src/backup-schema.ts
|
|
2372
2423
|
import { createHash } from "crypto";
|
|
2373
2424
|
var CANONICAL_MIGRATION = "0001_init";
|
|
2374
|
-
var CANONICAL_SCHEMA_HASH = "
|
|
2425
|
+
var CANONICAL_SCHEMA_HASH = "cb3811823a7dead88cce0beb08cd4066ea3143258af0f0b8ba329016465dda37";
|
|
2375
2426
|
var CANONICAL_OBJECTS = [
|
|
2376
2427
|
["table", "team_coding_environments"],
|
|
2377
2428
|
["table", "workspace_writers"],
|
|
@@ -2384,6 +2435,16 @@ var CANONICAL_OBJECTS = [
|
|
|
2384
2435
|
["table", "source_snapshots"],
|
|
2385
2436
|
["index", "source_snapshots_retention"],
|
|
2386
2437
|
["index", "source_snapshots_team_time"],
|
|
2438
|
+
["table", "verification_requests"],
|
|
2439
|
+
["index", "verification_requests_team_time"],
|
|
2440
|
+
["index", "verification_requests_recipient_dispatch"],
|
|
2441
|
+
["index", "verification_requests_retention"],
|
|
2442
|
+
["table", "verification_checks"],
|
|
2443
|
+
["table", "verification_attempts"],
|
|
2444
|
+
["index", "verification_attempts_one_open_per_request"],
|
|
2445
|
+
["index", "verification_attempts_lease"],
|
|
2446
|
+
["table", "verification_check_outcomes"],
|
|
2447
|
+
["index", "verification_check_outcomes_command"],
|
|
2387
2448
|
["table", "notification_settings"],
|
|
2388
2449
|
["table", "notification_receipts"],
|
|
2389
2450
|
["index", "notification_receipts_state"],
|
|
@@ -5619,7 +5680,7 @@ var skillCommand = defineCommand25({
|
|
|
5619
5680
|
// src/commands/team.ts
|
|
5620
5681
|
import { readFileSync as readFileSync11 } from "fs";
|
|
5621
5682
|
import { stdin as stdin2 } from "process";
|
|
5622
|
-
import { defineCommand as
|
|
5683
|
+
import { defineCommand as defineCommand31 } from "citty";
|
|
5623
5684
|
|
|
5624
5685
|
// src/commands/team-coding-log.ts
|
|
5625
5686
|
import { defineCommand as defineCommand26 } from "citty";
|
|
@@ -6353,8 +6414,215 @@ var teamReviewCommand = defineCommand29({
|
|
|
6353
6414
|
}
|
|
6354
6415
|
});
|
|
6355
6416
|
|
|
6417
|
+
// src/commands/team-verify.ts
|
|
6418
|
+
import { defineCommand as defineCommand30 } from "citty";
|
|
6419
|
+
var slug2 = {
|
|
6420
|
+
id: { type: "positional", required: true, description: "Team slug" }
|
|
6421
|
+
};
|
|
6422
|
+
var OUTCOME_GLYPH = {
|
|
6423
|
+
not_executed: "not run",
|
|
6424
|
+
succeeded: "ok",
|
|
6425
|
+
failed: "FAIL",
|
|
6426
|
+
skipped: "skipped",
|
|
6427
|
+
blocked: "blocked",
|
|
6428
|
+
timed_out: "timeout",
|
|
6429
|
+
cancelled: "cancelled",
|
|
6430
|
+
unknown: "unknown"
|
|
6431
|
+
};
|
|
6432
|
+
function latestAttempt(report) {
|
|
6433
|
+
return [...report.attempts].sort((a, b) => b.attemptNumber - a.attemptNumber)[0];
|
|
6434
|
+
}
|
|
6435
|
+
function printReport(report) {
|
|
6436
|
+
const { request } = report;
|
|
6437
|
+
const requester = request.requester.kind === "agent" ? `agent ${request.requester.agentId}` : "operator";
|
|
6438
|
+
console.log(`${request.id} ${request.state}`);
|
|
6439
|
+
console.log(
|
|
6440
|
+
` change: snapshot ${request.snapshot.id} (base ${request.snapshot.baseOid.slice(0, 12)}${request.snapshot.complete ? "" : ", INCOMPLETE COVERAGE"})`
|
|
6441
|
+
);
|
|
6442
|
+
console.log(` specialist: ${request.recipientAgentId} requested by: ${requester}`);
|
|
6443
|
+
console.log(` environment: ${request.environment.image} (shell ${request.environment.sandbox})`);
|
|
6444
|
+
console.log(
|
|
6445
|
+
` applicability: ${report.applicability.comparison === "identical" ? "unchanged since capture" : `${report.applicability.comparison} (never a pass)`}`
|
|
6446
|
+
);
|
|
6447
|
+
if (request.summary) console.log(` requested: ${request.summary}`);
|
|
6448
|
+
const attempt = latestAttempt(report);
|
|
6449
|
+
const outcomes = new Map((attempt?.outcomes ?? []).map((outcome) => [outcome.ordinal, outcome]));
|
|
6450
|
+
console.log(" checks:");
|
|
6451
|
+
for (const check of report.checks) {
|
|
6452
|
+
const outcome = outcomes.get(check.ordinal);
|
|
6453
|
+
const state = outcome?.state ?? "not_executed";
|
|
6454
|
+
const receipt = outcome?.commandId ? ` receipt ${outcome.commandId}` : outcome?.receiptUnavailable ? " receipt no longer available" : "";
|
|
6455
|
+
const exit = outcome?.exitCode === null || outcome?.exitCode === void 0 ? "" : ` exit ${outcome.exitCode}`;
|
|
6456
|
+
console.log(
|
|
6457
|
+
` [${check.ordinal}] ${OUTCOME_GLYPH[state]}${exit}${receipt} ${check.command} (${check.purpose})`
|
|
6458
|
+
);
|
|
6459
|
+
}
|
|
6460
|
+
if (attempt?.error) console.log(` note: ${attempt.error}`);
|
|
6461
|
+
if (!attempt) console.log(" note: no attempt has run yet");
|
|
6462
|
+
}
|
|
6463
|
+
var createCmd3 = defineCommand30({
|
|
6464
|
+
meta: {
|
|
6465
|
+
name: "create",
|
|
6466
|
+
description: "Capture a verification request against a snapshot (does not run checks)"
|
|
6467
|
+
},
|
|
6468
|
+
args: {
|
|
6469
|
+
...slug2,
|
|
6470
|
+
agent: { type: "string", required: true, description: "Team member who will verify" },
|
|
6471
|
+
snapshot: { type: "string", required: true, description: "BAZ-042 snapshot id to verify" },
|
|
6472
|
+
check: {
|
|
6473
|
+
type: "string",
|
|
6474
|
+
required: true,
|
|
6475
|
+
description: 'A check as "<command> :: <purpose> [:: <cwd>] [:: <timeoutSeconds>]". Repeat up to eight times.'
|
|
6476
|
+
},
|
|
6477
|
+
summary: { type: "string", description: "Optional acceptance summary for the specialist" },
|
|
6478
|
+
writable: {
|
|
6479
|
+
type: "string",
|
|
6480
|
+
description: "Declared writable output path for checks. Repeat for each path."
|
|
6481
|
+
},
|
|
6482
|
+
json: { type: "boolean", description: "Emit the request as JSON" }
|
|
6483
|
+
},
|
|
6484
|
+
async run({ args: args2 }) {
|
|
6485
|
+
const raw = collectFlagValues(process.argv, "check");
|
|
6486
|
+
if (raw.length === 0) {
|
|
6487
|
+
console.error("at least one --check is required");
|
|
6488
|
+
process.exit(1);
|
|
6489
|
+
}
|
|
6490
|
+
const checks = raw.map((value) => {
|
|
6491
|
+
const [command, purpose, cwd, timeoutSeconds] = value.split("::").map((part) => part.trim());
|
|
6492
|
+
if (!command || !purpose) {
|
|
6493
|
+
console.error(`a check needs a command and a purpose: ${value}`);
|
|
6494
|
+
process.exit(1);
|
|
6495
|
+
}
|
|
6496
|
+
const seconds = timeoutSeconds ? Number(timeoutSeconds) : 120;
|
|
6497
|
+
if (!Number.isFinite(seconds) || seconds < 1 || seconds > 300) {
|
|
6498
|
+
console.error(`a check timeout must be 1-300 seconds: ${value}`);
|
|
6499
|
+
process.exit(1);
|
|
6500
|
+
}
|
|
6501
|
+
return {
|
|
6502
|
+
command,
|
|
6503
|
+
purpose,
|
|
6504
|
+
cwd: cwd || ".",
|
|
6505
|
+
timeoutMs: Math.round(seconds * 1e3)
|
|
6506
|
+
};
|
|
6507
|
+
});
|
|
6508
|
+
const writablePaths = collectFlagValues(process.argv, "writable");
|
|
6509
|
+
const client = createClient2();
|
|
6510
|
+
try {
|
|
6511
|
+
const response = await client.verifications(args2.id).create({
|
|
6512
|
+
recipientAgentId: args2.agent,
|
|
6513
|
+
snapshotId: args2.snapshot,
|
|
6514
|
+
checks,
|
|
6515
|
+
summary: args2.summary ?? null,
|
|
6516
|
+
...writablePaths.length > 0 ? { writablePaths } : {}
|
|
6517
|
+
});
|
|
6518
|
+
if ("blocked" in response) {
|
|
6519
|
+
console.error(`blocked (${response.blocked.reason}): ${response.blocked.detail}`);
|
|
6520
|
+
process.exit(1);
|
|
6521
|
+
}
|
|
6522
|
+
if (args2.json) {
|
|
6523
|
+
console.log(JSON.stringify(response.request, null, 2));
|
|
6524
|
+
return;
|
|
6525
|
+
}
|
|
6526
|
+
console.log(
|
|
6527
|
+
`captured ${response.request.request.id} (state ${response.request.request.state})`
|
|
6528
|
+
);
|
|
6529
|
+
console.log("the specialist is admitted by the verification scheduler; nothing has run yet");
|
|
6530
|
+
} catch (error) {
|
|
6531
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
6532
|
+
process.exit(1);
|
|
6533
|
+
}
|
|
6534
|
+
}
|
|
6535
|
+
});
|
|
6536
|
+
var listCmd10 = defineCommand30({
|
|
6537
|
+
meta: { name: "list", description: "List verification requests for a Team" },
|
|
6538
|
+
args: {
|
|
6539
|
+
...slug2,
|
|
6540
|
+
json: { type: "boolean", description: "Emit JSON" }
|
|
6541
|
+
},
|
|
6542
|
+
async run({ args: args2 }) {
|
|
6543
|
+
const client = createClient2();
|
|
6544
|
+
const response = await client.verifications(args2.id).list();
|
|
6545
|
+
if (args2.json) {
|
|
6546
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6547
|
+
return;
|
|
6548
|
+
}
|
|
6549
|
+
if (response.requests.length === 0) {
|
|
6550
|
+
console.log("no verification requests");
|
|
6551
|
+
return;
|
|
6552
|
+
}
|
|
6553
|
+
const rows = [
|
|
6554
|
+
["ID", "STATE", "SPECIALIST", "CHANGE"],
|
|
6555
|
+
...response.requests.map((entry3) => [
|
|
6556
|
+
entry3.request.id,
|
|
6557
|
+
entry3.request.state,
|
|
6558
|
+
entry3.request.recipientAgentId,
|
|
6559
|
+
entry3.request.snapshot.id.slice(0, 12)
|
|
6560
|
+
])
|
|
6561
|
+
];
|
|
6562
|
+
for (const line of columnize(rows)) console.log(line);
|
|
6563
|
+
console.log("run `bazilion team verify show <slug> <id>` for a request's current applicability");
|
|
6564
|
+
}
|
|
6565
|
+
});
|
|
6566
|
+
var showCmd6 = defineCommand30({
|
|
6567
|
+
meta: { name: "show", description: "Show one verification request and its evidence" },
|
|
6568
|
+
args: {
|
|
6569
|
+
...slug2,
|
|
6570
|
+
requestId: { type: "positional", required: true, description: "Verification request id" },
|
|
6571
|
+
json: { type: "boolean", description: "Emit JSON" }
|
|
6572
|
+
},
|
|
6573
|
+
async run({ args: args2 }) {
|
|
6574
|
+
const client = createClient2();
|
|
6575
|
+
try {
|
|
6576
|
+
const response = await client.verifications(args2.id).show(args2.requestId);
|
|
6577
|
+
if (args2.json) {
|
|
6578
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6579
|
+
return;
|
|
6580
|
+
}
|
|
6581
|
+
printReport(response.request);
|
|
6582
|
+
} catch (error) {
|
|
6583
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
6584
|
+
process.exit(1);
|
|
6585
|
+
}
|
|
6586
|
+
}
|
|
6587
|
+
});
|
|
6588
|
+
var cancelCmd2 = defineCommand30({
|
|
6589
|
+
meta: { name: "cancel", description: "Cancel a pending or running verification request" },
|
|
6590
|
+
args: {
|
|
6591
|
+
...slug2,
|
|
6592
|
+
requestId: { type: "positional", required: true, description: "Verification request id" },
|
|
6593
|
+
json: { type: "boolean", description: "Emit JSON" }
|
|
6594
|
+
},
|
|
6595
|
+
async run({ args: args2 }) {
|
|
6596
|
+
const client = createClient2();
|
|
6597
|
+
try {
|
|
6598
|
+
const response = await client.verifications(args2.id).cancel(args2.requestId);
|
|
6599
|
+
if (args2.json) {
|
|
6600
|
+
console.log(JSON.stringify(response, null, 2));
|
|
6601
|
+
return;
|
|
6602
|
+
}
|
|
6603
|
+
console.log(`cancelled or cancelled-pending: ${response.request.request.id}`);
|
|
6604
|
+
printReport(response.request);
|
|
6605
|
+
} catch (error) {
|
|
6606
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
6607
|
+
process.exit(1);
|
|
6608
|
+
}
|
|
6609
|
+
}
|
|
6610
|
+
});
|
|
6611
|
+
var verifyCommand = defineCommand30({
|
|
6612
|
+
meta: {
|
|
6613
|
+
name: "verify",
|
|
6614
|
+
description: "Specialist verification of a captured code change (BAZ-044)"
|
|
6615
|
+
},
|
|
6616
|
+
subCommands: {
|
|
6617
|
+
create: createCmd3,
|
|
6618
|
+
list: listCmd10,
|
|
6619
|
+
show: showCmd6,
|
|
6620
|
+
cancel: cancelCmd2
|
|
6621
|
+
}
|
|
6622
|
+
});
|
|
6623
|
+
|
|
6356
6624
|
// src/commands/team.ts
|
|
6357
|
-
var addCmd2 =
|
|
6625
|
+
var addCmd2 = defineCommand31({
|
|
6358
6626
|
meta: {
|
|
6359
6627
|
name: "add",
|
|
6360
6628
|
description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
|
|
@@ -6378,7 +6646,7 @@ var addCmd2 = defineCommand30({
|
|
|
6378
6646
|
console.log(`registered team ${g.id} at ${g.path}`);
|
|
6379
6647
|
}
|
|
6380
6648
|
});
|
|
6381
|
-
var
|
|
6649
|
+
var listCmd11 = defineCommand31({
|
|
6382
6650
|
meta: { name: "list", description: "List teams" },
|
|
6383
6651
|
async run() {
|
|
6384
6652
|
const client = createClient2();
|
|
@@ -6391,7 +6659,7 @@ var listCmd10 = defineCommand30({
|
|
|
6391
6659
|
for (const line of columnize(rows)) console.log(line);
|
|
6392
6660
|
}
|
|
6393
6661
|
});
|
|
6394
|
-
var rmCmd5 =
|
|
6662
|
+
var rmCmd5 = defineCommand31({
|
|
6395
6663
|
meta: { name: "rm", description: "Remove a team registration" },
|
|
6396
6664
|
args: {
|
|
6397
6665
|
id: { type: "positional", required: true }
|
|
@@ -6412,7 +6680,7 @@ async function readStdin() {
|
|
|
6412
6680
|
for await (const chunk of stdin2) chunks.push(chunk);
|
|
6413
6681
|
return Buffer.concat(chunks).toString("utf8");
|
|
6414
6682
|
}
|
|
6415
|
-
var userMdShowCmd =
|
|
6683
|
+
var userMdShowCmd = defineCommand31({
|
|
6416
6684
|
meta: { name: "show", description: "Print the team's USER.md" },
|
|
6417
6685
|
args: { id: { type: "positional", required: true } },
|
|
6418
6686
|
async run({ args: args2 }) {
|
|
@@ -6422,7 +6690,7 @@ var userMdShowCmd = defineCommand30({
|
|
|
6422
6690
|
if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
|
|
6423
6691
|
}
|
|
6424
6692
|
});
|
|
6425
|
-
var userMdSetCmd =
|
|
6693
|
+
var userMdSetCmd = defineCommand31({
|
|
6426
6694
|
meta: {
|
|
6427
6695
|
name: "set",
|
|
6428
6696
|
description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
|
|
@@ -6448,7 +6716,7 @@ var userMdSetCmd = defineCommand30({
|
|
|
6448
6716
|
console.log(`updated USER.md for team ${args2.id} (${content.length} bytes)`);
|
|
6449
6717
|
}
|
|
6450
6718
|
});
|
|
6451
|
-
var userMdClearCmd =
|
|
6719
|
+
var userMdClearCmd = defineCommand31({
|
|
6452
6720
|
meta: { name: "clear", description: "Clear the team's USER.md to empty" },
|
|
6453
6721
|
args: { id: { type: "positional", required: true } },
|
|
6454
6722
|
async run({ args: args2 }) {
|
|
@@ -6458,7 +6726,7 @@ var userMdClearCmd = defineCommand30({
|
|
|
6458
6726
|
console.log(`cleared USER.md for team ${args2.id}`);
|
|
6459
6727
|
}
|
|
6460
6728
|
});
|
|
6461
|
-
var userMdCmd =
|
|
6729
|
+
var userMdCmd = defineCommand31({
|
|
6462
6730
|
meta: { name: "user-md", description: "View or edit a team's USER.md" },
|
|
6463
6731
|
subCommands: {
|
|
6464
6732
|
show: userMdShowCmd,
|
|
@@ -6466,7 +6734,7 @@ var userMdCmd = defineCommand30({
|
|
|
6466
6734
|
clear: userMdClearCmd
|
|
6467
6735
|
}
|
|
6468
6736
|
});
|
|
6469
|
-
var topicFormatShowCmd =
|
|
6737
|
+
var topicFormatShowCmd = defineCommand31({
|
|
6470
6738
|
meta: { name: "show", description: "Print the team's Telegram topic-name template" },
|
|
6471
6739
|
args: { id: { type: "positional", required: true } },
|
|
6472
6740
|
async run({ args: args2 }) {
|
|
@@ -6475,7 +6743,7 @@ var topicFormatShowCmd = defineCommand30({
|
|
|
6475
6743
|
console.log(g.telegramTopicNameFormat ?? "(default naming)");
|
|
6476
6744
|
}
|
|
6477
6745
|
});
|
|
6478
|
-
var topicFormatSetCmd =
|
|
6746
|
+
var topicFormatSetCmd = defineCommand31({
|
|
6479
6747
|
meta: {
|
|
6480
6748
|
name: "set",
|
|
6481
6749
|
description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
|
|
@@ -6495,7 +6763,7 @@ var topicFormatSetCmd = defineCommand30({
|
|
|
6495
6763
|
console.log(`set topic-name template for team ${args2.id}: ${g.telegramTopicNameFormat}`);
|
|
6496
6764
|
}
|
|
6497
6765
|
});
|
|
6498
|
-
var topicFormatClearCmd =
|
|
6766
|
+
var topicFormatClearCmd = defineCommand31({
|
|
6499
6767
|
meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
|
|
6500
6768
|
args: { id: { type: "positional", required: true } },
|
|
6501
6769
|
async run({ args: args2 }) {
|
|
@@ -6505,7 +6773,7 @@ var topicFormatClearCmd = defineCommand30({
|
|
|
6505
6773
|
console.log(`cleared topic-name template for team ${args2.id}`);
|
|
6506
6774
|
}
|
|
6507
6775
|
});
|
|
6508
|
-
var topicFormatCmd =
|
|
6776
|
+
var topicFormatCmd = defineCommand31({
|
|
6509
6777
|
meta: {
|
|
6510
6778
|
name: "topic-format",
|
|
6511
6779
|
description: "View or edit a team's Telegram forum-topic name template"
|
|
@@ -6516,7 +6784,7 @@ var topicFormatCmd = defineCommand30({
|
|
|
6516
6784
|
clear: topicFormatClearCmd
|
|
6517
6785
|
}
|
|
6518
6786
|
});
|
|
6519
|
-
var contextCmd =
|
|
6787
|
+
var contextCmd = defineCommand31({
|
|
6520
6788
|
meta: {
|
|
6521
6789
|
name: "context",
|
|
6522
6790
|
description: "Inspect repository instructions, Git state and command suggestions"
|
|
@@ -6563,15 +6831,16 @@ var contextCmd = defineCommand30({
|
|
|
6563
6831
|
console.log(` ${issue.code}${issue.path ? `: ${safe2(issue.path)}` : ""} \u2014 ${issue.message}`);
|
|
6564
6832
|
}
|
|
6565
6833
|
});
|
|
6566
|
-
var teamCommand =
|
|
6834
|
+
var teamCommand = defineCommand31({
|
|
6567
6835
|
meta: { name: "team", description: "Manage teams (collaboration contexts)" },
|
|
6568
6836
|
subCommands: {
|
|
6569
6837
|
environment: teamEnvironmentCommand,
|
|
6570
6838
|
log: teamCodingLogCommand,
|
|
6571
6839
|
review: teamReviewCommand,
|
|
6840
|
+
verify: verifyCommand,
|
|
6572
6841
|
context: contextCmd,
|
|
6573
6842
|
add: addCmd2,
|
|
6574
|
-
list:
|
|
6843
|
+
list: listCmd11,
|
|
6575
6844
|
rm: rmCmd5,
|
|
6576
6845
|
"user-md": userMdCmd,
|
|
6577
6846
|
"topic-format": topicFormatCmd,
|
|
@@ -6581,7 +6850,7 @@ var teamCommand = defineCommand30({
|
|
|
6581
6850
|
|
|
6582
6851
|
// src/commands/team-template.ts
|
|
6583
6852
|
import { readFileSync as readFileSync12 } from "fs";
|
|
6584
|
-
import { defineCommand as
|
|
6853
|
+
import { defineCommand as defineCommand32 } from "citty";
|
|
6585
6854
|
function jsonFile(path) {
|
|
6586
6855
|
try {
|
|
6587
6856
|
return JSON.parse(readFileSync12(path, "utf8"));
|
|
@@ -6609,7 +6878,7 @@ function printTeam(detail) {
|
|
|
6609
6878
|
console.log(line);
|
|
6610
6879
|
}
|
|
6611
6880
|
}
|
|
6612
|
-
var list7 =
|
|
6881
|
+
var list7 = defineCommand32({
|
|
6613
6882
|
meta: { name: "list", description: "List canonical Team templates" },
|
|
6614
6883
|
args: { json: { type: "boolean", description: "Emit stable JSON" } },
|
|
6615
6884
|
async run({ args: args2 }) {
|
|
@@ -6623,7 +6892,7 @@ var list7 = defineCommand31({
|
|
|
6623
6892
|
console.log(line);
|
|
6624
6893
|
}
|
|
6625
6894
|
});
|
|
6626
|
-
var show6 =
|
|
6895
|
+
var show6 = defineCommand32({
|
|
6627
6896
|
meta: { name: "show", description: "Show a canonical Team template" },
|
|
6628
6897
|
args: {
|
|
6629
6898
|
id: { type: "positional", required: true },
|
|
@@ -6637,7 +6906,7 @@ var show6 = defineCommand31({
|
|
|
6637
6906
|
else printTeam(detail);
|
|
6638
6907
|
}
|
|
6639
6908
|
});
|
|
6640
|
-
var exportCommand2 =
|
|
6909
|
+
var exportCommand2 = defineCommand32({
|
|
6641
6910
|
meta: {
|
|
6642
6911
|
name: "export",
|
|
6643
6912
|
description: "Export a portable versioned Team-template document to stdout"
|
|
@@ -6677,7 +6946,7 @@ function printImportDiff(current, document) {
|
|
|
6677
6946
|
for (const value of diff2.added) console.log(` + ${value}`);
|
|
6678
6947
|
for (const value of diff2.removed) console.log(` - ${value}`);
|
|
6679
6948
|
}
|
|
6680
|
-
var importCommand2 =
|
|
6949
|
+
var importCommand2 = defineCommand32({
|
|
6681
6950
|
meta: {
|
|
6682
6951
|
name: "import",
|
|
6683
6952
|
description: "Validate, diff, and explicitly apply a portable Team-template document"
|
|
@@ -6758,7 +7027,7 @@ var importCommand2 = defineCommand31({
|
|
|
6758
7027
|
);
|
|
6759
7028
|
}
|
|
6760
7029
|
});
|
|
6761
|
-
var teamTemplateCommand =
|
|
7030
|
+
var teamTemplateCommand = defineCommand32({
|
|
6762
7031
|
meta: {
|
|
6763
7032
|
name: "team-template",
|
|
6764
7033
|
description: "Inspect and exchange canonical Team templates"
|
|
@@ -6767,8 +7036,8 @@ var teamTemplateCommand = defineCommand31({
|
|
|
6767
7036
|
});
|
|
6768
7037
|
|
|
6769
7038
|
// src/commands/telegram.ts
|
|
6770
|
-
import { defineCommand as
|
|
6771
|
-
var setCmd2 =
|
|
7039
|
+
import { defineCommand as defineCommand33 } from "citty";
|
|
7040
|
+
var setCmd2 = defineCommand33({
|
|
6772
7041
|
meta: {
|
|
6773
7042
|
name: "set",
|
|
6774
7043
|
description: "Save bot token + supergroup chat ID (paired write)"
|
|
@@ -6786,7 +7055,7 @@ var setCmd2 = defineCommand32({
|
|
|
6786
7055
|
console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
|
|
6787
7056
|
}
|
|
6788
7057
|
});
|
|
6789
|
-
var clearCmd =
|
|
7058
|
+
var clearCmd = defineCommand33({
|
|
6790
7059
|
meta: {
|
|
6791
7060
|
name: "clear",
|
|
6792
7061
|
description: "Remove stored bot token + chat ID"
|
|
@@ -6797,7 +7066,7 @@ var clearCmd = defineCommand32({
|
|
|
6797
7066
|
console.log("cleared");
|
|
6798
7067
|
}
|
|
6799
7068
|
});
|
|
6800
|
-
var
|
|
7069
|
+
var showCmd7 = defineCommand33({
|
|
6801
7070
|
meta: {
|
|
6802
7071
|
name: "show",
|
|
6803
7072
|
description: "Show what credentials are stored (token is masked)"
|
|
@@ -6818,7 +7087,7 @@ var showCmd6 = defineCommand32({
|
|
|
6818
7087
|
}
|
|
6819
7088
|
}
|
|
6820
7089
|
});
|
|
6821
|
-
var reconnectCmd =
|
|
7090
|
+
var reconnectCmd = defineCommand33({
|
|
6822
7091
|
meta: {
|
|
6823
7092
|
name: "reconnect",
|
|
6824
7093
|
description: "Apply a pending supergroup chat-id migration + re-activate the bot"
|
|
@@ -6829,7 +7098,7 @@ var reconnectCmd = defineCommand32({
|
|
|
6829
7098
|
console.log(`reconnected \xB7 chat ${state.chatId}`);
|
|
6830
7099
|
}
|
|
6831
7100
|
});
|
|
6832
|
-
var configCmd =
|
|
7101
|
+
var configCmd = defineCommand33({
|
|
6833
7102
|
meta: {
|
|
6834
7103
|
name: "config",
|
|
6835
7104
|
description: "Manage Telegram credentials (bot token + chat ID)"
|
|
@@ -6837,10 +7106,10 @@ var configCmd = defineCommand32({
|
|
|
6837
7106
|
subCommands: {
|
|
6838
7107
|
set: setCmd2,
|
|
6839
7108
|
clear: clearCmd,
|
|
6840
|
-
show:
|
|
7109
|
+
show: showCmd7
|
|
6841
7110
|
}
|
|
6842
7111
|
});
|
|
6843
|
-
var healthCmd =
|
|
7112
|
+
var healthCmd = defineCommand33({
|
|
6844
7113
|
meta: {
|
|
6845
7114
|
name: "health",
|
|
6846
7115
|
description: "Run the four-step preflight against the Telegram Bot API"
|
|
@@ -6879,7 +7148,7 @@ var healthCmd = defineCommand32({
|
|
|
6879
7148
|
if (!allOk) process.exitCode = 1;
|
|
6880
7149
|
}
|
|
6881
7150
|
});
|
|
6882
|
-
var botStatusCmd =
|
|
7151
|
+
var botStatusCmd = defineCommand33({
|
|
6883
7152
|
meta: {
|
|
6884
7153
|
name: "status",
|
|
6885
7154
|
description: "Show polling state of the live bot"
|
|
@@ -6904,7 +7173,7 @@ var botStatusCmd = defineCommand32({
|
|
|
6904
7173
|
if (!p.running) process.exitCode = 1;
|
|
6905
7174
|
}
|
|
6906
7175
|
});
|
|
6907
|
-
var botRestartCmd =
|
|
7176
|
+
var botRestartCmd = defineCommand33({
|
|
6908
7177
|
meta: {
|
|
6909
7178
|
name: "restart",
|
|
6910
7179
|
description: "Force-restart the bot (tears down + brings up from current creds)"
|
|
@@ -6915,7 +7184,7 @@ var botRestartCmd = defineCommand32({
|
|
|
6915
7184
|
console.log("restart requested");
|
|
6916
7185
|
}
|
|
6917
7186
|
});
|
|
6918
|
-
var botCmd =
|
|
7187
|
+
var botCmd = defineCommand33({
|
|
6919
7188
|
meta: {
|
|
6920
7189
|
name: "bot",
|
|
6921
7190
|
description: "Inspect / control the live polling bot"
|
|
@@ -6925,7 +7194,7 @@ var botCmd = defineCommand32({
|
|
|
6925
7194
|
restart: botRestartCmd
|
|
6926
7195
|
}
|
|
6927
7196
|
});
|
|
6928
|
-
var bindCmd =
|
|
7197
|
+
var bindCmd = defineCommand33({
|
|
6929
7198
|
meta: {
|
|
6930
7199
|
name: "bind",
|
|
6931
7200
|
description: "Create a Telegram topic for an agent (manual fallback for /talk)"
|
|
@@ -6943,7 +7212,7 @@ var bindCmd = defineCommand32({
|
|
|
6943
7212
|
console.log(` ${result.deepLink}`);
|
|
6944
7213
|
}
|
|
6945
7214
|
});
|
|
6946
|
-
var unbindCmd =
|
|
7215
|
+
var unbindCmd = defineCommand33({
|
|
6947
7216
|
meta: {
|
|
6948
7217
|
name: "unbind",
|
|
6949
7218
|
description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
|
|
@@ -6957,7 +7226,7 @@ var unbindCmd = defineCommand32({
|
|
|
6957
7226
|
console.log(`unbound agent ${args2.agent}`);
|
|
6958
7227
|
}
|
|
6959
7228
|
});
|
|
6960
|
-
var listBindingsCmd =
|
|
7229
|
+
var listBindingsCmd = defineCommand33({
|
|
6961
7230
|
meta: {
|
|
6962
7231
|
name: "list",
|
|
6963
7232
|
description: "List agents and their Telegram topic bindings"
|
|
@@ -6985,7 +7254,7 @@ var listBindingsCmd = defineCommand32({
|
|
|
6985
7254
|
}
|
|
6986
7255
|
}
|
|
6987
7256
|
});
|
|
6988
|
-
var allowCmd =
|
|
7257
|
+
var allowCmd = defineCommand33({
|
|
6989
7258
|
meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
|
|
6990
7259
|
args: {
|
|
6991
7260
|
userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
|
|
@@ -7001,7 +7270,7 @@ var allowCmd = defineCommand32({
|
|
|
7001
7270
|
console.log(`allowed ${u.userId} (${u.role})`);
|
|
7002
7271
|
}
|
|
7003
7272
|
});
|
|
7004
|
-
var denyCmd =
|
|
7273
|
+
var denyCmd = defineCommand33({
|
|
7005
7274
|
meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
|
|
7006
7275
|
args: { userId: { type: "positional", required: true } },
|
|
7007
7276
|
async run({ args: args2 }) {
|
|
@@ -7010,7 +7279,7 @@ var denyCmd = defineCommand32({
|
|
|
7010
7279
|
console.log(`removed ${args2.userId}`);
|
|
7011
7280
|
}
|
|
7012
7281
|
});
|
|
7013
|
-
var allowedCmd =
|
|
7282
|
+
var allowedCmd = defineCommand33({
|
|
7014
7283
|
meta: { name: "allowed", description: "List allowlisted Telegram users" },
|
|
7015
7284
|
async run() {
|
|
7016
7285
|
const client = createClient2();
|
|
@@ -7025,7 +7294,7 @@ var allowedCmd = defineCommand32({
|
|
|
7025
7294
|
}
|
|
7026
7295
|
}
|
|
7027
7296
|
});
|
|
7028
|
-
var pairingCreateCmd =
|
|
7297
|
+
var pairingCreateCmd = defineCommand33({
|
|
7029
7298
|
meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
|
|
7030
7299
|
async run() {
|
|
7031
7300
|
const result = await createClient2().post(
|
|
@@ -7036,7 +7305,7 @@ var pairingCreateCmd = defineCommand32({
|
|
|
7036
7305
|
console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
|
|
7037
7306
|
}
|
|
7038
7307
|
});
|
|
7039
|
-
var pairingStatusCmd =
|
|
7308
|
+
var pairingStatusCmd = defineCommand33({
|
|
7040
7309
|
meta: { name: "status", description: "Show Telegram owner pairing status" },
|
|
7041
7310
|
async run() {
|
|
7042
7311
|
const result = await createClient2().get("/api/config/telegram/pairing");
|
|
@@ -7047,14 +7316,14 @@ var pairingStatusCmd = defineCommand32({
|
|
|
7047
7316
|
console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
|
|
7048
7317
|
}
|
|
7049
7318
|
});
|
|
7050
|
-
var pairingCancelCmd =
|
|
7319
|
+
var pairingCancelCmd = defineCommand33({
|
|
7051
7320
|
meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
|
|
7052
7321
|
async run() {
|
|
7053
7322
|
await createClient2().del("/api/config/telegram/pairing/challenge");
|
|
7054
7323
|
console.log("pairing challenge cancelled");
|
|
7055
7324
|
}
|
|
7056
7325
|
});
|
|
7057
|
-
var pairingResetCmd =
|
|
7326
|
+
var pairingResetCmd = defineCommand33({
|
|
7058
7327
|
meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
|
|
7059
7328
|
args: {
|
|
7060
7329
|
yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
|
|
@@ -7065,7 +7334,7 @@ var pairingResetCmd = defineCommand32({
|
|
|
7065
7334
|
console.log("Telegram owner reset; ingress is closed until re-paired");
|
|
7066
7335
|
}
|
|
7067
7336
|
});
|
|
7068
|
-
var pairingCmd =
|
|
7337
|
+
var pairingCmd = defineCommand33({
|
|
7069
7338
|
meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
|
|
7070
7339
|
subCommands: {
|
|
7071
7340
|
create: pairingCreateCmd,
|
|
@@ -7074,7 +7343,7 @@ var pairingCmd = defineCommand32({
|
|
|
7074
7343
|
reset: pairingResetCmd
|
|
7075
7344
|
}
|
|
7076
7345
|
});
|
|
7077
|
-
var telegramCommand =
|
|
7346
|
+
var telegramCommand = defineCommand33({
|
|
7078
7347
|
meta: {
|
|
7079
7348
|
name: "telegram",
|
|
7080
7349
|
description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
|
|
@@ -7095,7 +7364,7 @@ var telegramCommand = defineCommand32({
|
|
|
7095
7364
|
});
|
|
7096
7365
|
|
|
7097
7366
|
// src/commands/token.ts
|
|
7098
|
-
import { defineCommand as
|
|
7367
|
+
import { defineCommand as defineCommand34 } from "citty";
|
|
7099
7368
|
import qrcode from "qrcode-terminal";
|
|
7100
7369
|
function tokenRow(t) {
|
|
7101
7370
|
const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
|
|
@@ -7124,7 +7393,7 @@ function resolveQrServer(override) {
|
|
|
7124
7393
|
}
|
|
7125
7394
|
return url.origin;
|
|
7126
7395
|
}
|
|
7127
|
-
var
|
|
7396
|
+
var createCmd4 = defineCommand34({
|
|
7128
7397
|
meta: { name: "create", description: "Mint a new web token (shown once)" },
|
|
7129
7398
|
args: {
|
|
7130
7399
|
label: { type: "positional", required: true, description: "Human-readable label" },
|
|
@@ -7167,7 +7436,7 @@ var createCmd3 = defineCommand33({
|
|
|
7167
7436
|
qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
|
|
7168
7437
|
}
|
|
7169
7438
|
});
|
|
7170
|
-
var
|
|
7439
|
+
var listCmd12 = defineCommand34({
|
|
7171
7440
|
meta: { name: "list", description: "List web tokens" },
|
|
7172
7441
|
args: {
|
|
7173
7442
|
all: { type: "boolean", description: "Include revoked tokens" }
|
|
@@ -7183,7 +7452,7 @@ var listCmd11 = defineCommand33({
|
|
|
7183
7452
|
for (const line of columnize(tokens.map(tokenRow))) console.log(line);
|
|
7184
7453
|
}
|
|
7185
7454
|
});
|
|
7186
|
-
var showLocalCmd =
|
|
7455
|
+
var showLocalCmd = defineCommand34({
|
|
7187
7456
|
meta: {
|
|
7188
7457
|
name: "show-local",
|
|
7189
7458
|
description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
|
|
@@ -7193,7 +7462,7 @@ var showLocalCmd = defineCommand33({
|
|
|
7193
7462
|
console.log(readAuthFile(paths.authFile).token);
|
|
7194
7463
|
}
|
|
7195
7464
|
});
|
|
7196
|
-
var revokeCmd2 =
|
|
7465
|
+
var revokeCmd2 = defineCommand34({
|
|
7197
7466
|
meta: { name: "revoke", description: "Revoke a web token" },
|
|
7198
7467
|
args: {
|
|
7199
7468
|
id: { type: "positional", required: true }
|
|
@@ -7204,19 +7473,19 @@ var revokeCmd2 = defineCommand33({
|
|
|
7204
7473
|
console.log(`revoked token ${args2.id}`);
|
|
7205
7474
|
}
|
|
7206
7475
|
});
|
|
7207
|
-
var tokenCommand =
|
|
7476
|
+
var tokenCommand = defineCommand34({
|
|
7208
7477
|
meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
|
|
7209
7478
|
subCommands: {
|
|
7210
|
-
create:
|
|
7211
|
-
list:
|
|
7479
|
+
create: createCmd4,
|
|
7480
|
+
list: listCmd12,
|
|
7212
7481
|
revoke: revokeCmd2,
|
|
7213
7482
|
"show-local": showLocalCmd
|
|
7214
7483
|
}
|
|
7215
7484
|
});
|
|
7216
7485
|
|
|
7217
7486
|
// src/commands/trigger.ts
|
|
7218
|
-
import { defineCommand as
|
|
7219
|
-
var addCmd3 =
|
|
7487
|
+
import { defineCommand as defineCommand35 } from "citty";
|
|
7488
|
+
var addCmd3 = defineCommand35({
|
|
7220
7489
|
meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
|
|
7221
7490
|
args: {
|
|
7222
7491
|
agent: { type: "positional", required: true },
|
|
@@ -7264,7 +7533,7 @@ function triggerRow(t) {
|
|
|
7264
7533
|
const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
|
|
7265
7534
|
return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
|
|
7266
7535
|
}
|
|
7267
|
-
var
|
|
7536
|
+
var listCmd13 = defineCommand35({
|
|
7268
7537
|
meta: { name: "list", description: "List triggers for an agent" },
|
|
7269
7538
|
args: {
|
|
7270
7539
|
agent: { type: "positional", required: true }
|
|
@@ -7281,7 +7550,7 @@ var listCmd12 = defineCommand34({
|
|
|
7281
7550
|
for (const line of columnize(triggers.map(triggerRow))) console.log(line);
|
|
7282
7551
|
}
|
|
7283
7552
|
});
|
|
7284
|
-
var rmCmd6 =
|
|
7553
|
+
var rmCmd6 = defineCommand35({
|
|
7285
7554
|
meta: { name: "rm", description: "Delete a trigger" },
|
|
7286
7555
|
args: {
|
|
7287
7556
|
id: { type: "positional", required: true }
|
|
@@ -7292,7 +7561,7 @@ var rmCmd6 = defineCommand34({
|
|
|
7292
7561
|
console.log(`removed trigger ${args2.id}`);
|
|
7293
7562
|
}
|
|
7294
7563
|
});
|
|
7295
|
-
var enableCmd3 =
|
|
7564
|
+
var enableCmd3 = defineCommand35({
|
|
7296
7565
|
meta: { name: "enable", description: "Enable a trigger" },
|
|
7297
7566
|
args: {
|
|
7298
7567
|
id: { type: "positional", required: true }
|
|
@@ -7304,7 +7573,7 @@ var enableCmd3 = defineCommand34({
|
|
|
7304
7573
|
console.log(`enabled trigger ${args2.id}`);
|
|
7305
7574
|
}
|
|
7306
7575
|
});
|
|
7307
|
-
var disableCmd3 =
|
|
7576
|
+
var disableCmd3 = defineCommand35({
|
|
7308
7577
|
meta: { name: "disable", description: "Disable a trigger" },
|
|
7309
7578
|
args: {
|
|
7310
7579
|
id: { type: "positional", required: true }
|
|
@@ -7316,7 +7585,7 @@ var disableCmd3 = defineCommand34({
|
|
|
7316
7585
|
console.log(`disabled trigger ${args2.id}`);
|
|
7317
7586
|
}
|
|
7318
7587
|
});
|
|
7319
|
-
var historyCmd =
|
|
7588
|
+
var historyCmd = defineCommand35({
|
|
7320
7589
|
meta: { name: "history", description: "Show recent dispatches for a trigger" },
|
|
7321
7590
|
args: {
|
|
7322
7591
|
id: { type: "positional", required: true },
|
|
@@ -7344,11 +7613,11 @@ var historyCmd = defineCommand34({
|
|
|
7344
7613
|
for (const line of columnize(rows)) console.log(line);
|
|
7345
7614
|
}
|
|
7346
7615
|
});
|
|
7347
|
-
var triggerCommand =
|
|
7616
|
+
var triggerCommand = defineCommand35({
|
|
7348
7617
|
meta: { name: "trigger", description: "Manage scheduled agent triggers" },
|
|
7349
7618
|
subCommands: {
|
|
7350
7619
|
add: addCmd3,
|
|
7351
|
-
list:
|
|
7620
|
+
list: listCmd13,
|
|
7352
7621
|
rm: rmCmd6,
|
|
7353
7622
|
enable: enableCmd3,
|
|
7354
7623
|
disable: disableCmd3,
|
|
@@ -7360,7 +7629,7 @@ var triggerCommand = defineCommand34({
|
|
|
7360
7629
|
import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync2, realpathSync as realpathSync2, rmSync as rmSync4 } from "fs";
|
|
7361
7630
|
import { homedir as homedir2 } from "os";
|
|
7362
7631
|
import { isAbsolute as isAbsolute2, join as join6, parse as parse2, relative as relative2, resolve as resolve5, sep } from "path";
|
|
7363
|
-
import { defineCommand as
|
|
7632
|
+
import { defineCommand as defineCommand36 } from "citty";
|
|
7364
7633
|
function makeLineReader() {
|
|
7365
7634
|
let buffer = "";
|
|
7366
7635
|
let ended = false;
|
|
@@ -7447,7 +7716,7 @@ function assertSafeUninstallHome(home) {
|
|
|
7447
7716
|
}
|
|
7448
7717
|
return target;
|
|
7449
7718
|
}
|
|
7450
|
-
var uninstallCommand =
|
|
7719
|
+
var uninstallCommand = defineCommand36({
|
|
7451
7720
|
meta: {
|
|
7452
7721
|
name: "uninstall",
|
|
7453
7722
|
description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
|
|
@@ -7551,7 +7820,7 @@ var uninstallCommand = defineCommand35({
|
|
|
7551
7820
|
|
|
7552
7821
|
// src/index.ts
|
|
7553
7822
|
var VERSION = package_default.version;
|
|
7554
|
-
var main =
|
|
7823
|
+
var main = defineCommand37({
|
|
7555
7824
|
meta: {
|
|
7556
7825
|
name: "bazilion",
|
|
7557
7826
|
version: VERSION,
|