@elementumai/edk 0.9.18 → 0.9.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +154 -9
- package/dist-sdk/src/catalog/factories.d.ts +35 -1
- package/dist-sdk/src/catalog/factories.js +36 -0
- package/dist-sdk/src/catalog/from-authoring.d.ts +13 -8
- package/dist-sdk/src/catalog/from-authoring.js +34 -9
- package/dist-sdk/src/catalog/index.d.ts +2 -2
- package/dist-sdk/src/catalog/index.js +2 -2
- package/dist-sdk/src/catalog/org.d.ts +39 -1
- package/dist-sdk/src/catalog/org.js +460 -50
- package/dist-sdk/src/catalog/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +44 -1
- package/dist-sdk/src/catalog/types.js +13 -0
- package/dist-sdk/src/core/triggers/on-demand.d.ts +39 -3
- package/dist-sdk/src/core/triggers/on-demand.js +10 -2
- package/dist-sdk/src/engine/build/context.d.ts +1 -1
- package/dist-sdk/src/engine/ei/run.d.ts +149 -0
- package/dist-sdk/src/engine/ei/run.js +1132 -0
- package/dist-sdk/src/engine/logging.d.ts +17 -0
- package/dist-sdk/src/engine/logging.js +18 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.js +64 -27
- package/dist-sdk/src/engine/pull/result-output.d.ts +8 -0
- package/dist-sdk/src/engine/pull/result-output.js +88 -4
- package/dist-sdk/src/engine/tf/expr.js +39 -14
- package/dist-sdk/src/engine/tf/index.d.ts +3 -3
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +8 -0
- package/dist-sdk/src/engine/tf/labels.js +13 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.d.ts +19 -0
- package/dist-sdk/src/engine/tf/parse.js +197 -10
- package/dist-sdk/src/engine/tf/render.d.ts +4 -2
- package/dist-sdk/src/engine/tf/render.js +41 -7
- package/dist-sdk/src/engine/validation.d.ts +39 -0
- package/dist-sdk/src/engine/validation.js +85 -0
- package/dist-sdk/src/engine/workspace/loader.js +49 -12
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +11 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +6 -1
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +11 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +16 -6
- package/dist-sdk/src/entities/agent/build.d.ts +4 -16
- package/dist-sdk/src/entities/agent/build.js +40 -5
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +4 -2
- package/dist-sdk/src/entities/agent/to-tf.js +6 -3
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +7 -1
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/app/build.d.ts +98 -19
- package/dist-sdk/src/entities/app/build.js +51 -19
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +22 -1
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +11 -5
- package/dist-sdk/src/entities/app/index.d.ts +6 -5
- package/dist-sdk/src/entities/app/index.js +2 -0
- package/dist-sdk/src/entities/app/module.js +18 -2
- package/dist-sdk/src/entities/app/to-tf.js +21 -11
- package/dist-sdk/src/entities/automation/build.d.ts +49 -6
- package/dist-sdk/src/entities/automation/build.js +163 -19
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +320 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +563 -74
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.d.ts +33 -0
- package/dist-sdk/src/entities/automation/generated/task-output-contracts.js +183 -0
- package/dist-sdk/src/entities/automation/index.d.ts +2 -2
- package/dist-sdk/src/entities/automation/index.js +1 -1
- package/dist-sdk/src/entities/automation/module.d.ts +2 -0
- package/dist-sdk/src/entities/automation/module.js +93 -8
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +7 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +36 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +9 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +13 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +17 -0
- package/dist-sdk/src/entities/automation/script-code.js +91 -5
- package/dist-sdk/src/entities/automation/system-ref-name.d.ts +16 -0
- package/dist-sdk/src/entities/automation/system-ref-name.js +48 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +17 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +47 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +53 -4
- package/dist-sdk/src/entities/automation/tasks.js +38 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +4 -0
- package/dist-sdk/src/entities/automation/to-tf.js +647 -167
- package/dist-sdk/src/entities/automation/triggers.d.ts +4 -2
- package/dist-sdk/src/entities/automation/triggers.js +4 -0
- package/dist-sdk/src/entities/automation/types.js +1 -0
- package/dist-sdk/src/entities/chart/from-tf.js +33 -17
- package/dist-sdk/src/entities/chart/module.js +3 -1
- package/dist-sdk/src/entities/chart/printer.d.ts +1 -0
- package/dist-sdk/src/entities/chart/printer.js +26 -16
- package/dist-sdk/src/entities/chart/rebind-owner.d.ts +3 -0
- package/dist-sdk/src/entities/chart/rebind-owner.js +42 -0
- package/dist-sdk/src/entities/chart/to-tf.js +21 -12
- package/dist-sdk/src/entities/dashboard/build.d.ts +4 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +15 -4
- package/dist-sdk/src/entities/dashboard/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/dashboard/to-tf.js +13 -0
- package/dist-sdk/src/entities/dashboard-widget/module.js +4 -0
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +72 -30
- package/dist-sdk/src/entities/dynamic-layout/dialect.d.ts +3 -0
- package/dist-sdk/src/entities/dynamic-layout/dialect.js +5 -0
- package/dist-sdk/src/entities/dynamic-layout/from-tf.d.ts +9 -6
- package/dist-sdk/src/entities/dynamic-layout/from-tf.js +188 -26
- package/dist-sdk/src/entities/dynamic-layout/module.js +4 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.d.ts +5 -1
- package/dist-sdk/src/entities/dynamic-layout/to-tf.js +254 -23
- package/dist-sdk/src/entities/element/build.d.ts +33 -13
- package/dist-sdk/src/entities/element/build.js +5 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/element/from-tf.js +64 -3
- package/dist-sdk/src/entities/element/index.d.ts +5 -2
- package/dist-sdk/src/entities/element/index.js +2 -0
- package/dist-sdk/src/entities/element/module.js +11 -3
- package/dist-sdk/src/entities/element/to-tf.js +20 -2
- package/dist-sdk/src/entities/field/build.d.ts +14 -1
- package/dist-sdk/src/entities/field/build.js +3 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +3 -0
- package/dist-sdk/src/entities/field/from-tf.js +50 -1
- package/dist-sdk/src/entities/field/media-types.d.ts +6 -0
- package/dist-sdk/src/entities/field/media-types.js +30 -0
- package/dist-sdk/src/entities/field/module.js +1 -0
- package/dist-sdk/src/entities/field/to-tf.d.ts +23 -2
- package/dist-sdk/src/entities/field/to-tf.js +142 -22
- package/dist-sdk/src/entities/file-reader/from-tf.js +14 -5
- package/dist-sdk/src/entities/file-reader/module.js +1 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +2 -0
- package/dist-sdk/src/entities/file-reader/types.js +1 -1
- package/dist-sdk/src/entities/portal/build.d.ts +26 -0
- package/dist-sdk/src/entities/portal/build.js +37 -0
- package/dist-sdk/src/entities/portal/from-tf.d.ts +27 -0
- package/dist-sdk/src/entities/portal/from-tf.js +75 -0
- package/dist-sdk/src/entities/portal/index.d.ts +1 -0
- package/dist-sdk/src/entities/portal/index.js +1 -0
- package/dist-sdk/src/entities/portal/module.d.ts +3 -0
- package/dist-sdk/src/entities/portal/module.js +28 -0
- package/dist-sdk/src/entities/portal/to-tf.d.ts +12 -0
- package/dist-sdk/src/entities/portal/to-tf.js +73 -0
- package/dist-sdk/src/entities/portal/types.d.ts +1 -0
- package/dist-sdk/src/entities/portal/types.js +1 -0
- package/dist-sdk/src/entities/relationship/from-tf.d.ts +8 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +53 -10
- package/dist-sdk/src/entities/relationship/module.js +2 -0
- package/dist-sdk/src/entities/relationship/pair-check.d.ts +7 -0
- package/dist-sdk/src/entities/relationship/pair-check.js +68 -0
- package/dist-sdk/src/entities/relationship/to-tf.d.ts +10 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +31 -13
- package/dist-sdk/src/entities/search-table/module.js +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/to-tf.js +1 -1
- package/dist-sdk/src/entities/service-account/build.d.ts +15 -2
- package/dist-sdk/src/entities/service-account/from-tf.d.ts +2 -4
- package/dist-sdk/src/entities/service-account/from-tf.js +17 -5
- package/dist-sdk/src/entities/service-account/role-fidelity.d.ts +56 -0
- package/dist-sdk/src/entities/service-account/role-fidelity.js +243 -0
- package/dist-sdk/src/entities/service-account/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/service-account/to-tf.js +17 -0
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/shared/aspect-target-from-tf.js +5 -2
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +15 -2
- package/dist-sdk/src/entities/shared/filters/index.d.ts +25 -2
- package/dist-sdk/src/entities/shared/filters/index.js +38 -5
- package/dist-sdk/src/entities/shared/filters/print.js +31 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +25 -3
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +51 -15
- package/dist-sdk/src/entities/shared/filters/types.d.ts +22 -5
- package/dist-sdk/src/entities/shared/foreign-ref.d.ts +16 -0
- package/dist-sdk/src/entities/shared/foreign-ref.js +17 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.js +6 -9
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -5
- package/dist-sdk/src/entities/shared/types/field-types.js +4 -0
- package/dist-sdk/src/entities/skill/access-policy.d.ts +17 -0
- package/dist-sdk/src/entities/skill/access-policy.js +101 -0
- package/dist-sdk/src/entities/skill/build.d.ts +3 -0
- package/dist-sdk/src/entities/skill/build.js +3 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +4 -1
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +23 -1
- package/dist-sdk/src/entities/skill/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill/from-tf.js +70 -22
- package/dist-sdk/src/entities/skill/index.d.ts +2 -0
- package/dist-sdk/src/entities/skill/index.js +1 -0
- package/dist-sdk/src/entities/skill/input-coverage.d.ts +7 -0
- package/dist-sdk/src/entities/skill/input-coverage.js +11 -0
- package/dist-sdk/src/entities/skill/module.js +1 -0
- package/dist-sdk/src/entities/skill/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill/to-tf.js +19 -6
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +8 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -2
- package/dist-sdk/src/entities/skill-tool/to-tf.js +29 -6
- package/dist-sdk/src/entities/table/catalog.d.ts +14 -0
- package/dist-sdk/src/entities/table/catalog.js +66 -0
- package/dist-sdk/src/entities/table/module.js +2 -1
- package/dist-sdk/src/entities/table/to-tf.js +5 -5
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +89 -0
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +277 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +51 -0
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +360 -0
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +151 -0
- package/dist-sdk/src/entities/view/agent-view-layout.js +21 -0
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -3
- package/dist-sdk/src/entities/view/from-tf.js +161 -14
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +24 -2
- package/dist-sdk/src/entities/view/to-tf.js +95 -9
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +17 -15
- package/dist-sdk/src/entities/widget/build.d.ts +16 -1
- package/dist-sdk/src/entities/widget/build.js +11 -1
- package/dist-sdk/src/entities/widget/to-tf.js +36 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +38 -10
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +54 -0
- package/dist-sdk/src/graph/index.js +30 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +133 -2
- package/dist-sdk/src/internal/sdk-package.d.ts +1 -1
- package/dist-sdk/src/internal/sdk-package.js +1 -0
- package/package.json +11 -1
|
@@ -205,7 +205,11 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
|
|
|
205
205
|
throw new EntityTfError("reference filter value requires value");
|
|
206
206
|
const authored = raw.realType ?? raw.real_type;
|
|
207
207
|
const authoredType = typeof authored === "string" ? authored : undefined;
|
|
208
|
-
|
|
208
|
+
// `filter.text()` and the other typed wrappers set `explicit`. That type
|
|
209
|
+
// is the comparison the author wrote. Metadata inference replaces only an
|
|
210
|
+
// unmarked operator fallback (dropdown `.id` TEXT → UUID).
|
|
211
|
+
const explicit = raw.explicit === true;
|
|
212
|
+
const inferred = explicit ? authoredType : codec.referenceRealType?.(reference, role, authoredType);
|
|
209
213
|
const realType = String(inferred ?? authoredType ?? "TEXT");
|
|
210
214
|
// ei export always writes an explicit `multiple = false` on scalar text
|
|
211
215
|
// references. Omitting it plans null-vs-false drift after pull.
|
|
@@ -231,14 +235,22 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
|
|
|
231
235
|
};
|
|
232
236
|
}
|
|
233
237
|
if (type === "record_field") {
|
|
234
|
-
if (raw.field === undefined
|
|
235
|
-
throw new EntityTfError("record_field filter value requires field
|
|
236
|
-
|
|
238
|
+
if (raw.field === undefined)
|
|
239
|
+
throw new EntityTfError("record_field filter value requires field");
|
|
240
|
+
const aspect = raw.aspect ?? raw.object;
|
|
241
|
+
const sourceFieldType = raw.sourceFieldType ?? raw.source_field_type;
|
|
242
|
+
let field;
|
|
243
|
+
if (codec.recordField !== undefined)
|
|
244
|
+
field = codec.recordField(raw.field);
|
|
245
|
+
else if (typeof raw.field === "string")
|
|
246
|
+
field = raw.field;
|
|
247
|
+
else
|
|
248
|
+
throw new EntityTfError("record_field filter value field must be a platform id in this filter context");
|
|
237
249
|
return {
|
|
238
250
|
type,
|
|
239
|
-
field
|
|
240
|
-
object:
|
|
241
|
-
source_field_type: String(
|
|
251
|
+
field,
|
|
252
|
+
...(aspect !== undefined && { object: aspect }),
|
|
253
|
+
...(sourceFieldType !== undefined && { source_field_type: String(sourceFieldType).toLowerCase() }),
|
|
242
254
|
...((raw.dynamicField ?? raw.dynamic_field) !== undefined && { dynamic_field: (raw.dynamicField ?? raw.dynamic_field) }),
|
|
243
255
|
...((raw.dynamicFieldAspect ?? raw.dynamic_field_object) !== undefined && { dynamic_field_object: (raw.dynamicFieldAspect ?? raw.dynamic_field_object) }),
|
|
244
256
|
...(typeof raw.required === "boolean" && { required: raw.required }),
|
|
@@ -249,7 +261,15 @@ function wireFilterValueToTf(value, field, codec, role = "value", operator) {
|
|
|
249
261
|
}
|
|
250
262
|
if (raw.value === undefined)
|
|
251
263
|
throw new EntityTfError(`${type} filter value requires value`);
|
|
252
|
-
|
|
264
|
+
// A UUID wrapper already implies an option label (#1120); a TEXT wrapper
|
|
265
|
+
// carries the fact explicitly, so the owner's literal hook sees one answer.
|
|
266
|
+
const isOptionLabel = type === "uuid" || raw.option === true;
|
|
267
|
+
const resolved = codec.literal?.(raw.value, field, type, isOptionLabel) ?? raw.value;
|
|
268
|
+
// Writing an option label where the platform stored an id is a silent data
|
|
269
|
+
// change on a live view. Only a resolved lookup is an expression.
|
|
270
|
+
if (raw.option === true && !isTfExpr(resolved)) {
|
|
271
|
+
throw new EntityTfError(`option selection ${JSON.stringify(raw.value)} has no declared option identity`);
|
|
272
|
+
}
|
|
253
273
|
if (isTfExpr(resolved))
|
|
254
274
|
return { type, value: resolved };
|
|
255
275
|
if (type === "number") {
|
|
@@ -555,22 +575,38 @@ function filterValueFromTf(value, codec, fieldScope) {
|
|
|
555
575
|
...(typeof value.aspect_id === "string" && { aspect: value.aspect_id }),
|
|
556
576
|
...(value.treat_null_as_equals !== undefined && { treatNullAsEquals: value.treat_null_as_equals }),
|
|
557
577
|
};
|
|
558
|
-
case "record_field":
|
|
559
|
-
if (
|
|
560
|
-
throw new EntityTfError("record_field filter value requires field
|
|
578
|
+
case "record_field": {
|
|
579
|
+
if (value.field === undefined)
|
|
580
|
+
throw new EntityTfError("record_field filter value requires field");
|
|
581
|
+
if ((value.object !== undefined && typeof value.object !== "string") || (value.source_field_type !== undefined && typeof value.source_field_type !== "string")) {
|
|
582
|
+
throw new EntityTfError("record_field filter value object and source_field_type must be literal strings");
|
|
561
583
|
}
|
|
584
|
+
let field;
|
|
585
|
+
if (typeof value.field === "string")
|
|
586
|
+
field = value.field;
|
|
587
|
+
else if (codec.recordField !== undefined)
|
|
588
|
+
field = codec.recordField(value.field);
|
|
589
|
+
else
|
|
590
|
+
throw new EntityTfError("record_field filter value field reference cannot be reconstructed in this filter context");
|
|
562
591
|
return {
|
|
563
592
|
type: "RECORD_FIELD",
|
|
564
|
-
field
|
|
565
|
-
aspect: value.object,
|
|
566
|
-
sourceFieldType: value.source_field_type.toUpperCase(),
|
|
593
|
+
field,
|
|
594
|
+
...(value.object !== undefined && { aspect: value.object }),
|
|
595
|
+
...(value.source_field_type !== undefined && { sourceFieldType: value.source_field_type.toUpperCase() }),
|
|
567
596
|
...(typeof value.dynamic_field === "string" && { dynamicField: value.dynamic_field }),
|
|
568
597
|
...(typeof value.dynamic_field_object === "string" && { dynamicFieldAspect: value.dynamic_field_object }),
|
|
569
598
|
...(value.required !== undefined && { required: value.required }),
|
|
570
599
|
};
|
|
600
|
+
}
|
|
571
601
|
case "number": return { type: "NUMBER", value: typeof literal === "number" ? literal : Number(literal) };
|
|
572
602
|
case "boolean": return { type: "BOOLEAN", value: typeof literal === "boolean" ? literal : String(literal).toLowerCase() === "true" };
|
|
573
|
-
case "text":
|
|
603
|
+
case "text": {
|
|
604
|
+
// `type` stays the stored wrapper. An expression the codec collapsed to a
|
|
605
|
+
// plain string was an id lookup, so this literal is an option LABEL —
|
|
606
|
+
// the second, independent fact, which a TEXT wrapper cannot express.
|
|
607
|
+
const option = codec.optionLookupsAreIdentities === true && isTfExpr(value.value);
|
|
608
|
+
return { type: "TEXT", value: String(literal), ...(option && { option: true }) };
|
|
609
|
+
}
|
|
574
610
|
case "uuid":
|
|
575
611
|
case "date":
|
|
576
612
|
case "datetime": return { type: type.toUpperCase(), value: String(literal) };
|
|
@@ -32,9 +32,18 @@ export type FilterReference = {
|
|
|
32
32
|
variableId?: string;
|
|
33
33
|
variableTaskRefKey?: string;
|
|
34
34
|
};
|
|
35
|
-
export type FilterValue<FieldValue = string, ReferenceValue = FilterReference> =
|
|
35
|
+
export type FilterValue<FieldValue = string, ReferenceValue = FilterReference> =
|
|
36
|
+
/**
|
|
37
|
+
* `type` is the value wrapper the platform stored. `option` is the
|
|
38
|
+
* independent fact that `value` is a picklist/status/stage option LABEL
|
|
39
|
+
* whose stored value is that option's id — live list views hold option ids
|
|
40
|
+
* behind a TEXT wrapper as well as a UUID one, and a UUID wrapper already
|
|
41
|
+
* implies the label is an option, so only the TEXT wrapper needs to say so.
|
|
42
|
+
*/
|
|
43
|
+
{
|
|
36
44
|
type: "TEXT";
|
|
37
45
|
value: string;
|
|
46
|
+
option?: true;
|
|
38
47
|
} | {
|
|
39
48
|
type: "NUMBER";
|
|
40
49
|
value: number;
|
|
@@ -62,15 +71,23 @@ export type FilterValue<FieldValue = string, ReferenceValue = FilterReference> =
|
|
|
62
71
|
valueType?: "ID" | "EMAIL" | "DOMAIN";
|
|
63
72
|
} | {
|
|
64
73
|
type: "RECORD_FIELD";
|
|
65
|
-
field: string;
|
|
66
|
-
aspect
|
|
67
|
-
sourceFieldType
|
|
74
|
+
field: FieldValue | string;
|
|
75
|
+
aspect?: string;
|
|
76
|
+
sourceFieldType?: string;
|
|
68
77
|
dynamicField?: string;
|
|
69
78
|
dynamicFieldAspect?: string;
|
|
70
79
|
required?: boolean;
|
|
71
|
-
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* `explicit` is set by `filter.text()` / `filter.uuid()` / the other typed
|
|
83
|
+
* wrappers, and by an explicit comparison type. Build keeps that type.
|
|
84
|
+
* Without it, `realType` is only the operator fallback and field metadata
|
|
85
|
+
* may replace TEXT (a dropdown `.id` infers UUID).
|
|
86
|
+
*/
|
|
87
|
+
| {
|
|
72
88
|
type: "REFERENCE";
|
|
73
89
|
realType?: ValueType;
|
|
90
|
+
explicit?: true;
|
|
74
91
|
value: ReferenceValue;
|
|
75
92
|
label?: string;
|
|
76
93
|
multiple?: boolean;
|
|
@@ -12,3 +12,19 @@ export interface ForeignRootDataRef {
|
|
|
12
12
|
}
|
|
13
13
|
/** Resolve a foreign root through its graph-declared reference lookup facet. */
|
|
14
14
|
export declare function resolveForeignRef(kind: KindId, token: ForeignRootToken, orgRefs: OrgRefLookup, diagnostics?: string[], where?: string): ForeignRootDataRef;
|
|
15
|
+
declare const FOREIGN_FIELD_OWNER_RESOURCE_TYPES: {
|
|
16
|
+
readonly app: "elementum_app";
|
|
17
|
+
readonly element: "elementum_element";
|
|
18
|
+
readonly task: "elementum_task";
|
|
19
|
+
readonly table: "elementum_table";
|
|
20
|
+
};
|
|
21
|
+
export type ForeignFieldOwnerKind = keyof typeof FOREIGN_FIELD_OWNER_RESOURCE_TYPES;
|
|
22
|
+
/**
|
|
23
|
+
* The `data.elementum_field` label for a field on a foreign root: provider
|
|
24
|
+
* root type + the root's data-block label + the field's display name, the
|
|
25
|
+
* same label `ei export` writes. Every entity must derive it here — two
|
|
26
|
+
* entities naming the same (root, field) lookup differently emit duplicate,
|
|
27
|
+
* semantically identical data blocks.
|
|
28
|
+
*/
|
|
29
|
+
export declare function foreignFieldDataLabel(ownerKind: ForeignFieldOwnerKind, ownerTfLabel: string, fieldName: string): string;
|
|
30
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { expr } from "../../engine/tf/index.js";
|
|
1
|
+
import { expr, sanitizeName } from "../../engine/tf/index.js";
|
|
2
2
|
/** Resolve a foreign root through its graph-declared reference lookup facet. */
|
|
3
3
|
export function resolveForeignRef(kind, token, orgRefs, diagnostics, where = "foreign reference") {
|
|
4
4
|
const resolved = orgRefs.resolveForeignRoot(kind, token);
|
|
@@ -10,3 +10,19 @@ export function resolveForeignRef(kind, token, orgRefs, diagnostics, where = "fo
|
|
|
10
10
|
tfLabel: resolved.tfLabel,
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
+
const FOREIGN_FIELD_OWNER_RESOURCE_TYPES = {
|
|
14
|
+
app: "elementum_app",
|
|
15
|
+
element: "elementum_element",
|
|
16
|
+
task: "elementum_task",
|
|
17
|
+
table: "elementum_table",
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* The `data.elementum_field` label for a field on a foreign root: provider
|
|
21
|
+
* root type + the root's data-block label + the field's display name, the
|
|
22
|
+
* same label `ei export` writes. Every entity must derive it here — two
|
|
23
|
+
* entities naming the same (root, field) lookup differently emit duplicate,
|
|
24
|
+
* semantically identical data blocks.
|
|
25
|
+
*/
|
|
26
|
+
export function foreignFieldDataLabel(ownerKind, ownerTfLabel, fieldName) {
|
|
27
|
+
return sanitizeName(`${FOREIGN_FIELD_OWNER_RESOURCE_TYPES[ownerKind]}_${ownerTfLabel}_${fieldName}`);
|
|
28
|
+
}
|
|
@@ -24,15 +24,12 @@ export function resolveToolFieldKey(fieldRef, scopeTfLabel, scope = "app", ctx)
|
|
|
24
24
|
// field resource of its own in this stream). `scopeTfLabel`/`scope`
|
|
25
25
|
// already identify the RESOLVED target (see this module's header
|
|
26
26
|
// comment), so the label prefix to strip is known without any extra
|
|
27
|
-
// lookup
|
|
28
|
-
// `
|
|
29
|
-
const prefix
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
const taskPrefix = `elementum_task_${scopeTfLabel}_`;
|
|
34
|
-
if (scope === "task" && fieldRef.label.startsWith(taskPrefix)) {
|
|
35
|
-
return tfLabelToTsLabel(fieldRef.label.slice(taskPrefix.length));
|
|
27
|
+
// lookup: `foreignFieldDataLabel`'s `<owner type>_<target>_` form, or
|
|
28
|
+
// the `<scope>_<target>_` form older builds wrote.
|
|
29
|
+
for (const prefix of [`${ownerType}_${scopeTfLabel}_`, `${scope}_${scopeTfLabel}_`]) {
|
|
30
|
+
if (fieldRef.label.startsWith(prefix)) {
|
|
31
|
+
return tfLabelToTsLabel(fieldRef.label.slice(prefix.length));
|
|
32
|
+
}
|
|
36
33
|
}
|
|
37
34
|
}
|
|
38
35
|
if (isTfExpr(fieldRef) && fieldRef.$expr === "local") {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { AppOrElementRef } from "../../../catalog/types.js";
|
|
2
2
|
import type { RecordShape } from "../../field/record-shape.js";
|
|
3
|
+
import type { CalculationTypedValue } from "../ref.js";
|
|
3
4
|
/**
|
|
4
5
|
* WorkflowFieldType — mirrors the Java enum in
|
|
5
6
|
* jarvis/util/.../WorkflowFieldType.java
|
|
@@ -21,6 +22,9 @@ export type WorkflowFieldType = "TEXT" | "HANDLE" | "NUMBER" | "DECIMAL" | "BOOL
|
|
|
21
22
|
* ATTACHMENT_ID -> "attachment" (and from-tf.ts the inverse) rather than
|
|
22
23
|
* renaming this alias, to avoid a breaking change to authored `onDemand({})`
|
|
23
24
|
* calls that already use `type: "attachmentId"`.
|
|
25
|
+
*
|
|
26
|
+
* `userId` follows the same rule: the provider's attribute spells USER_ID as
|
|
27
|
+
* a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
|
|
24
28
|
*/
|
|
25
29
|
export declare const FIELD_TYPE_MAP: {
|
|
26
30
|
readonly text: "TEXT";
|
|
@@ -30,6 +34,7 @@ export declare const FIELD_TYPE_MAP: {
|
|
|
30
34
|
readonly date: "DATE";
|
|
31
35
|
readonly datetime: "DATETIME";
|
|
32
36
|
readonly user: "USER";
|
|
37
|
+
readonly userId: "USER_ID";
|
|
33
38
|
readonly json: "JSON";
|
|
34
39
|
readonly object: "OBJECT";
|
|
35
40
|
readonly attachmentId: "ATTACHMENT_ID";
|
|
@@ -41,14 +46,14 @@ export declare function isOnDemandRecordType(type: string | undefined): boolean;
|
|
|
41
46
|
/**
|
|
42
47
|
* Subset of {@link FieldTypeAlias} that Mobius's `onDemand` trigger
|
|
43
48
|
* validator accepts. Mobius rejects `WorkflowFieldType.USER` and
|
|
44
|
-
* `WorkflowFieldType.GROUP`
|
|
49
|
+
* `WorkflowFieldType.GROUP` on trigger params:
|
|
45
50
|
*
|
|
46
51
|
* parameter[submitter]: Parameter type USER is not valid for this trigger.
|
|
47
52
|
*
|
|
48
53
|
* We model the restriction at the type level so `onDemand({ x: { type: "user" } })`
|
|
49
|
-
* is a compile-time error, not a deploy-time 400.
|
|
50
|
-
*
|
|
51
|
-
*
|
|
54
|
+
* is a compile-time error, not a deploy-time 400. A user input is a
|
|
55
|
+
* `userId` (USER_ID) parameter; a Run Automation button binds it to the
|
|
56
|
+
* clicking user with `runAutomationParameterValue.triggeredByUser`.
|
|
52
57
|
*/
|
|
53
58
|
export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
|
|
54
59
|
/**
|
|
@@ -60,4 +65,4 @@ export type TriggerFieldTypeAlias = Exclude<FieldTypeAlias, "user">;
|
|
|
60
65
|
* Used when generating app definitions from Hydra's field metadata.
|
|
61
66
|
*/
|
|
62
67
|
export declare const ASPECT_FIELD_TYPE_NAME_TO_WORKFLOW_FIELD_TYPE: Record<string, WorkflowFieldType>;
|
|
63
|
-
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
|
|
68
|
+
export type FieldTypeToTS<A extends FieldTypeAlias> = A extends "text" ? string : A extends "number" | "decimal" ? number : A extends "boolean" ? boolean : A extends "date" | "datetime" ? string : A extends "user" ? string : A extends "userId" ? CalculationTypedValue<string, "user"> : A extends "attachmentId" ? string : A extends "json" | "object" ? unknown : A extends "record" ? RecordShape<AppOrElementRef> : unknown;
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
* ATTACHMENT_ID -> "attachment" (and from-tf.ts the inverse) rather than
|
|
11
11
|
* renaming this alias, to avoid a breaking change to authored `onDemand({})`
|
|
12
12
|
* calls that already use `type: "attachmentId"`.
|
|
13
|
+
*
|
|
14
|
+
* `userId` follows the same rule: the provider's attribute spells USER_ID as
|
|
15
|
+
* a bare "user", so to-tf maps USER_ID -> "user" and from-tf maps it back.
|
|
13
16
|
*/
|
|
14
17
|
export const FIELD_TYPE_MAP = {
|
|
15
18
|
text: "TEXT",
|
|
@@ -19,6 +22,7 @@ export const FIELD_TYPE_MAP = {
|
|
|
19
22
|
date: "DATE",
|
|
20
23
|
datetime: "DATETIME",
|
|
21
24
|
user: "USER",
|
|
25
|
+
userId: "USER_ID",
|
|
22
26
|
json: "JSON",
|
|
23
27
|
object: "OBJECT",
|
|
24
28
|
attachmentId: "ATTACHMENT_ID",
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { GroupRef } from "../../catalog/index.js";
|
|
2
|
+
import type { OrgRefLookup } from "../../engine/build/context.js";
|
|
3
|
+
import { type FromTfContext } from "../../engine/pull/context.js";
|
|
4
|
+
import { type TfValue } from "../../engine/tf/index.js";
|
|
5
|
+
import type { RoleUserRef } from "../role/build.js";
|
|
6
|
+
/** A portable user identity for a skill visibility grant. */
|
|
7
|
+
export type SkillUserRef = RoleUserRef;
|
|
8
|
+
/** Restrict skill visibility to these users or group members. Empty lists remove the restriction. */
|
|
9
|
+
export interface SkillAccessPolicy {
|
|
10
|
+
readonly users?: readonly SkillUserRef[];
|
|
11
|
+
readonly groups?: readonly GroupRef[];
|
|
12
|
+
}
|
|
13
|
+
/** Validate the complete policy before emitting any access-changing configuration. */
|
|
14
|
+
export declare function normalizeSkillAccessPolicy(value: unknown): SkillAccessPolicy;
|
|
15
|
+
export declare function skillAccessPolicyToTf(value: unknown, orgRefs: OrgRefLookup): Record<string, TfValue>;
|
|
16
|
+
/** Any unresolved principal blocks pull; dropping even one could broaden access on the next apply. */
|
|
17
|
+
export declare function skillAccessPolicyFromTf(attrs: Readonly<Record<string, TfValue>>, ctx: FromTfContext): SkillAccessPolicy | undefined;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { EntityTfError } from "../../engine/entity.js";
|
|
2
|
+
import { dataRefLabel } from "../../engine/pull/context.js";
|
|
3
|
+
import { expr, sanitizeName, tfLabelToTsLabel } from "../../engine/tf/index.js";
|
|
4
|
+
function object(value) {
|
|
5
|
+
return value !== null && typeof value === "object" && !Array.isArray(value);
|
|
6
|
+
}
|
|
7
|
+
/** Validate the complete policy before emitting any access-changing configuration. */
|
|
8
|
+
export function normalizeSkillAccessPolicy(value) {
|
|
9
|
+
if (!object(value))
|
|
10
|
+
throw new EntityTfError("skill accessPolicy must contain portable users or groups");
|
|
11
|
+
for (const key of Object.keys(value))
|
|
12
|
+
if (key !== "users" && key !== "groups")
|
|
13
|
+
throw new EntityTfError(`skill accessPolicy has unsupported key ${JSON.stringify(key)}`);
|
|
14
|
+
const out = {};
|
|
15
|
+
for (const key of ["users", "groups"]) {
|
|
16
|
+
const entries = value[key];
|
|
17
|
+
if (entries === undefined)
|
|
18
|
+
continue;
|
|
19
|
+
if (!Array.isArray(entries))
|
|
20
|
+
throw new EntityTfError(`skill accessPolicy.${key} must be a list of portable references`);
|
|
21
|
+
if (key === "users") {
|
|
22
|
+
const users = new Map();
|
|
23
|
+
for (const entry of entries) {
|
|
24
|
+
if (!object(entry) || entry.__kind !== "user" || typeof entry.email !== "string" || !/^[^\s@]+@[^\s@]+$/.test(entry.email)) {
|
|
25
|
+
throw new EntityTfError("skill accessPolicy.users requires userRef(email); raw IDs and other principal kinds are unsupported");
|
|
26
|
+
}
|
|
27
|
+
users.set(entry.email, { __kind: "user", email: entry.email });
|
|
28
|
+
}
|
|
29
|
+
out.users = [...users.values()];
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
const groups = new Map();
|
|
33
|
+
for (const entry of entries) {
|
|
34
|
+
if (!object(entry) || entry.__kind !== "group" || typeof entry.refName !== "string" || entry.refName.trim() === "" || typeof entry.name !== "string" || entry.name.trim() === "") {
|
|
35
|
+
throw new EntityTfError("skill accessPolicy.groups requires an org.groups reference; raw IDs and other principal kinds are unsupported");
|
|
36
|
+
}
|
|
37
|
+
const previous = groups.get(entry.refName);
|
|
38
|
+
if (previous !== undefined && previous.name !== entry.name)
|
|
39
|
+
throw new EntityTfError(`skill accessPolicy.groups has conflicting names for ${JSON.stringify(entry.refName)}`);
|
|
40
|
+
groups.set(entry.refName, { __kind: "group", refName: entry.refName, name: entry.name });
|
|
41
|
+
}
|
|
42
|
+
out.groups = [...groups.values()];
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return Object.keys(out).length === 0 ? { users: [], groups: [] } : out;
|
|
46
|
+
}
|
|
47
|
+
export function skillAccessPolicyToTf(value, orgRefs) {
|
|
48
|
+
const policy = normalizeSkillAccessPolicy(value);
|
|
49
|
+
const out = {};
|
|
50
|
+
const labels = new Map();
|
|
51
|
+
if (policy.users !== undefined)
|
|
52
|
+
out.user_ids = policy.users.map((user) => {
|
|
53
|
+
const label = sanitizeName(user.email.split("@", 1)[0]);
|
|
54
|
+
const previous = labels.get(label);
|
|
55
|
+
if (previous !== undefined && previous !== user.email)
|
|
56
|
+
throw new EntityTfError(`skill accessPolicy.users has colliding email lookup label ${JSON.stringify(label)}`);
|
|
57
|
+
labels.set(label, user.email);
|
|
58
|
+
orgRefs.rawLookup("elementum_user", label, user.email);
|
|
59
|
+
return expr.dataAttr("elementum_user", label, ["id"]);
|
|
60
|
+
});
|
|
61
|
+
if (policy.groups !== undefined)
|
|
62
|
+
out.group_ids = policy.groups.map((group) => {
|
|
63
|
+
const resolved = orgRefs.byTsLabel("groups", group.refName);
|
|
64
|
+
if (resolved === undefined)
|
|
65
|
+
throw new EntityTfError(`skill accessPolicy group ${JSON.stringify(group.refName)} is not in org.ts`);
|
|
66
|
+
return resolved.managed
|
|
67
|
+
? expr.resourceAttr("elementum_group", resolved.tfLabel, ["id"])
|
|
68
|
+
: expr.dataAttr("elementum_group", resolved.tfLabel, ["id"]);
|
|
69
|
+
});
|
|
70
|
+
return out;
|
|
71
|
+
}
|
|
72
|
+
/** Any unresolved principal blocks pull; dropping even one could broaden access on the next apply. */
|
|
73
|
+
export function skillAccessPolicyFromTf(attrs, ctx) {
|
|
74
|
+
if (attrs.user_ids === undefined && attrs.group_ids === undefined)
|
|
75
|
+
return undefined;
|
|
76
|
+
const policy = {};
|
|
77
|
+
for (const [key, type, output] of [["user_ids", "elementum_user", "users"], ["group_ids", "elementum_group", "groups"]]) {
|
|
78
|
+
const values = attrs[key];
|
|
79
|
+
if (values === undefined)
|
|
80
|
+
continue;
|
|
81
|
+
if (!Array.isArray(values))
|
|
82
|
+
throw new EntityTfError(`skill access policy ${key} must be a list; refusing to omit a restriction`);
|
|
83
|
+
const users = [];
|
|
84
|
+
const groups = [];
|
|
85
|
+
for (const value of values) {
|
|
86
|
+
const label = dataRefLabel(value, type);
|
|
87
|
+
const identity = label === undefined ? undefined : ctx.dataName(type, label);
|
|
88
|
+
if (label === undefined || identity === undefined || identity.trim() === "")
|
|
89
|
+
throw new EntityTfError(`skill access policy ${key} contains an unresolved principal; refusing to omit a restriction`);
|
|
90
|
+
if (output === "users")
|
|
91
|
+
users.push({ __kind: "user", email: identity });
|
|
92
|
+
else
|
|
93
|
+
groups.push({ __kind: "group", refName: tfLabelToTsLabel(label), name: identity });
|
|
94
|
+
}
|
|
95
|
+
if (output === "users")
|
|
96
|
+
policy.users = users;
|
|
97
|
+
else
|
|
98
|
+
policy.groups = groups;
|
|
99
|
+
}
|
|
100
|
+
return normalizeSkillAccessPolicy(policy);
|
|
101
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CatalogRef, SkillRef } from "../../catalog/index.js";
|
|
2
2
|
import type { DeployableEntity, EntityDeployOptions } from "../../engine/entity.js";
|
|
3
3
|
import type { SkillTool } from "./tools.js";
|
|
4
|
+
import { type SkillAccessPolicy } from "./access-policy.js";
|
|
4
5
|
export interface SkillInputSpec {
|
|
5
6
|
/** Optional explicit field name (defaults to the record key when using an object shape). */
|
|
6
7
|
readonly name?: string;
|
|
@@ -29,6 +30,8 @@ export type SkillV2Options = EntityDeployOptions & {
|
|
|
29
30
|
readonly properties?: Record<string, unknown>;
|
|
30
31
|
/** Typed discovery signals used when routing user requests to this skill. */
|
|
31
32
|
readonly discovery?: SkillDiscoveryOptions;
|
|
33
|
+
/** Restrict visibility to portable users/group members. Omission or empty lists removes an existing policy; no policy is open to otherwise-authorized users. */
|
|
34
|
+
readonly accessPolicy?: SkillAccessPolicy;
|
|
32
35
|
readonly tools?: readonly SkillTool[];
|
|
33
36
|
} & ({
|
|
34
37
|
/**
|
|
@@ -12,6 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { slimTokens } from "../../catalog/index.js";
|
|
14
14
|
import { deriveSkillInstructions, } from "./input-coverage.js";
|
|
15
|
+
import { normalizeSkillAccessPolicy } from "./access-policy.js";
|
|
15
16
|
/**
|
|
16
17
|
* `name` is a free-text display name, like an agent's — confirmed against
|
|
17
18
|
* the platform's actual create/update path, which only rejects a blank
|
|
@@ -74,6 +75,7 @@ export function skill(opts) {
|
|
|
74
75
|
throw new Error("skill discovery.routingPriority must be a finite number from -100 to 100");
|
|
75
76
|
}
|
|
76
77
|
const normalizedInputs = normalizeInputs(opts.inputs);
|
|
78
|
+
const accessPolicy = opts.accessPolicy === undefined ? undefined : normalizeSkillAccessPolicy(opts.accessPolicy);
|
|
77
79
|
const normalizedLookups = normalizeLookups(opts.lookups);
|
|
78
80
|
const instructions = deriveSkillInstructions(opts.instructions, normalizedInputs, normalizedLookups);
|
|
79
81
|
if (instructions.trim() === "") {
|
|
@@ -98,6 +100,7 @@ export function skill(opts) {
|
|
|
98
100
|
type: "CUSTOM",
|
|
99
101
|
...(opts.properties !== undefined ? { properties: opts.properties } : {}),
|
|
100
102
|
...(opts.discovery !== undefined ? { discovery: opts.discovery } : {}),
|
|
103
|
+
...(accessPolicy !== undefined ? { accessPolicy } : {}),
|
|
101
104
|
},
|
|
102
105
|
tools: opts.tools ?? [],
|
|
103
106
|
}),
|
|
@@ -16,10 +16,13 @@ import type { NormalizedSkill } from "../from-tf.js";
|
|
|
16
16
|
export interface PrintSkillV2Options {
|
|
17
17
|
/** The owning app's refName — `parent:` and the catalog token root. */
|
|
18
18
|
readonly appRefName: string;
|
|
19
|
+
/** Relative import of the workspace's portable org catalog. */
|
|
20
|
+
readonly orgImportPath?: string;
|
|
19
21
|
/**
|
|
20
22
|
* Set for a cross-org clone: a foreign-app tool target was resolved
|
|
21
23
|
* against the SOURCE org, so it's flagged as a TODO for manual review
|
|
22
|
-
* instead of silently carried over
|
|
24
|
+
* instead of silently carried over. Access-policy groups require explicit
|
|
25
|
+
* destination review and print a build-blocking placeholder — same treatment as agent tools
|
|
23
26
|
* (`src/entities/agent/deserializer/print-agent-v2.ts`).
|
|
24
27
|
*/
|
|
25
28
|
readonly crossOrg?: boolean;
|
|
@@ -46,6 +46,7 @@ export function printSkillV2(skill, opts) {
|
|
|
46
46
|
const factories = [
|
|
47
47
|
...new Set([
|
|
48
48
|
...skill.tools.map((t) => TOOL_FACTORY_BY_TYPE_KEY[t.typeKey]).filter(Boolean),
|
|
49
|
+
...((skill.accessPolicy?.users?.length ?? 0) > 0 ? ["userRef"] : []),
|
|
49
50
|
...(skill.tools.some((t) => t.runAs !== undefined && "serviceAccount" in t.runAs)
|
|
50
51
|
? ["serviceAccountRef"]
|
|
51
52
|
: []),
|
|
@@ -68,6 +69,8 @@ export function printSkillV2(skill, opts) {
|
|
|
68
69
|
if (skill.tools.some((tool) => tool.typeKey === "searchTable" && tool.target?.kind === "tableOwned")) {
|
|
69
70
|
lines.push(`import { tableSearchTableRef } from ${JSON.stringify(sdkPackageSpecifier("catalog"))};`);
|
|
70
71
|
}
|
|
72
|
+
if ((skill.accessPolicy?.groups?.length ?? 0) > 0)
|
|
73
|
+
lines.push(`import { org } from ${quote(opts.orgImportPath ?? "../../../org.js")};`);
|
|
71
74
|
if (usesUnsafePlatformId)
|
|
72
75
|
lines.push(`import { unsafePlatformId } from ${JSON.stringify(sdkPackageSpecifier("core"))};`);
|
|
73
76
|
lines.push(`import catalog from "@catalog";`);
|
|
@@ -115,6 +118,24 @@ export function printSkillV2(skill, opts) {
|
|
|
115
118
|
if (skill.discovery !== undefined) {
|
|
116
119
|
lines.push(` discovery: ${JSON.stringify(skill.discovery)},`);
|
|
117
120
|
}
|
|
121
|
+
if (skill.accessPolicy !== undefined) {
|
|
122
|
+
lines.push(" accessPolicy: {");
|
|
123
|
+
if (skill.accessPolicy.users !== undefined)
|
|
124
|
+
lines.push(` users: [${skill.accessPolicy.users.map((user) => `userRef(${quote(user.email)})`).join(", ")}],`);
|
|
125
|
+
if (skill.accessPolicy.groups !== undefined) {
|
|
126
|
+
if (crossOrg && skill.accessPolicy.groups.length > 0) {
|
|
127
|
+
lines.push(" groups: [");
|
|
128
|
+
for (const group of skill.accessPolicy.groups) {
|
|
129
|
+
lines.push(` TODO_DESTINATION_GROUP, // TODO: cross-org clone — verify the destination group's membership, then replace with org.groups.<key> for source group ${quote(group.name)}.`);
|
|
130
|
+
}
|
|
131
|
+
lines.push(" ],");
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
lines.push(` groups: [${skill.accessPolicy.groups.map((group) => `org.groups${safeMember(group.refName)}`).join(", ")}],`);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
lines.push(" },");
|
|
138
|
+
}
|
|
118
139
|
if (skill.tools.length > 0) {
|
|
119
140
|
lines.push(" tools: [");
|
|
120
141
|
for (const tool of skill.tools) {
|
|
@@ -320,7 +341,8 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
320
341
|
if (tool.target?.kind === "tableOwned") {
|
|
321
342
|
const owner = tool.searchTableOwnerRefName ?? parent;
|
|
322
343
|
const ownerName = tool.searchTableOwnerName;
|
|
323
|
-
|
|
344
|
+
const pinnedId = tool.searchTableId !== undefined ? `, id: ${quote(tool.searchTableId)}` : "";
|
|
345
|
+
lines.push(` table: tableSearchTableRef({ name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(owner)}${ownerName !== undefined ? `, parentName: ${quote(ownerName)}` : ""}${pinnedId} }),`);
|
|
324
346
|
}
|
|
325
347
|
else if (typedTable !== undefined) {
|
|
326
348
|
lines.push(` table: catalog.${typedTable.ownerRefName}.searchTables${safeMember(typedTable.tableKey)},`);
|
|
@@ -9,6 +9,7 @@ import { type FromTfContext } from "../../engine/pull/context.js";
|
|
|
9
9
|
import { type TfBlock } from "../../engine/tf/index.js";
|
|
10
10
|
import { type NormalizedSkillTool } from "../skill-tool/from-tf.js";
|
|
11
11
|
import { type SkillInputDefinition, type SkillLookupDefinition } from "./input-coverage.js";
|
|
12
|
+
import { type SkillAccessPolicy } from "./access-policy.js";
|
|
12
13
|
export interface NormalizedSkillDiscovery {
|
|
13
14
|
readonly routingPriority?: number;
|
|
14
15
|
readonly aliases?: readonly string[];
|
|
@@ -28,6 +29,7 @@ export interface NormalizedSkill {
|
|
|
28
29
|
readonly status?: "ACTIVE" | "INACTIVE";
|
|
29
30
|
readonly properties?: Record<string, unknown>;
|
|
30
31
|
readonly discovery?: NormalizedSkillDiscovery;
|
|
32
|
+
readonly accessPolicy?: SkillAccessPolicy;
|
|
31
33
|
readonly tools: readonly NormalizedSkillTool[];
|
|
32
34
|
}
|
|
33
35
|
export interface SkillFromTfResult {
|