@sixb/cli 0.1.1 → 0.1.3

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.
Files changed (50) hide show
  1. package/README.md +5 -2
  2. package/dist/commands/api.d.ts.map +1 -1
  3. package/dist/commands/dev.d.ts +2 -0
  4. package/dist/commands/dev.d.ts.map +1 -1
  5. package/dist/commands/worker-group.d.ts +2 -0
  6. package/dist/commands/worker-group.d.ts.map +1 -1
  7. package/dist/commands/worker.d.ts +2 -0
  8. package/dist/commands/worker.d.ts.map +1 -1
  9. package/dist/lib/agent-turn-timeout.d.ts +6 -0
  10. package/dist/lib/agent-turn-timeout.d.ts.map +1 -0
  11. package/dist/lib/health.d.ts +3 -3
  12. package/dist/lib/health.d.ts.map +1 -1
  13. package/dist/lib/loadSixb.d.ts +3 -48
  14. package/dist/lib/loadSixb.d.ts.map +1 -1
  15. package/dist/lib/production.d.ts +2 -2
  16. package/dist/lib/production.d.ts.map +1 -1
  17. package/dist/lib/runtime.d.ts +11 -8
  18. package/dist/lib/runtime.d.ts.map +1 -1
  19. package/dist/lib/shareable-providers.d.ts +3 -3
  20. package/dist/lib/shareable-providers.d.ts.map +1 -1
  21. package/dist/lib/storage-migration.d.ts +2 -2
  22. package/dist/lib/storage-migration.d.ts.map +1 -1
  23. package/dist/lib/worker-concurrency.d.ts +9 -0
  24. package/dist/lib/worker-concurrency.d.ts.map +1 -0
  25. package/dist/lib/worker-registry.d.ts +41 -4
  26. package/dist/lib/worker-registry.d.ts.map +1 -1
  27. package/dist/ui/index.d.ts +12 -16
  28. package/dist/ui/index.d.ts.map +1 -1
  29. package/package.json +16 -16
  30. package/src/commands/api.tsx +9 -4
  31. package/src/commands/app.tsx +2 -2
  32. package/src/commands/atlas.tsx +2 -2
  33. package/src/commands/check.tsx +1 -1
  34. package/src/commands/dev.tsx +38 -16
  35. package/src/commands/orchestrator.tsx +2 -2
  36. package/src/commands/rules.tsx +2 -2
  37. package/src/commands/scheduler.tsx +2 -2
  38. package/src/commands/worker-group.tsx +18 -6
  39. package/src/commands/worker.tsx +20 -5
  40. package/src/index.tsx +19 -3
  41. package/src/lib/agent-turn-timeout.ts +40 -0
  42. package/src/lib/health.ts +8 -8
  43. package/src/lib/loadSixb.ts +70 -105
  44. package/src/lib/production.ts +2 -2
  45. package/src/lib/runtime.ts +59 -42
  46. package/src/lib/shareable-providers.ts +6 -6
  47. package/src/lib/storage-migration.ts +3 -3
  48. package/src/lib/worker-concurrency.ts +127 -0
  49. package/src/lib/worker-registry.ts +68 -27
  50. package/src/ui/index.tsx +35 -71
@@ -15,7 +15,7 @@ export async function runCheck(options: CheckOptions = {}) {
15
15
  const sixb = await loadSixbFromEntry(entry)
16
16
 
17
17
  try {
18
- const objectTypes = sixb.listObjectTypes()
18
+ const objectTypes = sixb.definitions.ontology.listObjectTypes()
19
19
  const health = await checkRuntimeHealth(sixb)
20
20
 
21
21
  const projectValidation =
@@ -2,10 +2,12 @@ import { dirname, resolve } from "node:path"
2
2
  import { type CustomAppDevServer, createCustomApp } from "@sixb/app"
3
3
  import { type AtlasAppServer, createAtlasApp } from "@sixb/atlas"
4
4
  import { createSixbServer, type SixbServer } from "@sixb/server"
5
+ import { resolveAgentTurnTimeoutMs } from "../lib/agent-turn-timeout"
5
6
  import { apiDocsUrl, apiEventsUrl, apiUrl, resolveBrowserTopology } from "../lib/browser-topology"
6
- import { type LoadedSixb, loadSixbFromEntry } from "../lib/loadSixb"
7
+ import { type LoadedSixbHost, loadSixbFromEntry } from "../lib/loadSixb"
7
8
  import { runUntilSignal, startSixbRuntime, stopQuietly } from "../lib/runtime"
8
9
  import { generateProjectTypes } from "../lib/typegen"
10
+ import { resolveWorkerConcurrency } from "../lib/worker-concurrency"
9
11
  import { DevView, LoadingView, renderCliError, renderPersistent } from "../ui"
10
12
 
11
13
  export interface DevOptions {
@@ -17,11 +19,15 @@ export interface DevOptions {
17
19
  apiPublicOrigin?: string
18
20
  atlasPublicOrigin?: string
19
21
  appPublicOrigin?: string
22
+ agentTurnTimeout?: string
23
+ concurrency?: readonly string[]
20
24
  }
21
25
 
22
26
  export async function runDev(options: DevOptions = {}) {
23
27
  process.env.NODE_ENV = "development"
24
28
 
29
+ const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
30
+ const workerConcurrency = resolveWorkerConcurrency(options.concurrency)
25
31
  const entry = resolve(options.entry ?? "sixb.config.ts")
26
32
 
27
33
  const app = renderPersistent(
@@ -31,12 +37,13 @@ export async function runDev(options: DevOptions = {}) {
31
37
  let server: SixbServer | null = null
32
38
  let atlasServer: AtlasAppServer | null = null
33
39
  let customAppServer: CustomAppDevServer | null = null
34
- let sixb: LoadedSixb | null = null
40
+ let sixb: LoadedSixbHost | null = null
35
41
  let runtime: Awaited<ReturnType<typeof startSixbRuntime>> | null = null
36
42
 
37
43
  try {
38
44
  await generateProjectTypes({ entry })
39
- sixb = await loadSixbFromEntry(entry)
45
+ const host: LoadedSixbHost = await loadSixbFromEntry(entry)
46
+ sixb = host
40
47
  const projectRoot = dirname(resolve(entry))
41
48
 
42
49
  const customAppProbe = await createCustomApp({ rootDir: projectRoot })
@@ -52,24 +59,38 @@ export async function runDev(options: DevOptions = {}) {
52
59
  appPublicOrigin: options.appPublicOrigin,
53
60
  hasCustomApp,
54
61
  })
62
+ const customApp = await createCustomApp({
63
+ rootDir: projectRoot,
64
+ apiBaseUrl: topology.apiPublicOrigin,
65
+ audience: "app",
66
+ authEnabled: host.auth.isEnabled(),
67
+ })
68
+ const authExperience = hasCustomApp
69
+ ? ((await customApp.prepareAuthExperience()) ?? {
70
+ outdir: resolve(projectRoot, ".sixb", "generated", "auth"),
71
+ })
72
+ : null
55
73
 
56
- runtime = await startSixbRuntime(sixb, {
74
+ runtime = await startSixbRuntime(host, {
57
75
  cohostWorkers: true,
58
76
  agentApiBaseUrl: topology.apiPublicOrigin,
77
+ agentTurnTimeoutMs,
78
+ workerConcurrency,
59
79
  })
60
- const authEnabled = sixb.auth.isEnabled()
80
+ const authEnabled = host.auth.isEnabled()
61
81
 
62
82
  app.rerender(<LoadingView title="Starting sixb" subtitle={entry} status="Starting server" />)
63
83
 
64
84
  server = createSixbServer({
65
- sixb: sixb as unknown as never,
85
+ host: sixb,
66
86
  port: topology.apiPort,
67
- host: topology.apiHost,
87
+ hostname: topology.apiHost,
68
88
  quiet: true,
69
89
  browser: {
70
90
  publicOrigin: topology.apiPublicOrigin,
71
91
  allowedOrigins: topology.allowedBrowserOrigins,
72
92
  },
93
+ ...(authExperience ? { authExperience } : {}),
73
94
  })
74
95
  await server.start()
75
96
 
@@ -84,13 +105,6 @@ export async function runDev(options: DevOptions = {}) {
84
105
  development: true,
85
106
  })
86
107
 
87
- const customApp = await createCustomApp({
88
- rootDir: projectRoot,
89
- apiBaseUrl: topology.apiPublicOrigin,
90
- audience: "app",
91
- authEnabled,
92
- })
93
-
94
108
  let appUrl: string | null = null
95
109
  if (hasCustomApp) {
96
110
  app.rerender(
@@ -111,9 +125,17 @@ export async function runDev(options: DevOptions = {}) {
111
125
  apiDocsUrl={apiDocsUrl(topology)}
112
126
  wsUrl={apiEventsUrl(topology)}
113
127
  uiUrl={topology.atlasPublicOrigin}
114
- uiStatus={null}
115
128
  appUrl={appUrl}
116
- mqttUrl={null}
129
+ workers={[
130
+ { type: "action", worker: runtime.actionWorker },
131
+ { type: "agent", worker: runtime.agentWorker },
132
+ { type: "projection", worker: runtime.projectionWorker },
133
+ { type: "pipeline", worker: runtime.pipelineWorker },
134
+ { type: "workflow", worker: runtime.workflowWorker },
135
+ { type: "sync", worker: runtime.syncWorker },
136
+ ].flatMap(({ type, worker }) =>
137
+ worker ? [{ type, concurrency: worker.concurrency }] : []
138
+ )}
117
139
  warnings={runtime.warnings}
118
140
  />
119
141
  )
@@ -1,4 +1,4 @@
1
- import type { LoadedSixb } from "../lib/loadSixb"
1
+ import type { LoadedSixbHost } from "../lib/loadSixb"
2
2
  import { loadProductionSixb } from "../lib/production"
3
3
  import {
4
4
  type RunningOrchestratorRuntime,
@@ -28,7 +28,7 @@ export async function runOrchestrator(options: OrchestratorOptions = {}) {
28
28
  />
29
29
  )
30
30
 
31
- let sixb: LoadedSixb | null = loaded.sixb
31
+ let sixb: LoadedSixbHost | null = loaded.sixb
32
32
  let runtime: RunningOrchestratorRuntime | null = null
33
33
 
34
34
  try {
@@ -1,4 +1,4 @@
1
- import type { LoadedSixb } from "../lib/loadSixb"
1
+ import type { LoadedSixbHost } from "../lib/loadSixb"
2
2
  import { loadProductionSixb } from "../lib/production"
3
3
  import {
4
4
  type RunningRulesRuntime,
@@ -24,7 +24,7 @@ export async function runRules(options: RulesOptions = {}) {
24
24
  <LoadingView title="Starting sixb rules" subtitle={loaded.entry} status="Starting rules" />
25
25
  )
26
26
 
27
- let sixb: LoadedSixb | null = loaded.sixb
27
+ let sixb: LoadedSixbHost | null = loaded.sixb
28
28
  let runtime: RunningRulesRuntime | null = null
29
29
 
30
30
  try {
@@ -1,4 +1,4 @@
1
- import type { LoadedSixb } from "../lib/loadSixb"
1
+ import type { LoadedSixbHost } from "../lib/loadSixb"
2
2
  import { loadProductionSixb } from "../lib/production"
3
3
  import {
4
4
  type RunningSchedulerRuntime,
@@ -27,7 +27,7 @@ export async function runScheduler(options: SchedulerOptions = {}) {
27
27
  />
28
28
  )
29
29
 
30
- let sixb: LoadedSixb | null = loaded.sixb
30
+ let sixb: LoadedSixbHost | null = loaded.sixb
31
31
  let runtime: RunningSchedulerRuntime | null = null
32
32
 
33
33
  try {
@@ -1,5 +1,5 @@
1
- import type { Worker } from "@sixb/core/internal/workers"
2
- import { type LoadedSixb, loadSixbFromEntry } from "../lib/loadSixb"
1
+ import { resolveAgentTurnTimeoutMs } from "../lib/agent-turn-timeout"
2
+ import { type LoadedSixbHost, loadSixbFromEntry } from "../lib/loadSixb"
3
3
  import { resolveRuntimeEntry } from "../lib/production"
4
4
  import {
5
5
  runUntilSignal,
@@ -9,9 +9,11 @@ import {
9
9
  } from "../lib/runtime"
10
10
  import { assertShareableProviders } from "../lib/shareable-providers"
11
11
  import { migrateStorageForRole } from "../lib/storage-migration"
12
+ import { resolveWorkerConcurrency } from "../lib/worker-concurrency"
12
13
  import {
13
14
  assertWorkerInputs,
14
15
  createWorkerForType,
16
+ type QueueWorkerProcess,
15
17
  resolveRegisteredWorkerTypes,
16
18
  resolveWorkerTypeToStart,
17
19
  } from "../lib/worker-registry"
@@ -22,6 +24,8 @@ export interface WorkerGroupOptions {
22
24
  noMigrate?: boolean
23
25
  workerTypes?: readonly string[]
24
26
  apiPublicOrigin?: string
27
+ agentTurnTimeout?: string
28
+ concurrency?: readonly string[]
25
29
  }
26
30
 
27
31
  export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
@@ -30,14 +34,16 @@ export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
30
34
  // Validate explicit worker types before loading the runtime so an unknown type
31
35
  // fails fast, just like `sixb worker`.
32
36
  const requestedTypes = (options.workerTypes ?? []).map(resolveWorkerTypeToStart)
37
+ const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
38
+ const workerConcurrency = resolveWorkerConcurrency(options.concurrency)
33
39
  const entry = await resolveRuntimeEntry({ entry: options.entry })
34
40
 
35
41
  const app = renderPersistent(
36
42
  <LoadingView title="Starting sixb worker group" subtitle={entry} status="Loading runtime" />
37
43
  )
38
44
 
39
- let sixb: LoadedSixb | null = null
40
- let workers: Worker[] = []
45
+ let sixb: LoadedSixbHost | null = null
46
+ let workers: QueueWorkerProcess[] = []
41
47
 
42
48
  async function stopWorkersAndProviders() {
43
49
  await Promise.all(workers.map((worker) => stopQuietly(() => worker.stop())))
@@ -81,9 +87,12 @@ export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
81
87
  <LoadingView title="Starting sixb worker group" subtitle={entry} status="Starting workers" />
82
88
  )
83
89
 
90
+ const host = sixb
84
91
  workers = workerTypes.map((workerType) =>
85
- createWorkerForType(sixb as LoadedSixb, workerType, {
92
+ createWorkerForType(host, workerType, {
86
93
  agentApiBaseUrl: options.apiPublicOrigin,
94
+ agentTurnTimeoutMs,
95
+ workerConcurrency,
87
96
  })
88
97
  )
89
98
  await Promise.all(workers.map((worker) => worker.start()))
@@ -96,7 +105,10 @@ export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
96
105
  app.rerender(
97
106
  <WorkerGroupView
98
107
  name={sixb.id}
99
- workerTypes={workerTypes}
108
+ workers={workerTypes.map((workerType, index) => ({
109
+ type: workerType,
110
+ concurrency: workers[index]?.concurrency ?? 1,
111
+ }))}
100
112
  storage={migration.summary}
101
113
  warnings={warnings}
102
114
  />
@@ -1,6 +1,6 @@
1
- import type { Worker } from "@sixb/core/internal/workers"
1
+ import { resolveAgentTurnTimeoutMs } from "../lib/agent-turn-timeout"
2
2
  import { SixbCliError } from "../lib/errors"
3
- import { type LoadedSixb, loadSixbFromEntry } from "../lib/loadSixb"
3
+ import { type LoadedSixbHost, loadSixbFromEntry } from "../lib/loadSixb"
4
4
  import { resolveRuntimeEntry } from "../lib/production"
5
5
  import {
6
6
  runUntilSignal,
@@ -10,8 +10,10 @@ import {
10
10
  } from "../lib/runtime"
11
11
  import { assertShareableProviders } from "../lib/shareable-providers"
12
12
  import { migrateStorageForRole } from "../lib/storage-migration"
13
+ import { resolveSingleWorkerConcurrency } from "../lib/worker-concurrency"
13
14
  import {
14
15
  createWorkerForType,
16
+ type QueueWorkerProcess,
15
17
  resolveWorkerTypeToStart,
16
18
  unmetWorkerRequirement,
17
19
  } from "../lib/worker-registry"
@@ -22,20 +24,24 @@ export interface WorkerOptions {
22
24
  noMigrate?: boolean
23
25
  workerType?: string
24
26
  apiPublicOrigin?: string
27
+ agentTurnTimeout?: string
28
+ concurrency?: string
25
29
  }
26
30
 
27
31
  export async function runWorker(options: WorkerOptions = {}) {
28
32
  process.env.NODE_ENV = "production"
29
33
 
30
34
  const workerType = resolveWorkerTypeToStart(options.workerType)
35
+ const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
36
+ const workerConcurrency = resolveSingleWorkerConcurrency(workerType, options.concurrency)
31
37
  const entry = await resolveRuntimeEntry({ entry: options.entry })
32
38
 
33
39
  const app = renderPersistent(
34
40
  <LoadingView title="Starting sixb worker" subtitle={entry} status="Loading runtime" />
35
41
  )
36
42
 
37
- let sixb: LoadedSixb | null = null
38
- let worker: Worker | null = null
43
+ let sixb: LoadedSixbHost | null = null
44
+ let worker: QueueWorkerProcess | null = null
39
45
 
40
46
  try {
41
47
  sixb = await loadSixbFromEntry(entry)
@@ -66,11 +72,20 @@ export async function runWorker(options: WorkerOptions = {}) {
66
72
 
67
73
  worker = createWorkerForType(sixb, workerType, {
68
74
  agentApiBaseUrl: options.apiPublicOrigin,
75
+ agentTurnTimeoutMs,
76
+ workerConcurrency,
69
77
  })
70
78
  await worker.start()
71
79
 
72
80
  const workerId = `${workerType}-worker-${sixb.id}`
73
- app.rerender(<WorkerView name={sixb.id} workerId={workerId} storage={migration.summary} />)
81
+ app.rerender(
82
+ <WorkerView
83
+ name={sixb.id}
84
+ workerId={workerId}
85
+ concurrency={worker.concurrency}
86
+ storage={migration.summary}
87
+ />
88
+ )
74
89
 
75
90
  await Promise.race([
76
91
  runUntilSignal(async () => {
package/src/index.tsx CHANGED
@@ -61,7 +61,7 @@ async function readPackageVersion(): Promise<string> {
61
61
 
62
62
  function getFlag(name: string): string | undefined {
63
63
  const direct = args.find((arg) => arg.startsWith(`--${name}=`))
64
- if (direct) return direct.split("=")[1]
64
+ if (direct) return direct.slice(name.length + 3)
65
65
 
66
66
  const idx = args.indexOf(`--${name}`)
67
67
  if (idx >= 0) return args[idx + 1]
@@ -69,7 +69,7 @@ function getFlag(name: string): string | undefined {
69
69
  return undefined
70
70
  }
71
71
 
72
- function getFlags(name: string): string[] {
72
+ function getFlags(name: string, options: { readonly includeMissing?: boolean } = {}): string[] {
73
73
  const values: string[] = []
74
74
 
75
75
  for (let index = 0; index < args.length; index++) {
@@ -79,6 +79,8 @@ function getFlags(name: string): string[] {
79
79
  if (value && !value.startsWith("--")) {
80
80
  values.push(value)
81
81
  index++
82
+ } else if (options.includeMissing) {
83
+ values.push("")
82
84
  }
83
85
  } else if (arg?.startsWith(`--${name}=`)) {
84
86
  values.push(arg.slice(name.length + 3))
@@ -88,6 +90,11 @@ function getFlags(name: string): string[] {
88
90
  return values
89
91
  }
90
92
 
93
+ function getFlagRequiringValue(name: string): string | undefined {
94
+ const value = getFlag(name)
95
+ return value ?? (hasFlagValue(name) ? "" : undefined)
96
+ }
97
+
91
98
  function hasFlag(name: string): boolean {
92
99
  return args.includes(`--${name}`)
93
100
  }
@@ -103,6 +110,8 @@ const flagsWithValues = new Set([
103
110
  "api-port",
104
111
  "api-host",
105
112
  "api-public-origin",
113
+ "agent-turn-timeout",
114
+ "concurrency",
106
115
  "atlas-public-origin",
107
116
  "app-public-origin",
108
117
  "outdir",
@@ -128,7 +137,8 @@ function getCommandPositionals(): string[] {
128
137
 
129
138
  if (arg.startsWith("--")) {
130
139
  const flagName = arg.slice(2).split("=")[0] ?? ""
131
- if (!arg.includes("=") && flagsWithValues.has(flagName)) {
140
+ const next = args[index + 1]
141
+ if (!arg.includes("=") && flagsWithValues.has(flagName) && next && !next.startsWith("--")) {
132
142
  index++
133
143
  }
134
144
  continue
@@ -175,6 +185,8 @@ async function main(): Promise<void> {
175
185
  apiPublicOrigin: getFlag("api-public-origin"),
176
186
  atlasPublicOrigin: getFlag("atlas-public-origin"),
177
187
  appPublicOrigin: getFlag("app-public-origin"),
188
+ agentTurnTimeout: getFlag("agent-turn-timeout"),
189
+ concurrency: getFlags("concurrency", { includeMissing: true }),
178
190
  })
179
191
  break
180
192
  }
@@ -190,6 +202,8 @@ async function main(): Promise<void> {
190
202
  noMigrate: hasFlag("no-migrate"),
191
203
  workerType: getCommandPositionals()[0],
192
204
  apiPublicOrigin: getFlag("api-public-origin"),
205
+ agentTurnTimeout: getFlag("agent-turn-timeout"),
206
+ concurrency: getFlagRequiringValue("concurrency"),
193
207
  })
194
208
  break
195
209
  }
@@ -201,6 +215,8 @@ async function main(): Promise<void> {
201
215
  noMigrate: hasFlag("no-migrate"),
202
216
  workerTypes: getCommandPositionals(),
203
217
  apiPublicOrigin: getFlag("api-public-origin"),
218
+ agentTurnTimeout: getFlag("agent-turn-timeout"),
219
+ concurrency: getFlags("concurrency", { includeMissing: true }),
204
220
  })
205
221
  break
206
222
  }
@@ -0,0 +1,40 @@
1
+ const MAX_TIMER_DURATION_MS = 2_147_483_647
2
+
3
+ /**
4
+ * Resolve the agent turn timeout from the CLI flag or environment. `undefined` leaves the worker's
5
+ * built-in default in authority.
6
+ */
7
+ export function resolveAgentTurnTimeoutMs(value: string | undefined): number | undefined {
8
+ const configured = nonblank(value) ?? nonblank(process.env.SIXB_AGENT_TURN_TIMEOUT)
9
+ if (configured === undefined) return undefined
10
+
11
+ const match = configured.match(/^(\d+)(ms|s|m|h)$/)
12
+ if (!match) throw invalidAgentTurnTimeout(configured)
13
+
14
+ const amount = Number(match[1])
15
+ const unit = match[2] as "ms" | "s" | "m" | "h"
16
+ const multipliers = {
17
+ ms: 1,
18
+ s: 1_000,
19
+ m: 60_000,
20
+ h: 60 * 60_000,
21
+ } as const
22
+ const timeoutMs = amount * multipliers[unit]
23
+
24
+ if (!Number.isSafeInteger(timeoutMs) || timeoutMs <= 0 || timeoutMs > MAX_TIMER_DURATION_MS) {
25
+ throw invalidAgentTurnTimeout(configured)
26
+ }
27
+
28
+ return timeoutMs
29
+ }
30
+
31
+ function nonblank(value: string | undefined): string | undefined {
32
+ return value?.trim() || undefined
33
+ }
34
+
35
+ function invalidAgentTurnTimeout(value: string): Error {
36
+ return new Error(
37
+ `[SixbCLI] Invalid agent turn timeout '${value}'. Use a positive duration like 30s, 10m, or 1h ` +
38
+ "with --agent-turn-timeout or SIXB_AGENT_TURN_TIMEOUT."
39
+ )
40
+ }
package/src/lib/health.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { checkStorageSchema } from "@sixb/core"
2
- import type { LoadedSixb } from "./loadSixb"
2
+ import type { LoadedSixbHost } from "./loadSixb"
3
3
  import { findProcessLocalProviders } from "./shareable-providers"
4
4
 
5
5
  /** An unreachable Postgres waits rather than refusing, so every probe is bounded. */
@@ -27,11 +27,11 @@ export interface RuntimeCheck {
27
27
  /**
28
28
  * Probes the configured providers with read-only round trips.
29
29
  *
30
- * There is no `events` row because there is no events provider: `EventsRuntime` is built over
30
+ * There is no `events` row because there is no events provider: `DomainEventService` is built over
31
31
  * the broker, so probing both was one round trip reported twice.
32
32
  */
33
33
  export async function checkRuntimeHealth(
34
- sixb: LoadedSixb,
34
+ sixb: LoadedSixbHost,
35
35
  options: RuntimeCheckOptions = {}
36
36
  ): Promise<RuntimeCheck> {
37
37
  const timeoutMs = options.timeoutMs ?? PROBE_TIMEOUT_MS
@@ -51,7 +51,7 @@ export async function checkRuntimeHealth(
51
51
  }
52
52
  }
53
53
 
54
- async function probeStorage(sixb: LoadedSixb, timeoutMs: number): Promise<ProviderCheck> {
54
+ async function probeStorage(sixb: LoadedSixbHost, timeoutMs: number): Promise<ProviderCheck> {
55
55
  const name = providerName(sixb.storage)
56
56
  const reachable = await probe(() => sixb.storage.ping(), name, timeoutMs)
57
57
  if (!reachable.ok) return reachable
@@ -75,7 +75,7 @@ async function probeStorage(sixb: LoadedSixb, timeoutMs: number): Promise<Provid
75
75
  : schema
76
76
  }
77
77
 
78
- async function probeTimeseries(sixb: LoadedSixb): Promise<void> {
78
+ async function probeTimeseries(sixb: LoadedSixbHost): Promise<void> {
79
79
  // A read that matches nothing still exercises the telemetry table, which is a
80
80
  // different table from the one `ping()` touches.
81
81
  await sixb.storage.timeseries.getLatest({
@@ -86,19 +86,19 @@ async function probeTimeseries(sixb: LoadedSixb): Promise<void> {
86
86
  })
87
87
  }
88
88
 
89
- async function probeBroker(sixb: LoadedSixb): Promise<void> {
89
+ async function probeBroker(sixb: LoadedSixbHost): Promise<void> {
90
90
  // `latestCursor` is the only read in the broker contract that neither writes nor
91
91
  // requires the stream to exist — it answers `undefined` for a missing one.
92
92
  await sixb.events.latestCursor()
93
93
  }
94
94
 
95
- function probeQueues(sixb: LoadedSixb, timeoutMs: number): Promise<ProviderCheck> {
95
+ function probeQueues(sixb: LoadedSixbHost, timeoutMs: number): Promise<ProviderCheck> {
96
96
  // Bound to the provider: `probe` calls it as a bare function, and a queues provider
97
97
  // that reads its own connection off `this` would see `undefined`.
98
98
  return probe(sixb.queues.health.bind(sixb.queues), providerName(sixb.queues), timeoutMs)
99
99
  }
100
100
 
101
- function processLocalWarnings(sixb: LoadedSixb): readonly string[] {
101
+ function processLocalWarnings(sixb: LoadedSixbHost): readonly string[] {
102
102
  return findProcessLocalProviders(sixb).map(
103
103
  (offender) =>
104
104
  `${offender.slot} is ${offender.configured}, which only works inside one process. ` +