@standardagents/builder 0.12.1 → 0.12.3

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.
@@ -4697,7 +4697,7 @@ var init_FlowEngine = __esm({
4697
4697
  init_ToolExecutor();
4698
4698
  init_context();
4699
4699
  init_ThreadStateImpl();
4700
- FlowEngine = class {
4700
+ FlowEngine = class _FlowEngine {
4701
4701
  /**
4702
4702
  * Main execution entry point
4703
4703
  * Executes an agent conversation until stopped or max steps reached
@@ -4832,6 +4832,30 @@ var init_FlowEngine = __esm({
4832
4832
  }
4833
4833
  await state.stream.close();
4834
4834
  }
4835
+ /**
4836
+ * Convert a PromptDefinition (from definePrompt) to PromptData (runtime format).
4837
+ */
4838
+ static convertPromptDefinition(id, def) {
4839
+ return {
4840
+ id,
4841
+ name: def.name,
4842
+ tool_description: def.toolDescription,
4843
+ prompt: def.prompt,
4844
+ model: def.model,
4845
+ include_chat: def.includeChat ?? false,
4846
+ include_past_tools: def.includePastTools ?? false,
4847
+ parallel_tool_calls: def.parallelToolCalls ?? false,
4848
+ tool_choice: def.toolChoice ?? "auto",
4849
+ reasoning_effort: def.reasoning?.effort ?? null,
4850
+ reasoning_max_tokens: def.reasoning?.maxTokens ?? null,
4851
+ reasoning_exclude: def.reasoning?.exclude ?? false,
4852
+ include_reasoning: def.reasoning?.include ?? false,
4853
+ recentImageThreshold: def.recentImageThreshold ?? null,
4854
+ _tools: def.tools ?? [],
4855
+ _requiredSchema: def.requiredSchema ?? null,
4856
+ _hooks: def.hooks ?? []
4857
+ };
4858
+ }
4835
4859
  /**
4836
4860
  * Load prompts from TypeScript configs via virtual modules.
4837
4861
  *
@@ -4849,23 +4873,7 @@ var init_FlowEngine = __esm({
4849
4873
  if (sideAPromptDef.tools?.length) {
4850
4874
  console.log(`[FlowEngine] Prompt tools: [${sideAPromptDef.tools.map((t) => typeof t === "string" ? t : t.name).join(", ")}]`);
4851
4875
  }
4852
- const sideAPrompt = {
4853
- id: sideAPromptName,
4854
- name: sideAPromptDef.name,
4855
- tool_description: sideAPromptDef.toolDescription,
4856
- prompt: sideAPromptDef.prompt,
4857
- model: sideAPromptDef.model,
4858
- include_chat: sideAPromptDef.includeChat ?? false,
4859
- include_past_tools: sideAPromptDef.includePastTools ?? false,
4860
- parallel_tool_calls: sideAPromptDef.parallelToolCalls ?? false,
4861
- tool_choice: sideAPromptDef.toolChoice ?? "auto",
4862
- reasoning_effort: sideAPromptDef.reasoning?.effort ?? null,
4863
- reasoning_max_tokens: sideAPromptDef.reasoning?.maxTokens ?? null,
4864
- reasoning_exclude: sideAPromptDef.reasoning?.exclude ?? false,
4865
- include_reasoning: sideAPromptDef.reasoning?.include ?? false,
4866
- _tools: sideAPromptDef.tools ?? [],
4867
- _requiredSchema: sideAPromptDef.requiredSchema ?? null
4868
- };
4876
+ const sideAPrompt = _FlowEngine.convertPromptDefinition(sideAPromptName, sideAPromptDef);
4869
4877
  let sideBPrompt = null;
4870
4878
  const sideBPromptName = agentConfig.side_b_agent_prompt;
4871
4879
  if (sideBPromptName) {
@@ -4875,23 +4883,7 @@ var init_FlowEngine = __esm({
4875
4883
  if (sideBPromptDef.tools?.length) {
4876
4884
  console.log(`[FlowEngine] Prompt tools: [${sideBPromptDef.tools.map((t) => typeof t === "string" ? t : t.name).join(", ")}]`);
4877
4885
  }
4878
- sideBPrompt = {
4879
- id: sideBPromptName,
4880
- name: sideBPromptDef.name,
4881
- tool_description: sideBPromptDef.toolDescription,
4882
- prompt: sideBPromptDef.prompt,
4883
- model: sideBPromptDef.model,
4884
- include_chat: sideBPromptDef.includeChat ?? false,
4885
- include_past_tools: sideBPromptDef.includePastTools ?? false,
4886
- parallel_tool_calls: sideBPromptDef.parallelToolCalls ?? false,
4887
- tool_choice: sideBPromptDef.toolChoice ?? "auto",
4888
- reasoning_effort: sideBPromptDef.reasoning?.effort ?? null,
4889
- reasoning_max_tokens: sideBPromptDef.reasoning?.maxTokens ?? null,
4890
- reasoning_exclude: sideBPromptDef.reasoning?.exclude ?? false,
4891
- include_reasoning: sideBPromptDef.reasoning?.include ?? false,
4892
- _tools: sideBPromptDef.tools ?? [],
4893
- _requiredSchema: sideBPromptDef.requiredSchema ?? null
4894
- };
4886
+ sideBPrompt = _FlowEngine.convertPromptDefinition(sideBPromptName, sideBPromptDef);
4895
4887
  }
4896
4888
  return { agentConfig, sideAPrompt, sideBPrompt };
4897
4889
  }
@@ -23273,8 +23265,8 @@ var index_post_default4 = defineController(async ({ req, env: env2 }) => {
23273
23265
 
23274
23266
  // src/api/agents/[name].get.ts
23275
23267
  var name_get_default = defineController(async ({ params, agents, prompts, promptNames }) => {
23276
- const { name } = params;
23277
- if (!agents || !agents[name]) {
23268
+ const name = params.name ? decodeURIComponent(params.name) : void 0;
23269
+ if (!name || !agents || !agents[name]) {
23278
23270
  return Response.json({ error: "Agent not found" }, { status: 404 });
23279
23271
  }
23280
23272
  try {
@@ -23374,7 +23366,7 @@ var id_delete_default = defineController(async ({ req, env: env2, params }) => {
23374
23366
 
23375
23367
  // src/api/models/[name].get.ts
23376
23368
  var name_get_default2 = defineController(async ({ params, models }) => {
23377
- const { name } = params;
23369
+ const name = params.name ? decodeURIComponent(params.name) : void 0;
23378
23370
  if (!name) {
23379
23371
  return Response.json({ error: "Model name is required" }, { status: 400 });
23380
23372
  }
@@ -25056,8 +25048,8 @@ function normalizePromptContent2(prompt) {
25056
25048
  return prompt;
25057
25049
  }
25058
25050
  var name_get_default3 = defineController(async ({ params, prompts, models, modelNames }) => {
25059
- const { name } = params;
25060
- if (!prompts || !prompts[name]) {
25051
+ const name = params.name ? decodeURIComponent(params.name) : void 0;
25052
+ if (!name || !prompts || !prompts[name]) {
25061
25053
  return Response.json({ error: "Prompt not found" }, { status: 404 });
25062
25054
  }
25063
25055
  try {
@@ -25113,6 +25105,7 @@ var name_get_default3 = defineController(async ({ params, prompts, models, model
25113
25105
  tool_choice: definition.toolChoice || "auto",
25114
25106
  tools,
25115
25107
  reasoning: definition.reasoning || null,
25108
+ hooks: definition.hooks || [],
25116
25109
  created_at: Math.floor(Date.now() / 1e3)
25117
25110
  };
25118
25111
  return Response.json({ prompt });
@@ -25358,8 +25351,8 @@ function toJSONSchema5(schema) {
25358
25351
  }
25359
25352
  }
25360
25353
  var name_get_default4 = defineController(async ({ params, tools }) => {
25361
- const { name } = params;
25362
- if (!tools || !tools[name]) {
25354
+ const name = params.name ? decodeURIComponent(params.name) : void 0;
25355
+ if (!name || !tools || !tools[name]) {
25363
25356
  return Response.json({ error: "Tool not found" }, { status: 404 });
25364
25357
  }
25365
25358
  try {
@@ -26477,8 +26470,8 @@ function extractTenvsFromSchema(tenvSchema) {
26477
26470
  return tenvs;
26478
26471
  }
26479
26472
  var tenvs_get_default = defineController(async ({ params, agents, prompts, promptNames, models, modelNames }) => {
26480
- const { name: agentName } = params;
26481
- if (!agents || !agents[agentName]) {
26473
+ const agentName = params.name ? decodeURIComponent(params.name) : void 0;
26474
+ if (!agentName || !agents || !agents[agentName]) {
26482
26475
  return Response.json({ error: "Agent not found" }, { status: 404 });
26483
26476
  }
26484
26477
  const discoveredTenvs = [];
@@ -26609,7 +26602,7 @@ var API_KEY_ENV_VARS = {
26609
26602
  google: "GOOGLE_API_KEY"
26610
26603
  };
26611
26604
  var curl_data_get_default = defineController(async ({ params, models, env: env2 }) => {
26612
- const { name } = params;
26605
+ const name = params.name ? decodeURIComponent(params.name) : void 0;
26613
26606
  if (!name) {
26614
26607
  return Response.json({ error: "Model name is required" }, { status: 400 });
26615
26608
  }
@@ -27035,8 +27028,8 @@ function extractTenvsFromSchema2(tenvSchema) {
27035
27028
  return tenvs;
27036
27029
  }
27037
27030
  var tenvs_get_default2 = defineController(async ({ params, prompts, models, modelNames }) => {
27038
- const { name: promptName } = params;
27039
- if (!prompts || !prompts[promptName]) {
27031
+ const promptName = params.name ? decodeURIComponent(params.name) : void 0;
27032
+ if (!promptName || !prompts || !prompts[promptName]) {
27040
27033
  return Response.json({ error: "Prompt not found" }, { status: 404 });
27041
27034
  }
27042
27035
  const allTenvs = [];
@@ -27141,7 +27134,7 @@ function placeholderSvg(name) {
27141
27134
  return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="24" height="24"><circle cx="12" cy="12" r="10" fill="#e5e7eb"/><text x="12" y="16" text-anchor="middle" font-size="12" font-family="system-ui" fill="#6b7280">${letter}</text></svg>`;
27142
27135
  }
27143
27136
  var icon_get_default = defineController(async ({ params, url }) => {
27144
- const { name: providerName } = params;
27137
+ const providerName = params.name ? decodeURIComponent(params.name) : void 0;
27145
27138
  const modelId = url.searchParams.get("model") || void 0;
27146
27139
  if (!providerName) {
27147
27140
  return Response.json({ error: "Provider name is required" }, { status: 400 });
@@ -27220,7 +27213,7 @@ function extractTenvsFromSchema3(tenvSchema) {
27220
27213
  return tenvs;
27221
27214
  }
27222
27215
  var tools_get_default2 = defineController(async ({ params, url, env: env2 }) => {
27223
- const { name: providerName } = params;
27216
+ const providerName = params.name ? decodeURIComponent(params.name) : void 0;
27224
27217
  const modelId = url.searchParams.get("model") || void 0;
27225
27218
  if (!providerName) {
27226
27219
  return Response.json({ error: "Provider name is required" }, { status: 400 });