@hasna/loops 0.3.39 → 0.3.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/index.js +21 -5
- package/dist/daemon/index.js +8 -3
- package/dist/index.js +20 -4
- package/dist/lib/store.d.ts +1 -0
- package/dist/lib/store.js +7 -2
- package/dist/sdk/index.js +7 -2
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -946,8 +946,6 @@ class Store {
|
|
|
946
946
|
WHERE idempotency_key IS NOT NULL;
|
|
947
947
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow_created ON workflow_runs(workflow_id, created_at DESC);
|
|
948
948
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_loop_run ON workflow_runs(loop_run_id);
|
|
949
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
950
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
951
949
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
952
950
|
|
|
953
951
|
CREATE TABLE IF NOT EXISTS workflow_invocations (
|
|
@@ -1120,6 +1118,7 @@ class Store {
|
|
|
1120
1118
|
this.addColumnIfMissing("workflow_runs", "manifest_path", "TEXT");
|
|
1121
1119
|
this.addColumnIfMissing("workflow_step_runs", "pid", "INTEGER");
|
|
1122
1120
|
this.addColumnIfMissing("workflow_step_runs", "goal_run_id", "TEXT");
|
|
1121
|
+
this.createWorkflowRunBackfillIndexes();
|
|
1123
1122
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0001_initial_and_workflows", nowIso());
|
|
1124
1123
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0002_loop_machines", nowIso());
|
|
1125
1124
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0003_goals", nowIso());
|
|
@@ -1132,6 +1131,12 @@ class Store {
|
|
|
1132
1131
|
return;
|
|
1133
1132
|
this.db.query(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`).run();
|
|
1134
1133
|
}
|
|
1134
|
+
createWorkflowRunBackfillIndexes() {
|
|
1135
|
+
this.db.exec(`
|
|
1136
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
1137
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
1138
|
+
`);
|
|
1139
|
+
}
|
|
1135
1140
|
assertDaemonLeaseFence(opts = {}, now = nowIso()) {
|
|
1136
1141
|
if (!opts.daemonLeaseId)
|
|
1137
1142
|
return;
|
|
@@ -5711,7 +5716,7 @@ function buildScriptInventoryReport(store, opts = {}) {
|
|
|
5711
5716
|
// package.json
|
|
5712
5717
|
var package_default = {
|
|
5713
5718
|
name: "@hasna/loops",
|
|
5714
|
-
version: "0.3.
|
|
5719
|
+
version: "0.3.41",
|
|
5715
5720
|
description: "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
|
|
5716
5721
|
type: "module",
|
|
5717
5722
|
main: "dist/index.js",
|
|
@@ -6286,6 +6291,7 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
6286
6291
|
throw new Error("taskId is required");
|
|
6287
6292
|
if (!input.projectPath?.trim())
|
|
6288
6293
|
throw new Error("projectPath is required");
|
|
6294
|
+
const todosProjectPath = input.routeProjectPath ?? input.projectPath;
|
|
6289
6295
|
const plan = worktreePlan(input, input.taskId);
|
|
6290
6296
|
const taskContext = {
|
|
6291
6297
|
taskId: input.taskId,
|
|
@@ -6310,10 +6316,15 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
6310
6316
|
"",
|
|
6311
6317
|
"You are the worker agent for a task-triggered OpenLoops workflow.",
|
|
6312
6318
|
worktreePrompt(plan),
|
|
6319
|
+
`Todos project path: ${todosProjectPath}`,
|
|
6320
|
+
"Use these exact todos commands so worktree cwd inference cannot attach to the wrong project:",
|
|
6321
|
+
`- Inspect first: todos --project ${todosProjectPath} inspect ${input.taskId}`,
|
|
6322
|
+
`- Claim/start if appropriate: todos --project ${todosProjectPath} start ${input.taskId}`,
|
|
6323
|
+
`- Record evidence: todos --project ${todosProjectPath} comment ${input.taskId} "<concise evidence and blockers>"`,
|
|
6313
6324
|
"Investigate first before changing files. Use the todos CLI as the source of truth for the task.",
|
|
6314
|
-
"
|
|
6325
|
+
"Inspect the repository/project state, implement only the task scope, run focused validation, preserve unrelated user changes, and update the task with comments, evidence, changed files, commits, and blockers.",
|
|
6315
6326
|
"Do not dispatch or paste prompts into tmux panes. If additional work is required, create or update deduped todos tasks so task-created routing can start a fresh headless workflow.",
|
|
6316
|
-
"Do not mark the task complete
|
|
6327
|
+
"Do not mark the task complete in the worker step; the verifier step owns completion after independent validation.",
|
|
6317
6328
|
"",
|
|
6318
6329
|
`Task context JSON: ${compactJson(taskContext)}`
|
|
6319
6330
|
].join(`
|
|
@@ -6323,6 +6334,11 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
6323
6334
|
"",
|
|
6324
6335
|
"You are the verifier agent for a task-triggered OpenLoops workflow.",
|
|
6325
6336
|
worktreePrompt(plan),
|
|
6337
|
+
`Todos project path: ${todosProjectPath}`,
|
|
6338
|
+
"Use these exact todos commands so worktree cwd inference cannot attach to the wrong project:",
|
|
6339
|
+
`- Inspect first: todos --project ${todosProjectPath} inspect ${input.taskId}`,
|
|
6340
|
+
`- Record verification: todos --project ${todosProjectPath} comment ${input.taskId} "<verification evidence or blocker>"`,
|
|
6341
|
+
`- If valid and complete: todos --project ${todosProjectPath} done ${input.taskId}`,
|
|
6326
6342
|
"Use fresh context. Inspect the task, repository state, commits, tests, and worker evidence. Act as an adversarial reviewer focused on correctness, regressions, missing tests, security, and incomplete requirements.",
|
|
6327
6343
|
"If the work is valid, record verification evidence in todos and mark/leave the task in the correct completed state according to the todos CLI. If it is not valid, add precise follow-up tasks or comments and leave the original task open or blocked with clear evidence.",
|
|
6328
6344
|
"Do not dispatch or paste prompts into tmux panes. If additional work is required, create or update deduped todos tasks so task-created routing can start a fresh headless workflow.",
|
package/dist/daemon/index.js
CHANGED
|
@@ -946,8 +946,6 @@ class Store {
|
|
|
946
946
|
WHERE idempotency_key IS NOT NULL;
|
|
947
947
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow_created ON workflow_runs(workflow_id, created_at DESC);
|
|
948
948
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_loop_run ON workflow_runs(loop_run_id);
|
|
949
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
950
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
951
949
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
952
950
|
|
|
953
951
|
CREATE TABLE IF NOT EXISTS workflow_invocations (
|
|
@@ -1120,6 +1118,7 @@ class Store {
|
|
|
1120
1118
|
this.addColumnIfMissing("workflow_runs", "manifest_path", "TEXT");
|
|
1121
1119
|
this.addColumnIfMissing("workflow_step_runs", "pid", "INTEGER");
|
|
1122
1120
|
this.addColumnIfMissing("workflow_step_runs", "goal_run_id", "TEXT");
|
|
1121
|
+
this.createWorkflowRunBackfillIndexes();
|
|
1123
1122
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0001_initial_and_workflows", nowIso());
|
|
1124
1123
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0002_loop_machines", nowIso());
|
|
1125
1124
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0003_goals", nowIso());
|
|
@@ -1132,6 +1131,12 @@ class Store {
|
|
|
1132
1131
|
return;
|
|
1133
1132
|
this.db.query(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`).run();
|
|
1134
1133
|
}
|
|
1134
|
+
createWorkflowRunBackfillIndexes() {
|
|
1135
|
+
this.db.exec(`
|
|
1136
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
1137
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
1138
|
+
`);
|
|
1139
|
+
}
|
|
1135
1140
|
assertDaemonLeaseFence(opts = {}, now = nowIso()) {
|
|
1136
1141
|
if (!opts.daemonLeaseId)
|
|
1137
1142
|
return;
|
|
@@ -5025,7 +5030,7 @@ function enableStartup(result) {
|
|
|
5025
5030
|
// package.json
|
|
5026
5031
|
var package_default = {
|
|
5027
5032
|
name: "@hasna/loops",
|
|
5028
|
-
version: "0.3.
|
|
5033
|
+
version: "0.3.41",
|
|
5029
5034
|
description: "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
|
|
5030
5035
|
type: "module",
|
|
5031
5036
|
main: "dist/index.js",
|
package/dist/index.js
CHANGED
|
@@ -944,8 +944,6 @@ class Store {
|
|
|
944
944
|
WHERE idempotency_key IS NOT NULL;
|
|
945
945
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow_created ON workflow_runs(workflow_id, created_at DESC);
|
|
946
946
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_loop_run ON workflow_runs(loop_run_id);
|
|
947
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
948
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
949
947
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
950
948
|
|
|
951
949
|
CREATE TABLE IF NOT EXISTS workflow_invocations (
|
|
@@ -1118,6 +1116,7 @@ class Store {
|
|
|
1118
1116
|
this.addColumnIfMissing("workflow_runs", "manifest_path", "TEXT");
|
|
1119
1117
|
this.addColumnIfMissing("workflow_step_runs", "pid", "INTEGER");
|
|
1120
1118
|
this.addColumnIfMissing("workflow_step_runs", "goal_run_id", "TEXT");
|
|
1119
|
+
this.createWorkflowRunBackfillIndexes();
|
|
1121
1120
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0001_initial_and_workflows", nowIso());
|
|
1122
1121
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0002_loop_machines", nowIso());
|
|
1123
1122
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0003_goals", nowIso());
|
|
@@ -1130,6 +1129,12 @@ class Store {
|
|
|
1130
1129
|
return;
|
|
1131
1130
|
this.db.query(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`).run();
|
|
1132
1131
|
}
|
|
1132
|
+
createWorkflowRunBackfillIndexes() {
|
|
1133
|
+
this.db.exec(`
|
|
1134
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
1135
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
1136
|
+
`);
|
|
1137
|
+
}
|
|
1133
1138
|
assertDaemonLeaseFence(opts = {}, now = nowIso()) {
|
|
1134
1139
|
if (!opts.daemonLeaseId)
|
|
1135
1140
|
return;
|
|
@@ -5247,6 +5252,7 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
5247
5252
|
throw new Error("taskId is required");
|
|
5248
5253
|
if (!input.projectPath?.trim())
|
|
5249
5254
|
throw new Error("projectPath is required");
|
|
5255
|
+
const todosProjectPath = input.routeProjectPath ?? input.projectPath;
|
|
5250
5256
|
const plan = worktreePlan(input, input.taskId);
|
|
5251
5257
|
const taskContext = {
|
|
5252
5258
|
taskId: input.taskId,
|
|
@@ -5271,10 +5277,15 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
5271
5277
|
"",
|
|
5272
5278
|
"You are the worker agent for a task-triggered OpenLoops workflow.",
|
|
5273
5279
|
worktreePrompt(plan),
|
|
5280
|
+
`Todos project path: ${todosProjectPath}`,
|
|
5281
|
+
"Use these exact todos commands so worktree cwd inference cannot attach to the wrong project:",
|
|
5282
|
+
`- Inspect first: todos --project ${todosProjectPath} inspect ${input.taskId}`,
|
|
5283
|
+
`- Claim/start if appropriate: todos --project ${todosProjectPath} start ${input.taskId}`,
|
|
5284
|
+
`- Record evidence: todos --project ${todosProjectPath} comment ${input.taskId} "<concise evidence and blockers>"`,
|
|
5274
5285
|
"Investigate first before changing files. Use the todos CLI as the source of truth for the task.",
|
|
5275
|
-
"
|
|
5286
|
+
"Inspect the repository/project state, implement only the task scope, run focused validation, preserve unrelated user changes, and update the task with comments, evidence, changed files, commits, and blockers.",
|
|
5276
5287
|
"Do not dispatch or paste prompts into tmux panes. If additional work is required, create or update deduped todos tasks so task-created routing can start a fresh headless workflow.",
|
|
5277
|
-
"Do not mark the task complete
|
|
5288
|
+
"Do not mark the task complete in the worker step; the verifier step owns completion after independent validation.",
|
|
5278
5289
|
"",
|
|
5279
5290
|
`Task context JSON: ${compactJson(taskContext)}`
|
|
5280
5291
|
].join(`
|
|
@@ -5284,6 +5295,11 @@ function renderTodosTaskWorkerVerifierWorkflow(input) {
|
|
|
5284
5295
|
"",
|
|
5285
5296
|
"You are the verifier agent for a task-triggered OpenLoops workflow.",
|
|
5286
5297
|
worktreePrompt(plan),
|
|
5298
|
+
`Todos project path: ${todosProjectPath}`,
|
|
5299
|
+
"Use these exact todos commands so worktree cwd inference cannot attach to the wrong project:",
|
|
5300
|
+
`- Inspect first: todos --project ${todosProjectPath} inspect ${input.taskId}`,
|
|
5301
|
+
`- Record verification: todos --project ${todosProjectPath} comment ${input.taskId} "<verification evidence or blocker>"`,
|
|
5302
|
+
`- If valid and complete: todos --project ${todosProjectPath} done ${input.taskId}`,
|
|
5287
5303
|
"Use fresh context. Inspect the task, repository state, commits, tests, and worker evidence. Act as an adversarial reviewer focused on correctness, regressions, missing tests, security, and incomplete requirements.",
|
|
5288
5304
|
"If the work is valid, record verification evidence in todos and mark/leave the task in the correct completed state according to the todos CLI. If it is not valid, add precise follow-up tasks or comments and leave the original task open or blocked with clear evidence.",
|
|
5289
5305
|
"Do not dispatch or paste prompts into tmux panes. If additional work is required, create or update deduped todos tasks so task-created routing can start a fresh headless workflow.",
|
package/dist/lib/store.d.ts
CHANGED
|
@@ -69,6 +69,7 @@ export declare class Store {
|
|
|
69
69
|
* in {@link migrate}, never user input, so interpolation here is safe.
|
|
70
70
|
*/
|
|
71
71
|
private addColumnIfMissing;
|
|
72
|
+
private createWorkflowRunBackfillIndexes;
|
|
72
73
|
private assertDaemonLeaseFence;
|
|
73
74
|
createLoop(input: CreateLoopInput, from?: Date): Loop;
|
|
74
75
|
getLoop(id: string): Loop | undefined;
|
package/dist/lib/store.js
CHANGED
|
@@ -944,8 +944,6 @@ class Store {
|
|
|
944
944
|
WHERE idempotency_key IS NOT NULL;
|
|
945
945
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow_created ON workflow_runs(workflow_id, created_at DESC);
|
|
946
946
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_loop_run ON workflow_runs(loop_run_id);
|
|
947
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
948
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
949
947
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
950
948
|
|
|
951
949
|
CREATE TABLE IF NOT EXISTS workflow_invocations (
|
|
@@ -1118,6 +1116,7 @@ class Store {
|
|
|
1118
1116
|
this.addColumnIfMissing("workflow_runs", "manifest_path", "TEXT");
|
|
1119
1117
|
this.addColumnIfMissing("workflow_step_runs", "pid", "INTEGER");
|
|
1120
1118
|
this.addColumnIfMissing("workflow_step_runs", "goal_run_id", "TEXT");
|
|
1119
|
+
this.createWorkflowRunBackfillIndexes();
|
|
1121
1120
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0001_initial_and_workflows", nowIso());
|
|
1122
1121
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0002_loop_machines", nowIso());
|
|
1123
1122
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0003_goals", nowIso());
|
|
@@ -1130,6 +1129,12 @@ class Store {
|
|
|
1130
1129
|
return;
|
|
1131
1130
|
this.db.query(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`).run();
|
|
1132
1131
|
}
|
|
1132
|
+
createWorkflowRunBackfillIndexes() {
|
|
1133
|
+
this.db.exec(`
|
|
1134
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
1135
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
1136
|
+
`);
|
|
1137
|
+
}
|
|
1133
1138
|
assertDaemonLeaseFence(opts = {}, now = nowIso()) {
|
|
1134
1139
|
if (!opts.daemonLeaseId)
|
|
1135
1140
|
return;
|
package/dist/sdk/index.js
CHANGED
|
@@ -944,8 +944,6 @@ class Store {
|
|
|
944
944
|
WHERE idempotency_key IS NOT NULL;
|
|
945
945
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_workflow_created ON workflow_runs(workflow_id, created_at DESC);
|
|
946
946
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_loop_run ON workflow_runs(loop_run_id);
|
|
947
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
948
|
-
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
949
947
|
CREATE INDEX IF NOT EXISTS idx_workflow_runs_status ON workflow_runs(status);
|
|
950
948
|
|
|
951
949
|
CREATE TABLE IF NOT EXISTS workflow_invocations (
|
|
@@ -1118,6 +1116,7 @@ class Store {
|
|
|
1118
1116
|
this.addColumnIfMissing("workflow_runs", "manifest_path", "TEXT");
|
|
1119
1117
|
this.addColumnIfMissing("workflow_step_runs", "pid", "INTEGER");
|
|
1120
1118
|
this.addColumnIfMissing("workflow_step_runs", "goal_run_id", "TEXT");
|
|
1119
|
+
this.createWorkflowRunBackfillIndexes();
|
|
1121
1120
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0001_initial_and_workflows", nowIso());
|
|
1122
1121
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0002_loop_machines", nowIso());
|
|
1123
1122
|
this.db.query("INSERT OR IGNORE INTO schema_migrations (id, applied_at) VALUES (?, ?)").run("0003_goals", nowIso());
|
|
@@ -1130,6 +1129,12 @@ class Store {
|
|
|
1130
1129
|
return;
|
|
1131
1130
|
this.db.query(`ALTER TABLE ${table} ADD COLUMN ${column} ${definition}`).run();
|
|
1132
1131
|
}
|
|
1132
|
+
createWorkflowRunBackfillIndexes() {
|
|
1133
|
+
this.db.exec(`
|
|
1134
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_invocation ON workflow_runs(invocation_id);
|
|
1135
|
+
CREATE INDEX IF NOT EXISTS idx_workflow_runs_work_item ON workflow_runs(work_item_id);
|
|
1136
|
+
`);
|
|
1137
|
+
}
|
|
1133
1138
|
assertDaemonLeaseFence(opts = {}, now = nowIso()) {
|
|
1134
1139
|
if (!opts.daemonLeaseId)
|
|
1135
1140
|
return;
|
package/package.json
CHANGED