@nodetool-ai/cli-timeline 0.0.0-stage → 0.8.9-beta.2

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 (47) hide show
  1. package/README.md +12 -2
  2. package/dist/.nodetool-build-stamp +1 -0
  3. package/dist/commands/timeline-render.d.ts +75 -0
  4. package/dist/commands/timeline-render.d.ts.map +1 -0
  5. package/dist/commands/timeline-render.js +463 -0
  6. package/dist/commands/timeline-render.js.map +1 -0
  7. package/dist/commands/timeline-score.d.ts +16 -0
  8. package/dist/commands/timeline-score.d.ts.map +1 -0
  9. package/dist/commands/timeline-score.js +89 -0
  10. package/dist/commands/timeline-score.js.map +1 -0
  11. package/dist/commands/timeline-validation-output.d.ts +7 -0
  12. package/dist/commands/timeline-validation-output.d.ts.map +1 -0
  13. package/dist/commands/timeline-validation-output.js +9 -0
  14. package/dist/commands/timeline-validation-output.js.map +1 -0
  15. package/dist/commands/timeline-versions.d.ts +72 -0
  16. package/dist/commands/timeline-versions.d.ts.map +1 -0
  17. package/dist/commands/timeline-versions.js +108 -0
  18. package/dist/commands/timeline-versions.js.map +1 -0
  19. package/dist/commands/timeline.d.ts +22 -0
  20. package/dist/commands/timeline.d.ts.map +1 -0
  21. package/dist/commands/timeline.js +103 -0
  22. package/dist/commands/timeline.js.map +1 -0
  23. package/dist/index.d.ts +19 -0
  24. package/dist/index.d.ts.map +1 -0
  25. package/dist/index.js +14 -0
  26. package/dist/index.js.map +1 -0
  27. package/dist/nodetool.d.ts +3 -0
  28. package/dist/nodetool.d.ts.map +1 -0
  29. package/dist/nodetool.js +4 -0
  30. package/dist/nodetool.js.map +1 -0
  31. package/dist/timeline-debug/harness.d.ts +93 -0
  32. package/dist/timeline-debug/harness.d.ts.map +1 -0
  33. package/dist/timeline-debug/harness.js +100 -0
  34. package/dist/timeline-debug/harness.js.map +1 -0
  35. package/dist/timeline-debug/index.d.ts +9 -0
  36. package/dist/timeline-debug/index.d.ts.map +1 -0
  37. package/dist/timeline-debug/index.js +9 -0
  38. package/dist/timeline-debug/index.js.map +1 -0
  39. package/dist/timeline-debug/interactions.d.ts +19 -0
  40. package/dist/timeline-debug/interactions.d.ts.map +1 -0
  41. package/dist/timeline-debug/interactions.js +17 -0
  42. package/dist/timeline-debug/interactions.js.map +1 -0
  43. package/dist/timeline-debug/target.d.ts +34 -0
  44. package/dist/timeline-debug/target.d.ts.map +1 -0
  45. package/dist/timeline-debug/target.js +109 -0
  46. package/dist/timeline-debug/target.js.map +1 -0
  47. package/package.json +63 -4
@@ -0,0 +1,100 @@
1
+ import { runInteractionSteps } from "@nodetool-ai/cli-common/interaction-script";
2
+ import { writeDebugBundle } from "@nodetool-ai/cli-common/debug-bundle";
3
+ import { resolveTimelineTarget } from "./target.js";
4
+ async function loadCore() {
5
+ const core = await import("@nodetool-ai/execution/timeline-debug");
6
+ return {
7
+ validateTimelineSequence: (raw, meta) => core.validateTimelineSequence(raw, meta),
8
+ buildTimelineDebugReport: (input) => core.buildTimelineDebugReport(input),
9
+ renderTimelineReportMarkdown: (report) => core.renderTimelineReportMarkdown(report)
10
+ };
11
+ }
12
+ async function loadBridgeFactory() {
13
+ const { createTimelineToolBridge } = await import("@nodetool-ai/agents");
14
+ return (initial) =>
15
+ // SAFETY: the eval-surface bridge in @nodetool-ai/agents implements this
16
+ // exact tool list and snapshot — it is the bridge this type describes. The
17
+ // two packages declare the timeline document types independently, and that
18
+ // duplication is the only reason the structures do not line up.
19
+ createTimelineToolBridge(initial);
20
+ }
21
+ /** Load a timeline and validate it — no bridge, no bundle. */
22
+ export async function runTimelineValidate(ref, deps) {
23
+ const resolved = await resolveTimelineTarget(ref, deps);
24
+ const core = deps.core ?? (await loadCore());
25
+ const validation = await core.validateTimelineSequence(resolved.raw, resolved.meta);
26
+ return { target: resolved.target, validation };
27
+ }
28
+ /**
29
+ * Replay `--interact` against the headless bridge and write the bundle.
30
+ *
31
+ * A failing step is recorded and the script continues: a run that stops at the
32
+ * first error hides every problem behind it, and the report is what the caller
33
+ * came for.
34
+ */
35
+ export async function runTimelineDebug(ref, options, deps) {
36
+ const resolved = await resolveTimelineTarget(ref, deps);
37
+ const core = deps.core ?? (await loadCore());
38
+ const steps = options.interact ?? [];
39
+ const interactions = [];
40
+ let snapshot;
41
+ if (steps.length > 0) {
42
+ const createBridge = deps.createBridge ?? (await loadBridgeFactory());
43
+ const sequence = {
44
+ ...resolved.meta,
45
+ tracks: resolved.document.tracks,
46
+ clips: resolved.document.clips,
47
+ markers: resolved.document.markers,
48
+ // Ticks are read against it, so a session that never sees the stored
49
+ // tempo rescales the midi clips off the 120 BPM default.
50
+ tempo: resolved.document.tempo
51
+ };
52
+ if (resolved.document.camera2d !== undefined) {
53
+ sequence.camera2d = resolved.document.camera2d;
54
+ }
55
+ const bridge = createBridge({ sequence });
56
+ interactions.push(...(await runInteractionSteps(steps, bridge.tools, "timeline", deps.onLog)));
57
+ snapshot = bridge.finalState();
58
+ }
59
+ // The bridge hands back its full tracks, clips and markers, so the document
60
+ // the session ended with is a real document. Markers fall back to the ones
61
+ // the target carried, for a bridge that does not report them.
62
+ const finalCamera2d = snapshot?.camera2d !== undefined
63
+ ? snapshot.camera2d
64
+ : resolved.document.camera2d;
65
+ let finalDocument;
66
+ if (snapshot?.documentTracks && snapshot.documentClips) {
67
+ finalDocument = {
68
+ tracks: snapshot.documentTracks,
69
+ clips: snapshot.documentClips,
70
+ markers: snapshot.markers ?? resolved.document.markers,
71
+ tempo: snapshot.tempo ?? resolved.document.tempo
72
+ };
73
+ if (finalCamera2d !== undefined) {
74
+ finalDocument.camera2d = finalCamera2d;
75
+ }
76
+ }
77
+ const reportInput = {
78
+ target: resolved.target,
79
+ document: resolved.raw,
80
+ meta: resolved.meta,
81
+ interactions
82
+ };
83
+ if (snapshot) {
84
+ reportInput.finalState = snapshot;
85
+ }
86
+ if (finalDocument) {
87
+ reportInput.finalDocument = finalDocument;
88
+ }
89
+ const report = await core.buildTimelineDebugReport(reportInput);
90
+ const bundleDir = await writeDebugBundle({
91
+ kind: "timeline",
92
+ ref,
93
+ outDir: options.outDir,
94
+ raw: resolved.raw,
95
+ report,
96
+ reportMarkdown: core.renderTimelineReportMarkdown(report),
97
+ });
98
+ return { report, bundleDir };
99
+ }
100
+ //# sourceMappingURL=harness.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"harness.js","sourceRoot":"","sources":["../../src/timeline-debug/harness.ts"],"names":[],"mappings":"AAqBA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4CAA4C,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sCAAsC,CAAC;AACxE,OAAO,EACL,qBAAqB,EAItB,MAAM,aAAa,CAAC;AA8ErB,KAAK,UAAU,QAAQ;IACrB,MAAM,IAAI,GAAG,MAAM,MAAM,CAAC,uCAAuC,CAAC,CAAC;IACnE,OAAO;QACL,wBAAwB,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,EAAE,CACtC,IAAI,CAAC,wBAAwB,CAAC,GAAG,EAAE,IAAI,CAAC;QAC1C,wBAAwB,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC;QACzE,4BAA4B,EAAE,CAAC,MAAM,EAAE,EAAE,CACvC,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC;KAC5C,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,iBAAiB;IAC9B,MAAM,EAAE,wBAAwB,EAAE,GAAG,MAAM,MAAM,CAAC,qBAAqB,CAAC,CAAC;IACzE,OAAO,CAAC,OAAO,EAAE,EAAE;IACjB,yEAAyE;IACzE,2EAA2E;IAC3E,2EAA2E;IAC3E,gEAAgE;IAChE,wBAAwB,CACtB,OAAyD,CACxC,CAAC;AACxB,CAAC;AAED,8DAA8D;AAC9D,MAAM,CAAC,KAAK,UAAU,mBAAmB,CACvC,GAAW,EACX,IAAuB;IAEvB,MAAM,QAAQ,GAAG,MAAM,qBAAqB,CAAC,G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AAC;IACD,IAAI,aAAa,EAAE,CAAC;QAClB,WAAW,CAAC,aAAa,GAAG,aAAa,CAAC;IAC5C,CAAC;IACD,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB,CAAC,WAAW,CAAC,CAAC;IAEhE,MAAM,SAAS,GAAG,MAAM,gBAAgB,CAAC;QACvC,IAAI,EAAE,UAAU;QAChB,GAAG;QACH,MAAM,EAAE,OAAO,CAAC,MAAM;QACtB,GAAG,EAAE,QAAQ,CAAC,GAAG;QACjB,MAAM;QACN,cAAc,EAAE,IAAI,CAAC,4BAA4B,CAAC,MAAM,CAAC;KAC1D,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;AAC/B,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The CLI host for the timeline debug harness: target resolution, the
3
+ * `--interact` script, and the bundle writer. The rules themselves live in
4
+ * `@nodetool-ai/execution/timeline-debug`.
5
+ */
6
+ export { runTimelineDebug, runTimelineValidate, type CreateTimelineBridge, type TimelineBridge, type TimelineBridgeSnapshot, type TimelineBridgeTool, type TimelineDebugCore, type TimelineDebugDeps, type TimelineDebugOptions, type TimelineDebugResult, type TimelineValidateResult } from "./harness.js";
7
+ export { normalizeToolName, parseInteractionScript, type TimelineInteractionStep } from "./interactions.js";
8
+ export { resolveTimelineTarget, type ResolvedTimelineTarget, type TimelineSequenceRecord, type TimelineSequenceSettings, type TimelineTargetDeps } from "./target.js";
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/timeline-debug/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EACnB,KAAK,oBAAoB,EACzB,KAAK,cAAc,EACnB,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACxB,KAAK,sBAAsB,EAC5B,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EACtB,KAAK,uBAAuB,EAC7B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,wBAAwB,EAC7B,KAAK,kBAAkB,EACxB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * The CLI host for the timeline debug harness: target resolution, the
3
+ * `--interact` script, and the bundle writer. The rules themselves live in
4
+ * `@nodetool-ai/execution/timeline-debug`.
5
+ */
6
+ export { runTimelineDebug, runTimelineValidate } from "./harness.js";
7
+ export { normalizeToolName, parseInteractionScript } from "./interactions.js";
8
+ export { resolveTimelineTarget } from "./target.js";
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/timeline-debug/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,gBAAgB,EAChB,mBAAmB,EAUpB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,iBAAiB,EACjB,sBAAsB,EAEvB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,qBAAqB,EAKtB,MAAM,aAAa,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * The `--interact` script for `nodetool timeline debug`.
3
+ *
4
+ * A step names one timeline tool and the input to call it with:
5
+ *
6
+ * ```json
7
+ * [{"tool": "add_track", "input": {"type": "audio"}},
8
+ * {"tool": "ui_timeline_animate_clip",
9
+ * "input": {"target": "Title", "animations": [{"role": "in", "preset": "fade"}]}}]
10
+ * ```
11
+ *
12
+ * Both spellings resolve to the same tool: the `ui_timeline_` prefix is what
13
+ * the bridge and the browser call it, and typing it for every step is noise.
14
+ */
15
+ import { type InteractionStep } from "@nodetool-ai/cli-common/interaction-script";
16
+ /** One parsed step, with the tool name in its canonical `ui_timeline_*` form. */
17
+ export type TimelineInteractionStep = InteractionStep;
18
+ export declare const normalizeToolName: (name: string) => string, parseInteractionScript: (json: string) => InteractionStep[];
19
+ //# sourceMappingURL=interactions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactions.d.ts","sourceRoot":"","sources":["../../src/timeline-debug/interactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAEL,KAAK,eAAe,EACrB,MAAM,4CAA4C,CAAC;AAEpD,iFAAiF;AACjF,MAAM,MAAM,uBAAuB,GAAG,eAAe,CAAC;AAEtD,eAAO,MAAQ,iBAAiB,4BAAE,sBAAsB,qCAIrD,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * The `--interact` script for `nodetool timeline debug`.
3
+ *
4
+ * A step names one timeline tool and the input to call it with:
5
+ *
6
+ * ```json
7
+ * [{"tool": "add_track", "input": {"type": "audio"}},
8
+ * {"tool": "ui_timeline_animate_clip",
9
+ * "input": {"target": "Title", "animations": [{"role": "in", "preset": "fade"}]}}]
10
+ * ```
11
+ *
12
+ * Both spellings resolve to the same tool: the `ui_timeline_` prefix is what
13
+ * the bridge and the browser call it, and typing it for every step is noise.
14
+ */
15
+ import { createInteractionScript } from "@nodetool-ai/cli-common/interaction-script";
16
+ export const { normalizeToolName, parseInteractionScript } = createInteractionScript("ui_timeline_", '{"tool":"add_track","input":{"type":"audio"}}');
17
+ //# sourceMappingURL=interactions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactions.js","sourceRoot":"","sources":["../../src/timeline-debug/interactions.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EACL,uBAAuB,EAExB,MAAM,4CAA4C,CAAC;AAKpD,MAAM,CAAC,MAAM,EAAE,iBAAiB,EAAE,sBAAsB,EAAE,GACxD,uBAAuB,CACrB,cAAc,EACd,+CAA+C,CAChD,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { TimelineDocument } from "@nodetool-ai/protocol/api-schemas/timeline.js";
2
+ import type { TimelineDebugTarget } from "@nodetool-ai/execution/timeline-debug";
3
+ /** A `timeline_sequences` row as the harness needs it. */
4
+ export interface TimelineSequenceRecord {
5
+ id: string;
6
+ name?: string;
7
+ fps?: number;
8
+ width?: number;
9
+ height?: number;
10
+ /** The stored document — a JSON string or an already-parsed object. */
11
+ document: unknown;
12
+ }
13
+ export interface TimelineTargetDeps {
14
+ /** Load a timeline sequence by DB id. */
15
+ loadSequence: (id: string) => Promise<TimelineSequenceRecord | null>;
16
+ }
17
+ /** The sequence settings a document does not carry itself. */
18
+ export interface TimelineSequenceSettings {
19
+ fps?: number;
20
+ width?: number;
21
+ height?: number;
22
+ durationMs?: number;
23
+ }
24
+ export interface ResolvedTimelineTarget {
25
+ target: TimelineDebugTarget;
26
+ /** The document exactly as loaded — validation's input, unrepaired. */
27
+ raw: unknown;
28
+ /** The same document, read as tracks + clips + markers. */
29
+ document: TimelineDocument;
30
+ meta: TimelineSequenceSettings;
31
+ }
32
+ /** Resolve a timeline target: a JSON file path or a sequence row id. */
33
+ export declare function resolveTimelineTarget(ref: string, deps: TimelineTargetDeps): Promise<ResolvedTimelineTarget>;
34
+ //# sourceMappingURL=target.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.d.ts","sourceRoot":"","sources":["../../src/timeline-debug/target.ts"],"names":[],"mappings":"AAeA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,+CAA+C,CAAC;AACtF,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,uCAAuC,CAAC;AASjF,0DAA0D;AAC1D,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,uEAAuE;IACvE,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,kBAAkB;IACjC,yCAAyC;IACzC,YAAY,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,sBAAsB,GAAG,IAAI,CAAC,CAAC;CACtE;AAED,8DAA8D;AAC9D,MAAM,WAAW,wBAAwB;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,sBAAsB;IACrC,MAAM,EAAE,mBAAmB,CAAC;IAC5B,uEAAuE;IACvE,GAAG,EAAE,OAAO,CAAC;IACb,2DAA2D;IAC3D,QAAQ,EAAE,gBAAgB,CAAC;IAC3B,IAAI,EAAE,wBAAwB,CAAC;CAChC;AAkDD,wEAAwE;AACxE,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,kBAAkB,GACvB,OAAO,CAAC,sBAAsB,CAAC,CA6CjC"}
@@ -0,0 +1,109 @@
1
+ /**
2
+ * Resolves a timeline debug target into a document plus its sequence settings.
3
+ *
4
+ * A timeline is named two ways, and both end up in the same shape:
5
+ *
6
+ * - a **JSON file** — either a bare `TimelineDocument` (`tracks`/`clips`/
7
+ * `markers`) or a wrapper carrying one under `document`, as the
8
+ * `timeline_sequences` row and the `GET /api/timeline/:id` response do;
9
+ * - a **timeline_sequences row id**, read through an injected loader so this
10
+ * module needs no database.
11
+ *
12
+ * A path that exists on disk wins over an id, so a file named like an id is
13
+ * still readable.
14
+ */
15
+ import { existsSync, readFileSync } from "node:fs";
16
+ import { isBoolean, isFiniteNumber, isRecord, isString } from "@nodetool-ai/cli-common/predicates";
17
+ import { documentOf } from "@nodetool-ai/cli-common/document-json";
18
+ const numberOr = (value) => isFiniteNumber(value) ? value : undefined;
19
+ /** Read fps/width/height off whatever wrapper carried the document. */
20
+ function settingsOf(raw) {
21
+ if (!isRecord(raw))
22
+ return {};
23
+ const settings = {};
24
+ const fps = numberOr(raw.fps);
25
+ const width = numberOr(raw.width);
26
+ const height = numberOr(raw.height);
27
+ const durationMs = numberOr(raw.durationMs);
28
+ if (fps !== undefined)
29
+ settings.fps = fps;
30
+ if (width !== undefined)
31
+ settings.width = width;
32
+ if (height !== undefined)
33
+ settings.height = height;
34
+ if (durationMs !== undefined)
35
+ settings.durationMs = durationMs;
36
+ return settings;
37
+ }
38
+ /** A document is anything with `tracks` and `clips` arrays. */
39
+ const looksLikeDocument = (value) => isRecord(value) && Array.isArray(value.tracks) && Array.isArray(value.clips);
40
+ /** Read a document as tracks + clips + markers, defaulting what is missing. */
41
+ function asDocument(raw) {
42
+ const record = isRecord(raw) ? raw : {};
43
+ const document = {
44
+ tracks: Array.isArray(record.tracks)
45
+ ? record.tracks
46
+ : [],
47
+ clips: Array.isArray(record.clips)
48
+ ? record.clips
49
+ : [],
50
+ markers: Array.isArray(record.markers)
51
+ ? record.markers
52
+ : []
53
+ };
54
+ if (Array.isArray(record.transcript)) {
55
+ document.transcript = record.transcript;
56
+ }
57
+ if (isBoolean(record.scriptEnabled)) {
58
+ document.scriptEnabled = record.scriptEnabled;
59
+ }
60
+ if (record.camera2d !== undefined) {
61
+ document.camera2d = record.camera2d;
62
+ }
63
+ return document;
64
+ }
65
+ /** Resolve a timeline target: a JSON file path or a sequence row id. */
66
+ export async function resolveTimelineTarget(ref, deps) {
67
+ if (existsSync(ref)) {
68
+ let parsed;
69
+ try {
70
+ parsed = JSON.parse(readFileSync(ref, "utf8"));
71
+ }
72
+ catch (e) {
73
+ throw new Error(`${ref} is not valid JSON: ${e.message}`);
74
+ }
75
+ const raw = documentOf(parsed);
76
+ if (!looksLikeDocument(raw)) {
77
+ throw new Error(`${ref} is not a timeline document (no \`tracks\`/\`clips\` arrays, and no \`document\` field carrying them).`);
78
+ }
79
+ const name = isRecord(parsed) && isString(parsed.name)
80
+ ? parsed.name
81
+ : undefined;
82
+ const target = { kind: "file", ref };
83
+ if (name) {
84
+ target.name = name;
85
+ }
86
+ return {
87
+ target,
88
+ raw,
89
+ document: asDocument(raw),
90
+ meta: { ...settingsOf(parsed), ...settingsOf(raw) }
91
+ };
92
+ }
93
+ const record = await deps.loadSequence(ref);
94
+ if (!record) {
95
+ throw new Error(`Timeline sequence not found: ${ref}`);
96
+ }
97
+ const raw = documentOf(record);
98
+ const target = { kind: "id", ref };
99
+ if (record.name) {
100
+ target.name = record.name;
101
+ }
102
+ return {
103
+ target,
104
+ raw,
105
+ document: asDocument(raw),
106
+ meta: settingsOf(record)
107
+ };
108
+ }
109
+ //# sourceMappingURL=target.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"target.js","sourceRoot":"","sources":["../../src/timeline-debug/target.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAGnD,OAAO,EACL,SAAS,EACT,cAAc,EACd,QAAQ,EACR,QAAQ,EACT,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,UAAU,EAAkB,MAAM,uCAAuC,CAAC;AAmCnF,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAsB,EAAE,CACtD,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC;AAE5C,uEAAuE;AACvE,SAAS,UAAU,CAAC,GAAY;IAC9B,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC;QAAE,OAAO,EAAE,CAAC;IAC9B,MAAM,QAAQ,GAA6B,EAAE,CAAC;IAC9C,MAAM,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC9B,MAAM,KAAK,GAAG,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAClC,MAAM,MAAM,GAAG,QAAQ,CAAC,GAAG,CAAC,MAAM,CAAC,C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AM,CAAC,IAAI,GAAG,IAAI,CAAC;QACrB,CAAC;QACD,OAAO;YACL,MAAM;YACN,GAAG;YACH,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC;YACzB,IAAI,EAAE,EAAE,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,GAAG,UAAU,CAAC,GAAG,CAAC,EAAE;SACpD,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC;IAC5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC;IACzD,CAAC;IACD,MAAM,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,CAAC;IAC/B,MAAM,MAAM,GAAwB,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC;IACxD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;QAChB,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IAC5B,CAAC;IACD,OAAO;QACL,MAAM;QACN,GAAG;QACH,QAAQ,EAAE,UAAU,CAAC,GAAG,CAAC;QACzB,IAAI,EAAE,UAAU,CAAC,MAAM,CAAC;KACzB,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,65 @@
1
1
  {
2
2
  "name": "@nodetool-ai/cli-timeline",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.8.9-beta.2",
4
+ "description": "Independent timeline command feature for NodeTool",
5
+ "type": "module",
6
+ "engines": {
7
+ "node": ">=22.0.0"
8
+ },
9
+ "main": "dist/index.js",
10
+ "types": "dist/index.d.ts",
11
+ "bin": {
12
+ "nodetool-timeline": "dist/nodetool.js"
13
+ },
14
+ "exports": {
15
+ ".": {
16
+ "nodetool-dev": "./src/index.ts",
17
+ "types": "./dist/index.d.ts",
18
+ "import": "./dist/index.js",
19
+ "default": "./dist/index.js"
20
+ },
21
+ "./*": {
22
+ "nodetool-dev": "./src/*.ts",
23
+ "types": "./dist/*.d.ts",
24
+ "import": "./dist/*.js",
25
+ "default": "./dist/*.js"
26
+ }
27
+ },
28
+ "scripts": {
29
+ "build": "node ../../scripts/build-typescript-workspace.mjs",
30
+ "test": "node ../../scripts/run-vitest.mjs run",
31
+ "lint": "node ../../scripts/run-tsc.mjs --noEmit"
32
+ },
33
+ "dependencies": {
34
+ "@nodetool-ai/agents": "0.8.9-beta.2",
35
+ "@nodetool-ai/cli-common": "0.8.9-beta.2",
36
+ "@nodetool-ai/config": "0.8.9-beta.2",
37
+ "@nodetool-ai/execution": "0.8.9-beta.2",
38
+ "@nodetool-ai/models": "0.8.9-beta.2",
39
+ "@nodetool-ai/node-catalog": "0.8.9-beta.2",
40
+ "@nodetool-ai/pack-manager": "0.8.9-beta.2",
41
+ "@nodetool-ai/protocol": "0.8.9-beta.2",
42
+ "@nodetool-ai/runtime": "0.8.9-beta.2",
43
+ "@nodetool-ai/storage": "0.8.9-beta.2",
44
+ "@nodetool-ai/video-nodes": "0.8.9-beta.2",
45
+ "commander": "^12.1.0"
46
+ },
47
+ "devDependencies": {
48
+ "@types/node": "^22.0.0",
49
+ "typescript": "npm:@typescript/typescript6@6.0.2",
50
+ "vitest": "^5.0.1"
51
+ },
52
+ "license": "MIT",
53
+ "repository": {
54
+ "type": "git",
55
+ "url": "https://github.com/nodetool-ai/nodetool.git",
56
+ "directory": "packages/cli-timeline"
57
+ },
58
+ "publishConfig": {
59
+ "access": "public"
60
+ },
61
+ "files": [
62
+ "dist",
63
+ "README.md"
64
+ ]
65
+ }