@sepveneto/dnde 0.8.0 → 0.8.2

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