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,113 @@
|
|
|
1
|
+
import { sql } from "drizzle-orm";
|
|
2
|
+
import { index, integer, primaryKey, sqliteTable, text } from "drizzle-orm/sqlite-core";
|
|
3
|
+
|
|
4
|
+
const nowMs = sql`(strftime('%s', 'now') * 1000)`;
|
|
5
|
+
|
|
6
|
+
export const sessions = sqliteTable(
|
|
7
|
+
"sessions",
|
|
8
|
+
{
|
|
9
|
+
id: text("id").primaryKey(),
|
|
10
|
+
title: text("title").notNull(),
|
|
11
|
+
model: text("model").notNull(),
|
|
12
|
+
status: text("status", { enum: ["active", "idle"] }).notNull().default("idle"),
|
|
13
|
+
messageCount: integer("message_count").notNull().default(0),
|
|
14
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
15
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
16
|
+
lastActiveAt: integer("last_active_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
17
|
+
},
|
|
18
|
+
table => [index("sessions_last_active_idx").on(table.lastActiveAt)],
|
|
19
|
+
);
|
|
20
|
+
|
|
21
|
+
export const messages = sqliteTable(
|
|
22
|
+
"messages",
|
|
23
|
+
{
|
|
24
|
+
id: text("id").primaryKey(),
|
|
25
|
+
sessionId: text("session_id")
|
|
26
|
+
.notNull()
|
|
27
|
+
.references(() => sessions.id, { onDelete: "cascade" }),
|
|
28
|
+
role: text("role", { enum: ["user", "assistant"] }).notNull(),
|
|
29
|
+
content: text("content").notNull(),
|
|
30
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
31
|
+
},
|
|
32
|
+
table => [index("messages_session_created_idx").on(table.sessionId, table.createdAt)],
|
|
33
|
+
);
|
|
34
|
+
|
|
35
|
+
export const usageEvents = sqliteTable(
|
|
36
|
+
"usage_events",
|
|
37
|
+
{
|
|
38
|
+
id: text("id").primaryKey(),
|
|
39
|
+
sessionId: text("session_id").references(() => sessions.id, { onDelete: "set null" }),
|
|
40
|
+
providerId: text("provider_id"),
|
|
41
|
+
modelId: text("model_id"),
|
|
42
|
+
requestCountDelta: integer("request_count_delta").notNull().default(0),
|
|
43
|
+
inputTokensDelta: integer("input_tokens_delta").notNull().default(0),
|
|
44
|
+
outputTokensDelta: integer("output_tokens_delta").notNull().default(0),
|
|
45
|
+
estimatedCostUsdDelta: integer("estimated_cost_usd_delta_micros").notNull().default(0),
|
|
46
|
+
source: text("source", { enum: ["api", "runtime", "scheduler", "system"] }).notNull().default("system"),
|
|
47
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
48
|
+
},
|
|
49
|
+
table => [
|
|
50
|
+
index("usage_events_created_idx").on(table.createdAt),
|
|
51
|
+
index("usage_events_provider_created_idx").on(table.providerId, table.createdAt),
|
|
52
|
+
index("usage_events_provider_model_created_idx").on(table.providerId, table.modelId, table.createdAt),
|
|
53
|
+
],
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
export const heartbeatEvents = sqliteTable(
|
|
57
|
+
"heartbeat_events",
|
|
58
|
+
{
|
|
59
|
+
id: text("id").primaryKey(),
|
|
60
|
+
online: integer("online", { mode: "boolean" }).notNull().default(true),
|
|
61
|
+
source: text("source", { enum: ["api", "runtime", "scheduler", "system"] }).notNull().default("system"),
|
|
62
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
63
|
+
},
|
|
64
|
+
table => [index("heartbeat_events_created_idx").on(table.createdAt)],
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
export const runtimeConfig = sqliteTable("runtime_config", {
|
|
68
|
+
key: text("key").primaryKey(),
|
|
69
|
+
valueJson: text("value_json").notNull(),
|
|
70
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
export const runtimeSessionBindings = sqliteTable(
|
|
74
|
+
"runtime_session_bindings",
|
|
75
|
+
{
|
|
76
|
+
runtime: text("runtime").notNull(),
|
|
77
|
+
sessionId: text("session_id").notNull(),
|
|
78
|
+
externalSessionId: text("external_session_id").notNull(),
|
|
79
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
80
|
+
},
|
|
81
|
+
table => [
|
|
82
|
+
primaryKey({ columns: [table.runtime, table.sessionId] }),
|
|
83
|
+
index("runtime_session_bindings_external_idx").on(table.runtime, table.externalSessionId),
|
|
84
|
+
index("runtime_session_bindings_updated_idx").on(table.updatedAt),
|
|
85
|
+
],
|
|
86
|
+
);
|
|
87
|
+
|
|
88
|
+
export const backgroundRuns = sqliteTable(
|
|
89
|
+
"background_runs",
|
|
90
|
+
{
|
|
91
|
+
id: text("id").primaryKey(),
|
|
92
|
+
runtime: text("runtime").notNull(),
|
|
93
|
+
parentSessionId: text("parent_session_id")
|
|
94
|
+
.notNull()
|
|
95
|
+
.references(() => sessions.id, { onDelete: "cascade" }),
|
|
96
|
+
parentExternalSessionId: text("parent_external_session_id").notNull(),
|
|
97
|
+
childExternalSessionId: text("child_external_session_id").notNull(),
|
|
98
|
+
requestedBy: text("requested_by").notNull().default("system"),
|
|
99
|
+
prompt: text("prompt").notNull().default(""),
|
|
100
|
+
status: text("status").notNull().default("created"),
|
|
101
|
+
resultSummary: text("result_summary"),
|
|
102
|
+
error: text("error"),
|
|
103
|
+
createdAt: integer("created_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
104
|
+
updatedAt: integer("updated_at", { mode: "timestamp_ms" }).notNull().default(nowMs),
|
|
105
|
+
startedAt: integer("started_at", { mode: "timestamp_ms" }),
|
|
106
|
+
completedAt: integer("completed_at", { mode: "timestamp_ms" }),
|
|
107
|
+
},
|
|
108
|
+
table => [
|
|
109
|
+
index("background_runs_child_external_idx").on(table.runtime, table.childExternalSessionId),
|
|
110
|
+
index("background_runs_parent_created_idx").on(table.parentSessionId, table.createdAt),
|
|
111
|
+
index("background_runs_status_updated_idx").on(table.status, table.updatedAt),
|
|
112
|
+
],
|
|
113
|
+
);
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { afterAll, beforeAll, beforeEach, describe, expect, test } from "bun:test";
|
|
2
|
+
import { mkdtempSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
|
|
6
|
+
import type * as RepositoryModuleType from "./repository";
|
|
7
|
+
|
|
8
|
+
const testRoot = mkdtempSync(path.join(tmpdir(), "agent-mockingbird-usage-db-test-"));
|
|
9
|
+
const testDbPath = path.join(testRoot, "agent-mockingbird.usage-dashboard.test.db");
|
|
10
|
+
const testConfigPath = path.join(testRoot, "agent-mockingbird.usage-dashboard.config.json");
|
|
11
|
+
const testWorkspacePath = path.join(testRoot, "workspace");
|
|
12
|
+
|
|
13
|
+
process.env.NODE_ENV = "test";
|
|
14
|
+
process.env.AGENT_MOCKINGBIRD_DB_PATH = testDbPath;
|
|
15
|
+
process.env.AGENT_MOCKINGBIRD_CONFIG_PATH = testConfigPath;
|
|
16
|
+
process.env.AGENT_MOCKINGBIRD_MEMORY_WORKSPACE_DIR = testWorkspacePath;
|
|
17
|
+
process.env.AGENT_MOCKINGBIRD_MEMORY_EMBED_PROVIDER = "none";
|
|
18
|
+
|
|
19
|
+
type RepositoryModule = typeof RepositoryModuleType;
|
|
20
|
+
|
|
21
|
+
let repository: RepositoryModule;
|
|
22
|
+
|
|
23
|
+
beforeAll(async () => {
|
|
24
|
+
await import("./migrate");
|
|
25
|
+
repository = await import("./repository");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
repository.resetDatabaseToDefaults();
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
afterAll(() => {
|
|
33
|
+
rmSync(testRoot, { recursive: true, force: true });
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("usage dashboard repository", () => {
|
|
37
|
+
test("groups attributed usage by provider and model for the selected date range", () => {
|
|
38
|
+
const now = Date.now();
|
|
39
|
+
const session = repository.createSession({
|
|
40
|
+
title: "Usage Session",
|
|
41
|
+
model: "anthropic/claude-sonnet-4.5",
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
repository.recordUsageDelta({
|
|
45
|
+
sessionId: session.id,
|
|
46
|
+
requestCountDelta: 1,
|
|
47
|
+
inputTokensDelta: 120,
|
|
48
|
+
outputTokensDelta: 80,
|
|
49
|
+
estimatedCostUsdDelta: 0.42,
|
|
50
|
+
source: "runtime",
|
|
51
|
+
createdAt: now - 2 * 60 * 60 * 1000,
|
|
52
|
+
});
|
|
53
|
+
repository.recordUsageDelta({
|
|
54
|
+
requestCountDelta: 1,
|
|
55
|
+
inputTokensDelta: 40,
|
|
56
|
+
outputTokensDelta: 10,
|
|
57
|
+
estimatedCostUsdDelta: 0.08,
|
|
58
|
+
source: "system",
|
|
59
|
+
createdAt: now - 60 * 60 * 1000,
|
|
60
|
+
});
|
|
61
|
+
repository.recordUsageDelta({
|
|
62
|
+
providerId: "openai",
|
|
63
|
+
modelId: "gpt-5.4",
|
|
64
|
+
requestCountDelta: 1,
|
|
65
|
+
inputTokensDelta: 500,
|
|
66
|
+
outputTokensDelta: 400,
|
|
67
|
+
estimatedCostUsdDelta: 1.5,
|
|
68
|
+
source: "runtime",
|
|
69
|
+
createdAt: now - 10 * 24 * 60 * 60 * 1000,
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
const recentRange = repository.getUsageDashboardSnapshot({
|
|
73
|
+
startAt: now - 24 * 60 * 60 * 1000,
|
|
74
|
+
endAtExclusive: now + 1,
|
|
75
|
+
});
|
|
76
|
+
expect(recentRange.totals.requestCount).toBe(2);
|
|
77
|
+
expect(recentRange.totals.totalTokens).toBe(250);
|
|
78
|
+
expect(recentRange.unattributedTotals.totalTokens).toBe(50);
|
|
79
|
+
expect(recentRange.providers).toHaveLength(1);
|
|
80
|
+
expect(recentRange.providers[0]).toMatchObject({
|
|
81
|
+
providerId: "anthropic",
|
|
82
|
+
totalTokens: 200,
|
|
83
|
+
});
|
|
84
|
+
expect(recentRange.models).toHaveLength(1);
|
|
85
|
+
expect(recentRange.models[0]).toMatchObject({
|
|
86
|
+
providerId: "anthropic",
|
|
87
|
+
modelId: "claude-sonnet-4.5",
|
|
88
|
+
totalTokens: 200,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const fullRange = repository.getUsageDashboardSnapshot({
|
|
92
|
+
startAt: now - 30 * 24 * 60 * 60 * 1000,
|
|
93
|
+
endAtExclusive: now + 1,
|
|
94
|
+
});
|
|
95
|
+
expect(fullRange.totals.requestCount).toBe(3);
|
|
96
|
+
expect(fullRange.providers.map(row => row.providerId)).toEqual(["openai", "anthropic"]);
|
|
97
|
+
expect(fullRange.models.map(row => `${row.providerId}/${row.modelId}`)).toEqual([
|
|
98
|
+
"openai/gpt-5.4",
|
|
99
|
+
"anthropic/claude-sonnet-4.5",
|
|
100
|
+
]);
|
|
101
|
+
});
|
|
102
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { resolvedDbPath } from "./client";
|
|
2
|
+
import { resetDatabaseToDefaults } from "./repository";
|
|
3
|
+
|
|
4
|
+
const bootstrap = resetDatabaseToDefaults();
|
|
5
|
+
|
|
6
|
+
console.log("Database reset complete.");
|
|
7
|
+
console.log(`Target database: ${resolvedDbPath}`);
|
|
8
|
+
console.log(
|
|
9
|
+
`Sessions: ${bootstrap.sessions.map(session => `${session.id} (${session.title})`).join(", ") || "none"}`,
|
|
10
|
+
);
|
|
11
|
+
console.log(`Skills: ${bootstrap.skills.length}`);
|
|
12
|
+
console.log(`MCP servers: ${bootstrap.mcps.length}`);
|
|
13
|
+
console.log(`Agents: ${bootstrap.agents.length}`);
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type { SpecialistAgent } from "@agent-mockingbird/contracts/dashboard";
|
|
2
|
+
|
|
3
|
+
import type { AgentTypeDefinition } from "./config/schema";
|
|
4
|
+
|
|
5
|
+
export const DEFAULT_SKILLS: string[] = [
|
|
6
|
+
"config-editor",
|
|
7
|
+
"config-auditor",
|
|
8
|
+
"runtime-diagnose",
|
|
9
|
+
];
|
|
10
|
+
|
|
11
|
+
export const DEFAULT_MCPS: string[] = [];
|
|
12
|
+
|
|
13
|
+
export const DEFAULT_AGENTS: SpecialistAgent[] = [];
|
|
14
|
+
export const DEFAULT_AGENT_TYPES: AgentTypeDefinition[] = [
|
|
15
|
+
{
|
|
16
|
+
id: "build",
|
|
17
|
+
name: "Agent Mockingbird",
|
|
18
|
+
description: "Default primary agent.",
|
|
19
|
+
mode: "primary",
|
|
20
|
+
hidden: false,
|
|
21
|
+
disable: false,
|
|
22
|
+
options: {},
|
|
23
|
+
},
|
|
24
|
+
];
|
|
25
|
+
|
|
26
|
+
export const DEFAULT_SESSIONS = [
|
|
27
|
+
{
|
|
28
|
+
id: "main",
|
|
29
|
+
title: "Main",
|
|
30
|
+
model: "claude-sonnet-4.5",
|
|
31
|
+
},
|
|
32
|
+
];
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { createEnv } from "@t3-oss/env-core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
const envSchema = {
|
|
5
|
+
NODE_ENV: z.enum(["development", "test", "production"]).default("development"),
|
|
6
|
+
AGENT_MOCKINGBIRD_DB_PATH: z.string().optional(),
|
|
7
|
+
AGENT_MOCKINGBIRD_CONFIG_PATH: z.string().optional(),
|
|
8
|
+
AGENT_MOCKINGBIRD_OPENCODE_BASE_URL: z.string().url().optional(),
|
|
9
|
+
AGENT_MOCKINGBIRD_OPENCODE_AUTH_HEADER: z.string().optional(),
|
|
10
|
+
AGENT_MOCKINGBIRD_OPENCODE_USERNAME: z.string().optional(),
|
|
11
|
+
AGENT_MOCKINGBIRD_OPENCODE_PASSWORD: z.string().optional(),
|
|
12
|
+
AGENT_MOCKINGBIRD_EXPO_PUSH_API_URL: z.string().url().default("https://exp.host/--/api/v2/push/send"),
|
|
13
|
+
AGENT_MOCKINGBIRD_CRON_ENABLED: z.coerce.boolean().default(true),
|
|
14
|
+
AGENT_MOCKINGBIRD_CRON_SCHEDULER_POLL_MS: z.coerce.number().int().min(250).default(1_000),
|
|
15
|
+
AGENT_MOCKINGBIRD_CRON_WORKER_POLL_MS: z.coerce.number().int().min(250).default(1_000),
|
|
16
|
+
AGENT_MOCKINGBIRD_CRON_LEASE_MS: z.coerce.number().int().min(1_000).default(30_000),
|
|
17
|
+
AGENT_MOCKINGBIRD_CRON_MAX_ENQUEUE_PER_JOB_TICK: z.coerce.number().int().min(1).max(1_000).default(25),
|
|
18
|
+
AGENT_MOCKINGBIRD_MEMORY_ENABLED: z.coerce.boolean().default(true),
|
|
19
|
+
AGENT_MOCKINGBIRD_MEMORY_WORKSPACE_DIR: z.string().default("./data/workspace"),
|
|
20
|
+
AGENT_MOCKINGBIRD_MEMORY_EMBED_PROVIDER: z.enum(["ollama", "none"]).default("ollama"),
|
|
21
|
+
AGENT_MOCKINGBIRD_MEMORY_EMBED_MODEL: z.string().min(1).default("granite-embedding:278m"),
|
|
22
|
+
AGENT_MOCKINGBIRD_MEMORY_OLLAMA_BASE_URL: z.string().url().default("http://127.0.0.1:11434"),
|
|
23
|
+
AGENT_MOCKINGBIRD_MEMORY_CHUNK_TOKENS: z.coerce.number().int().positive().default(400),
|
|
24
|
+
AGENT_MOCKINGBIRD_MEMORY_CHUNK_OVERLAP: z.coerce.number().int().min(0).default(80),
|
|
25
|
+
AGENT_MOCKINGBIRD_MEMORY_MAX_RESULTS: z.coerce.number().int().positive().default(4),
|
|
26
|
+
AGENT_MOCKINGBIRD_MEMORY_MIN_SCORE: z.coerce.number().min(0).max(1).default(0.35),
|
|
27
|
+
AGENT_MOCKINGBIRD_MEMORY_SYNC_COOLDOWN_MS: z.coerce.number().int().min(0).default(10_000),
|
|
28
|
+
AGENT_MOCKINGBIRD_MEMORY_TOOL_MODE: z.enum(["hybrid", "inject_only", "tool_only"]).default("tool_only"),
|
|
29
|
+
AGENT_MOCKINGBIRD_MEMORY_INJECTION_DEDUPE_ENABLED: z.coerce.boolean().default(true),
|
|
30
|
+
AGENT_MOCKINGBIRD_MEMORY_INJECTION_DEDUPE_FALLBACK_RECALL_ONLY: z.coerce.boolean().default(true),
|
|
31
|
+
AGENT_MOCKINGBIRD_MEMORY_INJECTION_DEDUPE_MAX_TRACKED: z.coerce.number().int().min(32).max(10_000).default(256),
|
|
32
|
+
} satisfies Record<string, z.ZodTypeAny>;
|
|
33
|
+
|
|
34
|
+
function loadEnv() {
|
|
35
|
+
return createEnv({
|
|
36
|
+
server: envSchema,
|
|
37
|
+
runtimeEnv: process.env,
|
|
38
|
+
emptyStringAsUndefined: true,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type AppEnv = ReturnType<typeof loadEnv>;
|
|
43
|
+
|
|
44
|
+
export const env = new Proxy({} as AppEnv, {
|
|
45
|
+
get(_target, property) {
|
|
46
|
+
return loadEnv()[property as keyof AppEnv];
|
|
47
|
+
},
|
|
48
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import type { HeartbeatConfig } from "./types";
|
|
2
|
+
|
|
3
|
+
export function isActiveHours(config: HeartbeatConfig): boolean {
|
|
4
|
+
if (!config.activeHours) return true;
|
|
5
|
+
|
|
6
|
+
const { start, end, timezone } = config.activeHours;
|
|
7
|
+
|
|
8
|
+
const now = new Date();
|
|
9
|
+
|
|
10
|
+
const formatter = new Intl.DateTimeFormat("en-CA", {
|
|
11
|
+
timeZone: timezone,
|
|
12
|
+
hour: "numeric",
|
|
13
|
+
minute: "numeric",
|
|
14
|
+
hour12: false,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const parts = formatter.formatToParts(now);
|
|
18
|
+
let hour = 0;
|
|
19
|
+
let minute = 0;
|
|
20
|
+
|
|
21
|
+
for (const part of parts) {
|
|
22
|
+
if (part.type === "hour") {
|
|
23
|
+
hour = parseInt(part.value, 10);
|
|
24
|
+
} else if (part.type === "minute") {
|
|
25
|
+
minute = parseInt(part.value, 10);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const startParts = start.split(":").map(Number);
|
|
30
|
+
const endParts = end.split(":").map(Number);
|
|
31
|
+
const startH = startParts[0] ?? 0;
|
|
32
|
+
const startM = startParts[1] ?? 0;
|
|
33
|
+
const endH = endParts[0] ?? 0;
|
|
34
|
+
const endM = endParts[1] ?? 0;
|
|
35
|
+
|
|
36
|
+
const startMinutes = startH * 60 + startM;
|
|
37
|
+
const endMinutes = endH * 60 + endM;
|
|
38
|
+
const nowMinutes = hour * 60 + minute;
|
|
39
|
+
|
|
40
|
+
if (startMinutes <= endMinutes) {
|
|
41
|
+
return nowMinutes >= startMinutes && nowMinutes <= endMinutes;
|
|
42
|
+
} else {
|
|
43
|
+
return nowMinutes >= startMinutes || nowMinutes <= endMinutes;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { DEFAULT_HEARTBEAT_PROMPT, parseInterval } from "./service";
|
|
2
|
+
import { ensureCronTables } from "../cron/storage";
|
|
3
|
+
import { sqlite } from "../db/client";
|
|
4
|
+
import { DEFAULT_AGENT_TYPES } from "../defaults";
|
|
5
|
+
|
|
6
|
+
export const HEARTBEAT_SYSTEM_JOB_ID = "heartbeat-system";
|
|
7
|
+
const HEARTBEAT_SYSTEM_JOB_NAME = "Heartbeat";
|
|
8
|
+
const DEFAULT_HEARTBEAT_INTERVAL = "30m";
|
|
9
|
+
|
|
10
|
+
function resolveDefaultHeartbeatAgentId() {
|
|
11
|
+
return (
|
|
12
|
+
DEFAULT_AGENT_TYPES.find(agent => agent.mode === "primary" && !agent.disable)?.id ??
|
|
13
|
+
DEFAULT_AGENT_TYPES[0]?.id ??
|
|
14
|
+
"build"
|
|
15
|
+
);
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
function buildDefaultHeartbeatPayload() {
|
|
19
|
+
return {
|
|
20
|
+
agentId: resolveDefaultHeartbeatAgentId(),
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function seedDefaultHeartbeatJob(createdAt: number) {
|
|
25
|
+
ensureCronTables();
|
|
26
|
+
sqlite
|
|
27
|
+
.query(
|
|
28
|
+
`
|
|
29
|
+
INSERT INTO cron_job_definitions (
|
|
30
|
+
id, name, thread_session_id, enabled, schedule_kind, schedule_expr, every_ms, at_iso, timezone,
|
|
31
|
+
run_mode, handler_key, condition_module_path, condition_description, agent_prompt_template, agent_model_override,
|
|
32
|
+
max_attempts, retry_backoff_ms, payload_json, last_enqueued_for, created_at, updated_at
|
|
33
|
+
)
|
|
34
|
+
VALUES (?1, ?2, NULL, 1, 'every', NULL, ?3, NULL, NULL, 'agent', NULL, NULL, NULL, ?4, NULL, ?5, ?6, ?7, NULL, ?8, ?8)
|
|
35
|
+
ON CONFLICT(id) DO UPDATE SET
|
|
36
|
+
name = excluded.name,
|
|
37
|
+
enabled = excluded.enabled,
|
|
38
|
+
schedule_kind = excluded.schedule_kind,
|
|
39
|
+
schedule_expr = excluded.schedule_expr,
|
|
40
|
+
every_ms = excluded.every_ms,
|
|
41
|
+
at_iso = excluded.at_iso,
|
|
42
|
+
timezone = excluded.timezone,
|
|
43
|
+
run_mode = excluded.run_mode,
|
|
44
|
+
handler_key = excluded.handler_key,
|
|
45
|
+
condition_module_path = excluded.condition_module_path,
|
|
46
|
+
condition_description = excluded.condition_description,
|
|
47
|
+
agent_prompt_template = excluded.agent_prompt_template,
|
|
48
|
+
agent_model_override = excluded.agent_model_override,
|
|
49
|
+
max_attempts = excluded.max_attempts,
|
|
50
|
+
retry_backoff_ms = excluded.retry_backoff_ms,
|
|
51
|
+
payload_json = excluded.payload_json,
|
|
52
|
+
updated_at = excluded.updated_at
|
|
53
|
+
`,
|
|
54
|
+
)
|
|
55
|
+
.run(
|
|
56
|
+
HEARTBEAT_SYSTEM_JOB_ID,
|
|
57
|
+
HEARTBEAT_SYSTEM_JOB_NAME,
|
|
58
|
+
parseInterval(DEFAULT_HEARTBEAT_INTERVAL),
|
|
59
|
+
DEFAULT_HEARTBEAT_PROMPT,
|
|
60
|
+
3,
|
|
61
|
+
30_000,
|
|
62
|
+
JSON.stringify(buildDefaultHeartbeatPayload()),
|
|
63
|
+
createdAt,
|
|
64
|
+
);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
export function deleteLegacyHeartbeatJobs() {
|
|
68
|
+
ensureCronTables();
|
|
69
|
+
sqlite
|
|
70
|
+
.query(
|
|
71
|
+
`
|
|
72
|
+
DELETE FROM cron_job_instances
|
|
73
|
+
WHERE job_definition_id = ?1
|
|
74
|
+
OR job_definition_id LIKE 'heartbeat-%'
|
|
75
|
+
`,
|
|
76
|
+
)
|
|
77
|
+
.run(HEARTBEAT_SYSTEM_JOB_ID);
|
|
78
|
+
const deleted = sqlite
|
|
79
|
+
.query(
|
|
80
|
+
`
|
|
81
|
+
DELETE FROM cron_job_definitions
|
|
82
|
+
WHERE id = ?1
|
|
83
|
+
OR id LIKE 'heartbeat-%'
|
|
84
|
+
`,
|
|
85
|
+
)
|
|
86
|
+
.run(HEARTBEAT_SYSTEM_JOB_ID).changes;
|
|
87
|
+
return deleted;
|
|
88
|
+
}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
|
|
3
|
+
import { isActiveHours } from "./activeHours";
|
|
4
|
+
import { deleteLegacyHeartbeatJobs, HEARTBEAT_SYSTEM_JOB_ID, seedDefaultHeartbeatJob } from "./defaultJob";
|
|
5
|
+
import { parseInterval } from "./service";
|
|
6
|
+
import type { HeartbeatConfig } from "./types";
|
|
7
|
+
import { clearCronTables } from "../cron/storage";
|
|
8
|
+
import { sqlite } from "../db/client";
|
|
9
|
+
|
|
10
|
+
describe("parseInterval", () => {
|
|
11
|
+
test("parses minutes", () => {
|
|
12
|
+
expect(parseInterval("30m")).toBe(30 * 60 * 1000);
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
test("parses hours", () => {
|
|
16
|
+
expect(parseInterval("1h")).toBe(60 * 60 * 1000);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
test("parses days", () => {
|
|
20
|
+
expect(parseInterval("1d")).toBe(24 * 60 * 60 * 1000);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
test("parses zero minutes", () => {
|
|
24
|
+
expect(parseInterval("0m")).toBe(0);
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
test("rejects invalid format", () => {
|
|
28
|
+
expect(() => parseInterval("invalid")).toThrow();
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
test("rejects missing unit", () => {
|
|
32
|
+
expect(() => parseInterval("30")).toThrow();
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
describe("isActiveHours", () => {
|
|
37
|
+
test("returns true if no active hours config", () => {
|
|
38
|
+
const config: HeartbeatConfig = {
|
|
39
|
+
enabled: true,
|
|
40
|
+
interval: "30m",
|
|
41
|
+
prompt: "heartbeat",
|
|
42
|
+
ackMaxChars: 300,
|
|
43
|
+
};
|
|
44
|
+
expect(isActiveHours(config)).toBe(true);
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
test("returns true for always-on config (00:00-23:59)", () => {
|
|
48
|
+
const config: HeartbeatConfig = {
|
|
49
|
+
enabled: true,
|
|
50
|
+
interval: "30m",
|
|
51
|
+
prompt: "heartbeat",
|
|
52
|
+
ackMaxChars: 300,
|
|
53
|
+
activeHours: {
|
|
54
|
+
start: "00:00",
|
|
55
|
+
end: "23:59",
|
|
56
|
+
timezone: "UTC",
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
expect(isActiveHours(config)).toBe(true);
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
describe("legacy heartbeat cron cleanup", () => {
|
|
64
|
+
test("removes the reserved heartbeat cron job", () => {
|
|
65
|
+
clearCronTables();
|
|
66
|
+
const createdAt = Date.now();
|
|
67
|
+
seedDefaultHeartbeatJob(createdAt);
|
|
68
|
+
|
|
69
|
+
expect(deleteLegacyHeartbeatJobs()).toBe(1);
|
|
70
|
+
const remaining = sqlite
|
|
71
|
+
.query(
|
|
72
|
+
`
|
|
73
|
+
SELECT COUNT(*) as count
|
|
74
|
+
FROM cron_job_definitions
|
|
75
|
+
WHERE id = ?1
|
|
76
|
+
`,
|
|
77
|
+
)
|
|
78
|
+
.get(HEARTBEAT_SYSTEM_JOB_ID) as { count: number };
|
|
79
|
+
expect(remaining.count).toBe(0);
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
test("removes legacy heartbeat-prefixed jobs", () => {
|
|
83
|
+
clearCronTables();
|
|
84
|
+
sqlite
|
|
85
|
+
.query(
|
|
86
|
+
`
|
|
87
|
+
INSERT INTO cron_job_definitions (
|
|
88
|
+
id, name, thread_session_id, enabled, schedule_kind, schedule_expr, every_ms, at_iso, timezone,
|
|
89
|
+
run_mode, handler_key, condition_module_path, condition_description, agent_prompt_template, agent_model_override,
|
|
90
|
+
max_attempts, retry_backoff_ms, payload_json, last_enqueued_for, created_at, updated_at
|
|
91
|
+
)
|
|
92
|
+
VALUES (?1, ?2, NULL, 1, 'every', NULL, ?3, NULL, NULL, 'background', 'heartbeat.check', NULL, NULL, NULL, NULL, 3, 30000, '{}', NULL, ?4, ?4)
|
|
93
|
+
`,
|
|
94
|
+
)
|
|
95
|
+
.run("heartbeat-build", "Heartbeat: build", parseInterval("30m"), Date.now());
|
|
96
|
+
|
|
97
|
+
expect(deleteLegacyHeartbeatJobs()).toBe(1);
|
|
98
|
+
|
|
99
|
+
const rows = sqlite
|
|
100
|
+
.query(
|
|
101
|
+
`
|
|
102
|
+
SELECT id
|
|
103
|
+
FROM cron_job_definitions
|
|
104
|
+
ORDER BY id
|
|
105
|
+
`,
|
|
106
|
+
)
|
|
107
|
+
.all() as Array<{ id: string }>;
|
|
108
|
+
expect(rows).toEqual([]);
|
|
109
|
+
});
|
|
110
|
+
});
|