@1agh/maude 0.43.0 → 0.44.0
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/apps/studio/acp/bridge.ts +44 -10
- package/apps/studio/acp/env.ts +23 -0
- package/apps/studio/acp/login-state.ts +263 -0
- package/apps/studio/acp/plugin-bootstrap.ts +31 -25
- package/apps/studio/acp/probe.ts +152 -1
- package/apps/studio/annotations-layer.tsx +396 -46
- package/apps/studio/api.ts +395 -2
- package/apps/studio/bin/_audio-search.mjs +140 -0
- package/apps/studio/bin/_import-asset-pdf-worker.mjs +34 -0
- package/apps/studio/bin/_import-asset.mjs +815 -0
- package/apps/studio/bin/_import-brand.mjs +635 -0
- package/apps/studio/bin/_import-tokens-alias-resolver.mjs +95 -0
- package/apps/studio/bin/_import-tokens.mjs +1201 -0
- package/apps/studio/bin/_transcribe.mjs +419 -0
- package/apps/studio/bin/_transcribe.test.mjs +80 -0
- package/apps/studio/bin/audio-search.sh +28 -0
- package/apps/studio/bin/generate.sh +154 -0
- package/apps/studio/bin/import-asset.sh +34 -0
- package/apps/studio/bin/import-brand.sh +29 -0
- package/apps/studio/bin/import-tokens.sh +33 -0
- package/apps/studio/bin/photo-bg-remove.sh +119 -21
- package/apps/studio/bin/transcribe.sh +39 -0
- package/apps/studio/canvas-edit.ts +197 -2
- package/apps/studio/canvas-lib.tsx +115 -6
- package/apps/studio/client/app.jsx +1954 -685
- package/apps/studio/client/generate-dialog.jsx +352 -0
- package/apps/studio/client/github.js +14 -0
- package/apps/studio/client/inspector-controls.jsx +781 -0
- package/apps/studio/client/panels/BrandUploadPanel.jsx +233 -0
- package/apps/studio/client/panels/ChatPanel.jsx +15 -33
- package/apps/studio/client/panels/IntroVideoDialog.jsx +44 -0
- package/apps/studio/client/panels/OnboardingWizard.jsx +12 -0
- package/apps/studio/client/panels/ReadinessList.jsx +227 -7
- package/apps/studio/client/panels/SettingsPanel.jsx +828 -0
- package/apps/studio/client/panels/SetupChecklist.jsx +223 -0
- package/apps/studio/client/photo-knobs.jsx +167 -172
- package/apps/studio/client/styles/3-shell-maude.css +334 -28
- package/apps/studio/client/styles/4-components.css +223 -0
- package/apps/studio/client/styles/6-acp-chat.css +86 -0
- package/apps/studio/client/tour/quick-setup-tour.js +39 -0
- package/apps/studio/commands/annotation-strokes-command.ts +13 -3
- package/apps/studio/config.schema.json +70 -0
- package/apps/studio/context-menu.tsx +11 -2
- package/apps/studio/context.ts +16 -0
- package/apps/studio/design-setup-readiness.ts +115 -0
- package/apps/studio/dist/client.bundle.js +2097 -2088
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/draw/palette.ts +34 -0
- package/apps/studio/footage/schema.test.ts +92 -0
- package/apps/studio/footage/schema.ts +179 -1
- package/apps/studio/generation/adapters/elevenlabs.ts +370 -0
- package/apps/studio/generation/adapters/gemini.ts +542 -0
- package/apps/studio/generation/adapters/groq.test.ts +80 -0
- package/apps/studio/generation/adapters/groq.ts +247 -0
- package/apps/studio/generation/audio-library.test.ts +95 -0
- package/apps/studio/generation/audio-library.ts +156 -0
- package/apps/studio/generation/captions.test.ts +78 -0
- package/apps/studio/generation/captions.ts +132 -0
- package/apps/studio/generation/download.ts +76 -0
- package/apps/studio/generation/elevenlabs.test.ts +223 -0
- package/apps/studio/generation/gemini.test.ts +350 -0
- package/apps/studio/generation/jobs.test.ts +128 -0
- package/apps/studio/generation/jobs.ts +243 -0
- package/apps/studio/generation/keys.test.ts +75 -0
- package/apps/studio/generation/keys.ts +162 -0
- package/apps/studio/generation/prefs.test.ts +95 -0
- package/apps/studio/generation/prefs.ts +82 -0
- package/apps/studio/generation/registry.ts +88 -0
- package/apps/studio/generation/types.test.ts +123 -0
- package/apps/studio/generation/types.ts +266 -0
- package/apps/studio/generation/whisper-models.test.ts +152 -0
- package/apps/studio/generation/whisper-models.ts +257 -0
- package/apps/studio/generation/whisper-spike-results.md +61 -0
- package/apps/studio/git/service.ts +3 -1
- package/apps/studio/http.ts +867 -9
- package/apps/studio/media/intro.mp4 +0 -0
- package/apps/studio/media-commit-chain.ts +119 -0
- package/apps/studio/paths.ts +10 -0
- package/apps/studio/readiness.ts +108 -20
- package/apps/studio/scaffold-design.ts +1145 -0
- package/apps/studio/server.ts +13 -1
- package/apps/studio/test/_helpers.ts +15 -2
- package/apps/studio/test/acp-bridge.test.ts +34 -1
- package/apps/studio/test/acp-env.test.ts +30 -0
- package/apps/studio/test/acp-plugin-bootstrap.test.ts +23 -57
- package/apps/studio/test/acp-session-plugins.test.ts +72 -1
- package/apps/studio/test/annotation-strokes-command.test.ts +17 -0
- package/apps/studio/test/annotations-layer.test.ts +174 -0
- package/apps/studio/test/canvas-origin-gate.test.ts +37 -0
- package/apps/studio/test/csp-canvas-shell.test.ts +11 -0
- package/apps/studio/test/csrf-write-guard.test.ts +23 -1
- package/apps/studio/test/design-setup-readiness.test.ts +155 -0
- package/apps/studio/test/element-structural-edit.test.ts +108 -0
- package/apps/studio/test/fixtures/fake-claude-auth.mjs +13 -0
- package/apps/studio/test/generate-route.test.ts +106 -0
- package/apps/studio/test/import-asset-browser.test.ts +64 -0
- package/apps/studio/test/import-asset-route.test.ts +71 -0
- package/apps/studio/test/import-asset.test.ts +399 -0
- package/apps/studio/test/import-brand-browser.test.ts +88 -0
- package/apps/studio/test/import-brand-route.test.ts +120 -0
- package/apps/studio/test/import-brand.test.ts +206 -0
- package/apps/studio/test/import-tokens.test.ts +722 -0
- package/apps/studio/test/media-commit-chain.test.ts +210 -0
- package/apps/studio/test/photo-bg-remove-validation.test.ts +71 -0
- package/apps/studio/test/readiness.test.ts +13 -11
- package/apps/studio/test/scaffold-design.test.ts +122 -0
- package/apps/studio/test/tour-overlay.test.tsx +16 -0
- package/apps/studio/tool-palette.tsx +11 -6
- package/apps/studio/ui-prefs.ts +130 -0
- package/apps/studio/use-canvas-media-drop.tsx +4 -2
- package/apps/studio/use-chrome-visibility.tsx +8 -2
- package/apps/studio/whats-new.json +96 -0
- package/apps/studio/ws.ts +5 -0
- package/cli/bin/maude.mjs +6 -6
- package/cli/commands/design.mjs +33 -0
- package/cli/lib/gitignore-block.mjs +1 -0
- package/cli/lib/pkg-root.mjs +107 -0
- package/cli/lib/pkg-root.test.mjs +79 -0
- package/cli/lib/reconstruct-toolset.test.mjs +194 -0
- package/cli/lib/update-check.mjs +8 -0
- package/package.json +12 -10
- package/plugins/design/dependencies.json +18 -0
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
// _import-tokens-alias-resolver.mjs — DDR-172 Decision 2: whole-value-only
|
|
2
|
+
// alias resolution.
|
|
3
|
+
//
|
|
4
|
+
// PURE MODULE, NO I/O. This file must never import `fs`/`node:fs`,
|
|
5
|
+
// `net`/`node:net`, `http(s)`/`node:http(s)`, `dns`/`node:dns`,
|
|
6
|
+
// `child_process`/`node:child_process`, and must never reference the global
|
|
7
|
+
// `fetch`/`XMLHttpRequest` — apps/studio/test/import-tokens.test.ts asserts
|
|
8
|
+
// this by grepping this file's own source, not by trusting this comment
|
|
9
|
+
// (DDR-172's own lesson, quoting DDR-167: "policy prose alone is exactly the
|
|
10
|
+
// failure mode this codebase has already hit once"). This is what makes "the
|
|
11
|
+
// resolver never dereferences a path/URL" an ENFORCED invariant rather than
|
|
12
|
+
// an intention a later refactor (e.g. someone "helpfully" adding real
|
|
13
|
+
// `$ref`-file support) could silently violate.
|
|
14
|
+
//
|
|
15
|
+
// Only WHOLE-VALUE single-alias substitution is resolved — a value must,
|
|
16
|
+
// once trimmed, be ENTIRELY one `{group.token.path}` reference. A value that
|
|
17
|
+
// merely *contains* a `{...}` span alongside other text (`"{a} solid"`,
|
|
18
|
+
// `"{a} {b}"`) is NOT alias syntax at all here; it is returned unresolved, as
|
|
19
|
+
// literal text, so the caller's grammar validation rejects it (no grammar
|
|
20
|
+
// admits `{`/`}`). This gives each token AT MOST ONE outgoing alias edge,
|
|
21
|
+
// which structurally caps total resolution work at O(tokens × maxDepth)
|
|
22
|
+
// regardless of fan-out or a real Style-Dictionary "{a} {a}"-style
|
|
23
|
+
// multi-reference doubling bomb — neither a branching term nor a doubling
|
|
24
|
+
// term is reachable by construction, not merely bounded by a budget.
|
|
25
|
+
|
|
26
|
+
const WHOLE_VALUE_ALIAS_RE = /^\{([^{}]+)\}$/;
|
|
27
|
+
|
|
28
|
+
export class AliasResolutionError extends Error {
|
|
29
|
+
constructor(code, message) {
|
|
30
|
+
super(message);
|
|
31
|
+
this.code = code;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @param {Record<string, string>} tokens - `Object.create(null)` map of
|
|
37
|
+
* flattened token path -> raw (pre-alias) value. Non-string values are
|
|
38
|
+
* passed through unresolved (only strings can be whole-value aliases).
|
|
39
|
+
* @param {{ maxDepth?: number }} [opts]
|
|
40
|
+
* @returns {{ resolved: Record<string, unknown>, statuses: Record<string, string> }}
|
|
41
|
+
* `resolved[path]` is the alias-resolved literal for every token that
|
|
42
|
+
* resolved cleanly (including non-aliased passthroughs). `statuses[path]`
|
|
43
|
+
* is set ONLY for tokens that did NOT resolve — `'unresolved-alias'`,
|
|
44
|
+
* `'circular-alias'`, or `'alias-chain-too-deep'` — the caller reports
|
|
45
|
+
* these, never guesses a value for them.
|
|
46
|
+
*/
|
|
47
|
+
export function resolveAliases(tokens, { maxDepth = 16 } = {}) {
|
|
48
|
+
const resolved = Object.create(null);
|
|
49
|
+
const statuses = Object.create(null);
|
|
50
|
+
|
|
51
|
+
function resolveOne(path, chain) {
|
|
52
|
+
if (path in resolved) return resolved[path];
|
|
53
|
+
if (path in statuses) return undefined;
|
|
54
|
+
const raw = tokens[path];
|
|
55
|
+
if (typeof raw !== 'string') {
|
|
56
|
+
resolved[path] = raw;
|
|
57
|
+
return raw;
|
|
58
|
+
}
|
|
59
|
+
const m = WHOLE_VALUE_ALIAS_RE.exec(raw.trim());
|
|
60
|
+
if (!m) {
|
|
61
|
+
resolved[path] = raw;
|
|
62
|
+
return raw;
|
|
63
|
+
}
|
|
64
|
+
const targetPath = m[1].trim();
|
|
65
|
+
if (chain.has(targetPath) || targetPath === path) {
|
|
66
|
+
statuses[path] = 'circular-alias';
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
if (chain.size + 1 >= maxDepth) {
|
|
70
|
+
statuses[path] = 'alias-chain-too-deep';
|
|
71
|
+
return undefined;
|
|
72
|
+
}
|
|
73
|
+
if (!(targetPath in tokens)) {
|
|
74
|
+
statuses[path] = 'unresolved-alias';
|
|
75
|
+
return undefined;
|
|
76
|
+
}
|
|
77
|
+
const nextChain = new Set(chain);
|
|
78
|
+
nextChain.add(path);
|
|
79
|
+
const val = resolveOne(targetPath, nextChain);
|
|
80
|
+
if (val === undefined) {
|
|
81
|
+
// Target itself failed to resolve — propagate the SAME failure reason
|
|
82
|
+
// rather than inventing a new one, but only if this token doesn't
|
|
83
|
+
// already have its own status set.
|
|
84
|
+
if (!(path in statuses)) statuses[path] = statuses[targetPath] || 'unresolved-alias';
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
resolved[path] = val;
|
|
88
|
+
return val;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
for (const path of Object.keys(tokens)) {
|
|
92
|
+
if (!(path in resolved) && !(path in statuses)) resolveOne(path, new Set());
|
|
93
|
+
}
|
|
94
|
+
return { resolved, statuses };
|
|
95
|
+
}
|