clisbot 0.1.45-beta.12 → 0.1.45-beta.13
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/main.js +75 -23
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -67402,6 +67402,7 @@ function createStoredLoopBase(params) {
|
|
|
67402
67402
|
protectedControlMutationRule: params.protectedControlMutationRule,
|
|
67403
67403
|
promptSummary: params.promptSummary,
|
|
67404
67404
|
promptSource: params.promptSource,
|
|
67405
|
+
progressMessages: params.progressMessages,
|
|
67405
67406
|
loopStart: params.loopStart,
|
|
67406
67407
|
createdBy: params.createdBy,
|
|
67407
67408
|
sender: params.sender ?? deriveLegacyLoopSender({
|
|
@@ -67432,6 +67433,7 @@ function createStoredIntervalLoop(params) {
|
|
|
67432
67433
|
protectedControlMutationRule: params.protectedControlMutationRule,
|
|
67433
67434
|
promptSummary: params.promptSummary,
|
|
67434
67435
|
promptSource: params.promptSource,
|
|
67436
|
+
progressMessages: params.progressMessages,
|
|
67435
67437
|
loopStart: params.loopStart,
|
|
67436
67438
|
createdBy: params.createdBy,
|
|
67437
67439
|
sender: params.sender,
|
|
@@ -67462,6 +67464,7 @@ function createStoredCalendarLoop(params) {
|
|
|
67462
67464
|
protectedControlMutationRule: params.protectedControlMutationRule,
|
|
67463
67465
|
promptSummary: params.promptSummary,
|
|
67464
67466
|
promptSource: params.promptSource,
|
|
67467
|
+
progressMessages: params.progressMessages,
|
|
67465
67468
|
loopStart: params.loopStart,
|
|
67466
67469
|
createdBy: params.createdBy,
|
|
67467
67470
|
sender: params.sender,
|
|
@@ -71637,7 +71640,9 @@ var REPLY_RULES = `When replying to the user:
|
|
|
71637
71640
|
- put the user-facing message inside the --message body of that command
|
|
71638
71641
|
{{progress_rules_block}}- {{final_rule_line}}`;
|
|
71639
71642
|
var PROGRESS_PHRASE = "progress update or ";
|
|
71643
|
+
var EMPTY_PROGRESS_PHRASE = "";
|
|
71640
71644
|
var PROGRESS_FLAG_SUFFIX = "|progress";
|
|
71645
|
+
var EMPTY_PROGRESS_FLAG_SUFFIX = "";
|
|
71641
71646
|
var PROGRESS_RULES_BLOCK = `- use that command to send progress updates and the final reply back to the conversation
|
|
71642
71647
|
- send at most {{max_progress_messages}} short, meaningful progress updates; skip trivial internal steps
|
|
71643
71648
|
`;
|
|
@@ -71703,7 +71708,8 @@ function buildChannelPromptText(params) {
|
|
|
71703
71708
|
identity: params.identity,
|
|
71704
71709
|
config: params.config,
|
|
71705
71710
|
responseMode: params.responseMode,
|
|
71706
|
-
streaming: params.streaming
|
|
71711
|
+
streaming: params.streaming,
|
|
71712
|
+
maxProgressMessagesOverride: params.maxProgressMessagesOverride
|
|
71707
71713
|
});
|
|
71708
71714
|
const context = resolvePromptContext(params);
|
|
71709
71715
|
return renderTemplate(BASE_TEMPLATE, {
|
|
@@ -71748,9 +71754,11 @@ function renderMessagePromptParts(params) {
|
|
|
71748
71754
|
replyStyleHint: EMPTY_REPLY_STYLE_HINT
|
|
71749
71755
|
};
|
|
71750
71756
|
}
|
|
71751
|
-
const
|
|
71752
|
-
const
|
|
71753
|
-
const
|
|
71757
|
+
const maxProgressMessages = Math.max(0, params.maxProgressMessagesOverride ?? params.config.maxProgressMessages);
|
|
71758
|
+
const progressEnabled = maxProgressMessages > 0;
|
|
71759
|
+
const progressPhrase = progressEnabled ? PROGRESS_PHRASE : EMPTY_PROGRESS_PHRASE;
|
|
71760
|
+
const progressFlagSuffix = progressEnabled ? PROGRESS_FLAG_SUFFIX : EMPTY_PROGRESS_FLAG_SUFFIX;
|
|
71761
|
+
const progressRulesBlock = progressEnabled ? PROGRESS_RULES_BLOCK : "";
|
|
71754
71762
|
const finalRuleLine = params.config.requireFinalResponse ? FINAL_RULE_REQUIRED : FINAL_RULE_OPTIONAL;
|
|
71755
71763
|
return {
|
|
71756
71764
|
deliveryIntro: renderTemplate(DELIVERY_INTRO, {
|
|
@@ -71765,7 +71773,7 @@ function renderMessagePromptParts(params) {
|
|
|
71765
71773
|
}),
|
|
71766
71774
|
replyRules: renderTemplate(REPLY_RULES, {
|
|
71767
71775
|
progress_rules_block: renderTemplate(progressRulesBlock, {
|
|
71768
|
-
max_progress_messages: String(
|
|
71776
|
+
max_progress_messages: String(maxProgressMessages)
|
|
71769
71777
|
}),
|
|
71770
71778
|
final_rule_line: finalRuleLine
|
|
71771
71779
|
}),
|
|
@@ -72417,7 +72425,8 @@ class SurfaceRuntime {
|
|
|
72417
72425
|
agentId,
|
|
72418
72426
|
time: promptTime,
|
|
72419
72427
|
promptContext,
|
|
72420
|
-
scheduledLoopId: loop.id
|
|
72428
|
+
scheduledLoopId: loop.id,
|
|
72429
|
+
maxProgressMessagesOverride: loop.progressMessages
|
|
72421
72430
|
});
|
|
72422
72431
|
}
|
|
72423
72432
|
async buildManagedQueuePrompt(agentId, item) {
|
|
@@ -76538,7 +76547,7 @@ class SlackSocketService {
|
|
|
76538
76547
|
senderId: slackSenderId,
|
|
76539
76548
|
text,
|
|
76540
76549
|
agentPromptText,
|
|
76541
|
-
agentPromptBuilder: (nextText) => buildAgentPromptText({
|
|
76550
|
+
agentPromptBuilder: (nextText, options) => buildAgentPromptText({
|
|
76542
76551
|
text: enrichPromptText(nextText),
|
|
76543
76552
|
identity,
|
|
76544
76553
|
config: this.getBotConfig().agentPrompt,
|
|
@@ -76556,7 +76565,8 @@ class SlackSocketService {
|
|
|
76556
76565
|
agentId: params.route.agentId,
|
|
76557
76566
|
routeTimezone: params.route.timezone,
|
|
76558
76567
|
botTimezone: params.route.botTimezone
|
|
76559
|
-
}).timezone
|
|
76568
|
+
}).timezone,
|
|
76569
|
+
maxProgressMessagesOverride: options?.maxProgressMessagesOverride
|
|
76560
76570
|
}),
|
|
76561
76571
|
promptContext,
|
|
76562
76572
|
protectedControlMutationRule,
|
|
@@ -79207,7 +79217,7 @@ class TelegramPollingService {
|
|
|
79207
79217
|
senderId: message.from?.id != null ? String(message.from.id).trim() : undefined,
|
|
79208
79218
|
text,
|
|
79209
79219
|
agentPromptText,
|
|
79210
|
-
agentPromptBuilder: (nextText) => buildAgentPromptText({
|
|
79220
|
+
agentPromptBuilder: (nextText, options) => buildAgentPromptText({
|
|
79211
79221
|
text: enrichPromptText(nextText),
|
|
79212
79222
|
identity,
|
|
79213
79223
|
config: this.getBotConfig().agentPrompt,
|
|
@@ -79225,7 +79235,8 @@ class TelegramPollingService {
|
|
|
79225
79235
|
agentId: route.agentId,
|
|
79226
79236
|
routeTimezone: route.timezone,
|
|
79227
79237
|
botTimezone: route.botTimezone
|
|
79228
|
-
}).timezone
|
|
79238
|
+
}).timezone,
|
|
79239
|
+
maxProgressMessagesOverride: options?.maxProgressMessagesOverride
|
|
79229
79240
|
}),
|
|
79230
79241
|
promptContext,
|
|
79231
79242
|
protectedControlMutationRule,
|
|
@@ -81476,7 +81487,7 @@ function resolveSlackLoopCliContext(params) {
|
|
|
81476
81487
|
sessionTarget,
|
|
81477
81488
|
identity,
|
|
81478
81489
|
route,
|
|
81479
|
-
buildLoopPromptText: (text) => buildAgentPromptText({
|
|
81490
|
+
buildLoopPromptText: (text, options) => buildAgentPromptText({
|
|
81480
81491
|
text,
|
|
81481
81492
|
identity,
|
|
81482
81493
|
config: botConfig.agentPrompt,
|
|
@@ -81490,7 +81501,8 @@ function resolveSlackLoopCliContext(params) {
|
|
|
81490
81501
|
agentId: sessionTarget.agentId,
|
|
81491
81502
|
routeTimezone: route.timezone,
|
|
81492
81503
|
botTimezone: route.botTimezone
|
|
81493
|
-
}).timezone
|
|
81504
|
+
}).timezone,
|
|
81505
|
+
maxProgressMessagesOverride: options?.maxProgressMessagesOverride
|
|
81494
81506
|
})
|
|
81495
81507
|
};
|
|
81496
81508
|
}
|
|
@@ -81546,7 +81558,7 @@ function resolveTelegramLoopCliContext(params) {
|
|
|
81546
81558
|
sessionTarget,
|
|
81547
81559
|
identity,
|
|
81548
81560
|
route,
|
|
81549
|
-
buildLoopPromptText: (text) => buildAgentPromptText({
|
|
81561
|
+
buildLoopPromptText: (text, options) => buildAgentPromptText({
|
|
81550
81562
|
text,
|
|
81551
81563
|
identity,
|
|
81552
81564
|
config: botConfig.agentPrompt,
|
|
@@ -81560,7 +81572,8 @@ function resolveTelegramLoopCliContext(params) {
|
|
|
81560
81572
|
agentId: sessionTarget.agentId,
|
|
81561
81573
|
routeTimezone: route.timezone,
|
|
81562
81574
|
botTimezone: route.botTimezone
|
|
81563
|
-
}).timezone
|
|
81575
|
+
}).timezone,
|
|
81576
|
+
maxProgressMessagesOverride: options?.maxProgressMessagesOverride
|
|
81564
81577
|
})
|
|
81565
81578
|
};
|
|
81566
81579
|
}
|
|
@@ -81720,6 +81733,8 @@ function renderLoopsHelp() {
|
|
|
81720
81733
|
" - `--sender <principal>` is required when creating loops, using `slack:<user-id>` or `telegram:<user-id>`",
|
|
81721
81734
|
" - optional creator display fields: `--sender-name <name>` and `--sender-handle <handle>`",
|
|
81722
81735
|
" - `--timezone <iana>` is a one-off wall-clock loop override and is frozen on the created loop record",
|
|
81736
|
+
` - \`${LOOP_START_FLAG} <none|brief|full>\` controls scheduled loop-start notifications only; it does not control injected agent progress messages`,
|
|
81737
|
+
" - `--progress <count>` overrides loop progress-message injection for agent replies; `0` disables progress messages, and omitting the flag inherits the normal clisbot prompt config",
|
|
81723
81738
|
" - in Telegram forum groups, omitting `--topic-id` targets the parent chat surface; sends then follow Telegram's normal no-`message_thread_id` behavior, which is the General topic when that forum has one",
|
|
81724
81739
|
"",
|
|
81725
81740
|
"Expressions:",
|
|
@@ -81741,6 +81756,7 @@ function renderLoopsHelp() {
|
|
|
81741
81756
|
" - CLI loop creation fails without `--sender` so scheduled prompts can preserve creator identity",
|
|
81742
81757
|
" - the first wall-clock loop returns `confirmation_required` and does not persist until rerun with `--confirm`",
|
|
81743
81758
|
" - recurring interval loops and confirmed wall-clock loops are persisted immediately and picked up by the runtime when it is running",
|
|
81759
|
+
" - loop-created agent prompts inherit the normal clisbot prompt config unless `--progress <count>` overrides that loop",
|
|
81744
81760
|
" - if runtime is stopped, recurring loops activate on the next `clisbot start`",
|
|
81745
81761
|
" - global `cancel --all` clears the whole app; scoped `cancel --all` clears one routed session",
|
|
81746
81762
|
" - `cancel --all --app` is accepted only with a scoped session target, matching `/loop cancel --all --app`",
|
|
@@ -81771,6 +81787,7 @@ function renderLoopsCreateHelp() {
|
|
|
81771
81787
|
" - `--timezone <iana>` freezes a one-off wall-clock timezone on the loop record",
|
|
81772
81788
|
" - `--confirm` persists the first wall-clock loop after reviewing the confirmation output",
|
|
81773
81789
|
` - advanced: \`${LOOP_START_FLAG} <none|brief|full>\` overrides the default scheduled loop-start notification behavior for that recurring loop`,
|
|
81790
|
+
" - advanced: `--progress <count>` overrides loop agent progress-message injection; `0` disables progress messages, and omitting the flag inherits the normal clisbot prompt config",
|
|
81774
81791
|
"",
|
|
81775
81792
|
"Examples:",
|
|
81776
81793
|
` ${renderCliCommand("loops create --channel slack --target group:C1234567890 --thread-id 1712345678.123456 --sender slack:U1234567890 every day at 07:00 check CI")}`,
|
|
@@ -81780,7 +81797,8 @@ function renderLoopsCreateHelp() {
|
|
|
81780
81797
|
"Behavior:",
|
|
81781
81798
|
" - create without `--sender` fails by design",
|
|
81782
81799
|
" - the `--sender` platform must match `--channel`",
|
|
81783
|
-
" - recurring CLI-created loops persist creator metadata into the session store"
|
|
81800
|
+
" - recurring CLI-created loops persist creator metadata into the session store",
|
|
81801
|
+
" - CLI-created loop prompts inherit the normal clisbot prompt config unless `--progress <count>` is provided"
|
|
81784
81802
|
].join(`
|
|
81785
81803
|
`);
|
|
81786
81804
|
}
|
|
@@ -81991,6 +82009,7 @@ async function getScopedLoopCounts(params) {
|
|
|
81991
82009
|
// src/control/loops-cli.ts
|
|
81992
82010
|
var LOOP_BUSY_RETRY_MS = 250;
|
|
81993
82011
|
var LOOP_CONFIRM_FLAG = "--confirm";
|
|
82012
|
+
var LOOP_PROGRESS_FLAG = "--progress";
|
|
81994
82013
|
var LOOP_SENDER_FLAG = "--sender";
|
|
81995
82014
|
var LOOP_SENDER_NAME_FLAG = "--sender-name";
|
|
81996
82015
|
var LOOP_SENDER_HANDLE_FLAG = "--sender-handle";
|
|
@@ -82150,7 +82169,9 @@ async function waitForSessionIdle(agentService, target) {
|
|
|
82150
82169
|
}
|
|
82151
82170
|
async function executeCountLoop(params) {
|
|
82152
82171
|
const agentService = new AgentService(params.state.loadedConfig);
|
|
82153
|
-
const builtPrompt = params.context.buildLoopPromptText(params.promptText
|
|
82172
|
+
const builtPrompt = params.context.buildLoopPromptText(params.promptText, params.progressMessages == null ? undefined : {
|
|
82173
|
+
maxProgressMessagesOverride: params.progressMessages
|
|
82174
|
+
});
|
|
82154
82175
|
console.log(renderLoopStartedMessage({
|
|
82155
82176
|
mode: "times",
|
|
82156
82177
|
count: params.count,
|
|
@@ -82204,8 +82225,35 @@ function stripLoopCreatorArgs(args) {
|
|
|
82204
82225
|
}
|
|
82205
82226
|
return remaining;
|
|
82206
82227
|
}
|
|
82228
|
+
function parseLoopProgress(args) {
|
|
82229
|
+
const raw = parseOptionValue3(args, LOOP_PROGRESS_FLAG);
|
|
82230
|
+
if (raw == null) {
|
|
82231
|
+
return;
|
|
82232
|
+
}
|
|
82233
|
+
const parsed = Number.parseInt(raw, 10);
|
|
82234
|
+
if (!Number.isFinite(parsed) || String(parsed) !== raw.trim() || parsed < 0) {
|
|
82235
|
+
throw new Error(`${LOOP_PROGRESS_FLAG} must be a non-negative integer.`);
|
|
82236
|
+
}
|
|
82237
|
+
return parsed;
|
|
82238
|
+
}
|
|
82239
|
+
function stripLoopProgressArgs(args) {
|
|
82240
|
+
const remaining = [];
|
|
82241
|
+
for (let index = 0;index < args.length; index += 1) {
|
|
82242
|
+
const current = args[index];
|
|
82243
|
+
if (current === "--") {
|
|
82244
|
+
remaining.push(...args.slice(index));
|
|
82245
|
+
break;
|
|
82246
|
+
}
|
|
82247
|
+
if (current === LOOP_PROGRESS_FLAG) {
|
|
82248
|
+
index += 1;
|
|
82249
|
+
continue;
|
|
82250
|
+
}
|
|
82251
|
+
remaining.push(current);
|
|
82252
|
+
}
|
|
82253
|
+
return remaining;
|
|
82254
|
+
}
|
|
82207
82255
|
function parseCreateExpression(rawArgs, explicitCreateSubcommand) {
|
|
82208
|
-
const expressionArgs = stripLoopContextArgs(stripLoopCreatorArgs(stripConfirmFlag(explicitCreateSubcommand ? rawArgs.slice(1) : rawArgs)));
|
|
82256
|
+
const expressionArgs = stripLoopContextArgs(stripLoopCreatorArgs(stripLoopProgressArgs(stripConfirmFlag(explicitCreateSubcommand ? rawArgs.slice(1) : rawArgs))));
|
|
82209
82257
|
const expression = expressionArgs.join(" ").trim();
|
|
82210
82258
|
if (!expression) {
|
|
82211
82259
|
throw new Error("Loop creation requires an interval, count, or schedule expression.");
|
|
@@ -82285,6 +82333,7 @@ function requireValidIntervalLoop(parsed) {
|
|
|
82285
82333
|
async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand) {
|
|
82286
82334
|
const confirm = hasFlag4(rawArgs, LOOP_CONFIRM_FLAG);
|
|
82287
82335
|
const loopTimezone = parseLoopTimezone(rawArgs);
|
|
82336
|
+
const progressMessages = parseLoopProgress(rawArgs);
|
|
82288
82337
|
const expression = parseCreateExpression(rawArgs, explicitCreateSubcommand);
|
|
82289
82338
|
const parsed = parseCreateCommand(expression);
|
|
82290
82339
|
let addressing = parseAddressing(rawArgs);
|
|
@@ -82314,7 +82363,8 @@ async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand
|
|
|
82314
82363
|
maxActiveLoops,
|
|
82315
82364
|
expression,
|
|
82316
82365
|
confirm,
|
|
82317
|
-
loopTimezone
|
|
82366
|
+
loopTimezone,
|
|
82367
|
+
progressMessages
|
|
82318
82368
|
};
|
|
82319
82369
|
}
|
|
82320
82370
|
addressing = await prepareLoopCreateAddressing({
|
|
@@ -82345,7 +82395,8 @@ async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand
|
|
|
82345
82395
|
maxActiveLoops,
|
|
82346
82396
|
expression,
|
|
82347
82397
|
confirm,
|
|
82348
|
-
loopTimezone
|
|
82398
|
+
loopTimezone,
|
|
82399
|
+
progressMessages
|
|
82349
82400
|
};
|
|
82350
82401
|
}
|
|
82351
82402
|
function buildLoopSurfaceBinding2(request) {
|
|
@@ -82376,6 +82427,7 @@ function buildRecurringLoopPromptMetadata(request) {
|
|
|
82376
82427
|
promptText: request.resolvedPrompt.text,
|
|
82377
82428
|
promptSummary: summarizeLoopPrompt(request.resolvedPrompt.text, request.resolvedPrompt.maintenancePrompt),
|
|
82378
82429
|
promptSource: request.resolvedPrompt.maintenancePrompt ? "LOOP.md" : "custom",
|
|
82430
|
+
progressMessages: request.progressMessages,
|
|
82379
82431
|
loopStart: request.parsed.mode === "times" ? undefined : request.parsed.loopStart,
|
|
82380
82432
|
maintenancePrompt: request.resolvedPrompt.maintenancePrompt,
|
|
82381
82433
|
createdBy: request.creator.providerId,
|
|
@@ -82516,7 +82568,8 @@ async function createLoop(state, rawArgs, options = {}) {
|
|
|
82516
82568
|
context: request.deliveryContext ?? request.context,
|
|
82517
82569
|
promptText: request.resolvedPrompt.text,
|
|
82518
82570
|
count: request.parsed.count,
|
|
82519
|
-
maintenancePrompt: request.resolvedPrompt.maintenancePrompt
|
|
82571
|
+
maintenancePrompt: request.resolvedPrompt.maintenancePrompt,
|
|
82572
|
+
progressMessages: request.progressMessages
|
|
82520
82573
|
});
|
|
82521
82574
|
return;
|
|
82522
82575
|
}
|
|
@@ -83052,10 +83105,9 @@ function createQueueItemForContext(params) {
|
|
|
83052
83105
|
});
|
|
83053
83106
|
}
|
|
83054
83107
|
function renderQueueCreatedNotification(params) {
|
|
83055
|
-
const queueLine = params.positionAhead > 0 ? `Queued
|
|
83108
|
+
const queueLine = params.positionAhead > 0 ? `Queued \`${params.queueId}\`: ${params.positionAhead} ahead.` : `Queued \`${params.queueId}\`.`;
|
|
83056
83109
|
return `${queueLine}
|
|
83057
83110
|
|
|
83058
|
-
Prompt:
|
|
83059
83111
|
${params.promptText.trim()}`;
|
|
83060
83112
|
}
|
|
83061
83113
|
async function getQueuePositionAhead(state, sessionKey, itemId) {
|
|
@@ -83151,7 +83203,7 @@ async function createQueue(state, args, deps) {
|
|
|
83151
83203
|
});
|
|
83152
83204
|
await state.sessionState.setQueuedItem(resolved, item);
|
|
83153
83205
|
const positionAhead = await getQueuePositionAhead(state, context.sessionTarget.sessionKey, item.id);
|
|
83154
|
-
const text = renderQueueCreatedNotification({ positionAhead, promptText });
|
|
83206
|
+
const text = renderQueueCreatedNotification({ queueId: item.id, positionAhead, promptText });
|
|
83155
83207
|
await deps.sendQueueCreatedNotification({
|
|
83156
83208
|
state,
|
|
83157
83209
|
context,
|