@stigmer/sdk 0.0.86 → 0.0.88
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/__tests__/node.test.d.ts +2 -0
- package/__tests__/node.test.d.ts.map +1 -0
- package/__tests__/node.test.js +52 -0
- package/__tests__/node.test.js.map +1 -0
- package/config.d.ts +37 -4
- package/config.d.ts.map +1 -1
- package/config.js +5 -0
- package/config.js.map +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js +37 -0
- package/errors.js.map +1 -1
- package/gen/identityprovider.d.ts +5 -0
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js +4 -0
- package/gen/identityprovider.js.map +1 -1
- package/node.d.ts +52 -0
- package/node.d.ts.map +1 -0
- package/node.js +60 -0
- package/node.js.map +1 -0
- package/package.json +7 -2
- package/src/__tests__/node.test.ts +57 -0
- package/src/config.ts +45 -4
- package/src/errors.ts +37 -0
- package/src/gen/identityprovider.ts +9 -0
- package/src/node.ts +87 -0
- package/src/stigmer.ts +2 -2
- package/stigmer.js +2 -2
- package/stigmer.js.map +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/node.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { createNodeClient, createNodeTransport } from "../node";
|
|
3
|
+
describe("createNodeTransport", () => {
|
|
4
|
+
it("creates a transport with an API key", () => {
|
|
5
|
+
const transport = createNodeTransport({
|
|
6
|
+
baseUrl: "https://api.stigmer.ai",
|
|
7
|
+
apiKey: "sk_test_123",
|
|
8
|
+
});
|
|
9
|
+
expect(transport).toBeDefined();
|
|
10
|
+
});
|
|
11
|
+
it("creates a transport with a token provider", () => {
|
|
12
|
+
const transport = createNodeTransport({
|
|
13
|
+
baseUrl: "https://api.stigmer.ai",
|
|
14
|
+
getAccessToken: () => "token_abc",
|
|
15
|
+
});
|
|
16
|
+
expect(transport).toBeDefined();
|
|
17
|
+
});
|
|
18
|
+
it("creates a transport without auth", () => {
|
|
19
|
+
const transport = createNodeTransport({
|
|
20
|
+
baseUrl: "https://api.stigmer.ai",
|
|
21
|
+
});
|
|
22
|
+
expect(transport).toBeDefined();
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe("createNodeClient", () => {
|
|
26
|
+
it("creates a Stigmer client with API key", () => {
|
|
27
|
+
const client = createNodeClient({
|
|
28
|
+
baseUrl: "https://api.stigmer.ai",
|
|
29
|
+
apiKey: "sk_test_123",
|
|
30
|
+
});
|
|
31
|
+
expect(client).toBeDefined();
|
|
32
|
+
expect(client.baseUrl).toBe("https://api.stigmer.ai");
|
|
33
|
+
});
|
|
34
|
+
it("creates a Stigmer client with token provider", () => {
|
|
35
|
+
const client = createNodeClient({
|
|
36
|
+
baseUrl: "https://api.stigmer.ai",
|
|
37
|
+
getAccessToken: () => "token_abc",
|
|
38
|
+
});
|
|
39
|
+
expect(client).toBeDefined();
|
|
40
|
+
expect(client.baseUrl).toBe("https://api.stigmer.ai");
|
|
41
|
+
});
|
|
42
|
+
it("exposes resource sub-clients", () => {
|
|
43
|
+
const client = createNodeClient({
|
|
44
|
+
baseUrl: "https://api.stigmer.ai",
|
|
45
|
+
apiKey: "sk_test_123",
|
|
46
|
+
});
|
|
47
|
+
expect(client.agent).toBeDefined();
|
|
48
|
+
expect(client.session).toBeDefined();
|
|
49
|
+
expect(client.agentExecution).toBeDefined();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
//# sourceMappingURL=node.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.test.js","sourceRoot":"","sources":["../../src/__tests__/node.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,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,OAAO,EAAE,wBAAwB;YACjC,cAAc,EAAE,GAAG,EAAE,CAAC,WAAW;SAClC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC7B,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,wBAAwB,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8BAA8B,EAAE,GAAG,EAAE;QACtC,MAAM,MAAM,GAAG,gBAAgB,CAAC;YAC9B,OAAO,EAAE,wBAAwB;YACjC,MAAM,EAAE,aAAa;SACtB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;QACrC,MAAM,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/config.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Transport } from "@connectrpc/connect";
|
|
1
2
|
/**
|
|
2
3
|
* Token provider callback for dynamic authentication.
|
|
3
4
|
* Called per-request, allowing token refresh and auth state changes.
|
|
@@ -7,9 +8,13 @@ export type TokenProvider = () => Promise<string | null> | string | null;
|
|
|
7
8
|
/**
|
|
8
9
|
* Configuration for the Stigmer SDK client.
|
|
9
10
|
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
11
|
+
* Authentication: exactly one of `apiKey` or `getAccessToken` must be
|
|
12
|
+
* provided (unless `customTransport` handles auth independently).
|
|
13
|
+
*
|
|
14
|
+
* Transport: by default the SDK creates a browser-oriented transport
|
|
15
|
+
* using `@connectrpc/connect-web`. Pass `customTransport` to use a
|
|
16
|
+
* pre-built transport — for example, `@connectrpc/connect-node` for
|
|
17
|
+
* server-side or CLI usage.
|
|
13
18
|
*/
|
|
14
19
|
export interface StigmerConfig {
|
|
15
20
|
/** Base URL of the Stigmer API server (e.g., "https://api.stigmer.ai"). */
|
|
@@ -29,9 +34,37 @@ export interface StigmerConfig {
|
|
|
29
34
|
* - `"grpc-web"` (default): gRPC-Web binary protocol. Compact, battle-tested.
|
|
30
35
|
* - `"connect"`: Connect protocol over HTTP/JSON. Easier to debug with standard HTTP tooling.
|
|
31
36
|
*
|
|
32
|
-
* Both protocols are supported by the Stigmer server.
|
|
37
|
+
* Both protocols are supported by the Stigmer server. Ignored when
|
|
38
|
+
* `customTransport` is provided.
|
|
33
39
|
*/
|
|
34
40
|
readonly transport?: "grpc-web" | "connect";
|
|
41
|
+
/**
|
|
42
|
+
* Pre-built ConnectRPC transport.
|
|
43
|
+
*
|
|
44
|
+
* When provided, the SDK uses this transport directly instead of
|
|
45
|
+
* creating one from `baseUrl`, `transport`, and the auth fields.
|
|
46
|
+
* This enables non-browser environments (Node.js CLIs, edge runtimes)
|
|
47
|
+
* to supply a transport with native HTTP/2 support via
|
|
48
|
+
* `@connectrpc/connect-node` or any other ConnectRPC transport.
|
|
49
|
+
*
|
|
50
|
+
* The caller is responsible for configuring auth interceptors on the
|
|
51
|
+
* custom transport; the SDK's built-in auth interceptor is bypassed.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* import { createConnectTransport } from "@connectrpc/connect-node";
|
|
56
|
+
* import { Stigmer } from "@stigmer/sdk";
|
|
57
|
+
*
|
|
58
|
+
* const stigmer = new Stigmer({
|
|
59
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
60
|
+
* customTransport: createConnectTransport({
|
|
61
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
62
|
+
* httpVersion: "2",
|
|
63
|
+
* }),
|
|
64
|
+
* });
|
|
65
|
+
* ```
|
|
66
|
+
*/
|
|
67
|
+
readonly customTransport?: Transport;
|
|
35
68
|
}
|
|
36
69
|
/**
|
|
37
70
|
* Validate a StigmerConfig and throw a descriptive error for invalid configurations.
|
package/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;AAEzE
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAErD;;;;GAIG;AACH,MAAM,MAAM,aAAa,GAAG,MAAM,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,GAAG,MAAM,GAAG,IAAI,CAAC;AAEzE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,aAAa;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,iFAAiF;IACjF,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,2EAA2E;IAC3E,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC;IAExC;;;;OAIG;IACH,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAC;IAExC;;;;;;;OAOG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,UAAU,GAAG,SAAS,CAAC;IAE5C;;;;;;;;;;;;;;;;;;;;;;;;;OAyBG;IACH,QAAQ,CAAC,eAAe,CAAC,EAAE,SAAS,CAAC;CACtC;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,aAAa,GAAG,IAAI,CAyB1D"}
|
package/config.js
CHANGED
|
@@ -5,6 +5,11 @@ export function validateConfig(config) {
|
|
|
5
5
|
if (!config.baseUrl) {
|
|
6
6
|
throw new Error("stigmer: baseUrl is required");
|
|
7
7
|
}
|
|
8
|
+
// When a custom transport is supplied, auth fields are optional — the
|
|
9
|
+
// caller is responsible for wiring auth interceptors on the transport.
|
|
10
|
+
if (config.customTransport) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
8
13
|
const hasApiKey = typeof config.apiKey === "string" && config.apiKey.length > 0;
|
|
9
14
|
const hasTokenProvider = typeof config.getAccessToken === "function";
|
|
10
15
|
if (!hasApiKey && !hasTokenProvider) {
|
package/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AA4EA;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,MAAqB;IAClD,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IAClD,CAAC;IAED,sEAAsE;IACtE,uEAAuE;IACvE,IAAI,MAAM,CAAC,eAAe,EAAE,CAAC;QAC3B,OAAO;IACT,CAAC;IAED,MAAM,SAAS,GAAG,OAAO,MAAM,CAAC,MAAM,KAAK,QAAQ,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC;IAChF,MAAM,gBAAgB,GAAG,OAAO,MAAM,CAAC,cAAc,KAAK,UAAU,CAAC;IAErE,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,EAAE,CAAC;QACpC,MAAM,IAAI,KAAK,CACb,2DAA2D,CAC5D,CAAC;IACJ,CAAC;IAED,IAAI,SAAS,IAAI,gBAAgB,EAAE,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,mFAAmF,CACpF,CAAC;IACJ,CAAC;AACH,CAAC"}
|
package/errors.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,O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;AA2DD;;;;;;;;;;;;GAYG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAOxE;AA6BD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAID;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,MAAM,EACb,QAAQ,EAAE,gBAAgB,GACzB,IAAI,CAEN;AAED;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,GAAG,SAAS,CAK3E"}
|
package/errors.js
CHANGED
|
@@ -83,6 +83,39 @@ const CATEGORY_FALLBACKS = {
|
|
|
83
83
|
cancelled: "The request was cancelled.",
|
|
84
84
|
unknown: "An unexpected error occurred.",
|
|
85
85
|
};
|
|
86
|
+
/**
|
|
87
|
+
* Maps enriched auth error descriptions from the backend into developer-friendly
|
|
88
|
+
* guidance. These patterns match the actionable descriptions returned by the
|
|
89
|
+
* gRPC interceptor chain (GrpcSecurityConfigBase + GrpcRequestContextBuilderInterceptor).
|
|
90
|
+
*/
|
|
91
|
+
const AUTH_ERROR_PATTERNS = [
|
|
92
|
+
[
|
|
93
|
+
/token audience does not match/i,
|
|
94
|
+
"The token's audience does not match the IdentityProvider's expected_audience. " +
|
|
95
|
+
"Verify your Auth0 API identifier matches the expected_audience configured in Stigmer.",
|
|
96
|
+
],
|
|
97
|
+
[
|
|
98
|
+
/token signature verification failed/i,
|
|
99
|
+
"Token signature verification failed. " +
|
|
100
|
+
"Check that the IdentityProvider's jwks_uri points to the correct JWKS endpoint.",
|
|
101
|
+
],
|
|
102
|
+
[
|
|
103
|
+
/token has expired/i,
|
|
104
|
+
"The access token has expired. Request a new token and retry.",
|
|
105
|
+
],
|
|
106
|
+
[
|
|
107
|
+
/federated identity account not found/i,
|
|
108
|
+
"No identity account exists for this user. " +
|
|
109
|
+
"The platform must create a federated account via createFederatedAccount " +
|
|
110
|
+
"before the user can authenticate.",
|
|
111
|
+
],
|
|
112
|
+
[
|
|
113
|
+
/account provisioning failed/i,
|
|
114
|
+
"SSO account provisioning failed. " +
|
|
115
|
+
"Ensure the IdentityProvider's userinfo_endpoint is configured and the " +
|
|
116
|
+
"access token includes the 'openid email profile' scopes.",
|
|
117
|
+
],
|
|
118
|
+
];
|
|
86
119
|
const INFRA_NOISE_PATTERNS = [
|
|
87
120
|
[/no healthy upstream/i, "The server is temporarily unavailable."],
|
|
88
121
|
[/ECONNREFUSED/i, "Unable to connect to the server."],
|
|
@@ -132,6 +165,10 @@ function extractRawMessage(error) {
|
|
|
132
165
|
function sanitizeMessage(message) {
|
|
133
166
|
if (!message)
|
|
134
167
|
return "";
|
|
168
|
+
for (const [pattern, replacement] of AUTH_ERROR_PATTERNS) {
|
|
169
|
+
if (pattern.test(message))
|
|
170
|
+
return replacement;
|
|
171
|
+
}
|
|
135
172
|
for (const [pattern, replacement] of INFRA_NOISE_PATTERNS) {
|
|
136
173
|
if (pattern.test(message))
|
|
137
174
|
return replacement;
|
package/errors.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAkB,MAAM,cAAc,CAAC;AAE5D,kCAAkC;AAClC,OAAO,EACL,YAAY,EAEZ,SAAS,EACT,UAAU,EACV,iBAAiB,EACjB,kBAAkB,EAClB,WAAW,GACZ,MAAM,cAAc,CAAC;AAyBtB,MAAM,wBAAwB,GAAkC;IAC9D,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,MAAM;IAC9B,CAAC,IAAI,CAAC,gBAAgB,CAAC,EAAE,YAAY;IACrC,CAAC,IAAI,CA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{ type IdentityProvider } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/api_pb";
|
|
4
4
|
import { type ListIdentityProvidersByOrgInput, type IdentityProviders, type OrganizationSsoLookup, type SsoProviderInfo } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/io_pb";
|
|
5
|
+
import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
5
6
|
/** Provides operations on identityprovider resources. */
|
|
6
7
|
export declare class IdentityProviderClient {
|
|
7
8
|
private readonly command;
|
|
@@ -30,5 +31,9 @@ export interface IdentityProviderInput {
|
|
|
30
31
|
userinfoEndpoint?: string;
|
|
31
32
|
isSsoProvider?: boolean;
|
|
32
33
|
oidcClientId?: string;
|
|
34
|
+
autoProvisionAccounts?: boolean;
|
|
35
|
+
autoGrantOnOrg?: boolean;
|
|
36
|
+
autoGrantRole?: IamRole;
|
|
37
|
+
tenantOrgClaim?: string;
|
|
33
38
|
}
|
|
34
39
|
//# sourceMappingURL=identityprovider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityprovider.d.ts","sourceRoot":"","sources":["../../src/gen/identityprovider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAErE,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhF,OAAO,EAA0B,KAAK,gBAAgB,EAAE,MAAM,2DAA2D,CAAC;AAE1H,OAAO,EAAsH,KAAK,+BAA+B,EAAE,KAAK,iBAAiB,EAAE,KAAK,qBAAqB,EAAE,KAAK,eAAe,EAAE,MAAM,0DAA0D,CAAC;
|
|
1
|
+
{"version":3,"file":"identityprovider.d.ts","sourceRoot":"","sources":["../../src/gen/identityprovider.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAErE,OAAO,EAA6B,KA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AAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB"}
|
package/gen/identityprovider.js
CHANGED
|
@@ -106,6 +106,10 @@ function buildIdentityProviderProto(input) {
|
|
|
106
106
|
userinfoEndpoint: input.userinfoEndpoint,
|
|
107
107
|
isSsoProvider: input.isSsoProvider,
|
|
108
108
|
oidcClientId: input.oidcClientId,
|
|
109
|
+
autoProvisionAccounts: input.autoProvisionAccounts,
|
|
110
|
+
autoGrantOnOrg: input.autoGrantOnOrg,
|
|
111
|
+
autoGrantRole: input.autoGrantRole,
|
|
112
|
+
tenantOrgClaim: input.tenantOrgClaim,
|
|
109
113
|
})),
|
|
110
114
|
});
|
|
111
115
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"identityprovider.js","sourceRoot":"","sources":["../../src/gen/identityprovider.ts"],"names":[],"mappings":"AAAA,kDAAkD;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,eAAe,EAAE,MAAM,qFAAqF,CAAC;AACtH,OAAO,EAAE,mBAAmB,EAAE,0BAA0B,EAAE,4BAA4B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M,CAAC,yBAAyB,CAAC,EAAE;YACzD,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,EAAE,KAAK,CAAC,GAAG;YACd,GAAG,CAAC,KAAK,CAAC,IAAI,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;YACvC,GAAG,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC;SAC9C,CAAC;QACF,IAAI,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,0BAA0B,CAAC,EAAE,cAAc,CAAC;YACrE,WAAW,EAAE,KAAK,CAAC,WAAW;YAC9B,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,eAAe,EAAE,KAAK,CAAC,eAAe;YACtC,gBAAgB,EAAE,KAAK,CAAC,gBAAgB;YACxC,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,YAAY,EAAE,KAAK,CAAC,YAAY;YAChC,qBAAqB,EAAE,KAAK,CAAC,qBAAqB;YAClD,cAAc,EAAE,KAAK,CAAC,cAAc;YACpC,aAAa,EAAE,KAAK,CAAC,aAAa;YAClC,cAAc,EAAE,KAAK,CAAC,cAAc;SACrC,CAAC,CAAC;KACJ,CAAqB,CAAC;AACzB,CAAC"}
|
package/node.d.ts
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { Transport } from "@connectrpc/connect";
|
|
2
|
+
import { Stigmer, type TokenProvider } from "./index";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for creating a Node.js-compatible Stigmer client.
|
|
5
|
+
*
|
|
6
|
+
* Uses `@connectrpc/connect-node` for native HTTP/2 transport instead
|
|
7
|
+
* of the browser-oriented `@connectrpc/connect-web` that the default
|
|
8
|
+
* `Stigmer` constructor uses.
|
|
9
|
+
*/
|
|
10
|
+
export interface NodeClientConfig {
|
|
11
|
+
/** Stigmer API server URL (e.g., "https://api.stigmer.ai"). */
|
|
12
|
+
readonly baseUrl: string;
|
|
13
|
+
/** Static API key for authentication. */
|
|
14
|
+
readonly apiKey?: string;
|
|
15
|
+
/** Dynamic token provider for authentication. */
|
|
16
|
+
readonly getAccessToken?: TokenProvider;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Create a gRPC-web transport for Node.js using native HTTP/2.
|
|
20
|
+
*
|
|
21
|
+
* The interceptor chain matches the browser transport for consistent
|
|
22
|
+
* behavior across runtimes:
|
|
23
|
+
* 1. Auth — attaches `Authorization: Bearer <token>`
|
|
24
|
+
* 2. RPC metadata — annotates errors with method name and service path
|
|
25
|
+
* 3. Error strip — removes gRPC status-code prefixes from messages
|
|
26
|
+
*
|
|
27
|
+
* The browser-specific auth-redirect interceptor (`onUnauthenticated`)
|
|
28
|
+
* is intentionally omitted — Node.js consumers handle auth failures
|
|
29
|
+
* through error handling, not UI redirects.
|
|
30
|
+
*/
|
|
31
|
+
export declare function createNodeTransport(config: NodeClientConfig): Transport;
|
|
32
|
+
/**
|
|
33
|
+
* Create a Stigmer client configured for Node.js environments.
|
|
34
|
+
*
|
|
35
|
+
* Uses `@connectrpc/connect-node` for native HTTP/2 transport with the
|
|
36
|
+
* full SDK interceptor chain (auth, RPC metadata, error stripping).
|
|
37
|
+
* Suitable for CLI tools, server-side scripts, and Ink terminal apps.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { createNodeClient } from "@stigmer/sdk/node";
|
|
42
|
+
*
|
|
43
|
+
* const stigmer = createNodeClient({
|
|
44
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
45
|
+
* apiKey: "sk_live_abc123",
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* const agent = await stigmer.agent.get("my-agent");
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export declare function createNodeClient(config: NodeClientConfig): Stigmer;
|
|
52
|
+
//# sourceMappingURL=node.d.ts.map
|
package/node.d.ts.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAe,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,SAAS,CAAC;AAOtD;;;;;;GAMG;AACH,MAAM,WAAW,gBAAgB;IAC/B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,yCAAyC;IACzC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEzB,iDAAiD;IACjD,QAAQ,CAAC,cAAc,CAAC,EAAE,aAAa,CAAC;CACzC;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,gBAAgB,GAAG,SAAS,CAgBvE;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,gBAAgB,GAAG,OAAO,CASlE"}
|
package/node.js
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { createGrpcWebTransport } from "@connectrpc/connect-node";
|
|
2
|
+
import { Stigmer } from "./index";
|
|
3
|
+
import { createAuthInterceptor, rpcMetadataInterceptor, errorStripInterceptor, } from "./internal/interceptors";
|
|
4
|
+
/**
|
|
5
|
+
* Create a gRPC-web transport for Node.js using native HTTP/2.
|
|
6
|
+
*
|
|
7
|
+
* The interceptor chain matches the browser transport for consistent
|
|
8
|
+
* behavior across runtimes:
|
|
9
|
+
* 1. Auth — attaches `Authorization: Bearer <token>`
|
|
10
|
+
* 2. RPC metadata — annotates errors with method name and service path
|
|
11
|
+
* 3. Error strip — removes gRPC status-code prefixes from messages
|
|
12
|
+
*
|
|
13
|
+
* The browser-specific auth-redirect interceptor (`onUnauthenticated`)
|
|
14
|
+
* is intentionally omitted — Node.js consumers handle auth failures
|
|
15
|
+
* through error handling, not UI redirects.
|
|
16
|
+
*/
|
|
17
|
+
export function createNodeTransport(config) {
|
|
18
|
+
const tokenProvider = config.apiKey
|
|
19
|
+
? () => config.apiKey
|
|
20
|
+
: config.getAccessToken ?? (() => null);
|
|
21
|
+
const interceptors = [
|
|
22
|
+
createAuthInterceptor(tokenProvider),
|
|
23
|
+
rpcMetadataInterceptor,
|
|
24
|
+
errorStripInterceptor,
|
|
25
|
+
];
|
|
26
|
+
return createGrpcWebTransport({
|
|
27
|
+
baseUrl: config.baseUrl,
|
|
28
|
+
httpVersion: "2",
|
|
29
|
+
interceptors,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Create a Stigmer client configured for Node.js environments.
|
|
34
|
+
*
|
|
35
|
+
* Uses `@connectrpc/connect-node` for native HTTP/2 transport with the
|
|
36
|
+
* full SDK interceptor chain (auth, RPC metadata, error stripping).
|
|
37
|
+
* Suitable for CLI tools, server-side scripts, and Ink terminal apps.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* ```typescript
|
|
41
|
+
* import { createNodeClient } from "@stigmer/sdk/node";
|
|
42
|
+
*
|
|
43
|
+
* const stigmer = createNodeClient({
|
|
44
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
45
|
+
* apiKey: "sk_live_abc123",
|
|
46
|
+
* });
|
|
47
|
+
*
|
|
48
|
+
* const agent = await stigmer.agent.get("my-agent");
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
export function createNodeClient(config) {
|
|
52
|
+
const transport = createNodeTransport(config);
|
|
53
|
+
return new Stigmer({
|
|
54
|
+
baseUrl: config.baseUrl,
|
|
55
|
+
apiKey: config.apiKey,
|
|
56
|
+
getAccessToken: config.getAccessToken,
|
|
57
|
+
customTransport: transport,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=node.js.map
|
package/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAElE,OAAO,EAAE,OAAO,EAAsB,MAAM,SAAS,CAAC;AACtD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,qBAAqB,GACtB,MAAM,yBAAyB,CAAC;AAoBjC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAwB;IAC1D,MAAM,aAAa,GAAkB,MAAM,CAAC,MAAM;QAChD,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,MAAO;QACtB,CAAC,CAAC,MAAM,CAAC,cAAc,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IAE1C,MAAM,YAAY,GAAkB;QAClC,qBAAqB,CAAC,aAAa,CAAC;QACpC,sBAAsB;QACtB,qBAAqB;KACtB,CAAC;IAEF,OAAO,sBAAsB,CAAC;QAC5B,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,WAAW,EAAE,GAAG;QAChB,YAAY;KACb,CAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,gBAAgB,CAAC,MAAwB;IACvD,MAAM,SAAS,GAAG,mBAAmB,CAAC,MAAM,CAAC,CAAC;IAE9C,OAAO,IAAI,OAAO,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,MAAM,EAAE,MAAM,CAAC,MAAM;QACrB,cAAc,EAAE,MAAM,CAAC,cAAc;QACrC,eAAe,EAAE,SAAS;KAC3B,CAAC,CAAC;AACL,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stigmer/sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.88",
|
|
4
4
|
"description": "Stigmer TypeScript SDK — typed API client for all Stigmer platform resources",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -27,6 +27,10 @@
|
|
|
27
27
|
".": {
|
|
28
28
|
"types": "./index.d.ts",
|
|
29
29
|
"import": "./index.js"
|
|
30
|
+
},
|
|
31
|
+
"./node": {
|
|
32
|
+
"types": "./node.d.ts",
|
|
33
|
+
"import": "./node.js"
|
|
30
34
|
}
|
|
31
35
|
},
|
|
32
36
|
"dependencies": {
|
|
@@ -35,6 +39,7 @@
|
|
|
35
39
|
},
|
|
36
40
|
"peerDependencies": {
|
|
37
41
|
"@bufbuild/protobuf": "^2.0.0",
|
|
38
|
-
"@
|
|
42
|
+
"@connectrpc/connect-node": "^2.0.0",
|
|
43
|
+
"@stigmer/protos": "0.0.88"
|
|
39
44
|
}
|
|
40
45
|
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { createNodeClient, createNodeTransport } from "../node";
|
|
3
|
+
|
|
4
|
+
describe("createNodeTransport", () => {
|
|
5
|
+
it("creates a transport with an API key", () => {
|
|
6
|
+
const transport = createNodeTransport({
|
|
7
|
+
baseUrl: "https://api.stigmer.ai",
|
|
8
|
+
apiKey: "sk_test_123",
|
|
9
|
+
});
|
|
10
|
+
expect(transport).toBeDefined();
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
it("creates a transport with a token provider", () => {
|
|
14
|
+
const transport = createNodeTransport({
|
|
15
|
+
baseUrl: "https://api.stigmer.ai",
|
|
16
|
+
getAccessToken: () => "token_abc",
|
|
17
|
+
});
|
|
18
|
+
expect(transport).toBeDefined();
|
|
19
|
+
});
|
|
20
|
+
|
|
21
|
+
it("creates a transport without auth", () => {
|
|
22
|
+
const transport = createNodeTransport({
|
|
23
|
+
baseUrl: "https://api.stigmer.ai",
|
|
24
|
+
});
|
|
25
|
+
expect(transport).toBeDefined();
|
|
26
|
+
});
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
describe("createNodeClient", () => {
|
|
30
|
+
it("creates a Stigmer client with API key", () => {
|
|
31
|
+
const client = createNodeClient({
|
|
32
|
+
baseUrl: "https://api.stigmer.ai",
|
|
33
|
+
apiKey: "sk_test_123",
|
|
34
|
+
});
|
|
35
|
+
expect(client).toBeDefined();
|
|
36
|
+
expect(client.baseUrl).toBe("https://api.stigmer.ai");
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it("creates a Stigmer client with token provider", () => {
|
|
40
|
+
const client = createNodeClient({
|
|
41
|
+
baseUrl: "https://api.stigmer.ai",
|
|
42
|
+
getAccessToken: () => "token_abc",
|
|
43
|
+
});
|
|
44
|
+
expect(client).toBeDefined();
|
|
45
|
+
expect(client.baseUrl).toBe("https://api.stigmer.ai");
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
it("exposes resource sub-clients", () => {
|
|
49
|
+
const client = createNodeClient({
|
|
50
|
+
baseUrl: "https://api.stigmer.ai",
|
|
51
|
+
apiKey: "sk_test_123",
|
|
52
|
+
});
|
|
53
|
+
expect(client.agent).toBeDefined();
|
|
54
|
+
expect(client.session).toBeDefined();
|
|
55
|
+
expect(client.agentExecution).toBeDefined();
|
|
56
|
+
});
|
|
57
|
+
});
|
package/src/config.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { Transport } from "@connectrpc/connect";
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* Token provider callback for dynamic authentication.
|
|
3
5
|
* Called per-request, allowing token refresh and auth state changes.
|
|
@@ -8,9 +10,13 @@ export type TokenProvider = () => Promise<string | null> | string | null;
|
|
|
8
10
|
/**
|
|
9
11
|
* Configuration for the Stigmer SDK client.
|
|
10
12
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
13
|
+
* Authentication: exactly one of `apiKey` or `getAccessToken` must be
|
|
14
|
+
* provided (unless `customTransport` handles auth independently).
|
|
15
|
+
*
|
|
16
|
+
* Transport: by default the SDK creates a browser-oriented transport
|
|
17
|
+
* using `@connectrpc/connect-web`. Pass `customTransport` to use a
|
|
18
|
+
* pre-built transport — for example, `@connectrpc/connect-node` for
|
|
19
|
+
* server-side or CLI usage.
|
|
14
20
|
*/
|
|
15
21
|
export interface StigmerConfig {
|
|
16
22
|
/** Base URL of the Stigmer API server (e.g., "https://api.stigmer.ai"). */
|
|
@@ -34,9 +40,38 @@ export interface StigmerConfig {
|
|
|
34
40
|
* - `"grpc-web"` (default): gRPC-Web binary protocol. Compact, battle-tested.
|
|
35
41
|
* - `"connect"`: Connect protocol over HTTP/JSON. Easier to debug with standard HTTP tooling.
|
|
36
42
|
*
|
|
37
|
-
* Both protocols are supported by the Stigmer server.
|
|
43
|
+
* Both protocols are supported by the Stigmer server. Ignored when
|
|
44
|
+
* `customTransport` is provided.
|
|
38
45
|
*/
|
|
39
46
|
readonly transport?: "grpc-web" | "connect";
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Pre-built ConnectRPC transport.
|
|
50
|
+
*
|
|
51
|
+
* When provided, the SDK uses this transport directly instead of
|
|
52
|
+
* creating one from `baseUrl`, `transport`, and the auth fields.
|
|
53
|
+
* This enables non-browser environments (Node.js CLIs, edge runtimes)
|
|
54
|
+
* to supply a transport with native HTTP/2 support via
|
|
55
|
+
* `@connectrpc/connect-node` or any other ConnectRPC transport.
|
|
56
|
+
*
|
|
57
|
+
* The caller is responsible for configuring auth interceptors on the
|
|
58
|
+
* custom transport; the SDK's built-in auth interceptor is bypassed.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* import { createConnectTransport } from "@connectrpc/connect-node";
|
|
63
|
+
* import { Stigmer } from "@stigmer/sdk";
|
|
64
|
+
*
|
|
65
|
+
* const stigmer = new Stigmer({
|
|
66
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
67
|
+
* customTransport: createConnectTransport({
|
|
68
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
69
|
+
* httpVersion: "2",
|
|
70
|
+
* }),
|
|
71
|
+
* });
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
readonly customTransport?: Transport;
|
|
40
75
|
}
|
|
41
76
|
|
|
42
77
|
/**
|
|
@@ -47,6 +82,12 @@ export function validateConfig(config: StigmerConfig): void {
|
|
|
47
82
|
throw new Error("stigmer: baseUrl is required");
|
|
48
83
|
}
|
|
49
84
|
|
|
85
|
+
// When a custom transport is supplied, auth fields are optional — the
|
|
86
|
+
// caller is responsible for wiring auth interceptors on the transport.
|
|
87
|
+
if (config.customTransport) {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
|
|
50
91
|
const hasApiKey = typeof config.apiKey === "string" && config.apiKey.length > 0;
|
|
51
92
|
const hasTokenProvider = typeof config.getAccessToken === "function";
|
|
52
93
|
|
package/src/errors.ts
CHANGED
|
@@ -124,6 +124,40 @@ const CATEGORY_FALLBACKS: Record<ErrorCategory, string> = {
|
|
|
124
124
|
unknown: "An unexpected error occurred.",
|
|
125
125
|
};
|
|
126
126
|
|
|
127
|
+
/**
|
|
128
|
+
* Maps enriched auth error descriptions from the backend into developer-friendly
|
|
129
|
+
* guidance. These patterns match the actionable descriptions returned by the
|
|
130
|
+
* gRPC interceptor chain (GrpcSecurityConfigBase + GrpcRequestContextBuilderInterceptor).
|
|
131
|
+
*/
|
|
132
|
+
const AUTH_ERROR_PATTERNS: ReadonlyArray<readonly [RegExp, string]> = [
|
|
133
|
+
[
|
|
134
|
+
/token audience does not match/i,
|
|
135
|
+
"The token's audience does not match the IdentityProvider's expected_audience. " +
|
|
136
|
+
"Verify your Auth0 API identifier matches the expected_audience configured in Stigmer.",
|
|
137
|
+
],
|
|
138
|
+
[
|
|
139
|
+
/token signature verification failed/i,
|
|
140
|
+
"Token signature verification failed. " +
|
|
141
|
+
"Check that the IdentityProvider's jwks_uri points to the correct JWKS endpoint.",
|
|
142
|
+
],
|
|
143
|
+
[
|
|
144
|
+
/token has expired/i,
|
|
145
|
+
"The access token has expired. Request a new token and retry.",
|
|
146
|
+
],
|
|
147
|
+
[
|
|
148
|
+
/federated identity account not found/i,
|
|
149
|
+
"No identity account exists for this user. " +
|
|
150
|
+
"The platform must create a federated account via createFederatedAccount " +
|
|
151
|
+
"before the user can authenticate.",
|
|
152
|
+
],
|
|
153
|
+
[
|
|
154
|
+
/account provisioning failed/i,
|
|
155
|
+
"SSO account provisioning failed. " +
|
|
156
|
+
"Ensure the IdentityProvider's userinfo_endpoint is configured and the " +
|
|
157
|
+
"access token includes the 'openid email profile' scopes.",
|
|
158
|
+
],
|
|
159
|
+
];
|
|
160
|
+
|
|
127
161
|
const INFRA_NOISE_PATTERNS: ReadonlyArray<readonly [RegExp, string]> = [
|
|
128
162
|
[/no healthy upstream/i, "The server is temporarily unavailable."],
|
|
129
163
|
[/ECONNREFUSED/i, "Unable to connect to the server."],
|
|
@@ -175,6 +209,9 @@ function extractRawMessage(error: unknown): string {
|
|
|
175
209
|
|
|
176
210
|
function sanitizeMessage(message: string): string {
|
|
177
211
|
if (!message) return "";
|
|
212
|
+
for (const [pattern, replacement] of AUTH_ERROR_PATTERNS) {
|
|
213
|
+
if (pattern.test(message)) return replacement;
|
|
214
|
+
}
|
|
178
215
|
for (const [pattern, replacement] of INFRA_NOISE_PATTERNS) {
|
|
179
216
|
if (pattern.test(message)) return replacement;
|
|
180
217
|
}
|
|
@@ -13,6 +13,7 @@ import { IdentityProviderCommandController } from "@stigmer/protos/ai/stigmer/ia
|
|
|
13
13
|
import { ListIdentityProvidersByOrgInputSchema, IdentityProvidersSchema, OrganizationSsoLookupSchema, SsoProviderInfoSchema, type ListIdentityProvidersByOrgInput, type IdentityProviders, type OrganizationSsoLookup, type SsoProviderInfo } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/io_pb";
|
|
14
14
|
import { IdentityProviderQueryController } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/query_pb";
|
|
15
15
|
import { IdentityProviderSpecSchema } from "@stigmer/protos/ai/stigmer/iam/identityprovider/v1/spec_pb";
|
|
16
|
+
import { IamRole } from "@stigmer/protos/ai/stigmer/iam/v1/enum_pb";
|
|
16
17
|
|
|
17
18
|
/** Provides operations on identityprovider resources. */
|
|
18
19
|
export class IdentityProviderClient {
|
|
@@ -91,6 +92,10 @@ export interface IdentityProviderInput {
|
|
|
91
92
|
userinfoEndpoint?: string;
|
|
92
93
|
isSsoProvider?: boolean;
|
|
93
94
|
oidcClientId?: string;
|
|
95
|
+
autoProvisionAccounts?: boolean;
|
|
96
|
+
autoGrantOnOrg?: boolean;
|
|
97
|
+
autoGrantRole?: IamRole;
|
|
98
|
+
tenantOrgClaim?: string;
|
|
94
99
|
}
|
|
95
100
|
|
|
96
101
|
function buildIdentityProviderProto(input: IdentityProviderInput): IdentityProvider {
|
|
@@ -112,6 +117,10 @@ function buildIdentityProviderProto(input: IdentityProviderInput): IdentityProvi
|
|
|
112
117
|
userinfoEndpoint: input.userinfoEndpoint,
|
|
113
118
|
isSsoProvider: input.isSsoProvider,
|
|
114
119
|
oidcClientId: input.oidcClientId,
|
|
120
|
+
autoProvisionAccounts: input.autoProvisionAccounts,
|
|
121
|
+
autoGrantOnOrg: input.autoGrantOnOrg,
|
|
122
|
+
autoGrantRole: input.autoGrantRole,
|
|
123
|
+
tenantOrgClaim: input.tenantOrgClaim,
|
|
115
124
|
})),
|
|
116
125
|
}) as IdentityProvider;
|
|
117
126
|
}
|
package/src/node.ts
ADDED
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { createGrpcWebTransport } from "@connectrpc/connect-node";
|
|
2
|
+
import type { Transport, Interceptor } from "@connectrpc/connect";
|
|
3
|
+
import { Stigmer, type TokenProvider } from "./index";
|
|
4
|
+
import {
|
|
5
|
+
createAuthInterceptor,
|
|
6
|
+
rpcMetadataInterceptor,
|
|
7
|
+
errorStripInterceptor,
|
|
8
|
+
} from "./internal/interceptors";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Configuration for creating a Node.js-compatible Stigmer client.
|
|
12
|
+
*
|
|
13
|
+
* Uses `@connectrpc/connect-node` for native HTTP/2 transport instead
|
|
14
|
+
* of the browser-oriented `@connectrpc/connect-web` that the default
|
|
15
|
+
* `Stigmer` constructor uses.
|
|
16
|
+
*/
|
|
17
|
+
export interface NodeClientConfig {
|
|
18
|
+
/** Stigmer API server URL (e.g., "https://api.stigmer.ai"). */
|
|
19
|
+
readonly baseUrl: string;
|
|
20
|
+
|
|
21
|
+
/** Static API key for authentication. */
|
|
22
|
+
readonly apiKey?: string;
|
|
23
|
+
|
|
24
|
+
/** Dynamic token provider for authentication. */
|
|
25
|
+
readonly getAccessToken?: TokenProvider;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Create a gRPC-web transport for Node.js using native HTTP/2.
|
|
30
|
+
*
|
|
31
|
+
* The interceptor chain matches the browser transport for consistent
|
|
32
|
+
* behavior across runtimes:
|
|
33
|
+
* 1. Auth — attaches `Authorization: Bearer <token>`
|
|
34
|
+
* 2. RPC metadata — annotates errors with method name and service path
|
|
35
|
+
* 3. Error strip — removes gRPC status-code prefixes from messages
|
|
36
|
+
*
|
|
37
|
+
* The browser-specific auth-redirect interceptor (`onUnauthenticated`)
|
|
38
|
+
* is intentionally omitted — Node.js consumers handle auth failures
|
|
39
|
+
* through error handling, not UI redirects.
|
|
40
|
+
*/
|
|
41
|
+
export function createNodeTransport(config: NodeClientConfig): Transport {
|
|
42
|
+
const tokenProvider: TokenProvider = config.apiKey
|
|
43
|
+
? () => config.apiKey!
|
|
44
|
+
: config.getAccessToken ?? (() => null);
|
|
45
|
+
|
|
46
|
+
const interceptors: Interceptor[] = [
|
|
47
|
+
createAuthInterceptor(tokenProvider),
|
|
48
|
+
rpcMetadataInterceptor,
|
|
49
|
+
errorStripInterceptor,
|
|
50
|
+
];
|
|
51
|
+
|
|
52
|
+
return createGrpcWebTransport({
|
|
53
|
+
baseUrl: config.baseUrl,
|
|
54
|
+
httpVersion: "2",
|
|
55
|
+
interceptors,
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Create a Stigmer client configured for Node.js environments.
|
|
61
|
+
*
|
|
62
|
+
* Uses `@connectrpc/connect-node` for native HTTP/2 transport with the
|
|
63
|
+
* full SDK interceptor chain (auth, RPC metadata, error stripping).
|
|
64
|
+
* Suitable for CLI tools, server-side scripts, and Ink terminal apps.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* import { createNodeClient } from "@stigmer/sdk/node";
|
|
69
|
+
*
|
|
70
|
+
* const stigmer = createNodeClient({
|
|
71
|
+
* baseUrl: "https://api.stigmer.ai",
|
|
72
|
+
* apiKey: "sk_live_abc123",
|
|
73
|
+
* });
|
|
74
|
+
*
|
|
75
|
+
* const agent = await stigmer.agent.get("my-agent");
|
|
76
|
+
* ```
|
|
77
|
+
*/
|
|
78
|
+
export function createNodeClient(config: NodeClientConfig): Stigmer {
|
|
79
|
+
const transport = createNodeTransport(config);
|
|
80
|
+
|
|
81
|
+
return new Stigmer({
|
|
82
|
+
baseUrl: config.baseUrl,
|
|
83
|
+
apiKey: config.apiKey,
|
|
84
|
+
getAccessToken: config.getAccessToken,
|
|
85
|
+
customTransport: transport,
|
|
86
|
+
});
|
|
87
|
+
}
|
package/src/stigmer.ts
CHANGED
|
@@ -49,13 +49,13 @@ export class Stigmer extends GeneratedClient {
|
|
|
49
49
|
constructor(config: StigmerConfig) {
|
|
50
50
|
validateConfig(config);
|
|
51
51
|
|
|
52
|
-
const transport = createStigmerTransport(config);
|
|
52
|
+
const transport = config.customTransport ?? createStigmerTransport(config);
|
|
53
53
|
super(transport);
|
|
54
54
|
|
|
55
55
|
this.baseUrl = config.baseUrl;
|
|
56
56
|
this._tokenProvider = config.apiKey
|
|
57
57
|
? () => config.apiKey!
|
|
58
|
-
: config.getAccessToken
|
|
58
|
+
: config.getAccessToken ?? (() => null);
|
|
59
59
|
|
|
60
60
|
this.search = new SearchClient(transport);
|
|
61
61
|
this.github = new GitHubClient(transport);
|
package/stigmer.js
CHANGED
|
@@ -40,12 +40,12 @@ export class Stigmer extends GeneratedClient {
|
|
|
40
40
|
_tokenProvider;
|
|
41
41
|
constructor(config) {
|
|
42
42
|
validateConfig(config);
|
|
43
|
-
const transport = createStigmerTransport(config);
|
|
43
|
+
const transport = config.customTransport ?? createStigmerTransport(config);
|
|
44
44
|
super(transport);
|
|
45
45
|
this.baseUrl = config.baseUrl;
|
|
46
46
|
this._tokenProvider = config.apiKey
|
|
47
47
|
? () => config.apiKey
|
|
48
|
-
: config.getAccessToken;
|
|
48
|
+
: config.getAccessToken ?? (() => null);
|
|
49
49
|
this.search = new SearchClient(transport);
|
|
50
50
|
this.github = new GitHubClient(transport);
|
|
51
51
|
}
|
package/stigmer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"stigmer.js","sourceRoot":"","sources":["../src/stigmer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,EACL,cAAc,GAGf,MAAM,UAAU,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,OAAQ,SAAQ,eAAe;IAC1C;;;;;;OAMG;IACM,OAAO,CAAS;IAEhB,MAAM,CAAe;IACrB,MAAM,CAAe;IAEb,cAAc,CAAgB;IAE/C,YAAY,MAAqB;QAC/B,cAAc,CAAC,MAAM,CAAC,CAAC;QAEvB,MAAM,SAAS,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"stigmer.js","sourceRoot":"","sources":["../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