@stigmer/cli 3.14.1 → 3.15.1
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/client/client.d.ts +20 -1
- package/client/client.d.ts.map +1 -1
- package/client/client.js +32 -5
- package/client/client.js.map +1 -1
- package/commands/auth/index.d.ts.map +1 -1
- package/commands/auth/index.js +7 -36
- package/commands/auth/index.js.map +1 -1
- package/commands/auth/login.d.ts +13 -0
- package/commands/auth/login.d.ts.map +1 -0
- package/commands/auth/login.js +58 -0
- package/commands/auth/login.js.map +1 -0
- package/commands/auth/whoami.d.ts +18 -0
- package/commands/auth/whoami.d.ts.map +1 -0
- package/commands/auth/whoami.js +58 -0
- package/commands/auth/whoami.js.map +1 -0
- package/commands/draft.d.ts.map +1 -1
- package/commands/draft.js +24 -8
- package/commands/draft.js.map +1 -1
- package/commands/internal-daemon.d.ts.map +1 -1
- package/commands/internal-daemon.js +2 -9
- package/commands/internal-daemon.js.map +1 -1
- package/commands/run.d.ts.map +1 -1
- package/commands/run.js +15 -6
- package/commands/run.js.map +1 -1
- package/commands/up.d.ts.map +1 -1
- package/commands/up.js +37 -8
- package/commands/up.js.map +1 -1
- package/local/artifact.d.ts +13 -3
- package/local/artifact.d.ts.map +1 -1
- package/local/artifact.js +31 -10
- package/local/artifact.js.map +1 -1
- package/local/daemon/components.d.ts.map +1 -1
- package/local/daemon/components.js +2 -0
- package/local/daemon/components.js.map +1 -1
- package/local/daemon/host.d.ts +8 -0
- package/local/daemon/host.d.ts.map +1 -1
- package/local/daemon/host.js +42 -1
- package/local/daemon/host.js.map +1 -1
- package/local/daemon/index.d.ts +3 -3
- package/local/daemon/index.d.ts.map +1 -1
- package/local/daemon/index.js +2 -2
- package/local/daemon/index.js.map +1 -1
- package/local/daemon/launch.d.ts +29 -1
- package/local/daemon/launch.d.ts.map +1 -1
- package/local/daemon/launch.js +73 -23
- package/local/daemon/launch.js.map +1 -1
- package/local/daemon/process.d.ts +16 -2
- package/local/daemon/process.d.ts.map +1 -1
- package/local/daemon/process.js +16 -2
- package/local/daemon/process.js.map +1 -1
- package/local/daemon/types.d.ts +2 -0
- package/local/daemon/types.d.ts.map +1 -1
- package/local/paths.d.ts +14 -4
- package/local/paths.d.ts.map +1 -1
- package/local/paths.js +17 -4
- package/local/paths.js.map +1 -1
- package/local/runtime/runner.d.ts +4 -0
- package/local/runtime/runner.d.ts.map +1 -1
- package/local/runtime/runner.js +10 -6
- package/local/runtime/runner.js.map +1 -1
- package/local/runtime/server.d.ts +5 -0
- package/local/runtime/server.d.ts.map +1 -1
- package/local/runtime/server.js +13 -8
- package/local/runtime/server.js.map +1 -1
- package/local/seedpack/content.d.ts +4 -0
- package/local/seedpack/content.d.ts.map +1 -1
- package/local/seedpack/content.js +11 -11
- package/local/seedpack/content.js.map +1 -1
- package/local/state/lock.d.ts +3 -2
- package/local/state/lock.d.ts.map +1 -1
- package/local/state/lock.js +23 -9
- package/local/state/lock.js.map +1 -1
- package/local/state/proc.d.ts +13 -0
- package/local/state/proc.d.ts.map +1 -1
- package/local/state/proc.js +15 -0
- package/local/state/proc.js.map +1 -1
- package/local/temporal/download.d.ts +7 -1
- package/local/temporal/download.d.ts.map +1 -1
- package/local/temporal/download.js +21 -11
- package/local/temporal/download.js.map +1 -1
- package/local/temporal/index.d.ts +3 -3
- package/local/temporal/index.d.ts.map +1 -1
- package/local/temporal/index.js +2 -2
- package/local/temporal/index.js.map +1 -1
- package/local/temporal/inspect.d.ts +10 -3
- package/local/temporal/inspect.d.ts.map +1 -1
- package/local/temporal/inspect.js +52 -13
- package/local/temporal/inspect.js.map +1 -1
- package/local/temporal/manager.d.ts +16 -4
- package/local/temporal/manager.d.ts.map +1 -1
- package/local/temporal/manager.js +19 -6
- package/local/temporal/manager.js.map +1 -1
- package/package.json +5 -5
- package/resources/run/prepare.d.ts +10 -8
- package/resources/run/prepare.d.ts.map +1 -1
- package/resources/run/prepare.js +18 -4
- package/resources/run/prepare.js.map +1 -1
- package/src/client/client.test.ts +89 -1
- package/src/client/client.ts +82 -9
- package/src/commands/auth/index.ts +7 -56
- package/src/commands/auth/login.test.ts +52 -0
- package/src/commands/auth/login.ts +70 -0
- package/src/commands/auth/whoami.test.ts +96 -0
- package/src/commands/auth/whoami.ts +87 -0
- package/src/commands/draft.ts +85 -26
- package/src/commands/internal-daemon.ts +2 -10
- package/src/commands/run.ts +77 -35
- package/src/commands/up.ts +52 -8
- package/src/local/artifact.test.ts +27 -1
- package/src/local/artifact.ts +35 -13
- package/src/local/daemon/components.ts +2 -0
- package/src/local/daemon/daemon.integration.test.ts +33 -0
- package/src/local/daemon/host.ts +50 -1
- package/src/local/daemon/index.ts +3 -3
- package/src/local/daemon/launch.test.ts +136 -0
- package/src/local/daemon/launch.ts +108 -27
- package/src/local/daemon/process.ts +31 -4
- package/src/local/daemon/supervisor.test.ts +1 -1
- package/src/local/daemon/types.ts +2 -0
- package/src/local/paths.ts +17 -4
- package/src/local/runtime/runner.ts +10 -6
- package/src/local/runtime/runtime.test.ts +15 -0
- package/src/local/runtime/server.test.ts +37 -0
- package/src/local/runtime/server.ts +17 -12
- package/src/local/seedpack/content.test.ts +21 -0
- package/src/local/seedpack/content.ts +15 -16
- package/src/local/state/lock.ts +24 -9
- package/src/local/state/proc.ts +16 -0
- package/src/local/state/state.test.ts +25 -1
- package/src/local/temporal/download.test.ts +79 -11
- package/src/local/temporal/download.ts +24 -11
- package/src/local/temporal/index.ts +11 -3
- package/src/local/temporal/inspect.test.ts +83 -0
- package/src/local/temporal/inspect.ts +60 -12
- package/src/local/temporal/manager.test.ts +34 -1
- package/src/local/temporal/manager.ts +22 -8
- package/src/resources/run/prepare.test.ts +28 -26
- package/src/resources/run/prepare.ts +48 -18
package/client/client.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DescService } from "@bufbuild/protobuf";
|
|
2
2
|
import { type Client, type Transport } from "@connectrpc/connect";
|
|
3
|
-
import {
|
|
3
|
+
import type { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
4
|
+
import { type ServerInfo, Stigmer, type TokenProvider } from "@stigmer/sdk";
|
|
4
5
|
import { type Config } from "../config/index.js";
|
|
5
6
|
/** The composed backend client returned by {@link createBackendClient}. */
|
|
6
7
|
export interface BackendClient {
|
|
@@ -14,12 +15,30 @@ export interface BackendClient {
|
|
|
14
15
|
controller<Desc extends DescService>(service: Desc): Client<Desc>;
|
|
15
16
|
/** Probe the server (unauthenticated) to fail fast on connectivity issues. */
|
|
16
17
|
connect(timeoutMs?: number): Promise<void>;
|
|
18
|
+
/**
|
|
19
|
+
* The connected server's edition and version, as the server reports them.
|
|
20
|
+
* Asked once per process and remembered; a failed probe is rethrown and
|
|
21
|
+
* not remembered, so the next question asks again.
|
|
22
|
+
*/
|
|
23
|
+
serverInfo(): Promise<ServerInfo>;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the connected server serves `kind`: the kind's tier against the
|
|
26
|
+
* server's reported edition. The CLI's counterpart to the console's
|
|
27
|
+
* `useResourceAvailable`.
|
|
28
|
+
*/
|
|
29
|
+
isResourceAvailable(kind: ApiResourceKind): Promise<boolean>;
|
|
17
30
|
}
|
|
18
31
|
export interface BackendClientOptions {
|
|
19
32
|
/** Config to use; defaults to the on-disk config (or standalone default). */
|
|
20
33
|
readonly config?: Config;
|
|
21
34
|
/** Token-provider override (the auth module supplies a refreshing provider). */
|
|
22
35
|
readonly getAccessToken?: TokenProvider;
|
|
36
|
+
/**
|
|
37
|
+
* Transport override; defaults to the SDK's Node transport over the resolved
|
|
38
|
+
* endpoint. Mirrors `StigmerConfig.customTransport`: tests hand in an
|
|
39
|
+
* in-memory router so the façade's behaviour is proven without a network.
|
|
40
|
+
*/
|
|
41
|
+
readonly transport?: Transport;
|
|
23
42
|
}
|
|
24
43
|
export declare function createBackendClient(options?: BackendClientOptions): BackendClient;
|
|
25
44
|
//# sourceMappingURL=client.d.ts.map
|
package/client/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAqBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACtD,OAAO,EAAE,KAAK,MAAM,EAAgB,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAChF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AAC3H,OAAO,EAEL,KAAK,UAAU,EACf,OAAO,EACP,KAAK,aAAa,EACnB,MAAM,cAAc,CAAC;AAEtB,OAAO,EACL,KAAK,MAAM,EAIZ,MAAM,oBAAoB,CAAC;AAG5B,2EAA2E;AAC3E,MAAM,WAAW,aAAa;IAC5B,iEAAiE;IACjE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,uCAAuC;IACvC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;IAC9B,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,sEAAsE;IACtE,UAAU,CAAC,IAAI,SAAS,WAAW,EAAE,OAAO,EAAE,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC;IAClE,8EAA8E;IAC9E,OAAO,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C;;;;OAIG;IACH,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IAClC;;;;OAIG;IACH,mBAAmB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC9D;AAED,MAAM,WAAW,oBAAoB;IACnC,6EAA6E;IAC7E,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC;IACxC;;;;OAIG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,SAAS,CAAC;CAChC;AAID,wBAAgB,mBAAmB,CACjC,OAAO,GAAE,oBAAyB,GACjC,aAAa,CAgDf"}
|
package/client/client.js
CHANGED
|
@@ -6,14 +6,22 @@
|
|
|
6
6
|
// - `transport` + `controller(service)`: the raw Connect layer, so write
|
|
7
7
|
// flows (a later wave) can drive generated controllers directly for full
|
|
8
8
|
// YAML->proto fidelity rather than the high-level client's lossy inputs.
|
|
9
|
+
// - `serverInfo()` + `isResourceAvailable(kind)`: what the connected server
|
|
10
|
+
// IS and what it serves. The edition is the server's reported one, asked
|
|
11
|
+
// once per process, and "does it serve this kind?" is the kind's tier
|
|
12
|
+
// against that edition — the SDK's isResourceAvailable, the same answer
|
|
13
|
+
// the console's useResourceAvailable gives. A command never infers a
|
|
14
|
+
// tier question from the config's backend `type` (20260911.11 A3): the
|
|
15
|
+
// backend type says where the config file lives and which token is sent,
|
|
16
|
+
// not which kinds a server serves.
|
|
9
17
|
//
|
|
10
18
|
// This module holds no business logic: backend selection, token precedence, and
|
|
11
19
|
// endpoint shape are delegated to the config layer; org resolution and verb
|
|
12
20
|
// dispatch live with the commands and the registry.
|
|
13
21
|
import { createClient } from "@connectrpc/connect";
|
|
14
|
-
import { Stigmer } from "@stigmer/sdk";
|
|
22
|
+
import { isResourceAvailable, Stigmer, } from "@stigmer/sdk";
|
|
15
23
|
import { createNodeTransport, normalizeEndpoint } from "@stigmer/sdk/node";
|
|
16
|
-
import { load, resolveEndpoint, resolveToken } from "../config/index.js";
|
|
24
|
+
import { load, resolveEndpoint, resolveToken, } from "../config/index.js";
|
|
17
25
|
import { CliExitError, ExitCode } from "../errors/index.js";
|
|
18
26
|
const DEFAULT_CONNECT_TIMEOUT_MS = 10_000;
|
|
19
27
|
export function createBackendClient(options = {}) {
|
|
@@ -23,8 +31,23 @@ export function createBackendClient(options = {}) {
|
|
|
23
31
|
// mid-session is picked up. STIGMER_API_KEY > config token precedence lives in
|
|
24
32
|
// resolveToken; a caller-supplied provider (refresh-aware) takes over entirely.
|
|
25
33
|
const tokenProvider = options.getAccessToken ?? (() => resolveToken(config) || null);
|
|
26
|
-
const transport =
|
|
27
|
-
|
|
34
|
+
const transport = options.transport ??
|
|
35
|
+
createNodeTransport({ baseUrl, getAccessToken: tokenProvider });
|
|
36
|
+
const stigmer = new Stigmer({
|
|
37
|
+
baseUrl,
|
|
38
|
+
getAccessToken: tokenProvider,
|
|
39
|
+
customTransport: transport,
|
|
40
|
+
});
|
|
41
|
+
// One probe per process. The pending promise is shared so concurrent askers
|
|
42
|
+
// coalesce; a rejection clears it so a transient fault is not remembered.
|
|
43
|
+
let serverInfo;
|
|
44
|
+
const probeServerInfo = () => {
|
|
45
|
+
serverInfo ??= stigmer.platform.getServerInfo().catch((err) => {
|
|
46
|
+
serverInfo = undefined;
|
|
47
|
+
throw err;
|
|
48
|
+
});
|
|
49
|
+
return serverInfo;
|
|
50
|
+
};
|
|
28
51
|
return {
|
|
29
52
|
stigmer,
|
|
30
53
|
transport,
|
|
@@ -33,7 +56,11 @@ export function createBackendClient(options = {}) {
|
|
|
33
56
|
return createClient(service, transport);
|
|
34
57
|
},
|
|
35
58
|
async connect(timeoutMs = DEFAULT_CONNECT_TIMEOUT_MS) {
|
|
36
|
-
await withTimeout(
|
|
59
|
+
await withTimeout(probeServerInfo(), timeoutMs);
|
|
60
|
+
},
|
|
61
|
+
serverInfo: probeServerInfo,
|
|
62
|
+
async isResourceAvailable(kind) {
|
|
63
|
+
return isResourceAvailable(kind, (await probeServerInfo()).deploymentMode);
|
|
37
64
|
},
|
|
38
65
|
};
|
|
39
66
|
}
|
package/client/client.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/client/client.ts"],"names":[],"mappings":"AAAA,yBAAyB;AACzB,EAAE;AACF,+EAA+E;AAC/E,kCAAkC;AAClC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,GAAG,EAAE,CACH,MAAM,CACJ,IAAI,YAAY,CACd,4CAA4C,EAC5C,QAAQ,CAAC,UAAU,CACpB,CACF,EACH,SAAS,CACV,CAAC;IACJ,CAAC,CAAC,CAAC;IACH,IAAI,CAAC;QACH,OAAO,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAChD,CAAC;YAAS,CAAC;QACT,IAAI,KAAK,KAAK,SAAS;YAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC/C,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,YAAY,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CA6BnD"}
|
package/commands/auth/index.js
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
// `stigmer auth login|logout|whoami` — manage Stigmer Cloud authentication.
|
|
2
2
|
//
|
|
3
3
|
// login is interactive (browser PKCE) and human-only; logout and whoami honor
|
|
4
|
-
// the standard mutating-output flags.
|
|
5
|
-
|
|
4
|
+
// the standard mutating-output flags. login and whoami both end in the SDK's
|
|
5
|
+
// ensureMyIdentityAccount (login.ts, whoami.ts): the first-sign-in flow the
|
|
6
|
+
// console runs, so the CLI provisions an account exactly as the console does.
|
|
7
|
+
import { activeBackend, load, save } from "../../config/index.js";
|
|
6
8
|
import { CommandResult, renderResult, } from "../../output/index.js";
|
|
7
9
|
import { addResultFlags, resultFormat } from "../shared.js";
|
|
8
10
|
export function registerAuth(program) {
|
|
@@ -13,11 +15,8 @@ export function registerAuth(program) {
|
|
|
13
15
|
.command("login")
|
|
14
16
|
.description("log in to Stigmer Cloud via browser (PKCE OAuth)")
|
|
15
17
|
.action(async () => {
|
|
16
|
-
const {
|
|
17
|
-
await
|
|
18
|
-
renderResult(CommandResult.success("Authenticated with Stigmer Cloud")
|
|
19
|
-
.hint("Run commands against the cloud backend, e.g.:")
|
|
20
|
-
.hint(" stigmer list agents"), "human");
|
|
18
|
+
const { runLogin } = await import("./login.js");
|
|
19
|
+
renderResult(await runLogin(), "human");
|
|
21
20
|
});
|
|
22
21
|
const logout = auth
|
|
23
22
|
.command("logout")
|
|
@@ -30,6 +29,7 @@ export function registerAuth(program) {
|
|
|
30
29
|
.command("whoami")
|
|
31
30
|
.description("show the currently authenticated account")
|
|
32
31
|
.action(async (options) => {
|
|
32
|
+
const { runWhoami } = await import("./whoami.js");
|
|
33
33
|
renderResult(await runWhoami(), resultFormat(options));
|
|
34
34
|
});
|
|
35
35
|
addResultFlags(whoami);
|
|
@@ -55,33 +55,4 @@ function runLogout() {
|
|
|
55
55
|
save(config);
|
|
56
56
|
return CommandResult.success("Logged out from Stigmer Cloud").hint("Run 'stigmer auth login' to authenticate again.");
|
|
57
57
|
}
|
|
58
|
-
async function runWhoami() {
|
|
59
|
-
const { connectBackend } = await import("../../backend.js");
|
|
60
|
-
const client = connectBackend();
|
|
61
|
-
ensureAuthenticated(client.config);
|
|
62
|
-
const account = await client.stigmer.identityAccount.whoAmI();
|
|
63
|
-
const result = CommandResult.success("Authenticated");
|
|
64
|
-
const section = result.addSection("");
|
|
65
|
-
if (account.metadata !== undefined) {
|
|
66
|
-
section.field("Account ID", account.metadata.id);
|
|
67
|
-
if (account.metadata.name !== "")
|
|
68
|
-
section.field("Name", account.metadata.name);
|
|
69
|
-
}
|
|
70
|
-
if (account.spec !== undefined) {
|
|
71
|
-
if (account.spec.email !== "")
|
|
72
|
-
section.field("Email", account.spec.email);
|
|
73
|
-
if (account.spec.firstName !== "" || account.spec.lastName !== "") {
|
|
74
|
-
section.field("Full Name", `${account.spec.firstName} ${account.spec.lastName}`.trim());
|
|
75
|
-
}
|
|
76
|
-
section.field("Account Type", account.spec.isMachineAccount ? "Machine Account" : "User Account");
|
|
77
|
-
}
|
|
78
|
-
const org = resolveContextOrganization(client.config);
|
|
79
|
-
if (org !== "") {
|
|
80
|
-
section.field("Organization", org);
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
result.hint("No organization set. Use: stigmer config context set --org <slug>");
|
|
84
|
-
}
|
|
85
|
-
return result;
|
|
86
|
-
}
|
|
87
58
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,8EAA8E;AAC9E,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/auth/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,EAAE;AACF,8EAA8E;AAC9E,6EAA6E;AAC7E,4EAA4E;AAC5E,8EAA8E;AAG9E,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAClE,OAAO,EACL,aAAa,EAEb,YAAY,GACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5D,MAAM,UAAU,YAAY,CAAC,OAAgB;IAC3C,MAAM,IAAI,GAAG,OAAO;SACjB,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,0CAA0C,CAAC,CAAC;IAE3D,IAAI;SACD,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,kDAAkD,CAAC;SAC/D,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC;QAChD,YAAY,CAAC,MAAM,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,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C,EAChE,CAAC;QACD,OAAO,aAAa,CAAC,OAAO,CAAC,yBAAyB,CAAC,CAAC,IAAI,CAC1D,2CAA2C,CAC5C,CAAC;IACJ,CAAC;IACD,KAAK,CAAC,KAAK,GAAG,SAAS,CAAC;IACxB,KAAK,CAAC,aAAa,GAAG,SAAS,CAAC;IAChC,KAAK,CAAC,YAAY,GAAG,SAAS,CAAC;IAC/B,IAAI,CAAC,MAAM,CAAC,CAAC;IACb,OAAO,aAAa,CAAC,OAAO,CAAC,+BAA+B,CAAC,CAAC,IAAI,CAChE,iDAAiD,CAClD,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { CommandResult } from "../../output/index.js";
|
|
2
|
+
/** How the account step went, after the tokens were persisted. */
|
|
3
|
+
export type AccountSetup = {
|
|
4
|
+
readonly status: "ensured";
|
|
5
|
+
readonly created: boolean;
|
|
6
|
+
} | {
|
|
7
|
+
readonly status: "failed";
|
|
8
|
+
readonly message: string;
|
|
9
|
+
};
|
|
10
|
+
/** Render the login outcome. Pure: the command layer supplies `setup`. */
|
|
11
|
+
export declare function loginResult(setup: AccountSetup): CommandResult;
|
|
12
|
+
export declare function runLogin(): Promise<CommandResult>;
|
|
13
|
+
//# sourceMappingURL=login.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAeA,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,kEAAkE;AAClE,MAAM,MAAM,YAAY,GACpB;IAAE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAA;CAAE,GACzD;IAAE,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAO5D,0EAA0E;AAC1E,wBAAgB,WAAW,CAAC,KAAK,EAAE,YAAY,GAAG,aAAa,CAoB9D;AAED,wBAAsB,QAAQ,IAAI,OAAO,CAAC,aAAa,CAAC,CAIvD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// `stigmer auth login` — the browser PKCE flow, then the account.
|
|
2
|
+
//
|
|
3
|
+
// The auth module's login() persists the tokens and switches the backend to
|
|
4
|
+
// cloud. This command then runs the SDK's ensureMyIdentityAccount — the
|
|
5
|
+
// console's first-sign-in flow (20260911.11 A3) — so a person who signs in
|
|
6
|
+
// from the CLI alone is provisioned, not left for entry 3's authorizer to
|
|
7
|
+
// lock out as an unknown principal.
|
|
8
|
+
//
|
|
9
|
+
// The order matters for the result: the tokens are already saved when the
|
|
10
|
+
// account step runs, so its failure is a WARNING that says the login stood
|
|
11
|
+
// and how to finish (`auth whoami` runs the same flow), never an error that
|
|
12
|
+
// sends the person back to the browser.
|
|
13
|
+
import { ensureMyIdentityAccount } from "@stigmer/sdk";
|
|
14
|
+
import { classify } from "../../errors/index.js";
|
|
15
|
+
import { CommandResult } from "../../output/index.js";
|
|
16
|
+
const CLOUD_HINTS = [
|
|
17
|
+
"Run commands against the cloud backend, e.g.:",
|
|
18
|
+
" stigmer list agents",
|
|
19
|
+
];
|
|
20
|
+
/** Render the login outcome. Pure: the command layer supplies `setup`. */
|
|
21
|
+
export function loginResult(setup) {
|
|
22
|
+
switch (setup.status) {
|
|
23
|
+
case "ensured": {
|
|
24
|
+
const result = CommandResult.success(setup.created
|
|
25
|
+
? "Authenticated with Stigmer Cloud — your account was created on this first sign-in"
|
|
26
|
+
: "Authenticated with Stigmer Cloud");
|
|
27
|
+
for (const hint of CLOUD_HINTS)
|
|
28
|
+
result.hint(hint);
|
|
29
|
+
return result;
|
|
30
|
+
}
|
|
31
|
+
case "failed":
|
|
32
|
+
return CommandResult.warning(`Authenticated with Stigmer Cloud, but your account could not be set up: ${setup.message}`).hint("Run 'stigmer auth whoami' to finish setting up your account.");
|
|
33
|
+
default: {
|
|
34
|
+
const _exhaustive = setup;
|
|
35
|
+
throw new Error(`unknown account setup: ${String(_exhaustive)}`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export async function runLogin() {
|
|
40
|
+
const { login } = await import("../../auth/index.js");
|
|
41
|
+
await login();
|
|
42
|
+
return loginResult(await ensureAccount());
|
|
43
|
+
}
|
|
44
|
+
// The tokens are on disk by now; connectBackend() reads them fresh.
|
|
45
|
+
async function ensureAccount() {
|
|
46
|
+
const { connectBackend } = await import("../../backend.js");
|
|
47
|
+
const client = connectBackend();
|
|
48
|
+
try {
|
|
49
|
+
const { created } = await ensureMyIdentityAccount(client.stigmer, {
|
|
50
|
+
onProvisioning: () => process.stderr.write("Setting up your account...\n"),
|
|
51
|
+
});
|
|
52
|
+
return { status: "ensured", created };
|
|
53
|
+
}
|
|
54
|
+
catch (err) {
|
|
55
|
+
return { status: "failed", message: classify(err)?.message ?? String(err) };
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=login.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../../src/commands/auth/login.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,EAAE;AACF,4EAA4E;AAC5E,wEAAwE;AACxE,2EAA2E;AAC3E,0EAA0E;AAC1E,oCAAoC;AACpC,EAAE;AACF,0EAA0E;AAC1E,2EAA2E;AAC3E,4EAA4E;AAC5E,wCAAwC;AAExC,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAOtD,MAAM,WAAW,GAAG;IAClB,+CAA+C;IAC/C,uBAAuB;CACxB,CAAC;AAEF,0EAA0E;AAC1E,MAAM,UAAU,WAAW,CAAC,KAAmB;IAC7C,QAAQ,KAAK,CAAC,MAA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,CAAC;IACxC,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,CAAC,GAAG,CAAC,EAAE,OAAO,IAAI,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9E,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { IdentityAccount } from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
|
|
2
|
+
import { CommandResult } from "../../output/index.js";
|
|
3
|
+
/** What the call learned beyond the account itself. */
|
|
4
|
+
export interface WhoamiContext {
|
|
5
|
+
/** `true` when this call created the account (a first sign-in). */
|
|
6
|
+
readonly created: boolean;
|
|
7
|
+
/** The organization the CLI context resolves to; "" when none is set. */
|
|
8
|
+
readonly org: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Render the caller's account. Every field is optional on the wire and an
|
|
12
|
+
* empty profile (the unconfigured laptop's operator) renders only what it
|
|
13
|
+
* has; a missing organization is a hint with the command that sets it, not a
|
|
14
|
+
* failure.
|
|
15
|
+
*/
|
|
16
|
+
export declare function whoamiResult(account: IdentityAccount, context: WhoamiContext): CommandResult;
|
|
17
|
+
export declare function runWhoami(): Promise<CommandResult>;
|
|
18
|
+
//# sourceMappingURL=whoami.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.d.ts","sourceRoot":"","sources":["../../../src/commands/auth/whoami.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0DAA0D,CAAC;AAMhG,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAEtD,uDAAuD;AACvD,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,yEAAyE;IACzE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;CACtB;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,aAAa,GACrB,aAAa,CAoCf;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,aAAa,CAAC,CAYxD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
// `stigmer auth whoami` — who the connected server says you are.
|
|
2
|
+
//
|
|
3
|
+
// Runs the SDK's ensureMyIdentityAccount, the same first-sign-in flow the
|
|
4
|
+
// console's gate runs (20260911.11 A3): an authenticated caller with no
|
|
5
|
+
// account yet is provisioned here rather than told "not found", so a person
|
|
6
|
+
// who only ever uses the CLI is never left without an account. The result
|
|
7
|
+
// says when THIS call created it — a first sign-in is visible, never silent.
|
|
8
|
+
//
|
|
9
|
+
// whoamiResult is the pure half (given the account and what the call learned,
|
|
10
|
+
// the CommandResult a person reads); runWhoami is the I/O half.
|
|
11
|
+
import { ensureMyIdentityAccount } from "@stigmer/sdk";
|
|
12
|
+
import { ensureAuthenticated, resolveContextOrganization, } from "../../config/index.js";
|
|
13
|
+
import { CommandResult } from "../../output/index.js";
|
|
14
|
+
/**
|
|
15
|
+
* Render the caller's account. Every field is optional on the wire and an
|
|
16
|
+
* empty profile (the unconfigured laptop's operator) renders only what it
|
|
17
|
+
* has; a missing organization is a hint with the command that sets it, not a
|
|
18
|
+
* failure.
|
|
19
|
+
*/
|
|
20
|
+
export function whoamiResult(account, context) {
|
|
21
|
+
const result = CommandResult.success(context.created
|
|
22
|
+
? "Authenticated — your account was created on this first sign-in"
|
|
23
|
+
: "Authenticated");
|
|
24
|
+
const section = result.addSection("");
|
|
25
|
+
if (account.metadata !== undefined) {
|
|
26
|
+
section.field("Account ID", account.metadata.id);
|
|
27
|
+
if (account.metadata.name !== "")
|
|
28
|
+
section.field("Name", account.metadata.name);
|
|
29
|
+
}
|
|
30
|
+
if (account.spec !== undefined) {
|
|
31
|
+
if (account.spec.email !== "")
|
|
32
|
+
section.field("Email", account.spec.email);
|
|
33
|
+
if (account.spec.firstName !== "" || account.spec.lastName !== "") {
|
|
34
|
+
section.field("Full Name", `${account.spec.firstName} ${account.spec.lastName}`.trim());
|
|
35
|
+
}
|
|
36
|
+
section.field("Account Type", account.spec.isMachineAccount ? "Machine Account" : "User Account");
|
|
37
|
+
}
|
|
38
|
+
if (context.org !== "") {
|
|
39
|
+
section.field("Organization", context.org);
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
result.hint("No organization set. Use: stigmer config context set --org <slug>");
|
|
43
|
+
}
|
|
44
|
+
return result;
|
|
45
|
+
}
|
|
46
|
+
export async function runWhoami() {
|
|
47
|
+
const { connectBackend } = await import("../../backend.js");
|
|
48
|
+
const client = connectBackend();
|
|
49
|
+
ensureAuthenticated(client.config);
|
|
50
|
+
const { account, created } = await ensureMyIdentityAccount(client.stigmer, {
|
|
51
|
+
onProvisioning: () => process.stderr.write("Setting up your account...\n"),
|
|
52
|
+
});
|
|
53
|
+
return whoamiResult(account, {
|
|
54
|
+
created,
|
|
55
|
+
org: resolveContextOrganization(client.config),
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=whoami.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"whoami.js","sourceRoot":"","sources":["../../../src/commands/auth/whoami.ts"],"names":[],"mappings":"AAAA,iEAAiE;AACjE,EAAE;AACF,0EAA0E;AAC1E,wEAAwE;AACxE,4EAA4E;AAC5E,0EAA0E;AAC1E,6EAA6E;AAC7E,EAAE;AACF,8EAA8E;AAC9E,gEAAgE;AAGhE,OAAO,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AACvD,OAAO,EACL,mBAAmB,EACnB,0BAA0B,GAC3B,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAUtD;;;;;GAKG;AACH,MAAM,UAAU,YAAY,CAC1B,OAAwB,EACxB,OAAsB;IAEtB,MAAM,MAAM,GAA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C;QACN,MAAM,CAAC,IAAI,CACT,mEAAmE,CACpE,CAAC;IACJ,CAAC;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,SAAS;IAC7B,MAAM,EAAE,cAAc,EAAE,GAAG,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;IAC5D,MAAM,MAAM,GAAG,cAAc,EAAE,CAAC;IAChC,mBAAmB,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;IAEnC,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,uBAAuB,CAAC,MAAM,CAAC,OAAO,EAAE;QACzE,cAAc,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,8BAA8B,CAAC;KAC3E,CAAC,CAAC;IACH,OAAO,YAAY,CAAC,OAAO,EAAE;QAC3B,OAAO;QACP,GAAG,EAAE,0BAA0B,CAAC,MAAM,CAAC,MAAM,CAAC;KAC/C,CAAC,CAAC;AACL,CAAC"}
|
package/commands/draft.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/commands/draft.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"draft.d.ts","sourceRoot":"","sources":["../../src/commands/draft.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAmDzC,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAgBpD"}
|
package/commands/draft.js
CHANGED
|
@@ -6,24 +6,39 @@
|
|
|
6
6
|
// Draft differs from run only at the edges: the agent is fixed (a system agent),
|
|
7
7
|
// --message is required, and artifacts download to -o/--output (or the CWD)
|
|
8
8
|
// unless detached or a local workspace is in play.
|
|
9
|
-
import {
|
|
9
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
10
|
+
import { ensureAuthenticated, resolveOrganization } from "../config/index.js";
|
|
10
11
|
import { UsageError } from "../errors/index.js";
|
|
11
|
-
import { addAgentExecFlags, toAgentExecFlags } from "./agent-exec-flags.js";
|
|
12
|
+
import { addAgentExecFlags, toAgentExecFlags, } from "./agent-exec-flags.js";
|
|
12
13
|
import { globalOrg } from "./shared.js";
|
|
13
14
|
// The org that owns the system agent blueprints (installed by the seedpack),
|
|
14
15
|
// regardless of which org the user operates in. Mirrors Go's systemAgentOrg.
|
|
15
16
|
const SYSTEM_AGENT_ORG = "stigmer";
|
|
16
17
|
const CONFIGS = [
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
18
|
+
{
|
|
19
|
+
name: "skill",
|
|
20
|
+
resourceType: "Skill",
|
|
21
|
+
summary: "create a skill with AI assistance",
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "agent",
|
|
25
|
+
resourceType: "Agent",
|
|
26
|
+
summary: "create an agent with AI assistance",
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: "mcp-server",
|
|
30
|
+
resourceType: "McpServer",
|
|
31
|
+
summary: "create an MCP server config with AI assistance",
|
|
32
|
+
},
|
|
20
33
|
];
|
|
21
34
|
// System agent slug per subcommand (Go's draftConfig.AgentName: "<type>-creator").
|
|
22
35
|
function agentSlug(name) {
|
|
23
36
|
return `${name}-creator`;
|
|
24
37
|
}
|
|
25
38
|
export function registerDraft(program) {
|
|
26
|
-
const draft = program
|
|
39
|
+
const draft = program
|
|
40
|
+
.command("draft")
|
|
41
|
+
.description("create resource configurations with AI assistance");
|
|
27
42
|
for (const config of CONFIGS) {
|
|
28
43
|
const sub = draft.command(config.name).description(config.summary);
|
|
29
44
|
addAgentExecFlags(sub, true)
|
|
@@ -40,7 +55,7 @@ async function runDraft(config, options, command) {
|
|
|
40
55
|
if (org === "") {
|
|
41
56
|
throw new UsageError("organization not set\n\nSet it with:\n stigmer config context set --org <org>\n stigmer draft --org <org> ...");
|
|
42
57
|
}
|
|
43
|
-
const [{ prepareAgentExec }, { executeResolvedAgent }, { resolveAgentRef }, { localWorkspaceRoots }] = await Promise.all([
|
|
58
|
+
const [{ prepareAgentExec }, { executeResolvedAgent }, { resolveAgentRef }, { localWorkspaceRoots },] = await Promise.all([
|
|
44
59
|
import("../resources/run/prepare.js"),
|
|
45
60
|
import("../resources/run/agent-exec.js"),
|
|
46
61
|
import("../resources/run/resolve.js"),
|
|
@@ -48,7 +63,8 @@ async function runDraft(config, options, command) {
|
|
|
48
63
|
]);
|
|
49
64
|
const agent = await resolveDraftAgent(resolveAgentRef, client.stigmer, config);
|
|
50
65
|
const prepared = await prepareAgentExec(toAgentExecFlags(options), client.stigmer, org, stderrProgress(), {
|
|
51
|
-
|
|
66
|
+
// The kind's tier against the server's reported edition, as `run` asks it.
|
|
67
|
+
accountPreferencesAvailable: await client.isResourceAvailable(ApiResourceKind.identity_account),
|
|
52
68
|
});
|
|
53
69
|
if (prepared.attachments.length + prepared.workspaceFileRefs.length > 0) {
|
|
54
70
|
process.stderr.write(`Attached ${prepared.attachments.length + prepared.workspaceFileRefs.length} file(s) as context\n`);
|
package/commands/draft.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../src/commands/draft.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,oCAAoC;AACpC,EAAE;AACF,iFAAiF;AACjF,4EAA4E;AAC5E,mDAAmD;AAGnD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"draft.js","sourceRoot":"","sources":["../../src/commands/draft.ts"],"names":[],"mappings":"AAAA,iFAAiF;AACjF,6EAA6E;AAC7E,gFAAgF;AAChF,oCAAoC;AACpC,EAAE;AACF,iFAAiF;AACjF,4EAA4E;AAC5E,mDAAmD;AAGnD,OAAO,EAAE,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O,MAAM,CAAC;IACjC,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,cAAc;IACrB,IAAI,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI;QAAE,OAAO,GAAG,EAAE,GAAE,CAAC,CAAC;IACnD,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,KAAK,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/internal-daemon.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"internal-daemon.d.ts","sourceRoot":"","sources":["../../src/commands/internal-daemon.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAS7D"}
|
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
// `stigmer internal-daemon` (hidden) — the long-lived supervised daemon process
|
|
2
2
|
// that `up` re-execs. It is not meant to be invoked directly; it runs the local
|
|
3
3
|
// stack until it receives SIGTERM/SIGINT, then exits with the daemon's code.
|
|
4
|
+
// (`stigmer up --foreground` runs the same body in the launching process.)
|
|
4
5
|
export function registerInternalDaemon(program) {
|
|
5
6
|
program
|
|
6
7
|
.command("internal-daemon", { hidden: true })
|
|
7
8
|
.description("internal: run the supervised local-stack daemon (do not invoke directly)")
|
|
8
9
|
.action(async () => {
|
|
9
|
-
const { runInternalDaemon } = await import("../local/daemon/process.js");
|
|
10
|
+
const { runInternalDaemon, waitForShutdownSignal } = await import("../local/daemon/process.js");
|
|
10
11
|
const code = await runInternalDaemon({ waitForShutdown: waitForShutdownSignal });
|
|
11
12
|
process.exit(code);
|
|
12
13
|
});
|
|
13
14
|
}
|
|
14
|
-
// Resolve when the first SIGTERM/SIGINT arrives — the daemon's shutdown trigger.
|
|
15
|
-
function waitForShutdownSignal() {
|
|
16
|
-
return new Promise((resolve) => {
|
|
17
|
-
const onSignal = () => resolve();
|
|
18
|
-
process.once("SIGTERM", onSignal);
|
|
19
|
-
process.once("SIGINT", onSignal);
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
15
|
//# sourceMappingURL=internal-daemon.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"internal-daemon.js","sourceRoot":"","sources":["../../src/commands/internal-daemon.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;
|
|
1
|
+
{"version":3,"file":"internal-daemon.js","sourceRoot":"","sources":["../../src/commands/internal-daemon.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,gFAAgF;AAChF,6EAA6E;AAC7E,2EAA2E;AAI3E,MAAM,UAAU,sBAAsB,CAAC,OAAgB;IACrD,OAAO;SACJ,OAAO,CAAC,iBAAiB,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;SAC5C,WAAW,CAAC,0EAA0E,CAAC;SACvF,MAAM,CAAC,KAAK,IAAI,EAAE;QACjB,MAAM,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,GAAG,MAAM,MAAM,CAAC,4BAA4B,CAAC,CAAC;QAChG,MAAM,IAAI,GAAG,MAAM,iBAAiB,CAAC,EAAE,eAAe,EAAE,qBAAqB,EAAE,CAAC,CAAC;QACjF,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;AACP,CAAC"}
|
package/commands/run.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAgBzC,wBAAgB,WAAW,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAelD"}
|
package/commands/run.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
// reference (smart 0/1/2-arg dispatch mirroring Go's run.go + run_picker.go),
|
|
4
4
|
// then delegate to the shared run stack. Heavy modules (backend client, Ink,
|
|
5
5
|
// the differ) load lazily inside the action so `--help` stays fast (DD-001).
|
|
6
|
-
import {
|
|
6
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
7
|
+
import { ensureAuthenticated, resolveOrganization } from "../config/index.js";
|
|
7
8
|
import { UsageError } from "../errors/index.js";
|
|
8
9
|
import { interactiveBrowseEnabled } from "../resources/picker/tty.js";
|
|
9
|
-
import { addAgentExecFlags } from "./agent-exec-flags.js";
|
|
10
|
+
import { addAgentExecFlags, } from "./agent-exec-flags.js";
|
|
10
11
|
import { globalOrg } from "./shared.js";
|
|
11
12
|
export function registerRun(program) {
|
|
12
13
|
const run = program
|
|
@@ -110,7 +111,9 @@ async function runResolvedAgent(agent, options, org, outputMode, client) {
|
|
|
110
111
|
const { executeResolvedAgent } = await import("../resources/run/agent-exec.js");
|
|
111
112
|
const { toAgentExecFlags } = await import("./agent-exec-flags.js");
|
|
112
113
|
const prepared = await prepareAgentExec(toAgentExecFlags(options), client.stigmer, org, stderrProgress(), {
|
|
113
|
-
|
|
114
|
+
// The kind's tier against the server's reported edition — the same
|
|
115
|
+
// question the console asks — never the config's backend type.
|
|
116
|
+
accountPreferencesAvailable: await client.isResourceAvailable(ApiResourceKind.identity_account),
|
|
114
117
|
// run opts into the account default_harness fill; draft deliberately
|
|
115
118
|
// does not (see the option's doc comment for the D5 rationale).
|
|
116
119
|
applyAccountHarnessDefault: true,
|
|
@@ -132,7 +135,7 @@ async function runWorkflow(reference, options, org, outputMode, client) {
|
|
|
132
135
|
if (options.workspace.length > 0) {
|
|
133
136
|
throw new UsageError("--workspace is not supported for workflows (workspace is an agent-level concept)");
|
|
134
137
|
}
|
|
135
|
-
const [{ resolveWorkflowRef }, { createWorkflowExecution }, { loadAndMergeEnv }, { parseApprovalAction }] = await Promise.all([
|
|
138
|
+
const [{ resolveWorkflowRef }, { createWorkflowExecution }, { loadAndMergeEnv }, { parseApprovalAction },] = await Promise.all([
|
|
136
139
|
import("../resources/run/resolve.js"),
|
|
137
140
|
import("../resources/run/create.js"),
|
|
138
141
|
import("../resources/run/env.js"),
|
|
@@ -166,7 +169,9 @@ async function runWorkflow(reference, options, org, outputMode, client) {
|
|
|
166
169
|
client: client.stigmer,
|
|
167
170
|
executionId: id,
|
|
168
171
|
outputMode,
|
|
169
|
-
defaultAction: options.autoApprove === true
|
|
172
|
+
defaultAction: options.autoApprove === true
|
|
173
|
+
? ApprovalAction.APPROVE_ALL
|
|
174
|
+
: parseApprovalAction(options.approveDefault ?? ""),
|
|
170
175
|
});
|
|
171
176
|
}
|
|
172
177
|
function stderrProgress() {
|
|
@@ -179,7 +184,11 @@ function stderrProgress() {
|
|
|
179
184
|
// cleanly so the command exits 0. Loaded lazily to honor the DD-001 boundary.
|
|
180
185
|
async function browseAndRunAgent(initialQuery, options, org, outputMode, client) {
|
|
181
186
|
const { pickAgent } = await import("../resources/picker/ink.js");
|
|
182
|
-
const selected = await pickAgent({
|
|
187
|
+
const selected = await pickAgent({
|
|
188
|
+
client: client.stigmer,
|
|
189
|
+
org,
|
|
190
|
+
initialQuery,
|
|
191
|
+
});
|
|
183
192
|
if (selected === undefined)
|
|
184
193
|
return;
|
|
185
194
|
await runAgent(selected.id, options, org, outputMode, client);
|