@yourgpt/copilot-sdk 0.1.1 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/dist/{thread-CLmfwine.d.ts → ThreadManager-BCVt-_k_.d.cts} +376 -223
- package/dist/{thread-CLmfwine.d.cts → ThreadManager-BjC15mh8.d.ts} +376 -223
- package/dist/{chunk-IH7WXWX4.cjs → chunk-42YQ4ATO.cjs} +889 -2
- package/dist/chunk-42YQ4ATO.cjs.map +1 -0
- package/dist/{chunk-R452HH3J.cjs → chunk-BN75ZW24.cjs} +455 -26
- package/dist/chunk-BN75ZW24.cjs.map +1 -0
- package/dist/{chunk-QWQELTEB.js → chunk-QSEGNATZ.js} +882 -3
- package/dist/chunk-QSEGNATZ.js.map +1 -0
- package/dist/{chunk-FO75W5UI.js → chunk-XAVZZVUL.js} +428 -4
- package/dist/chunk-XAVZZVUL.js.map +1 -0
- package/dist/core/index.cjs +99 -71
- package/dist/core/index.d.cts +4 -4
- package/dist/core/index.d.ts +4 -4
- package/dist/core/index.js +1 -1
- package/dist/react/index.cjs +66 -34
- package/dist/react/index.d.cts +371 -5
- package/dist/react/index.d.ts +371 -5
- package/dist/react/index.js +2 -2
- package/dist/{tools-eeJ5iEC4.d.ts → types-BtAaOV07.d.cts} +367 -1
- package/dist/{tools-eeJ5iEC4.d.cts → types-BtAaOV07.d.ts} +367 -1
- package/dist/ui/index.cjs +1703 -467
- package/dist/ui/index.cjs.map +1 -1
- package/dist/ui/index.d.cts +333 -38
- package/dist/ui/index.d.ts +333 -38
- package/dist/ui/index.js +1699 -467
- package/dist/ui/index.js.map +1 -1
- package/package.json +9 -9
- package/dist/chunk-FO75W5UI.js.map +0 -1
- package/dist/chunk-IH7WXWX4.cjs.map +0 -1
- package/dist/chunk-QWQELTEB.js.map +0 -1
- package/dist/chunk-R452HH3J.cjs.map +0 -1
|
@@ -1839,6 +1839,885 @@ function fileToBase64(file) {
|
|
|
1839
1839
|
});
|
|
1840
1840
|
}
|
|
1841
1841
|
|
|
1842
|
-
|
|
1843
|
-
|
|
1844
|
-
|
|
1842
|
+
// src/thread/interfaces/ThreadManagerState.ts
|
|
1843
|
+
var SimpleThreadManagerState = class {
|
|
1844
|
+
constructor() {
|
|
1845
|
+
this._threads = [];
|
|
1846
|
+
this._currentThreadId = null;
|
|
1847
|
+
this._currentThread = null;
|
|
1848
|
+
this._loadStatus = "idle";
|
|
1849
|
+
this._error = void 0;
|
|
1850
|
+
this.callbacks = /* @__PURE__ */ new Set();
|
|
1851
|
+
}
|
|
1852
|
+
// Getters
|
|
1853
|
+
get threads() {
|
|
1854
|
+
return this._threads;
|
|
1855
|
+
}
|
|
1856
|
+
get currentThreadId() {
|
|
1857
|
+
return this._currentThreadId;
|
|
1858
|
+
}
|
|
1859
|
+
get currentThread() {
|
|
1860
|
+
return this._currentThread;
|
|
1861
|
+
}
|
|
1862
|
+
get loadStatus() {
|
|
1863
|
+
return this._loadStatus;
|
|
1864
|
+
}
|
|
1865
|
+
get error() {
|
|
1866
|
+
return this._error;
|
|
1867
|
+
}
|
|
1868
|
+
// Setters with notification
|
|
1869
|
+
set threads(value) {
|
|
1870
|
+
this._threads = value;
|
|
1871
|
+
this.notify();
|
|
1872
|
+
}
|
|
1873
|
+
setThreads(threads) {
|
|
1874
|
+
this._threads = threads;
|
|
1875
|
+
this.notify();
|
|
1876
|
+
}
|
|
1877
|
+
setCurrentThread(thread) {
|
|
1878
|
+
this._currentThread = thread;
|
|
1879
|
+
this._currentThreadId = thread?.id ?? null;
|
|
1880
|
+
this.notify();
|
|
1881
|
+
}
|
|
1882
|
+
setCurrentThreadId(id) {
|
|
1883
|
+
this._currentThreadId = id;
|
|
1884
|
+
this.notify();
|
|
1885
|
+
}
|
|
1886
|
+
addThread(thread) {
|
|
1887
|
+
this._threads = [thread, ...this._threads];
|
|
1888
|
+
this.notify();
|
|
1889
|
+
}
|
|
1890
|
+
updateThread(id, updates) {
|
|
1891
|
+
this._threads = this._threads.map(
|
|
1892
|
+
(t) => t.id === id ? { ...t, ...updates } : t
|
|
1893
|
+
);
|
|
1894
|
+
if (this._currentThread?.id === id) {
|
|
1895
|
+
this._currentThread = { ...this._currentThread, ...updates };
|
|
1896
|
+
}
|
|
1897
|
+
this.notify();
|
|
1898
|
+
}
|
|
1899
|
+
removeThread(id) {
|
|
1900
|
+
this._threads = this._threads.filter((t) => t.id !== id);
|
|
1901
|
+
if (this._currentThreadId === id) {
|
|
1902
|
+
this._currentThreadId = null;
|
|
1903
|
+
this._currentThread = null;
|
|
1904
|
+
}
|
|
1905
|
+
this.notify();
|
|
1906
|
+
}
|
|
1907
|
+
setLoadStatus(status) {
|
|
1908
|
+
this._loadStatus = status;
|
|
1909
|
+
this.notify();
|
|
1910
|
+
}
|
|
1911
|
+
setError(error) {
|
|
1912
|
+
this._error = error;
|
|
1913
|
+
this.notify();
|
|
1914
|
+
}
|
|
1915
|
+
// Subscription
|
|
1916
|
+
subscribe(callback) {
|
|
1917
|
+
this.callbacks.add(callback);
|
|
1918
|
+
return () => this.callbacks.delete(callback);
|
|
1919
|
+
}
|
|
1920
|
+
// Snapshots
|
|
1921
|
+
getThreadsSnapshot() {
|
|
1922
|
+
return this._threads;
|
|
1923
|
+
}
|
|
1924
|
+
getCurrentThreadSnapshot() {
|
|
1925
|
+
return this._currentThread;
|
|
1926
|
+
}
|
|
1927
|
+
getLoadStatusSnapshot() {
|
|
1928
|
+
return this._loadStatus;
|
|
1929
|
+
}
|
|
1930
|
+
getErrorSnapshot() {
|
|
1931
|
+
return this._error;
|
|
1932
|
+
}
|
|
1933
|
+
notify() {
|
|
1934
|
+
this.callbacks.forEach((cb) => cb());
|
|
1935
|
+
}
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1938
|
+
// src/thread/adapters/localStorageAdapter.ts
|
|
1939
|
+
var DEFAULT_STORAGE_KEY = "copilot-sdk-store";
|
|
1940
|
+
var STORE_VERSION = 1;
|
|
1941
|
+
function isLocalStorageAvailable() {
|
|
1942
|
+
if (typeof window === "undefined") return false;
|
|
1943
|
+
try {
|
|
1944
|
+
const testKey = "__copilot_test__";
|
|
1945
|
+
window.localStorage.setItem(testKey, testKey);
|
|
1946
|
+
window.localStorage.removeItem(testKey);
|
|
1947
|
+
return true;
|
|
1948
|
+
} catch {
|
|
1949
|
+
return false;
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
function createEmptyStore() {
|
|
1953
|
+
return {
|
|
1954
|
+
version: STORE_VERSION,
|
|
1955
|
+
lastActiveThreadId: null,
|
|
1956
|
+
threads: []
|
|
1957
|
+
};
|
|
1958
|
+
}
|
|
1959
|
+
function serializeThread(thread) {
|
|
1960
|
+
return {
|
|
1961
|
+
id: thread.id,
|
|
1962
|
+
title: thread.title,
|
|
1963
|
+
preview: thread.preview,
|
|
1964
|
+
messageCount: thread.messageCount,
|
|
1965
|
+
createdAt: thread.createdAt.toISOString(),
|
|
1966
|
+
updatedAt: thread.updatedAt.toISOString(),
|
|
1967
|
+
sources: thread.sources || [],
|
|
1968
|
+
messages: thread.messages.map((m) => ({
|
|
1969
|
+
id: m.id,
|
|
1970
|
+
role: m.role,
|
|
1971
|
+
content: m.content,
|
|
1972
|
+
created_at: m.created_at instanceof Date ? m.created_at.toISOString() : m.created_at,
|
|
1973
|
+
tool_calls: m.tool_calls,
|
|
1974
|
+
tool_call_id: m.tool_call_id,
|
|
1975
|
+
metadata: m.metadata
|
|
1976
|
+
}))
|
|
1977
|
+
};
|
|
1978
|
+
}
|
|
1979
|
+
function deserializeThread(data) {
|
|
1980
|
+
return {
|
|
1981
|
+
id: data.id,
|
|
1982
|
+
title: data.title,
|
|
1983
|
+
preview: data.preview,
|
|
1984
|
+
messageCount: data.messageCount ?? data.messages?.length ?? 0,
|
|
1985
|
+
createdAt: new Date(data.createdAt),
|
|
1986
|
+
updatedAt: new Date(data.updatedAt),
|
|
1987
|
+
sources: data.sources || [],
|
|
1988
|
+
messages: (data.messages || []).map((m) => ({
|
|
1989
|
+
id: m.id,
|
|
1990
|
+
role: m.role,
|
|
1991
|
+
content: m.content,
|
|
1992
|
+
created_at: new Date(m.created_at),
|
|
1993
|
+
tool_calls: m.tool_calls,
|
|
1994
|
+
tool_call_id: m.tool_call_id,
|
|
1995
|
+
metadata: m.metadata
|
|
1996
|
+
}))
|
|
1997
|
+
};
|
|
1998
|
+
}
|
|
1999
|
+
function readStore(storageKey) {
|
|
2000
|
+
if (!isLocalStorageAvailable()) {
|
|
2001
|
+
return createEmptyStore();
|
|
2002
|
+
}
|
|
2003
|
+
try {
|
|
2004
|
+
const raw = localStorage.getItem(storageKey);
|
|
2005
|
+
if (!raw) {
|
|
2006
|
+
return createEmptyStore();
|
|
2007
|
+
}
|
|
2008
|
+
const parsed = JSON.parse(raw);
|
|
2009
|
+
if (!parsed || typeof parsed !== "object") {
|
|
2010
|
+
console.warn("[CopilotSDK] Invalid store format, resetting");
|
|
2011
|
+
return createEmptyStore();
|
|
2012
|
+
}
|
|
2013
|
+
if (parsed.version !== STORE_VERSION) {
|
|
2014
|
+
console.log(
|
|
2015
|
+
`[CopilotSDK] Migrating store from v${parsed.version} to v${STORE_VERSION}`
|
|
2016
|
+
);
|
|
2017
|
+
}
|
|
2018
|
+
return {
|
|
2019
|
+
version: STORE_VERSION,
|
|
2020
|
+
lastActiveThreadId: parsed.lastActiveThreadId ?? null,
|
|
2021
|
+
threads: Array.isArray(parsed.threads) ? parsed.threads : []
|
|
2022
|
+
};
|
|
2023
|
+
} catch (e) {
|
|
2024
|
+
console.warn("[CopilotSDK] Failed to read store, resetting:", e);
|
|
2025
|
+
return createEmptyStore();
|
|
2026
|
+
}
|
|
2027
|
+
}
|
|
2028
|
+
function writeStore(storageKey, store) {
|
|
2029
|
+
if (!isLocalStorageAvailable()) return;
|
|
2030
|
+
try {
|
|
2031
|
+
const serialized = JSON.stringify(store);
|
|
2032
|
+
localStorage.setItem(storageKey, serialized);
|
|
2033
|
+
} catch (e) {
|
|
2034
|
+
if (e instanceof DOMException && e.name === "QuotaExceededError") {
|
|
2035
|
+
console.error(
|
|
2036
|
+
"[CopilotSDK] localStorage quota exceeded. Consider clearing old threads."
|
|
2037
|
+
);
|
|
2038
|
+
} else {
|
|
2039
|
+
console.warn("[CopilotSDK] Failed to write store:", e);
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
function updateStore(storageKey, updater) {
|
|
2044
|
+
const store = readStore(storageKey);
|
|
2045
|
+
const updates = updater(store);
|
|
2046
|
+
const newStore = { ...store, ...updates };
|
|
2047
|
+
writeStore(storageKey, newStore);
|
|
2048
|
+
return newStore;
|
|
2049
|
+
}
|
|
2050
|
+
function createLocalStorageAdapter(config) {
|
|
2051
|
+
const storageKey = config?.storageKey ?? DEFAULT_STORAGE_KEY;
|
|
2052
|
+
return {
|
|
2053
|
+
save: async (threads) => {
|
|
2054
|
+
updateStore(storageKey, (store) => ({
|
|
2055
|
+
threads: threads.map(serializeThread)
|
|
2056
|
+
}));
|
|
2057
|
+
},
|
|
2058
|
+
load: async () => {
|
|
2059
|
+
const store = readStore(storageKey);
|
|
2060
|
+
return store.threads.map(deserializeThread);
|
|
2061
|
+
},
|
|
2062
|
+
clear: async () => {
|
|
2063
|
+
if (!isLocalStorageAvailable()) return;
|
|
2064
|
+
try {
|
|
2065
|
+
localStorage.removeItem(storageKey);
|
|
2066
|
+
} catch (e) {
|
|
2067
|
+
console.warn("[CopilotSDK] Failed to clear store:", e);
|
|
2068
|
+
}
|
|
2069
|
+
},
|
|
2070
|
+
getLastActiveThreadId: async () => {
|
|
2071
|
+
const store = readStore(storageKey);
|
|
2072
|
+
return store.lastActiveThreadId;
|
|
2073
|
+
},
|
|
2074
|
+
setLastActiveThreadId: async (threadId) => {
|
|
2075
|
+
updateStore(storageKey, () => ({
|
|
2076
|
+
lastActiveThreadId: threadId
|
|
2077
|
+
}));
|
|
2078
|
+
}
|
|
2079
|
+
};
|
|
2080
|
+
}
|
|
2081
|
+
var localStorageAdapter = createLocalStorageAdapter();
|
|
2082
|
+
|
|
2083
|
+
// src/thread/adapters/serverAdapter.ts
|
|
2084
|
+
function parseThread(data) {
|
|
2085
|
+
return {
|
|
2086
|
+
id: data.id,
|
|
2087
|
+
title: data.title,
|
|
2088
|
+
preview: data.preview,
|
|
2089
|
+
messageCount: data.messageCount,
|
|
2090
|
+
createdAt: new Date(data.createdAt),
|
|
2091
|
+
updatedAt: new Date(data.updatedAt),
|
|
2092
|
+
messages: (data.messages ?? []).map((m) => ({
|
|
2093
|
+
id: m.id,
|
|
2094
|
+
role: m.role,
|
|
2095
|
+
content: m.content,
|
|
2096
|
+
created_at: m.created_at ? new Date(m.created_at) : /* @__PURE__ */ new Date(),
|
|
2097
|
+
tool_calls: m.tool_calls,
|
|
2098
|
+
tool_call_id: m.tool_call_id,
|
|
2099
|
+
metadata: m.metadata
|
|
2100
|
+
})),
|
|
2101
|
+
sources: data.sources ?? []
|
|
2102
|
+
};
|
|
2103
|
+
}
|
|
2104
|
+
function serializeThread2(thread) {
|
|
2105
|
+
const serialized = {};
|
|
2106
|
+
if (thread.id !== void 0) serialized.id = thread.id;
|
|
2107
|
+
if (thread.title !== void 0) serialized.title = thread.title;
|
|
2108
|
+
if (thread.preview !== void 0) serialized.preview = thread.preview;
|
|
2109
|
+
if (thread.messageCount !== void 0)
|
|
2110
|
+
serialized.messageCount = thread.messageCount;
|
|
2111
|
+
if (thread.createdAt !== void 0)
|
|
2112
|
+
serialized.createdAt = thread.createdAt.toISOString();
|
|
2113
|
+
if (thread.updatedAt !== void 0)
|
|
2114
|
+
serialized.updatedAt = thread.updatedAt.toISOString();
|
|
2115
|
+
if (thread.messages !== void 0) {
|
|
2116
|
+
serialized.messages = thread.messages.map((m) => ({
|
|
2117
|
+
id: m.id,
|
|
2118
|
+
role: m.role,
|
|
2119
|
+
content: m.content,
|
|
2120
|
+
created_at: m.created_at instanceof Date ? m.created_at.toISOString() : m.created_at,
|
|
2121
|
+
tool_calls: m.tool_calls,
|
|
2122
|
+
tool_call_id: m.tool_call_id,
|
|
2123
|
+
metadata: m.metadata
|
|
2124
|
+
}));
|
|
2125
|
+
}
|
|
2126
|
+
if (thread.sources !== void 0) serialized.sources = thread.sources;
|
|
2127
|
+
return serialized;
|
|
2128
|
+
}
|
|
2129
|
+
function createServerAdapter(config) {
|
|
2130
|
+
const { endpoint, headers = {} } = config;
|
|
2131
|
+
const fetchFn = config.fetch ?? globalThis.fetch;
|
|
2132
|
+
const buildUrl = (path = "", params) => {
|
|
2133
|
+
const url = new URL(
|
|
2134
|
+
path ? `${endpoint}/${path}` : endpoint,
|
|
2135
|
+
globalThis.location?.origin ?? "http://localhost"
|
|
2136
|
+
);
|
|
2137
|
+
if (params) {
|
|
2138
|
+
Object.entries(params).forEach(([key, value]) => {
|
|
2139
|
+
url.searchParams.set(key, value);
|
|
2140
|
+
});
|
|
2141
|
+
}
|
|
2142
|
+
return url.toString();
|
|
2143
|
+
};
|
|
2144
|
+
const request = async (method, path = "", body, params) => {
|
|
2145
|
+
const url = buildUrl(path, params);
|
|
2146
|
+
const response = await fetchFn(url, {
|
|
2147
|
+
method,
|
|
2148
|
+
headers: {
|
|
2149
|
+
"Content-Type": "application/json",
|
|
2150
|
+
...headers
|
|
2151
|
+
},
|
|
2152
|
+
body: body ? JSON.stringify(body) : void 0
|
|
2153
|
+
});
|
|
2154
|
+
if (!response.ok) {
|
|
2155
|
+
const errorText = await response.text();
|
|
2156
|
+
throw new Error(
|
|
2157
|
+
`Server adapter request failed: ${response.status} ${response.statusText} - ${errorText}`
|
|
2158
|
+
);
|
|
2159
|
+
}
|
|
2160
|
+
if (response.status === 204) {
|
|
2161
|
+
return void 0;
|
|
2162
|
+
}
|
|
2163
|
+
return response.json();
|
|
2164
|
+
};
|
|
2165
|
+
return {
|
|
2166
|
+
// ============================================
|
|
2167
|
+
// Basic Operations (required by ThreadStorageAdapter)
|
|
2168
|
+
// ============================================
|
|
2169
|
+
/**
|
|
2170
|
+
* Load all threads from server
|
|
2171
|
+
* Note: For large datasets, prefer using listThreads with pagination
|
|
2172
|
+
*/
|
|
2173
|
+
load: async () => {
|
|
2174
|
+
const response = await request("GET");
|
|
2175
|
+
const threads = Array.isArray(response) ? response : response.threads;
|
|
2176
|
+
return threads.map(parseThread);
|
|
2177
|
+
},
|
|
2178
|
+
/**
|
|
2179
|
+
* Save all threads to server (batch upsert)
|
|
2180
|
+
* Note: This is a fallback - prefer using individual CRUD operations
|
|
2181
|
+
*/
|
|
2182
|
+
save: async (threads) => {
|
|
2183
|
+
await request("PUT", "", {
|
|
2184
|
+
threads: threads.map(serializeThread2)
|
|
2185
|
+
});
|
|
2186
|
+
},
|
|
2187
|
+
/**
|
|
2188
|
+
* Clear all threads
|
|
2189
|
+
*/
|
|
2190
|
+
clear: async () => {
|
|
2191
|
+
await request("DELETE", "");
|
|
2192
|
+
},
|
|
2193
|
+
// ============================================
|
|
2194
|
+
// Optimized Single-Thread Operations
|
|
2195
|
+
// ============================================
|
|
2196
|
+
/**
|
|
2197
|
+
* Get a single thread by ID with messages
|
|
2198
|
+
*/
|
|
2199
|
+
getThread: async (id) => {
|
|
2200
|
+
try {
|
|
2201
|
+
const response = await request("GET", id);
|
|
2202
|
+
return parseThread(response);
|
|
2203
|
+
} catch (error) {
|
|
2204
|
+
if (error instanceof Error && error.message.includes("404")) {
|
|
2205
|
+
return null;
|
|
2206
|
+
}
|
|
2207
|
+
throw error;
|
|
2208
|
+
}
|
|
2209
|
+
},
|
|
2210
|
+
/**
|
|
2211
|
+
* Create a new thread
|
|
2212
|
+
*/
|
|
2213
|
+
createThread: async (thread) => {
|
|
2214
|
+
const response = await request(
|
|
2215
|
+
"POST",
|
|
2216
|
+
"",
|
|
2217
|
+
serializeThread2(thread)
|
|
2218
|
+
);
|
|
2219
|
+
return parseThread(response);
|
|
2220
|
+
},
|
|
2221
|
+
/**
|
|
2222
|
+
* Update an existing thread
|
|
2223
|
+
*/
|
|
2224
|
+
updateThread: async (id, updates) => {
|
|
2225
|
+
const response = await request(
|
|
2226
|
+
"PATCH",
|
|
2227
|
+
id,
|
|
2228
|
+
serializeThread2(updates)
|
|
2229
|
+
);
|
|
2230
|
+
return parseThread(response);
|
|
2231
|
+
},
|
|
2232
|
+
/**
|
|
2233
|
+
* Delete a thread by ID
|
|
2234
|
+
*/
|
|
2235
|
+
deleteThread: async (id) => {
|
|
2236
|
+
await request("DELETE", id);
|
|
2237
|
+
},
|
|
2238
|
+
/**
|
|
2239
|
+
* List threads with pagination
|
|
2240
|
+
*/
|
|
2241
|
+
listThreads: async (options) => {
|
|
2242
|
+
const params = {};
|
|
2243
|
+
if (options?.limit) params.limit = String(options.limit);
|
|
2244
|
+
if (options?.offset) params.offset = String(options.offset);
|
|
2245
|
+
if (options?.orderBy) params.orderBy = options.orderBy;
|
|
2246
|
+
if (options?.orderDir) params.orderDir = options.orderDir;
|
|
2247
|
+
const response = await request(
|
|
2248
|
+
"GET",
|
|
2249
|
+
"",
|
|
2250
|
+
void 0,
|
|
2251
|
+
params
|
|
2252
|
+
);
|
|
2253
|
+
return {
|
|
2254
|
+
threads: response.threads.map((t) => ({
|
|
2255
|
+
id: t.id,
|
|
2256
|
+
title: t.title,
|
|
2257
|
+
preview: t.preview,
|
|
2258
|
+
messageCount: t.messageCount,
|
|
2259
|
+
createdAt: new Date(t.createdAt),
|
|
2260
|
+
updatedAt: new Date(t.updatedAt)
|
|
2261
|
+
})),
|
|
2262
|
+
total: response.total,
|
|
2263
|
+
hasMore: response.hasMore ?? false
|
|
2264
|
+
};
|
|
2265
|
+
},
|
|
2266
|
+
// ============================================
|
|
2267
|
+
// Session Persistence
|
|
2268
|
+
// ============================================
|
|
2269
|
+
/**
|
|
2270
|
+
* Get the last active thread ID from localStorage
|
|
2271
|
+
*/
|
|
2272
|
+
getLastActiveThreadId: async () => {
|
|
2273
|
+
if (typeof window === "undefined") return null;
|
|
2274
|
+
try {
|
|
2275
|
+
return localStorage.getItem("yourgpt-last-thread-id");
|
|
2276
|
+
} catch {
|
|
2277
|
+
return null;
|
|
2278
|
+
}
|
|
2279
|
+
},
|
|
2280
|
+
/**
|
|
2281
|
+
* Store the last active thread ID in localStorage
|
|
2282
|
+
*/
|
|
2283
|
+
setLastActiveThreadId: async (threadId) => {
|
|
2284
|
+
if (typeof window === "undefined") return;
|
|
2285
|
+
try {
|
|
2286
|
+
if (threadId) {
|
|
2287
|
+
localStorage.setItem("yourgpt-last-thread-id", threadId);
|
|
2288
|
+
} else {
|
|
2289
|
+
localStorage.removeItem("yourgpt-last-thread-id");
|
|
2290
|
+
}
|
|
2291
|
+
} catch {
|
|
2292
|
+
}
|
|
2293
|
+
}
|
|
2294
|
+
};
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
// src/thread/adapters/memoryAdapter.ts
|
|
2298
|
+
function createMemoryAdapter(initialThreads) {
|
|
2299
|
+
let threads = initialThreads ? [...initialThreads] : [];
|
|
2300
|
+
return {
|
|
2301
|
+
save: async (newThreads) => {
|
|
2302
|
+
threads = JSON.parse(JSON.stringify(newThreads));
|
|
2303
|
+
threads = threads.map((t) => ({
|
|
2304
|
+
...t,
|
|
2305
|
+
createdAt: new Date(t.createdAt),
|
|
2306
|
+
updatedAt: new Date(t.updatedAt),
|
|
2307
|
+
messages: t.messages.map((m) => ({
|
|
2308
|
+
...m,
|
|
2309
|
+
created_at: new Date(m.created_at)
|
|
2310
|
+
}))
|
|
2311
|
+
}));
|
|
2312
|
+
},
|
|
2313
|
+
load: async () => {
|
|
2314
|
+
return threads.map((t) => ({
|
|
2315
|
+
...t,
|
|
2316
|
+
messages: [...t.messages],
|
|
2317
|
+
sources: [...t.sources]
|
|
2318
|
+
}));
|
|
2319
|
+
},
|
|
2320
|
+
clear: async () => {
|
|
2321
|
+
threads = [];
|
|
2322
|
+
}
|
|
2323
|
+
};
|
|
2324
|
+
}
|
|
2325
|
+
var noopAdapter = {
|
|
2326
|
+
save: async () => {
|
|
2327
|
+
},
|
|
2328
|
+
load: async () => [],
|
|
2329
|
+
clear: async () => {
|
|
2330
|
+
}
|
|
2331
|
+
};
|
|
2332
|
+
|
|
2333
|
+
// src/thread/ThreadManager.ts
|
|
2334
|
+
function generateThreadId2() {
|
|
2335
|
+
return `thread_${Date.now()}_${Math.random().toString(36).substring(2, 9)}`;
|
|
2336
|
+
}
|
|
2337
|
+
function generateThreadTitle2(content) {
|
|
2338
|
+
const trimmed = content.trim();
|
|
2339
|
+
if (trimmed.length <= 50) return trimmed;
|
|
2340
|
+
return trimmed.substring(0, 47) + "...";
|
|
2341
|
+
}
|
|
2342
|
+
function generatePreview(content) {
|
|
2343
|
+
const trimmed = content.trim();
|
|
2344
|
+
if (trimmed.length <= 100) return trimmed;
|
|
2345
|
+
return trimmed.substring(0, 97) + "...";
|
|
2346
|
+
}
|
|
2347
|
+
var ThreadManager = class {
|
|
2348
|
+
constructor(config = {}, callbacks = {}) {
|
|
2349
|
+
// Debounce timer for auto-save
|
|
2350
|
+
this.saveTimer = null;
|
|
2351
|
+
// Full thread data cache (for localStorage adapter)
|
|
2352
|
+
this.threadsData = /* @__PURE__ */ new Map();
|
|
2353
|
+
// Initialization promise
|
|
2354
|
+
this.initPromise = null;
|
|
2355
|
+
this.state = config.state ?? new SimpleThreadManagerState();
|
|
2356
|
+
this.adapter = config.adapter ?? localStorageAdapter;
|
|
2357
|
+
this.callbacks = callbacks;
|
|
2358
|
+
this.saveDebounce = config.saveDebounce ?? 1e3;
|
|
2359
|
+
this.autoLoad = config.autoLoad ?? true;
|
|
2360
|
+
this.autoRestoreLastThread = config.autoRestoreLastThread ?? true;
|
|
2361
|
+
if (this.autoLoad) {
|
|
2362
|
+
this.initPromise = this.loadThreads().catch((err) => {
|
|
2363
|
+
console.warn("[ThreadManager] Auto-load failed:", err);
|
|
2364
|
+
});
|
|
2365
|
+
}
|
|
2366
|
+
}
|
|
2367
|
+
// ============================================
|
|
2368
|
+
// Getters
|
|
2369
|
+
// ============================================
|
|
2370
|
+
/** All threads (metadata) */
|
|
2371
|
+
get threads() {
|
|
2372
|
+
return this.state.threads;
|
|
2373
|
+
}
|
|
2374
|
+
/** Currently selected thread ID */
|
|
2375
|
+
get currentThreadId() {
|
|
2376
|
+
return this.state.currentThreadId;
|
|
2377
|
+
}
|
|
2378
|
+
/** Currently loaded thread (with messages) */
|
|
2379
|
+
get currentThread() {
|
|
2380
|
+
return this.state.currentThread;
|
|
2381
|
+
}
|
|
2382
|
+
/** Whether threads are currently loading */
|
|
2383
|
+
get isLoading() {
|
|
2384
|
+
return this.state.loadStatus === "loading";
|
|
2385
|
+
}
|
|
2386
|
+
/** Current load status */
|
|
2387
|
+
get loadStatus() {
|
|
2388
|
+
return this.state.loadStatus;
|
|
2389
|
+
}
|
|
2390
|
+
/** Current error */
|
|
2391
|
+
get error() {
|
|
2392
|
+
return this.state.error;
|
|
2393
|
+
}
|
|
2394
|
+
/** Whether there are pending changes waiting to be saved */
|
|
2395
|
+
get hasPendingChanges() {
|
|
2396
|
+
return this.saveTimer !== null;
|
|
2397
|
+
}
|
|
2398
|
+
// ============================================
|
|
2399
|
+
// Public Methods
|
|
2400
|
+
// ============================================
|
|
2401
|
+
/**
|
|
2402
|
+
* Load all threads from storage
|
|
2403
|
+
*/
|
|
2404
|
+
async loadThreads() {
|
|
2405
|
+
this.state.setLoadStatus("loading");
|
|
2406
|
+
this.state.setError(void 0);
|
|
2407
|
+
try {
|
|
2408
|
+
const threadsData = await this.adapter.load();
|
|
2409
|
+
this.threadsData.clear();
|
|
2410
|
+
for (const thread of threadsData) {
|
|
2411
|
+
this.threadsData.set(thread.id, thread);
|
|
2412
|
+
}
|
|
2413
|
+
const threads = threadsData.map((t) => ({
|
|
2414
|
+
id: t.id,
|
|
2415
|
+
title: t.title,
|
|
2416
|
+
preview: t.preview ?? (t.messages[0]?.content ? generatePreview(
|
|
2417
|
+
typeof t.messages[0].content === "string" ? t.messages[0].content : ""
|
|
2418
|
+
) : void 0),
|
|
2419
|
+
messageCount: t.messageCount ?? t.messages.length,
|
|
2420
|
+
createdAt: t.createdAt,
|
|
2421
|
+
updatedAt: t.updatedAt
|
|
2422
|
+
}));
|
|
2423
|
+
threads.sort((a, b) => b.updatedAt.getTime() - a.updatedAt.getTime());
|
|
2424
|
+
this.state.setThreads(threads);
|
|
2425
|
+
this.state.setLoadStatus("loaded");
|
|
2426
|
+
this.callbacks.onThreadsLoaded?.(threads);
|
|
2427
|
+
if (this.autoRestoreLastThread && this.adapter.getLastActiveThreadId) {
|
|
2428
|
+
const lastActiveId = await this.adapter.getLastActiveThreadId();
|
|
2429
|
+
if (lastActiveId && this.threadsData.has(lastActiveId)) {
|
|
2430
|
+
this.switchThread(lastActiveId).catch((err) => {
|
|
2431
|
+
console.warn(
|
|
2432
|
+
"[ThreadManager] Failed to restore last active thread:",
|
|
2433
|
+
err
|
|
2434
|
+
);
|
|
2435
|
+
});
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
} catch (err) {
|
|
2439
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2440
|
+
this.state.setError(error);
|
|
2441
|
+
this.state.setLoadStatus("error");
|
|
2442
|
+
this.callbacks.onError?.(error);
|
|
2443
|
+
throw error;
|
|
2444
|
+
}
|
|
2445
|
+
}
|
|
2446
|
+
/**
|
|
2447
|
+
* Wait for initialization to complete
|
|
2448
|
+
*/
|
|
2449
|
+
async waitForInit() {
|
|
2450
|
+
if (this.initPromise) {
|
|
2451
|
+
await this.initPromise;
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
/**
|
|
2455
|
+
* Create a new thread
|
|
2456
|
+
*/
|
|
2457
|
+
async createThread(options) {
|
|
2458
|
+
const now = /* @__PURE__ */ new Date();
|
|
2459
|
+
const id = options?.id ?? generateThreadId2();
|
|
2460
|
+
let title = options?.title;
|
|
2461
|
+
if (!title && options?.messages) {
|
|
2462
|
+
const firstUserMsg = options.messages.find((m) => m.role === "user");
|
|
2463
|
+
if (firstUserMsg?.content) {
|
|
2464
|
+
title = generateThreadTitle2(
|
|
2465
|
+
typeof firstUserMsg.content === "string" ? firstUserMsg.content : ""
|
|
2466
|
+
);
|
|
2467
|
+
}
|
|
2468
|
+
}
|
|
2469
|
+
const thread = {
|
|
2470
|
+
id,
|
|
2471
|
+
title,
|
|
2472
|
+
messages: options?.messages ?? [],
|
|
2473
|
+
sources: [],
|
|
2474
|
+
createdAt: now,
|
|
2475
|
+
updatedAt: now,
|
|
2476
|
+
preview: options?.messages?.[0]?.content ? generatePreview(
|
|
2477
|
+
typeof options.messages[0].content === "string" ? options.messages[0].content : ""
|
|
2478
|
+
) : void 0,
|
|
2479
|
+
messageCount: options?.messages?.length ?? 0
|
|
2480
|
+
};
|
|
2481
|
+
const asyncAdapter = this.adapter;
|
|
2482
|
+
if (asyncAdapter.createThread) {
|
|
2483
|
+
try {
|
|
2484
|
+
const created = await asyncAdapter.createThread(thread);
|
|
2485
|
+
this.threadsData.set(created.id, created);
|
|
2486
|
+
this.state.addThread(created);
|
|
2487
|
+
this.state.setCurrentThread(created);
|
|
2488
|
+
this.callbacks.onThreadCreated?.(created);
|
|
2489
|
+
this.saveLastActiveThread(created.id);
|
|
2490
|
+
return created;
|
|
2491
|
+
} catch (err) {
|
|
2492
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2493
|
+
this.state.setError(error);
|
|
2494
|
+
this.callbacks.onError?.(error);
|
|
2495
|
+
throw error;
|
|
2496
|
+
}
|
|
2497
|
+
}
|
|
2498
|
+
this.threadsData.set(id, thread);
|
|
2499
|
+
this.state.addThread(thread);
|
|
2500
|
+
this.state.setCurrentThread(thread);
|
|
2501
|
+
this.scheduleSave();
|
|
2502
|
+
this.callbacks.onThreadCreated?.(thread);
|
|
2503
|
+
this.saveLastActiveThread(id);
|
|
2504
|
+
return thread;
|
|
2505
|
+
}
|
|
2506
|
+
/**
|
|
2507
|
+
* Switch to a different thread
|
|
2508
|
+
*/
|
|
2509
|
+
async switchThread(id) {
|
|
2510
|
+
if (this.currentThreadId === id && this.currentThread) {
|
|
2511
|
+
return this.currentThread;
|
|
2512
|
+
}
|
|
2513
|
+
const asyncAdapter = this.adapter;
|
|
2514
|
+
if (asyncAdapter.getThread) {
|
|
2515
|
+
try {
|
|
2516
|
+
const thread2 = await asyncAdapter.getThread(id);
|
|
2517
|
+
this.state.setCurrentThread(thread2);
|
|
2518
|
+
if (thread2) {
|
|
2519
|
+
this.threadsData.set(id, thread2);
|
|
2520
|
+
this.saveLastActiveThread(id);
|
|
2521
|
+
}
|
|
2522
|
+
this.callbacks.onThreadSwitched?.(thread2);
|
|
2523
|
+
return thread2;
|
|
2524
|
+
} catch (err) {
|
|
2525
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2526
|
+
this.state.setError(error);
|
|
2527
|
+
this.callbacks.onError?.(error);
|
|
2528
|
+
throw error;
|
|
2529
|
+
}
|
|
2530
|
+
}
|
|
2531
|
+
const thread = this.threadsData.get(id) ?? null;
|
|
2532
|
+
this.state.setCurrentThread(thread);
|
|
2533
|
+
if (thread) {
|
|
2534
|
+
this.saveLastActiveThread(id);
|
|
2535
|
+
}
|
|
2536
|
+
this.callbacks.onThreadSwitched?.(thread);
|
|
2537
|
+
return thread;
|
|
2538
|
+
}
|
|
2539
|
+
/**
|
|
2540
|
+
* Update the current thread
|
|
2541
|
+
*/
|
|
2542
|
+
async updateCurrentThread(updates) {
|
|
2543
|
+
if (!this.currentThread) {
|
|
2544
|
+
throw new Error("No thread selected");
|
|
2545
|
+
}
|
|
2546
|
+
const now = /* @__PURE__ */ new Date();
|
|
2547
|
+
const id = this.currentThread.id;
|
|
2548
|
+
const updatedThread = {
|
|
2549
|
+
...this.currentThread,
|
|
2550
|
+
...updates,
|
|
2551
|
+
updatedAt: now
|
|
2552
|
+
};
|
|
2553
|
+
if (updates.messages) {
|
|
2554
|
+
updatedThread.messageCount = updates.messages.length;
|
|
2555
|
+
if (updates.messages[0]?.content) {
|
|
2556
|
+
updatedThread.preview = generatePreview(
|
|
2557
|
+
typeof updates.messages[0].content === "string" ? updates.messages[0].content : ""
|
|
2558
|
+
);
|
|
2559
|
+
}
|
|
2560
|
+
if (!updatedThread.title) {
|
|
2561
|
+
const firstUserMsg = updates.messages.find((m) => m.role === "user");
|
|
2562
|
+
if (firstUserMsg?.content) {
|
|
2563
|
+
updatedThread.title = generateThreadTitle2(
|
|
2564
|
+
typeof firstUserMsg.content === "string" ? firstUserMsg.content : ""
|
|
2565
|
+
);
|
|
2566
|
+
}
|
|
2567
|
+
}
|
|
2568
|
+
}
|
|
2569
|
+
const asyncAdapter = this.adapter;
|
|
2570
|
+
if (asyncAdapter.updateThread) {
|
|
2571
|
+
try {
|
|
2572
|
+
const updated = await asyncAdapter.updateThread(id, updatedThread);
|
|
2573
|
+
this.threadsData.set(id, updated);
|
|
2574
|
+
this.state.setCurrentThread(updated);
|
|
2575
|
+
this.state.updateThread(id, {
|
|
2576
|
+
title: updated.title,
|
|
2577
|
+
preview: updated.preview,
|
|
2578
|
+
messageCount: updated.messageCount,
|
|
2579
|
+
updatedAt: updated.updatedAt
|
|
2580
|
+
});
|
|
2581
|
+
this.callbacks.onThreadUpdated?.(updated);
|
|
2582
|
+
return;
|
|
2583
|
+
} catch (err) {
|
|
2584
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2585
|
+
this.state.setError(error);
|
|
2586
|
+
this.callbacks.onError?.(error);
|
|
2587
|
+
throw error;
|
|
2588
|
+
}
|
|
2589
|
+
}
|
|
2590
|
+
this.threadsData.set(id, updatedThread);
|
|
2591
|
+
this.state.setCurrentThread(updatedThread);
|
|
2592
|
+
this.state.updateThread(id, {
|
|
2593
|
+
title: updatedThread.title,
|
|
2594
|
+
preview: updatedThread.preview,
|
|
2595
|
+
messageCount: updatedThread.messageCount,
|
|
2596
|
+
updatedAt: updatedThread.updatedAt
|
|
2597
|
+
});
|
|
2598
|
+
this.scheduleSave();
|
|
2599
|
+
this.callbacks.onThreadUpdated?.(updatedThread);
|
|
2600
|
+
}
|
|
2601
|
+
/**
|
|
2602
|
+
* Delete a thread
|
|
2603
|
+
*/
|
|
2604
|
+
async deleteThread(id) {
|
|
2605
|
+
const isDeletingCurrent = this.currentThreadId === id;
|
|
2606
|
+
const asyncAdapter = this.adapter;
|
|
2607
|
+
if (asyncAdapter.deleteThread) {
|
|
2608
|
+
try {
|
|
2609
|
+
await asyncAdapter.deleteThread(id);
|
|
2610
|
+
this.threadsData.delete(id);
|
|
2611
|
+
this.state.removeThread(id);
|
|
2612
|
+
if (isDeletingCurrent) {
|
|
2613
|
+
this.state.setCurrentThread(null);
|
|
2614
|
+
this.saveLastActiveThread(null);
|
|
2615
|
+
}
|
|
2616
|
+
this.callbacks.onThreadDeleted?.(id);
|
|
2617
|
+
return;
|
|
2618
|
+
} catch (err) {
|
|
2619
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2620
|
+
this.state.setError(error);
|
|
2621
|
+
this.callbacks.onError?.(error);
|
|
2622
|
+
throw error;
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
this.threadsData.delete(id);
|
|
2626
|
+
this.state.removeThread(id);
|
|
2627
|
+
if (isDeletingCurrent) {
|
|
2628
|
+
this.state.setCurrentThread(null);
|
|
2629
|
+
this.saveLastActiveThread(null);
|
|
2630
|
+
}
|
|
2631
|
+
this.scheduleSave();
|
|
2632
|
+
this.callbacks.onThreadDeleted?.(id);
|
|
2633
|
+
}
|
|
2634
|
+
/**
|
|
2635
|
+
* Clear the current thread selection
|
|
2636
|
+
*/
|
|
2637
|
+
clearCurrentThread() {
|
|
2638
|
+
this.state.setCurrentThread(null);
|
|
2639
|
+
this.saveLastActiveThread(null);
|
|
2640
|
+
this.callbacks.onThreadSwitched?.(null);
|
|
2641
|
+
}
|
|
2642
|
+
/**
|
|
2643
|
+
* Clear all threads
|
|
2644
|
+
*/
|
|
2645
|
+
async clearAllThreads() {
|
|
2646
|
+
try {
|
|
2647
|
+
await this.adapter.clear();
|
|
2648
|
+
this.threadsData.clear();
|
|
2649
|
+
this.state.setThreads([]);
|
|
2650
|
+
this.state.setCurrentThread(null);
|
|
2651
|
+
this.saveLastActiveThread(null);
|
|
2652
|
+
} catch (err) {
|
|
2653
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2654
|
+
this.state.setError(error);
|
|
2655
|
+
this.callbacks.onError?.(error);
|
|
2656
|
+
throw error;
|
|
2657
|
+
}
|
|
2658
|
+
}
|
|
2659
|
+
/**
|
|
2660
|
+
* Save changes immediately (bypass debounce)
|
|
2661
|
+
*/
|
|
2662
|
+
async saveNow() {
|
|
2663
|
+
if (this.saveTimer) {
|
|
2664
|
+
clearTimeout(this.saveTimer);
|
|
2665
|
+
this.saveTimer = null;
|
|
2666
|
+
}
|
|
2667
|
+
try {
|
|
2668
|
+
const threads = Array.from(this.threadsData.values());
|
|
2669
|
+
await this.adapter.save(threads);
|
|
2670
|
+
} catch (err) {
|
|
2671
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
2672
|
+
this.state.setError(error);
|
|
2673
|
+
this.callbacks.onError?.(error);
|
|
2674
|
+
throw error;
|
|
2675
|
+
}
|
|
2676
|
+
}
|
|
2677
|
+
/**
|
|
2678
|
+
* Dispose of the manager and save pending changes
|
|
2679
|
+
*/
|
|
2680
|
+
async dispose() {
|
|
2681
|
+
if (this.saveTimer) {
|
|
2682
|
+
clearTimeout(this.saveTimer);
|
|
2683
|
+
this.saveTimer = null;
|
|
2684
|
+
await this.saveNow();
|
|
2685
|
+
}
|
|
2686
|
+
}
|
|
2687
|
+
// ============================================
|
|
2688
|
+
// Protected Methods
|
|
2689
|
+
// ============================================
|
|
2690
|
+
/**
|
|
2691
|
+
* Schedule a debounced save
|
|
2692
|
+
*/
|
|
2693
|
+
scheduleSave() {
|
|
2694
|
+
if (this.saveTimer) {
|
|
2695
|
+
clearTimeout(this.saveTimer);
|
|
2696
|
+
}
|
|
2697
|
+
this.saveTimer = setTimeout(async () => {
|
|
2698
|
+
this.saveTimer = null;
|
|
2699
|
+
try {
|
|
2700
|
+
await this.saveNow();
|
|
2701
|
+
} catch (err) {
|
|
2702
|
+
console.warn("[ThreadManager] Auto-save failed:", err);
|
|
2703
|
+
}
|
|
2704
|
+
}, this.saveDebounce);
|
|
2705
|
+
}
|
|
2706
|
+
/**
|
|
2707
|
+
* Save the last active thread ID (for session persistence)
|
|
2708
|
+
*/
|
|
2709
|
+
saveLastActiveThread(threadId) {
|
|
2710
|
+
if (this.adapter.setLastActiveThreadId) {
|
|
2711
|
+
this.adapter.setLastActiveThreadId(threadId).catch((err) => {
|
|
2712
|
+
console.warn("[ThreadManager] Failed to save last active thread:", err);
|
|
2713
|
+
});
|
|
2714
|
+
}
|
|
2715
|
+
}
|
|
2716
|
+
};
|
|
2717
|
+
function createThreadManager(config, callbacks) {
|
|
2718
|
+
return new ThreadManager(config, callbacks);
|
|
2719
|
+
}
|
|
2720
|
+
|
|
2721
|
+
export { CLOUD_MAX_FILE_SIZE, DEFAULT_MODELS, DEFAULT_YOURGPT_ENDPOINT, SimpleThreadManagerState, ThreadManager, actionToTool, builtinTools, captureCurrentLogs, captureScreenshot, clearConsoleLogs, clearNetworkRequests, consoleLogsTool, createAssistantMessage, createCloudStorage, createConsoleLogsTool, createCustomDetector, createLocalStorageAdapter, createMemoryAdapter, createMessage, createNetworkRequestsTool, createSSEStream, createScreenshotTool, createServerAdapter, createThreadManager, createToolCall, createToolMessage, createToolResult, createUserMessage, defaultSystemMessage, defineClientTool, defineServerTool, defineTool, detectIntent, failure, formatLogsForAI, formatRequestsForAI, formatSSE, generateId, generateMessageId, generateSuggestionReason, generateThreadId, generateThreadTitle, generateToolCallId, getAttachmentTypeFromMime, getConsoleErrors, getConsoleLogs, getConsoleWarnings, getDefaultModel, getFailedRequests, getNetworkRequests, getPrimaryTool, hasToolCalls, hasToolSuggestions, isConsoleCaptureActive, isNetworkCaptureActive, isScreenshotSupported, isToolResult, localStorageAdapter, networkRequestsTool, noopAdapter, parseSSELine, parseStreamEvent, parseToolCallArgs, processFileToAttachment, resizeScreenshot, screenshotTool, serializeStreamEvent, startConsoleCapture, startNetworkCapture, stopConsoleCapture, stopNetworkCapture, streamSSE, success, tool, toolToAnthropicFormat, toolToOpenAIFormat, zodObjectToInputSchema, zodToJsonSchema };
|
|
2722
|
+
//# sourceMappingURL=chunk-QSEGNATZ.js.map
|
|
2723
|
+
//# sourceMappingURL=chunk-QSEGNATZ.js.map
|