Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/agent-manager-prompt-preview.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@kilocode/cli": patch
"kilo-code": patch
---

Show the target session and full outgoing prompt when asking permission to send a prompt through Agent Manager.
Original file line number Diff line number Diff line change
Expand Up @@ -299,7 +299,13 @@ export const PermissionDock: Component<{
when={skillShellCommands().length > 0}
fallback={
<>
<Show when={cmdDescription()}>{(desc) => <div data-slot="permission-hint">{desc()}</div>}</Show>
<Show when={cmdDescription()}>
{(desc) => (
<div data-slot="permission-hint" data-wrap>
{desc()}
</div>
)}
</Show>
<Show when={command()}>
{(cmd) => <PermissionCommand command={cmd()} plain={props.request.args.heredoc === true} />}
</Show>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@
font-size: var(--kilo-font-size-12);

&[data-wrap] {
white-space: pre-wrap;
overflow-wrap: anywhere;
word-break: normal;
}
Expand Down
9 changes: 7 additions & 2 deletions packages/opencode/src/kilocode/tool/agent-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,18 +281,23 @@ export const AgentManagerTool = Tool.define<
}
}
if (params.action === "prompt") {
const prompt = params.prompt.trim()
yield* ctx.ask({
permission: "agent_manager",
patterns: ["prompt"],
always: ["prompt"],
metadata: { action: "prompt", sessionID: params.sessionID },
metadata: {
action: "prompt",
sessionID: params.sessionID,
description: `Send a prompt to Agent Manager session ${params.sessionID}:\n\n${prompt}`,
},
})
const result = yield* run(
host.request({
operation: "prompt",
sessionID: ctx.sessionID,
targetSessionID: params.sessionID,
prompt: params.prompt.trim(),
prompt,
}),
ctx.abort,
)
Expand Down
26 changes: 21 additions & 5 deletions packages/opencode/test/kilocode/agent-manager-tool.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,12 @@ describe("agent_manager tool", () => {
await rt.dispose()
})

test("prompts one existing session with a separate mutation permission pattern", async () => {
test.each([
{ name: "single-line", prompt: "Continue the fix" },
{ name: "multiline", prompt: 'Review <script>alert("test")</script>.\n\n Keep `code` and **markup** literal.' },
{ name: "long", prompt: "Review the next file.\n".repeat(500) + "Report the final result." },
])("previews the full $name prompt before sending it to one session", async (item) => {
const prompt = item.prompt
const requests: unknown[] = []
const rt = makeRuntime("test", {
request: (input) =>
Expand All @@ -519,8 +524,15 @@ describe("agent_manager tool", () => {
const result = await rt.runPromise(
provideTmpdirInstance(() =>
tool.execute(
{ action: "prompt", sessionID: SessionID.make("ses_target"), prompt: " Continue the fix " },
{ ...ctx, ask: (input: unknown) => Effect.sync(() => permissions.push(input)) },
{ action: "prompt", sessionID: SessionID.make("ses_target"), prompt: ` ${prompt}\n ` },
{
...ctx,
ask: (input: unknown) =>
Effect.sync(() => {
expect(requests).toEqual([])
permissions.push(input)
}),
},
),
).pipe(Effect.scoped),
)
Expand All @@ -530,15 +542,19 @@ describe("agent_manager tool", () => {
permission: "agent_manager",
patterns: ["prompt"],
always: ["prompt"],
metadata: { action: "prompt", sessionID: "ses_target" },
metadata: {
action: "prompt",
sessionID: "ses_target",
description: `Send a prompt to Agent Manager session ses_target:\n\n${prompt}`,
},
},
])
expect(requests).toEqual([
{
operation: "prompt",
sessionID: ctx.sessionID,
targetSessionID: "ses_target",
prompt: "Continue the fix",
prompt,
},
])
expect(result.title).toBe("Prompt accepted")
Expand Down
Loading