agent-mockingbird 0.0.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/.agents/skills/btca-cli/SKILL.md +64 -0
- package/.agents/skills/btca-cli/agents/openai.yaml +3 -0
- package/.agents/skills/frontend-design/SKILL.md +42 -0
- package/.agents/skills/frontend-design/agents/openai.yaml +3 -0
- package/.env.example +36 -0
- package/.githooks/pre-commit +33 -0
- package/.github/workflows/ci.yml +309 -0
- package/.opencode/bun.lock +18 -0
- package/.opencode/package.json +5 -0
- package/.opencode/tools/agent_type_manager.ts +100 -0
- package/.opencode/tools/config_manager.ts +87 -0
- package/.opencode/tools/cron_manager.ts +145 -0
- package/.opencode/tools/memory_get.ts +43 -0
- package/.opencode/tools/memory_remember.ts +53 -0
- package/.opencode/tools/memory_search.ts +48 -0
- package/AGENTS.md +126 -0
- package/MEMORY.md +2 -0
- package/README.md +451 -0
- package/THIRD_PARTY_NOTICES.md +11 -0
- package/agent-mockingbird.config.example.json +135 -0
- package/apps/server/package.json +32 -0
- package/apps/server/src/backend/agents/bootstrapContext.ts +362 -0
- package/apps/server/src/backend/agents/openclawImport.test.ts +133 -0
- package/apps/server/src/backend/agents/openclawImport.ts +797 -0
- package/apps/server/src/backend/agents/opencodeConfig.ts +428 -0
- package/apps/server/src/backend/agents/service.ts +10 -0
- package/apps/server/src/backend/config/example-config.test.ts +20 -0
- package/apps/server/src/backend/config/orchestration.ts +243 -0
- package/apps/server/src/backend/config/policy.ts +158 -0
- package/apps/server/src/backend/config/schema.test.ts +15 -0
- package/apps/server/src/backend/config/schema.ts +391 -0
- package/apps/server/src/backend/config/semantic.test.ts +34 -0
- package/apps/server/src/backend/config/semantic.ts +149 -0
- package/apps/server/src/backend/config/service.test.ts +75 -0
- package/apps/server/src/backend/config/service.ts +207 -0
- package/apps/server/src/backend/config/smoke.ts +77 -0
- package/apps/server/src/backend/config/store.test.ts +123 -0
- package/apps/server/src/backend/config/store.ts +581 -0
- package/apps/server/src/backend/config/testFixtures.ts +5 -0
- package/apps/server/src/backend/config/types.ts +56 -0
- package/apps/server/src/backend/contracts/events.ts +320 -0
- package/apps/server/src/backend/contracts/runtime.ts +111 -0
- package/apps/server/src/backend/cron/executor.ts +435 -0
- package/apps/server/src/backend/cron/repository.ts +170 -0
- package/apps/server/src/backend/cron/service.ts +660 -0
- package/apps/server/src/backend/cron/storage.ts +92 -0
- package/apps/server/src/backend/cron/types.ts +138 -0
- package/apps/server/src/backend/cron/utils.ts +351 -0
- package/apps/server/src/backend/db/client.ts +20 -0
- package/apps/server/src/backend/db/migrate.ts +40 -0
- package/apps/server/src/backend/db/repository.ts +1762 -0
- package/apps/server/src/backend/db/schema.ts +113 -0
- package/apps/server/src/backend/db/usageDashboard.test.ts +102 -0
- package/apps/server/src/backend/db/wipe.ts +13 -0
- package/apps/server/src/backend/defaults.ts +32 -0
- package/apps/server/src/backend/env.ts +48 -0
- package/apps/server/src/backend/heartbeat/activeHours.ts +45 -0
- package/apps/server/src/backend/heartbeat/defaultJob.ts +88 -0
- package/apps/server/src/backend/heartbeat/heartbeat.test.ts +110 -0
- package/apps/server/src/backend/heartbeat/runtimeService.ts +190 -0
- package/apps/server/src/backend/heartbeat/service.ts +176 -0
- package/apps/server/src/backend/heartbeat/state.test.ts +63 -0
- package/apps/server/src/backend/heartbeat/state.ts +167 -0
- package/apps/server/src/backend/heartbeat/types.ts +54 -0
- package/apps/server/src/backend/http/boundedQueue.test.ts +49 -0
- package/apps/server/src/backend/http/boundedQueue.ts +92 -0
- package/apps/server/src/backend/http/parsers.ts +40 -0
- package/apps/server/src/backend/http/router.ts +61 -0
- package/apps/server/src/backend/http/routes/agentRoutes.ts +67 -0
- package/apps/server/src/backend/http/routes/backgroundRoutes.ts +203 -0
- package/apps/server/src/backend/http/routes/chatRoutes.ts +107 -0
- package/apps/server/src/backend/http/routes/configRoutes.ts +602 -0
- package/apps/server/src/backend/http/routes/cronRoutes.ts +221 -0
- package/apps/server/src/backend/http/routes/dashboardRoutes.ts +308 -0
- package/apps/server/src/backend/http/routes/eventRoutes.ts +7 -0
- package/apps/server/src/backend/http/routes/heartbeatRoutes.test.ts +41 -0
- package/apps/server/src/backend/http/routes/heartbeatRoutes.ts +28 -0
- package/apps/server/src/backend/http/routes/index.ts +101 -0
- package/apps/server/src/backend/http/routes/mcpRoutes.ts +213 -0
- package/apps/server/src/backend/http/routes/memoryRoutes.ts +154 -0
- package/apps/server/src/backend/http/routes/runRoutes.ts +310 -0
- package/apps/server/src/backend/http/routes/runtimeRoutes.ts +197 -0
- package/apps/server/src/backend/http/routes/skillRoutes.ts +112 -0
- package/apps/server/src/backend/http/routes/uiRoutes.test.ts +161 -0
- package/apps/server/src/backend/http/routes/uiRoutes.ts +177 -0
- package/apps/server/src/backend/http/routes/usageRoutes.test.ts +104 -0
- package/apps/server/src/backend/http/routes/usageRoutes.ts +767 -0
- package/apps/server/src/backend/http/schemas.ts +64 -0
- package/apps/server/src/backend/http/sse.ts +144 -0
- package/apps/server/src/backend/integration/backend-core.test.ts +2316 -0
- package/apps/server/src/backend/logging/logger.ts +64 -0
- package/apps/server/src/backend/mcp/service.ts +326 -0
- package/apps/server/src/backend/memory/cli.ts +170 -0
- package/apps/server/src/backend/memory/conceptExpansion.test.ts +28 -0
- package/apps/server/src/backend/memory/conceptExpansion.ts +80 -0
- package/apps/server/src/backend/memory/qmdPort.test.ts +54 -0
- package/apps/server/src/backend/memory/qmdPort.ts +61 -0
- package/apps/server/src/backend/memory/records.test.ts +66 -0
- package/apps/server/src/backend/memory/records.ts +229 -0
- package/apps/server/src/backend/memory/service.ts +2012 -0
- package/apps/server/src/backend/memory/sqliteVec.ts +58 -0
- package/apps/server/src/backend/memory/types.ts +104 -0
- package/apps/server/src/backend/opencode/agentMockingbirdPlugin.test.ts +396 -0
- package/apps/server/src/backend/opencode/client.ts +98 -0
- package/apps/server/src/backend/opencode/models.ts +41 -0
- package/apps/server/src/backend/opencode/systemPrompt.test.ts +146 -0
- package/apps/server/src/backend/opencode/systemPrompt.ts +284 -0
- package/apps/server/src/backend/paths.ts +57 -0
- package/apps/server/src/backend/prompts/service.ts +100 -0
- package/apps/server/src/backend/queue/queue.test.ts +189 -0
- package/apps/server/src/backend/queue/service.ts +177 -0
- package/apps/server/src/backend/queue/types.ts +39 -0
- package/apps/server/src/backend/run/service.ts +576 -0
- package/apps/server/src/backend/run/storage.ts +47 -0
- package/apps/server/src/backend/run/types.ts +44 -0
- package/apps/server/src/backend/runtime/errors.ts +61 -0
- package/apps/server/src/backend/runtime/index.ts +72 -0
- package/apps/server/src/backend/runtime/memoryPromptDedup.test.ts +153 -0
- package/apps/server/src/backend/runtime/memoryPromptDedup.ts +76 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/backgroundMethods.ts +765 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/coreMethods.ts +705 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/eventMethods.ts +503 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/memoryMethods.ts +462 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/promptMethods.ts +1167 -0
- package/apps/server/src/backend/runtime/opencodeRuntime/shared.ts +254 -0
- package/apps/server/src/backend/runtime/opencodeRuntime.test.ts +2899 -0
- package/apps/server/src/backend/runtime/opencodeRuntime.ts +135 -0
- package/apps/server/src/backend/runtime/sessionScope.ts +45 -0
- package/apps/server/src/backend/skills/service.ts +442 -0
- package/apps/server/src/backend/workspace/resolve.ts +27 -0
- package/apps/server/src/cli/agent-mockingbird.mjs +2522 -0
- package/apps/server/src/cli/agent-mockingbird.test.ts +68 -0
- package/apps/server/src/cli/runtime-assets.mjs +269 -0
- package/apps/server/src/cli/runtime-assets.test.ts +52 -0
- package/apps/server/src/cli/runtime-layout.mjs +75 -0
- package/apps/server/src/cli/standaloneBuild.test.ts +19 -0
- package/apps/server/src/cli/standaloneBuild.ts +19 -0
- package/apps/server/src/cli/standaloneCronBinary.test.ts +187 -0
- package/apps/server/src/index.ts +178 -0
- package/apps/server/tsconfig.json +12 -0
- package/backlog.md +5 -0
- package/bin/agent-mockingbird +2522 -0
- package/bin/runtime-layout.mjs +75 -0
- package/build-bin.ts +34 -0
- package/build-cli.mjs +37 -0
- package/build.ts +40 -0
- package/bun-env.d.ts +11 -0
- package/bun.lock +888 -0
- package/bunfig.toml +2 -0
- package/components.json +21 -0
- package/config.json +130 -0
- package/deploy/RELEASE_INSTALL.md +112 -0
- package/deploy/docker-compose.yml +42 -0
- package/deploy/systemd/README.md +46 -0
- package/deploy/systemd/agent-mockingbird.service +28 -0
- package/deploy/systemd/opencode.service +25 -0
- package/docs/legacy-config-ui-reference.md +51 -0
- package/docs/memory-e2e-trace-2026-03-04.md +63 -0
- package/docs/memory-ops.md +96 -0
- package/docs/memory-runtime-contract.md +42 -0
- package/docs/memory-tuning-remote-2026-03-04.md +59 -0
- package/docs/opencode-rebase-workflow-plan.md +614 -0
- package/docs/opencode-startup-sync-plan.md +94 -0
- package/docs/vendor-opencode.md +41 -0
- package/drizzle/0000_famous_turbo.sql +49 -0
- package/drizzle/0001_cron_memory_aux.sql +160 -0
- package/drizzle/0002_runtime_session_bindings.sql +28 -0
- package/drizzle/0003_background_runs.sql +27 -0
- package/drizzle/0004_memory_open_write.sql +63 -0
- package/drizzle/0005_signal_channel.sql +47 -0
- package/drizzle/0006_usage_event_dimensions.sql +7 -0
- package/drizzle/meta/0000_snapshot.json +341 -0
- package/drizzle/meta/_journal.json +55 -0
- package/drizzle.config.ts +14 -0
- package/eslint.config.mjs +77 -0
- package/knip.json +18 -0
- package/memory/2026-03-04.md +4 -0
- package/opencode.lock.json +16 -0
- package/package.json +67 -0
- package/packages/agent-mockingbird-installer/README.md +31 -0
- package/packages/agent-mockingbird-installer/bin/agent-mockingbird-installer.mjs +44 -0
- package/packages/agent-mockingbird-installer/opencode.lock.json +16 -0
- package/packages/agent-mockingbird-installer/package.json +23 -0
- package/packages/contracts/package.json +19 -0
- package/packages/contracts/src/agentTypes.ts +122 -0
- package/packages/contracts/src/cron.ts +146 -0
- package/packages/contracts/src/dashboard.ts +378 -0
- package/packages/contracts/src/index.ts +3 -0
- package/packages/contracts/tsconfig.json +4 -0
- package/patches/opencode/0001-Wafflebot-OpenCode-baseline.patch +2341 -0
- package/patches/opencode/0002-Fix-OpenCode-web-entry-and-settings-icons.patch +104 -0
- package/patches/opencode/0003-fix-app-remove-duplicate-sidebar-mount.patch +32 -0
- package/patches/opencode/0004-Add-heartbeat-settings-and-usage-nav.patch +506 -0
- package/patches/opencode/0005-Use-chart-icon-for-usage-nav.patch +38 -0
- package/patches/opencode/0006-Modernize-cron-settings.patch +399 -0
- package/patches/opencode/0007-Rename-waffle-namespaces-to-mockingbird.patch +1110 -0
- package/patches/opencode/0008-Remove-cron-contract-section.patch +178 -0
- package/patches/opencode/0009-Rework-cron-tab-as-operations-console.patch +414 -0
- package/patches/opencode/0010-Refine-heartbeat-settings-controls.patch +208 -0
- package/runtime-assets/opencode-config/opencode.jsonc +25 -0
- package/runtime-assets/opencode-config/package.json +5 -0
- package/runtime-assets/opencode-config/plugins/agent-mockingbird.ts +715 -0
- package/runtime-assets/workspace/.agents/skills/config-auditor/SKILL.md +25 -0
- package/runtime-assets/workspace/.agents/skills/config-editor/SKILL.md +24 -0
- package/runtime-assets/workspace/.agents/skills/cron-manager/SKILL.md +57 -0
- package/runtime-assets/workspace/.agents/skills/memory-ops/SKILL.md +120 -0
- package/runtime-assets/workspace/.agents/skills/runtime-diagnose/SKILL.md +25 -0
- package/runtime-assets/workspace/AGENTS.md +56 -0
- package/runtime-assets/workspace/MEMORY.md +4 -0
- package/scripts/build-release-bundle.sh +66 -0
- package/scripts/check-ship.ts +383 -0
- package/scripts/dev-opencode.sh +17 -0
- package/scripts/dev-stack-opencode.sh +15 -0
- package/scripts/dev-stack.sh +61 -0
- package/scripts/install-systemd.sh +87 -0
- package/scripts/memory-e2e.sh +76 -0
- package/scripts/memory-trace-e2e.sh +141 -0
- package/scripts/migrate-opencode-env.ts +108 -0
- package/scripts/onboard/bootstrap.sh +32 -0
- package/scripts/opencode-swap.ts +78 -0
- package/scripts/opencode-sync.ts +715 -0
- package/scripts/runtime-assets-sync.mjs +83 -0
- package/scripts/setup-git-hooks.ts +39 -0
- package/tsconfig.json +45 -0
- package/tui.json +98 -0
- package/turbo.json +36 -0
- package/vendor/OPENCODE_VENDOR.md +13 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@waffleophagus/agent-mockingbird-installer",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Compatibility wrapper for installing and running Agent Mockingbird from npm.",
|
|
7
|
+
"homepage": "https://github.com/waffleophagus/agent-mockingbird",
|
|
8
|
+
"bugs": {
|
|
9
|
+
"url": "https://github.com/waffleophagus/agent-mockingbird/issues"
|
|
10
|
+
},
|
|
11
|
+
"repository": {
|
|
12
|
+
"type": "git",
|
|
13
|
+
"url": "git+https://github.com/waffleophagus/agent-mockingbird.git"
|
|
14
|
+
},
|
|
15
|
+
"bin": {
|
|
16
|
+
"agent-mockingbird-installer": "bin/agent-mockingbird-installer.mjs"
|
|
17
|
+
},
|
|
18
|
+
"files": [
|
|
19
|
+
"bin",
|
|
20
|
+
"opencode.lock.json",
|
|
21
|
+
"README.md"
|
|
22
|
+
]
|
|
23
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@agent-mockingbird/contracts",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"lint": "eslint .",
|
|
8
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": "./src/index.ts",
|
|
12
|
+
"./agentTypes": "./src/agentTypes.ts",
|
|
13
|
+
"./cron": "./src/cron.ts",
|
|
14
|
+
"./dashboard": "./src/dashboard.ts"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"zod": "^4.3.6"
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
export type AgentTypeMode = "subagent" | "primary" | "all";
|
|
2
|
+
export type LegacySpecialistStatus = "available" | "busy" | "offline";
|
|
3
|
+
|
|
4
|
+
export interface LegacySpecialistAgentLike {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
specialty: string;
|
|
8
|
+
summary: string;
|
|
9
|
+
model: string;
|
|
10
|
+
status: LegacySpecialistStatus;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export interface AgentTypeDefinitionLike {
|
|
14
|
+
id: string;
|
|
15
|
+
name?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
prompt?: string;
|
|
18
|
+
model?: string;
|
|
19
|
+
variant?: string;
|
|
20
|
+
mode: AgentTypeMode;
|
|
21
|
+
hidden: boolean;
|
|
22
|
+
disable: boolean;
|
|
23
|
+
temperature?: number;
|
|
24
|
+
topP?: number;
|
|
25
|
+
steps?: number;
|
|
26
|
+
permission?: Record<string, unknown>;
|
|
27
|
+
options: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const LEGACY_DEFAULT_SPECIALTY = "General";
|
|
31
|
+
const LEGACY_DEFAULT_SUMMARY = "General assistant tasks.";
|
|
32
|
+
|
|
33
|
+
function isPlainObject(value: unknown): value is Record<string, unknown> {
|
|
34
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function normalizeAgentTypeMode(value: unknown): AgentTypeMode {
|
|
38
|
+
if (value === "subagent" || value === "primary" || value === "all") {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
return "subagent";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function normalizeLegacySpecialistStatus(value: unknown): LegacySpecialistStatus {
|
|
45
|
+
if (value === "available" || value === "busy" || value === "offline") {
|
|
46
|
+
return value;
|
|
47
|
+
}
|
|
48
|
+
return "available";
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export function normalizeAgentTypeDraft(agentType: AgentTypeDefinitionLike): AgentTypeDefinitionLike {
|
|
52
|
+
return {
|
|
53
|
+
...agentType,
|
|
54
|
+
id: agentType.id.trim(),
|
|
55
|
+
name: agentType.name?.trim() || undefined,
|
|
56
|
+
description: agentType.description?.trim() || undefined,
|
|
57
|
+
prompt: agentType.prompt?.trim() || undefined,
|
|
58
|
+
model: agentType.model?.trim() || undefined,
|
|
59
|
+
variant: agentType.variant?.trim() || undefined,
|
|
60
|
+
mode: normalizeAgentTypeMode(agentType.mode),
|
|
61
|
+
hidden: agentType.hidden === true,
|
|
62
|
+
disable: agentType.disable === true,
|
|
63
|
+
options: isPlainObject(agentType.options) ? { ...agentType.options } : {},
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function normalizeAgentTypeList(agentTypes: AgentTypeDefinitionLike[]) {
|
|
68
|
+
const deduped = new Map<string, AgentTypeDefinitionLike>();
|
|
69
|
+
for (const rawType of agentTypes) {
|
|
70
|
+
const normalized = normalizeAgentTypeDraft(rawType);
|
|
71
|
+
if (!normalized.id) continue;
|
|
72
|
+
deduped.set(normalized.id, normalized);
|
|
73
|
+
}
|
|
74
|
+
return [...deduped.values()].sort((left, right) => left.id.localeCompare(right.id));
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export function normalizeLegacySpecialistAgents(agents: LegacySpecialistAgentLike[]) {
|
|
78
|
+
const deduped = new Map<string, LegacySpecialistAgentLike>();
|
|
79
|
+
for (const rawAgent of agents) {
|
|
80
|
+
const id = rawAgent.id.trim();
|
|
81
|
+
if (!id) continue;
|
|
82
|
+
deduped.set(id, {
|
|
83
|
+
id,
|
|
84
|
+
name: rawAgent.name.trim() || id,
|
|
85
|
+
specialty: rawAgent.specialty.trim() || LEGACY_DEFAULT_SPECIALTY,
|
|
86
|
+
summary: rawAgent.summary.trim() || LEGACY_DEFAULT_SUMMARY,
|
|
87
|
+
model: rawAgent.model.trim(),
|
|
88
|
+
status: normalizeLegacySpecialistStatus(rawAgent.status),
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return [...deduped.values()].sort((left, right) => left.id.localeCompare(right.id));
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export function legacySpecialistToAgentType(agent: LegacySpecialistAgentLike): AgentTypeDefinitionLike {
|
|
95
|
+
return {
|
|
96
|
+
id: agent.id.trim(),
|
|
97
|
+
name: agent.name.trim() || undefined,
|
|
98
|
+
description: agent.specialty.trim() || undefined,
|
|
99
|
+
prompt: agent.summary.trim() || undefined,
|
|
100
|
+
model: agent.model.trim() || undefined,
|
|
101
|
+
mode: "subagent",
|
|
102
|
+
hidden: false,
|
|
103
|
+
disable: agent.status === "offline",
|
|
104
|
+
options: {
|
|
105
|
+
agentMockingbirdManagedLegacy: true,
|
|
106
|
+
agentMockingbirdDisplayName: agent.name.trim(),
|
|
107
|
+
agentMockingbirdStatus: agent.status,
|
|
108
|
+
},
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export function agentTypeToLegacySpecialist(agentType: AgentTypeDefinitionLike): LegacySpecialistAgentLike {
|
|
113
|
+
const normalized = normalizeAgentTypeDraft(agentType);
|
|
114
|
+
return {
|
|
115
|
+
id: normalized.id,
|
|
116
|
+
name: normalized.name || normalized.id,
|
|
117
|
+
specialty: normalized.description || LEGACY_DEFAULT_SPECIALTY,
|
|
118
|
+
summary: normalized.prompt || LEGACY_DEFAULT_SUMMARY,
|
|
119
|
+
model: normalized.model || "",
|
|
120
|
+
status: normalized.disable ? "offline" : "available",
|
|
121
|
+
};
|
|
122
|
+
}
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
export type CronScheduleKind = "at" | "every" | "cron";
|
|
2
|
+
export type CronRunMode = "background" | "conditional_agent" | "agent";
|
|
3
|
+
|
|
4
|
+
export type CronJobState = "queued" | "leased" | "running" | "completed" | "failed" | "dead";
|
|
5
|
+
export type CronStepStatus = "pending" | "running" | "completed" | "failed" | "skipped";
|
|
6
|
+
export type CronStepKind = "background" | "conditional_agent" | "agent";
|
|
7
|
+
|
|
8
|
+
export interface CronJobDefinition {
|
|
9
|
+
id: string;
|
|
10
|
+
name: string;
|
|
11
|
+
enabled: boolean;
|
|
12
|
+
scheduleKind: CronScheduleKind;
|
|
13
|
+
scheduleExpr: string | null;
|
|
14
|
+
everyMs: number | null;
|
|
15
|
+
atIso: string | null;
|
|
16
|
+
timezone: string | null;
|
|
17
|
+
runMode: CronRunMode;
|
|
18
|
+
conditionModulePath: string | null;
|
|
19
|
+
conditionDescription: string | null;
|
|
20
|
+
agentPromptTemplate: string | null;
|
|
21
|
+
agentModelOverride: string | null;
|
|
22
|
+
maxAttempts: number;
|
|
23
|
+
retryBackoffMs: number;
|
|
24
|
+
payload: Record<string, unknown>;
|
|
25
|
+
lastEnqueuedFor: string | null;
|
|
26
|
+
createdAt: string;
|
|
27
|
+
updatedAt: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export interface CronJobInstance {
|
|
31
|
+
id: string;
|
|
32
|
+
jobDefinitionId: string;
|
|
33
|
+
scheduledFor: string;
|
|
34
|
+
agentInvoked: boolean;
|
|
35
|
+
state: CronJobState;
|
|
36
|
+
attempt: number;
|
|
37
|
+
nextAttemptAt: string | null;
|
|
38
|
+
leaseOwner: string | null;
|
|
39
|
+
leaseExpiresAt: string | null;
|
|
40
|
+
lastHeartbeatAt: string | null;
|
|
41
|
+
resultSummary: string | null;
|
|
42
|
+
error: unknown;
|
|
43
|
+
createdAt: string;
|
|
44
|
+
updatedAt: string;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export interface CronJobStep {
|
|
48
|
+
id: string;
|
|
49
|
+
jobInstanceId: string;
|
|
50
|
+
stepKind: CronStepKind;
|
|
51
|
+
status: CronStepStatus;
|
|
52
|
+
input: unknown;
|
|
53
|
+
output: unknown;
|
|
54
|
+
error: unknown;
|
|
55
|
+
startedAt: string | null;
|
|
56
|
+
finishedAt: string | null;
|
|
57
|
+
createdAt: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface CronHealthSnapshot {
|
|
61
|
+
enabled: boolean;
|
|
62
|
+
schedulerPollMs: number;
|
|
63
|
+
workerPollMs: number;
|
|
64
|
+
leaseMs: number;
|
|
65
|
+
jobs: {
|
|
66
|
+
total: number;
|
|
67
|
+
enabled: number;
|
|
68
|
+
};
|
|
69
|
+
instances: {
|
|
70
|
+
queued: number;
|
|
71
|
+
leased: number;
|
|
72
|
+
running: number;
|
|
73
|
+
completed: number;
|
|
74
|
+
failed: number;
|
|
75
|
+
dead: number;
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
export interface CronJobCreateInput {
|
|
80
|
+
id?: string;
|
|
81
|
+
name: string;
|
|
82
|
+
enabled?: boolean;
|
|
83
|
+
scheduleKind: CronScheduleKind;
|
|
84
|
+
scheduleExpr?: string | null;
|
|
85
|
+
everyMs?: number | null;
|
|
86
|
+
atIso?: string | null;
|
|
87
|
+
timezone?: string | null;
|
|
88
|
+
runMode: CronRunMode;
|
|
89
|
+
conditionModulePath?: string | null;
|
|
90
|
+
conditionDescription?: string | null;
|
|
91
|
+
agentPromptTemplate?: string | null;
|
|
92
|
+
agentModelOverride?: string | null;
|
|
93
|
+
maxAttempts?: number;
|
|
94
|
+
retryBackoffMs?: number;
|
|
95
|
+
payload?: Record<string, unknown>;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export interface CronJobPatchInput {
|
|
99
|
+
name?: string;
|
|
100
|
+
enabled?: boolean;
|
|
101
|
+
scheduleKind?: CronScheduleKind;
|
|
102
|
+
scheduleExpr?: string | null;
|
|
103
|
+
everyMs?: number | null;
|
|
104
|
+
atIso?: string | null;
|
|
105
|
+
timezone?: string | null;
|
|
106
|
+
runMode?: CronRunMode;
|
|
107
|
+
conditionModulePath?: string | null;
|
|
108
|
+
conditionDescription?: string | null;
|
|
109
|
+
agentPromptTemplate?: string | null;
|
|
110
|
+
agentModelOverride?: string | null;
|
|
111
|
+
maxAttempts?: number;
|
|
112
|
+
retryBackoffMs?: number;
|
|
113
|
+
payload?: Record<string, unknown>;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export interface CronHandlerContext {
|
|
117
|
+
nowMs: number;
|
|
118
|
+
payload: Record<string, unknown>;
|
|
119
|
+
job: CronJobDefinition;
|
|
120
|
+
instance: CronJobInstance;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
export interface CronHandlerResult {
|
|
124
|
+
status: "ok" | "error";
|
|
125
|
+
summary?: string;
|
|
126
|
+
data?: unknown;
|
|
127
|
+
invokeAgent?: {
|
|
128
|
+
shouldInvoke: boolean;
|
|
129
|
+
prompt?: string;
|
|
130
|
+
context?: Record<string, unknown>;
|
|
131
|
+
severity?: "info" | "warn" | "critical";
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export type CronHandler = (ctx: CronHandlerContext) => Promise<CronHandlerResult> | CronHandlerResult;
|
|
136
|
+
|
|
137
|
+
export interface CronConditionalModuleContext {
|
|
138
|
+
nowMs: number;
|
|
139
|
+
payload: Record<string, unknown>;
|
|
140
|
+
job: CronJobDefinition;
|
|
141
|
+
instance: CronJobInstance;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type CronConditionalModule = (
|
|
145
|
+
ctx: CronConditionalModuleContext,
|
|
146
|
+
) => Promise<CronHandlerResult> | CronHandlerResult;
|
|
@@ -0,0 +1,378 @@
|
|
|
1
|
+
export type ChatRole = "user" | "assistant";
|
|
2
|
+
|
|
3
|
+
export interface MemoryToolCallTrace {
|
|
4
|
+
tool: string;
|
|
5
|
+
status: "pending" | "running" | "completed" | "error";
|
|
6
|
+
summary?: string;
|
|
7
|
+
error?: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface MessageMemoryTrace {
|
|
11
|
+
mode: "hybrid" | "inject_only" | "tool_only";
|
|
12
|
+
injectedContextResults: number;
|
|
13
|
+
retrievedContextResults?: number;
|
|
14
|
+
suppressedAsAlreadyInContext?: number;
|
|
15
|
+
suppressedAsIrrelevant?: number;
|
|
16
|
+
toolCalls: MemoryToolCallTrace[];
|
|
17
|
+
createdAt: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export type ChatToolCallStatus = "pending" | "running" | "completed" | "error";
|
|
21
|
+
|
|
22
|
+
export interface ChatThinkingPart {
|
|
23
|
+
id: string;
|
|
24
|
+
type: "thinking";
|
|
25
|
+
text: string;
|
|
26
|
+
startedAt?: string;
|
|
27
|
+
endedAt?: string;
|
|
28
|
+
observedAt?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export interface ChatToolCallPart {
|
|
32
|
+
id: string;
|
|
33
|
+
type: "tool_call";
|
|
34
|
+
toolCallId: string;
|
|
35
|
+
tool: string;
|
|
36
|
+
status: ChatToolCallStatus;
|
|
37
|
+
input?: Record<string, unknown>;
|
|
38
|
+
output?: string;
|
|
39
|
+
error?: string;
|
|
40
|
+
startedAt?: string;
|
|
41
|
+
endedAt?: string;
|
|
42
|
+
observedAt?: string;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export type ChatMessagePart = ChatThinkingPart | ChatToolCallPart;
|
|
46
|
+
|
|
47
|
+
export interface ChatMessage {
|
|
48
|
+
id: string;
|
|
49
|
+
role: ChatRole;
|
|
50
|
+
content: string;
|
|
51
|
+
at: string;
|
|
52
|
+
memoryTrace?: MessageMemoryTrace;
|
|
53
|
+
parts?: ChatMessagePart[];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
export interface SessionMessageCheckpoint {
|
|
57
|
+
lastMessageAt: string;
|
|
58
|
+
lastMessageId: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
export interface SessionMessageCursor {
|
|
62
|
+
at: string;
|
|
63
|
+
role: ChatRole;
|
|
64
|
+
id: string;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export interface SessionMessageWindowMeta {
|
|
68
|
+
oldestLoaded: SessionMessageCursor | null;
|
|
69
|
+
newestLoaded: SessionMessageCursor | null;
|
|
70
|
+
hasOlder: boolean;
|
|
71
|
+
totalMessages: number;
|
|
72
|
+
isWindowed: boolean;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export interface SessionMessagesDeltaResponse {
|
|
76
|
+
messages: ChatMessage[];
|
|
77
|
+
checkpoint: SessionMessageCheckpoint | null;
|
|
78
|
+
requiresReset?: boolean;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
export interface SessionMessagesWindowResponse {
|
|
82
|
+
messages: ChatMessage[];
|
|
83
|
+
meta: SessionMessageWindowMeta;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
export interface SessionSummary {
|
|
87
|
+
id: string;
|
|
88
|
+
title: string;
|
|
89
|
+
model: string;
|
|
90
|
+
status: "active" | "idle";
|
|
91
|
+
lastActiveAt: string;
|
|
92
|
+
messageCount: number;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export interface ModelOption {
|
|
96
|
+
id: string;
|
|
97
|
+
label: string;
|
|
98
|
+
providerId: string;
|
|
99
|
+
modelId: string;
|
|
100
|
+
supportsImageInput?: boolean;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
export interface SpecialistAgent {
|
|
104
|
+
id: string;
|
|
105
|
+
name: string;
|
|
106
|
+
specialty: string;
|
|
107
|
+
summary: string;
|
|
108
|
+
model: string;
|
|
109
|
+
status: "available" | "busy" | "offline";
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
export interface AgentTypeDefinition {
|
|
113
|
+
id: string;
|
|
114
|
+
name?: string;
|
|
115
|
+
description?: string;
|
|
116
|
+
prompt?: string;
|
|
117
|
+
model?: string;
|
|
118
|
+
variant?: string;
|
|
119
|
+
mode: "subagent" | "primary" | "all";
|
|
120
|
+
hidden: boolean;
|
|
121
|
+
disable: boolean;
|
|
122
|
+
temperature?: number;
|
|
123
|
+
topP?: number;
|
|
124
|
+
steps?: number;
|
|
125
|
+
permission?: Record<string, unknown>;
|
|
126
|
+
options: Record<string, unknown>;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
export interface RuntimeSkill {
|
|
130
|
+
id: string;
|
|
131
|
+
name: string;
|
|
132
|
+
description: string;
|
|
133
|
+
location: string;
|
|
134
|
+
enabled: boolean;
|
|
135
|
+
managed: boolean;
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export interface RuntimeSkillIssue {
|
|
139
|
+
id?: string;
|
|
140
|
+
location: string;
|
|
141
|
+
reason: string;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export type RuntimeMcpStatus =
|
|
145
|
+
| "connected"
|
|
146
|
+
| "disabled"
|
|
147
|
+
| "failed"
|
|
148
|
+
| "needs_auth"
|
|
149
|
+
| "needs_client_registration"
|
|
150
|
+
| "unknown";
|
|
151
|
+
|
|
152
|
+
export interface RuntimeMcp {
|
|
153
|
+
id: string;
|
|
154
|
+
enabled: boolean;
|
|
155
|
+
status: RuntimeMcpStatus;
|
|
156
|
+
error?: string;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
export interface RuntimeAgent {
|
|
160
|
+
id: string;
|
|
161
|
+
mode: "subagent" | "primary" | "all";
|
|
162
|
+
description?: string;
|
|
163
|
+
model?: string;
|
|
164
|
+
native: boolean;
|
|
165
|
+
hidden: boolean;
|
|
166
|
+
enabled: boolean;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
export type ConfiguredMcpServer =
|
|
170
|
+
| {
|
|
171
|
+
id: string;
|
|
172
|
+
type: "remote";
|
|
173
|
+
enabled: boolean;
|
|
174
|
+
url: string;
|
|
175
|
+
headers: Record<string, string>;
|
|
176
|
+
oauth: "auto" | "off";
|
|
177
|
+
timeoutMs?: number;
|
|
178
|
+
}
|
|
179
|
+
| {
|
|
180
|
+
id: string;
|
|
181
|
+
type: "local";
|
|
182
|
+
enabled: boolean;
|
|
183
|
+
command: string[];
|
|
184
|
+
environment: Record<string, string>;
|
|
185
|
+
timeoutMs?: number;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export interface UsageSnapshot {
|
|
189
|
+
requestCount: number;
|
|
190
|
+
inputTokens: number;
|
|
191
|
+
outputTokens: number;
|
|
192
|
+
estimatedCostUsd: number;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface SessionRunStatusSnapshot {
|
|
196
|
+
sessionId: string;
|
|
197
|
+
status: "idle" | "busy" | "retry";
|
|
198
|
+
attempt?: number;
|
|
199
|
+
message?: string;
|
|
200
|
+
nextAt?: string;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export interface SessionCompactedSnapshot {
|
|
204
|
+
sessionId: string;
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
export interface SessionRunErrorSnapshot {
|
|
208
|
+
sessionId: string | null;
|
|
209
|
+
name?: string;
|
|
210
|
+
message: string;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
export interface PermissionPromptRequest {
|
|
214
|
+
id: string;
|
|
215
|
+
sessionId: string;
|
|
216
|
+
permission: string;
|
|
217
|
+
patterns: string[];
|
|
218
|
+
metadata: Record<string, unknown>;
|
|
219
|
+
always: string[];
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
export interface PermissionPromptResolved {
|
|
223
|
+
sessionId: string;
|
|
224
|
+
requestId: string;
|
|
225
|
+
reply: "once" | "always" | "reject";
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export interface QuestionPromptOption {
|
|
229
|
+
label: string;
|
|
230
|
+
description: string;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export interface QuestionPromptInfo {
|
|
234
|
+
question: string;
|
|
235
|
+
header: string;
|
|
236
|
+
options: QuestionPromptOption[];
|
|
237
|
+
multiple?: boolean;
|
|
238
|
+
custom?: boolean;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export interface QuestionPromptRequest {
|
|
242
|
+
id: string;
|
|
243
|
+
sessionId: string;
|
|
244
|
+
questions: QuestionPromptInfo[];
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
export interface QuestionPromptResolved {
|
|
248
|
+
sessionId: string;
|
|
249
|
+
requestId: string;
|
|
250
|
+
outcome: "replied" | "rejected";
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
export interface SessionMessageDeltaSnapshot {
|
|
254
|
+
sessionId: string;
|
|
255
|
+
messageId: string;
|
|
256
|
+
text: string;
|
|
257
|
+
mode: "append" | "replace";
|
|
258
|
+
observedAt: string;
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
export interface BackgroundRunSnapshot {
|
|
262
|
+
runId: string;
|
|
263
|
+
parentSessionId: string;
|
|
264
|
+
parentExternalSessionId: string;
|
|
265
|
+
childExternalSessionId: string;
|
|
266
|
+
childSessionId: string | null;
|
|
267
|
+
requestedBy: string;
|
|
268
|
+
prompt: string;
|
|
269
|
+
status: "created" | "running" | "retrying" | "idle" | "completed" | "failed" | "aborted";
|
|
270
|
+
resultSummary: string | null;
|
|
271
|
+
error: string | null;
|
|
272
|
+
createdAt: string;
|
|
273
|
+
updatedAt: string;
|
|
274
|
+
startedAt: string | null;
|
|
275
|
+
completedAt: string | null;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
export type SessionMessagePartPhase = "start" | "update" | "final";
|
|
279
|
+
|
|
280
|
+
export interface HeartbeatSnapshot {
|
|
281
|
+
online: boolean;
|
|
282
|
+
at: string;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export interface MemoryStatusSnapshot {
|
|
286
|
+
enabled: boolean;
|
|
287
|
+
workspaceDir: string;
|
|
288
|
+
provider: string;
|
|
289
|
+
model: string;
|
|
290
|
+
toolMode: "hybrid" | "inject_only" | "tool_only";
|
|
291
|
+
files: number;
|
|
292
|
+
chunks: number;
|
|
293
|
+
records: number;
|
|
294
|
+
cacheEntries: number;
|
|
295
|
+
indexedAt: string | null;
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface MemoryWriteEvent {
|
|
299
|
+
id: string;
|
|
300
|
+
status: "accepted" | "rejected";
|
|
301
|
+
reason: string;
|
|
302
|
+
source: "user" | "assistant" | "system";
|
|
303
|
+
content: string;
|
|
304
|
+
confidence: number;
|
|
305
|
+
sessionId: string | null;
|
|
306
|
+
topic: string | null;
|
|
307
|
+
recordId: string | null;
|
|
308
|
+
path: string | null;
|
|
309
|
+
createdAt: string;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export interface DashboardBootstrap {
|
|
313
|
+
sessions: SessionSummary[];
|
|
314
|
+
skills: string[];
|
|
315
|
+
mcps: string[];
|
|
316
|
+
agents: SpecialistAgent[];
|
|
317
|
+
usage: UsageSnapshot;
|
|
318
|
+
heartbeat: HeartbeatSnapshot;
|
|
319
|
+
}
|
|
320
|
+
|
|
321
|
+
export interface SessionScreenBootstrapResponse {
|
|
322
|
+
sessions: SessionSummary[];
|
|
323
|
+
activeSessionId: string;
|
|
324
|
+
activeSession: SessionSummary | null;
|
|
325
|
+
messages: ChatMessage[];
|
|
326
|
+
messagesMeta?: SessionMessageWindowMeta;
|
|
327
|
+
usage: UsageSnapshot;
|
|
328
|
+
heartbeat: HeartbeatSnapshot;
|
|
329
|
+
models: ModelOption[];
|
|
330
|
+
backgroundRuns: BackgroundRunSnapshot[];
|
|
331
|
+
pendingPermissions?: PermissionPromptRequest[];
|
|
332
|
+
pendingQuestions?: QuestionPromptRequest[];
|
|
333
|
+
workspaceBootstrap?: {
|
|
334
|
+
mode?: string;
|
|
335
|
+
identity?: {
|
|
336
|
+
name?: string;
|
|
337
|
+
emoji?: string;
|
|
338
|
+
theme?: string;
|
|
339
|
+
creature?: string;
|
|
340
|
+
vibe?: string;
|
|
341
|
+
avatar?: string;
|
|
342
|
+
};
|
|
343
|
+
files?: Array<{
|
|
344
|
+
name: string;
|
|
345
|
+
missing: boolean;
|
|
346
|
+
truncated: boolean;
|
|
347
|
+
}>;
|
|
348
|
+
};
|
|
349
|
+
featureFlags?: {
|
|
350
|
+
reviewEnabled?: boolean;
|
|
351
|
+
};
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export type DashboardEvent =
|
|
355
|
+
| { event: "heartbeat"; payload: HeartbeatSnapshot }
|
|
356
|
+
| { event: "usage"; payload: UsageSnapshot }
|
|
357
|
+
| { event: "session-updated"; payload: SessionSummary }
|
|
358
|
+
| { event: "session-message"; payload: { sessionId: string; message: ChatMessage } }
|
|
359
|
+
| {
|
|
360
|
+
event: "session-message-part";
|
|
361
|
+
payload: {
|
|
362
|
+
sessionId: string;
|
|
363
|
+
messageId: string;
|
|
364
|
+
part: ChatMessagePart;
|
|
365
|
+
phase: SessionMessagePartPhase;
|
|
366
|
+
observedAt: string;
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
| { event: "session-message-delta"; payload: SessionMessageDeltaSnapshot }
|
|
370
|
+
| { event: "session-status"; payload: SessionRunStatusSnapshot }
|
|
371
|
+
| { event: "session-compacted"; payload: SessionCompactedSnapshot }
|
|
372
|
+
| { event: "session-error"; payload: SessionRunErrorSnapshot }
|
|
373
|
+
| { event: "permission-requested"; payload: PermissionPromptRequest }
|
|
374
|
+
| { event: "permission-resolved"; payload: PermissionPromptResolved }
|
|
375
|
+
| { event: "question-requested"; payload: QuestionPromptRequest }
|
|
376
|
+
| { event: "question-resolved"; payload: QuestionPromptResolved }
|
|
377
|
+
| { event: "background-run"; payload: BackgroundRunSnapshot }
|
|
378
|
+
| { event: "skills-catalog-updated"; payload: { revision: string } };
|