@contentful/experience-design-system-generation 2.32.1-dev-build-3e401c3.0 → 2.32.1-dev-build-10912f6.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.32.1-dev-build-3e401c3.0",
3
+ "version": "2.32.1-dev-build-10912f6.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",
@@ -2,7 +2,6 @@ import type { AgentDebugEvent, AgentAuthStatus, AgentName, AgentRunResult } from
2
2
  export interface InvokeAgentOptions {
3
3
  agent: AgentName;
4
4
  model?: string;
5
- bedrock?: boolean;
6
5
  prompt: string;
7
6
  timeoutMs: number;
8
7
  onOutput?: (chunk: string) => void;
@@ -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. `bedrock` only affects the fallback default, and only for
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, bedrock?: boolean): string;
111
+ export declare function resolveAgentModel(agent: AgentName, explicit?: string): string | undefined;
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, bedrock?: boolean): string[];
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
@@ -280,80 +280,35 @@ 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
- * explicit model is configured. cursor uses `gpt-mini` (verified alias from
301
- * GetUsableModels; haiku is not available in cursor's model catalog). codex's
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.
285
+ * explicit model is configured. cursor uses `gpt-mini`
286
+ * (verified alias from GetUsableModels; haiku is not available in cursor's
287
+ * model catalog).
305
288
  */
306
289
  const DEFAULT_MODELS = {
307
290
  claude: 'haiku',
308
- codex: 'gpt-5.6-luna', // 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. `bedrock` only affects the fallback default, and only for
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, bedrock = false) {
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
- * opencode selects providers via a `provider/model` string rather than a
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 resolvedModel = resolveAgentModel(agent, model);
311
+ const modelArg = resolvedModel ? ['--model', resolvedModel] : [];
357
312
  // When the prompt is delivered on stdin, omit it from argv — a large prompt
358
313
  // as a command-line argument overflows ARG_MAX (spawn E2BIG). All four CLIs
359
314
  // read the prompt from stdin when it isn't passed positionally.
@@ -361,11 +316,9 @@ export function buildArgs(agent, prompt, model, promptViaStdin = false, bedrock
361
316
  switch (agent) {
362
317
  case 'claude':
363
318
  return ['--print', ...modelArg, ...promptArg];
364
- case 'codex': {
365
- const bedrockArgs = bedrock ? codexBedrockConfigArgs() : [];
319
+ case 'codex':
366
320
  // --dangerously-bypass-approvals-and-sandbox required for non-interactive use
367
- return ['exec', ...bedrockArgs, ...modelArg, '--dangerously-bypass-approvals-and-sandbox', ...promptArg];
368
- }
321
+ return ['exec', ...modelArg, '--dangerously-bypass-approvals-and-sandbox', ...promptArg];
369
322
  case 'opencode':
370
323
  return ['run', ...modelArg, ...promptArg];
371
324
  case 'cursor':
@@ -387,36 +340,28 @@ export function buildArgs(agent, prompt, model, promptViaStdin = false, bedrock
387
340
  // value, so promptViaStdin will fail here — callers must pass the
388
341
  // prompt inline for copilot.
389
342
  const copilotModel = resolveAgentModel('copilot', model);
390
- const copilotModelArg = copilotModel === 'Auto' ? [] : ['--model', copilotModel];
343
+ const copilotModelArg = !copilotModel || copilotModel === 'Auto' ? [] : ['--model', copilotModel];
391
344
  return ['-p', ...promptArg, ...copilotModelArg, '--allow-all-tools'];
392
345
  }
393
346
  }
394
347
  }
395
348
  export async function runAgent(options) {
396
349
  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
350
  const binary = resolveBinary(agent);
403
351
  const useStdin = !!promptViaStdin;
404
- const args = buildArgs(agent, prompt, model, useStdin, bedrock);
352
+ const args = buildArgs(agent, prompt, model, useStdin);
405
353
  const startedAt = Date.now();
406
354
  onDebugEvent?.('run.start', {
407
355
  agent,
408
356
  binary,
409
357
  model,
410
- bedrock: !!bedrock,
411
358
  timeoutMs,
412
359
  promptLen: prompt.length,
413
360
  promptHead: prompt.slice(0, 500),
414
361
  });
415
362
  return new Promise((resolve) => {
416
- const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : undefined;
417
363
  const child = spawn(binary, args, {
418
364
  stdio: ['pipe', 'pipe', 'pipe'],
419
- ...(bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}),
420
365
  });
421
366
  if (useStdin && child.stdin) {
422
367
  // Guard against EPIPE: the child may close stdin before we finish
@@ -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 { agentSupportsBedrock, buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseMapTokenPropToolCallLines, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
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 { agentSupportsBedrock, buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseMapTokenPropToolCallLines, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
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.32.1-dev-build-3e401c3.0",
3
+ "version": "2.32.1-dev-build-10912f6.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.32.1-dev-build-3e401c3.0"
25
+ "@contentful/experience-design-system-types": "2.32.1-dev-build-10912f6.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "@tsconfig/node24": "^24.0.4",