@amykit/agent-kit 0.3.1 → 0.5.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/README.md CHANGED
@@ -2,8 +2,9 @@
2
2
 
3
3
  The part of "being an agent" that is the same whichever harness answers.
4
4
 
5
- Not a plugin. A library the harness plugins share, so that adding a harness
6
- means teaching amy a **command line**, not re-teaching it the job.
5
+ Not a plugin. A library the harness plugins and the workflows share, so that
6
+ adding a harness means teaching amy a **command line**, and writing a step
7
+ means writing a **prompt**.
7
8
 
8
9
  ## What is here
9
10
 
@@ -12,18 +13,40 @@ means teaching amy a **command line**, not re-teaching it the job.
12
13
  ```ts
13
14
  interface Harness {
14
15
  readonly name: string;
15
- ask(prompt: string, cwd: string): Promise<HarnessReply>;
16
+ ask(prompt: string, cwd: string, context?: AskContext): Promise<HarnessReply>;
16
17
  }
17
18
  ```
18
19
 
19
- One method. Everything else about being useful to a ticket lives in
20
- `HarnessAgent`, which turns that one method into the `agent` port: the triage,
21
- implement and review-answering prompts, the JSON the replies are read out of,
22
- and the git dance around each call.
20
+ One method, and the `agent` port is the same one method. A harness answers in
21
+ the directory it is handed and never touches git: when work is committed and
22
+ pushed is the workflow's decision
23
+ ([an agent only answers](../../docs/design/an-agent-only-answers.md)).
23
24
 
24
- **`contributeTiers`** adds one agent per model tier to the collection the
25
- relay reads. The naming lives here rather than in each plugin because it is a
26
- contract: `claude:opus` is what an operator writes in a ladder, so three
25
+ **`implementStep`** and **`judgeStep`** are what a workflow builds a step
26
+ with, on any agent:
27
+
28
+ ```ts
29
+ // Ask for a change; commit it through the function you pass.
30
+ const { value } = await implementStep(agent, {
31
+ prompt, cwd, context: { workId, step: "implement" },
32
+ commit: () => git.commitAndPush(repo, branch, message, workId),
33
+ });
34
+
35
+ // Ask a question whose answer is one JSON object, and read it.
36
+ const { value } = await judgeStep(agent, {
37
+ prompt, cwd, context: { workId, step: "triage" },
38
+ read: (answer) => readTriage(answer, at),
39
+ fallback: unreadTriage(at),
40
+ });
41
+ ```
42
+
43
+ **`HarnessRelay`** is one harness made of several: a skill ladder for who
44
+ should do a step and a harness ladder for what to do when the one asked ran
45
+ out of quota or was not up to it, both keyed by the `step` in the context.
46
+
47
+ **`contributeTiers`** adds one `NamedHarness` per model tier to the collection
48
+ the relay reads. The naming lives here rather than in each plugin because it
49
+ is a contract: `claude:opus` is what an operator writes in a ladder, so three
27
50
  plugins inventing three conventions would make the config unlearnable.
28
51
 
29
52
  ## Why a harness contributes instead of mounting
@@ -32,18 +55,19 @@ A port has exactly one owner. Three harnesses that each mounted `agent` would
32
55
  refuse to mount together, which is the correct behaviour for a port and the
33
56
  wrong outcome here.
34
57
 
35
- So a harness contributes a `NamedAgent` and `@amykit/plugin-agent-relay` is the
36
- only thing that mounts the port. A single-harness install goes through the
58
+ So a harness contributes a `NamedHarness` and `@amykit/plugin-agent-relay` is
59
+ the only thing that mounts the port. A single-harness install goes through the
37
60
  relay too, with a ladder one rung long and nothing special about that case.
38
61
 
39
- `harness` and `model` are declared on each `NamedAgent` rather than discovered
40
- from a result, because the relay has to decide **where to go next** before it
41
- runs anything.
42
-
43
- ## Two decisions inherited by every harness
62
+ `harness` and `model` are declared on each rung rather than discovered from a
63
+ result, because the relay has to decide **where to go next** before it runs
64
+ anything.
44
65
 
45
- **A clean exit that changed nothing is a failure.** The ticket asked for work.
46
- Reporting success would send an empty pull request to a reviewer.
66
+ ## A decision every step inherits
47
67
 
48
- **An unanswered review comment becomes a disagreement, not a silence.** A
49
- comment the agent did not answer is pushed to the owner rather than dropped.
68
+ **A clean exit that changed nothing is a failure.** `implementStep` commits
69
+ as the context's `verify`, which the relay calls after each rung that
70
+ completed, so a rung that changed no file hands the step to the stronger model
71
+ or the next skill, and the attempt that changed nothing on every rung reports
72
+ `unchanged` progress. Reporting success would send an empty pull request to a
73
+ reviewer.
@@ -1 +1 @@
1
- {"version":3,"file":"HarnessRelay.d.ts","sourceRoot":"","sources":["../src/HarnessRelay.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AE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,MAAM,CAAC,EAAE,YAAY,CAAC;CACvB;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,YAAW,OAAO;IAIxC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,QAAQ,CAAC,IAAI,WAAW;gBAGL,OAAO,EAAE,OAAO,CAAC,YAAY,CAAC,EAC9B,IAAI,GAAE,gBAAqB;IAO9C;;;;;OAKG;IACG,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAwBvF;;;;;;OAMG;YACW,KAAK;CAkCpB"}
@@ -68,6 +68,10 @@ export class HarnessRelay {
68
68
  while (index < ladder.length) {
69
69
  const rung = ladder[index];
70
70
  last = await rung.cli.ask(asked(prompt, skill, handoff), cwd, context);
71
+ // The caller says whether a completed run holds while there is still a
72
+ // rung to climb to, rather than after the ladder has stopped.
73
+ if (last.run.outcome === "completed" && context.verify)
74
+ last = await context.verify(last);
71
75
  const next = nextRung(ladder, index, last.run.outcome);
72
76
  if (next === null)
73
77
  return last;
@@ -1 +1 @@
1
- {"version":3,"file":"HarnessRelay.js","sourceRoot":"","sources":["../src/HarnessRelay.ts"],"names":[],"mappings":"AAEA,OAAO,EAAc,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC1F,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAW,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAS5D;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,YAAY;IAIJ;IACA;IAJV,IAAI,GAAG,OAAO,CAAC;IAExB,YACmB,OAA8B,EAC9B,OAAyB,EAAE;QAD3B,YAAO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/C,CAAC;AAED,kEAAkE;AAClE,SAAS,IAAI,CAAC,OAAmB;IAC/B,OAAO,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC;AAC/B,CAAC"}
@@ -1,44 +1,19 @@
1
1
  import { Harness } from "@amykit/core";
2
- import { Agent } from "@amykit/workflow-ticket-to-qa";
3
2
  import { Rung } from "./ladder.js";
4
- /** The collection every harness plugin adds its ticket-shaped agents to. */
5
- export declare const AGENT_COLLECTION = "agent";
6
3
  /**
7
- * The collection every harness plugin adds the bare CLI to.
4
+ * The collection every harness plugin adds its CLI to, one per model tier.
8
5
  *
9
- * Two collections rather than one, because they are two different things at
10
- * two different levels. A `NamedAgent` already knows what a ticket is, which
11
- * prompt to send and when to commit; a `NamedHarness` knows none of that and
12
- * is what a second workflow wants, so that its own prompts go up the same
13
- * ladder as the first workflow's do.
14
- */
15
- export declare const HARNESS_COLLECTION = "harness";
16
- /**
17
- * One harness at one model tier, ready to be asked.
18
- *
19
- * A harness plugin contributes one of these per model it was configured with,
20
- * rather than mounting the `agent` port. Only one plugin can own a port, and
21
- * three harnesses that each want to be *the* agent would simply refuse to
22
- * mount together. Contributing instead lets a relay compose them, and lets a
23
- * single-harness install work through the same relay with nothing special
24
- * about it.
6
+ * A harness plugin contributes rather than mounting the `agent` port: only
7
+ * one plugin can own a port, and three harnesses that each wanted to be *the*
8
+ * agent would refuse to mount together. The relay composes what is
9
+ * contributed, and a single-harness install goes through the same relay.
25
10
  *
26
11
  * `harness` and `model` are declared rather than discovered, because the
27
12
  * relay has to decide **where to go next** before running anything: a quota
28
- * problem wants a different harness and a failure wants a stronger model, and
29
- * both are choices made in advance.
13
+ * problem wants a different harness and a failure wants a stronger model.
30
14
  */
31
- export interface NamedAgent extends Rung {
32
- readonly agent: Agent;
33
- /**
34
- * The same harness and model, with a named skill doing the step.
35
- *
36
- * A second agent rather than an argument on the port, because which skill
37
- * answers is decided before the call, exactly like which harness does.
38
- */
39
- readonly using: (skill: string) => Agent;
40
- }
41
- /** The same rung of the same ladder, with no workflow's prompts on it. */
15
+ export declare const HARNESS_COLLECTION = "harness";
16
+ /** One rung of the ladder: a harness at one model, with nobody's prompts on it. */
42
17
  export interface NamedHarness extends Rung {
43
18
  readonly cli: Harness;
44
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,4EAA4E;AAC5E,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC;;;;;;;;GAQG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,UAAW,SAAQ,IAAI;IACtC,QAAQ,CAAC,KAAK,EAAE,KAAK,CAAC;IACtB;;;;;OAKG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,KAAK,CAAC;CAC1C;AAED,0EAA0E;AAC1E,MAAM,WAAW,YAAa,SAAQ,IAAI;IACxC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB"}
1
+ {"version":3,"file":"collection.d.ts","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAE5C,mFAAmF;AACnF,MAAM,WAAW,YAAa,SAAQ,IAAI;IACxC,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;CACvB"}
@@ -1,13 +1,14 @@
1
- /** The collection every harness plugin adds its ticket-shaped agents to. */
2
- export const AGENT_COLLECTION = "agent";
3
1
  /**
4
- * The collection every harness plugin adds the bare CLI to.
2
+ * The collection every harness plugin adds its CLI to, one per model tier.
5
3
  *
6
- * Two collections rather than one, because they are two different things at
7
- * two different levels. A `NamedAgent` already knows what a ticket is, which
8
- * prompt to send and when to commit; a `NamedHarness` knows none of that and
9
- * is what a second workflow wants, so that its own prompts go up the same
10
- * ladder as the first workflow's do.
4
+ * A harness plugin contributes rather than mounting the `agent` port: only
5
+ * one plugin can own a port, and three harnesses that each wanted to be *the*
6
+ * agent would refuse to mount together. The relay composes what is
7
+ * contributed, and a single-harness install goes through the same relay.
8
+ *
9
+ * `harness` and `model` are declared rather than discovered, because the
10
+ * relay has to decide **where to go next** before running anything: a quota
11
+ * problem wants a different harness and a failure wants a stronger model.
11
12
  */
12
13
  export const HARNESS_COLLECTION = "harness";
13
14
  //# sourceMappingURL=collection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"collection.js","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAIA,4EAA4E;AAC5E,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CAAC;AAExC;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC"}
1
+ {"version":3,"file":"collection.js","sourceRoot":"","sources":["../src/collection.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG,SAAS,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { HarnessAgent } from "./HarnessAgent.js";
2
- export type { HarnessAgentConfig } from "./HarnessAgent.js";
3
1
  export { HarnessRelay } from "./HarnessRelay.js";
4
2
  export type { HarnessRelayDeps, SkillLadders } from "./HarnessRelay.js";
5
3
  export { extractJson } from "./json.js";
6
- export { AGENT_COLLECTION, HARNESS_COLLECTION } from "./collection.js";
7
- export type { NamedAgent, NamedHarness } from "./collection.js";
4
+ export { HARNESS_COLLECTION } from "./collection.js";
5
+ export type { NamedHarness } from "./collection.js";
6
+ export { implementStep, judgeStep } from "./steps.js";
7
+ export type { ImplementInput, JudgeInput, StepInput } from "./steps.js";
8
8
  export { handoffNote, recordHandoff, recordSkillHandoff } from "./handoff.js";
9
9
  export type { HandoffLog } from "./handoff.js";
10
10
  export { nextRung } from "./ladder.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACvE,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9E,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,YAAY,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACtD,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAC9E,YAAY,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,YAAY,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC"}
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- export { HarnessAgent } from "./HarnessAgent.js";
2
1
  export { HarnessRelay } from "./HarnessRelay.js";
3
2
  export { extractJson } from "./json.js";
4
- export { AGENT_COLLECTION, HARNESS_COLLECTION } from "./collection.js";
3
+ export { HARNESS_COLLECTION } from "./collection.js";
4
+ export { implementStep, judgeStep } from "./steps.js";
5
5
  export { handoffNote, recordHandoff, recordSkillHandoff } from "./handoff.js";
6
6
  export { nextRung } from "./ladder.js";
7
7
  export { everyRung, oneLadder, rungsFor } from "./ladders.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAEjD,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAEtD,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAEvC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAE9D,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC"}
@@ -0,0 +1,46 @@
1
+ import { Agent, AgentResult, AskContext, AttemptOutcome } from "@amykit/core";
2
+ /** One question to the agent, in the directory the work is in. */
3
+ export interface StepInput {
4
+ prompt: string;
5
+ cwd: string;
6
+ context?: AskContext;
7
+ }
8
+ export interface ImplementInput extends StepInput {
9
+ /**
10
+ * Commits what the agent left behind, and says whether there was anything.
11
+ *
12
+ * The caller's, because when work is committed and when it reaches the
13
+ * remote are the workflow's decisions: one pushes after every attempt,
14
+ * another once per cycle. This helper never names git.
15
+ */
16
+ commit: () => Promise<boolean>;
17
+ /** The progress key a retry is judged by. */
18
+ key?: string;
19
+ now?: () => Date;
20
+ }
21
+ /**
22
+ * Asks for a change, commits it through the caller, and says whether it moved.
23
+ *
24
+ * The commit runs as the context's `verify`, so a relay commits after each
25
+ * rung that completed and climbs on one that changed nothing, exactly as it
26
+ * climbs on a failure. Over an agent that never calls `verify` the commit
27
+ * runs once the answer is back. A run that completed and changed no file is
28
+ * a failure with `unchanged` progress, so a retry policy can tell an attempt
29
+ * that added nothing from one that did. A run that did not complete is
30
+ * returned rather than thrown, with its account.
31
+ */
32
+ export declare function implementStep(agent: Agent, input: ImplementInput): Promise<AgentResult<AttemptOutcome>>;
33
+ export interface JudgeInput<T> extends StepInput {
34
+ /** Turns the JSON object the prompt asked for into the step's answer. */
35
+ read: (answer: unknown) => T;
36
+ /** The answer when the run did not complete, so there is nothing to read. */
37
+ fallback: T;
38
+ }
39
+ /**
40
+ * Asks a question whose answer is one JSON object, and reads it.
41
+ *
42
+ * A run that did not complete yields the caller's fallback with the run's
43
+ * account, for the same reason `implementStep` returns rather than throws.
44
+ */
45
+ export declare function judgeStep<T>(agent: Agent, input: JudgeInput<T>): Promise<AgentResult<T>>;
46
+ //# sourceMappingURL=steps.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.d.ts","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAgB,MAAM,cAAc,CAAC;AAG5F,kEAAkE;AAClE,MAAM,WAAW,SAAS;IACxB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,UAAU,CAAC;CACtB;AAED,MAAM,WAAW,cAAe,SAAQ,SAAS;IAC/C;;;;;;OAMG;IACH,MAAM,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/B,6CAA6C;IAC7C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAID;;;;;;;;;;GAUG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CA4B7G;AAED,MAAM,WAAW,UAAU,CAAC,CAAC,CAAE,SAAQ,SAAS;IAC9C,yEAAyE;IACzE,IAAI,EAAE,CAAC,MAAM,EAAE,OAAO,KAAK,CAAC,CAAC;IAC7B,6EAA6E;IAC7E,QAAQ,EAAE,CAAC,CAAC;CACb;AAED;;;;;GAKG;AACH,wBAAsB,SAAS,CAAC,CAAC,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAI9F"}
package/dist/steps.js ADDED
@@ -0,0 +1,53 @@
1
+ import { extractJson } from "./json.js";
2
+ const NO_CHANGE = "the agent finished without changing any file";
3
+ /**
4
+ * Asks for a change, commits it through the caller, and says whether it moved.
5
+ *
6
+ * The commit runs as the context's `verify`, so a relay commits after each
7
+ * rung that completed and climbs on one that changed nothing, exactly as it
8
+ * climbs on a failure. Over an agent that never calls `verify` the commit
9
+ * runs once the answer is back. A run that completed and changed no file is
10
+ * a failure with `unchanged` progress, so a retry policy can tell an attempt
11
+ * that added nothing from one that did. A run that did not complete is
12
+ * returned rather than thrown, with its account.
13
+ */
14
+ export async function implementStep(agent, input) {
15
+ // The last run `verify` judged, and whether it changed anything. Only the
16
+ // run that comes back is the attempt's, so an earlier rung's verdict never
17
+ // speaks for a later rung that failed for another reason.
18
+ let judged;
19
+ const verify = async (reply) => {
20
+ const changed = await input.commit();
21
+ const verdict = changed ? reply : { ...reply, run: { ...reply.run, outcome: "failed", output: `${NO_CHANGE}\n\n${reply.run.output}` } };
22
+ judged = { reply: verdict, changed };
23
+ return verdict;
24
+ };
25
+ let reply = await agent.ask(input.prompt, input.cwd, { ...input.context, verify });
26
+ if (reply.run.outcome === "completed" && judged?.reply !== reply)
27
+ reply = await verify(reply);
28
+ const at = (input.now ?? (() => new Date()))().toISOString();
29
+ const key = input.key ?? "implementation";
30
+ if (judged?.reply === reply && !judged.changed) {
31
+ return {
32
+ value: { ok: false, output: reply.run.output, at, progress: { kind: "unchanged", key, detail: NO_CHANGE } },
33
+ run: reply.run,
34
+ };
35
+ }
36
+ if (reply.run.outcome !== "completed") {
37
+ return { value: { ok: false, output: reply.run.output, at }, run: reply.run };
38
+ }
39
+ return { value: { ok: true, output: reply.run.output, at, progress: { kind: "advanced", key } }, run: reply.run };
40
+ }
41
+ /**
42
+ * Asks a question whose answer is one JSON object, and reads it.
43
+ *
44
+ * A run that did not complete yields the caller's fallback with the run's
45
+ * account, for the same reason `implementStep` returns rather than throws.
46
+ */
47
+ export async function judgeStep(agent, input) {
48
+ const reply = await agent.ask(input.prompt, input.cwd, input.context);
49
+ if (reply.run.outcome !== "completed")
50
+ return { value: input.fallback, run: reply.run };
51
+ return { value: input.read(extractJson(reply.text)), run: reply.run };
52
+ }
53
+ //# sourceMappingURL=steps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAuBxC,MAAM,SAAS,GAAG,8CAA8C,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAY,EAAE,KAAqB;IACrE,0EAA0E;IAC1E,2EAA2E;IAC3E,0DAA0D;IAC1D,IAAI,MAA6D,CAAC;IAClE,MAAM,MAAM,GAAG,KAAK,E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SAAS,EAAE,EAAE;YAC3G,GAAG,EAAE,KAAK,CAAC,GAAG;SACf,CAAC;IACJ,CAAC;IACD,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,WAAW,EAAE,CAAC;QACtC,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IAChF,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AACpH,CAAC;AASD;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAI,KAAY,EAAE,KAAoB;IACnE,MAAM,KAAK,GAAG,MAAM,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;IACtE,IAAI,KAAK,CAAC,GAAG,CAAC,OAAO,KAAK,WAAW;QAAE,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;IACxF,OAAO,EAAE,KAAK,EAAE,KAAK,CAAC,IAAI,CAAC,WAAW,CAAU,KAAK,CAAC,IAAI,CAAC,CAAC,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AACjF,CAAC"}
package/dist/tiers.d.ts CHANGED
@@ -1,6 +1,5 @@
1
- import { Git, Harness, Registry } from "@amykit/core";
2
- import { NamedAgent } from "./collection.js";
3
- import { HarnessAgentConfig } from "./HarnessAgent.js";
1
+ import { Harness, Registry } from "@amykit/core";
2
+ import { NamedHarness } from "./collection.js";
4
3
  export interface TierOptions {
5
4
  /** The harness name, which is also the axis the relay swaps along. */
6
5
  harness: string;
@@ -12,25 +11,15 @@ export interface TierOptions {
12
11
  make: (model: string) => Harness;
13
12
  /** See `Rung.pricesItsOwnRuns`. Declared once per harness, not per tier. */
14
13
  pricesItsOwnRuns?: boolean;
15
- git: Git;
16
- agent?: HarnessAgentConfig;
17
14
  }
18
15
  /**
19
- * Adds one agent **and one bare harness** per model tier to the collections
20
- * the relay reads.
21
- *
22
- * Both, because they are used at different levels. The agent already knows
23
- * what a ticket is; the harness knows nothing, and is what a second workflow
24
- * asks its own questions through. Contributing only the first is what made
25
- * `@amykit/plugin-claude` a plugin exactly one workflow could use.
16
+ * Adds one harness per model tier to the collection the relay reads.
26
17
  *
27
18
  * The naming lives here rather than in each harness plugin because it is a
28
19
  * contract: the ladder in a config file refers to these names, so three
29
- * plugins inventing three conventions would make the config unlearnable. One
30
- * name covers both collections, so a ladder means the same thing whichever
31
- * level reads it.
20
+ * plugins inventing three conventions would make the config unlearnable.
32
21
  */
33
- export declare function contributeTiers(registry: Registry, opts: TierOptions): NamedAgent[];
22
+ export declare function contributeTiers(registry: Registry, opts: TierOptions): NamedHarness[];
34
23
  /** `claude:opus`, or plain `claude` when no model was named. */
35
24
  export declare function tierName(harness: string, model: string): string;
36
25
  //# sourceMappingURL=tiers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"tiers.d.ts","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACtD,OAAO,EAAwC,UAAU,EAAgB,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAgB,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,GAAG,EAAE,GAAG,CAAC;IACT,KAAK,CAAC,EAAE,kBAAkB,CAAC;CAC5B;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,UAAU,EAAE,CAkCnF;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D"}
1
+ {"version":3,"file":"tiers.d.ts","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAsB,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAEnE,MAAM,WAAW,WAAW;IAC1B,sEAAsE;IACtE,OAAO,EAAE,MAAM,CAAC;IAChB;;;OAGG;IACH,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,IAAI,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,CAAC;IACjC,4EAA4E;IAC5E,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,GAAG,YAAY,EAAE,CA0BrF;AAED,gEAAgE;AAChE,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/D"}
package/dist/tiers.js CHANGED
@@ -1,19 +1,10 @@
1
- import { AGENT_COLLECTION, HARNESS_COLLECTION } from "./collection.js";
2
- import { HarnessAgent } from "./HarnessAgent.js";
1
+ import { HARNESS_COLLECTION } from "./collection.js";
3
2
  /**
4
- * Adds one agent **and one bare harness** per model tier to the collections
5
- * the relay reads.
6
- *
7
- * Both, because they are used at different levels. The agent already knows
8
- * what a ticket is; the harness knows nothing, and is what a second workflow
9
- * asks its own questions through. Contributing only the first is what made
10
- * `@amykit/plugin-claude` a plugin exactly one workflow could use.
3
+ * Adds one harness per model tier to the collection the relay reads.
11
4
  *
12
5
  * The naming lives here rather than in each harness plugin because it is a
13
6
  * contract: the ladder in a config file refers to these names, so three
14
- * plugins inventing three conventions would make the config unlearnable. One
15
- * name covers both collections, so a ladder means the same thing whichever
16
- * level reads it.
7
+ * plugins inventing three conventions would make the config unlearnable.
17
8
  */
18
9
  export function contributeTiers(registry, opts) {
19
10
  // The union the config sent can name a model twice — `ladder` and a step's
@@ -32,18 +23,14 @@ export function contributeTiers(registry, opts) {
32
23
  if (models.length === 0)
33
24
  models.push("");
34
25
  return models.map((model) => {
35
- const cli = opts.make(model);
36
- const agent = (skill) => new HarnessAgent(cli, opts.git, { ...(opts.agent ?? {}), skill });
37
- const rung = {
26
+ const named = {
38
27
  name: tierName(opts.harness, model),
39
28
  harness: opts.harness,
40
29
  model,
41
30
  pricesItsOwnRuns: opts.pricesItsOwnRuns ?? false,
31
+ cli: opts.make(model),
42
32
  };
43
- const named = { ...rung, agent: agent(), using: (skill) => agent(skill) };
44
- const bare = { ...rung, cli };
45
- registry.contribute(AGENT_COLLECTION, named.name, named);
46
- registry.contribute(HARNESS_COLLECTION, bare.name, bare);
33
+ registry.contribute(HARNESS_COLLECTION, named.name, named);
47
34
  return named;
48
35
  });
49
36
  }
package/dist/tiers.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"tiers.js","sourceRoot":"","sources":["../src/tiers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAA4B,MAAM,iBAAiB,CAAC;AACjG,OAAO,EAAE,YAAY,EAAsB,MAAM,mBAAmB,CAAC;AAiBrE;;;;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AAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;QAC1B,MAAM,KAAK,GAAiB;YAC1B,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,CAAC;YACnC,OAAO,EAAE,IAAI,CAAC,OAAO;YACrB,KAAK;YACL,gBAAgB,EAAE,IAAI,CAAC,gBAAgB,IAAI,KAAK;YAChD,GAAG,EAAE,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC;SACtB,CAAC;QACF,QAAQ,CAAC,UAAU,CAAC,kBAAkB,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAC3D,OAAO,KAAK,CAAC;IACf,CAAC,CAAC,CAAC;AACL,CAAC;AAED,gEAAgE;AAChE,MAAM,UAAU,QAAQ,CAAC,OAAe,EAAE,KAAa;IACrD,OAAO,KAAK,CAAC,CAAC,CAAC,GAAG,OAAO,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AACjD,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@amykit/agent-kit",
3
- "version": "0.3.1",
4
- "description": "What every agent does the same way: the prompts, the git dance, and the JSON.",
3
+ "version": "0.5.0",
4
+ "description": "What every agent does the same way: the ladders, the handoffs, and steps built on ask that never touch git.",
5
5
  "type": "module",
6
6
  "license": "MIT",
7
7
  "author": "Nicolas Melo",
@@ -28,8 +28,7 @@
28
28
  "dist"
29
29
  ],
30
30
  "dependencies": {
31
- "@amykit/core": "^0.3.1",
32
- "@amykit/workflow-ticket-to-qa": "^0.3.1"
31
+ "@amykit/core": "^0.5.0"
33
32
  },
34
33
  "devDependencies": {
35
34
  "@amykit/test-fixtures": "^0.1.0"
@@ -1,39 +0,0 @@
1
- import { AgentResult, Git, Harness, ReviewThread } from "@amykit/core";
2
- import { Agent, AttemptOutcome, ThreadVerdict, Ticket, TriageOutcome } from "@amykit/workflow-ticket-to-qa";
3
- export interface HarnessAgentConfig {
4
- /**
5
- * Extra guidance to append when answering a particular reviewer, keyed by
6
- * their host login. A reviewer with known habits is cheaper to satisfy on
7
- * the first pass than on the third.
8
- */
9
- reviewerHints?: Readonly<Record<string, string>>;
10
- /**
11
- * A skill to hand the step to, instead of amy asking in its own words.
12
- *
13
- * The step's own instructions still follow the invocation, because the
14
- * answer has to arrive in the same shape whoever does the work.
15
- */
16
- skill?: string;
17
- }
18
- /**
19
- * An agent for a ticket, over any harness.
20
- *
21
- * Every call runs in the ticket's own checkout, on the branch the tracker
22
- * named, and anything the harness leaves behind is committed and pushed. The
23
- * machine's notion of "implemented" means the work is on the remote, because
24
- * that is what a pull request can be opened against.
25
- */
26
- export declare class HarnessAgent implements Agent {
27
- private readonly harness;
28
- private readonly git;
29
- private readonly config;
30
- constructor(harness: Harness, git: Git, config?: HarnessAgentConfig);
31
- triage(ticket: Ticket): Promise<AgentResult<TriageOutcome>>;
32
- implement(ticket: Ticket, retryContext?: string): Promise<AgentResult<AttemptOutcome>>;
33
- addressThreads(ticket: Ticket, threads: readonly ReviewThread[], from: "automated" | "human"): Promise<AgentResult<ThreadVerdict[]>>;
34
- private threadPrompt;
35
- private ask;
36
- /** The prompt, addressed to a skill when one was named. */
37
- private invoke;
38
- }
39
- //# sourceMappingURL=HarnessAgent.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HarnessAgent.d.ts","sourceRoot":"","sources":["../src/HarnessAgent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,GAAG,EAAE,OAAO,EAAgB,YAAY,EAAE,MAAM,cAAc,CAAC;AACrF,OAAO,EACL,KAAK,EACL,cAAc,EACd,aAAa,EACb,MAAM,EACN,aAAa,EACd,MAAM,+BAA+B,CAAC;AAGvC,MAAM,WAAW,kBAAkB;IACjC;;;;OAIG;IACH,aAAa,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACjD;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAWD;;;;;;;GAOG;AACH,qBAAa,YAAa,YAAW,KAAK;IAEtC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,GAAG;IACpB,OAAO,CAAC,QAAQ,CAAC,MAAM;gBAFN,OAAO,EAAE,OAAO,EAChB,GAAG,EAAE,GAAG,EACR,MAAM,GAAE,kBAAuB;IAG5C,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,aAAa,CAAC,CAAC;IA4C3D,SAAS,CAAC,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC;IAuDtF,cAAc,CAClB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,SAAS,YAAY,EAAE,EAChC,IAAI,EAAE,WAAW,GAAG,OAAO,GAC1B,OAAO,CAAC,WAAW,CAAC,aAAa,EAAE,CAAC,CAAC;IAoCxC,OAAO,CAAC,YAAY;IAoCpB,OAAO,CAAC,GAAG;IAMX,2DAA2D;IAC3D,OAAO,CAAC,MAAM;CAGf"}
@@ -1,161 +0,0 @@
1
- import { extractJson } from "./json.js";
2
- /**
3
- * An agent for a ticket, over any harness.
4
- *
5
- * Every call runs in the ticket's own checkout, on the branch the tracker
6
- * named, and anything the harness leaves behind is committed and pushed. The
7
- * machine's notion of "implemented" means the work is on the remote, because
8
- * that is what a pull request can be opened against.
9
- */
10
- export class HarnessAgent {
11
- harness;
12
- git;
13
- config;
14
- constructor(harness, git, config = {}) {
15
- this.harness = harness;
16
- this.git = git;
17
- this.config = config;
18
- }
19
- async triage(ticket) {
20
- const reply = await this.ask(ticket, [
21
- `You are deciding whether a ticket can be implemented as written.`,
22
- ``,
23
- `Ticket ${ticket.id}: ${ticket.title}`,
24
- `Tracker: ${ticket.url}`,
25
- ``,
26
- `Read the ticket and enough of this repository to judge it. Answer with a`,
27
- `single JSON object and nothing else:`,
28
- ``,
29
- `{"clear": true}`,
30
- ``,
31
- `if you could start implementing right now, or:`,
32
- ``,
33
- `{"clear": false, "questions": ["...", "..."]}`,
34
- ``,
35
- `listing only questions that genuinely block the work. A question you`,
36
- `could answer yourself by reading the code is not a blocking question.`,
37
- ].join("\n"));
38
- // A run that did not complete has no answer to parse, and this returns
39
- // rather than throwing so that a relay above can read the cause and try
40
- // another harness. Throwing here would skip the whole escalation exactly
41
- // when it is needed. Nothing consumes this value: an agent action whose
42
- // run did not complete is failed by the engine.
43
- if (reply.run.outcome !== "completed") {
44
- return { value: { clear: false, questions: [], at: new Date().toISOString() }, run: reply.run };
45
- }
46
- const answer = extractJson(reply.text);
47
- return {
48
- value: {
49
- clear: answer.clear,
50
- questions: answer.clear ? [] : (answer.questions ?? []),
51
- at: new Date().toISOString(),
52
- },
53
- run: reply.run,
54
- };
55
- }
56
- async implement(ticket, retryContext) {
57
- await this.git.prepareBranch(ticket.repo, ticket.branchName);
58
- const reply = await this.ask(ticket, [
59
- `Implement this ticket in the current repository.`,
60
- ``,
61
- `Ticket ${ticket.id}: ${ticket.title}`,
62
- `Tracker: ${ticket.url}`,
63
- ...(retryContext
64
- ? [
65
- ``,
66
- `A previous attempt did not hold. This is what went wrong, verbatim:`,
67
- ``,
68
- retryContext,
69
- ``,
70
- `Fix the underlying cause. Do not discard work that was already correct.`,
71
- ]
72
- : []),
73
- ``,
74
- `Follow the conventions already in this repository. Do not commit: that is`,
75
- `handled for you.`,
76
- ].join("\n"));
77
- const at = new Date().toISOString();
78
- if (reply.run.outcome !== "completed") {
79
- return { value: { ok: false, output: reply.run.output, at }, run: reply.run };
80
- }
81
- const pushed = await this.git.commitAndPush(ticket.repo, ticket.branchName, `${ticket.id}: ${ticket.title}`);
82
- if (!pushed) {
83
- // The harness exited cleanly and changed nothing. For a ticket that
84
- // asked for work, that is a failure worth reporting rather than a
85
- // success, and the account has to agree so a relay can act on it.
86
- return {
87
- value: {
88
- ok: false,
89
- output: `the agent finished without changing any file\n\n${reply.run.output}`,
90
- at,
91
- },
92
- run: { ...reply.run, outcome: "failed" },
93
- };
94
- }
95
- return { value: { ok: true, output: reply.run.output, at }, run: reply.run };
96
- }
97
- async addressThreads(ticket, threads, from) {
98
- await this.git.prepareBranch(ticket.repo, ticket.branchName);
99
- const reply = await this.ask(ticket, this.threadPrompt(ticket, threads, from));
100
- // Returned rather than thrown, for the same reason as in `triage`: the
101
- // relay above decides whether another harness gets a turn, and it needs
102
- // the run to decide. The engine is what fails the action once every
103
- // harness has been tried, so an empty list is never mistaken for "no
104
- // comment needed answering".
105
- if (reply.run.outcome !== "completed") {
106
- return { value: [], run: reply.run };
107
- }
108
- const answer = extractJson(reply.text);
109
- const verdicts = threads.map((thread) => {
110
- const given = answer.verdicts?.find((v) => v.threadId === thread.id);
111
- return {
112
- threadId: thread.id,
113
- // A comment the agent did not answer is not silently dropped. It is
114
- // pushed to the owner, because an unanswered review comment is the
115
- // one thing that must never disappear.
116
- verdict: given?.verdict ?? "disagreed",
117
- note: given?.note ?? "the agent did not answer this comment",
118
- };
119
- });
120
- await this.git.commitAndPush(ticket.repo, ticket.branchName, `${ticket.id}: address review comments`);
121
- return { value: verdicts, run: reply.run };
122
- }
123
- threadPrompt(ticket, threads, from) {
124
- const hints = [
125
- ...new Set(threads
126
- .map((thread) => this.config.reviewerHints?.[thread.author.toLowerCase()])
127
- .filter((hint) => Boolean(hint))),
128
- ];
129
- return [
130
- from === "automated"
131
- ? `An automated reviewer left comments on the pull request for this ticket.`
132
- : `A human reviewer left comments on the pull request for this ticket.`,
133
- ``,
134
- `Ticket ${ticket.id}: ${ticket.title}`,
135
- ``,
136
- `Comments:`,
137
- ...threads.map((thread) => `\n[${thread.id}] ${thread.author} said:\n${thread.body}`),
138
- ...(hints.length ? [``, `Reviewer notes:`, ...hints.map((hint) => `- ${hint}`)] : []),
139
- ``,
140
- `For each comment, either change the code or say why you disagree. Do not`,
141
- `argue on the pull request. Do not commit: that is handled for you.`,
142
- ``,
143
- `Then answer with a single JSON object and nothing else:`,
144
- ``,
145
- `{"verdicts": [{"threadId": "...", "verdict": "fixed", "note": "what you changed"}]}`,
146
- ``,
147
- `Use "disagreed" only when you did not change the code, and say why in the`,
148
- `note. A disagreement goes to the ticket owner to settle, so be specific.`,
149
- ].join("\n");
150
- }
151
- ask(ticket, prompt) {
152
- return this.harness.ask(this.invoke(prompt), this.git.pathFor(ticket.repo), {
153
- workId: ticket.id,
154
- });
155
- }
156
- /** The prompt, addressed to a skill when one was named. */
157
- invoke(prompt) {
158
- return this.config.skill ? `/${this.config.skill}\n\n${prompt}` : prompt;
159
- }
160
- }
161
- //# sourceMappingURL=HarnessAgent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"HarnessAgent.js","sourceRoot":"","sources":["../src/HarnessAgent.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AA2BxC;;;;;;;GAOG;AACH,MAAM,OAAO,YAAY;IAEJ;IACA;IACA;IAHnB,YACmB,OAAgB,EAChB,GAAQ,EACR,SAA6B,EAAE;QAF/B,YAAO,GAAP,OAAO,CAAS;QAChB,QAAG,GAAH,GAAG,CAAK;QACR,WAAM,GAAN,MAAM,CAAyB;IAC/C,CAAC;IAEJ,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,GAAG,CAC1B,MAAM,EACN;YACE,kEAAkE;YAClE,EAAE;YACF,UAAU,MAAM,CAAC,EAAE,KAAK,MAAM,CAAC,KAAK,EAAE;YACtC,YAAY,MAAM,CAAC,GAAG,EAAE;YACxB,EAAE;YACF,0EAA0E;YAC1E,sCAAsC;YACtC,EAAE;YACF,iBAAiB;YACjB,EAAE;YACF,gDAAgD;YAChD,EAAE;YACF,+CAA+C;YAC/C,EAAE;YACF,sEAAsE;YACtE,uEAAuE;SACxE,CAAC,IAAI,CAAC,IAAI,CAAC,CACb,CAAC;QAEF,uEAAuE;QACvE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