@vibes.diy/api-types 14.3.326 → 14.3.327

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/cf-env.d.ts CHANGED
@@ -59,6 +59,8 @@ export interface CFEnv {
59
59
  ASC_PRIVATE_KEY?: string;
60
60
  SIGHTENGINE_API_USER?: string;
61
61
  SIGHTENGINE_API_SECRET?: string;
62
+ VIBES_ADMIN_USER_IDS?: string;
63
+ MODERATION_FIRST_RESPONDER_USER_ID?: string;
62
64
  SESSIONS: DurableObjectNamespace;
63
65
  CODEGEN_SESSIONS: DurableObjectNamespace;
64
66
  USER_NOTIFY: DurableObjectNamespace;
@@ -95,6 +97,8 @@ export interface CFEnv {
95
97
  TEXT_PHONE_SALT?: string;
96
98
  TEXT_LINES?: string;
97
99
  TEXT_CHAT: DurableObjectNamespace;
100
+ MAC_BRIDGE: DurableObjectNamespace;
101
+ MAC_BRIDGE_SALT?: string;
98
102
  CLOUDFLARE_ANALYTICS_TOKEN?: string;
99
103
  CLOUDFLARE_ZONE_TAG?: string;
100
104
  POSTHOG_QUERY_API_KEY?: string;
package/index.d.ts CHANGED
@@ -14,6 +14,7 @@ export * from "./agent-chat.js";
14
14
  export * from "./agent-fold.js";
15
15
  export * from "./agent-reply-fold.js";
16
16
  export * from "./text-turn.js";
17
+ export * from "./mac-bridge-wire.js";
17
18
  export * from "./guest-principal.js";
18
19
  export * from "./chat-chips.js";
19
20
  export * from "./agent-tools.js";
package/index.js CHANGED
@@ -13,6 +13,7 @@ export * from "./agent-chat.js";
13
13
  export * from "./agent-fold.js";
14
14
  export * from "./agent-reply-fold.js";
15
15
  export * from "./text-turn.js";
16
+ export * from "./mac-bridge-wire.js";
16
17
  export * from "./guest-principal.js";
17
18
  export * from "./chat-chips.js";
18
19
  export * from "./agent-tools.js";
@@ -0,0 +1,87 @@
1
+ export declare const MAC_BRIDGE_VERBS: readonly ["sendText", "sendDirect", "sendAttachment", "fetchPhoto", "discardPhoto", "participants", "messagesSince", "react", "markRead", "contactsEnsure", "metric"];
2
+ export type MacBridgeVerb = (typeof MAC_BRIDGE_VERBS)[number];
3
+ export declare const MAC_BRIDGE_ONE_WAY: ReadonlySet<MacBridgeVerb>;
4
+ export declare const MAC_BRIDGE_WIRE_VERSION = 1;
5
+ export declare const macBridgeHello: import("arktype/internal/variants/object.ts").ObjectType<{
6
+ t: "hello";
7
+ version: number;
8
+ caps: string[];
9
+ lastSeenAt: number;
10
+ }, {}>;
11
+ export type MacBridgeHello = typeof macBridgeHello.infer;
12
+ export declare const macBridgeEvent: import("arktype/internal/variants/object.ts").ObjectType<{
13
+ t: "event";
14
+ id: string;
15
+ event: {
16
+ [x: string]: unknown;
17
+ kind: string;
18
+ };
19
+ arrivedAt: number;
20
+ }, {}>;
21
+ export type MacBridgeEvent = typeof macBridgeEvent.infer;
22
+ export declare const macBridgeResult: import("arktype/internal/variants/object.ts").ObjectType<{
23
+ t: "result";
24
+ id: string;
25
+ ok: true;
26
+ value?: unknown;
27
+ } | {
28
+ t: "result";
29
+ id: string;
30
+ ok: false;
31
+ error: string;
32
+ }, {}>;
33
+ export type MacBridgeResult = typeof macBridgeResult.infer;
34
+ export declare const macBridgeUp: import("arktype/internal/variants/object.ts").ObjectType<{
35
+ t: "hello";
36
+ version: number;
37
+ caps: string[];
38
+ lastSeenAt: number;
39
+ } | {
40
+ t: "event";
41
+ id: string;
42
+ event: {
43
+ [x: string]: unknown;
44
+ kind: string;
45
+ };
46
+ arrivedAt: number;
47
+ } | {
48
+ t: "result";
49
+ id: string;
50
+ ok: true;
51
+ value?: unknown;
52
+ } | {
53
+ t: "result";
54
+ id: string;
55
+ ok: false;
56
+ error: string;
57
+ }, {}>;
58
+ export type MacBridgeUp = typeof macBridgeUp.infer;
59
+ export declare function parseMacBridgeUp(obj: unknown): MacBridgeUp | undefined;
60
+ export declare const macBridgeCall: import("arktype/internal/variants/object.ts").ObjectType<{
61
+ t: "call";
62
+ id: string;
63
+ key: string;
64
+ verb: "contactsEnsure" | "discardPhoto" | "fetchPhoto" | "markRead" | "messagesSince" | "metric" | "participants" | "react" | "sendAttachment" | "sendDirect" | "sendText";
65
+ args: unknown;
66
+ }, {}>;
67
+ export type MacBridgeCall = typeof macBridgeCall.infer;
68
+ export declare const macBridgeAck: import("arktype/internal/variants/object.ts").ObjectType<{
69
+ t: "ack";
70
+ id: string;
71
+ }, {}>;
72
+ export type MacBridgeAck = typeof macBridgeAck.infer;
73
+ export declare const macBridgeDown: import("arktype/internal/variants/object.ts").ObjectType<{
74
+ t: "call";
75
+ id: string;
76
+ key: string;
77
+ verb: "contactsEnsure" | "discardPhoto" | "fetchPhoto" | "markRead" | "messagesSince" | "metric" | "participants" | "react" | "sendAttachment" | "sendDirect" | "sendText";
78
+ args: unknown;
79
+ } | {
80
+ t: "ack";
81
+ id: string;
82
+ }, {}>;
83
+ export type MacBridgeDown = typeof macBridgeDown.infer;
84
+ export declare function parseMacBridgeDown(obj: unknown): MacBridgeDown | undefined;
85
+ export declare const MAC_BRIDGE_BLOB_PATH = "/text-lane/mac/blob/";
86
+ export declare const MAC_BRIDGE_STATE_PATH = "/text-lane/mac/state";
87
+ export declare const MAC_BRIDGE_SOCKET_PATH = "/text-lane/mac";
@@ -0,0 +1,56 @@
1
+ import { type } from "arktype";
2
+ import { lazyType } from "./lazy-type.js";
3
+ export const MAC_BRIDGE_VERBS = [
4
+ "sendText",
5
+ "sendDirect",
6
+ "sendAttachment",
7
+ "fetchPhoto",
8
+ "discardPhoto",
9
+ "participants",
10
+ "messagesSince",
11
+ "react",
12
+ "markRead",
13
+ "contactsEnsure",
14
+ "metric",
15
+ ];
16
+ export const MAC_BRIDGE_ONE_WAY = new Set(["metric", "discardPhoto"]);
17
+ export const MAC_BRIDGE_WIRE_VERSION = 1;
18
+ export const macBridgeHello = lazyType(() => type({
19
+ t: "'hello'",
20
+ version: "number",
21
+ caps: "string[]",
22
+ lastSeenAt: "number",
23
+ }));
24
+ export const macBridgeEvent = lazyType(() => type({
25
+ t: "'event'",
26
+ id: "string > 0",
27
+ event: { kind: "string", "[string]": "unknown" },
28
+ arrivedAt: "number",
29
+ }));
30
+ export const macBridgeResult = lazyType(() => type({ t: "'result'", id: "string > 0", ok: "true", "value?": "unknown" }).or({
31
+ t: "'result'",
32
+ id: "string > 0",
33
+ ok: "false",
34
+ error: "string",
35
+ }));
36
+ export const macBridgeUp = lazyType(() => macBridgeHello.or(macBridgeEvent).or(macBridgeResult));
37
+ export function parseMacBridgeUp(obj) {
38
+ const r = macBridgeUp(obj);
39
+ return r instanceof type.errors ? undefined : r;
40
+ }
41
+ export const macBridgeCall = lazyType(() => type({
42
+ t: "'call'",
43
+ id: "string > 0",
44
+ key: "string > 0",
45
+ verb: type.enumerated(...MAC_BRIDGE_VERBS),
46
+ args: "unknown",
47
+ }));
48
+ export const macBridgeAck = lazyType(() => type({ t: "'ack'", id: "string > 0" }));
49
+ export const macBridgeDown = lazyType(() => macBridgeCall.or(macBridgeAck));
50
+ export function parseMacBridgeDown(obj) {
51
+ const r = macBridgeDown(obj);
52
+ return r instanceof type.errors ? undefined : r;
53
+ }
54
+ export const MAC_BRIDGE_BLOB_PATH = "/text-lane/mac/blob/";
55
+ export const MAC_BRIDGE_STATE_PATH = "/text-lane/mac/state";
56
+ export const MAC_BRIDGE_SOCKET_PATH = "/text-lane/mac";
package/moderation.d.ts CHANGED
@@ -56,22 +56,58 @@ export type EvtVibeReported = typeof evtVibeReported.infer;
56
56
  export declare function isEvtVibeReported(obj: unknown): obj is EvtVibeReported;
57
57
  export declare const evtChildSafetySignal: import("arktype/internal/variants/object.ts").ObjectType<{
58
58
  type: "vibes.diy.evt-child-safety-signal";
59
- source: "image-check";
59
+ source: "code-check" | "image-check" | "prompt-check";
60
60
  ownerHandle: string;
61
61
  appSlug: string;
62
62
  refId: string;
63
63
  }, {}>;
64
64
  export type EvtChildSafetySignal = typeof evtChildSafetySignal.infer;
65
65
  export declare function isEvtChildSafetySignal(obj: unknown): obj is EvtChildSafetySignal;
66
- export declare const moderationAdminOp: import("arktype/internal/variants/string.ts").StringType<"list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "unsuspend", {}>;
66
+ export declare const moderationAdminOp: import("arktype/internal/variants/string.ts").StringType<"list-flags" | "list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "triage-flag" | "unsuspend", {}>;
67
67
  export type ModerationAdminOp = typeof moderationAdminOp.infer;
68
+ export declare const AUTO_FLAG_CATEGORIES: readonly ["minors_sexual", "named_person", "self_harm", "credential_capture", "harassment_doxxing", "refused"];
69
+ export type AutoFlagCategory = (typeof AUTO_FLAG_CATEGORIES)[number];
70
+ export declare const autoFlagTriage: import("arktype/internal/variants/string.ts").StringType<"escalated" | "false_alarm" | "resolved", {}>;
71
+ export type AutoFlagTriage = typeof autoFlagTriage.infer;
72
+ export declare const autoFlagRow: import("arktype/internal/variants/object.ts").ObjectType<{
73
+ flagId: string;
74
+ ownerHandle: string;
75
+ appSlug: string;
76
+ actorUserId: string;
77
+ inputKind: "code" | "prompt";
78
+ category: string;
79
+ reason: string;
80
+ model: string;
81
+ status: string;
82
+ created: string;
83
+ chatId?: string | undefined;
84
+ promptId?: string | undefined;
85
+ fsId?: string | undefined;
86
+ promptText?: string | undefined;
87
+ triagedAt?: string | undefined;
88
+ triagedBy?: string | undefined;
89
+ triageNote?: string | undefined;
90
+ }, {}>;
91
+ export type AutoFlagRow = typeof autoFlagRow.infer;
92
+ export declare const evtAutoFlagWaiting: import("arktype/internal/variants/object.ts").ObjectType<{
93
+ type: "vibes.diy.evt-auto-flag-waiting";
94
+ stage: "first-responder" | "widen";
95
+ flagId: string;
96
+ ownerHandle: string;
97
+ appSlug: string;
98
+ category: string;
99
+ inputKind: "code" | "prompt";
100
+ at: string;
101
+ }, {}>;
102
+ export type EvtAutoFlagWaiting = typeof evtAutoFlagWaiting.infer;
103
+ export declare function isEvtAutoFlagWaiting(obj: unknown): obj is EvtAutoFlagWaiting;
68
104
  export declare const reqModerationAdmin: import("arktype/internal/variants/object.ts").ObjectType<{
69
105
  type: "vibes.diy.req-moderation-admin";
70
106
  auth: {
71
107
  type: "clerk" | "device-id" | "guest" | "ucan";
72
108
  token: string;
73
109
  };
74
- op: "list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "unsuspend";
110
+ op: "list-flags" | "list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "triage-flag" | "unsuspend";
75
111
  reason?: string | undefined;
76
112
  reportId?: string | undefined;
77
113
  userId?: string | undefined;
@@ -79,6 +115,9 @@ export declare const reqModerationAdmin: import("arktype/internal/variants/objec
79
115
  paused?: boolean | undefined;
80
116
  status?: "all" | "open" | "resolved" | undefined;
81
117
  limit?: number | undefined;
118
+ flagId?: string | undefined;
119
+ triage?: "escalated" | "false_alarm" | "resolved" | undefined;
120
+ flagStatus?: "all" | "escalated" | "false_alarm" | "open" | "resolved" | undefined;
82
121
  }, {}>;
83
122
  export type ReqModerationAdmin = typeof reqModerationAdmin.infer;
84
123
  export declare const vibeReportRow: import("arktype/internal/variants/object.ts").ObjectType<{
@@ -113,7 +152,7 @@ export declare const publishingSwitchState: import("arktype/internal/variants/ob
113
152
  export type PublishingSwitchState = typeof publishingSwitchState.infer;
114
153
  export declare const resModerationAdmin: import("arktype/internal/variants/object.ts").ObjectType<{
115
154
  type: "vibes.diy.res-moderation-admin";
116
- op: "list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "unsuspend";
155
+ op: "list-flags" | "list-reports" | "resolve-report" | "set-publishing-paused" | "status" | "suspend" | "triage-flag" | "unsuspend";
117
156
  reports?: {
118
157
  reportId: string;
119
158
  ownerHandle: string;
@@ -163,6 +202,44 @@ export declare const resModerationAdmin: import("arktype/internal/variants/objec
163
202
  updated?: string | undefined;
164
203
  } | undefined;
165
204
  openReports?: number | undefined;
205
+ flags?: {
206
+ flagId: string;
207
+ ownerHandle: string;
208
+ appSlug: string;
209
+ actorUserId: string;
210
+ inputKind: "code" | "prompt";
211
+ category: string;
212
+ reason: string;
213
+ model: string;
214
+ status: string;
215
+ created: string;
216
+ chatId?: string | undefined;
217
+ promptId?: string | undefined;
218
+ fsId?: string | undefined;
219
+ promptText?: string | undefined;
220
+ triagedAt?: string | undefined;
221
+ triagedBy?: string | undefined;
222
+ triageNote?: string | undefined;
223
+ }[] | undefined;
224
+ flag?: {
225
+ flagId: string;
226
+ ownerHandle: string;
227
+ appSlug: string;
228
+ actorUserId: string;
229
+ inputKind: "code" | "prompt";
230
+ category: string;
231
+ reason: string;
232
+ model: string;
233
+ status: string;
234
+ created: string;
235
+ chatId?: string | undefined;
236
+ promptId?: string | undefined;
237
+ fsId?: string | undefined;
238
+ promptText?: string | undefined;
239
+ triagedAt?: string | undefined;
240
+ triagedBy?: string | undefined;
241
+ triageNote?: string | undefined;
242
+ } | undefined;
166
243
  }, {}>;
167
244
  export type ResModerationAdmin = typeof resModerationAdmin.infer;
168
245
  export declare function isResModerationAdmin(obj: unknown): obj is ResModerationAdmin;
package/moderation.js CHANGED
@@ -48,7 +48,7 @@ export function isEvtVibeReported(obj) {
48
48
  }
49
49
  export const evtChildSafetySignal = lazyType(() => type({
50
50
  type: "'vibes.diy.evt-child-safety-signal'",
51
- source: "'image-check'",
51
+ source: "'image-check' | 'prompt-check' | 'code-check'",
52
52
  ownerHandle: "string",
53
53
  appSlug: "string",
54
54
  refId: "string",
@@ -56,7 +56,48 @@ export const evtChildSafetySignal = lazyType(() => type({
56
56
  export function isEvtChildSafetySignal(obj) {
57
57
  return evtChildSafetySignal.allows(obj);
58
58
  }
59
- export const moderationAdminOp = lazyType(() => type("'list-reports' | 'resolve-report' | 'suspend' | 'unsuspend' | 'set-publishing-paused' | 'status'"));
59
+ export const moderationAdminOp = lazyType(() => type("'list-reports' | 'resolve-report' | 'suspend' | 'unsuspend' | 'set-publishing-paused' | 'status' | 'list-flags' | 'triage-flag'"));
60
+ export const AUTO_FLAG_CATEGORIES = [
61
+ "minors_sexual",
62
+ "named_person",
63
+ "self_harm",
64
+ "credential_capture",
65
+ "harassment_doxxing",
66
+ "refused",
67
+ ];
68
+ export const autoFlagTriage = lazyType(() => type("'false_alarm' | 'escalated' | 'resolved'"));
69
+ export const autoFlagRow = lazyType(() => type({
70
+ flagId: "string",
71
+ ownerHandle: "string",
72
+ appSlug: "string",
73
+ actorUserId: "string",
74
+ inputKind: "'prompt' | 'code'",
75
+ category: "string",
76
+ reason: "string",
77
+ model: "string",
78
+ status: "string",
79
+ created: "string",
80
+ "chatId?": "string",
81
+ "promptId?": "string",
82
+ "fsId?": "string",
83
+ "promptText?": "string",
84
+ "triagedAt?": "string",
85
+ "triagedBy?": "string",
86
+ "triageNote?": "string",
87
+ }));
88
+ export const evtAutoFlagWaiting = lazyType(() => type({
89
+ type: "'vibes.diy.evt-auto-flag-waiting'",
90
+ stage: "'first-responder' | 'widen'",
91
+ flagId: "string",
92
+ ownerHandle: "string",
93
+ appSlug: "string",
94
+ category: "string",
95
+ inputKind: "'prompt' | 'code'",
96
+ at: "string",
97
+ }));
98
+ export function isEvtAutoFlagWaiting(obj) {
99
+ return evtAutoFlagWaiting.allows(obj);
100
+ }
60
101
  export const reqModerationAdmin = lazyType(() => type({
61
102
  type: "'vibes.diy.req-moderation-admin'",
62
103
  auth: dashAuthType,
@@ -68,6 +109,9 @@ export const reqModerationAdmin = lazyType(() => type({
68
109
  "paused?": "boolean",
69
110
  "status?": "'open' | 'resolved' | 'all'",
70
111
  "limit?": "number",
112
+ "flagId?": "string",
113
+ "triage?": autoFlagTriage,
114
+ "flagStatus?": "'open' | 'false_alarm' | 'escalated' | 'resolved' | 'all'",
71
115
  }));
72
116
  export const vibeReportRow = lazyType(() => type({
73
117
  reportId: "string",
@@ -105,6 +149,8 @@ export const resModerationAdmin = lazyType(() => type({
105
149
  "suspensions?": accountSuspensionRow.array(),
106
150
  "publishing?": publishingSwitchState,
107
151
  "openReports?": "number",
152
+ "flags?": autoFlagRow.array(),
153
+ "flag?": autoFlagRow,
108
154
  }));
109
155
  export function isResModerationAdmin(obj) {
110
156
  return resModerationAdmin.allows(obj);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibes.diy/api-types",
3
- "version": "14.3.326",
3
+ "version": "14.3.327",
4
4
  "license": "SEE LICENSE IN LICENSE.md",
5
5
  "type": "module",
6
6
  "main": "./index.js",
@@ -25,9 +25,9 @@
25
25
  "dependencies": {
26
26
  "@adviser/cement": "~0.5.37",
27
27
  "@cloudflare/workers-types": "~5.20261101.1",
28
- "@vibes.diy/call-ai-v2": "14.3.326",
29
- "@vibes.diy/identity": "14.3.326",
30
- "@vibes.diy/vibe-types": "14.3.326",
28
+ "@vibes.diy/call-ai-v2": "14.3.327",
29
+ "@vibes.diy/identity": "14.3.327",
30
+ "@vibes.diy/vibe-types": "14.3.327",
31
31
  "arktype": "~2.2.9"
32
32
  },
33
33
  "repository": {
package/text-turn.d.ts CHANGED
@@ -13,6 +13,7 @@ export declare const reqTextTurn: import("arktype/internal/variants/object.ts").
13
13
  originalUploadId?: string | undefined;
14
14
  size?: number | undefined;
15
15
  }[];
16
+ events?: true | undefined;
16
17
  }, {}>;
17
18
  export type ReqTextTurn = typeof reqTextTurn.infer;
18
19
  export declare function isReqTextTurn(obj: unknown): obj is ReqTextTurn;
@@ -44,6 +45,24 @@ export declare const textTurnLine: import("arktype/internal/variants/object.ts")
44
45
  chatId: string;
45
46
  } | {
46
47
  error: string;
48
+ detail?: string | undefined;
49
+ } | {
50
+ reaction: string;
51
+ } | {
52
+ confirm: {
53
+ action: "unpublish";
54
+ ownerHandle: string;
55
+ appSlug: string;
56
+ };
57
+ } | {
58
+ copy: {
59
+ ownerHandle: string;
60
+ appSlug: string;
61
+ remixOf: string;
62
+ };
63
+ } | {
64
+ idle: true;
65
+ chatId: string;
47
66
  }, {}>;
48
67
  export type TextTurnLine = typeof textTurnLine.infer;
49
68
  export declare function isTextTurnLine(obj: unknown): obj is TextTurnLine;
package/text-turn.js CHANGED
@@ -9,6 +9,7 @@ export const reqTextTurn = lazyType(() => type({
9
9
  "newSession?": "boolean",
10
10
  text: "string",
11
11
  fileBlocks: VibesFileContent.array(),
12
+ "events?": "true",
12
13
  }));
13
14
  export function isReqTextTurn(obj) {
14
15
  return !(reqTextTurn(obj) instanceof type.errors);
@@ -18,7 +19,11 @@ export const foldedReplyWire = lazyType(() => type({ kind: "'text'", text: "stri
18
19
  .or({ kind: "'picture-missed'" }));
19
20
  export const textTurnLine = lazyType(() => type({ "+": "reject", reply: foldedReplyWire })
20
21
  .or({ "+": "reject", done: "true", chatId: "string" })
21
- .or({ "+": "reject", error: "string" }));
22
+ .or({ "+": "reject", error: "string", "detail?": "string" })
23
+ .or({ "+": "reject", reaction: "string" })
24
+ .or({ "+": "reject", confirm: { action: "'unpublish'", ownerHandle: "string", appSlug: "string" } })
25
+ .or({ "+": "reject", copy: { ownerHandle: "string", appSlug: "string", remixOf: "string" } })
26
+ .or({ "+": "reject", idle: "true", chatId: "string" }));
22
27
  export function isTextTurnLine(obj) {
23
28
  return !(textTurnLine(obj) instanceof type.errors);
24
29
  }