@elementumai/edk 0.8.0-preview.11 → 0.8.2-alpha.5
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 +510 -324
- package/dist-sdk/src/catalog/ai-provider-models.d.ts +30 -0
- package/dist-sdk/src/catalog/ai-provider-models.js +63 -0
- package/dist-sdk/src/catalog/factories.d.ts +56 -3
- package/dist-sdk/src/catalog/factories.js +83 -4
- package/dist-sdk/src/catalog/from-authoring.js +19 -2
- package/dist-sdk/src/catalog/index.d.ts +3 -2
- package/dist-sdk/src/catalog/index.js +3 -2
- package/dist-sdk/src/catalog/org.d.ts +1 -1
- package/dist-sdk/src/catalog/org.js +134 -50
- package/dist-sdk/src/catalog/render.d.ts +13 -1
- package/dist-sdk/src/catalog/render.js +21 -4
- package/dist-sdk/src/catalog/token.js +18 -0
- package/dist-sdk/src/catalog/types.d.ts +75 -3
- package/dist-sdk/src/catalog/types.js +3 -0
- package/dist-sdk/src/core/system-fields.d.ts +2 -0
- package/dist-sdk/src/core/system-fields.js +2 -0
- package/dist-sdk/src/core/types/ai-provider.d.ts +10 -23
- package/dist-sdk/src/core/types/ai-provider.js +1 -25
- package/dist-sdk/src/core/types/app.d.ts +26 -1
- package/dist-sdk/src/engine/build/context.d.ts +58 -0
- package/dist-sdk/src/engine/build/context.js +11 -1
- package/dist-sdk/src/engine/build/source-context.d.ts +45 -0
- package/dist-sdk/src/engine/build/source-context.js +23 -0
- package/dist-sdk/src/engine/pull/context.d.ts +15 -0
- package/dist-sdk/src/engine/pull/org.d.ts +10 -0
- package/dist-sdk/src/engine/pull/org.js +34 -4
- package/dist-sdk/src/engine/tf/index.d.ts +2 -2
- package/dist-sdk/src/engine/tf/index.js +2 -2
- package/dist-sdk/src/engine/tf/labels.d.ts +54 -0
- package/dist-sdk/src/engine/tf/labels.js +75 -0
- package/dist-sdk/src/engine/tf/parse.d.ts +15 -0
- package/dist-sdk/src/engine/tf/parse.js +162 -0
- package/dist-sdk/src/entities/access-policy/build.d.ts +26 -0
- package/dist-sdk/src/entities/access-policy/build.js +7 -0
- package/dist-sdk/src/entities/access-policy/filter.d.ts +61 -0
- package/dist-sdk/src/entities/access-policy/filter.js +83 -0
- package/dist-sdk/src/entities/access-policy/from-tf.d.ts +66 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +187 -0
- package/dist-sdk/src/entities/access-policy/module.d.ts +3 -0
- package/dist-sdk/src/entities/access-policy/module.js +17 -0
- package/dist-sdk/src/entities/access-policy/to-tf.d.ts +43 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +164 -0
- package/dist-sdk/src/entities/access-policy/types.d.ts +4 -0
- package/dist-sdk/src/entities/access-policy/types.js +10 -0
- package/dist-sdk/src/entities/agent/build.d.ts +2 -0
- package/dist-sdk/src/entities/agent/build.js +1 -0
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +257 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +29 -9
- package/dist-sdk/src/entities/agent/from-tf.js +146 -19
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +14 -4
- package/dist-sdk/src/entities/agent/to-tf.d.ts +46 -1
- package/dist-sdk/src/entities/agent/to-tf.js +160 -14
- package/dist-sdk/src/entities/agent/tools.d.ts +88 -9
- package/dist-sdk/src/entities/agent/tools.js +46 -7
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.d.ts +17 -0
- package/dist-sdk/src/entities/agent-a2a-skill/from-tf.js +64 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.d.ts +4 -0
- package/dist-sdk/src/entities/agent-a2a-skill/module.js +14 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.d.ts +40 -0
- package/dist-sdk/src/entities/agent-a2a-skill/to-tf.js +47 -0
- package/dist-sdk/src/entities/agent-tool/from-tf.d.ts +51 -4
- package/dist-sdk/src/entities/agent-tool/from-tf.js +131 -35
- package/dist-sdk/src/entities/agent-tool/to-tf.d.ts +11 -4
- package/dist-sdk/src/entities/agent-tool/to-tf.js +176 -30
- package/dist-sdk/src/entities/agent-tool/types.d.ts +5 -4
- package/dist-sdk/src/entities/agent-tool/types.js +38 -6
- package/dist-sdk/src/entities/app/build.d.ts +91 -13
- package/dist-sdk/src/entities/app/build.js +63 -5
- package/dist-sdk/src/entities/app/deserializer/normalize.d.ts +3 -0
- package/dist-sdk/src/entities/app/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/app/from-tf.js +32 -22
- package/dist-sdk/src/entities/app/index.d.ts +4 -1
- package/dist-sdk/src/entities/app/index.js +2 -1
- package/dist-sdk/src/entities/app/module.js +10 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +45 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +62 -42
- package/dist-sdk/src/entities/automation/deserializer/ast.d.ts +25 -8
- package/dist-sdk/src/entities/automation/deserializer/print-automation.d.ts +16 -1
- package/dist-sdk/src/entities/automation/deserializer/print-automation.js +206 -47
- package/dist-sdk/src/entities/automation/filter.d.ts +37 -3
- package/dist-sdk/src/entities/automation/filter.js +54 -3
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1344 -222
- package/dist-sdk/src/entities/automation/index.d.ts +4 -0
- package/dist-sdk/src/entities/automation/index.js +4 -0
- package/dist-sdk/src/entities/automation/module.js +29 -32
- package/dist-sdk/src/entities/automation/operators.d.ts +29 -2
- package/dist-sdk/src/entities/automation/operators.js +27 -1
- package/dist-sdk/src/entities/automation/output-key-wire-name.d.ts +19 -0
- package/dist-sdk/src/entities/automation/output-key-wire-name.js +24 -0
- package/dist-sdk/src/entities/automation/script-code.d.ts +10 -21
- package/dist-sdk/src/entities/automation/script-code.js +272 -5
- package/dist-sdk/src/entities/automation/tasks.d.ts +125 -19
- package/dist-sdk/src/entities/automation/tasks.js +83 -15
- package/dist-sdk/src/entities/automation/to-tf.d.ts +10 -29
- package/dist-sdk/src/entities/automation/to-tf.js +1291 -230
- package/dist-sdk/src/entities/automation/triggers.d.ts +9 -1
- package/dist-sdk/src/entities/automation/types.d.ts +29 -4
- package/dist-sdk/src/entities/automation/types.js +76 -46
- package/dist-sdk/src/entities/element/build.d.ts +44 -13
- package/dist-sdk/src/entities/element/build.js +45 -3
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +28 -14
- package/dist-sdk/src/entities/element/index.d.ts +4 -1
- package/dist-sdk/src/entities/element/index.js +2 -1
- package/dist-sdk/src/entities/element/module.js +4 -1
- package/dist-sdk/src/entities/element/to-tf.js +26 -3
- package/dist-sdk/src/entities/field/build.d.ts +61 -14
- package/dist-sdk/src/entities/field/build.js +10 -0
- package/dist-sdk/src/entities/field/calc/runtime.js +4 -0
- package/dist-sdk/src/entities/field/from-tf.d.ts +5 -3
- package/dist-sdk/src/entities/field/from-tf.js +118 -7
- package/dist-sdk/src/entities/field/module.js +3 -2
- package/dist-sdk/src/entities/field/to-tf.d.ts +46 -11
- package/dist-sdk/src/entities/field/to-tf.js +166 -17
- package/dist-sdk/src/entities/field/types.d.ts +26 -0
- package/dist-sdk/src/entities/field/types.js +34 -12
- package/dist-sdk/src/entities/file-reader/build.d.ts +108 -50
- package/dist-sdk/src/entities/file-reader/build.js +23 -23
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.d.ts +6 -0
- package/dist-sdk/src/entities/file-reader/deserializer/print-file-reader.js +109 -0
- package/dist-sdk/src/entities/file-reader/from-tf.d.ts +13 -0
- package/dist-sdk/src/entities/file-reader/from-tf.js +172 -0
- package/dist-sdk/src/entities/file-reader/index.d.ts +8 -3
- package/dist-sdk/src/entities/file-reader/index.js +7 -2
- package/dist-sdk/src/entities/file-reader/module.d.ts +3 -0
- package/dist-sdk/src/entities/file-reader/module.js +115 -0
- package/dist-sdk/src/entities/file-reader/to-tf.d.ts +14 -0
- package/dist-sdk/src/entities/file-reader/to-tf.js +84 -0
- package/dist-sdk/src/entities/file-reader/types.d.ts +32 -0
- package/dist-sdk/src/entities/file-reader/types.js +30 -0
- package/dist-sdk/src/entities/org/ai-provider.d.ts +13 -0
- package/dist-sdk/src/entities/org/ai-provider.js +46 -0
- package/dist-sdk/src/entities/org/connector.d.ts +8 -1
- package/dist-sdk/src/entities/org/connector.js +12 -14
- package/dist-sdk/src/entities/org/group.js +10 -1
- package/dist-sdk/src/entities/org/index.d.ts +1 -0
- package/dist-sdk/src/entities/org/index.js +1 -0
- package/dist-sdk/src/entities/org/user.js +10 -1
- package/dist-sdk/src/entities/shared/filters/ast.d.ts +59 -9
- package/dist-sdk/src/entities/shared/filters/types.d.ts +1 -1
- package/dist-sdk/src/entities/shared/tool-field-ref.d.ts +17 -0
- package/dist-sdk/src/entities/shared/tool-field-ref.js +46 -0
- package/dist-sdk/src/entities/shared/types/field-types.d.ts +10 -1
- package/dist-sdk/src/entities/shared/types/field-types.js +9 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.d.ts +19 -0
- package/dist-sdk/src/entities/skill/deserializer/print-skill-v2.js +128 -11
- package/dist-sdk/src/entities/skill/from-tf.js +4 -3
- package/dist-sdk/src/entities/skill/index.d.ts +1 -1
- package/dist-sdk/src/entities/skill/module.js +7 -1
- package/dist-sdk/src/entities/skill/to-tf.d.ts +26 -0
- package/dist-sdk/src/entities/skill/to-tf.js +65 -4
- package/dist-sdk/src/entities/skill/tools.d.ts +37 -8
- package/dist-sdk/src/entities/skill/tools.js +43 -1
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +34 -4
- package/dist-sdk/src/entities/skill-tool/from-tf.js +128 -18
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +13 -1
- package/dist-sdk/src/entities/skill-tool/to-tf.js +164 -25
- package/dist-sdk/src/entities/skill-tool/types.d.ts +5 -7
- package/dist-sdk/src/entities/skill-tool/types.js +47 -11
- package/dist-sdk/src/entities/view/from-tf.d.ts +6 -2
- package/dist-sdk/src/entities/view/from-tf.js +11 -9
- package/dist-sdk/src/entities/view/to-tf.d.ts +9 -7
- package/dist-sdk/src/entities/view/to-tf.js +39 -18
- package/dist-sdk/src/entities/view/types.d.ts +1 -1
- package/dist-sdk/src/entities/view/types.js +1 -1
- package/dist-sdk/src/graph/deferred-catalog-render.d.ts +0 -5
- package/dist-sdk/src/graph/deferred-catalog-render.js +1 -20
- package/dist-sdk/src/graph/index.d.ts +8 -0
- package/dist-sdk/src/graph/index.js +13 -9
- package/dist-sdk/src/graph/modules.js +8 -1
- package/dist-sdk/src/graph/types.d.ts +98 -4
- package/package.json +49 -16
- package/dist-sdk/src/entities/automation/value-ref-tf.d.ts +0 -76
- package/dist-sdk/src/entities/automation/value-ref-tf.js +0 -190
|
@@ -3,9 +3,9 @@
|
|
|
3
3
|
* every app's, element's, and table's own per-entity `generated/catalog.ts`
|
|
4
4
|
* (written by `writeAppCatalog`/`writeAppCatalogFromAuthoring`) and exposes
|
|
5
5
|
* apps/elements flat plus tables under `catalog.tables`, alongside org
|
|
6
|
-
*
|
|
6
|
+
* AI providers/cloud links. `import catalog from "@catalog"` gives
|
|
7
7
|
* `catalog.testingAles`, `catalog.tables.orders`,
|
|
8
|
-
* `catalog.
|
|
8
|
+
* `catalog.aiProviders.anthropic.models.claudeOpus_4_6`, etc.
|
|
9
9
|
*
|
|
10
10
|
* Elements and apps share the exact same per-entity catalog shape — an
|
|
11
11
|
* element just lives under `elements/<handle>/` instead of `apps/<handle>/`.
|
|
@@ -19,8 +19,10 @@ import { existsSync } from "node:fs";
|
|
|
19
19
|
import { readdir } from "node:fs/promises";
|
|
20
20
|
import { mkdir, writeFile } from "node:fs/promises";
|
|
21
21
|
import { join } from "node:path";
|
|
22
|
-
import { ORG_IDENTITY_BAGS, orgRootOwnFileBags } from "../graph/index.js";
|
|
22
|
+
import { AI_PROVIDER_TYPE_BY_RESOURCE_TYPE, ORG_IDENTITY_BAGS, orgRootOwnFileBags } from "../graph/index.js";
|
|
23
|
+
import { sanitizeName, tfLabelToTsLabel, tsLabelToTfLabel } from "../engine/tf/index.js";
|
|
23
24
|
import { sdkPackageSpecifier } from "../internal/sdk-package.js";
|
|
25
|
+
import { OrgExtractError } from "../engine/pull/org.js";
|
|
24
26
|
// ---------------------------------------------------------------------------
|
|
25
27
|
// Public entry points
|
|
26
28
|
// ---------------------------------------------------------------------------
|
|
@@ -59,14 +61,23 @@ function renderOrgTs(extract) {
|
|
|
59
61
|
return [];
|
|
60
62
|
return [{ bag, factory, entries, order: m.catalog.renderOrder }];
|
|
61
63
|
}).sort((a, b) => a.order - b.order || a.bag.localeCompare(b.bag));
|
|
62
|
-
|
|
64
|
+
// connector and the 10 ai-provider-* kinds are all `catalog: NO_CATALOG` —
|
|
65
|
+
// they never appear in `bags` above. Models nest on their provider instead
|
|
66
|
+
// (`aiProviders.<provider>.models.<model>`), rendered specially here.
|
|
67
|
+
const aiProvidersLines = renderAiProvidersBag(extract);
|
|
68
|
+
const factories = new Set(["orgCatalog", ...bags.map((b) => b.factory)]);
|
|
69
|
+
if (aiProvidersLines.length > 0) {
|
|
70
|
+
factories.add("defineAiProvider");
|
|
71
|
+
factories.add("connectorRef");
|
|
72
|
+
}
|
|
63
73
|
const lines = [
|
|
64
74
|
"// Org reference identities from `elementum pull org --data-only` — refresh by re-running it.",
|
|
65
75
|
"// Each key IS the identity's terraform label in camelCase: tfLabel = tsLabelToTfLabel(key)",
|
|
66
76
|
"// (the lossless bijection in src/tf/labels.ts — the stable naming contract).",
|
|
67
|
-
`import { ${factories.join(", ")} } from "${sdkPackageSpecifier("catalog")}";`,
|
|
77
|
+
`import { ${[...factories].sort().join(", ")} } from "${sdkPackageSpecifier("catalog")}";`,
|
|
68
78
|
"",
|
|
69
79
|
"export const org = orgCatalog({",
|
|
80
|
+
...aiProvidersLines,
|
|
70
81
|
];
|
|
71
82
|
for (const { bag, factory, entries } of bags) {
|
|
72
83
|
lines.push(` ${bag}: {`);
|
|
@@ -78,36 +89,142 @@ function renderOrgTs(extract) {
|
|
|
78
89
|
lines.push("});", "");
|
|
79
90
|
return lines.join("\n");
|
|
80
91
|
}
|
|
81
|
-
/**
|
|
92
|
+
/**
|
|
93
|
+
* Connectors nest one level under their provider — model names alone collide
|
|
94
|
+
* across providers, so `aiProviders.<provider>.models.<model>` disambiguates
|
|
95
|
+
* instead of a flat `connectors.<model>`. Provider/model keys are
|
|
96
|
+
* independently derived from `name`/`model_name` (never split out of the
|
|
97
|
+
* connector's combined tfLabel) and cross-checked against the recorded
|
|
98
|
+
* tfLabel — a mismatch means ei's label construction drifted from this
|
|
99
|
+
* derivation. Every connector is required (by `extractOrg`) to carry a
|
|
100
|
+
* resolved `providerRef`, so an unresolved one here means its provider
|
|
101
|
+
* wasn't itself exported — loud, not silent.
|
|
102
|
+
*/
|
|
103
|
+
function renderAiProvidersBag(extract) {
|
|
104
|
+
if (extract.aiProviders.length === 0)
|
|
105
|
+
return [];
|
|
106
|
+
const providerByRef = new Map();
|
|
107
|
+
for (const provider of extract.aiProviders) {
|
|
108
|
+
providerByRef.set(`${provider.resourceType}.${provider.tfLabel}`, provider);
|
|
109
|
+
}
|
|
110
|
+
const modelsByProviderKey = new Map();
|
|
111
|
+
for (const connector of extract.connectors) {
|
|
112
|
+
if (connector.providerRef === undefined) {
|
|
113
|
+
throw new OrgExtractError(`connector "${connector.name}" (${connector.tfLabel}) has no resolved provider reference`);
|
|
114
|
+
}
|
|
115
|
+
const providerRefKey = `${connector.providerRef.resourceType}.${connector.providerRef.tfLabel}`;
|
|
116
|
+
const provider = providerByRef.get(providerRefKey);
|
|
117
|
+
if (provider === undefined) {
|
|
118
|
+
throw new OrgExtractError(`connector "${connector.name}" (${connector.tfLabel}): its provider (${providerRefKey}) was not exported`);
|
|
119
|
+
}
|
|
120
|
+
const providerKey = tfLabelToTsLabel(sanitizeName(provider.name));
|
|
121
|
+
const modelKey = tfLabelToTsLabel(sanitizeName(connector.name));
|
|
122
|
+
const rebuilt = `${tsLabelToTfLabel(providerKey)}_${tsLabelToTfLabel(modelKey)}`;
|
|
123
|
+
if (rebuilt !== connector.tfLabel) {
|
|
124
|
+
throw new OrgExtractError(`connector "${connector.name}" / provider "${provider.name}": derived label "${rebuilt}" doesn't match ei's recorded label "${connector.tfLabel}" — label derivation drifted`);
|
|
125
|
+
}
|
|
126
|
+
const models = modelsByProviderKey.get(providerKey) ?? [];
|
|
127
|
+
if (models.some((m) => m.modelKey === modelKey)) {
|
|
128
|
+
throw new OrgExtractError(`provider "${provider.name}": two connectors both derive the model key "${modelKey}"`);
|
|
129
|
+
}
|
|
130
|
+
models.push({ modelKey, connector });
|
|
131
|
+
modelsByProviderKey.set(providerKey, models);
|
|
132
|
+
}
|
|
133
|
+
const providers = extract.aiProviders
|
|
134
|
+
.map((provider) => ({ provider, providerKey: tfLabelToTsLabel(sanitizeName(provider.name)) }))
|
|
135
|
+
.sort((a, b) => a.providerKey.localeCompare(b.providerKey));
|
|
136
|
+
const lines = [" aiProviders: {"];
|
|
137
|
+
for (const { provider, providerKey } of providers) {
|
|
138
|
+
const type = AI_PROVIDER_TYPE_BY_RESOURCE_TYPE.get(provider.resourceType);
|
|
139
|
+
if (type === undefined) {
|
|
140
|
+
throw new OrgExtractError(`provider "${provider.name}": unrecognized resource type "${provider.resourceType}"`);
|
|
141
|
+
}
|
|
142
|
+
const models = (modelsByProviderKey.get(providerKey) ?? []).sort((a, b) => a.modelKey.localeCompare(b.modelKey));
|
|
143
|
+
if (models.length === 0) {
|
|
144
|
+
lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)} }),`);
|
|
145
|
+
continue;
|
|
146
|
+
}
|
|
147
|
+
lines.push(` ${providerKey}: defineAiProvider({ name: ${q(provider.name)}, type: ${q(type)}, models: {`);
|
|
148
|
+
for (const { modelKey, connector } of models) {
|
|
149
|
+
lines.push(` ${modelKey}: connectorRef({ name: ${q(connector.name)} }),`);
|
|
150
|
+
}
|
|
151
|
+
lines.push(" } }),");
|
|
152
|
+
}
|
|
153
|
+
lines.push(" },");
|
|
154
|
+
return lines;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Render generated/catalog.ts as a pure barrel over org.ts + disk-scanned
|
|
158
|
+
* catalogs — every app/element/table entry is a lazy `get` accessor (a
|
|
159
|
+
* `require(...)` inside the getter body, type-asserted via `typeof
|
|
160
|
+
* import(...)` so `Ref`/autocomplete stay fully typed) rather than a
|
|
161
|
+
* static top-level import.
|
|
162
|
+
*
|
|
163
|
+
* This is NOT cosmetic: a relation field authored on a root app/element's
|
|
164
|
+
* own file can reference ANOTHER sibling via `catalog.<ref>` (see
|
|
165
|
+
* `entities/field/to-tf.ts`'s `workspaceAspects` sibling resolution) — the
|
|
166
|
+
* first real case of a root file importing `@catalog` itself. But the
|
|
167
|
+
* barrel unconditionally aggregates EVERY app/element, including the
|
|
168
|
+
* importing file's own entry, so a static import here would statically
|
|
169
|
+
* import that file's own per-entity catalog, which itself statically
|
|
170
|
+
* imports the file currently mid-evaluation — a genuine circular require
|
|
171
|
+
* (confirmed live: jiti/CJS semantics hand back a partial, `export
|
|
172
|
+
* default`-less module, and `.ref()` on it throws). A lazy getter defers
|
|
173
|
+
* that whole chain until the property is actually READ, by which point
|
|
174
|
+
* the importing file's own module evaluation has moved past the point of
|
|
175
|
+
* needing it (or, for a property this file never touches at all — e.g.
|
|
176
|
+
* `knowledge.ts` only ever reads `catalog.tickets`, never
|
|
177
|
+
* `catalog.knowledge` — the getter for its OWN entry is simply never
|
|
178
|
+
* invoked, so its self-referential chain never runs).
|
|
179
|
+
*/
|
|
82
180
|
function renderBarrel(appHandles, elementHandles, tableHandles) {
|
|
83
|
-
const
|
|
181
|
+
const elementKeys = computeElementKeys(appHandles, elementHandles);
|
|
182
|
+
const hasLazyEntries = appHandles.length > 0 || elementHandles.length > 0 || tableHandles.length > 0;
|
|
84
183
|
const lines = [
|
|
85
184
|
'import { org } from "../org.js";',
|
|
86
|
-
|
|
185
|
+
'import { usersCatalog } from "@elementumai/edk/catalog";',
|
|
87
186
|
"",
|
|
88
|
-
"const catalog = {",
|
|
89
187
|
];
|
|
188
|
+
if (hasLazyEntries) {
|
|
189
|
+
// A minimal local ambient declaration rather than relying on `@types/node`
|
|
190
|
+
// (a consumer workspace may not have it) — the runtime `require` itself
|
|
191
|
+
// is provided by the loader (jiti), not by this declaration, which is
|
|
192
|
+
// erased entirely at compile time.
|
|
193
|
+
lines.push("declare const require: (id: string) => unknown;", "");
|
|
194
|
+
}
|
|
195
|
+
lines.push("const catalog = {");
|
|
90
196
|
for (const h of appHandles)
|
|
91
|
-
lines.push(
|
|
197
|
+
lines.push(...lazyAspectGetter(h, `../apps/${h}/generated/catalog.js`, h));
|
|
92
198
|
for (const h of elementHandles) {
|
|
93
|
-
|
|
94
|
-
lines.push(key === h ? ` ${h},` : ` ${key},`);
|
|
199
|
+
lines.push(...lazyAspectGetter(elementKeys.get(h), `../elements/${h}/generated/catalog.js`, h));
|
|
95
200
|
}
|
|
96
|
-
lines.push("
|
|
201
|
+
lines.push(" users: usersCatalog,");
|
|
202
|
+
lines.push(" aiProviders: org.aiProviders,");
|
|
97
203
|
lines.push(" cloudLinks: org.cloudLinks,");
|
|
98
204
|
lines.push(" categories: org.categories,");
|
|
99
205
|
lines.push(" groups: org.groups,");
|
|
100
206
|
if (tableHandles.length > 0) {
|
|
101
207
|
lines.push(" tables: {");
|
|
102
208
|
for (const h of tableHandles)
|
|
103
|
-
lines.push(
|
|
209
|
+
lines.push(...lazyAspectGetter(safeKey(h), `../tables/${h}/generated/catalog.js`, "default", " "));
|
|
104
210
|
lines.push(" },");
|
|
105
211
|
}
|
|
106
212
|
lines.push("};", "", "export { org };", "export type Ref = typeof catalog;", "export default catalog;", "");
|
|
107
213
|
return lines.join("\n");
|
|
108
214
|
}
|
|
109
|
-
/**
|
|
110
|
-
|
|
215
|
+
/**
|
|
216
|
+
* One lazy `get <key>() { ... }` accessor: `require`s `importPath` only when
|
|
217
|
+
* read, type-asserted as `typeof import(importPath)` so the property's
|
|
218
|
+
* static type is exactly what a real `import` would have given it.
|
|
219
|
+
*/
|
|
220
|
+
function lazyAspectGetter(key, importPath, exportName, indent = " ") {
|
|
221
|
+
const quoted = JSON.stringify(importPath);
|
|
222
|
+
return [
|
|
223
|
+
`${indent}get ${key}() { return (require(${quoted}) as typeof import(${quoted})).${exportName}; },`,
|
|
224
|
+
];
|
|
225
|
+
}
|
|
226
|
+
/** An app and an element MAY share a handle — expose the element under a disambiguated key, warning once. */
|
|
227
|
+
function computeElementKeys(appHandles, elementHandles) {
|
|
111
228
|
const used = new Set(appHandles);
|
|
112
229
|
const elementKeys = new Map();
|
|
113
230
|
for (const h of elementHandles) {
|
|
@@ -126,19 +243,7 @@ function aspectImportLines(appHandles, elementHandles, tableHandles) {
|
|
|
126
243
|
used.add(candidate);
|
|
127
244
|
console.error(`[elementum] warning: "${h}" names both an app and an element — the element is exposed as catalog.${candidate} (the app keeps catalog.${h}) to avoid a collision.`);
|
|
128
245
|
}
|
|
129
|
-
|
|
130
|
-
const lines = [];
|
|
131
|
-
for (const h of appHandles)
|
|
132
|
-
lines.push(`import { ${h} } from "../apps/${h}/generated/catalog.js";`);
|
|
133
|
-
for (const h of elementHandles) {
|
|
134
|
-
const key = elementKeys.get(h);
|
|
135
|
-
lines.push(key === h
|
|
136
|
-
? `import { ${h} } from "../elements/${h}/generated/catalog.js";`
|
|
137
|
-
: `import { ${h} as ${key} } from "../elements/${h}/generated/catalog.js";`);
|
|
138
|
-
}
|
|
139
|
-
for (const h of tableHandles)
|
|
140
|
-
lines.push(`import ${tableImports.get(h)} from "../tables/${h}/generated/catalog.js";`);
|
|
141
|
-
return { elementKeys, tableImports, lines };
|
|
246
|
+
return elementKeys;
|
|
142
247
|
}
|
|
143
248
|
// ---------------------------------------------------------------------------
|
|
144
249
|
// App / element / table handle discovery (dirs from orgRootOwnFileBags)
|
|
@@ -188,24 +293,3 @@ function safeKey(name) {
|
|
|
188
293
|
? name
|
|
189
294
|
: q(name);
|
|
190
295
|
}
|
|
191
|
-
function localTableNames(handles, usedNames) {
|
|
192
|
-
const out = new Map();
|
|
193
|
-
for (const handle of handles) {
|
|
194
|
-
const base = `${identifierBase(handle)}$table`;
|
|
195
|
-
let candidate = base;
|
|
196
|
-
let n = 2;
|
|
197
|
-
while (usedNames.has(candidate) || RESERVED_IDENT.has(candidate)) {
|
|
198
|
-
candidate = `${base}${n}`;
|
|
199
|
-
n += 1;
|
|
200
|
-
}
|
|
201
|
-
usedNames.add(candidate);
|
|
202
|
-
out.set(handle, candidate);
|
|
203
|
-
}
|
|
204
|
-
return out;
|
|
205
|
-
}
|
|
206
|
-
function identifierBase(handle) {
|
|
207
|
-
const sanitized = handle.replace(/[^A-Za-z0-9_$]/g, "_");
|
|
208
|
-
if (sanitized === "")
|
|
209
|
-
return "_";
|
|
210
|
-
return /^[A-Za-z_$]/.test(sanitized) ? sanitized : `_${sanitized}`;
|
|
211
|
-
}
|
|
@@ -13,6 +13,18 @@ export interface BarrelRoot {
|
|
|
13
13
|
readonly refName: string;
|
|
14
14
|
readonly name: string;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* The app/element's own authoring file, imported live so identity + fields
|
|
18
|
+
* never need re-baking when the file's content changes — only the file's
|
|
19
|
+
* *existence* is a catalog-generation event (adding/removing an own-file
|
|
20
|
+
* child still goes through `edk new agent`/`edk new skill`/pull). Safe
|
|
21
|
+
* because an app/element file is always a leaf: it never imports `@catalog`
|
|
22
|
+
* itself, so importing it from the catalog can't cycle.
|
|
23
|
+
*/
|
|
24
|
+
export interface OwnFileRef {
|
|
25
|
+
readonly importPath: string;
|
|
26
|
+
readonly identifier: string;
|
|
27
|
+
}
|
|
16
28
|
/**
|
|
17
29
|
* Render a single flat catalog file. App/element catalogs use `appCatalog()` /
|
|
18
30
|
* `elementCatalog()` so `__kind` stays inside the factory. The org catalog uses
|
|
@@ -23,7 +35,7 @@ export interface BarrelRoot {
|
|
|
23
35
|
*
|
|
24
36
|
* @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
|
|
25
37
|
*/
|
|
26
|
-
export declare function renderCatalog(root: BarrelRoot, refs: readonly CatalogRef[], _automationTriggerKinds?: Map<string, string
|
|
38
|
+
export declare function renderCatalog(root: BarrelRoot, refs: readonly CatalogRef[], _automationTriggerKinds?: Map<string, string>, ownFile?: OwnFileRef): string;
|
|
27
39
|
/** One entry the barrel imports and aggregates. */
|
|
28
40
|
export interface BarrelEntry {
|
|
29
41
|
readonly kind: CatalogRefKind;
|
|
@@ -26,11 +26,15 @@ function bagName(kind) {
|
|
|
26
26
|
*
|
|
27
27
|
* @deprecated `automationTriggerKinds` is no longer used — pass nothing or omit.
|
|
28
28
|
*/
|
|
29
|
-
export function renderCatalog(root, refs, _automationTriggerKinds) {
|
|
29
|
+
export function renderCatalog(root, refs, _automationTriggerKinds, ownFile) {
|
|
30
30
|
const isApp = root.kind === "app" || root.kind === "element";
|
|
31
31
|
// Graph CatalogFacet (+ deferred meta) drives which kinds belong on this root
|
|
32
32
|
// and their emission order — no hard-wired KIND_ORDER / bag lists here.
|
|
33
33
|
const usedMeta = catalogKindsForRoot(root.kind).filter((m) => refs.some((r) => r.__kind === m.refKind));
|
|
34
|
+
// Fields resolve live off `ownFile` (identity + fields come straight from
|
|
35
|
+
// the app/element's own `.ref()` call) — never rendered as baked entries,
|
|
36
|
+
// so `fieldRef` never needs importing and the per-entry loop skips "field".
|
|
37
|
+
const liveMeta = ownFile !== undefined ? usedMeta.filter((m) => m.refKind !== "field") : usedMeta;
|
|
34
38
|
const factoryNames = new Set();
|
|
35
39
|
if (isApp) {
|
|
36
40
|
factoryNames.add(root.kind === "element" ? "elementCatalog" : "appCatalog");
|
|
@@ -38,10 +42,10 @@ export function renderCatalog(root, refs, _automationTriggerKinds) {
|
|
|
38
42
|
else {
|
|
39
43
|
factoryNames.add("orgCatalog");
|
|
40
44
|
}
|
|
41
|
-
for (const m of
|
|
45
|
+
for (const m of liveMeta)
|
|
42
46
|
factoryNames.add(m.factoryName);
|
|
43
47
|
const entryIndent = isApp ? " " : " ";
|
|
44
|
-
for (const m of
|
|
48
|
+
for (const m of liveMeta) {
|
|
45
49
|
const kindRefs = refs.filter((r) => r.__kind === m.refKind);
|
|
46
50
|
for (const ref of kindRefs) {
|
|
47
51
|
const rendered = m.renderEntry({
|
|
@@ -54,15 +58,28 @@ export function renderCatalog(root, refs, _automationTriggerKinds) {
|
|
|
54
58
|
}
|
|
55
59
|
}
|
|
56
60
|
const lines = [];
|
|
61
|
+
if (ownFile !== undefined) {
|
|
62
|
+
lines.push(`import ${ownFile.identifier} from ${JSON.stringify(ownFile.importPath)};`);
|
|
63
|
+
}
|
|
57
64
|
lines.push(`import { ${[...factoryNames].sort().join(", ")} } from "${sdkPackageSpecifier("catalog")}";`);
|
|
58
65
|
lines.push("");
|
|
59
66
|
if (isApp) {
|
|
60
67
|
const catalogFn = root.kind === "element" ? "elementCatalog" : "appCatalog";
|
|
68
|
+
if (ownFile !== undefined) {
|
|
69
|
+
lines.push(`const __own = ${ownFile.identifier}.ref(${JSON.stringify(root.refName)});`);
|
|
70
|
+
lines.push("");
|
|
71
|
+
}
|
|
61
72
|
lines.push(`export const ${root.refName} = ${catalogFn}(`);
|
|
62
|
-
lines.push(
|
|
73
|
+
lines.push(ownFile !== undefined
|
|
74
|
+
? ` { refName: __own.refName, name: __own.name },`
|
|
75
|
+
: ` { refName: ${JSON.stringify(root.refName)}, name: ${JSON.stringify(root.name)} },`);
|
|
63
76
|
lines.push(` {`);
|
|
64
77
|
for (const m of usedMeta) {
|
|
65
78
|
const bag = bagName(m.refKind);
|
|
79
|
+
if (m.refKind === "field" && ownFile !== undefined) {
|
|
80
|
+
lines.push(` ${bag}: __own.fields,`);
|
|
81
|
+
continue;
|
|
82
|
+
}
|
|
66
83
|
const kindRefs = refs
|
|
67
84
|
.filter((r) => r.__kind === m.refKind)
|
|
68
85
|
.sort((a, b) => a.refName.localeCompare(b.refName));
|
|
@@ -30,10 +30,28 @@ export function slimToken(token) {
|
|
|
30
30
|
out.name = token.name;
|
|
31
31
|
if (token.parent !== undefined)
|
|
32
32
|
out.parent = token.parent;
|
|
33
|
+
if ((token.__kind === "approvalChain" || token.__kind === "skill") && typeof token.unresolvedId === "string") {
|
|
34
|
+
out.unresolvedId = token.unresolvedId;
|
|
35
|
+
}
|
|
33
36
|
// The terraform path derives a field's resource type from its authoring
|
|
34
37
|
// type — canonical field metadata, not a barrel bag.
|
|
35
38
|
if (token.__kind === "field" && typeof token.fieldType === "string")
|
|
36
39
|
out.fieldType = token.fieldType;
|
|
40
|
+
if (token.__kind === "field" && (token.parentKind === "app" || token.parentKind === "element"))
|
|
41
|
+
out.parentKind = token.parentKind;
|
|
42
|
+
if (token.__kind === "field" && typeof token.parentName === "string")
|
|
43
|
+
out.parentName = token.parentName;
|
|
44
|
+
// Same reasoning for a file reader: build needs to know which of the
|
|
45
|
+
// excel/json/text/xml/ai resource types backs it to emit the right
|
|
46
|
+
// `elementum_<type>_file_reader.<label>.id` reference - without this,
|
|
47
|
+
// slimToken silently dropped readerType and automationToTf's
|
|
48
|
+
// documentModel case threw "no recognized readerType" on every readFile
|
|
49
|
+
// task build.
|
|
50
|
+
if (token.__kind === "documentModel" && typeof token.readerType === "string")
|
|
51
|
+
out.readerType = token.readerType;
|
|
52
|
+
if (token.__kind === "field" && Array.isArray(token.options)) {
|
|
53
|
+
out.options = token.options.filter((option) => typeof option === "string");
|
|
54
|
+
}
|
|
37
55
|
if ((token.__kind === "field" || token.__kind === "tableColumn") && Array.isArray(token.tags)) {
|
|
38
56
|
out.tags = token.tags.filter((tag) => typeof tag === "string");
|
|
39
57
|
}
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
* schema is authoring-only — at the wire boundary `resolvePayload` replaces the
|
|
24
24
|
* whole token with the resolved id, discarding it.
|
|
25
25
|
*/
|
|
26
|
+
import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js";
|
|
26
27
|
/**
|
|
27
28
|
* Kinds a catalog fragment can describe:
|
|
28
29
|
* - behavioral, app-owned, deployable — `automation` / `agent` / `skill`;
|
|
@@ -34,7 +35,7 @@
|
|
|
34
35
|
* resolved to the current-version param/output id via the parent
|
|
35
36
|
* automation's state binding.
|
|
36
37
|
*/
|
|
37
|
-
export type CatalogRefKind = "automation" | "agent" | "skill" | "flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "category" | "group" | "app" | "element" | "triggerParameter" | "outputProperty";
|
|
38
|
+
export type CatalogRefKind = "automation" | "agent" | "skill" | "flow" | "approvalChain" | "table" | "tableColumn" | "cloudLink" | "field" | "searchTable" | "documentModel" | "documentModelField" | "connector" | "aiProvider" | "category" | "group" | "app" | "element" | "triggerParameter" | "outputProperty";
|
|
38
39
|
/**
|
|
39
40
|
* The reference surface for a catalog entity. `handle` is the stable join key
|
|
40
41
|
* (no id); `name` is for readability/diagnostics, never a match key.
|
|
@@ -65,9 +66,22 @@ export interface AutomationRef<TTrigger = unknown, TOutput = unknown> extends Ca
|
|
|
65
66
|
readonly output?: TOutput;
|
|
66
67
|
}
|
|
67
68
|
export type AgentRef = CatalogRef<"agent">;
|
|
68
|
-
export
|
|
69
|
+
export interface SkillRef extends CatalogRef<"skill"> {
|
|
70
|
+
/**
|
|
71
|
+
* A raw platform id, when the export carries a `skill_ids`/
|
|
72
|
+
* `preloaded_skill_ids` entry that resolves to neither a self-app resource
|
|
73
|
+
* ref nor a foreign-app `data.elementum_agentic_skill` block (no name to
|
|
74
|
+
* key a lookup by at all) — same escape as `ApprovalChainRef`'s. Present
|
|
75
|
+
* only takes over resolution at build; `refName`/`name` still exist (both
|
|
76
|
+
* the raw id) purely to satisfy `SkillRef`'s shape.
|
|
77
|
+
*/
|
|
78
|
+
readonly unresolvedId?: string;
|
|
79
|
+
}
|
|
69
80
|
export type FlowRef = CatalogRef<"flow">;
|
|
70
|
-
export
|
|
81
|
+
export interface ApprovalChainRef extends CatalogRef<"approvalChain"> {
|
|
82
|
+
/** Provider id retained only when no managed/data HCL reference exists. */
|
|
83
|
+
readonly unresolvedId?: string;
|
|
84
|
+
}
|
|
71
85
|
export interface TableColumnRef extends CatalogRef<"tableColumn"> {
|
|
72
86
|
/** Owning table handle. */
|
|
73
87
|
readonly parent: string;
|
|
@@ -81,6 +95,27 @@ export interface TableRef extends CatalogRef<"table"> {
|
|
|
81
95
|
}
|
|
82
96
|
export type SearchTableRef = CatalogRef<"searchTable">;
|
|
83
97
|
export type ConnectorRef = CatalogRef<"connector">;
|
|
98
|
+
/**
|
|
99
|
+
* An AI provider reference that also exposes its enabled connectors as a
|
|
100
|
+
* nested ref bag — models are referenceable *on* the provider
|
|
101
|
+
* (`catalog.aiProviders.<provider>.models.<model>`), the same nested-ref-bag
|
|
102
|
+
* shape `AutomationCatalogRef`/`FileReaderCatalogRef` already use. Reference
|
|
103
|
+
* only — the provider must already exist on the platform; there is no
|
|
104
|
+
* create/deploy path (src/CLAUDE.md). Generic over `T` so `type: "anthropic"`
|
|
105
|
+
* narrows which models are valid in `models` (see `AiProviderLlmModel`).
|
|
106
|
+
*/
|
|
107
|
+
export interface AiProviderRef<T extends AiProviderType = AiProviderType> extends CatalogRef<"aiProvider"> {
|
|
108
|
+
/** Which AI provider family this is (e.g. "anthropic", "bedrock") — build maps it to the matching `elementum_<type>_ai_provider` terraform data source; authored source never names the resource type directly. */
|
|
109
|
+
readonly type: T;
|
|
110
|
+
/**
|
|
111
|
+
* Each entry is either a reference to an already-pulled connector
|
|
112
|
+
* (`connectorRef({ name })`, what `pull org` always emits) or a bare model
|
|
113
|
+
* literal naming a connector to create for that model — type-checked
|
|
114
|
+
* against `T`'s valid models. The create path has no build/authoring-
|
|
115
|
+
* location wiring yet; this is the type surface only.
|
|
116
|
+
*/
|
|
117
|
+
readonly models?: Readonly<Record<string, ConnectorRef | AiProviderLlmModel<T>>>;
|
|
118
|
+
}
|
|
84
119
|
export type CloudLinkRef = CatalogRef<"cloudLink">;
|
|
85
120
|
/** Org-owned reference identities from `elementum pull org --data-only` (pristine-refactor). */
|
|
86
121
|
export type CategoryRef = CatalogRef<"category">;
|
|
@@ -96,6 +131,36 @@ export type AspectRef = CatalogRef<"app"> | CatalogRef<"element">;
|
|
|
96
131
|
export interface FieldRef extends CatalogRef<"field"> {
|
|
97
132
|
readonly fieldType: string;
|
|
98
133
|
readonly tags?: readonly string[];
|
|
134
|
+
readonly options?: readonly string[];
|
|
135
|
+
/**
|
|
136
|
+
* Whether `parent` names an app or an element — stamped alongside `parent`
|
|
137
|
+
* by `appCatalog`/`elementCatalog` (the field's own token doesn't otherwise
|
|
138
|
+
* say, unlike `AspectRef`'s own `__kind`). Lets a cross-app field ref pick
|
|
139
|
+
* `elementum_app` vs `elementum_element` for its owner lookup without
|
|
140
|
+
* depending on the owner also appearing elsewhere in the same payload.
|
|
141
|
+
*/
|
|
142
|
+
readonly parentKind?: "app" | "element";
|
|
143
|
+
/**
|
|
144
|
+
* The parent's display NAME, stamped alongside `parent` for the same
|
|
145
|
+
* reason `parentKind` is — a foreign owner lookup (`data.elementum_app` /
|
|
146
|
+
* `data.elementum_element`) keys by display name, which `parent` (a
|
|
147
|
+
* refName) doesn't carry.
|
|
148
|
+
*/
|
|
149
|
+
readonly parentName?: string;
|
|
150
|
+
}
|
|
151
|
+
/** Platform-owned user attributes accepted by user-search task filters. */
|
|
152
|
+
export declare const USER_FIELD_KEYS: readonly ["firstName", "email", "jobTitle", "lastName"];
|
|
153
|
+
export type UserFieldKey = (typeof USER_FIELD_KEYS)[number];
|
|
154
|
+
/**
|
|
155
|
+
* A virtual catalog ref for the fixed user-directory schema. Unlike an app
|
|
156
|
+
* FieldRef, this token serializes to its literal platform key (there is no
|
|
157
|
+
* entity id to resolve).
|
|
158
|
+
*/
|
|
159
|
+
export interface UserFieldRef {
|
|
160
|
+
readonly __kind: "userField";
|
|
161
|
+
readonly refName: UserFieldKey;
|
|
162
|
+
readonly name: UserFieldKey;
|
|
163
|
+
readonly fieldType: "TEXT";
|
|
99
164
|
}
|
|
100
165
|
export interface TriggerParameterRef extends CatalogRef<"triggerParameter"> {
|
|
101
166
|
/**
|
|
@@ -116,6 +181,13 @@ export type DocumentModelFieldRef = CatalogRef<"documentModelField">;
|
|
|
116
181
|
* nested ref is this document model's handle.
|
|
117
182
|
*/
|
|
118
183
|
export interface FileReaderCatalogRef extends CatalogRef<"documentModel"> {
|
|
184
|
+
/**
|
|
185
|
+
* Which of the platform's file-reader resource types this token points at
|
|
186
|
+
* — `elementum_file_reader_task.file_reader_id` accepts excel/json/text
|
|
187
|
+
* readers only, and build needs the exact resource type (not just a name)
|
|
188
|
+
* to emit the right `elementum_<type>_file_reader.<label>.id` reference.
|
|
189
|
+
*/
|
|
190
|
+
readonly readerType: "excel" | "json" | "text" | "xml" | "ai";
|
|
119
191
|
readonly fields?: Readonly<Record<string, DocumentModelFieldRef>>;
|
|
120
192
|
}
|
|
121
193
|
/**
|
|
@@ -23,6 +23,8 @@
|
|
|
23
23
|
* schema is authoring-only — at the wire boundary `resolvePayload` replaces the
|
|
24
24
|
* whole token with the resolved id, discarding it.
|
|
25
25
|
*/
|
|
26
|
+
/** Platform-owned user attributes accepted by user-search task filters. */
|
|
27
|
+
export const USER_FIELD_KEYS = ["firstName", "email", "jobTitle", "lastName"];
|
|
26
28
|
/**
|
|
27
29
|
* Which scope resolves a kind's id at deploy:
|
|
28
30
|
* - `"app"` — the app's v2 state (app-owned entities + fields/tables);
|
|
@@ -44,6 +46,7 @@ export const REF_SCOPE = {
|
|
|
44
46
|
documentModel: "app",
|
|
45
47
|
documentModelField: "app",
|
|
46
48
|
connector: "org",
|
|
49
|
+
aiProvider: "org",
|
|
47
50
|
category: "org",
|
|
48
51
|
group: "org",
|
|
49
52
|
app: "registry",
|
|
@@ -65,6 +65,8 @@ export declare const SYSTEM_FIELD_TAG_BY_KEY: {
|
|
|
65
65
|
export type SystemFieldKey = keyof typeof SYSTEM_FIELD_TAG_BY_KEY;
|
|
66
66
|
/** All canonical keys, in platform rank order (HANDLE first … CLOSED_BY last). */
|
|
67
67
|
export declare const SYSTEM_FIELD_KEYS: readonly SystemFieldKey[];
|
|
68
|
+
/** `SYSTEM_FIELD_KEYS` as a set — for O(1) "is this key a system field?" checks (e.g. distinguishing a system field from a custom field by bag key alone). */
|
|
69
|
+
export declare const SYSTEM_FIELD_KEY_SET: ReadonlySet<SystemFieldKey>;
|
|
68
70
|
export declare const SYSTEM_FIELD_KEY_BY_TAG: Readonly<Record<string, SystemFieldKey>>;
|
|
69
71
|
/**
|
|
70
72
|
* What a NO-OVERRIDE deploy produces — the terraform provider's auto-create
|
|
@@ -101,6 +101,8 @@ export const SYSTEM_FIELD_TAG_BY_KEY = {
|
|
|
101
101
|
};
|
|
102
102
|
/** All canonical keys, in platform rank order (HANDLE first … CLOSED_BY last). */
|
|
103
103
|
export const SYSTEM_FIELD_KEYS = Object.keys(SYSTEM_FIELD_TAG_BY_KEY);
|
|
104
|
+
/** `SYSTEM_FIELD_KEYS` as a set — for O(1) "is this key a system field?" checks (e.g. distinguishing a system field from a custom field by bag key alone). */
|
|
105
|
+
export const SYSTEM_FIELD_KEY_SET = new Set(SYSTEM_FIELD_KEYS);
|
|
104
106
|
export const SYSTEM_FIELD_KEY_BY_TAG = Object.fromEntries(Object.entries(SYSTEM_FIELD_TAG_BY_KEY).map(([k, tag]) => [tag, k]));
|
|
105
107
|
/**
|
|
106
108
|
* What a NO-OVERRIDE deploy produces — the terraform provider's auto-create
|
|
@@ -1,27 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* export const openAiGpt5 = defineAiProviderConnector({
|
|
12
|
-
* id: "ab100edd-b301-4a16-b269-e5347449ad9b",
|
|
13
|
-
* name: "ChatGPT 5 (OpenAI)",
|
|
14
|
-
* model: "GPT_5",
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // agents/support-agent.ts
|
|
18
|
-
* import { openAiGpt5 } from "../connectors/ai-providers.js";
|
|
19
|
-
*
|
|
20
|
-
* defineAgent({
|
|
21
|
-
* aiProviderConnector: openAiGpt5,
|
|
22
|
-
* // ...
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
2
|
+
* @deprecated v1 authoring pattern — hand-typed with a raw platform UUID,
|
|
3
|
+
* exactly the "no ids in authored source" bug CLAUDE.md's Gotchas section
|
|
4
|
+
* warns about. Superseded by the pulled `aiProviders` catalog: providers and
|
|
5
|
+
* their connectors are discovered by `elementum pull org --data-only`, never
|
|
6
|
+
* hand-authored (they hold credentials, manually configured on the
|
|
7
|
+
* platform), and referenced as `catalog.aiProviders.<provider>.models.<model>`
|
|
8
|
+
* — e.g. `connector: catalog.aiProviders.anthropic.models.claudeOpus_4_6`.
|
|
9
|
+
* Kept only because it's re-exported through the published
|
|
10
|
+
* `@elementumai/edk/core` entry; do not use in new code.
|
|
25
11
|
*/
|
|
26
12
|
export interface AiProviderConnector {
|
|
27
13
|
readonly id: string;
|
|
@@ -29,6 +15,7 @@ export interface AiProviderConnector {
|
|
|
29
15
|
/** Model identifier (e.g. "gpt-4o", "claude-3-5-sonnet"). Metadata only — the platform uses the connector's configured model. */
|
|
30
16
|
readonly model?: string;
|
|
31
17
|
}
|
|
18
|
+
/** @deprecated Use the pulled `catalog.aiProviders.<provider>.models.<model>` token instead — see {@link AiProviderConnector}. */
|
|
32
19
|
export declare function defineAiProviderConnector(opts: {
|
|
33
20
|
id: string;
|
|
34
21
|
name?: string;
|
|
@@ -1,28 +1,4 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AI provider connector descriptor — a typed handle to a registered
|
|
3
|
-
* AI provider connector (OpenAI, Anthropic, etc.) on the Elementum platform.
|
|
4
|
-
*
|
|
5
|
-
* Defined once and shared across agents so callers reference the same typed
|
|
6
|
-
* object everywhere (mirroring the `App`, `AppAgent`, `AppAutomation` pattern),
|
|
7
|
-
* rather than re-typing a raw `{ id }` blob at each agent site.
|
|
8
|
-
*
|
|
9
|
-
* ```ts
|
|
10
|
-
* // connectors/ai-providers.ts
|
|
11
|
-
* export const openAiGpt5 = defineAiProviderConnector({
|
|
12
|
-
* id: "ab100edd-b301-4a16-b269-e5347449ad9b",
|
|
13
|
-
* name: "ChatGPT 5 (OpenAI)",
|
|
14
|
-
* model: "GPT_5",
|
|
15
|
-
* });
|
|
16
|
-
*
|
|
17
|
-
* // agents/support-agent.ts
|
|
18
|
-
* import { openAiGpt5 } from "../connectors/ai-providers.js";
|
|
19
|
-
*
|
|
20
|
-
* defineAgent({
|
|
21
|
-
* aiProviderConnector: openAiGpt5,
|
|
22
|
-
* // ...
|
|
23
|
-
* });
|
|
24
|
-
* ```
|
|
25
|
-
*/
|
|
1
|
+
/** @deprecated Use the pulled `catalog.aiProviders.<provider>.models.<model>` token instead — see {@link AiProviderConnector}. */
|
|
26
2
|
export function defineAiProviderConnector(opts) {
|
|
27
3
|
return {
|
|
28
4
|
id: opts.id,
|