@gethmy/agent 1.42.0 → 1.43.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.
- package/dist/cli.js +37 -0
- package/dist/index.js +37 -0
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -8612,6 +8612,14 @@ class StateStore {
|
|
|
8612
8612
|
getCard(cardId) {
|
|
8613
8613
|
return this.state.cards.find((c) => c.cardId === cardId) ?? null;
|
|
8614
8614
|
}
|
|
8615
|
+
async forgetCard(cardId) {
|
|
8616
|
+
const before = this.state.cards.length;
|
|
8617
|
+
this.state.cards = this.state.cards.filter((c) => c.cardId !== cardId);
|
|
8618
|
+
if (this.state.cards.length === before)
|
|
8619
|
+
return false;
|
|
8620
|
+
await this.persist();
|
|
8621
|
+
return true;
|
|
8622
|
+
}
|
|
8615
8623
|
async incrementAttempt(cardId) {
|
|
8616
8624
|
const rec = this.ensureCard(cardId);
|
|
8617
8625
|
rec.attempts += 1;
|
|
@@ -13701,6 +13709,12 @@ import {
|
|
|
13701
13709
|
describeApiError as describeApiError3,
|
|
13702
13710
|
log as log36
|
|
13703
13711
|
} from "@gethmy/harness";
|
|
13712
|
+
function httpStatusOf(err) {
|
|
13713
|
+
if (typeof err !== "object" || err === null)
|
|
13714
|
+
return;
|
|
13715
|
+
const status = own(err, "status");
|
|
13716
|
+
return typeof status === "number" ? status : undefined;
|
|
13717
|
+
}
|
|
13704
13718
|
async function routeBudgetDecision(d, run, actions, cardId) {
|
|
13705
13719
|
if (!run) {
|
|
13706
13720
|
if (!cardId)
|
|
@@ -14081,6 +14095,10 @@ class Pool {
|
|
|
14081
14095
|
try {
|
|
14082
14096
|
({ decisions } = await this.client.getBudgetDecisions(cardId, new Date(sinceMs).toISOString()));
|
|
14083
14097
|
} catch (err) {
|
|
14098
|
+
if (httpStatusOf(err) === 404) {
|
|
14099
|
+
await this.forgetDeletedCard(cardId, run);
|
|
14100
|
+
return;
|
|
14101
|
+
}
|
|
14084
14102
|
log36.warn(TAG32, `getBudgetDecisions failed for ${cardId}: ${err}`);
|
|
14085
14103
|
return;
|
|
14086
14104
|
}
|
|
@@ -14105,6 +14123,25 @@ class Pool {
|
|
|
14105
14123
|
this.draining.delete(cardId);
|
|
14106
14124
|
}
|
|
14107
14125
|
}
|
|
14126
|
+
async forgetDeletedCard(cardId, run) {
|
|
14127
|
+
if (run) {
|
|
14128
|
+
try {
|
|
14129
|
+
await this.stateStore.endRun(run.runId, "failed", {
|
|
14130
|
+
errorMessage: "card deleted"
|
|
14131
|
+
});
|
|
14132
|
+
} catch (err) {
|
|
14133
|
+
log36.warn(TAG32, `Failed to end the parked run for the deleted card ${cardId}: ${err}`);
|
|
14134
|
+
}
|
|
14135
|
+
}
|
|
14136
|
+
try {
|
|
14137
|
+
const dropped = await this.stateStore.forgetCard(cardId);
|
|
14138
|
+
if (dropped) {
|
|
14139
|
+
log36.info(TAG32, `Card ${cardId} no longer exists on the server — dropped from the local ledger; its budget question can never be answered`);
|
|
14140
|
+
}
|
|
14141
|
+
} catch (err) {
|
|
14142
|
+
log36.warn(TAG32, `Failed to drop the deleted card ${cardId}: ${err}`);
|
|
14143
|
+
}
|
|
14144
|
+
}
|
|
14108
14145
|
async releaseExpiredPark(run) {
|
|
14109
14146
|
try {
|
|
14110
14147
|
await this.client.addComment(run.cardId, formatExpiredParkComment({
|
package/dist/index.js
CHANGED
|
@@ -8611,6 +8611,14 @@ class StateStore {
|
|
|
8611
8611
|
getCard(cardId) {
|
|
8612
8612
|
return this.state.cards.find((c) => c.cardId === cardId) ?? null;
|
|
8613
8613
|
}
|
|
8614
|
+
async forgetCard(cardId) {
|
|
8615
|
+
const before = this.state.cards.length;
|
|
8616
|
+
this.state.cards = this.state.cards.filter((c) => c.cardId !== cardId);
|
|
8617
|
+
if (this.state.cards.length === before)
|
|
8618
|
+
return false;
|
|
8619
|
+
await this.persist();
|
|
8620
|
+
return true;
|
|
8621
|
+
}
|
|
8614
8622
|
async incrementAttempt(cardId) {
|
|
8615
8623
|
const rec = this.ensureCard(cardId);
|
|
8616
8624
|
rec.attempts += 1;
|
|
@@ -13700,6 +13708,12 @@ import {
|
|
|
13700
13708
|
describeApiError as describeApiError3,
|
|
13701
13709
|
log as log36
|
|
13702
13710
|
} from "@gethmy/harness";
|
|
13711
|
+
function httpStatusOf(err) {
|
|
13712
|
+
if (typeof err !== "object" || err === null)
|
|
13713
|
+
return;
|
|
13714
|
+
const status = own(err, "status");
|
|
13715
|
+
return typeof status === "number" ? status : undefined;
|
|
13716
|
+
}
|
|
13703
13717
|
async function routeBudgetDecision(d, run, actions, cardId) {
|
|
13704
13718
|
if (!run) {
|
|
13705
13719
|
if (!cardId)
|
|
@@ -14080,6 +14094,10 @@ class Pool {
|
|
|
14080
14094
|
try {
|
|
14081
14095
|
({ decisions } = await this.client.getBudgetDecisions(cardId, new Date(sinceMs).toISOString()));
|
|
14082
14096
|
} catch (err) {
|
|
14097
|
+
if (httpStatusOf(err) === 404) {
|
|
14098
|
+
await this.forgetDeletedCard(cardId, run);
|
|
14099
|
+
return;
|
|
14100
|
+
}
|
|
14083
14101
|
log36.warn(TAG32, `getBudgetDecisions failed for ${cardId}: ${err}`);
|
|
14084
14102
|
return;
|
|
14085
14103
|
}
|
|
@@ -14104,6 +14122,25 @@ class Pool {
|
|
|
14104
14122
|
this.draining.delete(cardId);
|
|
14105
14123
|
}
|
|
14106
14124
|
}
|
|
14125
|
+
async forgetDeletedCard(cardId, run) {
|
|
14126
|
+
if (run) {
|
|
14127
|
+
try {
|
|
14128
|
+
await this.stateStore.endRun(run.runId, "failed", {
|
|
14129
|
+
errorMessage: "card deleted"
|
|
14130
|
+
});
|
|
14131
|
+
} catch (err) {
|
|
14132
|
+
log36.warn(TAG32, `Failed to end the parked run for the deleted card ${cardId}: ${err}`);
|
|
14133
|
+
}
|
|
14134
|
+
}
|
|
14135
|
+
try {
|
|
14136
|
+
const dropped = await this.stateStore.forgetCard(cardId);
|
|
14137
|
+
if (dropped) {
|
|
14138
|
+
log36.info(TAG32, `Card ${cardId} no longer exists on the server — dropped from the local ledger; its budget question can never be answered`);
|
|
14139
|
+
}
|
|
14140
|
+
} catch (err) {
|
|
14141
|
+
log36.warn(TAG32, `Failed to drop the deleted card ${cardId}: ${err}`);
|
|
14142
|
+
}
|
|
14143
|
+
}
|
|
14107
14144
|
async releaseExpiredPark(run) {
|
|
14108
14145
|
try {
|
|
14109
14146
|
await this.client.addComment(run.cardId, formatExpiredParkComment({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gethmy/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.43.0",
|
|
4
4
|
"description": "Push-based agent daemon for Harmony — picks up assigned cards, builds them in isolated git worktrees, and opens PRs. It runs where you put it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
47
|
"@anthropic-ai/claude-agent-sdk": "^0.3.178",
|
|
48
|
-
"@gethmy/harness": "1.
|
|
49
|
-
"@gethmy/mcp": "3.
|
|
48
|
+
"@gethmy/harness": "1.16.0",
|
|
49
|
+
"@gethmy/mcp": "3.12.0",
|
|
50
50
|
"@supabase/supabase-js": "2.95.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|