@cremini/skillpack 1.1.9 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +508 -180
- package/dist/runtime/registry.js +244 -0
- package/package.json +2 -2
- package/web/index.html +29 -62
- package/web/js/api-key-dialog.js +189 -36
- package/web/js/chat-apps-dialog.js +4 -10
- package/web/js/main.js +0 -2
- package/web/styles.css +65 -27
- package/web/js/settings.js +0 -205
|
@@ -101,14 +101,11 @@ function populateForm() {
|
|
|
101
101
|
|
|
102
102
|
// Restart required status
|
|
103
103
|
if (state.restartRequired) {
|
|
104
|
-
const canRestart = config.runtimeControl?.canManagedRestart;
|
|
105
104
|
setStatus(
|
|
106
|
-
|
|
107
|
-
? "Settings changed. Restart service to apply."
|
|
108
|
-
: "Settings changed. Restart the service manually to apply.",
|
|
105
|
+
"Settings changed. Restart service to apply.",
|
|
109
106
|
"warning",
|
|
110
107
|
);
|
|
111
|
-
updateRestartButton(
|
|
108
|
+
updateRestartButton(true);
|
|
112
109
|
} else {
|
|
113
110
|
setStatus("", "");
|
|
114
111
|
updateRestartButton(false);
|
|
@@ -139,17 +136,14 @@ async function handleSave() {
|
|
|
139
136
|
const res = await saveConfigData(updates);
|
|
140
137
|
|
|
141
138
|
state.config.adapters = res.adapters;
|
|
142
|
-
state.config.runtimeControl = res.runtimeControl;
|
|
143
139
|
state.restartRequired = !!res.requiresRestart;
|
|
144
140
|
|
|
145
141
|
if (res.requiresRestart) {
|
|
146
142
|
setStatus(
|
|
147
|
-
|
|
148
|
-
? "Settings saved. Restart service to apply changes."
|
|
149
|
-
: "Settings saved. Restart the service manually to apply changes.",
|
|
143
|
+
"Settings saved. Restart service to apply changes.",
|
|
150
144
|
"warning",
|
|
151
145
|
);
|
|
152
|
-
updateRestartButton(
|
|
146
|
+
updateRestartButton(true);
|
|
153
147
|
} else {
|
|
154
148
|
close();
|
|
155
149
|
}
|
package/web/js/main.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { state, loadConfig } from "./config.js";
|
|
2
|
-
import { initSettings } from "./settings.js";
|
|
3
2
|
import { initApiKeyDialog, updateApiKeyButton } from "./api-key-dialog.js";
|
|
4
3
|
import { initChatAppsDialog, updateChatAppsButton } from "./chat-apps-dialog.js";
|
|
5
4
|
import { initChat, showWelcome } from "./chat.js";
|
|
@@ -42,7 +41,6 @@ async function init() {
|
|
|
42
41
|
}
|
|
43
42
|
|
|
44
43
|
// Initialize all dialog modules
|
|
45
|
-
initSettings();
|
|
46
44
|
initApiKeyDialog();
|
|
47
45
|
initChatAppsDialog();
|
|
48
46
|
initChat();
|
package/web/styles.css
CHANGED
|
@@ -72,13 +72,6 @@ body {
|
|
|
72
72
|
line-height: 1.4;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
.sidebar-settings-section {
|
|
76
|
-
padding: 16px 20px;
|
|
77
|
-
border-top: 1px solid var(--border-color);
|
|
78
|
-
background: var(--bg-secondary);
|
|
79
|
-
flex-shrink: 0;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
75
|
.sidebar-skills-section {
|
|
83
76
|
padding: 16px 20px;
|
|
84
77
|
flex: 1;
|
|
@@ -874,26 +867,6 @@ body {
|
|
|
874
867
|
width: 440px;
|
|
875
868
|
}
|
|
876
869
|
|
|
877
|
-
/* ---- Settings Modal ---- */
|
|
878
|
-
.settings-trigger-btn {
|
|
879
|
-
display: flex;
|
|
880
|
-
align-items: center;
|
|
881
|
-
justify-content: center;
|
|
882
|
-
gap: 8px;
|
|
883
|
-
width: 100%;
|
|
884
|
-
padding: 12px;
|
|
885
|
-
background: var(--bg-tertiary);
|
|
886
|
-
border: 1px solid var(--border-color);
|
|
887
|
-
border-radius: var(--radius-sm);
|
|
888
|
-
color: var(--text-primary);
|
|
889
|
-
font-weight: 500;
|
|
890
|
-
cursor: pointer;
|
|
891
|
-
transition: all 0.2s ease;
|
|
892
|
-
}
|
|
893
|
-
.settings-trigger-btn:hover {
|
|
894
|
-
background: #ebebeb;
|
|
895
|
-
}
|
|
896
|
-
|
|
897
870
|
.settings-modal {
|
|
898
871
|
margin: auto;
|
|
899
872
|
padding: 0;
|
|
@@ -1073,3 +1046,68 @@ body {
|
|
|
1073
1046
|
transform: none;
|
|
1074
1047
|
box-shadow: none;
|
|
1075
1048
|
}
|
|
1049
|
+
.label-hint {
|
|
1050
|
+
color: var(--text-secondary);
|
|
1051
|
+
font-size: 11px;
|
|
1052
|
+
font-weight: 400;
|
|
1053
|
+
margin-left: 4px;
|
|
1054
|
+
}
|
|
1055
|
+
|
|
1056
|
+
/* OAuth UI */
|
|
1057
|
+
#apikey-oauth-section {
|
|
1058
|
+
padding: 8px 0;
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
.oauth-status-card {
|
|
1062
|
+
background: var(--bg-tertiary);
|
|
1063
|
+
border: 1px solid var(--border-color);
|
|
1064
|
+
border-radius: var(--radius-sm);
|
|
1065
|
+
padding: 16px;
|
|
1066
|
+
margin-bottom: 16px;
|
|
1067
|
+
}
|
|
1068
|
+
|
|
1069
|
+
#oauth-status-indicator {
|
|
1070
|
+
display: flex;
|
|
1071
|
+
align-items: center;
|
|
1072
|
+
gap: 8px;
|
|
1073
|
+
font-size: 13px;
|
|
1074
|
+
font-weight: 600;
|
|
1075
|
+
margin-bottom: 8px;
|
|
1076
|
+
}
|
|
1077
|
+
|
|
1078
|
+
.oauth-status-dot {
|
|
1079
|
+
width: 8px;
|
|
1080
|
+
height: 8px;
|
|
1081
|
+
border-radius: 50%;
|
|
1082
|
+
}
|
|
1083
|
+
|
|
1084
|
+
.oauth-disconnected .oauth-status-dot {
|
|
1085
|
+
background-color: #94a3b8;
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.oauth-connected .oauth-status-dot {
|
|
1089
|
+
background-color: #22c55e;
|
|
1090
|
+
}
|
|
1091
|
+
|
|
1092
|
+
.oauth-disconnected #oauth-status-text {
|
|
1093
|
+
color: var(--text-secondary);
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
.oauth-connected #oauth-status-text {
|
|
1097
|
+
color: #16a34a;
|
|
1098
|
+
}
|
|
1099
|
+
|
|
1100
|
+
.oauth-hint {
|
|
1101
|
+
font-size: 12px;
|
|
1102
|
+
color: var(--text-muted);
|
|
1103
|
+
line-height: 1.5;
|
|
1104
|
+
}
|
|
1105
|
+
|
|
1106
|
+
.oauth-btn {
|
|
1107
|
+
width: 100%;
|
|
1108
|
+
margin-top: 8px;
|
|
1109
|
+
}
|
|
1110
|
+
|
|
1111
|
+
.oauth-btn svg {
|
|
1112
|
+
margin-right: 8px;
|
|
1113
|
+
}
|
package/web/js/settings.js
DELETED
|
@@ -1,205 +0,0 @@
|
|
|
1
|
-
import { state } from "./config.js";
|
|
2
|
-
import { restartRuntime, saveConfigData } from "./api.js";
|
|
3
|
-
|
|
4
|
-
// DOM Elements
|
|
5
|
-
let dialog;
|
|
6
|
-
let settingsBtn;
|
|
7
|
-
let closeBtn;
|
|
8
|
-
let saveBtn;
|
|
9
|
-
let providerSelect;
|
|
10
|
-
let apiKeyInput;
|
|
11
|
-
let telegramTokenInput;
|
|
12
|
-
let slackBotTokenInput;
|
|
13
|
-
let slackAppTokenInput;
|
|
14
|
-
let keyStatus;
|
|
15
|
-
let restartBtn;
|
|
16
|
-
|
|
17
|
-
export function initSettings() {
|
|
18
|
-
dialog = document.getElementById("settings-dialog");
|
|
19
|
-
settingsBtn = document.getElementById("open-settings-btn");
|
|
20
|
-
closeBtn = document.getElementById("close-settings-btn");
|
|
21
|
-
saveBtn = document.getElementById("save-settings-btn");
|
|
22
|
-
|
|
23
|
-
providerSelect = document.getElementById("provider-select");
|
|
24
|
-
apiKeyInput = document.getElementById("api-key-input");
|
|
25
|
-
telegramTokenInput = document.getElementById("telegram-token-input");
|
|
26
|
-
slackBotTokenInput = document.getElementById("slack-bot-token-input");
|
|
27
|
-
slackAppTokenInput = document.getElementById("slack-app-token-input");
|
|
28
|
-
keyStatus = document.getElementById("key-status");
|
|
29
|
-
restartBtn = document.getElementById("restart-service-btn");
|
|
30
|
-
|
|
31
|
-
if (!dialog) return;
|
|
32
|
-
|
|
33
|
-
// Open/Close dialog
|
|
34
|
-
if (settingsBtn) {
|
|
35
|
-
settingsBtn.addEventListener("click", () => {
|
|
36
|
-
populateForm();
|
|
37
|
-
dialog.showModal();
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
if (closeBtn) {
|
|
42
|
-
closeBtn.addEventListener("click", () => {
|
|
43
|
-
dialog.close();
|
|
44
|
-
keyStatus.textContent = ""; // clear status on close
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
// Save Settings
|
|
49
|
-
if (saveBtn) {
|
|
50
|
-
saveBtn.addEventListener("click", handleSave);
|
|
51
|
-
}
|
|
52
|
-
if (restartBtn) {
|
|
53
|
-
restartBtn.addEventListener("click", handleRestart);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// Placeholder logic
|
|
57
|
-
if (providerSelect) {
|
|
58
|
-
providerSelect.addEventListener("change", updatePlaceholder);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
function updatePlaceholder() {
|
|
63
|
-
const p = providerSelect.value;
|
|
64
|
-
if (p === "openai") apiKeyInput.placeholder = "sk-proj-...";
|
|
65
|
-
else if (p === "anthropic") apiKeyInput.placeholder = "sk-ant-api03-...";
|
|
66
|
-
else apiKeyInput.placeholder = "sk-...";
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function populateForm() {
|
|
70
|
-
const config = state.config;
|
|
71
|
-
if (!config) return;
|
|
72
|
-
|
|
73
|
-
if (state.restartRequired) {
|
|
74
|
-
setStatus(
|
|
75
|
-
config.runtimeControl?.canManagedRestart
|
|
76
|
-
? "Settings saved. Restart service to apply changes."
|
|
77
|
-
: "Settings saved. Restart the service manually to apply changes.",
|
|
78
|
-
"warning",
|
|
79
|
-
);
|
|
80
|
-
updateRestartButton(true);
|
|
81
|
-
} else {
|
|
82
|
-
setStatus("", "");
|
|
83
|
-
updateRestartButton(false);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
if (config.hasApiKey && config.apiKey) {
|
|
87
|
-
apiKeyInput.value = config.apiKey;
|
|
88
|
-
} else if (config.hasApiKey) {
|
|
89
|
-
apiKeyInput.value = "***************************************************";
|
|
90
|
-
} else {
|
|
91
|
-
apiKeyInput.value = "";
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
if (config.provider) {
|
|
95
|
-
providerSelect.value = config.provider;
|
|
96
|
-
}
|
|
97
|
-
updatePlaceholder();
|
|
98
|
-
|
|
99
|
-
const adapters = config.adapters || {};
|
|
100
|
-
if (adapters.telegram && adapters.telegram.token) {
|
|
101
|
-
telegramTokenInput.value = adapters.telegram.token;
|
|
102
|
-
} else {
|
|
103
|
-
telegramTokenInput.value = "";
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
if (adapters.slack) {
|
|
107
|
-
slackBotTokenInput.value = adapters.slack.botToken || "";
|
|
108
|
-
slackAppTokenInput.value = adapters.slack.appToken || "";
|
|
109
|
-
} else {
|
|
110
|
-
slackBotTokenInput.value = "";
|
|
111
|
-
slackAppTokenInput.value = "";
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
async function handleSave() {
|
|
116
|
-
const key = apiKeyInput.value.trim();
|
|
117
|
-
const provider = providerSelect.value;
|
|
118
|
-
const telegramToken = telegramTokenInput.value.trim();
|
|
119
|
-
const slackBotToken = slackBotTokenInput.value.trim();
|
|
120
|
-
const slackAppToken = slackAppTokenInput.value.trim();
|
|
121
|
-
|
|
122
|
-
const adapters = {};
|
|
123
|
-
if (telegramToken) adapters.telegram = { token: telegramToken };
|
|
124
|
-
if (slackBotToken || slackAppToken) {
|
|
125
|
-
adapters.slack = {
|
|
126
|
-
botToken: slackBotToken || undefined,
|
|
127
|
-
appToken: slackAppToken || undefined
|
|
128
|
-
};
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
const updates = { provider, adapters };
|
|
132
|
-
if (key && key !== "***************************************************" && key !== state.config.apiKey) {
|
|
133
|
-
updates.key = key;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
try {
|
|
137
|
-
const res = await saveConfigData(updates);
|
|
138
|
-
|
|
139
|
-
// Update local config
|
|
140
|
-
state.config.provider = res.provider;
|
|
141
|
-
state.config.adapters = res.adapters;
|
|
142
|
-
state.config.runtimeControl = res.runtimeControl;
|
|
143
|
-
if (updates.key) {
|
|
144
|
-
state.config.hasApiKey = true;
|
|
145
|
-
state.config.apiKey = updates.key;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
if (state.config.hasApiKey && state.config.apiKey) {
|
|
149
|
-
apiKeyInput.value = state.config.apiKey;
|
|
150
|
-
} else if (state.config.hasApiKey) {
|
|
151
|
-
apiKeyInput.value = "***************************************************";
|
|
152
|
-
} else {
|
|
153
|
-
apiKeyInput.value = "";
|
|
154
|
-
}
|
|
155
|
-
state.restartRequired = !!res.requiresRestart;
|
|
156
|
-
|
|
157
|
-
if (res.requiresRestart) {
|
|
158
|
-
setStatus(
|
|
159
|
-
res.runtimeControl.canManagedRestart
|
|
160
|
-
? "Settings saved. Restart service to apply changes."
|
|
161
|
-
: "Settings saved. Restart the service manually to apply changes.",
|
|
162
|
-
"warning",
|
|
163
|
-
);
|
|
164
|
-
updateRestartButton(res.runtimeControl.canManagedRestart);
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
setStatus("Settings saved", "success");
|
|
169
|
-
updateRestartButton(false);
|
|
170
|
-
|
|
171
|
-
} catch (err) {
|
|
172
|
-
setStatus("Save failed: " + err.message, "error");
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
async function handleRestart() {
|
|
177
|
-
if (!restartBtn) return;
|
|
178
|
-
|
|
179
|
-
restartBtn.disabled = true;
|
|
180
|
-
if (saveBtn) saveBtn.disabled = true;
|
|
181
|
-
setStatus("Restarting service...", "warning");
|
|
182
|
-
|
|
183
|
-
try {
|
|
184
|
-
await restartRuntime();
|
|
185
|
-
setTimeout(() => {
|
|
186
|
-
window.location.reload();
|
|
187
|
-
}, 6000);
|
|
188
|
-
} catch (err) {
|
|
189
|
-
if (saveBtn) saveBtn.disabled = false;
|
|
190
|
-
restartBtn.disabled = false;
|
|
191
|
-
setStatus("Restart failed: " + err.message, "error");
|
|
192
|
-
}
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
function updateRestartButton(show) {
|
|
196
|
-
if (!restartBtn) return;
|
|
197
|
-
restartBtn.hidden = !show;
|
|
198
|
-
restartBtn.disabled = false;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
function setStatus(message, status) {
|
|
202
|
-
if (!keyStatus) return;
|
|
203
|
-
keyStatus.textContent = message;
|
|
204
|
-
keyStatus.className = status ? `status-text ${status}` : "status-text";
|
|
205
|
-
}
|