@dreb/coding-agent 2.51.0 → 2.52.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -5
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +11 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/core/extensions/types.d.ts +31 -11
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/tools/ask-user.d.ts +28 -20
- package/dist/core/tools/ask-user.d.ts.map +1 -1
- package/dist/core/tools/ask-user.js +130 -106
- package/dist/core/tools/ask-user.js.map +1 -1
- package/dist/core/tools/index.d.ts +9 -7
- package/dist/core/tools/index.d.ts.map +1 -1
- package/dist/core/tools/index.js.map +1 -1
- package/dist/modes/interactive/components/ask-wizard.d.ts +83 -0
- package/dist/modes/interactive/components/ask-wizard.d.ts.map +1 -0
- package/dist/modes/interactive/components/ask-wizard.js +464 -0
- package/dist/modes/interactive/components/ask-wizard.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +4 -2
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +7 -5
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-mode.js +100 -20
- package/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/dist/modes/rpc/rpc-types.d.ts +18 -7
- package/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/dist/modes/rpc/rpc-types.js.map +1 -1
- package/docs/dashboard.md +1 -1
- package/docs/extensions.md +35 -18
- package/docs/rpc.md +26 -8
- package/examples/extensions/rpc-demo.ts +29 -0
- package/examples/rpc-extension-ui.ts +162 -6
- package/package.json +1 -1
- package/dist/modes/interactive/components/ask-user.d.ts +0 -59
- package/dist/modes/interactive/components/ask-user.d.ts.map +0 -1
- package/dist/modes/interactive/components/ask-user.js +0 -240
- package/dist/modes/interactive/components/ask-user.js.map +0 -1
|
@@ -1,26 +1,25 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* ask_user tool.
|
|
3
3
|
*
|
|
4
|
-
* Lets the agent pause and ask the user
|
|
5
|
-
* with optional multiple-choice options,
|
|
6
|
-
* "type your own answer" free-text field —
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* settles without opening any UI.
|
|
4
|
+
* Lets the agent pause and ask the user one or more structured clarifying
|
|
5
|
+
* questions in a single call — each with optional multiple-choice options,
|
|
6
|
+
* single- or multi-select, and a "type your own answer" free-text field —
|
|
7
|
+
* rendered natively as a wizard in the TUI, the Dashboard, and over RPC. The
|
|
8
|
+
* whole batch is answered together and returned as one result. Answering,
|
|
9
|
+
* stopping the turn, aborting, or timing out always settles cleanly so the
|
|
10
|
+
* agent never deadlocks on an absent user. Unanswered questions come back
|
|
11
|
+
* flagged as skipped rather than blocking the turn.
|
|
13
12
|
*/
|
|
14
13
|
import { Text } from "@dreb/tui";
|
|
15
14
|
import { Type } from "@sinclair/typebox";
|
|
16
15
|
// ============================================================================
|
|
17
16
|
// Schema
|
|
18
|
-
const
|
|
17
|
+
const questionSchema = Type.Object({
|
|
19
18
|
question: Type.String({
|
|
20
19
|
description: "The Markdown-formatted question to ask the user. Be specific about what you need to decide.",
|
|
21
20
|
}),
|
|
22
21
|
title: Type.Optional(Type.String({
|
|
23
|
-
description: "Short bold header shown above
|
|
22
|
+
description: "Short bold header shown above this question.",
|
|
24
23
|
})),
|
|
25
24
|
options: Type.Optional(Type.Array(Type.String({ minLength: 1, pattern: "^.*[^ \\t\\r\\n].*$" }), {
|
|
26
25
|
minItems: 2,
|
|
@@ -36,6 +35,14 @@ const askUserSchema = Type.Object({
|
|
|
36
35
|
multiline: Type.Optional(Type.Boolean({
|
|
37
36
|
description: "Use a large multi-line text area for open-ended answers.",
|
|
38
37
|
})),
|
|
38
|
+
});
|
|
39
|
+
const askUserSchema = Type.Object({
|
|
40
|
+
questions: Type.Array(questionSchema, {
|
|
41
|
+
minItems: 1,
|
|
42
|
+
maxItems: 10,
|
|
43
|
+
description: "One or more clarifying questions to ask together in a single wizard. " +
|
|
44
|
+
"Batch every question you need answered in one call — the user answers them all and submits once.",
|
|
45
|
+
}),
|
|
39
46
|
timeoutSeconds: Type.Optional(Type.Number({
|
|
40
47
|
minimum: 5,
|
|
41
48
|
maximum: 3600,
|
|
@@ -44,6 +51,28 @@ const askUserSchema = Type.Object({
|
|
|
44
51
|
})),
|
|
45
52
|
});
|
|
46
53
|
// ============================================================================
|
|
54
|
+
// Normalization
|
|
55
|
+
/**
|
|
56
|
+
* Normalize a single question so every rendered surface has at least one usable
|
|
57
|
+
* answer control and no impossible flag combinations survive.
|
|
58
|
+
*/
|
|
59
|
+
function normalizeQuestion(q) {
|
|
60
|
+
const hasOptions = (q.options?.length ?? 0) > 0;
|
|
61
|
+
return {
|
|
62
|
+
question: q.question,
|
|
63
|
+
title: q.title,
|
|
64
|
+
options: q.options,
|
|
65
|
+
// Guarantee at least one answer control: with no options, free text must
|
|
66
|
+
// be offered regardless of the requested flag, otherwise a question would
|
|
67
|
+
// render only a Skip control and no way to answer.
|
|
68
|
+
allowFreeText: hasOptions ? q.allowFreeText : true,
|
|
69
|
+
// multiSelect is only meaningful with options; multiline only with free
|
|
70
|
+
// text — normalize away impossible combinations.
|
|
71
|
+
multiSelect: hasOptions ? q.multiSelect : undefined,
|
|
72
|
+
multiline: hasOptions ? (q.allowFreeText === false ? undefined : q.multiline) : q.multiline,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
// ============================================================================
|
|
47
76
|
// Result helpers
|
|
48
77
|
function textResult(text, details) {
|
|
49
78
|
return {
|
|
@@ -51,142 +80,137 @@ function textResult(text, details) {
|
|
|
51
80
|
details,
|
|
52
81
|
};
|
|
53
82
|
}
|
|
54
|
-
function
|
|
55
|
-
return { question:
|
|
83
|
+
function skippedAnswer(q) {
|
|
84
|
+
return { question: q.question, title: q.title, selected: [], skipped: true };
|
|
56
85
|
}
|
|
57
|
-
function unavailableResult(
|
|
86
|
+
function unavailableResult(questions) {
|
|
58
87
|
return textResult("The ask_user tool requires an interactive UI, which is not available in this mode. " +
|
|
59
|
-
"Proceed using your best judgment without waiting for an answer.", {
|
|
88
|
+
"Proceed using your best judgment without waiting for an answer.", { answers: questions.map(skippedAnswer), unavailable: true });
|
|
60
89
|
}
|
|
61
|
-
function unansweredResult(
|
|
62
|
-
return textResult("The
|
|
63
|
-
|
|
64
|
-
selected: [],
|
|
65
|
-
skipped: true,
|
|
90
|
+
function unansweredResult(questions) {
|
|
91
|
+
return textResult("The questions closed without an answer.", {
|
|
92
|
+
answers: questions.map(skippedAnswer),
|
|
66
93
|
unavailable: false,
|
|
67
94
|
});
|
|
68
95
|
}
|
|
69
|
-
function failedResult(
|
|
70
|
-
return textResult("The
|
|
71
|
-
"Continue without this input.", {
|
|
72
|
-
...baseDetails(input),
|
|
73
|
-
selected: [],
|
|
74
|
-
skipped: false,
|
|
75
|
-
unavailable: false,
|
|
76
|
-
failed: true,
|
|
77
|
-
});
|
|
96
|
+
function failedResult(questions) {
|
|
97
|
+
return textResult("The questions could not be delivered because the interactive UI or response protocol failed. " +
|
|
98
|
+
"Continue without this input.", { answers: questions.map(skippedAnswer), unavailable: false, failed: true });
|
|
78
99
|
}
|
|
79
|
-
|
|
100
|
+
/** Build a per-question detail entry from the user's answer. */
|
|
101
|
+
function toAnswerDetail(q, answer) {
|
|
102
|
+
if (!answer || answer.skipped)
|
|
103
|
+
return skippedAnswer(q);
|
|
80
104
|
const customText = answer.customText?.trim() || undefined;
|
|
81
|
-
const selected = answer.selected;
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
105
|
+
const selected = answer.selected ?? [];
|
|
106
|
+
if (selected.length === 0 && !customText)
|
|
107
|
+
return skippedAnswer(q);
|
|
108
|
+
return { question: q.question, title: q.title, selected, customText, skipped: false };
|
|
109
|
+
}
|
|
110
|
+
/** Compose the model-facing summary, one block per question. */
|
|
111
|
+
function summarizeAnswers(details) {
|
|
112
|
+
const blocks = details.map((d) => {
|
|
113
|
+
const heading = (d.title || d.question || "").replace(/\s+/g, " ").trim();
|
|
114
|
+
if (d.skipped)
|
|
115
|
+
return `**${heading}** → (no answer)`;
|
|
116
|
+
const parts = [];
|
|
117
|
+
if (d.selected.length > 0)
|
|
118
|
+
parts.push(`Selected: ${d.selected.join(", ")}`);
|
|
119
|
+
if (d.customText)
|
|
120
|
+
parts.push(`wrote: "${d.customText}"`);
|
|
121
|
+
return `**${heading}** → ${parts.join(" / ")}`;
|
|
95
122
|
});
|
|
123
|
+
return blocks.join("\n");
|
|
124
|
+
}
|
|
125
|
+
function answeredResult(questions, result) {
|
|
126
|
+
const details = questions.map((q, i) => toAnswerDetail(q, result.answers[i]));
|
|
127
|
+
return textResult(summarizeAnswers(details), { answers: details, unavailable: false });
|
|
96
128
|
}
|
|
97
129
|
// ============================================================================
|
|
98
130
|
// Render helpers
|
|
131
|
+
function callLabel(args) {
|
|
132
|
+
const questions = args?.questions ?? [];
|
|
133
|
+
const count = questions.length;
|
|
134
|
+
if (count === 1) {
|
|
135
|
+
const first = questions[0];
|
|
136
|
+
const label = (first?.title || first?.question || "").replace(/\s+/g, " ").trim();
|
|
137
|
+
return label.length > 80 ? `${label.slice(0, 79)}…` : label;
|
|
138
|
+
}
|
|
139
|
+
return `${count} questions`;
|
|
140
|
+
}
|
|
99
141
|
function formatCall(args, theme) {
|
|
100
|
-
|
|
101
|
-
const shown = label.length > 80 ? `${label.slice(0, 79)}…` : label;
|
|
102
|
-
return `${theme.fg("toolTitle", theme.bold("ask_user"))} ${theme.fg("accent", shown)}`;
|
|
142
|
+
return `${theme.fg("toolTitle", theme.bold("ask_user"))} ${theme.fg("accent", callLabel(args))}`;
|
|
103
143
|
}
|
|
104
144
|
function formatResult(details, theme) {
|
|
105
145
|
if (details.unavailable)
|
|
106
146
|
return theme.fg("toolOutput", "no interactive UI — continued without asking");
|
|
107
147
|
if (details.failed)
|
|
108
148
|
return theme.fg("toolOutput", "interactive UI failed — continued without an answer");
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
if (details.
|
|
113
|
-
parts
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
149
|
+
const answered = details.answers.filter((a) => !a.skipped);
|
|
150
|
+
if (answered.length === 0)
|
|
151
|
+
return theme.fg("toolOutput", "closed without an answer");
|
|
152
|
+
if (details.answers.length === 1) {
|
|
153
|
+
const parts = [];
|
|
154
|
+
if (answered[0].selected.length > 0)
|
|
155
|
+
parts.push(answered[0].selected.join(", "));
|
|
156
|
+
if (answered[0].customText)
|
|
157
|
+
parts.push(`"${answered[0].customText}"`);
|
|
158
|
+
return theme.fg("toolOutput", `→ ${parts.join(" + ")}`);
|
|
159
|
+
}
|
|
160
|
+
return theme.fg("toolOutput", `→ answered ${answered.length} of ${details.answers.length}`);
|
|
117
161
|
}
|
|
118
162
|
// ============================================================================
|
|
119
163
|
// Tool definition factory
|
|
120
164
|
/**
|
|
121
|
-
* Create an `ask_user` tool definition.
|
|
122
|
-
*
|
|
123
|
-
* one
|
|
165
|
+
* Create an `ask_user` tool definition.
|
|
166
|
+
*
|
|
167
|
+
* One call carries one or more questions, collected together in a single
|
|
168
|
+
* wizard and returned as a batch of answers. Every path — answer, skip, abort,
|
|
169
|
+
* timeout, or host failure — settles gracefully and never orphans a promise.
|
|
124
170
|
*/
|
|
125
171
|
export function createAskUserToolDefinition() {
|
|
126
|
-
// Per-session serialization: only one question is ever open at a time.
|
|
127
|
-
let tail = Promise.resolve();
|
|
128
|
-
const serialize = (run) => {
|
|
129
|
-
const result = tail.then(run, run);
|
|
130
|
-
// Always advance the queue, whether the call resolved, cancelled, timed
|
|
131
|
-
// out, or threw — so a failure can never wedge later questions.
|
|
132
|
-
tail = result.then(() => undefined, () => undefined);
|
|
133
|
-
return result;
|
|
134
|
-
};
|
|
135
172
|
return {
|
|
136
173
|
name: "ask_user",
|
|
137
174
|
label: "ask_user",
|
|
138
|
-
description: "Pause and ask the user
|
|
139
|
-
"free-text answer.
|
|
175
|
+
description: "Pause and ask the user one or more structured clarifying questions in a single call, each with " +
|
|
176
|
+
"optional multiple-choice options and a free-text answer. The questions are shown together as one " +
|
|
177
|
+
"wizard and answered as a batch. Use only when genuinely blocked by ambiguity with multiple viable " +
|
|
178
|
+
"paths — not for routine confirmation.",
|
|
140
179
|
parameters: askUserSchema,
|
|
141
|
-
promptSnippet: "Ask the user
|
|
180
|
+
promptSnippet: "Ask the user one or more clarifying questions with optional multiple-choice options and free text",
|
|
142
181
|
promptGuidelines: [
|
|
143
182
|
"Call ask_user ONLY when you are genuinely blocked by ambiguity and there are multiple viable paths forward",
|
|
144
183
|
"Do NOT use it for routine confirmation, permission, or things you can reasonably decide yourself",
|
|
145
|
-
"
|
|
184
|
+
"Batch everything you need in ONE call: put each distinct decision in the `questions` array — the user answers them all and submits once",
|
|
185
|
+
"Provide 2-4 concrete `options` per question when there are clear candidate answers; the user can always type their own",
|
|
146
186
|
"Set `multiSelect: true` when several options can be combined; `multiline: true` for open-ended answers",
|
|
147
|
-
"The user may stop the current turn instead of answering; never treat that as an answer",
|
|
148
|
-
"Prefer one focused question over many; the question blocks the turn until the user responds or stops it",
|
|
187
|
+
"The user may stop the current turn instead of answering; never treat that as an answer, and unanswered questions come back as skipped",
|
|
149
188
|
],
|
|
150
189
|
async execute(_toolCallId, input, signal, _onUpdate, ctx) {
|
|
151
|
-
const
|
|
152
|
-
const request = {
|
|
153
|
-
question: input.question,
|
|
154
|
-
title: input.title,
|
|
155
|
-
options: input.options,
|
|
156
|
-
// Guarantee at least one answer control: with no options, free text
|
|
157
|
-
// must be offered regardless of the requested flag, otherwise both
|
|
158
|
-
// surfaces would render only a Skip button and no way to answer.
|
|
159
|
-
allowFreeText: hasOptions ? input.allowFreeText : true,
|
|
160
|
-
// multiSelect is only meaningful with options; multiline only with
|
|
161
|
-
// free text — normalize away impossible combinations.
|
|
162
|
-
multiSelect: hasOptions ? input.multiSelect : undefined,
|
|
163
|
-
multiline: hasOptions ? (input.allowFreeText === false ? undefined : input.multiline) : input.multiline,
|
|
164
|
-
};
|
|
190
|
+
const questions = input.questions.map(normalizeQuestion);
|
|
191
|
+
const request = { questions };
|
|
165
192
|
// Optional auto-stop timeout, forwarded to every UI surface (TUI
|
|
166
193
|
// countdown, RPC/Dashboard). Model-facing units are seconds.
|
|
167
194
|
const timeout = input.timeoutSeconds && input.timeoutSeconds > 0 ? input.timeoutSeconds * 1000 : undefined;
|
|
168
195
|
// Headless / print / no-host modes: never block on an unreachable UI.
|
|
169
196
|
if (!ctx?.hasUI) {
|
|
170
|
-
return unavailableResult(
|
|
197
|
+
return unavailableResult(questions);
|
|
198
|
+
}
|
|
199
|
+
// A call whose signal already aborted settles without ever opening the
|
|
200
|
+
// UI; the parent turn is already stopping.
|
|
201
|
+
if (signal?.aborted)
|
|
202
|
+
return unansweredResult(questions);
|
|
203
|
+
try {
|
|
204
|
+
const answer = await ctx.ui.ask(request, { signal, timeout });
|
|
205
|
+
if (!answer)
|
|
206
|
+
return unansweredResult(questions);
|
|
207
|
+
return answeredResult(questions, answer);
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// Host/protocol failure must still settle and never deadlock, but it
|
|
211
|
+
// must not masquerade as an intentional user skip.
|
|
212
|
+
return failedResult(questions);
|
|
171
213
|
}
|
|
172
|
-
return serialize(async () => {
|
|
173
|
-
// A queued call whose signal already aborted settles without ever
|
|
174
|
-
// opening the UI; the parent turn is already stopping.
|
|
175
|
-
if (signal?.aborted)
|
|
176
|
-
return unansweredResult(input);
|
|
177
|
-
try {
|
|
178
|
-
const answer = await ctx.ui.ask(request, { signal, timeout });
|
|
179
|
-
if (!answer || (answer.selected.length === 0 && !answer.customText?.trim())) {
|
|
180
|
-
return unansweredResult(input);
|
|
181
|
-
}
|
|
182
|
-
return answeredResult(input, answer);
|
|
183
|
-
}
|
|
184
|
-
catch {
|
|
185
|
-
// Host/protocol failure must still release the queue and never
|
|
186
|
-
// deadlock, but it must not masquerade as an intentional user skip.
|
|
187
|
-
return failedResult(input);
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
214
|
},
|
|
191
215
|
renderCall(args, theme, context) {
|
|
192
216
|
const text = context.lastComponent ?? new Text("", 0, 0, undefined, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../../src/core/tools/ask-user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAmBtD,+EAA+E;AAC/E,SAAS;AAET,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IACjC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,6FAA6F;KAC1G,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,QAAQ,CACnB,IAAI,CAAC,MAAM,CAAC;QACX,WAAW,EAAE,6CAA6C;KAC1D,CAAC,CACF;IACD,OAAO,EAAE,IAAI,CAAC,QAAQ,CACrB,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,qBAAqB,EAAE,CAAC,EAAE;QACzE,QAAQ,EAAE,CAAC;QACX,QAAQ,EAAE,CAAC;QACX,WAAW,EAAE,wDAAwD;KACrE,CAAC,CACF;IACD,aAAa,EAAE,IAAI,CAAC,QAAQ,CAC3B,IAAI,CAAC,OAAO,CAAC;QACZ,WAAW,EAAE,yDAAyD;KACtE,CAAC,CAC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AC,CAAC;QAAA,CACH;QAED,UAAU,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;YAChC,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAChG,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC,CAAC;YACtC,OAAO,IAAI,CAAC;QAAA,CACZ;QAED,YAAY,CAAC,MAAM,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE;YAC9C,MAAM,IAAI,GAAI,OAAO,CAAC,aAAkC,IAAI,IAAI,IAAI,CAAC,EAAE,EAAE,CAAC,EAAE,CAAC,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;YAChG,MAAM,OAAO,GAAI,MAAc,CAAC,OAAqC,CAAC;YACtE,IAAI,OAAO,EAAE,CAAC;gBACb,IAAI,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACP,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACpF,CAAC;YACD,OAAO,IAAI,CAAC;QAAA,CACZ;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * ask_user tool.\n *\n * Lets the agent pause and ask the user a structured clarifying question —\n * with optional multiple-choice options, single- or multi-select, and a\n * \"type your own answer\" free-text field — rendered natively in the TUI, the\n * Dashboard, and over RPC. Answering, stopping the turn, aborting, or timing\n * out always settles cleanly so the agent never deadlocks on an absent user.\n *\n * Concurrent calls are serialized through a per-session FIFO queue: only one\n * question is ever shown at a time, and a queued call whose signal aborts\n * settles without opening any UI.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { AskRequest, AskResult, ExtensionContext, ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\nexport interface AskUserDetails {\n\tquestion: string;\n\ttitle?: string;\n\tselected: string[];\n\tcustomText?: string;\n\t/** True when the question closed without an answer. */\n\tskipped: boolean;\n\t/** True when no interactive UI was available (headless/print mode). */\n\tunavailable: boolean;\n\t/** True when the UI host or response protocol failed. */\n\tfailed?: boolean;\n}\n\n// ============================================================================\n// Schema\n\nconst askUserSchema = Type.Object({\n\tquestion: Type.String({\n\t\tdescription: \"The Markdown-formatted question to ask the user. Be specific about what you need to decide.\",\n\t}),\n\ttitle: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Short bold header shown above the question.\",\n\t\t}),\n\t),\n\toptions: Type.Optional(\n\t\tType.Array(Type.String({ minLength: 1, pattern: \"^.*[^ \\\\t\\\\r\\\\n].*$\" }), {\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"2-4 nonblank suggested answers the user can pick from.\",\n\t\t}),\n\t),\n\tallowFreeText: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Offer a 'type your own answer' field. Defaults to true.\",\n\t\t}),\n\t),\n\tmultiSelect: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Allow selecting multiple options (checkboxes). Only meaningful with options.\",\n\t\t}),\n\t),\n\tmultiline: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Use a large multi-line text area for open-ended answers.\",\n\t\t}),\n\t),\n\ttimeoutSeconds: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 5,\n\t\t\tmaximum: 3600,\n\t\t\tdescription:\n\t\t\t\t\"Optional: stop the current agent turn after this many seconds if the user does not respond. \" +\n\t\t\t\t\"Shows a live countdown. Omit to wait indefinitely.\",\n\t\t}),\n\t),\n});\n\nexport type AskUserInput = Static<typeof askUserSchema>;\n\n// ============================================================================\n// Result helpers\n\nfunction textResult(text: string, details: AskUserDetails) {\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails,\n\t};\n}\n\nfunction baseDetails(input: AskUserInput): Omit<AskUserDetails, \"selected\" | \"skipped\" | \"unavailable\"> {\n\treturn { question: input.question, title: input.title };\n}\n\nfunction unavailableResult(input: AskUserInput) {\n\treturn textResult(\n\t\t\"The ask_user tool requires an interactive UI, which is not available in this mode. \" +\n\t\t\t\"Proceed using your best judgment without waiting for an answer.\",\n\t\t{ ...baseDetails(input), selected: [], skipped: true, unavailable: true },\n\t);\n}\n\nfunction unansweredResult(input: AskUserInput) {\n\treturn textResult(\"The question closed without an answer.\", {\n\t\t...baseDetails(input),\n\t\tselected: [],\n\t\tskipped: true,\n\t\tunavailable: false,\n\t});\n}\n\nfunction failedResult(input: AskUserInput) {\n\treturn textResult(\n\t\t\"The question could not be delivered because the interactive UI or response protocol failed. \" +\n\t\t\t\"Continue without this input.\",\n\t\t{\n\t\t\t...baseDetails(input),\n\t\t\tselected: [],\n\t\t\tskipped: false,\n\t\t\tunavailable: false,\n\t\t\tfailed: true,\n\t\t},\n\t);\n}\n\nfunction answeredResult(input: AskUserInput, answer: AskResult) {\n\tconst customText = answer.customText?.trim() || undefined;\n\tconst selected = answer.selected;\n\tconst parts: string[] = [];\n\tif (selected.length > 0) {\n\t\tparts.push(\n\t\t\tselected.length === 1 ? `The user selected: ${selected[0]}` : `The user selected: ${selected.join(\", \")}`,\n\t\t);\n\t}\n\tif (customText) {\n\t\tparts.push(selected.length > 0 ? `They also wrote: \"${customText}\"` : `The user answered: \"${customText}\"`);\n\t}\n\treturn textResult(parts.join(\" \"), {\n\t\t...baseDetails(input),\n\t\tselected,\n\t\tcustomText,\n\t\tskipped: false,\n\t\tunavailable: false,\n\t});\n}\n\n// ============================================================================\n// Render helpers\n\nfunction formatCall(args: { question?: string; title?: string } | undefined, theme: any): string {\n\tconst label = (args?.title || args?.question || \"\").replace(/\\s+/g, \" \").trim();\n\tconst shown = label.length > 80 ? `${label.slice(0, 79)}…` : label;\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"ask_user\"))} ${theme.fg(\"accent\", shown)}`;\n}\n\nfunction formatResult(details: AskUserDetails, theme: any): string {\n\tif (details.unavailable) return theme.fg(\"toolOutput\", \"no interactive UI — continued without asking\");\n\tif (details.failed) return theme.fg(\"toolOutput\", \"interactive UI failed — continued without an answer\");\n\tif (details.skipped) return theme.fg(\"toolOutput\", \"question closed without an answer\");\n\tconst parts: string[] = [];\n\tif (details.selected.length > 0) parts.push(details.selected.join(\", \"));\n\tif (details.customText) parts.push(`\"${details.customText}\"`);\n\treturn theme.fg(\"toolOutput\", `→ ${parts.join(\" + \")}`);\n}\n\n// ============================================================================\n// Tool definition factory\n\n/**\n * Create an `ask_user` tool definition. Each call creates an isolated FIFO\n * queue, so concurrent `ask_user` calls in a single session are shown strictly\n * one at a time.\n */\nexport function createAskUserToolDefinition(): ToolDefinition<typeof askUserSchema, AskUserDetails | undefined> {\n\t// Per-session serialization: only one question is ever open at a time.\n\tlet tail: Promise<void> = Promise.resolve();\n\tconst serialize = <T>(run: () => Promise<T>): Promise<T> => {\n\t\tconst result = tail.then(run, run);\n\t\t// Always advance the queue, whether the call resolved, cancelled, timed\n\t\t// out, or threw — so a failure can never wedge later questions.\n\t\ttail = result.then(\n\t\t\t() => undefined,\n\t\t\t() => undefined,\n\t\t);\n\t\treturn result;\n\t};\n\n\treturn {\n\t\tname: \"ask_user\",\n\t\tlabel: \"ask_user\",\n\t\tdescription:\n\t\t\t\"Pause and ask the user a structured clarifying question with optional multiple-choice options and a \" +\n\t\t\t\"free-text answer. Use only when genuinely blocked by ambiguity with multiple viable paths — not for routine confirmation.\",\n\n\t\tparameters: askUserSchema,\n\n\t\tpromptSnippet: \"Ask the user a clarifying question with optional multiple-choice options and free text\",\n\n\t\tpromptGuidelines: [\n\t\t\t\"Call ask_user ONLY when you are genuinely blocked by ambiguity and there are multiple viable paths forward\",\n\t\t\t\"Do NOT use it for routine confirmation, permission, or things you can reasonably decide yourself\",\n\t\t\t\"Provide 2-4 concrete `options` when there are clear candidate answers; the user can always type their own\",\n\t\t\t\"Set `multiSelect: true` when several options can be combined; `multiline: true` for open-ended answers\",\n\t\t\t\"The user may stop the current turn instead of answering; never treat that as an answer\",\n\t\t\t\"Prefer one focused question over many; the question blocks the turn until the user responds or stops it\",\n\t\t],\n\n\t\tasync execute(_toolCallId, input: AskUserInput, signal, _onUpdate, ctx?: ExtensionContext) {\n\t\t\tconst hasOptions = (input.options?.length ?? 0) > 0;\n\t\t\tconst request: AskRequest = {\n\t\t\t\tquestion: input.question,\n\t\t\t\ttitle: input.title,\n\t\t\t\toptions: input.options,\n\t\t\t\t// Guarantee at least one answer control: with no options, free text\n\t\t\t\t// must be offered regardless of the requested flag, otherwise both\n\t\t\t\t// surfaces would render only a Skip button and no way to answer.\n\t\t\t\tallowFreeText: hasOptions ? input.allowFreeText : true,\n\t\t\t\t// multiSelect is only meaningful with options; multiline only with\n\t\t\t\t// free text — normalize away impossible combinations.\n\t\t\t\tmultiSelect: hasOptions ? input.multiSelect : undefined,\n\t\t\t\tmultiline: hasOptions ? (input.allowFreeText === false ? undefined : input.multiline) : input.multiline,\n\t\t\t};\n\n\t\t\t// Optional auto-stop timeout, forwarded to every UI surface (TUI\n\t\t\t// countdown, RPC/Dashboard). Model-facing units are seconds.\n\t\t\tconst timeout = input.timeoutSeconds && input.timeoutSeconds > 0 ? input.timeoutSeconds * 1000 : undefined;\n\n\t\t\t// Headless / print / no-host modes: never block on an unreachable UI.\n\t\t\tif (!ctx?.hasUI) {\n\t\t\t\treturn unavailableResult(input);\n\t\t\t}\n\n\t\t\treturn serialize(async () => {\n\t\t\t\t// A queued call whose signal already aborted settles without ever\n\t\t\t\t// opening the UI; the parent turn is already stopping.\n\t\t\t\tif (signal?.aborted) return unansweredResult(input);\n\t\t\t\ttry {\n\t\t\t\t\tconst answer = await ctx.ui.ask(request, { signal, timeout });\n\t\t\t\t\tif (!answer || (answer.selected.length === 0 && !answer.customText?.trim())) {\n\t\t\t\t\t\treturn unansweredResult(input);\n\t\t\t\t\t}\n\t\t\t\t\treturn answeredResult(input, answer);\n\t\t\t\t} catch {\n\t\t\t\t\t// Host/protocol failure must still release the queue and never\n\t\t\t\t\t// deadlock, but it must not masquerade as an intentional user skip.\n\t\t\t\t\treturn failedResult(input);\n\t\t\t\t}\n\t\t\t});\n\t\t},\n\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\t\ttext.setText(formatCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\n\t\trenderResult(result, _options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\t\tconst details = (result as any).details as AskUserDetails | undefined;\n\t\t\tif (details) {\n\t\t\t\ttext.setText(formatResult(details, theme));\n\t\t\t} else {\n\t\t\t\tconst content = result.content?.[0];\n\t\t\t\ttext.setText(theme.fg(\"toolOutput\", content?.type === \"text\" ? content.text : \"\"));\n\t\t\t}\n\t\t\treturn text;\n\t\t},\n\t};\n}\n"]}
|
|
1
|
+
{"version":3,"file":"ask-user.js","sourceRoot":"","sources":["../../../src/core/tools/ask-user.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAe,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAyBtD,+EAA+E;AAC/E,SAAS;AAET,MAAM,cAAc,GAAG,IAAI,CAAC,MAAM,CAAC;IAClC,QAAQ,EAAE,IAAI,CAAC,MAAM,CAAC;QACrB,WAAW,EAAE,6FAA6F;KAC1G,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,QA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,CAAC,OAAO,CAAC,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACP,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;gBACpC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,EAAE,OAAO,EAAE,IAAI,KAAK,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;YACpF,CAAC;YACD,OAAO,IAAI,CAAC;QAAA,CACZ;KACD,CAAC;AAAA,CACF","sourcesContent":["/**\n * ask_user tool.\n *\n * Lets the agent pause and ask the user one or more structured clarifying\n * questions in a single call — each with optional multiple-choice options,\n * single- or multi-select, and a \"type your own answer\" free-text field —\n * rendered natively as a wizard in the TUI, the Dashboard, and over RPC. The\n * whole batch is answered together and returned as one result. Answering,\n * stopping the turn, aborting, or timing out always settles cleanly so the\n * agent never deadlocks on an absent user. Unanswered questions come back\n * flagged as skipped rather than blocking the turn.\n */\n\nimport { Text } from \"@dreb/tui\";\nimport { type Static, Type } from \"@sinclair/typebox\";\nimport type { AskQuestion, AskRequest, AskResult, ExtensionContext, ToolDefinition } from \"../extensions/types.js\";\n\n// ============================================================================\n// Types\n\n/** One question's outcome, surfaced in the tool result details. */\nexport interface AskUserAnswerDetail {\n\tquestion: string;\n\ttitle?: string;\n\tselected: string[];\n\tcustomText?: string;\n\t/** True when this question closed without an answer. */\n\tskipped: boolean;\n}\n\nexport interface AskUserDetails {\n\t/** One entry per question asked, in order. */\n\tanswers: AskUserAnswerDetail[];\n\t/** True when no interactive UI was available (headless/print mode). */\n\tunavailable: boolean;\n\t/** True when the UI host or response protocol failed. */\n\tfailed?: boolean;\n}\n\n// ============================================================================\n// Schema\n\nconst questionSchema = Type.Object({\n\tquestion: Type.String({\n\t\tdescription: \"The Markdown-formatted question to ask the user. Be specific about what you need to decide.\",\n\t}),\n\ttitle: Type.Optional(\n\t\tType.String({\n\t\t\tdescription: \"Short bold header shown above this question.\",\n\t\t}),\n\t),\n\toptions: Type.Optional(\n\t\tType.Array(Type.String({ minLength: 1, pattern: \"^.*[^ \\\\t\\\\r\\\\n].*$\" }), {\n\t\t\tminItems: 2,\n\t\t\tmaxItems: 4,\n\t\t\tdescription: \"2-4 nonblank suggested answers the user can pick from.\",\n\t\t}),\n\t),\n\tallowFreeText: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Offer a 'type your own answer' field. Defaults to true.\",\n\t\t}),\n\t),\n\tmultiSelect: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Allow selecting multiple options (checkboxes). Only meaningful with options.\",\n\t\t}),\n\t),\n\tmultiline: Type.Optional(\n\t\tType.Boolean({\n\t\t\tdescription: \"Use a large multi-line text area for open-ended answers.\",\n\t\t}),\n\t),\n});\n\nconst askUserSchema = Type.Object({\n\tquestions: Type.Array(questionSchema, {\n\t\tminItems: 1,\n\t\tmaxItems: 10,\n\t\tdescription:\n\t\t\t\"One or more clarifying questions to ask together in a single wizard. \" +\n\t\t\t\"Batch every question you need answered in one call — the user answers them all and submits once.\",\n\t}),\n\ttimeoutSeconds: Type.Optional(\n\t\tType.Number({\n\t\t\tminimum: 5,\n\t\t\tmaximum: 3600,\n\t\t\tdescription:\n\t\t\t\t\"Optional: stop the current agent turn after this many seconds if the user does not respond. \" +\n\t\t\t\t\"Shows a live countdown. Omit to wait indefinitely.\",\n\t\t}),\n\t),\n});\n\nexport type AskUserInput = Static<typeof askUserSchema>;\ntype AskUserQuestion = Static<typeof questionSchema>;\n\n// ============================================================================\n// Normalization\n\n/**\n * Normalize a single question so every rendered surface has at least one usable\n * answer control and no impossible flag combinations survive.\n */\nfunction normalizeQuestion(q: AskUserQuestion): AskQuestion {\n\tconst hasOptions = (q.options?.length ?? 0) > 0;\n\treturn {\n\t\tquestion: q.question,\n\t\ttitle: q.title,\n\t\toptions: q.options,\n\t\t// Guarantee at least one answer control: with no options, free text must\n\t\t// be offered regardless of the requested flag, otherwise a question would\n\t\t// render only a Skip control and no way to answer.\n\t\tallowFreeText: hasOptions ? q.allowFreeText : true,\n\t\t// multiSelect is only meaningful with options; multiline only with free\n\t\t// text — normalize away impossible combinations.\n\t\tmultiSelect: hasOptions ? q.multiSelect : undefined,\n\t\tmultiline: hasOptions ? (q.allowFreeText === false ? undefined : q.multiline) : q.multiline,\n\t};\n}\n\n// ============================================================================\n// Result helpers\n\nfunction textResult(text: string, details: AskUserDetails) {\n\treturn {\n\t\tcontent: [{ type: \"text\" as const, text }],\n\t\tdetails,\n\t};\n}\n\nfunction skippedAnswer(q: AskQuestion): AskUserAnswerDetail {\n\treturn { question: q.question, title: q.title, selected: [], skipped: true };\n}\n\nfunction unavailableResult(questions: AskQuestion[]) {\n\treturn textResult(\n\t\t\"The ask_user tool requires an interactive UI, which is not available in this mode. \" +\n\t\t\t\"Proceed using your best judgment without waiting for an answer.\",\n\t\t{ answers: questions.map(skippedAnswer), unavailable: true },\n\t);\n}\n\nfunction unansweredResult(questions: AskQuestion[]) {\n\treturn textResult(\"The questions closed without an answer.\", {\n\t\tanswers: questions.map(skippedAnswer),\n\t\tunavailable: false,\n\t});\n}\n\nfunction failedResult(questions: AskQuestion[]) {\n\treturn textResult(\n\t\t\"The questions could not be delivered because the interactive UI or response protocol failed. \" +\n\t\t\t\"Continue without this input.\",\n\t\t{ answers: questions.map(skippedAnswer), unavailable: false, failed: true },\n\t);\n}\n\n/** Build a per-question detail entry from the user's answer. */\nfunction toAnswerDetail(q: AskQuestion, answer: AskResult[\"answers\"][number] | undefined): AskUserAnswerDetail {\n\tif (!answer || answer.skipped) return skippedAnswer(q);\n\tconst customText = answer.customText?.trim() || undefined;\n\tconst selected = answer.selected ?? [];\n\tif (selected.length === 0 && !customText) return skippedAnswer(q);\n\treturn { question: q.question, title: q.title, selected, customText, skipped: false };\n}\n\n/** Compose the model-facing summary, one block per question. */\nfunction summarizeAnswers(details: AskUserAnswerDetail[]): string {\n\tconst blocks = details.map((d) => {\n\t\tconst heading = (d.title || d.question || \"\").replace(/\\s+/g, \" \").trim();\n\t\tif (d.skipped) return `**${heading}** → (no answer)`;\n\t\tconst parts: string[] = [];\n\t\tif (d.selected.length > 0) parts.push(`Selected: ${d.selected.join(\", \")}`);\n\t\tif (d.customText) parts.push(`wrote: \"${d.customText}\"`);\n\t\treturn `**${heading}** → ${parts.join(\" / \")}`;\n\t});\n\treturn blocks.join(\"\\n\");\n}\n\nfunction answeredResult(questions: AskQuestion[], result: AskResult) {\n\tconst details = questions.map((q, i) => toAnswerDetail(q, result.answers[i]));\n\treturn textResult(summarizeAnswers(details), { answers: details, unavailable: false });\n}\n\n// ============================================================================\n// Render helpers\n\nfunction callLabel(args: { questions?: Array<{ title?: string; question?: string }> } | undefined): string {\n\tconst questions = args?.questions ?? [];\n\tconst count = questions.length;\n\tif (count === 1) {\n\t\tconst first = questions[0];\n\t\tconst label = (first?.title || first?.question || \"\").replace(/\\s+/g, \" \").trim();\n\t\treturn label.length > 80 ? `${label.slice(0, 79)}…` : label;\n\t}\n\treturn `${count} questions`;\n}\n\nfunction formatCall(\n\targs: { questions?: Array<{ title?: string; question?: string }> } | undefined,\n\ttheme: any,\n): string {\n\treturn `${theme.fg(\"toolTitle\", theme.bold(\"ask_user\"))} ${theme.fg(\"accent\", callLabel(args))}`;\n}\n\nfunction formatResult(details: AskUserDetails, theme: any): string {\n\tif (details.unavailable) return theme.fg(\"toolOutput\", \"no interactive UI — continued without asking\");\n\tif (details.failed) return theme.fg(\"toolOutput\", \"interactive UI failed — continued without an answer\");\n\tconst answered = details.answers.filter((a) => !a.skipped);\n\tif (answered.length === 0) return theme.fg(\"toolOutput\", \"closed without an answer\");\n\tif (details.answers.length === 1) {\n\t\tconst parts: string[] = [];\n\t\tif (answered[0].selected.length > 0) parts.push(answered[0].selected.join(\", \"));\n\t\tif (answered[0].customText) parts.push(`\"${answered[0].customText}\"`);\n\t\treturn theme.fg(\"toolOutput\", `→ ${parts.join(\" + \")}`);\n\t}\n\treturn theme.fg(\"toolOutput\", `→ answered ${answered.length} of ${details.answers.length}`);\n}\n\n// ============================================================================\n// Tool definition factory\n\n/**\n * Create an `ask_user` tool definition.\n *\n * One call carries one or more questions, collected together in a single\n * wizard and returned as a batch of answers. Every path — answer, skip, abort,\n * timeout, or host failure — settles gracefully and never orphans a promise.\n */\nexport function createAskUserToolDefinition(): ToolDefinition<typeof askUserSchema, AskUserDetails | undefined> {\n\treturn {\n\t\tname: \"ask_user\",\n\t\tlabel: \"ask_user\",\n\t\tdescription:\n\t\t\t\"Pause and ask the user one or more structured clarifying questions in a single call, each with \" +\n\t\t\t\"optional multiple-choice options and a free-text answer. The questions are shown together as one \" +\n\t\t\t\"wizard and answered as a batch. Use only when genuinely blocked by ambiguity with multiple viable \" +\n\t\t\t\"paths — not for routine confirmation.\",\n\n\t\tparameters: askUserSchema,\n\n\t\tpromptSnippet:\n\t\t\t\"Ask the user one or more clarifying questions with optional multiple-choice options and free text\",\n\n\t\tpromptGuidelines: [\n\t\t\t\"Call ask_user ONLY when you are genuinely blocked by ambiguity and there are multiple viable paths forward\",\n\t\t\t\"Do NOT use it for routine confirmation, permission, or things you can reasonably decide yourself\",\n\t\t\t\"Batch everything you need in ONE call: put each distinct decision in the `questions` array — the user answers them all and submits once\",\n\t\t\t\"Provide 2-4 concrete `options` per question when there are clear candidate answers; the user can always type their own\",\n\t\t\t\"Set `multiSelect: true` when several options can be combined; `multiline: true` for open-ended answers\",\n\t\t\t\"The user may stop the current turn instead of answering; never treat that as an answer, and unanswered questions come back as skipped\",\n\t\t],\n\n\t\tasync execute(_toolCallId, input: AskUserInput, signal, _onUpdate, ctx?: ExtensionContext) {\n\t\t\tconst questions = input.questions.map(normalizeQuestion);\n\t\t\tconst request: AskRequest = { questions };\n\n\t\t\t// Optional auto-stop timeout, forwarded to every UI surface (TUI\n\t\t\t// countdown, RPC/Dashboard). Model-facing units are seconds.\n\t\t\tconst timeout = input.timeoutSeconds && input.timeoutSeconds > 0 ? input.timeoutSeconds * 1000 : undefined;\n\n\t\t\t// Headless / print / no-host modes: never block on an unreachable UI.\n\t\t\tif (!ctx?.hasUI) {\n\t\t\t\treturn unavailableResult(questions);\n\t\t\t}\n\n\t\t\t// A call whose signal already aborted settles without ever opening the\n\t\t\t// UI; the parent turn is already stopping.\n\t\t\tif (signal?.aborted) return unansweredResult(questions);\n\n\t\t\ttry {\n\t\t\t\tconst answer = await ctx.ui.ask(request, { signal, timeout });\n\t\t\t\tif (!answer) return unansweredResult(questions);\n\t\t\t\treturn answeredResult(questions, answer);\n\t\t\t} catch {\n\t\t\t\t// Host/protocol failure must still settle and never deadlock, but it\n\t\t\t\t// must not masquerade as an intentional user skip.\n\t\t\t\treturn failedResult(questions);\n\t\t\t}\n\t\t},\n\n\t\trenderCall(args, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\t\ttext.setText(formatCall(args, theme));\n\t\t\treturn text;\n\t\t},\n\n\t\trenderResult(result, _options, theme, context) {\n\t\t\tconst text = (context.lastComponent as Text | undefined) ?? new Text(\"\", 0, 0, undefined, true);\n\t\t\tconst details = (result as any).details as AskUserDetails | undefined;\n\t\t\tif (details) {\n\t\t\t\ttext.setText(formatResult(details, theme));\n\t\t\t} else {\n\t\t\t\tconst content = result.content?.[0];\n\t\t\t\ttext.setText(theme.fg(\"toolOutput\", content?.type === \"text\" ? content.text : \"\"));\n\t\t\t}\n\t\t\treturn text;\n\t\t},\n\t};\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { type AskUserDetails, type AskUserInput, createAskUserToolDefinition, } from "./ask-user.js";
|
|
1
|
+
export { type AskUserAnswerDetail, type AskUserDetails, type AskUserInput, createAskUserToolDefinition, } from "./ask-user.js";
|
|
2
2
|
export { type BashOperations, type BashSpawnContext, type BashSpawnHook, type BashToolDetails, type BashToolInput, type BashToolOptions, bashTool, bashToolDefinition, createBashTool, createBashToolDefinition, createLocalBashOperations, } from "./bash.js";
|
|
3
3
|
export { createEditTool, createEditToolDefinition, type EditOperations, type EditToolDetails, type EditToolInput, type EditToolOptions, editTool, editToolDefinition, } from "./edit.js";
|
|
4
4
|
export { withFileMutationQueue } from "./file-mutation-queue.js";
|
|
@@ -193,12 +193,14 @@ export declare const allToolDefinitions: {
|
|
|
193
193
|
rebuild: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
194
194
|
}>, import("./search.js").SearchToolDetails, any>;
|
|
195
195
|
ask_user: ToolDefinition<import("@sinclair/typebox").TObject<{
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
196
|
+
questions: import("@sinclair/typebox").TArray<import("@sinclair/typebox").TObject<{
|
|
197
|
+
question: import("@sinclair/typebox").TString;
|
|
198
|
+
title: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TString>;
|
|
199
|
+
options: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TArray<import("@sinclair/typebox").TString>>;
|
|
200
|
+
allowFreeText: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
201
|
+
multiSelect: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
202
|
+
multiline: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TBoolean>;
|
|
203
|
+
}>>;
|
|
202
204
|
timeoutSeconds: import("@sinclair/typebox").TOptional<import("@sinclair/typebox").TNumber>;
|
|
203
205
|
}>, import("./ask-user.js").AskUserDetails | undefined, any>;
|
|
204
206
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,2BAA2B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO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serInput,\n\tcreateAskUserToolDefinition,\n} from \"./ask-user.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nexport {\n\tcreateSearchTool,\n\tcreateSearchToolDefinition,\n\tisSearchAvailable,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\tsearchTool,\n\tsearchToolDefinition,\n} from \"./search.js\";\nexport {\n\tcreateSkillTool,\n\tcreateSkillToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n\ttype SkillToolOptions,\n} from \"./skill.js\";\nexport {\n\tabortBackgroundAgents,\n\ttype BackgroundAgentInfo,\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tdiscoverAgentTypes,\n\tfilterSubagentTools,\n\tgetBackgroundAgents,\n\tgetRunningBackgroundAgents,\n\tpruneBackgroundAgents,\n\ttype SubagentArbitrationEvent,\n\ttype SubagentResult,\n\ttype SubagentStepMetadata,\n\ttype SubagentToolDetails,\n\ttype SubagentToolInput,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nexport {\n\tcreateSuggestNextToolDefinition,\n\ttype SuggestNextCallback,\n\ttype SuggestNextDetails,\n\ttype SuggestNextInput,\n} from \"./suggest-next.js\";\nexport {\n\tcreateTasksToolDefinition,\n\ttype SessionTask,\n\ttype TaskStatus,\n\ttype TasksToolDetails,\n\ttype TasksToolInput,\n\ttype TasksUpdateCallback,\n} from \"./tasks.js\";\nexport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWaitToolDefinition,\n\tformatWaitCall,\n\tformatWaitResult,\n\ttype WaitAgentInfo,\n\ttype WaitToolDetails,\n\ttype WaitToolInput,\n\ttype WaitToolOptions,\n\twaitToolDefinition,\n} from \"./wait.js\";\nexport {\n\tcreateLocalGithubCiOperations,\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\ttype GithubCiOperations,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nexport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\ttype WebFetchToolDetails,\n\ttype WebFetchToolInput,\n\ttype WebSearchConfig,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { createAskUserToolDefinition } from \"./ask-user.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createSearchTool, createSearchToolDefinition, searchTool, searchToolDefinition } from \"./search.js\";\nimport { createSkillTool, createSkillToolDefinition, type SkillToolOptions } from \"./skill.js\";\nimport {\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tgetRunningBackgroundAgents,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nimport { createSuggestNextToolDefinition, type SuggestNextCallback } from \"./suggest-next.js\";\nimport { createTasksToolDefinition, type TasksUpdateCallback } from \"./tasks.js\";\nimport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { createWaitToolDefinition, waitToolDefinition } from \"./wait.js\";\nimport {\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nimport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nconst tmpReadToolDefinition = createTmpReadToolDefinition();\nconst tmpReadTool = wrapToolDefinition(tmpReadToolDefinition);\nconst waitTool = wrapToolDefinition(waitToolDefinition);\nconst askUserToolDefinition = createAskUserToolDefinition();\nconst askUserTool = wrapToolDefinition(askUserToolDefinition);\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\tweb_search: webSearchTool,\n\tweb_fetch: webFetchTool,\n\tsubagent: subagentTool,\n\ttmp_read: tmpReadTool,\n\twait: waitTool,\n\twatch_github_ci: watchGithubCiTool,\n\tsearch: searchTool,\n\task_user: askUserTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n\tweb_search: webSearchToolDefinition,\n\tweb_fetch: webFetchToolDefinition,\n\tsubagent: subagentToolDefinition,\n\ttmp_read: tmpReadToolDefinition,\n\twait: waitToolDefinition,\n\twatch_github_ci: watchGithubCiToolDefinition,\n\tsearch: searchToolDefinition,\n\task_user: askUserToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tsubagent?: SubagentToolOptions;\n\tskill?: SkillToolOptions;\n\ttasks?: { onUpdate: TasksUpdateCallback };\n\tsuggestNext?: { onSuggest: SuggestNextCallback };\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", ToolDef> {\n\tconst tools: Record<string, ToolDef> = {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\n\t\tweb_search: createWebSearchToolDefinition(cwd),\n\t\tweb_fetch: createWebFetchToolDefinition(cwd),\n\t\tsubagent: createSubagentToolDefinition(cwd, options?.subagent),\n\t\ttmp_read: createTmpReadToolDefinition(options?.read),\n\t\twait: createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents }),\n\t\twatch_github_ci: createWatchGithubCiToolDefinition(cwd),\n\t\tsearch: createSearchToolDefinition(cwd),\n\t\task_user: createAskUserToolDefinition(),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillToolDefinition(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = createTasksToolDefinition(options.tasks.onUpdate);\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = createSuggestNextToolDefinition(options.suggestNext.onSuggest);\n\t}\n\treturn tools as Record<ToolName | \"skill\", ToolDef>;\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", Tool> {\n\tconst tools: Record<string, Tool> = {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\tweb_search: createWebSearchTool(cwd),\n\t\tweb_fetch: createWebFetchTool(cwd),\n\t\tsubagent: createSubagentTool(cwd, options?.subagent),\n\t\ttmp_read: wrapToolDefinition(createTmpReadToolDefinition(options?.read)),\n\t\twait: wrapToolDefinition(createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents })),\n\t\twatch_github_ci: createWatchGithubCiTool(cwd),\n\t\tsearch: createSearchTool(cwd),\n\t\task_user: wrapToolDefinition(createAskUserToolDefinition()),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillTool(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = wrapToolDefinition(createTasksToolDefinition(options.tasks.onUpdate));\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = wrapToolDefinition(createSuggestNextToolDefinition(options.suggestNext.onSuggest));\n\t}\n\treturn tools as Record<ToolName | \"skill\", Tool>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,YAAY,EACjB,2BAA2B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EACN,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACrB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EACxB,KAAK,cAAc,EACnB,KAAK,eAAe,EACpB,KAAK,aAAa,EAClB,KAAK,eAAe,EACpB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EACtB,KAAK,YAAY,EACjB,KAAK,aAAa,EAClB,KAAK,WAAW,EAChB,KA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AAE,OAAO,CAAC,CA4BjH;AAED,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAO7E;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,IAAI,EAAE,CAE/E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,MAAM,CAAC,QAAQ,GAAG,OAAO,EAAE,IAAI,CAAC,CA4BpG","sourcesContent":["export {\n\ttype AskUserAnswerDetail,\n\ttype AskUserDetails,\n\ttype AskUserInput,\n\tcreateAskUserToolDefinition,\n} from \"./ask-user.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nexport {\n\tcreateSearchTool,\n\tcreateSearchToolDefinition,\n\tisSearchAvailable,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\tsearchTool,\n\tsearchToolDefinition,\n} from \"./search.js\";\nexport {\n\tcreateSkillTool,\n\tcreateSkillToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n\ttype SkillToolOptions,\n} from \"./skill.js\";\nexport {\n\tabortBackgroundAgents,\n\ttype BackgroundAgentInfo,\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tdiscoverAgentTypes,\n\tfilterSubagentTools,\n\tgetBackgroundAgents,\n\tgetRunningBackgroundAgents,\n\tpruneBackgroundAgents,\n\ttype SubagentArbitrationEvent,\n\ttype SubagentResult,\n\ttype SubagentStepMetadata,\n\ttype SubagentToolDetails,\n\ttype SubagentToolInput,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nexport {\n\tcreateSuggestNextToolDefinition,\n\ttype SuggestNextCallback,\n\ttype SuggestNextDetails,\n\ttype SuggestNextInput,\n} from \"./suggest-next.js\";\nexport {\n\tcreateTasksToolDefinition,\n\ttype SessionTask,\n\ttype TaskStatus,\n\ttype TasksToolDetails,\n\ttype TasksToolInput,\n\ttype TasksUpdateCallback,\n} from \"./tasks.js\";\nexport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWaitToolDefinition,\n\tformatWaitCall,\n\tformatWaitResult,\n\ttype WaitAgentInfo,\n\ttype WaitToolDetails,\n\ttype WaitToolInput,\n\ttype WaitToolOptions,\n\twaitToolDefinition,\n} from \"./wait.js\";\nexport {\n\tcreateLocalGithubCiOperations,\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\ttype GithubCiOperations,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nexport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\ttype WebFetchToolDetails,\n\ttype WebFetchToolInput,\n\ttype WebSearchConfig,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { createAskUserToolDefinition } from \"./ask-user.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createSearchTool, createSearchToolDefinition, searchTool, searchToolDefinition } from \"./search.js\";\nimport { createSkillTool, createSkillToolDefinition, type SkillToolOptions } from \"./skill.js\";\nimport {\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tgetRunningBackgroundAgents,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nimport { createSuggestNextToolDefinition, type SuggestNextCallback } from \"./suggest-next.js\";\nimport { createTasksToolDefinition, type TasksUpdateCallback } from \"./tasks.js\";\nimport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { createWaitToolDefinition, waitToolDefinition } from \"./wait.js\";\nimport {\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nimport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nconst tmpReadToolDefinition = createTmpReadToolDefinition();\nconst tmpReadTool = wrapToolDefinition(tmpReadToolDefinition);\nconst waitTool = wrapToolDefinition(waitToolDefinition);\nconst askUserToolDefinition = createAskUserToolDefinition();\nconst askUserTool = wrapToolDefinition(askUserToolDefinition);\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\tweb_search: webSearchTool,\n\tweb_fetch: webFetchTool,\n\tsubagent: subagentTool,\n\ttmp_read: tmpReadTool,\n\twait: waitTool,\n\twatch_github_ci: watchGithubCiTool,\n\tsearch: searchTool,\n\task_user: askUserTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n\tweb_search: webSearchToolDefinition,\n\tweb_fetch: webFetchToolDefinition,\n\tsubagent: subagentToolDefinition,\n\ttmp_read: tmpReadToolDefinition,\n\twait: waitToolDefinition,\n\twatch_github_ci: watchGithubCiToolDefinition,\n\tsearch: searchToolDefinition,\n\task_user: askUserToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tsubagent?: SubagentToolOptions;\n\tskill?: SkillToolOptions;\n\ttasks?: { onUpdate: TasksUpdateCallback };\n\tsuggestNext?: { onSuggest: SuggestNextCallback };\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", ToolDef> {\n\tconst tools: Record<string, ToolDef> = {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\n\t\tweb_search: createWebSearchToolDefinition(cwd),\n\t\tweb_fetch: createWebFetchToolDefinition(cwd),\n\t\tsubagent: createSubagentToolDefinition(cwd, options?.subagent),\n\t\ttmp_read: createTmpReadToolDefinition(options?.read),\n\t\twait: createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents }),\n\t\twatch_github_ci: createWatchGithubCiToolDefinition(cwd),\n\t\tsearch: createSearchToolDefinition(cwd),\n\t\task_user: createAskUserToolDefinition(),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillToolDefinition(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = createTasksToolDefinition(options.tasks.onUpdate);\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = createSuggestNextToolDefinition(options.suggestNext.onSuggest);\n\t}\n\treturn tools as Record<ToolName | \"skill\", ToolDef>;\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", Tool> {\n\tconst tools: Record<string, Tool> = {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\tweb_search: createWebSearchTool(cwd),\n\t\tweb_fetch: createWebFetchTool(cwd),\n\t\tsubagent: createSubagentTool(cwd, options?.subagent),\n\t\ttmp_read: wrapToolDefinition(createTmpReadToolDefinition(options?.read)),\n\t\twait: wrapToolDefinition(createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents })),\n\t\twatch_github_ci: createWatchGithubCiTool(cwd),\n\t\tsearch: createSearchTool(cwd),\n\t\task_user: wrapToolDefinition(createAskUserToolDefinition()),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillTool(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = wrapToolDefinition(createTasksToolDefinition(options.tasks.onUpdate));\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = wrapToolDefinition(createSuggestNextToolDefinition(options.suggestNext.onSuggest));\n\t}\n\treturn tools as Record<ToolName | \"skill\", Tool>;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAGN,2BAA2B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAs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CAAC,CAAC;IACnD,CAAC;IACD,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,KAAK,CAAC,YAAY,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QAC1B,KAAK,CAAC,YAAY,GAAG,kBAAkB,CAAC,+BAA+B,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,KAAyC,CAAC;AAAA,CACjD","sourcesContent":["export {\n\ttype AskUserDetails,\n\ttype AskUserInput,\n\tcreateAskUserToolDefinition,\n} from \"./ask-user.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nexport {\n\tcreateSearchTool,\n\tcreateSearchToolDefinition,\n\tisSearchAvailable,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\tsearchTool,\n\tsearchToolDefinition,\n} from \"./search.js\";\nexport {\n\tcreateSkillTool,\n\tcreateSkillToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n\ttype SkillToolOptions,\n} from \"./skill.js\";\nexport {\n\tabortBackgroundAgents,\n\ttype BackgroundAgentInfo,\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tdiscoverAgentTypes,\n\tfilterSubagentTools,\n\tgetBackgroundAgents,\n\tgetRunningBackgroundAgents,\n\tpruneBackgroundAgents,\n\ttype SubagentArbitrationEvent,\n\ttype SubagentResult,\n\ttype SubagentStepMetadata,\n\ttype SubagentToolDetails,\n\ttype SubagentToolInput,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nexport {\n\tcreateSuggestNextToolDefinition,\n\ttype SuggestNextCallback,\n\ttype SuggestNextDetails,\n\ttype SuggestNextInput,\n} from \"./suggest-next.js\";\nexport {\n\tcreateTasksToolDefinition,\n\ttype SessionTask,\n\ttype TaskStatus,\n\ttype TasksToolDetails,\n\ttype TasksToolInput,\n\ttype TasksUpdateCallback,\n} from \"./tasks.js\";\nexport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWaitToolDefinition,\n\tformatWaitCall,\n\tformatWaitResult,\n\ttype WaitAgentInfo,\n\ttype WaitToolDetails,\n\ttype WaitToolInput,\n\ttype WaitToolOptions,\n\twaitToolDefinition,\n} from \"./wait.js\";\nexport {\n\tcreateLocalGithubCiOperations,\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\ttype GithubCiOperations,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nexport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\ttype WebFetchToolDetails,\n\ttype WebFetchToolInput,\n\ttype WebSearchConfig,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { createAskUserToolDefinition } from \"./ask-user.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createSearchTool, createSearchToolDefinition, searchTool, searchToolDefinition } from \"./search.js\";\nimport { createSkillTool, createSkillToolDefinition, type SkillToolOptions } from \"./skill.js\";\nimport {\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tgetRunningBackgroundAgents,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nimport { createSuggestNextToolDefinition, type SuggestNextCallback } from \"./suggest-next.js\";\nimport { createTasksToolDefinition, type TasksUpdateCallback } from \"./tasks.js\";\nimport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { createWaitToolDefinition, waitToolDefinition } from \"./wait.js\";\nimport {\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nimport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nconst tmpReadToolDefinition = createTmpReadToolDefinition();\nconst tmpReadTool = wrapToolDefinition(tmpReadToolDefinition);\nconst waitTool = wrapToolDefinition(waitToolDefinition);\nconst askUserToolDefinition = createAskUserToolDefinition();\nconst askUserTool = wrapToolDefinition(askUserToolDefinition);\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\tweb_search: webSearchTool,\n\tweb_fetch: webFetchTool,\n\tsubagent: subagentTool,\n\ttmp_read: tmpReadTool,\n\twait: waitTool,\n\twatch_github_ci: watchGithubCiTool,\n\tsearch: searchTool,\n\task_user: askUserTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n\tweb_search: webSearchToolDefinition,\n\tweb_fetch: webFetchToolDefinition,\n\tsubagent: subagentToolDefinition,\n\ttmp_read: tmpReadToolDefinition,\n\twait: waitToolDefinition,\n\twatch_github_ci: watchGithubCiToolDefinition,\n\tsearch: searchToolDefinition,\n\task_user: askUserToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tsubagent?: SubagentToolOptions;\n\tskill?: SkillToolOptions;\n\ttasks?: { onUpdate: TasksUpdateCallback };\n\tsuggestNext?: { onSuggest: SuggestNextCallback };\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", ToolDef> {\n\tconst tools: Record<string, ToolDef> = {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\n\t\tweb_search: createWebSearchToolDefinition(cwd),\n\t\tweb_fetch: createWebFetchToolDefinition(cwd),\n\t\tsubagent: createSubagentToolDefinition(cwd, options?.subagent),\n\t\ttmp_read: createTmpReadToolDefinition(options?.read),\n\t\twait: createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents }),\n\t\twatch_github_ci: createWatchGithubCiToolDefinition(cwd),\n\t\tsearch: createSearchToolDefinition(cwd),\n\t\task_user: createAskUserToolDefinition(),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillToolDefinition(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = createTasksToolDefinition(options.tasks.onUpdate);\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = createSuggestNextToolDefinition(options.suggestNext.onSuggest);\n\t}\n\treturn tools as Record<ToolName | \"skill\", ToolDef>;\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", Tool> {\n\tconst tools: Record<string, Tool> = {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\tweb_search: createWebSearchTool(cwd),\n\t\tweb_fetch: createWebFetchTool(cwd),\n\t\tsubagent: createSubagentTool(cwd, options?.subagent),\n\t\ttmp_read: wrapToolDefinition(createTmpReadToolDefinition(options?.read)),\n\t\twait: wrapToolDefinition(createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents })),\n\t\twatch_github_ci: createWatchGithubCiTool(cwd),\n\t\tsearch: createSearchTool(cwd),\n\t\task_user: wrapToolDefinition(createAskUserToolDefinition()),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillTool(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = wrapToolDefinition(createTasksToolDefinition(options.tasks.onUpdate));\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = wrapToolDefinition(createSuggestNextToolDefinition(options.suggestNext.onSuggest));\n\t}\n\treturn tools as Record<ToolName | \"skill\", Tool>;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/core/tools/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAIN,2BAA2B,GAC3B,MAAM,eAAe,CAAC;AACvB,OAAO,EAON,QAAQ,EACR,kBAAkB,EAClB,cAAc,EACd,wBAAwB,EACxB,yBAAyB,GACzB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,cAAc,EACd,wBAAwB,EAKxB,QAAQ,EACR,kBAAkB,GAClB,MAAM,WAAW,CAAC;AACnB,OAAO,EACN,YAAY,EACZ,sBAAsB,EAKtB,MAAM,EACN,gBA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IACD,IAAI,OAAO,EAAE,KAAK,EAAE,CAAC;QACpB,KAAK,CAAC,YAAY,GAAG,kBAAkB,CAAC,yBAAyB,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAC;IAC5F,CAAC;IACD,IAAI,OAAO,EAAE,WAAW,EAAE,CAAC;QAC1B,KAAK,CAAC,YAAY,GAAG,kBAAkB,CAAC,+BAA+B,CAAC,OAAO,CAAC,WAAW,CAAC,SAAS,CAAC,CAAC,CAAC;IACzG,CAAC;IACD,OAAO,KAAyC,CAAC;AAAA,CACjD","sourcesContent":["export {\n\ttype AskUserAnswerDetail,\n\ttype AskUserDetails,\n\ttype AskUserInput,\n\tcreateAskUserToolDefinition,\n} from \"./ask-user.js\";\nexport {\n\ttype BashOperations,\n\ttype BashSpawnContext,\n\ttype BashSpawnHook,\n\ttype BashToolDetails,\n\ttype BashToolInput,\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n\tcreateLocalBashOperations,\n} from \"./bash.js\";\nexport {\n\tcreateEditTool,\n\tcreateEditToolDefinition,\n\ttype EditOperations,\n\ttype EditToolDetails,\n\ttype EditToolInput,\n\ttype EditToolOptions,\n\teditTool,\n\teditToolDefinition,\n} from \"./edit.js\";\nexport { withFileMutationQueue } from \"./file-mutation-queue.js\";\nexport {\n\tcreateFindTool,\n\tcreateFindToolDefinition,\n\ttype FindOperations,\n\ttype FindToolDetails,\n\ttype FindToolInput,\n\ttype FindToolOptions,\n\tfindTool,\n\tfindToolDefinition,\n} from \"./find.js\";\nexport {\n\tcreateGrepTool,\n\tcreateGrepToolDefinition,\n\ttype GrepOperations,\n\ttype GrepToolDetails,\n\ttype GrepToolInput,\n\ttype GrepToolOptions,\n\tgrepTool,\n\tgrepToolDefinition,\n} from \"./grep.js\";\nexport {\n\tcreateLsTool,\n\tcreateLsToolDefinition,\n\ttype LsOperations,\n\ttype LsToolDetails,\n\ttype LsToolInput,\n\ttype LsToolOptions,\n\tlsTool,\n\tlsToolDefinition,\n} from \"./ls.js\";\nexport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadOperations,\n\ttype ReadToolDetails,\n\ttype ReadToolInput,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nexport {\n\tcreateSearchTool,\n\tcreateSearchToolDefinition,\n\tisSearchAvailable,\n\ttype SearchToolDetails,\n\ttype SearchToolInput,\n\tsearchTool,\n\tsearchToolDefinition,\n} from \"./search.js\";\nexport {\n\tcreateSkillTool,\n\tcreateSkillToolDefinition,\n\ttype SkillToolDetails,\n\ttype SkillToolInput,\n\ttype SkillToolOptions,\n} from \"./skill.js\";\nexport {\n\tabortBackgroundAgents,\n\ttype BackgroundAgentInfo,\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tdiscoverAgentTypes,\n\tfilterSubagentTools,\n\tgetBackgroundAgents,\n\tgetRunningBackgroundAgents,\n\tpruneBackgroundAgents,\n\ttype SubagentArbitrationEvent,\n\ttype SubagentResult,\n\ttype SubagentStepMetadata,\n\ttype SubagentToolDetails,\n\ttype SubagentToolInput,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nexport {\n\tcreateSuggestNextToolDefinition,\n\ttype SuggestNextCallback,\n\ttype SuggestNextDetails,\n\ttype SuggestNextInput,\n} from \"./suggest-next.js\";\nexport {\n\tcreateTasksToolDefinition,\n\ttype SessionTask,\n\ttype TaskStatus,\n\ttype TasksToolDetails,\n\ttype TasksToolInput,\n\ttype TasksUpdateCallback,\n} from \"./tasks.js\";\nexport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nexport {\n\tDEFAULT_MAX_BYTES,\n\tDEFAULT_MAX_LINES,\n\tformatSize,\n\ttype TruncationOptions,\n\ttype TruncationResult,\n\ttruncateHead,\n\ttruncateLine,\n\ttruncateTail,\n} from \"./truncate.js\";\nexport {\n\tcreateWaitToolDefinition,\n\tformatWaitCall,\n\tformatWaitResult,\n\ttype WaitAgentInfo,\n\ttype WaitToolDetails,\n\ttype WaitToolInput,\n\ttype WaitToolOptions,\n\twaitToolDefinition,\n} from \"./wait.js\";\nexport {\n\tcreateLocalGithubCiOperations,\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\ttype GithubCiOperations,\n\ttype WatchGithubCiToolDetails,\n\ttype WatchGithubCiToolInput,\n\ttype WatchGithubCiToolOptions,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nexport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\ttype WebFetchToolDetails,\n\ttype WebFetchToolInput,\n\ttype WebSearchConfig,\n\ttype WebSearchToolDetails,\n\ttype WebSearchToolInput,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nexport {\n\tcreateWriteTool,\n\tcreateWriteToolDefinition,\n\ttype WriteOperations,\n\ttype WriteToolInput,\n\ttype WriteToolOptions,\n\twriteTool,\n\twriteToolDefinition,\n} from \"./write.js\";\n\nimport type { AgentTool } from \"@dreb/agent-core\";\nimport type { ToolDefinition } from \"../extensions/types.js\";\nimport { createAskUserToolDefinition } from \"./ask-user.js\";\nimport {\n\ttype BashToolOptions,\n\tbashTool,\n\tbashToolDefinition,\n\tcreateBashTool,\n\tcreateBashToolDefinition,\n} from \"./bash.js\";\nimport { createEditTool, createEditToolDefinition, editTool, editToolDefinition } from \"./edit.js\";\nimport { createFindTool, createFindToolDefinition, findTool, findToolDefinition } from \"./find.js\";\nimport { createGrepTool, createGrepToolDefinition, grepTool, grepToolDefinition } from \"./grep.js\";\nimport { createLsTool, createLsToolDefinition, lsTool, lsToolDefinition } from \"./ls.js\";\nimport {\n\tcreateReadTool,\n\tcreateReadToolDefinition,\n\ttype ReadToolOptions,\n\treadTool,\n\treadToolDefinition,\n} from \"./read.js\";\nimport { createSearchTool, createSearchToolDefinition, searchTool, searchToolDefinition } from \"./search.js\";\nimport { createSkillTool, createSkillToolDefinition, type SkillToolOptions } from \"./skill.js\";\nimport {\n\tcreateSubagentTool,\n\tcreateSubagentToolDefinition,\n\tgetRunningBackgroundAgents,\n\ttype SubagentToolOptions,\n\tsubagentTool,\n\tsubagentToolDefinition,\n} from \"./subagent.js\";\nimport { createSuggestNextToolDefinition, type SuggestNextCallback } from \"./suggest-next.js\";\nimport { createTasksToolDefinition, type TasksUpdateCallback } from \"./tasks.js\";\nimport { createTmpReadToolDefinition } from \"./tmp-read.js\";\nimport { wrapToolDefinition } from \"./tool-definition-wrapper.js\";\nimport { createWaitToolDefinition, waitToolDefinition } from \"./wait.js\";\nimport {\n\tcreateWatchGithubCiTool,\n\tcreateWatchGithubCiToolDefinition,\n\twatchGithubCiTool,\n\twatchGithubCiToolDefinition,\n} from \"./watch-github-ci.js\";\nimport {\n\tcreateWebFetchTool,\n\tcreateWebFetchToolDefinition,\n\tcreateWebSearchTool,\n\tcreateWebSearchToolDefinition,\n\twebFetchTool,\n\twebFetchToolDefinition,\n\twebSearchTool,\n\twebSearchToolDefinition,\n} from \"./web.js\";\nimport { createWriteTool, createWriteToolDefinition, writeTool, writeToolDefinition } from \"./write.js\";\n\nexport type Tool = AgentTool<any>;\nexport type ToolDef = ToolDefinition<any, any>;\n\nexport const codingTools: Tool[] = [readTool, bashTool, editTool, writeTool];\nexport const readOnlyTools: Tool[] = [readTool, grepTool, findTool, lsTool];\n\nconst tmpReadToolDefinition = createTmpReadToolDefinition();\nconst tmpReadTool = wrapToolDefinition(tmpReadToolDefinition);\nconst waitTool = wrapToolDefinition(waitToolDefinition);\nconst askUserToolDefinition = createAskUserToolDefinition();\nconst askUserTool = wrapToolDefinition(askUserToolDefinition);\n\nexport const allTools = {\n\tread: readTool,\n\tbash: bashTool,\n\tedit: editTool,\n\twrite: writeTool,\n\tgrep: grepTool,\n\tfind: findTool,\n\tls: lsTool,\n\tweb_search: webSearchTool,\n\tweb_fetch: webFetchTool,\n\tsubagent: subagentTool,\n\ttmp_read: tmpReadTool,\n\twait: waitTool,\n\twatch_github_ci: watchGithubCiTool,\n\tsearch: searchTool,\n\task_user: askUserTool,\n};\n\nexport const allToolDefinitions = {\n\tread: readToolDefinition,\n\tbash: bashToolDefinition,\n\tedit: editToolDefinition,\n\twrite: writeToolDefinition,\n\tgrep: grepToolDefinition,\n\tfind: findToolDefinition,\n\tls: lsToolDefinition,\n\tweb_search: webSearchToolDefinition,\n\tweb_fetch: webFetchToolDefinition,\n\tsubagent: subagentToolDefinition,\n\ttmp_read: tmpReadToolDefinition,\n\twait: waitToolDefinition,\n\twatch_github_ci: watchGithubCiToolDefinition,\n\tsearch: searchToolDefinition,\n\task_user: askUserToolDefinition,\n};\n\nexport type ToolName = keyof typeof allTools;\n\nexport interface ToolsOptions {\n\tread?: ReadToolOptions;\n\tbash?: BashToolOptions;\n\tsubagent?: SubagentToolOptions;\n\tskill?: SkillToolOptions;\n\ttasks?: { onUpdate: TasksUpdateCallback };\n\tsuggestNext?: { onSuggest: SuggestNextCallback };\n}\n\nexport function createCodingToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateBashToolDefinition(cwd, options?.bash),\n\t\tcreateEditToolDefinition(cwd),\n\t\tcreateWriteToolDefinition(cwd),\n\t];\n}\n\nexport function createReadOnlyToolDefinitions(cwd: string, options?: ToolsOptions): ToolDef[] {\n\treturn [\n\t\tcreateReadToolDefinition(cwd, options?.read),\n\t\tcreateGrepToolDefinition(cwd),\n\t\tcreateFindToolDefinition(cwd),\n\t\tcreateLsToolDefinition(cwd),\n\t];\n}\n\nexport function createAllToolDefinitions(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", ToolDef> {\n\tconst tools: Record<string, ToolDef> = {\n\t\tread: createReadToolDefinition(cwd, options?.read),\n\t\tbash: createBashToolDefinition(cwd, options?.bash),\n\t\tedit: createEditToolDefinition(cwd),\n\t\twrite: createWriteToolDefinition(cwd),\n\t\tgrep: createGrepToolDefinition(cwd),\n\t\tfind: createFindToolDefinition(cwd),\n\t\tls: createLsToolDefinition(cwd),\n\t\tweb_search: createWebSearchToolDefinition(cwd),\n\t\tweb_fetch: createWebFetchToolDefinition(cwd),\n\t\tsubagent: createSubagentToolDefinition(cwd, options?.subagent),\n\t\ttmp_read: createTmpReadToolDefinition(options?.read),\n\t\twait: createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents }),\n\t\twatch_github_ci: createWatchGithubCiToolDefinition(cwd),\n\t\tsearch: createSearchToolDefinition(cwd),\n\t\task_user: createAskUserToolDefinition(),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillToolDefinition(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = createTasksToolDefinition(options.tasks.onUpdate);\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = createSuggestNextToolDefinition(options.suggestNext.onSuggest);\n\t}\n\treturn tools as Record<ToolName | \"skill\", ToolDef>;\n}\n\nexport function createCodingTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [\n\t\tcreateReadTool(cwd, options?.read),\n\t\tcreateBashTool(cwd, options?.bash),\n\t\tcreateEditTool(cwd),\n\t\tcreateWriteTool(cwd),\n\t];\n}\n\nexport function createReadOnlyTools(cwd: string, options?: ToolsOptions): Tool[] {\n\treturn [createReadTool(cwd, options?.read), createGrepTool(cwd), createFindTool(cwd), createLsTool(cwd)];\n}\n\nexport function createAllTools(cwd: string, options?: ToolsOptions): Record<ToolName | \"skill\", Tool> {\n\tconst tools: Record<string, Tool> = {\n\t\tread: createReadTool(cwd, options?.read),\n\t\tbash: createBashTool(cwd, options?.bash),\n\t\tedit: createEditTool(cwd),\n\t\twrite: createWriteTool(cwd),\n\t\tgrep: createGrepTool(cwd),\n\t\tfind: createFindTool(cwd),\n\t\tls: createLsTool(cwd),\n\t\tweb_search: createWebSearchTool(cwd),\n\t\tweb_fetch: createWebFetchTool(cwd),\n\t\tsubagent: createSubagentTool(cwd, options?.subagent),\n\t\ttmp_read: wrapToolDefinition(createTmpReadToolDefinition(options?.read)),\n\t\twait: wrapToolDefinition(createWaitToolDefinition({ getRunningAgents: getRunningBackgroundAgents })),\n\t\twatch_github_ci: createWatchGithubCiTool(cwd),\n\t\tsearch: createSearchTool(cwd),\n\t\task_user: wrapToolDefinition(createAskUserToolDefinition()),\n\t};\n\tif (options?.skill) {\n\t\ttools.skill = createSkillTool(cwd, options.skill);\n\t}\n\tif (options?.tasks) {\n\t\ttools.tasks_update = wrapToolDefinition(createTasksToolDefinition(options.tasks.onUpdate));\n\t}\n\tif (options?.suggestNext) {\n\t\ttools.suggest_next = wrapToolDefinition(createSuggestNextToolDefinition(options.suggestNext.onSuggest));\n\t}\n\treturn tools as Record<ToolName | \"skill\", Tool>;\n}\n"]}
|