@dudko.dev/agent-web-ui 0.0.2 → 0.0.4
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 +83 -4
- package/dist/canvas.cjs +0 -1
- package/dist/canvas.js +1 -2
- package/dist/{chunk-WFM6B7CL.js → chunk-627OXMFG.js} +2 -1
- package/dist/{chunk-EL2YCROY.js → chunk-D64VLIRY.js} +0 -1
- package/dist/{chunk-ZBHESK6V.js → chunk-G7LQTOA2.js} +0 -1
- package/dist/{chunk-SVYHDLAZ.js → chunk-S5AHUAFG.js} +0 -1
- package/dist/{chunk-7O64ZI6Z.js → chunk-TJBGZM6D.js} +0 -1
- package/dist/{chunk-VCR7LU7J.js → chunk-V33T6VX3.js} +0 -1
- package/dist/{chunk-WZ7K7JIP.js → chunk-VZCQXE3P.js} +0 -1
- package/dist/{chunk-GB7RZJMG.js → chunk-WEYQMUKY.js} +0 -1
- package/dist/{chunk-KZQB35LS.js → chunk-Y6QYUFSC.js} +0 -1
- package/dist/controller.cjs +560 -6
- package/dist/controller.d.cts +110 -3
- package/dist/controller.d.ts +110 -3
- package/dist/controller.js +556 -6
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +4 -4
- package/dist/{labels-DH1ESUtm.d.ts → labels-BJMtk5Fw.d.ts} +2 -0
- package/dist/{labels-CmiTBLWD.d.cts → labels-B_y8F1GW.d.cts} +2 -0
- package/dist/locales/be.cjs +2 -1
- package/dist/locales/be.js +1 -2
- package/dist/locales/bg.cjs +2 -1
- package/dist/locales/bg.js +1 -2
- package/dist/locales/ca.cjs +2 -1
- package/dist/locales/ca.js +1 -2
- package/dist/locales/cs.cjs +2 -1
- package/dist/locales/cs.js +1 -2
- package/dist/locales/da.cjs +2 -1
- package/dist/locales/da.js +1 -2
- package/dist/locales/de.cjs +2 -1
- package/dist/locales/de.js +1 -2
- package/dist/locales/el.cjs +2 -1
- package/dist/locales/el.js +1 -2
- package/dist/locales/en.cjs +2 -1
- package/dist/locales/en.js +1 -2
- package/dist/locales/es-419.cjs +2 -1
- package/dist/locales/es-419.js +2 -3
- package/dist/locales/es.cjs +2 -1
- package/dist/locales/es.js +2 -3
- package/dist/locales/fi.cjs +2 -1
- package/dist/locales/fi.js +1 -2
- package/dist/locales/fr-CA.cjs +2 -1
- package/dist/locales/fr-CA.js +2 -3
- package/dist/locales/fr.cjs +2 -1
- package/dist/locales/fr.js +2 -3
- package/dist/locales/gn.cjs +2 -1
- package/dist/locales/gn.js +1 -2
- package/dist/locales/hr.cjs +2 -1
- package/dist/locales/hr.js +1 -2
- package/dist/locales/ht.cjs +2 -1
- package/dist/locales/ht.js +1 -2
- package/dist/locales/hu.cjs +2 -1
- package/dist/locales/hu.js +1 -2
- package/dist/locales/index.cjs +2 -1
- package/dist/locales/index.js +1 -2
- package/dist/locales/it.cjs +2 -1
- package/dist/locales/it.js +1 -2
- package/dist/locales/nb.cjs +2 -1
- package/dist/locales/nb.js +1 -2
- package/dist/locales/nl.cjs +2 -1
- package/dist/locales/nl.js +1 -2
- package/dist/locales/pl.cjs +2 -1
- package/dist/locales/pl.js +1 -2
- package/dist/locales/pt-BR.cjs +2 -1
- package/dist/locales/pt-BR.js +1 -2
- package/dist/locales/pt.cjs +2 -1
- package/dist/locales/pt.js +1 -2
- package/dist/locales/qu.cjs +2 -1
- package/dist/locales/qu.js +1 -2
- package/dist/locales/ro.cjs +2 -1
- package/dist/locales/ro.js +1 -2
- package/dist/locales/ru.cjs +2 -1
- package/dist/locales/ru.js +1 -2
- package/dist/locales/sk.cjs +2 -1
- package/dist/locales/sk.js +1 -2
- package/dist/locales/sq.cjs +2 -1
- package/dist/locales/sq.js +1 -2
- package/dist/locales/sr-Latn.cjs +2 -1
- package/dist/locales/sr-Latn.js +2 -3
- package/dist/locales/sr.cjs +2 -1
- package/dist/locales/sr.js +2 -3
- package/dist/locales/sv.cjs +2 -1
- package/dist/locales/sv.js +1 -2
- package/dist/locales/tr.cjs +2 -1
- package/dist/locales/tr.js +1 -2
- package/dist/locales/uk.cjs +2 -1
- package/dist/locales/uk.js +1 -2
- package/dist/markdown.cjs +36 -1
- package/dist/markdown.d.cts +27 -1
- package/dist/markdown.d.ts +27 -1
- package/dist/markdown.js +34 -2
- package/dist/mcp-app-sandbox.cjs +0 -1
- package/dist/mcp-app-sandbox.js +1 -2
- package/dist/mcp-app.cjs +0 -1
- package/dist/mcp-app.js +2 -3
- package/dist/pipeline.cjs +0 -1
- package/dist/pipeline.js +1 -2
- package/package.json +3 -3
- package/dist/canvas.cjs.map +0 -1
- package/dist/canvas.js.map +0 -1
- package/dist/chunk-7O64ZI6Z.js.map +0 -1
- package/dist/chunk-EL2YCROY.js.map +0 -1
- package/dist/chunk-GB7RZJMG.js.map +0 -1
- package/dist/chunk-KZQB35LS.js.map +0 -1
- package/dist/chunk-SVYHDLAZ.js.map +0 -1
- package/dist/chunk-VCR7LU7J.js.map +0 -1
- package/dist/chunk-WFM6B7CL.js.map +0 -1
- package/dist/chunk-WZ7K7JIP.js.map +0 -1
- package/dist/chunk-ZBHESK6V.js.map +0 -1
- package/dist/controller.cjs.map +0 -1
- package/dist/controller.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/locales/be.cjs.map +0 -1
- package/dist/locales/be.js.map +0 -1
- package/dist/locales/bg.cjs.map +0 -1
- package/dist/locales/bg.js.map +0 -1
- package/dist/locales/ca.cjs.map +0 -1
- package/dist/locales/ca.js.map +0 -1
- package/dist/locales/cs.cjs.map +0 -1
- package/dist/locales/cs.js.map +0 -1
- package/dist/locales/da.cjs.map +0 -1
- package/dist/locales/da.js.map +0 -1
- package/dist/locales/de.cjs.map +0 -1
- package/dist/locales/de.js.map +0 -1
- package/dist/locales/el.cjs.map +0 -1
- package/dist/locales/el.js.map +0 -1
- package/dist/locales/en.cjs.map +0 -1
- package/dist/locales/en.js.map +0 -1
- package/dist/locales/es-419.cjs.map +0 -1
- package/dist/locales/es-419.js.map +0 -1
- package/dist/locales/es.cjs.map +0 -1
- package/dist/locales/es.js.map +0 -1
- package/dist/locales/fi.cjs.map +0 -1
- package/dist/locales/fi.js.map +0 -1
- package/dist/locales/fr-CA.cjs.map +0 -1
- package/dist/locales/fr-CA.js.map +0 -1
- package/dist/locales/fr.cjs.map +0 -1
- package/dist/locales/fr.js.map +0 -1
- package/dist/locales/gn.cjs.map +0 -1
- package/dist/locales/gn.js.map +0 -1
- package/dist/locales/hr.cjs.map +0 -1
- package/dist/locales/hr.js.map +0 -1
- package/dist/locales/ht.cjs.map +0 -1
- package/dist/locales/ht.js.map +0 -1
- package/dist/locales/hu.cjs.map +0 -1
- package/dist/locales/hu.js.map +0 -1
- package/dist/locales/index.cjs.map +0 -1
- package/dist/locales/index.js.map +0 -1
- package/dist/locales/it.cjs.map +0 -1
- package/dist/locales/it.js.map +0 -1
- package/dist/locales/nb.cjs.map +0 -1
- package/dist/locales/nb.js.map +0 -1
- package/dist/locales/nl.cjs.map +0 -1
- package/dist/locales/nl.js.map +0 -1
- package/dist/locales/pl.cjs.map +0 -1
- package/dist/locales/pl.js.map +0 -1
- package/dist/locales/pt-BR.cjs.map +0 -1
- package/dist/locales/pt-BR.js.map +0 -1
- package/dist/locales/pt.cjs.map +0 -1
- package/dist/locales/pt.js.map +0 -1
- package/dist/locales/qu.cjs.map +0 -1
- package/dist/locales/qu.js.map +0 -1
- package/dist/locales/ro.cjs.map +0 -1
- package/dist/locales/ro.js.map +0 -1
- package/dist/locales/ru.cjs.map +0 -1
- package/dist/locales/ru.js.map +0 -1
- package/dist/locales/sk.cjs.map +0 -1
- package/dist/locales/sk.js.map +0 -1
- package/dist/locales/sq.cjs.map +0 -1
- package/dist/locales/sq.js.map +0 -1
- package/dist/locales/sr-Latn.cjs.map +0 -1
- package/dist/locales/sr-Latn.js.map +0 -1
- package/dist/locales/sr.cjs.map +0 -1
- package/dist/locales/sr.js.map +0 -1
- package/dist/locales/sv.cjs.map +0 -1
- package/dist/locales/sv.js.map +0 -1
- package/dist/locales/tr.cjs.map +0 -1
- package/dist/locales/tr.js.map +0 -1
- package/dist/locales/uk.cjs.map +0 -1
- package/dist/locales/uk.js.map +0 -1
- package/dist/markdown.cjs.map +0 -1
- package/dist/markdown.js.map +0 -1
- package/dist/mcp-app-sandbox.cjs.map +0 -1
- package/dist/mcp-app-sandbox.js.map +0 -1
- package/dist/mcp-app.cjs.map +0 -1
- package/dist/mcp-app.js.map +0 -1
- package/dist/pipeline.cjs.map +0 -1
- package/dist/pipeline.js.map +0 -1
package/dist/controller.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
pendingApprovalsOf,
|
|
12
12
|
questionTimeoutOf,
|
|
13
13
|
remoteAnswerOf
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-G7LQTOA2.js";
|
|
15
15
|
|
|
16
16
|
// src/controller.ts
|
|
17
17
|
import * as core from "@dudko.dev/agent-web";
|
|
@@ -19,13 +19,558 @@ import {
|
|
|
19
19
|
createAgent,
|
|
20
20
|
createRunControl
|
|
21
21
|
} from "@dudko.dev/agent-web";
|
|
22
|
+
|
|
23
|
+
// src/remote-controller.ts
|
|
24
|
+
var createSseParser = (onFrame, onRetry) => {
|
|
25
|
+
let buffer = "";
|
|
26
|
+
let data = [];
|
|
27
|
+
let id;
|
|
28
|
+
let sawCr = false;
|
|
29
|
+
const line = (text) => {
|
|
30
|
+
if (text === "") {
|
|
31
|
+
if (data.length > 0) onFrame({ ...id !== void 0 ? { id } : {}, data: data.join("\n") });
|
|
32
|
+
data = [];
|
|
33
|
+
id = void 0;
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (text.startsWith(":")) return;
|
|
37
|
+
const colon = text.indexOf(":");
|
|
38
|
+
const field = colon < 0 ? text : text.slice(0, colon);
|
|
39
|
+
let value = colon < 0 ? "" : text.slice(colon + 1);
|
|
40
|
+
if (value.startsWith(" ")) value = value.slice(1);
|
|
41
|
+
if (field === "data") data.push(value);
|
|
42
|
+
else if (field === "id" && !value.includes("\0")) id = value;
|
|
43
|
+
else if (field === "retry" && /^\d+$/.test(value)) onRetry?.(Number(value));
|
|
44
|
+
};
|
|
45
|
+
return {
|
|
46
|
+
push: (chunk) => {
|
|
47
|
+
let text = buffer + chunk;
|
|
48
|
+
buffer = "";
|
|
49
|
+
if (sawCr && text.startsWith("\n")) text = text.slice(1);
|
|
50
|
+
sawCr = false;
|
|
51
|
+
let start = 0;
|
|
52
|
+
for (let i = 0; i < text.length; i += 1) {
|
|
53
|
+
const c = text[i];
|
|
54
|
+
if (c !== "\n" && c !== "\r") continue;
|
|
55
|
+
line(text.slice(start, i));
|
|
56
|
+
if (c === "\r") {
|
|
57
|
+
if (i + 1 === text.length) sawCr = true;
|
|
58
|
+
else if (text[i + 1] === "\n") i += 1;
|
|
59
|
+
}
|
|
60
|
+
start = i + 1;
|
|
61
|
+
}
|
|
62
|
+
buffer = text.slice(start);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
};
|
|
66
|
+
var parseRemoteCursor = (raw) => {
|
|
67
|
+
const m = typeof raw === "string" ? /^(\d+):(\d+):(\d+)$/.exec(raw.trim()) : null;
|
|
68
|
+
return m ? { turn: Number(m[1]), attempt: Number(m[2]), seq: Number(m[3]) } : void 0;
|
|
69
|
+
};
|
|
70
|
+
var compareCursors = (a, b) => a.turn - b.turn || a.attempt - b.attempt || a.seq - b.seq;
|
|
71
|
+
var remoteEventScope = (event) => {
|
|
72
|
+
const step = event.step?.id;
|
|
73
|
+
if (event.type.startsWith("step.") && typeof step === "string") return `step:${step}`;
|
|
74
|
+
if (event.type === "final" || event.type.startsWith("final.")) return "final";
|
|
75
|
+
if (event.type.startsWith("plan.") || event.type === "replan.decision") return "plan";
|
|
76
|
+
return void 0;
|
|
77
|
+
};
|
|
78
|
+
var remoteEventOf = (event) => {
|
|
79
|
+
if (event.type === "error" && typeof event.error !== "string") {
|
|
80
|
+
const err = event.error;
|
|
81
|
+
return {
|
|
82
|
+
...event,
|
|
83
|
+
error: typeof err?.message === "string" ? err.message : "error"
|
|
84
|
+
};
|
|
85
|
+
}
|
|
86
|
+
return event;
|
|
87
|
+
};
|
|
88
|
+
var emptyUsage = () => ({ inputTokens: 0, outputTokens: 0, totalTokens: 0 });
|
|
89
|
+
var newMessageId = () => globalThis.crypto?.randomUUID?.() ?? `m-${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 12)}`;
|
|
90
|
+
var GatewayError = class extends Error {
|
|
91
|
+
constructor(status, code, message) {
|
|
92
|
+
super(message);
|
|
93
|
+
this.status = status;
|
|
94
|
+
this.code = code;
|
|
95
|
+
this.name = "GatewayError";
|
|
96
|
+
}
|
|
97
|
+
status;
|
|
98
|
+
code;
|
|
99
|
+
};
|
|
100
|
+
var createInitialRemoteSnapshot = (options = {}) => snapshotOf({ ...createInitialAgentState(), status: "ready" }, options.sessionId ?? "", /* @__PURE__ */ new Set());
|
|
101
|
+
var snapshotOf = (state, sessionId, answering) => Object.freeze({
|
|
102
|
+
...state,
|
|
103
|
+
isRunning: state.status === "running",
|
|
104
|
+
isReady: state.status === "ready",
|
|
105
|
+
// A request answered here waits for the stream to say so: not offered twice meanwhile.
|
|
106
|
+
pendingApprovals: state.approvals.filter(
|
|
107
|
+
(a) => a.status === "pending" && !a.remote && !answering.has(a.id)
|
|
108
|
+
),
|
|
109
|
+
pendingQuestions: [],
|
|
110
|
+
// The server's policy decides; a view hides the switch for a remote agent.
|
|
111
|
+
approvalMode: "ask-writes",
|
|
112
|
+
sessionId
|
|
113
|
+
});
|
|
114
|
+
var createRemoteAgentController = (options) => {
|
|
115
|
+
const base = options.baseUrl.replace(/\/+$/, "");
|
|
116
|
+
const doFetch = options.fetch ?? ((...args) => globalThis.fetch(...args));
|
|
117
|
+
const minWait = Math.max(0, options.reconnect?.minMs ?? 1e3);
|
|
118
|
+
const maxWait = Math.max(minWait, options.reconnect?.maxMs ?? 3e4);
|
|
119
|
+
const maxEvents = options.maxEvents;
|
|
120
|
+
let disposed = false;
|
|
121
|
+
let sessionId = options.sessionId?.trim() || void 0;
|
|
122
|
+
let state = { ...createInitialAgentState(), status: "ready" };
|
|
123
|
+
let snapshot;
|
|
124
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
125
|
+
const answering = /* @__PURE__ */ new Set();
|
|
126
|
+
const changed = () => {
|
|
127
|
+
snapshot = void 0;
|
|
128
|
+
for (const listener of [...listeners]) {
|
|
129
|
+
try {
|
|
130
|
+
listener();
|
|
131
|
+
} catch (err) {
|
|
132
|
+
queueMicrotask(() => {
|
|
133
|
+
throw err;
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
};
|
|
138
|
+
const apply = (action) => {
|
|
139
|
+
if (disposed) return;
|
|
140
|
+
const next = agentStateReducer(state, action);
|
|
141
|
+
if (next === state) return;
|
|
142
|
+
state = next;
|
|
143
|
+
changed();
|
|
144
|
+
};
|
|
145
|
+
let turn;
|
|
146
|
+
let turnIds = [];
|
|
147
|
+
let turnFinal = false;
|
|
148
|
+
let waiting = [];
|
|
149
|
+
const runs = /* @__PURE__ */ new Map();
|
|
150
|
+
const fold = (action, attempt = 0, scope) => {
|
|
151
|
+
if (turn) {
|
|
152
|
+
if (scope !== void 0 && turn.entries.some((e) => e.scope === scope && e.attempt < attempt)) {
|
|
153
|
+
turn.entries = turn.entries.filter((e) => !(e.scope === scope && e.attempt < attempt));
|
|
154
|
+
let s = turn.start;
|
|
155
|
+
for (const e of turn.entries) s = agentStateReducer(s, e.action);
|
|
156
|
+
state = s;
|
|
157
|
+
changed();
|
|
158
|
+
}
|
|
159
|
+
turn.entries.push({ action, attempt, ...scope !== void 0 ? { scope } : {} });
|
|
160
|
+
}
|
|
161
|
+
apply(action);
|
|
162
|
+
if (action.type === "event" && !disposed) tell(action.event);
|
|
163
|
+
};
|
|
164
|
+
const tell = (e) => {
|
|
165
|
+
try {
|
|
166
|
+
options.onEvent?.(e);
|
|
167
|
+
} catch {
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
const event = (e) => ({
|
|
171
|
+
type: "event",
|
|
172
|
+
event: e,
|
|
173
|
+
maxEvents,
|
|
174
|
+
at: Date.now()
|
|
175
|
+
});
|
|
176
|
+
const queueShown = () => {
|
|
177
|
+
for (const w of waiting) fold(event({ type: "message.queued", id: w.id, text: w.text }));
|
|
178
|
+
};
|
|
179
|
+
const endTurn = (body) => {
|
|
180
|
+
const status = body.status;
|
|
181
|
+
const text = typeof body.text === "string" ? body.text : "";
|
|
182
|
+
if (status === "completed") {
|
|
183
|
+
if (!turnFinal && text) fold(event({ type: "final", text }));
|
|
184
|
+
} else if (status === "stopped") {
|
|
185
|
+
fold(event({ type: "stopped" }));
|
|
186
|
+
} else if (status === "failed") {
|
|
187
|
+
const error = typeof body.error === "string" && body.error ? body.error : "the turn failed";
|
|
188
|
+
fold(event({ type: "error", phase: "run", error }));
|
|
189
|
+
}
|
|
190
|
+
const result = status === "failed" ? void 0 : {
|
|
191
|
+
runId: typeof body.runId === "string" ? body.runId : "",
|
|
192
|
+
goal: state.goal ?? "",
|
|
193
|
+
final: state.finalText || text,
|
|
194
|
+
plan: state.plan ?? { thought: "", steps: [] },
|
|
195
|
+
trace: [],
|
|
196
|
+
steps: state.steps.length,
|
|
197
|
+
applied: 0,
|
|
198
|
+
stopped: status === "stopped",
|
|
199
|
+
usage: body.usage ?? state.usage ?? emptyUsage(),
|
|
200
|
+
skills: []
|
|
201
|
+
};
|
|
202
|
+
for (const id of turnIds) {
|
|
203
|
+
const done = runs.get(id);
|
|
204
|
+
runs.delete(id);
|
|
205
|
+
done?.(result);
|
|
206
|
+
}
|
|
207
|
+
turn = void 0;
|
|
208
|
+
turnIds = [];
|
|
209
|
+
turnFinal = false;
|
|
210
|
+
answering.clear();
|
|
211
|
+
apply({ type: "status", status: waiting.length > 0 ? "running" : "ready" });
|
|
212
|
+
};
|
|
213
|
+
const onFrame = (frame) => {
|
|
214
|
+
let parsed;
|
|
215
|
+
try {
|
|
216
|
+
parsed = JSON.parse(frame.data);
|
|
217
|
+
} catch {
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
const raw = parsed?.event;
|
|
221
|
+
if (!raw || typeof raw !== "object" || typeof raw.type !== "string") return;
|
|
222
|
+
const cursor2 = parseRemoteCursor(frame.id);
|
|
223
|
+
const attempt = cursor2?.attempt ?? 0;
|
|
224
|
+
const shown = remoteEventOf(raw);
|
|
225
|
+
if (raw.type === "turn.started") {
|
|
226
|
+
const ids = Array.isArray(raw.messageIds) ? raw.messageIds.filter((x) => typeof x === "string") : [];
|
|
227
|
+
waiting = waiting.filter((w) => !ids.includes(w.id));
|
|
228
|
+
turnIds = ids;
|
|
229
|
+
turnFinal = false;
|
|
230
|
+
apply({ type: "status", status: "running" });
|
|
231
|
+
turn = { number: cursor2?.turn ?? 0, start: state, entries: [] };
|
|
232
|
+
const goal = typeof raw.input === "string" ? raw.input : "";
|
|
233
|
+
fold(event({ type: "run.start", goal }));
|
|
234
|
+
queueShown();
|
|
235
|
+
} else if (raw.type === "turn.ended") {
|
|
236
|
+
endTurn(raw);
|
|
237
|
+
} else if (raw.type === "tool.approval-resolved" && raw.parked === true) {
|
|
238
|
+
} else {
|
|
239
|
+
if (raw.type === "tool.approval-resolved" && typeof raw.id === "string") {
|
|
240
|
+
answering.delete(raw.id);
|
|
241
|
+
}
|
|
242
|
+
if (raw.type === "final") turnFinal = true;
|
|
243
|
+
fold(event(shown), attempt, remoteEventScope(raw));
|
|
244
|
+
}
|
|
245
|
+
if (raw.type === "turn.started" || raw.type === "turn.ended") tell(shown);
|
|
246
|
+
};
|
|
247
|
+
const headersFor = async (extra) => {
|
|
248
|
+
const given = typeof options.headers === "function" ? await options.headers() : options.headers;
|
|
249
|
+
const headers = new Headers(given ?? {});
|
|
250
|
+
for (const [k, v] of Object.entries(extra)) headers.set(k, v);
|
|
251
|
+
return headers;
|
|
252
|
+
};
|
|
253
|
+
const request = async (path, init, signal) => {
|
|
254
|
+
const res = await doFetch(`${base}${path}`, {
|
|
255
|
+
method: init.method,
|
|
256
|
+
headers: await headersFor({
|
|
257
|
+
...init.body !== void 0 ? { "content-type": "application/json" } : {},
|
|
258
|
+
...init.headers
|
|
259
|
+
}),
|
|
260
|
+
...init.body !== void 0 ? { body: JSON.stringify(init.body) } : {},
|
|
261
|
+
credentials: options.credentials ?? "same-origin",
|
|
262
|
+
...signal ? { signal } : {}
|
|
263
|
+
});
|
|
264
|
+
if (!res.ok) {
|
|
265
|
+
let code;
|
|
266
|
+
let message = `the agent's server answered ${res.status}`;
|
|
267
|
+
try {
|
|
268
|
+
const body = await res.json();
|
|
269
|
+
if (typeof body?.error?.code === "string") code = body.error.code;
|
|
270
|
+
if (typeof body?.error?.message === "string") message = body.error.message;
|
|
271
|
+
} catch {
|
|
272
|
+
}
|
|
273
|
+
throw new GatewayError(res.status, code, message);
|
|
274
|
+
}
|
|
275
|
+
return res;
|
|
276
|
+
};
|
|
277
|
+
const post = async (path, body) => {
|
|
278
|
+
const res = await request(path, { method: "POST", body });
|
|
279
|
+
try {
|
|
280
|
+
return await res.json();
|
|
281
|
+
} catch {
|
|
282
|
+
return void 0;
|
|
283
|
+
}
|
|
284
|
+
};
|
|
285
|
+
const sayError = (err) => fold(event({ type: "error", phase: "execute", error: errMessage(err) }));
|
|
286
|
+
let streamAbort;
|
|
287
|
+
let retryTimer;
|
|
288
|
+
let cursor;
|
|
289
|
+
let lastCursor;
|
|
290
|
+
let wait = minWait;
|
|
291
|
+
let serverRetry = 0;
|
|
292
|
+
let streamGeneration = 0;
|
|
293
|
+
const closeStream = () => {
|
|
294
|
+
streamGeneration += 1;
|
|
295
|
+
streamAbort?.abort();
|
|
296
|
+
streamAbort = void 0;
|
|
297
|
+
if (retryTimer !== void 0) clearTimeout(retryTimer);
|
|
298
|
+
retryTimer = void 0;
|
|
299
|
+
};
|
|
300
|
+
const scheduleReconnect = (generation) => {
|
|
301
|
+
if (disposed || generation !== streamGeneration || retryTimer !== void 0) return;
|
|
302
|
+
const delay = Math.min(maxWait, Math.max(wait, serverRetry));
|
|
303
|
+
wait = Math.min(maxWait, Math.max(minWait, wait * 2) || minWait);
|
|
304
|
+
retryTimer = setTimeout(() => {
|
|
305
|
+
retryTimer = void 0;
|
|
306
|
+
if (generation === streamGeneration) void openStream(generation);
|
|
307
|
+
}, delay);
|
|
308
|
+
};
|
|
309
|
+
const openStream = async (generation = streamGeneration) => {
|
|
310
|
+
const sid = sessionId;
|
|
311
|
+
if (disposed || !sid || generation !== streamGeneration || streamAbort) return;
|
|
312
|
+
const ac = new AbortController();
|
|
313
|
+
streamAbort = ac;
|
|
314
|
+
const decoder = new TextDecoder();
|
|
315
|
+
let cancelBody;
|
|
316
|
+
try {
|
|
317
|
+
const res = await request(
|
|
318
|
+
`/sessions/${encodeURIComponent(sid)}/events`,
|
|
319
|
+
{
|
|
320
|
+
method: "GET",
|
|
321
|
+
headers: { accept: "text/event-stream", ...cursor ? { "last-event-id": cursor } : {} }
|
|
322
|
+
},
|
|
323
|
+
ac.signal
|
|
324
|
+
);
|
|
325
|
+
const reader = res.body?.getReader();
|
|
326
|
+
if (!reader) throw new Error("the event stream has no body");
|
|
327
|
+
cancelBody = () => void reader.cancel().catch(() => {
|
|
328
|
+
});
|
|
329
|
+
if (ac.signal.aborted) cancelBody();
|
|
330
|
+
else ac.signal.addEventListener("abort", cancelBody, { once: true });
|
|
331
|
+
const parser = createSseParser(
|
|
332
|
+
(frame) => {
|
|
333
|
+
if (generation !== streamGeneration) return;
|
|
334
|
+
const at = parseRemoteCursor(frame.id);
|
|
335
|
+
if (at && lastCursor && compareCursors(at, lastCursor) <= 0) return;
|
|
336
|
+
if (at) lastCursor = at;
|
|
337
|
+
if (frame.id) cursor = frame.id;
|
|
338
|
+
wait = minWait;
|
|
339
|
+
onFrame(frame);
|
|
340
|
+
},
|
|
341
|
+
(ms) => {
|
|
342
|
+
serverRetry = ms;
|
|
343
|
+
}
|
|
344
|
+
);
|
|
345
|
+
for (; ; ) {
|
|
346
|
+
const { done, value } = await reader.read();
|
|
347
|
+
if (done || generation !== streamGeneration) break;
|
|
348
|
+
parser.push(decoder.decode(value, { stream: true }));
|
|
349
|
+
}
|
|
350
|
+
} catch (err) {
|
|
351
|
+
if (generation === streamGeneration && !disposed) {
|
|
352
|
+
if (err instanceof GatewayError && err.status === 404) {
|
|
353
|
+
forgetSession();
|
|
354
|
+
return;
|
|
355
|
+
}
|
|
356
|
+
if (err instanceof GatewayError && (err.status === 400 || err.status === 401 || err.status === 403)) {
|
|
357
|
+
sayError(err);
|
|
358
|
+
}
|
|
359
|
+
}
|
|
360
|
+
} finally {
|
|
361
|
+
if (cancelBody) ac.signal.removeEventListener("abort", cancelBody);
|
|
362
|
+
if (streamAbort === ac) streamAbort = void 0;
|
|
363
|
+
}
|
|
364
|
+
scheduleReconnect(generation);
|
|
365
|
+
};
|
|
366
|
+
const setSession = (next) => {
|
|
367
|
+
if (next === sessionId) return;
|
|
368
|
+
sessionId = next;
|
|
369
|
+
snapshot = void 0;
|
|
370
|
+
changed();
|
|
371
|
+
try {
|
|
372
|
+
options.onSessionId?.(next);
|
|
373
|
+
} catch {
|
|
374
|
+
}
|
|
375
|
+
};
|
|
376
|
+
const forgetSession = () => {
|
|
377
|
+
closeStream();
|
|
378
|
+
cursor = void 0;
|
|
379
|
+
lastCursor = void 0;
|
|
380
|
+
turn = void 0;
|
|
381
|
+
turnIds = [];
|
|
382
|
+
setSession(void 0);
|
|
383
|
+
};
|
|
384
|
+
const run = async (goal, runOptions) => {
|
|
385
|
+
if (disposed || state.status === "running") return void 0;
|
|
386
|
+
if (runOptions?.images?.length || runOptions?.files?.length) {
|
|
387
|
+
sayError(new Error("this agent takes text only: attachments are not sent"));
|
|
388
|
+
return void 0;
|
|
389
|
+
}
|
|
390
|
+
const text = goal.trim() ? goal : runOptions?.label ?? "";
|
|
391
|
+
if (!text.trim()) return void 0;
|
|
392
|
+
const id = newMessageId();
|
|
393
|
+
const shown = runOptions?.label?.trim() ? runOptions.label : text;
|
|
394
|
+
apply({ type: "status", status: "running" });
|
|
395
|
+
apply({ type: "submitted", goal: shown });
|
|
396
|
+
waiting.push({ id, text });
|
|
397
|
+
const ended = new Promise((resolve) => runs.set(id, resolve));
|
|
398
|
+
try {
|
|
399
|
+
await sendMessage(id, text);
|
|
400
|
+
} catch (err) {
|
|
401
|
+
runs.delete(id);
|
|
402
|
+
waiting = waiting.filter((w) => w.id !== id);
|
|
403
|
+
fold(event({ type: "stopped" }));
|
|
404
|
+
apply({ type: "status", status: "ready" });
|
|
405
|
+
apply({ type: "undelivered", texts: [...state.undelivered, text] });
|
|
406
|
+
sayError(err);
|
|
407
|
+
return void 0;
|
|
408
|
+
}
|
|
409
|
+
return ended;
|
|
410
|
+
};
|
|
411
|
+
const sendMessage = async (id, text) => {
|
|
412
|
+
const sid = sessionId;
|
|
413
|
+
if (sid) {
|
|
414
|
+
try {
|
|
415
|
+
await post(`/sessions/${encodeURIComponent(sid)}/messages`, { text, id });
|
|
416
|
+
return;
|
|
417
|
+
} catch (err) {
|
|
418
|
+
const gone = err instanceof GatewayError && (err.status === 404 || err.status === 409 && err.code === "session_ended");
|
|
419
|
+
if (!gone || sessionId !== sid) throw err;
|
|
420
|
+
forgetSession();
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
const made = await post("/sessions", { message: text, id });
|
|
424
|
+
if (disposed) return;
|
|
425
|
+
if (typeof made?.sessionId !== "string")
|
|
426
|
+
throw new Error("the agent’s server started no session");
|
|
427
|
+
closeStream();
|
|
428
|
+
cursor = void 0;
|
|
429
|
+
lastCursor = void 0;
|
|
430
|
+
wait = minWait;
|
|
431
|
+
setSession(made.sessionId);
|
|
432
|
+
void openStream();
|
|
433
|
+
};
|
|
434
|
+
const send = (text) => {
|
|
435
|
+
const clean = typeof text === "string" ? text.trim() : "";
|
|
436
|
+
if (disposed || state.status !== "running" || !clean || !sessionId) return false;
|
|
437
|
+
const id = newMessageId();
|
|
438
|
+
waiting.push({ id, text: clean });
|
|
439
|
+
fold(event({ type: "message.queued", id, text: clean }));
|
|
440
|
+
void post(`/sessions/${encodeURIComponent(sessionId)}/messages`, { text: clean, id }).catch(
|
|
441
|
+
(err) => {
|
|
442
|
+
waiting = waiting.filter((w) => w.id !== id);
|
|
443
|
+
fold({ type: "undelivered", texts: [...state.undelivered, clean], keepQueued: true });
|
|
444
|
+
sayError(err);
|
|
445
|
+
}
|
|
446
|
+
);
|
|
447
|
+
return true;
|
|
448
|
+
};
|
|
449
|
+
const stop = () => {
|
|
450
|
+
if (disposed || !sessionId || state.status !== "running") return;
|
|
451
|
+
const sid = sessionId;
|
|
452
|
+
const left = waiting.map((w) => w.text);
|
|
453
|
+
waiting = [];
|
|
454
|
+
for (const [id, done] of runs) if (!turnIds.includes(id)) runs.delete(id), done(void 0);
|
|
455
|
+
if (left.length > 0) fold({ type: "undelivered", texts: [...state.undelivered, ...left] });
|
|
456
|
+
if (!turn) {
|
|
457
|
+
fold(event({ type: "stopped" }));
|
|
458
|
+
apply({ type: "status", status: "ready" });
|
|
459
|
+
}
|
|
460
|
+
void post(`/sessions/${encodeURIComponent(sid)}/stop`, {}).catch(sayError);
|
|
461
|
+
};
|
|
462
|
+
const answer = (id, body) => {
|
|
463
|
+
const sid = sessionId;
|
|
464
|
+
if (disposed || !sid || answering.has(id)) return;
|
|
465
|
+
if (!state.approvals.some((a) => a.id === id && a.status === "pending")) return;
|
|
466
|
+
answering.add(id);
|
|
467
|
+
changed();
|
|
468
|
+
void post(`/sessions/${encodeURIComponent(sid)}/answers/${encodeURIComponent(id)}`, body).catch(
|
|
469
|
+
(err) => {
|
|
470
|
+
if (err instanceof GatewayError && err.status === 409) return;
|
|
471
|
+
answering.delete(id);
|
|
472
|
+
changed();
|
|
473
|
+
sayError(err);
|
|
474
|
+
}
|
|
475
|
+
);
|
|
476
|
+
};
|
|
477
|
+
const approve = (id, _opts) => {
|
|
478
|
+
void _opts;
|
|
479
|
+
answer(id, { approved: true });
|
|
480
|
+
};
|
|
481
|
+
const deny = (id, reason) => answer(id, { approved: false, ...reason ? { reason: reason.slice(0, 2e3) } : {} });
|
|
482
|
+
const reset = () => {
|
|
483
|
+
if (disposed) return;
|
|
484
|
+
for (const [id, done] of runs) runs.delete(id), done(void 0);
|
|
485
|
+
waiting = [];
|
|
486
|
+
answering.clear();
|
|
487
|
+
forgetSession();
|
|
488
|
+
apply({ type: "reset" });
|
|
489
|
+
apply({ type: "status", status: "ready" });
|
|
490
|
+
};
|
|
491
|
+
const loadChat = (chat) => {
|
|
492
|
+
if (disposed) return;
|
|
493
|
+
const next = chat.sessionId?.trim();
|
|
494
|
+
if (!next || next === sessionId) return;
|
|
495
|
+
reset();
|
|
496
|
+
setSession(next);
|
|
497
|
+
void openStream();
|
|
498
|
+
};
|
|
499
|
+
const dispose = () => {
|
|
500
|
+
if (disposed) return;
|
|
501
|
+
disposed = true;
|
|
502
|
+
closeStream();
|
|
503
|
+
for (const [id, done] of runs) runs.delete(id), done(void 0);
|
|
504
|
+
listeners.clear();
|
|
505
|
+
};
|
|
506
|
+
if (sessionId) void openStream();
|
|
507
|
+
const notAvailable = (what) => async () => {
|
|
508
|
+
throw new Error(`${what} is not available for an agent on a server`);
|
|
509
|
+
};
|
|
510
|
+
return {
|
|
511
|
+
getSnapshot: () => snapshot ??= snapshotOf(state, sessionId ?? "", answering),
|
|
512
|
+
subscribe: (listener) => {
|
|
513
|
+
if (disposed) return () => {
|
|
514
|
+
};
|
|
515
|
+
listeners.add(listener);
|
|
516
|
+
return () => {
|
|
517
|
+
listeners.delete(listener);
|
|
518
|
+
};
|
|
519
|
+
},
|
|
520
|
+
// A server agent's configuration is the server's.
|
|
521
|
+
update: () => {
|
|
522
|
+
},
|
|
523
|
+
dispose,
|
|
524
|
+
get agent() {
|
|
525
|
+
return void 0;
|
|
526
|
+
},
|
|
527
|
+
get disposed() {
|
|
528
|
+
return disposed;
|
|
529
|
+
},
|
|
530
|
+
run,
|
|
531
|
+
stop,
|
|
532
|
+
stopRemote: () => {
|
|
533
|
+
},
|
|
534
|
+
send,
|
|
535
|
+
sendRemote: () => false,
|
|
536
|
+
stopSubagent: () => false,
|
|
537
|
+
forgetSkill: async () => false,
|
|
538
|
+
sendUndelivered: () => {
|
|
539
|
+
const texts = state.undelivered;
|
|
540
|
+
if (disposed || texts.length === 0 || state.status === "running") return;
|
|
541
|
+
apply({ type: "undelivered", texts: [] });
|
|
542
|
+
void run(texts.join("\n\n"));
|
|
543
|
+
},
|
|
544
|
+
discardUndelivered: () => apply({ type: "undelivered", texts: [] }),
|
|
545
|
+
reset,
|
|
546
|
+
// Opens the stream again at once (after the network came back, say).
|
|
547
|
+
reload: () => {
|
|
548
|
+
if (disposed || !sessionId) return;
|
|
549
|
+
if (retryTimer !== void 0) clearTimeout(retryTimer);
|
|
550
|
+
retryTimer = void 0;
|
|
551
|
+
wait = minWait;
|
|
552
|
+
void openStream();
|
|
553
|
+
},
|
|
554
|
+
approve,
|
|
555
|
+
deny,
|
|
556
|
+
answerQuestion: () => false,
|
|
557
|
+
setApprovalMode: () => {
|
|
558
|
+
},
|
|
559
|
+
approveAppToolCall: notAvailable("An app’s tool call"),
|
|
560
|
+
sampleForApp: notAvailable("An app’s sampling"),
|
|
561
|
+
compact: async () => void 0,
|
|
562
|
+
loadChat
|
|
563
|
+
};
|
|
564
|
+
};
|
|
565
|
+
|
|
566
|
+
// src/controller.ts
|
|
22
567
|
var dbNameOf = (store) => {
|
|
23
568
|
const name = store?.dbName;
|
|
24
569
|
return typeof name === "string" && name ? name : void 0;
|
|
25
570
|
};
|
|
26
571
|
var modeOf = (config) => config.toolApproval?.mode ?? "autopilot";
|
|
27
572
|
var pageAppToolGrants = /* @__PURE__ */ new Set();
|
|
28
|
-
var
|
|
573
|
+
var snapshotOf2 = (state, extra) => {
|
|
29
574
|
const remoteRunning = state.remote?.running === true;
|
|
30
575
|
return Object.freeze({
|
|
31
576
|
...state,
|
|
@@ -40,7 +585,7 @@ var snapshotOf = (state, extra) => {
|
|
|
40
585
|
sessionId: extra.sessionId
|
|
41
586
|
});
|
|
42
587
|
};
|
|
43
|
-
var createInitialAgentSnapshot = (config) =>
|
|
588
|
+
var createInitialAgentSnapshot = (config) => snapshotOf2(createInitialAgentState(), {
|
|
44
589
|
sessionId: config.sessionId ?? "default",
|
|
45
590
|
pendingQuestions: [],
|
|
46
591
|
approvalMode: modeOf(config)
|
|
@@ -437,7 +982,7 @@ var createAgentController = (initialConfig, initialOptions = {}) => {
|
|
|
437
982
|
syncWatch();
|
|
438
983
|
syncSkills();
|
|
439
984
|
return {
|
|
440
|
-
getSnapshot: () => snapshot ??=
|
|
985
|
+
getSnapshot: () => snapshot ??= snapshotOf2(state, { sessionId, pendingQuestions, approvalMode }),
|
|
441
986
|
subscribe: (listener) => {
|
|
442
987
|
if (disposed) return () => {
|
|
443
988
|
};
|
|
@@ -477,6 +1022,11 @@ var createAgentController = (initialConfig, initialOptions = {}) => {
|
|
|
477
1022
|
};
|
|
478
1023
|
export {
|
|
479
1024
|
createAgentController,
|
|
480
|
-
createInitialAgentSnapshot
|
|
1025
|
+
createInitialAgentSnapshot,
|
|
1026
|
+
createInitialRemoteSnapshot,
|
|
1027
|
+
createRemoteAgentController,
|
|
1028
|
+
createSseParser,
|
|
1029
|
+
parseRemoteCursor,
|
|
1030
|
+
remoteEventOf,
|
|
1031
|
+
remoteEventScope
|
|
481
1032
|
};
|
|
482
|
-
//# sourceMappingURL=controller.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -1909,6 +1909,7 @@ var defaultLabels = {
|
|
|
1909
1909
|
memoryUndo: "Undo",
|
|
1910
1910
|
memoryUndone: "Undone",
|
|
1911
1911
|
placeholder: "Ask the agent to do something… ( / for commands, Ctrl+V to paste an image )",
|
|
1912
|
+
placeholderTextOnly: "Ask the agent to do something… ( / for commands )",
|
|
1912
1913
|
listening: "Listening…",
|
|
1913
1914
|
message: "Message",
|
|
1914
1915
|
dropHint: "Drop files or images to attach them",
|
|
@@ -4273,4 +4274,3 @@ var createAudioSpeaker = (options) => (text2, { lang, onState }) => {
|
|
|
4273
4274
|
withoutOwnWords,
|
|
4274
4275
|
workspacePathOf
|
|
4275
4276
|
});
|
|
4276
|
-
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentEvent, IUsage, Skill, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
2
2
|
import { A as AgentUiState, C as ChatAttachment, R as RemoteRunView, L as LessonView, a as ChatMessage, b as ApprovalView, S as SubagentView, i as SubagentNode } from './types-DnBCok3z.cjs';
|
|
3
3
|
export { h as AgentStatus, j as AppView, B as BrowserOAuthProvider, k as BrowserOAuthProviderOptions, l as BudgetView, m as CompactionView, n as ConnectedMcp, D as DecisionView, E as ElicitationView, F as FetchView, o as McpAppsConnectionLike, p as McpCatalogEntry, M as McpElicitationFieldSchema, c as McpElicitationHandler, f as McpElicitationOptions, d as McpElicitationRequest, e as McpElicitationResult, g as McpElicitationSchema, q as McpHttpServerConfig, r as McpModule, s as McpOAuthCallback, t as McpOAuthRegistration, u as McpOAuthRegistrationKind, v as McpProtocolMode, w as McpServerInstructions, x as McpServerProtocol, y as McpServerResult, z as MediaView, G as ModelLoadState, Q as QuestionView, H as QueuedMessageView, I as ReplanState, J as SkillConsentView, K as StepEscalationView, N as StepView, T as ToolCallView, O as TranscriptView, U as UserNoteView, W as WrittenFileView } from './types-DnBCok3z.cjs';
|
|
4
|
-
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-
|
|
4
|
+
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-B_y8F1GW.cjs';
|
|
5
5
|
export { A as ASK_USER_TOOL_NAME, P as PendingQuestion, a as QUESTION_TIMEOUT_MS, Q as QuestionOutcomeReason, b as QuestionQueue, c as QuestionQueueOptions, d as askUserOutputKept, e as askUserWith, f as createQuestionQueue, q as questionChoiceOf, g as questionOtherOf, h as questionTimeoutOf, w as withoutOwnWords } from './questions-Dw--IEjT.cjs';
|
|
6
6
|
import './mcp-app.cjs';
|
|
7
7
|
import './mcp-app-policy-DXKQ2jjM.cjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentEvent, IUsage, Skill, ToolApprovalRequest, ToolApprovalContext, ToolApprovalDecision } from '@dudko.dev/agent-web';
|
|
2
2
|
import { A as AgentUiState, C as ChatAttachment, R as RemoteRunView, L as LessonView, a as ChatMessage, b as ApprovalView, S as SubagentView, i as SubagentNode } from './types-DnBCok3z.js';
|
|
3
3
|
export { h as AgentStatus, j as AppView, B as BrowserOAuthProvider, k as BrowserOAuthProviderOptions, l as BudgetView, m as CompactionView, n as ConnectedMcp, D as DecisionView, E as ElicitationView, F as FetchView, o as McpAppsConnectionLike, p as McpCatalogEntry, M as McpElicitationFieldSchema, c as McpElicitationHandler, f as McpElicitationOptions, d as McpElicitationRequest, e as McpElicitationResult, g as McpElicitationSchema, q as McpHttpServerConfig, r as McpModule, s as McpOAuthCallback, t as McpOAuthRegistration, u as McpOAuthRegistrationKind, v as McpProtocolMode, w as McpServerInstructions, x as McpServerProtocol, y as McpServerResult, z as MediaView, G as ModelLoadState, Q as QuestionView, H as QueuedMessageView, I as ReplanState, J as SkillConsentView, K as StepEscalationView, N as StepView, T as ToolCallView, O as TranscriptView, U as UserNoteView, W as WrittenFileView } from './types-DnBCok3z.js';
|
|
4
|
-
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-
|
|
4
|
+
export { a as ATTACHMENT_BOUNDS, b as AgentLabels, A as AgentLabelsOverride, c as AttachmentBounds, d as AttachmentFiles, e as AttachmentOverLimit, f as AttachmentTextOptions, g as AttachmentTransform, C as ComposerAttachment, h as ComposerNotice, E as ELICITATION_MAX_OPTIONS, i as ELICITATION_TIMEOUT_MS, j as ELICITATION_VALUE_MAX_CHARS, k as ElicitationControl, l as ElicitationDraft, m as ElicitationDraftValue, n as ElicitationField, o as ElicitationFormOutcome, p as ElicitationIssue, q as ElicitationIssueKind, r as ElicitationLink, s as ElicitationOption, t as ElicitationOutcomeReason, u as ElicitationQueue, v as ElicitationQueueOptions, F as FileKind, I as INPUT_COUNTER_FROM, M as MenuSection, N as NotReadyInput, w as NotReadyIntent, x as NotReadyReason, y as NoticeTexts, P as PendingElicitation, S as SavedAttachments, z as SlashCommand, B as SteerIntent, T as TextExcerpt, W as WaitingSendStep, D as attachmentFileName, G as attachmentKindOf, H as attachmentLabel, J as attachmentOverLimit, K as attachmentRefusal, L as attachmentTransformOf, O as boxLength, Q as createElicitationQueue, R as dataUrlParts, U as defaultLabels, V as defaultNoticeTexts, X as elicitationConnectOptions, Y as elicitationFields, Z as elicitationFormAnswer, _ as elicitationInitialDraft, $ as elicitationLink, a0 as elicitationSettings, a1 as elicitationTimeoutOf, a2 as excerptNote, a3 as fileKindOf, a4 as fileNameOf, a5 as filterCommands, a6 as formatClock, a7 as formatCountdown, a8 as formatElapsed, a9 as freeAttachmentPath, aa as inputCounterShown, ab as insertionFits, ac as isOneCharacter, ad as lineCountOf, ae as longTextName, af as longTextRoute, ag as menuKeyTarget, ah as menuSections, ai as mergeLabels, aj as messageOverLimit, ak as micProblemText, al as notReadyIntent, am as notReadyReason, an as noticesOf, ao as overflowOf, ap as parseSlash, aq as saveAttachments, ar as steerIntent, as as textExcerpt, at as voiceMessageName, au as waitingSendStep, av as withAttachments } from './labels-BJMtk5Fw.js';
|
|
5
5
|
export { A as ASK_USER_TOOL_NAME, P as PendingQuestion, a as QUESTION_TIMEOUT_MS, Q as QuestionOutcomeReason, b as QuestionQueue, c as QuestionQueueOptions, d as askUserOutputKept, e as askUserWith, f as createQuestionQueue, q as questionChoiceOf, g as questionOtherOf, h as questionTimeoutOf, w as withoutOwnWords } from './questions-Dw--IEjT.js';
|
|
6
6
|
import './mcp-app.js';
|
|
7
7
|
import './mcp-app-policy-DXKQ2jjM.js';
|
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
tokenizeHtml,
|
|
13
13
|
withCspFirst,
|
|
14
14
|
withPolicyFirst
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-D64VLIRY.js";
|
|
16
16
|
import {
|
|
17
17
|
NAMED_FILES_MAX,
|
|
18
18
|
NAMED_FILES_SCAN_MAX,
|
|
@@ -20,7 +20,7 @@ import {
|
|
|
20
20
|
namedFilesOf,
|
|
21
21
|
pathsNamedIn,
|
|
22
22
|
workspacePathOf
|
|
23
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-TJBGZM6D.js";
|
|
24
24
|
import {
|
|
25
25
|
ASK_USER_TOOL_NAME,
|
|
26
26
|
QUESTION_TIMEOUT_MS,
|
|
@@ -43,7 +43,7 @@ import {
|
|
|
43
43
|
remoteAnswerOf,
|
|
44
44
|
subagentTree,
|
|
45
45
|
withoutOwnWords
|
|
46
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-G7LQTOA2.js";
|
|
47
47
|
|
|
48
48
|
// src/composer.ts
|
|
49
49
|
var parseSlash = (text2) => {
|
|
@@ -424,6 +424,7 @@ var defaultLabels = {
|
|
|
424
424
|
memoryUndo: "Undo",
|
|
425
425
|
memoryUndone: "Undone",
|
|
426
426
|
placeholder: "Ask the agent to do something… ( / for commands, Ctrl+V to paste an image )",
|
|
427
|
+
placeholderTextOnly: "Ask the agent to do something… ( / for commands )",
|
|
427
428
|
listening: "Listening…",
|
|
428
429
|
message: "Message",
|
|
429
430
|
dropHint: "Drop files or images to attach them",
|
|
@@ -2491,4 +2492,3 @@ export {
|
|
|
2491
2492
|
withoutOwnWords,
|
|
2492
2493
|
workspacePathOf
|
|
2493
2494
|
};
|
|
2494
|
-
//# sourceMappingURL=index.js.map
|