@stigmer/client 0.0.0-stage → 0.1.0-dev.20261017064309.g94d062a29f89
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/LICENSE +194 -0
- package/README.md +299 -2
- package/access-history.d.ts +35 -0
- package/access-history.d.ts.map +1 -0
- package/access-history.js +66 -0
- package/access-history.js.map +1 -0
- package/activity.d.ts +26 -0
- package/activity.d.ts.map +1 -0
- package/activity.js +30 -0
- package/activity.js.map +1 -0
- package/artifact-routing.d.ts +42 -0
- package/artifact-routing.d.ts.map +1 -0
- package/artifact-routing.js +60 -0
- package/artifact-routing.js.map +1 -0
- package/authorization-config.d.ts +52 -0
- package/authorization-config.d.ts.map +1 -0
- package/authorization-config.js +57 -0
- package/authorization-config.js.map +1 -0
- package/billing.d.ts +118 -0
- package/billing.d.ts.map +1 -0
- package/billing.js +152 -0
- package/billing.js.map +1 -0
- package/chat-link.d.ts +77 -0
- package/chat-link.d.ts.map +1 -0
- package/chat-link.js +118 -0
- package/chat-link.js.map +1 -0
- package/config.d.ts +118 -0
- package/config.d.ts.map +1 -0
- package/config.js +22 -0
- package/config.js.map +1 -0
- package/ensure-identity-account.d.ts +71 -0
- package/ensure-identity-account.d.ts.map +1 -0
- package/ensure-identity-account.js +29 -0
- package/ensure-identity-account.js.map +1 -0
- package/errors.d.ts +121 -0
- package/errors.d.ts.map +1 -0
- package/errors.js +274 -0
- package/errors.js.map +1 -0
- package/eval-run/allow-tools.d.ts +3 -0
- package/eval-run/allow-tools.d.ts.map +1 -0
- package/eval-run/allow-tools.js +11 -0
- package/eval-run/allow-tools.js.map +1 -0
- package/eval-run/result-document.d.ts +165 -0
- package/eval-run/result-document.d.ts.map +1 -0
- package/eval-run/result-document.js +269 -0
- package/eval-run/result-document.js.map +1 -0
- package/eval.d.ts +45 -0
- package/eval.d.ts.map +1 -0
- package/eval.js +100 -0
- package/eval.js.map +1 -0
- package/gen/agent.d.ts +127 -0
- package/gen/agent.d.ts.map +1 -0
- package/gen/agent.js +342 -0
- package/gen/agent.js.map +1 -0
- package/gen/apikey.d.ts +63 -0
- package/gen/apikey.d.ts.map +1 -0
- package/gen/apikey.js +166 -0
- package/gen/apikey.js.map +1 -0
- package/gen/authorization-config.d.ts +46 -0
- package/gen/authorization-config.d.ts.map +1 -0
- package/gen/authorization-config.js +138 -0
- package/gen/authorization-config.js.map +1 -0
- package/gen/bidi-stream.d.ts +21 -0
- package/gen/bidi-stream.d.ts.map +1 -0
- package/gen/bidi-stream.js +60 -0
- package/gen/bidi-stream.js.map +1 -0
- package/gen/channel.d.ts +135 -0
- package/gen/channel.d.ts.map +1 -0
- package/gen/channel.js +453 -0
- package/gen/channel.js.map +1 -0
- package/gen/channelapp.d.ts +70 -0
- package/gen/channelapp.d.ts.map +1 -0
- package/gen/channelapp.js +184 -0
- package/gen/channelapp.js.map +1 -0
- package/gen/client.d.ts +111 -0
- package/gen/client.d.ts.map +1 -0
- package/gen/client.js +113 -0
- package/gen/client.js.map +1 -0
- package/gen/errors.d.ts +22 -0
- package/gen/errors.d.ts.map +1 -0
- package/gen/errors.js +64 -0
- package/gen/errors.js.map +1 -0
- package/gen/eval.d.ts +55 -0
- package/gen/eval.d.ts.map +1 -0
- package/gen/eval.js +173 -0
- package/gen/eval.js.map +1 -0
- package/gen/evalrun.d.ts +77 -0
- package/gen/evalrun.d.ts.map +1 -0
- package/gen/evalrun.js +158 -0
- package/gen/evalrun.js.map +1 -0
- package/gen/federationissuer.d.ts +64 -0
- package/gen/federationissuer.d.ts.map +1 -0
- package/gen/federationissuer.js +162 -0
- package/gen/federationissuer.js.map +1 -0
- package/gen/grant.d.ts +58 -0
- package/gen/grant.d.ts.map +1 -0
- package/gen/grant.js +183 -0
- package/gen/grant.js.map +1 -0
- package/gen/identityaccount.d.ts +81 -0
- package/gen/identityaccount.d.ts.map +1 -0
- package/gen/identityaccount.js +238 -0
- package/gen/identityaccount.js.map +1 -0
- package/gen/invitation.d.ts +44 -0
- package/gen/invitation.d.ts.map +1 -0
- package/gen/invitation.js +104 -0
- package/gen/invitation.js.map +1 -0
- package/gen/license.d.ts +70 -0
- package/gen/license.d.ts.map +1 -0
- package/gen/license.js +114 -0
- package/gen/license.js.map +1 -0
- package/gen/memory.d.ts +62 -0
- package/gen/memory.d.ts.map +1 -0
- package/gen/memory.js +155 -0
- package/gen/memory.js.map +1 -0
- package/gen/oauthapp.d.ts +68 -0
- package/gen/oauthapp.d.ts.map +1 -0
- package/gen/oauthapp.js +170 -0
- package/gen/oauthapp.js.map +1 -0
- package/gen/organization.d.ts +91 -0
- package/gen/organization.d.ts.map +1 -0
- package/gen/organization.js +237 -0
- package/gen/organization.js.map +1 -0
- package/gen/plan.d.ts +68 -0
- package/gen/plan.d.ts.map +1 -0
- package/gen/plan.js +116 -0
- package/gen/plan.js.map +1 -0
- package/gen/plugin.d.ts +67 -0
- package/gen/plugin.d.ts.map +1 -0
- package/gen/plugin.js +172 -0
- package/gen/plugin.js.map +1 -0
- package/gen/proto-utils.d.ts +33 -0
- package/gen/proto-utils.d.ts.map +1 -0
- package/gen/proto-utils.js +57 -0
- package/gen/proto-utils.js.map +1 -0
- package/gen/providerkey.d.ts +19 -0
- package/gen/providerkey.d.ts.map +1 -0
- package/gen/providerkey.js +55 -0
- package/gen/providerkey.js.map +1 -0
- package/gen/resource-availability.d.ts +12 -0
- package/gen/resource-availability.d.ts.map +1 -0
- package/gen/resource-availability.js +41 -0
- package/gen/resource-availability.js.map +1 -0
- package/gen/routine.d.ts +116 -0
- package/gen/routine.d.ts.map +1 -0
- package/gen/routine.js +319 -0
- package/gen/routine.js.map +1 -0
- package/gen/run.d.ts +199 -0
- package/gen/run.d.ts.map +1 -0
- package/gen/run.js +578 -0
- package/gen/run.js.map +1 -0
- package/gen/score.d.ts +79 -0
- package/gen/score.d.ts.map +1 -0
- package/gen/score.js +204 -0
- package/gen/score.js.map +1 -0
- package/gen/scoringrule.d.ts +50 -0
- package/gen/scoringrule.d.ts.map +1 -0
- package/gen/scoringrule.js +112 -0
- package/gen/scoringrule.js.map +1 -0
- package/gen/session.d.ts +110 -0
- package/gen/session.d.ts.map +1 -0
- package/gen/session.js +333 -0
- package/gen/session.js.map +1 -0
- package/gen/skill.d.ts +55 -0
- package/gen/skill.d.ts.map +1 -0
- package/gen/skill.js +159 -0
- package/gen/skill.js.map +1 -0
- package/gen/subscription.d.ts +34 -0
- package/gen/subscription.d.ts.map +1 -0
- package/gen/subscription.js +85 -0
- package/gen/subscription.js.map +1 -0
- package/gen/team.d.ts +55 -0
- package/gen/team.d.ts.map +1 -0
- package/gen/team.js +140 -0
- package/gen/team.js.map +1 -0
- package/gen/types.d.ts +18 -0
- package/gen/types.d.ts.map +1 -0
- package/gen/types.js +3 -0
- package/gen/types.js.map +1 -0
- package/gen/vault.d.ts +103 -0
- package/gen/vault.d.ts.map +1 -0
- package/gen/vault.js +344 -0
- package/gen/vault.js.map +1 -0
- package/github.d.ts +47 -0
- package/github.d.ts.map +1 -0
- package/github.js +68 -0
- package/github.js.map +1 -0
- package/guest-auth.d.ts +177 -0
- package/guest-auth.d.ts.map +1 -0
- package/guest-auth.js +218 -0
- package/guest-auth.js.map +1 -0
- package/hook-words.d.ts +32 -0
- package/hook-words.d.ts.map +1 -0
- package/hook-words.js +65 -0
- package/hook-words.js.map +1 -0
- package/iam-principal.d.ts +43 -0
- package/iam-principal.d.ts.map +1 -0
- package/iam-principal.js +109 -0
- package/iam-principal.js.map +1 -0
- package/iam-role.d.ts +57 -0
- package/iam-role.d.ts.map +1 -0
- package/iam-role.js +83 -0
- package/iam-role.js.map +1 -0
- package/index.d.ts +83 -0
- package/index.d.ts.map +1 -0
- package/index.js +126 -0
- package/index.js.map +1 -0
- package/internal/interceptors.d.ts +25 -0
- package/internal/interceptors.d.ts.map +1 -0
- package/internal/interceptors.js +75 -0
- package/internal/interceptors.js.map +1 -0
- package/internal/trim.d.ts +7 -0
- package/internal/trim.d.ts.map +1 -0
- package/internal/trim.js +12 -0
- package/internal/trim.js.map +1 -0
- package/manifest/client.d.ts +91 -0
- package/manifest/client.d.ts.map +1 -0
- package/manifest/client.js +141 -0
- package/manifest/client.js.map +1 -0
- package/manifest/document.d.ts +36 -0
- package/manifest/document.d.ts.map +1 -0
- package/manifest/document.js +67 -0
- package/manifest/document.js.map +1 -0
- package/manifest/index.d.ts +12 -0
- package/manifest/index.d.ts.map +1 -0
- package/manifest/index.js +13 -0
- package/manifest/index.js.map +1 -0
- package/manifest/parse.d.ts +98 -0
- package/manifest/parse.d.ts.map +1 -0
- package/manifest/parse.js +216 -0
- package/manifest/parse.js.map +1 -0
- package/manifest/redaction.d.ts +16 -0
- package/manifest/redaction.d.ts.map +1 -0
- package/manifest/redaction.js +19 -0
- package/manifest/redaction.js.map +1 -0
- package/manifest/registry.d.ts +63 -0
- package/manifest/registry.d.ts.map +1 -0
- package/manifest/registry.js +121 -0
- package/manifest/registry.js.map +1 -0
- package/manifest/serialize.d.ts +47 -0
- package/manifest/serialize.d.ts.map +1 -0
- package/manifest/serialize.js +144 -0
- package/manifest/serialize.js.map +1 -0
- package/manifest/slug.d.ts +122 -0
- package/manifest/slug.d.ts.map +1 -0
- package/manifest/slug.js +196 -0
- package/manifest/slug.js.map +1 -0
- package/node.d.ts +99 -0
- package/node.d.ts.map +1 -0
- package/node.js +142 -0
- package/node.js.map +1 -0
- package/package.json +45 -4
- package/pages.d.ts +32 -0
- package/pages.d.ts.map +1 -0
- package/pages.js +44 -0
- package/pages.js.map +1 -0
- package/platform.d.ts +69 -0
- package/platform.d.ts.map +1 -0
- package/platform.js +64 -0
- package/platform.js.map +1 -0
- package/plugin.d.ts +25 -0
- package/plugin.d.ts.map +1 -0
- package/plugin.js +45 -0
- package/plugin.js.map +1 -0
- package/references.d.ts +34 -0
- package/references.d.ts.map +1 -0
- package/references.js +38 -0
- package/references.js.map +1 -0
- package/resource-availability.d.ts +64 -0
- package/resource-availability.d.ts.map +1 -0
- package/resource-availability.js +111 -0
- package/resource-availability.js.map +1 -0
- package/run/approval-provenance.d.ts +36 -0
- package/run/approval-provenance.d.ts.map +1 -0
- package/run/approval-provenance.js +85 -0
- package/run/approval-provenance.js.map +1 -0
- package/run/conversation-rules.d.ts +67 -0
- package/run/conversation-rules.d.ts.map +1 -0
- package/run/conversation-rules.js +116 -0
- package/run/conversation-rules.js.map +1 -0
- package/run/file-review-fold.d.ts +21 -0
- package/run/file-review-fold.d.ts.map +1 -0
- package/run/file-review-fold.js +36 -0
- package/run/file-review-fold.js.map +1 -0
- package/run/run-phases.d.ts +7 -0
- package/run/run-phases.d.ts.map +1 -0
- package/run/run-phases.js +21 -0
- package/run/run-phases.js.map +1 -0
- package/run/to-display-file-change.d.ts +39 -0
- package/run/to-display-file-change.d.ts.map +1 -0
- package/run/to-display-file-change.js +48 -0
- package/run/to-display-file-change.js.map +1 -0
- package/run/tool-view.d.ts +164 -0
- package/run/tool-view.d.ts.map +1 -0
- package/run/tool-view.js +651 -0
- package/run/tool-view.js.map +1 -0
- package/run/transcript.d.ts +179 -0
- package/run/transcript.d.ts.map +1 -0
- package/run/transcript.js +515 -0
- package/run/transcript.js.map +1 -0
- package/runner-adapter.d.ts +54 -0
- package/runner-adapter.d.ts.map +1 -0
- package/runner-adapter.js +23 -0
- package/runner-adapter.js.map +1 -0
- package/search.d.ts +45 -0
- package/search.d.ts.map +1 -0
- package/search.js +50 -0
- package/search.js.map +1 -0
- package/session-events.d.ts +124 -0
- package/session-events.d.ts.map +1 -0
- package/session-events.js +185 -0
- package/session-events.js.map +1 -0
- package/session.d.ts +85 -0
- package/session.d.ts.map +1 -0
- package/session.js +99 -0
- package/session.js.map +1 -0
- package/skill.d.ts +27 -0
- package/skill.d.ts.map +1 -0
- package/skill.js +44 -0
- package/skill.js.map +1 -0
- package/src/access-history.ts +108 -0
- package/src/activity.ts +51 -0
- package/src/artifact-routing.ts +112 -0
- package/src/authorization-config.ts +89 -0
- package/src/billing.ts +243 -0
- package/src/chat-link.ts +134 -0
- package/src/config.ts +152 -0
- package/src/ensure-identity-account.ts +86 -0
- package/src/errors.ts +345 -0
- package/src/eval-run/allow-tools.ts +12 -0
- package/src/eval-run/result-document.ts +477 -0
- package/src/eval.ts +141 -0
- package/src/gen/agent.ts +417 -0
- package/src/gen/apikey.ts +176 -0
- package/src/gen/authorization-config.ts +143 -0
- package/src/gen/bidi-stream.ts +62 -0
- package/src/gen/channel.ts +467 -0
- package/src/gen/channelapp.ts +211 -0
- package/src/gen/client.ts +143 -0
- package/src/gen/errors.ts +88 -0
- package/src/gen/eval.ts +170 -0
- package/src/gen/evalrun.ts +200 -0
- package/src/gen/federationissuer.ts +177 -0
- package/src/gen/grant.ts +184 -0
- package/src/gen/identityaccount.ts +253 -0
- package/src/gen/invitation.ts +117 -0
- package/src/gen/license.ts +164 -0
- package/src/gen/memory.ts +175 -0
- package/src/gen/oauthapp.ts +188 -0
- package/src/gen/organization.ts +270 -0
- package/src/gen/plan.ts +161 -0
- package/src/gen/plugin.ts +188 -0
- package/src/gen/proto-utils.ts +61 -0
- package/src/gen/providerkey.ts +52 -0
- package/src/gen/resource-availability.ts +42 -0
- package/src/gen/routine.ts +373 -0
- package/src/gen/run.ts +691 -0
- package/src/gen/score.ts +228 -0
- package/src/gen/scoringrule.ts +128 -0
- package/src/gen/session.ts +367 -0
- package/src/gen/skill.ts +162 -0
- package/src/gen/subscription.ts +95 -0
- package/src/gen/team.ts +149 -0
- package/src/gen/types.ts +20 -0
- package/src/gen/vault.ts +353 -0
- package/src/github.ts +104 -0
- package/src/guest-auth.ts +330 -0
- package/src/hook-words.ts +81 -0
- package/src/iam-principal.ts +138 -0
- package/src/iam-role.ts +106 -0
- package/src/index.ts +522 -0
- package/src/internal/interceptors.ts +83 -0
- package/src/internal/trim.ts +10 -0
- package/src/manifest/client.ts +196 -0
- package/src/manifest/document.ts +75 -0
- package/src/manifest/index.ts +49 -0
- package/src/manifest/parse.ts +307 -0
- package/src/manifest/redaction.ts +20 -0
- package/src/manifest/registry.ts +198 -0
- package/src/manifest/serialize.ts +165 -0
- package/src/manifest/slug.ts +316 -0
- package/src/node.ts +198 -0
- package/src/pages.ts +59 -0
- package/src/platform.ts +112 -0
- package/src/plugin.ts +58 -0
- package/src/references.ts +52 -0
- package/src/resource-availability.ts +134 -0
- package/src/run/approval-provenance.ts +90 -0
- package/src/run/conversation-rules.ts +122 -0
- package/src/run/file-review-fold.ts +45 -0
- package/src/run/run-phases.ts +23 -0
- package/src/run/to-display-file-change.ts +79 -0
- package/src/run/tool-view.ts +876 -0
- package/src/run/transcript.ts +771 -0
- package/src/runner-adapter.ts +72 -0
- package/src/search.ts +82 -0
- package/src/session-events.ts +301 -0
- package/src/session.ts +113 -0
- package/src/skill.ts +58 -0
- package/src/stigmer.ts +208 -0
- package/src/tokens.ts +124 -0
- package/src/transport.ts +47 -0
- package/stigmer.d.ts +118 -0
- package/stigmer.d.ts.map +1 -0
- package/stigmer.js +174 -0
- package/stigmer.js.map +1 -0
- package/tokens.d.ts +79 -0
- package/tokens.d.ts.map +1 -0
- package/tokens.js +83 -0
- package/tokens.js.map +1 -0
- package/transport.d.ts +13 -0
- package/transport.d.ts.map +1 -0
- package/transport.js +35 -0
- package/transport.js.map +1 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
Copyright 2026 Stigmer Contributors
|
|
179
|
+
|
|
180
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
you may not use this file except in compliance with the License.
|
|
182
|
+
You may obtain a copy of the License at
|
|
183
|
+
|
|
184
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
|
|
186
|
+
Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
See the License for the specific language governing permissions and
|
|
190
|
+
limitations under the License.
|
|
191
|
+
|
|
192
|
+
Except for the contents of the ee/ directory, which are licensed under the
|
|
193
|
+
Stigmer Enterprise License (see ee/LICENSE), everything in this repository
|
|
194
|
+
is licensed under the Apache License, Version 2.0, above.
|
package/README.md
CHANGED
|
@@ -1,3 +1,300 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @stigmer/client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
TypeScript SDK for the Stigmer platform. Provides typed API clients for all Stigmer resources with authentication, error handling, and cross-resource search.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install @stigmer/client @stigmer/apis @bufbuild/protobuf
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
`@stigmer/apis` and `@bufbuild/protobuf` are peer dependencies.
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### Server-to-server (static API key)
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import { Stigmer } from "@stigmer/client";
|
|
19
|
+
|
|
20
|
+
const stigmer = new Stigmer({
|
|
21
|
+
baseUrl: "https://api.stigmer.ai",
|
|
22
|
+
apiKey: "sk_live_abc123",
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const agent = await stigmer.agent.get("agent-id");
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
### Browser / rotating credentials
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { Stigmer } from "@stigmer/client";
|
|
32
|
+
|
|
33
|
+
const stigmer = new Stigmer({
|
|
34
|
+
baseUrl: "https://api.stigmer.ai",
|
|
35
|
+
getAccessToken: () => authStore.getToken(),
|
|
36
|
+
onUnauthenticated: () => router.push("/login"),
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
const agents = await stigmer.agent.list({ org: "my-org" });
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## Resource Clients
|
|
43
|
+
|
|
44
|
+
Every resource type has a typed client accessible as a property on the `Stigmer` instance:
|
|
45
|
+
|
|
46
|
+
| Property | Resource |
|
|
47
|
+
|----------------------|--------------------|
|
|
48
|
+
| `agent` | Agent |
|
|
49
|
+
| `run` | Run |
|
|
50
|
+
| `apiKey` | ApiKey |
|
|
51
|
+
| `grant` | Grant |
|
|
52
|
+
| `identityAccount` | IdentityAccount |
|
|
53
|
+
| `federationIssuer` | FederationIssuer |
|
|
54
|
+
| `organization` | Organization |
|
|
55
|
+
| `plugin` | Plugin |
|
|
56
|
+
| `session` | Session |
|
|
57
|
+
| `skill` | Skill |
|
|
58
|
+
| `vault` | Vault |
|
|
59
|
+
| `search` | Cross-resource search |
|
|
60
|
+
| `billing` | Billing (account, Stripe, model catalog) |
|
|
61
|
+
|
|
62
|
+
A vault's entries are written through its entry calls, not through `create`
|
|
63
|
+
or `update`: `stigmer.vault.setSecrets`, `setConnection`, `removeSecrets` and
|
|
64
|
+
`removeConnections`. `create` starts the vault empty, and `update` changes its
|
|
65
|
+
name, description and external id while keeping the entries as stored.
|
|
66
|
+
|
|
67
|
+
### Billing
|
|
68
|
+
|
|
69
|
+
An organization's billing account (its Stripe customer), the Stripe portal
|
|
70
|
+
and card setup sessions. Token usage is read from the run client's usage
|
|
71
|
+
reports (`getRunUsageReport`, `getSessionUsageReport`, `getAgentUsageReport`,
|
|
72
|
+
`getOrgUsageReport`), counted in tokens and never priced. Queries
|
|
73
|
+
require `can_view_billing` on the org and the org's own billing commands
|
|
74
|
+
require `can_manage_billing`. The model catalog calls
|
|
75
|
+
(`listModelPricingBaselines`, `upsertModelPricingBaseline`,
|
|
76
|
+
`retireModelPricingBaseline`) require `can_manage_model_pricing` on the
|
|
77
|
+
platform:
|
|
78
|
+
|
|
79
|
+
```typescript
|
|
80
|
+
const account = await stigmer.billing.getBillingAccount(org);
|
|
81
|
+
|
|
82
|
+
const { setupUrl } = await stigmer.billing.createPaymentMethodSetupSession({
|
|
83
|
+
org,
|
|
84
|
+
successUrl: "https://example.com/billing?setup=success",
|
|
85
|
+
cancelUrl: "https://example.com/billing",
|
|
86
|
+
});
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Common operations
|
|
90
|
+
|
|
91
|
+
```typescript
|
|
92
|
+
import { create } from "@bufbuild/protobuf";
|
|
93
|
+
import { ListAgentsRequestSchema } from "@stigmer/apis/ai/stigmer/agentic/agent/v1/io_pb";
|
|
94
|
+
import { RenameInputSchema } from "@stigmer/apis/ai/stigmer/commons/apiresource/io_pb";
|
|
95
|
+
|
|
96
|
+
// Create
|
|
97
|
+
const agent = await stigmer.agent.create({
|
|
98
|
+
name: "my-agent",
|
|
99
|
+
org: "my-org",
|
|
100
|
+
description: "Handles customer inquiries",
|
|
101
|
+
instructions: "Be helpful and concise.",
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
// Get by ID
|
|
105
|
+
const agent = await stigmer.agent.get("agent-id");
|
|
106
|
+
|
|
107
|
+
// Get by reference (org + slug)
|
|
108
|
+
const agent = await stigmer.agent.getByReference({
|
|
109
|
+
org: "my-org",
|
|
110
|
+
slug: "my-agent",
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// Update: name the agent by id, give the new values, and name the fields
|
|
114
|
+
// you changed. Every other field keeps its stored value. Sending the etag
|
|
115
|
+
// you read makes the save fail with "aborted" if someone changed the agent
|
|
116
|
+
// since.
|
|
117
|
+
const current = await stigmer.agent.get("agent-id");
|
|
118
|
+
const updated = await stigmer.agent.update(
|
|
119
|
+
{
|
|
120
|
+
metadata: { id: current.metadata?.id, etag: current.metadata?.etag },
|
|
121
|
+
spec: { description: "Updated description" },
|
|
122
|
+
},
|
|
123
|
+
["spec.description"],
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
// Rename: change the slug people type. The id stays, so everything that
|
|
127
|
+
// points at the agent keeps working; the old slug reads for 30 days.
|
|
128
|
+
const renamed = await stigmer.agent.rename(
|
|
129
|
+
create(RenameInputSchema, { resourceId: "agent-id", slug: "support-bot" }),
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
// Delete
|
|
133
|
+
const deleted = await stigmer.agent.delete("agent-id");
|
|
134
|
+
|
|
135
|
+
// List: one page of the org's agents, newest first. A page carries
|
|
136
|
+
// nextPageToken while more follow; pageSize 0 asks for the default 50.
|
|
137
|
+
const page = await stigmer.agent.list(create(ListAgentsRequestSchema, { org: "my-org", pageSize: 20 }));
|
|
138
|
+
const next = await stigmer.agent.list(
|
|
139
|
+
create(ListAgentsRequestSchema, { org: "my-org", pageSize: 20, pageToken: page.nextPageToken }),
|
|
140
|
+
);
|
|
141
|
+
|
|
142
|
+
// Every agent, page after page: listAll follows the tokens.
|
|
143
|
+
for await (const a of stigmer.agent.listAll({ org: "my-org" })) {
|
|
144
|
+
console.log(a.metadata?.slug);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// Only the agents carrying every label given.
|
|
148
|
+
for await (const a of stigmer.agent.listAll({ org: "my-org", labels: { team: "support" } })) {
|
|
149
|
+
console.log(a.metadata?.slug);
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Cross-resource search
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { ApiResourceKind } from "@stigmer/client";
|
|
157
|
+
|
|
158
|
+
const results = await stigmer.search.query({
|
|
159
|
+
kinds: [ApiResourceKind.agent, ApiResourceKind.skill],
|
|
160
|
+
org: "my-org",
|
|
161
|
+
query: "customer support",
|
|
162
|
+
});
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
## Streaming
|
|
166
|
+
|
|
167
|
+
Resources with streaming RPCs return `AsyncGenerator`:
|
|
168
|
+
|
|
169
|
+
```typescript
|
|
170
|
+
for await (const event of stigmer.run.watch("run-id")) {
|
|
171
|
+
console.log(event);
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// With cancellation
|
|
175
|
+
const controller = new AbortController();
|
|
176
|
+
for await (const event of stigmer.run.watch("run-id", controller.signal)) {
|
|
177
|
+
if (shouldStop(event)) {
|
|
178
|
+
controller.abort();
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
## Error Handling
|
|
184
|
+
|
|
185
|
+
All SDK operations throw `StigmerError` with structured error codes:
|
|
186
|
+
|
|
187
|
+
```typescript
|
|
188
|
+
import { StigmerError, isNotFound, isRetryable } from "@stigmer/client";
|
|
189
|
+
|
|
190
|
+
try {
|
|
191
|
+
const agent = await stigmer.agent.get("nonexistent");
|
|
192
|
+
} catch (err) {
|
|
193
|
+
if (isNotFound(err)) {
|
|
194
|
+
console.log("Agent not found");
|
|
195
|
+
} else if (isRetryable(err)) {
|
|
196
|
+
console.log("Transient error, retry later");
|
|
197
|
+
} else if (err instanceof StigmerError) {
|
|
198
|
+
console.log(`Error [${err.code}]: ${err.message}`);
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Error codes: `not-found`, `permission-denied`, `unauthenticated`, `invalid-argument`, `already-exists`, `resource-exhausted`, `failed-precondition`, `internal`, `unavailable`, `cancelled`, `unknown`.
|
|
204
|
+
|
|
205
|
+
## Transport Protocol
|
|
206
|
+
|
|
207
|
+
The SDK supports two transport protocols. Both are supported by the Stigmer server.
|
|
208
|
+
|
|
209
|
+
```typescript
|
|
210
|
+
// gRPC-Web (default) — compact binary protocol
|
|
211
|
+
const stigmer = new Stigmer({
|
|
212
|
+
baseUrl: "https://api.stigmer.ai",
|
|
213
|
+
apiKey: "sk_live_abc123",
|
|
214
|
+
});
|
|
215
|
+
|
|
216
|
+
// Connect protocol — HTTP/JSON, easier to debug with browser devtools
|
|
217
|
+
const stigmer = new Stigmer({
|
|
218
|
+
baseUrl: "https://api.stigmer.ai",
|
|
219
|
+
apiKey: "sk_live_abc123",
|
|
220
|
+
transport: "connect",
|
|
221
|
+
});
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Configuration
|
|
225
|
+
|
|
226
|
+
```typescript
|
|
227
|
+
interface StigmerConfig {
|
|
228
|
+
baseUrl: string;
|
|
229
|
+
apiKey?: string; // Static API key (mutually exclusive with getAccessToken)
|
|
230
|
+
getAccessToken?: () => string | null | Promise<string | null>; // Dynamic token provider
|
|
231
|
+
onUnauthenticated?: () => void; // Called once on UNAUTHENTICATED (code 16)
|
|
232
|
+
transport?: "grpc-web" | "connect"; // Default: "grpc-web"
|
|
233
|
+
executionTarget?: "local" | "cloud"; // Default execution target — see "Local Execution"
|
|
234
|
+
}
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
Exactly one of `apiKey` or `getAccessToken` must be provided.
|
|
238
|
+
|
|
239
|
+
For a CI job or a script, use a [service account's](https://stigmer.ai/docs/guides/authentication/service-accounts) API key, not a person's: it keeps working when that person leaves and works only in its own organization.
|
|
240
|
+
|
|
241
|
+
## Local Execution
|
|
242
|
+
|
|
243
|
+
Agent runs execute in the cloud by default — the Stigmer server provisions a sandbox with a runner. To execute runs on the client (a desktop app, CLI, or self-hosted deployment), set the execution target.
|
|
244
|
+
|
|
245
|
+
### Selecting the target
|
|
246
|
+
|
|
247
|
+
```typescript
|
|
248
|
+
// App-level default for every session
|
|
249
|
+
const stigmer = new Stigmer({
|
|
250
|
+
baseUrl: "https://api.stigmer.ai",
|
|
251
|
+
getAccessToken: () => authStore.getToken(),
|
|
252
|
+
executionTarget: "local", // "local" | "cloud"; omit to let the server decide
|
|
253
|
+
});
|
|
254
|
+
|
|
255
|
+
// A per-call executionTarget takes precedence over the app-level default
|
|
256
|
+
const session = await stigmer.session.create({
|
|
257
|
+
name: "review",
|
|
258
|
+
org: "my-org",
|
|
259
|
+
agentRef: { org: "my-org", slug: "code-reviewer" },
|
|
260
|
+
executionTarget: "cloud",
|
|
261
|
+
});
|
|
262
|
+
```
|
|
263
|
+
|
|
264
|
+
### `RunnerAdapter`
|
|
265
|
+
|
|
266
|
+
For local execution, the client owns the runner lifecycle. `@stigmer/client` exports the `RunnerAdapter` type so non-React hosts (Node scripts, custom frameworks) can implement it:
|
|
267
|
+
|
|
268
|
+
```typescript
|
|
269
|
+
import type { RunnerAdapter } from "@stigmer/client";
|
|
270
|
+
|
|
271
|
+
const adapter: RunnerAdapter = {
|
|
272
|
+
onSessionOpened: async (sessionId) => { /* start a worker for this session */ },
|
|
273
|
+
onSessionClosed: async (sessionId) => { /* stop it */ },
|
|
274
|
+
};
|
|
275
|
+
```
|
|
276
|
+
|
|
277
|
+
If your runner backend already exposes `addSession` / `removeSession` (a `RunnerWorkerHost`) — the in-process `createStigmerRunnerManager`, the desktop's embedded-runner context, or your own API — skip the hand-wiring and let `createRunnerAdapter` build the adapter:
|
|
278
|
+
|
|
279
|
+
```typescript
|
|
280
|
+
import { createRunnerAdapter } from "@stigmer/client";
|
|
281
|
+
|
|
282
|
+
const adapter = createRunnerAdapter(myRunnerHost);
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
A Session has no terminal phase, so its worker is tied to whether the session is **open**: attach on `onSessionOpened`, detach on `onSessionClosed` (and keep both idempotent — `onSessionOpened` may fire again on re-open).
|
|
286
|
+
|
|
287
|
+
The SDK does not invoke these methods on its own in a non-React host — you wire the adapter to your own open/close code paths. In React apps, `@stigmer/react-sdk` does this wiring automatically: pass `executionTarget` and `runnerAdapter` to `StigmerProvider` and the SDK hooks invoke the adapter at the right lifecycle points.
|
|
288
|
+
|
|
289
|
+
See the [`@stigmer/react-sdk` local execution docs](../react/README.md#local-execution) and the [runner embedding guide](https://stigmer.ai/docs/guides/runners/embedding) for the full desktop (local) and web (cloud) walkthrough.
|
|
290
|
+
|
|
291
|
+
## Code Generation
|
|
292
|
+
|
|
293
|
+
The resource clients in `src/gen/` are generated from protobuf service schemas. To regenerate after proto changes:
|
|
294
|
+
|
|
295
|
+
```bash
|
|
296
|
+
cd sdk/typescript
|
|
297
|
+
make codegen
|
|
298
|
+
```
|
|
299
|
+
|
|
300
|
+
Handwritten code lives in `src/` (outside `src/gen/`): `config.ts`, `transport.ts`, `stigmer.ts`, `search.ts`, `index.ts`, and `internal/`.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type AccessHistoryEntry } from "@stigmer/apis/ai/stigmer/iam/grant/v1/io_pb";
|
|
2
|
+
import type { GrantClient } from "./gen/grant.js";
|
|
3
|
+
export type { AccessHistoryEntry };
|
|
4
|
+
/** A run of entries the server removed before the export reached them. */
|
|
5
|
+
export interface RemovedAccessHistory {
|
|
6
|
+
/** The first removed sequence: just after the one the caller holds. */
|
|
7
|
+
readonly first: bigint;
|
|
8
|
+
/** The last removed sequence: just before the oldest the server keeps. */
|
|
9
|
+
readonly last: bigint;
|
|
10
|
+
/** How many days the server keeps the history; 0 when it keeps it for good now. */
|
|
11
|
+
readonly retentionDays: number;
|
|
12
|
+
}
|
|
13
|
+
/** Where an export starts, and what it is told on the way. */
|
|
14
|
+
export interface ExportAccessHistoryOptions {
|
|
15
|
+
/**
|
|
16
|
+
* The last sequence the caller already holds: the export starts just
|
|
17
|
+
* after it. Absent or 0, it starts at the oldest entry the server keeps.
|
|
18
|
+
*/
|
|
19
|
+
readonly after?: bigint;
|
|
20
|
+
/** Stops the export between pages. */
|
|
21
|
+
readonly signal?: AbortSignal;
|
|
22
|
+
/**
|
|
23
|
+
* Called once, before the first entry, when entries after `after` were
|
|
24
|
+
* removed by the server's retention: the export starts after them.
|
|
25
|
+
*/
|
|
26
|
+
readonly onRemoved?: (removed: RemovedAccessHistory) => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Every entry of `org`'s access history after `options.after`, oldest
|
|
30
|
+
* first, following every page until the newest entry.
|
|
31
|
+
*/
|
|
32
|
+
export declare function exportAccessHistory(client: Pick<GrantClient, "listAccessHistory">, org: string, options?: ExportAccessHistoryOptions): AsyncGenerator<AccessHistoryEntry, void, undefined>;
|
|
33
|
+
/** One entry as one JSON Lines line (no trailing newline): its canonical proto JSON. */
|
|
34
|
+
export declare function accessHistoryJsonLine(entry: AccessHistoryEntry): string;
|
|
35
|
+
//# sourceMappingURL=access-history.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-history.d.ts","sourceRoot":"","sources":["src/access-history.ts"],"names":[],"mappings":"AA4BA,OAAO,EAGL,KAAK,kBAAkB,EACxB,MAAM,6CAA6C,CAAC;AAErD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,YAAY,EAAE,kBAAkB,EAAE,CAAC;AAKnC,0EAA0E;AAC1E,MAAM,WAAW,oBAAoB;IACnC,uEAAuE;IACvE,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,0EAA0E;IAC1E,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,mFAAmF;IACnF,QAAQ,CAAC,aAAa,EAAE,MAAM,CAAC;CAChC;AAED,8DAA8D;AAC9D,MAAM,WAAW,0BAA0B;IACzC;;;OAGG;IACH,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,sCAAsC;IACtC,QAAQ,CAAC,MAAM,CAAC,EAAE,WAAW,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,oBAAoB,KAAK,IAAI,CAAC;CAC9D;AAED;;;GAGG;AACH,wBAAuB,mBAAmB,CACxC,MAAM,EAAE,IAAI,CAAC,WAAW,EAAE,mBAAmB,CAAC,EAC9C,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,0BAA+B,GACvC,cAAc,CAAC,kBAAkB,EAAE,IAAI,EAAE,SAAS,CAAC,CA2BrD;AAED,wFAAwF;AACxF,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,kBAAkB,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Exporting an organization's access history: every time someone was
|
|
3
|
+
* given or lost access, who did it, why and when
|
|
4
|
+
* (`GrantClient.listAccessHistory`).
|
|
5
|
+
*
|
|
6
|
+
* The export is the history's follow read: oldest first, strictly after
|
|
7
|
+
* the last entry the caller already holds, every page followed. Each
|
|
8
|
+
* organization numbers its entries from 1 in the order they happened, with
|
|
9
|
+
* no gaps, so a tool that stores the last `sequence` it wrote and asks for
|
|
10
|
+
* what came after it next time never misses an entry the server still
|
|
11
|
+
* keeps.
|
|
12
|
+
*
|
|
13
|
+
* A server may keep the history for a limited time, set by its operator,
|
|
14
|
+
* and remove the oldest entries first. Every page says the oldest number
|
|
15
|
+
* the organization still holds (`oldestSequence`; when every entry was
|
|
16
|
+
* removed, the number its next entry will get) and how many days the
|
|
17
|
+
* server keeps the history (`retentionDays`, 0 for good). When a tool asks
|
|
18
|
+
* after N and the oldest kept entry is above N + 1, the entries between
|
|
19
|
+
* were removed, not missed: `onRemoved` hears that once, before the first
|
|
20
|
+
* entry, so a tool can record the run it will never receive. Whoever may
|
|
21
|
+
* read the history reads all of it, so the numbers have no other gaps.
|
|
22
|
+
*
|
|
23
|
+
* One format for every surface (the CLI's `access-history export`, the
|
|
24
|
+
* console's download): JSON Lines, one entry per line, each line the
|
|
25
|
+
* entry's canonical proto JSON. Proto JSON writes the 64-bit `sequence` as
|
|
26
|
+
* a string ("42"), and enum values by name ("granted", "grant").
|
|
27
|
+
*/
|
|
28
|
+
import { create, toJsonString } from "@bufbuild/protobuf";
|
|
29
|
+
import { AccessHistoryEntrySchema, ListAccessHistoryInputSchema, } from "@stigmer/apis/ai/stigmer/iam/grant/v1/io_pb";
|
|
30
|
+
/** The most entries one page of the history returns. */
|
|
31
|
+
const EXPORT_PAGE_SIZE = 100;
|
|
32
|
+
/**
|
|
33
|
+
* Every entry of `org`'s access history after `options.after`, oldest
|
|
34
|
+
* first, following every page until the newest entry.
|
|
35
|
+
*/
|
|
36
|
+
export async function* exportAccessHistory(client, org, options = {}) {
|
|
37
|
+
const after = options.after ?? BigInt(0);
|
|
38
|
+
let pageToken = "";
|
|
39
|
+
let first = true;
|
|
40
|
+
do {
|
|
41
|
+
options.signal?.throwIfAborted();
|
|
42
|
+
const page = await client.listAccessHistory(create(ListAccessHistoryInputSchema, {
|
|
43
|
+
org,
|
|
44
|
+
afterSequence: after,
|
|
45
|
+
pageSize: EXPORT_PAGE_SIZE,
|
|
46
|
+
pageToken,
|
|
47
|
+
}));
|
|
48
|
+
// Only the first page's oldest number is the one the export started
|
|
49
|
+
// from; a later page's may have moved on while the export ran.
|
|
50
|
+
if (first && page.oldestSequence > after + BigInt(1)) {
|
|
51
|
+
options.onRemoved?.({
|
|
52
|
+
first: after + BigInt(1),
|
|
53
|
+
last: page.oldestSequence - BigInt(1),
|
|
54
|
+
retentionDays: page.retentionDays,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
first = false;
|
|
58
|
+
yield* page.entries;
|
|
59
|
+
pageToken = page.nextPageToken;
|
|
60
|
+
} while (pageToken !== "");
|
|
61
|
+
}
|
|
62
|
+
/** One entry as one JSON Lines line (no trailing newline): its canonical proto JSON. */
|
|
63
|
+
export function accessHistoryJsonLine(entry) {
|
|
64
|
+
return toJsonString(AccessHistoryEntrySchema, entry);
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=access-history.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"access-history.js","sourceRoot":"","sources":["src/access-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAC1D,OAAO,EACL,wBAAwB,EACxB,4BAA4B,GAE7B,MAAM,6CAA6C,CAAC;AAMrD,wDAAwD;AACxD,MAAM,gBAAgB,GAAG,GAAG,CAAC;AA4B7B;;;GAGG;AACH,MAAM,CAAC,KAAK,SAAS,CAAC,CAAC,mBAAmB,CACxC,MAA8C,EAC9C,GAAW,EACX,UAAsC,EAAE;IAExC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC;IACzC,IAAI,SAAS,GAAG,EAAE,CAAC;IACnB,IAAI,KAAK,GAAG,IAAI,CAAC;IACjB,GAAG,CAAC;QACF,OAAO,CAAC,MAAM,EAAE,cAAc,EAAE,CAAC;QACjC,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,iBAAiB,CACzC,MAAM,CAAC,4BAA4B,EAAE;YACnC,GAAG;YACH,aAAa,EAAE,KAAK;YACpB,QAAQ,EAAE,gBAAgB;YAC1B,SAAS;SACV,CAAC,CACH,CAAC;QACF,oEAAoE;QACpE,+DAA+D;QAC/D,IAAI,KAAK,IAAI,IAAI,CAAC,cAAc,GAAG,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;YACrD,OAAO,CAAC,SAAS,EAAE,CAAC;gBAClB,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC;gBACxB,IAAI,EAAE,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,CAAC,CAAC;gBACrC,aAAa,EAAE,IAAI,CAAC,aAAa;aAClC,CAAC,CAAC;QACL,CAAC;QACD,KAAK,GAAG,KAAK,CAAC;QACd,KAAK,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;QACpB,SAAS,GAAG,IAAI,CAAC,aAAa,CAAC;IACjC,CAAC,QAAQ,SAAS,KAAK,EAAE,EAAE;AAC7B,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,qBAAqB,CAAC,KAAyB;IAC7D,OAAO,YAAY,CAAC,wBAAwB,EAAE,KAAK,CAAC,CAAC;AACvD,CAAC"}
|
package/activity.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type Transport } from "@connectrpc/connect";
|
|
2
|
+
import type { RecentActivityEntry } from "@stigmer/apis/ai/stigmer/activity/v1/io_pb";
|
|
3
|
+
export type { RecentActivityEntry };
|
|
4
|
+
/** Parameters for listing recent activity. */
|
|
5
|
+
export interface ListRecentActivityParams {
|
|
6
|
+
/** Maximum entries to return. Defaults to 30. */
|
|
7
|
+
readonly pageSize?: number;
|
|
8
|
+
/** The organization for the org-scoped fast path, by id or slug. */
|
|
9
|
+
readonly org?: string;
|
|
10
|
+
}
|
|
11
|
+
/** Response from listing recent activity. */
|
|
12
|
+
export interface ListRecentActivityResponse {
|
|
13
|
+
readonly entries: RecentActivityEntry[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Client for the unified recent activity query.
|
|
17
|
+
*
|
|
18
|
+
* Returns the caller's most recent sessions, newest activity first,
|
|
19
|
+
* in a single RPC call.
|
|
20
|
+
*/
|
|
21
|
+
export declare class ActivityClient {
|
|
22
|
+
private readonly client;
|
|
23
|
+
constructor(transport: Transport);
|
|
24
|
+
listRecentActivity(params?: ListRecentActivityParams): Promise<ListRecentActivityResponse>;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=activity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.d.ts","sourceRoot":"","sources":["src/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAIhF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AAGtF,YAAY,EAAE,mBAAmB,EAAE,CAAC;AAEpC,8CAA8C;AAC9C,MAAM,WAAW,wBAAwB;IACvC,iDAAiD;IACjD,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;CACvB;AAED,6CAA6C;AAC7C,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,mBAAmB,EAAE,CAAC;CACzC;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;gBAEpD,SAAS,EAAE,SAAS;IAI1B,kBAAkB,CACtB,MAAM,CAAC,EAAE,wBAAwB,GAChC,OAAO,CAAC,0BAA0B,CAAC;CAavC"}
|
package/activity.js
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createClient } from "@connectrpc/connect";
|
|
2
|
+
import { create } from "@bufbuild/protobuf";
|
|
3
|
+
import { ActivityQueryController } from "@stigmer/apis/ai/stigmer/activity/v1/query_pb";
|
|
4
|
+
import { ListRecentActivityRequestSchema } from "@stigmer/apis/ai/stigmer/activity/v1/io_pb";
|
|
5
|
+
import { wrapError } from "./gen/errors.js";
|
|
6
|
+
/**
|
|
7
|
+
* Client for the unified recent activity query.
|
|
8
|
+
*
|
|
9
|
+
* Returns the caller's most recent sessions, newest activity first,
|
|
10
|
+
* in a single RPC call.
|
|
11
|
+
*/
|
|
12
|
+
export class ActivityClient {
|
|
13
|
+
client;
|
|
14
|
+
constructor(transport) {
|
|
15
|
+
this.client = createClient(ActivityQueryController, transport);
|
|
16
|
+
}
|
|
17
|
+
async listRecentActivity(params) {
|
|
18
|
+
try {
|
|
19
|
+
const resp = await this.client.listRecentActivity(create(ListRecentActivityRequestSchema, {
|
|
20
|
+
pageSize: params?.pageSize ?? 30,
|
|
21
|
+
org: params?.org ?? "",
|
|
22
|
+
}));
|
|
23
|
+
return { entries: [...resp.entries] };
|
|
24
|
+
}
|
|
25
|
+
catch (e) {
|
|
26
|
+
throw wrapError(e);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=activity.js.map
|
package/activity.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activity.js","sourceRoot":"","sources":["src/activity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA+B,MAAM,qBAAqB,CAAC;AAChF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,MAAM,+CAA+C,CAAC;AACxF,OAAO,EAAE,+BAA+B,EAAE,MAAM,4CAA4C,CAAC;AAE7F,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAiB5C;;;;;GAKG;AACH,MAAM,OAAO,cAAc;IACR,MAAM,CAAyC;IAEhE,YAAY,SAAoB;QAC9B,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,uBAAuB,EAAE,SAAS,CAAC,CAAC;IACjE,CAAC;IAED,KAAK,CAAC,kBAAkB,CACtB,MAAiC;QAEjC,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAC/C,MAAM,CAAC,+BAA+B,EAAE;gBACtC,QAAQ,EAAE,MAAM,EAAE,QAAQ,IAAI,EAAE;gBAChC,GAAG,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE;aACvB,CAAC,CACH,CAAC;YACF,OAAO,EAAE,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,MAAM,SAAS,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;CACF"}
|