@rallycry/conveyor-agent 11.1.5 → 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/{boot-3FWYGHSN.js → boot-6QUJHRWD.js} +4 -4
- package/dist/{chunk-ILDV4TNW.js → chunk-OFGV5G4O.js} +1 -1
- package/dist/{chunk-MILKMRPU.js → chunk-PIHFGSXB.js} +3037 -2321
- package/dist/{chunk-5TGLNTVH.js → chunk-TGU3DX5B.js} +220 -49
- package/dist/chunk-UP4XACLL.js +1613 -0
- package/dist/{chunk-TPOWIJ5P.js → chunk-YQLVANEA.js} +105 -8
- package/dist/cli.js +8 -7
- package/dist/heartbeat-worker.js +2 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +4 -3
- package/dist/remote-2H36LTGP-XZSIM243.js +9 -0
- package/dist/{serve-boot-GDVLSYPX.js → serve-boot-JWGICOM7.js} +4 -3
- package/dist/{server-3SSY4JV7.js → server-CGCSZ3WJ.js} +2 -2
- package/package.json +3 -3
- package/skills/conveyor-workflows/SKILL.md +8 -0
- package/dist/{chunk-MFGRXD4Y.js → chunk-LUAOWQ6W.js} +3 -3
|
@@ -97,9 +97,10 @@ import {
|
|
|
97
97
|
stageAndCommit,
|
|
98
98
|
statWorkspacePath,
|
|
99
99
|
subProjectScopePaths,
|
|
100
|
+
toMemberMentionRows,
|
|
100
101
|
updateRemoteToken,
|
|
101
102
|
verifyGitCredential
|
|
102
|
-
} from "./chunk-
|
|
103
|
+
} from "./chunk-YQLVANEA.js";
|
|
103
104
|
import {
|
|
104
105
|
reportBootMilestone
|
|
105
106
|
} from "./chunk-VIUZS7V4.js";
|
|
@@ -118,7 +119,7 @@ import {
|
|
|
118
119
|
import {
|
|
119
120
|
LoopLagMonitor,
|
|
120
121
|
loopStatusForRunnerStatus
|
|
121
|
-
} from "./chunk-
|
|
122
|
+
} from "./chunk-PIHFGSXB.js";
|
|
122
123
|
import {
|
|
123
124
|
getWorkbenchClient
|
|
124
125
|
} from "./chunk-SQM2BQ7H.js";
|
|
@@ -3349,6 +3350,12 @@ var PtySession = class {
|
|
|
3349
3350
|
// type chat text into the questionnaire. Fail-safe — a stale flag only
|
|
3350
3351
|
// costs a teardown + respawn (`--resume` recovers the conversation).
|
|
3351
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;
|
|
3352
3359
|
// Parked-permission-dialog backstop (see handleHookNotification). The last
|
|
3353
3360
|
// tool the PreToolUse hook saw over the socket, cleared once that tool runs:
|
|
3354
3361
|
// a parked ExitPlanMode/AskUserQuestion dialog is an expected wait, not an
|
|
@@ -3872,9 +3879,8 @@ var PtySession = class {
|
|
|
3872
3879
|
/** Render the question card in the web chat NOW — at hook time — instead of
|
|
3873
3880
|
* whenever the CLI flushes the transcript records (which is only after the
|
|
3874
3881
|
* questionnaire resolves; see the field comment). */
|
|
3875
|
-
emitSyntheticQuestionCard(questions) {
|
|
3882
|
+
emitSyntheticQuestionCard(questions, id) {
|
|
3876
3883
|
if (questions.length === 0 || typeof this.bridge?.sendChatEvent !== "function") return;
|
|
3877
|
-
const id = `aq-${randomUUID()}`;
|
|
3878
3884
|
this.pendingSyntheticQuestionIds.push(id);
|
|
3879
3885
|
this.sendChatEvent({
|
|
3880
3886
|
kind: "tool_use",
|
|
@@ -3925,6 +3931,7 @@ var PtySession = class {
|
|
|
3925
3931
|
*/
|
|
3926
3932
|
injectIntoRunningTurn(text) {
|
|
3927
3933
|
if (!this.pty || this._toreDown || this.exited) return false;
|
|
3934
|
+
if (this.questionnairePending) return false;
|
|
3928
3935
|
if (this.activeQueue === null) return false;
|
|
3929
3936
|
if (!this.adapter.capabilities.structuredEvents) return false;
|
|
3930
3937
|
if (!text.trim()) return false;
|
|
@@ -3973,6 +3980,7 @@ var PtySession = class {
|
|
|
3973
3980
|
if (this._toreDown) return;
|
|
3974
3981
|
this._toreDown = true;
|
|
3975
3982
|
this.questionnairePending = false;
|
|
3983
|
+
this.openQuestionRequestId = null;
|
|
3976
3984
|
this.disarmPlanDialogAutoAccept();
|
|
3977
3985
|
this.disarmSubmitNudge();
|
|
3978
3986
|
this.closeSyntheticQuestionCards();
|
|
@@ -4268,7 +4276,12 @@ var PtySession = class {
|
|
|
4268
4276
|
if (this.pendingPlanApproval && progress.tool_name === "ExitPlanMode") {
|
|
4269
4277
|
this.disarmPlanDialogAutoAccept();
|
|
4270
4278
|
}
|
|
4271
|
-
|
|
4279
|
+
let answeredRequestId = null;
|
|
4280
|
+
if (progress.tool_name === "AskUserQuestion") {
|
|
4281
|
+
this.questionnairePending = false;
|
|
4282
|
+
answeredRequestId = this.openQuestionRequestId;
|
|
4283
|
+
this.openQuestionRequestId = null;
|
|
4284
|
+
}
|
|
4272
4285
|
this.permissionAlertArmed = false;
|
|
4273
4286
|
if (progress.tool_name !== void 0 && progress.tool_name === this.lastPreToolUseTool) {
|
|
4274
4287
|
this.lastPreToolUseTool = null;
|
|
@@ -4277,7 +4290,8 @@ var PtySession = class {
|
|
|
4277
4290
|
this.pushEvent({
|
|
4278
4291
|
type: "tool_progress",
|
|
4279
4292
|
...progress.tool_name === void 0 ? {} : { tool_name: progress.tool_name },
|
|
4280
|
-
...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 } : {}
|
|
4281
4295
|
});
|
|
4282
4296
|
}
|
|
4283
4297
|
/**
|
|
@@ -4296,8 +4310,10 @@ var PtySession = class {
|
|
|
4296
4310
|
this.disarmPlanDialogAutoAccept();
|
|
4297
4311
|
this.questionnairePending = true;
|
|
4298
4312
|
const questions = parseUserQuestions(request.tool_input);
|
|
4299
|
-
|
|
4300
|
-
this.
|
|
4313
|
+
const requestId = `aq-${randomUUID()}`;
|
|
4314
|
+
this.openQuestionRequestId = requestId;
|
|
4315
|
+
this.pushEvent({ type: "user_question", questions, requestId });
|
|
4316
|
+
this.emitSyntheticQuestionCard(questions, requestId);
|
|
4301
4317
|
return { decision: "allow" };
|
|
4302
4318
|
}
|
|
4303
4319
|
const canUseTool = this.turn.canUseTool;
|
|
@@ -6045,7 +6061,6 @@ import {
|
|
|
6045
6061
|
closeSync,
|
|
6046
6062
|
existsSync,
|
|
6047
6063
|
openSync,
|
|
6048
|
-
readFileSync as readFileSync3,
|
|
6049
6064
|
readSync,
|
|
6050
6065
|
renameSync as renameSync2,
|
|
6051
6066
|
statSync as statSync2,
|
|
@@ -7142,6 +7157,7 @@ ${context.agentInstructions}`);
|
|
|
7142
7157
|
`
|
|
7143
7158
|
Your turn output appears ONLY in the live agent terminal \u2014 it is NOT posted to the task chat. The team does NOT see your replies unless you post them.`,
|
|
7144
7159
|
`Use post_to_chat (omit task_id \u2192 your own task's chat) to share meaningful status as you work, a summary when you finish, and any blocker or question you need a human to answer.`,
|
|
7160
|
+
`To loop in a specific teammate, mention them in post_to_chat as @[user:<name, email or user id>]; list_project_members gives exact tokens. A mention pings that person in Slack/Discord and in Conveyor, so use it only when you need them. Never write raw Slack IDs.`,
|
|
7145
7161
|
`A question you need answered goes through AskUserQuestion \u2014 that is what pages a person. post_to_chat with milestone: "blocked" records that you are parked and does not page anyone.`,
|
|
7146
7162
|
`Pass task_id only to reach a DIFFERENT card: a child task's chat on post_to_chat and read_task_chat, or any card in this project's files on list_task_files and get_attachment (a pack parent's source documents, for example). Omit it for your own card.`,
|
|
7147
7163
|
`Use read_task_chat only if you need to re-read earlier messages beyond the chat context above.`,
|
|
@@ -7357,6 +7373,11 @@ function buildFreshInstructions(isPlanning, context) {
|
|
|
7357
7373
|
`You are the Planner on this card \u2014 scope and plan it with the team. A separate Builder session implements it.`
|
|
7358
7374
|
) : builderKickoff(context, `You are the Builder on this card \u2014 implement its plan.`);
|
|
7359
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
|
+
}
|
|
7360
7381
|
function buildFreshCodeReviewInstructions(context) {
|
|
7361
7382
|
const parts = [...buildSkillInvocation("/conveyor-review"), branchRule(context, true)];
|
|
7362
7383
|
if (context.githubPRUrl) {
|
|
@@ -7385,7 +7406,7 @@ function buildIdleRelaunchInstructions(context, isPlanning) {
|
|
|
7385
7406
|
...builderKickoff(context, `You are the Builder on this card \u2014 pick up where you left off.`)
|
|
7386
7407
|
];
|
|
7387
7408
|
}
|
|
7388
|
-
function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
7409
|
+
function buildInstructions(mode, context, scenario, agentMode, isAuto, resumed) {
|
|
7389
7410
|
const parts = [`
|
|
7390
7411
|
## Instructions`];
|
|
7391
7412
|
const isPm = mode === "pm";
|
|
@@ -7400,7 +7421,9 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
|
7400
7421
|
return parts;
|
|
7401
7422
|
}
|
|
7402
7423
|
if (scenario === "fresh") {
|
|
7403
|
-
parts.push(
|
|
7424
|
+
parts.push(
|
|
7425
|
+
...isPlanning && resumed ? buildResumedPlannerInstructions() : buildFreshInstructions(isPlanning, context)
|
|
7426
|
+
);
|
|
7404
7427
|
return parts;
|
|
7405
7428
|
}
|
|
7406
7429
|
const newBatch = relaunchMessageBatch(context);
|
|
@@ -7420,7 +7443,7 @@ function buildInstructions(mode, context, scenario, agentMode, isAuto) {
|
|
|
7420
7443
|
parts.push(...buildFeedbackInstructions(context, isPlanning));
|
|
7421
7444
|
return parts;
|
|
7422
7445
|
}
|
|
7423
|
-
async function buildInitialPrompt(mode, context, isAuto, agentMode) {
|
|
7446
|
+
async function buildInitialPrompt(mode, context, isAuto, agentMode, opts) {
|
|
7424
7447
|
const isPackRunner = isPackRunnerSession(mode);
|
|
7425
7448
|
if (!isPackRunner) {
|
|
7426
7449
|
const sessionRelaunch = buildRelaunchWithSession(mode, context, agentMode, isAuto);
|
|
@@ -7434,7 +7457,7 @@ async function buildInitialPrompt(mode, context, isAuto, agentMode) {
|
|
|
7434
7457
|
scenario = "fresh";
|
|
7435
7458
|
}
|
|
7436
7459
|
const body = await buildTaskBody(context, mode);
|
|
7437
|
-
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);
|
|
7438
7461
|
return [...body, ...instructions].join("\n");
|
|
7439
7462
|
}
|
|
7440
7463
|
|
|
@@ -7537,6 +7560,29 @@ var mcpProjectId = f.optional(f.string({ desc: "Target Conveyor project ID" }));
|
|
|
7537
7560
|
var cardDescriptionDesc = (lead) => `${lead} \u2014 ${CARD_DESCRIPTION_FIELD_HINT}`;
|
|
7538
7561
|
var storyPointValueDesc = "Story point value (1=Common, 2=Magic, 3=Rare, 5=Unique)";
|
|
7539
7562
|
var priorityValueDesc = "Priority value from manage_priorities list (1 = the project's highest level; seeded defaults are 1=High, 2=Medium, 3=Low)";
|
|
7563
|
+
var MENTION_HOW = "To mention a teammate, write @[user:<name, email or user id>]; list_project_members gives exact tokens.";
|
|
7564
|
+
var MENTION_STRICT = "A name that matches nobody, or several people, fails the post with suggestions. Never write raw Slack or Discord IDs (<@U\u2026>).";
|
|
7565
|
+
var CHAT_MENTION_GUIDANCE = `${MENTION_HOW} Conveyor turns it into a real Slack/Discord mention plus an in-app alert. ${MENTION_STRICT}`;
|
|
7566
|
+
var CHANNEL_MENTION_GUIDANCE = `${MENTION_HOW} Conveyor turns it into a real Slack/Discord mention. ${MENTION_STRICT}`;
|
|
7567
|
+
var MEMBERS_DESCRIPTION = "List this project's members, the people you can mention, assign, or add as reviewer. Each row has userId, name, email, access level, and a ready-to-paste `mention` token (@[user:<id>]). Pass query to filter by name or email.";
|
|
7568
|
+
var QUERY_DESC = "Keep only members whose name or email contains this text, case-insensitively. Omit to list everyone.";
|
|
7569
|
+
var listProjectMembersContract = defineToolContract({
|
|
7570
|
+
name: "list_project_members",
|
|
7571
|
+
agent: {
|
|
7572
|
+
description: MEMBERS_DESCRIPTION,
|
|
7573
|
+
fields: {
|
|
7574
|
+
query: f.optional(f.string({ desc: QUERY_DESC, max: 100 }))
|
|
7575
|
+
}
|
|
7576
|
+
},
|
|
7577
|
+
mcp: {
|
|
7578
|
+
description: `${MEMBERS_DESCRIPTION} Pass projectId to target a specific project; otherwise the configured default project is used.`,
|
|
7579
|
+
fields: {
|
|
7580
|
+
projectId: mcpProjectId,
|
|
7581
|
+
query: f.optional(f.string({ desc: QUERY_DESC, max: 100 }))
|
|
7582
|
+
}
|
|
7583
|
+
}
|
|
7584
|
+
});
|
|
7585
|
+
var membersContracts = [listProjectMembersContract];
|
|
7540
7586
|
var getTaskContract = defineToolContract({
|
|
7541
7587
|
name: "get_task",
|
|
7542
7588
|
agent: {
|
|
@@ -7563,7 +7609,9 @@ var postToChatContract = defineToolContract({
|
|
|
7563
7609
|
agent: {
|
|
7564
7610
|
description: "Post a message to the task chat for the team to see. Your turn output is NOT shown in chat, so this is the only way the team sees your status, summaries, and questions. Omit task_id to post to the current task's chat; pass a child's ID to message its chat.",
|
|
7565
7611
|
fields: {
|
|
7566
|
-
message: f.optional(
|
|
7612
|
+
message: f.optional(
|
|
7613
|
+
f.string({ desc: `The message to post to the team. ${CHAT_MENTION_GUIDANCE}` })
|
|
7614
|
+
),
|
|
7567
7615
|
content: f.optional(
|
|
7568
7616
|
f.string({
|
|
7569
7617
|
desc: "Alias of `message` (the external conveyor-mcp surface names this field `content`). Provide exactly one of the two."
|
|
@@ -7586,7 +7634,7 @@ var postToChatContract = defineToolContract({
|
|
|
7586
7634
|
fields: {
|
|
7587
7635
|
projectId: mcpProjectId,
|
|
7588
7636
|
taskId: f.string({ desc: "The task ID" }),
|
|
7589
|
-
content: f.optional(f.string({ desc:
|
|
7637
|
+
content: f.optional(f.string({ desc: `Message content. ${CHAT_MENTION_GUIDANCE}` })),
|
|
7590
7638
|
message: f.optional(
|
|
7591
7639
|
f.string({
|
|
7592
7640
|
desc: "Alias of `content` (the in-pod agent surface names this field `message`). Provide exactly one of the two."
|
|
@@ -8803,6 +8851,7 @@ var createPullRequestContract = defineToolContract({
|
|
|
8803
8851
|
var pullRequestContracts = [createPullRequestContract];
|
|
8804
8852
|
var REGISTRY_RULE = "Only channels an admin registered as work channels in project settings are reachable \u2014 an unregistered channel is invisible here no matter what the bot can see in the workspace, and the card-sync channels are NOT automatically included.";
|
|
8805
8853
|
var NO_STORAGE = "Messages are fetched live from Slack/Discord on every call and are never stored by Conveyor.";
|
|
8854
|
+
var READ_MENTIONS = "People who are Conveyor users appear in `text` as @[user:<id>] tokens instead of raw Slack or Discord ids, and `authorMention` is the author's token when the author is one. Reuse those tokens to mention people back.";
|
|
8806
8855
|
var listProjectIntegrationsContract = defineToolContract({
|
|
8807
8856
|
name: "list_project_integrations",
|
|
8808
8857
|
agent: {
|
|
@@ -8837,7 +8886,7 @@ var THREAD_DESC = "Read one thread instead of the channel surface. Pass a `threa
|
|
|
8837
8886
|
var readChannelMessagesContract = defineToolContract({
|
|
8838
8887
|
name: "read_channel_messages",
|
|
8839
8888
|
agent: {
|
|
8840
|
-
description: `Read recent messages from a registered work channel, newest first \u2014 to catch up on a discussion, find the context behind a decision, or check whether something was already raised. Each message reports its author, whether that author is a bot (Conveyor's own card feed posts show up here too, so check this before treating a message as a teammate's), its text, and a cursor for paging further back. ${REGISTRY_RULE} ${NO_STORAGE}`,
|
|
8889
|
+
description: `Read recent messages from a registered work channel, newest first \u2014 to catch up on a discussion, find the context behind a decision, or check whether something was already raised. Each message reports its author, whether that author is a bot (Conveyor's own card feed posts show up here too, so check this before treating a message as a teammate's), its text, and a cursor for paging further back. ${READ_MENTIONS} ${REGISTRY_RULE} ${NO_STORAGE}`,
|
|
8841
8890
|
fields: {
|
|
8842
8891
|
channelId: f.string({ desc: CHANNEL_ID_DESC }),
|
|
8843
8892
|
limit: f.optional(f.number({ desc: LIMIT_DESC, int: true, min: 1, max: 50 })),
|
|
@@ -8847,7 +8896,7 @@ var readChannelMessagesContract = defineToolContract({
|
|
|
8847
8896
|
}
|
|
8848
8897
|
},
|
|
8849
8898
|
mcp: {
|
|
8850
|
-
description: `Read recent messages from a project's registered work channel, newest first. Each message carries author name, a bot flag, text, a provider-native cursor, and a timestamp; the response carries an olderCursor for paging back. ${REGISTRY_RULE} ${NO_STORAGE} Pass projectId to target a specific project; otherwise the configured default project is used.`,
|
|
8899
|
+
description: `Read recent messages from a project's registered work channel, newest first. Each message carries author name, a bot flag, text, a provider-native cursor, and a timestamp; the response carries an olderCursor for paging back. ${READ_MENTIONS} ${REGISTRY_RULE} ${NO_STORAGE} Pass projectId to target a specific project; otherwise the configured default project is used.`,
|
|
8851
8900
|
fields: {
|
|
8852
8901
|
projectId: mcpProjectId,
|
|
8853
8902
|
channelId: f.string({ desc: CHANNEL_ID_DESC }),
|
|
@@ -8858,7 +8907,7 @@ var readChannelMessagesContract = defineToolContract({
|
|
|
8858
8907
|
}
|
|
8859
8908
|
}
|
|
8860
8909
|
});
|
|
8861
|
-
var POST_TEXT_DESC =
|
|
8910
|
+
var POST_TEXT_DESC = `What to say, in plain text or light markdown. An attribution footer naming you is appended automatically, so do not sign the message yourself. ${CHANNEL_MENTION_GUIDANCE} Channel-wide and group pings (@everyone, @here, <!channel>, <!subteam^\u2026>) are rendered as ordinary text and will not notify anyone.`;
|
|
8862
8911
|
var POST_THREAD_DESC = "Reply inside a thread rather than to the channel. Prefer this when responding to a specific message \u2014 pass the `threadTs` from the message you are answering.";
|
|
8863
8912
|
var POST_WARNING = "This is visible to everyone in the channel and cannot be edited or deleted afterwards. Posting requires a per-channel grant that is OFF by default, separate from read access, so most registered channels will refuse it.";
|
|
8864
8913
|
var postChannelMessageContract = defineToolContract({
|
|
@@ -9670,6 +9719,7 @@ var TOOL_CONTRACTS = Object.fromEntries(
|
|
|
9670
9719
|
...decisionsContracts,
|
|
9671
9720
|
...pullRequestContracts,
|
|
9672
9721
|
...integrationsContracts,
|
|
9722
|
+
...membersContracts,
|
|
9673
9723
|
...driveContracts,
|
|
9674
9724
|
...meetingsContracts,
|
|
9675
9725
|
...logsContracts,
|
|
@@ -10231,6 +10281,7 @@ function buildPostToChatTool(connection) {
|
|
|
10231
10281
|
await connection.call("postToChat", { message: text, milestone });
|
|
10232
10282
|
return textResult(JSON.stringify({ posted: true }));
|
|
10233
10283
|
} catch (error) {
|
|
10284
|
+
if (!task_id) connection.untrackRecentMessage(text);
|
|
10234
10285
|
return textResult(
|
|
10235
10286
|
`Failed to post message: ${error instanceof Error ? error.message : "Unknown error"}`
|
|
10236
10287
|
);
|
|
@@ -11891,6 +11942,22 @@ function buildListProjectIntegrationsTool(connection, projectId) {
|
|
|
11891
11942
|
}
|
|
11892
11943
|
});
|
|
11893
11944
|
}
|
|
11945
|
+
function buildListProjectMembersTool(connection, projectId) {
|
|
11946
|
+
return defineContractTool(listProjectMembersContract, async (input) => {
|
|
11947
|
+
try {
|
|
11948
|
+
const members = await connection.call("listProjectMembers", { projectId });
|
|
11949
|
+
const rows = toMemberMentionRows(members, input.query);
|
|
11950
|
+
if (rows.length === 0 && input.query) {
|
|
11951
|
+
return textResult(
|
|
11952
|
+
`No member's name or email contains "${input.query}". Call list_project_members without a query to see everyone you can mention.`
|
|
11953
|
+
);
|
|
11954
|
+
}
|
|
11955
|
+
return textResult(JSON.stringify(rows, null, 2));
|
|
11956
|
+
} catch (error) {
|
|
11957
|
+
return errText3("Failed to list project members", error);
|
|
11958
|
+
}
|
|
11959
|
+
});
|
|
11960
|
+
}
|
|
11894
11961
|
function buildListProjectChannelsTool(connection, projectId) {
|
|
11895
11962
|
return defineContractTool(listProjectChannelsContract, async () => {
|
|
11896
11963
|
try {
|
|
@@ -12402,6 +12469,7 @@ function connectedToolsFor(connection, context, config) {
|
|
|
12402
12469
|
return [
|
|
12403
12470
|
...context.googleDriveConnected ? buildDriveTools(connection, projectId) : [],
|
|
12404
12471
|
buildListProjectIntegrationsTool(connection, projectId),
|
|
12472
|
+
buildListProjectMembersTool(connection, projectId),
|
|
12405
12473
|
...context.chatChannelsConfigured ? buildChannelTools(connection, projectId) : [],
|
|
12406
12474
|
...context.meetingsAvailable ? buildMeetingTools(connection, projectId) : [],
|
|
12407
12475
|
// Always available: the decision tables exist on every project, and a fork
|
|
@@ -12992,15 +13060,18 @@ function questionTextFromEvent(event) {
|
|
|
12992
13060
|
async function armQuestionPending(host, state, event) {
|
|
12993
13061
|
state.questionPending = true;
|
|
12994
13062
|
const questionText = questionTextFromEvent(event);
|
|
12995
|
-
host.callbacks.onUserQuestion?.({
|
|
12996
|
-
kind: "armed",
|
|
12997
|
-
...questionText === void 0 ? {} : { questionText }
|
|
12998
|
-
});
|
|
12999
13063
|
await host.connection.emitStatus(
|
|
13000
13064
|
"waiting_for_input",
|
|
13001
13065
|
AGENT_STATUS_REASON_USER_QUESTION,
|
|
13002
13066
|
questionText
|
|
13003
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
|
+
});
|
|
13004
13075
|
await host.callbacks.onStatusChange("waiting_for_input");
|
|
13005
13076
|
}
|
|
13006
13077
|
async function clearQuestionPending(host, state, options) {
|
|
@@ -13024,6 +13095,7 @@ async function applyQuestionTransitions(event, host, state) {
|
|
|
13024
13095
|
return;
|
|
13025
13096
|
case "tool_progress":
|
|
13026
13097
|
if (event.tool_name === "AskUserQuestion") {
|
|
13098
|
+
if (event.requestId) host.connection.markAgentQuestionAnswered(event.requestId);
|
|
13027
13099
|
await clearQuestionPending(host, state, { emitRunning: true });
|
|
13028
13100
|
}
|
|
13029
13101
|
return;
|
|
@@ -13766,38 +13838,80 @@ function transcriptHasConversation(path) {
|
|
|
13766
13838
|
}
|
|
13767
13839
|
}
|
|
13768
13840
|
}
|
|
13841
|
+
var REPAIR_TAIL_WINDOW_BYTES = 1024 * 1024;
|
|
13842
|
+
var NEWLINE = 10;
|
|
13769
13843
|
function repairTornSessionFile(path) {
|
|
13844
|
+
let fd;
|
|
13770
13845
|
try {
|
|
13771
13846
|
if (!existsSync(path)) return false;
|
|
13772
|
-
const
|
|
13773
|
-
if (
|
|
13774
|
-
|
|
13775
|
-
|
|
13776
|
-
|
|
13777
|
-
|
|
13778
|
-
while (keepEnd > 0) {
|
|
13779
|
-
const prevNewline = content.lastIndexOf("\n", keepEnd - 2);
|
|
13780
|
-
const line = content.slice(prevNewline + 1, keepEnd - 1).trim();
|
|
13781
|
-
if (line.length > 0) {
|
|
13782
|
-
try {
|
|
13783
|
-
JSON.parse(line);
|
|
13784
|
-
break;
|
|
13785
|
-
} catch {
|
|
13786
|
-
}
|
|
13787
|
-
}
|
|
13788
|
-
keepEnd = prevNewline + 1;
|
|
13789
|
-
}
|
|
13790
|
-
if (keepEnd === content.length) return false;
|
|
13791
|
-
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);
|
|
13792
13853
|
logger6.warn("Repaired torn transcript before resume", {
|
|
13793
13854
|
path,
|
|
13794
|
-
trimmedBytes:
|
|
13855
|
+
trimmedBytes: size - keepEnd
|
|
13795
13856
|
});
|
|
13796
13857
|
return true;
|
|
13797
13858
|
} catch {
|
|
13798
13859
|
return false;
|
|
13860
|
+
} finally {
|
|
13861
|
+
if (fd !== void 0) {
|
|
13862
|
+
try {
|
|
13863
|
+
closeSync(fd);
|
|
13864
|
+
} catch {
|
|
13865
|
+
}
|
|
13866
|
+
}
|
|
13799
13867
|
}
|
|
13800
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;
|
|
13912
|
+
}
|
|
13913
|
+
return keepEnd;
|
|
13914
|
+
}
|
|
13801
13915
|
function resolvePromptDelivery(inputs) {
|
|
13802
13916
|
if (inputs.harnessKind !== "pty") return "submit";
|
|
13803
13917
|
if (inputs.runnerMode === "code-review") return "submit";
|
|
@@ -14252,7 +14366,8 @@ async function runInitialQuery(host, context, options, resume, promptDelivery) {
|
|
|
14252
14366
|
host.config.mode,
|
|
14253
14367
|
context,
|
|
14254
14368
|
host.isAuto,
|
|
14255
|
-
host.agentMode
|
|
14369
|
+
host.agentMode,
|
|
14370
|
+
{ resumed: !!resume }
|
|
14256
14371
|
);
|
|
14257
14372
|
const { prompt, appendSystemPrompt } = selectInitialPromptInput(
|
|
14258
14373
|
promptDelivery,
|
|
@@ -15518,6 +15633,52 @@ function findLiveChild(sources) {
|
|
|
15518
15633
|
return null;
|
|
15519
15634
|
}
|
|
15520
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
|
+
|
|
15521
15682
|
// src/runner/session-runner.ts
|
|
15522
15683
|
var AUTO_RUN_MODES = /* @__PURE__ */ new Set(["building", "auto", "review", "discovery", "chat"]);
|
|
15523
15684
|
var CHILD_DEFER_RECHECK_MS = 60 * 1e3;
|
|
@@ -15530,7 +15691,6 @@ function resolveQuestionGraceMs() {
|
|
|
15530
15691
|
}
|
|
15531
15692
|
var QUESTION_TYPING_RECENT_MS = 6e4;
|
|
15532
15693
|
var QUESTION_TYPING_DEFER_MS = 2 * 6e4;
|
|
15533
|
-
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.';
|
|
15534
15694
|
var SessionRunner = class _SessionRunner {
|
|
15535
15695
|
connection;
|
|
15536
15696
|
mode;
|
|
@@ -15603,6 +15763,10 @@ var SessionRunner = class _SessionRunner {
|
|
|
15603
15763
|
* liveness hold above is bounded by timestamp arithmetic, so a lost timer
|
|
15604
15764
|
* still expires the hold — it just skips the un-park injection. */
|
|
15605
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;
|
|
15606
15770
|
constructor(config, callbacks, deps = {}) {
|
|
15607
15771
|
this.config = config;
|
|
15608
15772
|
this.callbacks = callbacks;
|
|
@@ -16951,6 +17115,10 @@ ${outcome.failures.join("\n")}
|
|
|
16951
17115
|
handleUserQuestionSignal(signal) {
|
|
16952
17116
|
if (signal.kind === "armed") {
|
|
16953
17117
|
this.questionPendingSince = Date.now();
|
|
17118
|
+
this.pendingQuestion = {
|
|
17119
|
+
questions: signal.questions ?? [],
|
|
17120
|
+
persisted: signal.persisted === true
|
|
17121
|
+
};
|
|
16954
17122
|
this.armQuestionGraceTimer(resolveQuestionGraceMs());
|
|
16955
17123
|
this.refreshLoopStatus();
|
|
16956
17124
|
} else if (signal.kind === "answered") {
|
|
@@ -16967,6 +17135,7 @@ ${outcome.failures.join("\n")}
|
|
|
16967
17135
|
clearTimeout(this.questionGraceTimer);
|
|
16968
17136
|
this.questionGraceTimer = null;
|
|
16969
17137
|
}
|
|
17138
|
+
this.pendingQuestion = null;
|
|
16970
17139
|
if (this.questionPendingSince === null) return;
|
|
16971
17140
|
this.questionPendingSince = null;
|
|
16972
17141
|
this.refreshLoopStatus();
|
|
@@ -16994,11 +17163,13 @@ ${outcome.failures.join("\n")}
|
|
|
16994
17163
|
process.stderr.write(
|
|
16995
17164
|
"[conveyor-agent] Question grace expired with no answer \u2014 un-parking the agent\n"
|
|
16996
17165
|
);
|
|
16997
|
-
|
|
16998
|
-
|
|
16999
|
-
|
|
17000
|
-
|
|
17166
|
+
const content = buildQuestionTimeoutPrompt({
|
|
17167
|
+
graceMs: resolveQuestionGraceMs(),
|
|
17168
|
+
questions: this.pendingQuestion?.questions ?? [],
|
|
17169
|
+
persisted: this.pendingQuestion?.persisted ?? false,
|
|
17170
|
+
isPlanner: this.mode.effectiveMode === "discovery"
|
|
17001
17171
|
});
|
|
17172
|
+
this.injectMessage({ content, userId: "system", source: "question_timeout" });
|
|
17002
17173
|
}
|
|
17003
17174
|
/** Mirror the resolved status into the loop-lag buffer so the starvation-proof
|
|
17004
17175
|
* heartbeat worker reports it too. Returns what it wrote. */
|