clisbot 0.1.16 → 0.1.17
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/config/clisbot.json.template +2 -2
- package/dist/main.js +137 -51
- package/package.json +1 -1
|
@@ -194,7 +194,7 @@
|
|
|
194
194
|
"!"
|
|
195
195
|
]
|
|
196
196
|
},
|
|
197
|
-
"streaming": "
|
|
197
|
+
"streaming": "off",
|
|
198
198
|
"response": "final",
|
|
199
199
|
"responseMode": "message-tool",
|
|
200
200
|
"additionalMessageMode": "steer",
|
|
@@ -240,7 +240,7 @@
|
|
|
240
240
|
"!"
|
|
241
241
|
]
|
|
242
242
|
},
|
|
243
|
-
"streaming": "
|
|
243
|
+
"streaming": "off",
|
|
244
244
|
"response": "final",
|
|
245
245
|
"responseMode": "message-tool",
|
|
246
246
|
"additionalMessageMode": "steer",
|
package/dist/main.js
CHANGED
|
@@ -60078,7 +60078,7 @@ var telegramSchema = exports_external.object({
|
|
|
60078
60078
|
slash: ["::", "\\"],
|
|
60079
60079
|
bash: ["!"]
|
|
60080
60080
|
}),
|
|
60081
|
-
streaming: slackStreamingSchema.default("
|
|
60081
|
+
streaming: slackStreamingSchema.default("off"),
|
|
60082
60082
|
response: slackResponseSchema.default("final"),
|
|
60083
60083
|
responseMode: channelResponseModeSchema.default("message-tool"),
|
|
60084
60084
|
additionalMessageMode: channelAdditionalMessageModeSchema.default("steer"),
|
|
@@ -60153,7 +60153,7 @@ var slackSchema = exports_external.object({
|
|
|
60153
60153
|
slash: ["::", "\\"],
|
|
60154
60154
|
bash: ["!"]
|
|
60155
60155
|
}),
|
|
60156
|
-
streaming: slackStreamingSchema.default("
|
|
60156
|
+
streaming: slackStreamingSchema.default("off"),
|
|
60157
60157
|
response: slackResponseSchema.default("final"),
|
|
60158
60158
|
responseMode: channelResponseModeSchema.default("message-tool"),
|
|
60159
60159
|
additionalMessageMode: channelAdditionalMessageModeSchema.default("steer"),
|
|
@@ -60304,7 +60304,7 @@ var clisbotConfigSchema = exports_external.object({
|
|
|
60304
60304
|
slash: ["::", "\\"],
|
|
60305
60305
|
bash: ["!"]
|
|
60306
60306
|
},
|
|
60307
|
-
streaming: "
|
|
60307
|
+
streaming: "off",
|
|
60308
60308
|
response: "final",
|
|
60309
60309
|
responseMode: "message-tool",
|
|
60310
60310
|
additionalMessageMode: "steer",
|
|
@@ -60621,7 +60621,7 @@ function renderDefaultConfigTemplate(options = {}) {
|
|
|
60621
60621
|
slash: ["::", "\\"],
|
|
60622
60622
|
bash: ["!"]
|
|
60623
60623
|
},
|
|
60624
|
-
streaming: "
|
|
60624
|
+
streaming: "off",
|
|
60625
60625
|
response: "final",
|
|
60626
60626
|
responseMode: "message-tool",
|
|
60627
60627
|
additionalMessageMode: "steer",
|
|
@@ -60662,7 +60662,7 @@ function renderDefaultConfigTemplate(options = {}) {
|
|
|
60662
60662
|
slash: ["::", "\\"],
|
|
60663
60663
|
bash: ["!"]
|
|
60664
60664
|
},
|
|
60665
|
-
streaming: "
|
|
60665
|
+
streaming: "off",
|
|
60666
60666
|
response: "final",
|
|
60667
60667
|
responseMode: "message-tool",
|
|
60668
60668
|
additionalMessageMode: "steer",
|
|
@@ -61834,6 +61834,10 @@ function getExecutableNames(command) {
|
|
|
61834
61834
|
// src/runners/tmux/client.ts
|
|
61835
61835
|
var MAIN_WINDOW_NAME = "main";
|
|
61836
61836
|
var TMUX_NOT_FOUND_CODE = "ENOENT";
|
|
61837
|
+
var TMUX_SERVER_DEFAULTS = [
|
|
61838
|
+
["exit-empty", "off"],
|
|
61839
|
+
["destroy-unattached", "off"]
|
|
61840
|
+
];
|
|
61837
61841
|
|
|
61838
61842
|
class TmuxClient {
|
|
61839
61843
|
socketPath;
|
|
@@ -61893,6 +61897,14 @@ class TmuxClient {
|
|
|
61893
61897
|
${result.stdout}`.trim();
|
|
61894
61898
|
return !output.includes("no server running");
|
|
61895
61899
|
}
|
|
61900
|
+
async ensureServerDefaults() {
|
|
61901
|
+
if (!await this.isServerRunning()) {
|
|
61902
|
+
return;
|
|
61903
|
+
}
|
|
61904
|
+
for (const [name, value] of TMUX_SERVER_DEFAULTS) {
|
|
61905
|
+
await this.execOrThrow(["set-option", "-g", name, value]);
|
|
61906
|
+
}
|
|
61907
|
+
}
|
|
61896
61908
|
async newSession(params) {
|
|
61897
61909
|
await this.execOrThrow([
|
|
61898
61910
|
"new-session",
|
|
@@ -61905,6 +61917,7 @@ ${result.stdout}`.trim();
|
|
|
61905
61917
|
params.cwd,
|
|
61906
61918
|
params.command
|
|
61907
61919
|
]);
|
|
61920
|
+
await this.ensureServerDefaults();
|
|
61908
61921
|
await this.freezeWindowName(`${params.sessionName}:${MAIN_WINDOW_NAME}`);
|
|
61909
61922
|
}
|
|
61910
61923
|
async newWindow(params) {
|
|
@@ -64168,7 +64181,7 @@ ${params.text}
|
|
|
64168
64181
|
}
|
|
64169
64182
|
function renderAgentPromptInstruction(params) {
|
|
64170
64183
|
const messageToolMode = (params.responseMode ?? "message-tool") === "message-tool";
|
|
64171
|
-
const progressAllowed = messageToolMode && (params.streaming ?? "
|
|
64184
|
+
const progressAllowed = messageToolMode && (params.streaming ?? "off") === "off";
|
|
64172
64185
|
const lines = [
|
|
64173
64186
|
`[${renderPromptTimestamp()}] ${renderIdentitySummary(params.identity)}`,
|
|
64174
64187
|
"",
|
|
@@ -64265,7 +64278,7 @@ function buildReplyCommand(params) {
|
|
|
64265
64278
|
}
|
|
64266
64279
|
lines.push(" --final \\");
|
|
64267
64280
|
lines.push(' --message "$(cat <<\\__CLISBOT_MESSAGE__');
|
|
64268
|
-
lines.push("<
|
|
64281
|
+
lines.push("<user-facing reply>");
|
|
64269
64282
|
lines.push("__CLISBOT_MESSAGE__");
|
|
64270
64283
|
lines.push(')" \\');
|
|
64271
64284
|
lines.push(" [--media /absolute/path/to/file]");
|
|
@@ -64279,7 +64292,7 @@ function buildReplyCommand(params) {
|
|
|
64279
64292
|
}
|
|
64280
64293
|
lines.push(" --final \\");
|
|
64281
64294
|
lines.push(' --message "$(cat <<\\__CLISBOT_MESSAGE__');
|
|
64282
|
-
lines.push("<
|
|
64295
|
+
lines.push("<user-facing reply>");
|
|
64283
64296
|
lines.push("__CLISBOT_MESSAGE__");
|
|
64284
64297
|
lines.push(')" \\');
|
|
64285
64298
|
lines.push(" [--media /absolute/path/to/file]");
|
|
@@ -64931,11 +64944,50 @@ function extractScrolledAppend(previous, current) {
|
|
|
64931
64944
|
}
|
|
64932
64945
|
return "";
|
|
64933
64946
|
}
|
|
64947
|
+
function deriveRunningInteractionText(previousSnapshot, currentSnapshot) {
|
|
64948
|
+
const previous = cleanInteractionSnapshot(previousSnapshot);
|
|
64949
|
+
const current = cleanInteractionSnapshot(currentSnapshot);
|
|
64950
|
+
if (!current || current === previous) {
|
|
64951
|
+
return "";
|
|
64952
|
+
}
|
|
64953
|
+
if (!previous) {
|
|
64954
|
+
return current;
|
|
64955
|
+
}
|
|
64956
|
+
return extractScrolledAppend(previous, current);
|
|
64957
|
+
}
|
|
64934
64958
|
function deriveInteractionText(initialSnapshot, currentSnapshot) {
|
|
64935
64959
|
const previous = cleanInteractionSnapshot(initialSnapshot);
|
|
64936
64960
|
const current = cleanInteractionSnapshot(currentSnapshot);
|
|
64937
64961
|
return extractScrolledAppend(previous, current) || diffText(previous, current);
|
|
64938
64962
|
}
|
|
64963
|
+
function appendInteractionText(currentBody, nextDelta) {
|
|
64964
|
+
const trimmedCurrent = currentBody.trim();
|
|
64965
|
+
const trimmedDelta = nextDelta.trim();
|
|
64966
|
+
if (!trimmedDelta) {
|
|
64967
|
+
return trimmedCurrent;
|
|
64968
|
+
}
|
|
64969
|
+
if (!trimmedCurrent) {
|
|
64970
|
+
return trimmedDelta;
|
|
64971
|
+
}
|
|
64972
|
+
const currentLines = trimmedCurrent.split(`
|
|
64973
|
+
`);
|
|
64974
|
+
const deltaLines = trimmedDelta.split(`
|
|
64975
|
+
`);
|
|
64976
|
+
const maxOverlap = Math.min(currentLines.length, deltaLines.length, 8);
|
|
64977
|
+
let overlap = 0;
|
|
64978
|
+
for (let size = maxOverlap;size > 0; size -= 1) {
|
|
64979
|
+
const currentSuffix = currentLines.slice(currentLines.length - size).join(`
|
|
64980
|
+
`);
|
|
64981
|
+
const deltaPrefix = deltaLines.slice(0, size).join(`
|
|
64982
|
+
`);
|
|
64983
|
+
if (currentSuffix === deltaPrefix) {
|
|
64984
|
+
overlap = size;
|
|
64985
|
+
break;
|
|
64986
|
+
}
|
|
64987
|
+
}
|
|
64988
|
+
return [...currentLines, ...deltaLines.slice(overlap)].join(`
|
|
64989
|
+
`).trim();
|
|
64990
|
+
}
|
|
64939
64991
|
function truncateTail(raw, maxChars) {
|
|
64940
64992
|
if (raw.length <= maxChars) {
|
|
64941
64993
|
return raw;
|
|
@@ -65713,6 +65765,9 @@ class RunnerSessionService {
|
|
|
65713
65765
|
await ensureRunnerExitRecordDir(this.loadedConfig.stateDir, resolved.sessionName);
|
|
65714
65766
|
const existing = await this.sessionState.getEntry(resolved.sessionKey);
|
|
65715
65767
|
const serverRunning = await this.tmux.isServerRunning();
|
|
65768
|
+
if (serverRunning) {
|
|
65769
|
+
await this.tmux.ensureServerDefaults();
|
|
65770
|
+
}
|
|
65716
65771
|
if (serverRunning && await this.tmux.hasSession(resolved.sessionName)) {
|
|
65717
65772
|
logLatencyDebug("ensure-session-ready-existing-session", timingContext, {
|
|
65718
65773
|
hasStoredSessionId: Boolean(existing?.sessionId)
|
|
@@ -66006,7 +66061,7 @@ async function monitorTmuxRun(params) {
|
|
|
66006
66061
|
let previousSnapshot = params.initialSnapshot;
|
|
66007
66062
|
let lastChangeAt = Date.now();
|
|
66008
66063
|
let sawChange = false;
|
|
66009
|
-
let
|
|
66064
|
+
let cumulativeInteractionSnapshot = "";
|
|
66010
66065
|
let detachedNotified = params.detachedAlready;
|
|
66011
66066
|
let firstMeaningfulDeltaLogged = false;
|
|
66012
66067
|
if (params.prompt) {
|
|
@@ -66032,12 +66087,14 @@ async function monitorTmuxRun(params) {
|
|
|
66032
66087
|
const snapshot = normalizePaneText(await params.tmux.capturePane(params.sessionName, params.captureLines));
|
|
66033
66088
|
const now = Date.now();
|
|
66034
66089
|
if (snapshot !== previousSnapshot) {
|
|
66090
|
+
const priorSnapshot = previousSnapshot;
|
|
66035
66091
|
lastChangeAt = now;
|
|
66036
66092
|
previousSnapshot = snapshot;
|
|
66037
|
-
const
|
|
66038
|
-
|
|
66093
|
+
const interactionDelta = deriveRunningInteractionText(priorSnapshot, snapshot);
|
|
66094
|
+
const nextInteractionSnapshot = appendInteractionText(cumulativeInteractionSnapshot, interactionDelta);
|
|
66095
|
+
if (nextInteractionSnapshot && nextInteractionSnapshot !== cumulativeInteractionSnapshot) {
|
|
66039
66096
|
sawChange = true;
|
|
66040
|
-
|
|
66097
|
+
cumulativeInteractionSnapshot = nextInteractionSnapshot;
|
|
66041
66098
|
if (!firstMeaningfulDeltaLogged) {
|
|
66042
66099
|
firstMeaningfulDeltaLogged = true;
|
|
66043
66100
|
logLatencyDebug("tmux-first-meaningful-delta", params.timingContext, {
|
|
@@ -66046,7 +66103,7 @@ async function monitorTmuxRun(params) {
|
|
|
66046
66103
|
});
|
|
66047
66104
|
}
|
|
66048
66105
|
await params.onRunning({
|
|
66049
|
-
snapshot:
|
|
66106
|
+
snapshot: cumulativeInteractionSnapshot,
|
|
66050
66107
|
fullSnapshot: snapshot,
|
|
66051
66108
|
initialSnapshot: params.initialSnapshot
|
|
66052
66109
|
});
|
|
@@ -66055,14 +66112,14 @@ async function monitorTmuxRun(params) {
|
|
|
66055
66112
|
if (!detachedNotified && now - params.startedAt >= params.maxRuntimeMs) {
|
|
66056
66113
|
detachedNotified = true;
|
|
66057
66114
|
await params.onDetached({
|
|
66058
|
-
snapshot: deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66115
|
+
snapshot: cumulativeInteractionSnapshot || deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66059
66116
|
fullSnapshot: previousSnapshot,
|
|
66060
66117
|
initialSnapshot: params.initialSnapshot
|
|
66061
66118
|
});
|
|
66062
66119
|
}
|
|
66063
66120
|
if (sawChange && now - lastChangeAt >= params.idleTimeoutMs) {
|
|
66064
66121
|
await params.onCompleted({
|
|
66065
|
-
snapshot: deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66122
|
+
snapshot: cumulativeInteractionSnapshot || deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66066
66123
|
fullSnapshot: previousSnapshot,
|
|
66067
66124
|
initialSnapshot: params.initialSnapshot
|
|
66068
66125
|
});
|
|
@@ -66070,7 +66127,7 @@ async function monitorTmuxRun(params) {
|
|
|
66070
66127
|
}
|
|
66071
66128
|
if (!sawChange && now - params.startedAt >= params.noOutputTimeoutMs) {
|
|
66072
66129
|
await params.onTimeout({
|
|
66073
|
-
snapshot: deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66130
|
+
snapshot: cumulativeInteractionSnapshot || deriveInteractionText(params.initialSnapshot, previousSnapshot),
|
|
66074
66131
|
fullSnapshot: previousSnapshot,
|
|
66075
66132
|
initialSnapshot: params.initialSnapshot
|
|
66076
66133
|
});
|
|
@@ -67386,18 +67443,6 @@ function parseAgentCommand(text, options = {}) {
|
|
|
67386
67443
|
source: "slash"
|
|
67387
67444
|
};
|
|
67388
67445
|
}
|
|
67389
|
-
if (lowered === "queue-list" || lowered === "queuelist") {
|
|
67390
|
-
return {
|
|
67391
|
-
type: "control",
|
|
67392
|
-
name: "queue-list"
|
|
67393
|
-
};
|
|
67394
|
-
}
|
|
67395
|
-
if (lowered === "queue-clear" || lowered === "queueclear") {
|
|
67396
|
-
return {
|
|
67397
|
-
type: "control",
|
|
67398
|
-
name: "queue-clear"
|
|
67399
|
-
};
|
|
67400
|
-
}
|
|
67401
67446
|
if (lowered === "loop") {
|
|
67402
67447
|
const loopText = withoutSlash.slice(command.length).trim();
|
|
67403
67448
|
const loweredLoopText = loopText.toLowerCase();
|
|
@@ -67445,9 +67490,37 @@ function parseAgentCommand(text, options = {}) {
|
|
|
67445
67490
|
};
|
|
67446
67491
|
}
|
|
67447
67492
|
if (lowered === "queue" || lowered === "q") {
|
|
67493
|
+
const queueText = withoutSlash.slice(command.length).trim();
|
|
67494
|
+
const normalizedQueueText = queueText.toLowerCase();
|
|
67495
|
+
if (lowered === "queue") {
|
|
67496
|
+
if (normalizedQueueText === "list") {
|
|
67497
|
+
return {
|
|
67498
|
+
type: "control",
|
|
67499
|
+
name: "queue-list"
|
|
67500
|
+
};
|
|
67501
|
+
}
|
|
67502
|
+
if (normalizedQueueText === "clear") {
|
|
67503
|
+
return {
|
|
67504
|
+
type: "control",
|
|
67505
|
+
name: "queue-clear"
|
|
67506
|
+
};
|
|
67507
|
+
}
|
|
67508
|
+
}
|
|
67448
67509
|
return {
|
|
67449
67510
|
type: "queue",
|
|
67450
|
-
text:
|
|
67511
|
+
text: queueText
|
|
67512
|
+
};
|
|
67513
|
+
}
|
|
67514
|
+
if (lowered === "queue-list" || lowered === "queuelist") {
|
|
67515
|
+
return {
|
|
67516
|
+
type: "control",
|
|
67517
|
+
name: "queue-list"
|
|
67518
|
+
};
|
|
67519
|
+
}
|
|
67520
|
+
if (lowered === "queue-clear" || lowered === "queueclear") {
|
|
67521
|
+
return {
|
|
67522
|
+
type: "control",
|
|
67523
|
+
name: "queue-clear"
|
|
67451
67524
|
};
|
|
67452
67525
|
}
|
|
67453
67526
|
if (lowered === "steer" || lowered === "s") {
|
|
@@ -67495,11 +67568,7 @@ function renderAgentControlSlashHelp() {
|
|
|
67495
67568
|
"- `/followup mention-only`: require explicit mention for each later turn",
|
|
67496
67569
|
"- `/followup pause`: stop passive follow-up until the next explicit mention",
|
|
67497
67570
|
"- `/followup resume`: clear the runtime override and restore config defaults",
|
|
67498
|
-
"- `/streaming status`: show
|
|
67499
|
-
"- `/streaming on`: enable streaming for this surface using the current `all` preview behavior",
|
|
67500
|
-
"- `/streaming off`: disable surface streaming previews for this surface",
|
|
67501
|
-
"- `/streaming latest`: prefer the latest preview shape for this surface",
|
|
67502
|
-
"- `/streaming all`: retain the full current preview shape for this surface",
|
|
67571
|
+
"- `/streaming status|on|off|latest|all`: show or change streaming mode for this surface",
|
|
67503
67572
|
"- `/responsemode status`: show the configured response mode for this surface",
|
|
67504
67573
|
"- `/responsemode capture-pane`: settle replies from captured pane output for this surface",
|
|
67505
67574
|
"- `/responsemode message-tool`: expect the agent to reply through `clisbot message send` for this surface",
|
|
@@ -67508,8 +67577,8 @@ function renderAgentControlSlashHelp() {
|
|
|
67508
67577
|
"- `/additionalmessagemode queue`: queue later user messages behind the active run for this surface",
|
|
67509
67578
|
"- `/queue <message>` or `\\q <message>`: enqueue a later message behind the active run and let clisbot deliver it in order",
|
|
67510
67579
|
"- `/steer <message>` or `\\s <message>`: inject a steering message into the active run immediately",
|
|
67511
|
-
"- `/queue
|
|
67512
|
-
"- `/queue
|
|
67580
|
+
"- `/queue list`: show queued messages that have not started yet",
|
|
67581
|
+
"- `/queue clear`: clear queued messages that have not started yet",
|
|
67513
67582
|
...renderLoopHelpLines(),
|
|
67514
67583
|
"- `/bash` followed by a shell command: requires `shellExecute` on the resolved agent role",
|
|
67515
67584
|
"- shortcut prefixes such as `!` run bash only when the resolved agent role allows `shellExecute`",
|
|
@@ -67687,7 +67756,7 @@ function renderRouteStatusMessage(params) {
|
|
|
67687
67756
|
lines.push(`- \`${loop.id}\` ${renderLoopStatusSchedule(loop)} remaining \`${loop.remainingRuns}\` nextRunAt \`${new Date(loop.nextRunAt).toISOString()}\``);
|
|
67688
67757
|
}
|
|
67689
67758
|
}
|
|
67690
|
-
lines.push("", "Useful commands:", "- `/help`", "- `/whoami`", "- `/status`", "- `/attach`, `/detach`, `/watch every 30s`", "- `/followup status`", "- `/streaming status`", "- `/responsemode status`", "- `/additionalmessagemode status`", "- `/loop status`, `/loop cancel`, `/loop cancel <id>`", "- `/queue <message>`, `/steer <message>`", "- `/queue
|
|
67759
|
+
lines.push("", "Useful commands:", "- `/help`", "- `/whoami`", "- `/status`", "- `/attach`, `/detach`, `/watch every 30s`", "- `/followup status`", "- `/streaming status|on|off|latest|all`", "- `/responsemode status`", "- `/additionalmessagemode status`", "- `/loop status`, `/loop cancel`, `/loop cancel <id>`", "- `/queue <message>`, `/steer <message>`", "- `/queue list`, `/queue clear`", params.route.verbose === "off" ? "- `/transcript` disabled on this route (`verbose: off`)" : "- `/transcript` enabled on this route (`verbose: minimal`)", "- `/bash` requires `shellExecute`");
|
|
67691
67760
|
return lines.join(`
|
|
67692
67761
|
`);
|
|
67693
67762
|
}
|
|
@@ -67925,7 +67994,7 @@ async function executePromptDelivery(params) {
|
|
|
67925
67994
|
let finalReplyRecorded = false;
|
|
67926
67995
|
let loggedFirstRunningUpdate = false;
|
|
67927
67996
|
let activePreviewStartedAt;
|
|
67928
|
-
let
|
|
67997
|
+
let messageToolPreviewHandedOff = false;
|
|
67929
67998
|
const paneManagedDelivery = params.route.responseMode === "capture-pane" || params.forceQueuedDelivery === true;
|
|
67930
67999
|
const messageToolPreview = params.route.responseMode === "message-tool" && params.forceQueuedDelivery !== true && params.route.streaming !== "off";
|
|
67931
68000
|
const previewEnabled = params.route.streaming !== "off" && (paneManagedDelivery || messageToolPreview);
|
|
@@ -67961,11 +68030,12 @@ async function executePromptDelivery(params) {
|
|
|
67961
68030
|
renderedState = undefined;
|
|
67962
68031
|
activePreviewStartedAt = undefined;
|
|
67963
68032
|
}
|
|
67964
|
-
function
|
|
67965
|
-
|
|
67966
|
-
|
|
67967
|
-
|
|
67968
|
-
|
|
68033
|
+
async function handoffMessageToolPreview() {
|
|
68034
|
+
if (messageToolPreviewHandedOff) {
|
|
68035
|
+
return;
|
|
68036
|
+
}
|
|
68037
|
+
messageToolPreviewHandedOff = true;
|
|
68038
|
+
await clearResponseText();
|
|
67969
68039
|
}
|
|
67970
68040
|
async function getMessageToolRuntimeSignals() {
|
|
67971
68041
|
if (params.route.responseMode !== "message-tool" || params.forceQueuedDelivery === true) {
|
|
@@ -68019,13 +68089,12 @@ async function executePromptDelivery(params) {
|
|
|
68019
68089
|
}
|
|
68020
68090
|
await (renderChain = renderChain.then(async () => {
|
|
68021
68091
|
const signals = await getMessageToolRuntimeSignals();
|
|
68022
|
-
if (messageToolPreview && typeof activePreviewStartedAt === "number" && typeof signals.messageToolFinalReplyAt === "number" && signals.messageToolFinalReplyAt >= activePreviewStartedAt) {
|
|
68023
|
-
|
|
68024
|
-
activePreviewStartedAt = undefined;
|
|
68092
|
+
if (messageToolPreview && typeof activePreviewStartedAt === "number" && (typeof signals.messageToolFinalReplyAt === "number" && signals.messageToolFinalReplyAt >= activePreviewStartedAt || typeof signals.lastMessageToolReplyAt === "number" && signals.lastMessageToolReplyAt >= activePreviewStartedAt)) {
|
|
68093
|
+
await handoffMessageToolPreview();
|
|
68025
68094
|
return;
|
|
68026
68095
|
}
|
|
68027
|
-
if (messageToolPreview
|
|
68028
|
-
|
|
68096
|
+
if (messageToolPreview) {
|
|
68097
|
+
return;
|
|
68029
68098
|
}
|
|
68030
68099
|
const nextState2 = buildRenderedMessageState({
|
|
68031
68100
|
platform: params.identity.platform,
|
|
@@ -68041,9 +68110,6 @@ async function executePromptDelivery(params) {
|
|
|
68041
68110
|
if (renderedState?.text === nextState2.text) {
|
|
68042
68111
|
return;
|
|
68043
68112
|
}
|
|
68044
|
-
if (!renderedState && lastFrozenPreviewText === nextState2.text) {
|
|
68045
|
-
return;
|
|
68046
|
-
}
|
|
68047
68113
|
const postedNew2 = await renderResponseText(nextState2.text);
|
|
68048
68114
|
if (postedNew2) {
|
|
68049
68115
|
await recordVisibleReply("reply", "channel");
|
|
@@ -68091,6 +68157,9 @@ async function executePromptDelivery(params) {
|
|
|
68091
68157
|
}
|
|
68092
68158
|
const finalResult = await result;
|
|
68093
68159
|
await renderChain;
|
|
68160
|
+
if (!paneManagedDelivery && messageToolPreviewHandedOff) {
|
|
68161
|
+
return;
|
|
68162
|
+
}
|
|
68094
68163
|
const nextState = buildRenderedMessageState({
|
|
68095
68164
|
platform: params.identity.platform,
|
|
68096
68165
|
status: finalResult.status,
|
|
@@ -68136,6 +68205,21 @@ async function executePromptDelivery(params) {
|
|
|
68136
68205
|
if (finalResult.status === "completed") {
|
|
68137
68206
|
return;
|
|
68138
68207
|
}
|
|
68208
|
+
if (messageToolPreview && responseChunks.length > 0) {
|
|
68209
|
+
const postedNew2 = await renderResponseText(renderPlatformInteraction({
|
|
68210
|
+
platform: params.identity.platform,
|
|
68211
|
+
status: finalResult.status,
|
|
68212
|
+
content: "",
|
|
68213
|
+
maxChars: Number.POSITIVE_INFINITY,
|
|
68214
|
+
note: finalResult.note,
|
|
68215
|
+
allowTranscriptInspection: allowTranscriptInspectionForRoute(params.route),
|
|
68216
|
+
responsePolicy: params.route.response
|
|
68217
|
+
}));
|
|
68218
|
+
if (postedNew2) {
|
|
68219
|
+
await recordVisibleReply("reply", "channel");
|
|
68220
|
+
}
|
|
68221
|
+
return;
|
|
68222
|
+
}
|
|
68139
68223
|
if (params.route.streaming === "off" || responseChunks.length === 0) {
|
|
68140
68224
|
const postedNew2 = await renderResponseText(renderPlatformInteraction({
|
|
68141
68225
|
platform: params.identity.platform,
|
|
@@ -71258,8 +71342,10 @@ var TELEGRAM_FULL_COMMANDS = [
|
|
|
71258
71342
|
{ command: "followup", description: "Show or change follow-up mode" },
|
|
71259
71343
|
{ command: "streaming", description: "Show or change streaming mode" },
|
|
71260
71344
|
{ command: "responsemode", description: "Show or change response mode" },
|
|
71345
|
+
{ command: "additionalmessagemode", description: "Show or change later-message mode" },
|
|
71261
71346
|
{ command: "queue", description: "Queue a later message behind the active run" },
|
|
71262
71347
|
{ command: "steer", description: "Steer the active run immediately" },
|
|
71348
|
+
{ command: "loop", description: "Show or manage loops for this route" },
|
|
71263
71349
|
{ command: "bash", description: "Run bash in the agent workspace" }
|
|
71264
71350
|
];
|
|
71265
71351
|
var TELEGRAM_STARTUP_CONFLICT_MAX_WAIT_MS = 6000;
|