@sepveneto/dnde-agent 0.2.0 → 0.2.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/README.md +7 -6
- package/dist/agents.d.ts +2 -2
- package/dist/agents.d.ts.map +1 -1
- package/dist/{agent-DZUWgLKQ.js → chunks/agent-C7KN73yy.js} +16 -16
- package/dist/{index-DGG6v34-.js → chunks/index-DeZzIl57.js} +2615 -2608
- package/dist/editorDsl.d.ts.map +1 -1
- package/dist/element.js +32 -66274
- package/dist/index.js +11 -11
- package/package.json +2 -4
package/README.md
CHANGED
|
@@ -42,6 +42,7 @@ register({
|
|
|
42
42
|
- 主 Agent 的 `tools` 始终为空,只负责分诊和 handoff。
|
|
43
43
|
- 子 Agent 由宿主定义,或直接注入已经构造好的 Agents SDK `Agent`。
|
|
44
44
|
- 子 Agent 负责实际分析、业务查询和页面编辑。
|
|
45
|
+
- 子 Agent 完成任务后通过 `transfer_back_to_main` 将控制权交还主 Agent。
|
|
45
46
|
- 未提供匹配子 Agent 时,主 Agent 会说明当前能力不足,不会自行读取或修改页面。
|
|
46
47
|
|
|
47
48
|
这种边界可确保业务权限、工具实现和具体编辑策略不进入 Agent Runtime。
|
|
@@ -92,7 +93,8 @@ const pageAgent = new Agent({
|
|
|
92
93
|
instructions: [
|
|
93
94
|
'先调用 get_current_editor 和 get_widgets。',
|
|
94
95
|
'页面修改必须通过 apply_editor_dsl 提交完整、版本化的 DSL。',
|
|
95
|
-
'
|
|
96
|
+
'任务全部完成后调用 transfer_back_to_main 交还控制权。',
|
|
97
|
+
'需要用户补充信息时不要交还,等待用户回复后继续当前任务。',
|
|
96
98
|
].join('\n'),
|
|
97
99
|
tools: [
|
|
98
100
|
...editorTools,
|
|
@@ -104,9 +106,9 @@ const pageAgent = new Agent({
|
|
|
104
106
|
const subAgents: AgentSubAgent[] = [pageAgent]
|
|
105
107
|
```
|
|
106
108
|
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
运行时会创建子 Agent 的轻量副本,并追加 `transfer_back_to_main` handoff;模型、工具、
|
|
110
|
+
结构化输出和宿主原有的 `handoffs` 保持不变。子 Agent 完成任务后交还控制权,由主 Agent
|
|
111
|
+
统一回复用户。
|
|
110
112
|
|
|
111
113
|
只读子 Agent 不添加 `editorTools` 即可,不会自动获得文档修改能力。结构化输出等其它
|
|
112
114
|
SDK 能力直接在创建 Agent 时配置 `outputType`。
|
|
@@ -149,14 +151,13 @@ interface EditorDsl {
|
|
|
149
151
|
| {
|
|
150
152
|
op: 'delete'
|
|
151
153
|
uuid: string
|
|
152
|
-
confirmToken?: string
|
|
153
154
|
}
|
|
154
155
|
>
|
|
155
156
|
}
|
|
156
157
|
```
|
|
157
158
|
|
|
158
159
|
`baseRevision` 必须来自 `get_current_editor`。宿主在应用前校验 revision、组件能力、
|
|
159
|
-
|
|
160
|
+
字段作用域;整批操作由编辑器原子执行。
|
|
160
161
|
|
|
161
162
|
### 公开 DSL 工具
|
|
162
163
|
|
package/dist/agents.d.ts
CHANGED
|
@@ -13,7 +13,7 @@ export interface CreateAgentsOptions {
|
|
|
13
13
|
*/
|
|
14
14
|
export declare function createAgents(options: CreateAgentsOptions): {
|
|
15
15
|
agent: Agent<unknown, "text">;
|
|
16
|
-
subAgents:
|
|
17
|
-
agents: (
|
|
16
|
+
subAgents: Agent<any, any>[];
|
|
17
|
+
agents: (Agent<any, any> | Agent<unknown, "text">)[];
|
|
18
18
|
};
|
|
19
19
|
//# sourceMappingURL=agents.d.ts.map
|
package/dist/agents.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,
|
|
1
|
+
{"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../src/agents.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAW,MAAM,gBAAgB,CAAA;AAG/C,eAAO,MAAM,mBAAmB,kBAAkB,CAAA;AAClD,eAAO,MAAM,qBAAqB,6BAA6B,CAAA;AAG/D,8CAA8C;AAC9C,MAAM,MAAM,aAAa,GAAG,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,CAAA;AAE3C,MAAM,WAAW,mBAAmB;IAClC,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,SAAS,CAAC,EAAE,aAAa,EAAE,CAAA;CAC5B;AAmBD;;;GAGG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,mBAAmB;;;;EAyCxD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var V = Object.defineProperty;
|
|
2
2
|
var Q = (t, s, e) => s in t ? V(t, s, { enumerable: !0, configurable: !0, writable: !0, value: e }) : t[s] = e;
|
|
3
3
|
var a = (t, s, e) => Q(t, typeof s != "symbol" ? s + "" : s, e);
|
|
4
|
-
import { C as E,
|
|
4
|
+
import { C as E, l as x, m as X, t as v, o as I, s as y, n as Z, w as A, p as q, q as ee, u as te, v as k, x as R, y as C, i as se, S as ie, z as ne, B as re, E as ae } from "./index-DeZzIl57.js";
|
|
5
5
|
function oe(t) {
|
|
6
6
|
return t ? !(typeof t == "object" && t && "constructor" in t && typeof t.constructor == "function" ? t.constructor.name : "").includes("ChatCompletions") : !0;
|
|
7
7
|
}
|
|
@@ -280,9 +280,9 @@ function T(t) {
|
|
|
280
280
|
if (n.startsWith(D))
|
|
281
281
|
r = xe(s, i);
|
|
282
282
|
else if (n.startsWith(M))
|
|
283
|
-
r = Ie(s, i);
|
|
284
|
-
else if (n.startsWith(F))
|
|
285
283
|
r = ve(s, i);
|
|
284
|
+
else if (n.startsWith(F))
|
|
285
|
+
r = Ie(s, i);
|
|
286
286
|
else
|
|
287
287
|
return {
|
|
288
288
|
ok: !1,
|
|
@@ -320,7 +320,7 @@ function xe(t, s) {
|
|
|
320
320
|
nextIndex: s
|
|
321
321
|
};
|
|
322
322
|
}
|
|
323
|
-
function
|
|
323
|
+
function ve(t, s) {
|
|
324
324
|
const e = S(t[s], M);
|
|
325
325
|
return e ? (s += 1, s < t.length - 1 && !N(t[s]) ? { error: `Delete File patch for ${e} must not include a diff.` } : {
|
|
326
326
|
operation: {
|
|
@@ -330,7 +330,7 @@ function Ie(t, s) {
|
|
|
330
330
|
nextIndex: s
|
|
331
331
|
}) : { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
332
332
|
}
|
|
333
|
-
function
|
|
333
|
+
function Ie(t, s) {
|
|
334
334
|
const e = S(t[s], F);
|
|
335
335
|
if (!e)
|
|
336
336
|
return { error: `Missing path in apply_patch header: ${t[s]}` };
|
|
@@ -443,17 +443,17 @@ class Ee extends E {
|
|
|
443
443
|
return ke(o, f);
|
|
444
444
|
}
|
|
445
445
|
};
|
|
446
|
-
return G(this._modelInstance) ? r.push(
|
|
446
|
+
return G(this._modelInstance) ? r.push(v({
|
|
447
447
|
name: "view_image",
|
|
448
448
|
description: "Returns an image output from a path in the sandbox workspace or an explicitly granted sandbox path.",
|
|
449
|
-
parameters:
|
|
449
|
+
parameters: I({
|
|
450
450
|
path: y().describe("Path to an image file in the sandbox workspace or an explicitly granted sandbox path")
|
|
451
451
|
}),
|
|
452
452
|
execute: async ({ path: o }, h, c) => await l(o, c)
|
|
453
|
-
})) : r.push(
|
|
453
|
+
})) : r.push(v({
|
|
454
454
|
name: "view_image",
|
|
455
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:
|
|
456
|
+
parameters: I({
|
|
457
457
|
path: y().describe("Path to an image file in the sandbox workspace or an explicitly granted sandbox path")
|
|
458
458
|
}),
|
|
459
459
|
execute: async ({ path: o }, h, c) => we(await l(o, c))
|
|
@@ -499,10 +499,10 @@ class Ne extends E {
|
|
|
499
499
|
if (!e.execCommand)
|
|
500
500
|
throw new x("Shell sandbox sessions must provide execCommand().");
|
|
501
501
|
const i = [
|
|
502
|
-
|
|
502
|
+
v({
|
|
503
503
|
name: "exec_command",
|
|
504
504
|
description: "Runs a command in a PTY, returning output or a session ID for ongoing interaction.",
|
|
505
|
-
parameters:
|
|
505
|
+
parameters: I({
|
|
506
506
|
cmd: y().min(1).describe("Shell command to execute."),
|
|
507
507
|
workdir: y().optional().describe("Optional working directory to run the command in; defaults to the turn cwd."),
|
|
508
508
|
shell: y().optional().describe("Shell binary to launch. Defaults to the user's default shell."),
|
|
@@ -534,10 +534,10 @@ class Ne extends E {
|
|
|
534
534
|
}
|
|
535
535
|
})
|
|
536
536
|
];
|
|
537
|
-
return (n = e.supportsPty) != null && n.call(e) && e.writeStdin && i.push(
|
|
537
|
+
return (n = e.supportsPty) != null && n.call(e) && e.writeStdin && i.push(v({
|
|
538
538
|
name: "write_stdin",
|
|
539
539
|
description: "Writes characters to an existing unified exec session and returns recent output.",
|
|
540
|
-
parameters:
|
|
540
|
+
parameters: I({
|
|
541
541
|
session_id: k().int().describe("Identifier of the running unified exec session."),
|
|
542
542
|
chars: y().default("").describe("Bytes to write to stdin (may be empty to poll)."),
|
|
543
543
|
yield_time_ms: k().int().min(0).default(Fe).describe("How long to wait (in milliseconds) for output before yielding."),
|
|
@@ -607,12 +607,12 @@ function Le() {
|
|
|
607
607
|
const We = {
|
|
608
608
|
default: Le
|
|
609
609
|
};
|
|
610
|
-
var
|
|
611
|
-
class J extends (
|
|
610
|
+
var z, H;
|
|
611
|
+
class J extends (H = se, z = ie, H) {
|
|
612
612
|
constructor(e) {
|
|
613
613
|
var i, n;
|
|
614
614
|
super(e);
|
|
615
|
-
a(this,
|
|
615
|
+
a(this, z, !0);
|
|
616
616
|
a(this, "defaultManifest");
|
|
617
617
|
a(this, "baseInstructions");
|
|
618
618
|
a(this, "capabilities");
|