diff options
| -rw-r--r-- | bun.lock | 1 | ||||
| -rw-r--r-- | packages/host-bin/package.json | 3 | ||||
| -rw-r--r-- | packages/host-bin/src/main.ts | 39 | ||||
| -rw-r--r-- | packages/host-bin/tsconfig.json | 69 |
4 files changed, 79 insertions, 33 deletions
@@ -70,6 +70,7 @@ "@dispatch/storage-sqlite": "workspace:*", "@dispatch/surface-loaded-extensions": "workspace:*", "@dispatch/surface-registry": "workspace:*", + "@dispatch/system-prompt": "workspace:*", "@dispatch/throughput-store": "workspace:*", "@dispatch/todo": "workspace:*", "@dispatch/tool-edit-file": "workspace:*", diff --git a/packages/host-bin/package.json b/packages/host-bin/package.json index ca328da..abc4a3e 100644 --- a/packages/host-bin/package.json +++ b/packages/host-bin/package.json @@ -28,6 +28,7 @@ "@dispatch/lsp": "workspace:*", "@dispatch/surface-loaded-extensions": "workspace:*", "@dispatch/surface-registry": "workspace:*", - "@dispatch/transport-ws": "workspace:*" + "@dispatch/transport-ws": "workspace:*", + "@dispatch/system-prompt": "workspace:*" } } diff --git a/packages/host-bin/src/main.ts b/packages/host-bin/src/main.ts index 1261df4..c045e6b 100644 --- a/packages/host-bin/src/main.ts +++ b/packages/host-bin/src/main.ts @@ -1,4 +1,4 @@ -import { mkdirSync } from "node:fs"; +import { existsSync, mkdirSync } from "node:fs"; import { dirname } from "node:path"; import { extension as authApikeyExt } from "@dispatch/auth-apikey"; import { extension as cacheWarmingExt } from "@dispatch/cache-warming"; @@ -28,6 +28,7 @@ import { extension as skillsExt } from "@dispatch/skills"; import { createSqliteStorage, extension as storageSqliteExt } from "@dispatch/storage-sqlite"; import { createLoadedExtensionsExtension } from "@dispatch/surface-loaded-extensions"; import { createSurfaceRegistryExtension } from "@dispatch/surface-registry"; +import { extension as systemPromptExt } from "@dispatch/system-prompt"; import { extension as throughputStoreExt } from "@dispatch/throughput-store"; import { extension as todoExt } from "@dispatch/todo"; import { extension as toolEditFileExt } from "@dispatch/tool-edit-file"; @@ -85,6 +86,7 @@ const CORE_EXTENSIONS: readonly Extension[] = [ messageQueueExt, sessionOrchestratorExt, skillsExt, + systemPromptExt, cacheWarmingExt, lspExt, createTransportHttpExtension(), @@ -111,20 +113,25 @@ async function boot(): Promise<void> { const traceDbPath = process.env.DISPATCH_TRACE_DB ?? "./.dispatch-data/traces.db"; - const supervisor = createCollectorSupervisor({ - spawn: (cmd: string[]) => { - const proc = Bun.spawn(cmd, { stdout: "inherit", stderr: "inherit" }); - const handle: ChildHandle = { - kill: (signal?: string) => proc.kill(signal as NodeJS.Signals), - exited: proc.exited, - }; - return handle; - }, - journalPath, - dbPath: traceDbPath, - logger: logger.child({ extensionId: "collector-supervisor" }), - }); - supervisor.start(); + // Only start the collector supervisor in dev mode (source files available). + // Compiled binaries don't have the source tree, so the collector can't spawn. + let supervisor: ReturnType<typeof createCollectorSupervisor> | undefined; + if (existsSync("packages/observability-collector/src/main.ts")) { + supervisor = createCollectorSupervisor({ + spawn: (cmd: string[]) => { + const proc = Bun.spawn(cmd, { stdout: "inherit", stderr: "inherit" }); + const handle: ChildHandle = { + kill: (signal?: string) => proc.kill(signal as NodeJS.Signals), + exited: proc.exited, + }; + return handle; + }, + journalPath, + dbPath: traceDbPath, + logger: logger.child({ extensionId: "collector-supervisor" }), + }); + supervisor.start(); + } const dbPath = process.env.DISPATCH_DB ?? "./.dispatch-data/dispatch.db"; mkdirSync(dirname(dbPath), { recursive: true }); @@ -196,7 +203,7 @@ async function boot(): Promise<void> { logger.info("Shutting down — deactivating extensions"); await host.deactivate(); logger.info("Draining collector"); - await supervisor.stop(); + await supervisor?.stop(); process.exit(0); }; process.on("SIGINT", shutdown); diff --git a/packages/host-bin/tsconfig.json b/packages/host-bin/tsconfig.json index 110f931..771dc92 100644 --- a/packages/host-bin/tsconfig.json +++ b/packages/host-bin/tsconfig.json @@ -1,22 +1,59 @@ { "extends": "../../tsconfig.base.json", - "compilerOptions": { "rootDir": "src", "outDir": "dist", "composite": true }, + "compilerOptions": { + "rootDir": "src", + "outDir": "dist", + "composite": true + }, "include": ["src/**/*.ts"], "references": [ - { "path": "../cache-warming" }, - { "path": "../kernel" }, - { "path": "../message-queue" }, - { "path": "../storage-sqlite" }, - { "path": "../surface-loaded-extensions" }, - { "path": "../surface-registry" }, - { "path": "../tool-read-file" }, - { "path": "../tool-shell" }, - { "path": "../tool-edit-file" }, - { "path": "../tool-write-file" }, - { "path": "../skills" }, - { "path": "../throughput-store" }, - { "path": "../transport-http" }, - { "path": "../transport-ws" }, - { "path": "../lsp" } + { + "path": "../cache-warming" + }, + { + "path": "../kernel" + }, + { + "path": "../lsp" + }, + { + "path": "../message-queue" + }, + { + "path": "../skills" + }, + { + "path": "../storage-sqlite" + }, + { + "path": "../surface-loaded-extensions" + }, + { + "path": "../surface-registry" + }, + { + "path": "../system-prompt" + }, + { + "path": "../throughput-store" + }, + { + "path": "../tool-edit-file" + }, + { + "path": "../tool-read-file" + }, + { + "path": "../tool-shell" + }, + { + "path": "../tool-write-file" + }, + { + "path": "../transport-http" + }, + { + "path": "../transport-ws" + } ] } |
