blun-king-cli 9.1.643 → 9.1.644
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.
- package/LIESMICH.txt +18 -0
- package/README.md +20 -6
- package/bin/blun.js +3 -3
- package/bin/king.js +3 -3
- package/bin/launcher-mode.js +125 -126
- package/bin/launcher-runtime.js +603 -616
- package/bin/plugin-bootstrap.js +339 -405
- package/bin/rename-private-staging.cjs +2 -2
- package/bin/retired-bundled-plugins.cjs +84 -0
- package/bin/startup-security-host.cjs +105 -0
- package/bin/startup-security.cjs +9 -105
- package/bin/startup-warning-policy.cjs +22 -0
- package/bin/update-lease-installer.cjs +125 -0
- package/bin/update-lease-sockets.cjs +228 -0
- package/bin/update-lease.js +22 -327
- package/bin/verify-bundled-agent-sources.cjs +2 -4
- package/blun.mjs +18 -179
- package/bundled-agent-sources.json +1 -552
- package/package.json +1 -5
- package/tool-liveness642/receipt.json +1 -1
- package/worker-host.mjs +3 -119
- package/agent-spine-plugin/.claude-plugin/marketplace.json +0 -20
- package/agent-spine-plugin/.claude-plugin/plugin.json +0 -14
- package/agent-spine-plugin/.codex-plugin/plugin.json +0 -47
- package/agent-spine-plugin/.mcp.json +0 -8
- package/agent-spine-plugin/CHANGELOG.md +0 -1614
- package/agent-spine-plugin/LICENSE +0 -186
- package/agent-spine-plugin/README.md +0 -432
- package/agent-spine-plugin/assets/agentspine-banner.svg +0 -32
- package/agent-spine-plugin/bin/agentspine-mcp.js +0 -4
- package/agent-spine-plugin/bin/agentspine.js +0 -7
- package/agent-spine-plugin/blun.plugin.json +0 -68
- package/agent-spine-plugin/docs/acceptance.md +0 -61
- package/agent-spine-plugin/docs/artifact-evaluation.md +0 -93
- package/agent-spine-plugin/docs/host-integration.md +0 -193
- package/agent-spine-plugin/docs/preflight-recall.md +0 -71
- package/agent-spine-plugin/docs/preservation-contract.md +0 -53
- package/agent-spine-plugin/docs/quality-gates.md +0 -50
- package/agent-spine-plugin/docs/session-timeline.md +0 -112
- package/agent-spine-plugin/docs/source-roots.md +0 -113
- package/agent-spine-plugin/docs/world-model.md +0 -119
- package/agent-spine-plugin/hooks/codex.json +0 -47
- package/agent-spine-plugin/hooks/hooks.json +0 -106
- package/agent-spine-plugin/hooks/version.json +0 -5
- package/agent-spine-plugin/package.json +0 -77
- package/agent-spine-plugin/scripts/check-codex-install.js +0 -226
- package/agent-spine-plugin/scripts/check-hosts.js +0 -208
- package/agent-spine-plugin/scripts/check-install-hook.js +0 -227
- package/agent-spine-plugin/scripts/check-install-selfstarter.js +0 -154
- package/agent-spine-plugin/scripts/check-install.js +0 -478
- package/agent-spine-plugin/scripts/check-line-budget.js +0 -58
- package/agent-spine-plugin/scripts/check-syntax.js +0 -29
- package/agent-spine-plugin/scripts/github-actions.js +0 -11
- package/agent-spine-plugin/scripts/hermetic-process.js +0 -191
- package/agent-spine-plugin/scripts/release-check.js +0 -150
- package/agent-spine-plugin/scripts/run-acceptance.js +0 -19
- package/agent-spine-plugin/scripts/run-checks.js +0 -50
- package/agent-spine-plugin/scripts/run-tests-hermetic.js +0 -112
- package/agent-spine-plugin/skills/agent-spine/SKILL.md +0 -99
- package/agent-spine-plugin/spine-example/1-identity.md +0 -12
- package/agent-spine-plugin/spine-example/2-voice.md +0 -6
- package/agent-spine-plugin/spine-example/3-conduct.md +0 -8
- package/agent-spine-plugin/spine-example/4-history.md +0 -4
- package/agent-spine-plugin/src/cli-agent.js +0 -315
- package/agent-spine-plugin/src/cli-attention.js +0 -95
- package/agent-spine-plugin/src/cli-autonomy.js +0 -36
- package/agent-spine-plugin/src/cli-common.js +0 -71
- package/agent-spine-plugin/src/cli-continuity.js +0 -116
- package/agent-spine-plugin/src/cli-core.js +0 -128
- package/agent-spine-plugin/src/cli-diagnostics.js +0 -291
- package/agent-spine-plugin/src/cli-host.js +0 -21
- package/agent-spine-plugin/src/cli-learning.js +0 -320
- package/agent-spine-plugin/src/cli-premortem.js +0 -16
- package/agent-spine-plugin/src/cli-sharing.js +0 -230
- package/agent-spine-plugin/src/cli.js +0 -181
- package/agent-spine-plugin/src/codex-reader-launcher.js +0 -182
- package/agent-spine-plugin/src/hook.js +0 -500
- package/agent-spine-plugin/src/index.js +0 -108
- package/agent-spine-plugin/src/lib/acceptance.js +0 -435
- package/agent-spine-plugin/src/lib/action-lesson-recall.js +0 -118
- package/agent-spine-plugin/src/lib/attention-context.js +0 -167
- package/agent-spine-plugin/src/lib/attention-events.js +0 -113
- package/agent-spine-plugin/src/lib/attention-privacy.js +0 -72
- package/agent-spine-plugin/src/lib/attention-schema.js +0 -164
- package/agent-spine-plugin/src/lib/attention-storage.js +0 -93
- package/agent-spine-plugin/src/lib/attention.js +0 -164
- package/agent-spine-plugin/src/lib/audit-premortem.js +0 -223
- package/agent-spine-plugin/src/lib/audit.js +0 -401
- package/agent-spine-plugin/src/lib/authentication.js +0 -515
- package/agent-spine-plugin/src/lib/autonomy-policy.js +0 -110
- package/agent-spine-plugin/src/lib/autonomy-store.js +0 -202
- package/agent-spine-plugin/src/lib/autonomy.js +0 -8
- package/agent-spine-plugin/src/lib/briefing.js +0 -493
- package/agent-spine-plugin/src/lib/catalog-document-read.js +0 -51
- package/agent-spine-plugin/src/lib/catalog.js +0 -167
- package/agent-spine-plugin/src/lib/channel-continuity.js +0 -19
- package/agent-spine-plugin/src/lib/channel-runtime.js +0 -665
- package/agent-spine-plugin/src/lib/codex-installation.js +0 -231
- package/agent-spine-plugin/src/lib/codex-skill-installation.js +0 -211
- package/agent-spine-plugin/src/lib/context.js +0 -156
- package/agent-spine-plugin/src/lib/continuity.js +0 -338
- package/agent-spine-plugin/src/lib/coordination.js +0 -577
- package/agent-spine-plugin/src/lib/delivery-agent-usage.js +0 -231
- package/agent-spine-plugin/src/lib/delivery-assignment.js +0 -220
- package/agent-spine-plugin/src/lib/delivery-command-actions.js +0 -462
- package/agent-spine-plugin/src/lib/delivery-knowledge.js +0 -78
- package/agent-spine-plugin/src/lib/delivery-premortem-binding.js +0 -107
- package/agent-spine-plugin/src/lib/delivery-premortem-closure.js +0 -171
- package/agent-spine-plugin/src/lib/delivery-premortem-codec.js +0 -45
- package/agent-spine-plugin/src/lib/delivery-premortem-correction.js +0 -101
- package/agent-spine-plugin/src/lib/delivery-premortem-file.js +0 -21
- package/agent-spine-plugin/src/lib/delivery-premortem-index.js +0 -493
- package/agent-spine-plugin/src/lib/delivery-premortem-inspection.js +0 -37
- package/agent-spine-plugin/src/lib/delivery-premortem-recovery.js +0 -120
- package/agent-spine-plugin/src/lib/delivery-premortem-rejection.js +0 -65
- package/agent-spine-plugin/src/lib/delivery-premortem-results.js +0 -28
- package/agent-spine-plugin/src/lib/delivery-premortem-session-guard.js +0 -46
- package/agent-spine-plugin/src/lib/delivery-premortem-write-ledger.js +0 -285
- package/agent-spine-plugin/src/lib/delivery-premortem.js +0 -499
- package/agent-spine-plugin/src/lib/delivery-shell-heredoc.js +0 -115
- package/agent-spine-plugin/src/lib/delivery-shell-substitutions.js +0 -111
- package/agent-spine-plugin/src/lib/delivery-shell-wrapper.js +0 -64
- package/agent-spine-plugin/src/lib/delivery-target.js +0 -73
- package/agent-spine-plugin/src/lib/delivery-verification.js +0 -445
- package/agent-spine-plugin/src/lib/documents.js +0 -239
- package/agent-spine-plugin/src/lib/feed-transport.js +0 -499
- package/agent-spine-plugin/src/lib/filesystem-retry.js +0 -34
- package/agent-spine-plugin/src/lib/gateway-common.js +0 -68
- package/agent-spine-plugin/src/lib/gateway-control.js +0 -370
- package/agent-spine-plugin/src/lib/gateway-delivery.js +0 -103
- package/agent-spine-plugin/src/lib/gateway-execution.js +0 -350
- package/agent-spine-plugin/src/lib/gateway-group-response.js +0 -128
- package/agent-spine-plugin/src/lib/gateway-host-fencing.js +0 -92
- package/agent-spine-plugin/src/lib/gateway-host-lifecycle.js +0 -193
- package/agent-spine-plugin/src/lib/gateway-inspection.js +0 -85
- package/agent-spine-plugin/src/lib/gateway-knowledge.js +0 -129
- package/agent-spine-plugin/src/lib/gateway-policy-provenance.js +0 -197
- package/agent-spine-plugin/src/lib/gateway-premortem-disposition.js +0 -82
- package/agent-spine-plugin/src/lib/gateway-premortem.js +0 -363
- package/agent-spine-plugin/src/lib/gateway-prepared-host.js +0 -28
- package/agent-spine-plugin/src/lib/gateway-runs.js +0 -345
- package/agent-spine-plugin/src/lib/gateway-runtime-identity.js +0 -31
- package/agent-spine-plugin/src/lib/gateway-runtime-records.js +0 -21
- package/agent-spine-plugin/src/lib/gateway-runtime.js +0 -18
- package/agent-spine-plugin/src/lib/gateway-state-transaction.js +0 -356
- package/agent-spine-plugin/src/lib/gateway-state.js +0 -344
- package/agent-spine-plugin/src/lib/graph.js +0 -337
- package/agent-spine-plugin/src/lib/hook-artifact-guards.js +0 -356
- package/agent-spine-plugin/src/lib/hook-audit.js +0 -43
- package/agent-spine-plugin/src/lib/hook-briefing-use.js +0 -78
- package/agent-spine-plugin/src/lib/hook-context.js +0 -441
- package/agent-spine-plugin/src/lib/hook-final-message.js +0 -26
- package/agent-spine-plugin/src/lib/hook-input.js +0 -27
- package/agent-spine-plugin/src/lib/hook-output.js +0 -284
- package/agent-spine-plugin/src/lib/hook-premortem.js +0 -257
- package/agent-spine-plugin/src/lib/hook-process-advisory.js +0 -36
- package/agent-spine-plugin/src/lib/hook-protection.js +0 -95
- package/agent-spine-plugin/src/lib/hook-stop-verification.js +0 -84
- package/agent-spine-plugin/src/lib/hook-timeline.js +0 -102
- package/agent-spine-plugin/src/lib/host-instruction-budget.js +0 -11
- package/agent-spine-plugin/src/lib/https-transport.js +0 -392
- package/agent-spine-plugin/src/lib/identifier-analysis.js +0 -446
- package/agent-spine-plugin/src/lib/indexed-memory-offline.js +0 -40
- package/agent-spine-plugin/src/lib/indexed-memory.js +0 -298
- package/agent-spine-plugin/src/lib/knowledge-evidence.js +0 -431
- package/agent-spine-plugin/src/lib/learning-applications.js +0 -441
- package/agent-spine-plugin/src/lib/learning-artifact-evaluator.js +0 -114
- package/agent-spine-plugin/src/lib/learning-candidates.js +0 -274
- package/agent-spine-plugin/src/lib/learning-context.js +0 -137
- package/agent-spine-plugin/src/lib/learning-delivery-contracts.js +0 -310
- package/agent-spine-plugin/src/lib/learning-evaluation-contracts.js +0 -350
- package/agent-spine-plugin/src/lib/learning-evaluation-registration.js +0 -372
- package/agent-spine-plugin/src/lib/learning-evaluation-revocation.js +0 -292
- package/agent-spine-plugin/src/lib/learning-evidence-contracts.js +0 -321
- package/agent-spine-plugin/src/lib/learning-findings.js +0 -458
- package/agent-spine-plugin/src/lib/learning-measurement-contracts.js +0 -285
- package/agent-spine-plugin/src/lib/learning-measurements.js +0 -265
- package/agent-spine-plugin/src/lib/learning-outcome-contracts.js +0 -165
- package/agent-spine-plugin/src/lib/learning-outcomes.js +0 -343
- package/agent-spine-plugin/src/lib/learning-reconciliation.js +0 -290
- package/agent-spine-plugin/src/lib/learning-retry-contracts.js +0 -188
- package/agent-spine-plugin/src/lib/learning-schema.js +0 -229
- package/agent-spine-plugin/src/lib/learning-scope-targets.js +0 -424
- package/agent-spine-plugin/src/lib/learning-state-upgrade.js +0 -477
- package/agent-spine-plugin/src/lib/learning-status-configuration.js +0 -476
- package/agent-spine-plugin/src/lib/learning-storage.js +0 -203
- package/agent-spine-plugin/src/lib/learning-trial-recovery.js +0 -218
- package/agent-spine-plugin/src/lib/learning-validation-contracts.js +0 -375
- package/agent-spine-plugin/src/lib/learning-validation-renewal.js +0 -298
- package/agent-spine-plugin/src/lib/learning-validation-runtime.js +0 -234
- package/agent-spine-plugin/src/lib/learning.js +0 -36
- package/agent-spine-plugin/src/lib/lesson-recall-session.js +0 -172
- package/agent-spine-plugin/src/lib/mcp-autonomy-tools.js +0 -37
- package/agent-spine-plugin/src/lib/mcp-delivery-completion.js +0 -124
- package/agent-spine-plugin/src/lib/mcp-delivery-tools.js +0 -45
- package/agent-spine-plugin/src/lib/mcp-premortem.js +0 -68
- package/agent-spine-plugin/src/lib/mcp-runtime.js +0 -355
- package/agent-spine-plugin/src/lib/mcp-source-context.js +0 -61
- package/agent-spine-plugin/src/lib/mcp-timeline-tools.js +0 -240
- package/agent-spine-plugin/src/lib/mcp-world-tools.js +0 -52
- package/agent-spine-plugin/src/lib/object-transport.js +0 -206
- package/agent-spine-plugin/src/lib/owned-file-lock.js +0 -182
- package/agent-spine-plugin/src/lib/paths.js +0 -109
- package/agent-spine-plugin/src/lib/peer-transport.js +0 -283
- package/agent-spine-plugin/src/lib/persona-runtime.js +0 -581
- package/agent-spine-plugin/src/lib/pre-answer-timeline-recall.js +0 -104
- package/agent-spine-plugin/src/lib/preflight-delivery-id.js +0 -27
- package/agent-spine-plugin/src/lib/preflight.js +0 -688
- package/agent-spine-plugin/src/lib/project-portfolio.js +0 -176
- package/agent-spine-plugin/src/lib/runtime.js +0 -13
- package/agent-spine-plugin/src/lib/selfstarter-core.js +0 -382
- package/agent-spine-plugin/src/lib/selfstarter-jobs.js +0 -149
- package/agent-spine-plugin/src/lib/selfstarter-lease.js +0 -204
- package/agent-spine-plugin/src/lib/selfstarter-policy.js +0 -90
- package/agent-spine-plugin/src/lib/selfstarter-workspace.js +0 -111
- package/agent-spine-plugin/src/lib/selfstarter.js +0 -11
- package/agent-spine-plugin/src/lib/session-timeline-auth.js +0 -316
- package/agent-spine-plugin/src/lib/session-timeline-codex.js +0 -69
- package/agent-spine-plugin/src/lib/session-timeline-contract.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-source.js +0 -38
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-storage.js +0 -128
- package/agent-spine-plugin/src/lib/session-timeline-enrollment-transport.js +0 -15
- package/agent-spine-plugin/src/lib/session-timeline-enrollment.js +0 -478
- package/agent-spine-plugin/src/lib/session-timeline-event-extract.js +0 -186
- package/agent-spine-plugin/src/lib/session-timeline-host-origin.js +0 -73
- package/agent-spine-plugin/src/lib/session-timeline-host-receipt.js +0 -117
- package/agent-spine-plugin/src/lib/session-timeline-invocation.js +0 -201
- package/agent-spine-plugin/src/lib/session-timeline-king.js +0 -93
- package/agent-spine-plugin/src/lib/session-timeline-prior.js +0 -57
- package/agent-spine-plugin/src/lib/session-timeline-provider.js +0 -36
- package/agent-spine-plugin/src/lib/session-timeline-query.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-results.js +0 -56
- package/agent-spine-plugin/src/lib/session-timeline-root.js +0 -11
- package/agent-spine-plugin/src/lib/session-timeline-search.js +0 -82
- package/agent-spine-plugin/src/lib/session-timeline-sid-acl.js +0 -213
- package/agent-spine-plugin/src/lib/session-timeline-source-open.js +0 -30
- package/agent-spine-plugin/src/lib/session-timeline-source.js +0 -80
- package/agent-spine-plugin/src/lib/session-timeline-state.js +0 -45
- package/agent-spine-plugin/src/lib/session-timeline-transport.js +0 -42
- package/agent-spine-plugin/src/lib/session-timeline-windows-acl.js +0 -145
- package/agent-spine-plugin/src/lib/session-timeline.js +0 -462
- package/agent-spine-plugin/src/lib/sharing.js +0 -969
- package/agent-spine-plugin/src/lib/source-roots.js +0 -475
- package/agent-spine-plugin/src/lib/source-tree-scan.js +0 -178
- package/agent-spine-plugin/src/lib/sqlite-transport.js +0 -501
- package/agent-spine-plugin/src/lib/task-knowledge-context.js +0 -99
- package/agent-spine-plugin/src/lib/telegram-adapter.js +0 -119
- package/agent-spine-plugin/src/lib/timeline-continuation-update.js +0 -100
- package/agent-spine-plugin/src/lib/timeline-tool-guard.js +0 -225
- package/agent-spine-plugin/src/lib/timeline-user-feedback.js +0 -216
- package/agent-spine-plugin/src/lib/timeline-world-capture.js +0 -233
- package/agent-spine-plugin/src/lib/voice-runtime.js +0 -39
- package/agent-spine-plugin/src/lib/world-knowledge.js +0 -306
- package/agent-spine-plugin/src/lib/world-model.js +0 -333
- package/agent-spine-plugin/src/mcp.js +0 -456
- package/agent-spine-plugin/src/version.js +0 -1
- package/agent-spine-plugin/src/worker.js +0 -257
- package/bin/agentspine-king-goal-inbox.mjs +0 -127
- package/bin/agentspine-king-goal-intake.mjs +0 -106
- package/bin/agentspine-king-host-runner.mjs +0 -109
- package/bin/agentspine-king-snapshot-policy.cjs +0 -80
- package/bin/agentspine-king-status-policy.mjs +0 -226
- package/bin/agentspine-king-worker-host.mjs +0 -160
- package/bin/managed-plugin-selection.cjs +0 -141
- package/bin/verify-agent-behavior.cjs +0 -122
- package/bin/verify-agent-components.cjs +0 -104
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
const fs = require('node:fs');
|
|
3
|
-
const path = require('node:path');
|
|
4
|
-
const os = require('node:os');
|
|
5
|
-
const vm = require('node:vm');
|
|
6
|
-
const assert = require('node:assert/strict');
|
|
7
|
-
|
|
8
|
-
function functionSource(source, name) {
|
|
9
|
-
const found = source.match(new RegExp('^function ' + name + '\\([\\s\\S]*?^\\}', 'm'))?.[0];
|
|
10
|
-
if (!found) throw new Error('Missing executable contract: ' + name);
|
|
11
|
-
return found;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function verifyAgentBehavior(packageRoot, reportParent) {
|
|
15
|
-
const parent = reportParent || path.join(os.homedir(), '.blun', 'diagnostics', 'package-contracts');
|
|
16
|
-
fs.mkdirSync(parent, { recursive: true });
|
|
17
|
-
const work = fs.mkdtempSync(path.join(parent, 'check-'));
|
|
18
|
-
const passed = [];
|
|
19
|
-
const notApplicable = [];
|
|
20
|
-
const write = (file, data) => {
|
|
21
|
-
fs.mkdirSync(path.dirname(file), { recursive: true });
|
|
22
|
-
fs.writeFileSync(file, typeof data === 'string' ? data : JSON.stringify(data));
|
|
23
|
-
};
|
|
24
|
-
const read = file => JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
25
|
-
const core = fs.readFileSync(path.join(packageRoot, 'blun.mjs'), 'utf8');
|
|
26
|
-
const plugin = require(path.join(packageRoot, 'bin/plugin-bootstrap.js'));
|
|
27
|
-
const selected = require(path.join(packageRoot, 'bin/managed-plugin-selection.cjs'));
|
|
28
|
-
const tools = require(path.join(packageRoot, 'bin/standard-tools-bootstrap.js'));
|
|
29
|
-
const profile = path.join(work, 'profile');
|
|
30
|
-
plugin.installManagedAgentSpinePlugin({ packageRoot, blunDir: profile });
|
|
31
|
-
plugin.installManagedTelegramPlugin({ packageRoot, blunDir: profile });
|
|
32
|
-
tools.seedStandardTools({ packageRoot, blunDir: profile, names: ['blun-language-guard'], env: {} });
|
|
33
|
-
const registryFile = path.join(profile, 'plugins/installed.json');
|
|
34
|
-
const registry = read(registryFile);
|
|
35
|
-
const spine = registry.plugins.find(item => item.id === 'agent-spine');
|
|
36
|
-
const telegram = registry.plugins.find(item => item.id === 'telegram');
|
|
37
|
-
assert(spine?.enabled && telegram?.enabled, 'native startup omitted a bundled plugin');
|
|
38
|
-
assert(fs.existsSync(path.join(spine.root, 'src/hook.js')));
|
|
39
|
-
const mcpFile = path.join(profile, 'mcp.json');
|
|
40
|
-
const mcp = read(mcpFile);
|
|
41
|
-
const guard = mcp.mcpServers['blun-language-guard'];
|
|
42
|
-
assert.equal(guard.enabled, true);
|
|
43
|
-
assert.equal(guard.args[0], path.join(packageRoot, 'standard-tools/language-guard/blun_language_guard.py'));
|
|
44
|
-
passed.push('bootstrap-components-register-spine-telegram-guard');
|
|
45
|
-
|
|
46
|
-
spine.managedSelection = selected.describeAgentSpineSelection({ blunDir: profile, pluginRoot: spine.root });
|
|
47
|
-
write(registryFile, registry);
|
|
48
|
-
const before = fs.readFileSync(registryFile);
|
|
49
|
-
plugin.installManagedAgentSpinePlugin({ packageRoot, blunDir: profile });
|
|
50
|
-
assert.deepEqual(fs.readFileSync(registryFile), before);
|
|
51
|
-
guard.enabled = false; write(mcpFile, mcp);
|
|
52
|
-
tools.seedStandardTools({ packageRoot, blunDir: profile, names: ['blun-language-guard'], env: {} });
|
|
53
|
-
assert.equal(read(mcpFile).mcpServers['blun-language-guard'].enabled, false);
|
|
54
|
-
guard.args = [path.join(work, 'custom/blun_language_guard.py'), 'serve'];
|
|
55
|
-
guard.env = { SYNTHETIC_CUSTOM_SETTING: 'retained' }; write(mcpFile, mcp);
|
|
56
|
-
const custom = fs.readFileSync(mcpFile);
|
|
57
|
-
tools.seedStandardTools({ packageRoot, blunDir: profile, names: ['blun-language-guard'], env: {} });
|
|
58
|
-
assert.deepEqual(fs.readFileSync(mcpFile), custom);
|
|
59
|
-
passed.push('repeat-start-preserves-selected-plugin-disabled-and-custom-guard');
|
|
60
|
-
|
|
61
|
-
const sharedHome = path.join(work, 'old-user-home');
|
|
62
|
-
const staleRoot = path.join(sharedHome, '.blun/plugins/managed/old-telegram');
|
|
63
|
-
write(path.join(staleRoot, '.mcp.json'), { mcpServers: {} });
|
|
64
|
-
write(path.join(staleRoot, 'dist/mcp-server.mjs'), '// Synthetic old installed entrypoint.\n');
|
|
65
|
-
write(path.join(sharedHome, '.blun/plugins/installed.json'), { plugins: [{ id: 'telegram', enabled: true, root: staleRoot }] });
|
|
66
|
-
const env = { BLUN_HOME: profile };
|
|
67
|
-
const resolveRoot = vm.runInNewContext(functionSource(core, 'managedTelegramPluginRoot') + '\nmanagedTelegramPluginRoot;', {
|
|
68
|
-
process: { env }, join: path.join, homedir: () => sharedHome,
|
|
69
|
-
existsSync: fs.existsSync, readFileSync: fs.readFileSync,
|
|
70
|
-
});
|
|
71
|
-
assert.equal(resolveRoot(), telegram.root, 'bridge selected the old shared registration');
|
|
72
|
-
telegram.enabled = false; write(registryFile, registry);
|
|
73
|
-
assert.equal(resolveRoot(), undefined, 'disabled plugin was selected');
|
|
74
|
-
telegram.enabled = true; write(registryFile, registry);
|
|
75
|
-
passed.push('packed-host-selects-active-profile-not-stale-shared-copy');
|
|
76
|
-
|
|
77
|
-
const bridge = fs.readFileSync(path.join(telegram.root, 'dist/bridge.mjs'), 'utf8');
|
|
78
|
-
const access = { dmPolicy: 'allowlist', allowFrom: ['operator'], pending: {},
|
|
79
|
-
groups: { '-1001': { requireMention: true, alwaysAllowFrom: ['operator'], allowFrom: [] } } };
|
|
80
|
-
const gateHelpers = ['matchesAny', 'isMentioned', 'gate',
|
|
81
|
-
...(/^function connectionCode\(/m.test(bridge) ? ['connectionCode']
|
|
82
|
-
: ['isGermanGroupBroadcast', 'botLoopGuardAllows'])];
|
|
83
|
-
const gate = vm.runInNewContext(gateHelpers
|
|
84
|
-
.map(name => functionSource(bridge, name)).join('\n') + '\ngate;', {
|
|
85
|
-
readAccess: () => access, pruneExpired: () => false,
|
|
86
|
-
saveAccess: () => { throw new Error('unexpected access change'); },
|
|
87
|
-
BOT_COOLDOWN_MS: 15000, lastBotDelivery: new Map(),
|
|
88
|
-
});
|
|
89
|
-
const message = { chatId: '-1001', chatType: 'supergroup', text: 'Status for another participant', from: { id: 'operator' } };
|
|
90
|
-
assert.equal(gate(message, 'ExampleBot').action, 'drop');
|
|
91
|
-
assert.equal(gate({ ...message, from: { id: 'another-bot', isBot: true } }, 'ExampleBot').action, 'drop');
|
|
92
|
-
assert.equal(gate({ ...message, text: '@ExampleBot inspect', entities: [{ type: 'mention', offset: 0, length: 11 }] }, 'ExampleBot').action, 'deliver');
|
|
93
|
-
assert.equal(gate({ ...message, replyToUsername: 'ExampleBot' }, 'ExampleBot').action, 'deliver');
|
|
94
|
-
assert.equal(gate({ ...message, chatType: 'private', chatId: 'operator' }, 'ExampleBot').action, 'deliver');
|
|
95
|
-
passed.push('registered-bridge-drops-unmentioned-groups-preserves-mentions-replies-dms');
|
|
96
|
-
|
|
97
|
-
const thinkingFile = path.join(packageRoot, 'bin/thinking-only-guard.cjs');
|
|
98
|
-
if (fs.existsSync(thinkingFile)) {
|
|
99
|
-
const thinking = require(thinkingFile);
|
|
100
|
-
assert.equal(thinking.DEFAULT_THINKING_ONLY_LIMIT_MS, 120000);
|
|
101
|
-
const original = { messages: [{ role: 'user', content: 'synthetic inspection' }] };
|
|
102
|
-
assert.equal(thinking.forceAnswerParams(original).thinkingOnlyRecovery, true);
|
|
103
|
-
assert(core.includes('thinkingOnlyRecovery') && core.includes('withThinking("off")'), 'thinking recovery integration missing');
|
|
104
|
-
passed.push('bounded-thinking-recovery-retained-structural-only');
|
|
105
|
-
} else {
|
|
106
|
-
assert(fs.existsSync(path.join(packageRoot, 'bundled-agent-sources.json')), 'private thinking helper missing');
|
|
107
|
-
notApplicable.push({ check: 'private-thinking-helper', reason: 'The regular CLI does not ship this private test API; no recovery or host proof.' });
|
|
108
|
-
}
|
|
109
|
-
const routing = require(path.join(packageRoot, 'bin/turn-thinking-policy.cjs'));
|
|
110
|
-
for (const prompt of ['Which result file belongs to our task?', 'Quick status?', 'Do you remember our previous decision?']) {
|
|
111
|
-
assert.equal(routing.selectThinkingEffortForTurn(prompt, 'user', 'off'), undefined,
|
|
112
|
-
'continuity request lost its project context');
|
|
113
|
-
}
|
|
114
|
-
assert.equal(routing.selectThinkingEffortForTurn('Hi', 'user'), 'low');
|
|
115
|
-
passed.push('continuity-requests-retain-normal-context-routing');
|
|
116
|
-
const report = { verified: true, work, passed, notApplicable, launcherAutomaticRegistrationTested: false, modelApplicationTested: false,
|
|
117
|
-
hubCompletenessTested: false, realProfilesChanged: false };
|
|
118
|
-
write(path.join(work, 'report.json'), report);
|
|
119
|
-
return report;
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
module.exports = { verifyAgentBehavior, functionSource };
|
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs');
|
|
4
|
-
const path = require('node:path');
|
|
5
|
-
const { createHash } = require('node:crypto');
|
|
6
|
-
|
|
7
|
-
const RECEIPT = 'agent-components.json';
|
|
8
|
-
const SCHEMA = 'blun.bundled-agent-components/v1';
|
|
9
|
-
const REQUIRED = [
|
|
10
|
-
'blun.mjs',
|
|
11
|
-
'telegram-plugin/dist/bridge.mjs',
|
|
12
|
-
'bin/thinking-only-guard.cjs',
|
|
13
|
-
'bin/turn-thinking-policy.cjs',
|
|
14
|
-
'bin/context-performance-policy.cjs',
|
|
15
|
-
'bin/verify-agent-behavior.cjs',
|
|
16
|
-
'agent-spine-plugin/blun.plugin.json',
|
|
17
|
-
'agent-spine-plugin/src/hook.js',
|
|
18
|
-
'agent-spine-plugin/src/mcp.js',
|
|
19
|
-
'agent-spine-plugin/skills/agent-spine/SKILL.md',
|
|
20
|
-
'standard-skills/translate-native/SKILL.md',
|
|
21
|
-
'standard-tools/language-guard/blun_language_guard.py',
|
|
22
|
-
'standard-tools/language-guard/check_diacritics.py',
|
|
23
|
-
'standard-tools/language-guard/guard_service_client.py',
|
|
24
|
-
'standard-tools/language-guard/language_quality.py',
|
|
25
|
-
'standard-tools/language-guard/translation_guard.py',
|
|
26
|
-
'bin/plugin-bootstrap.js',
|
|
27
|
-
'bin/managed-plugin-selection.cjs',
|
|
28
|
-
'bin/standard-tools-bootstrap.js',
|
|
29
|
-
'bin/launcher-runtime.js',
|
|
30
|
-
];
|
|
31
|
-
const PREFIXES = ['agent-spine-plugin/', 'standard-skills/translate-native/', 'standard-tools/language-guard/'];
|
|
32
|
-
const sha256 = bytes => createHash('sha256').update(bytes).digest('hex');
|
|
33
|
-
|
|
34
|
-
function inventory(root, prefix = '', excluded = []) {
|
|
35
|
-
const result = {};
|
|
36
|
-
for (const name of fs.readdirSync(root).sort()) {
|
|
37
|
-
const file = path.join(root, name);
|
|
38
|
-
const relative = prefix + name;
|
|
39
|
-
if (excluded.some(item => relative === item || relative.startsWith(item + '/'))) continue;
|
|
40
|
-
const stat = fs.lstatSync(file);
|
|
41
|
-
if (stat.isSymbolicLink()) throw new Error('Linked component path: ' + relative);
|
|
42
|
-
if (stat.isDirectory()) Object.assign(result, inventory(file, relative + '/', excluded));
|
|
43
|
-
else if (stat.isFile()) result[relative] = sha256(fs.readFileSync(file));
|
|
44
|
-
else throw new Error('Unsupported component path: ' + relative);
|
|
45
|
-
}
|
|
46
|
-
return result;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
function safeFile(root, relative) {
|
|
50
|
-
if (typeof relative !== 'string' || relative.includes('\\') || relative.includes(':')
|
|
51
|
-
|| relative.split('/').some(part => !part || part === '.' || part === '..')) {
|
|
52
|
-
throw new Error('Invalid component path');
|
|
53
|
-
}
|
|
54
|
-
let current = path.resolve(root);
|
|
55
|
-
for (const part of relative.split('/')) {
|
|
56
|
-
current = path.join(current, part);
|
|
57
|
-
if (fs.lstatSync(current).isSymbolicLink()) throw new Error('Linked component path: ' + relative);
|
|
58
|
-
}
|
|
59
|
-
return current;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function verifyAgentComponents(packageRoot) {
|
|
63
|
-
const receipt = JSON.parse(fs.readFileSync(path.join(packageRoot, RECEIPT), 'utf8'));
|
|
64
|
-
if (receipt.schema !== SCHEMA || !receipt.files || typeof receipt.files !== 'object'
|
|
65
|
-
|| Array.isArray(receipt.files)) throw new Error('Invalid bundled component receipt');
|
|
66
|
-
for (const name of ['agentSpine', 'translateNative']) {
|
|
67
|
-
if (!/^[a-f0-9]{40}$/.test(receipt.sources?.[name]?.commit || '')) {
|
|
68
|
-
throw new Error('Missing bundled component source: ' + name);
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
for (const name of REQUIRED) {
|
|
72
|
-
if (!Object.hasOwn(receipt.files, name)) throw new Error('Missing bundled component: ' + name);
|
|
73
|
-
}
|
|
74
|
-
for (const [relative, expected] of Object.entries(receipt.files)) {
|
|
75
|
-
if (!/^[a-f0-9]{64}$/.test(expected) || sha256(fs.readFileSync(safeFile(packageRoot, relative))) !== expected) {
|
|
76
|
-
throw new Error('Bundled component digest mismatch: ' + relative);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
for (const prefix of PREFIXES) {
|
|
80
|
-
const actual = Object.keys(inventory(safeFile(packageRoot, prefix.slice(0, -1)), prefix));
|
|
81
|
-
const expected = Object.keys(receipt.files).filter(file => file.startsWith(prefix)).sort();
|
|
82
|
-
if (JSON.stringify(actual.sort()) !== JSON.stringify(expected)) throw new Error('Unexpected bundled component files: ' + prefix);
|
|
83
|
-
}
|
|
84
|
-
const manifest = JSON.parse(fs.readFileSync(path.join(packageRoot, 'package.json'), 'utf8'));
|
|
85
|
-
if (manifest.scripts?.prepack !== 'node bin/verify-agent-components.cjs') {
|
|
86
|
-
throw new Error('Bundled component prepack check missing');
|
|
87
|
-
}
|
|
88
|
-
const launcher = fs.readFileSync(path.join(packageRoot, 'bin/launcher-runtime.js'), 'utf8');
|
|
89
|
-
if (!launcher.includes("require('./verify-agent-components.cjs').verifyAgentComponents(PKG);")) {
|
|
90
|
-
throw new Error('Bundled component startup check missing');
|
|
91
|
-
}
|
|
92
|
-
return { verified: true, files: Object.keys(receipt.files).length, sources: receipt.sources };
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (require.main === module) {
|
|
96
|
-
try {
|
|
97
|
-
const root = path.resolve(__dirname, '..');
|
|
98
|
-
console.log(JSON.stringify(verifyAgentComponents(root)));
|
|
99
|
-
console.log(JSON.stringify(require('./verify-agent-behavior.cjs').verifyAgentBehavior(root)));
|
|
100
|
-
}
|
|
101
|
-
catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
module.exports = { inventory, sha256, verifyAgentComponents, SCHEMA, RECEIPT, REQUIRED, PREFIXES };
|