terse-cli 0.2.12 → 0.2.14

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.
Files changed (211) hide show
  1. package/dist/codegen.d.ts +0 -15
  2. package/dist/codegen.d.ts.map +1 -1
  3. package/dist/codegen.js +81 -466
  4. package/dist/codegen.js.map +1 -1
  5. package/dist/commands/test.d.ts.map +1 -1
  6. package/dist/commands/test.js +40 -3
  7. package/dist/commands/test.js.map +1 -1
  8. package/dist/deploy.d.ts +1 -2
  9. package/dist/deploy.d.ts.map +1 -1
  10. package/dist/deploy.js +38 -61
  11. package/dist/deploy.js.map +1 -1
  12. package/dist/generate.d.ts +1 -2
  13. package/dist/generate.d.ts.map +1 -1
  14. package/dist/generate.js +69 -67
  15. package/dist/generate.js.map +1 -1
  16. package/dist/init.d.ts +1 -2
  17. package/dist/init.d.ts.map +1 -1
  18. package/dist/init.js +96 -45
  19. package/dist/init.js.map +1 -1
  20. package/dist/integrate.d.ts +0 -1
  21. package/dist/integrate.d.ts.map +1 -1
  22. package/dist/integrate.js +11 -191
  23. package/dist/integrate.js.map +1 -1
  24. package/dist/jsonOutput.d.ts +19 -0
  25. package/dist/jsonOutput.d.ts.map +1 -0
  26. package/dist/jsonOutput.js +25 -0
  27. package/dist/jsonOutput.js.map +1 -0
  28. package/dist/nonInteractive.d.ts +2 -4
  29. package/dist/nonInteractive.d.ts.map +1 -1
  30. package/dist/nonInteractive.js +2 -5
  31. package/dist/nonInteractive.js.map +1 -1
  32. package/dist/providers/LanguageProvider.d.ts +2 -1
  33. package/dist/providers/LanguageProvider.d.ts.map +1 -1
  34. package/dist/providers/python/PythonProvider.js +0 -1
  35. package/dist/providers/python/PythonProvider.js.map +1 -1
  36. package/dist/providers/typescript/TypeScriptProvider.d.ts +2 -1
  37. package/dist/providers/typescript/TypeScriptProvider.d.ts.map +1 -1
  38. package/dist/providers/typescript/TypeScriptProvider.js.map +1 -1
  39. package/dist/providers/typescript/parkSignals.d.ts +7 -0
  40. package/dist/providers/typescript/parkSignals.d.ts.map +1 -0
  41. package/dist/providers/typescript/parkSignals.js +45 -0
  42. package/dist/providers/typescript/parkSignals.js.map +1 -0
  43. package/dist/providers/typescript/prepareCodegenData.d.ts.map +1 -1
  44. package/dist/providers/typescript/prepareCodegenData.js +299 -311
  45. package/dist/providers/typescript/prepareCodegenData.js.map +1 -1
  46. package/dist/providers/typescript/runtimes/JobRuntime.d.ts +2 -1
  47. package/dist/providers/typescript/runtimes/JobRuntime.d.ts.map +1 -1
  48. package/dist/providers/typescript/runtimes/JobRuntime.js.map +1 -1
  49. package/dist/providers/typescript/runtimes/directJobRuntime.d.ts.map +1 -1
  50. package/dist/providers/typescript/runtimes/directJobRuntime.js +1 -1
  51. package/dist/providers/typescript/runtimes/directJobRuntime.js.map +1 -1
  52. package/dist/providers/typescript/runtimes/durableJobRuntime.d.ts.map +1 -1
  53. package/dist/providers/typescript/runtimes/durableJobRuntime.js +1 -1
  54. package/dist/providers/typescript/runtimes/durableJobRuntime.js.map +1 -1
  55. package/dist/providers/typescript/runtimes/session.d.ts +2 -1
  56. package/dist/providers/typescript/runtimes/session.d.ts.map +1 -1
  57. package/dist/providers/typescript/runtimes/session.js +2 -1
  58. package/dist/providers/typescript/runtimes/session.js.map +1 -1
  59. package/dist/replay.d.ts +3 -0
  60. package/dist/replay.d.ts.map +1 -0
  61. package/dist/replay.js +20 -0
  62. package/dist/replay.js.map +1 -0
  63. package/dist/run.d.ts +11 -2
  64. package/dist/run.d.ts.map +1 -1
  65. package/dist/run.js +153 -42
  66. package/dist/run.js.map +1 -1
  67. package/dist/runLocalTestJob.d.ts +2 -1
  68. package/dist/runLocalTestJob.d.ts.map +1 -1
  69. package/dist/runLocalTestJob.js +1 -0
  70. package/dist/runLocalTestJob.js.map +1 -1
  71. package/dist/sampleEventId.d.ts +4 -0
  72. package/dist/sampleEventId.d.ts.map +1 -1
  73. package/dist/sampleEventId.js +4 -0
  74. package/dist/sampleEventId.js.map +1 -1
  75. package/dist/shared/ApiRoutes.d.ts +0 -19
  76. package/dist/shared/ApiRoutes.d.ts.map +1 -1
  77. package/dist/shared/ApiRoutes.js +1 -17
  78. package/dist/shared/ApiRoutes.js.map +1 -1
  79. package/dist/shared/Configs.d.ts +2 -24
  80. package/dist/shared/Configs.d.ts.map +1 -1
  81. package/dist/shared/Configs.js +2 -32
  82. package/dist/shared/Configs.js.map +1 -1
  83. package/dist/shared/Integrations.d.ts +1 -18
  84. package/dist/shared/Integrations.d.ts.map +1 -1
  85. package/dist/shared/Integrations.js +1 -10
  86. package/dist/shared/Integrations.js.map +1 -1
  87. package/dist/shared/InvalidationKeys.d.ts +0 -1
  88. package/dist/shared/InvalidationKeys.d.ts.map +1 -1
  89. package/dist/shared/InvalidationKeys.js +0 -3
  90. package/dist/shared/InvalidationKeys.js.map +1 -1
  91. package/dist/shared/ModelEvents.d.ts +0 -9
  92. package/dist/shared/ModelEvents.d.ts.map +1 -1
  93. package/dist/shared/ModelEvents.js +0 -15
  94. package/dist/shared/ModelEvents.js.map +1 -1
  95. package/dist/shared/ToolDisplayUtils.d.ts.map +1 -1
  96. package/dist/shared/ToolDisplayUtils.js +11 -107
  97. package/dist/shared/ToolDisplayUtils.js.map +1 -1
  98. package/dist/shared/types.d.ts +108 -1013
  99. package/dist/shared/types.d.ts.map +1 -1
  100. package/dist/shared/types.js.map +1 -1
  101. package/dist/test.d.ts +1 -2
  102. package/dist/test.d.ts.map +1 -1
  103. package/dist/test.js +23 -43
  104. package/dist/test.js.map +1 -1
  105. package/dist/testRelay.d.ts +6 -0
  106. package/dist/testRelay.d.ts.map +1 -0
  107. package/dist/testRelay.js +91 -0
  108. package/dist/testRelay.js.map +1 -0
  109. package/dist/urls.d.ts +3 -0
  110. package/dist/urls.d.ts.map +1 -0
  111. package/dist/urls.js +27 -0
  112. package/dist/urls.js.map +1 -0
  113. package/dist/util.d.ts +3 -2
  114. package/dist/util.d.ts.map +1 -1
  115. package/dist/util.js +3 -3
  116. package/dist/util.js.map +1 -1
  117. package/package.json +3 -3
  118. package/dist/_tmp_create_project.d.ts +0 -2
  119. package/dist/_tmp_create_project.d.ts.map +0 -1
  120. package/dist/_tmp_create_project.js +0 -17
  121. package/dist/_tmp_create_project.js.map +0 -1
  122. package/dist/_tmp_delete_agent.d.ts +0 -2
  123. package/dist/_tmp_delete_agent.d.ts.map +0 -1
  124. package/dist/_tmp_delete_agent.js +0 -14
  125. package/dist/_tmp_delete_agent.js.map +0 -1
  126. package/dist/_tmp_manual_trigger.d.ts +0 -2
  127. package/dist/_tmp_manual_trigger.d.ts.map +0 -1
  128. package/dist/_tmp_manual_trigger.js +0 -17
  129. package/dist/_tmp_manual_trigger.js.map +0 -1
  130. package/dist/_tmp_patch_active.d.ts +0 -2
  131. package/dist/_tmp_patch_active.d.ts.map +0 -1
  132. package/dist/_tmp_patch_active.js +0 -21
  133. package/dist/_tmp_patch_active.js.map +0 -1
  134. package/dist/commands/deployTheme.d.ts +0 -28
  135. package/dist/commands/deployTheme.d.ts.map +0 -1
  136. package/dist/commands/deployTheme.js +0 -68
  137. package/dist/commands/deployTheme.js.map +0 -1
  138. package/dist/commands/dev.d.ts +0 -3
  139. package/dist/commands/dev.d.ts.map +0 -1
  140. package/dist/commands/dev.js +0 -47
  141. package/dist/commands/dev.js.map +0 -1
  142. package/dist/commands/fsExec.d.ts +0 -8
  143. package/dist/commands/fsExec.d.ts.map +0 -1
  144. package/dist/commands/fsExec.js +0 -46
  145. package/dist/commands/fsExec.js.map +0 -1
  146. package/dist/commands/serve.d.ts +0 -1
  147. package/dist/commands/serve.d.ts.map +0 -1
  148. package/dist/commands/serve.js +0 -2
  149. package/dist/commands/serve.js.map +0 -1
  150. package/dist/commands/terseCliTheme.d.ts +0 -28
  151. package/dist/commands/terseCliTheme.d.ts.map +0 -1
  152. package/dist/commands/terseCliTheme.js +0 -68
  153. package/dist/commands/terseCliTheme.js.map +0 -1
  154. package/dist/commands/tool.d.ts +0 -6
  155. package/dist/commands/tool.d.ts.map +0 -1
  156. package/dist/commands/tool.js +0 -34
  157. package/dist/commands/tool.js.map +0 -1
  158. package/dist/data/standardSlackEmoji.d.ts +0 -2
  159. package/dist/data/standardSlackEmoji.d.ts.map +0 -1
  160. package/dist/data/standardSlackEmoji.js +0 -1978
  161. package/dist/data/standardSlackEmoji.js.map +0 -1
  162. package/dist/data/standardSlackEmoji.json +0 -1974
  163. package/dist/perf.d.ts +0 -9
  164. package/dist/perf.d.ts.map +0 -1
  165. package/dist/perf.js +0 -59
  166. package/dist/perf.js.map +0 -1
  167. package/dist/providers/codegen.test.d.ts +0 -2
  168. package/dist/providers/codegen.test.d.ts.map +0 -1
  169. package/dist/providers/codegen.test.js +0 -45
  170. package/dist/providers/codegen.test.js.map +0 -1
  171. package/dist/providers/python/PythonProvider.test.d.ts +0 -2
  172. package/dist/providers/python/PythonProvider.test.d.ts.map +0 -1
  173. package/dist/providers/python/PythonProvider.test.js +0 -169
  174. package/dist/providers/python/PythonProvider.test.js.map +0 -1
  175. package/dist/providers/typescript/prepareCodegenData.test.d.ts +0 -2
  176. package/dist/providers/typescript/prepareCodegenData.test.d.ts.map +0 -1
  177. package/dist/providers/typescript/prepareCodegenData.test.js +0 -54
  178. package/dist/providers/typescript/prepareCodegenData.test.js.map +0 -1
  179. package/dist/providers/typescript/projectedTypes.d.ts +0 -11
  180. package/dist/providers/typescript/projectedTypes.d.ts.map +0 -1
  181. package/dist/providers/typescript/projectedTypes.js +0 -53
  182. package/dist/providers/typescript/projectedTypes.js.map +0 -1
  183. package/dist/providers/typescript/projectionPrinter.d.ts +0 -26
  184. package/dist/providers/typescript/projectionPrinter.d.ts.map +0 -1
  185. package/dist/providers/typescript/projectionPrinter.js +0 -110
  186. package/dist/providers/typescript/projectionPrinter.js.map +0 -1
  187. package/dist/providers/typescript/replayLogDedupe.d.ts +0 -6
  188. package/dist/providers/typescript/replayLogDedupe.d.ts.map +0 -1
  189. package/dist/providers/typescript/replayLogDedupe.js +0 -156
  190. package/dist/providers/typescript/replayLogDedupe.js.map +0 -1
  191. package/dist/providers/typescript/triggerPayloads.d.ts +0 -7
  192. package/dist/providers/typescript/triggerPayloads.d.ts.map +0 -1
  193. package/dist/providers/typescript/triggerPayloads.js +0 -60
  194. package/dist/providers/typescript/triggerPayloads.js.map +0 -1
  195. package/dist/providers/typescript/triggerTypeDeclarations.d.ts +0 -7
  196. package/dist/providers/typescript/triggerTypeDeclarations.d.ts.map +0 -1
  197. package/dist/providers/typescript/triggerTypeDeclarations.js +0 -99
  198. package/dist/providers/typescript/triggerTypeDeclarations.js.map +0 -1
  199. package/dist/providers/typescript/triggerTypeRegistry.d.ts +0 -7
  200. package/dist/providers/typescript/triggerTypeRegistry.d.ts.map +0 -1
  201. package/dist/providers/typescript/triggerTypeRegistry.js +0 -198
  202. package/dist/providers/typescript/triggerTypeRegistry.js.map +0 -1
  203. package/dist/providers/typescript/typePrinter.d.ts +0 -22
  204. package/dist/providers/typescript/typePrinter.d.ts.map +0 -1
  205. package/dist/providers/typescript/typePrinter.js +0 -117
  206. package/dist/providers/typescript/typePrinter.js.map +0 -1
  207. package/dist/triggerParseDetail.d.ts +0 -8
  208. package/dist/triggerParseDetail.d.ts.map +0 -1
  209. package/dist/triggerParseDetail.js +0 -30
  210. package/dist/triggerParseDetail.js.map +0 -1
  211. package/templates/typescript/codegen/.impeccable/hook.cache.json +0 -1
@@ -1,4 +1,5 @@
1
- import { toolsWithIntegrationId } from "terse-types";
1
+ import { ToolDefinitions, toolsWithIntegrationId } from "terse-types";
2
+ import { z } from "zod";
2
3
  function toPascalCase(value) {
3
4
  return value
4
5
  .replace(/[^a-zA-Z0-9]+/g, " ")
@@ -586,17 +587,17 @@ function buildAttioRuntimeLines(objects, lists) {
586
587
  lines.push(" return { ...(raw as object), entry_values: __getAttioEntryValues(__normalizeAttioObjectSlug(list), raw.entry_values) } as AttioListEntryFor<TList>");
587
588
  lines.push("}");
588
589
  lines.push("");
589
- lines.push('function __enhanceAttioListEntriesResult<TList>(list: TList, result: ToolOutputByName["attio_lists"]): AttioListEntriesResult<TList> {');
590
+ lines.push('function __enhanceAttioListEntriesResult<TList>(list: TList, result: ToolOutputByName["attio_read_list_entries"]): AttioListEntriesResult<TList> {');
590
591
  lines.push(" const entries = (result.entries || []).map(entry => __enhanceAttioListEntry(list, entry))");
591
592
  lines.push(" return { entries, count: entries.length, offset: result.offset ?? 0 }");
592
593
  lines.push("}");
593
594
  lines.push("");
594
- lines.push('function __enhanceAttioListEntryResult<TList>(list: TList, result: ToolOutputByName["attio_lists"]): AttioListEntryResult<TList> {');
595
+ lines.push('function __enhanceAttioListEntryResult<TList>(list: TList, result: ToolOutputByName["attio_read_list_entries"]): AttioListEntryResult<TList> {');
595
596
  lines.push(' if (!result.entry) throw new Error("Attio returned a response without the expected list entry payload.")');
596
597
  lines.push(" return __enhanceAttioListEntry(list, result.entry)");
597
598
  lines.push("}");
598
599
  lines.push("");
599
- lines.push('function __enhanceAttioHistoryResult<TValue>(result: ToolOutputByName["attio_records"]): AttioAttributeHistoryResult<TValue> {');
600
+ lines.push('function __enhanceAttioHistoryResult<TValue>(result: ToolOutputByName["attio_read_records"]): AttioAttributeHistoryResult<TValue> {');
600
601
  lines.push(" const history = (result.history || []).map(entry => ({ active_from: entry.active_from, active_until: entry.active_until, value: __flattenAttioLeafValue(entry) as TValue }))");
601
602
  lines.push(" return { history, count: history.length }");
602
603
  lines.push("}");
@@ -800,15 +801,13 @@ function prepareToolsSection(tools, input) {
800
801
  attioPreludeLines.push("export type AttioUpsertRecordParams<TObject extends GeneratedAttioObject = GeneratedAttioObject> = { object: TObject; matchingAttribute: AttioAttributeSlug<TObject>; records: AttioValuesFor<TObject>[] }");
801
802
  attioPreludeLines.push("export type AttioDeleteRecordParams<TObject extends GeneratedAttioObject = GeneratedAttioObject> = { object: TObject; recordId: string }");
802
803
  attioPreludeLines.push("export type AttioGetAttributeHistoryParams<TObject extends GeneratedAttioObject = GeneratedAttioObject> = { object: TObject; recordId: string; attribute: AttioAttributeSlug<TObject>; limit?: number | null; offset?: number | null }");
803
- attioPreludeLines.push("export type AttioListWorkspaceMembersParams = Record<string, never>");
804
- attioPreludeLines.push("export type AttioGetWorkspaceMemberParams = { workspaceMemberId: string }");
805
804
  attioPreludeLines.push('export type AttioWorkspaceMembersResult = ToolOutputByName["attio_workspace_members"]');
806
- attioPreludeLines.push('export type AttioRecordsResult = ToolOutputByName["attio_records"]');
805
+ attioPreludeLines.push('export type AttioRecordsResult = ToolOutputByName["attio_read_records"]');
807
806
  attioPreludeLines.push("export type AttioQueryRecordsResult<TObject extends GeneratedAttioObject = GeneratedAttioObject> = { records: Array<AttioRecordFor<TObject>>; count: number; offset: number }");
808
807
  attioPreludeLines.push('export type AttioSearchRecordsResult = { matches: NonNullable<AttioRecordsResult["matches"]>; count: number }');
809
808
  attioPreludeLines.push("export type AttioUpsertRecordResult<TObject extends GeneratedAttioObject = GeneratedAttioObject> = { records: Array<AttioRecordFor<TObject>>; count: number }");
810
809
  attioPreludeLines.push("export type AttioSingleRecordResult<TObject extends GeneratedAttioObject = GeneratedAttioObject> = AttioRecordFor<TObject>");
811
- attioPreludeLines.push('export type AttioListsResult = ToolOutputByName["attio_lists"]');
810
+ attioPreludeLines.push('export type AttioListsResult = ToolOutputByName["attio_read_lists"]');
812
811
  attioPreludeLines.push("export type AttioEntryValuesFor<TList> = TList extends { __entryValues: infer TValues } ? TValues : Record<string, unknown>");
813
812
  attioPreludeLines.push("export type AttioEntryRecordValuesFor<TList> = TList extends { __entryRecordValues: infer TValues extends Record<string, unknown> } ? TValues : Record<string, unknown>");
814
813
  attioPreludeLines.push("export type AttioEntryFilterFor<TList> = __AttioFilterExpression<AttioEntryRecordValuesFor<TList>>");
@@ -852,22 +851,22 @@ function prepareToolsSection(tools, input) {
852
851
  attioPreludeLines.push(" return value");
853
852
  attioPreludeLines.push("}");
854
853
  attioPreludeLines.push("");
855
- attioPreludeLines.push('function __enhanceAttioQueryResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_records"]): AttioQueryRecordsResult<TObject> {');
854
+ attioPreludeLines.push('function __enhanceAttioQueryResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_read_records"]): AttioQueryRecordsResult<TObject> {');
856
855
  attioPreludeLines.push(" const records = (result.records || []).map(record => __enhanceAttioRecord(object, record)).filter(Boolean) as Array<AttioRecordFor<TObject>>");
857
856
  attioPreludeLines.push(" return { records, count: records.length, offset: result.offset ?? 0 }");
858
857
  attioPreludeLines.push("}");
859
858
  attioPreludeLines.push("");
860
- attioPreludeLines.push('function __enhanceAttioSearchResult(result: ToolOutputByName["attio_records"]): AttioSearchRecordsResult {');
859
+ attioPreludeLines.push('function __enhanceAttioSearchResult(result: ToolOutputByName["attio_read_records"]): AttioSearchRecordsResult {');
861
860
  attioPreludeLines.push(" const matches = result.matches ?? []");
862
861
  attioPreludeLines.push(" return { matches, count: matches.length }");
863
862
  attioPreludeLines.push("}");
864
863
  attioPreludeLines.push("");
865
- attioPreludeLines.push('function __enhanceAttioUpsertResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_records"]): AttioUpsertRecordResult<TObject> {');
864
+ attioPreludeLines.push('function __enhanceAttioUpsertResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_upsert_record"]): AttioUpsertRecordResult<TObject> {');
866
865
  attioPreludeLines.push(" const records = (result.records || []).map(record => __enhanceAttioRecord(object, record)).filter(Boolean) as Array<AttioRecordFor<TObject>>");
867
866
  attioPreludeLines.push(" return { records, count: records.length }");
868
867
  attioPreludeLines.push("}");
869
868
  attioPreludeLines.push("");
870
- attioPreludeLines.push('function __enhanceAttioSingleRecordResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_records"]): AttioSingleRecordResult<TObject> {');
869
+ attioPreludeLines.push('function __enhanceAttioSingleRecordResult<TObject extends GeneratedAttioObject>(object: TObject, result: ToolOutputByName["attio_read_records"]): AttioSingleRecordResult<TObject> {');
871
870
  attioPreludeLines.push(' return __requireAttioPayload(__enhanceAttioRecord(object, result.record), "record")');
872
871
  attioPreludeLines.push("}");
873
872
  attioPreludeLines.push("");
@@ -930,7 +929,7 @@ function prepareToolsSection(tools, input) {
930
929
  const paramsType = toolNameToInterfaceName(tool.name);
931
930
  const normalizedParamsExpr = group.integration === "github" ? normalizeGitHubReposParams(tool.name) : "params";
932
931
  if (group.integration === "attio" && group.integrationId) {
933
- const attioMethods = buildAttioToolMethods(group.integrationId, tool.name);
932
+ const attioMethods = buildAttioToolMethods(group.integrationId, tool);
934
933
  if (attioMethods)
935
934
  return attioMethods;
936
935
  }
@@ -967,213 +966,198 @@ function prepareToolsSection(tools, input) {
967
966
  }
968
967
  };
969
968
  }
970
- function buildAttioRecordsMethods(integrationId) {
969
+ function buildAttioRecordsMethods(integrationId, tool) {
971
970
  const id = escapeString(integrationId);
972
- const call = (requestExpr) => `TerseAgent.executeTool<ToolOutputByName["attio_records"]>("attio_records", { integrationId: "${id}", request: ${requestExpr} })`;
971
+ const toolName = tool.name;
972
+ const call = (requestExpr) => `TerseAgent.executeTool<ToolOutputByName["${toolName}"]>("${toolName}", { integrationId: "${id}", request: ${requestExpr} })`;
973
973
  const objectSlug = "objectSlug: __normalizeAttioObjectSlug(params.object)";
974
- return [
975
- {
976
- description: "Query records of an Attio object, with optional filtering and limit/offset pagination (limit defaults to 20, max 500).",
977
- generatedSignature: "queryRecords<TObject extends GeneratedAttioObject>(params: AttioQueryRecordsParams<TObject>): Promise<AttioQueryRecordsResult<TObject>>",
978
- runtimeLines: [
979
- "queryRecords: <TObject extends GeneratedAttioObject>(params: AttioQueryRecordsParams<TObject>) =>",
980
- ` ${call(`{ action: "query", ${objectSlug}, filter: __serializeAttioFilter(params.filter), limit: params.limit ?? null, offset: params.offset ?? null }`)}.then(result => __enhanceAttioQueryResult(params.object, result)),`
981
- ]
982
- },
983
- {
984
- description: "Fuzzy-search records (max 25 matches) following Attio's in-product matching: names/domains/emails/phones on people and companies, the record label on other objects. Query with a distinctive substring of the target name; extra tokens absent from it can prevent matches. Results are eventually consistent (a just-created record may not be indexed) — use queryRecords for read-after-write.",
985
- generatedSignature: "searchRecords<TObject extends GeneratedAttioObject>(params: AttioSearchRecordsParams<TObject>): Promise<AttioSearchRecordsResult>",
986
- runtimeLines: [
987
- "searchRecords: <TObject extends GeneratedAttioObject>(params: AttioSearchRecordsParams<TObject>) =>",
988
- ` ${call(`{ action: "search", ${objectSlug}, query: params.query, limit: params.limit ?? null }`)}.then(result => __enhanceAttioSearchResult(result)),`
989
- ]
990
- },
991
- {
992
- description: "Fetch a single record by its ID.",
993
- generatedSignature: "getRecord<TObject extends GeneratedAttioObject>(params: AttioGetRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
994
- runtimeLines: [
995
- "getRecord: <TObject extends GeneratedAttioObject>(params: AttioGetRecordParams<TObject>) =>",
996
- ` ${call(`{ action: "get", ${objectSlug}, recordId: params.recordId }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
997
- ]
998
- },
999
- {
1000
- description: "Create a new record. Unlike upsertRecord, no matching attribute is needed, so this works for objects without a unique writable attribute (e.g. deals).",
1001
- generatedSignature: "createRecord<TObject extends GeneratedAttioObject>(params: AttioCreateRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
1002
- runtimeLines: [
1003
- "createRecord: <TObject extends GeneratedAttioObject>(params: AttioCreateRecordParams<TObject>) =>",
1004
- ` ${call(`{ action: "create", ${objectSlug}, values: JSON.stringify(params.values) }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
1005
- ]
1006
- },
1007
- {
1008
- description: "Update an existing record by its ID. Only the attributes present in values are touched; multiselectMode 'append' adds to multi-value attributes instead of overwriting them.",
1009
- generatedSignature: "updateRecord<TObject extends GeneratedAttioObject>(params: AttioUpdateRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
1010
- runtimeLines: [
1011
- "updateRecord: <TObject extends GeneratedAttioObject>(params: AttioUpdateRecordParams<TObject>) =>",
1012
- ` ${call(`{ action: "update", ${objectSlug}, recordId: params.recordId, values: JSON.stringify(params.values), multiselectMode: params.multiselectMode ?? null }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
1013
- ]
1014
- },
1015
- {
1016
- description: "Create or update one or more records, matched on a unique writable attribute (e.g. email_addresses for people, domains for companies). Throws if ANY record fails, naming each failure; records earlier in the batch may already be written (upserts are safe to retry).",
1017
- generatedSignature: "upsertRecord<TObject extends GeneratedAttioObject>(params: AttioUpsertRecordParams<TObject>): Promise<AttioUpsertRecordResult<TObject>>",
1018
- runtimeLines: [
1019
- "upsertRecord: <TObject extends GeneratedAttioObject>(params: AttioUpsertRecordParams<TObject>) =>",
1020
- ` ${call(`{ action: "upsert", ${objectSlug}, matchingAttribute: params.matchingAttribute, records: __serializeAttioRecords(params.records) }`)}.then(result => __enhanceAttioUpsertResult(params.object, result)),`
1021
- ]
1022
- },
1023
- {
1024
- description: "Permanently delete a record by its ID. This cannot be undone.",
1025
- generatedSignature: "deleteRecord<TObject extends GeneratedAttioObject>(params: AttioDeleteRecordParams<TObject>): Promise<void>",
1026
- runtimeLines: [
1027
- "deleteRecord: <TObject extends GeneratedAttioObject>(params: AttioDeleteRecordParams<TObject>) =>",
1028
- ` ${call(`{ action: "delete", ${objectSlug}, recordId: params.recordId }`)}.then(() => undefined),`
1029
- ]
1030
- },
1031
- {
1032
- description: "Fetch the historic values of one attribute on a record (e.g. every stage a deal has been in), with limit/offset pagination. Entries come back as { active_from, active_until, value } with the value flattened and typed by the attribute.",
1033
- generatedSignature: "getAttributeHistory<TObject extends GeneratedAttioObject, TAttr extends AttioAttributeSlug<TObject>>(params: AttioGetAttributeHistoryParams<TObject> & { attribute: TAttr }): Promise<AttioAttributeHistoryResult<__AttioSingleValue<NonNullable<AttioRecordValuesFor<TObject>[TAttr & keyof AttioRecordValuesFor<TObject>]>>>>",
1034
- runtimeLines: [
1035
- "getAttributeHistory: <TObject extends GeneratedAttioObject, TAttr extends AttioAttributeSlug<TObject>>(params: AttioGetAttributeHistoryParams<TObject> & { attribute: TAttr }) =>",
1036
- ` ${call(`{ action: "get_attribute_history", ${objectSlug}, recordId: params.recordId, attributeSlug: params.attribute, limit: params.limit ?? null, offset: params.offset ?? null }`)}.then(result => __enhanceAttioHistoryResult<__AttioSingleValue<NonNullable<AttioRecordValuesFor<TObject>[TAttr & keyof AttioRecordValuesFor<TObject>]>>>(result)),`
1037
- ]
1038
- }
1039
- ];
1040
- }
1041
- function buildAttioToolMethods(integrationId, toolName) {
1042
974
  switch (toolName) {
1043
- case "attio_records":
1044
- return buildAttioRecordsMethods(integrationId);
1045
- case "attio_workspace_members":
1046
- return buildAttioWorkspaceMembersMethods(integrationId);
1047
- case "attio_lists":
1048
- return buildAttioListsMethods(integrationId);
1049
- case "attio_tasks":
1050
- case "attio_notes":
1051
- case "attio_comments":
1052
- case "attio_meetings":
1053
- case "attio_files":
1054
- case "attio_schema":
1055
- return buildAttioResourceMethods(integrationId, toolName, ATTIO_RESOURCE_METHOD_SPECS[toolName]);
975
+ case "attio_read_records":
976
+ return [
977
+ {
978
+ description: attioActionDescription(toolName, "query"),
979
+ generatedSignature: "queryRecords<TObject extends GeneratedAttioObject>(params: AttioQueryRecordsParams<TObject>): Promise<AttioQueryRecordsResult<TObject>>",
980
+ runtimeLines: [
981
+ "queryRecords: <TObject extends GeneratedAttioObject>(params: AttioQueryRecordsParams<TObject>) =>",
982
+ ` ${call(`{ action: "query", ${objectSlug}, filter: __serializeAttioFilter(params.filter), limit: params.limit ?? null, offset: params.offset ?? null }`)}.then(result => __enhanceAttioQueryResult(params.object, result)),`
983
+ ]
984
+ },
985
+ {
986
+ description: attioActionDescription(toolName, "search"),
987
+ generatedSignature: "searchRecords<TObject extends GeneratedAttioObject>(params: AttioSearchRecordsParams<TObject>): Promise<AttioSearchRecordsResult>",
988
+ runtimeLines: [
989
+ "searchRecords: <TObject extends GeneratedAttioObject>(params: AttioSearchRecordsParams<TObject>) =>",
990
+ ` ${call(`{ action: "search", ${objectSlug}, query: params.query, limit: params.limit ?? null }`)}.then(result => __enhanceAttioSearchResult(result)),`
991
+ ]
992
+ },
993
+ {
994
+ description: attioActionDescription(toolName, "get"),
995
+ generatedSignature: "getRecord<TObject extends GeneratedAttioObject>(params: AttioGetRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
996
+ runtimeLines: [
997
+ "getRecord: <TObject extends GeneratedAttioObject>(params: AttioGetRecordParams<TObject>) =>",
998
+ ` ${call(`{ action: "get", ${objectSlug}, recordId: params.recordId }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
999
+ ]
1000
+ },
1001
+ {
1002
+ description: attioActionDescription(toolName, "get_attribute_history"),
1003
+ generatedSignature: "getAttributeHistory<TObject extends GeneratedAttioObject, TAttr extends AttioAttributeSlug<TObject>>(params: AttioGetAttributeHistoryParams<TObject> & { attribute: TAttr }): Promise<AttioAttributeHistoryResult<__AttioSingleValue<NonNullable<AttioRecordValuesFor<TObject>[TAttr & keyof AttioRecordValuesFor<TObject>]>>>>",
1004
+ runtimeLines: [
1005
+ "getAttributeHistory: <TObject extends GeneratedAttioObject, TAttr extends AttioAttributeSlug<TObject>>(params: AttioGetAttributeHistoryParams<TObject> & { attribute: TAttr }) =>",
1006
+ ` ${call(`{ action: "get_attribute_history", ${objectSlug}, recordId: params.recordId, attributeSlug: params.attribute, limit: params.limit ?? null, offset: params.offset ?? null }`)}.then(result => __enhanceAttioHistoryResult<__AttioSingleValue<NonNullable<AttioRecordValuesFor<TObject>[TAttr & keyof AttioRecordValuesFor<TObject>]>>>(result)),`
1007
+ ]
1008
+ }
1009
+ ];
1010
+ case "attio_create_record":
1011
+ return [
1012
+ {
1013
+ description: tool.description || undefined,
1014
+ generatedSignature: "createRecord<TObject extends GeneratedAttioObject>(params: AttioCreateRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
1015
+ runtimeLines: [
1016
+ "createRecord: <TObject extends GeneratedAttioObject>(params: AttioCreateRecordParams<TObject>) =>",
1017
+ ` ${call(`{ ${objectSlug}, values: JSON.stringify(params.values) }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
1018
+ ]
1019
+ }
1020
+ ];
1021
+ case "attio_update_record":
1022
+ return [
1023
+ {
1024
+ description: tool.description || undefined,
1025
+ generatedSignature: "updateRecord<TObject extends GeneratedAttioObject>(params: AttioUpdateRecordParams<TObject>): Promise<AttioSingleRecordResult<TObject>>",
1026
+ runtimeLines: [
1027
+ "updateRecord: <TObject extends GeneratedAttioObject>(params: AttioUpdateRecordParams<TObject>) =>",
1028
+ ` ${call(`{ ${objectSlug}, recordId: params.recordId, values: JSON.stringify(params.values), multiselectMode: params.multiselectMode ?? null }`)}.then(result => __enhanceAttioSingleRecordResult(params.object, result)),`
1029
+ ]
1030
+ }
1031
+ ];
1032
+ case "attio_upsert_record":
1033
+ return [
1034
+ {
1035
+ description: tool.description || undefined,
1036
+ generatedSignature: "upsertRecord<TObject extends GeneratedAttioObject>(params: AttioUpsertRecordParams<TObject>): Promise<AttioUpsertRecordResult<TObject>>",
1037
+ runtimeLines: [
1038
+ "upsertRecord: <TObject extends GeneratedAttioObject>(params: AttioUpsertRecordParams<TObject>) =>",
1039
+ ` ${call(`{ ${objectSlug}, matchingAttribute: params.matchingAttribute, records: __serializeAttioRecords(params.records) }`)}.then(result => __enhanceAttioUpsertResult(params.object, result)),`
1040
+ ]
1041
+ }
1042
+ ];
1043
+ case "attio_delete_record":
1044
+ return [
1045
+ {
1046
+ description: tool.description || undefined,
1047
+ generatedSignature: "deleteRecord<TObject extends GeneratedAttioObject>(params: AttioDeleteRecordParams<TObject>): Promise<void>",
1048
+ runtimeLines: [
1049
+ "deleteRecord: <TObject extends GeneratedAttioObject>(params: AttioDeleteRecordParams<TObject>) =>",
1050
+ ` ${call(`{ ${objectSlug}, recordId: params.recordId }`)}.then(() => undefined),`
1051
+ ]
1052
+ }
1053
+ ];
1056
1054
  default:
1057
- return null;
1055
+ return [];
1058
1056
  }
1059
1057
  }
1058
+ function buildAttioToolMethods(integrationId, tool) {
1059
+ switch (tool.name) {
1060
+ case "attio_read_records":
1061
+ case "attio_create_record":
1062
+ case "attio_update_record":
1063
+ case "attio_upsert_record":
1064
+ case "attio_delete_record":
1065
+ return buildAttioRecordsMethods(integrationId, tool);
1066
+ case "attio_read_lists":
1067
+ case "attio_create_list":
1068
+ case "attio_update_list":
1069
+ case "attio_read_list_entries":
1070
+ case "attio_add_list_entry":
1071
+ case "attio_upsert_list_entry":
1072
+ case "attio_update_list_entry":
1073
+ case "attio_remove_list_entry":
1074
+ return buildAttioListsMethods(integrationId, tool);
1075
+ default: {
1076
+ const specs = ATTIO_RESOURCE_METHOD_SPECS[tool.name];
1077
+ return specs ? buildAttioResourceMethods(integrationId, tool, specs) : null;
1078
+ }
1079
+ }
1080
+ }
1081
+ // Method TSDoc is single-sourced: single-op tools inherit the tool description, action-mapped
1082
+ // methods inherit the zod action literal's description.
1083
+ function attioActionDescription(toolName, action) {
1084
+ if (!isKnownToolName(toolName))
1085
+ return undefined;
1086
+ const parsed = attioRequestUnionJsonSchema.safeParse(z.toJSONSchema(ToolDefinitions[toolName].inputSchema));
1087
+ if (!parsed.success)
1088
+ return undefined;
1089
+ const request = parsed.data.properties.request;
1090
+ for (const branch of request.oneOf ?? request.anyOf ?? []) {
1091
+ const actionBranch = attioActionBranchJsonSchema.safeParse(branch);
1092
+ if (actionBranch.success && actionBranch.data.properties.action.const === action) {
1093
+ return actionBranch.data.properties.action.description;
1094
+ }
1095
+ }
1096
+ return undefined;
1097
+ }
1098
+ function isKnownToolName(name) {
1099
+ return name in ToolDefinitions;
1100
+ }
1101
+ const attioRequestUnionJsonSchema = z.object({
1102
+ properties: z.object({ request: z.object({ oneOf: z.array(z.unknown()).optional(), anyOf: z.array(z.unknown()).optional() }) })
1103
+ });
1104
+ const attioActionBranchJsonSchema = z.object({
1105
+ properties: z.object({ action: z.object({ const: z.string(), description: z.string().optional() }) })
1106
+ });
1060
1107
  const ATTIO_RESOURCE_METHOD_SPECS = {
1061
- attio_tasks: [
1062
- {
1063
- action: "list",
1064
- methodName: "listTasks",
1065
- description: "List Attio tasks, optionally filtered by linked record or completion state (limit/offset pagination).",
1066
- emptyParams: true,
1067
- result: { kind: "list", key: "tasks" }
1068
- },
1069
- { action: "get", methodName: "getTask", description: "Fetch a single Attio task by ID.", result: { kind: "single", key: "task" } },
1070
- {
1071
- action: "create",
1072
- methodName: "createTask",
1073
- description: "Create an Attio task with optional deadline, assignees (workspace-member emails or IDs) and linked records.",
1074
- result: { kind: "single", key: "task" }
1075
- },
1076
- {
1077
- action: "update",
1078
- methodName: "updateTask",
1079
- description: "Update an Attio task's deadline, completion state, assignees or linked records (content is immutable).",
1080
- result: { kind: "single", key: "task" }
1081
- },
1082
- { action: "delete", methodName: "deleteTask", description: "Permanently delete an Attio task.", result: { kind: "void" } }
1108
+ attio_workspace_members: [
1109
+ { action: "list", methodName: "listWorkspaceMembers", emptyParams: true, result: { kind: "list", key: "members" } },
1110
+ { action: "get", methodName: "getWorkspaceMember", result: { kind: "single", key: "member", what: "workspace member" } }
1111
+ ],
1112
+ attio_read_tasks: [
1113
+ { action: "list", methodName: "listTasks", emptyParams: true, result: { kind: "list", key: "tasks" } },
1114
+ { action: "get", methodName: "getTask", result: { kind: "single", key: "task" } }
1083
1115
  ],
1084
- attio_notes: [
1085
- {
1086
- action: "list",
1087
- methodName: "listNotes",
1088
- description: "List Attio notes, optionally scoped to one record (limit/offset pagination).",
1089
- emptyParams: true,
1090
- result: { kind: "list", key: "notes" }
1091
- },
1092
- { action: "get", methodName: "getNote", description: "Fetch a single Attio note by ID.", result: { kind: "single", key: "note" } },
1093
- { action: "create", methodName: "createNote", description: "Create a note on a record (markdown by default).", result: { kind: "single", key: "note" } },
1094
- { action: "delete", methodName: "deleteNote", description: "Permanently delete a note.", result: { kind: "void" } }
1116
+ attio_create_task: [{ methodName: "createTask", result: { kind: "single", key: "task" } }],
1117
+ attio_update_task: [{ methodName: "updateTask", result: { kind: "single", key: "task" } }],
1118
+ attio_delete_task: [{ methodName: "deleteTask", result: { kind: "void" } }],
1119
+ attio_read_notes: [
1120
+ { action: "list", methodName: "listNotes", emptyParams: true, result: { kind: "list", key: "notes" } },
1121
+ { action: "get", methodName: "getNote", result: { kind: "single", key: "note" } }
1095
1122
  ],
1096
- attio_comments: [
1097
- {
1098
- action: "create",
1099
- methodName: "createComment",
1100
- description: "Create a comment: reply to a thread via threadId, or start a thread on a record via objectSlug + recordId. Requires authorWorkspaceMemberId.",
1101
- result: { kind: "single", key: "comment" }
1102
- },
1103
- { action: "get", methodName: "getComment", description: "Fetch a single comment by ID.", result: { kind: "single", key: "comment" } },
1104
- { action: "delete", methodName: "deleteComment", description: "Permanently delete a comment.", result: { kind: "void" } },
1105
- { action: "list_threads", methodName: "listThreads", description: "List comment threads on a record.", emptyParams: true, result: { kind: "list", key: "threads" } },
1106
- { action: "get_thread", methodName: "getThread", description: "Fetch a thread with all of its comments.", result: { kind: "single", key: "thread" } }
1123
+ attio_create_note: [{ methodName: "createNote", result: { kind: "single", key: "note" } }],
1124
+ attio_delete_note: [{ methodName: "deleteNote", result: { kind: "void" } }],
1125
+ attio_read_comments: [
1126
+ { action: "get", methodName: "getComment", result: { kind: "single", key: "comment" } },
1127
+ { action: "list_threads", methodName: "listThreads", emptyParams: true, result: { kind: "list", key: "threads" } },
1128
+ { action: "get_thread", methodName: "getThread", result: { kind: "single", key: "thread" } }
1107
1129
  ],
1130
+ attio_create_comment: [{ methodName: "createComment", result: { kind: "single", key: "comment" } }],
1131
+ attio_delete_comment: [{ methodName: "deleteComment", result: { kind: "void" } }],
1108
1132
  attio_meetings: [
1109
- {
1110
- action: "list",
1111
- methodName: "listMeetings",
1112
- description: "List meetings, filterable by linked record, participants or time range (cursor pagination via nextCursor).",
1113
- emptyParams: true,
1114
- result: { kind: "list", key: "meetings", cursor: true }
1115
- },
1116
- { action: "get", methodName: "getMeeting", description: "Fetch a single meeting by ID.", result: { kind: "single", key: "meeting" } },
1117
- {
1118
- action: "list_recordings",
1119
- methodName: "listCallRecordings",
1120
- description: "List call recordings for a meeting.",
1121
- result: { kind: "list", key: "recordings", cursor: true }
1122
- },
1123
- {
1124
- action: "get_transcript",
1125
- methodName: "getCallTranscript",
1126
- description: "Fetch the transcript of a call recording.",
1127
- result: { kind: "singleWithCursor", key: "transcript" }
1128
- }
1133
+ { action: "list", methodName: "listMeetings", emptyParams: true, result: { kind: "list", key: "meetings", cursor: true } },
1134
+ { action: "get", methodName: "getMeeting", result: { kind: "single", key: "meeting" } },
1135
+ { action: "list_recordings", methodName: "listCallRecordings", result: { kind: "list", key: "recordings", cursor: true } },
1136
+ { action: "get_transcript", methodName: "getCallTranscript", result: { kind: "singleWithCursor", key: "transcript" } }
1137
+ ],
1138
+ attio_read_files: [
1139
+ { action: "list", methodName: "listFiles", result: { kind: "list", key: "files", cursor: true } },
1140
+ { action: "get", methodName: "getFile", result: { kind: "single", key: "file" } },
1141
+ { action: "get_download_url", methodName: "getFileDownloadUrl", result: { kind: "single", key: "downloadUrl", what: "download URL" } }
1129
1142
  ],
1130
- attio_files: [
1131
- { action: "list", methodName: "listFiles", description: "List files attached to a record (cursor pagination).", result: { kind: "list", key: "files", cursor: true } },
1132
- { action: "get", methodName: "getFile", description: "Fetch a file's metadata by ID.", result: { kind: "single", key: "file" } },
1133
- { action: "upload", methodName: "uploadFile", description: "Upload a file to a record from base64 content (max 50 MB).", result: { kind: "single", key: "file" } },
1134
- {
1135
- action: "get_download_url",
1136
- methodName: "getFileDownloadUrl",
1137
- description: "Get a signed download URL for a file.",
1138
- result: { kind: "single", key: "downloadUrl", what: "download URL" }
1139
- },
1140
- { action: "delete", methodName: "deleteFile", description: "Permanently delete a file.", result: { kind: "void" } }
1143
+ attio_upload_file: [{ methodName: "uploadFile", result: { kind: "single", key: "file" } }],
1144
+ attio_delete_file: [{ methodName: "deleteFile", result: { kind: "void" } }],
1145
+ attio_read_schema: [
1146
+ { action: "list_objects", methodName: "listObjects", emptyParams: true, result: { kind: "list", key: "objects" } },
1147
+ { action: "get_object", methodName: "getObject", result: { kind: "single", key: "object" } },
1148
+ { action: "list_attributes", methodName: "listAttributes", result: { kind: "list", key: "attributes" } },
1149
+ { action: "list_statuses", methodName: "listStatuses", result: { kind: "list", key: "statuses" } },
1150
+ { action: "list_select_options", methodName: "listSelectOptions", result: { kind: "list", key: "selectOptions" } }
1141
1151
  ],
1142
- attio_schema: [
1143
- {
1144
- action: "list_objects",
1145
- methodName: "listObjects",
1146
- description: "List all object types in the workspace with their attributes. Call before creating or updating records.",
1147
- emptyParams: true,
1148
- result: { kind: "list", key: "objects" }
1149
- },
1150
- { action: "get_object", methodName: "getObject", description: "Fetch one object's configuration.", result: { kind: "single", key: "object" } },
1151
- { action: "create_object", methodName: "createObject", description: "Create a custom object type (changes the workspace schema).", result: { kind: "single", key: "object" } },
1152
- { action: "update_object", methodName: "updateObject", description: "Update an object's slug or display names.", result: { kind: "single", key: "object" } },
1153
- { action: "list_attributes", methodName: "listAttributes", description: "List the attributes on an object or list.", result: { kind: "list", key: "attributes" } },
1154
- {
1155
- action: "create_attribute",
1156
- methodName: "createAttribute",
1157
- description: "Create an attribute on an object or list (changes the workspace schema).",
1158
- result: { kind: "single", key: "attribute" }
1159
- },
1160
- { action: "update_attribute", methodName: "updateAttribute", description: "Update an attribute's title or constraints.", result: { kind: "single", key: "attribute" } },
1161
- { action: "list_statuses", methodName: "listStatuses", description: "List the statuses of a status attribute (e.g. deal stages).", result: { kind: "list", key: "statuses" } },
1162
- {
1163
- action: "create_status",
1164
- methodName: "createStatus",
1165
- description: "Add a status to a status attribute. Rerun terse generate to refresh constants.",
1166
- result: { kind: "single", key: "status" }
1167
- },
1168
- { action: "update_status", methodName: "updateStatus", description: "Rename or archive a status.", result: { kind: "single", key: "status" } },
1169
- { action: "list_select_options", methodName: "listSelectOptions", description: "List the options of a select attribute.", result: { kind: "list", key: "selectOptions" } },
1170
- {
1171
- action: "create_select_option",
1172
- methodName: "createSelectOption",
1173
- description: "Add an option to a select attribute. Rerun terse generate to refresh constants.",
1174
- result: { kind: "single", key: "selectOption" }
1175
- },
1176
- { action: "update_select_option", methodName: "updateSelectOption", description: "Rename or archive a select option.", result: { kind: "single", key: "selectOption" } }
1152
+ attio_modify_schema: [
1153
+ { action: "create_object", methodName: "createObject", result: { kind: "single", key: "object" } },
1154
+ { action: "update_object", methodName: "updateObject", result: { kind: "single", key: "object" } },
1155
+ { action: "create_attribute", methodName: "createAttribute", result: { kind: "single", key: "attribute" } },
1156
+ { action: "update_attribute", methodName: "updateAttribute", result: { kind: "single", key: "attribute" } },
1157
+ { action: "create_status", methodName: "createStatus", result: { kind: "single", key: "status" } },
1158
+ { action: "update_status", methodName: "updateStatus", result: { kind: "single", key: "status" } },
1159
+ { action: "create_select_option", methodName: "createSelectOption", result: { kind: "single", key: "selectOption" } },
1160
+ { action: "update_select_option", methodName: "updateSelectOption", result: { kind: "single", key: "selectOption" } }
1177
1161
  ]
1178
1162
  };
1179
1163
  // Each method narrows the wire result to its action's payload at runtime: singles unwrap to the bare
@@ -1205,124 +1189,128 @@ function attioResultParts(toolName, result) {
1205
1189
  throw result;
1206
1190
  }
1207
1191
  }
1208
- function buildAttioResourceMethods(integrationId, toolName, specs) {
1192
+ function buildAttioResourceMethods(integrationId, tool, specs) {
1209
1193
  const id = escapeString(integrationId);
1194
+ const toolName = tool.name;
1210
1195
  return specs.map(spec => {
1211
- const paramsType = `Omit<Extract<ToolInputByName["${toolName}"]["request"], { action: "${spec.action}" }>, "action">`;
1196
+ const paramsType = spec.action ? `Omit<Extract<ToolInputByName["${toolName}"]["request"], { action: "${spec.action}" }>, "action">` : `ToolInputByName["${toolName}"]["request"]`;
1197
+ const requestExpr = spec.action ? `{ action: "${spec.action}", ...params }` : "params";
1212
1198
  const { resultType, thenExpr } = attioResultParts(toolName, spec.result);
1213
1199
  return {
1214
- description: spec.description,
1200
+ description: spec.action ? attioActionDescription(toolName, spec.action) : tool.description || undefined,
1215
1201
  generatedSignature: `${spec.methodName}(${spec.emptyParams ? `params?: ${paramsType}` : `params: ${paramsType}`}): Promise<${resultType}>`,
1216
1202
  runtimeLines: [
1217
1203
  `${spec.methodName}: (params: ${paramsType}${spec.emptyParams ? " = {}" : ""}) =>`,
1218
- ` TerseAgent.executeTool<ToolOutputByName["${toolName}"]>("${toolName}", { integrationId: "${id}", request: { action: "${spec.action}", ...params } })${thenExpr},`
1204
+ ` TerseAgent.executeTool<ToolOutputByName["${toolName}"]>("${toolName}", { integrationId: "${id}", request: ${requestExpr} })${thenExpr},`
1219
1205
  ]
1220
1206
  };
1221
1207
  });
1222
1208
  }
1223
- function buildAttioListsMethods(integrationId) {
1209
+ function buildAttioListsMethods(integrationId, tool) {
1224
1210
  const id = escapeString(integrationId);
1225
- const call = (requestExpr) => `TerseAgent.executeTool<ToolOutputByName["attio_lists"]>("attio_lists", { integrationId: "${id}", request: ${requestExpr} })`;
1211
+ const toolName = tool.name;
1212
+ const call = (requestExpr) => `TerseAgent.executeTool<ToolOutputByName["${toolName}"]>("${toolName}", { integrationId: "${id}", request: ${requestExpr} })`;
1226
1213
  const listKey = "listIdOrSlug: __normalizeAttioObjectSlug(params.list)";
1227
1214
  const listParam = "list: GeneratedAttioList | string";
1228
- return [
1229
- {
1230
- description: "List all Attio lists in the workspace.",
1231
- generatedSignature: 'listLists(): Promise<{ lists: NonNullable<AttioListsResult["lists"]>; count: number }>',
1232
- runtimeLines: ["listLists: () =>", ` ${call('{ action: "list" }')}.then(result => ({ lists: result.lists ?? [], count: (result.lists ?? []).length })),`]
1233
- },
1234
- {
1235
- description: "Fetch a list's configuration. Accepts a generated AttioList constant or a plain list ID/slug.",
1236
- generatedSignature: `getList(params: { ${listParam} }): Promise<NonNullable<AttioListsResult["list"]>>`,
1237
- runtimeLines: [`getList: (params: { ${listParam} }) =>`, ` ${call(`{ action: "get", ${listKey} }`)}.then(result => __requireAttioPayload(result.list, "list")),`]
1238
- },
1239
- {
1240
- description: "Create a new list over an object. This changes the workspace for every user.",
1241
- generatedSignature: 'createList(params: Omit<Extract<ToolInputByName["attio_lists"]["request"], { action: "create" }>, "action">): Promise<NonNullable<AttioListsResult["list"]>>',
1242
- runtimeLines: [
1243
- 'createList: (params: Omit<Extract<ToolInputByName["attio_lists"]["request"], { action: "create" }>, "action">) =>',
1244
- ` ${call('{ action: "create", ...params }')}.then(result => __requireAttioPayload(result.list, "list")),`
1245
- ]
1246
- },
1247
- {
1248
- description: "Rename a list.",
1249
- generatedSignature: `updateList(params: { ${listParam}; name: string }): Promise<NonNullable<AttioListsResult["list"]>>`,
1250
- runtimeLines: [
1251
- `updateList: (params: { ${listParam}; name: string }) =>`,
1252
- ` ${call(`{ action: "update", ${listKey}, name: params.name }`)}.then(result => __requireAttioPayload(result.list, "list")),`
1253
- ]
1254
- },
1255
- {
1256
- description: "List entries in a list with a typed filter, an optional parent-record lookup, and limit/offset pagination. Entry values come back flattened (statuses/selects as AttioSelectOption).",
1257
- generatedSignature: "queryListEntries<TList extends GeneratedAttioList | string>(params: { list: TList; filter?: AttioEntryFilterFor<TList> | null; parentRecordId?: string | null; parentObjectSlug?: string; limit?: number | null; offset?: number | null }): Promise<AttioListEntriesResult<TList>>",
1258
- runtimeLines: [
1259
- "queryListEntries: <TList extends GeneratedAttioList | string>(params: { list: TList; filter?: AttioEntryFilterFor<TList> | null; parentRecordId?: string | null; parentObjectSlug?: string; limit?: number | null; offset?: number | null }) =>",
1260
- ` ${call('{ action: "query_entries", listIdOrSlug: __normalizeAttioObjectSlug(params.list), filter: __serializeAttioFilter(params.filter), parentRecordId: params.parentRecordId ?? null, parentObjectSlug: params.parentRecordId ? __requireAttioListParentObject(params.list, params.parentObjectSlug) : null, limit: params.limit ?? null, offset: params.offset ?? null }')}.then(result => __enhanceAttioListEntriesResult(params.list, result)),`
1261
- ]
1262
- },
1263
- {
1264
- description: "Add a record to a list as a new entry, with typed entry values. parentObjectSlug is inferred from a generated AttioList constant.",
1265
- generatedSignature: "addListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }): Promise<AttioListEntryResult<TList>>",
1266
- runtimeLines: [
1267
- "addListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }) =>",
1268
- ` ${call('{ action: "add_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), parentObjectSlug: __requireAttioListParentObject(params.list, params.parentObjectSlug), parentRecordId: params.parentRecordId, entryValues: __serializeAttioValues(params.entryValues) }')}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1269
- ]
1270
- },
1271
- {
1272
- description: "Create or update a list entry keyed by its parent record (idempotent list membership), with typed entry values.",
1273
- generatedSignature: "upsertListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }): Promise<AttioListEntryResult<TList>>",
1274
- runtimeLines: [
1275
- "upsertListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }) =>",
1276
- ` ${call('{ action: "upsert_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), parentObjectSlug: __requireAttioListParentObject(params.list, params.parentObjectSlug), parentRecordId: params.parentRecordId, entryValues: __serializeAttioValues(params.entryValues) }')}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1277
- ]
1278
- },
1279
- {
1280
- description: "Fetch a single list entry with flattened, typed entry values.",
1281
- generatedSignature: "getListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string }): Promise<AttioListEntryResult<TList>>",
1282
- runtimeLines: [
1283
- "getListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string }) =>",
1284
- ` ${call('{ action: "get_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId }')}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1285
- ]
1286
- },
1287
- {
1288
- description: "Update a list entry's attribute values (e.g. move its stage), typed against the list's entry attributes.",
1289
- generatedSignature: 'updateListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string; entryValues: Partial<AttioEntryValuesFor<TList>>; multiselectMode?: "overwrite" | "append" | null }): Promise<AttioListEntryResult<TList>>',
1290
- runtimeLines: [
1291
- 'updateListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string; entryValues: Partial<AttioEntryValuesFor<TList>>; multiselectMode?: "overwrite" | "append" | null }) =>',
1292
- ` ${call('{ action: "update_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId, entryValues: __serializeAttioValues(params.entryValues), multiselectMode: params.multiselectMode ?? null }')}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1293
- ]
1294
- },
1295
- {
1296
- description: "Remove an entry from a list; the parent record is untouched.",
1297
- generatedSignature: `removeListEntry(params: { ${listParam}; entryId: string }): Promise<void>`,
1298
- runtimeLines: [
1299
- `removeListEntry: (params: { ${listParam}; entryId: string }) =>`,
1300
- ` ${call('{ action: "remove_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId }')}.then(() => undefined),`
1301
- ]
1302
- }
1303
- ];
1304
- }
1305
- function buildAttioWorkspaceMembersMethods(integrationId) {
1306
- const id = escapeString(integrationId);
1307
- const call = (requestExpr) => `TerseAgent.executeTool<ToolOutputByName["attio_workspace_members"]>("attio_workspace_members", { integrationId: "${id}", request: ${requestExpr} })`;
1308
- return [
1309
- {
1310
- description: "List every Attio workspace member (name, email address, access level). Use to resolve a record's owner to a person, e.g. for a Slack DM by email.",
1311
- generatedSignature: 'listWorkspaceMembers(params?: AttioListWorkspaceMembersParams): Promise<{ members: NonNullable<AttioWorkspaceMembersResult["members"]>; count: number }>',
1312
- runtimeLines: [
1313
- "listWorkspaceMembers: (_params: AttioListWorkspaceMembersParams = {}) =>",
1314
- ` ${call('{ action: "list" }')}.then(result => ({ members: result.members ?? [], count: (result.members ?? []).length })),`
1315
- ]
1316
- },
1317
- {
1318
- description: "Fetch a single workspace member by ID (e.g. the referenced_actor_id of a record's owner value).",
1319
- generatedSignature: 'getWorkspaceMember(params: AttioGetWorkspaceMemberParams): Promise<NonNullable<AttioWorkspaceMembersResult["member"]>>',
1320
- runtimeLines: [
1321
- "getWorkspaceMember: (params: AttioGetWorkspaceMemberParams) =>",
1322
- ` ${call('{ action: "get", workspaceMemberId: params.workspaceMemberId }')}.then(result => __requireAttioPayload(result.member, "workspace member")),`
1323
- ]
1324
- }
1325
- ];
1215
+ switch (toolName) {
1216
+ case "attio_read_lists":
1217
+ return [
1218
+ {
1219
+ description: attioActionDescription(toolName, "list"),
1220
+ generatedSignature: 'listLists(): Promise<{ lists: NonNullable<AttioListsResult["lists"]>; count: number }>',
1221
+ runtimeLines: ["listLists: () =>", ` ${call('{ action: "list" }')}.then(result => ({ lists: result.lists ?? [], count: (result.lists ?? []).length })),`]
1222
+ },
1223
+ {
1224
+ description: attioActionDescription(toolName, "get"),
1225
+ generatedSignature: `getList(params: { ${listParam} }): Promise<NonNullable<AttioListsResult["list"]>>`,
1226
+ runtimeLines: [`getList: (params: { ${listParam} }) =>`, ` ${call(`{ action: "get", ${listKey} }`)}.then(result => __requireAttioPayload(result.list, "list")),`]
1227
+ }
1228
+ ];
1229
+ case "attio_create_list":
1230
+ return [
1231
+ {
1232
+ description: tool.description || undefined,
1233
+ generatedSignature: 'createList(params: ToolInputByName["attio_create_list"]["request"]): Promise<NonNullable<AttioListsResult["list"]>>',
1234
+ runtimeLines: ['createList: (params: ToolInputByName["attio_create_list"]["request"]) =>', ` ${call("params")}.then(result => __requireAttioPayload(result.list, "list")),`]
1235
+ }
1236
+ ];
1237
+ case "attio_update_list":
1238
+ return [
1239
+ {
1240
+ description: tool.description || undefined,
1241
+ generatedSignature: `updateList(params: { ${listParam}; name: string }): Promise<NonNullable<AttioListsResult["list"]>>`,
1242
+ runtimeLines: [
1243
+ `updateList: (params: { ${listParam}; name: string }) =>`,
1244
+ ` ${call(`{ ${listKey}, name: params.name }`)}.then(result => __requireAttioPayload(result.list, "list")),`
1245
+ ]
1246
+ }
1247
+ ];
1248
+ case "attio_read_list_entries":
1249
+ return [
1250
+ {
1251
+ description: attioActionDescription(toolName, "query_entries"),
1252
+ generatedSignature: "queryListEntries<TList extends GeneratedAttioList | string>(params: { list: TList; filter?: AttioEntryFilterFor<TList> | null; parentRecordId?: string | null; parentObjectSlug?: string; limit?: number | null; offset?: number | null }): Promise<AttioListEntriesResult<TList>>",
1253
+ runtimeLines: [
1254
+ "queryListEntries: <TList extends GeneratedAttioList | string>(params: { list: TList; filter?: AttioEntryFilterFor<TList> | null; parentRecordId?: string | null; parentObjectSlug?: string; limit?: number | null; offset?: number | null }) =>",
1255
+ ` ${call('{ action: "query_entries", listIdOrSlug: __normalizeAttioObjectSlug(params.list), filter: __serializeAttioFilter(params.filter), parentRecordId: params.parentRecordId ?? null, parentObjectSlug: params.parentRecordId ? __requireAttioListParentObject(params.list, params.parentObjectSlug) : null, limit: params.limit ?? null, offset: params.offset ?? null }')}.then(result => __enhanceAttioListEntriesResult(params.list, result)),`
1256
+ ]
1257
+ },
1258
+ {
1259
+ description: attioActionDescription(toolName, "get_entry"),
1260
+ generatedSignature: "getListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string }): Promise<AttioListEntryResult<TList>>",
1261
+ runtimeLines: [
1262
+ "getListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string }) =>",
1263
+ ` ${call('{ action: "get_entry", listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId }')}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1264
+ ]
1265
+ }
1266
+ ];
1267
+ case "attio_add_list_entry":
1268
+ return [
1269
+ {
1270
+ description: tool.description || undefined,
1271
+ generatedSignature: "addListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }): Promise<AttioListEntryResult<TList>>",
1272
+ runtimeLines: [
1273
+ "addListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }) =>",
1274
+ ` ${call("{ listIdOrSlug: __normalizeAttioObjectSlug(params.list), parentObjectSlug: __requireAttioListParentObject(params.list, params.parentObjectSlug), parentRecordId: params.parentRecordId, entryValues: __serializeAttioValues(params.entryValues) }")}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1275
+ ]
1276
+ }
1277
+ ];
1278
+ case "attio_upsert_list_entry":
1279
+ return [
1280
+ {
1281
+ description: tool.description || undefined,
1282
+ generatedSignature: "upsertListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }): Promise<AttioListEntryResult<TList>>",
1283
+ runtimeLines: [
1284
+ "upsertListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; parentRecordId: string; parentObjectSlug?: string; entryValues?: AttioEntryValuesFor<TList> | null }) =>",
1285
+ ` ${call("{ listIdOrSlug: __normalizeAttioObjectSlug(params.list), parentObjectSlug: __requireAttioListParentObject(params.list, params.parentObjectSlug), parentRecordId: params.parentRecordId, entryValues: __serializeAttioValues(params.entryValues) }")}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1286
+ ]
1287
+ }
1288
+ ];
1289
+ case "attio_update_list_entry":
1290
+ return [
1291
+ {
1292
+ description: tool.description || undefined,
1293
+ generatedSignature: 'updateListEntry<TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string; entryValues: Partial<AttioEntryValuesFor<TList>>; multiselectMode?: "overwrite" | "append" | null }): Promise<AttioListEntryResult<TList>>',
1294
+ runtimeLines: [
1295
+ 'updateListEntry: <TList extends GeneratedAttioList | string>(params: { list: TList; entryId: string; entryValues: Partial<AttioEntryValuesFor<TList>>; multiselectMode?: "overwrite" | "append" | null }) =>',
1296
+ ` ${call("{ listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId, entryValues: __serializeAttioValues(params.entryValues), multiselectMode: params.multiselectMode ?? null }")}.then(result => __enhanceAttioListEntryResult(params.list, result)),`
1297
+ ]
1298
+ }
1299
+ ];
1300
+ case "attio_remove_list_entry":
1301
+ return [
1302
+ {
1303
+ description: tool.description || undefined,
1304
+ generatedSignature: `removeListEntry(params: { ${listParam}; entryId: string }): Promise<void>`,
1305
+ runtimeLines: [
1306
+ `removeListEntry: (params: { ${listParam}; entryId: string }) =>`,
1307
+ ` ${call("{ listIdOrSlug: __normalizeAttioObjectSlug(params.list), entryId: params.entryId }")}.then(() => undefined),`
1308
+ ]
1309
+ }
1310
+ ];
1311
+ default:
1312
+ return [];
1313
+ }
1326
1314
  }
1327
1315
  function prepareSystemSection() {
1328
1316
  return sectionData([