@neta-art/cohub 2.11.0 → 2.11.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Viscept Limited
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -1,27 +1,81 @@
1
1
  import { n as CohubEnvironment } from "./environment.js";
2
- import { $ as CheckpointDiffSummary, $t as ReferenceKind, Ar as TaskRunRecord, B as CanvasDocumentRecord, Bn as SpaceDefaultResponse, Br as ListGenerationModelsResponse, Bt as Permission, Cn as SpaceAccessPolicy, Dn as SpaceCommerceBenefit, Dr as SpaceUsageResponse, En as SpaceCheckpointDetailResponse, Fr as UserSessionsResponse, G as Channel, Gn as SpaceFsCreateUploadResponse, Gt as PublicUserPageResponse, Hn as SpaceFsCompleteUploadInput, In as SpaceConfigInput, Ir as CreateGenerationTaskRequest, It as MeResponse, J as CheckpointDiffFileResponse, Ln as SpaceConfigResponse, Lr as CreateGenerationTaskResponse, Lt as ModelCatalogEntry, Mn as SpaceCommerceProduct, Mr as UserRulesResponse, Nn as SpaceCommerceProductBenefitBinding, Nt as LabelResourceType, On as SpaceCommerceBuyerProfile, Ot as LabelAssignmentRecord, Qt as ReferenceDirection, R as CanvasBootstrapResponse, Rn as SpaceConfigUpdateResponse, Rr as GenerationTaskResult, Rt as PatchResourceLabelsInput, St as InvitationDetail, Tr as SpaceSessionsResponse, Un as SpaceFsCompleteUploadResponse, Ut as PromptTemplateCatalogResponse, Vn as SpaceEnvInput, W as CanvasTransactionInput, Wn as SpaceFsCreateUploadInput, Wt as PublicReferral, Xn as SpaceFsMoveInput, Xt as ReferenceAggregateGroupBy, Yn as SpaceFsFileResponse, Zn as SpaceFsPreparingFile, Zt as ReferenceAggregateResponse, _n as SessionTurnResponse, _r as SpacePresenceSnapshot, a as WebsocketClientOptions, bi as ContentBlock, bn as SessionTurnWindowResponse, br as SpaceRecord, cr as SpaceFsUploadResponse, ct as CreateSpaceSessionInput, d as BatchUserProfilesResponse, dt as CronJobUpdatePatch, en as ReferenceQueryResponse, er as SpaceFsReadFilesResponse, et as CheckpointRecord, fi as SessionTurnPatchEvent, fn as SessionMessageResponse, fr as SpaceMember, ft as CursorPageInfo, gn as SessionTurnIndexResponse, gr as SpacePendingDiffSummary, hi as SessionForkRecord, hn as SessionRecord, hr as SpacePendingDiffFileResponse, in as ReferralDashboard, it as CreateSpaceInput, jn as SpaceCommerceOrder, jr as UserProfile, jt as LabelListItem, kr as TaskRunDetailResponse, kt as LabelItemsResponse, l as AcceptInvitationResponse, lr as SpaceFsWriteFileInput, mi as MessageRecord, mn as SessionMessagesResponse, mr as SpaceModListItem, ni as ChannelConfig, nt as CreateInvitationInput, ot as CreateSpacePromptInput, pi as SpacePublicEndpoints, pn as SessionMessagesPaginatedResponse, r as WebsocketClient, ri as ChannelHealth, rt as CreateInvitationResponse, s as WebsocketEventPayload, st as CreateSpacePromptResponse, tn as ReferenceQueryableType, tr as SpaceFsTreeResponse, tt as ClaimReferralResponse, ui as RealtimePatchOperation, ur as SpaceInvitation, ut as CronJobRecord, vi as SessionTurnRecord, vn as SessionTurnSignedUrlsResponse, xn as SessionTurnsPaginatedResponse, xr as SpaceRole, xt as GlobalSearchType, yi as Usage, yn as SessionTurnStreamSnapshotResponse, yr as SpacePublicProfile, yt as GlobalSearchResponse, z as CanvasCreateInput, zn as SpaceCreateResponse, zt as PatchResourceLabelsResponse } from "./websocket.js";
2
+ import { $ as CheckpointDiffSummary, $n as SpaceFsPreparingFile, $r as ChannelConfig, $t as ReferenceKind, An as SpaceCommerceBuyerProfile, B as CanvasDocumentRecord, Bn as SpaceConfigUpdateResponse, Bt as Permission, Cn as SkillCatalogResponse, Cr as SpaceRole, Dr as SpaceSessionsResponse, Fn as SpaceCommerceProductBenefitBinding, G as Channel, Gn as SpaceFsCompleteUploadResponse, Gt as PublicUserPageResponse, Hn as SpaceDefaultResponse, It as MeResponse, J as CheckpointDiffFileResponse, Kn as SpaceFsCreateUploadInput, Lr as UserSessionsResponse, Lt as ModelCatalogEntry, Mr as TaskRunRecord, Nn as SpaceCommerceOrder, Nr as UserProfile, Nt as LabelResourceType, On as SpaceCheckpointDetailResponse, Ot as LabelAssignmentRecord, Pn as SpaceCommerceProduct, Pr as UserRulesResponse, Qn as SpaceFsMoveInput, Qt as ReferenceDirection, R as CanvasBootstrapResponse, Rn as SpaceConfigInput, Rt as PatchResourceLabelsInput, Sr as SpaceRecord, St as InvitationDetail, Tn as SpaceAccessPolicy, Un as SpaceEnvInput, Ut as PromptTemplateCatalogResponse, Vn as SpaceCreateResponse, W as CanvasTransactionInput, Wn as SpaceFsCompleteUploadInput, Wt as PublicReferral, Xr as GenerationContentBlock, Xt as ReferenceAggregateGroupBy, Zn as SpaceFsFileResponse, Zr as GenerationModelDeclaration, Zt as ReferenceAggregateResponse, _i as BillingPayload, _n as SessionTurnResponse, _r as SpacePendingDiffFileResponse, a as WebsocketClientOptions, bn as SessionTurnWindowResponse, ct as CreateSpaceSessionInput, d as BatchUserProfilesResponse, di as MessageRecord, dr as SpaceFsWriteFileInput, dt as CronJobUpdatePatch, ei as ChannelHealth, en as ReferenceQueryResponse, et as CheckpointRecord, fi as SessionForkRecord, fn as SessionMessageResponse, fr as SpaceInvitation, ft as CursorPageInfo, gi as Usage, gn as SessionTurnIndexResponse, gr as SpaceModListItem, hi as SessionTurnRecord, hn as SessionRecord, in as ReferralDashboard, it as CreateSpaceInput, jr as TaskRunDetailResponse, jt as LabelListItem, kn as SpaceCommerceBenefit, kr as SpaceUsageResponse, kt as LabelItemsResponse, l as AcceptInvitationResponse, li as SessionTurnPatchEvent, mn as SessionMessagesResponse, mr as SpaceMember, nr as SpaceFsReadFilesResponse, nt as CreateInvitationInput, ot as CreateSpacePromptInput, pn as SessionMessagesPaginatedResponse, qn as SpaceFsCreateUploadResponse, r as WebsocketClient, rr as SpaceFsTreeResponse, rt as CreateInvitationResponse, s as WebsocketEventPayload, si as RealtimePatchOperation, st as CreateSpacePromptResponse, tn as ReferenceQueryableType, tt as ClaimReferralResponse, ui as SpacePublicEndpoints, ur as SpaceFsUploadResponse, ut as CronJobRecord, vi as ContentBlock, vn as SessionTurnSignedUrlsResponse, vr as SpacePendingDiffSummary, xn as SessionTurnsPaginatedResponse, xr as SpacePublicProfile, xt as GlobalSearchType, yn as SessionTurnStreamSnapshotResponse, yr as SpacePresenceSnapshot, yt as GlobalSearchResponse, z as CanvasCreateInput, zn as SpaceConfigResponse, zt as PatchResourceLabelsResponse } from "./websocket.js";
3
3
  import { a as VoiceInputCreateOptions } from "./voice-input.js";
4
-
5
- //#region ../protocol/src/model/completion.d.ts
4
+ //#region ../protocol/dist/generation/index.d.ts
5
+ declare const GENERATION_TASK_TYPE: "generation";
6
+ type CreateGenerationTaskRequest = {
7
+ spaceId: string;
8
+ sessionId?: string | null;
9
+ turnId?: string | null;
10
+ model: string;
11
+ content: GenerationContentBlock[];
12
+ parameters?: Record<string, unknown>;
13
+ meta?: Record<string, unknown>;
14
+ };
15
+ type CreateGenerationTaskResponse = {
16
+ taskRunId: string;
17
+ taskType: typeof GENERATION_TASK_TYPE;
18
+ status: "pending";
19
+ billing?: BillingPayload | null;
20
+ };
21
+ /**
22
+ * Final generation task payload stored on the task run.
23
+ *
24
+ * - `output` is the generated content blocks (SDK `GenerationResult.content`)
25
+ * - `requestId` maps to the provider response body's top-level `request_id`
26
+ * - `cost` maps to the official request price in `usage.cost`
27
+ * - `billing` records post-success credit consumption (when attempted)
28
+ * - `meta` is the request meta (including Cohub context such as taskRunId/spaceId)
29
+ */
30
+ type GenerationUsageBilling = {
31
+ /** Official provider cost before plan discount. */
32
+ officialCostUsd?: number;
33
+ /** Effective charge amount after plan discount; inspect status to confirm recording. */
34
+ amountUsd: number;
35
+ /** Server-resolved multiplier applied to officialCostUsd. */
36
+ discountMultiplier?: number;
37
+ usageType: string;
38
+ status: "recorded" | "overage" | "skipped";
39
+ reason?: string | null;
40
+ };
41
+ type GenerationTaskResult = {
42
+ model: string;
43
+ output: GenerationContentBlock[];
44
+ requestId?: string;
45
+ cost?: number;
46
+ /** Post-success usage charge metadata. Distinct from gate `billing` on create. */
47
+ billing?: GenerationUsageBilling | null;
48
+ meta?: Record<string, unknown>;
49
+ };
50
+ type PublicGenerationDeclaration = Omit<GenerationModelDeclaration, "adapter">;
51
+ type ListGenerationModelsResponse = {
52
+ models: PublicGenerationDeclaration[];
53
+ };
54
+ //#endregion
55
+ //#region ../protocol/dist/model/completion.d.ts
6
56
  type CompletionMessageRole = "user" | "assistant" | "system";
7
57
  /** Raw completion message. Reuses session ContentBlock content shape. */
8
58
  type CompletionMessage = {
9
59
  role: CompletionMessageRole;
10
60
  content: ContentBlock[];
11
61
  };
12
- type CompletionThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh";
62
+ type CompletionThinkingLevel = "off" | "minimal" | "low" | "medium" | "high" | "xhigh" | "max";
13
63
  type CreateSpaceCompletionInput = {
14
- /** Optional provider. Defaults to the first available model provider. */provider?: string | null; /** Optional model id. Defaults to the first available model. */
64
+ /** Optional provider. Defaults to the first available model provider. */
65
+ provider?: string | null;
66
+ /** Optional model id. Defaults to the first available model. */
15
67
  model?: string | null;
16
68
  /**
17
69
  * Optional space-relative markdown/text path used as system prompt.
18
70
  * Omitted/null/empty → empty system prompt.
19
71
  */
20
- systemPromptPath?: string | null; /** Full conversation history controlled by the caller. */
72
+ systemPromptPath?: string | null;
73
+ /** Full conversation history controlled by the caller. */
21
74
  messages: CompletionMessage[];
22
75
  temperature?: number | null;
23
76
  maxTokens?: number | null;
24
- thinkingLevel?: CompletionThinkingLevel | null; /** When true, respond with SSE. Default false (JSON). */
77
+ thinkingLevel?: CompletionThinkingLevel | null;
78
+ /** When true, respond with SSE. Default false (JSON). */
25
79
  stream?: boolean | null;
26
80
  };
27
81
  type CompletionUsage = Usage;
@@ -95,7 +149,9 @@ type WorkRuntimeCheckoutState = {
95
149
  * Options for a single work runtime transport request.
96
150
  */
97
151
  type WorkRuntimeRequestOptions = {
98
- /** How long to wait for a matching response before resolving with null. */timeoutMs?: number; /** When set, re-posts the request on this interval until a response arrives. */
152
+ /** How long to wait for a matching response before resolving with null. */
153
+ timeoutMs?: number;
154
+ /** When set, re-posts the request on this interval until a response arrives. */
99
155
  retryIntervalMs?: number;
100
156
  };
101
157
  /**
@@ -131,7 +187,8 @@ declare class PopupBrokerTransport implements WorkRuntimeTransport {
131
187
  private readonly workId?;
132
188
  private readonly getWorkId?;
133
189
  constructor(config: {
134
- brokerOrigin: string; /** Explicit work id. When absent, {@link getWorkId} is used to resolve it. */
190
+ brokerOrigin: string;
191
+ /** Explicit work id. When absent, {@link getWorkId} is used to resolve it. */
135
192
  workId?: string;
136
193
  /**
137
194
  * Lazily resolves the work id at runtime (e.g. via the public
@@ -192,7 +249,9 @@ declare class WorkRuntimeApi {
192
249
  * Configuration for the work runtime mode.
193
250
  */
194
251
  type WorkRuntimeModeConfig = {
195
- /** Explicit mode selection. When omitted, auto-detection is used. */mode?: "bridge" | "broker"; /** Cohub origin for the broker page (e.g. "https://cohub.run"). */
252
+ /** Explicit mode selection. When omitted, auto-detection is used. */
253
+ mode?: "bridge" | "broker";
254
+ /** Cohub origin for the broker page (e.g. "https://cohub.run"). */
196
255
  brokerOrigin?: string;
197
256
  /**
198
257
  * The work's public id. Required for broker mode unless the slug triple
@@ -201,8 +260,10 @@ type WorkRuntimeModeConfig = {
201
260
  workId?: string;
202
261
  /** Space owner's username. Used with {@link spaceSlug} + {@link workSlug} to
203
262
  * resolve the workId at runtime via the public `works.getBySlug` API. */
204
- ownerUsername?: string; /** Space slug. Part of the slug triple used for runtime workId resolution. */
205
- spaceSlug?: string; /** Work slug. Part of the slug triple used for runtime workId resolution. */
263
+ ownerUsername?: string;
264
+ /** Space slug. Part of the slug triple used for runtime workId resolution. */
265
+ spaceSlug?: string;
266
+ /** Work slug. Part of the slug triple used for runtime workId resolution. */
206
267
  workSlug?: string;
207
268
  };
208
269
  /** Lazily resolves a work's public id, e.g. via slug reverse lookup. */
@@ -251,9 +312,18 @@ type CohubClientOptions = {
251
312
  clearStoredAuthToken?: () => void;
252
313
  fetch?: Fetch;
253
314
  websocket?: WebsocketClientOptions;
254
- voice?: VoiceInputCreateOptions; /** Work runtime mode configuration (bridge vs broker). */
315
+ voice?: VoiceInputCreateOptions;
316
+ /** Work runtime mode configuration (bridge vs broker). */
255
317
  work?: WorkRuntimeModeConfig;
256
318
  };
319
+ /**
320
+ * Access tokens must be a single HTTP header token.
321
+ * Newlines / control chars (from corrupted storage or clipboard paste) make
322
+ * `Headers#set` throw TypeError — Safari: "The string did not match the expected pattern."
323
+ */
324
+ declare function sanitizeAccessToken(token: string | null | undefined): string | null;
325
+ /** Join API base + path without double slashes; prefer URL when base is absolute. */
326
+ declare function joinApiUrl(baseUrl: string, path: string): string;
257
327
  declare class HttpError extends Error {
258
328
  readonly status: number;
259
329
  readonly body: unknown;
@@ -370,6 +440,15 @@ declare class PromptsApi {
370
440
  }, customFetch?: Fetch): Promise<PromptTemplateCatalogResponse>;
371
441
  }
372
442
  //#endregion
443
+ //#region src/apis/skills.d.ts
444
+ declare class SkillsApi {
445
+ private readonly transport;
446
+ constructor(transport: HttpTransport);
447
+ list(options?: {
448
+ spaceId?: string;
449
+ }, customFetch?: Fetch): Promise<SkillCatalogResponse>;
450
+ }
451
+ //#endregion
373
452
  //#region src/apis/public-assets.d.ts
374
453
  type PublicAssetPurpose = "user_avatar" | "space_avatar" | "chat_attachment";
375
454
  /** Avatar + preprocessed chat images. General chat files may use any mime string. */
@@ -404,7 +483,9 @@ type UploadPublicAssetInput = {
404
483
  filename?: string;
405
484
  };
406
485
  type UploadChatAttachmentInput = {
407
- /** Optional association only; upload is user-scoped. */spaceId?: string; /** Optional association only; upload is user-scoped. */
486
+ /** Optional association only; upload is user-scoped. */
487
+ spaceId?: string;
488
+ /** Optional association only; upload is user-scoped. */
408
489
  sessionId?: string;
409
490
  file: Blob;
410
491
  mimeType: string;
@@ -656,8 +737,11 @@ type GenerationStreamSubscriptionHandlers = {
656
737
  outOfSync?: (event: GenerationStreamOutOfSyncEvent) => void;
657
738
  };
658
739
  type GenerationStreamSubscribeOptions = {
659
- /** Seed the stream reducer from the server-side active stream snapshot. */recover?: boolean; /** Optional host-provided snapshot to avoid an extra HTTP request. */
660
- initialSnapshot?: SessionTurnStreamSnapshotResponse["snapshot"] | null; /** Emit a state event after snapshot seed. Defaults to true. */
740
+ /** Seed the stream reducer from the server-side active stream snapshot. */
741
+ recover?: boolean;
742
+ /** Optional host-provided snapshot to avoid an extra HTTP request. */
743
+ initialSnapshot?: SessionTurnStreamSnapshotResponse["snapshot"] | null;
744
+ /** Emit a state event after snapshot seed. Defaults to true. */
661
745
  emitSnapshotState?: boolean;
662
746
  };
663
747
  declare function parseAssistantMessageCommit(message: MessageRecord): AssistantMessageCommit;
@@ -716,7 +800,8 @@ declare class PublicInviteApi {
716
800
  //#endregion
717
801
  //#region src/apis/spaces.d.ts
718
802
  type SessionSubscriptionHandlers = {
719
- patch?: (event: WebsocketEventPayload) => void; /** @deprecated Use `session.subscribeGeneration({ state })`. */
803
+ patch?: (event: WebsocketEventPayload) => void;
804
+ /** @deprecated Use `session.subscribeGeneration({ state })`. */
720
805
  patchState?: (result: SessionPatchApplyResult) => void;
721
806
  turnUpdated?: (event: WebsocketEventPayload) => void;
722
807
  turnFinalized?: (event: WebsocketEventPayload) => void;
@@ -1419,6 +1504,8 @@ type WorkCreateInput = {
1419
1504
  workScopes?: Permission[];
1420
1505
  allowedViewerScopes?: Permission[];
1421
1506
  meta?: WorkMeta | null;
1507
+ /** Optional provenance/notes stored on the initial published version. */
1508
+ versionMeta?: WorkMeta | null;
1422
1509
  };
1423
1510
  type WorkUpdateInput = Partial<{
1424
1511
  slug: string;
@@ -1437,6 +1524,8 @@ type WorkVersionRecord = {
1437
1524
  targetType: WorkTargetType;
1438
1525
  targetRef: string;
1439
1526
  assetKey: string | null;
1527
+ /** Optional provenance/notes for this version (e.g. source session/turn). */
1528
+ meta: WorkMeta | null;
1440
1529
  createdAt: string | null;
1441
1530
  };
1442
1531
  type WorkContent = {
@@ -1509,7 +1598,9 @@ declare class WorksApi {
1509
1598
  listVersions(workId: string): Promise<{
1510
1599
  versions: WorkVersionRecord[];
1511
1600
  }>;
1512
- publishVersion(workId: string): Promise<{
1601
+ publishVersion(workId: string, input?: {
1602
+ meta?: WorkMeta | null;
1603
+ }): Promise<{
1513
1604
  work: WorkRecord;
1514
1605
  version: WorkVersionRecord;
1515
1606
  }>;
@@ -1597,6 +1688,7 @@ declare class CohubHttpClient {
1597
1688
  readonly generations: GenerationsApi;
1598
1689
  readonly models: ModelsApi;
1599
1690
  readonly prompts: PromptsApi;
1691
+ readonly skills: SkillsApi;
1600
1692
  readonly publicAssets: PublicAssetsApi;
1601
1693
  readonly sessionAccess: SessionAccessApi;
1602
1694
  readonly search: SearchApi;
@@ -1613,4 +1705,4 @@ declare class CohubHttpClient {
1613
1705
  }
1614
1706
  declare const createHttpClient: (options?: CohubClientOptions) => CohubHttpClient;
1615
1707
  //#endregion
1616
- export { SessionGenerationStreamClient as $, UsersApi as A, ParentBridgeTransport as At, PublicInviteApi as B, createSlugWorkIdResolver as Bt, WorkStatus as C, CronJobsApi as Ct, WorkVisibility as D, HttpError as Dt, WorkVersionRecord as E, Fetch as Et, SpaceChannelBindingRecord as F, WorkRuntimeCheckoutStatus as Ft, GenerationStreamFinalizedEvent as G, CompletionMessageRole as Gt, GenerationStreamCommitEvent as H, resolveWorkTransport as Ht, SpaceClient as I, WorkRuntimeContext as It, GenerationStreamOutOfSyncEvent as J, CreateSpaceCompletionInput as Jt, GenerationStreamIntermediateMessage as K, CompletionThinkingLevel as Kt, SpaceEventName as L, WorkRuntimeModeConfig as Lt, TasksApi as M, WorkIdResolver as Mt, SessionEventName as N, WorkRuntimeApi as Nt, WorksApi as O, HttpTransport as Ot, SessionSubscriptionHandlers as P, WorkRuntimeCheckoutState as Pt, GenerationStreamTurnUpdatedEvent as Q, SpacesApi as R, WorkRuntimeRequestOptions as Rt, WorkSessionResponse as S, GenerationsApi as St, WorkUpdateInput as T, CohubClientOptions as Tt, GenerationStreamErrorEvent as U, CompletionAssistantMessage as Ut, AssistantMessageCommit as V, createWorkRuntime as Vt, GenerationStreamEvent as W, CompletionMessage as Wt, GenerationStreamSubscribeOptions as X, SpaceCompletionStreamEvent as Xt, GenerationStreamStateEvent as Y, SpaceCompletionResult as Yt, GenerationStreamSubscriptionHandlers as Z, WorkPresentationMeta as _, UploadChatAttachmentInput as _t, WorkCommerceCreditConsumeResponse as a, SessionPatchState as at, WorkRecord as b, PromptsApi as bt, WorkCommerceEntitlementsResponse as c, SessionAccessApi as ct, WorkCommercePurchaseResponse as d, SearchApi as dt, createSessionGenerationStreamClient as et, WorkAuthorizeResponse as f, CreatePublicAssetUploadInput as ft, WorkMeta as g, PublicAssetsApi as gt, WorkGetResponse as h, PublicAssetPurpose as ht, WorkCommerceCheckoutStatus as i, SessionPatchReducer as it, UserApi as j, PopupBrokerTransport as jt, ReferralsApi as k, RawHttpResponse as kt, WorkCommerceOrder as l, ReferenceResourceSelector as lt, WorkDetailResponse as m, PublicAssetMimeType as mt, createHttpClient as n, SessionPatchApplyInput as nt, WorkCommerceCreditConsumeStatus as o, SessionPatchStatus as ot, WorkCreateInput as p, CreatePublicAssetUploadResponse as pt, GenerationStreamLifecycleEvent as q, CompletionUsage as qt, WorkCommerceApi as r, SessionPatchApplyResult as rt, WorkCommerceEntitlement as s, createSessionPatchReducer as st, CohubHttpClient as t, parseAssistantMessageCommit as tt, WorkCommerceProductResolveResponse as u, ReferencesApi as ut, WorkPublicOwnerRecord as v, UploadChatImageAttachmentInput as vt, WorkTargetType as w, ChannelsApi as wt, WorkResolveResponse as x, ModelsApi as xt, WorkPublicSpaceRecord as y, UploadPublicAssetInput as yt, WebSocketConnectionState as z, WorkRuntimeTransport as zt };
1708
+ export { SessionGenerationStreamClient as $, SpaceCompletionStreamEvent as $t, UsersApi as A, RawHttpResponse as At, PublicInviteApi as B, WorkRuntimeModeConfig as Bt, WorkStatus as C, GenerationsApi as Ct, WorkVisibility as D, Fetch as Dt, WorkVersionRecord as E, CohubClientOptions as Et, SpaceChannelBindingRecord as F, WorkIdResolver as Ft, GenerationStreamFinalizedEvent as G, resolveWorkTransport as Gt, GenerationStreamCommitEvent as H, WorkRuntimeTransport as Ht, SpaceClient as I, WorkRuntimeApi as It, GenerationStreamOutOfSyncEvent as J, CompletionMessageRole as Jt, GenerationStreamIntermediateMessage as K, CompletionAssistantMessage as Kt, SpaceEventName as L, WorkRuntimeCheckoutState as Lt, TasksApi as M, sanitizeAccessToken as Mt, SessionEventName as N, ParentBridgeTransport as Nt, WorksApi as O, HttpError as Ot, SessionSubscriptionHandlers as P, PopupBrokerTransport as Pt, GenerationStreamTurnUpdatedEvent as Q, SpaceCompletionResult as Qt, SpacesApi as R, WorkRuntimeCheckoutStatus as Rt, WorkSessionResponse as S, ModelsApi as St, WorkUpdateInput as T, ChannelsApi as Tt, GenerationStreamErrorEvent as U, createSlugWorkIdResolver as Ut, AssistantMessageCommit as V, WorkRuntimeRequestOptions as Vt, GenerationStreamEvent as W, createWorkRuntime as Wt, GenerationStreamSubscribeOptions as X, CompletionUsage as Xt, GenerationStreamStateEvent as Y, CompletionThinkingLevel as Yt, GenerationStreamSubscriptionHandlers as Z, CreateSpaceCompletionInput as Zt, WorkPresentationMeta as _, UploadChatAttachmentInput as _t, WorkCommerceCreditConsumeResponse as a, PublicGenerationDeclaration as an, SessionPatchState as at, WorkRecord as b, SkillsApi as bt, WorkCommerceEntitlementsResponse as c, SessionAccessApi as ct, WorkCommercePurchaseResponse as d, SearchApi as dt, CreateGenerationTaskRequest as en, createSessionGenerationStreamClient as et, WorkAuthorizeResponse as f, CreatePublicAssetUploadInput as ft, WorkMeta as g, PublicAssetsApi as gt, WorkGetResponse as h, PublicAssetPurpose as ht, WorkCommerceCheckoutStatus as i, ListGenerationModelsResponse as in, SessionPatchReducer as it, UserApi as j, joinApiUrl as jt, ReferralsApi as k, HttpTransport as kt, WorkCommerceOrder as l, ReferenceResourceSelector as lt, WorkDetailResponse as m, PublicAssetMimeType as mt, createHttpClient as n, GenerationTaskResult as nn, SessionPatchApplyInput as nt, WorkCommerceCreditConsumeStatus as o, SessionPatchStatus as ot, WorkCreateInput as p, CreatePublicAssetUploadResponse as pt, GenerationStreamLifecycleEvent as q, CompletionMessage as qt, WorkCommerceApi as r, GenerationUsageBilling as rn, SessionPatchApplyResult as rt, WorkCommerceEntitlement as s, createSessionPatchReducer as st, CohubHttpClient as t, CreateGenerationTaskResponse as tn, parseAssistantMessageCommit as tt, WorkCommerceProductResolveResponse as u, ReferencesApi as ut, WorkPublicOwnerRecord as v, UploadChatImageAttachmentInput as vt, WorkTargetType as w, CronJobsApi as wt, WorkResolveResponse as x, PromptsApi as xt, WorkPublicSpaceRecord as y, UploadPublicAssetInput as yt, WebSocketConnectionState as z, WorkRuntimeContext as zt };
@@ -1,4 +1,4 @@
1
- import { a as getRealtimeSpaceRoom, n as HttpTransport, t as HttpError } from "./transport.js";
1
+ import { n as HttpTransport, s as getRealtimeSpaceRoom, t as HttpError } from "./transport.js";
2
2
  import { a as resolveApiBaseUrl } from "./environment.js";
3
3
  //#region src/apis/channels.ts
4
4
  var ChannelsApi = class {
@@ -186,7 +186,28 @@ var PromptsApi = class {
186
186
  }
187
187
  };
188
188
  //#endregion
189
+ //#region src/apis/skills.ts
190
+ var SkillsApi = class {
191
+ transport;
192
+ constructor(transport) {
193
+ this.transport = transport;
194
+ }
195
+ async list(options, customFetch) {
196
+ const params = new URLSearchParams();
197
+ if (options?.spaceId) params.set("spaceId", options.spaceId);
198
+ const query = params.toString();
199
+ const path = query ? `/api/skills?${query}` : "/api/skills";
200
+ return this.transport.request(path, { fetch: customFetch });
201
+ }
202
+ };
203
+ //#endregion
189
204
  //#region src/apis/public-assets.ts
205
+ /** Strip characters Safari rejects in FormData file names. */
206
+ function sanitizeFormDataFilename(filename) {
207
+ if (typeof filename !== "string") return void 0;
208
+ const base = filename.split(/[/\\]/).pop()?.replace(/[\r\n\0]/g, "").trim() ?? "";
209
+ return base.length > 0 ? base : void 0;
210
+ }
190
211
  var PublicAssetsApi = class {
191
212
  transport;
192
213
  constructor(transport) {
@@ -212,12 +233,19 @@ var PublicAssetsApi = class {
212
233
  });
213
234
  const formData = new FormData();
214
235
  for (const [key, value] of Object.entries(plan.asset.uploadFields)) formData.append(key, value);
215
- if (input.filename) formData.append("file", input.file, input.filename);
236
+ const safeFilename = sanitizeFormDataFilename(input.filename);
237
+ if (safeFilename) formData.append("file", input.file, safeFilename);
216
238
  else formData.append("file", input.file);
217
- const response = await fetch(plan.asset.uploadUrl, {
218
- method: plan.asset.uploadMethod,
219
- body: formData
220
- });
239
+ let response;
240
+ try {
241
+ response = await fetch(plan.asset.uploadUrl, {
242
+ method: plan.asset.uploadMethod,
243
+ body: formData
244
+ });
245
+ } catch (error) {
246
+ if (error instanceof TypeError && (error.message === "The string did not match the expected pattern." || /Failed to construct|invalid/i.test(error.message))) throw new Error(`Public asset upload failed: invalid upload request${safeFilename ? ` (${safeFilename})` : ""}`, { cause: error });
247
+ throw error;
248
+ }
221
249
  if (!response.ok) {
222
250
  const detail = await response.text().catch(() => "");
223
251
  throw new Error(`Public asset upload failed: HTTP ${response.status}${detail ? ` — ${detail}` : ""}`);
@@ -320,7 +348,7 @@ function ensureRealtimeConnected(websocketClient) {
320
348
  const blockSubPathPattern = /^\/message\/content\/blocks\/(\d+)\/(.+)$/;
321
349
  const blockPathPattern = /^\/message\/content\/blocks\/(\d+)$/;
322
350
  const blockMetaPathPattern = /^\/message\/content\/blocks\/(\d+)\/_meta$/;
323
- const TERMINAL_PATCH_STATUSES = new Set([
351
+ const TERMINAL_PATCH_STATUSES = /* @__PURE__ */ new Set([
324
352
  "completed",
325
353
  "failed",
326
354
  "interrupted"
@@ -2666,8 +2694,12 @@ var WorksApi = class {
2666
2694
  listVersions(workId) {
2667
2695
  return this.transport.request(`/api/works/${workId}/versions`);
2668
2696
  }
2669
- publishVersion(workId) {
2670
- return this.transport.request(`/api/works/${workId}/versions`, { method: "POST" });
2697
+ publishVersion(workId, input) {
2698
+ return this.transport.request(`/api/works/${workId}/versions`, {
2699
+ method: "POST",
2700
+ headers: input ? { "Content-Type": "application/json" } : void 0,
2701
+ body: input ? JSON.stringify(input) : void 0
2702
+ });
2671
2703
  }
2672
2704
  createSession(workId) {
2673
2705
  return this.transport.request(`/api/works/${workId}/session`, { method: "POST" });
@@ -2725,6 +2757,7 @@ var CohubHttpClient = class {
2725
2757
  generations;
2726
2758
  models;
2727
2759
  prompts;
2760
+ skills;
2728
2761
  publicAssets;
2729
2762
  sessionAccess;
2730
2763
  search;
@@ -2746,6 +2779,7 @@ var CohubHttpClient = class {
2746
2779
  this.generations = new GenerationsApi(this.transport);
2747
2780
  this.models = new ModelsApi(this.transport);
2748
2781
  this.prompts = new PromptsApi(this.transport);
2782
+ this.skills = new SkillsApi(this.transport);
2749
2783
  this.publicAssets = new PublicAssetsApi(this.transport);
2750
2784
  this.sessionAccess = new SessionAccessApi(this.transport);
2751
2785
  this.search = new SearchApi(this.transport);
@@ -2763,4 +2797,4 @@ var CohubHttpClient = class {
2763
2797
  };
2764
2798
  const createHttpClient = (options) => new CohubHttpClient(options);
2765
2799
  //#endregion
2766
- export { ModelsApi as C, ChannelsApi as E, PromptsApi as S, CronJobsApi as T, ensureRealtimeConnected as _, ReferralsApi as a, SearchApi as b, TasksApi as c, PublicInviteApi as d, SessionGenerationStreamClient as f, createSessionPatchReducer as g, SessionPatchReducer as h, WorksApi as i, SpaceClient as l, parseAssistantMessageCommit as m, createHttpClient as n, UsersApi as o, createSessionGenerationStreamClient as p, WorkCommerceApi as r, UserApi as s, CohubHttpClient as t, SpacesApi as u, SessionAccessApi as v, GenerationsApi as w, PublicAssetsApi as x, ReferencesApi as y };
2800
+ export { PromptsApi as C, ChannelsApi as D, CronJobsApi as E, SkillsApi as S, GenerationsApi as T, ensureRealtimeConnected as _, ReferralsApi as a, SearchApi as b, TasksApi as c, PublicInviteApi as d, SessionGenerationStreamClient as f, createSessionPatchReducer as g, SessionPatchReducer as h, WorksApi as i, SpaceClient as l, parseAssistantMessageCommit as m, createHttpClient as n, UsersApi as o, createSessionGenerationStreamClient as p, WorkCommerceApi as r, UserApi as s, CohubHttpClient as t, SpacesApi as u, SessionAccessApi as v, ModelsApi as w, PublicAssetsApi as x, ReferencesApi as y };