dsh-plugin-capabilities 0.1.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/LICENSE +21 -0
- package/README.md +52 -0
- package/cordis.patch.yml +7 -0
- package/lib/client.js +863 -0
- package/lib/client.js.map +7 -0
- package/lib/index.js +1514 -0
- package/lib/index.js.map +7 -0
- package/package.json +64 -0
- package/src/agents.test.ts +105 -0
- package/src/agents.ts +135 -0
- package/src/client/McpTab.tsx +411 -0
- package/src/client/SkillsTab.tsx +301 -0
- package/src/client/css.ts +47 -0
- package/src/client/desktop-bridge.d.ts +12 -0
- package/src/client/index.ts +108 -0
- package/src/client/locales.ts +131 -0
- package/src/client/primitives.d.ts +57 -0
- package/src/http.ts +42 -0
- package/src/index.ts +56 -0
- package/src/mcp.test.ts +85 -0
- package/src/mcp.ts +170 -0
- package/src/profile.ts +17 -0
- package/src/routes.ts +285 -0
- package/src/skills.test.ts +73 -0
- package/src/skills.ts +81 -0
- package/src/smoke.test.ts +150 -0
- package/src/types.ts +34 -0
package/lib/index.js
ADDED
|
@@ -0,0 +1,1514 @@
|
|
|
1
|
+
// src/agents.ts
|
|
2
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
3
|
+
import { homedir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
|
|
6
|
+
// node_modules/smol-toml/dist/date.js
|
|
7
|
+
var DATE_TIME_RE = /^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;
|
|
8
|
+
var TomlDate = class _TomlDate extends Date {
|
|
9
|
+
#hasDate = false;
|
|
10
|
+
#hasTime = false;
|
|
11
|
+
#offset = null;
|
|
12
|
+
constructor(date) {
|
|
13
|
+
let hasDate = true;
|
|
14
|
+
let hasTime = true;
|
|
15
|
+
let offset = "Z";
|
|
16
|
+
if (typeof date === "string") {
|
|
17
|
+
let match = date.match(DATE_TIME_RE);
|
|
18
|
+
if (match) {
|
|
19
|
+
if (!match[1]) {
|
|
20
|
+
hasDate = false;
|
|
21
|
+
date = `0000-01-01T${date}`;
|
|
22
|
+
}
|
|
23
|
+
hasTime = !!match[2];
|
|
24
|
+
hasTime && date[10] === " " && (date = date.replace(" ", "T"));
|
|
25
|
+
if (match[2] && +match[2] > 23) {
|
|
26
|
+
date = "";
|
|
27
|
+
} else {
|
|
28
|
+
offset = match[3] || null;
|
|
29
|
+
date = date.toUpperCase();
|
|
30
|
+
if (!offset && hasTime)
|
|
31
|
+
date += "Z";
|
|
32
|
+
}
|
|
33
|
+
} else {
|
|
34
|
+
date = "";
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
super(date);
|
|
38
|
+
if (!isNaN(this.getTime())) {
|
|
39
|
+
this.#hasDate = hasDate;
|
|
40
|
+
this.#hasTime = hasTime;
|
|
41
|
+
this.#offset = offset;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
isDateTime() {
|
|
45
|
+
return this.#hasDate && this.#hasTime;
|
|
46
|
+
}
|
|
47
|
+
isLocal() {
|
|
48
|
+
return !this.#hasDate || !this.#hasTime || !this.#offset;
|
|
49
|
+
}
|
|
50
|
+
isDate() {
|
|
51
|
+
return this.#hasDate && !this.#hasTime;
|
|
52
|
+
}
|
|
53
|
+
isTime() {
|
|
54
|
+
return this.#hasTime && !this.#hasDate;
|
|
55
|
+
}
|
|
56
|
+
isValid() {
|
|
57
|
+
return this.#hasDate || this.#hasTime;
|
|
58
|
+
}
|
|
59
|
+
toISOString() {
|
|
60
|
+
let iso = super.toISOString();
|
|
61
|
+
if (this.isDate())
|
|
62
|
+
return iso.slice(0, 10);
|
|
63
|
+
if (this.isTime())
|
|
64
|
+
return iso.slice(11, 23);
|
|
65
|
+
if (this.#offset === null)
|
|
66
|
+
return iso.slice(0, -1);
|
|
67
|
+
if (this.#offset === "Z")
|
|
68
|
+
return iso;
|
|
69
|
+
let offset = +this.#offset.slice(1, 3) * 60 + +this.#offset.slice(4, 6);
|
|
70
|
+
offset = this.#offset[0] === "-" ? offset : -offset;
|
|
71
|
+
let offsetDate = new Date(this.getTime() - offset * 6e4);
|
|
72
|
+
return offsetDate.toISOString().slice(0, -1) + this.#offset;
|
|
73
|
+
}
|
|
74
|
+
static wrapAsOffsetDateTime(jsDate, offset = "Z") {
|
|
75
|
+
let date = new _TomlDate(jsDate);
|
|
76
|
+
date.#offset = offset;
|
|
77
|
+
return date;
|
|
78
|
+
}
|
|
79
|
+
static wrapAsLocalDateTime(jsDate) {
|
|
80
|
+
let date = new _TomlDate(jsDate);
|
|
81
|
+
date.#offset = null;
|
|
82
|
+
return date;
|
|
83
|
+
}
|
|
84
|
+
static wrapAsLocalDate(jsDate) {
|
|
85
|
+
let date = new _TomlDate(jsDate);
|
|
86
|
+
date.#hasTime = false;
|
|
87
|
+
date.#offset = null;
|
|
88
|
+
return date;
|
|
89
|
+
}
|
|
90
|
+
static wrapAsLocalTime(jsDate) {
|
|
91
|
+
let date = new _TomlDate(jsDate);
|
|
92
|
+
date.#hasDate = false;
|
|
93
|
+
date.#offset = null;
|
|
94
|
+
return date;
|
|
95
|
+
}
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
// node_modules/smol-toml/dist/error.js
|
|
99
|
+
function getLineColFromPtr(string, ptr) {
|
|
100
|
+
let lines = string.slice(0, ptr).split(/\r\n|\n|\r/g);
|
|
101
|
+
return [lines.length, lines.pop().length + 1];
|
|
102
|
+
}
|
|
103
|
+
function makeCodeBlock(string, line, column) {
|
|
104
|
+
let lines = string.split(/\r\n|\n|\r/g);
|
|
105
|
+
let codeblock = "";
|
|
106
|
+
let numberLen = (Math.log10(line + 1) | 0) + 1;
|
|
107
|
+
for (let i = line - 1; i <= line + 1; i++) {
|
|
108
|
+
let l = lines[i - 1];
|
|
109
|
+
if (!l)
|
|
110
|
+
continue;
|
|
111
|
+
codeblock += i.toString().padEnd(numberLen, " ");
|
|
112
|
+
codeblock += ": ";
|
|
113
|
+
codeblock += l;
|
|
114
|
+
codeblock += "\n";
|
|
115
|
+
if (i === line) {
|
|
116
|
+
codeblock += " ".repeat(numberLen + column + 2);
|
|
117
|
+
codeblock += "^\n";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
return codeblock;
|
|
121
|
+
}
|
|
122
|
+
var TomlError = class extends Error {
|
|
123
|
+
line;
|
|
124
|
+
column;
|
|
125
|
+
codeblock;
|
|
126
|
+
constructor(message, options) {
|
|
127
|
+
const [line, column] = getLineColFromPtr(options.toml, options.ptr);
|
|
128
|
+
const codeblock = makeCodeBlock(options.toml, line, column);
|
|
129
|
+
super(`Invalid TOML document: ${message}
|
|
130
|
+
|
|
131
|
+
${codeblock}`, options);
|
|
132
|
+
this.line = line;
|
|
133
|
+
this.column = column;
|
|
134
|
+
this.codeblock = codeblock;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
// node_modules/smol-toml/dist/util.js
|
|
139
|
+
function indexOfNewline(str, start = 0) {
|
|
140
|
+
let idx = str.indexOf("\n", start);
|
|
141
|
+
if (str.charCodeAt(idx - 1) === 13)
|
|
142
|
+
idx--;
|
|
143
|
+
return idx;
|
|
144
|
+
}
|
|
145
|
+
function skipComment(ctx) {
|
|
146
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
147
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
148
|
+
if (c === 10)
|
|
149
|
+
break;
|
|
150
|
+
if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10) {
|
|
151
|
+
ctx.p++;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
if (c < 32 && c !== 9 || c === 127) {
|
|
155
|
+
throw new TomlError("control characters are not allowed in comments", {
|
|
156
|
+
toml: ctx.s,
|
|
157
|
+
ptr: ctx.p
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function skipVoid(ctx, banNewLines, banComments) {
|
|
163
|
+
let c;
|
|
164
|
+
while (1) {
|
|
165
|
+
while ((c = ctx.s.charCodeAt(ctx.p)) === 32 || c === 9 || !banNewLines && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10))
|
|
166
|
+
ctx.p++;
|
|
167
|
+
if (banComments || c !== 35)
|
|
168
|
+
break;
|
|
169
|
+
skipComment(ctx);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
function skipUntil(ctx, sep, end) {
|
|
173
|
+
let ptr = ctx.p;
|
|
174
|
+
if (!end) {
|
|
175
|
+
ptr = indexOfNewline(ctx.s, ptr);
|
|
176
|
+
ctx.p = ptr < 0 ? ctx.s.length : ptr;
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
180
|
+
let c = ctx.s.charCodeAt(ctx.p);
|
|
181
|
+
if (c === 35) {
|
|
182
|
+
skipComment(ctx);
|
|
183
|
+
} else if (c === end || c === sep) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
throw new TomlError("cannot find end of structure", {
|
|
188
|
+
toml: ctx.s,
|
|
189
|
+
ptr
|
|
190
|
+
});
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// node_modules/smol-toml/dist/primitive.js
|
|
194
|
+
var INT_REGEX = /^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/;
|
|
195
|
+
var FLOAT_REGEX = /^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/;
|
|
196
|
+
var LEADING_ZERO = /^[+-]?0[0-9_]/;
|
|
197
|
+
function parseString(ctx) {
|
|
198
|
+
let start = ctx.p;
|
|
199
|
+
let c = ctx.s.charCodeAt(ctx.p++);
|
|
200
|
+
let first = c;
|
|
201
|
+
let isLiteral = c === 39;
|
|
202
|
+
let isMultiline = c === ctx.s.charCodeAt(ctx.p) && c === ctx.s.charCodeAt(ctx.p + 1);
|
|
203
|
+
if (isMultiline) {
|
|
204
|
+
if ((c = ctx.s.charCodeAt(ctx.p += 2)) === 10)
|
|
205
|
+
ctx.p++;
|
|
206
|
+
else if (c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)
|
|
207
|
+
ctx.p += 2;
|
|
208
|
+
}
|
|
209
|
+
let parsed = "";
|
|
210
|
+
let sliceStart = ctx.p;
|
|
211
|
+
let state = 0;
|
|
212
|
+
for (; ctx.p < ctx.s.length; ctx.p++) {
|
|
213
|
+
c = ctx.s.charCodeAt(ctx.p);
|
|
214
|
+
if (isMultiline && (c === 10 || c === 13 && ctx.s.charCodeAt(ctx.p + 1) === 10)) {
|
|
215
|
+
state = state && 3;
|
|
216
|
+
} else if (c < 32 && c !== 9 || c === 127) {
|
|
217
|
+
throw new TomlError("control characters are not allowed in strings", {
|
|
218
|
+
toml: ctx.s,
|
|
219
|
+
ptr: ctx.p
|
|
220
|
+
});
|
|
221
|
+
} else if ((!state || state === 3) && c === first && (!isMultiline || ctx.s.charCodeAt(ctx.p + 1) === first && ctx.s.charCodeAt(ctx.p + 2) === first)) {
|
|
222
|
+
if (isMultiline) {
|
|
223
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
224
|
+
ctx.p++;
|
|
225
|
+
if (ctx.s.charCodeAt(ctx.p + 3) === first)
|
|
226
|
+
ctx.p++;
|
|
227
|
+
}
|
|
228
|
+
if (!state)
|
|
229
|
+
parsed += ctx.s.slice(sliceStart, ctx.p);
|
|
230
|
+
ctx.p += isMultiline ? 3 : 1;
|
|
231
|
+
return parsed;
|
|
232
|
+
} else if (!state) {
|
|
233
|
+
if (!isLiteral && c === 92) {
|
|
234
|
+
parsed += ctx.s.slice(sliceStart, sliceStart = ctx.p);
|
|
235
|
+
state = 1;
|
|
236
|
+
}
|
|
237
|
+
} else if (state === 1) {
|
|
238
|
+
if (c === 120 || c === 117 || c === 85) {
|
|
239
|
+
let value = 0;
|
|
240
|
+
let len = c === 120 ? 2 : c === 117 ? 4 : 8;
|
|
241
|
+
for (let j = 0; j < len; j++, ctx.p++) {
|
|
242
|
+
let hex = ctx.s.charCodeAt(ctx.p + 1);
|
|
243
|
+
let digit = (
|
|
244
|
+
/* 0-9 */
|
|
245
|
+
hex >= 48 && hex <= 57 ? hex - 48 : (
|
|
246
|
+
/* A-F */
|
|
247
|
+
hex >= 65 && hex <= 70 ? hex - 65 + 10 : (
|
|
248
|
+
/* a-f */
|
|
249
|
+
hex >= 97 && hex <= 102 ? hex - 97 + 10 : -1
|
|
250
|
+
)
|
|
251
|
+
)
|
|
252
|
+
);
|
|
253
|
+
if (digit < 0)
|
|
254
|
+
throw new TomlError("invalid non-hex character in unicode escape", { toml: ctx.s, ptr: ctx.p + 1 });
|
|
255
|
+
value = value << 4 | digit;
|
|
256
|
+
}
|
|
257
|
+
if (value < 0 || value > 1114111 || value >= 55296 && value <= 57343) {
|
|
258
|
+
throw new TomlError("invalid unicode escape", { toml: ctx.s, ptr: ctx.p });
|
|
259
|
+
}
|
|
260
|
+
parsed += String.fromCodePoint(value);
|
|
261
|
+
sliceStart = ctx.p + 1;
|
|
262
|
+
state = 0;
|
|
263
|
+
} else if (c === 32 || c === 9) {
|
|
264
|
+
state = 2;
|
|
265
|
+
} else {
|
|
266
|
+
if (c === 98)
|
|
267
|
+
parsed += "\b";
|
|
268
|
+
else if (c === 116)
|
|
269
|
+
parsed += " ";
|
|
270
|
+
else if (c === 110)
|
|
271
|
+
parsed += "\n";
|
|
272
|
+
else if (c === 102)
|
|
273
|
+
parsed += "\f";
|
|
274
|
+
else if (c === 114)
|
|
275
|
+
parsed += "\r";
|
|
276
|
+
else if (c === 101)
|
|
277
|
+
parsed += "\x1B";
|
|
278
|
+
else if (c === 34)
|
|
279
|
+
parsed += '"';
|
|
280
|
+
else if (c === 92)
|
|
281
|
+
parsed += "\\";
|
|
282
|
+
else
|
|
283
|
+
throw new TomlError("unrecognized escape sequence", { toml: ctx.s, ptr: ctx.p });
|
|
284
|
+
sliceStart = ctx.p + 1;
|
|
285
|
+
state = 0;
|
|
286
|
+
}
|
|
287
|
+
} else if (c !== 32 && c !== 9) {
|
|
288
|
+
if (state === 2) {
|
|
289
|
+
throw new TomlError("invalid escape: only line-ending whitespace may be escaped", {
|
|
290
|
+
toml: ctx.s,
|
|
291
|
+
ptr: sliceStart
|
|
292
|
+
});
|
|
293
|
+
}
|
|
294
|
+
state = !isLiteral && c === 92 ? 1 : 0;
|
|
295
|
+
sliceStart = ctx.p;
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
throw new TomlError("unfinished string", { toml: ctx.s, ptr: start });
|
|
299
|
+
}
|
|
300
|
+
function sliceAndTrimEndOf(ctx, start, end) {
|
|
301
|
+
let value = ctx.s.slice(start, end);
|
|
302
|
+
let commentIdx = value.indexOf("#");
|
|
303
|
+
if (commentIdx > 0) {
|
|
304
|
+
skipComment({ s: value, p: commentIdx, d: 0 });
|
|
305
|
+
value = value.slice(0, commentIdx);
|
|
306
|
+
}
|
|
307
|
+
return value.trimEnd();
|
|
308
|
+
}
|
|
309
|
+
function parseValue(ctx, integersAsBigInt, end) {
|
|
310
|
+
let ptr = ctx.p;
|
|
311
|
+
let err = { toml: ctx.s, ptr };
|
|
312
|
+
skipUntil(ctx, 44, end);
|
|
313
|
+
let value = sliceAndTrimEndOf(ctx, ptr, ctx.p);
|
|
314
|
+
if (!value)
|
|
315
|
+
throw new TomlError("incomplete declaration: value expected", err);
|
|
316
|
+
if (value === "-inf")
|
|
317
|
+
return -Infinity;
|
|
318
|
+
if (value === "inf" || value === "+inf")
|
|
319
|
+
return Infinity;
|
|
320
|
+
if (value === "nan" || value === "+nan" || value === "-nan")
|
|
321
|
+
return NaN;
|
|
322
|
+
if (value === "-0")
|
|
323
|
+
return integersAsBigInt ? 0n : 0;
|
|
324
|
+
let isInt = INT_REGEX.test(value);
|
|
325
|
+
if (isInt || FLOAT_REGEX.test(value)) {
|
|
326
|
+
if (LEADING_ZERO.test(value)) {
|
|
327
|
+
throw new TomlError("leading zeroes are not allowed", err);
|
|
328
|
+
}
|
|
329
|
+
value = value.replace(/_/g, "");
|
|
330
|
+
let numeric = +value;
|
|
331
|
+
if (isNaN(numeric)) {
|
|
332
|
+
throw new TomlError("invalid number", err);
|
|
333
|
+
}
|
|
334
|
+
if (isInt) {
|
|
335
|
+
if ((isInt = !Number.isSafeInteger(numeric)) && !integersAsBigInt) {
|
|
336
|
+
throw new TomlError("integer value cannot be represented losslessly", err);
|
|
337
|
+
}
|
|
338
|
+
if (isInt || integersAsBigInt === true)
|
|
339
|
+
numeric = BigInt(value);
|
|
340
|
+
}
|
|
341
|
+
return numeric;
|
|
342
|
+
}
|
|
343
|
+
const date = new TomlDate(value);
|
|
344
|
+
if (!date.isValid())
|
|
345
|
+
throw new TomlError("invalid value", err);
|
|
346
|
+
return date;
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// node_modules/smol-toml/dist/extract.js
|
|
350
|
+
function extractValue(ctx, end, integersAsBigInt) {
|
|
351
|
+
let ptr = ctx.p;
|
|
352
|
+
let c = ctx.s.charCodeAt(ptr);
|
|
353
|
+
if (c === 91 || c === 123) {
|
|
354
|
+
if (!ctx.d--) {
|
|
355
|
+
throw new TomlError("document contains excessively nested structures. aborting.", {
|
|
356
|
+
toml: ctx.s,
|
|
357
|
+
ptr
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
let value = c === 91 ? parseArray(ctx, integersAsBigInt) : parseInlineTable(ctx, integersAsBigInt);
|
|
361
|
+
ctx.d++;
|
|
362
|
+
return value;
|
|
363
|
+
}
|
|
364
|
+
if (c === 34 || c === 39) {
|
|
365
|
+
return parseString(ctx);
|
|
366
|
+
}
|
|
367
|
+
if (c === 116) {
|
|
368
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 114 || ctx.s.charCodeAt(++ctx.p) !== 117 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
369
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
370
|
+
ctx.p++;
|
|
371
|
+
return true;
|
|
372
|
+
}
|
|
373
|
+
if (c === 102) {
|
|
374
|
+
if (ctx.s.charCodeAt(++ctx.p) !== 97 || ctx.s.charCodeAt(++ctx.p) !== 108 || ctx.s.charCodeAt(++ctx.p) !== 115 || ctx.s.charCodeAt(++ctx.p) !== 101)
|
|
375
|
+
throw new TomlError("invalid value", { toml: ctx.s, ptr });
|
|
376
|
+
ctx.p++;
|
|
377
|
+
return false;
|
|
378
|
+
}
|
|
379
|
+
return parseValue(ctx, integersAsBigInt, end);
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
// node_modules/smol-toml/dist/struct.js
|
|
383
|
+
var KEY_PART_RE = /^[a-zA-Z0-9-_]+[ \t]*$/;
|
|
384
|
+
function parseKey(ctx, end = "=") {
|
|
385
|
+
let start = ctx.p;
|
|
386
|
+
let dot = start - 1;
|
|
387
|
+
let parsed = [];
|
|
388
|
+
let endPtr = ctx.s.indexOf(end, start);
|
|
389
|
+
if (endPtr < 0) {
|
|
390
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
391
|
+
toml: ctx.s,
|
|
392
|
+
ptr: start
|
|
393
|
+
});
|
|
394
|
+
}
|
|
395
|
+
do {
|
|
396
|
+
let c = ctx.s.charCodeAt(ctx.p = ++dot);
|
|
397
|
+
if (c !== 32 && c !== 9) {
|
|
398
|
+
if (c === 34 || c === 39) {
|
|
399
|
+
if (c === ctx.s.charCodeAt(ctx.p + 1) && c === ctx.s.charCodeAt(ctx.p + 2)) {
|
|
400
|
+
throw new TomlError("multiline strings are not allowed in keys", {
|
|
401
|
+
toml: ctx.s,
|
|
402
|
+
ptr: ctx.p
|
|
403
|
+
});
|
|
404
|
+
}
|
|
405
|
+
let part = parseString(ctx);
|
|
406
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
407
|
+
let strEnd = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
408
|
+
let newLine = indexOfNewline(strEnd);
|
|
409
|
+
if (newLine > -1) {
|
|
410
|
+
throw new TomlError("newlines are not allowed in keys", {
|
|
411
|
+
toml: ctx.s,
|
|
412
|
+
ptr: newLine
|
|
413
|
+
});
|
|
414
|
+
}
|
|
415
|
+
if (strEnd.trimStart()) {
|
|
416
|
+
throw new TomlError("found extra tokens after the string part", {
|
|
417
|
+
toml: ctx.s,
|
|
418
|
+
ptr: ctx.p
|
|
419
|
+
});
|
|
420
|
+
}
|
|
421
|
+
if (endPtr < ctx.p) {
|
|
422
|
+
endPtr = ctx.s.indexOf(end, ctx.p);
|
|
423
|
+
if (endPtr < 0) {
|
|
424
|
+
throw new TomlError("incomplete key-value: cannot find end of key", {
|
|
425
|
+
toml: ctx.s,
|
|
426
|
+
ptr: start
|
|
427
|
+
});
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
parsed.push(part);
|
|
431
|
+
} else {
|
|
432
|
+
dot = ctx.s.indexOf(".", ctx.p);
|
|
433
|
+
let part = ctx.s.slice(ctx.p, dot < 0 || dot > endPtr ? endPtr : dot);
|
|
434
|
+
if (!KEY_PART_RE.test(part)) {
|
|
435
|
+
throw new TomlError("only letter, numbers, dashes and underscores are allowed in keys", {
|
|
436
|
+
toml: ctx.s,
|
|
437
|
+
ptr: ctx.p
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
parsed.push(part.trimEnd());
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
} while (dot + 1 && dot < endPtr);
|
|
444
|
+
ctx.p = endPtr + 1;
|
|
445
|
+
skipVoid(ctx, true, true);
|
|
446
|
+
return parsed;
|
|
447
|
+
}
|
|
448
|
+
function parseInlineTable(ctx, integersAsBigInt) {
|
|
449
|
+
let res = {};
|
|
450
|
+
let seen = /* @__PURE__ */ new Set();
|
|
451
|
+
let c;
|
|
452
|
+
ctx.p++;
|
|
453
|
+
while (ctx.p < ctx.s.length) {
|
|
454
|
+
skipVoid(ctx);
|
|
455
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 125) {
|
|
456
|
+
ctx.p++;
|
|
457
|
+
return res;
|
|
458
|
+
}
|
|
459
|
+
let k;
|
|
460
|
+
let t = res;
|
|
461
|
+
let hasOwn = false;
|
|
462
|
+
let p = ctx.p;
|
|
463
|
+
let key = parseKey(ctx);
|
|
464
|
+
for (let i = 0; i < key.length; i++) {
|
|
465
|
+
if (i)
|
|
466
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
467
|
+
k = key[i];
|
|
468
|
+
if ((hasOwn = Object.hasOwn(t, k)) && (typeof t[k] !== "object" || seen.has(t[k]))) {
|
|
469
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
470
|
+
toml: ctx.s,
|
|
471
|
+
ptr: p
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
if (!hasOwn && k === "__proto__") {
|
|
475
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
if (hasOwn) {
|
|
479
|
+
throw new TomlError("trying to redefine an already defined value", {
|
|
480
|
+
toml: ctx.s,
|
|
481
|
+
ptr: ctx.p
|
|
482
|
+
});
|
|
483
|
+
}
|
|
484
|
+
let value = extractValue(ctx, 125, integersAsBigInt);
|
|
485
|
+
seen.add(t[k] = value);
|
|
486
|
+
skipVoid(ctx);
|
|
487
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 125) {
|
|
488
|
+
return res;
|
|
489
|
+
}
|
|
490
|
+
if (c !== 44) {
|
|
491
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
492
|
+
}
|
|
493
|
+
}
|
|
494
|
+
throw new TomlError("unfinished table encountered", {
|
|
495
|
+
toml: ctx.s,
|
|
496
|
+
ptr: ctx.p
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function parseArray(ctx, integersAsBigInt) {
|
|
500
|
+
let res = [];
|
|
501
|
+
let c;
|
|
502
|
+
ctx.p++;
|
|
503
|
+
while (ctx.p < ctx.s.length) {
|
|
504
|
+
skipVoid(ctx);
|
|
505
|
+
if ((c = ctx.s.charCodeAt(ctx.p)) === 93) {
|
|
506
|
+
ctx.p++;
|
|
507
|
+
return res;
|
|
508
|
+
}
|
|
509
|
+
res.push(extractValue(ctx, 93, integersAsBigInt));
|
|
510
|
+
skipVoid(ctx);
|
|
511
|
+
if ((c = ctx.s.charCodeAt(ctx.p++)) === 93) {
|
|
512
|
+
return res;
|
|
513
|
+
}
|
|
514
|
+
if (c !== 44) {
|
|
515
|
+
throw new TomlError("expected comma or end of structure", { toml: ctx.s, ptr: ctx.p - 1 });
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
throw new TomlError("unfinished array encountered", {
|
|
519
|
+
toml: ctx.s,
|
|
520
|
+
ptr: ctx.p
|
|
521
|
+
});
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
// node_modules/smol-toml/dist/parse.js
|
|
525
|
+
function peekTable(key, table, meta, type) {
|
|
526
|
+
let t = table;
|
|
527
|
+
let m = meta;
|
|
528
|
+
let k;
|
|
529
|
+
let hasOwn = false;
|
|
530
|
+
let state;
|
|
531
|
+
for (let i = 0; i < key.length; i++) {
|
|
532
|
+
if (i) {
|
|
533
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
534
|
+
m = (state = m[k]).c;
|
|
535
|
+
if (type === 0 && (state.t === 1 || state.t === 2)) {
|
|
536
|
+
return null;
|
|
537
|
+
}
|
|
538
|
+
if (state.t === 2) {
|
|
539
|
+
let l = t.length - 1;
|
|
540
|
+
t = t[l];
|
|
541
|
+
m = m[l].c;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
k = key[i];
|
|
545
|
+
if ((hasOwn = Object.hasOwn(t, k)) && m[k]?.t === 0 && m[k]?.d) {
|
|
546
|
+
return null;
|
|
547
|
+
}
|
|
548
|
+
if (!hasOwn) {
|
|
549
|
+
if (k === "__proto__") {
|
|
550
|
+
Object.defineProperty(t, k, { enumerable: true, configurable: true, writable: true });
|
|
551
|
+
Object.defineProperty(m, k, { enumerable: true, configurable: true, writable: true });
|
|
552
|
+
}
|
|
553
|
+
m[k] = {
|
|
554
|
+
t: i < key.length - 1 && type === 2 ? 3 : type,
|
|
555
|
+
d: false,
|
|
556
|
+
i: 0,
|
|
557
|
+
c: {}
|
|
558
|
+
};
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
state = m[k];
|
|
562
|
+
if (state.t !== type && !(type === 1 && state.t === 3)) {
|
|
563
|
+
return null;
|
|
564
|
+
}
|
|
565
|
+
if (type === 2) {
|
|
566
|
+
if (!state.d) {
|
|
567
|
+
state.d = true;
|
|
568
|
+
t[k] = [];
|
|
569
|
+
}
|
|
570
|
+
t[k].push(t = {});
|
|
571
|
+
state.c[state.i++] = state = { t: 1, d: false, i: 0, c: {} };
|
|
572
|
+
}
|
|
573
|
+
if (state.d) {
|
|
574
|
+
return null;
|
|
575
|
+
}
|
|
576
|
+
state.d = true;
|
|
577
|
+
if (type === 1) {
|
|
578
|
+
t = hasOwn ? t[k] : t[k] = {};
|
|
579
|
+
} else if (type === 0 && hasOwn) {
|
|
580
|
+
return null;
|
|
581
|
+
}
|
|
582
|
+
return [k, t, state.c];
|
|
583
|
+
}
|
|
584
|
+
function parse(toml, { maxDepth = 1e3, integersAsBigInt } = {}) {
|
|
585
|
+
let ctx = { s: toml, p: 0, d: maxDepth };
|
|
586
|
+
let res = {};
|
|
587
|
+
let meta = {};
|
|
588
|
+
let tmp;
|
|
589
|
+
let tbl = res;
|
|
590
|
+
let m = meta;
|
|
591
|
+
skipVoid(ctx);
|
|
592
|
+
while (ctx.p < toml.length) {
|
|
593
|
+
if (toml.charCodeAt(ctx.p) === 91) {
|
|
594
|
+
let isTableArray = toml.charCodeAt(++ctx.p) === 91;
|
|
595
|
+
tmp = ctx.p += +isTableArray;
|
|
596
|
+
let k = parseKey(ctx, "]");
|
|
597
|
+
if (isTableArray) {
|
|
598
|
+
if (toml.charCodeAt(ctx.p - 1) !== 93) {
|
|
599
|
+
throw new TomlError("expected end of table declaration", {
|
|
600
|
+
toml,
|
|
601
|
+
ptr: ctx.p - 1
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
ctx.p++;
|
|
605
|
+
}
|
|
606
|
+
let p = peekTable(
|
|
607
|
+
k,
|
|
608
|
+
res,
|
|
609
|
+
meta,
|
|
610
|
+
isTableArray ? 2 : 1
|
|
611
|
+
/* Type.EXPLICIT */
|
|
612
|
+
);
|
|
613
|
+
if (!p) {
|
|
614
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
615
|
+
toml,
|
|
616
|
+
ptr: tmp
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
m = p[2];
|
|
620
|
+
tbl = p[1];
|
|
621
|
+
} else {
|
|
622
|
+
tmp = ctx.p;
|
|
623
|
+
let k = parseKey(ctx);
|
|
624
|
+
let p = peekTable(
|
|
625
|
+
k,
|
|
626
|
+
tbl,
|
|
627
|
+
m,
|
|
628
|
+
0
|
|
629
|
+
/* Type.DOTTED */
|
|
630
|
+
);
|
|
631
|
+
if (!p) {
|
|
632
|
+
throw new TomlError("trying to redefine an already defined table or value", {
|
|
633
|
+
toml,
|
|
634
|
+
ptr: tmp
|
|
635
|
+
});
|
|
636
|
+
}
|
|
637
|
+
p[1][p[0]] = extractValue(ctx, void 0, integersAsBigInt);
|
|
638
|
+
}
|
|
639
|
+
skipVoid(ctx, true);
|
|
640
|
+
if (ctx.p < toml.length && (tmp = toml.charCodeAt(ctx.p)) !== 10 && tmp !== 13) {
|
|
641
|
+
throw new TomlError("each key-value declaration must be followed by an end-of-line", {
|
|
642
|
+
toml,
|
|
643
|
+
ptr: ctx.p
|
|
644
|
+
});
|
|
645
|
+
}
|
|
646
|
+
skipVoid(ctx);
|
|
647
|
+
}
|
|
648
|
+
return res;
|
|
649
|
+
}
|
|
650
|
+
|
|
651
|
+
// src/agents.ts
|
|
652
|
+
function stringEntries(value) {
|
|
653
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return void 0;
|
|
654
|
+
const out = {};
|
|
655
|
+
for (const [key, entry] of Object.entries(value)) {
|
|
656
|
+
if (typeof entry === "string") out[key] = entry;
|
|
657
|
+
}
|
|
658
|
+
return Object.keys(out).length > 0 ? out : void 0;
|
|
659
|
+
}
|
|
660
|
+
function stringArray(value) {
|
|
661
|
+
if (!Array.isArray(value)) return void 0;
|
|
662
|
+
const out = value.filter((entry) => typeof entry === "string");
|
|
663
|
+
return out.length > 0 ? out : void 0;
|
|
664
|
+
}
|
|
665
|
+
function mapClaudeEntry(name2, entry) {
|
|
666
|
+
if (typeof entry !== "object" || entry === null) return null;
|
|
667
|
+
const record = entry;
|
|
668
|
+
const type = typeof record.type === "string" ? record.type : "stdio";
|
|
669
|
+
if (type === "stdio" || type === "stdio" && record.command !== void 0) {
|
|
670
|
+
if (typeof record.command !== "string" || record.command === "") return null;
|
|
671
|
+
return {
|
|
672
|
+
agent: "claude-code",
|
|
673
|
+
name: name2,
|
|
674
|
+
transport: "stdio",
|
|
675
|
+
command: record.command,
|
|
676
|
+
args: stringArray(record.args),
|
|
677
|
+
env: stringEntries(record.env)
|
|
678
|
+
};
|
|
679
|
+
}
|
|
680
|
+
if (type === "http" || type === "streamable-http") {
|
|
681
|
+
if (typeof record.url !== "string" || record.url === "") return null;
|
|
682
|
+
return {
|
|
683
|
+
agent: "claude-code",
|
|
684
|
+
name: name2,
|
|
685
|
+
transport: "streamable-http",
|
|
686
|
+
url: record.url,
|
|
687
|
+
headers: stringEntries(record.headers)
|
|
688
|
+
};
|
|
689
|
+
}
|
|
690
|
+
return null;
|
|
691
|
+
}
|
|
692
|
+
function scanClaudeMcp(home = homedir()) {
|
|
693
|
+
const merged = {};
|
|
694
|
+
for (const file of [join(home, ".claude", "settings.json"), join(home, ".claude.json")]) {
|
|
695
|
+
if (!existsSync(file)) continue;
|
|
696
|
+
try {
|
|
697
|
+
const parsed = JSON.parse(readFileSync(file, "utf8"));
|
|
698
|
+
if (typeof parsed.mcpServers === "object" && parsed.mcpServers !== null) {
|
|
699
|
+
Object.assign(merged, parsed.mcpServers);
|
|
700
|
+
}
|
|
701
|
+
} catch {
|
|
702
|
+
}
|
|
703
|
+
}
|
|
704
|
+
const out = [];
|
|
705
|
+
for (const [name2, entry] of Object.entries(merged)) {
|
|
706
|
+
const mapped = mapClaudeEntry(name2, entry);
|
|
707
|
+
if (mapped !== null) out.push(mapped);
|
|
708
|
+
}
|
|
709
|
+
return out;
|
|
710
|
+
}
|
|
711
|
+
function scanCodexMcp(home = homedir()) {
|
|
712
|
+
const file = join(home, ".codex", "config.toml");
|
|
713
|
+
if (!existsSync(file)) return [];
|
|
714
|
+
let root;
|
|
715
|
+
try {
|
|
716
|
+
root = parse(readFileSync(file, "utf8"));
|
|
717
|
+
} catch {
|
|
718
|
+
return [];
|
|
719
|
+
}
|
|
720
|
+
const table = root.mcp_servers;
|
|
721
|
+
if (typeof table !== "object" || table === null) return [];
|
|
722
|
+
const out = [];
|
|
723
|
+
for (const [name2, entry] of Object.entries(table)) {
|
|
724
|
+
if (typeof entry !== "object" || entry === null) continue;
|
|
725
|
+
const record = entry;
|
|
726
|
+
if (typeof record.command === "string" && record.command !== "") {
|
|
727
|
+
out.push({
|
|
728
|
+
agent: "codex",
|
|
729
|
+
name: name2,
|
|
730
|
+
transport: "stdio",
|
|
731
|
+
command: record.command,
|
|
732
|
+
args: stringArray(record.args),
|
|
733
|
+
env: stringEntries(record.env)
|
|
734
|
+
});
|
|
735
|
+
} else if (typeof record.url === "string" && record.url !== "") {
|
|
736
|
+
out.push({ agent: "codex", name: name2, transport: "streamable-http", url: record.url });
|
|
737
|
+
}
|
|
738
|
+
}
|
|
739
|
+
return out;
|
|
740
|
+
}
|
|
741
|
+
function scanAllMcp(home = homedir()) {
|
|
742
|
+
const seen = /* @__PURE__ */ new Set();
|
|
743
|
+
return [...scanClaudeMcp(home), ...scanCodexMcp(home)].filter((server) => {
|
|
744
|
+
const key = `${server.agent}/${server.name}`;
|
|
745
|
+
if (seen.has(key)) return false;
|
|
746
|
+
seen.add(key);
|
|
747
|
+
return true;
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
function agentSkillRoots(home = homedir()) {
|
|
751
|
+
return [join(home, ".claude", "skills"), join(home, ".codex", "skills")].filter((path) => existsSync(path));
|
|
752
|
+
}
|
|
753
|
+
|
|
754
|
+
// src/profile.ts
|
|
755
|
+
import { homedir as homedir2 } from "node:os";
|
|
756
|
+
import { join as join2 } from "node:path";
|
|
757
|
+
function argvProfile(argv = process.argv) {
|
|
758
|
+
const flag = argv.indexOf("--profile");
|
|
759
|
+
if (flag !== -1 && flag + 1 < argv.length && !argv[flag + 1].startsWith("-")) return argv[flag + 1];
|
|
760
|
+
return void 0;
|
|
761
|
+
}
|
|
762
|
+
function profileDir(profile, dshHome = process.env.DSH_HOME) {
|
|
763
|
+
const home = dshHome ?? join2(homedir2(), ".dsh");
|
|
764
|
+
return join2(home, "profiles", profile);
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
// src/http.ts
|
|
768
|
+
async function readJsonBody(request) {
|
|
769
|
+
const chunks = [];
|
|
770
|
+
let received = 0;
|
|
771
|
+
for await (const chunk of request) {
|
|
772
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
773
|
+
received += buffer.length;
|
|
774
|
+
if (received > 1024 * 1024) throw new Error("request body too large");
|
|
775
|
+
chunks.push(buffer);
|
|
776
|
+
}
|
|
777
|
+
return JSON.parse(Buffer.concat(chunks).toString("utf8"));
|
|
778
|
+
}
|
|
779
|
+
function sameOrigin(request) {
|
|
780
|
+
const origin = request.headers.origin;
|
|
781
|
+
const host = request.headers.host;
|
|
782
|
+
if (origin === void 0 || host === void 0) return false;
|
|
783
|
+
try {
|
|
784
|
+
const parsed = new URL(origin);
|
|
785
|
+
return (parsed.protocol === "http:" || parsed.protocol === "https:") && parsed.host === host;
|
|
786
|
+
} catch {
|
|
787
|
+
return false;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
function sendJson(response, status, body) {
|
|
791
|
+
const payload = JSON.stringify(body);
|
|
792
|
+
response.writeHead(status, {
|
|
793
|
+
"content-type": "application/json; charset=utf-8",
|
|
794
|
+
"cache-control": "no-store"
|
|
795
|
+
});
|
|
796
|
+
response.end(payload);
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// src/skills.ts
|
|
800
|
+
import { existsSync as existsSync2, mkdirSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
801
|
+
import { homedir as homedir3 } from "node:os";
|
|
802
|
+
import { join as join3 } from "node:path";
|
|
803
|
+
var SKILL_NAME_RE = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
804
|
+
function userSkillsDir(dshHome = process.env.DSH_HOME) {
|
|
805
|
+
return join3(dshHome ?? join3(homedir3(), ".dsh"), "skills");
|
|
806
|
+
}
|
|
807
|
+
function quote(value) {
|
|
808
|
+
return JSON.stringify(value);
|
|
809
|
+
}
|
|
810
|
+
function serializeSkill(input) {
|
|
811
|
+
const lines = [
|
|
812
|
+
`name: ${input.name}`,
|
|
813
|
+
`description: ${quote(input.description)}`
|
|
814
|
+
];
|
|
815
|
+
if (input.whenToUse !== void 0 && input.whenToUse !== "") lines.push(`whenToUse: ${quote(input.whenToUse)}`);
|
|
816
|
+
if (!input.modelInvocable) lines.push("disable-model-invocation: true");
|
|
817
|
+
if (!input.userInvocable) lines.push("user-invocable: false");
|
|
818
|
+
const body = input.content.replace(/\r\n/g, "\n").trim();
|
|
819
|
+
return `---
|
|
820
|
+
${lines.join("\n")}
|
|
821
|
+
---
|
|
822
|
+
|
|
823
|
+
${body}
|
|
824
|
+
`;
|
|
825
|
+
}
|
|
826
|
+
function validateSkillInput(input) {
|
|
827
|
+
if (!SKILL_NAME_RE.test(input.name)) return "name must be kebab-case (a-z, 0-9, dashes)";
|
|
828
|
+
if (input.description.trim() === "") return "description is required";
|
|
829
|
+
if (input.description.length > 1024) return "description too long (max 1024)";
|
|
830
|
+
if (input.whenToUse !== void 0 && input.whenToUse.length > 2048) return "whenToUse too long (max 2048)";
|
|
831
|
+
if (input.content.length > 256 * 1024) return "content too large (max 256 KiB)";
|
|
832
|
+
return null;
|
|
833
|
+
}
|
|
834
|
+
function skillDir(name2, dshHome) {
|
|
835
|
+
return join3(userSkillsDir(dshHome), name2);
|
|
836
|
+
}
|
|
837
|
+
function writeSkill(input, dshHome) {
|
|
838
|
+
const dir = skillDir(input.name, dshHome);
|
|
839
|
+
mkdirSync(dir, { recursive: true });
|
|
840
|
+
const file = join3(dir, "SKILL.md");
|
|
841
|
+
writeFileSync(file, serializeSkill(input), "utf8");
|
|
842
|
+
return file;
|
|
843
|
+
}
|
|
844
|
+
function deleteSkill(name2, dshHome) {
|
|
845
|
+
if (!SKILL_NAME_RE.test(name2)) return false;
|
|
846
|
+
const dir = skillDir(name2, dshHome);
|
|
847
|
+
if (!existsSync2(dir) || !statSync(dir).isDirectory()) return false;
|
|
848
|
+
rmSync(dir, { recursive: true, force: true });
|
|
849
|
+
return true;
|
|
850
|
+
}
|
|
851
|
+
|
|
852
|
+
// src/mcp.ts
|
|
853
|
+
import { existsSync as existsSync3, mkdirSync as mkdirSync2, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "node:fs";
|
|
854
|
+
import { join as join4 } from "node:path";
|
|
855
|
+
import { parseDocument, Document } from "yaml";
|
|
856
|
+
var MCP_PLUGIN = "@deepseek-ai/dsh-mcp-client";
|
|
857
|
+
var SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
|
|
858
|
+
function loadPatch(profileDirPath) {
|
|
859
|
+
const path = join4(profileDirPath, "cordis.patch.yml");
|
|
860
|
+
const text = existsSync3(path) ? readFileSync2(path, "utf8") : "[]";
|
|
861
|
+
return parseDocument(text);
|
|
862
|
+
}
|
|
863
|
+
function savePatch(profileDirPath, doc) {
|
|
864
|
+
mkdirSync2(profileDirPath, { recursive: true });
|
|
865
|
+
writeFileSync2(join4(profileDirPath, "cordis.patch.yml"), String(doc), "utf8");
|
|
866
|
+
}
|
|
867
|
+
function toNode(value) {
|
|
868
|
+
return new Document(value).contents;
|
|
869
|
+
}
|
|
870
|
+
function rowSeq(doc) {
|
|
871
|
+
if (doc.contents === null) doc.contents = toNode([]);
|
|
872
|
+
return doc.contents;
|
|
873
|
+
}
|
|
874
|
+
function mcpRows(doc) {
|
|
875
|
+
return (rowSeq(doc).items ?? []).filter((item) => item.get("name") === MCP_PLUGIN);
|
|
876
|
+
}
|
|
877
|
+
function isStringMap(value) {
|
|
878
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
|
|
879
|
+
return Object.values(value).every((entry) => typeof entry === "string");
|
|
880
|
+
}
|
|
881
|
+
function listMcp(profileDirPath) {
|
|
882
|
+
const doc = loadPatch(profileDirPath);
|
|
883
|
+
return mcpRows(doc).map((item) => {
|
|
884
|
+
const configNode = item.get("config");
|
|
885
|
+
const plain = typeof configNode === "object" && configNode !== null && typeof configNode.toJS === "function" ? configNode.toJS(doc) : {};
|
|
886
|
+
return {
|
|
887
|
+
id: String(item.get("id") ?? ""),
|
|
888
|
+
serverName: String(plain.serverName ?? ""),
|
|
889
|
+
transport: plain.transport === "streamable-http" ? "streamable-http" : "stdio",
|
|
890
|
+
disabled: item.get("disabled") === true,
|
|
891
|
+
...typeof plain.command === "string" && plain.command !== "" ? { command: plain.command } : {},
|
|
892
|
+
...Array.isArray(plain.args) ? { args: plain.args.map(String) } : {},
|
|
893
|
+
...isStringMap(plain.env) ? { env: plain.env } : {},
|
|
894
|
+
...typeof plain.cwd === "string" && plain.cwd !== "" ? { cwd: plain.cwd } : {},
|
|
895
|
+
...typeof plain.url === "string" && plain.url !== "" ? { url: plain.url } : {},
|
|
896
|
+
...isStringMap(plain.headers) ? { headers: plain.headers } : {}
|
|
897
|
+
};
|
|
898
|
+
});
|
|
899
|
+
}
|
|
900
|
+
function validateMcpInput(input) {
|
|
901
|
+
if (!SERVER_NAME_RE.test(input.serverName)) return "serverName must be 1-32 chars of A-Z a-z 0-9 _ -";
|
|
902
|
+
if (input.id.includes("/") || input.id.includes("..")) return "invalid id";
|
|
903
|
+
if (input.transport === "stdio") {
|
|
904
|
+
if (input.command === void 0 || input.command.trim() === "") return "stdio transport requires a command";
|
|
905
|
+
} else if (input.url === void 0 || !/^https?:\/\//.test(input.url)) {
|
|
906
|
+
return "http transport requires an http(s) url";
|
|
907
|
+
}
|
|
908
|
+
return null;
|
|
909
|
+
}
|
|
910
|
+
function upsertMcp(profileDirPath, input) {
|
|
911
|
+
const doc = loadPatch(profileDirPath);
|
|
912
|
+
const seq = rowSeq(doc);
|
|
913
|
+
const existing = input.id !== "" ? mcpRows(doc).find((item) => item.get("id") === input.id) : void 0;
|
|
914
|
+
let id = input.id !== "" ? input.id : `mcp-${input.serverName}`;
|
|
915
|
+
if (existing === void 0) {
|
|
916
|
+
const taken = new Set(
|
|
917
|
+
(seq.items ?? []).map((item) => String(item.get("id") ?? "")).filter((id2) => id2 !== "")
|
|
918
|
+
);
|
|
919
|
+
let suffix = 2;
|
|
920
|
+
while (taken.has(id)) id = `mcp-${input.serverName}-${suffix++}`;
|
|
921
|
+
}
|
|
922
|
+
const config = input.transport === "stdio" ? {
|
|
923
|
+
serverName: input.serverName,
|
|
924
|
+
transport: input.transport,
|
|
925
|
+
command: input.command,
|
|
926
|
+
...input.args !== void 0 && input.args.length > 0 ? { args: input.args } : {},
|
|
927
|
+
...input.env !== void 0 && Object.keys(input.env).length > 0 ? { env: input.env } : {},
|
|
928
|
+
...input.cwd !== void 0 && input.cwd !== "" ? { cwd: input.cwd } : {}
|
|
929
|
+
} : {
|
|
930
|
+
serverName: input.serverName,
|
|
931
|
+
transport: input.transport,
|
|
932
|
+
url: input.url,
|
|
933
|
+
...input.headers !== void 0 && Object.keys(input.headers).length > 0 ? { headers: input.headers } : {}
|
|
934
|
+
};
|
|
935
|
+
const row = { id, name: MCP_PLUGIN, config };
|
|
936
|
+
if (input.disabled === true) row.disabled = true;
|
|
937
|
+
const node = toNode(row);
|
|
938
|
+
if (existing === void 0) seq.add(node);
|
|
939
|
+
else seq.items[seq.items.indexOf(existing)] = node;
|
|
940
|
+
savePatch(profileDirPath, doc);
|
|
941
|
+
return id;
|
|
942
|
+
}
|
|
943
|
+
function setMcpDisabled(profileDirPath, id, disabled) {
|
|
944
|
+
const doc = loadPatch(profileDirPath);
|
|
945
|
+
const item = mcpRows(doc).find((row) => row.get("id") === id);
|
|
946
|
+
if (item === void 0) return false;
|
|
947
|
+
if (disabled) item.set("disabled", true);
|
|
948
|
+
else item.delete("disabled");
|
|
949
|
+
savePatch(profileDirPath, doc);
|
|
950
|
+
return true;
|
|
951
|
+
}
|
|
952
|
+
function removeMcp(profileDirPath, id) {
|
|
953
|
+
const doc = loadPatch(profileDirPath);
|
|
954
|
+
const item = mcpRows(doc).find((row) => row.get("id") === id);
|
|
955
|
+
if (item === void 0) return false;
|
|
956
|
+
const seq = rowSeq(doc);
|
|
957
|
+
seq.items.splice(seq.items.indexOf(item), 1);
|
|
958
|
+
savePatch(profileDirPath, doc);
|
|
959
|
+
return true;
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// src/routes.ts
|
|
963
|
+
var EDITABLE_SOURCE = "user-dsh";
|
|
964
|
+
function mountCapabilitiesRoutes(host, config) {
|
|
965
|
+
const disposers = [
|
|
966
|
+
host.webServer.register({
|
|
967
|
+
kind: "exact",
|
|
968
|
+
path: "/dsh-plugin-capabilities/skills",
|
|
969
|
+
handler: async (request, response) => {
|
|
970
|
+
if (request.method !== "GET") {
|
|
971
|
+
response.writeHead(405, { allow: "GET" });
|
|
972
|
+
response.end();
|
|
973
|
+
return;
|
|
974
|
+
}
|
|
975
|
+
try {
|
|
976
|
+
const skills = await host.skills.list();
|
|
977
|
+
sendJson(response, 200, {
|
|
978
|
+
skills: skills.map((skill) => ({ ...skill, editable: skill.source === EDITABLE_SOURCE }))
|
|
979
|
+
});
|
|
980
|
+
} catch (error) {
|
|
981
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
982
|
+
}
|
|
983
|
+
}
|
|
984
|
+
}),
|
|
985
|
+
host.webServer.register({
|
|
986
|
+
kind: "exact",
|
|
987
|
+
path: "/dsh-plugin-capabilities/skill",
|
|
988
|
+
handler: async (request, response) => {
|
|
989
|
+
if (request.method !== "GET") {
|
|
990
|
+
response.writeHead(405, { allow: "GET" });
|
|
991
|
+
response.end();
|
|
992
|
+
return;
|
|
993
|
+
}
|
|
994
|
+
const url = new URL(request.url ?? "/", "http://localhost");
|
|
995
|
+
const name2 = url.searchParams.get("name") ?? "";
|
|
996
|
+
try {
|
|
997
|
+
const definition = await host.skills.get(name2);
|
|
998
|
+
sendJson(response, 200, { name: definition.name, content: definition.content });
|
|
999
|
+
} catch (error) {
|
|
1000
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
}),
|
|
1004
|
+
host.webServer.register({
|
|
1005
|
+
kind: "exact",
|
|
1006
|
+
path: "/dsh-plugin-capabilities/skill/save",
|
|
1007
|
+
handler: async (request, response) => {
|
|
1008
|
+
if (request.method !== "POST") {
|
|
1009
|
+
response.writeHead(405, { allow: "POST" });
|
|
1010
|
+
response.end();
|
|
1011
|
+
return;
|
|
1012
|
+
}
|
|
1013
|
+
if (!sameOrigin(request)) {
|
|
1014
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1015
|
+
return;
|
|
1016
|
+
}
|
|
1017
|
+
try {
|
|
1018
|
+
const body = await readJsonBody(request);
|
|
1019
|
+
const input = {
|
|
1020
|
+
name: typeof body.name === "string" ? body.name : "",
|
|
1021
|
+
description: typeof body.description === "string" ? body.description : "",
|
|
1022
|
+
whenToUse: typeof body.whenToUse === "string" ? body.whenToUse : void 0,
|
|
1023
|
+
modelInvocable: body.modelInvocable !== false,
|
|
1024
|
+
userInvocable: body.userInvocable !== false,
|
|
1025
|
+
content: typeof body.content === "string" ? body.content : ""
|
|
1026
|
+
};
|
|
1027
|
+
const invalid = validateSkillInput(input);
|
|
1028
|
+
if (invalid !== null) {
|
|
1029
|
+
sendJson(response, 400, { error: invalid });
|
|
1030
|
+
return;
|
|
1031
|
+
}
|
|
1032
|
+
writeSkill(input);
|
|
1033
|
+
sendJson(response, 200, { ok: true, name: input.name });
|
|
1034
|
+
} catch (error) {
|
|
1035
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
}),
|
|
1039
|
+
host.webServer.register({
|
|
1040
|
+
kind: "exact",
|
|
1041
|
+
path: "/dsh-plugin-capabilities/skill/delete",
|
|
1042
|
+
handler: async (request, response) => {
|
|
1043
|
+
if (request.method !== "POST") {
|
|
1044
|
+
response.writeHead(405, { allow: "POST" });
|
|
1045
|
+
response.end();
|
|
1046
|
+
return;
|
|
1047
|
+
}
|
|
1048
|
+
if (!sameOrigin(request)) {
|
|
1049
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1050
|
+
return;
|
|
1051
|
+
}
|
|
1052
|
+
try {
|
|
1053
|
+
const body = await readJsonBody(request);
|
|
1054
|
+
const name2 = typeof body.name === "string" ? body.name : "";
|
|
1055
|
+
const removed = deleteSkill(name2);
|
|
1056
|
+
sendJson(response, removed ? 200 : 404, removed ? { ok: true, name: name2 } : { error: "skill not found" });
|
|
1057
|
+
} catch (error) {
|
|
1058
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
}),
|
|
1062
|
+
host.webServer.register({
|
|
1063
|
+
kind: "exact",
|
|
1064
|
+
path: "/dsh-plugin-capabilities/mcp",
|
|
1065
|
+
handler: async (request, response) => {
|
|
1066
|
+
if (request.method !== "GET") {
|
|
1067
|
+
response.writeHead(405, { allow: "GET" });
|
|
1068
|
+
response.end();
|
|
1069
|
+
return;
|
|
1070
|
+
}
|
|
1071
|
+
sendJson(response, 200, { servers: listMcp(config.profileDirPath), restartNeeded: true });
|
|
1072
|
+
}
|
|
1073
|
+
}),
|
|
1074
|
+
host.webServer.register({
|
|
1075
|
+
kind: "exact",
|
|
1076
|
+
path: "/dsh-plugin-capabilities/mcp/save",
|
|
1077
|
+
handler: async (request, response) => {
|
|
1078
|
+
if (request.method !== "POST") {
|
|
1079
|
+
response.writeHead(405, { allow: "POST" });
|
|
1080
|
+
response.end();
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
if (!sameOrigin(request)) {
|
|
1084
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1085
|
+
return;
|
|
1086
|
+
}
|
|
1087
|
+
try {
|
|
1088
|
+
const input = await readJsonBody(request);
|
|
1089
|
+
const invalid = validateMcpInput(input);
|
|
1090
|
+
if (invalid !== null) {
|
|
1091
|
+
sendJson(response, 400, { error: invalid });
|
|
1092
|
+
return;
|
|
1093
|
+
}
|
|
1094
|
+
const id = upsertMcp(config.profileDirPath, input);
|
|
1095
|
+
sendJson(response, 200, { ok: true, id, restartNeeded: true });
|
|
1096
|
+
} catch (error) {
|
|
1097
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}),
|
|
1101
|
+
host.webServer.register({
|
|
1102
|
+
kind: "exact",
|
|
1103
|
+
path: "/dsh-plugin-capabilities/mcp/toggle",
|
|
1104
|
+
handler: async (request, response) => {
|
|
1105
|
+
if (request.method !== "POST") {
|
|
1106
|
+
response.writeHead(405, { allow: "POST" });
|
|
1107
|
+
response.end();
|
|
1108
|
+
return;
|
|
1109
|
+
}
|
|
1110
|
+
if (!sameOrigin(request)) {
|
|
1111
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1112
|
+
return;
|
|
1113
|
+
}
|
|
1114
|
+
try {
|
|
1115
|
+
const body = await readJsonBody(request);
|
|
1116
|
+
if (typeof body.id !== "string" || typeof body.disabled !== "boolean") {
|
|
1117
|
+
sendJson(response, 400, { error: "id and disabled are required" });
|
|
1118
|
+
return;
|
|
1119
|
+
}
|
|
1120
|
+
const ok = setMcpDisabled(config.profileDirPath, body.id, body.disabled);
|
|
1121
|
+
sendJson(response, ok ? 200 : 404, ok ? { ok: true, restartNeeded: true } : { error: "server row not found" });
|
|
1122
|
+
} catch (error) {
|
|
1123
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1124
|
+
}
|
|
1125
|
+
}
|
|
1126
|
+
}),
|
|
1127
|
+
host.webServer.register({
|
|
1128
|
+
kind: "exact",
|
|
1129
|
+
path: "/dsh-plugin-capabilities/mcp/remove",
|
|
1130
|
+
handler: async (request, response) => {
|
|
1131
|
+
if (request.method !== "POST") {
|
|
1132
|
+
response.writeHead(405, { allow: "POST" });
|
|
1133
|
+
response.end();
|
|
1134
|
+
return;
|
|
1135
|
+
}
|
|
1136
|
+
if (!sameOrigin(request)) {
|
|
1137
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1138
|
+
return;
|
|
1139
|
+
}
|
|
1140
|
+
try {
|
|
1141
|
+
const body = await readJsonBody(request);
|
|
1142
|
+
if (typeof body.id !== "string") {
|
|
1143
|
+
sendJson(response, 400, { error: "id is required" });
|
|
1144
|
+
return;
|
|
1145
|
+
}
|
|
1146
|
+
const ok = removeMcp(config.profileDirPath, body.id);
|
|
1147
|
+
sendJson(response, ok ? 200 : 404, ok ? { ok: true, restartNeeded: true } : { error: "server row not found" });
|
|
1148
|
+
} catch (error) {
|
|
1149
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
}),
|
|
1153
|
+
host.webServer.register({
|
|
1154
|
+
kind: "exact",
|
|
1155
|
+
path: "/dsh-plugin-capabilities/import/scan",
|
|
1156
|
+
handler: async (request, response) => {
|
|
1157
|
+
if (request.method !== "GET") {
|
|
1158
|
+
response.writeHead(405, { allow: "GET" });
|
|
1159
|
+
response.end();
|
|
1160
|
+
return;
|
|
1161
|
+
}
|
|
1162
|
+
try {
|
|
1163
|
+
sendJson(response, 200, {
|
|
1164
|
+
servers: scanAllMcp(),
|
|
1165
|
+
// Profile serverNames, so the browser can grey out existing ones.
|
|
1166
|
+
existing: listMcp(config.profileDirPath).map((row) => row.serverName)
|
|
1167
|
+
});
|
|
1168
|
+
} catch (error) {
|
|
1169
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
}),
|
|
1173
|
+
host.webServer.register({
|
|
1174
|
+
kind: "exact",
|
|
1175
|
+
path: "/dsh-plugin-capabilities/import/apply",
|
|
1176
|
+
handler: async (request, response) => {
|
|
1177
|
+
if (request.method !== "POST") {
|
|
1178
|
+
response.writeHead(405, { allow: "POST" });
|
|
1179
|
+
response.end();
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
if (!sameOrigin(request)) {
|
|
1183
|
+
sendJson(response, 403, { error: "untrusted origin" });
|
|
1184
|
+
return;
|
|
1185
|
+
}
|
|
1186
|
+
try {
|
|
1187
|
+
const body = await readJsonBody(request);
|
|
1188
|
+
const wanted = new Set(
|
|
1189
|
+
(Array.isArray(body.items) ? body.items : []).filter((item) => typeof item === "object" && item !== null && typeof item.agent === "string" && typeof item.name === "string").map((item) => `${item.agent}/${item.name}`)
|
|
1190
|
+
);
|
|
1191
|
+
const results = [];
|
|
1192
|
+
for (const server of scanAllMcp()) {
|
|
1193
|
+
if (!wanted.has(`${server.agent}/${server.name}`)) continue;
|
|
1194
|
+
const existing = listMcp(config.profileDirPath).some((row) => row.serverName === server.name);
|
|
1195
|
+
if (existing) {
|
|
1196
|
+
results.push({ name: server.name, ok: false, error: "already in profile" });
|
|
1197
|
+
continue;
|
|
1198
|
+
}
|
|
1199
|
+
const input = {
|
|
1200
|
+
id: "",
|
|
1201
|
+
serverName: server.name,
|
|
1202
|
+
transport: server.transport,
|
|
1203
|
+
...server.transport === "stdio" ? { command: server.command, args: server.args, env: server.env } : { url: server.url, headers: server.headers }
|
|
1204
|
+
};
|
|
1205
|
+
const invalid = validateMcpInput(input);
|
|
1206
|
+
if (invalid !== null) {
|
|
1207
|
+
results.push({ name: server.name, ok: false, error: invalid });
|
|
1208
|
+
continue;
|
|
1209
|
+
}
|
|
1210
|
+
upsertMcp(config.profileDirPath, input);
|
|
1211
|
+
results.push({ name: server.name, ok: true });
|
|
1212
|
+
}
|
|
1213
|
+
sendJson(response, 200, { ok: results.every((item) => item.ok), results, restartNeeded: true });
|
|
1214
|
+
} catch (error) {
|
|
1215
|
+
sendJson(response, 500, { error: error instanceof Error ? error.message : String(error) });
|
|
1216
|
+
}
|
|
1217
|
+
}
|
|
1218
|
+
})
|
|
1219
|
+
];
|
|
1220
|
+
return () => {
|
|
1221
|
+
for (const dispose of disposers) dispose();
|
|
1222
|
+
};
|
|
1223
|
+
}
|
|
1224
|
+
|
|
1225
|
+
// src/index.ts
|
|
1226
|
+
var name = "dsh-plugin-capabilities";
|
|
1227
|
+
var inject = ["webServer", "skills"];
|
|
1228
|
+
function apply(ctx, config) {
|
|
1229
|
+
const profile = config?.profile ?? argvProfile() ?? "web";
|
|
1230
|
+
ctx.inject(["webServer", "skills"], (hostCtx) => {
|
|
1231
|
+
void (async () => {
|
|
1232
|
+
try {
|
|
1233
|
+
const mod = await import("@deepseek-ai/dsh-skill-filesystem");
|
|
1234
|
+
const plugin = mod.default ?? mod;
|
|
1235
|
+
const roots = agentSkillRoots();
|
|
1236
|
+
hostCtx.plugin(plugin, roots.length > 0 ? { customSkillDirs: roots } : {});
|
|
1237
|
+
} catch {
|
|
1238
|
+
}
|
|
1239
|
+
})();
|
|
1240
|
+
ctx.effect(
|
|
1241
|
+
() => mountCapabilitiesRoutes(hostCtx, { profileDirPath: profileDir(profile) }),
|
|
1242
|
+
"dsh-plugin-capabilities: http routes"
|
|
1243
|
+
);
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
export {
|
|
1247
|
+
apply,
|
|
1248
|
+
inject,
|
|
1249
|
+
name
|
|
1250
|
+
};
|
|
1251
|
+
/*! Bundled license information:
|
|
1252
|
+
|
|
1253
|
+
smol-toml/dist/date.js:
|
|
1254
|
+
(*!
|
|
1255
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1256
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1257
|
+
*
|
|
1258
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1259
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1260
|
+
*
|
|
1261
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1262
|
+
* list of conditions and the following disclaimer.
|
|
1263
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1264
|
+
* this list of conditions and the following disclaimer in the
|
|
1265
|
+
* documentation and/or other materials provided with the distribution.
|
|
1266
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1267
|
+
* may be used to endorse or promote products derived from this software without
|
|
1268
|
+
* specific prior written permission.
|
|
1269
|
+
*
|
|
1270
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1271
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1272
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1273
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1274
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1275
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1276
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1277
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1278
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1279
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1280
|
+
*)
|
|
1281
|
+
|
|
1282
|
+
smol-toml/dist/error.js:
|
|
1283
|
+
(*!
|
|
1284
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1285
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1286
|
+
*
|
|
1287
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1288
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1289
|
+
*
|
|
1290
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1291
|
+
* list of conditions and the following disclaimer.
|
|
1292
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1293
|
+
* this list of conditions and the following disclaimer in the
|
|
1294
|
+
* documentation and/or other materials provided with the distribution.
|
|
1295
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1296
|
+
* may be used to endorse or promote products derived from this software without
|
|
1297
|
+
* specific prior written permission.
|
|
1298
|
+
*
|
|
1299
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1300
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1301
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1302
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1303
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1304
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1305
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1306
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1307
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1308
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1309
|
+
*)
|
|
1310
|
+
|
|
1311
|
+
smol-toml/dist/util.js:
|
|
1312
|
+
(*!
|
|
1313
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1314
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1315
|
+
*
|
|
1316
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1317
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1318
|
+
*
|
|
1319
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1320
|
+
* list of conditions and the following disclaimer.
|
|
1321
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1322
|
+
* this list of conditions and the following disclaimer in the
|
|
1323
|
+
* documentation and/or other materials provided with the distribution.
|
|
1324
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1325
|
+
* may be used to endorse or promote products derived from this software without
|
|
1326
|
+
* specific prior written permission.
|
|
1327
|
+
*
|
|
1328
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1329
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1330
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1331
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1332
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1333
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1334
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1335
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1336
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1337
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1338
|
+
*)
|
|
1339
|
+
|
|
1340
|
+
smol-toml/dist/primitive.js:
|
|
1341
|
+
(*!
|
|
1342
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1343
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1344
|
+
*
|
|
1345
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1346
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1347
|
+
*
|
|
1348
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1349
|
+
* list of conditions and the following disclaimer.
|
|
1350
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1351
|
+
* this list of conditions and the following disclaimer in the
|
|
1352
|
+
* documentation and/or other materials provided with the distribution.
|
|
1353
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1354
|
+
* may be used to endorse or promote products derived from this software without
|
|
1355
|
+
* specific prior written permission.
|
|
1356
|
+
*
|
|
1357
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1358
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1359
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1360
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1361
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1362
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1363
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1364
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1365
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1366
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1367
|
+
*)
|
|
1368
|
+
|
|
1369
|
+
smol-toml/dist/extract.js:
|
|
1370
|
+
(*!
|
|
1371
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1372
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1373
|
+
*
|
|
1374
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1375
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1376
|
+
*
|
|
1377
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1378
|
+
* list of conditions and the following disclaimer.
|
|
1379
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1380
|
+
* this list of conditions and the following disclaimer in the
|
|
1381
|
+
* documentation and/or other materials provided with the distribution.
|
|
1382
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1383
|
+
* may be used to endorse or promote products derived from this software without
|
|
1384
|
+
* specific prior written permission.
|
|
1385
|
+
*
|
|
1386
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1387
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1388
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1389
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1390
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1391
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1392
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1393
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1394
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1395
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1396
|
+
*)
|
|
1397
|
+
|
|
1398
|
+
smol-toml/dist/struct.js:
|
|
1399
|
+
(*!
|
|
1400
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1401
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1402
|
+
*
|
|
1403
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1404
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1405
|
+
*
|
|
1406
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1407
|
+
* list of conditions and the following disclaimer.
|
|
1408
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1409
|
+
* this list of conditions and the following disclaimer in the
|
|
1410
|
+
* documentation and/or other materials provided with the distribution.
|
|
1411
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1412
|
+
* may be used to endorse or promote products derived from this software without
|
|
1413
|
+
* specific prior written permission.
|
|
1414
|
+
*
|
|
1415
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1416
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1417
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1418
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1419
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1420
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1421
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1422
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1423
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1424
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1425
|
+
*)
|
|
1426
|
+
|
|
1427
|
+
smol-toml/dist/parse.js:
|
|
1428
|
+
(*!
|
|
1429
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1430
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1431
|
+
*
|
|
1432
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1433
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1434
|
+
*
|
|
1435
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1436
|
+
* list of conditions and the following disclaimer.
|
|
1437
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1438
|
+
* this list of conditions and the following disclaimer in the
|
|
1439
|
+
* documentation and/or other materials provided with the distribution.
|
|
1440
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1441
|
+
* may be used to endorse or promote products derived from this software without
|
|
1442
|
+
* specific prior written permission.
|
|
1443
|
+
*
|
|
1444
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1445
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1446
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1447
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1448
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1449
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1450
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1451
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1452
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1453
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1454
|
+
*)
|
|
1455
|
+
|
|
1456
|
+
smol-toml/dist/stringify.js:
|
|
1457
|
+
(*!
|
|
1458
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1459
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1460
|
+
*
|
|
1461
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1462
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1463
|
+
*
|
|
1464
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1465
|
+
* list of conditions and the following disclaimer.
|
|
1466
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1467
|
+
* this list of conditions and the following disclaimer in the
|
|
1468
|
+
* documentation and/or other materials provided with the distribution.
|
|
1469
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1470
|
+
* may be used to endorse or promote products derived from this software without
|
|
1471
|
+
* specific prior written permission.
|
|
1472
|
+
*
|
|
1473
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1474
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1475
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1476
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1477
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1478
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1479
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1480
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1481
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1482
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1483
|
+
*)
|
|
1484
|
+
|
|
1485
|
+
smol-toml/dist/index.js:
|
|
1486
|
+
(*!
|
|
1487
|
+
* Copyright (c) Squirrel Chat et al., All rights reserved.
|
|
1488
|
+
* SPDX-License-Identifier: BSD-3-Clause
|
|
1489
|
+
*
|
|
1490
|
+
* Redistribution and use in source and binary forms, with or without
|
|
1491
|
+
* modification, are permitted provided that the following conditions are met:
|
|
1492
|
+
*
|
|
1493
|
+
* 1. Redistributions of source code must retain the above copyright notice, this
|
|
1494
|
+
* list of conditions and the following disclaimer.
|
|
1495
|
+
* 2. Redistributions in binary form must reproduce the above copyright notice,
|
|
1496
|
+
* this list of conditions and the following disclaimer in the
|
|
1497
|
+
* documentation and/or other materials provided with the distribution.
|
|
1498
|
+
* 3. Neither the name of the copyright holder nor the names of its contributors
|
|
1499
|
+
* may be used to endorse or promote products derived from this software without
|
|
1500
|
+
* specific prior written permission.
|
|
1501
|
+
*
|
|
1502
|
+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
|
1503
|
+
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
|
1504
|
+
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
|
1505
|
+
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
|
1506
|
+
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
1507
|
+
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
|
1508
|
+
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
|
1509
|
+
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
|
1510
|
+
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
|
1511
|
+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
1512
|
+
*)
|
|
1513
|
+
*/
|
|
1514
|
+
//# sourceMappingURL=index.js.map
|