bazilion 0.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/.understand-anything/.understandignore +25 -0
- package/.understand-anything/fingerprints.json +14267 -0
- package/.understand-anything/knowledge-graph.json +18128 -0
- package/.understand-anything/meta.json +6 -0
- package/CLAUDE.md +164 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/apps/cli/package.json +21 -0
- package/apps/cli/src/auth-file.ts +18 -0
- package/apps/cli/src/client.ts +37 -0
- package/apps/cli/src/columnize.ts +32 -0
- package/apps/cli/src/commands/agent.ts +574 -0
- package/apps/cli/src/commands/auth.ts +110 -0
- package/apps/cli/src/commands/backup.ts +135 -0
- package/apps/cli/src/commands/completion.ts +155 -0
- package/apps/cli/src/commands/config.ts +95 -0
- package/apps/cli/src/commands/doctor.ts +131 -0
- package/apps/cli/src/commands/group.ts +132 -0
- package/apps/cli/src/commands/inbox.ts +82 -0
- package/apps/cli/src/commands/login.ts +73 -0
- package/apps/cli/src/commands/memory.ts +106 -0
- package/apps/cli/src/commands/profile.ts +259 -0
- package/apps/cli/src/commands/provider.ts +170 -0
- package/apps/cli/src/commands/send.ts +24 -0
- package/apps/cli/src/commands/serve.ts +89 -0
- package/apps/cli/src/commands/skill.ts +120 -0
- package/apps/cli/src/commands/token.ts +148 -0
- package/apps/cli/src/commands/trigger.ts +129 -0
- package/apps/cli/src/commands/uninstall.ts +156 -0
- package/apps/cli/src/index.ts +196 -0
- package/apps/cli/src/paths.ts +12 -0
- package/apps/cli/test/agent.test.ts +213 -0
- package/apps/cli/test/backup.test.ts +95 -0
- package/apps/cli/test/chat.test.ts +539 -0
- package/apps/cli/test/columnize.test.ts +29 -0
- package/apps/cli/test/completion.test.ts +45 -0
- package/apps/cli/test/config-page.test.ts +151 -0
- package/apps/cli/test/group.test.ts +74 -0
- package/apps/cli/test/helpers.ts +70 -0
- package/apps/cli/test/inbox-autodeliver.test.ts +143 -0
- package/apps/cli/test/inbox.test.ts +147 -0
- package/apps/cli/test/memory.test.ts +69 -0
- package/apps/cli/test/profile.test.ts +110 -0
- package/apps/cli/test/send.test.ts +30 -0
- package/apps/cli/test/server-fixture.ts +212 -0
- package/apps/cli/test/session-head.test.ts +45 -0
- package/apps/cli/test/skill.test.ts +128 -0
- package/apps/cli/test/token.test.ts +109 -0
- package/apps/cli/test/trigger.test.ts +245 -0
- package/apps/cli/tsconfig.json +4 -0
- package/apps/daemon/package.json +31 -0
- package/apps/daemon/src/app.ts +41 -0
- package/apps/daemon/src/core/agent/archive.ts +8 -0
- package/apps/daemon/src/core/agent/delete.ts +30 -0
- package/apps/daemon/src/core/agent/resolve.ts +31 -0
- package/apps/daemon/src/core/agent/spawn.ts +95 -0
- package/apps/daemon/src/core/agent/unarchive.ts +11 -0
- package/apps/daemon/src/core/availableModels.ts +58 -0
- package/apps/daemon/src/core/db/client.ts +113 -0
- package/apps/daemon/src/core/db/migrate.ts +41 -0
- package/apps/daemon/src/core/db/migrations/0001_init.sql +179 -0
- package/apps/daemon/src/core/group/delete.ts +21 -0
- package/apps/daemon/src/core/group/register.ts +68 -0
- package/apps/daemon/src/core/index.ts +71 -0
- package/apps/daemon/src/core/paths.ts +56 -0
- package/apps/daemon/src/core/profile/create.ts +78 -0
- package/apps/daemon/src/core/profile/delete.ts +26 -0
- package/apps/daemon/src/core/profile/identity.ts +70 -0
- package/apps/daemon/src/core/profile/load.ts +45 -0
- package/apps/daemon/src/core/profile/seed.ts +74 -0
- package/apps/daemon/src/core/profile/templates.ts +60 -0
- package/apps/daemon/src/core/profile/update.ts +57 -0
- package/apps/daemon/src/core/profile/validate.ts +9 -0
- package/apps/daemon/src/core/repos/agents.ts +202 -0
- package/apps/daemon/src/core/repos/config.ts +78 -0
- package/apps/daemon/src/core/repos/groups.ts +55 -0
- package/apps/daemon/src/core/repos/messages.ts +127 -0
- package/apps/daemon/src/core/repos/profiles.ts +83 -0
- package/apps/daemon/src/core/repos/providerModels.ts +58 -0
- package/apps/daemon/src/core/repos/providerState.ts +37 -0
- package/apps/daemon/src/core/repos/secrets.ts +145 -0
- package/apps/daemon/src/core/repos/skillMeta.ts +49 -0
- package/apps/daemon/src/core/repos/triggers.ts +101 -0
- package/apps/daemon/src/core/repos/webTokens.ts +87 -0
- package/apps/daemon/src/core/secrets.ts +65 -0
- package/apps/daemon/src/core/services.ts +264 -0
- package/apps/daemon/src/core/skills/discover.ts +28 -0
- package/apps/daemon/src/core/skills/import.ts +136 -0
- package/apps/daemon/src/core/skills/parse.ts +52 -0
- package/apps/daemon/src/core/skills/resolve.ts +50 -0
- package/apps/daemon/src/index.ts +45 -0
- package/apps/daemon/src/lib/agent-cancel.ts +48 -0
- package/apps/daemon/src/lib/agent-id.ts +13 -0
- package/apps/daemon/src/lib/agent-turn.ts +56 -0
- package/apps/daemon/src/lib/api-key.ts +56 -0
- package/apps/daemon/src/lib/auth.ts +41 -0
- package/apps/daemon/src/lib/cron.ts +93 -0
- package/apps/daemon/src/lib/ctx.ts +80 -0
- package/apps/daemon/src/lib/messaging-host.ts +34 -0
- package/apps/daemon/src/lib/middleware-auth.ts +52 -0
- package/apps/daemon/src/lib/scheduler.ts +294 -0
- package/apps/daemon/src/routes/agents.ts +772 -0
- package/apps/daemon/src/routes/auth-login.ts +193 -0
- package/apps/daemon/src/routes/config.ts +267 -0
- package/apps/daemon/src/routes/groups.ts +133 -0
- package/apps/daemon/src/routes/messages.ts +29 -0
- package/apps/daemon/src/routes/misc.ts +239 -0
- package/apps/daemon/src/routes/profiles.ts +197 -0
- package/apps/daemon/src/routes/skills.ts +123 -0
- package/apps/daemon/src/routes/triggers.ts +29 -0
- package/apps/daemon/src/runtime/auth/openai-codex.ts +121 -0
- package/apps/daemon/src/runtime/auto-reply/heartbeat.ts +31 -0
- package/apps/daemon/src/runtime/index.ts +77 -0
- package/apps/daemon/src/runtime/memory/files.ts +103 -0
- package/apps/daemon/src/runtime/memory/qmd.ts +152 -0
- package/apps/daemon/src/runtime/memory/types.ts +16 -0
- package/apps/daemon/src/runtime/pi/events.ts +173 -0
- package/apps/daemon/src/runtime/pi/session.ts +536 -0
- package/apps/daemon/src/runtime/pi/tools.ts +85 -0
- package/apps/daemon/src/runtime/providers/catalog.ts +145 -0
- package/apps/daemon/src/runtime/providers/pi-adapter.ts +272 -0
- package/apps/daemon/src/runtime/providers/registry.ts +374 -0
- package/apps/daemon/src/runtime/providers/retry.ts +176 -0
- package/apps/daemon/src/runtime/providers/types.ts +33 -0
- package/apps/daemon/src/runtime/session/prompt.ts +83 -0
- package/apps/daemon/src/runtime/tools/bootstrap.ts +22 -0
- package/apps/daemon/src/runtime/tools/home.ts +114 -0
- package/apps/daemon/src/runtime/tools/memory.ts +81 -0
- package/apps/daemon/src/runtime/tools/messaging.ts +127 -0
- package/apps/daemon/src/runtime/tools/registry.ts +29 -0
- package/apps/daemon/src/runtime/tools/types.ts +13 -0
- package/apps/daemon/src/runtime/tools/web-extract.ts +110 -0
- package/apps/daemon/src/runtime/tools/web-ssrf.ts +245 -0
- package/apps/daemon/src/runtime/tools/web.ts +273 -0
- package/apps/daemon/src/runtime/worker/entry.ts +221 -0
- package/apps/daemon/src/runtime/worker/ipc-protocol.ts +75 -0
- package/apps/daemon/src/runtime/worker/spawn.ts +249 -0
- package/apps/daemon/test/core/agents.test.ts +319 -0
- package/apps/daemon/test/core/available-models.test.ts +63 -0
- package/apps/daemon/test/core/config.test.ts +99 -0
- package/apps/daemon/test/core/groups.test.ts +63 -0
- package/apps/daemon/test/core/helpers.ts +50 -0
- package/apps/daemon/test/core/identity.test.ts +85 -0
- package/apps/daemon/test/core/migrations.test.ts +83 -0
- package/apps/daemon/test/core/profiles.test.ts +182 -0
- package/apps/daemon/test/core/provider-models.test.ts +57 -0
- package/apps/daemon/test/core/provider-state.test.ts +36 -0
- package/apps/daemon/test/core/skill-meta.test.ts +45 -0
- package/apps/daemon/test/core/skills.test.ts +271 -0
- package/apps/daemon/test/core/triggers.test.ts +182 -0
- package/apps/daemon/test/core/web-tokens.test.ts +79 -0
- package/apps/daemon/test/cron.test.ts +90 -0
- package/apps/daemon/test/runtime/heartbeat.test.ts +34 -0
- package/apps/daemon/test/runtime/memory-qmd.test.ts +97 -0
- package/apps/daemon/test/runtime/memory.test.ts +78 -0
- package/apps/daemon/test/runtime/messaging.test.ts +213 -0
- package/apps/daemon/test/runtime/mock-server.ts +65 -0
- package/apps/daemon/test/runtime/openai-codex-auth.test.ts +116 -0
- package/apps/daemon/test/runtime/providers.test.ts +306 -0
- package/apps/daemon/test/runtime/retry.test.ts +191 -0
- package/apps/daemon/test/runtime/session-head.test.ts +90 -0
- package/apps/daemon/test/runtime/tools-home.test.ts +102 -0
- package/apps/daemon/test/runtime/tools-web.test.ts +206 -0
- package/apps/daemon/tsconfig.json +4 -0
- package/apps/mobile/README.md +60 -0
- package/apps/mobile/app/_layout.tsx +58 -0
- package/apps/mobile/app/agents/[id]/chat.tsx +486 -0
- package/apps/mobile/app/agents/[id]/index.tsx +166 -0
- package/apps/mobile/app/agents/index.tsx +212 -0
- package/apps/mobile/app/index.tsx +21 -0
- package/apps/mobile/app/pair.tsx +226 -0
- package/apps/mobile/app/settings.tsx +419 -0
- package/apps/mobile/app.json +49 -0
- package/apps/mobile/assets/adaptive-icon.png +0 -0
- package/apps/mobile/assets/favicon.png +0 -0
- package/apps/mobile/assets/icon.png +0 -0
- package/apps/mobile/assets/splash-icon.png +0 -0
- package/apps/mobile/babel.config.js +6 -0
- package/apps/mobile/metro.config.js +28 -0
- package/apps/mobile/package.json +44 -0
- package/apps/mobile/src/auth.ts +66 -0
- package/apps/mobile/src/pair-url.ts +48 -0
- package/apps/mobile/src/theme-context.tsx +88 -0
- package/apps/mobile/src/theme.ts +135 -0
- package/apps/mobile/test/pair-url.test.ts +46 -0
- package/apps/mobile/tsconfig.json +23 -0
- package/apps/web/components.json +25 -0
- package/apps/web/package.json +39 -0
- package/apps/web/public/baziu.svg +8 -0
- package/apps/web/src/components/AgentTabs.tsx +45 -0
- package/apps/web/src/components/BaziuLogo.tsx +21 -0
- package/apps/web/src/components/ChatPane.tsx +1033 -0
- package/apps/web/src/components/ConfigTabs.tsx +29 -0
- package/apps/web/src/components/CopyButton.tsx +68 -0
- package/apps/web/src/components/CreateGroupDialog.tsx +127 -0
- package/apps/web/src/components/FieldRow.tsx +94 -0
- package/apps/web/src/components/Footer.tsx +10 -0
- package/apps/web/src/components/PawIcon.tsx +15 -0
- package/apps/web/src/components/Sidebar.tsx +287 -0
- package/apps/web/src/components/SpawnDialog.tsx +129 -0
- package/apps/web/src/components/ThemeToggle.tsx +75 -0
- package/apps/web/src/components/TopNav.tsx +34 -0
- package/apps/web/src/components/ui/button.tsx +67 -0
- package/apps/web/src/components/ui/card.tsx +103 -0
- package/apps/web/src/components/ui/checkbox.tsx +31 -0
- package/apps/web/src/components/ui/dialog.tsx +168 -0
- package/apps/web/src/components/ui/input.tsx +19 -0
- package/apps/web/src/components/ui/label.tsx +22 -0
- package/apps/web/src/components/ui/radio-group.tsx +44 -0
- package/apps/web/src/components/ui/select.tsx +192 -0
- package/apps/web/src/components/ui/separator.tsx +26 -0
- package/apps/web/src/components/ui/table.tsx +116 -0
- package/apps/web/src/components/ui/tabs.tsx +88 -0
- package/apps/web/src/components/ui/textarea.tsx +18 -0
- package/apps/web/src/lib/auth.ts +50 -0
- package/apps/web/src/lib/daemon-client.ts +34 -0
- package/apps/web/src/lib/md.ts +45 -0
- package/apps/web/src/lib/utils.ts +6 -0
- package/apps/web/src/lib/wire-constants.ts +27 -0
- package/apps/web/src/routeTree.gen.ts +408 -0
- package/apps/web/src/router.tsx +20 -0
- package/apps/web/src/routes/__root.tsx +123 -0
- package/apps/web/src/routes/agents/$id/inbox.tsx +207 -0
- package/apps/web/src/routes/agents/$id/index.tsx +527 -0
- package/apps/web/src/routes/agents/$id/triggers.tsx +239 -0
- package/apps/web/src/routes/agents/index.tsx +265 -0
- package/apps/web/src/routes/api/$.ts +88 -0
- package/apps/web/src/routes/config/index.tsx +315 -0
- package/apps/web/src/routes/config/services.tsx +49 -0
- package/apps/web/src/routes/config/tokens.tsx +192 -0
- package/apps/web/src/routes/groups/$id/index.tsx +153 -0
- package/apps/web/src/routes/groups/$id/memory.tsx +321 -0
- package/apps/web/src/routes/groups/index.tsx +191 -0
- package/apps/web/src/routes/index.tsx +133 -0
- package/apps/web/src/routes/login.tsx +63 -0
- package/apps/web/src/routes/profiles/$id.tsx +549 -0
- package/apps/web/src/routes/profiles/index.tsx +458 -0
- package/apps/web/src/routes/skills/index.tsx +297 -0
- package/apps/web/src/routes/welcome.tsx +61 -0
- package/apps/web/src/styles.css +449 -0
- package/apps/web/tsconfig.json +25 -0
- package/apps/web/vite.config.ts +25 -0
- package/biome.json +23 -0
- package/docs/agent-engine.md +219 -0
- package/docs/architecture.md +627 -0
- package/docs/backlog/README.md +42 -0
- package/docs/backlog/draft/BAZ-001-a2a-federation-spike.md +125 -0
- package/docs/openclaw-reference.md +210 -0
- package/package.json +38 -0
- package/packages/api-types/package.json +11 -0
- package/packages/api-types/src/entities.ts +146 -0
- package/packages/api-types/src/events.ts +55 -0
- package/packages/api-types/src/index.ts +488 -0
- package/packages/api-types/src/memory.ts +15 -0
- package/packages/client/package.json +13 -0
- package/packages/client/src/index.ts +117 -0
- package/pnpm-workspace.yaml +3 -0
- package/tsconfig.base.json +23 -0
- package/tsconfig.json +11 -0
- package/vitest.config.ts +22 -0
|
@@ -0,0 +1,488 @@
|
|
|
1
|
+
// Wire-shape package. Hermetic: depends on nothing from the daemon, so every
|
|
2
|
+
// client (web, mobile, cli, future SDKs) can pull in API shapes without
|
|
3
|
+
// dragging Node-only code (node:sqlite, undici, pi-ai, the worker spawner)
|
|
4
|
+
// into its TS check graph or runtime bundle. The daemon imports its entity
|
|
5
|
+
// and wire types FROM here.
|
|
6
|
+
|
|
7
|
+
export type {
|
|
8
|
+
Agent,
|
|
9
|
+
AgentIdentityFile,
|
|
10
|
+
AgentSkillAttachment,
|
|
11
|
+
AgentStatus,
|
|
12
|
+
AgentTrigger,
|
|
13
|
+
Group,
|
|
14
|
+
LoadedProfile,
|
|
15
|
+
Message,
|
|
16
|
+
OpenAICodexStatus,
|
|
17
|
+
Profile,
|
|
18
|
+
ReasoningLevel,
|
|
19
|
+
ResolvedAgent,
|
|
20
|
+
SkillMeta,
|
|
21
|
+
SkillsMode,
|
|
22
|
+
Timestamp,
|
|
23
|
+
TriggerKind,
|
|
24
|
+
WebToken,
|
|
25
|
+
} from './entities.ts'
|
|
26
|
+
export { REASONING_LEVELS } from './entities.ts'
|
|
27
|
+
export type {
|
|
28
|
+
ChatFrame,
|
|
29
|
+
ProviderMessage,
|
|
30
|
+
Role,
|
|
31
|
+
SessionEvent,
|
|
32
|
+
ToolCall,
|
|
33
|
+
ToolDef,
|
|
34
|
+
} from './events.ts'
|
|
35
|
+
export type { MemoryEntry, MemoryHit } from './memory.ts'
|
|
36
|
+
|
|
37
|
+
import type { AgentTrigger, Message, ReasoningLevel, WebToken } from './entities.ts'
|
|
38
|
+
|
|
39
|
+
export interface ApiError {
|
|
40
|
+
error: string
|
|
41
|
+
code?: string
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// --- agents ---
|
|
45
|
+
|
|
46
|
+
export interface ListAgentsQuery {
|
|
47
|
+
includeArchived?: boolean
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface SpawnAgentRequest {
|
|
51
|
+
profileId: string
|
|
52
|
+
name?: string
|
|
53
|
+
model?: string
|
|
54
|
+
reasoningLevel?: ReasoningLevel
|
|
55
|
+
/** Group the new agent joins. Falls back to the seeded 'default' group when omitted. */
|
|
56
|
+
groupId?: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface UpdateAgentRequest {
|
|
60
|
+
modelOverride?: string | null
|
|
61
|
+
reasoningLevel?: ReasoningLevel
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface AttachSkillRequest {
|
|
65
|
+
skill: string
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/** Body for `PATCH /api/agents/:id/group`: move the agent to a new group. */
|
|
69
|
+
export interface MoveAgentRequest {
|
|
70
|
+
groupId: string
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export interface SendMessageRequest {
|
|
74
|
+
from: string
|
|
75
|
+
payload: { text: string }
|
|
76
|
+
replyTo?: string
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface ListInboxQuery {
|
|
80
|
+
unread?: boolean
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
export interface ListInboxResponse {
|
|
84
|
+
messages: Message[]
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface UpdateMessageRequest {
|
|
88
|
+
read: true
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// --- profiles ---
|
|
92
|
+
|
|
93
|
+
export interface UpdateProfileRequest {
|
|
94
|
+
name?: string
|
|
95
|
+
defaultModel?: string
|
|
96
|
+
skillsMode?: 'all' | 'selected'
|
|
97
|
+
defaultSkills?: string[]
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export interface CreateProfileRequest {
|
|
101
|
+
id: string
|
|
102
|
+
name?: string
|
|
103
|
+
defaultModel: string
|
|
104
|
+
skillsMode?: 'all' | 'selected'
|
|
105
|
+
defaultSkills?: string[]
|
|
106
|
+
/** Initial SOUL.md content. Falls back to the built-in template when omitted. */
|
|
107
|
+
soul?: string
|
|
108
|
+
/** Initial IDENTITY.md content. Falls back to the built-in template when omitted. */
|
|
109
|
+
identity?: string
|
|
110
|
+
/** Initial BOOTSTRAP.md content. Omit for default; pass null to skip bootstrap entirely. */
|
|
111
|
+
bootstrap?: string | null
|
|
112
|
+
/** Initial AGENTS.md content. Omit to skip; pass a string to seed the file. */
|
|
113
|
+
agents?: string
|
|
114
|
+
/** Initial TOOLS.md content. Omit to skip; pass a string to seed the file. */
|
|
115
|
+
tools?: string
|
|
116
|
+
/** Initial HEARTBEAT.md content. Omit to skip; pass a string to seed the file. */
|
|
117
|
+
heartbeat?: string
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
// --- groups ---
|
|
121
|
+
|
|
122
|
+
export interface RegisterGroupRequest {
|
|
123
|
+
/** Slug (lowercase, digits, hyphens). Becomes the row id AND the directory
|
|
124
|
+
* name under `~/.bazilion/groups/<slug>/`. */
|
|
125
|
+
id: string
|
|
126
|
+
/** Optional human-readable label. Defaults to `id`. */
|
|
127
|
+
name?: string
|
|
128
|
+
/**
|
|
129
|
+
* Optional symlink target. When set, the daemon materializes the group
|
|
130
|
+
* slot as a symlink to this absolute path instead of as a real directory
|
|
131
|
+
* — useful for "agents working on my existing project tree." Target must
|
|
132
|
+
* exist and be a directory.
|
|
133
|
+
*/
|
|
134
|
+
link?: string
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/** Body for `PUT /api/groups/:id/user-md`. */
|
|
138
|
+
export interface SetGroupUserMdRequest {
|
|
139
|
+
userMd: string
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// --- skills (write) ---
|
|
143
|
+
|
|
144
|
+
export interface ImportSkillsRequest {
|
|
145
|
+
source: string
|
|
146
|
+
force?: boolean
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export interface ImportSkillsResponse {
|
|
150
|
+
imported: string[]
|
|
151
|
+
skipped: { name: string; reason: string }[]
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
// --- providers (write) ---
|
|
155
|
+
|
|
156
|
+
export interface ProviderTestRequest {
|
|
157
|
+
model: string
|
|
158
|
+
message?: string
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface ProviderTestResponse {
|
|
162
|
+
content: string
|
|
163
|
+
usage?: {
|
|
164
|
+
promptTokens: number
|
|
165
|
+
completionTokens: number
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
// --- chat streaming ---
|
|
170
|
+
|
|
171
|
+
export interface ChatRequest {
|
|
172
|
+
message: string
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// --- profile files ---
|
|
176
|
+
|
|
177
|
+
export type ProfileFileName =
|
|
178
|
+
| 'profile.json'
|
|
179
|
+
| 'SOUL.md'
|
|
180
|
+
| 'IDENTITY.md'
|
|
181
|
+
| 'BOOTSTRAP.md'
|
|
182
|
+
| 'AGENTS.md'
|
|
183
|
+
| 'TOOLS.md'
|
|
184
|
+
| 'HEARTBEAT.md'
|
|
185
|
+
|
|
186
|
+
export const PROFILE_FILES: ProfileFileName[] = [
|
|
187
|
+
'profile.json',
|
|
188
|
+
'SOUL.md',
|
|
189
|
+
'IDENTITY.md',
|
|
190
|
+
'BOOTSTRAP.md',
|
|
191
|
+
'AGENTS.md',
|
|
192
|
+
'TOOLS.md',
|
|
193
|
+
'HEARTBEAT.md',
|
|
194
|
+
]
|
|
195
|
+
|
|
196
|
+
export interface FileContentResponse {
|
|
197
|
+
content: string
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
export interface PutFileRequest {
|
|
201
|
+
content: string
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
// --- skills ---
|
|
205
|
+
|
|
206
|
+
export interface SkillInfo {
|
|
207
|
+
name: string
|
|
208
|
+
description: string
|
|
209
|
+
source: string | null
|
|
210
|
+
importedAt: number | null
|
|
211
|
+
parseError?: string
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export interface ResolvedSkillsResponse {
|
|
215
|
+
resolved: SkillInfo[]
|
|
216
|
+
missing: { name: string; reason: string }[]
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
export interface TruncateChatRequest {
|
|
220
|
+
/** Number of leading messages to preserve; everything after is dropped. */
|
|
221
|
+
keepCount: number
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
export interface TruncateChatResponse {
|
|
225
|
+
before: number
|
|
226
|
+
after: number
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* Lightweight "has anything new happened on this agent's session?" probe.
|
|
231
|
+
* Polled by the web chat UI to detect out-of-band activity (inbox-wakes,
|
|
232
|
+
* scheduled triggers, turns run from another tab) so it can prompt the user
|
|
233
|
+
* to refresh — the session JSONL is append-only, so either a new filename or
|
|
234
|
+
* a bigger byte-count means new entries landed.
|
|
235
|
+
*/
|
|
236
|
+
export interface SessionHeadResponse {
|
|
237
|
+
/** Basename of the most-recent `.jsonl` session file, or `null` if none. */
|
|
238
|
+
file: string | null
|
|
239
|
+
/** Byte size of that file (monotonically increasing while in use). */
|
|
240
|
+
size: number
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
export interface ContextFileEntry {
|
|
244
|
+
/** Basename of the injected profile file (e.g. SOUL.md). */
|
|
245
|
+
name: string
|
|
246
|
+
/** Full character count of the file's contribution to the system prompt. */
|
|
247
|
+
chars: number
|
|
248
|
+
/** Rough token estimate (chars / 4). */
|
|
249
|
+
tokens: number
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
export interface ContextToolEntry {
|
|
253
|
+
name: string
|
|
254
|
+
/** JSON schema char size (what the provider sees as tool definitions). */
|
|
255
|
+
schemaChars: number
|
|
256
|
+
/** Description char size. */
|
|
257
|
+
descriptionChars: number
|
|
258
|
+
/** Count of top-level properties on the input schema, when shaped like JSONSchema. */
|
|
259
|
+
paramCount: number | null
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
export interface ContextSkillEntry {
|
|
263
|
+
name: string
|
|
264
|
+
/** Char count of the skill block injected into the system prompt (currently just the name). */
|
|
265
|
+
blockChars: number
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
export interface ContextGroupEntry {
|
|
269
|
+
id: string
|
|
270
|
+
name: string
|
|
271
|
+
path: string
|
|
272
|
+
userMdChars: number
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
export interface ContextHistoryBreakdown {
|
|
276
|
+
/** Count of `message` entries. */
|
|
277
|
+
messageEntries: number
|
|
278
|
+
/** Count of `compaction` entries (summarization boundaries). */
|
|
279
|
+
compactionEntries: number
|
|
280
|
+
/** Char sum of message `content` fields (LLM input surface). */
|
|
281
|
+
chars: number
|
|
282
|
+
/** Raw wire size of the serialized log on disk. */
|
|
283
|
+
bytes: number
|
|
284
|
+
/** Rough token estimate (chars / 4) for history alone. */
|
|
285
|
+
tokensEstimate: number
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface ChatContextResponse {
|
|
289
|
+
/** Agent being reported on. */
|
|
290
|
+
agentId: string
|
|
291
|
+
/** provider:model string the agent currently resolves to. */
|
|
292
|
+
model: string
|
|
293
|
+
systemPrompt: {
|
|
294
|
+
chars: number
|
|
295
|
+
tokens: number
|
|
296
|
+
/** Per-file breakdown of profile markdown sources (AGENTS.md, SOUL.md, TOOLS.md, IDENTITY.md, HEARTBEAT.md, BOOTSTRAP.md). */
|
|
297
|
+
files: ContextFileEntry[]
|
|
298
|
+
/** Char count of the skill-list text rendered into the system prompt. */
|
|
299
|
+
skillsListChars: number
|
|
300
|
+
/** Char count of the group block rendered into the system prompt. */
|
|
301
|
+
groupListChars: number
|
|
302
|
+
/** Char count of the USER.md block (0 when the group's userMd is empty). */
|
|
303
|
+
userMdChars: number
|
|
304
|
+
/** Fixed memory-hint block the runtime always appends. */
|
|
305
|
+
memoryHintChars: number
|
|
306
|
+
}
|
|
307
|
+
tools: {
|
|
308
|
+
count: number
|
|
309
|
+
listChars: number
|
|
310
|
+
schemaChars: number
|
|
311
|
+
entries: ContextToolEntry[]
|
|
312
|
+
}
|
|
313
|
+
skills: {
|
|
314
|
+
count: number
|
|
315
|
+
entries: ContextSkillEntry[]
|
|
316
|
+
}
|
|
317
|
+
group: ContextGroupEntry
|
|
318
|
+
history: ContextHistoryBreakdown
|
|
319
|
+
/** Sum of system prompt + tool schemas + history, in chars + tokens. */
|
|
320
|
+
totals: { chars: number; tokens: number }
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
export interface ChatCompactRequest {
|
|
324
|
+
/** Number of trailing message entries to keep verbatim. Default 10. */
|
|
325
|
+
keepTail?: number
|
|
326
|
+
/** Optional freeform guidance prepended to the summarizer system prompt. */
|
|
327
|
+
customInstructions?: string
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface ChatCompactResponse {
|
|
331
|
+
/** Entry count before compaction. */
|
|
332
|
+
before: number
|
|
333
|
+
/** Entry count after compaction (1 compaction + `keptTail` messages). */
|
|
334
|
+
after: number
|
|
335
|
+
/** Message entries summarized into the compaction (the head that was dropped). */
|
|
336
|
+
summarized: number
|
|
337
|
+
/** Message entries preserved verbatim after the compaction boundary. */
|
|
338
|
+
keptTail: number
|
|
339
|
+
/** Rough token estimate of the log before compaction. */
|
|
340
|
+
tokensBefore: number
|
|
341
|
+
/** Rough token estimate of the log after compaction. */
|
|
342
|
+
tokensAfter: number
|
|
343
|
+
/** The summary text produced by the model. */
|
|
344
|
+
summary: string
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
// --- triggers (heartbeats / cron) ---
|
|
348
|
+
|
|
349
|
+
export interface CreateTriggerRequest {
|
|
350
|
+
kind: 'interval' | 'cron'
|
|
351
|
+
/** required when kind='interval' */
|
|
352
|
+
intervalSec?: number
|
|
353
|
+
/** required when kind='cron' — 5-field expression ("m h dom mon dow") */
|
|
354
|
+
cronExpr?: string
|
|
355
|
+
/** injected as the user message when the trigger fires */
|
|
356
|
+
message: string
|
|
357
|
+
enabled?: boolean
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
export interface UpdateTriggerRequest {
|
|
361
|
+
enabled?: boolean
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export interface CreateTriggerResponse {
|
|
365
|
+
trigger: AgentTrigger
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
export interface UpdateTriggerResponse {
|
|
369
|
+
trigger: AgentTrigger
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
export interface ListTriggersResponse {
|
|
373
|
+
triggers: AgentTrigger[]
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// --- config page (providers + services + fields) ---
|
|
377
|
+
|
|
378
|
+
/** Per-field UI + storage descriptor — source-of-truth is SERVICES in apps/daemon/src/core/services.ts. */
|
|
379
|
+
export interface ServiceFieldState {
|
|
380
|
+
envVar: string
|
|
381
|
+
kind: 'secret' | 'config'
|
|
382
|
+
label: string
|
|
383
|
+
placeholder?: string
|
|
384
|
+
description?: string
|
|
385
|
+
/** True when the field has a non-empty value in its storage backend. */
|
|
386
|
+
set: boolean
|
|
387
|
+
/** For `kind: 'config'` (plaintext): the actual value. Omitted for secrets. */
|
|
388
|
+
value?: string
|
|
389
|
+
/** For `kind: 'secret'`: a truncated preview like "sk-abc…" so the UI can confirm something is stored. Omitted when unset. */
|
|
390
|
+
preview?: string
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
export interface ServiceCard {
|
|
394
|
+
id: string
|
|
395
|
+
displayName: string
|
|
396
|
+
/** Present for category==='provider' cards — tracks whether the pi-adapter sees it as configured. */
|
|
397
|
+
enabled?: boolean
|
|
398
|
+
envHint?: string
|
|
399
|
+
hint?: string
|
|
400
|
+
fields: ServiceFieldState[]
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
export interface ProviderConfigEntry extends ServiceCard {
|
|
404
|
+
enabled: boolean
|
|
405
|
+
envHint: string
|
|
406
|
+
/** Static catalog from pi-ai's typed model list — empty for providers not in the catalog. */
|
|
407
|
+
catalog: string[]
|
|
408
|
+
/** Live `/v1/models` query — omitted when the provider doesn't expose one. */
|
|
409
|
+
live?: { models: string[]; error?: string }
|
|
410
|
+
/** Curated models the admin has selected — drives the dropdowns in profile/agent forms. */
|
|
411
|
+
curated: string[]
|
|
412
|
+
}
|
|
413
|
+
|
|
414
|
+
export interface ProviderConfigResponse {
|
|
415
|
+
providers: ProviderConfigEntry[]
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
export interface ServiceConfigResponse {
|
|
419
|
+
services: ServiceCard[]
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
export interface SetFieldRequest {
|
|
423
|
+
value: string
|
|
424
|
+
}
|
|
425
|
+
|
|
426
|
+
export interface SetProviderModelsRequest {
|
|
427
|
+
models: string[]
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export interface SetProviderModelsResponse {
|
|
431
|
+
models: string[]
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
export interface SetProviderEnabledRequest {
|
|
435
|
+
enabled: boolean
|
|
436
|
+
}
|
|
437
|
+
|
|
438
|
+
export interface SetProviderEnabledResponse {
|
|
439
|
+
name: string
|
|
440
|
+
enabled: boolean
|
|
441
|
+
}
|
|
442
|
+
|
|
443
|
+
// --- web tokens ---
|
|
444
|
+
|
|
445
|
+
export interface CreateTokenRequest {
|
|
446
|
+
label: string
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
export interface CreateTokenResponse {
|
|
450
|
+
/** Plaintext token — returned exactly once. */
|
|
451
|
+
token: string
|
|
452
|
+
meta: WebToken
|
|
453
|
+
}
|
|
454
|
+
|
|
455
|
+
export interface ListTokensResponse {
|
|
456
|
+
tokens: WebToken[]
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
// --- health (doctor) ---
|
|
460
|
+
|
|
461
|
+
export interface HealthReport {
|
|
462
|
+
ok: boolean
|
|
463
|
+
home: string
|
|
464
|
+
paths: {
|
|
465
|
+
home: boolean
|
|
466
|
+
db: boolean
|
|
467
|
+
auth: boolean
|
|
468
|
+
profiles: boolean
|
|
469
|
+
agents: boolean
|
|
470
|
+
skills: boolean
|
|
471
|
+
}
|
|
472
|
+
database:
|
|
473
|
+
| { ok: true; profiles: number; activeAgents: number; totalAgents: number; groups: number }
|
|
474
|
+
| { ok: false; error: string }
|
|
475
|
+
| null
|
|
476
|
+
skills: { installed: number; parseErrors: number }
|
|
477
|
+
providers: {
|
|
478
|
+
/** Names of cloud providers with credentials configured (e.g. ['anthropic', 'groq']). */
|
|
479
|
+
configured: string[]
|
|
480
|
+
lmstudio: { baseURL: string; hasKey: boolean }
|
|
481
|
+
ollama: { baseURL: string }
|
|
482
|
+
}
|
|
483
|
+
webSearch: { bravePreview: string | null; searxngUrl: string | null }
|
|
484
|
+
openclaw: { path: string; exists: boolean }
|
|
485
|
+
triggers: { active: number; disabled: number }
|
|
486
|
+
tokens: { active: number }
|
|
487
|
+
scheduler: { enabled: boolean; tickMs: number }
|
|
488
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Wire shapes for the per-group memory store. The `MemoryBackend` interface
|
|
2
|
+
// itself stays in apps/daemon/src/runtime/memory (it has methods and is
|
|
3
|
+
// server-internal); these are the values that cross the HTTP wire.
|
|
4
|
+
|
|
5
|
+
export interface MemoryEntry {
|
|
6
|
+
key: string
|
|
7
|
+
content: string
|
|
8
|
+
updatedAt: number
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export interface MemoryHit {
|
|
12
|
+
key: string
|
|
13
|
+
snippet: string
|
|
14
|
+
score: number
|
|
15
|
+
}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { ApiError } from '@bazilion/api-types'
|
|
2
|
+
|
|
3
|
+
export type TokenSource = string | (() => string | Promise<string>)
|
|
4
|
+
|
|
5
|
+
export interface ClientConfig {
|
|
6
|
+
serverUrl: string
|
|
7
|
+
/**
|
|
8
|
+
* Bearer token (or supplier for lazy / rotating credentials). The package
|
|
9
|
+
* sends it as `Authorization: Bearer <token>` and also stamps `Origin:
|
|
10
|
+
* <serverUrl>` to pass Astro's `security.checkOrigin` gate on non-GET
|
|
11
|
+
* requests. Pass a function to support token rotation (OAuth refresh,
|
|
12
|
+
* mobile keychain reads) — it is invoked on every request.
|
|
13
|
+
*/
|
|
14
|
+
token: TokenSource
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export class ApiClientError extends Error {
|
|
18
|
+
status: number
|
|
19
|
+
body: ApiError
|
|
20
|
+
constructor(status: number, body: ApiError) {
|
|
21
|
+
super(`${status}: ${body.error}`)
|
|
22
|
+
this.status = status
|
|
23
|
+
this.body = body
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async function resolveToken(src: TokenSource): Promise<string> {
|
|
28
|
+
return typeof src === 'function' ? await src() : src
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export function createClient(cfg: ClientConfig) {
|
|
32
|
+
async function authHeaders(): Promise<Record<string, string>> {
|
|
33
|
+
const token = await resolveToken(cfg.token)
|
|
34
|
+
return {
|
|
35
|
+
authorization: `Bearer ${token}`,
|
|
36
|
+
// Astro 6 enabled `security.checkOrigin` by default for server mode:
|
|
37
|
+
// any state-changing request without an `Origin` matching the server
|
|
38
|
+
// host is rejected with 403. Browsers set this automatically; `fetch`
|
|
39
|
+
// in Node / React Native does not. Stamping the server's own URL is
|
|
40
|
+
// always valid for a legitimate client.
|
|
41
|
+
origin: cfg.serverUrl,
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function request<T>(method: string, path: string, body?: unknown): Promise<T> {
|
|
46
|
+
const headers: Record<string, string> = { ...(await authHeaders()) }
|
|
47
|
+
if (body !== undefined) headers['content-type'] = 'application/json'
|
|
48
|
+
const res = await fetch(`${cfg.serverUrl}${path}`, {
|
|
49
|
+
method,
|
|
50
|
+
headers,
|
|
51
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
52
|
+
})
|
|
53
|
+
if (!res.ok) {
|
|
54
|
+
const err = (await res.json().catch(() => ({ error: res.statusText }))) as ApiError
|
|
55
|
+
throw new ApiClientError(res.status, err)
|
|
56
|
+
}
|
|
57
|
+
if (res.status === 204) return undefined as T
|
|
58
|
+
return (await res.json()) as T
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// Multipart POST — lets the runtime set its own `content-type: multipart/form-data;
|
|
62
|
+
// boundary=…` header. Reusing `request()` would stomp that with JSON, so
|
|
63
|
+
// we keep a separate path.
|
|
64
|
+
async function postMultipart<T>(path: string, form: FormData): Promise<T> {
|
|
65
|
+
const res = await fetch(`${cfg.serverUrl}${path}`, {
|
|
66
|
+
method: 'POST',
|
|
67
|
+
headers: { ...(await authHeaders()) },
|
|
68
|
+
body: form,
|
|
69
|
+
})
|
|
70
|
+
if (!res.ok) {
|
|
71
|
+
const err = (await res.json().catch(() => ({ error: res.statusText }))) as ApiError
|
|
72
|
+
throw new ApiClientError(res.status, err)
|
|
73
|
+
}
|
|
74
|
+
if (res.status === 204) return undefined as T
|
|
75
|
+
return (await res.json()) as T
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
async function* stream<T>(method: string, path: string, body?: unknown): AsyncGenerator<T> {
|
|
79
|
+
const headers: Record<string, string> = { ...(await authHeaders()) }
|
|
80
|
+
if (body !== undefined) headers['content-type'] = 'application/json'
|
|
81
|
+
const res = await fetch(`${cfg.serverUrl}${path}`, {
|
|
82
|
+
method,
|
|
83
|
+
headers,
|
|
84
|
+
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
85
|
+
})
|
|
86
|
+
if (!res.ok || !res.body) {
|
|
87
|
+
const err = (await res.json().catch(() => ({ error: res.statusText }))) as ApiError
|
|
88
|
+
throw new ApiClientError(res.status, err)
|
|
89
|
+
}
|
|
90
|
+
const reader = res.body.getReader()
|
|
91
|
+
const decoder = new TextDecoder()
|
|
92
|
+
let buffer = ''
|
|
93
|
+
while (true) {
|
|
94
|
+
const { done, value } = await reader.read()
|
|
95
|
+
if (done) break
|
|
96
|
+
buffer += decoder.decode(value, { stream: true })
|
|
97
|
+
const lines = buffer.split('\n')
|
|
98
|
+
buffer = lines.pop() ?? ''
|
|
99
|
+
for (const line of lines) {
|
|
100
|
+
if (line.trim()) yield JSON.parse(line) as T
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
if (buffer.trim()) yield JSON.parse(buffer) as T
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return {
|
|
107
|
+
get: <T>(p: string) => request<T>('GET', p),
|
|
108
|
+
post: <T>(p: string, b?: unknown) => request<T>('POST', p, b),
|
|
109
|
+
postMultipart,
|
|
110
|
+
put: <T>(p: string, b?: unknown) => request<T>('PUT', p, b),
|
|
111
|
+
patch: <T>(p: string, b?: unknown) => request<T>('PATCH', p, b),
|
|
112
|
+
del: <T>(p: string) => request<T>('DELETE', p),
|
|
113
|
+
stream,
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export type BazilionClient = ReturnType<typeof createClient>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"target": "ESNext",
|
|
4
|
+
"module": "ESNext",
|
|
5
|
+
"moduleResolution": "Bundler",
|
|
6
|
+
"lib": ["ESNext"],
|
|
7
|
+
"types": ["node"],
|
|
8
|
+
|
|
9
|
+
"strict": true,
|
|
10
|
+
"noUncheckedIndexedAccess": true,
|
|
11
|
+
"noImplicitOverride": true,
|
|
12
|
+
"noFallthroughCasesInSwitch": true,
|
|
13
|
+
"forceConsistentCasingInFileNames": true,
|
|
14
|
+
|
|
15
|
+
"esModuleInterop": true,
|
|
16
|
+
"resolveJsonModule": true,
|
|
17
|
+
"isolatedModules": true,
|
|
18
|
+
"verbatimModuleSyntax": true,
|
|
19
|
+
"allowImportingTsExtensions": true,
|
|
20
|
+
"skipLibCheck": true,
|
|
21
|
+
"noEmit": true
|
|
22
|
+
}
|
|
23
|
+
}
|
package/tsconfig.json
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.base.json",
|
|
3
|
+
"include": [
|
|
4
|
+
"apps/cli/src/**/*.ts",
|
|
5
|
+
"apps/cli/test/**/*.ts",
|
|
6
|
+
"apps/daemon/src/**/*.ts",
|
|
7
|
+
"apps/daemon/test/**/*.ts",
|
|
8
|
+
"packages/**/src/**/*.ts"
|
|
9
|
+
],
|
|
10
|
+
"exclude": ["**/node_modules", "**/dist", "apps/web/**"]
|
|
11
|
+
}
|
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config'
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
include: ['apps/*/test/**/*.test.ts', 'packages/*/test/**/*.test.ts'],
|
|
6
|
+
passWithNoTests: true,
|
|
7
|
+
// CLI integration tests spawn the daemon as a subprocess per test file.
|
|
8
|
+
// 30s is generous for cold start; if it's slower, we want to see it fail
|
|
9
|
+
// quickly and diagnose the real cause rather than silently stall the suite.
|
|
10
|
+
hookTimeout: 30_000,
|
|
11
|
+
// Some CLI tests chain 10+ subprocess calls (each ~200–400 ms). Vitest's
|
|
12
|
+
// 5s default testTimeout is below the realistic ceiling, so give them the
|
|
13
|
+
// same 30s budget as hooks. Real hangs still show up quickly.
|
|
14
|
+
testTimeout: 30_000,
|
|
15
|
+
pool: 'forks',
|
|
16
|
+
poolOptions: {
|
|
17
|
+
forks: {
|
|
18
|
+
maxForks: 8,
|
|
19
|
+
},
|
|
20
|
+
},
|
|
21
|
+
},
|
|
22
|
+
})
|