@contentful/experience-design-system-generation 2.35.1-dev-build-b8da2525.0 → 2.35.1-dev-build-4f1ad8cb.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/dist/package.json +1 -1
- package/dist/src/agent-names.js +7 -13
- package/dist/src/controller/create-generation-endpoint.d.ts +2 -2
- package/dist/src/controller/create-generation-endpoint.js +3 -3
- package/dist/src/controller/helpers/validate-generation-request.d.ts +1 -1
- package/dist/src/controller/helpers/validate-generation-request.js +9 -11
- package/dist/src/index.d.ts +21 -21
- package/dist/src/index.js +14 -14
- package/dist/src/orchestrator/execute-generation-orchestrator.d.ts +2 -2
- package/dist/src/orchestrator/execute-generation-orchestrator.js +1 -1
- package/dist/src/services/agent/helpers/build-agent-args.d.ts +1 -1
- package/dist/src/services/agent/helpers/build-agent-args.js +26 -45
- package/dist/src/services/agent/helpers/check-agent-auth.d.ts +2 -2
- package/dist/src/services/agent/helpers/check-agent-auth.js +10 -10
- package/dist/src/services/agent/helpers/check-claude-auth.d.ts +1 -1
- package/dist/src/services/agent/helpers/check-claude-auth.js +11 -11
- package/dist/src/services/agent/helpers/describe-agent-failure.d.ts +1 -1
- package/dist/src/services/agent/helpers/describe-agent-failure.js +2 -6
- package/dist/src/services/agent/helpers/extract-sentinel-output.d.ts +1 -1
- package/dist/src/services/agent/helpers/extract-sentinel-output.js +4 -4
- package/dist/src/services/agent/helpers/resolve-agent-binary.d.ts +1 -1
- package/dist/src/services/agent/helpers/resolve-agent-binary.js +1 -1
- package/dist/src/services/agent/local-cli-agent-invoker.d.ts +1 -1
- package/dist/src/services/agent/local-cli-agent-invoker.js +2 -2
- package/dist/src/services/agent/run-agent.d.ts +4 -4
- package/dist/src/services/agent/run-agent.js +17 -17
- package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.d.ts +1 -1
- package/dist/src/services/parsing/helpers/parse-selection-slot-evidence.js +11 -13
- package/dist/src/services/parsing/helpers/read-tool-call-objects.js +6 -6
- package/dist/src/services/parsing/parse-map-token-tool-calls.d.ts +1 -1
- package/dist/src/services/parsing/parse-map-token-tool-calls.js +9 -9
- package/dist/src/services/parsing/parse-prop-tool-calls.d.ts +1 -1
- package/dist/src/services/parsing/parse-prop-tool-calls.js +36 -52
- package/dist/src/services/parsing/parse-select-tool-calls.d.ts +1 -1
- package/dist/src/services/parsing/parse-select-tool-calls.js +8 -13
- package/dist/src/services/parsing/parse-token-tool-calls.d.ts +1 -1
- package/dist/src/services/parsing/parse-token-tool-calls.js +14 -14
- package/dist/src/services/prompts/build-prompt.d.ts +2 -2
- package/dist/src/services/prompts/build-prompt.js +4 -5
- package/dist/src/services/prompts/helpers/build-preamble.d.ts +1 -1
- package/dist/src/services/prompts/helpers/build-preamble.js +10 -15
- package/dist/src/services/prompts/helpers/format-source-refs.d.ts +1 -1
- package/dist/src/services/prompts/helpers/format-source-refs.js +8 -8
- package/dist/src/services/prompts/helpers/format-token-candidates.d.ts +1 -1
- package/dist/src/services/prompts/helpers/format-token-candidates.js +27 -27
- package/dist/src/services/prompts/helpers/resolve-skill-file.d.ts +2 -2
- package/dist/src/services/prompts/helpers/resolve-skill-file.js +12 -12
- package/dist/src/types/agent.d.ts +2 -2
- package/dist/src/types/contract.d.ts +3 -3
- package/dist/src/types/invoker.d.ts +2 -2
- package/dist/src/types/prompt.d.ts +3 -3
- package/dist/src/types/tool-calls.d.ts +10 -10
- package/package.json +2 -2
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { flattenDTCG } from
|
|
1
|
+
import { flattenDTCG } from '@contentful/experience-design-system-types';
|
|
2
2
|
export function inferFenceLang(filename) {
|
|
3
3
|
if (!filename)
|
|
4
|
-
return
|
|
5
|
-
const ext = filename.split(
|
|
4
|
+
return 'json';
|
|
5
|
+
const ext = filename.split('.').pop()?.toLowerCase() ?? '';
|
|
6
6
|
const map = {
|
|
7
|
-
js:
|
|
8
|
-
mjs:
|
|
9
|
-
cjs:
|
|
10
|
-
ts:
|
|
11
|
-
mts:
|
|
12
|
-
cts:
|
|
13
|
-
tsx:
|
|
14
|
-
jsx:
|
|
15
|
-
vue:
|
|
16
|
-
svelte:
|
|
17
|
-
astro:
|
|
18
|
-
scss:
|
|
19
|
-
sass:
|
|
20
|
-
css:
|
|
21
|
-
json:
|
|
22
|
-
json5:
|
|
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] ??
|
|
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 ===
|
|
37
|
-
const {
|
|
36
|
+
if (prop.$type === 'token' && prop.$category === 'design') {
|
|
37
|
+
const { '$token.allowed': _tokenAllowed, ...rest } = prop;
|
|
38
38
|
filteredProps[propName] = rest;
|
|
39
|
-
const kind = prop[
|
|
40
|
-
if (typeof kind ===
|
|
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,
|
|
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
|
-
:
|
|
63
|
-
const lines = entries.map((e) => `${e.path} · ${e.$type}`).join(
|
|
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
|
|
1
|
+
import type { Skill } from '../../../types/prompt.js';
|
|
2
2
|
export declare function resolveSkillPath(skill: Skill): string;
|
|
3
|
-
export declare function formatCustomPromptBanner(skill:
|
|
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,12 @@
|
|
|
1
|
-
import { existsSync } from
|
|
2
|
-
import { readFile } from
|
|
3
|
-
import { dirname, join, resolve } from
|
|
4
|
-
import { fileURLToPath } from
|
|
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:
|
|
7
|
-
tokens:
|
|
8
|
-
select:
|
|
9
|
-
|
|
6
|
+
components: 'generate-components.md',
|
|
7
|
+
tokens: 'generate-tokens.md',
|
|
8
|
+
select: 'select-components.md',
|
|
9
|
+
'map-tokens': 'map-tokens.md',
|
|
10
10
|
};
|
|
11
11
|
export function resolveSkillPath(skill) {
|
|
12
12
|
if (!(skill in SKILL_FILES))
|
|
@@ -14,10 +14,10 @@ export function resolveSkillPath(skill) {
|
|
|
14
14
|
const thisDir = dirname(fileURLToPath(import.meta.url));
|
|
15
15
|
let dir = thisDir;
|
|
16
16
|
for (;;) {
|
|
17
|
-
const candidate = join(dir,
|
|
17
|
+
const candidate = join(dir, 'skills');
|
|
18
18
|
if (existsSync(candidate))
|
|
19
19
|
return join(candidate, SKILL_FILES[skill]);
|
|
20
|
-
const parent = resolve(dir,
|
|
20
|
+
const parent = resolve(dir, '..');
|
|
21
21
|
if (parent === dir) {
|
|
22
22
|
throw new Error(`skill file missing from CLI installation (could not locate skills/ directory from: ${thisDir})`);
|
|
23
23
|
}
|
|
@@ -33,7 +33,7 @@ export async function readSkillFile(skill, override) {
|
|
|
33
33
|
if (override) {
|
|
34
34
|
const skillPath = resolve(override);
|
|
35
35
|
try {
|
|
36
|
-
return await readFile(skillPath,
|
|
36
|
+
return await readFile(skillPath, 'utf8');
|
|
37
37
|
}
|
|
38
38
|
catch {
|
|
39
39
|
throw new Error(`custom prompt file not found (skill: ${skill}, path: ${skillPath})`);
|
|
@@ -41,7 +41,7 @@ export async function readSkillFile(skill, override) {
|
|
|
41
41
|
}
|
|
42
42
|
const skillPath = resolveSkillPath(skill);
|
|
43
43
|
try {
|
|
44
|
-
return await readFile(skillPath,
|
|
44
|
+
return await readFile(skillPath, 'utf8');
|
|
45
45
|
}
|
|
46
46
|
catch {
|
|
47
47
|
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
|
|
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 =
|
|
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
|
|
2
|
-
import type { AgentAuthStatus, AgentDebugEvent } from
|
|
3
|
-
import type { PromptOptions } from
|
|
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
|
|
2
|
-
import type { AgentAuthStatus, AgentDebugEvent, AgentRunResult } from
|
|
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,6 @@
|
|
|
1
|
-
import type { CDFComponentEntry } from
|
|
2
|
-
export type Skill =
|
|
3
|
-
export type Mode =
|
|
1
|
+
import type { CDFComponentEntry } from '@contentful/experience-design-system-types';
|
|
2
|
+
export type Skill = 'components' | 'tokens' | 'select' | 'map-tokens';
|
|
3
|
+
export type Mode = 'autonomous';
|
|
4
4
|
export interface ComponentSourceRef {
|
|
5
5
|
component: string;
|
|
6
6
|
sourcePath: string;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export interface ClassifyPropCall {
|
|
2
|
-
tool:
|
|
2
|
+
tool: 'classify_prop';
|
|
3
3
|
prop: string;
|
|
4
4
|
cdf_type: string;
|
|
5
|
-
cdf_category:
|
|
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:
|
|
15
|
+
tool: 'exclude_prop';
|
|
16
16
|
prop: string;
|
|
17
17
|
reason: string;
|
|
18
18
|
}
|
|
19
19
|
export interface ClassifyComponentCall {
|
|
20
|
-
tool:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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-
|
|
3
|
+
"version": "2.35.1-dev-build-4f1ad8cb.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-
|
|
25
|
+
"@contentful/experience-design-system-types": "2.35.1-dev-build-4f1ad8cb.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@tsconfig/node24": "^24.0.4",
|