@stigmer/sdk 3.24.0 → 3.25.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.
@@ -4,16 +4,28 @@
4
4
  * (`deploymentModeOf`), so a third edition on the wire reaches consumers
5
5
  * as its own mode and never collapses into "cloud" by accident. The raw
6
6
  * edition rides beside it for callers that want the wire value.
7
+ *
8
+ * Also pins the authentication posture across the wire: a server's `true`
9
+ * and `false` reach callers as they were sent, and a server that predates
10
+ * the field answers `undefined`, never `false` — the difference between
11
+ * "this server trusts every request" and "this server did not say", which
12
+ * a console meeting an older server must not confuse.
7
13
  */
8
14
  import { describe, expect, it } from "vitest";
9
15
  import { createRouterTransport } from "@connectrpc/connect";
10
16
  import { create } from "@bufbuild/protobuf";
11
17
  import { GetServerInfoOutputSchema, PlatformQueryController, ServerEdition, } from "@stigmer/protos/ai/stigmer/platform/v1/server_info_pb";
12
18
  import { PlatformClient } from "../platform";
13
- function clientAnswering(edition) {
19
+ function clientAnswering(edition, authenticationRequired) {
14
20
  return new PlatformClient(createRouterTransport(({ service }) => {
15
21
  service(PlatformQueryController, {
16
- getServerInfo: () => create(GetServerInfoOutputSchema, { edition, version: "1.2.3" }),
22
+ getServerInfo: () => create(GetServerInfoOutputSchema, {
23
+ edition,
24
+ version: "1.2.3",
25
+ ...(authenticationRequired !== undefined
26
+ ? { authenticationRequired }
27
+ : {}),
28
+ }),
17
29
  });
18
30
  }));
19
31
  }
@@ -28,5 +40,13 @@ describe("PlatformClient.getServerInfo", () => {
28
40
  expect(info.edition).toBe(edition);
29
41
  expect(info.version).toBe("1.2.3");
30
42
  });
43
+ it.each([
44
+ [true, true],
45
+ [false, false],
46
+ [undefined, undefined],
47
+ ])("reports a server's authentication posture of %s as %s", async (sent, reported) => {
48
+ const info = await clientAnswering(ServerEdition.cloud, sent).getServerInfo();
49
+ expect(info.authenticationRequired).toBe(reported);
50
+ });
31
51
  });
32
52
  //# sourceMappingURL=platform.test.js.map
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AAC,CACT,gEAAgE,EAChE,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE;QACtB,MAAM,IAAI,GAAG,MAAM,eAAe,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC;QAC5D,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC,CACF,CAAC;IAEF,EAAE,CAAC,IAAI,CAAC;QACN,CAAC,IAAI,EAAE,IAAI,CAAC;QACZ,CAAC,KAAK,EAAE,KAAK,CAAC;QACd,CAAC,SAAS,EAAE,SAAS,CAAC;KACd,CAAC,CACT,uDAAuD,EACvD,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,eAAe,CAChC,aAAa,CAAC,KAAK,EACnB,IAAI,CACL,CAAC,aAAa,EAAE,CAAC;QAClB,MAAM,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IACrD,CAAC,CACF,CAAC;AACJ,CAAC,CAAC,CAAC"}
@@ -17,7 +17,7 @@ export const KIND_TIERS = new Map([
17
17
  [ApiResourceKind.invitation, ResourceTier.enterprise],
18
18
  [ApiResourceKind.identity_provider, ResourceTier.enterprise],
19
19
  [ApiResourceKind.oauth_app, ResourceTier.open_source],
20
- [ApiResourceKind.platform_client, ResourceTier.cloud_only],
20
+ [ApiResourceKind.platform_client, ResourceTier.open_source],
21
21
  [ApiResourceKind.organization, ResourceTier.open_source],
22
22
  [ApiResourceKind.platform, ResourceTier.enterprise],
23
23
  [ApiResourceKind.agent, ResourceTier.open_source],
@@ -1 +1 @@
1
- {"version":3,"file":"resource-availability.js","sourceR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C9D,CAAC,eAAe,CAAC,WAAW,EAAE,YAAY,CAAC,WAAW,CAAC;IACvD,CAAC,eAAe,CAAC,iBAAiB,EAAE,YAAY,CAAC,WAAW,CAAC;IAC7D,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC;IACpD,CAAC,eAAe,CAAC,QAAQ,EAAE,YAAY,CAAC,WAAW,CAAC;IACpD,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC;IAClD,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,CAAC,WAAW,CAAC;IAClD,CAAC,eAAe,CAAC,IAAI,EAAE,YAAY,CAAC,UAAU,CAAC;IAC/C,CAAC,eAAe,CAAC,YAAY,EAAE,YAAY,CAAC,UAAU,CAAC;IACvD,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,UAAU,CAAC;CACnD,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stigmer/sdk",
3
- "version": "3.24.0",
3
+ "version": "3.25.0",
4
4
  "description": "Stigmer TypeScript SDK — typed API client for all Stigmer platform resources",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -41,6 +41,6 @@
41
41
  "peerDependencies": {
42
42
  "@bufbuild/protobuf": "^2.0.0",
43
43
  "@connectrpc/connect-node": "^2.0.0",
44
- "@stigmer/protos": "3.24.0"
44
+ "@stigmer/protos": "3.25.0"
45
45
  }
46
46
  }
package/platform.d.ts CHANGED
@@ -9,6 +9,17 @@ export interface ServerInfo {
9
9
  readonly edition: ServerEdition;
10
10
  /** Semantic version of the server binary. */
11
11
  readonly version: string;
12
+ /**
13
+ * Whether the server authenticates its callers. `false` on a server that
14
+ * trusts every request (the default single-operator posture), where
15
+ * features that hand out credentials only a verifying server honours —
16
+ * minting PlatformClient user tokens — are unavailable.
17
+ *
18
+ * `undefined` when the server predates the field, so its posture is
19
+ * unknown: offer the feature and let the server's own answer decide.
20
+ * Only an explicit `false` means the feature is unavailable.
21
+ */
22
+ readonly authenticationRequired: boolean | undefined;
12
23
  }
13
24
  /**
14
25
  * Client for platform-level queries (server info, capabilities, license).
@@ -22,7 +33,8 @@ export declare class PlatformClient {
22
33
  private readonly platform;
23
34
  constructor(transport: Transport);
24
35
  /**
25
- * Retrieve the connected server's edition and version.
36
+ * Retrieve the connected server's edition, version and authentication
37
+ * posture.
26
38
  *
27
39
  * Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
28
40
  * through {@link deploymentModeOf}:
package/platform.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOhF,OAAO,KAAK,EACV,sBAAsB,EAEtB,aAAa,EACd,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAEpC,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;gBAEtD,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;OASG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAe1C;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAS1D"}
1
+ {"version":3,"file":"platform.d.ts","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAOhF,OAAO,KAAK,EACV,sBAAsB,EAEtB,aAAa,EACd,MAAM,uDAAuD,CAAC;AAE/D,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,4BAA4B,CAAC;AAEpC,oFAAoF;AACpF,MAAM,WAAW,UAAU;IACzB,yDAAyD;IACzD,QAAQ,CAAC,cAAc,EAAE,cAAc,CAAC;IACxC,qCAAqC;IACrC,QAAQ,CAAC,OAAO,EAAE,aAAa,CAAC;IAChC,6CAA6C;IAC7C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB;;;;;;;;;OASG;IACH,QAAQ,CAAC,sBAAsB,EAAE,OAAO,GAAG,SAAS,CAAC;CACtD;AAED;;;;;;;GAOG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAyC;gBAEtD,SAAS,EAAE,SAAS;IAIhC;;;;;;;;;;OAUG;IACG,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC;IAgB1C;;;;;;;;;OASG;IACG,gBAAgB,IAAI,OAAO,CAAC,sBAAsB,CAAC;CAS1D"}
package/platform.js CHANGED
@@ -17,7 +17,8 @@ export class PlatformClient {
17
17
  this.platform = createClient(PlatformQueryController, transport);
18
18
  }
19
19
  /**
20
- * Retrieve the connected server's edition and version.
20
+ * Retrieve the connected server's edition, version and authentication
21
+ * posture.
21
22
  *
22
23
  * Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
23
24
  * through {@link deploymentModeOf}:
@@ -33,6 +34,7 @@ export class PlatformClient {
33
34
  deploymentMode: deploymentModeOf(resp.edition),
34
35
  edition: resp.edition,
35
36
  version: resp.version,
37
+ authenticationRequired: resp.authenticationRequired,
36
38
  };
37
39
  }
38
40
  catch (e) {
package/platform.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"platform.js","sourceRoot":"","sources":["../src/platform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,M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own mode and never collapses into "cloud" by accident. The raw
6
6
  * edition rides beside it for callers that want the wire value.
7
+ *
8
+ * Also pins the authentication posture across the wire: a server's `true`
9
+ * and `false` reach callers as they were sent, and a server that predates
10
+ * the field answers `undefined`, never `false` — the difference between
11
+ * "this server trusts every request" and "this server did not say", which
12
+ * a console meeting an older server must not confuse.
7
13
  */
8
14
  import { describe, expect, it } from "vitest";
9
15
  import { createRouterTransport } from "@connectrpc/connect";
@@ -16,12 +22,21 @@ import {
16
22
 
17
23
  import { PlatformClient } from "../platform";
18
24
 
19
- function clientAnswering(edition: ServerEdition): PlatformClient {
25
+ function clientAnswering(
26
+ edition: ServerEdition,
27
+ authenticationRequired?: boolean,
28
+ ): PlatformClient {
20
29
  return new PlatformClient(
21
30
  createRouterTransport(({ service }) => {
22
31
  service(PlatformQueryController, {
23
32
  getServerInfo: () =>
24
- create(GetServerInfoOutputSchema, { edition, version: "1.2.3" }),
33
+ create(GetServerInfoOutputSchema, {
34
+ edition,
35
+ version: "1.2.3",
36
+ ...(authenticationRequired !== undefined
37
+ ? { authenticationRequired }
38
+ : {}),
39
+ }),
25
40
  });
26
41
  }),
27
42
  );
@@ -41,4 +56,19 @@ describe("PlatformClient.getServerInfo", () => {
41
56
  expect(info.version).toBe("1.2.3");
42
57
  },
43
58
  );
59
+
60
+ it.each([
61
+ [true, true],
62
+ [false, false],
63
+ [undefined, undefined],
64
+ ] as const)(
65
+ "reports a server's authentication posture of %s as %s",
66
+ async (sent, reported) => {
67
+ const info = await clientAnswering(
68
+ ServerEdition.cloud,
69
+ sent,
70
+ ).getServerInfo();
71
+ expect(info.authenticationRequired).toBe(reported);
72
+ },
73
+ );
44
74
  });
@@ -19,7 +19,7 @@ export const KIND_TIERS: ReadonlyMap<ApiResourceKind, ResourceTier> = new Map([
19
19
  [ApiResourceKind.invitation, ResourceTier.enterprise],
20
20
  [ApiResourceKind.identity_provider, ResourceTier.enterprise],
21
21
  [ApiResourceKind.oauth_app, ResourceTier.open_source],
22
- [ApiResourceKind.platform_client, ResourceTier.cloud_only],
22
+ [ApiResourceKind.platform_client, ResourceTier.open_source],
23
23
  [ApiResourceKind.organization, ResourceTier.open_source],
24
24
  [ApiResourceKind.platform, ResourceTier.enterprise],
25
25
  [ApiResourceKind.agent, ResourceTier.open_source],
package/src/platform.ts CHANGED
@@ -24,6 +24,17 @@ export interface ServerInfo {
24
24
  readonly edition: ServerEdition;
25
25
  /** Semantic version of the server binary. */
26
26
  readonly version: string;
27
+ /**
28
+ * Whether the server authenticates its callers. `false` on a server that
29
+ * trusts every request (the default single-operator posture), where
30
+ * features that hand out credentials only a verifying server honours —
31
+ * minting PlatformClient user tokens — are unavailable.
32
+ *
33
+ * `undefined` when the server predates the field, so its posture is
34
+ * unknown: offer the feature and let the server's own answer decide.
35
+ * Only an explicit `false` means the feature is unavailable.
36
+ */
37
+ readonly authenticationRequired: boolean | undefined;
27
38
  }
28
39
 
29
40
  /**
@@ -42,7 +53,8 @@ export class PlatformClient {
42
53
  }
43
54
 
44
55
  /**
45
- * Retrieve the connected server's edition and version.
56
+ * Retrieve the connected server's edition, version and authentication
57
+ * posture.
46
58
  *
47
59
  * Maps the proto {@link ServerEdition} to a {@link DeploymentMode}
48
60
  * through {@link deploymentModeOf}:
@@ -60,6 +72,7 @@ export class PlatformClient {
60
72
  deploymentMode: deploymentModeOf(resp.edition),
61
73
  edition: resp.edition,
62
74
  version: resp.version,
75
+ authenticationRequired: resp.authenticationRequired,
63
76
  };
64
77
  } catch (e) {
65
78
  throw wrapError(e);