@tacuchi/agent-workflow-cli 20.26.0 → 21.1.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/README.md +2 -1
- package/dist/adapters/node-file-system.js +3 -0
- package/dist/adapters/node-file-system.js.map +1 -1
- package/dist/application/capability/compose.js +161 -0
- package/dist/application/capability/compose.js.map +1 -0
- package/dist/application/capability/descriptor-loader.js +109 -0
- package/dist/application/capability/descriptor-loader.js.map +1 -0
- package/dist/application/capability/design-handler.js +299 -0
- package/dist/application/capability/design-handler.js.map +1 -0
- package/dist/application/capability/dispatcher.js +312 -0
- package/dist/application/capability/dispatcher.js.map +1 -0
- package/dist/application/capability/durable-effect.js +220 -0
- package/dist/application/capability/durable-effect.js.map +1 -0
- package/dist/application/capability/installed-inventory.js +168 -0
- package/dist/application/capability/installed-inventory.js.map +1 -0
- package/dist/application/capability/readiness.js +204 -0
- package/dist/application/capability/readiness.js.map +1 -0
- package/dist/application/capability/resolution.js +264 -0
- package/dist/application/capability/resolution.js.map +1 -0
- package/dist/application/capability/wrapper.js +187 -0
- package/dist/application/capability/wrapper.js.map +1 -0
- package/dist/application/context/manifest.js +11 -5
- package/dist/application/context/manifest.js.map +1 -1
- package/dist/application/context/measure.js +5 -2
- package/dist/application/context/measure.js.map +1 -1
- package/dist/application/context/plan-service.js +6 -6
- package/dist/application/context/plan-service.js.map +1 -1
- package/dist/application/design/design-bundle-service.js +148 -0
- package/dist/application/design/design-bundle-service.js.map +1 -0
- package/dist/application/design/design-gate-service.js +246 -0
- package/dist/application/design/design-gate-service.js.map +1 -0
- package/dist/application/design/design-graph-service.js +85 -0
- package/dist/application/design/design-graph-service.js.map +1 -0
- package/dist/application/design/design-index-service.js +132 -0
- package/dist/application/design/design-index-service.js.map +1 -0
- package/dist/application/design/design-proposal-service.js +69 -0
- package/dist/application/design/design-proposal-service.js.map +1 -0
- package/dist/application/design/design-publish-service.js +756 -0
- package/dist/application/design/design-publish-service.js.map +1 -0
- package/dist/application/design/design-record-service.js +100 -0
- package/dist/application/design/design-record-service.js.map +1 -0
- package/dist/application/design/design-resolver-service.js +165 -0
- package/dist/application/design/design-resolver-service.js.map +1 -0
- package/dist/application/flow/advance.js +533 -0
- package/dist/application/flow/advance.js.map +1 -0
- package/dist/application/flow/flow-service.js +65 -0
- package/dist/application/flow/flow-service.js.map +1 -0
- package/dist/application/flow/run-projection.js +80 -0
- package/dist/application/flow/run-projection.js.map +1 -0
- package/dist/application/flow/run-state-service.js +107 -0
- package/dist/application/flow/run-state-service.js.map +1 -0
- package/dist/application/flow/submit.js +423 -0
- package/dist/application/flow/submit.js.map +1 -0
- package/dist/application/resume-service.js +46 -14
- package/dist/application/resume-service.js.map +1 -1
- package/dist/application/self/install-skill.js +11 -0
- package/dist/application/self/install-skill.js.map +1 -1
- package/dist/application/self/uninstall.js +21 -0
- package/dist/application/self/uninstall.js.map +1 -1
- package/dist/application/semantic-operation/protocol.js +18 -12
- package/dist/application/semantic-operation/protocol.js.map +1 -1
- package/dist/application/semantic-operation/publish.js +56 -9
- package/dist/application/semantic-operation/publish.js.map +1 -1
- package/dist/application/skills-resolver-service.js +27 -6
- package/dist/application/skills-resolver-service.js.map +1 -1
- package/dist/application/status-service.js +5 -1
- package/dist/application/status-service.js.map +1 -1
- package/dist/application/workline-index-service.js +6 -0
- package/dist/application/workline-index-service.js.map +1 -1
- package/dist/application/workspace-init-service.js +22 -2
- package/dist/application/workspace-init-service.js.map +1 -1
- package/dist/cli/commands/capability.js +182 -0
- package/dist/cli/commands/capability.js.map +1 -0
- package/dist/cli/commands/designs.js +110 -0
- package/dist/cli/commands/designs.js.map +1 -0
- package/dist/cli/commands/flow.js +71 -0
- package/dist/cli/commands/flow.js.map +1 -0
- package/dist/cli/commands/index.js +6 -0
- package/dist/cli/commands/index.js.map +1 -1
- package/dist/cli/commands/resume.js +8 -0
- package/dist/cli/commands/resume.js.map +1 -1
- package/dist/cli/commands/skills.js +55 -2
- package/dist/cli/commands/skills.js.map +1 -1
- package/dist/cli/commands/status.js +50 -0
- package/dist/cli/commands/status.js.map +1 -1
- package/dist/cli/help-groups.js +9 -0
- package/dist/cli/help-groups.js.map +1 -1
- package/dist/cli/parser.js +7 -0
- package/dist/cli/parser.js.map +1 -1
- package/dist/cli/tui/data/workflow-content.js +5 -0
- package/dist/cli/tui/data/workflow-content.js.map +1 -1
- package/dist/cli/tui/tabs/workflow-tab.js +5 -1
- package/dist/cli/tui/tabs/workflow-tab.js.map +1 -1
- package/dist/domain/capability/descriptor.js +553 -0
- package/dist/domain/capability/descriptor.js.map +1 -0
- package/dist/domain/capability/effects.js +90 -0
- package/dist/domain/capability/effects.js.map +1 -0
- package/dist/domain/capability/protocol.js +494 -0
- package/dist/domain/capability/protocol.js.map +1 -0
- package/dist/domain/contract-reader.js +84 -0
- package/dist/domain/contract-reader.js.map +1 -0
- package/dist/domain/design/adapter.js +161 -0
- package/dist/domain/design/adapter.js.map +1 -0
- package/dist/domain/design/artifact-body.js +223 -0
- package/dist/domain/design/artifact-body.js.map +1 -0
- package/dist/domain/design/artifact.js +750 -0
- package/dist/domain/design/artifact.js.map +1 -0
- package/dist/domain/design/baseline.js +359 -0
- package/dist/domain/design/baseline.js.map +1 -0
- package/dist/domain/design/capability.js +310 -0
- package/dist/domain/design/capability.js.map +1 -0
- package/dist/domain/design/closure.js +161 -0
- package/dist/domain/design/closure.js.map +1 -0
- package/dist/domain/design/direct.js +108 -0
- package/dist/domain/design/direct.js.map +1 -0
- package/dist/domain/design/external-send.js +65 -0
- package/dist/domain/design/external-send.js.map +1 -0
- package/dist/domain/design/governance.js +298 -0
- package/dist/domain/design/governance.js.map +1 -0
- package/dist/domain/design/identity.js +145 -0
- package/dist/domain/design/identity.js.map +1 -0
- package/dist/domain/design/manifest.js +552 -0
- package/dist/domain/design/manifest.js.map +1 -0
- package/dist/domain/design/maturity.js +305 -0
- package/dist/domain/design/maturity.js.map +1 -0
- package/dist/domain/design/naming.js +117 -0
- package/dist/domain/design/naming.js.map +1 -0
- package/dist/domain/design/offline.js +92 -0
- package/dist/domain/design/offline.js.map +1 -0
- package/dist/domain/design/profiles.js +212 -0
- package/dist/domain/design/profiles.js.map +1 -0
- package/dist/domain/design/projections.js +165 -0
- package/dist/domain/design/projections.js.map +1 -0
- package/dist/domain/design/proposal.js +234 -0
- package/dist/domain/design/proposal.js.map +1 -0
- package/dist/domain/design/reference.js +234 -0
- package/dist/domain/design/reference.js.map +1 -0
- package/dist/domain/design/render-bundle.js +0 -0
- package/dist/domain/design/render-bundle.js.map +1 -0
- package/dist/domain/design/rendition.js +472 -0
- package/dist/domain/design/rendition.js.map +1 -0
- package/dist/domain/design/retired.js +61 -0
- package/dist/domain/design/retired.js.map +1 -0
- package/dist/domain/design/revision.js +219 -0
- package/dist/domain/design/revision.js.map +1 -0
- package/dist/domain/design/secrets.js +86 -0
- package/dist/domain/design/secrets.js.map +1 -0
- package/dist/domain/design/sources.js +180 -0
- package/dist/domain/design/sources.js.map +1 -0
- package/dist/domain/design/validation.js +19 -0
- package/dist/domain/design/validation.js.map +1 -0
- package/dist/domain/design/visual-evidence.js +155 -0
- package/dist/domain/design/visual-evidence.js.map +1 -0
- package/dist/domain/design/yaml-subset.js +390 -0
- package/dist/domain/design/yaml-subset.js.map +1 -0
- package/dist/domain/flow/answer.js +459 -0
- package/dist/domain/flow/answer.js.map +1 -0
- package/dist/domain/flow/authority.js +2276 -0
- package/dist/domain/flow/authority.js.map +1 -0
- package/dist/domain/flow/authorization.js +62 -0
- package/dist/domain/flow/authorization.js.map +1 -0
- package/dist/domain/flow/directive.js +421 -0
- package/dist/domain/flow/directive.js.map +1 -0
- package/dist/domain/flow/rules.js +140 -0
- package/dist/domain/flow/rules.js.map +1 -0
- package/dist/domain/flow/run-state.js +317 -0
- package/dist/domain/flow/run-state.js.map +1 -0
- package/dist/domain/harnesses.js +21 -0
- package/dist/domain/harnesses.js.map +1 -1
- package/dist/domain/safe-path.js +23 -0
- package/dist/domain/safe-path.js.map +1 -0
- package/dist/domain/skills.js +26 -3
- package/dist/domain/skills.js.map +1 -1
- package/package.json +1 -1
- package/skills/w/SKILL.md +15 -13
- package/skills/w/artifacts/README.md +3 -4
- package/skills/w/artifacts/artifacts-core/CHECKPOINT.md +2 -2
- package/skills/w/commands/plan-exec.md +11 -5
- package/skills/w/commands/plan-new.md +6 -2
- package/skills/w/commands/plan-refine.md +6 -3
- package/skills/w/commands/quick.md +2 -2
- package/skills/w/commands/spec-new.md +2 -2
- package/skills/w/commands/spec-refine.md +1 -0
- package/skills/w/context/MANIFEST.json +57 -9
- package/skills/w/harness/HARNESS.md +20 -0
- package/skills/w/loops/CHASSIS.md +11 -20
- package/skills/w/loops/CODE-POLICIES.md +18 -9
- package/skills/w/loops/README.md +1 -1
- package/skills/w/loops/plan-exec-loop/LOOP.md +126 -62
- package/skills/w/loops/plan-new-loop/LOOP.md +71 -73
- package/skills/w/loops/plan-refine-loop/LOOP.md +20 -10
- package/skills/w/loops/quick-loop/LOOP.md +18 -26
- package/skills/w/loops/spec-refine-loop/LOOP.md +28 -30
- package/skills/w/modules/COMPACTION.md +2 -6
- package/skills/w/modules/DB-SCRIPTS-ONLY.md +2 -0
- package/skills/w/modules/DESIGN-REFERENCES.md +113 -0
- package/skills/w/modules/IDEATION-GATE.md +3 -3
- package/skills/w/modules/PERSIST-ROUTING.md +1 -0
- package/skills/w/modules/PLAN-EXECUTION-BATCHES.md +65 -0
- package/skills/w/modules/PLAN-INPUT.md +5 -3
- package/skills/w/modules/PLAN-REFINE-SPLIT.md +3 -1
- package/skills/w/modules/PLAN-SPLIT-GATE.md +7 -5
- package/skills/w/modules/PROMPT-CONTINUITY.md +3 -1
- package/skills/w/modules/SPEC-CHANGE-SHAPE.md +4 -4
- package/skills/w/roles/README.md +9 -5
- package/skills/w/roles/design/CONTRACT.md +80 -0
- package/skills/w/roles/design/ROLE.md +224 -0
- package/skills/w/schemas/capability-descriptor.schema.json +260 -0
- package/skills/w/schemas/design/design-baseline.v1.schema.json +71 -0
- package/skills/w/schemas/design/design-manifest.v1.schema.json +322 -0
- package/skills/w/schemas/design/design-render-bundle.v1.schema.json +191 -0
- package/skills/w/schemas/design/design-rendition.v1.schema.json +232 -0
- package/skills/w/schemas/design/design-review.v1.schema.json +72 -0
- package/skills/w/schemas/design/design-revocation.v1.schema.json +54 -0
- package/skills/w/schemas/design/ui-flow.v1.schema.json +211 -0
- package/skills/w/schemas/design/ui-screen.v1.schema.json +242 -0
- package/skills/w/artifacts/artifacts-design/SPEC.md +0 -42
- package/skills/w/modules/PLAN-DESIGN-SPECS.md +0 -12
- package/skills/w/modules/PLAN-REFINE-DESIGN-SPECS.md +0 -7
- package/skills/w/roles/ui-spec/ROLE.md +0 -147
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import { ARTIFACT_PREFIX, isArtifactId } from "./identity.js";
|
|
2
|
+
import { NAMING, revisionSegment } from "./naming.js";
|
|
3
|
+
/**
|
|
4
|
+
* Changing published normative content.
|
|
5
|
+
*
|
|
6
|
+
* The rule has one shape: you never edit a published revision, you mint the
|
|
7
|
+
* next one. Everything else follows — the previous file keeps its name, every
|
|
8
|
+
* reference to it keeps resolving, and `supersedes` records the succession
|
|
9
|
+
* without rewriting what came before.
|
|
10
|
+
*
|
|
11
|
+
* This module answers the two questions that operation asks: *what is the next
|
|
12
|
+
* revision and where does it go*, and afterwards *did anything published
|
|
13
|
+
* disappear*. Writing the files is publication's job (F5); this is the arithmetic
|
|
14
|
+
* and the proof.
|
|
15
|
+
*/
|
|
16
|
+
/** Where each artifact kind is catalogued. One rule, one place. */
|
|
17
|
+
export const KIND_LIST = {
|
|
18
|
+
flow: "flows",
|
|
19
|
+
screen: "screens",
|
|
20
|
+
rule: "rules",
|
|
21
|
+
token: "tokens",
|
|
22
|
+
rendition: "renditions",
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* The next revision of `id`, or the first one when the artifact is new.
|
|
26
|
+
* `slug` only shapes the file name; identity never derives from it.
|
|
27
|
+
*/
|
|
28
|
+
export function planNextRevision(manifest, kind, id, slug, artifact) {
|
|
29
|
+
// The id shapes the PATH this function returns, so validating the cosmetic
|
|
30
|
+
// slug and not the identity would let `../../evil` out of here as a path.
|
|
31
|
+
if (!isArtifactId(id, kind)) {
|
|
32
|
+
return {
|
|
33
|
+
ok: false,
|
|
34
|
+
failure: {
|
|
35
|
+
code: "DESIGN_FIELD_INVALID",
|
|
36
|
+
artifact,
|
|
37
|
+
message: `'${id}' no es un id de ${kind}`,
|
|
38
|
+
action: `usá ${ARTIFACT_PREFIX[kind]}-NNN`,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
if (!/^[a-z0-9]+(-[a-z0-9]+)*$/.test(slug)) {
|
|
43
|
+
return {
|
|
44
|
+
ok: false,
|
|
45
|
+
failure: {
|
|
46
|
+
code: "DESIGN_FIELD_INVALID",
|
|
47
|
+
artifact,
|
|
48
|
+
message: `'${slug}' no es un slug: solo minúsculas, números y guiones`,
|
|
49
|
+
action: "usá algo como 'alta-miembro'",
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
const existing = manifest.catalog[KIND_LIST[kind]].filter((e) => e.id === id);
|
|
54
|
+
const highest = existing.reduce((max, e) => Math.max(max, e.revision), 0);
|
|
55
|
+
const revision = highest + 1;
|
|
56
|
+
const rule = NAMING[kind];
|
|
57
|
+
const path = `${rule.dir}/${id}-${revisionSegment(revision)}-${slug}${rule.suffix}`;
|
|
58
|
+
// No collision check here on purpose: `revision` is always max+1 and the
|
|
59
|
+
// revision is part of the path, so the new file CANNOT be one the catalog
|
|
60
|
+
// already holds. The impossibility is structural — an `if` would only be
|
|
61
|
+
// dead code pretending to be a safeguard.
|
|
62
|
+
return {
|
|
63
|
+
ok: true,
|
|
64
|
+
value: {
|
|
65
|
+
id,
|
|
66
|
+
revision,
|
|
67
|
+
path,
|
|
68
|
+
supersedes: highest === 0 ? null : `${manifest.id}/${id}@r${highest}`,
|
|
69
|
+
preserves: existing.map((e) => e.path).sort(),
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* What a publication lost, comparing the manifest before and after.
|
|
75
|
+
*
|
|
76
|
+
* A published revision may gain nothing and lose nothing: not its path, and —
|
|
77
|
+
* for a baseline — not its digest. Anything else means a reference somebody
|
|
78
|
+
* already wrote now resolves to different bytes, which is the one thing the
|
|
79
|
+
* whole revision model exists to prevent.
|
|
80
|
+
*/
|
|
81
|
+
export function findHistoryLoss(before, after) {
|
|
82
|
+
return [
|
|
83
|
+
...artifactLosses(before, after),
|
|
84
|
+
...baselineLosses(before, after),
|
|
85
|
+
...addressedLosses(before, after),
|
|
86
|
+
];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Assets and governance records are addressed by content and by id: an asset
|
|
90
|
+
* that leaves the catalog breaks whatever depended on that digest, and a review
|
|
91
|
+
* that changes its target changes what it approved.
|
|
92
|
+
*/
|
|
93
|
+
function artifactLosses(before, after) {
|
|
94
|
+
const losses = [];
|
|
95
|
+
const current = publishedArtifacts(after);
|
|
96
|
+
for (const [ref, entry] of publishedArtifacts(before)) {
|
|
97
|
+
const now = current.get(ref);
|
|
98
|
+
if (now === undefined) {
|
|
99
|
+
losses.push({ ref, kind: "removed", before: entry.path, after: null });
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
if (now.path !== entry.path) {
|
|
103
|
+
losses.push({ ref, kind: "moved", before: entry.path, after: now.path });
|
|
104
|
+
}
|
|
105
|
+
// Promoting a published revision in place is a mutation of what someone
|
|
106
|
+
// already pinned: `outline` and `handoff` mean different things to a gate,
|
|
107
|
+
// so the promotion is the NEXT revision, never an edit of this one.
|
|
108
|
+
for (const field of ["maturity", "supersedes"]) {
|
|
109
|
+
const was = entry[field] ?? null;
|
|
110
|
+
const is = now[field] ?? null;
|
|
111
|
+
if (was === is)
|
|
112
|
+
continue;
|
|
113
|
+
losses.push({
|
|
114
|
+
ref,
|
|
115
|
+
kind: "rewritten",
|
|
116
|
+
field,
|
|
117
|
+
before: String(was),
|
|
118
|
+
after: is === null ? null : String(is),
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
return losses;
|
|
123
|
+
}
|
|
124
|
+
function baselineLosses(before, after) {
|
|
125
|
+
const losses = [];
|
|
126
|
+
// Changing a package's identity orphans every reference ever written to it —
|
|
127
|
+
// the largest history loss there is, and the one nobody would think to look for.
|
|
128
|
+
if (before.id !== after.id) {
|
|
129
|
+
losses.push({
|
|
130
|
+
ref: before.id,
|
|
131
|
+
kind: "rewritten",
|
|
132
|
+
field: "id",
|
|
133
|
+
before: before.id,
|
|
134
|
+
after: after.id,
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
for (const baseline of before.baselines) {
|
|
138
|
+
const ref = `${before.id}@r${baseline.revision}`;
|
|
139
|
+
const now = after.baselines.find((b) => b.revision === baseline.revision);
|
|
140
|
+
if (now === undefined) {
|
|
141
|
+
losses.push({ ref, kind: "removed", before: baseline.path, after: null });
|
|
142
|
+
continue;
|
|
143
|
+
}
|
|
144
|
+
if (now.path !== baseline.path) {
|
|
145
|
+
losses.push({ ref, kind: "moved", before: baseline.path, after: now.path });
|
|
146
|
+
}
|
|
147
|
+
if (now.digest !== baseline.digest) {
|
|
148
|
+
losses.push({ ref, kind: "rewritten", before: baseline.digest, after: now.digest });
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
return losses;
|
|
152
|
+
}
|
|
153
|
+
function addressedLosses(before, after) {
|
|
154
|
+
return [...assetLosses(before, after), ...governanceLosses(before, after)];
|
|
155
|
+
}
|
|
156
|
+
/** An asset that leaves the catalog breaks whatever depended on that digest. */
|
|
157
|
+
function assetLosses(before, after) {
|
|
158
|
+
const losses = [];
|
|
159
|
+
for (const asset of before.catalog.assets) {
|
|
160
|
+
const now = after.catalog.assets.find((a) => a.digest === asset.digest);
|
|
161
|
+
if (now === undefined) {
|
|
162
|
+
losses.push({ ref: asset.digest, kind: "removed", before: asset.path, after: null });
|
|
163
|
+
}
|
|
164
|
+
else if (now.path !== asset.path) {
|
|
165
|
+
losses.push({ ref: asset.digest, kind: "moved", before: asset.path, after: now.path });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return losses;
|
|
169
|
+
}
|
|
170
|
+
/** A review that changes its target changes what it approved. */
|
|
171
|
+
function governanceLosses(before, after) {
|
|
172
|
+
const losses = [];
|
|
173
|
+
for (const key of ["reviews", "revocations"]) {
|
|
174
|
+
for (const record of before.governance[key]) {
|
|
175
|
+
const now = after.governance[key].find((g) => g.id === record.id);
|
|
176
|
+
if (now === undefined) {
|
|
177
|
+
losses.push({ ref: record.id, kind: "removed", before: record.path, after: null });
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
for (const field of ["digest", "target"]) {
|
|
181
|
+
if (now[field] === record[field])
|
|
182
|
+
continue;
|
|
183
|
+
losses.push({
|
|
184
|
+
ref: record.id,
|
|
185
|
+
kind: "rewritten",
|
|
186
|
+
field,
|
|
187
|
+
before: record[field],
|
|
188
|
+
after: now[field],
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
return losses;
|
|
194
|
+
}
|
|
195
|
+
/** Turn a loss into the diagnostic a publication should refuse with. */
|
|
196
|
+
export function historyLossFailure(loss, artifact) {
|
|
197
|
+
const what = loss.field ?? "digest";
|
|
198
|
+
const message = {
|
|
199
|
+
removed: `${loss.ref} estaba publicada y ya no está en el catálogo`,
|
|
200
|
+
moved: `${loss.ref} cambió de path: '${loss.before}' → '${loss.after}'`,
|
|
201
|
+
rewritten: `${loss.ref} cambió de ${what}: '${loss.before}' → '${String(loss.after)}'`,
|
|
202
|
+
}[loss.kind];
|
|
203
|
+
return {
|
|
204
|
+
code: "DESIGN_HISTORY_MUTATED",
|
|
205
|
+
artifact,
|
|
206
|
+
message,
|
|
207
|
+
action: "una revisión publicada no se toca: creá la siguiente y dejá la anterior como está",
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
function publishedArtifacts(manifest) {
|
|
211
|
+
const out = new Map();
|
|
212
|
+
for (const key of Object.values(KIND_LIST)) {
|
|
213
|
+
for (const entry of manifest.catalog[key]) {
|
|
214
|
+
out.set(`${manifest.id}/${entry.id}@r${entry.revision}`, entry);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
return out;
|
|
218
|
+
}
|
|
219
|
+
//# sourceMappingURL=revision.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"revision.js","sourceRoot":"","sources":["../../../src/domain/design/revision.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAkB,eAAe,EAAE,MAAM,aAAa,CAAC;AAGtE;;;;;;;;;;;;GAYG;AAEH,mEAAmE;AACnE,MAAM,CAAC,MAAM,SAAS,GAA2C;IAC/D,IAAI,EAAE,OAAO;IACb,MAAM,EAAE,SAAS;IACjB,IAAI,EAAE,OAAO;IACb,KAAK,EAAE,QAAQ;IACf,SAAS,EAAE,YAAY;CACxB,CAAC;AAiBF;;;GAGG;AACH,MAAM,UAAU,gBAAgB,CAC9B,QAAwB,EACxB,IAAe,EACf,EAAU,EACV,IAAY,EACZ,QAAgB;IAEhB,2EAA2E;IAC3E,0EAA0E;IAC1E,IAAI,CAAC,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,EAAE,CAAC;QAC5B,OAAO;YACL,EAAE,EAAE,KAAK;YACT,OAAO,EAAE;gBACP,IAAI,EAAE,sBAAsB;gBAC5B,QAAQ;gBACR,OAAO,EAAE,IAAI,EAAE,oBAAoB,IAAI,EAAE;gBACzC,MAAM,EAAE,OAAO,eAAe,CAAC,IAAI,CAAC,MAAM;aAC3C;SACF,CAAC;IACJ,CAAC;IACD,IAAI,CAAC,0BAA0B,CAAC,IAA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|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Credentials never enter a package.
|
|
3
|
+
*
|
|
4
|
+
* A package records an ACCESS CLASSIFICATION — `private`, `team`, `public` —
|
|
5
|
+
* and never the thing that grants access. The distinction matters because a
|
|
6
|
+
* package is a durable, committed, shareable dossier: a token that lands in one
|
|
7
|
+
* is a token in every clone of the repo, forever, and rotating it does not
|
|
8
|
+
* remove it from history.
|
|
9
|
+
*
|
|
10
|
+
* The repo's `code-scan-service` greps source trees with regexes; this walks an
|
|
11
|
+
* already-parsed document instead, which is a different shape — the values are
|
|
12
|
+
* structured, so the key is as much a signal as the value.
|
|
13
|
+
*/
|
|
14
|
+
/** Keys that hold a secret by definition. Their presence is the finding. */
|
|
15
|
+
const SECRET_KEYS = /^(password|passwd|pwd|secret|client_secret|token|access_token|refresh_token|id_token|api_?key|apikey|private_?key|secret_?key|access_?key|credential|credentials|auth_?token|bearer|session_?id|cookie)$/i;
|
|
16
|
+
/** Shapes that are a credential wherever they appear, whatever the key. */
|
|
17
|
+
const SECRET_VALUES = [
|
|
18
|
+
{ test: /-----BEGIN [A-Z ]*PRIVATE KEY-----/, what: "una clave privada PEM" },
|
|
19
|
+
{ test: /\bgh[pousr]_[A-Za-z0-9]{16,}\b/, what: "un token de GitHub" },
|
|
20
|
+
{ test: /\bgithub_pat_[A-Za-z0-9_]{20,}\b/, what: "un token de GitHub" },
|
|
21
|
+
{ test: /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/, what: "un token de Slack" },
|
|
22
|
+
{ test: /\bAKIA[0-9A-Z]{16}\b/, what: "una access key de AWS" },
|
|
23
|
+
{ test: /\bsk-[A-Za-z0-9]{20,}\b/, what: "una API key" },
|
|
24
|
+
// Los proveedores que la spec declara obligatorios para v1 tienen su propio
|
|
25
|
+
// prefijo, y no reconocerlos dejaba a AC-SEC-02 sin cubrir justo donde importa.
|
|
26
|
+
{ test: /\bfigd_[A-Za-z0-9_-]{20,}\b/, what: "un token de Figma" },
|
|
27
|
+
{ test: /\bfigu_[A-Za-z0-9_-]{20,}\b/, what: "un token de Figma" },
|
|
28
|
+
{ test: /\bAIza[0-9A-Za-z_-]{35}\b/, what: "una API key de Google" },
|
|
29
|
+
{ test: /\bya29\.[0-9A-Za-z_-]{20,}\b/, what: "un token OAuth de Google" },
|
|
30
|
+
{ test: /\bsk-ant-[A-Za-z0-9_-]{20,}\b/, what: "una API key de Anthropic" },
|
|
31
|
+
{ test: /\beyJ[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}\.[A-Za-z0-9_-]{10,}/, what: "un JWT" },
|
|
32
|
+
{ test: /\b(?:Bearer|Basic)\s+[A-Za-z0-9._~+/=-]{16,}/, what: "un header de autorización" },
|
|
33
|
+
// `https://user:password@host` — the one credential form that hides in a URL.
|
|
34
|
+
{
|
|
35
|
+
test: /\b[a-z][a-z0-9+.-]*:\/\/[^/\s:@]+:[^/\s@]+@/i,
|
|
36
|
+
what: "una URL con usuario y contraseña",
|
|
37
|
+
},
|
|
38
|
+
];
|
|
39
|
+
/**
|
|
40
|
+
* Walk a parsed document for credentials. Returns every finding: a document
|
|
41
|
+
* with two leaked tokens should report two, not stop at the first.
|
|
42
|
+
*/
|
|
43
|
+
export function findSecrets(document, at = "") {
|
|
44
|
+
if (typeof document === "string") {
|
|
45
|
+
const shape = SECRET_VALUES.find((s) => s.test.test(document));
|
|
46
|
+
return shape === undefined ? [] : [{ at, what: shape.what }];
|
|
47
|
+
}
|
|
48
|
+
if (Array.isArray(document)) {
|
|
49
|
+
return document.flatMap((v, i) => findSecrets(v, `${at}[${i}]`));
|
|
50
|
+
}
|
|
51
|
+
if (typeof document !== "object" || document === null)
|
|
52
|
+
return [];
|
|
53
|
+
const findings = [];
|
|
54
|
+
for (const [key, value] of Object.entries(document)) {
|
|
55
|
+
const path = at.length === 0 ? key : `${at}.${key}`;
|
|
56
|
+
// A key named `token` with ANY content is the finding — there is no value of
|
|
57
|
+
// that field a package may carry, and wrapping it in an object
|
|
58
|
+
// (`token: { value: … }`) does not make it a different field.
|
|
59
|
+
if (SECRET_KEYS.test(key) && !isEmpty(value)) {
|
|
60
|
+
findings.push({ at: path, what: `un campo '${key}'` });
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
findings.push(...findSecrets(value, path));
|
|
64
|
+
}
|
|
65
|
+
return findings;
|
|
66
|
+
}
|
|
67
|
+
export function secretFailures(document, artifact) {
|
|
68
|
+
return findSecrets(document).map((finding) => ({
|
|
69
|
+
code: "DESIGN_SECRET_PRESENT",
|
|
70
|
+
artifact,
|
|
71
|
+
message: `'${finding.at}' parece contener ${finding.what}`,
|
|
72
|
+
action: "un package registra la CLASIFICACIÓN de acceso, nunca la credencial: quitala y rotala, ya está en el historial de git",
|
|
73
|
+
}));
|
|
74
|
+
}
|
|
75
|
+
function isEmpty(value) {
|
|
76
|
+
if (value === null || value === undefined)
|
|
77
|
+
return true;
|
|
78
|
+
if (typeof value === "string")
|
|
79
|
+
return value.trim().length === 0;
|
|
80
|
+
if (Array.isArray(value))
|
|
81
|
+
return value.length === 0;
|
|
82
|
+
if (typeof value === "object")
|
|
83
|
+
return Object.keys(value).length === 0;
|
|
84
|
+
return false;
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=secrets.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"secrets.js","sourceRoot":"","sources":["../../../src/domain/design/secrets.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;GAYG;AAEH,4EAA4E;AAC5E,MAAM,WAAW,GACf,2MAA2M,CAAC;AAE9M,2EAA2E;AAC3E,MAAM,aAAa,GAA0C;IAC3D,EAAE,IAAI,EAAE,oCAAoC,EAAE,IAAI,EAAE,uBAAuB,EAAE;IAC7E,EAAE,IAAI,EAAE,gCAAgC,EAAE,IAAI,EAAE,oBAAoB,EAAE;IACtE,EAAE,IAAI,EAAE,kCAAkC,EAAE,IAAI,EAAE,oBAAoB,EAAE;IACxE,EAAE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uH;KAC1H,CAAC,CAAC,CAAC;AACN,CAAC;AAED,SAAS,OAAO,CAAC,KAAc;IAC7B,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS;QAAE,OAAO,IAAI,CAAC;IACvD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,CAAC;IAChE,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC;IACpD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,MAAM,CAAC,IAAI,CAAC,KAAe,CAAC,CAAC,MAAM,KAAK,CAAC,CAAC;IAChF,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `design` accepts as a source, and what happens to each one.
|
|
3
|
+
*
|
|
4
|
+
* The envelope already carries WHICH inputs an invocation declared and where
|
|
5
|
+
* they came from — that is the capability contract's job, and it is not redone
|
|
6
|
+
* here. What this module owns is the design domain's half: which KINDS of
|
|
7
|
+
* source v1 can actually read, what a reading produced, and what it costs when
|
|
8
|
+
* one of them could not be read.
|
|
9
|
+
*
|
|
10
|
+
* The disposition vocabulary is five values because the four ways a source can
|
|
11
|
+
* fail to contribute are not the same problem for whoever has to fix it:
|
|
12
|
+
* `skipped` is a decision, `unsupported` is a format nobody promised,
|
|
13
|
+
* `unavailable` is something that should have been there and was not, and
|
|
14
|
+
* `redacted` is a deliberate withholding. Collapsing them into "not used" would
|
|
15
|
+
* make the receipt say four different things with one word.
|
|
16
|
+
*
|
|
17
|
+
* The consequence is fail-closed on purpose: a source that did not contribute
|
|
18
|
+
* blocks `handoff` unless someone states, in writing, why the design does not
|
|
19
|
+
* need it. A design that silently dropped a requirements document and still
|
|
20
|
+
* declared itself ready for implementation is precisely the failure the
|
|
21
|
+
* provenance exists to prevent.
|
|
22
|
+
*/
|
|
23
|
+
/**
|
|
24
|
+
* The v1 source catalog. Binary documents are read by the HOST's multimodal
|
|
25
|
+
* capability — the CLI ships no PDF, DOCX or PPTX parser — so what this list
|
|
26
|
+
* declares is what the domain KNOWS HOW TO ACCOUNT FOR, not what the CLI can
|
|
27
|
+
* decode by itself.
|
|
28
|
+
*/
|
|
29
|
+
export const DESIGN_SOURCE_KINDS = [
|
|
30
|
+
"markdown",
|
|
31
|
+
"image",
|
|
32
|
+
"pdf",
|
|
33
|
+
"docx",
|
|
34
|
+
"pptx",
|
|
35
|
+
/** Conversation or attachments the host exposed, passed in explicitly. */
|
|
36
|
+
"host_context",
|
|
37
|
+
/** An existing UI Design Package, by identity. */
|
|
38
|
+
"package",
|
|
39
|
+
/** A provider reference (`file_key`, `project_id`, an artifact id…). */
|
|
40
|
+
"provider_locator",
|
|
41
|
+
];
|
|
42
|
+
export const SOURCE_DISPOSITIONS = [
|
|
43
|
+
/** Read, and its content reached the design. */
|
|
44
|
+
"used",
|
|
45
|
+
/** Deliberately not read. A decision, and it carries its reason. */
|
|
46
|
+
"skipped",
|
|
47
|
+
/** A format v1 does not accept — including every retired UI format. */
|
|
48
|
+
"unsupported",
|
|
49
|
+
/** It should have been readable and was not: missing, corrupt, unreachable. */
|
|
50
|
+
"unavailable",
|
|
51
|
+
/** Withheld on purpose: sensitive, and the invocation did not authorize it. */
|
|
52
|
+
"redacted",
|
|
53
|
+
];
|
|
54
|
+
/** Extension → kind, for the locators that carry one. */
|
|
55
|
+
const BY_EXTENSION = new Map([
|
|
56
|
+
["md", "markdown"],
|
|
57
|
+
["markdown", "markdown"],
|
|
58
|
+
["txt", "markdown"],
|
|
59
|
+
["png", "image"],
|
|
60
|
+
["jpg", "image"],
|
|
61
|
+
["jpeg", "image"],
|
|
62
|
+
["webp", "image"],
|
|
63
|
+
["gif", "image"],
|
|
64
|
+
["svg", "image"],
|
|
65
|
+
["pdf", "pdf"],
|
|
66
|
+
["docx", "docx"],
|
|
67
|
+
["pptx", "pptx"],
|
|
68
|
+
]);
|
|
69
|
+
/**
|
|
70
|
+
* Classify a locator by what it looks like. Returns null when nothing in the
|
|
71
|
+
* catalog matches — which the caller reports as `unsupported`, never as a guess.
|
|
72
|
+
*/
|
|
73
|
+
export function classifySource(locator) {
|
|
74
|
+
const trimmed = locator.trim();
|
|
75
|
+
if (trimmed.length === 0)
|
|
76
|
+
return null;
|
|
77
|
+
if (/^DES-(?:[0-9]{3}|[1-9][0-9]{3,})(?:@r[1-9][0-9]{0,5})?$/.test(trimmed))
|
|
78
|
+
return "package";
|
|
79
|
+
if (/^[a-z][a-z0-9+.-]*:\/\//.test(trimmed))
|
|
80
|
+
return "provider_locator";
|
|
81
|
+
const extension = trimmed.split(".").pop()?.toLowerCase() ?? "";
|
|
82
|
+
return BY_EXTENSION.get(extension) ?? null;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Judge a set of sources: shape first, then consequence.
|
|
86
|
+
*
|
|
87
|
+
* A malformed record is a failure of the caller, not of the design — a source
|
|
88
|
+
* that says it was skipped and does not say why cannot be reported at all, so
|
|
89
|
+
* it is refused here rather than reaching a receipt that would read as if
|
|
90
|
+
* nothing had been dropped.
|
|
91
|
+
*/
|
|
92
|
+
export function reportSources(sources, artifact) {
|
|
93
|
+
const failures = [];
|
|
94
|
+
for (const source of sources) {
|
|
95
|
+
if (source.disposition !== "used" && (source.reason ?? "").trim().length === 0) {
|
|
96
|
+
failures.push({
|
|
97
|
+
code: "DESIGN_SOURCE_WITHOUT_REASON",
|
|
98
|
+
artifact,
|
|
99
|
+
message: `la fuente '${source.name}' quedó '${source.disposition}' y no dice por qué`,
|
|
100
|
+
action: "declará la causa: una fuente descartada en silencio es una decisión invisible",
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
if (!source.essential && (source.reason ?? "").trim().length === 0) {
|
|
104
|
+
failures.push({
|
|
105
|
+
code: "DESIGN_SOURCE_OPTIONAL_WITHOUT_REASON",
|
|
106
|
+
artifact,
|
|
107
|
+
message: `la fuente '${source.name}' se declara no esencial sin justificarlo`,
|
|
108
|
+
action: "explicá por qué el diseño se sostiene sin ella, o dejala como esencial",
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const omitted = sources.filter((s) => s.disposition !== "used");
|
|
113
|
+
return {
|
|
114
|
+
sources: [...sources],
|
|
115
|
+
omitted,
|
|
116
|
+
blocksHandoff: omitted.some((s) => s.essential),
|
|
117
|
+
failures,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* The gap an omission leaves behind.
|
|
122
|
+
*
|
|
123
|
+
* Actionable on purpose: it names the source, its disposition and its reason,
|
|
124
|
+
* so the person reading the receipt knows what to go get rather than that
|
|
125
|
+
* "something" was missing.
|
|
126
|
+
*/
|
|
127
|
+
export function handoffGapsFrom(report) {
|
|
128
|
+
return report.omitted
|
|
129
|
+
.filter((s) => s.essential)
|
|
130
|
+
.map((s) =>
|
|
131
|
+
// The LOCATOR, not just the input name: several sources arrive under one
|
|
132
|
+
// declared input, so "the essential source 'sources' is missing" tells
|
|
133
|
+
// nobody which file to go and get.
|
|
134
|
+
`la fuente esencial '${s.locator}' (${s.kind}, input '${s.name}') quedó '${s.disposition}': ${s.reason ?? "sin causa"} — conseguila o declarala no esencial con su razón`);
|
|
135
|
+
}
|
|
136
|
+
export function planOriginalCopy(sources, request, artifact) {
|
|
137
|
+
const byName = new Map(sources.map((s) => [s.name, s]));
|
|
138
|
+
const copy = [];
|
|
139
|
+
for (const name of request.approved) {
|
|
140
|
+
const source = byName.get(name);
|
|
141
|
+
if (source === undefined) {
|
|
142
|
+
return {
|
|
143
|
+
ok: false,
|
|
144
|
+
failure: {
|
|
145
|
+
code: "DESIGN_SOURCE_COPY_UNKNOWN",
|
|
146
|
+
artifact,
|
|
147
|
+
message: `se autorizó copiar '${name}' y no hay ninguna fuente con ese nombre`,
|
|
148
|
+
action: `nombrá una de: ${[...byName.keys()].join(", ") || "(ninguna)"}`,
|
|
149
|
+
},
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
// Copying a source the run never managed to read would put a file in the
|
|
153
|
+
// package that nothing in the design derives from.
|
|
154
|
+
if (source.disposition !== "used") {
|
|
155
|
+
return {
|
|
156
|
+
ok: false,
|
|
157
|
+
failure: {
|
|
158
|
+
code: "DESIGN_SOURCE_COPY_UNUSED",
|
|
159
|
+
artifact,
|
|
160
|
+
message: `'${name}' quedó '${source.disposition}' y no se copia al package`,
|
|
161
|
+
action: "copiá solo fuentes que el diseño usó de verdad",
|
|
162
|
+
},
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
if (source.sensitivity === "sensitive") {
|
|
166
|
+
return {
|
|
167
|
+
ok: false,
|
|
168
|
+
failure: {
|
|
169
|
+
code: "DESIGN_SOURCE_COPY_SENSITIVE",
|
|
170
|
+
artifact,
|
|
171
|
+
message: `'${name}' está clasificada sensible: no entra al package`,
|
|
172
|
+
action: "desclasificala explícitamente o dejá solo su proveniencia",
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
copy.push(source);
|
|
177
|
+
}
|
|
178
|
+
return { ok: true, copy };
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=sources.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sources.js","sourceRoot":"","sources":["../../../src/domain/design/sources.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,UAAU;IACV,OAAO;IACP,KAAK;IACL,MAAM;IACN,MAAM;IACN,0EAA0E;IAC1E,cAAc;IACd,kDAAkD;IAClD,SAAS;IACT,wEAAwE;IACxE,kBAAkB;CACV,CAAC;AAIX,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,gDAAgD;IAChD,MAAM;IACN,oEAAoE;IACpE,SAAS;IACT,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C;QACD,IAAI,MAAM,CAAC,WAAW,KAAK,WAAW,EAAE,CAAC;YACvC,OAAO;gBACL,EAAE,EAAE,KAAK;gBACT,OAAO,EAAE;oBACP,IAAI,EAAE,8BAA8B;oBACpC,QAAQ;oBACR,OAAO,EAAE,IAAI,IAAI,kDAAkD;oBACnE,MAAM,EAAE,2DAA2D;iBACpE;aACF,CAAC;QACJ,CAAC;QACD,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACpB,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The design side of the shared contract machinery.
|
|
3
|
+
*
|
|
4
|
+
* The reader, the closed-object rule and the coverage tracking are generic and
|
|
5
|
+
* live in `../contract-reader.js`; what is design-specific is the failure CODE
|
|
6
|
+
* prefix every diagnostic carries (`DESIGN_FIELD_INVALID`, `DESIGN_KEY_UNKNOWN`).
|
|
7
|
+
* Binding it once here is what lets every design validator keep importing
|
|
8
|
+
* `Reader` from this module unchanged while the capability descriptor — which
|
|
9
|
+
* must not depend on `domain/design` — builds on the same machinery under its
|
|
10
|
+
* own prefix.
|
|
11
|
+
*/
|
|
12
|
+
import { ContractReader } from "../contract-reader.js";
|
|
13
|
+
export { eachRecord, isNonEmptyString, isRecord } from "../contract-reader.js";
|
|
14
|
+
export class Reader extends ContractReader {
|
|
15
|
+
constructor(allowedKeys) {
|
|
16
|
+
super("DESIGN", allowedKeys);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../../src/domain/design/validation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAIvD,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI/E,MAAM,OAAO,MAAO,SAAQ,cAAc;IACxC,YAAY,WAAwB;QAClC,KAAK,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IAC/B,CAAC;CACF"}
|