@gethmy/agent 1.43.0 → 1.44.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 +25 -7
- package/dist/index.js +25 -7
- package/package.json +3 -3
package/dist/cli.js
CHANGED
|
@@ -7361,7 +7361,7 @@ function renderPreviousAttemptsSection(failures) {
|
|
|
7361
7361
|
].join(`
|
|
7362
7362
|
`);
|
|
7363
7363
|
}
|
|
7364
|
-
async function buildPrompt(enriched, branchName, worktreePath, client, workspaceId, projectId, onRecallOutcome) {
|
|
7364
|
+
async function buildPrompt(enriched, branchName, worktreePath, client, workspaceId, projectId, onRecallOutcome, onPromptFallback) {
|
|
7365
7365
|
const { card } = enriched;
|
|
7366
7366
|
const referenceSection = await renderReferenceSection(client, card.title, card.description ?? "", workspaceId, projectId, onRecallOutcome);
|
|
7367
7367
|
try {
|
|
@@ -7379,6 +7379,7 @@ The daemon owns the run lifecycle: once your work is committed it ends the agent
|
|
|
7379
7379
|
} catch (err) {
|
|
7380
7380
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7381
7381
|
log22.warn(TAG20, `Failed to generate prompt via API, using fallback: ${msg}`);
|
|
7382
|
+
onPromptFallback?.();
|
|
7382
7383
|
const commentsSection = await renderCommentsSection(client, card.id);
|
|
7383
7384
|
return buildFallbackPrompt(enriched, branchName, worktreePath) + commentsSection + referenceSection;
|
|
7384
7385
|
}
|
|
@@ -7411,9 +7412,14 @@ async function renderReferenceSection(client, title, description, workspaceId, p
|
|
|
7411
7412
|
const query = buildMemoryQuery(title, description);
|
|
7412
7413
|
const { entities } = await client.searchMemoryEntities(workspaceId, query, {
|
|
7413
7414
|
project_id: projectId,
|
|
7414
|
-
limit: 5
|
|
7415
|
+
limit: 5,
|
|
7416
|
+
consumer: "agent-reference"
|
|
7417
|
+
});
|
|
7418
|
+
onOutcome?.({
|
|
7419
|
+
flavour: "reference",
|
|
7420
|
+
count: entities.length,
|
|
7421
|
+
candidateCount: entities.length
|
|
7415
7422
|
});
|
|
7416
|
-
onOutcome?.({ flavour: "reference", count: entities.length });
|
|
7417
7423
|
if (entities.length === 0)
|
|
7418
7424
|
return "";
|
|
7419
7425
|
const bullets = entities.map((entity) => {
|
|
@@ -12679,11 +12685,16 @@ class Worker {
|
|
|
12679
12685
|
if (worktreePath) {
|
|
12680
12686
|
commitUncommittedChanges(worktreePath, card);
|
|
12681
12687
|
if (this.branchName) {
|
|
12688
|
+
let pushed = false;
|
|
12682
12689
|
try {
|
|
12683
12690
|
pushBranch3(this.branchName, worktreePath);
|
|
12691
|
+
pushed = true;
|
|
12684
12692
|
} catch (err) {
|
|
12685
12693
|
log34.error(this.tag, `push after the motor stage "${ctx.stage.name}" failed for ${this.branchName}: ${err instanceof Error ? err.message : err}`);
|
|
12686
12694
|
}
|
|
12695
|
+
if (pushed) {
|
|
12696
|
+
await recordBranchProvenance(this.client, card, this.branchName);
|
|
12697
|
+
}
|
|
12687
12698
|
}
|
|
12688
12699
|
}
|
|
12689
12700
|
const completionColumn = this.config.completion.moveToColumn;
|
|
@@ -12707,8 +12718,11 @@ class Worker {
|
|
|
12707
12718
|
}
|
|
12708
12719
|
async buildFreshRunPrompt(enriched, card, stageCtx, continuesPushedWork, resuming) {
|
|
12709
12720
|
const recallOutcomes = [];
|
|
12710
|
-
|
|
12711
|
-
this.
|
|
12721
|
+
let promptFallback = false;
|
|
12722
|
+
const basePrompt = await buildPrompt(enriched, this.branchName, this.worktreePath, this.client, this.workspaceId, this.projectId, (outcome) => recallOutcomes.push(outcome), () => {
|
|
12723
|
+
promptFallback = true;
|
|
12724
|
+
});
|
|
12725
|
+
this.recordPromptAssembled(recallOutcomes, promptFallback);
|
|
12712
12726
|
let prompt = basePrompt;
|
|
12713
12727
|
if (stageCtx.kind === "run") {
|
|
12714
12728
|
const loop = getStageLoop(stageCtx.stage);
|
|
@@ -12918,16 +12932,20 @@ ${prompt}`;
|
|
|
12918
12932
|
}
|
|
12919
12933
|
return outcome;
|
|
12920
12934
|
}
|
|
12921
|
-
recordPromptAssembled(outcomes) {
|
|
12922
|
-
const
|
|
12935
|
+
recordPromptAssembled(outcomes, promptFallback = false) {
|
|
12936
|
+
const outcomeOf = (flavour) => outcomes.find((o) => o.flavour === flavour);
|
|
12937
|
+
const countOf = (flavour) => outcomeOf(flavour)?.count;
|
|
12923
12938
|
const failures = outcomes.flatMap((o) => o.failure ? [{ flavour: o.flavour, message: o.failure.slice(0, 300) }] : []);
|
|
12924
12939
|
const episodeCount = countOf("past_episodes");
|
|
12940
|
+
const candidateCount = outcomeOf("reference")?.candidateCount;
|
|
12925
12941
|
this.cliRunner?.record({
|
|
12926
12942
|
kind: "prompt_assembled",
|
|
12927
12943
|
source: "system",
|
|
12928
12944
|
payload: {
|
|
12929
12945
|
...episodeCount === undefined ? {} : { episodeCount },
|
|
12930
12946
|
referenceCount: countOf("reference") ?? 0,
|
|
12947
|
+
...candidateCount === undefined ? {} : { candidateCount },
|
|
12948
|
+
...promptFallback ? { promptFallback: true } : {},
|
|
12931
12949
|
...failures.length > 0 ? { recallFailures: failures } : {}
|
|
12932
12950
|
}
|
|
12933
12951
|
});
|
package/dist/index.js
CHANGED
|
@@ -7360,7 +7360,7 @@ function renderPreviousAttemptsSection(failures) {
|
|
|
7360
7360
|
].join(`
|
|
7361
7361
|
`);
|
|
7362
7362
|
}
|
|
7363
|
-
async function buildPrompt(enriched, branchName, worktreePath, client, workspaceId, projectId, onRecallOutcome) {
|
|
7363
|
+
async function buildPrompt(enriched, branchName, worktreePath, client, workspaceId, projectId, onRecallOutcome, onPromptFallback) {
|
|
7364
7364
|
const { card } = enriched;
|
|
7365
7365
|
const referenceSection = await renderReferenceSection(client, card.title, card.description ?? "", workspaceId, projectId, onRecallOutcome);
|
|
7366
7366
|
try {
|
|
@@ -7378,6 +7378,7 @@ The daemon owns the run lifecycle: once your work is committed it ends the agent
|
|
|
7378
7378
|
} catch (err) {
|
|
7379
7379
|
const msg = err instanceof Error ? err.message : String(err);
|
|
7380
7380
|
log22.warn(TAG20, `Failed to generate prompt via API, using fallback: ${msg}`);
|
|
7381
|
+
onPromptFallback?.();
|
|
7381
7382
|
const commentsSection = await renderCommentsSection(client, card.id);
|
|
7382
7383
|
return buildFallbackPrompt(enriched, branchName, worktreePath) + commentsSection + referenceSection;
|
|
7383
7384
|
}
|
|
@@ -7410,9 +7411,14 @@ async function renderReferenceSection(client, title, description, workspaceId, p
|
|
|
7410
7411
|
const query = buildMemoryQuery(title, description);
|
|
7411
7412
|
const { entities } = await client.searchMemoryEntities(workspaceId, query, {
|
|
7412
7413
|
project_id: projectId,
|
|
7413
|
-
limit: 5
|
|
7414
|
+
limit: 5,
|
|
7415
|
+
consumer: "agent-reference"
|
|
7416
|
+
});
|
|
7417
|
+
onOutcome?.({
|
|
7418
|
+
flavour: "reference",
|
|
7419
|
+
count: entities.length,
|
|
7420
|
+
candidateCount: entities.length
|
|
7414
7421
|
});
|
|
7415
|
-
onOutcome?.({ flavour: "reference", count: entities.length });
|
|
7416
7422
|
if (entities.length === 0)
|
|
7417
7423
|
return "";
|
|
7418
7424
|
const bullets = entities.map((entity) => {
|
|
@@ -12678,11 +12684,16 @@ class Worker {
|
|
|
12678
12684
|
if (worktreePath) {
|
|
12679
12685
|
commitUncommittedChanges(worktreePath, card);
|
|
12680
12686
|
if (this.branchName) {
|
|
12687
|
+
let pushed = false;
|
|
12681
12688
|
try {
|
|
12682
12689
|
pushBranch3(this.branchName, worktreePath);
|
|
12690
|
+
pushed = true;
|
|
12683
12691
|
} catch (err) {
|
|
12684
12692
|
log34.error(this.tag, `push after the motor stage "${ctx.stage.name}" failed for ${this.branchName}: ${err instanceof Error ? err.message : err}`);
|
|
12685
12693
|
}
|
|
12694
|
+
if (pushed) {
|
|
12695
|
+
await recordBranchProvenance(this.client, card, this.branchName);
|
|
12696
|
+
}
|
|
12686
12697
|
}
|
|
12687
12698
|
}
|
|
12688
12699
|
const completionColumn = this.config.completion.moveToColumn;
|
|
@@ -12706,8 +12717,11 @@ class Worker {
|
|
|
12706
12717
|
}
|
|
12707
12718
|
async buildFreshRunPrompt(enriched, card, stageCtx, continuesPushedWork, resuming) {
|
|
12708
12719
|
const recallOutcomes = [];
|
|
12709
|
-
|
|
12710
|
-
this.
|
|
12720
|
+
let promptFallback = false;
|
|
12721
|
+
const basePrompt = await buildPrompt(enriched, this.branchName, this.worktreePath, this.client, this.workspaceId, this.projectId, (outcome) => recallOutcomes.push(outcome), () => {
|
|
12722
|
+
promptFallback = true;
|
|
12723
|
+
});
|
|
12724
|
+
this.recordPromptAssembled(recallOutcomes, promptFallback);
|
|
12711
12725
|
let prompt = basePrompt;
|
|
12712
12726
|
if (stageCtx.kind === "run") {
|
|
12713
12727
|
const loop = getStageLoop(stageCtx.stage);
|
|
@@ -12917,16 +12931,20 @@ ${prompt}`;
|
|
|
12917
12931
|
}
|
|
12918
12932
|
return outcome;
|
|
12919
12933
|
}
|
|
12920
|
-
recordPromptAssembled(outcomes) {
|
|
12921
|
-
const
|
|
12934
|
+
recordPromptAssembled(outcomes, promptFallback = false) {
|
|
12935
|
+
const outcomeOf = (flavour) => outcomes.find((o) => o.flavour === flavour);
|
|
12936
|
+
const countOf = (flavour) => outcomeOf(flavour)?.count;
|
|
12922
12937
|
const failures = outcomes.flatMap((o) => o.failure ? [{ flavour: o.flavour, message: o.failure.slice(0, 300) }] : []);
|
|
12923
12938
|
const episodeCount = countOf("past_episodes");
|
|
12939
|
+
const candidateCount = outcomeOf("reference")?.candidateCount;
|
|
12924
12940
|
this.cliRunner?.record({
|
|
12925
12941
|
kind: "prompt_assembled",
|
|
12926
12942
|
source: "system",
|
|
12927
12943
|
payload: {
|
|
12928
12944
|
...episodeCount === undefined ? {} : { episodeCount },
|
|
12929
12945
|
referenceCount: countOf("reference") ?? 0,
|
|
12946
|
+
...candidateCount === undefined ? {} : { candidateCount },
|
|
12947
|
+
...promptFallback ? { promptFallback: true } : {},
|
|
12930
12948
|
...failures.length > 0 ? { recallFailures: failures } : {}
|
|
12931
12949
|
}
|
|
12932
12950
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gethmy/agent",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.44.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.17.0",
|
|
49
|
+
"@gethmy/mcp": "3.13.0",
|
|
50
50
|
"@supabase/supabase-js": "2.95.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|