clisbot 0.1.45-beta.12 → 0.1.45-beta.14

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.
Files changed (2) hide show
  1. package/dist/main.js +81 -23
  2. 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 progressPhrase = PROGRESS_PHRASE;
71752
- const progressFlagSuffix = PROGRESS_FLAG_SUFFIX;
71753
- const progressRulesBlock = PROGRESS_RULES_BLOCK;
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(params.config.maxProgressMessages)
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) {
@@ -76198,6 +76207,12 @@ class SlackSocketService {
76198
76207
  allowFrom: params.route.allowUsers ?? [],
76199
76208
  userId: senderId
76200
76209
  })) {
76210
+ const explicitlyAddressed = params.wasMentioned || hasBotMention(event.text ?? "", this.botUserId);
76211
+ if (params.route.requireMention && !explicitlyAddressed) {
76212
+ debugSlackEvent("drop-shared-not-addressed", { eventId, senderId });
76213
+ await this.processedEventsStore.markCompleted(eventId);
76214
+ return;
76215
+ }
76201
76216
  try {
76202
76217
  await postSlackText(this.app.client, {
76203
76218
  channel: channelId,
@@ -76538,7 +76553,7 @@ class SlackSocketService {
76538
76553
  senderId: slackSenderId,
76539
76554
  text,
76540
76555
  agentPromptText,
76541
- agentPromptBuilder: (nextText) => buildAgentPromptText({
76556
+ agentPromptBuilder: (nextText, options) => buildAgentPromptText({
76542
76557
  text: enrichPromptText(nextText),
76543
76558
  identity,
76544
76559
  config: this.getBotConfig().agentPrompt,
@@ -76556,7 +76571,8 @@ class SlackSocketService {
76556
76571
  agentId: params.route.agentId,
76557
76572
  routeTimezone: params.route.timezone,
76558
76573
  botTimezone: params.route.botTimezone
76559
- }).timezone
76574
+ }).timezone,
76575
+ maxProgressMessagesOverride: options?.maxProgressMessagesOverride
76560
76576
  }),
76561
76577
  promptContext,
76562
76578
  protectedControlMutationRule,
@@ -79207,7 +79223,7 @@ class TelegramPollingService {
79207
79223
  senderId: message.from?.id != null ? String(message.from.id).trim() : undefined,
79208
79224
  text,
79209
79225
  agentPromptText,
79210
- agentPromptBuilder: (nextText) => buildAgentPromptText({
79226
+ agentPromptBuilder: (nextText, options) => buildAgentPromptText({
79211
79227
  text: enrichPromptText(nextText),
79212
79228
  identity,
79213
79229
  config: this.getBotConfig().agentPrompt,
@@ -79225,7 +79241,8 @@ class TelegramPollingService {
79225
79241
  agentId: route.agentId,
79226
79242
  routeTimezone: route.timezone,
79227
79243
  botTimezone: route.botTimezone
79228
- }).timezone
79244
+ }).timezone,
79245
+ maxProgressMessagesOverride: options?.maxProgressMessagesOverride
79229
79246
  }),
79230
79247
  promptContext,
79231
79248
  protectedControlMutationRule,
@@ -81476,7 +81493,7 @@ function resolveSlackLoopCliContext(params) {
81476
81493
  sessionTarget,
81477
81494
  identity,
81478
81495
  route,
81479
- buildLoopPromptText: (text) => buildAgentPromptText({
81496
+ buildLoopPromptText: (text, options) => buildAgentPromptText({
81480
81497
  text,
81481
81498
  identity,
81482
81499
  config: botConfig.agentPrompt,
@@ -81490,7 +81507,8 @@ function resolveSlackLoopCliContext(params) {
81490
81507
  agentId: sessionTarget.agentId,
81491
81508
  routeTimezone: route.timezone,
81492
81509
  botTimezone: route.botTimezone
81493
- }).timezone
81510
+ }).timezone,
81511
+ maxProgressMessagesOverride: options?.maxProgressMessagesOverride
81494
81512
  })
81495
81513
  };
81496
81514
  }
@@ -81546,7 +81564,7 @@ function resolveTelegramLoopCliContext(params) {
81546
81564
  sessionTarget,
81547
81565
  identity,
81548
81566
  route,
81549
- buildLoopPromptText: (text) => buildAgentPromptText({
81567
+ buildLoopPromptText: (text, options) => buildAgentPromptText({
81550
81568
  text,
81551
81569
  identity,
81552
81570
  config: botConfig.agentPrompt,
@@ -81560,7 +81578,8 @@ function resolveTelegramLoopCliContext(params) {
81560
81578
  agentId: sessionTarget.agentId,
81561
81579
  routeTimezone: route.timezone,
81562
81580
  botTimezone: route.botTimezone
81563
- }).timezone
81581
+ }).timezone,
81582
+ maxProgressMessagesOverride: options?.maxProgressMessagesOverride
81564
81583
  })
81565
81584
  };
81566
81585
  }
@@ -81720,6 +81739,8 @@ function renderLoopsHelp() {
81720
81739
  " - `--sender <principal>` is required when creating loops, using `slack:<user-id>` or `telegram:<user-id>`",
81721
81740
  " - optional creator display fields: `--sender-name <name>` and `--sender-handle <handle>`",
81722
81741
  " - `--timezone <iana>` is a one-off wall-clock loop override and is frozen on the created loop record",
81742
+ ` - \`${LOOP_START_FLAG} <none|brief|full>\` controls scheduled loop-start notifications only; it does not control injected agent progress messages`,
81743
+ " - `--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
81744
  " - 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
81745
  "",
81725
81746
  "Expressions:",
@@ -81741,6 +81762,7 @@ function renderLoopsHelp() {
81741
81762
  " - CLI loop creation fails without `--sender` so scheduled prompts can preserve creator identity",
81742
81763
  " - the first wall-clock loop returns `confirmation_required` and does not persist until rerun with `--confirm`",
81743
81764
  " - recurring interval loops and confirmed wall-clock loops are persisted immediately and picked up by the runtime when it is running",
81765
+ " - loop-created agent prompts inherit the normal clisbot prompt config unless `--progress <count>` overrides that loop",
81744
81766
  " - if runtime is stopped, recurring loops activate on the next `clisbot start`",
81745
81767
  " - global `cancel --all` clears the whole app; scoped `cancel --all` clears one routed session",
81746
81768
  " - `cancel --all --app` is accepted only with a scoped session target, matching `/loop cancel --all --app`",
@@ -81771,6 +81793,7 @@ function renderLoopsCreateHelp() {
81771
81793
  " - `--timezone <iana>` freezes a one-off wall-clock timezone on the loop record",
81772
81794
  " - `--confirm` persists the first wall-clock loop after reviewing the confirmation output",
81773
81795
  ` - advanced: \`${LOOP_START_FLAG} <none|brief|full>\` overrides the default scheduled loop-start notification behavior for that recurring loop`,
81796
+ " - advanced: `--progress <count>` overrides loop agent progress-message injection; `0` disables progress messages, and omitting the flag inherits the normal clisbot prompt config",
81774
81797
  "",
81775
81798
  "Examples:",
81776
81799
  ` ${renderCliCommand("loops create --channel slack --target group:C1234567890 --thread-id 1712345678.123456 --sender slack:U1234567890 every day at 07:00 check CI")}`,
@@ -81780,7 +81803,8 @@ function renderLoopsCreateHelp() {
81780
81803
  "Behavior:",
81781
81804
  " - create without `--sender` fails by design",
81782
81805
  " - the `--sender` platform must match `--channel`",
81783
- " - recurring CLI-created loops persist creator metadata into the session store"
81806
+ " - recurring CLI-created loops persist creator metadata into the session store",
81807
+ " - CLI-created loop prompts inherit the normal clisbot prompt config unless `--progress <count>` is provided"
81784
81808
  ].join(`
81785
81809
  `);
81786
81810
  }
@@ -81991,6 +82015,7 @@ async function getScopedLoopCounts(params) {
81991
82015
  // src/control/loops-cli.ts
81992
82016
  var LOOP_BUSY_RETRY_MS = 250;
81993
82017
  var LOOP_CONFIRM_FLAG = "--confirm";
82018
+ var LOOP_PROGRESS_FLAG = "--progress";
81994
82019
  var LOOP_SENDER_FLAG = "--sender";
81995
82020
  var LOOP_SENDER_NAME_FLAG = "--sender-name";
81996
82021
  var LOOP_SENDER_HANDLE_FLAG = "--sender-handle";
@@ -82150,7 +82175,9 @@ async function waitForSessionIdle(agentService, target) {
82150
82175
  }
82151
82176
  async function executeCountLoop(params) {
82152
82177
  const agentService = new AgentService(params.state.loadedConfig);
82153
- const builtPrompt = params.context.buildLoopPromptText(params.promptText);
82178
+ const builtPrompt = params.context.buildLoopPromptText(params.promptText, params.progressMessages == null ? undefined : {
82179
+ maxProgressMessagesOverride: params.progressMessages
82180
+ });
82154
82181
  console.log(renderLoopStartedMessage({
82155
82182
  mode: "times",
82156
82183
  count: params.count,
@@ -82204,8 +82231,35 @@ function stripLoopCreatorArgs(args) {
82204
82231
  }
82205
82232
  return remaining;
82206
82233
  }
82234
+ function parseLoopProgress(args) {
82235
+ const raw = parseOptionValue3(args, LOOP_PROGRESS_FLAG);
82236
+ if (raw == null) {
82237
+ return;
82238
+ }
82239
+ const parsed = Number.parseInt(raw, 10);
82240
+ if (!Number.isFinite(parsed) || String(parsed) !== raw.trim() || parsed < 0) {
82241
+ throw new Error(`${LOOP_PROGRESS_FLAG} must be a non-negative integer.`);
82242
+ }
82243
+ return parsed;
82244
+ }
82245
+ function stripLoopProgressArgs(args) {
82246
+ const remaining = [];
82247
+ for (let index = 0;index < args.length; index += 1) {
82248
+ const current = args[index];
82249
+ if (current === "--") {
82250
+ remaining.push(...args.slice(index));
82251
+ break;
82252
+ }
82253
+ if (current === LOOP_PROGRESS_FLAG) {
82254
+ index += 1;
82255
+ continue;
82256
+ }
82257
+ remaining.push(current);
82258
+ }
82259
+ return remaining;
82260
+ }
82207
82261
  function parseCreateExpression(rawArgs, explicitCreateSubcommand) {
82208
- const expressionArgs = stripLoopContextArgs(stripLoopCreatorArgs(stripConfirmFlag(explicitCreateSubcommand ? rawArgs.slice(1) : rawArgs)));
82262
+ const expressionArgs = stripLoopContextArgs(stripLoopCreatorArgs(stripLoopProgressArgs(stripConfirmFlag(explicitCreateSubcommand ? rawArgs.slice(1) : rawArgs))));
82209
82263
  const expression = expressionArgs.join(" ").trim();
82210
82264
  if (!expression) {
82211
82265
  throw new Error("Loop creation requires an interval, count, or schedule expression.");
@@ -82285,6 +82339,7 @@ function requireValidIntervalLoop(parsed) {
82285
82339
  async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand) {
82286
82340
  const confirm = hasFlag4(rawArgs, LOOP_CONFIRM_FLAG);
82287
82341
  const loopTimezone = parseLoopTimezone(rawArgs);
82342
+ const progressMessages = parseLoopProgress(rawArgs);
82288
82343
  const expression = parseCreateExpression(rawArgs, explicitCreateSubcommand);
82289
82344
  const parsed = parseCreateCommand(expression);
82290
82345
  let addressing = parseAddressing(rawArgs);
@@ -82314,7 +82369,8 @@ async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand
82314
82369
  maxActiveLoops,
82315
82370
  expression,
82316
82371
  confirm,
82317
- loopTimezone
82372
+ loopTimezone,
82373
+ progressMessages
82318
82374
  };
82319
82375
  }
82320
82376
  addressing = await prepareLoopCreateAddressing({
@@ -82345,7 +82401,8 @@ async function resolveLoopCreateRequest(state, rawArgs, explicitCreateSubcommand
82345
82401
  maxActiveLoops,
82346
82402
  expression,
82347
82403
  confirm,
82348
- loopTimezone
82404
+ loopTimezone,
82405
+ progressMessages
82349
82406
  };
82350
82407
  }
82351
82408
  function buildLoopSurfaceBinding2(request) {
@@ -82376,6 +82433,7 @@ function buildRecurringLoopPromptMetadata(request) {
82376
82433
  promptText: request.resolvedPrompt.text,
82377
82434
  promptSummary: summarizeLoopPrompt(request.resolvedPrompt.text, request.resolvedPrompt.maintenancePrompt),
82378
82435
  promptSource: request.resolvedPrompt.maintenancePrompt ? "LOOP.md" : "custom",
82436
+ progressMessages: request.progressMessages,
82379
82437
  loopStart: request.parsed.mode === "times" ? undefined : request.parsed.loopStart,
82380
82438
  maintenancePrompt: request.resolvedPrompt.maintenancePrompt,
82381
82439
  createdBy: request.creator.providerId,
@@ -82516,7 +82574,8 @@ async function createLoop(state, rawArgs, options = {}) {
82516
82574
  context: request.deliveryContext ?? request.context,
82517
82575
  promptText: request.resolvedPrompt.text,
82518
82576
  count: request.parsed.count,
82519
- maintenancePrompt: request.resolvedPrompt.maintenancePrompt
82577
+ maintenancePrompt: request.resolvedPrompt.maintenancePrompt,
82578
+ progressMessages: request.progressMessages
82520
82579
  });
82521
82580
  return;
82522
82581
  }
@@ -83052,10 +83111,9 @@ function createQueueItemForContext(params) {
83052
83111
  });
83053
83112
  }
83054
83113
  function renderQueueCreatedNotification(params) {
83055
- const queueLine = params.positionAhead > 0 ? `Queued: ${params.positionAhead} ahead.` : "Queued.";
83114
+ const queueLine = params.positionAhead > 0 ? `Queued \`${params.queueId}\`: ${params.positionAhead} ahead.` : `Queued \`${params.queueId}\`.`;
83056
83115
  return `${queueLine}
83057
83116
 
83058
- Prompt:
83059
83117
  ${params.promptText.trim()}`;
83060
83118
  }
83061
83119
  async function getQueuePositionAhead(state, sessionKey, itemId) {
@@ -83151,7 +83209,7 @@ async function createQueue(state, args, deps) {
83151
83209
  });
83152
83210
  await state.sessionState.setQueuedItem(resolved, item);
83153
83211
  const positionAhead = await getQueuePositionAhead(state, context.sessionTarget.sessionKey, item.id);
83154
- const text = renderQueueCreatedNotification({ positionAhead, promptText });
83212
+ const text = renderQueueCreatedNotification({ queueId: item.id, positionAhead, promptText });
83155
83213
  await deps.sendQueueCreatedNotification({
83156
83214
  state,
83157
83215
  context,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clisbot",
3
- "version": "0.1.45-beta.12",
3
+ "version": "0.1.45-beta.14",
4
4
  "private": false,
5
5
  "description": "Chat surfaces for durable AI coding agents running in tmux",
6
6
  "license": "MIT",