@standardagents/builder 0.13.2 → 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},`);
@@ -2026,34 +2028,28 @@ function transformAgentData(data) {
2026
2028
  transformed.sideA.maxSteps = data.side_a_max_steps;
2027
2029
  }
2028
2030
  const sideASessionStop = toSessionBinding(
2029
- data.side_a_session_stop_tool ?? data.side_a_end_session_tool,
2031
+ data.side_a_session_stop_tool,
2030
2032
  data.side_a_session_stop_message_property,
2031
2033
  data.side_a_session_stop_attachments_property
2032
2034
  );
2033
2035
  if (sideASessionStop !== void 0) {
2034
2036
  transformed.sideA.sessionStop = sideASessionStop;
2035
- } else if (data.side_a_end_session_tool) {
2036
- transformed.sideA.endSessionTool = data.side_a_end_session_tool;
2037
2037
  }
2038
2038
  const sideASessionFail = toSessionBinding(
2039
- data.side_a_session_fail_tool ?? data.side_a_fail_session_tool,
2039
+ data.side_a_session_fail_tool,
2040
2040
  data.side_a_session_fail_message_property,
2041
2041
  data.side_a_session_fail_attachments_property
2042
2042
  );
2043
2043
  if (sideASessionFail !== void 0) {
2044
2044
  transformed.sideA.sessionFail = sideASessionFail;
2045
- } else if (data.side_a_fail_session_tool) {
2046
- transformed.sideA.failSessionTool = data.side_a_fail_session_tool;
2047
2045
  }
2048
2046
  const sideASessionStatus = toSessionBinding(
2049
- data.side_a_session_status_tool ?? data.side_a_status_tool,
2047
+ data.side_a_session_status_tool,
2050
2048
  data.side_a_session_status_message_property,
2051
2049
  data.side_a_session_status_attachments_property
2052
2050
  );
2053
2051
  if (sideASessionStatus !== void 0) {
2054
2052
  transformed.sideA.sessionStatus = sideASessionStatus;
2055
- } else if (data.side_a_status_tool) {
2056
- transformed.sideA.statusTool = data.side_a_status_tool;
2057
2053
  }
2058
2054
  if (data.side_a_manual_stop_condition !== void 0) {
2059
2055
  transformed.sideA.manualStopCondition = data.side_a_manual_stop_condition;
@@ -2078,34 +2074,28 @@ function transformAgentData(data) {
2078
2074
  transformed.sideB.maxSteps = data.side_b_max_steps;
2079
2075
  }
2080
2076
  const sideBSessionStop = toSessionBinding(
2081
- data.side_b_session_stop_tool ?? data.side_b_end_session_tool,
2077
+ data.side_b_session_stop_tool,
2082
2078
  data.side_b_session_stop_message_property,
2083
2079
  data.side_b_session_stop_attachments_property
2084
2080
  );
2085
2081
  if (sideBSessionStop !== void 0) {
2086
2082
  transformed.sideB.sessionStop = sideBSessionStop;
2087
- } else if (data.side_b_end_session_tool) {
2088
- transformed.sideB.endSessionTool = data.side_b_end_session_tool;
2089
2083
  }
2090
2084
  const sideBSessionFail = toSessionBinding(
2091
- data.side_b_session_fail_tool ?? data.side_b_fail_session_tool,
2085
+ data.side_b_session_fail_tool,
2092
2086
  data.side_b_session_fail_message_property,
2093
2087
  data.side_b_session_fail_attachments_property
2094
2088
  );
2095
2089
  if (sideBSessionFail !== void 0) {
2096
2090
  transformed.sideB.sessionFail = sideBSessionFail;
2097
- } else if (data.side_b_fail_session_tool) {
2098
- transformed.sideB.failSessionTool = data.side_b_fail_session_tool;
2099
2091
  }
2100
2092
  const sideBSessionStatus = toSessionBinding(
2101
- data.side_b_session_status_tool ?? data.side_b_status_tool,
2093
+ data.side_b_session_status_tool,
2102
2094
  data.side_b_session_status_message_property,
2103
2095
  data.side_b_session_status_attachments_property
2104
2096
  );
2105
2097
  if (sideBSessionStatus !== void 0) {
2106
2098
  transformed.sideB.sessionStatus = sideBSessionStatus;
2107
- } else if (data.side_b_status_tool) {
2108
- transformed.sideB.statusTool = data.side_b_status_tool;
2109
2099
  }
2110
2100
  if (data.side_b_manual_stop_condition !== void 0) {
2111
2101
  transformed.sideB.manualStopCondition = data.side_b_manual_stop_condition;