@polderlabs/bizar 6.3.0 → 7.0.0
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/.claude/hooks/sessionend-recall.mjs +3 -3
- package/.claude/hooks/worker-suggest.mjs +110 -0
- package/.claude/settings.json +9 -0
- package/bizar-dash/dist/assets/{EnvVarsSection-B58aiJiE.js → EnvVarsSection-CW6fWKds.js} +3 -3
- package/bizar-dash/dist/assets/{EnvVarsSection-B58aiJiE.js.map → EnvVarsSection-CW6fWKds.js.map} +1 -1
- package/bizar-dash/dist/assets/MobileChat-D7zRhU9K.js +1 -0
- package/bizar-dash/dist/assets/{MobileChat-BJrqwVDd.js.map → MobileChat-D7zRhU9K.js.map} +1 -1
- package/bizar-dash/dist/assets/MobileSettings-K-sNsn_r.js +1 -0
- package/bizar-dash/dist/assets/{MobileSettings-CEQNJNLJ.js.map → MobileSettings-K-sNsn_r.js.map} +1 -1
- package/bizar-dash/dist/assets/{Toast-Cpl6-E63.js → Toast-WTxc3m2g.js} +1 -1
- package/bizar-dash/dist/assets/{Toast-Cpl6-E63.js.map → Toast-WTxc3m2g.js.map} +1 -1
- package/bizar-dash/dist/assets/flow-BpU0-gK2.js +1 -0
- package/bizar-dash/dist/assets/flow-BpU0-gK2.js.map +1 -0
- package/bizar-dash/dist/assets/fuzzy-l0sNRNKZ.js +1 -0
- package/bizar-dash/dist/assets/fuzzy-l0sNRNKZ.js.map +1 -0
- package/bizar-dash/dist/assets/{icons-Do5N2jmX.js → icons-B0AKnYI3.js} +98 -103
- package/bizar-dash/dist/assets/icons-B0AKnYI3.js.map +1 -0
- package/bizar-dash/dist/assets/main-C-Md3DaY.css +1 -0
- package/bizar-dash/dist/assets/main-CO8fIxQK.js +18 -0
- package/bizar-dash/dist/assets/main-CO8fIxQK.js.map +1 -0
- package/bizar-dash/dist/assets/markdown-w2bDDkAH.js +1 -0
- package/bizar-dash/dist/assets/{markdown-tOLaD6nm.js.map → markdown-w2bDDkAH.js.map} +1 -1
- package/bizar-dash/dist/assets/mobile-DXYCA0hC.js +1 -0
- package/bizar-dash/dist/assets/{mobile-DYCHcUpq.js.map → mobile-DXYCA0hC.js.map} +1 -1
- package/bizar-dash/dist/assets/mobile-layout-DSmtNPja.js +2 -0
- package/bizar-dash/dist/assets/mobile-layout-DSmtNPja.js.map +1 -0
- package/bizar-dash/dist/assets/react-vendor-BnuhLJ6X.css +1 -0
- package/bizar-dash/dist/assets/react-vendor-D3pra6w-.js +46 -0
- package/bizar-dash/dist/assets/react-vendor-D3pra6w-.js.map +1 -0
- package/bizar-dash/dist/assets/useSlashCommands-3DFLOfpk.js +2 -0
- package/bizar-dash/dist/assets/useSlashCommands-3DFLOfpk.js.map +1 -0
- package/bizar-dash/dist/assets/vendor-Di7Cp-rw.js +45 -0
- package/bizar-dash/dist/assets/vendor-Di7Cp-rw.js.map +1 -0
- package/bizar-dash/dist/index.html +12 -10
- package/bizar-dash/dist/mobile.html +7 -4
- package/bizar-dash/node_modules/.vite/vitest/da39a3ee5e6b4b0d3255bfef95601890afd80709/results.json +1 -1
- package/bizar-dash/src/server/api.mjs +11 -0
- package/bizar-dash/src/server/memory-consolidator.mjs +218 -0
- package/bizar-dash/src/server/memory-distillation.mjs +296 -0
- package/bizar-dash/src/server/routes/distill.mjs +129 -0
- package/bizar-dash/src/server/routes/goal-planner.mjs +236 -0
- package/bizar-dash/src/web/App.tsx +4 -0
- package/bizar-dash/src/web/components/Tag.tsx +18 -5
- package/bizar-dash/src/web/components/Topbar.tsx +3 -0
- package/bizar-dash/src/web/components/agents/CommunicationLog.tsx +126 -0
- package/bizar-dash/src/web/components/agents/DependencyGraph.tsx +163 -0
- package/bizar-dash/src/web/components/agents/QualityGates.tsx +123 -0
- package/bizar-dash/src/web/components/agents/RealTimeEventLog.tsx +127 -0
- package/bizar-dash/src/web/components/agents/RoutingDecisions.test.tsx +148 -0
- package/bizar-dash/src/web/components/agents/RoutingDecisions.tsx +160 -0
- package/bizar-dash/src/web/components/goals/GoalInput.tsx +86 -0
- package/bizar-dash/src/web/components/goals/PlanVisualization.tsx +111 -0
- package/bizar-dash/src/web/lib/goapPlanner.ts +614 -0
- package/bizar-dash/src/web/lib/types.ts +25 -0
- package/bizar-dash/src/web/styles/agents-redesign.css +311 -0
- package/bizar-dash/src/web/styles/main.css +251 -0
- package/bizar-dash/src/web/styles/tasks-redesign.css +231 -0
- package/bizar-dash/src/web/ui/controls/Button.tsx +77 -0
- package/bizar-dash/src/web/ui/controls/Checkbox.tsx +95 -0
- package/bizar-dash/src/web/ui/controls/IconButton.tsx +66 -0
- package/bizar-dash/src/web/ui/controls/Kbd.tsx +24 -0
- package/bizar-dash/src/web/ui/controls/NumberInput.tsx +77 -0
- package/bizar-dash/src/web/ui/controls/RadioGroup.tsx +109 -0
- package/bizar-dash/src/web/ui/controls/SearchInput.tsx +91 -0
- package/bizar-dash/src/web/ui/controls/Select.tsx +92 -0
- package/bizar-dash/src/web/ui/controls/Slider.tsx +70 -0
- package/bizar-dash/src/web/ui/controls/TextInput.tsx +67 -0
- package/bizar-dash/src/web/ui/controls/Toggle.tsx +79 -0
- package/bizar-dash/src/web/ui/controls/controls.css +454 -0
- package/bizar-dash/src/web/ui/controls/index.ts +33 -0
- package/bizar-dash/src/web/ui/data/BarChart.tsx +60 -0
- package/bizar-dash/src/web/ui/data/DataTable.tsx +216 -0
- package/bizar-dash/src/web/ui/data/EmptyState.tsx +60 -0
- package/bizar-dash/src/web/ui/data/ErrorState.tsx +56 -0
- package/bizar-dash/src/web/ui/data/KeyValueList.tsx +106 -0
- package/bizar-dash/src/web/ui/data/LoadingState.tsx +65 -0
- package/bizar-dash/src/web/ui/data/Sparkline.tsx +87 -0
- package/bizar-dash/src/web/ui/data/StatTile.tsx +87 -0
- package/bizar-dash/src/web/ui/data/data.css +535 -0
- package/bizar-dash/src/web/ui/data/index.ts +31 -0
- package/bizar-dash/src/web/ui/feedback/Badge.tsx +49 -0
- package/bizar-dash/src/web/ui/feedback/Dialog.tsx +209 -0
- package/bizar-dash/src/web/ui/feedback/ProgressBar.tsx +69 -0
- package/bizar-dash/src/web/ui/feedback/StatusDot.tsx +50 -0
- package/bizar-dash/src/web/ui/feedback/Toast.tsx +200 -0
- package/bizar-dash/src/web/ui/feedback/Tooltip.tsx +126 -0
- package/bizar-dash/src/web/ui/feedback/feedback.css +314 -0
- package/bizar-dash/src/web/ui/feedback/index.ts +43 -0
- package/bizar-dash/src/web/ui/index.ts +56 -0
- package/bizar-dash/src/web/ui/layout/AppShell.tsx +51 -0
- package/bizar-dash/src/web/ui/layout/Breadcrumbs.tsx +97 -0
- package/bizar-dash/src/web/ui/layout/Panel.tsx +73 -0
- package/bizar-dash/src/web/ui/layout/PanelHeader.tsx +39 -0
- package/bizar-dash/src/web/ui/layout/Sidebar.tsx +131 -0
- package/bizar-dash/src/web/ui/layout/Tabs.tsx +133 -0
- package/bizar-dash/src/web/ui/layout/Topbar.tsx +42 -0
- package/bizar-dash/src/web/ui/layout/index.ts +33 -0
- package/bizar-dash/src/web/ui/layout/layout.css +413 -0
- package/bizar-dash/src/web/ui/navigation/CommandPalette.tsx +199 -0
- package/bizar-dash/src/web/ui/navigation/NavGroup.tsx +95 -0
- package/bizar-dash/src/web/ui/navigation/NavLink.tsx +93 -0
- package/bizar-dash/src/web/ui/navigation/index.ts +17 -0
- package/bizar-dash/src/web/ui/navigation/navigation.css +343 -0
- package/bizar-dash/src/web/ui/primitives/Box.tsx +91 -0
- package/bizar-dash/src/web/ui/primitives/Grid.tsx +49 -0
- package/bizar-dash/src/web/ui/primitives/Inline.tsx +55 -0
- package/bizar-dash/src/web/ui/primitives/Separator.tsx +46 -0
- package/bizar-dash/src/web/ui/primitives/Stack.tsx +54 -0
- package/bizar-dash/src/web/ui/primitives/VisuallyHidden.tsx +26 -0
- package/bizar-dash/src/web/ui/primitives/index.ts +23 -0
- package/bizar-dash/src/web/ui/primitives/primitives.css +183 -0
- package/bizar-dash/src/web/ui/styles/globals.css +86 -0
- package/bizar-dash/src/web/ui/styles/reset.css +125 -0
- package/bizar-dash/src/web/ui/styles/tokens.css +195 -0
- package/bizar-dash/src/web/ui/theme/ThemeProvider.tsx +142 -0
- package/bizar-dash/src/web/ui/theme/tokens.ts +131 -0
- package/bizar-dash/src/web/ui/theme/useTheme.ts +22 -0
- package/bizar-dash/src/web/ui/utils/cx.ts +42 -0
- package/bizar-dash/src/web/views/Agents.tsx +506 -266
- package/bizar-dash/src/web/views/GoalPlanner.tsx +158 -0
- package/bizar-dash/src/web/views/Overview.tsx +996 -448
- package/bizar-dash/src/web/views/Tasks.tsx +277 -273
- package/bizar-dash/tests/communication-log.test.tsx +67 -0
- package/bizar-dash/tests/dep-graph.test.tsx +40 -0
- package/bizar-dash/tests/event-log.test.tsx +61 -0
- package/bizar-dash/tests/goal-input.test.tsx +72 -0
- package/bizar-dash/tests/goap-planner.test.ts +68 -0
- package/bizar-dash/tests/quality-gates.test.tsx +59 -0
- package/bizar-dash/tests/setup.ts +31 -1
- package/bizar-dash/tests/ui/controls/Button.test.tsx +50 -0
- package/bizar-dash/tests/ui/controls/Checkbox.test.tsx +44 -0
- package/bizar-dash/tests/ui/controls/IconButton.test.tsx +37 -0
- package/bizar-dash/tests/ui/controls/Kbd.test.tsx +39 -0
- package/bizar-dash/tests/ui/controls/NumberInput.test.tsx +56 -0
- package/bizar-dash/tests/ui/controls/RadioGroup.test.tsx +58 -0
- package/bizar-dash/tests/ui/controls/SearchInput.test.tsx +52 -0
- package/bizar-dash/tests/ui/controls/Select.test.tsx +66 -0
- package/bizar-dash/tests/ui/controls/Slider.test.tsx +41 -0
- package/bizar-dash/tests/ui/controls/TextInput.test.tsx +44 -0
- package/bizar-dash/tests/ui/controls/Toggle.test.tsx +39 -0
- package/bizar-dash/tests/ui/data/BarChart.test.tsx +55 -0
- package/bizar-dash/tests/ui/data/DataTable.test.tsx +112 -0
- package/bizar-dash/tests/ui/data/EmptyState.test.tsx +57 -0
- package/bizar-dash/tests/ui/data/ErrorState.test.tsx +47 -0
- package/bizar-dash/tests/ui/data/KeyValueList.test.tsx +59 -0
- package/bizar-dash/tests/ui/data/LoadingState.test.tsx +37 -0
- package/bizar-dash/tests/ui/data/Sparkline.test.tsx +56 -0
- package/bizar-dash/tests/ui/data/StatTile.test.tsx +69 -0
- package/bizar-dash/tests/ui/feedback/Badge.test.tsx +41 -0
- package/bizar-dash/tests/ui/feedback/Dialog.test.tsx +99 -0
- package/bizar-dash/tests/ui/feedback/ProgressBar.test.tsx +66 -0
- package/bizar-dash/tests/ui/feedback/StatusDot.test.tsx +41 -0
- package/bizar-dash/tests/ui/feedback/Toast.test.tsx +124 -0
- package/bizar-dash/tests/ui/feedback/Tooltip.test.tsx +102 -0
- package/bizar-dash/tests/ui/layout/AppShell.test.tsx +50 -0
- package/bizar-dash/tests/ui/layout/Breadcrumbs.test.tsx +85 -0
- package/bizar-dash/tests/ui/layout/Panel.test.tsx +52 -0
- package/bizar-dash/tests/ui/layout/PanelHeader.test.tsx +32 -0
- package/bizar-dash/tests/ui/layout/Sidebar.test.tsx +95 -0
- package/bizar-dash/tests/ui/layout/Tabs.test.tsx +87 -0
- package/bizar-dash/tests/ui/layout/Topbar.test.tsx +41 -0
- package/bizar-dash/tests/ui/navigation/CommandPalette.test.tsx +105 -0
- package/bizar-dash/tests/ui/navigation/NavGroup.test.tsx +55 -0
- package/bizar-dash/tests/ui/navigation/NavLink.test.tsx +61 -0
- package/bizar-dash/tests/ui/primitives/Box.test.tsx +49 -0
- package/bizar-dash/tests/ui/primitives/Grid.test.tsx +37 -0
- package/bizar-dash/tests/ui/primitives/Inline.test.tsx +33 -0
- package/bizar-dash/tests/ui/primitives/Separator.test.tsx +34 -0
- package/bizar-dash/tests/ui/primitives/Stack.test.tsx +45 -0
- package/bizar-dash/tests/ui/primitives/VisuallyHidden.test.tsx +27 -0
- package/bizar-dash/tests/views/Agents.test.tsx +359 -0
- package/bizar-dash/tests/views/Overview.test.tsx +413 -0
- package/bizar-dash/tests/views/Tasks.test.tsx +250 -0
- package/bizar-dash/vitest.config.ts +3 -1
- package/cli/__tests__/cost-gate.test.mjs +301 -0
- package/cli/__tests__/feature-list-bridge.test.mjs +371 -0
- package/cli/bin.mjs +38 -0
- package/cli/commands/claim.mjs +282 -0
- package/cli/commands/cost.mjs +279 -0
- package/cli/cost-gate.mjs +501 -0
- package/cli/feature-list-bridge.mjs +400 -0
- package/cli/memory-constants.mjs +17 -0
- package/cli/worker-dispatcher.mjs +259 -0
- package/cli/worker-dispatcher.test.mjs +204 -0
- package/config/trigger-patterns.json +186 -0
- package/package.json +2 -2
- package/packages/sdk/package.json +1 -1
- package/packages/sdk/src/agent-registry.ts +304 -0
- package/packages/sdk/src/consensus/byzantine.ts +587 -0
- package/packages/sdk/src/consensus/index.ts +147 -0
- package/packages/sdk/src/consensus/queen.ts +173 -0
- package/packages/sdk/src/consensus/types.ts +199 -0
- package/packages/sdk/src/federation/audit.ts +156 -0
- package/packages/sdk/src/federation/budget.ts +269 -0
- package/packages/sdk/src/federation/envelope.ts +144 -0
- package/packages/sdk/src/federation/hmac.ts +160 -0
- package/packages/sdk/src/federation/index.ts +443 -0
- package/packages/sdk/src/federation/pii.ts +241 -0
- package/packages/sdk/src/federation/policy.ts +112 -0
- package/packages/sdk/src/federation/trust.ts +146 -0
- package/packages/sdk/src/index.ts +67 -0
- package/packages/sdk/src/mcp/server.ts +351 -1
- package/packages/sdk/src/router/codemod-intent.ts +125 -0
- package/packages/sdk/src/router/index.ts +247 -0
- package/packages/sdk/src/router/memory-distillation-shim.mjs +18 -0
- package/packages/sdk/src/router/memory-distillation.ts +249 -0
- package/packages/sdk/src/router/model-router.ts +235 -0
- package/packages/sdk/src/router/q-learning-router.ts +304 -0
- package/packages/sdk/src/swarm-topology.ts +279 -0
- package/packages/sdk/tests/agent-registry.test.ts +285 -0
- package/packages/sdk/tests/consensus.test.ts +376 -0
- package/packages/sdk/tests/federation/audit.test.ts +164 -0
- package/packages/sdk/tests/federation/budget.test.ts +189 -0
- package/packages/sdk/tests/federation/envelope.test.ts +120 -0
- package/packages/sdk/tests/federation/hmac.test.ts +194 -0
- package/packages/sdk/tests/federation/orchestrator.test.ts +176 -0
- package/packages/sdk/tests/federation/pii.test.ts +106 -0
- package/packages/sdk/tests/federation/policy.test.ts +140 -0
- package/packages/sdk/tests/federation/trust.test.ts +124 -0
- package/packages/sdk/tests/mcp-tools.test.ts +204 -0
- package/packages/sdk/tests/memory-distillation.test.mjs +186 -0
- package/packages/sdk/tests/model-router.test.mjs +108 -0
- package/packages/sdk/tests/q-learning-router.test.mjs +100 -0
- package/packages/sdk/tests/router-orchestrator.test.mjs +172 -0
- package/packages/sdk/tests/router.test.mjs +91 -0
- package/packages/sdk/tests/sdk.test.mjs +26 -2
- package/packages/sdk/tests/swarm-topology.test.ts +258 -0
- package/scripts/bh-full-e2e.mjs +11 -15
- package/bizar-dash/dist/assets/MobileChat-BJrqwVDd.js +0 -1
- package/bizar-dash/dist/assets/MobileSettings-CEQNJNLJ.js +0 -1
- package/bizar-dash/dist/assets/icons-Do5N2jmX.js.map +0 -1
- package/bizar-dash/dist/assets/main-IvfQAOfy.js +0 -18
- package/bizar-dash/dist/assets/main-IvfQAOfy.js.map +0 -1
- package/bizar-dash/dist/assets/main-ietCEg_R.css +0 -1
- package/bizar-dash/dist/assets/markdown-tOLaD6nm.js +0 -1
- package/bizar-dash/dist/assets/mobile-DYCHcUpq.js +0 -1
- package/bizar-dash/dist/assets/mobile-layout-CBHjpwsb.js +0 -2
- package/bizar-dash/dist/assets/mobile-layout-CBHjpwsb.js.map +0 -1
- package/bizar-dash/dist/assets/react-vendor-Dn4wqh4Z.js +0 -40
- package/bizar-dash/dist/assets/react-vendor-Dn4wqh4Z.js.map +0 -1
- package/bizar-dash/dist/assets/useSlashCommands-Bd7_FA6U.js +0 -2
- package/bizar-dash/dist/assets/useSlashCommands-Bd7_FA6U.js.map +0 -1
- package/bizar-dash/dist/assets/vendor-C843201K.js +0 -29
- package/bizar-dash/dist/assets/vendor-C843201K.js.map +0 -1
- package/packages/sdk/package-lock.json +0 -32
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* cli/worker-dispatcher.test.mjs
|
|
3
|
+
*
|
|
4
|
+
* F-034 Background Workers — unit tests for the trigger-pattern dispatcher.
|
|
5
|
+
* Uses Node's built-in `node:test`. No external test framework.
|
|
6
|
+
*
|
|
7
|
+
* Strategy:
|
|
8
|
+
* - Use the real `config/trigger-patterns.json` (already on disk).
|
|
9
|
+
* - Call `dispatch()` and `listWorkers()` exported from
|
|
10
|
+
* `cli/worker-dispatcher.mjs`.
|
|
11
|
+
* - 5 sample prompts → expected worker ids (the canonical F-034 dry run).
|
|
12
|
+
* - Edge cases: empty prompt, case-insensitive matches, maxSuggestions
|
|
13
|
+
* clipping, no-match prompt, listWorkers completeness.
|
|
14
|
+
*/
|
|
15
|
+
import { test, describe, before, after } from 'node:test';
|
|
16
|
+
import assert from 'node:assert/strict';
|
|
17
|
+
import { mkdtempSync, writeFileSync, rmSync, existsSync } from 'node:fs';
|
|
18
|
+
import { tmpdir } from 'node:os';
|
|
19
|
+
import { join, dirname } from 'node:path';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
|
|
22
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
|
|
24
|
+
const dispatcherModule = await import('./worker-dispatcher.mjs');
|
|
25
|
+
const { dispatch, listWorkers, resetCache, loadPatterns } = dispatcherModule;
|
|
26
|
+
|
|
27
|
+
// ── Fixture: optional override path (not used by the canonical suite) ──────
|
|
28
|
+
const ORIG_BIZAR = process.env.BIZAR_TRIGGER_PATTERNS;
|
|
29
|
+
|
|
30
|
+
after(() => {
|
|
31
|
+
if (ORIG_BIZAR === undefined) delete process.env.BIZAR_TRIGGER_PATTERNS;
|
|
32
|
+
else process.env.BIZAR_TRIGGER_PATTERNS = ORIG_BIZAR;
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// ── Canonical F-034 dry-run: 5 sample prompts → expected worker ids ─────────
|
|
36
|
+
|
|
37
|
+
describe('dispatch() — canonical 5-prompt dry run', () => {
|
|
38
|
+
let tmpdir_created = false;
|
|
39
|
+
// Make sure cache is fresh for each run.
|
|
40
|
+
before(() => { resetCache(); });
|
|
41
|
+
|
|
42
|
+
test('"missing tests" → suggests testgaps', () => {
|
|
43
|
+
const out = dispatch('missing tests in the auth module');
|
|
44
|
+
const ids = out.map((s) => s.workerId);
|
|
45
|
+
assert.ok(ids.includes('testgaps'), `expected testgaps, got ${JSON.stringify(ids)}`);
|
|
46
|
+
assert.equal(out.find((s) => s.workerId === 'testgaps').matchedPattern, 'missing tests');
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
test('"deep dive into fn()" → suggests deepdive', () => {
|
|
50
|
+
const out = dispatch('deep dive into fn()');
|
|
51
|
+
const ids = out.map((s) => s.workerId);
|
|
52
|
+
assert.ok(ids.includes('deepdive'), `expected deepdive, got ${JSON.stringify(ids)}`);
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
test('"refactor this module" → suggests refactor', () => {
|
|
56
|
+
const out = dispatch('refactor this module');
|
|
57
|
+
const ids = out.map((s) => s.workerId);
|
|
58
|
+
assert.ok(ids.includes('refactor'), `expected refactor, got ${JSON.stringify(ids)}`);
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
test('"security scan the API" → suggests audit', () => {
|
|
62
|
+
const out = dispatch('security scan the API');
|
|
63
|
+
const ids = out.map((s) => s.workerId);
|
|
64
|
+
assert.ok(ids.includes('audit'), `expected audit, got ${JSON.stringify(ids)}`);
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
test('"optimize the build for size" → suggests optimize', () => {
|
|
68
|
+
const out = dispatch('optimize the build for size');
|
|
69
|
+
const ids = out.map((s) => s.workerId);
|
|
70
|
+
assert.ok(ids.includes('optimize'), `expected optimize, got ${JSON.stringify(ids)}`);
|
|
71
|
+
});
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// ── Empty / no-match paths ──────────────────────────────────────────────────
|
|
75
|
+
|
|
76
|
+
describe('dispatch() — edge cases', () => {
|
|
77
|
+
before(() => { resetCache(); });
|
|
78
|
+
|
|
79
|
+
test('empty prompt returns []', () => {
|
|
80
|
+
assert.deepEqual(dispatch(''), []);
|
|
81
|
+
assert.deepEqual(dispatch(' '), []);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test('no-match prompt returns []', () => {
|
|
85
|
+
assert.deepEqual(dispatch('hello world, no actionable words here'), []);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
test('case-insensitive match', () => {
|
|
89
|
+
const a = dispatch('Refactor this MODULE');
|
|
90
|
+
const b = dispatch('refactor this module');
|
|
91
|
+
const aIds = a.map((s) => s.workerId).sort();
|
|
92
|
+
const bIds = b.map((s) => s.workerId).sort();
|
|
93
|
+
assert.ok(aIds.includes('refactor'), 'refactor must match even in ALLCAPS');
|
|
94
|
+
assert.deepEqual(aIds, bIds);
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
test('maxSuggestions: 1 clips to a single suggestion', () => {
|
|
98
|
+
// Construct a prompt that hits MANY workers (refactor + optimize +
|
|
99
|
+
// document + audit + testgaps). With maxSuggestions=1 we get exactly 1.
|
|
100
|
+
const out = dispatch(
|
|
101
|
+
'refactor this module; optimize the build for size; write docs; security scan; missing tests',
|
|
102
|
+
{ maxSuggestions: 1 },
|
|
103
|
+
);
|
|
104
|
+
assert.equal(out.length, 1, 'should clip to maxSuggestions=1');
|
|
105
|
+
});
|
|
106
|
+
|
|
107
|
+
test('maxSuggestions: 0 returns []', () => {
|
|
108
|
+
const out = dispatch('missing tests', { maxSuggestions: 0 });
|
|
109
|
+
assert.deepEqual(out, []);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
test('default maxSuggestions clips at 3', () => {
|
|
113
|
+
// Same long prompt as above — default should clamp at 3.
|
|
114
|
+
const out = dispatch(
|
|
115
|
+
'refactor this module; optimize the build for size; write docs; security scan; missing tests',
|
|
116
|
+
);
|
|
117
|
+
assert.equal(out.length, 3, 'default maxSuggestions must be 3');
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test('output is sorted by weight desc (then workerId)', () => {
|
|
121
|
+
const out = dispatch(
|
|
122
|
+
'refactor this module; security scan; missing tests; write docs',
|
|
123
|
+
);
|
|
124
|
+
// Find weights and assert strictly non-increasing.
|
|
125
|
+
for (let i = 1; i < out.length; i++) {
|
|
126
|
+
assert.ok(
|
|
127
|
+
out[i - 1].weight >= out[i].weight,
|
|
128
|
+
`weights must be non-increasing (${out[i - 1].workerId}=${out[i - 1].weight} < ${out[i].workerId}=${out[i].weight})`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
test('every suggestion exposes skill + agent + matchedPattern', () => {
|
|
134
|
+
const out = dispatch('missing tests');
|
|
135
|
+
for (const s of out) {
|
|
136
|
+
assert.equal(typeof s.workerId, 'string');
|
|
137
|
+
assert.equal(typeof s.weight, 'number');
|
|
138
|
+
assert.ok(s.skill === null || typeof s.skill === 'string');
|
|
139
|
+
assert.ok(s.agent === null || typeof s.agent === 'string');
|
|
140
|
+
assert.equal(typeof s.matchedPattern, 'string');
|
|
141
|
+
assert.ok(s.matchedPattern.length > 0);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
// ── listWorkers / loadPatterns ───────────────────────────────────────────────
|
|
147
|
+
|
|
148
|
+
describe('listWorkers()', () => {
|
|
149
|
+
before(() => { resetCache(); });
|
|
150
|
+
|
|
151
|
+
test('returns the full worker set (all 12)', () => {
|
|
152
|
+
const ids = listWorkers();
|
|
153
|
+
const expected = [
|
|
154
|
+
'testgaps', 'audit', 'deepdive', 'refactor', 'document', 'optimize',
|
|
155
|
+
'ultralearn', 'consolidate', 'predict', 'map', 'preload', 'benchmark',
|
|
156
|
+
];
|
|
157
|
+
for (const id of expected) {
|
|
158
|
+
assert.ok(ids.includes(id), `expected worker ${id} in ${JSON.stringify(ids)}`);
|
|
159
|
+
}
|
|
160
|
+
assert.equal(ids.length, expected.length, `worker count must be exactly ${expected.length}`);
|
|
161
|
+
});
|
|
162
|
+
});
|
|
163
|
+
|
|
164
|
+
describe('loadPatterns()', () => {
|
|
165
|
+
before(() => { resetCache(); });
|
|
166
|
+
|
|
167
|
+
test('caches on second call (same instance)', () => {
|
|
168
|
+
const a = loadPatterns();
|
|
169
|
+
const b = loadPatterns();
|
|
170
|
+
assert.equal(a, b, 'second call must return cached array');
|
|
171
|
+
});
|
|
172
|
+
|
|
173
|
+
test('resetCache() forces a fresh load', () => {
|
|
174
|
+
const a = loadPatterns();
|
|
175
|
+
resetCache();
|
|
176
|
+
const b = loadPatterns();
|
|
177
|
+
assert.notEqual(a, b, 'after resetCache the new array must be a fresh object');
|
|
178
|
+
});
|
|
179
|
+
|
|
180
|
+
test('missing configPath yields empty dispatcher (no throw)', () => {
|
|
181
|
+
resetCache();
|
|
182
|
+
const tmp = mkdtempSync(join(tmpdir(), 'bizar-workers-'));
|
|
183
|
+
const phantom = join(tmp, 'does-not-exist.json');
|
|
184
|
+
const out = dispatch('missing tests', { configPath: phantom });
|
|
185
|
+
assert.deepEqual(out, []);
|
|
186
|
+
// Restore default config by clearing the override.
|
|
187
|
+
delete process.env.BIZAR_TRIGGER_PATTERNS;
|
|
188
|
+
resetCache();
|
|
189
|
+
// Sanity: the real config still works.
|
|
190
|
+
assert.ok(dispatch('missing tests').length > 0);
|
|
191
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
192
|
+
});
|
|
193
|
+
|
|
194
|
+
test('malformed JSON yields empty dispatcher (no throw)', () => {
|
|
195
|
+
resetCache();
|
|
196
|
+
const tmp = mkdtempSync(join(tmpdir(), 'bizar-workers-'));
|
|
197
|
+
const broken = join(tmp, 'broken.json');
|
|
198
|
+
writeFileSync(broken, '{not valid json');
|
|
199
|
+
const out = dispatch('missing tests', { configPath: broken });
|
|
200
|
+
assert.deepEqual(out, []);
|
|
201
|
+
resetCache();
|
|
202
|
+
rmSync(tmp, { recursive: true, force: true });
|
|
203
|
+
});
|
|
204
|
+
});
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "./trigger-patterns.v1.schema.json",
|
|
3
|
+
"version": 1,
|
|
4
|
+
"description": "Trigger-pattern table for the Bizar Background Workers dispatcher. Each worker maps zero-or-more regex patterns to a Bizar skill and/or agent. The dispatcher in cli/worker-dispatcher.mjs reads this file, matches user prompts against the regex arrays (case-insensitive), and emits 0..N suggestions ranked by weight.",
|
|
5
|
+
"workers": [
|
|
6
|
+
{
|
|
7
|
+
"id": "testgaps",
|
|
8
|
+
"regex": [
|
|
9
|
+
"missing tests",
|
|
10
|
+
"low coverage",
|
|
11
|
+
"no tests for",
|
|
12
|
+
"tests? for .+ that",
|
|
13
|
+
"test gaps?",
|
|
14
|
+
"test coverage",
|
|
15
|
+
"coverage report",
|
|
16
|
+
"add tests"
|
|
17
|
+
],
|
|
18
|
+
"weight": 0.8,
|
|
19
|
+
"skill": "harness-engineering",
|
|
20
|
+
"agent": "forseti",
|
|
21
|
+
"description": "Identify test coverage gaps and untested code paths."
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"id": "audit",
|
|
25
|
+
"regex": [
|
|
26
|
+
"security scan",
|
|
27
|
+
"security audit",
|
|
28
|
+
"vulnerab",
|
|
29
|
+
"cve",
|
|
30
|
+
"owasp",
|
|
31
|
+
"pentest"
|
|
32
|
+
],
|
|
33
|
+
"weight": 0.9,
|
|
34
|
+
"skill": "harness-engineering",
|
|
35
|
+
"agent": "forseti",
|
|
36
|
+
"description": "Security analysis and vulnerability scanning."
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"id": "deepdive",
|
|
40
|
+
"regex": [
|
|
41
|
+
"deep dive into",
|
|
42
|
+
"deep dive",
|
|
43
|
+
"explain .{20,}",
|
|
44
|
+
"how does .+ work",
|
|
45
|
+
"walk me through",
|
|
46
|
+
"in-depth analysis",
|
|
47
|
+
"comprehensive review"
|
|
48
|
+
],
|
|
49
|
+
"weight": 0.7,
|
|
50
|
+
"skill": null,
|
|
51
|
+
"agent": "mimir",
|
|
52
|
+
"description": "Deep code analysis and thorough explanation."
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
"id": "refactor",
|
|
56
|
+
"regex": [
|
|
57
|
+
"refactor",
|
|
58
|
+
"clean up .{1,30}",
|
|
59
|
+
"simplify",
|
|
60
|
+
"restructure",
|
|
61
|
+
"improve code quality",
|
|
62
|
+
"make .+ more readable"
|
|
63
|
+
],
|
|
64
|
+
"weight": 0.7,
|
|
65
|
+
"skill": null,
|
|
66
|
+
"agent": "thor",
|
|
67
|
+
"description": "Code refactoring suggestions and structural cleanup."
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
"id": "document",
|
|
71
|
+
"regex": [
|
|
72
|
+
"write docs",
|
|
73
|
+
"write readme",
|
|
74
|
+
"add jsdoc",
|
|
75
|
+
"document .{1,40}",
|
|
76
|
+
"api docs",
|
|
77
|
+
"generate docs",
|
|
78
|
+
"add documentation"
|
|
79
|
+
],
|
|
80
|
+
"weight": 0.6,
|
|
81
|
+
"skill": null,
|
|
82
|
+
"agent": "baldr",
|
|
83
|
+
"description": "Auto-documentation generation (README, JSDoc, API docs)."
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"id": "optimize",
|
|
87
|
+
"regex": [
|
|
88
|
+
"optimize .{1,40} for",
|
|
89
|
+
"performance issue",
|
|
90
|
+
"make .+ faster",
|
|
91
|
+
"speed up",
|
|
92
|
+
"reduce .{1,20}(memory|time)",
|
|
93
|
+
"improve performance"
|
|
94
|
+
],
|
|
95
|
+
"weight": 0.7,
|
|
96
|
+
"skill": null,
|
|
97
|
+
"agent": "thor",
|
|
98
|
+
"description": "Performance optimization and tuning."
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"id": "ultralearn",
|
|
102
|
+
"regex": [
|
|
103
|
+
"learn about",
|
|
104
|
+
"understand how",
|
|
105
|
+
"understand what",
|
|
106
|
+
"understand why",
|
|
107
|
+
"comprehensive guide",
|
|
108
|
+
"master .+"
|
|
109
|
+
],
|
|
110
|
+
"weight": 0.65,
|
|
111
|
+
"skill": "harness-engineering",
|
|
112
|
+
"agent": "mimir",
|
|
113
|
+
"description": "Deep knowledge acquisition and learning."
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"id": "consolidate",
|
|
117
|
+
"regex": [
|
|
118
|
+
"consolidate",
|
|
119
|
+
"merge memories",
|
|
120
|
+
"clean up memory",
|
|
121
|
+
"deduplicate",
|
|
122
|
+
"memory maintenance"
|
|
123
|
+
],
|
|
124
|
+
"weight": 0.5,
|
|
125
|
+
"skill": "harness-engineering",
|
|
126
|
+
"agent": null,
|
|
127
|
+
"description": "Memory consolidation and cleanup."
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"id": "predict",
|
|
131
|
+
"regex": [
|
|
132
|
+
"what will happen",
|
|
133
|
+
"predict",
|
|
134
|
+
"forecast",
|
|
135
|
+
"anticipate",
|
|
136
|
+
"prepare for"
|
|
137
|
+
],
|
|
138
|
+
"weight": 0.55,
|
|
139
|
+
"skill": null,
|
|
140
|
+
"agent": "mimir",
|
|
141
|
+
"description": "Predictive preloading and anticipation."
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
"id": "map",
|
|
145
|
+
"regex": [
|
|
146
|
+
"map .{0,5}codebase",
|
|
147
|
+
"architecture overview",
|
|
148
|
+
"project structure",
|
|
149
|
+
"dependency graph",
|
|
150
|
+
"code map",
|
|
151
|
+
"explore codebase"
|
|
152
|
+
],
|
|
153
|
+
"weight": 0.6,
|
|
154
|
+
"skill": "harness-engineering",
|
|
155
|
+
"agent": "mimir",
|
|
156
|
+
"description": "Codebase mapping and architecture analysis."
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
"id": "preload",
|
|
160
|
+
"regex": [
|
|
161
|
+
"preload",
|
|
162
|
+
"cache ahead",
|
|
163
|
+
"prefetch",
|
|
164
|
+
"warm .+ cache"
|
|
165
|
+
],
|
|
166
|
+
"weight": 0.4,
|
|
167
|
+
"skill": null,
|
|
168
|
+
"agent": null,
|
|
169
|
+
"description": "Resource preloading and cache warming."
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
"id": "benchmark",
|
|
173
|
+
"regex": [
|
|
174
|
+
"benchmark",
|
|
175
|
+
"performance test",
|
|
176
|
+
"measure speed",
|
|
177
|
+
"stress test",
|
|
178
|
+
"load test"
|
|
179
|
+
],
|
|
180
|
+
"weight": 0.65,
|
|
181
|
+
"skill": null,
|
|
182
|
+
"agent": "thor",
|
|
183
|
+
"description": "Performance benchmarking."
|
|
184
|
+
}
|
|
185
|
+
]
|
|
186
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@polderlabs/bizar",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "Norse-pantheon multi-agent system for Claude Code — 14 agents across 4 cost tiers with cost-aware routing, plans, and a configurable agent harness. Ships as a single npm package with the dashboard server, Claude Code MCP server, and typed SDK.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"test:sdk": "node_modules/.bin/vitest run --root packages/sdk",
|
|
24
24
|
"test:web": "cd bizar-dash && npx vitest run",
|
|
25
25
|
"test:sdk:watch": "node_modules/.bin/vitest --root packages/sdk",
|
|
26
|
-
"test": "npm run typecheck && npm run test:sdk && node --test cli/install.test.mjs cli/provision.test.mjs cli/commands/setup-provider.test.mjs cli/commands/rca.test.mjs && node --test bizar-dash/tests/path-safe.test.mjs",
|
|
26
|
+
"test": "npm run typecheck && npm run test:sdk && node --test cli/install.test.mjs cli/provision.test.mjs cli/worker-dispatcher.test.mjs cli/commands/setup-provider.test.mjs cli/commands/rca.test.mjs cli/__tests__/cost-gate.test.mjs cli/__tests__/feature-list-bridge.test.mjs && node --test bizar-dash/tests/path-safe.test.mjs",
|
|
27
27
|
"build": "npm run build:sdk && npm run build:dash",
|
|
28
28
|
"prepublishOnly": "npm run build"
|
|
29
29
|
},
|