bazilion 0.16.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 +672 -87
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +3759 -432
- package/dist/daemon.js.map +1 -1
- package/dist/migrations/0001_init.sql +169 -0
- package/dist/web/client/assets/ChatPane-CAYS_fIQ.js +76 -0
- package/dist/web/client/assets/ConfirmDialog-BzIiABOP.js +1 -0
- package/dist/web/client/assets/{FieldRow-DJ2Gx4Du.js → FieldRow-W_54rw5c.js} +1 -1
- package/dist/web/client/assets/ProductionTeamPolicyEditor-DNXVX8Lz.js +7 -0
- package/dist/web/client/assets/ProfileCommunicationEditor-DN0fOzqn.js +1 -0
- package/dist/web/client/assets/{ResultSourceConversation-CtzJ8QA-.js → ResultSourceConversation-DoU4tOWc.js} +1 -1
- package/dist/web/client/assets/TeamTabs-BmTZRI4T.js +1 -0
- package/dist/web/client/assets/TemplatesTabs-Bs_OXKwx.js +1 -0
- package/dist/web/client/assets/{UnsavedChangesGuard-BCsLw-mU.js → UnsavedChangesGuard-CPRtFReU.js} +1 -1
- package/dist/web/client/assets/{_id-DxopIW-y.js → _id-CxAB4TDr.js} +1 -1
- package/dist/web/client/assets/_id-DL4tJFQB.js +1 -0
- package/dist/web/client/assets/{_id-BEDmIXVf.js → _id-DR9eFC17.js} +1 -1
- package/dist/web/client/assets/{_id-BFM_tn_s.js → _id-Dbmei5tg.js} +1 -1
- package/dist/web/client/assets/{_id-B5Ov7cdO.js → _id-ybF-pqmr.js} +1 -1
- package/dist/web/client/assets/activity-oUyy77jD.js +1 -0
- package/dist/web/client/assets/{agents-CMPOFcs-.js → agents-D_TrEqAg.js} +1 -1
- package/dist/web/client/assets/{agents-O4soKZND.js → agents-DkjJp7JP.js} +1 -1
- package/dist/web/client/assets/{approvals-CwDu_lrA.js → approvals-DhOerWdt.js} +1 -1
- package/dist/web/client/assets/{attention-BY8MMuM_.js → attention-DGwiF-Jy.js} +1 -1
- package/dist/web/client/assets/chevron-right-DSa4xPTs.js +1 -0
- package/dist/web/client/assets/config-BJ2ZzHPR.js +3 -0
- package/dist/web/client/assets/createServerFn-Dzfjt7mA.js +3 -0
- package/dist/web/client/assets/git-review-presentation-CzHQulDk.js +1 -0
- package/dist/web/client/assets/{inbox-CWXql0K3.js → inbox-BUElnGep.js} +1 -1
- package/dist/web/client/assets/index-Bi-HxcPG.js +50 -0
- package/dist/web/client/assets/{learning-DAm4dyyc.js → learning-BiTHNwB3.js} +1 -1
- package/dist/web/client/assets/login-BmcZvAH2.js +1 -0
- package/dist/web/client/assets/{mcp-loLB0wuh.js → mcp-Cwk9V82W.js} +1 -1
- package/dist/web/client/assets/{members-BJ0ikkTl.js → members-CHDNabFh.js} +1 -1
- package/dist/web/client/assets/{memory-Drn9Gv53.js → memory-Cx_Fpd4e.js} +1 -1
- package/dist/web/client/assets/policy-C0nMdwcG.js +1 -0
- package/dist/web/client/assets/{results-9exU6f7m.js → results-Bz3jASs-.js} +1 -1
- package/dist/web/client/assets/review-AK9WGmpv.js +1 -0
- package/dist/web/client/assets/routes-DsMY_6oy.js +1 -0
- package/dist/web/client/assets/{services-BLso1BhA.js → services-DItA6fJ7.js} +1 -1
- package/dist/web/client/assets/{skills-BodqX3OI.js → skills-DbNV2vgL.js} +1 -1
- package/dist/web/client/assets/{styles-d1yjBpud.css → styles-C6br2xxl.css} +1 -1
- package/dist/web/client/assets/{teams-ByQedXZi.js → teams-D83scDxw.js} +1 -1
- package/dist/web/client/assets/{teams-SYsF1bOR.js → teams-DAny1ypN.js} +1 -1
- package/dist/web/client/assets/{telegram-DC9PLFbB.js → telegram-BOmf9vUh.js} +1 -1
- package/dist/web/client/assets/{tokens-DGy8Ijpo.js → tokens-DBGH6Bw5.js} +1 -1
- package/dist/web/client/assets/{triggers-BXpVmHDG.js → triggers-D1_pseI3.js} +1 -1
- package/dist/web/client/assets/verifications-CBTo-FyV.js +2 -0
- package/dist/web/client/assets/welcome-DAfPOm15.js +1 -0
- package/dist/web/client/assets/x-CWY-gUaM.js +1 -0
- package/dist/web/server/assets/{ChatPane-CS5oI7ef.js → ChatPane-DybH39WK.js} +301 -14
- package/dist/web/server/assets/{ResultSourceConversation-BpVWBRYq.js → ResultSourceConversation-BmXTcEOA.js} +1 -1
- package/dist/web/server/assets/{TeamTabs-TCKjCvMA.js → TeamTabs-Dg4v6x0-.js} +8 -0
- package/dist/web/server/assets/{_id-DtIYuJJX.js → _id--onriuvj.js} +1 -1
- package/dist/web/server/assets/{_id-DOnInzLb.js → _id--zoh1vv7.js} +1 -1
- package/dist/web/server/assets/{_id-CeyHEsCZ.js → _id-6p-mDmI8.js} +1 -1
- package/dist/web/server/assets/{_id-5pgKoid8.js → _id-BN1BPEDI.js} +1 -1
- package/dist/web/server/assets/{_id-DFHB9JFQ.js → _id-BYKpT2Tu.js} +1 -1
- package/dist/web/server/assets/{_id-B_-CDHOi2.js → _id-BqWTB8Wl.js} +1 -1
- package/dist/web/server/assets/{_id-BnqodC1c2.js → _id-C_2er0_G.js} +3 -3
- package/dist/web/server/assets/{_id-BG2nkGxa.js → _id-DptBl3X8.js} +1 -1
- package/dist/web/server/assets/{_id-DwZXhLlL.js → _id-EAjRXNbD.js} +2 -2
- package/dist/web/server/assets/{_id-DrB9uR1b.js → _id-dUnXL-My2.js} +1 -1
- package/dist/web/server/assets/{_tanstack-start-manifest_v-D7gKv6m6.js → _tanstack-start-manifest_v-B3M-dfRO.js} +108 -84
- package/dist/web/server/assets/{activity-0VUkStOu.js → activity-C5jpoEQI.js} +1 -1
- package/dist/web/server/assets/{activity-C88qrNqv.js → activity-Cu7zKPGD.js} +1 -1
- package/dist/web/server/assets/{activity-5fWKPDxj.js → activity-Dn50vkQP.js} +2 -2
- package/dist/web/server/assets/{agents-CSXLaM2W.js → agents-RE6aYOb-.js} +1 -1
- package/dist/web/server/assets/{agents-C86K6HvS.js → agents-nAOx_H7s.js} +1 -1
- package/dist/web/server/assets/{approvals-C3MysI6l.js → approvals-DhHxIDrL.js} +1 -1
- package/dist/web/server/assets/{attention-DLeLCKah.js → attention-CBWzWRni.js} +1 -1
- package/dist/web/server/assets/{auth-CDZp9aEk.js → auth-tB3i6cFd.js} +1 -1
- package/dist/web/server/assets/{config-BVTHvljR.js → config-D1k_tTAw.js} +1 -1
- package/dist/web/server/assets/{daemon-client-xWyYKAcx.js → daemon-client-C7qjQ2iO.js} +45 -0
- package/dist/web/server/assets/git-review-BB3M9nYg.js +26 -0
- package/dist/web/server/assets/git-review-Bf5ABFJg.js +179 -0
- package/dist/web/server/assets/git-review-presentation-TJiHJhen.js +81 -0
- package/dist/web/server/assets/{inbox-PQTrjtOw.js → inbox-Dw4pTevh.js} +1 -1
- package/dist/web/server/assets/{learning-K0cmDsZR.js → learning-CF8ZzFVD.js} +1 -1
- package/dist/web/server/assets/{mcp-Rtraochg.js → mcp-D5dmBT82.js} +1 -1
- package/dist/web/server/assets/{members-CD3GiTfF.js → members-Bd0OtiTr.js} +1 -1
- package/dist/web/server/assets/{members-grAKFWgv.js → members-CvwEN9pm.js} +1 -1
- package/dist/web/server/assets/{members-cc5SeEaW.js → members-xSXoYUOd.js} +2 -2
- package/dist/web/server/assets/{memory-egFpBD1g.js → memory-CcPK7um7.js} +1 -1
- package/dist/web/server/assets/{memory-C5i_GxlY.js → memory-UP6AsRkO.js} +2 -2
- package/dist/web/server/assets/{memory-CVqnyUaM.js → memory-lo2vHRNw.js} +1 -1
- package/dist/web/server/assets/{policy-bLKwvnja.js → policy-B62WXIFo.js} +1 -1
- package/dist/web/server/assets/{policy-Dgjb0_gK.js → policy-Bze9Krhg.js} +2 -2
- package/dist/web/server/assets/{policy-ooSBgiDS.js → policy-Dh6wd2wN.js} +1 -1
- package/dist/web/server/assets/{results-N-kP4iFT.js → results-BFqs2iOu.js} +1 -1
- package/dist/web/server/assets/{results-DXdYtHaq.js → results-BWnu3gXP.js} +1 -1
- package/dist/web/server/assets/{results-CfNsFncJ.js → results-CzZk50Fu.js} +3 -3
- package/dist/web/server/assets/review-DUe3vHPU.js +393 -0
- package/dist/web/server/assets/review-c_-cFi7H.js +14 -0
- package/dist/web/server/assets/{router-B6g_s7W3.js → router-Deq94UJQ.js} +41 -27
- package/dist/web/server/assets/{routes-pcRy_Sf8.js → routes-B6x3pEW8.js} +1 -1
- package/dist/web/server/assets/{routes-BqSaZvlu.js → routes-CVKkvFVv.js} +1 -1
- package/dist/web/server/assets/{routes-Dsh8F_7i.js → routes-DsUzzxk4.js} +2 -2
- package/dist/web/server/assets/{services-DlZA8fRL.js → services-CEr61xb5.js} +1 -1
- package/dist/web/server/assets/{skills-i2duvgW-.js → skills-BImC3LTO.js} +1 -1
- package/dist/web/server/assets/{teams-6RYIj1Xm.js → teams-8zEIo08E.js} +1 -1
- package/dist/web/server/assets/{teams-B1AI3NfN.js → teams-D-yaAWLV.js} +1 -1
- package/dist/web/server/assets/{telegram-C4q0YTVn.js → telegram-CGl_LFtJ.js} +1 -1
- package/dist/web/server/assets/{tokens-RFquA2Bx.js → tokens-cB-uf7qm.js} +1 -1
- package/dist/web/server/assets/{triggers-DVD-iE-N.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 +72 -28
- package/dist/worker.js +470 -79
- package/dist/worker.js.map +1 -1
- package/package.json +3 -3
- package/dist/web/client/assets/ChatPane-CQZzxOir.js +0 -76
- package/dist/web/client/assets/ConfirmDialog-MicTTwdy.js +0 -1
- package/dist/web/client/assets/ProductionTeamPolicyEditor-DqUnN_ce.js +0 -7
- package/dist/web/client/assets/ProfileCommunicationEditor-DArXub0b.js +0 -1
- package/dist/web/client/assets/TeamTabs-DbIk5vvT.js +0 -1
- package/dist/web/client/assets/TemplatesTabs-CatJIjGi.js +0 -1
- package/dist/web/client/assets/_id-CrnEVcw8.js +0 -1
- package/dist/web/client/assets/activity-CrG8Bg60.js +0 -1
- package/dist/web/client/assets/chevron-right-Cf6vKeLq.js +0 -1
- package/dist/web/client/assets/config-Cn4iBJFz.js +0 -3
- package/dist/web/client/assets/index-Bq2zrG2_.js +0 -52
- package/dist/web/client/assets/login-BsABI8Ux.js +0 -1
- package/dist/web/client/assets/policy-pQadZyk0.js +0 -1
- package/dist/web/client/assets/routes-jw1PuqiR.js +0 -1
- package/dist/web/client/assets/welcome-BKsnsCxJ.js +0 -1
- package/dist/web/client/assets/x-BK4xNCzS.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,58 @@ 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
|
+
},
|
|
206
|
+
/** Read-only Git change review and bounded source snapshots (BAZ-042). */
|
|
207
|
+
repositoryReview: (teamId) => {
|
|
208
|
+
const base = `/api/teams/${encodeURIComponent(teamId)}/review`;
|
|
209
|
+
return {
|
|
210
|
+
changes: (options = {}) => {
|
|
211
|
+
const params = new URLSearchParams();
|
|
212
|
+
if (options.base !== void 0) params.set("base", options.base);
|
|
213
|
+
if (options.patches) params.set("patches", "1");
|
|
214
|
+
const suffix = params.size ? `?${params}` : "";
|
|
215
|
+
return request("GET", `${base}${suffix}`);
|
|
216
|
+
},
|
|
217
|
+
snapshots: () => request("GET", `${base}/snapshots`),
|
|
218
|
+
snapshot: (snapshotId) => request("GET", `${base}/snapshots/${encodeURIComponent(snapshotId)}`),
|
|
219
|
+
capture: (input) => request("POST", `${base}/snapshots`, input)
|
|
220
|
+
};
|
|
221
|
+
},
|
|
222
|
+
/** Operator retained-diagnostic access for BAZ-041 receipts. */
|
|
223
|
+
codingLogs: (teamId) => {
|
|
224
|
+
const base = `/api/teams/${encodeURIComponent(teamId)}/coding-commands`;
|
|
225
|
+
const item = (commandId) => `${base}/${encodeURIComponent(commandId)}/log`;
|
|
226
|
+
return {
|
|
227
|
+
page: (commandId, options = {}) => {
|
|
228
|
+
const params = new URLSearchParams();
|
|
229
|
+
if (options.offset !== void 0) params.set("offset", String(options.offset));
|
|
230
|
+
if (options.limit !== void 0) params.set("limit", String(options.limit));
|
|
231
|
+
const suffix = params.size ? `?${params}` : "";
|
|
232
|
+
return request(
|
|
233
|
+
"GET",
|
|
234
|
+
`${item(commandId)}${suffix}`
|
|
235
|
+
);
|
|
236
|
+
},
|
|
237
|
+
search: (commandId, query) => request(
|
|
238
|
+
"GET",
|
|
239
|
+
`${item(commandId)}/search?q=${encodeURIComponent(query)}`
|
|
240
|
+
)
|
|
241
|
+
};
|
|
242
|
+
},
|
|
191
243
|
repositoryContext: (teamId, options = {}) => request(
|
|
192
244
|
"GET",
|
|
193
245
|
`/api/teams/${encodeURIComponent(teamId)}/repository-context${options.target !== void 0 ? `?target=${encodeURIComponent(options.target)}` : ""}`
|
|
@@ -836,6 +888,30 @@ async function promptForQuestion(item, prompt) {
|
|
|
836
888
|
}
|
|
837
889
|
}
|
|
838
890
|
|
|
891
|
+
// src/repeatable-args.ts
|
|
892
|
+
function collectFlagValues(rawArgs, name) {
|
|
893
|
+
const values = [];
|
|
894
|
+
const long = `--${name}`;
|
|
895
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
896
|
+
const arg = rawArgs[i];
|
|
897
|
+
if (arg === void 0) continue;
|
|
898
|
+
if (arg === "--") break;
|
|
899
|
+
if (arg === long) {
|
|
900
|
+
const next = rawArgs[i + 1];
|
|
901
|
+
if (next !== void 0 && next !== "--") {
|
|
902
|
+
values.push(next);
|
|
903
|
+
i++;
|
|
904
|
+
}
|
|
905
|
+
continue;
|
|
906
|
+
}
|
|
907
|
+
if (arg.startsWith(`${long}=`)) {
|
|
908
|
+
const value = arg.slice(long.length + 1);
|
|
909
|
+
if (value.length > 0) values.push(value);
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return values;
|
|
913
|
+
}
|
|
914
|
+
|
|
839
915
|
// src/commands/agent.ts
|
|
840
916
|
var IMAGE_MIME = {
|
|
841
917
|
".png": "image/png",
|
|
@@ -867,9 +943,6 @@ function loadFiles(paths) {
|
|
|
867
943
|
data: readFileSync3(p).toString("base64")
|
|
868
944
|
}));
|
|
869
945
|
}
|
|
870
|
-
function asPaths(v) {
|
|
871
|
-
return v ? Array.isArray(v) ? v : [v] : [];
|
|
872
|
-
}
|
|
873
946
|
var spawnCmd = defineCommand5({
|
|
874
947
|
meta: { name: "spawn", description: "Spawn an agent from a profile into a team" },
|
|
875
948
|
args: {
|
|
@@ -1224,20 +1297,20 @@ var chatCmd = defineCommand5({
|
|
|
1224
1297
|
},
|
|
1225
1298
|
image: {
|
|
1226
1299
|
type: "string",
|
|
1227
|
-
description: "Attach an image file (png/jpg/gif/webp;
|
|
1300
|
+
description: "Attach an image file (png/jpg/gif/webp; repeat the flag for more). One-shot mode."
|
|
1228
1301
|
},
|
|
1229
1302
|
file: {
|
|
1230
1303
|
type: "string",
|
|
1231
|
-
description: "Attach any file \u2014 the agent gets a path reference (
|
|
1304
|
+
description: "Attach any file \u2014 the agent gets a path reference (repeat the flag for more). One-shot mode."
|
|
1232
1305
|
}
|
|
1233
1306
|
},
|
|
1234
|
-
async run({ args: args2 }) {
|
|
1307
|
+
async run({ args: args2, rawArgs }) {
|
|
1235
1308
|
const client = createClient2();
|
|
1236
1309
|
const resolved = await client.get(`/api/agents/${args2.id}`);
|
|
1237
1310
|
const bashApprovalMode = bashApprovalModeForTty(stdin.isTTY, stdout.isTTY);
|
|
1238
1311
|
const attachments = [
|
|
1239
|
-
...loadImages(
|
|
1240
|
-
...loadFiles(
|
|
1312
|
+
...loadImages(collectFlagValues(rawArgs, "image")),
|
|
1313
|
+
...loadFiles(collectFlagValues(rawArgs, "file"))
|
|
1241
1314
|
];
|
|
1242
1315
|
if (args2.message || attachments.length > 0) {
|
|
1243
1316
|
const rl2 = bashApprovalMode === "interactive" ? createInterface({ input: stdin, output: stdout }) : null;
|
|
@@ -2226,6 +2299,48 @@ function invalidateRestoredCodingEvidence(db, payload, targetHome) {
|
|
|
2226
2299
|
row2.id
|
|
2227
2300
|
);
|
|
2228
2301
|
}
|
|
2302
|
+
const restoredAt = Date.now();
|
|
2303
|
+
db.prepare(
|
|
2304
|
+
`UPDATE coding_command_logs SET state = 'expired', text = NULL, byte_length = 0, retired_at = ?
|
|
2305
|
+
WHERE state = 'retained' AND expires_at <= ?`
|
|
2306
|
+
).run(restoredAt, restoredAt);
|
|
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
|
+
}
|
|
2229
2344
|
db.prepare("UPDATE workspace_writers SET state = 'recovery', recovery_mode = 'restored'").run();
|
|
2230
2345
|
const teams = db.prepare("SELECT id FROM teams").all();
|
|
2231
2346
|
const rebase = db.prepare("UPDATE workspace_writers SET root_path = ? WHERE team_id = ?");
|
|
@@ -2307,13 +2422,29 @@ function pauseRestoredUserQueue(database) {
|
|
|
2307
2422
|
// src/backup-schema.ts
|
|
2308
2423
|
import { createHash } from "crypto";
|
|
2309
2424
|
var CANONICAL_MIGRATION = "0001_init";
|
|
2310
|
-
var CANONICAL_SCHEMA_HASH = "
|
|
2425
|
+
var CANONICAL_SCHEMA_HASH = "cb3811823a7dead88cce0beb08cd4066ea3143258af0f0b8ba329016465dda37";
|
|
2311
2426
|
var CANONICAL_OBJECTS = [
|
|
2312
2427
|
["table", "team_coding_environments"],
|
|
2313
2428
|
["table", "workspace_writers"],
|
|
2314
2429
|
["table", "workspace_resources"],
|
|
2315
2430
|
["table", "coding_commands"],
|
|
2316
2431
|
["index", "coding_command_history"],
|
|
2432
|
+
["table", "coding_command_logs"],
|
|
2433
|
+
["index", "coding_command_logs_retention"],
|
|
2434
|
+
["index", "coding_command_logs_team_time"],
|
|
2435
|
+
["table", "source_snapshots"],
|
|
2436
|
+
["index", "source_snapshots_retention"],
|
|
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"],
|
|
2317
2448
|
["table", "notification_settings"],
|
|
2318
2449
|
["table", "notification_receipts"],
|
|
2319
2450
|
["index", "notification_receipts_state"],
|
|
@@ -4792,6 +4923,14 @@ import { readFileSync as readFileSync7, rmSync as rmSync3, writeFileSync as writ
|
|
|
4792
4923
|
import { tmpdir as tmpdir2 } from "os";
|
|
4793
4924
|
import { join as join4 } from "path";
|
|
4794
4925
|
|
|
4926
|
+
// ../../packages/api-types/src/git-review.ts
|
|
4927
|
+
var REVIEW_LIMITS = {
|
|
4928
|
+
files: 1e3,
|
|
4929
|
+
fileBytes: 1024 * 1024,
|
|
4930
|
+
totalBytes: 16 * 1024 * 1024,
|
|
4931
|
+
patchBytes: 256 * 1024
|
|
4932
|
+
};
|
|
4933
|
+
|
|
4795
4934
|
// ../../packages/api-types/src/index.ts
|
|
4796
4935
|
var PROFILE_FILES = [
|
|
4797
4936
|
"profile.json",
|
|
@@ -5541,25 +5680,82 @@ var skillCommand = defineCommand25({
|
|
|
5541
5680
|
// src/commands/team.ts
|
|
5542
5681
|
import { readFileSync as readFileSync11 } from "fs";
|
|
5543
5682
|
import { stdin as stdin2 } from "process";
|
|
5544
|
-
import { defineCommand as
|
|
5683
|
+
import { defineCommand as defineCommand31 } from "citty";
|
|
5684
|
+
|
|
5685
|
+
// src/commands/team-coding-log.ts
|
|
5686
|
+
import { defineCommand as defineCommand26 } from "citty";
|
|
5687
|
+
var teamCodingLogCommand = defineCommand26({
|
|
5688
|
+
meta: {
|
|
5689
|
+
name: "log",
|
|
5690
|
+
description: "Read retained diagnostics for a shared coding command receipt"
|
|
5691
|
+
},
|
|
5692
|
+
args: {
|
|
5693
|
+
team: { type: "positional", required: true, description: "Team slug" },
|
|
5694
|
+
commandId: { type: "positional", required: true, description: "Coding command id" },
|
|
5695
|
+
offset: { type: "string", description: "UTF-8 byte offset into the retained tail" },
|
|
5696
|
+
limit: { type: "string", description: "Maximum bytes to read (default 64 KiB)" },
|
|
5697
|
+
search: { type: "string", description: "Literal search instead of a page read" }
|
|
5698
|
+
},
|
|
5699
|
+
async run({ args: args2 }) {
|
|
5700
|
+
const client = createClient2().codingLogs(args2.team);
|
|
5701
|
+
if (args2.search !== void 0) {
|
|
5702
|
+
const { view: view2, result } = await client.search(args2.commandId, args2.search);
|
|
5703
|
+
if (!result) {
|
|
5704
|
+
console.log(`Coding log withheld (${view2.availability}); not shared for disclosure.`);
|
|
5705
|
+
return;
|
|
5706
|
+
}
|
|
5707
|
+
console.log(
|
|
5708
|
+
`${view2.availability}${result.bounded ? " \xB7 bounded scan" : ""} \xB7 ${result.matches.length} match(es)`
|
|
5709
|
+
);
|
|
5710
|
+
for (const match of result.matches) {
|
|
5711
|
+
console.log(`${match.line}:${match.offset} ${match.excerpt.replace(/\n/g, "\\n")}`);
|
|
5712
|
+
}
|
|
5713
|
+
return;
|
|
5714
|
+
}
|
|
5715
|
+
const offset = args2.offset === void 0 ? void 0 : Number(args2.offset);
|
|
5716
|
+
const limit = args2.limit === void 0 ? void 0 : Number(args2.limit);
|
|
5717
|
+
if (offset !== void 0 && (!Number.isSafeInteger(offset) || offset < 0) || limit !== void 0 && !Number.isSafeInteger(limit)) {
|
|
5718
|
+
console.error("offset and limit must be non-negative integers");
|
|
5719
|
+
process.exitCode = 1;
|
|
5720
|
+
return;
|
|
5721
|
+
}
|
|
5722
|
+
const { view, page } = await client.page(args2.commandId, {
|
|
5723
|
+
...offset !== void 0 ? { offset } : {},
|
|
5724
|
+
...limit !== void 0 ? { limit } : {}
|
|
5725
|
+
});
|
|
5726
|
+
if (!page) {
|
|
5727
|
+
console.log(`Coding log withheld (${view.availability}); not shared for disclosure.`);
|
|
5728
|
+
return;
|
|
5729
|
+
}
|
|
5730
|
+
console.log(
|
|
5731
|
+
`${view.availability} \xB7 ${view.byteLength} retained byte(s) of ${view.observedBytes} observed` + (view.redacted ? " \xB7 redacted" : "") + ` \xB7 expires ${new Date(view.expiresAt).toISOString()}`
|
|
5732
|
+
);
|
|
5733
|
+
process.stdout.write(page.text);
|
|
5734
|
+
if (page.hasMore)
|
|
5735
|
+
console.log(
|
|
5736
|
+
`
|
|
5737
|
+
\u2026 truncated; continue with --offset ${page.offset + Buffer.byteLength(page.text)}`
|
|
5738
|
+
);
|
|
5739
|
+
}
|
|
5740
|
+
});
|
|
5545
5741
|
|
|
5546
5742
|
// src/commands/team-environment.ts
|
|
5547
5743
|
import { readFileSync as readFileSync9 } from "fs";
|
|
5548
|
-
import { defineCommand as
|
|
5744
|
+
import { defineCommand as defineCommand27 } from "citty";
|
|
5549
5745
|
var args = { id: { type: "positional", required: true, description: "Team slug" } };
|
|
5550
|
-
var teamEnvironmentCommand =
|
|
5746
|
+
var teamEnvironmentCommand = defineCommand27({
|
|
5551
5747
|
meta: {
|
|
5552
5748
|
name: "environment",
|
|
5553
5749
|
description: "Optional Team runtime defaults; Agents discover and run commands during tasks"
|
|
5554
5750
|
},
|
|
5555
5751
|
subCommands: {
|
|
5556
|
-
show:
|
|
5752
|
+
show: defineCommand27({
|
|
5557
5753
|
args,
|
|
5558
5754
|
async run({ args: args2 }) {
|
|
5559
5755
|
console.log(JSON.stringify(await createClient2().codingEnvironment.show(args2.id), null, 2));
|
|
5560
5756
|
}
|
|
5561
5757
|
}),
|
|
5562
|
-
configure:
|
|
5758
|
+
configure: defineCommand27({
|
|
5563
5759
|
args: {
|
|
5564
5760
|
...args,
|
|
5565
5761
|
file: {
|
|
@@ -5582,7 +5778,7 @@ var teamEnvironmentCommand = defineCommand26({
|
|
|
5582
5778
|
|
|
5583
5779
|
// src/commands/team-policy.ts
|
|
5584
5780
|
import { readFileSync as readFileSync10 } from "fs";
|
|
5585
|
-
import { defineCommand as
|
|
5781
|
+
import { defineCommand as defineCommand28 } from "citty";
|
|
5586
5782
|
|
|
5587
5783
|
// src/team-interchange.ts
|
|
5588
5784
|
var TEAM_POLICY_INTERCHANGE_VERSION = 1;
|
|
@@ -5830,7 +6026,7 @@ function printPolicy(detail) {
|
|
|
5830
6026
|
console.log(line);
|
|
5831
6027
|
}
|
|
5832
6028
|
}
|
|
5833
|
-
var show5 =
|
|
6029
|
+
var show5 = defineCommand28({
|
|
5834
6030
|
meta: { name: "show", description: "Show the one effective live policy for a Team" },
|
|
5835
6031
|
args: {
|
|
5836
6032
|
team: { type: "positional", required: true },
|
|
@@ -5844,7 +6040,7 @@ var show5 = defineCommand27({
|
|
|
5844
6040
|
else printPolicy(detail);
|
|
5845
6041
|
}
|
|
5846
6042
|
});
|
|
5847
|
-
var exportCommand =
|
|
6043
|
+
var exportCommand = defineCommand28({
|
|
5848
6044
|
meta: { name: "export", description: "Export a revisioned Team policy document" },
|
|
5849
6045
|
args: { team: { type: "positional", required: true } },
|
|
5850
6046
|
async run({ args: args2 }) {
|
|
@@ -5868,7 +6064,7 @@ function printEdgeDiff(current, edges) {
|
|
|
5868
6064
|
for (const value of diff2.added) console.log(` + ${value}`);
|
|
5869
6065
|
for (const value of diff2.removed) console.log(` - ${value}`);
|
|
5870
6066
|
}
|
|
5871
|
-
var importCommand =
|
|
6067
|
+
var importCommand = defineCommand28({
|
|
5872
6068
|
meta: {
|
|
5873
6069
|
name: "import",
|
|
5874
6070
|
description: "Validate, diff, and explicitly replace a Team policy"
|
|
@@ -5923,7 +6119,7 @@ var importCommand = defineCommand27({
|
|
|
5923
6119
|
console.log(`updated Team ${args2.team} policy to revision ${updated.teamPolicy.revision}`);
|
|
5924
6120
|
}
|
|
5925
6121
|
});
|
|
5926
|
-
var diff =
|
|
6122
|
+
var diff = defineCommand28({
|
|
5927
6123
|
meta: { name: "diff", description: "Compare live policy with its retained baseline source" },
|
|
5928
6124
|
args: {
|
|
5929
6125
|
team: { type: "positional", required: true },
|
|
@@ -5947,7 +6143,7 @@ var diff = defineCommand27({
|
|
|
5947
6143
|
);
|
|
5948
6144
|
}
|
|
5949
6145
|
});
|
|
5950
|
-
var evaluate =
|
|
6146
|
+
var evaluate = defineCommand28({
|
|
5951
6147
|
meta: {
|
|
5952
6148
|
name: "evaluate",
|
|
5953
6149
|
description: "Evaluate a communication path without sending or recording a block"
|
|
@@ -5978,7 +6174,7 @@ var evaluate = defineCommand27({
|
|
|
5978
6174
|
);
|
|
5979
6175
|
}
|
|
5980
6176
|
});
|
|
5981
|
-
var blocks =
|
|
6177
|
+
var blocks = defineCommand28({
|
|
5982
6178
|
meta: { name: "blocks", description: "List paginated durable communication denials" },
|
|
5983
6179
|
args: {
|
|
5984
6180
|
team: { type: "positional", required: true },
|
|
@@ -6027,7 +6223,7 @@ var blocks = defineCommand27({
|
|
|
6027
6223
|
if (page.nextCursor) console.log(`next cursor: ${page.nextCursor}`);
|
|
6028
6224
|
}
|
|
6029
6225
|
});
|
|
6030
|
-
var teamPolicyCommand =
|
|
6226
|
+
var teamPolicyCommand = defineCommand28({
|
|
6031
6227
|
meta: { name: "policy", description: "Inspect and manage the Team-owned live policy" },
|
|
6032
6228
|
subCommands: {
|
|
6033
6229
|
show: show5,
|
|
@@ -6039,8 +6235,394 @@ var teamPolicyCommand = defineCommand27({
|
|
|
6039
6235
|
}
|
|
6040
6236
|
});
|
|
6041
6237
|
|
|
6238
|
+
// src/commands/team-review.ts
|
|
6239
|
+
import { defineCommand as defineCommand29 } from "citty";
|
|
6240
|
+
var slug = {
|
|
6241
|
+
id: { type: "positional", required: true, description: "Team slug" }
|
|
6242
|
+
};
|
|
6243
|
+
function printIssues(changes) {
|
|
6244
|
+
for (const issue of changes.issues) console.log(`note: ${issue.code}: ${issue.message}`);
|
|
6245
|
+
}
|
|
6246
|
+
var showCmd5 = defineCommand29({
|
|
6247
|
+
meta: {
|
|
6248
|
+
name: "show",
|
|
6249
|
+
description: "List changes since a baseline (read-only)"
|
|
6250
|
+
},
|
|
6251
|
+
args: {
|
|
6252
|
+
...slug,
|
|
6253
|
+
base: {
|
|
6254
|
+
type: "string",
|
|
6255
|
+
description: "Comparison base: branch, tag or commit id (default HEAD)"
|
|
6256
|
+
},
|
|
6257
|
+
patch: {
|
|
6258
|
+
type: "string",
|
|
6259
|
+
description: "Print the unified diff for one changed path instead of the list"
|
|
6260
|
+
},
|
|
6261
|
+
json: { type: "boolean", description: "Emit the complete review as JSON" }
|
|
6262
|
+
},
|
|
6263
|
+
async run({ args: args2 }) {
|
|
6264
|
+
const client = createClient2();
|
|
6265
|
+
const review = await client.repositoryReview(args2.id).changes({
|
|
6266
|
+
...args2.base ? { base: args2.base } : {},
|
|
6267
|
+
patches: true
|
|
6268
|
+
});
|
|
6269
|
+
if (args2.json) {
|
|
6270
|
+
console.log(JSON.stringify(review, null, 2));
|
|
6271
|
+
return;
|
|
6272
|
+
}
|
|
6273
|
+
const changes = review.changes;
|
|
6274
|
+
if (args2.patch) {
|
|
6275
|
+
const entry3 = changes.changes.find((change) => change.path === args2.patch);
|
|
6276
|
+
if (!entry3) {
|
|
6277
|
+
console.error(`no change for path: ${args2.patch}`);
|
|
6278
|
+
process.exit(1);
|
|
6279
|
+
}
|
|
6280
|
+
if (!entry3.patch) {
|
|
6281
|
+
console.log(
|
|
6282
|
+
`${entry3.path}: ${entry3.status}${entry3.contentOmitted ? ` (${entry3.contentOmitted})` : " (no content)"}`
|
|
6283
|
+
);
|
|
6284
|
+
return;
|
|
6285
|
+
}
|
|
6286
|
+
console.log(entry3.patch);
|
|
6287
|
+
if (entry3.patchTruncated) console.log("(diff truncated at the configured patch cap)");
|
|
6288
|
+
return;
|
|
6289
|
+
}
|
|
6290
|
+
console.log(
|
|
6291
|
+
`# ${changes.identity.branch ?? `detached ${changes.identity.head ?? "unborn"}`} \xB7 base ${changes.base.requestedRef} (${changes.base.resolvedOid.slice(0, 12)})`
|
|
6292
|
+
);
|
|
6293
|
+
if (changes.changes.length === 0) console.log("(no changes since baseline)");
|
|
6294
|
+
const rows = changes.changes.map((change) => [
|
|
6295
|
+
change.status,
|
|
6296
|
+
change.previousPath ? `${change.previousPath} -> ${change.path}` : change.path,
|
|
6297
|
+
change.binary ? "binary" : `${change.addedLines ?? 0}+ ${change.deletedLines ?? 0}-`,
|
|
6298
|
+
change.contentOmitted ?? ""
|
|
6299
|
+
]);
|
|
6300
|
+
for (const line of columnize(rows)) console.log(line);
|
|
6301
|
+
if (changes.truncated) console.log("note: the change list is incomplete (file limit)");
|
|
6302
|
+
const withheld = changes.withheld;
|
|
6303
|
+
if (withheld.excluded + withheld.untracked > 0) {
|
|
6304
|
+
console.log(
|
|
6305
|
+
`note: ${withheld.excluded} excluded and ${withheld.untracked} untracked path(s) withheld`
|
|
6306
|
+
);
|
|
6307
|
+
}
|
|
6308
|
+
printIssues(changes);
|
|
6309
|
+
}
|
|
6310
|
+
});
|
|
6311
|
+
var captureCmd = defineCommand29({
|
|
6312
|
+
meta: {
|
|
6313
|
+
name: "capture",
|
|
6314
|
+
description: "Capture a bounded source snapshot for a Team (read-only)"
|
|
6315
|
+
},
|
|
6316
|
+
args: {
|
|
6317
|
+
...slug,
|
|
6318
|
+
base: { type: "string", description: "Comparison base (default HEAD)" },
|
|
6319
|
+
include: {
|
|
6320
|
+
type: "string",
|
|
6321
|
+
// Read from raw arguments: citty keeps only the last value of a repeated flag.
|
|
6322
|
+
description: "Untracked path to include by content (repeat the flag for more)"
|
|
6323
|
+
},
|
|
6324
|
+
json: { type: "boolean", description: "Emit the complete snapshot as JSON" }
|
|
6325
|
+
},
|
|
6326
|
+
async run({ args: args2, rawArgs }) {
|
|
6327
|
+
const client = createClient2();
|
|
6328
|
+
const includeUntracked = collectFlagValues(rawArgs, "include");
|
|
6329
|
+
if (includeUntracked.length > 1e3) {
|
|
6330
|
+
console.error("team review capture: too many paths to include");
|
|
6331
|
+
process.exit(1);
|
|
6332
|
+
}
|
|
6333
|
+
const captured = await client.repositoryReview(args2.id).capture({
|
|
6334
|
+
...args2.base ? { base: args2.base } : {},
|
|
6335
|
+
...includeUntracked.length > 0 ? { includeUntracked } : {}
|
|
6336
|
+
});
|
|
6337
|
+
if (args2.json) {
|
|
6338
|
+
console.log(JSON.stringify(captured, null, 2));
|
|
6339
|
+
return;
|
|
6340
|
+
}
|
|
6341
|
+
const { snapshot, reference } = captured;
|
|
6342
|
+
console.log(`snapshot ${reference.id}`);
|
|
6343
|
+
console.log(` complete: ${reference.complete ? "yes" : "no (applicability is unknown)"}`);
|
|
6344
|
+
console.log(` head: ${snapshot.head ?? "(unborn)"}`);
|
|
6345
|
+
console.log(
|
|
6346
|
+
` entries: ${snapshot.entries.length} \xB7 included untracked: ${snapshot.untrackedIncluded.length}`
|
|
6347
|
+
);
|
|
6348
|
+
if (snapshot.exclusions.length > 0) {
|
|
6349
|
+
console.log(` excluded: ${snapshot.exclusions.map((item) => item.path).join(", ")}`);
|
|
6350
|
+
}
|
|
6351
|
+
for (const issue of snapshot.issues) console.log(` note: ${issue.code}: ${issue.message}`);
|
|
6352
|
+
}
|
|
6353
|
+
});
|
|
6354
|
+
var snapshotsCmd = defineCommand29({
|
|
6355
|
+
meta: { name: "snapshots", description: "List retained source snapshots for a Team" },
|
|
6356
|
+
args: { ...slug, json: { type: "boolean", description: "Emit JSON" } },
|
|
6357
|
+
async run({ args: args2 }) {
|
|
6358
|
+
const client = createClient2();
|
|
6359
|
+
const list8 = await client.repositoryReview(args2.id).snapshots();
|
|
6360
|
+
if (args2.json) {
|
|
6361
|
+
console.log(JSON.stringify(list8, null, 2));
|
|
6362
|
+
return;
|
|
6363
|
+
}
|
|
6364
|
+
if (list8.snapshots.length === 0) {
|
|
6365
|
+
console.log("(no retained snapshots)");
|
|
6366
|
+
return;
|
|
6367
|
+
}
|
|
6368
|
+
const rows = list8.snapshots.map((snapshot) => [
|
|
6369
|
+
snapshot.snapshotId.slice(0, 12),
|
|
6370
|
+
snapshot.complete ? "complete" : "incomplete",
|
|
6371
|
+
snapshot.capturedBy,
|
|
6372
|
+
new Date(snapshot.createdAt).toISOString(),
|
|
6373
|
+
`${snapshot.entryCount} entries`
|
|
6374
|
+
]);
|
|
6375
|
+
for (const line of columnize(rows)) console.log(line);
|
|
6376
|
+
}
|
|
6377
|
+
});
|
|
6378
|
+
var snapshotCmd = defineCommand29({
|
|
6379
|
+
meta: { name: "snapshot", description: "Show one retained source snapshot" },
|
|
6380
|
+
args: {
|
|
6381
|
+
...slug,
|
|
6382
|
+
snapshot: { type: "positional", required: true, description: "Snapshot id" },
|
|
6383
|
+
json: { type: "boolean", description: "Emit JSON" }
|
|
6384
|
+
},
|
|
6385
|
+
async run({ args: args2 }) {
|
|
6386
|
+
const client = createClient2();
|
|
6387
|
+
const { snapshot } = await client.repositoryReview(args2.id).snapshot(args2.snapshot);
|
|
6388
|
+
if (args2.json) {
|
|
6389
|
+
console.log(JSON.stringify(snapshot, null, 2));
|
|
6390
|
+
return;
|
|
6391
|
+
}
|
|
6392
|
+
console.log(`snapshot ${snapshot.id} \xB7 ${snapshot.complete ? "complete" : "incomplete"}`);
|
|
6393
|
+
console.log(` head: ${snapshot.head ?? "(unborn)"} \xB7 base: ${snapshot.base.resolvedOid}`);
|
|
6394
|
+
const rows = snapshot.entries.map((entry3) => [
|
|
6395
|
+
entry3.layer,
|
|
6396
|
+
entry3.kind,
|
|
6397
|
+
entry3.path,
|
|
6398
|
+
entry3.bytes === null ? "-" : `${entry3.bytes}B`,
|
|
6399
|
+
entry3.digest === null ? "" : entry3.digest.slice(0, 12)
|
|
6400
|
+
]);
|
|
6401
|
+
for (const line of columnize(rows)) console.log(line);
|
|
6402
|
+
}
|
|
6403
|
+
});
|
|
6404
|
+
var teamReviewCommand = defineCommand29({
|
|
6405
|
+
meta: {
|
|
6406
|
+
name: "review",
|
|
6407
|
+
description: "Read-only Git change review and bounded source snapshots"
|
|
6408
|
+
},
|
|
6409
|
+
subCommands: {
|
|
6410
|
+
show: showCmd5,
|
|
6411
|
+
capture: captureCmd,
|
|
6412
|
+
snapshots: snapshotsCmd,
|
|
6413
|
+
snapshot: snapshotCmd
|
|
6414
|
+
}
|
|
6415
|
+
});
|
|
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
|
+
|
|
6042
6624
|
// src/commands/team.ts
|
|
6043
|
-
var addCmd2 =
|
|
6625
|
+
var addCmd2 = defineCommand31({
|
|
6044
6626
|
meta: {
|
|
6045
6627
|
name: "add",
|
|
6046
6628
|
description: "Register a team at ~/.bazilion/teams/<slug>/ (use --link to point at an existing tree)"
|
|
@@ -6064,7 +6646,7 @@ var addCmd2 = defineCommand28({
|
|
|
6064
6646
|
console.log(`registered team ${g.id} at ${g.path}`);
|
|
6065
6647
|
}
|
|
6066
6648
|
});
|
|
6067
|
-
var
|
|
6649
|
+
var listCmd11 = defineCommand31({
|
|
6068
6650
|
meta: { name: "list", description: "List teams" },
|
|
6069
6651
|
async run() {
|
|
6070
6652
|
const client = createClient2();
|
|
@@ -6077,7 +6659,7 @@ var listCmd10 = defineCommand28({
|
|
|
6077
6659
|
for (const line of columnize(rows)) console.log(line);
|
|
6078
6660
|
}
|
|
6079
6661
|
});
|
|
6080
|
-
var rmCmd5 =
|
|
6662
|
+
var rmCmd5 = defineCommand31({
|
|
6081
6663
|
meta: { name: "rm", description: "Remove a team registration" },
|
|
6082
6664
|
args: {
|
|
6083
6665
|
id: { type: "positional", required: true }
|
|
@@ -6098,7 +6680,7 @@ async function readStdin() {
|
|
|
6098
6680
|
for await (const chunk of stdin2) chunks.push(chunk);
|
|
6099
6681
|
return Buffer.concat(chunks).toString("utf8");
|
|
6100
6682
|
}
|
|
6101
|
-
var userMdShowCmd =
|
|
6683
|
+
var userMdShowCmd = defineCommand31({
|
|
6102
6684
|
meta: { name: "show", description: "Print the team's USER.md" },
|
|
6103
6685
|
args: { id: { type: "positional", required: true } },
|
|
6104
6686
|
async run({ args: args2 }) {
|
|
@@ -6108,7 +6690,7 @@ var userMdShowCmd = defineCommand28({
|
|
|
6108
6690
|
if (g.userMd && !g.userMd.endsWith("\n")) process.stdout.write("\n");
|
|
6109
6691
|
}
|
|
6110
6692
|
});
|
|
6111
|
-
var userMdSetCmd =
|
|
6693
|
+
var userMdSetCmd = defineCommand31({
|
|
6112
6694
|
meta: {
|
|
6113
6695
|
name: "set",
|
|
6114
6696
|
description: "Replace the team's USER.md (from --file, --from-stdin, or inline text)"
|
|
@@ -6134,7 +6716,7 @@ var userMdSetCmd = defineCommand28({
|
|
|
6134
6716
|
console.log(`updated USER.md for team ${args2.id} (${content.length} bytes)`);
|
|
6135
6717
|
}
|
|
6136
6718
|
});
|
|
6137
|
-
var userMdClearCmd =
|
|
6719
|
+
var userMdClearCmd = defineCommand31({
|
|
6138
6720
|
meta: { name: "clear", description: "Clear the team's USER.md to empty" },
|
|
6139
6721
|
args: { id: { type: "positional", required: true } },
|
|
6140
6722
|
async run({ args: args2 }) {
|
|
@@ -6144,7 +6726,7 @@ var userMdClearCmd = defineCommand28({
|
|
|
6144
6726
|
console.log(`cleared USER.md for team ${args2.id}`);
|
|
6145
6727
|
}
|
|
6146
6728
|
});
|
|
6147
|
-
var userMdCmd =
|
|
6729
|
+
var userMdCmd = defineCommand31({
|
|
6148
6730
|
meta: { name: "user-md", description: "View or edit a team's USER.md" },
|
|
6149
6731
|
subCommands: {
|
|
6150
6732
|
show: userMdShowCmd,
|
|
@@ -6152,7 +6734,7 @@ var userMdCmd = defineCommand28({
|
|
|
6152
6734
|
clear: userMdClearCmd
|
|
6153
6735
|
}
|
|
6154
6736
|
});
|
|
6155
|
-
var topicFormatShowCmd =
|
|
6737
|
+
var topicFormatShowCmd = defineCommand31({
|
|
6156
6738
|
meta: { name: "show", description: "Print the team's Telegram topic-name template" },
|
|
6157
6739
|
args: { id: { type: "positional", required: true } },
|
|
6158
6740
|
async run({ args: args2 }) {
|
|
@@ -6161,7 +6743,7 @@ var topicFormatShowCmd = defineCommand28({
|
|
|
6161
6743
|
console.log(g.telegramTopicNameFormat ?? "(default naming)");
|
|
6162
6744
|
}
|
|
6163
6745
|
});
|
|
6164
|
-
var topicFormatSetCmd =
|
|
6746
|
+
var topicFormatSetCmd = defineCommand31({
|
|
6165
6747
|
meta: {
|
|
6166
6748
|
name: "set",
|
|
6167
6749
|
description: "Set the topic-name template. Tokens: {agent.name} {team.name} {team.slug} (must include {agent.name})"
|
|
@@ -6181,7 +6763,7 @@ var topicFormatSetCmd = defineCommand28({
|
|
|
6181
6763
|
console.log(`set topic-name template for team ${args2.id}: ${g.telegramTopicNameFormat}`);
|
|
6182
6764
|
}
|
|
6183
6765
|
});
|
|
6184
|
-
var topicFormatClearCmd =
|
|
6766
|
+
var topicFormatClearCmd = defineCommand31({
|
|
6185
6767
|
meta: { name: "clear", description: "Clear the template (revert to built-in naming)" },
|
|
6186
6768
|
args: { id: { type: "positional", required: true } },
|
|
6187
6769
|
async run({ args: args2 }) {
|
|
@@ -6191,7 +6773,7 @@ var topicFormatClearCmd = defineCommand28({
|
|
|
6191
6773
|
console.log(`cleared topic-name template for team ${args2.id}`);
|
|
6192
6774
|
}
|
|
6193
6775
|
});
|
|
6194
|
-
var topicFormatCmd =
|
|
6776
|
+
var topicFormatCmd = defineCommand31({
|
|
6195
6777
|
meta: {
|
|
6196
6778
|
name: "topic-format",
|
|
6197
6779
|
description: "View or edit a team's Telegram forum-topic name template"
|
|
@@ -6202,7 +6784,7 @@ var topicFormatCmd = defineCommand28({
|
|
|
6202
6784
|
clear: topicFormatClearCmd
|
|
6203
6785
|
}
|
|
6204
6786
|
});
|
|
6205
|
-
var contextCmd =
|
|
6787
|
+
var contextCmd = defineCommand31({
|
|
6206
6788
|
meta: {
|
|
6207
6789
|
name: "context",
|
|
6208
6790
|
description: "Inspect repository instructions, Git state and command suggestions"
|
|
@@ -6249,13 +6831,16 @@ var contextCmd = defineCommand28({
|
|
|
6249
6831
|
console.log(` ${issue.code}${issue.path ? `: ${safe2(issue.path)}` : ""} \u2014 ${issue.message}`);
|
|
6250
6832
|
}
|
|
6251
6833
|
});
|
|
6252
|
-
var teamCommand =
|
|
6834
|
+
var teamCommand = defineCommand31({
|
|
6253
6835
|
meta: { name: "team", description: "Manage teams (collaboration contexts)" },
|
|
6254
6836
|
subCommands: {
|
|
6255
6837
|
environment: teamEnvironmentCommand,
|
|
6838
|
+
log: teamCodingLogCommand,
|
|
6839
|
+
review: teamReviewCommand,
|
|
6840
|
+
verify: verifyCommand,
|
|
6256
6841
|
context: contextCmd,
|
|
6257
6842
|
add: addCmd2,
|
|
6258
|
-
list:
|
|
6843
|
+
list: listCmd11,
|
|
6259
6844
|
rm: rmCmd5,
|
|
6260
6845
|
"user-md": userMdCmd,
|
|
6261
6846
|
"topic-format": topicFormatCmd,
|
|
@@ -6265,7 +6850,7 @@ var teamCommand = defineCommand28({
|
|
|
6265
6850
|
|
|
6266
6851
|
// src/commands/team-template.ts
|
|
6267
6852
|
import { readFileSync as readFileSync12 } from "fs";
|
|
6268
|
-
import { defineCommand as
|
|
6853
|
+
import { defineCommand as defineCommand32 } from "citty";
|
|
6269
6854
|
function jsonFile(path) {
|
|
6270
6855
|
try {
|
|
6271
6856
|
return JSON.parse(readFileSync12(path, "utf8"));
|
|
@@ -6293,7 +6878,7 @@ function printTeam(detail) {
|
|
|
6293
6878
|
console.log(line);
|
|
6294
6879
|
}
|
|
6295
6880
|
}
|
|
6296
|
-
var list7 =
|
|
6881
|
+
var list7 = defineCommand32({
|
|
6297
6882
|
meta: { name: "list", description: "List canonical Team templates" },
|
|
6298
6883
|
args: { json: { type: "boolean", description: "Emit stable JSON" } },
|
|
6299
6884
|
async run({ args: args2 }) {
|
|
@@ -6307,7 +6892,7 @@ var list7 = defineCommand29({
|
|
|
6307
6892
|
console.log(line);
|
|
6308
6893
|
}
|
|
6309
6894
|
});
|
|
6310
|
-
var show6 =
|
|
6895
|
+
var show6 = defineCommand32({
|
|
6311
6896
|
meta: { name: "show", description: "Show a canonical Team template" },
|
|
6312
6897
|
args: {
|
|
6313
6898
|
id: { type: "positional", required: true },
|
|
@@ -6321,7 +6906,7 @@ var show6 = defineCommand29({
|
|
|
6321
6906
|
else printTeam(detail);
|
|
6322
6907
|
}
|
|
6323
6908
|
});
|
|
6324
|
-
var exportCommand2 =
|
|
6909
|
+
var exportCommand2 = defineCommand32({
|
|
6325
6910
|
meta: {
|
|
6326
6911
|
name: "export",
|
|
6327
6912
|
description: "Export a portable versioned Team-template document to stdout"
|
|
@@ -6361,7 +6946,7 @@ function printImportDiff(current, document) {
|
|
|
6361
6946
|
for (const value of diff2.added) console.log(` + ${value}`);
|
|
6362
6947
|
for (const value of diff2.removed) console.log(` - ${value}`);
|
|
6363
6948
|
}
|
|
6364
|
-
var importCommand2 =
|
|
6949
|
+
var importCommand2 = defineCommand32({
|
|
6365
6950
|
meta: {
|
|
6366
6951
|
name: "import",
|
|
6367
6952
|
description: "Validate, diff, and explicitly apply a portable Team-template document"
|
|
@@ -6442,7 +7027,7 @@ var importCommand2 = defineCommand29({
|
|
|
6442
7027
|
);
|
|
6443
7028
|
}
|
|
6444
7029
|
});
|
|
6445
|
-
var teamTemplateCommand =
|
|
7030
|
+
var teamTemplateCommand = defineCommand32({
|
|
6446
7031
|
meta: {
|
|
6447
7032
|
name: "team-template",
|
|
6448
7033
|
description: "Inspect and exchange canonical Team templates"
|
|
@@ -6451,8 +7036,8 @@ var teamTemplateCommand = defineCommand29({
|
|
|
6451
7036
|
});
|
|
6452
7037
|
|
|
6453
7038
|
// src/commands/telegram.ts
|
|
6454
|
-
import { defineCommand as
|
|
6455
|
-
var setCmd2 =
|
|
7039
|
+
import { defineCommand as defineCommand33 } from "citty";
|
|
7040
|
+
var setCmd2 = defineCommand33({
|
|
6456
7041
|
meta: {
|
|
6457
7042
|
name: "set",
|
|
6458
7043
|
description: "Save bot token + supergroup chat ID (paired write)"
|
|
@@ -6470,7 +7055,7 @@ var setCmd2 = defineCommand30({
|
|
|
6470
7055
|
console.log(`saved \xB7 token ${state.botTokenPreview} \xB7 chat ${state.chatId}`);
|
|
6471
7056
|
}
|
|
6472
7057
|
});
|
|
6473
|
-
var clearCmd =
|
|
7058
|
+
var clearCmd = defineCommand33({
|
|
6474
7059
|
meta: {
|
|
6475
7060
|
name: "clear",
|
|
6476
7061
|
description: "Remove stored bot token + chat ID"
|
|
@@ -6481,7 +7066,7 @@ var clearCmd = defineCommand30({
|
|
|
6481
7066
|
console.log("cleared");
|
|
6482
7067
|
}
|
|
6483
7068
|
});
|
|
6484
|
-
var
|
|
7069
|
+
var showCmd7 = defineCommand33({
|
|
6485
7070
|
meta: {
|
|
6486
7071
|
name: "show",
|
|
6487
7072
|
description: "Show what credentials are stored (token is masked)"
|
|
@@ -6502,7 +7087,7 @@ var showCmd5 = defineCommand30({
|
|
|
6502
7087
|
}
|
|
6503
7088
|
}
|
|
6504
7089
|
});
|
|
6505
|
-
var reconnectCmd =
|
|
7090
|
+
var reconnectCmd = defineCommand33({
|
|
6506
7091
|
meta: {
|
|
6507
7092
|
name: "reconnect",
|
|
6508
7093
|
description: "Apply a pending supergroup chat-id migration + re-activate the bot"
|
|
@@ -6513,7 +7098,7 @@ var reconnectCmd = defineCommand30({
|
|
|
6513
7098
|
console.log(`reconnected \xB7 chat ${state.chatId}`);
|
|
6514
7099
|
}
|
|
6515
7100
|
});
|
|
6516
|
-
var configCmd =
|
|
7101
|
+
var configCmd = defineCommand33({
|
|
6517
7102
|
meta: {
|
|
6518
7103
|
name: "config",
|
|
6519
7104
|
description: "Manage Telegram credentials (bot token + chat ID)"
|
|
@@ -6521,10 +7106,10 @@ var configCmd = defineCommand30({
|
|
|
6521
7106
|
subCommands: {
|
|
6522
7107
|
set: setCmd2,
|
|
6523
7108
|
clear: clearCmd,
|
|
6524
|
-
show:
|
|
7109
|
+
show: showCmd7
|
|
6525
7110
|
}
|
|
6526
7111
|
});
|
|
6527
|
-
var healthCmd =
|
|
7112
|
+
var healthCmd = defineCommand33({
|
|
6528
7113
|
meta: {
|
|
6529
7114
|
name: "health",
|
|
6530
7115
|
description: "Run the four-step preflight against the Telegram Bot API"
|
|
@@ -6563,7 +7148,7 @@ var healthCmd = defineCommand30({
|
|
|
6563
7148
|
if (!allOk) process.exitCode = 1;
|
|
6564
7149
|
}
|
|
6565
7150
|
});
|
|
6566
|
-
var botStatusCmd =
|
|
7151
|
+
var botStatusCmd = defineCommand33({
|
|
6567
7152
|
meta: {
|
|
6568
7153
|
name: "status",
|
|
6569
7154
|
description: "Show polling state of the live bot"
|
|
@@ -6588,7 +7173,7 @@ var botStatusCmd = defineCommand30({
|
|
|
6588
7173
|
if (!p.running) process.exitCode = 1;
|
|
6589
7174
|
}
|
|
6590
7175
|
});
|
|
6591
|
-
var botRestartCmd =
|
|
7176
|
+
var botRestartCmd = defineCommand33({
|
|
6592
7177
|
meta: {
|
|
6593
7178
|
name: "restart",
|
|
6594
7179
|
description: "Force-restart the bot (tears down + brings up from current creds)"
|
|
@@ -6599,7 +7184,7 @@ var botRestartCmd = defineCommand30({
|
|
|
6599
7184
|
console.log("restart requested");
|
|
6600
7185
|
}
|
|
6601
7186
|
});
|
|
6602
|
-
var botCmd =
|
|
7187
|
+
var botCmd = defineCommand33({
|
|
6603
7188
|
meta: {
|
|
6604
7189
|
name: "bot",
|
|
6605
7190
|
description: "Inspect / control the live polling bot"
|
|
@@ -6609,7 +7194,7 @@ var botCmd = defineCommand30({
|
|
|
6609
7194
|
restart: botRestartCmd
|
|
6610
7195
|
}
|
|
6611
7196
|
});
|
|
6612
|
-
var bindCmd =
|
|
7197
|
+
var bindCmd = defineCommand33({
|
|
6613
7198
|
meta: {
|
|
6614
7199
|
name: "bind",
|
|
6615
7200
|
description: "Create a Telegram topic for an agent (manual fallback for /talk)"
|
|
@@ -6627,7 +7212,7 @@ var bindCmd = defineCommand30({
|
|
|
6627
7212
|
console.log(` ${result.deepLink}`);
|
|
6628
7213
|
}
|
|
6629
7214
|
});
|
|
6630
|
-
var unbindCmd =
|
|
7215
|
+
var unbindCmd = defineCommand33({
|
|
6631
7216
|
meta: {
|
|
6632
7217
|
name: "unbind",
|
|
6633
7218
|
description: "Clear an agent's Telegram topic binding (topic stays in Telegram as orphan)"
|
|
@@ -6641,7 +7226,7 @@ var unbindCmd = defineCommand30({
|
|
|
6641
7226
|
console.log(`unbound agent ${args2.agent}`);
|
|
6642
7227
|
}
|
|
6643
7228
|
});
|
|
6644
|
-
var listBindingsCmd =
|
|
7229
|
+
var listBindingsCmd = defineCommand33({
|
|
6645
7230
|
meta: {
|
|
6646
7231
|
name: "list",
|
|
6647
7232
|
description: "List agents and their Telegram topic bindings"
|
|
@@ -6669,7 +7254,7 @@ var listBindingsCmd = defineCommand30({
|
|
|
6669
7254
|
}
|
|
6670
7255
|
}
|
|
6671
7256
|
});
|
|
6672
|
-
var allowCmd =
|
|
7257
|
+
var allowCmd = defineCommand33({
|
|
6673
7258
|
meta: { name: "allow", description: "Add a Telegram user id to the allowlist" },
|
|
6674
7259
|
args: {
|
|
6675
7260
|
userId: { type: "positional", required: true, description: "Numeric Telegram user id" },
|
|
@@ -6685,7 +7270,7 @@ var allowCmd = defineCommand30({
|
|
|
6685
7270
|
console.log(`allowed ${u.userId} (${u.role})`);
|
|
6686
7271
|
}
|
|
6687
7272
|
});
|
|
6688
|
-
var denyCmd =
|
|
7273
|
+
var denyCmd = defineCommand33({
|
|
6689
7274
|
meta: { name: "deny", description: "Remove a Telegram user id from the allowlist" },
|
|
6690
7275
|
args: { userId: { type: "positional", required: true } },
|
|
6691
7276
|
async run({ args: args2 }) {
|
|
@@ -6694,7 +7279,7 @@ var denyCmd = defineCommand30({
|
|
|
6694
7279
|
console.log(`removed ${args2.userId}`);
|
|
6695
7280
|
}
|
|
6696
7281
|
});
|
|
6697
|
-
var allowedCmd =
|
|
7282
|
+
var allowedCmd = defineCommand33({
|
|
6698
7283
|
meta: { name: "allowed", description: "List allowlisted Telegram users" },
|
|
6699
7284
|
async run() {
|
|
6700
7285
|
const client = createClient2();
|
|
@@ -6709,7 +7294,7 @@ var allowedCmd = defineCommand30({
|
|
|
6709
7294
|
}
|
|
6710
7295
|
}
|
|
6711
7296
|
});
|
|
6712
|
-
var pairingCreateCmd =
|
|
7297
|
+
var pairingCreateCmd = defineCommand33({
|
|
6713
7298
|
meta: { name: "create", description: "Generate a one-time Telegram owner pairing code" },
|
|
6714
7299
|
async run() {
|
|
6715
7300
|
const result = await createClient2().post(
|
|
@@ -6720,7 +7305,7 @@ var pairingCreateCmd = defineCommand30({
|
|
|
6720
7305
|
console.log("send `/pair <code>` in the configured \u2699 bazilion service topic");
|
|
6721
7306
|
}
|
|
6722
7307
|
});
|
|
6723
|
-
var pairingStatusCmd =
|
|
7308
|
+
var pairingStatusCmd = defineCommand33({
|
|
6724
7309
|
meta: { name: "status", description: "Show Telegram owner pairing status" },
|
|
6725
7310
|
async run() {
|
|
6726
7311
|
const result = await createClient2().get("/api/config/telegram/pairing");
|
|
@@ -6731,14 +7316,14 @@ var pairingStatusCmd = defineCommand30({
|
|
|
6731
7316
|
console.log(`expires: ${new Date(result.challengeExpiresAt).toISOString()}`);
|
|
6732
7317
|
}
|
|
6733
7318
|
});
|
|
6734
|
-
var pairingCancelCmd =
|
|
7319
|
+
var pairingCancelCmd = defineCommand33({
|
|
6735
7320
|
meta: { name: "cancel", description: "Cancel the active Telegram pairing code" },
|
|
6736
7321
|
async run() {
|
|
6737
7322
|
await createClient2().del("/api/config/telegram/pairing/challenge");
|
|
6738
7323
|
console.log("pairing challenge cancelled");
|
|
6739
7324
|
}
|
|
6740
7325
|
});
|
|
6741
|
-
var pairingResetCmd =
|
|
7326
|
+
var pairingResetCmd = defineCommand33({
|
|
6742
7327
|
meta: { name: "reset", description: "Revoke the Telegram owner and require re-pairing" },
|
|
6743
7328
|
args: {
|
|
6744
7329
|
yes: { type: "boolean", description: "Confirm destructive owner reset", required: true }
|
|
@@ -6749,7 +7334,7 @@ var pairingResetCmd = defineCommand30({
|
|
|
6749
7334
|
console.log("Telegram owner reset; ingress is closed until re-paired");
|
|
6750
7335
|
}
|
|
6751
7336
|
});
|
|
6752
|
-
var pairingCmd =
|
|
7337
|
+
var pairingCmd = defineCommand33({
|
|
6753
7338
|
meta: { name: "pairing", description: "Manage single-owner Telegram pairing" },
|
|
6754
7339
|
subCommands: {
|
|
6755
7340
|
create: pairingCreateCmd,
|
|
@@ -6758,7 +7343,7 @@ var pairingCmd = defineCommand30({
|
|
|
6758
7343
|
reset: pairingResetCmd
|
|
6759
7344
|
}
|
|
6760
7345
|
});
|
|
6761
|
-
var telegramCommand =
|
|
7346
|
+
var telegramCommand = defineCommand33({
|
|
6762
7347
|
meta: {
|
|
6763
7348
|
name: "telegram",
|
|
6764
7349
|
description: "Telegram integration: credentials, health, bot lifecycle, bindings, access"
|
|
@@ -6779,7 +7364,7 @@ var telegramCommand = defineCommand30({
|
|
|
6779
7364
|
});
|
|
6780
7365
|
|
|
6781
7366
|
// src/commands/token.ts
|
|
6782
|
-
import { defineCommand as
|
|
7367
|
+
import { defineCommand as defineCommand34 } from "citty";
|
|
6783
7368
|
import qrcode from "qrcode-terminal";
|
|
6784
7369
|
function tokenRow(t) {
|
|
6785
7370
|
const last = t.lastUsedAt ? new Date(t.lastUsedAt).toISOString() : "(never)";
|
|
@@ -6808,7 +7393,7 @@ function resolveQrServer(override) {
|
|
|
6808
7393
|
}
|
|
6809
7394
|
return url.origin;
|
|
6810
7395
|
}
|
|
6811
|
-
var
|
|
7396
|
+
var createCmd4 = defineCommand34({
|
|
6812
7397
|
meta: { name: "create", description: "Mint a new web token (shown once)" },
|
|
6813
7398
|
args: {
|
|
6814
7399
|
label: { type: "positional", required: true, description: "Human-readable label" },
|
|
@@ -6851,7 +7436,7 @@ var createCmd3 = defineCommand31({
|
|
|
6851
7436
|
qrcode.generate(pairUrl, { small: true }, (qr) => console.log(qr));
|
|
6852
7437
|
}
|
|
6853
7438
|
});
|
|
6854
|
-
var
|
|
7439
|
+
var listCmd12 = defineCommand34({
|
|
6855
7440
|
meta: { name: "list", description: "List web tokens" },
|
|
6856
7441
|
args: {
|
|
6857
7442
|
all: { type: "boolean", description: "Include revoked tokens" }
|
|
@@ -6867,7 +7452,7 @@ var listCmd11 = defineCommand31({
|
|
|
6867
7452
|
for (const line of columnize(tokens.map(tokenRow))) console.log(line);
|
|
6868
7453
|
}
|
|
6869
7454
|
});
|
|
6870
|
-
var showLocalCmd =
|
|
7455
|
+
var showLocalCmd = defineCommand34({
|
|
6871
7456
|
meta: {
|
|
6872
7457
|
name: "show-local",
|
|
6873
7458
|
description: "Print the bootstrap web token stored in ~/.bazilion/auth.json"
|
|
@@ -6877,7 +7462,7 @@ var showLocalCmd = defineCommand31({
|
|
|
6877
7462
|
console.log(readAuthFile(paths.authFile).token);
|
|
6878
7463
|
}
|
|
6879
7464
|
});
|
|
6880
|
-
var revokeCmd2 =
|
|
7465
|
+
var revokeCmd2 = defineCommand34({
|
|
6881
7466
|
meta: { name: "revoke", description: "Revoke a web token" },
|
|
6882
7467
|
args: {
|
|
6883
7468
|
id: { type: "positional", required: true }
|
|
@@ -6888,19 +7473,19 @@ var revokeCmd2 = defineCommand31({
|
|
|
6888
7473
|
console.log(`revoked token ${args2.id}`);
|
|
6889
7474
|
}
|
|
6890
7475
|
});
|
|
6891
|
-
var tokenCommand =
|
|
7476
|
+
var tokenCommand = defineCommand34({
|
|
6892
7477
|
meta: { name: "token", description: "Manage web tokens for API/CLI clients" },
|
|
6893
7478
|
subCommands: {
|
|
6894
|
-
create:
|
|
6895
|
-
list:
|
|
7479
|
+
create: createCmd4,
|
|
7480
|
+
list: listCmd12,
|
|
6896
7481
|
revoke: revokeCmd2,
|
|
6897
7482
|
"show-local": showLocalCmd
|
|
6898
7483
|
}
|
|
6899
7484
|
});
|
|
6900
7485
|
|
|
6901
7486
|
// src/commands/trigger.ts
|
|
6902
|
-
import { defineCommand as
|
|
6903
|
-
var addCmd3 =
|
|
7487
|
+
import { defineCommand as defineCommand35 } from "citty";
|
|
7488
|
+
var addCmd3 = defineCommand35({
|
|
6904
7489
|
meta: { name: "add", description: "Add an interval / cron trigger to an agent" },
|
|
6905
7490
|
args: {
|
|
6906
7491
|
agent: { type: "positional", required: true },
|
|
@@ -6948,7 +7533,7 @@ function triggerRow(t) {
|
|
|
6948
7533
|
const msgPreview = t.message.length > 60 ? `${t.message.slice(0, 60)}\u2026` : t.message;
|
|
6949
7534
|
return [t.id, state, spec, `last: ${last}`, `"${msgPreview}"`];
|
|
6950
7535
|
}
|
|
6951
|
-
var
|
|
7536
|
+
var listCmd13 = defineCommand35({
|
|
6952
7537
|
meta: { name: "list", description: "List triggers for an agent" },
|
|
6953
7538
|
args: {
|
|
6954
7539
|
agent: { type: "positional", required: true }
|
|
@@ -6965,7 +7550,7 @@ var listCmd12 = defineCommand32({
|
|
|
6965
7550
|
for (const line of columnize(triggers.map(triggerRow))) console.log(line);
|
|
6966
7551
|
}
|
|
6967
7552
|
});
|
|
6968
|
-
var rmCmd6 =
|
|
7553
|
+
var rmCmd6 = defineCommand35({
|
|
6969
7554
|
meta: { name: "rm", description: "Delete a trigger" },
|
|
6970
7555
|
args: {
|
|
6971
7556
|
id: { type: "positional", required: true }
|
|
@@ -6976,7 +7561,7 @@ var rmCmd6 = defineCommand32({
|
|
|
6976
7561
|
console.log(`removed trigger ${args2.id}`);
|
|
6977
7562
|
}
|
|
6978
7563
|
});
|
|
6979
|
-
var enableCmd3 =
|
|
7564
|
+
var enableCmd3 = defineCommand35({
|
|
6980
7565
|
meta: { name: "enable", description: "Enable a trigger" },
|
|
6981
7566
|
args: {
|
|
6982
7567
|
id: { type: "positional", required: true }
|
|
@@ -6988,7 +7573,7 @@ var enableCmd3 = defineCommand32({
|
|
|
6988
7573
|
console.log(`enabled trigger ${args2.id}`);
|
|
6989
7574
|
}
|
|
6990
7575
|
});
|
|
6991
|
-
var disableCmd3 =
|
|
7576
|
+
var disableCmd3 = defineCommand35({
|
|
6992
7577
|
meta: { name: "disable", description: "Disable a trigger" },
|
|
6993
7578
|
args: {
|
|
6994
7579
|
id: { type: "positional", required: true }
|
|
@@ -7000,7 +7585,7 @@ var disableCmd3 = defineCommand32({
|
|
|
7000
7585
|
console.log(`disabled trigger ${args2.id}`);
|
|
7001
7586
|
}
|
|
7002
7587
|
});
|
|
7003
|
-
var historyCmd =
|
|
7588
|
+
var historyCmd = defineCommand35({
|
|
7004
7589
|
meta: { name: "history", description: "Show recent dispatches for a trigger" },
|
|
7005
7590
|
args: {
|
|
7006
7591
|
id: { type: "positional", required: true },
|
|
@@ -7028,11 +7613,11 @@ var historyCmd = defineCommand32({
|
|
|
7028
7613
|
for (const line of columnize(rows)) console.log(line);
|
|
7029
7614
|
}
|
|
7030
7615
|
});
|
|
7031
|
-
var triggerCommand =
|
|
7616
|
+
var triggerCommand = defineCommand35({
|
|
7032
7617
|
meta: { name: "trigger", description: "Manage scheduled agent triggers" },
|
|
7033
7618
|
subCommands: {
|
|
7034
7619
|
add: addCmd3,
|
|
7035
|
-
list:
|
|
7620
|
+
list: listCmd13,
|
|
7036
7621
|
rm: rmCmd6,
|
|
7037
7622
|
enable: enableCmd3,
|
|
7038
7623
|
disable: disableCmd3,
|
|
@@ -7044,7 +7629,7 @@ var triggerCommand = defineCommand32({
|
|
|
7044
7629
|
import { existsSync as existsSync7, lstatSync as lstatSync4, readdirSync as readdirSync2, realpathSync as realpathSync2, rmSync as rmSync4 } from "fs";
|
|
7045
7630
|
import { homedir as homedir2 } from "os";
|
|
7046
7631
|
import { isAbsolute as isAbsolute2, join as join6, parse as parse2, relative as relative2, resolve as resolve5, sep } from "path";
|
|
7047
|
-
import { defineCommand as
|
|
7632
|
+
import { defineCommand as defineCommand36 } from "citty";
|
|
7048
7633
|
function makeLineReader() {
|
|
7049
7634
|
let buffer = "";
|
|
7050
7635
|
let ended = false;
|
|
@@ -7131,7 +7716,7 @@ function assertSafeUninstallHome(home) {
|
|
|
7131
7716
|
}
|
|
7132
7717
|
return target;
|
|
7133
7718
|
}
|
|
7134
|
-
var uninstallCommand =
|
|
7719
|
+
var uninstallCommand = defineCommand36({
|
|
7135
7720
|
meta: {
|
|
7136
7721
|
name: "uninstall",
|
|
7137
7722
|
description: "Wipe bazilion state from ~/.bazilion (or BAZILION_HOME)"
|
|
@@ -7235,7 +7820,7 @@ var uninstallCommand = defineCommand33({
|
|
|
7235
7820
|
|
|
7236
7821
|
// src/index.ts
|
|
7237
7822
|
var VERSION = package_default.version;
|
|
7238
|
-
var main =
|
|
7823
|
+
var main = defineCommand37({
|
|
7239
7824
|
meta: {
|
|
7240
7825
|
name: "bazilion",
|
|
7241
7826
|
version: VERSION,
|