@sixb/cli 0.1.19 → 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 -26
- 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 +1 -0
- 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 +1 -0
- 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 +14 -15
- 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 -47
- 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 +26 -18
- package/src/lib/deploy-release.ts +0 -3
- 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 +2 -0
- package/src/lib/worker-concurrency.ts +11 -0
- package/src/lib/worker-registry.ts +5 -1
- 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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sixb/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "Command-line interface for Sixb projects",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"sixb",
|
|
@@ -29,26 +29,25 @@
|
|
|
29
29
|
"prepack": "bun run build"
|
|
30
30
|
},
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@sixb/agent-worker": "0.1.
|
|
33
|
-
"@sixb/app": "^0.1.
|
|
34
|
-
"@sixb/
|
|
35
|
-
"@sixb/
|
|
36
|
-
"@sixb/core": "0.1.19",
|
|
32
|
+
"@sixb/agent-worker": "0.1.20",
|
|
33
|
+
"@sixb/app": "^0.1.12",
|
|
34
|
+
"@sixb/client": "^0.1.20",
|
|
35
|
+
"@sixb/core": "0.1.20",
|
|
37
36
|
"@sixb/cli-core": "^0.1.8",
|
|
38
|
-
"@sixb/orchestrator": "0.1.
|
|
39
|
-
"@sixb/pipeline-worker": "0.1.
|
|
40
|
-
"@sixb/projection-worker": "0.1.
|
|
41
|
-
"@sixb/rules-worker": "0.1.
|
|
42
|
-
"@sixb/server": "0.1.
|
|
43
|
-
"@sixb/sync-worker": "0.1.
|
|
44
|
-
"@sixb/workflow-worker": "0.1.
|
|
45
|
-
"create-sixb": "^0.1.
|
|
37
|
+
"@sixb/orchestrator": "0.1.20",
|
|
38
|
+
"@sixb/pipeline-worker": "0.1.20",
|
|
39
|
+
"@sixb/projection-worker": "0.1.20",
|
|
40
|
+
"@sixb/rules-worker": "0.1.20",
|
|
41
|
+
"@sixb/server": "0.1.20",
|
|
42
|
+
"@sixb/sync-worker": "0.1.20",
|
|
43
|
+
"@sixb/workflow-worker": "0.1.20",
|
|
44
|
+
"create-sixb": "^0.1.5",
|
|
46
45
|
"ink": "^6.0.0",
|
|
47
46
|
"react": "^19.0.0",
|
|
48
47
|
"react-devtools-core": "^4.19.1"
|
|
49
48
|
},
|
|
50
49
|
"devDependencies": {
|
|
51
|
-
"@sixb/deploy-ssh": "0.1.
|
|
50
|
+
"@sixb/deploy-ssh": "0.1.2",
|
|
52
51
|
"@types/bun": "latest",
|
|
53
52
|
"@types/react": "^19.0.0",
|
|
54
53
|
"typescript": "^5.7.0"
|
package/src/commands/api.tsx
CHANGED
|
@@ -3,7 +3,7 @@ import { resolve } from "node:path"
|
|
|
3
3
|
import { createSixbServer, type SixbServer } from "@sixb/server"
|
|
4
4
|
import { apiDocsUrl, apiEventsUrl, apiUrl, resolveBrowserTopology } from "../lib/browser-topology"
|
|
5
5
|
import type { LoadedSixbHost } from "../lib/loadSixb"
|
|
6
|
-
import { builtAppOutdir,
|
|
6
|
+
import { builtAppOutdir, loadProductionSixb } from "../lib/production"
|
|
7
7
|
import { runUntilSignal, stopQuietly } from "../lib/role-lifecycle"
|
|
8
8
|
import { stopSixbProviders } from "../lib/runtime"
|
|
9
9
|
import { migrateStorageForRole } from "../lib/storage-migration"
|
|
@@ -17,7 +17,6 @@ export interface ApiOptions {
|
|
|
17
17
|
apiPort?: string
|
|
18
18
|
apiHost?: string
|
|
19
19
|
apiPublicOrigin?: string
|
|
20
|
-
atlasPublicOrigin?: string
|
|
21
20
|
appPublicOrigin?: string
|
|
22
21
|
trustedProxies?: string
|
|
23
22
|
}
|
|
@@ -51,7 +50,6 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
51
50
|
})
|
|
52
51
|
|
|
53
52
|
const appOutdir = builtAppOutdir(loaded.buildOutdir)
|
|
54
|
-
const hasCustomApp = await hasBuiltCustomApp(appOutdir)
|
|
55
53
|
const authExperienceOutdir = resolve(appOutdir, "auth")
|
|
56
54
|
const hasAuthExperience = await stat(resolve(authExperienceOutdir, "index.html"))
|
|
57
55
|
.then(() => true)
|
|
@@ -63,9 +61,7 @@ export async function runApi(options: ApiOptions = {}) {
|
|
|
63
61
|
port: options.port,
|
|
64
62
|
apiPort: options.apiPort,
|
|
65
63
|
apiPublicOrigin: options.apiPublicOrigin,
|
|
66
|
-
atlasPublicOrigin: options.atlasPublicOrigin,
|
|
67
64
|
appPublicOrigin: options.appPublicOrigin,
|
|
68
|
-
hasCustomApp,
|
|
69
65
|
})
|
|
70
66
|
|
|
71
67
|
const trustedProxies = (options.trustedProxies ?? process.env.SIXB_TRUSTED_PROXIES ?? "")
|
package/src/commands/app.tsx
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { basename } from "node:path"
|
|
2
|
-
import { type
|
|
2
|
+
import { type CustomAppServer, createCustomApp } from "@sixb/app/server"
|
|
3
3
|
import { resolveBrowserTopology, servedUrl } from "../lib/browser-topology"
|
|
4
4
|
import {
|
|
5
5
|
builtAppOutdir,
|
|
6
|
-
|
|
6
|
+
hasBuiltApp,
|
|
7
7
|
resolveProductionPaths,
|
|
8
8
|
resolveRuntimeEntry,
|
|
9
9
|
} from "../lib/production"
|
|
@@ -31,11 +31,11 @@ export async function runApp(options: AppOptions = {}) {
|
|
|
31
31
|
status: "Starting app",
|
|
32
32
|
})
|
|
33
33
|
|
|
34
|
-
let customAppServer:
|
|
34
|
+
let customAppServer: CustomAppServer | null = null
|
|
35
35
|
|
|
36
36
|
try {
|
|
37
37
|
const appOutdir = builtAppOutdir(buildOutdir)
|
|
38
|
-
if (!(await
|
|
38
|
+
if (!(await hasBuiltApp(appOutdir))) {
|
|
39
39
|
throw new Error(
|
|
40
40
|
`[SixbCustomApp] No built app found in ${appOutdir}. Run \`sixb build\` before \`sixb app\`.`
|
|
41
41
|
)
|
|
@@ -52,7 +52,6 @@ export async function runApp(options: AppOptions = {}) {
|
|
|
52
52
|
const customApp = await createCustomApp({
|
|
53
53
|
rootDir: projectRoot,
|
|
54
54
|
apiBaseUrl: topology.apiPublicOrigin,
|
|
55
|
-
audience: "app",
|
|
56
55
|
// No authEnabled: the page asks the API whether the project uses auth, so serving the
|
|
57
56
|
// bundle never loads the project.
|
|
58
57
|
})
|
|
@@ -61,13 +60,12 @@ export async function runApp(options: AppOptions = {}) {
|
|
|
61
60
|
port: topology.appPort,
|
|
62
61
|
outdir: appOutdir,
|
|
63
62
|
apiBaseUrl: topology.apiPublicOrigin,
|
|
64
|
-
audience: "app",
|
|
65
63
|
})
|
|
66
64
|
|
|
67
65
|
app.started({
|
|
68
66
|
title: "Sixb app started",
|
|
69
67
|
name: basename(projectRoot),
|
|
70
|
-
serviceName: "
|
|
68
|
+
serviceName: "App",
|
|
71
69
|
items: [{ label: "URL", value: servedUrl(topology) }],
|
|
72
70
|
})
|
|
73
71
|
|
package/src/commands/build.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { mkdir } from "node:fs/promises"
|
|
2
2
|
import { dirname, join, resolve } from "node:path"
|
|
3
|
-
import { createCustomApp } from "@sixb/app"
|
|
4
|
-
import { buildAtlasAssets } from "@sixb/atlas"
|
|
3
|
+
import { createCustomApp } from "@sixb/app/server"
|
|
5
4
|
import { buildRuntime } from "../lib/build-runtime"
|
|
6
5
|
import { generateProjectTypes } from "../lib/typegen"
|
|
7
6
|
import { BuildView, ErrorView, renderStatic } from "../ui"
|
|
@@ -37,43 +36,27 @@ export async function runBuild(options: BuildOptions = {}) {
|
|
|
37
36
|
generatedDir: join(".sixb", "build", "app"),
|
|
38
37
|
})
|
|
39
38
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
})
|
|
39
|
+
try {
|
|
40
|
+
const appResult = await customApp.build({
|
|
41
|
+
outdir: resolve(outdir, "app"),
|
|
42
|
+
})
|
|
45
43
|
|
|
46
|
-
|
|
47
|
-
await renderStatic(
|
|
48
|
-
<ErrorView
|
|
49
|
-
title="App build failed"
|
|
50
|
-
message="Failed to build the app"
|
|
51
|
-
details={appResult.logs ?? []}
|
|
52
|
-
/>
|
|
53
|
-
)
|
|
54
|
-
process.exit(1)
|
|
55
|
-
}
|
|
56
|
-
} catch (error) {
|
|
57
|
-
// e.g. the app/globals.css Tailwind compile failed — surface the labeled
|
|
58
|
-
// message instead of an unhandled stack trace.
|
|
59
|
-
const message = error instanceof Error ? error.message : String(error)
|
|
44
|
+
if (!appResult.success) {
|
|
60
45
|
await renderStatic(
|
|
61
|
-
<ErrorView
|
|
46
|
+
<ErrorView
|
|
47
|
+
title="App build failed"
|
|
48
|
+
message="Failed to build the app"
|
|
49
|
+
details={appResult.logs ?? []}
|
|
50
|
+
/>
|
|
62
51
|
)
|
|
63
52
|
process.exit(1)
|
|
64
53
|
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
await buildAtlasAssets({ outdir: resolve(outdir, "atlas") })
|
|
69
54
|
} catch (error) {
|
|
55
|
+
// e.g. the app/globals.css Tailwind compile failed — surface the labeled
|
|
56
|
+
// message instead of an unhandled stack trace.
|
|
70
57
|
const message = error instanceof Error ? error.message : String(error)
|
|
71
58
|
await renderStatic(
|
|
72
|
-
<ErrorView
|
|
73
|
-
title="Built-in UI build failed"
|
|
74
|
-
message="Failed to build production UI assets"
|
|
75
|
-
details={[message]}
|
|
76
|
-
/>
|
|
59
|
+
<ErrorView title="App build failed" message="Failed to build the app" details={[message]} />
|
|
77
60
|
)
|
|
78
61
|
process.exit(1)
|
|
79
62
|
}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
import { dirname, resolve } from "node:path"
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import {
|
|
3
|
+
AppPackagesMissingError,
|
|
4
|
+
type CustomAppDevOptions,
|
|
5
|
+
type CustomAppDevServer,
|
|
6
|
+
createCustomApp,
|
|
7
|
+
} from "@sixb/app/server"
|
|
4
8
|
import { createSixbServer } from "@sixb/server"
|
|
5
9
|
import { resolveAgentTurnTimeoutMs } from "../lib/agent-turn-timeout"
|
|
6
|
-
import {
|
|
10
|
+
import {
|
|
11
|
+
apiDocsUrl,
|
|
12
|
+
apiEventsUrl,
|
|
13
|
+
apiUrl,
|
|
14
|
+
resolveBrowserTopology,
|
|
15
|
+
servedUrl,
|
|
16
|
+
} from "../lib/browser-topology"
|
|
7
17
|
import { type LoadedSixbHost, loadSixbFromEntry } from "../lib/loadSixb"
|
|
8
18
|
import { stopQuietly } from "../lib/role-lifecycle"
|
|
9
19
|
import { startSixbRuntime, stopSixbProviders } from "../lib/runtime"
|
|
10
20
|
import { generateProjectTypes } from "../lib/typegen"
|
|
11
|
-
import { resolveWorkerConcurrency } from "../lib/worker-concurrency"
|
|
21
|
+
import { resolveVectorConcurrency, resolveWorkerConcurrency } from "../lib/worker-concurrency"
|
|
12
22
|
import { DevView, LoadingView, renderCliError, renderPersistent } from "../ui"
|
|
13
23
|
|
|
14
24
|
export interface DevOptions {
|
|
@@ -18,10 +28,10 @@ export interface DevOptions {
|
|
|
18
28
|
apiPort?: string
|
|
19
29
|
apiHost?: string
|
|
20
30
|
apiPublicOrigin?: string
|
|
21
|
-
atlasPublicOrigin?: string
|
|
22
31
|
appPublicOrigin?: string
|
|
23
32
|
agentTurnTimeout?: string
|
|
24
33
|
concurrency?: readonly string[]
|
|
34
|
+
vectorConcurrency?: string
|
|
25
35
|
}
|
|
26
36
|
|
|
27
37
|
export async function runDevRuntime(options: DevOptions = {}) {
|
|
@@ -29,13 +39,13 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
29
39
|
|
|
30
40
|
const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
|
|
31
41
|
const workerConcurrency = resolveWorkerConcurrency(options.concurrency)
|
|
42
|
+
const vectorConcurrency = resolveVectorConcurrency(options.vectorConcurrency)
|
|
32
43
|
const entry = resolve(options.entry ?? "sixb.config.ts")
|
|
33
44
|
|
|
34
45
|
const app = renderPersistent(
|
|
35
46
|
<LoadingView title="Starting sixb" subtitle={entry} status="Loading runtime" />
|
|
36
47
|
)
|
|
37
48
|
|
|
38
|
-
let atlasServer: AtlasAppServer | null = null
|
|
39
49
|
let customAppServer: CustomAppDevServer | null = null
|
|
40
50
|
let sixb: LoadedSixbHost | null = null
|
|
41
51
|
let runtime: Awaited<ReturnType<typeof startSixbRuntime>> | null = null
|
|
@@ -56,8 +66,6 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
56
66
|
abort.signal.throwIfAborted()
|
|
57
67
|
const projectRoot = dirname(resolve(entry))
|
|
58
68
|
|
|
59
|
-
const customAppProbe = await createCustomApp({ rootDir: projectRoot })
|
|
60
|
-
const hasCustomApp = await customAppProbe.hasRoutes()
|
|
61
69
|
const topology = resolveBrowserTopology({
|
|
62
70
|
role: "dev",
|
|
63
71
|
host: options.host,
|
|
@@ -65,21 +73,16 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
65
73
|
port: options.port,
|
|
66
74
|
apiPort: options.apiPort,
|
|
67
75
|
apiPublicOrigin: options.apiPublicOrigin,
|
|
68
|
-
atlasPublicOrigin: options.atlasPublicOrigin,
|
|
69
76
|
appPublicOrigin: options.appPublicOrigin,
|
|
70
|
-
hasCustomApp,
|
|
71
77
|
})
|
|
72
78
|
const customApp = await createCustomApp({
|
|
73
79
|
rootDir: projectRoot,
|
|
74
80
|
apiBaseUrl: topology.apiPublicOrigin,
|
|
75
|
-
audience: "app",
|
|
76
81
|
authEnabled: host.auth.isEnabled(),
|
|
77
82
|
})
|
|
78
|
-
const authExperience =
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
})
|
|
82
|
-
: null
|
|
83
|
+
const authExperience = (await customApp.prepareAuthExperience()) ?? {
|
|
84
|
+
outdir: resolve(projectRoot, ".sixb", "generated", "auth"),
|
|
85
|
+
}
|
|
83
86
|
|
|
84
87
|
abort.signal.throwIfAborted()
|
|
85
88
|
const server = createSixbServer({
|
|
@@ -91,7 +94,7 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
91
94
|
publicOrigin: topology.apiPublicOrigin,
|
|
92
95
|
allowedOrigins: topology.allowedBrowserOrigins,
|
|
93
96
|
},
|
|
94
|
-
|
|
97
|
+
authExperience,
|
|
95
98
|
})
|
|
96
99
|
runtimeOwnsProviders = true
|
|
97
100
|
// The runtime owns the server's lifecycle so agent turns run only while it listens.
|
|
@@ -109,34 +112,13 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
109
112
|
agentApiBaseUrl: topology.apiPublicOrigin,
|
|
110
113
|
agentTurnTimeoutMs,
|
|
111
114
|
workerConcurrency,
|
|
115
|
+
vectorConcurrency,
|
|
112
116
|
})
|
|
113
117
|
abort.signal.throwIfAborted()
|
|
114
|
-
const authEnabled = host.auth.isEnabled()
|
|
115
118
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
authEnabled,
|
|
120
|
-
})
|
|
121
|
-
atlasServer = await atlas.start({
|
|
122
|
-
host: topology.host,
|
|
123
|
-
port: topology.atlasPort,
|
|
124
|
-
development: true,
|
|
125
|
-
})
|
|
126
|
-
abort.signal.throwIfAborted()
|
|
127
|
-
|
|
128
|
-
let appUrl: string | null = null
|
|
129
|
-
if (hasCustomApp) {
|
|
130
|
-
app.rerender(
|
|
131
|
-
<LoadingView title="Starting sixb" subtitle={entry} status="Starting custom app" />
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
customAppServer = await customApp.dev({
|
|
135
|
-
host: topology.host,
|
|
136
|
-
port: topology.appPort,
|
|
137
|
-
})
|
|
138
|
-
appUrl = topology.appPublicOrigin
|
|
139
|
-
}
|
|
119
|
+
app.rerender(<LoadingView title="Starting sixb" subtitle={entry} status="Starting app" />)
|
|
120
|
+
const devApp = await startDevApp(customApp, { host: topology.host, port: topology.appPort })
|
|
121
|
+
customAppServer = devApp.server
|
|
140
122
|
abort.signal.throwIfAborted()
|
|
141
123
|
|
|
142
124
|
app.rerender(
|
|
@@ -145,8 +127,7 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
145
127
|
apiUrl={apiUrl(topology)}
|
|
146
128
|
apiDocsUrl={apiDocsUrl(topology)}
|
|
147
129
|
wsUrl={apiEventsUrl(topology)}
|
|
148
|
-
|
|
149
|
-
appUrl={appUrl}
|
|
130
|
+
appUrl={customAppServer ? servedUrl(topology) : null}
|
|
150
131
|
workers={[
|
|
151
132
|
{ type: "agent", worker: runtime.agentWorker },
|
|
152
133
|
{ type: "projection", worker: runtime.projectionWorker },
|
|
@@ -156,12 +137,12 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
156
137
|
].flatMap(({ type, worker }) =>
|
|
157
138
|
worker ? [{ type, concurrency: worker.concurrency }] : []
|
|
158
139
|
)}
|
|
159
|
-
warnings={runtime.warnings}
|
|
140
|
+
warnings={devApp.warning ? [devApp.warning, ...runtime.warnings] : runtime.warnings}
|
|
160
141
|
/>
|
|
161
142
|
)
|
|
162
143
|
|
|
163
144
|
process.env.SIXB_DEV_READY = "1"
|
|
164
|
-
process.send?.({ type: "ready",
|
|
145
|
+
process.send?.({ type: "ready", watchesApp: customAppServer?.watchesSources ?? false })
|
|
165
146
|
|
|
166
147
|
await Promise.race([stopped, runtime.waitForWorkerFailure()])
|
|
167
148
|
} catch (error) {
|
|
@@ -175,10 +156,25 @@ export async function runDevRuntime(options: DevOptions = {}) {
|
|
|
175
156
|
process.env.SIXB_DEV_READY = ""
|
|
176
157
|
app.unmount()
|
|
177
158
|
await stopQuietly(() => customAppServer?.stop() ?? Promise.resolve())
|
|
178
|
-
await stopQuietly(() => atlasServer?.stop() ?? Promise.resolve())
|
|
179
159
|
await stopQuietly(() => runtime?.stop() ?? Promise.resolve())
|
|
180
160
|
if (sixb && !runtimeOwnsProviders) await stopSixbProviders(sixb)
|
|
181
161
|
process.off("SIGINT", requestShutdown)
|
|
182
162
|
process.off("SIGTERM", requestShutdown)
|
|
183
163
|
}
|
|
184
164
|
}
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* Starts the app's dev server. A project missing the packages the app is bundled from still gets
|
|
168
|
+
* its API, with the install command as a warning; `sixb build` refuses instead.
|
|
169
|
+
*/
|
|
170
|
+
export async function startDevApp(
|
|
171
|
+
customApp: { dev(options: CustomAppDevOptions): Promise<CustomAppDevServer> },
|
|
172
|
+
options: CustomAppDevOptions
|
|
173
|
+
): Promise<{ readonly server: CustomAppDevServer | null; readonly warning?: string }> {
|
|
174
|
+
try {
|
|
175
|
+
return { server: await customApp.dev(options) }
|
|
176
|
+
} catch (error) {
|
|
177
|
+
if (!(error instanceof AppPackagesMissingError)) throw error
|
|
178
|
+
return { server: null, warning: error.message.replace("[SixbCustomApp] ", "") }
|
|
179
|
+
}
|
|
180
|
+
}
|
|
@@ -5,7 +5,7 @@ import { runUntilSignal, stopQuietly } from "../lib/role-lifecycle"
|
|
|
5
5
|
import { recordApiPublicOrigin, stopSixbProviders, waitForWorkerFailure } from "../lib/runtime"
|
|
6
6
|
import { assertShareableProviders } from "../lib/shareable-providers"
|
|
7
7
|
import { migrateStorageForRole } from "../lib/storage-migration"
|
|
8
|
-
import { resolveWorkerConcurrency } from "../lib/worker-concurrency"
|
|
8
|
+
import { resolveVectorConcurrency, resolveWorkerConcurrency } from "../lib/worker-concurrency"
|
|
9
9
|
import {
|
|
10
10
|
agentRuntimeRequired,
|
|
11
11
|
assertWorkerInputs,
|
|
@@ -23,6 +23,7 @@ export interface WorkerGroupOptions {
|
|
|
23
23
|
apiPublicOrigin?: string
|
|
24
24
|
agentTurnTimeout?: string
|
|
25
25
|
concurrency?: readonly string[]
|
|
26
|
+
vectorConcurrency?: string
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
|
|
@@ -33,6 +34,7 @@ export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
|
|
|
33
34
|
const requestedTypes = (options.workerTypes ?? []).map(resolveWorkerTypeToStart)
|
|
34
35
|
const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
|
|
35
36
|
const workerConcurrency = resolveWorkerConcurrency(options.concurrency)
|
|
37
|
+
const vectorConcurrency = resolveVectorConcurrency(options.vectorConcurrency)
|
|
36
38
|
const entry = await resolveRuntimeEntry({ entry: options.entry })
|
|
37
39
|
|
|
38
40
|
const app = renderPersistent(
|
|
@@ -92,6 +94,7 @@ export async function runWorkerGroup(options: WorkerGroupOptions = {}) {
|
|
|
92
94
|
agentApiBaseUrl: options.apiPublicOrigin,
|
|
93
95
|
agentTurnTimeoutMs,
|
|
94
96
|
workerConcurrency,
|
|
97
|
+
vectorConcurrency,
|
|
95
98
|
})
|
|
96
99
|
)
|
|
97
100
|
await Promise.all(workers.map((worker) => worker.start()))
|
package/src/commands/worker.tsx
CHANGED
|
@@ -6,7 +6,7 @@ import { runUntilSignal, stopQuietly } from "../lib/role-lifecycle"
|
|
|
6
6
|
import { recordApiPublicOrigin, stopSixbProviders, waitForWorkerFailure } from "../lib/runtime"
|
|
7
7
|
import { assertShareableProviders } from "../lib/shareable-providers"
|
|
8
8
|
import { migrateStorageForRole } from "../lib/storage-migration"
|
|
9
|
-
import { resolveSingleWorkerConcurrency } from "../lib/worker-concurrency"
|
|
9
|
+
import { resolveSingleWorkerConcurrency, resolveVectorConcurrency } from "../lib/worker-concurrency"
|
|
10
10
|
import {
|
|
11
11
|
agentRuntimeRequired,
|
|
12
12
|
createWorkerForType,
|
|
@@ -23,6 +23,7 @@ export interface WorkerOptions {
|
|
|
23
23
|
apiPublicOrigin?: string
|
|
24
24
|
agentTurnTimeout?: string
|
|
25
25
|
concurrency?: string
|
|
26
|
+
vectorConcurrency?: string
|
|
26
27
|
}
|
|
27
28
|
|
|
28
29
|
export async function runWorker(options: WorkerOptions = {}) {
|
|
@@ -31,6 +32,7 @@ export async function runWorker(options: WorkerOptions = {}) {
|
|
|
31
32
|
const workerType = resolveWorkerTypeToStart(options.workerType)
|
|
32
33
|
const agentTurnTimeoutMs = resolveAgentTurnTimeoutMs(options.agentTurnTimeout)
|
|
33
34
|
const workerConcurrency = resolveSingleWorkerConcurrency(workerType, options.concurrency)
|
|
35
|
+
const vectorConcurrency = resolveVectorConcurrency(options.vectorConcurrency)
|
|
34
36
|
const entry = await resolveRuntimeEntry({ entry: options.entry })
|
|
35
37
|
|
|
36
38
|
const app = renderPersistent(
|
|
@@ -76,6 +78,7 @@ export async function runWorker(options: WorkerOptions = {}) {
|
|
|
76
78
|
agentApiBaseUrl: options.apiPublicOrigin,
|
|
77
79
|
agentTurnTimeoutMs,
|
|
78
80
|
workerConcurrency,
|
|
81
|
+
vectorConcurrency,
|
|
79
82
|
})
|
|
80
83
|
await worker.start()
|
|
81
84
|
|
package/src/index.tsx
CHANGED
|
@@ -102,10 +102,10 @@ async function main(): Promise<void> {
|
|
|
102
102
|
apiPort: getFlag("api-port"),
|
|
103
103
|
apiHost: getFlag("api-host"),
|
|
104
104
|
apiPublicOrigin: getFlag("api-public-origin"),
|
|
105
|
-
atlasPublicOrigin: getFlag("atlas-public-origin"),
|
|
106
105
|
appPublicOrigin: getFlag("app-public-origin"),
|
|
107
106
|
agentTurnTimeout: getFlag("agent-turn-timeout"),
|
|
108
107
|
concurrency: getFlags("concurrency"),
|
|
108
|
+
vectorConcurrency: getFlag("vector-concurrency"),
|
|
109
109
|
})
|
|
110
110
|
break
|
|
111
111
|
}
|
|
@@ -119,6 +119,7 @@ async function main(): Promise<void> {
|
|
|
119
119
|
apiPublicOrigin: getFlag("api-public-origin"),
|
|
120
120
|
agentTurnTimeout: getFlag("agent-turn-timeout"),
|
|
121
121
|
concurrency: getFlag("concurrency"),
|
|
122
|
+
vectorConcurrency: getFlag("vector-concurrency"),
|
|
122
123
|
})
|
|
123
124
|
break
|
|
124
125
|
}
|
|
@@ -132,6 +133,7 @@ async function main(): Promise<void> {
|
|
|
132
133
|
apiPublicOrigin: getFlag("api-public-origin"),
|
|
133
134
|
agentTurnTimeout: getFlag("agent-turn-timeout"),
|
|
134
135
|
concurrency: getFlags("concurrency"),
|
|
136
|
+
vectorConcurrency: getFlag("vector-concurrency"),
|
|
135
137
|
})
|
|
136
138
|
break
|
|
137
139
|
}
|
|
@@ -146,25 +148,12 @@ async function main(): Promise<void> {
|
|
|
146
148
|
apiPort: getFlag("api-port"),
|
|
147
149
|
apiHost: getFlag("api-host"),
|
|
148
150
|
apiPublicOrigin: getFlag("api-public-origin"),
|
|
149
|
-
atlasPublicOrigin: getFlag("atlas-public-origin"),
|
|
150
151
|
appPublicOrigin: getFlag("app-public-origin"),
|
|
151
152
|
trustedProxies: getFlag("trusted-proxies"),
|
|
152
153
|
})
|
|
153
154
|
break
|
|
154
155
|
}
|
|
155
156
|
|
|
156
|
-
case "atlas": {
|
|
157
|
-
const { runAtlas } = await import("./commands/atlas")
|
|
158
|
-
await runAtlas({
|
|
159
|
-
entry: getFlag("entry"),
|
|
160
|
-
port: getFlag("port"),
|
|
161
|
-
host: getFlag("host"),
|
|
162
|
-
apiPublicOrigin: getFlag("api-public-origin"),
|
|
163
|
-
atlasPublicOrigin: getFlag("atlas-public-origin"),
|
|
164
|
-
})
|
|
165
|
-
break
|
|
166
|
-
}
|
|
167
|
-
|
|
168
157
|
case "app": {
|
|
169
158
|
const { runApp } = await import("./commands/app")
|
|
170
159
|
await runApp({
|