kaijibot 2026.8.8 → 2026.8.9

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 (67) hide show
  1. package/dist/.buildstamp +1 -1
  2. package/dist/build-info.json +3 -3
  3. package/dist/cli-startup-metadata.json +1 -1
  4. package/dist/{command-auth-DydNj8Yn.js → command-auth-D--zsY0q.js} +1 -1
  5. package/dist/{command-registry-DWFJJKiz.js → command-registry-Cb__3qQe.js} +4 -4
  6. package/dist/{command-registry-A0f_2uRD.js → command-registry-M2_JqckO.js} +1 -1
  7. package/dist/{completion-cli-BsX0NuzW.js → completion-cli-DDgfvOcn.js} +2 -2
  8. package/dist/{completion-cli-CffaJUO_.js → completion-cli-m0Bo_KXv.js} +1 -1
  9. package/dist/{context-writer-C-Llg_ih.js → context-writer-Ccf978kV.js} +4 -9
  10. package/dist/{direct-dm-1-HwQtv5.js → direct-dm-CbJLNCK5.js} +1 -1
  11. package/dist/{dispatch-C1PQp8ia.js → dispatch-DkfVbg9D.js} +4 -10
  12. package/dist/{doctor-completion-DJywUq0s.js → doctor-completion-DJHx_hH7.js} +1 -1
  13. package/dist/entry.js +1 -1
  14. package/dist/extensions/diffs/.kaijibot-runtime-deps-stamp.json +1 -1
  15. package/dist/extensions/feishu/.kaijibot-runtime-deps-stamp.json +1 -1
  16. package/dist/extensions/kindle-portal/.kaijibot-runtime-deps-stamp.json +1 -1
  17. package/dist/extensions/webhooks/.kaijibot-runtime-deps-stamp.json +1 -1
  18. package/dist/extensions/wechat/api.js +1 -1
  19. package/dist/{gateway-cli-B6XgMuOz.js → gateway-cli-DkP9Pskw.js} +1 -1
  20. package/dist/get-reply-from-config.runtime-cAAI8JXx.js +2 -0
  21. package/dist/get-reply-from-config.runtime.js +1 -1
  22. package/dist/{heartbeat-runner-BlntM0AS.js → heartbeat-runner-BIQVu7Z7.js} +32 -7
  23. package/dist/{heartbeat-runner-Bnf8xcNt.js → heartbeat-runner-CiOo2dfr.js} +1 -1
  24. package/dist/heartbeat-runner.runtime-CTztca1X.js +2 -0
  25. package/dist/heartbeat-runner.runtime.js +1 -1
  26. package/dist/{inbound-reply-dispatch-CEbl2yr5.js → inbound-reply-dispatch-BSMKDNKm.js} +1 -1
  27. package/dist/index.js +2 -2
  28. package/dist/{library-D7WB9pfC.js → library-0Arn0Twp.js} +1 -1
  29. package/dist/{monitor-Bjf1KNAi.js → monitor-DSyn4g7P.js} +1 -1
  30. package/dist/{onboard-CVbAx20c.js → onboard-CQjF6_kD.js} +1 -1
  31. package/dist/plugin-sdk/.boundary-entry-shims.stamp +1 -1
  32. package/dist/plugin-sdk/channel-inbound.js +1 -1
  33. package/dist/plugin-sdk/command-auth.js +2 -2
  34. package/dist/plugin-sdk/direct-dm.js +1 -1
  35. package/dist/plugin-sdk/gateway-method-runtime.js +1 -1
  36. package/dist/plugin-sdk/inbound-reply-dispatch.js +1 -1
  37. package/dist/plugin-sdk/reply-dispatch-runtime.js +1 -1
  38. package/dist/plugin-sdk/reply-runtime.js +3 -3
  39. package/dist/plugin-sdk/src/cognitive/context-writer.d.ts +10 -3
  40. package/dist/plugin-sdk/src/cognitive/types.d.ts +3 -1
  41. package/dist/plugin-sdk/src/config/types.cognitive.d.ts +4 -0
  42. package/dist/plugin-sdk/src/infra/heartbeat-runner.d.ts +7 -0
  43. package/dist/plugins/runtime/index.js +1 -1
  44. package/dist/{proactive-scheduler-1vuql4ea.js → proactive-scheduler-Bp_FBAER.js} +2 -2
  45. package/dist/{program-Bk8iztSC.js → program-BM2X3cuO.js} +1 -1
  46. package/dist/{prompt-select-styled-FfNyc6GQ.js → prompt-select-styled-CB9jpO1l.js} +1 -1
  47. package/dist/{provider-dispatcher-DGc6N0AZ.js → provider-dispatcher-Cujqljoi.js} +1 -1
  48. package/dist/{register.maintenance-Cx7dGP8N.js → register.maintenance-Ct0Qtlyv.js} +1 -1
  49. package/dist/{register.onboard-AM-1pFbi.js → register.onboard-cO7YWIf8.js} +1 -1
  50. package/dist/{register.setup-DD2KzdhV.js → register.setup-BegH-UM1.js} +1 -1
  51. package/dist/{register.subclis-DWDRfm9Q.js → register.subclis-C6-yF8tE.js} +3 -3
  52. package/dist/{register.subclis-BbDrib8b.js → register.subclis-C6O24zEE.js} +1 -1
  53. package/dist/{reply-LbSp51nz.js → reply-D8YRXfdK.js} +2 -9
  54. package/dist/reply.runtime-CtYU19fx.js +2 -0
  55. package/dist/reply.runtime.js +1 -1
  56. package/dist/{run-main-BYhJxN80.js → run-main-BHZRsHzS.js} +3 -3
  57. package/dist/{runtime-CvasIVwT.js → runtime-BFQw_vNi.js} +3 -3
  58. package/dist/{server-methods-R9IVu4Nx.js → server-methods-6o0mfjgq.js} +2 -2
  59. package/dist/{server-CR-RmrOX.js → server-oqZ0r7cB.js} +1 -1
  60. package/dist/{server.impl-Dyj_4LQf.js → server.impl-BhohG95V.js} +62 -10
  61. package/dist/{setup-BL9KrPLD.js → setup-BDXJPCJZ.js} +1 -1
  62. package/dist/{setup.finalize-Cwo4dSP4.js → setup.finalize-Cib80vdy.js} +2 -2
  63. package/dist/{update-cli-Dit5ZL-N.js → update-cli-BxJ22lNS.js} +3 -3
  64. package/package.json +1 -1
  65. package/dist/get-reply-from-config.runtime-CW4PYe0e.js +0 -2
  66. package/dist/heartbeat-runner.runtime-DQtwkqi5.js +0 -2
  67. package/dist/reply.runtime-2-5jNLN7.js +0 -2
package/dist/.buildstamp CHANGED
@@ -1 +1 @@
1
- {"builtAt":1786164229958,"head":"f0c2534f7eb6653877fc845115c7efe896aea539"}
1
+ {"builtAt":1786272329982,"head":"cca361b93994d2f7311fbcc945b728f514d36830"}
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2026.8.8",
3
- "commit": "f0c2534f7eb6653877fc845115c7efe896aea539",
4
- "builtAt": "2026-08-08T04:44:36.110Z"
2
+ "version": "2026.8.9",
3
+ "commit": "cca361b93994d2f7311fbcc945b728f514d36830",
4
+ "builtAt": "2026-08-09T10:46:21.018Z"
5
5
  }
@@ -14,5 +14,5 @@
14
14
  ],
15
15
  "channelCatalogSignature": "a99b78ac99491ac5c8d64c4a6973088cc21688cb",
16
16
  "rootHelpBundleSignature": "8520d7aba9638401504ce3128c98e059de7ceb60",
17
- "rootHelpText": "\n👾 KaijiBot 2026.8.8 (f0c2534) — Wisdom isn't the accumulation of knowledge — it's knowing what to ignore.\n\nUsage: kaijibot [options] [command]\n\nOptions:\n --container <name> Run the CLI inside a running Podman/Docker container\n named <name> (default: env KAIJIBOT_CONTAINER)\n --dev Dev profile: isolate state under ~/.kaijibot-dev, default\n gateway port 19001, and shift derived ports\n (browser/canvas)\n -h, --help Display help for command\n --log-level <level> Global log level override for file + console\n (silent|fatal|error|warn|info|debug|trace)\n --no-color Disable ANSI colors\n --profile <name> Use a named profile (isolates\n KAIJIBOT_STATE_DIR/KAIJIBOT_CONFIG_PATH under\n ~/.kaijibot-<name>)\n -V, --version output the version number\n\nCommands:\n Hint: commands suffixed with * have subcommands. Run <command> --help for details.\n acp * Agent Control Protocol tools\n agent Run one agent turn via the Gateway\n agents * Manage isolated agents (workspaces, auth, routing)\n android-install Set up KaijiBot on Android/Termux (auto-installs\n packages, boot script, battery settings)\n approvals * Manage exec approvals (gateway or node host)\n backup * Create and verify local backup archives for KaijiBot\n state\n capability * Run provider-backed inference commands (fallback alias:\n infer)\n channels * Manage connected chat channels (Telegram, Discord, etc.)\n clawbot * Legacy clawbot command aliases\n completion Generate shell completion script\n config * Non-interactive config helpers\n (get/set/unset/file/validate). Default: starts guided\n setup.\n configure Interactive configuration for credentials, channels,\n gateway, and agent defaults\n cron * Manage cron jobs via the Gateway scheduler\n daemon * Gateway service (legacy alias)\n dashboard Open the Control UI with your current token\n devices * Device pairing + token management\n directory * Lookup contact and group IDs (self, peers, groups) for\n supported chat channels\n dns * DNS helpers for wide-area discovery (Tailscale + CoreDNS)\n docs Search the live KaijiBot docs\n doctor Health checks + quick fixes for the gateway and channels\n gateway * Run, inspect, and query the WebSocket Gateway\n health Fetch health from the running gateway\n help Display help for command\n hooks * Manage internal agent hooks\n infer * Run provider-backed inference commands\n logs Tail gateway file logs via RPC\n mcp * Manage KaijiBot MCP config and channel bridge\n memory Search, inspect, and reindex memory files\n message * Send, read, and manage messages\n migrate Migrate data from OpenClaw or legacy installations to\n KaijiBot\n models * Discover, scan, and configure models\n node * Run and manage the headless node host service\n nodes * Manage gateway-owned node pairing and node commands\n onboard Interactive onboarding for the gateway, workspace, and\n skills\n pairing * Secure DM pairing (approve inbound requests)\n plugins * Manage KaijiBot plugins and extensions\n qa * Run QA scenarios and launch the private QA debugger UI\n qr Generate mobile pairing QR/setup code\n reset Reset local config/state (keeps the CLI installed)\n sandbox * Manage sandbox containers for agent isolation\n secrets * Secrets runtime reload controls\n security * Security tools and local config audits\n sessions * List stored conversation sessions\n setup Initialize local config and agent workspace\n skills * List and inspect available skills\n soul * Manage soul presets (MBTI-based personality profiles)\n status Show channel health and recent session recipients\n system * System events, heartbeat, and presence\n tasks * Inspect durable background task state\n tui Open a terminal UI connected to the Gateway\n uninstall Uninstall the gateway service + local data (CLI remains)\n update * Update KaijiBot and inspect update channel status\n webhooks * Webhook helpers and integrations\n\nExamples:\n kaijibot models --help\n Show detailed help for the models command.\n kaijibot channels login --verbose\n Link personal WhatsApp Web and show QR + connection logs.\n kaijibot message send --target +15555550123 --message \"Hi\" --json\n Send via your web session and print JSON result.\n kaijibot gateway --port 18789\n Run the WebSocket Gateway locally.\n kaijibot --dev gateway\n Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.\n kaijibot gateway --force\n Kill anything bound to the default gateway port, then start it.\n kaijibot gateway ...\n Gateway control via WebSocket.\n kaijibot agent --to +15555550123 --message \"Run summary\" --deliver\n Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.\n kaijibot message send --channel feishu --target ou_xxx --message \"Hi\"\n Send via your Telegram bot.\n\nDocs: https://gitee.com/kaiji1126/kaijibot/blob/main/docs/cli.md\n\n"
17
+ "rootHelpText": "\n👾 KaijiBot 2026.8.9 (cca361b) — The boundary of your thinking is the boundary of your world.\n\nUsage: kaijibot [options] [command]\n\nOptions:\n --container <name> Run the CLI inside a running Podman/Docker container\n named <name> (default: env KAIJIBOT_CONTAINER)\n --dev Dev profile: isolate state under ~/.kaijibot-dev, default\n gateway port 19001, and shift derived ports\n (browser/canvas)\n -h, --help Display help for command\n --log-level <level> Global log level override for file + console\n (silent|fatal|error|warn|info|debug|trace)\n --no-color Disable ANSI colors\n --profile <name> Use a named profile (isolates\n KAIJIBOT_STATE_DIR/KAIJIBOT_CONFIG_PATH under\n ~/.kaijibot-<name>)\n -V, --version output the version number\n\nCommands:\n Hint: commands suffixed with * have subcommands. Run <command> --help for details.\n acp * Agent Control Protocol tools\n agent Run one agent turn via the Gateway\n agents * Manage isolated agents (workspaces, auth, routing)\n android-install Set up KaijiBot on Android/Termux (auto-installs\n packages, boot script, battery settings)\n approvals * Manage exec approvals (gateway or node host)\n backup * Create and verify local backup archives for KaijiBot\n state\n capability * Run provider-backed inference commands (fallback alias:\n infer)\n channels * Manage connected chat channels (Telegram, Discord, etc.)\n clawbot * Legacy clawbot command aliases\n completion Generate shell completion script\n config * Non-interactive config helpers\n (get/set/unset/file/validate). Default: starts guided\n setup.\n configure Interactive configuration for credentials, channels,\n gateway, and agent defaults\n cron * Manage cron jobs via the Gateway scheduler\n daemon * Gateway service (legacy alias)\n dashboard Open the Control UI with your current token\n devices * Device pairing + token management\n directory * Lookup contact and group IDs (self, peers, groups) for\n supported chat channels\n dns * DNS helpers for wide-area discovery (Tailscale + CoreDNS)\n docs Search the live KaijiBot docs\n doctor Health checks + quick fixes for the gateway and channels\n gateway * Run, inspect, and query the WebSocket Gateway\n health Fetch health from the running gateway\n help Display help for command\n hooks * Manage internal agent hooks\n infer * Run provider-backed inference commands\n logs Tail gateway file logs via RPC\n mcp * Manage KaijiBot MCP config and channel bridge\n memory Search, inspect, and reindex memory files\n message * Send, read, and manage messages\n migrate Migrate data from OpenClaw or legacy installations to\n KaijiBot\n models * Discover, scan, and configure models\n node * Run and manage the headless node host service\n nodes * Manage gateway-owned node pairing and node commands\n onboard Interactive onboarding for the gateway, workspace, and\n skills\n pairing * Secure DM pairing (approve inbound requests)\n plugins * Manage KaijiBot plugins and extensions\n qa * Run QA scenarios and launch the private QA debugger UI\n qr Generate mobile pairing QR/setup code\n reset Reset local config/state (keeps the CLI installed)\n sandbox * Manage sandbox containers for agent isolation\n secrets * Secrets runtime reload controls\n security * Security tools and local config audits\n sessions * List stored conversation sessions\n setup Initialize local config and agent workspace\n skills * List and inspect available skills\n soul * Manage soul presets (MBTI-based personality profiles)\n status Show channel health and recent session recipients\n system * System events, heartbeat, and presence\n tasks * Inspect durable background task state\n tui Open a terminal UI connected to the Gateway\n uninstall Uninstall the gateway service + local data (CLI remains)\n update * Update KaijiBot and inspect update channel status\n webhooks * Webhook helpers and integrations\n\nExamples:\n kaijibot models --help\n Show detailed help for the models command.\n kaijibot channels login --verbose\n Link personal WhatsApp Web and show QR + connection logs.\n kaijibot message send --target +15555550123 --message \"Hi\" --json\n Send via your web session and print JSON result.\n kaijibot gateway --port 18789\n Run the WebSocket Gateway locally.\n kaijibot --dev gateway\n Run a dev Gateway (isolated state/config) on ws://127.0.0.1:19001.\n kaijibot gateway --force\n Kill anything bound to the default gateway port, then start it.\n kaijibot gateway ...\n Gateway control via WebSocket.\n kaijibot agent --to +15555550123 --message \"Run summary\" --deliver\n Talk directly to the agent using the Gateway; optionally send the WhatsApp reply.\n kaijibot message send --channel feishu --target ou_xxx --message \"Hi\"\n Send via your Telegram bot.\n\nDocs: https://gitee.com/kaiji1126/kaijibot/blob/main/docs/cli.md\n\n"
18
18
  }
@@ -5,7 +5,7 @@ import "./command-auth-XGJw9qMC.js";
5
5
  import "./stored-model-override-B_Pfo0rs.js";
6
6
  import "./commands-models-B7UPtUbJ.js";
7
7
  import { n as buildCommandsMessagePaginated$1, r as buildHelpMessage$1, t as buildCommandsMessage$1 } from "./command-status-builders-C3CnFOP2.js";
8
- import "./direct-dm-1-HwQtv5.js";
8
+ import "./direct-dm-CbJLNCK5.js";
9
9
  import "./skill-commands-BRwGzS_r.js";
10
10
  //#region src/plugin-sdk/command-auth.ts
11
11
  /** Fast-path DM command authorization when only policy and sender allowlist state matter. */
@@ -1,6 +1,6 @@
1
1
  import { t as resolveCliArgvInvocation } from "./argv-invocation-CagzCjnZ.js";
2
2
  import { n as shouldRegisterPrimaryCommandOnly } from "./command-registration-policy-BMA0d51Q.js";
3
- import { a as defineImportedCommandGroupSpec, i as buildCommandGroupEntries, o as defineImportedProgramCommandGroupSpecs, r as registerSubCliCommands } from "./register.subclis-DWDRfm9Q.js";
3
+ import { a as defineImportedCommandGroupSpec, i as buildCommandGroupEntries, o as defineImportedProgramCommandGroupSpecs, r as registerSubCliCommands } from "./register.subclis-C6-yF8tE.js";
4
4
  import { i as registerCommandGroups, r as registerCommandGroupByName } from "./register-command-groups-EWuTSFO0.js";
5
5
  import { n as getCoreCliCommandNames$1, t as getCoreCliCommandDescriptors } from "./core-command-descriptors-C6sYXgBr.js";
6
6
  //#region src/cli/program/command-registry.ts
@@ -16,12 +16,12 @@ const coreEntrySpecs = [
16
16
  ...withProgramOnlySpecs(defineImportedProgramCommandGroupSpecs([
17
17
  {
18
18
  commandNames: ["setup"],
19
- loadModule: () => import("./register.setup-DD2KzdhV.js"),
19
+ loadModule: () => import("./register.setup-BegH-UM1.js"),
20
20
  exportName: "registerSetupCommand"
21
21
  },
22
22
  {
23
23
  commandNames: ["onboard"],
24
- loadModule: () => import("./register.onboard-AM-1pFbi.js"),
24
+ loadModule: () => import("./register.onboard-cO7YWIf8.js"),
25
25
  exportName: "registerOnboardCommand"
26
26
  },
27
27
  {
@@ -46,7 +46,7 @@ const coreEntrySpecs = [
46
46
  "reset",
47
47
  "uninstall"
48
48
  ],
49
- loadModule: () => import("./register.maintenance-Cx7dGP8N.js"),
49
+ loadModule: () => import("./register.maintenance-Ct0Qtlyv.js"),
50
50
  exportName: "registerMaintenanceCommands"
51
51
  },
52
52
  {
@@ -1,3 +1,3 @@
1
1
  import "./core-command-descriptors-C6sYXgBr.js";
2
- import { n as registerCoreCliByName } from "./command-registry-DWFJJKiz.js";
2
+ import { n as registerCoreCliByName } from "./command-registry-Cb__3qQe.js";
3
3
  export { registerCoreCliByName };
@@ -5,8 +5,8 @@ import { t as formatDocsLink } from "./links-DG6HlfoL.js";
5
5
  import { r as theme } from "./theme-BtqB6Mz_.js";
6
6
  import { _ as resolveStateDir } from "./paths-BzRif4MR.js";
7
7
  import { r as t } from "./translate-CZMssHoF.js";
8
- import { n as registerSubCliByName, t as getSubCliEntries } from "./register.subclis-DWDRfm9Q.js";
9
- import { n as registerCoreCliByName, t as getCoreCliCommandNames } from "./command-registry-DWFJJKiz.js";
8
+ import { n as registerSubCliByName, t as getSubCliEntries } from "./register.subclis-C6-yF8tE.js";
9
+ import { n as registerCoreCliByName, t as getCoreCliCommandNames } from "./command-registry-Cb__3qQe.js";
10
10
  import { t as getProgramContext } from "./program-context-beQs52o_.js";
11
11
  import path from "node:path";
12
12
  import os from "node:os";
@@ -1,2 +1,2 @@
1
- import { a as registerCompletionCli, c as usesSlowDynamicCompletion, i as isCompletionInstalled, n as getCompletionScript, o as resolveCompletionCachePath, r as installCompletion, s as resolveShellFromEnv, t as completionCacheExists } from "./completion-cli-BsX0NuzW.js";
1
+ import { a as registerCompletionCli, c as usesSlowDynamicCompletion, i as isCompletionInstalled, n as getCompletionScript, o as resolveCompletionCachePath, r as installCompletion, s as resolveShellFromEnv, t as completionCacheExists } from "./completion-cli-DDgfvOcn.js";
2
2
  export { completionCacheExists, getCompletionScript, installCompletion, isCompletionInstalled, registerCompletionCli, resolveCompletionCachePath, resolveShellFromEnv, usesSlowDynamicCompletion };
@@ -217,19 +217,14 @@ function formatHandshakeGap(hours) {
217
217
  return hours < 24 ? `${Math.round(hours)} 小时` : `${Math.round(hours / 24)} 天`;
218
218
  }
219
219
  function buildHandshakeSection(params) {
220
- const { persona, recentInsights, hoursSinceLastInteraction } = params;
220
+ const { persona, pendingInsightDelivery, hoursSinceLastInteraction } = params;
221
221
  const gap = formatHandshakeGap(hoursSinceLastInteraction);
222
222
  const lines = ["## Continuity Handshake"];
223
223
  lines.push(`距上次交互已 ${gap}。回答用户问题前,先用一两句自然承接上文,让用户感到被记住,然后正常回答。`);
224
224
  const cues = [];
225
225
  if (persona.identity.displayName) cues.push(`用户称呼:${persona.identity.displayName}`);
226
226
  if (persona.recentFocus.length > 0) cues.push(`最近关注:${persona.recentFocus.slice(0, 3).join("、")}`);
227
- const lastInsight = recentInsights[0];
228
- if (lastInsight) {
229
- const date = new Date(lastInsight.generatedAt).toLocaleDateString("zh-CN");
230
- const preview = lastInsight.content.slice(0, 80);
231
- cues.push(`上次推送的洞察(${date}):${preview}`);
232
- }
227
+ if (pendingInsightDelivery) cues.push(`有条之前没来得及告诉你的洞察(未送达):${pendingInsightDelivery.candidate.content}`);
233
228
  if (cues.length > 0) {
234
229
  lines.push("可承接的线索(选最相关的一条,不要全部列举):");
235
230
  for (const cue of cues) lines.push(`- ${cue}`);
@@ -238,7 +233,7 @@ function buildHandshakeSection(params) {
238
233
  return lines.join("\n");
239
234
  }
240
235
  function buildCognitiveModePrompt(params) {
241
- const { message, isHeartbeat, isCron, recentModes, cognitiveEnabled, evolutionEnabled, persona, corrections, locale, recentInsights, now, handshakeConfig } = params;
236
+ const { message, isHeartbeat, isCron, recentModes, cognitiveEnabled, evolutionEnabled, persona, corrections, locale, pendingInsightDelivery, now, handshakeConfig } = params;
242
237
  const classification = classifyMode(message, {
243
238
  isHeartbeat,
244
239
  isCron,
@@ -262,7 +257,7 @@ function buildCognitiveModePrompt(params) {
262
257
  const hoursSinceLastInteraction = (currentTime - persona.lifecycle.lastActiveAt) / 36e5;
263
258
  if (hoursSinceLastInteraction >= minGap) parts.push(buildHandshakeSection({
264
259
  persona,
265
- recentInsights: recentInsights ?? [],
260
+ pendingInsightDelivery: pendingInsightDelivery ?? null,
266
261
  hoursSinceLastInteraction
267
262
  }));
268
263
  }
@@ -1,5 +1,5 @@
1
1
  import { n as readStoreAllowFromForDmPolicy, o as resolveDmGroupAccessWithLists } from "./dm-policy-shared-CCEaN5_W.js";
2
- import { i as recordInboundSessionAndDispatchReply } from "./inbound-reply-dispatch-CEbl2yr5.js";
2
+ import { i as recordInboundSessionAndDispatchReply } from "./inbound-reply-dispatch-BSMKDNKm.js";
3
3
  import { r as resolveInboundRouteEnvelopeBuilderWithRuntime } from "./inbound-envelope-CA8EoFYk.js";
4
4
  //#region src/plugin-sdk/direct-dm.ts
5
5
  /** Resolve direct-DM policy, effective allowlists, and optional command auth in one place. */
@@ -122,7 +122,7 @@ function loadRouteReplyRuntime() {
122
122
  return routeReplyRuntimePromise;
123
123
  }
124
124
  function loadGetReplyFromConfigRuntime() {
125
- getReplyFromConfigRuntimePromise ??= import("./get-reply-from-config.runtime-CW4PYe0e.js");
125
+ getReplyFromConfigRuntimePromise ??= import("./get-reply-from-config.runtime-cAAI8JXx.js");
126
126
  return getReplyFromConfigRuntimePromise;
127
127
  }
128
128
  function loadAbortRuntime() {
@@ -1025,7 +1025,7 @@ async function detectInsightFollowupFeedback(params) {
1025
1025
  const userMessage = params.ctx.BodyForCommands ?? params.ctx.Body ?? "";
1026
1026
  if (!userMessage.trim()) return;
1027
1027
  const FOLLOWUP_WINDOW_MS = 1800 * 1e3;
1028
- const SIMILARITY_THRESHOLD = .12;
1028
+ const SIMILARITY_THRESHOLD = .08;
1029
1029
  try {
1030
1030
  const [{ resolveConfigDir }, { resolveSessionAgentId }] = await Promise.all([import("./utils-DPaRngSQ.js"), import("./agent-scope-B0ikgii_.js")]);
1031
1031
  const insightStoreMod = await import("./store-CnS9lv_1.js");
@@ -1037,15 +1037,9 @@ async function detectInsightFollowupFeedback(params) {
1037
1037
  });
1038
1038
  const configDir = resolveConfigDir();
1039
1039
  const personaStore = new personaStoreMod.PersonaStore(configDir);
1040
- const persona = await personaStore.load(agentId, userId);
1041
- if (!persona) return;
1042
- const lastProactive = persona.feedbackProfile.lastProactiveAt;
1043
- if (lastProactive <= 0) return;
1044
- if (Date.now() - lastProactive > FOLLOWUP_WINDOW_MS) return;
1045
1040
  const insightStore = new insightStoreMod.InsightStore(configDir);
1046
- const recent = await insightStore.listActive(agentId, userId, void 0, 1);
1047
- if (!recent[0]) return;
1048
- const insight = recent[0];
1041
+ const insight = (await insightStore.listRecent(agentId, userId, 5)).find((r) => r.deliveredAt !== void 0 && Date.now() - r.deliveredAt <= FOLLOWUP_WINDOW_MS);
1042
+ if (!insight) return;
1049
1043
  const isDiscussing = bigramSimilarity(userMessage, insight.content) >= SIMILARITY_THRESHOLD;
1050
1044
  const isFollowUp = FOLLOWUP_PATTERNS.some((p) => userMessage.toLowerCase().includes(p));
1051
1045
  if (!isDiscussing && !isFollowUp) return;
@@ -1,7 +1,7 @@
1
1
  import { t as resolveKaijiBotPackageRoot } from "./kaijibot-root-BjhI7uOk.js";
2
2
  import { n as resolveCliName } from "./cli-name-mbXbS_Xz.js";
3
3
  import { t as note } from "./note-o9JlpIK2.js";
4
- import { c as usesSlowDynamicCompletion, i as isCompletionInstalled, o as resolveCompletionCachePath, r as installCompletion, s as resolveShellFromEnv, t as completionCacheExists } from "./completion-cli-BsX0NuzW.js";
4
+ import { c as usesSlowDynamicCompletion, i as isCompletionInstalled, o as resolveCompletionCachePath, r as installCompletion, s as resolveShellFromEnv, t as completionCacheExists } from "./completion-cli-DDgfvOcn.js";
5
5
  import path from "node:path";
6
6
  import { spawnSync } from "node:child_process";
7
7
  //#region src/commands/doctor-completion.ts
package/dist/entry.js CHANGED
@@ -203,7 +203,7 @@ function tryHandleRootHelpFastPath(argv, deps = {}) {
203
203
  }
204
204
  function runMainOrRootHelp(argv) {
205
205
  if (tryHandleRootHelpFastPath(argv)) return;
206
- import("./run-main-BYhJxN80.js").then(({ runCli }) => runCli(argv)).catch((error) => {
206
+ import("./run-main-BHZRsHzS.js").then(({ runCli }) => runCli(argv)).catch((error) => {
207
207
  console.error("[kaijibot] Failed to start CLI:", error instanceof Error ? error.stack ?? error.message : error);
208
208
  process$1.exitCode = 1;
209
209
  });
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "fingerprint": "7f9a14455059d2608f7b54d385279434b5706b102c321092d95562543bbefe89",
3
- "generatedAt": "2026-08-08T04:43:35.021Z"
3
+ "generatedAt": "2026-08-09T10:45:15.496Z"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "fingerprint": "0e863d9e866384b501fe67a8493a59d491638c0b14dbd959b9a842c395597683",
3
- "generatedAt": "2026-08-08T04:43:43.860Z"
3
+ "generatedAt": "2026-08-09T10:45:23.262Z"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "fingerprint": "f6b459898ce2a3c3ffaab0a08be3597be3c465e286ddf8b3b439b3cc96a48291",
3
- "generatedAt": "2026-08-08T04:43:49.563Z"
3
+ "generatedAt": "2026-08-09T10:45:29.703Z"
4
4
  }
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "fingerprint": "e14e27d86a5c2cd6c7799ab20222469b1730dec59a22bdb6fdc2634a5d690d4f",
3
- "generatedAt": "2026-08-08T04:43:49.677Z"
3
+ "generatedAt": "2026-08-09T10:45:29.768Z"
4
4
  }
@@ -744,7 +744,7 @@ const weixinPlugin = {
744
744
  });
745
745
  throw new Error(msg);
746
746
  }
747
- const { monitorWeixinProvider } = await import("../../monitor-Bjf1KNAi.js");
747
+ const { monitorWeixinProvider } = await import("../../monitor-DSyn4g7P.js");
748
748
  return monitorWeixinProvider({
749
749
  baseUrl: account.baseUrl,
750
750
  cdnBaseUrl: account.cdnBaseUrl,
@@ -1181,7 +1181,7 @@ async function runGatewayCommand$1(opts) {
1181
1181
  const { startGatewayServer } = await withProgress({
1182
1182
  label: t("cli.gateway.run.loadingModules"),
1183
1183
  indeterminate: true
1184
- }, async () => import("./server-CR-RmrOX.js"));
1184
+ }, async () => import("./server-oqZ0r7cB.js"));
1185
1185
  setConsoleTimestampPrefix(true);
1186
1186
  if (devMode) await ensureDevGatewayConfig({ reset: Boolean(opts.reset) });
1187
1187
  gatewayLog.info("loading configuration…");
@@ -0,0 +1,2 @@
1
+ import { t as getReplyFromConfig } from "./reply-D8YRXfdK.js";
2
+ export { getReplyFromConfig };
@@ -1 +1 @@
1
- export * from "./get-reply-from-config.runtime-CW4PYe0e.js";
1
+ export * from "./get-reply-from-config.runtime-cAAI8JXx.js";
@@ -238,7 +238,7 @@ function resolveNextHeartbeatDueMs(params) {
238
238
  const log = createSubsystemLogger("gateway/heartbeat");
239
239
  let heartbeatRunnerRuntimePromise = null;
240
240
  function loadHeartbeatRunnerRuntime() {
241
- heartbeatRunnerRuntimePromise ??= import("./heartbeat-runner.runtime-DQtwkqi5.js");
241
+ heartbeatRunnerRuntimePromise ??= import("./heartbeat-runner.runtime-CTztca1X.js");
242
242
  return heartbeatRunnerRuntimePromise;
243
243
  }
244
244
  function resolveHeartbeatSchedulerSeed(explicitSeed) {
@@ -664,6 +664,19 @@ async function runHeartbeatOnce(opts) {
664
664
  startedAt,
665
665
  heartbeatFileContent: preflight.heartbeatFileContent
666
666
  });
667
+ const insightIdForOutcome = hasInsightEvent ? preflight.pendingEventEntries.map((event) => event.contextKey ?? "").find((key) => key.startsWith("insight:"))?.slice(8) ?? null : null;
668
+ const insightOutcomeDep = opts.deps?.onInsightDeliveryOutcome;
669
+ const reportInsightOutcome = async (delivered) => {
670
+ if (!insightIdForOutcome || !insightOutcomeDep) return;
671
+ try {
672
+ await insightOutcomeDep({
673
+ agentId,
674
+ sessionKey,
675
+ insightId: insightIdForOutcome,
676
+ delivered
677
+ });
678
+ } catch {}
679
+ };
667
680
  if (prompt === null) {
668
681
  if (!preflight.isWakeReason && preflight.shouldInspectPendingEvents && preflight.pendingEventEntries.length > 0) consumeSystemEventEntries(sessionKey, preflight.pendingEventEntries);
669
682
  return {
@@ -821,6 +834,7 @@ async function runHeartbeatOnce(opts) {
821
834
  });
822
835
  await updateTaskTimestamps();
823
836
  consumeInspectedSystemEvents();
837
+ await reportInsightOutcome(false);
824
838
  return {
825
839
  status: "ran",
826
840
  durationMs: Date.now() - startedAt
@@ -976,11 +990,14 @@ async function runHeartbeatOnce(opts) {
976
990
  const { resolveCognitiveUserId } = await import("./identity-DN9QMF_Z.js");
977
991
  const insightUserId = resolveCognitiveUserId(sessionKey);
978
992
  if (insightUserId) {
993
+ const insightId = preflight.pendingEventEntries.map((event) => event.contextKey ?? "").find((key) => key.startsWith("insight:"))?.slice(8);
979
994
  const insightStore = new InsightStore(resolveConfigDir());
980
- const pending = (await insightStore.listActive(agentId, insightUserId, void 0, 5)).find((i) => !i.deliveryMessageId);
981
- if (pending) {
982
- pending.deliveryMessageId = msgId;
983
- await insightStore.save(agentId, insightUserId, pending);
995
+ if (insightId) {
996
+ const record = await insightStore.load(agentId, insightUserId, insightId);
997
+ if (record && !record.deliveryMessageId) {
998
+ record.deliveryMessageId = msgId;
999
+ await insightStore.save(agentId, insightUserId, record);
1000
+ }
984
1001
  }
985
1002
  }
986
1003
  } catch {}
@@ -1009,6 +1026,7 @@ async function runHeartbeatOnce(opts) {
1009
1026
  });
1010
1027
  await updateTaskTimestamps();
1011
1028
  consumeInspectedSystemEvents();
1029
+ await reportInsightOutcome(true);
1012
1030
  return {
1013
1031
  status: "ran",
1014
1032
  durationMs: Date.now() - startedAt
@@ -1033,6 +1051,7 @@ async function runHeartbeatOnce(opts) {
1033
1051
  function startHeartbeatRunner(opts) {
1034
1052
  const runtime = opts.runtime ?? defaultRuntime;
1035
1053
  const runOnce = opts.runOnce ?? runHeartbeatOnce;
1054
+ const insightDeliveryOutcome = opts.onInsightDeliveryOutcome;
1036
1055
  const state = {
1037
1056
  cfg: opts.cfg ?? loadConfig(),
1038
1057
  runtime,
@@ -1161,7 +1180,10 @@ function startHeartbeatRunner(opts) {
1161
1180
  heartbeat: targetAgent.heartbeat,
1162
1181
  reason,
1163
1182
  sessionKey: requestedSessionKey,
1164
- deps: { runtime: state.runtime }
1183
+ deps: {
1184
+ runtime: state.runtime,
1185
+ ...insightDeliveryOutcome ? { onInsightDeliveryOutcome: insightDeliveryOutcome } : {}
1186
+ }
1165
1187
  });
1166
1188
  if (res.status !== "skipped" || res.reason !== "disabled") advanceAgentSchedule(targetAgent, now, reason);
1167
1189
  return res.status === "ran" ? {
@@ -1187,7 +1209,10 @@ function startHeartbeatRunner(opts) {
1187
1209
  agentId: agent.agentId,
1188
1210
  heartbeat: agent.heartbeat,
1189
1211
  reason,
1190
- deps: { runtime: state.runtime }
1212
+ deps: {
1213
+ runtime: state.runtime,
1214
+ ...insightDeliveryOutcome ? { onInsightDeliveryOutcome: insightDeliveryOutcome } : {}
1215
+ }
1191
1216
  });
1192
1217
  } catch (err) {
1193
1218
  const errMsg = formatErrorMessage(err);
@@ -1,4 +1,4 @@
1
1
  import { n as resolveHeartbeatIntervalMs, r as resolveHeartbeatSummaryForAgent, t as isHeartbeatEnabledForAgent } from "./heartbeat-summary-DUIjehAy.js";
2
2
  import { i as setHeartbeatsEnabled, t as areHeartbeatsEnabled } from "./heartbeat-wake-Dq7RT9AC.js";
3
- import { i as isCronSystemEvent, n as runHeartbeatOnce, r as startHeartbeatRunner, t as resolveHeartbeatPrompt } from "./heartbeat-runner-BlntM0AS.js";
3
+ import { i as isCronSystemEvent, n as runHeartbeatOnce, r as startHeartbeatRunner, t as resolveHeartbeatPrompt } from "./heartbeat-runner-BIQVu7Z7.js";
4
4
  export { areHeartbeatsEnabled, isCronSystemEvent, isHeartbeatEnabledForAgent, resolveHeartbeatIntervalMs, resolveHeartbeatPrompt, resolveHeartbeatSummaryForAgent, runHeartbeatOnce, setHeartbeatsEnabled, startHeartbeatRunner };
@@ -0,0 +1,2 @@
1
+ import { t as getReplyFromConfig } from "./reply-D8YRXfdK.js";
2
+ export { getReplyFromConfig };
@@ -1 +1 @@
1
- export * from "./heartbeat-runner.runtime-DQtwkqi5.js";
1
+ export * from "./heartbeat-runner.runtime-CTztca1X.js";
@@ -1,5 +1,5 @@
1
1
  import { n as createNormalizedOutboundDeliverer } from "./reply-payload-DchHby3G.js";
2
- import { c as dispatchReplyFromConfig, i as withReplyDispatcher } from "./dispatch-C1PQp8ia.js";
2
+ import { c as dispatchReplyFromConfig, i as withReplyDispatcher } from "./dispatch-DkfVbg9D.js";
3
3
  import { t as createChannelReplyPipeline } from "./channel-reply-pipeline-pwTGYUNQ.js";
4
4
  //#region src/plugin-sdk/inbound-reply-dispatch.ts
5
5
  /** Run `dispatchReplyFromConfig` with a dispatcher that always gets its settled callback. */
package/dist/index.js CHANGED
@@ -26,7 +26,7 @@ let runExec;
26
26
  let saveSessionStore;
27
27
  let waitForever;
28
28
  async function loadLegacyCliDeps() {
29
- const [{ installGaxiosFetchCompat }, { runCli }] = await Promise.all([import("./gaxios-fetch-compat-C7uLN0yt.js"), import("./run-main-BYhJxN80.js")]);
29
+ const [{ installGaxiosFetchCompat }, { runCli }] = await Promise.all([import("./gaxios-fetch-compat-C7uLN0yt.js"), import("./run-main-BHZRsHzS.js")]);
30
30
  return {
31
31
  installGaxiosFetchCompat,
32
32
  runCli
@@ -38,7 +38,7 @@ async function runLegacyCliEntry(argv = process.argv, deps) {
38
38
  await runCli(argv);
39
39
  }
40
40
  const isMain = isMainModule({ currentFile: fileURLToPath(import.meta.url) });
41
- if (!isMain) ({applyTemplate, createDefaultDeps, deriveSessionKey, describePortOwner, ensureBinary, ensurePortAvailable, getReplyFromConfig, handlePortError, loadConfig, loadSessionStore, monitorWebChannel, normalizeE164, PortInUseError, promptYesNo, resolveSessionKey, resolveStorePath, runCommandWithTimeout, runExec, saveSessionStore, waitForever} = await import("./library-D7WB9pfC.js"));
41
+ if (!isMain) ({applyTemplate, createDefaultDeps, deriveSessionKey, describePortOwner, ensureBinary, ensurePortAvailable, getReplyFromConfig, handlePortError, loadConfig, loadSessionStore, monitorWebChannel, normalizeE164, PortInUseError, promptYesNo, resolveSessionKey, resolveStorePath, runCommandWithTimeout, runExec, saveSessionStore, waitForever} = await import("./library-0Arn0Twp.js"));
42
42
  if (isMain) {
43
43
  const { restoreTerminalState } = await import("./restore-ADlpnb-M.js");
44
44
  installUnhandledRejectionHandler();
@@ -16,7 +16,7 @@ let binariesRuntimePromise = null;
16
16
  let execRuntimePromise = null;
17
17
  let webChannelRuntimePromise = null;
18
18
  function loadReplyRuntime() {
19
- replyRuntimePromise ??= import("./reply.runtime-2-5jNLN7.js");
19
+ replyRuntimePromise ??= import("./reply.runtime-CtYU19fx.js");
20
20
  return replyRuntimePromise;
21
21
  }
22
22
  function loadPromptRuntime() {
@@ -3,7 +3,7 @@ import { n as resolvePreferredKaijiBotTmpDir } from "./tmp-kaijibot-dir-DReZNN28
3
3
  import { t as createTypingCallbacks } from "./typing-DQC5rX66.js";
4
4
  import "./channel-runtime-99WLZInM.js";
5
5
  import "./infra-runtime-Bkj-kkXZ.js";
6
- import { i as resolveDirectDmAuthorizationOutcome, o as resolveSenderCommandAuthorizationWithRuntime } from "./command-auth-DydNj8Yn.js";
6
+ import { i as resolveDirectDmAuthorizationOutcome, o as resolveSenderCommandAuthorizationWithRuntime } from "./command-auth-D--zsY0q.js";
7
7
  import { C as pauseSession, D as getConfig, E as classifyFetchError, G as logger, I as deriveRawAccountId, K as resolveStateDir, M as redactBody, N as redactToken, O as getUpdates, S as getRemainingPauseMs, W as readFrameworkAllowFromList, _ as decryptAesEcb, a as applyWeixinMessageSendingHook, b as TypingStatus, d as isMediaItem, g as buildCdnDownloadUrl, h as downloadRemoteImageToTemp, i as StreamingMarkdownFilter, j as sendTyping, m as weixinMessageToMsgContext, n as sendMessageItemWeixin, o as emitWeixinMessageSent, p as setContextToken, r as sendMessageWeixin, t as sendWeixinMediaFile, u as getContextTokenFromMsgContext, v as getMimeFromFilename, y as MessageItemType, z as loadWeixinAccount } from "./send-media-C3qhcyH9.js";
8
8
  import fs from "node:fs";
9
9
  import path from "node:path";
@@ -16,7 +16,7 @@ import { t as WizardCancelledError } from "./prompts-BxqZMpRa.js";
16
16
  import { n as logConfigUpdated } from "./logging-Cfo_m4oX.js";
17
17
  import { t as createClackPrompter } from "./clack-prompter-Dt70PlIh.js";
18
18
  import { c as resolveManifestProviderOnboardAuthFlags, i as resolveDeprecatedAuthChoiceReplacement, n as isDeprecatedAuthChoice, r as normalizeLegacyOnboardAuthChoice, t as formatDeprecatedNonInteractiveAuthChoiceError } from "./auth-choice-legacy-B36i1CbP.js";
19
- import { t as runSetupWizard } from "./setup-BL9KrPLD.js";
19
+ import { t as runSetupWizard } from "./setup-BDXJPCJZ.js";
20
20
  import { r as applyLocalSetupWorkspaceConfig } from "./onboard-config-D6HSppfR.js";
21
21
  //#region src/commands/onboard-core-auth-flags.ts
22
22
  const CORE_ONBOARD_AUTH_FLAGS = [];
@@ -1 +1 @@
1
- 2026-08-08T04:44:34.854Z
1
+ 2026-08-09T10:46:19.945Z
@@ -7,7 +7,7 @@ import { a as resolveEnvelopeFormatOptions, i as formatInboundFromLabel, r as fo
7
7
  import { n as resolveInboundDebounceMs, t as createInboundDebouncer } from "../inbound-debounce-BwpaLd0T.js";
8
8
  import { a as normalizeMentionText, i as matchesMentionWithExplicit, n as buildMentionRegexes, r as matchesMentionPatterns } from "../mentions-EL98on4E.js";
9
9
  import { i as resolveMentionGatingWithBypass, n as resolveInboundMentionDecision, r as resolveMentionGating, t as implicitMentionKindWhen } from "../mention-gating-D7mirAsn.js";
10
- import { r as dispatchInboundDirectDmWithRuntime, t as createDirectDmPreCryptoGuardPolicy } from "../direct-dm-1-HwQtv5.js";
10
+ import { r as dispatchInboundDirectDmWithRuntime, t as createDirectDmPreCryptoGuardPolicy } from "../direct-dm-CbJLNCK5.js";
11
11
  import { n as logInboundDrop } from "../logging-_lps4QsK.js";
12
12
  //#region src/channels/inbound-debounce-policy.ts
13
13
  function shouldDebounceTextInbound(params) {
@@ -5,8 +5,8 @@ import { t as resolveCommandAuthorization } from "../command-auth-XGJw9qMC.js";
5
5
  import { t as resolveStoredModelOverride } from "../stored-model-override-B_Pfo0rs.js";
6
6
  import { n as resolveSkillCommandInvocation, t as listReservedChatSlashCommandNames } from "../skill-commands-base-BhSbjIF5.js";
7
7
  import { i as resolveModelsCommandReply, n as formatModelsAvailableHeader, t as buildModelsProviderData } from "../commands-models-B7UPtUbJ.js";
8
- import { i as resolveInboundDirectDmAccessWithRuntime, n as createPreCryptoDirectDmAuthorizer } from "../direct-dm-1-HwQtv5.js";
8
+ import { i as resolveInboundDirectDmAccessWithRuntime, n as createPreCryptoDirectDmAuthorizer } from "../direct-dm-CbJLNCK5.js";
9
9
  import { t as resolveNativeCommandSessionTargets } from "../native-command-session-targets-DvXRRtVt.js";
10
10
  import { n as listSkillCommandsForWorkspace, t as listSkillCommandsForAgents } from "../skill-commands-BRwGzS_r.js";
11
- import { a as resolveSenderCommandAuthorization, i as resolveDirectDmAuthorizationOutcome, n as buildCommandsMessagePaginated, o as resolveSenderCommandAuthorizationWithRuntime, r as buildHelpMessage, t as buildCommandsMessage } from "../command-auth-DydNj8Yn.js";
11
+ import { a as resolveSenderCommandAuthorization, i as resolveDirectDmAuthorizationOutcome, n as buildCommandsMessagePaginated, o as resolveSenderCommandAuthorizationWithRuntime, r as buildHelpMessage, t as buildCommandsMessage } from "../command-auth-D--zsY0q.js";
12
12
  export { buildCommandText, buildCommandTextFromArgs, buildCommandsMessage, buildCommandsMessagePaginated, buildHelpMessage, buildModelsProviderData, createPreCryptoDirectDmAuthorizer, findCommandByNativeName, formatModelsAvailableHeader, getCommandDetection, hasControlCommand, hasInlineCommandTokens, isCommandEnabled, isCommandMessage, isControlCommandMessage, isNativeCommandSurface, listChatCommands, listChatCommandsForConfig, listNativeCommandSpecs, listNativeCommandSpecsForConfig, listReservedChatSlashCommandNames, listSkillCommandsForAgents, listSkillCommandsForWorkspace, maybeResolveTextAlias, normalizeCommandBody, parseCommandArgs, resolveCommandArgChoices, resolveCommandArgMenu, resolveCommandAuthorization, resolveCommandAuthorizedFromAuthorizers, resolveControlCommandGate, resolveDirectDmAuthorizationOutcome, resolveDualTextControlCommandGate, resolveInboundDirectDmAccessWithRuntime, resolveModelsCommandReply, resolveNativeCommandSessionTargets, resolveSenderCommandAuthorization, resolveSenderCommandAuthorizationWithRuntime, resolveSkillCommandInvocation, resolveStoredModelOverride, resolveTextCommand, serializeCommandArgs, shouldComputeCommandAuthorized, shouldHandleTextCommands };
@@ -1,2 +1,2 @@
1
- import { i as resolveInboundDirectDmAccessWithRuntime, n as createPreCryptoDirectDmAuthorizer, r as dispatchInboundDirectDmWithRuntime, t as createDirectDmPreCryptoGuardPolicy } from "../direct-dm-1-HwQtv5.js";
1
+ import { i as resolveInboundDirectDmAccessWithRuntime, n as createPreCryptoDirectDmAuthorizer, r as dispatchInboundDirectDmWithRuntime, t as createDirectDmPreCryptoGuardPolicy } from "../direct-dm-CbJLNCK5.js";
2
2
  export { createDirectDmPreCryptoGuardPolicy, createPreCryptoDirectDmAuthorizer, dispatchInboundDirectDmWithRuntime, resolveInboundDirectDmAccessWithRuntime };
@@ -1,5 +1,5 @@
1
1
  import { n as getPluginRuntimeGatewayRequestScope } from "../registry-DLm2u-Uf.js";
2
- import { n as handleGatewayRequest } from "../server-methods-R9IVu4Nx.js";
2
+ import { n as handleGatewayRequest } from "../server-methods-6o0mfjgq.js";
3
3
  //#region src/plugin-sdk/gateway-method-runtime.ts
4
4
  /**
5
5
  * Dispatch a Gateway control-plane method from an authenticated plugin request scope.
@@ -1,2 +1,2 @@
1
- import { i as recordInboundSessionAndDispatchReply, n as dispatchInboundReplyWithBase, r as dispatchReplyFromConfigWithSettledDispatcher, t as buildInboundReplyDispatchBase } from "../inbound-reply-dispatch-CEbl2yr5.js";
1
+ import { i as recordInboundSessionAndDispatchReply, n as dispatchInboundReplyWithBase, r as dispatchReplyFromConfigWithSettledDispatcher, t as buildInboundReplyDispatchBase } from "../inbound-reply-dispatch-BSMKDNKm.js";
2
2
  export { buildInboundReplyDispatchBase, dispatchInboundReplyWithBase, dispatchReplyFromConfigWithSettledDispatcher, recordInboundSessionAndDispatchReply };
@@ -1,4 +1,4 @@
1
1
  import { s as resolveChunkMode } from "../chunk-FzWJ2y1r.js";
2
2
  import { t as finalizeInboundContext } from "../inbound-context-bhGbq3l8.js";
3
- import { n as dispatchReplyWithDispatcher, t as dispatchReplyWithBufferedBlockDispatcher } from "../provider-dispatcher-DGc6N0AZ.js";
3
+ import { n as dispatchReplyWithDispatcher, t as dispatchReplyWithBufferedBlockDispatcher } from "../provider-dispatcher-Cujqljoi.js";
4
4
  export { dispatchReplyWithBufferedBlockDispatcher, dispatchReplyWithDispatcher, finalizeInboundContext, resolveChunkMode };
@@ -8,13 +8,13 @@ import { a as chunkText, c as resolveTextChunkLimit, i as chunkMarkdownTextWithM
8
8
  import { a as createReplyReferencePlanner } from "../reply-threading-COkM27Vc.js";
9
9
  import { n as resolveModelAsync } from "../model-to2Jvg2K.js";
10
10
  import { n as isAbortRequestText } from "../abort-primitives-y8CC2aTw.js";
11
- import { a as createReplyDispatcher, l as resetInboundDedupe, n as dispatchInboundMessageWithBufferedDispatcher, o as createReplyDispatcherWithTyping, r as dispatchInboundMessageWithDispatcher, t as dispatchInboundMessage } from "../dispatch-C1PQp8ia.js";
11
+ import { a as createReplyDispatcher, l as resetInboundDedupe, n as dispatchInboundMessageWithBufferedDispatcher, o as createReplyDispatcherWithTyping, r as dispatchInboundMessageWithDispatcher, t as dispatchInboundMessage } from "../dispatch-DkfVbg9D.js";
12
12
  import { t as finalizeInboundContext } from "../inbound-context-bhGbq3l8.js";
13
13
  import { n as resolveInboundDebounceMs, t as createInboundDebouncer } from "../inbound-debounce-BwpaLd0T.js";
14
- import { n as dispatchReplyWithDispatcher, t as dispatchReplyWithBufferedBlockDispatcher } from "../provider-dispatcher-DGc6N0AZ.js";
14
+ import { n as dispatchReplyWithDispatcher, t as dispatchReplyWithBufferedBlockDispatcher } from "../provider-dispatcher-Cujqljoi.js";
15
15
  import { n as parseActivationCommand, t as normalizeGroupActivation } from "../group-activation-BSNTwZ1-.js";
16
16
  import { t as resolveHeartbeatReplyPayload } from "../heartbeat-reply-payload-CZpRIF_C.js";
17
- import { t as getReplyFromConfig } from "../reply-LbSp51nz.js";
17
+ import { t as getReplyFromConfig } from "../reply-D8YRXfdK.js";
18
18
  import "../abort-oEKWlCCQ.js";
19
19
  import { n as isBtwRequestText } from "../btw-command-Ceh5j8Wd.js";
20
20
  import { t as prepareModelForSimpleCompletion } from "../simple-completion-transport-Cfgzjke9.js";
@@ -1,6 +1,12 @@
1
1
  import { type CognitiveLocale } from "./cognitive-locale.js";
2
2
  import type { CorrectionRecord } from "./correction/types.js";
3
- import type { CognitiveMode, InsightRecord, ModeClassification, PersonaTree } from "./types.js";
3
+ import type { InsightCandidate } from "./insight/types.js";
4
+ import type { CognitiveMode, ModeClassification, PersonaTree } from "./types.js";
5
+ type PendingInsightDelivery = {
6
+ candidate: InsightCandidate;
7
+ generatedAt: number;
8
+ opportunityType: string;
9
+ } | null;
4
10
  export declare function buildCognitiveModePrompt(params: {
5
11
  message: string;
6
12
  isHeartbeat?: boolean;
@@ -12,8 +18,8 @@ export declare function buildCognitiveModePrompt(params: {
12
18
  corrections?: CorrectionRecord[];
13
19
  /** Optional locale override; defaults to detecting from `persona`. */
14
20
  locale?: CognitiveLocale;
15
- /** Recently delivered insights, used by the continuity handshake to reference prior context. */
16
- recentInsights?: InsightRecord[];
21
+ /** Undelivered insight to surface as a handshake cue (distinct from already-delivered insights). */
22
+ pendingInsightDelivery?: PendingInsightDelivery;
17
23
  /** Current timestamp (ms); defaults to Date.now(). Used for handshake gap calculation. */
18
24
  now?: number;
19
25
  /** Continuity handshake config. When enabled and the gap since last interaction exceeds minGapHours, a handshake section is injected. */
@@ -25,3 +31,4 @@ export declare function buildCognitiveModePrompt(params: {
25
31
  prompt: string;
26
32
  classification: ModeClassification;
27
33
  };
34
+ export {};
@@ -1,4 +1,4 @@
1
- import type { InsightCandidate } from "./insight/types.js";
1
+ import type { InsightCandidate, InsightMode } from "./insight/types.js";
2
2
  export type CognitiveMode = "task" | "insight" | "hybrid" | "proactive";
3
3
  /**
4
4
  * Category of a typed insight extracted from user interactions.
@@ -172,6 +172,8 @@ export type InsightRecord = {
172
172
  userResponse?: string;
173
173
  /** Channel-native message id assigned to the delivered insight (for reply matching). */
174
174
  deliveryMessageId?: string;
175
+ /** Resolved insight mode at generation time — used to reconstruct pendingInsightDelivery. */
176
+ resolvedMode?: InsightMode;
175
177
  promptVariant?: {
176
178
  fewShotSet: number;
177
179
  frameIndex: number;
@@ -17,6 +17,10 @@ export type CognitiveConfig = {
17
17
  digestMode?: "realtime" | "daily" | "weekly";
18
18
  /** Epsilon-greedy exploration probability (0-1, default 0.2). Promotes exploration candidates with probability ε. Set to 0 to disable. */
19
19
  epsilonGreedy?: number;
20
+ /** Cost of false negative — missing a good insight. Higher = more willing to send. Default: 7 */
21
+ costFalseNegative?: number;
22
+ /** Cost of false alarm — bothering user with unwanted insight. Higher = more conservative. Default: 3 */
23
+ costFalseAlarm?: number;
20
24
  };
21
25
  /** User cognitive model settings */
22
26
  persona?: {
@@ -10,6 +10,12 @@ export type HeartbeatDeps = OutboundSendDeps & ChannelHeartbeatDeps & {
10
10
  runtime?: RuntimeEnv;
11
11
  getQueueSize?: (lane?: string) => number;
12
12
  nowMs?: () => number;
13
+ onInsightDeliveryOutcome?: (params: {
14
+ agentId: string;
15
+ sessionKey: string;
16
+ insightId: string;
17
+ delivered: boolean;
18
+ }) => Promise<void> | void;
13
19
  };
14
20
  export { areHeartbeatsEnabled, setHeartbeatsEnabled };
15
21
  export { isHeartbeatEnabledForAgent, resolveHeartbeatIntervalMs, resolveHeartbeatSummaryForAgent, type HeartbeatSummary, } from "./heartbeat-summary.js";
@@ -34,4 +40,5 @@ export declare function startHeartbeatRunner(opts: {
34
40
  abortSignal?: AbortSignal;
35
41
  runOnce?: typeof runHeartbeatOnce;
36
42
  stableSchedulerSeed?: string;
43
+ onInsightDeliveryOutcome?: HeartbeatDeps["onInsightDeliveryOutcome"];
37
44
  }): HeartbeatRunner;
@@ -1,2 +1,2 @@
1
- import { n as createPluginRuntime, r as setGatewaySubagentRuntime, t as clearGatewaySubagentRuntime } from "../../runtime-CvasIVwT.js";
1
+ import { n as createPluginRuntime, r as setGatewaySubagentRuntime, t as clearGatewaySubagentRuntime } from "../../runtime-BFQw_vNi.js";
2
2
  export { clearGatewaySubagentRuntime, createPluginRuntime, setGatewaySubagentRuntime };
@@ -244,8 +244,8 @@ function pickMode(candidates, modeBandits) {
244
244
  }
245
245
  //#endregion
246
246
  //#region src/cognitive/scheduler/gate.ts
247
- const DEFAULT_C_FN$1 = 5;
248
- const DEFAULT_C_FA$1 = 1;
247
+ const DEFAULT_C_FN$1 = 7;
248
+ const DEFAULT_C_FA$1 = 3;
249
249
  const BASE_NEED = .6;
250
250
  const EVENT_FACTORS = {
251
251
  timer: .7,
@@ -4,7 +4,7 @@ import { n as VERSION } from "./version-Bhg28AYn.js";
4
4
  import "./globals-BZWRdOIN.js";
5
5
  import { n as resolveCliName } from "./cli-name-mbXbS_Xz.js";
6
6
  import { n as resolveCliChannelOptions } from "./channel-options-B7HU3KNx.js";
7
- import { i as registerProgramCommands } from "./command-registry-DWFJJKiz.js";
7
+ import { i as registerProgramCommands } from "./command-registry-Cb__3qQe.js";
8
8
  import { n as setProgramContext } from "./program-context-beQs52o_.js";
9
9
  import { t as isCommandJsonOutputMode } from "./json-mode-DqdU2QKj.js";
10
10
  import { t as forceFreePort } from "./ports-Dkq3wtgj.js";
@@ -112,7 +112,7 @@ import { t as ensureSystemdUserLingerInteractive } from "./systemd-linger-PPA7ao
112
112
  import { t as formatHealthCheckFailure } from "./health-format-Ce_JDIhc.js";
113
113
  import { a as stripUnknownConfigKeys, i as resolveConfigPathTarget, n as formatConfigPath, r as noteOpencodeProviderOverrides, t as runDoctorConfigPreflight } from "./doctor-config-preflight-Btf1cOWg.js";
114
114
  import { a as runChannelPluginStartupMaintenance, i as normalizeCronJobIdentityFields, t as coerceFiniteScheduleNumber } from "./schedule-CwecsZBq.js";
115
- import { n as doctorShellCompletion } from "./doctor-completion-DJywUq0s.js";
115
+ import { n as doctorShellCompletion } from "./doctor-completion-DJHx_hH7.js";
116
116
  import { t as collectChannelStatusIssues } from "./channels-status-issues-D2AdlEnC.js";
117
117
  import { t as resolveDefaultChannelAccountContext } from "./channel-account-context-ANQKjlHX.js";
118
118
  import { a as runLegacyStateMigrations, n as detectLegacyStateMigrations } from "./state-migrations-Cbd6TTGf.js";
@@ -1,4 +1,4 @@
1
- import { n as dispatchInboundMessageWithBufferedDispatcher, r as dispatchInboundMessageWithDispatcher } from "./dispatch-C1PQp8ia.js";
1
+ import { n as dispatchInboundMessageWithBufferedDispatcher, r as dispatchInboundMessageWithDispatcher } from "./dispatch-DkfVbg9D.js";
2
2
  //#region src/auto-reply/reply/provider-dispatcher.ts
3
3
  async function dispatchReplyWithBufferedBlockDispatcher(params) {
4
4
  return await dispatchInboundMessageWithBufferedDispatcher({
@@ -15,7 +15,7 @@ import { i as formatControlUiSshHint } from "./onboard-helpers-BdaHbjnc.js";
15
15
  import { a as tryResolveGatewayService } from "./service-Dh0bwr9G.js";
16
16
  import { a as removeStateAndLinkedPaths, i as removePath, o as removeWorkspaceDirs, r as listAgentSessionDirs, t as buildCleanupPlan } from "./cleanup-utils-Bd_rHZ0n.js";
17
17
  import { n as runCommandWithRuntime } from "./cli-utils-IZWWFneu.js";
18
- import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-FfNyc6GQ.js";
18
+ import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-CB9jpO1l.js";
19
19
  import path from "node:path";
20
20
  import { cancel, confirm, isCancel, multiselect } from "@clack/prompts";
21
21
  //#region src/infra/clipboard.ts
@@ -5,7 +5,7 @@ import { i as resolveCliLocale, n as initCliI18n, r as t } from "./translate-CZM
5
5
  import { n as runCommandWithRuntime } from "./cli-utils-IZWWFneu.js";
6
6
  import { c as resolveManifestProviderOnboardAuthFlags } from "./auth-choice-legacy-B36i1CbP.js";
7
7
  import { n as formatAuthChoiceChoicesForCli } from "./auth-choice-options-0pERI0ul.js";
8
- import { n as CORE_ONBOARD_AUTH_FLAGS, t as setupWizardCommand } from "./onboard-CVbAx20c.js";
8
+ import { n as CORE_ONBOARD_AUTH_FLAGS, t as setupWizardCommand } from "./onboard-CQjF6_kD.js";
9
9
  //#region src/cli/program/register.onboard.ts
10
10
  function resolveInstallDaemonFlag(command, opts) {
11
11
  if (!command || typeof command !== "object") return;
@@ -11,7 +11,7 @@ import { s as resolveSessionTranscriptsDir } from "./paths-DSl3hU-R.js";
11
11
  import { n as safeParseWithSchema } from "./zod-parse-Cu9hgbVC.js";
12
12
  import { n as logConfigUpdated, t as formatConfigPath } from "./logging-Cfo_m4oX.js";
13
13
  import { n as runCommandWithRuntime } from "./cli-utils-IZWWFneu.js";
14
- import { t as setupWizardCommand } from "./onboard-CVbAx20c.js";
14
+ import { t as setupWizardCommand } from "./onboard-CQjF6_kD.js";
15
15
  import fs from "node:fs/promises";
16
16
  import JSON5 from "json5";
17
17
  import { z } from "zod";
@@ -58,7 +58,7 @@ const entrySpecs = [
58
58
  },
59
59
  {
60
60
  commandNames: ["gateway"],
61
- loadModule: () => import("./gateway-cli-B6XgMuOz.js"),
61
+ loadModule: () => import("./gateway-cli-DkP9Pskw.js"),
62
62
  exportName: "registerGatewayCli"
63
63
  },
64
64
  {
@@ -201,12 +201,12 @@ const entrySpecs = [
201
201
  },
202
202
  {
203
203
  commandNames: ["update"],
204
- loadModule: () => import("./update-cli-Dit5ZL-N.js"),
204
+ loadModule: () => import("./update-cli-BxJ22lNS.js"),
205
205
  exportName: "registerUpdateCli"
206
206
  },
207
207
  {
208
208
  commandNames: ["completion"],
209
- loadModule: () => import("./completion-cli-CffaJUO_.js"),
209
+ loadModule: () => import("./completion-cli-m0Bo_KXv.js"),
210
210
  exportName: "registerCompletionCli"
211
211
  }
212
212
  ])
@@ -1,3 +1,3 @@
1
- import { n as registerSubCliByName } from "./register.subclis-DWDRfm9Q.js";
1
+ import { n as registerSubCliByName } from "./register.subclis-C6-yF8tE.js";
2
2
  import "./subcli-descriptors-BumU40t_.js";
3
3
  export { registerSubCliByName };
@@ -1859,9 +1859,8 @@ async function runPreparedReply(params) {
1859
1859
  const rawBodyTrimmed = (ctx.CommandBody ?? ctx.RawBody ?? ctx.Body ?? "").trim();
1860
1860
  let cognitivePersona;
1861
1861
  let corrections;
1862
- let cognitiveInsights;
1863
1862
  try {
1864
- const { buildCognitiveModePrompt } = await import("./context-writer-C-Llg_ih.js");
1863
+ const { buildCognitiveModePrompt } = await import("./context-writer-Ccf978kV.js");
1865
1864
  const { PersonaStore } = await import("./store-sbo2sQ7F.js");
1866
1865
  const { resolveConfigDir } = await import("./utils-DPaRngSQ.js");
1867
1866
  const cognitiveCfg = cfg.cognitive;
@@ -1873,19 +1872,13 @@ async function runPreparedReply(params) {
1873
1872
  if (userId) corrections = await new CorrectionStore(resolveConfigDir()).listActive(agentId, userId);
1874
1873
  }
1875
1874
  } catch {}
1876
- try {
1877
- if (cognitiveCfg?.enabled !== false && userId) {
1878
- const { InsightStore } = await import("./store-CnS9lv_1.js");
1879
- cognitiveInsights = await new InsightStore(resolveConfigDir()).listActive(agentId, userId, void 0, 3);
1880
- }
1881
- } catch {}
1882
1875
  const { prompt: cognitivePrompt, classification: cognitiveClassification } = buildCognitiveModePrompt({
1883
1876
  message: rawBodyTrimmed,
1884
1877
  cognitiveEnabled: cognitiveCfg?.enabled,
1885
1878
  evolutionEnabled: cognitiveCfg?.evolution?.enabled !== false,
1886
1879
  persona: cognitivePersona,
1887
1880
  corrections,
1888
- recentInsights: cognitiveInsights,
1881
+ pendingInsightDelivery: cognitivePersona?.feedbackProfile.pendingInsightDelivery ?? null,
1889
1882
  handshakeConfig: cognitiveCfg?.handshake
1890
1883
  });
1891
1884
  if (cognitivePrompt) extraSystemPromptParts.push(cognitivePrompt);
@@ -0,0 +1,2 @@
1
+ import { t as getReplyFromConfig } from "./reply-D8YRXfdK.js";
2
+ export { getReplyFromConfig };
@@ -1 +1 @@
1
- export * from "./reply.runtime-2-5jNLN7.js";
1
+ export * from "./reply.runtime-CtYU19fx.js";
@@ -396,7 +396,7 @@ async function runCli(argv = process$1.argv) {
396
396
  if (await tryRouteCli(normalizedArgv)) return;
397
397
  enableConsoleCapture();
398
398
  const [{ buildProgram }, { installUnhandledRejectionHandler }, { restoreTerminalState }] = await Promise.all([
399
- import("./program-Bk8iztSC.js"),
399
+ import("./program-BM2X3cuO.js"),
400
400
  import("./unhandled-rejections-B7jiLc5X.js"),
401
401
  import("./restore-ADlpnb-M.js")
402
402
  ]);
@@ -413,10 +413,10 @@ async function runCli(argv = process$1.argv) {
413
413
  const { getProgramContext } = await import("./program-context-Bk8VQcWK.js");
414
414
  const ctx = getProgramContext(program);
415
415
  if (ctx) {
416
- const { registerCoreCliByName } = await import("./command-registry-A0f_2uRD.js");
416
+ const { registerCoreCliByName } = await import("./command-registry-M2_JqckO.js");
417
417
  await registerCoreCliByName(program, ctx, primary, parseArgv);
418
418
  }
419
- const { registerSubCliByName } = await import("./register.subclis-BbDrib8b.js");
419
+ const { registerSubCliByName } = await import("./register.subclis-C6O24zEE.js");
420
420
  await registerSubCliByName(program, primary);
421
421
  }
422
422
  if (!shouldSkipPluginCommandRegistration({
@@ -45,12 +45,12 @@ import { r as listWebSearchProviders, s as runWebSearch } from "./runtime-CQHmcb
45
45
  import { n as resolveChannelGroupRequireMention, t as resolveChannelGroupPolicy } from "./group-policy-v_Z-Myoq.js";
46
46
  import { y as shouldHandleTextCommands } from "./commands-registry-DsmkKhxm.js";
47
47
  import { i as shouldComputeCommandAuthorized, r as isControlCommandMessage, t as hasControlCommand } from "./command-detection-CwJFZ3Yb.js";
48
- import { c as dispatchReplyFromConfig, i as withReplyDispatcher, o as createReplyDispatcherWithTyping } from "./dispatch-C1PQp8ia.js";
48
+ import { c as dispatchReplyFromConfig, i as withReplyDispatcher, o as createReplyDispatcherWithTyping } from "./dispatch-DkfVbg9D.js";
49
49
  import { t as finalizeInboundContext } from "./inbound-context-bhGbq3l8.js";
50
50
  import { a as resolveEnvelopeFormatOptions, r as formatInboundEnvelope, t as formatAgentEnvelope } from "./envelope-Ctk092lH.js";
51
51
  import { n as resolveInboundDebounceMs, t as createInboundDebouncer } from "./inbound-debounce-BwpaLd0T.js";
52
52
  import { i as matchesMentionWithExplicit, n as buildMentionRegexes, r as matchesMentionPatterns } from "./mentions-EL98on4E.js";
53
- import { t as dispatchReplyWithBufferedBlockDispatcher } from "./provider-dispatcher-DGc6N0AZ.js";
53
+ import { t as dispatchReplyWithBufferedBlockDispatcher } from "./provider-dispatcher-Cujqljoi.js";
54
54
  import { n as shouldAckReaction, t as removeAckReactionAfterReply } from "./ack-reactions-gWXsc0l7.js";
55
55
  import { t as resolveCommandAuthorizedFromAuthorizers } from "./command-gating-7YZfGlk9.js";
56
56
  import { n as resolveInboundMentionDecision, t as implicitMentionKindWhen } from "./mention-gating-D7mirAsn.js";
@@ -360,7 +360,7 @@ function formatNativeDependencyHint(params) {
360
360
  }
361
361
  //#endregion
362
362
  //#region src/plugins/runtime/runtime-system.ts
363
- const runHeartbeatOnceInternal = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./heartbeat-runner-Bnf8xcNt.js")), (runtime) => runtime.runHeartbeatOnce);
363
+ const runHeartbeatOnceInternal = createLazyRuntimeMethod(createLazyRuntimeModule(() => import("./heartbeat-runner-CiOo2dfr.js")), (runtime) => runtime.runHeartbeatOnce);
364
364
  function createRuntimeSystem() {
365
365
  return {
366
366
  enqueueSystemEvent,
@@ -102,7 +102,7 @@ import { n as getActiveMemorySearchManager } from "./memory-runtime-2CSSp2_b.js"
102
102
  import { o as resolvePreferredSessionKeyForSessionIdMatches } from "./pi-embedded-runner-UQCF7MYt.js";
103
103
  import "./pi-embedded-DOW7myY1.js";
104
104
  import { n as isAbortRequestText } from "./abort-primitives-y8CC2aTw.js";
105
- import { a as createReplyDispatcher, t as dispatchInboundMessage } from "./dispatch-C1PQp8ia.js";
105
+ import { a as createReplyDispatcher, t as dispatchInboundMessage } from "./dispatch-DkfVbg9D.js";
106
106
  import { n as resolveSendPolicy, t as normalizeSendPolicy } from "./send-policy-BL4pOXE1.js";
107
107
  import { n as formatZonedTimestamp } from "./format-datetime-C4OkcYvZ.js";
108
108
  import { t as getChannelActivity } from "./channel-activity-ChJp-W_J.js";
@@ -136,7 +136,7 @@ import { o as fetchClawHubSkillDetail } from "./clawhub-Br81or9N.js";
136
136
  import { i as updateSkillsFromClawHub, r as searchSkillsFromClawHub, t as installSkillFromClawHub } from "./skills-clawhub-xDYWTF_c.js";
137
137
  import { t as installSkill } from "./skills-install-DdrW6QjU.js";
138
138
  import { t as buildWorkspaceSkillStatus } from "./skills-status-CQJi2Duf.js";
139
- import "./heartbeat-runner-BlntM0AS.js";
139
+ import "./heartbeat-runner-BIQVu7Z7.js";
140
140
  import { n as summarizeToolDescriptionText } from "./tool-description-summary-3i4MHeXW.js";
141
141
  import { t as resolveEffectiveToolInventory } from "./tools-effective-inventory-oVtwfQPM.js";
142
142
  import { t as runGatewayUpdate } from "./update-runner-CFPiEpEV.js";
@@ -1,7 +1,7 @@
1
1
  import { t as truncateCloseReason } from "./close-reason-DgNNQTUr.js";
2
2
  //#region src/gateway/server.ts
3
3
  async function loadServerImpl() {
4
- return await import("./server.impl-Dyj_4LQf.js");
4
+ return await import("./server.impl-BhohG95V.js");
5
5
  }
6
6
  async function startGatewayServer(...args) {
7
7
  return await (await loadServerImpl()).startGatewayServer(...args);
@@ -148,8 +148,8 @@ import { t as resolveModel } from "./model-to2Jvg2K.js";
148
148
  import { o as resolvePreferredSessionKeyForSessionIdMatches, t as runEmbeddedPiAgent } from "./pi-embedded-runner-UQCF7MYt.js";
149
149
  import { o as resolveBootstrapWarningSignaturesSeen } from "./bootstrap-budget-DkKmyVsg.js";
150
150
  import "./pi-embedded-DOW7myY1.js";
151
- import { n as createPluginRuntime, r as setGatewaySubagentRuntime } from "./runtime-CvasIVwT.js";
152
- import { s as getTotalPendingReplies } from "./dispatch-C1PQp8ia.js";
151
+ import { n as createPluginRuntime, r as setGatewaySubagentRuntime } from "./runtime-BFQw_vNi.js";
152
+ import { s as getTotalPendingReplies } from "./dispatch-DkfVbg9D.js";
153
153
  import { o as readChannelAllowFromStoreSync } from "./pairing-store-Beug75Tt.js";
154
154
  import { i as resolveChannelDefaultAccountId } from "./helpers-c8d9fhdJ.js";
155
155
  import { r as buildHistoryContextFromEntries } from "./history-65L0aBRj.js";
@@ -179,11 +179,11 @@ import { i as safeParseJson } from "./nodes.helpers-Anv98Zsu.js";
179
179
  import { r as resolveBootstrapProfileScopesForRole } from "./device-bootstrap-profile-I2zbsVdf.js";
180
180
  import { a as hasEffectivePairedDeviceRole, c as listEffectivePairedDeviceRoles, d as requestDevicePairing, g as verifyDeviceToken, h as updatePairedDeviceMetadata, i as getPairedDevice, n as approveDevicePairing, r as ensureDeviceToken, s as listDevicePairing, t as approveBootstrapDevicePairing } from "./device-pairing-DDIqpw_B.js";
181
181
  import { a as redeemDeviceBootstrapTokenProfile, n as getBoundDeviceBootstrapProfile, o as revokeDeviceBootstrapToken, r as getDeviceBootstrapTokenProfile, s as verifyDeviceBootstrapToken } from "./device-bootstrap-DZri1tFR.js";
182
- import { A as DEFAULT_ASSISTANT_IDENTITY, C as MAX_BUFFERED_BYTES, D as isSuppressedControlReplyLeadFragment, E as TICK_INTERVAL_MS, M as parseGatewayRole, N as roleCanSkipDeviceIdentity, O as isSuppressedControlReplyText, S as HEALTH_REFRESH_INTERVAL_MS, T as MAX_PREAUTH_PAYLOAD_BYTES, _ as loadCognitiveStatsSummary, a as upsertPresence, b as DEDUPE_MAX, c as mintCanvasCapabilityToken, d as loadVoiceWakeConfig, f as appendCronRunLog, g as startGatewayConfigReloader, h as resolveGatewayReloadSettings, i as listSystemPresence, j as resolveAssistantIdentity, k as abortChatRunById, l as normalizeCanvasScopedUrl, m as resolveCronRunLogPruneOptions, n as handleGatewayRequest, o as CANVAS_CAPABILITY_TTL_MS, p as resolveCronRunLogPath, r as broadcastPresenceSnapshot, s as buildCanvasScopedHostUrl, t as coreGatewayHandlers, u as formatError, v as DEFAULT_CHAT_HISTORY_TEXT_MAX_CHARS, w as MAX_PAYLOAD_BYTES, x as DEDUPE_TTL_MS, y as sanitizeChatHistoryMessages } from "./server-methods-R9IVu4Nx.js";
182
+ import { A as DEFAULT_ASSISTANT_IDENTITY, C as MAX_BUFFERED_BYTES, D as isSuppressedControlReplyLeadFragment, E as TICK_INTERVAL_MS, M as parseGatewayRole, N as roleCanSkipDeviceIdentity, O as isSuppressedControlReplyText, S as HEALTH_REFRESH_INTERVAL_MS, T as MAX_PREAUTH_PAYLOAD_BYTES, _ as loadCognitiveStatsSummary, a as upsertPresence, b as DEDUPE_MAX, c as mintCanvasCapabilityToken, d as loadVoiceWakeConfig, f as appendCronRunLog, g as startGatewayConfigReloader, h as resolveGatewayReloadSettings, i as listSystemPresence, j as resolveAssistantIdentity, k as abortChatRunById, l as normalizeCanvasScopedUrl, m as resolveCronRunLogPruneOptions, n as handleGatewayRequest, o as CANVAS_CAPABILITY_TTL_MS, p as resolveCronRunLogPath, r as broadcastPresenceSnapshot, s as buildCanvasScopedHostUrl, t as coreGatewayHandlers, u as formatError, v as DEFAULT_CHAT_HISTORY_TEXT_MAX_CHARS, w as MAX_PAYLOAD_BYTES, x as DEDUPE_TTL_MS, y as sanitizeChatHistoryMessages } from "./server-methods-6o0mfjgq.js";
183
183
  import "./agent-BjZepTjv.js";
184
184
  import { a as resolveApnsAuthConfigFromEnv, c as sendApnsExecApprovalAlert, d as resolveApnsRelayConfigFromEnv, l as sendApnsExecApprovalResolvedWake, n as loadApnsRegistration, t as clearApnsRegistrationIfCurrent, u as shouldClearStoredApnsRegistration } from "./push-apns-DC-Qdxey.js";
185
185
  import { m as normalizeUpdateChannel, n as compareSemverStrings, o as resolveNpmChannelTag, t as checkUpdateStatus } from "./update-check-Df7U6g_w.js";
186
- import { a as resolveCronSession, n as runHeartbeatOnce, r as startHeartbeatRunner } from "./heartbeat-runner-BlntM0AS.js";
186
+ import { a as resolveCronSession, n as runHeartbeatOnce, r as startHeartbeatRunner } from "./heartbeat-runner-BIQVu7Z7.js";
187
187
  import { a as resolveControlUiRootOverrideSync, n as isPackageProvenControlUiRootSync, o as resolveControlUiRootSync, t as ensureControlUiAssetsBuilt } from "./control-ui-assets-DNv5eSv-.js";
188
188
  import { t as loadProviderUsageSummary } from "./provider-usage-DkJQmZPn.js";
189
189
  import { n as loadCostUsageSummary } from "./session-cost-usage-CeA04EiL.js";
@@ -199,7 +199,7 @@ import { t as loadWorkspaceHookEntries } from "./workspace-BKDWfnPa.js";
199
199
  import { i as resolveGatewayStartupPluginIds, r as resolveConfiguredDeferredChannelPluginIds } from "./channel-plugin-ids-BmwxN62G.js";
200
200
  import { a as runChannelPluginStartupMaintenance, i as normalizeCronJobIdentityFields, n as computeNextRunAtMs, r as computePreviousRunAtMs, t as coerceFiniteScheduleNumber } from "./schedule-CwecsZBq.js";
201
201
  import { i as migrateOrphanedSessionKeys } from "./state-migrations-Cbd6TTGf.js";
202
- import { t as runSetupWizard } from "./setup-BL9KrPLD.js";
202
+ import { t as runSetupWizard } from "./setup-BDXJPCJZ.js";
203
203
  import { d as startTaskRegistryMaintenance, f as stopTaskRegistryMaintenance, g as markCronJobActive, h as clearCronJobActive, n as getInspectableTaskRegistrySummary } from "./task-registry.maintenance-DT4J_-Q9.js";
204
204
  import { n as collectEnabledInsecureOrDangerousFlags, t as DEFAULT_GATEWAY_HTTP_TOOL_DENY } from "./dangerous-tools-1weJroFG.js";
205
205
  import { _ as buildGogWatchStartArgs, g as buildGogWatchServeArgs, i as ensureTailscaleEndpoint, w as resolveGmailHookRuntimeConfig } from "./gmail-setup-utils-BjTvHWj-.js";
@@ -18796,10 +18796,16 @@ async function startGatewayServer(port = 18789, opts = {}) {
18796
18796
  } : {}
18797
18797
  }, connIds, { dropIfSlow: true });
18798
18798
  });
18799
- if (!minimalTestGateway) heartbeatRunner = startHeartbeatRunner({ cfg: cfgAtStart });
18799
+ let insightDeliveryOutcomeHandler;
18800
+ if (!minimalTestGateway) heartbeatRunner = startHeartbeatRunner({
18801
+ cfg: cfgAtStart,
18802
+ onInsightDeliveryOutcome: async (params) => {
18803
+ if (insightDeliveryOutcomeHandler) await insightDeliveryOutcomeHandler(params);
18804
+ }
18805
+ });
18800
18806
  if (!minimalTestGateway && cfgAtStart.cognitive?.proactive?.enabled !== false && cfgAtStart.cognitive?.enabled !== false) (async () => {
18801
18807
  try {
18802
- const { ProactiveScheduler } = await import("./proactive-scheduler-1vuql4ea.js");
18808
+ const { ProactiveScheduler } = await import("./proactive-scheduler-Bp_FBAER.js");
18803
18809
  const { InfoScanSource } = await import("./info-scan-source-B7go_Oc2.js");
18804
18810
  const { PersonaChangeSource } = await import("./persona-change-source-DPNY1vyZ.js");
18805
18811
  const { PersonaStore } = await import("./store-sbo2sQ7F.js");
@@ -18807,8 +18813,48 @@ async function startGatewayServer(port = 18789, opts = {}) {
18807
18813
  const { generateInsightCandidatesLLM, createDefaultInsightDeps, loadIdentityContextForInsight } = await import("./llm-engine-_29a7uJ6.js");
18808
18814
  const cognitiveStore = new PersonaStore(resolveConfigDir());
18809
18815
  await cognitiveStore.migrateFromFlatLayout();
18816
+ const baseInsightDeps = createDefaultInsightDeps();
18817
+ insightDeliveryOutcomeHandler = async ({ agentId, sessionKey, insightId, delivered }) => {
18818
+ const { resolveCognitiveUserId } = await import("./identity-DN9QMF_Z.js");
18819
+ const userId = resolveCognitiveUserId(sessionKey);
18820
+ if (!userId) return;
18821
+ if (delivered) {
18822
+ await cognitiveStore.update(agentId, userId, (persona) => {
18823
+ if (persona.feedbackProfile.pendingInsightDelivery) persona.feedbackProfile.pendingInsightDelivery = null;
18824
+ return persona;
18825
+ });
18826
+ return;
18827
+ }
18828
+ const { InsightStore: InsightStoreCls } = await import("./store-CnS9lv_1.js");
18829
+ const record = await new InsightStoreCls(resolveConfigDir()).load(agentId, userId, insightId);
18830
+ if (!record) return;
18831
+ await cognitiveStore.update(agentId, userId, (persona) => {
18832
+ const existing = persona.feedbackProfile.pendingInsightDelivery;
18833
+ if (existing && existing.generatedAt > record.generatedAt) return persona;
18834
+ const candidate = {
18835
+ id: record.id,
18836
+ content: record.content,
18837
+ rationale: record.rationale,
18838
+ targetDomains: record.targetDomains,
18839
+ sourceDomains: record.sourceDomains,
18840
+ relevanceScore: 0,
18841
+ surpriseScore: 0,
18842
+ compositeScore: 0,
18843
+ sources: record.sources,
18844
+ verificationStatus: "verified",
18845
+ ...record.resolvedMode ? { resolvedMode: record.resolvedMode } : {},
18846
+ ...record.promptVariant ? { promptVariant: record.promptVariant } : {}
18847
+ };
18848
+ persona.feedbackProfile.pendingInsightDelivery = {
18849
+ candidate,
18850
+ generatedAt: record.generatedAt,
18851
+ opportunityType: "redelivery"
18852
+ };
18853
+ return persona;
18854
+ });
18855
+ };
18810
18856
  const insightDeps = {
18811
- ...createDefaultInsightDeps(),
18857
+ ...baseInsightDeps,
18812
18858
  webSearch: async (query) => {
18813
18859
  try {
18814
18860
  const { runWebSearch } = await import("./runtime-B-REKkqz.js");
@@ -18859,7 +18905,9 @@ async function startGatewayServer(port = 18789, opts = {}) {
18859
18905
  timezone: cfgAtStart.cognitive?.proactive?.activeHours?.timezone,
18860
18906
  patternVerification: cfgAtStart.cognitive?.insight?.patternVerification,
18861
18907
  llmFreshnessCheck: cfgAtStart.cognitive?.insight?.llmFreshnessCheck,
18862
- epsilonGreedy: cfgAtStart.cognitive?.proactive?.epsilonGreedy
18908
+ epsilonGreedy: cfgAtStart.cognitive?.proactive?.epsilonGreedy,
18909
+ costFalseNegative: cfgAtStart.cognitive?.proactive?.costFalseNegative,
18910
+ costFalseAlarm: cfgAtStart.cognitive?.proactive?.costFalseAlarm
18863
18911
  }, {
18864
18912
  loadPersona: async (agentId, userId) => cognitiveStore.load(agentId, userId),
18865
18913
  savePersona: async (agentId, userId, persona) => {
@@ -18878,6 +18926,7 @@ async function startGatewayServer(port = 18789, opts = {}) {
18878
18926
  rationale: candidate.rationale,
18879
18927
  sources: candidate.sources,
18880
18928
  deliveredAt: Date.now(),
18929
+ resolvedMode: candidate.resolvedMode,
18881
18930
  promptVariant: candidate.promptVariant
18882
18931
  };
18883
18932
  try {
@@ -18894,7 +18943,10 @@ async function startGatewayServer(port = 18789, opts = {}) {
18894
18943
  const insightText = candidate.content;
18895
18944
  const sessionKey = findSessionKeyForUserId(cfgAtStart, userId, agentId);
18896
18945
  if (sessionKey) {
18897
- enqueueSystemEvent(`[Cognitive Insight] ${insightText}\n(这是一条已生成的主动洞察,请用你自己的语言自然地分享给用户。)`, { sessionKey });
18946
+ enqueueSystemEvent(`[Cognitive Insight] ${insightText}\n(这是一条已生成的主动洞察,请用你自己的语言自然地分享给用户。)`, {
18947
+ sessionKey,
18948
+ contextKey: `insight:${record.id}`
18949
+ });
18898
18950
  requestHeartbeatNow({
18899
18951
  reason: "cognitive-insight",
18900
18952
  sessionKey
@@ -483,7 +483,7 @@ async function runSetupWizard(opts, runtime = defaultRuntime, prompter) {
483
483
  mode
484
484
  });
485
485
  await writeConfigFile(nextConfig);
486
- const { finalizeSetupWizard } = await import("./setup.finalize-Cwo4dSP4.js");
486
+ const { finalizeSetupWizard } = await import("./setup.finalize-Cib80vdy.js");
487
487
  const { launchedTui } = await finalizeSetupWizard({
488
488
  flow,
489
489
  opts,
@@ -14,11 +14,11 @@ import { i as isSystemdUserServiceAvailable } from "./systemd-CWxWaH1R.js";
14
14
  import { a as tryResolveGatewayService, t as describeGatewayServiceRestart } from "./service-Dh0bwr9G.js";
15
15
  import { n as listConfiguredWebSearchProviders } from "./runtime-CQHmcblN.js";
16
16
  import { t as ensureControlUiAssetsBuilt } from "./control-ui-assets-DNv5eSv-.js";
17
- import { r as installCompletion } from "./completion-cli-BsX0NuzW.js";
17
+ import { r as installCompletion } from "./completion-cli-DDgfvOcn.js";
18
18
  import { r as healthCommand } from "./health-CGERlBuw.js";
19
19
  import { t as resolveSetupSecretInputString } from "./setup.secret-input-DhUIgaP4.js";
20
20
  import { t as formatHealthCheckFailure } from "./health-format-Ce_JDIhc.js";
21
- import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-DJywUq0s.js";
21
+ import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-DJHx_hH7.js";
22
22
  import { t as runTui } from "./tui-BM_07QIG.js";
23
23
  import path from "node:path";
24
24
  import os from "node:os";
@@ -29,10 +29,10 @@ import { d as formatUpdateChannelLabel, g as resolveUpdateChannelDisplay, h as r
29
29
  import { i as resolveUpdateAvailability, n as formatUpdateOneLiner, t as formatUpdateAvailableHint } from "./status.update-W1QbnUdM.js";
30
30
  import { a as createGlobalInstallEnv, c as globalInstallArgs, d as resolveGlobalInstallTarget, f as normalizePackageTagInput, i as collectInstalledGlobalPackageErrors, l as resolveExpectedInstalledVersionFromSpec, m as readPackageVersion, n as canResolveRegistryVersionForPackageTarget, o as detectGlobalInstallManagerByPresence, p as readPackageName, r as cleanupGlobalRenameDirs, s as detectGlobalInstallManagerForRoot, t as runGatewayUpdate, u as resolveGlobalInstallSpec } from "./update-runner-CFPiEpEV.js";
31
31
  import { n as renderTable, t as getTerminalTableWidth } from "./table-Bwd5JCmV.js";
32
- import { r as installCompletion } from "./completion-cli-BsX0NuzW.js";
32
+ import { r as installCompletion } from "./completion-cli-DDgfvOcn.js";
33
33
  import { n as updateNpmInstalledPlugins, t as syncPluginsForUpdateChannel } from "./update-Dxt6Te--.js";
34
- import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-FfNyc6GQ.js";
35
- import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-DJywUq0s.js";
34
+ import { n as doctorCommand, t as selectStyled } from "./prompt-select-styled-CB9jpO1l.js";
35
+ import { r as ensureCompletionCacheExists, t as checkShellCompletionStatus } from "./doctor-completion-DJHx_hH7.js";
36
36
  import path from "node:path";
37
37
  import { spawn, spawnSync } from "node:child_process";
38
38
  import os from "node:os";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kaijibot",
3
- "version": "2026.8.8",
3
+ "version": "2026.8.9",
4
4
  "description": "Proactive cognitive AI assistant with Feishu/WeChat integration — learns user interests, pushes cross-domain insights, evolves skills, self-corrects. 40+ LLM providers, runs on cloud/desktop/Android.",
5
5
  "keywords": [
6
6
  "ai",
@@ -1,2 +0,0 @@
1
- import { t as getReplyFromConfig } from "./reply-LbSp51nz.js";
2
- export { getReplyFromConfig };
@@ -1,2 +0,0 @@
1
- import { t as getReplyFromConfig } from "./reply-LbSp51nz.js";
2
- export { getReplyFromConfig };
@@ -1,2 +0,0 @@
1
- import { t as getReplyFromConfig } from "./reply-LbSp51nz.js";
2
- export { getReplyFromConfig };