@rallycry/conveyor-agent 11.1.6 → 11.1.7
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/{chunk-YSIZHDN2.js → chunk-OFGV5G4O.js} +1 -1
- package/dist/{chunk-TFQKDNRY.js → chunk-TGU3DX5B.js} +167 -43
- package/dist/{chunk-GNUXQJR6.js → chunk-YQLVANEA.js} +66 -4
- package/dist/cli.js +4 -4
- package/dist/index.d.ts +17 -1
- package/dist/index.js +2 -2
- package/dist/{serve-boot-FWARG2BW.js → serve-boot-JWGICOM7.js} +2 -2
- package/package.json +1 -1
|
@@ -100,7 +100,7 @@ import {
|
|
|
100
100
|
toMemberMentionRows,
|
|
101
101
|
updateRemoteToken,
|
|
102
102
|
verifyGitCredential
|
|
103
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-YQLVANEA.js";
|
|
104
104
|
import {
|
|
105
105
|
reportBootMilestone
|
|
106
106
|
} from "./chunk-VIUZS7V4.js";
|
|
@@ -3350,6 +3350,12 @@ var PtySession = class {
|
|
|
3350
3350
|
// type chat text into the questionnaire. Fail-safe — a stale flag only
|
|
3351
3351
|
// costs a teardown + respawn (`--resume` recovers the conversation).
|
|
3352
3352
|
questionnairePending = false;
|
|
3353
|
+
// The `aq-…` id of the questionnaire the PreToolUse hook saw last, until its
|
|
3354
|
+
// PostToolUse envelope (or teardown) consumes it. The id names the saved
|
|
3355
|
+
// card poll, and the envelope carries it so the runner can mark that poll
|
|
3356
|
+
// answered in the terminal. Deliberately NOT cleared per turn: the envelope
|
|
3357
|
+
// can arrive after a passive turn already began on the answer's records.
|
|
3358
|
+
openQuestionRequestId = null;
|
|
3353
3359
|
// Parked-permission-dialog backstop (see handleHookNotification). The last
|
|
3354
3360
|
// tool the PreToolUse hook saw over the socket, cleared once that tool runs:
|
|
3355
3361
|
// a parked ExitPlanMode/AskUserQuestion dialog is an expected wait, not an
|
|
@@ -3873,9 +3879,8 @@ var PtySession = class {
|
|
|
3873
3879
|
/** Render the question card in the web chat NOW — at hook time — instead of
|
|
3874
3880
|
* whenever the CLI flushes the transcript records (which is only after the
|
|
3875
3881
|
* questionnaire resolves; see the field comment). */
|
|
3876
|
-
emitSyntheticQuestionCard(questions) {
|
|
3882
|
+
emitSyntheticQuestionCard(questions, id) {
|
|
3877
3883
|
if (questions.length === 0 || typeof this.bridge?.sendChatEvent !== "function") return;
|
|
3878
|
-
const id = `aq-${randomUUID()}`;
|
|
3879
3884
|
this.pendingSyntheticQuestionIds.push(id);
|
|
3880
3885
|
this.sendChatEvent({
|
|
3881
3886
|
kind: "tool_use",
|
|
@@ -3926,6 +3931,7 @@ var PtySession = class {
|
|
|
3926
3931
|
*/
|
|
3927
3932
|
injectIntoRunningTurn(text) {
|
|
3928
3933
|
if (!this.pty || this._toreDown || this.exited) return false;
|
|
3934
|
+
if (this.questionnairePending) return false;
|
|
3929
3935
|
if (this.activeQueue === null) return false;
|
|
3930
3936
|
if (!this.adapter.capabilities.structuredEvents) return false;
|
|
3931
3937
|
if (!text.trim()) return false;
|
|
@@ -3974,6 +3980,7 @@ var PtySession = class {
|
|
|
3974
3980
|
if (this._toreDown) return;
|
|
3975
3981
|
this._toreDown = true;
|
|
3976
3982
|
this.questionnairePending = false;
|
|
3983
|
+
this.openQuestionRequestId = null;
|
|
3977
3984
|
this.disarmPlanDialogAutoAccept();
|
|
3978
3985
|
this.disarmSubmitNudge();
|
|
3979
3986
|
this.closeSyntheticQuestionCards();
|
|
@@ -4269,7 +4276,12 @@ var PtySession = class {
|
|
|
4269
4276
|
if (this.pendingPlanApproval && progress.tool_name === "ExitPlanMode") {
|
|
4270
4277
|
this.disarmPlanDialogAutoAccept();
|
|
4271
4278
|
}
|
|
4272
|
-
|
|
4279
|
+
let answeredRequestId = null;
|
|
4280
|
+
if (progress.tool_name === "AskUserQuestion") {
|
|
4281
|
+
this.questionnairePending = false;
|
|
4282
|
+
answeredRequestId = this.openQuestionRequestId;
|
|
4283
|
+
this.openQuestionRequestId = null;
|
|
4284
|
+
}
|
|
4273
4285
|
this.permissionAlertArmed = false;
|
|
4274
4286
|
if (progress.tool_name !== void 0 && progress.tool_name === this.lastPreToolUseTool) {
|
|
4275
4287
|
this.lastPreToolUseTool = null;
|
|
@@ -4278,7 +4290,8 @@ var PtySession = class {
|
|
|
4278
4290
|
this.pushEvent({
|
|
4279
4291
|
type: "tool_progress",
|
|
4280
4292
|
...progress.tool_name === void 0 ? {} : { tool_name: progress.tool_name },
|
|
4281
|
-
...progress.elapsed_time_seconds === void 0 ? {} : { elapsed_time_seconds: progress.elapsed_time_seconds }
|
|
4293
|
+
...progress.elapsed_time_seconds === void 0 ? {} : { elapsed_time_seconds: progress.elapsed_time_seconds },
|
|
4294
|
+
...answeredRequestId ? { requestId: answeredRequestId } : {}
|
|
4282
4295
|
});
|
|
4283
4296
|
}
|
|
4284
4297
|
/**
|
|
@@ -4297,8 +4310,10 @@ var PtySession = class {
|
|
|
4297
4310
|
this.disarmPlanDialogAutoAccept();
|
|
4298
4311
|
this.questionnairePending = true;
|
|
4299
4312
|
const questions = parseUserQuestions(request.tool_input);
|
|
4300
|
-
|
|
4301
|
-
this.
|
|
4313
|
+
const requestId = `aq-${randomUUID()}`;
|
|
4314
|
+
this.openQuestionRequestId = requestId;
|
|
4315
|
+
this.pushEvent({ type: "user_question", questions, requestId });
|
|
4316
|
+
this.emitSyntheticQuestionCard(questions, requestId);
|
|
4302
4317
|
return { decision: "allow" };
|
|
4303
4318
|
}
|
|
4304
4319
|
const canUseTool = this.turn.canUseTool;
|
|
@@ -6046,7 +6061,6 @@ import {
|
|
|
6046
6061
|
closeSync,
|
|
6047
6062
|
existsSync,
|
|
6048
6063
|
openSync,
|
|
6049
|
-
readFileSync as readFileSync3,
|
|
6050
6064
|
readSync,
|
|
6051
6065
|
renameSync as renameSync2,
|
|
6052
6066
|
statSync as statSync2,
|
|
@@ -7359,6 +7373,11 @@ function buildFreshInstructions(isPlanning, context) {
|
|
|
7359
7373
|
`You are the Planner on this card \u2014 scope and plan it with the team. A separate Builder session implements it.`
|
|
7360
7374
|
) : builderKickoff(context, `You are the Builder on this card \u2014 implement its plan.`);
|
|
7361
7375
|
}
|
|
7376
|
+
function buildResumedPlannerInstructions() {
|
|
7377
|
+
return plannerKickoff(
|
|
7378
|
+
`You are resuming your own planning conversation on this card. What you researched before the pause is earlier in this conversation: do not repeat it. Anything new since you paused, including answers to your questions, is in New Messages above. Fold it into the plan and continue the workflow from where you stopped.`
|
|
7379
|
+
);
|
|
7380
|
+
}
|
|
7362
7381
|
function buildFreshCodeReviewInstructions(context) {
|
|
7363
7382
|
const parts = [...buildSkillInvocation("/conveyor-review"), branchRule(context, true)];
|
|
7364
7383
|
if (context.githubPRUrl) {
|
|
@@ -7387,7 +7406,7 @@ function buildIdleRelaunchInstructions(context, isPlanning) {
|
|
|
7387
7406
|
...builderKickoff(context, `You are the Builder on this card \u2014 pick up where you left off.`)
|
|
7388
7407
|
];
|
|
7389
7408
|
}
|
|
7390
|
-
function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
7409
|
+
function buildInstructions(mode, context, scenario, agentMode, isAuto, resumed) {
|
|
7391
7410
|
const parts = [`
|
|
7392
7411
|
## Instructions`];
|
|
7393
7412
|
const isPm = mode === "pm";
|
|
@@ -7402,7 +7421,9 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
|
7402
7421
|
return parts;
|
|
7403
7422
|
}
|
|
7404
7423
|
if (scenario === "fresh") {
|
|
7405
|
-
parts.push(
|
|
7424
|
+
parts.push(
|
|
7425
|
+
...isPlanning && resumed ? buildResumedPlannerInstructions() : buildFreshInstructions(isPlanning, context)
|
|
7426
|
+
);
|
|
7406
7427
|
return parts;
|
|
7407
7428
|
}
|
|
7408
7429
|
const newBatch = relaunchMessageBatch(context);
|
|
@@ -7422,7 +7443,7 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
|
7422
7443
|
parts.push(...buildFeedbackInstructions(context, isPlanning));
|
|
7423
7444
|
return parts;
|
|
7424
7445
|
}
|
|
7425
|
-
async function buildInitialPrompt(mode, context, isAuto, agentMode) {
|
|
7446
|
+
async function buildInitialPrompt(mode, context, isAuto, agentMode, opts) {
|
|
7426
7447
|
const isPackRunner = isPackRunnerSession(mode);
|
|
7427
7448
|
if (!isPackRunner) {
|
|
7428
7449
|
const sessionRelaunch = buildRelaunchWithSession(mode, context, agentMode, isAuto);
|
|
@@ -7436,7 +7457,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
|
|
|
7436
7457
|
scenario = "fresh";
|
|
7437
7458
|
}
|
|
7438
7459
|
const body = await buildTaskBody(context, mode);
|
|
7439
|
-
const instructions = isPackRunner ? buildSinglePodPackInstructions(scenario) : buildInstructions(mode, context, scenario, agentMode, isAuto);
|
|
7460
|
+
const instructions = isPackRunner ? buildSinglePodPackInstructions(scenario) : buildInstructions(mode, context, scenario, agentMode, isAuto, opts?.resumed);
|
|
7440
7461
|
return [...body, ...instructions].join("\n");
|
|
7441
7462
|
}
|
|
7442
7463
|
|
|
@@ -13039,15 +13060,18 @@ function questionTextFromEvent(event) {
|
|
|
13039
13060
|
async function armQuestionPending(host, state, event) {
|
|
13040
13061
|
state.questionPending = true;
|
|
13041
13062
|
const questionText = questionTextFromEvent(event);
|
|
13042
|
-
host.callbacks.onUserQuestion?.({
|
|
13043
|
-
kind: "armed",
|
|
13044
|
-
...questionText === void 0 ? {} : { questionText }
|
|
13045
|
-
});
|
|
13046
13063
|
await host.connection.emitStatus(
|
|
13047
13064
|
"waiting_for_input",
|
|
13048
13065
|
AGENT_STATUS_REASON_USER_QUESTION,
|
|
13049
13066
|
questionText
|
|
13050
13067
|
);
|
|
13068
|
+
const persisted = event.requestId !== void 0 && event.questions.length > 0 ? await host.connection.recordAgentQuestion(event.requestId, event.questions) : false;
|
|
13069
|
+
host.callbacks.onUserQuestion?.({
|
|
13070
|
+
kind: "armed",
|
|
13071
|
+
...questionText === void 0 ? {} : { questionText },
|
|
13072
|
+
questions: event.questions,
|
|
13073
|
+
persisted
|
|
13074
|
+
});
|
|
13051
13075
|
await host.callbacks.onStatusChange("waiting_for_input");
|
|
13052
13076
|
}
|
|
13053
13077
|
async function clearQuestionPending(host, state, options) {
|
|
@@ -13071,6 +13095,7 @@ async function applyQuestionTransitions(event, host, state) {
|
|
|
13071
13095
|
return;
|
|
13072
13096
|
case "tool_progress":
|
|
13073
13097
|
if (event.tool_name === "AskUserQuestion") {
|
|
13098
|
+
if (event.requestId) host.connection.markAgentQuestionAnswered(event.requestId);
|
|
13074
13099
|
await clearQuestionPending(host, state, { emitRunning: true });
|
|
13075
13100
|
}
|
|
13076
13101
|
return;
|
|
@@ -13813,37 +13838,79 @@ function transcriptHasConversation(path) {
|
|
|
13813
13838
|
}
|
|
13814
13839
|
}
|
|
13815
13840
|
}
|
|
13841
|
+
var REPAIR_TAIL_WINDOW_BYTES = 1024 * 1024;
|
|
13842
|
+
var NEWLINE = 10;
|
|
13816
13843
|
function repairTornSessionFile(path) {
|
|
13844
|
+
let fd;
|
|
13817
13845
|
try {
|
|
13818
13846
|
if (!existsSync(path)) return false;
|
|
13819
|
-
const
|
|
13820
|
-
if (
|
|
13821
|
-
|
|
13822
|
-
|
|
13823
|
-
|
|
13824
|
-
|
|
13825
|
-
while (keepEnd > 0) {
|
|
13826
|
-
const prevNewline = content.lastIndexOf("\n", keepEnd - 2);
|
|
13827
|
-
const line = content.slice(prevNewline + 1, keepEnd - 1).trim();
|
|
13828
|
-
if (line.length > 0) {
|
|
13829
|
-
try {
|
|
13830
|
-
JSON.parse(line);
|
|
13831
|
-
break;
|
|
13832
|
-
} catch {
|
|
13833
|
-
}
|
|
13834
|
-
}
|
|
13835
|
-
keepEnd = prevNewline + 1;
|
|
13836
|
-
}
|
|
13837
|
-
if (keepEnd === content.length) return false;
|
|
13838
|
-
truncateSync(path, Buffer.byteLength(content.slice(0, keepEnd), "utf8"));
|
|
13847
|
+
const size = statSync2(path).size;
|
|
13848
|
+
if (size === 0) return false;
|
|
13849
|
+
fd = openSync(path, "r");
|
|
13850
|
+
const keepEnd = findLastWholeLineEnd(fd, size);
|
|
13851
|
+
if (keepEnd === size) return false;
|
|
13852
|
+
truncateSync(path, keepEnd);
|
|
13839
13853
|
logger6.warn("Repaired torn transcript before resume", {
|
|
13840
13854
|
path,
|
|
13841
|
-
trimmedBytes:
|
|
13855
|
+
trimmedBytes: size - keepEnd
|
|
13842
13856
|
});
|
|
13843
13857
|
return true;
|
|
13844
13858
|
} catch {
|
|
13845
13859
|
return false;
|
|
13860
|
+
} finally {
|
|
13861
|
+
if (fd !== void 0) {
|
|
13862
|
+
try {
|
|
13863
|
+
closeSync(fd);
|
|
13864
|
+
} catch {
|
|
13865
|
+
}
|
|
13866
|
+
}
|
|
13867
|
+
}
|
|
13868
|
+
}
|
|
13869
|
+
function findLastWholeLineEnd(fd, size) {
|
|
13870
|
+
let window = Math.min(size, REPAIR_TAIL_WINDOW_BYTES);
|
|
13871
|
+
for (; ; ) {
|
|
13872
|
+
const windowStart = size - window;
|
|
13873
|
+
const buffer = Buffer.alloc(window);
|
|
13874
|
+
let read = 0;
|
|
13875
|
+
while (read < window) {
|
|
13876
|
+
const n = readSync(fd, buffer, read, window - read, windowStart + read);
|
|
13877
|
+
if (n === 0) break;
|
|
13878
|
+
read += n;
|
|
13879
|
+
}
|
|
13880
|
+
const tail = buffer.subarray(0, read);
|
|
13881
|
+
const result = lastWholeLineEndInWindow(tail, windowStart);
|
|
13882
|
+
if (result !== null) return result;
|
|
13883
|
+
if (window === size) return 0;
|
|
13884
|
+
window = Math.min(size, window * 2);
|
|
13885
|
+
}
|
|
13886
|
+
}
|
|
13887
|
+
function lastWholeLineEndInWindow(tail, windowStart) {
|
|
13888
|
+
const end = windowStart + tail.length;
|
|
13889
|
+
let keepEnd = end;
|
|
13890
|
+
if (tail[tail.length - 1] !== NEWLINE) {
|
|
13891
|
+
const lastNewline = tail.lastIndexOf(NEWLINE);
|
|
13892
|
+
if (lastNewline === -1) {
|
|
13893
|
+
if (windowStart > 0) return null;
|
|
13894
|
+
return 0;
|
|
13895
|
+
}
|
|
13896
|
+
keepEnd = windowStart + lastNewline + 1;
|
|
13897
|
+
}
|
|
13898
|
+
while (keepEnd > 0) {
|
|
13899
|
+
const searchFrom = keepEnd - 2 - windowStart;
|
|
13900
|
+
const prevNewline = searchFrom >= 0 ? tail.lastIndexOf(NEWLINE, searchFrom) : -1;
|
|
13901
|
+
if (prevNewline === -1 && windowStart > 0) return null;
|
|
13902
|
+
const lineStart = prevNewline + 1;
|
|
13903
|
+
const line = tail.subarray(lineStart, keepEnd - 1 - windowStart).toString("utf8").trim();
|
|
13904
|
+
if (line.length > 0) {
|
|
13905
|
+
try {
|
|
13906
|
+
JSON.parse(line);
|
|
13907
|
+
break;
|
|
13908
|
+
} catch {
|
|
13909
|
+
}
|
|
13910
|
+
}
|
|
13911
|
+
keepEnd = windowStart + lineStart;
|
|
13846
13912
|
}
|
|
13913
|
+
return keepEnd;
|
|
13847
13914
|
}
|
|
13848
13915
|
function resolvePromptDelivery(inputs) {
|
|
13849
13916
|
if (inputs.harnessKind !== "pty") return "submit";
|
|
@@ -14299,7 +14366,8 @@ async function runInitialQuery(host, context, options, resume, promptDelivery) {
|
|
|
14299
14366
|
host.config.mode,
|
|
14300
14367
|
context,
|
|
14301
14368
|
host.isAuto,
|
|
14302
|
-
host.agentMode
|
|
14369
|
+
host.agentMode,
|
|
14370
|
+
{ resumed: !!resume }
|
|
14303
14371
|
);
|
|
14304
14372
|
const { prompt, appendSystemPrompt } = selectInitialPromptInput(
|
|
14305
14373
|
promptDelivery,
|
|
@@ -15565,6 +15633,52 @@ function findLiveChild(sources) {
|
|
|
15565
15633
|
return null;
|
|
15566
15634
|
}
|
|
15567
15635
|
|
|
15636
|
+
// src/runner/question-timeout-prompt.ts
|
|
15637
|
+
function formatGrace(ms) {
|
|
15638
|
+
if (ms >= 6e4) {
|
|
15639
|
+
const minutes = Math.round(ms / 6e4);
|
|
15640
|
+
return `${minutes} ${minutes === 1 ? "minute" : "minutes"}`;
|
|
15641
|
+
}
|
|
15642
|
+
const seconds = Math.max(1, Math.round(ms / 1e3));
|
|
15643
|
+
return `${seconds} ${seconds === 1 ? "second" : "seconds"}`;
|
|
15644
|
+
}
|
|
15645
|
+
function questionLines(questions) {
|
|
15646
|
+
if (questions.length === 0) return [];
|
|
15647
|
+
const noun = questions.length === 1 ? "Your question was" : "Your questions were";
|
|
15648
|
+
return [
|
|
15649
|
+
`${noun}:`,
|
|
15650
|
+
...questions.map((q) => {
|
|
15651
|
+
const header = q.header.trim();
|
|
15652
|
+
return header ? `- ${header}: ${q.question}` : `- ${q.question}`;
|
|
15653
|
+
})
|
|
15654
|
+
];
|
|
15655
|
+
}
|
|
15656
|
+
function buildQuestionTimeoutPrompt(input) {
|
|
15657
|
+
const grace = formatGrace(input.graceMs);
|
|
15658
|
+
const asked = questionLines(input.questions);
|
|
15659
|
+
if (!input.persisted) {
|
|
15660
|
+
return [
|
|
15661
|
+
`No one answered your clarifying questions within ${grace}.`,
|
|
15662
|
+
...asked,
|
|
15663
|
+
'Do this now: (1) Save your findings-so-far as the card plan (`update_task`). (2) Post the unanswered questions to chat with `post_to_chat` using `milestone: "blocked"`, stating the assumption you would make for each (this is a parking note \u2014 the question already paged them). (3) If you can safely proceed on your best-judgment answers, state the assumptions and continue; otherwise end your turn \u2014 answers posted in chat will be delivered when you resume.'
|
|
15664
|
+
].join("\n");
|
|
15665
|
+
}
|
|
15666
|
+
const steps = input.isPlanner ? [
|
|
15667
|
+
"Save a checkpoint plan with `update_task`: what you verified (cite file:line), the open questions, and your next steps.",
|
|
15668
|
+
'Post one line with `post_to_chat` and `milestone: "blocked"` that says you are waiting on the question on the card. Do not repeat the question.'
|
|
15669
|
+
] : [
|
|
15670
|
+
'Post a short progress note with `post_to_chat` and `milestone: "blocked"`: what is done, and what the open question decides. Do not repeat the question.'
|
|
15671
|
+
];
|
|
15672
|
+
steps.push(
|
|
15673
|
+
"If you can safely proceed on stated assumptions, state them and continue. Otherwise end your turn: an answer on the card or in chat wakes you, even after this workspace sleeps, and you continue this conversation."
|
|
15674
|
+
);
|
|
15675
|
+
return [
|
|
15676
|
+
`No one answered your question within ${grace}.`,
|
|
15677
|
+
...asked,
|
|
15678
|
+
`It is saved as a poll on the card and stays open there, so do not post it again. Do this now: ${steps.map((step, i) => `(${i + 1}) ${step}`).join(" ")}`
|
|
15679
|
+
].join("\n");
|
|
15680
|
+
}
|
|
15681
|
+
|
|
15568
15682
|
// src/runner/session-runner.ts
|
|
15569
15683
|
var AUTO_RUN_MODES = /* @__PURE__ */ new Set(["building", "auto", "review", "discovery", "chat"]);
|
|
15570
15684
|
var CHILD_DEFER_RECHECK_MS = 60 * 1e3;
|
|
@@ -15577,7 +15691,6 @@ function resolveQuestionGraceMs() {
|
|
|
15577
15691
|
}
|
|
15578
15692
|
var QUESTION_TYPING_RECENT_MS = 6e4;
|
|
15579
15693
|
var QUESTION_TYPING_DEFER_MS = 2 * 6e4;
|
|
15580
|
-
var QUESTION_TIMEOUT_PROMPT = 'No one answered your clarifying questions within 10 minutes. Do this now: (1) Save your findings-so-far as the card plan (`update_task`). (2) Post the unanswered questions to chat with `post_to_chat` using `milestone: "blocked"`, stating the assumption you would make for each (this is a parking note \u2014 the question already paged them). (3) If you can safely proceed on your best-judgment answers, state the assumptions and continue; otherwise end your turn \u2014 answers posted in chat will be delivered when you resume.';
|
|
15581
15694
|
var SessionRunner = class _SessionRunner {
|
|
15582
15695
|
connection;
|
|
15583
15696
|
mode;
|
|
@@ -15650,6 +15763,10 @@ var SessionRunner = class _SessionRunner {
|
|
|
15650
15763
|
* liveness hold above is bounded by timestamp arithmetic, so a lost timer
|
|
15651
15764
|
* still expires the hold — it just skips the un-park injection. */
|
|
15652
15765
|
questionGraceTimer = null;
|
|
15766
|
+
/** What the parked questionnaire asked, and whether the API saved it as a
|
|
15767
|
+
* card poll — read when the grace expires, to word the timeout prompt.
|
|
15768
|
+
* Cleared with the hold. */
|
|
15769
|
+
pendingQuestion = null;
|
|
15653
15770
|
constructor(config, callbacks, deps = {}) {
|
|
15654
15771
|
this.config = config;
|
|
15655
15772
|
this.callbacks = callbacks;
|
|
@@ -16998,6 +17115,10 @@ ${outcome.failures.join("\n")}
|
|
|
16998
17115
|
handleUserQuestionSignal(signal) {
|
|
16999
17116
|
if (signal.kind === "armed") {
|
|
17000
17117
|
this.questionPendingSince = Date.now();
|
|
17118
|
+
this.pendingQuestion = {
|
|
17119
|
+
questions: signal.questions ?? [],
|
|
17120
|
+
persisted: signal.persisted === true
|
|
17121
|
+
};
|
|
17001
17122
|
this.armQuestionGraceTimer(resolveQuestionGraceMs());
|
|
17002
17123
|
this.refreshLoopStatus();
|
|
17003
17124
|
} else if (signal.kind === "answered") {
|
|
@@ -17014,6 +17135,7 @@ ${outcome.failures.join("\n")}
|
|
|
17014
17135
|
clearTimeout(this.questionGraceTimer);
|
|
17015
17136
|
this.questionGraceTimer = null;
|
|
17016
17137
|
}
|
|
17138
|
+
this.pendingQuestion = null;
|
|
17017
17139
|
if (this.questionPendingSince === null) return;
|
|
17018
17140
|
this.questionPendingSince = null;
|
|
17019
17141
|
this.refreshLoopStatus();
|
|
@@ -17041,11 +17163,13 @@ ${outcome.failures.join("\n")}
|
|
|
17041
17163
|
process.stderr.write(
|
|
17042
17164
|
"[conveyor-agent] Question grace expired with no answer \u2014 un-parking the agent\n"
|
|
17043
17165
|
);
|
|
17044
|
-
|
|
17045
|
-
|
|
17046
|
-
|
|
17047
|
-
|
|
17166
|
+
const content = buildQuestionTimeoutPrompt({
|
|
17167
|
+
graceMs: resolveQuestionGraceMs(),
|
|
17168
|
+
questions: this.pendingQuestion?.questions ?? [],
|
|
17169
|
+
persisted: this.pendingQuestion?.persisted ?? false,
|
|
17170
|
+
isPlanner: this.mode.effectiveMode === "discovery"
|
|
17048
17171
|
});
|
|
17172
|
+
this.injectMessage({ content, userId: "system", source: "question_timeout" });
|
|
17049
17173
|
}
|
|
17050
17174
|
/** Mirror the resolved status into the loop-lag buffer so the starvation-proof
|
|
17051
17175
|
* heartbeat worker reports it too. Returns what it wrote. */
|
|
@@ -1369,6 +1369,15 @@ var AskUserQuestionRequestSchema = z5.object({
|
|
|
1369
1369
|
requestId: z5.string().min(1),
|
|
1370
1370
|
questions: z5.array(AgentQuestionSchema).min(1)
|
|
1371
1371
|
});
|
|
1372
|
+
var RecordAgentQuestionRequestSchema = z5.object({
|
|
1373
|
+
sessionId: z5.string(),
|
|
1374
|
+
requestId: z5.string().min(1),
|
|
1375
|
+
questions: z5.array(AgentQuestionSchema).min(1)
|
|
1376
|
+
});
|
|
1377
|
+
var MarkAgentQuestionAnsweredRequestSchema = z5.object({
|
|
1378
|
+
sessionId: z5.string(),
|
|
1379
|
+
requestId: z5.string().min(1)
|
|
1380
|
+
});
|
|
1372
1381
|
var PostAgentMessageRequestSchema = z5.object({
|
|
1373
1382
|
sessionId: z5.string().min(1),
|
|
1374
1383
|
content: z5.string(),
|
|
@@ -2900,6 +2909,7 @@ function toMemberMentionRows(members, query28) {
|
|
|
2900
2909
|
}));
|
|
2901
2910
|
}
|
|
2902
2911
|
var POSTGRES_ENV = {
|
|
2912
|
+
PGDATA: "/var/lib/postgresql/data",
|
|
2903
2913
|
POSTGRES_HOST_AUTH_METHOD: "trust",
|
|
2904
2914
|
POSTGRES_DB: "conveyor"
|
|
2905
2915
|
};
|
|
@@ -2918,7 +2928,7 @@ var FIREBASE_EMULATOR_ENV = {
|
|
|
2918
2928
|
var CATALOG = {
|
|
2919
2929
|
postgresql: {
|
|
2920
2930
|
name: "postgresql",
|
|
2921
|
-
image: "postgres:
|
|
2931
|
+
image: "postgres:18-alpine",
|
|
2922
2932
|
command: [
|
|
2923
2933
|
"sh",
|
|
2924
2934
|
"-c",
|
|
@@ -2928,7 +2938,7 @@ var CATALOG = {
|
|
|
2928
2938
|
// WAL flush. fsync=off + synchronous_commit=off + full_page_writes=off
|
|
2929
2939
|
// remove all blocking storage I/O — without them, per-commit flushes on
|
|
2930
2940
|
// the node's network boot disk dominated int-test wall time (~100ms/commit).
|
|
2931
|
-
|
|
2941
|
+
'if [ ! -s /var/lib/postgresql/data/PG_VERSION ]; then for seed in /opt/conveyor/postgresql/pod-data /var/lib/postgresql/pod-data; do if [ -s "$seed/PG_VERSION" ]; then cp -a "$seed/." /var/lib/postgresql/data/ || exit 1; break; fi; done; fi; chown -R postgres:postgres /var/lib/postgresql/data; docker-entrypoint.sh postgres -c fsync=off -c synchronous_commit=off -c full_page_writes=off & PID=$!; for i in $(seq 1 30); do pg_isready -U postgres && break; sleep 1; done; createdb -U postgres conveyor_test 2>/dev/null || true; wait $PID'
|
|
2932
2942
|
],
|
|
2933
2943
|
ports: [5432],
|
|
2934
2944
|
livenessProbe: {
|
|
@@ -2940,7 +2950,7 @@ var CATALOG = {
|
|
|
2940
2950
|
},
|
|
2941
2951
|
env: { ...POSTGRES_ENV },
|
|
2942
2952
|
resources: {
|
|
2943
|
-
// postgres runs from the baked seed at /
|
|
2953
|
+
// postgres runs from the baked seed at /opt/conveyor/postgresql/pod-data via
|
|
2944
2954
|
// overlayfs CoW (no emptyDir — see k8s-pod-spec.ts), so WAL + catalog +
|
|
2945
2955
|
// re-seed churn charges the container's ephemeral-storage. It must exceed
|
|
2946
2956
|
// the ~1Gi ceiling where pods evicted, but is bounded by TWO Autopilot rules:
|
|
@@ -7186,6 +7196,18 @@ var messageMetadataSchema = schemaOf()(
|
|
|
7186
7196
|
answers: z43.record(z43.string(), z43.string()).optional(),
|
|
7187
7197
|
agentName: z43.string().optional(),
|
|
7188
7198
|
agentImage: z43.string().optional(),
|
|
7199
|
+
sessionId: z43.string().optional(),
|
|
7200
|
+
source: z43.enum(["pty", "sdk"]).optional(),
|
|
7201
|
+
answeredByUserId: z43.string().optional(),
|
|
7202
|
+
answeredAt: z43.string().optional(),
|
|
7203
|
+
answeredVia: z43.enum(["chat", "card", "terminal"]).optional(),
|
|
7204
|
+
answerMessageId: z43.string().optional(),
|
|
7205
|
+
forwards: z43.array(messageForwardSchema).optional()
|
|
7206
|
+
}),
|
|
7207
|
+
z43.object({
|
|
7208
|
+
type: z43.literal("question_answer"),
|
|
7209
|
+
requestId: z43.string(),
|
|
7210
|
+
questionMessageId: z43.string(),
|
|
7189
7211
|
forwards: z43.array(messageForwardSchema).optional()
|
|
7190
7212
|
}),
|
|
7191
7213
|
z43.object({
|
|
@@ -9243,6 +9265,16 @@ var agentSessionContract = defineContract("agentSessionService", {
|
|
|
9243
9265
|
output: standard(z60.object({ answers: z60.record(z60.string(), z60.string()) })),
|
|
9244
9266
|
describe: "Lets a card's agent ask the team questions in the card's chat and wait for their answers. Alerts the team, and returns no answers if nobody replies within five minutes."
|
|
9245
9267
|
}),
|
|
9268
|
+
recordAgentQuestion: mutation({
|
|
9269
|
+
input: RecordAgentQuestionRequestSchema,
|
|
9270
|
+
output: standard(z60.object({ messageId: z60.string().nullable() })),
|
|
9271
|
+
describe: "Lets a card's agent save a question it asked in its terminal as a poll in the card's chat, so the team can answer it after the agent's workspace sleeps. Repeat calls return the same poll."
|
|
9272
|
+
}),
|
|
9273
|
+
markAgentQuestionAnswered: mutation({
|
|
9274
|
+
input: MarkAgentQuestionAnsweredRequestSchema,
|
|
9275
|
+
output: standard(z60.object({ success: z60.boolean() })),
|
|
9276
|
+
describe: "Lets a card's agent mark one of its saved polls as answered in the terminal, so the card stops asking for an answer."
|
|
9277
|
+
}),
|
|
9246
9278
|
reportApiOutage: mutation({
|
|
9247
9279
|
input: ReportApiOutageRequestSchema,
|
|
9248
9280
|
output: standard(reportApiOutageResponseSchema),
|
|
@@ -10293,7 +10325,7 @@ var agentSessionContract = defineContract("agentSessionService", {
|
|
|
10293
10325
|
answerAgentQuestion: mutation({
|
|
10294
10326
|
input: AnswerAgentQuestionRequestSchema,
|
|
10295
10327
|
output: standard(z60.object({ success: z60.boolean() })),
|
|
10296
|
-
describe: "Answers a question a card's agent asked in the card chat
|
|
10328
|
+
describe: "Answers a question a card's agent asked in the card chat. Saves the answers on the question, posts them as the caller's chat message and hands them to the agent, waking its sleeping workspace. Refuses a question that is already answered."
|
|
10297
10329
|
}),
|
|
10298
10330
|
clearAgentTodos: mutation({
|
|
10299
10331
|
input: ClearAgentTodosRequestSchema,
|
|
@@ -17236,6 +17268,36 @@ ${q.question}${q.options.length ? "\n" + q.options.map((o) => `- ${o.label}: ${o
|
|
|
17236
17268
|
this.pendingAnswerResolvers.delete(requestId);
|
|
17237
17269
|
}
|
|
17238
17270
|
}
|
|
17271
|
+
/**
|
|
17272
|
+
* Save a terminal AskUserQuestion as a poll in the card's chat, so it stays
|
|
17273
|
+
* answerable after this pod sleeps. Resolves false on ANY failure, an API
|
|
17274
|
+
* that predates the method included: the caller then keeps the old
|
|
17275
|
+
* behavior (the question lives only in this pod).
|
|
17276
|
+
*/
|
|
17277
|
+
async recordAgentQuestion(requestId, questions) {
|
|
17278
|
+
try {
|
|
17279
|
+
const { messageId } = await this.call("recordAgentQuestion", {
|
|
17280
|
+
sessionId: this.config.sessionId,
|
|
17281
|
+
requestId,
|
|
17282
|
+
questions
|
|
17283
|
+
});
|
|
17284
|
+
return messageId !== null;
|
|
17285
|
+
} catch (err) {
|
|
17286
|
+
logger.warn("could not save the question as a card poll", {
|
|
17287
|
+
requestId,
|
|
17288
|
+
error: err instanceof Error ? err.message : String(err)
|
|
17289
|
+
});
|
|
17290
|
+
return false;
|
|
17291
|
+
}
|
|
17292
|
+
}
|
|
17293
|
+
/** The human answered the saved poll in the terminal. Fire-and-forget. */
|
|
17294
|
+
markAgentQuestionAnswered(requestId) {
|
|
17295
|
+
void this.call("markAgentQuestionAnswered", {
|
|
17296
|
+
sessionId: this.config.sessionId,
|
|
17297
|
+
requestId
|
|
17298
|
+
}).catch(() => {
|
|
17299
|
+
});
|
|
17300
|
+
}
|
|
17239
17301
|
// ── Typed service method wrappers ───────────────────────────────────
|
|
17240
17302
|
getTaskProperties() {
|
|
17241
17303
|
return this.call("getTaskProperties", { sessionId: this.config.sessionId });
|
package/dist/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
WorkspaceCommandSupervisor,
|
|
8
8
|
startWorkspaceCommandsAfterConnect,
|
|
9
9
|
stopWorkspaceCommands
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-OFGV5G4O.js";
|
|
11
11
|
import {
|
|
12
12
|
PtyHarness,
|
|
13
13
|
SessionRunner,
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
resolveTuiKindFromEnv,
|
|
26
26
|
sampleKeyUsage,
|
|
27
27
|
usesNativeUsageReporting
|
|
28
|
-
} from "./chunk-
|
|
28
|
+
} from "./chunk-TGU3DX5B.js";
|
|
29
29
|
import "./chunk-V5WR2F2P.js";
|
|
30
30
|
import {
|
|
31
31
|
inheritedEnv,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
createServiceLogger,
|
|
42
42
|
loadAndAnnotateDiscoveredPorts,
|
|
43
43
|
loadConveyorConfig
|
|
44
|
-
} from "./chunk-
|
|
44
|
+
} from "./chunk-YQLVANEA.js";
|
|
45
45
|
import "./chunk-VIUZS7V4.js";
|
|
46
46
|
import "./chunk-W4LZ7R6Z.js";
|
|
47
47
|
import "./chunk-372R6E4C.js";
|
|
@@ -1399,7 +1399,7 @@ if (!RUNNER_MODES.includes(CONVEYOR_MODE)) {
|
|
|
1399
1399
|
process.exit(1);
|
|
1400
1400
|
}
|
|
1401
1401
|
if (CONVEYOR_MODE === "serving") {
|
|
1402
|
-
const { runServingSession } = await import("./serve-boot-
|
|
1402
|
+
const { runServingSession } = await import("./serve-boot-JWGICOM7.js");
|
|
1403
1403
|
exitContext.runnerMode = "serving";
|
|
1404
1404
|
exitContext.sessionId = process.env.CONVEYOR_SESSION_ID ?? exitContext.sessionId;
|
|
1405
1405
|
const outcome = await runServingSession({
|
package/dist/index.d.ts
CHANGED
|
@@ -385,6 +385,15 @@ declare class AgentConnection {
|
|
|
385
385
|
resetsAt: string;
|
|
386
386
|
}>;
|
|
387
387
|
askUserQuestion(questions: AgentQuestion[]): Promise<Record<string, string>>;
|
|
388
|
+
/**
|
|
389
|
+
* Save a terminal AskUserQuestion as a poll in the card's chat, so it stays
|
|
390
|
+
* answerable after this pod sleeps. Resolves false on ANY failure, an API
|
|
391
|
+
* that predates the method included: the caller then keeps the old
|
|
392
|
+
* behavior (the question lives only in this pod).
|
|
393
|
+
*/
|
|
394
|
+
recordAgentQuestion(requestId: string, questions: AgentQuestion[]): Promise<boolean>;
|
|
395
|
+
/** The human answered the saved poll in the terminal. Fire-and-forget. */
|
|
396
|
+
markAgentQuestionAnswered(requestId: string): void;
|
|
388
397
|
getTaskProperties(): Promise<{
|
|
389
398
|
plan?: string;
|
|
390
399
|
storyPointId?: string;
|
|
@@ -778,6 +787,10 @@ declare class SessionRunner {
|
|
|
778
787
|
* liveness hold above is bounded by timestamp arithmetic, so a lost timer
|
|
779
788
|
* still expires the hold — it just skips the un-park injection. */
|
|
780
789
|
private questionGraceTimer;
|
|
790
|
+
/** What the parked questionnaire asked, and whether the API saved it as a
|
|
791
|
+
* card poll — read when the grace expires, to word the timeout prompt.
|
|
792
|
+
* Cleared with the hold. */
|
|
793
|
+
private pendingQuestion;
|
|
781
794
|
constructor(config: SessionRunnerConfig, callbacks: SessionRunnerCallbacks, deps?: SessionRunnerDependencies);
|
|
782
795
|
get state(): AgentRunnerStatus;
|
|
783
796
|
/**
|
|
@@ -1187,7 +1200,8 @@ interface AgentRunnerConfig {
|
|
|
1187
1200
|
* Question-pending transitions surfaced to the runner by the event loop
|
|
1188
1201
|
* (`applyQuestionTransitions` in execution/event-processor.ts):
|
|
1189
1202
|
* - `armed` — the PTY hook observed an AskUserQuestion; a questionnaire is
|
|
1190
|
-
* parked on a human.
|
|
1203
|
+
* parked on a human. `questions` are what it asked, and `persisted` says
|
|
1204
|
+
* the API saved them as a card poll, which outlives this pod.
|
|
1191
1205
|
* - `answered` — the questionnaire resolved (PostToolUse envelope, or a new
|
|
1192
1206
|
* assistant record without the question block).
|
|
1193
1207
|
* - `turn_ended` — the turn's `result` arrived while the questionnaire was
|
|
@@ -1198,6 +1212,8 @@ interface AgentRunnerConfig {
|
|
|
1198
1212
|
type UserQuestionSignal = {
|
|
1199
1213
|
kind: "armed";
|
|
1200
1214
|
questionText?: string;
|
|
1215
|
+
questions?: _project_shared.AgentQuestion[];
|
|
1216
|
+
persisted?: boolean;
|
|
1201
1217
|
} | {
|
|
1202
1218
|
kind: "answered";
|
|
1203
1219
|
} | {
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
SessionRunner,
|
|
3
3
|
unshallowRepo
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-TGU3DX5B.js";
|
|
5
5
|
import "./chunk-V5WR2F2P.js";
|
|
6
6
|
import "./chunk-76JCOHPE.js";
|
|
7
7
|
import {
|
|
@@ -17,7 +17,7 @@ import {
|
|
|
17
17
|
stageAndCommit,
|
|
18
18
|
updateRemoteToken,
|
|
19
19
|
workspacePathExists
|
|
20
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-YQLVANEA.js";
|
|
21
21
|
import "./chunk-VIUZS7V4.js";
|
|
22
22
|
import {
|
|
23
23
|
runAuthTokenCommand,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
WorkspaceCommandSupervisor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-OFGV5G4O.js";
|
|
4
4
|
import {
|
|
5
5
|
AgentConnection,
|
|
6
6
|
DEFAULT_LIFECYCLE_CONFIG,
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
ensureOnTaskBranch,
|
|
12
12
|
loadAndAnnotateDiscoveredPorts,
|
|
13
13
|
loadConveyorConfig
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-YQLVANEA.js";
|
|
15
15
|
import "./chunk-VIUZS7V4.js";
|
|
16
16
|
import "./chunk-W4LZ7R6Z.js";
|
|
17
17
|
import "./chunk-PIHFGSXB.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rallycry/conveyor-agent",
|
|
3
|
-
"version": "11.1.
|
|
3
|
+
"version": "11.1.7",
|
|
4
4
|
"description": "Conveyor Agent Runner v10 - PTY harness for the task chat (SDK harness for audit/project-chat). Agent-as-User architecture with BaseService patterns. Works locally too.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agent",
|