@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"manager.js","sourceRoot":"","sources":["../../../src/local/temporal/manager.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD,EAAE;AACF,8EAA8E;AAC9E,0EAA0E;AAC1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AAkB,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;gBACrE,aAAa,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC9B,CAAC;YACD,OAAO;QACT,CAAC;QACD,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC5C,IAAI,MAAM,KAAK,IAAI,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;YAC9D,GAAG,CAAC,IAAI,CAAC,0CAA0C,EAAE,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;YACvF,gBAAgB,CAAC,MAAM,EAAE,SAAS,CAAC,CAAC;QACtC,CAAC;IACH,CAAC;CACF;AAED,SAAS,KAAK,CAAC,EAAU;IACvB,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC;AAC/C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/cli",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.15.1",
|
|
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.15.1",
|
|
39
|
+
"@stigmer/mcp-server": "3.15.1",
|
|
40
|
+
"@stigmer/protos": "3.15.1",
|
|
41
|
+
"@stigmer/sdk": "3.15.1",
|
|
42
42
|
"commander": "^12.1.0",
|
|
43
43
|
"fflate": "^0.8.3",
|
|
44
44
|
"ink": "^7.0.0",
|
|
@@ -75,18 +75,20 @@ export interface PreparedRun {
|
|
|
75
75
|
/** Optional behavior switches for {@link prepareAgentExec}. */
|
|
76
76
|
export interface PrepareAgentExecOptions {
|
|
77
77
|
/**
|
|
78
|
-
* When `true`
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
* `
|
|
83
|
-
*
|
|
78
|
+
* When `true` and `--model` is omitted, the model is filled from the
|
|
79
|
+
* caller's account preference (`IdentityAccountPreferences.default_*_model`
|
|
80
|
+
* for the resolved harness) via `whoAmI()`. The caller answers this from
|
|
81
|
+
* the connected server's edition and the kind's tier —
|
|
82
|
+
* `client.isResourceAvailable(ApiResourceKind.identity_account)` — never
|
|
83
|
+
* from the config's backend type (20260911.11 A3): a server that does not
|
|
84
|
+
* serve identity accounts is not even asked, and the omitted model keeps
|
|
85
|
+
* resolving to the platform default.
|
|
84
86
|
*/
|
|
85
|
-
readonly
|
|
87
|
+
readonly accountPreferencesAvailable?: boolean;
|
|
86
88
|
/**
|
|
87
89
|
* When `true` and `--harness` is omitted, the harness is filled from the
|
|
88
90
|
* caller's account preference (`IdentityAccountPreferences.default_harness`)
|
|
89
|
-
*
|
|
91
|
+
* where the kind is served. `run` opts in; `draft` deliberately does not: draft executes the
|
|
90
92
|
* seedpack's system creator agents (a utility flow, not the user's own
|
|
91
93
|
* conversation), which are built and exercised on the native harness —
|
|
92
94
|
* silently rerouting them onto the cursor engine (different toolset,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.d.ts","sourceRoot":"","sources":["../../../src/resources/run/prepare.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,UAA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,EACX,QAAQ,CAAC,EAAE,YAAY,EACvB,OAAO,CAAC,EAAE,uBAAuB,GAChC,OAAO,CAAC,WAAW,CAAC,CA0EtB;AAiDD;;;;GAIG;AACH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,cAAc,CAkBjE;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,IAAI,OAAO,CAMlE;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,IAAI,IAAI,eAAe,CAMjC;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,IAAI,YAAY,CAM3E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAC7B,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,OAAO,IAAI,WAAW,CAMhC"}
|
package/resources/run/prepare.js
CHANGED
|
@@ -22,7 +22,7 @@ export async function prepareAgentExec(flags, client, org, progress, options) {
|
|
|
22
22
|
validateThinking(flags.thinking);
|
|
23
23
|
validateHarness(flags.harness);
|
|
24
24
|
// Layered seeds (oss#293, DD-003): explicit flag > account preference
|
|
25
|
-
// (
|
|
25
|
+
// (where the server serves identity accounts) > platform default. Harness resolves first because the model
|
|
26
26
|
// fill is harness-aware: a cursor session fills from default_cursor_model,
|
|
27
27
|
// everything else from default_native_model. `run` and `draft` always
|
|
28
28
|
// create a NEW session (threading lives in `resume`, which does not pass
|
|
@@ -31,10 +31,15 @@ export async function prepareAgentExec(flags, client, org, progress, options) {
|
|
|
31
31
|
// skipped entirely when explicit flags leave nothing to fill.
|
|
32
32
|
const wantsHarnessFill = flags.harness === "" && options?.applyAccountHarnessDefault === true;
|
|
33
33
|
const wantsModelFill = flags.model === "";
|
|
34
|
-
const accountDefaults = options?.
|
|
34
|
+
const accountDefaults = options?.accountPreferencesAvailable === true &&
|
|
35
|
+
(wantsHarnessFill || wantsModelFill)
|
|
35
36
|
? await resolveAccountExecutionDefaults(client)
|
|
36
37
|
: NO_ACCOUNT_DEFAULTS;
|
|
37
|
-
const harness = flags.harness !== ""
|
|
38
|
+
const harness = flags.harness !== ""
|
|
39
|
+
? flags.harness
|
|
40
|
+
: wantsHarnessFill
|
|
41
|
+
? accountDefaults.harness
|
|
42
|
+
: "";
|
|
38
43
|
const model = wantsModelFill
|
|
39
44
|
? harness === "cursor"
|
|
40
45
|
? accountDefaults.cursorModel
|
|
@@ -68,7 +73,11 @@ export async function prepareAgentExec(flags, client, org, progress, options) {
|
|
|
68
73
|
harness,
|
|
69
74
|
};
|
|
70
75
|
}
|
|
71
|
-
const NO_ACCOUNT_DEFAULTS = {
|
|
76
|
+
const NO_ACCOUNT_DEFAULTS = {
|
|
77
|
+
harness: "",
|
|
78
|
+
nativeModel: "",
|
|
79
|
+
cursorModel: "",
|
|
80
|
+
};
|
|
72
81
|
/**
|
|
73
82
|
* Best-effort read of the caller's execution defaults
|
|
74
83
|
* (`IdentityAccountPreferences.default_harness` / `default_*_model`) in one
|
|
@@ -76,6 +85,11 @@ const NO_ACCOUNT_DEFAULTS = { harness: "", nativeModel: "", cursorModel: "" };
|
|
|
76
85
|
* IdentityAccount — resolves to no defaults and the run proceeds exactly as
|
|
77
86
|
* unfilled flags do today: a missing preference must never fail a run.
|
|
78
87
|
*
|
|
88
|
+
* This reads `whoAmI` directly and never the SDK's ensureMyIdentityAccount:
|
|
89
|
+
* a run must not create an account as a side effect, so NOT_FOUND here means
|
|
90
|
+
* "no preferences yet". Provisioning belongs to `auth login` and `auth
|
|
91
|
+
* whoami`, the commands whose purpose is the caller's identity.
|
|
92
|
+
*
|
|
79
93
|
* The persisted harness value is allowlist-guarded to the shipped engines
|
|
80
94
|
* (the same guard the web launcher's useAccountExecutionDefaults applies):
|
|
81
95
|
* a client must not trust stored data it did not write, so anything outside
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../../src/resources/run/prepare.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,oEAAoE;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAG9F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAqB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"prepare.js","sourceRoot":"","sources":["../../../src/resources/run/prepare.ts"],"names":[],"mappings":"AAAA,0EAA0E;AAC1E,8EAA8E;AAC9E,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,6EAA6E;AAC7E,gFAAgF;AAChF,oEAAoE;AAGpE,OAAO,EAAE,cAAc,EAAE,MAAM,8DAA8D,CAAC;AAG9F,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAqB,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,eAAe,EAAmB,MAAM,UAAU,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,MAAM,gBAAgB,CAAC;AAuG5E;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,gBAAgB,CACpC,KAAqB,EACrB,MAAe,EACf,GAAW,EACX,QAAuB,EACvB,OAAiC;IAEjC,MAAM,aAAa,GAAG,mBAAmB,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC;IAChE,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IACzB,mBAAmB,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACvC,gBAAgB,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AMG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAY;IAC3C,IAAI,IAAI,KAAK,EAAE,IAAI,IAAI,KAAK,UAAU,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;QAC7D,MAAM,IAAI,UAAU,CAClB,6BAA6B,IAAI,oCAAoC,CACtE,CAAC;IACJ,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAC7B,OAAe;IAEf,IAAI,OAAO,KAAK,EAAE,IAAI,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,QAAQ,EAAE,CAAC;QACnE,MAAM,IAAI,UAAU,CAClB,4BAA4B,OAAO,iCAAiC,CACrE,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -1,4 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { create } from "@bufbuild/protobuf";
|
|
2
|
+
import { Code, ConnectError, createRouterTransport } from "@connectrpc/connect";
|
|
3
|
+
import { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
4
|
+
import {
|
|
5
|
+
GetServerInfoOutputSchema,
|
|
6
|
+
PlatformQueryController,
|
|
7
|
+
ServerEdition,
|
|
8
|
+
} from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
|
|
2
9
|
import { afterEach, describe, expect, it } from "vitest";
|
|
3
10
|
import type { Config } from "../config/index.js";
|
|
4
11
|
import { createBackendClient } from "./client.js";
|
|
@@ -52,3 +59,84 @@ describe("createBackendClient — controller factory", () => {
|
|
|
52
59
|
expect(typeof platform.getServerInfo).toBe("function");
|
|
53
60
|
});
|
|
54
61
|
});
|
|
62
|
+
|
|
63
|
+
// An in-memory server that answers getServerInfo with one edition and counts
|
|
64
|
+
// how often it was asked. `answers` is consumed in order; the last entry
|
|
65
|
+
// repeats, so a single-entry list is a steady server and a two-entry list is
|
|
66
|
+
// "fails once, then recovers".
|
|
67
|
+
function serverAnswering(...answers: Array<ServerEdition | ConnectError>): {
|
|
68
|
+
transport: ReturnType<typeof createRouterTransport>;
|
|
69
|
+
asked: () => number;
|
|
70
|
+
} {
|
|
71
|
+
let asked = 0;
|
|
72
|
+
const transport = createRouterTransport(({ service }) => {
|
|
73
|
+
service(PlatformQueryController, {
|
|
74
|
+
getServerInfo: () => {
|
|
75
|
+
const answer = answers[Math.min(asked, answers.length - 1)]!;
|
|
76
|
+
asked += 1;
|
|
77
|
+
if (answer instanceof ConnectError) throw answer;
|
|
78
|
+
return create(GetServerInfoOutputSchema, {
|
|
79
|
+
edition: answer,
|
|
80
|
+
version: "1.2.3",
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
return { transport, asked: () => asked };
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
describe("BackendClient — the server's edition and what it serves (20260911.11 A3)", () => {
|
|
89
|
+
it("answers the tier question against the server's REPORTED edition, not the config's backend type", async () => {
|
|
90
|
+
// The config says "cloud"; the server says it is the open-source edition.
|
|
91
|
+
// The server wins: a cloud-only kind is not served, a core kind is.
|
|
92
|
+
const oss = serverAnswering(ServerEdition.oss);
|
|
93
|
+
const client = createBackendClient({
|
|
94
|
+
config: cloud("t"),
|
|
95
|
+
transport: oss.transport,
|
|
96
|
+
});
|
|
97
|
+
expect(
|
|
98
|
+
await client.isResourceAvailable(ApiResourceKind.platform_client),
|
|
99
|
+
).toBe(false);
|
|
100
|
+
expect(await client.isResourceAvailable(ApiResourceKind.agent)).toBe(true);
|
|
101
|
+
|
|
102
|
+
const cloudServer = serverAnswering(ServerEdition.cloud);
|
|
103
|
+
const onCloud = createBackendClient({
|
|
104
|
+
config: cloud("t"),
|
|
105
|
+
transport: cloudServer.transport,
|
|
106
|
+
});
|
|
107
|
+
expect(
|
|
108
|
+
await onCloud.isResourceAvailable(ApiResourceKind.platform_client),
|
|
109
|
+
).toBe(true);
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
it("asks the server once per process: connect() and every availability question share the answer", async () => {
|
|
113
|
+
const server = serverAnswering(ServerEdition.oss);
|
|
114
|
+
const client = createBackendClient({
|
|
115
|
+
config: cloud("t"),
|
|
116
|
+
transport: server.transport,
|
|
117
|
+
});
|
|
118
|
+
await client.connect();
|
|
119
|
+
await client.isResourceAvailable(ApiResourceKind.agent);
|
|
120
|
+
await client.isResourceAvailable(ApiResourceKind.platform_client);
|
|
121
|
+
const info = await client.serverInfo();
|
|
122
|
+
expect(info.deploymentMode).toBe("local");
|
|
123
|
+
expect(info.version).toBe("1.2.3");
|
|
124
|
+
expect(server.asked(), "one getServerInfo for the whole process").toBe(1);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("a failed probe propagates and is not remembered — the next question asks again", async () => {
|
|
128
|
+
const server = serverAnswering(
|
|
129
|
+
new ConnectError("server warming up", Code.Unavailable),
|
|
130
|
+
ServerEdition.cloud,
|
|
131
|
+
);
|
|
132
|
+
const client = createBackendClient({
|
|
133
|
+
config: cloud("t"),
|
|
134
|
+
transport: server.transport,
|
|
135
|
+
});
|
|
136
|
+
await expect(client.serverInfo()).rejects.toThrow("server warming up");
|
|
137
|
+
expect(
|
|
138
|
+
await client.isResourceAvailable(ApiResourceKind.platform_client),
|
|
139
|
+
).toBe(true);
|
|
140
|
+
expect(server.asked(), "the rejection was not cached").toBe(2);
|
|
141
|
+
});
|
|
142
|
+
});
|
package/src/client/client.ts
CHANGED
|
@@ -6,6 +6,14 @@
|
|
|
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
|
|
@@ -13,9 +21,20 @@
|
|
|
13
21
|
|
|
14
22
|
import type { DescService } from "@bufbuild/protobuf";
|
|
15
23
|
import { type Client, createClient, type Transport } from "@connectrpc/connect";
|
|
16
|
-
import {
|
|
24
|
+
import type { ApiResourceKind } from "@stigmer/protos/ai/stigmer/commons/apiresource/apiresourcekind/api_resource_kind_pb";
|
|
25
|
+
import {
|
|
26
|
+
isResourceAvailable,
|
|
27
|
+
type ServerInfo,
|
|
28
|
+
Stigmer,
|
|
29
|
+
type TokenProvider,
|
|
30
|
+
} from "@stigmer/sdk";
|
|
17
31
|
import { createNodeTransport, normalizeEndpoint } from "@stigmer/sdk/node";
|
|
18
|
-
import {
|
|
32
|
+
import {
|
|
33
|
+
type Config,
|
|
34
|
+
load,
|
|
35
|
+
resolveEndpoint,
|
|
36
|
+
resolveToken,
|
|
37
|
+
} from "../config/index.js";
|
|
19
38
|
import { CliExitError, ExitCode } from "../errors/index.js";
|
|
20
39
|
|
|
21
40
|
/** The composed backend client returned by {@link createBackendClient}. */
|
|
@@ -30,6 +49,18 @@ export interface BackendClient {
|
|
|
30
49
|
controller<Desc extends DescService>(service: Desc): Client<Desc>;
|
|
31
50
|
/** Probe the server (unauthenticated) to fail fast on connectivity issues. */
|
|
32
51
|
connect(timeoutMs?: number): Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* The connected server's edition and version, as the server reports them.
|
|
54
|
+
* Asked once per process and remembered; a failed probe is rethrown and
|
|
55
|
+
* not remembered, so the next question asks again.
|
|
56
|
+
*/
|
|
57
|
+
serverInfo(): Promise<ServerInfo>;
|
|
58
|
+
/**
|
|
59
|
+
* Whether the connected server serves `kind`: the kind's tier against the
|
|
60
|
+
* server's reported edition. The CLI's counterpart to the console's
|
|
61
|
+
* `useResourceAvailable`.
|
|
62
|
+
*/
|
|
63
|
+
isResourceAvailable(kind: ApiResourceKind): Promise<boolean>;
|
|
33
64
|
}
|
|
34
65
|
|
|
35
66
|
export interface BackendClientOptions {
|
|
@@ -37,21 +68,47 @@ export interface BackendClientOptions {
|
|
|
37
68
|
readonly config?: Config;
|
|
38
69
|
/** Token-provider override (the auth module supplies a refreshing provider). */
|
|
39
70
|
readonly getAccessToken?: TokenProvider;
|
|
71
|
+
/**
|
|
72
|
+
* Transport override; defaults to the SDK's Node transport over the resolved
|
|
73
|
+
* endpoint. Mirrors `StigmerConfig.customTransport`: tests hand in an
|
|
74
|
+
* in-memory router so the façade's behaviour is proven without a network.
|
|
75
|
+
*/
|
|
76
|
+
readonly transport?: Transport;
|
|
40
77
|
}
|
|
41
78
|
|
|
42
79
|
const DEFAULT_CONNECT_TIMEOUT_MS = 10_000;
|
|
43
80
|
|
|
44
|
-
export function createBackendClient(
|
|
81
|
+
export function createBackendClient(
|
|
82
|
+
options: BackendClientOptions = {},
|
|
83
|
+
): BackendClient {
|
|
45
84
|
const config = options.config ?? load();
|
|
46
85
|
const baseUrl = normalizeEndpoint(resolveEndpoint(config));
|
|
47
86
|
|
|
48
87
|
// Dynamic provider: re-reads env/config on every request so a token refreshed
|
|
49
88
|
// mid-session is picked up. STIGMER_API_KEY > config token precedence lives in
|
|
50
89
|
// resolveToken; a caller-supplied provider (refresh-aware) takes over entirely.
|
|
51
|
-
const tokenProvider: TokenProvider =
|
|
90
|
+
const tokenProvider: TokenProvider =
|
|
91
|
+
options.getAccessToken ?? (() => resolveToken(config) || null);
|
|
52
92
|
|
|
53
|
-
const transport =
|
|
54
|
-
|
|
93
|
+
const transport =
|
|
94
|
+
options.transport ??
|
|
95
|
+
createNodeTransport({ baseUrl, getAccessToken: tokenProvider });
|
|
96
|
+
const stigmer = new Stigmer({
|
|
97
|
+
baseUrl,
|
|
98
|
+
getAccessToken: tokenProvider,
|
|
99
|
+
customTransport: transport,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
// One probe per process. The pending promise is shared so concurrent askers
|
|
103
|
+
// coalesce; a rejection clears it so a transient fault is not remembered.
|
|
104
|
+
let serverInfo: Promise<ServerInfo> | undefined;
|
|
105
|
+
const probeServerInfo = (): Promise<ServerInfo> => {
|
|
106
|
+
serverInfo ??= stigmer.platform.getServerInfo().catch((err: unknown) => {
|
|
107
|
+
serverInfo = undefined;
|
|
108
|
+
throw err;
|
|
109
|
+
});
|
|
110
|
+
return serverInfo;
|
|
111
|
+
};
|
|
55
112
|
|
|
56
113
|
return {
|
|
57
114
|
stigmer,
|
|
@@ -61,18 +118,34 @@ export function createBackendClient(options: BackendClientOptions = {}): Backend
|
|
|
61
118
|
return createClient(service, transport);
|
|
62
119
|
},
|
|
63
120
|
async connect(timeoutMs = DEFAULT_CONNECT_TIMEOUT_MS) {
|
|
64
|
-
await withTimeout(
|
|
121
|
+
await withTimeout(probeServerInfo(), timeoutMs);
|
|
122
|
+
},
|
|
123
|
+
serverInfo: probeServerInfo,
|
|
124
|
+
async isResourceAvailable(kind) {
|
|
125
|
+
return isResourceAvailable(
|
|
126
|
+
kind,
|
|
127
|
+
(await probeServerInfo()).deploymentMode,
|
|
128
|
+
);
|
|
65
129
|
},
|
|
66
130
|
};
|
|
67
131
|
}
|
|
68
132
|
|
|
69
133
|
// Soft timeout: races the RPC against a timer. It cannot cancel the underlying
|
|
70
134
|
// request, but the CLI exits immediately after, so the dangling call is moot.
|
|
71
|
-
async function withTimeout<T>(
|
|
135
|
+
async function withTimeout<T>(
|
|
136
|
+
promise: Promise<T>,
|
|
137
|
+
timeoutMs: number,
|
|
138
|
+
): Promise<T> {
|
|
72
139
|
let timer: NodeJS.Timeout | undefined;
|
|
73
140
|
const timeout = new Promise<never>((_, reject) => {
|
|
74
141
|
timer = setTimeout(
|
|
75
|
-
() =>
|
|
142
|
+
() =>
|
|
143
|
+
reject(
|
|
144
|
+
new CliExitError(
|
|
145
|
+
"Timed out connecting to the Stigmer server",
|
|
146
|
+
ExitCode.Connection,
|
|
147
|
+
),
|
|
148
|
+
),
|
|
76
149
|
timeoutMs,
|
|
77
150
|
);
|
|
78
151
|
});
|
|
@@ -1,16 +1,12 @@
|
|
|
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.
|
|
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.
|
|
5
7
|
|
|
6
8
|
import type { Command } from "commander";
|
|
7
|
-
import {
|
|
8
|
-
activeBackend,
|
|
9
|
-
ensureAuthenticated,
|
|
10
|
-
load,
|
|
11
|
-
resolveContextOrganization,
|
|
12
|
-
save,
|
|
13
|
-
} from "../../config/index.js";
|
|
9
|
+
import { activeBackend, load, save } from "../../config/index.js";
|
|
14
10
|
import {
|
|
15
11
|
CommandResult,
|
|
16
12
|
type OutputFlags,
|
|
@@ -27,14 +23,8 @@ export function registerAuth(program: Command): void {
|
|
|
27
23
|
.command("login")
|
|
28
24
|
.description("log in to Stigmer Cloud via browser (PKCE OAuth)")
|
|
29
25
|
.action(async () => {
|
|
30
|
-
const {
|
|
31
|
-
await
|
|
32
|
-
renderResult(
|
|
33
|
-
CommandResult.success("Authenticated with Stigmer Cloud")
|
|
34
|
-
.hint("Run commands against the cloud backend, e.g.:")
|
|
35
|
-
.hint(" stigmer list agents"),
|
|
36
|
-
"human",
|
|
37
|
-
);
|
|
26
|
+
const { runLogin } = await import("./login.js");
|
|
27
|
+
renderResult(await runLogin(), "human");
|
|
38
28
|
});
|
|
39
29
|
|
|
40
30
|
const logout = auth
|
|
@@ -49,6 +39,7 @@ export function registerAuth(program: Command): void {
|
|
|
49
39
|
.command("whoami")
|
|
50
40
|
.description("show the currently authenticated account")
|
|
51
41
|
.action(async (options: OutputFlags) => {
|
|
42
|
+
const { runWhoami } = await import("./whoami.js");
|
|
52
43
|
renderResult(await runWhoami(), resultFormat(options));
|
|
53
44
|
});
|
|
54
45
|
addResultFlags(whoami);
|
|
@@ -83,43 +74,3 @@ function runLogout(): CommandResult {
|
|
|
83
74
|
"Run 'stigmer auth login' to authenticate again.",
|
|
84
75
|
);
|
|
85
76
|
}
|
|
86
|
-
|
|
87
|
-
async function runWhoami(): Promise<CommandResult> {
|
|
88
|
-
const { connectBackend } = await import("../../backend.js");
|
|
89
|
-
const client = connectBackend();
|
|
90
|
-
ensureAuthenticated(client.config);
|
|
91
|
-
|
|
92
|
-
const account = await client.stigmer.identityAccount.whoAmI();
|
|
93
|
-
const result = CommandResult.success("Authenticated");
|
|
94
|
-
const section = result.addSection("");
|
|
95
|
-
|
|
96
|
-
if (account.metadata !== undefined) {
|
|
97
|
-
section.field("Account ID", account.metadata.id);
|
|
98
|
-
if (account.metadata.name !== "")
|
|
99
|
-
section.field("Name", account.metadata.name);
|
|
100
|
-
}
|
|
101
|
-
if (account.spec !== undefined) {
|
|
102
|
-
if (account.spec.email !== "") section.field("Email", account.spec.email);
|
|
103
|
-
if (account.spec.firstName !== "" || account.spec.lastName !== "") {
|
|
104
|
-
section.field(
|
|
105
|
-
"Full Name",
|
|
106
|
-
`${account.spec.firstName} ${account.spec.lastName}`.trim(),
|
|
107
|
-
);
|
|
108
|
-
}
|
|
109
|
-
section.field(
|
|
110
|
-
"Account Type",
|
|
111
|
-
account.spec.isMachineAccount ? "Machine Account" : "User Account",
|
|
112
|
-
);
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
const org = resolveContextOrganization(client.config);
|
|
116
|
-
if (org !== "") {
|
|
117
|
-
section.field("Organization", org);
|
|
118
|
-
} else {
|
|
119
|
-
result.hint(
|
|
120
|
-
"No organization set. Use: stigmer config context set --org <slug>",
|
|
121
|
-
);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
return result;
|
|
125
|
-
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// Unit tests for `stigmer auth login`'s result (commands/auth/login.ts;
|
|
2
|
+
// 20260911.11 A3): after the browser flow persists the tokens, the command
|
|
3
|
+
// runs the SDK's ensureMyIdentityAccount — the console's first-sign-in flow —
|
|
4
|
+
// so a CLI-only user is provisioned. loginResult is the pure half: given how
|
|
5
|
+
// the account setup went, the CommandResult a person reads.
|
|
6
|
+
//
|
|
7
|
+
// The tokens are saved BEFORE the account step runs, so a setup failure is a
|
|
8
|
+
// warning that says the login itself succeeded and how to finish, never an
|
|
9
|
+
// error that makes the person log in again.
|
|
10
|
+
|
|
11
|
+
import { describe, expect, it } from "vitest";
|
|
12
|
+
|
|
13
|
+
import { loginResult } from "./login.js";
|
|
14
|
+
|
|
15
|
+
const CLOUD_HINTS = [
|
|
16
|
+
"Run commands against the cloud backend, e.g.:",
|
|
17
|
+
" stigmer list agents",
|
|
18
|
+
];
|
|
19
|
+
|
|
20
|
+
describe("loginResult", () => {
|
|
21
|
+
it("an existing account: authenticated, with the cloud usage hints", () => {
|
|
22
|
+
const result = loginResult({ status: "ensured", created: false });
|
|
23
|
+
expect(result.status).toBe("success");
|
|
24
|
+
expect(result.message).toBe("Authenticated with Stigmer Cloud");
|
|
25
|
+
expect(result.hints).toEqual(CLOUD_HINTS);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
it("a first sign-in says the account was created — visible, never silent", () => {
|
|
29
|
+
const result = loginResult({ status: "ensured", created: true });
|
|
30
|
+
expect(result.status).toBe("success");
|
|
31
|
+
expect(result.message).toBe(
|
|
32
|
+
"Authenticated with Stigmer Cloud — your account was created on this first sign-in",
|
|
33
|
+
);
|
|
34
|
+
expect(result.hints).toEqual(CLOUD_HINTS);
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
it("a setup failure is a warning: the login stood, and whoami is the way to finish", () => {
|
|
38
|
+
const result = loginResult({
|
|
39
|
+
status: "failed",
|
|
40
|
+
message:
|
|
41
|
+
"Failed to fetch user profile from identity provider: userinfo answered 503",
|
|
42
|
+
});
|
|
43
|
+
expect(result.status).toBe("warning");
|
|
44
|
+
expect(result.message).toBe(
|
|
45
|
+
"Authenticated with Stigmer Cloud, but your account could not be set up: " +
|
|
46
|
+
"Failed to fetch user profile from identity provider: userinfo answered 503",
|
|
47
|
+
);
|
|
48
|
+
expect(result.hints).toEqual([
|
|
49
|
+
"Run 'stigmer auth whoami' to finish setting up your account.",
|
|
50
|
+
]);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
@@ -0,0 +1,70 @@
|
|
|
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
|
+
|
|
14
|
+
import { ensureMyIdentityAccount } from "@stigmer/sdk";
|
|
15
|
+
import { classify } from "../../errors/index.js";
|
|
16
|
+
import { CommandResult } from "../../output/index.js";
|
|
17
|
+
|
|
18
|
+
/** How the account step went, after the tokens were persisted. */
|
|
19
|
+
export type AccountSetup =
|
|
20
|
+
| { readonly status: "ensured"; readonly created: boolean }
|
|
21
|
+
| { readonly status: "failed"; readonly message: string };
|
|
22
|
+
|
|
23
|
+
const CLOUD_HINTS = [
|
|
24
|
+
"Run commands against the cloud backend, e.g.:",
|
|
25
|
+
" stigmer list agents",
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
/** Render the login outcome. Pure: the command layer supplies `setup`. */
|
|
29
|
+
export function loginResult(setup: AccountSetup): CommandResult {
|
|
30
|
+
switch (setup.status) {
|
|
31
|
+
case "ensured": {
|
|
32
|
+
const result = CommandResult.success(
|
|
33
|
+
setup.created
|
|
34
|
+
? "Authenticated with Stigmer Cloud — your account was created on this first sign-in"
|
|
35
|
+
: "Authenticated with Stigmer Cloud",
|
|
36
|
+
);
|
|
37
|
+
for (const hint of CLOUD_HINTS) result.hint(hint);
|
|
38
|
+
return result;
|
|
39
|
+
}
|
|
40
|
+
case "failed":
|
|
41
|
+
return CommandResult.warning(
|
|
42
|
+
`Authenticated with Stigmer Cloud, but your account could not be set up: ${setup.message}`,
|
|
43
|
+
).hint("Run 'stigmer auth whoami' to finish setting up your account.");
|
|
44
|
+
default: {
|
|
45
|
+
const _exhaustive: never = setup;
|
|
46
|
+
throw new Error(`unknown account setup: ${String(_exhaustive)}`);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export async function runLogin(): Promise<CommandResult> {
|
|
52
|
+
const { login } = await import("../../auth/index.js");
|
|
53
|
+
await login();
|
|
54
|
+
return loginResult(await ensureAccount());
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// The tokens are on disk by now; connectBackend() reads them fresh.
|
|
58
|
+
async function ensureAccount(): Promise<AccountSetup> {
|
|
59
|
+
const { connectBackend } = await import("../../backend.js");
|
|
60
|
+
const client = connectBackend();
|
|
61
|
+
try {
|
|
62
|
+
const { created } = await ensureMyIdentityAccount(client.stigmer, {
|
|
63
|
+
onProvisioning: () =>
|
|
64
|
+
process.stderr.write("Setting up your account...\n"),
|
|
65
|
+
});
|
|
66
|
+
return { status: "ensured", created };
|
|
67
|
+
} catch (err: unknown) {
|
|
68
|
+
return { status: "failed", message: classify(err)?.message ?? String(err) };
|
|
69
|
+
}
|
|
70
|
+
}
|