@stigmer/sdk 3.35.0 → 3.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/activity.d.ts.map +1 -1
- package/activity.js.map +1 -1
- package/artifact-routing.d.ts.map +1 -1
- package/artifact-routing.js.map +1 -1
- package/authorization-config.d.ts.map +1 -1
- package/authorization-config.js.map +1 -1
- package/billing.d.ts.map +1 -1
- package/billing.js.map +1 -1
- package/config.d.ts.map +1 -1
- package/config.js.map +1 -1
- package/cursor-accounts.d.ts.map +1 -1
- package/cursor-accounts.js.map +1 -1
- package/ensure-identity-account.d.ts.map +1 -1
- package/ensure-identity-account.js.map +1 -1
- package/errors.d.ts.map +1 -1
- package/errors.js.map +1 -1
- package/execution/approval-provenance.d.ts.map +1 -1
- package/execution/approval-provenance.js.map +1 -1
- package/execution/conversation-rules.d.ts.map +1 -1
- package/execution/conversation-rules.js.map +1 -1
- package/execution/execution-phases.d.ts.map +1 -1
- package/execution/execution-phases.js.map +1 -1
- package/execution/file-review-fold.d.ts.map +1 -1
- package/execution/file-review-fold.js.map +1 -1
- package/execution/to-display-file-change.d.ts.map +1 -1
- package/execution/to-display-file-change.js.map +1 -1
- package/execution/tool-view.d.ts.map +1 -1
- package/execution/tool-view.js.map +1 -1
- package/execution/transcript.d.ts.map +1 -1
- package/execution/transcript.js.map +1 -1
- package/gen/agent.d.ts.map +1 -1
- package/gen/agent.js.map +1 -1
- package/gen/agentchannel.d.ts.map +1 -1
- package/gen/agentchannel.js.map +1 -1
- package/gen/agentexecution.d.ts.map +1 -1
- package/gen/agentexecution.js.map +1 -1
- package/gen/agentinstance.d.ts.map +1 -1
- package/gen/agentinstance.js.map +1 -1
- package/gen/agentshare.d.ts.map +1 -1
- package/gen/agentshare.js.map +1 -1
- package/gen/apikey.d.ts.map +1 -1
- package/gen/apikey.js.map +1 -1
- package/gen/artifact.d.ts.map +1 -1
- package/gen/artifact.js.map +1 -1
- package/gen/authorization-config.d.ts.map +1 -1
- package/gen/authorization-config.js +2 -2
- package/gen/authorization-config.js.map +1 -1
- package/gen/bidi-stream.d.ts.map +1 -1
- package/gen/bidi-stream.js.map +1 -1
- package/gen/channelapp.d.ts.map +1 -1
- package/gen/channelapp.js.map +1 -1
- package/gen/client.d.ts.map +1 -1
- package/gen/client.js.map +1 -1
- package/gen/environment.d.ts.map +1 -1
- package/gen/environment.js.map +1 -1
- package/gen/errors.d.ts.map +1 -1
- package/gen/errors.js.map +1 -1
- package/gen/executioncontext.d.ts.map +1 -1
- package/gen/executioncontext.js.map +1 -1
- package/gen/iampolicy.d.ts.map +1 -1
- package/gen/iampolicy.js.map +1 -1
- package/gen/identityaccount.d.ts.map +1 -1
- package/gen/identityaccount.js.map +1 -1
- package/gen/identityprovider.d.ts.map +1 -1
- package/gen/identityprovider.js.map +1 -1
- package/gen/invitation.d.ts.map +1 -1
- package/gen/invitation.js.map +1 -1
- package/gen/license.d.ts.map +1 -1
- package/gen/license.js.map +1 -1
- package/gen/mcpserver.d.ts.map +1 -1
- package/gen/mcpserver.js.map +1 -1
- package/gen/memory.d.ts.map +1 -1
- package/gen/memory.js.map +1 -1
- package/gen/oauthapp.d.ts.map +1 -1
- package/gen/oauthapp.js.map +1 -1
- package/gen/organization.d.ts.map +1 -1
- package/gen/organization.js.map +1 -1
- package/gen/plan.d.ts.map +1 -1
- package/gen/plan.js.map +1 -1
- package/gen/platformclient.d.ts.map +1 -1
- package/gen/platformclient.js.map +1 -1
- package/gen/plugin.d.ts.map +1 -1
- package/gen/plugin.js.map +1 -1
- package/gen/proto-utils.d.ts.map +1 -1
- package/gen/proto-utils.js.map +1 -1
- package/gen/resource-availability.d.ts.map +1 -1
- package/gen/resource-availability.js.map +1 -1
- package/gen/schedule.d.ts.map +1 -1
- package/gen/schedule.js.map +1 -1
- package/gen/session.d.ts.map +1 -1
- package/gen/session.js.map +1 -1
- package/gen/skill.d.ts.map +1 -1
- package/gen/skill.js.map +1 -1
- package/gen/subscription.d.ts.map +1 -1
- package/gen/subscription.js.map +1 -1
- package/gen/team.d.ts.map +1 -1
- package/gen/team.js.map +1 -1
- package/gen/types.d.ts.map +1 -1
- package/gen/types.js.map +1 -1
- package/gen/workflow.d.ts.map +1 -1
- package/gen/workflow.js.map +1 -1
- package/gen/workflowexecution.d.ts.map +1 -1
- package/gen/workflowexecution.js.map +1 -1
- package/gen/workflowinstance.d.ts.map +1 -1
- package/gen/workflowinstance.js.map +1 -1
- package/github.d.ts.map +1 -1
- package/github.js.map +1 -1
- package/guest-auth.d.ts.map +1 -1
- package/guest-auth.js.map +1 -1
- package/iam-principal.d.ts.map +1 -1
- package/iam-principal.js.map +1 -1
- package/iam-role.d.ts.map +1 -1
- package/iam-role.js.map +1 -1
- package/index.d.ts.map +1 -1
- package/index.js.map +1 -1
- package/internal/interceptors.d.ts.map +1 -1
- package/internal/interceptors.js.map +1 -1
- package/manifest/client.d.ts.map +1 -1
- package/manifest/client.js.map +1 -1
- package/manifest/document.d.ts.map +1 -1
- package/manifest/document.js.map +1 -1
- package/manifest/index.d.ts.map +1 -1
- package/manifest/index.js.map +1 -1
- package/manifest/parse.d.ts.map +1 -1
- package/manifest/parse.js.map +1 -1
- package/manifest/redaction.d.ts.map +1 -1
- package/manifest/redaction.js.map +1 -1
- package/manifest/registry.d.ts.map +1 -1
- package/manifest/registry.js.map +1 -1
- package/manifest/serialize.d.ts.map +1 -1
- package/manifest/serialize.js.map +1 -1
- package/mcpserver-connect.d.ts.map +1 -1
- package/mcpserver-connect.js.map +1 -1
- package/node.d.ts.map +1 -1
- package/node.js.map +1 -1
- package/package.json +2 -2
- package/platform-client-auth.d.ts.map +1 -1
- package/platform-client-auth.js.map +1 -1
- package/platform.d.ts.map +1 -1
- package/platform.js.map +1 -1
- package/plugin.d.ts.map +1 -1
- package/plugin.js.map +1 -1
- package/provider-standing.d.ts.map +1 -1
- package/provider-standing.js.map +1 -1
- package/resource-availability.d.ts.map +1 -1
- package/resource-availability.js.map +1 -1
- package/runner-adapter.d.ts.map +1 -1
- package/runner-adapter.js.map +1 -1
- package/search.d.ts.map +1 -1
- package/search.js.map +1 -1
- package/session.d.ts.map +1 -1
- package/session.js.map +1 -1
- package/sharing.d.ts.map +1 -1
- package/sharing.js.map +1 -1
- package/skill.d.ts.map +1 -1
- package/skill.js.map +1 -1
- package/src/gen/authorization-config.ts +2 -2
- package/stigmer.d.ts.map +1 -1
- package/stigmer.js.map +1 -1
- package/transport.d.ts.map +1 -1
- package/transport.js.map +1 -1
- package/__tests__/billing.test.d.ts +0 -2
- package/__tests__/billing.test.d.ts.map +0 -1
- package/__tests__/billing.test.js +0 -120
- package/__tests__/billing.test.js.map +0 -1
- package/__tests__/config.test.d.ts +0 -2
- package/__tests__/config.test.d.ts.map +0 -1
- package/__tests__/config.test.js +0 -35
- package/__tests__/config.test.js.map +0 -1
- package/__tests__/ensure-identity-account.test.d.ts +0 -2
- package/__tests__/ensure-identity-account.test.d.ts.map +0 -1
- package/__tests__/ensure-identity-account.test.js +0 -108
- package/__tests__/ensure-identity-account.test.js.map +0 -1
- package/__tests__/errors.test.d.ts +0 -2
- package/__tests__/errors.test.d.ts.map +0 -1
- package/__tests__/errors.test.js +0 -228
- package/__tests__/errors.test.js.map +0 -1
- package/__tests__/gen/errors.test.d.ts +0 -2
- package/__tests__/gen/errors.test.d.ts.map +0 -1
- package/__tests__/gen/errors.test.js +0 -97
- package/__tests__/gen/errors.test.js.map +0 -1
- package/__tests__/gen/invitation-client.test.d.ts +0 -2
- package/__tests__/gen/invitation-client.test.d.ts.map +0 -1
- package/__tests__/gen/invitation-client.test.js +0 -106
- package/__tests__/gen/invitation-client.test.js.map +0 -1
- package/__tests__/gen/proto-utils.test.d.ts +0 -2
- package/__tests__/gen/proto-utils.test.d.ts.map +0 -1
- package/__tests__/gen/proto-utils.test.js +0 -85
- package/__tests__/gen/proto-utils.test.js.map +0 -1
- package/__tests__/gen/session-client.test.d.ts +0 -2
- package/__tests__/gen/session-client.test.d.ts.map +0 -1
- package/__tests__/gen/session-client.test.js +0 -152
- package/__tests__/gen/session-client.test.js.map +0 -1
- package/__tests__/guest-auth.test.d.ts +0 -2
- package/__tests__/guest-auth.test.d.ts.map +0 -1
- package/__tests__/guest-auth.test.js +0 -223
- package/__tests__/guest-auth.test.js.map +0 -1
- package/__tests__/iam-principal.test.d.ts +0 -2
- package/__tests__/iam-principal.test.d.ts.map +0 -1
- package/__tests__/iam-principal.test.js +0 -65
- package/__tests__/iam-principal.test.js.map +0 -1
- package/__tests__/manifest.test.d.ts +0 -2
- package/__tests__/manifest.test.d.ts.map +0 -1
- package/__tests__/manifest.test.js +0 -306
- package/__tests__/manifest.test.js.map +0 -1
- package/__tests__/mcpserver-connect.test.d.ts +0 -2
- package/__tests__/mcpserver-connect.test.d.ts.map +0 -1
- package/__tests__/mcpserver-connect.test.js +0 -146
- package/__tests__/mcpserver-connect.test.js.map +0 -1
- package/__tests__/node.test.d.ts +0 -2
- package/__tests__/node.test.d.ts.map +0 -1
- package/__tests__/node.test.js +0 -67
- package/__tests__/node.test.js.map +0 -1
- package/__tests__/platform-client-auth.test.d.ts +0 -2
- package/__tests__/platform-client-auth.test.d.ts.map +0 -1
- package/__tests__/platform-client-auth.test.js +0 -59
- package/__tests__/platform-client-auth.test.js.map +0 -1
- package/__tests__/platform.test.d.ts +0 -2
- package/__tests__/platform.test.d.ts.map +0 -1
- package/__tests__/platform.test.js +0 -52
- package/__tests__/platform.test.js.map +0 -1
- package/__tests__/plugin.test.d.ts +0 -2
- package/__tests__/plugin.test.d.ts.map +0 -1
- package/__tests__/plugin.test.js +0 -74
- package/__tests__/plugin.test.js.map +0 -1
- package/__tests__/resource-availability.test.d.ts +0 -2
- package/__tests__/resource-availability.test.d.ts.map +0 -1
- package/__tests__/resource-availability.test.js +0 -80
- package/__tests__/resource-availability.test.js.map +0 -1
- package/__tests__/runner-adapter.test.d.ts +0 -2
- package/__tests__/runner-adapter.test.d.ts.map +0 -1
- package/__tests__/runner-adapter.test.js +0 -88
- package/__tests__/runner-adapter.test.js.map +0 -1
- package/__tests__/session.test.d.ts +0 -6
- package/__tests__/session.test.d.ts.map +0 -1
- package/__tests__/session.test.js +0 -50
- package/__tests__/session.test.js.map +0 -1
- package/__tests__/sharing.test.d.ts +0 -2
- package/__tests__/sharing.test.d.ts.map +0 -1
- package/__tests__/sharing.test.js +0 -106
- package/__tests__/sharing.test.js.map +0 -1
- package/__tests__/skill.test.d.ts +0 -2
- package/__tests__/skill.test.d.ts.map +0 -1
- package/__tests__/skill.test.js +0 -117
- package/__tests__/skill.test.js.map +0 -1
- package/__tests__/stigmer.test.d.ts +0 -2
- package/__tests__/stigmer.test.d.ts.map +0 -1
- package/__tests__/stigmer.test.js +0 -127
- package/__tests__/stigmer.test.js.map +0 -1
- package/__tests__/update-input-roundtrip.test.d.ts +0 -2
- package/__tests__/update-input-roundtrip.test.d.ts.map +0 -1
- package/__tests__/update-input-roundtrip.test.js +0 -775
- package/__tests__/update-input-roundtrip.test.js.map +0 -1
- package/__tests__/update-input.test.d.ts +0 -2
- package/__tests__/update-input.test.d.ts.map +0 -1
- package/__tests__/update-input.test.js +0 -188
- package/__tests__/update-input.test.js.map +0 -1
- package/execution/__tests__/approval-provenance.test.d.ts +0 -2
- package/execution/__tests__/approval-provenance.test.d.ts.map +0 -1
- package/execution/__tests__/approval-provenance.test.js +0 -42
- package/execution/__tests__/approval-provenance.test.js.map +0 -1
- package/execution/__tests__/file-review-fold.corpus.test.d.ts +0 -2
- package/execution/__tests__/file-review-fold.corpus.test.d.ts.map +0 -1
- package/execution/__tests__/file-review-fold.corpus.test.js +0 -82
- package/execution/__tests__/file-review-fold.corpus.test.js.map +0 -1
- package/execution/__tests__/file-review-fold.test.d.ts +0 -2
- package/execution/__tests__/file-review-fold.test.d.ts.map +0 -1
- package/execution/__tests__/file-review-fold.test.js +0 -184
- package/execution/__tests__/file-review-fold.test.js.map +0 -1
- package/execution/__tests__/to-display-file-change.test.d.ts +0 -2
- package/execution/__tests__/to-display-file-change.test.d.ts.map +0 -1
- package/execution/__tests__/to-display-file-change.test.js +0 -81
- package/execution/__tests__/to-display-file-change.test.js.map +0 -1
- package/execution/__tests__/tool-view.file-changes.test.d.ts +0 -2
- package/execution/__tests__/tool-view.file-changes.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.file-changes.test.js +0 -86
- package/execution/__tests__/tool-view.file-changes.test.js.map +0 -1
- package/execution/__tests__/tool-view.fixtures.test.d.ts +0 -2
- package/execution/__tests__/tool-view.fixtures.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.fixtures.test.js +0 -152
- package/execution/__tests__/tool-view.fixtures.test.js.map +0 -1
- package/execution/__tests__/tool-view.output-ref.test.d.ts +0 -2
- package/execution/__tests__/tool-view.output-ref.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.output-ref.test.js +0 -64
- package/execution/__tests__/tool-view.output-ref.test.js.map +0 -1
- package/execution/__tests__/tool-view.read.test.d.ts +0 -2
- package/execution/__tests__/tool-view.read.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.read.test.js +0 -56
- package/execution/__tests__/tool-view.read.test.js.map +0 -1
- package/execution/__tests__/tool-view.search.test.d.ts +0 -2
- package/execution/__tests__/tool-view.search.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.search.test.js +0 -200
- package/execution/__tests__/tool-view.search.test.js.map +0 -1
- package/execution/__tests__/tool-view.shell.test.d.ts +0 -2
- package/execution/__tests__/tool-view.shell.test.d.ts.map +0 -1
- package/execution/__tests__/tool-view.shell.test.js +0 -104
- package/execution/__tests__/tool-view.shell.test.js.map +0 -1
- package/execution/__tests__/transcript.test.d.ts +0 -2
- package/execution/__tests__/transcript.test.d.ts.map +0 -1
- package/execution/__tests__/transcript.test.js +0 -591
- package/execution/__tests__/transcript.test.js.map +0 -1
- package/node.test.d.ts +0 -2
- package/node.test.d.ts.map +0 -1
- package/node.test.js +0 -35
- package/node.test.js.map +0 -1
- package/src/__tests__/billing.test.ts +0 -146
- package/src/__tests__/config.test.ts +0 -52
- package/src/__tests__/ensure-identity-account.test.ts +0 -146
- package/src/__tests__/errors.test.ts +0 -349
- package/src/__tests__/gen/errors.test.ts +0 -138
- package/src/__tests__/gen/invitation-client.test.ts +0 -132
- package/src/__tests__/gen/proto-utils.test.ts +0 -99
- package/src/__tests__/gen/session-client.test.ts +0 -208
- package/src/__tests__/guest-auth.test.ts +0 -287
- package/src/__tests__/iam-principal.test.ts +0 -82
- package/src/__tests__/manifest.test.ts +0 -362
- package/src/__tests__/mcpserver-connect.test.ts +0 -181
- package/src/__tests__/node.test.ts +0 -74
- package/src/__tests__/platform-client-auth.test.ts +0 -76
- package/src/__tests__/platform.test.ts +0 -74
- package/src/__tests__/plugin.test.ts +0 -92
- package/src/__tests__/resource-availability.test.ts +0 -118
- package/src/__tests__/runner-adapter.test.ts +0 -122
- package/src/__tests__/session.test.ts +0 -66
- package/src/__tests__/sharing.test.ts +0 -159
- package/src/__tests__/skill.test.ts +0 -150
- package/src/__tests__/stigmer.test.ts +0 -170
- package/src/__tests__/update-input-roundtrip.test.ts +0 -1007
- package/src/__tests__/update-input.test.ts +0 -250
- package/src/execution/__tests__/approval-provenance.test.ts +0 -60
- package/src/execution/__tests__/file-review-fold.corpus.test.ts +0 -127
- package/src/execution/__tests__/file-review-fold.test.ts +0 -281
- package/src/execution/__tests__/to-display-file-change.test.ts +0 -106
- package/src/execution/__tests__/tool-view.file-changes.test.ts +0 -100
- package/src/execution/__tests__/tool-view.fixtures.test.ts +0 -225
- package/src/execution/__tests__/tool-view.output-ref.test.ts +0 -76
- package/src/execution/__tests__/tool-view.read.test.ts +0 -71
- package/src/execution/__tests__/tool-view.search.test.ts +0 -264
- package/src/execution/__tests__/tool-view.shell.test.ts +0 -127
- package/src/execution/__tests__/transcript.golden.md +0 -100
- package/src/execution/__tests__/transcript.test.ts +0 -697
- package/src/node.test.ts +0 -38
package/node.test.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { normalizeEndpoint } from "./node";
|
|
3
|
-
describe("normalizeEndpoint", () => {
|
|
4
|
-
it.each([
|
|
5
|
-
// Loopback hosts stay plaintext (the local daemon default).
|
|
6
|
-
["localhost:7234", "http://localhost:7234"],
|
|
7
|
-
["127.0.0.1:7234", "http://127.0.0.1:7234"],
|
|
8
|
-
["[::1]:7234", "http://[::1]:7234"],
|
|
9
|
-
// Explicit :443 is TLS; any other explicit port is plaintext.
|
|
10
|
-
["api.stigmer.ai:443", "https://api.stigmer.ai:443"],
|
|
11
|
-
["internal:8080", "http://internal:8080"],
|
|
12
|
-
// No port on a public host → assume TLS on :443.
|
|
13
|
-
["api.stigmer.ai", "https://api.stigmer.ai:443"],
|
|
14
|
-
// Loopback without a port stays plaintext and is left as-is.
|
|
15
|
-
["localhost", "http://localhost"],
|
|
16
|
-
])("normalizes %s → %s", (input, expected) => {
|
|
17
|
-
expect(normalizeEndpoint(input)).toBe(expected);
|
|
18
|
-
});
|
|
19
|
-
it("strips a URL scheme and derives TLS from the port, not the scheme", () => {
|
|
20
|
-
// Mirrors the Go rule's quirk: the port is authoritative for TLS.
|
|
21
|
-
expect(normalizeEndpoint("https://api.stigmer.ai")).toBe("https://api.stigmer.ai:443");
|
|
22
|
-
expect(normalizeEndpoint("http://internal:8080")).toBe("http://internal:8080");
|
|
23
|
-
expect(normalizeEndpoint("https://internal:8080")).toBe("http://internal:8080");
|
|
24
|
-
});
|
|
25
|
-
it("trims whitespace and trailing slashes", () => {
|
|
26
|
-
expect(normalizeEndpoint(" api.stigmer.ai:443/ ")).toBe("https://api.stigmer.ai:443");
|
|
27
|
-
expect(normalizeEndpoint("https://api.stigmer.ai/")).toBe("https://api.stigmer.ai:443");
|
|
28
|
-
});
|
|
29
|
-
it("throws on empty input", () => {
|
|
30
|
-
expect(() => normalizeEndpoint("")).toThrow(/must not be empty/);
|
|
31
|
-
expect(() => normalizeEndpoint(" ")).toThrow(/must not be empty/);
|
|
32
|
-
expect(() => normalizeEndpoint("https://")).toThrow(/no host/);
|
|
33
|
-
});
|
|
34
|
-
});
|
|
35
|
-
//# sourceMappingURL=node.test.js.map
|
package/node.test.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"node.test.js","sourceRoot":"","sources":["../src/node.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,QAAQ,CAAC;AAE3C,QAAQ,CAAC,mBAAmB,EAAE,GAAG,EAAE;IACjC,EAAE,CAAC,IAAI,CAAC;QACN,4DAA4D;QAC5D,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;QAC3C,CAAC,gBAAgB,EAAE,uBAAuB,CAAC;QAC3C,CAAC,YAAY,EAAE,mBAAmB,CAAC;QACnC,8DAA8D;QAC9D,CAAC,oBAAoB,EAAE,4BAA4B,CAAC;QACpD,CAAC,eAAe,EAAE,sBAAsB,CAAC;QACzC,iDAAiD;QACjD,CAAC,gBAAgB,EAAE,4BAA4B,CAAC;QAChD,6DAA6D;QAC7D,CAAC,WAAW,EAAE,kBAAkB,CAAC;KAClC,CAAC,CAAC,oBAAoB,EAAE,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC3C,MAAM,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;IAClD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,mEAAmE,EAAE,GAAG,EAAE;QAC3E,kEAAkE;QAClE,MAAM,CAAC,iBAAiB,CAAC,wBAAwB,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACvF,MAAM,CAAC,iBAAiB,CAAC,sBAAsB,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;QAC/E,MAAM,CAAC,iBAAiB,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC;IAClF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;QAC/C,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;QACxF,MAAM,CAAC,iBAAiB,CAAC,yBAAyB,CAAC,CAAC,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAC;IAC1F,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,uBAAuB,EAAE,GAAG,EAAE;QAC/B,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACjE,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,mBAAmB,CAAC,CAAC;QACpE,MAAM,CAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IACjE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
// Wire-shape tests for BillingClient: a router transport fakes the billing
|
|
2
|
-
// services in-process, captures the outgoing request messages, and the tests
|
|
3
|
-
// assert the SDK params mapped onto the right proto fields. This mirrors
|
|
4
|
-
// sdk/java's BillingClientTest and sdk/go's billing_test.go — the reference
|
|
5
|
-
// pattern for testing the handwritten (non-resource) clients.
|
|
6
|
-
import { describe, expect, it } from "vitest";
|
|
7
|
-
import { createRouterTransport, type Transport } from "@connectrpc/connect";
|
|
8
|
-
import { create } from "@bufbuild/protobuf";
|
|
9
|
-
import { timestampDate } from "@bufbuild/protobuf/wkt";
|
|
10
|
-
import { BillingCommandController } from "@stigmer/protos/ai/stigmer/billing/v1/command_pb";
|
|
11
|
-
import { BillingQueryController } from "@stigmer/protos/ai/stigmer/billing/v1/query_pb";
|
|
12
|
-
import {
|
|
13
|
-
CreditLedgerResponseSchema,
|
|
14
|
-
type AdjustCreditsInput,
|
|
15
|
-
type GrantCreditsInput,
|
|
16
|
-
type GetCreditLedgerInput,
|
|
17
|
-
} from "@stigmer/protos/ai/stigmer/billing/v1/io_pb";
|
|
18
|
-
import { CreditLedgerEntrySchema } from "@stigmer/protos/ai/stigmer/billing/v1/credit_pb";
|
|
19
|
-
import { LedgerEntryType, LedgerView } from "@stigmer/protos/ai/stigmer/billing/v1/enum_pb";
|
|
20
|
-
import { BillingClient } from "../billing.js";
|
|
21
|
-
|
|
22
|
-
interface Captured {
|
|
23
|
-
adjustCredits?: AdjustCreditsInput;
|
|
24
|
-
grantCredits?: GrantCreditsInput;
|
|
25
|
-
getCreditLedger?: GetCreditLedgerInput;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
function fakeTransport(captured: Captured): Transport {
|
|
29
|
-
return createRouterTransport(({ service }) => {
|
|
30
|
-
service(BillingCommandController, {
|
|
31
|
-
adjustCredits: (req) => {
|
|
32
|
-
captured.adjustCredits = req;
|
|
33
|
-
return create(CreditLedgerEntrySchema, { amountMicros: req.amountMicros });
|
|
34
|
-
},
|
|
35
|
-
grantCredits: (req) => {
|
|
36
|
-
captured.grantCredits = req;
|
|
37
|
-
return create(CreditLedgerEntrySchema, { amountMicros: req.amountMicros });
|
|
38
|
-
},
|
|
39
|
-
});
|
|
40
|
-
service(BillingQueryController, {
|
|
41
|
-
getCreditLedger: (req) => {
|
|
42
|
-
captured.getCreditLedger = req;
|
|
43
|
-
return create(CreditLedgerResponseSchema, {});
|
|
44
|
-
},
|
|
45
|
-
});
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
describe("BillingClient.adjustCredits", () => {
|
|
50
|
-
it("maps params onto AdjustCreditsInput and returns the ledger entry", async () => {
|
|
51
|
-
const captured: Captured = {};
|
|
52
|
-
const client = new BillingClient(fakeTransport(captured));
|
|
53
|
-
|
|
54
|
-
const entry = await client.adjustCredits({
|
|
55
|
-
orgId: "acme",
|
|
56
|
-
amountMicros: 25_000_000n,
|
|
57
|
-
reason: "initial tenant funding",
|
|
58
|
-
idempotencyKey: "fund-acme-001",
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
expect(entry.amountMicros).toBe(25_000_000n);
|
|
62
|
-
expect(captured.adjustCredits?.orgId).toBe("acme");
|
|
63
|
-
expect(captured.adjustCredits?.amountMicros).toBe(25_000_000n);
|
|
64
|
-
expect(captured.adjustCredits?.reason).toBe("initial tenant funding");
|
|
65
|
-
expect(captured.adjustCredits?.idempotencyKey).toBe("fund-acme-001");
|
|
66
|
-
});
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
describe("BillingClient.grantCredits", () => {
|
|
70
|
-
it("maps params including the expiry onto GrantCreditsInput", async () => {
|
|
71
|
-
const captured: Captured = {};
|
|
72
|
-
const client = new BillingClient(fakeTransport(captured));
|
|
73
|
-
|
|
74
|
-
const expiresAt = new Date("2026-08-31T23:59:59Z");
|
|
75
|
-
const entry = await client.grantCredits({
|
|
76
|
-
orgId: "acme",
|
|
77
|
-
amountMicros: 5_000_000n,
|
|
78
|
-
expiresAt,
|
|
79
|
-
reason: "monthly free allowance 2026-08",
|
|
80
|
-
idempotencyKey: "allowance-acme-2026-08",
|
|
81
|
-
});
|
|
82
|
-
|
|
83
|
-
expect(entry.amountMicros).toBe(5_000_000n);
|
|
84
|
-
const req = captured.grantCredits;
|
|
85
|
-
expect(req?.orgId).toBe("acme");
|
|
86
|
-
expect(req?.amountMicros).toBe(5_000_000n);
|
|
87
|
-
expect(req?.expiresAt && timestampDate(req.expiresAt)).toEqual(expiresAt);
|
|
88
|
-
expect(req?.reason).toBe("monthly free allowance 2026-08");
|
|
89
|
-
expect(req?.idempotencyKey).toBe("allowance-acme-2026-08");
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it("omits the expiry for a never-expiring grant", async () => {
|
|
93
|
-
const captured: Captured = {};
|
|
94
|
-
const client = new BillingClient(fakeTransport(captured));
|
|
95
|
-
|
|
96
|
-
await client.grantCredits({
|
|
97
|
-
orgId: "acme",
|
|
98
|
-
amountMicros: 1_000_000n,
|
|
99
|
-
reason: "welcome credit",
|
|
100
|
-
idempotencyKey: "welcome-acme",
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
expect(captured.grantCredits?.expiresAt).toBeUndefined();
|
|
104
|
-
});
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
describe("BillingClient.getCreditLedger", () => {
|
|
108
|
-
it("maps all filters including the time range", async () => {
|
|
109
|
-
const captured: Captured = {};
|
|
110
|
-
const client = new BillingClient(fakeTransport(captured));
|
|
111
|
-
|
|
112
|
-
const startTime = new Date("2026-08-01T00:00:00Z");
|
|
113
|
-
const endTime = new Date("2026-08-13T00:00:00Z");
|
|
114
|
-
await client.getCreditLedger({
|
|
115
|
-
orgId: "acme",
|
|
116
|
-
page: { num: 2, size: 50 },
|
|
117
|
-
typeFilter: [LedgerEntryType.adjustment_credit],
|
|
118
|
-
startTime,
|
|
119
|
-
endTime,
|
|
120
|
-
view: LedgerView.statement,
|
|
121
|
-
});
|
|
122
|
-
|
|
123
|
-
const req = captured.getCreditLedger;
|
|
124
|
-
expect(req?.orgId).toBe("acme");
|
|
125
|
-
expect(req?.page?.num).toBe(2);
|
|
126
|
-
expect(req?.page?.size).toBe(50);
|
|
127
|
-
expect(req?.typeFilter).toEqual([LedgerEntryType.adjustment_credit]);
|
|
128
|
-
expect(req?.startTime && timestampDate(req.startTime)).toEqual(startTime);
|
|
129
|
-
expect(req?.endTime && timestampDate(req.endTime)).toEqual(endTime);
|
|
130
|
-
expect(req?.view).toBe(LedgerView.statement);
|
|
131
|
-
});
|
|
132
|
-
|
|
133
|
-
it("omits unset optional filters", async () => {
|
|
134
|
-
const captured: Captured = {};
|
|
135
|
-
const client = new BillingClient(fakeTransport(captured));
|
|
136
|
-
|
|
137
|
-
await client.getCreditLedger({ orgId: "acme" });
|
|
138
|
-
|
|
139
|
-
const req = captured.getCreditLedger;
|
|
140
|
-
expect(req?.page).toBeUndefined();
|
|
141
|
-
expect(req?.startTime).toBeUndefined();
|
|
142
|
-
expect(req?.endTime).toBeUndefined();
|
|
143
|
-
expect(req?.typeFilter).toEqual([]);
|
|
144
|
-
expect(req?.view).toBe(LedgerView.unspecified);
|
|
145
|
-
});
|
|
146
|
-
});
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from "vitest";
|
|
2
|
-
import { validateConfig, type StigmerConfig } from "../config";
|
|
3
|
-
|
|
4
|
-
describe("validateConfig", () => {
|
|
5
|
-
const validApiKeyConfig: StigmerConfig = {
|
|
6
|
-
baseUrl: "https://api.stigmer.ai",
|
|
7
|
-
apiKey: "sk_live_abc123",
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
const validTokenProviderConfig: StigmerConfig = {
|
|
11
|
-
baseUrl: "https://api.stigmer.ai",
|
|
12
|
-
getAccessToken: () => "token",
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
it("accepts a valid config with apiKey", () => {
|
|
16
|
-
expect(() => validateConfig(validApiKeyConfig)).not.toThrow();
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
it("accepts a valid config with getAccessToken", () => {
|
|
20
|
-
expect(() => validateConfig(validTokenProviderConfig)).not.toThrow();
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
it("rejects missing baseUrl", () => {
|
|
24
|
-
expect(() =>
|
|
25
|
-
validateConfig({ baseUrl: "", apiKey: "key" }),
|
|
26
|
-
).toThrow("stigmer: baseUrl is required");
|
|
27
|
-
});
|
|
28
|
-
|
|
29
|
-
it("rejects missing both apiKey and getAccessToken", () => {
|
|
30
|
-
expect(() =>
|
|
31
|
-
validateConfig({ baseUrl: "https://api.stigmer.ai" }),
|
|
32
|
-
).toThrow("stigmer: either apiKey or getAccessToken must be provided");
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
it("rejects empty apiKey without getAccessToken", () => {
|
|
36
|
-
expect(() =>
|
|
37
|
-
validateConfig({ baseUrl: "https://api.stigmer.ai", apiKey: "" }),
|
|
38
|
-
).toThrow("stigmer: either apiKey or getAccessToken must be provided");
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("rejects providing both apiKey and getAccessToken", () => {
|
|
42
|
-
expect(() =>
|
|
43
|
-
validateConfig({
|
|
44
|
-
baseUrl: "https://api.stigmer.ai",
|
|
45
|
-
apiKey: "sk_live_abc123",
|
|
46
|
-
getAccessToken: () => "token",
|
|
47
|
-
}),
|
|
48
|
-
).toThrow(
|
|
49
|
-
"stigmer: apiKey and getAccessToken are mutually exclusive — provide one, not both",
|
|
50
|
-
);
|
|
51
|
-
});
|
|
52
|
-
});
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Pins `ensureMyIdentityAccount` (`ensure-identity-account.ts`; 20260911.11
|
|
3
|
-
* A3): the ONE first-sign-in flow every surface runs — the console's
|
|
4
|
-
* `useIdentityAccountGate` delegates to it, the CLI's `auth whoami` and
|
|
5
|
-
* `auth login` call it — so a platform builder embedding Stigmer gets the
|
|
6
|
-
* same flow as a first-class import.
|
|
7
|
-
*
|
|
8
|
-
* 1. whoAmI answers → the account, `created: false`; nothing else is
|
|
9
|
-
* called;
|
|
10
|
-
* 2. whoAmI is NOT_FOUND → `onProvisioning` fires once (the hook's
|
|
11
|
-
* "provisioning" state), provisionMyAccount runs, the created account
|
|
12
|
-
* comes back with `created: true`;
|
|
13
|
-
* 3. any other whoAmI error propagates untouched (UNAUTHENTICATED,
|
|
14
|
-
* UNAVAILABLE, a network fault) — the caller's error UX owns it;
|
|
15
|
-
* 4. a provisionMyAccount failure propagates untouched (UNAVAILABLE when
|
|
16
|
-
* the issuer's userinfo is down is the documented arm).
|
|
17
|
-
*
|
|
18
|
-
* The doubles reject with `StigmerError`, the vocabulary the real
|
|
19
|
-
* `IdentityAccountClient` speaks (every RPC failure passes through
|
|
20
|
-
* `wrapError`), so `isNotFound` — the SDK's one classifier — is what the
|
|
21
|
-
* helper is proven against (refinement 11, slice 4).
|
|
22
|
-
*/
|
|
23
|
-
import { Code } from "@connectrpc/connect";
|
|
24
|
-
import { create } from "@bufbuild/protobuf";
|
|
25
|
-
import {
|
|
26
|
-
IdentityAccountSchema,
|
|
27
|
-
type IdentityAccount,
|
|
28
|
-
} from "@stigmer/protos/ai/stigmer/iam/identityaccount/v1/api_pb";
|
|
29
|
-
import { describe, expect, it } from "vitest";
|
|
30
|
-
|
|
31
|
-
import {
|
|
32
|
-
ensureMyIdentityAccount,
|
|
33
|
-
type IdentityAccountLane,
|
|
34
|
-
} from "../ensure-identity-account";
|
|
35
|
-
import { StigmerError } from "../gen/errors";
|
|
36
|
-
|
|
37
|
-
interface Calls {
|
|
38
|
-
whoAmI: number;
|
|
39
|
-
provisionMyAccount: number;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
function clientWith(behaviour: {
|
|
43
|
-
whoAmI: () => Promise<IdentityAccount>;
|
|
44
|
-
provisionMyAccount?: () => Promise<IdentityAccount>;
|
|
45
|
-
}): { client: { identityAccount: IdentityAccountLane }; calls: Calls } {
|
|
46
|
-
const calls: Calls = { whoAmI: 0, provisionMyAccount: 0 };
|
|
47
|
-
const client = {
|
|
48
|
-
identityAccount: {
|
|
49
|
-
whoAmI: () => {
|
|
50
|
-
calls.whoAmI += 1;
|
|
51
|
-
return behaviour.whoAmI();
|
|
52
|
-
},
|
|
53
|
-
provisionMyAccount: () => {
|
|
54
|
-
calls.provisionMyAccount += 1;
|
|
55
|
-
return (
|
|
56
|
-
behaviour.provisionMyAccount ??
|
|
57
|
-
(() => Promise.reject(new Error("must not be called")))
|
|
58
|
-
)();
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
return { client, calls };
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
const EXISTING = create(IdentityAccountSchema, {
|
|
66
|
-
metadata: { id: "ida_existing" },
|
|
67
|
-
spec: { idpId: "auth0|existing" },
|
|
68
|
-
});
|
|
69
|
-
const CREATED = create(IdentityAccountSchema, {
|
|
70
|
-
metadata: { id: "ida_created" },
|
|
71
|
-
spec: { idpId: "auth0|created" },
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
const NOT_FOUND = () =>
|
|
75
|
-
new StigmerError(
|
|
76
|
-
"not-found",
|
|
77
|
-
"Identity account not found for the authenticated user",
|
|
78
|
-
Code.NotFound,
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
describe("ensureMyIdentityAccount", () => {
|
|
82
|
-
it("answers the existing account without provisioning", async () => {
|
|
83
|
-
const { client, calls } = clientWith({
|
|
84
|
-
whoAmI: () => Promise.resolve(EXISTING),
|
|
85
|
-
});
|
|
86
|
-
const result = await ensureMyIdentityAccount(client);
|
|
87
|
-
expect(result).toEqual({ account: EXISTING, created: false });
|
|
88
|
-
expect(calls).toEqual({ whoAmI: 1, provisionMyAccount: 0 });
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
it("provisions on NOT_FOUND, telling the caller once that it is provisioning", async () => {
|
|
92
|
-
const { client, calls } = clientWith({
|
|
93
|
-
whoAmI: () => Promise.reject(NOT_FOUND()),
|
|
94
|
-
provisionMyAccount: () => Promise.resolve(CREATED),
|
|
95
|
-
});
|
|
96
|
-
let provisioning = 0;
|
|
97
|
-
const result = await ensureMyIdentityAccount(client, {
|
|
98
|
-
onProvisioning: () => (provisioning += 1),
|
|
99
|
-
});
|
|
100
|
-
expect(result).toEqual({ account: CREATED, created: true });
|
|
101
|
-
expect(provisioning).toBe(1);
|
|
102
|
-
expect(calls).toEqual({ whoAmI: 1, provisionMyAccount: 1 });
|
|
103
|
-
});
|
|
104
|
-
|
|
105
|
-
it("does not fire onProvisioning when the account already exists", async () => {
|
|
106
|
-
const { client } = clientWith({ whoAmI: () => Promise.resolve(EXISTING) });
|
|
107
|
-
let provisioning = 0;
|
|
108
|
-
await ensureMyIdentityAccount(client, {
|
|
109
|
-
onProvisioning: () => (provisioning += 1),
|
|
110
|
-
});
|
|
111
|
-
expect(provisioning).toBe(0);
|
|
112
|
-
});
|
|
113
|
-
|
|
114
|
-
it("propagates any other whoAmI error untouched — only NOT_FOUND means 'provision me'", async () => {
|
|
115
|
-
const unauthenticated = new StigmerError(
|
|
116
|
-
"unauthenticated",
|
|
117
|
-
"authentication token missing",
|
|
118
|
-
Code.Unauthenticated,
|
|
119
|
-
);
|
|
120
|
-
const { client, calls } = clientWith({
|
|
121
|
-
whoAmI: () => Promise.reject(unauthenticated),
|
|
122
|
-
});
|
|
123
|
-
await expect(ensureMyIdentityAccount(client)).rejects.toBe(unauthenticated);
|
|
124
|
-
expect(calls.provisionMyAccount).toBe(0);
|
|
125
|
-
|
|
126
|
-
// A value that is not a StigmerError at all (a lane double that does
|
|
127
|
-
// not wrap, a transport fault) is also "any other error": propagated
|
|
128
|
-
// as the same object, never classified as "provision me".
|
|
129
|
-
const network = new TypeError("Load failed");
|
|
130
|
-
const offline = clientWith({ whoAmI: () => Promise.reject(network) });
|
|
131
|
-
await expect(ensureMyIdentityAccount(offline.client)).rejects.toBe(network);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("propagates a provisioning failure untouched (the issuer's userinfo down is UNAVAILABLE)", async () => {
|
|
135
|
-
const unavailable = new StigmerError(
|
|
136
|
-
"unavailable",
|
|
137
|
-
"Failed to fetch user profile from identity provider: userinfo answered 503",
|
|
138
|
-
Code.Unavailable,
|
|
139
|
-
);
|
|
140
|
-
const { client } = clientWith({
|
|
141
|
-
whoAmI: () => Promise.reject(NOT_FOUND()),
|
|
142
|
-
provisionMyAccount: () => Promise.reject(unavailable),
|
|
143
|
-
});
|
|
144
|
-
await expect(ensureMyIdentityAccount(client)).rejects.toBe(unavailable);
|
|
145
|
-
});
|
|
146
|
-
});
|