@sixb/cli 0.1.18 → 0.1.20
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/README.md +23 -27
- package/dist/commands/api.d.ts +0 -1
- package/dist/commands/api.d.ts.map +1 -1
- package/dist/commands/app.d.ts.map +1 -1
- package/dist/commands/build.d.ts.map +1 -1
- package/dist/commands/dev-runner.d.ts +12 -1
- package/dist/commands/dev-runner.d.ts.map +1 -1
- package/dist/commands/worker-group.d.ts +1 -0
- package/dist/commands/worker-group.d.ts.map +1 -1
- package/dist/commands/worker.d.ts +1 -0
- package/dist/commands/worker.d.ts.map +1 -1
- package/dist/lib/browser-topology.d.ts +9 -33
- package/dist/lib/browser-topology.d.ts.map +1 -1
- package/dist/lib/command-line.d.ts +8 -8
- package/dist/lib/command-line.d.ts.map +1 -1
- package/dist/lib/deploy-release.d.ts.map +1 -1
- package/dist/lib/dev-supervisor.d.ts.map +1 -1
- package/dist/lib/dev-watch.d.ts +1 -1
- package/dist/lib/dev-watch.d.ts.map +1 -1
- package/dist/lib/production-roles.d.ts +5 -10
- package/dist/lib/production-roles.d.ts.map +1 -1
- package/dist/lib/production.d.ts +1 -2
- package/dist/lib/production.d.ts.map +1 -1
- package/dist/lib/role-view.d.ts +2 -3
- package/dist/lib/role-view.d.ts.map +1 -1
- package/dist/lib/runtime.d.ts +11 -14
- package/dist/lib/runtime.d.ts.map +1 -1
- package/dist/lib/worker-concurrency.d.ts +5 -0
- package/dist/lib/worker-concurrency.d.ts.map +1 -1
- package/dist/lib/worker-registry.d.ts +3 -31
- package/dist/lib/worker-registry.d.ts.map +1 -1
- package/dist/ui/index.d.ts +3 -3
- package/dist/ui/index.d.ts.map +1 -1
- package/package.json +15 -17
- package/src/commands/api.tsx +1 -5
- package/src/commands/app.tsx +5 -7
- package/src/commands/build.tsx +14 -31
- package/src/commands/dev-runner.tsx +43 -48
- package/src/commands/worker-group.tsx +4 -1
- package/src/commands/worker.tsx +4 -1
- package/src/index.tsx +3 -14
- package/src/lib/browser-topology.ts +28 -135
- package/src/lib/command-line.ts +32 -28
- package/src/lib/deploy-release.ts +21 -7
- package/src/lib/dev-supervisor.ts +7 -6
- package/src/lib/dev-watch.ts +8 -8
- package/src/lib/production-roles.ts +5 -7
- package/src/lib/production.ts +3 -8
- package/src/lib/profiles.ts +1 -1
- package/src/lib/role-lifecycle.ts +2 -2
- package/src/lib/role-view.ts +2 -3
- package/src/lib/runtime.ts +18 -23
- package/src/lib/worker-concurrency.ts +26 -38
- package/src/lib/worker-registry.ts +16 -36
- package/src/ui/index.tsx +7 -15
- package/dist/commands/atlas.d.ts +0 -9
- package/dist/commands/atlas.d.ts.map +0 -1
- package/src/commands/atlas.tsx +0 -71
package/src/lib/runtime.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionWorker } from "@sixb/action-worker"
|
|
2
1
|
import { AgentWorker } from "@sixb/agent-worker"
|
|
3
2
|
import { migrateStorage } from "@sixb/core"
|
|
3
|
+
import { ACTION_RUN_DRAIN_TIMEOUT_MS, drainActionRuns } from "@sixb/core/internal/actions"
|
|
4
4
|
import { flushSixbErrors } from "@sixb/core/internal/error-reporting"
|
|
5
5
|
import { PipelineRunDispatcher } from "@sixb/core/internal/pipelines"
|
|
6
6
|
import {
|
|
@@ -41,7 +41,6 @@ async function closeProvider(provider: { close?(): void | Promise<void> }): Prom
|
|
|
41
41
|
export interface RunningSixbRuntime {
|
|
42
42
|
readonly rulesWorker: RulesWorker | null
|
|
43
43
|
readonly syncWorker: SyncWorker | null
|
|
44
|
-
readonly actionWorker: ActionWorker | null
|
|
45
44
|
readonly agentWorker: AgentWorker | null
|
|
46
45
|
readonly projectionWorker: ProjectionWorker | null
|
|
47
46
|
readonly pipelineWorker: PipelineWorker | null
|
|
@@ -62,6 +61,7 @@ export interface StartSixbRuntimeOptions {
|
|
|
62
61
|
readonly agentApiBaseUrl?: string
|
|
63
62
|
readonly agentTurnTimeoutMs?: number
|
|
64
63
|
readonly workerConcurrency?: WorkerConcurrency
|
|
64
|
+
readonly vectorConcurrency?: number
|
|
65
65
|
}
|
|
66
66
|
|
|
67
67
|
export interface RuntimeApiServer {
|
|
@@ -109,6 +109,11 @@ export async function checkRuntimeLakeDefinitions(sixb: LoadedSixbHost): Promise
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
export async function stopSixbProviders(sixb: LoadedSixbHost): Promise<void> {
|
|
112
|
+
// Actions run inside the request that asked for them, and a client that disconnects does not stop
|
|
113
|
+
// them: refuse new ones and give those in flight, and the effects they start, time to finish
|
|
114
|
+
// before closing what they use. A run is recorded only when it ends, so one cut short leaves no
|
|
115
|
+
// record, and a retry under the same run id runs it again.
|
|
116
|
+
await stopQuietly(() => drainActionRuns(sixb, ACTION_RUN_DRAIN_TIMEOUT_MS))
|
|
112
117
|
await stopQuietly(() => flushSixbErrors(sixb))
|
|
113
118
|
await stopQuietly(() => sixb.closeConnectors())
|
|
114
119
|
await stopQuietly(() => closeProvider(sixb.queues))
|
|
@@ -203,15 +208,14 @@ export async function startOrchestratorRuntime(
|
|
|
203
208
|
*
|
|
204
209
|
* Startup order (consumers before producers):
|
|
205
210
|
* 1. RulesWorker (subscribes to ontology events)
|
|
206
|
-
* 2.
|
|
207
|
-
* 3.
|
|
208
|
-
* 4.
|
|
209
|
-
* 5.
|
|
210
|
-
* 6.
|
|
211
|
-
* 7.
|
|
212
|
-
* 8.
|
|
213
|
-
* 9.
|
|
214
|
-
* 10. AgentWorker (claims from queues; its turns call the API)
|
|
211
|
+
* 2. ProjectionWorker (claims from queues)
|
|
212
|
+
* 3. PipelineWorker (claims from queues)
|
|
213
|
+
* 4. WorkflowWorker (claims from queues)
|
|
214
|
+
* 5. SyncWorker (claims from queues)
|
|
215
|
+
* 6. Orchestrator (subscribes to events and enqueues jobs)
|
|
216
|
+
* 7. Scheduler (emits schedule.triggered)
|
|
217
|
+
* 8. API server, when this process serves it
|
|
218
|
+
* 9. AgentWorker (claims from queues; its turns call the API)
|
|
215
219
|
*
|
|
216
220
|
* Shutdown order (producers before consumers):
|
|
217
221
|
* 1. AgentWorker (ends its turns while the API still answers them)
|
|
@@ -222,9 +226,8 @@ export async function startOrchestratorRuntime(
|
|
|
222
226
|
* 6. WorkflowWorker
|
|
223
227
|
* 7. PipelineWorker
|
|
224
228
|
* 8. ProjectionWorker
|
|
225
|
-
* 9.
|
|
226
|
-
* 10.
|
|
227
|
-
* 11. Runtime providers (connectors, broker)
|
|
229
|
+
* 9. RulesWorker (drains pending evaluations)
|
|
230
|
+
* 10. Runtime providers (connectors, broker)
|
|
228
231
|
*/
|
|
229
232
|
export async function startSixbRuntime(
|
|
230
233
|
sixb: LoadedSixbHost,
|
|
@@ -235,7 +238,6 @@ export async function startSixbRuntime(
|
|
|
235
238
|
let orchestratorRuntime: RunningOrchestratorRuntime | null = null
|
|
236
239
|
let rulesWorker: RulesWorker | null = null
|
|
237
240
|
let syncWorker: SyncWorker | null = null
|
|
238
|
-
let actionWorker: ActionWorker | null = null
|
|
239
241
|
let agentWorker: AgentWorker | null = null
|
|
240
242
|
let pipelineWorker: PipelineWorker | null = null
|
|
241
243
|
let workflowWorker: WorkflowWorker | null = null
|
|
@@ -252,7 +254,6 @@ export async function startSixbRuntime(
|
|
|
252
254
|
await stopQuietly(() => workflowWorker?.stop() ?? Promise.resolve())
|
|
253
255
|
await stopQuietly(() => pipelineWorker?.stop() ?? Promise.resolve())
|
|
254
256
|
await stopQuietly(() => projectionWorker?.stop() ?? Promise.resolve())
|
|
255
|
-
await stopQuietly(() => actionWorker?.stop() ?? Promise.resolve())
|
|
256
257
|
await stopQuietly(() => rulesRuntime?.stop() ?? Promise.resolve())
|
|
257
258
|
await stopSixbProviders(sixb)
|
|
258
259
|
}
|
|
@@ -265,11 +266,6 @@ export async function startSixbRuntime(
|
|
|
265
266
|
rulesWorker = rulesRuntime.rulesWorker
|
|
266
267
|
|
|
267
268
|
if (options.cohostWorkers) {
|
|
268
|
-
if (sixb.definitions.actions.list().length > 0) {
|
|
269
|
-
actionWorker = new ActionWorker(sixb)
|
|
270
|
-
await actionWorker.start()
|
|
271
|
-
}
|
|
272
|
-
|
|
273
269
|
// Constructed here so a configuration error stops startup early; started last, below.
|
|
274
270
|
if (agentWorkerRequired(sixb)) {
|
|
275
271
|
agentWorker = new AgentWorker(sixb, {
|
|
@@ -285,6 +281,7 @@ export async function startSixbRuntime(
|
|
|
285
281
|
if (projectionCount > 0) {
|
|
286
282
|
projectionWorker = new ProjectionWorker(sixb, {
|
|
287
283
|
concurrency: options.workerConcurrency?.projection,
|
|
284
|
+
vectorConcurrency: options.vectorConcurrency,
|
|
288
285
|
})
|
|
289
286
|
await projectionWorker.start()
|
|
290
287
|
}
|
|
@@ -326,7 +323,6 @@ export async function startSixbRuntime(
|
|
|
326
323
|
const workers: Worker[] = []
|
|
327
324
|
if (rulesWorker) workers.push(rulesWorker)
|
|
328
325
|
if (syncWorker) workers.push(syncWorker)
|
|
329
|
-
if (actionWorker) workers.push(actionWorker)
|
|
330
326
|
if (agentWorker) workers.push(agentWorker)
|
|
331
327
|
if (projectionWorker) workers.push(projectionWorker)
|
|
332
328
|
if (pipelineWorker) workers.push(pipelineWorker)
|
|
@@ -338,7 +334,6 @@ export async function startSixbRuntime(
|
|
|
338
334
|
return {
|
|
339
335
|
rulesWorker,
|
|
340
336
|
syncWorker,
|
|
341
|
-
actionWorker,
|
|
342
337
|
agentWorker,
|
|
343
338
|
projectionWorker,
|
|
344
339
|
pipelineWorker,
|
|
@@ -1,25 +1,20 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { WORKER_TYPES, type WorkerConcurrency, type WorkerType } from "./worker-registry"
|
|
2
|
+
|
|
3
|
+
/** The environment variable that sets each worker type's concurrency. */
|
|
4
|
+
const ENVIRONMENT_VARIABLES = {
|
|
5
|
+
sync: "SIXB_SYNC_WORKER_CONCURRENCY",
|
|
6
|
+
agent: "SIXB_AGENT_WORKER_CONCURRENCY",
|
|
7
|
+
pipeline: "SIXB_PIPELINE_WORKER_CONCURRENCY",
|
|
8
|
+
projection: "SIXB_PROJECTION_WORKER_CONCURRENCY",
|
|
9
|
+
workflow: "SIXB_WORKFLOW_WORKER_CONCURRENCY",
|
|
10
|
+
} as const satisfies Record<WorkerType, string>
|
|
8
11
|
|
|
9
12
|
/** Resolve the scalar concurrency accepted by `sixb worker <type>`. */
|
|
10
13
|
export function resolveSingleWorkerConcurrency(
|
|
11
14
|
workerType: WorkerType,
|
|
12
15
|
value: string | undefined
|
|
13
16
|
): WorkerConcurrency {
|
|
14
|
-
const
|
|
15
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
16
|
-
if (value !== undefined || nonblank(process.env[definition.environmentVariable])) {
|
|
17
|
-
throw fixedActionConcurrency()
|
|
18
|
-
}
|
|
19
|
-
return {}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
const environmentVariable = definition.environmentVariable
|
|
17
|
+
const environmentVariable = ENVIRONMENT_VARIABLES[workerType]
|
|
23
18
|
const configured = value?.trim() ?? nonblank(process.env[environmentVariable])
|
|
24
19
|
if (configured === undefined) return {}
|
|
25
20
|
|
|
@@ -33,19 +28,12 @@ export function resolveSingleWorkerConcurrency(
|
|
|
33
28
|
export function resolveWorkerConcurrency(values: readonly string[] = []): WorkerConcurrency {
|
|
34
29
|
const overrides = values.map(parseWorkerConcurrencyEntry)
|
|
35
30
|
const overriddenWorkerTypes = new Set(overrides.map((entry) => entry.workerType))
|
|
36
|
-
const resolved: Partial<Record<
|
|
31
|
+
const resolved: Partial<Record<WorkerType, number>> = {}
|
|
37
32
|
|
|
38
33
|
for (const workerType of WORKER_TYPES) {
|
|
39
|
-
const definition = WORKER_CONCURRENCY_CONFIG[workerType]
|
|
40
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
41
|
-
if (nonblank(process.env[definition.environmentVariable])) {
|
|
42
|
-
throw fixedActionConcurrency()
|
|
43
|
-
}
|
|
44
|
-
continue
|
|
45
|
-
}
|
|
46
34
|
if (overriddenWorkerTypes.has(workerType)) continue
|
|
47
35
|
|
|
48
|
-
const environmentVariable =
|
|
36
|
+
const environmentVariable = ENVIRONMENT_VARIABLES[workerType]
|
|
49
37
|
const configured = nonblank(process.env[environmentVariable])
|
|
50
38
|
if (configured !== undefined) {
|
|
51
39
|
resolved[workerType] = parseConcurrency(configured, environmentVariable)
|
|
@@ -59,8 +47,19 @@ export function resolveWorkerConcurrency(values: readonly string[] = []): Worker
|
|
|
59
47
|
return resolved
|
|
60
48
|
}
|
|
61
49
|
|
|
50
|
+
/**
|
|
51
|
+
* Resolve the projection worker's concurrent embedding calls. `undefined` leaves the worker's
|
|
52
|
+
* built-in default in authority.
|
|
53
|
+
*/
|
|
54
|
+
export function resolveVectorConcurrency(value: string | undefined): number | undefined {
|
|
55
|
+
const configured = value?.trim() ?? nonblank(process.env.SIXB_VECTOR_CONCURRENCY)
|
|
56
|
+
if (configured === undefined) return undefined
|
|
57
|
+
|
|
58
|
+
return parseConcurrency(configured, "--vector-concurrency or SIXB_VECTOR_CONCURRENCY")
|
|
59
|
+
}
|
|
60
|
+
|
|
62
61
|
function parseWorkerConcurrencyEntry(value: string): {
|
|
63
|
-
readonly workerType:
|
|
62
|
+
readonly workerType: WorkerType
|
|
64
63
|
readonly concurrency: number
|
|
65
64
|
} {
|
|
66
65
|
const separator = value.indexOf("=")
|
|
@@ -72,12 +71,9 @@ function parseWorkerConcurrencyEntry(value: string): {
|
|
|
72
71
|
const configured = value.slice(separator + 1).trim()
|
|
73
72
|
if (!isWorkerType(workerType)) {
|
|
74
73
|
throw new Error(
|
|
75
|
-
`[SixbCLI] Unknown worker concurrency type '${workerType || value}'. Available: ${WORKER_TYPES.
|
|
74
|
+
`[SixbCLI] Unknown worker concurrency type '${workerType || value}'. Available: ${WORKER_TYPES.join(", ")}.`
|
|
76
75
|
)
|
|
77
76
|
}
|
|
78
|
-
if (!isConfigurableWorkerType(workerType)) {
|
|
79
|
-
throw fixedActionConcurrency()
|
|
80
|
-
}
|
|
81
77
|
|
|
82
78
|
return {
|
|
83
79
|
workerType,
|
|
@@ -105,10 +101,6 @@ function isWorkerType(value: string): value is WorkerType {
|
|
|
105
101
|
return WORKER_TYPES.some((workerType) => workerType === value)
|
|
106
102
|
}
|
|
107
103
|
|
|
108
|
-
function isConfigurableWorkerType(value: WorkerType): value is ConfigurableWorkerType {
|
|
109
|
-
return WORKER_CONCURRENCY_CONFIG[value].configurable
|
|
110
|
-
}
|
|
111
|
-
|
|
112
104
|
function invalidConcurrency(value: string, source: string): Error {
|
|
113
105
|
return new Error(
|
|
114
106
|
`[SixbCLI] Invalid worker concurrency '${value}'. Use a positive integer with ${source}.`
|
|
@@ -121,7 +113,3 @@ function invalidWorkerConcurrencyEntry(value: string): Error {
|
|
|
121
113
|
"--concurrency agent=4 --concurrency sync=2."
|
|
122
114
|
)
|
|
123
115
|
}
|
|
124
|
-
|
|
125
|
-
function fixedActionConcurrency(): Error {
|
|
126
|
-
return new Error("[SixbCLI] Action worker concurrency is fixed at 1 and cannot be configured.")
|
|
127
|
-
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ActionWorker } from "@sixb/action-worker"
|
|
2
1
|
import { AgentWorker } from "@sixb/agent-worker"
|
|
3
2
|
import type { Worker } from "@sixb/core/internal/workers"
|
|
4
3
|
import { PipelineWorker } from "@sixb/pipeline-worker"
|
|
@@ -9,42 +8,18 @@ import { SixbCliError } from "./errors"
|
|
|
9
8
|
import type { LoadedSixbHost } from "./loadSixb"
|
|
10
9
|
import { configuredOrigin } from "./public-origin"
|
|
11
10
|
|
|
12
|
-
export const WORKER_TYPES = [
|
|
13
|
-
"sync",
|
|
14
|
-
"action",
|
|
15
|
-
"agent",
|
|
16
|
-
"pipeline",
|
|
17
|
-
"projection",
|
|
18
|
-
"workflow",
|
|
19
|
-
] as const
|
|
11
|
+
export const WORKER_TYPES = ["sync", "agent", "pipeline", "projection", "workflow"] as const
|
|
20
12
|
|
|
21
13
|
export type WorkerType = (typeof WORKER_TYPES)[number]
|
|
22
14
|
|
|
23
|
-
export
|
|
24
|
-
sync: { configurable: true, environmentVariable: "SIXB_SYNC_WORKER_CONCURRENCY" },
|
|
25
|
-
action: { configurable: false, environmentVariable: "SIXB_ACTION_WORKER_CONCURRENCY" },
|
|
26
|
-
agent: { configurable: true, environmentVariable: "SIXB_AGENT_WORKER_CONCURRENCY" },
|
|
27
|
-
pipeline: { configurable: true, environmentVariable: "SIXB_PIPELINE_WORKER_CONCURRENCY" },
|
|
28
|
-
projection: { configurable: true, environmentVariable: "SIXB_PROJECTION_WORKER_CONCURRENCY" },
|
|
29
|
-
workflow: { configurable: true, environmentVariable: "SIXB_WORKFLOW_WORKER_CONCURRENCY" },
|
|
30
|
-
} as const satisfies Record<
|
|
31
|
-
WorkerType,
|
|
32
|
-
{ readonly configurable: boolean; readonly environmentVariable: string }
|
|
33
|
-
>
|
|
34
|
-
|
|
35
|
-
export type ConfigurableWorkerType = {
|
|
36
|
-
[Type in WorkerType]: (typeof WORKER_CONCURRENCY_CONFIG)[Type]["configurable"] extends true
|
|
37
|
-
? Type
|
|
38
|
-
: never
|
|
39
|
-
}[WorkerType]
|
|
40
|
-
|
|
41
|
-
export type WorkerConcurrency = Readonly<Partial<Record<ConfigurableWorkerType, number>>>
|
|
15
|
+
export type WorkerConcurrency = Readonly<Partial<Record<WorkerType, number>>>
|
|
42
16
|
export type QueueWorkerProcess = Worker & { readonly concurrency: number }
|
|
43
17
|
|
|
44
18
|
export interface WorkerCreationOptions {
|
|
45
19
|
readonly agentApiBaseUrl?: string
|
|
46
20
|
readonly agentTurnTimeoutMs?: number
|
|
47
21
|
readonly workerConcurrency?: WorkerConcurrency
|
|
22
|
+
readonly vectorConcurrency?: number
|
|
48
23
|
}
|
|
49
24
|
|
|
50
25
|
interface WorkerFactory {
|
|
@@ -70,9 +45,6 @@ const workerFactories: Record<WorkerType, WorkerFactory> = {
|
|
|
70
45
|
create: (sixb, options) =>
|
|
71
46
|
new SyncWorker(sixb, { concurrency: options.workerConcurrency?.sync }),
|
|
72
47
|
},
|
|
73
|
-
action: {
|
|
74
|
-
create: (sixb) => new ActionWorker(sixb),
|
|
75
|
-
},
|
|
76
48
|
agent: {
|
|
77
49
|
create: (sixb, options) =>
|
|
78
50
|
new AgentWorker(sixb, {
|
|
@@ -91,7 +63,10 @@ const workerFactories: Record<WorkerType, WorkerFactory> = {
|
|
|
91
63
|
},
|
|
92
64
|
projection: {
|
|
93
65
|
create: (sixb, options) =>
|
|
94
|
-
new ProjectionWorker(sixb, {
|
|
66
|
+
new ProjectionWorker(sixb, {
|
|
67
|
+
concurrency: options.workerConcurrency?.projection,
|
|
68
|
+
vectorConcurrency: options.vectorConcurrency,
|
|
69
|
+
}),
|
|
95
70
|
},
|
|
96
71
|
workflow: {
|
|
97
72
|
create: (sixb, options) =>
|
|
@@ -117,6 +92,7 @@ export function resolveWorkerTypeToStart(requestedWorker?: string): WorkerType {
|
|
|
117
92
|
throw new Error(`[SixbWorker] Usage: sixb worker <${knownWorkers().replaceAll(", ", "|")}>`)
|
|
118
93
|
}
|
|
119
94
|
|
|
95
|
+
if (requestedWorker === "action") throw removedActionWorker()
|
|
120
96
|
if (!isWorkerType(requestedWorker)) {
|
|
121
97
|
throw new Error(
|
|
122
98
|
`[SixbWorker] Unknown worker '${requestedWorker}'. Available: ${knownWorkers()}`
|
|
@@ -126,6 +102,14 @@ export function resolveWorkerTypeToStart(requestedWorker?: string): WorkerType {
|
|
|
126
102
|
return requestedWorker
|
|
127
103
|
}
|
|
128
104
|
|
|
105
|
+
/** `action` was a worker type until Actions ran in the process that requests them. */
|
|
106
|
+
function removedActionWorker(): Error {
|
|
107
|
+
return new Error(
|
|
108
|
+
"[SixbWorker] 'action' is no longer a worker type: Actions run in the process that requests " +
|
|
109
|
+
"them (API, workflows, syncs). Remove it from the command."
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
|
|
129
113
|
/**
|
|
130
114
|
* Why this worker cannot be constructed with these options, or `null` when it can. Exported
|
|
131
115
|
* for `sixb worker`, which has to answer this before it migrates storage.
|
|
@@ -203,10 +187,6 @@ export function resolveRegisteredWorkerTypes(sixb: LoadedSixbHost): readonly Wor
|
|
|
203
187
|
workerTypes.push("projection")
|
|
204
188
|
}
|
|
205
189
|
|
|
206
|
-
if (sixb.definitions.actions.list().length > 0) {
|
|
207
|
-
workerTypes.push("action")
|
|
208
|
-
}
|
|
209
|
-
|
|
210
190
|
if (agentWorkerRequired(sixb)) {
|
|
211
191
|
workerTypes.push("agent")
|
|
212
192
|
}
|
package/src/ui/index.tsx
CHANGED
|
@@ -44,9 +44,9 @@ export async function renderCliError(
|
|
|
44
44
|
)
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
// The entrypoint and the
|
|
48
|
-
// with JSX loads React as soon as it is evaluated, and `
|
|
49
|
-
//
|
|
47
|
+
// The entrypoint and the app role render through these rather than JSX of their own: a module
|
|
48
|
+
// with JSX loads React as soon as it is evaluated, and `app` loads neither React nor Ink outside a
|
|
49
|
+
// terminal.
|
|
50
50
|
|
|
51
51
|
export async function renderVersion(version: string): Promise<void> {
|
|
52
52
|
await renderStatic(<VersionView version={version} />)
|
|
@@ -481,7 +481,6 @@ export function DevView({
|
|
|
481
481
|
apiUrl,
|
|
482
482
|
apiDocsUrl,
|
|
483
483
|
wsUrl,
|
|
484
|
-
uiUrl,
|
|
485
484
|
appUrl,
|
|
486
485
|
workers = [],
|
|
487
486
|
warnings = [],
|
|
@@ -490,8 +489,8 @@ export function DevView({
|
|
|
490
489
|
apiUrl: string
|
|
491
490
|
apiDocsUrl: string
|
|
492
491
|
wsUrl: string
|
|
493
|
-
|
|
494
|
-
appUrl
|
|
492
|
+
/** `null` when the app could not start; a warning says why. */
|
|
493
|
+
appUrl: string | null
|
|
495
494
|
workers?: readonly { readonly type: string; readonly concurrency: number }[]
|
|
496
495
|
warnings?: readonly string[]
|
|
497
496
|
}) {
|
|
@@ -500,22 +499,15 @@ export function DevView({
|
|
|
500
499
|
{ label: "API docs", value: apiDocsUrl },
|
|
501
500
|
{ label: "Events", value: wsUrl },
|
|
502
501
|
]
|
|
503
|
-
if (uiUrl) {
|
|
504
|
-
serverItems.push({ label: "Atlas UI", value: uiUrl })
|
|
505
|
-
}
|
|
506
502
|
|
|
507
503
|
return (
|
|
508
504
|
<Box flexDirection="column">
|
|
509
505
|
<Text bold>sixb dev</Text>
|
|
510
506
|
<Text dimColor>{name}</Text>
|
|
511
507
|
<Spacer />
|
|
508
|
+
<ServicePanel name="App" items={[{ label: "URL", value: appUrl ?? "not running" }]} />
|
|
509
|
+
<Spacer />
|
|
512
510
|
<ServicePanel name="Server" items={serverItems} />
|
|
513
|
-
{appUrl ? (
|
|
514
|
-
<>
|
|
515
|
-
<Spacer />
|
|
516
|
-
<ServicePanel name="Custom app" items={[{ label: "URL", value: appUrl }]} />
|
|
517
|
-
</>
|
|
518
|
-
) : null}
|
|
519
511
|
{workers.length > 0 ? (
|
|
520
512
|
<>
|
|
521
513
|
<Spacer />
|
package/dist/commands/atlas.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"atlas.d.ts","sourceRoot":"","sources":["../../src/commands/atlas.tsx"],"names":[],"mappings":"AAOA,MAAM,WAAW,YAAY;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,iBAAiB,CAAC,EAAE,MAAM,CAAA;CAC3B;AAED,wBAAsB,QAAQ,CAAC,OAAO,GAAE,YAAiB,iBAuDxD"}
|
package/src/commands/atlas.tsx
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import { basename } from "node:path"
|
|
2
|
-
import { type AtlasAppServer, createAtlasApp } from "@sixb/atlas"
|
|
3
|
-
import { resolveBrowserTopology, servedUrl } from "../lib/browser-topology"
|
|
4
|
-
import { builtAtlasOutdir, resolveProductionPaths, resolveRuntimeEntry } from "../lib/production"
|
|
5
|
-
import { runUntilSignal, stopQuietly } from "../lib/role-lifecycle"
|
|
6
|
-
import { loadRoleView } from "../lib/role-view"
|
|
7
|
-
|
|
8
|
-
export interface AtlasOptions {
|
|
9
|
-
entry?: string
|
|
10
|
-
port?: string
|
|
11
|
-
host?: string
|
|
12
|
-
apiPublicOrigin?: string
|
|
13
|
-
atlasPublicOrigin?: string
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export async function runAtlas(options: AtlasOptions = {}) {
|
|
17
|
-
// Before NODE_ENV changes: see loadRoleView.
|
|
18
|
-
const view = await loadRoleView()
|
|
19
|
-
process.env.NODE_ENV = "production"
|
|
20
|
-
|
|
21
|
-
const entry = await resolveRuntimeEntry({ entry: options.entry })
|
|
22
|
-
const { projectRoot, buildOutdir } = await resolveProductionPaths(entry)
|
|
23
|
-
const app = view.startup({
|
|
24
|
-
title: "Starting sixb atlas",
|
|
25
|
-
subtitle: entry,
|
|
26
|
-
status: "Starting Atlas",
|
|
27
|
-
})
|
|
28
|
-
|
|
29
|
-
let atlasServer: AtlasAppServer | null = null
|
|
30
|
-
|
|
31
|
-
try {
|
|
32
|
-
const topology = resolveBrowserTopology({
|
|
33
|
-
role: "atlas",
|
|
34
|
-
host: options.host,
|
|
35
|
-
port: options.port,
|
|
36
|
-
apiPublicOrigin: options.apiPublicOrigin,
|
|
37
|
-
atlasPublicOrigin: options.atlasPublicOrigin,
|
|
38
|
-
})
|
|
39
|
-
|
|
40
|
-
const atlas = createAtlasApp({
|
|
41
|
-
apiBaseUrl: topology.apiPublicOrigin,
|
|
42
|
-
audience: "atlas",
|
|
43
|
-
// No authEnabled: the page asks the API whether the project uses auth, so serving the
|
|
44
|
-
// bundle never loads the project.
|
|
45
|
-
})
|
|
46
|
-
atlasServer = await atlas.start({
|
|
47
|
-
host: topology.host,
|
|
48
|
-
port: topology.atlasPort,
|
|
49
|
-
development: false,
|
|
50
|
-
outdir: builtAtlasOutdir(buildOutdir),
|
|
51
|
-
})
|
|
52
|
-
|
|
53
|
-
app.started({
|
|
54
|
-
title: "Sixb Atlas started",
|
|
55
|
-
name: basename(projectRoot),
|
|
56
|
-
serviceName: "Atlas",
|
|
57
|
-
items: [{ label: "URL", value: servedUrl(topology) }],
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
await runUntilSignal(async () => {
|
|
61
|
-
app.unmount()
|
|
62
|
-
console.log("\nShutting down atlas...")
|
|
63
|
-
await stopQuietly(() => atlasServer?.stop() ?? Promise.resolve())
|
|
64
|
-
})
|
|
65
|
-
} catch (error) {
|
|
66
|
-
app.unmount()
|
|
67
|
-
await stopQuietly(() => atlasServer?.stop() ?? Promise.resolve())
|
|
68
|
-
await view.error(error)
|
|
69
|
-
process.exit(1)
|
|
70
|
-
}
|
|
71
|
-
}
|