@automovie/template 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/generated/pnpm-workspace.json +1 -0
- package/generated/skills/visual-debugging/capture.md +1 -1
- package/lib/createAutoMovieScaffold.d.ts +4 -2
- package/lib/createAutoMovieScaffold.js +11 -3
- package/lib/createAutoMovieScaffold.js.map +1 -1
- package/package.json +2 -2
- package/scaffold/instructions/.agents/skills/audio/film-sound.md +2 -0
- package/scaffold/instructions/.agents/skills/audio/listening.md +2 -0
- package/scaffold/instructions/.agents/skills/contracts/SKILL.md +1 -1
- package/scaffold/instructions/.agents/skills/contracts/development/SKILL.md +1 -3
- package/scaffold/instructions/.agents/skills/contracts/development/behaviors.md +14 -6
- package/scaffold/instructions/.agents/skills/contracts/development/composition.md +21 -7
- package/scaffold/instructions/.agents/skills/contracts/development/entities.md +22 -8
- package/scaffold/instructions/.agents/skills/contracts/items.md +7 -12
- package/scaffold/instructions/.agents/skills/contracts/story/SKILL.md +18 -22
- package/scaffold/instructions/.agents/skills/contracts/story/discovery/brief.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/discovery/common.md +27 -0
- package/scaffold/instructions/.agents/skills/contracts/story/{shared/discovery → discovery}/narratives.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/{shared/discovery → discovery}/screenplay.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/discovery/scripts.md +9 -0
- package/scaffold/instructions/.agents/skills/contracts/story/discovery/settings.md +13 -0
- package/scaffold/instructions/.agents/skills/contracts/story/{shared/discovery → discovery}/treatments.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/brief.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/common.md +26 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/index.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/narratives.md +25 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/review.md +21 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/screenplay.md +39 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/scripts.md +17 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/settings.md +31 -0
- package/scaffold/instructions/.agents/skills/contracts/story/obligations/treatments.md +19 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/brief.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/{shared/principles → principles}/common.md +2 -2
- package/scaffold/instructions/.agents/skills/contracts/story/principles/index.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/narratives.md +25 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/research.md +21 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/review.md +21 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/screenplay.md +89 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/scripts.md +9 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/settings.md +13 -0
- package/scaffold/instructions/.agents/skills/contracts/story/principles/treatments.md +19 -0
- package/scaffold/instructions/.agents/skills/contracts/story/upstream/screenplay.md +11 -0
- package/scaffold/instructions/.agents/skills/contracts/story/upstream/scripts.md +9 -0
- package/scaffold/instructions/.agents/skills/contracts/story/{shared/upstream → upstream}/treatments.md +2 -2
- package/scaffold/instructions/.agents/skills/development/modules.md +7 -1
- package/scaffold/instructions/.agents/skills/development/source-layout.md +1 -1
- package/scaffold/instructions/.agents/skills/development/testing.md +1 -1
- package/scaffold/instructions/.agents/skills/evidence/adoption.md +2 -2
- package/scaffold/instructions/.agents/skills/evidence/answering.md +7 -1
- package/scaffold/instructions/.agents/skills/evidence/configuration.md +3 -3
- package/scaffold/instructions/.agents/skills/image/canon-references.md +5 -3
- package/scaffold/instructions/.agents/skills/image/diffusion/editing.md +2 -0
- package/scaffold/instructions/.agents/skills/motion/SKILL.md +1 -0
- package/scaffold/instructions/.agents/skills/motion/catalog-cases.md +10 -16
- package/scaffold/instructions/.agents/skills/motion/compose/composition.md +6 -2
- package/scaffold/instructions/.agents/skills/motion/control-channels.md +4 -0
- package/scaffold/instructions/.agents/skills/motion/frame-evaluation.md +2 -0
- package/scaffold/instructions/.agents/skills/motion/judgment.md +12 -12
- package/scaffold/instructions/.agents/skills/motion/performance.md +4 -4
- package/scaffold/instructions/.agents/skills/motion/segment-review.md +3 -9
- package/scaffold/instructions/.agents/skills/motion/staging.md +6 -4
- package/scaffold/instructions/.agents/skills/production/assembly.md +12 -21
- package/scaffold/instructions/.agents/skills/production/captions.md +2 -0
- package/scaffold/instructions/.agents/skills/production/director.md +7 -1
- package/scaffold/instructions/.agents/skills/production/media-records.md +2 -0
- package/scaffold/instructions/.agents/skills/production/project-context.md +4 -0
- package/scaffold/instructions/.agents/skills/production/workflow.md +1 -1
- package/scaffold/instructions/.agents/skills/review/delivery-review.md +26 -47
- package/scaffold/instructions/.agents/skills/review/estimation.md +1 -1
- package/scaffold/instructions/.agents/skills/review/independent-reading.md +4 -4
- package/scaffold/instructions/.agents/skills/review/narrative-rounds.md +4 -8
- package/scaffold/instructions/.agents/skills/review/source-review.md +4 -4
- package/scaffold/instructions/.agents/skills/story/answers.md +4 -4
- package/scaffold/instructions/.agents/skills/story/correction/inspection.md +6 -6
- package/scaffold/instructions/.agents/skills/story/correction/repair.md +8 -6
- package/scaffold/instructions/.agents/skills/story/document-layout.md +11 -4
- package/scaffold/instructions/.agents/skills/story/layers/SKILL.md +2 -2
- package/scaffold/instructions/.agents/skills/story/layers/brief.md +4 -4
- package/scaffold/instructions/.agents/skills/story/layers/notation.md +8 -4
- package/scaffold/instructions/.agents/skills/story/layers/screenplay.md +6 -20
- package/scaffold/instructions/.agents/skills/story/layers/scripts.md +3 -7
- package/scaffold/instructions/.agents/skills/story/layers/settings.md +2 -2
- package/scaffold/instructions/.agents/skills/story/layers/shots.md +6 -10
- package/scaffold/instructions/.agents/skills/story/layers/treatments.md +4 -2
- package/scaffold/instructions/.agents/skills/story/planning/direction.md +2 -0
- package/scaffold/instructions/.agents/skills/story/planning/discovery.md +1 -1
- package/scaffold/instructions/.agents/skills/story/planning/research.md +7 -15
- package/scaffold/instructions/.agents/skills/story/workflow/routes.md +1 -1
- package/scaffold/instructions/.agents/skills/story/workflow/short.md +4 -8
- package/scaffold/instructions/.agents/skills/video/diffusion/continuity.md +2 -0
- package/scaffold/instructions/.agents/skills/video/diffusion/models.md +2 -0
- package/scaffold/instructions/.agents/skills/video/diffusion/prompts.md +1 -1
- package/scaffold/instructions/.agents/skills/video/direct-film.md +1 -1
- package/scaffold/instructions/.agents/skills/video/generation.md +4 -0
- package/scaffold/instructions/.agents/skills/video/requests.md +2 -0
- package/scaffold/instructions/.agents/skills/visual-debugging/SKILL.md +1 -1
- package/scaffold/instructions/AGENTS.md +4 -4
- package/scaffold/production/README.md +28 -0
- package/scaffold/production/package.json +4 -2
- package/scaffold/production/src/executable/motionTake/IMotionTakeSource.ts +65 -0
- package/scaffold/production/src/executable/motionTake/assertMotionTakeBindings.ts +64 -0
- package/scaffold/production/src/executable/motionTake/collectMotionTakeFiles.ts +71 -0
- package/scaffold/production/src/executable/motionTake/hashMotionTakeFile.ts +19 -0
- package/scaffold/production/src/executable/motionTake/openMotionTake.ts +178 -0
- package/scaffold/production/src/executable/motionTake/readMotionTakeArtifact.ts +36 -0
- package/scaffold/production/src/executable/motionTake/readMotionTakeInstalledLock.ts +39 -0
- package/scaffold/production/src/executable/motionTake/readMotionTakePackageVersion.ts +45 -0
- package/scaffold/production/src/executable/motionTake/readMotionTakeSource.ts +169 -0
- package/scaffold/production/src/executable/motionTake/replayMotionTake.ts +86 -0
- package/scaffold/production/src/executable/motionTake/resolveMotionTakePath.ts +41 -0
- package/scaffold/production/src/executable/motionTake/verifyMotionTakeEditPrefix.ts +121 -0
- package/scaffold/production/src/executable/motionTake/writeMotionTakeArtifact.ts +44 -0
- package/scaffold/production/src/executable/motionTake.ts +65 -0
- package/scaffold/workspace/package.json +1 -1
- package/src/createAutoMovieScaffold.ts +17 -4
- package/scaffold/instructions/.agents/skills/contracts/development/statements/behaviors.md +0 -40
- package/scaffold/instructions/.agents/skills/contracts/development/statements/composition.md +0 -32
- package/scaffold/instructions/.agents/skills/contracts/development/statements/entities.md +0 -34
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/brief.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/common.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/discovery/settings.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/common.md +0 -17
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/common.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/realized.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/obligations/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/realized.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/naturalness/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/brief.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/common.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/index.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/narratives.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/review.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/screenplay.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/scripts.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/settings.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/obligations/treatments.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/brief.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/index.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/narratives.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/realized.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/research.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/review.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/screenplay.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/settings.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/principles/treatments.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/brief.md +0 -16
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/common.md +0 -40
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/narratives.md +0 -6
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/screenplay.md +0 -12
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/settings.md +0 -21
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/discovery/treatments.md +0 -7
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/common.md +0 -84
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/common.md +0 -17
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/realized.md +0 -13
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/obligations/scripts.md +0 -12
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/realized.md +0 -18
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/naturalness/scripts.md +0 -16
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/brief.md +0 -17
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/common.md +0 -29
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/index.md +0 -15
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/narratives.md +0 -41
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/review.md +0 -31
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/screenplay.md +0 -21
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/scripts.md +0 -23
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/settings.md +0 -43
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/obligations/treatments.md +0 -27
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/brief.md +0 -11
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/common.md +0 -10
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/index.md +0 -16
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/narratives.md +0 -43
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/realized.md +0 -16
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/research.md +0 -32
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/review.md +0 -23
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/screenplay.md +0 -75
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/scripts.md +0 -43
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/settings.md +0 -16
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/principles/treatments.md +0 -20
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/screenplay.md +0 -11
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/scripts.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/statements/upstream/treatments.md +0 -7
- package/scaffold/instructions/.agents/skills/contracts/story/shared/upstream/screenplay.md +0 -9
- package/scaffold/instructions/.agents/skills/contracts/story/shared/upstream/scripts.md +0 -9
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieMotionTake,
|
|
3
|
+
IAutoMovieMotionTakeProvenance,
|
|
4
|
+
} from "@automovie/interface";
|
|
5
|
+
import path from "node:path";
|
|
6
|
+
import { pathToFileURL } from "node:url";
|
|
7
|
+
|
|
8
|
+
import type { IMotionTakeSource } from "./IMotionTakeSource";
|
|
9
|
+
import { assertMotionTakeBindings } from "./assertMotionTakeBindings";
|
|
10
|
+
import { collectMotionTakeFiles } from "./collectMotionTakeFiles";
|
|
11
|
+
import { hashMotionTakeFile } from "./hashMotionTakeFile";
|
|
12
|
+
import { readMotionTakeInstalledLock } from "./readMotionTakeInstalledLock";
|
|
13
|
+
import { readMotionTakePackageVersion } from "./readMotionTakePackageVersion";
|
|
14
|
+
import { resolveMotionTakePath } from "./resolveMotionTakePath";
|
|
15
|
+
|
|
16
|
+
/** File digests associated with source modules already loaded by this process. */
|
|
17
|
+
const LOADED_FILES: Map<string, string> = new Map();
|
|
18
|
+
|
|
19
|
+
/** Installed dependency identities already used under each production root. */
|
|
20
|
+
const LOADED_INSTALL: Map<string, string> = new Map();
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Measure and rebuild the source explicitly selected by the production author.
|
|
24
|
+
* A saved manifest can verify input bytes before the source is evaluated.
|
|
25
|
+
*
|
|
26
|
+
* @evidence contracts/development/common.md#meaningful-documentation States who chooses the module, the pre-import guard and the provenance this host measures.
|
|
27
|
+
* @evidence contracts/development/implementation.md#principled-implementation Independently measures saved input files, verifies the selected module and binds the fixed trusted export and its registered function values.
|
|
28
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Separates pre-import checks, source reconstruction and provenance measurement.
|
|
29
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No persisted field selects executable code, and the trusted source must register its callable owner inputs.
|
|
30
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Scans the import graph once and reuses the digests of saved files measured before the import.
|
|
31
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Static source digests also satisfy matching explicit data dependencies.
|
|
32
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Returns source runtime inputs and scalar provenance to the operation without owning persistent handles.
|
|
33
|
+
*/
|
|
34
|
+
export async function readMotionTakeSource(
|
|
35
|
+
root: string,
|
|
36
|
+
module: string,
|
|
37
|
+
saved?: IAutoMovieMotionTake,
|
|
38
|
+
): Promise<{
|
|
39
|
+
recipe: IMotionTakeSource;
|
|
40
|
+
provenance: IAutoMovieMotionTakeProvenance;
|
|
41
|
+
}> {
|
|
42
|
+
const exportName: string = "createMotionTakeSource";
|
|
43
|
+
if (
|
|
44
|
+
saved &&
|
|
45
|
+
(saved.source.module !== module || saved.source.export !== exportName)
|
|
46
|
+
)
|
|
47
|
+
throw new Error(
|
|
48
|
+
"take-provenance: independently selected source differs from the saved source",
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
const graph: Awaited<ReturnType<typeof collectMotionTakeFiles>> =
|
|
52
|
+
await collectMotionTakeFiles(root, module);
|
|
53
|
+
const measured: Map<string, string> = new Map(
|
|
54
|
+
graph.files.map(({ path, sha256 }): [string, string] => [path, sha256]),
|
|
55
|
+
);
|
|
56
|
+
const expected: Map<string, string> = new Map(
|
|
57
|
+
saved?.provenance.files.map(({ path, sha256 }): [string, string] => [
|
|
58
|
+
path,
|
|
59
|
+
sha256,
|
|
60
|
+
]),
|
|
61
|
+
);
|
|
62
|
+
for (const [reference, digest] of measured) {
|
|
63
|
+
if (saved && digest !== expected.get(reference))
|
|
64
|
+
throw new Error(
|
|
65
|
+
`take-provenance: files[${reference}].sha256 changed since save`,
|
|
66
|
+
);
|
|
67
|
+
const loaded: string | undefined = LOADED_FILES.get(
|
|
68
|
+
path.join(root, reference),
|
|
69
|
+
);
|
|
70
|
+
if (loaded !== undefined && loaded !== digest)
|
|
71
|
+
throw new Error(
|
|
72
|
+
`take-provenance: source changed in this process at ${reference}; reopen in a fresh process`,
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const installed: Map<string, string> = new Map();
|
|
77
|
+
const resolved: Set<string> = new Set();
|
|
78
|
+
for (const { name, issuer } of [
|
|
79
|
+
{ name: "@automovie/engine", issuer: "package.json" },
|
|
80
|
+
{ name: "@automovie/motions", issuer: "package.json" },
|
|
81
|
+
...graph.packages,
|
|
82
|
+
]) {
|
|
83
|
+
const key: string = `${path.dirname(issuer)}\u0000${name}`;
|
|
84
|
+
if (resolved.has(key)) continue;
|
|
85
|
+
resolved.add(key);
|
|
86
|
+
const version: string = await readMotionTakePackageVersion(
|
|
87
|
+
root,
|
|
88
|
+
name,
|
|
89
|
+
issuer,
|
|
90
|
+
);
|
|
91
|
+
const id: string = `npm:${name}`;
|
|
92
|
+
const previous: string | undefined = installed.get(id);
|
|
93
|
+
if (previous !== undefined && previous !== version)
|
|
94
|
+
throw new Error(
|
|
95
|
+
`take-provenance: ${name} resolves to multiple versions in the source graph`,
|
|
96
|
+
);
|
|
97
|
+
installed.set(id, version);
|
|
98
|
+
}
|
|
99
|
+
const lock: string | undefined = await readMotionTakeInstalledLock(root);
|
|
100
|
+
if (lock !== undefined) installed.set("install:pnpm-lock", lock);
|
|
101
|
+
const currentInstall: Map<string, string> = new Map(installed);
|
|
102
|
+
if (lock === undefined) currentInstall.set("install:pnpm-lock", "");
|
|
103
|
+
for (const [id, version] of currentInstall) {
|
|
104
|
+
const loaded: string | undefined = LOADED_INSTALL.get(`${root}\u0000${id}`);
|
|
105
|
+
if (loaded !== undefined && loaded !== version)
|
|
106
|
+
throw new Error(
|
|
107
|
+
`take-provenance: installed dependency changed in this process at ${id}; reopen in a fresh process`,
|
|
108
|
+
);
|
|
109
|
+
}
|
|
110
|
+
const expectedInstalled: Map<string, string> = new Map(
|
|
111
|
+
saved?.provenance.providers
|
|
112
|
+
.filter(({ id }) => /^(?:npm|install):/u.test(id))
|
|
113
|
+
.map(({ id, version }): [string, string] => [id, version]),
|
|
114
|
+
);
|
|
115
|
+
if (
|
|
116
|
+
saved &&
|
|
117
|
+
(expectedInstalled.size !== installed.size ||
|
|
118
|
+
[...installed].some(
|
|
119
|
+
([id, version]) => expectedInstalled.get(id) !== version,
|
|
120
|
+
))
|
|
121
|
+
)
|
|
122
|
+
throw new Error(
|
|
123
|
+
"take-provenance: installed dependency versions or lockfile changed since save",
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const sourcePath: string = await resolveMotionTakePath(root, module, "read");
|
|
127
|
+
for (const [reference, digest] of measured)
|
|
128
|
+
LOADED_FILES.set(path.join(root, reference), digest);
|
|
129
|
+
for (const [id, version] of currentInstall)
|
|
130
|
+
LOADED_INSTALL.set(`${root}\u0000${id}`, version);
|
|
131
|
+
const producer: {
|
|
132
|
+
createMotionTakeSource?: () =>
|
|
133
|
+
| IMotionTakeSource
|
|
134
|
+
| Promise<IMotionTakeSource>;
|
|
135
|
+
} = await import(pathToFileURL(sourcePath).href);
|
|
136
|
+
if (typeof producer.createMotionTakeSource !== "function")
|
|
137
|
+
throw new Error(`Motion take source ${module} must export ${exportName}()`);
|
|
138
|
+
const recipe: IMotionTakeSource = await producer.createMotionTakeSource();
|
|
139
|
+
assertMotionTakeBindings(recipe);
|
|
140
|
+
|
|
141
|
+
const files: IAutoMovieMotionTakeProvenance["files"][number][] = [];
|
|
142
|
+
for (const path of [
|
|
143
|
+
...new Set([...graph.files.map((file) => file.path), ...recipe.assets]),
|
|
144
|
+
].sort((left, right) => (left < right ? -1 : left > right ? 1 : 0))) {
|
|
145
|
+
const sha256: string =
|
|
146
|
+
measured.get(path) ??
|
|
147
|
+
(await hashMotionTakeFile(
|
|
148
|
+
await resolveMotionTakePath(root, path, "read"),
|
|
149
|
+
));
|
|
150
|
+
files.push({ path, sha256 });
|
|
151
|
+
}
|
|
152
|
+
return {
|
|
153
|
+
recipe,
|
|
154
|
+
provenance: {
|
|
155
|
+
files,
|
|
156
|
+
providers: [
|
|
157
|
+
...[...installed].map(([id, version]) => ({ id, version })),
|
|
158
|
+
...recipe.bindings.map(({ id, version }) => ({ id, version })),
|
|
159
|
+
],
|
|
160
|
+
seeds: [
|
|
161
|
+
...recipe.seeds,
|
|
162
|
+
...Object.entries(recipe.human).map(([shot, input]) => ({
|
|
163
|
+
id: `human:${shot}`,
|
|
164
|
+
value: input.seed,
|
|
165
|
+
})),
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
IAutoMovieMotionHumanPerformance,
|
|
3
|
+
IAutoMovieMotionTakeAnchor,
|
|
4
|
+
IAutoMovieShot,
|
|
5
|
+
} from "@automovie/interface";
|
|
6
|
+
import {
|
|
7
|
+
HumanPerformance,
|
|
8
|
+
compileHumanPerformanceContinuation,
|
|
9
|
+
} from "@automovie/motions";
|
|
10
|
+
|
|
11
|
+
import type { IMotionTakeSource } from "./IMotionTakeSource";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Prepare the Human owner once for reads on either side of an admitted anchor.
|
|
15
|
+
* A branch retains its original runtime before the owner's continuation seam.
|
|
16
|
+
*
|
|
17
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the admitted anchor and the transition between prepared Human runtimes.
|
|
18
|
+
* @evidence contracts/development/implementation.md#principled-implementation Uses the same Human compiler for reopen and the owner's continuation gate for a changed suffix.
|
|
19
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Selects the named owner input once and returns the compiled runtime along with its source-time selector.
|
|
20
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Rejects inconsistent shot ownership or duration instead of adjusting either clock.
|
|
21
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Only the selected shot is compiled; each later selector call tests one seam.
|
|
22
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work All renderer or authoring reads share the prepared original and branch runtimes.
|
|
23
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources The caller owns the returned Human performance and its preparation lifetime.
|
|
24
|
+
*/
|
|
25
|
+
export function replayMotionTake(
|
|
26
|
+
source: IMotionTakeSource,
|
|
27
|
+
anchor: IAutoMovieMotionTakeAnchor,
|
|
28
|
+
parent?: IMotionTakeSource,
|
|
29
|
+
): {
|
|
30
|
+
source: HumanPerformance;
|
|
31
|
+
branch?: HumanPerformance;
|
|
32
|
+
branchStart?: number;
|
|
33
|
+
performanceAt: (seconds: number, entry?: number) => HumanPerformance;
|
|
34
|
+
} {
|
|
35
|
+
const owner: IMotionTakeSource = parent ?? source;
|
|
36
|
+
const input: IAutoMovieMotionHumanPerformance.IInput | undefined =
|
|
37
|
+
owner.human[anchor.shot];
|
|
38
|
+
if (!input || !Object.hasOwn(owner.human, anchor.shot))
|
|
39
|
+
throw new Error(
|
|
40
|
+
`take-provider: no Human source registered for shot ${anchor.shot}`,
|
|
41
|
+
);
|
|
42
|
+
const authoredDuration: number | undefined = owner.shots.find(
|
|
43
|
+
(shot: IAutoMovieShot): boolean => shot.id === anchor.shot,
|
|
44
|
+
)?.duration;
|
|
45
|
+
if (source.branch === undefined) {
|
|
46
|
+
const performance: HumanPerformance = new HumanPerformance(input);
|
|
47
|
+
if (performance.duration !== authoredDuration)
|
|
48
|
+
throw new Error(
|
|
49
|
+
`take-anchor: Human and editorial durations differ for ${anchor.shot}`,
|
|
50
|
+
);
|
|
51
|
+
return {
|
|
52
|
+
source: performance,
|
|
53
|
+
performanceAt: (): HumanPerformance => performance,
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (!parent)
|
|
57
|
+
throw new Error("take-provenance: branch requires its original source");
|
|
58
|
+
|
|
59
|
+
const continuation: ReturnType<typeof compileHumanPerformanceContinuation> =
|
|
60
|
+
compileHumanPerformanceContinuation(
|
|
61
|
+
input,
|
|
62
|
+
anchor.sourceSeconds,
|
|
63
|
+
source.branch.retainedParts,
|
|
64
|
+
source.branch.suffix,
|
|
65
|
+
);
|
|
66
|
+
const branchDuration: number | undefined = source.shots.find(
|
|
67
|
+
(shot: IAutoMovieShot): boolean => shot.id === anchor.shot,
|
|
68
|
+
)?.duration;
|
|
69
|
+
if (
|
|
70
|
+
continuation.source.duration !== authoredDuration ||
|
|
71
|
+
continuation.branch.duration !== branchDuration
|
|
72
|
+
)
|
|
73
|
+
throw new Error(
|
|
74
|
+
`take-anchor: Human and editorial durations differ for ${anchor.shot}`,
|
|
75
|
+
);
|
|
76
|
+
return {
|
|
77
|
+
...continuation,
|
|
78
|
+
performanceAt: (
|
|
79
|
+
seconds: number,
|
|
80
|
+
entry: number = anchor.entry,
|
|
81
|
+
): HumanPerformance =>
|
|
82
|
+
entry < anchor.entry || seconds < continuation.branchStart
|
|
83
|
+
? continuation.source
|
|
84
|
+
: continuation.branch,
|
|
85
|
+
};
|
|
86
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { isPortableMotionTakePath } from "@automovie/engine";
|
|
2
|
+
import { realpath } from "node:fs/promises";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Resolve a production-relative source, data or artifact path under a canonical production root.
|
|
7
|
+
* Creation resolves the existing parent without following an already-present destination.
|
|
8
|
+
*
|
|
9
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the path scope and the distinct creation resolution.
|
|
10
|
+
* @evidence contracts/development/implementation.md#principled-implementation Validates the portable reference, resolves filesystem aliases and checks confinement on the resolved path.
|
|
11
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Validation, filesystem resolution and containment are successive steps.
|
|
12
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Does not accept an absolute path, traverse a parent segment or waive the canonical root check on Windows.
|
|
13
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Checks each segment once and performs one filesystem resolution.
|
|
14
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Current filesystem resolution cannot reuse a prior result after aliases change.
|
|
15
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Retains only a returned path string and opens no file handle.
|
|
16
|
+
*/
|
|
17
|
+
export async function resolveMotionTakePath(
|
|
18
|
+
root: string,
|
|
19
|
+
reference: string,
|
|
20
|
+
mode: "read" | "create",
|
|
21
|
+
): Promise<string> {
|
|
22
|
+
if (!isPortableMotionTakePath(reference))
|
|
23
|
+
throw new Error(`Expected a production-relative path: ${reference}`);
|
|
24
|
+
|
|
25
|
+
const absolute: string = path.join(root, ...reference.split("/"));
|
|
26
|
+
const check: string = mode === "read" ? absolute : path.dirname(absolute);
|
|
27
|
+
const canonical: string = await realpath(check).catch((cause: unknown) => {
|
|
28
|
+
throw new Error(`Motion take path is unavailable: ${reference}`, { cause });
|
|
29
|
+
});
|
|
30
|
+
const relative: string = path.relative(root, canonical);
|
|
31
|
+
if (
|
|
32
|
+
relative === ".." ||
|
|
33
|
+
relative.startsWith(`..${path.sep}`) ||
|
|
34
|
+
path.isAbsolute(relative)
|
|
35
|
+
)
|
|
36
|
+
throw new Error(`Motion take path escapes the production: ${reference}`);
|
|
37
|
+
|
|
38
|
+
return mode === "read"
|
|
39
|
+
? canonical
|
|
40
|
+
: path.join(canonical, path.basename(absolute));
|
|
41
|
+
}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { sequenceEventTimeline } from "@automovie/engine";
|
|
2
|
+
import type {
|
|
3
|
+
IAutoMoviePlaybackEntry,
|
|
4
|
+
IAutoMoviePlaybackEvent,
|
|
5
|
+
IAutoMoviePreparePlaybackTimeline,
|
|
6
|
+
IAutoMovieSequence,
|
|
7
|
+
IAutoMovieShot,
|
|
8
|
+
} from "@automovie/interface";
|
|
9
|
+
import { isDeepStrictEqual } from "node:util";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Refuse a branch that changes the original editorial view through the Human join.
|
|
13
|
+
*
|
|
14
|
+
* @evidence contracts/development/common.md#meaningful-documentation States the boundary whose placement and cues must remain fixed.
|
|
15
|
+
* @evidence contracts/development/implementation.md#principled-implementation Compares the admitted affine placement, visible bounds, prior shots and projected event ownership on the original output clock.
|
|
16
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure First verifies frame placement and then compares the engine's projected event ledgers.
|
|
17
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts A matching snapshot alone cannot admit an edit that changes a prior rate, trim, transition or event.
|
|
18
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Walks the visible prefix once and obtains ordered cues from the existing projector.
|
|
19
|
+
* @evidence contracts/development/implementation.md#reuse-equivalent-work Reads the prepared layouts already used to resolve the saved anchors.
|
|
20
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Borrows both editable sources and keeps neither after the check.
|
|
21
|
+
*/
|
|
22
|
+
export function verifyMotionTakeEditPrefix(
|
|
23
|
+
original: {
|
|
24
|
+
sequence: IAutoMovieSequence;
|
|
25
|
+
prepared: IAutoMoviePreparePlaybackTimeline.IResult;
|
|
26
|
+
shots: readonly IAutoMovieShot[];
|
|
27
|
+
},
|
|
28
|
+
branch: {
|
|
29
|
+
sequence: IAutoMovieSequence;
|
|
30
|
+
prepared: IAutoMoviePreparePlaybackTimeline.IResult;
|
|
31
|
+
shots: readonly IAutoMovieShot[];
|
|
32
|
+
},
|
|
33
|
+
selected: number,
|
|
34
|
+
sourceJoin: number,
|
|
35
|
+
): void {
|
|
36
|
+
const selectedEntry: IAutoMoviePlaybackEntry =
|
|
37
|
+
original.prepared.timeline.entries[selected]!;
|
|
38
|
+
const selectedShot: IAutoMovieShot = original.prepared.shotById.get(
|
|
39
|
+
selectedEntry.shot,
|
|
40
|
+
)!.shot;
|
|
41
|
+
const alternateShot: IAutoMovieShot = branch.prepared.shotById.get(
|
|
42
|
+
selectedEntry.shot,
|
|
43
|
+
)!.shot;
|
|
44
|
+
if (
|
|
45
|
+
selectedShot.scene !== alternateShot.scene ||
|
|
46
|
+
selectedShot.camera !== alternateShot.camera ||
|
|
47
|
+
!isDeepStrictEqual(selectedShot.cameraMotion, alternateShot.cameraMotion) ||
|
|
48
|
+
!isDeepStrictEqual(
|
|
49
|
+
selectedShot.objectMotions,
|
|
50
|
+
alternateShot.objectMotions,
|
|
51
|
+
) ||
|
|
52
|
+
!isDeepStrictEqual(selectedShot.lightMotions, alternateShot.lightMotions)
|
|
53
|
+
)
|
|
54
|
+
throw new Error(
|
|
55
|
+
`take-anchor: branch changes shot staging or camera ${selectedEntry.shot}`,
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
let seam: number = original.prepared.timeline.runtime;
|
|
59
|
+
for (const entry of original.prepared.timeline.entries.slice(selected)) {
|
|
60
|
+
if (entry.shot !== selectedEntry.shot) continue;
|
|
61
|
+
const placement: IAutoMovieSequence["shots"][number] =
|
|
62
|
+
original.sequence.shots[entry.entry]!;
|
|
63
|
+
const end: number =
|
|
64
|
+
placement.exactSourceEnd ??
|
|
65
|
+
(placement.trim
|
|
66
|
+
? placement.trim.start + placement.trim.duration
|
|
67
|
+
: selectedShot.duration);
|
|
68
|
+
if (sourceJoin > end) continue;
|
|
69
|
+
seam =
|
|
70
|
+
entry.start +
|
|
71
|
+
Math.max(0, (sourceJoin - entry.offset) / (entry.playbackRate ?? 1));
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
if (original.sequence.fps !== branch.sequence.fps)
|
|
75
|
+
throw new Error("take-anchor: branch changes the edit frame rate");
|
|
76
|
+
|
|
77
|
+
const before: IAutoMoviePlaybackEntry[] =
|
|
78
|
+
original.prepared.timeline.entries.filter(
|
|
79
|
+
(entry): boolean => entry.start <= seam,
|
|
80
|
+
);
|
|
81
|
+
const after: IAutoMoviePlaybackEntry[] =
|
|
82
|
+
branch.prepared.timeline.entries.filter(
|
|
83
|
+
(entry): boolean => entry.start <= seam,
|
|
84
|
+
);
|
|
85
|
+
if (before.length !== after.length)
|
|
86
|
+
throw new Error("take-anchor: branch changes the edit prefix entries");
|
|
87
|
+
for (const [index, entry] of before.entries()) {
|
|
88
|
+
const candidate: IAutoMoviePlaybackEntry = after[index]!;
|
|
89
|
+
if (
|
|
90
|
+
entry.shot !== candidate.shot ||
|
|
91
|
+
entry.start !== candidate.start ||
|
|
92
|
+
entry.offset !== candidate.offset ||
|
|
93
|
+
entry.playbackRate !== candidate.playbackRate ||
|
|
94
|
+
Math.min(entry.start + entry.played, seam) !==
|
|
95
|
+
Math.min(candidate.start + candidate.played, seam) ||
|
|
96
|
+
!isDeepStrictEqual(
|
|
97
|
+
original.sequence.shots[index]?.transition,
|
|
98
|
+
branch.sequence.shots[index]?.transition,
|
|
99
|
+
)
|
|
100
|
+
)
|
|
101
|
+
throw new Error(`take-anchor: branch changes edit prefix entry ${index}`);
|
|
102
|
+
if (
|
|
103
|
+
entry.shot !== selectedEntry.shot &&
|
|
104
|
+
!isDeepStrictEqual(
|
|
105
|
+
original.prepared.shotById.get(entry.shot)?.shot,
|
|
106
|
+
branch.prepared.shotById.get(entry.shot)?.shot,
|
|
107
|
+
)
|
|
108
|
+
)
|
|
109
|
+
throw new Error(`take-anchor: branch changes prior shot ${entry.shot}`);
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/** Project the event plays that the audience has reached at the join. */
|
|
113
|
+
const events = (cut: typeof original): IAutoMoviePlaybackEvent[] =>
|
|
114
|
+
sequenceEventTimeline(cut.sequence, [...cut.shots]).filter(
|
|
115
|
+
(event: IAutoMoviePlaybackEvent): boolean => event.globalTime <= seam,
|
|
116
|
+
);
|
|
117
|
+
if (!isDeepStrictEqual(events(original), events(branch)))
|
|
118
|
+
throw new Error(
|
|
119
|
+
"take-anchor: branch changes event ownership through the edit prefix",
|
|
120
|
+
);
|
|
121
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { link, mkdtemp, open, rmdir, unlink } from "node:fs/promises";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Publish one admitted artifact as complete JSON at an unused destination.
|
|
6
|
+
*
|
|
7
|
+
* @evidence contracts/development/common.md#meaningful-documentation States what is committed and that the destination must be unused.
|
|
8
|
+
* @evidence contracts/development/implementation.md#principled-implementation Stages the serialized artifact on the destination volume and links it in one exclusive operation after sync and close.
|
|
9
|
+
* @evidence contracts/development/implementation.md#clear-and-simple-structure Serialization, temporary write and publication have distinct steps with local cleanup.
|
|
10
|
+
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts Never truncates an existing take and does not fall back to a partial direct write.
|
|
11
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Serializes and writes the artifact once without copying it again during publication.
|
|
12
|
+
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call must commit the given artifact to a distinct destination.
|
|
13
|
+
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Closes the write handle and cleans up the file and directory owned by this invocation.
|
|
14
|
+
*/
|
|
15
|
+
export async function writeMotionTakeArtifact(
|
|
16
|
+
destination: string,
|
|
17
|
+
value: object,
|
|
18
|
+
): Promise<void> {
|
|
19
|
+
const text: string = `${JSON.stringify(value, null, 2)}\n`;
|
|
20
|
+
const staging: string = await mkdtemp(
|
|
21
|
+
path.join(path.dirname(destination), ".motion-take-"),
|
|
22
|
+
);
|
|
23
|
+
const temporary: string = path.join(staging, "take.json");
|
|
24
|
+
try {
|
|
25
|
+
const handle: Awaited<ReturnType<typeof open>> = await open(
|
|
26
|
+
temporary,
|
|
27
|
+
"wx",
|
|
28
|
+
);
|
|
29
|
+
try {
|
|
30
|
+
await handle.writeFile(text, "utf8");
|
|
31
|
+
await handle.sync();
|
|
32
|
+
} finally {
|
|
33
|
+
await handle.close();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
// A link publishes the whole file and refuses any existing directory entry.
|
|
37
|
+
await link(temporary, destination);
|
|
38
|
+
} finally {
|
|
39
|
+
await unlink(temporary).catch((error: NodeJS.ErrnoException): void => {
|
|
40
|
+
if (error.code !== "ENOENT") throw error;
|
|
41
|
+
});
|
|
42
|
+
await rmdir(staging);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { openMotionTake } from "./motionTake/openMotionTake";
|
|
2
|
+
|
|
3
|
+
/** Parse the installed motion take command and print an exact reopened sample. */
|
|
4
|
+
async function main(): Promise<void> {
|
|
5
|
+
const [mode, source, artifact, seconds, entry, side, ...rest]: string[] =
|
|
6
|
+
process.argv.slice(2);
|
|
7
|
+
if (
|
|
8
|
+
!source ||
|
|
9
|
+
!artifact ||
|
|
10
|
+
rest.length ||
|
|
11
|
+
(mode === "save"
|
|
12
|
+
? !seconds ||
|
|
13
|
+
(entry !== undefined && !/^(0|[1-9]\d*)$/u.test(entry)) ||
|
|
14
|
+
(side !== undefined && side !== "before" && side !== "after")
|
|
15
|
+
: (mode !== "open" && mode !== "branch") || seconds !== undefined)
|
|
16
|
+
)
|
|
17
|
+
throw new Error(
|
|
18
|
+
[
|
|
19
|
+
"Usage:",
|
|
20
|
+
"motion:take save <source-module> <new-artifact> <output-seconds> [entry] [before|after]",
|
|
21
|
+
"motion:take open <source-module> <artifact>",
|
|
22
|
+
"motion:take branch <branch-source-module> <new-artifact>",
|
|
23
|
+
].join("\n"),
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const result: Awaited<ReturnType<typeof openMotionTake>> =
|
|
27
|
+
await openMotionTake({
|
|
28
|
+
root: process.cwd(),
|
|
29
|
+
source,
|
|
30
|
+
artifact,
|
|
31
|
+
...(mode === "save"
|
|
32
|
+
? {
|
|
33
|
+
create: {
|
|
34
|
+
mode,
|
|
35
|
+
outputSeconds: Number(seconds),
|
|
36
|
+
...(entry === undefined ? {} : { entry: Number(entry) }),
|
|
37
|
+
...(side === "before" || side === "after" ? { side } : {}),
|
|
38
|
+
},
|
|
39
|
+
}
|
|
40
|
+
: mode === "branch"
|
|
41
|
+
? { create: { mode } }
|
|
42
|
+
: {}),
|
|
43
|
+
});
|
|
44
|
+
const { anchor } = result.take;
|
|
45
|
+
const performance: ReturnType<typeof result.replay.performanceAt> =
|
|
46
|
+
result.replay.performanceAt(anchor.sourceSeconds);
|
|
47
|
+
if (mode === "open") {
|
|
48
|
+
console.log(
|
|
49
|
+
JSON.stringify({
|
|
50
|
+
take: result.take,
|
|
51
|
+
poses: Object.fromEntries(
|
|
52
|
+
performance.performers.map(({ subject }) => [
|
|
53
|
+
subject,
|
|
54
|
+
performance.pose(subject, anchor.sourceSeconds),
|
|
55
|
+
]),
|
|
56
|
+
),
|
|
57
|
+
}),
|
|
58
|
+
);
|
|
59
|
+
} else console.log(JSON.stringify(result.take));
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
void main().catch((error: unknown): void => {
|
|
63
|
+
console.error(error);
|
|
64
|
+
process.exitCode = 1;
|
|
65
|
+
});
|
|
@@ -21,6 +21,8 @@ const PACKAGE: string = path.resolve(__dirname, "..");
|
|
|
21
21
|
*
|
|
22
22
|
* A `$<name>` placeholder under a layer's `.agents/skills` is replaced by the repository skill item the build copied to `generated/skills`. A layer's root `_gitignore` becomes `.gitignore`, because npm pack renames a packed `.gitignore`. `{{name}}` becomes the admitted name and `{{skills}}` the path of the skills the production reads. Line endings become LF. Every `package.json` dependency is a `catalog:` reference: the `automovie` catalog ranges this package's own version, and the others carry the ranges the build read from the repository's `pnpm-workspace.yaml`.
|
|
23
23
|
*
|
|
24
|
+
* Instruction Markdown omits reserved `<!-- @source ... -->` lines after shared skills are expanded. A source paragraph leaves one blank line between its heading and the body.
|
|
25
|
+
*
|
|
24
26
|
* Nothing is written; the caller writes the map.
|
|
25
27
|
*
|
|
26
28
|
* @param props The installation kind and its name.
|
|
@@ -30,8 +32,8 @@ const PACKAGE: string = path.resolve(__dirname, "..");
|
|
|
30
32
|
* @evidence contracts/development/implementation.md#principled-implementation Layers are read from the installed package, so the map always matches the shipped scaffold. Catalog ranges come from the build's record of the repository catalogs and the automovie range from this package's own manifest, so a workspace and its productions resolve the release the package belongs to. A duplicate path throws instead of keeping either source.
|
|
31
33
|
* @evidence contracts/development/implementation.md#clear-and-simple-structure One function owns the whole map for every kind; the kind decides only which layers are read and which generated files are added, and writing is left to the caller.
|
|
32
34
|
* @evidence contracts/development/implementation.md#prohibited-implementation-shortcuts No file is named except the generated `pnpm-workspace.yaml` and `evidence.config.ts`, whose content differs by kind, and the root `_gitignore`, whose rename npm pack forces.
|
|
33
|
-
* @evidence contracts/development/common.md#meaningful-documentation The comment lists every kind's layers and generated files,
|
|
34
|
-
* @evidence contracts/development/implementation.md#efficient-algorithms Each
|
|
35
|
+
* @evidence contracts/development/common.md#meaningful-documentation The comment lists every kind's layers and generated files, shared skills, source notes, renames, substitutions, line endings, version sources and failures.
|
|
36
|
+
* @evidence contracts/development/implementation.md#efficient-algorithms Each file is listed and read once. Source lines, tokens and line endings take a fixed number of linear scans, plus each directory's sort.
|
|
35
37
|
* @evidenceExclude contracts/development/implementation.md#reuse-equivalent-work Each call reads the scaffold as installed now, once per creation.
|
|
36
38
|
* @evidence contracts/development/implementation.md#bound-retention-and-release-resources Files are read with `readFileSync`, which releases its handle before returning; only the returned map, owned by the caller, outlives the call.
|
|
37
39
|
*/
|
|
@@ -76,6 +78,19 @@ const readLayer = (
|
|
|
76
78
|
add: (relative: string, content: string) => void,
|
|
77
79
|
): void => {
|
|
78
80
|
const root: string = path.join(PACKAGE, "scaffold", layer);
|
|
81
|
+
|
|
82
|
+
/** Strip the source note while keeping one of its surrounding blank lines. */
|
|
83
|
+
const read = (file: string): string => {
|
|
84
|
+
const text: string = fs.readFileSync(file, "utf8");
|
|
85
|
+
return layer === "instructions" && file.endsWith(".md")
|
|
86
|
+
? text.replace(
|
|
87
|
+
/(?<=^|\n)(\r?\n)?<!-- @source (?:(?!-->)[^\r\n])+ -->[ \t]*(?:\r?\n|$)(\r?\n)?/gu,
|
|
88
|
+
(_: string, before?: string, after?: string): string =>
|
|
89
|
+
before ?? after ?? "",
|
|
90
|
+
)
|
|
91
|
+
: text;
|
|
92
|
+
};
|
|
93
|
+
|
|
79
94
|
for (const relative of listAutoMovieScaffoldFiles(root)) {
|
|
80
95
|
const shared: string | null = scaffoldSharedSkillPath(relative);
|
|
81
96
|
if (shared === null) {
|
|
@@ -109,7 +124,5 @@ const renderEvidenceConfig = (workspace: boolean): string =>
|
|
|
109
124
|
``,
|
|
110
125
|
].join("\n");
|
|
111
126
|
|
|
112
|
-
const read = (file: string): string => fs.readFileSync(file, "utf8");
|
|
113
|
-
|
|
114
127
|
const toPosix = (relative: string): string =>
|
|
115
128
|
relative.split(path.sep).join("/");
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
# Behavior statements
|
|
2
|
-
|
|
3
|
-
## Studied laws
|
|
4
|
-
|
|
5
|
-
1. A relation names its installed actions and operators, and the screenplay facts it realizes. It studies only what [research](../../../story/planning/research.md#what-needs-a-study) requires; installed defaults and ordinary screenplay choices need no new derivation.
|
|
6
|
-
2. A new motion law performs an action the installed vocabulary cannot express, alone or joined with others. A faulty installed action is never replaced by a new law.
|
|
7
|
-
3. Every constant the behavior adds states its source or derivation, and none was tuned until a scene looked right. Calling a package default adds no new constant to derive.
|
|
8
|
-
4. A motion law's key poses, reach, contact surfaces and variation ranges come from its prior study. A pure rule or table cites the rules it adds and tests their classifications and boundaries against independent expectations.
|
|
9
|
-
5. A motion law scales duration and speed with the body under [time scale](../../../motion/laws/declaration.md#time-scale), and its tests compare results with the study's values.
|
|
10
|
-
6. A relation's tests check its own choice and coordination through the vocabulary's measures under [motion checks](../../../development/testing.md#motion-checks), without repeating the installed actions' internal physical tests.
|
|
11
|
-
7. A person's row or law is registered with the vocabulary under [vocabulary extension](../../../motion/laws/extension.md), so the vocabulary performs it.
|
|
12
|
-
8. A deliberately stylized departure states its factor and reason.
|
|
13
|
-
|
|
14
|
-
## Relational goals
|
|
15
|
-
|
|
16
|
-
1. A relation supplies the actual performer, counterpart target, outcome and synchronization to the installed action. A motion law's goals name effector, target, approach, window and whether the target is frozen or tracked, under [effector goals](../../../motion/laws/authoring.md#writing-a-goal).
|
|
17
|
-
2. No absolute coordinate, offset or tuned joint angle stands in for a goal.
|
|
18
|
-
3. A motion law declares and follows its [out-of-reach rule](../../../motion/laws/authoring.md#out-of-reach). A relation retains the installed action's rule, and neither silently clamps a target.
|
|
19
|
-
4. A motion law declares each contact's window and [support frame](../../../motion/laws/contacts.md#windows-and-support-frames); a relation uses its action's declared events and contacts.
|
|
20
|
-
5. A relation passes the screenplay's outcome to the vocabulary. A new outcome law realizes that outcome class under the studied rules.
|
|
21
|
-
6. What the installed package reports of the action establishes its outcome; a geometric miss stays a failure, and a scheduled impact event alone establishes no contact or solved impulse.
|
|
22
|
-
7. Consequences derive only from computed outcomes.
|
|
23
|
-
8. A motion law's unit tests assert each bound of [motion verification](../../../motion/laws/verification.md) that applies, each taken from the requirement or the study:
|
|
24
|
-
- end-effector-to-target distance;
|
|
25
|
-
- penetration;
|
|
26
|
-
- slip;
|
|
27
|
-
- range of motion;
|
|
28
|
-
- balance;
|
|
29
|
-
- continuity at cuts.
|
|
30
|
-
9. Test motion laws across statures, proportions and the production's partners and props. Test each relation's own cases. Test pure rules and tables over their input domains.
|
|
31
|
-
|
|
32
|
-
## Deterministic evaluation
|
|
33
|
-
|
|
34
|
-
1. A relation shares the film's schedule resolution; it does not resolve a new performance at every sample. Each pose is a pure function of the plan and film time, under [plan and time](../../../motion/laws/declaration.md#plan-and-time).
|
|
35
|
-
2. A motion law plans from the [entry state](../../../motion/laws/declaration.md#entry-state): displayed pose and velocity, planted feet and held objects. A relation preserves that entry through the vocabulary's operators.
|
|
36
|
-
3. A motion law declares its [events and decisive instant](../../../motion/laws/declaration.md#events-and-the-decisive-instant); a relation synchronizes on the installed actions' events.
|
|
37
|
-
4. A motion law declares its [cuts](../../../motion/laws/transitions.md#declared-cuts), windows and kinds. A relation uses those admitted cuts, and an unlisted cut is refused when the plan is built. Pure rules and tables declare their inputs without inventing motion events or cuts.
|
|
38
|
-
5. Variation draws from the installed packages' seeded generator, from a [stream](../../../motion/laws/variation.md#independent-draws) keyed by the film seed and stable identities, never from `Math.random` or a clock.
|
|
39
|
-
6. Variation stays within the domain its cited law bounds, and no seed, skill or member trait changes an outcome class or the count of members an outcome takes.
|
|
40
|
-
7. No result depends on history that only sequential playback builds or on a transient source. Exception: a stated limitation that names the consumer it affects.
|