@project-ava-supernova/core 0.2.176 → 0.2.178

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 (197) hide show
  1. package/dist/agent/agent.d.ts +3 -0
  2. package/dist/agent/agent.d.ts.map +1 -1
  3. package/dist/agent/agent.js +44 -11
  4. package/dist/agent/agent.js.map +1 -1
  5. package/dist/agent/social-craft.d.ts +30 -67
  6. package/dist/agent/social-craft.d.ts.map +1 -1
  7. package/dist/agent/social-craft.js +58 -185
  8. package/dist/agent/social-craft.js.map +1 -1
  9. package/dist/agent/system-prompt.d.ts +10 -3
  10. package/dist/agent/system-prompt.d.ts.map +1 -1
  11. package/dist/agent/system-prompt.js +1184 -1321
  12. package/dist/agent/system-prompt.js.map +1 -1
  13. package/dist/auto/aurora-router.d.ts +1 -1
  14. package/dist/auto/aurora-router.d.ts.map +1 -1
  15. package/dist/auto/aurora-router.js +4 -1
  16. package/dist/auto/aurora-router.js.map +1 -1
  17. package/dist/auto/auto-coordinator.d.ts.map +1 -1
  18. package/dist/auto/auto-coordinator.js +2 -1
  19. package/dist/auto/auto-coordinator.js.map +1 -1
  20. package/dist/auto/longxiang-router.d.ts.map +1 -1
  21. package/dist/auto/longxiang-router.js +1 -0
  22. package/dist/auto/longxiang-router.js.map +1 -1
  23. package/dist/auto/model-router.d.ts.map +1 -1
  24. package/dist/auto/model-router.js +1 -0
  25. package/dist/auto/model-router.js.map +1 -1
  26. package/dist/auto/supernova-router.d.ts.map +1 -1
  27. package/dist/auto/supernova-router.js +3 -0
  28. package/dist/auto/supernova-router.js.map +1 -1
  29. package/dist/auto/task-classifier.d.ts.map +1 -1
  30. package/dist/auto/task-classifier.js +8 -1
  31. package/dist/auto/task-classifier.js.map +1 -1
  32. package/dist/auto/types.d.ts +1 -1
  33. package/dist/auto/types.d.ts.map +1 -1
  34. package/dist/brand/brand-kits.d.ts +217 -0
  35. package/dist/brand/brand-kits.d.ts.map +1 -0
  36. package/dist/brand/brand-kits.js +681 -0
  37. package/dist/brand/brand-kits.js.map +1 -0
  38. package/dist/brand/kit-py.d.ts +7 -0
  39. package/dist/brand/kit-py.d.ts.map +1 -0
  40. package/dist/brand/kit-py.js +49 -0
  41. package/dist/brand/kit-py.js.map +1 -0
  42. package/dist/config/schema.d.ts +5 -0
  43. package/dist/config/schema.d.ts.map +1 -1
  44. package/dist/config/schema.js.map +1 -1
  45. package/dist/creative/folder-export.d.ts +72 -0
  46. package/dist/creative/folder-export.d.ts.map +1 -0
  47. package/dist/creative/folder-export.js +463 -0
  48. package/dist/creative/folder-export.js.map +1 -0
  49. package/dist/creative/library-folders.d.ts +171 -0
  50. package/dist/creative/library-folders.d.ts.map +1 -0
  51. package/dist/creative/library-folders.js +515 -0
  52. package/dist/creative/library-folders.js.map +1 -0
  53. package/dist/creative/library-upload.d.ts +23 -0
  54. package/dist/creative/library-upload.d.ts.map +1 -0
  55. package/dist/creative/library-upload.js +152 -0
  56. package/dist/creative/library-upload.js.map +1 -0
  57. package/dist/creative/making-report.d.ts +46 -0
  58. package/dist/creative/making-report.d.ts.map +1 -0
  59. package/dist/creative/making-report.js +244 -0
  60. package/dist/creative/making-report.js.map +1 -0
  61. package/dist/creative/pack-plan-status.d.ts +18 -0
  62. package/dist/creative/pack-plan-status.d.ts.map +1 -0
  63. package/dist/creative/pack-plan-status.js +58 -0
  64. package/dist/creative/pack-plan-status.js.map +1 -0
  65. package/dist/creative/store-profiles.d.ts +46 -0
  66. package/dist/creative/store-profiles.d.ts.map +1 -0
  67. package/dist/creative/store-profiles.js +486 -0
  68. package/dist/creative/store-profiles.js.map +1 -0
  69. package/dist/docs/data/tools.d.ts.map +1 -1
  70. package/dist/docs/data/tools.js +17 -0
  71. package/dist/docs/data/tools.js.map +1 -1
  72. package/dist/index.d.ts +32 -1
  73. package/dist/index.d.ts.map +1 -1
  74. package/dist/index.js +22 -0
  75. package/dist/index.js.map +1 -1
  76. package/dist/memory/config.d.ts +12 -0
  77. package/dist/memory/config.d.ts.map +1 -1
  78. package/dist/memory/config.js +12 -0
  79. package/dist/memory/config.js.map +1 -1
  80. package/dist/memory/memory-manager.d.ts +11 -0
  81. package/dist/memory/memory-manager.d.ts.map +1 -1
  82. package/dist/memory/memory-manager.js +90 -2
  83. package/dist/memory/memory-manager.js.map +1 -1
  84. package/dist/memory/project-brain.d.ts.map +1 -1
  85. package/dist/memory/project-brain.js +2 -1
  86. package/dist/memory/project-brain.js.map +1 -1
  87. package/dist/memory/tfidf.d.ts +10 -0
  88. package/dist/memory/tfidf.d.ts.map +1 -1
  89. package/dist/memory/tfidf.js +27 -0
  90. package/dist/memory/tfidf.js.map +1 -1
  91. package/dist/portability/bundle.d.ts.map +1 -1
  92. package/dist/portability/bundle.js +1 -0
  93. package/dist/portability/bundle.js.map +1 -1
  94. package/dist/portability/factory-reset.js +1 -1
  95. package/dist/portability/factory-reset.js.map +1 -1
  96. package/dist/social/index.d.ts +57 -0
  97. package/dist/social/index.d.ts.map +1 -1
  98. package/dist/social/index.js +54 -5
  99. package/dist/social/index.js.map +1 -1
  100. package/dist/social/tag-volume.d.ts +7 -0
  101. package/dist/social/tag-volume.d.ts.map +1 -1
  102. package/dist/social/tag-volume.js +27 -0
  103. package/dist/social/tag-volume.js.map +1 -1
  104. package/dist/tools/blender/build-model.d.ts +62 -0
  105. package/dist/tools/blender/build-model.d.ts.map +1 -0
  106. package/dist/tools/blender/build-model.js +501 -0
  107. package/dist/tools/blender/build-model.js.map +1 -0
  108. package/dist/tools/blender/find-blender.d.ts +43 -0
  109. package/dist/tools/blender/find-blender.d.ts.map +1 -0
  110. package/dist/tools/blender/find-blender.js +154 -0
  111. package/dist/tools/blender/find-blender.js.map +1 -0
  112. package/dist/tools/blender/model-brief.d.ts +64 -0
  113. package/dist/tools/blender/model-brief.d.ts.map +1 -0
  114. package/dist/tools/blender/model-brief.js +117 -0
  115. package/dist/tools/blender/model-brief.js.map +1 -0
  116. package/dist/tools/blender/model-history.d.ts +42 -0
  117. package/dist/tools/blender/model-history.d.ts.map +1 -0
  118. package/dist/tools/blender/model-history.js +145 -0
  119. package/dist/tools/blender/model-history.js.map +1 -0
  120. package/dist/tools/blender/paths.d.ts +20 -0
  121. package/dist/tools/blender/paths.d.ts.map +1 -0
  122. package/dist/tools/blender/paths.js +37 -0
  123. package/dist/tools/blender/paths.js.map +1 -0
  124. package/dist/tools/blender/runner-py.d.ts +2 -0
  125. package/dist/tools/blender/runner-py.d.ts.map +1 -0
  126. package/dist/tools/blender/runner-py.js +455 -0
  127. package/dist/tools/blender/runner-py.js.map +1 -0
  128. package/dist/tools/brief-store.d.ts +28 -0
  129. package/dist/tools/brief-store.d.ts.map +1 -0
  130. package/dist/tools/brief-store.js +76 -0
  131. package/dist/tools/brief-store.js.map +1 -0
  132. package/dist/tools/check-posts.d.ts.map +1 -1
  133. package/dist/tools/check-posts.js +21 -3
  134. package/dist/tools/check-posts.js.map +1 -1
  135. package/dist/tools/design-checkin.d.ts +28 -0
  136. package/dist/tools/design-checkin.d.ts.map +1 -0
  137. package/dist/tools/design-checkin.js +74 -0
  138. package/dist/tools/design-checkin.js.map +1 -0
  139. package/dist/tools/design-docs.d.ts +37 -0
  140. package/dist/tools/design-docs.d.ts.map +1 -0
  141. package/dist/tools/design-docs.js +367 -0
  142. package/dist/tools/design-docs.js.map +1 -0
  143. package/dist/tools/design-folder.d.ts +24 -0
  144. package/dist/tools/design-folder.d.ts.map +1 -0
  145. package/dist/tools/design-folder.js +277 -0
  146. package/dist/tools/design-folder.js.map +1 -0
  147. package/dist/tools/design-fonts.d.ts +58 -0
  148. package/dist/tools/design-fonts.d.ts.map +1 -0
  149. package/dist/tools/design-fonts.js +316 -0
  150. package/dist/tools/design-fonts.js.map +1 -0
  151. package/dist/tools/design-studio-tools.d.ts +16 -0
  152. package/dist/tools/design-studio-tools.d.ts.map +1 -1
  153. package/dist/tools/design-studio-tools.js +288 -43
  154. package/dist/tools/design-studio-tools.js.map +1 -1
  155. package/dist/tools/generation-manager.d.ts +1 -1
  156. package/dist/tools/generation-manager.d.ts.map +1 -1
  157. package/dist/tools/gimp/build-image.d.ts +161 -0
  158. package/dist/tools/gimp/build-image.d.ts.map +1 -0
  159. package/dist/tools/gimp/build-image.js +900 -0
  160. package/dist/tools/gimp/build-image.js.map +1 -0
  161. package/dist/tools/gimp/find-gimp.d.ts +32 -0
  162. package/dist/tools/gimp/find-gimp.d.ts.map +1 -0
  163. package/dist/tools/gimp/find-gimp.js +149 -0
  164. package/dist/tools/gimp/find-gimp.js.map +1 -0
  165. package/dist/tools/gimp/runner-py.d.ts +2 -0
  166. package/dist/tools/gimp/runner-py.d.ts.map +1 -0
  167. package/dist/tools/gimp/runner-py.js +750 -0
  168. package/dist/tools/gimp/runner-py.js.map +1 -0
  169. package/dist/tools/making-record.d.ts +80 -0
  170. package/dist/tools/making-record.d.ts.map +1 -0
  171. package/dist/tools/making-record.js +221 -0
  172. package/dist/tools/making-record.js.map +1 -0
  173. package/dist/tools/propose-brief.d.ts.map +1 -1
  174. package/dist/tools/propose-brief.js +6 -1
  175. package/dist/tools/propose-brief.js.map +1 -1
  176. package/dist/tools/research-post.d.ts +1 -1
  177. package/dist/tools/research-post.d.ts.map +1 -1
  178. package/dist/tools/research-post.js +20 -9
  179. package/dist/tools/research-post.js.map +1 -1
  180. package/dist/tools/review-post.d.ts +25 -0
  181. package/dist/tools/review-post.d.ts.map +1 -0
  182. package/dist/tools/review-post.js +63 -0
  183. package/dist/tools/review-post.js.map +1 -0
  184. package/dist/tools/tool-registry.d.ts.map +1 -1
  185. package/dist/tools/tool-registry.js +42 -1
  186. package/dist/tools/tool-registry.js.map +1 -1
  187. package/dist/tools/tool-request-words.d.ts +7 -0
  188. package/dist/tools/tool-request-words.d.ts.map +1 -0
  189. package/dist/tools/tool-request-words.js +39 -0
  190. package/dist/tools/tool-request-words.js.map +1 -0
  191. package/dist/tools/write-post.d.ts.map +1 -1
  192. package/dist/tools/write-post.js +38 -2
  193. package/dist/tools/write-post.js.map +1 -1
  194. package/dist/tools/write-video-post.d.ts.map +1 -1
  195. package/dist/tools/write-video-post.js +10 -1
  196. package/dist/tools/write-video-post.js.map +1 -1
  197. package/package.json +2 -1
@@ -0,0 +1,154 @@
1
+ /**
2
+ * Find Blender on this machine.
3
+ *
4
+ * Order: the path the person set in settings (`preferences.blenderPath` in
5
+ * ~/.ava/config.json, so it follows them between the extension and the IDE),
6
+ * then AVA_BLENDER, then the usual install places, then PATH. The newest
7
+ * version wins when several are installed. Nothing found → null, and the tool
8
+ * says so with a link instead of failing quietly.
9
+ */
10
+ import { existsSync, readdirSync } from 'node:fs';
11
+ import { readFile, writeFile, mkdir, rename } from 'node:fs/promises';
12
+ import { join, dirname } from 'node:path';
13
+ import { execFile } from 'node:child_process';
14
+ import { CONFIG_PATH } from '../../core/constants.js';
15
+ export const BLENDER_DOWNLOAD_URL = 'https://www.blender.org/download/';
16
+ const EXE = process.platform === 'win32' ? 'blender.exe' : 'blender';
17
+ /** Candidate install folders for this OS, newest-looking first. */
18
+ function detectedCandidates() {
19
+ const out = [];
20
+ if (process.platform === 'win32') {
21
+ const roots = [process.env.ProgramFiles, process.env['ProgramFiles(x86)'], 'C:\\Program Files']
22
+ .filter((r) => !!r);
23
+ for (const root of new Set(roots)) {
24
+ const foundation = join(root, 'Blender Foundation');
25
+ if (!existsSync(foundation))
26
+ continue;
27
+ let dirs = [];
28
+ try {
29
+ dirs = readdirSync(foundation);
30
+ }
31
+ catch { /* unreadable */ }
32
+ // "Blender 5.2", "Blender 4.5" … sort by version number, highest first.
33
+ dirs.sort((a, b) => b.localeCompare(a, undefined, { numeric: true }));
34
+ for (const d of dirs)
35
+ out.push(join(foundation, d, EXE));
36
+ }
37
+ for (const root of roots)
38
+ out.push(join(root, 'Steam', 'steamapps', 'common', 'Blender', EXE));
39
+ if (process.env.LOCALAPPDATA)
40
+ out.push(join(process.env.LOCALAPPDATA, 'Programs', 'Blender Foundation', 'Blender', EXE));
41
+ }
42
+ else if (process.platform === 'darwin') {
43
+ out.push('/Applications/Blender.app/Contents/MacOS/Blender');
44
+ if (process.env.HOME)
45
+ out.push(join(process.env.HOME, 'Applications', 'Blender.app', 'Contents', 'MacOS', 'Blender'));
46
+ }
47
+ else {
48
+ out.push('/usr/bin/blender', '/usr/local/bin/blender', '/snap/bin/blender');
49
+ if (process.env.HOME)
50
+ out.push(join(process.env.HOME, '.steam', 'steam', 'steamapps', 'common', 'Blender', 'blender'));
51
+ }
52
+ return out;
53
+ }
54
+ function onPath() {
55
+ const dirs = (process.env.PATH || '').split(process.platform === 'win32' ? ';' : ':');
56
+ for (const d of dirs) {
57
+ if (!d)
58
+ continue;
59
+ const p = join(d, EXE);
60
+ if (existsSync(p))
61
+ return p;
62
+ }
63
+ return null;
64
+ }
65
+ /** Ask Blender its version. Null when the file is not a working Blender. */
66
+ export function readBlenderVersion(exe) {
67
+ return new Promise((resolve) => {
68
+ execFile(exe, ['-b', '--factory-startup', '--version'], { timeout: 30_000, windowsHide: true }, (err, stdout) => {
69
+ if (err && !stdout)
70
+ return resolve(null);
71
+ const m = /Blender\s+(\d+\.\d+(?:\.\d+)?(?:\s+LTS)?)/.exec(String(stdout));
72
+ resolve(m ? m[1] : null);
73
+ });
74
+ });
75
+ }
76
+ async function configuredPath() {
77
+ try {
78
+ const cfg = JSON.parse(await readFile(CONFIG_PATH, 'utf-8'));
79
+ return cfg.preferences?.blenderPath?.trim() || undefined;
80
+ }
81
+ catch {
82
+ return undefined;
83
+ }
84
+ }
85
+ let cached = null;
86
+ /**
87
+ * Locate Blender. Cached per configured path, so changing the setting is
88
+ * picked up on the next call without a restart.
89
+ */
90
+ export async function findBlender(opts = {}) {
91
+ const configured = await configuredPath();
92
+ const key = `${configured ?? ''}|${process.env.AVA_BLENDER ?? ''}`;
93
+ if (!opts.refresh && cached?.key === key)
94
+ return cached.install;
95
+ const tries = [];
96
+ if (configured)
97
+ tries.push({ path: configured, source: 'settings' });
98
+ if (process.env.AVA_BLENDER)
99
+ tries.push({ path: process.env.AVA_BLENDER, source: 'env' });
100
+ for (const p of detectedCandidates())
101
+ tries.push({ path: p, source: 'detected' });
102
+ const fromPath = onPath();
103
+ if (fromPath)
104
+ tries.push({ path: fromPath, source: 'path' });
105
+ let install = null;
106
+ for (const t of tries) {
107
+ if (!existsSync(t.path))
108
+ continue;
109
+ const version = await readBlenderVersion(t.path);
110
+ if (version) {
111
+ install = { path: t.path, version, source: t.source };
112
+ break;
113
+ }
114
+ }
115
+ cached = { key, install };
116
+ return install;
117
+ }
118
+ /**
119
+ * Save (or clear, with null) the Blender path the person chose in Settings.
120
+ * Checked first — a path that isn't a working Blender is refused with a
121
+ * reason, never saved. Lives in ~/.ava/config.json so the extension and the
122
+ * IDE share it.
123
+ */
124
+ export async function setBlenderPath(path) {
125
+ const chosen = path?.trim() || null;
126
+ if (chosen) {
127
+ if (!existsSync(chosen))
128
+ return { ok: false, error: 'There is no file at that path.' };
129
+ const version = await readBlenderVersion(chosen);
130
+ if (!version)
131
+ return { ok: false, error: 'That file did not answer as Blender. Pick blender.exe inside the Blender folder.' };
132
+ }
133
+ let cfg = {};
134
+ try {
135
+ cfg = JSON.parse(await readFile(CONFIG_PATH, 'utf-8'));
136
+ }
137
+ catch { /* none yet */ }
138
+ const prefs = { ...(cfg.preferences ?? {}) };
139
+ if (chosen)
140
+ prefs.blenderPath = chosen;
141
+ else
142
+ delete prefs.blenderPath;
143
+ cfg.preferences = prefs;
144
+ await mkdir(dirname(CONFIG_PATH), { recursive: true });
145
+ const tmp = `${CONFIG_PATH}.${process.pid}.tmp`;
146
+ await writeFile(tmp, JSON.stringify(cfg, null, 2), 'utf-8');
147
+ await rename(tmp, CONFIG_PATH);
148
+ return { ok: true, install: await findBlender({ refresh: true }) };
149
+ }
150
+ /** What Settings shows: the Blender in use, and whether it was chosen by hand. */
151
+ export async function blenderStatus() {
152
+ return { install: await findBlender({ refresh: true }), configured: (await configuredPath()) ?? null };
153
+ }
154
+ //# sourceMappingURL=find-blender.js.map
@@ -0,0 +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AE,GAAG,CAAE,GAAG,CAAC,WAAmD,IAAI,EAAE,CAAC,EAAE,CAAC;IACtF,IAAI,MAAM;QAAE,KAAK,CAAC,WAAW,GAAG,MAAM,CAAC;;QAAM,OAAO,KAAK,CAAC,WAAW,CAAC;IACtE,GAAG,CAAC,WAAW,GAAG,KAAK,CAAC;IACxB,MAAM,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACvD,MAAM,GAAG,GAAG,GAAG,WAAW,IAAI,OAAO,CAAC,GAAG,MAAM,CAAC;IAChD,MAAM,SAAS,CAAC,GAAG,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,OAAO,CAAC,CAAC;IAC5D,MAAM,MAAM,CAAC,GAAG,EAAE,WAAW,CAAC,CAAC;IAC/B,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;AACrE,CAAC;AAED,kFAAkF;AAClF,MAAM,CAAC,KAAK,UAAU,aAAa;IACjC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,MAAM,cAAc,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC;AACzG,CAAC"}
@@ -0,0 +1,64 @@
1
+ /**
2
+ * The brief for a 3D model — agreed before anything is built.
3
+ *
4
+ * His lesson from the Albert Bridge (28 Oct 2026): the brief decides the
5
+ * result, and research comes before the first polygon. Most people don't know
6
+ * what to ask for, so the studio asks — and Ava proposes the answers with her
7
+ * reasoning, because the person learns by questioning a position.
8
+ *
9
+ * Stored as brief.json in the model's own folder, so it travels with the model
10
+ * (duplicate, copy to project) and both surfaces read the same file.
11
+ *
12
+ * ENFORCED, not advised: design_build_model refuses to run until the person
13
+ * has agreed the brief on the card. Ava cannot agree it herself — the only way
14
+ * to 'agreed' is agreeModelBrief, which the surfaces call from his button.
15
+ * Re-proposing an agreed brief puts it back to 'proposed': a changed brief is
16
+ * a new agreement.
17
+ */
18
+ import type { Tool, ToolExecutionContext, ToolResult, ToolRiskLevel } from '../types.js';
19
+ import type { FunctionSchema } from '../../providers/types.js';
20
+ import { type BriefRecord } from '../brief-store.js';
21
+ import { type ModelStep } from './model-history.js';
22
+ export interface ModelBriefFields {
23
+ what: string;
24
+ where: string;
25
+ style: string;
26
+ dimensions: string;
27
+ references: string;
28
+ target: string;
29
+ budget: string;
30
+ condition: string;
31
+ extras: string;
32
+ purpose: string;
33
+ }
34
+ export interface ModelBrief extends ModelBriefFields, BriefRecord {
35
+ }
36
+ export declare const BRIEF_FIELDS: Array<[keyof ModelBriefFields, string, string]>;
37
+ export declare const briefPath: (slug: string) => string;
38
+ export declare const readModelBrief: (slug: string) => Promise<ModelBrief | null>;
39
+ /** His button on the card. The ONLY way a brief becomes agreed. */
40
+ export declare const agreeModelBrief: (slug: string) => Promise<ModelBrief | null>;
41
+ /** His edits on the card. Saving changes keeps it agreed only if nothing moved. */
42
+ export declare const saveModelBriefEdits: (slug: string, fields: Partial<ModelBriefFields>) => Promise<ModelBrief | null>;
43
+ export interface ModelSummary {
44
+ slug: string;
45
+ name: string;
46
+ brief: ModelBrief | null;
47
+ built: boolean;
48
+ updatedAt: string;
49
+ /** Every saved step, oldest first, so they can look back and return to one. */
50
+ history: ModelStep[];
51
+ }
52
+ /** Every model folder — including ones with a brief and nothing built yet. */
53
+ export declare function listModels(): Promise<ModelSummary[]>;
54
+ /** A readable brief, for her context and the tool replies. */
55
+ export declare function formatModelBrief(b: ModelBrief): string;
56
+ export declare class DesignProposeModelBriefTool implements Tool {
57
+ readonly name = "design_propose_model_brief";
58
+ readonly description = "Propose the brief for a 3D model \u2014 what it is, where it lives, style, real dimensions, references, target, budget, condition, extras, purpose \u2014 for the person to question and agree BEFORE anything is built.";
59
+ readonly riskLevel: ToolRiskLevel;
60
+ readonly requiresConfirmation = false;
61
+ readonly schema: FunctionSchema;
62
+ execute(args: Record<string, unknown>, context?: ToolExecutionContext): Promise<ToolResult>;
63
+ }
64
+ //# sourceMappingURL=model-brief.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-brief.d.ts","sourceRoot":"","sources":["../../../src/tools/blender/model-brief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAKH,OAAO,KAAK,EAAE,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAc,KAAK,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAAoB,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAEtE,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,UAAW,SAAQ,gBAAgB,EAAE,WAAW;CAAG;AAEpE,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,CAAC,MAAM,gBAAgB,EAAE,MAAM,EAAE,MAAM,CAAC,CAWxE,CAAC;AAIF,eAAO,MAAM,SAAS,0BAAa,CAAC;AACpC,eAAO,MAAM,cAAc,8CAAa,CAAC;AAEzC,mEAAmE;AACnE,eAAO,MAAM,eAAe,8CAAc,CAAC;AAC3C,mFAAmF;AACnF,eAAO,MAAM,mBAAmB,GAAI,MAAM,MAAM,EAAE,QAAQ,OAAO,CAAC,gBAAgB,CAAC,+BAAkC,CAAC;AAEtH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,UAAU,GAAG,IAAI,CAAC;IACzB,KAAK,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,OAAO,EAAE,SAAS,EAAE,CAAC;CACtB;AAED,8EAA8E;AAC9E,wBAAsB,UAAU,IAAI,OAAO,CAAC,YAAY,EAAE,CAAC,CAc1D;AAED,8DAA8D;AAC9D,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,UAAU,GAAG,MAAM,CAEtD;AAID,qBAAa,2BAA4B,YAAW,IAAI;IACtD,QAAQ,CAAC,IAAI,gCAAgC;IAC7C,QAAQ,CAAC,WAAW,8NAC+L;IAEnN,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAU;IAC3C,QAAQ,CAAC,oBAAoB,SAAS;IAEtC,QAAQ,CAAC,MAAM,EAAE,cAAc,CAgB7B;IAEI,OAAO,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,OAAO,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,UAAU,CAAC;CA+BlG"}
@@ -0,0 +1,117 @@
1
+ /**
2
+ * The brief for a 3D model — agreed before anything is built.
3
+ *
4
+ * His lesson from the Albert Bridge (28 Oct 2026): the brief decides the
5
+ * result, and research comes before the first polygon. Most people don't know
6
+ * what to ask for, so the studio asks — and Ava proposes the answers with her
7
+ * reasoning, because the person learns by questioning a position.
8
+ *
9
+ * Stored as brief.json in the model's own folder, so it travels with the model
10
+ * (duplicate, copy to project) and both surfaces read the same file.
11
+ *
12
+ * ENFORCED, not advised: design_build_model refuses to run until the person
13
+ * has agreed the brief on the card. Ava cannot agree it herself — the only way
14
+ * to 'agreed' is agreeModelBrief, which the surfaces call from his button.
15
+ * Re-proposing an agreed brief puts it back to 'proposed': a changed brief is
16
+ * a new agreement.
17
+ */
18
+ import { existsSync } from 'node:fs';
19
+ import { readdir, stat } from 'node:fs/promises';
20
+ import { join } from 'node:path';
21
+ import { modelsDir, modelSlug } from './paths.js';
22
+ import { briefStore } from '../brief-store.js';
23
+ import { readModelHistory } from './model-history.js';
24
+ export const BRIEF_FIELDS = [
25
+ ['what', 'What it is', 'e.g. "a worn wooden supply crate with iron corner brackets"'],
26
+ ['where', 'Where it lives / what it is for', 'e.g. "the ruined London dock in the Earth chapter" or "a product shot for my shop"'],
27
+ ['style', 'Style', 'low-poly, stylised or realistic — and why that suits where it lives'],
28
+ ['dimensions', 'Real dimensions', 'researched, in metres, e.g. "1.2 × 0.8 × 0.8 m — a standard shipping crate"'],
29
+ ['references', 'References', 'what the reference images you found show: construction, materials, details worth copying'],
30
+ ['target', 'Where it goes', 'Unreal (FBX, Z-up), Unity (FBX, Y-up), Godot (glTF), a 3D print, renders only…'],
31
+ ['budget', 'Detail budget', 'triangles and texture size, e.g. "~2k triangles, 2K textures"'],
32
+ ['condition', 'Condition', 'pristine → worn → ruined, and what that means for this object'],
33
+ ['extras', 'Extras', 'inventory icon, variants, LODs — or "none"'],
34
+ ['purpose', 'Purpose', 'their own project, or for sale (a marketplace has stricter checks)'],
35
+ ];
36
+ const store = briefStore(modelsDir, () => BRIEF_FIELDS.map(([k]) => k), 'blender');
37
+ export const briefPath = store.path;
38
+ export const readModelBrief = store.read;
39
+ /** His button on the card. The ONLY way a brief becomes agreed. */
40
+ export const agreeModelBrief = store.agree;
41
+ /** His edits on the card. Saving changes keeps it agreed only if nothing moved. */
42
+ export const saveModelBriefEdits = (slug, fields) => store.saveEdits(slug, fields);
43
+ /** Every model folder — including ones with a brief and nothing built yet. */
44
+ export async function listModels() {
45
+ const out = [];
46
+ for (const e of await readdir(modelsDir(), { withFileTypes: true }).catch(() => [])) {
47
+ if (!e.isDirectory())
48
+ continue;
49
+ const dir = join(modelsDir(), e.name);
50
+ const brief = await readModelBrief(e.name);
51
+ const blend = join(dir, `${e.name}.blend`);
52
+ const built = existsSync(blend);
53
+ const mtime = (await stat(built ? blend : dir).catch(() => null))?.mtime ?? new Date(0);
54
+ const briefTime = brief?.agreedAt || brief?.proposedAt;
55
+ const updatedAt = briefTime && new Date(briefTime) > mtime ? briefTime : mtime.toISOString();
56
+ out.push({ slug: e.name, name: brief?.name || e.name, brief, built, updatedAt, history: await readModelHistory(e.name) });
57
+ }
58
+ return out.sort((a, b) => b.updatedAt.localeCompare(a.updatedAt));
59
+ }
60
+ /** A readable brief, for her context and the tool replies. */
61
+ export function formatModelBrief(b) {
62
+ return BRIEF_FIELDS.map(([k, label]) => `${label}: ${b[k] || '—'}`).join('\n');
63
+ }
64
+ // ── design_propose_model_brief ───────────────────────────────────────────────
65
+ export class DesignProposeModelBriefTool {
66
+ name = 'design_propose_model_brief';
67
+ description = 'Propose the brief for a 3D model — what it is, where it lives, style, real dimensions, references, target, budget, condition, extras, purpose — for the person to question and agree BEFORE anything is built.';
68
+ // Writes only the brief file in the model's own folder; builds nothing.
69
+ riskLevel = 'safe';
70
+ requiresConfirmation = false;
71
+ schema = {
72
+ name: 'design_propose_model_brief',
73
+ description: 'Put the BRIEF for a 3D model on the card in the room, before anything is built. Research first (web_search for references and REAL dimensions), ' +
74
+ 'then propose YOUR point of view on every field with your reasoning — never hand the questions back to them; most people do not know what to ask for, which is why the studio asks. ' +
75
+ 'The person questions it, may edit it on the card, and agrees it there. design_build_model will not run until they have agreed. ' +
76
+ 'Call again with the full brief whenever the discussion changes it; a changed brief has to be agreed again. You cannot agree it yourself.',
77
+ parameters: {
78
+ type: 'object',
79
+ properties: {
80
+ name: { type: 'string', description: 'The model\'s name, e.g. "Worn Supply Crate". The same name is used for design_build_model.' },
81
+ ...Object.fromEntries(BRIEF_FIELDS.map(([k, label, hint]) => [k, { type: 'string', description: `${label} — ${hint}.` }])),
82
+ reasoning: { type: 'string', description: 'Why this brief: what you found in your research, what you weighed and rejected. This is the part they learn from.' },
83
+ },
84
+ required: ['name', ...BRIEF_FIELDS.map(([k]) => k), 'reasoning'],
85
+ },
86
+ };
87
+ async execute(args, context) {
88
+ const str = (k) => (typeof args[k] === 'string' ? args[k].trim() : '');
89
+ const name = str('name');
90
+ const slug = modelSlug(name);
91
+ if (!slug)
92
+ return { success: false, output: 'Missing `name` — the model\'s name.' };
93
+ const missing = BRIEF_FIELDS.filter(([k]) => !str(k)).map(([, label]) => label);
94
+ if (!str('reasoning'))
95
+ missing.push('your reasoning');
96
+ if (missing.length) {
97
+ return { success: false, output: `The brief is missing: ${missing.join(', ')}. Every part shapes the model — a hole here is filled by guesswork when it is built.` };
98
+ }
99
+ const previous = await readModelBrief(slug);
100
+ const brief = {
101
+ name,
102
+ ...Object.fromEntries(BRIEF_FIELDS.map(([k]) => [k, str(k)])),
103
+ reasoning: str('reasoning'),
104
+ status: 'proposed',
105
+ proposedAt: new Date().toISOString(),
106
+ };
107
+ await store.propose(slug, brief, context);
108
+ const wasAgreed = previous?.status === 'agreed';
109
+ return {
110
+ success: true,
111
+ output: `Brief for "${name}" is on the card${wasAgreed ? ' — it changed, so it needs agreeing again before the next build' : ''}. ` +
112
+ 'Talk them through your reasoning, answer their questions, change it where they have a point. They agree it on the card; nothing is built until they do.',
113
+ metadata: { model: slug },
114
+ };
115
+ }
116
+ }
117
+ //# sourceMappingURL=model-brief.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-brief.js","sourceRoot":"","sources":["../../../src/tools/blender/model-brief.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAClD,OAAO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,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAiC;YAC9F,SAAS,EAAE,GAAG,CAAC,WAAW,CAAC;YAC3B,MAAM,EAAE,UAAU;YAClB,UAAU,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;SACrC,CAAC;QACF,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;QAE1C,MAAM,SAAS,GAAG,QAAQ,EAAE,MAAM,KAAK,QAAQ,CAAC;QAChD,OAAO;YACL,OAAO,EAAE,IAAI;YACb,MAAM,EACJ,cAAc,IAAI,mBAAmB,SAAS,CAAC,CAAC,CAAC,iEAAiE,CAAC,CAAC,CAAC,EAAE,IAAI;gBAC3H,yJAAyJ;YAC3J,QAAQ,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE;SAC1B,CAAC;IACJ,CAAC;CACF"}
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Step history for 3D models — the same strip the GIMP room has (Library
3
+ * folders and packs plan, the step after Phase 3; built 9 Nov 2026).
4
+ *
5
+ * Every run saves over the same .blend, and versions/ only kept the last five
6
+ * with no picture and no way back from the room. Now each successful step is
7
+ * saved to history/<number>/ with its preview and a label, and going back to
8
+ * one is a step itself — so nothing later is lost and they can go forward again.
9
+ *
10
+ * What a step holds: the .blend, the .glb and preview.png — and the baked
11
+ * textures, because a bake rewrites them and going back must bring back the
12
+ * textures that step had. Texture maps are large, so a step only stores them
13
+ * when they changed since the step before; otherwise it points at the step
14
+ * that has them (texturesIn). Pruning moves a shared copy forward rather than
15
+ * losing it.
16
+ */
17
+ import { type MakingAi } from '../making-record.js';
18
+ export interface ModelStep {
19
+ number: number;
20
+ label: string;
21
+ at: string;
22
+ /** Relative to the model's folder, or null when the step had no picture. */
23
+ preview: string | null;
24
+ /** The step whose history folder holds this step's textures; null = it had none. */
25
+ texturesIn: number | null;
26
+ }
27
+ export declare function readModelHistory(slug: string): Promise<ModelStep[]>;
28
+ /** Save the model as it stands now as the next step. */
29
+ export declare function recordModelStep(slug: string, label: string): Promise<ModelStep | null>;
30
+ /**
31
+ * Put the model back as it was at a step: .blend, .glb, preview and textures.
32
+ * Going back is itself saved as a step, so later steps stay and can be
33
+ * returned to. Null if there is no such step.
34
+ */
35
+ export declare function restoreModelStep(slug: string, number: number, who?: {
36
+ by: 'ava';
37
+ ai: MakingAi | null;
38
+ ask: string | null;
39
+ } | {
40
+ by: 'person';
41
+ }): Promise<ModelStep | null>;
42
+ //# sourceMappingURL=model-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-history.d.ts","sourceRoot":"","sources":["../../../src/tools/blender/model-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAMH,OAAO,EAA0C,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE5F,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;IACX,4EAA4E;IAC5E,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,oFAAoF;IACpF,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAMD,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAKzE;AAmBD,wDAAwD;AACxD,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAkD5F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAC5B,GAAG,GAAE;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,EAAE,EAAE,QAAQ,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,QAAQ,CAAA;CAAqB,GAChG,OAAO,CAAC,SAAS,GAAG,IAAI,CAAC,CAmB3B"}
@@ -0,0 +1,145 @@
1
+ /**
2
+ * Step history for 3D models — the same strip the GIMP room has (Library
3
+ * folders and packs plan, the step after Phase 3; built 9 Nov 2026).
4
+ *
5
+ * Every run saves over the same .blend, and versions/ only kept the last five
6
+ * with no picture and no way back from the room. Now each successful step is
7
+ * saved to history/<number>/ with its preview and a label, and going back to
8
+ * one is a step itself — so nothing later is lost and they can go forward again.
9
+ *
10
+ * What a step holds: the .blend, the .glb and preview.png — and the baked
11
+ * textures, because a bake rewrites them and going back must bring back the
12
+ * textures that step had. Texture maps are large, so a step only stores them
13
+ * when they changed since the step before; otherwise it points at the step
14
+ * that has them (texturesIn). Pruning moves a shared copy forward rather than
15
+ * losing it.
16
+ */
17
+ import { existsSync } from 'node:fs';
18
+ import { cp, mkdir, readdir, readFile, rename, rm, stat, writeFile, copyFile } from 'node:fs/promises';
19
+ import { join } from 'node:path';
20
+ import { modelsDir } from './paths.js';
21
+ import { appendMaking, beforeChange, sourcesNow } from '../making-record.js';
22
+ const HISTORY_KEEP = 20;
23
+ const historyFile = (slug) => join(modelsDir(), slug, 'history.json');
24
+ const stepFolder = (slug, n) => join(modelsDir(), slug, 'history', String(n));
25
+ export async function readModelHistory(slug) {
26
+ try {
27
+ const parsed = JSON.parse(await readFile(historyFile(slug), 'utf-8'));
28
+ return Array.isArray(parsed) ? parsed : [];
29
+ }
30
+ catch {
31
+ return [];
32
+ }
33
+ }
34
+ /** Names, sizes and times of the textures: enough to know whether a bake changed them. */
35
+ async function textureSignature(dir) {
36
+ const names = (await readdir(dir).catch(() => [])).sort();
37
+ if (!names.length)
38
+ return null;
39
+ const parts = [];
40
+ for (const n of names) {
41
+ const s = await stat(join(dir, n)).catch(() => null);
42
+ if (s?.isFile())
43
+ parts.push(`${n}:${s.size}:${Math.round(s.mtimeMs)}`);
44
+ }
45
+ return parts.length ? parts.join('|') : null;
46
+ }
47
+ async function signatureOfStep(slug, step) {
48
+ if (step.texturesIn === null)
49
+ return null;
50
+ try {
51
+ return await readFile(join(stepFolder(slug, step.texturesIn), 'textures.sig'), 'utf-8');
52
+ }
53
+ catch {
54
+ return null;
55
+ }
56
+ }
57
+ /** Save the model as it stands now as the next step. */
58
+ export async function recordModelStep(slug, label) {
59
+ const dir = join(modelsDir(), slug);
60
+ const blend = join(dir, `${slug}.blend`);
61
+ if (!existsSync(blend))
62
+ return null;
63
+ const steps = await readModelHistory(slug);
64
+ const number = (steps.at(-1)?.number ?? 0) + 1;
65
+ const folder = stepFolder(slug, number);
66
+ await mkdir(folder, { recursive: true });
67
+ await copyFile(blend, join(folder, `${slug}.blend`));
68
+ for (const f of [`${slug}.glb`, 'preview.png']) {
69
+ if (existsSync(join(dir, f)))
70
+ await copyFile(join(dir, f), join(folder, f));
71
+ }
72
+ // Textures only when they changed since the last step.
73
+ const sig = await textureSignature(join(dir, 'textures'));
74
+ let texturesIn = null;
75
+ if (sig) {
76
+ // Any step already holding these exact textures — not only the last one:
77
+ // going back to step 2 after step 1 must reuse step 2's copy.
78
+ let holder = null;
79
+ for (const n of [...new Set(steps.map((s) => s.texturesIn).filter((x) => x !== null))].reverse()) {
80
+ if ((await signatureOfStep(slug, { texturesIn: n })) === sig) {
81
+ holder = n;
82
+ break;
83
+ }
84
+ }
85
+ if (holder !== null)
86
+ texturesIn = holder;
87
+ else {
88
+ await cp(join(dir, 'textures'), join(folder, 'textures'), { recursive: true, preserveTimestamps: true });
89
+ await writeFile(join(folder, 'textures.sig'), sig, 'utf-8');
90
+ texturesIn = number;
91
+ }
92
+ }
93
+ const step = {
94
+ number, label: label.trim().slice(0, 80) || `Step ${number}`, at: new Date().toISOString(),
95
+ preview: existsSync(join(folder, 'preview.png')) ? `history/${number}/preview.png` : null,
96
+ texturesIn,
97
+ };
98
+ steps.push(step);
99
+ while (steps.length > HISTORY_KEEP) {
100
+ const oldest = steps.shift();
101
+ const heirs = steps.filter((s) => s.texturesIn === oldest.number);
102
+ if (heirs.length) {
103
+ // A later step still uses these textures: move them to the first of those.
104
+ const heir = heirs[0].number;
105
+ await rm(join(stepFolder(slug, heir), 'textures'), { recursive: true, force: true });
106
+ await rename(join(stepFolder(slug, oldest.number), 'textures'), join(stepFolder(slug, heir), 'textures')).catch(() => { });
107
+ await rename(join(stepFolder(slug, oldest.number), 'textures.sig'), join(stepFolder(slug, heir), 'textures.sig')).catch(() => { });
108
+ for (const s of heirs)
109
+ s.texturesIn = heir;
110
+ }
111
+ await rm(stepFolder(slug, oldest.number), { recursive: true, force: true });
112
+ }
113
+ await writeFile(historyFile(slug), JSON.stringify(steps, null, 2), 'utf-8');
114
+ return step;
115
+ }
116
+ /**
117
+ * Put the model back as it was at a step: .blend, .glb, preview and textures.
118
+ * Going back is itself saved as a step, so later steps stay and can be
119
+ * returned to. Null if there is no such step.
120
+ */
121
+ export async function restoreModelStep(slug, number, who = { by: 'person' }) {
122
+ const step = (await readModelHistory(slug)).find((s) => s.number === number);
123
+ if (!step)
124
+ return null;
125
+ const dir = join(modelsDir(), slug);
126
+ const folder = stepFolder(slug, number);
127
+ if (!existsSync(join(folder, `${slug}.blend`)))
128
+ return null;
129
+ await beforeChange(dir, 'blender');
130
+ await copyFile(join(folder, `${slug}.blend`), join(dir, `${slug}.blend`));
131
+ for (const f of [`${slug}.glb`, 'preview.png']) {
132
+ if (existsSync(join(folder, f)))
133
+ await copyFile(join(folder, f), join(dir, f));
134
+ else
135
+ await rm(join(dir, f), { force: true });
136
+ }
137
+ await rm(join(dir, 'textures'), { recursive: true, force: true });
138
+ if (step.texturesIn !== null && existsSync(join(stepFolder(slug, step.texturesIn), 'textures'))) {
139
+ await cp(join(stepFolder(slug, step.texturesIn), 'textures'), join(dir, 'textures'), { recursive: true, preserveTimestamps: true });
140
+ }
141
+ await recordModelStep(slug, `Back to step ${number}`);
142
+ await appendMaking(dir, { ...who, event: 'restored', tool: 'blender', step: number, label: step.label, sources: await sourcesNow(dir, 'blender') });
143
+ return step;
144
+ }
145
+ //# sourceMappingURL=model-history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"model-history.js","sourceRoot":"","sources":["../../../src/tools/blender/model-history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvG,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAiB,MAAM,qBAAqB,CAAC;AAY5F,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,WAAW,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,cAAc,CAAC,CAAC;AAC9E,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,CAAS,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAE9F,MAAM,CAAC,KAAK,UAAU,gBAAgB,CAAC,IAAY;IACjD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,MAAM,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC,CAAC;QACtE,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC;IAC7C,CAAC;IAAC,MAAM,CAAC;QA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AC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,MAAM,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IAClE,IAAI,IAAI,CAAC,UAAU,KAAK,IAAI,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,CAAC,EAAE,CAAC;QAChG,MAAM,EAAE,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,EAAE,UAAU,CAAC,EAAE,IAAI,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,kBAAkB,EAAE,IAAI,EAAE,CAAC,CAAC;IACtI,CAAC;IACD,MAAM,eAAe,CAAC,IAAI,EAAE,gBAAgB,MAAM,EAAE,CAAC,CAAC;IACtD,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,GAAG,GAAG,EAAE,KAAK,EAAE,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC,GAAG,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC;IACpJ,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Where Ava's 3D models live: ~/.ava/creative/blender/<slug>/.
3
+ *
4
+ * Read at call time: tests point AVA_CREATIVE_DIR at a scratch folder so they
5
+ * never touch the real Library.
6
+ */
7
+ export declare const creativeDir: () => string;
8
+ export declare const modelsDir: () => string;
9
+ export declare const imagesDir: () => string;
10
+ export declare const metadataFile: () => string;
11
+ /** "Worn Supply Crate" → "worn-supply-crate". The folder and file names. */
12
+ export declare function modelSlug(name: string): string;
13
+ /**
14
+ * Delete a piece of work: its whole folder, brief included, and its Library
15
+ * entry. The Library can only reach work that has been made, so a brief that
16
+ * was never built had no way out. Only ever called from the person's own
17
+ * Delete button, after they have confirmed it.
18
+ */
19
+ export declare function deleteDesignWork(tool: 'blender' | 'gimp', slug: string): Promise<boolean>;
20
+ //# sourceMappingURL=paths.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../../src/tools/blender/paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,eAAO,MAAM,WAAW,cAAmE,CAAC;AAC5F,eAAO,MAAM,SAAS,cAAuC,CAAC;AAC9D,eAAO,MAAM,SAAS,cAAoC,CAAC;AAC3D,eAAO,MAAM,YAAY,cAA6C,CAAC;AAEvE,4EAA4E;AAC5E,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,SAAS,GAAG,MAAM,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAS/F"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Where Ava's 3D models live: ~/.ava/creative/blender/<slug>/.
3
+ *
4
+ * Read at call time: tests point AVA_CREATIVE_DIR at a scratch folder so they
5
+ * never touch the real Library.
6
+ */
7
+ import { readFile, rm, writeFile } from 'node:fs/promises';
8
+ import { join } from 'node:path';
9
+ import { AVA_HOME } from '../../core/constants.js';
10
+ export const creativeDir = () => process.env.AVA_CREATIVE_DIR || join(AVA_HOME, 'creative');
11
+ export const modelsDir = () => join(creativeDir(), 'blender');
12
+ export const imagesDir = () => join(creativeDir(), 'gimp');
13
+ export const metadataFile = () => join(creativeDir(), 'metadata.json');
14
+ /** "Worn Supply Crate" → "worn-supply-crate". The folder and file names. */
15
+ export function modelSlug(name) {
16
+ return name.toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '').slice(0, 60);
17
+ }
18
+ /**
19
+ * Delete a piece of work: its whole folder, brief included, and its Library
20
+ * entry. The Library can only reach work that has been made, so a brief that
21
+ * was never built had no way out. Only ever called from the person's own
22
+ * Delete button, after they have confirmed it.
23
+ */
24
+ export async function deleteDesignWork(tool, slug) {
25
+ if (!slug || modelSlug(slug) !== slug)
26
+ return false;
27
+ await rm(join(tool === 'gimp' ? imagesDir() : modelsDir(), slug), { recursive: true, force: true });
28
+ try {
29
+ const items = JSON.parse(await readFile(metadataFile(), 'utf-8'));
30
+ const id = `${tool === 'gimp' ? 'gimp' : 'model'}_${slug}`;
31
+ if (Array.isArray(items))
32
+ await writeFile(metadataFile(), JSON.stringify(items.filter((i) => i?.id !== id), null, 2), 'utf-8');
33
+ }
34
+ catch { /* no index yet */ }
35
+ return true;
36
+ }
37
+ //# sourceMappingURL=paths.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"paths.js","sourceRoot":"","sources":["../../../src/tools/blender/paths.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAEnD,MAAM,CAAC,MAAM,WAAW,GAAG,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,gBAAgB,IAAI,IAAI,CAAC,QAAQ,EAAE,UAAU,CAAC,CAAC;AAC5F,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,SAAS,CAAC,CAAC;AAC9D,MAAM,CAAC,MAAM,SAAS,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,MAAM,CAAC,CAAC;AAC3D,MAAM,CAAC,MAAM,YAAY,GAA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