@contentful/experience-design-system-generation 2.27.1-dev-build-16b0c21.0 → 2.27.1-dev-build-887759e.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-invoker.d.ts +1 -0
- package/dist/src/agent-runner.d.ts +10 -0
- package/dist/src/agent-runner.js +21 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/index.js +1 -1
- package/package.json +2 -2
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@contentful/experience-design-system-generation",
|
|
3
|
-
"version": "2.27.1-dev-build-
|
|
3
|
+
"version": "2.27.1-dev-build-887759e.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",
|
|
@@ -90,6 +90,7 @@ export interface ParsedToolCalls {
|
|
|
90
90
|
export declare function parseToolCallLines(stdout: string): ParsedToolCalls;
|
|
91
91
|
export declare function parseTokenToolCallLines(stdout: string): ParsedTokenToolCalls;
|
|
92
92
|
export declare function resolveBinary(agent: AgentName): string;
|
|
93
|
+
export declare function agentSupportsBedrock(agent: AgentName): boolean;
|
|
93
94
|
/**
|
|
94
95
|
* Resolve the model for an agent. Explicit flag/creds value wins, then a
|
|
95
96
|
* per-agent `EDS_AGENT_MODEL_<AGENT>` env override (mirrors the
|
|
@@ -104,6 +105,15 @@ export declare function runAgent(options: {
|
|
|
104
105
|
prompt: string;
|
|
105
106
|
timeoutMs: number;
|
|
106
107
|
model?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Route the selected agent's model calls through AWS Bedrock instead of its
|
|
110
|
+
* default provider, by setting that agent's Bedrock-routing env var(s) (see
|
|
111
|
+
* BEDROCK_ENV_BY_AGENT) on the spawned process. AWS credentials (AWS_PROFILE,
|
|
112
|
+
* or AWS_ACCESS_KEY_ID/AWS_SECRET_ACCESS_KEY/AWS_SESSION_TOKEN, plus
|
|
113
|
+
* AWS_REGION) must already be present in the parent env — this only flips
|
|
114
|
+
* the routing switch. No-op for agents with no entry in BEDROCK_ENV_BY_AGENT.
|
|
115
|
+
*/
|
|
116
|
+
bedrock?: boolean;
|
|
107
117
|
onOutput?: (chunk: string) => void;
|
|
108
118
|
/**
|
|
109
119
|
* Deliver the prompt on stdin instead of as an argv positional. Required for
|
package/dist/src/agent-runner.js
CHANGED
|
@@ -234,6 +234,23 @@ export function resolveBinary(agent) {
|
|
|
234
234
|
return override.trim();
|
|
235
235
|
return AGENT_BINARIES[agent];
|
|
236
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Per-agent env vars that switch that agent's CLI to route model calls
|
|
239
|
+
* through AWS Bedrock instead of its default provider. Populated only for
|
|
240
|
+
* agents with a confirmed, simple boolean-style switch — `claude`'s
|
|
241
|
+
* CLAUDE_CODE_USE_BEDROCK=1. Not every agent has one: AWS Bedrock doesn't
|
|
242
|
+
* host OpenAI/GPT models at all (so `codex` has no Bedrock path), and
|
|
243
|
+
* `cursor-agent` exposes no AWS/Bedrock flag in its CLI. `opencode` likely
|
|
244
|
+
* supports Bedrock via a `bedrock/<model-id>` model string rather than a
|
|
245
|
+
* toggle env var — add it here once that's confirmed, rather than routing it
|
|
246
|
+
* through this same mechanism.
|
|
247
|
+
*/
|
|
248
|
+
const BEDROCK_ENV_BY_AGENT = {
|
|
249
|
+
claude: { CLAUDE_CODE_USE_BEDROCK: '1' },
|
|
250
|
+
};
|
|
251
|
+
export function agentSupportsBedrock(agent) {
|
|
252
|
+
return agent in BEDROCK_ENV_BY_AGENT;
|
|
253
|
+
}
|
|
237
254
|
/**
|
|
238
255
|
* Default models per agent — lightweight/fast picks to control cost when no
|
|
239
256
|
* explicit model is configured. cursor uses `gpt-mini` (verified alias from
|
|
@@ -279,7 +296,7 @@ export function buildArgs(agent, prompt, model, promptViaStdin = false) {
|
|
|
279
296
|
}
|
|
280
297
|
}
|
|
281
298
|
export async function runAgent(options) {
|
|
282
|
-
const { agent, prompt, timeoutMs, model, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
299
|
+
const { agent, prompt, timeoutMs, model, bedrock, onOutput, promptViaStdin, onDebugEvent } = options;
|
|
283
300
|
const binary = resolveBinary(agent);
|
|
284
301
|
const useStdin = !!promptViaStdin;
|
|
285
302
|
const args = buildArgs(agent, prompt, model, useStdin);
|
|
@@ -288,13 +305,16 @@ export async function runAgent(options) {
|
|
|
288
305
|
agent,
|
|
289
306
|
binary,
|
|
290
307
|
model,
|
|
308
|
+
bedrock: !!bedrock,
|
|
291
309
|
timeoutMs,
|
|
292
310
|
promptLen: prompt.length,
|
|
293
311
|
promptHead: prompt.slice(0, 500),
|
|
294
312
|
});
|
|
295
313
|
return new Promise((resolve) => {
|
|
314
|
+
const bedrockEnv = bedrock ? BEDROCK_ENV_BY_AGENT[agent] : undefined;
|
|
296
315
|
const child = spawn(binary, args, {
|
|
297
316
|
stdio: ['pipe', 'pipe', 'pipe'],
|
|
317
|
+
...(bedrockEnv ? { env: { ...process.env, ...bedrockEnv } } : {}),
|
|
298
318
|
});
|
|
299
319
|
if (useStdin && child.stdin) {
|
|
300
320
|
// 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 { buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
|
|
3
|
+
export { agentSupportsBedrock, buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
|
|
4
4
|
export type { AgentAuthStatus, AgentDebugEvent, AgentRunResult, ClassifyComponentCall, ClassifyPropCall, ClassifySlotCall, ExcludePropCall, 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 { buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, parseSelectToolCallLines, parseTokenToolCallLines, parseToolCallLines, resolveAgentModel, resolveBinary, runAgent, } from './agent-runner.js';
|
|
4
|
+
export { agentSupportsBedrock, buildArgs, checkAgentAuth, describeAgentFailure, extractSentinelOutput, 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.27.1-dev-build-
|
|
3
|
+
"version": "2.27.1-dev-build-887759e.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.27.1-dev-build-
|
|
25
|
+
"@contentful/experience-design-system-types": "2.27.1-dev-build-887759e.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@tsconfig/node24": "^24.0.4",
|