@amykit/agent-kit 0.7.1 → 0.9.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/HarnessRelay.d.ts.map +1 -1
- package/dist/HarnessRelay.js +35 -1
- package/dist/HarnessRelay.js.map +1 -1
- package/dist/handoff.d.ts.map +1 -1
- package/dist/handoff.js +3 -1
- package/dist/handoff.js.map +1 -1
- package/dist/harness-conformance.d.ts +23 -0
- package/dist/harness-conformance.d.ts.map +1 -0
- package/dist/harness-conformance.js +66 -0
- package/dist/harness-conformance.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/steps.d.ts +12 -7
- package/dist/steps.d.ts.map +1 -1
- package/dist/steps.js +32 -24
- package/dist/steps.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HarnessRelay.d.ts","sourceRoot":"","sources":["../src/HarnessRelay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,UAAU,EAAkD,MAAM,cAAc,CAAC;AAE1F,OAAO,EAAE,OAAO,EAAuB,MAAM,cAAc,CAAC;AAE5D,mEAAmE;AACnE,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC,CAAC,CAAC;AAEvE,MAAM,WAAW,gBAAiB,SAAQ,UAAU;IAClD,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB;;;;OAIG;IACH,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,GAAG,SAAS,CAAC;CAChD;AAED;;;;;;;;;;;;GAYG;AACH,qBAAa,YAAa,YA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EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,GAAE,UAAe,GAAG,OAAO,CAAC,YAAY,CAAC;IAwBvF;;;;;;OAMG;YACW,KAAK;CA8CpB"}
|
package/dist/HarnessRelay.js
CHANGED
|
@@ -62,12 +62,23 @@ export class HarnessRelay {
|
|
|
62
62
|
// Chosen once per climb rather than per rung: a step that swapped ladders
|
|
63
63
|
// half way up would make "the next rung" mean nothing.
|
|
64
64
|
const ladder = rungsFor(this.ladders, context.step);
|
|
65
|
-
|
|
65
|
+
// A step that has come back from the same origin before is asked of the
|
|
66
|
+
// rung its rounds earned, not of the first one again.
|
|
67
|
+
const begin = Math.min(Math.max(0, Math.trunc(context.rung ?? 0)), ladder.length - 1);
|
|
68
|
+
let index = begin;
|
|
66
69
|
let handoff;
|
|
67
70
|
let last = null;
|
|
68
71
|
const handed = withSkill(context, skill, this.deps.locate);
|
|
69
72
|
while (index < ladder.length) {
|
|
70
73
|
const rung = ladder[index];
|
|
74
|
+
// A skill turn is never sent to a rung that cannot be handed the skill:
|
|
75
|
+
// `/name` without the directory behind it is a method the run cannot
|
|
76
|
+
// follow. The boot refuses a configured ladder that could reach one;
|
|
77
|
+
// this is the same rule at the moment of asking, for a plugin that
|
|
78
|
+
// declared nothing.
|
|
79
|
+
if (skill && (handed.skill === undefined || rung.cli.lendsSkill !== true)) {
|
|
80
|
+
return cannotLend(rung, skill, handed.skill === undefined);
|
|
81
|
+
}
|
|
71
82
|
last = await rung.cli.ask(asked(prompt, skill, handoff), cwd, handed);
|
|
72
83
|
// The caller says whether a completed run holds while there is still a
|
|
73
84
|
// rung to climb to, rather than after the ladder has stopped.
|
|
@@ -94,6 +105,29 @@ function asked(prompt, skill, handoff) {
|
|
|
94
105
|
const body = handoff ? `${prompt}\n\n${handoff}` : prompt;
|
|
95
106
|
return skill ? `/${skill}\n\n${body}` : body;
|
|
96
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* What a rung that cannot be handed the skill gets instead of the turn.
|
|
110
|
+
*
|
|
111
|
+
* A run that cannot follow the method is refused before it starts; sending it
|
|
112
|
+
* bare would look like work while proving nothing. The output says which rung
|
|
113
|
+
* and which of the two reasons, so the fix is the ladder or the install.
|
|
114
|
+
*/
|
|
115
|
+
function cannotLend(rung, skill, missing) {
|
|
116
|
+
const why = missing
|
|
117
|
+
? `the directory holding /${skill} was not found`
|
|
118
|
+
: `${rung.name} does not lend a skill`;
|
|
119
|
+
return {
|
|
120
|
+
text: "",
|
|
121
|
+
run: {
|
|
122
|
+
outcome: "failed",
|
|
123
|
+
harness: rung.harness,
|
|
124
|
+
model: rung.model,
|
|
125
|
+
durationMs: 0,
|
|
126
|
+
costSource: "unknown",
|
|
127
|
+
output: `${rung.name} was not asked /${skill}: ${why}, so the turn would act without the method.`,
|
|
128
|
+
},
|
|
129
|
+
};
|
|
130
|
+
}
|
|
97
131
|
/**
|
|
98
132
|
* The context a rung is asked with: the caller's, plus the skill the prompt
|
|
99
133
|
* is addressed to and where it lives, when the relay knows.
|
package/dist/HarnessRelay.js.map
CHANGED
|
@@ -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;AAe5D;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,YAAY;IAIJ;IACA;IAJV,IAAI,GAAG,OAAO,CAAC;IAExB,YACmB,OAA8B,EAC9B,OAAyB,EAAE;QAD3B,YAAO,GAAP,OAAO,CAAuB;QAC9B,SAAI,GAAJ,IAAI,CAAuB;QAE5C,IAAI,SAAS,CAAC,OAAO,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACpC,MAAM,I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AE,KAAK,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC;AAChF,CAAC;AAED,kEAAkE;AAClE,SAAS,IAAI,CAAC,OAAmB;IAC/B,OAAO,OAAO,CAAC,IAAI,IAAI,KAAK,CAAC;AAC/B,CAAC"}
|
package/dist/handoff.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,MAAM,WAAW,UAAU;IACzB,GAAG,CAAC,EAAE,QAAQ,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,IAAI,CAAC;CAClB;AAED;;;;;;;GAOG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,QAAQ,GAAG,MAAM,CAc7D;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAC3B,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,IAAI,EACV,EAAE,EAAE,IAAI,EACR,GAAG,EAAE,QAAQ,GACZ,IAAI,CASN;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,MAAM,EAAE,MAAM,GAAG,SAAS,EAC1B,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,EACV,GAAG,EAAE,QAAQ,GACZ,IAAI,CAQN"}
|
package/dist/handoff.js
CHANGED
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
export function handoffNote(from, run) {
|
|
10
10
|
const because = run.outcome === "rate-limited"
|
|
11
11
|
? `ran out of quota partway through`
|
|
12
|
-
:
|
|
12
|
+
: run.refused
|
|
13
|
+
? `answered, and that answer was refused: ${run.refused}`
|
|
14
|
+
: `did not succeed`;
|
|
13
15
|
return [
|
|
14
16
|
`A previous attempt by ${from.harness} (${from.model}) ${because}.`,
|
|
15
17
|
`The working tree is exactly as it left it, so this may be half-done work`,
|
package/dist/handoff.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAU,EAAE,GAAa;IACnD,MAAM,OAAO,GACX,GAAG,CAAC,OAAO,KAAK,cAAc;QAC5B,CAAC,CAAC,kCAAkC;QACpC,CAAC,CAAC,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../src/handoff.ts"],"names":[],"mappings":"AAQA;;;;;;;GAOG;AACH,MAAM,UAAU,WAAW,CAAC,IAAU,EAAE,GAAa;IACnD,MAAM,OAAO,GACX,GAAG,CAAC,OAAO,KAAK,cAAc;QAC5B,CAAC,CAAC,kCAAkC;QACpC,CAAC,CAAC,GAAG,CAAC,OAAO;YACX,CAAC,CAAC,0CAA0C,GAAG,CAAC,OAAO,EAAE;YACzD,CAAC,CAAC,iBAAiB,CAAC;IAE1B,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,IAAgB,EAAE,MAA0B,EAAE,MAA+B;IAC3F,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QACf,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC,WAAW,EAAE;QACpD,IAAI,EAAE,eAAe;QACrB,GAAG,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC;QAC3C,MAAM;KACP,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Harness } from "@amykit/core";
|
|
2
|
+
/** What one run was handed, as its own CLI reads what reached it. */
|
|
3
|
+
export type Granted = "write" | "read-only" | "nothing";
|
|
4
|
+
/**
|
|
5
|
+
* A harness over a seam its test watches. Only the harness's own test knows
|
|
6
|
+
* how its CLI spells writing, so it says what the last run was handed.
|
|
7
|
+
*/
|
|
8
|
+
export interface HarnessUnderTest {
|
|
9
|
+
readonly harness: Harness;
|
|
10
|
+
granted(): Granted;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Asks a harness for one writing run and one read-only run, and says what
|
|
14
|
+
* each was handed that it should not have been. Empty when it conforms.
|
|
15
|
+
*
|
|
16
|
+
* A writing run with no way to write answers and changes nothing, which a
|
|
17
|
+
* step reads as done; a read-only run that may write is a discussion that
|
|
18
|
+
* edits the work. Both look like success from outside. A skill turn is the
|
|
19
|
+
* same shape: a harness that did not declare `lendsSkill` and answers one
|
|
20
|
+
* anyway has acted without the method it was addressed to.
|
|
21
|
+
*/
|
|
22
|
+
export declare function harnessConformance(make: () => HarnessUnderTest): Promise<string[]>;
|
|
23
|
+
//# sourceMappingURL=harness-conformance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"harness-conformance.d.ts","sourceRoot":"","sources":["../src/harness-conformance.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEvC,qEAAqE;AACrE,MAAM,MAAM,OAAO,GAAG,OAAO,GAAG,WAAW,GAAG,SAAS,CAAC;AAExD;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,OAAO,IAAI,OAAO,CAAC;CACpB;AAED;;;;;;;;;GASG;AACH,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,gBAAgB,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAUxF"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import os from "node:os";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
/**
|
|
5
|
+
* Asks a harness for one writing run and one read-only run, and says what
|
|
6
|
+
* each was handed that it should not have been. Empty when it conforms.
|
|
7
|
+
*
|
|
8
|
+
* A writing run with no way to write answers and changes nothing, which a
|
|
9
|
+
* step reads as done; a read-only run that may write is a discussion that
|
|
10
|
+
* edits the work. Both look like success from outside. A skill turn is the
|
|
11
|
+
* same shape: a harness that did not declare `lendsSkill` and answers one
|
|
12
|
+
* anyway has acted without the method it was addressed to.
|
|
13
|
+
*/
|
|
14
|
+
export async function harnessConformance(make) {
|
|
15
|
+
const findings = [];
|
|
16
|
+
const writing = await granted(make(), false, findings);
|
|
17
|
+
if (writing !== undefined && writing !== "write") {
|
|
18
|
+
findings.push(`a writing run is handed ${writing === "nothing" ? "no way to write" : "only a way to read"}`);
|
|
19
|
+
}
|
|
20
|
+
const reading = await granted(make(), true, findings);
|
|
21
|
+
if (reading === "write")
|
|
22
|
+
findings.push("a read-only run is handed a way to write");
|
|
23
|
+
await aSkillTurn(make(), findings);
|
|
24
|
+
return findings;
|
|
25
|
+
}
|
|
26
|
+
async function granted(probe, readOnly, findings) {
|
|
27
|
+
try {
|
|
28
|
+
// A directory that exists: a harness that spawns its CLI runs it there.
|
|
29
|
+
await probe.harness.ask(readOnly ? "why did it fail?" : "change it", os.tmpdir(), readOnly ? { readOnly } : {});
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
findings.push(`a ${readOnly ? "read-only" : "writing"} run threw: ${error instanceof Error ? error.message : String(error)}`);
|
|
33
|
+
return undefined;
|
|
34
|
+
}
|
|
35
|
+
return probe.granted();
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Asks for a turn addressed to a skill, on a harness that says it cannot be
|
|
39
|
+
* handed one.
|
|
40
|
+
*
|
|
41
|
+
* The relay refuses to send `/name` to such a rung, so the only way a harness
|
|
42
|
+
* can see this turn is if a caller went around the relay. Answering it is the
|
|
43
|
+
* failure: the run followed no method and looks completed anyway. Refusing,
|
|
44
|
+
* by a failed run or a throw, is what a harness that declared nothing owes.
|
|
45
|
+
*/
|
|
46
|
+
async function aSkillTurn(probe, findings) {
|
|
47
|
+
if (probe.harness.lendsSkill === true)
|
|
48
|
+
return;
|
|
49
|
+
const root = fs.mkdtempSync(path.join(os.tmpdir(), "amy-conformance-skill-"));
|
|
50
|
+
const directory = path.join(root, "amy-groom");
|
|
51
|
+
fs.mkdirSync(directory);
|
|
52
|
+
fs.writeFileSync(path.join(directory, "SKILL.md"), "# amy-groom\n");
|
|
53
|
+
try {
|
|
54
|
+
const reply = await probe.harness.ask("change it", os.tmpdir(), { skill: { name: "amy-groom", path: directory } });
|
|
55
|
+
if (reply.run.outcome !== "failed" && reply.run.outcome !== "abandoned") {
|
|
56
|
+
findings.push("a skill turn was answered by a harness that does not lend the skill");
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// A harness that refuses by throwing has refused.
|
|
61
|
+
}
|
|
62
|
+
finally {
|
|
63
|
+
fs.rmSync(root, { recursive: true, force: true });
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=harness-conformance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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;YAAS,CAAC;QACT,EAAE,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACpD,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -15,4 +15,6 @@ export { contributeTiers, tierName } from "./tiers.js";
|
|
|
15
15
|
export type { TierOptions } from "./tiers.js";
|
|
16
16
|
export { contributeUsage, USAGE_COLLECTION } from "./usage.js";
|
|
17
17
|
export type { UsageAvailable, UsageReader, UsageResult, UsageUnavailable, UsageWindow } from "./usage.js";
|
|
18
|
+
export { harnessConformance } from "./harness-conformance.js";
|
|
19
|
+
export type { Granted, HarnessUnderTest } from "./harness-conformance.js";
|
|
18
20
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -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,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,C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O,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACvD,YAAY,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAC/D,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,WAAW,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1G,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,YAAY,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -7,4 +7,5 @@ export { nextRung } from "./ladder.js";
|
|
|
7
7
|
export { everyRung, oneLadder, rungsFor } from "./ladders.js";
|
|
8
8
|
export { contributeTiers, tierName } from "./tiers.js";
|
|
9
9
|
export { contributeUsage, USAGE_COLLECTION } from "./usage.js";
|
|
10
|
+
export { harnessConformance } from "./harness-conformance.js";
|
|
10
11
|
//# sourceMappingURL=index.js.map
|
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,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;AAEvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,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;AAEvD,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE/D,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/steps.d.ts
CHANGED
|
@@ -21,13 +21,14 @@ export interface ImplementInput extends StepInput {
|
|
|
21
21
|
/**
|
|
22
22
|
* Asks for a change, commits it through the caller, and says whether it moved.
|
|
23
23
|
*
|
|
24
|
-
* The commit
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
*
|
|
29
|
-
* that
|
|
30
|
-
*
|
|
24
|
+
* The commit is the step's business and not a verdict: it runs for the rung
|
|
25
|
+
* that comes back, and what it says is the account of whether the attempt
|
|
26
|
+
* moved anything. A run that ended without changing a file is still an
|
|
27
|
+
* answer, with `unchanged` progress and the agent's own words as the reason,
|
|
28
|
+
* so a retry policy can tell work that added nothing from work that failed. A
|
|
29
|
+
* step that declared a `verify` of its own keeps it, and that one alone
|
|
30
|
+
* decides whether the relay climbs. A run that did not complete is returned
|
|
31
|
+
* rather than thrown, with its account.
|
|
31
32
|
*/
|
|
32
33
|
export declare function implementStep(agent: Agent, input: ImplementInput): Promise<AgentResult<AttemptOutcome>>;
|
|
33
34
|
export interface JudgeInput<T> extends StepInput {
|
|
@@ -41,6 +42,10 @@ export interface JudgeInput<T> extends StepInput {
|
|
|
41
42
|
*
|
|
42
43
|
* A run that did not complete yields the caller's fallback with the run's
|
|
43
44
|
* account, for the same reason `implementStep` returns rather than throws.
|
|
45
|
+
* An answer with no object in it, or one the caller's reader refuses, is the
|
|
46
|
+
* action's failure: the reply is read and the error it raises is the answer,
|
|
47
|
+
* so a reader's own words reach the operator and no stronger rung is bought
|
|
48
|
+
* for a shape this one already gave.
|
|
44
49
|
*/
|
|
45
50
|
export declare function judgeStep<T>(agent: Agent, input: JudgeInput<T>): Promise<AgentResult<T>>;
|
|
46
51
|
//# sourceMappingURL=steps.d.ts.map
|
package/dist/steps.d.ts.map
CHANGED
|
@@ -1 +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;
|
|
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;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,aAAa,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,cAAc,CAAC,CAAC,CA+B7G;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;;;;;;;;;GASG;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
CHANGED
|
@@ -1,48 +1,56 @@
|
|
|
1
1
|
import { extractJson } from "./json.js";
|
|
2
|
-
const NO_CHANGE = "the agent finished without changing any file";
|
|
3
2
|
/**
|
|
4
3
|
* Asks for a change, commits it through the caller, and says whether it moved.
|
|
5
4
|
*
|
|
6
|
-
* The commit
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* that
|
|
12
|
-
*
|
|
5
|
+
* The commit is the step's business and not a verdict: it runs for the rung
|
|
6
|
+
* that comes back, and what it says is the account of whether the attempt
|
|
7
|
+
* moved anything. A run that ended without changing a file is still an
|
|
8
|
+
* answer, with `unchanged` progress and the agent's own words as the reason,
|
|
9
|
+
* so a retry policy can tell work that added nothing from work that failed. A
|
|
10
|
+
* step that declared a `verify` of its own keeps it, and that one alone
|
|
11
|
+
* decides whether the relay climbs. A run that did not complete is returned
|
|
12
|
+
* rather than thrown, with its account.
|
|
13
13
|
*/
|
|
14
14
|
export async function implementStep(agent, input) {
|
|
15
|
-
// The
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
|
|
15
|
+
// The commit is the step's business, not a verdict: it runs once for every
|
|
16
|
+
// rung that comes back, and what it says about the last one is the whole
|
|
17
|
+
// account of whether this attempt moved anything. A step that declared a
|
|
18
|
+
// verify of its own keeps it: that one, and only that one, decides a climb.
|
|
19
|
+
let changed = false;
|
|
20
|
+
let asked = false;
|
|
21
|
+
const declares = input.context?.verify;
|
|
19
22
|
const verify = async (reply) => {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
return verdict;
|
|
23
|
+
asked = true;
|
|
24
|
+
changed = await input.commit();
|
|
25
|
+
return declares ? declares(reply) : reply;
|
|
24
26
|
};
|
|
25
27
|
let reply = await agent.ask(input.prompt, input.cwd, { ...input.context, verify });
|
|
26
|
-
|
|
28
|
+
// An agent that never calls `verify`, as one harness on its own does, still
|
|
29
|
+
// has its work committed and weighed once.
|
|
30
|
+
if (!asked && reply.run.outcome === "completed")
|
|
27
31
|
reply = await verify(reply);
|
|
28
32
|
const at = (input.now ?? (() => new Date()))().toISOString();
|
|
29
33
|
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
34
|
if (reply.run.outcome !== "completed") {
|
|
37
35
|
return { value: { ok: false, output: reply.run.output, at }, run: reply.run };
|
|
38
36
|
}
|
|
39
|
-
|
|
37
|
+
// A run that ended without changing a file is an answer, on the rung that
|
|
38
|
+
// gave it. The agent's own words are the reason, because a stronger model
|
|
39
|
+
// does not know something this one did not.
|
|
40
|
+
const progress = changed
|
|
41
|
+
? { kind: "advanced", key }
|
|
42
|
+
: { kind: "unchanged", key, detail: reply.text };
|
|
43
|
+
return { value: { ok: true, output: reply.run.output, at, progress }, run: reply.run };
|
|
40
44
|
}
|
|
41
45
|
/**
|
|
42
46
|
* Asks a question whose answer is one JSON object, and reads it.
|
|
43
47
|
*
|
|
44
48
|
* A run that did not complete yields the caller's fallback with the run's
|
|
45
49
|
* account, for the same reason `implementStep` returns rather than throws.
|
|
50
|
+
* An answer with no object in it, or one the caller's reader refuses, is the
|
|
51
|
+
* action's failure: the reply is read and the error it raises is the answer,
|
|
52
|
+
* so a reader's own words reach the operator and no stronger rung is bought
|
|
53
|
+
* for a shape this one already gave.
|
|
46
54
|
*/
|
|
47
55
|
export async function judgeStep(agent, input) {
|
|
48
56
|
const reply = await agent.ask(input.prompt, input.cwd, input.context);
|
package/dist/steps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAuBxC
|
|
1
|
+
{"version":3,"file":"steps.js","sourceRoot":"","sources":["../src/steps.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAuBxC;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAY,EAAE,KAAqB;IACrE,2EAA2E;IAC3E,yEAAyE;IACzE,yEAAyE;IACzE,4EAA4E;IAC5E,IAAI,OAAO,GAAG,KAAK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AI,EAAE,UAAU,EAAE,GAAG,EAAY;QACtC,CAAC,CAAE,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,CAAC,IAAI,EAAY,CAAC;IAC9D,OAAO,EAAE,KAAK,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,GAAG,EAAE,KAAK,CAAC,GAAG,EAAE,CAAC;AACzF,CAAC;AASD;;;;;;;;;GASG;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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@amykit/agent-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
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",
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
"dist"
|
|
29
29
|
],
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@amykit/core": "^0.
|
|
31
|
+
"@amykit/core": "^0.9.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
34
|
"@amykit/test-fixtures": "^0.1.0"
|