@copilotkit/shared 1.51.5-next.0 → 1.51.5-next.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/CHANGELOG.md +4 -0
- package/dist/_virtual/_rolldown/runtime.cjs +29 -0
- package/dist/constants/index.cjs +13 -0
- package/dist/constants/index.cjs.map +1 -0
- package/dist/constants/{index.d.ts → index.d.cts} +3 -1
- package/dist/constants/index.d.cts.map +1 -0
- package/dist/constants/index.d.mts +8 -0
- package/dist/constants/index.d.mts.map +1 -0
- package/dist/constants/index.mjs +8 -12
- package/dist/constants/index.mjs.map +1 -1
- package/dist/index.cjs +64 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +22 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +23 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +16 -123
- package/dist/index.mjs.map +1 -1
- package/dist/index.umd.js +1017 -2
- package/dist/index.umd.js.map +1 -1
- package/dist/package.cjs +12 -0
- package/dist/package.cjs.map +1 -0
- package/dist/package.mjs +6 -0
- package/dist/package.mjs.map +1 -0
- package/dist/telemetry/events.d.cts +47 -0
- package/dist/telemetry/events.d.cts.map +1 -0
- package/dist/telemetry/events.d.mts +47 -0
- package/dist/telemetry/events.d.mts.map +1 -0
- package/dist/telemetry/index.d.mts +1 -0
- package/dist/telemetry/scarf-client.cjs +29 -0
- package/dist/telemetry/scarf-client.cjs.map +1 -0
- package/dist/telemetry/scarf-client.mjs +27 -5
- package/dist/telemetry/scarf-client.mjs.map +1 -1
- package/dist/telemetry/telemetry-client.cjs +87 -0
- package/dist/telemetry/telemetry-client.cjs.map +1 -0
- package/dist/telemetry/telemetry-client.d.cts +48 -0
- package/dist/telemetry/telemetry-client.d.cts.map +1 -0
- package/dist/telemetry/telemetry-client.d.mts +48 -0
- package/dist/telemetry/telemetry-client.d.mts.map +1 -0
- package/dist/telemetry/telemetry-client.mjs +83 -9
- package/dist/telemetry/telemetry-client.mjs.map +1 -1
- package/dist/telemetry/utils.cjs +16 -0
- package/dist/telemetry/utils.cjs.map +1 -0
- package/dist/telemetry/utils.mjs +14 -8
- package/dist/telemetry/utils.mjs.map +1 -1
- package/dist/types/{action.d.ts → action.d.cts} +32 -32
- package/dist/types/action.d.cts.map +1 -0
- package/dist/types/action.d.mts +59 -0
- package/dist/types/action.d.mts.map +1 -0
- package/dist/types/copilot-cloud-config.d.cts +15 -0
- package/dist/types/copilot-cloud-config.d.cts.map +1 -0
- package/dist/types/copilot-cloud-config.d.mts +15 -0
- package/dist/types/copilot-cloud-config.d.mts.map +1 -0
- package/dist/types/error.d.cts +57 -0
- package/dist/types/error.d.cts.map +1 -0
- package/dist/types/error.d.mts +57 -0
- package/dist/types/error.d.mts.map +1 -0
- package/dist/types/{message.d.ts → message.d.cts} +14 -12
- package/dist/types/message.d.cts.map +1 -0
- package/dist/types/message.d.mts +31 -0
- package/dist/types/message.d.mts.map +1 -0
- package/dist/types/openai-assistant.d.cts +55 -0
- package/dist/types/openai-assistant.d.cts.map +1 -0
- package/dist/types/openai-assistant.d.mts +55 -0
- package/dist/types/openai-assistant.d.mts.map +1 -0
- package/dist/types/utility.d.cts +6 -0
- package/dist/types/utility.d.cts.map +1 -0
- package/dist/types/utility.d.mts +6 -0
- package/dist/types/utility.d.mts.map +1 -0
- package/dist/utils/conditions.cjs +32 -0
- package/dist/utils/conditions.cjs.map +1 -0
- package/dist/utils/{conditions.d.ts → conditions.d.cts} +16 -11
- package/dist/utils/conditions.d.cts.map +1 -0
- package/dist/utils/conditions.d.mts +31 -0
- package/dist/utils/conditions.d.mts.map +1 -0
- package/dist/utils/conditions.mjs +30 -6
- package/dist/utils/conditions.mjs.map +1 -1
- package/dist/utils/console-styling.cjs +91 -0
- package/dist/utils/console-styling.cjs.map +1 -0
- package/dist/utils/console-styling.d.cts +65 -0
- package/dist/utils/console-styling.d.cts.map +1 -0
- package/dist/utils/console-styling.d.mts +65 -0
- package/dist/utils/console-styling.d.mts.map +1 -0
- package/dist/utils/console-styling.mjs +83 -15
- package/dist/utils/console-styling.mjs.map +1 -1
- package/dist/utils/errors.cjs +439 -0
- package/dist/utils/errors.cjs.map +1 -0
- package/dist/utils/{errors.d.ts → errors.d.cts} +188 -156
- package/dist/utils/errors.d.cts.map +1 -0
- package/dist/utils/errors.d.mts +312 -0
- package/dist/utils/errors.d.mts.map +1 -0
- package/dist/utils/errors.mjs +416 -63
- package/dist/utils/errors.mjs.map +1 -1
- package/dist/utils/index.cjs +50 -0
- package/dist/utils/index.cjs.map +1 -0
- package/dist/utils/{index.d.ts → index.d.cts} +10 -11
- package/dist/utils/index.d.cts.map +1 -0
- package/dist/utils/index.d.mts +31 -0
- package/dist/utils/index.d.mts.map +1 -0
- package/dist/utils/index.mjs +47 -107
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/json-schema.cjs +157 -0
- package/dist/utils/json-schema.cjs.map +1 -0
- package/dist/utils/{json-schema.d.ts → json-schema.d.cts} +19 -17
- package/dist/utils/json-schema.d.cts.map +1 -0
- package/dist/utils/json-schema.d.mts +36 -0
- package/dist/utils/json-schema.d.mts.map +1 -0
- package/dist/utils/json-schema.mjs +152 -12
- package/dist/utils/json-schema.mjs.map +1 -1
- package/dist/utils/random-id.cjs +38 -0
- package/dist/utils/random-id.cjs.map +1 -0
- package/dist/utils/{random-id.d.ts → random-id.d.cts} +3 -1
- package/dist/utils/random-id.d.cts.map +1 -0
- package/dist/utils/random-id.d.mts +8 -0
- package/dist/utils/random-id.d.mts.map +1 -0
- package/dist/utils/random-id.mjs +33 -12
- package/dist/utils/random-id.mjs.map +1 -1
- package/dist/utils/requests.cjs +58 -0
- package/dist/utils/requests.cjs.map +1 -0
- package/dist/utils/{requests.d.ts → requests.d.cts} +3 -1
- package/dist/utils/requests.d.cts.map +1 -0
- package/dist/utils/requests.d.mts +12 -0
- package/dist/utils/requests.d.mts.map +1 -0
- package/dist/utils/requests.mjs +56 -6
- package/dist/utils/requests.mjs.map +1 -1
- package/dist/utils/{types.d.ts → types.d.cts} +9 -7
- package/dist/utils/types.d.cts.map +1 -0
- package/dist/utils/types.d.mts +22 -0
- package/dist/utils/types.d.mts.map +1 -0
- package/package.json +16 -14
- package/tsdown.config.ts +36 -0
- package/vitest.config.mjs +11 -0
- package/dist/chunk-2OJ5OJ2D.mjs +0 -1
- package/dist/chunk-2OJ5OJ2D.mjs.map +0 -1
- package/dist/chunk-3DK3UMRW.mjs +0 -217
- package/dist/chunk-3DK3UMRW.mjs.map +0 -1
- package/dist/chunk-7KOT4KP4.mjs +0 -435
- package/dist/chunk-7KOT4KP4.mjs.map +0 -1
- package/dist/chunk-DE5XAMMI.mjs +0 -110
- package/dist/chunk-DE5XAMMI.mjs.map +0 -1
- package/dist/chunk-FCCOSO5L.mjs +0 -1
- package/dist/chunk-FCCOSO5L.mjs.map +0 -1
- package/dist/chunk-GS5BLXSZ.mjs +0 -41
- package/dist/chunk-GS5BLXSZ.mjs.map +0 -1
- package/dist/chunk-IAFBVORQ.mjs +0 -1
- package/dist/chunk-IAFBVORQ.mjs.map +0 -1
- package/dist/chunk-M2RJI5BZ.mjs +0 -94
- package/dist/chunk-M2RJI5BZ.mjs.map +0 -1
- package/dist/chunk-MSUB6DGR.mjs +0 -1
- package/dist/chunk-MSUB6DGR.mjs.map +0 -1
- package/dist/chunk-N5EP5OD5.mjs +0 -1
- package/dist/chunk-N5EP5OD5.mjs.map +0 -1
- package/dist/chunk-NAFEBKSO.mjs +0 -1
- package/dist/chunk-NAFEBKSO.mjs.map +0 -1
- package/dist/chunk-P7STFMPO.mjs +0 -1
- package/dist/chunk-P7STFMPO.mjs.map +0 -1
- package/dist/chunk-UYARLQNA.mjs +0 -1
- package/dist/chunk-UYARLQNA.mjs.map +0 -1
- package/dist/chunk-V7BSERGI.mjs +0 -62
- package/dist/chunk-V7BSERGI.mjs.map +0 -1
- package/dist/chunk-WAZHII6M.mjs +0 -67
- package/dist/chunk-WAZHII6M.mjs.map +0 -1
- package/dist/chunk-XTHC46M2.mjs +0 -1
- package/dist/chunk-XTHC46M2.mjs.map +0 -1
- package/dist/chunk-ZI7ZVRL3.mjs +0 -38
- package/dist/chunk-ZI7ZVRL3.mjs.map +0 -1
- package/dist/chunk-ZIC6V6S5.mjs +0 -13
- package/dist/chunk-ZIC6V6S5.mjs.map +0 -1
- package/dist/chunk-ZUE2VR7D.mjs +0 -38
- package/dist/chunk-ZUE2VR7D.mjs.map +0 -1
- package/dist/constants/index.js +0 -40
- package/dist/constants/index.js.map +0 -1
- package/dist/index.d.ts +0 -25
- package/dist/index.js +0 -1138
- package/dist/index.js.map +0 -1
- package/dist/telemetry/events.d.ts +0 -45
- package/dist/telemetry/events.js +0 -19
- package/dist/telemetry/events.js.map +0 -1
- package/dist/telemetry/events.mjs +0 -1
- package/dist/telemetry/events.mjs.map +0 -1
- package/dist/telemetry/index.d.ts +0 -3
- package/dist/telemetry/index.js +0 -191
- package/dist/telemetry/index.js.map +0 -1
- package/dist/telemetry/index.mjs +0 -12
- package/dist/telemetry/index.mjs.map +0 -1
- package/dist/telemetry/scarf-client.d.ts +0 -7
- package/dist/telemetry/scarf-client.js +0 -59
- package/dist/telemetry/scarf-client.js.map +0 -1
- package/dist/telemetry/security-check.d.ts +0 -2
- package/dist/telemetry/security-check.js +0 -2
- package/dist/telemetry/security-check.js.map +0 -1
- package/dist/telemetry/security-check.mjs +0 -1
- package/dist/telemetry/security-check.mjs.map +0 -1
- package/dist/telemetry/telemetry-client.d.ts +0 -40
- package/dist/telemetry/telemetry-client.js +0 -189
- package/dist/telemetry/telemetry-client.js.map +0 -1
- package/dist/telemetry/utils.d.ts +0 -8
- package/dist/telemetry/utils.js +0 -73
- package/dist/telemetry/utils.js.map +0 -1
- package/dist/types/action.js +0 -19
- package/dist/types/action.js.map +0 -1
- package/dist/types/action.mjs +0 -2
- package/dist/types/action.mjs.map +0 -1
- package/dist/types/copilot-cloud-config.d.ts +0 -13
- package/dist/types/copilot-cloud-config.js +0 -19
- package/dist/types/copilot-cloud-config.js.map +0 -1
- package/dist/types/copilot-cloud-config.mjs +0 -2
- package/dist/types/copilot-cloud-config.mjs.map +0 -1
- package/dist/types/error.d.ts +0 -55
- package/dist/types/error.js +0 -19
- package/dist/types/error.js.map +0 -1
- package/dist/types/error.mjs +0 -2
- package/dist/types/error.mjs.map +0 -1
- package/dist/types/index.d.ts +0 -7
- package/dist/types/index.js +0 -19
- package/dist/types/index.js.map +0 -1
- package/dist/types/index.mjs +0 -8
- package/dist/types/index.mjs.map +0 -1
- package/dist/types/message.js +0 -19
- package/dist/types/message.js.map +0 -1
- package/dist/types/message.mjs +0 -2
- package/dist/types/message.mjs.map +0 -1
- package/dist/types/openai-assistant.d.ts +0 -53
- package/dist/types/openai-assistant.js +0 -19
- package/dist/types/openai-assistant.js.map +0 -1
- package/dist/types/openai-assistant.mjs +0 -2
- package/dist/types/openai-assistant.mjs.map +0 -1
- package/dist/types/utility.d.ts +0 -6
- package/dist/types/utility.js +0 -19
- package/dist/types/utility.js.map +0 -1
- package/dist/types/utility.mjs +0 -2
- package/dist/types/utility.mjs.map +0 -1
- package/dist/utils/conditions.js +0 -86
- package/dist/utils/conditions.js.map +0 -1
- package/dist/utils/console-styling.d.ts +0 -84
- package/dist/utils/console-styling.js +0 -123
- package/dist/utils/console-styling.js.map +0 -1
- package/dist/utils/errors.js +0 -452
- package/dist/utils/errors.js.map +0 -1
- package/dist/utils/index.js +0 -964
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/json-schema.js +0 -244
- package/dist/utils/json-schema.js.map +0 -1
- package/dist/utils/random-id.js +0 -68
- package/dist/utils/random-id.js.map +0 -1
- package/dist/utils/requests.js +0 -91
- package/dist/utils/requests.js.map +0 -1
- package/dist/utils/types.js +0 -19
- package/dist/utils/types.js.map +0 -1
- package/dist/utils/types.mjs +0 -2
- package/dist/utils/types.mjs.map +0 -1
- package/jest.config.js +0 -5
- package/rollup.config.mjs +0 -54
- package/tsup.config.ts +0 -15
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/utils/conditions.d.ts
|
|
2
|
+
type ComparisonRule = "EQUALS" | "NOT_EQUALS" | "GREATER_THAN" | "LESS_THAN" | "CONTAINS" | "NOT_CONTAINS" | "MATCHES" | "STARTS_WITH" | "ENDS_WITH";
|
|
3
|
+
type LogicalRule = "AND" | "OR" | "NOT";
|
|
4
|
+
type ExistenceRule = "EXISTS" | "NOT_EXISTS";
|
|
5
|
+
type Rule = ComparisonRule | LogicalRule | ExistenceRule;
|
|
6
|
+
interface BaseCondition {
|
|
7
|
+
rule: Rule;
|
|
8
|
+
path?: string;
|
|
9
|
+
}
|
|
10
|
+
interface ComparisonCondition extends BaseCondition {
|
|
11
|
+
rule: ComparisonRule;
|
|
12
|
+
value: any;
|
|
13
|
+
}
|
|
14
|
+
interface LogicalCondition extends BaseCondition {
|
|
15
|
+
rule: LogicalRule;
|
|
16
|
+
conditions: Condition[];
|
|
17
|
+
}
|
|
18
|
+
interface ExistenceCondition extends BaseCondition {
|
|
19
|
+
rule: ExistenceRule;
|
|
20
|
+
}
|
|
21
|
+
type Condition = ComparisonCondition | LogicalCondition | ExistenceCondition;
|
|
22
|
+
declare function executeConditions({
|
|
23
|
+
conditions,
|
|
24
|
+
value
|
|
25
|
+
}: {
|
|
26
|
+
conditions?: Condition[];
|
|
27
|
+
value: any;
|
|
28
|
+
}): boolean;
|
|
29
|
+
//#endregion
|
|
30
|
+
export { BaseCondition, ComparisonCondition, ComparisonRule, Condition, ExistenceCondition, ExistenceRule, LogicalCondition, LogicalRule, Rule, executeConditions };
|
|
31
|
+
//# sourceMappingURL=conditions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"conditions.d.mts","names":[],"sources":["../../src/utils/conditions.ts"],"mappings":";KAAY,cAAA;AAAA,KAUA,WAAA;AAAA,KACA,aAAA;AAAA,KAEA,IAAA,GAAO,cAAA,GAAiB,WAAA,GAAc,aAAA;AAAA,UAEjC,aAAA;EACf,IAAA,EAAM,IAAA;EACN,IAAA;AAAA;AAAA,UAGe,mBAAA,SAA4B,aAAA;EAC3C,IAAA,EAAM,cAAA;EACN,KAAA;AAAA;AAAA,UAGe,gBAAA,SAAyB,aAAA;EACxC,IAAA,EAAM,WAAA;EACN,UAAA,EAAY,SAAA;AAAA;AAAA,UAGG,kBAAA,SAA2B,aAAA;EAC1C,IAAA,EAAM,aAAA;AAAA;AAAA,KAGI,SAAA,GACR,mBAAA,GACA,gBAAA,GACA,kBAAA;AAAA,iBAEY,iBAAA,CAAA;EACd,UAAA;EACA;AAAA;EAEA,UAAA,GAAa,SAAA;EACb,KAAA;AAAA"}
|
|
@@ -1,7 +1,31 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
//#region src/utils/conditions.ts
|
|
2
|
+
function executeConditions({ conditions, value }) {
|
|
3
|
+
if (!conditions?.length) return true;
|
|
4
|
+
return conditions.every((condition) => executeCondition(condition, value));
|
|
5
|
+
}
|
|
6
|
+
function executeCondition(condition, value) {
|
|
7
|
+
const targetValue = condition.path ? getValueFromPath(value, condition.path) : value;
|
|
8
|
+
switch (condition.rule) {
|
|
9
|
+
case "AND": return condition.conditions.every((c) => executeCondition(c, value));
|
|
10
|
+
case "OR": return condition.conditions.some((c) => executeCondition(c, value));
|
|
11
|
+
case "NOT": return !condition.conditions.every((c) => executeCondition(c, value));
|
|
12
|
+
case "EQUALS": return targetValue === condition.value;
|
|
13
|
+
case "NOT_EQUALS": return targetValue !== condition.value;
|
|
14
|
+
case "GREATER_THAN": return targetValue > condition.value;
|
|
15
|
+
case "LESS_THAN": return targetValue < condition.value;
|
|
16
|
+
case "CONTAINS": return Array.isArray(targetValue) && targetValue.includes(condition.value);
|
|
17
|
+
case "NOT_CONTAINS": return Array.isArray(targetValue) && !targetValue.includes(condition.value);
|
|
18
|
+
case "MATCHES": return new RegExp(condition.value).test(String(targetValue));
|
|
19
|
+
case "STARTS_WITH": return String(targetValue).startsWith(condition.value);
|
|
20
|
+
case "ENDS_WITH": return String(targetValue).endsWith(condition.value);
|
|
21
|
+
case "EXISTS": return targetValue !== void 0 && targetValue !== null;
|
|
22
|
+
case "NOT_EXISTS": return targetValue === void 0 || targetValue === null;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function getValueFromPath(obj, path) {
|
|
26
|
+
return path.split(".").reduce((acc, part) => acc?.[part], obj);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
//#endregion
|
|
30
|
+
export { executeConditions };
|
|
7
31
|
//# sourceMappingURL=conditions.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"
|
|
1
|
+
{"version":3,"file":"conditions.mjs","names":[],"sources":["../../src/utils/conditions.ts"],"sourcesContent":["export type ComparisonRule =\n | \"EQUALS\"\n | \"NOT_EQUALS\"\n | \"GREATER_THAN\"\n | \"LESS_THAN\"\n | \"CONTAINS\"\n | \"NOT_CONTAINS\"\n | \"MATCHES\"\n | \"STARTS_WITH\"\n | \"ENDS_WITH\";\nexport type LogicalRule = \"AND\" | \"OR\" | \"NOT\";\nexport type ExistenceRule = \"EXISTS\" | \"NOT_EXISTS\";\n\nexport type Rule = ComparisonRule | LogicalRule | ExistenceRule;\n\nexport interface BaseCondition {\n rule: Rule;\n path?: string;\n}\n\nexport interface ComparisonCondition extends BaseCondition {\n rule: ComparisonRule;\n value: any;\n}\n\nexport interface LogicalCondition extends BaseCondition {\n rule: LogicalRule;\n conditions: Condition[];\n}\n\nexport interface ExistenceCondition extends BaseCondition {\n rule: ExistenceRule;\n}\n\nexport type Condition =\n | ComparisonCondition\n | LogicalCondition\n | ExistenceCondition;\n\nexport function executeConditions({\n conditions,\n value,\n}: {\n conditions?: Condition[];\n value: any;\n}): boolean {\n // If no conditions, consider it a pass\n if (!conditions?.length) return true;\n\n // Run all conditions (implicit AND)\n return conditions.every((condition) => executeCondition(condition, value));\n}\n\nfunction executeCondition(condition: Condition, value: any): boolean {\n const targetValue = condition.path\n ? getValueFromPath(value, condition.path)\n : value;\n\n switch (condition.rule) {\n // Logical\n case \"AND\":\n return (condition as LogicalCondition).conditions.every((c) =>\n executeCondition(c, value),\n );\n case \"OR\":\n return (condition as LogicalCondition).conditions.some((c) =>\n executeCondition(c, value),\n );\n case \"NOT\":\n return !(condition as LogicalCondition).conditions.every((c) =>\n executeCondition(c, value),\n );\n\n // Comparison\n case \"EQUALS\":\n return targetValue === (condition as ComparisonCondition).value;\n case \"NOT_EQUALS\":\n return targetValue !== (condition as ComparisonCondition).value;\n case \"GREATER_THAN\":\n return targetValue > (condition as ComparisonCondition).value;\n case \"LESS_THAN\":\n return targetValue < (condition as ComparisonCondition).value;\n case \"CONTAINS\":\n return (\n Array.isArray(targetValue) &&\n targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"NOT_CONTAINS\":\n return (\n Array.isArray(targetValue) &&\n !targetValue.includes((condition as ComparisonCondition).value)\n );\n case \"MATCHES\":\n return new RegExp((condition as ComparisonCondition).value).test(\n String(targetValue),\n );\n case \"STARTS_WITH\":\n return String(targetValue).startsWith(\n (condition as ComparisonCondition).value,\n );\n case \"ENDS_WITH\":\n return String(targetValue).endsWith(\n (condition as ComparisonCondition).value,\n );\n\n // Existence\n case \"EXISTS\":\n return targetValue !== undefined && targetValue !== null;\n case \"NOT_EXISTS\":\n return targetValue === undefined || targetValue === null;\n }\n}\n\nfunction getValueFromPath(obj: any, path: string): any {\n return path.split(\".\").reduce((acc, part) => acc?.[part], obj);\n}\n"],"mappings":";AAuCA,SAAgB,kBAAkB,EAChC,YACA,SAIU;AAEV,KAAI,CAAC,YAAY,OAAQ,QAAO;AAGhC,QAAO,WAAW,OAAO,cAAc,iBAAiB,WAAW,MAAM,CAAC;;AAG5E,SAAS,iBAAiB,WAAsB,OAAqB;CACnE,MAAM,cAAc,UAAU,OAC1B,iBAAiB,OAAO,UAAU,KAAK,GACvC;AAEJ,SAAQ,UAAU,MAAlB;EAEE,KAAK,MACH,QAAQ,UAA+B,WAAW,OAAO,MACvD,iBAAiB,GAAG,MAAM,CAC3B;EACH,KAAK,KACH,QAAQ,UAA+B,WAAW,MAAM,MACtD,iBAAiB,GAAG,MAAM,CAC3B;EACH,KAAK,MACH,QAAO,CAAE,UAA+B,WAAW,OAAO,MACxD,iBAAiB,GAAG,MAAM,CAC3B;EAGH,KAAK,SACH,QAAO,gBAAiB,UAAkC;EAC5D,KAAK,aACH,QAAO,gBAAiB,UAAkC;EAC5D,KAAK,eACH,QAAO,cAAe,UAAkC;EAC1D,KAAK,YACH,QAAO,cAAe,UAAkC;EAC1D,KAAK,WACH,QACE,MAAM,QAAQ,YAAY,IAC1B,YAAY,SAAU,UAAkC,MAAM;EAElE,KAAK,eACH,QACE,MAAM,QAAQ,YAAY,IAC1B,CAAC,YAAY,SAAU,UAAkC,MAAM;EAEnE,KAAK,UACH,QAAO,IAAI,OAAQ,UAAkC,MAAM,CAAC,KAC1D,OAAO,YAAY,CACpB;EACH,KAAK,cACH,QAAO,OAAO,YAAY,CAAC,WACxB,UAAkC,MACpC;EACH,KAAK,YACH,QAAO,OAAO,YAAY,CAAC,SACxB,UAAkC,MACpC;EAGH,KAAK,SACH,QAAO,gBAAgB,UAAa,gBAAgB;EACtD,KAAK,aACH,QAAO,gBAAgB,UAAa,gBAAgB;;;AAI1D,SAAS,iBAAiB,KAAU,MAAmB;AACrD,QAAO,KAAK,MAAM,IAAI,CAAC,QAAQ,KAAK,SAAS,MAAM,OAAO,IAAI"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
|
|
2
|
+
//#region src/utils/console-styling.ts
|
|
3
|
+
/**
|
|
4
|
+
* Console styling utilities for CopilotKit branded messages
|
|
5
|
+
* Provides consistent, readable colors across light and dark console themes
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Color palette optimized for console readability
|
|
9
|
+
*/
|
|
10
|
+
const ConsoleColors = {
|
|
11
|
+
primary: "#007acc",
|
|
12
|
+
success: "#22c55e",
|
|
13
|
+
feature: "#a855f7",
|
|
14
|
+
cta: "#ef4444",
|
|
15
|
+
info: "#06b6d4",
|
|
16
|
+
inherit: "inherit",
|
|
17
|
+
warning: "#f59e0b"
|
|
18
|
+
};
|
|
19
|
+
/**
|
|
20
|
+
* Console style templates for common patterns
|
|
21
|
+
*/
|
|
22
|
+
const ConsoleStyles = {
|
|
23
|
+
header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,
|
|
24
|
+
section: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
25
|
+
highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,
|
|
26
|
+
cta: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
27
|
+
info: `color: ${ConsoleColors.info}; font-weight: bold;`,
|
|
28
|
+
link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,
|
|
29
|
+
body: `color: ${ConsoleColors.inherit};`,
|
|
30
|
+
warning: `color: ${ConsoleColors.cta}; font-weight: bold;`
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* Styled console message for CopilotKit Platform promotion
|
|
34
|
+
* Displays a beautiful, branded advertisement in the console
|
|
35
|
+
*/
|
|
36
|
+
function logCopilotKitPlatformMessage() {
|
|
37
|
+
console.log(`%cCopilotKit Warning%c
|
|
38
|
+
|
|
39
|
+
useCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. To enable this premium feature, add your public license key, available for free at:
|
|
40
|
+
|
|
41
|
+
%chttps://cloud.copilotkit.ai%c
|
|
42
|
+
|
|
43
|
+
Alternatively, useCopilotChat is available for basic programmatic control, and does not require an API key.
|
|
44
|
+
|
|
45
|
+
To learn more about premium features, read the documentation here:
|
|
46
|
+
|
|
47
|
+
%chttps://docs.copilotkit.ai/premium%c`, ConsoleStyles.header, ConsoleStyles.body, ConsoleStyles.cta, ConsoleStyles.body, ConsoleStyles.link, ConsoleStyles.body);
|
|
48
|
+
}
|
|
49
|
+
function publicApiKeyRequired(feature) {
|
|
50
|
+
console.log(`
|
|
51
|
+
%cCopilotKit Warning%c \n
|
|
52
|
+
In order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.
|
|
53
|
+
`.trim(), ConsoleStyles.header, ConsoleStyles.body);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Create a styled console message with custom content
|
|
57
|
+
*
|
|
58
|
+
* @param template - Template string with %c placeholders
|
|
59
|
+
* @param styles - Array of style strings matching the %c placeholders
|
|
60
|
+
*
|
|
61
|
+
* @example
|
|
62
|
+
* ```typescript
|
|
63
|
+
* logStyled(
|
|
64
|
+
* '%cCopilotKit%c Welcome to the platform!',
|
|
65
|
+
* [ConsoleStyles.header, ConsoleStyles.body]
|
|
66
|
+
* );
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
function logStyled(template, styles) {
|
|
70
|
+
console.log(template, ...styles);
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Quick styled console methods for common use cases
|
|
74
|
+
*/
|
|
75
|
+
const styledConsole = {
|
|
76
|
+
success: (message) => logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),
|
|
77
|
+
info: (message) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),
|
|
78
|
+
feature: (message) => logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),
|
|
79
|
+
cta: (message) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),
|
|
80
|
+
logCopilotKitPlatformMessage,
|
|
81
|
+
publicApiKeyRequired
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
//#endregion
|
|
85
|
+
exports.ConsoleColors = ConsoleColors;
|
|
86
|
+
exports.ConsoleStyles = ConsoleStyles;
|
|
87
|
+
exports.logCopilotKitPlatformMessage = logCopilotKitPlatformMessage;
|
|
88
|
+
exports.logStyled = logStyled;
|
|
89
|
+
exports.publicApiKeyRequired = publicApiKeyRequired;
|
|
90
|
+
exports.styledConsole = styledConsole;
|
|
91
|
+
//# sourceMappingURL=console-styling.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-styling.cjs","names":[],"sources":["../../src/utils/console-styling.ts"],"sourcesContent":["/**\n * Console styling utilities for CopilotKit branded messages\n * Provides consistent, readable colors across light and dark console themes\n */\n\n/**\n * Color palette optimized for console readability\n */\nexport const ConsoleColors = {\n /** Primary brand blue - for titles and links */\n primary: \"#007acc\",\n /** Success green - for positive messaging */\n success: \"#22c55e\",\n /** Purple - for feature highlights */\n feature: \"#a855f7\",\n /** Red - for calls-to-action */\n cta: \"#ef4444\",\n /** Cyan - for closing statements */\n info: \"#06b6d4\",\n /** Inherit console default - for body text */\n inherit: \"inherit\",\n /** Warning style */\n warning: \"#f59e0b\",\n} as const;\n\n/**\n * Console style templates for common patterns\n */\nexport const ConsoleStyles = {\n /** Large header style */\n header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,\n /** Section header style */\n section: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Feature highlight style */\n highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,\n /** Call-to-action style */\n cta: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Info style */\n info: `color: ${ConsoleColors.info}; font-weight: bold;`,\n /** Link style */\n link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,\n /** Body text - inherits console theme */\n body: `color: ${ConsoleColors.inherit};`,\n /** Warning style */\n warning: `color: ${ConsoleColors.cta}; font-weight: bold;`,\n} as const;\n\n/**\n * Styled console message for CopilotKit Platform promotion\n * Displays a beautiful, branded advertisement in the console\n */\nexport function logCopilotKitPlatformMessage() {\n console.log(\n `%cCopilotKit Warning%c\n\nuseCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. To enable this premium feature, add your public license key, available for free at:\n\n%chttps://cloud.copilotkit.ai%c\n\nAlternatively, useCopilotChat is available for basic programmatic control, and does not require an API key.\n\nTo learn more about premium features, read the documentation here:\n\n%chttps://docs.copilotkit.ai/premium%c`,\n ConsoleStyles.header,\n ConsoleStyles.body,\n ConsoleStyles.cta,\n ConsoleStyles.body,\n ConsoleStyles.link,\n ConsoleStyles.body,\n );\n}\n\nexport function publicApiKeyRequired(feature: string) {\n console.log(\n `\n%cCopilotKit Warning%c \\n\nIn order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.\n `.trim(),\n ConsoleStyles.header,\n ConsoleStyles.body,\n );\n}\n\n/**\n * Create a styled console message with custom content\n *\n * @param template - Template string with %c placeholders\n * @param styles - Array of style strings matching the %c placeholders\n *\n * @example\n * ```typescript\n * logStyled(\n * '%cCopilotKit%c Welcome to the platform!',\n * [ConsoleStyles.header, ConsoleStyles.body]\n * );\n * ```\n */\nexport function logStyled(template: string, styles: string[]) {\n console.log(template, ...styles);\n}\n\n/**\n * Quick styled console methods for common use cases\n */\nexport const styledConsole = {\n /** Log a success message */\n success: (message: string) =>\n logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),\n\n /** Log an info message */\n info: (message: string) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),\n\n /** Log a feature highlight */\n feature: (message: string) =>\n logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),\n\n /** Log a call-to-action */\n cta: (message: string) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),\n\n /** Log the CopilotKit platform promotion */\n logCopilotKitPlatformMessage: logCopilotKitPlatformMessage,\n\n /** Log a `publicApiKeyRequired` warning */\n publicApiKeyRequired: publicApiKeyRequired,\n} as const;\n"],"mappings":";;;;;;;;;AAQA,MAAa,gBAAgB;CAE3B,SAAS;CAET,SAAS;CAET,SAAS;CAET,KAAK;CAEL,MAAM;CAEN,SAAS;CAET,SAAS;CACV;;;;AAKD,MAAa,gBAAgB;CAE3B,QAAQ,UAAU,cAAc,QAAQ;CAExC,SAAS,UAAU,cAAc,QAAQ;CAEzC,WAAW,UAAU,cAAc,QAAQ;CAE3C,KAAK,UAAU,cAAc,QAAQ;CAErC,MAAM,UAAU,cAAc,KAAK;CAEnC,MAAM,UAAU,cAAc,QAAQ;CAEtC,MAAM,UAAU,cAAc,QAAQ;CAEtC,SAAS,UAAU,cAAc,IAAI;CACtC;;;;;AAMD,SAAgB,+BAA+B;AAC7C,SAAQ,IACN;;;;;;;;;;yCAWA,cAAc,QACd,cAAc,MACd,cAAc,KACd,cAAc,MACd,cAAc,MACd,cAAc,KACf;;AAGH,SAAgB,qBAAqB,SAAiB;AACpD,SAAQ,IACN;;kBAEc,QAAQ;MACpB,MAAM,EACR,cAAc,QACd,cAAc,KACf;;;;;;;;;;;;;;;;AAiBH,SAAgB,UAAU,UAAkB,QAAkB;AAC5D,SAAQ,IAAI,UAAU,GAAG,OAAO;;;;;AAMlC,MAAa,gBAAgB;CAE3B,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,QAAQ,CAAC;CAGtD,OAAO,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,KAAK,CAAC;CAG7E,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,UAAU,CAAC;CAGxD,MAAM,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,IAAI,CAAC;CAG7C;CAGR;CACvB"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/utils/console-styling.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Console styling utilities for CopilotKit branded messages
|
|
4
|
+
* Provides consistent, readable colors across light and dark console themes
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color palette optimized for console readability
|
|
8
|
+
*/
|
|
9
|
+
declare const ConsoleColors: {
|
|
10
|
+
/** Primary brand blue - for titles and links */readonly primary: "#007acc"; /** Success green - for positive messaging */
|
|
11
|
+
readonly success: "#22c55e"; /** Purple - for feature highlights */
|
|
12
|
+
readonly feature: "#a855f7"; /** Red - for calls-to-action */
|
|
13
|
+
readonly cta: "#ef4444"; /** Cyan - for closing statements */
|
|
14
|
+
readonly info: "#06b6d4"; /** Inherit console default - for body text */
|
|
15
|
+
readonly inherit: "inherit"; /** Warning style */
|
|
16
|
+
readonly warning: "#f59e0b";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Console style templates for common patterns
|
|
20
|
+
*/
|
|
21
|
+
declare const ConsoleStyles: {
|
|
22
|
+
/** Large header style */readonly header: "color: #f59e0b; font-weight: bold; font-size: 16px;"; /** Section header style */
|
|
23
|
+
readonly section: "color: #22c55e; font-weight: bold;"; /** Feature highlight style */
|
|
24
|
+
readonly highlight: "color: #a855f7; font-weight: bold;"; /** Call-to-action style */
|
|
25
|
+
readonly cta: "color: #22c55e; font-weight: bold;"; /** Info style */
|
|
26
|
+
readonly info: "color: #06b6d4; font-weight: bold;"; /** Link style */
|
|
27
|
+
readonly link: "color: #007acc; text-decoration: underline;"; /** Body text - inherits console theme */
|
|
28
|
+
readonly body: "color: inherit;"; /** Warning style */
|
|
29
|
+
readonly warning: "color: #ef4444; font-weight: bold;";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Styled console message for CopilotKit Platform promotion
|
|
33
|
+
* Displays a beautiful, branded advertisement in the console
|
|
34
|
+
*/
|
|
35
|
+
declare function logCopilotKitPlatformMessage(): void;
|
|
36
|
+
declare function publicApiKeyRequired(feature: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Create a styled console message with custom content
|
|
39
|
+
*
|
|
40
|
+
* @param template - Template string with %c placeholders
|
|
41
|
+
* @param styles - Array of style strings matching the %c placeholders
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* logStyled(
|
|
46
|
+
* '%cCopilotKit%c Welcome to the platform!',
|
|
47
|
+
* [ConsoleStyles.header, ConsoleStyles.body]
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare function logStyled(template: string, styles: string[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* Quick styled console methods for common use cases
|
|
54
|
+
*/
|
|
55
|
+
declare const styledConsole: {
|
|
56
|
+
/** Log a success message */readonly success: (message: string) => void; /** Log an info message */
|
|
57
|
+
readonly info: (message: string) => void; /** Log a feature highlight */
|
|
58
|
+
readonly feature: (message: string) => void; /** Log a call-to-action */
|
|
59
|
+
readonly cta: (message: string) => void; /** Log the CopilotKit platform promotion */
|
|
60
|
+
readonly logCopilotKitPlatformMessage: typeof logCopilotKitPlatformMessage; /** Log a `publicApiKeyRequired` warning */
|
|
61
|
+
readonly publicApiKeyRequired: typeof publicApiKeyRequired;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole };
|
|
65
|
+
//# sourceMappingURL=console-styling.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-styling.d.cts","names":[],"sources":["../../src/utils/console-styling.ts"],"mappings":";;AAQA;;;;;;cAAa,aAAA;;;+BAoBA;EAAA;;;;;;;;cAAA,aAAA;mGAuB+B;EAAA,wDAAA;EAAA,0DAsB5B;EAAA;uDAAoC;EAAA,8DAyB3B;EAAA,kCAAC;EAAA;;;;;;iBA/CV,4BAAA,CAAA;AAAA,iBAsBA,oBAAA,CAAqB,OAAA;;;;;;;;;;;;;;;iBAyBrB,SAAA,CAAU,QAAA,UAAkB,MAAA;;;;cAO/B,aAAA;;;;;gDAoBH,4BAAA;wCAAA,oBAAA;AAAA"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
//#region src/utils/console-styling.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Console styling utilities for CopilotKit branded messages
|
|
4
|
+
* Provides consistent, readable colors across light and dark console themes
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color palette optimized for console readability
|
|
8
|
+
*/
|
|
9
|
+
declare const ConsoleColors: {
|
|
10
|
+
/** Primary brand blue - for titles and links */readonly primary: "#007acc"; /** Success green - for positive messaging */
|
|
11
|
+
readonly success: "#22c55e"; /** Purple - for feature highlights */
|
|
12
|
+
readonly feature: "#a855f7"; /** Red - for calls-to-action */
|
|
13
|
+
readonly cta: "#ef4444"; /** Cyan - for closing statements */
|
|
14
|
+
readonly info: "#06b6d4"; /** Inherit console default - for body text */
|
|
15
|
+
readonly inherit: "inherit"; /** Warning style */
|
|
16
|
+
readonly warning: "#f59e0b";
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* Console style templates for common patterns
|
|
20
|
+
*/
|
|
21
|
+
declare const ConsoleStyles: {
|
|
22
|
+
/** Large header style */readonly header: "color: #f59e0b; font-weight: bold; font-size: 16px;"; /** Section header style */
|
|
23
|
+
readonly section: "color: #22c55e; font-weight: bold;"; /** Feature highlight style */
|
|
24
|
+
readonly highlight: "color: #a855f7; font-weight: bold;"; /** Call-to-action style */
|
|
25
|
+
readonly cta: "color: #22c55e; font-weight: bold;"; /** Info style */
|
|
26
|
+
readonly info: "color: #06b6d4; font-weight: bold;"; /** Link style */
|
|
27
|
+
readonly link: "color: #007acc; text-decoration: underline;"; /** Body text - inherits console theme */
|
|
28
|
+
readonly body: "color: inherit;"; /** Warning style */
|
|
29
|
+
readonly warning: "color: #ef4444; font-weight: bold;";
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Styled console message for CopilotKit Platform promotion
|
|
33
|
+
* Displays a beautiful, branded advertisement in the console
|
|
34
|
+
*/
|
|
35
|
+
declare function logCopilotKitPlatformMessage(): void;
|
|
36
|
+
declare function publicApiKeyRequired(feature: string): void;
|
|
37
|
+
/**
|
|
38
|
+
* Create a styled console message with custom content
|
|
39
|
+
*
|
|
40
|
+
* @param template - Template string with %c placeholders
|
|
41
|
+
* @param styles - Array of style strings matching the %c placeholders
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* ```typescript
|
|
45
|
+
* logStyled(
|
|
46
|
+
* '%cCopilotKit%c Welcome to the platform!',
|
|
47
|
+
* [ConsoleStyles.header, ConsoleStyles.body]
|
|
48
|
+
* );
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
declare function logStyled(template: string, styles: string[]): void;
|
|
52
|
+
/**
|
|
53
|
+
* Quick styled console methods for common use cases
|
|
54
|
+
*/
|
|
55
|
+
declare const styledConsole: {
|
|
56
|
+
/** Log a success message */readonly success: (message: string) => void; /** Log an info message */
|
|
57
|
+
readonly info: (message: string) => void; /** Log a feature highlight */
|
|
58
|
+
readonly feature: (message: string) => void; /** Log a call-to-action */
|
|
59
|
+
readonly cta: (message: string) => void; /** Log the CopilotKit platform promotion */
|
|
60
|
+
readonly logCopilotKitPlatformMessage: typeof logCopilotKitPlatformMessage; /** Log a `publicApiKeyRequired` warning */
|
|
61
|
+
readonly publicApiKeyRequired: typeof publicApiKeyRequired;
|
|
62
|
+
};
|
|
63
|
+
//#endregion
|
|
64
|
+
export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole };
|
|
65
|
+
//# sourceMappingURL=console-styling.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"console-styling.d.mts","names":[],"sources":["../../src/utils/console-styling.ts"],"mappings":";;AAQA;;;;;;cAAa,aAAA;;;+BAoBA;EAAA;;;;;;;;cAAA,aAAA;mGAuB+B;EAAA,wDAAA;EAAA,0DAsB5B;EAAA;uDAAoC;EAAA,8DAyB3B;EAAA,kCAAC;EAAA;;;;;;iBA/CV,4BAAA,CAAA;AAAA,iBAsBA,oBAAA,CAAqB,OAAA;;;;;;;;;;;;;;;iBAyBrB,SAAA,CAAU,QAAA,UAAkB,MAAA;;;;cAO/B,aAAA;;;;;gDAoBH,4BAAA;wCAAA,oBAAA;AAAA"}
|
|
@@ -1,17 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
//#region src/utils/console-styling.ts
|
|
2
|
+
/**
|
|
3
|
+
* Console styling utilities for CopilotKit branded messages
|
|
4
|
+
* Provides consistent, readable colors across light and dark console themes
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Color palette optimized for console readability
|
|
8
|
+
*/
|
|
9
|
+
const ConsoleColors = {
|
|
10
|
+
primary: "#007acc",
|
|
11
|
+
success: "#22c55e",
|
|
12
|
+
feature: "#a855f7",
|
|
13
|
+
cta: "#ef4444",
|
|
14
|
+
info: "#06b6d4",
|
|
15
|
+
inherit: "inherit",
|
|
16
|
+
warning: "#f59e0b"
|
|
16
17
|
};
|
|
18
|
+
/**
|
|
19
|
+
* Console style templates for common patterns
|
|
20
|
+
*/
|
|
21
|
+
const ConsoleStyles = {
|
|
22
|
+
header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,
|
|
23
|
+
section: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
24
|
+
highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,
|
|
25
|
+
cta: `color: ${ConsoleColors.success}; font-weight: bold;`,
|
|
26
|
+
info: `color: ${ConsoleColors.info}; font-weight: bold;`,
|
|
27
|
+
link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,
|
|
28
|
+
body: `color: ${ConsoleColors.inherit};`,
|
|
29
|
+
warning: `color: ${ConsoleColors.cta}; font-weight: bold;`
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* Styled console message for CopilotKit Platform promotion
|
|
33
|
+
* Displays a beautiful, branded advertisement in the console
|
|
34
|
+
*/
|
|
35
|
+
function logCopilotKitPlatformMessage() {
|
|
36
|
+
console.log(`%cCopilotKit Warning%c
|
|
37
|
+
|
|
38
|
+
useCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. To enable this premium feature, add your public license key, available for free at:
|
|
39
|
+
|
|
40
|
+
%chttps://cloud.copilotkit.ai%c
|
|
41
|
+
|
|
42
|
+
Alternatively, useCopilotChat is available for basic programmatic control, and does not require an API key.
|
|
43
|
+
|
|
44
|
+
To learn more about premium features, read the documentation here:
|
|
45
|
+
|
|
46
|
+
%chttps://docs.copilotkit.ai/premium%c`, ConsoleStyles.header, ConsoleStyles.body, ConsoleStyles.cta, ConsoleStyles.body, ConsoleStyles.link, ConsoleStyles.body);
|
|
47
|
+
}
|
|
48
|
+
function publicApiKeyRequired(feature) {
|
|
49
|
+
console.log(`
|
|
50
|
+
%cCopilotKit Warning%c \n
|
|
51
|
+
In order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.
|
|
52
|
+
`.trim(), ConsoleStyles.header, ConsoleStyles.body);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a styled console message with custom content
|
|
56
|
+
*
|
|
57
|
+
* @param template - Template string with %c placeholders
|
|
58
|
+
* @param styles - Array of style strings matching the %c placeholders
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* logStyled(
|
|
63
|
+
* '%cCopilotKit%c Welcome to the platform!',
|
|
64
|
+
* [ConsoleStyles.header, ConsoleStyles.body]
|
|
65
|
+
* );
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
function logStyled(template, styles) {
|
|
69
|
+
console.log(template, ...styles);
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Quick styled console methods for common use cases
|
|
73
|
+
*/
|
|
74
|
+
const styledConsole = {
|
|
75
|
+
success: (message) => logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),
|
|
76
|
+
info: (message) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),
|
|
77
|
+
feature: (message) => logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),
|
|
78
|
+
cta: (message) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),
|
|
79
|
+
logCopilotKitPlatformMessage,
|
|
80
|
+
publicApiKeyRequired
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
//#endregion
|
|
84
|
+
export { ConsoleColors, ConsoleStyles, logCopilotKitPlatformMessage, logStyled, publicApiKeyRequired, styledConsole };
|
|
17
85
|
//# sourceMappingURL=console-styling.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[
|
|
1
|
+
{"version":3,"file":"console-styling.mjs","names":[],"sources":["../../src/utils/console-styling.ts"],"sourcesContent":["/**\n * Console styling utilities for CopilotKit branded messages\n * Provides consistent, readable colors across light and dark console themes\n */\n\n/**\n * Color palette optimized for console readability\n */\nexport const ConsoleColors = {\n /** Primary brand blue - for titles and links */\n primary: \"#007acc\",\n /** Success green - for positive messaging */\n success: \"#22c55e\",\n /** Purple - for feature highlights */\n feature: \"#a855f7\",\n /** Red - for calls-to-action */\n cta: \"#ef4444\",\n /** Cyan - for closing statements */\n info: \"#06b6d4\",\n /** Inherit console default - for body text */\n inherit: \"inherit\",\n /** Warning style */\n warning: \"#f59e0b\",\n} as const;\n\n/**\n * Console style templates for common patterns\n */\nexport const ConsoleStyles = {\n /** Large header style */\n header: `color: ${ConsoleColors.warning}; font-weight: bold; font-size: 16px;`,\n /** Section header style */\n section: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Feature highlight style */\n highlight: `color: ${ConsoleColors.feature}; font-weight: bold;`,\n /** Call-to-action style */\n cta: `color: ${ConsoleColors.success}; font-weight: bold;`,\n /** Info style */\n info: `color: ${ConsoleColors.info}; font-weight: bold;`,\n /** Link style */\n link: `color: ${ConsoleColors.primary}; text-decoration: underline;`,\n /** Body text - inherits console theme */\n body: `color: ${ConsoleColors.inherit};`,\n /** Warning style */\n warning: `color: ${ConsoleColors.cta}; font-weight: bold;`,\n} as const;\n\n/**\n * Styled console message for CopilotKit Platform promotion\n * Displays a beautiful, branded advertisement in the console\n */\nexport function logCopilotKitPlatformMessage() {\n console.log(\n `%cCopilotKit Warning%c\n\nuseCopilotChatHeadless_c provides full compatibility with CopilotKit's newly released Headless UI feature set. To enable this premium feature, add your public license key, available for free at:\n\n%chttps://cloud.copilotkit.ai%c\n\nAlternatively, useCopilotChat is available for basic programmatic control, and does not require an API key.\n\nTo learn more about premium features, read the documentation here:\n\n%chttps://docs.copilotkit.ai/premium%c`,\n ConsoleStyles.header,\n ConsoleStyles.body,\n ConsoleStyles.cta,\n ConsoleStyles.body,\n ConsoleStyles.link,\n ConsoleStyles.body,\n );\n}\n\nexport function publicApiKeyRequired(feature: string) {\n console.log(\n `\n%cCopilotKit Warning%c \\n\nIn order to use ${feature}, you need to add your CopilotKit API key, available for free at https://cloud.copilotkit.ai.\n `.trim(),\n ConsoleStyles.header,\n ConsoleStyles.body,\n );\n}\n\n/**\n * Create a styled console message with custom content\n *\n * @param template - Template string with %c placeholders\n * @param styles - Array of style strings matching the %c placeholders\n *\n * @example\n * ```typescript\n * logStyled(\n * '%cCopilotKit%c Welcome to the platform!',\n * [ConsoleStyles.header, ConsoleStyles.body]\n * );\n * ```\n */\nexport function logStyled(template: string, styles: string[]) {\n console.log(template, ...styles);\n}\n\n/**\n * Quick styled console methods for common use cases\n */\nexport const styledConsole = {\n /** Log a success message */\n success: (message: string) =>\n logStyled(`%c✅ ${message}`, [ConsoleStyles.section]),\n\n /** Log an info message */\n info: (message: string) => logStyled(`%cℹ️ ${message}`, [ConsoleStyles.info]),\n\n /** Log a feature highlight */\n feature: (message: string) =>\n logStyled(`%c✨ ${message}`, [ConsoleStyles.highlight]),\n\n /** Log a call-to-action */\n cta: (message: string) => logStyled(`%c🚀 ${message}`, [ConsoleStyles.cta]),\n\n /** Log the CopilotKit platform promotion */\n logCopilotKitPlatformMessage: logCopilotKitPlatformMessage,\n\n /** Log a `publicApiKeyRequired` warning */\n publicApiKeyRequired: publicApiKeyRequired,\n} as const;\n"],"mappings":";;;;;;;;AAQA,MAAa,gBAAgB;CAE3B,SAAS;CAET,SAAS;CAET,SAAS;CAET,KAAK;CAEL,MAAM;CAEN,SAAS;CAET,SAAS;CACV;;;;AAKD,MAAa,gBAAgB;CAE3B,QAAQ,UAAU,cAAc,QAAQ;CAExC,SAAS,UAAU,cAAc,QAAQ;CAEzC,WAAW,UAAU,cAAc,QAAQ;CAE3C,KAAK,UAAU,cAAc,QAAQ;CAErC,MAAM,UAAU,cAAc,KAAK;CAEnC,MAAM,UAAU,cAAc,QAAQ;CAEtC,MAAM,UAAU,cAAc,QAAQ;CAEtC,SAAS,UAAU,cAAc,IAAI;CACtC;;;;;AAMD,SAAgB,+BAA+B;AAC7C,SAAQ,IACN;;;;;;;;;;yCAWA,cAAc,QACd,cAAc,MACd,cAAc,KACd,cAAc,MACd,cAAc,MACd,cAAc,KACf;;AAGH,SAAgB,qBAAqB,SAAiB;AACpD,SAAQ,IACN;;kBAEc,QAAQ;MACpB,MAAM,EACR,cAAc,QACd,cAAc,KACf;;;;;;;;;;;;;;;;AAiBH,SAAgB,UAAU,UAAkB,QAAkB;AAC5D,SAAQ,IAAI,UAAU,GAAG,OAAO;;;;;AAMlC,MAAa,gBAAgB;CAE3B,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,QAAQ,CAAC;CAGtD,OAAO,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,KAAK,CAAC;CAG7E,UAAU,YACR,UAAU,OAAO,WAAW,CAAC,cAAc,UAAU,CAAC;CAGxD,MAAM,YAAoB,UAAU,QAAQ,WAAW,CAAC,cAAc,IAAI,CAAC;CAG7C;CAGR;CACvB"}
|