@contentful/experience-design-system-generation 2.35.1-dev-build-fa950e44.0 → 2.35.1-dev-build-b8da2525.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.
Files changed (54) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/agent-names.js +13 -7
  3. package/dist/src/controller/create-generation-endpoint.d.ts +2 -2
  4. package/dist/src/controller/create-generation-endpoint.js +6 -4
  5. package/dist/src/controller/helpers/validate-generation-request.d.ts +1 -1
  6. package/dist/src/controller/helpers/validate-generation-request.js +11 -9
  7. package/dist/src/index.d.ts +21 -21
  8. package/dist/src/index.js +14 -14
  9. package/dist/src/orchestrator/execute-generation-orchestrator.d.ts +2 -2
  10. package/dist/src/orchestrator/execute-generation-orchestrator.js +1 -1
  11. package/dist/src/services/agent/helpers/build-agent-args.d.ts +1 -1
  12. package/dist/src/services/agent/helpers/build-agent-args.js +45 -26
  13. package/dist/src/services/agent/helpers/check-agent-auth.d.ts +2 -2
  14. package/dist/src/services/agent/helpers/check-agent-auth.js +10 -10
  15. package/dist/src/services/agent/helpers/check-claude-auth.d.ts +1 -1
  16. package/dist/src/services/agent/helpers/check-claude-auth.js +11 -11
  17. package/dist/src/services/agent/helpers/describe-agent-failure.d.ts +1 -1
  18. package/dist/src/services/agent/helpers/describe-agent-failure.js +6 -2
  19. package/dist/src/services/agent/helpers/extract-sentinel-output.d.ts +1 -1
  20. package/dist/src/services/agent/helpers/extract-sentinel-output.js +4 -4
  21. package/dist/src/services/agent/helpers/resolve-agent-binary.d.ts +1 -1
  22. package/dist/src/services/agent/helpers/resolve-agent-binary.js +1 -1
  23. package/dist/src/services/agent/local-cli-agent-invoker.d.ts +1 -1
  24. package/dist/src/services/agent/local-cli-agent-invoker.js +2 -2
  25. package/dist/src/services/agent/run-agent.d.ts +4 -4
  26. package/dist/src/services/agent/run-agent.js +23 -18
  27. package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.d.ts +2 -0
  28. package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.js +66 -0
  29. package/dist/src/services/parsing/helpers/read-tool-call-objects.js +6 -6
  30. package/dist/src/services/parsing/parse-map-token-tool-calls.d.ts +1 -1
  31. package/dist/src/services/parsing/parse-map-token-tool-calls.js +14 -9
  32. package/dist/src/services/parsing/parse-prop-tool-calls.d.ts +1 -1
  33. package/dist/src/services/parsing/parse-prop-tool-calls.js +55 -35
  34. package/dist/src/services/parsing/parse-select-tool-calls.d.ts +1 -1
  35. package/dist/src/services/parsing/parse-select-tool-calls.js +21 -7
  36. package/dist/src/services/parsing/parse-token-tool-calls.d.ts +1 -1
  37. package/dist/src/services/parsing/parse-token-tool-calls.js +19 -14
  38. package/dist/src/services/prompts/build-prompt.d.ts +2 -2
  39. package/dist/src/services/prompts/build-prompt.js +5 -4
  40. package/dist/src/services/prompts/helpers/build-preamble.d.ts +1 -1
  41. package/dist/src/services/prompts/helpers/build-preamble.js +19 -11
  42. package/dist/src/services/prompts/helpers/format-source-refs.d.ts +1 -1
  43. package/dist/src/services/prompts/helpers/format-source-refs.js +8 -8
  44. package/dist/src/services/prompts/helpers/format-token-candidates.d.ts +1 -1
  45. package/dist/src/services/prompts/helpers/format-token-candidates.js +27 -27
  46. package/dist/src/services/prompts/helpers/resolve-skill-file.d.ts +2 -2
  47. package/dist/src/services/prompts/helpers/resolve-skill-file.js +12 -12
  48. package/dist/src/types/agent.d.ts +2 -2
  49. package/dist/src/types/contract.d.ts +3 -3
  50. package/dist/src/types/invoker.d.ts +2 -2
  51. package/dist/src/types/prompt.d.ts +4 -3
  52. package/dist/src/types/tool-calls.d.ts +23 -10
  53. package/package.json +2 -2
  54. package/skills/select-components.md +43 -8
@@ -0,0 +1,66 @@
1
+ export function parseSelectionSlotEvidence(value, warnings) {
2
+ if (value === undefined)
3
+ return undefined;
4
+ if (!Array.isArray(value)) {
5
+ warnings.push("slot_evidence must be an array — ignored");
6
+ return undefined;
7
+ }
8
+ const evidence = [];
9
+ for (const [index, candidate] of value.entries()) {
10
+ if (typeof candidate !== "object" || candidate === null) {
11
+ warnings.push(`slot_evidence[${index}] must be an object — skipped`);
12
+ continue;
13
+ }
14
+ const record = candidate;
15
+ const evidenceItems = record.evidence;
16
+ if (typeof record.name !== "string" ||
17
+ typeof record.is_real_slot !== "boolean" ||
18
+ typeof record.reason !== "string" ||
19
+ !Array.isArray(evidenceItems)) {
20
+ warnings.push(`slot_evidence[${index}] is missing name, is_real_slot, reason, or evidence — skipped`);
21
+ continue;
22
+ }
23
+ const citations = [];
24
+ for (const [citationIndex, citation] of evidenceItems.entries()) {
25
+ if (typeof citation !== "object" || citation === null)
26
+ continue;
27
+ const citationRecord = citation;
28
+ if (typeof citationRecord.source === "string" &&
29
+ typeof citationRecord.line === "string" &&
30
+ typeof citationRecord.quote === "string") {
31
+ citations.push({
32
+ source: citationRecord.source,
33
+ line: citationRecord.line,
34
+ quote: citationRecord.quote,
35
+ });
36
+ }
37
+ else {
38
+ warnings.push(`slot_evidence[${index}].evidence[${citationIndex}] is missing source, line, or quote — skipped`);
39
+ }
40
+ }
41
+ if (record.is_real_slot && citations.length === 0) {
42
+ warnings.push(`slot_evidence[${index}] marks a real slot without citation evidence — skipped`);
43
+ continue;
44
+ }
45
+ const allowedComponents = record.allowed_components;
46
+ if (allowedComponents !== undefined &&
47
+ (!Array.isArray(allowedComponents) ||
48
+ !allowedComponents.every((component) => typeof component === "string"))) {
49
+ warnings.push(`slot_evidence[${index}].allowed_components must be an array of names — skipped`);
50
+ continue;
51
+ }
52
+ if (record.is_real_slot &&
53
+ (!Array.isArray(allowedComponents) || allowedComponents.length === 0)) {
54
+ warnings.push(`slot_evidence[${index}] marks a real slot without allowed_components — skipped`);
55
+ continue;
56
+ }
57
+ evidence.push({
58
+ name: record.name,
59
+ is_real_slot: record.is_real_slot,
60
+ ...(allowedComponents ? { allowed_components: allowedComponents } : {}),
61
+ evidence: citations,
62
+ reason: record.reason,
63
+ });
64
+ }
65
+ return evidence;
66
+ }
@@ -7,16 +7,16 @@ function findJsonObjectEnd(line) {
7
7
  if (escaped) {
8
8
  escaped = false;
9
9
  }
10
- else if (ch === '\\' && inString) {
10
+ else if (ch === "\\" && inString) {
11
11
  escaped = true;
12
12
  }
13
13
  else if (ch === '"') {
14
14
  inString = !inString;
15
15
  }
16
- else if (!inString && ch === '{') {
16
+ else if (!inString && ch === "{") {
17
17
  depth++;
18
18
  }
19
- else if (!inString && ch === '}' && --depth === 0) {
19
+ else if (!inString && ch === "}" && --depth === 0) {
20
20
  return i;
21
21
  }
22
22
  }
@@ -25,9 +25,9 @@ function findJsonObjectEnd(line) {
25
25
  export function readToolCallObjects(stdout) {
26
26
  const objects = [];
27
27
  const warnings = [];
28
- for (const raw of stdout.split('\n')) {
28
+ for (const raw of stdout.split("\n")) {
29
29
  const line = raw.trim();
30
- if (!line.startsWith('{'))
30
+ if (!line.startsWith("{"))
31
31
  continue;
32
32
  const end = findJsonObjectEnd(line);
33
33
  if (end === -1) {
@@ -46,7 +46,7 @@ export function readToolCallObjects(stdout) {
46
46
  if (trailing.trim()) {
47
47
  warnings.push(`ignored trailing content after JSON: ${trailing.trim().slice(0, 120)}`);
48
48
  }
49
- if (typeof parsed === 'object' && parsed !== null && 'tool' in parsed) {
49
+ if (typeof parsed === "object" && parsed !== null && "tool" in parsed) {
50
50
  objects.push(parsed);
51
51
  }
52
52
  }
@@ -1,2 +1,2 @@
1
- import type { ParsedMapTokenPropToolCalls } from '../../types/tool-calls.js';
1
+ import type { ParsedMapTokenPropToolCalls } from "../../types/tool-calls.js";
2
2
  export declare function parseMapTokenPropToolCallLines(stdout: string): ParsedMapTokenPropToolCalls;
@@ -1,12 +1,12 @@
1
1
  function isStringArray(value) {
2
- return Array.isArray(value) && value.every((v) => typeof v === 'string');
2
+ return Array.isArray(value) && value.every((v) => typeof v === "string");
3
3
  }
4
4
  export function parseMapTokenPropToolCallLines(stdout) {
5
5
  const calls = [];
6
6
  const warnings = [];
7
- for (const raw of stdout.split('\n')) {
7
+ for (const raw of stdout.split("\n")) {
8
8
  const line = raw.trim();
9
- if (!line.startsWith('{'))
9
+ if (!line.startsWith("{"))
10
10
  continue;
11
11
  let obj;
12
12
  try {
@@ -16,16 +16,16 @@ export function parseMapTokenPropToolCallLines(stdout) {
16
16
  warnings.push(`unparseable line: ${line.slice(0, 120)}`);
17
17
  continue;
18
18
  }
19
- if (typeof obj !== 'object' || obj === null || !('tool' in obj))
19
+ if (typeof obj !== "object" || obj === null || !("tool" in obj))
20
20
  continue;
21
21
  const rec = obj;
22
- if (rec.tool !== 'map_token_prop')
22
+ if (rec.tool !== "map_token_prop")
23
23
  continue;
24
- if (typeof rec.component !== 'string' || !rec.component) {
25
- warnings.push('map_token_prop missing component — skipped');
24
+ if (typeof rec.component !== "string" || !rec.component) {
25
+ warnings.push("map_token_prop missing component — skipped");
26
26
  continue;
27
27
  }
28
- if (typeof rec.prop !== 'string' || !rec.prop) {
28
+ if (typeof rec.prop !== "string" || !rec.prop) {
29
29
  warnings.push(`map_token_prop '${rec.component}': missing prop — skipped`);
30
30
  continue;
31
31
  }
@@ -33,7 +33,12 @@ export function parseMapTokenPropToolCallLines(stdout) {
33
33
  warnings.push(`map_token_prop '${rec.component}.${String(rec.prop)}': missing or empty token_allowed — skipped`);
34
34
  continue;
35
35
  }
36
- calls.push({ tool: 'map_token_prop', component: rec.component, prop: rec.prop, token_allowed: rec.token_allowed });
36
+ calls.push({
37
+ tool: "map_token_prop",
38
+ component: rec.component,
39
+ prop: rec.prop,
40
+ token_allowed: rec.token_allowed,
41
+ });
37
42
  }
38
43
  return { calls, warnings };
39
44
  }
@@ -1,2 +1,2 @@
1
- import type { ParsedToolCalls } from '../../types/tool-calls.js';
1
+ import type { ParsedToolCalls } from "../../types/tool-calls.js";
2
2
  export declare function parsePropToolCallLines(stdout: string): ParsedToolCalls;
@@ -1,7 +1,19 @@
1
- import { readToolCallObjects } from './helpers/read-tool-call-objects.js';
2
- const VALID_TOOL_NAMES = new Set(['classify_prop', 'exclude_prop', 'classify_component', 'classify_slot']);
3
- const VALID_CDF_TYPES = new Set(['string', 'richtext', 'media', 'enum', 'token', 'boolean']);
4
- const VALID_CATEGORIES = new Set(['content', 'design', 'state']);
1
+ import { readToolCallObjects } from "./helpers/read-tool-call-objects.js";
2
+ const VALID_TOOL_NAMES = new Set([
3
+ "classify_prop",
4
+ "exclude_prop",
5
+ "classify_component",
6
+ "classify_slot",
7
+ ]);
8
+ const VALID_CDF_TYPES = new Set([
9
+ "string",
10
+ "richtext",
11
+ "media",
12
+ "enum",
13
+ "token",
14
+ "boolean",
15
+ ]);
16
+ const VALID_CATEGORIES = new Set(["content", "design", "state"]);
5
17
  export function parsePropToolCallLines(stdout) {
6
18
  const calls = [];
7
19
  const { objects, warnings } = readToolCallObjects(stdout);
@@ -11,78 +23,86 @@ export function parsePropToolCallLines(stdout) {
11
23
  continue;
12
24
  }
13
25
  const tool = rec.tool;
14
- if (tool === 'classify_prop') {
15
- if (typeof rec.prop !== 'string' || !rec.prop) {
16
- warnings.push('classify_prop missing prop name — skipped');
26
+ if (tool === "classify_prop") {
27
+ if (typeof rec.prop !== "string" || !rec.prop) {
28
+ warnings.push("classify_prop missing prop name — skipped");
17
29
  continue;
18
30
  }
19
- if (typeof rec.cdf_type !== 'string' || !VALID_CDF_TYPES.has(rec.cdf_type)) {
31
+ if (typeof rec.cdf_type !== "string" ||
32
+ !VALID_CDF_TYPES.has(rec.cdf_type)) {
20
33
  warnings.push(`classify_prop '${rec.prop}': invalid cdf_type '${String(rec.cdf_type)}' — skipped`);
21
34
  continue;
22
35
  }
23
- if (typeof rec.cdf_category !== 'string' || !VALID_CATEGORIES.has(rec.cdf_category)) {
36
+ if (typeof rec.cdf_category !== "string" ||
37
+ !VALID_CATEGORIES.has(rec.cdf_category)) {
24
38
  warnings.push(`classify_prop '${rec.prop}': invalid cdf_category '${String(rec.cdf_category)}' — skipped`);
25
39
  continue;
26
40
  }
27
41
  const call = {
28
- tool: 'classify_prop',
42
+ tool: "classify_prop",
29
43
  prop: rec.prop,
30
44
  cdf_type: rec.cdf_type,
31
45
  cdf_category: rec.cdf_category,
32
46
  };
33
- if (Array.isArray(rec.values) && rec.values.every((v) => typeof v === 'string'))
47
+ if (Array.isArray(rec.values) &&
48
+ rec.values.every((v) => typeof v === "string"))
34
49
  call.values = rec.values;
35
- if (typeof rec.token_kind === 'string')
50
+ if (typeof rec.token_kind === "string")
36
51
  call.token_kind = rec.token_kind;
37
- if (typeof rec.required === 'boolean')
52
+ if (typeof rec.required === "boolean")
38
53
  call.required = rec.required;
39
- if (typeof rec.description === 'string')
54
+ if (typeof rec.description === "string")
40
55
  call.description = rec.description;
41
- if (typeof rec.default === 'string' || typeof rec.default === 'boolean')
56
+ if (typeof rec.default === "string" || typeof rec.default === "boolean")
42
57
  call.default = rec.default;
43
- if (typeof rec.reason === 'string')
58
+ if (typeof rec.reason === "string")
44
59
  call.reason = rec.reason;
45
60
  calls.push(call);
46
61
  }
47
- else if (tool === 'exclude_prop') {
48
- if (typeof rec.prop !== 'string' || !rec.prop) {
49
- warnings.push('exclude_prop missing prop name — skipped');
62
+ else if (tool === "exclude_prop") {
63
+ if (typeof rec.prop !== "string" || !rec.prop) {
64
+ warnings.push("exclude_prop missing prop name — skipped");
50
65
  continue;
51
66
  }
52
- calls.push({ tool: 'exclude_prop', prop: rec.prop, reason: typeof rec.reason === 'string' ? rec.reason : '' });
67
+ calls.push({
68
+ tool: "exclude_prop",
69
+ prop: rec.prop,
70
+ reason: typeof rec.reason === "string" ? rec.reason : "",
71
+ });
53
72
  }
54
- else if (tool === 'classify_component') {
55
- const call = { tool: 'classify_component' };
56
- if (typeof rec.description === 'string')
73
+ else if (tool === "classify_component") {
74
+ const call = { tool: "classify_component" };
75
+ if (typeof rec.description === "string")
57
76
  call.description = rec.description;
58
- if (typeof rec.rationale === 'object' && rec.rationale !== null) {
77
+ if (typeof rec.rationale === "object" && rec.rationale !== null) {
59
78
  const r = rec.rationale;
60
79
  const rationale = {};
61
- if (typeof r.description === 'string')
80
+ if (typeof r.description === "string")
62
81
  rationale.description = r.description;
63
- if (typeof r.props === 'string')
82
+ if (typeof r.props === "string")
64
83
  rationale.props = r.props;
65
- if (typeof r.slots === 'string')
84
+ if (typeof r.slots === "string")
66
85
  rationale.slots = r.slots;
67
86
  if (Object.keys(rationale).length > 0)
68
87
  call.rationale = rationale;
69
88
  }
70
89
  calls.push(call);
71
90
  }
72
- else if (tool === 'classify_slot') {
73
- if (typeof rec.slot !== 'string' || !rec.slot) {
74
- warnings.push('classify_slot missing slot name — skipped');
91
+ else if (tool === "classify_slot") {
92
+ if (typeof rec.slot !== "string" || !rec.slot) {
93
+ warnings.push("classify_slot missing slot name — skipped");
75
94
  continue;
76
95
  }
77
- const call = { tool: 'classify_slot', slot: rec.slot };
78
- if (typeof rec.required === 'boolean')
96
+ const call = { tool: "classify_slot", slot: rec.slot };
97
+ if (typeof rec.required === "boolean")
79
98
  call.required = rec.required;
80
- if (Array.isArray(rec.allowed_components) && rec.allowed_components.every((v) => typeof v === 'string')) {
99
+ if (Array.isArray(rec.allowed_components) &&
100
+ rec.allowed_components.every((v) => typeof v === "string")) {
81
101
  call.allowed_components = rec.allowed_components;
82
102
  }
83
- if (typeof rec.description === 'string')
103
+ if (typeof rec.description === "string")
84
104
  call.description = rec.description;
85
- if (typeof rec.rationale === 'string')
105
+ if (typeof rec.rationale === "string")
86
106
  call.rationale = rec.rationale;
87
107
  calls.push(call);
88
108
  }
@@ -1,2 +1,2 @@
1
- import type { ParsedSelectToolCalls } from '../../types/tool-calls.js';
1
+ import type { ParsedSelectToolCalls } from "../../types/tool-calls.js";
2
2
  export declare function parseSelectToolCallLines(stdout: string): ParsedSelectToolCalls;
@@ -1,26 +1,40 @@
1
- import { readToolCallObjects } from './helpers/read-tool-call-objects.js';
2
- const VALID_SELECT_TOOL_NAMES = new Set(['select_component', 'reject_component']);
1
+ import { parseSelectionSlotEvidence } from "./helpers/parse-selection-slot-evidence.js";
2
+ import { readToolCallObjects } from "./helpers/read-tool-call-objects.js";
3
+ const VALID_SELECT_TOOL_NAMES = new Set([
4
+ "select_component",
5
+ "reject_component",
6
+ ]);
3
7
  export function parseSelectToolCallLines(stdout) {
4
8
  const calls = [];
5
9
  const { objects, warnings } = readToolCallObjects(stdout);
6
10
  for (const rec of objects) {
7
11
  if (!VALID_SELECT_TOOL_NAMES.has(rec.tool))
8
12
  continue;
9
- if (typeof rec.name !== 'string' || !rec.name) {
13
+ if (typeof rec.name !== "string" || !rec.name) {
10
14
  warnings.push(`${String(rec.tool)} missing name — skipped`);
11
15
  continue;
12
16
  }
13
- const call = { tool: rec.tool, name: rec.name };
14
- if (typeof rec.reason === 'string')
17
+ const call = {
18
+ tool: rec.tool,
19
+ name: rec.name,
20
+ };
21
+ if (typeof rec.reason === "string")
15
22
  call.reason = rec.reason;
16
- if (typeof rec.confidence === 'number' && rec.confidence >= 1 && rec.confidence <= 5) {
17
- if (call.tool === 'select_component') {
23
+ if (typeof rec.confidence === "number" &&
24
+ rec.confidence >= 1 &&
25
+ rec.confidence <= 5) {
26
+ if (call.tool === "select_component") {
18
27
  call.confidence = rec.confidence;
19
28
  }
20
29
  else {
21
30
  call.confidence = rec.confidence;
22
31
  }
23
32
  }
33
+ if (call.tool === "select_component") {
34
+ const slotEvidence = parseSelectionSlotEvidence(rec.slot_evidence, warnings);
35
+ if (slotEvidence !== undefined)
36
+ call.slot_evidence = slotEvidence;
37
+ }
24
38
  calls.push(call);
25
39
  }
26
40
  return { calls, warnings };
@@ -1,2 +1,2 @@
1
- import type { ParsedTokenToolCalls } from '../../types/tool-calls.js';
1
+ import type { ParsedTokenToolCalls } from "../../types/tool-calls.js";
2
2
  export declare function parseTokenToolCallLines(stdout: string): ParsedTokenToolCalls;
@@ -1,36 +1,41 @@
1
- import { readToolCallObjects } from './helpers/read-tool-call-objects.js';
2
- const VALID_TOKEN_TOOL_NAMES = new Set(['set_token', 'set_group']);
1
+ import { readToolCallObjects } from "./helpers/read-tool-call-objects.js";
2
+ const VALID_TOKEN_TOOL_NAMES = new Set(["set_token", "set_group"]);
3
3
  export function parseTokenToolCallLines(stdout) {
4
4
  const calls = [];
5
5
  const { objects, warnings } = readToolCallObjects(stdout);
6
6
  for (const rec of objects) {
7
7
  if (!VALID_TOKEN_TOOL_NAMES.has(rec.tool))
8
8
  continue;
9
- if (rec.tool === 'set_token') {
10
- if (typeof rec.path !== 'string' || !rec.path) {
11
- warnings.push('set_token missing path — skipped');
9
+ if (rec.tool === "set_token") {
10
+ if (typeof rec.path !== "string" || !rec.path) {
11
+ warnings.push("set_token missing path — skipped");
12
12
  continue;
13
13
  }
14
- if (typeof rec.type !== 'string' || !rec.type) {
14
+ if (typeof rec.type !== "string" || !rec.type) {
15
15
  warnings.push(`set_token '${rec.path}': missing type — skipped`);
16
16
  continue;
17
17
  }
18
- if (!('value' in rec)) {
18
+ if (!("value" in rec)) {
19
19
  warnings.push(`set_token '${rec.path}': missing value — skipped`);
20
20
  continue;
21
21
  }
22
- const call = { tool: 'set_token', path: rec.path, type: rec.type, value: rec.value };
23
- if (typeof rec.description === 'string')
22
+ const call = {
23
+ tool: "set_token",
24
+ path: rec.path,
25
+ type: rec.type,
26
+ value: rec.value,
27
+ };
28
+ if (typeof rec.description === "string")
24
29
  call.description = rec.description;
25
30
  calls.push(call);
26
31
  }
27
- else if (rec.tool === 'set_group') {
28
- if (typeof rec.path !== 'string' || !rec.path) {
29
- warnings.push('set_group missing path — skipped');
32
+ else if (rec.tool === "set_group") {
33
+ if (typeof rec.path !== "string" || !rec.path) {
34
+ warnings.push("set_group missing path — skipped");
30
35
  continue;
31
36
  }
32
- const call = { tool: 'set_group', path: rec.path };
33
- if (typeof rec.description === 'string')
37
+ const call = { tool: "set_group", path: rec.path };
38
+ if (typeof rec.description === "string")
34
39
  call.description = rec.description;
35
40
  calls.push(call);
36
41
  }
@@ -1,4 +1,4 @@
1
- import type { PromptOptions, Skill } from '../../types/prompt.js';
2
- export { resolveSkillPath, formatCustomPromptBanner } from './helpers/resolve-skill-file.js';
1
+ import type { PromptOptions, Skill } from "../../types/prompt.js";
2
+ export { resolveSkillPath, formatCustomPromptBanner, } from "./helpers/resolve-skill-file.js";
3
3
  export type { Skill };
4
4
  export declare function buildPrompt(options: PromptOptions): Promise<string>;
@@ -1,8 +1,9 @@
1
- import { readSkillFile } from './helpers/resolve-skill-file.js';
2
- import { buildPreamble } from './helpers/build-preamble.js';
3
- export { resolveSkillPath, formatCustomPromptBanner } from './helpers/resolve-skill-file.js';
1
+ import { readSkillFile } from "./helpers/resolve-skill-file.js";
2
+ import { buildPreamble } from "./helpers/build-preamble.js";
3
+ export { resolveSkillPath, formatCustomPromptBanner, } from "./helpers/resolve-skill-file.js";
4
4
  export async function buildPrompt(options) {
5
- const skillContent = options.skillContentOverride ?? (await readSkillFile(options.skill, options.skillPathOverride));
5
+ const skillContent = options.skillContentOverride ??
6
+ (await readSkillFile(options.skill, options.skillPathOverride));
6
7
  const preamble = buildPreamble(options);
7
8
  return `${preamble}\n\nSkill instructions follow:\n---\n${skillContent}`;
8
9
  }
@@ -1,2 +1,2 @@
1
- import type { PromptOptions } from '../../../types/prompt.js';
1
+ import type { PromptOptions } from "../../../types/prompt.js";
2
2
  export declare function buildPreamble(options: PromptOptions): string;
@@ -1,8 +1,8 @@
1
- import { inferFenceLang, filterDesignTokenProps, buildTokenCandidateSections } from './format-token-candidates.js';
2
- import { formatSourceRefsSection } from './format-source-refs.js';
3
- import { buildComponentsAutonomousPreamble, buildSelectAutonomousPreamble, buildMapTokensAutonomousPreamble, buildTokensAutonomousPreamble, } from './build-skill-preambles.js';
1
+ import { inferFenceLang, filterDesignTokenProps, buildTokenCandidateSections, } from "./format-token-candidates.js";
2
+ import { formatSourceRefsSection } from "./format-source-refs.js";
3
+ import { buildComponentsAutonomousPreamble, buildSelectAutonomousPreamble, buildMapTokensAutonomousPreamble, buildTokensAutonomousPreamble, } from "./build-skill-preambles.js";
4
4
  export function buildPreamble(options) {
5
- const { skill, rawComponentsInline, rawTokensInline, rawTokensFilename, tokensInline, tokenMapInline, generatedCdf, tokenTree, componentSourceRefs, existingComponentsInline, existingTokensInline, componentAllowlistInline, } = options;
5
+ const { skill, rawComponentsInline, propBucketsInline, rawTokensInline, rawTokensFilename, tokensInline, tokenMapInline, generatedCdf, tokenTree, componentSourceRefs, existingComponentsInline, existingTokensInline, componentAllowlistInline, } = options;
6
6
  const sections = [];
7
7
  if (existingComponentsInline) {
8
8
  sections.push(`Existing components in the target Contentful space (JSON) — use for alignment, not as a hard filter:\n\`\`\`json\n${existingComponentsInline}\n\`\`\``);
@@ -16,9 +16,14 @@ export function buildPreamble(options) {
16
16
  if (rawComponentsInline) {
17
17
  sections.push(`Raw component data (JSON):\n\`\`\`json\n${rawComponentsInline}\n\`\`\``);
18
18
  }
19
+ if (propBucketsInline) {
20
+ sections.push(`Deterministic prop buckets (advisory evidence only; verify against source and do not treat as inclusion or category decisions):\n\`\`\`json\n${propBucketsInline}\n\`\`\``);
21
+ }
19
22
  if (rawTokensInline) {
20
23
  const lang = inferFenceLang(rawTokensFilename);
21
- const label = rawTokensFilename ? `Raw token source (${rawTokensFilename})` : 'Raw token source';
24
+ const label = rawTokensFilename
25
+ ? `Raw token source (${rawTokensFilename})`
26
+ : "Raw token source";
22
27
  sections.push(`${label}:\n\`\`\`${lang}\n${rawTokensInline}\n\`\`\``);
23
28
  }
24
29
  if (tokensInline) {
@@ -27,8 +32,11 @@ export function buildPreamble(options) {
27
32
  if (tokenMapInline) {
28
33
  sections.push(`Token-name sidecar (raw name → DTCG path):\n\`\`\`json\n${tokenMapInline}\n\`\`\``);
29
34
  }
30
- const filteredTokenProps = generatedCdf ? filterDesignTokenProps(generatedCdf) : undefined;
31
- if (filteredTokenProps && Object.keys(filteredTokenProps.filtered).length > 0) {
35
+ const filteredTokenProps = generatedCdf
36
+ ? filterDesignTokenProps(generatedCdf)
37
+ : undefined;
38
+ if (filteredTokenProps &&
39
+ Object.keys(filteredTokenProps.filtered).length > 0) {
32
40
  sections.push(`Generated CDF so far — design-category token props only (JSON):\n\`\`\`json\n${JSON.stringify(filteredTokenProps.filtered)}\n\`\`\``);
33
41
  }
34
42
  if (tokenTree) {
@@ -37,12 +45,12 @@ export function buildPreamble(options) {
37
45
  if (componentSourceRefs && componentSourceRefs.length > 0) {
38
46
  sections.push(...formatSourceRefsSection(componentSourceRefs, skill));
39
47
  }
40
- const inputBlock = sections.length > 0 ? `\n\n${sections.join('\n\n')}` : '';
41
- if (skill === 'components')
48
+ const inputBlock = sections.length > 0 ? `\n\n${sections.join("\n\n")}` : "";
49
+ if (skill === "components")
42
50
  return buildComponentsAutonomousPreamble(inputBlock);
43
- if (skill === 'select')
51
+ if (skill === "select")
44
52
  return buildSelectAutonomousPreamble(inputBlock);
45
- if (skill === 'map-tokens')
53
+ if (skill === "map-tokens")
46
54
  return buildMapTokensAutonomousPreamble(inputBlock);
47
55
  return buildTokensAutonomousPreamble(inputBlock);
48
56
  }
@@ -1,2 +1,2 @@
1
- import type { ComponentSourceRef, Skill } from '../../../types/prompt.js';
1
+ import type { ComponentSourceRef, Skill } from "../../../types/prompt.js";
2
2
  export declare function formatSourceRefsSection(refs: ComponentSourceRef[], skill: Skill): string[];
@@ -1,30 +1,30 @@
1
- import { inferFenceLang } from './format-token-candidates.js';
1
+ import { inferFenceLang } from "./format-token-candidates.js";
2
2
  function formatSourceRefBlock(ref) {
3
3
  const mainBlock = `#### ${ref.component} (\`${ref.sourcePath}\`)\n\`\`\`${inferFenceLang(ref.sourcePath)}\n${ref.content}\n\`\`\``;
4
4
  const siblingBlocks = (ref.siblingFiles ?? []).map((sibling) => `##### ${ref.component} — imported file \`${sibling.path}\`\n\`\`\`${inferFenceLang(sibling.path)}\n${sibling.content}\n\`\`\``);
5
5
  const truncationNote = ref.truncatedSiblingCount && ref.truncatedSiblingCount > 0
6
6
  ? [
7
- `##### ${ref.component} — +${ref.truncatedSiblingCount} more imported file${ref.truncatedSiblingCount === 1 ? '' : 's'} not shown (evidence may be incomplete)`,
7
+ `##### ${ref.component} — +${ref.truncatedSiblingCount} more imported file${ref.truncatedSiblingCount === 1 ? "" : "s"} not shown (evidence may be incomplete)`,
8
8
  ]
9
9
  : [];
10
10
  const notShownNote = ref.usesNotShown && ref.usesNotShown.length > 0
11
11
  ? [
12
- `##### ${ref.component} — uses not shown: ${ref.usesNotShown.join(', ')}\n\nThe files above are excerpts, and each of these properties has at least one use that fell outside the excerpt budget. Treat their consumption as unknown, not absent: do not classify them \`token\` on what is shown, and do not conclude they are unread.`,
12
+ `##### ${ref.component} — uses not shown: ${ref.usesNotShown.join(", ")}\n\nThe files above are excerpts, and each of these properties has at least one use that fell outside the excerpt budget. Treat their consumption as unknown, not absent: do not classify them \`token\` on what is shown, and do not conclude they are unread.`,
13
13
  ]
14
14
  : [];
15
- return [mainBlock, ...siblingBlocks, ...truncationNote, ...notShownNote].join('\n\n');
15
+ return [mainBlock, ...siblingBlocks, ...truncationNote, ...notShownNote].join("\n\n");
16
16
  }
17
17
  export function formatSourceRefsSection(refs, skill) {
18
18
  const sections = [];
19
19
  const withContent = refs.filter((ref) => ref.content != null);
20
20
  const withoutContent = refs.filter((ref) => ref.content == null);
21
21
  if (withContent.length > 0) {
22
- sections.push(`### Component source references\n\n${withContent.map(formatSourceRefBlock).join('\n\n')}`);
22
+ sections.push(`### Component source references\n\n${withContent.map(formatSourceRefBlock).join("\n\n")}`);
23
23
  }
24
24
  if (withoutContent.length > 0) {
25
- const guidance = skill === 'components'
26
- ? 'there is no consumption evidence for these, so `token` cannot be earned for any of their props — classify from the prop signature alone, and any prop that would otherwise be enum-versus-token is `enum` (or `string`)'
27
- : 'there is no source evidence to narrow from — emit nothing for their props';
25
+ const guidance = skill === "components"
26
+ ? "there is no consumption evidence for these, so `token` cannot be earned for any of their props — classify from the prop signature alone, and any prop that would otherwise be enum-versus-token is `enum` (or `string`)"
27
+ : "there is no source evidence to narrow from — emit nothing for their props";
28
28
  sections.push(`Component source unavailable for (JSON) — ${guidance}:\n\`\`\`json\n${JSON.stringify(withoutContent.map((ref) => ({ component: ref.component, sourcePath: ref.sourcePath })))}\n\`\`\``);
29
29
  }
30
30
  return sections;
@@ -1,4 +1,4 @@
1
- import type { GeneratedCdf } from '../../../types/prompt.js';
1
+ import type { GeneratedCdf } from "../../../types/prompt.js";
2
2
  export declare function inferFenceLang(filename: string | undefined): string;
3
3
  export declare function filterDesignTokenProps(cdf: GeneratedCdf): {
4
4
  filtered: GeneratedCdf;