@neonwatty/limner 0.1.6 → 0.1.7
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 +27 -1
- package/dist/commands/compare-output.js +1 -0
- package/dist/commands/compare-output.js.map +1 -1
- package/dist/commands/ledger.d.ts +3 -1
- package/dist/commands/loop-actions.d.ts +22 -0
- package/dist/commands/loop-actions.js +54 -0
- package/dist/commands/loop-actions.js.map +1 -0
- package/dist/commands/loop-cli.js +96 -2
- package/dist/commands/loop-cli.js.map +1 -1
- package/dist/commands/loop-task.d.ts +17 -0
- package/dist/commands/loop-task.js +95 -0
- package/dist/commands/loop-task.js.map +1 -0
- package/dist/commands/loop.d.ts +3 -1
- package/dist/commands/loop.js +23 -21
- package/dist/commands/loop.js.map +1 -1
- package/dist/core/agent-comparison-pack.d.ts +13 -0
- package/dist/core/agent-comparison-pack.js +27 -21
- package/dist/core/agent-comparison-pack.js.map +1 -1
- package/dist/core/agent-comparison-response.d.ts +19 -0
- package/dist/core/agent-comparison-response.js +34 -0
- package/dist/core/agent-comparison-response.js.map +1 -0
- package/dist/core/agent-task-brief.d.ts +30 -0
- package/dist/core/agent-task-brief.js +158 -0
- package/dist/core/agent-task-brief.js.map +1 -0
- package/dist/core/comparison-artifacts.js +17 -3
- package/dist/core/comparison-artifacts.js.map +1 -1
- package/dist/core/current-artifacts.d.ts +14 -0
- package/dist/core/current-artifacts.js +16 -0
- package/dist/core/current-artifacts.js.map +1 -0
- package/dist/core/ledger-agent-responses.d.ts +21 -0
- package/dist/core/ledger-agent-responses.js +13 -0
- package/dist/core/ledger-agent-responses.js.map +1 -0
- package/dist/core/ledger-db.js +18 -0
- package/dist/core/ledger-db.js.map +1 -1
- package/dist/core/ledger-events.js +21 -1
- package/dist/core/ledger-events.js.map +1 -1
- package/dist/core/ledger-markdown.d.ts +21 -6
- package/dist/core/ledger-markdown.js +89 -6
- package/dist/core/ledger-markdown.js.map +1 -1
- package/dist/core/ledger-queries.d.ts +4 -1
- package/dist/core/ledger-queries.js +11 -3
- package/dist/core/ledger-queries.js.map +1 -1
- package/dist/core/ledger-store.d.ts +8 -1
- package/dist/core/ledger-store.js +4 -0
- package/dist/core/ledger-store.js.map +1 -1
- package/dist/core/loop-rerun-command.d.ts +4 -0
- package/dist/core/loop-rerun-command.js +36 -0
- package/dist/core/loop-rerun-command.js.map +1 -0
- package/dist/schemas/ledger.d.ts +23 -0
- package/dist/schemas/ledger.js +4 -0
- package/dist/schemas/ledger.js.map +1 -1
- package/docs/agent-workflow.md +31 -1
- package/docs/superpowers/plans/2026-06-13-agent-response-sqlite.md +70 -0
- package/docs/superpowers/plans/2026-06-13-loop-action-ledger.md +257 -0
- package/package.json +1 -1
- package/skills/limner/SKILL.md +15 -4
package/README.md
CHANGED
|
@@ -56,6 +56,9 @@ limner preview --target replay-boundaries
|
|
|
56
56
|
limner capture reference --target replay-boundaries
|
|
57
57
|
limner loop start --mode image-mockup --target replay-boundaries --name replay-boundaries-polish --max-iterations 5
|
|
58
58
|
limner loop compare --trajectory traj_...
|
|
59
|
+
limner loop task --trajectory traj_... --executor subagent
|
|
60
|
+
limner loop action start --trajectory traj_... --from-run run_... --kind polish --executor subagent --summary "Resize dashboard preview"
|
|
61
|
+
limner loop action complete --trajectory traj_... --action act_... --executor subagent --summary "Adjusted preview sizing" --files "src/app/page.tsx"
|
|
59
62
|
limner loop status --trajectory traj_...
|
|
60
63
|
limner compare image-reference --target replay-boundaries
|
|
61
64
|
limner compare reference-implementation --target replay-boundaries --url http://localhost:3152/internal/optimization-lab/wedding-envelope#replay-boundaries --storage-state ./e2e/.auth/user.json
|
|
@@ -92,6 +95,10 @@ Use `limner loop` for Ralph Loop-style polishing. Loop work is tracked in a glob
|
|
|
92
95
|
```bash
|
|
93
96
|
limner loop start --mode image-mockup --target replay-boundaries --name replay-boundaries-polish --max-iterations 5
|
|
94
97
|
limner loop compare --trajectory traj_...
|
|
98
|
+
limner loop task --trajectory traj_... --executor subagent
|
|
99
|
+
limner loop action start --trajectory traj_... --from-run run_... --kind polish --executor subagent --summary "Resize dashboard preview"
|
|
100
|
+
limner loop action complete --trajectory traj_... --action act_... --executor subagent --summary "Adjusted preview sizing" --files "src/app/page.tsx"
|
|
101
|
+
limner loop action skip --trajectory traj_... --from-run run_... --summary "Comparison smoke only; no edit intended"
|
|
95
102
|
limner loop status --trajectory traj_... --feedback "Prompt should mention button contrast."
|
|
96
103
|
limner loop next --trajectory traj_...
|
|
97
104
|
limner loop close --trajectory traj_...
|
|
@@ -103,7 +110,17 @@ Loop modes:
|
|
|
103
110
|
- `mockup-implementation`: approved mockup to real implementation.
|
|
104
111
|
- `image-implementation`: source image directly to real implementation.
|
|
105
112
|
|
|
106
|
-
Every meaningful loop interaction writes a ledger event. `agentFeedback` is an optional 255-character field for short process-improvement notes; longer comments belong in notes or project artifacts.
|
|
113
|
+
Every meaningful loop interaction writes a ledger event. Validated, missing, invalid, and stale agent responses are also stored in local SQLite with the full JSON body, response hash, validation status, and freshness (`missing`, `cached`, `stale`, `invalid`, or future `fresh`). `agentFeedback` is an optional 255-character field for short process-improvement notes; longer comments belong in notes or project artifacts.
|
|
114
|
+
|
|
115
|
+
### Action Logging
|
|
116
|
+
|
|
117
|
+
After an agent writes `agent-response.json` and `loop compare` validates it, use `limner loop task --trajectory traj_... --executor subagent` to print the next edit brief. The intended loop is:
|
|
118
|
+
|
|
119
|
+
```text
|
|
120
|
+
loop compare -> loop task --executor subagent -> loop action start -> edit -> loop action complete -> loop compare
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
The task brief names likely files, selectors, prioritized diffs, next steps, action logging commands, and the compare command to rerun. Record `loop action start` before edits and `loop action complete` after edits; keep `--summary` under 255 characters. Use `loop action skip` for comparison-only smoke runs where no edit is intended. Limner records executor intent and action claims; it cannot prove an external orchestrator actually used a subagent. Use `--format json` when another tool needs machine-readable handoff data.
|
|
107
124
|
|
|
108
125
|
Use `limner ledger` to query and export trajectories:
|
|
109
126
|
|
|
@@ -116,6 +133,15 @@ limner ledger export traj_... --format json
|
|
|
116
133
|
limner ledger export traj_... --format markdown
|
|
117
134
|
```
|
|
118
135
|
|
|
136
|
+
Agents can discover the current CLI surface with:
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
limner --help
|
|
140
|
+
limner loop --help
|
|
141
|
+
limner loop task --help
|
|
142
|
+
limner ledger --help
|
|
143
|
+
```
|
|
144
|
+
|
|
119
145
|
### Image To Reference
|
|
120
146
|
|
|
121
147
|
Use this while recreating the ideal image as a standalone HTML/CSS mockup. This mode uses the `ideal-to-mockup` agent comparison profile.
|
|
@@ -6,6 +6,7 @@ export function printAgentComparison(agentComparison) {
|
|
|
6
6
|
console.log(`Claude comparison prompt: ${agentComparison.claudePromptPath}`);
|
|
7
7
|
console.log(`Agent comparison schema: ${agentComparison.schemaPath}`);
|
|
8
8
|
console.log(`Agent comparison response target: ${agentComparison.responsePath}`);
|
|
9
|
+
console.log(`Agent response freshness: ${agentComparison.freshness}`);
|
|
9
10
|
if (agentComparison.status === 'validated') {
|
|
10
11
|
console.log(`Image comparison: ${agentComparison.imageComparisonPath}`);
|
|
11
12
|
if (agentComparison.structureComparisonPath)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compare-output.js","sourceRoot":"","sources":["../../src/commands/compare-output.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,oBAAoB,CAAC,eAA2C;IAC9E,IAAI,CAAC,eAAe;QAAE,OAAO;IAC7B,OAAO,CAAC,GAAG,CAAC,4BAA4B,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,4BAA4B,eAAe,CAAC,eAAe,EAAE,CAAC,CAAC;IAC3E,OAAO,CAAC,GAAG,CAAC,6BAA6B,eAAe,CAAC,gBAAgB,EAAE,CAAC,CAAC;IAC7E,OAAO,CAAC,GAAG,CAAC,4BAA4B,eAAe,CAAC,UAAU,EAAE,CAAC,CAAC;IACtE,O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,EAAE,CAAC,CAAC;QACxE,IAAI,eAAe,CAAC,uBAAuB;YAAE,OAAO,CAAC,GAAG,CAAC,yBAAyB,eAAe,CAAC,uBAAuB,EAAE,CAAC,CAAC;QAC7H,OAAO,CAAC,GAAG,CAAC,uBAAuB,eAAe,CAAC,WAAW,EAAE,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,4BAA4B,eAAe,CAAC,MAAM,EAAE,CAAC,CAAC;IACpE,CAAC;AACH,CAAC"}
|
|
@@ -26,7 +26,9 @@ export declare function showLedger(input: {
|
|
|
26
26
|
runs: unknown[];
|
|
27
27
|
instructionVersions: unknown[];
|
|
28
28
|
notes: unknown[];
|
|
29
|
-
|
|
29
|
+
agentResponses: unknown[];
|
|
30
|
+
artifacts: import("../core/current-artifacts.js").LedgerArtifactRow[];
|
|
31
|
+
currentArtifacts: import("../core/current-artifacts.js").CurrentArtifacts;
|
|
30
32
|
};
|
|
31
33
|
};
|
|
32
34
|
export declare function getLedgerNext(input: {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type LedgerActionExecutor, type LedgerActionKind, type LedgerActionStatus, type LedgerMode } from '../schemas/ledger.js';
|
|
2
|
+
type LedgerEnv = Partial<Pick<NodeJS.ProcessEnv, 'LIMNER_LEDGER_HOME'>>;
|
|
3
|
+
type TrajectorySelector = {
|
|
4
|
+
ledgerEnv?: LedgerEnv;
|
|
5
|
+
trajectoryId?: string;
|
|
6
|
+
target?: string;
|
|
7
|
+
mode?: LedgerMode;
|
|
8
|
+
};
|
|
9
|
+
export type LoopActionInput = TrajectorySelector & {
|
|
10
|
+
status: LedgerActionStatus;
|
|
11
|
+
kind: LedgerActionKind;
|
|
12
|
+
executor: LedgerActionExecutor;
|
|
13
|
+
summary: string;
|
|
14
|
+
actionId?: string;
|
|
15
|
+
fromRunId?: string;
|
|
16
|
+
files?: string[];
|
|
17
|
+
commit?: string;
|
|
18
|
+
};
|
|
19
|
+
export declare function recordLoopAction(input: LoopActionInput): {
|
|
20
|
+
actionId: string;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { ledgerActionExecutorSchema, ledgerActionKindSchema, ledgerActionStatusSchema, ledgerActionSummarySchema } from '../schemas/ledger.js';
|
|
2
|
+
import { openLedgerDatabase } from '../core/ledger-db.js';
|
|
3
|
+
import { createLedgerId } from '../core/ledger-ids.js';
|
|
4
|
+
import { resolveLedgerPaths } from '../core/ledger-paths.js';
|
|
5
|
+
import { createLedgerStore } from '../core/ledger-store.js';
|
|
6
|
+
export function recordLoopAction(input) {
|
|
7
|
+
return withStore(input.ledgerEnv, (store) => {
|
|
8
|
+
const trajectory = store.resolveTrajectory(selector(input));
|
|
9
|
+
const status = ledgerActionStatusSchema.parse(input.status);
|
|
10
|
+
const kind = ledgerActionKindSchema.parse(input.kind);
|
|
11
|
+
const executor = ledgerActionExecutorSchema.parse(input.executor);
|
|
12
|
+
const summary = ledgerActionSummarySchema.parse(input.summary);
|
|
13
|
+
const actionId = input.actionId ?? createLedgerId('act');
|
|
14
|
+
store.appendEvent({
|
|
15
|
+
trajectoryId: trajectory.trajectoryId,
|
|
16
|
+
iterationId: trajectory.activeIterationId ?? undefined,
|
|
17
|
+
eventType: `loop.action.${status}`,
|
|
18
|
+
actor: actionActor(executor),
|
|
19
|
+
command: 'loop action',
|
|
20
|
+
resultStatus: status,
|
|
21
|
+
inputsSummary: JSON.stringify({
|
|
22
|
+
actionId,
|
|
23
|
+
kind,
|
|
24
|
+
executor,
|
|
25
|
+
fromRunId: input.fromRunId,
|
|
26
|
+
summary,
|
|
27
|
+
files: input.files,
|
|
28
|
+
commit: input.commit,
|
|
29
|
+
}),
|
|
30
|
+
artifactRefs: (input.files ?? []).map((file) => ({ path: file, kind: 'edited-file', role: 'artifact' })),
|
|
31
|
+
});
|
|
32
|
+
return { actionId };
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function withStore(env, callback) {
|
|
36
|
+
const db = openLedgerDatabase({ databasePath: resolveLedgerPaths(env).databasePath });
|
|
37
|
+
try {
|
|
38
|
+
return callback(createLedgerStore(db));
|
|
39
|
+
}
|
|
40
|
+
finally {
|
|
41
|
+
db.close();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
function selector(input) {
|
|
45
|
+
return { trajectoryId: input.trajectoryId, target: input.target, mode: input.mode };
|
|
46
|
+
}
|
|
47
|
+
function actionActor(executor) {
|
|
48
|
+
if (executor === 'user')
|
|
49
|
+
return 'user';
|
|
50
|
+
if (executor === 'cli')
|
|
51
|
+
return 'cli';
|
|
52
|
+
return 'agent';
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=loop-actions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-actions.js","sourceRoot":"","sources":["../../src/commands/loop-actions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,0BAA0B,EAAE,sBAAsB,EAAE,wBAAwB,EAAE,yBAAyB,EAAqH,MAAM,sBAAsB,CAAC;AAClQ,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAA+B,MAAM,yBAAyB,CAAC;AAMzF,MAAM,UAAU,gBAAgB,CAAC,KAAsB;IACrD,OAAO,SAAS,CAAC,KAAK,CAAC,SAAS,EAAE,CAAC,KAAK,EAAE,EAAE;QAC1C,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC;QAC5D,MAAM,MAAM,GAAG,wBAAwB,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC5D,MAAM,IAAI,GAAG,sBAAsB,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI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AAE,CAAC,CAAC,CAAC;IACzC,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC;AAED,SAAS,QAAQ,CAAC,KAAyB;IACzC,OAAO,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACtF,CAAC;AAED,SAAS,WAAW,CAAC,QAA8B;IACjD,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,MAAM,CAAC;IACvC,IAAI,QAAQ,KAAK,KAAK;QAAE,OAAO,KAAK,CAAC;IACrC,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { advanceLoop, closeLoop, compareLoop, getLoopStatus, startLoop } from './loop.js';
|
|
1
|
+
import { advanceLoop, closeLoop, compareLoop, getLoopStatus, getLoopTask, recordLoopAction, startLoop } from './loop.js';
|
|
2
2
|
export function registerLoopCommand(program) {
|
|
3
3
|
const loop = program.command('loop').description('Manage Limner comparison loops');
|
|
4
4
|
loop
|
|
@@ -64,8 +64,102 @@ export function registerLoopCommand(program) {
|
|
|
64
64
|
console.log(`Side-by-side: ${result.sideBySidePath}`);
|
|
65
65
|
if (result.reportPath)
|
|
66
66
|
console.log(`Report: ${result.reportPath}`);
|
|
67
|
-
if (result.agentComparison)
|
|
67
|
+
if (result.agentComparison) {
|
|
68
68
|
console.log(`Agent comparison status: ${result.agentComparison.status}`);
|
|
69
|
+
console.log(`Agent response freshness: ${result.agentComparison.freshness}`);
|
|
70
|
+
}
|
|
69
71
|
});
|
|
72
|
+
loop
|
|
73
|
+
.command('task')
|
|
74
|
+
.description('Print an agent-ready task brief from the latest validated comparison')
|
|
75
|
+
.option('--trajectory <id>', 'trajectory id')
|
|
76
|
+
.option('-t, --target <name>', 'target name')
|
|
77
|
+
.option('--mode <mode>', 'loop mode')
|
|
78
|
+
.option('--format <format>', 'output format', 'markdown')
|
|
79
|
+
.option('--executor <executor>', 'desired action executor', 'subagent')
|
|
80
|
+
.action(async (options, command) => {
|
|
81
|
+
const globals = command.optsWithGlobals();
|
|
82
|
+
const result = await getLoopTask({
|
|
83
|
+
workspaceRoot: globals.workspace,
|
|
84
|
+
trajectoryId: options.trajectory,
|
|
85
|
+
target: options.target,
|
|
86
|
+
mode: options.mode,
|
|
87
|
+
format: options.format,
|
|
88
|
+
executor: options.executor,
|
|
89
|
+
});
|
|
90
|
+
process.stdout.write(result.output);
|
|
91
|
+
});
|
|
92
|
+
registerLoopActionCommand(loop);
|
|
93
|
+
}
|
|
94
|
+
function registerLoopActionCommand(loop) {
|
|
95
|
+
const action = loop.command('action').description('Record loop action ledger events');
|
|
96
|
+
addActionSelector(action.command('start')
|
|
97
|
+
.requiredOption('--from-run <run-id>', 'source run id')
|
|
98
|
+
.option('--kind <kind>', 'action kind', 'polish')
|
|
99
|
+
.option('--executor <executor>', 'action executor', 'subagent')
|
|
100
|
+
.requiredOption('--summary <text>', 'short action summary'))
|
|
101
|
+
.action((options) => {
|
|
102
|
+
printAction({
|
|
103
|
+
trajectoryId: options.trajectory,
|
|
104
|
+
target: options.target,
|
|
105
|
+
mode: options.mode,
|
|
106
|
+
status: 'started',
|
|
107
|
+
kind: options.kind,
|
|
108
|
+
executor: options.executor,
|
|
109
|
+
fromRunId: options.fromRun,
|
|
110
|
+
summary: options.summary,
|
|
111
|
+
});
|
|
112
|
+
});
|
|
113
|
+
addActionSelector(action.command('complete')
|
|
114
|
+
.requiredOption('--action <action-id>', 'action id')
|
|
115
|
+
.requiredOption('--summary <text>', 'short action summary')
|
|
116
|
+
.option('--files <paths>', 'comma-separated edited files')
|
|
117
|
+
.option('--commit <sha>', 'commit sha')
|
|
118
|
+
.option('--kind <kind>', 'action kind', 'polish')
|
|
119
|
+
.option('--executor <executor>', 'action executor', 'agent'))
|
|
120
|
+
.action((options) => {
|
|
121
|
+
printAction({
|
|
122
|
+
trajectoryId: options.trajectory,
|
|
123
|
+
target: options.target,
|
|
124
|
+
mode: options.mode,
|
|
125
|
+
status: 'completed',
|
|
126
|
+
kind: options.kind,
|
|
127
|
+
executor: options.executor,
|
|
128
|
+
actionId: options.action,
|
|
129
|
+
summary: options.summary,
|
|
130
|
+
files: parseFiles(options.files),
|
|
131
|
+
commit: options.commit,
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
addActionSelector(action.command('skip')
|
|
135
|
+
.requiredOption('--from-run <run-id>', 'source run id')
|
|
136
|
+
.requiredOption('--summary <text>', 'short action summary')
|
|
137
|
+
.option('--executor <executor>', 'action executor', 'agent'))
|
|
138
|
+
.action((options) => {
|
|
139
|
+
printAction({
|
|
140
|
+
trajectoryId: options.trajectory,
|
|
141
|
+
target: options.target,
|
|
142
|
+
mode: options.mode,
|
|
143
|
+
status: 'skipped',
|
|
144
|
+
kind: 'no-op',
|
|
145
|
+
executor: options.executor,
|
|
146
|
+
fromRunId: options.fromRun,
|
|
147
|
+
summary: options.summary,
|
|
148
|
+
});
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function printAction(input) {
|
|
152
|
+
const result = recordLoopAction(input);
|
|
153
|
+
console.log(`Action: ${result.actionId}`);
|
|
154
|
+
}
|
|
155
|
+
function addActionSelector(command) {
|
|
156
|
+
return command
|
|
157
|
+
.option('--trajectory <id>', 'trajectory id')
|
|
158
|
+
.option('-t, --target <name>', 'target name')
|
|
159
|
+
.option('--mode <mode>', 'loop mode');
|
|
160
|
+
}
|
|
161
|
+
function parseFiles(files) {
|
|
162
|
+
const parsed = files?.split(',').map((file) => file.trim()).filter(Boolean);
|
|
163
|
+
return parsed && parsed.length > 0 ? parsed : undefined;
|
|
70
164
|
}
|
|
71
165
|
//# sourceMappingURL=loop-cli.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop-cli.js","sourceRoot":"","sources":["../../src/commands/loop-cli.ts"],"names":[],"mappings":"AAGA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GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAC5E,OAAO,MAAM,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type LedgerActionExecutor, type LedgerMode } from '../schemas/ledger.js';
|
|
2
|
+
type LedgerEnv = Partial<Pick<NodeJS.ProcessEnv, 'LIMNER_LEDGER_HOME'>>;
|
|
3
|
+
type TrajectorySelector = {
|
|
4
|
+
ledgerEnv?: LedgerEnv;
|
|
5
|
+
trajectoryId?: string;
|
|
6
|
+
target?: string;
|
|
7
|
+
mode?: LedgerMode;
|
|
8
|
+
};
|
|
9
|
+
export type LoopTaskInput = TrajectorySelector & {
|
|
10
|
+
executor?: LedgerActionExecutor;
|
|
11
|
+
format?: 'markdown' | 'json';
|
|
12
|
+
workspaceRoot?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getLoopTask(input: LoopTaskInput): Promise<{
|
|
15
|
+
output: string;
|
|
16
|
+
}>;
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { existsSync } from 'node:fs';
|
|
2
|
+
import { buildAgentTaskBrief } from '../core/agent-task-brief.js';
|
|
3
|
+
import { openLedgerDatabase } from '../core/ledger-db.js';
|
|
4
|
+
import { resolveLedgerPaths } from '../core/ledger-paths.js';
|
|
5
|
+
import { buildLoopCompareRerunCommand } from '../core/loop-rerun-command.js';
|
|
6
|
+
import { createLedgerStore } from '../core/ledger-store.js';
|
|
7
|
+
import { ledgerActionExecutorSchema } from '../schemas/ledger.js';
|
|
8
|
+
export async function getLoopTask(input) {
|
|
9
|
+
return withStoreAsync(input.ledgerEnv, async (store) => {
|
|
10
|
+
const format = taskOutputFormat(input.format);
|
|
11
|
+
const desiredExecutor = ledgerActionExecutorSchema.parse(input.executor ?? 'subagent');
|
|
12
|
+
const trajectory = store.resolveTrajectory(selector(input));
|
|
13
|
+
const exported = store.exportTrajectoryJson(trajectory.trajectoryId);
|
|
14
|
+
const latestComparison = latestValidatedComparison(exported);
|
|
15
|
+
if (!latestComparison.ok)
|
|
16
|
+
throw new Error(latestComparisonError(latestComparison));
|
|
17
|
+
const brief = await buildAgentTaskBrief({
|
|
18
|
+
trajectoryId: trajectory.trajectoryId,
|
|
19
|
+
target: trajectory.target,
|
|
20
|
+
mode: trajectory.mode,
|
|
21
|
+
workspaceRoot: input.workspaceRoot ?? process.cwd(),
|
|
22
|
+
comparisonSummaryPath: latestComparison.summaryPath,
|
|
23
|
+
sourceRunId: latestComparison.runId,
|
|
24
|
+
desiredExecutor,
|
|
25
|
+
rerunCommand: buildLoopCompareRerunCommand(trajectory, latestComparison.inputsSummary),
|
|
26
|
+
});
|
|
27
|
+
store.appendEvent({
|
|
28
|
+
trajectoryId: trajectory.trajectoryId,
|
|
29
|
+
iterationId: trajectory.activeIterationId ?? undefined,
|
|
30
|
+
eventType: 'loop.task.viewed',
|
|
31
|
+
actor: 'agent',
|
|
32
|
+
command: 'loop task',
|
|
33
|
+
resultStatus: 'ok',
|
|
34
|
+
inputsSummary: JSON.stringify({ sourceRunId: latestComparison.runId, desiredExecutor }),
|
|
35
|
+
});
|
|
36
|
+
return { output: format === 'json' ? `${JSON.stringify(brief.json, null, 2)}\n` : brief.markdown };
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
async function withStoreAsync(env, callback) {
|
|
40
|
+
const db = openLedgerDatabase({ databasePath: resolveLedgerPaths(env).databasePath });
|
|
41
|
+
try {
|
|
42
|
+
return await callback(createLedgerStore(db));
|
|
43
|
+
}
|
|
44
|
+
finally {
|
|
45
|
+
db.close();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
function selector(input) {
|
|
49
|
+
return { trajectoryId: input.trajectoryId, target: input.target, mode: input.mode };
|
|
50
|
+
}
|
|
51
|
+
function taskOutputFormat(format) {
|
|
52
|
+
if (format === undefined || format === 'markdown' || format === 'json')
|
|
53
|
+
return format ?? 'markdown';
|
|
54
|
+
throw new Error(`Unsupported loop task format: ${format}`);
|
|
55
|
+
}
|
|
56
|
+
function latestValidatedComparison(exported) {
|
|
57
|
+
for (const event of [...exported.events].reverse()) {
|
|
58
|
+
if (event.eventType !== 'loop.compare.validated' || event.resultStatus !== 'validated')
|
|
59
|
+
continue;
|
|
60
|
+
if (!event.runId)
|
|
61
|
+
return { ok: false, reason: 'missing-run-id' };
|
|
62
|
+
const summary = parseArtifactRefs(event.artifactRefsJson).find((artifact) => artifact.kind === 'comparison-summary');
|
|
63
|
+
if (!summary)
|
|
64
|
+
return { ok: false, reason: 'missing-summary-artifact', runId: event.runId };
|
|
65
|
+
if (summary.exists === false)
|
|
66
|
+
return { ok: false, reason: 'summary-marked-missing', runId: event.runId, summaryPath: summary.path };
|
|
67
|
+
if (!existsSync(summary.path))
|
|
68
|
+
return { ok: false, reason: 'summary-missing-on-disk', runId: event.runId, summaryPath: summary.path };
|
|
69
|
+
return { ok: true, summaryPath: summary.path, inputsSummary: event.inputsSummary, runId: event.runId };
|
|
70
|
+
}
|
|
71
|
+
return { ok: false, reason: 'none' };
|
|
72
|
+
}
|
|
73
|
+
function latestComparisonError(result) {
|
|
74
|
+
switch (result.reason) {
|
|
75
|
+
case 'none':
|
|
76
|
+
return 'No validated comparison summary found. Write agent-response.json, then run limner loop compare first.';
|
|
77
|
+
case 'missing-run-id':
|
|
78
|
+
return 'Latest validated comparison is missing a run id, so loop task cannot create a sourceRunId.';
|
|
79
|
+
case 'missing-summary-artifact':
|
|
80
|
+
return `Latest validated comparison run ${result.runId} did not include a comparison-summary artifact. Rerun limner loop compare.`;
|
|
81
|
+
case 'summary-marked-missing':
|
|
82
|
+
return `Latest validated comparison run ${result.runId} has a comparison summary marked missing: ${result.summaryPath}. Rerun limner loop compare.`;
|
|
83
|
+
case 'summary-missing-on-disk':
|
|
84
|
+
return `Latest validated comparison run ${result.runId} references a comparison summary that is missing on disk: ${result.summaryPath}. Rerun limner loop compare.`;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
function parseArtifactRefs(raw) {
|
|
88
|
+
if (!raw)
|
|
89
|
+
return [];
|
|
90
|
+
const parsed = JSON.parse(raw);
|
|
91
|
+
return Array.isArray(parsed)
|
|
92
|
+
? parsed.filter((value) => typeof value === 'object' && value !== null && 'path' in value && 'kind' in value && typeof value.path === 'string' && typeof value.kind === 'string')
|
|
93
|
+
: [];
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=loop-task.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop-task.js","sourceRoot":"","sources":["../../src/commands/loop-task.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,4BAA4B,EAAE,MAAM,+BAA+B,CAAC;AAC7E,OAAO,EAAE,iBAAiB,EAA+B,MAAM,yBAAyB,CAAC;AACzF,OAAO,EAAE,0BAA0B,EAA8C,MAAM,sBAAsB,CAAC;AAM9G,MAAM,CAAC,KAAK,UAAU,WAAW,CAAC,KAAoB;IACpD,OAAO,cAAc,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;QACrD,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC9C,MAAM,eAAe,GAAG,0BAA0B,CAAC,KAAK,CAAC,KAAK,CAAC,QAAQ,IAAI,UAAU,CAAC,CAAC;QACvF,MAAM,UAAU,GAAG,KAAK,CAAC,iBAAiB,CAA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BAA8B,CAAC;IACxK,CAAC;AACH,CAAC;AAED,SAAS,iBAAiB,CAAC,GAAkB;IAC3C,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY,CAAC;IAC1C,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC;QAC1B,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,KAAK,EAAwB,EAAE,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,MAAM,IAAI,KAAK,IAAI,MAAM,IAAI,KAAK,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,CAAC;QACvM,CAAC,CAAC,EAAE,CAAC;AACT,CAAC"}
|
package/dist/commands/loop.d.ts
CHANGED
|
@@ -25,6 +25,9 @@ export type CompareLoopInput = TrajectorySelector & {
|
|
|
25
25
|
headed?: boolean;
|
|
26
26
|
fullPage?: boolean;
|
|
27
27
|
};
|
|
28
|
+
export { getLoopTask } from './loop-task.js';
|
|
29
|
+
export { recordLoopAction } from './loop-actions.js';
|
|
30
|
+
export type { LoopActionInput } from './loop-actions.js';
|
|
28
31
|
export declare function startLoop(input: StartLoopInput): {
|
|
29
32
|
trajectoryId: string;
|
|
30
33
|
iterationId: string | null;
|
|
@@ -38,4 +41,3 @@ export declare function advanceLoop(input: TrajectorySelector): {
|
|
|
38
41
|
};
|
|
39
42
|
export declare function closeLoop(input: TrajectorySelector): import("../core/ledger-store.js").TrajectorySummary;
|
|
40
43
|
export declare function compareLoop(input: CompareLoopInput): Promise<import("./loop-comparison-adapters.js").LoopCompareResult>;
|
|
41
|
-
export {};
|
package/dist/commands/loop.js
CHANGED
|
@@ -5,6 +5,8 @@ import { resolveLedgerPaths } from '../core/ledger-paths.js';
|
|
|
5
5
|
import { getRuntimeContext } from '../core/runtime-context.js';
|
|
6
6
|
import { createLedgerStore } from '../core/ledger-store.js';
|
|
7
7
|
import { runLoopComparison } from './loop-comparison-adapters.js';
|
|
8
|
+
export { getLoopTask } from './loop-task.js';
|
|
9
|
+
export { recordLoopAction } from './loop-actions.js';
|
|
8
10
|
export function startLoop(input) {
|
|
9
11
|
return withStore(input.ledgerEnv, (store) => {
|
|
10
12
|
const mode = ledgerModeSchema.parse(input.mode);
|
|
@@ -66,16 +68,10 @@ export function getLoopStatus(input) {
|
|
|
66
68
|
});
|
|
67
69
|
}
|
|
68
70
|
export function advanceLoop(input) {
|
|
69
|
-
return withStore(input.ledgerEnv, (store) =>
|
|
70
|
-
const trajectory = store.resolveTrajectory(selector(input));
|
|
71
|
-
return store.advanceIteration(trajectory.trajectoryId);
|
|
72
|
-
});
|
|
71
|
+
return withStore(input.ledgerEnv, (store) => store.advanceIteration(store.resolveTrajectory(selector(input)).trajectoryId));
|
|
73
72
|
}
|
|
74
73
|
export function closeLoop(input) {
|
|
75
|
-
return withStore(input.ledgerEnv, (store) =>
|
|
76
|
-
const trajectory = store.resolveTrajectory(selector(input));
|
|
77
|
-
return store.closeTrajectory(trajectory.trajectoryId);
|
|
78
|
-
});
|
|
74
|
+
return withStore(input.ledgerEnv, (store) => store.closeTrajectory(store.resolveTrajectory(selector(input)).trajectoryId));
|
|
79
75
|
}
|
|
80
76
|
export async function compareLoop(input) {
|
|
81
77
|
return withStoreAsync(input.ledgerEnv, async (store) => {
|
|
@@ -111,6 +107,23 @@ export async function compareLoop(input) {
|
|
|
111
107
|
inputsSummary: JSON.stringify(compareContext(input)),
|
|
112
108
|
artifactRefs: result.artifacts,
|
|
113
109
|
});
|
|
110
|
+
if (result.agentComparison) {
|
|
111
|
+
store.recordAgentResponse({
|
|
112
|
+
trajectoryId: trajectory.trajectoryId,
|
|
113
|
+
iterationId: trajectory.activeIterationId ?? undefined,
|
|
114
|
+
runId: result.runId,
|
|
115
|
+
mode: trajectory.mode,
|
|
116
|
+
profile: result.agentComparison.profile,
|
|
117
|
+
responsePath: result.agentComparison.responsePath,
|
|
118
|
+
responseHash: result.agentComparison.responseHash,
|
|
119
|
+
freshness: result.agentComparison.freshness,
|
|
120
|
+
validationStatus: result.agentComparison.status,
|
|
121
|
+
inputFingerprint: result.agentComparison.inputFingerprint,
|
|
122
|
+
responseJson: result.agentComparison.responseJson,
|
|
123
|
+
score: result.agentComparison.score,
|
|
124
|
+
topFix: result.agentComparison.topFix,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
114
127
|
return result;
|
|
115
128
|
}
|
|
116
129
|
catch (error) {
|
|
@@ -147,20 +160,9 @@ async function withStoreAsync(env, callback) {
|
|
|
147
160
|
}
|
|
148
161
|
}
|
|
149
162
|
function selector(input) {
|
|
150
|
-
return {
|
|
151
|
-
trajectoryId: input.trajectoryId,
|
|
152
|
-
target: input.target,
|
|
153
|
-
mode: input.mode,
|
|
154
|
-
};
|
|
163
|
+
return { trajectoryId: input.trajectoryId, target: input.target, mode: input.mode };
|
|
155
164
|
}
|
|
156
165
|
function compareContext(input) {
|
|
157
|
-
return {
|
|
158
|
-
...getRuntimeContext(),
|
|
159
|
-
headed: input.headed === true,
|
|
160
|
-
headless: input.headed !== true,
|
|
161
|
-
fullPage: input.fullPage === true,
|
|
162
|
-
hasUrl: Boolean(input.url),
|
|
163
|
-
hasStorageState: Boolean(input.storageState),
|
|
164
|
-
};
|
|
166
|
+
return { ...getRuntimeContext(), headed: input.headed === true, headless: input.headed !== true, fullPage: input.fullPage === true, hasUrl: Boolean(input.url), hasStorageState: Boolean(input.storageState), ...(input.url ? { url: input.url } : {}), ...(input.storageState ? { storageState: input.storageState } : {}) };
|
|
165
167
|
}
|
|
166
168
|
//# sourceMappingURL=loop.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loop.js","sourceRoot":"","sources":["../../src/commands/loop.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAmB,MAAM,sBAAsB,CAAC;AACzE,OAAO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CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,KAAK,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC;AAChU,CAAC"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { type AgentComparisonInputFingerprint } from '../schemas/comparison.js';
|
|
1
2
|
import type { AgentComparisonProfileName } from './agent-comparison-profiles.js';
|
|
3
|
+
import { type AgentResponseFreshness } from './agent-comparison-response.js';
|
|
2
4
|
export type AgentComparisonPackResult = {
|
|
3
5
|
promptPath: string;
|
|
4
6
|
codexPromptPath: string;
|
|
@@ -7,11 +9,22 @@ export type AgentComparisonPackResult = {
|
|
|
7
9
|
examplePath: string;
|
|
8
10
|
responsePath: string;
|
|
9
11
|
status: 'awaiting-agent' | 'validated' | 'invalid';
|
|
12
|
+
profile: AgentComparisonProfileName;
|
|
13
|
+
inputFingerprint: AgentComparisonInputFingerprint;
|
|
14
|
+
freshness: AgentResponseFreshness;
|
|
15
|
+
responseExistedBefore: boolean;
|
|
16
|
+
responseHash?: string;
|
|
17
|
+
responseJson?: string;
|
|
10
18
|
validationErrors?: string[];
|
|
11
19
|
imageComparisonPath?: string;
|
|
12
20
|
structureComparisonPath?: string;
|
|
13
21
|
summaryPath?: string;
|
|
14
22
|
scoreHighlights?: string[];
|
|
23
|
+
score?: {
|
|
24
|
+
imageOverall: number;
|
|
25
|
+
structureOverall?: number;
|
|
26
|
+
};
|
|
27
|
+
topFix?: string;
|
|
15
28
|
};
|
|
16
29
|
export declare function writeAgentComparisonPack(input: {
|
|
17
30
|
workspaceRoot: string;
|