@gethmy/agent 1.14.2 → 1.14.3
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/cli.js +17 -3
- package/dist/index.js +17 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5851,6 +5851,11 @@ async function runTransition(client, card, plan, opts = {}) {
|
|
|
5851
5851
|
await withRetry("endSession", shortId, () => client.endAgentSession(card.id, plan.endSession), attempts, backoffMs);
|
|
5852
5852
|
log.info(TAG22, `#${shortId} session ended (${plan.endSession.status})`);
|
|
5853
5853
|
}
|
|
5854
|
+
if (plan.assignAgent !== undefined) {
|
|
5855
|
+
const assignedAgentId = plan.assignAgent;
|
|
5856
|
+
await withRetry("assignAgent", shortId, () => client.updateCard(card.id, { assignedAgentId }), attempts, backoffMs);
|
|
5857
|
+
log.info(TAG22, assignedAgentId ? `#${shortId} assigned → agent ${assignedAgentId}` : `#${shortId} unassigned`);
|
|
5858
|
+
}
|
|
5854
5859
|
if (opts.store && opts.runId) {
|
|
5855
5860
|
try {
|
|
5856
5861
|
await opts.store.heartbeat(opts.runId);
|
|
@@ -6986,7 +6991,8 @@ async function advanceStageOnGate(card, stage, stageIndex, def, evaluation, deps
|
|
|
6986
6991
|
});
|
|
6987
6992
|
await runTransition(deps.client, card, {
|
|
6988
6993
|
move: { columnName: toColumn },
|
|
6989
|
-
addLabels: [{ name: AGENT_LABEL }]
|
|
6994
|
+
addLabels: [{ name: AGENT_LABEL }],
|
|
6995
|
+
...isAgentRunnableOwner(next.stage.owner) ? { assignAgent: deps.agentId } : {}
|
|
6990
6996
|
}, { store: deps.stateStore, runId: deps.runId });
|
|
6991
6997
|
deps.stateStore.recordOutcome(card.id, "success").catch(() => {});
|
|
6992
6998
|
log.info(TAG28, `#${card.short_id} advanced "${stage.name}" → "${next.stage.name}" (column "${toColumn}")`);
|
|
@@ -7015,7 +7021,11 @@ async function handleGateUnmet(card, stage, summary, deps) {
|
|
|
7015
7021
|
try {
|
|
7016
7022
|
await deps.client.addComment(card.id, `Stage gate unmet — re-running "${stage.name}". ${summary}.`, { commentType: "progress" });
|
|
7017
7023
|
} catch {}
|
|
7018
|
-
await runTransition(deps.client, card, {
|
|
7024
|
+
await runTransition(deps.client, card, {
|
|
7025
|
+
move: { columnName: toColumn },
|
|
7026
|
+
addLabels: [{ name: AGENT_LABEL }],
|
|
7027
|
+
...isAgentRunnableOwner(stage.owner) ? { assignAgent: deps.agentId } : {}
|
|
7028
|
+
}, { store: deps.stateStore, runId: deps.runId });
|
|
7019
7029
|
log.info(TAG28, `#${card.short_id} gate unmet for "${stage.name}" — requeued to "${toColumn}" for re-run (attempt ${attempts}/${deps.maxAttempts})`);
|
|
7020
7030
|
return { kind: "requeued_gate_unmet", toColumn };
|
|
7021
7031
|
}
|
|
@@ -7115,6 +7125,7 @@ class Worker {
|
|
|
7115
7125
|
timedOut = false;
|
|
7116
7126
|
verificationFailed = false;
|
|
7117
7127
|
held = false;
|
|
7128
|
+
completionStarted = false;
|
|
7118
7129
|
sessionId = null;
|
|
7119
7130
|
runId = null;
|
|
7120
7131
|
cliSessionId = null;
|
|
@@ -7186,6 +7197,7 @@ class Worker {
|
|
|
7186
7197
|
this.timedOut = false;
|
|
7187
7198
|
this.verificationFailed = false;
|
|
7188
7199
|
this.held = false;
|
|
7200
|
+
this.completionStarted = false;
|
|
7189
7201
|
this.runCostCents = 0;
|
|
7190
7202
|
this.runTurns = 0;
|
|
7191
7203
|
this.cliSessionId = null;
|
|
@@ -7325,6 +7337,7 @@ class Worker {
|
|
|
7325
7337
|
progressPercent: 75
|
|
7326
7338
|
});
|
|
7327
7339
|
this.state = "completing";
|
|
7340
|
+
this.completionStarted = true;
|
|
7328
7341
|
await this.recordPhase("completing");
|
|
7329
7342
|
let stageGateEvaluation = null;
|
|
7330
7343
|
const stageRun = stageCtx.kind === "run" ? stageCtx : null;
|
|
@@ -7676,6 +7689,7 @@ class Worker {
|
|
|
7676
7689
|
return await advanceStageOnGate(card, stage, stageIndex, def, evaluation, {
|
|
7677
7690
|
client: this.client,
|
|
7678
7691
|
stateStore: this.stateStore,
|
|
7692
|
+
agentId: this.agentId,
|
|
7679
7693
|
maxAttempts: this.config.budget.maxAttemptsPerCard,
|
|
7680
7694
|
fallbackColumn: this.config.pickupColumns[0] ?? "To Do",
|
|
7681
7695
|
sink: this.cliRunner,
|
|
@@ -7778,7 +7792,7 @@ class Worker {
|
|
|
7778
7792
|
sigtermTimeoutMs: CANCEL_SIGTERM_TIMEOUT2
|
|
7779
7793
|
});
|
|
7780
7794
|
}
|
|
7781
|
-
if (this.cardId && !this.timedOut) {
|
|
7795
|
+
if (this.cardId && !this.timedOut && !this.completionStarted) {
|
|
7782
7796
|
try {
|
|
7783
7797
|
const stats = this.lastSessionStats ?? this.progressTracker?.stats;
|
|
7784
7798
|
await this.client.endAgentSession(this.cardId, {
|
package/dist/index.js
CHANGED
|
@@ -5850,6 +5850,11 @@ async function runTransition(client, card, plan, opts = {}) {
|
|
|
5850
5850
|
await withRetry("endSession", shortId, () => client.endAgentSession(card.id, plan.endSession), attempts, backoffMs);
|
|
5851
5851
|
log.info(TAG22, `#${shortId} session ended (${plan.endSession.status})`);
|
|
5852
5852
|
}
|
|
5853
|
+
if (plan.assignAgent !== undefined) {
|
|
5854
|
+
const assignedAgentId = plan.assignAgent;
|
|
5855
|
+
await withRetry("assignAgent", shortId, () => client.updateCard(card.id, { assignedAgentId }), attempts, backoffMs);
|
|
5856
|
+
log.info(TAG22, assignedAgentId ? `#${shortId} assigned → agent ${assignedAgentId}` : `#${shortId} unassigned`);
|
|
5857
|
+
}
|
|
5853
5858
|
if (opts.store && opts.runId) {
|
|
5854
5859
|
try {
|
|
5855
5860
|
await opts.store.heartbeat(opts.runId);
|
|
@@ -6985,7 +6990,8 @@ async function advanceStageOnGate(card, stage, stageIndex, def, evaluation, deps
|
|
|
6985
6990
|
});
|
|
6986
6991
|
await runTransition(deps.client, card, {
|
|
6987
6992
|
move: { columnName: toColumn },
|
|
6988
|
-
addLabels: [{ name: AGENT_LABEL }]
|
|
6993
|
+
addLabels: [{ name: AGENT_LABEL }],
|
|
6994
|
+
...isAgentRunnableOwner(next.stage.owner) ? { assignAgent: deps.agentId } : {}
|
|
6989
6995
|
}, { store: deps.stateStore, runId: deps.runId });
|
|
6990
6996
|
deps.stateStore.recordOutcome(card.id, "success").catch(() => {});
|
|
6991
6997
|
log.info(TAG28, `#${card.short_id} advanced "${stage.name}" → "${next.stage.name}" (column "${toColumn}")`);
|
|
@@ -7014,7 +7020,11 @@ async function handleGateUnmet(card, stage, summary, deps) {
|
|
|
7014
7020
|
try {
|
|
7015
7021
|
await deps.client.addComment(card.id, `Stage gate unmet — re-running "${stage.name}". ${summary}.`, { commentType: "progress" });
|
|
7016
7022
|
} catch {}
|
|
7017
|
-
await runTransition(deps.client, card, {
|
|
7023
|
+
await runTransition(deps.client, card, {
|
|
7024
|
+
move: { columnName: toColumn },
|
|
7025
|
+
addLabels: [{ name: AGENT_LABEL }],
|
|
7026
|
+
...isAgentRunnableOwner(stage.owner) ? { assignAgent: deps.agentId } : {}
|
|
7027
|
+
}, { store: deps.stateStore, runId: deps.runId });
|
|
7018
7028
|
log.info(TAG28, `#${card.short_id} gate unmet for "${stage.name}" — requeued to "${toColumn}" for re-run (attempt ${attempts}/${deps.maxAttempts})`);
|
|
7019
7029
|
return { kind: "requeued_gate_unmet", toColumn };
|
|
7020
7030
|
}
|
|
@@ -7114,6 +7124,7 @@ class Worker {
|
|
|
7114
7124
|
timedOut = false;
|
|
7115
7125
|
verificationFailed = false;
|
|
7116
7126
|
held = false;
|
|
7127
|
+
completionStarted = false;
|
|
7117
7128
|
sessionId = null;
|
|
7118
7129
|
runId = null;
|
|
7119
7130
|
cliSessionId = null;
|
|
@@ -7185,6 +7196,7 @@ class Worker {
|
|
|
7185
7196
|
this.timedOut = false;
|
|
7186
7197
|
this.verificationFailed = false;
|
|
7187
7198
|
this.held = false;
|
|
7199
|
+
this.completionStarted = false;
|
|
7188
7200
|
this.runCostCents = 0;
|
|
7189
7201
|
this.runTurns = 0;
|
|
7190
7202
|
this.cliSessionId = null;
|
|
@@ -7324,6 +7336,7 @@ class Worker {
|
|
|
7324
7336
|
progressPercent: 75
|
|
7325
7337
|
});
|
|
7326
7338
|
this.state = "completing";
|
|
7339
|
+
this.completionStarted = true;
|
|
7327
7340
|
await this.recordPhase("completing");
|
|
7328
7341
|
let stageGateEvaluation = null;
|
|
7329
7342
|
const stageRun = stageCtx.kind === "run" ? stageCtx : null;
|
|
@@ -7675,6 +7688,7 @@ class Worker {
|
|
|
7675
7688
|
return await advanceStageOnGate(card, stage, stageIndex, def, evaluation, {
|
|
7676
7689
|
client: this.client,
|
|
7677
7690
|
stateStore: this.stateStore,
|
|
7691
|
+
agentId: this.agentId,
|
|
7678
7692
|
maxAttempts: this.config.budget.maxAttemptsPerCard,
|
|
7679
7693
|
fallbackColumn: this.config.pickupColumns[0] ?? "To Do",
|
|
7680
7694
|
sink: this.cliRunner,
|
|
@@ -7777,7 +7791,7 @@ class Worker {
|
|
|
7777
7791
|
sigtermTimeoutMs: CANCEL_SIGTERM_TIMEOUT2
|
|
7778
7792
|
});
|
|
7779
7793
|
}
|
|
7780
|
-
if (this.cardId && !this.timedOut) {
|
|
7794
|
+
if (this.cardId && !this.timedOut && !this.completionStarted) {
|
|
7781
7795
|
try {
|
|
7782
7796
|
const stats = this.lastSessionStats ?? this.progressTracker?.stats;
|
|
7783
7797
|
await this.client.endAgentSession(this.cardId, {
|