@tangle-network/agent-app 0.60.250 → 0.60.252

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (222) hide show
  1. package/dist/DesignCanvas-L6J72JQ2.js +15 -0
  2. package/dist/DesignCanvasEditor-QFQD63MR.js +18 -0
  3. package/dist/agent-enrollment/drizzle.js +3 -3
  4. package/dist/agent-enrollment/index.js +3 -3
  5. package/dist/app-auth/drizzle.d.ts +475 -0
  6. package/dist/app-auth/drizzle.js +86 -0
  7. package/dist/app-auth/drizzle.js.map +1 -0
  8. package/dist/app-auth/index.js +5 -3
  9. package/dist/app-auth/index.js.map +1 -1
  10. package/dist/app-oauth/drizzle.d.ts +2080 -0
  11. package/dist/app-oauth/drizzle.js +161 -0
  12. package/dist/app-oauth/drizzle.js.map +1 -0
  13. package/dist/app-oauth/index.d.ts +4 -0
  14. package/dist/app-oauth/index.js +8 -222
  15. package/dist/app-oauth/index.js.map +1 -1
  16. package/dist/app-oauth/issuer.d.ts +133 -0
  17. package/dist/app-oauth/issuer.js +247 -0
  18. package/dist/app-oauth/issuer.js.map +1 -0
  19. package/dist/assistant/index.js +13 -13
  20. package/dist/chat-react/index.js +4 -4
  21. package/dist/chat-routes/index.js +37 -67
  22. package/dist/chat-routes/index.js.map +1 -1
  23. package/dist/chat-routes/promote-file-part.d.ts +2 -3
  24. package/dist/chat-store/index.js +4 -4
  25. package/dist/{chunk-MY3EJJ6Y.js → chunk-4FEH6266.js} +2 -2
  26. package/dist/{chunk-5Y7Z5G3Y.js → chunk-4GCPADYG.js} +20 -336
  27. package/dist/chunk-4GCPADYG.js.map +1 -0
  28. package/dist/{chunk-X556WVBG.js → chunk-4ZSLX3LY.js} +2 -2
  29. package/dist/chunk-57XPEL7X.js +26 -0
  30. package/dist/chunk-57XPEL7X.js.map +1 -0
  31. package/dist/chunk-6Z7TZVKZ.js +26 -0
  32. package/dist/chunk-6Z7TZVKZ.js.map +1 -0
  33. package/dist/{chunk-7KKOFMLD.js → chunk-AWIQQEFP.js} +1 -1
  34. package/dist/chunk-AWIQQEFP.js.map +1 -0
  35. package/dist/{chunk-VBKP2NLI.js → chunk-BTKI4XMM.js} +2 -2
  36. package/dist/{chunk-63QAQP7I.js → chunk-CNBVWPQC.js} +7 -7
  37. package/dist/{chunk-FENBDSIW.js → chunk-CQGEGPY7.js} +75 -3
  38. package/dist/chunk-CQGEGPY7.js.map +1 -0
  39. package/dist/chunk-CTREXL3O.js +335 -0
  40. package/dist/chunk-CTREXL3O.js.map +1 -0
  41. package/dist/chunk-DLWO3J7D.js +238 -0
  42. package/dist/chunk-DLWO3J7D.js.map +1 -0
  43. package/dist/{chunk-LWSJK546.js → chunk-DSMGS4IV.js} +5 -5
  44. package/dist/{chunk-LWSJK546.js.map → chunk-DSMGS4IV.js.map} +1 -1
  45. package/dist/{chunk-A3KPDLSF.js → chunk-EFPIHR6F.js} +18 -18
  46. package/dist/chunk-FRAICFTZ.js +191 -0
  47. package/dist/chunk-FRAICFTZ.js.map +1 -0
  48. package/dist/chunk-GS7VWV26.js +61 -0
  49. package/dist/chunk-GS7VWV26.js.map +1 -0
  50. package/dist/{chunk-NMSAZFRL.js → chunk-H5GQMLHA.js} +2 -2
  51. package/dist/{chunk-OQE6WMDP.js → chunk-HN6MZ2XL.js} +5 -5
  52. package/dist/chunk-HY57QRRW.js +11 -0
  53. package/dist/chunk-HY57QRRW.js.map +1 -0
  54. package/dist/{chunk-TCGZFSN5.js → chunk-KH4QSBNI.js} +2 -2
  55. package/dist/{chunk-JH3CKHF4.js → chunk-KJODHPWM.js} +8 -8
  56. package/dist/chunk-LSBI5MWS.js +66 -0
  57. package/dist/chunk-LSBI5MWS.js.map +1 -0
  58. package/dist/chunk-MDRH3SDA.js +106 -0
  59. package/dist/chunk-MDRH3SDA.js.map +1 -0
  60. package/dist/{chunk-VBWYH7UZ.js → chunk-NHYRIM4I.js} +3 -3
  61. package/dist/{chunk-BYP54FMI.js → chunk-O2RCDK5D.js} +30 -15
  62. package/dist/{chunk-BYP54FMI.js.map → chunk-O2RCDK5D.js.map} +1 -1
  63. package/dist/{chunk-EWOJATDS.js → chunk-PDD5A43Y.js} +3 -3
  64. package/dist/{chunk-23JUSUUB.js → chunk-RZLCBWGG.js} +2 -2
  65. package/dist/chunk-SFZELD6V.js +52 -0
  66. package/dist/chunk-SFZELD6V.js.map +1 -0
  67. package/dist/{chunk-Y4W6GK5X.js → chunk-UGFCLD32.js} +2 -2
  68. package/dist/{chunk-ZGUXI5SI.js → chunk-VUBJZEZB.js} +2 -2
  69. package/dist/{chunk-LQYIBL3G.js → chunk-WL7PZK7Q.js} +71 -1
  70. package/dist/chunk-WL7PZK7Q.js.map +1 -0
  71. package/dist/{chunk-7HZCFG2A.js → chunk-WP2GYFZ4.js} +38 -1
  72. package/dist/chunk-WP2GYFZ4.js.map +1 -0
  73. package/dist/{chunk-JK7R7BZQ.js → chunk-ZWJ3SZ2G.js} +2 -2
  74. package/dist/crypto/digest.d.ts +2 -0
  75. package/dist/crypto/index.d.ts +1 -0
  76. package/dist/crypto/index.js +6 -2
  77. package/dist/design-canvas/index.js +5 -3
  78. package/dist/design-canvas/index.js.map +1 -1
  79. package/dist/design-canvas-react/engine.js +7 -5
  80. package/dist/design-canvas-react/index.js +14 -12
  81. package/dist/design-canvas-react/index.js.map +1 -1
  82. package/dist/design-canvas-react/lazy.js +1 -1
  83. package/dist/eval/index.d.ts +4 -0
  84. package/dist/eval/index.js +125 -0
  85. package/dist/eval/index.js.map +1 -1
  86. package/dist/eval/persona-driver.d.ts +37 -0
  87. package/dist/eval/research-plan.d.ts +25 -0
  88. package/dist/eval/research-plan.js +55 -0
  89. package/dist/eval/research-plan.js.map +1 -0
  90. package/dist/eval/scorecard.d.ts +38 -0
  91. package/dist/forms/blank.d.ts +2 -2
  92. package/dist/forms/index.js +4 -5
  93. package/dist/forms/index.js.map +1 -1
  94. package/dist/hosted-agent/application.js +2 -2
  95. package/dist/interactions/index.js +3 -3
  96. package/dist/knowledge/prelaunch-audit.d.ts +17 -0
  97. package/dist/knowledge/prelaunch-audit.js +67 -0
  98. package/dist/knowledge/prelaunch-audit.js.map +1 -0
  99. package/dist/media/drizzle.d.ts +207 -0
  100. package/dist/media/drizzle.js +26 -0
  101. package/dist/media/drizzle.js.map +1 -0
  102. package/dist/media/generate-request.d.ts +53 -0
  103. package/dist/media/generation-record.d.ts +68 -0
  104. package/dist/media/index.d.ts +13 -0
  105. package/dist/media/index.js +653 -0
  106. package/dist/media/index.js.map +1 -0
  107. package/dist/media/model-catalog.d.ts +109 -0
  108. package/dist/media/router-client.d.ts +40 -0
  109. package/dist/media/router-generation.d.ts +44 -0
  110. package/dist/media/speech-script.d.ts +20 -0
  111. package/dist/openui/index.js +1 -1
  112. package/dist/operator/index.js +4 -5
  113. package/dist/operator/index.js.map +1 -1
  114. package/dist/plans/decision.d.ts +48 -0
  115. package/dist/plans/drizzle.d.ts +25 -0
  116. package/dist/plans/drizzle.js +97 -0
  117. package/dist/plans/drizzle.js.map +1 -0
  118. package/dist/plans/index.d.ts +1 -1
  119. package/dist/plans/index.js +11 -3
  120. package/dist/platform/billing-config.d.ts +22 -0
  121. package/dist/platform/billing-config.js +36 -0
  122. package/dist/platform/billing-config.js.map +1 -0
  123. package/dist/platform/index.js +13 -11
  124. package/dist/platform/index.js.map +1 -1
  125. package/dist/preset-cloudflare/index.js +2 -1
  126. package/dist/preset-cloudflare/index.js.map +1 -1
  127. package/dist/profile/index.js +4 -5
  128. package/dist/profile/index.js.map +1 -1
  129. package/dist/public-consultation/index.d.ts +1 -1
  130. package/dist/public-consultation/index.js +13 -11
  131. package/dist/public-consultation/index.js.map +1 -1
  132. package/dist/runtime/telemetry-cap.d.ts +24 -0
  133. package/dist/runtime/telemetry-cap.js +36 -0
  134. package/dist/runtime/telemetry-cap.js.map +1 -0
  135. package/dist/sandbox/index.js +12 -9
  136. package/dist/sequences/index.js +4 -2
  137. package/dist/sequences/index.js.map +1 -1
  138. package/dist/skills-placement/box.d.ts +50 -0
  139. package/dist/skills-placement/box.js +204 -0
  140. package/dist/skills-placement/box.js.map +1 -0
  141. package/dist/skills-placement/index.js +8 -96
  142. package/dist/skills-placement/index.js.map +1 -1
  143. package/dist/spend/budget.d.ts +13 -0
  144. package/dist/spend/drizzle.d.ts +55 -0
  145. package/dist/spend/drizzle.js +131 -0
  146. package/dist/spend/drizzle.js.map +1 -0
  147. package/dist/spend/index.d.ts +2 -1
  148. package/dist/spend/index.js +77 -58
  149. package/dist/spend/index.js.map +1 -1
  150. package/dist/spend/platform-settlements.d.ts +46 -0
  151. package/dist/stream/index.js +19 -19
  152. package/dist/studio/generated-media/index.d.ts +6 -0
  153. package/dist/studio/generated-media/index.js +590 -0
  154. package/dist/studio/generated-media/index.js.map +1 -0
  155. package/dist/studio/generated-media/output.d.ts +27 -0
  156. package/dist/studio/generated-media/store.d.ts +175 -0
  157. package/dist/studio-react/download-generations.d.ts +7 -0
  158. package/dist/studio-react/index.d.ts +1 -0
  159. package/dist/studio-react/index.js +85 -0
  160. package/dist/studio-react/index.js.map +1 -1
  161. package/dist/studio-react/use-studio-route.d.ts +44 -0
  162. package/dist/teams/invitations-api.d.ts +4 -0
  163. package/dist/teams/invitations-api.js +44 -32
  164. package/dist/teams/invitations-api.js.map +1 -1
  165. package/dist/theme/dom.d.ts +22 -0
  166. package/dist/theme/dom.js +18 -0
  167. package/dist/theme/dom.js.map +1 -0
  168. package/dist/vault/collaboration.d.ts +83 -0
  169. package/dist/vault/collaboration.js +215 -0
  170. package/dist/vault/collaboration.js.map +1 -0
  171. package/dist/vault/server.js +6 -53
  172. package/dist/vault/server.js.map +1 -1
  173. package/dist/vault/store/coordinator.d.ts +64 -0
  174. package/dist/vault/store/index.d.ts +12 -0
  175. package/dist/vault/store/index.js +1202 -0
  176. package/dist/vault/store/index.js.map +1 -0
  177. package/dist/vault/store/paths.d.ts +65 -0
  178. package/dist/vault/store/revisions.d.ts +211 -0
  179. package/dist/vault/store/sandbox-sync.d.ts +74 -0
  180. package/dist/vault/store/store.d.ts +161 -0
  181. package/dist/vault/store/tree.d.ts +11 -0
  182. package/dist/web/entry-server.d.ts +7 -0
  183. package/dist/web/entry-server.js +29 -0
  184. package/dist/web/entry-server.js.map +1 -0
  185. package/dist/web/fetch-guard.d.ts +6 -0
  186. package/dist/web/index.d.ts +3 -0
  187. package/dist/web/index.js +20 -4
  188. package/dist/web/mime.d.ts +16 -0
  189. package/dist/web/rate-limit.d.ts +25 -0
  190. package/dist/web/timeout.d.ts +9 -0
  191. package/dist/web-react/agent-profile-editor.js +3 -3
  192. package/dist/web-react/api-access-panel.d.ts +4 -2
  193. package/dist/web-react/document.d.ts +41 -0
  194. package/dist/web-react/document.js +103 -0
  195. package/dist/web-react/document.js.map +1 -0
  196. package/dist/web-react/index.js +31 -31
  197. package/dist/workspace-react/index.js +5 -5
  198. package/package.json +95 -4
  199. package/dist/DesignCanvas-OW3W2QXW.js +0 -13
  200. package/dist/DesignCanvasEditor-TCHZF25W.js +0 -16
  201. package/dist/chunk-5Y7Z5G3Y.js.map +0 -1
  202. package/dist/chunk-7HZCFG2A.js.map +0 -1
  203. package/dist/chunk-7KKOFMLD.js.map +0 -1
  204. package/dist/chunk-FENBDSIW.js.map +0 -1
  205. package/dist/chunk-LQYIBL3G.js.map +0 -1
  206. /package/dist/{DesignCanvas-OW3W2QXW.js.map → DesignCanvas-L6J72JQ2.js.map} +0 -0
  207. /package/dist/{DesignCanvasEditor-TCHZF25W.js.map → DesignCanvasEditor-QFQD63MR.js.map} +0 -0
  208. /package/dist/{chunk-MY3EJJ6Y.js.map → chunk-4FEH6266.js.map} +0 -0
  209. /package/dist/{chunk-X556WVBG.js.map → chunk-4ZSLX3LY.js.map} +0 -0
  210. /package/dist/{chunk-VBKP2NLI.js.map → chunk-BTKI4XMM.js.map} +0 -0
  211. /package/dist/{chunk-63QAQP7I.js.map → chunk-CNBVWPQC.js.map} +0 -0
  212. /package/dist/{chunk-A3KPDLSF.js.map → chunk-EFPIHR6F.js.map} +0 -0
  213. /package/dist/{chunk-NMSAZFRL.js.map → chunk-H5GQMLHA.js.map} +0 -0
  214. /package/dist/{chunk-OQE6WMDP.js.map → chunk-HN6MZ2XL.js.map} +0 -0
  215. /package/dist/{chunk-TCGZFSN5.js.map → chunk-KH4QSBNI.js.map} +0 -0
  216. /package/dist/{chunk-JH3CKHF4.js.map → chunk-KJODHPWM.js.map} +0 -0
  217. /package/dist/{chunk-VBWYH7UZ.js.map → chunk-NHYRIM4I.js.map} +0 -0
  218. /package/dist/{chunk-EWOJATDS.js.map → chunk-PDD5A43Y.js.map} +0 -0
  219. /package/dist/{chunk-23JUSUUB.js.map → chunk-RZLCBWGG.js.map} +0 -0
  220. /package/dist/{chunk-Y4W6GK5X.js.map → chunk-UGFCLD32.js.map} +0 -0
  221. /package/dist/{chunk-ZGUXI5SI.js.map → chunk-VUBJZEZB.js.map} +0 -0
  222. /package/dist/{chunk-JK7R7BZQ.js.map → chunk-ZWJ3SZ2G.js.map} +0 -0
@@ -0,0 +1,207 @@
1
+ import type { AnySQLiteColumn, AnySQLiteTable } from 'drizzle-orm/sqlite-core';
2
+ /** A product table referenced by FK: only the `id` column is touched. */
3
+ export type GenerationParentTable = AnySQLiteTable & {
4
+ id: AnySQLiteColumn;
5
+ };
6
+ export interface CreateGenerationsTableOptions {
7
+ workspaceTable: GenerationParentTable;
8
+ threadTable: GenerationParentTable;
9
+ /** What deleting a thread does to its generations; omitted keeps the database default (no action). */
10
+ threadOnDelete?: 'cascade' | 'set null' | 'restrict' | 'no action';
11
+ /** Index generations by thread, for products that list a thread's media. */
12
+ indexThread?: boolean;
13
+ }
14
+ /** Build the `generation` table. */
15
+ export declare function createGenerationsTable(opts: CreateGenerationsTableOptions): import("drizzle-orm/sqlite-core").SQLiteTableWithColumns<{
16
+ name: "generation";
17
+ schema: undefined;
18
+ columns: {
19
+ id: import("drizzle-orm/sqlite-core").SQLiteColumn<{
20
+ name: "id";
21
+ tableName: "generation";
22
+ dataType: "string";
23
+ columnType: "SQLiteText";
24
+ data: string;
25
+ driverParam: string;
26
+ notNull: true;
27
+ hasDefault: true;
28
+ isPrimaryKey: true;
29
+ isAutoincrement: false;
30
+ hasRuntimeDefault: false;
31
+ enumValues: [string, ...string[]];
32
+ baseColumn: never;
33
+ identity: undefined;
34
+ generated: undefined;
35
+ }, {}, {
36
+ length: number | undefined;
37
+ }>;
38
+ workspaceId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
39
+ name: "workspace_id";
40
+ tableName: "generation";
41
+ dataType: "string";
42
+ columnType: "SQLiteText";
43
+ data: string;
44
+ driverParam: string;
45
+ notNull: true;
46
+ hasDefault: false;
47
+ isPrimaryKey: false;
48
+ isAutoincrement: false;
49
+ hasRuntimeDefault: false;
50
+ enumValues: [string, ...string[]];
51
+ baseColumn: never;
52
+ identity: undefined;
53
+ generated: undefined;
54
+ }, {}, {
55
+ length: number | undefined;
56
+ }>;
57
+ threadId: import("drizzle-orm/sqlite-core").SQLiteColumn<{
58
+ name: "thread_id";
59
+ tableName: "generation";
60
+ dataType: "string";
61
+ columnType: "SQLiteText";
62
+ data: string;
63
+ driverParam: string;
64
+ notNull: false;
65
+ hasDefault: false;
66
+ isPrimaryKey: false;
67
+ isAutoincrement: false;
68
+ hasRuntimeDefault: false;
69
+ enumValues: [string, ...string[]];
70
+ baseColumn: never;
71
+ identity: undefined;
72
+ generated: undefined;
73
+ }, {}, {
74
+ length: number | undefined;
75
+ }>;
76
+ type: import("drizzle-orm/sqlite-core").SQLiteColumn<{
77
+ name: "type";
78
+ tableName: "generation";
79
+ dataType: "string";
80
+ columnType: "SQLiteText";
81
+ data: "avatar" | "image" | "speech" | "transcription" | "video";
82
+ driverParam: string;
83
+ notNull: true;
84
+ hasDefault: false;
85
+ isPrimaryKey: false;
86
+ isAutoincrement: false;
87
+ hasRuntimeDefault: false;
88
+ enumValues: ["image", "video", "avatar", "speech", "transcription"];
89
+ baseColumn: never;
90
+ identity: undefined;
91
+ generated: undefined;
92
+ }, {}, {
93
+ length: number | undefined;
94
+ }>;
95
+ prompt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
96
+ name: "prompt";
97
+ tableName: "generation";
98
+ dataType: "string";
99
+ columnType: "SQLiteText";
100
+ data: string;
101
+ driverParam: string;
102
+ notNull: true;
103
+ hasDefault: false;
104
+ isPrimaryKey: false;
105
+ isAutoincrement: false;
106
+ hasRuntimeDefault: false;
107
+ enumValues: [string, ...string[]];
108
+ baseColumn: never;
109
+ identity: undefined;
110
+ generated: undefined;
111
+ }, {}, {
112
+ length: number | undefined;
113
+ }>;
114
+ result: import("drizzle-orm/sqlite-core").SQLiteColumn<{
115
+ name: "result";
116
+ tableName: "generation";
117
+ dataType: "string";
118
+ columnType: "SQLiteText";
119
+ data: string;
120
+ driverParam: string;
121
+ notNull: false;
122
+ hasDefault: false;
123
+ isPrimaryKey: false;
124
+ isAutoincrement: false;
125
+ hasRuntimeDefault: false;
126
+ enumValues: [string, ...string[]];
127
+ baseColumn: never;
128
+ identity: undefined;
129
+ generated: undefined;
130
+ }, {}, {
131
+ length: number | undefined;
132
+ }>;
133
+ model: import("drizzle-orm/sqlite-core").SQLiteColumn<{
134
+ name: "model";
135
+ tableName: "generation";
136
+ dataType: "string";
137
+ columnType: "SQLiteText";
138
+ data: string;
139
+ driverParam: string;
140
+ notNull: false;
141
+ hasDefault: false;
142
+ isPrimaryKey: false;
143
+ isAutoincrement: false;
144
+ hasRuntimeDefault: false;
145
+ enumValues: [string, ...string[]];
146
+ baseColumn: never;
147
+ identity: undefined;
148
+ generated: undefined;
149
+ }, {}, {
150
+ length: number | undefined;
151
+ }>;
152
+ cost: import("drizzle-orm/sqlite-core").SQLiteColumn<{
153
+ name: "cost";
154
+ tableName: "generation";
155
+ dataType: "number";
156
+ columnType: "SQLiteReal";
157
+ data: number;
158
+ driverParam: number;
159
+ notNull: false;
160
+ hasDefault: false;
161
+ isPrimaryKey: false;
162
+ isAutoincrement: false;
163
+ hasRuntimeDefault: false;
164
+ enumValues: undefined;
165
+ baseColumn: never;
166
+ identity: undefined;
167
+ generated: undefined;
168
+ }, {}, {}>;
169
+ metadata: import("drizzle-orm/sqlite-core").SQLiteColumn<{
170
+ name: "metadata";
171
+ tableName: "generation";
172
+ dataType: "json";
173
+ columnType: "SQLiteTextJson";
174
+ data: Record<string, unknown>;
175
+ driverParam: string;
176
+ notNull: false;
177
+ hasDefault: false;
178
+ isPrimaryKey: false;
179
+ isAutoincrement: false;
180
+ hasRuntimeDefault: false;
181
+ enumValues: undefined;
182
+ baseColumn: never;
183
+ identity: undefined;
184
+ generated: undefined;
185
+ }, {}, {
186
+ $type: Record<string, unknown>;
187
+ }>;
188
+ createdAt: import("drizzle-orm/sqlite-core").SQLiteColumn<{
189
+ name: "created_at";
190
+ tableName: "generation";
191
+ dataType: "date";
192
+ columnType: "SQLiteTimestamp";
193
+ data: Date;
194
+ driverParam: number;
195
+ notNull: true;
196
+ hasDefault: true;
197
+ isPrimaryKey: false;
198
+ isAutoincrement: false;
199
+ hasRuntimeDefault: false;
200
+ enumValues: undefined;
201
+ baseColumn: never;
202
+ identity: undefined;
203
+ generated: undefined;
204
+ }, {}, {}>;
205
+ };
206
+ dialect: 'sqlite';
207
+ }>;
@@ -0,0 +1,26 @@
1
+ // src/media/drizzle.ts
2
+ import { sql } from "drizzle-orm";
3
+ import { index, integer, real, sqliteTable, text } from "drizzle-orm/sqlite-core";
4
+ function createGenerationsTable(opts) {
5
+ const { workspaceTable, threadTable, threadOnDelete, indexThread } = opts;
6
+ return sqliteTable("generation", {
7
+ id: text("id").primaryKey().default(sql`(lower(hex(randomblob(16))))`),
8
+ workspaceId: text("workspace_id").notNull().references(() => workspaceTable.id, { onDelete: "cascade" }),
9
+ threadId: text("thread_id").references(() => threadTable.id, threadOnDelete ? { onDelete: threadOnDelete } : void 0),
10
+ type: text("type", { enum: ["image", "video", "avatar", "speech", "transcription"] }).notNull(),
11
+ prompt: text("prompt").notNull(),
12
+ result: text("result"),
13
+ model: text("model"),
14
+ cost: real("cost"),
15
+ metadata: text("metadata", { mode: "json" }).$type(),
16
+ createdAt: integer("created_at", { mode: "timestamp" }).notNull().default(sql`(unixepoch())`)
17
+ }, (table) => [
18
+ index("idx_generation_workspace").on(table.workspaceId),
19
+ index("idx_generation_workspace_type").on(table.workspaceId, table.type),
20
+ ...indexThread ? [index("idx_generation_thread").on(table.threadId)] : []
21
+ ]);
22
+ }
23
+ export {
24
+ createGenerationsTable
25
+ };
26
+ //# sourceMappingURL=drizzle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/media/drizzle.ts"],"sourcesContent":["/**\n * Drizzle (SQLite / D1) table for generated media: one row per generated\n * image, video, speech, avatar or transcription, with its provider metadata as\n * JSON. A product owns its workspace and thread tables; the factory wires the\n * foreign keys into them so the row lives in the product's one drizzle schema.\n * Its own subpath because it imports `drizzle-orm` at module top.\n */\nimport { sql } from 'drizzle-orm'\nimport { index, integer, real, sqliteTable, text } from 'drizzle-orm/sqlite-core'\nimport type { AnySQLiteColumn, AnySQLiteTable } from 'drizzle-orm/sqlite-core'\n\n/** A product table referenced by FK: only the `id` column is touched. */\nexport type GenerationParentTable = AnySQLiteTable & { id: AnySQLiteColumn }\n\nexport interface CreateGenerationsTableOptions {\n workspaceTable: GenerationParentTable\n threadTable: GenerationParentTable\n /** What deleting a thread does to its generations; omitted keeps the database default (no action). */\n threadOnDelete?: 'cascade' | 'set null' | 'restrict' | 'no action'\n /** Index generations by thread, for products that list a thread's media. */\n indexThread?: boolean\n}\n\n/** Build the `generation` table. */\nexport function createGenerationsTable(opts: CreateGenerationsTableOptions) {\n const { workspaceTable, threadTable, threadOnDelete, indexThread } = opts\n return sqliteTable('generation', {\n id: text('id').primaryKey().default(sql`(lower(hex(randomblob(16))))`),\n workspaceId: text('workspace_id').notNull().references(() => workspaceTable.id, { onDelete: 'cascade' }),\n threadId: text('thread_id').references(() => threadTable.id, threadOnDelete ? { onDelete: threadOnDelete } : undefined),\n type: text('type', { enum: ['image', 'video', 'avatar', 'speech', 'transcription'] }).notNull(),\n prompt: text('prompt').notNull(),\n result: text('result'),\n model: text('model'),\n cost: real('cost'),\n metadata: text('metadata', { mode: 'json' }).$type<Record<string, unknown>>(),\n createdAt: integer('created_at', { mode: 'timestamp' }).notNull().default(sql`(unixepoch())`),\n }, (table) => [\n index('idx_generation_workspace').on(table.workspaceId),\n index('idx_generation_workspace_type').on(table.workspaceId, table.type),\n ...(indexThread ? [index('idx_generation_thread').on(table.threadId)] : []),\n ])\n}\n"],"mappings":";AAOA,SAAS,WAAW;AACpB,SAAS,OAAO,SAAS,MAAM,aAAa,YAAY;AAgBjD,SAAS,uBAAuB,MAAqC;AAC1E,QAAM,EAAE,gBAAgB,aAAa,gBAAgB,YAAY,IAAI;AACrE,SAAO,YAAY,cAAc;AAAA,IAC/B,IAAI,KAAK,IAAI,EAAE,WAAW,EAAE,QAAQ,iCAAiC;AAAA,IACrE,aAAa,KAAK,cAAc,EAAE,QAAQ,EAAE,WAAW,MAAM,eAAe,IAAI,EAAE,UAAU,UAAU,CAAC;AAAA,IACvG,UAAU,KAAK,WAAW,EAAE,WAAW,MAAM,YAAY,IAAI,iBAAiB,EAAE,UAAU,eAAe,IAAI,MAAS;AAAA,IACtH,MAAM,KAAK,QAAQ,EAAE,MAAM,CAAC,SAAS,SAAS,UAAU,UAAU,eAAe,EAAE,CAAC,EAAE,QAAQ;AAAA,IAC9F,QAAQ,KAAK,QAAQ,EAAE,QAAQ;AAAA,IAC/B,QAAQ,KAAK,QAAQ;AAAA,IACrB,OAAO,KAAK,OAAO;AAAA,IACnB,MAAM,KAAK,MAAM;AAAA,IACjB,UAAU,KAAK,YAAY,EAAE,MAAM,OAAO,CAAC,EAAE,MAA+B;AAAA,IAC5E,WAAW,QAAQ,cAAc,EAAE,MAAM,YAAY,CAAC,EAAE,QAAQ,EAAE,QAAQ,kBAAkB;AAAA,EAC9F,GAAG,CAAC,UAAU;AAAA,IACZ,MAAM,0BAA0B,EAAE,GAAG,MAAM,WAAW;AAAA,IACtD,MAAM,+BAA+B,EAAE,GAAG,MAAM,aAAa,MAAM,IAAI;AAAA,IACvE,GAAI,cAAc,CAAC,MAAM,uBAAuB,EAAE,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC;AAAA,EAC3E,CAAC;AACH;","names":[]}
@@ -0,0 +1,53 @@
1
+ import type { GenerationType } from '../studio/generation';
2
+ /** The request body every media product accepts; a product extends it with its own fields. */
3
+ export interface GenerateRequestBody {
4
+ workspaceId: string;
5
+ threadId?: string;
6
+ clientRequestId?: string;
7
+ type: GenerationType;
8
+ prompt?: string;
9
+ negativePrompt?: string;
10
+ outputPath?: string;
11
+ model?: string;
12
+ size?: string;
13
+ quality?: string;
14
+ n?: number;
15
+ /** The media catalog publishes both numeric and string durations. */
16
+ duration?: string | number;
17
+ resolution?: string;
18
+ aspectRatio?: string;
19
+ referenceImageUrl?: string;
20
+ voice?: string;
21
+ audioUrl?: string;
22
+ imageUrl?: string;
23
+ avatarId?: string;
24
+ language?: string;
25
+ responseFormat?: string;
26
+ temperature?: number;
27
+ }
28
+ /** The request's checked inputs, recorded on the generation row. */
29
+ export type GenerateInputs = Record<string, unknown> & {
30
+ promptLabel: string;
31
+ audioUrl?: string;
32
+ imageUrl?: string;
33
+ avatarId?: string;
34
+ language?: string;
35
+ responseFormat?: string;
36
+ temperature?: number;
37
+ };
38
+ export type Checked<T> = {
39
+ succeeded: true;
40
+ value: T;
41
+ } | {
42
+ succeeded: false;
43
+ error: string;
44
+ };
45
+ export declare function requiredText(value: unknown): string | null;
46
+ export declare function validateGenerateRequest(type: GenerationType, body: GenerateRequestBody, prompt: string): Checked<GenerateInputs>;
47
+ /** The images requested: absent means one; anything but an integer in range is refused. */
48
+ export declare function imageCountForRequest(value: unknown): Checked<number>;
49
+ /** The model the request names, else the product's default for its type. */
50
+ export declare function modelForRequest(type: GenerationType, body: {
51
+ model?: string;
52
+ }, defaults: Record<GenerationType, string>): string;
53
+ export declare function optionalHttpsUrl(value: unknown, field: string): Checked<string | undefined>;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * The record a media generation leaves behind: the metadata stored on its row,
3
+ * the result URL a browser may be shown, how a provider job's status reads,
4
+ * and the decoding of provider image output. Storage and persistence stay with
5
+ * the product.
6
+ */
7
+ import type { GenerationStatus, GenerationType } from '../studio/generation';
8
+ import type { RouterMediaSource } from './router-client';
9
+ /** Everything a generation's stored metadata can carry. */
10
+ export interface GenerationMetadataFields {
11
+ status: GenerationStatus;
12
+ provider: GenerationType;
13
+ negativePrompt?: string;
14
+ outputPath?: string | null;
15
+ /** The approved publish package, kept only when the request had one. */
16
+ publishPackage?: Record<string, unknown> | object | null;
17
+ inputs?: Record<string, unknown>;
18
+ providerJobId?: string;
19
+ providerStatus?: string;
20
+ providerError?: string;
21
+ resultUrl?: string | null;
22
+ providerResultUrl?: string | null;
23
+ pollingUrl?: string;
24
+ storageStatus?: 'saved' | 'failed';
25
+ storageError?: string;
26
+ clientRequestId?: string;
27
+ batchId?: string;
28
+ outputIndex?: number;
29
+ outputCount?: number;
30
+ assetId?: string;
31
+ assetVersionId?: string;
32
+ vaultPath?: string;
33
+ savedToVaultAt?: string | null;
34
+ r2Key?: string;
35
+ mimeType?: string;
36
+ sizeBytes?: number;
37
+ failureCode?: string;
38
+ retryable?: boolean;
39
+ chatVisibility?: 'hidden';
40
+ }
41
+ /** A result URL safe to store: data URIs are bytes, never a link. */
42
+ export declare function metadataResultUrl(value: string | null | undefined): string | undefined;
43
+ /** The stored metadata of one generation row, with data URIs kept out of its URLs. */
44
+ export declare function generationMetadata({ status, provider, negativePrompt, publishPackage, resultUrl, providerResultUrl, ...fields }: GenerationMetadataFields): Record<string, unknown>;
45
+ /**
46
+ * Router-proxied URLs require the Bearer key, so the browser cannot load them;
47
+ * only public provider URLs are usable as a result before ingestion completes.
48
+ */
49
+ export declare function browserUsableSourceUrl(source: RouterMediaSource | null): string | null;
50
+ export interface ProviderJobStatus {
51
+ status: 'running' | 'succeeded' | 'failed';
52
+ providerStatus: string;
53
+ resultUrl?: string;
54
+ error?: string;
55
+ }
56
+ /** Read a provider job's status response or webhook payload (video or avatar) into the three states a generation row has. */
57
+ export declare function normalizeProviderJobStatus(value: unknown): ProviderJobStatus;
58
+ export type ProviderImageOutput = {
59
+ url?: string;
60
+ b64_json?: string;
61
+ };
62
+ /** The provider outputs that carry an image, by URL or by bytes. */
63
+ export declare function validProviderImages(value: ProviderImageOutput[] | undefined): ProviderImageOutput[];
64
+ /** The bytes a provider returned inline, from a data URI or base64; null when it returned neither. */
65
+ export declare function providerImageBytes(url: string | null | undefined, b64Json: string | null | undefined): {
66
+ bytes: Uint8Array;
67
+ mimeType: string;
68
+ } | null;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Media generation: the Router's media client, the request checks every
3
+ * generation type runs, speech scripts, and the record a generation leaves on
4
+ * its row. Products bind the client once with their router base URL and keys;
5
+ * pricing, default models and persistence stay with the product. The row's
6
+ * drizzle table is `./media/drizzle`.
7
+ */
8
+ export * from './router-client';
9
+ export * from './router-generation';
10
+ export * from './generate-request';
11
+ export * from './speech-script';
12
+ export * from './generation-record';
13
+ export * from './model-catalog';