blun-king-cli 9.1.536 → 9.1.550

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 (117) hide show
  1. package/LIESMICH.txt +13 -869
  2. package/README.md +41 -833
  3. package/bin/assistant-message-offload-policy.cjs +3 -1
  4. package/bin/context-performance-policy.cjs +2 -5
  5. package/bin/context-pressure-policy.cjs +20 -0
  6. package/bin/cron-run-output.cjs +45 -0
  7. package/bin/cron-run-store.cjs +145 -0
  8. package/bin/durable-task-resume-policy.cjs +130 -0
  9. package/bin/durable-task-resume-runtime.cjs +117 -0
  10. package/bin/durable-task-resume-store.cjs +88 -0
  11. package/bin/editable-tool-approval-policy.cjs +540 -0
  12. package/bin/editable-tool-approval-runtime.cjs +99 -0
  13. package/bin/html-to-research-markdown.cjs +146 -0
  14. package/bin/programmatic-tool-runtime.mjs +330 -4
  15. package/bin/read-continuation-policy.cjs +36 -5
  16. package/bin/scoped-cron-run-policy.cjs +358 -0
  17. package/bin/startup-preferences.cjs +3 -3
  18. package/bin/structured-agent-swarm-output.cjs +325 -0
  19. package/bin/subagent-context-fork-policy.cjs +155 -0
  20. package/bin/subagent-skill-policy.cjs +204 -0
  21. package/bin/telegram-approval-relay.cjs +2 -1
  22. package/bin/tool-result-offload-policy.cjs +14 -1
  23. package/bin/update-notice.js +14 -18
  24. package/bin/user-message-offload-policy.cjs +3 -1
  25. package/blun.mjs +1089 -477
  26. package/codebase-index/README.md +12 -0
  27. package/codebase-index/codebase_index.py +129 -18
  28. package/package.json +23 -58
  29. package/telegram-plugin/bin/telegram-typing-keepalive.cjs +89 -0
  30. package/telegram-plugin/dist/bridge.mjs +8 -1
  31. package/CHANGELOG.md +0 -321
  32. package/agent-spine-plugin/CHANGELOG.md +0 -406
  33. package/agent-spine-plugin/CONTRIBUTING.md +0 -52
  34. package/agent-spine-plugin/README.md +0 -344
  35. package/agent-spine-plugin/SECURITY.md +0 -47
  36. package/agent-spine-plugin/docs/acceptance.md +0 -61
  37. package/agent-spine-plugin/docs/architecture.md +0 -183
  38. package/agent-spine-plugin/docs/attention.md +0 -121
  39. package/agent-spine-plugin/docs/automatic-continuity.md +0 -79
  40. package/agent-spine-plugin/docs/channel-runtime.md +0 -92
  41. package/agent-spine-plugin/docs/coordination.md +0 -138
  42. package/agent-spine-plugin/docs/feed-transport.md +0 -99
  43. package/agent-spine-plugin/docs/gateway-runtime.md +0 -116
  44. package/agent-spine-plugin/docs/harness-reference.md +0 -45
  45. package/agent-spine-plugin/docs/host-integration.md +0 -129
  46. package/agent-spine-plugin/docs/https-transport.md +0 -116
  47. package/agent-spine-plugin/docs/learning.md +0 -133
  48. package/agent-spine-plugin/docs/object-transport.md +0 -93
  49. package/agent-spine-plugin/docs/peer-transport.md +0 -88
  50. package/agent-spine-plugin/docs/preflight-recall.md +0 -69
  51. package/agent-spine-plugin/docs/preservation-contract.md +0 -53
  52. package/agent-spine-plugin/docs/quality-gates.md +0 -50
  53. package/agent-spine-plugin/docs/relationships.md +0 -73
  54. package/agent-spine-plugin/docs/releasing.md +0 -83
  55. package/agent-spine-plugin/docs/roadmap.md +0 -307
  56. package/agent-spine-plugin/docs/selfstarter.md +0 -88
  57. package/agent-spine-plugin/docs/session-briefing.md +0 -74
  58. package/agent-spine-plugin/docs/shared-memory.md +0 -259
  59. package/agent-spine-plugin/docs/source-roots.md +0 -86
  60. package/agent-spine-plugin/docs/sqlite-transport.md +0 -76
  61. package/agent-spine-plugin/scripts/check-hosts.js +0 -195
  62. package/agent-spine-plugin/scripts/check-install.js +0 -569
  63. package/agent-spine-plugin/scripts/check-syntax.js +0 -29
  64. package/agent-spine-plugin/scripts/github-actions.js +0 -11
  65. package/agent-spine-plugin/scripts/release-check.js +0 -128
  66. package/agent-spine-plugin/scripts/run-acceptance.js +0 -19
  67. package/agent-spine-plugin/scripts/run-checks.js +0 -46
  68. package/agent-spine-plugin/scripts/run-tests-hermetic.js +0 -73
  69. package/agent-spine-plugin/spine-example/1-identity.md +0 -12
  70. package/agent-spine-plugin/spine-example/2-voice.md +0 -6
  71. package/agent-spine-plugin/spine-example/3-conduct.md +0 -8
  72. package/agent-spine-plugin/spine-example/4-history.md +0 -4
  73. package/bin/fredrik-glm-provider.cjs +0 -256
  74. package/bin/package-regression-policy.cjs +0 -77
  75. package/fredrik-glm-profile.toml.example +0 -26
  76. package/release-planned-removals.json +0 -15
  77. package/scripts/check-active-profile-plugin-startup.js +0 -36
  78. package/scripts/check-active-work-steer-regression.js +0 -46
  79. package/scripts/check-approval-observability-regression.js +0 -111
  80. package/scripts/check-approval-queue-shortcuts-regression.js +0 -65
  81. package/scripts/check-bundled-agent-spine-regression.js +0 -48
  82. package/scripts/check-codebase-search-packaging-regression.js +0 -92
  83. package/scripts/check-copy-command-regression.js +0 -74
  84. package/scripts/check-current-turn-read-pin-mutation-regression.js +0 -72
  85. package/scripts/check-current-turn-read-pin-regression.js +0 -94
  86. package/scripts/check-deepseek-native-max-regression.js +0 -49
  87. package/scripts/check-empty-response-effort-downgrade-regression.js +0 -48
  88. package/scripts/check-fredrik-glm-mutation-regression.js +0 -18
  89. package/scripts/check-fredrik-glm-regression.js +0 -169
  90. package/scripts/check-historical-tool-result-preview-regression.js +0 -77
  91. package/scripts/check-history-pressure-offload-regression.js +0 -77
  92. package/scripts/check-mcp-startup-wait-budget.js +0 -48
  93. package/scripts/check-package-regression.js +0 -38
  94. package/scripts/check-plugin-startup-regression.js +0 -53
  95. package/scripts/check-programmatic-context-isolation-regression.js +0 -193
  96. package/scripts/check-programmatic-tool-regression.js +0 -294
  97. package/scripts/check-queue-controls-regression.js +0 -189
  98. package/scripts/check-release-metadata.js +0 -103
  99. package/scripts/check-reload-agent-spine-regression.js +0 -76
  100. package/scripts/check-resume-replay-regression.js +0 -102
  101. package/scripts/check-session-cancel-regression.js +0 -43
  102. package/scripts/check-session-picker-resume-metrics-regression.js +0 -97
  103. package/scripts/check-session-start-hook-context-regression.js +0 -228
  104. package/scripts/check-shell-terminal-isolation-regression.js +0 -81
  105. package/scripts/check-slash-escape-regression.js +0 -89
  106. package/scripts/check-startup-swarm-command-regression.js +0 -24
  107. package/scripts/check-structured-subagent-output-regression.js +0 -331
  108. package/scripts/check-telegram-bridge-watchdog.js +0 -60
  109. package/scripts/check-telegram-direct-work-resume-regression.js +0 -53
  110. package/scripts/check-telegram-loop-exactly-once-regression.js +0 -71
  111. package/scripts/check-todo-loop-regression.js +0 -78
  112. package/scripts/check-todo-progress-regression.js +0 -416
  113. package/scripts/check-todo-recovery-catalog-regression.js +0 -50
  114. package/scripts/check-tool-schema-capacity-regression.js +0 -40
  115. package/scripts/programmatic-tool-runtime.test.mjs +0 -365
  116. package/scripts/structured-subagent-output.test.cjs +0 -170
  117. /package/{scripts → bin}/fix-node-pty-perms.js +0 -0
@@ -1,5 +1,10 @@
1
1
  'use strict';
2
2
 
3
+ const {
4
+ DEFAULT_CONTEXT_PRESSURE_RATIO,
5
+ hasContextPressure,
6
+ } = require('./context-pressure-policy.cjs');
7
+
3
8
  const TOOL_RESULT_MAX_CHARS = 12_000;
4
9
  const TOOL_RESULT_PREVIEW_CHARS = 2_000;
5
10
  const TOOL_RESULT_HISTORICAL_PREVIEW_CHARS = 400;
@@ -16,8 +21,13 @@ const TOOL_RESULT_HISTORICAL_REPLACEMENT_BUDGET_CHARS = 1_000;
16
21
  const TOOL_RESULT_SUCCESS_KEEP_RECENT_MESSAGES = 12;
17
22
  const TOOL_RESULT_HISTORICAL_SUCCESS_MARKER = '[Old tool result content cleared]';
18
23
  const TOOL_RESULT_REPEAT_MARKER = '[Repeated tool result omitted]';
24
+ const TOOL_RESULT_OFFLOAD_PRESSURE_RATIO = DEFAULT_CONTEXT_PRESSURE_RATIO;
19
25
  const READ_CONTINUATION_LINE_OFFSET_RE = /^Continue reading with line_offset=(\d+)\. Do not assume you have reached the end of the file\.$/mu;
20
26
 
27
+ function hasToolResultOffloadPressure(options = {}) {
28
+ return hasContextPressure(options);
29
+ }
30
+
21
31
  function shouldOffloadToolResult(textLength) {
22
32
  return Number.isFinite(textLength) && textLength > TOOL_RESULT_MAX_CHARS;
23
33
  }
@@ -154,8 +164,9 @@ function compactPersistedToolResultReference(content) {
154
164
  return changed ? compacted : content;
155
165
  }
156
166
 
157
- function compactHistoricalSuccessfulToolResults(messages) {
167
+ function compactHistoricalSuccessfulToolResults(messages, options = {}) {
158
168
  if (!Array.isArray(messages) || messages.length === 0) return messages;
169
+ if (!hasToolResultOffloadPressure(options)) return messages;
159
170
 
160
171
  const recentStart = Math.max(0, messages.length - TOOL_RESULT_SUCCESS_KEEP_RECENT_MESSAGES);
161
172
  const freshIds = freshToolResultIds(messages);
@@ -326,6 +337,7 @@ function selectHistoricalToolResultOffloads(textLengths) {
326
337
  }
327
338
 
328
339
  module.exports = {
340
+ TOOL_RESULT_OFFLOAD_PRESSURE_RATIO,
329
341
  TOOL_RESULT_BATCH_MAX_CHARS,
330
342
  TOOL_RESULT_BATCH_MIN_ITEM_CHARS,
331
343
  TOOL_RESULT_BATCH_REPLACEMENT_BUDGET_CHARS,
@@ -349,6 +361,7 @@ module.exports = {
349
361
  currentUserTurnStartIndex,
350
362
  dedupeRepeatedSuccessfulToolResults,
351
363
  freshToolResultIds,
364
+ hasToolResultOffloadPressure,
352
365
  isPersistedToolResultReference,
353
366
  readContinuationLineOffset,
354
367
  selectHistoricalToolResultOffloads,
@@ -1484,20 +1484,6 @@ async function runUpdateFlow(options, explicitUpdate) {
1484
1484
  ? explicitFailure(stderr, 'lease_unavailable', undefined, uiLocale)
1485
1485
  : { kind: 'continue', reason: 'lease_unavailable' };
1486
1486
  }
1487
- if (!options.installVersion) {
1488
- installerSession = await (options.prepareInstaller || preparePinnedInstaller)(
1489
- release.version,
1490
- { blunDir, packageRoot },
1491
- );
1492
- if (!installerSession?.ready) {
1493
- if (explicitUpdate) {
1494
- return explicitFailure(stderr, 'installer_unavailable', undefined, uiLocale);
1495
- }
1496
- return installerSession?.reason === 'failed'
1497
- ? { kind: 'continue', reason: 'installer_unavailable' }
1498
- : { kind: 'update_in_progress' };
1499
- }
1500
- }
1501
1487
  let action;
1502
1488
  if (explicitUpdate || options.autoInstall === true) {
1503
1489
  action = 'install';
@@ -1515,10 +1501,6 @@ async function runUpdateFlow(options, explicitUpdate) {
1515
1501
  }
1516
1502
  }
1517
1503
  if (action !== 'install') {
1518
- if (installerSession?.ready) {
1519
- await installerSession.cancel();
1520
- installerSession = undefined;
1521
- }
1522
1504
  if (action === 'skip-once') {
1523
1505
  return { kind: 'continue', reason: 'skipped_once' };
1524
1506
  }
@@ -1537,6 +1519,20 @@ async function runUpdateFlow(options, explicitUpdate) {
1537
1519
  }
1538
1520
  return { kind: 'continue', reason: 'postponed' };
1539
1521
  }
1522
+ if (!options.installVersion) {
1523
+ installerSession = await (options.prepareInstaller || preparePinnedInstaller)(
1524
+ release.version,
1525
+ { blunDir, packageRoot },
1526
+ );
1527
+ if (!installerSession?.ready) {
1528
+ if (explicitUpdate) {
1529
+ return explicitFailure(stderr, 'installer_unavailable', undefined, uiLocale);
1530
+ }
1531
+ return installerSession?.reason === 'failed'
1532
+ ? { kind: 'continue', reason: 'installer_unavailable' }
1533
+ : { kind: 'update_in_progress' };
1534
+ }
1535
+ }
1540
1536
 
1541
1537
  const updateProgress = createUpdateProgress(stdout);
1542
1538
  updateProgress(1, copy.updateChecked);
@@ -4,6 +4,7 @@ const {
4
4
  hasHistoricalOffloadPressure,
5
5
  historyTextChars,
6
6
  } = require('./history-offload-pressure-policy.cjs');
7
+ const { hasContextPressure } = require('./context-pressure-policy.cjs');
7
8
 
8
9
  const USER_MESSAGE_MAX_CHARS = 200_000;
9
10
  const HISTORICAL_USER_MESSAGE_MAX_CHARS = 4_000;
@@ -30,7 +31,8 @@ function shouldOffloadHistoricalUserMessage(options = {}) {
30
31
  || historyIndex >= historyLength
31
32
  ) return false;
32
33
  const cutoff = Math.max(0, historyLength - USER_MESSAGE_KEEP_RECENT_MESSAGES);
33
- return hasHistoricalOffloadPressure({ historyLength, historyChars })
34
+ return hasContextPressure(options)
35
+ && hasHistoricalOffloadPressure({ historyLength, historyChars })
34
36
  && historyIndex < cutoff
35
37
  && textChars > HISTORICAL_USER_MESSAGE_MAX_CHARS;
36
38
  }