@anthropic-ai/sdk 0.125.0 → 0.126.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (297) hide show
  1. package/CHANGELOG.md +50 -0
  2. package/client.d.mts +2 -2
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +2 -2
  5. package/client.d.ts.map +1 -1
  6. package/client.js +846 -840
  7. package/client.js.map +1 -1
  8. package/client.mjs +846 -834
  9. package/client.mjs.map +1 -1
  10. package/core/api-promise.js +71 -68
  11. package/core/api-promise.js.map +1 -1
  12. package/core/api-promise.mjs +71 -64
  13. package/core/api-promise.mjs.map +1 -1
  14. package/core/error.js +5 -2
  15. package/core/error.js.map +1 -1
  16. package/core/error.mjs +5 -2
  17. package/core/error.mjs.map +1 -1
  18. package/core/pagination.js +56 -50
  19. package/core/pagination.js.map +1 -1
  20. package/core/pagination.mjs +56 -41
  21. package/core/pagination.mjs.map +1 -1
  22. package/core/streaming.js +212 -209
  23. package/core/streaming.js.map +1 -1
  24. package/core/streaming.mjs +212 -209
  25. package/core/streaming.mjs.map +1 -1
  26. package/helpers/beta/mcp.js +14 -19
  27. package/helpers/beta/mcp.js.map +1 -1
  28. package/helpers/beta/mcp.mjs +14 -13
  29. package/helpers/beta/mcp.mjs.map +1 -1
  30. package/internal/constants.js +1 -1
  31. package/internal/constants.js.map +1 -1
  32. package/internal/decoders/jsonl.js +27 -24
  33. package/internal/decoders/jsonl.js.map +1 -1
  34. package/internal/decoders/jsonl.mjs +27 -24
  35. package/internal/decoders/jsonl.mjs.map +1 -1
  36. package/internal/decoders/line.js +52 -49
  37. package/internal/decoders/line.js.map +1 -1
  38. package/internal/decoders/line.mjs +52 -43
  39. package/internal/decoders/line.mjs.map +1 -1
  40. package/internal/file-store.js +256 -258
  41. package/internal/file-store.js.map +1 -1
  42. package/internal/file-store.mjs +256 -243
  43. package/internal/file-store.mjs.map +1 -1
  44. package/internal/node.browser.d.mts.map +1 -1
  45. package/internal/node.browser.d.ts.map +1 -1
  46. package/internal/node.browser.js.map +1 -1
  47. package/internal/node.browser.mjs +7 -7
  48. package/internal/node.browser.mjs.map +1 -1
  49. package/internal/shim-types.js +0 -6
  50. package/internal/shim-types.js.map +1 -1
  51. package/internal/shim-types.mjs +0 -6
  52. package/internal/shim-types.mjs.map +1 -1
  53. package/internal/shims.js +0 -6
  54. package/internal/shims.js.map +1 -1
  55. package/internal/shims.mjs +0 -6
  56. package/internal/shims.mjs.map +1 -1
  57. package/internal/stainless-helper-header.js +6 -6
  58. package/internal/stainless-helper-header.js.map +1 -1
  59. package/internal/utils/async-queue.js +66 -63
  60. package/internal/utils/async-queue.js.map +1 -1
  61. package/internal/utils/async-queue.mjs +66 -56
  62. package/internal/utils/async-queue.mjs.map +1 -1
  63. package/internal/utils/bytes.d.mts +1 -1
  64. package/internal/utils/bytes.d.mts.map +1 -1
  65. package/internal/utils/bytes.d.ts +1 -1
  66. package/internal/utils/bytes.d.ts.map +1 -1
  67. package/lib/BetaMessageStream.js +593 -590
  68. package/lib/BetaMessageStream.js.map +1 -1
  69. package/lib/BetaMessageStream.mjs +593 -590
  70. package/lib/BetaMessageStream.mjs.map +1 -1
  71. package/lib/MessageStream.js +544 -541
  72. package/lib/MessageStream.js.map +1 -1
  73. package/lib/MessageStream.mjs +544 -541
  74. package/lib/MessageStream.mjs.map +1 -1
  75. package/lib/environments/poller.js +180 -174
  76. package/lib/environments/poller.js.map +1 -1
  77. package/lib/environments/poller.mjs +180 -153
  78. package/lib/environments/poller.mjs.map +1 -1
  79. package/lib/environments/worker.js +375 -369
  80. package/lib/environments/worker.js.map +1 -1
  81. package/lib/environments/worker.mjs +374 -329
  82. package/lib/environments/worker.mjs.map +1 -1
  83. package/lib/tools/BetaToolRunner.js +316 -313
  84. package/lib/tools/BetaToolRunner.js.map +1 -1
  85. package/lib/tools/BetaToolRunner.mjs +315 -306
  86. package/lib/tools/BetaToolRunner.mjs.map +1 -1
  87. package/lib/tools/SessionToolRunner.js +241 -235
  88. package/lib/tools/SessionToolRunner.js.map +1 -1
  89. package/lib/tools/SessionToolRunner.mjs +241 -192
  90. package/lib/tools/SessionToolRunner.mjs.map +1 -1
  91. package/lib/tools/ToolError.js +39 -36
  92. package/lib/tools/ToolError.js.map +1 -1
  93. package/lib/tools/ToolError.mjs +39 -13
  94. package/lib/tools/ToolError.mjs.map +1 -1
  95. package/package.json +3 -3
  96. package/resources/beta/agents/agents.js +135 -132
  97. package/resources/beta/agents/agents.js.map +1 -1
  98. package/resources/beta/agents/agents.mjs +135 -132
  99. package/resources/beta/agents/agents.mjs.map +1 -1
  100. package/resources/beta/beta.d.mts +5 -5
  101. package/resources/beta/beta.d.mts.map +1 -1
  102. package/resources/beta/beta.d.ts +5 -5
  103. package/resources/beta/beta.d.ts.map +1 -1
  104. package/resources/beta/beta.js +39 -36
  105. package/resources/beta/beta.js.map +1 -1
  106. package/resources/beta/beta.mjs +39 -36
  107. package/resources/beta/beta.mjs.map +1 -1
  108. package/resources/beta/dreams.d.mts +2 -28
  109. package/resources/beta/dreams.d.mts.map +1 -1
  110. package/resources/beta/dreams.d.ts +2 -28
  111. package/resources/beta/dreams.d.ts.map +1 -1
  112. package/resources/beta/environments/environments.js +157 -154
  113. package/resources/beta/environments/environments.js.map +1 -1
  114. package/resources/beta/environments/environments.mjs +157 -154
  115. package/resources/beta/environments/environments.mjs.map +1 -1
  116. package/resources/beta/environments/work.js +255 -252
  117. package/resources/beta/environments/work.js.map +1 -1
  118. package/resources/beta/environments/work.mjs +255 -252
  119. package/resources/beta/environments/work.mjs.map +1 -1
  120. package/resources/beta/index.d.mts +2 -2
  121. package/resources/beta/index.d.mts.map +1 -1
  122. package/resources/beta/index.d.ts +2 -2
  123. package/resources/beta/index.d.ts.map +1 -1
  124. package/resources/beta/index.js.map +1 -1
  125. package/resources/beta/index.mjs.map +1 -1
  126. package/resources/beta/memory-stores/memory-stores.js +150 -147
  127. package/resources/beta/memory-stores/memory-stores.js.map +1 -1
  128. package/resources/beta/memory-stores/memory-stores.mjs +150 -147
  129. package/resources/beta/memory-stores/memory-stores.mjs.map +1 -1
  130. package/resources/beta/messages/batches.d.mts +12 -1
  131. package/resources/beta/messages/batches.d.mts.map +1 -1
  132. package/resources/beta/messages/batches.d.ts +12 -1
  133. package/resources/beta/messages/batches.d.ts.map +1 -1
  134. package/resources/beta/messages/index.d.mts +1 -1
  135. package/resources/beta/messages/index.d.mts.map +1 -1
  136. package/resources/beta/messages/index.d.ts +1 -1
  137. package/resources/beta/messages/index.d.ts.map +1 -1
  138. package/resources/beta/messages/index.js.map +1 -1
  139. package/resources/beta/messages/index.mjs.map +1 -1
  140. package/resources/beta/messages/messages.d.mts +238 -100
  141. package/resources/beta/messages/messages.d.mts.map +1 -1
  142. package/resources/beta/messages/messages.d.ts +238 -100
  143. package/resources/beta/messages/messages.d.ts.map +1 -1
  144. package/resources/beta/messages/messages.js +113 -110
  145. package/resources/beta/messages/messages.js.map +1 -1
  146. package/resources/beta/messages/messages.mjs +113 -110
  147. package/resources/beta/messages/messages.mjs.map +1 -1
  148. package/resources/beta/models.d.mts +22 -1
  149. package/resources/beta/models.d.mts.map +1 -1
  150. package/resources/beta/models.d.ts +22 -1
  151. package/resources/beta/models.d.ts.map +1 -1
  152. package/resources/beta/organization/federation/federation.js +11 -8
  153. package/resources/beta/organization/federation/federation.js.map +1 -1
  154. package/resources/beta/organization/federation/federation.mjs +11 -8
  155. package/resources/beta/organization/federation/federation.mjs.map +1 -1
  156. package/resources/beta/organization/federation/rules/rules.js +187 -184
  157. package/resources/beta/organization/federation/rules/rules.js.map +1 -1
  158. package/resources/beta/organization/federation/rules/rules.mjs +187 -184
  159. package/resources/beta/organization/federation/rules/rules.mjs.map +1 -1
  160. package/resources/beta/organization/organization.js +38 -35
  161. package/resources/beta/organization/organization.js.map +1 -1
  162. package/resources/beta/organization/organization.mjs +38 -35
  163. package/resources/beta/organization/organization.mjs.map +1 -1
  164. package/resources/beta/organization/service-accounts/service-accounts.js +163 -160
  165. package/resources/beta/organization/service-accounts/service-accounts.js.map +1 -1
  166. package/resources/beta/organization/service-accounts/service-accounts.mjs +163 -160
  167. package/resources/beta/organization/service-accounts/service-accounts.mjs.map +1 -1
  168. package/resources/beta/organization/workspaces/workspaces.d.mts +3 -3
  169. package/resources/beta/organization/workspaces/workspaces.d.mts.map +1 -1
  170. package/resources/beta/organization/workspaces/workspaces.d.ts +3 -3
  171. package/resources/beta/organization/workspaces/workspaces.d.ts.map +1 -1
  172. package/resources/beta/organization/workspaces/workspaces.js +97 -94
  173. package/resources/beta/organization/workspaces/workspaces.js.map +1 -1
  174. package/resources/beta/organization/workspaces/workspaces.mjs +97 -94
  175. package/resources/beta/organization/workspaces/workspaces.mjs.map +1 -1
  176. package/resources/beta/sessions/events.d.mts +12 -21
  177. package/resources/beta/sessions/events.d.mts.map +1 -1
  178. package/resources/beta/sessions/events.d.ts +12 -21
  179. package/resources/beta/sessions/events.d.ts.map +1 -1
  180. package/resources/beta/sessions/events.js +118 -115
  181. package/resources/beta/sessions/events.js.map +1 -1
  182. package/resources/beta/sessions/events.mjs +118 -115
  183. package/resources/beta/sessions/events.mjs.map +1 -1
  184. package/resources/beta/sessions/resources.d.mts +0 -3
  185. package/resources/beta/sessions/resources.d.mts.map +1 -1
  186. package/resources/beta/sessions/resources.d.ts +0 -3
  187. package/resources/beta/sessions/resources.d.ts.map +1 -1
  188. package/resources/beta/sessions/sessions.d.mts +2 -2
  189. package/resources/beta/sessions/sessions.d.ts +2 -2
  190. package/resources/beta/sessions/sessions.js +161 -158
  191. package/resources/beta/sessions/sessions.js.map +1 -1
  192. package/resources/beta/sessions/sessions.mjs +161 -158
  193. package/resources/beta/sessions/sessions.mjs.map +1 -1
  194. package/resources/beta/sessions/threads/threads.js +86 -83
  195. package/resources/beta/sessions/threads/threads.js.map +1 -1
  196. package/resources/beta/sessions/threads/threads.mjs +86 -83
  197. package/resources/beta/sessions/threads/threads.mjs.map +1 -1
  198. package/resources/beta/skills/skills.js +104 -101
  199. package/resources/beta/skills/skills.js.map +1 -1
  200. package/resources/beta/skills/skills.mjs +104 -101
  201. package/resources/beta/skills/skills.mjs.map +1 -1
  202. package/resources/beta/tunnels/tunnels.js +188 -185
  203. package/resources/beta/tunnels/tunnels.js.map +1 -1
  204. package/resources/beta/tunnels/tunnels.mjs +188 -185
  205. package/resources/beta/tunnels/tunnels.mjs.map +1 -1
  206. package/resources/beta/user-profiles.d.mts +45 -0
  207. package/resources/beta/user-profiles.d.mts.map +1 -1
  208. package/resources/beta/user-profiles.d.ts +45 -0
  209. package/resources/beta/user-profiles.d.ts.map +1 -1
  210. package/resources/beta/user-profiles.js +25 -10
  211. package/resources/beta/user-profiles.js.map +1 -1
  212. package/resources/beta/user-profiles.mjs +25 -10
  213. package/resources/beta/user-profiles.mjs.map +1 -1
  214. package/resources/beta/vaults/credentials.d.mts +0 -14
  215. package/resources/beta/vaults/credentials.d.mts.map +1 -1
  216. package/resources/beta/vaults/credentials.d.ts +0 -14
  217. package/resources/beta/vaults/credentials.d.ts.map +1 -1
  218. package/resources/beta/vaults/vaults.js +156 -153
  219. package/resources/beta/vaults/vaults.js.map +1 -1
  220. package/resources/beta/vaults/vaults.mjs +156 -153
  221. package/resources/beta/vaults/vaults.mjs.map +1 -1
  222. package/resources/completions.d.mts +1 -1
  223. package/resources/completions.d.ts +1 -1
  224. package/resources/index.d.mts +1 -1
  225. package/resources/index.d.mts.map +1 -1
  226. package/resources/index.d.ts +1 -1
  227. package/resources/index.d.ts.map +1 -1
  228. package/resources/index.js.map +1 -1
  229. package/resources/index.mjs.map +1 -1
  230. package/resources/messages/index.d.mts +1 -1
  231. package/resources/messages/index.d.mts.map +1 -1
  232. package/resources/messages/index.d.ts +1 -1
  233. package/resources/messages/index.d.ts.map +1 -1
  234. package/resources/messages/index.js.map +1 -1
  235. package/resources/messages/index.mjs.map +1 -1
  236. package/resources/messages/messages.d.mts +100 -63
  237. package/resources/messages/messages.d.mts.map +1 -1
  238. package/resources/messages/messages.d.ts +100 -63
  239. package/resources/messages/messages.d.ts.map +1 -1
  240. package/resources/messages/messages.js +115 -112
  241. package/resources/messages/messages.js.map +1 -1
  242. package/resources/messages/messages.mjs +115 -112
  243. package/resources/messages/messages.mjs.map +1 -1
  244. package/resources/skills/skills.js +88 -85
  245. package/resources/skills/skills.js.map +1 -1
  246. package/resources/skills/skills.mjs +88 -85
  247. package/resources/skills/skills.mjs.map +1 -1
  248. package/resources/top-level.js +0 -1
  249. package/resources/top-level.js.map +1 -1
  250. package/resources/top-level.mjs +0 -1
  251. package/resources/top-level.mjs.map +1 -1
  252. package/src/client.ts +13 -1
  253. package/src/internal/node.browser.ts +7 -7
  254. package/src/internal/utils/bytes.ts +1 -1
  255. package/src/resources/beta/beta.ts +24 -1
  256. package/src/resources/beta/dreams.ts +2 -28
  257. package/src/resources/beta/index.ts +11 -0
  258. package/src/resources/beta/messages/batches.ts +13 -1
  259. package/src/resources/beta/messages/index.ts +10 -0
  260. package/src/resources/beta/messages/messages.ts +288 -99
  261. package/src/resources/beta/models.ts +25 -0
  262. package/src/resources/beta/organization/workspaces/workspaces.ts +3 -3
  263. package/src/resources/beta/sessions/events.ts +12 -21
  264. package/src/resources/beta/sessions/resources.ts +0 -3
  265. package/src/resources/beta/sessions/sessions.ts +2 -2
  266. package/src/resources/beta/user-profiles.ts +75 -10
  267. package/src/resources/beta/vaults/credentials.ts +0 -14
  268. package/src/resources/completions.ts +1 -1
  269. package/src/resources/index.ts +6 -0
  270. package/src/resources/messages/index.ts +6 -0
  271. package/src/resources/messages/messages.ts +128 -62
  272. package/src/tsconfig.json +13 -3
  273. package/src/version.ts +1 -1
  274. package/tools/agent-toolset/fs-util.js +0 -6
  275. package/tools/agent-toolset/fs-util.js.map +1 -1
  276. package/tools/agent-toolset/fs-util.mjs +0 -6
  277. package/tools/agent-toolset/fs-util.mjs.map +1 -1
  278. package/tools/agent-toolset/memories.js +4 -4
  279. package/tools/agent-toolset/memories.js.map +1 -1
  280. package/tools/agent-toolset/memories.mjs +2 -2
  281. package/tools/agent-toolset/memories.mjs.map +1 -1
  282. package/tools/agent-toolset/node.browser.js +12 -12
  283. package/tools/agent-toolset/node.browser.js.map +1 -1
  284. package/tools/agent-toolset/node.js +142 -139
  285. package/tools/agent-toolset/node.js.map +1 -1
  286. package/tools/agent-toolset/node.mjs +132 -125
  287. package/tools/agent-toolset/node.mjs.map +1 -1
  288. package/tools/agent-toolset/skills.js +5 -5
  289. package/tools/agent-toolset/skills.js.map +1 -1
  290. package/tools/agent-toolset/sync-interval.js +3 -3
  291. package/tools/agent-toolset/sync-interval.js.map +1 -1
  292. package/tools/memory/node.browser.js +2 -2
  293. package/tools/memory/node.browser.js.map +1 -1
  294. package/version.d.mts +1 -1
  295. package/version.d.ts +1 -1
  296. package/version.js +1 -1
  297. package/version.mjs +1 -1
@@ -8,190 +8,193 @@ const workspaces_1 = require("./workspaces.js");
8
8
  const pagination_1 = require("../../../../../core/pagination.js");
9
9
  const headers_1 = require("../../../../../internal/headers.js");
10
10
  const path_1 = require("../../../../../internal/utils/path.js");
11
- class Rules extends resource_1.APIResource {
12
- constructor() {
13
- super(...arguments);
14
- this.workspaces = new WorkspacesAPI.Workspaces(this._client);
11
+ var Rules = /* @__PURE__ */ (() => {
12
+ class Rules extends resource_1.APIResource {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.workspaces = new WorkspacesAPI.Workspaces(this._client);
16
+ }
17
+ /**
18
+ * **Requires an OAuth access token with the `org:admin` scope**, from
19
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
20
+ * API keys are not accepted. See
21
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
22
+ *
23
+ * Create a federation rule owned by your organization.
24
+ *
25
+ * The referenced issuer and the target service account must already exist in the
26
+ * same organization; invalid references are rejected with a 400 error. The
27
+ * workspace reference is validated. Membership is not checked at rule creation:
28
+ * token exchange resolves a single enabled workspace per call and is rejected
29
+ * unless the target service account is a member of that workspace (it is
30
+ * implicitly a member of the default workspace). Rules on well-known shared
31
+ * issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud, Google) must
32
+ * constrain tenant identity via an identity-bearing claim, a tenant-pinning
33
+ * subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition referencing one
34
+ * of those identity claims (e.g. `claims.repository_owner`). OAuth callers may
35
+ * only manage rules whose `oauth_scope` is `workspace:developer` or
36
+ * `workspace:inference`; other scopes require a Console session.
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const betaFederationRule =
41
+ * await client.beta.organization.federation.rules.create({
42
+ * issuer_id: 'issuer_id',
43
+ * match: {},
44
+ * name: 'x',
45
+ * oauth_scope: 'x',
46
+ * target: {
47
+ * service_account_id: 'svac_01SDCCSbTxrXDpWc1phhtcfK',
48
+ * type: 'service_account',
49
+ * },
50
+ * });
51
+ * ```
52
+ */
53
+ create(params, options) {
54
+ const { betas, ...body } = params;
55
+ return this._client.post('/v1/organizations/federation_rules?beta=true', {
56
+ body,
57
+ ...options,
58
+ headers: (0, headers_1.buildHeaders)([
59
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
60
+ options?.headers,
61
+ ]),
62
+ });
63
+ }
64
+ /**
65
+ * **Requires an OAuth access token with the `org:admin` scope**, from
66
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
67
+ * API keys are not accepted. See
68
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
69
+ *
70
+ * Retrieve a federation rule by its ID (`fdrl_...`).
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const betaFederationRule =
75
+ * await client.beta.organization.federation.rules.retrieve(
76
+ * 'federation_rule_id',
77
+ * );
78
+ * ```
79
+ */
80
+ retrieve(federationRuleID, params = {}, options) {
81
+ const { betas } = params ?? {};
82
+ return this._client.get((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
83
+ ...options,
84
+ headers: (0, headers_1.buildHeaders)([
85
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
86
+ options?.headers,
87
+ ]),
88
+ });
89
+ }
90
+ /**
91
+ * **Requires an OAuth access token with the `org:admin` scope**, from
92
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
93
+ * API keys are not accepted. See
94
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
95
+ *
96
+ * Partially update a federation rule.
97
+ *
98
+ * `issuer_id` is immutable. `match` and `target` are replaced as whole objects
99
+ * when set. Referenced service accounts and workspaces must exist in your
100
+ * organization; invalid references are rejected with a 400 error. Archived rules
101
+ * cannot be updated; this returns 400. Create a new rule instead. Rules on
102
+ * well-known shared issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud,
103
+ * Google) must constrain tenant identity via an identity-bearing claim, a
104
+ * tenant-pinning subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition
105
+ * referencing one of those identity claims (e.g. `claims.repository_owner`). On
106
+ * these issuers the requirement is re-checked on every update; if an existing
107
+ * rule's stored match does not yet constrain tenant identity, any update (even a
108
+ * rename or description change) must also supply a conforming `match` in the same
109
+ * request. OAuth callers may only manage rules whose `oauth_scope` is
110
+ * `workspace:developer` or `workspace:inference`; other scopes require a Console
111
+ * session.
112
+ *
113
+ * @example
114
+ * ```ts
115
+ * const betaFederationRule =
116
+ * await client.beta.organization.federation.rules.update(
117
+ * 'federation_rule_id',
118
+ * );
119
+ * ```
120
+ */
121
+ update(federationRuleID, params, options) {
122
+ const { betas, ...body } = params;
123
+ return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
124
+ body,
125
+ ...options,
126
+ headers: (0, headers_1.buildHeaders)([
127
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
128
+ options?.headers,
129
+ ]),
130
+ });
131
+ }
132
+ /**
133
+ * **Requires an OAuth access token with the `org:admin` scope**, from
134
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
135
+ * API keys are not accepted. See
136
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
137
+ *
138
+ * List federation rules in your organization.
139
+ *
140
+ * Optionally filter by issuer with `issuer_id`. Archived rules are excluded unless
141
+ * `include_archived=true`.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * // Automatically fetches more pages as needed.
146
+ * for await (const betaFederationRule of client.beta.organization.federation.rules.list()) {
147
+ * // ...
148
+ * }
149
+ * ```
150
+ */
151
+ list(params = {}, options) {
152
+ const { betas, ...query } = params ?? {};
153
+ return this._client.getAPIList('/v1/organizations/federation_rules?beta=true', (pagination_1.PageCursor), {
154
+ query,
155
+ ...options,
156
+ headers: (0, headers_1.buildHeaders)([
157
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
158
+ options?.headers,
159
+ ]),
160
+ });
161
+ }
162
+ /**
163
+ * **Requires an OAuth access token with the `org:admin` scope**, from
164
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
165
+ * API keys are not accepted. See
166
+ * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
167
+ *
168
+ * Archive a federation rule.
169
+ *
170
+ * Token exchange through this rule stops immediately. Idempotent; re-archiving
171
+ * returns the rule with its original `archived_at`. Archiving clears the rule's
172
+ * workspace targeting (`workspace_id` and `workspace_ids` are emptied). Tokens
173
+ * already minted before archive remain valid until they expire. OAuth callers may
174
+ * only manage rules whose `oauth_scope` is `workspace:developer` or
175
+ * `workspace:inference`; other scopes require a Console session.
176
+ *
177
+ * @example
178
+ * ```ts
179
+ * const betaFederationRule =
180
+ * await client.beta.organization.federation.rules.archive(
181
+ * 'federation_rule_id',
182
+ * );
183
+ * ```
184
+ */
185
+ archive(federationRuleID, params = {}, options) {
186
+ const { betas } = params ?? {};
187
+ return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}/archive?beta=true`, {
188
+ ...options,
189
+ headers: (0, headers_1.buildHeaders)([
190
+ { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
191
+ options?.headers,
192
+ ]),
193
+ });
194
+ }
15
195
  }
16
- /**
17
- * **Requires an OAuth access token with the `org:admin` scope**, from
18
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
19
- * API keys are not accepted. See
20
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
21
- *
22
- * Create a federation rule owned by your organization.
23
- *
24
- * The referenced issuer and the target service account must already exist in the
25
- * same organization; invalid references are rejected with a 400 error. The
26
- * workspace reference is validated. Membership is not checked at rule creation:
27
- * token exchange resolves a single enabled workspace per call and is rejected
28
- * unless the target service account is a member of that workspace (it is
29
- * implicitly a member of the default workspace). Rules on well-known shared
30
- * issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud, Google) must
31
- * constrain tenant identity via an identity-bearing claim, a tenant-pinning
32
- * subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition referencing one
33
- * of those identity claims (e.g. `claims.repository_owner`). OAuth callers may
34
- * only manage rules whose `oauth_scope` is `workspace:developer` or
35
- * `workspace:inference`; other scopes require a Console session.
36
- *
37
- * @example
38
- * ```ts
39
- * const betaFederationRule =
40
- * await client.beta.organization.federation.rules.create({
41
- * issuer_id: 'issuer_id',
42
- * match: {},
43
- * name: 'x',
44
- * oauth_scope: 'x',
45
- * target: {
46
- * service_account_id: 'svac_01SDCCSbTxrXDpWc1phhtcfK',
47
- * type: 'service_account',
48
- * },
49
- * });
50
- * ```
51
- */
52
- create(params, options) {
53
- const { betas, ...body } = params;
54
- return this._client.post('/v1/organizations/federation_rules?beta=true', {
55
- body,
56
- ...options,
57
- headers: (0, headers_1.buildHeaders)([
58
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
59
- options?.headers,
60
- ]),
61
- });
62
- }
63
- /**
64
- * **Requires an OAuth access token with the `org:admin` scope**, from
65
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
66
- * API keys are not accepted. See
67
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
68
- *
69
- * Retrieve a federation rule by its ID (`fdrl_...`).
70
- *
71
- * @example
72
- * ```ts
73
- * const betaFederationRule =
74
- * await client.beta.organization.federation.rules.retrieve(
75
- * 'federation_rule_id',
76
- * );
77
- * ```
78
- */
79
- retrieve(federationRuleID, params = {}, options) {
80
- const { betas } = params ?? {};
81
- return this._client.get((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
82
- ...options,
83
- headers: (0, headers_1.buildHeaders)([
84
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
85
- options?.headers,
86
- ]),
87
- });
88
- }
89
- /**
90
- * **Requires an OAuth access token with the `org:admin` scope**, from
91
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
92
- * API keys are not accepted. See
93
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
94
- *
95
- * Partially update a federation rule.
96
- *
97
- * `issuer_id` is immutable. `match` and `target` are replaced as whole objects
98
- * when set. Referenced service accounts and workspaces must exist in your
99
- * organization; invalid references are rejected with a 400 error. Archived rules
100
- * cannot be updated; this returns 400. Create a new rule instead. Rules on
101
- * well-known shared issuers (GitHub Actions, GitLab, Buildkite, Terraform Cloud,
102
- * Google) must constrain tenant identity via an identity-bearing claim, a
103
- * tenant-pinning subject prefix (such as `repo:YOUR_ORG/...`), or a CEL condition
104
- * referencing one of those identity claims (e.g. `claims.repository_owner`). On
105
- * these issuers the requirement is re-checked on every update; if an existing
106
- * rule's stored match does not yet constrain tenant identity, any update (even a
107
- * rename or description change) must also supply a conforming `match` in the same
108
- * request. OAuth callers may only manage rules whose `oauth_scope` is
109
- * `workspace:developer` or `workspace:inference`; other scopes require a Console
110
- * session.
111
- *
112
- * @example
113
- * ```ts
114
- * const betaFederationRule =
115
- * await client.beta.organization.federation.rules.update(
116
- * 'federation_rule_id',
117
- * );
118
- * ```
119
- */
120
- update(federationRuleID, params, options) {
121
- const { betas, ...body } = params;
122
- return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}?beta=true`, {
123
- body,
124
- ...options,
125
- headers: (0, headers_1.buildHeaders)([
126
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
127
- options?.headers,
128
- ]),
129
- });
130
- }
131
- /**
132
- * **Requires an OAuth access token with the `org:admin` scope**, from
133
- * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
134
- * API keys are not accepted. See
135
- * [Manage WIF with the Admin API](/docs/en/manage-claude/wif-admin-api).
136
- *
137
- * List federation rules in your organization.
138
- *
139
- * Optionally filter by issuer with `issuer_id`. Archived rules are excluded unless
140
- * `include_archived=true`.
141
- *
142
- * @example
143
- * ```ts
144
- * // Automatically fetches more pages as needed.
145
- * for await (const betaFederationRule of client.beta.organization.federation.rules.list()) {
146
- * // ...
147
- * }
148
- * ```
149
- */
150
- list(params = {}, options) {
151
- const { betas, ...query } = params ?? {};
152
- return this._client.getAPIList('/v1/organizations/federation_rules?beta=true', (pagination_1.PageCursor), {
153
- query,
154
- ...options,
155
- headers: (0, headers_1.buildHeaders)([
156
- { ...(betas?.toString() != null ? { 'anthropic-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-claude/wif-admin-api).
166
- *
167
- * Archive a federation rule.
168
- *
169
- * Token exchange through this rule stops immediately. Idempotent; re-archiving
170
- * returns the rule with its original `archived_at`. Archiving clears the rule's
171
- * workspace targeting (`workspace_id` and `workspace_ids` are emptied). Tokens
172
- * already minted before archive remain valid until they expire. OAuth callers may
173
- * only manage rules whose `oauth_scope` is `workspace:developer` or
174
- * `workspace:inference`; other scopes require a Console session.
175
- *
176
- * @example
177
- * ```ts
178
- * const betaFederationRule =
179
- * await client.beta.organization.federation.rules.archive(
180
- * 'federation_rule_id',
181
- * );
182
- * ```
183
- */
184
- archive(federationRuleID, params = {}, options) {
185
- const { betas } = params ?? {};
186
- return this._client.post((0, path_1.path) `/v1/organizations/federation_rules/${federationRuleID}/archive?beta=true`, {
187
- ...options,
188
- headers: (0, headers_1.buildHeaders)([
189
- { ...(betas?.toString() != null ? { 'anthropic-beta': betas?.toString() } : undefined) },
190
- options?.headers,
191
- ]),
192
- });
193
- }
194
- }
196
+ Rules.Workspaces = workspaces_1.Workspaces;
197
+ return Rules;
198
+ })();
195
199
  exports.Rules = Rules;
196
- Rules.Workspaces = workspaces_1.Workspaces;
197
200
  //# sourceMappingURL=rules.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../../src/resources/beta/organization/federation/rules/rules.ts"],"names":[],"mappings":";;;;AAAA,8DAA2D;AAE3D,uEAA8C;AAC9C,gDAMsB;AAEtB,kEAAgG;AAChG,gEAA+D;AAE/D,gEAA0D;AAE1D,MAAa,KAAM,SAAQ,sBAAW;IAAtC;;QACE,eAAU,GAA6B,IAAI,aAAa,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA2MpF,CAAC;IAzMC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OAmCG;IACH,MAAM,CAAC,MAAwB,EAAE,OAAwB;QACvD,MAAM,EAAE,KAAK,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,CAAC;QAClC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,8CAA8C,EAAE;YACvE,IAAI;YACJ,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO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EAAE,GAAG,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,UAAU,CAC5B,8CAA8C,EAC9C,CAAA,uBAA8B,CAAA,EAC9B;YACE,KAAK;YACL,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CACF,CAAC;IACJ,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;OAsBG;IACH,OAAO,CACL,gBAAwB,EACxB,SAA+C,EAAE,EACjD,OAAwB;QAExB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,sCAAsC,gBAAgB,oBAAoB,EAAE;YACvG,GAAG,OAAO;YACV,OAAO,EAAE,IAAA,sBAAY,EAAC;gBACpB,EAAE,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,EAAE;gBACxF,OAAO,EAAE,OAAO;aACjB,CAAC;SACH,CAAC,CAAC;IACL,CAAC;CACF;AA5MD,sBA4MC;AA0XD,KAAK,CAAC,UAAU,GAAG,uBAAU,CAAC"}
1
+ {"version":3,"file":"rules.js","sourceRoot":"","sources":["../../../../../src/resources/beta/organization/federation/rules/rules.ts"],"names":[],"mappings":";;;;AAAA,8DAA2D;AAE3D,uEAA8C;AAC9C,gDAMsB;AAEtB,kEAAgG;AAChG,gEAA+D;AAE/D,gEAA0D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