@standardagents/builder 0.13.1 → 0.14.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/plugin.js CHANGED
@@ -185,7 +185,6 @@ function generateTypesContent(config) {
185
185
  const agents = agentResults.map((a) => a.name);
186
186
  const callables = [...prompts, ...agents, ...tools];
187
187
  return `// Auto-generated by @standardagents/builder - DO NOT EDIT
188
- // Generated at: ${(/* @__PURE__ */ new Date()).toISOString()}
189
188
  //
190
189
  // This file augments the StandardAgentSpec namespace declared in @standardagents/spec
191
190
  // to provide type-safe references for your models, prompts, agents, tools, and hooks.
@@ -474,7 +473,7 @@ declare module 'virtual:@standardagents/builder' {
474
473
  offset?: number,
475
474
  order?: 'ASC' | 'DESC'
476
475
  ): Promise<GetLogsResult>;
477
- getLogDetails(logId: string): Promise<ThreadLogDetails>;
476
+ getLogDetails(logId: string): Promise<ThreadLogDetails | null>;
478
477
 
479
478
  // Thread management methods
480
479
  getThreadMeta(threadId: string): Promise<ThreadMetaResult>;
@@ -730,14 +729,23 @@ function ensureDir(dir) {
730
729
  fs4__default.mkdirSync(dir, { recursive: true });
731
730
  }
732
731
  }
732
+ function writeFileIfChanged(filePath, content) {
733
+ if (fs4__default.existsSync(filePath)) {
734
+ const existing = fs4__default.readFileSync(filePath, "utf-8");
735
+ if (existing === content) {
736
+ return;
737
+ }
738
+ }
739
+ fs4__default.writeFileSync(filePath, content);
740
+ }
733
741
  function generateTypes(config) {
734
742
  ensureDir(config.outputDir);
735
743
  const typesContent = generateTypesContent(config);
736
- fs4__default.writeFileSync(path8__default.join(config.outputDir, "types.d.ts"), typesContent);
744
+ writeFileIfChanged(path8__default.join(config.outputDir, "types.d.ts"), typesContent);
737
745
  const virtualModuleContent = generateVirtualModuleContent();
738
- fs4__default.writeFileSync(path8__default.join(config.outputDir, "virtual-module.d.ts"), virtualModuleContent);
739
- fs4__default.writeFileSync(path8__default.join(config.outputDir, "tsconfig.json"), TSCONFIG_CONTENT);
740
- fs4__default.writeFileSync(path8__default.join(config.outputDir, ".gitignore"), "*\n");
746
+ writeFileIfChanged(path8__default.join(config.outputDir, "virtual-module.d.ts"), virtualModuleContent);
747
+ writeFileIfChanged(path8__default.join(config.outputDir, "tsconfig.json"), TSCONFIG_CONTENT);
748
+ writeFileIfChanged(path8__default.join(config.outputDir, ".gitignore"), "*\n");
741
749
  }
742
750
  function needsRegeneration(config) {
743
751
  const typesPath = path8__default.join(config.outputDir, "types.d.ts");
@@ -1346,18 +1354,12 @@ function formatSideConfig(config) {
1346
1354
  }
1347
1355
  if (config.sessionStop) {
1348
1356
  parts.push(` sessionStop: ${formatSessionBinding(config.sessionStop)},`);
1349
- } else if (config.endSessionTool) {
1350
- parts.push(` endSessionTool: '${escapeString3(config.endSessionTool)}',`);
1351
1357
  }
1352
1358
  if (config.sessionFail) {
1353
1359
  parts.push(` sessionFail: ${formatSessionBinding(config.sessionFail)},`);
1354
- } else if (config.failSessionTool) {
1355
- parts.push(` failSessionTool: '${escapeString3(config.failSessionTool)}',`);
1356
1360
  }
1357
1361
  if (config.sessionStatus) {
1358
1362
  parts.push(` sessionStatus: ${formatSessionBinding(config.sessionStatus)},`);
1359
- } else if (config.statusTool) {
1360
- parts.push(` statusTool: '${escapeString3(config.statusTool)}',`);
1361
1363
  }
1362
1364
  if (config.manualStopCondition) {
1363
1365
  parts.push(` manualStopCondition: ${config.manualStopCondition},`);
@@ -1384,23 +1386,47 @@ function formatSessionBinding(binding) {
1384
1386
 
1385
1387
  // src/providers/catalog.ts
1386
1388
  var FIRST_PARTY_PROVIDERS = [
1389
+ {
1390
+ name: "cloudflare",
1391
+ package: "@standardagents/cloudflare",
1392
+ label: "Cloudflare Workers AI",
1393
+ envKeys: ["CLOUDFLARE_API_TOKEN", "CLOUDFLARE_ACCOUNT_ID"]
1394
+ },
1387
1395
  {
1388
1396
  name: "cerebras",
1389
1397
  package: "@standardagents/cerebras",
1390
1398
  label: "Cerebras",
1391
- envKey: "CEREBRAS_API_KEY"
1399
+ envKeys: ["CEREBRAS_API_KEY"]
1400
+ },
1401
+ {
1402
+ name: "google",
1403
+ package: "@standardagents/google",
1404
+ label: "Google Gemini",
1405
+ envKeys: ["GOOGLE_API_KEY"]
1406
+ },
1407
+ {
1408
+ name: "groq",
1409
+ package: "@standardagents/groq",
1410
+ label: "Groq",
1411
+ envKeys: ["GROQ_API_KEY"]
1392
1412
  },
1393
1413
  {
1394
1414
  name: "openai",
1395
1415
  package: "@standardagents/openai",
1396
1416
  label: "OpenAI",
1397
- envKey: "OPENAI_API_KEY"
1417
+ envKeys: ["OPENAI_API_KEY"]
1398
1418
  },
1399
1419
  {
1400
1420
  name: "openrouter",
1401
1421
  package: "@standardagents/openrouter",
1402
1422
  label: "OpenRouter",
1403
- envKey: "OPENROUTER_API_KEY"
1423
+ envKeys: ["OPENROUTER_API_KEY"]
1424
+ },
1425
+ {
1426
+ name: "xai",
1427
+ package: "@standardagents/xai",
1428
+ label: "xAI",
1429
+ envKeys: ["XAI_API_KEY"]
1404
1430
  }
1405
1431
  ];
1406
1432
  function humanizeProviderName(name) {
@@ -1412,7 +1438,7 @@ function packageToCustomProvider(pkg) {
1412
1438
  name,
1413
1439
  package: pkg,
1414
1440
  label: humanizeProviderName(name),
1415
- envKey: `${name.toUpperCase().replace(/-/g, "_")}_API_KEY`,
1441
+ envKeys: [`${name.toUpperCase().replace(/-/g, "_")}_API_KEY`],
1416
1442
  isCustom: true
1417
1443
  };
1418
1444
  }
@@ -2002,34 +2028,28 @@ function transformAgentData(data) {
2002
2028
  transformed.sideA.maxSteps = data.side_a_max_steps;
2003
2029
  }
2004
2030
  const sideASessionStop = toSessionBinding(
2005
- data.side_a_session_stop_tool ?? data.side_a_end_session_tool,
2031
+ data.side_a_session_stop_tool,
2006
2032
  data.side_a_session_stop_message_property,
2007
2033
  data.side_a_session_stop_attachments_property
2008
2034
  );
2009
2035
  if (sideASessionStop !== void 0) {
2010
2036
  transformed.sideA.sessionStop = sideASessionStop;
2011
- } else if (data.side_a_end_session_tool) {
2012
- transformed.sideA.endSessionTool = data.side_a_end_session_tool;
2013
2037
  }
2014
2038
  const sideASessionFail = toSessionBinding(
2015
- data.side_a_session_fail_tool ?? data.side_a_fail_session_tool,
2039
+ data.side_a_session_fail_tool,
2016
2040
  data.side_a_session_fail_message_property,
2017
2041
  data.side_a_session_fail_attachments_property
2018
2042
  );
2019
2043
  if (sideASessionFail !== void 0) {
2020
2044
  transformed.sideA.sessionFail = sideASessionFail;
2021
- } else if (data.side_a_fail_session_tool) {
2022
- transformed.sideA.failSessionTool = data.side_a_fail_session_tool;
2023
2045
  }
2024
2046
  const sideASessionStatus = toSessionBinding(
2025
- data.side_a_session_status_tool ?? data.side_a_status_tool,
2047
+ data.side_a_session_status_tool,
2026
2048
  data.side_a_session_status_message_property,
2027
2049
  data.side_a_session_status_attachments_property
2028
2050
  );
2029
2051
  if (sideASessionStatus !== void 0) {
2030
2052
  transformed.sideA.sessionStatus = sideASessionStatus;
2031
- } else if (data.side_a_status_tool) {
2032
- transformed.sideA.statusTool = data.side_a_status_tool;
2033
2053
  }
2034
2054
  if (data.side_a_manual_stop_condition !== void 0) {
2035
2055
  transformed.sideA.manualStopCondition = data.side_a_manual_stop_condition;
@@ -2054,34 +2074,28 @@ function transformAgentData(data) {
2054
2074
  transformed.sideB.maxSteps = data.side_b_max_steps;
2055
2075
  }
2056
2076
  const sideBSessionStop = toSessionBinding(
2057
- data.side_b_session_stop_tool ?? data.side_b_end_session_tool,
2077
+ data.side_b_session_stop_tool,
2058
2078
  data.side_b_session_stop_message_property,
2059
2079
  data.side_b_session_stop_attachments_property
2060
2080
  );
2061
2081
  if (sideBSessionStop !== void 0) {
2062
2082
  transformed.sideB.sessionStop = sideBSessionStop;
2063
- } else if (data.side_b_end_session_tool) {
2064
- transformed.sideB.endSessionTool = data.side_b_end_session_tool;
2065
2083
  }
2066
2084
  const sideBSessionFail = toSessionBinding(
2067
- data.side_b_session_fail_tool ?? data.side_b_fail_session_tool,
2085
+ data.side_b_session_fail_tool,
2068
2086
  data.side_b_session_fail_message_property,
2069
2087
  data.side_b_session_fail_attachments_property
2070
2088
  );
2071
2089
  if (sideBSessionFail !== void 0) {
2072
2090
  transformed.sideB.sessionFail = sideBSessionFail;
2073
- } else if (data.side_b_fail_session_tool) {
2074
- transformed.sideB.failSessionTool = data.side_b_fail_session_tool;
2075
2091
  }
2076
2092
  const sideBSessionStatus = toSessionBinding(
2077
- data.side_b_session_status_tool ?? data.side_b_status_tool,
2093
+ data.side_b_session_status_tool,
2078
2094
  data.side_b_session_status_message_property,
2079
2095
  data.side_b_session_status_attachments_property
2080
2096
  );
2081
2097
  if (sideBSessionStatus !== void 0) {
2082
2098
  transformed.sideB.sessionStatus = sideBSessionStatus;
2083
- } else if (data.side_b_status_tool) {
2084
- transformed.sideB.statusTool = data.side_b_status_tool;
2085
2099
  }
2086
2100
  if (data.side_b_manual_stop_condition !== void 0) {
2087
2101
  transformed.sideB.manualStopCondition = data.side_b_manual_stop_condition;
@@ -6588,11 +6602,11 @@ export function getVisibleToolNames() {
6588
6602
  import { DurableThread as _BaseDurableThread } from '@standardagents/builder/runtime';
6589
6603
  import { DurableAgentBuilder as _BaseDurableAgentBuilder } from '@standardagents/builder/runtime';
6590
6604
 
6591
- // Import sip WASM module and initializer
6605
+ // Import sip WASM module and readiness helper
6592
6606
  // Static import allows workerd to pre-compile the WASM at bundle time
6593
6607
  // WASM is bundled in builder's dist to avoid transitive dependency resolution issues
6594
6608
  import _sipWasm from '@standardagents/builder/dist/sip.wasm';
6595
- import { initWithWasmModule as _initSipWasm } from '@standardagents/sip';
6609
+ import { ready as _initSipWasm } from '@standardagents/sip';
6596
6610
 
6597
6611
  // Re-export router from virtual:@standardagents-routes
6598
6612
  export { router } from 'virtual:@standardagents-routes';
@@ -6636,7 +6650,7 @@ export class DurableThread extends _BaseDurableThread {
6636
6650
  // blockConcurrencyWhile ensures WASM is ready before handling any requests
6637
6651
  // Pass the statically imported WASM module for workerd to pre-compile
6638
6652
  ctx.blockConcurrencyWhile(async () => {
6639
- await _initSipWasm(_sipWasm);
6653
+ await _initSipWasm({ wasm: _sipWasm });
6640
6654
  });
6641
6655
  }
6642
6656