@vibes.diy/api-types 2.6.8 → 2.6.10

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/index.d.ts CHANGED
@@ -23,6 +23,7 @@ export * from "./report.js";
23
23
  export * from "./direct-channel.js";
24
24
  export * from "./notifications.js";
25
25
  export * from "./access-function.js";
26
+ export * from "./shard-policy.js";
26
27
  export interface FetchOkResult {
27
28
  type: "fetch.ok";
28
29
  url: string;
package/index.js CHANGED
@@ -22,6 +22,7 @@ export * from "./report.js";
22
22
  export * from "./direct-channel.js";
23
23
  export * from "./notifications.js";
24
24
  export * from "./access-function.js";
25
+ export * from "./shard-policy.js";
25
26
  export function isFetchOkResult(result) {
26
27
  return result.type === "fetch.ok";
27
28
  }
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../jsr/index.ts"],"names":[],"mappings":"AAEA,cAAc,YAAY,CAAC;AAC3B,cAAc,yBAAyB,CAAC;AACxC,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AAEjC,cAAc,qBAAqB,CAAC;AAEpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,aAAa,CAAC;AAE5B,cAAc,aAAa,CAAC;AAC5B,cAAc,WAAW,CAAC;AAE1B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,cAAc,CAAC;AAC7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AAQrC,MAAM,UAAU,eAAe,CAAC,MA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AM,CAAC,IAAI,KAAK,gBAAgB,CAAC;AAC1C,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/api-types",
3
- "version": "2.6.8",
3
+ "version": "2.6.10",
4
4
  "type": "module",
5
5
  "main": "./index.js",
6
6
  "scripts": {
@@ -14,9 +14,9 @@
14
14
  "@fireproof/core-types-base": "~0.24.19",
15
15
  "@fireproof/core-types-protocols-cloud": "~0.24.19",
16
16
  "@fireproof/core-types-protocols-dashboard": "~0.24.19",
17
- "@vibes.diy/call-ai-v2": "2.6.8",
18
- "@vibes.diy/identity": "2.6.8",
19
- "@vibes.diy/vibe-types": "2.6.8",
17
+ "@vibes.diy/call-ai-v2": "2.6.10",
18
+ "@vibes.diy/identity": "2.6.10",
19
+ "@vibes.diy/vibe-types": "2.6.10",
20
20
  "arktype": "~2.2.1"
21
21
  },
22
22
  "repository": {
@@ -0,0 +1,84 @@
1
+ export type ShardKind = "codegen" | "vibe" | "shared";
2
+ export interface ShardIdentity {
3
+ readonly kind: ShardKind;
4
+ readonly shardId: string;
5
+ }
6
+ export type VibeShard = string & {
7
+ readonly __brand: "vibe";
8
+ };
9
+ export type SharedShard = string & {
10
+ readonly __brand: "shared";
11
+ };
12
+ export type CodegenShard = string & {
13
+ readonly __brand: "codegen";
14
+ };
15
+ export declare function openVibe(ownerHandle: string, appSlug: string): VibeShard;
16
+ export declare function openShared(shard?: string): SharedShard;
17
+ export declare function openCodegen(streamId: string): CodegenShard;
18
+ export declare function chatShardsForMode(mode: string | undefined): readonly ShardKind[];
19
+ export declare const PROBE_MODES: readonly string[];
20
+ export declare const SHARD_POLICY: {
21
+ readonly "vibes.diy.req-list-user-slug-app-slug": readonly ["codegen", "vibe", "shared"];
22
+ readonly "vibes.diy.req-list-recent-vibes": readonly ["codegen", "vibe", "shared"];
23
+ readonly "vibes.diy.req-pin-recent-vibe": readonly ["codegen", "vibe", "shared"];
24
+ readonly "vibes.diy.req-get-app-by-fsid": readonly ["codegen", "vibe", "shared"];
25
+ readonly "vibes.diy.req-ensure-app-settings": readonly ["codegen", "vibe", "shared"];
26
+ readonly "vibes.diy.req-ensure-user-settings": readonly ["codegen", "vibe", "shared"];
27
+ readonly "vibes.diy.req-ensure-handle-avatar": readonly ["codegen", "vibe", "shared"];
28
+ readonly "vibes.diy.req-list-models": readonly ["codegen", "vibe", "shared"];
29
+ readonly "vibes.diy.req-create-invite": readonly ["codegen", "vibe", "shared"];
30
+ readonly "vibes.diy.req-revoke-invite": readonly ["codegen", "vibe", "shared"];
31
+ readonly "vibes.diy.req-redeem-invite": readonly ["codegen", "vibe", "shared"];
32
+ readonly "vibes.diy.req-has-access-invite": readonly ["codegen", "vibe", "shared"];
33
+ readonly "vibes.diy.req-invite-set-role": readonly ["codegen", "vibe", "shared"];
34
+ readonly "vibes.diy.req-list-invite-grants": readonly ["codegen", "vibe", "shared"];
35
+ readonly "vibes.diy.req-request-access": readonly ["codegen", "vibe", "shared"];
36
+ readonly "vibes.diy.req-has-access-request": readonly ["codegen", "vibe", "shared"];
37
+ readonly "vibes.diy.req-approve-request": readonly ["codegen", "vibe", "shared"];
38
+ readonly "vibes.diy.req-request-set-role": readonly ["codegen", "vibe", "shared"];
39
+ readonly "vibes.diy.req-revoke-request": readonly ["codegen", "vibe", "shared"];
40
+ readonly "vibes.diy.req-list-request-grants": readonly ["codegen", "vibe", "shared"];
41
+ readonly "vibes.diy.req-subscribe-request-grants": readonly ["codegen", "vibe", "shared"];
42
+ readonly "vibes.diy.req-list-members": readonly ["codegen", "vibe", "shared"];
43
+ readonly "vibes.diy.req-list-memberships": readonly ["codegen", "vibe", "shared"];
44
+ readonly "vibe.req.whoAmI": readonly ["codegen", "vibe", "shared"];
45
+ readonly "vibe.req.accessFnSource": readonly ["codegen", "vibe", "shared"];
46
+ readonly "vibes.diy.req-subscribe-user-notifications": readonly ["codegen", "vibe", "shared"];
47
+ readonly "vibes.diy.req-list-dm-threads": readonly ["codegen", "vibe", "shared"];
48
+ readonly "vibes.diy.req-asset-upload-grant": readonly ["codegen", "vibe", "shared"];
49
+ readonly "vibes.diy.req-list-user-slug-bindings": readonly ["codegen", "vibe", "shared"];
50
+ readonly "vibes.diy.req-create-user-slug-binding": readonly ["codegen", "vibe", "shared"];
51
+ readonly "vibes.diy.req-delete-user-slug-binding": readonly ["codegen", "vibe", "shared"];
52
+ readonly reqCertFromCsr: readonly ["codegen", "vibe", "shared"];
53
+ readonly "vibes.diy.req-report-growth-memberships": readonly ["codegen", "vibe", "shared"];
54
+ readonly "vibes.diy.req-report-growth-vibes-with-data": readonly ["codegen", "vibe", "shared"];
55
+ readonly "vibes.diy.req-report-active-members": readonly ["codegen", "vibe", "shared"];
56
+ readonly "vibes.diy.req-report-top-vibes-by-members": readonly ["codegen", "vibe", "shared"];
57
+ readonly "vibes.diy.req-report-attribution-referrers": readonly ["codegen", "vibe", "shared"];
58
+ readonly "vibes.diy.req-report-campaign-health": readonly ["codegen", "vibe", "shared"];
59
+ readonly "vibes.diy.req-report-campaign-ad-previews": readonly ["codegen", "vibe", "shared"];
60
+ readonly "vibes.diy.req-get-chat-details": readonly ["codegen", "vibe", "shared"];
61
+ readonly "vibes.diy.req-get-chat-response": readonly ["codegen", "vibe", "shared"];
62
+ readonly "vibes.diy.req-list-application-chats": readonly ["codegen", "vibe", "shared"];
63
+ readonly "vibes.diy.req-put-doc": readonly ["vibe"];
64
+ readonly "vibes.diy.req-get-doc": readonly ["vibe"];
65
+ readonly "vibes.diy.req-query-docs": readonly ["vibe"];
66
+ readonly "vibes.diy.req-delete-doc": readonly ["vibe"];
67
+ readonly "vibes.diy.req-subscribe-docs": readonly ["vibe"];
68
+ readonly "vibes.diy.req-subscribe-viewer-grants": readonly ["vibe"];
69
+ readonly "vibes.diy.req-list-db-names": readonly ["vibe"];
70
+ readonly "vibes.diy.req-mark-dm-read": readonly ["vibe"];
71
+ readonly "vibes.diy.req-ensure-app-slug": readonly ["codegen"];
72
+ readonly "vibes.diy.req-open-chat": (req: {
73
+ mode?: string;
74
+ }) => readonly ShardKind[];
75
+ readonly "vibes.diy.req-prompt-chat-section": (req: {
76
+ mode?: string;
77
+ }) => readonly ShardKind[];
78
+ readonly "vibes.diy.req-fork-app": readonly ["codegen"];
79
+ readonly "vibes.diy.req-set-mode-fs": readonly ["codegen"];
80
+ };
81
+ export type ReqType = keyof typeof SHARD_POLICY;
82
+ export declare function shardsForReq(reqType: string, req: {
83
+ mode?: string;
84
+ }): readonly ShardKind[];
@@ -0,0 +1,88 @@
1
+ import { canonicalModelUsage } from "./chat.js";
2
+ export function openVibe(ownerHandle, appSlug) {
3
+ return `${ownerHandle}--${appSlug}`;
4
+ }
5
+ export function openShared(shard = "global") {
6
+ return shard;
7
+ }
8
+ export function openCodegen(streamId) {
9
+ return streamId;
10
+ }
11
+ export function chatShardsForMode(mode) {
12
+ switch (canonicalModelUsage(mode ?? "codegen")) {
13
+ case "img":
14
+ return ["codegen", "vibe"];
15
+ case "codegen":
16
+ case "runtime":
17
+ default:
18
+ return ["codegen"];
19
+ }
20
+ }
21
+ export const PROBE_MODES = ["codegen", "img", "runtime"];
22
+ const ALL_SHARDS = ["codegen", "vibe", "shared"];
23
+ const VIBE_ONLY = ["vibe"];
24
+ const CODEGEN_ONLY = ["codegen"];
25
+ export const SHARD_POLICY = {
26
+ "vibes.diy.req-list-user-slug-app-slug": ALL_SHARDS,
27
+ "vibes.diy.req-list-recent-vibes": ALL_SHARDS,
28
+ "vibes.diy.req-pin-recent-vibe": ALL_SHARDS,
29
+ "vibes.diy.req-get-app-by-fsid": ALL_SHARDS,
30
+ "vibes.diy.req-ensure-app-settings": ALL_SHARDS,
31
+ "vibes.diy.req-ensure-user-settings": ALL_SHARDS,
32
+ "vibes.diy.req-ensure-handle-avatar": ALL_SHARDS,
33
+ "vibes.diy.req-list-models": ALL_SHARDS,
34
+ "vibes.diy.req-create-invite": ALL_SHARDS,
35
+ "vibes.diy.req-revoke-invite": ALL_SHARDS,
36
+ "vibes.diy.req-redeem-invite": ALL_SHARDS,
37
+ "vibes.diy.req-has-access-invite": ALL_SHARDS,
38
+ "vibes.diy.req-invite-set-role": ALL_SHARDS,
39
+ "vibes.diy.req-list-invite-grants": ALL_SHARDS,
40
+ "vibes.diy.req-request-access": ALL_SHARDS,
41
+ "vibes.diy.req-has-access-request": ALL_SHARDS,
42
+ "vibes.diy.req-approve-request": ALL_SHARDS,
43
+ "vibes.diy.req-request-set-role": ALL_SHARDS,
44
+ "vibes.diy.req-revoke-request": ALL_SHARDS,
45
+ "vibes.diy.req-list-request-grants": ALL_SHARDS,
46
+ "vibes.diy.req-subscribe-request-grants": ALL_SHARDS,
47
+ "vibes.diy.req-list-members": ALL_SHARDS,
48
+ "vibes.diy.req-list-memberships": ALL_SHARDS,
49
+ "vibe.req.whoAmI": ALL_SHARDS,
50
+ "vibe.req.accessFnSource": ALL_SHARDS,
51
+ "vibes.diy.req-subscribe-user-notifications": ALL_SHARDS,
52
+ "vibes.diy.req-list-dm-threads": ALL_SHARDS,
53
+ "vibes.diy.req-asset-upload-grant": ALL_SHARDS,
54
+ "vibes.diy.req-list-user-slug-bindings": ALL_SHARDS,
55
+ "vibes.diy.req-create-user-slug-binding": ALL_SHARDS,
56
+ "vibes.diy.req-delete-user-slug-binding": ALL_SHARDS,
57
+ reqCertFromCsr: ALL_SHARDS,
58
+ "vibes.diy.req-report-growth-memberships": ALL_SHARDS,
59
+ "vibes.diy.req-report-growth-vibes-with-data": ALL_SHARDS,
60
+ "vibes.diy.req-report-active-members": ALL_SHARDS,
61
+ "vibes.diy.req-report-top-vibes-by-members": ALL_SHARDS,
62
+ "vibes.diy.req-report-attribution-referrers": ALL_SHARDS,
63
+ "vibes.diy.req-report-campaign-health": ALL_SHARDS,
64
+ "vibes.diy.req-report-campaign-ad-previews": ALL_SHARDS,
65
+ "vibes.diy.req-get-chat-details": ALL_SHARDS,
66
+ "vibes.diy.req-get-chat-response": ALL_SHARDS,
67
+ "vibes.diy.req-list-application-chats": ALL_SHARDS,
68
+ "vibes.diy.req-put-doc": VIBE_ONLY,
69
+ "vibes.diy.req-get-doc": VIBE_ONLY,
70
+ "vibes.diy.req-query-docs": VIBE_ONLY,
71
+ "vibes.diy.req-delete-doc": VIBE_ONLY,
72
+ "vibes.diy.req-subscribe-docs": VIBE_ONLY,
73
+ "vibes.diy.req-subscribe-viewer-grants": VIBE_ONLY,
74
+ "vibes.diy.req-list-db-names": VIBE_ONLY,
75
+ "vibes.diy.req-mark-dm-read": VIBE_ONLY,
76
+ "vibes.diy.req-ensure-app-slug": CODEGEN_ONLY,
77
+ "vibes.diy.req-open-chat": (req) => chatShardsForMode(req.mode),
78
+ "vibes.diy.req-prompt-chat-section": (req) => chatShardsForMode(req.mode),
79
+ "vibes.diy.req-fork-app": CODEGEN_ONLY,
80
+ "vibes.diy.req-set-mode-fs": CODEGEN_ONLY,
81
+ };
82
+ export function shardsForReq(reqType, req) {
83
+ const entry = SHARD_POLICY[reqType];
84
+ if (entry === undefined)
85
+ return [];
86
+ return typeof entry === "function" ? entry(req) : entry;
87
+ }
88
+ //# sourceMappingURL=shard-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shard-policy.js","sourceRoot":"","sources":["../jsr/shard-policy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAuBhD,MAAM,UAAU,QAAQ,CAAC,WAAmB,EAAE,OAAe;IAC3D,OAAO,GAAG,WAAW,KAAK,OAAO,EAAe,CAAC;AACnD,CAAC;AACD,MAAM,UAAU,UAAU,CAAC,KAAK,GAAG,QAAQ;IACzC,OAAO,KAAoB,CAAC;AAC9B,CAAC;AACD,MAAM,UAAU,WAAW,CAAC,QAAgB;IAC1C,OAAO,QAAwB,CAAC;AAClC,CAAC;AAKD,MAAM,UAAU,iBAAiB,CAAC,IAAwB;IACxD,QAAQ,mBAAmB,CAAC,IAAI,IAAI,SAAS,CAAC,EAAE,CAAC;QAC/C,KAAK,KAAK;YACR,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3
+ expectTypeOf().toEqualTypeOf();
4
+ expectTypeOf(openVibe("alice", "todo")).toEqualTypeOf();
5
+ const _bad = "alice--todo";
6
+ expectTypeOf(openShared()).toEqualTypeOf();
7
+ expectTypeOf(openCodegen("uuid")).toEqualTypeOf();
8
+ expectTypeOf().toEqualTypeOf();
9
+ expectTypeOf().toEqualTypeOf();
10
+ vibe.putDoc({ ownerHandle: "a", appSlug: "t", dbName: "d", doc: {} });
11
+ shared.putDoc({ ownerHandle: "a", appSlug: "t", dbName: "d", doc: {} });
12
+ codegen.putDoc({ ownerHandle: "a", appSlug: "t", dbName: "d", doc: {} });
13
+ shared.listModels({});
14
+ vibe.listModels({});
15
+ codegen.listModels({});
16
+ expectTypeOf().toEqualTypeOf();
17
+ expectTypeOf().toEqualTypeOf();
18
+ expectTypeOf().toEqualTypeOf();
19
+ expectTypeOf().toEqualTypeOf();
20
+ expectTypeOf().toEqualTypeOf();
21
+ vibe.openChat({ mode: "img" });
22
+ vibe.openChat({ mode: "codegen" });
23
+ codegen.openChat({ mode: "codegen" });
24
+ codegen.openChat({ mode: "img" });
25
+ //# sourceMappingURL=shard-policy.test-d.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"shard-policy.test-d.js","sourceRoot":"","sources":["../jsr/shard-policy.test-d.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAEL,QAAQ,EACR,UAAU,EACV,WAAW,GAIZ,MAAM,mBAAmB,CAAC;AAI3B,YAAY,EAAa,CAAC,aAAa,EAAiC,CAAC;AACzE,YAAY,CAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,aAAa,EAAa,CAAC;AAGnE,MAAM,IAAI,GAAc,aAAa,CAAC;AACtC,YAAY,CAAC,UAAU,EAAE,CAAC,CAAC,aAAa,EAAe,CAAC;AACxD,YAAY,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,CAAC,aAAa,EAAgB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, ResPromptChatSection, SectionEvent, ReqListModels, ResList
5
5
  import { ReqEnsureUserSettings, ResEnsureUserSettings, ReqEnsureHandleAvatar, ResEnsureHandleAvatar, ReqListApplicationChats, ResListApplicationChats, ReqEnsureAppSettings, ResEnsureAppSettings } from "./settings.js";
6
6
  import { ReqCreateInvite, ResCreateInvite, ReqRevokeInvite, ResRevokeInvite, ReqRedeemInvite, ResRedeemInviteOK, ReqHasAccessInvite, ResHasAccessInvite, ReqInviteSetRole, ResInviteSetRole, ReqListInviteGrants, ResListInviteGrants } from "./invite-flow.js";
7
7
  import { ReqListRequestGrants, ResListRequestGrants, ReqSubscribeRequestGrants, ResSubscribeRequestGrants, ReqRequestAccess, ResRequestAccess, ReqApproveRequest, ResApproveRequest, ReqRequestSetRole, ResRequestSetRole, ReqRevokeRequest, ResRevokeRequest, ReqHasAccessRequest, ResHasAccessRequest, EvtRequestGrant } from "./request-access.js";
8
- import { ResSubscribeUserNotifications, EvtUserNotification } from "./notifications.js";
8
+ import { ResSubscribeUserNotifications, EvtUserNotification, ReqSubscribeUserNotificationsRaw } from "./notifications.js";
9
9
  import { ReqPutDoc, ResPutDoc, ReqGetDoc, ResGetDoc, ResGetDocNotFound, ReqQueryDocs, ResQueryDocs, ReqDeleteDoc, ResDeleteDoc, ReqSubscribeDocs, ResSubscribeDocs, ReqSubscribeViewerGrants, ResSubscribeViewerGrants, EvtViewerGrantsChanged, ReqListDbNames, ResListDbNames, ReqListDmThreads, ResListDmThreads, ReqMarkDmRead, ResMarkDmRead } from "./app-documents.js";
10
10
  import { ReqListMembers, ResListMembers } from "./members.js";
11
11
  import { ReqListMemberships, ResListMemberships } from "./memberships.js";
@@ -14,6 +14,7 @@ import { ReqAssetUploadGrant, ResAssetUploadGrant } from "./asset.js";
14
14
  import { ReqReportGrowthMemberships, ResReportGrowthMemberships, ReqReportGrowthVibesWithData, ResReportGrowthVibesWithData, ReqReportActiveMembers, ResReportActiveMembers, ReqReportTopVibesByMembers, ResReportTopVibesByMembers, ReqReportAttributionReferrers, ResReportAttributionReferrers, ReqReportCampaignHealth, ResReportCampaignHealth } from "./report.js";
15
15
  import { LLMRequest } from "@vibes.diy/call-ai-v2";
16
16
  import { DashAuthType, ReqCertFromCsr, ResCertFromCsr, VerifiedClaimsResult, ClerkClaim } from "@vibes.diy/identity";
17
+ import type { ShardKind, ReqType, SHARD_POLICY } from "./shard-policy.js";
17
18
  export declare const LLMChatEntry: import("arktype/internal/variants/object.ts").ObjectType<{
18
19
  tid: string;
19
20
  chatId: string;
@@ -37,7 +38,14 @@ export interface LLMChat extends LLMChatEntry {
37
38
  export interface OptionalAuth {
38
39
  readonly auth?: DashAuthType;
39
40
  }
40
- export type Req<T> = T extends unknown ? Omit<T, "type" | "auth"> & OptionalAuth : never;
41
+ export type Req<T> = T extends unknown ? Omit<T, "type" | "auth"> & OptionalAuth & {
42
+ readonly __reqType?: T extends {
43
+ type: infer Ty;
44
+ } ? Ty : never;
45
+ } : never;
46
+ export type MethodReqType<M> = M extends (req: infer R) => unknown ? (R extends {
47
+ __reqType?: infer Ty;
48
+ } ? Ty : never) : never;
41
49
  export interface VibesDiyApiIface<_T = unknown> {
42
50
  close(): Promise<void>;
43
51
  ensureAppSlug(req: Req<ReqEnsureAppSlug>): Promise<Result<ResEnsureAppSlug, VibesDiyError>>;
@@ -98,8 +106,17 @@ export interface VibesDiyApiIface<_T = unknown> {
98
106
  onDocChanged(fn: (ownerHandle: string, appSlug: string, dbName: string, docId: string) => void): () => void;
99
107
  onRequestGrant(fn: (evt: EvtRequestGrant) => void): () => void;
100
108
  onViewerGrantsChanged(fn: (evt: EvtViewerGrantsChanged) => void): () => void;
101
- subscribeUserNotifications(req: Req<{
102
- auth?: unknown;
103
- }>): Promise<Result<ResSubscribeUserNotifications, VibesDiyError>>;
109
+ subscribeUserNotifications(req: Req<ReqSubscribeUserNotificationsRaw>): Promise<Result<ResSubscribeUserNotifications, VibesDiyError>>;
104
110
  onUserNotification(fn: (evt: EvtUserNotification) => void): () => void;
105
111
  }
112
+ type StaticShards<T extends ReqType> = (typeof SHARD_POLICY)[T] extends readonly ShardKind[] ? (typeof SHARD_POLICY)[T][number] : never;
113
+ type AvailableMethods<K extends ShardKind> = {
114
+ [M in keyof VibesDiyApiIface as [MethodReqType<VibesDiyApiIface[M]>] extends [never] ? M : MethodReqType<VibesDiyApiIface[M]> extends ReqType ? K extends StaticShards<MethodReqType<VibesDiyApiIface[M]>> ? M : never : M]: VibesDiyApiIface[M];
115
+ };
116
+ type ChatOverrides<K extends ShardKind> = K extends "vibe" ? {
117
+ openChat(req: Req<ReqOpenChat> & {
118
+ mode: "img";
119
+ }): ReturnType<VibesDiyApiIface["openChat"]>;
120
+ } : Pick<VibesDiyApiIface, "openChat">;
121
+ export type Conn<K extends ShardKind> = Omit<AvailableMethods<K>, "openChat"> & ChatOverrides<K>;
122
+ export {};
@@ -1 +1 @@
1
- {"version":3,"file":"vibes-diy-api.js","sourceRoot":"","sources":["../jsr/vibes-diy-api.ts"],"names":[],"mappings":"AAuHA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAI/B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC"}
1
+ {"version":3,"file":"vibes-diy-api.js","sourceRoot":"","sources":["../jsr/vibes-diy-api.ts"],"names":[],"mappings":"AAuHA,OAAO,EAAE,IAAI,EAAE,MAAM,SAAS,CAAC;AAK/B,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC;IAC/B,GAAG,EAAE,QAAQ;IACb,MAAM,EAAE,QAAQ;IAChB,WAAW,EAAE,QAAQ;IACrB,OAAO,EAAE,QAAQ;CAClB,CAAC,CAAC"}