@elementumai/edk 0.9.19 → 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 +146 -6
- package/dist-sdk/src/catalog/factories.d.ts +24 -1
- package/dist-sdk/src/catalog/factories.js +30 -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/render.js +6 -6
- package/dist-sdk/src/catalog/token.js +7 -0
- package/dist-sdk/src/catalog/types.d.ts +34 -1
- package/dist-sdk/src/catalog/types.js +11 -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 +10 -7
- package/dist-sdk/src/engine/pull/result-output.d.ts +6 -0
- package/dist-sdk/src/engine/pull/result-output.js +87 -3
- package/dist-sdk/src/engine/tf/expr.js +1 -1
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +6 -0
- package/dist-sdk/src/engine/tf/labels.js +9 -0
- package/dist-sdk/src/engine/tf/model.d.ts +22 -1
- package/dist-sdk/src/engine/tf/parse.js +92 -4
- 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/entities/access-policy/to-tf.js +5 -2
- 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 +27 -5
- package/dist-sdk/src/entities/app/build.d.ts +89 -20
- package/dist-sdk/src/entities/app/build.js +51 -6
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +16 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/app/from-tf.js +7 -2
- package/dist-sdk/src/entities/app/index.d.ts +6 -6
- package/dist-sdk/src/entities/app/index.js +1 -0
- package/dist-sdk/src/entities/app/module.js +5 -2
- package/dist-sdk/src/entities/app/to-tf.js +19 -11
- package/dist-sdk/src/entities/automation/build.d.ts +47 -5
- package/dist-sdk/src/entities/automation/build.js +137 -20
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +24 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +314 -39
- package/dist-sdk/src/entities/automation/from-tf.d.ts +28 -6
- package/dist-sdk/src/entities/automation/from-tf.js +428 -48
- 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.js +37 -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.js +4 -0
- package/dist-sdk/src/entities/automation/task-output-labels.d.ts +2 -0
- package/dist-sdk/src/entities/automation/task-output-labels.js +9 -0
- package/dist-sdk/src/entities/automation/tasks.d.ts +24 -2
- 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 +489 -83
- 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/chart/to-tf.js +10 -3
- package/dist-sdk/src/entities/dynamic-layout/build.d.ts +24 -31
- package/dist-sdk/src/entities/element/build.d.ts +25 -13
- package/dist-sdk/src/entities/element/build.js +4 -1
- package/dist-sdk/src/entities/element/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/element/from-tf.js +58 -1
- package/dist-sdk/src/entities/element/index.d.ts +5 -3
- package/dist-sdk/src/entities/element/index.js +1 -0
- package/dist-sdk/src/entities/element/module.js +9 -3
- package/dist-sdk/src/entities/element/to-tf.js +8 -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 +1 -0
- package/dist-sdk/src/entities/field/from-tf.js +39 -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 +130 -14
- 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/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 +2 -0
- package/dist-sdk/src/entities/relationship/to-tf.js +12 -3
- 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 +8 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.js +14 -4
- package/dist-sdk/src/entities/shared/filters/print.js +17 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +5 -1
- package/dist-sdk/src/entities/shared/filters/types.d.ts +9 -1
- 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/deserializer/print-skill-v2.js +2 -1
- package/dist-sdk/src/entities/skill/from-tf.js +66 -13
- 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/to-tf.js +14 -4
- 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 +27 -5
- 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 +2 -2
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.d.ts +49 -9
- package/dist-sdk/src/entities/view/agent-view-layout-from-tf.js +71 -18
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.d.ts +19 -4
- package/dist-sdk/src/entities/view/agent-view-layout-to-tf.js +82 -10
- package/dist-sdk/src/entities/view/agent-view-layout.d.ts +53 -23
- package/dist-sdk/src/entities/view/agent-view-layout.js +1 -1
- package/dist-sdk/src/entities/view/from-tf.d.ts +3 -2
- package/dist-sdk/src/entities/view/from-tf.js +124 -12
- package/dist-sdk/src/entities/view/module.js +30 -3
- package/dist-sdk/src/entities/view/to-tf.d.ts +14 -1
- package/dist-sdk/src/entities/view/to-tf.js +67 -10
- package/dist-sdk/src/entities/view/types.d.ts +4 -15
- package/dist-sdk/src/entities/view/types.js +15 -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 +34 -8
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.d.ts +16 -5
- package/dist-sdk/src/generated/ragnarok/ragnarok-spec.js +2 -2
- package/dist-sdk/src/graph/index.d.ts +11 -0
- package/dist-sdk/src/graph/index.js +21 -0
- package/dist-sdk/src/graph/modules.js +2 -0
- package/dist-sdk/src/graph/types.d.ts +55 -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 +10 -1
|
@@ -7,10 +7,10 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { EntityTfError } from "../../engine/entity.js";
|
|
9
9
|
import { optionalString, resourceRefLabel } from "../../engine/pull/context.js";
|
|
10
|
-
import { scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
10
|
+
import { isTfExpr, scopedLabelToBagKey } from "../../engine/tf/index.js";
|
|
11
11
|
import { skillToolFromTf } from "../skill-tool/from-tf.js";
|
|
12
12
|
import { APP_RESOURCE_TYPE } from "../app/module.js";
|
|
13
|
-
import { analyzeSkillInputCoverage,
|
|
13
|
+
import { analyzeSkillInputCoverage, decomposeSkillInstructionsLossless, skillCoverageGapDiagnostics, skillCoverageReportLines, } from "./input-coverage.js";
|
|
14
14
|
import { SKILL_RESOURCE_TYPE } from "./module.js";
|
|
15
15
|
import { skillAccessPolicyFromTf } from "./access-policy.js";
|
|
16
16
|
/** Attributes `skillFromTf` understands — anything else is dialect growth, reported loudly. */
|
|
@@ -42,6 +42,68 @@ function optionalStringList(attrs, key, where, ctx) {
|
|
|
42
42
|
}
|
|
43
43
|
return value;
|
|
44
44
|
}
|
|
45
|
+
/** Walk a parsed value, rejecting anything that is still a Terraform expression. */
|
|
46
|
+
function asPlainJson(value) {
|
|
47
|
+
if (isTfExpr(value))
|
|
48
|
+
return { ok: false };
|
|
49
|
+
if (Array.isArray(value)) {
|
|
50
|
+
const items = [];
|
|
51
|
+
for (const item of value) {
|
|
52
|
+
const plain = asPlainJson(item);
|
|
53
|
+
if (!plain.ok)
|
|
54
|
+
return plain;
|
|
55
|
+
items.push(plain.value);
|
|
56
|
+
}
|
|
57
|
+
return { ok: true, value: items };
|
|
58
|
+
}
|
|
59
|
+
if (typeof value === "object" && value !== null) {
|
|
60
|
+
const out = {};
|
|
61
|
+
for (const [key, child] of Object.entries(value)) {
|
|
62
|
+
const plain = asPlainJson(child);
|
|
63
|
+
if (!plain.ok)
|
|
64
|
+
return plain;
|
|
65
|
+
out[key] = plain.value;
|
|
66
|
+
}
|
|
67
|
+
return { ok: true, value: out };
|
|
68
|
+
}
|
|
69
|
+
return { ok: true, value };
|
|
70
|
+
}
|
|
71
|
+
function propertiesObject(value, where, ctx) {
|
|
72
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
73
|
+
ctx.diagnostics.push(`${where}: properties JSON must be an object; dropped`);
|
|
74
|
+
return undefined;
|
|
75
|
+
}
|
|
76
|
+
return value;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* `properties` is a JSON string on the wire. ei emits it as `jsonencode({...})`
|
|
80
|
+
* so the file formats; older builds may still carry a quoted JSON string.
|
|
81
|
+
* Either shape keeps the skill. An unreadable shape drops only the attribute.
|
|
82
|
+
*/
|
|
83
|
+
function propertiesFromTf(raw, where, ctx) {
|
|
84
|
+
if (raw === undefined || raw === null || raw === "")
|
|
85
|
+
return undefined;
|
|
86
|
+
if (typeof raw === "string") {
|
|
87
|
+
try {
|
|
88
|
+
// eslint-disable-next-line no-restricted-syntax -- properties is a JSON string on the resource, not an authored entity.
|
|
89
|
+
return propertiesObject(JSON.parse(raw), where, ctx);
|
|
90
|
+
}
|
|
91
|
+
catch {
|
|
92
|
+
ctx.diagnostics.push(`${where}: properties is not valid JSON; dropped`);
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
if (isTfExpr(raw) && raw.$expr === "jsonencode") {
|
|
97
|
+
const plain = asPlainJson(raw.value);
|
|
98
|
+
if (!plain.ok) {
|
|
99
|
+
ctx.diagnostics.push(`${where}: properties jsonencode payload is not plain JSON; dropped`);
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
return propertiesObject(plain.value, where, ctx);
|
|
103
|
+
}
|
|
104
|
+
ctx.diagnostics.push(`${where}: properties has an unrecognized shape; dropped`);
|
|
105
|
+
return undefined;
|
|
106
|
+
}
|
|
45
107
|
/**
|
|
46
108
|
* The `elementum_agentic_skill` block + its tool blocks → the normalized
|
|
47
109
|
* skill. Tool blocks belonging to OTHER skills are skipped with a
|
|
@@ -68,16 +130,7 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
68
130
|
if (resourceRefLabel(attrs["owner_id"], APP_RESOURCE_TYPE) !== appLabel) {
|
|
69
131
|
return { skippedReason: `${where}: owner_id does not reference ${APP_RESOURCE_TYPE}.${appLabel}; skipped` };
|
|
70
132
|
}
|
|
71
|
-
|
|
72
|
-
const rawProperties = attrs["properties"];
|
|
73
|
-
if (typeof rawProperties === "string" && rawProperties !== "") {
|
|
74
|
-
try {
|
|
75
|
-
properties = JSON.parse(rawProperties);
|
|
76
|
-
}
|
|
77
|
-
catch {
|
|
78
|
-
ctx.diagnostics.push(`${where}: properties is not valid JSON; dropped`);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
133
|
+
const properties = propertiesFromTf(attrs["properties"], where, ctx);
|
|
81
134
|
const status = optionalString(attrs, "status", where, ctx);
|
|
82
135
|
const accessPolicy = skillAccessPolicyFromTf(attrs, ctx);
|
|
83
136
|
const routingPriority = attrs["routing_priority"];
|
|
@@ -111,7 +164,7 @@ export function skillFromTf(skillBlock, toolBlocks, appLabel, ctx) {
|
|
|
111
164
|
const coverage = analyzeSkillInputCoverage(name, rawInstructions, coverageTools);
|
|
112
165
|
ctx.reports?.push(...skillCoverageReportLines(coverage));
|
|
113
166
|
ctx.diagnostics.push(...skillCoverageGapDiagnostics(coverage));
|
|
114
|
-
const decomposed =
|
|
167
|
+
const decomposed = decomposeSkillInstructionsLossless(rawInstructions);
|
|
115
168
|
const instructions = decomposed.inputs.length > 0 || decomposed.lookups.length > 0
|
|
116
169
|
? decomposed.prose
|
|
117
170
|
: rawInstructions;
|
|
@@ -79,6 +79,13 @@ export declare function formatSkillInputSchema(inputs: readonly SkillInputDefini
|
|
|
79
79
|
export declare function formatSkillLookupNotes(lookups: readonly SkillLookupDefinition[]): string;
|
|
80
80
|
export declare function deriveSkillInstructions(baseProse: string | undefined, inputs?: readonly SkillInputDefinition[], lookups?: readonly SkillLookupDefinition[]): string;
|
|
81
81
|
export declare function decomposeSkillInstructions(markdown: string): DecomposedSkillInstructions;
|
|
82
|
+
/**
|
|
83
|
+
* Decompose instructions for pulled source only when build reproduces them exactly — build re-derives the
|
|
84
|
+
* Input Schema / Lookup Notes sections from structured inputs/lookups, printed only when non-empty. Text the
|
|
85
|
+
* generator would not write back byte for byte (e.g. a hand-written "## Lookup Notes" placeholder) stays verbatim
|
|
86
|
+
* in the prose, so a pull → build round trip never changes the platform's instructions.
|
|
87
|
+
*/
|
|
88
|
+
export declare function decomposeSkillInstructionsLossless(markdown: string): DecomposedSkillInstructions;
|
|
82
89
|
/** Compare instruction-declared form variables with the deployed tool surface. */
|
|
83
90
|
export declare function analyzeSkillInputCoverage(skill: string, instructions: string, coverageTools: readonly SkillCoverageTool[]): SkillInputCoverageReport;
|
|
84
91
|
/** Informational coverage lines emitted on stderr and in JSON `reports`. */
|
|
@@ -197,6 +197,17 @@ export function decomposeSkillInstructions(markdown) {
|
|
|
197
197
|
const prose = proseLines.join("\n").trim();
|
|
198
198
|
return { prose, inputs, lookups };
|
|
199
199
|
}
|
|
200
|
+
/**
|
|
201
|
+
* Decompose instructions for pulled source only when build reproduces them exactly — build re-derives the
|
|
202
|
+
* Input Schema / Lookup Notes sections from structured inputs/lookups, printed only when non-empty. Text the
|
|
203
|
+
* generator would not write back byte for byte (e.g. a hand-written "## Lookup Notes" placeholder) stays verbatim
|
|
204
|
+
* in the prose, so a pull → build round trip never changes the platform's instructions.
|
|
205
|
+
*/
|
|
206
|
+
export function decomposeSkillInstructionsLossless(markdown) {
|
|
207
|
+
const decomposed = decomposeSkillInstructions(markdown);
|
|
208
|
+
const rebuilt = deriveSkillInstructions(decomposed.prose, decomposed.inputs.length > 0 ? decomposed.inputs : undefined, decomposed.lookups.length > 0 ? decomposed.lookups : undefined);
|
|
209
|
+
return rebuilt === markdown ? decomposed : { prose: markdown, inputs: [], lookups: [] };
|
|
210
|
+
}
|
|
200
211
|
function mentionsIdentifier(markdown, name) {
|
|
201
212
|
if (name === "")
|
|
202
213
|
return false;
|
|
@@ -91,7 +91,14 @@ export function skillToTf(entity, ctx) {
|
|
|
91
91
|
type: elementum.type ?? "CUSTOM",
|
|
92
92
|
};
|
|
93
93
|
if (elementum.properties !== undefined) {
|
|
94
|
-
|
|
94
|
+
// Same shape ei exports: jsonencode({ ... }) of the JSON object, not a
|
|
95
|
+
// quoted JSON string. A quoted string still applies, but it does not match
|
|
96
|
+
// the export and hides a properties round-trip gap. JSON.stringify drops
|
|
97
|
+
// undefined members the way the previous quoted-JSON path did; leaving
|
|
98
|
+
// them in the object makes render throw.
|
|
99
|
+
// eslint-disable-next-line no-restricted-syntax -- properties is an opaque JSON object, same normalization as from-tf.
|
|
100
|
+
const plain = JSON.parse(JSON.stringify(elementum.properties));
|
|
101
|
+
attrs["properties"] = expr.jsonencode(plain);
|
|
95
102
|
}
|
|
96
103
|
if (elementum.accessPolicy !== undefined)
|
|
97
104
|
Object.assign(attrs, skillAccessPolicyToTf(elementum.accessPolicy, ctx.orgRefs));
|
|
@@ -119,14 +126,17 @@ export function skillToTf(entity, ctx) {
|
|
|
119
126
|
foreignAppRef: (l, n, ns) => ctx.orgRefs.foreignApp(l, n, ns),
|
|
120
127
|
foreignElementRef: (l, n, ns) => ctx.orgRefs.foreignElement(l, n, ns),
|
|
121
128
|
foreignTaskRef: (l, n) => ctx.orgRefs.rawLookup("elementum_task", l, n),
|
|
122
|
-
foreignFieldRef: (t, l, o, n) => ctx.orgRefs.foreignField(t, l, o, n),
|
|
129
|
+
foreignFieldRef: (t, l, o, n, extra) => ctx.orgRefs.foreignField(t, l, o, n, extra),
|
|
123
130
|
workspaceAspects: ctx.workspaceAspects,
|
|
124
131
|
serviceAccountRef: (_label, serviceAccountName) => serviceAccountValue(serviceAccountName, ctx),
|
|
125
|
-
tableSearchTableRef: (label, tableRefName, tableName, searchTableName) => {
|
|
132
|
+
tableSearchTableRef: (label, tableRefName, tableName, searchTableName, searchTableId) => {
|
|
126
133
|
const tableLabel = sanitizeName(tableRefName);
|
|
127
134
|
const tableId = expr.dataAttr("elementum_table", tableLabel, ["id"]);
|
|
128
135
|
ctx.orgRefs.rawLookup("elementum_table", tableLabel, tableName);
|
|
129
|
-
ctx.orgRefs.rawLookup("elementum_search_table", label, searchTableName, {
|
|
136
|
+
ctx.orgRefs.rawLookup("elementum_search_table", label, searchTableName, {
|
|
137
|
+
table_id: tableId,
|
|
138
|
+
...(searchTableId !== undefined && searchTableId !== "" ? { id: searchTableId } : {}),
|
|
139
|
+
});
|
|
130
140
|
return expr.dataAttr("elementum_search_table", label, ["id"]);
|
|
131
141
|
},
|
|
132
142
|
foreignAutomationRef: (tfLabel, parentKind, _parentRefName, parentName, automationName) => {
|
|
@@ -94,6 +94,8 @@ export interface NormalizedSkillTool {
|
|
|
94
94
|
readonly searchTableKey?: string;
|
|
95
95
|
/** Foreign table lookup name when search_table_id is data.elementum_search_table. */
|
|
96
96
|
readonly searchTableName?: string;
|
|
97
|
+
/** Pinned search-table id when the data source names more than one row. */
|
|
98
|
+
readonly searchTableId?: string;
|
|
97
99
|
/** Display name of the owning organization table for a table-owned search table. */
|
|
98
100
|
readonly searchTableOwnerName?: string;
|
|
99
101
|
/** Canonical catalog refName of the owning organization table, when known. */
|
|
@@ -217,6 +217,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
217
217
|
}
|
|
218
218
|
let searchTableKey;
|
|
219
219
|
let searchTableName;
|
|
220
|
+
let searchTableId;
|
|
220
221
|
let tableOwnedSearchTable = false;
|
|
221
222
|
let searchTableOwnerName;
|
|
222
223
|
let searchTableOwnerRefName;
|
|
@@ -240,11 +241,15 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
240
241
|
}
|
|
241
242
|
else if (isTfExpr(value) && value.$expr === "data-attr" && value.type === "elementum_search_table") {
|
|
242
243
|
searchTableName = ctx.dataName(value.type, value.label);
|
|
244
|
+
const dataAttrs = ctx.dataAttrs?.(value.type, value.label);
|
|
245
|
+
const pinnedId = dataAttrs?.["id"];
|
|
246
|
+
if (typeof pinnedId === "string" && pinnedId !== "")
|
|
247
|
+
searchTableId = pinnedId;
|
|
243
248
|
// The generic search-table data source is used for both aspect-owned and
|
|
244
249
|
// table-owned tables. The presence of table_id is the only portable
|
|
245
250
|
// discriminator available in the HCL stream.
|
|
246
|
-
tableOwnedSearchTable =
|
|
247
|
-
const tableLabel = dataRefLabel(
|
|
251
|
+
tableOwnedSearchTable = dataAttrs?.["table_id"] !== undefined;
|
|
252
|
+
const tableLabel = dataRefLabel(dataAttrs?.["table_id"], "elementum_table");
|
|
248
253
|
if (tableLabel !== undefined) {
|
|
249
254
|
searchTableOwnerName = ctx.dataName("elementum_table", tableLabel);
|
|
250
255
|
if (searchTableOwnerName !== undefined) {
|
|
@@ -445,6 +450,7 @@ export function skillToolFromTf(block, owner, ctx) {
|
|
|
445
450
|
}),
|
|
446
451
|
...(searchTableKey !== undefined && { searchTableKey }),
|
|
447
452
|
...(searchTableName !== undefined && { searchTableName }),
|
|
453
|
+
...(searchTableId !== undefined && { searchTableId }),
|
|
448
454
|
...(searchTableOwnerName !== undefined && { searchTableOwnerName }),
|
|
449
455
|
...(searchTableOwnerRefName !== undefined && { searchTableOwnerRefName }),
|
|
450
456
|
...(searchTableRawId !== undefined && { searchTableRawId }),
|
|
@@ -29,13 +29,13 @@ export interface SkillToolToTfContext {
|
|
|
29
29
|
/** Records a foreign-TASK data lookup for data.tf. */
|
|
30
30
|
foreignTaskRef?(tfLabel: string, name: string, namespace?: string): void;
|
|
31
31
|
/** Records an object-scoped data lookup owned by a foreign app/element. */
|
|
32
|
-
foreignFieldRef(type: string, tfLabel: string, objectId: TfValue, name: string): void;
|
|
32
|
+
foreignFieldRef(type: string, tfLabel: string, objectId: TfValue, name: string, extraAttrs?: Readonly<Record<string, TfValue>>): void;
|
|
33
33
|
/** App/element roots authored in this same workspace. */
|
|
34
34
|
readonly workspaceAspects?: ReadonlyMap<string, WorkspaceAspect>;
|
|
35
35
|
/** Records an app-scoped service-account lookup by name. */
|
|
36
36
|
serviceAccountRef?(tfLabel: string, name: string): TfValue | void;
|
|
37
37
|
/** Records a table-owned search-table data lookup for a pulled public ref. */
|
|
38
|
-
tableSearchTableRef?(tfLabel: string, tableRefName: string, tableName: string, searchTableName: string): TfValue | void;
|
|
38
|
+
tableSearchTableRef?(tfLabel: string, tableRefName: string, tableName: string, searchTableName: string, searchTableId?: string): TfValue | void;
|
|
39
39
|
/**
|
|
40
40
|
* Records a cross-app/element automation data lookup (a `runAutomation`
|
|
41
41
|
* skill/agent tool targeting an automation this workspace doesn't own),
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { workspaceAspectKey } from "../../engine/build/context.js";
|
|
10
10
|
import { automationRunTargetResourceAttr } from "../automation/to-tf.js";
|
|
11
|
-
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
12
|
-
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
11
|
+
import { appScopedResourceLabel, childPartFromScopedLabel, expr, sanitizeName, scopedResourceLabel, stableIdSuffix, tsLabelToTfLabel } from "../../engine/tf/index.js";
|
|
12
|
+
import { authoredFieldKeysFromPayload, fieldRefToTfValue, } from "../field/to-tf.js";
|
|
13
13
|
import { foreignFieldDataLabel } from "../shared/foreign-ref.js";
|
|
14
14
|
import { encodeOptionalHandleDescription } from "../shared/handle-description.js";
|
|
15
15
|
import { SKILL_TOOL_SUB_TYPE_BY_TYPE_KEY } from "./types.js";
|
|
@@ -63,6 +63,7 @@ function targetIdValue(token, ctx) {
|
|
|
63
63
|
refName,
|
|
64
64
|
kind,
|
|
65
65
|
localTfLabel: sibling.tfLabel,
|
|
66
|
+
fieldOwnership: authoredFieldKeysFromPayload(sibling.streamRootEntity?.payload),
|
|
66
67
|
};
|
|
67
68
|
}
|
|
68
69
|
const name = token.name ?? refName;
|
|
@@ -131,7 +132,7 @@ function fieldRefValue(token, where, ctx, target) {
|
|
|
131
132
|
const authoringType = token.fieldType ?? "";
|
|
132
133
|
const ref = refName === ""
|
|
133
134
|
? undefined
|
|
134
|
-
: fieldRefToTfValue(authoringType, refName, target.localTfLabel, target.kind);
|
|
135
|
+
: fieldRefToTfValue(authoringType, refName, target.localTfLabel, target.kind, target.fieldOwnership);
|
|
135
136
|
if (ref === undefined) {
|
|
136
137
|
ctx.diagnostics.push(`${where}: field token "${refName}" has no terraform field resource mapping (fieldType ${JSON.stringify(authoringType)}); dropped`);
|
|
137
138
|
return undefined;
|
|
@@ -279,6 +280,7 @@ export function skillToolToTf(entry, ctx) {
|
|
|
279
280
|
attrs["target_id"] = "";
|
|
280
281
|
if (typeKey === "searchTable") {
|
|
281
282
|
const table = inner.searchTableId;
|
|
283
|
+
const pinnedSearchTableId = typeof table?.id === "string" && table.id !== "" ? table.id : undefined;
|
|
282
284
|
// The search table itself (not its owner - that's the __variant/parent
|
|
283
285
|
// fallback below) has no portable lookup at all: unsafePlatformId()
|
|
284
286
|
// round-trips it as a raw id directly, before the refName check below,
|
|
@@ -310,11 +312,25 @@ export function skillToolToTf(entry, ctx) {
|
|
|
310
312
|
const workspaceTable = table.parent === undefined
|
|
311
313
|
? undefined
|
|
312
314
|
: ctx.workspaceAspects?.get(workspaceAspectKey("table", table.parent));
|
|
313
|
-
|
|
315
|
+
const searchName = table.name ?? table.refName;
|
|
316
|
+
const tableLookupLabel = `${sanitizeName(table.parent ?? "")}_${sanitizeName(searchName)}`;
|
|
317
|
+
const tableLookup = pinnedSearchTableId === undefined
|
|
318
|
+
? tableLookupLabel
|
|
319
|
+
: `${tableLookupLabel}_${stableIdSuffix(pinnedSearchTableId)}`;
|
|
320
|
+
if (pinnedSearchTableId !== undefined && ctx.tableSearchTableRef !== undefined && table.parent !== undefined && table.parent !== "") {
|
|
321
|
+
const lookup = ctx.tableSearchTableRef(tableLookup, table.parent, table.parentName ?? table.parent, searchName, pinnedSearchTableId);
|
|
322
|
+
if (lookup !== undefined)
|
|
323
|
+
attrs["search_table_id"] = lookup;
|
|
324
|
+
else {
|
|
325
|
+
ctx.diagnostics.push(`${where}: table-owned search table lookup could not be materialized; dropped`);
|
|
326
|
+
return undefined;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
else if (workspaceTable !== undefined) {
|
|
314
330
|
attrs["search_table_id"] = expr.resourceAttr("elementum_table_search_table", `tables_${workspaceTable.tfLabel}_${tsLabelToTfLabel(table.refName)}`, ["id"]);
|
|
315
331
|
}
|
|
316
332
|
else if (ctx.tableSearchTableRef !== undefined && table.parent !== undefined && table.parent !== "") {
|
|
317
|
-
const lookup = ctx.tableSearchTableRef(
|
|
333
|
+
const lookup = ctx.tableSearchTableRef(tableLookup, table.parent, table.parentName ?? table.parent, searchName);
|
|
318
334
|
if (lookup !== undefined)
|
|
319
335
|
attrs["search_table_id"] = lookup;
|
|
320
336
|
else {
|
|
@@ -330,6 +346,12 @@ export function skillToolToTf(entry, ctx) {
|
|
|
330
346
|
return undefined;
|
|
331
347
|
}
|
|
332
348
|
}
|
|
349
|
+
else if (pinnedSearchTableId !== undefined) {
|
|
350
|
+
const ownerPart = target.localTfLabel ?? target.foreignTfLabel ?? sanitizeName(target.refName);
|
|
351
|
+
const lookupLabel = `${sanitizeName(`${ownerPart}_${table.name ?? table.refName}`)}_${stableIdSuffix(pinnedSearchTableId)}`;
|
|
352
|
+
ctx.foreignFieldRef("elementum_search_table", lookupLabel, target.value, table.name ?? table.refName, { id: pinnedSearchTableId });
|
|
353
|
+
attrs["search_table_id"] = expr.dataAttr("elementum_search_table", lookupLabel, ["id"]);
|
|
354
|
+
}
|
|
333
355
|
else if (target.localTfLabel === undefined) {
|
|
334
356
|
const targetName = aspectId?.name ?? aspectId?.refName ?? table.parent;
|
|
335
357
|
const lookupLabel = sanitizeName(`${targetName}_${table.name ?? table.refName}`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { TableColumnStateV2 } from "./state.js";
|
|
2
|
+
export interface TableCatalogInput {
|
|
3
|
+
readonly handle: string;
|
|
4
|
+
readonly name: string;
|
|
5
|
+
readonly categoryId?: string;
|
|
6
|
+
readonly tableColumns?: Record<string, TableColumnStateV2>;
|
|
7
|
+
readonly datamines?: Record<string, {
|
|
8
|
+
readonly name: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
export declare function renderTableCatalog(table: TableCatalogInput): string;
|
|
12
|
+
export declare function writeTableCatalog(orgRoot: string, table: TableCatalogInput): Promise<{
|
|
13
|
+
catalogPath: string;
|
|
14
|
+
}>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { mkdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { sdkPackageSpecifier } from "../../internal/sdk-package.js";
|
|
4
|
+
const RESERVED_IDENT = new Set([
|
|
5
|
+
"break", "case", "catch", "class", "const", "continue", "debugger", "default",
|
|
6
|
+
"delete", "do", "else", "export", "extends", "false", "finally", "for",
|
|
7
|
+
"function", "if", "import", "in", "instanceof", "new", "null", "return",
|
|
8
|
+
"super", "switch", "this", "throw", "true", "try", "typeof", "var", "void",
|
|
9
|
+
"while", "with", "let", "static", "yield", "enum",
|
|
10
|
+
]);
|
|
11
|
+
function q(value) {
|
|
12
|
+
return JSON.stringify(value);
|
|
13
|
+
}
|
|
14
|
+
function safeKey(name) {
|
|
15
|
+
return /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(name) && !RESERVED_IDENT.has(name)
|
|
16
|
+
? name
|
|
17
|
+
: q(name);
|
|
18
|
+
}
|
|
19
|
+
export function renderTableCatalog(table) {
|
|
20
|
+
const lines = [];
|
|
21
|
+
lines.push(`import { datamineRef, tableColumnRef, tableRef } from "${sdkPackageSpecifier("catalog")}";`);
|
|
22
|
+
lines.push("");
|
|
23
|
+
lines.push("export const table = tableRef({");
|
|
24
|
+
// This catalog is imported directly by generated/catalog.ts, so there is no
|
|
25
|
+
// enclosing `orgCatalog({ tables: ... })` call to stamp the bag key later.
|
|
26
|
+
lines.push(` refName: ${q(table.handle)},`);
|
|
27
|
+
lines.push(` name: ${q(table.name)},`);
|
|
28
|
+
const columns = Object.entries(table.tableColumns ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
29
|
+
if (columns.length > 0) {
|
|
30
|
+
lines.push(" columns: {");
|
|
31
|
+
for (const [key, col] of columns) {
|
|
32
|
+
// `parent` is stamped explicitly here (rather than left for a downstream
|
|
33
|
+
// barrel to fix up) so this per-table catalog file is correct even if
|
|
34
|
+
// something imports it directly instead of through the org catalog.
|
|
35
|
+
const parts = [`name: ${q(col.name)}`, `parent: ${q(table.handle)}`, `parentName: ${q(table.name)}`];
|
|
36
|
+
if (col.fieldType !== undefined)
|
|
37
|
+
parts.push(`fieldType: ${q(col.fieldType)}`);
|
|
38
|
+
if (col.tags !== undefined)
|
|
39
|
+
parts.push(`tags: ${JSON.stringify(col.tags)}`);
|
|
40
|
+
lines.push(` ${safeKey(key)}: tableColumnRef({ ${parts.join(", ")} }),`);
|
|
41
|
+
}
|
|
42
|
+
lines.push(" },");
|
|
43
|
+
}
|
|
44
|
+
const datamines = Object.entries(table.datamines ?? {}).sort(([a], [b]) => a.localeCompare(b));
|
|
45
|
+
if (datamines.length > 0) {
|
|
46
|
+
lines.push(" datamines: {");
|
|
47
|
+
for (const [key, datamine] of datamines) {
|
|
48
|
+
lines.push(` ${safeKey(key)}: datamineRef({ name: ${q(datamine.name)}, parent: ${q(table.handle)}, parentName: ${q(table.name)} }),`);
|
|
49
|
+
}
|
|
50
|
+
lines.push(" },");
|
|
51
|
+
}
|
|
52
|
+
if (table.categoryId !== undefined)
|
|
53
|
+
lines.push(` categoryId: ${q(table.categoryId)},`);
|
|
54
|
+
lines.push("});");
|
|
55
|
+
lines.push("");
|
|
56
|
+
lines.push("export default table;");
|
|
57
|
+
lines.push("");
|
|
58
|
+
return lines.join("\n");
|
|
59
|
+
}
|
|
60
|
+
export async function writeTableCatalog(orgRoot, table) {
|
|
61
|
+
const generatedDir = join(orgRoot, "tables", table.handle, "generated");
|
|
62
|
+
const catalogPath = join(generatedDir, "catalog.ts");
|
|
63
|
+
await mkdir(generatedDir, { recursive: true });
|
|
64
|
+
await writeFile(catalogPath, renderTableCatalog(table), "utf8");
|
|
65
|
+
return { catalogPath };
|
|
66
|
+
}
|
|
@@ -13,7 +13,8 @@ export const tableModule = {
|
|
|
13
13
|
stream: { role: "streamRoot", exportVerb: "tables" },
|
|
14
14
|
authoring: { unit: "ownFile", bag: "tables" },
|
|
15
15
|
parents: [{ parent: "org", child: "table" }],
|
|
16
|
-
|
|
16
|
+
// The platform's Table type has no description, icon or color to read back.
|
|
17
|
+
resource: { shape: "single", resourceType: TABLE_RESOURCE_TYPE, adoptable: true, unreadableAttributes: ["description", "icon", "color"] },
|
|
17
18
|
// Cross-table relationships already emit name-keyed data lookups through
|
|
18
19
|
// OrgRefLookup.rawLookup; register that real build surface in the graph.
|
|
19
20
|
data: { participates: true, resourceType: "elementum_table", lookupAttr: "name", referencedByBuild: true, referenceLookups: [{ strategy: "rootName" }] },
|
|
@@ -5,7 +5,7 @@ import { CATEGORY_ORG_BAG } from "../org/category.js";
|
|
|
5
5
|
import { categoryIdExpr, missingCategoryDiagnostic } from "../org/category-ref.js";
|
|
6
6
|
import { CLOUD_LINK_ORG_BAG } from "../org/cloud-link.js";
|
|
7
7
|
import { tableDataminesToTf, } from "../datamine/to-tf.js";
|
|
8
|
-
import { fieldRefToTfValue } from "../field/to-tf.js";
|
|
8
|
+
import { authoredFieldKeysFromPayload, fieldRefToTfValue } from "../field/to-tf.js";
|
|
9
9
|
import { foreignFieldDataLabel, resolveForeignRef } from "../shared/foreign-ref.js";
|
|
10
10
|
import { filterToTf as serializeFilterToTf } from "../shared/filters/tf-codec.js";
|
|
11
11
|
import { TABLE_RESOURCE_TYPE } from "./module.js";
|
|
@@ -91,7 +91,7 @@ function fieldId(value, orgRefs, ownRef, ownLabel, ownColumnNames, workspaceAspe
|
|
|
91
91
|
if (local !== undefined &&
|
|
92
92
|
ref.fieldType !== undefined &&
|
|
93
93
|
ref.refName !== undefined) {
|
|
94
|
-
const resolved = fieldRefToTfValue(ref.fieldType, ref.refName, local.tfLabel, kind);
|
|
94
|
+
const resolved = fieldRefToTfValue(ref.fieldType, ref.refName, local.tfLabel, kind, authoredFieldKeysFromPayload(local.streamRootEntity?.payload));
|
|
95
95
|
if (resolved !== undefined)
|
|
96
96
|
return resolved;
|
|
97
97
|
}
|
|
@@ -1,19 +1,44 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pull:
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
2
|
+
* Pull: blocks layouts → normalized values the printer turns back into source.
|
|
3
|
+
* `elementum_agent_view.layout` → `agentViews.<key>.layout`;
|
|
4
|
+
* `elementum_custom_view.layout` → `customViews.<key>.layout` (see
|
|
5
|
+
* `viewBlocksFromTf`). References become typed markers at the per-block id
|
|
6
|
+
* positions, inside nested filters and inside actions; raw platform ids there
|
|
7
|
+
* become `unsafePlatformId(...)`. A layout this cannot represent makes the
|
|
8
|
+
* whole view unmanaged (skipped), never silently dropped: the code owns the
|
|
9
|
+
* layout, so a dropped detail would be cleared on the next apply.
|
|
8
10
|
*/
|
|
9
11
|
import { type TfValue } from "../../engine/tf/index.js";
|
|
10
|
-
/**
|
|
12
|
+
/** Another app or element a pulled blocks layout references, by its pulled catalog identity. */
|
|
13
|
+
export interface ViewBlocksSourceMarker {
|
|
14
|
+
readonly __specRef: "source";
|
|
15
|
+
readonly kind: "app" | "element";
|
|
16
|
+
readonly key: string;
|
|
17
|
+
readonly name: string;
|
|
18
|
+
readonly namespace?: string;
|
|
19
|
+
}
|
|
20
|
+
/** A field of another app or element a pulled blocks layout references. */
|
|
21
|
+
export interface ViewBlocksForeignFieldMarker {
|
|
22
|
+
readonly __specRef: "foreignField";
|
|
23
|
+
readonly key: string;
|
|
24
|
+
readonly name: string;
|
|
25
|
+
readonly fieldType: string;
|
|
26
|
+
readonly parent: string;
|
|
27
|
+
readonly parentKind: "app" | "element";
|
|
28
|
+
readonly parentName: string;
|
|
29
|
+
readonly parentNamespace?: string;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* A typed reference inside a pulled blocks layout. `app` is the view's owner
|
|
33
|
+
* (an app or an element) and `field` one of its fields; `source` and
|
|
34
|
+
* `foreignField` are other apps and elements and their fields.
|
|
35
|
+
*/
|
|
11
36
|
export type AgentViewSpecMarker = {
|
|
12
37
|
readonly __specRef: "app";
|
|
13
38
|
} | {
|
|
14
39
|
readonly __specRef: "field";
|
|
15
40
|
readonly key: string;
|
|
16
|
-
} | {
|
|
41
|
+
} | ViewBlocksSourceMarker | ViewBlocksForeignFieldMarker | {
|
|
17
42
|
readonly __specRef: "unsafe";
|
|
18
43
|
readonly id: string;
|
|
19
44
|
};
|
|
@@ -32,10 +57,14 @@ export interface NormalizedAgentViewLayout {
|
|
|
32
57
|
readonly customView?: unknown;
|
|
33
58
|
}
|
|
34
59
|
export interface AgentViewLayoutFromTfOptions {
|
|
35
|
-
/** True when the value references the
|
|
60
|
+
/** True when the value references the view's owner (`elementum_app.<owner>.id` or `elementum_element.<owner>.id`). */
|
|
36
61
|
readonly isOwnApp: (value: TfValue) => boolean;
|
|
37
62
|
/** Resolves a field reference to its bag key, a system field key, or a raw id. */
|
|
38
63
|
readonly fieldKey: (value: TfValue) => string | undefined;
|
|
64
|
+
/** Resolves another app's or element's data lookup. */
|
|
65
|
+
readonly foreignSource?: (value: TfValue) => ViewBlocksSourceMarker | undefined;
|
|
66
|
+
/** Resolves the data lookup of another app's or element's field. */
|
|
67
|
+
readonly foreignField?: (value: TfValue) => ViewBlocksForeignFieldMarker | undefined;
|
|
39
68
|
}
|
|
40
69
|
export type AgentViewLayoutFromTfResult = {
|
|
41
70
|
readonly ok: true;
|
|
@@ -45,5 +74,16 @@ export type AgentViewLayoutFromTfResult = {
|
|
|
45
74
|
readonly reason: string;
|
|
46
75
|
};
|
|
47
76
|
export declare function agentViewLayoutFromTf(value: TfValue, opts: AgentViewLayoutFromTfOptions): AgentViewLayoutFromTfResult;
|
|
77
|
+
export type ViewBlocksFromTfResult = {
|
|
78
|
+
readonly ok: true;
|
|
79
|
+
readonly layout: unknown;
|
|
80
|
+
} | {
|
|
81
|
+
readonly ok: false;
|
|
82
|
+
readonly reason: string;
|
|
83
|
+
};
|
|
84
|
+
/** A blocks layout (the value inside `jsonencode(...)`) → plain JSON with `AgentViewSpecMarker` objects at reference positions. */
|
|
85
|
+
export declare function viewBlocksFromTf(value: TfValue, opts: AgentViewLayoutFromTfOptions): ViewBlocksFromTfResult;
|
|
48
86
|
/** Own-app field bag keys a pulled layout references (for hoisting their consts). */
|
|
49
87
|
export declare function collectAgentViewLayoutFieldKeys(layout: NormalizedAgentViewLayout | undefined): string[];
|
|
88
|
+
/** Own field bag keys a pulled blocks layout references (for hoisting their consts). */
|
|
89
|
+
export declare function collectViewBlocksFieldKeys(layout: unknown): string[];
|