@elementumai/edk 0.9.7 → 0.9.9

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 (148) hide show
  1. package/README.md +3 -2
  2. package/dist-sdk/src/catalog/factories.d.ts +14 -3
  3. package/dist-sdk/src/catalog/factories.js +32 -0
  4. package/dist-sdk/src/catalog/from-authoring.js +27 -33
  5. package/dist-sdk/src/catalog/index.d.ts +2 -2
  6. package/dist-sdk/src/catalog/index.js +2 -2
  7. package/dist-sdk/src/catalog/org.js +67 -29
  8. package/dist-sdk/src/catalog/token.js +10 -0
  9. package/dist-sdk/src/catalog/types.d.ts +20 -2
  10. package/dist-sdk/src/catalog/types.js +5 -0
  11. package/dist-sdk/src/core/index.d.ts +1 -1
  12. package/dist-sdk/src/core/index.js +1 -1
  13. package/dist-sdk/src/core/platform-id.d.ts +2 -0
  14. package/dist-sdk/src/core/platform-id.js +4 -0
  15. package/dist-sdk/src/core/system-fields.d.ts +14 -0
  16. package/dist-sdk/src/core/system-fields.js +6 -0
  17. package/dist-sdk/src/core/triggers/on-demand.d.ts +27 -24
  18. package/dist-sdk/src/core/triggers/on-demand.js +33 -12
  19. package/dist-sdk/src/core/types/aspect-category.d.ts +1 -0
  20. package/dist-sdk/src/core/types/aspect-category.js +1 -0
  21. package/dist-sdk/src/engine/build/context.d.ts +20 -8
  22. package/dist-sdk/src/engine/build/source-context.d.ts +14 -17
  23. package/dist-sdk/src/engine/build/source-context.js +1 -1
  24. package/dist-sdk/src/engine/pull/context.d.ts +9 -0
  25. package/dist-sdk/src/engine/pull/org.d.ts +4 -0
  26. package/dist-sdk/src/engine/pull/org.js +17 -2
  27. package/dist-sdk/src/engine/pull/procedure-refs.d.ts +16 -0
  28. package/dist-sdk/src/engine/pull/procedure-refs.js +69 -0
  29. package/dist-sdk/src/engine/tf/expr.js +1 -1
  30. package/dist-sdk/src/engine/workspace/authoring-layout.d.ts +15 -0
  31. package/dist-sdk/src/engine/workspace/authoring-layout.js +33 -1
  32. package/dist-sdk/src/engine/workspace/loader.d.ts +40 -0
  33. package/dist-sdk/src/engine/workspace/loader.js +328 -0
  34. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +4 -0
  35. package/dist-sdk/src/entities/access-policy/from-tf.js +10 -2
  36. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +1 -0
  37. package/dist-sdk/src/entities/access-policy/to-tf.js +7 -2
  38. package/dist-sdk/src/entities/agent/build.d.ts +54 -8
  39. package/dist-sdk/src/entities/agent/build.js +36 -1
  40. package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +126 -2
  41. package/dist-sdk/src/entities/agent/from-tf.d.ts +7 -6
  42. package/dist-sdk/src/entities/agent/from-tf.js +176 -5
  43. package/dist-sdk/src/entities/agent/index.d.ts +2 -2
  44. package/dist-sdk/src/entities/agent/index.js +1 -1
  45. package/dist-sdk/src/entities/agent/to-tf.d.ts +4 -4
  46. package/dist-sdk/src/entities/agent/to-tf.js +185 -11
  47. package/dist-sdk/src/entities/agent/tools.d.ts +16 -5
  48. package/dist-sdk/src/entities/agent/tools.js +13 -1
  49. package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +7 -0
  50. package/dist-sdk/src/entities/agent-tool/from-tf.js +29 -4
  51. package/dist-sdk/src/entities/agent-tool/to-tf.js +10 -9
  52. package/dist-sdk/src/entities/agent-tool/types.js +1 -0
  53. package/dist-sdk/src/entities/app/build.d.ts +2 -2
  54. package/dist-sdk/src/entities/app/build.js +6 -3
  55. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +5 -0
  56. package/dist-sdk/src/entities/app/display-blocks-to-layout.d.ts +45 -0
  57. package/dist-sdk/src/entities/app/display-blocks-to-layout.js +98 -0
  58. package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.d.ts +55 -0
  59. package/dist-sdk/src/entities/app/display-blocks-to-record-create-form.js +99 -0
  60. package/dist-sdk/src/entities/app/from-tf.js +9 -7
  61. package/dist-sdk/src/entities/app/to-tf.js +15 -7
  62. package/dist-sdk/src/entities/automation/build.d.ts +8 -1
  63. package/dist-sdk/src/entities/automation/build.js +36 -5
  64. package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +3 -7
  65. package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +2 -0
  66. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +77 -8
  67. package/dist-sdk/src/entities/automation/from-tf.d.ts +10 -1
  68. package/dist-sdk/src/entities/automation/from-tf.js +803 -62
  69. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  70. package/dist-sdk/src/entities/automation/module.js +13 -3
  71. package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +12 -4
  72. package/dist-sdk/src/entities/automation/output-key-wire-name.js +17 -6
  73. package/dist-sdk/src/entities/automation/script-code.d.ts +1 -1
  74. package/dist-sdk/src/entities/automation/script-code.js +15 -11
  75. package/dist-sdk/src/entities/automation/task-label.d.ts +2 -0
  76. package/dist-sdk/src/entities/automation/task-label.js +18 -0
  77. package/dist-sdk/src/entities/automation/tasks.d.ts +60 -9
  78. package/dist-sdk/src/entities/automation/tasks.js +16 -4
  79. package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
  80. package/dist-sdk/src/entities/automation/to-tf.js +385 -52
  81. package/dist-sdk/src/entities/automation/triggers.d.ts +14 -5
  82. package/dist-sdk/src/entities/automation/triggers.js +1 -1
  83. package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
  84. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +1 -0
  85. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +1 -1
  86. package/dist-sdk/src/entities/element/build.d.ts +30 -7
  87. package/dist-sdk/src/entities/element/build.js +6 -3
  88. package/dist-sdk/src/entities/element/from-tf.js +7 -3
  89. package/dist-sdk/src/entities/element/index.d.ts +1 -1
  90. package/dist-sdk/src/entities/element/index.js +1 -1
  91. package/dist-sdk/src/entities/element/to-tf.js +49 -8
  92. package/dist-sdk/src/entities/field/from-tf.d.ts +6 -0
  93. package/dist-sdk/src/entities/field/from-tf.js +12 -0
  94. package/dist-sdk/src/entities/field/module.js +1 -0
  95. package/dist-sdk/src/entities/field/to-tf.d.ts +1 -1
  96. package/dist-sdk/src/entities/field/to-tf.js +19 -5
  97. package/dist-sdk/src/entities/org/category-ref.d.ts +5 -0
  98. package/dist-sdk/src/entities/org/category-ref.js +12 -0
  99. package/dist-sdk/src/entities/record-create-form/from-tf.js +3 -3
  100. package/dist-sdk/src/entities/record-create-form/to-tf.d.ts +1 -0
  101. package/dist-sdk/src/entities/record-create-form/to-tf.js +13 -5
  102. package/dist-sdk/src/entities/relationship/from-tf.js +15 -4
  103. package/dist-sdk/src/entities/role/from-tf.js +10 -4
  104. package/dist-sdk/src/entities/search-table/build.d.ts +1 -1
  105. package/dist-sdk/src/entities/search-table/from-tf.d.ts +1 -0
  106. package/dist-sdk/src/entities/search-table/from-tf.js +6 -0
  107. package/dist-sdk/src/entities/search-table/printer.js +3 -1
  108. package/dist-sdk/src/entities/search-table/to-tf.js +3 -3
  109. package/dist-sdk/src/entities/search-table/types.js +1 -0
  110. package/dist-sdk/src/entities/service-account/from-tf.js +10 -4
  111. package/dist-sdk/src/entities/service-account/to-tf.d.ts +2 -1
  112. package/dist-sdk/src/entities/service-account/to-tf.js +7 -0
  113. package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -1
  114. package/dist-sdk/src/entities/shared/filters/ast.js +3 -0
  115. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +7 -1
  116. package/dist-sdk/src/entities/shared/filters/tf-codec.js +8 -4
  117. package/dist-sdk/src/entities/shared/handle-description.d.ts +12 -0
  118. package/dist-sdk/src/entities/shared/handle-description.js +20 -0
  119. package/dist-sdk/src/entities/shared/types/field-types.d.ts +6 -1
  120. package/dist-sdk/src/entities/shared/types/field-types.js +5 -8
  121. package/dist-sdk/src/entities/skill/build.d.ts +51 -2
  122. package/dist-sdk/src/entities/skill/build.js +65 -8
  123. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +35 -3
  124. package/dist-sdk/src/entities/skill/from-tf.d.ts +11 -0
  125. package/dist-sdk/src/entities/skill/from-tf.js +39 -7
  126. package/dist-sdk/src/entities/skill/index.d.ts +1 -1
  127. package/dist-sdk/src/entities/skill/index.js +1 -1
  128. package/dist-sdk/src/entities/skill/input-coverage.d.ts +21 -0
  129. package/dist-sdk/src/entities/skill/input-coverage.js +148 -5
  130. package/dist-sdk/src/entities/skill/to-tf.d.ts +6 -25
  131. package/dist-sdk/src/entities/skill/to-tf.js +22 -38
  132. package/dist-sdk/src/entities/skill/tools.d.ts +2 -1
  133. package/dist-sdk/src/entities/skill/tools.js +3 -1
  134. package/dist-sdk/src/entities/skill-tool/from-tf.js +10 -3
  135. package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +5 -5
  136. package/dist-sdk/src/entities/skill-tool/to-tf.js +5 -7
  137. package/dist-sdk/src/entities/table/to-tf.js +3 -4
  138. package/dist-sdk/src/entities/task/to-tf.js +3 -2
  139. package/dist-sdk/src/entities/view/from-tf.js +36 -10
  140. package/dist-sdk/src/entities/view/to-tf.d.ts +2 -0
  141. package/dist-sdk/src/entities/view/to-tf.js +44 -30
  142. package/dist-sdk/src/entities/widget/from-tf.js +2 -2
  143. package/dist-sdk/src/entities/widget/to-tf.d.ts +1 -0
  144. package/dist-sdk/src/entities/widget/to-tf.js +52 -23
  145. package/dist-sdk/src/graph/index.d.ts +19 -1
  146. package/dist-sdk/src/graph/index.js +20 -0
  147. package/dist-sdk/src/graph/types.d.ts +19 -0
  148. package/package.json +10 -5
@@ -17,5 +17,5 @@ export { AUTOMATION_RESOURCE_TYPES, AUTOMATION_TASK_TYPES, AUTOMATION_TRIGGER_TY
17
17
  export * as filter from "../shared/filters/index.js";
18
18
  export { automationStatus, chainableTrigger, actions, automation, type ActionBuilder, type ActionChain, type ActionDef, type ActionOptions, type ActionSequenceDef, type ActionsStarted, type AutomationConfigured, type AutomationOptions, type AutomationStatus, type ForkJoinBranch, type ForkJoinBranchBuilder, type ForkJoinConfig, type ForEachBuilder, type ForEachConfig, type NestedActionBuilder, type NestedActionChain, type NestedActionContext, type OperatorChild, type SwitchCase, type SwitchCaseBuilder, type SwitchConfig, type TriggerChain, type TriggerDef, type TriggerParamMeta } from "./build.js";
19
19
  export { ScriptCodeError, type ScriptCodeFn, type ScriptInput } from "./script-code.js";
20
- export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSearchTableOutput, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type CalculationEntry, type CalculationExpression, type CalculationInclude, type CalculationOptions, type CalculationOutputs, type CalculationValueInput, type CalculationValueOptions, type CalculationValueOutputs, type CalculationValues, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type ProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationOptions, type SaveAttachmentOptions, type ScriptOutputProperties, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
20
+ export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, filterAction, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, type AddWatcherOptions, type AiAgentOptions, type AiAgentOutput, type AiAgentOutputField, type AiAgentOutputFieldType, type AiClassifyCategorySource, type AiClassifyOptions, type AiClassifyStaticCategory, type AiEmailAnalysisOptions, type AiFileAnalysisOptions, type AiSearchTableOptions, type AiSearchTableOutput, type AiSummarizeOptions, type AiTransformOptions, type ApiRequestHeader, type ApiRequestOptions, type ApprovalChainOptions, type ApprovalChainTemplateOptions, type ApprovalStatusUpdateOptions, type ApprovalStatusUpdateStatus, type AssignGroupOptions, type AssignUserOptions, type AssignmentEngineOptions, type BulkExcelFieldMapping, type BulkExcelFieldSource, type BulkExcelOptions, type CalculationEntry, type CalculationExpression, type CalculationInclude, type CalculationOptions, type CalculationOutputs, type CalculationValueInput, type CalculationValueOptions, type CalculationValueOutputs, type CalculationValues, type CreateRecordOptions, type CreateRecordOutput, type EmailAttachment, type ExecuteScriptOptions, type FieldAssignment, type FilterActionOptions, type FindRelatedRecordsOptions, type GenerateReportOptions, type InitiateCallOptions, type InitiateEmailConversationOptions, type InitiateEmailFirstEmail, type LegacyCalculationOptions, type MultiSelectUpdateMode, type NotificationOptions, type PostCommentOptions, type PostTeamsMessageOptions, type LegacyProcedureOptions, type ProcedureOptions, type TypedProcedureOptions, type ReadFileDataSource, type ReadFileOptions, type RecordFieldLockingOptions, type RecordId, type RecordReference, type RecordSearchOptions, type RecordSearchOutput, type RelateRecordsOptions, type RunAutomationInput, type RunAutomationOptions, type SaveAttachmentOptions, type ScriptOutputProperties, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
21
21
  export { approvalProcessStatusUpdated, attachment, commentAdded, conversationEnd, dataMine, emailReceived, onDemand, recordCreated, recordUpdated, schedule, slackMessage, surveyResponseCreate, temporal, webHook, webhook, type AttachmentTriggerOptions, type AttachmentTriggerOutput, type CommentAddedTriggerOptions, type CommentAddedTriggerOutput, type ConversationEndConversationType, type ConversationEndTriggerOptions, type ConversationEndTriggerOutput, type DataMineTriggerOptions, type EmailReceivedTriggerOptions, type EmailReceivedTriggerOutput, type RecordTriggerOptions, type RecordTriggerOutput, type ScheduleFrequency, type ScheduleTriggerOptions, type ScheduleTriggerOutput, type SlackMessageTriggerOutput, type SurveyResponseCreateTriggerOptions, type SurveyResponseCreateTriggerOutput, type TemporalTriggerOptions, type TemporalUnit, type WebhookTriggerOptions, type WebhookTriggerOutput, type Weekday, type approvalProcessStatusUpdatedStatus, type approvalProcessStatusUpdatedTriggerOptions } from "./triggers.js";
@@ -1,7 +1,7 @@
1
1
  /** The automation entity's registry entry (see src/graph/). */
2
2
  import { sanitizeName, tfLabelToTsLabel, isTfExpr } from "../../engine/tf/index.js";
3
3
  import { renderAutomationCatalogEntry } from "./catalog-render.js";
4
- import { printAutomationV2 } from "./deserializer/print-automation.js";
4
+ import { preserveAuthoredAutomationRevision, printAutomationV2 } from "./deserializer/print-automation.js";
5
5
  import { automationFromTf, automationOwnedAddresses } from "./from-tf.js";
6
6
  import { automationToTf } from "./to-tf.js";
7
7
  import { ALL_AUTOMATION_SUB_TYPES, AUTOMATION_RESOURCE_TYPE, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
@@ -103,6 +103,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
103
103
  const items = [];
104
104
  const skipped = [];
105
105
  const diagnostics = [];
106
+ const adoptionAddressAliases = [];
106
107
  for (const autoBlock of ownBlocks) {
107
108
  const autoLabel = autoBlock.label ?? "";
108
109
  const doc = { blocks: [...stream.allBlocks] };
@@ -111,12 +112,13 @@ function extractAutomations(ownBlocks, stream, ctx) {
111
112
  // (one owned-address walk) relative to from-tf.
112
113
  registerForeignObjectIdDeps(doc, autoLabel, ctx);
113
114
  try {
114
- const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.picklistOptionLabelById, ctx.fieldNamesByOwnerRefName, ctx.foreignAppRefNames, ctx.foreignElementRefNames);
115
+ const extracted = automationFromTf(doc, autoLabel, ctx.appRefName, ctx.foreignFieldRefsById, ctx.foreignFieldRefsByDataAddress, ctx.foreignTableRefsById, ctx.picklistOptionLabelById, ctx.fieldNamesByOwnerRefName, ctx.foreignAppRefNames, ctx.foreignElementRefNames, ctx.procedureKeysByDiscriminator);
115
116
  // Keep automationFromTf's label-derived refName — agent/skill tools store
116
117
  // the same scopedLabelToBagKey as automationKey. Pushing bare AST (name
117
118
  // only) made missing-automation diagnostics false-positive on every real
118
119
  // extract (issue #395 / PR #417 review).
119
120
  items.push({ ...extracted.ast, refName: extracted.refName });
121
+ adoptionAddressAliases.push(...extracted.adoptionAddressAliases);
120
122
  }
121
123
  catch (err) {
122
124
  // Report the automation's FULL graph (trigger/tasks/branches/publish),
@@ -128,7 +130,7 @@ function extractAutomations(ownBlocks, stream, ctx) {
128
130
  diagnostics.push(`${autoLabel}: ${err instanceof Error ? err.message : String(err)}`);
129
131
  }
130
132
  }
131
- return { items, skipped, diagnostics };
133
+ return { items, skipped, diagnostics, adoptionAddressAliases };
132
134
  }
133
135
  export const automationModule = {
134
136
  kind: "automation",
@@ -192,6 +194,7 @@ export const automationModule = {
192
194
  }),
193
195
  };
194
196
  },
197
+ mergePulledSource: preserveAuthoredAutomationRevision,
195
198
  toTf: (entity, ctx) => automationToTf(entity, {
196
199
  appRefName: ctx.appRefName,
197
200
  appTfLabel: ctx.appTfLabel,
@@ -201,6 +204,7 @@ export const automationModule = {
201
204
  fieldNames: ctx.fieldNames ?? new Map(),
202
205
  fieldMetadata: ctx.fieldMetadata ?? new Map(),
203
206
  ...(ctx.fieldNamesByAppRefName !== undefined ? { fieldNamesByAppRefName: ctx.fieldNamesByAppRefName } : {}),
207
+ ...(ctx.allowUnknownPicklistOptions === true ? { allowUnknownPicklistOptions: true } : {}),
204
208
  orgRefs: ctx.orgRefs,
205
209
  workspaceAspects: ctx.workspaceAspects,
206
210
  localsAttrs: ctx.localsAttrs,
@@ -209,6 +213,12 @@ export const automationModule = {
209
213
  .filter((sibling) => sibling.kind === "automation" &&
210
214
  sibling.payload?.status === "ACTIVE")
211
215
  .map((sibling) => sibling.refName)),
216
+ automationNamesByRefName: new Map((ctx.siblingEntities ?? [])
217
+ .filter((sibling) => sibling.kind === "automation")
218
+ .flatMap((sibling) => {
219
+ const name = sibling.payload?.name;
220
+ return typeof name === "string" && name !== "" ? [[sibling.refName, name]] : [];
221
+ })),
212
222
  }),
213
223
  },
214
224
  catalog: {
@@ -7,10 +7,9 @@
7
7
  * directly against a live-deployed task's own `refs` map (Preston High
8
8
  * integration run, item 235) — that map is Title-Case (`Reason`, `Response`,
9
9
  * `Success`), so the wire name here must match that casing exactly, not the
10
- * lowercase property name. The aiSummarize/aiTransform `response` entries
11
- * predate that discovery and have never been exercised by a fixture or live
12
- * run that references their `.output` from a downstream task/output — their
13
- * casing is UNVERIFIED and may have the same bug.
10
+ * lowercase property name. aiSummarize/aiTransform share the same Title-Case
11
+ * refs map (`Response`, `Success`) — confirmed live via apply failures when
12
+ * downstream tasks referenced `.output` with the old lowercase wire name.
14
13
  *
15
14
  * Used by `build.ts` (forward: `output` → wire name) and `from-tf.ts`
16
15
  * (inverse: wire name → `output`) — kept dependency-free so importing it from
@@ -25,3 +24,12 @@ export declare const OUTPUT_KEY_WIRE_NAME: Readonly<Record<string, string>>;
25
24
  export declare const API_TASK_REF_WIRE_NAMES: Readonly<Record<string, string>>;
26
25
  /** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
27
26
  export declare const API_TASK_REF_AUTHORING_NAMES: Readonly<Record<string, string>>;
27
+ /**
28
+ * Resolve a single `elementum_api_task` refs[] wire label (e.g. "File",
29
+ * "Content Type") to its authoring path segments (e.g. ["file"], ["file",
30
+ * "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES} — some authoring
31
+ * names are dotted (`file.content`) since they nest under the `file` output.
32
+ * Returns undefined for a wire label with no known authoring counterpart so
33
+ * callers can fall back to the generic segment mapping.
34
+ */
35
+ export declare function apiTaskRefAuthoringPath(wireSegment: string): string[] | undefined;
@@ -7,18 +7,17 @@
7
7
  * directly against a live-deployed task's own `refs` map (Preston High
8
8
  * integration run, item 235) — that map is Title-Case (`Reason`, `Response`,
9
9
  * `Success`), so the wire name here must match that casing exactly, not the
10
- * lowercase property name. The aiSummarize/aiTransform `response` entries
11
- * predate that discovery and have never been exercised by a fixture or live
12
- * run that references their `.output` from a downstream task/output — their
13
- * casing is UNVERIFIED and may have the same bug.
10
+ * lowercase property name. aiSummarize/aiTransform share the same Title-Case
11
+ * refs map (`Response`, `Success`) — confirmed live via apply failures when
12
+ * downstream tasks referenced `.output` with the old lowercase wire name.
14
13
  *
15
14
  * Used by `build.ts` (forward: `output` → wire name) and `from-tf.ts`
16
15
  * (inverse: wire name → `output`) — kept dependency-free so importing it from
17
16
  * either side can never introduce a cycle.
18
17
  */
19
18
  export const OUTPUT_KEY_WIRE_NAME = {
20
- aiSummarize: "response",
21
- aiTransform: "response",
19
+ aiSummarize: "Response",
20
+ aiTransform: "Response",
22
21
  aiClassify: "Response",
23
22
  documentModel: "text",
24
23
  };
@@ -38,3 +37,15 @@ export const API_TASK_REF_WIRE_NAMES = {
38
37
  };
39
38
  /** Inverse of {@link API_TASK_REF_WIRE_NAMES} for export jsonencode envelopes. */
40
39
  export const API_TASK_REF_AUTHORING_NAMES = Object.fromEntries(Object.entries(API_TASK_REF_WIRE_NAMES).map(([authoring, wire]) => [wire, authoring]));
40
+ /**
41
+ * Resolve a single `elementum_api_task` refs[] wire label (e.g. "File",
42
+ * "Content Type") to its authoring path segments (e.g. ["file"], ["file",
43
+ * "contentType"]) via {@link API_TASK_REF_AUTHORING_NAMES} — some authoring
44
+ * names are dotted (`file.content`) since they nest under the `file` output.
45
+ * Returns undefined for a wire label with no known authoring counterpart so
46
+ * callers can fall back to the generic segment mapping.
47
+ */
48
+ export function apiTaskRefAuthoringPath(wireSegment) {
49
+ const authoring = API_TASK_REF_AUTHORING_NAMES[wireSegment];
50
+ return authoring !== undefined ? authoring.split(".") : undefined;
51
+ }
@@ -42,7 +42,7 @@ export declare function freeIdentifiers(body: string, params: ReadonlySet<string
42
42
  /**
43
43
  * Look up task `name`'s `code:` body verbatim from the automation file
44
44
  * `elementum build` is currently importing (tracked engine-side by
45
- * `withSourceText` around each own-file-child's `jiti.import()` —
45
+ * `withSourceText` around each own-file-child's import —
46
46
  * `src/engine/build/build.ts`/`source-context.ts`), or `undefined` if
47
47
  * there's no tracked source (not running under `elementum build`, e.g. an
48
48
  * automation constructed directly in a test) or the name/shape wasn't found
@@ -17,24 +17,22 @@
17
17
  * reference, not the value — on the platform `x` is undefined. A best-effort
18
18
  * free-identifier scan throws at def() time on obvious captures (per the
19
19
  * tranche decision: best effort, not a guarantee).
20
- * - WHAT YOU AUTHOR IS TRANSPILED FIRST: jiti/Babel strip type annotations by
21
- * fully re-printing the function from its AST, which normalizes formatting
22
- * (`{done: true}` becomes `{ done: true }`) regardless of the original
23
- * source's spacing. `Function.prototype.toString()` only ever sees that
24
- * reprinted form. For a HAND-authored script this is harmless (there is no
25
- * "original" spacing to preserve — the author's intent survives). For a
26
- * PULLED script it's lossy: the platform's exact text stops matching after
27
- * one `edk build`, producing a spurious plan diff forever.
20
+ * - WHAT YOU AUTHOR IS TYPE-STRIPPED FIRST: Node erases type annotations by
21
+ * overwriting them with spaces, so `Function.prototype.toString()` returns
22
+ * the original spacing but blanks wherever a type used to be. For a
23
+ * HAND-authored script that is usually harmless. For a PULLED script it is
24
+ * lossy: the platform's exact text stops matching after one `edk build`,
25
+ * producing a spurious plan diff forever.
28
26
  *
29
27
  * `elementum build` avoids that loss for pulled scripts WITHOUT relying on
30
28
  * `toString()` at all: `src/engine/build/build.ts` wraps each automation
31
- * file's jiti import with that file's own untranspiled text (engine-side,
29
+ * file's import with that file's own on-disk text (engine-side,
32
30
  * entity-agnostic — `source-context.ts`), and `tryExtractFromCurrentSource`
33
31
  * here locates the matching `.executeScript("name", { code: (input) => {...}
34
32
  * })` call at any fluent-chain depth by a
35
33
  * lightweight source scan — the same string/comment-aware tokenizing already
36
34
  * used by {@link inferOutputSchema} — and slices the body's ORIGINAL text directly out
37
- * of the file, never touching the transpiled function. `extractScriptBody`
35
+ * of the file, never touching the loaded function. `extractScriptBody`
38
36
  * (the `toString()` path) remains the fallback for contexts with no tracked
39
37
  * source (tests constructing automations directly).
40
38
  */
@@ -405,6 +403,12 @@ export function freeIdentifiers(body, params) {
405
403
  for (const id of (m[1] ?? "").matchAll(/[A-Za-z_$][\w$]*/g))
406
404
  declared.add(id[0]);
407
405
  }
406
+ // Arrow functions may omit parentheses for a single parameter (`row => …`).
407
+ // Without this pass, common callbacks such as `items.map(row => row.value)`
408
+ // are incorrectly reported as closure captures.
409
+ for (const m of stripped.matchAll(/(?:\basync\s+)?([A-Za-z_$][\w$]*)\s*=>/g)) {
410
+ declared.add(m[1]);
411
+ }
408
412
  // function / class names AND their formal parameters (nested helpers in
409
413
  // pulled scripts are common — Sanofi getSuppliers_1's levenshtein helpers).
410
414
  for (const m of stripped.matchAll(/\b(?:function|class)\s+([A-Za-z_$][\w$]*)/g))
@@ -588,7 +592,7 @@ const scanCache = new WeakMap();
588
592
  /**
589
593
  * Look up task `name`'s `code:` body verbatim from the automation file
590
594
  * `elementum build` is currently importing (tracked engine-side by
591
- * `withSourceText` around each own-file-child's `jiti.import()` —
595
+ * `withSourceText` around each own-file-child's import —
592
596
  * `src/engine/build/build.ts`/`source-context.ts`), or `undefined` if
593
597
  * there's no tracked source (not running under `elementum build`, e.g. an
594
598
  * automation constructed directly in a test) or the name/shape wasn't found
@@ -0,0 +1,2 @@
1
+ /** Canonical Terraform label for an authored automation task ref key. */
2
+ export declare function taskTfLabel(automationLabel: string, refKey: string): string;
@@ -0,0 +1,18 @@
1
+ import { isCanonicalTsLabel, sanitizeName, tsLabelToTfLabel } from "../../engine/tf/index.js";
2
+ /** Canonical Terraform label for an authored automation task ref key. */
3
+ export function taskTfLabel(automationLabel, refKey) {
4
+ // ei's task label is `<auto>_<sanitizeName(task name)>` for display-name
5
+ // stems. Pulled refKeys that are already canonical camelCase (e.g.
6
+ // `commodityBHit_1`) must use the lossless `tsLabelToTfLabel` bijection —
7
+ // `sanitizeName` lowercases before splitCamelCase and collapses
8
+ // single-letter camel segments (`commodityBHit` → `commodityb_hit`), which
9
+ // plans destroy+create against export's `commodity_b_hit_1`.
10
+ //
11
+ // ALLCAPS / SCREAMING_SNAKE refKeys (`GREETING`) also round-trip the
12
+ // bijection (via ugly `_g_r_e_e_t_i_n_g`), but ei's SanitizeName yields
13
+ // `greeting` — require a lowercase letter before preferring the bijection.
14
+ const normalized = isCanonicalTsLabel(refKey) && /[a-z]/.test(refKey)
15
+ ? tsLabelToTfLabel(refKey)
16
+ : sanitizeName(refKey);
17
+ return normalized.startsWith(`${automationLabel}_`) ? normalized : `${automationLabel}_${normalized}`;
18
+ }
@@ -11,7 +11,7 @@
11
11
  * accept a literal or a `ctx` `Ref` and are pre-serialized to the platform's
12
12
  * `ValueReference` JSON via the shared, agnostic `serializeValueOrRef`.
13
13
  */
14
- import type { AgentRef, AppOrElementRef, ApprovalProcessRef, AutomationCatalogRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, OutputPropertyRef, PhoneServiceRef, SearchTableRef, TableRef } from "../../catalog/index.js";
14
+ import type { AgentRef, AppOrElementRef, ApprovalProcessRef, AutomationCatalogRef, CloudLinkRef, ConnectorRef, DocumentModelFieldRef, FieldRef, FileReaderCatalogRef, OutputPropertyRef, PhoneServiceRef, ProcedureParameterType, ProcedureRef, SearchTableRef, TableRef } from "../../catalog/index.js";
15
15
  import type { UnsafePlatformId } from "../../core/platform-id.js";
16
16
  import type { CalculationInclude, Expr, ExprCardinality, ExprContext, ExprType } from "../field/calc/types.js";
17
17
  import type { RecordId, RecordShape } from "../field/record-shape.js";
@@ -167,6 +167,7 @@ export type AiAgentOutputFieldType = "text" | "number" | "decimal" | "boolean" |
167
167
  export interface AiAgentOutputField {
168
168
  readonly type: AiAgentOutputFieldType;
169
169
  readonly description?: string;
170
+ readonly required?: boolean;
170
171
  }
171
172
  /** TS type a structured-output field of the given declared type resolves to. */
172
173
  type AiAgentFieldTs<T extends AiAgentOutputFieldType> = T extends "number" | "decimal" ? number : T extends "boolean" ? boolean : string;
@@ -370,9 +371,12 @@ export interface ApiRequestOptions {
370
371
  }
371
372
  export declare function apiRequest(opts: ApiRequestOptions): ActionDef<{
372
373
  response: unknown;
374
+ file?: unknown;
375
+ statusCode?: unknown;
376
+ textResponse?: unknown;
373
377
  }>;
374
378
  export interface AiSearchTableOptions {
375
- readonly table: SearchTableRef;
379
+ readonly table: SearchTableRef | UnsafePlatformId;
376
380
  readonly query: ValueOrRef<unknown>;
377
381
  readonly filter?: Filter;
378
382
  readonly limit?: number;
@@ -514,6 +518,29 @@ export interface UnzipOptions {
514
518
  readonly file: ValueOrRef<unknown>;
515
519
  }
516
520
  export declare function unzip(opts: UnzipOptions): ActionDef<Empty>;
521
+ /**
522
+ * Placeholder for a platform task type EDK's automation module doesn't
523
+ * implement yet (e.g. a report-generation task). The platform exports it as a
524
+ * read-only `elementum_unmanaged_task_reference` data source rather than a
525
+ * real resource — this builder preserves that reference (and, critically,
526
+ * its real position in the task tree) in authored/pulled source instead of
527
+ * silently dropping it or hoisting whatever chains off it out of its real
528
+ * switch case / forkJoin branch (edk#821). It carries no CRUD: the
529
+ * referenced task's own configuration is not authorable, only its identity
530
+ * and position.
531
+ *
532
+ * `id` requires the `unsafePlatformId` wrapper rather than a bare string —
533
+ * deliberately awkward to hand-author, since this task has no CRUD and
534
+ * requires a `workflow_id` that doesn't exist pre-publish; in practice this
535
+ * builder is reconstructed by `edk pull`, not hand-written.
536
+ */
537
+ export interface UnimplementedTaskOptions {
538
+ /** The unsupported task's raw platform id. */
539
+ readonly id: UnsafePlatformId;
540
+ /** The unsupported task's platform GraphQL typename, e.g. "WorkflowGenerateAspectAppReportTask". */
541
+ readonly taskType: string;
542
+ }
543
+ export declare function unimplementedTask(opts: UnimplementedTaskOptions): ActionDef<Record<string, never>>;
517
544
  export interface GenerateReportOptions {
518
545
  readonly record: ValueOrRef<unknown>;
519
546
  readonly reportId: string;
@@ -534,14 +561,33 @@ export interface AssignmentEngineOptions {
534
561
  readonly record: ValueOrRef<unknown>;
535
562
  }
536
563
  export declare function assignmentEngine(opts: AssignmentEngineOptions): ActionDef<Empty>;
537
- export interface ProcedureOptions {
564
+ export interface LegacyProcedureOptions {
538
565
  readonly procedureId: string;
539
566
  /** A raw cloud link id, or a `catalog.cloudLinks.<handle>` reference. */
540
567
  readonly cloudLinkId: string | CloudLinkRef;
568
+ readonly procedure?: never;
541
569
  /** Positional arguments (index == position). */
542
570
  readonly parameters?: readonly ValueOrRef<unknown>[];
543
571
  }
544
- export declare function procedure(opts: ProcedureOptions): ActionDef<{
572
+ type ProcedureParameterValues<Parameters extends readonly ProcedureParameterType[]> = {
573
+ readonly [Index in keyof Parameters]: ValueOrRef<unknown>;
574
+ };
575
+ export type TypedProcedureOptions<Parameters extends readonly ProcedureParameterType[]> = {
576
+ readonly procedure: ProcedureRef<Parameters>;
577
+ readonly procedureId?: never;
578
+ readonly cloudLinkId?: never;
579
+ } & (number extends Parameters["length"] ? {
580
+ readonly parameters?: readonly ValueOrRef<unknown>[];
581
+ } : Parameters extends readonly [] ? {
582
+ readonly parameters?: readonly [];
583
+ } : {
584
+ readonly parameters: ProcedureParameterValues<Parameters>;
585
+ });
586
+ export type ProcedureOptions = LegacyProcedureOptions | TypedProcedureOptions<readonly ProcedureParameterType[]>;
587
+ export declare function procedure<const Parameters extends readonly ProcedureParameterType[]>(opts: TypedProcedureOptions<Parameters>): ActionDef<{
588
+ output: unknown;
589
+ }>;
590
+ export declare function procedure(opts: LegacyProcedureOptions): ActionDef<{
545
591
  output: unknown;
546
592
  }>;
547
593
  export interface InitiateCallOptions {
@@ -623,12 +669,13 @@ export type CalculationOptions<Values extends CalculationValues = CalculationVal
623
669
  export declare function calculation<const Values extends CalculationValues>(opts: CalculationOptions<Values>): ActionDef<CalculationValueOutputs<Values>>;
624
670
  /** @deprecated Prefer `calculation({ values: { name: expression } })`. */
625
671
  export declare function calculation<const Entries extends readonly CalculationEntry[]>(opts: LegacyCalculationOptions<Entries>): ActionDef<CalculationOutputs<Entries>>;
672
+ /** The status to set on the referenced approval. Mirrors the provider's `status` validator. */
673
+ export type ApprovalStatusUpdateStatus = "APPROVED" | "DENIED" | "EXCEPTION";
626
674
  export interface ApprovalStatusUpdateOptions {
627
- readonly approvalChainTemplateId: string;
628
- readonly record: ValueOrRef<unknown>;
629
- readonly status: string;
675
+ /** Value reference to the approval to update (typically an `approvalChain` task's output). */
676
+ readonly approvalReference: ValueOrRef<unknown>;
677
+ readonly status: ApprovalStatusUpdateStatus;
630
678
  readonly reason?: ValueOrRef<unknown>;
631
- readonly tags?: ValueOrRef<unknown>;
632
679
  }
633
680
  export declare function approvalStatusUpdate(opts: ApprovalStatusUpdateOptions): ActionDef<Empty>;
634
681
  export interface RunAutomationInput {
@@ -662,7 +709,11 @@ export interface RunAutomationOptions<A extends AutomationCatalogRef = Automatio
662
709
  * never carries a platform UUID.
663
710
  */
664
711
  readonly inputs?: readonly RunAutomationInput[];
665
- /** Output property names to surface. */
712
+ /**
713
+ * Published output property names to expose on the typed action result.
714
+ * Static targets surface those refs automatically; the Terraform compiler
715
+ * does not send a redundant `output_mappings` payload to the backend.
716
+ */
666
717
  readonly outputs?: readonly string[];
667
718
  }
668
719
  export declare function runAutomation<const A extends AutomationCatalogRef>(opts: RunAutomationOptions<A>): ActionDef<RunAutomationOutput<A>>;
@@ -149,6 +149,7 @@ export function aiAgent(opts) {
149
149
  name,
150
150
  type: def.type.toUpperCase(),
151
151
  ...(def.description !== undefined ? { description: def.description } : {}),
152
+ ...(def.required !== undefined ? { required: def.required } : {}),
152
153
  })),
153
154
  }
154
155
  : {}),
@@ -482,6 +483,9 @@ export function saveAttachment(opts) {
482
483
  export function unzip(opts) {
483
484
  return { key: "unzip", config: { file: serializeValueOrRef(opts.file) } };
484
485
  }
486
+ export function unimplementedTask(opts) {
487
+ return { key: "unimplementedTask", config: { id: opts.id, taskType: opts.taskType } };
488
+ }
485
489
  export function generateReport(opts) {
486
490
  return {
487
491
  key: "aspectAppReportGeneration",
@@ -517,12 +521,22 @@ export function assignmentEngine(opts) {
517
521
  };
518
522
  }
519
523
  export function procedure(opts) {
524
+ const parameters = (opts.parameters ?? []).map((v, index) => ({ index, value: serializeValueOrRef(v) }));
525
+ if ("procedure" in opts && opts.procedure !== undefined) {
526
+ return {
527
+ key: "procedure",
528
+ config: {
529
+ procedure: opts.procedure,
530
+ parameters,
531
+ },
532
+ };
533
+ }
520
534
  return {
521
535
  key: "procedure",
522
536
  config: {
523
537
  procedureId: opts.procedureId,
524
538
  cloudLinkId: opts.cloudLinkId,
525
- parameters: (opts.parameters ?? []).map((v, index) => ({ index, value: serializeValueOrRef(v) })),
539
+ parameters,
526
540
  },
527
541
  };
528
542
  }
@@ -679,11 +693,9 @@ export function approvalStatusUpdate(opts) {
679
693
  return {
680
694
  key: "approvalStatusUpdate",
681
695
  config: {
682
- approvalChainTemplateId: opts.approvalChainTemplateId,
683
- recordId: serializeValueOrRef(opts.record),
696
+ approvalReference: serializeValueOrRef(opts.approvalReference),
684
697
  status: opts.status,
685
698
  ...(opts.reason !== undefined ? { reason: serializeValueOrRef(opts.reason) } : {}),
686
- ...(opts.tags !== undefined ? { tags: serializeValueOrRef(opts.tags) } : {}),
687
699
  },
688
700
  };
689
701
  }
@@ -18,11 +18,15 @@ export interface AutomationToTfContext {
18
18
  * typed against a DIFFERENT aspect resolve cross-app refs (#490).
19
19
  */
20
20
  readonly fieldNamesByAppRefName?: ReadonlyMap<string, ReadonlyMap<string, string>>;
21
+ /** Build-time tolerance for stale labels retained by pulled automations. */
22
+ readonly allowUnknownPicklistOptions?: boolean;
21
23
  readonly orgRefs?: OrgRefLookup;
22
24
  readonly diagnostics?: string[];
23
25
  readonly serviceAccounts?: Readonly<Record<string, AppServiceAccount>>;
24
26
  /** App-local automations whose publish resource will be emitted in this build. */
25
27
  readonly activeAutomationRefNames?: ReadonlySet<string>;
28
+ /** Display names for app-local authored automations, keyed by source refName. */
29
+ readonly automationNamesByRefName?: ReadonlyMap<string, string>;
26
30
  /**
27
31
  * Every app/element stream root discovered in this same build, keyed by
28
32
  * `workspaceAspectKey` — lets a cross-aspect token (an app/element ref, or