@hasna/loops 0.4.27 → 0.4.28
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/CHANGELOG.md +121 -0
- package/README.md +6 -0
- package/dist/api/index.js +689 -20
- package/dist/cli/index.js +509 -85
- package/dist/daemon/index.js +118 -11
- package/dist/index.js +525 -64
- package/dist/lib/executor.d.ts +9 -0
- package/dist/lib/migration.d.ts +66 -0
- package/dist/lib/mode.js +3 -3
- package/dist/lib/route/fields.d.ts +8 -0
- package/dist/lib/storage/index.js +197 -7
- package/dist/lib/storage/postgres-loop-storage.d.ts +2 -2
- package/dist/lib/storage/postgres-schema.js +3 -0
- package/dist/lib/storage/postgres.js +3 -0
- package/dist/lib/storage/sqlite.js +83 -3
- package/dist/lib/store/index.d.ts +3 -0
- package/dist/lib/store.d.ts +77 -0
- package/dist/lib/store.js +89 -4
- package/dist/mcp/index.js +118 -11
- package/dist/runner/index.js +35 -8
- package/dist/sdk/http.d.ts +153 -1
- package/dist/sdk/http.js +78 -1
- package/dist/sdk/index.js +411 -60
- package/dist/serve/index.js +919 -60
- package/dist/types.d.ts +11 -0
- package/docs/DEPLOYMENT_MODES.md +6 -0
- package/docs/USAGE.md +11 -8
- package/package.json +3 -3
package/dist/types.d.ts
CHANGED
|
@@ -223,6 +223,16 @@ export interface WorkflowWorkItem {
|
|
|
223
223
|
priority: number;
|
|
224
224
|
status: WorkflowWorkItemStatus;
|
|
225
225
|
attempts: number;
|
|
226
|
+
/**
|
|
227
|
+
* Consecutive non-productive "gate death" finishes (runs that failed at
|
|
228
|
+
* worktree prep or a fast triage/planner gate before any real work). Gate
|
|
229
|
+
* deaths refund their redispatch attempt, so this second counter bounds a
|
|
230
|
+
* deterministic infrastructure fault: at the ceiling the item is
|
|
231
|
+
* dead-lettered instead of retrying forever. Reset by a run that reaches
|
|
232
|
+
* the worker (success, productive failure, or tempfail) and by an
|
|
233
|
+
* operator requeue with attempts reset.
|
|
234
|
+
*/
|
|
235
|
+
gateDeaths: number;
|
|
226
236
|
nextAttemptAt?: string;
|
|
227
237
|
leaseExpiresAt?: string;
|
|
228
238
|
workflowId?: string;
|
|
@@ -233,6 +243,7 @@ export interface WorkflowWorkItem {
|
|
|
233
243
|
updatedAt: string;
|
|
234
244
|
}
|
|
235
245
|
export interface UpsertWorkflowWorkItemInput {
|
|
246
|
+
id?: string;
|
|
236
247
|
routeKey: string;
|
|
237
248
|
idempotencyKey: string;
|
|
238
249
|
invocationId: string;
|
package/docs/DEPLOYMENT_MODES.md
CHANGED
|
@@ -159,6 +159,12 @@ refuses to write a no-loss bundle unless the operator explicitly uses
|
|
|
159
159
|
requires `--apply`; existing rows with the same id are updated only with
|
|
160
160
|
`--replace`. The CLI creates a local SQLite backup before a safe apply.
|
|
161
161
|
|
|
162
|
+
`loops self-hosted push` applies an additional self-hosted safety rule. Imported
|
|
163
|
+
workflow definitions are archived, and imported loops are paused with
|
|
164
|
+
`nextRunAt`/`retryScheduledFor` cleared. That safety normalization can re-archive
|
|
165
|
+
or re-pause existing same-id rows even when `--replace` is not supplied; explicit
|
|
166
|
+
preserve flags are reserved for deliberate activation.
|
|
167
|
+
|
|
162
168
|
No-loss validation blocks unsupported or live state instead of silently
|
|
163
169
|
dropping it. The current migration bundle does not preserve workflow invocation
|
|
164
170
|
rows, workflow work items, workflow run/step/event history, or goal run history.
|
package/docs/USAGE.md
CHANGED
|
@@ -86,22 +86,25 @@ leases, running runs, leased work items). Inline command env values are not
|
|
|
86
86
|
exported as secrets; bundles with redacted env values require
|
|
87
87
|
`--allow-redacted` and are marked non-importable.
|
|
88
88
|
|
|
89
|
-
Self-hosted sync commands
|
|
90
|
-
id-preserving import
|
|
89
|
+
Self-hosted sync commands compare local definitions with the control-plane API.
|
|
90
|
+
`push` can apply through the id-preserving `/v1/import` endpoint; `migrate` and
|
|
91
|
+
`pull` remain preview/blocked for remote state that lacks a full export surface:
|
|
91
92
|
|
|
92
93
|
```bash
|
|
93
94
|
loops self-hosted migrate --dry-run
|
|
94
95
|
loops self-hosted push --dry-run
|
|
96
|
+
loops self-hosted push --apply --manifest-file ./self-hosted-push.json
|
|
95
97
|
loops self-hosted pull --dry-run
|
|
96
98
|
```
|
|
97
99
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
Self-hosted push is safe by default: workflows are archived and loops are
|
|
101
|
+
paused with scheduling pointers cleared, including existing same-id rows that
|
|
102
|
+
need re-neutralizing. `--replace` permits broader same-id data updates, but is
|
|
103
|
+
not required for that safety normalization. Use `loops self-hosted
|
|
104
|
+
runner-register` to verify runner registration against an API, then use
|
|
105
|
+
`loops-runner run-once` for the current bounded non-workflow
|
|
102
106
|
claim/execute/finalize protocol. `loops-serve migrate` applies the Postgres
|
|
103
|
-
schema and `api_keys` table for a self-hosted control-plane host
|
|
104
|
-
CLI migration previews still do not perform id-preserving remote apply.
|
|
107
|
+
schema and `api_keys` table for a self-hosted control-plane host.
|
|
105
108
|
Runner registration is preview-only unless `--apply` is present.
|
|
106
109
|
|
|
107
110
|
## Install
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/loops",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.28",
|
|
4
4
|
"description": "Persistent local loop and workflow runner for deterministic commands and headless AI coding agents",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -110,6 +110,7 @@
|
|
|
110
110
|
"bun": ">=1.0.0"
|
|
111
111
|
},
|
|
112
112
|
"dependencies": {
|
|
113
|
+
"@hasna/contracts": "^0.5.1",
|
|
113
114
|
"@hasna/events": "^0.1.9",
|
|
114
115
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
115
116
|
"@openrouter/ai-sdk-provider": "2.9.1",
|
|
@@ -119,8 +120,7 @@
|
|
|
119
120
|
"zod": "4.4.3"
|
|
120
121
|
},
|
|
121
122
|
"optionalDependencies": {
|
|
122
|
-
"@hasna/machines": "0.0.49"
|
|
123
|
-
"@hasna/contracts": "^0.4.2"
|
|
123
|
+
"@hasna/machines": "0.0.49"
|
|
124
124
|
},
|
|
125
125
|
"devDependencies": {
|
|
126
126
|
"@types/bun": "latest",
|