@rallycry/conveyor-agent 5.3.0 → 5.4.0
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.
|
@@ -908,8 +908,35 @@ async function processEvents(events, context, host) {
|
|
|
908
908
|
switch (event.type) {
|
|
909
909
|
case "system": {
|
|
910
910
|
const systemEvent = event;
|
|
911
|
-
|
|
912
|
-
|
|
911
|
+
if (systemEvent.subtype === "init") {
|
|
912
|
+
const stored = await handleSystemEvent(systemEvent, host, context, sessionIdStored);
|
|
913
|
+
if (stored) sessionIdStored = true;
|
|
914
|
+
} else if (systemEvent.subtype === "compact_boundary") {
|
|
915
|
+
const meta = systemEvent.compact_metadata;
|
|
916
|
+
if (meta) {
|
|
917
|
+
void host.callbacks.onEvent({
|
|
918
|
+
type: "context_compacted",
|
|
919
|
+
trigger: meta.trigger,
|
|
920
|
+
preTokens: meta.pre_tokens
|
|
921
|
+
});
|
|
922
|
+
}
|
|
923
|
+
} else if (systemEvent.subtype === "task_started") {
|
|
924
|
+
const msg = systemEvent;
|
|
925
|
+
void host.callbacks.onEvent({
|
|
926
|
+
type: "subagent_started",
|
|
927
|
+
sdkTaskId: msg.task_id ?? "",
|
|
928
|
+
description: msg.description ?? ""
|
|
929
|
+
});
|
|
930
|
+
} else if (systemEvent.subtype === "task_progress") {
|
|
931
|
+
const msg = systemEvent;
|
|
932
|
+
void host.callbacks.onEvent({
|
|
933
|
+
type: "subagent_progress",
|
|
934
|
+
sdkTaskId: msg.task_id ?? "",
|
|
935
|
+
description: msg.description ?? "",
|
|
936
|
+
toolUses: msg.usage?.tool_uses ?? 0,
|
|
937
|
+
durationMs: msg.usage?.duration_ms ?? 0
|
|
938
|
+
});
|
|
939
|
+
}
|
|
913
940
|
break;
|
|
914
941
|
}
|
|
915
942
|
case "assistant": {
|
|
@@ -949,6 +976,15 @@ async function processEvents(events, context, host) {
|
|
|
949
976
|
if (resetsAt) rateLimitResetsAt = resetsAt;
|
|
950
977
|
break;
|
|
951
978
|
}
|
|
979
|
+
case "tool_progress": {
|
|
980
|
+
const msg = event;
|
|
981
|
+
void host.callbacks.onEvent({
|
|
982
|
+
type: "tool_progress",
|
|
983
|
+
toolName: msg.tool_name ?? "",
|
|
984
|
+
elapsedSeconds: msg.elapsed_time_seconds ?? 0
|
|
985
|
+
});
|
|
986
|
+
break;
|
|
987
|
+
}
|
|
952
988
|
}
|
|
953
989
|
}
|
|
954
990
|
if (isTyping) {
|
|
@@ -2882,7 +2918,6 @@ function pushSetupLog(setupLog, line) {
|
|
|
2882
2918
|
}
|
|
2883
2919
|
}
|
|
2884
2920
|
async function executeSetupConfig(config, runnerConfig, connection, setupLog) {
|
|
2885
|
-
let deferredStartConfig = null;
|
|
2886
2921
|
if (config.setupCommand) {
|
|
2887
2922
|
pushSetupLog(setupLog, `$ ${config.setupCommand}`);
|
|
2888
2923
|
await runSetupCommand(config.setupCommand, runnerConfig.workspaceDir, (stream, data) => {
|
|
@@ -2899,7 +2934,6 @@ async function executeSetupConfig(config, runnerConfig, connection, setupLog) {
|
|
|
2899
2934
|
connection.sendEvent({ type: "start_command_output", stream, data });
|
|
2900
2935
|
});
|
|
2901
2936
|
}
|
|
2902
|
-
return deferredStartConfig;
|
|
2903
2937
|
}
|
|
2904
2938
|
async function checkoutTaskBranch(runnerConfig, connection, callbacks, setupLog) {
|
|
2905
2939
|
const taskBranch = process.env.CONVEYOR_TASK_BRANCH;
|
|
@@ -2946,29 +2980,23 @@ async function runSetupSafe(runnerConfig, connection, callbacks, setupLog, _effe
|
|
|
2946
2980
|
);
|
|
2947
2981
|
}
|
|
2948
2982
|
if (!await checkoutTaskBranch(runnerConfig, connection, callbacks, setupLog)) {
|
|
2949
|
-
return { ok: false,
|
|
2983
|
+
return { ok: false, conveyorConfig: null };
|
|
2950
2984
|
}
|
|
2951
2985
|
const config = await loadConveyorConfig(runnerConfig.workspaceDir);
|
|
2952
2986
|
if (!config) {
|
|
2953
2987
|
connection.sendEvent({ type: "setup_complete" });
|
|
2954
2988
|
await callbacks.onEvent({ type: "setup_complete" });
|
|
2955
|
-
return { ok: true,
|
|
2989
|
+
return { ok: true, conveyorConfig: null };
|
|
2956
2990
|
}
|
|
2957
2991
|
try {
|
|
2958
|
-
|
|
2959
|
-
config,
|
|
2960
|
-
runnerConfig,
|
|
2961
|
-
connection,
|
|
2962
|
-
setupLog
|
|
2963
|
-
);
|
|
2992
|
+
await executeSetupConfig(config, runnerConfig, connection, setupLog);
|
|
2964
2993
|
const setupEvent = {
|
|
2965
2994
|
type: "setup_complete",
|
|
2966
|
-
previewPort: config.previewPort ?? void 0
|
|
2967
|
-
startCommandDeferred: deferredStartConfig === null ? void 0 : true
|
|
2995
|
+
previewPort: config.previewPort ?? void 0
|
|
2968
2996
|
};
|
|
2969
2997
|
connection.sendEvent(setupEvent);
|
|
2970
2998
|
await callbacks.onEvent(setupEvent);
|
|
2971
|
-
return { ok: true,
|
|
2999
|
+
return { ok: true, conveyorConfig: config };
|
|
2972
3000
|
} catch (error) {
|
|
2973
3001
|
const message = error instanceof Error ? error.message : "Setup failed";
|
|
2974
3002
|
connection.sendEvent({ type: "setup_error", message });
|
|
@@ -2977,7 +3005,7 @@ async function runSetupSafe(runnerConfig, connection, callbacks, setupLog, _effe
|
|
|
2977
3005
|
`Environment setup failed: ${message}
|
|
2978
3006
|
The agent cannot start until this is resolved.`
|
|
2979
3007
|
);
|
|
2980
|
-
return { ok: false,
|
|
3008
|
+
return { ok: false, conveyorConfig: null };
|
|
2981
3009
|
}
|
|
2982
3010
|
}
|
|
2983
3011
|
function runAuthTokenSafe(config, connection, taskContext) {
|
|
@@ -2991,16 +3019,16 @@ function runAuthTokenSafe(config, connection, taskContext) {
|
|
|
2991
3019
|
} catch {
|
|
2992
3020
|
}
|
|
2993
3021
|
}
|
|
2994
|
-
function
|
|
2995
|
-
if (!
|
|
2996
|
-
pushSetupLog(setupLog, `$ ${
|
|
3022
|
+
function rerunStartCommand(conveyorConfig, runnerConfig, connection, setupLog) {
|
|
3023
|
+
if (!conveyorConfig.startCommand) return;
|
|
3024
|
+
pushSetupLog(setupLog, `$ ${conveyorConfig.startCommand} & (background, re-trigger)`);
|
|
2997
3025
|
connection.sendEvent({ type: "start_command_started" });
|
|
2998
|
-
runStartCommand(
|
|
3026
|
+
runStartCommand(conveyorConfig.startCommand, runnerConfig.workspaceDir, (stream, data) => {
|
|
2999
3027
|
connection.sendEvent({ type: "start_command_output", stream, data });
|
|
3000
3028
|
});
|
|
3001
3029
|
const setupEvent = {
|
|
3002
3030
|
type: "setup_complete",
|
|
3003
|
-
previewPort:
|
|
3031
|
+
previewPort: conveyorConfig.previewPort ?? void 0
|
|
3004
3032
|
};
|
|
3005
3033
|
connection.sendEvent(setupEvent);
|
|
3006
3034
|
}
|
|
@@ -3143,7 +3171,7 @@ var AgentRunner = class {
|
|
|
3143
3171
|
prNudgeCount = 0;
|
|
3144
3172
|
idleTimer = null;
|
|
3145
3173
|
idleCheckInterval = null;
|
|
3146
|
-
|
|
3174
|
+
conveyorConfig = null;
|
|
3147
3175
|
_queryHost = null;
|
|
3148
3176
|
constructor(config, callbacks) {
|
|
3149
3177
|
this.config = config;
|
|
@@ -3215,7 +3243,7 @@ var AgentRunner = class {
|
|
|
3215
3243
|
this.connection.disconnect();
|
|
3216
3244
|
return;
|
|
3217
3245
|
}
|
|
3218
|
-
this.
|
|
3246
|
+
this.conveyorConfig = result.conveyorConfig;
|
|
3219
3247
|
}
|
|
3220
3248
|
this.tryInitWorktree();
|
|
3221
3249
|
if (!await this.fetchAndInitContext()) return;
|
|
@@ -3399,15 +3427,9 @@ var AgentRunner = class {
|
|
|
3399
3427
|
}
|
|
3400
3428
|
}
|
|
3401
3429
|
handleRunStartCommand() {
|
|
3402
|
-
if (!this.
|
|
3430
|
+
if (!this.conveyorConfig?.startCommand || this.startCommandStarted) return;
|
|
3403
3431
|
this.startCommandStarted = true;
|
|
3404
|
-
|
|
3405
|
-
this.deferredStartConfig,
|
|
3406
|
-
this.config,
|
|
3407
|
-
this.connection,
|
|
3408
|
-
this.setupLog
|
|
3409
|
-
);
|
|
3410
|
-
this.deferredStartConfig = null;
|
|
3432
|
+
rerunStartCommand(this.conveyorConfig, this.config, this.connection, this.setupLog);
|
|
3411
3433
|
}
|
|
3412
3434
|
logEffectiveSettings() {
|
|
3413
3435
|
if (!this.taskContext) return;
|
|
@@ -3440,6 +3462,9 @@ var AgentRunner = class {
|
|
|
3440
3462
|
resolve2(msg);
|
|
3441
3463
|
} else {
|
|
3442
3464
|
this.pendingMessages.push(msg);
|
|
3465
|
+
if (this._queryHost?.activeQuery) {
|
|
3466
|
+
this.softStop();
|
|
3467
|
+
}
|
|
3443
3468
|
}
|
|
3444
3469
|
}
|
|
3445
3470
|
waitForMessage() {
|
|
@@ -4049,4 +4074,4 @@ export {
|
|
|
4049
4074
|
ProjectRunner,
|
|
4050
4075
|
FileCache
|
|
4051
4076
|
};
|
|
4052
|
-
//# sourceMappingURL=chunk-
|
|
4077
|
+
//# sourceMappingURL=chunk-DJJBHD4H.js.map
|