add macros (#68)
This commit is contained in:
committed by
pullfrog[bot]
parent
3539ddf943
commit
1daf1571cf
+83
-69
@@ -83424,7 +83424,7 @@ var schema = ark.schema;
|
||||
var define2 = ark.define;
|
||||
var declare = ark.declare;
|
||||
|
||||
// node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.1.77_zod@4.3.5/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
||||
// node_modules/.pnpm/@anthropic-ai+claude-agent-sdk@0.2.7_zod@4.3.5/node_modules/@anthropic-ai/claude-agent-sdk/sdk.mjs
|
||||
import { join as join5 } from "path";
|
||||
import { fileURLToPath as fileURLToPath2 } from "url";
|
||||
import { setMaxListeners } from "events";
|
||||
@@ -90212,6 +90212,7 @@ function getInitialState() {
|
||||
}
|
||||
return {
|
||||
originalCwd: resolvedCwd,
|
||||
projectRoot: resolvedCwd,
|
||||
totalCostUSD: 0,
|
||||
totalAPIDuration: 0,
|
||||
totalAPIDurationWithoutRetries: 0,
|
||||
@@ -90260,6 +90261,7 @@ function getInitialState() {
|
||||
inMemoryErrorLog: [],
|
||||
inlinePlugins: [],
|
||||
sessionBypassPermissionsMode: false,
|
||||
sessionTrustAccepted: false,
|
||||
sessionPersistenceDisabled: false,
|
||||
hasExitedPlanMode: false,
|
||||
needsPlanModeExitAttachment: false,
|
||||
@@ -90272,25 +90274,14 @@ function getInitialState() {
|
||||
teleportedSessionInfo: null,
|
||||
invokedSkills: /* @__PURE__ */ new Map(),
|
||||
slowOperations: [],
|
||||
sdkBetas: void 0
|
||||
sdkBetas: void 0,
|
||||
mainThreadAgentType: void 0
|
||||
};
|
||||
}
|
||||
var STATE = getInitialState();
|
||||
function getSessionId() {
|
||||
return STATE.sessionId;
|
||||
}
|
||||
var MAX_SLOW_OPERATIONS = 10;
|
||||
var SLOW_OPERATION_TTL_MS = 1e4;
|
||||
function addSlowOperation(operation, durationMs) {
|
||||
if (true)
|
||||
return;
|
||||
const now = Date.now();
|
||||
STATE.slowOperations = STATE.slowOperations.filter((op) => now - op.timestamp < SLOW_OPERATION_TTL_MS);
|
||||
STATE.slowOperations.push({ operation, durationMs, timestamp: now });
|
||||
if (STATE.slowOperations.length > MAX_SLOW_OPERATIONS) {
|
||||
STATE.slowOperations = STATE.slowOperations.slice(-MAX_SLOW_OPERATIONS);
|
||||
}
|
||||
}
|
||||
function createBufferedWriter({
|
||||
writeFn,
|
||||
flushIntervalMs = 1e3,
|
||||
@@ -90362,9 +90353,7 @@ function withSlowLogging(operation, fn2) {
|
||||
return fn2();
|
||||
} finally {
|
||||
const duration6 = performance.now() - startTime;
|
||||
if (duration6 > SLOW_OPERATION_THRESHOLD_MS) {
|
||||
logForDebugging(`[SLOW OPERATION DETECTED] ${operation} (${duration6.toFixed(1)}ms)`);
|
||||
addSlowOperation(operation, duration6);
|
||||
if (duration6 > SLOW_OPERATION_THRESHOLD_MS && false) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -90420,7 +90409,7 @@ function getDebugWriter() {
|
||||
}
|
||||
return debugWriter;
|
||||
}
|
||||
function logForDebugging(message, { level } = {
|
||||
function logForDebugging2(message, { level } = {
|
||||
level: "debug"
|
||||
}) {
|
||||
if (!shouldLogDebugMessage(message)) {
|
||||
@@ -90463,15 +90452,14 @@ var updateLatestDebugLogSymlink = memoize_default(() => {
|
||||
} catch {
|
||||
}
|
||||
});
|
||||
var isLoggingSlowOperation = false;
|
||||
function withSlowLogging2(operation, fn2) {
|
||||
const startTime = performance.now();
|
||||
try {
|
||||
return fn2();
|
||||
} finally {
|
||||
const duration6 = performance.now() - startTime;
|
||||
if (duration6 > SLOW_OPERATION_THRESHOLD_MS) {
|
||||
logForDebugging(`[SLOW OPERATION DETECTED] fs.${operation} (${duration6.toFixed(1)}ms)`);
|
||||
addSlowOperation(`fs.${operation}`, duration6);
|
||||
if (duration6 > SLOW_OPERATION_THRESHOLD_MS && !isLoggingSlowOperation && false) {
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -91254,7 +91242,7 @@ var Query = class {
|
||||
this.firstResultReceivedResolve();
|
||||
}
|
||||
if (this.isSingleUserTurn) {
|
||||
logForDebugging(`[Query.readMessages] First result received for single-turn query, closing stdin`);
|
||||
logForDebugging2(`[Query.readMessages] First result received for single-turn query, closing stdin`);
|
||||
this.transport.endInput();
|
||||
}
|
||||
}
|
||||
@@ -91498,23 +91486,23 @@ var Query = class {
|
||||
return (await this.initialization).account;
|
||||
}
|
||||
async streamInput(stream) {
|
||||
logForDebugging(`[Query.streamInput] Starting to process input stream`);
|
||||
logForDebugging2(`[Query.streamInput] Starting to process input stream`);
|
||||
try {
|
||||
let messageCount = 0;
|
||||
for await (const message of stream) {
|
||||
messageCount++;
|
||||
logForDebugging(`[Query.streamInput] Processing message ${messageCount}: ${message.type}`);
|
||||
logForDebugging2(`[Query.streamInput] Processing message ${messageCount}: ${message.type}`);
|
||||
if (this.abortController?.signal.aborted)
|
||||
break;
|
||||
await Promise.resolve(this.transport.write(jsonStringify(message) + `
|
||||
`));
|
||||
}
|
||||
logForDebugging(`[Query.streamInput] Finished processing ${messageCount} messages from input stream`);
|
||||
logForDebugging2(`[Query.streamInput] Finished processing ${messageCount} messages from input stream`);
|
||||
if (messageCount > 0 && this.hasBidirectionalNeeds()) {
|
||||
logForDebugging(`[Query.streamInput] Has bidirectional needs, waiting for first result`);
|
||||
logForDebugging2(`[Query.streamInput] Has bidirectional needs, waiting for first result`);
|
||||
await this.waitForFirstResult();
|
||||
}
|
||||
logForDebugging(`[Query] Calling transport.endInput() to close stdin to CLI process`);
|
||||
logForDebugging2(`[Query] Calling transport.endInput() to close stdin to CLI process`);
|
||||
this.transport.endInput();
|
||||
} catch (error50) {
|
||||
if (!(error50 instanceof AbortError)) {
|
||||
@@ -91524,7 +91512,7 @@ var Query = class {
|
||||
}
|
||||
waitForFirstResult() {
|
||||
if (this.firstResultReceived) {
|
||||
logForDebugging(`[Query.waitForFirstResult] Result already received, returning immediately`);
|
||||
logForDebugging2(`[Query.waitForFirstResult] Result already received, returning immediately`);
|
||||
return Promise.resolve();
|
||||
}
|
||||
return new Promise((resolve2) => {
|
||||
@@ -99836,7 +99824,7 @@ function query({
|
||||
const dirname2 = join5(filename, "..");
|
||||
pathToClaudeCodeExecutable = join5(dirname2, "cli.js");
|
||||
}
|
||||
process.env.CLAUDE_AGENT_SDK_VERSION = "0.1.77";
|
||||
process.env.CLAUDE_AGENT_SDK_VERSION = "0.2.7";
|
||||
const {
|
||||
abortController = createAbortController(),
|
||||
additionalDirectories = [],
|
||||
@@ -99992,13 +99980,13 @@ var package_default = {
|
||||
dependencies: {
|
||||
"@actions/core": "^1.11.1",
|
||||
"@actions/github": "^6.0.1",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.1.77",
|
||||
"@anthropic-ai/claude-agent-sdk": "0.2.7",
|
||||
"@ark/fs": "0.53.0",
|
||||
"@ark/util": "0.53.0",
|
||||
"@octokit/plugin-throttling": "^11.0.3",
|
||||
"@octokit/rest": "^22.0.0",
|
||||
"@octokit/webhooks-types": "^7.6.1",
|
||||
"@openai/codex-sdk": "0.58.0",
|
||||
"@openai/codex-sdk": "0.80.0",
|
||||
"@opencode-ai/sdk": "^1.0.143",
|
||||
"@standard-schema/spec": "1.0.0",
|
||||
"@toon-format/toon": "^1.0.0",
|
||||
@@ -100342,7 +100330,7 @@ var agentsManifest = {
|
||||
}
|
||||
};
|
||||
var AgentName = type.enumerated(...Object.keys(agentsManifest));
|
||||
var Effort = type.enumerated("nothink", "think", "max");
|
||||
var Effort = type.enumerated("mini", "auto", "max");
|
||||
|
||||
// modes.ts
|
||||
var ModeSchema = type({
|
||||
@@ -104740,8 +104728,8 @@ var agent = (input) => {
|
||||
|
||||
// agents/claude.ts
|
||||
var claudeEffortModels = {
|
||||
nothink: "haiku",
|
||||
think: "opusplan",
|
||||
mini: "haiku",
|
||||
auto: "opusplan",
|
||||
max: "opus"
|
||||
};
|
||||
var claude = agent({
|
||||
@@ -104887,7 +104875,7 @@ var messageHandlers = {
|
||||
import { mkdirSync as mkdirSync3, writeFileSync } from "node:fs";
|
||||
import { join as join6 } from "node:path";
|
||||
|
||||
// node_modules/.pnpm/@openai+codex-sdk@0.58.0/node_modules/@openai/codex-sdk/dist/index.js
|
||||
// node_modules/.pnpm/@openai+codex-sdk@0.80.0/node_modules/@openai/codex-sdk/dist/index.js
|
||||
import { promises as fs2 } from "fs";
|
||||
import os from "os";
|
||||
import path from "path";
|
||||
@@ -104958,9 +104946,11 @@ var Thread = class {
|
||||
skipGitRepoCheck: options?.skipGitRepoCheck,
|
||||
outputSchemaFile: schemaPath,
|
||||
modelReasoningEffort: options?.modelReasoningEffort,
|
||||
signal: turnOptions.signal,
|
||||
networkAccessEnabled: options?.networkAccessEnabled,
|
||||
webSearchEnabled: options?.webSearchEnabled,
|
||||
approvalPolicy: options?.approvalPolicy
|
||||
approvalPolicy: options?.approvalPolicy,
|
||||
additionalDirectories: options?.additionalDirectories
|
||||
});
|
||||
try {
|
||||
for await (const item of generator) {
|
||||
@@ -105024,8 +105014,10 @@ var INTERNAL_ORIGINATOR_ENV = "CODEX_INTERNAL_ORIGINATOR_OVERRIDE";
|
||||
var TYPESCRIPT_SDK_ORIGINATOR = "codex_sdk_ts";
|
||||
var CodexExec = class {
|
||||
executablePath;
|
||||
constructor(executablePath = null) {
|
||||
envOverride;
|
||||
constructor(executablePath = null, env3) {
|
||||
this.executablePath = executablePath || findCodexPath();
|
||||
this.envOverride = env3;
|
||||
}
|
||||
async *run(args3) {
|
||||
const commandArgs = ["exec", "--experimental-json"];
|
||||
@@ -105038,6 +105030,11 @@ var CodexExec = class {
|
||||
if (args3.workingDirectory) {
|
||||
commandArgs.push("--cd", args3.workingDirectory);
|
||||
}
|
||||
if (args3.additionalDirectories?.length) {
|
||||
for (const dir of args3.additionalDirectories) {
|
||||
commandArgs.push("--add-dir", dir);
|
||||
}
|
||||
}
|
||||
if (args3.skipGitRepoCheck) {
|
||||
commandArgs.push("--skip-git-repo-check");
|
||||
}
|
||||
@@ -105048,7 +105045,10 @@ var CodexExec = class {
|
||||
commandArgs.push("--config", `model_reasoning_effort="${args3.modelReasoningEffort}"`);
|
||||
}
|
||||
if (args3.networkAccessEnabled !== void 0) {
|
||||
commandArgs.push("--config", `sandbox_workspace_write.network_access=${args3.networkAccessEnabled}`);
|
||||
commandArgs.push(
|
||||
"--config",
|
||||
`sandbox_workspace_write.network_access=${args3.networkAccessEnabled}`
|
||||
);
|
||||
}
|
||||
if (args3.webSearchEnabled !== void 0) {
|
||||
commandArgs.push("--config", `features.web_search_request=${args3.webSearchEnabled}`);
|
||||
@@ -105064,9 +105064,16 @@ var CodexExec = class {
|
||||
if (args3.threadId) {
|
||||
commandArgs.push("resume", args3.threadId);
|
||||
}
|
||||
const env3 = {
|
||||
...process.env
|
||||
};
|
||||
const env3 = {};
|
||||
if (this.envOverride) {
|
||||
Object.assign(env3, this.envOverride);
|
||||
} else {
|
||||
for (const [key, value2] of Object.entries(process.env)) {
|
||||
if (value2 !== void 0) {
|
||||
env3[key] = value2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!env3[INTERNAL_ORIGINATOR_ENV]) {
|
||||
env3[INTERNAL_ORIGINATOR_ENV] = TYPESCRIPT_SDK_ORIGINATOR;
|
||||
}
|
||||
@@ -105077,7 +105084,8 @@ var CodexExec = class {
|
||||
env3.CODEX_API_KEY = args3.apiKey;
|
||||
}
|
||||
const child = spawn2(this.executablePath, commandArgs, {
|
||||
env: env3
|
||||
env: env3,
|
||||
signal: args3.signal
|
||||
});
|
||||
let spawnError = null;
|
||||
child.once("error", (err) => spawnError = err);
|
||||
@@ -105097,6 +105105,13 @@ var CodexExec = class {
|
||||
stderrChunks.push(data);
|
||||
});
|
||||
}
|
||||
const exitPromise = new Promise(
|
||||
(resolve2) => {
|
||||
child.once("exit", (code, signal) => {
|
||||
resolve2({ code, signal });
|
||||
});
|
||||
}
|
||||
);
|
||||
const rl = readline.createInterface({
|
||||
input: child.stdout,
|
||||
crlfDelay: Infinity
|
||||
@@ -105105,20 +105120,13 @@ var CodexExec = class {
|
||||
for await (const line of rl) {
|
||||
yield line;
|
||||
}
|
||||
const exitCode = new Promise((resolve2, reject) => {
|
||||
child.once("exit", (code) => {
|
||||
if (code === 0) {
|
||||
resolve2(code);
|
||||
} else {
|
||||
const stderrBuffer = Buffer.concat(stderrChunks);
|
||||
reject(
|
||||
new Error(`Codex Exec exited with code ${code}: ${stderrBuffer.toString("utf8")}`)
|
||||
);
|
||||
}
|
||||
});
|
||||
});
|
||||
if (spawnError) throw spawnError;
|
||||
await exitCode;
|
||||
const { code, signal } = await exitPromise;
|
||||
if (code !== 0 || signal) {
|
||||
const stderrBuffer = Buffer.concat(stderrChunks);
|
||||
const detail = signal ? `signal ${signal}` : `code ${code ?? 1}`;
|
||||
throw new Error(`Codex Exec exited with ${detail}: ${stderrBuffer.toString("utf8")}`);
|
||||
}
|
||||
} finally {
|
||||
rl.close();
|
||||
child.removeAllListeners();
|
||||
@@ -105188,7 +105196,7 @@ var Codex = class {
|
||||
exec;
|
||||
options;
|
||||
constructor(options = {}) {
|
||||
this.exec = new CodexExec(options.codexPathOverride);
|
||||
this.exec = new CodexExec(options.codexPathOverride, options.env);
|
||||
this.options = options;
|
||||
}
|
||||
/**
|
||||
@@ -105212,13 +105220,15 @@ var Codex = class {
|
||||
|
||||
// agents/codex.ts
|
||||
var codexModel = {
|
||||
nothink: "gpt-5.1-codex-mini",
|
||||
think: "gpt-5.1-codex",
|
||||
mini: "gpt-5.1-codex-mini",
|
||||
// https://developers.openai.com/codex/models/
|
||||
// gpt-5.2-codex is not yet available via api key (even through codex cli)
|
||||
auto: "gpt-5.1-codex",
|
||||
max: "gpt-5.1-codex-max"
|
||||
};
|
||||
var codexReasoningEffort = {
|
||||
nothink: "low",
|
||||
think: void 0,
|
||||
mini: "low",
|
||||
auto: void 0,
|
||||
// use default
|
||||
max: "high"
|
||||
};
|
||||
@@ -105416,9 +105426,9 @@ import { existsSync as existsSync4, mkdirSync as mkdirSync4, readFileSync as rea
|
||||
import { homedir as homedir2 } from "node:os";
|
||||
import { join as join7 } from "node:path";
|
||||
var cursorEffortModels = {
|
||||
nothink: null,
|
||||
mini: null,
|
||||
// use default (auto)
|
||||
think: null,
|
||||
auto: null,
|
||||
// use default (auto)
|
||||
max: "opus-4.5-thinking"
|
||||
};
|
||||
@@ -105727,9 +105737,13 @@ async function spawn4(options) {
|
||||
|
||||
// agents/gemini.ts
|
||||
var geminiEffortConfig = {
|
||||
nothink: { model: "gemini-2.5-flash", thinkingLevel: "LOW" },
|
||||
think: { model: "gemini-2.5-flash", thinkingLevel: "HIGH" },
|
||||
max: { model: "gemini-2.5-pro", thinkingLevel: "HIGH" }
|
||||
// https://ai.google.dev/gemini-api/docs/models
|
||||
// the docs mention needing to enable preview features for these models but if you
|
||||
// pass the model directly it works if we ever did need to do something like this,
|
||||
// we could write to .gemini/settings.json
|
||||
mini: { model: "gemini-3-flash-preview", thinkingLevel: "LOW" },
|
||||
auto: { model: "gemini-3-flash-preview", thinkingLevel: "HIGH" },
|
||||
max: { model: "gemini-3-pro-preview", thinkingLevel: "HIGH" }
|
||||
};
|
||||
var assistantMessageBuffer = "";
|
||||
var messageHandlers3 = {
|
||||
@@ -138688,7 +138702,7 @@ function parsePayload(inputs) {
|
||||
prompt: inputs.prompt,
|
||||
event: inputs.event,
|
||||
modes: inputs.modes ?? modes,
|
||||
effort: inputs.effort ?? "think",
|
||||
effort: inputs.effort ?? "auto",
|
||||
sandbox: inputs.sandbox,
|
||||
disableProgressComment: inputs.disableProgressComment,
|
||||
comment_id: inputs.comment_id,
|
||||
@@ -138703,7 +138717,7 @@ function parsePayload(inputs) {
|
||||
}
|
||||
return {
|
||||
...parsedPrompt,
|
||||
effort: parsedPrompt.effort ?? inputs.effort ?? "think"
|
||||
effort: parsedPrompt.effort ?? inputs.effort ?? "auto"
|
||||
};
|
||||
} catch {
|
||||
return {
|
||||
@@ -138714,7 +138728,7 @@ function parsePayload(inputs) {
|
||||
trigger: "unknown"
|
||||
},
|
||||
modes: inputs.modes ?? modes,
|
||||
effort: inputs.effort ?? "think",
|
||||
effort: inputs.effort ?? "auto",
|
||||
sandbox: inputs.sandbox
|
||||
};
|
||||
}
|
||||
@@ -138761,7 +138775,7 @@ function validateApiKey(params) {
|
||||
};
|
||||
}
|
||||
async function runAgent(ctx) {
|
||||
const effort = ctx.payload.effort ?? "think";
|
||||
const effort = ctx.payload.effort ?? "auto";
|
||||
log.info(`Running ${ctx.agent.name} with effort=${effort}...`);
|
||||
const { context: _context, ...eventWithoutContext } = ctx.payload.event;
|
||||
const promptContent = `${ctx.payload.prompt}
|
||||
|
||||
Reference in New Issue
Block a user