@copilotkit/react-core 0.8.0-alpha.4 → 0.8.0-alpha.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +42 -38
- package/CHANGELOG.md +6 -0
- package/dist/components/copilot-provider.mjs +340 -5
- package/dist/components/copilot-provider.mjs.map +1 -1
- package/dist/components/index.mjs +340 -6
- package/dist/components/index.mjs.map +1 -1
- package/dist/context/copilot-context.mjs +63 -3
- package/dist/context/copilot-context.mjs.map +1 -1
- package/dist/context/index.mjs +63 -4
- package/dist/context/index.mjs.map +1 -1
- package/dist/hooks/index.mjs +199 -7
- package/dist/hooks/index.mjs.map +1 -1
- package/dist/hooks/use-copilot-chat.mjs +155 -4
- package/dist/hooks/use-copilot-chat.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-actionable.mjs +84 -4
- package/dist/hooks/use-make-copilot-actionable.mjs.map +1 -1
- package/dist/hooks/use-make-copilot-readable.mjs +73 -4
- package/dist/hooks/use-make-copilot-readable.mjs.map +1 -1
- package/dist/hooks/use-tree.mjs +159 -3
- package/dist/hooks/use-tree.mjs.map +1 -1
- package/dist/index.mjs +470 -12
- package/dist/index.mjs.map +1 -1
- package/dist/types/annotated-function.mjs +0 -2
- package/dist/types/annotated-function.mjs.map +1 -1
- package/dist/types/index.mjs +0 -2
- package/dist/types/index.mjs.map +1 -1
- package/dist/utils/utils.mjs +0 -2
- package/dist/utils/utils.mjs.map +1 -1
- package/dist/utils/utils.test.mjs +0 -1
- package/dist/utils/utils.test.mjs.map +1 -1
- package/package.json +2 -2
- package/src/hooks/use-copilot-chat.ts +0 -3
- package/dist/chunk-3BOHSSKR.mjs +0 -141
- package/dist/chunk-3BOHSSKR.mjs.map +0 -1
- package/dist/chunk-6VD2ABXH.mjs +0 -82
- package/dist/chunk-6VD2ABXH.mjs.map +0 -1
- package/dist/chunk-BVQRDAR7.mjs +0 -3
- package/dist/chunk-BVQRDAR7.mjs.map +0 -1
- package/dist/chunk-DFQJR3H5.mjs +0 -120
- package/dist/chunk-DFQJR3H5.mjs.map +0 -1
- package/dist/chunk-EFZPSZWO.mjs +0 -3
- package/dist/chunk-EFZPSZWO.mjs.map +0 -1
- package/dist/chunk-JD7BAH7U.mjs +0 -3
- package/dist/chunk-JD7BAH7U.mjs.map +0 -1
- package/dist/chunk-JLQULZT4.mjs +0 -19
- package/dist/chunk-JLQULZT4.mjs.map +0 -1
- package/dist/chunk-MRXNTQOX.mjs +0 -55
- package/dist/chunk-MRXNTQOX.mjs.map +0 -1
- package/dist/chunk-W6NBODX5.mjs +0 -30
- package/dist/chunk-W6NBODX5.mjs.map +0 -1
- package/dist/chunk-YPSGKPDA.mjs +0 -3
- package/dist/chunk-YPSGKPDA.mjs.map +0 -1
- package/dist/chunk-ZKO7HCZS.mjs +0 -40
- package/dist/chunk-ZKO7HCZS.mjs.map +0 -1
package/dist/hooks/use-tree.mjs
CHANGED
|
@@ -1,4 +1,160 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
|
|
21
|
+
// src/hooks/use-tree.ts
|
|
22
|
+
import { nanoid } from "nanoid";
|
|
23
|
+
import { useCallback, useReducer } from "react";
|
|
24
|
+
var removeNode = (nodes, id) => {
|
|
25
|
+
return nodes.reduce((result, node) => {
|
|
26
|
+
if (node.id !== id) {
|
|
27
|
+
const newNode = __spreadProps(__spreadValues({}, node), { children: removeNode(node.children, id) });
|
|
28
|
+
result.push(newNode);
|
|
29
|
+
}
|
|
30
|
+
return result;
|
|
31
|
+
}, []);
|
|
32
|
+
};
|
|
33
|
+
var addNode = (nodes, newNode, parentId) => {
|
|
34
|
+
if (!parentId) {
|
|
35
|
+
return [...nodes, newNode];
|
|
36
|
+
}
|
|
37
|
+
return nodes.map((node) => {
|
|
38
|
+
if (node.id === parentId) {
|
|
39
|
+
return __spreadProps(__spreadValues({}, node), { children: [...node.children, newNode] });
|
|
40
|
+
} else if (node.children.length) {
|
|
41
|
+
return __spreadProps(__spreadValues({}, node), { children: addNode(node.children, newNode, parentId) });
|
|
42
|
+
}
|
|
43
|
+
return node;
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
var treeIndentationRepresentation = (index, indentLevel) => {
|
|
47
|
+
if (indentLevel === 0) {
|
|
48
|
+
return (index + 1).toString();
|
|
49
|
+
} else if (indentLevel === 1) {
|
|
50
|
+
return String.fromCharCode(65 + index);
|
|
51
|
+
} else if (indentLevel === 2) {
|
|
52
|
+
return String.fromCharCode(97 + index);
|
|
53
|
+
} else {
|
|
54
|
+
return "-";
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
var printNode = (node, prefix = "", indentLevel = 0) => {
|
|
58
|
+
const indent = " ".repeat(3).repeat(indentLevel);
|
|
59
|
+
const prefixPlusIndentLength = prefix.length + indent.length;
|
|
60
|
+
const subsequentLinesPrefix = " ".repeat(prefixPlusIndentLength);
|
|
61
|
+
const valueLines = node.value.split("\n");
|
|
62
|
+
const outputFirstLine = `${indent}${prefix}${valueLines[0]}`;
|
|
63
|
+
const outputSubsequentLines = valueLines.slice(1).map((line) => `${subsequentLinesPrefix}${line}`).join("\n");
|
|
64
|
+
let output = `${outputFirstLine}
|
|
65
|
+
`;
|
|
66
|
+
if (outputSubsequentLines) {
|
|
67
|
+
output += `${outputSubsequentLines}
|
|
68
|
+
`;
|
|
69
|
+
}
|
|
70
|
+
const childPrePrefix = " ".repeat(prefix.length);
|
|
71
|
+
node.children.forEach(
|
|
72
|
+
(child, index) => output += printNode(
|
|
73
|
+
child,
|
|
74
|
+
`${childPrePrefix}${treeIndentationRepresentation(
|
|
75
|
+
index,
|
|
76
|
+
indentLevel + 1
|
|
77
|
+
)}. `,
|
|
78
|
+
indentLevel + 1
|
|
79
|
+
)
|
|
80
|
+
);
|
|
81
|
+
return output;
|
|
82
|
+
};
|
|
83
|
+
function treeReducer(state, action) {
|
|
84
|
+
switch (action.type) {
|
|
85
|
+
case "ADD_NODE": {
|
|
86
|
+
const { value, parentId, id: newNodeId } = action;
|
|
87
|
+
const newNode = {
|
|
88
|
+
id: newNodeId,
|
|
89
|
+
value,
|
|
90
|
+
children: [],
|
|
91
|
+
categories: new Set(action.categories)
|
|
92
|
+
};
|
|
93
|
+
try {
|
|
94
|
+
return addNode(state, newNode, parentId);
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error(`Error while adding node with id ${newNodeId}: ${error}`);
|
|
97
|
+
return state;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
case "REMOVE_NODE":
|
|
101
|
+
return removeNode(state, action.id);
|
|
102
|
+
default:
|
|
103
|
+
return state;
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
var useTree = () => {
|
|
107
|
+
const [tree, dispatch] = useReducer(treeReducer, []);
|
|
108
|
+
const addElement = useCallback(
|
|
109
|
+
(value, categories, parentId) => {
|
|
110
|
+
const newNodeId = nanoid();
|
|
111
|
+
dispatch({
|
|
112
|
+
type: "ADD_NODE",
|
|
113
|
+
value,
|
|
114
|
+
parentId,
|
|
115
|
+
id: newNodeId,
|
|
116
|
+
categories
|
|
117
|
+
});
|
|
118
|
+
return newNodeId;
|
|
119
|
+
},
|
|
120
|
+
[]
|
|
121
|
+
);
|
|
122
|
+
const removeElement = useCallback((id) => {
|
|
123
|
+
dispatch({ type: "REMOVE_NODE", id });
|
|
124
|
+
}, []);
|
|
125
|
+
const printTree = useCallback(
|
|
126
|
+
(categories) => {
|
|
127
|
+
const categoriesSet = new Set(categories);
|
|
128
|
+
let output = "";
|
|
129
|
+
tree.forEach((node, index) => {
|
|
130
|
+
if (!setsHaveIntersection(categoriesSet, node.categories)) {
|
|
131
|
+
return;
|
|
132
|
+
}
|
|
133
|
+
if (index !== 0) {
|
|
134
|
+
output += "\n";
|
|
135
|
+
}
|
|
136
|
+
output += printNode(
|
|
137
|
+
node,
|
|
138
|
+
`${treeIndentationRepresentation(index, 0)}. `
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
return output;
|
|
142
|
+
},
|
|
143
|
+
[tree]
|
|
144
|
+
);
|
|
145
|
+
return { tree, addElement, printTree, removeElement };
|
|
146
|
+
};
|
|
147
|
+
var use_tree_default = useTree;
|
|
148
|
+
function setsHaveIntersection(setA, setB) {
|
|
149
|
+
const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];
|
|
150
|
+
for (let item of smallerSet) {
|
|
151
|
+
if (largerSet.has(item)) {
|
|
152
|
+
return true;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
return false;
|
|
156
|
+
}
|
|
157
|
+
export {
|
|
158
|
+
use_tree_default as default
|
|
159
|
+
};
|
|
4
160
|
//# sourceMappingURL=use-tree.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/use-tree.ts"],"sourcesContent":["import { nanoid } from \"nanoid\";\nimport { useCallback, useReducer } from \"react\";\n\nexport type TreeNodeId = string;\n\nexport interface TreeNode {\n id: TreeNodeId;\n value: string;\n children: TreeNode[];\n parentId?: TreeNodeId;\n categories: Set<string>;\n}\n\nexport type Tree = TreeNode[];\n\nexport interface UseTreeReturn {\n tree: Tree;\n addElement: (\n value: string,\n categories: string[],\n parentId?: TreeNodeId\n ) => TreeNodeId;\n printTree: (categories: string[]) => string;\n removeElement: (id: TreeNodeId) => void;\n}\n\nconst findNode = (nodes: Tree, id: TreeNodeId): TreeNode | undefined => {\n for (const node of nodes) {\n if (node.id === id) {\n return node;\n }\n const result = findNode(node.children, id);\n if (result) {\n return result;\n }\n }\n return undefined;\n};\n\nconst removeNode = (nodes: Tree, id: TreeNodeId): Tree => {\n return nodes.reduce((result: Tree, node) => {\n if (node.id !== id) {\n const newNode = { ...node, children: removeNode(node.children, id) };\n result.push(newNode);\n }\n return result;\n }, []);\n};\n\nconst addNode = (\n nodes: Tree,\n newNode: TreeNode,\n parentId?: TreeNodeId\n): Tree => {\n if (!parentId) {\n return [...nodes, newNode];\n }\n return nodes.map((node) => {\n if (node.id === parentId) {\n return { ...node, children: [...node.children, newNode] };\n } else if (node.children.length) {\n return { ...node, children: addNode(node.children, newNode, parentId) };\n }\n return node;\n });\n};\n\nconst treeIndentationRepresentation = (\n index: number,\n indentLevel: number\n): string => {\n if (indentLevel === 0) {\n return (index + 1).toString();\n } else if (indentLevel === 1) {\n return String.fromCharCode(65 + index); // 65 is the ASCII value for 'A'\n } else if (indentLevel === 2) {\n return String.fromCharCode(97 + index); // 97 is the ASCII value for 'a'\n } else {\n return \"-\";\n }\n};\n\nconst printNode = (node: TreeNode, prefix = \"\", indentLevel = 0): string => {\n const indent = \" \".repeat(3).repeat(indentLevel);\n\n const prefixPlusIndentLength = prefix.length + indent.length;\n const subsequentLinesPrefix = \" \".repeat(prefixPlusIndentLength);\n\n const valueLines = node.value.split(\"\\n\");\n\n const outputFirstLine = `${indent}${prefix}${valueLines[0]}`;\n const outputSubsequentLines = valueLines\n .slice(1)\n .map((line) => `${subsequentLinesPrefix}${line}`)\n .join(\"\\n\");\n\n let output = `${outputFirstLine}\\n`;\n if (outputSubsequentLines) {\n output += `${outputSubsequentLines}\\n`;\n }\n\n const childPrePrefix = \" \".repeat(prefix.length);\n\n node.children.forEach(\n (child, index) =>\n (output += printNode(\n child,\n `${childPrePrefix}${treeIndentationRepresentation(\n index,\n indentLevel + 1\n )}. `,\n indentLevel + 1\n ))\n );\n return output;\n};\n\n// Action types\ntype Action =\n | {\n type: \"ADD_NODE\";\n value: string;\n parentId?: string;\n id: string;\n categories: string[];\n }\n | { type: \"REMOVE_NODE\"; id: string };\n\n// Reducer function\nfunction treeReducer(state: Tree, action: Action): Tree {\n switch (action.type) {\n case \"ADD_NODE\": {\n const { value, parentId, id: newNodeId } = action;\n const newNode: TreeNode = {\n id: newNodeId,\n value,\n children: [],\n categories: new Set(action.categories),\n };\n\n try {\n return addNode(state, newNode, parentId);\n } catch (error) {\n console.error(`Error while adding node with id ${newNodeId}: ${error}`);\n return state;\n }\n }\n case \"REMOVE_NODE\":\n return removeNode(state, action.id);\n default:\n return state;\n }\n}\n\n// useTree hook\nconst useTree = (): UseTreeReturn => {\n const [tree, dispatch] = useReducer(treeReducer, []);\n\n const addElement = useCallback(\n (value: string, categories: string[], parentId?: string): TreeNodeId => {\n const newNodeId = nanoid(); // Generate new ID outside of dispatch\n dispatch({\n type: \"ADD_NODE\",\n value,\n parentId,\n id: newNodeId,\n categories: categories,\n });\n return newNodeId; // Return the new ID\n },\n []\n );\n\n const removeElement = useCallback((id: TreeNodeId): void => {\n dispatch({ type: \"REMOVE_NODE\", id });\n }, []);\n\n const printTree = useCallback(\n (categories: string[]): string => {\n const categoriesSet = new Set(categories);\n\n let output = \"\";\n tree.forEach((node, index) => {\n // if the node does not have any of the desired categories, continue to the next node\n if (!setsHaveIntersection(categoriesSet, node.categories)) {\n return;\n }\n\n // add a new line before each node except the first one\n if (index !== 0) {\n output += \"\\n\";\n }\n\n output += printNode(\n node,\n `${treeIndentationRepresentation(index, 0)}. `\n );\n });\n return output;\n },\n [tree]\n );\n\n return { tree, addElement, printTree, removeElement };\n};\n\nexport default useTree;\n\nfunction setsHaveIntersection<T>(setA: Set<T>, setB: Set<T>): boolean {\n const [smallerSet, largerSet] =\n setA.size <= setB.size ? [setA, setB] : [setB, setA];\n\n for (let item of smallerSet) {\n if (largerSet.has(item)) {\n return true;\n }\n }\n\n return false;\n}\n"],"mappings":"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","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -1,13 +1,471 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __objRest = (source, exclude) => {
|
|
21
|
+
var target = {};
|
|
22
|
+
for (var prop in source)
|
|
23
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
24
|
+
target[prop] = source[prop];
|
|
25
|
+
if (source != null && __getOwnPropSymbols)
|
|
26
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
27
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
28
|
+
target[prop] = source[prop];
|
|
29
|
+
}
|
|
30
|
+
return target;
|
|
31
|
+
};
|
|
32
|
+
var __async = (__this, __arguments, generator) => {
|
|
33
|
+
return new Promise((resolve, reject) => {
|
|
34
|
+
var fulfilled = (value) => {
|
|
35
|
+
try {
|
|
36
|
+
step(generator.next(value));
|
|
37
|
+
} catch (e) {
|
|
38
|
+
reject(e);
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
var rejected = (value) => {
|
|
42
|
+
try {
|
|
43
|
+
step(generator.throw(value));
|
|
44
|
+
} catch (e) {
|
|
45
|
+
reject(e);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
49
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
50
|
+
});
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
// src/components/copilot-provider.tsx
|
|
54
|
+
import { useCallback as useCallback2, useState } from "react";
|
|
55
|
+
|
|
56
|
+
// src/context/copilot-context.tsx
|
|
57
|
+
import React from "react";
|
|
58
|
+
"use client";
|
|
59
|
+
function copilotApiConfigExtrapolator(config) {
|
|
60
|
+
return {
|
|
61
|
+
get chatApiEndpoint() {
|
|
62
|
+
return `${config.chatApiEndpoint}`;
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var emptyCopilotContext = {
|
|
67
|
+
entryPoints: {},
|
|
68
|
+
setEntryPoint: () => {
|
|
69
|
+
},
|
|
70
|
+
removeEntryPoint: () => {
|
|
71
|
+
},
|
|
72
|
+
getChatCompletionFunctionDescriptions: () => returnAndThrowInDebug([]),
|
|
73
|
+
getFunctionCallHandler: () => returnAndThrowInDebug(() => __async(void 0, null, function* () {
|
|
74
|
+
})),
|
|
75
|
+
getContextString: () => returnAndThrowInDebug(""),
|
|
76
|
+
addContext: () => "",
|
|
77
|
+
removeContext: () => {
|
|
78
|
+
},
|
|
79
|
+
copilotApiConfig: new class {
|
|
80
|
+
get chatApiEndpoint() {
|
|
81
|
+
throw new Error(
|
|
82
|
+
"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!"
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
}()
|
|
86
|
+
};
|
|
87
|
+
var CopilotContext = React.createContext(emptyCopilotContext);
|
|
88
|
+
function returnAndThrowInDebug(value) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
"Remember to wrap your app in a `<CopilotProvider> {...} </CopilotProvider>` !!!"
|
|
91
|
+
);
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// src/hooks/use-tree.ts
|
|
96
|
+
import { nanoid } from "nanoid";
|
|
97
|
+
import { useCallback, useReducer } from "react";
|
|
98
|
+
var removeNode = (nodes, id) => {
|
|
99
|
+
return nodes.reduce((result, node) => {
|
|
100
|
+
if (node.id !== id) {
|
|
101
|
+
const newNode = __spreadProps(__spreadValues({}, node), { children: removeNode(node.children, id) });
|
|
102
|
+
result.push(newNode);
|
|
103
|
+
}
|
|
104
|
+
return result;
|
|
105
|
+
}, []);
|
|
106
|
+
};
|
|
107
|
+
var addNode = (nodes, newNode, parentId) => {
|
|
108
|
+
if (!parentId) {
|
|
109
|
+
return [...nodes, newNode];
|
|
110
|
+
}
|
|
111
|
+
return nodes.map((node) => {
|
|
112
|
+
if (node.id === parentId) {
|
|
113
|
+
return __spreadProps(__spreadValues({}, node), { children: [...node.children, newNode] });
|
|
114
|
+
} else if (node.children.length) {
|
|
115
|
+
return __spreadProps(__spreadValues({}, node), { children: addNode(node.children, newNode, parentId) });
|
|
116
|
+
}
|
|
117
|
+
return node;
|
|
118
|
+
});
|
|
119
|
+
};
|
|
120
|
+
var treeIndentationRepresentation = (index, indentLevel) => {
|
|
121
|
+
if (indentLevel === 0) {
|
|
122
|
+
return (index + 1).toString();
|
|
123
|
+
} else if (indentLevel === 1) {
|
|
124
|
+
return String.fromCharCode(65 + index);
|
|
125
|
+
} else if (indentLevel === 2) {
|
|
126
|
+
return String.fromCharCode(97 + index);
|
|
127
|
+
} else {
|
|
128
|
+
return "-";
|
|
129
|
+
}
|
|
130
|
+
};
|
|
131
|
+
var printNode = (node, prefix = "", indentLevel = 0) => {
|
|
132
|
+
const indent = " ".repeat(3).repeat(indentLevel);
|
|
133
|
+
const prefixPlusIndentLength = prefix.length + indent.length;
|
|
134
|
+
const subsequentLinesPrefix = " ".repeat(prefixPlusIndentLength);
|
|
135
|
+
const valueLines = node.value.split("\n");
|
|
136
|
+
const outputFirstLine = `${indent}${prefix}${valueLines[0]}`;
|
|
137
|
+
const outputSubsequentLines = valueLines.slice(1).map((line) => `${subsequentLinesPrefix}${line}`).join("\n");
|
|
138
|
+
let output = `${outputFirstLine}
|
|
139
|
+
`;
|
|
140
|
+
if (outputSubsequentLines) {
|
|
141
|
+
output += `${outputSubsequentLines}
|
|
142
|
+
`;
|
|
143
|
+
}
|
|
144
|
+
const childPrePrefix = " ".repeat(prefix.length);
|
|
145
|
+
node.children.forEach(
|
|
146
|
+
(child, index) => output += printNode(
|
|
147
|
+
child,
|
|
148
|
+
`${childPrePrefix}${treeIndentationRepresentation(
|
|
149
|
+
index,
|
|
150
|
+
indentLevel + 1
|
|
151
|
+
)}. `,
|
|
152
|
+
indentLevel + 1
|
|
153
|
+
)
|
|
154
|
+
);
|
|
155
|
+
return output;
|
|
156
|
+
};
|
|
157
|
+
function treeReducer(state, action) {
|
|
158
|
+
switch (action.type) {
|
|
159
|
+
case "ADD_NODE": {
|
|
160
|
+
const { value, parentId, id: newNodeId } = action;
|
|
161
|
+
const newNode = {
|
|
162
|
+
id: newNodeId,
|
|
163
|
+
value,
|
|
164
|
+
children: [],
|
|
165
|
+
categories: new Set(action.categories)
|
|
166
|
+
};
|
|
167
|
+
try {
|
|
168
|
+
return addNode(state, newNode, parentId);
|
|
169
|
+
} catch (error) {
|
|
170
|
+
console.error(`Error while adding node with id ${newNodeId}: ${error}`);
|
|
171
|
+
return state;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
case "REMOVE_NODE":
|
|
175
|
+
return removeNode(state, action.id);
|
|
176
|
+
default:
|
|
177
|
+
return state;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
var useTree = () => {
|
|
181
|
+
const [tree, dispatch] = useReducer(treeReducer, []);
|
|
182
|
+
const addElement = useCallback(
|
|
183
|
+
(value, categories, parentId) => {
|
|
184
|
+
const newNodeId = nanoid();
|
|
185
|
+
dispatch({
|
|
186
|
+
type: "ADD_NODE",
|
|
187
|
+
value,
|
|
188
|
+
parentId,
|
|
189
|
+
id: newNodeId,
|
|
190
|
+
categories
|
|
191
|
+
});
|
|
192
|
+
return newNodeId;
|
|
193
|
+
},
|
|
194
|
+
[]
|
|
195
|
+
);
|
|
196
|
+
const removeElement = useCallback((id) => {
|
|
197
|
+
dispatch({ type: "REMOVE_NODE", id });
|
|
198
|
+
}, []);
|
|
199
|
+
const printTree = useCallback(
|
|
200
|
+
(categories) => {
|
|
201
|
+
const categoriesSet = new Set(categories);
|
|
202
|
+
let output = "";
|
|
203
|
+
tree.forEach((node, index) => {
|
|
204
|
+
if (!setsHaveIntersection(categoriesSet, node.categories)) {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
if (index !== 0) {
|
|
208
|
+
output += "\n";
|
|
209
|
+
}
|
|
210
|
+
output += printNode(
|
|
211
|
+
node,
|
|
212
|
+
`${treeIndentationRepresentation(index, 0)}. `
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
return output;
|
|
216
|
+
},
|
|
217
|
+
[tree]
|
|
218
|
+
);
|
|
219
|
+
return { tree, addElement, printTree, removeElement };
|
|
220
|
+
};
|
|
221
|
+
var use_tree_default = useTree;
|
|
222
|
+
function setsHaveIntersection(setA, setB) {
|
|
223
|
+
const [smallerSet, largerSet] = setA.size <= setB.size ? [setA, setB] : [setB, setA];
|
|
224
|
+
for (let item of smallerSet) {
|
|
225
|
+
if (largerSet.has(item)) {
|
|
226
|
+
return true;
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
return false;
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
// src/components/copilot-provider.tsx
|
|
233
|
+
import { jsx } from "react/jsx-runtime";
|
|
234
|
+
"use client";
|
|
235
|
+
function CopilotProvider({
|
|
236
|
+
copilotApiConfig,
|
|
237
|
+
children
|
|
238
|
+
}) {
|
|
239
|
+
const [entryPoints, setEntryPoints] = useState({});
|
|
240
|
+
const { addElement, removeElement, printTree } = use_tree_default();
|
|
241
|
+
const setEntryPoint = useCallback2(
|
|
242
|
+
(id, entryPoint) => {
|
|
243
|
+
setEntryPoints((prevPoints) => {
|
|
244
|
+
return __spreadProps(__spreadValues({}, prevPoints), {
|
|
245
|
+
[id]: entryPoint
|
|
246
|
+
});
|
|
247
|
+
});
|
|
248
|
+
},
|
|
249
|
+
[]
|
|
250
|
+
);
|
|
251
|
+
const removeEntryPoint = useCallback2((id) => {
|
|
252
|
+
setEntryPoints((prevPoints) => {
|
|
253
|
+
const newPoints = __spreadValues({}, prevPoints);
|
|
254
|
+
delete newPoints[id];
|
|
255
|
+
return newPoints;
|
|
256
|
+
});
|
|
257
|
+
}, []);
|
|
258
|
+
const getContextString = useCallback2(
|
|
259
|
+
(categories = ["global"]) => {
|
|
260
|
+
return printTree(categories);
|
|
261
|
+
},
|
|
262
|
+
[printTree]
|
|
263
|
+
);
|
|
264
|
+
const addContext = useCallback2(
|
|
265
|
+
(context, parentId, categories = ["global"]) => {
|
|
266
|
+
return addElement(context, categories, parentId);
|
|
267
|
+
},
|
|
268
|
+
[addElement]
|
|
269
|
+
);
|
|
270
|
+
const removeContext = useCallback2(
|
|
271
|
+
(id) => {
|
|
272
|
+
removeElement(id);
|
|
273
|
+
},
|
|
274
|
+
[removeElement]
|
|
275
|
+
);
|
|
276
|
+
const getChatCompletionFunctionDescriptions = useCallback2(() => {
|
|
277
|
+
return entryPointsToChatCompletionFunctions(Object.values(entryPoints));
|
|
278
|
+
}, [entryPoints]);
|
|
279
|
+
const getFunctionCallHandler = useCallback2(() => {
|
|
280
|
+
return entryPointsToFunctionCallHandler(Object.values(entryPoints));
|
|
281
|
+
}, [entryPoints]);
|
|
282
|
+
return /* @__PURE__ */ jsx(CopilotContext.Provider, {
|
|
283
|
+
value: {
|
|
284
|
+
entryPoints,
|
|
285
|
+
getChatCompletionFunctionDescriptions,
|
|
286
|
+
getFunctionCallHandler,
|
|
287
|
+
setEntryPoint,
|
|
288
|
+
removeEntryPoint,
|
|
289
|
+
getContextString,
|
|
290
|
+
addContext,
|
|
291
|
+
removeContext,
|
|
292
|
+
copilotApiConfig
|
|
293
|
+
},
|
|
294
|
+
children
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
function entryPointsToFunctionCallHandler(entryPoints) {
|
|
298
|
+
return (chatMessages, functionCall) => __async(this, null, function* () {
|
|
299
|
+
let entrypointsByFunctionName = {};
|
|
300
|
+
for (let entryPoint of entryPoints) {
|
|
301
|
+
entrypointsByFunctionName[entryPoint.name] = entryPoint;
|
|
302
|
+
}
|
|
303
|
+
const entryPointFunction = entrypointsByFunctionName[functionCall.name || ""];
|
|
304
|
+
if (entryPointFunction) {
|
|
305
|
+
let parsedFunctionCallArguments = [];
|
|
306
|
+
if (functionCall.arguments) {
|
|
307
|
+
parsedFunctionCallArguments = JSON.parse(functionCall.arguments);
|
|
308
|
+
}
|
|
309
|
+
const paramsInCorrectOrder = [];
|
|
310
|
+
for (let arg of entryPointFunction.argumentAnnotations) {
|
|
311
|
+
paramsInCorrectOrder.push(
|
|
312
|
+
parsedFunctionCallArguments[arg.name]
|
|
313
|
+
);
|
|
314
|
+
}
|
|
315
|
+
yield entryPointFunction.implementation(...paramsInCorrectOrder);
|
|
316
|
+
}
|
|
317
|
+
});
|
|
318
|
+
}
|
|
319
|
+
function entryPointsToChatCompletionFunctions(entryPoints) {
|
|
320
|
+
return entryPoints.map(annotatedFunctionToChatCompletionFunction);
|
|
321
|
+
}
|
|
322
|
+
function annotatedFunctionToChatCompletionFunction(annotatedFunction) {
|
|
323
|
+
let parameters = {};
|
|
324
|
+
for (let arg of annotatedFunction.argumentAnnotations) {
|
|
325
|
+
let _a = arg, { name, required } = _a, forwardedArgs = __objRest(_a, ["name", "required"]);
|
|
326
|
+
parameters[arg.name] = forwardedArgs;
|
|
327
|
+
}
|
|
328
|
+
let requiredParameterNames = [];
|
|
329
|
+
for (let arg of annotatedFunction.argumentAnnotations) {
|
|
330
|
+
if (arg.required) {
|
|
331
|
+
requiredParameterNames.push(arg.name);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
let chatCompletionFunction = {
|
|
335
|
+
name: annotatedFunction.name,
|
|
336
|
+
description: annotatedFunction.description,
|
|
337
|
+
parameters: {
|
|
338
|
+
type: "object",
|
|
339
|
+
properties: parameters,
|
|
340
|
+
required: requiredParameterNames
|
|
341
|
+
}
|
|
342
|
+
};
|
|
343
|
+
return chatCompletionFunction;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// src/hooks/use-copilot-chat.ts
|
|
347
|
+
import { useMemo, useContext } from "react";
|
|
348
|
+
import { useChat } from "ai/react";
|
|
349
|
+
function useCopilotChat(_a) {
|
|
350
|
+
var _b = _a, {
|
|
351
|
+
makeSystemMessage
|
|
352
|
+
} = _b, options = __objRest(_b, [
|
|
353
|
+
"makeSystemMessage"
|
|
354
|
+
]);
|
|
355
|
+
const {
|
|
356
|
+
getContextString,
|
|
357
|
+
getChatCompletionFunctionDescriptions,
|
|
358
|
+
getFunctionCallHandler,
|
|
359
|
+
copilotApiConfig
|
|
360
|
+
} = useContext(CopilotContext);
|
|
361
|
+
const systemMessage = useMemo(() => {
|
|
362
|
+
const systemMessageMaker = makeSystemMessage || defaultSystemMessage;
|
|
363
|
+
const contextString = getContextString();
|
|
364
|
+
return {
|
|
365
|
+
id: "system",
|
|
366
|
+
content: systemMessageMaker(contextString),
|
|
367
|
+
role: "system"
|
|
368
|
+
};
|
|
369
|
+
}, [getContextString, makeSystemMessage]);
|
|
370
|
+
const initialMessagesWithContext = [systemMessage].concat(
|
|
371
|
+
options.initialMessages || []
|
|
372
|
+
);
|
|
373
|
+
const functionDescriptions = useMemo(() => {
|
|
374
|
+
return getChatCompletionFunctionDescriptions();
|
|
375
|
+
}, [getChatCompletionFunctionDescriptions]);
|
|
376
|
+
const { messages, append, reload, stop, isLoading, input, setInput } = useChat({
|
|
377
|
+
api: copilotApiConfigExtrapolator(copilotApiConfig).chatApiEndpoint,
|
|
378
|
+
id: options.id,
|
|
379
|
+
initialMessages: initialMessagesWithContext,
|
|
380
|
+
experimental_onFunctionCall: getFunctionCallHandler(),
|
|
381
|
+
body: {
|
|
382
|
+
id: options.id,
|
|
383
|
+
functions: functionDescriptions
|
|
384
|
+
}
|
|
385
|
+
});
|
|
386
|
+
const visibleMessages = messages.filter(
|
|
387
|
+
(message) => message.role === "user" || message.role === "assistant"
|
|
388
|
+
);
|
|
389
|
+
return {
|
|
390
|
+
visibleMessages,
|
|
391
|
+
append,
|
|
392
|
+
reload,
|
|
393
|
+
stop,
|
|
394
|
+
isLoading,
|
|
395
|
+
input,
|
|
396
|
+
setInput
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function defaultSystemMessage(contextString) {
|
|
400
|
+
return `
|
|
401
|
+
Please act as an efficient, competent, conscientious, and industrious professional assistant.
|
|
402
|
+
|
|
403
|
+
Help the user achieve their goals, and you do so in a way that is as efficient as possible, without unnecessary fluff, but also without sacrificing professionalism.
|
|
404
|
+
Always be polite and respectful, and prefer brevity over verbosity.
|
|
405
|
+
|
|
406
|
+
The user has provided you with the following context:
|
|
407
|
+
\`\`\`
|
|
408
|
+
${contextString}
|
|
409
|
+
\`\`\`
|
|
410
|
+
|
|
411
|
+
They have also provided you with functions you can call to initiate actions on their behalf, or functions you can call to receive more information.
|
|
412
|
+
|
|
413
|
+
Please assist them as best you can.
|
|
414
|
+
|
|
415
|
+
You can ask them for clarifying questions if needed, but don't be annoying about it. If you can reasonably 'fill in the blanks' yourself, do so.
|
|
416
|
+
|
|
417
|
+
If you would like to call a function, call it without saying anything else.
|
|
418
|
+
`;
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
// src/hooks/use-make-copilot-actionable.ts
|
|
422
|
+
import { useRef, useContext as useContext2, useEffect, useMemo as useMemo2 } from "react";
|
|
423
|
+
import { nanoid as nanoid2 } from "nanoid";
|
|
424
|
+
"use client";
|
|
425
|
+
function useMakeCopilotActionable(annotatedFunction, dependencies) {
|
|
426
|
+
const idRef = useRef(nanoid2());
|
|
427
|
+
const { setEntryPoint, removeEntryPoint } = useContext2(CopilotContext);
|
|
428
|
+
const memoizedAnnotatedFunction = useMemo2(
|
|
429
|
+
() => ({
|
|
430
|
+
name: annotatedFunction.name,
|
|
431
|
+
description: annotatedFunction.description,
|
|
432
|
+
argumentAnnotations: annotatedFunction.argumentAnnotations,
|
|
433
|
+
implementation: annotatedFunction.implementation
|
|
434
|
+
}),
|
|
435
|
+
dependencies
|
|
436
|
+
);
|
|
437
|
+
useEffect(() => {
|
|
438
|
+
setEntryPoint(
|
|
439
|
+
idRef.current,
|
|
440
|
+
memoizedAnnotatedFunction
|
|
441
|
+
);
|
|
442
|
+
return () => {
|
|
443
|
+
removeEntryPoint(idRef.current);
|
|
444
|
+
};
|
|
445
|
+
}, [memoizedAnnotatedFunction, setEntryPoint, removeEntryPoint]);
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
// src/hooks/use-make-copilot-readable.ts
|
|
449
|
+
import { useContext as useContext3, useEffect as useEffect2, useRef as useRef2 } from "react";
|
|
450
|
+
"use client";
|
|
451
|
+
function useMakeCopilotReadable(information, parentId, categories) {
|
|
452
|
+
const { addContext, removeContext } = useContext3(CopilotContext);
|
|
453
|
+
const idRef = useRef2();
|
|
454
|
+
useEffect2(() => {
|
|
455
|
+
const id = addContext(information, parentId, categories);
|
|
456
|
+
idRef.current = id;
|
|
457
|
+
return () => {
|
|
458
|
+
removeContext(id);
|
|
459
|
+
};
|
|
460
|
+
}, [information, parentId, addContext, removeContext]);
|
|
461
|
+
return idRef.current;
|
|
462
|
+
}
|
|
463
|
+
export {
|
|
464
|
+
CopilotContext,
|
|
465
|
+
CopilotProvider,
|
|
466
|
+
copilotApiConfigExtrapolator,
|
|
467
|
+
useCopilotChat,
|
|
468
|
+
useMakeCopilotActionable,
|
|
469
|
+
useMakeCopilotReadable
|
|
470
|
+
};
|
|
13
471
|
//# sourceMappingURL=index.mjs.map
|