@ascenda-one/github-collector 0.1.40 → 0.1.42
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 +568 -34
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -604,7 +604,7 @@ var require_metricKeys = __commonJS({
|
|
|
604
604
|
family: "context",
|
|
605
605
|
readBy: ["handoff"],
|
|
606
606
|
unit: "tokens",
|
|
607
|
-
note: "Codex
|
|
607
|
+
note: "Codex: the model_context_window the rollout itself recorded \u2014 the real denominator its contextWindowPeakPct was computed against. VS Code: the largest modelConfiguration.contextSize a Copilot request recorded. Claude Code records no window and its ratio assumes 200k; absent here means the store never said."
|
|
608
608
|
},
|
|
609
609
|
date: { family: "clock", readBy: ["handoff"] },
|
|
610
610
|
errorCount: { family: "outcome", readBy: ["handoff"] },
|
|
@@ -720,6 +720,17 @@ var require_metricKeys = __commonJS({
|
|
|
720
720
|
unit: "lines",
|
|
721
721
|
note: "Claude Code only: user lines written by the Agent SDK or a headless run (entrypoint sdk-*). Nobody typed them, so promptCount leaves them out. Counted once per line across the store."
|
|
722
722
|
},
|
|
723
|
+
copilotCredits: {
|
|
724
|
+
family: "context",
|
|
725
|
+
readBy: ["diagnostic"],
|
|
726
|
+
unit: "Copilot credits",
|
|
727
|
+
note: "VS Code only: the sum of each Copilot request's copilotCredits, rounded to five decimal places. Absent where no request recorded the figure, which Copilot builds before Jun 2026 don't."
|
|
728
|
+
},
|
|
729
|
+
reasoningEffort: {
|
|
730
|
+
family: "model",
|
|
731
|
+
readBy: ["diagnostic"],
|
|
732
|
+
note: "VS Code only: the modelConfiguration.reasoningEffort most of a Copilot session's requests ran with. Absent where no request recorded a model configuration."
|
|
733
|
+
},
|
|
723
734
|
tokensNotCollected: {
|
|
724
735
|
family: "context",
|
|
725
736
|
readBy: ["diagnostic"],
|
|
@@ -733,7 +744,28 @@ var require_metricKeys = __commonJS({
|
|
|
733
744
|
duplicateChatSessions: {
|
|
734
745
|
family: "reading",
|
|
735
746
|
readBy: ["diagnostic"],
|
|
736
|
-
note: "VS Code only: chat sessions seen in more than one place (a transferred session also in a workspace). Counted once."
|
|
747
|
+
note: "VS Code only: chat sessions seen in more than one place (a transferred session also in a workspace). Counted once. Copilot CLI uses it for a session written both as a directory and as an older flat file."
|
|
748
|
+
},
|
|
749
|
+
clientName: {
|
|
750
|
+
family: "session",
|
|
751
|
+
readBy: ["diagnostic"],
|
|
752
|
+
note: "Copilot CLI only: workspace.yaml's client_name, one constant word naming what started the CLI (vscode, vscode-agent-host). Absent on sessions written before the field existed, which were the standalone CLI."
|
|
753
|
+
},
|
|
754
|
+
totalApiDurationMs: {
|
|
755
|
+
family: "session",
|
|
756
|
+
readBy: ["diagnostic"],
|
|
757
|
+
unit: "milliseconds",
|
|
758
|
+
note: "Copilot CLI only: session.shutdown.totalApiDurationMs, the time the session spent waiting on model calls. Absent where the session has no shutdown event."
|
|
759
|
+
},
|
|
760
|
+
selectedModel: {
|
|
761
|
+
family: "model",
|
|
762
|
+
readBy: ["diagnostic"],
|
|
763
|
+
note: "Copilot CLI only: the model the person chose at session start (session.start.selectedModel), which is auto when they let the router pick. primaryModel is the model that served the session, so the two differ exactly when the router chose."
|
|
764
|
+
},
|
|
765
|
+
selectedModelClass: {
|
|
766
|
+
family: "model",
|
|
767
|
+
readBy: ["diagnostic"],
|
|
768
|
+
note: "Copilot CLI only: classifyModelClass of selectedModel, so a session whose person picked auto reads router:auto beside the served model's class."
|
|
737
769
|
},
|
|
738
770
|
sessionsStartedFromBubble: {
|
|
739
771
|
family: "reading",
|
|
@@ -892,6 +924,9 @@ var require_out = __commonJS({
|
|
|
892
924
|
outcome: "outcome",
|
|
893
925
|
trigger: "outcome",
|
|
894
926
|
promptClass: "counts",
|
|
927
|
+
// One letter for how long the prompt was, worked out on this machine.
|
|
928
|
+
// Never the text or its length.
|
|
929
|
+
promptSizeBucket: "counts",
|
|
895
930
|
reason: "outcome",
|
|
896
931
|
afterHours: "clock",
|
|
897
932
|
activity: "counts",
|
|
@@ -951,6 +986,7 @@ var require_out = __commonJS({
|
|
|
951
986
|
"outcome",
|
|
952
987
|
"trigger",
|
|
953
988
|
"promptClass",
|
|
989
|
+
"promptSizeBucket",
|
|
954
990
|
"reason",
|
|
955
991
|
"afterHours",
|
|
956
992
|
"activity",
|
|
@@ -1255,7 +1291,7 @@ var require_collectorVersion = __commonJS({
|
|
|
1255
1291
|
exports.COLLECTOR_VERSION = exports.UNRELEASED_COLLECTOR_VERSION = void 0;
|
|
1256
1292
|
exports.describeCollectorVersion = describeCollectorVersion;
|
|
1257
1293
|
exports.UNRELEASED_COLLECTOR_VERSION = "unreleased";
|
|
1258
|
-
exports.COLLECTOR_VERSION = "0.1.
|
|
1294
|
+
exports.COLLECTOR_VERSION = "0.1.42" ? "0.1.42" : exports.UNRELEASED_COLLECTOR_VERSION;
|
|
1259
1295
|
function describeCollectorVersion(version = exports.COLLECTOR_VERSION) {
|
|
1260
1296
|
return version === exports.UNRELEASED_COLLECTOR_VERSION ? `${version} (built from a checkout, not a release)` : version;
|
|
1261
1297
|
}
|
|
@@ -2361,6 +2397,8 @@ var require_http = __commonJS({
|
|
|
2361
2397
|
exports.createPairingSession = createPairingSession;
|
|
2362
2398
|
exports.getPairingStatus = getPairingStatus;
|
|
2363
2399
|
exports.startStudyJoin = startStudyJoin;
|
|
2400
|
+
exports.previewJoinCode = previewJoinCode;
|
|
2401
|
+
exports.startSquadronJoin = startSquadronJoin;
|
|
2364
2402
|
exports.getStudyJoinStatus = getStudyJoinStatus;
|
|
2365
2403
|
exports.readInitiatives = readInitiatives;
|
|
2366
2404
|
exports.readStudyNotices = readStudyNotices;
|
|
@@ -2412,6 +2450,31 @@ var require_http = __commonJS({
|
|
|
2412
2450
|
throw await apiError(response);
|
|
2413
2451
|
return await response.json();
|
|
2414
2452
|
}
|
|
2453
|
+
async function previewJoinCode(apiBaseUrl, joinCode) {
|
|
2454
|
+
const response = await fetch(`${apiBaseUrl}/api/share/join/${encodeURIComponent(joinCode)}`, {
|
|
2455
|
+
method: "GET",
|
|
2456
|
+
headers: { Accept: "application/json" }
|
|
2457
|
+
});
|
|
2458
|
+
if (!response.ok)
|
|
2459
|
+
throw await apiError(response);
|
|
2460
|
+
return await response.json();
|
|
2461
|
+
}
|
|
2462
|
+
async function startSquadronJoin(apiBaseUrl, eventWriteToken, seat) {
|
|
2463
|
+
const response = await fetch(`${apiBaseUrl}/v1/org-study-join-sessions`, {
|
|
2464
|
+
method: "POST",
|
|
2465
|
+
headers: { "Content-Type": "application/json", Authorization: `Bearer ${eventWriteToken}` },
|
|
2466
|
+
body: JSON.stringify({
|
|
2467
|
+
joinCode: seat.joinCode,
|
|
2468
|
+
mode: "jam",
|
|
2469
|
+
handle: seat.handle,
|
|
2470
|
+
...seat.aircraft ? { aircraft: seat.aircraft } : {},
|
|
2471
|
+
...seat.colour ? { colour: seat.colour } : {}
|
|
2472
|
+
})
|
|
2473
|
+
});
|
|
2474
|
+
if (!response.ok)
|
|
2475
|
+
throw await apiError(response);
|
|
2476
|
+
return await response.json();
|
|
2477
|
+
}
|
|
2415
2478
|
async function getStudyJoinStatus(apiBaseUrl, eventWriteToken, joinSessionId) {
|
|
2416
2479
|
const response = await fetch(`${apiBaseUrl}/v1/org-study-join-sessions/${encodeURIComponent(joinSessionId)}/status`, {
|
|
2417
2480
|
method: "GET",
|
|
@@ -3920,6 +3983,8 @@ var require_hookAdapter = __commonJS({
|
|
|
3920
3983
|
if (!logFile)
|
|
3921
3984
|
throw error;
|
|
3922
3985
|
logUnsent(logFile, events, options);
|
|
3986
|
+
if (!(error instanceof MissingInstallationIdError))
|
|
3987
|
+
throw error;
|
|
3923
3988
|
return;
|
|
3924
3989
|
}
|
|
3925
3990
|
const sender = new eventSender_1.AscendaEventSender({
|
|
@@ -4017,17 +4082,20 @@ var require_confirmLinks = __commonJS({
|
|
|
4017
4082
|
"../packages/tool-kit/out/confirmLinks.js"(exports) {
|
|
4018
4083
|
"use strict";
|
|
4019
4084
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4085
|
+
exports.WEEKLY_POSTER_CONNECT_URL = void 0;
|
|
4020
4086
|
exports.pairingConfirmUrl = pairingConfirmUrl;
|
|
4021
4087
|
exports.pairingConfirmLines = pairingConfirmLines;
|
|
4022
4088
|
exports.studyJoinConfirmUrl = studyJoinConfirmUrl;
|
|
4089
|
+
exports.WEEKLY_POSTER_CONNECT_URL = "https://me.ascendaflow.com/connect";
|
|
4023
4090
|
function pairingConfirmUrl(qrUrl) {
|
|
4024
4091
|
return isHttps(qrUrl) ? qrUrl : void 0;
|
|
4025
4092
|
}
|
|
4026
4093
|
function pairingConfirmLines(qrUrl, code) {
|
|
4027
4094
|
const url = pairingConfirmUrl(qrUrl);
|
|
4095
|
+
const where = [" Ascenda Flow, under Connections \u2192 Ingest telemetry", ` ${exports.WEEKLY_POSTER_CONNECT_URL}, for the weekly poster`];
|
|
4028
4096
|
if (!url)
|
|
4029
|
-
return [`Confirm
|
|
4030
|
-
return [`Open this link to confirm: ${url}`, `Or
|
|
4097
|
+
return [`Confirm code ${code} in either place:`, ...where];
|
|
4098
|
+
return [`Open this link to confirm: ${url}`, `Or enter code ${code} in either place:`, ...where];
|
|
4031
4099
|
}
|
|
4032
4100
|
function studyJoinConfirmUrl(apiBaseUrl, deviceCode) {
|
|
4033
4101
|
if (!isHttps(apiBaseUrl))
|
|
@@ -4088,6 +4156,7 @@ var require_studyJoin = __commonJS({
|
|
|
4088
4156
|
};
|
|
4089
4157
|
}();
|
|
4090
4158
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4159
|
+
exports.gitOfferLine = gitOfferLine;
|
|
4091
4160
|
exports.runStudyJoin = runStudyJoin;
|
|
4092
4161
|
exports.formatWindow = formatWindow;
|
|
4093
4162
|
exports.describeStudyGrant = describeStudyGrant;
|
|
@@ -4096,6 +4165,11 @@ var require_studyJoin = __commonJS({
|
|
|
4096
4165
|
var readline = __importStar(__require("node:readline"));
|
|
4097
4166
|
var confirmLinks_1 = require_confirmLinks();
|
|
4098
4167
|
var http_1 = require_http();
|
|
4168
|
+
function gitOfferLine(optionalImportStores) {
|
|
4169
|
+
if (!optionalImportStores?.includes("git"))
|
|
4170
|
+
return void 0;
|
|
4171
|
+
return "The page also has an unticked box for git history: commit times, size buckets, files changed and whether each is a merge. No messages, paths, names or emails.";
|
|
4172
|
+
}
|
|
4099
4173
|
var STUDY_JOIN_MODE = "report";
|
|
4100
4174
|
var POLL_INTERVAL_MS = 3e3;
|
|
4101
4175
|
var POLL_TIMEOUT_MS = 11 * 60 * 1e3;
|
|
@@ -4132,6 +4206,9 @@ var require_studyJoin = __commonJS({
|
|
|
4132
4206
|
print("Report (30 days) grants:");
|
|
4133
4207
|
for (const grant of start.grants)
|
|
4134
4208
|
print(` ${describeStudyGrant(grant)}`);
|
|
4209
|
+
const gitOffer = gitOfferLine(start.optionalImportStores);
|
|
4210
|
+
if (gitOffer)
|
|
4211
|
+
print(gitOffer);
|
|
4135
4212
|
print("");
|
|
4136
4213
|
print("Study mode needs the Ascenda app. Open the app to join that way instead.");
|
|
4137
4214
|
print("");
|
|
@@ -4186,7 +4263,7 @@ var require_studyJoin = __commonJS({
|
|
|
4186
4263
|
print("");
|
|
4187
4264
|
print("Each of these can be turned off separately, in the app's consent settings.");
|
|
4188
4265
|
print("The organisation sees group counts, never who joined.");
|
|
4189
|
-
report({ status: "joined", start, granted });
|
|
4266
|
+
report({ status: "joined", start, granted, importStores: poll.importStores ?? null });
|
|
4190
4267
|
return 0;
|
|
4191
4268
|
}
|
|
4192
4269
|
if (poll.status === "expired") {
|
|
@@ -4208,7 +4285,7 @@ var require_studyJoin = __commonJS({
|
|
|
4208
4285
|
print("Each of these can be turned off separately, in the app's consent settings.");
|
|
4209
4286
|
}
|
|
4210
4287
|
print("Run join again, or check with your organisation.");
|
|
4211
|
-
report({ status: "refused", start, granted, refusedReason: poll.refusedReason, message: describeRefusal(poll.refusedReason) });
|
|
4288
|
+
report({ status: "refused", start, granted, refusedReason: poll.refusedReason, message: describeRefusal(poll.refusedReason), importStores: poll.importStores ?? null });
|
|
4212
4289
|
return 1;
|
|
4213
4290
|
}
|
|
4214
4291
|
print("");
|
|
@@ -4389,8 +4466,10 @@ var require_pairingStudyJoin = __commonJS({
|
|
|
4389
4466
|
const join = attempt.carriesJoin ? session.studyJoin : void 0;
|
|
4390
4467
|
if (!join)
|
|
4391
4468
|
return (0, confirmLinks_1.pairingConfirmLines)(session.qrUrl, session.code);
|
|
4469
|
+
const gitOffer = (0, studyJoin_1.gitOfferLine)(join.optionalImportStores);
|
|
4392
4470
|
return [
|
|
4393
4471
|
`This also joins ${join.organisationName} (${(0, studyJoin_1.formatWindow)(join.windowStartUtc, join.windowEndUtc)}). The page shows what you'd share before you confirm.`,
|
|
4472
|
+
...gitOffer ? [gitOffer] : [],
|
|
4394
4473
|
`Open this link to confirm: ${session.qrUrl}`
|
|
4395
4474
|
];
|
|
4396
4475
|
}
|
|
@@ -5021,7 +5100,7 @@ var require_setupDisclosure = __commonJS({
|
|
|
5021
5100
|
exports.renderSetupDisclosure = renderSetupDisclosure;
|
|
5022
5101
|
exports.FAMILY_SENTENCES = {
|
|
5023
5102
|
session: "when a session starts and ends, the one-word reason for the end if your agent gives one, how long each turn took, and whether it ran on this machine or in a hosted cloud session",
|
|
5024
|
-
counts: "how many prompts you sent, how many replies came back, and what class of command ran in a terminal \u2014 test, lint, build, git and so on",
|
|
5103
|
+
counts: "how many prompts you sent and roughly how long each was, as one of four sizes, how many replies came back, and what class of command ran in a terminal \u2014 test, lint, build, git and so on",
|
|
5025
5104
|
tools: "the name of each tool your agent calls",
|
|
5026
5105
|
outcome: "whether a call succeeded, failed, or was interrupted",
|
|
5027
5106
|
clock: "your machine's offset from UTC, so an evening is read as an evening",
|
|
@@ -5274,6 +5353,7 @@ var require_liveBus = __commonJS({
|
|
|
5274
5353
|
exports.existingSocketCandidates = existingSocketCandidates;
|
|
5275
5354
|
exports.liveBusSocketPath = liveBusSocketPath;
|
|
5276
5355
|
exports.bucketPromptSize = bucketPromptSize;
|
|
5356
|
+
exports.promptSizeMetadata = promptSizeMetadata;
|
|
5277
5357
|
exports.emitLiveSignal = emitLiveSignal;
|
|
5278
5358
|
exports.deliverLine = deliverLine;
|
|
5279
5359
|
var fs = __importStar(__require("fs"));
|
|
@@ -5322,6 +5402,9 @@ var require_liveBus = __commonJS({
|
|
|
5322
5402
|
return "l";
|
|
5323
5403
|
return "xl";
|
|
5324
5404
|
}
|
|
5405
|
+
function promptSizeMetadata(text) {
|
|
5406
|
+
return text === void 0 ? {} : { promptSizeBucket: bucketPromptSize(text) };
|
|
5407
|
+
}
|
|
5325
5408
|
var NOBODY_LISTENING = /* @__PURE__ */ new Set(["ECONNREFUSED", "ENOENT"]);
|
|
5326
5409
|
function onTheWire(signal) {
|
|
5327
5410
|
const out = { ...signal };
|
|
@@ -5960,7 +6043,7 @@ ${(0, setupDisclosure_1.renderSetupDisclosure)({ sends: spec.sends, displayName:
|
|
|
5960
6043
|
if (options.dryRun) {
|
|
5961
6044
|
row("info", "moved", `would remove the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os.homedir())}, so each event runs once`);
|
|
5962
6045
|
} else if (removeOurHookEntries(otherFile, spec)) {
|
|
5963
|
-
row("ok", "moved", `removed the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os.homedir())}, so each event runs once ${ui.dim("(backup beside it)")}`);
|
|
6046
|
+
row("ok", "moved", `removed the copy in ${(0, hookRunner_1.tidyHomePath)(otherFile, os.homedir())}, so each event runs once${spec.settings.owned ? "" : ` ${ui.dim("(backup beside it)")}`}`);
|
|
5964
6047
|
} else {
|
|
5965
6048
|
row("warn", "note", `${(0, hookRunner_1.tidyHomePath)(otherFile, os.homedir())} registers these hooks too, so each event runs twice.`);
|
|
5966
6049
|
detail("", `Remove the ${spec.binaryName} entries from one of the two files.`);
|
|
@@ -5987,7 +6070,7 @@ ${(0, setupDisclosure_1.renderSetupDisclosure)({ sends: spec.sends, displayName:
|
|
|
5987
6070
|
const next = (label, value) => console.log(` ${ui.bold(label.padEnd(6))} ${value}`);
|
|
5988
6071
|
console.log("");
|
|
5989
6072
|
if (chosenLocal) {
|
|
5990
|
-
console.log(`${ui.mark("ok")} ${ui.bold("Ready.")} The screen saver and
|
|
6073
|
+
console.log(`${ui.mark("ok")} ${ui.bold("Ready.")} The screen saver and Ascenda Flow's live view work now.`);
|
|
5991
6074
|
console.log(" They run on this machine and need no account or pairing.");
|
|
5992
6075
|
if (eventLog.path)
|
|
5993
6076
|
console.log(` Every event is also written to ${(0, hookRunner_1.tidyHomePath)(eventLog.path, os.homedir())}, for you or any tool to read.`);
|
|
@@ -6004,9 +6087,9 @@ ${(0, setupDisclosure_1.renderSetupDisclosure)({ sends: spec.sends, displayName:
|
|
|
6004
6087
|
next(chosenLocal ? "Pair" : "Retry", `${ui.cyan(`${self} setup`)}${chosenLocal ? ui.dim(" (optional)") : ""}`);
|
|
6005
6088
|
if (chosenLocal) {
|
|
6006
6089
|
console.log("");
|
|
6007
|
-
console.log(ui.dim(" Pairing sends the details below to Ascenda's servers, under the account
|
|
6008
|
-
console.log(ui.dim("
|
|
6009
|
-
console.log(ui.dim("
|
|
6090
|
+
console.log(ui.dim(" Pairing sends the details below to Ascenda's servers, under the account you"));
|
|
6091
|
+
console.log(ui.dim(" confirm the code with, in Ascenda Flow or at me.ascendaflow.com."));
|
|
6092
|
+
console.log(ui.dim(" Until you pair, nothing leaves this machine."));
|
|
6010
6093
|
console.log("");
|
|
6011
6094
|
console.log(ui.dim((0, setupDisclosure_1.renderSetupDisclosure)({ sends: spec.sends, displayName: spec.displayName }).split("\n").map((line) => ` ${line}`).join("\n")));
|
|
6012
6095
|
}
|
|
@@ -6232,7 +6315,7 @@ Pairing ${status.status}. Run setup again.`);
|
|
|
6232
6315
|
function writeHookSettings(settingsFile, binary, spec, dryRun) {
|
|
6233
6316
|
let settings = { ...spec.settings.scaffold ?? {} };
|
|
6234
6317
|
const exists = fs.existsSync(settingsFile);
|
|
6235
|
-
if (exists) {
|
|
6318
|
+
if (exists && !spec.settings.owned) {
|
|
6236
6319
|
const raw = fs.readFileSync(settingsFile, "utf8").trim();
|
|
6237
6320
|
if (raw) {
|
|
6238
6321
|
try {
|
|
@@ -6245,7 +6328,7 @@ ${settingsFile} is not valid JSON. Fix or move it, then run setup again.`);
|
|
|
6245
6328
|
}
|
|
6246
6329
|
}
|
|
6247
6330
|
const command = hookCommand(binary, spec);
|
|
6248
|
-
const hooks = { ...settings.hooks ?? {} };
|
|
6331
|
+
const hooks = spec.settings.owned ? {} : { ...settings.hooks ?? {} };
|
|
6249
6332
|
for (const event of spec.hookEvents) {
|
|
6250
6333
|
hooks[event] = placeOurEntry(hooks[event] ?? [], spec.settings.entry(command, event), spec);
|
|
6251
6334
|
}
|
|
@@ -6260,6 +6343,11 @@ ${settingsFile} is not valid JSON. Fix or move it, then run setup again.`);
|
|
|
6260
6343
|
${serialised}`);
|
|
6261
6344
|
return true;
|
|
6262
6345
|
}
|
|
6346
|
+
if (spec.settings.owned) {
|
|
6347
|
+
fs.mkdirSync(path.dirname(settingsFile), { recursive: true });
|
|
6348
|
+
(0, hookRunner_1.writeAtomically)(settingsFile, serialised, 420);
|
|
6349
|
+
return true;
|
|
6350
|
+
}
|
|
6263
6351
|
(0, settingsFile_1.replaceSettingsFile)(settingsFile, serialised);
|
|
6264
6352
|
return true;
|
|
6265
6353
|
}
|
|
@@ -6514,6 +6602,15 @@ ${serialised}`);
|
|
|
6514
6602
|
if (found.length)
|
|
6515
6603
|
lines.push("", ...found);
|
|
6516
6604
|
}
|
|
6605
|
+
if (spec.doctorExtras) {
|
|
6606
|
+
try {
|
|
6607
|
+
const extra = spec.doctorExtras(ui);
|
|
6608
|
+
if (extra.length)
|
|
6609
|
+
lines.push("", ...extra);
|
|
6610
|
+
} catch (error) {
|
|
6611
|
+
lines.push("", ` ${spec.displayName} checks could not run: ${error instanceof Error ? error.message : String(error)}`);
|
|
6612
|
+
}
|
|
6613
|
+
}
|
|
6517
6614
|
lines.push("", ...accountLines(ui, spec));
|
|
6518
6615
|
const localOnly = (0, credentials_1.isLocalOnlyHostInstall)(spec.host, (id) => (0, tokenStore_1.readTokenFile)((0, tokenStore_1.defaultTokenFilePath)(id)) !== void 0);
|
|
6519
6616
|
lines.push("", ` ${ui.bold("Local events")} ${(0, eventLog_1.describeEventLog)((0, eventLog_1.resolveEventLog)({ localOnly }), `npx ${spec.packageName} setup`)}`);
|
|
@@ -6569,6 +6666,10 @@ ${serialised}`);
|
|
|
6569
6666
|
function removeOurHookEntries(settingsFile, spec) {
|
|
6570
6667
|
if (!fs.existsSync(settingsFile))
|
|
6571
6668
|
return true;
|
|
6669
|
+
if (spec.settings.owned) {
|
|
6670
|
+
fs.rmSync(settingsFile, { force: true });
|
|
6671
|
+
return true;
|
|
6672
|
+
}
|
|
6572
6673
|
try {
|
|
6573
6674
|
const settings = JSON.parse(fs.readFileSync(settingsFile, "utf8"));
|
|
6574
6675
|
const hooks = { ...settings.hooks ?? {} };
|
|
@@ -6596,7 +6697,7 @@ ${serialised}`);
|
|
|
6596
6697
|
console.error(`could not parse ${settingsFile} \u2014 remove the ascenda hook entries by hand`);
|
|
6597
6698
|
return 1;
|
|
6598
6699
|
}
|
|
6599
|
-
console.log(`hooks removed from ${settingsFile}`);
|
|
6700
|
+
console.log(spec.settings.owned ? `removed ${settingsFile}` : `hooks removed from ${settingsFile}`);
|
|
6600
6701
|
}
|
|
6601
6702
|
for (const file of (0, hookRunner_1.removeHookRunner)(spec.binaryName)) {
|
|
6602
6703
|
if (!file.endsWith(".node") && !file.endsWith(".no-node"))
|
|
@@ -6707,6 +6808,395 @@ var require_turnState = __commonJS({
|
|
|
6707
6808
|
}
|
|
6708
6809
|
});
|
|
6709
6810
|
|
|
6811
|
+
// ../packages/tool-kit/out/squadronJoin.js
|
|
6812
|
+
var require_squadronJoin = __commonJS({
|
|
6813
|
+
"../packages/tool-kit/out/squadronJoin.js"(exports) {
|
|
6814
|
+
"use strict";
|
|
6815
|
+
var __createBinding = exports && exports.__createBinding || (Object.create ? function(o, m, k, k2) {
|
|
6816
|
+
if (k2 === void 0) k2 = k;
|
|
6817
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6818
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6819
|
+
desc = { enumerable: true, get: function() {
|
|
6820
|
+
return m[k];
|
|
6821
|
+
} };
|
|
6822
|
+
}
|
|
6823
|
+
Object.defineProperty(o, k2, desc);
|
|
6824
|
+
} : function(o, m, k, k2) {
|
|
6825
|
+
if (k2 === void 0) k2 = k;
|
|
6826
|
+
o[k2] = m[k];
|
|
6827
|
+
});
|
|
6828
|
+
var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? function(o, v) {
|
|
6829
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
6830
|
+
} : function(o, v) {
|
|
6831
|
+
o["default"] = v;
|
|
6832
|
+
});
|
|
6833
|
+
var __importStar = exports && exports.__importStar || /* @__PURE__ */ function() {
|
|
6834
|
+
var ownKeys = function(o) {
|
|
6835
|
+
ownKeys = Object.getOwnPropertyNames || function(o2) {
|
|
6836
|
+
var ar = [];
|
|
6837
|
+
for (var k in o2) if (Object.prototype.hasOwnProperty.call(o2, k)) ar[ar.length] = k;
|
|
6838
|
+
return ar;
|
|
6839
|
+
};
|
|
6840
|
+
return ownKeys(o);
|
|
6841
|
+
};
|
|
6842
|
+
return function(mod) {
|
|
6843
|
+
if (mod && mod.__esModule) return mod;
|
|
6844
|
+
var result = {};
|
|
6845
|
+
if (mod != null) {
|
|
6846
|
+
for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
6847
|
+
}
|
|
6848
|
+
__setModuleDefault(result, mod);
|
|
6849
|
+
return result;
|
|
6850
|
+
};
|
|
6851
|
+
}();
|
|
6852
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6853
|
+
exports.SQUADRON_COLOURS = exports.SQUADRON_AIRCRAFT = void 0;
|
|
6854
|
+
exports.generateCallsign = generateCallsign;
|
|
6855
|
+
exports.normaliseBookingReference = normaliseBookingReference;
|
|
6856
|
+
exports.callsignProblem = callsignProblem;
|
|
6857
|
+
exports.runSquadronJoin = runSquadronJoin;
|
|
6858
|
+
exports.leaseEnd = leaseEnd;
|
|
6859
|
+
exports.describeGate = describeGate;
|
|
6860
|
+
exports.describeSquadronRefusal = describeSquadronRefusal;
|
|
6861
|
+
var readline = __importStar(__require("node:readline"));
|
|
6862
|
+
var node_crypto_1 = __require("node:crypto");
|
|
6863
|
+
var confirmLinks_1 = require_confirmLinks();
|
|
6864
|
+
var http_1 = require_http();
|
|
6865
|
+
exports.SQUADRON_AIRCRAFT = ["trainer", "airliner", "glider", "fighter", "stealth", "floatplane"];
|
|
6866
|
+
exports.SQUADRON_COLOURS = ["orange", "yellow", "ivory", "charcoal", "grey", "red"];
|
|
6867
|
+
var CALLSIGN_WORDS = ["Kestrel", "Falcon", "Heron", "Swift", "Osprey", "Raven", "Merlin", "Puffin", "Condor", "Harrier", "Kite", "Tern"];
|
|
6868
|
+
function generateCallsign() {
|
|
6869
|
+
return `${CALLSIGN_WORDS[(0, node_crypto_1.randomInt)(CALLSIGN_WORDS.length)]} ${String((0, node_crypto_1.randomInt)(10, 100))}`;
|
|
6870
|
+
}
|
|
6871
|
+
function normaliseBookingReference(raw) {
|
|
6872
|
+
const cleaned = (raw ?? "").replace(/[\s-]/g, "").toUpperCase();
|
|
6873
|
+
return /^[A-Z0-9]{6}$/.test(cleaned) ? cleaned : void 0;
|
|
6874
|
+
}
|
|
6875
|
+
function callsignProblem(callsign) {
|
|
6876
|
+
const trimmed = callsign.trim();
|
|
6877
|
+
if (trimmed.length === 0)
|
|
6878
|
+
return "A callsign can't be empty.";
|
|
6879
|
+
if (trimmed.length > 40)
|
|
6880
|
+
return "A callsign is 40 characters at most.";
|
|
6881
|
+
if (/[\u0000-\u001f\u007f]/.test(trimmed))
|
|
6882
|
+
return "A callsign can't contain control characters.";
|
|
6883
|
+
return void 0;
|
|
6884
|
+
}
|
|
6885
|
+
var POLL_INTERVAL_MS = 3e3;
|
|
6886
|
+
var POLL_TIMEOUT_MS = 11 * 60 * 1e3;
|
|
6887
|
+
async function runSquadronJoin(ctx) {
|
|
6888
|
+
const stdin = ctx.stdin ?? process.stdin;
|
|
6889
|
+
const stdout = ctx.stdout ?? process.stdout;
|
|
6890
|
+
const stderr = ctx.stderr ?? process.stderr;
|
|
6891
|
+
const print = (line = "") => stdout.write(`${line}
|
|
6892
|
+
`);
|
|
6893
|
+
if (!stdin.isTTY || !stdout.isTTY) {
|
|
6894
|
+
stderr.write("squadron needs an interactive terminal (stdin and stdout). Run it directly, not from a script or a pipe.\n");
|
|
6895
|
+
return 0;
|
|
6896
|
+
}
|
|
6897
|
+
const reference = normaliseBookingReference(ctx.bookingReference);
|
|
6898
|
+
if (!reference) {
|
|
6899
|
+
stderr.write("A booking reference is six letters or digits, like FEFBDH.\n");
|
|
6900
|
+
return 1;
|
|
6901
|
+
}
|
|
6902
|
+
let preview;
|
|
6903
|
+
try {
|
|
6904
|
+
preview = await (0, http_1.previewJoinCode)(ctx.apiBaseUrl, reference);
|
|
6905
|
+
} catch (error) {
|
|
6906
|
+
stderr.write(`${describeSquadronError(error)}
|
|
6907
|
+
`);
|
|
6908
|
+
return 1;
|
|
6909
|
+
}
|
|
6910
|
+
const jam = preview.jam;
|
|
6911
|
+
if (preview.labRole !== "Jam" || !jam) {
|
|
6912
|
+
stderr.write(`${reference} isn't a Squadron booking reference. If it's a study code, run join instead.
|
|
6913
|
+
`);
|
|
6914
|
+
return 1;
|
|
6915
|
+
}
|
|
6916
|
+
if (jam.acceptsJoins === false) {
|
|
6917
|
+
stderr.write(jam.isLocked ? "This sortie's gate is closed. Ask the host to open it.\n" : "This sortie isn't taking new pilots.\n");
|
|
6918
|
+
return 1;
|
|
6919
|
+
}
|
|
6920
|
+
const aircraftList = jam.aircraft?.length ? jam.aircraft : [...exports.SQUADRON_AIRCRAFT];
|
|
6921
|
+
const colourList = jam.colours?.length ? jam.colours : [...exports.SQUADRON_COLOURS];
|
|
6922
|
+
for (const [flag, value, list] of [["--aircraft", ctx.aircraft, aircraftList], ["--colour", ctx.colour, colourList]]) {
|
|
6923
|
+
if (value !== void 0 && !list.includes(value.trim().toLowerCase())) {
|
|
6924
|
+
stderr.write(`${flag} must be one of: ${list.join(", ")}.
|
|
6925
|
+
`);
|
|
6926
|
+
return 1;
|
|
6927
|
+
}
|
|
6928
|
+
}
|
|
6929
|
+
if (ctx.callsign !== void 0) {
|
|
6930
|
+
const problem = callsignProblem(ctx.callsign);
|
|
6931
|
+
if (problem) {
|
|
6932
|
+
stderr.write(`${problem}
|
|
6933
|
+
`);
|
|
6934
|
+
return 1;
|
|
6935
|
+
}
|
|
6936
|
+
}
|
|
6937
|
+
print();
|
|
6938
|
+
print(`Squadron: ${jam.name ?? preview.labName ?? reference}`);
|
|
6939
|
+
if (jam.mission)
|
|
6940
|
+
print(`Mission: ${jam.mission}`);
|
|
6941
|
+
print(describeGate(jam));
|
|
6942
|
+
print();
|
|
6943
|
+
const prompt = createPrompter(stdin, stdout);
|
|
6944
|
+
try {
|
|
6945
|
+
let callsign = ctx.callsign?.trim();
|
|
6946
|
+
if (callsign === void 0) {
|
|
6947
|
+
const suggested = (ctx.generateCallsign ?? generateCallsign)();
|
|
6948
|
+
for (; ; ) {
|
|
6949
|
+
const answer = await prompt.ask(`Callsign [${suggested}]: `);
|
|
6950
|
+
if (answer === void 0)
|
|
6951
|
+
return notNow(print);
|
|
6952
|
+
const chosen = answer === "" ? suggested : answer;
|
|
6953
|
+
const problem = callsignProblem(chosen);
|
|
6954
|
+
if (!problem) {
|
|
6955
|
+
callsign = chosen.trim();
|
|
6956
|
+
break;
|
|
6957
|
+
}
|
|
6958
|
+
print(problem);
|
|
6959
|
+
}
|
|
6960
|
+
}
|
|
6961
|
+
let aircraft = ctx.aircraft?.trim().toLowerCase();
|
|
6962
|
+
if (aircraft === void 0) {
|
|
6963
|
+
const suggested = aircraftList[(0, node_crypto_1.randomInt)(aircraftList.length)];
|
|
6964
|
+
aircraft = await askFromList(prompt, print, "Aircraft", aircraftList, suggested);
|
|
6965
|
+
if (aircraft === void 0)
|
|
6966
|
+
return notNow(print);
|
|
6967
|
+
}
|
|
6968
|
+
let colour = ctx.colour?.trim().toLowerCase();
|
|
6969
|
+
if (colour === void 0) {
|
|
6970
|
+
const picked = await askFromList(prompt, print, "Colour", colourList, "", "dealt for you");
|
|
6971
|
+
if (picked === void 0)
|
|
6972
|
+
return notNow(print);
|
|
6973
|
+
colour = picked === "" ? void 0 : picked;
|
|
6974
|
+
}
|
|
6975
|
+
print();
|
|
6976
|
+
print(`You'll confirm as ${callsign}, ${aircraft}${colour ? `, ${colour}` : ""}. The confirm page lets you change any of them.`);
|
|
6977
|
+
print();
|
|
6978
|
+
print("Joining shares, with this squadron only:");
|
|
6979
|
+
print(` your activity counts from ${ctx.displayName}: prompts, tool calls, turns and edits, as numbers`);
|
|
6980
|
+
print(" your callsign and aircraft, which the other pilots see");
|
|
6981
|
+
print("Never your prompts, code, file names or project names.");
|
|
6982
|
+
print("Sharing stops on the date the server gives when you join. It's printed then.");
|
|
6983
|
+
print();
|
|
6984
|
+
print(" 1) Join");
|
|
6985
|
+
print(" 2) Not now");
|
|
6986
|
+
print();
|
|
6987
|
+
const choice = await prompt.ask("Choice [Not now]: ");
|
|
6988
|
+
if (choice === void 0 || !/^(1|join|y|yes)$/i.test(choice))
|
|
6989
|
+
return notNow(print);
|
|
6990
|
+
prompt.close();
|
|
6991
|
+
let start;
|
|
6992
|
+
try {
|
|
6993
|
+
start = await (0, http_1.startSquadronJoin)(ctx.apiBaseUrl, ctx.eventWriteToken, { joinCode: reference, handle: callsign, aircraft, colour });
|
|
6994
|
+
} catch (error) {
|
|
6995
|
+
const doorClosed = error instanceof http_1.AscendaApiError && error.status === 404 && !error.errorCode?.startsWith("jam_");
|
|
6996
|
+
stderr.write(doorClosed ? "This server can't seat you in a sortie from the command line yet. Join from the Ascenda app instead.\n" : `${describeSquadronError(error)}
|
|
6997
|
+
`);
|
|
6998
|
+
return 1;
|
|
6999
|
+
}
|
|
7000
|
+
if (start.kind !== void 0 && start.kind !== "jam") {
|
|
7001
|
+
stderr.write(`${reference} opened a study join, not a sortie. Run join instead.
|
|
7002
|
+
`);
|
|
7003
|
+
return 1;
|
|
7004
|
+
}
|
|
7005
|
+
print();
|
|
7006
|
+
const confirmUrl = (0, confirmLinks_1.studyJoinConfirmUrl)(ctx.apiBaseUrl, start.deviceCode);
|
|
7007
|
+
if (confirmUrl) {
|
|
7008
|
+
print(`Open this link to confirm: ${confirmUrl}`);
|
|
7009
|
+
print(`Or confirm in the Ascenda app with code ${start.deviceCode}.`);
|
|
7010
|
+
} else {
|
|
7011
|
+
print(`Confirm in the Ascenda app with code ${start.deviceCode}`);
|
|
7012
|
+
}
|
|
7013
|
+
print(`Waiting for confirmation (expires ${formatLocalTime(start.expiresAt)})...`);
|
|
7014
|
+
const pollIntervalMs = ctx.pollIntervalMs ?? POLL_INTERVAL_MS;
|
|
7015
|
+
const deadline = Math.min(Date.parse(start.expiresAt) || Date.now() + POLL_TIMEOUT_MS, Date.now() + POLL_TIMEOUT_MS);
|
|
7016
|
+
while (Date.now() < deadline) {
|
|
7017
|
+
await new Promise((resolve) => setTimeout(resolve, pollIntervalMs));
|
|
7018
|
+
let poll;
|
|
7019
|
+
try {
|
|
7020
|
+
poll = await (0, http_1.getStudyJoinStatus)(ctx.apiBaseUrl, ctx.eventWriteToken, start.joinSessionId);
|
|
7021
|
+
} catch (error) {
|
|
7022
|
+
if (!(error instanceof http_1.AscendaApiError) || error.status >= 500 && error.status <= 599)
|
|
7023
|
+
continue;
|
|
7024
|
+
stderr.write(`${describeSquadronError(error)}
|
|
7025
|
+
`);
|
|
7026
|
+
return 1;
|
|
7027
|
+
}
|
|
7028
|
+
if (poll.status === "pending")
|
|
7029
|
+
continue;
|
|
7030
|
+
if (poll.status === "confirmed") {
|
|
7031
|
+
const until = poll.endUtc ?? poll.jam?.endUtc ?? leaseEnd(poll.jam ?? {});
|
|
7032
|
+
const seat = poll.jam?.handle ? ` as ${poll.jam.handle}` : "";
|
|
7033
|
+
print();
|
|
7034
|
+
print(poll.jam?.alreadyJoined ? `You already have a seat${seat}.` : `Joined${seat}.`);
|
|
7035
|
+
print(until ? `Your activity counts are shared with this squadron until ${formatLocalDate(until)}.` : "Your activity counts are shared with this squadron until the sortie's sharing ends. The server didn't give a date.");
|
|
7036
|
+
print(describeStatusAfterJoin(poll.jam));
|
|
7037
|
+
return 0;
|
|
7038
|
+
}
|
|
7039
|
+
if (poll.status === "expired") {
|
|
7040
|
+
print();
|
|
7041
|
+
print("This code expired before it was confirmed. Run squadron again for a fresh code.");
|
|
7042
|
+
return 1;
|
|
7043
|
+
}
|
|
7044
|
+
print();
|
|
7045
|
+
print(describeSquadronRefusal(poll.refusedReason ?? void 0));
|
|
7046
|
+
return 1;
|
|
7047
|
+
}
|
|
7048
|
+
print();
|
|
7049
|
+
print("Timed out waiting for confirmation. Run squadron again for a fresh code.");
|
|
7050
|
+
return 1;
|
|
7051
|
+
} finally {
|
|
7052
|
+
prompt.close();
|
|
7053
|
+
}
|
|
7054
|
+
}
|
|
7055
|
+
function leaseEnd(jam) {
|
|
7056
|
+
const from = Date.parse(jam.startedAt ?? jam.quorumDeadline ?? "");
|
|
7057
|
+
if (Number.isNaN(from) || typeof jam.durationMinutes !== "number")
|
|
7058
|
+
return void 0;
|
|
7059
|
+
return new Date(from + (jam.durationMinutes + 7 * 24 * 60) * 6e4).toISOString();
|
|
7060
|
+
}
|
|
7061
|
+
function notNow(print) {
|
|
7062
|
+
print("Not now.");
|
|
7063
|
+
return 0;
|
|
7064
|
+
}
|
|
7065
|
+
async function askFromList(prompt, print, label, list, suggested, emptyMeans) {
|
|
7066
|
+
print(`${label === "Aircraft" ? "Aircraft" : `${label}s`}: ${list.join(", ")}`);
|
|
7067
|
+
for (; ; ) {
|
|
7068
|
+
const answer = await prompt.ask(`${label} [${emptyMeans ?? suggested}]: `);
|
|
7069
|
+
if (answer === void 0)
|
|
7070
|
+
return void 0;
|
|
7071
|
+
if (answer === "")
|
|
7072
|
+
return suggested;
|
|
7073
|
+
const value = answer.toLowerCase();
|
|
7074
|
+
const byNumber = /^\d+$/.test(value) ? list[Number(value) - 1] : void 0;
|
|
7075
|
+
if (byNumber)
|
|
7076
|
+
return byNumber;
|
|
7077
|
+
if (list.includes(value))
|
|
7078
|
+
return value;
|
|
7079
|
+
print(`Pick one of: ${list.join(", ")}.`);
|
|
7080
|
+
}
|
|
7081
|
+
}
|
|
7082
|
+
function describeGate(jam) {
|
|
7083
|
+
const length = jam.durationMinutes ? `${jam.durationMinutes}-minute flight plan` : "flight plan";
|
|
7084
|
+
if (jam.status === "live")
|
|
7085
|
+
return `In the air now, ${length}.`;
|
|
7086
|
+
const have = jam.activeParticipants ?? 0;
|
|
7087
|
+
const need = jam.minParticipants ?? 0;
|
|
7088
|
+
const deadline = jam.quorumDeadline ? `, gate closes ${formatLocalTime(jam.quorumDeadline)}` : "";
|
|
7089
|
+
return need > have ? `On the ground: ${have} of ${need} pilots in${deadline}. The ${length} starts when the squadron fills.` : `On the ground${deadline}. ${length[0].toUpperCase()}${length.slice(1)}.`;
|
|
7090
|
+
}
|
|
7091
|
+
function describeStatusAfterJoin(jam) {
|
|
7092
|
+
if (!jam)
|
|
7093
|
+
return "Open the Ascenda app to watch the squadron.";
|
|
7094
|
+
if (jam.status === "live" && jam.expiresAt)
|
|
7095
|
+
return `The squadron is in the air until ${formatLocalTime(jam.expiresAt)}. Open the Ascenda app to watch.`;
|
|
7096
|
+
const have = jam.activeParticipants;
|
|
7097
|
+
const need = jam.minParticipants;
|
|
7098
|
+
if (have !== void 0 && need !== void 0 && need > have)
|
|
7099
|
+
return `${have} of ${need} pilots in. The clock starts when the squadron fills.`;
|
|
7100
|
+
return "Open the Ascenda app to watch the squadron.";
|
|
7101
|
+
}
|
|
7102
|
+
function describeSquadronRefusal(code) {
|
|
7103
|
+
switch (code) {
|
|
7104
|
+
case "join_code_not_found":
|
|
7105
|
+
return "No sortie has that booking reference, or it has ended.";
|
|
7106
|
+
case "jam_closed":
|
|
7107
|
+
return "That sortie has ended.";
|
|
7108
|
+
case "jam_locked":
|
|
7109
|
+
return "This sortie's gate is closed. Ask the host to open it.";
|
|
7110
|
+
case "jam_already_left":
|
|
7111
|
+
return "You left this sortie, and leaving is final. Ask the host for a new one.";
|
|
7112
|
+
case "jam_handle_taken":
|
|
7113
|
+
return "Another pilot has that callsign. Run squadron again and pick another.";
|
|
7114
|
+
case "jam_requires_account":
|
|
7115
|
+
return "A sortie needs a signed-in Ascenda account, not a guest one.";
|
|
7116
|
+
case "jam_handle_required":
|
|
7117
|
+
case "jam_handle_too_long":
|
|
7118
|
+
case "jam_handle_invalid":
|
|
7119
|
+
return "The server didn't accept that callsign. Run squadron again and pick another.";
|
|
7120
|
+
case "jam_aircraft_unknown":
|
|
7121
|
+
return "The server didn't recognise that aircraft.";
|
|
7122
|
+
case "jam_colour_unknown":
|
|
7123
|
+
return "The server didn't recognise that colour.";
|
|
7124
|
+
case "unknown_mode":
|
|
7125
|
+
return "This server's join door didn't accept a sortie. It may be older than this command.";
|
|
7126
|
+
case "too_many_open_sessions":
|
|
7127
|
+
return "Too many joins are waiting to be confirmed. Confirm or let one expire, then try again.";
|
|
7128
|
+
case "jam_not_enabled":
|
|
7129
|
+
return "Squadron isn't switched on for this server yet.";
|
|
7130
|
+
default:
|
|
7131
|
+
return code ? `The server refused the join (${code}).` : "The server refused the join.";
|
|
7132
|
+
}
|
|
7133
|
+
}
|
|
7134
|
+
function describeSquadronError(error) {
|
|
7135
|
+
if (error instanceof http_1.AscendaApiError) {
|
|
7136
|
+
if (error.status === 401)
|
|
7137
|
+
return "This collector's pairing isn't accepted any more. Run pair, then try again.";
|
|
7138
|
+
if (error.status === 404 && !error.errorCode?.startsWith("jam_"))
|
|
7139
|
+
return describeSquadronRefusal("join_code_not_found");
|
|
7140
|
+
return describeSquadronRefusal(error.errorCode);
|
|
7141
|
+
}
|
|
7142
|
+
return `Couldn't reach Ascenda: ${error instanceof Error ? error.message : String(error)}`;
|
|
7143
|
+
}
|
|
7144
|
+
function createPrompter(stdin, stdout) {
|
|
7145
|
+
const rl = readline.createInterface({ input: stdin, output: stdout });
|
|
7146
|
+
let closed = false;
|
|
7147
|
+
const lines = [];
|
|
7148
|
+
let waiting;
|
|
7149
|
+
rl.on("line", (line) => {
|
|
7150
|
+
if (waiting) {
|
|
7151
|
+
const resolve = waiting;
|
|
7152
|
+
waiting = void 0;
|
|
7153
|
+
resolve(line.trim());
|
|
7154
|
+
} else {
|
|
7155
|
+
lines.push(line.trim());
|
|
7156
|
+
}
|
|
7157
|
+
});
|
|
7158
|
+
rl.on("close", () => {
|
|
7159
|
+
closed = true;
|
|
7160
|
+
if (waiting) {
|
|
7161
|
+
const resolve = waiting;
|
|
7162
|
+
waiting = void 0;
|
|
7163
|
+
resolve(void 0);
|
|
7164
|
+
}
|
|
7165
|
+
});
|
|
7166
|
+
return {
|
|
7167
|
+
ask(question) {
|
|
7168
|
+
if (lines.length > 0) {
|
|
7169
|
+
stdout.write(question);
|
|
7170
|
+
return Promise.resolve(lines.shift());
|
|
7171
|
+
}
|
|
7172
|
+
if (closed)
|
|
7173
|
+
return Promise.resolve(void 0);
|
|
7174
|
+
stdout.write(question);
|
|
7175
|
+
return new Promise((resolve) => {
|
|
7176
|
+
waiting = resolve;
|
|
7177
|
+
});
|
|
7178
|
+
},
|
|
7179
|
+
close() {
|
|
7180
|
+
if (!closed)
|
|
7181
|
+
rl.close();
|
|
7182
|
+
}
|
|
7183
|
+
};
|
|
7184
|
+
}
|
|
7185
|
+
function formatLocalTime(iso) {
|
|
7186
|
+
const date = new Date(iso);
|
|
7187
|
+
if (Number.isNaN(date.getTime()))
|
|
7188
|
+
return iso;
|
|
7189
|
+
return new Intl.DateTimeFormat(void 0, { day: "numeric", month: "short", hour: "numeric", minute: "2-digit" }).format(date);
|
|
7190
|
+
}
|
|
7191
|
+
function formatLocalDate(iso) {
|
|
7192
|
+
const date = new Date(iso);
|
|
7193
|
+
if (Number.isNaN(date.getTime()))
|
|
7194
|
+
return iso;
|
|
7195
|
+
return new Intl.DateTimeFormat(void 0, { day: "numeric", month: "short", year: "numeric" }).format(date);
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
});
|
|
7199
|
+
|
|
6710
7200
|
// ../packages/tool-kit/out/pluginBundle.js
|
|
6711
7201
|
var require_pluginBundle = __commonJS({
|
|
6712
7202
|
"../packages/tool-kit/out/pluginBundle.js"(exports) {
|
|
@@ -6947,9 +7437,9 @@ var require_out3 = __commonJS({
|
|
|
6947
7437
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6948
7438
|
exports.expandUserPath = exports.describeEventLog = exports.defaultEventLogPath = exports.appendEventLog = exports.EVENT_LOG_OFF = exports.EVENT_LOG_ENV_VAR = exports.toAgentEvent = exports.buildEventPayload = exports.buildEventBody = exports.TOKEN_RENEW_LEAD_MS = exports.AscendaSemanticEventError = exports.AscendaEventSender = exports.startBackgroundFlush = exports.runOutboxFlush = exports.hookDeliveryInline = exports.flushLockPath = exports.OUTBOX_FLUSH_COMMAND = exports.HOOK_DELIVERY_ENV_VAR = exports.FLUSH_LOCK_FRESH_MS = exports.describeCollectorVersion = exports.UNRELEASED_COLLECTOR_VERSION = exports.COLLECTOR_VERSION = exports.detectCollectorPlatform = exports.COLLECTOR_PLATFORM = exports.mintIdempotencyKey = exports.looksLikeCorrection = exports.outcomeForHook = exports.inferOutcome = exports.getNestedNumber = exports.getNestedString = exports.getNested = exports.getNumber = exports.getString = exports.localHourAt = exports.utcOffsetMinutesAt = exports.BUSINESS_DAY = exports.isOutsideBusinessHours = exports.isAfterHours = exports.bucketDurationMs = exports.bucketLinesChanged = exports.classifyModelClass = exports.autonomyBand = exports.shellCommandFacts = exports.invitesDebrief = exports.classifyMcpWorkMilestone = exports.classifyWorkMilestone = exports.isReworkGitAction = exports.classifyGitAction = exports.isVerificationCommand = exports.classifyCommand = void 0;
|
|
6949
7439
|
exports.shouldAnnounceFailure = exports.recordSendOutcome = exports.readCollectorState = exports.defaultStateFilePath = exports.tokenExpiryFilePath = exports.readTokenFile = exports.readTokenExpiry = exports.persistEventWriteToken = exports.listPersistedToolInstallationIds = exports.defaultTokenFilePath = exports.ascendaHome = exports.EVENT_TOKEN_TTL_MS = exports.recordTurnStart = exports.readTurnPromptId = exports.consumeTurnDurationMs = exports.writeTopLevelCredentials = exports.writeMachineCredentials = exports.writeRepoKeysSetting = exports.writeEventLogSetting = exports.writeHostCredentials = exports.removeHostCredentials = exports.readMachineCredentials = exports.readHostCredentials = exports.isLocalOnlyHostInstall = exports.credentialsFilePath = exports.renderSetupDisclosure = exports.REFUSALS = exports.FREE_TEXT_KEYS = exports.FAMILY_SENTENCES = exports.ALWAYS_SENT = exports.writeHookSettings = exports.trustProblemLines = exports.runCliAgentSetup = exports.registeredHookSets = exports.ourHookPositions = exports.isCliAgentManagementCommand = exports.findStaleHookCommands = exports.cliAgentHookBinPath = exports.resolveContextHashes = exports.resolveCliAgentInstallationId = exports.withPromptId = exports.withForgeKeys = exports.loadCliAgentConfig = exports.flushHookOutbox = exports.deliverHookEvents = exports.MissingInstallationIdError = exports.DEFAULT_API_BASE_URL = exports.resolveEventLogPath = exports.resolveEventLog = exports.parseEventLogFlag = void 0;
|
|
6950
|
-
exports.
|
|
6951
|
-
exports.
|
|
6952
|
-
exports.writePairingJoinOutcome = exports.settleStudyJoin = exports.pairingJoinOutcome = exports.pairingAttemptLines = exports.createPairingAttempt = exports.PAIR_ORG_JOIN_CODE_ENV = exports.PAIR_JOIN_OUTCOME_FILE_ENV = exports.studyJoinConfirmUrl = exports.pairingConfirmUrl = exports.pairingConfirmLines = exports.runStudyJoin = exports.formatWindow = exports.describeStudyGrant = exports.describeStudyKind = exports.describeStudyJoinRefusal = exports.studyNoticeStatus = exports.runStudyObjection = exports.renderStudyNotices = exports.NOTICED_PURPOSES = exports.renderInitiatives = exports.initiativesStatusLines = exports.INITIATIVE_COPY = exports.startStudyJoin = exports.setStudyObjection = exports.markStudyNoticeShown = exports.readStudyNotices = exports.readInitiatives = void 0;
|
|
7440
|
+
exports.emitLiveSignal = exports.startSquadronJoin = exports.previewJoinCode = exports.SQUADRON_COLOURS = exports.SQUADRON_AIRCRAFT = exports.describeSquadronRefusal = exports.describeGate = exports.callsignProblem = exports.normaliseBookingReference = exports.generateCallsign = exports.leaseEnd = exports.runSquadronJoin = exports.repoKeysEnabled = exports.deriveForgeKeysForCwd = exports.REPO_KEYS_ENV_VAR = exports.recordForgeProjectAlias = exports.forgeFullNameFromConfig = exports.readForgeFullName = exports.parseForgeFullName = exports.forgeBranchKey = exports.forgeRepoKey = exports.forgeProjectHash = exports.workContextRegistryFilePath = exports.readWorkContextRegistry = exports.recordWorkContextAlias = exports.recordWorkContext = exports.readBranchName = exports.normalizeBranchName = exports.deriveBranchHashForCwd = exports.deriveBranchHash = exports.deriveWorkContext = exports.hashWithMachineSalt = exports.readOrCreateMachineSalt = exports.machineSaltFilePath = exports.fixedTimeProvider = exports.systemTimeProvider = exports.enforceOutboxBounds = exports.claimOutbox = exports.readOutboxSummary = exports.appendToOutbox = exports.defaultOutboxFilePath = exports.outboxDrainEnabled = exports.DEFAULT_OUTBOX_DRAIN_BATCH_SIZE = exports.DEFAULT_OUTBOX_MAX_AGE_MS = exports.DEFAULT_OUTBOX_MAX_ENTRIES = exports.OUTBOX_DRAIN_ENV_VAR = exports.recordOutboxDiscard = exports.unresolvedToolInstallationId = exports.unresolvedStateFilePath = exports.markFailureNotified = void 0;
|
|
7441
|
+
exports.livePidFields = exports.findAgentProcess = exports.findAgentPid = exports.AGENT_PROCESS = exports.readViaPlugin = exports.readHookSet = exports.isHookSet = exports.hookSetOfCommand = exports.hookSetChanges = exports.hookSetArgument = exports.describeHookSetChanges = exports.UNVERSIONED_HOOK_SET = exports.HOOK_SET_FLAG = exports.liveSignalDoctorLines = exports.doctorRow = exports.DOCTOR_VALUE_COLUMN = exports.pluginBundlePaths = exports.installPluginBundle = exports.describePluginBundleOutcome = exports.replaceSettingsFile = exports.writeAtomically = exports.tidyHomePath = exports.stampLastHook = exports.resolveHookNode = exports.removeHookRunner = exports.readLastHook = exports.lastHookPath = exports.isDowngrade = exports.installHookRunner = exports.hookRunnerPaths = exports.hookRunnerCommand = exports.hookLauncherScript = exports.describeAge = exports.terminalStyle = exports.colourEnabled = exports.SAVER_REPLAY_WINDOW_MS = exports.saverSupportDir = exports.saverStatusDir = exports.saverReplayPath = exports.saverContainerDir = exports.readSaverStatuses = exports.probeSocket = exports.heldForSaver = exports.holdForSaver = exports.LIVE_BUS_BACKGROUND_TRUST_MS = exports.liveBusSocketCandidates = exports.liveBusSocketPath = exports.promptSizeMetadata = exports.bucketPromptSize = exports.deliverLine = void 0;
|
|
7442
|
+
exports.writePairingJoinOutcome = exports.settleStudyJoin = exports.pairingJoinOutcome = exports.pairingAttemptLines = exports.createPairingAttempt = exports.PAIR_ORG_JOIN_CODE_ENV = exports.PAIR_JOIN_OUTCOME_FILE_ENV = exports.studyJoinConfirmUrl = exports.pairingConfirmUrl = exports.pairingConfirmLines = exports.WEEKLY_POSTER_CONNECT_URL = exports.runStudyJoin = exports.gitOfferLine = exports.formatWindow = exports.describeStudyGrant = exports.describeStudyKind = exports.describeStudyJoinRefusal = exports.studyNoticeStatus = exports.runStudyObjection = exports.renderStudyNotices = exports.NOTICED_PURPOSES = exports.renderInitiatives = exports.initiativesStatusLines = exports.INITIATIVE_COPY = exports.startStudyJoin = exports.setStudyObjection = exports.markStudyNoticeShown = exports.readStudyNotices = exports.readInitiatives = exports.isRetryableStatus = exports.parseIngestResponse = exports.postToolEventsBatch = exports.postToolEvent = exports.renewToolToken = exports.getStudyJoinStatus = exports.getPairingStatus = exports.createPairingSession = exports.AscendaApiError = exports.scriptMarkerIn = exports.psLookup = exports.psArgsLookup = void 0;
|
|
6953
7443
|
var commandClassifier_1 = require_commandClassifier();
|
|
6954
7444
|
Object.defineProperty(exports, "classifyCommand", { enumerable: true, get: function() {
|
|
6955
7445
|
return commandClassifier_1.classifyCommand;
|
|
@@ -7393,6 +7883,41 @@ var require_out3 = __commonJS({
|
|
|
7393
7883
|
Object.defineProperty(exports, "repoKeysEnabled", { enumerable: true, get: function() {
|
|
7394
7884
|
return forgeKeys_1.repoKeysEnabled;
|
|
7395
7885
|
} });
|
|
7886
|
+
var squadronJoin_1 = require_squadronJoin();
|
|
7887
|
+
Object.defineProperty(exports, "runSquadronJoin", { enumerable: true, get: function() {
|
|
7888
|
+
return squadronJoin_1.runSquadronJoin;
|
|
7889
|
+
} });
|
|
7890
|
+
Object.defineProperty(exports, "leaseEnd", { enumerable: true, get: function() {
|
|
7891
|
+
return squadronJoin_1.leaseEnd;
|
|
7892
|
+
} });
|
|
7893
|
+
Object.defineProperty(exports, "generateCallsign", { enumerable: true, get: function() {
|
|
7894
|
+
return squadronJoin_1.generateCallsign;
|
|
7895
|
+
} });
|
|
7896
|
+
Object.defineProperty(exports, "normaliseBookingReference", { enumerable: true, get: function() {
|
|
7897
|
+
return squadronJoin_1.normaliseBookingReference;
|
|
7898
|
+
} });
|
|
7899
|
+
Object.defineProperty(exports, "callsignProblem", { enumerable: true, get: function() {
|
|
7900
|
+
return squadronJoin_1.callsignProblem;
|
|
7901
|
+
} });
|
|
7902
|
+
Object.defineProperty(exports, "describeGate", { enumerable: true, get: function() {
|
|
7903
|
+
return squadronJoin_1.describeGate;
|
|
7904
|
+
} });
|
|
7905
|
+
Object.defineProperty(exports, "describeSquadronRefusal", { enumerable: true, get: function() {
|
|
7906
|
+
return squadronJoin_1.describeSquadronRefusal;
|
|
7907
|
+
} });
|
|
7908
|
+
Object.defineProperty(exports, "SQUADRON_AIRCRAFT", { enumerable: true, get: function() {
|
|
7909
|
+
return squadronJoin_1.SQUADRON_AIRCRAFT;
|
|
7910
|
+
} });
|
|
7911
|
+
Object.defineProperty(exports, "SQUADRON_COLOURS", { enumerable: true, get: function() {
|
|
7912
|
+
return squadronJoin_1.SQUADRON_COLOURS;
|
|
7913
|
+
} });
|
|
7914
|
+
var http_1 = require_http();
|
|
7915
|
+
Object.defineProperty(exports, "previewJoinCode", { enumerable: true, get: function() {
|
|
7916
|
+
return http_1.previewJoinCode;
|
|
7917
|
+
} });
|
|
7918
|
+
Object.defineProperty(exports, "startSquadronJoin", { enumerable: true, get: function() {
|
|
7919
|
+
return http_1.startSquadronJoin;
|
|
7920
|
+
} });
|
|
7396
7921
|
var liveBus_1 = require_liveBus();
|
|
7397
7922
|
Object.defineProperty(exports, "emitLiveSignal", { enumerable: true, get: function() {
|
|
7398
7923
|
return liveBus_1.emitLiveSignal;
|
|
@@ -7403,6 +7928,9 @@ var require_out3 = __commonJS({
|
|
|
7403
7928
|
Object.defineProperty(exports, "bucketPromptSize", { enumerable: true, get: function() {
|
|
7404
7929
|
return liveBus_1.bucketPromptSize;
|
|
7405
7930
|
} });
|
|
7931
|
+
Object.defineProperty(exports, "promptSizeMetadata", { enumerable: true, get: function() {
|
|
7932
|
+
return liveBus_1.promptSizeMetadata;
|
|
7933
|
+
} });
|
|
7406
7934
|
Object.defineProperty(exports, "liveBusSocketPath", { enumerable: true, get: function() {
|
|
7407
7935
|
return liveBus_1.liveBusSocketPath;
|
|
7408
7936
|
} });
|
|
@@ -7561,48 +8089,48 @@ var require_out3 = __commonJS({
|
|
|
7561
8089
|
Object.defineProperty(exports, "scriptMarkerIn", { enumerable: true, get: function() {
|
|
7562
8090
|
return agentProcess_1.scriptMarkerIn;
|
|
7563
8091
|
} });
|
|
7564
|
-
var
|
|
8092
|
+
var http_2 = require_http();
|
|
7565
8093
|
Object.defineProperty(exports, "AscendaApiError", { enumerable: true, get: function() {
|
|
7566
|
-
return
|
|
8094
|
+
return http_2.AscendaApiError;
|
|
7567
8095
|
} });
|
|
7568
8096
|
Object.defineProperty(exports, "createPairingSession", { enumerable: true, get: function() {
|
|
7569
|
-
return
|
|
8097
|
+
return http_2.createPairingSession;
|
|
7570
8098
|
} });
|
|
7571
8099
|
Object.defineProperty(exports, "getPairingStatus", { enumerable: true, get: function() {
|
|
7572
|
-
return
|
|
8100
|
+
return http_2.getPairingStatus;
|
|
7573
8101
|
} });
|
|
7574
8102
|
Object.defineProperty(exports, "getStudyJoinStatus", { enumerable: true, get: function() {
|
|
7575
|
-
return
|
|
8103
|
+
return http_2.getStudyJoinStatus;
|
|
7576
8104
|
} });
|
|
7577
8105
|
Object.defineProperty(exports, "renewToolToken", { enumerable: true, get: function() {
|
|
7578
|
-
return
|
|
8106
|
+
return http_2.renewToolToken;
|
|
7579
8107
|
} });
|
|
7580
8108
|
Object.defineProperty(exports, "postToolEvent", { enumerable: true, get: function() {
|
|
7581
|
-
return
|
|
8109
|
+
return http_2.postToolEvent;
|
|
7582
8110
|
} });
|
|
7583
8111
|
Object.defineProperty(exports, "postToolEventsBatch", { enumerable: true, get: function() {
|
|
7584
|
-
return
|
|
8112
|
+
return http_2.postToolEventsBatch;
|
|
7585
8113
|
} });
|
|
7586
8114
|
Object.defineProperty(exports, "parseIngestResponse", { enumerable: true, get: function() {
|
|
7587
|
-
return
|
|
8115
|
+
return http_2.parseIngestResponse;
|
|
7588
8116
|
} });
|
|
7589
8117
|
Object.defineProperty(exports, "isRetryableStatus", { enumerable: true, get: function() {
|
|
7590
|
-
return
|
|
8118
|
+
return http_2.isRetryableStatus;
|
|
7591
8119
|
} });
|
|
7592
8120
|
Object.defineProperty(exports, "readInitiatives", { enumerable: true, get: function() {
|
|
7593
|
-
return
|
|
8121
|
+
return http_2.readInitiatives;
|
|
7594
8122
|
} });
|
|
7595
8123
|
Object.defineProperty(exports, "readStudyNotices", { enumerable: true, get: function() {
|
|
7596
|
-
return
|
|
8124
|
+
return http_2.readStudyNotices;
|
|
7597
8125
|
} });
|
|
7598
8126
|
Object.defineProperty(exports, "markStudyNoticeShown", { enumerable: true, get: function() {
|
|
7599
|
-
return
|
|
8127
|
+
return http_2.markStudyNoticeShown;
|
|
7600
8128
|
} });
|
|
7601
8129
|
Object.defineProperty(exports, "setStudyObjection", { enumerable: true, get: function() {
|
|
7602
|
-
return
|
|
8130
|
+
return http_2.setStudyObjection;
|
|
7603
8131
|
} });
|
|
7604
8132
|
Object.defineProperty(exports, "startStudyJoin", { enumerable: true, get: function() {
|
|
7605
|
-
return
|
|
8133
|
+
return http_2.startStudyJoin;
|
|
7606
8134
|
} });
|
|
7607
8135
|
var initiatives_1 = require_initiatives();
|
|
7608
8136
|
Object.defineProperty(exports, "INITIATIVE_COPY", { enumerable: true, get: function() {
|
|
@@ -7640,10 +8168,16 @@ var require_out3 = __commonJS({
|
|
|
7640
8168
|
Object.defineProperty(exports, "formatWindow", { enumerable: true, get: function() {
|
|
7641
8169
|
return studyJoin_1.formatWindow;
|
|
7642
8170
|
} });
|
|
8171
|
+
Object.defineProperty(exports, "gitOfferLine", { enumerable: true, get: function() {
|
|
8172
|
+
return studyJoin_1.gitOfferLine;
|
|
8173
|
+
} });
|
|
7643
8174
|
Object.defineProperty(exports, "runStudyJoin", { enumerable: true, get: function() {
|
|
7644
8175
|
return studyJoin_1.runStudyJoin;
|
|
7645
8176
|
} });
|
|
7646
8177
|
var confirmLinks_1 = require_confirmLinks();
|
|
8178
|
+
Object.defineProperty(exports, "WEEKLY_POSTER_CONNECT_URL", { enumerable: true, get: function() {
|
|
8179
|
+
return confirmLinks_1.WEEKLY_POSTER_CONNECT_URL;
|
|
8180
|
+
} });
|
|
7647
8181
|
Object.defineProperty(exports, "pairingConfirmLines", { enumerable: true, get: function() {
|
|
7648
8182
|
return confirmLinks_1.pairingConfirmLines;
|
|
7649
8183
|
} });
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"publishConfig": { "access": "public" },
|
|
3
3
|
"name": "@ascenda-one/github-collector",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.42",
|
|
5
5
|
"description": "Code-forge collaboration collector for Ascenda work telemetry — first-person review and pull-request signals.",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|