@igorjpimenta/winch 2026.11.27-beta.1 → 2026.11.27-beta.2

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igorjpimenta/winch",
3
- "version": "2026.11.27-beta.1",
3
+ "version": "2026.11.27-beta.2",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igorjpimenta/winch-openclaw",
3
- "version": "2026.11.27-beta.1",
3
+ "version": "2026.11.27-beta.2",
4
4
  "description": "OpenClaw companion for winch: stamps caller identity on winch MCP tool calls, receives HTTP dispatch wakes, and reconciles in-progress work.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@igorjpimenta/winch-opencode",
3
- "version": "2026.11.27-beta.1",
3
+ "version": "2026.11.27-beta.2",
4
4
  "description": "OpenCode companion for winch: stamps agent and session identity on winch tool calls, receives HTTP dispatch wakes, reports LLM usage, and reconciles assigned in-progress work. No SDK dependency \u2014 a plain id/setup/server export.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -3,6 +3,7 @@
3
3
  // winner starts a session. Item status remains the work acknowledgement.
4
4
 
5
5
  import { HUMAN_AGENT, HUMAN_HARNESS } from "../reserved.js";
6
+ import { readyTasks } from "../ready-queue.js";
6
7
  import { pickConsumer } from "./delivery.js";
7
8
 
8
9
  const RELEASING_STATUSES = new Set(["done", "cancelled", "blocked", "backlog", "review"]);
@@ -208,8 +209,8 @@ export function recover(store, { harness, consumerId = null, at = Date.now(), co
208
209
  const usedHarness = activeHarness + keptOffers.length;
209
210
  const usedGlobal = activeGlobal + otherReserved + keptOffers.length;
210
211
  let free = Math.max(0, Math.min(
211
- config.dispatchHarnessMax - usedHarness,
212
- config.dispatchGlobalMax - usedGlobal,
212
+ (config.dispatchHarnessMax ?? 8) - usedHarness,
213
+ (config.dispatchGlobalMax ?? 16) - usedGlobal,
213
214
  ));
214
215
  if (mutate) for (const row of store.admission.queued(harness, at)) {
215
216
  if (free <= 0 || (consumerId && windowFree <= 0)) break;
@@ -238,6 +239,44 @@ export function recover(store, { harness, consumerId = null, at = Date.now(), co
238
239
  free--;
239
240
  }
240
241
 
242
+ // A ready task whose last admission expired is otherwise dormant: only a new
243
+ // item event would enqueue it again. Recovery is the restart path, so it
244
+ // re-admits ready assigned work for this harness within the same caps.
245
+ if (mutate) for (const candidate of readyTasks(store, { harness, limit: free + 1 })) {
246
+ if (free <= 0 || (consumerId && windowFree <= 0)) break;
247
+ const agent = candidate.task.assignee_agent;
248
+ if (!agent || isHuman(agent, candidate.task.assignee_harness)) continue;
249
+ const busy = store.db.prepare(`
250
+ SELECT 1 FROM admission_queue WHERE item_id=? AND harness=? AND ended_at IS NULL
251
+ `).get(candidate.task.id, harness);
252
+ if (busy) continue;
253
+ const queued = store.admission.enqueue({ kind: "task", itemId: candidate.task.id, harness, agentId: agent, at });
254
+ if (!queued) continue;
255
+ const next = store.admission.markOffered(queued.id, at, {
256
+ pickActive: (attemptNo) => pickConsumer(store, { ...queued, attempt_no: attemptNo }),
257
+ leaseMs: config.dispatchConsumerTtlMs,
258
+ });
259
+ if (!next) continue;
260
+ start.push({
261
+ admissionId: next.id,
262
+ itemId: next.item_id,
263
+ attemptNo: next.attempt_no ?? null,
264
+ kind: next.kind,
265
+ agent: next.agent_id,
266
+ harness: next.harness,
267
+ eventId: next.event_id ?? null,
268
+ offerExpiresAt: at + config.dispatchOfferMs,
269
+ activeConsumerId: next.active_consumer_id ?? null,
270
+ leaseEpoch: next.lease_epoch ?? 0,
271
+ status: "offered",
272
+ });
273
+ if (consumerId) {
274
+ windowFree--;
275
+ store.delivery.markRunning({ admissionId: next.id, attemptNo: next.attempt_no ?? null, consumerId, at });
276
+ }
277
+ free--;
278
+ }
279
+
241
280
  return { resume, start: consumerId ? start.filter((row) => row.activeConsumerId === consumerId) : start, free };
242
281
  }
243
282