@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,128 @@
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.Versions = 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 uploads_1 = require("../../../internal/uploads");
9
+ const path_1 = require("../../../internal/utils/path");
10
+ class Versions extends resource_1.APIResource {
11
+ /**
12
+ * Create Skill Version
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const betaSkillVersion =
17
+ * await client.beta.skills.versions.create('skill_id', {
18
+ * files: [fs.createReadStream('path/to/file')],
19
+ * });
20
+ * ```
21
+ */
22
+ create(skillID, params, options) {
23
+ const { betas, ...body } = params;
24
+ return this._client.post((0, path_1.path) `/v1/skills/${skillID}/versions?beta=true`, (0, uploads_1.multipartFormRequestOptions)({
25
+ body,
26
+ ...options,
27
+ headers: (0, headers_1.buildHeaders)([
28
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
29
+ options?.headers,
30
+ ]),
31
+ }, this._client, false));
32
+ }
33
+ /**
34
+ * Get Skill Version
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const betaSkillVersion =
39
+ * await client.beta.skills.versions.retrieve('version', {
40
+ * skill_id: 'skill_id',
41
+ * });
42
+ * ```
43
+ */
44
+ retrieve(version, params, options) {
45
+ const { skill_id, betas } = params;
46
+ return this._client.get((0, path_1.path) `/v1/skills/${skill_id}/versions/${version}?beta=true`, {
47
+ ...options,
48
+ headers: (0, headers_1.buildHeaders)([
49
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
50
+ options?.headers,
51
+ ]),
52
+ });
53
+ }
54
+ /**
55
+ * List Skill Versions
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * // Automatically fetches more pages as needed.
60
+ * for await (const betaSkillVersion of client.beta.skills.versions.list(
61
+ * 'skill_id',
62
+ * )) {
63
+ * // ...
64
+ * }
65
+ * ```
66
+ */
67
+ list(skillID, params = {}, options) {
68
+ const { betas, ...query } = params ?? {};
69
+ return this._client.getAPIList((0, path_1.path) `/v1/skills/${skillID}/versions?beta=true`, (pagination_1.PageCursor), {
70
+ query,
71
+ ...options,
72
+ headers: (0, headers_1.buildHeaders)([
73
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
74
+ options?.headers,
75
+ ]),
76
+ });
77
+ }
78
+ /**
79
+ * Delete Skill Version
80
+ *
81
+ * @example
82
+ * ```ts
83
+ * const betaDeletedSkillVersion =
84
+ * await client.beta.skills.versions.delete('version', {
85
+ * skill_id: 'skill_id',
86
+ * });
87
+ * ```
88
+ */
89
+ delete(version, params, options) {
90
+ const { skill_id, betas } = params;
91
+ return this._client.delete((0, path_1.path) `/v1/skills/${skill_id}/versions/${version}?beta=true`, {
92
+ ...options,
93
+ headers: (0, headers_1.buildHeaders)([
94
+ { ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined) },
95
+ options?.headers,
96
+ ]),
97
+ });
98
+ }
99
+ /**
100
+ * Download a skill version's content as a zip archive.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * const response = await client.beta.skills.versions.download(
105
+ * 'version',
106
+ * { skill_id: 'skill_id' },
107
+ * );
108
+ *
109
+ * const content = await response.blob();
110
+ * console.log(content);
111
+ * ```
112
+ */
113
+ download(version, params, options) {
114
+ const { skill_id, betas } = params;
115
+ return this._client.get((0, path_1.path) `/v1/skills/${skill_id}/versions/${version}/content?beta=true`, {
116
+ ...options,
117
+ headers: (0, headers_1.buildHeaders)([
118
+ {
119
+ Accept: 'application/binary',
120
+ ...(betas?.toString() != null ? { 'puku-beta': betas?.toString() } : undefined),
121
+ },
122
+ options?.headers,
123
+ ]),
124
+ __binaryResponse: true,
125
+ });
126
+ }
127
+ }
128
+ exports.Versions = Versions;
@@ -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("./skills/index"), exports);
@@ -0,0 +1,128 @@
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.Certificates = 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 Certificates extends resource_1.APIResource {
10
+ /**
11
+ * The Tunnels API is in research preview. It requires the
12
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
13
+ * deprecation period. It supersedes the Admin API endpoints at
14
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
15
+ *
16
+ * Registers a public CA certificate on a tunnel. PukuAI verifies the gateway's
17
+ * server certificate against this CA when it terminates the inner TLS session. A
18
+ * tunnel holds at most two non-archived certificates.
19
+ *
20
+ * @example
21
+ * ```ts
22
+ * const betaTunnelCertificate =
23
+ * await client.beta.tunnels.certificates.create(
24
+ * 'tunnel_id',
25
+ * { ca_certificate_pem: 'ca_certificate_pem' },
26
+ * );
27
+ * ```
28
+ */
29
+ create(tunnelID, params, options) {
30
+ const { betas, ...body } = params;
31
+ return this._client.post((0, path_1.path) `/v1/tunnels/${tunnelID}/certificates?beta=true`, {
32
+ body,
33
+ ...options,
34
+ headers: (0, headers_1.buildHeaders)([
35
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
36
+ options?.headers,
37
+ ]),
38
+ });
39
+ }
40
+ /**
41
+ * The Tunnels API is in research preview. It requires the
42
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
43
+ * deprecation period. It supersedes the Admin API endpoints at
44
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
45
+ *
46
+ * Fetches a tunnel certificate by ID.
47
+ *
48
+ * @example
49
+ * ```ts
50
+ * const betaTunnelCertificate =
51
+ * await client.beta.tunnels.certificates.retrieve(
52
+ * 'certificate_id',
53
+ * { tunnel_id: 'tunnel_id' },
54
+ * );
55
+ * ```
56
+ */
57
+ retrieve(certificateID, params, options) {
58
+ const { tunnel_id, betas } = params;
59
+ return this._client.get((0, path_1.path) `/v1/tunnels/${tunnel_id}/certificates/${certificateID}?beta=true`, {
60
+ ...options,
61
+ headers: (0, headers_1.buildHeaders)([
62
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
63
+ options?.headers,
64
+ ]),
65
+ });
66
+ }
67
+ /**
68
+ * The Tunnels API is in research preview. It requires the
69
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
70
+ * deprecation period. It supersedes the Admin API endpoints at
71
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
72
+ *
73
+ * Lists the certificates registered on a tunnel. Archived certificates are
74
+ * excluded unless include_archived is set.
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * // Automatically fetches more pages as needed.
79
+ * for await (const betaTunnelCertificate of client.beta.tunnels.certificates.list(
80
+ * 'tunnel_id',
81
+ * )) {
82
+ * // ...
83
+ * }
84
+ * ```
85
+ */
86
+ list(tunnelID, params = {}, options) {
87
+ const { betas, ...query } = params ?? {};
88
+ return this._client.getAPIList((0, path_1.path) `/v1/tunnels/${tunnelID}/certificates?beta=true`, (pagination_1.PageCursor), {
89
+ query,
90
+ ...options,
91
+ headers: (0, headers_1.buildHeaders)([
92
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
93
+ options?.headers,
94
+ ]),
95
+ });
96
+ }
97
+ /**
98
+ * The Tunnels API is in research preview. It requires the
99
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
100
+ * deprecation period. It supersedes the Admin API endpoints at
101
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
102
+ *
103
+ * Archives a tunnel certificate, removing it from the set PukuAI trusts for the
104
+ * tunnel. The certificate record is retained. Archiving the last non-archived
105
+ * certificate is permitted; the tunnel rejects MCP traffic until a new certificate
106
+ * is added.
107
+ *
108
+ * @example
109
+ * ```ts
110
+ * const betaTunnelCertificate =
111
+ * await client.beta.tunnels.certificates.archive(
112
+ * 'certificate_id',
113
+ * { tunnel_id: 'tunnel_id' },
114
+ * );
115
+ * ```
116
+ */
117
+ archive(certificateID, params, options) {
118
+ const { tunnel_id, betas } = params;
119
+ return this._client.post((0, path_1.path) `/v1/tunnels/${tunnel_id}/certificates/${certificateID}/archive?beta=true`, {
120
+ ...options,
121
+ headers: (0, headers_1.buildHeaders)([
122
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
123
+ options?.headers,
124
+ ]),
125
+ });
126
+ }
127
+ }
128
+ exports.Certificates = Certificates;
@@ -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.Tunnels = exports.Certificates = void 0;
5
+ var certificates_1 = require("./certificates");
6
+ Object.defineProperty(exports, "Certificates", { enumerable: true, get: function () { return certificates_1.Certificates; } });
7
+ var tunnels_1 = require("./tunnels");
8
+ Object.defineProperty(exports, "Tunnels", { enumerable: true, get: function () { return tunnels_1.Tunnels; } });
@@ -0,0 +1,209 @@
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.Tunnels = void 0;
38
+ const resource_1 = require("../../../core/resource");
39
+ const CertificatesAPI = __importStar(require("./certificates"));
40
+ const certificates_1 = require("./certificates");
41
+ const pagination_1 = require("../../../core/pagination");
42
+ const headers_1 = require("../../../internal/headers");
43
+ const path_1 = require("../../../internal/utils/path");
44
+ class Tunnels extends resource_1.APIResource {
45
+ certificates = new CertificatesAPI.Certificates(this._client);
46
+ /**
47
+ * The Tunnels API is in research preview. It requires the
48
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
49
+ * deprecation period. It supersedes the Admin API endpoints at
50
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
51
+ *
52
+ * Creates a tunnel. Creation allocates a fresh hostname and provisions the tunnel;
53
+ * it is not idempotent. The new tunnel rejects MCP traffic until at least one CA
54
+ * certificate is added.
55
+ *
56
+ * @example
57
+ * ```ts
58
+ * const betaTunnel = await client.beta.tunnels.create();
59
+ * ```
60
+ */
61
+ create(params, options) {
62
+ const { betas, ...body } = params;
63
+ return this._client.post('/v1/tunnels?beta=true', {
64
+ body,
65
+ ...options,
66
+ headers: (0, headers_1.buildHeaders)([
67
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
68
+ options?.headers,
69
+ ]),
70
+ });
71
+ }
72
+ /**
73
+ * The Tunnels API is in research preview. It requires the
74
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
75
+ * deprecation period. It supersedes the Admin API endpoints at
76
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
77
+ *
78
+ * Fetches a tunnel by ID.
79
+ *
80
+ * @example
81
+ * ```ts
82
+ * const betaTunnel = await client.beta.tunnels.retrieve(
83
+ * 'tunnel_id',
84
+ * );
85
+ * ```
86
+ */
87
+ retrieve(tunnelID, params = {}, options) {
88
+ const { betas } = params ?? {};
89
+ return this._client.get((0, path_1.path) `/v1/tunnels/${tunnelID}?beta=true`, {
90
+ ...options,
91
+ headers: (0, headers_1.buildHeaders)([
92
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
93
+ options?.headers,
94
+ ]),
95
+ });
96
+ }
97
+ /**
98
+ * The Tunnels API is in research preview. It requires the
99
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
100
+ * deprecation period. It supersedes the Admin API endpoints at
101
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
102
+ *
103
+ * Lists tunnels. Results are ordered by creation time, newest first; archived
104
+ * tunnels are excluded unless include_archived is set.
105
+ *
106
+ * @example
107
+ * ```ts
108
+ * // Automatically fetches more pages as needed.
109
+ * for await (const betaTunnel of client.beta.tunnels.list()) {
110
+ * // ...
111
+ * }
112
+ * ```
113
+ */
114
+ list(params = {}, options) {
115
+ const { betas, ...query } = params ?? {};
116
+ return this._client.getAPIList('/v1/tunnels?beta=true', (pagination_1.PageCursor), {
117
+ query,
118
+ ...options,
119
+ headers: (0, headers_1.buildHeaders)([
120
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
121
+ options?.headers,
122
+ ]),
123
+ });
124
+ }
125
+ /**
126
+ * The Tunnels API is in research preview. It requires the
127
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
128
+ * deprecation period. It supersedes the Admin API endpoints at
129
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
130
+ *
131
+ * Archives a tunnel. Archival is irreversible: every non-archived certificate on
132
+ * the tunnel is archived in the same operation, the hostname is retired and never
133
+ * re-allocated, and the tunnel token is invalidated. Retrying against an
134
+ * already-archived tunnel returns the existing record unchanged.
135
+ *
136
+ * @example
137
+ * ```ts
138
+ * const betaTunnel = await client.beta.tunnels.archive(
139
+ * 'tunnel_id',
140
+ * );
141
+ * ```
142
+ */
143
+ archive(tunnelID, params = {}, options) {
144
+ const { betas } = params ?? {};
145
+ return this._client.post((0, path_1.path) `/v1/tunnels/${tunnelID}/archive?beta=true`, {
146
+ ...options,
147
+ headers: (0, headers_1.buildHeaders)([
148
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
149
+ options?.headers,
150
+ ]),
151
+ });
152
+ }
153
+ /**
154
+ * The Tunnels API is in research preview. It requires the
155
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
156
+ * deprecation period. It supersedes the Admin API endpoints at
157
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
158
+ *
159
+ * Reveals a tunnel's connector token. The value is fetched live on each call;
160
+ * PukuAI does not store it. Repeated calls return the same value until the
161
+ * token is rotated. Exposed as POST so the token does not appear in intermediary
162
+ * access logs.
163
+ *
164
+ * @example
165
+ * ```ts
166
+ * const betaTunnelToken =
167
+ * await client.beta.tunnels.revealToken('tunnel_id');
168
+ * ```
169
+ */
170
+ revealToken(tunnelID, params = {}, options) {
171
+ const { betas } = params ?? {};
172
+ return this._client.post((0, path_1.path) `/v1/tunnels/${tunnelID}/reveal_token?beta=true`, {
173
+ ...options,
174
+ headers: (0, headers_1.buildHeaders)([
175
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
176
+ options?.headers,
177
+ ]),
178
+ });
179
+ }
180
+ /**
181
+ * The Tunnels API is in research preview. It requires the
182
+ * `puku-beta: mcp-tunnels-2026-06-22` header and may change without a
183
+ * deprecation period. It supersedes the Admin API endpoints at
184
+ * `/v1/organizations/tunnels`, which remain available during a migration window.
185
+ *
186
+ * Rotates a tunnel's connector token. Rotation invalidates the current token for
187
+ * new connections and returns a fresh value; established connections are not
188
+ * severed. A connector restarted after rotation must use the new value.
189
+ *
190
+ * @example
191
+ * ```ts
192
+ * const betaTunnelToken =
193
+ * await client.beta.tunnels.rotateToken('tunnel_id');
194
+ * ```
195
+ */
196
+ rotateToken(tunnelID, params, options) {
197
+ const { betas, ...body } = params;
198
+ return this._client.post((0, path_1.path) `/v1/tunnels/${tunnelID}/rotate_token?beta=true`, {
199
+ body,
200
+ ...options,
201
+ headers: (0, headers_1.buildHeaders)([
202
+ { 'puku-beta': [...(betas ?? []), 'mcp-tunnels-2026-06-22'].toString() },
203
+ options?.headers,
204
+ ]),
205
+ });
206
+ }
207
+ }
208
+ exports.Tunnels = Tunnels;
209
+ Tunnels.Certificates = certificates_1.Certificates;
@@ -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("./tunnels/index"), exports);
@@ -0,0 +1,117 @@
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.UserProfiles = 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 UserProfiles extends resource_1.APIResource {
10
+ /**
11
+ * Create User Profile
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * const betaUserProfile =
16
+ * await client.beta.userProfiles.create();
17
+ * ```
18
+ */
19
+ create(params, options) {
20
+ const { betas, ...body } = params;
21
+ return this._client.post('/v1/user_profiles?beta=true', {
22
+ body,
23
+ ...options,
24
+ headers: (0, headers_1.buildHeaders)([
25
+ { 'puku-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
26
+ options?.headers,
27
+ ]),
28
+ });
29
+ }
30
+ /**
31
+ * Get User Profile
32
+ *
33
+ * @example
34
+ * ```ts
35
+ * const betaUserProfile =
36
+ * await client.beta.userProfiles.retrieve(
37
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
38
+ * );
39
+ * ```
40
+ */
41
+ retrieve(userProfileID, params = {}, options) {
42
+ const { betas } = params ?? {};
43
+ return this._client.get((0, path_1.path) `/v1/user_profiles/${userProfileID}?beta=true`, {
44
+ ...options,
45
+ headers: (0, headers_1.buildHeaders)([
46
+ { 'puku-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
47
+ options?.headers,
48
+ ]),
49
+ });
50
+ }
51
+ /**
52
+ * Update User Profile
53
+ *
54
+ * @example
55
+ * ```ts
56
+ * const betaUserProfile =
57
+ * await client.beta.userProfiles.update(
58
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
59
+ * );
60
+ * ```
61
+ */
62
+ update(userProfileID, params, options) {
63
+ const { betas, ...body } = params;
64
+ return this._client.post((0, path_1.path) `/v1/user_profiles/${userProfileID}?beta=true`, {
65
+ body,
66
+ ...options,
67
+ headers: (0, headers_1.buildHeaders)([
68
+ { 'puku-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
69
+ options?.headers,
70
+ ]),
71
+ });
72
+ }
73
+ /**
74
+ * List User Profiles
75
+ *
76
+ * @example
77
+ * ```ts
78
+ * // Automatically fetches more pages as needed.
79
+ * for await (const betaUserProfile of client.beta.userProfiles.list()) {
80
+ * // ...
81
+ * }
82
+ * ```
83
+ */
84
+ list(params = {}, options) {
85
+ const { betas, ...query } = params ?? {};
86
+ return this._client.getAPIList('/v1/user_profiles?beta=true', (pagination_1.PageCursor), {
87
+ query,
88
+ ...options,
89
+ headers: (0, headers_1.buildHeaders)([
90
+ { 'puku-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
91
+ options?.headers,
92
+ ]),
93
+ });
94
+ }
95
+ /**
96
+ * Create Enrollment URL
97
+ *
98
+ * @example
99
+ * ```ts
100
+ * const betaUserProfileEnrollmentURL =
101
+ * await client.beta.userProfiles.createEnrollmentURL(
102
+ * 'uprof_011CZkZCu8hGbp5mYRQgUmz9',
103
+ * );
104
+ * ```
105
+ */
106
+ createEnrollmentURL(userProfileID, params = {}, options) {
107
+ const { betas } = params ?? {};
108
+ return this._client.post((0, path_1.path) `/v1/user_profiles/${userProfileID}/enrollment_url?beta=true`, {
109
+ ...options,
110
+ headers: (0, headers_1.buildHeaders)([
111
+ { 'puku-beta': [...(betas ?? []), 'user-profiles-2026-08-18'].toString() },
112
+ options?.headers,
113
+ ]),
114
+ });
115
+ }
116
+ }
117
+ exports.UserProfiles = UserProfiles;