@puku-ai/sdk 4.0.2 → 4.0.4

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 (214) 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/BetaToolRunner.d.ts +1 -1
  88. package/dist/vendor/lib/tools/CompactionControl.cjs +27 -0
  89. package/dist/vendor/lib/tools/SessionToolRunner.cjs +740 -0
  90. package/dist/vendor/lib/tools/ToolError.cjs +46 -0
  91. package/dist/vendor/lib/transform-json-schema.cjs +113 -0
  92. package/dist/vendor/pagination.cjs +18 -0
  93. package/dist/vendor/resource.cjs +18 -0
  94. package/dist/vendor/resources/beta/agents/agents.cjs +159 -0
  95. package/dist/vendor/resources/beta/agents/agents.d.ts +3 -3
  96. package/dist/vendor/resources/beta/agents/agents.js +1 -1
  97. package/dist/vendor/resources/beta/agents/index.cjs +8 -0
  98. package/dist/vendor/resources/beta/agents/versions.cjs +35 -0
  99. package/dist/vendor/resources/beta/agents.cjs +18 -0
  100. package/dist/vendor/resources/beta/beta.cjs +105 -0
  101. package/dist/vendor/resources/beta/deployment-runs.cjs +54 -0
  102. package/dist/vendor/resources/beta/deployments.cjs +195 -0
  103. package/dist/vendor/resources/beta/dreams.cjs +115 -0
  104. package/dist/vendor/resources/beta/dreams.d.ts +2 -2
  105. package/dist/vendor/resources/beta/environments/environments.cjs +178 -0
  106. package/dist/vendor/resources/beta/environments/index.cjs +8 -0
  107. package/dist/vendor/resources/beta/environments/work.cjs +256 -0
  108. package/dist/vendor/resources/beta/environments.cjs +18 -0
  109. package/dist/vendor/resources/beta/files.cjs +123 -0
  110. package/dist/vendor/resources/beta/index.cjs +38 -0
  111. package/dist/vendor/resources/beta/memory-stores/index.cjs +10 -0
  112. package/dist/vendor/resources/beta/memory-stores/memories.cjs +129 -0
  113. package/dist/vendor/resources/beta/memory-stores/memory-stores.cjs +173 -0
  114. package/dist/vendor/resources/beta/memory-stores/memory-versions.cjs +80 -0
  115. package/dist/vendor/resources/beta/memory-stores.cjs +18 -0
  116. package/dist/vendor/resources/beta/messages/batches.cjs +206 -0
  117. package/dist/vendor/resources/beta/messages/batches.d.ts +3 -3
  118. package/dist/vendor/resources/beta/messages/index.cjs +11 -0
  119. package/dist/vendor/resources/beta/messages/messages.cjs +189 -0
  120. package/dist/vendor/resources/beta/messages/messages.d.ts +5 -5
  121. package/dist/vendor/resources/beta/messages/messages.js +4 -11
  122. package/dist/vendor/resources/beta/messages/messages.js.map +1 -1
  123. package/dist/vendor/resources/beta/messages.cjs +18 -0
  124. package/dist/vendor/resources/beta/models.cjs +59 -0
  125. package/dist/vendor/resources/beta/organization/api-keys.cjs +55 -0
  126. package/dist/vendor/resources/beta/organization/compliance-settings.cjs +51 -0
  127. package/dist/vendor/resources/beta/organization/external-keys.cjs +118 -0
  128. package/dist/vendor/resources/beta/organization/federation/federation.cjs +49 -0
  129. package/dist/vendor/resources/beta/organization/federation/index.cjs +10 -0
  130. package/dist/vendor/resources/beta/organization/federation/issuers.cjs +168 -0
  131. package/dist/vendor/resources/beta/organization/federation/rules/index.cjs +8 -0
  132. package/dist/vendor/resources/beta/organization/federation/rules/rules.cjs +226 -0
  133. package/dist/vendor/resources/beta/organization/federation/rules/workspaces.cjs +113 -0
  134. package/dist/vendor/resources/beta/organization/federation/rules.cjs +18 -0
  135. package/dist/vendor/resources/beta/organization/federation.cjs +18 -0
  136. package/dist/vendor/resources/beta/organization/index.cjs +24 -0
  137. package/dist/vendor/resources/beta/organization/invites.cjs +75 -0
  138. package/dist/vendor/resources/beta/organization/organization.cjs +90 -0
  139. package/dist/vendor/resources/beta/organization/rate-limits.cjs +30 -0
  140. package/dist/vendor/resources/beta/organization/service-accounts/index.cjs +8 -0
  141. package/dist/vendor/resources/beta/organization/service-accounts/service-accounts.cjs +202 -0
  142. package/dist/vendor/resources/beta/organization/service-accounts/workspaces.cjs +124 -0
  143. package/dist/vendor/resources/beta/organization/service-accounts.cjs +18 -0
  144. package/dist/vendor/resources/beta/organization/users.cjs +66 -0
  145. package/dist/vendor/resources/beta/organization/workspaces/index.cjs +12 -0
  146. package/dist/vendor/resources/beta/organization/workspaces/members.cjs +101 -0
  147. package/dist/vendor/resources/beta/organization/workspaces/rate-limits.cjs +33 -0
  148. package/dist/vendor/resources/beta/organization/workspaces/service-accounts.cjs +188 -0
  149. package/dist/vendor/resources/beta/organization/workspaces/workspaces.cjs +140 -0
  150. package/dist/vendor/resources/beta/organization/workspaces.cjs +18 -0
  151. package/dist/vendor/resources/beta/organization.cjs +18 -0
  152. package/dist/vendor/resources/beta/sessions/events.cjs +119 -0
  153. package/dist/vendor/resources/beta/sessions/index.cjs +12 -0
  154. package/dist/vendor/resources/beta/sessions/resources.cjs +131 -0
  155. package/dist/vendor/resources/beta/sessions/sessions.cjs +186 -0
  156. package/dist/vendor/resources/beta/sessions/sessions.d.ts +1 -1
  157. package/dist/vendor/resources/beta/sessions/threads/events.cjs +60 -0
  158. package/dist/vendor/resources/beta/sessions/threads/index.cjs +8 -0
  159. package/dist/vendor/resources/beta/sessions/threads/threads.cjs +116 -0
  160. package/dist/vendor/resources/beta/sessions/threads.cjs +18 -0
  161. package/dist/vendor/resources/beta/sessions.cjs +18 -0
  162. package/dist/vendor/resources/beta/skills/index.cjs +8 -0
  163. package/dist/vendor/resources/beta/skills/skills.cjs +132 -0
  164. package/dist/vendor/resources/beta/skills/versions.cjs +128 -0
  165. package/dist/vendor/resources/beta/skills.cjs +18 -0
  166. package/dist/vendor/resources/beta/tunnels/certificates.cjs +128 -0
  167. package/dist/vendor/resources/beta/tunnels/index.cjs +8 -0
  168. package/dist/vendor/resources/beta/tunnels/tunnels.cjs +209 -0
  169. package/dist/vendor/resources/beta/tunnels.cjs +18 -0
  170. package/dist/vendor/resources/beta/user-profiles.cjs +117 -0
  171. package/dist/vendor/resources/beta/vaults/credentials.cjs +176 -0
  172. package/dist/vendor/resources/beta/vaults/index.cjs +8 -0
  173. package/dist/vendor/resources/beta/vaults/vaults.cjs +177 -0
  174. package/dist/vendor/resources/beta/vaults.cjs +18 -0
  175. package/dist/vendor/resources/beta/webhooks.cjs +32 -0
  176. package/dist/vendor/resources/beta.cjs +18 -0
  177. package/dist/vendor/resources/completions.cjs +22 -0
  178. package/dist/vendor/resources/completions.d.ts +3 -3
  179. package/dist/vendor/resources/files.cjs +51 -0
  180. package/dist/vendor/resources/index.cjs +31 -0
  181. package/dist/vendor/resources/messages/batches.cjs +160 -0
  182. package/dist/vendor/resources/messages/batches.d.ts +1 -1
  183. package/dist/vendor/resources/messages/batches.js +1 -1
  184. package/dist/vendor/resources/messages/index.cjs +8 -0
  185. package/dist/vendor/resources/messages/messages.cjs +159 -0
  186. package/dist/vendor/resources/messages/messages.d.ts +7 -7
  187. package/dist/vendor/resources/messages/messages.js +6 -13
  188. package/dist/vendor/resources/messages/messages.js.map +1 -1
  189. package/dist/vendor/resources/messages.cjs +18 -0
  190. package/dist/vendor/resources/models.cjs +44 -0
  191. package/dist/vendor/resources/shared.cjs +3 -0
  192. package/dist/vendor/resources/skills/index.cjs +8 -0
  193. package/dist/vendor/resources/skills/skills.cjs +72 -0
  194. package/dist/vendor/resources/skills/versions.cjs +40 -0
  195. package/dist/vendor/resources/skills.cjs +18 -0
  196. package/dist/vendor/resources/top-level.cjs +3 -0
  197. package/dist/vendor/resources.cjs +17 -0
  198. package/dist/vendor/streaming.cjs +18 -0
  199. package/dist/vendor/tools/agent-toolset/fs-util.cjs +193 -0
  200. package/dist/vendor/tools/agent-toolset/memories.cjs +916 -0
  201. package/dist/vendor/tools/agent-toolset/node.browser.cjs +147 -0
  202. package/dist/vendor/tools/agent-toolset/node.cjs +939 -0
  203. package/dist/vendor/tools/agent-toolset/skills.cjs +325 -0
  204. package/dist/vendor/tools/agent-toolset/sync-interval.cjs +28 -0
  205. package/dist/vendor/tools/memory/node.browser.cjs +48 -0
  206. package/dist/vendor/tools/memory/node.cjs +364 -0
  207. package/dist/vendor/uploads.cjs +18 -0
  208. package/dist/vendor/version.cjs +4 -0
  209. package/package.json +12 -13
  210. package/sdk.cjs +0 -14293
  211. package/sdk.cjs.map +0 -149
  212. package/sdk.d.ts +0 -10866
  213. package/sdk.mjs +0 -68
  214. package/sdk.mjs.map +0 -149
@@ -0,0 +1,33 @@
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
+ const path_1 = require("../../../../internal/utils/path");
8
+ class RateLimits extends resource_1.APIResource {
9
+ /**
10
+ * List rate-limit overrides configured for a workspace.
11
+ *
12
+ * Returns only the groups and limiter types that have a workspace-level override.
13
+ * Groups without overrides inherit the organization limits and are not listed; use
14
+ * `GET /v1/organizations/rate_limits` to see those.
15
+ *
16
+ * When `limit` is omitted, every matching entry is returned in a single page; when
17
+ * `limit` truncates the result, follow `next_page` to fetch the remaining entries.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * // Automatically fetches more pages as needed.
22
+ * for await (const betaWorkspaceRateLimit of client.beta.organization.workspaces.rateLimits.list(
23
+ * 'workspace_id',
24
+ * )) {
25
+ * // ...
26
+ * }
27
+ * ```
28
+ */
29
+ list(workspaceID, query = {}, options) {
30
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/rate_limits?beta=true`, (pagination_1.PageCursor), { query, ...options });
31
+ }
32
+ }
33
+ exports.RateLimits = RateLimits;
@@ -0,0 +1,188 @@
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.ServiceAccounts = 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 ServiceAccounts 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
+ * Retrieve a service account's membership in a workspace.
17
+ *
18
+ * Returns the membership record, including the service account's `workspace_role`
19
+ * in this workspace. Archived workspaces return 400. For the default workspace,
20
+ * returns the implicit (`implicit: true`) membership when no explicit membership
21
+ * exists; an explicitly added membership is returned with its assigned role. An
22
+ * archived service account returns 404.
23
+ *
24
+ * @example
25
+ * ```ts
26
+ * const betaServiceAccountWorkspaceMember =
27
+ * await client.beta.organization.workspaces.serviceAccounts.retrieve(
28
+ * 'service_account_id',
29
+ * { workspace_id: 'workspace_id' },
30
+ * );
31
+ * ```
32
+ */
33
+ retrieve(serviceAccountID, params, options) {
34
+ const { workspace_id, betas } = params;
35
+ return this._client.get((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/service_accounts/${serviceAccountID}?beta=true`, {
36
+ ...options,
37
+ headers: (0, headers_1.buildHeaders)([
38
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
39
+ options?.headers,
40
+ ]),
41
+ });
42
+ }
43
+ /**
44
+ * **Requires an OAuth access token with the `org:admin` scope**, from
45
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
46
+ * API keys are not accepted. See
47
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
48
+ *
49
+ * Change a service account's role in a workspace.
50
+ *
51
+ * The new `workspace_role` replaces the current one. Only explicit memberships can
52
+ * be updated; to set a role on the implicit default-workspace membership, add the
53
+ * service account explicitly with
54
+ * `POST /workspaces/{workspace_id}/service_accounts`. Archived workspaces
55
+ * return 400. Archived service accounts cannot be updated and are rejected.
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * const betaServiceAccountWorkspaceMember =
60
+ * await client.beta.organization.workspaces.serviceAccounts.update(
61
+ * 'service_account_id',
62
+ * {
63
+ * workspace_id: 'workspace_id',
64
+ * workspace_role: 'workspace_admin',
65
+ * },
66
+ * );
67
+ * ```
68
+ */
69
+ update(serviceAccountID, params, options) {
70
+ const { workspace_id, betas, ...body } = params;
71
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/service_accounts/${serviceAccountID}?beta=true`, {
72
+ body,
73
+ ...options,
74
+ headers: (0, headers_1.buildHeaders)([
75
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
76
+ options?.headers,
77
+ ]),
78
+ });
79
+ }
80
+ /**
81
+ * **Requires an OAuth access token with the `org:admin` scope**, from
82
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
83
+ * API keys are not accepted. See
84
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
85
+ *
86
+ * List the service accounts that are members of a workspace.
87
+ *
88
+ * Each entry includes the service account's `workspace_role`. Use `limit` and the
89
+ * `next_page` cursor to paginate. Archived workspaces return 400; use
90
+ * `GET /service_accounts/{id}/workspaces` to audit memberships of an archived
91
+ * workspace. The implicit default-workspace membership is not included in this
92
+ * list. Memberships of archived service accounts are omitted from the results.
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * // Automatically fetches more pages as needed.
97
+ * for await (const betaServiceAccountWorkspaceMember of client.beta.organization.workspaces.serviceAccounts.list(
98
+ * 'workspace_id',
99
+ * )) {
100
+ * // ...
101
+ * }
102
+ * ```
103
+ */
104
+ list(workspaceID, params = {}, options) {
105
+ const { betas, ...query } = params ?? {};
106
+ return this._client.getAPIList((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/service_accounts?beta=true`, (pagination_1.PageCursor), {
107
+ query,
108
+ ...options,
109
+ headers: (0, headers_1.buildHeaders)([
110
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
111
+ options?.headers,
112
+ ]),
113
+ });
114
+ }
115
+ /**
116
+ * **Requires an OAuth access token with the `org:admin` scope**, from
117
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
118
+ * API keys are not accepted. See
119
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
120
+ *
121
+ * Add a service account to a workspace with the given `workspace_role`.
122
+ *
123
+ * The role determines what the service account can do in the workspace and which
124
+ * workspace-scoped permissions it can be granted when authenticating through
125
+ * federation. Every service account is already an implicit `workspace_user` member
126
+ * of the default workspace; adding it explicitly assigns a chosen role. If the
127
+ * service account is already an explicit member of the workspace, its
128
+ * `workspace_role` is replaced with the value supplied here. Archived workspaces
129
+ * return 400. Archived service accounts cannot be added and are rejected.
130
+ *
131
+ * @example
132
+ * ```ts
133
+ * const betaServiceAccountWorkspaceMember =
134
+ * await client.beta.organization.workspaces.serviceAccounts.add(
135
+ * 'workspace_id',
136
+ * {
137
+ * service_account_id: 'service_account_id',
138
+ * workspace_role: 'workspace_admin',
139
+ * },
140
+ * );
141
+ * ```
142
+ */
143
+ add(workspaceID, params, options) {
144
+ const { betas, ...body } = params;
145
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/service_accounts?beta=true`, {
146
+ body,
147
+ ...options,
148
+ headers: (0, headers_1.buildHeaders)([
149
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
150
+ options?.headers,
151
+ ]),
152
+ });
153
+ }
154
+ /**
155
+ * **Requires an OAuth access token with the `org:admin` scope**, from
156
+ * `ant auth login --scope org:admin` or a workload identity federation rule; Admin
157
+ * API keys are not accepted. See
158
+ * [Manage WIF with the Admin API](/docs/en/manage-puku/wif-admin-api).
159
+ *
160
+ * Remove a service account from a workspace.
161
+ *
162
+ * Removal is idempotent (returns 200 even if the membership was already removed).
163
+ * A DELETE against the implicit default-workspace membership returns 200 but is a
164
+ * no-op and the membership persists; deleting an explicit default-workspace row
165
+ * reverts to the implicit `workspace_user` membership. Archived workspaces
166
+ * return 400.
167
+ *
168
+ * @example
169
+ * ```ts
170
+ * const serviceAccount =
171
+ * await client.beta.organization.workspaces.serviceAccounts.remove(
172
+ * 'service_account_id',
173
+ * { workspace_id: 'workspace_id' },
174
+ * );
175
+ * ```
176
+ */
177
+ remove(serviceAccountID, params, options) {
178
+ const { workspace_id, betas } = params;
179
+ return this._client.delete((0, path_1.path) `/v1/organizations/workspaces/${workspace_id}/service_accounts/${serviceAccountID}?beta=true`, {
180
+ ...options,
181
+ headers: (0, headers_1.buildHeaders)([
182
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
183
+ options?.headers,
184
+ ]),
185
+ });
186
+ }
187
+ }
188
+ exports.ServiceAccounts = ServiceAccounts;
@@ -0,0 +1,140 @@
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.Workspaces = void 0;
38
+ const resource_1 = require("../../../../core/resource");
39
+ const MembersAPI = __importStar(require("./members"));
40
+ const members_1 = require("./members");
41
+ const RateLimitsAPI = __importStar(require("./rate-limits"));
42
+ const rate_limits_1 = require("./rate-limits");
43
+ const ServiceAccountsAPI = __importStar(require("./service-accounts"));
44
+ const service_accounts_1 = require("./service-accounts");
45
+ const pagination_1 = require("../../../../core/pagination");
46
+ const headers_1 = require("../../../../internal/headers");
47
+ const path_1 = require("../../../../internal/utils/path");
48
+ class Workspaces extends resource_1.APIResource {
49
+ rateLimits = new RateLimitsAPI.RateLimits(this._client);
50
+ members = new MembersAPI.Members(this._client);
51
+ serviceAccounts = new ServiceAccountsAPI.ServiceAccounts(this._client);
52
+ /**
53
+ * Create Workspace
54
+ *
55
+ * @example
56
+ * ```ts
57
+ * const betaWorkspace =
58
+ * await client.beta.organization.workspaces.create({
59
+ * name: 'x',
60
+ * });
61
+ * ```
62
+ */
63
+ create(params, options) {
64
+ const { betas, ...body } = params;
65
+ return this._client.post('/v1/organizations/workspaces?beta=true', {
66
+ body,
67
+ ...options,
68
+ headers: (0, headers_1.buildHeaders)([
69
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
70
+ options?.headers,
71
+ ]),
72
+ });
73
+ }
74
+ /**
75
+ * Get Workspace
76
+ *
77
+ * @example
78
+ * ```ts
79
+ * const betaWorkspace =
80
+ * await client.beta.organization.workspaces.retrieve(
81
+ * 'workspace_id',
82
+ * );
83
+ * ```
84
+ */
85
+ retrieve(workspaceID, options) {
86
+ return this._client.get((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}?beta=true`, options);
87
+ }
88
+ /**
89
+ * Update Workspace
90
+ *
91
+ * @example
92
+ * ```ts
93
+ * const betaWorkspace =
94
+ * await client.beta.organization.workspaces.update(
95
+ * 'workspace_id',
96
+ * );
97
+ * ```
98
+ */
99
+ update(workspaceID, body, options) {
100
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}?beta=true`, {
101
+ body,
102
+ ...options,
103
+ });
104
+ }
105
+ /**
106
+ * List Workspaces
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * // Automatically fetches more pages as needed.
111
+ * for await (const betaWorkspace of client.beta.organization.workspaces.list()) {
112
+ * // ...
113
+ * }
114
+ * ```
115
+ */
116
+ list(query = {}, options) {
117
+ return this._client.getAPIList('/v1/organizations/workspaces?beta=true', (pagination_1.Page), {
118
+ query,
119
+ ...options,
120
+ });
121
+ }
122
+ /**
123
+ * Archive Workspace
124
+ *
125
+ * @example
126
+ * ```ts
127
+ * const betaWorkspace =
128
+ * await client.beta.organization.workspaces.archive(
129
+ * 'workspace_id',
130
+ * );
131
+ * ```
132
+ */
133
+ archive(workspaceID, options) {
134
+ return this._client.post((0, path_1.path) `/v1/organizations/workspaces/${workspaceID}/archive?beta=true`, options);
135
+ }
136
+ }
137
+ exports.Workspaces = Workspaces;
138
+ Workspaces.RateLimits = rate_limits_1.RateLimits;
139
+ Workspaces.Members = members_1.Members;
140
+ Workspaces.ServiceAccounts = service_accounts_1.ServiceAccounts;
@@ -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("./workspaces/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("./organization/index"), exports);
@@ -0,0 +1,119 @@
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.SessionToolRunner = exports.Events = 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
+ const SessionToolRunner_1 = require("../../../lib/tools/SessionToolRunner");
10
+ class Events extends resource_1.APIResource {
11
+ /**
12
+ * List Events
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * // Automatically fetches more pages as needed.
17
+ * for await (const betaManagedAgentsSessionEvent of client.beta.sessions.events.list(
18
+ * 'sesn_011CZkZAtmR3yMPDzynEDxu7',
19
+ * )) {
20
+ * // ...
21
+ * }
22
+ * ```
23
+ */
24
+ list(sessionID, params = {}, options) {
25
+ const { betas, ...query } = params ?? {};
26
+ return this._client.getAPIList((0, path_1.path) `/v1/sessions/${sessionID}/events?beta=true`, (pagination_1.PageCursor), {
27
+ query,
28
+ ...options,
29
+ headers: (0, headers_1.buildHeaders)([
30
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
31
+ options?.headers,
32
+ ]),
33
+ });
34
+ }
35
+ /**
36
+ * Send Events
37
+ *
38
+ * @example
39
+ * ```ts
40
+ * const betaManagedAgentsSendSessionEvents =
41
+ * await client.beta.sessions.events.send(
42
+ * 'sesn_011CZkZAtmR3yMPDzynEDxu7',
43
+ * {
44
+ * events: [
45
+ * {
46
+ * content: [
47
+ * {
48
+ * text: 'Where is my order #1234?',
49
+ * type: 'text',
50
+ * },
51
+ * ],
52
+ * type: 'user.message',
53
+ * },
54
+ * ],
55
+ * },
56
+ * );
57
+ * ```
58
+ */
59
+ send(sessionID, params, options) {
60
+ const { betas, ...body } = params;
61
+ return this._client.post((0, path_1.path) `/v1/sessions/${sessionID}/events?beta=true`, {
62
+ body,
63
+ ...options,
64
+ headers: (0, headers_1.buildHeaders)([
65
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
66
+ options?.headers,
67
+ ]),
68
+ });
69
+ }
70
+ /**
71
+ * Stream Events
72
+ *
73
+ * @example
74
+ * ```ts
75
+ * const betaManagedAgentsStreamSessionEvents =
76
+ * await client.beta.sessions.events.stream(
77
+ * 'sesn_011CZkZAtmR3yMPDzynEDxu7',
78
+ * );
79
+ * ```
80
+ */
81
+ stream(sessionID, params = {}, options) {
82
+ const { betas, ...query } = params ?? {};
83
+ return this._client.get((0, path_1.path) `/v1/sessions/${sessionID}/events/stream?beta=true`, {
84
+ query,
85
+ ...options,
86
+ headers: (0, headers_1.buildHeaders)([
87
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
88
+ options?.headers,
89
+ ]),
90
+ stream: true,
91
+ });
92
+ }
93
+ /**
94
+ * Attach to a session and dispatch every incoming `agent.tool_use` and
95
+ * `agent.custom_tool_use` event to a local tool registry, sending the matching
96
+ * result back (`user.tool_result` / `user.custom_tool_result`). The
97
+ * sessions-side counterpart to `client.beta.messages.toolRunner`: yields one
98
+ * entry per completed tool call so callers can observe each dispatch (and
99
+ * `break` to abort cleanly).
100
+ *
101
+ * @example
102
+ * ```ts
103
+ * import { betaAgentToolset20260401 } from '@puku-ai/sdk/tools/agent-toolset/node';
104
+ *
105
+ * for await (const call of client.beta.sessions.events.toolRunner(work.data.id, {
106
+ * tools: [...betaAgentToolset20260401({ workdir }), myTool],
107
+ * })) {
108
+ * console.log(`${call.name} -> ${call.isError ? 'error' : 'ok'}`);
109
+ * }
110
+ * ```
111
+ */
112
+ toolRunner(sessionID, opts) {
113
+ return new SessionToolRunner_1.SessionToolRunner(sessionID, { ...opts, client: this._client });
114
+ }
115
+ }
116
+ exports.Events = Events;
117
+ var SessionToolRunner_2 = require("../../../lib/tools/SessionToolRunner");
118
+ Object.defineProperty(exports, "SessionToolRunner", { enumerable: true, get: function () { return SessionToolRunner_2.SessionToolRunner; } });
119
+ Events.SessionToolRunner = SessionToolRunner_1.SessionToolRunner;
@@ -0,0 +1,12 @@
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.Threads = exports.Sessions = exports.Resources = exports.Events = void 0;
5
+ var events_1 = require("./events");
6
+ Object.defineProperty(exports, "Events", { enumerable: true, get: function () { return events_1.Events; } });
7
+ var resources_1 = require("./resources");
8
+ Object.defineProperty(exports, "Resources", { enumerable: true, get: function () { return resources_1.Resources; } });
9
+ var sessions_1 = require("./sessions");
10
+ Object.defineProperty(exports, "Sessions", { enumerable: true, get: function () { return sessions_1.Sessions; } });
11
+ var index_1 = require("./threads/index");
12
+ Object.defineProperty(exports, "Threads", { enumerable: true, get: function () { return index_1.Threads; } });
@@ -0,0 +1,131 @@
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.Resources = 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 Resources extends resource_1.APIResource {
10
+ /**
11
+ * Get Session Resource
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const resource =
16
+ * await client.beta.sessions.resources.retrieve(
17
+ * 'sesrsc_011CZkZBJq5dWxk9fVLNcPht',
18
+ * { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' },
19
+ * );
20
+ * ```
21
+ */
22
+ retrieve(resourceID, params, options) {
23
+ const { session_id, betas } = params;
24
+ return this._client.get((0, path_1.path) `/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
25
+ ...options,
26
+ headers: (0, headers_1.buildHeaders)([
27
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
28
+ options?.headers,
29
+ ]),
30
+ });
31
+ }
32
+ /**
33
+ * Update Session Resource
34
+ *
35
+ * @example
36
+ * ```ts
37
+ * const resource =
38
+ * await client.beta.sessions.resources.update(
39
+ * 'sesrsc_011CZkZBJq5dWxk9fVLNcPht',
40
+ * {
41
+ * session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7',
42
+ * authorization_token: 'ghp_exampletoken',
43
+ * },
44
+ * );
45
+ * ```
46
+ */
47
+ update(resourceID, params, options) {
48
+ const { session_id, betas, ...body } = params;
49
+ return this._client.post((0, path_1.path) `/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
50
+ body,
51
+ ...options,
52
+ headers: (0, headers_1.buildHeaders)([
53
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
54
+ options?.headers,
55
+ ]),
56
+ });
57
+ }
58
+ /**
59
+ * List Session Resources
60
+ *
61
+ * @example
62
+ * ```ts
63
+ * // Automatically fetches more pages as needed.
64
+ * for await (const betaManagedAgentsSessionResource of client.beta.sessions.resources.list(
65
+ * 'sesn_011CZkZAtmR3yMPDzynEDxu7',
66
+ * )) {
67
+ * // ...
68
+ * }
69
+ * ```
70
+ */
71
+ list(sessionID, params = {}, options) {
72
+ const { betas, ...query } = params ?? {};
73
+ return this._client.getAPIList((0, path_1.path) `/v1/sessions/${sessionID}/resources?beta=true`, (pagination_1.PageCursor), {
74
+ query,
75
+ ...options,
76
+ headers: (0, headers_1.buildHeaders)([
77
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
78
+ options?.headers,
79
+ ]),
80
+ });
81
+ }
82
+ /**
83
+ * Delete Session Resource
84
+ *
85
+ * @example
86
+ * ```ts
87
+ * const betaManagedAgentsDeleteSessionResource =
88
+ * await client.beta.sessions.resources.delete(
89
+ * 'sesrsc_011CZkZBJq5dWxk9fVLNcPht',
90
+ * { session_id: 'sesn_011CZkZAtmR3yMPDzynEDxu7' },
91
+ * );
92
+ * ```
93
+ */
94
+ delete(resourceID, params, options) {
95
+ const { session_id, betas } = params;
96
+ return this._client.delete((0, path_1.path) `/v1/sessions/${session_id}/resources/${resourceID}?beta=true`, {
97
+ ...options,
98
+ headers: (0, headers_1.buildHeaders)([
99
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
100
+ options?.headers,
101
+ ]),
102
+ });
103
+ }
104
+ /**
105
+ * Add Session Resource
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * const betaManagedAgentsFileResource =
110
+ * await client.beta.sessions.resources.add(
111
+ * 'sesn_011CZkZAtmR3yMPDzynEDxu7',
112
+ * {
113
+ * file_id: 'file_011CNha8iCJcU1wXNR6q4V8w',
114
+ * type: 'file',
115
+ * },
116
+ * );
117
+ * ```
118
+ */
119
+ add(sessionID, params, options) {
120
+ const { betas, ...body } = params;
121
+ return this._client.post((0, path_1.path) `/v1/sessions/${sessionID}/resources?beta=true`, {
122
+ body,
123
+ ...options,
124
+ headers: (0, headers_1.buildHeaders)([
125
+ { 'puku-beta': [...(betas ?? []), 'managed-agents-2026-04-01'].toString() },
126
+ options?.headers,
127
+ ]),
128
+ });
129
+ }
130
+ }
131
+ exports.Resources = Resources;