@botiverse/raft-daemon 0.63.6 → 0.63.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.
@@ -1150,11 +1150,15 @@ function formatAgentInboxDelta(rows, options = {}) {
1150
1150
  function formatAgentInboxRowDetails(row) {
1151
1151
  const parts = [`pending: ${row.pendingCount} message${row.pendingCount === 1 ? "" : "s"}`];
1152
1152
  if (row.firstPendingMsgId) parts.push(`first msg=${shortMessageId(row.firstPendingMsgId)}`);
1153
- if (row.latestSenderName) parts.push(`latest @${row.latestSenderName}`);
1153
+ if (row.latestSenderName) parts.push(`latest sender @${row.latestSenderName}`);
1154
1154
  if (row.latestMsgId) parts.push(`latest msg=${shortMessageId(row.latestMsgId)}`);
1155
- parts.push(...row.flags);
1155
+ parts.push(...row.flags.map(formatAgentInboxFlag));
1156
1156
  return parts.join(" \xB7 ");
1157
1157
  }
1158
+ function formatAgentInboxFlag(flag) {
1159
+ if (flag === "mention") return "you were mentioned";
1160
+ return flag;
1161
+ }
1158
1162
  function shortMessageId(value) {
1159
1163
  return value.slice(0, 8);
1160
1164
  }
@@ -1650,6 +1654,13 @@ var PLAN_CONFIG = {
1650
1654
  price: 0,
1651
1655
  extraAgentPrice: 0
1652
1656
  },
1657
+ partner: {
1658
+ displayName: "Partner",
1659
+ limits: { maxMachines: -1, maxAgents: -1, maxChannels: -1, messageHistoryDays: -1, includedAgents: -1 },
1660
+ comingSoon: false,
1661
+ price: 0,
1662
+ extraAgentPrice: 0
1663
+ },
1653
1664
  pro: {
1654
1665
  displayName: "Pro",
1655
1666
  limits: { maxMachines: -1, maxAgents: PRO_PACK_AGENT_SEATS, maxChannels: -1, messageHistoryDays: -1, includedAgents: PRO_PACK_AGENT_SEATS },
@@ -2871,7 +2882,7 @@ function reduceApmGatedReviewBoundaryFlush(_state, input) {
2871
2882
  }
2872
2883
  function reduceApmGatedTurnEnd(_state, input = {}) {
2873
2884
  const shouldDeliverQueuedMessages = Boolean(
2874
- input.inboxLength && input.inboxLength > 0 && input.supportsStdinNotification && input.hasSession
2885
+ input.inboxLength && input.inboxLength > 0 && input.supportsStdinNotification && (input.hasSession || input.canDeliverWithoutSession)
2875
2886
  );
2876
2887
  return {
2877
2888
  nextState: {
@@ -3598,7 +3609,7 @@ function projectBucket(target, messages) {
3598
3609
  if (message.channel_type === "thread") flags.add("thread");
3599
3610
  if (message.channel_type === "dm") flags.add("dm");
3600
3611
  if (message.task_number || message.task_status) flags.add("task");
3601
- if (message.mention === true || message.mentioned === true) flags.add("mention");
3612
+ if (message.mentioned === true) flags.add("mention");
3602
3613
  }
3603
3614
  return stripUndefined({
3604
3615
  target,
@@ -4335,7 +4346,7 @@ function cleanupWorkspaceCliTransportFiles(workingDirectory) {
4335
4346
  rmSync(path2.join(legacySlockDir, filename), { force: true });
4336
4347
  }
4337
4348
  }
4338
- function writeOpencliWrapper(slockDir, opencliBinPath, platform = process.platform) {
4349
+ function writeOpencliWrapper(slockDir, opencliBinPath, platform = process.platform, execIsElectron = Boolean(process.versions.electron)) {
4339
4350
  const fallbacks = deriveOpencliFallbackCandidates(opencliBinPath);
4340
4351
  let binPath = opencliBinPath;
4341
4352
  if (!existsSync2(binPath)) {
@@ -4351,7 +4362,7 @@ fi
4351
4362
  path2.join(slockDir, "opencli"),
4352
4363
  `#!/usr/bin/env bash
4353
4364
  OPENCLI_BIN=${shellSingleQuote(binPath)}
4354
- ${posixFallbackBlock}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "$@"
4365
+ ${posixFallbackBlock}${execIsElectron ? "export ELECTRON_RUN_AS_NODE=1\n" : ""}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "$@"
4355
4366
  `,
4356
4367
  { mode: 493 }
4357
4368
  );
@@ -4365,6 +4376,7 @@ ${posixFallbackBlock}exec ${shellSingleQuote(process.execPath)} "$OPENCLI_BIN" "
4365
4376
  "chcp 65001 >NUL 2>NUL",
4366
4377
  `set "OPENCLI_BIN=${binPath}"`,
4367
4378
  ...fallbacks.map((candidate) => `if not exist "%OPENCLI_BIN%" set "OPENCLI_BIN=${candidate}"`),
4379
+ ...execIsElectron ? [`set "ELECTRON_RUN_AS_NODE=1"`] : [],
4368
4380
  `"${process.execPath}" "%OPENCLI_BIN%" %*`,
4369
4381
  ""
4370
4382
  ].join("\r\n") + "\r\n";
@@ -4446,7 +4458,7 @@ function runtimeContextEnv(config) {
4446
4458
  function buildCliTransportSystemPrompt(config, opts) {
4447
4459
  return buildCliSystemPrompt(config, opts);
4448
4460
  }
4449
- async function prepareCliTransport(ctx, extraEnv = {}, platform = process.platform) {
4461
+ async function prepareCliTransport(ctx, extraEnv = {}, platform = process.platform, execIsElectron = Boolean(process.versions.electron)) {
4450
4462
  if (!ctx.slockCliPath) {
4451
4463
  throw new Error(`${ctx.config.runtime} driver: slockCliPath is required (daemon must inject it)`);
4452
4464
  }
@@ -4503,7 +4515,7 @@ fi
4503
4515
  const posixBody = `#!/usr/bin/env bash
4504
4516
  ${posixLoopbackNoProxyPrelude()}
4505
4517
  SLOCK_CLI=${shellSingleQuote(cliPath)}
4506
- ${posixCliFallbackBlock}${posixCredentialPrefix}exec ${shellSingleQuote(process.execPath)} "$SLOCK_CLI" "$@"
4518
+ ${posixCliFallbackBlock}${execIsElectron ? "export ELECTRON_RUN_AS_NODE=1\n" : ""}${posixCredentialPrefix}exec ${shellSingleQuote(process.execPath)} "$SLOCK_CLI" "$@"
4507
4519
  `;
4508
4520
  writeFileSync(posixWrapper, posixBody, { mode: 493 });
4509
4521
  writeFileSync(posixRaftWrapper, posixBody, { mode: 493 });
@@ -4530,6 +4542,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
4530
4542
  cmdCredentialLine.trimEnd(),
4531
4543
  `set "SLOCK_CLI=${cliPath}"`,
4532
4544
  ...cmdCliFallbackLines,
4545
+ ...execIsElectron ? [`set "ELECTRON_RUN_AS_NODE=1"`] : [],
4533
4546
  `"${process.execPath}" "%SLOCK_CLI%" %*`,
4534
4547
  ""
4535
4548
  ].filter((line) => line.length > 0).join("\r\n") + "\r\n";
@@ -4562,6 +4575,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
4562
4575
  "$env:LC_ALL = 'C.UTF-8'",
4563
4576
  ...powershellLoopbackNoProxyLines(),
4564
4577
  ...psCredentialLines,
4578
+ ...execIsElectron ? ["$env:ELECTRON_RUN_AS_NODE = '1'"] : [],
4565
4579
  `$node = ${powershellSingleQuote(process.execPath)}`,
4566
4580
  `$cli = ${powershellSingleQuote(cliPath)}`,
4567
4581
  ...cliPath === "__cli" || cliFallbackCandidates.length === 0 ? [] : [
@@ -4584,7 +4598,7 @@ set "SLOCK_AGENT_ACTIVE_CAPABILITIES=${DEFAULT_ACTIVE_CAPABILITIES}"\r
4584
4598
  }
4585
4599
  const opencliBinPath = resolveOpencliBinPath();
4586
4600
  if (opencliBinPath) {
4587
- writeOpencliWrapper(slockDir, opencliBinPath, platform);
4601
+ writeOpencliWrapper(slockDir, opencliBinPath, platform, execIsElectron);
4588
4602
  }
4589
4603
  const wrapperPath = platform === "win32" ? path2.join(slockDir, "slock.cmd") : posixWrapper;
4590
4604
  const launchRuntimeFields = runtimeConfigToLaunchFields(ctx.config);
@@ -5275,6 +5289,10 @@ var ClaudeDriver = class {
5275
5289
  // arbitrary busy instant can collide with active signed thinking blocks. The
5276
5290
  // daemon therefore gates busy delivery on Claude stream-json boundaries.
5277
5291
  busyDeliveryMode = "gated";
5292
+ // Claude can report a new session id before the conversation is resumable.
5293
+ // Treat fresh session ids as delivery-ready only after the producing turn
5294
+ // reaches a boundary; existing --resume sessions are ready at launch.
5295
+ liveSessionReadyAt = "turn_end";
5278
5296
  supportsNativeStandingPrompt = true;
5279
5297
  eventNormalizer = new ClaudeEventNormalizer();
5280
5298
  probe() {
@@ -10345,6 +10363,9 @@ var RUNTIME_ERROR_FINGERPRINT_FENCE_THRESHOLD = 3;
10345
10363
  var SPAWN_FAIL_BACKOFF_BASE_MS = 1e3;
10346
10364
  var SPAWN_FAIL_BACKOFF_MAX_MS = 3e4;
10347
10365
  var SPAWN_FAIL_BACKOFF_THRESHOLD = 3;
10366
+ var RUNNER_CREDENTIAL_MINT_BACKOFF_BASE_MS = 6e4;
10367
+ var RUNNER_CREDENTIAL_MINT_BACKOFF_MAX_MS = 10 * 6e4;
10368
+ var RUNNER_CREDENTIAL_MINT_BACKOFF_THRESHOLD = 0;
10348
10369
  var COMPACTION_STALE_MS = 5 * 6e4;
10349
10370
  var RUNTIME_PROGRESS_STALE_MS = 15 * 6e4;
10350
10371
  var DEFAULT_RUNTIME_START_TIMEOUT_MS = 2 * 6e4;
@@ -11369,12 +11390,14 @@ var AgentProcessManager = class _AgentProcessManager {
11369
11390
  }
11370
11391
  // ----- SPAWN-FAIL BACKOFF (per-agent) ----------------------------------
11371
11392
  // Anchored at auto_restart_from_idle (apm:3596) + runtime_profile_auto_restart (apm:4137).
11372
- // Threshold > 1 first SPAWN_FAIL_BACKOFF_THRESHOLD failures behave as today (preserves
11373
- // single-transient-hiccup); subsequent failure schedules a per-agent cooldown gating new
11374
- // spawn attempts. Successful spawn resets state. State lives outside AgentProcess because
11375
- // spawn fails BEFORE ap exists and the rate-window must persist across stop/respawn
11376
- // (else stop/start churn bypasses the cap CC1 lifecycle pattern). Never advances any
11377
- // consume cursor or model-seen state (3-cursor orthogonality with CC1/CC2).
11393
+ // Generic spawn errors keep a threshold > 1 so single-transient hiccups behave as today.
11394
+ // Runner credential mint failures are different: one outer spawn failure already means the
11395
+ // inner credential-mint loop exhausted RUNNER_CREDENTIAL_MINT_MAX_ATTEMPTS. Those enter a
11396
+ // longer cooldown immediately so repeated wakes don't keep burning three network fetches.
11397
+ // Successful spawn resets state. State lives outside AgentProcess because spawn fails BEFORE
11398
+ // ap exists and the rate-window must persist across stop/respawn (else stop/start churn
11399
+ // bypasses the cap — CC1 lifecycle pattern). Never advances any consume cursor or model-seen
11400
+ // state (3-cursor orthogonality with CC1/CC2).
11378
11401
  getOrCreateSpawnFailBackoff(agentId) {
11379
11402
  let state = this.agentSpawnFailBackoff.get(agentId);
11380
11403
  if (!state) {
@@ -11395,12 +11418,16 @@ var AgentProcessManager = class _AgentProcessManager {
11395
11418
  const state = this.getOrCreateSpawnFailBackoff(agentId);
11396
11419
  state.attempts += 1;
11397
11420
  state.reason = reason;
11398
- if (state.attempts <= SPAWN_FAIL_BACKOFF_THRESHOLD) {
11421
+ const isRunnerCredentialMint = reason === "runner_credential_mint";
11422
+ const threshold = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_THRESHOLD : SPAWN_FAIL_BACKOFF_THRESHOLD;
11423
+ const baseMs = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_BASE_MS : SPAWN_FAIL_BACKOFF_BASE_MS;
11424
+ const maxMs = isRunnerCredentialMint ? RUNNER_CREDENTIAL_MINT_BACKOFF_MAX_MS : SPAWN_FAIL_BACKOFF_MAX_MS;
11425
+ if (state.attempts <= threshold) {
11399
11426
  state.untilMs = 0;
11400
11427
  return { backoffActive: false, attempts: state.attempts, untilMs: 0 };
11401
11428
  }
11402
- const exponent = Math.min(state.attempts - SPAWN_FAIL_BACKOFF_THRESHOLD, 10);
11403
- const baseDelay = Math.min(SPAWN_FAIL_BACKOFF_MAX_MS, SPAWN_FAIL_BACKOFF_BASE_MS * Math.pow(2, exponent));
11429
+ const exponent = Math.min(state.attempts - threshold - 1, 10);
11430
+ const baseDelay = Math.min(maxMs, baseMs * Math.pow(2, exponent));
11404
11431
  state.untilMs = this.clockNow() + Math.floor(baseDelay);
11405
11432
  if (state.timer) clearTimeout(state.timer);
11406
11433
  state.timer = setTimeout(() => {
@@ -12149,6 +12176,20 @@ var AgentProcessManager = class _AgentProcessManager {
12149
12176
  if (driver.requiresSessionInitForDelivery) return null;
12150
12177
  return config.sessionId || null;
12151
12178
  }
12179
+ initialSessionReadyForDelivery(driver, config, sessionId) {
12180
+ if (!sessionId) return false;
12181
+ if (config.sessionId && config.sessionId === sessionId) return true;
12182
+ return driver.liveSessionReadyAt !== "turn_end";
12183
+ }
12184
+ markSessionReadyForDelivery(ap, source) {
12185
+ if (!ap.sessionId) return;
12186
+ if (source === "turn_end" || ap.driver.liveSessionReadyAt !== "turn_end") {
12187
+ ap.sessionReadyForDelivery = true;
12188
+ }
12189
+ }
12190
+ canDeliverToRuntimeSession(ap) {
12191
+ return Boolean(ap.sessionId && ap.sessionReadyForDelivery);
12192
+ }
12152
12193
  restartSafeSessionId(ap) {
12153
12194
  return ap.sessionId || (ap.driver.requiresSessionInitForDelivery ? ap.config.sessionId || null : null);
12154
12195
  }
@@ -12198,9 +12239,11 @@ var AgentProcessManager = class _AgentProcessManager {
12198
12239
  const nextLaunchId = start.launchId || ap.launchId || null;
12199
12240
  const requiresSessionInit = ap.driver.requiresSessionInitForDelivery === true;
12200
12241
  const nextSessionId = ap.sessionId || (requiresSessionInit ? null : start.config.sessionId || null);
12242
+ const nextSessionReadyForDelivery = nextSessionId ? nextSessionId === ap.sessionId ? ap.sessionReadyForDelivery : this.initialSessionReadyForDelivery(ap.driver, start.config, nextSessionId) : false;
12201
12243
  const nextConfigSessionId = nextSessionId || (requiresSessionInit ? start.config.sessionId || null : ap.config.sessionId || start.config.sessionId || null);
12202
12244
  ap.launchId = nextLaunchId;
12203
12245
  ap.sessionId = nextSessionId;
12246
+ ap.sessionReadyForDelivery = nextSessionReadyForDelivery;
12204
12247
  ap.config = {
12205
12248
  ...start.config,
12206
12249
  sessionId: nextConfigSessionId
@@ -12617,6 +12660,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
12617
12660
  inbox: wakeMessageDeliveredAsInboxUpdate && wakeMessage ? [wakeMessage, ...startingInboxMessages] : startingInboxMessages,
12618
12661
  config: liveProcessConfig,
12619
12662
  sessionId: initialSessionId,
12663
+ sessionReadyForDelivery: this.initialSessionReadyForDelivery(driver, liveProcessConfig, initialSessionId),
12620
12664
  launchId: effectiveLaunchId,
12621
12665
  startupWakeMessage: wakeMessage,
12622
12666
  startupUnreadSummary: unreadSummary,
@@ -13593,7 +13637,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13593
13637
  if (!transientDelivery && this.queueDeliveryForRuntimeErrorBackoff(agentId, ap, message)) {
13594
13638
  return true;
13595
13639
  }
13596
- if (isIdle && ap.driver.supportsStdinNotification && ap.sessionId) {
13640
+ if (isIdle && ap.driver.supportsStdinNotification && this.canDeliverToRuntimeSession(ap)) {
13597
13641
  if (transientDelivery) {
13598
13642
  this.commitApmIdleState(agentId, ap, false);
13599
13643
  this.startRuntimeTrace(agentId, ap, "stdin-idle-delivery", [message]);
@@ -13611,6 +13655,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13611
13655
  process_present: true,
13612
13656
  runtime: ap.config.runtime,
13613
13657
  session_id_present: true,
13658
+ session_ready_for_delivery: true,
13614
13659
  launchId: ap.launchId || void 0,
13615
13660
  stdin_delivery_accepted: stdinAccepted2,
13616
13661
  delivered_messages_count: 1,
@@ -13629,6 +13674,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13629
13674
  process_present: true,
13630
13675
  runtime: ap.config.runtime,
13631
13676
  session_id_present: true,
13677
+ session_ready_for_delivery: true,
13632
13678
  launchId: ap.launchId || void 0,
13633
13679
  is_idle: isIdle,
13634
13680
  inbox_count: ap.inbox.length,
@@ -13711,6 +13757,20 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13711
13757
  }));
13712
13758
  return true;
13713
13759
  }
13760
+ if (!this.canDeliverToRuntimeSession(ap)) {
13761
+ this.recordDaemonTrace("daemon.agent.delivery.routed", this.deliveryTraceAttrs(agentId, message, {
13762
+ outcome: "queued_before_session_ready",
13763
+ accepted: true,
13764
+ process_present: true,
13765
+ runtime: ap.config.runtime,
13766
+ session_id_present: true,
13767
+ session_ready_for_delivery: false,
13768
+ launchId: ap.launchId || void 0,
13769
+ is_idle: isIdle,
13770
+ inbox_count: ap.inbox.length
13771
+ }));
13772
+ return true;
13773
+ }
13714
13774
  if (ap.gatedSteering.compacting) {
13715
13775
  ap.notifications.add();
13716
13776
  ap.notifications.clearTimer();
@@ -13958,7 +14018,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13958
14018
  };
13959
14019
  const ap = this.agents.get(agentId);
13960
14020
  const isIdle = ap ? this.isApmIdle(ap) : false;
13961
- if (ap && !(ap.sessionId && ap.driver.supportsStdinNotification && isIdle) && !(ap.sessionId && ap.runtime.descriptor.busyDelivery === "direct")) {
14021
+ const sessionReadyForDelivery = ap ? this.canDeliverToRuntimeSession(ap) : false;
14022
+ if (ap && !(sessionReadyForDelivery && ap.driver.supportsStdinNotification && isIdle) && !(sessionReadyForDelivery && ap.runtime.descriptor.busyDelivery === "direct")) {
13962
14023
  this.enqueueRuntimeProfileNotification(agentId, ap, message, kind, key);
13963
14024
  span.end("ok", {
13964
14025
  attrs: {
@@ -13966,13 +14027,14 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13966
14027
  runtime: ap.config.runtime,
13967
14028
  launchId: ap.launchId || void 0,
13968
14029
  session_id_present: Boolean(ap.sessionId),
14030
+ session_ready_for_delivery: sessionReadyForDelivery,
13969
14031
  supports_stdin_notification: ap.driver.supportsStdinNotification,
13970
14032
  busy_delivery_mode: ap.driver.busyDeliveryMode
13971
14033
  }
13972
14034
  });
13973
14035
  return true;
13974
14036
  }
13975
- if (ap?.sessionId && ap.driver.supportsStdinNotification && isIdle) {
14037
+ if (ap && sessionReadyForDelivery && ap.driver.supportsStdinNotification && isIdle) {
13976
14038
  this.commitApmIdleState(agentId, ap, false);
13977
14039
  this.startRuntimeTrace(agentId, ap, "runtime-profile", [message]);
13978
14040
  const written = this.deliverMessagesViaStdin(agentId, ap, [message], "idle");
@@ -13988,7 +14050,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
13988
14050
  });
13989
14051
  return written;
13990
14052
  }
13991
- if (ap?.sessionId && ap.runtime.descriptor.busyDelivery === "direct") {
14053
+ if (ap && sessionReadyForDelivery && ap.runtime.descriptor.busyDelivery === "direct") {
13992
14054
  const written = this.deliverMessagesViaStdin(agentId, ap, [message], "busy");
13993
14055
  span.end(written ? "ok" : "error", {
13994
14056
  attrs: {
@@ -14896,6 +14958,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14896
14958
  model: ap.config.model,
14897
14959
  reason,
14898
14960
  hasSession: Boolean(ap.sessionId),
14961
+ sessionReadyForDelivery: ap.sessionReadyForDelivery,
14899
14962
  ...this.messagesTraceAttrs(messages),
14900
14963
  ...inputTraceAttrs,
14901
14964
  ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
@@ -14904,6 +14967,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
14904
14967
  });
14905
14968
  span.addEvent("daemon.turn.started", {
14906
14969
  reason,
14970
+ sessionReadyForDelivery: ap.sessionReadyForDelivery,
14907
14971
  ...this.messagesTraceAttrs(messages),
14908
14972
  ...inputTraceAttrs,
14909
14973
  ...this.runtimeLaunchPolicyTraceAttrs(ap.config),
@@ -15004,7 +15068,7 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15004
15068
  notifyGatedSteeringBoundary(agentId, ap, reason) {
15005
15069
  const readiness = reduceApmGatedFlushReadiness(ap.gatedSteering, {
15006
15070
  isGated: ap.runtime.descriptor.busyDelivery === "gated",
15007
- hasSession: Boolean(ap.sessionId),
15071
+ hasSession: this.canDeliverToRuntimeSession(ap),
15008
15072
  inboxLength: ap.inbox.length,
15009
15073
  reason
15010
15074
  });
@@ -15453,7 +15517,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15453
15517
  }
15454
15518
  switch (event.kind) {
15455
15519
  case "session_init":
15456
- if (ap) ap.sessionId = event.sessionId;
15520
+ if (ap) {
15521
+ ap.sessionId = event.sessionId;
15522
+ this.markSessionReadyForDelivery(ap, "session_init");
15523
+ }
15457
15524
  this.sendToServer({ type: "agent:session", agentId, sessionId: event.sessionId, launchId: ap?.launchId || void 0 });
15458
15525
  this.sendRuntimeProfileReport(agentId, "session_init");
15459
15526
  break;
@@ -15564,8 +15631,10 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15564
15631
  flushBoundaryMessages: false
15565
15632
  });
15566
15633
  this.flushPendingTrajectory(agentId);
15634
+ const turnEndSessionId = event.sessionId ?? ap?.driver.currentSessionId ?? void 0;
15567
15635
  if (ap) {
15568
- if (event.sessionId) ap.sessionId = event.sessionId;
15636
+ if (turnEndSessionId) ap.sessionId = turnEndSessionId;
15637
+ this.markSessionReadyForDelivery(ap, "turn_end");
15569
15638
  const stickyTerminalFailure = classifyStickyTerminalFailure(ap);
15570
15639
  if (!stickyTerminalFailure && ap.runtimeErrorDeliveryBackoff.reason === "runtime_error") {
15571
15640
  this.clearRuntimeErrorDeliveryBackoffWithTrace(agentId, ap, "turn_end_unclassified_runtime_error");
@@ -15573,7 +15642,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15573
15642
  const reduction = reduceApmGatedTurnEnd(ap.gatedSteering, {
15574
15643
  inboxLength: stickyTerminalFailure ? 0 : ap.inbox.length,
15575
15644
  supportsStdinNotification: ap.driver.supportsStdinNotification,
15576
- hasSession: Boolean(ap.sessionId),
15645
+ hasSession: this.canDeliverToRuntimeSession(ap),
15646
+ canDeliverWithoutSession: !ap.driver.requiresSessionInitForDelivery,
15577
15647
  terminateProcessOnTurnEnd: ap.driver.terminateProcessOnTurnEnd === true
15578
15648
  });
15579
15649
  this.commitGatedSteeringDecisionState(agentId, ap, reduction.nextState, { event: "turn_end" });
@@ -15619,8 +15689,8 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15619
15689
  }
15620
15690
  }
15621
15691
  }
15622
- if (event.sessionId) {
15623
- this.sendToServer({ type: "agent:session", agentId, sessionId: event.sessionId, launchId: ap?.launchId || void 0 });
15692
+ if (turnEndSessionId) {
15693
+ this.sendToServer({ type: "agent:session", agentId, sessionId: turnEndSessionId, launchId: ap?.launchId || void 0 });
15624
15694
  this.sendRuntimeProfileReport(agentId, "turn_end");
15625
15695
  }
15626
15696
  break;
@@ -15826,6 +15896,22 @@ Use ${communicationCommand("read_history")} to catch up on the channels listed a
15826
15896
  if (count === 0) return false;
15827
15897
  if (this.isApmIdle(ap)) return false;
15828
15898
  if (!ap.sessionId) return false;
15899
+ if (!this.canDeliverToRuntimeSession(ap)) {
15900
+ ap.notifications.add(count);
15901
+ this.recordDaemonTrace("daemon.agent.stdin_notification", {
15902
+ agentId,
15903
+ runtime: ap.config.runtime,
15904
+ model: ap.config.model,
15905
+ launchId: ap.launchId || void 0,
15906
+ outcome: "suppressed_session_not_ready",
15907
+ mode: "busy",
15908
+ pending_notification_count: count,
15909
+ inbox_count: ap.inbox.length,
15910
+ session_id_present: true,
15911
+ session_ready_for_delivery: false
15912
+ });
15913
+ return false;
15914
+ }
15829
15915
  const runtimeErrorBackoffRemainingMs = this.runtimeErrorDeliveryBackoffRemainingMs(ap);
15830
15916
  if (runtimeErrorBackoffRemainingMs > 0) {
15831
15917
  ap.notifications.add(count);
@@ -17329,7 +17415,7 @@ function resolveSlockCliPathOrEmpty(moduleUrl = import.meta.url) {
17329
17415
  }
17330
17416
  async function runBundledSlockCli(argv) {
17331
17417
  process.argv = [process.execPath, "slock", ...argv];
17332
- await import("./dist-S7UP42L2.js");
17418
+ await import("./dist-7ZEXJWIW.js");
17333
17419
  }
17334
17420
  function detectRuntimes(tracer = noopTracer) {
17335
17421
  const ids = [];
package/dist/cli/index.js CHANGED
@@ -15658,11 +15658,15 @@ function formatAgentInboxSnapshot(rows) {
15658
15658
  function formatAgentInboxRowDetails(row) {
15659
15659
  const parts = [`pending: ${row.pendingCount} message${row.pendingCount === 1 ? "" : "s"}`];
15660
15660
  if (row.firstPendingMsgId) parts.push(`first msg=${shortMessageId(row.firstPendingMsgId)}`);
15661
- if (row.latestSenderName) parts.push(`latest @${row.latestSenderName}`);
15661
+ if (row.latestSenderName) parts.push(`latest sender @${row.latestSenderName}`);
15662
15662
  if (row.latestMsgId) parts.push(`latest msg=${shortMessageId(row.latestMsgId)}`);
15663
- parts.push(...row.flags);
15663
+ parts.push(...row.flags.map(formatAgentInboxFlag));
15664
15664
  return parts.join(" \xB7 ");
15665
15665
  }
15666
+ function formatAgentInboxFlag(flag) {
15667
+ if (flag === "mention") return "you were mentioned";
15668
+ return flag;
15669
+ }
15666
15670
  function shortMessageId(value) {
15667
15671
  return value.slice(0, 8);
15668
15672
  }
@@ -16061,6 +16065,13 @@ var PLAN_CONFIG = {
16061
16065
  price: 0,
16062
16066
  extraAgentPrice: 0
16063
16067
  },
16068
+ partner: {
16069
+ displayName: "Partner",
16070
+ limits: { maxMachines: -1, maxAgents: -1, maxChannels: -1, messageHistoryDays: -1, includedAgents: -1 },
16071
+ comingSoon: false,
16072
+ price: 0,
16073
+ extraAgentPrice: 0
16074
+ },
16064
16075
  pro: {
16065
16076
  displayName: "Pro",
16066
16077
  limits: { maxMachines: -1, maxAgents: PRO_PACK_AGENT_SEATS, maxChannels: -1, messageHistoryDays: -1, includedAgents: PRO_PACK_AGENT_SEATS },
@@ -21301,7 +21312,7 @@ registerReminderUpdateCommand(reminderCmd);
21301
21312
  registerReminderLogCommand(reminderCmd);
21302
21313
  var actionCmd = program.command("action").description("Action card operations (B-mode quick-commit shortcuts)");
21303
21314
  registerActionPrepareCommand(actionCmd);
21304
- program.parseAsync().catch((err) => {
21315
+ program.parseAsync(process.argv, { from: "node" }).catch((err) => {
21305
21316
  if (err instanceof CliExit) {
21306
21317
  process.exitCode = err.exitCode;
21307
21318
  } else {
package/dist/core.js CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  runBundledSlockCli,
12
12
  scanWorkspaceDirectories,
13
13
  subscribeDaemonLogs
14
- } from "./chunk-DUWRNQQE.js";
14
+ } from "./chunk-6OMBWTF5.js";
15
15
  export {
16
16
  DAEMON_CLI_USAGE,
17
17
  DaemonCore,
@@ -15466,11 +15466,15 @@ function formatAgentInboxSnapshot(rows) {
15466
15466
  function formatAgentInboxRowDetails(row) {
15467
15467
  const parts = [`pending: ${row.pendingCount} message${row.pendingCount === 1 ? "" : "s"}`];
15468
15468
  if (row.firstPendingMsgId) parts.push(`first msg=${shortMessageId(row.firstPendingMsgId)}`);
15469
- if (row.latestSenderName) parts.push(`latest @${row.latestSenderName}`);
15469
+ if (row.latestSenderName) parts.push(`latest sender @${row.latestSenderName}`);
15470
15470
  if (row.latestMsgId) parts.push(`latest msg=${shortMessageId(row.latestMsgId)}`);
15471
- parts.push(...row.flags);
15471
+ parts.push(...row.flags.map(formatAgentInboxFlag));
15472
15472
  return parts.join(" \xB7 ");
15473
15473
  }
15474
+ function formatAgentInboxFlag(flag) {
15475
+ if (flag === "mention") return "you were mentioned";
15476
+ return flag;
15477
+ }
15474
15478
  function shortMessageId(value) {
15475
15479
  return value.slice(0, 8);
15476
15480
  }
@@ -15859,6 +15863,13 @@ var PLAN_CONFIG = {
15859
15863
  price: 0,
15860
15864
  extraAgentPrice: 0
15861
15865
  },
15866
+ partner: {
15867
+ displayName: "Partner",
15868
+ limits: { maxMachines: -1, maxAgents: -1, maxChannels: -1, messageHistoryDays: -1, includedAgents: -1 },
15869
+ comingSoon: false,
15870
+ price: 0,
15871
+ extraAgentPrice: 0
15872
+ },
15862
15873
  pro: {
15863
15874
  displayName: "Pro",
15864
15875
  limits: { maxMachines: -1, maxAgents: PRO_PACK_AGENT_SEATS, maxChannels: -1, messageHistoryDays: -1, includedAgents: PRO_PACK_AGENT_SEATS },
@@ -20975,7 +20986,7 @@ registerReminderUpdateCommand(reminderCmd);
20975
20986
  registerReminderLogCommand(reminderCmd);
20976
20987
  var actionCmd = program.command("action").description("Action card operations (B-mode quick-commit shortcuts)");
20977
20988
  registerActionPrepareCommand(actionCmd);
20978
- program.parseAsync().catch((err) => {
20989
+ program.parseAsync(process.argv, { from: "node" }).catch((err) => {
20979
20990
  if (err instanceof CliExit) {
20980
20991
  process.exitCode = err.exitCode;
20981
20992
  } else {
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  DAEMON_CLI_USAGE,
4
4
  DaemonCore,
5
5
  parseDaemonCliArgs
6
- } from "./chunk-DUWRNQQE.js";
6
+ } from "./chunk-6OMBWTF5.js";
7
7
 
8
8
  // src/index.ts
9
9
  var parsedArgs = parseDaemonCliArgs(process.argv.slice(2));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@botiverse/raft-daemon",
3
- "version": "0.63.6",
3
+ "version": "0.63.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "raft-daemon": "dist/raft-daemon.js",
@@ -45,7 +45,7 @@
45
45
  "release:alpha": "npm version prerelease --preid=alpha --no-git-tag-version && cd ../.. && pnpm install --lockfile-only && git add packages/daemon/package.json pnpm-lock.yaml && git commit -m \"chore: bump @botiverse/raft-daemon to v$(node -p \"require('./packages/daemon/package.json').version\")\" && git tag daemon-v$(node -p \"require('./packages/daemon/package.json').version\") && git push && git push --tags"
46
46
  },
47
47
  "dependencies": {
48
- "@botiverse/kimi-code-sdk": "0.18.0-botiverse.0",
48
+ "@botiverse/kimi-code-sdk": "0.19.2-botiverse.0",
49
49
  "@earendil-works/pi-ai": "0.79.8",
50
50
  "@earendil-works/pi-coding-agent": "0.79.8",
51
51
  "@jackwener/opencli": "^1.8.3",