@elementumai/edk 0.8.0-preview.11 → 0.8.1
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 +378 -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 +65 -2
- package/dist-sdk/src/catalog/from-authoring.js +6 -1
- 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 +83 -6
- 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 +14 -0
- package/dist-sdk/src/catalog/types.d.ts +60 -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 +20 -1
- package/dist-sdk/src/engine/build/context.d.ts +18 -0
- 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 +1 -1
- package/dist-sdk/src/engine/tf/index.js +1 -1
- package/dist-sdk/src/engine/tf/labels.d.ts +45 -0
- package/dist-sdk/src/engine/tf/labels.js +71 -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 +48 -0
- package/dist-sdk/src/entities/access-policy/from-tf.js +189 -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 +36 -0
- package/dist-sdk/src/entities/access-policy/to-tf.js +149 -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/deserializer/print-agent-v2.d.ts +38 -3
- package/dist-sdk/src/entities/agent/deserializer/print-agent-v2.js +199 -32
- package/dist-sdk/src/entities/agent/from-tf.d.ts +18 -3
- package/dist-sdk/src/entities/agent/from-tf.js +135 -15
- package/dist-sdk/src/entities/agent/index.d.ts +1 -1
- package/dist-sdk/src/entities/agent/module.js +8 -2
- package/dist-sdk/src/entities/agent/to-tf.js +62 -10
- 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-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 +4 -2
- package/dist-sdk/src/entities/agent-tool/to-tf.js +103 -17
- 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 +63 -13
- package/dist-sdk/src/entities/app/build.js +48 -1
- 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 -15
- 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 +9 -2
- package/dist-sdk/src/entities/app/to-tf.d.ts +5 -0
- package/dist-sdk/src/entities/app/to-tf.js +33 -4
- package/dist-sdk/src/entities/automation/build.d.ts +57 -13
- package/dist-sdk/src/entities/automation/build.js +48 -36
- 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 +179 -43
- package/dist-sdk/src/entities/automation/filter.d.ts +15 -3
- package/dist-sdk/src/entities/automation/filter.js +12 -2
- package/dist-sdk/src/entities/automation/from-tf.d.ts +26 -27
- package/dist-sdk/src/entities/automation/from-tf.js +1229 -223
- 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 +1134 -231
- 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 +23 -10
- package/dist-sdk/src/entities/element/build.js +1 -0
- package/dist-sdk/src/entities/element/from-tf.d.ts +1 -1
- package/dist-sdk/src/entities/element/from-tf.js +18 -3
- 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 +3 -1
- package/dist-sdk/src/entities/element/to-tf.js +21 -3
- package/dist-sdk/src/entities/field/build.d.ts +56 -13
- 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 +27 -9
- package/dist-sdk/src/entities/field/to-tf.js +62 -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 +44 -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 +31 -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 +36 -8
- 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 +6 -1
- package/dist-sdk/src/entities/skill/to-tf.js +3 -2
- package/dist-sdk/src/entities/skill/tools.d.ts +25 -3
- package/dist-sdk/src/entities/skill/tools.js +17 -0
- package/dist-sdk/src/entities/skill-tool/from-tf.d.ts +15 -2
- package/dist-sdk/src/entities/skill-tool/from-tf.js +32 -11
- package/dist-sdk/src/entities/skill-tool/to-tf.d.ts +2 -0
- package/dist-sdk/src/entities/skill-tool/to-tf.js +32 -9
- 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 +33 -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 +6 -1
- package/dist-sdk/src/graph/types.d.ts +77 -3
- package/package.json +42 -14
- 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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which LLM models are valid under each AI provider family. Hand-maintained
|
|
3
|
+
* against the platform's authoritative AiProviderType enum — not derivable
|
|
4
|
+
* from `provider/schema.graphql`'s flat `AiLlmModel` enum, whose naming
|
|
5
|
+
* doesn't cleanly partition by provider (e.g. unprefixed `CLAUDE_4_6_OPUS`
|
|
6
|
+
* is valid under `snowflake` with no per-provider naming convention to lean
|
|
7
|
+
* on). This list WILL drift as the platform ships new models — update it by
|
|
8
|
+
* hand when that happens (a live pull surfacing an unrecognized model is
|
|
9
|
+
* the usual signal), the same cadence as regenerating the live-captured
|
|
10
|
+
* `.hcl` test fixtures.
|
|
11
|
+
*
|
|
12
|
+
* Deepgram/ElevenLab are speech providers (their models are speech-to-text/
|
|
13
|
+
* text-to-speech, a different model space entirely) — left empty, which
|
|
14
|
+
* makes `AiProviderLlmModel<"deepgram" | "elevenlab">` resolve to `never`.
|
|
15
|
+
*/
|
|
16
|
+
export type AiProviderType = "anthropic" | "bedrock" | "custom" | "deepgram" | "elevenlab" | "gemini" | "openai" | "snowflake" | "xai" | "managed";
|
|
17
|
+
export declare const AI_PROVIDER_LLM_MODELS: {
|
|
18
|
+
readonly anthropic: readonly ["ANTHROPIC_CLAUDE_4_5_SONNET", "ANTHROPIC_CLAUDE_4_6_SONNET", "ANTHROPIC_CLAUDE_5_SONNET", "ANTHROPIC_CLAUDE_HAIKU_4_5", "ANTHROPIC_CLAUDE_4_6_OPUS", "ANTHROPIC_CLAUDE_4_7_OPUS", "ANTHROPIC_CLAUDE_4_8_OPUS"];
|
|
19
|
+
readonly bedrock: readonly ["BEDROCK_CLAUDE_4_5_SONNET", "BEDROCK_CLAUDE_4_6_SONNET", "BEDROCK_CLAUDE_5_SONNET", "BEDROCK_CLAUDE_4_6_OPUS", "BEDROCK_CLAUDE_4_7_OPUS", "BEDROCK_CLAUDE_4_8_OPUS", "BEDROCK_CLAUDE_HAIKU_4_5", "TITAN_EMBED_V1", "TITAN_EMBED_V2"];
|
|
20
|
+
readonly custom: readonly ["ANTHROPIC_CLAUDE_4_5_SONNET", "ANTHROPIC_CLAUDE_4_6_SONNET", "ANTHROPIC_CLAUDE_5_SONNET", "ANTHROPIC_CLAUDE_HAIKU_4_5", "ANTHROPIC_CLAUDE_4_6_OPUS", "ANTHROPIC_CLAUDE_4_7_OPUS", "ANTHROPIC_CLAUDE_4_8_OPUS", "GPT_5", "GPT_5_MINI", "GPT_5_NANO", "GPT_5_1", "GPT_5_2", "GPT_5_3", "GPT_5_3_CODEX", "GPT_5_4", "GPT_5_4_MINI", "GPT_5_4_NANO", "GPT_5_5", "GPT_5_6_SOL", "GPT_5_6_TERRA", "GPT_5_6_LUNA"];
|
|
21
|
+
readonly deepgram: readonly [];
|
|
22
|
+
readonly elevenlab: readonly [];
|
|
23
|
+
readonly gemini: readonly ["GEMINI_2_0_FLASH", "GEMINI_2_0_FLASH_LITE", "GEMINI_1_5_PRO", "GEMINI_2_5_PRO", "GEMINI_2_5_FLASH", "GEMINI_3_PRO"];
|
|
24
|
+
readonly managed: readonly ["MISTRAL_7B"];
|
|
25
|
+
readonly openai: readonly ["GPT_3_5_TURBO", "GPT_3_5_TURBO_1106", "GPT_4", "GPT_4_TURBO_PREVIEW", "GPT_4_OMNI", "GPT_4_OMNI_MINI", "GPT_4_OMNI_MINI_TTS", "GPT_4_OMNI_TRANSCRIBE", "GPT_4_OMNI_MINI_TRANSCRIBE", "OPEN_AI_O1_MINI", "OPEN_AI_O3_MINI", "GPT_4_1", "GPT_4_1_MINI", "GPT_4_1_NANO", "GPT_5", "GPT_5_MINI", "GPT_5_NANO", "GPT_5_1", "GPT_5_2", "GPT_5_3", "GPT_5_3_CODEX", "GPT_5_4", "GPT_5_4_MINI", "GPT_5_4_NANO", "GPT_5_5", "GPT_5_6_SOL", "GPT_5_6_TERRA", "GPT_5_6_LUNA"];
|
|
26
|
+
readonly snowflake: readonly ["CLAUDE_3_5_SONNET", "CLAUDE_3_7_SONNET", "CLAUDE_4_SONNET", "CLAUDE_4_5_SONNET", "CLAUDE_4_6_SONNET", "CLAUDE_5_SONNET", "CLAUDE_HAIKU_4_5", "CLAUDE_4_OPUS", "CLAUDE_4_6_OPUS", "CLAUDE_4_7_OPUS", "CLAUDE_4_8_OPUS", "DEEPSEEK_R1", "MISTRAL_LARGE", "MISTRAL_LARGE_2", "GEMMA_7B", "JAMBA_INSTRUCT", "MISTRAL_7B", "LLAMA2_70B_CHAT", "LLAMA3_8B", "LLAMA3_70B", "LLAMA3_405B", "LLAMA3_1_8B", "LLAMA3_1_70B", "LLAMA3_2_1B", "LLAMA3_2_3B", "LLAMA3_3_70B", "MIXTRAL_8X7B", "SNOWFLAKE_ARCTIC", "SNOWFLAKE_ARCTIC_M_V1_5", "SNOWFLAKE_ARCTIC_L_V2_0", "REKA_FLASH", "REKA_CORE", "CORTEX_GPT_4_1", "CORTEX_OPEN_AI_O4_MINI", "CORTEX_GPT_5", "CORTEX_GPT_5_MINI", "CORTEX_GPT_5_NANO", "CORTEX_GPT_5_CHAT", "CORTEX_GPT_5_6_SOL", "CORTEX_GPT_5_6_TERRA", "CORTEX_GPT_5_6_LUNA"];
|
|
27
|
+
readonly xai: readonly ["GROK_4_FAST_NON_REASONING", "GROK_4_FAST_REASONING", "GROK_4_1_FAST_NON_REASONING", "GROK_4_1_FAST_REASONING"];
|
|
28
|
+
};
|
|
29
|
+
/** Valid LLM model identifiers for provider type `T` (all types if omitted). `never` for a provider with no LLM models (deepgram/elevenlab today). */
|
|
30
|
+
export type AiProviderLlmModel<T extends AiProviderType = AiProviderType> = (typeof AI_PROVIDER_LLM_MODELS)[T][number];
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Which LLM models are valid under each AI provider family. Hand-maintained
|
|
3
|
+
* against the platform's authoritative AiProviderType enum — not derivable
|
|
4
|
+
* from `provider/schema.graphql`'s flat `AiLlmModel` enum, whose naming
|
|
5
|
+
* doesn't cleanly partition by provider (e.g. unprefixed `CLAUDE_4_6_OPUS`
|
|
6
|
+
* is valid under `snowflake` with no per-provider naming convention to lean
|
|
7
|
+
* on). This list WILL drift as the platform ships new models — update it by
|
|
8
|
+
* hand when that happens (a live pull surfacing an unrecognized model is
|
|
9
|
+
* the usual signal), the same cadence as regenerating the live-captured
|
|
10
|
+
* `.hcl` test fixtures.
|
|
11
|
+
*
|
|
12
|
+
* Deepgram/ElevenLab are speech providers (their models are speech-to-text/
|
|
13
|
+
* text-to-speech, a different model space entirely) — left empty, which
|
|
14
|
+
* makes `AiProviderLlmModel<"deepgram" | "elevenlab">` resolve to `never`.
|
|
15
|
+
*/
|
|
16
|
+
export const AI_PROVIDER_LLM_MODELS = {
|
|
17
|
+
anthropic: [
|
|
18
|
+
"ANTHROPIC_CLAUDE_4_5_SONNET", "ANTHROPIC_CLAUDE_4_6_SONNET", "ANTHROPIC_CLAUDE_5_SONNET",
|
|
19
|
+
"ANTHROPIC_CLAUDE_HAIKU_4_5", "ANTHROPIC_CLAUDE_4_6_OPUS", "ANTHROPIC_CLAUDE_4_7_OPUS",
|
|
20
|
+
"ANTHROPIC_CLAUDE_4_8_OPUS",
|
|
21
|
+
],
|
|
22
|
+
bedrock: [
|
|
23
|
+
"BEDROCK_CLAUDE_4_5_SONNET", "BEDROCK_CLAUDE_4_6_SONNET", "BEDROCK_CLAUDE_5_SONNET",
|
|
24
|
+
"BEDROCK_CLAUDE_4_6_OPUS", "BEDROCK_CLAUDE_4_7_OPUS", "BEDROCK_CLAUDE_4_8_OPUS",
|
|
25
|
+
"BEDROCK_CLAUDE_HAIKU_4_5", "TITAN_EMBED_V1", "TITAN_EMBED_V2",
|
|
26
|
+
],
|
|
27
|
+
custom: [
|
|
28
|
+
"ANTHROPIC_CLAUDE_4_5_SONNET", "ANTHROPIC_CLAUDE_4_6_SONNET", "ANTHROPIC_CLAUDE_5_SONNET",
|
|
29
|
+
"ANTHROPIC_CLAUDE_HAIKU_4_5", "ANTHROPIC_CLAUDE_4_6_OPUS", "ANTHROPIC_CLAUDE_4_7_OPUS",
|
|
30
|
+
"ANTHROPIC_CLAUDE_4_8_OPUS", "GPT_5", "GPT_5_MINI", "GPT_5_NANO", "GPT_5_1", "GPT_5_2",
|
|
31
|
+
"GPT_5_3", "GPT_5_3_CODEX", "GPT_5_4", "GPT_5_4_MINI", "GPT_5_4_NANO", "GPT_5_5",
|
|
32
|
+
"GPT_5_6_SOL", "GPT_5_6_TERRA", "GPT_5_6_LUNA",
|
|
33
|
+
],
|
|
34
|
+
deepgram: [],
|
|
35
|
+
elevenlab: [],
|
|
36
|
+
gemini: [
|
|
37
|
+
"GEMINI_2_0_FLASH", "GEMINI_2_0_FLASH_LITE", "GEMINI_1_5_PRO", "GEMINI_2_5_PRO",
|
|
38
|
+
"GEMINI_2_5_FLASH", "GEMINI_3_PRO",
|
|
39
|
+
],
|
|
40
|
+
managed: ["MISTRAL_7B"],
|
|
41
|
+
openai: [
|
|
42
|
+
"GPT_3_5_TURBO", "GPT_3_5_TURBO_1106", "GPT_4", "GPT_4_TURBO_PREVIEW", "GPT_4_OMNI",
|
|
43
|
+
"GPT_4_OMNI_MINI", "GPT_4_OMNI_MINI_TTS", "GPT_4_OMNI_TRANSCRIBE", "GPT_4_OMNI_MINI_TRANSCRIBE",
|
|
44
|
+
"OPEN_AI_O1_MINI", "OPEN_AI_O3_MINI", "GPT_4_1", "GPT_4_1_MINI", "GPT_4_1_NANO", "GPT_5",
|
|
45
|
+
"GPT_5_MINI", "GPT_5_NANO", "GPT_5_1", "GPT_5_2", "GPT_5_3", "GPT_5_3_CODEX", "GPT_5_4",
|
|
46
|
+
"GPT_5_4_MINI", "GPT_5_4_NANO", "GPT_5_5", "GPT_5_6_SOL", "GPT_5_6_TERRA", "GPT_5_6_LUNA",
|
|
47
|
+
],
|
|
48
|
+
snowflake: [
|
|
49
|
+
"CLAUDE_3_5_SONNET", "CLAUDE_3_7_SONNET", "CLAUDE_4_SONNET", "CLAUDE_4_5_SONNET",
|
|
50
|
+
"CLAUDE_4_6_SONNET", "CLAUDE_5_SONNET", "CLAUDE_HAIKU_4_5", "CLAUDE_4_OPUS", "CLAUDE_4_6_OPUS",
|
|
51
|
+
"CLAUDE_4_7_OPUS", "CLAUDE_4_8_OPUS", "DEEPSEEK_R1", "MISTRAL_LARGE", "MISTRAL_LARGE_2",
|
|
52
|
+
"GEMMA_7B", "JAMBA_INSTRUCT", "MISTRAL_7B", "LLAMA2_70B_CHAT", "LLAMA3_8B", "LLAMA3_70B",
|
|
53
|
+
"LLAMA3_405B", "LLAMA3_1_8B", "LLAMA3_1_70B", "LLAMA3_2_1B", "LLAMA3_2_3B", "LLAMA3_3_70B",
|
|
54
|
+
"MIXTRAL_8X7B", "SNOWFLAKE_ARCTIC", "SNOWFLAKE_ARCTIC_M_V1_5", "SNOWFLAKE_ARCTIC_L_V2_0",
|
|
55
|
+
"REKA_FLASH", "REKA_CORE", "CORTEX_GPT_4_1", "CORTEX_OPEN_AI_O4_MINI", "CORTEX_GPT_5",
|
|
56
|
+
"CORTEX_GPT_5_MINI", "CORTEX_GPT_5_NANO", "CORTEX_GPT_5_CHAT", "CORTEX_GPT_5_6_SOL",
|
|
57
|
+
"CORTEX_GPT_5_6_TERRA", "CORTEX_GPT_5_6_LUNA",
|
|
58
|
+
],
|
|
59
|
+
xai: [
|
|
60
|
+
"GROK_4_FAST_NON_REASONING", "GROK_4_FAST_REASONING", "GROK_4_1_FAST_NON_REASONING",
|
|
61
|
+
"GROK_4_1_FAST_REASONING",
|
|
62
|
+
],
|
|
63
|
+
};
|
|
@@ -18,7 +18,37 @@
|
|
|
18
18
|
* the object satisfies `CatalogRef`'s structural shape before bag-level stamping;
|
|
19
19
|
* nothing reads those interim values.
|
|
20
20
|
*/
|
|
21
|
-
import type {
|
|
21
|
+
import type { AiProviderLlmModel, AiProviderType } from "./ai-provider-models.js";
|
|
22
|
+
import type { AgentRef, AiProviderRef, ApprovalChainRef, AutomationCatalogRef, CatalogRef, CategoryRef, CloudLinkRef, ConnectorRef, GroupRef, FileReaderCatalogRef, DocumentModelFieldRef, FieldRef, FlowRef, OutputPropertyRef, SearchTableRef, SkillRef, TableColumnRef, TableRef, TriggerParameterRef } from "./types.js";
|
|
23
|
+
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
24
|
+
export declare const usersCatalog: {
|
|
25
|
+
readonly fields: {
|
|
26
|
+
readonly firstName: {
|
|
27
|
+
readonly __kind: "userField";
|
|
28
|
+
readonly refName: "firstName";
|
|
29
|
+
readonly name: "firstName";
|
|
30
|
+
readonly fieldType: "TEXT";
|
|
31
|
+
};
|
|
32
|
+
readonly email: {
|
|
33
|
+
readonly __kind: "userField";
|
|
34
|
+
readonly refName: "email";
|
|
35
|
+
readonly name: "email";
|
|
36
|
+
readonly fieldType: "TEXT";
|
|
37
|
+
};
|
|
38
|
+
readonly jobTitle: {
|
|
39
|
+
readonly __kind: "userField";
|
|
40
|
+
readonly refName: "jobTitle";
|
|
41
|
+
readonly name: "jobTitle";
|
|
42
|
+
readonly fieldType: "TEXT";
|
|
43
|
+
};
|
|
44
|
+
readonly lastName: {
|
|
45
|
+
readonly __kind: "userField";
|
|
46
|
+
readonly refName: "lastName";
|
|
47
|
+
readonly name: "lastName";
|
|
48
|
+
readonly fieldType: "TEXT";
|
|
49
|
+
};
|
|
50
|
+
};
|
|
51
|
+
};
|
|
22
52
|
/** An app/element catalog's bags: reference-only kinds plus behavioral kinds sourced from authoring files. */
|
|
23
53
|
interface AppCatalogBags {
|
|
24
54
|
readonly fields?: Record<string, FieldRef>;
|
|
@@ -68,6 +98,7 @@ export declare const triggerParameterRef: <const T extends {
|
|
|
68
98
|
export declare function documentModelRef<F extends Readonly<Record<string, DocumentModelFieldRef>> | undefined = undefined>(opts: {
|
|
69
99
|
readonly name: string;
|
|
70
100
|
readonly parent?: string;
|
|
101
|
+
readonly readerType: FileReaderCatalogRef["readerType"];
|
|
71
102
|
readonly fields?: F;
|
|
72
103
|
}): FileReaderCatalogRef & {
|
|
73
104
|
readonly fields: F;
|
|
@@ -114,6 +145,28 @@ export declare const connectorRef: (opts: Omit<ConnectorRef, "refName" | "__kind
|
|
|
114
145
|
readonly __kind: "connector";
|
|
115
146
|
readonly refName: string;
|
|
116
147
|
};
|
|
148
|
+
/**
|
|
149
|
+
* AI provider ref — reference only, the provider must already exist on the
|
|
150
|
+
* platform (never created/deployed). Accepts an optional `models` bag whose
|
|
151
|
+
* entries are either connector refs (`connectorRef({ name })`, what `pull
|
|
152
|
+
* org` always emits) or a bare model literal naming a connector to create
|
|
153
|
+
* for that model — type-checked against `type`'s valid models
|
|
154
|
+
* (`AiProviderLlmModel`). `handle` is injected by the enclosing
|
|
155
|
+
* `orgCatalog`, which also stamps each nested ref-shaped model's `.parent`
|
|
156
|
+
* to this provider's own key.
|
|
157
|
+
*
|
|
158
|
+
* A hand-rolled generic (not built through `refFactory`, which fixes its
|
|
159
|
+
* type parameter once at definition time and would widen `type` away from
|
|
160
|
+
* its literal) — same `const T extends ...` trick as {@link fieldRef} so
|
|
161
|
+
* `type: "anthropic"` narrows which models are valid at each call site.
|
|
162
|
+
*/
|
|
163
|
+
export declare function defineAiProvider<T extends AiProviderType, M extends Readonly<Record<string, ConnectorRef | AiProviderLlmModel<T>>> | undefined = undefined>(opts: {
|
|
164
|
+
readonly name: string;
|
|
165
|
+
readonly type: T;
|
|
166
|
+
readonly models?: M;
|
|
167
|
+
}): AiProviderRef<T> & {
|
|
168
|
+
readonly models: M;
|
|
169
|
+
};
|
|
117
170
|
export declare const cloudLinkRef: (opts: Omit<CloudLinkRef, "refName" | "__kind">) => Omit<CloudLinkRef, "refName" | "__kind"> & {
|
|
118
171
|
readonly __kind: "cloudLink";
|
|
119
172
|
readonly refName: string;
|
|
@@ -171,13 +224,13 @@ export declare function elementCatalog<B extends AppCatalogBags>(identity: {
|
|
|
171
224
|
/**
|
|
172
225
|
* Assemble the org catalog object. Produces `{ handle: "org", name: "Org", ...bags }`.
|
|
173
226
|
* No `__kind` — the org is not a `CatalogRef` kind and is referenced only as
|
|
174
|
-
* a namespace (`org.
|
|
227
|
+
* a namespace (`org.aiProviders.X.models.Y`, `org.cloudLinks.Y`), never passed as a ref.
|
|
175
228
|
* `"org"` is a fixed singleton namespace, not derived from any entity's name —
|
|
176
229
|
* unlike every other identity in this file, it's not a ref name. Bag entries'
|
|
177
230
|
* `.handle` are stamped from their own key, same as `appCatalog`.
|
|
178
231
|
*/
|
|
179
232
|
export declare function orgCatalog<B extends {
|
|
180
|
-
|
|
233
|
+
aiProviders?: Record<string, AiProviderRef>;
|
|
181
234
|
cloudLinks?: Record<string, CloudLinkRef>;
|
|
182
235
|
categories?: Record<string, CategoryRef>;
|
|
183
236
|
groups?: Record<string, GroupRef>;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/** Fixed platform user-directory schema used by userSearch filters. */
|
|
2
|
+
export const usersCatalog = {
|
|
3
|
+
fields: {
|
|
4
|
+
firstName: { __kind: "userField", refName: "firstName", name: "firstName", fieldType: "TEXT" },
|
|
5
|
+
email: { __kind: "userField", refName: "email", name: "email", fieldType: "TEXT" },
|
|
6
|
+
jobTitle: { __kind: "userField", refName: "jobTitle", name: "jobTitle", fieldType: "TEXT" },
|
|
7
|
+
lastName: { __kind: "userField", refName: "lastName", name: "lastName", fieldType: "TEXT" },
|
|
8
|
+
},
|
|
9
|
+
};
|
|
1
10
|
/** Build a ref-kind factory: no identity parameter, `.refName` defaults to `name` (stamped over by the enclosing bag). */
|
|
2
11
|
function refFactory(kind) {
|
|
3
12
|
return (opts) => ({ __kind: kind, refName: opts.name, ...opts });
|
|
@@ -39,6 +48,7 @@ export function documentModelRef(opts) {
|
|
|
39
48
|
__kind: "documentModel",
|
|
40
49
|
refName: opts.name,
|
|
41
50
|
name: opts.name,
|
|
51
|
+
readerType: opts.readerType,
|
|
42
52
|
...(opts.parent !== undefined ? { parent: opts.parent } : {}),
|
|
43
53
|
...(opts.fields !== undefined ? { fields: opts.fields } : {}),
|
|
44
54
|
};
|
|
@@ -69,6 +79,30 @@ export const flowRef = refFactory("flow");
|
|
|
69
79
|
export const approvalChainRef = refFactory("approvalChain");
|
|
70
80
|
export const searchTableRef = refFactory("searchTable");
|
|
71
81
|
export const connectorRef = refFactory("connector");
|
|
82
|
+
/**
|
|
83
|
+
* AI provider ref — reference only, the provider must already exist on the
|
|
84
|
+
* platform (never created/deployed). Accepts an optional `models` bag whose
|
|
85
|
+
* entries are either connector refs (`connectorRef({ name })`, what `pull
|
|
86
|
+
* org` always emits) or a bare model literal naming a connector to create
|
|
87
|
+
* for that model — type-checked against `type`'s valid models
|
|
88
|
+
* (`AiProviderLlmModel`). `handle` is injected by the enclosing
|
|
89
|
+
* `orgCatalog`, which also stamps each nested ref-shaped model's `.parent`
|
|
90
|
+
* to this provider's own key.
|
|
91
|
+
*
|
|
92
|
+
* A hand-rolled generic (not built through `refFactory`, which fixes its
|
|
93
|
+
* type parameter once at definition time and would widen `type` away from
|
|
94
|
+
* its literal) — same `const T extends ...` trick as {@link fieldRef} so
|
|
95
|
+
* `type: "anthropic"` narrows which models are valid at each call site.
|
|
96
|
+
*/
|
|
97
|
+
export function defineAiProvider(opts) {
|
|
98
|
+
return {
|
|
99
|
+
__kind: "aiProvider",
|
|
100
|
+
refName: opts.name,
|
|
101
|
+
name: opts.name,
|
|
102
|
+
type: opts.type,
|
|
103
|
+
...(opts.models !== undefined ? { models: opts.models } : {}),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
72
106
|
export const cloudLinkRef = refFactory("cloudLink");
|
|
73
107
|
export const categoryRef = refFactory("category");
|
|
74
108
|
export const groupRef = refFactory("group");
|
|
@@ -183,7 +217,7 @@ export function elementCatalog(identity, bags) {
|
|
|
183
217
|
/**
|
|
184
218
|
* Assemble the org catalog object. Produces `{ handle: "org", name: "Org", ...bags }`.
|
|
185
219
|
* No `__kind` — the org is not a `CatalogRef` kind and is referenced only as
|
|
186
|
-
* a namespace (`org.
|
|
220
|
+
* a namespace (`org.aiProviders.X.models.Y`, `org.cloudLinks.Y`), never passed as a ref.
|
|
187
221
|
* `"org"` is a fixed singleton namespace, not derived from any entity's name —
|
|
188
222
|
* unlike every other identity in this file, it's not a ref name. Bag entries'
|
|
189
223
|
* `.handle` are stamped from their own key, same as `appCatalog`.
|
|
@@ -193,10 +227,39 @@ export function orgCatalog(bags) {
|
|
|
193
227
|
handle: "org",
|
|
194
228
|
name: "Org",
|
|
195
229
|
...bags,
|
|
196
|
-
|
|
230
|
+
aiProviders: stampAiProviders(bags.aiProviders),
|
|
197
231
|
cloudLinks: withOwnKeyAsHandle(bags.cloudLinks) ?? {},
|
|
198
232
|
categories: withOwnKeyAsHandle(bags.categories) ?? {},
|
|
199
233
|
groups: withOwnKeyAsHandle(bags.groups) ?? {},
|
|
200
234
|
tables: stampTableRefs(bags.tables) ?? {},
|
|
201
235
|
};
|
|
202
236
|
}
|
|
237
|
+
/**
|
|
238
|
+
* Stamp each provider's own `.refName`/`.handle` from its bag key (same as
|
|
239
|
+
* `withOwnKeyAsHandle`), and — since a provider's `models` bag is nested
|
|
240
|
+
* one level deeper than every other org bag — also stamp each ref-shaped
|
|
241
|
+
* model's `.parent` to the owning provider's key, so a connector ref
|
|
242
|
+
* self-describes which provider it came from. A bare model-literal entry
|
|
243
|
+
* (a create-intent, not yet a ref) has nothing to stamp and passes through
|
|
244
|
+
* unchanged — `withOwnKeyAsHandle` can't be reused here since its generic
|
|
245
|
+
* constraint requires every entry to already be a `CatalogRef`.
|
|
246
|
+
*/
|
|
247
|
+
function stampAiProviders(bag) {
|
|
248
|
+
const stamped = withOwnKeyAsHandle(bag);
|
|
249
|
+
if (stamped === undefined)
|
|
250
|
+
return {};
|
|
251
|
+
const out = {};
|
|
252
|
+
for (const [providerKey, provider] of Object.entries(stamped)) {
|
|
253
|
+
out[providerKey] = { ...provider, models: stampAiProviderModels(provider.models, providerKey) };
|
|
254
|
+
}
|
|
255
|
+
return out;
|
|
256
|
+
}
|
|
257
|
+
function stampAiProviderModels(models, providerKey) {
|
|
258
|
+
if (models === undefined)
|
|
259
|
+
return {};
|
|
260
|
+
const out = {};
|
|
261
|
+
for (const [modelKey, model] of Object.entries(models)) {
|
|
262
|
+
out[modelKey] = typeof model === "string" ? model : { ...model, refName: modelKey, parent: providerKey };
|
|
263
|
+
}
|
|
264
|
+
return out;
|
|
265
|
+
}
|
|
@@ -363,7 +363,12 @@ export async function writeAppCatalogFromAuthoring(appDir, appRefName, appName,
|
|
|
363
363
|
fromBags.push(...Object.values(bag));
|
|
364
364
|
}
|
|
365
365
|
const flatRefs = dedupeCatalogRefs([...Object.values(fields), ...fromBags, ...extraRefs]);
|
|
366
|
-
|
|
366
|
+
// Fields resolve live off the app's own file (see `renderCatalog`'s `ownFile`
|
|
367
|
+
// param) — never baked, so adding/editing/removing a field never requires
|
|
368
|
+
// re-running this writer. `flatRefs`' field entries still flow through
|
|
369
|
+
// (extraRefs/dedupe), but rendering ignores them when `ownFile` is set.
|
|
370
|
+
const ownFile = { importPath: `../${basename(appFile).replace(/\.ts$/, ".js")}`, identifier: `${appRefName}Own` };
|
|
371
|
+
const source = renderCatalog({ kind: refs.__kind, refName: appRefName, name: appName }, flatRefs, undefined, ownFile);
|
|
367
372
|
const generatedDir = join(appDir, "generated");
|
|
368
373
|
const catalogPath = join(generatedDir, CATALOG_FILENAME);
|
|
369
374
|
await mkdir(generatedDir, { recursive: true });
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* the typed app catalog. Handles (from `src/handles`) key the fragments; no
|
|
4
4
|
* ids appear here (identity lives in `src/deploy/state`).
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
6
|
+
export { AI_PROVIDER_LLM_MODELS, type AiProviderLlmModel, type AiProviderType } from "./ai-provider-models.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, type AgentRef, type AiProviderRef, type ApprovalChainRef, type AspectRef, type AutomationCatalogRef, type AutomationRef, type CatalogRef, type CatalogRefKind, type CategoryRef, type CloudLinkRef, type ConnectorRef, type GroupRef, type FileReaderCatalogRef, type DocumentModelFieldRef, type FieldRef, type FlowRef, type OutputPropertyRef, type SearchTableRef, type SkillRef, type TableColumnRef, type TableRef, type TriggerParameterRef, USER_FIELD_KEYS, type UserFieldKey, type UserFieldRef, } from "./types.js";
|
|
7
8
|
export { renderBarrel, renderCatalog, renderFragment, type BarrelEntry, type BarrelRoot, } from "./render.js";
|
|
8
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, type CatalogTarget, } from "./write.js";
|
|
9
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
10
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, type AppAuthoringCatalog, type AppCatalogRegenResult, type ConfiguredEntity, } from "./from-authoring.js";
|
|
11
|
-
export { agentRef, appCatalog, approvalChainRef, automationRef, categoryRef, cloudLinkRef, connectorRef, groupRef, documentModelFieldRef, documentModelRef, elementCatalog, fieldRef, flowRef, orgCatalog, outputPropertyRef, searchTableRef, skillRef, tableColumnRef, tableRef, triggerParameterRef, } from "./factories.js";
|
|
12
|
+
export { agentRef, appCatalog, approvalChainRef, automationRef, categoryRef, cloudLinkRef, connectorRef, defineAiProvider, groupRef, documentModelFieldRef, documentModelRef, elementCatalog, fieldRef, flowRef, orgCatalog, outputPropertyRef, searchTableRef, skillRef, tableColumnRef, tableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
* the typed app catalog. Handles (from `src/handles`) key the fragments; no
|
|
4
4
|
* ids appear here (identity lives in `src/deploy/state`).
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
6
|
+
export { AI_PROVIDER_LLM_MODELS } from "./ai-provider-models.js";
|
|
7
|
+
export { REF_SCOPE, REF_UPDATABLE, USER_FIELD_KEYS, } from "./types.js";
|
|
7
8
|
export { renderBarrel, renderCatalog, renderFragment, } from "./render.js";
|
|
8
9
|
export { appCatalogTarget, barrelPathFor, orgCatalogTarget, regenerateBarrel, writeCatalog, writeFlatCatalog, writeFragment, } from "./write.js";
|
|
9
10
|
export { isCatalogToken, slimToken, slimTokens } from "./token.js";
|
|
10
11
|
export { buildAppCatalogFromAuthoring, listEntityFilesFromPaths, refNameOf, regenerateAppCatalogsUnder, writeAppCatalog, writeAppCatalogFromAuthoring, } from "./from-authoring.js";
|
|
11
|
-
export { agentRef, appCatalog, approvalChainRef, automationRef, categoryRef, cloudLinkRef, connectorRef, groupRef, documentModelFieldRef, documentModelRef, elementCatalog, fieldRef, flowRef, orgCatalog, outputPropertyRef, searchTableRef, skillRef, tableColumnRef, tableRef, triggerParameterRef, } from "./factories.js";
|
|
12
|
+
export { agentRef, appCatalog, approvalChainRef, automationRef, categoryRef, cloudLinkRef, connectorRef, defineAiProvider, groupRef, documentModelFieldRef, documentModelRef, elementCatalog, fieldRef, flowRef, orgCatalog, outputPropertyRef, searchTableRef, skillRef, tableColumnRef, tableRef, triggerParameterRef, usersCatalog, } from "./factories.js";
|
|
@@ -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,11 +89,76 @@ function renderOrgTs(extract) {
|
|
|
78
89
|
lines.push("});", "");
|
|
79
90
|
return lines.join("\n");
|
|
80
91
|
}
|
|
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
|
+
}
|
|
81
156
|
/** Render generated/catalog.ts as a pure barrel over org.ts + disk-scanned catalogs. */
|
|
82
157
|
function renderBarrel(appHandles, elementHandles, tableHandles) {
|
|
83
158
|
const { elementKeys, tableImports, lines: importLines } = aspectImportLines(appHandles, elementHandles, tableHandles);
|
|
84
159
|
const lines = [
|
|
85
160
|
'import { org } from "../org.js";',
|
|
161
|
+
'import { usersCatalog } from "@elementumai/edk/catalog";',
|
|
86
162
|
...importLines,
|
|
87
163
|
"",
|
|
88
164
|
"const catalog = {",
|
|
@@ -93,7 +169,8 @@ function renderBarrel(appHandles, elementHandles, tableHandles) {
|
|
|
93
169
|
const key = elementKeys.get(h);
|
|
94
170
|
lines.push(key === h ? ` ${h},` : ` ${key},`);
|
|
95
171
|
}
|
|
96
|
-
lines.push("
|
|
172
|
+
lines.push(" users: usersCatalog,");
|
|
173
|
+
lines.push(" aiProviders: org.aiProviders,");
|
|
97
174
|
lines.push(" cloudLinks: org.cloudLinks,");
|
|
98
175
|
lines.push(" categories: org.categories,");
|
|
99
176
|
lines.push(" groups: org.groups,");
|
|
@@ -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,24 @@ 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
|
+
// Same reasoning for a file reader: build needs to know which of the
|
|
41
|
+
// excel/json/text/xml/ai resource types backs it to emit the right
|
|
42
|
+
// `elementum_<type>_file_reader.<label>.id` reference - without this,
|
|
43
|
+
// slimToken silently dropped readerType and automationToTf's
|
|
44
|
+
// documentModel case threw "no recognized readerType" on every readFile
|
|
45
|
+
// task build.
|
|
46
|
+
if (token.__kind === "documentModel" && typeof token.readerType === "string")
|
|
47
|
+
out.readerType = token.readerType;
|
|
48
|
+
if (token.__kind === "field" && Array.isArray(token.options)) {
|
|
49
|
+
out.options = token.options.filter((option) => typeof option === "string");
|
|
50
|
+
}
|
|
37
51
|
if ((token.__kind === "field" || token.__kind === "tableColumn") && Array.isArray(token.tags)) {
|
|
38
52
|
out.tags = token.tags.filter((tag) => typeof tag === "string");
|
|
39
53
|
}
|