@sepveneto/dnde-agent 0.1.1-beta.1 → 0.1.9
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/agent/core/sdk.d.ts +2 -2
- package/dist/agent/core/sdk.d.ts.map +1 -1
- package/dist/agent/runtime.d.ts +2 -2
- package/dist/agent/runtime.d.ts.map +1 -1
- package/dist/agent-BO7EhtdO.js +663 -0
- package/dist/composables/index.d.ts +2 -0
- package/dist/composables/index.d.ts.map +1 -0
- package/dist/composables/useFile.d.ts +14 -0
- package/dist/composables/useFile.d.ts.map +1 -0
- package/dist/element.d.ts.map +1 -1
- package/dist/element.js +9 -10
- package/dist/index-B4GzASvE.js +63165 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +38 -1137
- package/package.json +9 -7
|
@@ -0,0 +1,663 @@
|
|
|
1
|
+
var V = Object.defineProperty;
|
|
2
|
+
var Q = (t, s, e) => s in t ? V(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
|
+
var a = (t, s, e) => Q(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
+
import { C as E, U as x, r as X, t as I, o as v, s as y, a as Z, w as A, i as q, e as ee, A as te, n as k, b as R, p as C, c as se, S as ie, d as ne, M as re, f as ae } from "./index-B4GzASvE.js";
|
|
5
|
+
function oe(t) {
|
|
6
|
+
return t ? !(typeof t == "object" && t && "constructor" in t && typeof t.constructor == "function" ? t.constructor.name : "").includes("ChatCompletions") : !0;
|
|
7
|
+
}
|
|
8
|
+
function ce(t) {
|
|
9
|
+
return G(t);
|
|
10
|
+
}
|
|
11
|
+
function G(t) {
|
|
12
|
+
return t ? !(typeof t == "object" && t && "constructor" in t && typeof t.constructor == "function" ? t.constructor.name : "").includes("ChatCompletions") : !1;
|
|
13
|
+
}
|
|
14
|
+
class le {
|
|
15
|
+
}
|
|
16
|
+
class pe extends le {
|
|
17
|
+
constructor(e = 0.9, i = 24e4) {
|
|
18
|
+
super();
|
|
19
|
+
a(this, "thresholdRatio");
|
|
20
|
+
a(this, "fallbackThreshold");
|
|
21
|
+
if (!Number.isFinite(e) || e < 0 || e > 1)
|
|
22
|
+
throw new x("DynamicCompactionPolicy.thresholdRatio must be a finite number between 0 and 1.");
|
|
23
|
+
this.thresholdRatio = e, this.fallbackThreshold = i;
|
|
24
|
+
}
|
|
25
|
+
compactThreshold(e) {
|
|
26
|
+
if (!e)
|
|
27
|
+
return this.fallbackThreshold;
|
|
28
|
+
const i = g.forModel(e);
|
|
29
|
+
return i ? Math.floor(i.contextWindow * this.thresholdRatio) : this.fallbackThreshold;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
class g {
|
|
33
|
+
constructor(s) {
|
|
34
|
+
a(this, "contextWindow");
|
|
35
|
+
this.contextWindow = s;
|
|
36
|
+
}
|
|
37
|
+
static forModel(s) {
|
|
38
|
+
for (const e of de(s)) {
|
|
39
|
+
if (fe.has(e))
|
|
40
|
+
return new g(1047576);
|
|
41
|
+
if (me.has(e))
|
|
42
|
+
return new g(4e5);
|
|
43
|
+
if (ye.has(e))
|
|
44
|
+
return new g(2e5);
|
|
45
|
+
if (ge.has(e))
|
|
46
|
+
return new g(128e3);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
class ue extends E {
|
|
51
|
+
constructor(e = new pe()) {
|
|
52
|
+
super();
|
|
53
|
+
a(this, "type", "compaction");
|
|
54
|
+
a(this, "policy");
|
|
55
|
+
this.policy = e;
|
|
56
|
+
}
|
|
57
|
+
samplingParams(e) {
|
|
58
|
+
if (e.modelInstance && !oe(e.modelInstance))
|
|
59
|
+
return {};
|
|
60
|
+
const i = typeof e.model == "string" ? e.model : void 0;
|
|
61
|
+
return {
|
|
62
|
+
context_management: [
|
|
63
|
+
{
|
|
64
|
+
type: "compaction",
|
|
65
|
+
compact_threshold: this.policy.compactThreshold(i)
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
processContext(e) {
|
|
71
|
+
let i = -1;
|
|
72
|
+
for (let n = 0; n < e.length; n += 1)
|
|
73
|
+
e[n].type === "compaction" && (i = n);
|
|
74
|
+
return i === -1 ? e : e.slice(i);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function he(t = {}) {
|
|
78
|
+
return new ue(t.policy);
|
|
79
|
+
}
|
|
80
|
+
function de(t) {
|
|
81
|
+
const s = t.trim();
|
|
82
|
+
if (!s)
|
|
83
|
+
return [];
|
|
84
|
+
const i = (s.includes("/") ? s.slice(s.lastIndexOf("/") + 1) : s).toLowerCase(), n = i.replace(/-\d{4}-\d{2}-\d{2}$/u, "");
|
|
85
|
+
return [.../* @__PURE__ */ new Set([i, n])];
|
|
86
|
+
}
|
|
87
|
+
const fe = /* @__PURE__ */ new Set([
|
|
88
|
+
"gpt-5.6",
|
|
89
|
+
"gpt-5.6-sol",
|
|
90
|
+
"gpt-5.6-terra",
|
|
91
|
+
"gpt-5.6-luna",
|
|
92
|
+
"gpt-5.4",
|
|
93
|
+
"gpt-5.4-2026-03-05",
|
|
94
|
+
"gpt-5.4-pro",
|
|
95
|
+
"gpt-5.4-pro-2026-03-05",
|
|
96
|
+
"gpt-4.1",
|
|
97
|
+
"gpt-4.1-2025-04-14",
|
|
98
|
+
"gpt-4.1-mini",
|
|
99
|
+
"gpt-4.1-mini-2025-04-14",
|
|
100
|
+
"gpt-4.1-nano",
|
|
101
|
+
"gpt-4.1-nano-2025-04-14"
|
|
102
|
+
]), me = /* @__PURE__ */ new Set([
|
|
103
|
+
"gpt-5",
|
|
104
|
+
"gpt-5-codex",
|
|
105
|
+
"gpt-5-mini",
|
|
106
|
+
"gpt-5-nano",
|
|
107
|
+
"gpt-5-pro",
|
|
108
|
+
"gpt-5.1",
|
|
109
|
+
"gpt-5.1-codex",
|
|
110
|
+
"gpt-5.1-codex-max",
|
|
111
|
+
"gpt-5.1-codex-mini",
|
|
112
|
+
"gpt-5.2",
|
|
113
|
+
"gpt-5.2-codex",
|
|
114
|
+
"gpt-5.2-codex-cyber",
|
|
115
|
+
"gpt-5.2-pro",
|
|
116
|
+
"gpt-5.3-codex",
|
|
117
|
+
"gpt-5.3-codex-spark",
|
|
118
|
+
"gpt-5.4-mini",
|
|
119
|
+
"gpt-5.4-nano"
|
|
120
|
+
]), ye = /* @__PURE__ */ new Set([
|
|
121
|
+
"codex-mini-latest",
|
|
122
|
+
"o1",
|
|
123
|
+
"o1-2024-12-17",
|
|
124
|
+
"o1-pro",
|
|
125
|
+
"o3",
|
|
126
|
+
"o3-2025-04-16",
|
|
127
|
+
"o3-mini",
|
|
128
|
+
"o3-pro",
|
|
129
|
+
"o3-deep-research",
|
|
130
|
+
"o4-mini",
|
|
131
|
+
"o4-mini-2025-04-16",
|
|
132
|
+
"o4-mini-deep-research"
|
|
133
|
+
]), ge = /* @__PURE__ */ new Set([
|
|
134
|
+
"gpt-4o",
|
|
135
|
+
"gpt-4o-2024-08-06",
|
|
136
|
+
"gpt-4o-mini",
|
|
137
|
+
"gpt-4o-mini-2024-07-18",
|
|
138
|
+
"gpt-5-chat-latest",
|
|
139
|
+
"gpt-5.1-chat-latest",
|
|
140
|
+
"gpt-5.2-chat-latest",
|
|
141
|
+
"gpt-5.3-chat-latest"
|
|
142
|
+
]), be = {
|
|
143
|
+
type: "object",
|
|
144
|
+
properties: {
|
|
145
|
+
patch: {
|
|
146
|
+
type: "string",
|
|
147
|
+
description: "A freeform apply_patch payload wrapped in *** Begin Patch and *** End Patch."
|
|
148
|
+
},
|
|
149
|
+
operation: {
|
|
150
|
+
type: "object",
|
|
151
|
+
description: "A single structured apply_patch operation."
|
|
152
|
+
},
|
|
153
|
+
operations: {
|
|
154
|
+
type: "array",
|
|
155
|
+
items: { type: "object" },
|
|
156
|
+
description: "Structured apply_patch operations to apply in order."
|
|
157
|
+
},
|
|
158
|
+
command: {
|
|
159
|
+
type: "array",
|
|
160
|
+
description: 'Optional ["apply_patch", patch] command tuple form.'
|
|
161
|
+
},
|
|
162
|
+
type: {
|
|
163
|
+
type: "string",
|
|
164
|
+
enum: ["create_file", "update_file", "delete_file"],
|
|
165
|
+
description: "The patch operation to apply."
|
|
166
|
+
},
|
|
167
|
+
path: {
|
|
168
|
+
type: "string",
|
|
169
|
+
description: "The sandbox file path to patch."
|
|
170
|
+
},
|
|
171
|
+
diff: {
|
|
172
|
+
type: "string",
|
|
173
|
+
description: "The V4A patch diff for create_file and update_file operations."
|
|
174
|
+
},
|
|
175
|
+
moveTo: {
|
|
176
|
+
type: "string",
|
|
177
|
+
description: "Optional destination path for update_file move operations."
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
required: [],
|
|
181
|
+
additionalProperties: !0
|
|
182
|
+
}, P = "*** Begin Patch", j = "*** End Patch", D = "*** Add File: ", M = "*** Delete File: ", F = "*** Update File: ", K = "*** Move to: ";
|
|
183
|
+
function O(t) {
|
|
184
|
+
if (t instanceof Error)
|
|
185
|
+
return t.message || t.toString();
|
|
186
|
+
try {
|
|
187
|
+
return JSON.stringify(t);
|
|
188
|
+
} catch (s) {
|
|
189
|
+
return String(t);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function we(t) {
|
|
193
|
+
if (typeof t == "string")
|
|
194
|
+
return t;
|
|
195
|
+
const s = t.image;
|
|
196
|
+
if (typeof s == "string")
|
|
197
|
+
return s;
|
|
198
|
+
if (!q(s))
|
|
199
|
+
return "No image data was returned by the sandbox session.";
|
|
200
|
+
const e = s;
|
|
201
|
+
return typeof e.url == "string" ? e.url : typeof e.fileId == "string" ? `OpenAI file reference: ${e.fileId}` : typeof e.data == "string" ? `data:${typeof e.mediaType == "string" ? e.mediaType : "application/octet-stream"};base64,${e.data}` : e.data instanceof Uint8Array ? `data:${typeof e.mediaType == "string" ? e.mediaType : "application/octet-stream"};base64,${ee(e.data)}` : "No image data was returned by the sandbox session.";
|
|
202
|
+
}
|
|
203
|
+
function ke(t, s) {
|
|
204
|
+
const e = O(s);
|
|
205
|
+
if (/not found/iu.test(e))
|
|
206
|
+
return `image path \`${t}\` was not found`;
|
|
207
|
+
if (/not a file/iu.test(e))
|
|
208
|
+
return `image path \`${t}\` is not a file`;
|
|
209
|
+
if (/exceeds the 10 MB limit|exceeded the allowed size/iu.test(e))
|
|
210
|
+
return `image path \`${t}\` exceeded the allowed size of 10MB; resize or compress the image and try again`;
|
|
211
|
+
if (/unsupported image format|not a supported image/iu.test(e))
|
|
212
|
+
return `image path \`${t}\` is not a supported image file`;
|
|
213
|
+
const i = s instanceof Error ? s.name : typeof s;
|
|
214
|
+
return `unable to read image at \`${t}\`: ${i}`;
|
|
215
|
+
}
|
|
216
|
+
function _e(t) {
|
|
217
|
+
const s = t.trimStart();
|
|
218
|
+
if (s.startsWith(P))
|
|
219
|
+
return T(s);
|
|
220
|
+
let e;
|
|
221
|
+
try {
|
|
222
|
+
e = JSON.parse(t);
|
|
223
|
+
} catch (i) {
|
|
224
|
+
return {
|
|
225
|
+
ok: !1,
|
|
226
|
+
error: `Invalid apply_patch JSON: ${O(i)}`
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
return Te(e);
|
|
230
|
+
}
|
|
231
|
+
function Te(t) {
|
|
232
|
+
if (typeof t == "string")
|
|
233
|
+
return T(t);
|
|
234
|
+
if (Array.isArray(t))
|
|
235
|
+
return _(t);
|
|
236
|
+
if (!q(t))
|
|
237
|
+
return {
|
|
238
|
+
ok: !1,
|
|
239
|
+
error: "apply_patch input must be an object or array."
|
|
240
|
+
};
|
|
241
|
+
if (typeof t.patch == "string")
|
|
242
|
+
return T(t.patch);
|
|
243
|
+
if (Array.isArray(t.command)) {
|
|
244
|
+
const [s, e] = t.command;
|
|
245
|
+
if (s === "apply_patch" && typeof e == "string")
|
|
246
|
+
return T(e);
|
|
247
|
+
}
|
|
248
|
+
return Array.isArray(t.operations) ? _(t.operations) : t.operation !== void 0 ? _([t.operation]) : _([t]);
|
|
249
|
+
}
|
|
250
|
+
function _(t) {
|
|
251
|
+
const s = [];
|
|
252
|
+
for (const e of t) {
|
|
253
|
+
const i = te.safeParse(e);
|
|
254
|
+
if (!i.success)
|
|
255
|
+
return {
|
|
256
|
+
ok: !1,
|
|
257
|
+
error: `Invalid apply_patch operation: ${i.error.message}`
|
|
258
|
+
};
|
|
259
|
+
s.push(i.data);
|
|
260
|
+
}
|
|
261
|
+
return s.length === 0 ? { ok: !1, error: "apply_patch input must include an operation." } : { ok: !0, operations: s };
|
|
262
|
+
}
|
|
263
|
+
function T(t) {
|
|
264
|
+
const s = t.split(/\r?\n/);
|
|
265
|
+
if (s.at(-1) === "" && s.pop(), s[0] !== P)
|
|
266
|
+
return {
|
|
267
|
+
ok: !1,
|
|
268
|
+
error: `apply_patch input must start with "${P}".`
|
|
269
|
+
};
|
|
270
|
+
if (s.length < 2 || s.at(-1) !== j)
|
|
271
|
+
return {
|
|
272
|
+
ok: !1,
|
|
273
|
+
error: `apply_patch input must end with "${j}".`
|
|
274
|
+
};
|
|
275
|
+
const e = [];
|
|
276
|
+
let i = 1;
|
|
277
|
+
for (; i < s.length - 1; ) {
|
|
278
|
+
const n = s[i];
|
|
279
|
+
let r;
|
|
280
|
+
if (n.startsWith(D))
|
|
281
|
+
r = xe(s, i);
|
|
282
|
+
else if (n.startsWith(M))
|
|
283
|
+
r = Ie(s, i);
|
|
284
|
+
else if (n.startsWith(F))
|
|
285
|
+
r = ve(s, i);
|
|
286
|
+
else
|
|
287
|
+
return {
|
|
288
|
+
ok: !1,
|
|
289
|
+
error: `Invalid apply_patch file operation header: ${n}`
|
|
290
|
+
};
|
|
291
|
+
if ("error" in r)
|
|
292
|
+
return { ok: !1, error: r.error };
|
|
293
|
+
e.push(r.operation), i = r.nextIndex;
|
|
294
|
+
}
|
|
295
|
+
return e.length === 0 ? {
|
|
296
|
+
ok: !1,
|
|
297
|
+
error: "apply_patch input must include at least one file operation."
|
|
298
|
+
} : { ok: !0, operations: e };
|
|
299
|
+
}
|
|
300
|
+
function xe(t, s) {
|
|
301
|
+
const e = S(t[s], D);
|
|
302
|
+
if (!e)
|
|
303
|
+
return { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
304
|
+
s += 1;
|
|
305
|
+
const i = [];
|
|
306
|
+
for (; s < t.length - 1 && !N(t[s]); ) {
|
|
307
|
+
const n = t[s];
|
|
308
|
+
if (!n.startsWith("+"))
|
|
309
|
+
return { error: `Invalid Add File line: ${n}` };
|
|
310
|
+
i.push(n), s += 1;
|
|
311
|
+
}
|
|
312
|
+
return i.length === 0 ? {
|
|
313
|
+
error: `Add File patch for ${e} must include at least one + line.`
|
|
314
|
+
} : {
|
|
315
|
+
operation: {
|
|
316
|
+
type: "create_file",
|
|
317
|
+
path: e,
|
|
318
|
+
diff: Y(i)
|
|
319
|
+
},
|
|
320
|
+
nextIndex: s
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function Ie(t, s) {
|
|
324
|
+
const e = S(t[s], M);
|
|
325
|
+
return e ? (s += 1, s < t.length - 1 && !N(t[s]) ? { error: `Delete File patch for ${e} must not include a diff.` } : {
|
|
326
|
+
operation: {
|
|
327
|
+
type: "delete_file",
|
|
328
|
+
path: e
|
|
329
|
+
},
|
|
330
|
+
nextIndex: s
|
|
331
|
+
}) : { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
332
|
+
}
|
|
333
|
+
function ve(t, s) {
|
|
334
|
+
const e = S(t[s], F);
|
|
335
|
+
if (!e)
|
|
336
|
+
return { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
337
|
+
s += 1;
|
|
338
|
+
let i;
|
|
339
|
+
if (s < t.length - 1 && t[s].startsWith(K)) {
|
|
340
|
+
const r = S(t[s], K);
|
|
341
|
+
if (!r)
|
|
342
|
+
return { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
343
|
+
i = r, s += 1;
|
|
344
|
+
}
|
|
345
|
+
const n = [];
|
|
346
|
+
for (; s < t.length - 1 && !N(t[s]); )
|
|
347
|
+
n.push(t[s]), s += 1;
|
|
348
|
+
return n.length === 0 && !i ? { error: `Update File patch for ${e} must include a hunk.` } : {
|
|
349
|
+
operation: {
|
|
350
|
+
type: "update_file",
|
|
351
|
+
path: e,
|
|
352
|
+
diff: n.length > 0 ? Y(n) : "",
|
|
353
|
+
...i ? { moveTo: i } : {}
|
|
354
|
+
},
|
|
355
|
+
nextIndex: s
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
function S(t, s) {
|
|
359
|
+
const e = t.slice(s.length).trim();
|
|
360
|
+
return e || null;
|
|
361
|
+
}
|
|
362
|
+
function N(t) {
|
|
363
|
+
return t.startsWith(D) || t.startsWith(M) || t.startsWith(F);
|
|
364
|
+
}
|
|
365
|
+
function Y(t) {
|
|
366
|
+
return `${t.join(`
|
|
367
|
+
`)}
|
|
368
|
+
`;
|
|
369
|
+
}
|
|
370
|
+
async function Se(t, s, e) {
|
|
371
|
+
var n;
|
|
372
|
+
let i;
|
|
373
|
+
try {
|
|
374
|
+
switch (s.type) {
|
|
375
|
+
case "create_file":
|
|
376
|
+
i = await t.createFile(s, { runContext: e });
|
|
377
|
+
break;
|
|
378
|
+
case "update_file":
|
|
379
|
+
i = await t.updateFile(s, { runContext: e });
|
|
380
|
+
break;
|
|
381
|
+
case "delete_file":
|
|
382
|
+
i = await t.deleteFile(s, { runContext: e });
|
|
383
|
+
break;
|
|
384
|
+
default:
|
|
385
|
+
return "Unsupported apply_patch operation.";
|
|
386
|
+
}
|
|
387
|
+
} catch (r) {
|
|
388
|
+
return `Failed to apply patch: ${O(r)}`;
|
|
389
|
+
}
|
|
390
|
+
return (i == null ? void 0 : i.status) === "failed" ? i.output ? `Patch failed: ${i.output}` : "Patch failed." : (n = i == null ? void 0 : i.output) != null ? n : "Patch applied.";
|
|
391
|
+
}
|
|
392
|
+
async function Ae(t, s, e) {
|
|
393
|
+
const i = [];
|
|
394
|
+
for (const n of s) {
|
|
395
|
+
const r = await Se(t, n, e);
|
|
396
|
+
r && i.push(r);
|
|
397
|
+
}
|
|
398
|
+
return i.join(`
|
|
399
|
+
`) || "Patch applied.";
|
|
400
|
+
}
|
|
401
|
+
function Pe(t) {
|
|
402
|
+
return {
|
|
403
|
+
type: "function",
|
|
404
|
+
name: "apply_patch",
|
|
405
|
+
description: "Applies a create, update, move, or delete file patch in the sandbox workspace. Accepts a freeform patch string or structured apply_patch operations.",
|
|
406
|
+
parameters: be,
|
|
407
|
+
strict: !1,
|
|
408
|
+
deferLoading: !1,
|
|
409
|
+
needsApproval: async () => !1,
|
|
410
|
+
isEnabled: async () => !0,
|
|
411
|
+
invoke: async (e, i) => {
|
|
412
|
+
const n = _e(i);
|
|
413
|
+
return n.ok ? await Ae(t, n.operations, e) : n.error;
|
|
414
|
+
}
|
|
415
|
+
};
|
|
416
|
+
}
|
|
417
|
+
class Ee extends E {
|
|
418
|
+
constructor(e = {}) {
|
|
419
|
+
super();
|
|
420
|
+
a(this, "type", "filesystem");
|
|
421
|
+
a(this, "configureTools");
|
|
422
|
+
this.configureTools = e.configureTools;
|
|
423
|
+
}
|
|
424
|
+
tools() {
|
|
425
|
+
var p, u;
|
|
426
|
+
const e = X(this.type, this._session), i = (p = e.createEditor) == null ? void 0 : p.call(e, this._runAs);
|
|
427
|
+
if (!i)
|
|
428
|
+
throw new x("Filesystem sandbox sessions must provide createEditor().");
|
|
429
|
+
const n = (u = this._workspaceScope) != null && u.cwd ? Ce(i, this._workspaceScope) : i, r = [], l = async (o, h) => {
|
|
430
|
+
var m, d;
|
|
431
|
+
if (!e.viewImage)
|
|
432
|
+
throw new x("Filesystem sandbox sessions must provide viewImage().");
|
|
433
|
+
const c = (d = (m = this._workspaceScope) == null ? void 0 : m.anchor(o)) != null ? d : o;
|
|
434
|
+
try {
|
|
435
|
+
return await A("sandbox.view_image", {
|
|
436
|
+
path: c,
|
|
437
|
+
run_as: this._runAs
|
|
438
|
+
}, async () => await e.viewImage({
|
|
439
|
+
path: c,
|
|
440
|
+
runAs: this._runAs
|
|
441
|
+
}), this.tracingParent(h));
|
|
442
|
+
} catch (f) {
|
|
443
|
+
return ke(o, f);
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
return G(this._modelInstance) ? r.push(I({
|
|
447
|
+
name: "view_image",
|
|
448
|
+
description: "Returns an image output from a path in the sandbox workspace or an explicitly granted sandbox path.",
|
|
449
|
+
parameters: v({
|
|
450
|
+
path: y().describe("Path to an image file in the sandbox workspace or an explicitly granted sandbox path")
|
|
451
|
+
}),
|
|
452
|
+
execute: async ({ path: o }, h, c) => await l(o, c)
|
|
453
|
+
})) : r.push(I({
|
|
454
|
+
name: "view_image",
|
|
455
|
+
description: "Returns an image from a path in the sandbox workspace or an explicitly granted sandbox path as a data URL or reference string.",
|
|
456
|
+
parameters: v({
|
|
457
|
+
path: y().describe("Path to an image file in the sandbox workspace or an explicitly granted sandbox path")
|
|
458
|
+
}),
|
|
459
|
+
execute: async ({ path: o }, h, c) => we(await l(o, c))
|
|
460
|
+
})), ce(this._modelInstance) ? r.push(Z({
|
|
461
|
+
name: "apply_patch",
|
|
462
|
+
editor: n
|
|
463
|
+
})) : r.push(Pe(n)), this.configureTools ? this.configureTools([...r]) : r;
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
function Ce(t, s) {
|
|
467
|
+
return {
|
|
468
|
+
createFile: async (e, i) => await t.createFile({ ...e, path: s.anchor(e.path) }, i),
|
|
469
|
+
updateFile: async (e, i) => await t.updateFile({
|
|
470
|
+
...e,
|
|
471
|
+
path: s.anchor(e.path),
|
|
472
|
+
...e.moveTo ? { moveTo: s.anchor(e.moveTo) } : {}
|
|
473
|
+
}, i),
|
|
474
|
+
deleteFile: async (e, i) => await t.deleteFile({ ...e, path: s.anchor(e.path) }, i)
|
|
475
|
+
};
|
|
476
|
+
}
|
|
477
|
+
function De(t = {}) {
|
|
478
|
+
return new Ee(t);
|
|
479
|
+
}
|
|
480
|
+
const Me = 1e4, Fe = 250, Oe = [
|
|
481
|
+
"When using the shell:",
|
|
482
|
+
"- Use `exec_command` for shell execution.",
|
|
483
|
+
"- If available, use `write_stdin` to interact with or poll running sessions.",
|
|
484
|
+
"- To interrupt a long-running process via `write_stdin`, start it with `tty=true` and send Ctrl-C (`\\u0003`).",
|
|
485
|
+
"- Prefer `rg` and `rg --files` for text/file discovery when available.",
|
|
486
|
+
"- Avoid using Python scripts just to print large file chunks."
|
|
487
|
+
].join(`
|
|
488
|
+
`);
|
|
489
|
+
class Ne extends E {
|
|
490
|
+
constructor(e = {}) {
|
|
491
|
+
super();
|
|
492
|
+
a(this, "type", "shell");
|
|
493
|
+
a(this, "configureTools");
|
|
494
|
+
this.configureTools = e.configureTools;
|
|
495
|
+
}
|
|
496
|
+
tools() {
|
|
497
|
+
var n;
|
|
498
|
+
const e = X(this.type, this._session);
|
|
499
|
+
if (!e.execCommand)
|
|
500
|
+
throw new x("Shell sandbox sessions must provide execCommand().");
|
|
501
|
+
const i = [
|
|
502
|
+
I({
|
|
503
|
+
name: "exec_command",
|
|
504
|
+
description: "Runs a command in a PTY, returning output or a session ID for ongoing interaction.",
|
|
505
|
+
parameters: v({
|
|
506
|
+
cmd: y().min(1).describe("Shell command to execute."),
|
|
507
|
+
workdir: y().optional().describe("Optional working directory to run the command in; defaults to the turn cwd."),
|
|
508
|
+
shell: y().optional().describe("Shell binary to launch. Defaults to the user's default shell."),
|
|
509
|
+
login: R().default(!0).describe("Whether to run the shell with -l/-i semantics. Defaults to true."),
|
|
510
|
+
tty: R().default(!1).describe("Whether to allocate a TTY for the command. Defaults to false (plain pipes); set to true to open a PTY and access TTY process."),
|
|
511
|
+
yield_time_ms: k().int().min(0).default(Me).describe("How long to wait (in milliseconds) for output before yielding."),
|
|
512
|
+
max_output_tokens: k().int().min(1).optional().describe("Maximum number of tokens to return. Excess output will be truncated.")
|
|
513
|
+
}),
|
|
514
|
+
execute: async ({ cmd: r, workdir: l, shell: p, login: u, tty: o, yield_time_ms: h, max_output_tokens: c }, m, d) => {
|
|
515
|
+
var b, w;
|
|
516
|
+
const f = (w = (b = this._workspaceScope) == null ? void 0 : b.anchor(l)) != null ? w : l;
|
|
517
|
+
return await A("sandbox.exec", {
|
|
518
|
+
cmd: r,
|
|
519
|
+
workdir: f,
|
|
520
|
+
shell: p,
|
|
521
|
+
login: u,
|
|
522
|
+
tty: o,
|
|
523
|
+
run_as: this._runAs
|
|
524
|
+
}, async () => await e.execCommand({
|
|
525
|
+
cmd: r,
|
|
526
|
+
workdir: f,
|
|
527
|
+
shell: p,
|
|
528
|
+
login: u,
|
|
529
|
+
tty: o,
|
|
530
|
+
yieldTimeMs: h,
|
|
531
|
+
maxOutputTokens: c,
|
|
532
|
+
runAs: this._runAs
|
|
533
|
+
}), this.tracingParent(d));
|
|
534
|
+
}
|
|
535
|
+
})
|
|
536
|
+
];
|
|
537
|
+
return (n = e.supportsPty) != null && n.call(e) && e.writeStdin && i.push(I({
|
|
538
|
+
name: "write_stdin",
|
|
539
|
+
description: "Writes characters to an existing unified exec session and returns recent output.",
|
|
540
|
+
parameters: v({
|
|
541
|
+
session_id: k().int().describe("Identifier of the running unified exec session."),
|
|
542
|
+
chars: y().default("").describe("Bytes to write to stdin (may be empty to poll)."),
|
|
543
|
+
yield_time_ms: k().int().min(0).default(Fe).describe("How long to wait (in milliseconds) for output before yielding."),
|
|
544
|
+
max_output_tokens: k().int().min(1).optional().describe("Maximum number of tokens to return. Excess output will be truncated.")
|
|
545
|
+
}),
|
|
546
|
+
execute: async ({ session_id: r, chars: l, yield_time_ms: p, max_output_tokens: u }, o, h) => await A("sandbox.write_stdin", {
|
|
547
|
+
session_id: r
|
|
548
|
+
}, async () => await e.writeStdin({
|
|
549
|
+
sessionId: r,
|
|
550
|
+
chars: l,
|
|
551
|
+
yieldTimeMs: p,
|
|
552
|
+
maxOutputTokens: u
|
|
553
|
+
}), this.tracingParent(h))
|
|
554
|
+
})), this.configureTools ? this.configureTools([...i]) : i;
|
|
555
|
+
}
|
|
556
|
+
instructions() {
|
|
557
|
+
return Oe;
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
function $e(t = {}) {
|
|
561
|
+
return new Ne(t);
|
|
562
|
+
}
|
|
563
|
+
C`
|
|
564
|
+
A skill is a set of local instructions to follow that is stored in a \`SKILL.md\` file. Below is the list of skills that can be used. Each entry includes a name, description, and file path so you can open the source for full instructions when using a specific skill.
|
|
565
|
+
`;
|
|
566
|
+
C`
|
|
567
|
+
### How to use skills
|
|
568
|
+
- Discovery: The list above is the skills available in this session (name + description + file path). Skill bodies live on disk at the listed paths.
|
|
569
|
+
- Trigger rules: If the user names a skill (with \`$SkillName\` or plain text) OR the task clearly matches a skill's description shown above, you must use that skill for that turn. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned.
|
|
570
|
+
- Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback.
|
|
571
|
+
- How to use a skill (progressive disclosure):
|
|
572
|
+
1) After deciding to use a skill, open its \`SKILL.md\`. Read only enough to follow the workflow.
|
|
573
|
+
2) If \`SKILL.md\` points to extra folders such as \`references/\`, load only the specific files needed for the request; don't bulk-load everything.
|
|
574
|
+
3) If \`scripts/\` exist, prefer running or patching them instead of retyping large code blocks.
|
|
575
|
+
4) If \`assets/\` or templates exist, reuse them instead of recreating from scratch.
|
|
576
|
+
- Coordination and sequencing:
|
|
577
|
+
- If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them.
|
|
578
|
+
- Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why.
|
|
579
|
+
- Context hygiene:
|
|
580
|
+
- Keep context small: summarize long sections instead of pasting them; only load extra files when needed.
|
|
581
|
+
- Avoid deep reference-chasing: prefer opening only files directly linked from \`SKILL.md\` unless you're blocked.
|
|
582
|
+
- When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice.
|
|
583
|
+
- Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue.
|
|
584
|
+
`;
|
|
585
|
+
C`
|
|
586
|
+
### How to use skills
|
|
587
|
+
- Discovery: The list above is the skill index available in this session (name + description + workspace path). In lazy mode, those paths are loaded on demand instead of being present up front.
|
|
588
|
+
- Trigger rules: If the user names a skill (with \`$SkillName\` or plain text) OR the task clearly matches a skill's description shown above, you must use that skill for that turn. Multiple mentions mean use them all. Do not carry skills across turns unless re-mentioned.
|
|
589
|
+
- Missing/blocked: If a named skill isn't in the list or the path can't be read, say so briefly and continue with the best fallback.
|
|
590
|
+
- How to use a skill (progressive disclosure):
|
|
591
|
+
1) After deciding to use a lazy skill, call \`load_skill\` for that skill first, then open its \`SKILL.md\`.
|
|
592
|
+
2) If \`SKILL.md\` points to extra folders such as \`references/\`, load only the specific files needed for the request; don't bulk-load everything.
|
|
593
|
+
3) If \`scripts/\` exist, prefer running or patching them instead of retyping large code blocks.
|
|
594
|
+
4) If \`assets/\` or templates exist, reuse them instead of recreating from scratch.
|
|
595
|
+
- Coordination and sequencing:
|
|
596
|
+
- If multiple skills apply, choose the minimal set that covers the request and state the order you'll use them.
|
|
597
|
+
- Announce which skill(s) you're using and why (one short line). If you skip an obvious skill, say why.
|
|
598
|
+
- Context hygiene:
|
|
599
|
+
- Keep context small: summarize long sections instead of pasting them; only load extra files when needed.
|
|
600
|
+
- Avoid deep reference-chasing: prefer opening only files directly linked from \`SKILL.md\` unless you're blocked.
|
|
601
|
+
- When variants exist (frameworks, providers, domains), pick only the relevant reference file(s) and note that choice.
|
|
602
|
+
- Safety and fallback: If a skill can't be applied cleanly (missing files, unclear instructions), state the issue, pick the next-best approach, and continue.
|
|
603
|
+
`;
|
|
604
|
+
function Le() {
|
|
605
|
+
return [De(), $e(), he()];
|
|
606
|
+
}
|
|
607
|
+
const We = {
|
|
608
|
+
default: Le
|
|
609
|
+
};
|
|
610
|
+
var H, z;
|
|
611
|
+
class J extends (z = se, H = ie, z) {
|
|
612
|
+
constructor(e) {
|
|
613
|
+
var i, n;
|
|
614
|
+
super(e);
|
|
615
|
+
a(this, H, !0);
|
|
616
|
+
a(this, "defaultManifest");
|
|
617
|
+
a(this, "baseInstructions");
|
|
618
|
+
a(this, "capabilities");
|
|
619
|
+
a(this, "runAs");
|
|
620
|
+
a(this, "runtimeManifest");
|
|
621
|
+
if (e.baseInstructions !== void 0 && typeof e.baseInstructions != "string" && typeof e.baseInstructions != "function")
|
|
622
|
+
throw new TypeError("SandboxAgent baseInstructions must be a string or function.");
|
|
623
|
+
this.defaultManifest = e.defaultManifest ? ne(e.defaultManifest) : void 0, this.baseInstructions = e.baseInstructions, this.capabilities = (i = e.capabilities) != null ? i : We.default(), this.runAs = Be(e.runAs), this.runtimeManifest = (n = this.defaultManifest) != null ? n : new re();
|
|
624
|
+
}
|
|
625
|
+
clone(e) {
|
|
626
|
+
var i, n, r, l, p, u, o, h, c, m, d, f, b, w, $, L, W, B, U;
|
|
627
|
+
return new J({
|
|
628
|
+
name: (i = e.name) != null ? i : this.name,
|
|
629
|
+
instructions: (n = e.instructions) != null ? n : this.instructions,
|
|
630
|
+
prompt: (r = e.prompt) != null ? r : this.prompt,
|
|
631
|
+
handoffDescription: (l = e.handoffDescription) != null ? l : this.handoffDescription,
|
|
632
|
+
handoffs: (p = e.handoffs) != null ? p : this.handoffs,
|
|
633
|
+
model: (u = e.model) != null ? u : this.model,
|
|
634
|
+
modelSettings: (o = e.modelSettings) != null ? o : this.modelSettings,
|
|
635
|
+
tools: (h = e.tools) != null ? h : this.tools,
|
|
636
|
+
mcpServers: (c = e.mcpServers) != null ? c : this.mcpServers,
|
|
637
|
+
mcpConfig: (m = e.mcpConfig) != null ? m : this.mcpConfig,
|
|
638
|
+
inputGuardrails: (d = e.inputGuardrails) != null ? d : this.inputGuardrails,
|
|
639
|
+
outputGuardrails: (f = e.outputGuardrails) != null ? f : this.outputGuardrails,
|
|
640
|
+
outputType: (b = e.outputType) != null ? b : this.outputType,
|
|
641
|
+
toolUseBehavior: (w = e.toolUseBehavior) != null ? w : this.toolUseBehavior,
|
|
642
|
+
resetToolChoice: ($ = e.resetToolChoice) != null ? $ : this.resetToolChoice,
|
|
643
|
+
defaultManifest: (L = e.defaultManifest) != null ? L : this.defaultManifest,
|
|
644
|
+
baseInstructions: (W = e.baseInstructions) != null ? W : this.baseInstructions,
|
|
645
|
+
capabilities: (B = e.capabilities) != null ? B : this.capabilities,
|
|
646
|
+
runAs: (U = e.runAs) != null ? U : this.runAs
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
}
|
|
650
|
+
function Be(t) {
|
|
651
|
+
if (t !== void 0) {
|
|
652
|
+
if (typeof t == "string") {
|
|
653
|
+
const s = t.trim();
|
|
654
|
+
if (!s)
|
|
655
|
+
throw new TypeError("SandboxAgent runAs must be non-empty.");
|
|
656
|
+
return s;
|
|
657
|
+
}
|
|
658
|
+
return ae(t);
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
export {
|
|
662
|
+
J as SandboxAgent
|
|
663
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/composables/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAA"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from "vue";
|
|
2
|
+
export declare function useFile(file: Ref<HTMLInputElement | null>): {
|
|
3
|
+
list: import("vue").ShallowRef<{
|
|
4
|
+
name: string;
|
|
5
|
+
file: string;
|
|
6
|
+
}[], {
|
|
7
|
+
name: string;
|
|
8
|
+
file: string;
|
|
9
|
+
}[]>;
|
|
10
|
+
selectFile: () => void;
|
|
11
|
+
handleFileChange: (e: Event) => Promise<void>;
|
|
12
|
+
reset: () => void;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=useFile.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFile.d.ts","sourceRoot":"","sources":["../../src/composables/useFile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,GAAG,EAAE,MAAM,KAAK,CAAC;AAEtC,wBAAgB,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,gBAAgB,GAAG,IAAI,CAAC;;cACxB,MAAM;cAAQ,MAAM;;cAApB,MAAM;cAAQ,MAAM;;;0BASjB,KAAK;;EAuBzC"}
|
package/dist/element.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,KAAK,CAAA;
|
|
1
|
+
{"version":3,"file":"element.d.ts","sourceRoot":"","sources":["../src/element.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,KAAK,CAAA;AAGhD,cAAc,SAAS,CAAA;AAMvB;;GAEG;AACH,wBAAgB,eAAe,IAAI,qBAAqB,CAMvD;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAyB,GAAG,MAAM,GAAG,SAAS,CAU3F;AAKD,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAC7B,WAAW,EAAE,WAAW,CAAA;KACzB;CACF"}
|