@stigmer/cli 3.12.9 → 3.13.0
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/commands/up.d.ts.map +1 -1
- package/commands/up.js +22 -6
- package/commands/up.js.map +1 -1
- package/config/resolve.d.ts +5 -2
- package/config/resolve.d.ts.map +1 -1
- package/config/resolve.js +7 -4
- package/config/resolve.js.map +1 -1
- package/local/constants.d.ts +8 -3
- package/local/constants.d.ts.map +1 -1
- package/local/constants.js +8 -3
- package/local/constants.js.map +1 -1
- package/local/daemon/components.d.ts.map +1 -1
- package/local/daemon/components.js +4 -2
- package/local/daemon/components.js.map +1 -1
- package/local/daemon/env.d.ts +16 -3
- package/local/daemon/env.d.ts.map +1 -1
- package/local/daemon/env.js +16 -3
- package/local/daemon/env.js.map +1 -1
- package/local/daemon/launch.d.ts.map +1 -1
- package/local/daemon/launch.js +5 -4
- package/local/daemon/launch.js.map +1 -1
- package/local/daemon/process.d.ts.map +1 -1
- package/local/daemon/process.js +8 -5
- package/local/daemon/process.js.map +1 -1
- package/local/runtime/index.d.ts +2 -2
- package/local/runtime/index.d.ts.map +1 -1
- package/local/runtime/index.js +4 -2
- package/local/runtime/index.js.map +1 -1
- package/local/runtime/node.d.ts +8 -0
- package/local/runtime/node.d.ts.map +1 -1
- package/local/runtime/node.js +74 -23
- package/local/runtime/node.js.map +1 -1
- package/local/runtime/runner.d.ts +2 -1
- package/local/runtime/runner.d.ts.map +1 -1
- package/local/runtime/runner.js +4 -31
- package/local/runtime/runner.js.map +1 -1
- package/local/runtime/runtimes-install.d.ts +13 -0
- package/local/runtime/runtimes-install.d.ts.map +1 -0
- package/local/runtime/runtimes-install.js +60 -0
- package/local/runtime/runtimes-install.js.map +1 -0
- package/local/runtime/server.d.ts +26 -30
- package/local/runtime/server.d.ts.map +1 -1
- package/local/runtime/server.js +106 -108
- package/local/runtime/server.js.map +1 -1
- package/local/status.d.ts.map +1 -1
- package/local/status.js +4 -2
- package/local/status.js.map +1 -1
- package/local/webconsole/index.d.ts +2 -3
- package/local/webconsole/index.d.ts.map +1 -1
- package/local/webconsole/index.js +24 -10
- package/local/webconsole/index.js.map +1 -1
- package/package.json +5 -5
- package/src/commands/up.ts +24 -6
- package/src/config/resolve.test.ts +1 -1
- package/src/config/resolve.ts +7 -4
- package/src/local/constants.ts +8 -4
- package/src/local/daemon/components.test.ts +9 -1
- package/src/local/daemon/components.ts +4 -2
- package/src/local/daemon/daemon.integration.test.ts +1 -1
- package/src/local/daemon/env.test.ts +15 -4
- package/src/local/daemon/env.ts +33 -5
- package/src/local/daemon/launch.ts +5 -4
- package/src/local/daemon/process.ts +7 -4
- package/src/local/runtime/index.ts +6 -5
- package/src/local/runtime/node.ts +99 -23
- package/src/local/runtime/runner.ts +5 -36
- package/src/local/runtime/runtime.test.ts +58 -14
- package/src/local/runtime/runtimes-install.test.ts +56 -0
- package/src/local/runtime/runtimes-install.ts +72 -0
- package/src/local/runtime/server.test.ts +178 -114
- package/src/local/runtime/server.ts +149 -129
- package/src/local/status.ts +4 -2
- package/src/local/webconsole/index.ts +27 -10
- package/src/resources/connect/oauth.test.ts +1 -1
- package/src/resources/share.test.ts +2 -2
package/local/runtime/server.js
CHANGED
|
@@ -1,135 +1,133 @@
|
|
|
1
|
-
// Resolution and on-demand acquisition of the
|
|
1
|
+
// Resolution and on-demand acquisition of the stigmer server — the
|
|
2
|
+
// TypeScript implementation serving since the DD-006 cutover (D4 #24; the Go
|
|
3
|
+
// binary ladder that backed rollback retired with #25).
|
|
2
4
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
// with the Temporal downloader (`../artifact.ts`); the one deliberate difference
|
|
8
|
-
// is the checksum step — this is our own executable, and DD-003 makes integrity
|
|
9
|
-
// non-negotiable.
|
|
5
|
+
// The server is launched exactly like the runner: a compiled `node main.js`,
|
|
6
|
+
// never `tsx src/main.ts` (the workers bundle Temporal workflows on boot in
|
|
7
|
+
// dev shape, and the slim artifact ships pre-built bundles — either way the
|
|
8
|
+
// entry must be compiled; see the server package's workflow-source.ts).
|
|
10
9
|
//
|
|
11
|
-
// Resolution order (
|
|
12
|
-
// 1.
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
10
|
+
// Resolution order (the D2 §6 switch semantics):
|
|
11
|
+
// 1. STIGMER_SERVER_DIR — an explicit server package dir (dist/main.js
|
|
12
|
+
// required), the STIGMER_RUNNER_DIR mirror.
|
|
13
|
+
// 2. The repo-tree server package (dev; build required).
|
|
14
|
+
// 3. The published `@stigmer/server-slim`, installed on demand into
|
|
15
|
+
// ~/.stigmer/runtimes/<version>/ alongside the runner's package — one
|
|
16
|
+
// CJS main.js, pre-built workflow bundles, and the per-platform
|
|
17
|
+
// Temporal native bridge selected by npm via optionalDependencies.
|
|
18
18
|
import { existsSync } from "node:fs";
|
|
19
19
|
import { homedir } from "node:os";
|
|
20
20
|
import { dirname, join } from "node:path";
|
|
21
21
|
import { fileURLToPath } from "node:url";
|
|
22
22
|
import { CliExitError } from "../../errors/cli-exit-error.js";
|
|
23
23
|
import { ExitCode } from "../../errors/exit-codes.js";
|
|
24
|
+
import { log } from "../../logger.js";
|
|
24
25
|
import { VERSION } from "../../version.js";
|
|
25
|
-
import {
|
|
26
|
-
import {
|
|
27
|
-
import {
|
|
28
|
-
const
|
|
29
|
-
const GITHUB_REPO = "stigmer/stigmer";
|
|
30
|
-
// Platform/arch combos for which `release.cli.yaml` publishes a stigmer-server
|
|
31
|
-
// asset. The npm CLI installs on more platforms than this (e.g. linux-arm64,
|
|
32
|
-
// Windows), so an unsupported `stigmer up` must fail with clear guidance rather
|
|
33
|
-
// than a confusing 404.
|
|
34
|
-
const SUPPORTED_PLATFORMS = new Set(["darwin-arm64", "darwin-amd64", "linux-amd64"]);
|
|
26
|
+
import { runtimesDir } from "../paths.js";
|
|
27
|
+
import { resolveServerNode } from "./node.js";
|
|
28
|
+
import { ensureRuntimesRoot, isAcquirableRelease, npmInstallIntoRuntimes, } from "./runtimes-install.js";
|
|
29
|
+
const SLIM_PACKAGE = "@stigmer/server-slim";
|
|
35
30
|
/**
|
|
36
|
-
*
|
|
37
|
-
*
|
|
31
|
+
* Resolve what the daemon launches as `stigmer-server`: the explicit
|
|
32
|
+
* STIGMER_SERVER_DIR override, then the repo tree, then acquiring the
|
|
33
|
+
* published slim package. Throws actionable guidance on a missing build, an
|
|
34
|
+
* invalid override, or a non-release CLI build with nothing local.
|
|
38
35
|
*/
|
|
39
|
-
export function
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
return
|
|
36
|
+
export function ensureServer(opts = {}) {
|
|
37
|
+
const node = opts.node ?? resolveServerNode;
|
|
38
|
+
const local = resolveServerTs(node);
|
|
39
|
+
if (local !== null)
|
|
40
|
+
return local;
|
|
41
|
+
return acquireServer({ ...opts, node });
|
|
45
42
|
}
|
|
46
43
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
44
|
+
* Resolve a repo-tree TS server (dev) or an explicit STIGMER_SERVER_DIR, or
|
|
45
|
+
* null when neither is present (the caller then acquires the slim package).
|
|
46
|
+
* Throws when an override is set but invalid, or when a found server is not
|
|
47
|
+
* built — both are actionable user-facing conditions, not a reason to
|
|
48
|
+
* silently download. `node` is injectable for tests.
|
|
52
49
|
*/
|
|
53
|
-
export
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
50
|
+
export function resolveServerTs(node = resolveServerNode) {
|
|
51
|
+
const override = process.env.STIGMER_SERVER_DIR;
|
|
52
|
+
if (override !== undefined && override !== "") {
|
|
53
|
+
if (!hasPackageJson(override)) {
|
|
54
|
+
throw new CliExitError(`STIGMER_SERVER_DIR is not a server package: ${override}`, ExitCode.General, [
|
|
55
|
+
"Point STIGMER_SERVER_DIR at the @stigmer/server package directory (the one with package.json).",
|
|
56
|
+
]);
|
|
57
|
+
}
|
|
58
|
+
return resolveBuiltServer(override, node);
|
|
59
|
+
}
|
|
60
|
+
const root = repoRoot();
|
|
61
|
+
if (root !== null) {
|
|
62
|
+
const candidate = join(root, "backend", "services", "stigmer-server");
|
|
63
|
+
if (hasPackageJson(candidate))
|
|
64
|
+
return resolveBuiltServer(candidate, node);
|
|
61
65
|
}
|
|
62
|
-
|
|
63
|
-
await downloadServerBinary({ version, binPath, fetchImpl: opts.fetchImpl });
|
|
64
|
-
return binPath;
|
|
66
|
+
return null;
|
|
65
67
|
}
|
|
66
68
|
/**
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
*
|
|
69
|
+
* Acquire the published `@stigmer/server-slim@<version>` into
|
|
70
|
+
* ~/.stigmer/runtimes/<version>/ (idempotent: reuses a prior install; shares
|
|
71
|
+
* the install root with the runner's package) and resolve its `main.js`
|
|
72
|
+
* entry. The version is pinned to the CLI's own version so the server's
|
|
73
|
+
* protos and behavior stay in lockstep with the CLI and the runner.
|
|
70
74
|
*/
|
|
71
|
-
export
|
|
72
|
-
const
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
export function acquireServer(opts = {}) {
|
|
76
|
+
const home = opts.home ?? homedir();
|
|
77
|
+
const version = opts.version ?? VERSION;
|
|
78
|
+
if (!isAcquirableRelease(version)) {
|
|
79
|
+
throw new CliExitError(`cannot acquire ${SLIM_PACKAGE} for a non-release build (${version})`, ExitCode.General, [
|
|
80
|
+
"Run from the repo with a built server (make build-server), or set",
|
|
81
|
+
"STIGMER_SERVER_DIR to a built server package.",
|
|
82
|
+
"On-demand acquisition is only available for published releases.",
|
|
83
|
+
]);
|
|
77
84
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
}
|
|
102
|
-
// Only tagged releases publish a downloadable asset. A source build reports the
|
|
103
|
-
// "0.0.0-dev" sentinel and the dev npm channel stamps "<v>-dev.<stamp>" versions
|
|
104
|
-
// (release.dev.yaml) that never cut a GitHub release — neither is downloadable.
|
|
105
|
-
function isDownloadableRelease(version) {
|
|
106
|
-
return !version.includes("-dev");
|
|
107
|
-
}
|
|
108
|
-
// The npm package version maps to the GitHub release tag by prefixing "v"
|
|
109
|
-
// (npm 0.5.0 -> tag v0.5.0; npm 0.5.0-rc.1 -> tag v0.5.0-rc.1).
|
|
110
|
-
function releaseTag(version) {
|
|
111
|
-
return version.startsWith("v") ? version : `v${version}`;
|
|
85
|
+
// Probe the Node capability BEFORE the download: a user on an FTS5-less
|
|
86
|
+
// Node must not fetch the full slim artifact only to be rejected after.
|
|
87
|
+
const node = opts.node ?? resolveServerNode;
|
|
88
|
+
const nodeBin = node();
|
|
89
|
+
const installDir = join(runtimesDir(home), version);
|
|
90
|
+
const entryPath = join(installDir, "node_modules", "@stigmer", "server-slim", "main.js");
|
|
91
|
+
if (!existsSync(entryPath)) {
|
|
92
|
+
log.info(`acquiring ${SLIM_PACKAGE}`, { version, dir: installDir });
|
|
93
|
+
ensureRuntimesRoot(installDir);
|
|
94
|
+
const install = opts.install ?? npmInstallIntoRuntimes;
|
|
95
|
+
install(installDir, `${SLIM_PACKAGE}@${version}`);
|
|
96
|
+
}
|
|
97
|
+
if (!existsSync(entryPath)) {
|
|
98
|
+
throw new CliExitError(`${SLIM_PACKAGE} install did not produce ${entryPath}`, ExitCode.General, [
|
|
99
|
+
"The install may have skipped the platform-native package for this OS/arch.",
|
|
100
|
+
`Remove ${installDir} and retry, or set STIGMER_SERVER_DIR to a built server.`,
|
|
101
|
+
]);
|
|
102
|
+
}
|
|
103
|
+
return {
|
|
104
|
+
nodeBin,
|
|
105
|
+
entryPath,
|
|
106
|
+
appDir: dirname(entryPath),
|
|
107
|
+
};
|
|
112
108
|
}
|
|
113
|
-
function
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
109
|
+
function resolveBuiltServer(appDir, node) {
|
|
110
|
+
const entryPath = join(appDir, "dist", "main.js");
|
|
111
|
+
if (!existsSync(entryPath)) {
|
|
112
|
+
throw new CliExitError(`TS server not built: ${entryPath} is missing`, ExitCode.General, [
|
|
113
|
+
"Build it with: make build-server",
|
|
114
|
+
"The server must be compiled — it cannot run from source via tsx (its",
|
|
115
|
+
"Temporal workers bundle workflow code from the compiled dist).",
|
|
116
|
+
"STIGMER_SERVER_DIR expects the source package (dist/main.js); to run an",
|
|
117
|
+
"acquired @stigmer/server-slim install, unset it — the CLI resolves that",
|
|
118
|
+
"shape itself.",
|
|
119
|
+
]);
|
|
120
|
+
}
|
|
121
|
+
return { nodeBin: node(), entryPath, appDir };
|
|
119
122
|
}
|
|
120
|
-
function
|
|
121
|
-
return
|
|
122
|
-
"`stigmer up` needs a stigmer-server release asset, which is published for",
|
|
123
|
-
"macOS (arm64/amd64) and Linux (amd64) only.",
|
|
124
|
-
"Point STIGMER_SERVER_BIN at a server binary you built yourself to proceed.",
|
|
125
|
-
]);
|
|
123
|
+
function hasPackageJson(dir) {
|
|
124
|
+
return existsSync(join(dir, "package.json"));
|
|
126
125
|
}
|
|
127
|
-
// Walk up from this module to
|
|
128
|
-
// `bin/stigmer-server` in a dev checkout). Returns null outside a checkout.
|
|
126
|
+
// Walk up from this module to a repo root containing the TS server package.
|
|
129
127
|
function repoRoot() {
|
|
130
128
|
let dir = dirname(fileURLToPath(import.meta.url));
|
|
131
|
-
for (let i = 0; i <
|
|
132
|
-
if (existsSync(join(dir, "
|
|
129
|
+
for (let i = 0; i < 10; i += 1) {
|
|
130
|
+
if (existsSync(join(dir, "backend", "services", "stigmer-server", "package.json")))
|
|
133
131
|
return dir;
|
|
134
132
|
const parent = dirname(dir);
|
|
135
133
|
if (parent === dir)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/local/runtime/server.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../../../src/local/runtime/server.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,6EAA6E;AAC7E,wDAAwD;AACxD,EAAE;AACF,6EAA6E;AAC7E,4EAA4E;AAC5E,4EAA4E;AAC5E,wEAAwE;AACxE,EAAE;AACF,iDAAiD;AACjD,yEAAyE;AACzE,iDAAiD;AACjD,2DAA2D;AAC3D,sEAAsE;AACtE,2EAA2E;AAC3E,qEAAqE;AACrE,wEAAwE;AAExE,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,gCAAgC,CAAC;AAC9D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AACtD,OAAO,EAAE,GAAG,EAAE,MAAM,iBAAiB,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAAW,CAAC;AAC9C,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,sBAAsB,GAEvB,MAAM,uBAAuB,CAAC;AAE/B,MAAM,YAAY,GAAG,sBAAsB,CAAC;AAY5C;;;;;GAKG;AACH,MAAM,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kB,CAAC,MAAc,EAAE,IAAkB;IAC5D,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC;IAClD,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QAC3B,MAAM,IAAI,YAAY,CACpB,wBAAwB,SAAS,aAAa,EAC9C,QAAQ,CAAC,OAAO,EAChB;YACE,kCAAkC;YAClC,sEAAsE;YACtE,gEAAgE;YAChE,yEAAyE;YACzE,yEAAyE;YACzE,eAAe;SAChB,CACF,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAChD,CAAC;AAED,SAAS,cAAc,CAAC,GAAW;IACjC,OAAO,UAAU,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,4EAA4E;AAC5E,SAAS,QAAQ;IACf,IAAI,GAAG,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC;QAC/B,IACE,UAAU,CACR,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,UAAU,EAAE,gBAAgB,EAAE,cAAc,CAAC,CACnE;YAED,OAAO,GAAG,CAAC;QACb,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC5B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/local/status.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkB5D;wEACwE;AACxE,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAI3D,oEAAoE;AACpE,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAAkB,EAAE,KAAK,GAAE,SAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmCzH;
|
|
1
|
+
{"version":3,"file":"status.d.ts","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkB5D;wEACwE;AACxE,MAAM,MAAM,SAAS,GAAG,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;AAI3D,oEAAoE;AACpE,wBAAsB,iBAAiB,CAAC,IAAI,GAAE,MAAkB,EAAE,KAAK,GAAE,SAAwB,GAAG,OAAO,CAAC,aAAa,CAAC,CAmCzH;AAuGD,iEAAiE;AACjE,wBAAgB,cAAc,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAWjD"}
|
package/local/status.js
CHANGED
|
@@ -11,7 +11,7 @@ import { join } from "node:path";
|
|
|
11
11
|
import { load as loadConfig } from "../config/config.js";
|
|
12
12
|
import { configPath } from "../config/paths.js";
|
|
13
13
|
import { CommandResult } from "../output/command-result.js";
|
|
14
|
-
import { SERVER_PORT, TEMPORAL_UI_PORT
|
|
14
|
+
import { SERVER_PORT, TEMPORAL_UI_PORT } from "./constants.js";
|
|
15
15
|
import { resolveApiKey, resolveProvider } from "./llm-config.js";
|
|
16
16
|
import { tcpConnects } from "./net/tcp.js";
|
|
17
17
|
import { dataDir } from "./paths.js";
|
|
@@ -123,8 +123,10 @@ function addWebUiSection(result, health) {
|
|
|
123
123
|
if (!temporalRunning && !webRunning)
|
|
124
124
|
return;
|
|
125
125
|
const section = result.addSection("Web UI");
|
|
126
|
+
// The console shares the server's unified port (DD-012) — same origin as
|
|
127
|
+
// the API, served by the server itself.
|
|
126
128
|
if (webRunning)
|
|
127
|
-
section.field("Console", `http://localhost:${
|
|
129
|
+
section.field("Console", `http://localhost:${SERVER_PORT}`);
|
|
128
130
|
if (temporalRunning)
|
|
129
131
|
section.field("Temporal", `http://localhost:${TEMPORAL_UI_PORT}`);
|
|
130
132
|
}
|
package/local/status.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,
|
|
1
|
+
{"version":3,"file":"status.js","sourceRoot":"","sources":["../../src/local/status.ts"],"names":[],"mappings":"AAAA,6EAA6E;AAC7E,EAAE;AACF,yEAAyE;AACzE,gFAAgF;AAChF,gFAAgF;AAChF,iFAAiF;AACjF,8EAA8E;AAC9E,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,IAAI,IAAI,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,WAAW,E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,OAAO,GAAG,CAAC;IAClD,OAAO,GAAG,OAAO,GAAG,CAAC;AACvB,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/** Whether
|
|
2
|
-
|
|
3
|
-
export declare function isWebConsoleAvailable(): boolean;
|
|
1
|
+
/** Whether the running server serves a bundled web console. */
|
|
2
|
+
export declare function isWebConsoleAvailable(serverPort?: number): Promise<boolean>;
|
|
4
3
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/webconsole/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/local/webconsole/index.ts"],"names":[],"mappings":"AAiBA,+DAA+D;AAC/D,wBAAsB,qBAAqB,CACzC,UAAU,GAAE,MAAoB,GAC/B,OAAO,CAAC,OAAO,CAAC,CASlB"}
|
|
@@ -1,13 +1,27 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Web-console availability against the server's unified port.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
// :
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
3
|
+
// Since DD-012 (oss sub-project console-serving) the SERVER serves the
|
|
4
|
+
// console: the static export ships inside @stigmer/server-slim and the
|
|
5
|
+
// unified port's lane 4 serves it, synthesizing /config.json in-process.
|
|
6
|
+
// The CLI therefore PROBES rather than serves — /config.json answers 200
|
|
7
|
+
// exactly when a console export is bundled with the running server (a
|
|
8
|
+
// dev-tree server without the export falls through to the RPC adapter's
|
|
9
|
+
// 404), so the daemon's component state reports what a browser would
|
|
10
|
+
// actually find. The Go-era embedded console (go:embed on :8234) and the
|
|
11
|
+
// T05/T06 stub this file used to be are both retired by that design.
|
|
12
|
+
import { SERVER_PORT } from "../constants.js";
|
|
13
|
+
/** Keep the daemon's settle path snappy: a hung probe must not stall `stigmer up`. */
|
|
14
|
+
const PROBE_TIMEOUT_MS = 3000;
|
|
15
|
+
/** Whether the running server serves a bundled web console. */
|
|
16
|
+
export async function isWebConsoleAvailable(serverPort = SERVER_PORT) {
|
|
17
|
+
try {
|
|
18
|
+
const response = await fetch(`http://127.0.0.1:${serverPort}/config.json`, {
|
|
19
|
+
signal: AbortSignal.timeout(PROBE_TIMEOUT_MS),
|
|
20
|
+
});
|
|
21
|
+
return response.ok;
|
|
22
|
+
}
|
|
23
|
+
catch {
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
12
26
|
}
|
|
13
27
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/local/webconsole/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/local/webconsole/index.ts"],"names":[],"mappings":"AAAA,8DAA8D;AAC9D,EAAE;AACF,uEAAuE;AACvE,uEAAuE;AACvE,yEAAyE;AACzE,yEAAyE;AACzE,sEAAsE;AACtE,wEAAwE;AACxE,qEAAqE;AACrE,yEAAyE;AACzE,qEAAqE;AAErE,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,sFAAsF;AACtF,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAE9B,+DAA+D;AAC/D,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,aAAqB,WAAW;IAEhC,IAAI,CAAC;QACH,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,oBAAoB,UAAU,cAAc,EAAE;YACzE,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,gBAAgB,CAAC;SAC9C,CAAC,CAAC;QACH,OAAO,QAAQ,CAAC,EAAE,CAAC;IACrB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.13.0",
|
|
4
4
|
"description": "Stigmer command-line interface — manage agents, workflows, MCP servers, skills, and executions from the terminal",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -35,10 +35,10 @@
|
|
|
35
35
|
"@connectrpc/connect": "^2.0.0",
|
|
36
36
|
"@connectrpc/connect-node": "^2.1.1",
|
|
37
37
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
38
|
-
"@stigmer/ink": "3.
|
|
39
|
-
"@stigmer/mcp-server": "3.
|
|
40
|
-
"@stigmer/protos": "3.
|
|
41
|
-
"@stigmer/sdk": "3.
|
|
38
|
+
"@stigmer/ink": "3.13.0",
|
|
39
|
+
"@stigmer/mcp-server": "3.13.0",
|
|
40
|
+
"@stigmer/protos": "3.13.0",
|
|
41
|
+
"@stigmer/sdk": "3.13.0",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"fflate": "^0.8.3",
|
|
44
44
|
"ink": "^7.0.0",
|
package/src/commands/up.ts
CHANGED
|
@@ -6,9 +6,11 @@
|
|
|
6
6
|
// outcome. The launcher (and the heavy resolvers it pulls in) load lazily so
|
|
7
7
|
// `--help` stays fast (DD-001).
|
|
8
8
|
|
|
9
|
+
import { homedir } from "node:os";
|
|
10
|
+
import { join } from "node:path";
|
|
9
11
|
import type { Command } from "commander";
|
|
10
12
|
import { CommandResult, type OutputFlags, renderResult } from "../output/index.js";
|
|
11
|
-
import { SERVER_PORT } from "../local/constants.js";
|
|
13
|
+
import { HEALTH_STATE_FILE, SERVER_PORT } from "../local/constants.js";
|
|
12
14
|
import { addResultFlags, resultFormat } from "./shared.js";
|
|
13
15
|
|
|
14
16
|
interface UpFlags extends OutputFlags {
|
|
@@ -16,15 +18,17 @@ interface UpFlags extends OutputFlags {
|
|
|
16
18
|
web?: boolean; // false when --no-web is passed
|
|
17
19
|
}
|
|
18
20
|
|
|
21
|
+
// The server serves the web console from its unified port (DD-012); the
|
|
22
|
+
// flag suppresses probing/reporting it, not the serving itself (one
|
|
23
|
+
// process, one origin — there is no separate console to not-start).
|
|
24
|
+
const NO_WEB_HELP = "don't report the web console URL";
|
|
25
|
+
|
|
19
26
|
export function registerUp(program: Command): void {
|
|
20
27
|
const up = program
|
|
21
28
|
.command("up")
|
|
22
29
|
.description("start the local Stigmer stack (server, runner, Temporal)")
|
|
23
30
|
.option("--server-only", "start only the control plane (no runners)")
|
|
24
|
-
|
|
25
|
-
// local web console, so the stack is headless either way (use the cloud
|
|
26
|
-
// console at app.stigmer.ai for a UI).
|
|
27
|
-
.option("--no-web", "no-op: this CLI does not serve a local web console")
|
|
31
|
+
.option("--no-web", NO_WEB_HELP)
|
|
28
32
|
.action((options: UpFlags) =>
|
|
29
33
|
runUp({ serverOnly: options.serverOnly === true, noWeb: options.web === false }, options),
|
|
30
34
|
);
|
|
@@ -33,7 +37,7 @@ export function registerUp(program: Command): void {
|
|
|
33
37
|
const server = up
|
|
34
38
|
.command("server")
|
|
35
39
|
.description("start only the control plane (no runners)")
|
|
36
|
-
.option("--no-web",
|
|
40
|
+
.option("--no-web", NO_WEB_HELP)
|
|
37
41
|
.action((options: UpFlags) => runUp({ serverOnly: true, noWeb: options.web === false }, options));
|
|
38
42
|
addResultFlags(server);
|
|
39
43
|
}
|
|
@@ -46,6 +50,20 @@ async function runUp(opts: { serverOnly: boolean; noWeb: boolean }, flags: Outpu
|
|
|
46
50
|
const result = CommandResult.success(opts.serverOnly ? "Stigmer control plane is up" : "Stigmer local stack is up");
|
|
47
51
|
const section = result.addSection("Endpoints");
|
|
48
52
|
section.field("server", `http://localhost:${SERVER_PORT}`);
|
|
53
|
+
if (await consoleReported()) {
|
|
54
|
+
// Same origin as the API: the server serves the console (DD-012). Only
|
|
55
|
+
// printed when the daemon's probe found a bundled export — a dev-tree
|
|
56
|
+
// server without one must not advertise a dead URL.
|
|
57
|
+
section.field("console", `http://localhost:${SERVER_PORT}`);
|
|
58
|
+
}
|
|
49
59
|
result.hint("Check status with: stigmer status").hint("Stop it with: stigmer down");
|
|
50
60
|
renderResult(result, resultFormat(flags));
|
|
51
61
|
}
|
|
62
|
+
|
|
63
|
+
/** Whether the daemon recorded the web console as running (its own probe). */
|
|
64
|
+
async function consoleReported(): Promise<boolean> {
|
|
65
|
+
const { dataDir } = await import("../local/paths.js");
|
|
66
|
+
const { loadHealthState } = await import("../local/state/health-state.js");
|
|
67
|
+
const health = loadHealthState(join(dataDir(homedir()), HEALTH_STATE_FILE));
|
|
68
|
+
return health?.components["web-console"]?.state === "running";
|
|
69
|
+
}
|
|
@@ -109,7 +109,7 @@ describe("resolveConsoleURL", () => {
|
|
|
109
109
|
});
|
|
110
110
|
|
|
111
111
|
it("uses the local web-console port for the local backend", () => {
|
|
112
|
-
expect(resolveConsoleURL("local", {} as NodeJS.ProcessEnv)).toBe("http://localhost:
|
|
112
|
+
expect(resolveConsoleURL("local", {} as NodeJS.ProcessEnv)).toBe("http://localhost:7234");
|
|
113
113
|
});
|
|
114
114
|
|
|
115
115
|
it("uses the cloud console URL for the cloud backend", () => {
|
package/src/config/resolve.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
// precedence keeps every call site consistent (mirrors the Go CLI's Resolve*).
|
|
4
4
|
|
|
5
5
|
import { CliExitError, ExitCode } from "../errors/index.js";
|
|
6
|
-
import {
|
|
6
|
+
import { SERVER_PORT } from "../local/constants.js";
|
|
7
7
|
import { type BackendType, type Config, isCloudMode } from "./config.js";
|
|
8
8
|
|
|
9
9
|
const DEFAULT_CLOUD_ENDPOINT = "api.stigmer.ai:443";
|
|
@@ -76,17 +76,20 @@ export function resolveOrganization(config: Config, flagOrg?: string): string {
|
|
|
76
76
|
/**
|
|
77
77
|
* Resolve the web console URL:
|
|
78
78
|
* 1. `STIGMER_CONSOLE_URL` (explicit override)
|
|
79
|
-
* 2. local backend → `http://localhost:{
|
|
79
|
+
* 2. local backend → `http://localhost:{SERVER_PORT}` — the server's own
|
|
80
|
+
* unified port serves the console since DD-012 (one origin for UI and
|
|
81
|
+
* API; the Go-era separate 8234 listener is retired)
|
|
80
82
|
* 3. cloud backend → {@link DEFAULT_CLOUD_CONSOLE_URL}
|
|
81
83
|
*
|
|
82
84
|
* The console origin is also the app origin that serves the hosted chat
|
|
83
85
|
* page (`/chat/<org>/<slug>`) and the embed loader (`/embed.js`), so
|
|
84
|
-
* share-link builders use this same resolver
|
|
86
|
+
* share-link builders use this same resolver — both routes live in the
|
|
87
|
+
* same static export the server serves.
|
|
85
88
|
*/
|
|
86
89
|
export function resolveConsoleURL(backendType: BackendType, env: NodeJS.ProcessEnv = process.env): string {
|
|
87
90
|
const override = env.STIGMER_CONSOLE_URL;
|
|
88
91
|
if (override !== undefined && override !== "") return override;
|
|
89
|
-
if (backendType === "local") return `http://localhost:${
|
|
92
|
+
if (backendType === "local") return `http://localhost:${SERVER_PORT}`;
|
|
90
93
|
return DEFAULT_CLOUD_CONSOLE_URL;
|
|
91
94
|
}
|
|
92
95
|
|
package/src/local/constants.ts
CHANGED
|
@@ -7,12 +7,16 @@
|
|
|
7
7
|
// runner-poll can never drift (see the T05 plan's "Critical correctness
|
|
8
8
|
// finding").
|
|
9
9
|
|
|
10
|
-
/**
|
|
10
|
+
/**
|
|
11
|
+
* Port `stigmer-server` listens on (gRPC). Matches the Go CLI's `DaemonPort`.
|
|
12
|
+
*
|
|
13
|
+
* This is also the web console's origin: since DD-012 the server serves the
|
|
14
|
+
* console's static export on this same unified port (lane 4), so the Go-era
|
|
15
|
+
* WEB_CONSOLE_PORT (8234, a separate CLI-embedded listener) is retired —
|
|
16
|
+
* one process, one origin, no CORS hop.
|
|
17
|
+
*/
|
|
11
18
|
export const SERVER_PORT = 7234;
|
|
12
19
|
|
|
13
|
-
/** Port the embedded web console is served on (7xxx=API, 8xxx=UI convention). */
|
|
14
|
-
export const WEB_CONSOLE_PORT = 8234;
|
|
15
|
-
|
|
16
20
|
/** Temporal frontend gRPC port (dev server default). */
|
|
17
21
|
export const TEMPORAL_PORT = 7233;
|
|
18
22
|
|
|
@@ -11,7 +11,7 @@ const config: DaemonConfig = {
|
|
|
11
11
|
temporalAddress: "127.0.0.1:7233",
|
|
12
12
|
serverOnly: false,
|
|
13
13
|
noWeb: false,
|
|
14
|
-
|
|
14
|
+
server: { nodeBin: "/bin/node", entryPath: "/repo/server/dist/main.js", appDir: "/repo/server" },
|
|
15
15
|
runner: { nodeBin: "/bin/node", entryPath: "/repo/runner/dist/main.js", appDir: "/repo/runner" },
|
|
16
16
|
};
|
|
17
17
|
|
|
@@ -133,6 +133,14 @@ describe("buildComponents", () => {
|
|
|
133
133
|
expect(runner.resolve().args).toEqual(["/repo/runner/dist/main.js"]);
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
+
// The TS server child is `node <entry>` — the runner's launch shape.
|
|
137
|
+
it("spawns the node-shape server as node + entry", () => {
|
|
138
|
+
const [server] = buildComponents(config, {});
|
|
139
|
+
const spawn = server.resolve();
|
|
140
|
+
expect(spawn.command).toBe("/bin/node");
|
|
141
|
+
expect(spawn.args).toEqual(["/repo/server/dist/main.js"]);
|
|
142
|
+
});
|
|
143
|
+
|
|
136
144
|
it("omits the runner in server-only mode", () => {
|
|
137
145
|
const components = buildComponents({ ...config, serverOnly: true }, {});
|
|
138
146
|
expect(components.map((c) => c.name)).toEqual(["stigmer-server"]);
|
|
@@ -91,9 +91,11 @@ export function buildComponents(config: DaemonConfig, base: NodeJS.ProcessEnv =
|
|
|
91
91
|
name: "stigmer-server",
|
|
92
92
|
pidFile: join(config.dataDir, SERVER_PID_FILE),
|
|
93
93
|
critical: true,
|
|
94
|
+
// The server is `node <entry>` — the runner's launch shape, one child
|
|
95
|
+
// contract for both components.
|
|
94
96
|
resolve: () => ({
|
|
95
|
-
command: config.
|
|
96
|
-
args: [],
|
|
97
|
+
command: config.server.nodeBin,
|
|
98
|
+
args: [config.server.entryPath],
|
|
97
99
|
env: buildServerEnv(config, base),
|
|
98
100
|
logFile: join(config.logDir, "stigmer-server.log"),
|
|
99
101
|
}),
|
|
@@ -128,7 +128,7 @@ describe("runInternalDaemon (full body with fakes)", () => {
|
|
|
128
128
|
temporalAddress: "127.0.0.1:7233",
|
|
129
129
|
serverOnly: false,
|
|
130
130
|
noWeb: true,
|
|
131
|
-
|
|
131
|
+
server: { nodeBin: "node-cmd", entryPath: join(data, "server-entry.js"), appDir: data },
|
|
132
132
|
runner: { nodeBin: "node-cmd", entryPath: join(data, "entry.js"), appDir: data },
|
|
133
133
|
};
|
|
134
134
|
|