@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/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;
@@ -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 are preview-only until the control-plane API exposes
90
- id-preserving import endpoints:
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
- The preview may inspect `LOOPS_API_URL`/`HASNA_LOOPS_API_URL`, but it refuses
99
- remote apply because normal loop CRUD would generate new ids. Use
100
- `loops self-hosted runner-register` to verify runner registration against an
101
- API, then use `loops-runner run-once` for the current bounded non-workflow
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; the standalone
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.27",
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",