addInstructions
This commit is contained in:
+2
-3
@@ -3,12 +3,11 @@ import { createWriteStream, existsSync, rmSync } from "node:fs";
|
||||
import { mkdtemp } from "node:fs/promises";
|
||||
import { tmpdir } from "node:os";
|
||||
import { join } from "node:path";
|
||||
|
||||
import { pipeline } from "node:stream/promises";
|
||||
import { query, type SDKMessage } from "@anthropic-ai/claude-agent-sdk";
|
||||
import packageJson from "../package.json" with { type: "json" };
|
||||
import { log } from "../utils/cli.ts";
|
||||
import { agent, instructions } from "./shared.ts";
|
||||
import { addInstructions, agent } from "./shared.ts";
|
||||
|
||||
export const claude = agent({
|
||||
name: "claude",
|
||||
@@ -94,7 +93,7 @@ export const claude = agent({
|
||||
process.env.ANTHROPIC_API_KEY = apiKey;
|
||||
|
||||
const queryInstance = query({
|
||||
prompt: `${instructions}\n\n****** USER PROMPT ******\n${prompt}`,
|
||||
prompt: addInstructions(prompt),
|
||||
options: {
|
||||
permissionMode: "bypassPermissions",
|
||||
mcpServers,
|
||||
|
||||
+2
-6
@@ -1,7 +1,7 @@
|
||||
import { spawnSync } from "node:child_process";
|
||||
|
||||
import { findCliPath, log } from "../utils/cli.ts";
|
||||
import { agent, instructions } from "./shared.ts";
|
||||
import { addInstructions, agent } from "./shared.ts";
|
||||
|
||||
export const codex = agent({
|
||||
name: "codex",
|
||||
@@ -92,14 +92,10 @@ export const codex = agent({
|
||||
}
|
||||
}
|
||||
|
||||
// Use codex exec command via CLI
|
||||
const fullPrompt = `${instructions}\n\n****** USER PROMPT ******\n${prompt}`;
|
||||
|
||||
log.info("Running Codex via CLI...");
|
||||
|
||||
try {
|
||||
// Execute codex via CLI using child_process
|
||||
const result = spawnSync("codex", ["exec", fullPrompt], {
|
||||
const result = spawnSync(cliPath, ["exec", addInstructions(prompt)], {
|
||||
encoding: "utf-8",
|
||||
env: {
|
||||
...process.env,
|
||||
|
||||
@@ -75,3 +75,6 @@ ${workflows.map((w) => ` - "${w.name}": ${w.description}`).join("\n")}
|
||||
|
||||
${workflows.map((w) => `### ${w.name}\n\n${w.prompt}`).join("\n\n")}
|
||||
`;
|
||||
|
||||
export const addInstructions = (prompt: string) =>
|
||||
`****** GENERAL INSTRUCTIONS ******\n${instructions}\n\n****** USER PROMPT ******\n${prompt}`;
|
||||
|
||||
@@ -41218,6 +41218,11 @@ ${workflows.map((w) => `### ${w.name}
|
||||
|
||||
${w.prompt}`).join("\n\n")}
|
||||
`;
|
||||
var addInstructions = (prompt) => `****** GENERAL INSTRUCTIONS ******
|
||||
${instructions}
|
||||
|
||||
****** USER PROMPT ******
|
||||
${prompt}`;
|
||||
|
||||
// agents/claude.ts
|
||||
var claude = agent({
|
||||
@@ -41281,10 +41286,7 @@ var claude = agent({
|
||||
run: async ({ prompt, mcpServers, apiKey, cliPath }) => {
|
||||
process.env.ANTHROPIC_API_KEY = apiKey;
|
||||
const queryInstance = query({
|
||||
prompt: `${instructions}
|
||||
|
||||
****** USER PROMPT ******
|
||||
${prompt}`,
|
||||
prompt: addInstructions(prompt),
|
||||
options: {
|
||||
permissionMode: "bypassPermissions",
|
||||
mcpServers,
|
||||
@@ -41465,13 +41467,9 @@ var codex = agent({
|
||||
}
|
||||
}
|
||||
}
|
||||
const fullPrompt = `${instructions}
|
||||
|
||||
****** USER PROMPT ******
|
||||
${prompt}`;
|
||||
log.info("Running Codex via CLI...");
|
||||
try {
|
||||
const result = spawnSync2("codex", ["exec", fullPrompt], {
|
||||
const result = spawnSync2(cliPath, ["exec", addInstructions(prompt)], {
|
||||
encoding: "utf-8",
|
||||
env: {
|
||||
...process.env,
|
||||
|
||||
Reference in New Issue
Block a user