@puku-ai/sdk 4.0.3 → 4.0.5

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.
Files changed (201) hide show
  1. package/README.md +24 -7
  2. package/dist/index.cjs +85 -0
  3. package/dist/vendor/_vendor/partial-json-parser/parser.cjs +225 -0
  4. package/dist/vendor/api-promise.cjs +18 -0
  5. package/dist/vendor/client.cjs +1013 -0
  6. package/dist/vendor/core/api-promise.cjs +80 -0
  7. package/dist/vendor/core/api.cjs +2 -0
  8. package/dist/vendor/core/credentials.cjs +313 -0
  9. package/dist/vendor/core/error.cjs +156 -0
  10. package/dist/vendor/core/middleware.cjs +173 -0
  11. package/dist/vendor/core/pagination.cjs +215 -0
  12. package/dist/vendor/core/resource.cjs +11 -0
  13. package/dist/vendor/core/streaming.cjs +346 -0
  14. package/dist/vendor/core/uploads.cjs +5 -0
  15. package/dist/vendor/error.cjs +18 -0
  16. package/dist/vendor/helpers/beta/environments.cjs +30 -0
  17. package/dist/vendor/helpers/beta/json-schema.cjs +56 -0
  18. package/dist/vendor/helpers/beta/mcp.cjs +418 -0
  19. package/dist/vendor/helpers/beta/memory.cjs +17 -0
  20. package/dist/vendor/helpers/beta/standard-schema.cjs +57 -0
  21. package/dist/vendor/helpers/beta/zod.cjs +88 -0
  22. package/dist/vendor/helpers/index.cjs +7 -0
  23. package/dist/vendor/helpers/json-schema.cjs +36 -0
  24. package/dist/vendor/helpers/zod.cjs +77 -0
  25. package/dist/vendor/index.cjs +54 -0
  26. package/dist/vendor/internal/builtin-types.cjs +3 -0
  27. package/dist/vendor/internal/constants.cjs +12 -0
  28. package/dist/vendor/internal/decoders/jsonl.cjs +40 -0
  29. package/dist/vendor/internal/decoders/line.cjs +109 -0
  30. package/dist/vendor/internal/detect-platform.cjs +159 -0
  31. package/dist/vendor/internal/errors.cjs +42 -0
  32. package/dist/vendor/internal/file-store.cjs +535 -0
  33. package/dist/vendor/internal/headers.cjs +119 -0
  34. package/dist/vendor/internal/message-stream-utils.cjs +33 -0
  35. package/dist/vendor/internal/node.browser.cjs +21 -0
  36. package/dist/vendor/internal/node.cjs +55 -0
  37. package/dist/vendor/internal/parse.cjs +65 -0
  38. package/dist/vendor/internal/qs/formats.cjs +12 -0
  39. package/dist/vendor/internal/qs/index.cjs +13 -0
  40. package/dist/vendor/internal/qs/stringify.cjs +276 -0
  41. package/dist/vendor/internal/qs/types.cjs +2 -0
  42. package/dist/vendor/internal/qs/utils.cjs +229 -0
  43. package/dist/vendor/internal/request-options.cjs +31 -0
  44. package/dist/vendor/internal/request-signal.cjs +49 -0
  45. package/dist/vendor/internal/shim-types.cjs +3 -0
  46. package/dist/vendor/internal/shims.cjs +91 -0
  47. package/dist/vendor/internal/stainless-helper-header.cjs +90 -0
  48. package/dist/vendor/internal/stream-utils.cjs +37 -0
  49. package/dist/vendor/internal/to-file.cjs +95 -0
  50. package/dist/vendor/internal/types.cjs +3 -0
  51. package/dist/vendor/internal/uploads.cjs +148 -0
  52. package/dist/vendor/internal/utils/abort.cjs +24 -0
  53. package/dist/vendor/internal/utils/async-queue.cjs +69 -0
  54. package/dist/vendor/internal/utils/backoff.cjs +43 -0
  55. package/dist/vendor/internal/utils/base64.cjs +37 -0
  56. package/dist/vendor/internal/utils/bytes.cjs +30 -0
  57. package/dist/vendor/internal/utils/env.cjs +21 -0
  58. package/dist/vendor/internal/utils/log.cjs +111 -0
  59. package/dist/vendor/internal/utils/path.cjs +78 -0
  60. package/dist/vendor/internal/utils/promise.cjs +17 -0
  61. package/dist/vendor/internal/utils/query.cjs +41 -0
  62. package/dist/vendor/internal/utils/sleep.cjs +27 -0
  63. package/dist/vendor/internal/utils/time.cjs +7 -0
  64. package/dist/vendor/internal/utils/uuid.cjs +18 -0
  65. package/dist/vendor/internal/utils/values.cjs +125 -0
  66. package/dist/vendor/internal/utils.cjs +24 -0
  67. package/dist/vendor/lib/BetaMessageStream.cjs +665 -0
  68. package/dist/vendor/lib/MessageStream.cjs +612 -0
  69. package/dist/vendor/lib/beta-parser.cjs +78 -0
  70. package/dist/vendor/lib/credentials/credential-chain.cjs +244 -0
  71. package/dist/vendor/lib/credentials/identity-token.cjs +71 -0
  72. package/dist/vendor/lib/credentials/oidc-federation.cjs +81 -0
  73. package/dist/vendor/lib/credentials/token-cache.cjs +113 -0
  74. package/dist/vendor/lib/credentials/types.cjs +267 -0
  75. package/dist/vendor/lib/credentials/user-oauth.cjs +129 -0
  76. package/dist/vendor/lib/credentials.cjs +7 -0
  77. package/dist/vendor/lib/environments/index.cjs +17 -0
  78. package/dist/vendor/lib/environments/poller.cjs +226 -0
  79. package/dist/vendor/lib/environments/worker.cjs +609 -0
  80. package/dist/vendor/lib/helper-client.cjs +57 -0
  81. package/dist/vendor/lib/middleware.cjs +779 -0
  82. package/dist/vendor/lib/parser.cjs +65 -0
  83. package/dist/vendor/lib/sessions/accumulate.cjs +44 -0
  84. package/dist/vendor/lib/standard-schema.cjs +44 -0
  85. package/dist/vendor/lib/tools/BetaRunnableTool.cjs +30 -0
  86. package/dist/vendor/lib/tools/BetaToolRunner.cjs +500 -0
  87. package/dist/vendor/lib/tools/CompactionControl.cjs +27 -0
  88. package/dist/vendor/lib/tools/SessionToolRunner.cjs +740 -0
  89. package/dist/vendor/lib/tools/ToolError.cjs +46 -0
  90. package/dist/vendor/lib/transform-json-schema.cjs +113 -0
  91. package/dist/vendor/pagination.cjs +18 -0
  92. package/dist/vendor/resource.cjs +18 -0
  93. package/dist/vendor/resources/beta/agents/agents.cjs +159 -0
  94. package/dist/vendor/resources/beta/agents/index.cjs +8 -0
  95. package/dist/vendor/resources/beta/agents/versions.cjs +35 -0
  96. package/dist/vendor/resources/beta/agents.cjs +18 -0
  97. package/dist/vendor/resources/beta/beta.cjs +105 -0
  98. package/dist/vendor/resources/beta/deployment-runs.cjs +54 -0
  99. package/dist/vendor/resources/beta/deployments.cjs +195 -0
  100. package/dist/vendor/resources/beta/dreams.cjs +115 -0
  101. package/dist/vendor/resources/beta/environments/environments.cjs +178 -0
  102. package/dist/vendor/resources/beta/environments/index.cjs +8 -0
  103. package/dist/vendor/resources/beta/environments/work.cjs +256 -0
  104. package/dist/vendor/resources/beta/environments.cjs +18 -0
  105. package/dist/vendor/resources/beta/files.cjs +123 -0
  106. package/dist/vendor/resources/beta/index.cjs +38 -0
  107. package/dist/vendor/resources/beta/memory-stores/index.cjs +10 -0
  108. package/dist/vendor/resources/beta/memory-stores/memories.cjs +129 -0
  109. package/dist/vendor/resources/beta/memory-stores/memory-stores.cjs +173 -0
  110. package/dist/vendor/resources/beta/memory-stores/memory-versions.cjs +80 -0
  111. package/dist/vendor/resources/beta/memory-stores.cjs +18 -0
  112. package/dist/vendor/resources/beta/messages/batches.cjs +206 -0
  113. package/dist/vendor/resources/beta/messages/index.cjs +11 -0
  114. package/dist/vendor/resources/beta/messages/messages.cjs +189 -0
  115. package/dist/vendor/resources/beta/messages.cjs +18 -0
  116. package/dist/vendor/resources/beta/models.cjs +59 -0
  117. package/dist/vendor/resources/beta/organization/api-keys.cjs +55 -0
  118. package/dist/vendor/resources/beta/organization/compliance-settings.cjs +51 -0
  119. package/dist/vendor/resources/beta/organization/external-keys.cjs +118 -0
  120. package/dist/vendor/resources/beta/organization/federation/federation.cjs +49 -0
  121. package/dist/vendor/resources/beta/organization/federation/index.cjs +10 -0
  122. package/dist/vendor/resources/beta/organization/federation/issuers.cjs +168 -0
  123. package/dist/vendor/resources/beta/organization/federation/rules/index.cjs +8 -0
  124. package/dist/vendor/resources/beta/organization/federation/rules/rules.cjs +226 -0
  125. package/dist/vendor/resources/beta/organization/federation/rules/workspaces.cjs +113 -0
  126. package/dist/vendor/resources/beta/organization/federation/rules.cjs +18 -0
  127. package/dist/vendor/resources/beta/organization/federation.cjs +18 -0
  128. package/dist/vendor/resources/beta/organization/index.cjs +24 -0
  129. package/dist/vendor/resources/beta/organization/invites.cjs +75 -0
  130. package/dist/vendor/resources/beta/organization/organization.cjs +90 -0
  131. package/dist/vendor/resources/beta/organization/rate-limits.cjs +30 -0
  132. package/dist/vendor/resources/beta/organization/service-accounts/index.cjs +8 -0
  133. package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.cjs +202 -0
  134. package/dist/vendor/resources/beta/organization/service-accounts/workspaces.cjs +124 -0
  135. package/dist/vendor/resources/beta/organization/service-accounts.cjs +18 -0
  136. package/dist/vendor/resources/beta/organization/users.cjs +66 -0
  137. package/dist/vendor/resources/beta/organization/workspaces/index.cjs +12 -0
  138. package/dist/vendor/resources/beta/organization/workspaces/members.cjs +101 -0
  139. package/dist/vendor/resources/beta/organization/workspaces/rate-limits.cjs +33 -0
  140. package/dist/vendor/resources/beta/organization/workspaces/service-accounts.cjs +188 -0
  141. package/dist/vendor/resources/beta/organization/workspaces/workspaces.cjs +140 -0
  142. package/dist/vendor/resources/beta/organization/workspaces.cjs +18 -0
  143. package/dist/vendor/resources/beta/organization.cjs +18 -0
  144. package/dist/vendor/resources/beta/sessions/events.cjs +119 -0
  145. package/dist/vendor/resources/beta/sessions/index.cjs +12 -0
  146. package/dist/vendor/resources/beta/sessions/resources.cjs +131 -0
  147. package/dist/vendor/resources/beta/sessions/sessions.cjs +186 -0
  148. package/dist/vendor/resources/beta/sessions/threads/events.cjs +60 -0
  149. package/dist/vendor/resources/beta/sessions/threads/index.cjs +8 -0
  150. package/dist/vendor/resources/beta/sessions/threads/threads.cjs +116 -0
  151. package/dist/vendor/resources/beta/sessions/threads.cjs +18 -0
  152. package/dist/vendor/resources/beta/sessions.cjs +18 -0
  153. package/dist/vendor/resources/beta/skills/index.cjs +8 -0
  154. package/dist/vendor/resources/beta/skills/skills.cjs +132 -0
  155. package/dist/vendor/resources/beta/skills/versions.cjs +128 -0
  156. package/dist/vendor/resources/beta/skills.cjs +18 -0
  157. package/dist/vendor/resources/beta/tunnels/certificates.cjs +128 -0
  158. package/dist/vendor/resources/beta/tunnels/index.cjs +8 -0
  159. package/dist/vendor/resources/beta/tunnels/tunnels.cjs +209 -0
  160. package/dist/vendor/resources/beta/tunnels.cjs +18 -0
  161. package/dist/vendor/resources/beta/user-profiles.cjs +117 -0
  162. package/dist/vendor/resources/beta/vaults/credentials.cjs +176 -0
  163. package/dist/vendor/resources/beta/vaults/index.cjs +8 -0
  164. package/dist/vendor/resources/beta/vaults/vaults.cjs +177 -0
  165. package/dist/vendor/resources/beta/vaults.cjs +18 -0
  166. package/dist/vendor/resources/beta/webhooks.cjs +32 -0
  167. package/dist/vendor/resources/beta.cjs +18 -0
  168. package/dist/vendor/resources/completions.cjs +22 -0
  169. package/dist/vendor/resources/files.cjs +51 -0
  170. package/dist/vendor/resources/index.cjs +31 -0
  171. package/dist/vendor/resources/messages/batches.cjs +160 -0
  172. package/dist/vendor/resources/messages/index.cjs +8 -0
  173. package/dist/vendor/resources/messages/messages.cjs +159 -0
  174. package/dist/vendor/resources/messages.cjs +18 -0
  175. package/dist/vendor/resources/models.cjs +44 -0
  176. package/dist/vendor/resources/shared.cjs +3 -0
  177. package/dist/vendor/resources/skills/index.cjs +8 -0
  178. package/dist/vendor/resources/skills/skills.cjs +72 -0
  179. package/dist/vendor/resources/skills/versions.cjs +40 -0
  180. package/dist/vendor/resources/skills.cjs +18 -0
  181. package/dist/vendor/resources/top-level.cjs +3 -0
  182. package/dist/vendor/resources.cjs +17 -0
  183. package/dist/vendor/streaming.cjs +18 -0
  184. package/dist/vendor/tools/agent-toolset/fs-util.cjs +193 -0
  185. package/dist/vendor/tools/agent-toolset/memories.cjs +916 -0
  186. package/dist/vendor/tools/agent-toolset/node.browser.cjs +147 -0
  187. package/dist/vendor/tools/agent-toolset/node.cjs +939 -0
  188. package/dist/vendor/tools/agent-toolset/skills.cjs +325 -0
  189. package/dist/vendor/tools/agent-toolset/sync-interval.cjs +28 -0
  190. package/dist/vendor/tools/memory/node.browser.cjs +48 -0
  191. package/dist/vendor/tools/memory/node.cjs +364 -0
  192. package/dist/vendor/uploads.cjs +18 -0
  193. package/dist/vendor/version.cjs +4 -0
  194. package/dist/vendor/version.d.ts +1 -1
  195. package/dist/vendor/version.js +1 -1
  196. package/package.json +12 -13
  197. package/sdk.cjs +0 -14271
  198. package/sdk.cjs.map +0 -149
  199. package/sdk.d.ts +0 -10866
  200. package/sdk.mjs +0 -68
  201. package/sdk.mjs.map +0 -149
@@ -0,0 +1,226 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Rules = void 0;
38
+ const resource_1 = require("../../../../../core/resource");
39
+ const WorkspacesAPI = __importStar(require("./workspaces"));
40
+ const workspaces_1 = require("./workspaces");
41
+ const pagination_1 = require("../../../../../core/pagination");
42
+ const headers_1 = require("../../../../../internal/headers");
43
+ const path_1 = require("../../../../../internal/utils/path");
44
+ class Rules extends resource_1.APIResource {
45
+ workspaces = new WorkspacesAPI.Workspaces(this._client);
46
+ /**
47
+ * **Requires an OAuth access token with the `org:admin` scope**, from
48
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
49
+ * API keys are not accepted. See
50
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
51
+ *
52
+ * Create a federation rule owned by your organization.
53
+ *
54
+ * The referenced issuer and the target service account must already exist in the
55
+ * same organization; invalid references are rejected with a 400 error. The
56
+ * workspace reference is validated. Membership is not checked at rule creation:
57
+ * token exchange resolves a single enabled workspace per call and is rejected
58
+ * unless the target service account is a member of that workspace (it is
59
+ * implicitly a member of the default workspace). Rules on well-known shared
60
+ * issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud, Google) must
61
+ * constrain tenant identity via an identity-bearing claim, a tenant-pinning
62
+ * subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition referencing one
63
+ * of those identity claims (e.g. `claims.repository_owner`). OAuth callers may
64
+ * only manage rules whose `oauth_scope` is `workspace:developer` or
65
+ * `workspace:inference`; other scopes require a Console session.
66
+ *
67
+ * @example
68
+ * ```ts
69
+ * const betaFederationRule =
70
+ * await client.beta.organization.federation.rules.create({
71
+ * issuer_id: 'issuer_id',
72
+ * match: {},
73
+ * name: 'x',
74
+ * oauth_scope: 'x',
75
+ * target: {
76
+ * service_account_id: 'svac_01SDCCSbTxrXDpWc1phhtcfK',
77
+ * type: 'service_account',
78
+ * },
79
+ * });
80
+ * ```
81
+ */
82
+ create(params, options) {
83
+ const { betas, ...body } = params;
84
+ return this._client.post('/v1/organizations/federation_rules?beta=true', {
85
+ body,
86
+ ...options,
87
+ headers: (0, headers_1.buildHeaders)([
88
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
89
+ options?.headers,
90
+ ]),
91
+ });
92
+ }
93
+ /**
94
+ * **Requires an OAuth access token with the `org:admin` scope**, from
95
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
96
+ * API keys are not accepted. See
97
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
98
+ *
99
+ * Retrieve a federation rule by its ID (`fdrl_...`).
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * const betaFederationRule =
104
+ * await client.beta.organization.federation.rules.retrieve(
105
+ * 'federation_rule_id',
106
+ * );
107
+ * ```
108
+ */
109
+ retrieve(federationRuleID, params = {}, options) {
110
+ const { betas } = params ?? {};
111
+ return this._client.get((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
112
+ ...options,
113
+ headers: (0, headers_1.buildHeaders)([
114
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
115
+ options?.headers,
116
+ ]),
117
+ });
118
+ }
119
+ /**
120
+ * **Requires an OAuth access token with the `org:admin` scope**, from
121
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
122
+ * API keys are not accepted. See
123
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
124
+ *
125
+ * Partially update a federation rule.
126
+ *
127
+ * `issuer_id` is immutable. `match` and `target` are replaced as whole objects
128
+ * when set. Referenced service accounts and workspaces must exist in your
129
+ * organization; invalid references are rejected with a 400 error. Archived rules
130
+ * cannot be updated; this returns 400. Create a new rule instead. Rules on
131
+ * well-known shared issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud,
132
+ * Google) must constrain tenant identity via an identity-bearing claim, a
133
+ * tenant-pinning subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition
134
+ * referencing one of those identity claims (e.g. `claims.repository_owner`). On
135
+ * these issuers the requirement is re-checked on every update; if an existing
136
+ * rule's stored match does not yet constrain tenant identity, any update (even a
137
+ * rename or description change) must also supply a conforming `match` in the same
138
+ * request. OAuth callers may only manage rules whose `oauth_scope` is
139
+ * `workspace:developer` or `workspace:inference`; other scopes require a Console
140
+ * session.
141
+ *
142
+ * @example
143
+ * ```ts
144
+ * const betaFederationRule =
145
+ * await client.beta.organization.federation.rules.update(
146
+ * 'federation_rule_id',
147
+ * );
148
+ * ```
149
+ */
150
+ update(federationRuleID, params, options) {
151
+ const { betas, ...body } = params;
152
+ return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
153
+ body,
154
+ ...options,
155
+ headers: (0, headers_1.buildHeaders)([
156
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
157
+ options?.headers,
158
+ ]),
159
+ });
160
+ }
161
+ /**
162
+ * **Requires an OAuth access token with the `org:admin` scope**, from
163
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
164
+ * API keys are not accepted. See
165
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
166
+ *
167
+ * List federation rules in your organization.
168
+ *
169
+ * Optionally filter by issuer with `issuer_id`. Archived rules are excluded unless
170
+ * `include_archived=true`.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * // Automatically fetches more pages as needed.
175
+ * for await (const betaFederationRule of client.beta.organization.federation.rules.list()) {
176
+ * // ...
177
+ * }
178
+ * ```
179
+ */
180
+ list(params = {}, options) {
181
+ const { betas, ...query } = params ?? {};
182
+ return this._client.getAPIList('/v1/organizations/federation_rules?beta=true', (pagination_1.PageCursor), {
183
+ query,
184
+ ...options,
185
+ headers: (0, headers_1.buildHeaders)([
186
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
187
+ options?.headers,
188
+ ]),
189
+ });
190
+ }
191
+ /**
192
+ * **Requires an OAuth access token with the `org:admin` scope**, from
193
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
194
+ * API keys are not accepted. See
195
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
196
+ *
197
+ * Archive a federation rule.
198
+ *
199
+ * Token exchange through this rule stops immediately. Idempotent; re-archiving
200
+ * returns the rule with its original `archived_at`. Archiving clears the rule's
201
+ * workspace targeting (`workspace_id` and `workspace_ids` are emptied). Tokens
202
+ * already minted before archive remain valid until they expire. OAuth callers may
203
+ * only manage rules whose `oauth_scope` is `workspace:developer` or
204
+ * `workspace:inference`; other scopes require a Console session.
205
+ *
206
+ * @example
207
+ * ```ts
208
+ * const betaFederationRule =
209
+ * await client.beta.organization.federation.rules.archive(
210
+ * 'federation_rule_id',
211
+ * );
212
+ * ```
213
+ */
214
+ archive(federationRuleID, params = {}, options) {
215
+ const { betas } = params ?? {};
216
+ return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}/archive?beta=true`, {
217
+ ...options,
218
+ headers: (0, headers_1.buildHeaders)([
219
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
220
+ options?.headers,
221
+ ]),
222
+ });
223
+ }
224
+ }
225
+ exports.Rules = Rules;
226
+ Rules.Workspaces = workspaces_1.Workspaces;
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Workspaces = void 0;
5
+ const resource_1 = require("../../../../../core/resource");
6
+ const pagination_1 = require("../../../../../core/pagination");
7
+ const headers_1 = require("../../../../../internal/headers");
8
+ const path_1 = require("../../../../../internal/utils/path");
9
+ class Workspaces extends resource_1.APIResource {
10
+ /**
11
+ * **Requires an OAuth access token with the `org:admin` scope**, from
12
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
13
+ * API keys are not accepted. See
14
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
15
+ *
16
+ * List workspaces where this federation rule is enabled.
17
+ *
18
+ * Returns all workspace enablements in a single response; the `limit` and `page`
19
+ * parameters are accepted but have no effect, and `next_page` is always `null`.
20
+ * Returns explicit per-workspace enablements only; for rules with
21
+ * `applies_to_all_workspaces` or a legacy single `workspace_id`, check those
22
+ * fields on the rule itself.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * // Automatically fetches more pages as needed.
27
+ * for await (const betaFederationRuleWorkspace of client.beta.organization.federation.rules.workspaces.list(
28
+ * 'federation_rule_id',
29
+ * )) {
30
+ * // ...
31
+ * }
32
+ * ```
33
+ */
34
+ list(federationRuleID, params = {}, options) {
35
+ const { betas, ...query } = params ?? {};
36
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}/workspaces?beta=true`, (pagination_1.PageCursor), {
37
+ query,
38
+ ...options,
39
+ headers: (0, headers_1.buildHeaders)([
40
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
41
+ options?.headers,
42
+ ]),
43
+ });
44
+ }
45
+ /**
46
+ * **Requires an OAuth access token with the `org:admin` scope**, from
47
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
48
+ * API keys are not accepted. See
49
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
50
+ *
51
+ * Enable a federation rule for a workspace.
52
+ *
53
+ * Idempotent; re-enabling returns the existing enablement. The rule and workspace
54
+ * must both belong to your organization. Membership of the rule's target service
55
+ * account in this workspace is not checked at enablement: token exchange into this
56
+ * workspace is rejected unless the target is a member (it is implicitly a member
57
+ * of the default workspace). Archived rules are rejected with 400. OAuth callers
58
+ * may only manage rules whose `oauth_scope` is `workspace:developer` or
59
+ * `workspace:inference`; other scopes require a Console session.
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * const betaFederationRuleWorkspace =
64
+ * await client.beta.organization.federation.rules.workspaces.add(
65
+ * 'federation_rule_id',
66
+ * { workspace_id: 'workspace_id' },
67
+ * );
68
+ * ```
69
+ */
70
+ add(federationRuleID, params, options) {
71
+ const { betas, ...body } = params;
72
+ return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}/workspaces?beta=true`, {
73
+ body,
74
+ ...options,
75
+ headers: (0, headers_1.buildHeaders)([
76
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
77
+ options?.headers,
78
+ ]),
79
+ });
80
+ }
81
+ /**
82
+ * **Requires an OAuth access token with the `org:admin` scope**, from
83
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
84
+ * API keys are not accepted. See
85
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
86
+ *
87
+ * Disable a federation rule for a workspace.
88
+ *
89
+ * Idempotent; succeeds even if the enablement was already removed. OAuth callers
90
+ * may only manage rules whose `oauth_scope` is `workspace:developer` or
91
+ * `workspace:inference`; other scopes require a Console session.
92
+ *
93
+ * @example
94
+ * ```ts
95
+ * const workspace =
96
+ * await client.beta.organization.federation.rules.workspaces.remove(
97
+ * 'workspace_id',
98
+ * { federation_rule_id: 'federation_rule_id' },
99
+ * );
100
+ * ```
101
+ */
102
+ remove(workspaceID, params, options) {
103
+ const { federation_rule_id, betas } = params;
104
+ return this._client.delete((0, path_1.path) `/v1/organizations/federation_rules/${federation_rule_id}/workspaces/${workspaceID}?beta=true`, {
105
+ ...options,
106
+ headers: (0, headers_1.buildHeaders)([
107
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
108
+ options?.headers,
109
+ ]),
110
+ });
111
+ }
112
+ }
113
+ exports.Workspaces = Workspaces;
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./rules/index"), exports);
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
16
+ };
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ __exportStar(require("./federation/index"), exports);
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Workspaces = exports.Users = exports.ServiceAccounts = exports.RateLimits = exports.Organization = exports.Invites = exports.Federation = exports.ExternalKeys = exports.ComplianceSettings = exports.APIKeys = void 0;
5
+ var api_keys_1 = require("./api-keys");
6
+ Object.defineProperty(exports, "APIKeys", { enumerable: true, get: function () { return api_keys_1.APIKeys; } });
7
+ var compliance_settings_1 = require("./compliance-settings");
8
+ Object.defineProperty(exports, "ComplianceSettings", { enumerable: true, get: function () { return compliance_settings_1.ComplianceSettings; } });
9
+ var external_keys_1 = require("./external-keys");
10
+ Object.defineProperty(exports, "ExternalKeys", { enumerable: true, get: function () { return external_keys_1.ExternalKeys; } });
11
+ var index_1 = require("./federation/index");
12
+ Object.defineProperty(exports, "Federation", { enumerable: true, get: function () { return index_1.Federation; } });
13
+ var invites_1 = require("./invites");
14
+ Object.defineProperty(exports, "Invites", { enumerable: true, get: function () { return invites_1.Invites; } });
15
+ var organization_1 = require("./organization");
16
+ Object.defineProperty(exports, "Organization", { enumerable: true, get: function () { return organization_1.Organization; } });
17
+ var rate_limits_1 = require("./rate-limits");
18
+ Object.defineProperty(exports, "RateLimits", { enumerable: true, get: function () { return rate_limits_1.RateLimits; } });
19
+ var index_2 = require("./service-accounts/index");
20
+ Object.defineProperty(exports, "ServiceAccounts", { enumerable: true, get: function () { return index_2.ServiceAccounts; } });
21
+ var users_1 = require("./users");
22
+ Object.defineProperty(exports, "Users", { enumerable: true, get: function () { return users_1.Users; } });
23
+ var index_3 = require("./workspaces/index");
24
+ Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return index_3.Workspaces; } });
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Invites = void 0;
5
+ const resource_1 = require("../../../core/resource");
6
+ const pagination_1 = require("../../../core/pagination");
7
+ const path_1 = require("../../../internal/utils/path");
8
+ class Invites extends resource_1.APIResource {
9
+ /**
10
+ * Invite a user to join the organization by email.
11
+ *
12
+ * On plans that draw members from a finite pool of purchased seats, the invite
13
+ * automatically consumes a seat from the lowest tier with availability; there is
14
+ * no seat-tier parameter. When no seat is free the request fails with a 400 error
15
+ * rather than purchasing a seat.
16
+ *
17
+ * @example
18
+ * ```ts
19
+ * const betaOrganizationInvite =
20
+ * await client.beta.organization.invites.create({
21
+ * email: 'user@emaildomain.com',
22
+ * role: 'user',
23
+ * });
24
+ * ```
25
+ */
26
+ create(body, options) {
27
+ return this._client.post('/v1/organizations/invites?beta=true', { body, ...options });
28
+ }
29
+ /**
30
+ * Retrieve an invite by ID.
31
+ *
32
+ * @example
33
+ * ```ts
34
+ * const betaOrganizationInvite =
35
+ * await client.beta.organization.invites.retrieve(
36
+ * 'invite_id',
37
+ * );
38
+ * ```
39
+ */
40
+ retrieve(inviteID, options) {
41
+ return this._client.get((0, path_1.path) `/v1/organizations/invites/${inviteID}?beta=true`, options);
42
+ }
43
+ /**
44
+ * List the organization's invites.
45
+ *
46
+ * @example
47
+ * ```ts
48
+ * // Automatically fetches more pages as needed.
49
+ * for await (const betaOrganizationInvite of client.beta.organization.invites.list()) {
50
+ * // ...
51
+ * }
52
+ * ```
53
+ */
54
+ list(query = {}, options) {
55
+ return this._client.getAPIList('/v1/organizations/invites?beta=true', (pagination_1.Page), {
56
+ query,
57
+ ...options,
58
+ });
59
+ }
60
+ /**
61
+ * Delete a pending invite.
62
+ *
63
+ * @example
64
+ * ```ts
65
+ * const invite =
66
+ * await client.beta.organization.invites.delete(
67
+ * 'invite_id',
68
+ * );
69
+ * ```
70
+ */
71
+ delete(inviteID, options) {
72
+ return this._client.delete((0, path_1.path) `/v1/organizations/invites/${inviteID}?beta=true`, options);
73
+ }
74
+ }
75
+ exports.Invites = Invites;
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
4
+ if (k2 === undefined) k2 = k;
5
+ var desc = Object.getOwnPropertyDescriptor(m, k);
6
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
7
+ desc = { enumerable: true, get: function() { return m[k]; } };
8
+ }
9
+ Object.defineProperty(o, k2, desc);
10
+ }) : (function(o, m, k, k2) {
11
+ if (k2 === undefined) k2 = k;
12
+ o[k2] = m[k];
13
+ }));
14
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
15
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
16
+ }) : function(o, v) {
17
+ o["default"] = v;
18
+ });
19
+ var __importStar = (this && this.__importStar) || (function () {
20
+ var ownKeys = function(o) {
21
+ ownKeys = Object.getOwnPropertyNames || function (o) {
22
+ var ar = [];
23
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
24
+ return ar;
25
+ };
26
+ return ownKeys(o);
27
+ };
28
+ return function (mod) {
29
+ if (mod && mod.__esModule) return mod;
30
+ var result = {};
31
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
32
+ __setModuleDefault(result, mod);
33
+ return result;
34
+ };
35
+ })();
36
+ Object.defineProperty(exports, "__esModule", { value: true });
37
+ exports.Organization = void 0;
38
+ const resource_1 = require("../../../core/resource");
39
+ const APIKeysAPI = __importStar(require("./api-keys"));
40
+ const api_keys_1 = require("./api-keys");
41
+ const ComplianceSettingsAPI = __importStar(require("./compliance-settings"));
42
+ const compliance_settings_1 = require("./compliance-settings");
43
+ const ExternalKeysAPI = __importStar(require("./external-keys"));
44
+ const external_keys_1 = require("./external-keys");
45
+ const InvitesAPI = __importStar(require("./invites"));
46
+ const invites_1 = require("./invites");
47
+ const RateLimitsAPI = __importStar(require("./rate-limits"));
48
+ const rate_limits_1 = require("./rate-limits");
49
+ const UsersAPI = __importStar(require("./users"));
50
+ const users_1 = require("./users");
51
+ const FederationAPI = __importStar(require("./federation/federation"));
52
+ const federation_1 = require("./federation/federation");
53
+ const ServiceAccountsAPI = __importStar(require("./service-accounts/service-accounts"));
54
+ const service_accounts_1 = require("./service-accounts/service-accounts");
55
+ const WorkspacesAPI = __importStar(require("./workspaces/workspaces"));
56
+ const workspaces_1 = require("./workspaces/workspaces");
57
+ class Organization extends resource_1.APIResource {
58
+ apiKeys = new APIKeysAPI.APIKeys(this._client);
59
+ externalKeys = new ExternalKeysAPI.ExternalKeys(this._client);
60
+ federation = new FederationAPI.Federation(this._client);
61
+ invites = new InvitesAPI.Invites(this._client);
62
+ serviceAccounts = new ServiceAccountsAPI.ServiceAccounts(this._client);
63
+ users = new UsersAPI.Users(this._client);
64
+ workspaces = new WorkspacesAPI.Workspaces(this._client);
65
+ rateLimits = new RateLimitsAPI.RateLimits(this._client);
66
+ complianceSettings = new ComplianceSettingsAPI.ComplianceSettings(this._client);
67
+ /**
68
+ * Retrieve information about the organization associated with the authenticated
69
+ * API key.
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const betaOrganization =
74
+ * await client.beta.organization.retrieve();
75
+ * ```
76
+ */
77
+ retrieve(options) {
78
+ return this._client.get('/v1/organizations/me?beta=true', options);
79
+ }
80
+ }
81
+ exports.Organization = Organization;
82
+ Organization.APIKeys = api_keys_1.APIKeys;
83
+ Organization.ExternalKeys = external_keys_1.ExternalKeys;
84
+ Organization.Federation = federation_1.Federation;
85
+ Organization.Invites = invites_1.Invites;
86
+ Organization.ServiceAccounts = service_accounts_1.ServiceAccounts;
87
+ Organization.Users = users_1.Users;
88
+ Organization.Workspaces = workspaces_1.Workspaces;
89
+ Organization.RateLimits = rate_limits_1.RateLimits;
90
+ Organization.ComplianceSettings = compliance_settings_1.ComplianceSettings;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.RateLimits = void 0;
5
+ const resource_1 = require("../../../core/resource");
6
+ const pagination_1 = require("../../../core/pagination");
7
+ class RateLimits extends resource_1.APIResource {
8
+ /**
9
+ * List Messages API rate limits for your organization.
10
+ *
11
+ * Each entry corresponds to one rate-limit group (either a model family or an
12
+ * API-surface category such as the Files API or Message Batches) and contains the
13
+ * set of limiter values that apply to it.
14
+ *
15
+ * When `limit` is omitted, every matching entry is returned in a single page; when
16
+ * `limit` truncates the result, follow `next_page` to fetch the remaining entries.
17
+ *
18
+ * @example
19
+ * ```ts
20
+ * // Automatically fetches more pages as needed.
21
+ * for await (const betaOrganizationRateLimit of client.beta.organization.rateLimits.list()) {
22
+ * // ...
23
+ * }
24
+ * ```
25
+ */
26
+ list(query = {}, options) {
27
+ return this._client.getAPIList('/v1/organizations/rate_limits?beta=true', (pagination_1.PageCursor), { query, ...options });
28
+ }
29
+ }
30
+ exports.RateLimits = RateLimits;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.Workspaces = exports.ServiceAccounts = void 0;
5
+ var service_accounts_1 = require("./service-accounts");
6
+ Object.defineProperty(exports, "ServiceAccounts", { enumerable: true, get: function () { return service_accounts_1.ServiceAccounts; } });
7
+ var workspaces_1 = require("./workspaces");
8
+ Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_1.Workspaces; } });