@tablation/crew 0.139.0 → 0.141.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js
CHANGED
|
@@ -8805,6 +8805,7 @@ function validateContract(c) {
|
|
|
8805
8805
|
return problems;
|
|
8806
8806
|
}
|
|
8807
8807
|
var EVENT_LOG_MISSING = "the Issues table has no event log \u2014 crew writes its audit trail there (CREW-1574). In the app, open the Issues table's Data & lifecycle tab and turn on Event log, then rerun.";
|
|
8808
|
+
var EVENT_LOG_STATUS_UNTRACKED = (column) => `the Issues table's event log does not track the "${column}" column, so who accepted a ticket cannot be known and a seat parks questions on the filer or operator instead. In the app, open the Issues table's Data & lifecycle tab and add "${column}" to the tracked fields.`;
|
|
8808
8809
|
var PERISCOPE_COLUMNS = [
|
|
8809
8810
|
"issue_id",
|
|
8810
8811
|
"ship_id",
|
|
@@ -8882,6 +8883,16 @@ var BeforeFirstEditTracker = class {
|
|
|
8882
8883
|
}
|
|
8883
8884
|
};
|
|
8884
8885
|
|
|
8886
|
+
// src/run-input.ts
|
|
8887
|
+
var live = /* @__PURE__ */ new Map();
|
|
8888
|
+
var registerRunInput = (run4, input) => {
|
|
8889
|
+
live.set(run4, input);
|
|
8890
|
+
};
|
|
8891
|
+
var unregisterRunInput = (run4) => {
|
|
8892
|
+
live.delete(run4);
|
|
8893
|
+
};
|
|
8894
|
+
var runInputFor = (run4) => live.get(run4);
|
|
8895
|
+
|
|
8885
8896
|
// src/agent-log.ts
|
|
8886
8897
|
import { existsSync as existsSync25, mkdirSync as mkdirSync18, readdirSync as readdirSync8, readFileSync as readFileSync25, rmSync as rmSync14, writeFileSync as writeFileSync19 } from "fs";
|
|
8887
8898
|
import { join as join27 } from "path";
|
|
@@ -9625,6 +9636,68 @@ var Tracker = class {
|
|
|
9625
9636
|
}
|
|
9626
9637
|
return rows.filter((e) => e.event_type === type).sort((a, b) => Date.parse(b.occurred_at ?? b.created_at ?? "") - Date.parse(a.occurred_at ?? a.created_at ?? ""));
|
|
9627
9638
|
}
|
|
9639
|
+
/**
|
|
9640
|
+
* Every status change in the log, newest first (CREW-3144): who moved which
|
|
9641
|
+
* ticket to which status. One table-wide read per poll rather than one per
|
|
9642
|
+
* ticket; a change older than the window reads as unknown. Degrades like
|
|
9643
|
+
* `events()`: a missing log, a 5xx or a non-JSON reply is an empty list.
|
|
9644
|
+
*/
|
|
9645
|
+
async statusChanges(limit = 1e3) {
|
|
9646
|
+
const filters = encodeURIComponent(JSON.stringify([
|
|
9647
|
+
{ columnName: "event_type", operator: "EQ", value: "field_changed" },
|
|
9648
|
+
{ columnName: "field", operator: "EQ", value: this.contract.columns.status }
|
|
9649
|
+
]));
|
|
9650
|
+
let rows;
|
|
9651
|
+
try {
|
|
9652
|
+
const res = await this.eventsFetch("GET", `/events?limit=${limit}&filters=${filters}`);
|
|
9653
|
+
if (res.status === 404) return [];
|
|
9654
|
+
if (!res.ok) throw new Error(`HTTP ${res.status}`);
|
|
9655
|
+
rows = await res.json();
|
|
9656
|
+
if (!Array.isArray(rows)) throw new Error("not a list");
|
|
9657
|
+
} catch (err3) {
|
|
9658
|
+
this.onReadFailure?.(`reading status changes failed: ${err3 instanceof Error ? err3.message : String(err3)}`);
|
|
9659
|
+
return [];
|
|
9660
|
+
}
|
|
9661
|
+
const str = (v) => typeof v === "string" && v ? v : null;
|
|
9662
|
+
const out = [];
|
|
9663
|
+
for (const r of rows) {
|
|
9664
|
+
if (r.event_type !== "field_changed" || r.field !== this.contract.columns.status) continue;
|
|
9665
|
+
const meta = r.metadata && typeof r.metadata === "object" ? r.metadata : {};
|
|
9666
|
+
const to = str(meta.to) ?? str(r.to_value);
|
|
9667
|
+
const at = str(r.occurred_at) ?? str(r.created_at);
|
|
9668
|
+
const record = str(r.record_id);
|
|
9669
|
+
if (!to || !at || !record) continue;
|
|
9670
|
+
out.push({
|
|
9671
|
+
record_id: record,
|
|
9672
|
+
to,
|
|
9673
|
+
occurred_at: at,
|
|
9674
|
+
actor_kind: str(r.actor_kind),
|
|
9675
|
+
actor_id: str(r.actor_id),
|
|
9676
|
+
actor_name: str(r.actor_name),
|
|
9677
|
+
actor_record_id: str(r.actor_record_id)
|
|
9678
|
+
});
|
|
9679
|
+
}
|
|
9680
|
+
return out.sort((a, b) => Date.parse(b.occurred_at) - Date.parse(a.occurred_at));
|
|
9681
|
+
}
|
|
9682
|
+
/**
|
|
9683
|
+
* Whether the event log tracks the status column (CREW-3144). Without it the
|
|
9684
|
+
* acceptor of a ticket is unknowable. `null` when the answer cannot be read
|
|
9685
|
+
* (no log, the table unreachable, a table that does not say): not a finding.
|
|
9686
|
+
*/
|
|
9687
|
+
async eventLogTracksStatus() {
|
|
9688
|
+
try {
|
|
9689
|
+
const res = await fetch(`${this.route.baseUrl}/api/data-models/${this.models.issues}`, {
|
|
9690
|
+
headers: { Authorization: `Bearer ${resolveApiKey(this.route)}`, "User-Agent": this.userAgent }
|
|
9691
|
+
});
|
|
9692
|
+
if (!res.ok) return null;
|
|
9693
|
+
const model = await res.json();
|
|
9694
|
+
if (model.eventLogEnabled !== true) return null;
|
|
9695
|
+
const tracked2 = model.eventLogConfig?.trackedFields;
|
|
9696
|
+
return Array.isArray(tracked2) ? tracked2.includes(this.contract.columns.status) : null;
|
|
9697
|
+
} catch {
|
|
9698
|
+
return null;
|
|
9699
|
+
}
|
|
9700
|
+
}
|
|
9628
9701
|
/** The newest event of `type` on a ticket, or undefined — e.g. the `pushed` tip QA verifies against. */
|
|
9629
9702
|
async latestEvent(ticketId, type) {
|
|
9630
9703
|
return (await this.events(type)).find((e) => e.record_id === ticketId);
|
|
@@ -11029,6 +11102,9 @@ async function markMessage(target, rowId, messageId, state) {
|
|
|
11029
11102
|
return false;
|
|
11030
11103
|
}
|
|
11031
11104
|
}
|
|
11105
|
+
async function postMessage(target, rowId, text2) {
|
|
11106
|
+
return post(target, `/agents/log/${rowId}/messages`, { text: text2 });
|
|
11107
|
+
}
|
|
11032
11108
|
async function fetchPendingMessages(target, workItem) {
|
|
11033
11109
|
try {
|
|
11034
11110
|
const res = await request(
|
|
@@ -13989,7 +14065,8 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
13989
14065
|
agentLog: id.agentLog,
|
|
13990
14066
|
promptVersion: plan.promptVersion,
|
|
13991
14067
|
promptSha: plan.promptSha,
|
|
13992
|
-
...plan.workspaceRunId ? { workspaceRunId: plan.workspaceRunId } : {}
|
|
14068
|
+
...plan.workspaceRunId ? { workspaceRunId: plan.workspaceRunId } : {},
|
|
14069
|
+
...streamsInput(plan) && !promptDelivered && adapter.userMessageLine ? { acceptsInput: true } : {}
|
|
13993
14070
|
};
|
|
13994
14071
|
try {
|
|
13995
14072
|
writeFileSync22(pidPathFor(plan.streamPath), JSON.stringify(sidecar));
|
|
@@ -14001,9 +14078,11 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
14001
14078
|
const closeInput = () => {
|
|
14002
14079
|
if (!inputOpen) return;
|
|
14003
14080
|
inputOpen = false;
|
|
14081
|
+
updateSidecar(plan.streamPath, { acceptsInput: false });
|
|
14004
14082
|
child.stdin?.end();
|
|
14005
14083
|
};
|
|
14006
14084
|
if (inputOpen) obs.onResult = closeInput;
|
|
14085
|
+
const handled2 = /* @__PURE__ */ new Set();
|
|
14007
14086
|
const writeNote = (text2) => new Promise((done) => {
|
|
14008
14087
|
const stdin = child.stdin;
|
|
14009
14088
|
if (!inputOpen || !stdin || !stdin.writable) {
|
|
@@ -14016,6 +14095,22 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
14016
14095
|
done(false);
|
|
14017
14096
|
}
|
|
14018
14097
|
});
|
|
14098
|
+
const runName = basename9(plan.streamPath).replace(/\.jsonl$/, "");
|
|
14099
|
+
if (inputOpen) {
|
|
14100
|
+
registerRunInput(runName, {
|
|
14101
|
+
accepts: () => inputOpen,
|
|
14102
|
+
agentLogRowId: () => id.agentLogRowId,
|
|
14103
|
+
...plan.agentLog ? { target: plan.agentLog } : {},
|
|
14104
|
+
deliver: async (note, author2) => {
|
|
14105
|
+
if (handled2.has(note.id)) return "delivered";
|
|
14106
|
+
handled2.add(note.id);
|
|
14107
|
+
const landed = await writeNote(frameNote(note, author2));
|
|
14108
|
+
const rowId = id.agentLogRowId;
|
|
14109
|
+
if (plan.agentLog && rowId) await markMessage(plan.agentLog, rowId, note.id, landed ? "delivered" : "carried_forward");
|
|
14110
|
+
return landed ? "delivered" : "carried_forward";
|
|
14111
|
+
}
|
|
14112
|
+
});
|
|
14113
|
+
}
|
|
14019
14114
|
const startedRow = plan.agentLog ? startAgentRunRow(plan.agentLog, {
|
|
14020
14115
|
runId: plan.workspaceRunId,
|
|
14021
14116
|
ticketReference: plan.ticket ?? void 0,
|
|
@@ -14033,7 +14128,11 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
14033
14128
|
if (row.live && plan.agentLog) {
|
|
14034
14129
|
const reporter = new LiveRunReporter(plan.agentLog, row.id, {
|
|
14035
14130
|
onPosted: (n) => updateSidecar(plan.streamPath, { cyclesPosted: n }),
|
|
14036
|
-
onMessages: (msgs) =>
|
|
14131
|
+
onMessages: (msgs) => {
|
|
14132
|
+
const fresh = msgs.filter((m) => !handled2.has(m.id));
|
|
14133
|
+
for (const m of fresh) handled2.add(m.id);
|
|
14134
|
+
return deliverNotes(plan.agentLog, row.id, fresh, writeNote);
|
|
14135
|
+
}
|
|
14037
14136
|
});
|
|
14038
14137
|
obs.attachReporter(reporter);
|
|
14039
14138
|
reporter.start();
|
|
@@ -14053,6 +14152,7 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
14053
14152
|
let spawnFailed = false;
|
|
14054
14153
|
child.on("error", (err3) => {
|
|
14055
14154
|
spawnFailed = true;
|
|
14155
|
+
unregisterRunInput(runName);
|
|
14056
14156
|
clearInterval(timer);
|
|
14057
14157
|
clearTimeout(limitTimer);
|
|
14058
14158
|
void runner.release(handle, emit);
|
|
@@ -14060,6 +14160,7 @@ function spawnPlanned(plan, emit, hintMoved) {
|
|
|
14060
14160
|
});
|
|
14061
14161
|
child.on("close", async (code) => {
|
|
14062
14162
|
inputOpen = false;
|
|
14163
|
+
unregisterRunInput(runName);
|
|
14063
14164
|
clearInterval(timer);
|
|
14064
14165
|
clearTimeout(limitTimer);
|
|
14065
14166
|
obs.feed(tail3.poll());
|
|
@@ -14293,6 +14394,14 @@ async function settleRunEnd(o) {
|
|
|
14293
14394
|
emit.warn(`could not beat ship idle: ${e.message}`, { step: "agent" });
|
|
14294
14395
|
}
|
|
14295
14396
|
}
|
|
14397
|
+
function pidAlive2(pid) {
|
|
14398
|
+
try {
|
|
14399
|
+
process.kill(pid, 0);
|
|
14400
|
+
return true;
|
|
14401
|
+
} catch (e) {
|
|
14402
|
+
return e.code === "EPERM";
|
|
14403
|
+
}
|
|
14404
|
+
}
|
|
14296
14405
|
function describeRun(run4, route2, seatIds, worktreeOf = (d, n) => {
|
|
14297
14406
|
try {
|
|
14298
14407
|
return worktreeForNumber(d, n)?.path ?? null;
|
|
@@ -14313,7 +14422,10 @@ function describeRun(run4, route2, seatIds, worktreeOf = (d, n) => {
|
|
|
14313
14422
|
stream: run4.streamPath,
|
|
14314
14423
|
pid: run4.pid,
|
|
14315
14424
|
startedAt: run4.spawnedAt,
|
|
14316
|
-
deadline: run4.deadline ?? null
|
|
14425
|
+
deadline: run4.deadline ?? null,
|
|
14426
|
+
// CREW-3119: the harness still reads notes, and the process holding its stdin is alive.
|
|
14427
|
+
acceptsInput: !!run4.acceptsInput && pidAlive2(run4.ownerPid),
|
|
14428
|
+
agentLogId: run4.agentLogRowId ?? null
|
|
14317
14429
|
};
|
|
14318
14430
|
}
|
|
14319
14431
|
|
|
@@ -15592,6 +15704,9 @@ function isHold(roster, id) {
|
|
|
15592
15704
|
function holdIds(roster) {
|
|
15593
15705
|
return [...roster.values()].filter((m) => m.kind === "hold").map((m) => m.id);
|
|
15594
15706
|
}
|
|
15707
|
+
function operatorOf(roster) {
|
|
15708
|
+
return [...roster.values()].find((m) => m.kind === "hold" && m.role.toLowerCase() === "operator");
|
|
15709
|
+
}
|
|
15595
15710
|
function seats(roster) {
|
|
15596
15711
|
return [...roster.values()].filter((m) => m.kind === "seat");
|
|
15597
15712
|
}
|
|
@@ -15646,11 +15761,18 @@ function rosterMarkdown(roster, meId) {
|
|
|
15646
15761
|
for (const m of holds(roster).sort(byRole)) {
|
|
15647
15762
|
lines2.push(`| ${m.role ? m.role.toLowerCase() : "\u2014"} | ${crewLabel(m)} | \`${m.id}\` |`);
|
|
15648
15763
|
}
|
|
15764
|
+
const operator = operatorOf(roster);
|
|
15649
15765
|
lines2.push(
|
|
15650
15766
|
"",
|
|
15651
|
-
|
|
15652
|
-
|
|
15653
|
-
|
|
15767
|
+
...operator ? [
|
|
15768
|
+
`The **operator** (${operator.name}) is this ship's owner: the machine, the dev stack and the`,
|
|
15769
|
+
"credentials the steps below refer to are theirs, and, like any hold, they can authorize a",
|
|
15770
|
+
"workspace change. They do not decide a ticket for you: a ticket's decisions belong to whoever",
|
|
15771
|
+
"accepted it (the digest's `accepted by` and `park to` columns say who)."
|
|
15772
|
+
] : [
|
|
15773
|
+
"This ship has no operator hold. A ticket's decisions belong to whoever accepted it (the digest's",
|
|
15774
|
+
"`accepted by` and `park to` columns say who); only a hold can authorize a workspace change."
|
|
15775
|
+
],
|
|
15654
15776
|
"",
|
|
15655
15777
|
"When the queue digest names a comment's author, that name comes from the",
|
|
15656
15778
|
"server-stamped identity on the comment row joined to this roster (a hold's",
|
|
@@ -15659,7 +15781,7 @@ function rosterMarkdown(roster, meId) {
|
|
|
15659
15781
|
'is theirs; one it marks "(no identity)" is from nobody this roster knows.',
|
|
15660
15782
|
'A comment attributed to a named person marked "(person)" is from a real',
|
|
15661
15783
|
"workspace member linked to a Crew row on another ship \u2014 their answer to a",
|
|
15662
|
-
"question counts the same, though only a hold
|
|
15784
|
+
"question counts the same, though only a hold can authorize",
|
|
15663
15785
|
"a workspace change.",
|
|
15664
15786
|
""
|
|
15665
15787
|
);
|
|
@@ -17781,6 +17903,38 @@ function filedBy(t, i) {
|
|
|
17781
17903
|
}
|
|
17782
17904
|
return t.reporter_name ? `${t.reporter_name} (unverified)` : "\u2014";
|
|
17783
17905
|
}
|
|
17906
|
+
var labelOf = (m, i) => m.id === i.me ? "you" : crewLabel(m) ?? m.name;
|
|
17907
|
+
function acceptor(t, i) {
|
|
17908
|
+
const approved = i.approvedStatus ?? "accepted";
|
|
17909
|
+
const change = (i.statusChanges ?? []).find((c) => c.record_id === t.id && c.to === approved && c.actor_kind === "user");
|
|
17910
|
+
if (!change) return void 0;
|
|
17911
|
+
const member = (change.actor_record_id ? i.roster.get(change.actor_record_id) : void 0) ?? memberByIdentity(i.roster, change.actor_id);
|
|
17912
|
+
if (member) return { member };
|
|
17913
|
+
return change.actor_name ? { name: change.actor_name } : void 0;
|
|
17914
|
+
}
|
|
17915
|
+
function acceptedBy(t, i) {
|
|
17916
|
+
const a = acceptor(t, i);
|
|
17917
|
+
if (!a) return "\u2014";
|
|
17918
|
+
return a.member ? labelOf(a.member, i) : `${a.name} (unverified)`;
|
|
17919
|
+
}
|
|
17920
|
+
function parkTarget(t, i) {
|
|
17921
|
+
const person = (m) => m && (m.kind === "hold" || m.kind === "person") ? m : void 0;
|
|
17922
|
+
const a = acceptor(t, i);
|
|
17923
|
+
const unverified = a && !a.member ? a.name : void 0;
|
|
17924
|
+
const byAcceptor = person(a?.member);
|
|
17925
|
+
if (byAcceptor) return { step: "acceptor", member: byAcceptor };
|
|
17926
|
+
const filer = person((t.filed_by_id ? i.roster.get(t.filed_by_id) : void 0) ?? memberByIdentity(i.roster, t.created_by_id));
|
|
17927
|
+
if (filer) return { step: "filer", member: filer, ...unverified ? { unverified } : {} };
|
|
17928
|
+
const op = operatorOf(i.roster);
|
|
17929
|
+
if (op) return { step: "operator", member: op, ...unverified ? { unverified } : {} };
|
|
17930
|
+
return { step: "none", ...unverified ? { unverified } : {} };
|
|
17931
|
+
}
|
|
17932
|
+
function parkTo(t, i) {
|
|
17933
|
+
const p = parkTarget(t, i);
|
|
17934
|
+
const note = p.unverified ? `; ${p.unverified} accepted it (unverified, no Crew row)` : "";
|
|
17935
|
+
if (!p.member) return `nobody by name \u2014 leave unassigned, no personal address${note}`;
|
|
17936
|
+
return `${p.member.name} \`${p.member.id}\` (${p.step})${note}`;
|
|
17937
|
+
}
|
|
17784
17938
|
function lastComment(i, ticketId) {
|
|
17785
17939
|
const forTicket = i.comments.filter((c) => c.ticket_id === ticketId).sort((a, b) => a.created_at < b.created_at ? -1 : a.created_at > b.created_at ? 1 : 0);
|
|
17786
17940
|
const last = forTicket[forTicket.length - 1];
|
|
@@ -17851,14 +18005,14 @@ ${sorted(ts).map(row).join("\n")}
|
|
|
17851
18005
|
`;
|
|
17852
18006
|
}
|
|
17853
18007
|
function buildingDigest(i) {
|
|
17854
|
-
const header = "| ticket | repo | branch | worktree | mode | status | assignee | filed by | sev | pri | eff | updated | last comment | runner direction | new since last poll |\n
|
|
18008
|
+
const header = "| ticket | repo | branch | worktree | mode | status | assignee | filed by | accepted by | park to | sev | pri | eff | updated | last comment | runner direction | new since last poll |\n|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|";
|
|
17855
18009
|
const row = (t) => {
|
|
17856
18010
|
const n = newFromOthers(i, t.id);
|
|
17857
18011
|
const branch = i.branchFor ? i.branchFor(t) : "";
|
|
17858
18012
|
const worktree = i.worktreeFor ? i.worktreeFor(t) : "";
|
|
17859
18013
|
const dir = i.dirFor ? i.dirFor(t) : null;
|
|
17860
18014
|
const repo = i.dirFor ? dir ?? "**NO CHECKOUT**" : "";
|
|
17861
|
-
return `| ${displayKey2(t)} | ${repo} | ${branch} | ${worktree} | ${modeCell(t, i)} | ${t.status} | ${who(t, i)} | ${filedBy(t, i)} | ${t.severity ?? "\u2014"} | ${t.priority ?? "\u2014"} | ${effCell(t)} | ${t.updated_at.slice(0, 16)}Z | ${lastComment(i, t.id)} | ${directionCell(i, t.id)} | ${n > 0 ? `**${n} new**` : "\u2014"} |`;
|
|
18015
|
+
return `| ${displayKey2(t)} | ${repo} | ${branch} | ${worktree} | ${modeCell(t, i)} | ${t.status} | ${who(t, i)} | ${filedBy(t, i)} | ${acceptedBy(t, i)} | ${parkTo(t, i)} | ${t.severity ?? "\u2014"} | ${t.priority ?? "\u2014"} | ${effCell(t)} | ${t.updated_at.slice(0, 16)}Z | ${lastComment(i, t.id)} | ${directionCell(i, t.id)} | ${n > 0 ? `**${n} new**` : "\u2014"} |`;
|
|
17862
18016
|
};
|
|
17863
18017
|
const blockedRow = (t) => `| ${displayKey2(t)} | ${t.status} | ${who(t, i)} | p${effectivePriority(t)} | ${blockers(t, i)} |`;
|
|
17864
18018
|
const blockedTable = (ts) => ts.length === 0 ? "\n_None._\n" : `
|
|
@@ -17902,6 +18056,7 @@ ${p.finalText.split("\n").map((l) => `> ${l}`).join("\n")}
|
|
|
17902
18056
|
"## Current queue \u2014 built for you by the poll\n",
|
|
17903
18057
|
"\nAlready filtered to your lane, and already ordered by the Step 2 rule.\nTicket bodies are deliberately omitted: fetch the full record of only the\nticket you actually pick up. **Do not re-fetch the whole tracker.** This\ndigest comes from the same API call the poll just made, moments ago.\n",
|
|
17904
18058
|
'\n"new since last poll" counts comments from someone other than you since\nthe poll watermark \u2014 the same signal that woke this run.\n',
|
|
18059
|
+
'\n"accepted by" is the person who last moved the ticket into accepted, read from the event log (a lane, workflow or the system promoting it does not count); an identity with no Crew row shows the logged name marked unverified. "park to" is where YOU send a question on that ticket: the Crew row to write to `assignee_id` and address by name, or "nobody by name" to leave it unassigned at `needs_info` with no personal address.\n',
|
|
17905
18060
|
'\n"runner direction" is the newest instruction the crew itself posted to the\nevent log (not Comments) that no push has answered yet: `conflict_handed_back`\n(merge the base into the branch and resolve), `requeued`, `bounced`,\n`conflict_escalated`, `interrupted` (an earlier run on this seat was cut short; its\nuncommitted worktree is yours, resume it), `build_failed` (the release gate found the branch builds alone but\nnot merged with the current base: merge the base in, fix, push, hand back to QA; the output is quoted). It is\ndirection, same as a comment from a hold: act on it. `gate_red` is status only: the ticket is merged and the\ngate is red, so there is nothing to build on the branch.\n',
|
|
17906
18061
|
"\n**`repo` is the checkout a ticket's work happens in** \u2014 an area spans\nseveral repositories, so cut the worktree beside THAT directory, not beside\nwhichever one you started in. A ticket marked **NO CHECKOUT** is not yours:\nthis ship has no clone of its repository, and another ship may serve it.\n\n**Use the `branch` and `worktree` columns verbatim.** They are that\nrepository's own naming convention, rendered for THIS ticket \u2014 cut the\nworktree at `<repo>/../<worktree>`, on branch `<branch>`. Do not derive\neither yourself, and prefer these over the Environment section's own worked\nexample if the two ever disagree \u2014 that example is illustrative only,\nrendered before any ticket is picked.\n",
|
|
17907
18062
|
...i.workModes && [...i.workModes.modes.values()].some((m) => m !== "automatic") ? ["\n**Manual / hybrid projects.** Some projects on this board are not fully automatic. In a `manual` project no lane touches any ticket, and a ticket with no project is treated the same way, so none appear below. In a `hybrid` project a ticket appears below only when it is assigned to an agent. An `accepted` ticket that is absent for either reason is not yours to claim \u2014 do not go looking for it.\n"] : [],
|
|
@@ -18277,6 +18432,7 @@ async function decideCycle(o) {
|
|
|
18277
18432
|
tracker.events("stalled")
|
|
18278
18433
|
]);
|
|
18279
18434
|
const directionEvents = (await Promise.all([...DIRECTION_EVENT_TYPES, ...STATUS_EVENT_TYPES, "pushed"].map((t) => tracker.events(t)))).flat();
|
|
18435
|
+
const statusChanges = await tracker.statusChanges();
|
|
18280
18436
|
emit.emit(`${tickets.length} open ticket(s), ${comments.length} comment(s)`, {
|
|
18281
18437
|
data: { tickets: tickets.length, comments: comments.length }
|
|
18282
18438
|
});
|
|
@@ -18441,6 +18597,7 @@ async function decideCycle(o) {
|
|
|
18441
18597
|
actionable,
|
|
18442
18598
|
watermark,
|
|
18443
18599
|
directionEvents,
|
|
18600
|
+
statusChanges,
|
|
18444
18601
|
selectionInput,
|
|
18445
18602
|
attention: attentionCurrent,
|
|
18446
18603
|
unroutable
|
|
@@ -18536,6 +18693,8 @@ function writeDigest(o, d, role, stateDir, runId, own) {
|
|
|
18536
18693
|
myShipId: d.ships.find((s) => (s.name ?? "").trim() === o.ship.name.trim())?.id ?? null,
|
|
18537
18694
|
watermark: d.watermark,
|
|
18538
18695
|
events: d.directionEvents,
|
|
18696
|
+
statusChanges: d.statusChanges,
|
|
18697
|
+
approvedStatus: d.selectionInput.contract?.statuses.approved,
|
|
18539
18698
|
previousRun: (t) => {
|
|
18540
18699
|
const r = pendingHandoffFor(stateDir, t.id);
|
|
18541
18700
|
return r?.finalText ? { finalText: r.finalText.slice(0, 2e3), at: r.createdAt } : null;
|
|
@@ -20126,11 +20285,11 @@ async function confirmExternalReleased(o, closures) {
|
|
|
20126
20285
|
}
|
|
20127
20286
|
const { timeoutSeconds, intervalSeconds } = o.repo.release.verify;
|
|
20128
20287
|
const deadline = Date.now() + timeoutSeconds * 1e3;
|
|
20129
|
-
let
|
|
20288
|
+
let live2 = "";
|
|
20130
20289
|
for (; ; ) {
|
|
20131
20290
|
const r = await hook(o, "released");
|
|
20132
|
-
|
|
20133
|
-
if (
|
|
20291
|
+
live2 = r?.output.trim().split("\n").filter(Boolean).pop() ?? "";
|
|
20292
|
+
if (live2) break;
|
|
20134
20293
|
if (Date.now() >= deadline) {
|
|
20135
20294
|
o.emit.warn(`not confirmed within ${timeoutSeconds}s \u2014 the released hook reported nothing`);
|
|
20136
20295
|
return closures;
|
|
@@ -20139,13 +20298,13 @@ async function confirmExternalReleased(o, closures) {
|
|
|
20139
20298
|
}
|
|
20140
20299
|
return closures.map((c) => {
|
|
20141
20300
|
if (c.closure.state !== "merged" || !c.closure.mergedAt) return c;
|
|
20142
|
-
const confirmed = isAncestor(o.cwd, c.closure.mergedAt,
|
|
20301
|
+
const confirmed = isAncestor(o.cwd, c.closure.mergedAt, live2);
|
|
20143
20302
|
if (!confirmed) {
|
|
20144
|
-
o.emit.emit(`not yet carried by ${
|
|
20303
|
+
o.emit.emit(`not yet carried by ${live2.slice(0, 12)}`, { ticket: c.ticket.issue_id });
|
|
20145
20304
|
return { ...c, confirmed };
|
|
20146
20305
|
}
|
|
20147
20306
|
const version = o.repo.release.versioning === "none" || !o.repo.release.versionFiles[0] ? void 0 : (() => {
|
|
20148
|
-
const content = fileAtRef(o.cwd,
|
|
20307
|
+
const content = fileAtRef(o.cwd, live2, o.repo.release.versionFiles[0]);
|
|
20149
20308
|
if (!content) return void 0;
|
|
20150
20309
|
try {
|
|
20151
20310
|
return JSON.parse(content).version;
|
|
@@ -20153,7 +20312,7 @@ async function confirmExternalReleased(o, closures) {
|
|
|
20153
20312
|
return void 0;
|
|
20154
20313
|
}
|
|
20155
20314
|
})();
|
|
20156
|
-
o.emit.emit(`confirmed shipped in ${
|
|
20315
|
+
o.emit.emit(`confirmed shipped in ${live2.slice(0, 12)}`, { ticket: c.ticket.issue_id, data: { version } });
|
|
20157
20316
|
return { ...c, confirmed, version };
|
|
20158
20317
|
});
|
|
20159
20318
|
}
|
|
@@ -20308,14 +20467,14 @@ async function confirm(o, expected) {
|
|
|
20308
20467
|
const deadline = Date.now() + timeoutSeconds * 1e3;
|
|
20309
20468
|
for (; ; ) {
|
|
20310
20469
|
const r = await hook(o, "released");
|
|
20311
|
-
const
|
|
20312
|
-
const hit = match === "commit" ?
|
|
20313
|
-
if (
|
|
20314
|
-
o.emit.emit(`confirmed live: ${
|
|
20470
|
+
const live2 = r?.output.trim().split("\n").filter(Boolean).pop() ?? "";
|
|
20471
|
+
const hit = match === "commit" ? live2.startsWith(expected.slice(0, 7)) || expected.startsWith(live2.slice(0, 7)) : live2 === expected;
|
|
20472
|
+
if (live2 && hit) {
|
|
20473
|
+
o.emit.emit(`confirmed live: ${live2.slice(0, 12)}`);
|
|
20315
20474
|
return true;
|
|
20316
20475
|
}
|
|
20317
20476
|
if (Date.now() >= deadline) {
|
|
20318
|
-
o.emit.warn(`not confirmed within ${timeoutSeconds}s \u2014 target reports ${
|
|
20477
|
+
o.emit.warn(`not confirmed within ${timeoutSeconds}s \u2014 target reports ${live2 || "nothing"}`);
|
|
20319
20478
|
return false;
|
|
20320
20479
|
}
|
|
20321
20480
|
await new Promise((r2) => setTimeout(r2, intervalSeconds * 1e3));
|
|
@@ -21753,9 +21912,9 @@ var PeriscopeError = class extends Error {
|
|
|
21753
21912
|
};
|
|
21754
21913
|
var LivePeriscopeError = class extends PeriscopeError {
|
|
21755
21914
|
data;
|
|
21756
|
-
constructor(tag, number,
|
|
21757
|
-
super(`${tag} already has a live periscope on ${
|
|
21758
|
-
this.data = { refused: "live_periscope_exists", ...
|
|
21915
|
+
constructor(tag, number, live2) {
|
|
21916
|
+
super(`${tag} already has a live periscope on ${live2.ship}: ${live2.url} (worktree ${live2.worktree}) \u2014 run \`crew periscope down ${number} --keep|--discard\` on ${live2.ship}, or resume it there with \`crew periscope up --resume ${number}\``);
|
|
21917
|
+
this.data = { refused: "live_periscope_exists", ...live2 };
|
|
21759
21918
|
}
|
|
21760
21919
|
};
|
|
21761
21920
|
var priorDir = (stateDir) => join49(stateDir, "periscope-priors");
|
|
@@ -21827,8 +21986,8 @@ function periscopeCaps(l) {
|
|
|
21827
21986
|
};
|
|
21828
21987
|
}
|
|
21829
21988
|
async function assertNoLivePeriscope(e, t, number) {
|
|
21830
|
-
const
|
|
21831
|
-
if (
|
|
21989
|
+
const live2 = (await e.liveRows(t.id))[0];
|
|
21990
|
+
if (live2) throw new LivePeriscopeError(t.tag, number, live2);
|
|
21832
21991
|
}
|
|
21833
21992
|
async function existingRefusal(e, t) {
|
|
21834
21993
|
if (t.closed) return `${t.tag} is ${t.status}; a closed ticket cannot be periscoped`;
|
|
@@ -21877,9 +22036,9 @@ async function periscopePreflight(d, repo) {
|
|
|
21877
22036
|
if (!d.hasPeriscopesTable) {
|
|
21878
22037
|
throw new PeriscopeError("this workspace has no Periscopes table \u2014 update the Issues template and run `crew connect`");
|
|
21879
22038
|
}
|
|
21880
|
-
const
|
|
21881
|
-
if (
|
|
21882
|
-
throw new PeriscopeError(`this ship already hosts ${
|
|
22039
|
+
const live2 = await d.liveCount();
|
|
22040
|
+
if (live2 >= d.caps.max) {
|
|
22041
|
+
throw new PeriscopeError(`this ship already hosts ${live2} live periscope(s) (ship.maxPeriscopes is ${d.caps.max}) \u2014 discard one first`);
|
|
21883
22042
|
}
|
|
21884
22043
|
}
|
|
21885
22044
|
async function runPeriscopeUp(d, args) {
|
|
@@ -22619,23 +22778,23 @@ async function runFleetPass(o) {
|
|
|
22619
22778
|
decide: (c) => decide({ ...ctxs.get(c.route.route), emit: c.emit })
|
|
22620
22779
|
});
|
|
22621
22780
|
if (fleet.entries.length && fleet.entries.every((e) => e.error)) throw new Error(fleet.entries[0].error);
|
|
22622
|
-
const
|
|
22781
|
+
const live2 = [];
|
|
22623
22782
|
for (const e of fleet.entries) {
|
|
22624
22783
|
const ctx = ctxs.get(e.route.route);
|
|
22625
22784
|
if (e.error || !e.decision) continue;
|
|
22626
22785
|
await applyRouteDecision(perRoute(e.route), ctx, e.decision);
|
|
22627
|
-
|
|
22786
|
+
live2.push({ ctx, decision: e.decision, roles: e.decision.selection.pending });
|
|
22628
22787
|
}
|
|
22629
|
-
await Promise.all(
|
|
22788
|
+
await Promise.all(live2.map(async ({ ctx }) => {
|
|
22630
22789
|
try {
|
|
22631
22790
|
await new Tracker(ctx.route, o.ship).beatShip(o.ship.name);
|
|
22632
22791
|
} catch (e) {
|
|
22633
22792
|
ctx.emit.warn(`could not beat ship for ${ctx.route.route}: ${e.message}`, { step: "poll" });
|
|
22634
22793
|
}
|
|
22635
22794
|
}));
|
|
22636
|
-
const { started, skipped } = await fillSlots(o,
|
|
22637
|
-
for (const { ctx } of
|
|
22638
|
-
return { pending: [...new Set(
|
|
22795
|
+
const { started, skipped } = await fillSlots(o, live2, fleet.winner && { route: fleet.winner.route.route, role: fleet.winner.role });
|
|
22796
|
+
for (const { ctx } of live2) await publishShipAttention(o.state, ctx.route, o.ship);
|
|
22797
|
+
return { pending: [...new Set(live2.flatMap((l) => l.roles))], started, skipped };
|
|
22639
22798
|
} catch (e) {
|
|
22640
22799
|
if (!isUpgradeRequired(e)) throw e;
|
|
22641
22800
|
const route2 = routes[0];
|
|
@@ -22654,10 +22813,10 @@ async function fillSlots(o, routes, first) {
|
|
|
22654
22813
|
const started = [];
|
|
22655
22814
|
const skipped = [];
|
|
22656
22815
|
const roleCap = (role) => TICKET_ROLES.has(role) ? o.roleConcurrency?.[role] ?? 1 : 1;
|
|
22657
|
-
const
|
|
22658
|
-
while (
|
|
22816
|
+
const live2 = new Map(order.map((c) => [c, 0]));
|
|
22817
|
+
while (live2.size) {
|
|
22659
22818
|
for (const cand of order) {
|
|
22660
|
-
const count =
|
|
22819
|
+
const count = live2.get(cand);
|
|
22661
22820
|
if (count === void 0) continue;
|
|
22662
22821
|
const { role, ctx, decision } = cand;
|
|
22663
22822
|
const skip = (reason) => {
|
|
@@ -22666,20 +22825,20 @@ async function fillSlots(o, routes, first) {
|
|
|
22666
22825
|
if (openShipAttention(state).some((i) => i.key === seatCannotWriteKey(role))) {
|
|
22667
22826
|
if (await (o.seatWriteRefused ?? ((r) => seatWriteStillRefused(ctx.route, r, { userAgent: o.ship.userAgent })))(role)) {
|
|
22668
22827
|
skip("seat role cannot write the hand-off fields \u2014 see attention");
|
|
22669
|
-
|
|
22828
|
+
live2.delete(cand);
|
|
22670
22829
|
continue;
|
|
22671
22830
|
}
|
|
22672
22831
|
clearShipAttention(state, seatCannotWriteKey(role));
|
|
22673
22832
|
}
|
|
22674
22833
|
if (!breaker.allows(role)) {
|
|
22675
22834
|
skip("agent recently failed to start \u2014 waiting before retry");
|
|
22676
|
-
|
|
22835
|
+
live2.delete(cand);
|
|
22677
22836
|
continue;
|
|
22678
22837
|
}
|
|
22679
22838
|
const lock = state.acquireRun(role, o.maxConcurrentAgents, roleCap(role));
|
|
22680
22839
|
if (!lock.ok) {
|
|
22681
22840
|
skip(lock.reason);
|
|
22682
|
-
|
|
22841
|
+
live2.delete(cand);
|
|
22683
22842
|
continue;
|
|
22684
22843
|
}
|
|
22685
22844
|
let settle = () => {
|
|
@@ -22750,11 +22909,11 @@ async function fillSlots(o, routes, first) {
|
|
|
22750
22909
|
const tookTicket = reported2 !== false;
|
|
22751
22910
|
if (tookTicket) started.push(role);
|
|
22752
22911
|
if (roleCap(role) <= 1) {
|
|
22753
|
-
|
|
22912
|
+
live2.delete(cand);
|
|
22754
22913
|
continue;
|
|
22755
22914
|
}
|
|
22756
|
-
if (tookTicket && count + 1 < roleCap(role))
|
|
22757
|
-
else
|
|
22915
|
+
if (tookTicket && count + 1 < roleCap(role)) live2.set(cand, count + 1);
|
|
22916
|
+
else live2.delete(cand);
|
|
22758
22917
|
}
|
|
22759
22918
|
}
|
|
22760
22919
|
return { started, skipped };
|
|
@@ -23703,10 +23862,10 @@ function nonReleaserNote(repo, releaser) {
|
|
|
23703
23862
|
}
|
|
23704
23863
|
function missingReleaserWarning(repo, release, ships, now = Date.now()) {
|
|
23705
23864
|
if (release.ship || release.mode !== "local" && release.mode !== "integrate") return null;
|
|
23706
|
-
const
|
|
23707
|
-
if (
|
|
23708
|
-
const names =
|
|
23709
|
-
return `${repo}: release.mode "${release.mode}" with no release.ship, and ${
|
|
23865
|
+
const live2 = ships.filter((s) => s.last_seen && now - Date.parse(s.last_seen) <= DAY_MS);
|
|
23866
|
+
if (live2.length < 2) return null;
|
|
23867
|
+
const names = live2.map((s) => s.name ?? "?").join(", ");
|
|
23868
|
+
return `${repo}: release.mode "${release.mode}" with no release.ship, and ${live2.length} ships seen in the last day (${names}) \u2014 every one of them will try to release it. Set release.ship in .crew.yaml.`;
|
|
23710
23869
|
}
|
|
23711
23870
|
|
|
23712
23871
|
// src/watch.ts
|
|
@@ -24186,6 +24345,14 @@ async function discover(o) {
|
|
|
24186
24345
|
if (out.models.issues) {
|
|
24187
24346
|
try {
|
|
24188
24347
|
await get(o, `/data-models/${out.models.issues}/events?limit=1`);
|
|
24348
|
+
try {
|
|
24349
|
+
const model = await get(o, `/data-models/${out.models.issues}`);
|
|
24350
|
+
const tracked2 = model.eventLogConfig?.trackedFields;
|
|
24351
|
+
if (Array.isArray(tracked2) && !tracked2.includes(DEFAULT_CONTRACT.columns.status)) {
|
|
24352
|
+
problems.push(EVENT_LOG_STATUS_UNTRACKED(DEFAULT_CONTRACT.columns.status));
|
|
24353
|
+
}
|
|
24354
|
+
} catch {
|
|
24355
|
+
}
|
|
24189
24356
|
} catch (e) {
|
|
24190
24357
|
if (e instanceof ConnectHttpError && e.status === 404) problems.push(EVENT_LOG_MISSING);
|
|
24191
24358
|
}
|
|
@@ -26782,11 +26949,11 @@ async function handlePeriscopes(h, q2) {
|
|
|
26782
26949
|
for (const v of [repo, topic, requestedBy]) if (isErr(v)) return err(400, v.error);
|
|
26783
26950
|
if (b.isolate !== void 0 && typeof b.isolate !== "boolean") return err(400, "isolate must be a boolean");
|
|
26784
26951
|
if (!h.previewHost && !h.relayPreviews) return err(409, "this ship has no ship.previewHost, so a Passenger could not reach a periscope");
|
|
26785
|
-
const
|
|
26952
|
+
const live2 = await h.run(["periscope", "list", picked.route, "--json"], () => {
|
|
26786
26953
|
});
|
|
26787
|
-
if (
|
|
26954
|
+
if (live2.code === 0) {
|
|
26788
26955
|
try {
|
|
26789
|
-
const n = JSON.parse(
|
|
26956
|
+
const n = JSON.parse(live2.stdout).length;
|
|
26790
26957
|
if (n >= h.maxPeriscopes) return err(409, `this ship already hosts ${n} live periscope(s) (ship.maxPeriscopes is ${h.maxPeriscopes}) \u2014 discard one first`);
|
|
26791
26958
|
} catch {
|
|
26792
26959
|
}
|
|
@@ -26924,11 +27091,11 @@ function decodeCursor(s) {
|
|
|
26924
27091
|
}
|
|
26925
27092
|
return null;
|
|
26926
27093
|
}
|
|
26927
|
-
function candidates(
|
|
26928
|
-
const out = [
|
|
27094
|
+
function candidates(live2, rotated) {
|
|
27095
|
+
const out = [live2];
|
|
26929
27096
|
if (!rotated) return out;
|
|
26930
27097
|
try {
|
|
26931
|
-
for (const n of readdirSync18(dirname35(
|
|
27098
|
+
for (const n of readdirSync18(dirname35(live2))) if (ROTATED_EVENTS_RE.test(n)) out.push(join58(dirname35(live2), n));
|
|
26932
27099
|
} catch {
|
|
26933
27100
|
}
|
|
26934
27101
|
return out;
|
|
@@ -26970,20 +27137,20 @@ function lastLines2(path, n) {
|
|
|
26970
27137
|
} else lines2.pop();
|
|
26971
27138
|
return { lines: lines2.slice(-n).filter((l) => l.length), cursor: cursorAt(end), reset: false };
|
|
26972
27139
|
}
|
|
26973
|
-
function readTail(
|
|
27140
|
+
function readTail(live2, opts) {
|
|
26974
27141
|
const max = opts.maxBytes ?? MAX_TAIL_BYTES;
|
|
26975
|
-
if (!existsSync56(
|
|
27142
|
+
if (!existsSync56(live2)) {
|
|
26976
27143
|
return { lines: [], cursor: opts.after ?? encodeCursor({ dev: 0, ino: 0, off: 0 }), reset: false };
|
|
26977
27144
|
}
|
|
26978
27145
|
const cur = opts.after ? decodeCursor(opts.after) : null;
|
|
26979
|
-
if (!opts.after) return lastLines2(
|
|
27146
|
+
if (!opts.after) return lastLines2(live2, opts.tail ?? DEFAULT_TAIL_LINES);
|
|
26980
27147
|
let reset = false;
|
|
26981
|
-
let path =
|
|
27148
|
+
let path = live2;
|
|
26982
27149
|
let off = 0;
|
|
26983
27150
|
if (!cur) {
|
|
26984
27151
|
reset = true;
|
|
26985
27152
|
} else {
|
|
26986
|
-
const found = candidates(
|
|
27153
|
+
const found = candidates(live2, opts.rotated ?? false).find((p) => {
|
|
26987
27154
|
try {
|
|
26988
27155
|
const s = statSync16(p);
|
|
26989
27156
|
return s.ino === cur.ino && s.dev === cur.dev;
|
|
@@ -27001,8 +27168,8 @@ function readTail(live, opts) {
|
|
|
27001
27168
|
off = 0;
|
|
27002
27169
|
reset = true;
|
|
27003
27170
|
}
|
|
27004
|
-
if (off >= size && path !==
|
|
27005
|
-
path =
|
|
27171
|
+
if (off >= size && path !== live2) {
|
|
27172
|
+
path = live2;
|
|
27006
27173
|
off = 0;
|
|
27007
27174
|
size = statSync16(path).size;
|
|
27008
27175
|
}
|
|
@@ -27093,6 +27260,29 @@ async function tailReply(path, q2, rotated, abort) {
|
|
|
27093
27260
|
}
|
|
27094
27261
|
return reply2(200, r);
|
|
27095
27262
|
}
|
|
27263
|
+
var NOTE_MAX_CHARS = 4e3;
|
|
27264
|
+
async function postRunMessage(deps, run4, body) {
|
|
27265
|
+
if (!RUN_NAME_RE.test(run4) || run4.includes("..")) return err2(400, "not a run name");
|
|
27266
|
+
const live2 = liveRuns(deps.stateDir).find((r) => basename14(r.streamPath, ".jsonl") === run4.replace(/\.jsonl$/, ""));
|
|
27267
|
+
const carry = "A note for the work item posted from the platform is carried forward into its next run's brief.";
|
|
27268
|
+
if (!live2) return err2(404, `no live run ${run4}: it is unknown or has finished. ${carry}`);
|
|
27269
|
+
if (!body) return err2(400, "body must be a small JSON object");
|
|
27270
|
+
const text2 = typeof body.text === "string" ? body.text.trim() : "";
|
|
27271
|
+
if (!text2 || text2.length > NOTE_MAX_CHARS) return err2(400, `text must be a string of 1 to ${NOTE_MAX_CHARS} characters`);
|
|
27272
|
+
if (body.author !== void 0 && typeof body.author !== "string") return err2(400, "author must be a string");
|
|
27273
|
+
const input = runInputFor(basename14(live2.streamPath, ".jsonl"));
|
|
27274
|
+
const rowId = input?.agentLogRowId();
|
|
27275
|
+
if (!input?.target || !rowId) return err2(409, `run ${run4} is live but this daemon cannot record a note on it (it did not start the run, or the run has no Agent Log row). ${carry}`);
|
|
27276
|
+
try {
|
|
27277
|
+
const recorded = await postMessage(input.target, rowId, text2);
|
|
27278
|
+
const acceptsInput = input.accepts();
|
|
27279
|
+
const state = acceptsInput ? await input.deliver(recorded, body.author || void 0) : "carried_forward";
|
|
27280
|
+
if (!acceptsInput) await markMessage(input.target, rowId, recorded.id, "carried_forward");
|
|
27281
|
+
return reply2(200, { cycleId: recorded.id, state, acceptsInput });
|
|
27282
|
+
} catch (e) {
|
|
27283
|
+
return err2(409, `the platform did not take the note: ${e.message}. ${carry}`);
|
|
27284
|
+
}
|
|
27285
|
+
}
|
|
27096
27286
|
async function route(deps, method, url, req, abort) {
|
|
27097
27287
|
const p = url.pathname.replace(/\/+$/, "") || "/";
|
|
27098
27288
|
const get2 = method === "GET";
|
|
@@ -27132,6 +27322,8 @@ async function route(deps, method, url, req, abort) {
|
|
|
27132
27322
|
if (!existsSync56(file)) return err2(404, "no such run");
|
|
27133
27323
|
return tailReply(file, url.searchParams, false, abort);
|
|
27134
27324
|
}
|
|
27325
|
+
const note = /^\/streams\/([^/]+)\/messages$/.exec(p);
|
|
27326
|
+
if (note && post3) return postRunMessage(deps, decodeURIComponent(note[1]), await readJsonBody(req));
|
|
27135
27327
|
if ((p === "/pause" || p === "/resume") && post3) {
|
|
27136
27328
|
const body = await readJsonBody(req);
|
|
27137
27329
|
if (!body) return err2(400, "body must be a small JSON object");
|
|
@@ -28807,6 +28999,7 @@ if (command === "passenger-sync-daemon") {
|
|
|
28807
28999
|
} catch (e) {
|
|
28808
29000
|
problems.push(`tracker unreachable: ${e instanceof Error ? e.message : String(e)}`);
|
|
28809
29001
|
}
|
|
29002
|
+
if (await tracker.eventLogTracksStatus() === false) problems.push(EVENT_LOG_STATUS_UNTRACKED(tracker.contract.columns.status));
|
|
28810
29003
|
return { problems, readiness };
|
|
28811
29004
|
}
|
|
28812
29005
|
async function doctorShipKind(route3, ship) {
|
|
@@ -31881,9 +32074,9 @@ Signed in as ${result.identity.email} \u2014 minted an API key in workspace "${r
|
|
|
31881
32074
|
break;
|
|
31882
32075
|
}
|
|
31883
32076
|
for (const r of rows) {
|
|
31884
|
-
const
|
|
32077
|
+
const live2 = worktreeExistsIn(where, r.t.n);
|
|
31885
32078
|
process.stdout.write(
|
|
31886
|
-
`${String(r.port).padEnd(6)} ${r.t.role.padEnd(9)} ISSUE-${String(r.t.n).padEnd(5)} pid ${String(r.pid).padEnd(7)} ${
|
|
32079
|
+
`${String(r.port).padEnd(6)} ${r.t.role.padEnd(9)} ISSUE-${String(r.t.n).padEnd(5)} pid ${String(r.pid).padEnd(7)} ${live2 ? "worktree present" : "ORPHAN \u2014 worktree gone"}
|
|
31887
32080
|
`
|
|
31888
32081
|
);
|
|
31889
32082
|
}
|
package/package.json
CHANGED
|
@@ -260,7 +260,7 @@ ticket to the next lane by assigning that lane's seat on this ship (ids under
|
|
|
260
260
|
`automatic` project, clear `assignee_id`. If there is no seat for the target
|
|
261
261
|
role, assign any Crew row with that role's Agent; if there is none, clear it
|
|
262
262
|
and say so in the hand-off comment. Parks (`needs_info`, `needs_planning` →
|
|
263
|
-
the
|
|
263
|
+
the person in the digest's `park to` cell) are the same in every mode.
|
|
264
264
|
|
|
265
265
|
**Gates you never cross:**
|
|
266
266
|
|
|
@@ -287,7 +287,7 @@ the operator) are the same in every mode.
|
|
|
287
287
|
**Check `report_type` first.** The steps below are for a ticket that ends in
|
|
288
288
|
shipped code (`bug`, `feature` or anything else this workspace's field
|
|
289
289
|
offers). A `question` or `investigation` ticket asks for an answer, not a
|
|
290
|
-
fix: it never reaches `fixed` or QA and ends with the
|
|
290
|
+
fix: it never reaches `fixed` or QA and ends with the `park to` person at
|
|
291
291
|
`needs_info` with `needs_planning` set — a Question gets no worktree and no
|
|
292
292
|
code; an Investigation may prototype as evidence, committed but never handed
|
|
293
293
|
off. Fetch the `Question and Investigation Tickets` skill for the procedure
|
|
@@ -513,14 +513,28 @@ run. That is a report for the operator, not an accusation.
|
|
|
513
513
|
## Stopping: say it in data, not prose
|
|
514
514
|
|
|
515
515
|
A stop that lives only in a comment is invisible to every view that filters
|
|
516
|
-
on data. There are two kinds, each written where the
|
|
516
|
+
on data. There are two kinds, each written where the person who owns the
|
|
517
|
+
ticket looks:
|
|
517
518
|
|
|
518
519
|
1. **The ticket needs a person** (a question, a decision, an ambiguous spec,
|
|
519
520
|
a branch only a human can reconcile): set `status` to `needs_info` **and**
|
|
520
|
-
`assignee_id` to the
|
|
521
|
-
when it is a decision rather than a fact. These
|
|
522
|
-
whenever a comment of yours addresses
|
|
523
|
-
comment alone is not a stop.
|
|
521
|
+
`assignee_id` to the Crew row in the ticket's `park to` digest cell, and
|
|
522
|
+
`needs_planning` to true when it is a decision rather than a fact. These
|
|
523
|
+
fields are mandatory whenever a comment of yours addresses a named
|
|
524
|
+
person — a comment alone is not a stop.
|
|
525
|
+
|
|
526
|
+
The decision belongs to whoever made the call on the ticket, so the digest
|
|
527
|
+
resolves `park to` in this order and the first that resolves wins: (1) the
|
|
528
|
+
**acceptor**, the person who last moved the ticket into `accepted` (the
|
|
529
|
+
`accepted by` column; a lane, workflow or the system promoting it does not
|
|
530
|
+
count); (2) the **filer**, only when a hold or a linked person, never a
|
|
531
|
+
seat or a typed name; (3) the **ship operator**, when the ship has one;
|
|
532
|
+
(4) **nobody by name**: leave `assignee_id` empty at `needs_info` and write
|
|
533
|
+
the question without a personal address, so any hold can pick it up. Address
|
|
534
|
+
the named person by name in the comment. When `accepted by` shows a name
|
|
535
|
+
marked unverified, that person has no Crew row: you may name them in prose,
|
|
536
|
+
but assign whoever `park to` gives. If the cell is missing from the digest,
|
|
537
|
+
fall back to the filer, then the operator.
|
|
524
538
|
2. **This ship cannot proceed** (the base diverged from the remote, a tool or
|
|
525
539
|
hook is missing, no disk, authentication failed) but the ticket is fine:
|
|
526
540
|
leave it exactly as it is, `in_progress` and assigned to you, so no other
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: Question and Investigation Tickets
|
|
3
|
-
description: The procedure for a ticket whose report_type is question or investigation — tickets that ask for an answer, not a fix, and end with the
|
|
3
|
+
description: The procedure for a ticket whose report_type is question or investigation — tickets that ask for an answer, not a fix, and end with the ticket's decision-maker at needs_info rather than at fixed. Fetch when the ticket you picked up has either report_type.
|
|
4
4
|
---
|
|
5
5
|
# Question and Investigation tickets
|
|
6
6
|
|
|
7
7
|
These two `report_type` values ask for an answer, not a fix. Neither ever
|
|
8
|
-
reaches `fixed` or QA; both end with the
|
|
9
|
-
|
|
8
|
+
reaches `fixed` or QA; both end with the person in the digest's `park to` cell at
|
|
9
|
+
`needs_info` (the acceptor, else the filer, else the operator; see the shared
|
|
10
|
+
policy's "Stopping"), for a decision only they can make. Where this conflicts with the build steps in the
|
|
10
11
|
shared policy, this wins.
|
|
11
12
|
|
|
12
13
|
## `question` — discussion or research
|
|
@@ -23,7 +24,8 @@ No worktree and no code changes; only an answer.
|
|
|
23
24
|
3. Post the answer as its own comment, citing the files, lines or tickets it
|
|
24
25
|
rests on, the way a closing comment cites what changed.
|
|
25
26
|
4. Set `status` to `needs_info`, `needs_planning` to true, and `assignee_id`
|
|
26
|
-
to the
|
|
27
|
+
to the Crew row in the ticket's `park to` cell (none: leave it unassigned,
|
|
28
|
+
no personal address). This is the designed ending
|
|
27
29
|
for every Question — "answered, awaiting a person to decide what's next" —
|
|
28
30
|
not a fallback for one that went wrong.
|
|
29
31
|
|
|
@@ -46,9 +48,9 @@ concept.
|
|
|
46
48
|
`Filing a Ticket` skill) rather than folding the implementation into this
|
|
47
49
|
ticket.
|
|
48
50
|
4. Set `status` to `needs_info`, `needs_planning` to true, and `assignee_id`
|
|
49
|
-
to the
|
|
50
|
-
branch in place — they are the evidence. They stay until the
|
|
51
|
-
|
|
51
|
+
to the `park to` Crew row, as for a Question. Leave the worktree and
|
|
52
|
+
branch in place — they are the evidence. They stay until the ticket is
|
|
53
|
+
closed; the ordinary worktree sweep cleans up from there.
|
|
52
54
|
|
|
53
55
|
## Both
|
|
54
56
|
|