@nextblock-cms/cortex 0.12.2
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/client.cjs.js +1 -0
- package/client.d.ts +1 -0
- package/client.es.js +4 -0
- package/index.cjs.js +1 -0
- package/index.d.ts +13 -0
- package/index.es.js +135 -0
- package/lib/ai-block-generation.cjs.js +5 -0
- package/lib/ai-block-generation.d.ts +21 -0
- package/lib/ai-block-generation.es.js +195 -0
- package/lib/ai-client.cjs.js +1 -0
- package/lib/ai-client.d.ts +48 -0
- package/lib/ai-client.es.js +141 -0
- package/lib/ai-config.cjs.js +1 -0
- package/lib/ai-config.d.ts +31 -0
- package/lib/ai-config.es.js +72 -0
- package/lib/ai-cortex-widget-builder.cjs.js +1 -0
- package/lib/ai-cortex-widget-builder.d.ts +14 -0
- package/lib/ai-cortex-widget-builder.es.js +72 -0
- package/lib/ai-global-agent-custom-block-tools.cjs.js +1 -0
- package/lib/ai-global-agent-custom-block-tools.d.ts +208 -0
- package/lib/ai-global-agent-custom-block-tools.es.js +220 -0
- package/lib/ai-global-agent-db-tools.cjs.js +1 -0
- package/lib/ai-global-agent-db-tools.d.ts +280 -0
- package/lib/ai-global-agent-db-tools.es.js +879 -0
- package/lib/ai-global-agent-ecommerce.cjs.js +1 -0
- package/lib/ai-global-agent-ecommerce.d.ts +2 -0
- package/lib/ai-global-agent-ecommerce.es.js +7 -0
- package/lib/ai-global-agent-tools.cjs.js +15 -0
- package/lib/ai-global-agent-tools.d.ts +3109 -0
- package/lib/ai-global-agent-tools.es.js +2812 -0
- package/lib/ai-key-crypto.cjs.js +1 -0
- package/lib/ai-key-crypto.d.ts +32 -0
- package/lib/ai-key-crypto.es.js +88 -0
- package/lib/ai-model-catalog.cjs.js +1 -0
- package/lib/ai-model-catalog.d.ts +7 -0
- package/lib/ai-model-catalog.es.js +25 -0
- package/lib/ai-model-registry.cjs.js +3 -0
- package/lib/ai-model-registry.d.ts +79 -0
- package/lib/ai-model-registry.es.js +279 -0
- package/lib/cortex-widget-registry.cjs.js +1 -0
- package/lib/cortex-widget-registry.d.ts +19 -0
- package/lib/cortex-widget-registry.es.js +47 -0
- package/lib/cortex-widget-schema.cjs.js +5 -0
- package/lib/cortex-widget-schema.d.ts +224 -0
- package/lib/cortex-widget-schema.es.js +316 -0
- package/lib/zod-config.cjs.js +1 -0
- package/lib/zod-config.d.ts +2 -0
- package/lib/zod-config.es.js +6 -0
- package/package.json +39 -0
package/client.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./lib/ai-model-registry.cjs.js");exports.createCortexAiStoredModelSelection=e.createCortexAiStoredModelSelection;
|
package/client.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { createCortexAiStoredModelSelection, type CortexAiStoredModelSelection, } from './lib/ai-model-registry';
|
package/client.es.js
ADDED
package/index.cjs.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const u=require("./lib/ai-block-generation.cjs.js"),n=require("./lib/ai-client.cjs.js"),r=require("./lib/ai-config.cjs.js"),C=require("./lib/ai-cortex-widget-builder.cjs.js"),a=require("./lib/ai-global-agent-custom-block-tools.cjs.js"),i=require("./lib/ai-global-agent-db-tools.cjs.js"),e=require("./lib/ai-global-agent-tools.cjs.js"),c=require("./lib/ai-key-crypto.cjs.js"),m=require("./lib/ai-model-catalog.cjs.js"),t=require("./lib/ai-model-registry.cjs.js"),l=require("./lib/cortex-widget-registry.cjs.js"),o=require("./lib/cortex-widget-schema.cjs.js");require("./lib/zod-config.cjs.js");const d=require("zod");exports.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT=u.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT;exports.generateEditorBlocksRequestSchema=u.generateEditorBlocksRequestSchema;exports.generateEditorHtmlFragment=u.generateEditorHtmlFragment;exports.validateGeneratedEditorHtmlFragment=u.validateGeneratedEditorHtmlFragment;exports.createCortexAiOpenRouterClient=n.createCortexAiOpenRouterClient;exports.createCortexAiOpenRouterProvider=n.createCortexAiOpenRouterProvider;exports.generateCortexAiText=n.generateCortexAiText;exports.getStoredCortexAiModelSelection=n.getStoredCortexAiModelSelection;exports.resolveCortexAiOpenRouterCredential=n.resolveCortexAiOpenRouterCredential;exports.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY=r.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY;exports.CORTEX_AI_OPENROUTER_SETTING_KEY=r.CORTEX_AI_OPENROUTER_SETTING_KEY;exports.CORTEX_AI_PACKAGE_ID=r.CORTEX_AI_PACKAGE_ID;exports.CORTEX_AI_PACKAGE_NAME=r.CORTEX_AI_PACKAGE_NAME;exports.decryptStoredOpenRouterApiKey=r.decryptStoredOpenRouterApiKey;exports.encryptStoredOpenRouterApiKey=r.encryptStoredOpenRouterApiKey;exports.getCortexAiEnvConfig=r.getCortexAiEnvConfig;exports.getEnvOpenRouterKeyStatus=r.getEnvOpenRouterKeyStatus;exports.getOpenRouterEnvApiKey=r.getOpenRouterEnvApiKey;exports.getStoredOpenRouterKeyStatus=r.getStoredOpenRouterKeyStatus;exports.generateCortexWidgetDefinition=C.generateCortexWidgetDefinition;exports.createCortexCustomBlockTools=a.createCortexCustomBlockTools;exports.createCustomBlockInputSchema=a.createCustomBlockInputSchema;exports.deleteCustomBlockInputSchema=a.deleteCustomBlockInputSchema;exports.executeCreateCustomBlock=a.executeCreateCustomBlock;exports.executeDeleteCustomBlock=a.executeDeleteCustomBlock;exports.executeListCustomBlocks=a.executeListCustomBlocks;exports.executeUpdateCustomBlock=a.executeUpdateCustomBlock;exports.listCustomBlocksInputSchema=a.listCustomBlocksInputSchema;exports.updateCustomBlockInputSchema=a.updateCustomBlockInputSchema;exports.createCortexDatabaseAgentTools=i.createCortexDatabaseAgentTools;exports.describeDatabaseSchemaInputSchema=i.describeDatabaseSchemaInputSchema;exports.executeDatabaseActionPlan=i.executeDatabaseActionPlan;exports.executeDatabaseActionPlanInputSchema=i.executeDatabaseActionPlanInputSchema;exports.executeDatabaseMutation=i.executeDatabaseMutation;exports.executeDatabaseMutationInputSchema=i.executeDatabaseMutationInputSchema;exports.executeDescribeDatabaseSchema=i.executeDescribeDatabaseSchema;exports.executeReadDatabaseRecords=i.executeReadDatabaseRecords;exports.readDatabaseRecordsInputSchema=i.readDatabaseRecordsInputSchema;exports.availableCortexAiBlockTypes=e.availableCortexAiBlockTypes;exports.buildVisibleContactIntroActionPlan=e.buildVisibleContactIntroActionPlan;exports.cortexAiPageContextSchema=e.cortexAiPageContextSchema;exports.createCmsPageInputSchema=e.createCmsPageInputSchema;exports.createCmsPostInputSchema=e.createCmsPostInputSchema;exports.createCmsProductInputSchema=e.createCmsProductInputSchema;exports.createCortexGlobalAgentTools=e.createCortexGlobalAgentTools;exports.deleteCmsItemInputSchema=e.deleteCmsItemInputSchema;exports.executeCmsActionPlan=e.executeCmsActionPlan;exports.executeCmsActionPlanInputSchema=e.executeCmsActionPlanInputSchema;exports.executeCreateCmsPage=e.executeCreateCmsPage;exports.executeCreateCmsPost=e.executeCreateCmsPost;exports.executeCreateCmsProduct=e.executeCreateCmsProduct;exports.executeDeleteCmsItem=e.executeDeleteCmsItem;exports.executeFetchEcommerceStats=e.executeFetchEcommerceStats;exports.executeInsertContentBlock=e.executeInsertContentBlock;exports.executePrepareDeleteCmsItem=e.executePrepareDeleteCmsItem;exports.executeReadCurrentCmsItem=e.executeReadCurrentCmsItem;exports.executeSearchDocumentation=e.executeSearchDocumentation;exports.executeSearchDocumentationWithTimeout=e.executeSearchDocumentationWithTimeout;exports.executeUpdateCmsItemField=e.executeUpdateCmsItemField;exports.executeUpdateContentBlock=e.executeUpdateContentBlock;exports.executeUpdateCurrentCmsFields=e.executeUpdateCurrentCmsFields;exports.executeUpdateFooter=e.executeUpdateFooter;exports.executeUpdateNavigationBar=e.executeUpdateNavigationBar;exports.executeUpdateSectionColumnBlock=e.executeUpdateSectionColumnBlock;exports.fetchEcommerceStatsInputSchema=e.fetchEcommerceStatsInputSchema;exports.insertContentBlockInputSchema=e.insertContentBlockInputSchema;exports.navigationItemInputSchema=e.navigationItemInputSchema;exports.prepareDeleteCmsItemInputSchema=e.prepareDeleteCmsItemInputSchema;exports.readCurrentCmsItemInputSchema=e.readCurrentCmsItemInputSchema;exports.searchDocumentationInputSchema=e.searchDocumentationInputSchema;exports.updateCmsItemFieldInputSchema=e.updateCmsItemFieldInputSchema;exports.updateContentBlockInputSchema=e.updateContentBlockInputSchema;exports.updateCurrentCmsFieldsInputSchema=e.updateCurrentCmsFieldsInputSchema;exports.updateFooterInputSchema=e.updateFooterInputSchema;exports.updateNavigationBarInputSchema=e.updateNavigationBarInputSchema;exports.updateSectionColumnBlockInputSchema=e.updateSectionColumnBlockInputSchema;exports.CORTEX_AI_KEY_ALGORITHM=c.CORTEX_AI_KEY_ALGORITHM;exports.CORTEX_AI_KEY_ENVELOPE_VERSION=c.CORTEX_AI_KEY_ENVELOPE_VERSION;exports.decryptOpenRouterApiKey=c.decryptOpenRouterApiKey;exports.encryptOpenRouterApiKey=c.encryptOpenRouterApiKey;exports.getMaskedOpenRouterKey=c.getMaskedOpenRouterKey;exports.getOpenRouterKeyEnvelopeStatus=c.getOpenRouterKeyEnvelopeStatus;exports.listCortexAiCompatibleOpenRouterModels=m.listCortexAiCompatibleOpenRouterModels;exports.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY=t.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY;exports.CORTEX_AI_MODEL_REGISTRY=t.CORTEX_AI_MODEL_REGISTRY;exports.CORTEX_AI_OPENROUTER_BASE_URL=t.CORTEX_AI_OPENROUTER_BASE_URL;exports.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL=t.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL;exports.CORTEX_AI_REQUIRED_MODEL_PARAMETERS=t.CORTEX_AI_REQUIRED_MODEL_PARAMETERS;exports.CortexAiRoutingError=t.CortexAiRoutingError;exports.buildCortexAiModelFallbackChain=t.buildCortexAiModelFallbackChain;exports.buildCortexAiRoutingPolicy=t.buildCortexAiRoutingPolicy;exports.createCortexAiStoredModelSelection=t.createCortexAiStoredModelSelection;exports.filterCortexAiCompatibleOpenRouterModels=t.filterCortexAiCompatibleOpenRouterModels;exports.getHttpStatusCode=t.getHttpStatusCode;exports.isCortexAiFreeModelId=t.isCortexAiFreeModelId;exports.isOpenRouterRateLimitError=t.isOpenRouterRateLimitError;exports.isOpenRouterRecoverableRoutingError=t.isOpenRouterRecoverableRoutingError;exports.omitUnsupportedCortexAiModelOptions=t.omitUnsupportedCortexAiModelOptions;exports.runWithCortexAiModelFallback=t.runWithCortexAiModelFallback;exports.safeParseCortexAiModelSelection=t.safeParseCortexAiModelSelection;exports.summarizeCortexAiRoutingError=t.summarizeCortexAiRoutingError;exports.CORTEX_WIDGET_DEFINITION_SELECT=l.CORTEX_WIDGET_DEFINITION_SELECT;exports.CortexWidgetRegistryInsertError=l.CortexWidgetRegistryInsertError;exports.buildCortexWidgetDefinitionInsertPayload=l.buildCortexWidgetDefinitionInsertPayload;exports.insertCortexWidgetDefinition=l.insertCortexWidgetDefinition;exports.CORTEX_WIDGET_ALLOWED_RELATION_TABLES=o.CORTEX_WIDGET_ALLOWED_RELATION_TABLES;exports.buildCortexProfileCardVerificationDefinition=o.buildCortexProfileCardVerificationDefinition;exports.buildCortexWidgetBuilderPrompt=o.buildCortexWidgetBuilderPrompt;exports.buildCortexWidgetBuilderSystemPrompt=o.buildCortexWidgetBuilderSystemPrompt;exports.cortexWidgetBuildRequestSchema=o.cortexWidgetBuildRequestSchema;exports.cortexWidgetDbRelationFieldSchema=o.cortexWidgetDbRelationFieldSchema;exports.cortexWidgetDefinitionSchema=o.cortexWidgetDefinitionSchema;exports.cortexWidgetFieldSchema=o.cortexWidgetFieldSchema;exports.cortexWidgetImageR2FieldSchema=o.cortexWidgetImageR2FieldSchema;exports.cortexWidgetLayoutNodeSchema=o.cortexWidgetLayoutNodeSchema;exports.cortexWidgetRichTextFieldSchema=o.cortexWidgetRichTextFieldSchema;exports.cortexWidgetTextFieldSchema=o.cortexWidgetTextFieldSchema;exports.validateCortexWidgetDefinitionOutput=o.validateCortexWidgetDefinitionOutput;Object.defineProperty(exports,"z",{enumerable:!0,get:()=>d.z});
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './lib/ai-block-generation';
|
|
2
|
+
export * from './lib/ai-client';
|
|
3
|
+
export * from './lib/ai-config';
|
|
4
|
+
export * from './lib/ai-cortex-widget-builder';
|
|
5
|
+
export * from './lib/ai-global-agent-custom-block-tools';
|
|
6
|
+
export * from './lib/ai-global-agent-db-tools';
|
|
7
|
+
export * from './lib/ai-global-agent-tools';
|
|
8
|
+
export * from './lib/ai-key-crypto';
|
|
9
|
+
export * from './lib/ai-model-catalog';
|
|
10
|
+
export * from './lib/ai-model-registry';
|
|
11
|
+
export * from './lib/cortex-widget-registry';
|
|
12
|
+
export * from './lib/cortex-widget-schema';
|
|
13
|
+
export * from './lib/zod-config';
|
package/index.es.js
ADDED
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { INLINE_HTML_ASSISTANT_SYSTEM_PROMPT as r, generateEditorBlocksRequestSchema as a, generateEditorHtmlFragment as i, validateGeneratedEditorHtmlFragment as c } from "./lib/ai-block-generation.es.js";
|
|
2
|
+
import { createCortexAiOpenRouterClient as u, createCortexAiOpenRouterProvider as m, generateCortexAiText as C, getStoredCortexAiModelSelection as p, resolveCortexAiOpenRouterCredential as l } from "./lib/ai-client.es.js";
|
|
3
|
+
import { CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY as s, CORTEX_AI_OPENROUTER_SETTING_KEY as x, CORTEX_AI_PACKAGE_ID as E, CORTEX_AI_PACKAGE_NAME as S, decryptStoredOpenRouterApiKey as R, encryptStoredOpenRouterApiKey as I, getCortexAiEnvConfig as A, getEnvOpenRouterKeyStatus as _, getOpenRouterEnvApiKey as O, getStoredOpenRouterKeyStatus as h } from "./lib/ai-config.es.js";
|
|
4
|
+
import { generateCortexWidgetDefinition as g } from "./lib/ai-cortex-widget-builder.es.js";
|
|
5
|
+
import { createCortexCustomBlockTools as P, createCustomBlockInputSchema as b, deleteCustomBlockInputSchema as f, executeCreateCustomBlock as B, executeDeleteCustomBlock as M, executeListCustomBlocks as F, executeUpdateCustomBlock as L, listCustomBlocksInputSchema as k, updateCustomBlockInputSchema as W } from "./lib/ai-global-agent-custom-block-tools.es.js";
|
|
6
|
+
import { createCortexDatabaseAgentTools as N, describeDatabaseSchemaInputSchema as K, executeDatabaseActionPlan as U, executeDatabaseActionPlanInputSchema as v, executeDatabaseMutation as X, executeDatabaseMutationInputSchema as G, executeDescribeDatabaseSchema as Y, executeReadDatabaseRecords as H, readDatabaseRecordsInputSchema as V } from "./lib/ai-global-agent-db-tools.es.js";
|
|
7
|
+
import { availableCortexAiBlockTypes as z, buildVisibleContactIntroActionPlan as Q, cortexAiPageContextSchema as j, createCmsPageInputSchema as w, createCmsPostInputSchema as J, createCmsProductInputSchema as Z, createCortexGlobalAgentTools as $, deleteCmsItemInputSchema as ee, executeCmsActionPlan as te, executeCmsActionPlanInputSchema as oe, executeCreateCmsPage as re, executeCreateCmsPost as ae, executeCreateCmsProduct as ie, executeDeleteCmsItem as ce, executeFetchEcommerceStats as ne, executeInsertContentBlock as ue, executePrepareDeleteCmsItem as me, executeReadCurrentCmsItem as Ce, executeSearchDocumentation as pe, executeSearchDocumentationWithTimeout as le, executeUpdateCmsItemField as de, executeUpdateContentBlock as se, executeUpdateCurrentCmsFields as xe, executeUpdateFooter as Ee, executeUpdateNavigationBar as Se, executeUpdateSectionColumnBlock as Re, fetchEcommerceStatsInputSchema as Ie, insertContentBlockInputSchema as Ae, navigationItemInputSchema as _e, prepareDeleteCmsItemInputSchema as Oe, readCurrentCmsItemInputSchema as he, searchDocumentationInputSchema as Te, updateCmsItemFieldInputSchema as ge, updateContentBlockInputSchema as De, updateCurrentCmsFieldsInputSchema as Pe, updateFooterInputSchema as be, updateNavigationBarInputSchema as fe, updateSectionColumnBlockInputSchema as Be } from "./lib/ai-global-agent-tools.es.js";
|
|
8
|
+
import { CORTEX_AI_KEY_ALGORITHM as Fe, CORTEX_AI_KEY_ENVELOPE_VERSION as Le, decryptOpenRouterApiKey as ke, encryptOpenRouterApiKey as We, getMaskedOpenRouterKey as ye, getOpenRouterKeyEnvelopeStatus as Ne } from "./lib/ai-key-crypto.es.js";
|
|
9
|
+
import { listCortexAiCompatibleOpenRouterModels as Ue } from "./lib/ai-model-catalog.es.js";
|
|
10
|
+
import { CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY as Xe, CORTEX_AI_MODEL_REGISTRY as Ge, CORTEX_AI_OPENROUTER_BASE_URL as Ye, CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL as He, CORTEX_AI_REQUIRED_MODEL_PARAMETERS as Ve, CortexAiRoutingError as qe, buildCortexAiModelFallbackChain as ze, buildCortexAiRoutingPolicy as Qe, createCortexAiStoredModelSelection as je, filterCortexAiCompatibleOpenRouterModels as we, getHttpStatusCode as Je, isCortexAiFreeModelId as Ze, isOpenRouterRateLimitError as $e, isOpenRouterRecoverableRoutingError as et, omitUnsupportedCortexAiModelOptions as tt, runWithCortexAiModelFallback as ot, safeParseCortexAiModelSelection as rt, summarizeCortexAiRoutingError as at } from "./lib/ai-model-registry.es.js";
|
|
11
|
+
import { CORTEX_WIDGET_DEFINITION_SELECT as ct, CortexWidgetRegistryInsertError as nt, buildCortexWidgetDefinitionInsertPayload as ut, insertCortexWidgetDefinition as mt } from "./lib/cortex-widget-registry.es.js";
|
|
12
|
+
import { CORTEX_WIDGET_ALLOWED_RELATION_TABLES as pt, buildCortexProfileCardVerificationDefinition as lt, buildCortexWidgetBuilderPrompt as dt, buildCortexWidgetBuilderSystemPrompt as st, cortexWidgetBuildRequestSchema as xt, cortexWidgetDbRelationFieldSchema as Et, cortexWidgetDefinitionSchema as St, cortexWidgetFieldSchema as Rt, cortexWidgetImageR2FieldSchema as It, cortexWidgetLayoutNodeSchema as At, cortexWidgetRichTextFieldSchema as _t, cortexWidgetTextFieldSchema as Ot, validateCortexWidgetDefinitionOutput as ht } from "./lib/cortex-widget-schema.es.js";
|
|
13
|
+
import "./lib/zod-config.es.js";
|
|
14
|
+
import { z as gt } from "zod";
|
|
15
|
+
export {
|
|
16
|
+
Xe as CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY,
|
|
17
|
+
Fe as CORTEX_AI_KEY_ALGORITHM,
|
|
18
|
+
Le as CORTEX_AI_KEY_ENVELOPE_VERSION,
|
|
19
|
+
Ge as CORTEX_AI_MODEL_REGISTRY,
|
|
20
|
+
Ye as CORTEX_AI_OPENROUTER_BASE_URL,
|
|
21
|
+
He as CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL,
|
|
22
|
+
s as CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY,
|
|
23
|
+
x as CORTEX_AI_OPENROUTER_SETTING_KEY,
|
|
24
|
+
E as CORTEX_AI_PACKAGE_ID,
|
|
25
|
+
S as CORTEX_AI_PACKAGE_NAME,
|
|
26
|
+
Ve as CORTEX_AI_REQUIRED_MODEL_PARAMETERS,
|
|
27
|
+
pt as CORTEX_WIDGET_ALLOWED_RELATION_TABLES,
|
|
28
|
+
ct as CORTEX_WIDGET_DEFINITION_SELECT,
|
|
29
|
+
qe as CortexAiRoutingError,
|
|
30
|
+
nt as CortexWidgetRegistryInsertError,
|
|
31
|
+
r as INLINE_HTML_ASSISTANT_SYSTEM_PROMPT,
|
|
32
|
+
z as availableCortexAiBlockTypes,
|
|
33
|
+
ze as buildCortexAiModelFallbackChain,
|
|
34
|
+
Qe as buildCortexAiRoutingPolicy,
|
|
35
|
+
lt as buildCortexProfileCardVerificationDefinition,
|
|
36
|
+
dt as buildCortexWidgetBuilderPrompt,
|
|
37
|
+
st as buildCortexWidgetBuilderSystemPrompt,
|
|
38
|
+
ut as buildCortexWidgetDefinitionInsertPayload,
|
|
39
|
+
Q as buildVisibleContactIntroActionPlan,
|
|
40
|
+
j as cortexAiPageContextSchema,
|
|
41
|
+
xt as cortexWidgetBuildRequestSchema,
|
|
42
|
+
Et as cortexWidgetDbRelationFieldSchema,
|
|
43
|
+
St as cortexWidgetDefinitionSchema,
|
|
44
|
+
Rt as cortexWidgetFieldSchema,
|
|
45
|
+
It as cortexWidgetImageR2FieldSchema,
|
|
46
|
+
At as cortexWidgetLayoutNodeSchema,
|
|
47
|
+
_t as cortexWidgetRichTextFieldSchema,
|
|
48
|
+
Ot as cortexWidgetTextFieldSchema,
|
|
49
|
+
w as createCmsPageInputSchema,
|
|
50
|
+
J as createCmsPostInputSchema,
|
|
51
|
+
Z as createCmsProductInputSchema,
|
|
52
|
+
u as createCortexAiOpenRouterClient,
|
|
53
|
+
m as createCortexAiOpenRouterProvider,
|
|
54
|
+
je as createCortexAiStoredModelSelection,
|
|
55
|
+
P as createCortexCustomBlockTools,
|
|
56
|
+
N as createCortexDatabaseAgentTools,
|
|
57
|
+
$ as createCortexGlobalAgentTools,
|
|
58
|
+
b as createCustomBlockInputSchema,
|
|
59
|
+
ke as decryptOpenRouterApiKey,
|
|
60
|
+
R as decryptStoredOpenRouterApiKey,
|
|
61
|
+
ee as deleteCmsItemInputSchema,
|
|
62
|
+
f as deleteCustomBlockInputSchema,
|
|
63
|
+
K as describeDatabaseSchemaInputSchema,
|
|
64
|
+
We as encryptOpenRouterApiKey,
|
|
65
|
+
I as encryptStoredOpenRouterApiKey,
|
|
66
|
+
te as executeCmsActionPlan,
|
|
67
|
+
oe as executeCmsActionPlanInputSchema,
|
|
68
|
+
re as executeCreateCmsPage,
|
|
69
|
+
ae as executeCreateCmsPost,
|
|
70
|
+
ie as executeCreateCmsProduct,
|
|
71
|
+
B as executeCreateCustomBlock,
|
|
72
|
+
U as executeDatabaseActionPlan,
|
|
73
|
+
v as executeDatabaseActionPlanInputSchema,
|
|
74
|
+
X as executeDatabaseMutation,
|
|
75
|
+
G as executeDatabaseMutationInputSchema,
|
|
76
|
+
ce as executeDeleteCmsItem,
|
|
77
|
+
M as executeDeleteCustomBlock,
|
|
78
|
+
Y as executeDescribeDatabaseSchema,
|
|
79
|
+
ne as executeFetchEcommerceStats,
|
|
80
|
+
ue as executeInsertContentBlock,
|
|
81
|
+
F as executeListCustomBlocks,
|
|
82
|
+
me as executePrepareDeleteCmsItem,
|
|
83
|
+
Ce as executeReadCurrentCmsItem,
|
|
84
|
+
H as executeReadDatabaseRecords,
|
|
85
|
+
pe as executeSearchDocumentation,
|
|
86
|
+
le as executeSearchDocumentationWithTimeout,
|
|
87
|
+
de as executeUpdateCmsItemField,
|
|
88
|
+
se as executeUpdateContentBlock,
|
|
89
|
+
xe as executeUpdateCurrentCmsFields,
|
|
90
|
+
L as executeUpdateCustomBlock,
|
|
91
|
+
Ee as executeUpdateFooter,
|
|
92
|
+
Se as executeUpdateNavigationBar,
|
|
93
|
+
Re as executeUpdateSectionColumnBlock,
|
|
94
|
+
Ie as fetchEcommerceStatsInputSchema,
|
|
95
|
+
we as filterCortexAiCompatibleOpenRouterModels,
|
|
96
|
+
C as generateCortexAiText,
|
|
97
|
+
g as generateCortexWidgetDefinition,
|
|
98
|
+
a as generateEditorBlocksRequestSchema,
|
|
99
|
+
i as generateEditorHtmlFragment,
|
|
100
|
+
A as getCortexAiEnvConfig,
|
|
101
|
+
_ as getEnvOpenRouterKeyStatus,
|
|
102
|
+
Je as getHttpStatusCode,
|
|
103
|
+
ye as getMaskedOpenRouterKey,
|
|
104
|
+
O as getOpenRouterEnvApiKey,
|
|
105
|
+
Ne as getOpenRouterKeyEnvelopeStatus,
|
|
106
|
+
p as getStoredCortexAiModelSelection,
|
|
107
|
+
h as getStoredOpenRouterKeyStatus,
|
|
108
|
+
Ae as insertContentBlockInputSchema,
|
|
109
|
+
mt as insertCortexWidgetDefinition,
|
|
110
|
+
Ze as isCortexAiFreeModelId,
|
|
111
|
+
$e as isOpenRouterRateLimitError,
|
|
112
|
+
et as isOpenRouterRecoverableRoutingError,
|
|
113
|
+
Ue as listCortexAiCompatibleOpenRouterModels,
|
|
114
|
+
k as listCustomBlocksInputSchema,
|
|
115
|
+
_e as navigationItemInputSchema,
|
|
116
|
+
tt as omitUnsupportedCortexAiModelOptions,
|
|
117
|
+
Oe as prepareDeleteCmsItemInputSchema,
|
|
118
|
+
he as readCurrentCmsItemInputSchema,
|
|
119
|
+
V as readDatabaseRecordsInputSchema,
|
|
120
|
+
l as resolveCortexAiOpenRouterCredential,
|
|
121
|
+
ot as runWithCortexAiModelFallback,
|
|
122
|
+
rt as safeParseCortexAiModelSelection,
|
|
123
|
+
Te as searchDocumentationInputSchema,
|
|
124
|
+
at as summarizeCortexAiRoutingError,
|
|
125
|
+
ge as updateCmsItemFieldInputSchema,
|
|
126
|
+
De as updateContentBlockInputSchema,
|
|
127
|
+
Pe as updateCurrentCmsFieldsInputSchema,
|
|
128
|
+
W as updateCustomBlockInputSchema,
|
|
129
|
+
be as updateFooterInputSchema,
|
|
130
|
+
fe as updateNavigationBarInputSchema,
|
|
131
|
+
Be as updateSectionColumnBlockInputSchema,
|
|
132
|
+
ht as validateCortexWidgetDefinitionOutput,
|
|
133
|
+
c as validateGeneratedEditorHtmlFragment,
|
|
134
|
+
gt as z
|
|
135
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("ai");require("./zod-config.cjs.js");const x=require("./ai-client.cjs.js"),m=require("./ai-model-registry.cjs.js"),b=require("zod"),f=b.z.strictObject({context:b.z.string().max(2e3).optional(),prompt:b.z.string().min(3).max(4e3)}),S=6e4;function M(){return["You are NextBlock Cortex AI, an inline rich-text assistant for a Tiptap editor.","Return ONLY an HTML fragment. Do not return markdown fences, JSON, prose explanations, or commentary.","Do not include <!doctype>, <html>, <head>, or <body>. The output is inserted inside an existing editor document.","Use semantic HTML: headings, paragraphs, unordered and ordered lists, blockquotes, pre/code blocks, horizontal rules, and tables.","Use the current editor context for continuity, but do not repeat existing copy unless the user explicitly asks for a rewrite.","For tables, use valid <table>, <thead>, <tbody>, <tr>, <th>, and <td> markup with aligned rows and non-empty cells.","Never use blank table spacer rows, blank spacer columns, empty cells, <colgroup>, colspan, or rowspan unless the user explicitly asks for a blank template.","If CSS or JavaScript is explicitly requested, use proper <style> or <script> tags. The editor preserves those tags through its source-mode HTML parser.","Keep copy production-ready, editable, and concise unless the user asks for longer content."].join(" ")}function H(e){return["Create an HTML fragment for this inline editor request:",e.prompt,/\b(table|pricing table|comparison table)\b/i.test(e.prompt)?["Table requirements:","- Use a short header row.","- Use only the real content columns requested by the user.","- Do not add blank spacer columns or blank spacer rows.","- Do not use <colgroup>, colspan, or rowspan.","- Put normal descriptive prose before or after the table, not inside a table cell.","- Body rows must match the header column count.","- Every header and body cell must contain meaningful text."].join(`
|
|
2
|
+
`):null,e.context?`Current editor context:
|
|
3
|
+
${e.context}`:null].filter(Boolean).join(`
|
|
4
|
+
|
|
5
|
+
`)}function C(e){return e.replace(/ /gi," ").replace(/&/gi,"&").replace(/</gi,"<").replace(/>/gi,">").replace(/"/gi,'"').replace(/'/gi,"'")}function E(e){return C(e.replace(/<script\b[\s\S]*?<\/script>/gi,"").replace(/<style\b[\s\S]*?<\/style>/gi,"").replace(/<br\s*\/?>/gi," ").replace(/<[^>]+>/g," ")).replace(/\s+/g," ").trim()}function g(e){return E(e).length===0}function I(e){return e.replace(/<(p|h[1-6])\b[^>]*>(?:\s| |<br\s*\/?>)*<\/\1>/gi,"").trim()}function A(e){const t=[...e.matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)];if(t.length===0)return e;const o=t.map(r=>({cells:[...r[1].matchAll(/<(td|th)\b[^>]*>([\s\S]*?)<\/\1>/gi)].map(l=>({innerHtml:l[2].trim(),tag:l[1].toLowerCase()}))})).filter(r=>r.cells.some(n=>!g(n.innerHtml)));if(o.length===0)return e;const p=Math.max(...o.map(r=>r.cells.length)),i=new Set;for(let r=0;r<p;r++)o.every(l=>{const h=l.cells[r];return!h||g(h.innerHtml)})&&i.add(r);const s=o.map(r=>({cells:r.cells.filter((n,l)=>!i.has(l))})).filter(r=>r.cells.length>0);if(s.length===0)return e;const c=r=>`<tr>${r.cells.map(n=>`<${n.tag}>${n.innerHtml}</${n.tag}>`).join("")}</tr>`;if(!s[0].cells.some(r=>r.tag==="th"))return`<table><tbody>${s.map(c).join("")}</tbody></table>`;const[u,...d]=s;return`<table><thead>${c(u)}</thead><tbody>${d.map(c).join("")}</tbody></table>`}function R(e){return e.replace(/<table\b[\s\S]*?<\/table>/gi,t=>A(t))}function k(e){const t=[...e.matchAll(/<table\b[\s\S]*?<\/table>/gi)];for(const o of t){const i=[...o[0].matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)];if(i.length===0)throw new Error("Cortex AI returned a table without rows.");const s=[];for(const c of i){const a=[...c[1].matchAll(/<(td|th)\b[^>]*>([\s\S]*?)<\/\1>/gi)];if(a.length===0)throw new Error("Cortex AI returned a table row without cells.");for(const u of a)if(g(u[2]))throw new Error("Cortex AI returned a table with empty cells.");s.push(a.length)}if(new Set(s).size>1)throw new Error("Cortex AI returned a table with uneven row widths.")}}function L(e){let t=e.trim();(t.startsWith('"')&&t.endsWith('"')||t.startsWith("'")&&t.endsWith("'"))&&t.slice(1,-1).includes("<")&&(t=t.slice(1,-1).trim());const o=t.match(/<body\b[^>]*>([\s\S]*?)<\/body>/i);return o?.[1]&&(t=o[1].trim()),I(R(t))}function w(e){const t=L(e);if(!t.trim())throw new Error("Cortex AI returned empty HTML.");if(/```/.test(t))throw new Error("Cortex AI returned markdown code fences instead of an HTML fragment.");if(/<!doctype\b|<html\b|<head\b|<body\b/i.test(t))throw new Error("Cortex AI returned a full HTML document instead of an HTML fragment.");if(/^(sure|certainly|of course|here(?:'s| is)|below is|i can)\b/i.test(t))throw new Error("Cortex AI returned a conversational response instead of an HTML fragment.");if(!/<[a-z][\w:-]*(?:\s[^>]*)?>/i.test(t))throw new Error("Cortex AI returned plain text instead of semantic HTML.");return k(t),t}function v(e){const t=m.getHttpStatusCode(e);if(t===401||t===402||t===403)return!1;if(m.isOpenRouterRecoverableRoutingError(e)||t&&t>=500)return!0;const o=e instanceof Error?e.message:String(e);return/NoContentGenerated|No content generated|Provider returned error|empty HTML|markdown code fences|full HTML document|conversational response|plain text|aborted|abort|timeout|timed out/i.test(o)}async function q(e){const{apiKey:t,fallbackModelIds:o,modelId:p,modelSelection:i,...s}=e,c=f.parse(s),a=await x.createCortexAiOpenRouterClient({apiKey:t,modelSelection:i}),u=m.buildCortexAiRoutingPolicy({credentialSource:a.credentialSource,fallbackModelIds:o,requestedModelId:p,selectedModel:a.modelSelection}),d=await m.runWithCortexAiModelFallback({modelIds:u.modelIds,shouldRetry:v,execute:async r=>{const n=new AbortController,l=setTimeout(()=>n.abort(),S);try{const h=m.omitUnsupportedCortexAiModelOptions({abortSignal:n.signal,maxOutputTokens:5e3,maxRetries:0,prompt:H(c),system:M(),temperature:.2},{modelId:r,modelSelection:u.modelSelection}),y=await T.generateText({...h,model:a.model(r)});return w(y.text)}finally{clearTimeout(l)}}});return{attempts:d.attempts,credentialSource:a.credentialSource,html:d.result,modelId:d.modelId}}const N="Built at runtime for HTML-fragment rich-text assistance.";exports.INLINE_HTML_ASSISTANT_SYSTEM_PROMPT=N;exports.generateEditorBlocksRequestSchema=f;exports.generateEditorHtmlFragment=q;exports.validateGeneratedEditorHtmlFragment=w;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { z } from './zod-config';
|
|
2
|
+
import { CortexAiModelAttempt, CortexAiOpenRouterModelId, CortexAiStoredModelSelection } from './ai-model-registry';
|
|
3
|
+
export declare const generateEditorBlocksRequestSchema: z.ZodObject<{
|
|
4
|
+
context: z.ZodOptional<z.ZodString>;
|
|
5
|
+
prompt: z.ZodString;
|
|
6
|
+
}, z.core.$strict>;
|
|
7
|
+
export type GenerateEditorBlocksRequest = z.infer<typeof generateEditorBlocksRequestSchema>;
|
|
8
|
+
export type GenerateEditorHtmlFragmentResult = {
|
|
9
|
+
attempts: readonly CortexAiModelAttempt[];
|
|
10
|
+
credentialSource: 'env' | 'stored' | 'manual';
|
|
11
|
+
html: string;
|
|
12
|
+
modelId: CortexAiOpenRouterModelId;
|
|
13
|
+
};
|
|
14
|
+
export declare function validateGeneratedEditorHtmlFragment(rawText: string): string;
|
|
15
|
+
export declare function generateEditorHtmlFragment(params: GenerateEditorBlocksRequest & {
|
|
16
|
+
apiKey?: string;
|
|
17
|
+
fallbackModelIds?: readonly CortexAiOpenRouterModelId[];
|
|
18
|
+
modelId?: CortexAiOpenRouterModelId;
|
|
19
|
+
modelSelection?: CortexAiStoredModelSelection | null;
|
|
20
|
+
}): Promise<GenerateEditorHtmlFragmentResult>;
|
|
21
|
+
export declare const INLINE_HTML_ASSISTANT_SYSTEM_PROMPT = "Built at runtime for HTML-fragment rich-text assistance.";
|
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
import { generateText as g } from "ai";
|
|
2
|
+
import "./zod-config.es.js";
|
|
3
|
+
import { createCortexAiOpenRouterClient as w } from "./ai-client.es.js";
|
|
4
|
+
import { buildCortexAiRoutingPolicy as y, runWithCortexAiModelFallback as x, omitUnsupportedCortexAiModelOptions as T, getHttpStatusCode as S, isOpenRouterRecoverableRoutingError as C } from "./ai-model-registry.es.js";
|
|
5
|
+
import { z as h } from "zod";
|
|
6
|
+
const H = h.strictObject({
|
|
7
|
+
context: h.string().max(2e3).optional(),
|
|
8
|
+
prompt: h.string().min(3).max(4e3)
|
|
9
|
+
}), M = 6e4;
|
|
10
|
+
function E() {
|
|
11
|
+
return [
|
|
12
|
+
"You are NextBlock Cortex AI, an inline rich-text assistant for a Tiptap editor.",
|
|
13
|
+
"Return ONLY an HTML fragment. Do not return markdown fences, JSON, prose explanations, or commentary.",
|
|
14
|
+
"Do not include <!doctype>, <html>, <head>, or <body>. The output is inserted inside an existing editor document.",
|
|
15
|
+
"Use semantic HTML: headings, paragraphs, unordered and ordered lists, blockquotes, pre/code blocks, horizontal rules, and tables.",
|
|
16
|
+
"Use the current editor context for continuity, but do not repeat existing copy unless the user explicitly asks for a rewrite.",
|
|
17
|
+
"For tables, use valid <table>, <thead>, <tbody>, <tr>, <th>, and <td> markup with aligned rows and non-empty cells.",
|
|
18
|
+
"Never use blank table spacer rows, blank spacer columns, empty cells, <colgroup>, colspan, or rowspan unless the user explicitly asks for a blank template.",
|
|
19
|
+
"If CSS or JavaScript is explicitly requested, use proper <style> or <script> tags. The editor preserves those tags through its source-mode HTML parser.",
|
|
20
|
+
"Keep copy production-ready, editable, and concise unless the user asks for longer content."
|
|
21
|
+
].join(" ");
|
|
22
|
+
}
|
|
23
|
+
function I(e) {
|
|
24
|
+
return [
|
|
25
|
+
"Create an HTML fragment for this inline editor request:",
|
|
26
|
+
e.prompt,
|
|
27
|
+
/\b(table|pricing table|comparison table)\b/i.test(e.prompt) ? [
|
|
28
|
+
"Table requirements:",
|
|
29
|
+
"- Use a short header row.",
|
|
30
|
+
"- Use only the real content columns requested by the user.",
|
|
31
|
+
"- Do not add blank spacer columns or blank spacer rows.",
|
|
32
|
+
"- Do not use <colgroup>, colspan, or rowspan.",
|
|
33
|
+
"- Put normal descriptive prose before or after the table, not inside a table cell.",
|
|
34
|
+
"- Body rows must match the header column count.",
|
|
35
|
+
"- Every header and body cell must contain meaningful text."
|
|
36
|
+
].join(`
|
|
37
|
+
`) : null,
|
|
38
|
+
e.context ? `Current editor context:
|
|
39
|
+
${e.context}` : null
|
|
40
|
+
].filter(Boolean).join(`
|
|
41
|
+
|
|
42
|
+
`);
|
|
43
|
+
}
|
|
44
|
+
function A(e) {
|
|
45
|
+
return e.replace(/ /gi, " ").replace(/&/gi, "&").replace(/</gi, "<").replace(/>/gi, ">").replace(/"/gi, '"').replace(/'/gi, "'");
|
|
46
|
+
}
|
|
47
|
+
function k(e) {
|
|
48
|
+
return A(
|
|
49
|
+
e.replace(/<script\b[\s\S]*?<\/script>/gi, "").replace(/<style\b[\s\S]*?<\/style>/gi, "").replace(/<br\s*\/?>/gi, " ").replace(/<[^>]+>/g, " ")
|
|
50
|
+
).replace(/\s+/g, " ").trim();
|
|
51
|
+
}
|
|
52
|
+
function b(e) {
|
|
53
|
+
return k(e).length === 0;
|
|
54
|
+
}
|
|
55
|
+
function L(e) {
|
|
56
|
+
return e.replace(/<(p|h[1-6])\b[^>]*>(?:\s| |<br\s*\/?>)*<\/\1>/gi, "").trim();
|
|
57
|
+
}
|
|
58
|
+
function R(e) {
|
|
59
|
+
const t = [...e.matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)];
|
|
60
|
+
if (t.length === 0)
|
|
61
|
+
return e;
|
|
62
|
+
const o = t.map((r) => ({ cells: [...r[1].matchAll(/<(td|th)\b[^>]*>([\s\S]*?)<\/\1>/gi)].map(
|
|
63
|
+
(l) => ({
|
|
64
|
+
innerHtml: l[2].trim(),
|
|
65
|
+
tag: l[1].toLowerCase()
|
|
66
|
+
})
|
|
67
|
+
) })).filter((r) => r.cells.some((n) => !b(n.innerHtml)));
|
|
68
|
+
if (o.length === 0)
|
|
69
|
+
return e;
|
|
70
|
+
const m = Math.max(...o.map((r) => r.cells.length)), i = /* @__PURE__ */ new Set();
|
|
71
|
+
for (let r = 0; r < m; r++)
|
|
72
|
+
o.every((l) => {
|
|
73
|
+
const p = l.cells[r];
|
|
74
|
+
return !p || b(p.innerHtml);
|
|
75
|
+
}) && i.add(r);
|
|
76
|
+
const s = o.map((r) => ({
|
|
77
|
+
cells: r.cells.filter((n, l) => !i.has(l))
|
|
78
|
+
})).filter((r) => r.cells.length > 0);
|
|
79
|
+
if (s.length === 0)
|
|
80
|
+
return e;
|
|
81
|
+
const c = (r) => `<tr>${r.cells.map((n) => `<${n.tag}>${n.innerHtml}</${n.tag}>`).join("")}</tr>`;
|
|
82
|
+
if (!s[0].cells.some((r) => r.tag === "th"))
|
|
83
|
+
return `<table><tbody>${s.map(c).join("")}</tbody></table>`;
|
|
84
|
+
const [u, ...d] = s;
|
|
85
|
+
return `<table><thead>${c(u)}</thead><tbody>${d.map(c).join("")}</tbody></table>`;
|
|
86
|
+
}
|
|
87
|
+
function v(e) {
|
|
88
|
+
return e.replace(
|
|
89
|
+
/<table\b[\s\S]*?<\/table>/gi,
|
|
90
|
+
(t) => R(t)
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
function O(e) {
|
|
94
|
+
const t = [...e.matchAll(/<table\b[\s\S]*?<\/table>/gi)];
|
|
95
|
+
for (const o of t) {
|
|
96
|
+
const i = [...o[0].matchAll(/<tr\b[^>]*>([\s\S]*?)<\/tr>/gi)];
|
|
97
|
+
if (i.length === 0)
|
|
98
|
+
throw new Error("Cortex AI returned a table without rows.");
|
|
99
|
+
const s = [];
|
|
100
|
+
for (const c of i) {
|
|
101
|
+
const a = [...c[1].matchAll(/<(td|th)\b[^>]*>([\s\S]*?)<\/\1>/gi)];
|
|
102
|
+
if (a.length === 0)
|
|
103
|
+
throw new Error("Cortex AI returned a table row without cells.");
|
|
104
|
+
for (const u of a)
|
|
105
|
+
if (b(u[2]))
|
|
106
|
+
throw new Error("Cortex AI returned a table with empty cells.");
|
|
107
|
+
s.push(a.length);
|
|
108
|
+
}
|
|
109
|
+
if (new Set(s).size > 1)
|
|
110
|
+
throw new Error("Cortex AI returned a table with uneven row widths.");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function N(e) {
|
|
114
|
+
let t = e.trim();
|
|
115
|
+
(t.startsWith('"') && t.endsWith('"') || t.startsWith("'") && t.endsWith("'")) && t.slice(1, -1).includes("<") && (t = t.slice(1, -1).trim());
|
|
116
|
+
const o = t.match(/<body\b[^>]*>([\s\S]*?)<\/body>/i);
|
|
117
|
+
return o?.[1] && (t = o[1].trim()), L(v(t));
|
|
118
|
+
}
|
|
119
|
+
function q(e) {
|
|
120
|
+
const t = N(e);
|
|
121
|
+
if (!t.trim())
|
|
122
|
+
throw new Error("Cortex AI returned empty HTML.");
|
|
123
|
+
if (/```/.test(t))
|
|
124
|
+
throw new Error("Cortex AI returned markdown code fences instead of an HTML fragment.");
|
|
125
|
+
if (/<!doctype\b|<html\b|<head\b|<body\b/i.test(t))
|
|
126
|
+
throw new Error("Cortex AI returned a full HTML document instead of an HTML fragment.");
|
|
127
|
+
if (/^(sure|certainly|of course|here(?:'s| is)|below is|i can)\b/i.test(t))
|
|
128
|
+
throw new Error("Cortex AI returned a conversational response instead of an HTML fragment.");
|
|
129
|
+
if (!/<[a-z][\w:-]*(?:\s[^>]*)?>/i.test(t))
|
|
130
|
+
throw new Error("Cortex AI returned plain text instead of semantic HTML.");
|
|
131
|
+
return O(t), t;
|
|
132
|
+
}
|
|
133
|
+
function P(e) {
|
|
134
|
+
const t = S(e);
|
|
135
|
+
if (t === 401 || t === 402 || t === 403)
|
|
136
|
+
return !1;
|
|
137
|
+
if (C(e) || t && t >= 500)
|
|
138
|
+
return !0;
|
|
139
|
+
const o = e instanceof Error ? e.message : String(e);
|
|
140
|
+
return /NoContentGenerated|No content generated|Provider returned error|empty HTML|markdown code fences|full HTML document|conversational response|plain text|aborted|abort|timeout|timed out/i.test(
|
|
141
|
+
o
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
async function G(e) {
|
|
145
|
+
const { apiKey: t, fallbackModelIds: o, modelId: m, modelSelection: i, ...s } = e, c = H.parse(s), a = await w({ apiKey: t, modelSelection: i }), u = y({
|
|
146
|
+
credentialSource: a.credentialSource,
|
|
147
|
+
fallbackModelIds: o,
|
|
148
|
+
requestedModelId: m,
|
|
149
|
+
selectedModel: a.modelSelection
|
|
150
|
+
}), d = await x({
|
|
151
|
+
modelIds: u.modelIds,
|
|
152
|
+
shouldRetry: P,
|
|
153
|
+
execute: async (r) => {
|
|
154
|
+
const n = new AbortController(), l = setTimeout(
|
|
155
|
+
() => n.abort(),
|
|
156
|
+
M
|
|
157
|
+
);
|
|
158
|
+
try {
|
|
159
|
+
const p = T(
|
|
160
|
+
{
|
|
161
|
+
abortSignal: n.signal,
|
|
162
|
+
maxOutputTokens: 5e3,
|
|
163
|
+
maxRetries: 0,
|
|
164
|
+
prompt: I(c),
|
|
165
|
+
system: E(),
|
|
166
|
+
temperature: 0.2
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
modelId: r,
|
|
170
|
+
modelSelection: u.modelSelection
|
|
171
|
+
}
|
|
172
|
+
), f = await g({
|
|
173
|
+
...p,
|
|
174
|
+
model: a.model(r)
|
|
175
|
+
});
|
|
176
|
+
return q(f.text);
|
|
177
|
+
} finally {
|
|
178
|
+
clearTimeout(l);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
return {
|
|
183
|
+
attempts: d.attempts,
|
|
184
|
+
credentialSource: a.credentialSource,
|
|
185
|
+
html: d.result,
|
|
186
|
+
modelId: d.modelId
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
const U = "Built at runtime for HTML-fragment rich-text assistance.";
|
|
190
|
+
export {
|
|
191
|
+
U as INLINE_HTML_ASSISTANT_SYSTEM_PROMPT,
|
|
192
|
+
H as generateEditorBlocksRequestSchema,
|
|
193
|
+
G as generateEditorHtmlFragment,
|
|
194
|
+
q as validateGeneratedEditorHtmlFragment
|
|
195
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var C=Object.create;var s=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var x=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!y.call(e,n)&&n!==o&&s(e,n,{get:()=>t[n],enumerable:!(i=S(t,n))||i.enumerable});return e};var E=(e,t,o)=>(o=e!=null?C(T(e)):{},x(t||!e||!e.__esModule?s(o,"default",{value:e,enumerable:!0}):o,e));Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const I=require("@ai-sdk/openai-compatible"),f=require("ai"),a=require("./ai-config.cjs.js"),r=require("./ai-model-registry.cjs.js"),g="Cortex AI OpenRouter client can only be imported from server-side code.";function l(){if(!(typeof window>"u"))throw new Error(g)}function M(){return l(),{"HTTP-Referer":process.env.NEXT_PUBLIC_URL?.trim()||"https://nextblock.dev","X-Title":a.CORTEX_AI_PACKAGE_NAME}}function d(e){return l(),I.createOpenAICompatible({apiKey:e.apiKey,baseURL:r.CORTEX_AI_OPENROUTER_BASE_URL,fetch:e.fetch,headers:M(),includeUsage:!0,name:"openrouter",supportsStructuredOutputs:!0})}async function b(){l();const{getServiceRoleSupabaseClient:e}=await import("@nextblock-cms/db/server"),t=e(),{data:o,error:i}=await t.from("site_settings").select("value").eq("key",a.CORTEX_AI_OPENROUTER_SETTING_KEY).maybeSingle();if(i)throw new Error(`Failed to load stored Cortex AI OpenRouter key: ${i.message}`);return o?.value?a.decryptStoredOpenRouterApiKey(o.value):null}async function O(){l();const{getServiceRoleSupabaseClient:e}=await import("@nextblock-cms/db/server"),t=e(),{data:o,error:i}=await t.from("site_settings").select("value").eq("key",a.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY).maybeSingle();if(i)throw new Error(`Failed to load Cortex AI OpenRouter model selection: ${i.message}`);return r.safeParseCortexAiModelSelection(o?.value)}async function _(e){l();const t=e?.apiKey?.trim();if(t)return{apiKey:t,source:"manual"};const o=await b();if(o)return{apiKey:o,source:"stored"};const i=a.getOpenRouterEnvApiKey();return i?{apiKey:i,source:"env"}:{apiKey:null,source:"none"}}async function A(e){l();const t=await _({apiKey:e?.apiKey});if(!t.apiKey||t.source==="none")throw new Error("Cortex AI requires OPENROUTER_API_KEY or an encrypted OpenRouter BYOK in site settings.");const o=d({apiKey:t.apiKey,fetch:e?.fetch}),i=e?.modelSelection!==void 0?e.modelSelection:t.source==="stored"?await O():null;return{credentialSource:t.source,model:n=>o.chatModel(n||"openrouter/free"),modelSelection:i}}async function K({apiKey:e,fallbackModelIds:t,modelId:o,...i}){l();const n=await A({apiKey:e,modelSelection:i.modelSelection}),c=r.buildCortexAiRoutingPolicy({credentialSource:n.credentialSource,fallbackModelIds:t,requestedModelId:o,selectedModel:n.modelSelection}),u=await r.runWithCortexAiModelFallback({modelIds:c.modelIds,execute:R=>{const p=r.omitUnsupportedCortexAiModelOptions({...i,maxRetries:0},{modelId:R,modelSelection:c.modelSelection});return f.generateText({...p,model:n.model(R)})}});return{attempts:u.attempts,credentialSource:n.credentialSource,modelId:u.modelId,result:u.result}}exports.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY=r.CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY;exports.CORTEX_AI_MODEL_REGISTRY=r.CORTEX_AI_MODEL_REGISTRY;exports.CORTEX_AI_OPENROUTER_BASE_URL=r.CORTEX_AI_OPENROUTER_BASE_URL;exports.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL=r.CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL;exports.CORTEX_AI_REQUIRED_MODEL_PARAMETERS=r.CORTEX_AI_REQUIRED_MODEL_PARAMETERS;exports.CortexAiRoutingError=r.CortexAiRoutingError;exports.buildCortexAiModelFallbackChain=r.buildCortexAiModelFallbackChain;exports.buildCortexAiRoutingPolicy=r.buildCortexAiRoutingPolicy;exports.isOpenRouterRateLimitError=r.isOpenRouterRateLimitError;exports.isOpenRouterRecoverableRoutingError=r.isOpenRouterRecoverableRoutingError;exports.omitUnsupportedCortexAiModelOptions=r.omitUnsupportedCortexAiModelOptions;exports.runWithCortexAiModelFallback=r.runWithCortexAiModelFallback;exports.summarizeCortexAiRoutingError=r.summarizeCortexAiRoutingError;exports.createCortexAiOpenRouterClient=A;exports.createCortexAiOpenRouterProvider=d;exports.generateCortexAiText=K;exports.getStoredCortexAiModelSelection=O;exports.resolveCortexAiOpenRouterCredential=_;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { generateText, LanguageModel } from 'ai';
|
|
2
|
+
import { CortexAiModelAttempt, CortexAiOpenRouterModelId, CortexAiStoredModelSelection } from './ai-model-registry';
|
|
3
|
+
type AiGenerateTextOptions = Omit<Parameters<typeof generateText>[0], 'model'>;
|
|
4
|
+
type AiGenerateTextResult = Awaited<ReturnType<typeof generateText>>;
|
|
5
|
+
type FetchFunction = typeof globalThis.fetch;
|
|
6
|
+
export type CortexAiOpenRouterCredentialSource = 'env' | 'stored' | 'manual' | 'none';
|
|
7
|
+
export type CortexAiOpenRouterCredential = {
|
|
8
|
+
apiKey: string | null;
|
|
9
|
+
source: CortexAiOpenRouterCredentialSource;
|
|
10
|
+
};
|
|
11
|
+
export type CortexAiOpenRouterClient = {
|
|
12
|
+
credentialSource: Exclude<CortexAiOpenRouterCredentialSource, 'none'>;
|
|
13
|
+
model: (modelId?: CortexAiOpenRouterModelId) => LanguageModel;
|
|
14
|
+
modelSelection: CortexAiStoredModelSelection | null;
|
|
15
|
+
};
|
|
16
|
+
export type CortexAiGenerateTextOptions = AiGenerateTextOptions & {
|
|
17
|
+
apiKey?: string;
|
|
18
|
+
fallbackModelIds?: readonly CortexAiOpenRouterModelId[];
|
|
19
|
+
modelId?: CortexAiOpenRouterModelId;
|
|
20
|
+
};
|
|
21
|
+
export type CortexAiGenerateTextResult = {
|
|
22
|
+
attempts: readonly CortexAiModelAttempt[];
|
|
23
|
+
credentialSource: Exclude<CortexAiOpenRouterCredentialSource, 'none'>;
|
|
24
|
+
modelId: CortexAiOpenRouterModelId;
|
|
25
|
+
result: AiGenerateTextResult;
|
|
26
|
+
};
|
|
27
|
+
export declare function createCortexAiOpenRouterProvider(params: {
|
|
28
|
+
apiKey: string;
|
|
29
|
+
fetch?: FetchFunction;
|
|
30
|
+
}): import('@ai-sdk/openai-compatible').OpenAICompatibleProvider<string, string, string, string>;
|
|
31
|
+
export declare function getStoredCortexAiModelSelection(): Promise<CortexAiStoredModelSelection | null>;
|
|
32
|
+
export declare function resolveCortexAiOpenRouterCredential(params?: {
|
|
33
|
+
apiKey?: string;
|
|
34
|
+
}): Promise<CortexAiOpenRouterCredential>;
|
|
35
|
+
export declare function createCortexAiOpenRouterClient(params?: {
|
|
36
|
+
apiKey?: string;
|
|
37
|
+
fetch?: FetchFunction;
|
|
38
|
+
modelSelection?: CortexAiStoredModelSelection | null;
|
|
39
|
+
}): Promise<{
|
|
40
|
+
credentialSource: "env" | "manual" | "stored";
|
|
41
|
+
model: (modelId?: CortexAiOpenRouterModelId) => import('@ai-sdk/provider').LanguageModelV3;
|
|
42
|
+
modelSelection: CortexAiStoredModelSelection | null;
|
|
43
|
+
}>;
|
|
44
|
+
export declare function generateCortexAiText({ apiKey, fallbackModelIds, modelId, ...options }: CortexAiGenerateTextOptions & {
|
|
45
|
+
modelSelection?: CortexAiStoredModelSelection | null;
|
|
46
|
+
}): Promise<CortexAiGenerateTextResult>;
|
|
47
|
+
export { buildCortexAiModelFallbackChain, buildCortexAiRoutingPolicy, CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY, CORTEX_AI_MODEL_REGISTRY, CORTEX_AI_OPENROUTER_BASE_URL, CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL, CORTEX_AI_REQUIRED_MODEL_PARAMETERS, CortexAiRoutingError, isOpenRouterRecoverableRoutingError, isOpenRouterRateLimitError, omitUnsupportedCortexAiModelOptions, runWithCortexAiModelFallback, summarizeCortexAiRoutingError, } from './ai-model-registry';
|
|
48
|
+
export { listCortexAiCompatibleOpenRouterModels, } from './ai-model-catalog';
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { createOpenAICompatible as s } from "@ai-sdk/openai-compatible";
|
|
2
|
+
import { generateText as d } from "ai";
|
|
3
|
+
import { CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY as R, getOpenRouterEnvApiKey as E, CORTEX_AI_PACKAGE_NAME as p, CORTEX_AI_OPENROUTER_SETTING_KEY as O, decryptStoredOpenRouterApiKey as m } from "./ai-config.es.js";
|
|
4
|
+
import { CORTEX_AI_OPENROUTER_BASE_URL as _, buildCortexAiRoutingPolicy as A, runWithCortexAiModelFallback as S, omitUnsupportedCortexAiModelOptions as f, safeParseCortexAiModelSelection as y } from "./ai-model-registry.es.js";
|
|
5
|
+
import { CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY as N, CORTEX_AI_MODEL_REGISTRY as X, CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL as F, CORTEX_AI_REQUIRED_MODEL_PARAMETERS as Y, CortexAiRoutingError as k, buildCortexAiModelFallbackChain as D, isOpenRouterRateLimitError as G, isOpenRouterRecoverableRoutingError as q, summarizeCortexAiRoutingError as B } from "./ai-model-registry.es.js";
|
|
6
|
+
const C = "Cortex AI OpenRouter client can only be imported from server-side code.";
|
|
7
|
+
function n() {
|
|
8
|
+
if (!(typeof window > "u"))
|
|
9
|
+
throw new Error(C);
|
|
10
|
+
}
|
|
11
|
+
function T() {
|
|
12
|
+
return n(), {
|
|
13
|
+
"HTTP-Referer": process.env.NEXT_PUBLIC_URL?.trim() || "https://nextblock.dev",
|
|
14
|
+
"X-Title": p
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
function I(e) {
|
|
18
|
+
return n(), s({
|
|
19
|
+
apiKey: e.apiKey,
|
|
20
|
+
baseURL: _,
|
|
21
|
+
fetch: e.fetch,
|
|
22
|
+
headers: T(),
|
|
23
|
+
includeUsage: !0,
|
|
24
|
+
name: "openrouter",
|
|
25
|
+
supportsStructuredOutputs: !0
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async function K() {
|
|
29
|
+
n();
|
|
30
|
+
const { getServiceRoleSupabaseClient: e } = await import("@nextblock-cms/db/server"), t = e(), { data: o, error: r } = await t.from("site_settings").select("value").eq("key", O).maybeSingle();
|
|
31
|
+
if (r)
|
|
32
|
+
throw new Error(`Failed to load stored Cortex AI OpenRouter key: ${r.message}`);
|
|
33
|
+
return o?.value ? m(o.value) : null;
|
|
34
|
+
}
|
|
35
|
+
async function x() {
|
|
36
|
+
n();
|
|
37
|
+
const { getServiceRoleSupabaseClient: e } = await import("@nextblock-cms/db/server"), t = e(), { data: o, error: r } = await t.from("site_settings").select("value").eq("key", R).maybeSingle();
|
|
38
|
+
if (r)
|
|
39
|
+
throw new Error(`Failed to load Cortex AI OpenRouter model selection: ${r.message}`);
|
|
40
|
+
return y(o?.value);
|
|
41
|
+
}
|
|
42
|
+
async function g(e) {
|
|
43
|
+
n();
|
|
44
|
+
const t = e?.apiKey?.trim();
|
|
45
|
+
if (t)
|
|
46
|
+
return {
|
|
47
|
+
apiKey: t,
|
|
48
|
+
source: "manual"
|
|
49
|
+
};
|
|
50
|
+
const o = await K();
|
|
51
|
+
if (o)
|
|
52
|
+
return {
|
|
53
|
+
apiKey: o,
|
|
54
|
+
source: "stored"
|
|
55
|
+
};
|
|
56
|
+
const r = E();
|
|
57
|
+
return r ? {
|
|
58
|
+
apiKey: r,
|
|
59
|
+
source: "env"
|
|
60
|
+
} : {
|
|
61
|
+
apiKey: null,
|
|
62
|
+
source: "none"
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function v(e) {
|
|
66
|
+
n();
|
|
67
|
+
const t = await g({
|
|
68
|
+
apiKey: e?.apiKey
|
|
69
|
+
});
|
|
70
|
+
if (!t.apiKey || t.source === "none")
|
|
71
|
+
throw new Error(
|
|
72
|
+
"Cortex AI requires OPENROUTER_API_KEY or an encrypted OpenRouter BYOK in site settings."
|
|
73
|
+
);
|
|
74
|
+
const o = I({
|
|
75
|
+
apiKey: t.apiKey,
|
|
76
|
+
fetch: e?.fetch
|
|
77
|
+
}), r = e?.modelSelection !== void 0 ? e.modelSelection : t.source === "stored" ? await x() : null;
|
|
78
|
+
return {
|
|
79
|
+
credentialSource: t.source,
|
|
80
|
+
model: (i) => o.chatModel(i || "openrouter/free"),
|
|
81
|
+
modelSelection: r
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
async function P({
|
|
85
|
+
apiKey: e,
|
|
86
|
+
fallbackModelIds: t,
|
|
87
|
+
modelId: o,
|
|
88
|
+
...r
|
|
89
|
+
}) {
|
|
90
|
+
n();
|
|
91
|
+
const i = await v({ apiKey: e, modelSelection: r.modelSelection }), l = A({
|
|
92
|
+
credentialSource: i.credentialSource,
|
|
93
|
+
fallbackModelIds: t,
|
|
94
|
+
requestedModelId: o,
|
|
95
|
+
selectedModel: i.modelSelection
|
|
96
|
+
}), a = await S({
|
|
97
|
+
modelIds: l.modelIds,
|
|
98
|
+
execute: (c) => {
|
|
99
|
+
const u = f(
|
|
100
|
+
{
|
|
101
|
+
...r,
|
|
102
|
+
maxRetries: 0
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
modelId: c,
|
|
106
|
+
modelSelection: l.modelSelection
|
|
107
|
+
}
|
|
108
|
+
);
|
|
109
|
+
return d({
|
|
110
|
+
...u,
|
|
111
|
+
model: i.model(c)
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
});
|
|
115
|
+
return {
|
|
116
|
+
attempts: a.attempts,
|
|
117
|
+
credentialSource: i.credentialSource,
|
|
118
|
+
modelId: a.modelId,
|
|
119
|
+
result: a.result
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
export {
|
|
123
|
+
N as CORTEX_AI_FREE_MODEL_FALLBACK_REGISTRY,
|
|
124
|
+
X as CORTEX_AI_MODEL_REGISTRY,
|
|
125
|
+
_ as CORTEX_AI_OPENROUTER_BASE_URL,
|
|
126
|
+
F as CORTEX_AI_OPENROUTER_FREE_ROUTER_MODEL,
|
|
127
|
+
Y as CORTEX_AI_REQUIRED_MODEL_PARAMETERS,
|
|
128
|
+
k as CortexAiRoutingError,
|
|
129
|
+
D as buildCortexAiModelFallbackChain,
|
|
130
|
+
A as buildCortexAiRoutingPolicy,
|
|
131
|
+
v as createCortexAiOpenRouterClient,
|
|
132
|
+
I as createCortexAiOpenRouterProvider,
|
|
133
|
+
P as generateCortexAiText,
|
|
134
|
+
x as getStoredCortexAiModelSelection,
|
|
135
|
+
G as isOpenRouterRateLimitError,
|
|
136
|
+
q as isOpenRouterRecoverableRoutingError,
|
|
137
|
+
f as omitUnsupportedCortexAiModelOptions,
|
|
138
|
+
g as resolveCortexAiOpenRouterCredential,
|
|
139
|
+
S as runWithCortexAiModelFallback,
|
|
140
|
+
B as summarizeCortexAiRoutingError
|
|
141
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./ai-key-crypto.cjs.js"),o=require("@nextblock-cms/db/secrets"),y="Cortex AI configuration can only be imported from server-side code.";function t(){if(!(typeof window>"u"))throw new Error(y)}const p="cortex-ai",_="NextBlock Cortex AI",c="cortex_ai_openrouter_api_key",O="cortex_ai_openrouter_model_selection";function n(e){return process.env[e]?.trim()||null}function u(){return t(),n("OPENROUTER_API_KEY")}function i(){t();const e=u();return{encryptionKey:n("CORTEX_AI_ENCRYPTION_KEY"),freemiusSandboxKey:n("FREEMIUS_AI_SANDBOX_KEY"),hasEncryptionKey:o.hasSecretEncryptionKey(),hasOpenRouterEnvKey:!!e,openRouterEnvKeyLast4:e?e.slice(-4):null}}function R(){t();const e=o.resolveSecretEncryptionKey();if(!e)throw new Error("An encryption key (NEXTBLOCK_ENCRYPTION_KEY, CORTEX_AI_ENCRYPTION_KEY, or a Supabase service-role key) is required to manage stored OpenRouter keys.");return e}function s(e){return r.encryptOpenRouterApiKey({apiKey:e,encryptionSecret:R()})}function K(e){t();const E=o.tryDecryptWithEnvKey(e);if(E===null)throw new Error("Failed to decrypt stored OpenRouter key.");return E}function A(e){return r.getOpenRouterKeyEnvelopeStatus(e)}function a(){t();const e=i();return{hasEnvOpenRouterKey:e.hasOpenRouterEnvKey,maskedEnvOpenRouterKey:e.openRouterEnvKeyLast4?r.getMaskedOpenRouterKey(e.openRouterEnvKeyLast4):null}}exports.CORTEX_AI_OPENROUTER_MODEL_SELECTION_SETTING_KEY=O;exports.CORTEX_AI_OPENROUTER_SETTING_KEY=c;exports.CORTEX_AI_PACKAGE_ID=p;exports.CORTEX_AI_PACKAGE_NAME=_;exports.decryptStoredOpenRouterApiKey=K;exports.encryptStoredOpenRouterApiKey=s;exports.getCortexAiEnvConfig=i;exports.getEnvOpenRouterKeyStatus=a;exports.getOpenRouterEnvApiKey=u;exports.getStoredOpenRouterKeyStatus=A;
|