@polderlabs/bizar 4.4.13 → 4.5.1
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/bizar-dash/CHANGELOG.md +37 -276
- package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js +2 -0
- package/bizar-dash/dist/assets/__vite-browser-external-BIHI7g3E.js.map +1 -0
- package/bizar-dash/dist/assets/main-eWZ4NlCL.css +1 -0
- package/bizar-dash/dist/assets/main-usWhlPWa.js +362 -0
- package/bizar-dash/dist/assets/main-usWhlPWa.js.map +1 -0
- package/bizar-dash/dist/assets/{mobile-DSb-t42Y.js → mobile-DQLFCjwJ.js} +2 -2
- package/bizar-dash/dist/assets/{mobile-DSb-t42Y.js.map → mobile-DQLFCjwJ.js.map} +1 -1
- package/bizar-dash/dist/assets/mobile-O6ANdD4W.js +352 -0
- package/bizar-dash/dist/assets/mobile-O6ANdD4W.js.map +1 -0
- package/bizar-dash/dist/index.html +3 -3
- package/bizar-dash/dist/mobile.html +2 -2
- package/bizar-dash/skills/agent-baseline/SKILL.md +80 -0
- package/bizar-dash/skills/bizar/SKILL.md +116 -0
- package/bizar-dash/skills/chat/SKILL.md +74 -0
- package/bizar-dash/skills/headroom/SKILL.md +94 -0
- package/bizar-dash/skills/lightrag/SKILL.md +86 -0
- package/bizar-dash/skills/minimax/SKILL.md +80 -0
- package/bizar-dash/skills/obsidian/SKILL.md +68 -0
- package/bizar-dash/skills/providers/SKILL.md +75 -0
- package/bizar-dash/skills/sdk/SKILL.md +138 -0
- package/bizar-dash/skills/self-improvement/SKILL.md +53 -0
- package/bizar-dash/skills/skills-cli/SKILL.md +94 -0
- package/bizar-dash/skills/usage/SKILL.md +62 -0
- package/bizar-dash/src/server/api.mjs +18 -0
- package/bizar-dash/src/server/headroom.mjs +645 -0
- package/bizar-dash/src/server/memory-lightrag.mjs +272 -2
- package/bizar-dash/src/server/memory-obsidian.mjs +230 -0
- package/bizar-dash/src/server/memory-store.mjs +189 -0
- package/bizar-dash/src/server/minimax-usage-store.mjs +372 -0
- package/bizar-dash/src/server/minimax.mjs +196 -5
- package/bizar-dash/src/server/providers-store.mjs +956 -0
- package/bizar-dash/src/server/routes/_shared.mjs +17 -0
- package/bizar-dash/src/server/routes/config.mjs +52 -1
- package/bizar-dash/src/server/routes/env-vars.mjs +165 -0
- package/bizar-dash/src/server/routes/headroom.mjs +126 -0
- package/bizar-dash/src/server/routes/lightrag.mjs +154 -0
- package/bizar-dash/src/server/routes/memory.mjs +668 -1
- package/bizar-dash/src/server/routes/opencode-session-detail.mjs +14 -29
- package/bizar-dash/src/server/routes/opencode-sessions.mjs +205 -3
- package/bizar-dash/src/server/routes/providers.mjs +266 -5
- package/bizar-dash/src/server/routes/skills.mjs +32 -43
- package/bizar-dash/src/server/routes/update.mjs +340 -0
- package/bizar-dash/src/server/routes/usage.mjs +136 -0
- package/bizar-dash/src/server/serve-info.mjs +135 -4
- package/bizar-dash/src/server/server.mjs +20 -0
- package/bizar-dash/src/server/skills-store.mjs +152 -262
- package/bizar-dash/src/web/App.tsx +120 -29
- package/bizar-dash/src/web/components/EnvVarManager.tsx +247 -0
- package/bizar-dash/src/web/components/HeadroomSettings.tsx +418 -0
- package/bizar-dash/src/web/components/HeadroomStatus.tsx +158 -0
- package/bizar-dash/src/web/components/SettingsSearch.tsx +213 -0
- package/bizar-dash/src/web/components/Topbar.tsx +2 -1
- package/bizar-dash/src/web/components/UsageChart.tsx +250 -0
- package/bizar-dash/src/web/components/UsageTable.tsx +90 -0
- package/bizar-dash/src/web/components/chat/ChatComposer.tsx +21 -25
- package/bizar-dash/src/web/components/chat/ChatInfoPanel.tsx +199 -37
- package/bizar-dash/src/web/components/chat/ChatThread.tsx +29 -17
- package/bizar-dash/src/web/components/chat/FloatingComposer.tsx +7 -1
- package/bizar-dash/src/web/components/chat/InfoPanel.tsx +71 -6
- package/bizar-dash/src/web/components/chat/useChat.ts +751 -257
- package/bizar-dash/src/web/lib/api.ts +43 -0
- package/bizar-dash/src/web/lib/types.ts +16 -0
- package/bizar-dash/src/web/main.tsx +2 -0
- package/bizar-dash/src/web/mobile/views/MobileChat.tsx +110 -35
- package/bizar-dash/src/web/styles/chat.css +135 -1
- package/bizar-dash/src/web/styles/main.css +46 -0
- package/bizar-dash/src/web/styles/memory.css +955 -0
- package/bizar-dash/src/web/styles/minimax-usage.css +335 -0
- package/bizar-dash/src/web/styles/settings.css +418 -0
- package/bizar-dash/src/web/styles/skills.css +302 -0
- package/bizar-dash/src/web/styles/tasks.css +288 -0
- package/bizar-dash/src/web/views/Chat.tsx +276 -48
- package/bizar-dash/src/web/views/Config.tsx +3 -2065
- package/bizar-dash/src/web/views/Memory.tsx +140 -0
- package/bizar-dash/src/web/views/MiniMaxUsage.tsx +476 -461
- package/bizar-dash/src/web/views/Overview.tsx +3 -0
- package/bizar-dash/src/web/views/Settings.tsx +36 -0
- package/bizar-dash/src/web/views/Skills.tsx +208 -260
- package/bizar-dash/src/web/views/Tasks.tsx +348 -1119
- package/bizar-dash/src/web/views/memory/ConfigPanel.tsx +289 -0
- package/bizar-dash/src/web/views/memory/GitSyncPanel.tsx +220 -0
- package/bizar-dash/src/web/views/memory/LightragPanel.tsx +307 -0
- package/bizar-dash/src/web/views/memory/MemoryOverview.tsx +354 -0
- package/bizar-dash/src/web/views/memory/MemoryStatusCard.tsx +160 -0
- package/bizar-dash/src/web/views/memory/ObsidianPanel.tsx +642 -0
- package/bizar-dash/src/web/views/memory/SemanticSearchPanel.tsx +194 -0
- package/bizar-dash/tests/chat-session-create.test.mjs +391 -0
- package/bizar-dash/tests/chat-session-stream.test.mjs +308 -0
- package/bizar-dash/tests/env-vars-store.test.mjs +216 -0
- package/bizar-dash/tests/headroom-install.test.mjs +173 -0
- package/bizar-dash/tests/headroom-settings.test.mjs +126 -0
- package/bizar-dash/tests/headroom-status.test.mjs +117 -0
- package/bizar-dash/tests/lightrag-defaults.node.test.mjs +118 -0
- package/bizar-dash/tests/memory-lightrag-extended.test.mjs +162 -0
- package/bizar-dash/tests/memory-obsidian.test.mjs +269 -0
- package/bizar-dash/tests/memory-tab.test.mjs +322 -0
- package/bizar-dash/tests/minimax-chat-usage.test.mjs +178 -0
- package/bizar-dash/tests/minimax-usage-store.node.test.mjs +293 -0
- package/bizar-dash/tests/mod-upgrade.node.test.mjs +1 -1
- package/bizar-dash/tests/opencode-sessions-detail.test.mjs +12 -9
- package/bizar-dash/tests/providers-store-backup-keys.node.test.mjs +479 -3
- package/bizar-dash/tests/providers-store-search.node.test.mjs +166 -0
- package/bizar-dash/tests/skills-list.test.mjs +232 -0
- package/bizar-dash/tests/skills-search.test.mjs +222 -0
- package/bizar-dash/tests/submit-feedback.test.mjs +6 -6
- package/bizar-dash/tests/tasks-create.test.mjs +187 -0
- package/bizar-dash/tests/update-check.test.mjs +127 -0
- package/bizar-dash/tests/update-run.test.mjs +266 -0
- package/cli/bin.mjs +247 -1
- package/cli/provision.mjs +118 -4
- package/config/agents/_shared/SKILLS.md +109 -0
- package/package.json +1 -1
- package/bizar-dash/dist/assets/main-BB5mJurD.js +0 -352
- package/bizar-dash/dist/assets/main-BB5mJurD.js.map +0 -1
- package/bizar-dash/dist/assets/main-BsnQLXdh.css +0 -1
- package/bizar-dash/dist/assets/mobile-Dl1q7Cyq.js +0 -354
- package/bizar-dash/dist/assets/mobile-Dl1q7Cyq.js.map +0 -1
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: providers
|
|
3
|
+
description: How the provider subsystem works in BizarHarness - catalog management, backup keys, auto-add wizard, and provider store.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Provider Subsystem
|
|
7
|
+
|
|
8
|
+
The provider subsystem manages LLM API credentials and model routing. It is composed of the providers store, the config router, and the providers UI.
|
|
9
|
+
|
|
10
|
+
## Core Concepts
|
|
11
|
+
|
|
12
|
+
- **Provider:** A named API source (e.g., `minimax`, `openai`, `anthropic`).
|
|
13
|
+
- **Catalog:** The list of all known/available providers.
|
|
14
|
+
- **Active provider:** The currently selected provider for a given model tier.
|
|
15
|
+
- **Backup keys:** Additional API keys for a provider, used in rotation on 429/402/5xx.
|
|
16
|
+
|
|
17
|
+
## Provider Store
|
|
18
|
+
|
|
19
|
+
`bizar-dash/src/server/providers-store.mjs` manages:
|
|
20
|
+
- Provider credentials (API keys stored encrypted at rest)
|
|
21
|
+
- Active/inactive state per provider
|
|
22
|
+
- Priority ordering
|
|
23
|
+
- Backup key configuration
|
|
24
|
+
|
|
25
|
+
## Provider Config File
|
|
26
|
+
|
|
27
|
+
Providers are configured via `~/.config/opencode/providers.json` or via the dashboard UI:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"providers": [
|
|
32
|
+
{
|
|
33
|
+
"id": "minimax",
|
|
34
|
+
"name": "MiniMax",
|
|
35
|
+
"apiKeys": ["sk-..."],
|
|
36
|
+
"active": true,
|
|
37
|
+
"priority": 1
|
|
38
|
+
}
|
|
39
|
+
]
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Backup Keys (Multi-Key Rotation)
|
|
44
|
+
|
|
45
|
+
Configure additional keys for a provider:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# Via env var (comma-separated)
|
|
49
|
+
export MINIMAX_API_KEYS="key1,key2,key3"
|
|
50
|
+
|
|
51
|
+
# Via providers.json
|
|
52
|
+
{
|
|
53
|
+
"providers": [{
|
|
54
|
+
"id": "minimax",
|
|
55
|
+
"apiKeys": ["key1", "key2", "key3"]
|
|
56
|
+
}]
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Auto-Add Wizard
|
|
61
|
+
|
|
62
|
+
When the active provider fails with 401/403, the system can prompt the user to add a new key. The wizard:
|
|
63
|
+
1. Detects auth failure
|
|
64
|
+
2. Opens a modal prompting for a new key
|
|
65
|
+
3. Validates the key by making a test request
|
|
66
|
+
4. Adds to backup keys or replaces the failed key
|
|
67
|
+
|
|
68
|
+
## Provider API Endpoints
|
|
69
|
+
|
|
70
|
+
- `GET /api/providers` - list all providers with status
|
|
71
|
+
- `POST /api/providers` - add a new provider
|
|
72
|
+
- `PUT /api/providers/:id` - update provider config
|
|
73
|
+
- `DELETE /api/providers/:id` - remove a provider
|
|
74
|
+
- `POST /api/providers/:id/keys` - add a backup key
|
|
75
|
+
- `POST /api/providers/rotate` - force rotation to next key
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: sdk
|
|
3
|
+
description: @polderlabs/bizar-sdk usage - building AI agents on Cloudflare Workers using the Agents SDK. Covers Agent class, state management, callable RPC, Workflows, durable execution, queues, retries, observability, and React hooks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# @polderlabs/bizar-sdk
|
|
7
|
+
|
|
8
|
+
The Bizar SDK lets you build AI-powered agents on Cloudflare Workers using the Agents SDK. It runs on Cloudflare's global network with automatic scaling and durable state.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install @polderlabs/bizar-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Core Concepts
|
|
17
|
+
|
|
18
|
+
### Agent Class
|
|
19
|
+
|
|
20
|
+
```typescript
|
|
21
|
+
import { Agent } from '@polderlabs/bizar-sdk';
|
|
22
|
+
|
|
23
|
+
const agent = new Agent({
|
|
24
|
+
name: 'my-agent',
|
|
25
|
+
model: 'minimax/MiniMax-M3',
|
|
26
|
+
systemPrompt: 'You are a helpful assistant.',
|
|
27
|
+
env: { MINIMAX_API_KEY },
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
export default agent;
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
### State Management
|
|
34
|
+
|
|
35
|
+
Agents maintain durable state across requests using Cloudflare Durable Objects:
|
|
36
|
+
|
|
37
|
+
```typescript
|
|
38
|
+
const state = await agent.state.get();
|
|
39
|
+
// { count: 0, lastSeen: Date }
|
|
40
|
+
await agent.state.patch({ count: state.count + 1 });
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Callable RPC
|
|
44
|
+
|
|
45
|
+
Agents expose RPC methods callable via HTTP:
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
agent.method('greet', async (name: string) => {
|
|
49
|
+
return `Hello, ${name}!`;
|
|
50
|
+
});
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Call from the dashboard or any HTTP client:
|
|
54
|
+
```bash
|
|
55
|
+
curl -X POST https://my-agent.workers.dev/rpc/greet \
|
|
56
|
+
-H "Content-Type: application/json" \
|
|
57
|
+
-d '{"name": "World"}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Workflows
|
|
61
|
+
|
|
62
|
+
For long-running tasks, use Workflows (durable execution):
|
|
63
|
+
|
|
64
|
+
```typescript
|
|
65
|
+
import { Workflow } from '@polderlabs/bizar-sdk';
|
|
66
|
+
|
|
67
|
+
const workflow = new Workflow({
|
|
68
|
+
name: 'data-processor',
|
|
69
|
+
retry: { maxAttempts: 3, backoff: 'exponential' },
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
workflow.step('fetch', async ({ input }) => {
|
|
73
|
+
return await fetch(input.url);
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
workflow.step('process', async ({ input, state }) => {
|
|
77
|
+
const data = await input.json();
|
|
78
|
+
return { ...data, processed: true };
|
|
79
|
+
});
|
|
80
|
+
|
|
81
|
+
export default workflow;
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Queues
|
|
85
|
+
|
|
86
|
+
For async message processing:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { Queue } from '@polderlabs/bizar-sdk';
|
|
90
|
+
|
|
91
|
+
const queue = new Queue('my-queue', {
|
|
92
|
+
maxRetries: 3,
|
|
93
|
+
batchSize: 10,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
queue.processor(async (messages) => {
|
|
97
|
+
for (const msg of messages) {
|
|
98
|
+
console.log('Received:', msg.body);
|
|
99
|
+
}
|
|
100
|
+
});
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Observability
|
|
104
|
+
|
|
105
|
+
Built-in tracing to Cloudflare Analytics:
|
|
106
|
+
- Request logs
|
|
107
|
+
- Token usage
|
|
108
|
+
- Error rates
|
|
109
|
+
- Latency percentiles
|
|
110
|
+
|
|
111
|
+
## React Hooks
|
|
112
|
+
|
|
113
|
+
For building chat interfaces:
|
|
114
|
+
|
|
115
|
+
```typescript
|
|
116
|
+
import { useAgent, useSession } from '@polderlabs/bizar-sdk/react';
|
|
117
|
+
|
|
118
|
+
function ChatComponent({ agentName }: { agentName: string }) {
|
|
119
|
+
const { messages, send, isLoading } = useAgent(agentName);
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<div>
|
|
123
|
+
{messages.map((m) => (
|
|
124
|
+
<div key={m.id}>{m.role}: {m.content}</div>
|
|
125
|
+
))}
|
|
126
|
+
<input onSend={send} disabled={isLoading} />
|
|
127
|
+
</div>
|
|
128
|
+
);
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
## Deployment
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
npx wrangler deploy
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Workers are deployed to Cloudflare's global network. No cold starts, automatic HTTPS.
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: self-improvement
|
|
3
|
+
description: Use when setting up, configuring, or debugging the project-level self-improvement system. Every task records lessons learned to .bizar/AGENTS_SELF_IMPROVEMENT.md for agent behavior improvement across sessions.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Self-Improvement Protocol
|
|
7
|
+
|
|
8
|
+
Records lessons learned after every meaningful task to `.bizar/AGENTS_SELF_IMPROVEMENT.md`. This enables agents to avoid repeating mistakes and build on past successes.
|
|
9
|
+
|
|
10
|
+
## How It Works
|
|
11
|
+
|
|
12
|
+
After completing a non-trivial task, the agent appends a structured entry to `.bizar/AGENTS_SELF_IMPROVEMENT.md` in the project root. Entries are written in Markdown with frontmatter for easy querying.
|
|
13
|
+
|
|
14
|
+
## Entry Format
|
|
15
|
+
|
|
16
|
+
```markdown
|
|
17
|
+
## [YYYY-MM-DD] <one-line summary>
|
|
18
|
+
|
|
19
|
+
**Task:** <what was asked>
|
|
20
|
+
|
|
21
|
+
**Approach taken:** <key decisions and why>
|
|
22
|
+
|
|
23
|
+
**What worked:** <specific things that went well>
|
|
24
|
+
|
|
25
|
+
**What could be better:** <mistakes, friction points, missed opportunities>
|
|
26
|
+
|
|
27
|
+
**Will do differently:** <concrete rule or habit for next time>
|
|
28
|
+
|
|
29
|
+
**Tags:** #<tag1> #<tag2>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## When to Write an Entry
|
|
33
|
+
|
|
34
|
+
Write an entry when:
|
|
35
|
+
- A bug took more than 30 minutes to find or fix
|
|
36
|
+
- A significant architectural decision was made
|
|
37
|
+
- A known pattern or idiom was rediscovered
|
|
38
|
+
- A previous mistake was identified and corrected
|
|
39
|
+
- A task involved non-obvious tool usage or workflow
|
|
40
|
+
|
|
41
|
+
## Reading Before New Tasks
|
|
42
|
+
|
|
43
|
+
Before starting a non-trivial task in an unfamiliar area, agents should search the self-improvement file:
|
|
44
|
+
```
|
|
45
|
+
grep -A5 "tag:debugging" .bizar/AGENTS_SELF_IMPROVEMENT.md
|
|
46
|
+
grep -A5 "tag:typescript" .bizar/AGENTS_SELF_IMPROVEMENT.md
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
This surfaces prior lessons that apply to the current work.
|
|
50
|
+
|
|
51
|
+
## Skill File Location
|
|
52
|
+
|
|
53
|
+
The skill instructions are at `~/.opencode/skills/self-improvement/SKILL.md`. Load with the `skill` tool when setting up or debugging the system.
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: skills-cli
|
|
3
|
+
description: How to discover and install skills using the skills CLI. Covers skills list, search, add, and the skills.sh ecosystem of skill repositories.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Skills CLI
|
|
7
|
+
|
|
8
|
+
The `skills` CLI (`npm install -g skills`) is the standard way to discover and install skills in BizarHarness. Skills are Markdown files with YAML frontmatter that encode specialized knowledge and workflows for agents.
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
|
|
12
|
+
```bash
|
|
13
|
+
npm install -g skills
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
Verify: `skills --version`
|
|
17
|
+
|
|
18
|
+
## Core Commands
|
|
19
|
+
|
|
20
|
+
### skills list
|
|
21
|
+
List all installed skills:
|
|
22
|
+
```bash
|
|
23
|
+
skills list --json
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### skills search
|
|
27
|
+
Search for skills by keyword:
|
|
28
|
+
```bash
|
|
29
|
+
skills search "react performance"
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
### skills add
|
|
33
|
+
Install a skill from a GitHub repository:
|
|
34
|
+
```bash
|
|
35
|
+
skills add owner/repo --all -y # install all skills from repo
|
|
36
|
+
skills add owner/repo -s "skill-name" -y # install specific skill
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
### skills info
|
|
40
|
+
Get details about a skill:
|
|
41
|
+
```bash
|
|
42
|
+
skills info my-skill
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Known Skill Repositories
|
|
46
|
+
|
|
47
|
+
| Domain | Repository |
|
|
48
|
+
|---|---|
|
|
49
|
+
| General (find-skills, skill-creator) | `vercel-labs/skills` |
|
|
50
|
+
| Frontend (React, a11y, web-design) | `vercel-labs/agent-skills`, `shadcn/ui` |
|
|
51
|
+
| Backend (Supabase, Postgres, auth) | `supabase/agent-skills` |
|
|
52
|
+
| Testing (TDD, Playwright) | `mattpocock/skills`, `microsoft/playwright-cli` |
|
|
53
|
+
| Design (frontend-design, UI/UX) | `anthropics/skills`, `leonxlnx/taste-skill` |
|
|
54
|
+
|
|
55
|
+
## Skill File Format
|
|
56
|
+
|
|
57
|
+
Skills are `.md` files named `SKILL.md` inside a skill directory:
|
|
58
|
+
|
|
59
|
+
```
|
|
60
|
+
~/.opencode/skills/my-skill/
|
|
61
|
+
SKILL.md ← the skill content
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
The first line must be YAML frontmatter:
|
|
65
|
+
```yaml
|
|
66
|
+
---
|
|
67
|
+
name: my-skill
|
|
68
|
+
description: Use when you need to do X. Covers Y and Z.
|
|
69
|
+
---
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Skill Discovery Protocol
|
|
73
|
+
|
|
74
|
+
1. **Assess** - When given a task, consider whether a skill might exist for it
|
|
75
|
+
2. **Check installed** - Run `skills list --json` to see what is already available
|
|
76
|
+
3. **Try known repos** - Based on the task domain, attempt installation from known repos
|
|
77
|
+
4. **Use** - Load the skill with the `skill` tool before writing code
|
|
78
|
+
5. **Skip** - If no skill found, proceed without
|
|
79
|
+
|
|
80
|
+
## SKILL.md Structure
|
|
81
|
+
|
|
82
|
+
A good skill is 50–200 lines:
|
|
83
|
+
|
|
84
|
+
1. **Frontmatter** - `name`, `description`
|
|
85
|
+
2. **When to use** - trigger conditions and use cases
|
|
86
|
+
3. **Key concepts** - essential background
|
|
87
|
+
4. **Code examples** - realistic, copy-pasteable snippets
|
|
88
|
+
5. **Common gotchas** - pitfalls and how to avoid them
|
|
89
|
+
|
|
90
|
+
## Skill Loading in Bizar
|
|
91
|
+
|
|
92
|
+
When an agent task is dispatched, Bizar checks if a skill matches the task description. If matched, the skill's `SKILL.md` content is injected into the agent's context before the task prompt.
|
|
93
|
+
|
|
94
|
+
Use the `skill` tool explicitly when you want to load a skill's instructions into the current conversation.
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: usage
|
|
3
|
+
description: Usage monitoring and analytics in BizarHarness - token tracking, cost estimation, usage store, and the MiniMax usage dashboard.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Usage Monitoring
|
|
7
|
+
|
|
8
|
+
BizarHarness tracks LLM token usage across all sessions and agents. Data is stored in `bizar-dash/src/server/minimax-usage-store.mjs` and surfaced in the dashboard.
|
|
9
|
+
|
|
10
|
+
## What Is Tracked
|
|
11
|
+
|
|
12
|
+
Per request:
|
|
13
|
+
- **Input tokens** - prompt tokens sent to the model
|
|
14
|
+
- **Output tokens** - tokens received from the model
|
|
15
|
+
- **Model** - which model was used (MiniMax-M2.7, MiniMax-M3, etc.)
|
|
16
|
+
- **Provider** - which provider handled the request
|
|
17
|
+
- **Session ID** - which session this belongs to
|
|
18
|
+
- **Agent** - which agent made the request (Thor, Tyr, etc.)
|
|
19
|
+
- **Timestamp** - when the request completed
|
|
20
|
+
|
|
21
|
+
## Cost Estimation
|
|
22
|
+
|
|
23
|
+
Token counts are converted to cost using the model's published pricing:
|
|
24
|
+
- MiniMax-M2.7: $0.30/M input · $1.20/M output
|
|
25
|
+
- MiniMax-M3: $0.30/M input · $1.20/M output
|
|
26
|
+
|
|
27
|
+
The usage dashboard shows:
|
|
28
|
+
- Total cost (current billing period)
|
|
29
|
+
- Cost breakdown by agent
|
|
30
|
+
- Cost breakdown by day/week
|
|
31
|
+
- Token count vs cost trend
|
|
32
|
+
|
|
33
|
+
## Usage Store
|
|
34
|
+
|
|
35
|
+
`bizar-dash/src/server/minimax-usage-store.mjs` uses a simple JSON file at `~/.config/bizar/usage.jsonl` (one JSON object per line - append-only log).
|
|
36
|
+
|
|
37
|
+
The store aggregates on read:
|
|
38
|
+
- Daily totals
|
|
39
|
+
- Per-agent totals
|
|
40
|
+
- Per-session totals
|
|
41
|
+
|
|
42
|
+
## Usage API Endpoints
|
|
43
|
+
|
|
44
|
+
- `GET /api/minimax/usage` - aggregated usage stats
|
|
45
|
+
- `GET /api/minimax/usage/daily` - daily breakdown
|
|
46
|
+
- `GET /api/minimax/usage/sessions` - per-session usage
|
|
47
|
+
|
|
48
|
+
## Dashboard View
|
|
49
|
+
|
|
50
|
+
`bizar-dash/src/web/views/MiniMaxUsage.tsx` renders:
|
|
51
|
+
- Summary cards (total cost, total tokens, avg cost/session)
|
|
52
|
+
- Line chart of daily cost
|
|
53
|
+
- Bar chart of cost by agent
|
|
54
|
+
- Table of recent sessions with usage
|
|
55
|
+
|
|
56
|
+
## Retention
|
|
57
|
+
|
|
58
|
+
Usage data is retained for 90 days by default. Old entries are pruned on each write to keep the log manageable.
|
|
59
|
+
|
|
60
|
+
## Cost Alerts
|
|
61
|
+
|
|
62
|
+
When a session's cumulative cost exceeds a threshold, the system logs a warning. The threshold is configurable via `MINIMAX_COST_ALERT_THRESHOLD` env var (default: $5 per session).
|
|
@@ -50,6 +50,10 @@ import { createThemesRouter } from './routes/themes.mjs';
|
|
|
50
50
|
import { createNotificationsRouter } from './routes/notifications.mjs';
|
|
51
51
|
import { createMinimaxRouter } from './routes/minimax.mjs';
|
|
52
52
|
import { createMiscRouter } from './routes/misc.mjs';
|
|
53
|
+
import { createEnvVarsRouter } from './routes/env-vars.mjs';
|
|
54
|
+
import { createUpdateRouter } from './routes/update.mjs';
|
|
55
|
+
import { createUsageRouter } from './routes/usage.mjs';
|
|
56
|
+
import { createHeadroomRouter } from './routes/headroom.mjs';
|
|
53
57
|
|
|
54
58
|
/**
|
|
55
59
|
* @param {object} deps
|
|
@@ -103,6 +107,10 @@ export async function createApiRouter({
|
|
|
103
107
|
router.use(createHistoryRouter({ projectRoot }));
|
|
104
108
|
router.use(createConfigRouter({ state, watcher }));
|
|
105
109
|
router.use(createProvidersRouter());
|
|
110
|
+
router.use(createEnvVarsRouter());
|
|
111
|
+
// v4.6.0 — Update endpoints (status / check / apply). Wired with the
|
|
112
|
+
// shared broadcast so apply can stream progress via WS.
|
|
113
|
+
router.use(createUpdateRouter({ broadcast }));
|
|
106
114
|
router.use(createSettingsRouter({ state, broadcast }));
|
|
107
115
|
router.use(createChatRouter({ state, broadcast }));
|
|
108
116
|
router.use(createOpencodeSessionsRouter());
|
|
@@ -114,12 +122,22 @@ export async function createApiRouter({
|
|
|
114
122
|
// memory routes haven't landed yet, the dashboard still boots.
|
|
115
123
|
const { createMemoryRouter } = await import('./routes/memory.mjs');
|
|
116
124
|
router.use(createMemoryRouter({ projectRoot }));
|
|
125
|
+
// v4.6.0 — LightRAG settings endpoints (defaults + status). Lazy-imported
|
|
126
|
+
// so a sibling that owns this file can ship independently.
|
|
127
|
+
const { createLightragRouter } = await import('./routes/lightrag.mjs');
|
|
128
|
+
router.use(createLightragRouter({ projectRoot }));
|
|
117
129
|
router.use(createDiagnosticsRouter());
|
|
118
130
|
router.use(createPairRouter({ state, broadcast }));
|
|
119
131
|
router.use(createThemesRouter({ state }));
|
|
120
132
|
router.use(createNotificationsRouter({ broadcast }));
|
|
121
133
|
router.use(createArtifactsRouter({ state, broadcast, projectRoot }));
|
|
122
134
|
router.use(createMinimaxRouter({ state, broadcast }));
|
|
135
|
+
router.use(createUsageRouter());
|
|
136
|
+
// v5.0.0 — Headroom context compression endpoints.
|
|
137
|
+
// Mounted at /api/headroom/* so the mount-prefix stripping works correctly.
|
|
138
|
+
// Each route handler inside the router is at its bare path (e.g. '/status'),
|
|
139
|
+
// which becomes '/api/headroom/status' at the top level.
|
|
140
|
+
router.use('/headroom', createHeadroomRouter());
|
|
123
141
|
router.use(createMiscRouter({ state, broadcast }));
|
|
124
142
|
|
|
125
143
|
// /api/auth/* must be reachable WITHOUT the bearer token so a fresh
|