@hugpy/video-intelligence-ui 0.3.2 → 0.3.3

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 (148) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +9 -0
  3. package/dist/assets/hugpy-mark-BXktFcOQ.png +0 -0
  4. package/dist/assets/index-DuT1AMLn.css +1 -0
  5. package/dist/assets/index-_13ZiBDP.js +4191 -0
  6. package/dist/index.html +71 -0
  7. package/entry.tsx +0 -0
  8. package/index.html +4 -4
  9. package/package.json +42 -4
  10. package/src/assets/hugpy-mark.png +0 -0
  11. package/src/config.ts +0 -0
  12. package/src/demo/DemoBanner.tsx +0 -0
  13. package/src/demo/demo.css +0 -0
  14. package/src/demo/demoFetch.ts +0 -0
  15. package/src/demo/fixtures.ts +0 -0
  16. package/src/demo/identityFixture.ts +0 -0
  17. package/src/demo/index.ts +0 -0
  18. package/src/demo/mediaBase.ts +0 -0
  19. package/src/demo/mode.ts +0 -0
  20. package/src/demo/promptAssist.ts +0 -0
  21. package/src/demo/sampleData.ts +0 -0
  22. package/src/demo/sampleSets.ts +0 -0
  23. package/src/demo/seed.ts +0 -0
  24. package/src/nav/BrandMark.css +0 -0
  25. package/src/nav/BrandMark.tsx +0 -0
  26. package/src/nav/Navbar.css +0 -0
  27. package/src/nav/Navbar.tsx +6 -1
  28. package/src/regions/SpatialRegionEditor.tsx +0 -0
  29. package/src/regions/TemporalRegionEditor.tsx +0 -0
  30. package/src/regions/types.ts +0 -0
  31. package/src/session.ts +0 -0
  32. package/src/share.ts +0 -0
  33. package/src/stations/ActivePanel.tsx +0 -0
  34. package/src/stations/ActiveProcessesStation.tsx +0 -0
  35. package/src/stations/AddFileBar.tsx +0 -0
  36. package/src/stations/AudioCropStation.tsx +0 -0
  37. package/src/stations/ComfyPanel.tsx +0 -0
  38. package/src/stations/ComfyStation.tsx +0 -0
  39. package/src/stations/CondensedKnobStrip.tsx +0 -0
  40. package/src/stations/ConsolePanel.tsx +0 -0
  41. package/src/stations/FrameExtractStation.tsx +0 -0
  42. package/src/stations/GenIdentityBar.tsx +0 -0
  43. package/src/stations/GenerateStation.tsx +2 -1
  44. package/src/stations/GoalComposer.tsx +0 -0
  45. package/src/stations/ImageCropStation.tsx +0 -0
  46. package/src/stations/KnobInfo.tsx +0 -0
  47. package/src/stations/PlaceholderStation.tsx +0 -0
  48. package/src/stations/ScriptFirstStation.tsx +4 -0
  49. package/src/stations/SectionTabs.tsx +0 -0
  50. package/src/stations/SharePanel.tsx +0 -0
  51. package/src/stations/SidebarRegistry.tsx +0 -0
  52. package/src/stations/StationShell.tsx +0 -0
  53. package/src/stations/StudioClipsStation.tsx +0 -0
  54. package/src/stations/TemplateStepsPanel.tsx +190 -0
  55. package/src/stations/ToksPanel.tsx +0 -0
  56. package/src/stations/WorkbenchDrawer.tsx +0 -0
  57. package/src/stations/WorkbenchSidebar.tsx +0 -0
  58. package/src/stations/WorkbenchStation.tsx +0 -0
  59. package/src/stations/comfyEmbed.ts +0 -0
  60. package/src/stations/drawerShell.tsx +0 -0
  61. package/src/stations/ops/AudioCropCore.tsx +0 -0
  62. package/src/stations/ops/CharacterGroupsPanel.tsx +0 -0
  63. package/src/stations/ops/FrameExtractCore.tsx +0 -0
  64. package/src/stations/ops/ImageCropCore.tsx +0 -0
  65. package/src/stations/ops/VideoCropCore.tsx +0 -0
  66. package/src/stations/ops/useVideoCropJobs.ts +0 -0
  67. package/src/stations/oracle/DagPanel.tsx +0 -0
  68. package/src/stations/oracle/OracleStation.tsx +2 -0
  69. package/src/stations/oracle/PerformanceComposer.tsx +119 -0
  70. package/src/stations/oracle/SpatialTab.tsx +0 -0
  71. package/src/stations/oracle/StewardPanel.tsx +0 -0
  72. package/src/stations/oracle/oracle.css +33 -0
  73. package/src/stations/oracle/oracleShared.tsx +0 -0
  74. package/src/stations/oracle/oracleTypes.ts +0 -0
  75. package/src/stations/oracle/useOracle.ts +0 -0
  76. package/src/stations/pollCaps.ts +0 -0
  77. package/src/stations/registry.ts +0 -0
  78. package/src/stations/scriptFirst.css +23 -0
  79. package/src/stations/studio/AngleRingEditor.tsx +0 -0
  80. package/src/stations/studio/IdentitiesStation.tsx +21 -2
  81. package/src/stations/studio/IdentityCreatePanel.tsx +0 -0
  82. package/src/stations/studio/IdentityProfileControls.tsx +0 -0
  83. package/src/stations/studio/StudioActiveProcesses.tsx +0 -0
  84. package/src/stations/studio/StudioAssistLogPanel.tsx +0 -0
  85. package/src/stations/studio/StudioGenerateMode.tsx +0 -0
  86. package/src/stations/studio/StudioGenerateTab.tsx +20 -2
  87. package/src/stations/studio/StudioItemCard.tsx +0 -0
  88. package/src/stations/studio/StudioLibraryTab.tsx +0 -0
  89. package/src/stations/studio/StudioMovieComposer.tsx +0 -0
  90. package/src/stations/studio/StudioMovieSessions.tsx +12 -19
  91. package/src/stations/studio/StudioPlane.tsx +25 -4
  92. package/src/stations/studio/StudioSplicedRow.tsx +0 -0
  93. package/src/stations/studio/StudioViewer.tsx +0 -0
  94. package/src/stations/studio/TurntableViewer.tsx +0 -0
  95. package/src/stations/studio/coordinationBadge.tsx +0 -0
  96. package/src/stations/studio/identityUpload.ts +0 -0
  97. package/src/stations/studio/movieTimeline.ts +0 -0
  98. package/src/stations/studio/promptCard.tsx +0 -0
  99. package/src/stations/studio/studioItem.ts +0 -0
  100. package/src/stations/studio/studioShared.tsx +0 -0
  101. package/src/stations/studio/useIdentityCreateJob.ts +0 -0
  102. package/src/stations/studio/useIdentityProfiles.ts +0 -0
  103. package/src/stations/studio/useReconstruction.ts +0 -0
  104. package/src/stations/types.ts +0 -0
  105. package/src/stations/useAudioCropJobs.ts +0 -0
  106. package/src/stations/useAudioExtractJob.ts +0 -0
  107. package/src/stations/useCropJobs.ts +0 -0
  108. package/src/stations/useFrameJobs.ts +0 -0
  109. package/src/stations/useGenerateJob.ts +0 -0
  110. package/src/stations/useGenerateMovieJob.ts +0 -0
  111. package/src/stations/useGenerateRowJobs.ts +0 -0
  112. package/src/stations/useGenerateSceneJob.ts +0 -0
  113. package/src/stations/useGenerateSceneRowJobs.ts +0 -0
  114. package/src/stations/useScriptFirstRun.ts +0 -0
  115. package/src/style/app.css +49 -0
  116. package/src/transport/client.ts +0 -0
  117. package/src/transport/telemetry.ts +0 -0
  118. package/src/video/DropReceptacle.tsx +0 -0
  119. package/src/video/LengthRow.tsx +0 -0
  120. package/src/video/LibraryGroups.tsx +0 -0
  121. package/src/video/PromptAssistButtons.tsx +6 -4
  122. package/src/video/UnnamedWarn.tsx +0 -0
  123. package/src/video/composerBridge.ts +0 -0
  124. package/src/video/contract.ts +0 -0
  125. package/src/video/coordinationReport.ts +0 -0
  126. package/src/video/jobClock.ts +0 -0
  127. package/src/video/jobTracker.ts +0 -0
  128. package/src/video/mediaLibrary.ts +0 -0
  129. package/src/video/renderCompat.ts +0 -0
  130. package/src/video/sessionForm.ts +0 -0
  131. package/src/video/spreadAssist.ts +0 -0
  132. package/src/video/studioBridge.ts +0 -0
  133. package/src/video/useMediaJobs.ts +0 -0
  134. package/src/video/useModels.ts +0 -0
  135. package/src/video/useMoviePresets.ts +0 -0
  136. package/src/video/useMovieSessions.ts +0 -0
  137. package/src/video/useOperatorHistory.ts +0 -0
  138. package/src/video/usePresets.ts +0 -0
  139. package/src/video/useProjects.ts +0 -0
  140. package/src/video/usePromptAssist.ts +65 -23
  141. package/src/video/useRenderPresets.ts +0 -0
  142. package/src/video/useStudioAssistLog.ts +0 -0
  143. package/src/video/useStudioPresets.ts +0 -0
  144. package/src/video/useToks.ts +0 -0
  145. package/src/video/useWorkerCalls.ts +0 -0
  146. package/tsconfig.json +0 -0
  147. package/vite.config.ts +0 -0
  148. package/src/stations/studio/StudioMovieComposer.tsx.bak-declutter-20260813 +0 -3031
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
@@ -55,6 +55,9 @@ export interface AssistModel {
55
55
  model: string;
56
56
  /** Seated on a worker right now (answers in ~1s) vs present but cold (first call loads it). */
57
57
  serving: boolean;
58
+ /** Canonical residency (STATE-MODEL.md #4): serving|loaded = ready; hot = on a
59
+ * worker drive (pays a t_load); cold = central only (pays a download + load). */
60
+ state?: "serving" | "loaded" | "hot" | "cold";
58
61
  framework?: string | null;
59
62
  /** True for the fleet default — used when the user has never chosen. */
60
63
  default?: boolean;
@@ -154,6 +157,60 @@ function readAssistPrompt(value: unknown): string | null {
154
157
  return null;
155
158
  }
156
159
 
160
+ // Ticket flow (2026-08-28): a cold model load measured 6m12s on the live
161
+ // fleet, and a held browser connection dies long before that (ClientGone) —
162
+ // killing the load, which restarts on the next click, forever. POST with
163
+ // {async:true} returns {ticket} immediately and the generation keeps running
164
+ // server-side; we poll the ticket until the prompt lands. No connection has
165
+ // to survive the load. An old server without the ticket route answers the
166
+ // POST with the direct result, which passes through unchanged.
167
+ const TICKET_POLL_MS = 3_000;
168
+ const TICKET_CEILING_MS = 12 * 60_000;
169
+
170
+ async function assistCall(
171
+ body: Record<string, unknown>,
172
+ specKey: string | undefined,
173
+ operation: string,
174
+ ): Promise<ReturnType<typeof request<unknown>>> {
175
+ const res = await request<unknown>(hugpyConfig.promptAssistUrl, {
176
+ method: "POST",
177
+ headers: { "Content-Type": "application/json" },
178
+ body: JSON.stringify({ ...body, async: true }),
179
+ timeoutMs: 30_000,
180
+ meta: { specKey, operation },
181
+ });
182
+ if (!res.ok) return res;
183
+ const value = okValue(res) as { ticket?: string; pending?: boolean } | null;
184
+ const ticket = value?.ticket;
185
+ if (!ticket) return res; // direct (non-ticket) result — serve as-is
186
+ const deadline = Date.now() + TICKET_CEILING_MS;
187
+ for (;;) {
188
+ await new Promise((r) => setTimeout(r, TICKET_POLL_MS));
189
+ const poll = await request<unknown>(
190
+ `${hugpyConfig.promptAssistUrl}/ticket/${encodeURIComponent(ticket)}`,
191
+ {
192
+ method: "GET",
193
+ timeoutMs: 15_000,
194
+ meta: { specKey, operation: `${operation}.poll` },
195
+ },
196
+ );
197
+ if (!poll.ok) return poll;
198
+ const row = okValue(poll) as { pending?: boolean } | null;
199
+ if (!row?.pending) return poll;
200
+ if (Date.now() >= deadline) {
201
+ return {
202
+ ok: false,
203
+ error: {
204
+ kind: "timeout",
205
+ message:
206
+ "the assistant is still working after 12 minutes — the model may be stuck loading; try again",
207
+ requestId: `assist-ticket-${ticket.slice(0, 8)}`,
208
+ },
209
+ } as Awaited<ReturnType<typeof request<unknown>>>;
210
+ }
211
+ }
212
+ }
213
+
157
214
  export function usePromptAssist({ kind, specKey }: UsePromptAssistOptions): PromptAssistApi {
158
215
  // One in-flight call at a time: `assistBusy` holds the ACTIVE mode or null when idle —
159
216
  // it both blocks concurrent calls and drives which button shows its loading label.
@@ -246,13 +303,10 @@ export function usePromptAssist({ kind, specKey }: UsePromptAssistOptions): Prom
246
303
  context: { kind, ...(extra?.context ?? {}) },
247
304
  };
248
305
 
249
- const res = await request<unknown>(hugpyConfig.promptAssistUrl, {
250
- method: "POST",
251
- headers: { "Content-Type": "application/json" },
252
- body: JSON.stringify(body),
253
- timeoutMs: 90_000, // a few seconds typically; generous for an on-demand worker
254
- meta: { specKey, operation: `prompt.assist.${mode}` },
255
- });
306
+ // Ticket flow — see assistCall: the POST returns immediately and we poll,
307
+ // so a cold model load (measured 6m12s) can finish without the browser
308
+ // holding a connection through it.
309
+ const res = await assistCall(body, specKey, `prompt.assist.${mode}`);
256
310
  if (!res.ok) {
257
311
  setAssistError(describeAppError(errorOf(res)));
258
312
  setAssistBusy(null);
@@ -292,13 +346,7 @@ export function usePromptAssist({ kind, specKey }: UsePromptAssistOptions): Prom
292
346
  const negModel = opts.extra?.model ?? assistModel;
293
347
  if (negModel) body.model = negModel;
294
348
 
295
- const res = await request<unknown>(hugpyConfig.promptAssistUrl, {
296
- method: "POST",
297
- headers: { "Content-Type": "application/json" },
298
- body: JSON.stringify(body),
299
- timeoutMs: 90_000,
300
- meta: { specKey, operation: "prompt.assist.negative" },
301
- });
349
+ const res = await assistCall(body, specKey, "prompt.assist.negative");
302
350
  if (!res.ok) {
303
351
  setAssistError(describeAppError(errorOf(res)));
304
352
  setAssistBusy(null);
@@ -328,15 +376,9 @@ export function usePromptAssist({ kind, specKey }: UsePromptAssistOptions): Prom
328
376
  setAssistError(null);
329
377
  setAssistBusy("spread");
330
378
  const payload = { ...body, ...(assistModel ? { model: assistModel } : {}) };
331
- const res = await request<unknown>(hugpyConfig.promptAssistUrl, {
332
- method: "POST",
333
- headers: { "Content-Type": "application/json" },
334
- body: JSON.stringify(payload),
335
- // A spread writes N paragraphs in one generation, so it is the longest assist
336
- // call there is — and on a cold generator it pays a model load first.
337
- timeoutMs: 180_000,
338
- meta: { specKey, operation: "prompt.assist.spread" },
339
- });
379
+ // A spread writes N paragraphs in one generation, the longest assist call
380
+ // there is — the ticket flow means a cold generator's load can't kill it.
381
+ const res = await assistCall(payload, specKey, "prompt.assist.spread");
340
382
  if (!res.ok) {
341
383
  setAssistError(describeAppError(errorOf(res)));
342
384
  setAssistBusy(null);
File without changes
File without changes
File without changes
File without changes
File without changes
package/tsconfig.json CHANGED
File without changes
package/vite.config.ts CHANGED
File without changes