@dougbots/avenor-core 0.8.0 → 0.8.1
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/dist/index.d.ts +2 -0
- package/dist/index.js +13 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ interface SpawnParams {
|
|
|
38
38
|
session_id?: string;
|
|
39
39
|
sentinel_file?: string;
|
|
40
40
|
on_event?: string;
|
|
41
|
+
auto_approve?: boolean;
|
|
41
42
|
[key: string]: unknown;
|
|
42
43
|
}
|
|
43
44
|
declare class Client {
|
|
@@ -243,6 +244,7 @@ interface RunInfo {
|
|
|
243
244
|
dir?: string;
|
|
244
245
|
brokerUrl?: string;
|
|
245
246
|
parentToken?: string;
|
|
247
|
+
autoApprove?: boolean;
|
|
246
248
|
}
|
|
247
249
|
interface SupervisorOptions {
|
|
248
250
|
binaryPath?: string;
|
package/dist/index.js
CHANGED
|
@@ -1278,7 +1278,8 @@ var Supervisor = class Supervisor {
|
|
|
1278
1278
|
model: spawnParams.model,
|
|
1279
1279
|
dir: spawnParams.dir,
|
|
1280
1280
|
brokerUrl: result.broker_url,
|
|
1281
|
-
parentToken: result.parent_token
|
|
1281
|
+
parentToken: result.parent_token,
|
|
1282
|
+
autoApprove: spawnParams.auto_approve
|
|
1282
1283
|
};
|
|
1283
1284
|
this.runs.set(runInfo.label, runInfo);
|
|
1284
1285
|
this.runs.set(runId, runInfo);
|
|
@@ -2029,6 +2030,11 @@ function findRunByLabel(sup, runId) {
|
|
|
2029
2030
|
if (byKey) return byKey;
|
|
2030
2031
|
for (const info of runs.values()) if (info.label === runId) return info;
|
|
2031
2032
|
}
|
|
2033
|
+
function resolveAutoApprove(liveStatus, runInfo) {
|
|
2034
|
+
const liveAutoApprove = liveStatus?.auto_approve;
|
|
2035
|
+
if (typeof liveAutoApprove === "boolean") return liveAutoApprove;
|
|
2036
|
+
return typeof runInfo?.autoApprove === "boolean" ? runInfo.autoApprove : void 0;
|
|
2037
|
+
}
|
|
2032
2038
|
function requireResumableAgent(agent) {
|
|
2033
2039
|
if (agent === void 0) throw new Error("run has no agent to resume");
|
|
2034
2040
|
return agent;
|
|
@@ -2061,7 +2067,7 @@ async function followUpTool(args) {
|
|
|
2061
2067
|
const fallbackSessionId = runInfo?.sessionId;
|
|
2062
2068
|
let liveStatus = null;
|
|
2063
2069
|
try {
|
|
2064
|
-
liveStatus = await client.status(args.runId);
|
|
2070
|
+
liveStatus = await client.status(runInfo?.runtimeId ?? args.runId);
|
|
2065
2071
|
} catch {}
|
|
2066
2072
|
const sessionId = (await parseSentinel(liveStatus?.sentinel_file ?? path.join(runsRoot(), args.runId, "sentinel.done")))?.SESSION ?? liveStatus?.session_id ?? fallbackSessionId;
|
|
2067
2073
|
if (!sessionId) throw new Error("run has no session to resume");
|
|
@@ -2070,6 +2076,7 @@ async function followUpTool(args) {
|
|
|
2070
2076
|
const model = liveStatus?.model ?? runInfo?.model;
|
|
2071
2077
|
const dir = liveStatus?.dir ?? runInfo?.dir;
|
|
2072
2078
|
const agentProfile = liveStatus?.agent_profile ?? runInfo?.agentProfile;
|
|
2079
|
+
const autoApprove = resolveAutoApprove(liveStatus, runInfo);
|
|
2073
2080
|
const followUpRunId = crypto.randomUUID();
|
|
2074
2081
|
const followUpLabel = args.label ?? `${args.runId}-followup`;
|
|
2075
2082
|
const { sentinelPath: followUpSentinelPath, eventLogPath } = ensureRunPaths(followUpRunId);
|
|
@@ -2085,6 +2092,7 @@ async function followUpTool(args) {
|
|
|
2085
2092
|
if (model) spawnParams.model = model;
|
|
2086
2093
|
if (dir) spawnParams.dir = dir;
|
|
2087
2094
|
if (agentProfile) spawnParams.agent_profile = agentProfile;
|
|
2095
|
+
if (autoApprove === true) spawnParams.auto_approve = true;
|
|
2088
2096
|
return {
|
|
2089
2097
|
run_id: (await client.spawn(spawnParams)).runtime_id ?? followUpRunId,
|
|
2090
2098
|
label: followUpLabel
|
|
@@ -2108,6 +2116,7 @@ async function followUpTool(args) {
|
|
|
2108
2116
|
const model = liveStatus?.model ?? runInfo.model;
|
|
2109
2117
|
const dir = liveStatus?.dir ?? runInfo.dir;
|
|
2110
2118
|
const agentProfile = liveStatus?.agent_profile ?? runInfo.agentProfile;
|
|
2119
|
+
const autoApprove = resolveAutoApprove(liveStatus, runInfo);
|
|
2111
2120
|
const followUpLabel = args.label ?? `${runInfo.label}-followup`;
|
|
2112
2121
|
const followUpRun = await sup.spawn({
|
|
2113
2122
|
agent,
|
|
@@ -2117,7 +2126,8 @@ async function followUpTool(args) {
|
|
|
2117
2126
|
agent_profile: agentProfile,
|
|
2118
2127
|
prompt: args.message,
|
|
2119
2128
|
session_id: sessionId,
|
|
2120
|
-
label: followUpLabel
|
|
2129
|
+
label: followUpLabel,
|
|
2130
|
+
...autoApprove === true ? { auto_approve: true } : {}
|
|
2121
2131
|
});
|
|
2122
2132
|
return {
|
|
2123
2133
|
run_id: followUpRun.runId,
|