crossroom 0.2.0 → 0.3.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/README.md +23 -1
- package/dist/THIRD-PARTY-NOTICES.md +535 -0
- package/dist/chunk-7CTZAMHT.mjs +24392 -0
- package/dist/{chunk-27AE3JXP.mjs → chunk-GWFVXAVQ.mjs} +882 -69
- package/dist/{chunk-KYENX3H2.mjs → chunk-J4QPGWFS.mjs} +6 -6
- package/dist/chunk-KJTOBYEN.mjs +157 -0
- package/dist/{chunk-7TMIKS73.mjs → chunk-NAX7L4WR.mjs} +1 -1
- package/dist/chunk-NXBBMDR5.mjs +20 -0
- package/dist/{chunk-B22BPJRW.mjs → chunk-O3GNP4DR.mjs} +6 -1
- package/dist/chunk-PN2OQIQ5.mjs +157 -0
- package/dist/chunk-UYXRRLXZ.mjs +98 -0
- package/dist/{client-W2UXM3DQ.mjs → chunk-ZJ3UBXDU.mjs} +30752 -44003
- package/dist/{cli-CLTH3KTD.mjs → cli-DIMNWMDE.mjs} +14 -2
- package/dist/client-VOJ62D5R.mjs +17086 -0
- package/dist/{client-version-4NABXCVX.mjs → client-version-2BE42C46.mjs} +13 -1
- package/dist/crossroom.mjs +1 -1
- package/dist/{discovery-H337C4SR.mjs → discovery-EZAQSANW.mjs} +1 -1
- package/dist/{keep-in-account-TEFSINNC.mjs → keep-in-account-MEAE6BNO.mjs} +10 -8
- package/dist/{local-agent-LIALQD2F.mjs → local-agent-JSROJL7Y.mjs} +3 -3
- package/dist/{memory-notes-I2YVP6WP.mjs → memory-notes-7U7YO23S.mjs} +3 -3
- package/dist/node-CRLXXXMX.mjs +2258 -0
- package/dist/node-LUE5WS4G.mjs +20 -0
- package/dist/{relay-call-BPLNQ7JZ.mjs → relay-call-DKXVPYE4.mjs} +5 -4
- package/dist/sdk-P6RTMO2C.mjs +49 -0
- package/dist/wait-DMXS3HDV.mjs +21 -0
- package/package.json +6 -1
- package/dist/chunk-IU22ASGZ.mjs +0 -82
- package/dist/chunk-IX24JXWC.mjs +0 -219
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
runText,
|
|
24
24
|
slotLetter,
|
|
25
25
|
sourceCheckPhrase
|
|
26
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-O3GNP4DR.mjs";
|
|
27
27
|
|
|
28
28
|
// src/cli.ts
|
|
29
29
|
import { spawn as spawn2, spawnSync as spawnSync3 } from "node:child_process";
|
|
@@ -160,6 +160,10 @@ var E2EE_FIELDS = {
|
|
|
160
160
|
work: {},
|
|
161
161
|
submit: {},
|
|
162
162
|
report: {},
|
|
163
|
+
// A project room's plan (project rooms with a lead only): never offered in an end-to-end room,
|
|
164
|
+
// and its items' text is refused there (`E2EE_REFUSED`), since it would be stored in the clear.
|
|
165
|
+
plan: {},
|
|
166
|
+
progress: {},
|
|
163
167
|
// The room board. A room with a board is never end-to-end (its create refuses
|
|
164
168
|
// `board`), so nothing here is encrypted, and their arguments are refused (`E2EE_REFUSED`).
|
|
165
169
|
board: {},
|
|
@@ -232,6 +236,8 @@ var E2EE_REFUSED = {
|
|
|
232
236
|
// A submission's text and a report's note would be stored in the clear in the project's record.
|
|
233
237
|
submit: ["body", "title"],
|
|
234
238
|
report: ["note"],
|
|
239
|
+
// A plan's items (titles, briefs, criteria) would be stored in the clear in the project's work.
|
|
240
|
+
plan: ["items"],
|
|
235
241
|
// The board's keys and values would be stored in the clear.
|
|
236
242
|
board: ["key"],
|
|
237
243
|
board_set: ["key", "value"],
|
|
@@ -377,8 +383,8 @@ var UNSAFE = /[`[\]"'<>*_~|\\#!()]/g;
|
|
|
377
383
|
function labelText(label) {
|
|
378
384
|
if (typeof label !== "string") return "its repository";
|
|
379
385
|
const s = oneLine(label).replace(UNSAFE, " ").replace(/\s+/g, " ").trim();
|
|
380
|
-
const
|
|
381
|
-
return
|
|
386
|
+
const cut2 = [...s].slice(0, 60).join("");
|
|
387
|
+
return cut2 || "its repository";
|
|
382
388
|
}
|
|
383
389
|
var count = (n) => typeof n === "number" && Number.isSafeInteger(n) && n >= 0 ? n : 0;
|
|
384
390
|
var rev = (r) => typeof r === "string" && REV.test(r) ? r.slice(0, 12) : "an unnamed rev";
|
|
@@ -596,10 +602,51 @@ var AUTONOMY_WORDS = {
|
|
|
596
602
|
};
|
|
597
603
|
var LANE_TITLE_MAX = 200;
|
|
598
604
|
var LANE_BODY_MAX = 2e4;
|
|
605
|
+
var LANE_CITE_MAX = 500;
|
|
599
606
|
var LANE_NOTE_MAX = 4e3;
|
|
607
|
+
var LANE_LINK_MAX = 500;
|
|
600
608
|
var laneLabel = (n) => `L${n}`;
|
|
601
609
|
var LANE_PRIORITY_WORDS = { 0: "no priority", 1: "urgent", 2: "high", 3: "medium", 4: "low" };
|
|
610
|
+
function lanePriority(v) {
|
|
611
|
+
if (v === void 0 || v === null || v === "") return null;
|
|
612
|
+
const s = String(v).trim().toLowerCase();
|
|
613
|
+
const named = Object.entries(LANE_PRIORITY_WORDS).find(([, w]) => w === s || s === "none" && w === "no priority");
|
|
614
|
+
if (named) return Number(named[0]);
|
|
615
|
+
const m = /^p?([0-4])$/.exec(s);
|
|
616
|
+
return m ? Number(m[1]) : null;
|
|
617
|
+
}
|
|
602
618
|
var LANE_VIA_WORDS = { github: "a GitHub issue", linear: "a Linear issue", jira: "a Jira issue", azure: "an Azure DevOps work item" };
|
|
619
|
+
var TOKEN_PATH = /^\/(?:j\/[^/]+|mcp\/(?!start\/?$|connect\/?$)[^/]+|api\/hook\/|ask\/[^/]+)/i;
|
|
620
|
+
function decodedPath(p) {
|
|
621
|
+
let cur = p;
|
|
622
|
+
for (let i = 0; i < 5; i++) {
|
|
623
|
+
let next;
|
|
624
|
+
try {
|
|
625
|
+
next = decodeURIComponent(cur);
|
|
626
|
+
} catch {
|
|
627
|
+
return cur;
|
|
628
|
+
}
|
|
629
|
+
if (next === cur) return cur;
|
|
630
|
+
cur = next;
|
|
631
|
+
}
|
|
632
|
+
return cur;
|
|
633
|
+
}
|
|
634
|
+
function laneLinkProblem(raw) {
|
|
635
|
+
const s = raw.trim();
|
|
636
|
+
if (!s) return "A link is empty.";
|
|
637
|
+
if (s.length > LANE_LINK_MAX) return `A link is at most ${LANE_LINK_MAX} characters.`;
|
|
638
|
+
let u;
|
|
639
|
+
try {
|
|
640
|
+
u = new URL(s);
|
|
641
|
+
} catch {
|
|
642
|
+
return `${s.slice(0, 80)} is not a link.`;
|
|
643
|
+
}
|
|
644
|
+
if (u.protocol !== "https:") return "Links are https only.";
|
|
645
|
+
if (u.username || u.password) return "A link may not carry a user name or password.";
|
|
646
|
+
if (decodedPath(u.hash).includes("=")) return "That link carries a value in its fragment, which may be a key. Link the page without the part after #.";
|
|
647
|
+
if (TOKEN_PATH.test(decodedPath(u.pathname))) return "That link carries a Crossroom token (a seat, MCP, hook or ask link), which is a credential. Never put one on an item.";
|
|
648
|
+
return null;
|
|
649
|
+
}
|
|
603
650
|
var isOverdue = (i, now = Date.now()) => !!i.dueAt && i.state !== "closed" && Date.parse(i.dueAt) < now;
|
|
604
651
|
function needsSide(item, me) {
|
|
605
652
|
if (item.state === "closed") return false;
|
|
@@ -631,7 +678,7 @@ var SessionStatus = external_exports.enum(["open", "active", "ended"]);
|
|
|
631
678
|
var ParticipantKind = external_exports.enum(["hosted", "attached", "standing"]);
|
|
632
679
|
var CreatableKind = external_exports.enum(["hosted", "attached"]);
|
|
633
680
|
var Reachability = external_exports.enum(["push", "poll", "unknown"]);
|
|
634
|
-
var HostedRunner = external_exports.enum(["claude", "codex", "agy", "grok"]);
|
|
681
|
+
var HostedRunner = external_exports.enum(["claude", "codex", "agy", "grok", "api"]);
|
|
635
682
|
var HostedConfig = external_exports.object({
|
|
636
683
|
runner: HostedRunner,
|
|
637
684
|
/** Working directory the hosted agent may read. This is the private context boundary. */
|
|
@@ -804,7 +851,13 @@ var EventType = external_exports.enum([
|
|
|
804
851
|
// A side's autonomy changed: { side, autonomy, previous, by }, `side` the seat's letter, `by` that
|
|
805
852
|
// seat's letter or 'owner'. Content-free, delivered to every seat: the other side's next delivery
|
|
806
853
|
// says how far this side's agent now goes.
|
|
807
|
-
"lane_settings"
|
|
854
|
+
"lane_settings",
|
|
855
|
+
// A project room's plan changed (ops/plan.ts, `@parley/shared/work`): the lead planned items, a seat
|
|
856
|
+
// reported on one, or the owner accepted them. { kind: 'planned' | 'reported' | 'accepted', items:
|
|
857
|
+
// [{ n, state, slot }] }, `n` the item's P-number in this room and `slot` its assignee's (or null).
|
|
858
|
+
// Content-free: the words live in the work items, sealed under the project key. Delivered to every
|
|
859
|
+
// seat but the one whose doing it was, so the others hear it in `wait`.
|
|
860
|
+
"plan_updated"
|
|
808
861
|
]);
|
|
809
862
|
var CreateParticipantInput = external_exports.object({
|
|
810
863
|
name: external_exports.string().min(1).max(60),
|
|
@@ -1111,6 +1164,503 @@ function searchItems(items, query, fields) {
|
|
|
1111
1164
|
return hits.map(({ item, score, matched }) => ({ item, score, matched }));
|
|
1112
1165
|
}
|
|
1113
1166
|
|
|
1167
|
+
// ../shared/src/trackers.ts
|
|
1168
|
+
var TRACKER_WORD = { github: "GitHub", azure: "Azure DevOps", jira: "Jira" };
|
|
1169
|
+
var TRACKER_LIMITS = {
|
|
1170
|
+
key: 120,
|
|
1171
|
+
word: 60,
|
|
1172
|
+
person: 120,
|
|
1173
|
+
labels: 20,
|
|
1174
|
+
label: 60,
|
|
1175
|
+
links: 50,
|
|
1176
|
+
linkTitle: 200,
|
|
1177
|
+
url: 2e3,
|
|
1178
|
+
comments: 20,
|
|
1179
|
+
comment: 2e3,
|
|
1180
|
+
criteria: 30,
|
|
1181
|
+
criterion: 400,
|
|
1182
|
+
iterationPath: 200
|
|
1183
|
+
};
|
|
1184
|
+
var TRACKER_LINK_KINDS = ["pull_request", "work_item", "commit", "branch", "web"];
|
|
1185
|
+
var CONTROL = /[\u0000-\u0008\u000b-\u001f\u007f-\u009f]/g;
|
|
1186
|
+
function trackerLine(v, max) {
|
|
1187
|
+
if (typeof v !== "string") return "";
|
|
1188
|
+
const flat = v.replace(/[\r\n\u0085\u2028\u2029\t]+/g, " ").replace(CONTROL, "").replace(/\s+/g, " ").trim();
|
|
1189
|
+
return cut(flat, max).trim();
|
|
1190
|
+
}
|
|
1191
|
+
function trackerText(v, max) {
|
|
1192
|
+
if (typeof v !== "string") return "";
|
|
1193
|
+
const t = v.replace(/\r\n?|\u0085|\u2028|\u2029/g, "\n").replace(CONTROL, "").replace(/\n{3,}/g, "\n\n").trim();
|
|
1194
|
+
return t.length > max ? `${cut(t, max - 1)}\u2026` : t;
|
|
1195
|
+
}
|
|
1196
|
+
function cut(s, max) {
|
|
1197
|
+
if (s.length <= max) return s;
|
|
1198
|
+
const c = s.charCodeAt(max - 1);
|
|
1199
|
+
return s.slice(0, c >= 55296 && c <= 56319 ? max - 1 : max);
|
|
1200
|
+
}
|
|
1201
|
+
function trackerUrl(v) {
|
|
1202
|
+
if (typeof v !== "string" || v.length > TRACKER_LIMITS.url) return null;
|
|
1203
|
+
try {
|
|
1204
|
+
const u = new URL(v.trim());
|
|
1205
|
+
if (u.protocol !== "https:" || u.username || u.password) return null;
|
|
1206
|
+
return u.href.length <= TRACKER_LIMITS.url ? u.href : null;
|
|
1207
|
+
} catch {
|
|
1208
|
+
return null;
|
|
1209
|
+
}
|
|
1210
|
+
}
|
|
1211
|
+
function trackerLink(kind, relation, url, title, state = "") {
|
|
1212
|
+
const u = trackerUrl(url);
|
|
1213
|
+
if (!u || !TRACKER_LINK_KINDS.includes(kind)) return null;
|
|
1214
|
+
return {
|
|
1215
|
+
kind,
|
|
1216
|
+
relation: trackerLine(relation, TRACKER_LIMITS.word) || "Related",
|
|
1217
|
+
url: u,
|
|
1218
|
+
title: trackerLine(title, TRACKER_LIMITS.linkTitle) || u,
|
|
1219
|
+
state: trackerLine(state, TRACKER_LIMITS.word)
|
|
1220
|
+
};
|
|
1221
|
+
}
|
|
1222
|
+
function uniqueLinks(links) {
|
|
1223
|
+
const seen = /* @__PURE__ */ new Set();
|
|
1224
|
+
const out = [];
|
|
1225
|
+
for (const l of links) {
|
|
1226
|
+
if (!l || seen.has(l.url)) continue;
|
|
1227
|
+
seen.add(l.url);
|
|
1228
|
+
out.push(l);
|
|
1229
|
+
if (out.length >= TRACKER_LIMITS.links) break;
|
|
1230
|
+
}
|
|
1231
|
+
return out;
|
|
1232
|
+
}
|
|
1233
|
+
function latestComments(all) {
|
|
1234
|
+
return all.slice(-TRACKER_LIMITS.comments).map((c) => ({
|
|
1235
|
+
author: trackerLine(c.author, TRACKER_LIMITS.person) || null,
|
|
1236
|
+
at: typeof c.at === "string" && !Number.isNaN(Date.parse(c.at)) ? new Date(c.at).toISOString() : null,
|
|
1237
|
+
text: trackerText(c.text, TRACKER_LIMITS.comment)
|
|
1238
|
+
})).filter((c) => c.text !== "");
|
|
1239
|
+
}
|
|
1240
|
+
var trackerDate = (v) => typeof v === "string" && v && !Number.isNaN(Date.parse(v)) ? new Date(v).toISOString() : null;
|
|
1241
|
+
var LIST_ITEM = /^\s*(?:[-*+\u2022]|\d{1,3}[.)])\s+(?:\[[ xX]\]\s+)?(.*\S)\s*$/;
|
|
1242
|
+
var AC_HEADING = /^\s*(?:#{1,6}\s*|\*\*|__)?\s*(?:acceptance criteria|definition of done|done when)\s*:?\s*(?:\*\*|__)?\s*:?\s*$/i;
|
|
1243
|
+
var HEADING = /^\s*(?:#{1,6}\s+\S|\*\*[^*]+\*\*\s*:?\s*$)/;
|
|
1244
|
+
function criteriaFromField(text2) {
|
|
1245
|
+
const lines = text2.replace(/\r\n?/g, "\n").split("\n").map((l) => l.trim()).filter(Boolean);
|
|
1246
|
+
const items = lines.some((l) => LIST_ITEM.test(l)) ? lines.flatMap((l) => LIST_ITEM.test(l) ? [LIST_ITEM.exec(l)[1]] : []) : lines;
|
|
1247
|
+
return boundCriteria(items);
|
|
1248
|
+
}
|
|
1249
|
+
function criteriaFromText(text2) {
|
|
1250
|
+
const lines = text2.replace(/\r\n?/g, "\n").split("\n");
|
|
1251
|
+
const at2 = lines.findIndex((l) => AC_HEADING.test(l));
|
|
1252
|
+
if (at2 < 0) return [];
|
|
1253
|
+
const out = [];
|
|
1254
|
+
for (let i = at2 + 1; i < lines.length; i++) {
|
|
1255
|
+
const l = lines[i];
|
|
1256
|
+
if (!l.trim()) {
|
|
1257
|
+
if (out.length) {
|
|
1258
|
+
const next = lines.slice(i + 1).find((x) => x.trim());
|
|
1259
|
+
if (!next || !LIST_ITEM.test(next)) break;
|
|
1260
|
+
}
|
|
1261
|
+
continue;
|
|
1262
|
+
}
|
|
1263
|
+
const m = LIST_ITEM.exec(l);
|
|
1264
|
+
if (m) out.push(m[1]);
|
|
1265
|
+
else if (HEADING.test(l) || out.length) break;
|
|
1266
|
+
}
|
|
1267
|
+
return boundCriteria(out);
|
|
1268
|
+
}
|
|
1269
|
+
function boundCriteria(items) {
|
|
1270
|
+
return items.map((c) => trackerLine(c, TRACKER_LIMITS.criterion)).filter(Boolean).slice(0, TRACKER_LIMITS.criteria);
|
|
1271
|
+
}
|
|
1272
|
+
var JIRA_KEY = /^[A-Za-z][A-Za-z0-9_]{0,49}-[1-9][0-9]{0,9}$/;
|
|
1273
|
+
var isJiraCloudHost = (host) => /^[a-z0-9][a-z0-9-]{0,62}\.atlassian\.net$/.test(host.toLowerCase());
|
|
1274
|
+
function parseJiraIssueUrl(raw, o = {}) {
|
|
1275
|
+
let u;
|
|
1276
|
+
try {
|
|
1277
|
+
u = new URL(raw.trim());
|
|
1278
|
+
} catch {
|
|
1279
|
+
return null;
|
|
1280
|
+
}
|
|
1281
|
+
if (u.protocol !== "https:" || u.username || u.password || u.port) return null;
|
|
1282
|
+
const host = u.hostname.toLowerCase();
|
|
1283
|
+
if (!isJiraCloudHost(host) && !(o.anyHost && /^[a-z0-9.-]{1,253}$/.test(host) && host.includes("."))) return null;
|
|
1284
|
+
const m = /(?:^|\/)browse\/([^/?#]+)\/?$/.exec(u.pathname);
|
|
1285
|
+
let key2 = m ? safeDecode(m[1]) : u.searchParams.get("selectedIssue");
|
|
1286
|
+
if (!key2 || !JIRA_KEY.test(key2)) return null;
|
|
1287
|
+
key2 = key2.toUpperCase();
|
|
1288
|
+
return { site: `https://${host}`, key: key2, externalId: `${host}/${key2}`, url: `https://${host}/browse/${key2}` };
|
|
1289
|
+
}
|
|
1290
|
+
var safeDecode = (s) => {
|
|
1291
|
+
try {
|
|
1292
|
+
return decodeURIComponent(s);
|
|
1293
|
+
} catch {
|
|
1294
|
+
return null;
|
|
1295
|
+
}
|
|
1296
|
+
};
|
|
1297
|
+
var JIRA_TOKEN_ENV = { email: "JIRA_EMAIL", token: "JIRA_API_TOKEN", pat: "JIRA_PAT", site: "JIRA_SITE" };
|
|
1298
|
+
var GITHUB_TOKEN_ENV = ["GITHUB_TOKEN", "GH_TOKEN"];
|
|
1299
|
+
var ADF_INLINE_PARENTS = /* @__PURE__ */ new Set(["paragraph", "heading", "codeBlock"]);
|
|
1300
|
+
var ADF_LINE_LISTS = /* @__PURE__ */ new Set(["bulletList", "orderedList", "taskList", "listItem", "taskItem"]);
|
|
1301
|
+
function adfText(node, o = {}) {
|
|
1302
|
+
const walk = (n, depth) => {
|
|
1303
|
+
if (!n || typeof n !== "object" || depth > 64) return "";
|
|
1304
|
+
switch (n.type) {
|
|
1305
|
+
case "text":
|
|
1306
|
+
return typeof n.text === "string" ? n.text : "";
|
|
1307
|
+
case "hardBreak":
|
|
1308
|
+
return "\n";
|
|
1309
|
+
case "mention":
|
|
1310
|
+
case "emoji":
|
|
1311
|
+
return String(n.attrs?.text ?? n.attrs?.shortName ?? "");
|
|
1312
|
+
case "inlineCard":
|
|
1313
|
+
case "blockCard":
|
|
1314
|
+
return String(n.attrs?.url ?? "");
|
|
1315
|
+
}
|
|
1316
|
+
const kids = Array.isArray(n.content) ? n.content : [];
|
|
1317
|
+
if (ADF_INLINE_PARENTS.has(n.type)) return kids.map((k) => walk(k, depth + 1)).join("");
|
|
1318
|
+
const parts = kids.map((k) => walk(k, depth + 1)).filter((s) => s !== "");
|
|
1319
|
+
if (o.lists && (n.type === "bulletList" || n.type === "orderedList" || n.type === "taskList"))
|
|
1320
|
+
return parts.map((t, k) => `${n.type === "orderedList" ? `${k + 1}.` : "-"} ${t.replace(/\n+/g, " ")}`).join("\n");
|
|
1321
|
+
return parts.join(ADF_LINE_LISTS.has(n.type) ? "\n" : "\n\n");
|
|
1322
|
+
};
|
|
1323
|
+
return walk(node, 0);
|
|
1324
|
+
}
|
|
1325
|
+
var SYNC_EVERY_HOURS = [1, 2, 4, 8, 24];
|
|
1326
|
+
var TRACKER_READ_ITEMS_MAX = 1e3;
|
|
1327
|
+
var TRACKER_REPORT_BATCH_MAX = 50;
|
|
1328
|
+
var TRACKER_READ_CODES = ["not_configured", "not_allowed", "not_found", "tracker_error", "expired", "cancelled"];
|
|
1329
|
+
|
|
1330
|
+
// ../shared/src/work.ts
|
|
1331
|
+
var WORK_PREFIX = "work_";
|
|
1332
|
+
var ARTIFACT_PREFIX = "art_";
|
|
1333
|
+
var REVISION_PREFIX = "rev_";
|
|
1334
|
+
var REVIEW_PREFIX = "rvw_";
|
|
1335
|
+
var MEETING_PREFIX = "mtg_";
|
|
1336
|
+
var DECISION_PREFIX = "dec_";
|
|
1337
|
+
var ACTION_PREFIX = "act_";
|
|
1338
|
+
var KNOWLEDGE_PREFIX = "kn_";
|
|
1339
|
+
var GUEST_PREFIX = "gst_";
|
|
1340
|
+
var RANDOM = "[A-Za-z0-9_-]{22}";
|
|
1341
|
+
var idOf = (prefix) => new RegExp(`^${prefix}${RANDOM}$`);
|
|
1342
|
+
var WORK_ID = idOf(WORK_PREFIX);
|
|
1343
|
+
var ARTIFACT_ID = idOf(ARTIFACT_PREFIX);
|
|
1344
|
+
var REVISION_ID = idOf(REVISION_PREFIX);
|
|
1345
|
+
var REVIEW_ID = idOf(REVIEW_PREFIX);
|
|
1346
|
+
var MEETING_ID = idOf(MEETING_PREFIX);
|
|
1347
|
+
var DECISION_ID = idOf(DECISION_PREFIX);
|
|
1348
|
+
var ACTION_ID = idOf(ACTION_PREFIX);
|
|
1349
|
+
var KNOWLEDGE_ID = idOf(KNOWLEDGE_PREFIX);
|
|
1350
|
+
var GUEST_ID = idOf(GUEST_PREFIX);
|
|
1351
|
+
var WORK_GONE = "no such item in this project, or you are not allowed to see it";
|
|
1352
|
+
var STALE_VERSION = "this item changed since you read it";
|
|
1353
|
+
var Iso = external_exports.string().min(1).max(40);
|
|
1354
|
+
var Text = (max) => external_exports.string().max(max);
|
|
1355
|
+
var Title = external_exports.string().trim().min(1).max(200);
|
|
1356
|
+
var Digest = external_exports.string().regex(/^[0-9a-f]{64}$/);
|
|
1357
|
+
var MAX_BRIEF_CHARS = 2e4;
|
|
1358
|
+
var MAX_CRITERIA = 30;
|
|
1359
|
+
var MAX_CRITERION_CHARS = 500;
|
|
1360
|
+
var MAX_ARTIFACT_BODY_CHARS = 2e5;
|
|
1361
|
+
var MAX_AGENDA = 30;
|
|
1362
|
+
var MAX_PRE_READS = 20;
|
|
1363
|
+
var Criteria = external_exports.array(external_exports.string().trim().min(1).max(MAX_CRITERION_CHARS)).max(MAX_CRITERIA);
|
|
1364
|
+
var SourceProvider = external_exports.enum(["github", "azure", "jira", "parley", "manual", "unknown"]);
|
|
1365
|
+
var SourceRef = external_exports.object({
|
|
1366
|
+
provider: SourceProvider,
|
|
1367
|
+
/** `owner/name`, or null where unknown. */
|
|
1368
|
+
repo: external_exports.string().max(200).nullable(),
|
|
1369
|
+
path: external_exports.string().max(1e3),
|
|
1370
|
+
/** A commit SHA or tag, or null where unknown. */
|
|
1371
|
+
revision: external_exports.string().max(200).nullable()
|
|
1372
|
+
}).strict();
|
|
1373
|
+
var WorkState = external_exports.enum(["proposed", "accepted", "working", "blocked", "ready_for_review", "accepted_outcome", "cancelled"]);
|
|
1374
|
+
var WORK_STATE_LABEL = {
|
|
1375
|
+
proposed: "Proposed",
|
|
1376
|
+
accepted: "Accepted",
|
|
1377
|
+
working: "Working",
|
|
1378
|
+
blocked: "Blocked",
|
|
1379
|
+
ready_for_review: "Ready for review",
|
|
1380
|
+
accepted_outcome: "Outcome accepted",
|
|
1381
|
+
cancelled: "Cancelled"
|
|
1382
|
+
};
|
|
1383
|
+
var WORK_TRANSITIONS = {
|
|
1384
|
+
proposed: ["accepted", "cancelled"],
|
|
1385
|
+
accepted: ["working", "blocked", "cancelled"],
|
|
1386
|
+
working: ["blocked", "ready_for_review", "cancelled"],
|
|
1387
|
+
blocked: ["accepted", "working", "cancelled"],
|
|
1388
|
+
ready_for_review: ["working", "accepted_outcome", "cancelled"],
|
|
1389
|
+
accepted_outcome: [],
|
|
1390
|
+
cancelled: []
|
|
1391
|
+
};
|
|
1392
|
+
var Delegate = external_exports.object({ kind: external_exports.enum(["seat", "account", "team", "agent"]), ref: external_exports.string().min(1).max(200) }).strict();
|
|
1393
|
+
var L = TRACKER_LIMITS;
|
|
1394
|
+
var word = (max) => external_exports.string().max(max);
|
|
1395
|
+
var TrackerLinkSchema = external_exports.object({
|
|
1396
|
+
kind: external_exports.enum(["pull_request", "work_item", "commit", "branch", "web"]),
|
|
1397
|
+
relation: word(L.word),
|
|
1398
|
+
url: external_exports.url().max(L.url),
|
|
1399
|
+
title: word(L.linkTitle),
|
|
1400
|
+
state: word(L.word)
|
|
1401
|
+
}).strict();
|
|
1402
|
+
var TrackerCommentSchema = external_exports.object({ author: word(L.person).nullable(), at: external_exports.string().max(40).nullable(), text: external_exports.string().max(L.comment + 1) }).strict();
|
|
1403
|
+
var TrackerIterationSchema = external_exports.object({ name: word(L.word * 2), path: word(L.iterationPath), start: external_exports.string().max(40).nullable(), end: external_exports.string().max(40).nullable() }).strict();
|
|
1404
|
+
var TrackerSnapshotSchema = external_exports.object({
|
|
1405
|
+
key: word(L.key),
|
|
1406
|
+
type: word(L.word),
|
|
1407
|
+
state: word(L.word),
|
|
1408
|
+
assignee: word(L.person).nullable(),
|
|
1409
|
+
iteration: TrackerIterationSchema.nullable(),
|
|
1410
|
+
labels: external_exports.array(word(L.label)).max(L.labels),
|
|
1411
|
+
priority: word(L.word),
|
|
1412
|
+
points: external_exports.number().finite().min(0).max(1e5).nullable(),
|
|
1413
|
+
links: external_exports.array(TrackerLinkSchema).max(L.links),
|
|
1414
|
+
comments: external_exports.array(TrackerCommentSchema).max(L.comments),
|
|
1415
|
+
commentCount: external_exports.number().int().min(0).max(1e6),
|
|
1416
|
+
updatedAt: external_exports.string().max(40).nullable(),
|
|
1417
|
+
readAt: external_exports.string().max(40),
|
|
1418
|
+
readBy: external_exports.enum(["crossroom", "account", "runner"])
|
|
1419
|
+
}).strict();
|
|
1420
|
+
var WorkSource = external_exports.object({
|
|
1421
|
+
/** `native`: Crossroom holds the truth. `external`: the provider does, and Crossroom mirrors it. */
|
|
1422
|
+
authority: external_exports.enum(["native", "external"]),
|
|
1423
|
+
provider: SourceProvider.optional(),
|
|
1424
|
+
url: external_exports.string().max(2e3).optional(),
|
|
1425
|
+
externalId: external_exports.string().max(200).optional(),
|
|
1426
|
+
/** What the tracker said when it was last read; absent for an item made here, or imported before this was kept. */
|
|
1427
|
+
snapshot: TrackerSnapshotSchema.optional()
|
|
1428
|
+
}).strict();
|
|
1429
|
+
var AssignmentState = external_exports.enum(["proposed", "accepted", "declined", "countered"]);
|
|
1430
|
+
var Assignment = external_exports.object({
|
|
1431
|
+
state: AssignmentState,
|
|
1432
|
+
/** Who made the latest move: `account:<id>`. */
|
|
1433
|
+
by: external_exports.string().max(200),
|
|
1434
|
+
note: Text(1e3)
|
|
1435
|
+
}).strict();
|
|
1436
|
+
var WorkEventKind = external_exports.enum([
|
|
1437
|
+
"created",
|
|
1438
|
+
"edited",
|
|
1439
|
+
"transition",
|
|
1440
|
+
"assignment",
|
|
1441
|
+
"artifact_linked",
|
|
1442
|
+
"run_linked",
|
|
1443
|
+
"run_outcome",
|
|
1444
|
+
"external_update",
|
|
1445
|
+
"comment_sent",
|
|
1446
|
+
"imported"
|
|
1447
|
+
]);
|
|
1448
|
+
var ArtifactKind = external_exports.enum(["markdown", "text", "link"]);
|
|
1449
|
+
var ArtifactAudience = external_exports.enum(["project", "reviewers", "private"]);
|
|
1450
|
+
var RevisionStatus = external_exports.enum(["unreviewed", "changes_requested", "accepted", "superseded"]);
|
|
1451
|
+
var REVISION_STATUS_LABEL = {
|
|
1452
|
+
unreviewed: "Unreviewed",
|
|
1453
|
+
changes_requested: "Changes requested",
|
|
1454
|
+
accepted: "Accepted",
|
|
1455
|
+
superseded: "Superseded"
|
|
1456
|
+
};
|
|
1457
|
+
var ReviewVerdict = external_exports.enum(["comment", "request_changes", "accept", "supersede"]);
|
|
1458
|
+
var MeetingState = external_exports.enum(["draft", "open", "minutes_proposed", "closed"]);
|
|
1459
|
+
var MeetingLimits = external_exports.object({
|
|
1460
|
+
minutes: external_exports.number().int().min(1).max(24 * 60),
|
|
1461
|
+
turns: external_exports.number().int().min(1).max(500),
|
|
1462
|
+
usd: external_exports.number().min(0).max(1e3).optional()
|
|
1463
|
+
}).strict();
|
|
1464
|
+
var AgendaItem = external_exports.object({ title: Title, note: Text(2e3).optional() }).strict();
|
|
1465
|
+
var PreRead = external_exports.object({ artifactId: external_exports.string().min(1).max(100), revision: external_exports.number().int().min(1), digest: Digest.optional() }).strict();
|
|
1466
|
+
var ProposalState = external_exports.enum(["proposed", "accepted", "rejected"]);
|
|
1467
|
+
var ActionState = external_exports.enum(["proposed", "accepted", "declined"]);
|
|
1468
|
+
var KnowledgeKind = external_exports.enum(["decision", "finding", "open_question", "artifact"]);
|
|
1469
|
+
var KnowledgeAcceptance = external_exports.enum(["proposed", "accepted", "rejected"]);
|
|
1470
|
+
var KnowledgeAudience = external_exports.enum(["project", "reviewers"]);
|
|
1471
|
+
var KnowledgeOrigin = external_exports.enum(["entry", "fact", "decision", "artifact"]);
|
|
1472
|
+
var KnowledgeBasis = external_exports.enum(["quoted_fact", "accepted_decision", "artifact", "inference"]);
|
|
1473
|
+
var GuestObject = external_exports.object({ kind: external_exports.enum(["artifact_revision", "meeting_minutes"]), id: external_exports.string().min(1).max(100) }).strict();
|
|
1474
|
+
var WorkspaceKind = external_exports.enum(["personal", "org"]);
|
|
1475
|
+
var CreateWorkspaceInput = external_exports.object({ name: Title }).strict();
|
|
1476
|
+
var CreateWorkInput = external_exports.object({
|
|
1477
|
+
title: Title,
|
|
1478
|
+
brief: Text(MAX_BRIEF_CHARS).default(""),
|
|
1479
|
+
criteria: Criteria.default([]),
|
|
1480
|
+
delegate: Delegate.nullable().default(null),
|
|
1481
|
+
dependsOn: external_exports.array(external_exports.string().max(100)).max(30).default([]),
|
|
1482
|
+
expectedArtifactId: external_exports.string().max(100).nullable().default(null),
|
|
1483
|
+
reviewPoint: Iso.nullable().default(null)
|
|
1484
|
+
}).strict();
|
|
1485
|
+
var PatchWorkInput = external_exports.object({
|
|
1486
|
+
version: external_exports.number().int().min(1),
|
|
1487
|
+
title: Title.optional(),
|
|
1488
|
+
brief: Text(MAX_BRIEF_CHARS).optional(),
|
|
1489
|
+
criteria: Criteria.optional(),
|
|
1490
|
+
delegate: Delegate.nullable().optional(),
|
|
1491
|
+
dependsOn: external_exports.array(external_exports.string().max(100)).max(30).optional(),
|
|
1492
|
+
expectedArtifactId: external_exports.string().max(100).nullable().optional(),
|
|
1493
|
+
reviewPoint: Iso.nullable().optional()
|
|
1494
|
+
}).strict();
|
|
1495
|
+
var AssignmentInput = external_exports.object({ action: external_exports.enum(["propose", "accept", "decline", "counter"]), delegate: Delegate.optional(), note: Text(1e3).default("") }).strict();
|
|
1496
|
+
var TransitionInput = external_exports.object({ to: WorkState, version: external_exports.number().int().min(1), note: Text(1e3).default("") }).strict();
|
|
1497
|
+
var ProjectBriefInput = external_exports.object({ objective: Text(MAX_BRIEF_CHARS), version: external_exports.number().int().min(0) }).strict();
|
|
1498
|
+
var CreateArtifactInput = external_exports.object({
|
|
1499
|
+
title: Title,
|
|
1500
|
+
kind: ArtifactKind,
|
|
1501
|
+
audience: ArtifactAudience.default("project"),
|
|
1502
|
+
criteria: Criteria.default([]),
|
|
1503
|
+
body: Text(MAX_ARTIFACT_BODY_CHARS).optional(),
|
|
1504
|
+
url: external_exports.url().max(2e3).optional()
|
|
1505
|
+
}).strict();
|
|
1506
|
+
var CreateRevisionInput = external_exports.object({ body: Text(MAX_ARTIFACT_BODY_CHARS).optional(), url: external_exports.url().max(2e3).optional() }).strict();
|
|
1507
|
+
var CreateReviewInput = external_exports.object({
|
|
1508
|
+
revisionDigest: Digest,
|
|
1509
|
+
verdict: ReviewVerdict,
|
|
1510
|
+
criteriaChecked: external_exports.array(external_exports.number().int().min(0).max(MAX_CRITERIA)).max(MAX_CRITERIA).default([]),
|
|
1511
|
+
note: Text(4e3).default("")
|
|
1512
|
+
}).strict();
|
|
1513
|
+
var DiscussInput = external_exports.object({ workId: external_exports.string().regex(WORK_ID) }).strict();
|
|
1514
|
+
var SEAT_SUBMIT_MAX = 3e4;
|
|
1515
|
+
var SEAT_REPORT_STATES = ["working", "blocked", "ready_for_review"];
|
|
1516
|
+
var SubmitOpArgs = {
|
|
1517
|
+
body: external_exports.string().max(SEAT_SUBMIT_MAX)
|
|
1518
|
+
};
|
|
1519
|
+
var ReportOpArgs = {
|
|
1520
|
+
state: external_exports.enum(SEAT_REPORT_STATES),
|
|
1521
|
+
/** Longer than `SEAT_NOTE_MAX` is cut by the operation, not refused: the schema stays short. */
|
|
1522
|
+
note: external_exports.string().optional(),
|
|
1523
|
+
/** An item planned in this room (`P2`, or its work id), in a room with a plan; absent means the item the room was opened for. */
|
|
1524
|
+
item: external_exports.string().max(100).optional()
|
|
1525
|
+
};
|
|
1526
|
+
var PLAN_ITEMS_MAX = 12;
|
|
1527
|
+
var ROOM_PLAN_MAX = 24;
|
|
1528
|
+
var planLabel = (n) => `P${n}`;
|
|
1529
|
+
var PlanItemArg = external_exports.object({
|
|
1530
|
+
title: external_exports.string(),
|
|
1531
|
+
brief: external_exports.string().optional(),
|
|
1532
|
+
criteria: external_exports.array(external_exports.string()).optional(),
|
|
1533
|
+
/** A seat of this room, by letter or name. */
|
|
1534
|
+
assignee: external_exports.string().optional()
|
|
1535
|
+
});
|
|
1536
|
+
var PlanOpArgs = {
|
|
1537
|
+
items: external_exports.array(PlanItemArg).min(1).max(PLAN_ITEMS_MAX)
|
|
1538
|
+
};
|
|
1539
|
+
var AcceptPlanInput = external_exports.object({ ids: external_exports.array(external_exports.string().max(100)).min(1).max(ROOM_PLAN_MAX).optional() }).strict();
|
|
1540
|
+
var CreateMeetingInput = external_exports.object({
|
|
1541
|
+
title: Title,
|
|
1542
|
+
question: Text(2e3).default(""),
|
|
1543
|
+
agenda: external_exports.array(AgendaItem).max(MAX_AGENDA).default([]),
|
|
1544
|
+
preReads: external_exports.array(PreRead).max(MAX_PRE_READS).default([]),
|
|
1545
|
+
limits: MeetingLimits.default({ minutes: 60, turns: 40 })
|
|
1546
|
+
}).strict();
|
|
1547
|
+
var PatchMeetingInput = external_exports.object({
|
|
1548
|
+
title: Title.optional(),
|
|
1549
|
+
question: Text(2e3).optional(),
|
|
1550
|
+
agenda: external_exports.array(AgendaItem).max(MAX_AGENDA).optional(),
|
|
1551
|
+
preReads: external_exports.array(PreRead).max(MAX_PRE_READS).optional(),
|
|
1552
|
+
limits: MeetingLimits.optional()
|
|
1553
|
+
}).strict().extend({
|
|
1554
|
+
version: external_exports.number().int().min(1).optional(),
|
|
1555
|
+
/** New wording for proposed rows (rows already decided are refused). */
|
|
1556
|
+
decisions: external_exports.array(external_exports.object({ id: external_exports.string().min(1).max(100), text: Text(2e3).min(1) }).strict()).max(60).optional(),
|
|
1557
|
+
actions: external_exports.array(external_exports.object({ id: external_exports.string().min(1).max(100), text: Text(2e3).min(1), ownerAccountId: external_exports.string().max(100).nullable().optional(), criteria: Criteria.optional() }).strict()).max(60).optional()
|
|
1558
|
+
});
|
|
1559
|
+
var AcceptProposalInput = external_exports.object({
|
|
1560
|
+
text: Text(2e3).optional(),
|
|
1561
|
+
ownerAccountId: external_exports.string().max(100).optional(),
|
|
1562
|
+
/** Replaces the action's criteria when accepting an action. */
|
|
1563
|
+
criteria: Criteria.optional(),
|
|
1564
|
+
/** Decline the proposal (a decision is rejected, an action declined) instead of accepting it. */
|
|
1565
|
+
reject: external_exports.boolean().optional()
|
|
1566
|
+
}).strict();
|
|
1567
|
+
var CreateKnowledgeInput = external_exports.object({ kind: KnowledgeKind, text: Text(4e3).min(1), sources: external_exports.array(SourceRef).max(10).default([]), audience: KnowledgeAudience.default("project") }).strict();
|
|
1568
|
+
var KnowledgeDecisionInput = external_exports.object({ to: external_exports.enum(["accepted", "rejected"]).default("accepted") }).strict();
|
|
1569
|
+
var ImportInput = external_exports.object({ url: external_exports.url().max(2e3) }).strict();
|
|
1570
|
+
var ReportedImportInput = external_exports.object({
|
|
1571
|
+
provider: external_exports.enum(["github", "azure", "jira"]),
|
|
1572
|
+
/**
|
|
1573
|
+
* The item's address. It must parse for its provider, which gives the external id: a GitHub issue
|
|
1574
|
+
* or pull request, an Azure DevOps work item, or a Jira issue (`/browse/<KEY>`, a self-managed
|
|
1575
|
+
* site's too, since the command read it).
|
|
1576
|
+
*/
|
|
1577
|
+
url: external_exports.url().max(2e3),
|
|
1578
|
+
title: external_exports.string().trim().min(1).max(200),
|
|
1579
|
+
body: external_exports.string().max(MAX_BRIEF_CHARS).default(""),
|
|
1580
|
+
/** The tracker's own state word (Active, Resolved, Closed...), shown as it stands. */
|
|
1581
|
+
state: external_exports.string().trim().max(60).default(""),
|
|
1582
|
+
/** The tracker's own type word (Bug, Task, User Story...). */
|
|
1583
|
+
type: external_exports.string().trim().max(60).default(""),
|
|
1584
|
+
/** Who the tracker says it is assigned to, a display name; shown only, never matched to an account. */
|
|
1585
|
+
assignedTo: external_exports.string().trim().max(120).nullable().default(null),
|
|
1586
|
+
/** The item's own key: `PROJ-12`, `#42`. */
|
|
1587
|
+
key: word(L.key).optional(),
|
|
1588
|
+
criteria: external_exports.array(word(L.criterion)).max(L.criteria).optional(),
|
|
1589
|
+
iteration: TrackerIterationSchema.nullable().optional(),
|
|
1590
|
+
labels: external_exports.array(word(L.label)).max(L.labels).optional(),
|
|
1591
|
+
priority: word(L.word).optional(),
|
|
1592
|
+
points: external_exports.number().finite().min(0).max(1e5).nullable().optional(),
|
|
1593
|
+
links: external_exports.array(TrackerLinkSchema).max(L.links).optional(),
|
|
1594
|
+
comments: external_exports.array(TrackerCommentSchema).max(L.comments).optional(),
|
|
1595
|
+
commentCount: external_exports.number().int().min(0).max(1e6).optional(),
|
|
1596
|
+
updatedAt: external_exports.string().max(40).nullable().optional()
|
|
1597
|
+
}).strict();
|
|
1598
|
+
var ReportedBatchInput = external_exports.object({ items: external_exports.array(ReportedImportInput).min(1).max(TRACKER_REPORT_BATCH_MAX) }).strict();
|
|
1599
|
+
var RunnerReadInput = external_exports.object({ url: external_exports.url().max(2e3), runner: external_exports.string().trim().min(1).max(120) }).strict();
|
|
1600
|
+
var FilterName = external_exports.object({ name: external_exports.string().trim().min(1).max(200) }).strict();
|
|
1601
|
+
var TrackerFilterSchema = external_exports.object({
|
|
1602
|
+
assignee: external_exports.union([external_exports.enum(["me", "anyone", "unassigned"]), FilterName]).default("anyone"),
|
|
1603
|
+
states: external_exports.array(external_exports.string().trim().min(1).max(200)).max(20).default([]),
|
|
1604
|
+
types: external_exports.array(external_exports.string().trim().min(1).max(200)).max(20).default([]),
|
|
1605
|
+
sprint: external_exports.union([external_exports.enum(["any", "current"]), FilterName]).default("any"),
|
|
1606
|
+
area: external_exports.string().trim().max(200).nullable().default(null),
|
|
1607
|
+
labels: external_exports.array(external_exports.string().trim().min(1).max(200)).max(20).default([]),
|
|
1608
|
+
text: external_exports.string().trim().max(200).nullable().default(null),
|
|
1609
|
+
raw: external_exports.string().trim().max(2e3).nullable().default(null)
|
|
1610
|
+
}).strict();
|
|
1611
|
+
var TrackerSearchInput = external_exports.object({
|
|
1612
|
+
provider: external_exports.enum(["github", "azure", "jira"]),
|
|
1613
|
+
where: external_exports.url().max(2e3),
|
|
1614
|
+
query: external_exports.string().trim().max(2e3).nullable().optional(),
|
|
1615
|
+
filter: TrackerFilterSchema.nullable().optional(),
|
|
1616
|
+
sprint: external_exports.enum(["current"]).nullable().optional(),
|
|
1617
|
+
team: external_exports.string().trim().max(120).nullable().optional(),
|
|
1618
|
+
cursor: external_exports.string().max(600).nullable().optional(),
|
|
1619
|
+
pageSize: external_exports.number().int().min(1).max(100).optional()
|
|
1620
|
+
}).strict();
|
|
1621
|
+
var TrackerDiscoverInput = external_exports.object({
|
|
1622
|
+
provider: external_exports.enum(["github", "azure", "jira"]),
|
|
1623
|
+
what: external_exports.enum(["milestones", "labels", "projects", "teams", "iterations", "types", "boards", "sprints", "statuses"]),
|
|
1624
|
+
where: external_exports.url().max(2e3),
|
|
1625
|
+
team: external_exports.string().trim().max(120).nullable().optional()
|
|
1626
|
+
}).strict();
|
|
1627
|
+
var TrackerSyncInput = external_exports.object({
|
|
1628
|
+
name: external_exports.string().trim().min(1).max(80),
|
|
1629
|
+
provider: external_exports.enum(["github", "azure", "jira"]),
|
|
1630
|
+
where: external_exports.url().max(2e3),
|
|
1631
|
+
query: external_exports.string().trim().max(2e3).default(""),
|
|
1632
|
+
sprint: external_exports.enum(["current"]).nullable().default(null),
|
|
1633
|
+
/** An Azure DevOps team, for `sprint: 'current'`. */
|
|
1634
|
+
team: external_exports.string().trim().max(120).nullable().default(null),
|
|
1635
|
+
limit: external_exports.number().int().min(1).max(TRACKER_READ_ITEMS_MAX).default(200),
|
|
1636
|
+
everyHours: external_exports.union(SYNC_EVERY_HOURS.map((h) => external_exports.literal(h))),
|
|
1637
|
+
runner: external_exports.string().trim().min(1).max(120),
|
|
1638
|
+
enabled: external_exports.boolean().default(true),
|
|
1639
|
+
/**
|
|
1640
|
+
* Choices instead of a condition (`TrackerFilter`, `@parley/shared/tracker-read`): compiled into
|
|
1641
|
+
* the tracker's language when saved, kept beside the compiled `query` so the web can show it again.
|
|
1642
|
+
* With a filter, `query` rides inside it as its `raw` part, and `sprint` as its `sprint`.
|
|
1643
|
+
*/
|
|
1644
|
+
filter: TrackerFilterSchema.nullable().default(null)
|
|
1645
|
+
}).strict();
|
|
1646
|
+
var TrackerSyncPatch = TrackerSyncInput.partial().extend({ id: external_exports.string().min(1).max(64), version: external_exports.number().int().min(1) }).strict();
|
|
1647
|
+
var TrackerSyncRef = external_exports.object({ id: external_exports.string().min(1).max(64) }).strict();
|
|
1648
|
+
var CommentInput = external_exports.object({ text: external_exports.string().trim().min(1).max(1e4), runner: external_exports.string().min(1).max(64) }).strict();
|
|
1649
|
+
var ApproveCommentInput = external_exports.object({ id: external_exports.string().regex(/^wcm_[A-Za-z0-9_-]{16,32}$/), digest: external_exports.string().regex(/^[0-9a-f]{64}$/) }).strict();
|
|
1650
|
+
var EditCommentInput = external_exports.object({ id: external_exports.string().regex(/^wcm_[A-Za-z0-9_-]{16,32}$/), text: external_exports.string().trim().min(1).max(1e4) }).strict();
|
|
1651
|
+
var CommentApprovalRule = external_exports.enum(["self", "second"]);
|
|
1652
|
+
var COMMENT_RULE_WORDS = {
|
|
1653
|
+
self: "In a personal workspace you may approve a comment you wrote yourself.",
|
|
1654
|
+
second: "This project asks for a second person: a comment has to be approved by an editor or admin other than the one who wrote it."
|
|
1655
|
+
};
|
|
1656
|
+
var SECOND_PERSON_NEEDED = COMMENT_RULE_WORDS.second;
|
|
1657
|
+
var DelegateRunInput = external_exports.object({ playbook: external_exports.string().min(1).max(100), inputs: external_exports.record(external_exports.string(), external_exports.string().max(4e3)).default({}), preview: external_exports.boolean().default(false) }).strict();
|
|
1658
|
+
var WorkRunState = external_exports.enum(["starting", "running", "done", "failed", "cancelled", "lost"]);
|
|
1659
|
+
var CreateGuestInput = external_exports.object({ objects: external_exports.array(GuestObject).min(1).max(20), expiresInDays: external_exports.number().int().min(1).max(30).default(7) }).strict();
|
|
1660
|
+
var GuestReviewInput = CreateReviewInput.extend({ artifactId: external_exports.string().min(1).max(100), revision: external_exports.number().int().min(1) }).strict();
|
|
1661
|
+
var CopyInput = external_exports.object({ preview: external_exports.boolean().default(true), targetProjectId: external_exports.string().max(100).optional(), idempotencyKey: external_exports.string().min(8).max(100).optional() }).strict();
|
|
1662
|
+
var EXPORT_FORMATS = ["json", "md", "package"];
|
|
1663
|
+
|
|
1114
1664
|
// ../shared/src/render.ts
|
|
1115
1665
|
var CLOSE_OUT_WORDS = { decisions: "Decisions", actions: "Actions", open: "Still open" };
|
|
1116
1666
|
var LINE_BREAKS = /\r\n|[\n\r\v\f\u0085\u2028\u2029]/g;
|
|
@@ -1388,6 +1938,13 @@ ${CLOSE_OUT_WORDS[f]}: ${c[f].join("; ")}`);
|
|
|
1388
1938
|
const to = LANE_STATE_WORDS[p.to] ?? String(p.to);
|
|
1389
1939
|
return { seq: ev.seq, type: ev.type, from, at: at2, text: p.from === p.to ? `Added a note to ${id}.` : `Moved ${id} to ${to}.`, note: `Crossroom: items id=${id} has the note and the history.` };
|
|
1390
1940
|
}
|
|
1941
|
+
case "plan_updated": {
|
|
1942
|
+
const items = Array.isArray(p.items) ? p.items : [];
|
|
1943
|
+
const each = items.slice(0, 12).map((i) => `${planLabel(Number(i.n))} ${stateWord(String(i.state))}${typeof i.slot === "number" ? ` (${slotLetter(i.slot)})` : ""}`).join(", ");
|
|
1944
|
+
const more = items.length > 12 ? ` and ${items.length - 12} more` : "";
|
|
1945
|
+
const what = p.kind === "planned" ? "Planned" : p.kind === "accepted" ? "The owner accepted" : "Reported";
|
|
1946
|
+
return { seq: ev.seq, type: ev.type, from, at: at2, text: `${what}: ${each}${more}.`, note: "Crossroom: `progress` shows every item of the plan and who has it; `report item=` moves yours." };
|
|
1947
|
+
}
|
|
1391
1948
|
case "lane_settings": {
|
|
1392
1949
|
const words = AUTONOMY_WORDS[p.autonomy] ?? String(p.autonomy);
|
|
1393
1950
|
const who2 = p.by === "owner" ? `The owner set side ${String(p.side)}'s pass` : `Side ${String(p.by)} set its own pass`;
|
|
@@ -1782,6 +2339,9 @@ function renderWait(d, nonce = newNonce()) {
|
|
|
1782
2339
|
const leave = away ? ` Nobody has taken ${away} yet: the owner invited someone who may be hours away. You may end your turn now; your question stays in the room, and so will the answer.` : "";
|
|
1783
2340
|
const team = seats(d.teamAnswer);
|
|
1784
2341
|
const later = team ? ` Nobody has taken ${team} yet: a person on the team the other organisation granted will answer, and may be hours away. You may end your turn now; your question stays in the room, and so will the answer.` : "";
|
|
2342
|
+
const open = live ? (d.noAgent ?? []).map(slotLetter) : [];
|
|
2343
|
+
const letters = open.length > 1 ? `${open.slice(0, -1).join(", ")} and ${open.at(-1)}` : open[0] ?? "";
|
|
2344
|
+
const arrive = open.length ? ` Seat${open.length > 1 ? "s" : ""} ${letters} ${open.length > 1 ? "have" : "has"} no agent yet: ask your user to send ${open.length > 1 ? "each" : "it"} its join line.` : "";
|
|
1785
2345
|
const asking = seats(d.asking);
|
|
1786
2346
|
const back = asking ? ` The agent in ${asking} is asking its own user something and comes back when they answer.` : "";
|
|
1787
2347
|
const approving = seats(d.approval);
|
|
@@ -1791,7 +2351,7 @@ function renderWait(d, nonce = newNonce()) {
|
|
|
1791
2351
|
const silent = seats(d.quiet);
|
|
1792
2352
|
const quiet = silent ? ` The agent in ${silent} has made no call for over two minutes, so it may have stopped listening; what you say stays in the room for it.` : "";
|
|
1793
2353
|
if (d.lane) return "(nothing new in the lane) Nobody waits in a lane: stop here. Run your pass when your user asks, or on its schedule.";
|
|
1794
|
-
return `(no new activity after ${d.secs}s; session status=${d.status}) Call wait again${live ? "." : " \u2014 actually the session has ended; stop."}${back}${held}${steppedAway(d)}${inSideRoom(d)}${idle}${quiet}${leave}${later}`;
|
|
2354
|
+
return `(no new activity after ${d.secs}s; session status=${d.status}) Call wait again${live ? "." : " \u2014 actually the session has ended; stop."}${back}${held}${steppedAway(d)}${inSideRoom(d)}${idle}${quiet}${arrive}${leave}${later}`;
|
|
1795
2355
|
}
|
|
1796
2356
|
const who = whoFor(d.seats);
|
|
1797
2357
|
const items = d.events.map(
|
|
@@ -1881,9 +2441,37 @@ function renderSubmitted(d) {
|
|
|
1881
2441
|
return `${d.created ? "Started the item's artifact with your text (revision 1)." : `Added revision ${d.revision} to the item's artifact.`} A person reviews it; a seat's submission is never accepted by itself.`;
|
|
1882
2442
|
}
|
|
1883
2443
|
function renderReported(d) {
|
|
1884
|
-
|
|
2444
|
+
const it = d.item ? oneLine(d.item) : "The item";
|
|
2445
|
+
if (!d.changed) return `${it} is already ${stateWord(d.state)}.`;
|
|
1885
2446
|
const via = d.via ? ` (through ${stateWord(d.via)})` : "";
|
|
1886
|
-
return
|
|
2447
|
+
return `${it} is now ${stateWord(d.state)}${via}.${d.state === "ready_for_review" ? " Its owner decides whether to accept the outcome." : ""}${d.item ? " The other seats are told." : ""}`;
|
|
2448
|
+
}
|
|
2449
|
+
function planLines(items) {
|
|
2450
|
+
return items.map((i) => {
|
|
2451
|
+
const who = i.assignee ? `${i.assignee.letter} \xB7 ${oneLine(i.assignee.name)}` : "nobody yet";
|
|
2452
|
+
const note = i.note ? ` (last note: ${oneLine(i.note)})` : "";
|
|
2453
|
+
return `- ${oneLine(i.label)} [${stateWord(i.state)}, ${who}] ${oneLine(i.title)}${note}`;
|
|
2454
|
+
});
|
|
2455
|
+
}
|
|
2456
|
+
function renderPlan(d, nonce = newNonce()) {
|
|
2457
|
+
return [
|
|
2458
|
+
`Put ${d.planned.length} item${d.planned.length === 1 ? "" : "s"} into the project's work; this room's plan holds ${d.total}. ${fenceNote(nonce)}`,
|
|
2459
|
+
"",
|
|
2460
|
+
fence(nonce, "plan", planLines(d.planned).join("\n")),
|
|
2461
|
+
"Crossroom: they are proposed until a person accepts them into work. Each seat is told; tell them in the room what you need back. `progress` shows where each stands."
|
|
2462
|
+
].join("\n");
|
|
2463
|
+
}
|
|
2464
|
+
function renderProgress(d, nonce = newNonce()) {
|
|
2465
|
+
if (!d.items.length)
|
|
2466
|
+
return d.lead ? "This room has no plan yet. As its lead, `plan` puts one into the project and assigns each item to a seat." : "This room has no plan yet. Its lead puts one in, and you are told when it does.";
|
|
2467
|
+
const mine = d.items.filter((i) => i.assignee?.letter === d.me).map((i) => i.label);
|
|
2468
|
+
const proposed = d.items.filter((i) => i.state === "proposed").length;
|
|
2469
|
+
return [
|
|
2470
|
+
`This room's plan, ${d.items.length} item${d.items.length === 1 ? "" : "s"}. ${fenceNote(nonce)}`,
|
|
2471
|
+
"",
|
|
2472
|
+
fence(nonce, "plan", planLines(d.items).join("\n")),
|
|
2473
|
+
`Crossroom: ${mine.length ? `yours: ${mine.join(", ")}. \`report item=<P> state=working|blocked|ready_for_review\` moves one` : "none is assigned to you"}.${proposed ? ` ${proposed} still wait for a person to accept them into work.` : ""}${d.lead ? " As lead you may report on any of them." : ""}`
|
|
2474
|
+
].join("\n");
|
|
1887
2475
|
}
|
|
1888
2476
|
var CALL_STATE_WORDS = {
|
|
1889
2477
|
pending: "is still waiting for the owner, who decides from the room page. Carry on meanwhile; wait tells you how it went.",
|
|
@@ -2052,9 +2640,9 @@ function laneCall(seatUrl, op, args) {
|
|
|
2052
2640
|
return op === "items" ? `curl -s "${seatUrl}/items${args}"` : `curl -s -X POST ${seatUrl}/${op} ${args}`;
|
|
2053
2641
|
}
|
|
2054
2642
|
function renderLanePass(d, nonce = newNonce(), { scheduled = false } = {}) {
|
|
2055
|
-
const
|
|
2056
|
-
const c = (op, args) => `\`${laneCall(
|
|
2057
|
-
const schedule =
|
|
2643
|
+
const L2 = d.seatUrl;
|
|
2644
|
+
const c = (op, args) => `\`${laneCall(L2, op, args)}\``;
|
|
2645
|
+
const schedule = L2 && !scheduled ? laneScheduleBlock(L2, d.autonomy) : [];
|
|
2058
2646
|
const lines = [
|
|
2059
2647
|
`# Crossroom lane pass: side ${d.me} (you), with ${d.other.name} (side ${d.other.letter})`,
|
|
2060
2648
|
`Your pass: ${AUTONOMY_WORDS[d.autonomy]}. ${d.needs.length} item${d.needs.length === 1 ? "" : "s"} need${d.needs.length === 1 ? "s" : ""} you; ${d.waiting} wait${d.waiting === 1 ? "s" : ""} on the other side.`,
|
|
@@ -2115,14 +2703,14 @@ function renderLanePass(d, nonce = newNonce(), { scheduled = false } = {}) {
|
|
|
2115
2703
|
lines.push(...schedule);
|
|
2116
2704
|
return lines.join("\n");
|
|
2117
2705
|
}
|
|
2118
|
-
function laneScheduleBlock(
|
|
2706
|
+
function laneScheduleBlock(L2, autonomy) {
|
|
2119
2707
|
return [
|
|
2120
2708
|
"",
|
|
2121
2709
|
"## Running this pass on a schedule",
|
|
2122
|
-
`Anything that runs your agent in this repository with the prompt "${passPrompt(`${
|
|
2123
|
-
...scheduleLines(`${
|
|
2710
|
+
`Anything that runs your agent in this repository with the prompt "${passPrompt(`${L2}/pass?scheduled=1`)}" runs this pass. Offer your user one of these, once:`,
|
|
2711
|
+
...scheduleLines(`${L2}/pass`, curlRule(L2), autonomy),
|
|
2124
2712
|
"",
|
|
2125
|
-
`Permission: allow \`${curlRule(
|
|
2713
|
+
`Permission: allow \`${curlRule(L2)}\` and every call above runs without asking.`
|
|
2126
2714
|
];
|
|
2127
2715
|
}
|
|
2128
2716
|
function laneBriefing(d, l, seatUrl, nonce) {
|
|
@@ -2242,8 +2830,8 @@ var DEFAULT_ORDER = 1e3;
|
|
|
2242
2830
|
var RESERVED = /* @__PURE__ */ new Set(["help"]);
|
|
2243
2831
|
var WORD = /^[a-z][a-z0-9-]*$/;
|
|
2244
2832
|
var registered = [];
|
|
2245
|
-
function findCommand(
|
|
2246
|
-
return registered.find((c) => c.name ===
|
|
2833
|
+
function findCommand(word2) {
|
|
2834
|
+
return registered.find((c) => c.name === word2 || (c.aliases?.includes(word2) ?? false));
|
|
2247
2835
|
}
|
|
2248
2836
|
function registerCommand(cmd) {
|
|
2249
2837
|
const words = [cmd.name, ...cmd.aliases ?? []];
|
|
@@ -2272,10 +2860,11 @@ var UNLISTED_FLAGS = [
|
|
|
2272
2860
|
"seat",
|
|
2273
2861
|
"service",
|
|
2274
2862
|
"service-env",
|
|
2863
|
+
// Every command: an error no command expected prints its stack (cli.ts `unexpectedError`), which its one line names.
|
|
2864
|
+
"debug",
|
|
2275
2865
|
// Flags of commands whose help line has no room for them.
|
|
2276
2866
|
"api",
|
|
2277
2867
|
"cancel-move",
|
|
2278
|
-
"config",
|
|
2279
2868
|
"data",
|
|
2280
2869
|
"description",
|
|
2281
2870
|
"github",
|
|
@@ -2283,12 +2872,9 @@ var UNLISTED_FLAGS = [
|
|
|
2283
2872
|
"link",
|
|
2284
2873
|
"minutes",
|
|
2285
2874
|
"move",
|
|
2286
|
-
"provider",
|
|
2287
2875
|
"since",
|
|
2288
|
-
"site",
|
|
2289
2876
|
"team-token",
|
|
2290
2877
|
"to",
|
|
2291
|
-
"workspace",
|
|
2292
2878
|
// Older names: `panel open --server`, from before every command took `--instance`.
|
|
2293
2879
|
"server"
|
|
2294
2880
|
];
|
|
@@ -2392,6 +2978,18 @@ function overviewLines() {
|
|
|
2392
2978
|
var ROOM_PROTOCOL = "parley-room/1";
|
|
2393
2979
|
var LOCAL_COPY_HEADER = "x-parley-local-copy";
|
|
2394
2980
|
var SEAT_FINISHED = "This seat has already finished, so it takes no further part in the room. Nothing was recorded.";
|
|
2981
|
+
var NOT_FOUND = {
|
|
2982
|
+
/** A room's owner routes: `{"error": PRIVATE_ROOM}`, 404. */
|
|
2983
|
+
room: "no such room, or you are not its owner. A room is private to whoever opened it: open it in the browser that created it, or use the owner link you were given when it was created.",
|
|
2984
|
+
/** A seat token in `x-parley-seat` that opens nothing: `{"error": …}`, 404. */
|
|
2985
|
+
seat: "This is not, or is no longer, a Crossroom seat. Ask whoever sent the link for a fresh one.",
|
|
2986
|
+
/** A share link that opens nothing: `{"error": …}`, 404. */
|
|
2987
|
+
share: "This shared room does not exist, or its owner stopped sharing it.",
|
|
2988
|
+
/** An unmatched path under a declared prefix (`/api`, `/mcp`, `/ask`, `/auth`, `/scim`, `/fed`, `/.well-known`): `{"error": …}`, 404. */
|
|
2989
|
+
endpoint: "no such endpoint",
|
|
2990
|
+
/** An unmatched path under `/j`: this text, `text/plain; charset=utf-8`, 404. */
|
|
2991
|
+
seatLink: "Not a Crossroom seat link. Ask whoever sent it for a fresh one.\n"
|
|
2992
|
+
};
|
|
2395
2993
|
var CONFORMANCE_CHECKS = [
|
|
2396
2994
|
"identical-404",
|
|
2397
2995
|
"get-wait-405",
|
|
@@ -2551,7 +3149,7 @@ var summarise = (p) => {
|
|
|
2551
3149
|
}
|
|
2552
3150
|
};
|
|
2553
3151
|
function runnerAvailability(opts = {}) {
|
|
2554
|
-
|
|
3152
|
+
const clis = Object.keys(ADAPTERS).map((id) => {
|
|
2555
3153
|
const a = opts.adapters?.[id] ?? ADAPTERS[id];
|
|
2556
3154
|
const p = (opts.resolveBin ?? resolveBin)(a.bin);
|
|
2557
3155
|
let note = p ? "installed" : `"${a.bin}" not found on PATH`;
|
|
@@ -2561,7 +3159,11 @@ function runnerAvailability(opts = {}) {
|
|
|
2561
3159
|
const available = !!p && !a.hostedBlocked;
|
|
2562
3160
|
return { id, label: a.label, name: a.label, available, blocked: !!a.hostedBlocked, path: p, note, reason: available ? void 0 : note };
|
|
2563
3161
|
});
|
|
3162
|
+
const api = !!opts.apiKey;
|
|
3163
|
+
const apiNote = api ? "runs on the Anthropic API" : "runs on the Anthropic API once this Crossroom is given an API key";
|
|
3164
|
+
return [...clis, { id: "api", label: API_LABEL, name: API_LABEL, available: api, blocked: false, path: null, note: apiNote, reason: api ? void 0 : apiNote }];
|
|
2564
3165
|
}
|
|
3166
|
+
var API_LABEL = "Crossroom's agent";
|
|
2565
3167
|
var isThenable = (v) => typeof v?.then === "function";
|
|
2566
3168
|
function after(v, fn) {
|
|
2567
3169
|
return isThenable(v) ? Promise.resolve(v).then(fn) : fn(v);
|
|
@@ -2946,6 +3548,109 @@ ${lastError}`, code);
|
|
|
2946
3548
|
}
|
|
2947
3549
|
};
|
|
2948
3550
|
|
|
3551
|
+
// src/net-errors.ts
|
|
3552
|
+
var REQUEST_TIMEOUT_MS = 15e3;
|
|
3553
|
+
var TLS_CODES = /* @__PURE__ */ new Set([
|
|
3554
|
+
"CERT_HAS_EXPIRED",
|
|
3555
|
+
"CERT_NOT_YET_VALID",
|
|
3556
|
+
"DEPTH_ZERO_SELF_SIGNED_CERT",
|
|
3557
|
+
"SELF_SIGNED_CERT_IN_CHAIN",
|
|
3558
|
+
"UNABLE_TO_VERIFY_LEAF_SIGNATURE",
|
|
3559
|
+
"UNABLE_TO_GET_ISSUER_CERT",
|
|
3560
|
+
"UNABLE_TO_GET_ISSUER_CERT_LOCALLY",
|
|
3561
|
+
"ERR_TLS_CERT_ALTNAME_INVALID",
|
|
3562
|
+
"CERT_UNTRUSTED",
|
|
3563
|
+
"CERT_REVOKED",
|
|
3564
|
+
"ERR_SSL_WRONG_VERSION_NUMBER"
|
|
3565
|
+
]);
|
|
3566
|
+
function causeOf(e) {
|
|
3567
|
+
let c = e?.cause ?? e;
|
|
3568
|
+
if (Array.isArray(c?.errors) && c.errors.length) c = c.errors[0];
|
|
3569
|
+
return { code: typeof c?.code === "string" ? c.code : "", message: typeof c?.message === "string" ? c.message : "" };
|
|
3570
|
+
}
|
|
3571
|
+
function reasonOf(e) {
|
|
3572
|
+
const name = e?.name;
|
|
3573
|
+
if (name === "TimeoutError") return { reason: "timeout", code: "", message: "" };
|
|
3574
|
+
const { code, message: message2 } = causeOf(e);
|
|
3575
|
+
if (code === "ENOTFOUND" || code === "EAI_AGAIN" || code === "EAI_NONAME") return { reason: "dns", code, message: message2 };
|
|
3576
|
+
if (code === "ECONNREFUSED") return { reason: "refused", code, message: message2 };
|
|
3577
|
+
if (code === "ETIMEDOUT" || code === "UND_ERR_CONNECT_TIMEOUT") return { reason: "connect-timeout", code, message: message2 };
|
|
3578
|
+
if (code === "ECONNRESET" || code === "UND_ERR_SOCKET" || code === "EPIPE") return { reason: "reset", code, message: message2 };
|
|
3579
|
+
if (code === "EHOSTUNREACH" || code === "ENETUNREACH" || code === "ENETDOWN") return { reason: "unreachable", code, message: message2 };
|
|
3580
|
+
if (TLS_CODES.has(code) || /certificate/i.test(message2)) return { reason: "tls", code, message: message2 };
|
|
3581
|
+
if (/redirect/i.test(message2)) return { reason: "redirect", code, message: message2 };
|
|
3582
|
+
return { reason: "other", code, message: message2 || String(e?.message ?? e) };
|
|
3583
|
+
}
|
|
3584
|
+
var PROXY_VARS = ["HTTPS_PROXY", "https_proxy", "HTTP_PROXY", "http_proxy", "ALL_PROXY", "all_proxy"];
|
|
3585
|
+
function noProxy(host, env) {
|
|
3586
|
+
const list = (env.NO_PROXY ?? env.no_proxy ?? "").split(/[,\s]+/).filter(Boolean);
|
|
3587
|
+
const bare = host.replace(/:\d+$/, "").toLowerCase();
|
|
3588
|
+
return list.some((entry) => {
|
|
3589
|
+
const e = entry.replace(/:\d+$/, "").replace(/^\*?\./, "").toLowerCase();
|
|
3590
|
+
return entry === "*" || bare === e || bare.endsWith(`.${e}`);
|
|
3591
|
+
});
|
|
3592
|
+
}
|
|
3593
|
+
var isLoopback = (hostname) => hostname === "localhost" || hostname === "[::1]" || /^127\./.test(hostname);
|
|
3594
|
+
function proxyNote(url, env) {
|
|
3595
|
+
const set = PROXY_VARS.find((v) => env[v]?.trim());
|
|
3596
|
+
if (!set || isLoopback(url.hostname) || noProxy(url.host, env)) return "";
|
|
3597
|
+
if (env.NODE_USE_ENV_PROXY === "1") return ` The request went through the proxy in ${set}: check that the proxy is up and allows ${url.host}.`;
|
|
3598
|
+
return ` ${set} is set, but Node connects directly unless it is started with NODE_USE_ENV_PROXY=1 (Node 22.21 or later): set that and run this again.`;
|
|
3599
|
+
}
|
|
3600
|
+
function unreachableLine(url, e, opts = {}) {
|
|
3601
|
+
const u = new URL(url);
|
|
3602
|
+
const host = u.host;
|
|
3603
|
+
const env = opts.env ?? process.env;
|
|
3604
|
+
const { reason, code, message: message2 } = reasonOf(e);
|
|
3605
|
+
const s = Math.max(1, Math.round((opts.timeoutMs ?? REQUEST_TIMEOUT_MS) / 1e3));
|
|
3606
|
+
const seconds = s === 1 ? "1 second" : `${s} seconds`;
|
|
3607
|
+
const withProxy = (s2) => s2 + proxyNote(u, env);
|
|
3608
|
+
switch (reason) {
|
|
3609
|
+
case "dns":
|
|
3610
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (DNS lookup failed): check your connection and the address, or name another instance with --relay <url>.`) };
|
|
3611
|
+
case "refused":
|
|
3612
|
+
return {
|
|
3613
|
+
reason,
|
|
3614
|
+
line: withProxy(
|
|
3615
|
+
isLoopback(u.hostname) ? `Couldn't reach ${host} (connection refused): nothing is listening there. Start that Crossroom, or name another instance with --relay <url>.` : `Couldn't reach ${host} (connection refused): check the address, or name another instance with --relay <url>.`
|
|
3616
|
+
)
|
|
3617
|
+
};
|
|
3618
|
+
case "timeout":
|
|
3619
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (no answer in ${seconds}): it may be down or the network slow. Try again in a minute.`) };
|
|
3620
|
+
case "connect-timeout":
|
|
3621
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (the connection timed out): check your connection, or whether a firewall lets it through.`) };
|
|
3622
|
+
case "reset":
|
|
3623
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (the connection was cut off): try again; if it keeps happening, a firewall or proxy may be in the way.`) };
|
|
3624
|
+
case "unreachable":
|
|
3625
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (network unreachable): check your connection.`) };
|
|
3626
|
+
case "tls":
|
|
3627
|
+
return {
|
|
3628
|
+
reason,
|
|
3629
|
+
line: withProxy(
|
|
3630
|
+
`Couldn't reach ${host} (its certificate was not trusted${code ? `: ${code}` : ""}): if your network inspects HTTPS through a proxy or antivirus, point NODE_EXTRA_CA_CERTS at its certificate.`
|
|
3631
|
+
)
|
|
3632
|
+
};
|
|
3633
|
+
case "redirect":
|
|
3634
|
+
return {
|
|
3635
|
+
reason,
|
|
3636
|
+
line: `Couldn't reach ${host} (it answered with a redirect, which Crossroom does not follow, since the request may carry a token): use the address it moved to, with --relay <url>.`
|
|
3637
|
+
};
|
|
3638
|
+
default:
|
|
3639
|
+
return { reason, line: withProxy(`Couldn't reach ${host} (${(message2 || "the request failed").replace(/\s+/g, " ").slice(0, 200)}): check the address, or name another instance with --relay <url>.`) };
|
|
3640
|
+
}
|
|
3641
|
+
}
|
|
3642
|
+
function isFetchFailure(e) {
|
|
3643
|
+
const err = e;
|
|
3644
|
+
return err?.name === "TypeError" && err.message === "fetch failed" || err?.name === "TimeoutError";
|
|
3645
|
+
}
|
|
3646
|
+
function fetchFailedLine(e, env = process.env) {
|
|
3647
|
+
const { reason, code, message: message2 } = reasonOf(e);
|
|
3648
|
+
const why = reason === "dns" ? "DNS lookup failed" : reason === "refused" ? "connection refused" : reason === "timeout" || reason === "connect-timeout" ? "no answer in time" : reason === "tls" ? `its certificate was not trusted${code ? `: ${code}` : ""}` : reason === "redirect" ? "it answered with a redirect, which Crossroom does not follow" : (message2 || "the request failed").replace(/\s+/g, " ").slice(0, 200);
|
|
3649
|
+
const set = PROXY_VARS.find((v) => env[v]?.trim());
|
|
3650
|
+
const proxy = set && env.NODE_USE_ENV_PROXY !== "1" ? ` ${set} is set, but Node connects directly unless it is started with NODE_USE_ENV_PROXY=1 (Node 22.21 or later).` : "";
|
|
3651
|
+
return `Couldn't reach Crossroom (${why}): check your connection, or name the instance with --relay <url>.${proxy}`;
|
|
3652
|
+
}
|
|
3653
|
+
|
|
2949
3654
|
// src/signing.ts
|
|
2950
3655
|
import { createHash, createPrivateKey, createPublicKey, generateKeyPairSync, sign, verify } from "node:crypto";
|
|
2951
3656
|
|
|
@@ -3458,7 +4163,7 @@ function verifyV2(body, t) {
|
|
|
3458
4163
|
}
|
|
3459
4164
|
|
|
3460
4165
|
// src/cli.ts
|
|
3461
|
-
var VERSION = true ? "0.
|
|
4166
|
+
var VERSION = true ? "0.3.0" : "dev";
|
|
3462
4167
|
var DEFAULT_PORT = 4747;
|
|
3463
4168
|
var dataDir = () => process.env.PARLEY_DATA ?? path3.join(os.homedir(), ".parley");
|
|
3464
4169
|
var Usage = class extends Error {
|
|
@@ -3470,7 +4175,7 @@ var MissingValue = class extends Usage {
|
|
|
3470
4175
|
}
|
|
3471
4176
|
flag;
|
|
3472
4177
|
};
|
|
3473
|
-
var SWITCHES = /* @__PURE__ */ new Set(["no-open", "json", "no-start", "digest", "wait", "help", "version", "list", "print", "forget"]);
|
|
4178
|
+
var SWITCHES = /* @__PURE__ */ new Set(["no-open", "json", "no-start", "digest", "wait", "help", "version", "list", "print", "forget", "debug"]);
|
|
3474
4179
|
function parseArgs2(argv) {
|
|
3475
4180
|
const positional = [];
|
|
3476
4181
|
const flags = {};
|
|
@@ -3499,6 +4204,7 @@ function parseArgs2(argv) {
|
|
|
3499
4204
|
} else positional.push(a);
|
|
3500
4205
|
}
|
|
3501
4206
|
if (flags.host === CODEX && flags.session === void 0) flags.session = codexSession();
|
|
4207
|
+
if (flags.host === CLAUDE && flags.session === void 0) flags.session = claudeSession();
|
|
3502
4208
|
const command = positional.shift() ?? "serve";
|
|
3503
4209
|
return { command, positional, flags, ...Object.keys(values).length ? { values } : {} };
|
|
3504
4210
|
}
|
|
@@ -3508,6 +4214,17 @@ function codexSession() {
|
|
|
3508
4214
|
if (!id) throw new Usage("--host codex takes the session from CODEX_SESSION_ID, which Codex sets in the commands it runs. It is not set here: run this from inside a Codex session, or pass --session <id>.");
|
|
3509
4215
|
return id;
|
|
3510
4216
|
}
|
|
4217
|
+
var CLAUDE = "claude";
|
|
4218
|
+
var SESSION_ID = /^[A-Za-z0-9_-]{1,128}$/;
|
|
4219
|
+
function claudeSessionOf(env = process.env) {
|
|
4220
|
+
const id = env.CLAUDE_CODE_SESSION_ID?.trim();
|
|
4221
|
+
return id && SESSION_ID.test(id) ? id : null;
|
|
4222
|
+
}
|
|
4223
|
+
function claudeSession(env = process.env) {
|
|
4224
|
+
const id = claudeSessionOf(env);
|
|
4225
|
+
if (!id) throw new Usage("--host claude takes the session from CLAUDE_CODE_SESSION_ID, which Claude Code sets in the commands it runs. It is not set here: run this from inside a Claude Code session, or pass --session <id>.");
|
|
4226
|
+
return id;
|
|
4227
|
+
}
|
|
3511
4228
|
function ownCodexSession(args, what, about = "the seat this Codex session holds") {
|
|
3512
4229
|
const session = codexSession();
|
|
3513
4230
|
if (text(args.flags.session) !== session) throw new Usage(`${what} is for ${about}, and takes no --session.`);
|
|
@@ -3740,25 +4457,42 @@ async function leaveSeat(args, cwd = process.cwd()) {
|
|
|
3740
4457
|
throw new Usage(`The room refused the finish, so it was not told you left. ${kept}
|
|
3741
4458
|
${res.status} ${said}`);
|
|
3742
4459
|
}
|
|
3743
|
-
function
|
|
4460
|
+
function opHost(args, env = process.env) {
|
|
4461
|
+
if (args.flags.host === CODEX) return "codex";
|
|
4462
|
+
if (args.flags.host === CLAUDE) return "claude";
|
|
4463
|
+
if (args.flags.host === void 0 && claudeSessionOf(env)) return "claude";
|
|
4464
|
+
throw new Usage(
|
|
4465
|
+
"`crossroom op` runs inside an agent session, for the seat that session holds: in Codex add --host codex; in Claude Code it reads CLAUDE_CODE_SESSION_ID, which is not set here."
|
|
4466
|
+
);
|
|
4467
|
+
}
|
|
4468
|
+
function opSeat(args, env = process.env) {
|
|
4469
|
+
const host = opHost(args, env);
|
|
3744
4470
|
if (args.flags.seat !== void 0)
|
|
3745
|
-
throw new Usage(
|
|
3746
|
-
|
|
3747
|
-
|
|
4471
|
+
throw new Usage(
|
|
4472
|
+
`\`crossroom op\` speaks only for the seat this session holds, and takes no --seat. \`crossroom seat <link>${host === "codex" ? " --host codex" : " --host claude"}\` takes a seat for this session.`
|
|
4473
|
+
);
|
|
4474
|
+
let session;
|
|
4475
|
+
if (host === "codex") session = ownCodexSession(args, "`crossroom op`");
|
|
4476
|
+
else {
|
|
4477
|
+
session = claudeSession(env);
|
|
4478
|
+
if (args.flags.session !== void 0 && text(args.flags.session) !== session)
|
|
4479
|
+
throw new Usage("`crossroom op` is for the seat this Claude Code session holds, and takes no --session.");
|
|
4480
|
+
}
|
|
3748
4481
|
const held = sessionSeats().find((s) => s.session === session);
|
|
3749
4482
|
if (!held)
|
|
3750
4483
|
throw new Usage("This session holds no seat. `crossroom seat <link>` with this session takes one; `crossroom seats` lists the seats this machine knows.");
|
|
3751
4484
|
return held.seat;
|
|
3752
4485
|
}
|
|
3753
4486
|
function opCalls(seat) {
|
|
3754
|
-
const op = (rest) => `crossroom op ${rest} ${seat}`;
|
|
4487
|
+
const op = (rest) => seat ? `crossroom op ${rest} ${seat}` : `crossroom op ${rest}`;
|
|
4488
|
+
const claude = !seat;
|
|
3755
4489
|
return [
|
|
3756
4490
|
"## Calls",
|
|
3757
|
-
`Every call is \`crossroom op <call>\` with \`key=value\` arguments, run on its own: never chained, and with no \`$VAR\` in it. \`${seat}\` names your seat. Every call prints text; read it.`,
|
|
4491
|
+
claude ? "Every call is `crossroom op <call>` with `key=value` arguments, run on its own: never chained, and with no `$VAR` in it. It speaks for the seat this session holds, so no call names it. Every call prints text; read it." : `Every call is \`crossroom op <call>\` with \`key=value\` arguments, run on its own: never chained, and with no \`$VAR\` in it. \`${seat}\` names your seat. Every call prints text; read it.`,
|
|
3758
4492
|
"```sh",
|
|
3759
4493
|
"# say something",
|
|
3760
4494
|
op('say text="Your message here."'),
|
|
3761
|
-
'# wait for the other side (blocks up to 45 s; returns new activity or "(no new activity)")',
|
|
4495
|
+
claude ? `# wait for the others (holds up to ${WAIT_FOR_DEFAULT_S} s, riding out network blips; returns new activity or "Nothing yet")` : '# wait for the other side (blocks up to 45 s; returns new activity or "(no new activity)")',
|
|
3762
4496
|
op("wait"),
|
|
3763
4497
|
"# ask for something specific you need",
|
|
3764
4498
|
op('request_context what="the zod schema line for customerId" why="to check nullability"'),
|
|
@@ -3773,25 +4507,38 @@ function opCalls(seat) {
|
|
|
3773
4507
|
"# done",
|
|
3774
4508
|
op('finish summary="What was established, what moved, what is unresolved."'),
|
|
3775
4509
|
"```",
|
|
3776
|
-
"stance: support | oppose | uncertain | insufficient_evidence. Put text holding `$`, a backtick or a double quote in single quotes. Long text: `key@<file>` reads it from a file, and `key@-` from stdin."
|
|
4510
|
+
claude ? 'stance: support | oppose | uncertain | insufficient_evidence. Put text holding `$`, a backtick or a double quote in single quotes. Long or several-line text: `key@<file>` reads it from a file, and `key@-` from stdin (`sed -n \'12,20p\' src/schema.ts | crossroom op share_context kind=code title="checkout schema" source="src/schema.ts:12-20" body@-`); either is read as UTF-8 whatever the console\'s code page.\nIs your user asked to approve each call? Give them this Claude Code rule, which allows them all: `Bash(crossroom op:*)`.' : "stance: support | oppose | uncertain | insufficient_evidence. Put text holding `$`, a backtick or a double quote in single quotes. Long text: `key@<file>` reads it from a file, and `key@-` from stdin."
|
|
3777
4511
|
].join("\n");
|
|
3778
4512
|
}
|
|
3779
|
-
var
|
|
3780
|
-
|
|
4513
|
+
var opSeatFlag = (host) => host === "codex" ? "--host codex" : "";
|
|
4514
|
+
var WAIT_FOR_DEFAULT_S = 100;
|
|
4515
|
+
var OP_WAIT_FOR_S = WAIT_FOR_DEFAULT_S;
|
|
4516
|
+
var CALLS = [...OPS, "record", "work", "submit", "report", "plan", "progress", "board", "board_set", "declare_tool", "call_tool", "tool_result", "open_room", "subrooms", "context", "items", "file", "update", "verify", "pass", "autonomy"];
|
|
4517
|
+
async function seatOp(args, io, fetchImpl = fetch, opts = {}) {
|
|
4518
|
+
const env = opts.env ?? process.env;
|
|
3781
4519
|
const [call, ...tokens] = args.positional;
|
|
3782
|
-
if (!call) throw new Usage(`Usage: crossroom op <call> [key=value | key@file | key@-]... --host codex
|
|
4520
|
+
if (!call) throw new Usage(`Usage: crossroom op <call> [key=value | key@file | key@-]... [--host codex]
|
|
3783
4521
|
Calls: ${CALLS.join(", ")}.`);
|
|
3784
4522
|
if (!CALLS.includes(call)) throw new Usage(`There is no call "${call}". Calls: ${CALLS.join(", ")}.`);
|
|
3785
4523
|
const name = call;
|
|
4524
|
+
const host = opHost(args, env);
|
|
4525
|
+
const forGiven = args.flags.for;
|
|
4526
|
+
if (forGiven !== void 0 && name !== "wait") throw new Usage("--for is for `crossroom op wait` only.");
|
|
4527
|
+
if (forGiven === true) throw new Usage("--for takes a number of seconds.");
|
|
3786
4528
|
let link;
|
|
3787
4529
|
let fields;
|
|
3788
4530
|
try {
|
|
3789
|
-
link = parseLink(opSeat(args));
|
|
4531
|
+
link = parseLink(opSeat(args, env));
|
|
3790
4532
|
fields = await parseArgs(tokens, io);
|
|
3791
4533
|
} catch (e) {
|
|
3792
4534
|
if (e instanceof UsageError) throw new Usage(e.message);
|
|
3793
4535
|
throw e;
|
|
3794
4536
|
}
|
|
4537
|
+
if (name === "wait" && !link.key && (host === "claude" || forGiven !== void 0)) {
|
|
4538
|
+
const { waitFor, waitSeat } = await import("./wait-DMXS3HDV.mjs");
|
|
4539
|
+
const forS = waitFor(forGiven);
|
|
4540
|
+
return waitSeat(link.base, { forS, signal: opts.signal, fetchImpl: (u, i) => fetchImpl(u, i), again: "`crossroom op wait`" });
|
|
4541
|
+
}
|
|
3795
4542
|
const cipher = link.key ? await RoomCipher.fromKey(link.key).catch(() => null) : null;
|
|
3796
4543
|
if (link.key && !cipher) throw new Usage("The #e= part of this seat's link is not a Crossroom room key.");
|
|
3797
4544
|
const refused = cipher ? (E2EE_REFUSED[name] ?? []).filter((k) => fields[k]) : [];
|
|
@@ -3810,7 +4557,7 @@ Calls: ${CALLS.join(", ")}.`);
|
|
|
3810
4557
|
if (body.e2ee && !cipher)
|
|
3811
4558
|
return { code: 1, out: "", err: "This room is end-to-end encrypted, and the seat's link has no key: record the whole link, with its #e= part." };
|
|
3812
4559
|
const render = {
|
|
3813
|
-
join: async (d, c) => briefing(c ? await c.join(d) : d, { calls: opCalls(
|
|
4560
|
+
join: async (d, c) => briefing(c ? await c.join(d) : d, { calls: opCalls(opSeatFlag(host)) }),
|
|
3814
4561
|
status: async (d, c) => renderStatus(c ? await c.status(d) : d),
|
|
3815
4562
|
wait: async (d, c) => renderWait(c ? await c.wait(d) : d),
|
|
3816
4563
|
say: renderSay,
|
|
@@ -3825,6 +4572,8 @@ Calls: ${CALLS.join(", ")}.`);
|
|
|
3825
4572
|
work: (d) => renderWork(d),
|
|
3826
4573
|
submit: (d) => renderSubmitted(d),
|
|
3827
4574
|
report: (d) => renderReported(d),
|
|
4575
|
+
plan: (d) => renderPlan(d),
|
|
4576
|
+
progress: (d) => renderProgress(d),
|
|
3828
4577
|
// A room with a board's: in `CALLS`, never an end-to-end room's.
|
|
3829
4578
|
board: (d) => renderBoard(d),
|
|
3830
4579
|
board_set: (d) => renderBoardSet(d),
|
|
@@ -3909,7 +4658,8 @@ function seatsText(rows) {
|
|
|
3909
4658
|
].join("\n");
|
|
3910
4659
|
}
|
|
3911
4660
|
var PREFERRED = ["claude", "codex", "grok"];
|
|
3912
|
-
function pickRunner(
|
|
4661
|
+
function pickRunner(all, wanted) {
|
|
4662
|
+
const runners = all.filter((x) => x.id !== "api");
|
|
3913
4663
|
if (wanted) {
|
|
3914
4664
|
const r = runners.find((x) => x.id === wanted);
|
|
3915
4665
|
if (!r) throw new Usage(`There is no runner called "${wanted}". Crossroom can host: ${runners.map((x) => x.id).join(", ")}.`);
|
|
@@ -3961,10 +4711,10 @@ async function ask(args, say, deps = {}) {
|
|
|
3961
4711
|
const dir = path3.resolve(dirArg);
|
|
3962
4712
|
if (!existsSync(dir) || !statSync(dir).isDirectory()) throw new Usage(`${dir} is not a directory.`);
|
|
3963
4713
|
const recall = text(args.flags.recall);
|
|
3964
|
-
const { chosenInstance } = await import("./relay-call-
|
|
4714
|
+
const { chosenInstance } = await import("./relay-call-DKXVPYE4.mjs");
|
|
3965
4715
|
const { DEFAULT_INSTANCE } = await import("./instance-5LWNFMHX.mjs");
|
|
3966
|
-
const local = await import("./local-agent-
|
|
3967
|
-
const memory = await import("./memory-notes-
|
|
4716
|
+
const local = await import("./local-agent-JSROJL7Y.mjs");
|
|
4717
|
+
const memory = await import("./memory-notes-7U7YO23S.mjs");
|
|
3968
4718
|
const base = chosenInstance(args, DEFAULT_INSTANCE);
|
|
3969
4719
|
const runner = pickRunner(runnerAvailability(deps.runners), text(args.flags.with));
|
|
3970
4720
|
const agent = { runtime: runner.id, label: runner.label, dir, model: text(args.flags.model), unconfinedOk: args.flags["unconfined-reads-ok"] === true };
|
|
@@ -4038,6 +4788,9 @@ function pickRoom(args) {
|
|
|
4038
4788
|
throw new Usage(`Room ${want} was not opened from this machine, so there is no key for it here.`);
|
|
4039
4789
|
}
|
|
4040
4790
|
var owned = (room, extra = {}) => ({ "x-parley-owner": room.owner, accept: "application/json", ...extra });
|
|
4791
|
+
function ownerFetch(room, url, init = {}) {
|
|
4792
|
+
return fetch(url, { method: init.method ?? "GET", headers: owned(room, init.headers), ...init.body === void 0 ? {} : { body: init.body }, redirect: "error" });
|
|
4793
|
+
}
|
|
4041
4794
|
var privateLink = (room) => `${room.base}/s/${encodeURIComponent(room.id)}#k=${encodeURIComponent(room.owner)}`;
|
|
4042
4795
|
async function roomRows() {
|
|
4043
4796
|
const rooms = savedRooms();
|
|
@@ -4050,7 +4803,9 @@ async function roomRows() {
|
|
|
4050
4803
|
const res = await fetch(`${base}/api/sessions/lookup`, {
|
|
4051
4804
|
method: "POST",
|
|
4052
4805
|
headers: { "content-type": "application/json", accept: "application/json" },
|
|
4053
|
-
body: JSON.stringify({ rooms: mine.slice(i, i + 50).map((r) => ({ id: r.id, owner: r.owner })) })
|
|
4806
|
+
body: JSON.stringify({ rooms: mine.slice(i, i + 50).map((r) => ({ id: r.id, owner: r.owner })) }),
|
|
4807
|
+
// The body holds owner tokens, and a 307 or 308 would send it on.
|
|
4808
|
+
redirect: "error"
|
|
4054
4809
|
});
|
|
4055
4810
|
if (!res.ok) continue;
|
|
4056
4811
|
for (const s of await res.json()) found2.set(s.id, s);
|
|
@@ -4074,7 +4829,7 @@ async function roomRows() {
|
|
|
4074
4829
|
}
|
|
4075
4830
|
function roomsText(rows) {
|
|
4076
4831
|
if (!rows.length) return 'No rooms yet. `crossroom new "<topic>"` opens one.';
|
|
4077
|
-
const
|
|
4832
|
+
const word2 = {
|
|
4078
4833
|
live: "live",
|
|
4079
4834
|
open: "not started: a seat is still empty",
|
|
4080
4835
|
ended: "ended",
|
|
@@ -4084,7 +4839,7 @@ function roomsText(rows) {
|
|
|
4084
4839
|
const lines = rows.map((r) => {
|
|
4085
4840
|
const turn = r.yourTurn ? `, your turn (${r.yourTurn} question${r.yourTurn === 1 ? "" : "s"} for you)` : "";
|
|
4086
4841
|
return ` ${r.id.slice(0, 8)} ${firstLine(r.title).slice(0, 60)}
|
|
4087
|
-
${
|
|
4842
|
+
${word2[r.state]}${turn}, opened ${r.createdAt.slice(0, 16).replace("T", " ")}`;
|
|
4088
4843
|
});
|
|
4089
4844
|
return `${lines.join("\n")}
|
|
4090
4845
|
|
|
@@ -4093,9 +4848,9 @@ crossroom open|end|share|minutes <id> acts on one; with no id, on the first.`;
|
|
|
4093
4848
|
async function endRoom(args) {
|
|
4094
4849
|
const room = pickRoom(args);
|
|
4095
4850
|
const outcome = text(args.flags.outcome);
|
|
4096
|
-
const res = await
|
|
4851
|
+
const res = await ownerFetch(room, `${room.base}/api/sessions/${encodeURIComponent(room.id)}/end`, {
|
|
4097
4852
|
method: "POST",
|
|
4098
|
-
headers:
|
|
4853
|
+
headers: { "content-type": "application/json" },
|
|
4099
4854
|
body: JSON.stringify(outcome ? { outcome } : {})
|
|
4100
4855
|
});
|
|
4101
4856
|
if (!res.ok) throw new Usage(`Could not end room ${room.id}: ${await errorOf(res)}`);
|
|
@@ -4106,19 +4861,19 @@ async function shareRoom(args) {
|
|
|
4106
4861
|
const at2 = `${room.base}/api/sessions/${encodeURIComponent(room.id)}/shares`;
|
|
4107
4862
|
const revoke = text(args.flags.revoke);
|
|
4108
4863
|
if (revoke) {
|
|
4109
|
-
const res2 = await
|
|
4864
|
+
const res2 = await ownerFetch(room, `${at2}/${encodeURIComponent(revoke)}`, { method: "DELETE" });
|
|
4110
4865
|
if (!res2.ok) throw new Usage(`Could not revoke share ${revoke}: ${await errorOf(res2)}`);
|
|
4111
4866
|
return `Revoked. That link now opens nothing.`;
|
|
4112
4867
|
}
|
|
4113
4868
|
if (args.flags.list) {
|
|
4114
|
-
const res2 = await
|
|
4869
|
+
const res2 = await ownerFetch(room, at2);
|
|
4115
4870
|
if (!res2.ok) throw new Usage(`Could not list the room's share links: ${await errorOf(res2)}`);
|
|
4116
4871
|
const shares = await res2.json();
|
|
4117
4872
|
const live = shares.filter((s) => !s.revokedAt);
|
|
4118
4873
|
if (!live.length) return "This room has no live share links.";
|
|
4119
4874
|
return live.map((s) => ` ${s.id} made ${s.createdAt.slice(0, 16).replace("T", " ")}`).join("\n");
|
|
4120
4875
|
}
|
|
4121
|
-
const res = await
|
|
4876
|
+
const res = await ownerFetch(room, at2, { method: "POST" });
|
|
4122
4877
|
if (!res.ok) throw new Usage(`Could not share room ${room.id}: ${await errorOf(res)}`);
|
|
4123
4878
|
const made = await res.json();
|
|
4124
4879
|
return [
|
|
@@ -4130,17 +4885,16 @@ async function shareRoom(args) {
|
|
|
4130
4885
|
async function minutes(args, say) {
|
|
4131
4886
|
const room = pickRoom(args);
|
|
4132
4887
|
const id = room.id;
|
|
4133
|
-
const headers = { "x-parley-owner": room.owner };
|
|
4134
4888
|
if (args.flags.wait) {
|
|
4135
4889
|
say("Waiting for the room to end\u2026");
|
|
4136
4890
|
for (; ; ) {
|
|
4137
|
-
const res2 = await
|
|
4891
|
+
const res2 = await ownerFetch(room, `${room.base}/api/sessions/${encodeURIComponent(id)}/wait`);
|
|
4138
4892
|
if (!res2.ok) throw new Usage(`Could not wait on room ${id}: ${await errorOf(res2)}`);
|
|
4139
4893
|
if ((await res2.json()).status === "ended") break;
|
|
4140
4894
|
}
|
|
4141
4895
|
}
|
|
4142
4896
|
const style = args.flags.digest ? "?style=digest" : "";
|
|
4143
|
-
const res = await
|
|
4897
|
+
const res = await ownerFetch(room, `${room.base}/api/sessions/${encodeURIComponent(id)}/minutes${style}`, { headers: { accept: "text/markdown" } });
|
|
4144
4898
|
if (!res.ok) throw new Usage(`Could not read the minutes of room ${id}: ${await errorOf(res)}`);
|
|
4145
4899
|
return res.text();
|
|
4146
4900
|
}
|
|
@@ -4176,10 +4930,13 @@ async function verify2(args) {
|
|
|
4176
4930
|
if (published.publicKey !== v.publicKey) return { ok: false, lines: [...lines, `${base} signs with a different key: this document was not signed by it.`] };
|
|
4177
4931
|
return { ok: true, lines: [...lines, `${base} publishes this key, so it signed this document.`] };
|
|
4178
4932
|
}
|
|
4179
|
-
async function doctor(args) {
|
|
4933
|
+
async function doctor(args, script = process.argv[1]) {
|
|
4180
4934
|
const lines = [];
|
|
4181
4935
|
let ok = true;
|
|
4182
4936
|
const row = (mark, label, detail) => lines.push(` ${mark.padEnd(3)} ${label.padEnd(14)} ${detail}`);
|
|
4937
|
+
const { staleBuild, staleBuildLine } = await import("./client-version-2BE42C46.mjs");
|
|
4938
|
+
const stale = staleBuild(VERSION, script);
|
|
4939
|
+
row(stale ? "!!" : "ok", "Crossroom", stale ? staleBuildLine(stale) : VERSION);
|
|
4183
4940
|
row("ok", "Node", `${process.versions.node} (needs 22.13 or newer)`);
|
|
4184
4941
|
try {
|
|
4185
4942
|
new DatabaseSync(":memory:").close();
|
|
@@ -4241,7 +4998,7 @@ function addCommands(load) {
|
|
|
4241
4998
|
}
|
|
4242
4999
|
async function loadCommands() {
|
|
4243
5000
|
for (const load of addedCommands) await load();
|
|
4244
|
-
await import("./client-
|
|
5001
|
+
await import("./client-VOJ62D5R.mjs");
|
|
4245
5002
|
}
|
|
4246
5003
|
var helpHead = () => `Crossroom ${VERSION}: ${TAGLINE}`;
|
|
4247
5004
|
var helpFoot = () => `Data lives in ${dataDir()} (PARLEY_DATA changes it).`;
|
|
@@ -4258,10 +5015,10 @@ function helpText() {
|
|
|
4258
5015
|
function helpAllText() {
|
|
4259
5016
|
return [helpHead(), "", ...helpLines(), "", helpFoot()].join("\n");
|
|
4260
5017
|
}
|
|
4261
|
-
function helpFor(
|
|
4262
|
-
if (
|
|
4263
|
-
const topic = helpTopic(
|
|
4264
|
-
const c = findCommand(
|
|
5018
|
+
function helpFor(word2, prefer = "topic") {
|
|
5019
|
+
if (word2 === "all") return helpAllText();
|
|
5020
|
+
const topic = helpTopic(word2);
|
|
5021
|
+
const c = findCommand(word2);
|
|
4265
5022
|
if (topic && !(prefer === "command" && c)) return [...topicLines(topic.id), "", "crossroom help shows every topic."].join("\n");
|
|
4266
5023
|
if (!c) return null;
|
|
4267
5024
|
if (c.help) return c.help();
|
|
@@ -4287,24 +5044,27 @@ async function run(argv) {
|
|
|
4287
5044
|
args = parseArgs2(argv);
|
|
4288
5045
|
} catch (e) {
|
|
4289
5046
|
if (e instanceof MissingValue && !knownFlags([...SWITCHES, "help", "version"]).has(e.flag)) {
|
|
4290
|
-
const
|
|
4291
|
-
const command2 = findCommand(
|
|
4292
|
-
if (command2) refuseUnknownFlags({ command:
|
|
5047
|
+
const word2 = argv.find((a) => !a.startsWith("-")) ?? "serve";
|
|
5048
|
+
const command2 = findCommand(word2);
|
|
5049
|
+
if (command2) refuseUnknownFlags({ command: word2, positional: [], flags: { [e.flag]: true } }, command2);
|
|
4293
5050
|
}
|
|
4294
5051
|
throw e;
|
|
4295
5052
|
}
|
|
4296
5053
|
if (args.flags.version) {
|
|
4297
5054
|
console.log(VERSION);
|
|
5055
|
+
const { staleBuild, staleBuildLine } = await import("./client-version-2BE42C46.mjs");
|
|
5056
|
+
const stale = staleBuild(VERSION);
|
|
5057
|
+
if (stale) err(staleBuildLine(stale));
|
|
4298
5058
|
return 0;
|
|
4299
5059
|
}
|
|
4300
5060
|
if (args.command === "help") {
|
|
4301
|
-
const
|
|
4302
|
-
if (!
|
|
5061
|
+
const word2 = args.positional[0];
|
|
5062
|
+
if (!word2) {
|
|
4303
5063
|
console.log(helpText());
|
|
4304
5064
|
return 0;
|
|
4305
5065
|
}
|
|
4306
|
-
const page = helpFor(
|
|
4307
|
-
if (page === null) throw new Usage(`There is no command or help topic "${
|
|
5066
|
+
const page = helpFor(word2);
|
|
5067
|
+
if (page === null) throw new Usage(`There is no command or help topic "${word2}".
|
|
4308
5068
|
|
|
4309
5069
|
${helpText()}`);
|
|
4310
5070
|
console.log(page);
|
|
@@ -4330,9 +5090,9 @@ ${helpText()}`);
|
|
|
4330
5090
|
} finally {
|
|
4331
5091
|
const opened = takeOpenedRooms();
|
|
4332
5092
|
if (opened.length)
|
|
4333
|
-
await import("./keep-in-account-
|
|
5093
|
+
await import("./keep-in-account-MEAE6BNO.mjs").then((m) => m.keepOpened(args, opened, err)).catch(() => {
|
|
4334
5094
|
});
|
|
4335
|
-
await import("./client-version-
|
|
5095
|
+
await import("./client-version-2BE42C46.mjs").then((m) => m.warnIfOutdated({ version: VERSION, dataDir: dataDir(), say: err })).catch(() => {
|
|
4336
5096
|
});
|
|
4337
5097
|
}
|
|
4338
5098
|
} catch (e) {
|
|
@@ -4340,12 +5100,19 @@ ${helpText()}`);
|
|
|
4340
5100
|
err(e.message);
|
|
4341
5101
|
return 2;
|
|
4342
5102
|
}
|
|
4343
|
-
err(
|
|
5103
|
+
err(unexpectedError(e, { debug: argv.includes("--debug") }));
|
|
4344
5104
|
return 1;
|
|
4345
5105
|
}
|
|
4346
5106
|
}
|
|
5107
|
+
function unexpectedError(e, { debug = false, env = process.env } = {}) {
|
|
5108
|
+
if (debug || env.CROSSROOM_DEBUG === "1") return String(e?.stack ?? e);
|
|
5109
|
+
if (isFetchFailure(e)) return `${fetchFailedLine(e, env)} (--debug shows where.)`;
|
|
5110
|
+
const message2 = String(e?.message ?? e).split("\n")[0].trim() || "an unknown error";
|
|
5111
|
+
return `crossroom stopped: ${message2}. Run it again with --debug (or CROSSROOM_DEBUG=1) to see where, and report it at https://github.com/jagritvats/crossroom-cli/issues if it keeps happening.`;
|
|
5112
|
+
}
|
|
4347
5113
|
|
|
4348
5114
|
export {
|
|
5115
|
+
helperCommand,
|
|
4349
5116
|
generateRoomKey,
|
|
4350
5117
|
isRoomKey,
|
|
4351
5118
|
importRoomKey,
|
|
@@ -4365,8 +5132,11 @@ export {
|
|
|
4365
5132
|
LANE_STATE_WORDS,
|
|
4366
5133
|
LANE_TITLE_MAX,
|
|
4367
5134
|
LANE_BODY_MAX,
|
|
5135
|
+
LANE_CITE_MAX,
|
|
4368
5136
|
LANE_NOTE_MAX,
|
|
4369
5137
|
laneLabel,
|
|
5138
|
+
lanePriority,
|
|
5139
|
+
laneLinkProblem,
|
|
4370
5140
|
needsSide,
|
|
4371
5141
|
passPrompt,
|
|
4372
5142
|
scheduleLines,
|
|
@@ -4384,6 +5154,39 @@ export {
|
|
|
4384
5154
|
aboutText,
|
|
4385
5155
|
searchTerms,
|
|
4386
5156
|
searchItems,
|
|
5157
|
+
TRACKER_WORD,
|
|
5158
|
+
TRACKER_LIMITS,
|
|
5159
|
+
trackerLine,
|
|
5160
|
+
trackerText,
|
|
5161
|
+
trackerLink,
|
|
5162
|
+
uniqueLinks,
|
|
5163
|
+
latestComments,
|
|
5164
|
+
trackerDate,
|
|
5165
|
+
criteriaFromField,
|
|
5166
|
+
criteriaFromText,
|
|
5167
|
+
isJiraCloudHost,
|
|
5168
|
+
parseJiraIssueUrl,
|
|
5169
|
+
JIRA_TOKEN_ENV,
|
|
5170
|
+
GITHUB_TOKEN_ENV,
|
|
5171
|
+
adfText,
|
|
5172
|
+
TRACKER_READ_ITEMS_MAX,
|
|
5173
|
+
TRACKER_REPORT_BATCH_MAX,
|
|
5174
|
+
TRACKER_READ_CODES,
|
|
5175
|
+
WORK_GONE,
|
|
5176
|
+
STALE_VERSION,
|
|
5177
|
+
MAX_BRIEF_CHARS,
|
|
5178
|
+
MAX_ARTIFACT_BODY_CHARS,
|
|
5179
|
+
WorkState,
|
|
5180
|
+
WORK_STATE_LABEL,
|
|
5181
|
+
WORK_TRANSITIONS,
|
|
5182
|
+
ArtifactAudience,
|
|
5183
|
+
REVISION_STATUS_LABEL,
|
|
5184
|
+
CreateWorkInput,
|
|
5185
|
+
PatchWorkInput,
|
|
5186
|
+
CreateArtifactInput,
|
|
5187
|
+
CreateRevisionInput,
|
|
5188
|
+
ReportedImportInput,
|
|
5189
|
+
EXPORT_FORMATS,
|
|
4387
5190
|
newNonce,
|
|
4388
5191
|
briefing,
|
|
4389
5192
|
renderStatus,
|
|
@@ -4400,6 +5203,7 @@ export {
|
|
|
4400
5203
|
helpLine,
|
|
4401
5204
|
ROOM_PROTOCOL,
|
|
4402
5205
|
LOCAL_COPY_HEADER,
|
|
5206
|
+
NOT_FOUND,
|
|
4403
5207
|
CONFORMANCE_CHECKS,
|
|
4404
5208
|
CONFORMANCE_ROOMS_MAX,
|
|
4405
5209
|
CONFORMANCE_CREATES_PER_MINUTE,
|
|
@@ -4414,7 +5218,10 @@ export {
|
|
|
4414
5218
|
firstPrompt,
|
|
4415
5219
|
RESTART_PROMPT,
|
|
4416
5220
|
runnerAvailability,
|
|
5221
|
+
API_LABEL,
|
|
4417
5222
|
Hosted,
|
|
5223
|
+
REQUEST_TIMEOUT_MS,
|
|
5224
|
+
unreachableLine,
|
|
4418
5225
|
utf83 as utf8,
|
|
4419
5226
|
fromB64u2 as fromB64u,
|
|
4420
5227
|
sha256Hex,
|
|
@@ -4454,6 +5261,7 @@ export {
|
|
|
4454
5261
|
Usage,
|
|
4455
5262
|
MissingValue,
|
|
4456
5263
|
parseArgs2 as parseArgs,
|
|
5264
|
+
claudeSessionOf,
|
|
4457
5265
|
ownCodexSession,
|
|
4458
5266
|
text,
|
|
4459
5267
|
driverFlag,
|
|
@@ -4474,8 +5282,11 @@ export {
|
|
|
4474
5282
|
seatStatusText,
|
|
4475
5283
|
NOT_THIS_SESSIONS,
|
|
4476
5284
|
leaveSeat,
|
|
5285
|
+
opHost,
|
|
4477
5286
|
opSeat,
|
|
4478
5287
|
opCalls,
|
|
5288
|
+
opSeatFlag,
|
|
5289
|
+
OP_WAIT_FOR_S,
|
|
4479
5290
|
seatOp,
|
|
4480
5291
|
knownSeats,
|
|
4481
5292
|
seatsText,
|
|
@@ -4483,6 +5294,7 @@ export {
|
|
|
4483
5294
|
askRoom,
|
|
4484
5295
|
ask,
|
|
4485
5296
|
pickRoom,
|
|
5297
|
+
ownerFetch,
|
|
4486
5298
|
privateLink,
|
|
4487
5299
|
roomRows,
|
|
4488
5300
|
roomsText,
|
|
@@ -4498,5 +5310,6 @@ export {
|
|
|
4498
5310
|
helpAllText,
|
|
4499
5311
|
helpFor,
|
|
4500
5312
|
refuseUnknownFlags,
|
|
4501
|
-
run
|
|
5313
|
+
run,
|
|
5314
|
+
unexpectedError
|
|
4502
5315
|
};
|