@elementumai/edk 0.9.15 → 0.9.16
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/dist-sdk/pull/util.d.ts +0 -15
- package/dist-sdk/pull/util.js +44 -5
- package/dist-sdk/src/engine/build/context.d.ts +2 -2
- package/dist-sdk/src/engine/progress.d.ts +4 -0
- package/dist-sdk/src/engine/progress.js +16 -4
- package/dist-sdk/src/engine/pull/context.d.ts +5 -0
- package/dist-sdk/src/engine/pull/ref-only.d.ts +4 -0
- package/dist-sdk/src/engine/pull/ref-only.js +11 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/access-policy/from-tf.js +47 -12
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +5 -3
- package/dist-sdk/src/entities/access-policy/to-tf.js +23 -1
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +27 -2
- package/dist-sdk/src/entities/agent/from-tf.d.ts +1 -0
- package/dist-sdk/src/entities/agent/from-tf.js +18 -3
- package/dist-sdk/src/entities/agent/to-tf.js +14 -0
- package/dist-sdk/src/entities/agent/tools.d.ts +79 -2
- package/dist-sdk/src/entities/agent/tools.js +2 -1
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +11 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.js +45 -3
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +7 -0
- package/dist-sdk/src/entities/agent-tool/to-tf.js +72 -20
- package/dist-sdk/src/entities/app/module.js +8 -0
- package/dist-sdk/src/entities/app/to-tf.js +1 -0
- package/dist-sdk/src/entities/automation/build.d.ts +12 -5
- package/dist-sdk/src/entities/automation/build.js +30 -11
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +4 -0
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +108 -23
- package/dist-sdk/src/entities/automation/from-tf.d.ts +73 -5
- package/dist-sdk/src/entities/automation/from-tf.js +255 -30
- package/dist-sdk/src/entities/automation/index.d.ts +2 -1
- package/dist-sdk/src/entities/automation/index.js +2 -1
- package/dist-sdk/src/entities/automation/module.js +6 -7
- package/dist-sdk/src/entities/automation/output-field-types.d.ts +5 -0
- package/dist-sdk/src/entities/automation/output-field-types.js +12 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +20 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +22 -0
- package/dist-sdk/src/entities/automation/script-code.js +13 -4
- package/dist-sdk/src/entities/automation/tasks.d.ts +41 -5
- package/dist-sdk/src/entities/automation/tasks.js +31 -9
- package/dist-sdk/src/entities/automation/to-tf.d.ts +0 -2
- package/dist-sdk/src/entities/automation/to-tf.js +85 -36
- package/dist-sdk/src/entities/automation/triggers.d.ts +5 -2
- package/dist-sdk/src/entities/automation/types.d.ts +2 -0
- package/dist-sdk/src/entities/automation/types.js +5 -0
- package/dist-sdk/src/entities/automation/workflow-output.d.ts +35 -0
- package/dist-sdk/src/entities/automation/workflow-output.js +53 -0
- package/dist-sdk/src/entities/dashboard/from-tf.js +1 -1
- package/dist-sdk/src/entities/dashboard/to-tf.js +1 -0
- package/dist-sdk/src/entities/element/build.d.ts +11 -8
- package/dist-sdk/src/entities/element/build.js +14 -5
- package/dist-sdk/src/entities/element/locals.d.ts +2 -2
- package/dist-sdk/src/entities/element/locals.js +6 -2
- package/dist-sdk/src/entities/element/system-fields.d.ts +4 -0
- package/dist-sdk/src/entities/element/system-fields.js +12 -0
- package/dist-sdk/src/entities/element/to-tf.js +1 -0
- package/dist-sdk/src/entities/field/from-tf.js +47 -1
- package/dist-sdk/src/entities/relationship/from-tf.js +2 -2
- package/dist-sdk/src/entities/relationship/to-tf.js +1 -0
- package/dist-sdk/src/entities/search-table/from-tf.js +6 -6
- package/dist-sdk/src/entities/search-table/module.js +2 -2
- package/dist-sdk/src/entities/search-table/types.d.ts +1 -0
- package/dist-sdk/src/entities/search-table/types.js +1 -0
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +2 -0
- package/dist-sdk/src/entities/shared/filters/index.d.ts +12 -2
- package/dist-sdk/src/entities/shared/filters/index.js +17 -1
- package/dist-sdk/src/entities/shared/filters/print.js +25 -11
- package/dist-sdk/src/entities/shared/filters/tf-codec.d.ts +1 -1
- package/dist-sdk/src/entities/shared/filters/tf-codec.js +39 -7
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +18 -2
- package/dist-sdk/src/entities/skill/module.js +9 -0
- package/dist-sdk/src/entities/skill/to-tf.js +18 -0
- package/dist-sdk/src/entities/skill/tools.d.ts +18 -4
- package/dist-sdk/src/entities/skill/tools.js +1 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +12 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.js +58 -3
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +6 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +78 -43
- package/dist-sdk/src/entities/view/from-tf.js +30 -9
- package/dist-sdk/src/entities/view/to-tf.js +18 -10
- package/dist-sdk/src/entities/widget/from-tf.js +1 -1
- package/dist-sdk/src/entities/widget/to-tf.js +1 -0
- package/dist-sdk/src/graph/index.d.ts +13 -0
- package/dist-sdk/src/graph/index.js +5 -0
- package/dist-sdk/src/graph/types.d.ts +10 -0
- package/package.json +2 -1
package/dist-sdk/pull/util.d.ts
CHANGED
|
@@ -48,21 +48,6 @@ export declare function stripType(props: {
|
|
|
48
48
|
* decide what fallback to use (e.g. `"item1"`).
|
|
49
49
|
*/
|
|
50
50
|
export declare function camelCase(input: string): string;
|
|
51
|
-
/**
|
|
52
|
-
* Mobius's `ValueReference.ofTriggerReference` canonicalizes onDemand
|
|
53
|
-
* parameter reference names so the UI picker can resolve them:
|
|
54
|
-
* - all alphanumeric → first char lowercased (`amountUsd` stays
|
|
55
|
-
* `amountUsd`, `AmountUsd` → `amountUsd`)
|
|
56
|
-
* - contains non-alnum char → camelCase via {@link camelCase}
|
|
57
|
-
* (`amount_usd` → `amountUsd`,
|
|
58
|
-
* `has receipt` → `hasReceipt`)
|
|
59
|
-
*
|
|
60
|
-
* Lives here (not in the serializer) because both sides of the wire
|
|
61
|
-
* need it: the serializer applies it on-write so saved triggerReference
|
|
62
|
-
* names match the picker's canonical form, and the deserializer
|
|
63
|
-
* applies it on-read to map wire reference names back to the source's
|
|
64
|
-
* declared parameter names.
|
|
65
|
-
*/
|
|
66
51
|
export declare function normalizeOnDemandParamKey(name: string): string;
|
|
67
52
|
/**
|
|
68
53
|
* Pair each item with a unique camelCase key derived from
|
package/dist-sdk/pull/util.js
CHANGED
|
@@ -74,9 +74,21 @@ export function camelCase(input) {
|
|
|
74
74
|
* parameter reference names so the UI picker can resolve them:
|
|
75
75
|
* - all alphanumeric → first char lowercased (`amountUsd` stays
|
|
76
76
|
* `amountUsd`, `AmountUsd` → `amountUsd`)
|
|
77
|
-
* - contains non-alnum char →
|
|
77
|
+
* - contains non-alnum char → every letter lowercased, then the first
|
|
78
|
+
* letter after each separator uppercased
|
|
78
79
|
* (`amount_usd` → `amountUsd`,
|
|
79
|
-
* `has receipt` → `hasReceipt
|
|
80
|
+
* `has receipt` → `hasReceipt`,
|
|
81
|
+
* `CFF_ID` → `cffId` — NOT `cFFId`)
|
|
82
|
+
*
|
|
83
|
+
* Deliberately NOT delegated to the shared {@link camelCase} (title-cases
|
|
84
|
+
* each word's ORIGINAL casing beyond its first letter, so `CFF_ID` → `cFFId`
|
|
85
|
+
* there) - this must match the platform's exact
|
|
86
|
+
* `normalizeOnDemandFilterRefName` (provider/internal/provider/
|
|
87
|
+
* on_demand_trigger_resource.go) byte for byte, or a multi-uppercase-letter
|
|
88
|
+
* acronym parameter name (confirmed live: `CFF_ID`, `HCP_ID`, `REP_ID` on
|
|
89
|
+
* conciergeforfield/sanofi) computes a filter_refs/refs key the deployed
|
|
90
|
+
* trigger never actually has, and `tofu plan` fails with "Invalid index"
|
|
91
|
+
* on every filter/task referencing it.
|
|
80
92
|
*
|
|
81
93
|
* Lives here (not in the serializer) because both sides of the wire
|
|
82
94
|
* need it: the serializer applies it on-write so saved triggerReference
|
|
@@ -84,13 +96,40 @@ export function camelCase(input) {
|
|
|
84
96
|
* applies it on-read to map wire reference names back to the source's
|
|
85
97
|
* declared parameter names.
|
|
86
98
|
*/
|
|
99
|
+
function toSimpleLower(ch) {
|
|
100
|
+
if (ch === "İ")
|
|
101
|
+
return "i";
|
|
102
|
+
const lower = ch.toLowerCase();
|
|
103
|
+
return [...lower].length === 1 ? lower : ch;
|
|
104
|
+
}
|
|
105
|
+
function toSimpleUpper(ch) {
|
|
106
|
+
const upper = ch.toUpperCase();
|
|
107
|
+
return [...upper].length === 1 ? upper : ch;
|
|
108
|
+
}
|
|
87
109
|
export function normalizeOnDemandParamKey(name) {
|
|
88
110
|
if (!name)
|
|
89
111
|
return "";
|
|
90
|
-
|
|
91
|
-
|
|
112
|
+
// Unicode letter/decimal digit, matching Go's unicode.IsLetter/IsDigit - plain
|
|
113
|
+
// [A-Za-z0-9] treats non-ASCII letters as separators (dropping 'Ä' to produce
|
|
114
|
+
// "BcId" instead of "äbcId"), while \p{N} is too broad (treating non-decimal
|
|
115
|
+
// numbers like Roman numerals or fractions as alnum, which Go separates).
|
|
116
|
+
const chars = [...name];
|
|
117
|
+
const hasSeparator = chars.some((ch) => !/[\p{L}\p{Nd}]/u.test(ch));
|
|
118
|
+
if (!hasSeparator) {
|
|
119
|
+
return toSimpleLower(chars[0]) + chars.slice(1).join("");
|
|
120
|
+
}
|
|
121
|
+
let result = "";
|
|
122
|
+
let nextIsUpper = false;
|
|
123
|
+
for (const ch of chars) {
|
|
124
|
+
if (/[\p{L}\p{Nd}]/u.test(ch)) {
|
|
125
|
+
result += nextIsUpper ? toSimpleUpper(ch) : toSimpleLower(ch);
|
|
126
|
+
nextIsUpper = false;
|
|
127
|
+
}
|
|
128
|
+
else {
|
|
129
|
+
nextIsUpper = true;
|
|
130
|
+
}
|
|
92
131
|
}
|
|
93
|
-
return
|
|
132
|
+
return result;
|
|
94
133
|
}
|
|
95
134
|
/**
|
|
96
135
|
* Pair each item with a unique camelCase key derived from
|
|
@@ -90,8 +90,8 @@ export interface WorkspaceAspect {
|
|
|
90
90
|
readonly tfLabel: string;
|
|
91
91
|
/** Loaded stream root, available to entity-owned cross-stream resolvers. */
|
|
92
92
|
readonly streamRootEntity?: DeployableEntity;
|
|
93
|
-
/** ACTIVE authored automations owned by this root
|
|
94
|
-
readonly
|
|
93
|
+
/** Source refNames of ACTIVE authored automations owned by this root. */
|
|
94
|
+
readonly activeAutomationRefNames?: ReadonlySet<string>;
|
|
95
95
|
/** Sole on-demand record parameter targeting this same owner, keyed by automation refName, for CURRENT_RECORD widget binding. */
|
|
96
96
|
readonly onDemandRecordParamByAutomationRefName?: ReadonlyMap<string, string>;
|
|
97
97
|
/** Terraform labels of datamines managed by a table in this workspace. */
|
|
@@ -51,6 +51,8 @@ export interface LiveProgressOptions {
|
|
|
51
51
|
readonly intervalMs?: number;
|
|
52
52
|
/** Optional stable upper bound for the status label, excluding progress suffixes. */
|
|
53
53
|
readonly maxLabelLength?: number;
|
|
54
|
+
/** Optional fixed visible width reserved for the status label. */
|
|
55
|
+
readonly labelWidth?: number;
|
|
54
56
|
/** Preserve the current counter when a label-only update changes phase. */
|
|
55
57
|
readonly retainCountOnLabelChange?: boolean;
|
|
56
58
|
/** Keep label changes as durable lines; useful for pull stage history. */
|
|
@@ -67,6 +69,7 @@ export declare class LiveProgress {
|
|
|
67
69
|
private total?;
|
|
68
70
|
private readonly intervalMs;
|
|
69
71
|
private readonly maxLabelLength?;
|
|
72
|
+
private readonly labelWidth?;
|
|
70
73
|
private readonly retainCountOnLabelChange;
|
|
71
74
|
private readonly persistLabelChanges;
|
|
72
75
|
private label;
|
|
@@ -112,6 +115,7 @@ export declare class LiveProgress {
|
|
|
112
115
|
private detachTerminationHandlers;
|
|
113
116
|
private render;
|
|
114
117
|
private currentStatusRendered;
|
|
118
|
+
private fixedLabelWidth;
|
|
115
119
|
private bar;
|
|
116
120
|
/** Single terminal writer. Priority 0 is protocol/log output; priority 1 is animation. */
|
|
117
121
|
private enqueue;
|
|
@@ -159,6 +159,7 @@ export class LiveProgress {
|
|
|
159
159
|
total;
|
|
160
160
|
intervalMs;
|
|
161
161
|
maxLabelLength;
|
|
162
|
+
labelWidth;
|
|
162
163
|
retainCountOnLabelChange;
|
|
163
164
|
persistLabelChanges;
|
|
164
165
|
label;
|
|
@@ -193,6 +194,7 @@ export class LiveProgress {
|
|
|
193
194
|
};
|
|
194
195
|
constructor(options) {
|
|
195
196
|
this.maxLabelLength = options.maxLabelLength;
|
|
197
|
+
this.labelWidth = options.labelWidth;
|
|
196
198
|
this.retainCountOnLabelChange = options.retainCountOnLabelChange ?? false;
|
|
197
199
|
this.label = truncateLabel(options.label, this.maxLabelLength);
|
|
198
200
|
this.total = options.total;
|
|
@@ -421,15 +423,22 @@ export class LiveProgress {
|
|
|
421
423
|
if (this.total === undefined) {
|
|
422
424
|
const elapsed = formatElapsed(Date.now() - this.startedAt);
|
|
423
425
|
const suffix = elapsed === "" ? "" : ` ${applyEffect(elapsed, { start: 0, end: elapsed.length, dim: true })}`;
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
+
const availableLabelWidth = Math.max(0, columns - 2 - visibleWidth(suffix));
|
|
427
|
+
const labelWidth = this.fixedLabelWidth(availableLabelWidth);
|
|
428
|
+
const label = renderFittedText(this.label, this.textEffects, labelWidth ?? availableLabelWidth);
|
|
429
|
+
return `${spinner} ${labelWidth === undefined ? label : padRenderedLabel(label, labelWidth)}${suffix}`;
|
|
426
430
|
}
|
|
427
431
|
let barWidth = 20;
|
|
428
432
|
const fixedWidth = 2 + 1 + String(this.value).length + 1 + String(this.total).length + 1 + 2;
|
|
429
433
|
barWidth = Math.max(4, Math.min(20, columns - fixedWidth - 2));
|
|
430
434
|
const suffix = ` ${this.value}/${this.total} ${this.bar(barWidth)}`;
|
|
431
|
-
const
|
|
432
|
-
|
|
435
|
+
const availableLabelWidth = Math.max(0, columns - 2 - visibleWidth(suffix));
|
|
436
|
+
const labelWidth = this.fixedLabelWidth(availableLabelWidth);
|
|
437
|
+
const label = renderFittedText(this.label, this.textEffects, labelWidth ?? availableLabelWidth);
|
|
438
|
+
return `${spinner} ${labelWidth === undefined ? label : padRenderedLabel(label, labelWidth)}${suffix}`;
|
|
439
|
+
}
|
|
440
|
+
fixedLabelWidth(available) {
|
|
441
|
+
return this.labelWidth === undefined ? undefined : Math.min(this.labelWidth, available);
|
|
433
442
|
}
|
|
434
443
|
bar(width = 20) {
|
|
435
444
|
const total = this.total ?? 0;
|
|
@@ -573,6 +582,9 @@ function renderFittedText(text, effects, maxWidth) {
|
|
|
573
582
|
.map((effect) => ({ ...effect, start: Math.min(effect.start, end), end: Math.min(effect.end, end) }));
|
|
574
583
|
return `${renderTextEffects(text.slice(0, end), clippedEffects)}${suffix}`;
|
|
575
584
|
}
|
|
585
|
+
function padRenderedLabel(text, width) {
|
|
586
|
+
return text + " ".repeat(Math.max(0, width - visibleWidth(text)));
|
|
587
|
+
}
|
|
576
588
|
function truncateLabel(label, maxLength) {
|
|
577
589
|
if (maxLength === undefined || label.length <= maxLength)
|
|
578
590
|
return label;
|
|
@@ -36,6 +36,11 @@ export interface FromTfContext {
|
|
|
36
36
|
* reference then stays unresolvable, same as before this existed).
|
|
37
37
|
*/
|
|
38
38
|
readonly foreignAppRefNames?: ReadonlyMap<string, string>;
|
|
39
|
+
/** Owner display name + skill display name → materialized catalog skill ref. */
|
|
40
|
+
readonly foreignSkillRefsByOwnerName?: ReadonlyMap<string, {
|
|
41
|
+
readonly appRefName: string;
|
|
42
|
+
readonly skillRefName: string;
|
|
43
|
+
}>;
|
|
39
44
|
readonly foreignElementRefNames?: ReadonlyMap<string, string>;
|
|
40
45
|
readonly foreignTaskRefNames?: ReadonlyMap<string, string>;
|
|
41
46
|
/** Imported platform field id -> typed owner/key, assembled by the recursive pull workspace context. */
|
|
@@ -29,6 +29,10 @@ export interface DirectReferenceRoot {
|
|
|
29
29
|
readonly name: string;
|
|
30
30
|
}[];
|
|
31
31
|
}[];
|
|
32
|
+
readonly skills?: readonly {
|
|
33
|
+
readonly refName: string;
|
|
34
|
+
readonly name: string;
|
|
35
|
+
}[];
|
|
32
36
|
}
|
|
33
37
|
export type UnresolvedReference = UnresolvedReferenceDiagnostic;
|
|
34
38
|
/** Format the diagnostic suffix printed beside an existing `unsafePlatformId(...)` call. */
|
|
@@ -113,6 +113,16 @@ function parseRoot(payload) {
|
|
|
113
113
|
outputs,
|
|
114
114
|
}];
|
|
115
115
|
});
|
|
116
|
+
const skills = (Array.isArray(obj.skills) ? obj.skills : []).flatMap((rawSkill) => {
|
|
117
|
+
const skill = record(rawSkill);
|
|
118
|
+
if (skill === undefined)
|
|
119
|
+
return [];
|
|
120
|
+
const skillName = stringAt(skill, "name");
|
|
121
|
+
const skillRefName = stringAt(skill, "refName");
|
|
122
|
+
return skillName === undefined || skillRefName === undefined
|
|
123
|
+
? []
|
|
124
|
+
: [{ refName: tfLabelToTsLabel(skillRefName), name: skillName }];
|
|
125
|
+
});
|
|
116
126
|
return {
|
|
117
127
|
kind,
|
|
118
128
|
refName: tfLabelToTsLabel(wireRefName),
|
|
@@ -122,6 +132,7 @@ function parseRoot(payload) {
|
|
|
122
132
|
columns,
|
|
123
133
|
datamines,
|
|
124
134
|
automations,
|
|
135
|
+
skills,
|
|
125
136
|
};
|
|
126
137
|
}
|
|
127
138
|
function parseUnresolved(payload) {
|
|
@@ -36,7 +36,7 @@ export interface NormalizedAccessPolicy {
|
|
|
36
36
|
readonly serviceAccountIds?: readonly AccessPolicyServiceAccountRef[];
|
|
37
37
|
}
|
|
38
38
|
/** Decode one `filter` attribute through the shared exhaustive codec. */
|
|
39
|
-
export declare function filterFromTf(value: TfValue, owner: AccessPolicyOwner, where: string): Filter<RefExpr, RefExpr>;
|
|
39
|
+
export declare function filterFromTf(value: TfValue, owner: AccessPolicyOwner, where: string, ctx?: FromTfContext): Filter<RefExpr, RefExpr>;
|
|
40
40
|
export declare function principalList(value: TfValue | undefined, dataType: "elementum_user", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyUserRef[] | undefined;
|
|
41
41
|
export declare function principalList(value: TfValue | undefined, dataType: "elementum_group", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyGroupRef[] | undefined;
|
|
42
42
|
export declare function principalList(value: TfValue | undefined, dataType: "elementum_service_account", where: string, ctx: FromTfContext, owner?: AccessPolicyOwner): AccessPolicyServiceAccountRef[] | undefined;
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { EntityTfError } from "../../engine/entity.js";
|
|
14
14
|
import { dataRefLabel, resourceRefLabel } from "../../engine/pull/context.js";
|
|
15
|
-
import { appResourceLabelPrefix, elementResourceLabelPrefix, isTfExpr, scopedLabelToBagKey, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
15
|
+
import { appResourceLabelPrefix, elementResourceLabelPrefix, isTfExpr, scopedLabelToBagKey, scopedResourceLabel, tfLabelToTsLabel, } from "../../engine/tf/index.js";
|
|
16
16
|
import { filterFromTf as deserializeFilterFromTf } from "../shared/filters/tf-codec.js";
|
|
17
17
|
import { groupId, userId, } from "./principal.js";
|
|
18
18
|
import { KNOWN_ACCESS_POLICY_ATTRS } from "./types.js";
|
|
@@ -59,23 +59,58 @@ function fieldRef(value, owner, where) {
|
|
|
59
59
|
* collapse it back to its readable label, mirroring automation's own
|
|
60
60
|
* `picklistOptionLabel`.
|
|
61
61
|
*/
|
|
62
|
-
function picklistOptionLabel(value) {
|
|
63
|
-
if (value === undefined || !isTfExpr(value)
|
|
62
|
+
function picklistOptionLabel(value, owner) {
|
|
63
|
+
if (value === undefined || !isTfExpr(value))
|
|
64
64
|
return undefined;
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
// Locals are keyed by the Terraform resource label, like stage_ids_by_key,
|
|
66
|
+
// even when the caller's ownerTfLabel carries the public camelCase refName.
|
|
67
|
+
// A foreign label must not become this owner's option.
|
|
68
|
+
const ownedLocal = value.$expr === "local" && (value.name.startsWith(scopedResourceLabel(owner.label, "", owner.scope)) ||
|
|
69
|
+
["stage", "status"].some((field) => ["options_by_label", "option_ids_by_label"].some((suffix) => value.name === `${owner.label}_${field}_${suffix}`)));
|
|
70
|
+
const lookup = value.$expr === "local" && ownedLocal && value.path.length === 1 ? value.name
|
|
71
|
+
: value.$expr === "resource-attr" && value.type === owner.type && value.label === owner.label && value.path.length === 2 && typeof value.path[0] === "string" ? value.path[0] : undefined;
|
|
72
|
+
const segment = value.$expr === "local" ? value.path[0] : value.$expr === "resource-attr" ? value.path[1] : undefined;
|
|
73
|
+
const isOptionsLookup = lookup?.endsWith("_options_by_label") === true || lookup?.endsWith("_option_ids_by_label") === true;
|
|
67
74
|
return isOptionsLookup && typeof segment === "object" && segment !== null && "index" in segment && typeof segment.index === "string"
|
|
68
75
|
? segment.index
|
|
69
76
|
: undefined;
|
|
70
77
|
}
|
|
71
78
|
/** Decode one `filter` attribute through the shared exhaustive codec. */
|
|
72
|
-
export function filterFromTf(value, owner, where) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
79
|
+
export function filterFromTf(value, owner, where, ctx) {
|
|
80
|
+
try {
|
|
81
|
+
return deserializeFilterFromTf(value, {
|
|
82
|
+
field: (fieldValue) => fieldRef(fieldValue, owner, where),
|
|
83
|
+
reference: () => { throw new EntityTfError(`${where}: access-policy reference values are not supported`); },
|
|
84
|
+
literal: (literal) => picklistOptionLabel(literal, owner) ?? stageName(literal, owner, ctx) ?? literal,
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
catch (error) {
|
|
88
|
+
if (error instanceof EntityTfError && !error.message.startsWith(where)) {
|
|
89
|
+
throw new EntityTfError(`${where}: ${error.message}`);
|
|
90
|
+
}
|
|
91
|
+
throw error;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
/** Stage IDs use keys, unlike option lookups whose index is already a label. */
|
|
95
|
+
function stageName(value, owner, ctx) {
|
|
96
|
+
if (!isTfExpr(value) || value.$expr !== "local" || value.name !== `${owner.label}_stage_ids_by_key` || value.path.length !== 1)
|
|
97
|
+
return undefined;
|
|
98
|
+
const index = value.path[0];
|
|
99
|
+
if (typeof index !== "object" || index === null || !("index" in index) || typeof index.index !== "string")
|
|
100
|
+
return undefined;
|
|
101
|
+
const stages = ctx?.resourceByAddress?.(`${owner.type}.${owner.label}`)?.attrs["stages"];
|
|
102
|
+
if (!Array.isArray(stages))
|
|
103
|
+
return undefined;
|
|
104
|
+
const entries = stages.flatMap((stage) => {
|
|
105
|
+
if (stage === null || typeof stage !== "object" || Array.isArray(stage) || isTfExpr(stage))
|
|
106
|
+
return [];
|
|
107
|
+
return typeof stage["key"] === "string" && typeof stage["name"] === "string" ? [{ key: stage["key"], name: stage["name"] }] : [];
|
|
77
108
|
});
|
|
78
|
-
|
|
109
|
+
const matches = entries.filter((stage) => stage.key === index.index);
|
|
110
|
+
const name = matches.length === 1 ? matches[0]?.name : undefined;
|
|
111
|
+
// Public option selections resolve by name. Do not turn a unique key into
|
|
112
|
+
// an ambiguous selection when two stage names are identical.
|
|
113
|
+
return name !== undefined && entries.filter((stage) => stage.name === name).length === 1 ? name : undefined;
|
|
79
114
|
}
|
|
80
115
|
function principalListItem(item, dataType, where, ctx, owner) {
|
|
81
116
|
const label = dataRefLabel(item, dataType);
|
|
@@ -154,7 +189,7 @@ export function accessPolicyFromTf(block, owner, ctx) {
|
|
|
154
189
|
const filterOwner = owner.foreignFieldRefsById !== undefined
|
|
155
190
|
? owner
|
|
156
191
|
: { ...owner, foreignFieldRefsById: ctx.foreignFieldRefsById };
|
|
157
|
-
const filter = attrs["filter"] !== undefined ? filterFromTf(attrs["filter"], filterOwner, where) : { type: "TRUE" };
|
|
192
|
+
const filter = attrs["filter"] !== undefined ? filterFromTf(attrs["filter"], filterOwner, where, ctx) : { type: "TRUE" };
|
|
158
193
|
const userIds = principalList(attrs["user_ids"], "elementum_user", `${where}: user_ids`, ctx);
|
|
159
194
|
const groupIds = principalList(attrs["group_ids"], "elementum_group", `${where}: group_ids`, ctx);
|
|
160
195
|
const serviceAccountIds = principalList(attrs["service_account_ids"], "elementum_service_account", `${where}: service_account_ids`, ctx, owner);
|
|
@@ -24,6 +24,8 @@ import type { AppServiceAccount } from "../service-account/build.js";
|
|
|
24
24
|
import type { AccessPolicyGroupRef, AccessPolicyServiceAccountRef, AccessPolicyUserRef } from "./principal.js";
|
|
25
25
|
export interface AccessPolicyToTfContext {
|
|
26
26
|
readonly ownerTfLabel: string;
|
|
27
|
+
/** App or element refName used to verify filter-field ownership. */
|
|
28
|
+
readonly ownerRefName?: string;
|
|
27
29
|
readonly scope: ChildResourceScope;
|
|
28
30
|
/** The owner's id reference, e.g. `elementum_app.<ns>.id` — computed by the owner's to-tf. */
|
|
29
31
|
readonly objectId: TfValue;
|
|
@@ -56,9 +58,9 @@ export interface AccessPolicyToTfContext {
|
|
|
56
58
|
export interface FilterToTfContext extends Omit<AccessPolicyToTfContext, "orgRefs"> {
|
|
57
59
|
readonly orgRefs?: OrgRefLookup;
|
|
58
60
|
/**
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
*
|
|
61
|
+
* Preserve TEXT option labels on views. Resolving those labels to UUIDs
|
|
62
|
+
* plans changes to live views that still hold the label (Sanofi `submitted`).
|
|
63
|
+
* Explicit UUID selections retain their identity regardless of this flag.
|
|
62
64
|
*/
|
|
63
65
|
readonly resolvePicklistLiterals?: boolean;
|
|
64
66
|
}
|
|
@@ -55,6 +55,11 @@ function picklistLiteralToTf(literal, field, ctx) {
|
|
|
55
55
|
*/
|
|
56
56
|
export function filterToTf(f, where, ctx) {
|
|
57
57
|
return serializeFilterToTf(f, {
|
|
58
|
+
fieldFromLeftValue: (left) => {
|
|
59
|
+
if (left === null || typeof left !== "object" || !("type" in left) || left.type !== "FIELD")
|
|
60
|
+
return undefined;
|
|
61
|
+
return "value" in left ? left.value : undefined;
|
|
62
|
+
},
|
|
58
63
|
field: (field) => {
|
|
59
64
|
if (typeof field === "string" && isUuid(field))
|
|
60
65
|
return field;
|
|
@@ -65,8 +70,25 @@ export function filterToTf(f, where, ctx) {
|
|
|
65
70
|
return fieldValueToTf(field, where, ctx);
|
|
66
71
|
},
|
|
67
72
|
reference: () => { throw new EntityTfError(`${where}: access-policy filters do not support reference values`); },
|
|
68
|
-
literal: (value, field) => {
|
|
73
|
+
literal: (value, field, valueType) => {
|
|
69
74
|
if (typeof value === "string") {
|
|
75
|
+
// UUID option selections must remain identities, even on views where
|
|
76
|
+
// TEXT picklist labels intentionally stay literal (rather than IDs).
|
|
77
|
+
if (valueType === "uuid" && isFieldToken(field)) {
|
|
78
|
+
if (field.options?.includes(value)) {
|
|
79
|
+
const ownerRefName = ctx.ownerRefName ?? ctx.appRefName;
|
|
80
|
+
const sameOwner = (typeof field.parent === "string" && (field.parent === ctx.ownerTfLabel || field.parent === ownerRefName)) || field.parentNamespace === ctx.ownerTfLabel;
|
|
81
|
+
if (!sameOwner) {
|
|
82
|
+
if (!field.parent && !field.parentNamespace) {
|
|
83
|
+
throw new EntityTfError(`${where}: option selection has unresolved field ownership`);
|
|
84
|
+
}
|
|
85
|
+
throw new EntityTfError(`${where}: foreign option selections cannot use the current owner's lookup`);
|
|
86
|
+
}
|
|
87
|
+
return picklistLiteralToTf(value, field, ctx) ?? value;
|
|
88
|
+
}
|
|
89
|
+
if (field.tags?.includes("STAGE") && !isUuid(value))
|
|
90
|
+
throw new EntityTfError(`${where}: stage selection ${JSON.stringify(value)} has no declared option identity`);
|
|
91
|
+
}
|
|
70
92
|
if (ctx.resolvePicklistLiterals === false)
|
|
71
93
|
return value;
|
|
72
94
|
return picklistLiteralToTf(value, isFieldToken(field) ? field : undefined, ctx) ?? value;
|
|
@@ -110,7 +110,8 @@ export function printAgentV2(agent, opts) {
|
|
|
110
110
|
tool.searchTableFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
|
|
111
111
|
tool.returnFields?.some((field) => !searchTableFieldMatchesTarget(field.fieldId, targetOwner, opts.foreignFieldRefsById)) === true ||
|
|
112
112
|
tool.target?.kind === "unresolved" ||
|
|
113
|
-
tool.relatedTarget?.kind === "unresolved"
|
|
113
|
+
tool.relatedTarget?.kind === "unresolved" ||
|
|
114
|
+
tool.searchTableRawId !== undefined);
|
|
114
115
|
});
|
|
115
116
|
const lines = [];
|
|
116
117
|
lines.push("/**");
|
|
@@ -122,6 +123,9 @@ export function printAgentV2(agent, opts) {
|
|
|
122
123
|
lines.push("");
|
|
123
124
|
const agentImports = [...factories, "agent"];
|
|
124
125
|
lines.push(`import { ${[...new Set(agentImports)].sort().join(", ")} } from "${sdkPackageSpecifier("agents")}";`);
|
|
126
|
+
if (agent.tools.some((tool) => tool.typeKey === "searchTable" && tool.searchTableOwnerRefName !== undefined)) {
|
|
127
|
+
lines.push(`import { tableSearchTableRef } from "${sdkPackageSpecifier("catalog")}";`);
|
|
128
|
+
}
|
|
125
129
|
if (usesUnsafePlatformId)
|
|
126
130
|
lines.push(`import { unsafePlatformId } from "${sdkPackageSpecifier("core")}";`);
|
|
127
131
|
// Always needed: `connector:` is required and always a catalog.aiProviders
|
|
@@ -228,6 +232,9 @@ function printSkillRefToken(ref, appRefName, crossOrg) {
|
|
|
228
232
|
// the raw id fills both slots, same as `refName`.
|
|
229
233
|
return `{ __kind: "skill", refName: ${quote(ref.id)}, name: ${quote(ref.id)}, unresolvedId: ${quote(ref.id)} }, // TODO: this skill isn't resolvable from the export (no name, no data block) - identify it manually and replace with a real catalog.<app>.skills.<key> token`;
|
|
230
234
|
}
|
|
235
|
+
if (ref.appRefName !== undefined && ref.key !== undefined) {
|
|
236
|
+
return `catalog.${ref.appRefName}.skills${safeMember(ref.key)},`;
|
|
237
|
+
}
|
|
231
238
|
// The foreign app's catalog may not exist in this workspace — a literal
|
|
232
239
|
// token compiles and deploys; swap for a catalog token when available.
|
|
233
240
|
const todo = crossOrg
|
|
@@ -596,9 +603,27 @@ function printTool(tool, appRefName, crossOrg, foreignAppRefNames, foreignElemen
|
|
|
596
603
|
: tool.target?.kind === "foreignElement"
|
|
597
604
|
? foreignElementRefNames?.get(tool.target.name)
|
|
598
605
|
: undefined;
|
|
599
|
-
if (tool.
|
|
606
|
+
if (tool.searchTableRawId !== undefined) {
|
|
607
|
+
// The search table itself has no portable lookup at all (not even a
|
|
608
|
+
// name) - round-trip the raw platform id instead of dropping a live
|
|
609
|
+
// tool, the same unsafePlatformId() escape used for an unresolved
|
|
610
|
+
// field/target elsewhere in this printer.
|
|
611
|
+
lines.push(` table: unsafePlatformId(${quote(tool.searchTableRawId)}), // TODO: this search table has no portable lookup (no name, no local resource) - verify/replace with a real table reference if one becomes available`);
|
|
612
|
+
}
|
|
613
|
+
else if (tool.searchTableKey !== undefined) {
|
|
600
614
|
lines.push(` table: catalog.${targetRefName ?? appRefName}.searchTables${safeMember(tool.searchTableKey)},`);
|
|
601
615
|
}
|
|
616
|
+
else if (tool.searchTableOwnerRefName !== undefined) {
|
|
617
|
+
// Table-owned: the search table's owner is a standalone Table entity,
|
|
618
|
+
// not an app/element aspect - the public tableSearchTableRef() factory
|
|
619
|
+
// (same one print-skill-v2.ts already uses) stamps __variant: "table"
|
|
620
|
+
// so to-tf.ts builds a table_id-scoped data source instead of an
|
|
621
|
+
// aspect-scoped one (live-confirmed: conciergeforfield/sanofi's "HCP
|
|
622
|
+
// Lookup v2" table). Pulled TypeScript must round-trip through the
|
|
623
|
+
// public typed API, not a raw wire-shaped object literal.
|
|
624
|
+
const ownerName = tool.searchTableOwnerName ?? tool.searchTableOwnerRefName;
|
|
625
|
+
lines.push(` table: tableSearchTableRef({ name: ${quote(tool.searchTableName ?? "")}, parent: ${quote(tool.searchTableOwnerRefName)}, parentName: ${quote(ownerName)} }),`);
|
|
626
|
+
}
|
|
602
627
|
else {
|
|
603
628
|
const parent = tool.target?.kind === "self"
|
|
604
629
|
? appRefName
|
|
@@ -62,14 +62,29 @@ function parseSkillRef(item, where, ownerTfLabel, ctx) {
|
|
|
62
62
|
ctx.diagnostics.push(`${where}: references data.${SKILL_RESOURCE_TYPE}.${item.label} but the stream has no such data block; dropped`);
|
|
63
63
|
return undefined;
|
|
64
64
|
}
|
|
65
|
-
const
|
|
66
|
-
const
|
|
65
|
+
const appId = ctx.dataAttrs?.(SKILL_RESOURCE_TYPE, item.label)?.["app_id"];
|
|
66
|
+
const appDataLabel = dataRefLabel(appId, APP_RESOURCE_TYPE);
|
|
67
|
+
const appResourceLabel = resourceRefLabel(appId, APP_RESOURCE_TYPE);
|
|
68
|
+
let appName = appDataLabel === undefined ? undefined : ctx.dataName(APP_RESOURCE_TYPE, appDataLabel);
|
|
69
|
+
if (appName === undefined && appResourceLabel !== undefined) {
|
|
70
|
+
const ownerId = ctx.importId(`${APP_RESOURCE_TYPE}.${appResourceLabel}`);
|
|
71
|
+
const owner = ownerId === undefined ? undefined : ctx.importedResource?.(ownerId);
|
|
72
|
+
appName = typeof owner?.attrs["name"] === "string" ? owner.attrs["name"] : undefined;
|
|
73
|
+
}
|
|
67
74
|
if (appName === undefined) {
|
|
68
75
|
ctx.diagnostics.push(`${where}: data.${SKILL_RESOURCE_TYPE}.${item.label} has no resolvable app_id owner; dropped`);
|
|
69
76
|
return undefined;
|
|
70
77
|
}
|
|
71
78
|
const appRefName = ctx.foreignAppRefNames?.get(appName);
|
|
72
|
-
|
|
79
|
+
const catalogSkill = ctx.foreignSkillRefsByOwnerName?.get(JSON.stringify([appName, name]));
|
|
80
|
+
return {
|
|
81
|
+
kind: "foreign",
|
|
82
|
+
name,
|
|
83
|
+
appName,
|
|
84
|
+
...(catalogSkill !== undefined
|
|
85
|
+
? { appRefName: catalogSkill.appRefName, key: catalogSkill.skillRefName }
|
|
86
|
+
: appRefName !== undefined ? { appRefName } : {}),
|
|
87
|
+
};
|
|
73
88
|
}
|
|
74
89
|
// A bare UUID literal with no data block backing it at all - the platform
|
|
75
90
|
// lets skill_ids reference a skill this export can't otherwise name (e.g.
|
|
@@ -473,6 +473,20 @@ export function agentToTf(entity, ctx) {
|
|
|
473
473
|
foreignFieldRef: (t, l, o, n) => ctx.orgRefs.foreignField(t, l, o, n),
|
|
474
474
|
workspaceAspects: ctx.workspaceAspects,
|
|
475
475
|
serviceAccountRef: (_label, serviceAccountName) => serviceAccountValue(serviceAccountName, ctx),
|
|
476
|
+
tableSearchTableRef: (label, _tableRefName, tableName, searchTableName) => {
|
|
477
|
+
// sanitizeName(tableName), not tableRefName: ei labels the export
|
|
478
|
+
// from the table's DISPLAY name (SanitizeName(displayName)), and
|
|
479
|
+
// sanitizeName doesn't split a capital before a digit the way a
|
|
480
|
+
// camelCase refName needs to reverse that - "hcpLookupV2" sanitizes
|
|
481
|
+
// to "hcp_lookupv2" while ei's own label for "HCP Lookup v2" is
|
|
482
|
+
// "hcp_lookup_v2", a perpetual plan diff (review feedback, PR
|
|
483
|
+
// #1095, msivraj).
|
|
484
|
+
const tableLabel = sanitizeName(tableName);
|
|
485
|
+
const tableId = expr.dataAttr("elementum_table", tableLabel, ["id"]);
|
|
486
|
+
ctx.orgRefs.rawLookup("elementum_table", tableLabel, tableName);
|
|
487
|
+
ctx.orgRefs.rawLookup("elementum_search_table", label, searchTableName, { table_id: tableId });
|
|
488
|
+
return expr.dataAttr("elementum_search_table", label, ["id"]);
|
|
489
|
+
},
|
|
476
490
|
diagnostics: ctx.diagnostics,
|
|
477
491
|
});
|
|
478
492
|
if (tool !== undefined)
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* object. Optional `startMessage` / `runAs` are emitted only when supplied,
|
|
11
11
|
* matching the v1 serializer's field-by-field discipline.
|
|
12
12
|
*/
|
|
13
|
-
import type { AutomationCatalogRef, AgentRef, AppCatalogRef, AutomationRef, ElementCatalogRef, FieldRef, OutputPropertyRef, SearchTableRef, TaskCatalogRef, TriggerParameterRef } from "../../catalog/index.js";
|
|
13
|
+
import type { AutomationCatalogRef, AgentRef, AppCatalogRef, AutomationRef, ElementCatalogRef, FieldRef, OutputPropertyRef, SearchTableRef, TableOwnedSearchTableRef, TaskCatalogRef, TriggerParameterRef } from "../../catalog/index.js";
|
|
14
14
|
import type { UnsafePlatformId } from "../../core/platform-id.js";
|
|
15
15
|
import type { AgentToolRunAs } from "./run-as.js";
|
|
16
16
|
import type { Filter } from "../automation/filter.js";
|
|
@@ -187,12 +187,89 @@ type SearchTableFieldDialect<Target extends ElementCatalogRef> = {
|
|
|
187
187
|
readonly returnFields?: readonly AgentSearchReturnFieldInput<Target>[];
|
|
188
188
|
};
|
|
189
189
|
export type SearchTableToolV2<Target extends ElementCatalogRef = ElementCatalogRef> = CommonToolOptions & TargetOption<Target> & {
|
|
190
|
-
|
|
190
|
+
/**
|
|
191
|
+
* The search table itself, or (pull-fidelity fallback, mirroring
|
|
192
|
+
* `fieldId`/`id` elsewhere in this file) a raw platform id when the
|
|
193
|
+
* search table's own identity has no portable lookup at all - the
|
|
194
|
+
* target aspect can still resolve fine even though the search table
|
|
195
|
+
* doesn't (live-confirmed on conciergeforfield, sanofi/us).
|
|
196
|
+
*
|
|
197
|
+
* Narrowed to exclude the table-owned variant (mirrors
|
|
198
|
+
* `SkillSearchTableToolV2`) - without this, a table-owned ref (which has
|
|
199
|
+
* no aspect target on the wire) also satisfies this aspect-targeted
|
|
200
|
+
* overload, so a caller could pair it with `element`/`app` and typecheck
|
|
201
|
+
* cleanly while the built HCL silently ignores the target (review
|
|
202
|
+
* feedback, PR #1095, msivraj).
|
|
203
|
+
*/
|
|
204
|
+
readonly table: (SearchTableRef & {
|
|
205
|
+
readonly __variant?: "snowflake" | "linked";
|
|
206
|
+
}) | UnsafePlatformId;
|
|
191
207
|
readonly queryDescription: string;
|
|
192
208
|
readonly filterVariables?: readonly AgentFilterVariable[];
|
|
193
209
|
readonly filter?: Filter;
|
|
194
210
|
readonly limit?: number;
|
|
195
211
|
} & SearchTableFieldDialect<Target>;
|
|
212
|
+
/**
|
|
213
|
+
* A table-owned search table has no target aspect on the platform wire (the
|
|
214
|
+
* search table's owner is a standalone Table entity, not an app/element) -
|
|
215
|
+
* mirrors `SkillTableOwnedSearchTableToolV2`. `fields`/`returnFields` aren't
|
|
216
|
+
* modeled yet for this variant (no live-captured example carries them);
|
|
217
|
+
* add a table-column field-ref dialect here if one turns up.
|
|
218
|
+
*/
|
|
219
|
+
export type TableOwnedSearchTableToolV2 = CommonToolOptions & {
|
|
220
|
+
readonly app?: never;
|
|
221
|
+
readonly element?: never;
|
|
222
|
+
readonly table: TableOwnedSearchTableRef;
|
|
223
|
+
readonly queryDescription: string;
|
|
224
|
+
readonly filterVariables?: readonly AgentFilterVariable[];
|
|
225
|
+
readonly filter?: Filter;
|
|
226
|
+
readonly limit?: number;
|
|
227
|
+
readonly fields?: never;
|
|
228
|
+
readonly returnFields?: never;
|
|
229
|
+
};
|
|
230
|
+
/**
|
|
231
|
+
* Raw-id only, not the full `AgentSearchTableFieldInput<Target>` union -
|
|
232
|
+
* with no target aspect on the wire at all, there is no `Target` to type
|
|
233
|
+
* a real `FieldRef` against, so a pulled field here can only be the
|
|
234
|
+
* platform-id fallback (review feedback, PR #1099, jj-deloitte: the
|
|
235
|
+
* printer emits `fields`/`returnFields` for a raw-id search table tool
|
|
236
|
+
* whenever the pulled resource carries them, independent of whether the
|
|
237
|
+
* target itself also resolved - the old `fields?: never` rejected that
|
|
238
|
+
* real, printer-emitted shape and failed the pulled workspace's own
|
|
239
|
+
* typecheck). Closed either/or union, mirroring `SearchTableFieldDialect`
|
|
240
|
+
* - `fields` and `returnFields` are still mutually exclusive provider wire
|
|
241
|
+
* dialects even with no target (review feedback, PR #1099, jj-deloitte:
|
|
242
|
+
* making both independently optional let a caller supply both at once,
|
|
243
|
+
* silently making `returnFields` ineffective).
|
|
244
|
+
*/
|
|
245
|
+
type UnresolvedTargetSearchTableFieldDialect = {
|
|
246
|
+
readonly fields?: readonly AgentSearchTableRawIdField[];
|
|
247
|
+
readonly returnFields?: never;
|
|
248
|
+
} | {
|
|
249
|
+
readonly fields?: never;
|
|
250
|
+
readonly returnFields?: readonly AgentSearchRawIdReturnField[];
|
|
251
|
+
};
|
|
252
|
+
/**
|
|
253
|
+
* Neither the search table NOR the target aspect resolved to a portable
|
|
254
|
+
* reference (export couldn't recover either one) - `app`/`element` are
|
|
255
|
+
* absent from the wire entirely, not just unresolved, so unlike
|
|
256
|
+
* `SearchTableToolV2` there is no `Target` to type the overload against
|
|
257
|
+
* (review feedback, PR #1099, msivraj: the platform-id table shape with no
|
|
258
|
+
* target compiled against neither existing overload - `TableOwnedSearchTableToolV2`
|
|
259
|
+
* rejects a non-table-owned platform id, `SearchTableToolV2` requires
|
|
260
|
+
* `element`).
|
|
261
|
+
*/
|
|
262
|
+
export type UnresolvedTargetSearchTableToolV2 = CommonToolOptions & {
|
|
263
|
+
readonly app?: never;
|
|
264
|
+
readonly element?: never;
|
|
265
|
+
readonly table: UnsafePlatformId;
|
|
266
|
+
readonly queryDescription: string;
|
|
267
|
+
readonly filterVariables?: readonly AgentFilterVariable[];
|
|
268
|
+
readonly filter?: Filter;
|
|
269
|
+
readonly limit?: number;
|
|
270
|
+
} & UnresolvedTargetSearchTableFieldDialect;
|
|
271
|
+
export declare function agentSearchTable(opts: TableOwnedSearchTableToolV2): AgentTool;
|
|
272
|
+
export declare function agentSearchTable(opts: UnresolvedTargetSearchTableToolV2): AgentTool;
|
|
196
273
|
export declare function agentSearchTable<Target extends ElementCatalogRef = ElementCatalogRef>(opts: SearchTableToolV2<Target>): AgentTool;
|
|
197
274
|
export type CreateRecordToolV2<Target extends ToolTarget = ToolTarget> = CommonToolOptions & TargetOption<Target> & {
|
|
198
275
|
readonly fields?: readonly AgentRecordFieldInput<Target>[];
|
|
@@ -130,10 +130,11 @@ export function agentSearchRecords(opts) {
|
|
|
130
130
|
});
|
|
131
131
|
}
|
|
132
132
|
export function agentSearchTable(opts) {
|
|
133
|
+
const target = "app" in opts && opts.app !== undefined ? opts.app : "element" in opts && opts.element !== undefined ? opts.element : undefined;
|
|
133
134
|
return tool({
|
|
134
135
|
searchTable: {
|
|
135
136
|
...common(opts),
|
|
136
|
-
aspectId:
|
|
137
|
+
...(target !== undefined ? { aspectId: target } : {}),
|
|
137
138
|
searchTableId: opts.table,
|
|
138
139
|
queryDescription: opts.queryDescription,
|
|
139
140
|
// Distinct internal keys preserve the provider's newer `fields` and
|