@contentful/experience-design-system-generation 2.35.1-dev-build-b8da2525.0 → 2.35.1-dev-build-e1cfef52.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 (58) hide show
  1. package/dist/package.json +1 -1
  2. package/dist/src/agent-names.js +7 -13
  3. package/dist/src/controller/create-generation-endpoint.d.ts +2 -2
  4. package/dist/src/controller/create-generation-endpoint.js +3 -3
  5. package/dist/src/controller/helpers/validate-generation-request.d.ts +1 -1
  6. package/dist/src/controller/helpers/validate-generation-request.js +9 -11
  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/progress.d.ts +2 -2
  12. package/dist/src/progress.js +2 -2
  13. package/dist/src/services/agent/helpers/build-agent-args.d.ts +1 -1
  14. package/dist/src/services/agent/helpers/build-agent-args.js +26 -45
  15. package/dist/src/services/agent/helpers/check-agent-auth.d.ts +2 -2
  16. package/dist/src/services/agent/helpers/check-agent-auth.js +10 -10
  17. package/dist/src/services/agent/helpers/check-claude-auth.d.ts +1 -1
  18. package/dist/src/services/agent/helpers/check-claude-auth.js +11 -11
  19. package/dist/src/services/agent/helpers/describe-agent-failure.d.ts +1 -1
  20. package/dist/src/services/agent/helpers/describe-agent-failure.js +2 -6
  21. package/dist/src/services/agent/helpers/extract-sentinel-output.d.ts +1 -1
  22. package/dist/src/services/agent/helpers/extract-sentinel-output.js +4 -4
  23. package/dist/src/services/agent/helpers/resolve-agent-binary.d.ts +1 -1
  24. package/dist/src/services/agent/helpers/resolve-agent-binary.js +1 -1
  25. package/dist/src/services/agent/local-cli-agent-invoker.d.ts +1 -1
  26. package/dist/src/services/agent/local-cli-agent-invoker.js +2 -2
  27. package/dist/src/services/agent/run-agent.d.ts +4 -4
  28. package/dist/src/services/agent/run-agent.js +17 -17
  29. package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.d.ts +1 -1
  30. package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.js +11 -13
  31. package/dist/src/services/parsing/helpers/read-tool-call-objects.js +6 -6
  32. package/dist/src/services/parsing/parse-map-token-tool-calls.d.ts +1 -1
  33. package/dist/src/services/parsing/parse-map-token-tool-calls.js +9 -9
  34. package/dist/src/services/parsing/parse-prop-tool-calls.d.ts +1 -1
  35. package/dist/src/services/parsing/parse-prop-tool-calls.js +36 -52
  36. package/dist/src/services/parsing/parse-select-tool-calls.d.ts +1 -1
  37. package/dist/src/services/parsing/parse-select-tool-calls.js +8 -13
  38. package/dist/src/services/parsing/parse-token-tool-calls.d.ts +1 -1
  39. package/dist/src/services/parsing/parse-token-tool-calls.js +14 -14
  40. package/dist/src/services/prompts/build-prompt.d.ts +2 -2
  41. package/dist/src/services/prompts/build-prompt.js +4 -5
  42. package/dist/src/services/prompts/helpers/build-preamble.d.ts +1 -1
  43. package/dist/src/services/prompts/helpers/build-preamble.js +13 -16
  44. package/dist/src/services/prompts/helpers/build-skill-preambles.d.ts +2 -0
  45. package/dist/src/services/prompts/helpers/build-skill-preambles.js +31 -0
  46. package/dist/src/services/prompts/helpers/format-source-refs.d.ts +1 -1
  47. package/dist/src/services/prompts/helpers/format-source-refs.js +8 -8
  48. package/dist/src/services/prompts/helpers/format-token-candidates.d.ts +1 -1
  49. package/dist/src/services/prompts/helpers/format-token-candidates.js +27 -27
  50. package/dist/src/services/prompts/helpers/resolve-skill-file.d.ts +2 -2
  51. package/dist/src/services/prompts/helpers/resolve-skill-file.js +13 -12
  52. package/dist/src/types/agent.d.ts +2 -2
  53. package/dist/src/types/contract.d.ts +3 -3
  54. package/dist/src/types/invoker.d.ts +2 -2
  55. package/dist/src/types/prompt.d.ts +8 -3
  56. package/dist/src/types/tool-calls.d.ts +10 -10
  57. package/package.json +2 -2
  58. package/skills/debate-select.md +23 -0
@@ -1,27 +1,27 @@
1
- import { flattenDTCG } from "@contentful/experience-design-system-types";
1
+ import { flattenDTCG } from '@contentful/experience-design-system-types';
2
2
  export function inferFenceLang(filename) {
3
3
  if (!filename)
4
- return "json";
5
- const ext = filename.split(".").pop()?.toLowerCase() ?? "";
4
+ return 'json';
5
+ const ext = filename.split('.').pop()?.toLowerCase() ?? '';
6
6
  const map = {
7
- js: "js",
8
- mjs: "js",
9
- cjs: "js",
10
- ts: "ts",
11
- mts: "ts",
12
- cts: "ts",
13
- tsx: "tsx",
14
- jsx: "jsx",
15
- vue: "vue",
16
- svelte: "svelte",
17
- astro: "astro",
18
- scss: "scss",
19
- sass: "scss",
20
- css: "css",
21
- json: "json",
22
- json5: "json",
7
+ js: 'js',
8
+ mjs: 'js',
9
+ cjs: 'js',
10
+ ts: 'ts',
11
+ mts: 'ts',
12
+ cts: 'ts',
13
+ tsx: 'tsx',
14
+ jsx: 'jsx',
15
+ vue: 'vue',
16
+ svelte: 'svelte',
17
+ astro: 'astro',
18
+ scss: 'scss',
19
+ sass: 'scss',
20
+ css: 'css',
21
+ json: 'json',
22
+ json5: 'json',
23
23
  };
24
- return map[ext] ?? "text";
24
+ return map[ext] ?? 'text';
25
25
  }
26
26
  export function filterDesignTokenProps(cdf) {
27
27
  const result = {};
@@ -33,11 +33,11 @@ export function filterDesignTokenProps(cdf) {
33
33
  continue;
34
34
  const filteredProps = {};
35
35
  for (const [propName, prop] of Object.entries(properties)) {
36
- if (prop.$type === "token" && prop.$category === "design") {
37
- const { "$token.allowed": _tokenAllowed, ...rest } = prop;
36
+ if (prop.$type === 'token' && prop.$category === 'design') {
37
+ const { '$token.allowed': _tokenAllowed, ...rest } = prop;
38
38
  filteredProps[propName] = rest;
39
- const kind = prop["$token.kind"];
40
- if (typeof kind === "string" && kind.length > 0) {
39
+ const kind = prop['$token.kind'];
40
+ if (typeof kind === 'string' && kind.length > 0) {
41
41
  kinds.add(kind);
42
42
  }
43
43
  else {
@@ -52,15 +52,15 @@ export function filterDesignTokenProps(cdf) {
52
52
  return { filtered: result, kinds: [...kinds].sort(), hasUnscoped };
53
53
  }
54
54
  export function buildTokenCandidateSections(tokenTree, filteredTokenProps) {
55
- const index = flattenDTCG(tokenTree, "").sort((a, b) => a.path.localeCompare(b.path));
55
+ const index = flattenDTCG(tokenTree, '').sort((a, b) => a.path.localeCompare(b.path));
56
56
  if (index.length === 0)
57
57
  return [];
58
58
  const sections = [];
59
59
  const renderSection = (kind, entries) => {
60
60
  const label = kind
61
61
  ? `Token path index — ${kind} candidates only`
62
- : "Token path index — full tree (no $token.kind to scope by)";
63
- const lines = entries.map((e) => `${e.path} · ${e.$type}`).join("\n");
62
+ : 'Token path index — full tree (no $token.kind to scope by)';
63
+ const lines = entries.map((e) => `${e.path} · ${e.$type}`).join('\n');
64
64
  return `${label}, one leaf token per line as \`path · type\`, no \`$value\`:\n${lines}`;
65
65
  };
66
66
  if (filteredTokenProps) {
@@ -1,4 +1,4 @@
1
- import type { Skill } from "../../../types/prompt.js";
1
+ import type { Skill } from '../../../types/prompt.js';
2
2
  export declare function resolveSkillPath(skill: Skill): string;
3
- export declare function formatCustomPromptBanner(skill: "components" | "select", path: string): string;
3
+ export declare function formatCustomPromptBanner(skill: 'components' | 'select', path: string): string;
4
4
  export declare function readSkillFile(skill: Skill, override?: string): Promise<string>;
@@ -1,12 +1,13 @@
1
- import { existsSync } from "node:fs";
2
- import { readFile } from "node:fs/promises";
3
- import { dirname, join, resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
1
+ import { existsSync } from 'node:fs';
2
+ import { readFile } from 'node:fs/promises';
3
+ import { dirname, join, resolve } from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
5
  const SKILL_FILES = {
6
- components: "generate-components.md",
7
- tokens: "generate-tokens.md",
8
- select: "select-components.md",
9
- "map-tokens": "map-tokens.md",
6
+ components: 'generate-components.md',
7
+ tokens: 'generate-tokens.md',
8
+ select: 'select-components.md',
9
+ 'debate-select': 'debate-select.md',
10
+ 'map-tokens': 'map-tokens.md',
10
11
  };
11
12
  export function resolveSkillPath(skill) {
12
13
  if (!(skill in SKILL_FILES))
@@ -14,10 +15,10 @@ export function resolveSkillPath(skill) {
14
15
  const thisDir = dirname(fileURLToPath(import.meta.url));
15
16
  let dir = thisDir;
16
17
  for (;;) {
17
- const candidate = join(dir, "skills");
18
+ const candidate = join(dir, 'skills');
18
19
  if (existsSync(candidate))
19
20
  return join(candidate, SKILL_FILES[skill]);
20
- const parent = resolve(dir, "..");
21
+ const parent = resolve(dir, '..');
21
22
  if (parent === dir) {
22
23
  throw new Error(`skill file missing from CLI installation (could not locate skills/ directory from: ${thisDir})`);
23
24
  }
@@ -33,7 +34,7 @@ export async function readSkillFile(skill, override) {
33
34
  if (override) {
34
35
  const skillPath = resolve(override);
35
36
  try {
36
- return await readFile(skillPath, "utf8");
37
+ return await readFile(skillPath, 'utf8');
37
38
  }
38
39
  catch {
39
40
  throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath})`);
@@ -41,7 +42,7 @@ export async function readSkillFile(skill, override) {
41
42
  }
42
43
  const skillPath = resolveSkillPath(skill);
43
44
  try {
44
- return await readFile(skillPath, "utf8");
45
+ return await readFile(skillPath, 'utf8');
45
46
  }
46
47
  catch {
47
48
  throw new Error(`skill file missing from CLI installation — try reinstalling the CLI (looked for: ${skillPath})`);
@@ -1,4 +1,4 @@
1
- import type { AgentName } from "../agent-names.js";
1
+ import type { AgentName } from '../agent-names.js';
2
2
  export type { AgentName };
3
3
  export interface AgentRunResult {
4
4
  exitCode: number;
@@ -6,5 +6,5 @@ export interface AgentRunResult {
6
6
  stderr: string;
7
7
  timedOut: boolean;
8
8
  }
9
- export type AgentAuthStatus = "ok" | "unauthenticated" | "not-found";
9
+ export type AgentAuthStatus = 'ok' | 'unauthenticated' | 'not-found';
10
10
  export type AgentDebugEvent = (name: string, payload?: Record<string, unknown>) => void;
@@ -1,6 +1,6 @@
1
- import type { AgentName } from "../agent-names.js";
2
- import type { AgentAuthStatus, AgentDebugEvent } from "./agent.js";
3
- import type { PromptOptions } from "./prompt.js";
1
+ import type { AgentName } from '../agent-names.js';
2
+ import type { AgentAuthStatus, AgentDebugEvent } from './agent.js';
3
+ import type { PromptOptions } from './prompt.js';
4
4
  export interface GenerationEndpointRequest {
5
5
  readonly agent: AgentName;
6
6
  readonly model?: string;
@@ -1,5 +1,5 @@
1
- import type { AgentName } from "../agent-names.js";
2
- import type { AgentAuthStatus, AgentDebugEvent, AgentRunResult } from "./agent.js";
1
+ import type { AgentName } from '../agent-names.js';
2
+ import type { AgentAuthStatus, AgentDebugEvent, AgentRunResult } from './agent.js';
3
3
  export interface InvokeAgentOptions {
4
4
  agent: AgentName;
5
5
  model?: string;
@@ -1,6 +1,7 @@
1
- import type { CDFComponentEntry } from "@contentful/experience-design-system-types";
2
- export type Skill = "components" | "tokens" | "select" | "map-tokens";
3
- export type Mode = "autonomous";
1
+ import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
2
+ export type Skill = 'components' | 'tokens' | 'select' | 'debate-select' | 'map-tokens';
3
+ export type DebateRole = 'for' | 'against';
4
+ export type Mode = 'autonomous';
4
5
  export interface ComponentSourceRef {
5
6
  component: string;
6
7
  sourcePath: string;
@@ -23,6 +24,10 @@ export interface PromptOptions {
23
24
  skill: Skill;
24
25
  mode: Mode;
25
26
  rawComponentsInline?: string;
27
+ /** For the debate-select skill: which side of the disagreement this agent argues. */
28
+ debateRole?: DebateRole;
29
+ /** For the debate-select skill: JSON-serialized disagreement under review. */
30
+ disagreementInline?: string;
26
31
  propBucketsInline?: string;
27
32
  rawTokensInline?: string;
28
33
  /** Original filename for raw tokens — used to set the correct code fence language. */
@@ -1,8 +1,8 @@
1
1
  export interface ClassifyPropCall {
2
- tool: "classify_prop";
2
+ tool: 'classify_prop';
3
3
  prop: string;
4
4
  cdf_type: string;
5
- cdf_category: "content" | "design" | "state";
5
+ cdf_category: 'content' | 'design' | 'state';
6
6
  values?: string[];
7
7
  token_kind?: string;
8
8
  required?: boolean;
@@ -12,12 +12,12 @@ export interface ClassifyPropCall {
12
12
  reason?: string;
13
13
  }
14
14
  export interface ExcludePropCall {
15
- tool: "exclude_prop";
15
+ tool: 'exclude_prop';
16
16
  prop: string;
17
17
  reason: string;
18
18
  }
19
19
  export interface ClassifyComponentCall {
20
- tool: "classify_component";
20
+ tool: 'classify_component';
21
21
  description?: string;
22
22
  /**
23
23
  * Component-level rationale strings. Surfaced by the `I` ComponentRationalePanel.
@@ -31,7 +31,7 @@ export interface ClassifyComponentCall {
31
31
  };
32
32
  }
33
33
  export interface ClassifySlotCall {
34
- tool: "classify_slot";
34
+ tool: 'classify_slot';
35
35
  slot: string;
36
36
  required?: boolean;
37
37
  allowed_components?: string[];
@@ -57,14 +57,14 @@ export interface SelectionSlotEvidence {
57
57
  reason: string;
58
58
  }
59
59
  export interface SelectComponentCall {
60
- tool: "select_component";
60
+ tool: 'select_component';
61
61
  name: string;
62
62
  reason?: string;
63
63
  confidence?: number;
64
64
  slot_evidence?: SelectionSlotEvidence[];
65
65
  }
66
66
  export interface RejectComponentCall {
67
- tool: "reject_component";
67
+ tool: 'reject_component';
68
68
  name: string;
69
69
  reason?: string;
70
70
  confidence?: number;
@@ -75,14 +75,14 @@ export interface ParsedSelectToolCalls {
75
75
  warnings: string[];
76
76
  }
77
77
  export interface SetTokenCall {
78
- tool: "set_token";
78
+ tool: 'set_token';
79
79
  path: string;
80
80
  type: string;
81
81
  value: unknown;
82
82
  description?: string;
83
83
  }
84
84
  export interface SetGroupCall {
85
- tool: "set_group";
85
+ tool: 'set_group';
86
86
  path: string;
87
87
  description?: string;
88
88
  }
@@ -92,7 +92,7 @@ export interface ParsedTokenToolCalls {
92
92
  warnings: string[];
93
93
  }
94
94
  export interface MapTokenPropCall {
95
- tool: "map_token_prop";
95
+ tool: 'map_token_prop';
96
96
  component: string;
97
97
  prop: string;
98
98
  /** Narrowed subset of tokens the prop may draw from. Required and non-empty. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentful/experience-design-system-generation",
3
- "version": "2.35.1-dev-build-b8da2525.0",
3
+ "version": "2.35.1-dev-build-e1cfef52.0",
4
4
  "description": "Agent-invocation and skill-prompt engine for the Contentful Experience Design System SDK",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -22,7 +22,7 @@
22
22
  "skills/"
23
23
  ],
24
24
  "dependencies": {
25
- "@contentful/experience-design-system-types": "2.35.1-dev-build-b8da2525.0"
25
+ "@contentful/experience-design-system-types": "2.35.1-dev-build-e1cfef52.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tsconfig/node24": "^24.0.4",
@@ -0,0 +1,23 @@
1
+ # Debate component selection
2
+
3
+ This skill is used after independent component-selection agents disagree about an interpretive question. The caller supplies one component, its source evidence, the disagreement record, and your role (for or against).
4
+
5
+ The caller dispatches a blind FOR/AGAINST pair; argue only the side named in your prompt and do not assume or describe the other participant's response.
6
+
7
+ ## Scope
8
+
9
+ - Argue only the exact disagreement in the prompt.
10
+ - Use the supplied component data and citations as the evidence base.
11
+ - For slot-realness or allowed-component questions, reason from concrete caller evidence rather than from a ReactNode-shaped prop alone.
12
+ - Keep the argument specific enough for an orchestrator to make an independent determination.
13
+ - Do not write files, call tools, or invent evidence that is not present in the prompt.
14
+
15
+ ## Output protocol
16
+
17
+ Emit exactly one JSON object on one line:
18
+
19
+ ~~~json
20
+ {"role":"for","disagreement_id":"d1","argument":"...","evidence":[{"source":"src/Panel.tsx","line":"42","quote":"<Card><Badge /></Card>"}]}
21
+ ~~~
22
+
23
+ Use the role and disagreement ID supplied by the caller. evidence must be an array of objects with source, line, and quote strings; use an empty array when no citable source evidence is supplied.