@contentful/experience-design-system-generation 2.30.2-dev-build-2c13c19.0 → 2.31.1-dev-build-bd7d043.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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-generation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.1-dev-build-bd7d043.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",
|
|
@@ -102,25 +102,20 @@ export interface ParsedMapTokenPropToolCalls {
|
|
|
102
102
|
}
|
|
103
103
|
export declare function parseMapTokenPropToolCallLines(stdout: string): ParsedMapTokenPropToolCalls;
|
|
104
104
|
export declare function resolveBinary(agent: AgentName): string;
|
|
105
|
-
export declare function agentSupportsBedrock(agent: AgentName): boolean;
|
|
106
105
|
/**
|
|
107
106
|
* Resolve the model for an agent. Explicit flag/creds value wins, then a
|
|
108
107
|
* per-agent `EDS_AGENT_MODEL_<AGENT>` env override (mirrors the
|
|
109
108
|
* `EDS_AGENT_BINARY_<AGENT>` pattern), otherwise the lightweight default for
|
|
110
|
-
* that agent.
|
|
111
|
-
* agents whose model id changes shape under Bedrock (codex, opencode) — an
|
|
112
|
-
* explicit value or env override is never rewritten.
|
|
109
|
+
* that agent.
|
|
113
110
|
*/
|
|
114
|
-
export declare function resolveAgentModel(agent: AgentName, explicit?: string
|
|
111
|
+
export declare function resolveAgentModel(agent: AgentName, explicit?: string): string;
|
|
115
112
|
export type AgentDebugEvent = (name: string, payload?: Record<string, unknown>) => void;
|
|
116
|
-
export declare function buildArgs(agent: AgentName, prompt: string, model?: string, promptViaStdin?: boolean
|
|
113
|
+
export declare function buildArgs(agent: AgentName, prompt: string, model?: string, promptViaStdin?: boolean): string[];
|
|
117
114
|
export declare function runAgent(options: {
|
|
118
115
|
agent: AgentName;
|
|
119
116
|
prompt: string;
|
|
120
117
|
timeoutMs: number;
|
|
121
118
|
model?: string;
|
|
122
|
-
/** Apply the selected agent's Bedrock-routing env vars when enabled. */
|
|
123
|
-
bedrock?: boolean;
|
|
124
119
|
onOutput?: (chunk: string) => void;
|
|
125
120
|
/**
|
|
126
121
|
* Deliver the prompt on stdin instead of as an argv positional. Required for
|
package/dist/src/agent-runner.js
CHANGED
|
@@ -280,80 +280,34 @@ export function resolveBinary(agent) {
|
|
|
280
280
|
return override.trim();
|
|
281
281
|
return AGENT_BINARIES[agent];
|
|
282
282
|
}
|
|
283
|
-
/** Per-agent env vars that switch model calls to AWS Bedrock. */
|
|
284
|
-
const BEDROCK_ENV_BY_AGENT = {
|
|
285
|
-
claude: { CLAUDE_CODE_USE_BEDROCK: '1' },
|
|
286
|
-
};
|
|
287
|
-
/**
|
|
288
|
-
* Agents with a working Bedrock routing mechanism, of any shape (env var,
|
|
289
|
-
* argv config override, or a provider-prefixed model string) — not just the
|
|
290
|
-
* env-var agents in BEDROCK_ENV_BY_AGENT. cursor is excluded: its own Bedrock
|
|
291
|
-
* support is currently broken for non-interactive/CI use.
|
|
292
|
-
*/
|
|
293
|
-
const BEDROCK_CAPABLE_AGENTS = new Set(['claude', 'codex', 'opencode']);
|
|
294
|
-
export function agentSupportsBedrock(agent) {
|
|
295
|
-
return BEDROCK_CAPABLE_AGENTS.has(agent);
|
|
296
|
-
}
|
|
297
|
-
const DEFAULT_CODEX_BEDROCK_REGION = 'us-east-1';
|
|
298
283
|
/**
|
|
299
284
|
* Default models per agent — lightweight/fast picks to control cost when no
|
|
300
285
|
* explicit model is configured. cursor uses `gpt-mini` (verified alias from
|
|
301
|
-
* GetUsableModels; haiku is not available in cursor's model catalog).
|
|
302
|
-
* default differs on Bedrock: the model id there carries an `openai.` prefix,
|
|
303
|
-
* required by the Bedrock provider and absent from the direct api.openai.com
|
|
304
|
-
* id.
|
|
286
|
+
* GetUsableModels; haiku is not available in cursor's model catalog).
|
|
305
287
|
*/
|
|
306
288
|
const DEFAULT_MODELS = {
|
|
307
289
|
claude: 'haiku',
|
|
308
|
-
codex: 'gpt-5.
|
|
290
|
+
codex: 'gpt-5.4-mini', // requires OPENAI_API_KEY; ChatGPT account users must pass --model
|
|
309
291
|
opencode: 'claude-haiku-4-5',
|
|
310
292
|
cursor: 'gpt-mini', // cursor alias for gpt-5.4-mini-medium; haiku not in cursor's catalog
|
|
311
293
|
copilot: 'Auto', // the only model guaranteed on every Copilot plan (Free/Pro/Business/Enterprise); Pro+ users override via EDS_AGENT_MODEL_COPILOT
|
|
312
294
|
};
|
|
313
|
-
const DEFAULT_CODEX_BEDROCK_MODEL = 'openai.gpt-5.6-luna';
|
|
314
295
|
/**
|
|
315
296
|
* Resolve the model for an agent. Explicit flag/creds value wins, then a
|
|
316
297
|
* per-agent `EDS_AGENT_MODEL_<AGENT>` env override (mirrors the
|
|
317
298
|
* `EDS_AGENT_BINARY_<AGENT>` pattern), otherwise the lightweight default for
|
|
318
|
-
* that agent.
|
|
319
|
-
* agents whose model id changes shape under Bedrock (codex, opencode) — an
|
|
320
|
-
* explicit value or env override is never rewritten.
|
|
299
|
+
* that agent.
|
|
321
300
|
*/
|
|
322
|
-
export function resolveAgentModel(agent, explicit
|
|
301
|
+
export function resolveAgentModel(agent, explicit) {
|
|
323
302
|
if (explicit && explicit.trim())
|
|
324
303
|
return explicit.trim();
|
|
325
304
|
const override = process.env[`EDS_AGENT_MODEL_${agent.toUpperCase()}`];
|
|
326
305
|
if (override && override.trim())
|
|
327
306
|
return override.trim();
|
|
328
|
-
if (bedrock && agent === 'codex')
|
|
329
|
-
return DEFAULT_CODEX_BEDROCK_MODEL;
|
|
330
|
-
if (bedrock && agent === 'opencode')
|
|
331
|
-
return withBedrockProviderPrefix(DEFAULT_MODELS.opencode);
|
|
332
307
|
return DEFAULT_MODELS[agent];
|
|
333
308
|
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
* flag or env var, so routing it through Bedrock means rewriting the model
|
|
337
|
-
* string itself. Left alone if it already carries a provider prefix (an
|
|
338
|
-
* explicit --model / EDS_AGENT_MODEL_OPENCODE value naming its own
|
|
339
|
-
* provider), since resolveAgentModel only applies this to the bare default.
|
|
340
|
-
*/
|
|
341
|
-
function withBedrockProviderPrefix(model) {
|
|
342
|
-
return model.includes('/') ? model : `amazon-bedrock/${model}`;
|
|
343
|
-
}
|
|
344
|
-
/**
|
|
345
|
-
* codex has no Bedrock env var; it requires `-c` config overrides
|
|
346
|
-
* (`model_provider` + the Bedrock provider's region) passed as argv, per the
|
|
347
|
-
* org's verified codex-bedrock-security-review setup. Region comes from the
|
|
348
|
-
* environment's own AWS region var, falling back to us-east-1 — the region
|
|
349
|
-
* gpt-5.6-luna's Bedrock endpoint requires — when neither is set.
|
|
350
|
-
*/
|
|
351
|
-
function codexBedrockConfigArgs() {
|
|
352
|
-
const region = process.env.AWS_REGION?.trim() || process.env.AWS_DEFAULT_REGION?.trim() || DEFAULT_CODEX_BEDROCK_REGION;
|
|
353
|
-
return ['-c', 'model_provider=amazon-bedrock', '-c', `model_providers.amazon-bedrock.region=${region}`];
|
|
354
|
-
}
|
|
355
|
-
export function buildArgs(agent, prompt, model, promptViaStdin = false, bedrock = false) {
|
|
356
|
-
const modelArg = ['--model', resolveAgentModel(agent, model, bedrock)];
|
|
309
|
+
export function buildArgs(agent, prompt, model, promptViaStdin = false) {
|
|
310
|
+
const modelArg = ['--model', resolveAgentModel(agent, model)];
|
|
357
311
|
// When the prompt is delivered on stdin, omit it from argv — a large prompt
|
|
358
312
|
// as a command-line argument overflows ARG_MAX (spawn E2BIG). All four CLIs
|
|
359
313
|
// read the prompt from stdin when it isn't passed positionally.
|
|
@@ -361,11 +315,9 @@ export function buildArgs(agent, prompt, model, promptViaStdin = false, bedrock
|
|
|
361
315
|
switch (agent) {
|
|
362
316
|
case 'claude':
|
|
363
317
|
return ['--print', ...modelArg, ...promptArg];
|
|
364
|
-
case 'codex':
|
|
365
|
-
const bedrockArgs = bedrock ? codexBedrockConfigArgs() : [];
|
|
318
|
+
case 'codex':
|
|
366
319
|
// --dangerously-bypass-approvals-and-sandbox required for non-interactive use
|
|
367
|
-
return ['exec', ...
|
|
368
|
-
}
|
|
320
|
+
return ['exec', ...modelArg, '--dangerously-bypass-approvals-and-sandbox', ...promptArg];
|
|
369
321
|
case 'opencode':
|
|
370
322
|
return ['run', ...modelArg, ...promptArg];
|
|
371
323
|
case 'cursor':
|
|
@@ -394,29 +346,21 @@ export function buildArgs(agent, prompt, model, promptViaStdin = false, bedrock
|
|
|
394
346
|
}
|
|
395
347
|
export async function runAgent(options) {
|
|
396
348
|
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
397
|
-
// Fall back to the process-wide EDS_BEDROCK signal (set once by the CLI's
|
|
398
|
-
// top-level --bedrock resolution and inherited by every spawned subprocess)
|
|
399
|
-
// when a call site doesn't pass `bedrock` explicitly — closes the gap for
|
|
400
|
-
// call sites that forget to thread the flag through by hand.
|
|
401
|
-
const bedrock = options.bedrock ?? process.env.EDS_BEDROCK === '1';
|
|
402
349
|
const binary = resolveBinary(agent);
|
|
403
350
|
const useStdin = !!promptViaStdin;
|
|
404
|
-
const args = buildArgs(agent, prompt, model, useStdin
|
|
351
|
+
const args = buildArgs(agent, prompt, model, useStdin);
|
|
405
352
|
const startedAt = Date.now();
|
|
406
353
|
onDebugEvent?.('run.start', {
|
|
407
354
|
agent,
|
|
408
355
|
binary,
|
|
409
356
|
model,
|
|
410
|
-
bedrock: !!bedrock,
|
|
411
357
|
timeoutMs,
|
|
412
358
|
promptLen: prompt.length,
|
|
413
359
|
promptHead: prompt.slice(0, 500),
|
|
414
360
|
});
|
|
415
361
|
return new Promise((resolve) => {
|
|
416
|
-
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : undefined;
|
|
417
362
|
const child = spawn(binary, args, {
|
|
418
363
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
419
|
-
...(bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}),
|
|
420
364
|
});
|
|
421
365
|
if (useStdin && child.stdin) {
|
|
422
366
|
// Guard against EPIPE: the child may close stdin before we finish
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { AGENT_NAMES, DEFAULT_AGENT_NAME, isAgentName } from './agent-names.js';
|
|
2
2
|
export type { AgentName } from './agent-names.js';
|
|
3
|
-
export {
|
|
3
|
+
export { buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseMapTokenPropToolCallLines, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
|
|
4
4
|
export type { AgentAuthStatus, AgentDebugEvent, AgentRunResult, ClassifyComponentCall, ClassifyPropCall, ClassifySlotCall, ExcludePropCall, MapTokenPropCall, ParsedMapTokenPropToolCalls, ParsedSelectToolCalls, ParsedTokenToolCalls, ParsedToolCalls, RejectComponentCall, SelectComponentCall, SelectToolCall, SetGroupCall, SetTokenCall, ToolCall, TokenToolCall, } from './agent-runner.js';
|
|
5
5
|
export { createLocalCliAgentInvoker } from './agent-invoker.js';
|
|
6
6
|
export type { AgentInvoker, CreateLocalCliAgentInvokerOptions, InvokeAgentOptions } from './agent-invoker.js';
|
package/dist/src/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// Agent identity
|
|
2
2
|
export { AGENT_NAMES, DEFAULT_AGENT_NAME, isAgentName } from './agent-names.js';
|
|
3
3
|
// Agent invocation (low-level)
|
|
4
|
-
export {
|
|
4
|
+
export { buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseMapTokenPropToolCallLines, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
|
|
5
5
|
// Agent invocation (interface)
|
|
6
6
|
export { createLocalCliAgentInvoker } from './agent-invoker.js';
|
|
7
7
|
// Prompt building
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-generation",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.31.1-dev-build-bd7d043.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.
|
|
25
|
+
"@contentful/experience-design-system-types": "2.31.1-dev-build-bd7d043.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@tsconfig/node24": "^24.0.4",
|