@hugpy/video-intelligence-ui 0.3.2 → 0.3.4
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/LICENSE +0 -0
- package/README.md +9 -0
- package/dist/assets/hugpy-mark-BXktFcOQ.png +0 -0
- package/dist/assets/index-DMoT8G1q.css +1 -0
- package/dist/assets/index-GeD1mo16.js +4190 -0
- package/dist/index.html +71 -0
- package/entry.tsx +6 -27
- package/index.html +4 -4
- package/package.json +44 -5
- package/src/assets/hugpy-mark.png +0 -0
- package/src/config.ts +11 -27
- package/src/demo/DemoBanner.tsx +0 -0
- package/src/demo/demo.css +0 -0
- package/src/demo/demoFetch.ts +0 -9
- package/src/demo/fixtures.ts +0 -0
- package/src/demo/identityFixture.ts +0 -0
- package/src/demo/index.ts +0 -0
- package/src/demo/mediaBase.ts +0 -0
- package/src/demo/mode.ts +0 -0
- package/src/demo/promptAssist.ts +0 -0
- package/src/demo/sampleData.ts +0 -0
- package/src/demo/sampleSets.ts +0 -0
- package/src/demo/seed.ts +0 -0
- package/src/nav/BrandMark.css +0 -0
- package/src/nav/BrandMark.tsx +0 -0
- package/src/nav/Navbar.css +0 -0
- package/src/nav/Navbar.tsx +8 -3
- package/src/regions/SpatialRegionEditor.tsx +0 -0
- package/src/regions/TemporalRegionEditor.tsx +0 -0
- package/src/regions/types.ts +0 -0
- package/src/session.ts +8 -43
- package/src/share.ts +0 -0
- package/src/stations/ActivePanel.tsx +0 -0
- package/src/stations/ActiveProcessesStation.tsx +0 -0
- package/src/stations/AddFileBar.tsx +0 -0
- package/src/stations/AudioCropStation.tsx +0 -0
- package/src/stations/ComfyPanel.tsx +0 -0
- package/src/stations/ComfyStation.tsx +0 -0
- package/src/stations/CondensedKnobStrip.tsx +0 -0
- package/src/stations/ConsolePanel.tsx +0 -0
- package/src/stations/FrameExtractStation.tsx +0 -0
- package/src/stations/GenIdentityBar.tsx +0 -0
- package/src/stations/GenerateStation.tsx +10 -6
- package/src/stations/GoalComposer.tsx +0 -0
- package/src/stations/ImageCropStation.tsx +0 -0
- package/src/stations/KnobInfo.tsx +0 -0
- package/src/stations/PlaceholderStation.tsx +0 -0
- package/src/stations/ScriptFirstStation.tsx +4 -0
- package/src/stations/SectionTabs.tsx +0 -0
- package/src/stations/SharePanel.tsx +4 -4
- package/src/stations/SidebarRegistry.tsx +0 -0
- package/src/stations/StationShell.tsx +0 -0
- package/src/stations/StudioClipsStation.tsx +0 -0
- package/src/stations/TemplateStepsPanel.tsx +190 -0
- package/src/stations/ToksPanel.tsx +1 -2
- package/src/stations/WorkbenchDrawer.tsx +0 -0
- package/src/stations/WorkbenchSidebar.tsx +8 -261
- package/src/stations/WorkbenchStation.tsx +0 -0
- package/src/stations/comfyEmbed.ts +0 -0
- package/src/stations/drawerShell.tsx +0 -0
- package/src/stations/ops/AudioCropCore.tsx +0 -0
- package/src/stations/ops/CharacterGroupsPanel.tsx +75 -83
- package/src/stations/ops/FrameExtractCore.tsx +0 -0
- package/src/stations/ops/ImageCropCore.tsx +0 -0
- package/src/stations/ops/VideoCropCore.tsx +0 -0
- package/src/stations/ops/useVideoCropJobs.ts +0 -0
- package/src/stations/oracle/DagPanel.tsx +0 -0
- package/src/stations/oracle/OracleStation.tsx +2 -0
- package/src/stations/oracle/PerformanceComposer.tsx +119 -0
- package/src/stations/oracle/SpatialTab.tsx +0 -0
- package/src/stations/oracle/StewardPanel.tsx +0 -0
- package/src/stations/oracle/oracle.css +33 -0
- package/src/stations/oracle/oracleShared.tsx +0 -0
- package/src/stations/oracle/oracleTypes.ts +0 -0
- package/src/stations/oracle/useOracle.ts +0 -0
- package/src/stations/pollCaps.ts +0 -0
- package/src/stations/registry.ts +0 -0
- package/src/stations/scriptFirst.css +23 -0
- package/src/stations/studio/AngleRingEditor.tsx +0 -0
- package/src/stations/studio/IdentitiesStation.tsx +86 -76
- package/src/stations/studio/IdentityCreatePanel.tsx +0 -0
- package/src/stations/studio/IdentityProfileControls.tsx +0 -0
- package/src/stations/studio/StudioActiveProcesses.tsx +0 -0
- package/src/stations/studio/StudioAssistLogPanel.tsx +0 -0
- package/src/stations/studio/StudioGenerateMode.tsx +3 -2
- package/src/stations/studio/StudioGenerateTab.tsx +278 -190
- package/src/stations/studio/StudioItemCard.tsx +0 -0
- package/src/stations/studio/StudioLibraryTab.tsx +0 -0
- package/src/stations/studio/StudioMovieComposer.tsx +321 -46
- package/src/stations/studio/StudioMovieSessions.tsx +12 -19
- package/src/stations/studio/StudioPlane.tsx +28 -5
- package/src/stations/studio/StudioSplicedRow.tsx +0 -0
- package/src/stations/studio/StudioViewer.tsx +6 -11
- package/src/stations/studio/TurntableViewer.tsx +0 -0
- package/src/stations/studio/coordinationBadge.tsx +0 -0
- package/src/stations/studio/identityUpload.ts +0 -0
- package/src/stations/studio/movieTimeline.ts +0 -0
- package/src/stations/studio/promptCard.tsx +0 -0
- package/src/stations/studio/studioItem.ts +0 -0
- package/src/stations/studio/studioShared.tsx +14 -2
- package/src/stations/studio/useIdentityCreateJob.ts +26 -21
- package/src/stations/studio/useIdentityProfiles.ts +0 -0
- package/src/stations/studio/useReconstruction.ts +11 -5
- package/src/stations/types.ts +0 -0
- package/src/stations/useAudioCropJobs.ts +0 -0
- package/src/stations/useAudioExtractJob.ts +0 -0
- package/src/stations/useCropJobs.ts +0 -0
- package/src/stations/useFrameJobs.ts +0 -0
- package/src/stations/useGenerateJob.ts +0 -0
- package/src/stations/useGenerateMovieJob.ts +0 -0
- package/src/stations/useGenerateRowJobs.ts +0 -0
- package/src/stations/useGenerateSceneJob.ts +0 -0
- package/src/stations/useGenerateSceneRowJobs.ts +0 -0
- package/src/stations/useScriptFirstRun.ts +0 -0
- package/src/style/app.css +49 -0
- package/src/transport/client.ts +0 -0
- package/src/transport/telemetry.ts +0 -0
- package/src/video/DropReceptacle.tsx +0 -0
- package/src/video/LengthRow.tsx +0 -0
- package/src/video/LibraryGroups.tsx +0 -0
- package/src/video/PromptAssistButtons.tsx +5 -4
- package/src/video/UnnamedWarn.tsx +0 -0
- package/src/video/composerBridge.ts +0 -0
- package/src/video/contract.ts +0 -0
- package/src/video/coordinationReport.ts +0 -0
- package/src/video/jobClock.ts +0 -0
- package/src/video/jobStream.ts +119 -0
- package/src/video/jobTracker.ts +67 -76
- package/src/video/mediaLibrary.ts +0 -0
- package/src/video/modelsFeed.ts +105 -0
- package/src/video/renderCompat.ts +0 -0
- package/src/video/sessionForm.ts +0 -0
- package/src/video/spreadAssist.ts +0 -0
- package/src/video/studioBridge.ts +0 -0
- package/src/video/studioOracle.ts +48 -0
- package/src/video/useMediaJobs.ts +17 -3
- package/src/video/useModels.ts +12 -53
- package/src/video/useMoviePresets.ts +0 -0
- package/src/video/useMovieSessions.ts +15 -6
- package/src/video/useOperatorHistory.ts +11 -101
- package/src/video/usePresets.ts +0 -0
- package/src/video/useProjects.ts +0 -0
- package/src/video/usePromptAssist.ts +70 -25
- package/src/video/useRenderPresets.ts +0 -0
- package/src/video/useStudioAssistLog.ts +0 -0
- package/src/video/useStudioPresets.ts +0 -0
- package/src/video/useToks.ts +14 -6
- package/src/video/watchVideoJob.ts +43 -0
- package/tsconfig.json +0 -0
- package/vite.config.ts +0 -0
- package/src/stations/studio/StudioMovieComposer.tsx.bak-declutter-20260813 +0 -3031
- package/src/video/useWorkerCalls.ts +0 -165
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
// A live view of EVERY in-flight worker call across ALL transports (web / v1 /
|
|
2
|
-
// discord / cli / media) — the fleet-wide feed the session jobTracker CANNOT see,
|
|
3
|
-
// because the tracker only knows jobs THIS browser enqueued. GET /llm/jobs is the
|
|
4
|
-
// authoritative unified feed; this hook polls it, keeps the in-flight rows
|
|
5
|
-
// (pending / processing / streaming), drops `download` provisioning (shown
|
|
6
|
-
// elsewhere, and there can be dozens), and hands the survivors to the shared Active
|
|
7
|
-
// Processes panel so an identity reconstruction (kind:"identity_reconstruction",
|
|
8
|
-
// transport:"media") — or any render from another station — shows up even though
|
|
9
|
-
// this browser never launched it.
|
|
10
|
-
//
|
|
11
|
-
// Cadence ~2s (the panel doesn't need the tracker's 800ms poll); a fetch error
|
|
12
|
-
// keeps the last-good list rather than flashing empty. Mounted-ref guarded so a
|
|
13
|
-
// late poll never setState after unmount, and the interval is cleared on unmount.
|
|
14
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
15
|
-
import { hugpyConfig } from "../config";
|
|
16
|
-
import { request, okValue } from "../transport/client";
|
|
17
|
-
|
|
18
|
-
/** Poll cadence for the unified worker-call feed. */
|
|
19
|
-
const POLL_MS = 2000;
|
|
20
|
-
|
|
21
|
-
/** In-flight statuses from the /llm/jobs feed (everything else is terminal/idle). */
|
|
22
|
-
const IN_FLIGHT = new Set(["pending", "processing", "streaming"]);
|
|
23
|
-
|
|
24
|
-
/** One in-flight worker call, projected from a /llm/jobs row for the panel. */
|
|
25
|
-
export interface WorkerCall {
|
|
26
|
-
/** Server job id — the cancel handle + the dedup key against a TrackedJob.jobId. */
|
|
27
|
-
id: string;
|
|
28
|
-
/** Raw job kind (humanized for display in the row). */
|
|
29
|
-
kind: string;
|
|
30
|
-
/** In-flight status: pending | processing | streaming. */
|
|
31
|
-
status: string;
|
|
32
|
-
/** Transport that launched it — decides the cancel endpoint (media vs llm chat). */
|
|
33
|
-
transport: string;
|
|
34
|
-
/** Model label if the feed carries one (model_name preferred over model). */
|
|
35
|
-
model: string | null;
|
|
36
|
-
/** Serving worker name if present. */
|
|
37
|
-
worker: string | null;
|
|
38
|
-
/**
|
|
39
|
-
* ms-epoch start anchor, derived from the server `elapsed` seconds at poll time —
|
|
40
|
-
* the row's live clock reads (now - startedAt), so the elapsed ticks between polls
|
|
41
|
-
* and re-aligns to the server's truth on every refresh.
|
|
42
|
-
*/
|
|
43
|
-
startedAt: number;
|
|
44
|
-
/**
|
|
45
|
-
* Fractional progress 0..1 if the feed carries it, else null (unknown → the row
|
|
46
|
-
* shows an indeterminate "working" bar rather than a fabricated percentage).
|
|
47
|
-
*/
|
|
48
|
-
progress: number | null;
|
|
49
|
-
/** Free-text status line the worker is currently emitting (if any). */
|
|
50
|
-
message: string | null;
|
|
51
|
-
/** Coarse pipeline stage label (e.g. "sampling", "encoding") if the feed carries it. */
|
|
52
|
-
stage: string | null;
|
|
53
|
-
/** Last ≤40 log lines, NEWEST LAST — the scrolling tail in the expanded panel. */
|
|
54
|
-
logTail: string[];
|
|
55
|
-
/** Server-asserted wedged flag: the render is not making progress. */
|
|
56
|
-
stalled: boolean;
|
|
57
|
-
/** True once a cancel was requested and the server acknowledged it. */
|
|
58
|
-
cancelRequested: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* ms-epoch of the last observed movement (server `updated_at`), or null. The row
|
|
61
|
-
* derives "last movement Ns ago" as (now - updatedAt) and flips to a stalled look
|
|
62
|
-
* when that exceeds the stall window, so a frozen render stops reading as live.
|
|
63
|
-
*/
|
|
64
|
-
updatedAt: number | null;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function str(v: unknown): string | null {
|
|
68
|
-
return typeof v === "string" && v.trim() ? v : null;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Clamp an arbitrary progress reading into the renderable 0..1 band. */
|
|
72
|
-
function clamp01(v: number): number {
|
|
73
|
-
return v < 0 ? 0 : v > 1 ? 1 : v;
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// A server timestamp → ms-epoch. Tolerates epoch SECONDS (the arm's usual wire
|
|
77
|
-
// form, ~1.7e9), epoch MILLISECONDS (~1.7e12), and ISO strings; anything else → null.
|
|
78
|
-
function toMs(v: unknown): number | null {
|
|
79
|
-
if (typeof v === "number" && isFinite(v)) return v < 1e12 ? v * 1000 : v;
|
|
80
|
-
if (typeof v === "string" && v.trim()) {
|
|
81
|
-
const t = Date.parse(v);
|
|
82
|
-
return isFinite(t) ? t : null;
|
|
83
|
-
}
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// Project the /llm/jobs envelope into the in-flight WorkerCall rows. Defensive by
|
|
88
|
-
// construction (no zod schema for this feed, and strictNullChecks is off in the
|
|
89
|
-
// arm's tsconfig): a malformed row is skipped, never thrown.
|
|
90
|
-
function parseJobs(raw: unknown, at: number): WorkerCall[] {
|
|
91
|
-
const jobs = (raw as { jobs?: unknown } | null)?.jobs;
|
|
92
|
-
if (!Array.isArray(jobs)) return [];
|
|
93
|
-
const out: WorkerCall[] = [];
|
|
94
|
-
for (const j of jobs) {
|
|
95
|
-
if (!j || typeof j !== "object") continue;
|
|
96
|
-
const row = j as Record<string, unknown>;
|
|
97
|
-
const id = str(row.id);
|
|
98
|
-
if (!id) continue;
|
|
99
|
-
const kind = str(row.kind) ?? "";
|
|
100
|
-
if (kind === "download") continue; // provisioning — shown elsewhere
|
|
101
|
-
const status = str(row.status) ?? "";
|
|
102
|
-
if (!IN_FLIGHT.has(status)) continue;
|
|
103
|
-
const elapsed =
|
|
104
|
-
typeof row.elapsed === "number" && isFinite(row.elapsed) ? row.elapsed : 0;
|
|
105
|
-
// NEW fields (a parallel backend change adds progress/stage/log_tail; until it
|
|
106
|
-
// ships these read absent) — all optional, projected defensively so a bare
|
|
107
|
-
// legacy row still renders, just without the richer expanded detail.
|
|
108
|
-
const progress =
|
|
109
|
-
typeof row.progress === "number" && isFinite(row.progress)
|
|
110
|
-
? clamp01(row.progress)
|
|
111
|
-
: null;
|
|
112
|
-
const logTail = Array.isArray(row.log_tail)
|
|
113
|
-
? row.log_tail.filter((l): l is string => typeof l === "string").slice(-40)
|
|
114
|
-
: [];
|
|
115
|
-
out.push({
|
|
116
|
-
id,
|
|
117
|
-
kind,
|
|
118
|
-
status,
|
|
119
|
-
transport: str(row.transport) ?? "",
|
|
120
|
-
model: str(row.model_name) ?? str(row.model),
|
|
121
|
-
worker: str(row.worker),
|
|
122
|
-
startedAt: at - Math.max(0, elapsed) * 1000,
|
|
123
|
-
progress,
|
|
124
|
-
message: str(row.message),
|
|
125
|
-
stage: str(row.stage),
|
|
126
|
-
logTail,
|
|
127
|
-
stalled: row.stalled === true,
|
|
128
|
-
cancelRequested: row.cancel_requested === true,
|
|
129
|
-
updatedAt: toMs(row.updated_at),
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
return out;
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
/**
|
|
136
|
-
* The live in-flight worker calls + a manual `refetch` (fired right after a cancel,
|
|
137
|
-
* so the row disappears without waiting for the next poll tick). Polls only while a
|
|
138
|
-
* consumer is mounted — the panel mounts it only on the Active Processes tab, so no
|
|
139
|
-
* background polling when that tab is closed.
|
|
140
|
-
*/
|
|
141
|
-
export function useWorkerCalls(): { calls: WorkerCall[]; refetch: () => void } {
|
|
142
|
-
const [calls, setCalls] = useState<WorkerCall[]>([]);
|
|
143
|
-
const mounted = useRef(true);
|
|
144
|
-
|
|
145
|
-
const load = useCallback(async () => {
|
|
146
|
-
const r = await request<unknown>(hugpyConfig.llmJobsUrl, {
|
|
147
|
-
meta: { specKey: "workers", operation: "worker.calls.poll" },
|
|
148
|
-
});
|
|
149
|
-
if (!mounted.current) return;
|
|
150
|
-
if (!r.ok) return; // transient — keep last-good, retry next tick
|
|
151
|
-
setCalls(parseJobs(okValue(r), Date.now()));
|
|
152
|
-
}, []);
|
|
153
|
-
|
|
154
|
-
useEffect(() => {
|
|
155
|
-
mounted.current = true;
|
|
156
|
-
void load();
|
|
157
|
-
const id = window.setInterval(() => void load(), POLL_MS);
|
|
158
|
-
return () => {
|
|
159
|
-
mounted.current = false;
|
|
160
|
-
window.clearInterval(id);
|
|
161
|
-
};
|
|
162
|
-
}, [load]);
|
|
163
|
-
|
|
164
|
-
return { calls, refetch: load };
|
|
165
|
-
}
|