@elementumai/edk 0.9.17 → 0.9.19

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 (130) hide show
  1. package/README.md +8 -3
  2. package/dist-sdk/src/catalog/factories.d.ts +11 -0
  3. package/dist-sdk/src/catalog/factories.js +6 -0
  4. package/dist-sdk/src/catalog/index.d.ts +2 -2
  5. package/dist-sdk/src/catalog/index.js +2 -2
  6. package/dist-sdk/src/catalog/org.d.ts +39 -1
  7. package/dist-sdk/src/catalog/org.js +460 -50
  8. package/dist-sdk/src/catalog/types.d.ts +12 -2
  9. package/dist-sdk/src/catalog/types.js +2 -0
  10. package/dist-sdk/src/engine/pull/ref-only.js +54 -20
  11. package/dist-sdk/src/engine/pull/result-output.d.ts +2 -0
  12. package/dist-sdk/src/engine/pull/result-output.js +1 -1
  13. package/dist-sdk/src/engine/tf/expr.js +38 -13
  14. package/dist-sdk/src/engine/tf/index.d.ts +2 -2
  15. package/dist-sdk/src/engine/tf/index.js +2 -2
  16. package/dist-sdk/src/engine/tf/labels.d.ts +2 -0
  17. package/dist-sdk/src/engine/tf/labels.js +4 -0
  18. package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
  19. package/dist-sdk/src/engine/tf/parse.js +105 -6
  20. package/dist-sdk/src/engine/workspace/loader.js +49 -12
  21. package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
  22. package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
  23. package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
  24. package/dist-sdk/src/entities/access-policy/to-tf.js +11 -4
  25. package/dist-sdk/src/entities/agent-tool/to-tf.js +2 -1
  26. package/dist-sdk/src/entities/app/build.d.ts +10 -0
  27. package/dist-sdk/src/entities/app/build.js +0 -13
  28. package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +6 -1
  29. package/dist-sdk/src/entities/app/from-tf.js +4 -3
  30. package/dist-sdk/src/entities/app/index.d.ts +2 -0
  31. package/dist-sdk/src/entities/app/index.js +1 -0
  32. package/dist-sdk/src/entities/app/module.js +13 -0
  33. package/dist-sdk/src/entities/app/to-tf.js +2 -0
  34. package/dist-sdk/src/entities/automation/build.d.ts +2 -1
  35. package/dist-sdk/src/entities/automation/build.js +27 -0
  36. package/dist-sdk/src/entities/automation/deserializer/print-automation.js +6 -0
  37. package/dist-sdk/src/entities/automation/from-tf.js +156 -26
  38. package/dist-sdk/src/entities/automation/index.d.ts +1 -1
  39. package/dist-sdk/src/entities/automation/module.d.ts +2 -0
  40. package/dist-sdk/src/entities/automation/module.js +56 -0
  41. package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -4
  42. package/dist-sdk/src/entities/automation/output-field-types.js +23 -5
  43. package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
  44. package/dist-sdk/src/entities/automation/system-ref-name.js +44 -0
  45. package/dist-sdk/src/entities/automation/task-output-labels.d.ts +15 -0
  46. package/dist-sdk/src/entities/automation/task-output-labels.js +38 -0
  47. package/dist-sdk/src/entities/automation/tasks.d.ts +37 -5
  48. package/dist-sdk/src/entities/automation/tasks.js +23 -1
  49. package/dist-sdk/src/entities/automation/to-tf.js +158 -84
  50. package/dist-sdk/src/entities/automation/types.js +1 -0
  51. package/dist-sdk/src/entities/chart/from-tf.js +33 -17
  52. package/dist-sdk/src/entities/chart/module.js +3 -1
  53. package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
  54. package/dist-sdk/src/entities/chart/printer.js +26 -16
  55. package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
  56. package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
  57. package/dist-sdk/src/entities/chart/to-tf.js +12 -10
  58. package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
  59. package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
  60. package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
  61. package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
  62. package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
  63. package/dist-sdk/src/entities/dynamic-layout/build.d.ts +51 -2
  64. package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
  65. package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
  66. package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
  67. package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
  68. package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
  69. package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
  70. package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
  71. package/dist-sdk/src/entities/element/build.d.ts +8 -0
  72. package/dist-sdk/src/entities/element/build.js +1 -0
  73. package/dist-sdk/src/entities/element/from-tf.d.ts +1 -0
  74. package/dist-sdk/src/entities/element/from-tf.js +6 -2
  75. package/dist-sdk/src/entities/element/index.d.ts +1 -0
  76. package/dist-sdk/src/entities/element/index.js +1 -0
  77. package/dist-sdk/src/entities/element/module.js +2 -0
  78. package/dist-sdk/src/entities/element/to-tf.js +12 -0
  79. package/dist-sdk/src/entities/field/from-tf.d.ts +2 -0
  80. package/dist-sdk/src/entities/field/from-tf.js +11 -0
  81. package/dist-sdk/src/entities/field/to-tf.js +13 -9
  82. package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
  83. package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
  84. package/dist-sdk/src/entities/relationship/to-tf.d.ts +8 -0
  85. package/dist-sdk/src/entities/relationship/to-tf.js +19 -10
  86. package/dist-sdk/src/entities/shared/filters/ast.d.ts +7 -2
  87. package/dist-sdk/src/entities/shared/filters/index.d.ts +23 -2
  88. package/dist-sdk/src/entities/shared/filters/index.js +24 -1
  89. package/dist-sdk/src/entities/shared/filters/print.js +22 -4
  90. package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +23 -3
  91. package/dist-sdk/src/entities/shared/filters/tf-codec.js +60 -18
  92. package/dist-sdk/src/entities/shared/filters/types.d.ts +13 -4
  93. package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
  94. package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
  95. package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
  96. package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
  97. package/dist-sdk/src/entities/skill/access-policy.js +101 -0
  98. package/dist-sdk/src/entities/skill/build.d.ts +3 -0
  99. package/dist-sdk/src/entities/skill/build.js +3 -0
  100. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
  101. package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +21 -0
  102. package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
  103. package/dist-sdk/src/entities/skill/from-tf.js +4 -9
  104. package/dist-sdk/src/entities/skill/index.d.ts +2 -0
  105. package/dist-sdk/src/entities/skill/index.js +1 -0
  106. package/dist-sdk/src/entities/skill/module.js +1 -0
  107. package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
  108. package/dist-sdk/src/entities/skill/to-tf.js +5 -2
  109. package/dist-sdk/src/entities/skill-tool/to-tf.js +2 -1
  110. package/dist-sdk/src/entities/table/to-tf.js +3 -3
  111. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -0
  112. package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +224 -0
  113. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +36 -0
  114. package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +288 -0
  115. package/dist-sdk/src/entities/view/agent-view-layout.d.ts +121 -0
  116. package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
  117. package/dist-sdk/src/entities/view/from-tf.d.ts +3 -1
  118. package/dist-sdk/src/entities/view/from-tf.js +42 -7
  119. package/dist-sdk/src/entities/view/ragnarok.d.ts +7 -0
  120. package/dist-sdk/src/entities/view/ragnarok.js +1 -0
  121. package/dist-sdk/src/entities/view/to-tf.d.ts +10 -1
  122. package/dist-sdk/src/entities/view/to-tf.js +30 -1
  123. package/dist-sdk/src/entities/view/types.js +2 -0
  124. package/dist-sdk/src/entities/widget/to-tf.js +2 -2
  125. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +815 -0
  126. package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +5 -0
  127. package/dist-sdk/src/graph/index.d.ts +43 -0
  128. package/dist-sdk/src/graph/index.js +9 -0
  129. package/dist-sdk/src/graph/types.d.ts +78 -0
  130. package/package.json +11 -1
@@ -11,6 +11,7 @@
11
11
  * Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
12
12
  * record-experience configuration with build/pull round-trip support.
13
13
  */
14
+ import type { AppAgentViewLayout } from "../view/agent-view-layout.js";
14
15
  import { type AgentRef, type AppOrElementOrTaskRef, type AppOrElementRef, type AutomationCatalogRef, type CatalogRef, type ChartRef, type CloudLinkRef, type DashboardRef, type FieldRef, type WidgetRef } from "../../catalog/index.js";
15
16
  import type { WorkflowFieldType } from "../shared/types/field-types.js";
16
17
  import { type SystemFieldKey } from "../../core/system-fields.js";
@@ -263,6 +264,8 @@ export interface AppLayoutSection {
263
264
  readonly color?: string;
264
265
  /** `"group"` only — maximum columns used to arrange the group's fields. */
265
266
  readonly maxColumns?: number;
267
+ /** `"group"` only — an agent from this app whose chat is embedded in the section, with the record as context. */
268
+ readonly agent?: AgentRef;
266
269
  /** `"group"` only — the fields shown in this group, in order. */
267
270
  readonly fields?: readonly AppViewFieldRef[];
268
271
  /** `"group"` only — app-owned action/record widgets shown after the fields. */
@@ -304,6 +307,13 @@ export interface AppAgentView extends ManagedViewSharing {
304
307
  /** Ordered, typed field sorts using the platform's managed-view Sort contract. */
305
308
  readonly sort?: ManagedViewSort;
306
309
  readonly displayOrder?: number;
310
+ /**
311
+ * The Welcome landing screen (image, header, sub-header, branding, custom
312
+ * view). The code owns it: omitting it gives the standard chat, and an
313
+ * apply then removes any live customization. Run `elementum pull app` to
314
+ * bring a UI-made customization into code before applying.
315
+ */
316
+ readonly layout?: AppAgentViewLayout;
307
317
  }
308
318
  /** A calendar view positioned by a date/datetime field (`elementum_calendar_view`). */
309
319
  export interface AppCalendarView extends ManagedViewSharing {
@@ -1,16 +1,3 @@
1
- /**
2
- * v2 app/element authoring — `app`. Parallel to v1 `src/aspects`,
3
- * standalone from it.
4
- *
5
- * Produces a `DeployableEntity` of kind `app`/`element` with `parent: "org"` (apps are
6
- * org-owned), whose payload is the platform's `AgentAspectInput` compose body.
7
- * The cloud link is a `CatalogRef` token resolved at deploy; fields are authored
8
- * inline (a new app's fields get server-assigned ids on compose). Deployed via
9
- * the wire client's compose path (`composeAspect`).
10
- *
11
- * Includes typed scalar, Dropdown/Multi-Select, relation, calculation, and
12
- * record-experience configuration with build/pull round-trip support.
13
- */
14
1
  import { slimTokens } from "../../catalog/index.js";
15
2
  import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS, SYSTEM_FIELD_REQUIRED, SYSTEM_FIELD_TAG_BY_KEY, WRITABLE_SYSTEM_TAG_NAMES, } from "../../core/system-fields.js";
16
3
  import { serializeDisplayBlocks } from "./display-blocks.js";
@@ -9,6 +9,7 @@
9
9
  * pristine-refactor pipeline these shapes are produced from `ei export`
10
10
  * HCL streams instead (see `appFromTf`).
11
11
  */
12
+ import type { NormalizedAgentViewLayout } from "../../view/agent-view-layout-from-tf.js";
12
13
  import type { AppCategory, AppField, AppStage, AspectType } from "../../../core/types/app.js";
13
14
  import type { DisplayBlock } from "../../../core/types/display-block.js";
14
15
  import type { NormalizedAccessPolicy } from "../../access-policy/from-tf.js";
@@ -121,6 +122,8 @@ export interface NormalizedLayoutSection {
121
122
  readonly maxColumns?: number;
122
123
  readonly fields?: readonly string[];
123
124
  readonly widgets?: readonly string[];
125
+ /** `group` only — the app-owned agent embedded in the section, by bag key. */
126
+ readonly agentKey?: string;
124
127
  }
125
128
  /** A stage's record-detail layout, keyed by stage key on `NormalizedApp.layouts`. */
126
129
  export interface NormalizedLayout {
@@ -148,6 +151,7 @@ export interface NormalizedAgentView extends ManagedViewSharing {
148
151
  readonly filter?: Filter<RefExpr, RefExpr>;
149
152
  readonly sort?: NormalizedManagedViewSort;
150
153
  readonly displayOrder?: number;
154
+ readonly layout?: NormalizedAgentViewLayout;
151
155
  }
152
156
  /** A calendar view (`elementum_calendar_view`). */
153
157
  export interface NormalizedCalendarView extends ManagedViewSharing {
@@ -181,6 +185,7 @@ export type NormalizedDashboardWidget = {
181
185
  readonly kind: "app" | "element";
182
186
  };
183
187
  readonly filter?: Filter<RefExpr, RefExpr>;
188
+ readonly sort?: NormalizedManagedViewSort;
184
189
  } | {
185
190
  readonly key: string;
186
191
  readonly name: string;
@@ -267,7 +272,7 @@ export interface NormalizedRecordCreateForm {
267
272
  readonly sections: readonly NormalizedRecordCreateFormSection[];
268
273
  }
269
274
  export interface PulledDynamicLayoutRef {
270
- readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task";
275
+ readonly __pulledRef: "field" | "automation" | "agent" | "app" | "element" | "task" | "widget";
271
276
  readonly key: string;
272
277
  readonly parent?: string;
273
278
  readonly name?: string;
@@ -140,7 +140,7 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
140
140
  }
141
141
  // --- System-field attributes/config → tagged NormalizedField entries.
142
142
  const fields = [];
143
- const owner = { type: APP_RESOURCE_TYPE, label, scope: "app" };
143
+ const owner = { type: APP_RESOURCE_TYPE, label, scope: "app", refName };
144
144
  const customFields = fieldBlocks.flatMap((block) => {
145
145
  const entry = fieldFromTf(block, owner, ctx);
146
146
  return entry === undefined ? [] : [entry];
@@ -218,9 +218,10 @@ export function appFromTf(appBlock, fieldBlocks, ctx, viewBlocks = { layoutBlock
218
218
  ctx.diagnostics.push(`app "${label}": found ${viewBlocks.recordCreateFormBlocks.length} record create forms; only the first is used`);
219
219
  }
220
220
  const recordCreateForm = recordCreateFormFromTf(viewBlocks.recordCreateFormBlocks[0], { type: APP_RESOURCE_TYPE, label, ownerTfLabel: refName, scope: "app" }, ctx);
221
- const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: refName }, ctx);
221
+ const dynamicLayoutOwner = { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label };
222
+ const dynamicLayouts = dynamicLayoutsFromTf(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner, ctx);
222
223
  const relationships = relationshipsFromTf(viewBlocks.relationshipBlocks, { kind: "app", label, ownerRefName: refName, ownerTfLabel: refName, scope: "app" }, ctx);
223
- const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks));
224
+ const widgets = widgetsFromTf(viewBlocks.widgetBlocks, { type: APP_RESOURCE_TYPE, label, ownerRefName: refName, ownerTfLabel: label, scope: "app" }, ctx, dynamicLayoutCompanionWidgetLabels(viewBlocks.dynamicLayoutBlocks, dynamicLayoutOwner));
224
225
  // --- Access policies (entities/access-policy), owner passed in.
225
226
  const accessPolicyOwner = {
226
227
  type: APP_RESOURCE_TYPE,
@@ -20,6 +20,8 @@ export { phoneService, callerAccessMode, type CallerAccessMode, type E164PhoneNu
20
20
  export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
21
21
  export { groupId, userId, type AccessPolicyGroupRef, type AccessPolicyOptions, type AccessPolicyPrincipalRef, type AccessPolicyUserRef, type GroupId, type UserId } from "../access-policy/build.js";
22
22
  export { type ManagedViewSharing } from "../view/sharing.js";
23
+ export { type ElementumBlocksElement, type ElementumBlocksSpec } from "../view/ragnarok.js";
24
+ export { agentViewFontFamily, type AgentViewBlock, type AgentViewBranding, type AgentViewCustomView, type AgentViewFontFamily, type AgentViewHexColor, type AgentViewImage, type AgentViewSpecApp, type AgentViewSpecField, type AgentViewSpecFilterRef, type AppAgentViewLayout, } from "../view/agent-view-layout.js";
23
25
  export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef, type AppRole, type RoleAutoShare, type RoleGroupRef, type RolePermission, type RolePermissionGroup, type RolePermissionLevel, type RoleUserRef } from "../role/build.js";
24
26
  export { serviceAccountRoleRef, serviceAccountStatus, type AppServiceAccount, type ServiceAccountAccessPolicy, type ServiceAccountRoleRef, type ServiceAccountStatus } from "../service-account/build.js";
25
27
  export { serviceAccountRef, type ServiceAccountRef } from "../service-account/ref.js";
@@ -16,6 +16,7 @@ export { agentEvaluation, } from "../agent-evaluation/index.js";
16
16
  export { phoneService, callerAccessMode, } from "../phone-service/index.js";
17
17
  export { preservePulledCalculation } from "./deserializer/pulled-expression.js";
18
18
  export { groupId, userId } from "../access-policy/build.js";
19
+ export { agentViewFontFamily, } from "../view/agent-view-layout.js";
19
20
  export { roleAutoShare, rolePermissionGroup, rolePermissionLevel, userRef } from "../role/build.js";
20
21
  export { serviceAccountRoleRef, serviceAccountStatus } from "../service-account/build.js";
21
22
  export { serviceAccountRef } from "../service-account/ref.js";
@@ -95,6 +95,19 @@ export const appModule = {
95
95
  { attribute: "status_field_name", value: "Status" },
96
96
  { attribute: "title_field_name", value: "Title" },
97
97
  ],
98
+ keyedLocalAliases: [{
99
+ listAttribute: "stages",
100
+ keyAttribute: "key",
101
+ nameAttribute: "name",
102
+ byNameSuffix: "_stage_options_by_label",
103
+ byKeySuffix: "_stage_ids_by_key",
104
+ }],
105
+ computedMapAttributes: [{
106
+ attribute: "status_option_ids_by_label",
107
+ listAttribute: "status_options",
108
+ keyAttribute: "label",
109
+ valueAttribute: "id",
110
+ }],
98
111
  },
99
112
  catalog: NO_CATALOG,
100
113
  };
@@ -268,6 +268,7 @@ export function appToTf(entity, ctx) {
268
268
  stageTfLabels,
269
269
  dashboardKeys: new Set(Object.keys(payload.dashboards ?? {})),
270
270
  orgRefs: ctx.orgRefs,
271
+ workspaceAspects: ctx.workspaceAspects,
271
272
  diagnostics: ctx.diagnostics,
272
273
  fieldAddresses,
273
274
  widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
@@ -291,6 +292,7 @@ export function appToTf(entity, ctx) {
291
292
  orgRefs: ctx.orgRefs,
292
293
  workspaceAspects: ctx.workspaceAspects,
293
294
  fieldAddresses,
295
+ widgetKeys: new Set(Object.keys(payload.widgets ?? {})),
294
296
  }));
295
297
  blocks.push(...relationshipsToTf(payload.relationships, {
296
298
  ownerRefName: ctx.appRefName,
@@ -250,7 +250,8 @@ interface ActionMethods<TTrigger, TActions extends Record<string, unknown>, TVar
250
250
  approvalStatusUpdate<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").ApprovalStatusUpdateOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
251
251
  addWatcher<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").AddWatcherOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
252
252
  saveAttachment<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").SaveAttachmentOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
253
- userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").RecordSearchOutput>;
253
+ userSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserSearchOutput>;
254
+ userGroupSearch<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UserGroupSearchOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, import("./tasks.js").UserGroupSearchOutput>;
254
255
  initiateCall<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").InitiateCallOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
255
256
  recordFieldLocking<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").RecordFieldLockingOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
256
257
  unimplementedTask<TName extends string>(name: TName, opts: BuilderActionOptions<TTrigger, TActions, TVars, TItem, import("./tasks.js").UnimplementedTaskOptions>, displayName?: string, hclParent?: "trigger" | string): WithAction<TMode, TItem, TTrigger, TActions, TVars, TName, EmptyObject>;
@@ -39,6 +39,7 @@ import { serializeNode } from "./serialize.js";
39
39
  // automations call the direct fluent methods declared on ActionBuilder.
40
40
  import * as operatorFactories from "./operators.js";
41
41
  import * as actionFactories from "./tasks.js";
42
+ import { USER_SEARCH_REF_WIRE_NAMES, WHOLE_RECORD_REF_WIRE_NAMES } from "./task-output-labels.js";
42
43
  import { isWorkflowOutputDeclaration, workflowOutputFieldType, } from "./workflow-output.js";
43
44
  /** Placeholder `forEachTaskRefKey` the forEach item proxy emits; replaced with the real refKey. */
44
45
  export const FOR_EACH_PLACEHOLDER = "__forEach__";
@@ -201,6 +202,14 @@ function collectRecordKinds(tasks) {
201
202
  */
202
203
  const RECORD_BEARING_TASK_KEYS = new Set(["recordSearch", "createRecord", "findRelatedRecords"]);
203
204
  const FIND_RELATED_RECORDS_COUNT_REF_NAMES = new Set(["totalCount", "Records Size", "count"]);
205
+ /** userGroupSearch authoring output → provider refs-map key (captured live with `ei refs --from-remote`). */
206
+ const USER_GROUP_SEARCH_REF_WIRE_NAMES = {
207
+ count: "Groups Size",
208
+ group: "First found group",
209
+ "group.id": "ID",
210
+ "group.name": "Name",
211
+ groups: "All found groups",
212
+ };
204
213
  function findRelatedRecordsTotalCountError(taskRefKey) {
205
214
  const task = taskRefKey === undefined ? "findRelatedRecords" : `findRelatedRecords task "${taskRefKey}"`;
206
215
  return new EntityTfError(`${task} does not expose totalCount. That output is recordSearch-only ` +
@@ -246,6 +255,15 @@ function rewriteForwardTaskRefName(taskKey, name, taskRefKey) {
246
255
  if (taskKey === "recordSearch" && name === "totalCount") {
247
256
  return "Records Size";
248
257
  }
258
+ if (taskKey === "userGroupSearch") {
259
+ return USER_GROUP_SEARCH_REF_WIRE_NAMES[name] ?? name;
260
+ }
261
+ if (taskKey === "userSearch") {
262
+ return USER_SEARCH_REF_WIRE_NAMES[name] ?? name;
263
+ }
264
+ if (taskKey === "executeScript" && name === "textResult") {
265
+ return "Text Result";
266
+ }
249
267
  if (taskKey === "aiSearchTable" && name === "records") {
250
268
  return "All Records";
251
269
  }
@@ -290,6 +308,14 @@ function rewriteTaskOutputRefs(node, taskKindByRefKey) {
290
308
  if (node === null || typeof node !== "object")
291
309
  return;
292
310
  const rec = node;
311
+ if (Array.isArray(rec.field_mappings)) {
312
+ const mapped = rec.value?.taskReference;
313
+ const wholeRecord = typeof mapped?.taskRefKey === "string" && mapped.name === "record"
314
+ ? WHOLE_RECORD_REF_WIRE_NAMES[taskKindByRefKey.get(mapped.taskRefKey) ?? ""]
315
+ : undefined;
316
+ if (wholeRecord !== undefined)
317
+ mapped.name = wholeRecord;
318
+ }
293
319
  const ref = rec.taskReference;
294
320
  if (ref && typeof ref.taskRefKey === "string" && typeof ref.name === "string") {
295
321
  ref.name = rewriteForwardTaskRefName(taskKindByRefKey.get(ref.taskRefKey), ref.name, ref.taskRefKey);
@@ -427,6 +453,7 @@ function makeActionBuilder(state, mode = "root", item) {
427
453
  addWatcher: actionFactories.addWatcher,
428
454
  saveAttachment: actionFactories.saveAttachment,
429
455
  userSearch: actionFactories.userSearch,
456
+ userGroupSearch: actionFactories.userGroupSearch,
430
457
  initiateCall: actionFactories.initiateCall,
431
458
  recordFieldLocking: actionFactories.recordFieldLocking,
432
459
  unimplementedTask: actionFactories.unimplementedTask,
@@ -70,6 +70,7 @@ const TASK_FACTORY_V2 = {
70
70
  sendEmail: "sendEmail",
71
71
  saveAttachment: "saveAttachment",
72
72
  userSearch: "userSearch",
73
+ userGroupSearch: "userGroupSearch",
73
74
  groupSearch: "userGroupSearch",
74
75
  initiateCall: "initiateCall",
75
76
  approvalChain: "approvalChain",
@@ -1318,6 +1319,8 @@ function printRef(ref, state, refCtx) {
1318
1319
  }
1319
1320
  case "userField":
1320
1321
  return `catalog.users.fields${safeMember(ref.fieldKey)}`;
1322
+ case "userGroupField":
1323
+ return `catalog.userGroups.fields${safeMember(ref.fieldKey)}`;
1321
1324
  case "app": {
1322
1325
  if (ref.entityType === undefined || ref.name === undefined) {
1323
1326
  return `catalog.${catalogOwnerHandle(state, ref.appHandle)}`;
@@ -1446,6 +1449,9 @@ function printFilterField(left, state, refCtx = DEFAULT_CTX) {
1446
1449
  if (left.kind === "userField") {
1447
1450
  return `catalog.users.fields${safeMember(left.fieldKey)}`;
1448
1451
  }
1452
+ if (left.kind === "userGroupField") {
1453
+ return `catalog.userGroups.fields${safeMember(left.fieldKey)}`;
1454
+ }
1449
1455
  if (left.kind === "unresolved") {
1450
1456
  // A field placeholder (hint === "field") legitimately round-trips
1451
1457
  // through the field_id wire slot on rebuild (filter.ts's leftDescriptor).
@@ -1,5 +1,5 @@
1
- import { USER_FIELD_KEYS } from "../../catalog/types.js";
2
- import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
1
+ import { USER_FIELD_KEYS, USER_GROUP_FIELD_KEYS } from "../../catalog/types.js";
2
+ import { DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES, SYSTEM_FIELD_KEY_SET, SYSTEM_FIELD_KEYS } from "../../core/system-fields.js";
3
3
  import { EntityTfError } from "../../engine/entity.js";
4
4
  import { procedureDiscriminator } from "../../engine/pull/procedure-refs.js";
5
5
  import { childPartFromScopedLabel, isTfExpr, sanitizeName, scopedLabelToBagKey, tfLabelToTsLabel, tsLabelToTfLabel, } from "../../engine/tf/index.js";
@@ -13,6 +13,7 @@ import { TABLE_RESOURCE_TYPE } from "../table/module.js";
13
13
  import { SEARCH_TABLE_RESOURCE_TYPES } from "../search-table/types.js";
14
14
  import { outputFieldTypesFromScriptSchema, scriptOutputReferenceIsDeclared } from "./output-field-types.js";
15
15
  import { apiTaskRefAuthoringPath, matchesOutputWireKey, OUTPUT_KEY_WIRE_NAME } from "./output-key-wire-name.js";
16
+ import { systemRefNameRoundTrips } from "./system-ref-name.js";
16
17
  import { taskTfLabel } from "./task-label.js";
17
18
  import { workflowOutputTypeFromFieldType } from "./workflow-output.js";
18
19
  import { ALL_AUTOMATION_TASK_TYPE_SET, AUTOMATION_BRANCH_TYPE_SET, AUTOMATION_RESOURCE_TYPE, AUTOMATION_TRIGGER_TYPE_SET, WORKFLOW_PUBLISH_RESOURCE_TYPE, } from "./types.js";
@@ -58,6 +59,7 @@ const TASK_FACTORIES = {
58
59
  elementum_ai_transform_task: "aiTransform",
59
60
  elementum_save_attachment_task: "saveAttachment",
60
61
  elementum_user_search_task: "userSearch",
62
+ elementum_user_group_search_task: "userGroupSearch",
61
63
  elementum_calculation_task: "calculation",
62
64
  elementum_execute_script_task: "executeScript",
63
65
  elementum_file_reader_task: "documentModel",
@@ -121,6 +123,25 @@ const ATTR_TO_ARG = {
121
123
  function isObject(value) {
122
124
  return value !== null && typeof value === "object" && !Array.isArray(value) && !("$expr" in value);
123
125
  }
126
+ /**
127
+ * Map a string output-schema node back to a product scalar.
128
+ * DATE/DATETIME/EMAIL/UUID4 become date/datetime/email/uuid4. A missing
129
+ * format stays the unformatted `string` scalar. Any other format is
130
+ * reported rather than stripped, because dropping it plans a schema update.
131
+ */
132
+ function scriptOutputScalarFromStringNode(definition) {
133
+ const format = definition.format;
134
+ if (format === undefined || format === "")
135
+ return "string";
136
+ switch (format) {
137
+ case "DATE": return "date";
138
+ case "DATETIME": return "datetime";
139
+ case "EMAIL": return "email";
140
+ case "UUID4": return "uuid4";
141
+ default:
142
+ throw new EntityTfError(`unsupported execute-script output string format ${JSON.stringify(format)}; expected DATE, DATETIME, EMAIL, or UUID4`);
143
+ }
144
+ }
124
145
  /**
125
146
  * Detects a switch task's default/catch-all branch and which of the two
126
147
  * mutually-exclusive wire shapes the platform is currently using to mark it.
@@ -335,17 +356,30 @@ function recordFieldRefPath(wireName, ctx, ownerRefName = ctx.appRefName, rootNa
335
356
  continue;
336
357
  const base = wireName.slice(0, wireName.length - suffix.length);
337
358
  const fieldKey = lookupFieldKeyByDisplayName(ownerRefName, base, ctx);
338
- if (fieldKey !== undefined) {
359
+ if (fieldKey !== undefined && systemFieldPathRoundTrips(fieldKey, suffix, wireName)) {
339
360
  return [rootName, fieldKey, ...suffixPath];
340
361
  }
341
362
  }
342
- // System fields have no `*_field` resource block, so they never appear in
343
- // fieldById. Match their provider-default display names explicitly.
363
+ const systemPath = systemFieldRefPath(wireName);
364
+ return systemPath === undefined ? undefined : [rootName, ...systemPath];
365
+ }
366
+ function systemFieldPathRoundTrips(fieldKey, wireSuffix, wireName) {
367
+ return !SYSTEM_FIELD_KEY_SET.has(fieldKey) ||
368
+ systemRefNameRoundTrips(fieldKey, wireSuffix, wireName);
369
+ }
370
+ /**
371
+ * System fields have no `*_field` resource block, so they never appear in
372
+ * fieldById. Match their provider-default display names explicitly, but only
373
+ * when a rebuild of the typed path emits the same refs key; otherwise the
374
+ * caller keeps the org's exact label.
375
+ */
376
+ function systemFieldRefPath(wireName) {
377
+ const wireNameLower = wireName.toLowerCase();
344
378
  for (const key of SYSTEM_FIELD_KEYS) {
345
379
  const defaultName = DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
346
380
  for (const [suffix, suffixPath] of FIELD_REF_SUFFIX_FROM_WIRE) {
347
- if (wireNameLower === `${defaultName}${suffix}`.toLowerCase()) {
348
- return [rootName, key, ...suffixPath];
381
+ if (wireNameLower === `${defaultName}${suffix}`.toLowerCase() && systemRefNameRoundTrips(key, suffix, wireName)) {
382
+ return [key, ...suffixPath];
349
383
  }
350
384
  }
351
385
  }
@@ -410,7 +444,7 @@ const RECORD_SEARCH_TASK_REF_SEGMENT_TO_TS = {
410
444
  /**
411
445
  * The same outputs as seen from a CALCULATION formula, which addresses a
412
446
  * reference by its WorkflowTaskReference name rather than the refs-map
413
- * display key above (`to-tf.ts`'s `CALCULATION_TASK_OUTPUT_REF_NAME` is the
447
+ * display key above (`task-output-labels.ts`'s `TASK_OUTPUT_REFERENCE_NAMES` is the
414
448
  * write side). Only the names that differ from their authoring path are
415
449
  * listed; the rest already read back correctly.
416
450
  */
@@ -433,6 +467,33 @@ const AI_SEARCH_TABLE_TASK_REF_SEGMENT_TO_TS = {
433
467
  const TABLE_RECORDS_SEARCH_TASK_REF_SEGMENT_TO_TS = {
434
468
  "All matching table rows": "records",
435
469
  };
470
+ // Platform-fixed output labels → authoring path, inverse of
471
+ // task-output-labels.ts and executeScript's "Text Result". Scoped per task
472
+ // type: a field may share a label elsewhere.
473
+ const TASK_OUTPUT_LABEL_TO_TS = {
474
+ elementum_record_search_task: { "First found record": ["record"] },
475
+ elementum_create_record_task: { "Created record": ["record"] },
476
+ elementum_update_field_task: { "Updated record": ["record"] },
477
+ elementum_execute_script_task: { "Text Result": ["textResult"] },
478
+ elementum_user_search_task: {
479
+ "User's Id": ["user", "id"],
480
+ "User's Name": ["user", "name"],
481
+ "User's Email": ["user", "email"],
482
+ "Manager Name": ["user", "managerName"],
483
+ "Manager Email": ["user", "managerEmail"],
484
+ "All found users": ["users"],
485
+ },
486
+ };
487
+ // userGroupSearch refs-map keys → authoring path; inverse of build.ts's
488
+ // USER_GROUP_SEARCH_REF_WIRE_NAMES. "ID"/"Name" are only these outputs on
489
+ // elementum_user_group_search_task, so the table must stay scoped to it.
490
+ const USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS = {
491
+ "Groups Size": ["count"],
492
+ "First found group": ["group"],
493
+ ID: ["group", "id"],
494
+ Name: ["group", "name"],
495
+ "All found groups": ["groups"],
496
+ };
436
497
  /**
437
498
  * Restore the public aiAgent `.result` shape from either a provider refs-map
438
499
  * key (`Action Response` / authored schema field) or the nested platform
@@ -811,7 +872,8 @@ function forEachItemRefPath(path, ctx) {
811
872
  if (names.length !== 1)
812
873
  return names.flatMap((segment) => segment.split("."));
813
874
  const wireName = names[0];
814
- if (wireName === "item")
875
+ // "" is a plain-list loop's whole item (provider Read: `for_each.<id>.`).
876
+ if (wireName === "item" || wireName === "")
815
877
  return [];
816
878
  if (wireName === "Record")
817
879
  return ["recordId"];
@@ -828,15 +890,7 @@ function forEachItemRefPath(path, ctx) {
828
890
  }
829
891
  }
830
892
  }
831
- for (const key of SYSTEM_FIELD_KEYS) {
832
- const defaultName = DEPLOY_DEFAULT_SYSTEM_FIELD_NAMES[key];
833
- for (const [suffix, suffixPath] of FIELD_REF_SUFFIX_FROM_WIRE) {
834
- if (wireNameLower === `${defaultName}${suffix}`.toLowerCase()) {
835
- return [key, ...suffixPath];
836
- }
837
- }
838
- }
839
- return names.flatMap((segment) => segment.split("."));
893
+ return systemFieldRefPath(wireName) ?? names.flatMap((segment) => segment.split("."));
840
894
  }
841
895
  function resolveTaskRefKey(taskIdOrKey, ctx) {
842
896
  if (/^[a-f0-9-]{36}$/.test(taskIdOrKey)) {
@@ -937,6 +991,11 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
937
991
  return { kind: "taskRef", task: refKey, path: [tableSearchName, ...tail] };
938
992
  }
939
993
  }
994
+ if (block?.type === "elementum_user_group_search_task" && pathSegments.length === 1) {
995
+ const groupPath = USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS[pathSegments[0]];
996
+ if (groupPath !== undefined)
997
+ return { kind: "taskRef", task: refKey, path: [...groupPath] };
998
+ }
940
999
  // createRecord/findRelatedRecords record-id + field outputs (same as the
941
1000
  // refs["Title"] / refs["Record"] resource-attr path in decodeValue).
942
1001
  if ((block?.type === "elementum_create_record_task" || block?.type === "elementum_find_related_records_task") &&
@@ -945,10 +1004,7 @@ function decodeTaskReferenceFromString(taskIdOrKey, pathSegments, ctx) {
945
1004
  if (pathSegments.length === 1 && (head === "Record" || head === "Record ID")) {
946
1005
  return { kind: "taskRef", task: refKey, path: ["record", "recordId"] };
947
1006
  }
948
- if (block.type === "elementum_create_record_task" &&
949
- head === "record" &&
950
- tail.length >= 1 &&
951
- /^[a-f0-9-]{36}$/i.test(tail[0])) {
1007
+ if (head === "record" && tail.length >= 1 && /^[a-f0-9-]{36}$/i.test(tail[0])) {
952
1008
  const taskAddress = block.label !== undefined ? `${block.type}.${block.label}` : undefined;
953
1009
  const ownerRefName = taskAddress !== undefined
954
1010
  ? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) ?? ctx.appRefName
@@ -1074,9 +1130,10 @@ function decodeTemplateTriggerRecordFieldRef(value, ctx) {
1074
1130
  function decodeTemplateTaskRef(value, ctx) {
1075
1131
  if (!isTfExpr(value) || value.$expr !== "template")
1076
1132
  return undefined;
1077
- const [prefix, idPart, suffixPart] = value.parts;
1133
+ const [prefix, idPart, ...nameTemplate] = mergeAdjacentTemplateStrings(value.parts);
1078
1134
  if (prefix !== "task." || idPart === undefined || typeof idPart === "string")
1079
1135
  return undefined;
1136
+ const suffixPart = nameTemplate[0];
1080
1137
  if (typeof suffixPart !== "string" || !suffixPart.startsWith("."))
1081
1138
  return undefined;
1082
1139
  if (!isTfExpr(idPart) || idPart.$expr !== "resource-attr" || idPart.path[0] !== "id")
@@ -1084,11 +1141,47 @@ function decodeTemplateTaskRef(value, ctx) {
1084
1141
  const task = ctx.taskByAddress.get(`${idPart.type}.${idPart.label}`);
1085
1142
  if (task === undefined)
1086
1143
  return undefined;
1144
+ if (nameTemplate.length > 1) {
1145
+ const path = templateRecordFieldPath([suffixPart.slice(1), ...nameTemplate.slice(1)], task.block, ctx);
1146
+ return path === undefined ? undefined : { kind: "taskRef", task: task.refKey, path };
1147
+ }
1087
1148
  const nameParts = suffixPart.slice(1).split(".").filter((segment) => segment.length > 0);
1088
1149
  if (nameParts.length === 0)
1089
1150
  return undefined;
1090
1151
  return decodeTaskReferenceFromString(task.refKey, nameParts, ctx);
1091
1152
  }
1153
+ function mergeAdjacentTemplateStrings(parts) {
1154
+ const out = [];
1155
+ for (const part of parts) {
1156
+ const last = out[out.length - 1];
1157
+ if (typeof part === "string" && typeof last === "string")
1158
+ out[out.length - 1] = last + part;
1159
+ else
1160
+ out.push(part);
1161
+ }
1162
+ return out;
1163
+ }
1164
+ /**
1165
+ * Inverse of to-tf's `foundRecordFieldReferenceName`: a found record's field
1166
+ * built as `record.${<field id expr>}[.suffix]`. Only the automation's own
1167
+ * app's field labels decode by tf label; another app's do not, so a task
1168
+ * targeting one stays undefined rather than guessing its field.
1169
+ */
1170
+ function templateRecordFieldPath(parts, taskBlock, ctx) {
1171
+ const [head, fieldPart, suffixPart, ...rest] = mergeAdjacentTemplateStrings(parts);
1172
+ if (head !== "record." || fieldPart === undefined || typeof fieldPart === "string" || rest.length > 0)
1173
+ return undefined;
1174
+ if (suffixPart !== undefined && (typeof suffixPart !== "string" || !suffixPart.startsWith(".")))
1175
+ return undefined;
1176
+ const taskAddress = taskBlock.label !== undefined ? `${taskBlock.type}.${taskBlock.label}` : undefined;
1177
+ const ownerRefName = taskAddress !== undefined ? ctx.taskTargetOwnerRefNameByAddress?.get(taskAddress) : undefined;
1178
+ if (ownerRefName !== undefined && ownerRefName !== ctx.appRefName)
1179
+ return undefined;
1180
+ const fieldKey = fieldKeyFromTriggerFieldIdExpr(fieldPart, ctx);
1181
+ if (fieldKey === undefined)
1182
+ return undefined;
1183
+ return ["record", fieldKey, ...(suffixPart ?? "").split(".").filter((segment) => segment.length > 0)];
1184
+ }
1092
1185
  function decodeTemplateForEachRef(value, ctx) {
1093
1186
  if (!isTfExpr(value) || value.$expr !== "template")
1094
1187
  return undefined;
@@ -1103,7 +1196,7 @@ function decodeTemplateForEachRef(value, ctx) {
1103
1196
  if (task === undefined)
1104
1197
  return undefined;
1105
1198
  const nameParts = suffixPart.slice(1).split(".").filter((segment) => segment.length > 0);
1106
- if (nameParts.length === 0)
1199
+ if (nameParts.length === 0 && suffixPart !== ".")
1107
1200
  return undefined;
1108
1201
  return {
1109
1202
  kind: "forEachItemRef",
@@ -1294,6 +1387,13 @@ function decodeValue(value, ctx) {
1294
1387
  return { kind: "taskRef", task: task.refKey, path: aiAgentPath };
1295
1388
  }
1296
1389
  }
1390
+ const blockType = task.block.type;
1391
+ const labelPath = rawSegments.length === 1 && blockType !== undefined
1392
+ ? TASK_OUTPUT_LABEL_TO_TS[blockType]?.[rawSegments[0]]
1393
+ : undefined;
1394
+ if (labelPath !== undefined) {
1395
+ return { kind: "taskRef", task: task.refKey, path: [...labelPath] };
1396
+ }
1297
1397
  if (task.block.type === "elementum_record_search_task" && rawSegments.length === 1 && rawSegments[0] === "First found record id") {
1298
1398
  return { kind: "taskRef", task: task.refKey, path: ["record", "recordId"] };
1299
1399
  }
@@ -1350,6 +1450,12 @@ function decodeValue(value, ctx) {
1350
1450
  return { kind: "taskRef", task: task.refKey, path: [tableSearchName] };
1351
1451
  }
1352
1452
  }
1453
+ if (task.block.type === "elementum_user_group_search_task" && rawSegments.length === 1) {
1454
+ const groupPath = USER_GROUP_SEARCH_TASK_REF_LABEL_TO_TS[rawSegments[0]];
1455
+ if (groupPath !== undefined) {
1456
+ return { kind: "taskRef", task: task.refKey, path: [...groupPath] };
1457
+ }
1458
+ }
1353
1459
  // apiRequest's refs map uses display labels ("File", "Content Type",
1354
1460
  // …) that don't match the lowercase authoring property names
1355
1461
  // (`file`, `file.contentType`) - see API_TASK_REF_AUTHORING_NAMES.
@@ -1780,6 +1886,17 @@ function userFieldRef(value, ctx) {
1780
1886
  }
1781
1887
  return fieldRef(value, ctx);
1782
1888
  }
1889
+ const USER_GROUP_FIELD_KEY_SET = new Set(USER_GROUP_FIELD_KEYS);
1890
+ function userGroupFieldRef(value, ctx) {
1891
+ if (typeof value === "string" && USER_GROUP_FIELD_KEY_SET.has(value)) {
1892
+ return { kind: "userGroupField", fieldKey: value };
1893
+ }
1894
+ return fieldRef(value, ctx);
1895
+ }
1896
+ const FILTER_FIELD_SCOPE_BY_FACTORY = {
1897
+ userSearch: "user",
1898
+ userGroupSearch: "userGroup",
1899
+ };
1783
1900
  function picklistOptionLabel(value) {
1784
1901
  if (value === undefined || !isTfExpr(value))
1785
1902
  return undefined;
@@ -2113,6 +2230,15 @@ function decodeFilterReferenceEnvelope(value, ctx, outputName, role) {
2113
2230
  return decoded;
2114
2231
  }
2115
2232
  }
2233
+ if (isObject(taskRef) && isTfExpr(taskRef.name) && taskRef.name.$expr === "template") {
2234
+ const taskIdOrKey = workflowOutputTaskIdOrKey(taskRef.taskId, ctx);
2235
+ const { refKey, block } = taskIdOrKey !== undefined ? resolveTaskRefKey(taskIdOrKey, ctx) : { refKey: undefined, block: undefined };
2236
+ const path = block !== undefined
2237
+ ? templateRecordFieldPath(taskRef.name.parts, block, ctx)
2238
+ : undefined;
2239
+ if (refKey !== undefined && path !== undefined)
2240
+ return { kind: "taskRef", task: refKey, path };
2241
+ }
2116
2242
  const triggerRef = raw.triggerReference;
2117
2243
  if (isObject(triggerRef) && typeof triggerRef.name === "string") {
2118
2244
  return decodeReferenceString(`trigger.${triggerRef.name}`, ctx);
@@ -2229,7 +2355,9 @@ export function inferredPublishOutputType(value, ctx) {
2229
2355
  function decodeFilter(value, ctx, fieldScope = "app") {
2230
2356
  return deserializeFilterFromTf(value, {
2231
2357
  field: (fieldValue, scope) => {
2232
- const field = scope === "user" ? userFieldRef(fieldValue, ctx) : filterFieldRef(fieldValue, ctx);
2358
+ const field = scope === "user"
2359
+ ? userFieldRef(fieldValue, ctx)
2360
+ : scope === "userGroup" ? userGroupFieldRef(fieldValue, ctx) : filterFieldRef(fieldValue, ctx);
2233
2361
  return field ?? { kind: "unresolved", uuid: String(fieldValue), hint: "field" };
2234
2362
  },
2235
2363
  reference: (reference, role) => filterReference(reference, ctx, role),
@@ -2378,7 +2506,7 @@ function taskArgs(block, factory, ctx, fieldMappingDiagnostics) {
2378
2506
  if (attr === "parent" || attr === "name" || attr === "depends_on")
2379
2507
  continue;
2380
2508
  if (attr === "filter") {
2381
- args.filter = decodeFilter(value, ctx, factory === "userSearch" ? "user" : "app");
2509
+ args.filter = decodeFilter(value, ctx, FILTER_FIELD_SCOPE_BY_FACTORY[factory] ?? "app");
2382
2510
  continue;
2383
2511
  }
2384
2512
  if (attr === "fields" && (factory === "createRecord" || factory === "updateField")) {
@@ -2496,6 +2624,8 @@ function taskArgs(block, factory, ctx, fieldMappingDiagnostics) {
2496
2624
  }));
2497
2625
  return { type: "object", properties };
2498
2626
  }
2627
+ if (type === "string")
2628
+ return scriptOutputScalarFromStringNode(definition);
2499
2629
  return type === "bool" ? "boolean" : type;
2500
2630
  };
2501
2631
  const properties = Object.fromEntries(props.map((property) => {
@@ -18,5 +18,5 @@ 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, scriptFile, type ScriptCodeFn, type ScriptFile, type ScriptInput } from "./script-code.js";
20
20
  export { workflowOutput, workflowOutputType, type WorkflowOutputDeclaration, type WorkflowOutputType, } from "./workflow-output.js";
21
- export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings, type AddWatcherOptions, type AiAgentAttachment, 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 ExecuteScriptFieldMapping, type ExecuteScriptOptions, type FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, 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 ScriptOutputScalarType, type ScriptOutputType, 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
+ export { addWatcher, aiAgent, aiClassify, aiEmailAnalysis, aiFileAnalysis, aiSearchTable, aiSummarize, aiTransform, apiRequest, approvalChain, approvalChainTemplate, approvalStatusUpdate, assignGroup, assignUser, assignmentEngine, bulkExcel, calculation, createRecord, executeScript, findRelatedRecords, generateReport, initiateCall, initiateEmailConversation, notification, postComment, postTeamsMessage, procedure, readFile, recordFieldLocking, recordSearch, relateRecords, runAutomation, saveAttachment, sendEmail, sendSurvey, setVariable, tableRecordsSearch, unzip, updateField, userGroupSearch, userSearch, withFieldMappings, type AddWatcherOptions, type AiAgentAttachment, 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 ExecuteScriptFieldMapping, type ExecuteScriptOptions, type FieldAssignment, type FindRelatedRecordsOptions, type FindRelatedRecordsOutput, 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 ScriptOutputScalarType, type ScriptOutputType, type ScriptOutputs, type SendEmailOptions, type SendSurveyOptions, type SetVariableOptions, type TableRecordsSearchOptions, type TableRecordsSearchOutput, type UnzipOptions, type UpdateFieldAssignment, type UpdateFieldOptions, type UserGroupSearchOptions, type UserGroupSearchOutput, type UserGroupShape, type UserSearchOptions, type VariableAssign, type VariableDecl } from "./tasks.js";
22
22
  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 DataMineTriggerOutput, 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,3 +1,5 @@
1
1
  /** The automation entity's registry entry (see src/graph/). */
2
2
  import { type EntityKindModule } from "../../graph/types.js";
3
3
  export declare const automationModule: EntityKindModule;
4
+ /** The provider's `normalizeOnDemandFilterRefName`, which computes `filter_refs` at plan time. */
5
+ export declare function onDemandFilterRefName(name: string): string;