@copilotkit/react-core
Version:
<img src="https://github.com/user-attachments/assets/0a6b64d9-e193-4940-a3f6-60334ac34084" alt="banner" style="border-radius: 12px; border: 2px solid #d6d4fa;" />
128 lines (127 loc) • 4.19 kB
JavaScript
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __propIsEnum = Object.prototype.propertyIsEnumerable;
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
var __spreadValues = (a, b) => {
for (var prop in b || (b = {}))
if (__hasOwnProp.call(b, prop))
__defNormalProp(a, prop, b[prop]);
if (__getOwnPropSymbols)
for (var prop of __getOwnPropSymbols(b)) {
if (__propIsEnum.call(b, prop))
__defNormalProp(a, prop, b[prop]);
}
return a;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
// src/test-helpers/copilot-context.ts
var copilot_context_exports = {};
__export(copilot_context_exports, {
createTestCopilotContext: () => createTestCopilotContext
});
module.exports = __toCommonJS(copilot_context_exports);
var noop = () => {
};
var copilotApiConfig = {
chatApiEndpoint: "http://localhost",
headers: {}
};
function createTestCopilotContext(overrides = {}) {
return __spreadValues({
actions: {},
setAction: noop,
removeAction: noop,
setRegisteredActions: () => "action-id",
removeRegisteredAction: noop,
chatComponentsCache: { current: { actions: {}, coAgentStateRenders: {} } },
getFunctionCallHandler: () => () => __async(this, null, function* () {
}),
addContext: () => "context-id",
removeContext: noop,
getAllContext: () => [],
getContextString: () => "",
addDocumentContext: () => "document-id",
removeDocumentContext: noop,
getDocumentsContext: () => [],
isLoading: false,
setIsLoading: noop,
chatSuggestionConfiguration: {},
addChatSuggestionConfiguration: noop,
removeChatSuggestionConfiguration: noop,
chatInstructions: "",
setChatInstructions: noop,
additionalInstructions: [],
setAdditionalInstructions: noop,
copilotApiConfig,
showDevConsole: false,
coagentStates: {},
setCoagentStates: noop,
coagentStatesRef: { current: {} },
setCoagentStatesWithRef: noop,
agentSession: null,
setAgentSession: noop,
agentLock: null,
threadId: "",
setThreadId: noop,
runId: null,
setRunId: noop,
chatAbortControllerRef: { current: null },
forwardedParameters: {},
availableAgents: [],
extensions: {},
setExtensions: noop,
interruptActions: {},
setInterruptAction: noop,
removeInterruptAction: noop,
interruptEventQueue: {},
addInterruptEvent: noop,
resolveInterruptEvent: noop,
onError: noop,
bannerError: null,
setBannerError: noop,
internalErrorHandlers: {},
setInternalErrorHandler: noop,
removeInternalErrorHandler: noop
}, overrides);
}
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
createTestCopilotContext
});
//# sourceMappingURL=copilot-context.js.map