refactor instructions to return object with full/system/user/event/runtime properties, fix duplicate modes and json prompt extraction (#110)
This commit is contained in:
committed by
pullfrog[bot]
parent
410b11db71
commit
cb925556e8
+1
-1
@@ -73,7 +73,7 @@ export const claude = agent({
|
||||
};
|
||||
|
||||
const queryInstance = query({
|
||||
prompt: ctx.instructions,
|
||||
prompt: ctx.instructions.full,
|
||||
options: queryOptions,
|
||||
});
|
||||
|
||||
|
||||
+1
-1
@@ -129,7 +129,7 @@ export const codex = agent({
|
||||
const thread = codex.startThread(threadOptions);
|
||||
|
||||
try {
|
||||
const streamedTurn = await thread.runStreamed(ctx.instructions);
|
||||
const streamedTurn = await thread.runStreamed(ctx.instructions.full);
|
||||
|
||||
let finalOutput = "";
|
||||
for await (const event of streamedTurn.events) {
|
||||
|
||||
+1
-1
@@ -205,7 +205,7 @@ export const cursor = agent({
|
||||
// build CLI args
|
||||
const baseArgs = [
|
||||
"--print",
|
||||
ctx.instructions,
|
||||
ctx.instructions.full,
|
||||
"--output-format",
|
||||
"stream-json",
|
||||
"--approve-mcps",
|
||||
|
||||
+1
-1
@@ -188,7 +188,7 @@ export const gemini = agent({
|
||||
"--yolo",
|
||||
"--output-format=stream-json",
|
||||
"-p",
|
||||
ctx.instructions,
|
||||
ctx.instructions.full,
|
||||
];
|
||||
|
||||
let finalOutput = "";
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ export const opencode = agent({
|
||||
configureOpenCode(ctx);
|
||||
|
||||
// message positional must come right after "run", before flags
|
||||
const args = ["run", ctx.instructions, "--format", "json"];
|
||||
const args = ["run", ctx.instructions.full, "--format", "json"];
|
||||
|
||||
process.env.HOME = tempHome;
|
||||
|
||||
|
||||
+5
-2
@@ -1,6 +1,7 @@
|
||||
import type { show } from "@ark/util";
|
||||
import { type AgentManifest, type AgentName, agentsManifest } from "../external.ts";
|
||||
import { log } from "../utils/cli.ts";
|
||||
import type { ResolvedInstructions } from "../utils/instructions.ts";
|
||||
import type { ResolvedPayload } from "../utils/payload.ts";
|
||||
|
||||
/**
|
||||
@@ -20,7 +21,7 @@ export interface AgentRunContext {
|
||||
payload: ResolvedPayload;
|
||||
mcpServerUrl: string;
|
||||
tmpdir: string;
|
||||
instructions: string;
|
||||
instructions: ResolvedInstructions;
|
||||
}
|
||||
|
||||
export const agent = <const input extends AgentInput>(input: input): defineAgent<input> => {
|
||||
@@ -32,7 +33,9 @@ export const agent = <const input extends AgentInput>(input: input): defineAgent
|
||||
const search = ctx.payload.search;
|
||||
const write = ctx.payload.write;
|
||||
log.info(`» running ${input.name} with effort=${ctx.payload.effort}...`);
|
||||
log.box(ctx.instructions, { title: "Instructions" });
|
||||
log.box(ctx.instructions.user.trim() + "\n\n" + ctx.instructions.event.trim(), {
|
||||
title: "Instructions",
|
||||
});
|
||||
log.info(`» tool permissions: web=${web}, search=${search}, write=${write}, bash=${bash}`);
|
||||
return input.run(ctx);
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user