blun-king-cli 9.1.564 → 9.1.566

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 (88) hide show
  1. package/LIESMICH.txt +2 -2
  2. package/README.md +1 -1
  3. package/agent-spine-plugin/.claude-plugin/marketplace.json +20 -20
  4. package/agent-spine-plugin/.claude-plugin/plugin.json +14 -14
  5. package/agent-spine-plugin/.codex-plugin/plugin.json +34 -34
  6. package/agent-spine-plugin/.mcp.json +8 -8
  7. package/agent-spine-plugin/CONTRIBUTING.md +52 -0
  8. package/agent-spine-plugin/LICENSE +186 -186
  9. package/agent-spine-plugin/README.md +406 -0
  10. package/agent-spine-plugin/SECURITY.md +47 -0
  11. package/agent-spine-plugin/assets/agentspine-banner.svg +32 -32
  12. package/agent-spine-plugin/bin/agentspine-mcp.js +4 -4
  13. package/agent-spine-plugin/bin/agentspine.js +7 -7
  14. package/agent-spine-plugin/blun.plugin.json +33 -33
  15. package/agent-spine-plugin/hooks/codex.json +47 -47
  16. package/agent-spine-plugin/hooks/hooks.json +106 -106
  17. package/agent-spine-plugin/hooks/version.json +5 -5
  18. package/agent-spine-plugin/package.json +69 -69
  19. package/agent-spine-plugin/scripts/check-hosts.js +199 -199
  20. package/agent-spine-plugin/skill/SKILL.md +76 -76
  21. package/agent-spine-plugin/skills/agent-spine/SKILL.md +85 -85
  22. package/agent-spine-plugin/src/cli.js +1488 -1442
  23. package/agent-spine-plugin/src/hook.js +882 -861
  24. package/agent-spine-plugin/src/index.js +94 -93
  25. package/agent-spine-plugin/src/lib/acceptance.js +333 -333
  26. package/agent-spine-plugin/src/lib/attention.js +755 -755
  27. package/agent-spine-plugin/src/lib/audit.js +351 -342
  28. package/agent-spine-plugin/src/lib/authentication.js +515 -515
  29. package/agent-spine-plugin/src/lib/briefing.js +317 -317
  30. package/agent-spine-plugin/src/lib/catalog.js +167 -167
  31. package/agent-spine-plugin/src/lib/channel-runtime.js +665 -665
  32. package/agent-spine-plugin/src/lib/context.js +154 -154
  33. package/agent-spine-plugin/src/lib/continuity.js +338 -338
  34. package/agent-spine-plugin/src/lib/coordination.js +577 -577
  35. package/agent-spine-plugin/src/lib/documents.js +217 -217
  36. package/agent-spine-plugin/src/lib/feed-transport.js +499 -499
  37. package/agent-spine-plugin/src/lib/filesystem-retry.js +32 -32
  38. package/agent-spine-plugin/src/lib/gateway-runtime.js +1623 -760
  39. package/agent-spine-plugin/src/lib/graph.js +337 -337
  40. package/agent-spine-plugin/src/lib/hook-audit.js +29 -29
  41. package/agent-spine-plugin/src/lib/https-transport.js +392 -392
  42. package/agent-spine-plugin/src/lib/indexed-memory-offline.js +40 -40
  43. package/agent-spine-plugin/src/lib/indexed-memory.js +281 -281
  44. package/agent-spine-plugin/src/lib/learning.js +6923 -6466
  45. package/agent-spine-plugin/src/lib/object-transport.js +206 -206
  46. package/agent-spine-plugin/src/lib/owned-file-lock.js +143 -143
  47. package/agent-spine-plugin/src/lib/paths.js +109 -109
  48. package/agent-spine-plugin/src/lib/peer-transport.js +283 -283
  49. package/agent-spine-plugin/src/lib/persona-runtime.js +581 -581
  50. package/agent-spine-plugin/src/lib/preflight.js +702 -702
  51. package/agent-spine-plugin/src/lib/runtime.js +13 -13
  52. package/agent-spine-plugin/src/lib/selfstarter.js +911 -866
  53. package/agent-spine-plugin/src/lib/sharing.js +969 -969
  54. package/agent-spine-plugin/src/lib/source-roots.js +530 -498
  55. package/agent-spine-plugin/src/lib/sqlite-transport.js +501 -501
  56. package/agent-spine-plugin/src/lib/telegram-adapter.js +119 -119
  57. package/agent-spine-plugin/src/lib/voice-runtime.js +39 -39
  58. package/agent-spine-plugin/src/mcp.js +597 -572
  59. package/agent-spine-plugin/src/version.js +1 -1
  60. package/agent-spine-plugin/src/worker.js +210 -195
  61. package/bin/active-steer-priority-policy.cjs +24 -0
  62. package/bin/launcher-runtime.js +8 -1
  63. package/bin/mnemo-tool-agent-policy.cjs +22 -0
  64. package/bin/native-runtime-cache.cjs +76 -0
  65. package/bin/thinking-activity-status-policy.cjs +132 -0
  66. package/bin/thinking-only-guard.cjs +75 -0
  67. package/bin/tool-call-loop-policy.cjs +53 -0
  68. package/bin/turn-thinking-policy.cjs +25 -1
  69. package/blun.mjs +556 -63
  70. package/package.json +4 -1
  71. package/standard-skills/translate-native/LICENSE +21 -21
  72. package/standard-skills/translate-native/references/evaluation-protocol.md +95 -95
  73. package/standard-skills/translate-native/references/native-orthography.md +79 -79
  74. package/standard-skills/translate-native/references/native-translation-standard.md +94 -94
  75. package/standard-skills/translate-native/references/structured-content.md +72 -72
  76. package/standard-skills/translate-native/references/translationese-review.md +77 -77
  77. package/standard-skills/translate-native/scripts/blun_language_guard.py +697 -697
  78. package/standard-skills/translate-native/scripts/check_diacritics.py +353 -353
  79. package/standard-skills/translate-native/scripts/guard_service_client.py +264 -264
  80. package/standard-skills/translate-native/scripts/language_gateway.py +62 -62
  81. package/standard-skills/translate-native/scripts/language_quality.py +377 -377
  82. package/standard-skills/translate-native/scripts/pre_output_guard.py +64 -64
  83. package/standard-skills/translate-native/scripts/translation_guard.py +916 -916
  84. package/standard-tools/language-guard/blun_language_guard.py +697 -697
  85. package/standard-tools/language-guard/check_diacritics.py +353 -353
  86. package/standard-tools/language-guard/guard_service_client.py +264 -264
  87. package/standard-tools/language-guard/language_quality.py +377 -377
  88. package/standard-tools/language-guard/translation_guard.py +916 -916
@@ -0,0 +1,132 @@
1
+ 'use strict';
2
+
3
+ const ACTIVITY_CHANGE_INTERVAL_MS = 3_000;
4
+
5
+ const THINKING_ACTIVITY_WORDS = Object.freeze({
6
+ Thinking: Object.freeze([
7
+ 'Thinkering', 'Reasoning', 'Pondering', 'Analyzing', 'Exploring',
8
+ 'Connecting', 'Unraveling', 'Imagining', 'Envisioning', 'Strategizing',
9
+ 'Deciphering', 'Framing', 'Ideating', 'Synthesizing', 'Reflecting',
10
+ ]),
11
+ Planning: Object.freeze([
12
+ 'Architecting', 'Blueprinting', 'Structuring', 'Orchestrating', 'Sequencing',
13
+ 'Scoping', 'Prioritizing', 'Coordinating', 'Decomposing', 'Aligning',
14
+ 'Roadmapping', 'Modeling', 'Designing', 'Drafting', 'Preparing',
15
+ ]),
16
+ Researching: Object.freeze([
17
+ 'Searching', 'Browsing', 'Discovering', 'Investigating', 'Examining',
18
+ 'Inspecting', 'Tracing', 'Comparing', 'Verifying', 'Cross-checking',
19
+ 'Fact-finding', 'Source-hunting', 'Deep-diving', 'Contextualizing', 'Evidence-gathering',
20
+ ]),
21
+ Building: Object.freeze([
22
+ 'Building', 'Crafting', 'Coding', 'Engineering', 'Assembling',
23
+ 'Integrating', 'Implementing', 'Wiring', 'Configuring', 'Compiling',
24
+ 'Rendering', 'Generating', 'Prototyping', 'Shaping', 'Forging',
25
+ ]),
26
+ Solving: Object.freeze([
27
+ 'Debugging', 'Diagnosing', 'Troubleshooting', 'Untangling', 'Repairing',
28
+ 'Patching', 'Resolving', 'Reworking', 'Refining', 'Optimizing',
29
+ 'Simplifying', 'Stabilizing', 'Recovering', 'Calibrating', 'Tuning',
30
+ ]),
31
+ Validating: Object.freeze([
32
+ 'Testing', 'Validating', 'Reviewing', 'Auditing', 'Proofreading',
33
+ 'Measuring', 'Benchmarking', 'Stress-testing', 'Safeguarding', 'Hardening',
34
+ 'Polishing', 'Fine-tuning', 'Checking', 'Confirming', 'Certifying',
35
+ ]),
36
+ Processing: Object.freeze([
37
+ 'Reading', 'Parsing', 'Indexing', 'Remembering', 'Recalling',
38
+ 'Organizing', 'Classifying', 'Filtering', 'Sorting', 'Matching',
39
+ 'Merging', 'Summarizing', 'Compressing', 'Transforming', 'Learning',
40
+ ]),
41
+ Collaborating: Object.freeze([
42
+ 'Delegating', 'Collaborating', 'Consulting', 'Briefing', 'Dispatching',
43
+ 'Synchronizing', 'Negotiating', 'Handshaking', 'Queuing', 'Routing',
44
+ 'Supervising', 'Monitoring', 'Reconciling', 'Reporting', 'Converging',
45
+ ]),
46
+ Creating: Object.freeze([
47
+ 'Writing', 'Rewriting', 'Translating', 'Localizing', 'Narrating',
48
+ 'Explaining', 'Illustrating', 'Visualizing', 'Formatting', 'Styling',
49
+ 'Presenting', 'Documenting', 'Captioning', 'Storyboarding', 'Publishing',
50
+ ]),
51
+ 'BLUN Magic': Object.freeze([
52
+ 'BLUNing', 'Sparkering', 'Wondermaking', 'Dreamweaving', 'Futurecrafting',
53
+ 'Brightening', 'Flowing', 'Accelerating', 'Automating', 'Empowering',
54
+ 'Launching', 'Scaling', 'Evolving', 'Delivering', 'Finishing',
55
+ ]),
56
+ });
57
+
58
+ const EVIDENCE_KEYS = new Set([
59
+ 'command', 'cmd', 'description', 'file', 'file_path', 'path', 'pattern',
60
+ 'prompt', 'query', 'task', 'title', 'url',
61
+ ]);
62
+
63
+ function activityEvidence(toolCall) {
64
+ if (!toolCall || typeof toolCall !== 'object') return '';
65
+ const values = [toolCall.name];
66
+ const args = toolCall.args;
67
+ if (args && typeof args === 'object' && !Array.isArray(args)) {
68
+ for (const [key, value] of Object.entries(args)) {
69
+ if (!EVIDENCE_KEYS.has(key.toLowerCase())) continue;
70
+ if (typeof value === 'string') values.push(value.slice(0, 2_000));
71
+ }
72
+ } else if (typeof toolCall.argumentsText === 'string') {
73
+ values.push(toolCall.argumentsText.slice(0, 2_000));
74
+ }
75
+ return values.filter(Boolean).join(' ').toLowerCase();
76
+ }
77
+
78
+ function matchesAny(text, patterns) {
79
+ return patterns.some((pattern) => text.includes(pattern));
80
+ }
81
+
82
+ function inferThinkingActivityGroup(toolCall, options = {}) {
83
+ if (options.completing === true) return 'BLUN Magic';
84
+ if (options.retrying === true || options.failed === true) return 'Solving';
85
+
86
+ const name = typeof toolCall?.name === 'string' ? toolCall.name.toLowerCase() : '';
87
+ const evidence = activityEvidence(toolCall);
88
+ if (!name) return 'Thinking';
89
+ if (name === 'todolist' || matchesAny(evidence, [' plan', 'roadmap', 'architect', 'scope'])) return 'Planning';
90
+ if (matchesAny(name, ['agent', 'swarm', 'telegram']) || matchesAny(evidence, ['delegate', 'handoff', 'telegram', 'report to'])) return 'Collaborating';
91
+ if (matchesAny(name, ['mnemo', 'memory', 'compact']) || matchesAny(evidence, ['memory', 'mnemo', 'compact', 'summar', 'index'])) return 'Processing';
92
+ if (matchesAny(name, ['grep', 'glob', 'search', 'webfetch', 'web_fetch', 'websearch', 'web_search', 'ls']) || matchesAny(evidence, ['search', 'find ', 'inspect', 'trace'])) return 'Researching';
93
+ if (matchesAny(evidence, ['publish', 'release', 'deploy', 'launch', 'deliver', 'finish'])) return 'BLUN Magic';
94
+ if (matchesAny(evidence, ['error', 'fail', 'debug', 'diagnos', 'repair', 'patch', 'fix ', 'recover', 'troubleshoot'])) return 'Solving';
95
+ if (matchesAny(evidence, ['test', 'check', 'verify', 'validat', 'audit', 'benchmark', 'measure', 'compare', 'sha256', 'diff '])) return 'Validating';
96
+ if (name === 'read' || name === 'readbatch') return 'Processing';
97
+ if (name === 'write' || name === 'edit') {
98
+ if (matchesAny(evidence, ['.md', '.txt', 'readme', 'changelog', 'document', 'translat', 'localiz'])) return 'Creating';
99
+ return 'Building';
100
+ }
101
+ if (matchesAny(name, ['bash', 'shell', 'programmatictool']) || matchesAny(evidence, ['build', 'compile', 'npm ', 'node ', 'code'])) return 'Building';
102
+ return 'Processing';
103
+ }
104
+
105
+ class ThinkingActivityRotator {
106
+ constructor(changeIntervalMs = ACTIVITY_CHANGE_INTERVAL_MS) {
107
+ this.changeIntervalMs = Math.max(ACTIVITY_CHANGE_INTERVAL_MS, Number(changeIntervalMs) || 0);
108
+ this.currentWord = undefined;
109
+ this.changedAtMs = undefined;
110
+ this.nextIndexByGroup = new Map();
111
+ }
112
+
113
+ resolve(group, nowMs = Date.now()) {
114
+ const safeGroup = Object.hasOwn(THINKING_ACTIVITY_WORDS, group) ? group : 'Thinking';
115
+ const now = Number.isFinite(nowMs) ? nowMs : Date.now();
116
+ if (this.currentWord !== undefined && now - this.changedAtMs < this.changeIntervalMs) return this.currentWord;
117
+
118
+ const words = THINKING_ACTIVITY_WORDS[safeGroup];
119
+ const index = this.nextIndexByGroup.get(safeGroup) ?? 0;
120
+ this.currentWord = words[index % words.length];
121
+ this.nextIndexByGroup.set(safeGroup, (index + 1) % words.length);
122
+ this.changedAtMs = now;
123
+ return this.currentWord;
124
+ }
125
+ }
126
+
127
+ module.exports = {
128
+ ACTIVITY_CHANGE_INTERVAL_MS,
129
+ THINKING_ACTIVITY_WORDS,
130
+ ThinkingActivityRotator,
131
+ inferThinkingActivityGroup,
132
+ };
@@ -0,0 +1,75 @@
1
+ 'use strict';
2
+
3
+ const DEFAULT_THINKING_ONLY_LIMIT_MS = 10 * 60 * 1000;
4
+ const FORCE_ANSWER_PROMPT = [
5
+ 'Stop hidden thinking now and answer with the concrete finding, blocker, or next action.',
6
+ 'Do not call tools and do not ask for another task.',
7
+ ].join(' ');
8
+
9
+ function createThinkingOnlyGuard(options = {}) {
10
+ const maxMs = options.maxMs ?? DEFAULT_THINKING_ONLY_LIMIT_MS;
11
+ const now = options.now ?? Date.now;
12
+ const setTimer = options.setTimer ?? setTimeout;
13
+ const clearTimer = options.clearTimer ?? clearTimeout;
14
+ const onTimeout = options.onTimeout ?? (() => {});
15
+ let timer;
16
+ let startedAt;
17
+ let substantiveOutput = false;
18
+
19
+ function disarm() {
20
+ if (timer !== undefined) clearTimer(timer);
21
+ timer = undefined;
22
+ startedAt = undefined;
23
+ }
24
+
25
+ function beginAttempt() {
26
+ disarm();
27
+ substantiveOutput = false;
28
+ }
29
+
30
+ function noteThinking() {
31
+ if (substantiveOutput || timer !== undefined) return;
32
+ startedAt = now();
33
+ timer = setTimer(() => {
34
+ timer = undefined;
35
+ const elapsedMs = Math.max(0, now() - startedAt);
36
+ startedAt = undefined;
37
+ onTimeout({ reason: 'thinking_only_timeout', elapsedMs });
38
+ }, maxMs);
39
+ timer?.unref?.();
40
+ }
41
+
42
+ function noteSubstantiveOutput() {
43
+ substantiveOutput = true;
44
+ disarm();
45
+ }
46
+
47
+ return {
48
+ beginAttempt,
49
+ noteThinking,
50
+ noteSubstantiveOutput,
51
+ stop: disarm,
52
+ };
53
+ }
54
+
55
+ function forceAnswerParams(params) {
56
+ return {
57
+ ...params,
58
+ tools: [],
59
+ messages: [
60
+ ...params.messages,
61
+ {
62
+ role: 'user',
63
+ content: [{ type: 'text', text: FORCE_ANSWER_PROMPT }],
64
+ toolCalls: [],
65
+ },
66
+ ],
67
+ };
68
+ }
69
+
70
+ module.exports = {
71
+ DEFAULT_THINKING_ONLY_LIMIT_MS,
72
+ FORCE_ANSWER_PROMPT,
73
+ createThinkingOnlyGuard,
74
+ forceAnswerParams,
75
+ };
@@ -0,0 +1,53 @@
1
+ 'use strict';
2
+
3
+ const { createHash } = require('node:crypto');
4
+
5
+ const FORCE_ANSWER_RESULT_STREAK = 3;
6
+ const NUMBER_VALUE = '<number>';
7
+ const NUMBER_TEXT = /[-+]?(?:\d+(?:\.\d+)?|\.\d+)(?:e[-+]?\d+)?/giu;
8
+
9
+ function normalizeLoopText(value) {
10
+ return String(value).toLowerCase().replace(NUMBER_TEXT, NUMBER_VALUE);
11
+ }
12
+
13
+ function normalizeLoopValue(value) {
14
+ if (typeof value === 'number' || typeof value === 'bigint') return NUMBER_VALUE;
15
+ if (typeof value === 'string') return normalizeLoopText(value);
16
+ if (Array.isArray(value)) return value.map(normalizeLoopValue);
17
+ if (value === null || typeof value !== 'object') return value;
18
+
19
+ const normalized = {};
20
+ for (const key of Object.keys(value).sort((left, right) => left.localeCompare(right))) {
21
+ normalized[key.toLowerCase()] = normalizeLoopValue(value[key]);
22
+ }
23
+ return normalized;
24
+ }
25
+
26
+ function createToolCallLoopKey(toolName, args) {
27
+ return `${normalizeLoopText(toolName)} ${JSON.stringify(normalizeLoopValue(args))}`;
28
+ }
29
+
30
+ function hashToolResult(result) {
31
+ const normalized = normalizeResultValue({
32
+ isError: result?.isError === true,
33
+ output: result?.output,
34
+ });
35
+ return createHash('sha256').update(JSON.stringify(normalized)).digest('hex');
36
+ }
37
+
38
+ function normalizeResultValue(value) {
39
+ if (Array.isArray(value)) return value.map(normalizeResultValue);
40
+ if (value === null || typeof value !== 'object') return value;
41
+ const normalized = {};
42
+ for (const key of Object.keys(value).sort((left, right) => left.localeCompare(right))) {
43
+ normalized[key] = normalizeResultValue(value[key]);
44
+ }
45
+ return normalized;
46
+ }
47
+
48
+ module.exports = {
49
+ FORCE_ANSWER_RESULT_STREAK,
50
+ createToolCallLoopKey,
51
+ hashToolResult,
52
+ normalizeLoopValue,
53
+ };
@@ -7,8 +7,27 @@ const BOSNIAN_STANDALONE_CHAT = /^(?:zdravo|pozdrav|hvala|ćao|cao)[.!?]*$/iu;
7
7
  const IDENTITY_CHAT = /^(?:wer bist du|who are you|wie geht(?: es dir)?|how are you|na|kako si|kako je king|ko si ti|ko stoji iza tebe)[.!?]*$/iu;
8
8
  const STATUS_ONLY_CHECK_IN = /(?:\bstandabfrage\b|\bstatusabfrage\b|\bkurzes?\s+update\b|\bwo\s+stehst\s+du\b|\bwie\s+weit\s+bist\s+du\b|\bwhere\s+are\s+you\b|\bquick\s+status\b)/iu;
9
9
  const STATUS_FOLLOW_UP_ACTION = /\b(?:aendere|arbeite|baue|build|change|delete|deploy|deploye|fahr|fix|fixe|implement|implementiere|install|installiere|loesche|mach|patch|pruefe|repariere|run|schreibe|setze|start|starte|stop|stoppe|test|teste|write)\b/iu;
10
+ const THINKING_EFFORT_RANK = Object.freeze({
11
+ none: 0,
12
+ off: 0,
13
+ low: 1,
14
+ medium: 2,
15
+ high: 3,
16
+ xhigh: 4,
17
+ max: 5,
18
+ });
10
19
 
11
- function selectThinkingEffortForTurn(text, originKind) {
20
+ function keepOnlyEffortIncrease(selectedEffort, profileEffort) {
21
+ if (selectedEffort === undefined || profileEffort === undefined || profileEffort === null) {
22
+ return selectedEffort;
23
+ }
24
+ const selectedRank = THINKING_EFFORT_RANK[selectedEffort];
25
+ const profileRank = THINKING_EFFORT_RANK[profileEffort];
26
+ if (selectedRank === undefined || profileRank === undefined || selectedRank <= profileRank) return undefined;
27
+ return selectedEffort;
28
+ }
29
+
30
+ function classifyThinkingEffortForTurn(text, originKind) {
12
31
  if (originKind !== "user") return undefined;
13
32
 
14
33
  const normalized = String(text ?? "").replace(/\s+/gu, " ").trim();
@@ -30,6 +49,10 @@ function selectThinkingEffortForTurn(text, originKind) {
30
49
  return shortQuestion ? "low" : undefined;
31
50
  }
32
51
 
52
+ function selectThinkingEffortForTurn(text, originKind, profileEffort) {
53
+ return keepOnlyEffortIncrease(classifyThinkingEffortForTurn(text, originKind), profileEffort);
54
+ }
55
+
33
56
  function shouldEnableThinkingForTurn(text, originKind) {
34
57
  return selectThinkingEffortForTurn(text, originKind) !== "off";
35
58
  }
@@ -59,6 +82,7 @@ module.exports = {
59
82
  ACTIONABLE_PROMPT,
60
83
  EXPLICIT_THINKING_INTENT,
61
84
  capCompletionBudgetForAdaptiveEffort,
85
+ keepOnlyEffortIncrease,
62
86
  selectThinkingEffortForBufferedSteer,
63
87
  selectThinkingEffortForWorkStep,
64
88
  selectThinkingEffortForTurn,