project-tiny-context-harness 0.8.13 → 0.8.17
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 +53 -28
- package/assets/README.md +52 -25
- package/assets/README.zh-CN.md +55 -26
- package/assets/agents/AGENTS_CORE.md +2 -2
- package/assets/agents/long-task-implementation.toml +1 -1
- package/assets/context_templates/screen-contract.md +16 -0
- package/assets/skills/context_development_engineer/SKILL.md +16 -30
- package/assets/skills/context_development_engineer/references/engineering-design-reasoning.md +93 -0
- package/assets/skills/context_surface_contract/SKILL.md +13 -2
- package/assets/skills/context_uiux_design/SKILL.md +7 -3
- package/assets/skills/context_uiux_design/references/task-uiux-analysis.md +82 -0
- package/assets/skills/design-resource-authoring/SKILL.md +14 -8
- package/assets/skills/design-resource-authoring/references/downstream-handoff.md +18 -6
- package/assets/skills/design-resource-authoring/references/formal-selected-web-app-handoff.md +26 -8
- package/assets/skills/design-resource-authoring/references/implementation-feasibility.md +111 -0
- package/assets/skills/design-resource-authoring/references/open-design-provider.md +45 -7
- package/assets/skills/design-resource-authoring/references/recovery-and-writeback.md +7 -1
- package/assets/skills/design-resource-authoring/references/resource-selection.md +115 -3
- package/assets/skills/long-task-workflow/SKILL.md +9 -7
- package/assets/skills/long-task-workflow/agents/openai.yaml +1 -1
- package/assets/skills/long-task-workflow/references/authority-lifecycle.md +1 -1
- package/dist/commands/design-resource.js +9 -2
- package/dist/commands/long-task-revision.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/lib/design-resource-handoff-bundle.js +5 -0
- package/dist/lib/design-resource-handoff-input-types.d.ts +1 -1
- package/dist/lib/design-resource-handoff-manifest-projection.js +1 -0
- package/dist/lib/design-resource-handoff-set-integrity.js +1 -0
- package/dist/lib/design-resource-handoff-shape.js +6 -2
- package/dist/lib/design-resource-handoff-types.d.ts +5 -0
- package/dist/lib/design-resource-handoff-validation.js +12 -0
- package/dist/lib/design-resource-implementation-feasibility-model.d.ts +35 -0
- package/dist/lib/design-resource-implementation-feasibility-model.js +62 -0
- package/dist/lib/design-resource-implementation-feasibility-shape-sections.d.ts +43 -0
- package/dist/lib/design-resource-implementation-feasibility-shape-sections.js +142 -0
- package/dist/lib/design-resource-implementation-feasibility-shape.d.ts +4 -0
- package/dist/lib/design-resource-implementation-feasibility-shape.js +154 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision-projection.d.ts +24 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision-projection.js +106 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision.d.ts +21 -0
- package/dist/lib/design-resource-implementation-feasibility-source-decision.js +75 -0
- package/dist/lib/design-resource-implementation-feasibility-types.d.ts +135 -0
- package/dist/lib/design-resource-implementation-feasibility-types.js +37 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-cells.d.ts +5 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-cells.js +125 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-document.d.ts +4 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-document.js +167 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-facts.d.ts +3 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-facts.js +76 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-realizations.d.ts +8 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-realizations.js +76 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-support.d.ts +10 -0
- package/dist/lib/design-resource-implementation-feasibility-validation-support.js +75 -0
- package/dist/lib/design-resource-implementation-feasibility-validation.d.ts +3 -0
- package/dist/lib/design-resource-implementation-feasibility-validation.js +138 -0
- package/dist/lib/design-resource-symbolic-fact-shape.js +3 -1
- package/dist/lib/design-resource-symbolic-fact-types.d.ts +5 -0
- package/dist/lib/design-resource-symbolic-fact-validation.js +13 -0
- package/dist/lib/long-task-activation-validation.js +77 -7
- package/dist/lib/long-task-authority-revision-brief.js +3 -1
- package/dist/lib/long-task-authority-revision-summary.js +6 -2
- package/dist/lib/long-task-authority-revision-types.d.ts +2 -0
- package/dist/lib/long-task-check-runner.js +3 -296
- package/dist/lib/long-task-command-process.d.ts +9 -0
- package/dist/lib/long-task-command-process.js +175 -0
- package/dist/lib/long-task-delivery-validation.d.ts +5 -2
- package/dist/lib/long-task-delivery-validation.js +4 -4
- package/dist/lib/long-task-design-feasibility-binding-owners.d.ts +6 -0
- package/dist/lib/long-task-design-feasibility-binding-owners.js +52 -0
- package/dist/lib/long-task-design-feasibility-binding.d.ts +13 -0
- package/dist/lib/long-task-design-feasibility-binding.js +114 -0
- package/dist/lib/long-task-design-feasibility-source-closure.d.ts +11 -0
- package/dist/lib/long-task-design-feasibility-source-closure.js +78 -0
- package/dist/lib/long-task-design-resource-handoff.d.ts +3 -3
- package/dist/lib/long-task-design-resource-handoff.js +39 -3
- package/dist/lib/long-task-design-resource-method-binding.js +16 -4
- package/dist/lib/long-task-freshness.js +1 -1
- package/dist/lib/long-task-git.d.ts +26 -0
- package/dist/lib/long-task-git.js +130 -0
- package/dist/lib/long-task-paths.js +1 -1
- package/dist/lib/long-task-process-runtime-closure.js +74 -42
- package/dist/lib/long-task-process-table.d.ts +12 -0
- package/dist/lib/long-task-process-table.js +119 -0
- package/dist/lib/long-task-process-tree.d.ts +9 -0
- package/dist/lib/long-task-process-tree.js +138 -0
- package/dist/lib/long-task-protected-files.d.ts +1 -1
- package/dist/lib/long-task-protected-files.js +1 -1
- package/dist/lib/long-task-ui-surface-policy.d.ts +2 -1
- package/dist/lib/long-task-ui-surface-policy.js +7 -4
- package/dist/lib/long-task-ui-surface-validation.d.ts +3 -1
- package/dist/lib/long-task-ui-surface-validation.js +2 -2
- package/dist/lib/long-task-verifier-authority.js +2 -0
- package/dist/lib/long-task-workspace-manifest.d.ts +8 -0
- package/dist/lib/long-task-workspace-manifest.js +173 -0
- package/dist/lib/long-task-workspace-snapshot.d.ts +8 -0
- package/dist/lib/long-task-workspace-snapshot.js +176 -0
- package/dist/lib/long-task-workspace.d.ts +4 -25
- package/dist/lib/long-task-workspace.js +3 -432
- package/dist/lib/repository-path-safety.d.ts +2 -0
- package/dist/lib/repository-path-safety.js +36 -0
- package/dist/long-task-hook.js +12 -3
- package/dist/public-types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS, DESIGN_RESOURCE_TECHNICAL_SOURCE_ROLES, } from "./design-resource-implementation-feasibility-types.js";
|
|
2
|
+
import { parseBlockers, parseComponentFamilyCells, parseConditionModel, } from "./design-resource-implementation-feasibility-shape-sections.js";
|
|
3
|
+
import { invalidFeasibility } from "./design-resource-implementation-feasibility-validation-support.js";
|
|
4
|
+
import { contractKey, sha256, stableKey, stableKeys, } from "./design-resource-handoff-shape-primitives.js";
|
|
5
|
+
import { array, literal, nullable, object, repositoryFile, string, } from "./long-task-shape-primitives.js";
|
|
6
|
+
import { parseStrictYaml } from "./strict-codec.js";
|
|
7
|
+
export function parseDesignResourceTechnicalFeasibilityInputs(value, label = "design_resource_handoff.technical_feasibility_inputs") {
|
|
8
|
+
return array(value, label).map((item, index) => {
|
|
9
|
+
const itemLabel = `${label}[${index}]`;
|
|
10
|
+
const row = object(item, itemLabel, [
|
|
11
|
+
"key",
|
|
12
|
+
"target_ref",
|
|
13
|
+
"path",
|
|
14
|
+
"media_type",
|
|
15
|
+
"sha256",
|
|
16
|
+
]);
|
|
17
|
+
return {
|
|
18
|
+
key: stableKey(row.key, `${itemLabel}.key`),
|
|
19
|
+
target_ref: contractKey(row.target_ref, `${itemLabel}.target_ref`),
|
|
20
|
+
path: repositoryFile(row.path, `${itemLabel}.path`),
|
|
21
|
+
media_type: literal(row.media_type, ["application/json"], `${itemLabel}.media_type`),
|
|
22
|
+
sha256: sha256(row.sha256, `${itemLabel}.sha256`),
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function parseDesignResourceImplementationFeasibilityJson(content) {
|
|
27
|
+
try {
|
|
28
|
+
JSON.parse(content);
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
invalidFeasibility("json", error instanceof Error ? error.message : String(error));
|
|
32
|
+
}
|
|
33
|
+
try {
|
|
34
|
+
return parseDesignResourceImplementationFeasibilityShape(parseStrictYaml(content));
|
|
35
|
+
}
|
|
36
|
+
catch (error) {
|
|
37
|
+
if (error instanceof Error &&
|
|
38
|
+
error.message.startsWith("design_resource_implementation_feasibility_invalid:"))
|
|
39
|
+
throw error;
|
|
40
|
+
invalidFeasibility("shape", error instanceof Error ? error.message : String(error));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export function parseDesignResourceImplementationFeasibilityShape(value) {
|
|
44
|
+
const label = "implementation_feasibility";
|
|
45
|
+
const root = object(value, label, [
|
|
46
|
+
"schema_version",
|
|
47
|
+
"key",
|
|
48
|
+
"target_ref",
|
|
49
|
+
"realization_mode",
|
|
50
|
+
"source_records",
|
|
51
|
+
"substrate_observations",
|
|
52
|
+
"condition_model",
|
|
53
|
+
"component_family_cells",
|
|
54
|
+
"blockers",
|
|
55
|
+
]);
|
|
56
|
+
return {
|
|
57
|
+
schema_version: literal(root.schema_version, ["design-resource-implementation-feasibility-v1"], `${label}.schema_version`),
|
|
58
|
+
key: stableKey(root.key, `${label}.key`),
|
|
59
|
+
target_ref: contractKey(root.target_ref, `${label}.target_ref`),
|
|
60
|
+
realization_mode: literal(root.realization_mode, ["native_substrate", "mapped_substrate", "reference"], `${label}.realization_mode`),
|
|
61
|
+
source_records: parseSourceRecords(root.source_records, label),
|
|
62
|
+
substrate_observations: parseSubstrateObservations(root.substrate_observations, label),
|
|
63
|
+
condition_model: parseConditionModel(root.condition_model, label),
|
|
64
|
+
component_family_cells: parseComponentFamilyCells(root.component_family_cells, label),
|
|
65
|
+
blockers: parseBlockers(root.blockers, label),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
function parseSourceRecords(value, label) {
|
|
69
|
+
return array(value, `${label}.source_records`).map((item, index) => {
|
|
70
|
+
const itemLabel = `${label}.source_records[${index}]`;
|
|
71
|
+
const row = object(item, itemLabel, [
|
|
72
|
+
"key",
|
|
73
|
+
"path",
|
|
74
|
+
"media_type",
|
|
75
|
+
"sha256",
|
|
76
|
+
"locator",
|
|
77
|
+
"roles",
|
|
78
|
+
]);
|
|
79
|
+
const locator = object(row.locator, `${itemLabel}.locator`, ["kind", "value"], ["text_sha256"]);
|
|
80
|
+
const kind = literal(locator.kind, [
|
|
81
|
+
"whole_resource",
|
|
82
|
+
"json_pointer",
|
|
83
|
+
"markdown_anchor",
|
|
84
|
+
"source_anchor",
|
|
85
|
+
"source_item",
|
|
86
|
+
], `${itemLabel}.locator.kind`);
|
|
87
|
+
const locatorValue = string(locator.value, `${itemLabel}.locator.value`);
|
|
88
|
+
if (kind === "whole_resource" && locatorValue !== ".")
|
|
89
|
+
invalidFeasibility(`${itemLabel}.locator.value`, "whole_resource_must_be_dot");
|
|
90
|
+
if (kind === "json_pointer" && !locatorValue.startsWith("/"))
|
|
91
|
+
invalidFeasibility(`${itemLabel}.locator.value`, "json_pointer_must_start_with_slash");
|
|
92
|
+
const parsedLocator = kind === "whole_resource"
|
|
93
|
+
? { kind, value: "." }
|
|
94
|
+
: kind === "json_pointer"
|
|
95
|
+
? { kind, value: locatorValue }
|
|
96
|
+
: kind === "source_item"
|
|
97
|
+
? {
|
|
98
|
+
kind,
|
|
99
|
+
value: stableKey(locatorValue, `${itemLabel}.locator.value`),
|
|
100
|
+
text_sha256: sha256(locator.text_sha256, `${itemLabel}.locator.text_sha256`),
|
|
101
|
+
}
|
|
102
|
+
: { kind, value: locatorValue };
|
|
103
|
+
if (kind !== "source_item" && locator.text_sha256 !== undefined)
|
|
104
|
+
invalidFeasibility(`${itemLabel}.locator.text_sha256`, "only_source_item_may_declare_text_sha256");
|
|
105
|
+
return {
|
|
106
|
+
key: stableKey(row.key, `${itemLabel}.key`),
|
|
107
|
+
path: repositoryFile(row.path, `${itemLabel}.path`),
|
|
108
|
+
media_type: string(row.media_type, `${itemLabel}.media_type`),
|
|
109
|
+
sha256: sha256(row.sha256, `${itemLabel}.sha256`),
|
|
110
|
+
locator: parsedLocator,
|
|
111
|
+
roles: array(row.roles, `${itemLabel}.roles`).map((role, roleIndex) => literal(role, DESIGN_RESOURCE_TECHNICAL_SOURCE_ROLES, `${itemLabel}.roles[${roleIndex}]`)),
|
|
112
|
+
};
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
function parseSubstrateObservations(value, label) {
|
|
116
|
+
return array(value, `${label}.substrate_observations`).map((item, index) => {
|
|
117
|
+
const itemLabel = `${label}.substrate_observations[${index}]`;
|
|
118
|
+
const row = object(item, itemLabel, [
|
|
119
|
+
"kind",
|
|
120
|
+
"disposition",
|
|
121
|
+
"value",
|
|
122
|
+
"source_record_refs",
|
|
123
|
+
"reason",
|
|
124
|
+
]);
|
|
125
|
+
return {
|
|
126
|
+
kind: literal(row.kind, DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS, `${itemLabel}.kind`),
|
|
127
|
+
disposition: literal(row.disposition, [
|
|
128
|
+
"observed",
|
|
129
|
+
"not_applicable",
|
|
130
|
+
"decision_required",
|
|
131
|
+
"unavailable",
|
|
132
|
+
], `${itemLabel}.disposition`),
|
|
133
|
+
value: nullable(row.value, (entry) => parseObservationValue(entry, `${itemLabel}.value`)),
|
|
134
|
+
source_record_refs: stableKeys(row.source_record_refs, `${itemLabel}.source_record_refs`),
|
|
135
|
+
reason: nullable(row.reason, (entry) => string(entry, `${itemLabel}.reason`)),
|
|
136
|
+
};
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function parseObservationValue(value, label) {
|
|
140
|
+
const kind = object(value, label, ["kind"], ["name", "version_source_ref", "paths"]).kind;
|
|
141
|
+
if (kind === "identifier") {
|
|
142
|
+
const row = object(value, label, ["kind", "name", "version_source_ref"]);
|
|
143
|
+
return {
|
|
144
|
+
kind: literal(row.kind, ["identifier"], `${label}.kind`),
|
|
145
|
+
name: stableKey(row.name, `${label}.name`),
|
|
146
|
+
version_source_ref: nullable(row.version_source_ref, (entry) => stableKey(entry, `${label}.version_source_ref`)),
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const row = object(value, label, ["kind", "paths"]);
|
|
150
|
+
return {
|
|
151
|
+
kind: literal(row.kind, ["repository_paths"], `${label}.kind`),
|
|
152
|
+
paths: array(row.paths, `${label}.paths`).map((item, index) => repositoryFile(item, `${label}.paths[${index}]`)),
|
|
153
|
+
};
|
|
154
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { type DesignResourceSubstrateObservationKind } from "./design-resource-implementation-feasibility-types.js";
|
|
2
|
+
export declare const DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA: "design-resource-feasibility-decision-v1";
|
|
3
|
+
export type DesignResourceFeasibilityDecisionProjection = DesignResourceRequiredRealizationProjection | DesignResourcePlannedOwnerProjection | DesignResourceFeasibilityBlockerProjection;
|
|
4
|
+
interface DesignResourceFeasibilityDecisionProjectionBase {
|
|
5
|
+
schema_version: typeof DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA;
|
|
6
|
+
target_ref: string;
|
|
7
|
+
component_family_ref: string;
|
|
8
|
+
condition_scope_sha256: string;
|
|
9
|
+
}
|
|
10
|
+
export interface DesignResourceRequiredRealizationProjection extends DesignResourceFeasibilityDecisionProjectionBase {
|
|
11
|
+
mode: "required_realization";
|
|
12
|
+
realization_ref: string;
|
|
13
|
+
}
|
|
14
|
+
export interface DesignResourcePlannedOwnerProjection extends DesignResourceFeasibilityDecisionProjectionBase {
|
|
15
|
+
mode: "planned_owner_authorization";
|
|
16
|
+
owner_locator: string;
|
|
17
|
+
}
|
|
18
|
+
export interface DesignResourceFeasibilityBlockerProjection extends DesignResourceFeasibilityDecisionProjectionBase {
|
|
19
|
+
mode: "feasibility_blocker";
|
|
20
|
+
blocker_ref: string;
|
|
21
|
+
substrate_observation_refs: DesignResourceSubstrateObservationKind[];
|
|
22
|
+
}
|
|
23
|
+
export declare function parseDesignResourceFeasibilityDecisionProjections(sourcePath: string, sourceItemKey: string, normalizedText: string): DesignResourceFeasibilityDecisionProjection[];
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { digest, literal, object, oneOf, parseStrictJsonObject, stringSet, } from "./design-resource-recovery-codec-primitives.js";
|
|
2
|
+
import { contractKey, stableKey, } from "./design-resource-handoff-shape-primitives.js";
|
|
3
|
+
import { invalidFeasibility } from "./design-resource-implementation-feasibility-validation-support.js";
|
|
4
|
+
import { DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS, } from "./design-resource-implementation-feasibility-types.js";
|
|
5
|
+
import { canonicalValueJson } from "./strict-codec.js";
|
|
6
|
+
export const DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA = "design-resource-feasibility-decision-v1";
|
|
7
|
+
const DECISION_MARKER = "ty-design-feasibility-decision-v1";
|
|
8
|
+
export function parseDesignResourceFeasibilityDecisionProjections(sourcePath, sourceItemKey, normalizedText) {
|
|
9
|
+
const projections = [];
|
|
10
|
+
for (const [index, line] of normalizedText.split("\n").entries()) {
|
|
11
|
+
if (!line.includes(DECISION_MARKER))
|
|
12
|
+
continue;
|
|
13
|
+
const match = /^<!-- ty-design-feasibility-decision-v1 (\{.*\}) -->$/u.exec(line);
|
|
14
|
+
if (!match)
|
|
15
|
+
invalidFeasibility("source_decision_marker_invalid", `${sourcePath}:${sourceItemKey}:${index + 1}`);
|
|
16
|
+
try {
|
|
17
|
+
projections.push(parseDecisionProjection(match[1], `${sourcePath}:${sourceItemKey}:${index + 1}`));
|
|
18
|
+
}
|
|
19
|
+
catch (error) {
|
|
20
|
+
if (error instanceof Error &&
|
|
21
|
+
error.message.startsWith("design_resource_implementation_feasibility_invalid:"))
|
|
22
|
+
throw error;
|
|
23
|
+
invalidFeasibility("source_decision_projection_invalid", `${sourcePath}:${sourceItemKey}:${index + 1}:${message(error)}`);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
const identities = projections.map((projection) => canonicalValueJson(projection));
|
|
27
|
+
if (new Set(identities).size !== identities.length)
|
|
28
|
+
invalidFeasibility("source_decision_projection_duplicate", `${sourcePath}:${sourceItemKey}`);
|
|
29
|
+
return projections;
|
|
30
|
+
}
|
|
31
|
+
function parseDecisionProjection(content, label) {
|
|
32
|
+
const parsed = parseStrictJsonObject(content, `feasibility_decision_projection:${label}`);
|
|
33
|
+
const header = object(parsed, `feasibility_decision_projection:${label}`, [
|
|
34
|
+
"schema_version",
|
|
35
|
+
"mode",
|
|
36
|
+
"target_ref",
|
|
37
|
+
"component_family_ref",
|
|
38
|
+
"condition_scope_sha256",
|
|
39
|
+
], [
|
|
40
|
+
"realization_ref",
|
|
41
|
+
"owner_locator",
|
|
42
|
+
"blocker_ref",
|
|
43
|
+
"substrate_observation_refs",
|
|
44
|
+
]);
|
|
45
|
+
literal(header.schema_version, DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA, `${label}.schema_version`);
|
|
46
|
+
const mode = oneOf(header.mode, [
|
|
47
|
+
"required_realization",
|
|
48
|
+
"planned_owner_authorization",
|
|
49
|
+
"feasibility_blocker",
|
|
50
|
+
], `${label}.mode`);
|
|
51
|
+
const base = {
|
|
52
|
+
schema_version: DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA,
|
|
53
|
+
target_ref: contractKey(header.target_ref, `${label}.target_ref`),
|
|
54
|
+
component_family_ref: stableKey(header.component_family_ref, `${label}.component_family_ref`),
|
|
55
|
+
condition_scope_sha256: digest(header.condition_scope_sha256, `${label}.condition_scope_sha256`),
|
|
56
|
+
};
|
|
57
|
+
if (mode === "required_realization") {
|
|
58
|
+
const row = object(parsed, label, [
|
|
59
|
+
"schema_version",
|
|
60
|
+
"mode",
|
|
61
|
+
"target_ref",
|
|
62
|
+
"component_family_ref",
|
|
63
|
+
"condition_scope_sha256",
|
|
64
|
+
"realization_ref",
|
|
65
|
+
]);
|
|
66
|
+
return {
|
|
67
|
+
...base,
|
|
68
|
+
mode,
|
|
69
|
+
realization_ref: stableKey(row.realization_ref, `${label}.realization_ref`),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
if (mode === "planned_owner_authorization") {
|
|
73
|
+
const row = object(parsed, label, [
|
|
74
|
+
"schema_version",
|
|
75
|
+
"mode",
|
|
76
|
+
"target_ref",
|
|
77
|
+
"component_family_ref",
|
|
78
|
+
"condition_scope_sha256",
|
|
79
|
+
"owner_locator",
|
|
80
|
+
]);
|
|
81
|
+
return {
|
|
82
|
+
...base,
|
|
83
|
+
mode,
|
|
84
|
+
owner_locator: stableKey(row.owner_locator, `${label}.owner_locator`),
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
const row = object(parsed, label, [
|
|
88
|
+
"schema_version",
|
|
89
|
+
"mode",
|
|
90
|
+
"target_ref",
|
|
91
|
+
"component_family_ref",
|
|
92
|
+
"condition_scope_sha256",
|
|
93
|
+
"blocker_ref",
|
|
94
|
+
"substrate_observation_refs",
|
|
95
|
+
]);
|
|
96
|
+
const substrateObservationRefs = stringSet(row.substrate_observation_refs, `${label}.substrate_observation_refs`, { allowEmpty: true }).map((observationRef, observationIndex) => oneOf(observationRef, DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS, `${label}.substrate_observation_refs[${observationIndex}]`));
|
|
97
|
+
return {
|
|
98
|
+
...base,
|
|
99
|
+
mode,
|
|
100
|
+
blocker_ref: stableKey(row.blocker_ref, `${label}.blocker_ref`),
|
|
101
|
+
substrate_observation_refs: substrateObservationRefs,
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
function message(error) {
|
|
105
|
+
return error instanceof Error ? error.message : String(error);
|
|
106
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { SourceItemKind } from "./long-task-source-authority-types.js";
|
|
2
|
+
import type { DesignResourceImplementationFeasibilityV1, DesignResourceTechnicalSourceRecordV1 } from "./design-resource-implementation-feasibility-types.js";
|
|
3
|
+
import type { DesignResourceImplementationFeasibilityTargetModel } from "./design-resource-implementation-feasibility-model.js";
|
|
4
|
+
import { type DesignResourceFeasibilityDecisionProjection } from "./design-resource-implementation-feasibility-source-decision-projection.js";
|
|
5
|
+
export { DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA, parseDesignResourceFeasibilityDecisionProjections, } from "./design-resource-implementation-feasibility-source-decision-projection.js";
|
|
6
|
+
export type { DesignResourceFeasibilityBlockerProjection, DesignResourceFeasibilityDecisionProjection, DesignResourcePlannedOwnerProjection, DesignResourceRequiredRealizationProjection, } from "./design-resource-implementation-feasibility-source-decision-projection.js";
|
|
7
|
+
export interface LoadedDesignResourceFeasibilityDecisionSource {
|
|
8
|
+
source_record_ref: string;
|
|
9
|
+
source_path: string;
|
|
10
|
+
source_item_key: string;
|
|
11
|
+
source_item_kind: SourceItemKind;
|
|
12
|
+
text_sha256: string;
|
|
13
|
+
projections: DesignResourceFeasibilityDecisionProjection[];
|
|
14
|
+
}
|
|
15
|
+
export type DesignResourceFeasibilityDecisionSourceIndex = Map<string, LoadedDesignResourceFeasibilityDecisionSource>;
|
|
16
|
+
export declare function loadDesignResourceFeasibilityDecisionSource(record: DesignResourceTechnicalSourceRecordV1, content: string): LoadedDesignResourceFeasibilityDecisionSource | null;
|
|
17
|
+
export declare function deriveDesignResourceFeasibilityConditionScopeSha256(document: DesignResourceImplementationFeasibilityV1, model: DesignResourceImplementationFeasibilityTargetModel, profileRef: string): string;
|
|
18
|
+
export declare function requireExactFeasibilityDecisionProjection(sourceRefs: string[], sources: DesignResourceFeasibilityDecisionSourceIndex, expectation: DesignResourceFeasibilityDecisionProjection, label: string, options: {
|
|
19
|
+
allReferencesMustBeSourceItems: boolean;
|
|
20
|
+
allowedItemKinds: readonly SourceItemKind[];
|
|
21
|
+
}): LoadedDesignResourceFeasibilityDecisionSource;
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { parseSourceDocument } from "./long-task-source-item-parser.js";
|
|
2
|
+
import { invalidFeasibility } from "./design-resource-implementation-feasibility-validation-support.js";
|
|
3
|
+
import { parseDesignResourceFeasibilityDecisionProjections, } from "./design-resource-implementation-feasibility-source-decision-projection.js";
|
|
4
|
+
import { createSymbolicDenotationCompilationSession } from "./symbolic-denotation-engine.js";
|
|
5
|
+
import { canonicalValueJson, sha256Hex } from "./strict-codec.js";
|
|
6
|
+
export { DESIGN_RESOURCE_FEASIBILITY_DECISION_SCHEMA, parseDesignResourceFeasibilityDecisionProjections, } from "./design-resource-implementation-feasibility-source-decision-projection.js";
|
|
7
|
+
export function loadDesignResourceFeasibilityDecisionSource(record, content) {
|
|
8
|
+
if (record.locator.kind !== "source_item")
|
|
9
|
+
return null;
|
|
10
|
+
let parsed;
|
|
11
|
+
try {
|
|
12
|
+
parsed = parseSourceDocument(record.path, content);
|
|
13
|
+
}
|
|
14
|
+
catch (error) {
|
|
15
|
+
invalidFeasibility("source_item_document_invalid", `${record.key}:${message(error)}`);
|
|
16
|
+
}
|
|
17
|
+
const item = parsed.items.find((candidate) => candidate.key === record.locator.value);
|
|
18
|
+
if (!item)
|
|
19
|
+
invalidFeasibility("source_item_missing", `${record.key}:${record.locator.value}`);
|
|
20
|
+
if (item.text_sha256 !== record.locator.text_sha256)
|
|
21
|
+
invalidFeasibility("source_item_text_digest_mismatch", `${record.key}:${record.locator.text_sha256}:${item.text_sha256}`);
|
|
22
|
+
return {
|
|
23
|
+
source_record_ref: record.key,
|
|
24
|
+
source_path: record.path,
|
|
25
|
+
source_item_key: item.key,
|
|
26
|
+
source_item_kind: item.kind,
|
|
27
|
+
text_sha256: item.text_sha256,
|
|
28
|
+
projections: parseDesignResourceFeasibilityDecisionProjections(record.path, item.key, item.normalized_text),
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
export function deriveDesignResourceFeasibilityConditionScopeSha256(document, model, profileRef) {
|
|
32
|
+
if (document.condition_model.kind === "explicit_conditions_v1" &&
|
|
33
|
+
model.representation === "fact_cells_v1") {
|
|
34
|
+
const profile = document.condition_model.profiles.find((candidate) => candidate.key === profileRef);
|
|
35
|
+
if (!profile)
|
|
36
|
+
invalidFeasibility("condition_profile_unknown", profileRef);
|
|
37
|
+
return sha256Hex(canonicalValueJson([...profile.condition_refs].sort(compareText)));
|
|
38
|
+
}
|
|
39
|
+
if (document.condition_model.kind === "symbolic_regions_v2" &&
|
|
40
|
+
model.representation === "symbolic_rules_v2") {
|
|
41
|
+
const profile = document.condition_model.profiles.find((candidate) => candidate.key === profileRef);
|
|
42
|
+
if (!profile)
|
|
43
|
+
invalidFeasibility("condition_profile_unknown", profileRef);
|
|
44
|
+
return createSymbolicDenotationCompilationSession(model.axis_domains, [
|
|
45
|
+
profile.region,
|
|
46
|
+
]).compile(profile.region).canonical_sha256;
|
|
47
|
+
}
|
|
48
|
+
invalidFeasibility("condition_model_representation_mismatch", profileRef);
|
|
49
|
+
}
|
|
50
|
+
export function requireExactFeasibilityDecisionProjection(sourceRefs, sources, expectation, label, options) {
|
|
51
|
+
if (options.allReferencesMustBeSourceItems)
|
|
52
|
+
for (const sourceRef of sourceRefs)
|
|
53
|
+
if (!sources.has(sourceRef))
|
|
54
|
+
invalidFeasibility("source_item_authority_required", `${label}:${sourceRef}`);
|
|
55
|
+
const matches = [];
|
|
56
|
+
for (const sourceRef of sourceRefs) {
|
|
57
|
+
const source = sources.get(sourceRef);
|
|
58
|
+
if (!source)
|
|
59
|
+
continue;
|
|
60
|
+
if (source.projections.some((projection) => canonicalValueJson(projection) === canonicalValueJson(expectation)))
|
|
61
|
+
matches.push(source);
|
|
62
|
+
}
|
|
63
|
+
if (matches.length !== 1)
|
|
64
|
+
invalidFeasibility("source_decision_projection_count", `${label}:${matches.length}`);
|
|
65
|
+
const match = matches[0];
|
|
66
|
+
if (!options.allowedItemKinds.includes(match.source_item_kind))
|
|
67
|
+
invalidFeasibility("source_decision_item_kind_invalid", `${label}:${match.source_item_kind}`);
|
|
68
|
+
return match;
|
|
69
|
+
}
|
|
70
|
+
function compareText(left, right) {
|
|
71
|
+
return left < right ? -1 : left > right ? 1 : 0;
|
|
72
|
+
}
|
|
73
|
+
function message(error) {
|
|
74
|
+
return error instanceof Error ? error.message : String(error);
|
|
75
|
+
}
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { SymbolicDenotationPredicate } from "./symbolic-denotation-types.js";
|
|
2
|
+
export interface DesignResourceTechnicalFeasibilityInputV1 {
|
|
3
|
+
key: string;
|
|
4
|
+
target_ref: string;
|
|
5
|
+
path: string;
|
|
6
|
+
media_type: "application/json";
|
|
7
|
+
sha256: string;
|
|
8
|
+
}
|
|
9
|
+
export declare const DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS: readonly ["platform", "framework_runtime", "ui_system", "token_theming_adapter", "component_owner_roots", "route_owner_roots"];
|
|
10
|
+
export type DesignResourceSubstrateObservationKind = (typeof DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS)[number];
|
|
11
|
+
export type DesignResourceSubstrateObservationDisposition = "observed" | "not_applicable" | "decision_required" | "unavailable";
|
|
12
|
+
export declare const DESIGN_RESOURCE_TECHNICAL_SOURCE_ROLES: readonly ["technical_platform", "framework_runtime", "ui_system", "token_theming_adapter", "component_owner", "route_owner", "capability_basis", "planned_owner_authorization", "technical_authority", "feasibility_basis"];
|
|
13
|
+
export type DesignResourceTechnicalSourceRole = (typeof DESIGN_RESOURCE_TECHNICAL_SOURCE_ROLES)[number];
|
|
14
|
+
export interface DesignResourceTechnicalSourceRecordV1 {
|
|
15
|
+
key: string;
|
|
16
|
+
path: string;
|
|
17
|
+
media_type: string;
|
|
18
|
+
sha256: string;
|
|
19
|
+
locator: {
|
|
20
|
+
kind: "whole_resource";
|
|
21
|
+
value: ".";
|
|
22
|
+
} | {
|
|
23
|
+
kind: "json_pointer";
|
|
24
|
+
value: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: "markdown_anchor" | "source_anchor";
|
|
27
|
+
value: string;
|
|
28
|
+
} | {
|
|
29
|
+
kind: "source_item";
|
|
30
|
+
value: string;
|
|
31
|
+
text_sha256: string;
|
|
32
|
+
};
|
|
33
|
+
roles: DesignResourceTechnicalSourceRole[];
|
|
34
|
+
}
|
|
35
|
+
export type DesignResourceSubstrateObservationValueV1 = {
|
|
36
|
+
kind: "identifier";
|
|
37
|
+
name: string;
|
|
38
|
+
version_source_ref: string | null;
|
|
39
|
+
} | {
|
|
40
|
+
kind: "repository_paths";
|
|
41
|
+
paths: string[];
|
|
42
|
+
};
|
|
43
|
+
export interface DesignResourceSubstrateObservationV1 {
|
|
44
|
+
kind: DesignResourceSubstrateObservationKind;
|
|
45
|
+
disposition: DesignResourceSubstrateObservationDisposition;
|
|
46
|
+
value: DesignResourceSubstrateObservationValueV1 | null;
|
|
47
|
+
source_record_refs: string[];
|
|
48
|
+
reason: string | null;
|
|
49
|
+
}
|
|
50
|
+
export interface DesignResourceExplicitConditionProfileV1 {
|
|
51
|
+
key: string;
|
|
52
|
+
condition_refs: string[];
|
|
53
|
+
}
|
|
54
|
+
export interface DesignResourceSymbolicConditionProfileV1 {
|
|
55
|
+
key: string;
|
|
56
|
+
region: SymbolicDenotationPredicate;
|
|
57
|
+
}
|
|
58
|
+
export type DesignResourceImplementationConditionModelV1 = {
|
|
59
|
+
kind: "explicit_conditions_v1";
|
|
60
|
+
profiles: DesignResourceExplicitConditionProfileV1[];
|
|
61
|
+
} | {
|
|
62
|
+
kind: "symbolic_regions_v2";
|
|
63
|
+
profiles: DesignResourceSymbolicConditionProfileV1[];
|
|
64
|
+
};
|
|
65
|
+
export declare const DESIGN_RESOURCE_IMPLEMENTATION_STRATEGY_STEPS: readonly ["reuse_existing", "compose_existing", "extend_shared_component", "theme_with_tokens", "create_shared_component"];
|
|
66
|
+
export type DesignResourceImplementationStrategyStep = (typeof DESIGN_RESOURCE_IMPLEMENTATION_STRATEGY_STEPS)[number];
|
|
67
|
+
export declare const DESIGN_RESOURCE_CUSTOMIZATION_SURFACES: readonly ["theme_tokens", "component_variant", "primitive_props", "composition", "content_slot", "icon_slot", "behavior_slot", "style_api"];
|
|
68
|
+
export type DesignResourceCustomizationSurface = (typeof DESIGN_RESOURCE_CUSTOMIZATION_SURFACES)[number];
|
|
69
|
+
export type DesignResourceImplementationOwnerCandidateV1 = {
|
|
70
|
+
kind: "existing_path";
|
|
71
|
+
locator: string;
|
|
72
|
+
existence: "existing";
|
|
73
|
+
} | {
|
|
74
|
+
kind: "planned_logical_owner";
|
|
75
|
+
locator: string;
|
|
76
|
+
existence: "planned";
|
|
77
|
+
authorization_source_refs: string[];
|
|
78
|
+
};
|
|
79
|
+
export interface DesignResourceFeasibleRealizationV1 {
|
|
80
|
+
key: string;
|
|
81
|
+
strategy_steps: DesignResourceImplementationStrategyStep[];
|
|
82
|
+
primitive_refs: string[];
|
|
83
|
+
owner_candidates: DesignResourceImplementationOwnerCandidateV1[];
|
|
84
|
+
supported_customization_surfaces: DesignResourceCustomizationSurface[];
|
|
85
|
+
feasibility_basis_refs: string[];
|
|
86
|
+
observed_costs: string[];
|
|
87
|
+
observed_risks: string[];
|
|
88
|
+
}
|
|
89
|
+
export interface DesignResourceImplementationFeasibilityCellV1 {
|
|
90
|
+
key: string;
|
|
91
|
+
component_family_ref: string;
|
|
92
|
+
target_ref: string;
|
|
93
|
+
condition_profile_ref: string;
|
|
94
|
+
design_fact_refs: string[];
|
|
95
|
+
feasible_realizations: DesignResourceFeasibleRealizationV1[];
|
|
96
|
+
required_realization: {
|
|
97
|
+
realization_ref: string | null;
|
|
98
|
+
technical_authority_source_refs: string[];
|
|
99
|
+
};
|
|
100
|
+
blocker_refs: string[];
|
|
101
|
+
}
|
|
102
|
+
export interface DesignResourceImplementationFeasibilityBlockerV1 {
|
|
103
|
+
key: string;
|
|
104
|
+
component_family_ref: string;
|
|
105
|
+
target_ref: string;
|
|
106
|
+
condition_profile_ref: string;
|
|
107
|
+
source_record_refs: string[];
|
|
108
|
+
substrate_observation_refs: DesignResourceSubstrateObservationKind[];
|
|
109
|
+
description: string;
|
|
110
|
+
}
|
|
111
|
+
export interface DesignResourceImplementationFeasibilityV1 {
|
|
112
|
+
schema_version: "design-resource-implementation-feasibility-v1";
|
|
113
|
+
key: string;
|
|
114
|
+
target_ref: string;
|
|
115
|
+
realization_mode: "native_substrate" | "mapped_substrate" | "reference";
|
|
116
|
+
source_records: DesignResourceTechnicalSourceRecordV1[];
|
|
117
|
+
substrate_observations: DesignResourceSubstrateObservationV1[];
|
|
118
|
+
condition_model: DesignResourceImplementationConditionModelV1;
|
|
119
|
+
component_family_cells: DesignResourceImplementationFeasibilityCellV1[];
|
|
120
|
+
blockers: DesignResourceImplementationFeasibilityBlockerV1[];
|
|
121
|
+
}
|
|
122
|
+
export interface DesignResourceImplementationFeasibilityIdentityV1 {
|
|
123
|
+
key: string;
|
|
124
|
+
target_ref: string;
|
|
125
|
+
path: string;
|
|
126
|
+
sha256: string;
|
|
127
|
+
realization_mode: DesignResourceImplementationFeasibilityV1["realization_mode"];
|
|
128
|
+
component_family_cells: number;
|
|
129
|
+
blockers: number;
|
|
130
|
+
}
|
|
131
|
+
export interface LoadedDesignResourceImplementationFeasibilityV1 {
|
|
132
|
+
index: DesignResourceTechnicalFeasibilityInputV1;
|
|
133
|
+
document: DesignResourceImplementationFeasibilityV1;
|
|
134
|
+
identity: DesignResourceImplementationFeasibilityIdentityV1;
|
|
135
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const DESIGN_RESOURCE_SUBSTRATE_OBSERVATION_KINDS = [
|
|
2
|
+
"platform",
|
|
3
|
+
"framework_runtime",
|
|
4
|
+
"ui_system",
|
|
5
|
+
"token_theming_adapter",
|
|
6
|
+
"component_owner_roots",
|
|
7
|
+
"route_owner_roots",
|
|
8
|
+
];
|
|
9
|
+
export const DESIGN_RESOURCE_TECHNICAL_SOURCE_ROLES = [
|
|
10
|
+
"technical_platform",
|
|
11
|
+
"framework_runtime",
|
|
12
|
+
"ui_system",
|
|
13
|
+
"token_theming_adapter",
|
|
14
|
+
"component_owner",
|
|
15
|
+
"route_owner",
|
|
16
|
+
"capability_basis",
|
|
17
|
+
"planned_owner_authorization",
|
|
18
|
+
"technical_authority",
|
|
19
|
+
"feasibility_basis",
|
|
20
|
+
];
|
|
21
|
+
export const DESIGN_RESOURCE_IMPLEMENTATION_STRATEGY_STEPS = [
|
|
22
|
+
"reuse_existing",
|
|
23
|
+
"compose_existing",
|
|
24
|
+
"extend_shared_component",
|
|
25
|
+
"theme_with_tokens",
|
|
26
|
+
"create_shared_component",
|
|
27
|
+
];
|
|
28
|
+
export const DESIGN_RESOURCE_CUSTOMIZATION_SURFACES = [
|
|
29
|
+
"theme_tokens",
|
|
30
|
+
"component_variant",
|
|
31
|
+
"primitive_props",
|
|
32
|
+
"composition",
|
|
33
|
+
"content_slot",
|
|
34
|
+
"icon_slot",
|
|
35
|
+
"behavior_slot",
|
|
36
|
+
"style_api",
|
|
37
|
+
];
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { DesignResourceImplementationFeasibilityV1, DesignResourceTechnicalSourceRecordV1 } from "./design-resource-implementation-feasibility-types.js";
|
|
2
|
+
import type { DesignResourceImplementationFeasibilityTargetModel } from "./design-resource-implementation-feasibility-model.js";
|
|
3
|
+
import { type DesignResourceFeasibilityDecisionSourceIndex } from "./design-resource-implementation-feasibility-source-decision.js";
|
|
4
|
+
export declare function validateFeasibilityCells(repository: string, document: DesignResourceImplementationFeasibilityV1, model: DesignResourceImplementationFeasibilityTargetModel, profileRefs: Set<string>, sources: Map<string, DesignResourceTechnicalSourceRecordV1>, decisionSources: DesignResourceFeasibilityDecisionSourceIndex): Promise<void>;
|
|
5
|
+
export declare function validateSubstrateObservationBlockerCoverage(document: Pick<DesignResourceImplementationFeasibilityV1, "substrate_observations" | "component_family_cells" | "blockers">, model: Pick<DesignResourceImplementationFeasibilityTargetModel, "component_family_refs">): void;
|