@oro.ad/nuxt-claude-devtools 1.2.0 → 1.3.0
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/README.md +105 -13
- package/dist/client/200.html +1 -1
- package/dist/client/404.html +1 -1
- package/dist/client/_nuxt/B8uzckkK.js +1 -0
- package/dist/client/_nuxt/{CPQSDiF7.js → BAb1fJOF.js} +4 -4
- package/dist/client/_nuxt/BB1-kxmm.js +1 -0
- package/dist/client/_nuxt/BMZIbUUD.js +1 -0
- package/dist/client/_nuxt/BSF2Vz9o.js +1 -0
- package/dist/client/_nuxt/BSVkH7b6.js +1 -0
- package/dist/client/_nuxt/{08Mb3FOO.js → BYp73eMl.js} +1 -1
- package/dist/client/_nuxt/B_BoWmnX.js +1 -0
- package/dist/client/_nuxt/BcZxFXBD.js +1 -0
- package/dist/client/_nuxt/BflmC3YB.js +1 -0
- package/dist/client/_nuxt/BnXQTjo-.js +1 -0
- package/dist/client/_nuxt/C--9REmc.js +1 -0
- package/dist/client/_nuxt/CDQtmRaX.js +1 -0
- package/dist/client/_nuxt/CHeJJZL9.js +1 -0
- package/dist/client/_nuxt/{CSlPuO5s.js → COus5Ssl.js} +1 -1
- package/dist/client/_nuxt/{o1jjB-UO.js → CPA0s6N9.js} +1 -1
- package/dist/client/_nuxt/CRkq21kc.js +1 -0
- package/dist/client/_nuxt/Cgba93Y9.js +1 -0
- package/dist/client/_nuxt/D2l4TRxW.js +1 -0
- package/dist/client/_nuxt/DC_XB519.js +1 -0
- package/dist/client/_nuxt/DEys9N1G.js +1 -0
- package/dist/client/_nuxt/{b4Upel01.js → DGQ4s7ae.js} +1 -1
- package/dist/client/_nuxt/DH8Ugy8E.js +1 -0
- package/dist/client/_nuxt/DSt96JPY.js +4 -0
- package/dist/client/_nuxt/DbJLoP3G.js +1 -0
- package/dist/client/_nuxt/DeGmaFBY.js +1 -0
- package/dist/client/_nuxt/DgfRwrFR.js +1 -0
- package/dist/client/_nuxt/{CLKqRoht.js → DolUcBed.js} +1 -1
- package/dist/client/_nuxt/M6QPYocW.js +1 -0
- package/dist/client/_nuxt/QumocfwJ.js +1 -0
- package/dist/client/_nuxt/TQi6eIO6.js +1 -0
- package/dist/client/_nuxt/V4UvAcd3.js +1 -0
- package/dist/client/_nuxt/builds/latest.json +1 -1
- package/dist/client/_nuxt/builds/meta/2be12f06-336a-4fdd-b982-2f6c682c14a6.json +1 -0
- package/dist/client/_nuxt/d8BPa19J.js +1 -0
- package/dist/client/_nuxt/entry.BMxUr06A.css +1 -0
- package/dist/client/_nuxt/qbS8UemQ.js +1 -0
- package/dist/client/_nuxt/wDw60tEC.js +10 -0
- package/dist/client/_nuxt/xEjB6ozD.js +1 -0
- package/dist/client/agents/index.html +1 -1
- package/dist/client/commands/index.html +1 -1
- package/dist/client/docs/index.html +1 -1
- package/dist/client/index.html +1 -1
- package/dist/client/mcp/index.html +1 -1
- package/dist/client/plugins/index.html +1 -0
- package/dist/client/settings/index.html +1 -0
- package/dist/client/skills/index.html +1 -1
- package/dist/module.d.mts +12 -1
- package/dist/module.json +1 -1
- package/dist/module.mjs +27 -5
- package/dist/runtime/constants.d.ts +29 -0
- package/dist/runtime/constants.js +5 -0
- package/dist/runtime/overlay/components/ChatOverlay.d.vue.ts +7 -0
- package/dist/runtime/overlay/components/ChatOverlay.vue +893 -0
- package/dist/runtime/overlay/components/ChatOverlay.vue.d.ts +7 -0
- package/dist/runtime/overlay/components/MarkdownContent.d.vue.ts +6 -0
- package/dist/runtime/overlay/components/MarkdownContent.vue +31 -0
- package/dist/runtime/overlay/components/MarkdownContent.vue.d.ts +6 -0
- package/dist/runtime/overlay/components/ToolCallBlock.d.vue.ts +8 -0
- package/dist/runtime/overlay/components/ToolCallBlock.vue +77 -0
- package/dist/runtime/overlay/components/ToolCallBlock.vue.d.ts +8 -0
- package/dist/runtime/overlay/plugin.client.d.ts +6 -0
- package/dist/runtime/overlay/plugin.client.js +29 -0
- package/dist/runtime/server/agents-manager.d.ts +17 -4
- package/dist/runtime/server/agents-manager.js +38 -109
- package/dist/runtime/server/base-resource-manager.d.ts +90 -0
- package/dist/runtime/server/base-resource-manager.js +201 -0
- package/dist/runtime/server/claude-session.d.ts +11 -1
- package/dist/runtime/server/claude-session.js +246 -27
- package/dist/runtime/server/commands-manager.d.ts +12 -4
- package/dist/runtime/server/commands-manager.js +25 -100
- package/dist/runtime/server/constants.d.ts +94 -0
- package/dist/runtime/server/constants.js +18 -0
- package/dist/runtime/server/docs-manager.d.ts +7 -0
- package/dist/runtime/server/docs-manager.js +112 -3
- package/dist/runtime/server/history-manager.d.ts +1 -0
- package/dist/runtime/server/history-manager.js +25 -3
- package/dist/runtime/server/plugins/socket.io.js +5 -3
- package/dist/runtime/server/plugins-manager.d.ts +84 -0
- package/dist/runtime/server/plugins-manager.js +338 -0
- package/dist/runtime/server/settings-manager.d.ts +17 -0
- package/dist/runtime/server/settings-manager.js +70 -0
- package/dist/runtime/server/share-manager.d.ts +24 -0
- package/dist/runtime/server/share-manager.js +96 -0
- package/dist/runtime/server/skills-manager.d.ts +18 -4
- package/dist/runtime/server/skills-manager.js +32 -159
- package/dist/runtime/shared/composables/useClaudeChat.d.ts +35 -0
- package/dist/runtime/shared/composables/useClaudeChat.js +264 -0
- package/dist/runtime/shared/composables/useShare.d.ts +42 -0
- package/dist/runtime/shared/composables/useShare.js +192 -0
- package/dist/runtime/shared/composables/useVoiceInput.d.ts +8 -0
- package/dist/runtime/shared/composables/useVoiceInput.js +77 -0
- package/dist/runtime/shared/constants.d.ts +28 -0
- package/dist/runtime/shared/constants.js +6 -0
- package/dist/runtime/shared/index.d.ts +9 -0
- package/dist/runtime/shared/index.js +5 -0
- package/dist/runtime/shared/types.d.ts +48 -0
- package/dist/runtime/shared/types.js +0 -0
- package/dist/runtime/types.d.ts +2 -0
- package/dist/types.d.mts +1 -1
- package/package.json +5 -3
- package/dist/client/_nuxt/BMi2eT6G.js +0 -1
- package/dist/client/_nuxt/BiBLVxWh.js +0 -1
- package/dist/client/_nuxt/BnRGpZsC.js +0 -8
- package/dist/client/_nuxt/C2GhPw5d.js +0 -7
- package/dist/client/_nuxt/D8683igF.js +0 -7
- package/dist/client/_nuxt/DBIw6BGF.js +0 -1
- package/dist/client/_nuxt/DCgjfr8H.js +0 -9
- package/dist/client/_nuxt/bl5iU4Kz.js +0 -1
- package/dist/client/_nuxt/builds/meta/35284331-5e85-46e0-9058-988fea05336c.json +0 -1
- package/dist/client/_nuxt/entry.BhHeZ_Nj.css +0 -1
- package/dist/client/_nuxt/nKfsBgPE.js +0 -4
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import { computed, ref } from "vue";
|
|
2
|
+
import {
|
|
3
|
+
STORAGE_KEY_NICKNAME,
|
|
4
|
+
STORAGE_KEY_USER_ID,
|
|
5
|
+
URL_PARAM_SHARE,
|
|
6
|
+
URL_PARAM_SHARE_NICKNAME
|
|
7
|
+
} from "../constants.js";
|
|
8
|
+
export function useShare(options = {}) {
|
|
9
|
+
const { log = () => {
|
|
10
|
+
} } = options;
|
|
11
|
+
const userId = ref(null);
|
|
12
|
+
const nickname = ref(null);
|
|
13
|
+
const users = ref([]);
|
|
14
|
+
const showNicknameModal = ref(false);
|
|
15
|
+
const nicknameError = ref(null);
|
|
16
|
+
const isShareMode = computed(() => users.value.length > 1);
|
|
17
|
+
const wasInvited = ref(false);
|
|
18
|
+
const sharingActiveOnServer = ref(false);
|
|
19
|
+
const nicknameFromUrl = ref(false);
|
|
20
|
+
function generateId() {
|
|
21
|
+
return Math.random().toString(36).substring(2, 10);
|
|
22
|
+
}
|
|
23
|
+
function getShareParamsFromUrl() {
|
|
24
|
+
if (typeof window === "undefined") return { shareId: null, shareNickname: null };
|
|
25
|
+
const params = new URLSearchParams(window.location.search);
|
|
26
|
+
return {
|
|
27
|
+
shareId: params.get(URL_PARAM_SHARE),
|
|
28
|
+
shareNickname: params.get(URL_PARAM_SHARE_NICKNAME)
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
function cleanShareParamsFromUrl() {
|
|
32
|
+
if (typeof window === "undefined") return;
|
|
33
|
+
const url = new URL(window.location.href);
|
|
34
|
+
let changed = false;
|
|
35
|
+
if (url.searchParams.has(URL_PARAM_SHARE)) {
|
|
36
|
+
url.searchParams.delete(URL_PARAM_SHARE);
|
|
37
|
+
changed = true;
|
|
38
|
+
}
|
|
39
|
+
if (url.searchParams.has(URL_PARAM_SHARE_NICKNAME)) {
|
|
40
|
+
url.searchParams.delete(URL_PARAM_SHARE_NICKNAME);
|
|
41
|
+
changed = true;
|
|
42
|
+
}
|
|
43
|
+
if (changed) {
|
|
44
|
+
window.history.replaceState({}, "", url.toString());
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function initShare() {
|
|
48
|
+
if (typeof window === "undefined") return;
|
|
49
|
+
const { shareId, shareNickname } = getShareParamsFromUrl();
|
|
50
|
+
if (shareId) {
|
|
51
|
+
userId.value = shareId;
|
|
52
|
+
wasInvited.value = true;
|
|
53
|
+
localStorage.setItem(STORAGE_KEY_USER_ID, shareId);
|
|
54
|
+
log("Invited user ID:", shareId);
|
|
55
|
+
} else {
|
|
56
|
+
const storedUserId = localStorage.getItem(STORAGE_KEY_USER_ID);
|
|
57
|
+
if (storedUserId) {
|
|
58
|
+
userId.value = storedUserId;
|
|
59
|
+
} else {
|
|
60
|
+
const newId = generateId();
|
|
61
|
+
userId.value = newId;
|
|
62
|
+
localStorage.setItem(STORAGE_KEY_USER_ID, newId);
|
|
63
|
+
log("Generated new user ID:", newId);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
if (shareNickname) {
|
|
67
|
+
nickname.value = shareNickname;
|
|
68
|
+
localStorage.setItem(STORAGE_KEY_NICKNAME, shareNickname);
|
|
69
|
+
nicknameFromUrl.value = true;
|
|
70
|
+
log("Nickname from URL:", shareNickname);
|
|
71
|
+
} else {
|
|
72
|
+
const storedNickname = localStorage.getItem(STORAGE_KEY_NICKNAME);
|
|
73
|
+
if (storedNickname && storedNickname.trim()) {
|
|
74
|
+
nickname.value = storedNickname;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
cleanShareParamsFromUrl();
|
|
78
|
+
}
|
|
79
|
+
function createShareLink(includeNickname = false) {
|
|
80
|
+
if (typeof window === "undefined") return "";
|
|
81
|
+
const inviteeId = generateId();
|
|
82
|
+
let baseUrl;
|
|
83
|
+
const tunnelUrl = options.getTunnelUrl?.();
|
|
84
|
+
if (tunnelUrl) {
|
|
85
|
+
baseUrl = tunnelUrl;
|
|
86
|
+
} else {
|
|
87
|
+
baseUrl = window.location.origin;
|
|
88
|
+
}
|
|
89
|
+
const url = new URL(baseUrl);
|
|
90
|
+
url.searchParams.set(URL_PARAM_SHARE, inviteeId);
|
|
91
|
+
if (includeNickname && nickname.value) {
|
|
92
|
+
url.searchParams.set(URL_PARAM_SHARE_NICKNAME, nickname.value);
|
|
93
|
+
}
|
|
94
|
+
return url.toString();
|
|
95
|
+
}
|
|
96
|
+
function setNickname(name) {
|
|
97
|
+
nickname.value = name;
|
|
98
|
+
nicknameError.value = null;
|
|
99
|
+
if (typeof window !== "undefined") {
|
|
100
|
+
localStorage.setItem(STORAGE_KEY_NICKNAME, name);
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
function needsNicknameImmediate() {
|
|
104
|
+
return wasInvited.value && !nickname.value && !nicknameFromUrl.value;
|
|
105
|
+
}
|
|
106
|
+
function needsNicknameForMessage() {
|
|
107
|
+
return sharingActiveOnServer.value && !nickname.value;
|
|
108
|
+
}
|
|
109
|
+
function needsNicknameForShare() {
|
|
110
|
+
return !nickname.value;
|
|
111
|
+
}
|
|
112
|
+
function checkSharingStatus(socket) {
|
|
113
|
+
if (!socket) return;
|
|
114
|
+
socket.emit("share:is_active");
|
|
115
|
+
}
|
|
116
|
+
function registerUser(socket) {
|
|
117
|
+
if (!socket || !userId.value || !nickname.value) return;
|
|
118
|
+
socket.emit("share:register", {
|
|
119
|
+
userId: userId.value,
|
|
120
|
+
nickname: nickname.value
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function setupSocketListeners(socket) {
|
|
124
|
+
socket.on("share:users", (data) => {
|
|
125
|
+
users.value = data;
|
|
126
|
+
sharingActiveOnServer.value = data.length > 0;
|
|
127
|
+
});
|
|
128
|
+
socket.on("share:is_active", (data) => {
|
|
129
|
+
sharingActiveOnServer.value = data.active;
|
|
130
|
+
});
|
|
131
|
+
socket.on("share:user_joined", (user) => {
|
|
132
|
+
const existingIndex = users.value.findIndex((u) => u.id === user.id);
|
|
133
|
+
if (existingIndex >= 0) {
|
|
134
|
+
users.value[existingIndex] = user;
|
|
135
|
+
} else {
|
|
136
|
+
users.value.push(user);
|
|
137
|
+
}
|
|
138
|
+
});
|
|
139
|
+
socket.on("share:registered", (user) => {
|
|
140
|
+
nickname.value = user.nickname;
|
|
141
|
+
nicknameError.value = null;
|
|
142
|
+
showNicknameModal.value = false;
|
|
143
|
+
if (typeof window !== "undefined") {
|
|
144
|
+
localStorage.setItem(STORAGE_KEY_NICKNAME, user.nickname);
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
socket.on("share:nickname_taken", () => {
|
|
148
|
+
nicknameError.value = "This nickname is already taken";
|
|
149
|
+
showNicknameModal.value = true;
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
function getNicknameById(id) {
|
|
153
|
+
const user = users.value.find((u) => u.id === id);
|
|
154
|
+
return user?.nickname || null;
|
|
155
|
+
}
|
|
156
|
+
function isOwnMessage(senderId) {
|
|
157
|
+
if (!senderId || !userId.value) return true;
|
|
158
|
+
return senderId === userId.value;
|
|
159
|
+
}
|
|
160
|
+
async function copyShareLink(includeNickname = false) {
|
|
161
|
+
const link = createShareLink(includeNickname);
|
|
162
|
+
try {
|
|
163
|
+
await navigator.clipboard.writeText(link);
|
|
164
|
+
return true;
|
|
165
|
+
} catch {
|
|
166
|
+
return false;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return {
|
|
170
|
+
userId,
|
|
171
|
+
nickname,
|
|
172
|
+
users,
|
|
173
|
+
showNicknameModal,
|
|
174
|
+
nicknameError,
|
|
175
|
+
isShareMode,
|
|
176
|
+
wasInvited,
|
|
177
|
+
sharingActiveOnServer,
|
|
178
|
+
nicknameFromUrl,
|
|
179
|
+
initShare,
|
|
180
|
+
createShareLink,
|
|
181
|
+
setNickname,
|
|
182
|
+
needsNicknameImmediate,
|
|
183
|
+
needsNicknameForMessage,
|
|
184
|
+
needsNicknameForShare,
|
|
185
|
+
checkSharingStatus,
|
|
186
|
+
registerUser,
|
|
187
|
+
setupSocketListeners,
|
|
188
|
+
getNicknameById,
|
|
189
|
+
isOwnMessage,
|
|
190
|
+
copyShareLink
|
|
191
|
+
};
|
|
192
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare function useVoiceInput(): {
|
|
2
|
+
isRecording: import("vue").Ref<boolean, boolean>;
|
|
3
|
+
isSpeechSupported: import("vue").Ref<boolean, boolean>;
|
|
4
|
+
initSpeechRecognition: (onResult: (transcript: string) => void) => void;
|
|
5
|
+
toggleVoiceInput: (onResult: (transcript: string) => void) => void;
|
|
6
|
+
stopRecording: () => void;
|
|
7
|
+
cleanup: () => void;
|
|
8
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { ref } from "vue";
|
|
2
|
+
export function useVoiceInput() {
|
|
3
|
+
const isRecording = ref(false);
|
|
4
|
+
const speechRecognition = ref(null);
|
|
5
|
+
const isSpeechSupported = ref(false);
|
|
6
|
+
if (typeof window !== "undefined") {
|
|
7
|
+
const SpeechRecognitionAPI = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
8
|
+
isSpeechSupported.value = !!SpeechRecognitionAPI;
|
|
9
|
+
}
|
|
10
|
+
function initSpeechRecognition(onResult) {
|
|
11
|
+
const SpeechRecognitionAPI = window.SpeechRecognition || window.webkitSpeechRecognition;
|
|
12
|
+
if (!SpeechRecognitionAPI) {
|
|
13
|
+
isSpeechSupported.value = false;
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
isSpeechSupported.value = true;
|
|
17
|
+
const recognition = new SpeechRecognitionAPI();
|
|
18
|
+
recognition.continuous = true;
|
|
19
|
+
recognition.interimResults = true;
|
|
20
|
+
recognition.lang = navigator.language || "en-US";
|
|
21
|
+
recognition.onresult = (event) => {
|
|
22
|
+
let finalTranscript = "";
|
|
23
|
+
for (let i = event.resultIndex; i < event.results.length; i++) {
|
|
24
|
+
const transcript = event.results[i][0].transcript;
|
|
25
|
+
if (event.results[i].isFinal) {
|
|
26
|
+
finalTranscript += transcript;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
if (finalTranscript) {
|
|
30
|
+
onResult(finalTranscript);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
recognition.onerror = (event) => {
|
|
34
|
+
console.error("Speech recognition error:", event.error);
|
|
35
|
+
isRecording.value = false;
|
|
36
|
+
};
|
|
37
|
+
recognition.onend = () => {
|
|
38
|
+
isRecording.value = false;
|
|
39
|
+
};
|
|
40
|
+
speechRecognition.value = recognition;
|
|
41
|
+
}
|
|
42
|
+
function toggleVoiceInput(onResult) {
|
|
43
|
+
if (!speechRecognition.value) {
|
|
44
|
+
initSpeechRecognition(onResult);
|
|
45
|
+
}
|
|
46
|
+
if (!speechRecognition.value) {
|
|
47
|
+
alert("Speech recognition is not supported in this browser. Try Chrome or Edge.");
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (isRecording.value) {
|
|
51
|
+
speechRecognition.value.stop();
|
|
52
|
+
isRecording.value = false;
|
|
53
|
+
} else {
|
|
54
|
+
speechRecognition.value.start();
|
|
55
|
+
isRecording.value = true;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
function stopRecording() {
|
|
59
|
+
if (isRecording.value && speechRecognition.value) {
|
|
60
|
+
speechRecognition.value.stop();
|
|
61
|
+
isRecording.value = false;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
function cleanup() {
|
|
65
|
+
if (speechRecognition.value && isRecording.value) {
|
|
66
|
+
speechRecognition.value.stop();
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return {
|
|
70
|
+
isRecording,
|
|
71
|
+
isSpeechSupported,
|
|
72
|
+
initSpeechRecognition,
|
|
73
|
+
toggleVoiceInput,
|
|
74
|
+
stopRecording,
|
|
75
|
+
cleanup
|
|
76
|
+
};
|
|
77
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared constants for Claude DevTools
|
|
3
|
+
* Used by server, client, and overlay
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Socket.IO endpoint path for real-time communication
|
|
7
|
+
*/
|
|
8
|
+
export declare const SOCKET_PATH = "/__claude_devtools_socket";
|
|
9
|
+
/**
|
|
10
|
+
* DevTools UI iframe route
|
|
11
|
+
*/
|
|
12
|
+
export declare const DEVTOOLS_UI_ROUTE = "/__claude-devtools";
|
|
13
|
+
/**
|
|
14
|
+
* Unique user identifier for collaborative sessions
|
|
15
|
+
*/
|
|
16
|
+
export declare const STORAGE_KEY_USER_ID = "claude-devtools-user-id";
|
|
17
|
+
/**
|
|
18
|
+
* User's display name for collaborative sessions
|
|
19
|
+
*/
|
|
20
|
+
export declare const STORAGE_KEY_NICKNAME = "claude-devtools-nickname";
|
|
21
|
+
/**
|
|
22
|
+
* URL parameter for sharing collaborative session links
|
|
23
|
+
*/
|
|
24
|
+
export declare const URL_PARAM_SHARE = "oro_share";
|
|
25
|
+
/**
|
|
26
|
+
* URL parameter for auto-setting nickname from share link
|
|
27
|
+
*/
|
|
28
|
+
export declare const URL_PARAM_SHARE_NICKNAME = "oro_share_nickname";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const SOCKET_PATH = "/__claude_devtools_socket";
|
|
2
|
+
export const DEVTOOLS_UI_ROUTE = "/__claude-devtools";
|
|
3
|
+
export const STORAGE_KEY_USER_ID = "claude-devtools-user-id";
|
|
4
|
+
export const STORAGE_KEY_NICKNAME = "claude-devtools-nickname";
|
|
5
|
+
export const URL_PARAM_SHARE = "oro_share";
|
|
6
|
+
export const URL_PARAM_SHARE_NICKNAME = "oro_share_nickname";
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared exports for Claude DevTools
|
|
3
|
+
* Used by both overlay and potentially external integrations
|
|
4
|
+
*/
|
|
5
|
+
export * from './types.js';
|
|
6
|
+
export * from './constants.js';
|
|
7
|
+
export { useClaudeChat } from './composables/useClaudeChat.js';
|
|
8
|
+
export { useVoiceInput } from './composables/useVoiceInput.js';
|
|
9
|
+
export { useShare } from './composables/useShare.js';
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared types for Claude DevTools
|
|
3
|
+
* Used by both DevTools client and Overlay
|
|
4
|
+
*/
|
|
5
|
+
export interface ContentBlock {
|
|
6
|
+
type: 'text' | 'tool_use' | 'tool_result' | 'thinking';
|
|
7
|
+
text?: string;
|
|
8
|
+
thinking?: string;
|
|
9
|
+
id?: string;
|
|
10
|
+
name?: string;
|
|
11
|
+
input?: Record<string, unknown>;
|
|
12
|
+
tool_use_id?: string;
|
|
13
|
+
content?: string | unknown[];
|
|
14
|
+
is_error?: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface Message {
|
|
17
|
+
id: string;
|
|
18
|
+
role: 'user' | 'assistant' | 'system';
|
|
19
|
+
content: string;
|
|
20
|
+
contentBlocks?: ContentBlock[];
|
|
21
|
+
timestamp: Date | string;
|
|
22
|
+
streaming?: boolean;
|
|
23
|
+
model?: string;
|
|
24
|
+
senderId?: string;
|
|
25
|
+
senderNickname?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface Conversation {
|
|
28
|
+
id: string;
|
|
29
|
+
title?: string;
|
|
30
|
+
messages: Message[];
|
|
31
|
+
createdAt: string;
|
|
32
|
+
updatedAt: string;
|
|
33
|
+
projectPath: string;
|
|
34
|
+
}
|
|
35
|
+
export interface DocFile {
|
|
36
|
+
path: string;
|
|
37
|
+
name: string;
|
|
38
|
+
}
|
|
39
|
+
export interface SlashCommand {
|
|
40
|
+
name: string;
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface ShareUser {
|
|
44
|
+
id: string;
|
|
45
|
+
nickname: string;
|
|
46
|
+
joinedAt: string;
|
|
47
|
+
lastSeen: string;
|
|
48
|
+
}
|
|
File without changes
|
package/dist/runtime/types.d.ts
CHANGED
package/dist/types.d.mts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oro.ad/nuxt-claude-devtools",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Nuxt DevTools integration for Claude Code AI assistant",
|
|
5
5
|
"license": "GPL-3.0-only",
|
|
6
6
|
"type": "module",
|
|
@@ -56,7 +56,8 @@
|
|
|
56
56
|
"@oro.ad/nuxt-claude-devtools-bc": "^1.0.5",
|
|
57
57
|
"marked": "^17.0.1",
|
|
58
58
|
"sirv": "^3.0.2",
|
|
59
|
-
"socket.io": "^4.8.1"
|
|
59
|
+
"socket.io": "^4.8.1",
|
|
60
|
+
"socket.io-client": "^4.8.1"
|
|
60
61
|
},
|
|
61
62
|
"devDependencies": {
|
|
62
63
|
"@iconify-json/carbon": "^1.2.15",
|
|
@@ -69,7 +70,8 @@
|
|
|
69
70
|
"@nuxtjs/i18n": "^10.2.1",
|
|
70
71
|
"changelogen": "^0.6.2",
|
|
71
72
|
"eslint": "^9.39.2",
|
|
72
|
-
"nuxt": "^4.2.2"
|
|
73
|
+
"nuxt": "^4.2.2",
|
|
74
|
+
"vue-tsc": "^3.2.4"
|
|
73
75
|
},
|
|
74
76
|
"publishConfig": {
|
|
75
77
|
"access": "public"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as B}from"./bl5iU4Kz.js";import{u as R,a as E,_ as q,b as D,c as H,l as I}from"./BiBLVxWh.js";import{_ as z}from"./DBIw6BGF.js";import{_ as G}from"./CLKqRoht.js";import{g as J,r as p,j as K,k as O,c as r,o as u,a as t,b as s,w as i,d as a,n as Q,l as V,t as v,m as b,v as x,F as S,p as W}from"./nKfsBgPE.js";const X={class:"relative flex flex-col h-screen n-bg-base"},Y={class:"flex items-center justify-between p-4"},Z={class:"flex items-center gap-3"},h={class:"text-xl font-bold flex items-center gap-2"},ee={class:"flex items-center gap-2"},te={class:"flex-1 overflow-auto p-4"},le={class:"space-y-4"},oe={key:0,class:"n-bg-active rounded-lg p-4"},se={key:0,class:"mb-4"},ne={class:"space-y-4"},ae={class:"flex gap-4"},re={class:"flex items-center gap-2"},ue={class:"flex items-center gap-2"},ie={class:"flex items-center gap-2"},de={key:1},me={class:"flex gap-4"},pe={class:"flex items-center gap-2"},ve={class:"flex items-center gap-2"},ce={class:"flex gap-2 pt-2"},fe={key:1,class:"n-bg-active rounded-lg p-4 opacity-50"},ge={key:2,class:"space-y-2"},be={class:"font-bold flex items-center gap-2"},xe={class:"text-sm opacity-70 font-mono"},Ue=J({__name:"mcp",setup(_e){const w=R(),{log:_}=E("mcp"),n=p(null),k=p(!1),c=p(!1),U=p([]),f=p(!1),l=p({name:"",transport:"stdio",command:"",args:"",url:"",scope:"local"}),m=p("");function T(){return w.isActive.value&&w.origin.value?w.origin.value:window.location.origin}function $(){const d=T();_("Connecting to socket at",d),n.value=I(d,{path:"/__claude_devtools_socket",transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5}),n.value.on("connect",()=>{_("Connected to socket"),k.value=!0,N()}),n.value.on("disconnect",()=>{_("Disconnected from socket"),k.value=!1}),n.value.on("mcp:list",e=>{_("MCP list received",e),U.value=e,c.value=!1}),n.value.on("mcp:added",e=>{e.success?(f.value=!1,M()):m.value=e.error||"Failed to add MCP server"}),n.value.on("mcp:removed",e=>{e.success||alert(`Failed to remove: ${e.error}`)})}function N(){n.value&&(c.value=!0,n.value.emit("mcp:list"))}function M(){l.value={name:"",transport:"stdio",command:"",args:"",url:"",scope:"local"},m.value=""}function L(){if(!l.value.name){m.value="Name is required";return}if(l.value.transport==="stdio"&&!l.value.command){m.value="Command is required for stdio transport";return}if((l.value.transport==="http"||l.value.transport==="sse")&&!l.value.url){m.value="URL is required for HTTP/SSE transport";return}if(n.value){const d=l.value.args.split(" ").map(e=>e.trim()).filter(e=>e.length>0);n.value.emit("mcp:add",{name:l.value.name,transport:l.value.transport,command:l.value.command,args:d,url:l.value.url,scope:l.value.scope})}}function j(d){confirm(`Remove MCP server "${d.name}"?`)&&n.value&&n.value.emit("mcp:remove",{name:d.name})}return K(()=>{$()}),O(()=>{n.value&&n.value.disconnect()}),(d,e)=>{const F=B,y=q,g=D,P=H,C=z,A=G;return u(),r("div",X,[t("div",Y,[t("div",Z,[s(F,{class:"text-sm opacity-50 hover:opacity-100",to:"/"},{default:i(()=>[...e[11]||(e[11]=[a(" ← Chat ",-1)])]),_:1}),t("h1",h,[s(y,{class:"text-blue",icon:"carbon:plug"}),e[12]||(e[12]=a(" MCP Servers ",-1))])]),t("div",ee,[s(g,{disabled:!k.value,n:"blue",onClick:e[0]||(e[0]=o=>f.value=!0)},{default:i(()=>[s(y,{class:"mr-1",icon:"carbon:add"}),e[13]||(e[13]=a(" Add Server ",-1))]),_:1},8,["disabled"]),s(g,{disabled:!k.value||c.value,n:"gray",onClick:N},{default:i(()=>[s(y,{class:Q([{"animate-spin":c.value},"mr-1"]),icon:"carbon:restart"},null,8,["class"]),e[14]||(e[14]=a(" Refresh ",-1))]),_:1},8,["disabled"])])]),t("div",te,[t("div",le,[s(P,{class:"text-sm",icon:"carbon:information",n:"blue"},{default:i(()=>[...e[15]||(e[15]=[a(" Model Context Protocol (MCP) servers extend Claude's capabilities with custom tools and data sources. ",-1)])]),_:1}),f.value?(u(),r("div",oe,[e[29]||(e[29]=t("h3",{class:"font-bold mb-4"}," Add MCP Server ",-1)),m.value?(u(),r("div",se,[s(P,{icon:"carbon:warning",n:"red"},{default:i(()=>[a(v(m.value),1)]),_:1})])):V("",!0),t("div",ne,[t("div",null,[e[16]||(e[16]=t("label",{class:"block text-sm font-medium mb-1"},"Name",-1)),s(C,{modelValue:l.value.name,"onUpdate:modelValue":e[1]||(e[1]=o=>l.value.name=o),class:"w-full",placeholder:"e.g. github, nuxt-ui-remote"},null,8,["modelValue"])]),t("div",null,[e[20]||(e[20]=t("label",{class:"block text-sm font-medium mb-1"},"Transport",-1)),t("div",ae,[t("label",re,[b(t("input",{"onUpdate:modelValue":e[2]||(e[2]=o=>l.value.transport=o),name:"transport",type:"radio",value:"stdio"},null,512),[[x,l.value.transport]]),e[17]||(e[17]=t("span",null,"stdio",-1))]),t("label",ue,[b(t("input",{"onUpdate:modelValue":e[3]||(e[3]=o=>l.value.transport=o),name:"transport",type:"radio",value:"http"},null,512),[[x,l.value.transport]]),e[18]||(e[18]=t("span",null,"HTTP",-1))]),t("label",ie,[b(t("input",{"onUpdate:modelValue":e[4]||(e[4]=o=>l.value.transport=o),name:"transport",type:"radio",value:"sse"},null,512),[[x,l.value.transport]]),e[19]||(e[19]=t("span",null,"SSE",-1))])])]),l.value.transport==="stdio"?(u(),r(S,{key:0},[t("div",null,[e[21]||(e[21]=t("label",{class:"block text-sm font-medium mb-1"},"Command",-1)),s(C,{modelValue:l.value.command,"onUpdate:modelValue":e[5]||(e[5]=o=>l.value.command=o),class:"w-full font-mono",placeholder:"e.g. npx"},null,8,["modelValue"])]),t("div",null,[e[22]||(e[22]=t("label",{class:"block text-sm font-medium mb-1"},"Arguments",-1)),s(C,{modelValue:l.value.args,"onUpdate:modelValue":e[6]||(e[6]=o=>l.value.args=o),class:"w-full font-mono",placeholder:"e.g. -y @modelcontextprotocol/server-github"},null,8,["modelValue"])])],64)):V("",!0),l.value.transport==="http"||l.value.transport==="sse"?(u(),r("div",de,[e[23]||(e[23]=t("label",{class:"block text-sm font-medium mb-1"},"URL",-1)),s(C,{modelValue:l.value.url,"onUpdate:modelValue":e[7]||(e[7]=o=>l.value.url=o),class:"w-full font-mono",placeholder:"e.g. https://ui.nuxt.com/mcp"},null,8,["modelValue"])])):V("",!0),t("div",null,[e[26]||(e[26]=t("label",{class:"block text-sm font-medium mb-1"},"Scope",-1)),t("div",me,[t("label",pe,[b(t("input",{"onUpdate:modelValue":e[8]||(e[8]=o=>l.value.scope=o),name:"scope",type:"radio",value:"local"},null,512),[[x,l.value.scope]]),e[24]||(e[24]=t("span",null,"Local (this project)",-1))]),t("label",ve,[b(t("input",{"onUpdate:modelValue":e[9]||(e[9]=o=>l.value.scope=o),name:"scope",type:"radio",value:"global"},null,512),[[x,l.value.scope]]),e[25]||(e[25]=t("span",null,"User (all projects)",-1))])])]),t("div",ce,[s(g,{n:"green",onClick:L},{default:i(()=>[...e[27]||(e[27]=[a(" Add Server ",-1)])]),_:1}),s(g,{n:"gray",onClick:e[10]||(e[10]=o=>{f.value=!1,M()})},{default:i(()=>[...e[28]||(e[28]=[a(" Cancel ",-1)])]),_:1})])])])):V("",!0),U.value.length===0&&!f.value&&!c.value?(u(),r("div",fe,' No MCP servers configured. Click "Add Server" to get started. ')):(u(),r("div",ge,[(u(!0),r(S,null,W(U.value,o=>(u(),r("div",{key:o.name,class:"n-bg-active rounded-lg p-4 flex items-center justify-between"},[t("div",null,[t("div",be,[a(v(o.name)+" ",1),s(A,{n:o.transport==="stdio"?"gray":"blue",class:"text-xs"},{default:i(()=>[a(v(o.transport),1)]),_:2},1032,["n"]),s(A,{n:o.scope==="local"?"green":"purple",class:"text-xs"},{default:i(()=>[a(v(o.scope),1)]),_:2},1032,["n"])]),t("div",xe,[o.transport==="stdio"?(u(),r(S,{key:0},[a(v(o.command)+" "+v(o.args?.join(" ")),1)],64)):(u(),r(S,{key:1},[a(v(o.url),1)],64))])]),s(g,{n:"red",onClick:ke=>j(o)},{default:i(()=>[s(y,{icon:"carbon:trash-can"})]),_:1},8,["onClick"])]))),128))]))])])])}}});export{Ue as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{_ as me}from"./bl5iU4Kz.js";import{c as te,o as I,n as _e,g as be,L as J,H as C,a as we,s as ve,l as Ee,M as ke,q as x}from"./nKfsBgPE.js";const se={__name:"NIcon",props:{icon:{type:String,required:!1}},setup(n){return(e,t)=>(I(),te("div",{class:_e(["n-icon",n.icon])},null,2))}},At=be({name:"NButton",props:{to:String,icon:String,border:{type:Boolean,default:!0},disabled:Boolean,type:{type:String,default:"button"}},setup(n,{attrs:e,slots:t}){return()=>J(n.to?me:"button",{to:n.to,...e,...!n.to&&{type:n.type},...n.disabled?{disabled:!0}:{tabindex:0},class:[n.border?"n-button-base active:n-button-active focus-visible:n-focus-base hover:n-button-hover":"",t.default?"":"n-icon-button","n-button n-transition n-disabled:n-disabled"].join(" ")},{default:()=>[C(t,"icon",{},()=>n.icon?[J(se,{icon:n.icon,class:t.default?"n-button-icon":""})]:[]),C(t,"default")]})}}),Ae={class:"n-tip n-tip-base"},Tt={__name:"NTip",props:{icon:{type:String,required:!1}},setup(n){return(e,t)=>{const s=se;return I(),te("div",Ae,[C(e.$slots,"icon",{},()=>[n.icon?(I(),ve(s,{key:0,icon:n.icon,class:"n-tip-icon"},null,8,["icon"])):Ee("",!0)]),we("div",null,[C(e.$slots,"default")])])}}},y=Object.create(null);y.open="0";y.close="1";y.ping="2";y.pong="3";y.message="4";y.upgrade="5";y.noop="6";const T=Object.create(null);Object.keys(y).forEach(n=>{T[y[n]]=n});const V={type:"error",data:"parser error"},ne=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",ie=typeof ArrayBuffer=="function",re=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n&&n.buffer instanceof ArrayBuffer,K=({type:n,data:e},t,s)=>ne&&e instanceof Blob?t?s(e):Q(e,s):ie&&(e instanceof ArrayBuffer||re(e))?t?s(e):Q(new Blob([e]),s):s(y[n]+(e||"")),Q=(n,e)=>{const t=new FileReader;return t.onload=function(){const s=t.result.split(",")[1];e("b"+(s||""))},t.readAsDataURL(n)};function j(n){return n instanceof Uint8Array?n:n instanceof ArrayBuffer?new Uint8Array(n):new Uint8Array(n.buffer,n.byteOffset,n.byteLength)}let L;function Te(n,e){if(ne&&n.data instanceof Blob)return n.data.arrayBuffer().then(j).then(e);if(ie&&(n.data instanceof ArrayBuffer||re(n.data)))return e(j(n.data));K(n,!1,t=>{L||(L=new TextEncoder),e(L.encode(t))})}const G="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",E=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let n=0;n<G.length;n++)E[G.charCodeAt(n)]=n;const Re=n=>{let e=n.length*.75,t=n.length,s,i=0,r,o,c,h;n[n.length-1]==="="&&(e--,n[n.length-2]==="="&&e--);const g=new ArrayBuffer(e),f=new Uint8Array(g);for(s=0;s<t;s+=4)r=E[n.charCodeAt(s)],o=E[n.charCodeAt(s+1)],c=E[n.charCodeAt(s+2)],h=E[n.charCodeAt(s+3)],f[i++]=r<<2|o>>4,f[i++]=(o&15)<<4|c>>2,f[i++]=(c&3)<<6|h&63;return g},Oe=typeof ArrayBuffer=="function",W=(n,e)=>{if(typeof n!="string")return{type:"message",data:oe(n,e)};const t=n.charAt(0);return t==="b"?{type:"message",data:Ce(n.substring(1),e)}:T[t]?n.length>1?{type:T[t],data:n.substring(1)}:{type:T[t]}:V},Ce=(n,e)=>{if(Oe){const t=Re(n);return oe(t,e)}else return{base64:!0,data:n}},oe=(n,e)=>e==="blob"?n instanceof Blob?n:new Blob([n]):n instanceof ArrayBuffer?n:n.buffer,ae="",Be=(n,e)=>{const t=n.length,s=new Array(t);let i=0;n.forEach((r,o)=>{K(r,!1,c=>{s[o]=c,++i===t&&e(s.join(ae))})})},Se=(n,e)=>{const t=n.split(ae),s=[];for(let i=0;i<t.length;i++){const r=W(t[i],e);if(s.push(r),r.type==="error")break}return s};function Ne(){return new TransformStream({transform(n,e){Te(n,t=>{const s=t.length;let i;if(s<126)i=new Uint8Array(1),new DataView(i.buffer).setUint8(0,s);else if(s<65536){i=new Uint8Array(3);const r=new DataView(i.buffer);r.setUint8(0,126),r.setUint16(1,s)}else{i=new Uint8Array(9);const r=new DataView(i.buffer);r.setUint8(0,127),r.setBigUint64(1,BigInt(s))}n.data&&typeof n.data!="string"&&(i[0]|=128),e.enqueue(i),e.enqueue(t)})}})}let q;function k(n){return n.reduce((e,t)=>e+t.length,0)}function A(n,e){if(n[0].length===e)return n.shift();const t=new Uint8Array(e);let s=0;for(let i=0;i<e;i++)t[i]=n[0][s++],s===n[0].length&&(n.shift(),s=0);return n.length&&s<n[0].length&&(n[0]=n[0].slice(s)),t}function xe(n,e){q||(q=new TextDecoder);const t=[];let s=0,i=-1,r=!1;return new TransformStream({transform(o,c){for(t.push(o);;){if(s===0){if(k(t)<1)break;const h=A(t,1);r=(h[0]&128)===128,i=h[0]&127,i<126?s=3:i===126?s=1:s=2}else if(s===1){if(k(t)<2)break;const h=A(t,2);i=new DataView(h.buffer,h.byteOffset,h.length).getUint16(0),s=3}else if(s===2){if(k(t)<8)break;const h=A(t,8),g=new DataView(h.buffer,h.byteOffset,h.length),f=g.getUint32(0);if(f>Math.pow(2,21)-1){c.enqueue(V);break}i=f*Math.pow(2,32)+g.getUint32(4),s=3}else{if(k(t)<i)break;const h=A(t,i);c.enqueue(W(r?h:q.decode(h),e)),s=0}if(i===0||i>n){c.enqueue(V);break}}}})}const ce=4;function u(n){if(n)return Le(n)}function Le(n){for(var e in u.prototype)n[e]=u.prototype[e];return n}u.prototype.on=u.prototype.addEventListener=function(n,e){return this._callbacks=this._callbacks||{},(this._callbacks["$"+n]=this._callbacks["$"+n]||[]).push(e),this};u.prototype.once=function(n,e){function t(){this.off(n,t),e.apply(this,arguments)}return t.fn=e,this.on(n,t),this};u.prototype.off=u.prototype.removeListener=u.prototype.removeAllListeners=u.prototype.removeEventListener=function(n,e){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var t=this._callbacks["$"+n];if(!t)return this;if(arguments.length==1)return delete this._callbacks["$"+n],this;for(var s,i=0;i<t.length;i++)if(s=t[i],s===e||s.fn===e){t.splice(i,1);break}return t.length===0&&delete this._callbacks["$"+n],this};u.prototype.emit=function(n){this._callbacks=this._callbacks||{};for(var e=new Array(arguments.length-1),t=this._callbacks["$"+n],s=1;s<arguments.length;s++)e[s-1]=arguments[s];if(t){t=t.slice(0);for(var s=0,i=t.length;s<i;++s)t[s].apply(this,e)}return this};u.prototype.emitReserved=u.prototype.emit;u.prototype.listeners=function(n){return this._callbacks=this._callbacks||{},this._callbacks["$"+n]||[]};u.prototype.hasListeners=function(n){return!!this.listeners(n).length};const S=typeof Promise=="function"&&typeof Promise.resolve=="function"?e=>Promise.resolve().then(e):(e,t)=>t(e,0),l=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),qe="arraybuffer";function he(n,...e){return e.reduce((t,s)=>(n.hasOwnProperty(s)&&(t[s]=n[s]),t),{})}const Pe=l.setTimeout,De=l.clearTimeout;function N(n,e){e.useNativeTimers?(n.setTimeoutFn=Pe.bind(l),n.clearTimeoutFn=De.bind(l)):(n.setTimeoutFn=l.setTimeout.bind(l),n.clearTimeoutFn=l.clearTimeout.bind(l))}const Ie=1.33;function Ve(n){return typeof n=="string"?Ue(n):Math.ceil((n.byteLength||n.size)*Ie)}function Ue(n){let e=0,t=0;for(let s=0,i=n.length;s<i;s++)e=n.charCodeAt(s),e<128?t+=1:e<2048?t+=2:e<55296||e>=57344?t+=3:(s++,t+=4);return t}function ue(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function Fe(n){let e="";for(let t in n)n.hasOwnProperty(t)&&(e.length&&(e+="&"),e+=encodeURIComponent(t)+"="+encodeURIComponent(n[t]));return e}function Me(n){let e={},t=n.split("&");for(let s=0,i=t.length;s<i;s++){let r=t[s].split("=");e[decodeURIComponent(r[0])]=decodeURIComponent(r[1])}return e}class $e extends Error{constructor(e,t,s){super(e),this.description=t,this.context=s,this.type="TransportError"}}class Y extends u{constructor(e){super(),this.writable=!1,N(this,e),this.opts=e,this.query=e.query,this.socket=e.socket,this.supportsBinary=!e.forceBase64}onError(e,t,s){return super.emitReserved("error",new $e(e,t,s)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(e){this.readyState==="open"&&this.write(e)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(e){const t=W(e,this.socket.binaryType);this.onPacket(t)}onPacket(e){super.emitReserved("packet",e)}onClose(e){this.readyState="closed",super.emitReserved("close",e)}pause(e){}createUri(e,t={}){return e+"://"+this._hostname()+this._port()+this.opts.path+this._query(t)}_hostname(){const e=this.opts.hostname;return e.indexOf(":")===-1?e:"["+e+"]"}_port(){return this.opts.port&&(this.opts.secure&&Number(this.opts.port)!==443||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(e){const t=Fe(e);return t.length?"?"+t:""}}class He extends Y{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(e){this.readyState="pausing";const t=()=>{this.readyState="paused",e()};if(this._polling||!this.writable){let s=0;this._polling&&(s++,this.once("pollComplete",function(){--s||t()})),this.writable||(s++,this.once("drain",function(){--s||t()}))}else t()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(e){const t=s=>{if(this.readyState==="opening"&&s.type==="open"&&this.onOpen(),s.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(s)};Se(e,this.socket.binaryType).forEach(t),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const e=()=>{this.write([{type:"close"}])};this.readyState==="open"?e():this.once("open",e)}write(e){this.writable=!1,Be(e,t=>{this.doWrite(t,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const e=this.opts.secure?"https":"http",t=this.query||{};return this.opts.timestampRequests!==!1&&(t[this.opts.timestampParam]=ue()),!this.supportsBinary&&!t.sid&&(t.b64=1),this.createUri(e,t)}}let fe=!1;try{fe=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const Ke=fe;function We(){}class Ye extends He{constructor(e){if(super(e),typeof location<"u"){const t=location.protocol==="https:";let s=location.port;s||(s=t?"443":"80"),this.xd=typeof location<"u"&&e.hostname!==location.hostname||s!==e.port}}doWrite(e,t){const s=this.request({method:"POST",data:e});s.on("success",t),s.on("error",(i,r)=>{this.onError("xhr post error",i,r)})}doPoll(){const e=this.request();e.on("data",this.onData.bind(this)),e.on("error",(t,s)=>{this.onError("xhr poll error",t,s)}),this.pollXhr=e}}class d extends u{constructor(e,t,s){super(),this.createRequest=e,N(this,s),this._opts=s,this._method=s.method||"GET",this._uri=t,this._data=s.data!==void 0?s.data:null,this._create()}_create(){var e;const t=he(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");t.xdomain=!!this._opts.xd;const s=this._xhr=this.createRequest(t);try{s.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){s.setDisableHeaderCheck&&s.setDisableHeaderCheck(!0);for(let i in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(i)&&s.setRequestHeader(i,this._opts.extraHeaders[i])}}catch{}if(this._method==="POST")try{s.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{s.setRequestHeader("Accept","*/*")}catch{}(e=this._opts.cookieJar)===null||e===void 0||e.addCookies(s),"withCredentials"in s&&(s.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(s.timeout=this._opts.requestTimeout),s.onreadystatechange=()=>{var i;s.readyState===3&&((i=this._opts.cookieJar)===null||i===void 0||i.parseCookies(s.getResponseHeader("set-cookie"))),s.readyState===4&&(s.status===200||s.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof s.status=="number"?s.status:0)},0))},s.send(this._data)}catch(i){this.setTimeoutFn(()=>{this._onError(i)},0);return}typeof document<"u"&&(this._index=d.requestsCount++,d.requests[this._index]=this)}_onError(e){this.emitReserved("error",e,this._xhr),this._cleanup(!0)}_cleanup(e){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=We,e)try{this._xhr.abort()}catch{}typeof document<"u"&&delete d.requests[this._index],this._xhr=null}}_onLoad(){const e=this._xhr.responseText;e!==null&&(this.emitReserved("data",e),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}}d.requestsCount=0;d.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",Z);else if(typeof addEventListener=="function"){const n="onpagehide"in l?"pagehide":"unload";addEventListener(n,Z,!1)}}function Z(){for(let n in d.requests)d.requests.hasOwnProperty(n)&&d.requests[n].abort()}const ze=(function(){const n=le({xdomain:!1});return n&&n.responseType!==null})();class Xe extends Ye{constructor(e){super(e);const t=e&&e.forceBase64;this.supportsBinary=ze&&!t}request(e={}){return Object.assign(e,{xd:this.xd},this.opts),new d(le,this.uri(),e)}}function le(n){const e=n.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!e||Ke))return new XMLHttpRequest}catch{}if(!e)try{return new l[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const pe=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Je extends Y{get name(){return"websocket"}doOpen(){const e=this.uri(),t=this.opts.protocols,s=pe?{}:he(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(s.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(e,t,s)}catch(i){return this.emitReserved("error",i)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=e=>this.onClose({description:"websocket connection closed",context:e}),this.ws.onmessage=e=>this.onData(e.data),this.ws.onerror=e=>this.onError("websocket error",e)}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;K(s,this.supportsBinary,r=>{try{this.doWrite(s,r)}catch{}i&&S(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const e=this.opts.secure?"wss":"ws",t=this.query||{};return this.opts.timestampRequests&&(t[this.opts.timestampParam]=ue()),this.supportsBinary||(t.b64=1),this.createUri(e,t)}}const P=l.WebSocket||l.MozWebSocket;class Qe extends Je{createSocket(e,t,s){return pe?new P(e,t,s):t?new P(e,t):new P(e)}doWrite(e,t){this.ws.send(t)}}class je extends Y{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(e){return this.emitReserved("error",e)}this._transport.closed.then(()=>{this.onClose()}).catch(e=>{this.onError("webtransport error",e)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(e=>{const t=xe(Number.MAX_SAFE_INTEGER,this.socket.binaryType),s=e.readable.pipeThrough(t).getReader(),i=Ne();i.readable.pipeTo(e.writable),this._writer=i.writable.getWriter();const r=()=>{s.read().then(({done:c,value:h})=>{c||(this.onPacket(h),r())}).catch(c=>{})};r();const o={type:"open"};this.query.sid&&(o.data=`{"sid":"${this.query.sid}"}`),this._writer.write(o).then(()=>this.onOpen())})})}write(e){this.writable=!1;for(let t=0;t<e.length;t++){const s=e[t],i=t===e.length-1;this._writer.write(s).then(()=>{i&&S(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var e;(e=this._transport)===null||e===void 0||e.close()}}const Ge={websocket:Qe,webtransport:je,polling:Xe},Ze=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,et=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function U(n){if(n.length>8e3)throw"URI too long";const e=n,t=n.indexOf("["),s=n.indexOf("]");t!=-1&&s!=-1&&(n=n.substring(0,t)+n.substring(t,s).replace(/:/g,";")+n.substring(s,n.length));let i=Ze.exec(n||""),r={},o=14;for(;o--;)r[et[o]]=i[o]||"";return t!=-1&&s!=-1&&(r.source=e,r.host=r.host.substring(1,r.host.length-1).replace(/;/g,":"),r.authority=r.authority.replace("[","").replace("]","").replace(/;/g,":"),r.ipv6uri=!0),r.pathNames=tt(r,r.path),r.queryKey=st(r,r.query),r}function tt(n,e){const t=/\/{2,9}/g,s=e.replace(t,"/").split("/");return(e.slice(0,1)=="/"||e.length===0)&&s.splice(0,1),e.slice(-1)=="/"&&s.splice(s.length-1,1),s}function st(n,e){const t={};return e.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(s,i,r){i&&(t[i]=r)}),t}const F=typeof addEventListener=="function"&&typeof removeEventListener=="function",R=[];F&&addEventListener("offline",()=>{R.forEach(n=>n())},!1);class _ extends u{constructor(e,t){if(super(),this.binaryType=qe,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,e&&typeof e=="object"&&(t=e,e=null),e){const s=U(e);t.hostname=s.host,t.secure=s.protocol==="https"||s.protocol==="wss",t.port=s.port,s.query&&(t.query=s.query)}else t.host&&(t.hostname=U(t.host).host);N(this,t),this.secure=t.secure!=null?t.secure:typeof location<"u"&&location.protocol==="https:",t.hostname&&!t.port&&(t.port=this.secure?"443":"80"),this.hostname=t.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=t.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},t.transports.forEach(s=>{const i=s.prototype.name;this.transports.push(i),this._transportsByName[i]=s}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},t),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=Me(this.opts.query)),F&&(this.opts.closeOnBeforeunload&&(this._beforeunloadEventListener=()=>{this.transport&&(this.transport.removeAllListeners(),this.transport.close())},addEventListener("beforeunload",this._beforeunloadEventListener,!1)),this.hostname!=="localhost"&&(this._offlineEventListener=()=>{this._onClose("transport close",{description:"network connection lost"})},R.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(e){const t=Object.assign({},this.opts.query);t.EIO=ce,t.transport=e,this.id&&(t.sid=this.id);const s=Object.assign({},this.opts,{query:t,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[e]);return new this._transportsByName[e](s)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const e=this.opts.rememberUpgrade&&_.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const t=this.createTransport(e);t.open(),this.setTransport(t)}setTransport(e){this.transport&&this.transport.removeAllListeners(),this.transport=e,e.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",t=>this._onClose("transport close",t))}onOpen(){this.readyState="open",_.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(e){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",e),this.emitReserved("heartbeat"),e.type){case"open":this.onHandshake(JSON.parse(e.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const t=new Error("server error");t.code=e.data,this._onError(t);break;case"message":this.emitReserved("data",e.data),this.emitReserved("message",e.data);break}}onHandshake(e){this.emitReserved("handshake",e),this.id=e.sid,this.transport.query.sid=e.sid,this._pingInterval=e.pingInterval,this._pingTimeout=e.pingTimeout,this._maxPayload=e.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const e=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+e,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},e),this.opts.autoUnref&&this._pingTimeoutTimer.unref()}_onDrain(){this.writeBuffer.splice(0,this._prevBufferLen),this._prevBufferLen=0,this.writeBuffer.length===0?this.emitReserved("drain"):this.flush()}flush(){if(this.readyState!=="closed"&&this.transport.writable&&!this.upgrading&&this.writeBuffer.length){const e=this._getWritablePackets();this.transport.send(e),this._prevBufferLen=e.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let t=1;for(let s=0;s<this.writeBuffer.length;s++){const i=this.writeBuffer[s].data;if(i&&(t+=Ve(i)),s>0&&t>this._maxPayload)return this.writeBuffer.slice(0,s);t+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const e=Date.now()>this._pingTimeoutTime;return e&&(this._pingTimeoutTime=0,S(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),e}write(e,t,s){return this._sendPacket("message",e,t,s),this}send(e,t,s){return this._sendPacket("message",e,t,s),this}_sendPacket(e,t,s,i){if(typeof t=="function"&&(i=t,t=void 0),typeof s=="function"&&(i=s,s=null),this.readyState==="closing"||this.readyState==="closed")return;s=s||{},s.compress=s.compress!==!1;const r={type:e,data:t,options:s};this.emitReserved("packetCreate",r),this.writeBuffer.push(r),i&&this.once("flush",i),this.flush()}close(){const e=()=>{this._onClose("forced close"),this.transport.close()},t=()=>{this.off("upgrade",t),this.off("upgradeError",t),e()},s=()=>{this.once("upgrade",t),this.once("upgradeError",t)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?s():e()}):this.upgrading?s():e()),this}_onError(e){if(_.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",e),this._onClose("transport error",e)}_onClose(e,t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),F&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const s=R.indexOf(this._offlineEventListener);s!==-1&&R.splice(s,1)}this.readyState="closed",this.id=null,this.emitReserved("close",e,t),this.writeBuffer=[],this._prevBufferLen=0}}}_.protocol=ce;class nt extends _{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let e=0;e<this._upgrades.length;e++)this._probe(this._upgrades[e])}_probe(e){let t=this.createTransport(e),s=!1;_.priorWebsocketSuccess=!1;const i=()=>{s||(t.send([{type:"ping",data:"probe"}]),t.once("packet",m=>{if(!s)if(m.type==="pong"&&m.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",t),!t)return;_.priorWebsocketSuccess=t.name==="websocket",this.transport.pause(()=>{s||this.readyState!=="closed"&&(f(),this.setTransport(t),t.send([{type:"upgrade"}]),this.emitReserved("upgrade",t),t=null,this.upgrading=!1,this.flush())})}else{const w=new Error("probe error");w.transport=t.name,this.emitReserved("upgradeError",w)}}))};function r(){s||(s=!0,f(),t.close(),t=null)}const o=m=>{const w=new Error("probe error: "+m);w.transport=t.name,r(),this.emitReserved("upgradeError",w)};function c(){o("transport closed")}function h(){o("socket closed")}function g(m){t&&m.name!==t.name&&r()}const f=()=>{t.removeListener("open",i),t.removeListener("error",o),t.removeListener("close",c),this.off("close",h),this.off("upgrading",g)};t.once("open",i),t.once("error",o),t.once("close",c),this.once("close",h),this.once("upgrading",g),this._upgrades.indexOf("webtransport")!==-1&&e!=="webtransport"?this.setTimeoutFn(()=>{s||t.open()},200):t.open()}onHandshake(e){this._upgrades=this._filterUpgrades(e.upgrades),super.onHandshake(e)}_filterUpgrades(e){const t=[];for(let s=0;s<e.length;s++)~this.transports.indexOf(e[s])&&t.push(e[s]);return t}}let it=class extends nt{constructor(e,t={}){const s=typeof e=="object"?e:t;(!s.transports||s.transports&&typeof s.transports[0]=="string")&&(s.transports=(s.transports||["polling","websocket","webtransport"]).map(i=>Ge[i]).filter(i=>!!i)),super(e,s)}};function rt(n,e="",t){let s=n;t=t||typeof location<"u"&&location,n==null&&(n=t.protocol+"//"+t.host),typeof n=="string"&&(n.charAt(0)==="/"&&(n.charAt(1)==="/"?n=t.protocol+n:n=t.host+n),/^(https?|wss?):\/\//.test(n)||(typeof t<"u"?n=t.protocol+"//"+n:n="https://"+n),s=U(n)),s.port||(/^(http|ws)$/.test(s.protocol)?s.port="80":/^(http|ws)s$/.test(s.protocol)&&(s.port="443")),s.path=s.path||"/";const r=s.host.indexOf(":")!==-1?"["+s.host+"]":s.host;return s.id=s.protocol+"://"+r+":"+s.port+e,s.href=s.protocol+"://"+r+(t&&t.port===s.port?"":":"+s.port),s}const ot=typeof ArrayBuffer=="function",at=n=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(n):n.buffer instanceof ArrayBuffer,de=Object.prototype.toString,ct=typeof Blob=="function"||typeof Blob<"u"&&de.call(Blob)==="[object BlobConstructor]",ht=typeof File=="function"||typeof File<"u"&&de.call(File)==="[object FileConstructor]";function z(n){return ot&&(n instanceof ArrayBuffer||at(n))||ct&&n instanceof Blob||ht&&n instanceof File}function O(n,e){if(!n||typeof n!="object")return!1;if(Array.isArray(n)){for(let t=0,s=n.length;t<s;t++)if(O(n[t]))return!0;return!1}if(z(n))return!0;if(n.toJSON&&typeof n.toJSON=="function"&&arguments.length===1)return O(n.toJSON(),!0);for(const t in n)if(Object.prototype.hasOwnProperty.call(n,t)&&O(n[t]))return!0;return!1}function ut(n){const e=[],t=n.data,s=n;return s.data=M(t,e),s.attachments=e.length,{packet:s,buffers:e}}function M(n,e){if(!n)return n;if(z(n)){const t={_placeholder:!0,num:e.length};return e.push(n),t}else if(Array.isArray(n)){const t=new Array(n.length);for(let s=0;s<n.length;s++)t[s]=M(n[s],e);return t}else if(typeof n=="object"&&!(n instanceof Date)){const t={};for(const s in n)Object.prototype.hasOwnProperty.call(n,s)&&(t[s]=M(n[s],e));return t}return n}function ft(n,e){return n.data=$(n.data,e),delete n.attachments,n}function $(n,e){if(!n)return n;if(n&&n._placeholder===!0){if(typeof n.num=="number"&&n.num>=0&&n.num<e.length)return e[n.num];throw new Error("illegal attachments")}else if(Array.isArray(n))for(let t=0;t<n.length;t++)n[t]=$(n[t],e);else if(typeof n=="object")for(const t in n)Object.prototype.hasOwnProperty.call(n,t)&&(n[t]=$(n[t],e));return n}const ye=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],lt=5;var a;(function(n){n[n.CONNECT=0]="CONNECT",n[n.DISCONNECT=1]="DISCONNECT",n[n.EVENT=2]="EVENT",n[n.ACK=3]="ACK",n[n.CONNECT_ERROR=4]="CONNECT_ERROR",n[n.BINARY_EVENT=5]="BINARY_EVENT",n[n.BINARY_ACK=6]="BINARY_ACK"})(a||(a={}));class pt{constructor(e){this.replacer=e}encode(e){return(e.type===a.EVENT||e.type===a.ACK)&&O(e)?this.encodeAsBinary({type:e.type===a.EVENT?a.BINARY_EVENT:a.BINARY_ACK,nsp:e.nsp,data:e.data,id:e.id}):[this.encodeAsString(e)]}encodeAsString(e){let t=""+e.type;return(e.type===a.BINARY_EVENT||e.type===a.BINARY_ACK)&&(t+=e.attachments+"-"),e.nsp&&e.nsp!=="/"&&(t+=e.nsp+","),e.id!=null&&(t+=e.id),e.data!=null&&(t+=JSON.stringify(e.data,this.replacer)),t}encodeAsBinary(e){const t=ut(e),s=this.encodeAsString(t.packet),i=t.buffers;return i.unshift(s),i}}class X extends u{constructor(e){super(),this.reviver=e}add(e){let t;if(typeof e=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");t=this.decodeString(e);const s=t.type===a.BINARY_EVENT;s||t.type===a.BINARY_ACK?(t.type=s?a.EVENT:a.ACK,this.reconstructor=new dt(t),t.attachments===0&&super.emitReserved("decoded",t)):super.emitReserved("decoded",t)}else if(z(e)||e.base64)if(this.reconstructor)t=this.reconstructor.takeBinaryData(e),t&&(this.reconstructor=null,super.emitReserved("decoded",t));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+e)}decodeString(e){let t=0;const s={type:Number(e.charAt(0))};if(a[s.type]===void 0)throw new Error("unknown packet type "+s.type);if(s.type===a.BINARY_EVENT||s.type===a.BINARY_ACK){const r=t+1;for(;e.charAt(++t)!=="-"&&t!=e.length;);const o=e.substring(r,t);if(o!=Number(o)||e.charAt(t)!=="-")throw new Error("Illegal attachments");s.attachments=Number(o)}if(e.charAt(t+1)==="/"){const r=t+1;for(;++t&&!(e.charAt(t)===","||t===e.length););s.nsp=e.substring(r,t)}else s.nsp="/";const i=e.charAt(t+1);if(i!==""&&Number(i)==i){const r=t+1;for(;++t;){const o=e.charAt(t);if(o==null||Number(o)!=o){--t;break}if(t===e.length)break}s.id=Number(e.substring(r,t+1))}if(e.charAt(++t)){const r=this.tryParse(e.substr(t));if(X.isPayloadValid(s.type,r))s.data=r;else throw new Error("invalid payload")}return s}tryParse(e){try{return JSON.parse(e,this.reviver)}catch{return!1}}static isPayloadValid(e,t){switch(e){case a.CONNECT:return B(t);case a.DISCONNECT:return t===void 0;case a.CONNECT_ERROR:return typeof t=="string"||B(t);case a.EVENT:case a.BINARY_EVENT:return Array.isArray(t)&&(typeof t[0]=="number"||typeof t[0]=="string"&&ye.indexOf(t[0])===-1);case a.ACK:case a.BINARY_ACK:return Array.isArray(t)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class dt{constructor(e){this.packet=e,this.buffers=[],this.reconPack=e}takeBinaryData(e){if(this.buffers.push(e),this.buffers.length===this.reconPack.attachments){const t=ft(this.reconPack,this.buffers);return this.finishedReconstruction(),t}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}function yt(n){return typeof n=="string"}const gt=Number.isInteger||function(n){return typeof n=="number"&&isFinite(n)&&Math.floor(n)===n};function mt(n){return n===void 0||gt(n)}function B(n){return Object.prototype.toString.call(n)==="[object Object]"}function _t(n,e){switch(n){case a.CONNECT:return e===void 0||B(e);case a.DISCONNECT:return e===void 0;case a.EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&ye.indexOf(e[0])===-1);case a.ACK:return Array.isArray(e);case a.CONNECT_ERROR:return typeof e=="string"||B(e);default:return!1}}function bt(n){return yt(n.nsp)&&mt(n.id)&&_t(n.type,n.data)}const wt=Object.freeze(Object.defineProperty({__proto__:null,Decoder:X,Encoder:pt,get PacketType(){return a},isPacketValid:bt,protocol:lt},Symbol.toStringTag,{value:"Module"}));function p(n,e,t){return n.on(e,t),function(){n.off(e,t)}}const vt=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class ge extends u{constructor(e,t,s){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=e,this.nsp=t,s&&s.auth&&(this.auth=s.auth),this._opts=Object.assign({},s),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const e=this.io;this.subs=[p(e,"open",this.onopen.bind(this)),p(e,"packet",this.onpacket.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this))]}get active(){return!!this.subs}connect(){return this.connected?this:(this.subEvents(),this.io._reconnecting||this.io.open(),this.io._readyState==="open"&&this.onopen(),this)}open(){return this.connect()}send(...e){return e.unshift("message"),this.emit.apply(this,e),this}emit(e,...t){var s,i,r;if(vt.hasOwnProperty(e))throw new Error('"'+e.toString()+'" is a reserved event name');if(t.unshift(e),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(t),this;const o={type:a.EVENT,data:t};if(o.options={},o.options.compress=this.flags.compress!==!1,typeof t[t.length-1]=="function"){const f=this.ids++,m=t.pop();this._registerAckCallback(f,m),o.id=f}const c=(i=(s=this.io.engine)===null||s===void 0?void 0:s.transport)===null||i===void 0?void 0:i.writable,h=this.connected&&!(!((r=this.io.engine)===null||r===void 0)&&r._hasPingExpired());return this.flags.volatile&&!c||(h?(this.notifyOutgoingListeners(o),this.packet(o)):this.sendBuffer.push(o)),this.flags={},this}_registerAckCallback(e,t){var s;const i=(s=this.flags.timeout)!==null&&s!==void 0?s:this._opts.ackTimeout;if(i===void 0){this.acks[e]=t;return}const r=this.io.setTimeoutFn(()=>{delete this.acks[e];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===e&&this.sendBuffer.splice(c,1);t.call(this,new Error("operation has timed out"))},i),o=(...c)=>{this.io.clearTimeoutFn(r),t.apply(this,c)};o.withError=!0,this.acks[e]=o}emitWithAck(e,...t){return new Promise((s,i)=>{const r=(o,c)=>o?i(o):s(c);r.withError=!0,t.push(r),this.emit(e,...t)})}_addToQueue(e){let t;typeof e[e.length-1]=="function"&&(t=e.pop());const s={id:this._queueSeq++,tryCount:0,pending:!1,args:e,flags:Object.assign({fromQueue:!0},this.flags)};e.push((i,...r)=>(this._queue[0],i!==null?s.tryCount>this._opts.retries&&(this._queue.shift(),t&&t(i)):(this._queue.shift(),t&&t(null,...r)),s.pending=!1,this._drainQueue())),this._queue.push(s),this._drainQueue()}_drainQueue(e=!1){if(!this.connected||this._queue.length===0)return;const t=this._queue[0];t.pending&&!e||(t.pending=!0,t.tryCount++,this.flags=t.flags,this.emit.apply(this,t.args))}packet(e){e.nsp=this.nsp,this.io._packet(e)}onopen(){typeof this.auth=="function"?this.auth(e=>{this._sendConnectPacket(e)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(e){this.packet({type:a.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},e):e})}onerror(e){this.connected||this.emitReserved("connect_error",e)}onclose(e,t){this.connected=!1,delete this.id,this.emitReserved("disconnect",e,t),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(e=>{if(!this.sendBuffer.some(s=>String(s.id)===e)){const s=this.acks[e];delete this.acks[e],s.withError&&s.call(this,new Error("socket has been disconnected"))}})}onpacket(e){if(e.nsp===this.nsp)switch(e.type){case a.CONNECT:e.data&&e.data.sid?this.onconnect(e.data.sid,e.data.pid):this.emitReserved("connect_error",new Error("It seems you are trying to reach a Socket.IO server in v2.x with a v3.x client, but they are not compatible (more information here: https://socket.io/docs/v3/migrating-from-2-x-to-3-0/)"));break;case a.EVENT:case a.BINARY_EVENT:this.onevent(e);break;case a.ACK:case a.BINARY_ACK:this.onack(e);break;case a.DISCONNECT:this.ondisconnect();break;case a.CONNECT_ERROR:this.destroy();const s=new Error(e.data.message);s.data=e.data.data,this.emitReserved("connect_error",s);break}}onevent(e){const t=e.data||[];e.id!=null&&t.push(this.ack(e.id)),this.connected?this.emitEvent(t):this.receiveBuffer.push(Object.freeze(t))}emitEvent(e){if(this._anyListeners&&this._anyListeners.length){const t=this._anyListeners.slice();for(const s of t)s.apply(this,e)}super.emit.apply(this,e),this._pid&&e.length&&typeof e[e.length-1]=="string"&&(this._lastOffset=e[e.length-1])}ack(e){const t=this;let s=!1;return function(...i){s||(s=!0,t.packet({type:a.ACK,id:e,data:i}))}}onack(e){const t=this.acks[e.id];typeof t=="function"&&(delete this.acks[e.id],t.withError&&e.data.unshift(null),t.apply(this,e.data))}onconnect(e,t){this.id=e,this.recovered=t&&this._pid===t,this._pid=t,this.connected=!0,this.emitBuffered(),this._drainQueue(!0),this.emitReserved("connect")}emitBuffered(){this.receiveBuffer.forEach(e=>this.emitEvent(e)),this.receiveBuffer=[],this.sendBuffer.forEach(e=>{this.notifyOutgoingListeners(e),this.packet(e)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(e=>e()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:a.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(e){return this.flags.compress=e,this}get volatile(){return this.flags.volatile=!0,this}timeout(e){return this.flags.timeout=e,this}onAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(e),this}prependAny(e){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(e),this}offAny(e){if(!this._anyListeners)return this;if(e){const t=this._anyListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(e),this}prependAnyOutgoing(e){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(e),this}offAnyOutgoing(e){if(!this._anyOutgoingListeners)return this;if(e){const t=this._anyOutgoingListeners;for(let s=0;s<t.length;s++)if(e===t[s])return t.splice(s,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(e){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const t=this._anyOutgoingListeners.slice();for(const s of t)s.apply(this,e.data)}}}function b(n){n=n||{},this.ms=n.min||100,this.max=n.max||1e4,this.factor=n.factor||2,this.jitter=n.jitter>0&&n.jitter<=1?n.jitter:0,this.attempts=0}b.prototype.duration=function(){var n=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var e=Math.random(),t=Math.floor(e*this.jitter*n);n=(Math.floor(e*10)&1)==0?n-t:n+t}return Math.min(n,this.max)|0};b.prototype.reset=function(){this.attempts=0};b.prototype.setMin=function(n){this.ms=n};b.prototype.setMax=function(n){this.max=n};b.prototype.setJitter=function(n){this.jitter=n};class H extends u{constructor(e,t){var s;super(),this.nsps={},this.subs=[],e&&typeof e=="object"&&(t=e,e=void 0),t=t||{},t.path=t.path||"/socket.io",this.opts=t,N(this,t),this.reconnection(t.reconnection!==!1),this.reconnectionAttempts(t.reconnectionAttempts||1/0),this.reconnectionDelay(t.reconnectionDelay||1e3),this.reconnectionDelayMax(t.reconnectionDelayMax||5e3),this.randomizationFactor((s=t.randomizationFactor)!==null&&s!==void 0?s:.5),this.backoff=new b({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(t.timeout==null?2e4:t.timeout),this._readyState="closed",this.uri=e;const i=t.parser||wt;this.encoder=new i.Encoder,this.decoder=new i.Decoder,this._autoConnect=t.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(e){return arguments.length?(this._reconnection=!!e,e||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(e){return e===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=e,this)}reconnectionDelay(e){var t;return e===void 0?this._reconnectionDelay:(this._reconnectionDelay=e,(t=this.backoff)===null||t===void 0||t.setMin(e),this)}randomizationFactor(e){var t;return e===void 0?this._randomizationFactor:(this._randomizationFactor=e,(t=this.backoff)===null||t===void 0||t.setJitter(e),this)}reconnectionDelayMax(e){var t;return e===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=e,(t=this.backoff)===null||t===void 0||t.setMax(e),this)}timeout(e){return arguments.length?(this._timeout=e,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(e){if(~this._readyState.indexOf("open"))return this;this.engine=new it(this.uri,this.opts);const t=this.engine,s=this;this._readyState="opening",this.skipReconnect=!1;const i=p(t,"open",function(){s.onopen(),e&&e()}),r=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),e?e(c):this.maybeReconnectOnOpen()},o=p(t,"error",r);if(this._timeout!==!1){const c=this._timeout,h=this.setTimeoutFn(()=>{i(),r(new Error("timeout")),t.close()},c);this.opts.autoUnref&&h.unref(),this.subs.push(()=>{this.clearTimeoutFn(h)})}return this.subs.push(i),this.subs.push(o),this}connect(e){return this.open(e)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const e=this.engine;this.subs.push(p(e,"ping",this.onping.bind(this)),p(e,"data",this.ondata.bind(this)),p(e,"error",this.onerror.bind(this)),p(e,"close",this.onclose.bind(this)),p(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(e){try{this.decoder.add(e)}catch(t){this.onclose("parse error",t)}}ondecoded(e){S(()=>{this.emitReserved("packet",e)},this.setTimeoutFn)}onerror(e){this.emitReserved("error",e)}socket(e,t){let s=this.nsps[e];return s?this._autoConnect&&!s.active&&s.connect():(s=new ge(this,e,t),this.nsps[e]=s),s}_destroy(e){const t=Object.keys(this.nsps);for(const s of t)if(this.nsps[s].active)return;this._close()}_packet(e){const t=this.encoder.encode(e);for(let s=0;s<t.length;s++)this.engine.write(t[s],e.options)}cleanup(){this.subs.forEach(e=>e()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(e,t){var s;this.cleanup(),(s=this.engine)===null||s===void 0||s.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",e,t),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const e=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const t=this.backoff.duration();this._reconnecting=!0;const s=this.setTimeoutFn(()=>{e.skipReconnect||(this.emitReserved("reconnect_attempt",e.backoff.attempts),!e.skipReconnect&&e.open(i=>{i?(e._reconnecting=!1,e.reconnect(),this.emitReserved("reconnect_error",i)):e.onreconnect()}))},t);this.opts.autoUnref&&s.unref(),this.subs.push(()=>{this.clearTimeoutFn(s)})}}onreconnect(){const e=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",e)}}const v={};function D(n,e){typeof n=="object"&&(e=n,n=void 0),e=e||{};const t=rt(n,e.path||"/socket.io"),s=t.source,i=t.id,r=t.path,o=v[i]&&r in v[i].nsps,c=e.forceNew||e["force new connection"]||e.multiplex===!1||o;let h;return c?h=new H(s,e):(v[i]||(v[i]=new H(s,e)),h=v[i]),t.query&&!e.query&&(e.query=t.queryKey),h.socket(t.path,e)}Object.assign(D,{Manager:H,Socket:ge,io:D,connect:D});const ee="[claude-devtools]";function Ot(n){const e=window.location.hash.includes("debug=true"),t=n?`${ee} [${n}]`:ee;function s(i,...r){e&&(r.length>0?console.log(`${t} ${i}`,...r):console.log(`${t} ${i}`))}return{log:s}}function Ct(){const e=ke().public?.claudeDevtoolsBc?.tunnel;return{isActive:x(()=>!!e),origin:x(()=>e?.origin??null),host:x(()=>e?.host??null),config:e??null}}export{se as _,Ot as a,At as b,Tt as c,D as l,Ct as u};
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import{_ as W}from"./bl5iU4Kz.js";import{u as Y,a as J,l as Q,b as X,c as Z,_ as ee}from"./BiBLVxWh.js";import{_ as te}from"./DBIw6BGF.js";import{_ as ne}from"./CLKqRoht.js";import{_ as le}from"./CSlPuO5s.js";import{g as oe,r as p,j as se,k as ae,c as r,a as t,b as o,w as d,d as a,l as x,F as _,p as ie,m as H,E as L,x as F,t as b,s as M,o as i,n as I,y as ue}from"./nKfsBgPE.js";const re={class:"relative flex flex-col h-screen n-bg-base"},de={class:"flex items-center justify-between p-4"},ce={class:"flex items-center gap-3"},me={class:"text-xl font-bold flex items-center gap-2"},ve={class:"flex items-center gap-2"},pe={class:"flex-1 overflow-auto p-4"},fe={class:"flex gap-4 h-full"},be={class:"w-64 flex-shrink-0 space-y-4"},ge={key:0,class:"n-bg-active rounded-lg p-4 opacity-50 text-sm"},ke={class:"space-y-1"},xe=["onClick"],_e={class:"flex items-center justify-between"},we={class:"flex items-center gap-2 truncate"},ye={class:"font-medium"},Ce={key:0,class:"text-xs opacity-50 pl-6 truncate"},Se={class:"flex-1 flex flex-col n-bg-active rounded-lg overflow-hidden"},Ve={class:"flex-1 overflow-auto"},He={class:"p-4 border-b border-neutral-200 dark:border-neutral-800"},Ne={key:0,class:"mb-4"},Ue={class:"space-y-4"},De={class:"p-4"},Me={class:"p-4 border-t border-neutral-200 dark:border-neutral-800 flex gap-2 flex-shrink-0"},Ae={class:"p-4 border-b border-neutral-200 dark:border-neutral-800 flex items-center justify-between"},Be={class:"font-bold flex items-center gap-2"},Ee={key:0,class:"text-sm opacity-70"},$e={class:"flex gap-2"},Le={key:0,class:"px-4 pt-4"},Fe={class:"flex-1 p-4 overflow-auto"},Ie={class:"space-y-4 mb-4"},Te={class:"flex flex-wrap gap-2 mb-4"},je={class:"text-xs opacity-50 mb-4"},qe={key:2,class:"flex-1 flex items-center justify-center opacity-50"},he={class:"text-center"},Ye=oe({__name:"skills",setup(ze){const N=Y(),{log:C}=J("skills"),u=p(null),S=p(!1),w=p(!1),U=p([]),n=p(null),g=p(!1),V=p(!1),c=p({name:"",description:"",content:"",argumentHint:"",model:""}),m=p({name:"",description:"",content:"",argumentHint:"",model:""}),v=p("");function T(){return N.isActive.value&&N.origin.value?N.origin.value:window.location.origin}function j(){const s=T();C("Connecting to socket at",s),u.value=Q(s,{path:"/__claude_devtools_socket",transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5}),u.value.on("connect",()=>{C("Connected"),S.value=!0,A()}),u.value.on("disconnect",()=>{C("Disconnected"),S.value=!1}),u.value.on("skills:list",e=>{C("Skills list received",e),U.value=e,w.value=!1}),u.value.on("skills:saved",e=>{e.success&&e.skill?(n.value=e.skill,g.value=!1,V.value=!1,B(),v.value=""):v.value=e.error||"Failed to save skill"}),u.value.on("skills:deleted",e=>{e.success&&n.value?.name===e.name&&(n.value=null)})}function A(){u.value&&(w.value=!0,u.value.emit("skills:list"))}function B(){c.value={name:"",description:"",content:"",argumentHint:"",model:""},v.value=""}function q(s){n.value=s,m.value={name:s.name,description:s.description,content:s.content,argumentHint:s.argumentHint||"",model:s.model||""},g.value=!1}function h(){n.value&&(m.value={name:n.value.name,description:n.value.description,content:n.value.content,argumentHint:n.value.argumentHint||"",model:n.value.model||""},g.value=!0)}function E(){const s=g.value?m.value:c.value;if(!s.name){v.value="Name is required";return}if(!s.description){v.value="Description is required";return}if(!s.content){v.value="Content is required";return}u.value&&u.value.emit("skills:save",{name:s.name,description:s.description,content:s.content,argumentHint:s.argumentHint||void 0,model:s.model||void 0})}function z(){n.value&&(m.value={name:n.value.name,description:n.value.description,content:n.value.content,argumentHint:n.value.argumentHint||"",model:n.value.model||""}),g.value=!1,v.value=""}function O(s){return new Date(s).toLocaleDateString()}function G(s){confirm(`Delete skill "${s}"?`)&&u.value&&u.value.emit("skills:delete",s)}return se(()=>{j()}),ae(()=>{u.value&&u.value.disconnect()}),(s,e)=>{const K=W,f=ee,k=X,D=Z,y=te,$=ne,P=le;return i(),r("div",re,[t("div",de,[t("div",ce,[o(K,{class:"text-sm opacity-50 hover:opacity-100",to:"/"},{default:d(()=>[...e[11]||(e[11]=[a(" ← Chat ",-1)])]),_:1}),t("h1",me,[o(f,{class:"text-orange",icon:"carbon:lightning"}),e[12]||(e[12]=a(" Skills ",-1))])]),t("div",ve,[o(k,{disabled:!S.value,n:"orange",onClick:e[0]||(e[0]=l=>{V.value=!0,n.value=null})},{default:d(()=>[o(f,{class:"mr-1",icon:"carbon:add"}),e[13]||(e[13]=a(" New Skill ",-1))]),_:1},8,["disabled"]),o(k,{disabled:!S.value||w.value,n:"gray",onClick:A},{default:d(()=>[o(f,{class:I([{"animate-spin":w.value},"mr-1"]),icon:"carbon:restart"},null,8,["class"]),e[14]||(e[14]=a(" Refresh ",-1))]),_:1},8,["disabled"])])]),t("div",pe,[t("div",fe,[t("div",be,[o(D,{class:"text-xs",icon:"carbon:information",n:"orange"},{default:d(()=>[...e[15]||(e[15]=[a(" Skills extend Claude's capabilities with custom knowledge. ",-1),t("br",null,null,-1),a(" Stored as ",-1),t("code",{class:"font-mono"},".claude/skills/<name>/SKILL.md",-1)])]),_:1}),U.value.length===0&&!w.value?(i(),r("div",ge,[...e[16]||(e[16]=[a(" No skills configured yet. ",-1),t("br",null,null,-1),a(" Create one to get started. ",-1)])])):x("",!0),t("div",ke,[(i(!0),r(_,null,ie(U.value,l=>(i(),r("div",{key:l.name,class:I([n.value?.name===l.name?"n-bg-active ring-1 ring-orange-500":"hover:n-bg-active","rounded-lg p-2 cursor-pointer group"]),onClick:R=>q(l)},[t("div",_e,[t("div",we,[o(f,{class:"opacity-50 text-orange-500",icon:"carbon:lightning"}),t("span",ye,b(l.name),1)]),o(k,{class:"opacity-0 group-hover:opacity-100",n:"red xs",onClick:ue(R=>G(l.name),["stop"])},{default:d(()=>[o(f,{icon:"carbon:trash-can"})]),_:1},8,["onClick"])]),l.description?(i(),r("div",Ce,b(l.description),1)):x("",!0)],10,xe))),128))])]),t("div",Se,[V.value?(i(),r(_,{key:0},[t("div",Ve,[t("div",He,[e[23]||(e[23]=t("h3",{class:"font-bold mb-4"}," Create New Skill ",-1)),v.value?(i(),r("div",Ne,[o(D,{icon:"carbon:warning",n:"red"},{default:d(()=>[a(b(v.value),1)]),_:1})])):x("",!0),t("div",Ue,[t("div",null,[e[17]||(e[17]=t("label",{class:"block text-sm font-medium mb-1"},"Name",-1)),o(y,{modelValue:c.value.name,"onUpdate:modelValue":e[1]||(e[1]=l=>c.value.name=l),class:"w-full font-mono",placeholder:"e.g. vue-expert, code-reviewer"},null,8,["modelValue"])]),t("div",null,[e[18]||(e[18]=t("label",{class:"block text-sm font-medium mb-1"},"Description",-1)),o(y,{modelValue:c.value.description,"onUpdate:modelValue":e[2]||(e[2]=l=>c.value.description=l),class:"w-full",placeholder:"Brief description of what this skill does"},null,8,["modelValue"])]),t("div",null,[e[19]||(e[19]=t("label",{class:"block text-sm font-medium mb-1"},"Argument Hint (optional)",-1)),o(y,{modelValue:c.value.argumentHint,"onUpdate:modelValue":e[3]||(e[3]=l=>c.value.argumentHint=l),class:"w-full",placeholder:"e.g. <query>"},null,8,["modelValue"]),e[20]||(e[20]=t("div",{class:"text-xs opacity-50 mt-1"}," Hint for argument when using /skillname ",-1))]),t("div",null,[e[22]||(e[22]=t("label",{class:"block text-sm font-medium mb-1"},"Model (optional)",-1)),H(t("select",{"onUpdate:modelValue":e[4]||(e[4]=l=>c.value.model=l),class:"w-full p-2 n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800"},[...e[21]||(e[21]=[t("option",{value:""}," Inherit (default) ",-1),t("option",{value:"sonnet"}," Sonnet ",-1),t("option",{value:"opus"}," Opus ",-1),t("option",{value:"haiku"}," Haiku ",-1)])],512),[[L,c.value.model]])])])]),t("div",De,[e[24]||(e[24]=t("label",{class:"block text-sm font-medium mb-1"},"Content (Markdown)",-1)),H(t("textarea",{"onUpdate:modelValue":e[5]||(e[5]=l=>c.value.content=l),class:"w-full min-h-[200px] p-3 font-mono text-sm n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800 resize-y",placeholder:`Write the skill instructions in markdown...
|
|
2
|
-
|
|
3
|
-
Example:
|
|
4
|
-
You are an expert in Vue 3 Composition API.
|
|
5
|
-
|
|
6
|
-
## Guidelines
|
|
7
|
-
- Always use <script setup>
|
|
8
|
-
- Follow TypeScript best practices`},null,512),[[F,c.value.content]])])]),t("div",Me,[o(k,{n:"orange",onClick:E},{default:d(()=>[...e[25]||(e[25]=[a(" Create Skill ",-1)])]),_:1}),o(k,{n:"gray",onClick:e[6]||(e[6]=l=>{V.value=!1,B()})},{default:d(()=>[...e[26]||(e[26]=[a(" Cancel ",-1)])]),_:1})])],64)):n.value?(i(),r(_,{key:1},[t("div",Ae,[t("div",null,[t("h3",Be,[o(f,{class:"text-orange-500",icon:"carbon:lightning"}),a(" "+b(n.value.name),1)]),n.value.description?(i(),r("div",Ee,b(n.value.description),1)):x("",!0)]),t("div",$e,[g.value?(i(),r(_,{key:0},[o(k,{n:"green",onClick:E},{default:d(()=>[o(f,{class:"mr-1",icon:"carbon:save"}),e[27]||(e[27]=a(" Save ",-1))]),_:1}),o(k,{n:"gray",onClick:z},{default:d(()=>[...e[28]||(e[28]=[a(" Cancel ",-1)])]),_:1})],64)):(i(),M(k,{key:1,n:"blue",onClick:h},{default:d(()=>[o(f,{class:"mr-1",icon:"carbon:edit"}),e[29]||(e[29]=a(" Edit ",-1))]),_:1}))])]),v.value&&g.value?(i(),r("div",Le,[o(D,{icon:"carbon:warning",n:"red"},{default:d(()=>[a(b(v.value),1)]),_:1})])):x("",!0),t("div",Fe,[g.value?(i(),r(_,{key:0},[t("div",Ie,[t("div",null,[e[30]||(e[30]=t("label",{class:"block text-sm font-medium mb-1"},"Description",-1)),o(y,{modelValue:m.value.description,"onUpdate:modelValue":e[7]||(e[7]=l=>m.value.description=l),class:"w-full",placeholder:"Brief description"},null,8,["modelValue"])]),t("div",null,[e[31]||(e[31]=t("label",{class:"block text-sm font-medium mb-1"},"Argument Hint",-1)),o(y,{modelValue:m.value.argumentHint,"onUpdate:modelValue":e[8]||(e[8]=l=>m.value.argumentHint=l),class:"w-full",placeholder:"e.g. <query>"},null,8,["modelValue"])]),t("div",null,[e[33]||(e[33]=t("label",{class:"block text-sm font-medium mb-1"},"Model",-1)),H(t("select",{"onUpdate:modelValue":e[9]||(e[9]=l=>m.value.model=l),class:"w-full p-2 n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800"},[...e[32]||(e[32]=[t("option",{value:""}," Inherit (default) ",-1),t("option",{value:"sonnet"}," Sonnet ",-1),t("option",{value:"opus"}," Opus ",-1),t("option",{value:"haiku"}," Haiku ",-1)])],512),[[L,m.value.model]])])]),e[34]||(e[34]=t("label",{class:"block text-sm font-medium mb-1"},"Content (Markdown)",-1)),H(t("textarea",{"onUpdate:modelValue":e[10]||(e[10]=l=>m.value.content=l),class:"w-full h-full min-h-[300px] p-3 font-mono text-sm n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800 resize-none"},null,512),[[F,m.value.content]])],64)):(i(),r(_,{key:1},[t("div",Te,[n.value.model?(i(),M($,{key:0,n:"blue"},{default:d(()=>[a(" Model: "+b(n.value.model),1)]),_:1})):x("",!0),n.value.argumentHint?(i(),M($,{key:1,n:"gray"},{default:d(()=>[a(" Arg: "+b(n.value.argumentHint),1)]),_:1})):x("",!0)]),t("div",je," Updated: "+b(O(n.value.updatedAt)),1),o(P,{content:n.value.content,class:"max-w-none"},null,8,["content"])],64))])],64)):(i(),r("div",qe,[t("div",he,[o(f,{class:"text-4xl mb-2",icon:"carbon:lightning"}),e[35]||(e[35]=t("p",null,"Select a skill or create a new one",-1))])]))])])])])}}});export{Ye as default};
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import{_ as J}from"./bl5iU4Kz.js";import{u as K,a as O,l as Q,b as X,c as Z,_ as ee}from"./BiBLVxWh.js";import{_ as oe}from"./DBIw6BGF.js";import{_ as le}from"./CLKqRoht.js";import{_ as ne}from"./CSlPuO5s.js";import{g as te,r as f,j as se,k as ae,c as i,a as o,b as t,w as u,d,l as w,F as g,p as j,t as p,m as $,x as A,s as L,o as a,n as F,y as ie}from"./nKfsBgPE.js";const de={class:"relative flex flex-col h-screen n-bg-base"},re={class:"flex items-center justify-between p-4"},ue={class:"flex items-center gap-3"},me={class:"text-xl font-bold flex items-center gap-2"},ce={class:"flex items-center gap-2"},ve={class:"flex-1 overflow-auto p-4"},fe={class:"flex gap-4 h-full"},pe={class:"w-64 flex-shrink-0 space-y-4"},be={key:0,class:"n-bg-active rounded-lg p-4 opacity-50 text-sm"},xe={class:"space-y-1"},_e=["onClick"],ge={class:"flex items-center justify-between"},we={class:"flex items-center gap-2 truncate"},ke={class:"font-mono"},ye={key:0,class:"text-xs opacity-50 pl-6 truncate"},Ce={class:"flex-1 flex flex-col n-bg-active rounded-lg overflow-hidden"},Te={class:"flex-1 overflow-auto"},Ve={class:"p-4 border-b border-neutral-200 dark:border-neutral-800"},he={key:0,class:"mb-4"},Ne={class:"space-y-4"},Be={class:"text-xs opacity-50 mt-1"},Se={class:"p-4"},Ue={class:"p-4 border-t border-neutral-200 dark:border-neutral-800 flex gap-2 flex-shrink-0"},De={class:"p-4 border-b border-neutral-200 dark:border-neutral-800 flex items-center justify-between"},Ee={class:"font-bold font-mono"},je={key:0,class:"text-sm opacity-70"},$e={class:"text-xs opacity-50 mt-1"},Ae={class:"flex gap-2"},Le={key:0,class:"px-4 pt-4"},Fe={class:"flex-1 p-4 overflow-auto"},Me={class:"space-y-4 mb-4"},Pe={key:0,class:"mb-4"},Re={class:"flex flex-wrap gap-1"},qe={key:2,class:"flex-1 flex items-center justify-center opacity-50"},ze={class:"text-center"},Oe=te({__name:"commands",setup(Ie){const N=K(),{log:T}=O("commands"),r=f(null),V=f(!1),k=f(!1),B=f([]),n=f(null),b=f(!1),h=f(!1),m=f({name:"",description:"",content:"",allowedTools:""}),c=f({name:"",description:"",content:"",allowedTools:""}),v=f("");function M(){return N.isActive.value&&N.origin.value?N.origin.value:window.location.origin}function P(){const s=M();T("Connecting to socket at",s),r.value=Q(s,{path:"/__claude_devtools_socket",transports:["websocket","polling"],reconnection:!0,reconnectionAttempts:5}),r.value.on("connect",()=>{T("Connected"),V.value=!0,U()}),r.value.on("disconnect",()=>{T("Disconnected"),V.value=!1}),r.value.on("commands:list",e=>{T("Commands list received",e),B.value=e,k.value=!1}),r.value.on("commands:saved",e=>{e.success&&e.command?(n.value=e.command,b.value=!1,h.value=!1,D(),v.value=""):v.value=e.error||"Failed to save command"}),r.value.on("commands:deleted",e=>{e.success&&n.value?.name===e.name&&(n.value=null)})}function U(){r.value&&(k.value=!0,r.value.emit("commands:list"))}function D(){m.value={name:"",description:"",content:"",allowedTools:""},v.value=""}function R(s){n.value=s,c.value={name:s.name,description:s.description||"",content:s.content,allowedTools:s.allowedTools?.join(", ")||""},b.value=!1}function q(){n.value&&(c.value={name:n.value.name,description:n.value.description||"",content:n.value.content,allowedTools:n.value.allowedTools?.join(", ")||""},b.value=!0)}function E(){const s=b.value?c.value:m.value;if(!s.name){v.value="Name is required";return}if(!s.content){v.value="Content is required";return}if(r.value){const e=s.allowedTools.split(",").map(y=>y.trim()).filter(y=>y.length>0);r.value.emit("commands:save",{name:s.name,content:s.content,description:s.description||void 0,allowedTools:e.length>0?e:void 0})}}function z(){n.value&&(c.value={name:n.value.name,description:n.value.description||"",content:n.value.content,allowedTools:n.value.allowedTools?.join(", ")||""}),b.value=!1,v.value=""}function I(s){confirm(`Delete command "/${s}"?`)&&r.value&&r.value.emit("commands:delete",s)}function W(s){return new Date(s).toLocaleDateString()}return se(()=>{P()}),ae(()=>{r.value&&r.value.disconnect()}),(s,e)=>{const y=J,x=ee,_=X,S=Z,C=oe,Y=le,G=ne;return a(),i("div",de,[o("div",re,[o("div",ue,[t(y,{class:"text-sm opacity-50 hover:opacity-100",to:"/"},{default:u(()=>[...e[9]||(e[9]=[d(" ← Chat ",-1)])]),_:1}),o("h1",me,[t(x,{class:"text-green",icon:"carbon:terminal"}),e[10]||(e[10]=d(" Slash Commands ",-1))])]),o("div",ce,[t(_,{disabled:!V.value,n:"green",onClick:e[0]||(e[0]=l=>{h.value=!0,n.value=null})},{default:u(()=>[t(x,{class:"mr-1",icon:"carbon:add"}),e[11]||(e[11]=d(" New Command ",-1))]),_:1},8,["disabled"]),t(_,{disabled:!V.value||k.value,n:"gray",onClick:U},{default:u(()=>[t(x,{class:F([{"animate-spin":k.value},"mr-1"]),icon:"carbon:restart"},null,8,["class"]),e[12]||(e[12]=d(" Refresh ",-1))]),_:1},8,["disabled"])])]),o("div",ve,[o("div",fe,[o("div",pe,[t(S,{class:"text-xs",icon:"carbon:information",n:"green"},{default:u(()=>[...e[13]||(e[13]=[d(" Slash commands are markdown files with YAML frontmatter. ",-1),o("br",null,null,-1),d(" Stored as ",-1),o("code",{class:"font-mono"},".claude/commands/<name>.md",-1)])]),_:1}),B.value.length===0&&!k.value?(a(),i("div",be,[...e[14]||(e[14]=[d(" No slash commands yet. ",-1),o("br",null,null,-1),d(" Create one to get started. ",-1)])])):w("",!0),o("div",xe,[(a(!0),i(g,null,j(B.value,l=>(a(),i("div",{key:l.name,class:F([n.value?.name===l.name?"n-bg-active ring-1 ring-green-500":"hover:n-bg-active","rounded-lg p-2 cursor-pointer group"]),onClick:H=>R(l)},[o("div",ge,[o("div",we,[t(x,{class:"opacity-50 text-green-500",icon:"carbon:terminal"}),o("span",ke,"/"+p(l.name),1)]),t(_,{class:"opacity-0 group-hover:opacity-100",n:"red xs",onClick:ie(H=>I(l.name),["stop"])},{default:u(()=>[t(x,{icon:"carbon:trash-can"})]),_:1},8,["onClick"])]),l.description?(a(),i("div",ye,p(l.description),1)):w("",!0)],10,_e))),128))])]),o("div",Ce,[h.value?(a(),i(g,{key:0},[o("div",Te,[o("div",Ve,[e[19]||(e[19]=o("h3",{class:"font-bold mb-4"}," Create New Slash Command ",-1)),v.value?(a(),i("div",he,[t(S,{icon:"carbon:warning",n:"red"},{default:u(()=>[d(p(v.value),1)]),_:1})])):w("",!0),o("div",Ne,[o("div",null,[e[15]||(e[15]=o("label",{class:"block text-sm font-medium mb-1"},"Command Name",-1)),t(C,{modelValue:m.value.name,"onUpdate:modelValue":e[1]||(e[1]=l=>m.value.name=l),class:"w-full font-mono",placeholder:"e.g. review, deploy, test"},null,8,["modelValue"]),o("div",Be," Will be invoked as /"+p(m.value.name||"command-name"),1)]),o("div",null,[e[16]||(e[16]=o("label",{class:"block text-sm font-medium mb-1"},"Description (optional)",-1)),t(C,{modelValue:m.value.description,"onUpdate:modelValue":e[2]||(e[2]=l=>m.value.description=l),class:"w-full",placeholder:"Brief description of what this command does"},null,8,["modelValue"])]),o("div",null,[e[17]||(e[17]=o("label",{class:"block text-sm font-medium mb-1"},"Allowed Tools (optional)",-1)),t(C,{modelValue:m.value.allowedTools,"onUpdate:modelValue":e[3]||(e[3]=l=>m.value.allowedTools=l),class:"w-full font-mono",placeholder:"e.g. Bash(git:*), Read, Edit"},null,8,["modelValue"]),e[18]||(e[18]=o("div",{class:"text-xs opacity-50 mt-1"}," Comma-separated list of allowed tools ",-1))])])]),o("div",Se,[e[20]||(e[20]=o("label",{class:"block text-sm font-medium mb-1"},"Command Prompt",-1)),$(o("textarea",{"onUpdate:modelValue":e[4]||(e[4]=l=>m.value.content=l),class:"w-full min-h-[200px] p-3 font-mono text-sm n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800 resize-y",placeholder:`Write the prompt for this command...
|
|
2
|
-
|
|
3
|
-
Example:
|
|
4
|
-
Review the current code changes and provide feedback on:
|
|
5
|
-
1. Code quality
|
|
6
|
-
2. Potential bugs
|
|
7
|
-
3. Performance issues`},null,512),[[A,m.value.content]])])]),o("div",Ue,[t(_,{n:"green",onClick:E},{default:u(()=>[...e[21]||(e[21]=[d(" Create Command ",-1)])]),_:1}),t(_,{n:"gray",onClick:e[5]||(e[5]=l=>{h.value=!1,D()})},{default:u(()=>[...e[22]||(e[22]=[d(" Cancel ",-1)])]),_:1})])],64)):n.value?(a(),i(g,{key:1},[o("div",De,[o("div",null,[o("h3",Ee," /"+p(n.value.name),1),n.value.description?(a(),i("div",je,p(n.value.description),1)):w("",!0),o("div",$e," Updated: "+p(W(n.value.updatedAt)),1)]),o("div",Ae,[b.value?(a(),i(g,{key:0},[t(_,{n:"green",onClick:E},{default:u(()=>[t(x,{class:"mr-1",icon:"carbon:save"}),e[23]||(e[23]=d(" Save ",-1))]),_:1}),t(_,{n:"gray",onClick:z},{default:u(()=>[...e[24]||(e[24]=[d(" Cancel ",-1)])]),_:1})],64)):(a(),L(_,{key:1,n:"blue",onClick:q},{default:u(()=>[t(x,{class:"mr-1",icon:"carbon:edit"}),e[25]||(e[25]=d(" Edit ",-1))]),_:1}))])]),v.value&&b.value?(a(),i("div",Le,[t(S,{icon:"carbon:warning",n:"red"},{default:u(()=>[d(p(v.value),1)]),_:1})])):w("",!0),o("div",Fe,[b.value?(a(),i(g,{key:0},[o("div",Me,[o("div",null,[e[26]||(e[26]=o("label",{class:"block text-sm font-medium mb-1"},"Description",-1)),t(C,{modelValue:c.value.description,"onUpdate:modelValue":e[6]||(e[6]=l=>c.value.description=l),class:"w-full",placeholder:"Brief description"},null,8,["modelValue"])]),o("div",null,[e[27]||(e[27]=o("label",{class:"block text-sm font-medium mb-1"},"Allowed Tools",-1)),t(C,{modelValue:c.value.allowedTools,"onUpdate:modelValue":e[7]||(e[7]=l=>c.value.allowedTools=l),class:"w-full font-mono",placeholder:"e.g. Bash(git:*), Read, Edit"},null,8,["modelValue"])])]),e[28]||(e[28]=o("label",{class:"block text-sm font-medium mb-1"},"Command Prompt",-1)),$(o("textarea",{"onUpdate:modelValue":e[8]||(e[8]=l=>c.value.content=l),class:"w-full h-full min-h-[300px] p-3 font-mono text-sm n-bg-base rounded-lg border border-neutral-200 dark:border-neutral-800 resize-none"},null,512),[[A,c.value.content]])],64)):(a(),i(g,{key:1},[n.value.allowedTools&&n.value.allowedTools.length>0?(a(),i("div",Pe,[e[29]||(e[29]=o("div",{class:"text-xs font-medium opacity-50 mb-1"}," Allowed Tools ",-1)),o("div",Re,[(a(!0),i(g,null,j(n.value.allowedTools,l=>(a(),L(Y,{key:l,class:"font-mono text-xs",n:"blue"},{default:u(()=>[d(p(l),1)]),_:2},1024))),128))])])):w("",!0),t(G,{content:n.value.content,class:"max-w-none"},null,8,["content"])],64))])],64)):(a(),i("div",qe,[o("div",ze,[t(x,{class:"text-4xl mb-2",icon:"carbon:terminal"}),e[30]||(e[30]=o("p",null,"Select a command or create a new one",-1))])]))])])])])}}});export{Oe as default};
|