@quantod/qq 1.0.0 → 1.0.1

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.
@@ -50,7 +50,7 @@ push Q/pending "url-3" payload: "url: https://c.com"
50
50
  ```
51
51
 
52
52
  Spawn subagents with instructions like:
53
- > Claim an item from pipeline `0529_a3f9c2` stage `pending`. Open the URL. Extract name, price, availability. Release to `done` appending the fields. If the page fails, release to `failed` appending `error: <reason>`. Repeat until "No items to claim". Report back.
53
+ > Claim an item from pipeline `0529_a3f9c2` stage `pending`. Open the URL. Extract name, price, availability. Release to `done` appending the fields. If the page fails, release to `failed` appending `error: <reason>`. Repeat until claim returns `error: no items to claim`. Report back.
54
54
 
55
55
  Monitor with `status` — done when `pending: [0, 0]` and nothing claimed.
56
56
 
@@ -58,6 +58,14 @@ Monitor with `status` — done when `pending: [0, 0]` and nothing claimed.
58
58
 
59
59
  ## MCP Tools — Full Reference
60
60
 
61
+ Errors are returned uniformly — tools never throw:
62
+ - **MCP**: YAML text `error: <message>`
63
+ - **SDK**: JSON object `{ "error": "<message>" }`
64
+
65
+ The message is identical in both cases. Each command lists its specific errors below.
66
+
67
+ ---
68
+
61
69
  ### make_pipeline
62
70
 
63
71
  Creates a pipeline. Returns its name.
@@ -71,6 +79,9 @@ Returns:
71
79
  pipeline: 0529_a3f9c2
72
80
  ```
73
81
 
82
+ Errors:
83
+ - `error: pipeline <name> already exists` — custom name is already taken
84
+
74
85
  ---
75
86
 
76
87
  ### push
@@ -92,6 +103,11 @@ id: url-1
92
103
 
93
104
  **ID strategy**: use the item's natural stable identity from its origin system — URL, database row id, API object id. Omit id only when items have no upstream identity.
94
105
 
106
+ Errors:
107
+ - `error: item <id> already in the pipeline` — duplicate id; item already exists
108
+ - `error: payload is not valid YAML: <detail>` — `payloadFormat` is `yaml` (default) and payload fails YAML parse
109
+ - `error: payload is not valid JSON: <detail>` — `payloadFormat` is `json` and payload fails JSON parse
110
+
95
111
  ---
96
112
 
97
113
  ### claim
@@ -117,10 +133,8 @@ payload: |
117
133
  url: https://example.com/product/42
118
134
  ```
119
135
 
120
- Returns `error: no items to claim` when nothing is available. **Stop and report back when this happens** — do not retry.
121
-
122
- Errors (MCP YAML / SDK JSON):
123
- - `error: no items to claim` — stage is empty or all items are already claimed. Stop and report back.
136
+ Errors:
137
+ - `error: no items to claim` — stage is empty or all items are already claimed. **Stop and report back — do not retry.**
124
138
  - `error: item <id> not found` — only when claiming by specific `id`
125
139
  - `error: item <id> already claimed` — only when claiming by specific `id`
126
140
 
@@ -146,7 +160,11 @@ Returns:
146
160
  ok: true
147
161
  ```
148
162
 
149
- Fails if the claim expired (item was unstuck while you worked) or item is not claimed.
163
+ Errors:
164
+ - `error: claim on seq <n> expired` — seq no longer exists; item was unstuck while you held the claim
165
+ - `error: item seq <n> not claimed` — seq exists but the item is not currently claimed
166
+ - `error: payload is not valid YAML: <detail>` — `payloadFormat` is `yaml` (default) and payload fails YAML parse
167
+ - `error: payload is not valid JSON: <detail>` — `payloadFormat` is `json` and payload fails JSON parse
150
168
 
151
169
  **Payload is append-only history by default.** Each stage appends its output — resulting duplicate YAML fields are intentional. Use `replace: true` only when treating payload as a structured object you own.
152
170
 
@@ -171,6 +189,9 @@ stats:
171
189
 
172
190
  Each value is `[total, claimed]` — total item count and how many are currently claimed (being processed). `*` is the pipeline-level aggregate across all stages. For nested stages (`enriched/shortlisted`), intermediate paths are included as aggregates of their children. `description` is `null` if none was set.
173
191
 
192
+ Errors:
193
+ - `error: pipeline <name> not found`
194
+
174
195
  ---
175
196
 
176
197
  ### batch_read
@@ -262,9 +283,7 @@ QQ.status(pipeline) → Promise<{ description:
262
283
  - `release` opts: `target` (string), `payload` (string), `replace` (boolean), `priority` (number), `payloadFormat`
263
284
  - `batch_read` opts: `includePayload` (boolean), `claimed` (boolean), `ids` (string, comma-separated), `createdAfter`, `createdBefore`, `modifiedAfter` (epoch ms), `limit`, `offset` (number)
264
285
 
265
- All functions return `{ error: string }` on failure — never throw (except `BridgeError` for network connection failures). Check `result.error` before using the result.
266
-
267
- `claim` returns `{ error: "no items to claim" }` when nothing is available.
286
+ All functions return `{ error: string }` on failure — never throw (except `BridgeError` for network connection failures).
268
287
 
269
288
  Item shape (returned by `claim` and `batch_read`):
270
289
  ```
@@ -283,7 +302,7 @@ qq_batch_read(pipeline, stage, **opts) → list[dict] | { 'err
283
302
  qq_status(pipeline) → { 'description': str|None, 'stats': dict } | { 'error': str }
284
303
  ```
285
304
 
286
- All Python functions return `{ 'error': str }` on failure — never raise (except `BridgeError` for connection failures).
305
+ All Python functions return `{ 'error': str }` on failure — never raise (except `BridgeError` for connection failures). Error messages are identical to those in the MCP tool reference above.
287
306
 
288
307
  ---
289
308
 
@@ -320,7 +339,10 @@ item-2: duplicate
320
339
  item-3: error: <message>
321
340
  ```
322
341
 
323
- File-level parse errors (bad JSON, malformed CSV, etc.) abort the entire operation. Per-record push failures are reported individually without aborting remaining records.
342
+ Per-record push failures are reported inline (`item-1: error: <message>`) without aborting remaining records.
343
+
344
+ Errors:
345
+ - `error: <message>` — file-level failure (file not found, unsupported extension, malformed file). Entire operation aborted; no records are pushed.
324
346
 
325
347
  ---
326
348
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quantod/qq",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "Persistent queue for multi-stage Claude agent pipelines",
5
5
  "license": "UNLICENSED",
6
6
  "engines": {
@@ -50,7 +50,7 @@ push Q/pending "url-3" payload: "url: https://c.com"
50
50
  ```
51
51
 
52
52
  Spawn subagents with instructions like:
53
- > Claim an item from pipeline `0529_a3f9c2` stage `pending`. Open the URL. Extract name, price, availability. Release to `done` appending the fields. If the page fails, release to `failed` appending `error: <reason>`. Repeat until "No items to claim". Report back.
53
+ > Claim an item from pipeline `0529_a3f9c2` stage `pending`. Open the URL. Extract name, price, availability. Release to `done` appending the fields. If the page fails, release to `failed` appending `error: <reason>`. Repeat until claim returns `error: no items to claim`. Report back.
54
54
 
55
55
  Monitor with `status` — done when `pending: [0, 0]` and nothing claimed.
56
56
 
@@ -58,6 +58,14 @@ Monitor with `status` — done when `pending: [0, 0]` and nothing claimed.
58
58
 
59
59
  ## MCP Tools — Full Reference
60
60
 
61
+ Errors are returned uniformly — tools never throw:
62
+ - **MCP**: YAML text `error: <message>`
63
+ - **SDK**: JSON object `{ "error": "<message>" }`
64
+
65
+ The message is identical in both cases. Each command lists its specific errors below.
66
+
67
+ ---
68
+
61
69
  ### make_pipeline
62
70
 
63
71
  Creates a pipeline. Returns its name.
@@ -71,6 +79,9 @@ Returns:
71
79
  pipeline: 0529_a3f9c2
72
80
  ```
73
81
 
82
+ Errors:
83
+ - `error: pipeline <name> already exists` — custom name is already taken
84
+
74
85
  ---
75
86
 
76
87
  ### push
@@ -92,6 +103,11 @@ id: url-1
92
103
 
93
104
  **ID strategy**: use the item's natural stable identity from its origin system — URL, database row id, API object id. Omit id only when items have no upstream identity.
94
105
 
106
+ Errors:
107
+ - `error: item <id> already in the pipeline` — duplicate id; item already exists
108
+ - `error: payload is not valid YAML: <detail>` — `payloadFormat` is `yaml` (default) and payload fails YAML parse
109
+ - `error: payload is not valid JSON: <detail>` — `payloadFormat` is `json` and payload fails JSON parse
110
+
95
111
  ---
96
112
 
97
113
  ### claim
@@ -117,10 +133,8 @@ payload: |
117
133
  url: https://example.com/product/42
118
134
  ```
119
135
 
120
- Returns `error: no items to claim` when nothing is available. **Stop and report back when this happens** — do not retry.
121
-
122
- Errors (MCP YAML / SDK JSON):
123
- - `error: no items to claim` — stage is empty or all items are already claimed. Stop and report back.
136
+ Errors:
137
+ - `error: no items to claim` — stage is empty or all items are already claimed. **Stop and report back — do not retry.**
124
138
  - `error: item <id> not found` — only when claiming by specific `id`
125
139
  - `error: item <id> already claimed` — only when claiming by specific `id`
126
140
 
@@ -146,7 +160,11 @@ Returns:
146
160
  ok: true
147
161
  ```
148
162
 
149
- Fails if the claim expired (item was unstuck while you worked) or item is not claimed.
163
+ Errors:
164
+ - `error: claim on seq <n> expired` — seq no longer exists; discard your work
165
+ - `error: item seq <n> not claimed` — items should be claimed before releasing - likely bug
166
+ - `error: payload is not valid YAML: <detail>` — `payloadFormat` is `yaml` (default) and payload fails YAML parse
167
+ - `error: payload is not valid JSON: <detail>` — `payloadFormat` is `json` and payload fails JSON parse
150
168
 
151
169
  **Payload is append-only history by default.** Each stage appends its output — resulting duplicate YAML fields are intentional. Use `replace: true` only when treating payload as a structured object you own.
152
170
 
@@ -171,6 +189,9 @@ stats:
171
189
 
172
190
  Each value is `[total, claimed]` — total item count and how many are currently claimed (being processed). `*` is the pipeline-level aggregate across all stages. For nested stages (`enriched/shortlisted`), intermediate paths are included as aggregates of their children. `description` is `null` if none was set.
173
191
 
192
+ Errors:
193
+ - `error: pipeline <name> not found`
194
+
174
195
  ---
175
196
 
176
197
  ### batch_read
@@ -262,9 +283,7 @@ QQ.status(pipeline) → Promise<{ description:
262
283
  - `release` opts: `target` (string), `payload` (string), `replace` (boolean), `priority` (number), `payloadFormat`
263
284
  - `batch_read` opts: `includePayload` (boolean), `claimed` (boolean), `ids` (string, comma-separated), `createdAfter`, `createdBefore`, `modifiedAfter` (epoch ms), `limit`, `offset` (number)
264
285
 
265
- All functions return `{ error: string }` on failure — never throw (except `BridgeError` for network connection failures). Check `result.error` before using the result.
266
-
267
- `claim` returns `{ error: "no items to claim" }` when nothing is available.
286
+ All functions return `{ error: string }` on failure — never throw (except `BridgeError` for network connection failures).
268
287
 
269
288
  Item shape (returned by `claim` and `batch_read`):
270
289
  ```
@@ -283,7 +302,7 @@ qq_batch_read(pipeline, stage, **opts) → list[dict] | { 'err
283
302
  qq_status(pipeline) → { 'description': str|None, 'stats': dict } | { 'error': str }
284
303
  ```
285
304
 
286
- All Python functions return `{ 'error': str }` on failure — never raise (except `BridgeError` for connection failures).
305
+ All Python functions return `{ 'error': str }` on failure — never raise (except `BridgeError` for connection failures). Error messages are identical to those in the MCP tool reference above.
287
306
 
288
307
  ---
289
308
 
@@ -320,7 +339,10 @@ item-2: duplicate
320
339
  item-3: error: <message>
321
340
  ```
322
341
 
323
- File-level parse errors (bad JSON, malformed CSV, etc.) abort the entire operation. Per-record push failures are reported individually without aborting remaining records.
342
+ Per-record push failures are reported inline (`item-1: error: <message>`) without aborting remaining records.
343
+
344
+ Errors:
345
+ - `error: <message>` — file-level failure (file not found, unsupported extension, malformed file). Entire operation aborted; no records are pushed.
324
346
 
325
347
  ---
326
348