@neta-art/cohub 1.20.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,32 @@
1
+ //#region src/environment.d.ts
2
+ type CohubEnvironment = "prod" | "dev";
3
+ declare const COHUB_ENVIRONMENTS: {
4
+ readonly prod: {
5
+ readonly apiBaseUrl: "https://api.cohub.run";
6
+ readonly websocketUrl: "wss://gateway.cohub.run/ws";
7
+ readonly voiceInputWebsocketUrl: "wss://gateway.cohub.run/asr/ws";
8
+ };
9
+ readonly dev: {
10
+ readonly apiBaseUrl: "https://api-dev.cohub.run";
11
+ readonly websocketUrl: "wss://gateway-dev.cohub.run/ws";
12
+ readonly voiceInputWebsocketUrl: "wss://gateway-dev.cohub.run/asr/ws";
13
+ };
14
+ };
15
+ declare const resolveCohubEnvironment: (env?: CohubEnvironment) => CohubEnvironment;
16
+ declare const normalizeBaseUrl: (url: string) => string;
17
+ declare const normalizeWebsocketUrl: (input: string) => string;
18
+ declare const normalizeVoiceInputWebsocketUrl: (input: string) => string;
19
+ declare const resolveApiBaseUrl: (options?: {
20
+ baseUrl?: string;
21
+ env?: CohubEnvironment;
22
+ }) => string;
23
+ declare const resolveWebsocketUrl: (options?: {
24
+ url?: string;
25
+ env?: CohubEnvironment;
26
+ }) => string;
27
+ declare const resolveVoiceInputWebsocketUrl: (options?: {
28
+ url?: string;
29
+ env?: CohubEnvironment;
30
+ }) => string;
31
+ //#endregion
32
+ export { normalizeWebsocketUrl as a, resolveVoiceInputWebsocketUrl as c, normalizeVoiceInputWebsocketUrl as i, resolveWebsocketUrl as l, CohubEnvironment as n, resolveApiBaseUrl as o, normalizeBaseUrl as r, resolveCohubEnvironment as s, COHUB_ENVIRONMENTS as t };
@@ -2,11 +2,13 @@
2
2
  const COHUB_ENVIRONMENTS = {
3
3
  prod: {
4
4
  apiBaseUrl: "https://api.cohub.run",
5
- websocketUrl: "wss://gateway.cohub.run/ws"
5
+ websocketUrl: "wss://gateway.cohub.run/ws",
6
+ voiceInputWebsocketUrl: "wss://gateway.cohub.run/asr/ws"
6
7
  },
7
8
  dev: {
8
9
  apiBaseUrl: "https://api-dev.cohub.run",
9
- websocketUrl: "wss://gateway-dev.cohub.run/ws"
10
+ websocketUrl: "wss://gateway-dev.cohub.run/ws",
11
+ voiceInputWebsocketUrl: "wss://gateway-dev.cohub.run/asr/ws"
10
12
  }
11
13
  };
12
14
  const readRuntimeEnv = () => {
@@ -17,10 +19,16 @@ const resolveCohubEnvironment = (env) => {
17
19
  return readRuntimeEnv() === "dev" ? "dev" : "prod";
18
20
  };
19
21
  const normalizeBaseUrl = (url) => url.trim().replace(/\/+$/, "");
20
- const normalizeWebsocketUrl = (input) => {
21
- const withProtocol = normalizeBaseUrl(input).replace(/^http:/, "ws:").replace(/^https:/, "wss:");
22
- return withProtocol.endsWith("/ws") ? withProtocol : `${withProtocol}/ws`;
22
+ const normalizeWebsocketPath = (input, path, replacePaths = []) => {
23
+ let withProtocol = normalizeBaseUrl(input).replace(/^http:/, "ws:").replace(/^https:/, "wss:");
24
+ for (const replacePath of replacePaths) if (withProtocol.endsWith(replacePath)) {
25
+ withProtocol = withProtocol.slice(0, -replacePath.length);
26
+ break;
27
+ }
28
+ return withProtocol.endsWith(path) ? withProtocol : `${withProtocol}${path}`;
23
29
  };
30
+ const normalizeWebsocketUrl = (input) => normalizeWebsocketPath(input, "/ws", ["/asr/ws"]);
31
+ const normalizeVoiceInputWebsocketUrl = (input) => normalizeWebsocketPath(input, "/asr/ws", ["/ws"]);
24
32
  const resolveApiBaseUrl = (options = {}) => {
25
33
  if (options.baseUrl) return normalizeBaseUrl(options.baseUrl);
26
34
  return COHUB_ENVIRONMENTS[resolveCohubEnvironment(options.env)].apiBaseUrl;
@@ -29,5 +37,9 @@ const resolveWebsocketUrl = (options = {}) => {
29
37
  if (options.url) return normalizeWebsocketUrl(options.url);
30
38
  return COHUB_ENVIRONMENTS[resolveCohubEnvironment(options.env)].websocketUrl;
31
39
  };
40
+ const resolveVoiceInputWebsocketUrl = (options = {}) => {
41
+ if (options.url) return normalizeVoiceInputWebsocketUrl(options.url);
42
+ return COHUB_ENVIRONMENTS[resolveCohubEnvironment(options.env)].voiceInputWebsocketUrl;
43
+ };
32
44
  //#endregion
33
- export { resolveCohubEnvironment as a, resolveApiBaseUrl as i, normalizeBaseUrl as n, resolveWebsocketUrl as o, normalizeWebsocketUrl as r, COHUB_ENVIRONMENTS as t };
45
+ export { resolveApiBaseUrl as a, resolveWebsocketUrl as c, normalizeWebsocketUrl as i, normalizeBaseUrl as n, resolveCohubEnvironment as o, normalizeVoiceInputWebsocketUrl as r, resolveVoiceInputWebsocketUrl as s, COHUB_ENVIRONMENTS as t };
@@ -1,4 +1,6 @@
1
- import { S as CohubEnvironment, _ as SessionTurnIndexItem, a as WebsocketClientOptions, b as ContentBlock, d as SpacePublicEndpoints, f as MessageRecord, h as SessionRecord$1, l as RealtimePatchOperation, m as SessionForkRecord, p as SessionBindingRecord$1, r as WebsocketClient, s as WebsocketEventPayload, u as SessionTurnPatchEvent, v as SessionTurnRecord, y as Usage } from "./websocket.js";
1
+ import { n as CohubEnvironment } from "./environment.js";
2
+ import { C as ContentBlock, S as Usage, _ as SessionForkRecord, a as WebsocketClientOptions, b as SessionTurnIndexItem, d as RealtimePatchOperation, g as SessionBindingRecord$1, h as MessageRecord, m as SpacePublicEndpoints, p as SessionTurnPatchEvent, r as WebsocketClient, s as WebsocketEventPayload, v as SessionRecord$1, x as SessionTurnRecord } from "./websocket.js";
3
+ import { a as VoiceInputCreateOptions } from "./voice-input.js";
2
4
 
3
5
  //#region src/transport.d.ts
4
6
  type Fetch = typeof globalThis.fetch;
@@ -23,6 +25,7 @@ type CohubClientOptions = {
23
25
  clearStoredAuthToken?: () => void;
24
26
  fetch?: Fetch;
25
27
  websocket?: WebsocketClientOptions;
28
+ voice?: VoiceInputCreateOptions;
26
29
  };
27
30
  declare class HttpError extends Error {
28
31
  readonly status: number;
@@ -825,6 +828,11 @@ type GlobalSearchResponse = {
825
828
  source: "remote";
826
829
  degraded?: boolean;
827
830
  };
831
+ type CreateSpaceSessionInput = {
832
+ title?: string | null;
833
+ source?: string | null;
834
+ labelRefs?: string[];
835
+ };
828
836
  type SpaceSessionsResponse = {
829
837
  sessions: SessionRecord[];
830
838
  forks?: Array<SessionForkRecord & {
@@ -846,6 +854,7 @@ type CreateSpacePromptInput = {
846
854
  clientMessageId?: string | null;
847
855
  generationPolicy?: GenerationPolicy | null;
848
856
  accessMode?: PromptAccessMode | null;
857
+ labelRefs?: string[];
849
858
  schedule?: {
850
859
  mode?: "immediate";
851
860
  } | {
@@ -936,7 +945,7 @@ type SpaceMember = {
936
945
  updatedAt: string;
937
946
  };
938
947
  type LabelScopeType = "space" | "user" | "org";
939
- type LabelSource = "user" | "migration" | "system";
948
+ type LabelSource = "user" | "system";
940
949
  type LabelResourceType = "session" | "checkpoint" | "file";
941
950
  type LabelRecord = {
942
951
  id: string;
@@ -1579,10 +1588,7 @@ declare class SpaceSessionsApi {
1579
1588
  private readonly spaceId;
1580
1589
  private readonly websocketClient;
1581
1590
  constructor(transport: HttpTransport, spaceId: string, websocketClient: WebsocketClient | null);
1582
- create(input?: {
1583
- title?: string;
1584
- source?: string;
1585
- }): Promise<{
1591
+ create(input?: CreateSpaceSessionInput): Promise<{
1586
1592
  ok: true;
1587
1593
  session: SessionRecord;
1588
1594
  }>;
@@ -1746,46 +1752,46 @@ declare class SpaceLabelsApi {
1746
1752
  list(): Promise<{
1747
1753
  labels: LabelListItem[];
1748
1754
  }>;
1749
- create(input: {
1750
- name: string;
1751
- parentId?: string | null;
1752
- }): Promise<{
1753
- label: LabelListItem;
1755
+ create(labelRef: string): Promise<{
1756
+ labels: LabelListItem[];
1754
1757
  }>;
1755
- update(labelId: string, input: {
1758
+ update(labelRef: string, input: {
1756
1759
  name?: string;
1757
- parentId?: string | null;
1760
+ parentRef?: string | null;
1758
1761
  rank?: number;
1759
1762
  }): Promise<{
1760
1763
  label: LabelListItem;
1761
1764
  }>;
1762
- delete(labelId: string): Promise<{
1765
+ delete(labelRef: string): Promise<{
1763
1766
  ok: true;
1764
1767
  }>;
1765
- reorder(labelIds: string[]): Promise<{
1768
+ reorder(labelRefs: string[]): Promise<{
1766
1769
  labels: LabelListItem[];
1767
1770
  }>;
1768
- listItems(labelId: string, input?: {
1771
+ listItems(labelRef: string, input?: {
1769
1772
  limit?: number;
1770
1773
  cursor?: string | null;
1771
1774
  }): Promise<{
1772
1775
  items: LabelAssignmentListItem[];
1773
1776
  pageInfo: LabelAssignmentPageInfo;
1774
1777
  }>;
1775
- addItem(labelId: string, input: {
1778
+ attach(labelRef: string, input: {
1776
1779
  resourceType: LabelResourceType;
1777
1780
  resourceRef: string;
1778
1781
  }): Promise<{
1779
1782
  assignment: LabelAssignmentRecord;
1780
1783
  }>;
1781
- deleteItem(labelId: string, assignmentId: string): Promise<{
1784
+ detach(labelRef: string, input: {
1785
+ resourceType: LabelResourceType;
1786
+ resourceRef: string;
1787
+ }): Promise<{
1782
1788
  ok: true;
1783
1789
  }>;
1784
1790
  getResourceLabels(resourceType: LabelResourceType, resourceRef: string): Promise<{
1785
1791
  labels: LabelListItem[];
1786
1792
  assignments: LabelAssignmentRecord[];
1787
1793
  }>;
1788
- setResourceLabels(resourceType: LabelResourceType, resourceRef: string, labelIds: string[]): Promise<{
1794
+ setResourceLabels(resourceType: LabelResourceType, resourceRef: string, labelRefs: string[]): Promise<{
1789
1795
  labels: LabelListItem[];
1790
1796
  assignments: LabelAssignmentRecord[];
1791
1797
  }>;
@@ -1902,4 +1908,4 @@ declare class CohubHttpClient {
1902
1908
  }
1903
1909
  declare const createHttpClient: (options?: CohubClientOptions) => CohubHttpClient;
1904
1910
  //#endregion
1905
- export { BillingOpenOverageStatus as $, CreateGenerationTaskResponse as $n, SessionTurnStreamSnapshotResponse as $t, SessionPatchStatus as A, SpaceFsUploadPlanEntryInput as An, LabelAssignmentListItem as At, GenerationsApi as B, SpaceRecord as Bn, Permission as Bt, SessionGenerationStreamClient as C, SpaceFsReadFilesInput as Cn, GlobalSearchResponse as Ct, SessionPatchApplyResult as D, SpaceFsUploadEntry as Dn, JsonObject as Dt, SessionPatchApplyInput as E, SpaceFsUploadDestination as En, InvitationDetail as Et, CreatePublicAssetUploadResponse as F, SpaceListItem as Fn, LabelResourceType as Ft, BillingCatalog as G, SpaceUsageHourlyStat as Gn, SessionBindingRecord as Gt, ChannelsApi as H, SpaceSandboxAutoDestroyPolicy as Hn, PromptTemplateCatalogEntry as Ht, PublicAssetPurpose as I, SpaceMember as In, LabelScopeType as It, BillingCreditExpiryGroup as J, TaskRunDetailResponse as Jn, SessionMessagesResponse as Jt, BillingCatalogProduct as K, SpaceUsageResponse as Kn, SessionMessageResponse as Kt, PublicAssetsApi as L, SpaceMeta as Ln, LabelSource as Lt, SessionAccessApi as M, SpaceFsUploadResponse as Mn, LabelAssignmentRecord as Mt, SearchApi as N, SpaceFsWriteFileInput as Nn, LabelListItem as Nt, SessionPatchReducer as O, SpaceFsUploadError as On, JsonPrimitive as Ot, CreatePublicAssetUploadInput as P, SpaceInvitation as Pn, LabelRecord as Pt, BillingOpenOverageList as Q, CreateGenerationTaskRequest as Qn, SessionTurnSignedUrlsResponse as Qt, PromptsApi as R, SpaceModListItem as Rn, MeResponse as Rt, GenerationStreamTurnUpdatedEvent as S, SpaceFsReadFilesError as Sn, RawHttpResponse as Sr, ExploreSpacesResponse as St, parseAssistantMessageCommit as T, SpaceFsTreeResponse as Tn, GlobalSearchType as Tt, AcceptInvitationResponse as U, SpaceSandboxConfig as Un, PromptTemplateCatalogResponse as Ut, CronJobsApi as V, SpaceRole as Vn, PromptAccessMode as Vt, ApiError as W, SpaceSessionsResponse as Wn, ResourceLabelsResponse as Wt, BillingCreditStatus as X, UserProfile as Xn, SessionTurnIndexResponse as Xt, BillingCreditGrantStatus as Y, TaskRunRecord as Yn, SessionRecord as Yt, BillingCreditUnit as Z, UserRulesResponse as Zn, SessionTurnResponse as Zt, GenerationStreamFinalizedEvent as _, SpaceFsEntry as _n, DiscordChannelConfig as _r, CreateSpacePromptInput as _t, SessionEventName as a, SpaceChannelBindingInput as an, GenerationPolicy as ar, BillingProductKind as at, GenerationStreamStateEvent as b, SpaceFsMoveInput as bn, HttpError as br, ExploreSection as bt, SpaceClient as c, SpaceConfigInput as cn, decodeGenerationPolicy as cr, BillingSubscriptionSummary as ct, WebSocketConnectionState as d, SpaceEnvInput as dn, findGenerationModelPolicy as dr, Channel as dt, SessionTurnWindowResponse as en, GenerationTaskResult as er, BillingPaymentStatus as et, PublicInviteApi as f, SpaceFsCompleteUploadInput as fn, getAllowedGenerationModelIds as fr, CheckpointRecord as ft, GenerationStreamEvent as g, SpaceFsEncoding as gn, ChannelConfig as gr, CreateSpaceModInput as gt, GenerationStreamErrorEvent as h, SpaceFsCreateUploadResponse as hn, GenerationContentBlock as hr, CreateSpaceInput as ht, TasksApi as i, SpaceBootstrapSource as in, GenerationParameterConstraint as ir, BillingProductDisplay as it, createSessionPatchReducer as j, SpaceFsUploadProgress as jn, LabelAssignmentPageInfo as jt, SessionPatchState as k, SpaceFsUploadPlanEntry as kn, JsonValue as kt, SpaceEventName as l, SpaceConfigResponse as ln, encodeGenerationPolicy as lr, BillingUsageRecordList as lt, GenerationStreamCommitEvent as m, SpaceFsCreateUploadInput as mn, parseGenerationPolicyFromEnv as mr, CreateInvitationResponse as mt, createHttpClient as n, SpaceAccess as nn, PublicGenerationDeclaration as nr, BillingProductBillingInterval as nt, SessionSubscriptionHandlers as o, SpaceCheckpointDetailResponse as on, GenerationPolicyError as or, BillingProductPricing as ot, AssistantMessageCommit as p, SpaceFsCompleteUploadResponse as pn, normalizeGenerationPolicy as pr, CreateInvitationInput as pt, BillingCheckoutResult as q, SpaceUsageSummary as qn, SessionMessagesPaginatedResponse as qt, UserApi as r, SpaceAccessPolicy as rn, GenerationModelPolicy as rr, BillingProductCreditBenefit as rt, SpaceChannelBindingRecord as s, SpaceConfig as sn, assertGenerationRequestAllowedByPolicy as sr, BillingRedemptionResult as st, CohubHttpClient as t, SessionTurnsPaginatedResponse as tn, ListGenerationModelsResponse as tr, BillingPluginStatus as tt, SpacesApi as u, SpaceCreateResponse as un, filterGenerationDeclarationsByPolicy as ur, BillingUsageRecordStatus as ut, GenerationStreamIntermediateMessage as v, SpaceFsFileKind as vn, CohubClientOptions as vr, CreateSpacePromptResponse as vt, createSessionGenerationStreamClient as w, SpaceFsReadFilesResponse as wn, GlobalSearchResult as wt, GenerationStreamSubscriptionHandlers as x, SpaceFsPreparingFile as xn, HttpTransport as xr, ExploreSpaceItem as xt, GenerationStreamOutOfSyncEvent as y, SpaceFsFileResponse as yn, Fetch as yr, CronJobRecord as yt, ModelsApi as z, SpacePublicProfile as zn, ModelCatalogEntry as zt };
1911
+ export { BillingOpenOverageStatus as $, CreateGenerationTaskRequest as $n, SessionTurnSignedUrlsResponse as $t, SessionPatchStatus as A, SpaceFsUploadPlanEntry as An, JsonValue as At, GenerationsApi as B, SpacePublicProfile as Bn, ModelCatalogEntry as Bt, SessionGenerationStreamClient as C, SpaceFsReadFilesError as Cn, RawHttpResponse as Cr, ExploreSpacesResponse as Ct, SessionPatchApplyResult as D, SpaceFsUploadDestination as Dn, InvitationDetail as Dt, SessionPatchApplyInput as E, SpaceFsTreeResponse as En, GlobalSearchType as Et, CreatePublicAssetUploadResponse as F, SpaceInvitation as Fn, LabelRecord as Ft, BillingCatalog as G, SpaceSessionsResponse as Gn, ResourceLabelsResponse as Gt, ChannelsApi as H, SpaceRole as Hn, PromptAccessMode as Ht, PublicAssetPurpose as I, SpaceListItem as In, LabelResourceType as It, BillingCreditExpiryGroup as J, SpaceUsageSummary as Jn, SessionMessagesPaginatedResponse as Jt, BillingCatalogProduct as K, SpaceUsageHourlyStat as Kn, SessionBindingRecord as Kt, PublicAssetsApi as L, SpaceMember as Ln, LabelScopeType as Lt, SessionAccessApi as M, SpaceFsUploadProgress as Mn, LabelAssignmentPageInfo as Mt, SearchApi as N, SpaceFsUploadResponse as Nn, LabelAssignmentRecord as Nt, SessionPatchReducer as O, SpaceFsUploadEntry as On, JsonObject as Ot, CreatePublicAssetUploadInput as P, SpaceFsWriteFileInput as Pn, LabelListItem as Pt, BillingOpenOverageList as Q, UserRulesResponse as Qn, SessionTurnResponse as Qt, PromptsApi as R, SpaceMeta as Rn, LabelSource as Rt, GenerationStreamTurnUpdatedEvent as S, SpaceFsPreparingFile as Sn, HttpTransport as Sr, ExploreSpaceItem as St, parseAssistantMessageCommit as T, SpaceFsReadFilesResponse as Tn, GlobalSearchResult as Tt, AcceptInvitationResponse as U, SpaceSandboxAutoDestroyPolicy as Un, PromptTemplateCatalogEntry as Ut, CronJobsApi as V, SpaceRecord as Vn, Permission as Vt, ApiError as W, SpaceSandboxConfig as Wn, PromptTemplateCatalogResponse as Wt, BillingCreditStatus as X, TaskRunRecord as Xn, SessionRecord as Xt, BillingCreditGrantStatus as Y, TaskRunDetailResponse as Yn, SessionMessagesResponse as Yt, BillingCreditUnit as Z, UserProfile as Zn, SessionTurnIndexResponse as Zt, GenerationStreamFinalizedEvent as _, SpaceFsEncoding as _n, ChannelConfig as _r, CreateSpacePromptInput as _t, SessionEventName as a, SpaceBootstrapSource as an, GenerationParameterConstraint as ar, BillingProductKind as at, GenerationStreamStateEvent as b, SpaceFsFileResponse as bn, Fetch as br, CronJobRecord as bt, SpaceClient as c, SpaceConfig as cn, assertGenerationRequestAllowedByPolicy as cr, BillingSubscriptionSummary as ct, WebSocketConnectionState as d, SpaceCreateResponse as dn, filterGenerationDeclarationsByPolicy as dr, Channel as dt, SessionTurnStreamSnapshotResponse as en, CreateGenerationTaskResponse as er, BillingPaymentStatus as et, PublicInviteApi as f, SpaceEnvInput as fn, findGenerationModelPolicy as fr, CheckpointRecord as ft, GenerationStreamEvent as g, SpaceFsCreateUploadResponse as gn, GenerationContentBlock as gr, CreateSpaceModInput as gt, GenerationStreamErrorEvent as h, SpaceFsCreateUploadInput as hn, parseGenerationPolicyFromEnv as hr, CreateSpaceInput as ht, TasksApi as i, SpaceAccessPolicy as in, GenerationModelPolicy as ir, BillingProductDisplay as it, createSessionPatchReducer as j, SpaceFsUploadPlanEntryInput as jn, LabelAssignmentListItem as jt, SessionPatchState as k, SpaceFsUploadError as kn, JsonPrimitive as kt, SpaceEventName as l, SpaceConfigInput as ln, decodeGenerationPolicy as lr, BillingUsageRecordList as lt, GenerationStreamCommitEvent as m, SpaceFsCompleteUploadResponse as mn, normalizeGenerationPolicy as mr, CreateInvitationResponse as mt, createHttpClient as n, SessionTurnsPaginatedResponse as nn, ListGenerationModelsResponse as nr, BillingProductBillingInterval as nt, SessionSubscriptionHandlers as o, SpaceChannelBindingInput as on, GenerationPolicy as or, BillingProductPricing as ot, AssistantMessageCommit as p, SpaceFsCompleteUploadInput as pn, getAllowedGenerationModelIds as pr, CreateInvitationInput as pt, BillingCheckoutResult as q, SpaceUsageResponse as qn, SessionMessageResponse as qt, UserApi as r, SpaceAccess as rn, PublicGenerationDeclaration as rr, BillingProductCreditBenefit as rt, SpaceChannelBindingRecord as s, SpaceCheckpointDetailResponse as sn, GenerationPolicyError as sr, BillingRedemptionResult as st, CohubHttpClient as t, SessionTurnWindowResponse as tn, GenerationTaskResult as tr, BillingPluginStatus as tt, SpacesApi as u, SpaceConfigResponse as un, encodeGenerationPolicy as ur, BillingUsageRecordStatus as ut, GenerationStreamIntermediateMessage as v, SpaceFsEntry as vn, DiscordChannelConfig as vr, CreateSpacePromptResponse as vt, createSessionGenerationStreamClient as w, SpaceFsReadFilesInput as wn, GlobalSearchResponse as wt, GenerationStreamSubscriptionHandlers as x, SpaceFsMoveInput as xn, HttpError as xr, ExploreSection as xt, GenerationStreamOutOfSyncEvent as y, SpaceFsFileKind as yn, CohubClientOptions as yr, CreateSpaceSessionInput as yt, ModelsApi as z, SpaceModListItem as zn, MeResponse as zt };
@@ -1,4 +1,4 @@
1
- import { i as resolveApiBaseUrl } from "./environment.js";
1
+ import { a as resolveApiBaseUrl } from "./environment.js";
2
2
  //#region src/apis/channels.ts
3
3
  var ChannelsApi = class {
4
4
  transport;
@@ -1679,57 +1679,70 @@ var SpaceLabelsApi = class {
1679
1679
  list() {
1680
1680
  return this.transport.request(`/api/spaces/${this.spaceId}/labels`);
1681
1681
  }
1682
- create(input) {
1682
+ create(labelRef) {
1683
1683
  return this.transport.request(`/api/spaces/${this.spaceId}/labels`, {
1684
1684
  method: "POST",
1685
1685
  headers: { "Content-Type": "application/json" },
1686
- body: JSON.stringify(input)
1686
+ body: JSON.stringify({ labelRef })
1687
1687
  });
1688
1688
  }
1689
- update(labelId, input) {
1690
- return this.transport.request(`/api/spaces/${this.spaceId}/labels/${labelId}`, {
1689
+ update(labelRef, input) {
1690
+ return this.transport.request(`/api/spaces/${this.spaceId}/labels/by-ref`, {
1691
1691
  method: "PATCH",
1692
1692
  headers: { "Content-Type": "application/json" },
1693
- body: JSON.stringify(input)
1693
+ body: JSON.stringify({
1694
+ labelRef,
1695
+ ...input
1696
+ })
1694
1697
  });
1695
1698
  }
1696
- delete(labelId) {
1697
- return this.transport.request(`/api/spaces/${this.spaceId}/labels/${labelId}`, { method: "DELETE" });
1699
+ delete(labelRef) {
1700
+ const params = new URLSearchParams({ ref: labelRef });
1701
+ return this.transport.request(`/api/spaces/${this.spaceId}/labels/by-ref?${params.toString()}`, { method: "DELETE" });
1698
1702
  }
1699
- reorder(labelIds) {
1703
+ reorder(labelRefs) {
1700
1704
  return this.transport.request(`/api/spaces/${this.spaceId}/labels/reorder`, {
1701
1705
  method: "POST",
1702
1706
  headers: { "Content-Type": "application/json" },
1703
- body: JSON.stringify({ labelIds })
1707
+ body: JSON.stringify({ labelRefs })
1704
1708
  });
1705
1709
  }
1706
- listItems(labelId, input) {
1707
- const params = new URLSearchParams();
1710
+ listItems(labelRef, input) {
1711
+ const params = new URLSearchParams({ ref: labelRef });
1708
1712
  if (input?.limit) params.set("limit", String(input.limit));
1709
1713
  if (input?.cursor) params.set("cursor", input.cursor);
1710
- const query = params.toString();
1711
- return this.transport.request(`/api/spaces/${this.spaceId}/labels/${labelId}/items${query ? `?${query}` : ""}`);
1714
+ return this.transport.request(`/api/spaces/${this.spaceId}/labels/items?${params.toString()}`);
1712
1715
  }
1713
- addItem(labelId, input) {
1714
- return this.transport.request(`/api/spaces/${this.spaceId}/labels/${labelId}/items`, {
1716
+ attach(labelRef, input) {
1717
+ return this.transport.request(`/api/spaces/${this.spaceId}/labels/attach`, {
1715
1718
  method: "POST",
1716
1719
  headers: { "Content-Type": "application/json" },
1717
- body: JSON.stringify(input)
1720
+ body: JSON.stringify({
1721
+ labelRef,
1722
+ ...input
1723
+ })
1718
1724
  });
1719
1725
  }
1720
- deleteItem(labelId, assignmentId) {
1721
- return this.transport.request(`/api/spaces/${this.spaceId}/labels/${labelId}/items/${assignmentId}`, { method: "DELETE" });
1726
+ detach(labelRef, input) {
1727
+ return this.transport.request(`/api/spaces/${this.spaceId}/labels/detach`, {
1728
+ method: "POST",
1729
+ headers: { "Content-Type": "application/json" },
1730
+ body: JSON.stringify({
1731
+ labelRef,
1732
+ ...input
1733
+ })
1734
+ });
1722
1735
  }
1723
1736
  getResourceLabels(resourceType, resourceRef) {
1724
1737
  const params = new URLSearchParams({ resourceRef });
1725
1738
  return this.transport.request(`/api/spaces/${this.spaceId}/resources/${resourceType}/labels?${params.toString()}`);
1726
1739
  }
1727
- setResourceLabels(resourceType, resourceRef, labelIds) {
1740
+ setResourceLabels(resourceType, resourceRef, labelRefs) {
1728
1741
  const params = new URLSearchParams({ resourceRef });
1729
1742
  return this.transport.request(`/api/spaces/${this.spaceId}/resources/${resourceType}/labels?${params.toString()}`, {
1730
1743
  method: "PUT",
1731
1744
  headers: { "Content-Type": "application/json" },
1732
- body: JSON.stringify({ labelIds })
1745
+ body: JSON.stringify({ labelRefs })
1733
1746
  });
1734
1747
  }
1735
1748
  };
@@ -0,0 +1,94 @@
1
+ import { n as CohubEnvironment } from "./environment.js";
2
+
3
+ //#region src/voice-input.d.ts
4
+ type VoiceInputEvent = {
5
+ type: string;
6
+ payload?: Record<string, unknown>;
7
+ };
8
+ type VoiceInputCallbacks = {
9
+ onPartial?: (text: string) => void;
10
+ onFinal?: (text: string) => void;
11
+ onError?: (message: string) => void;
12
+ onDone?: () => void;
13
+ };
14
+ type VoiceInputClientOptions = {
15
+ env?: CohubEnvironment;
16
+ url?: string;
17
+ getAccessToken?: (options?: {
18
+ forceRefresh?: boolean;
19
+ }) => Promise<string | null> | string | null;
20
+ WebSocketImpl?: WebSocketConstructor;
21
+ connectionTimeoutMs?: number;
22
+ idleConnectionTimeoutMs?: number;
23
+ callbacks?: VoiceInputCallbacks;
24
+ };
25
+ type VoiceInputCreateOptions = Omit<VoiceInputClientOptions, "callbacks">;
26
+ type WebSocketLike = {
27
+ readonly readyState: number;
28
+ onopen: ((event: Event) => void) | null;
29
+ onmessage: ((event: MessageEvent) => void) | null;
30
+ onerror: ((event: Event) => void) | null;
31
+ onclose: ((event: CloseEvent) => void) | null;
32
+ send(data: string): void;
33
+ close(code?: number, reason?: string): void;
34
+ };
35
+ type WebSocketConstructor = new (url: string) => WebSocketLike;
36
+ declare class VoiceInputClient {
37
+ private readonly url;
38
+ private readonly getAccessToken?;
39
+ private readonly WebSocketImpl;
40
+ private readonly connectionTimeoutMs;
41
+ private readonly idleConnectionTimeoutMs;
42
+ private readonly callbacks;
43
+ private socket;
44
+ private stream;
45
+ private audioContext;
46
+ private processor;
47
+ private source;
48
+ private pendingSamples;
49
+ private pendingAudio;
50
+ private started;
51
+ private asrStarted;
52
+ private authenticated;
53
+ private intentionalClose;
54
+ private startPromise;
55
+ private socketOpenPromise;
56
+ private idleCloseTimer;
57
+ private authWaiter;
58
+ private asrStartWaiter;
59
+ constructor(options?: VoiceInputClientOptions);
60
+ start(): Promise<void>;
61
+ stop(): void;
62
+ cancel(): void;
63
+ close(): void;
64
+ private startInternal;
65
+ private withConnectionTimeout;
66
+ private ensureAuthenticatedSocket;
67
+ private ensureSocketOpen;
68
+ private authenticate;
69
+ private startAsrSession;
70
+ private createAuthWaiter;
71
+ private resolveAuthWaiter;
72
+ private rejectAuthWaiter;
73
+ private createAsrStartWaiter;
74
+ private resolveAsrStartWaiter;
75
+ private rejectAsrStartWaiter;
76
+ private closeWithError;
77
+ private setupAudio;
78
+ private sendAudio;
79
+ private flushPendingAudio;
80
+ private send;
81
+ private handleMessage;
82
+ private cleanupAudio;
83
+ private scheduleIdleClose;
84
+ private clearIdleCloseTimer;
85
+ private closeSocket;
86
+ }
87
+ declare class VoiceApi {
88
+ private readonly defaults;
89
+ constructor(defaults?: VoiceInputCreateOptions);
90
+ createInputClient(callbacks?: VoiceInputCallbacks, options?: VoiceInputCreateOptions): VoiceInputClient;
91
+ }
92
+ declare const createVoiceInputClient: (options?: VoiceInputClientOptions) => VoiceInputClient;
93
+ //#endregion
94
+ export { VoiceInputCreateOptions as a, WebSocketLike as c, VoiceInputClientOptions as i, createVoiceInputClient as l, VoiceInputCallbacks as n, VoiceInputEvent as o, VoiceInputClient as r, WebSocketConstructor as s, VoiceApi as t };