@igorjpimenta/winch 2026.11.23-beta.3 → 2026.11.24-beta.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.
package/README.md
CHANGED
|
@@ -129,6 +129,27 @@ is the single scheduler:
|
|
|
129
129
|
and ring `/dispatch/notify` on `WINCH_DISPATCH_URL`; the interval pump is
|
|
130
130
|
recovery, not routing.
|
|
131
131
|
|
|
132
|
+
**Prerequisite: one subscription per harness, before anything can wake.**
|
|
133
|
+
The pump only offers queued admissions to harnesses present in the
|
|
134
|
+
`webhooks` table, so assigning with no matching subscription succeeds but
|
|
135
|
+
never delivers — the admissions sit `queued` with no attempts while the
|
|
136
|
+
dispatch server looks healthy. `backlog_plan` reports this as
|
|
137
|
+
`warning: { code: "no_route" }` when no subscription is registered at all,
|
|
138
|
+
and `backlog_assign` reports it per harness. Register the receiver first:
|
|
139
|
+
|
|
140
|
+
```sh
|
|
141
|
+
winch webhook bearer # prints a receiver token, store it for the receiver
|
|
142
|
+
winch webhook register --topic dispatch --harness <harness> \
|
|
143
|
+
--url <receiver-url> --bearer <token>
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Manual rows are never swept; `winch webhook revoke --topic dispatch --id <id>`
|
|
147
|
+
removes one. Harness plugins register themselves instead (below), but only if
|
|
148
|
+
`WINCH_DISPATCH_URL` matches the port `winch webhook serve` is actually
|
|
149
|
+
listening on — the default is `38293`, and a `serve --port 38493` with
|
|
150
|
+
`WINCH_DISPATCH_URL` still on `38293` leaves `webhooks` empty while both
|
|
151
|
+
processes run.
|
|
152
|
+
|
|
132
153
|
Adapters register one route per `WINCH_CONSUMER_ID` (default
|
|
133
154
|
`harness:hostname`), with `WINCH_EXECUTOR_ID` as the live instance and a
|
|
134
155
|
`WINCH_WEBHOOK_BEARER` generated by `winch webhook bearer`. Registration is a
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@igorjpimenta/winch-openclaw",
|
|
3
|
-
"version": "2026.11.
|
|
3
|
+
"version": "2026.11.24-beta.1",
|
|
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.
|
|
3
|
+
"version": "2026.11.24-beta.1",
|
|
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",
|
package/src/tools/assign.js
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
// stamped from the caller's declared transport identity, so an assignment can
|
|
5
5
|
// never name an agent without saying which harness it belongs to. The reserved
|
|
6
6
|
// agent `human` gets the reserved harness `human_in_the_loop` instead.
|
|
7
|
-
import { ok, err } from "./shared.js";
|
|
7
|
+
import { ok, err, noRouteWarning } from "./shared.js";
|
|
8
8
|
|
|
9
9
|
export function createAssignTools({ store, logger }) {
|
|
10
10
|
return {
|
|
@@ -38,9 +38,13 @@ export function createAssignTools({ store, logger }) {
|
|
|
38
38
|
note: `assign ${assigned ?? "nobody"}`,
|
|
39
39
|
});
|
|
40
40
|
logger?.info?.(`backlog: ${qualified} assigned ${story.id} -> ${assigned ?? "nobody"}`);
|
|
41
|
+
// Wake signal only when the write actually enqueued: routesForEvent
|
|
42
|
+
// admits story.assigned solely from ready.
|
|
43
|
+
const warning = updated.status === "ready" ? noRouteWarning(store, updated.assignee_harness) : null;
|
|
44
|
+
if (warning) logger?.warn?.(`backlog: ${warning.message}`);
|
|
41
45
|
return ok(
|
|
42
|
-
JSON.stringify({ ok: true, story: { id: updated.id, status: updated.status, assigned: updated.assignee_agent, capabilities: updated.capabilities } }),
|
|
43
|
-
{ status: "ok", level: "story", id: updated.id, assigned: updated.assignee_agent, agent: identity.agent }
|
|
46
|
+
JSON.stringify({ ok: true, story: { id: updated.id, status: updated.status, assigned: updated.assignee_agent, capabilities: updated.capabilities }, ...(warning ? { warning } : {}) }),
|
|
47
|
+
{ status: "ok", level: "story", id: updated.id, assigned: updated.assignee_agent, agent: identity.agent, ...(warning ? { warning } : {}) }
|
|
44
48
|
);
|
|
45
49
|
} catch (e) {
|
|
46
50
|
return err(`backlog_assign failed: ${e?.message}`, "rejected", { id: story.id });
|
|
@@ -63,9 +67,13 @@ export function createAssignTools({ store, logger }) {
|
|
|
63
67
|
capabilities: args?.capabilities,
|
|
64
68
|
});
|
|
65
69
|
logger?.info?.(`backlog: ${qualified} assigned ${task.id} -> ${updated.assignee_agent ?? "nobody"}`);
|
|
70
|
+
// Wake signal only when the write actually enqueued: routesForEvent
|
|
71
|
+
// admits task.assigned solely from ready.
|
|
72
|
+
const warning = updated.status === "ready" ? noRouteWarning(store, updated.assignee_harness) : null;
|
|
73
|
+
if (warning) logger?.warn?.(`backlog: ${warning.message}`);
|
|
66
74
|
return ok(
|
|
67
|
-
JSON.stringify({ ok: true, task: { id: updated.id, status: updated.status, assigned: updated.assignee_agent, capabilities: updated.capabilities } }),
|
|
68
|
-
{ status: "ok", taskId: updated.id, assigned: updated.assignee_agent, agent: identity.agent }
|
|
75
|
+
JSON.stringify({ ok: true, task: { id: updated.id, status: updated.status, assigned: updated.assignee_agent, capabilities: updated.capabilities }, ...(warning ? { warning } : {}) }),
|
|
76
|
+
{ status: "ok", taskId: updated.id, assigned: updated.assignee_agent, agent: identity.agent, ...(warning ? { warning } : {}) }
|
|
69
77
|
);
|
|
70
78
|
} catch (e) {
|
|
71
79
|
return err(`backlog_assign failed: ${e?.message}`, "rejected", { taskId: task.id });
|
package/src/tools/definitions.js
CHANGED
|
@@ -35,7 +35,8 @@ export const TOOL_DEFS = [
|
|
|
35
35
|
"`backlog_append`, unassigned, so the planner can route them — use story assignment when the breakdown is not known at plan time. " +
|
|
36
36
|
"Refuses to reassign a task already in progress by someone else. Passing `agent: null` or \"\" clears it. " +
|
|
37
37
|
"The reserved agent `human` assigns human work with the reserved harness `human_in_the_loop`. " +
|
|
38
|
-
"Optional `capabilities` replaces the item's capability tags."
|
|
38
|
+
"Optional `capabilities` replaces the item's capability tags. " +
|
|
39
|
+
"A successful result may carry `warning.code: \"no_route\"` when no enabled dispatch subscription matches the harness — the row is ready but will not wake until a receiver is registered.",
|
|
39
40
|
inputSchema: {
|
|
40
41
|
type: "object",
|
|
41
42
|
additionalProperties: false,
|
|
@@ -91,7 +92,8 @@ export const TOOL_DEFS = [
|
|
|
91
92
|
"protocols a demand — the spec goes INTO the records (task description, story acceptance, capability tags), because a " +
|
|
92
93
|
"worker receives only a task id and reads the record itself. Tasks land `backlog`; assigning one moves it to `ready`. Use " +
|
|
93
94
|
"`backlog_assign`. `dependsOn` references other tasks in the same plan by key (default `s<story>t<task>`, zero-based) " +
|
|
94
|
-
"and may only point backward, so the plan is acyclic by construction. All-or-nothing: an invalid key rolls back the plan."
|
|
95
|
+
"and may only point backward, so the plan is acyclic by construction. All-or-nothing: an invalid key rolls back the plan. " +
|
|
96
|
+
"A successful result may carry `warning.code: \"no_route\"` when no dispatch subscription is registered at all — nothing can wake until a receiver is.",
|
|
95
97
|
inputSchema: {
|
|
96
98
|
type: "object",
|
|
97
99
|
additionalProperties: false,
|
package/src/tools/plan.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// plan.js — create and reshape the plan: plan, append, drop, restore.
|
|
2
2
|
import { addDep } from "../deps.js";
|
|
3
|
-
import { ok, err } from "./shared.js";
|
|
3
|
+
import { ok, err, noSubscriptionWarning } from "./shared.js";
|
|
4
4
|
|
|
5
5
|
export function createPlanTools({ store, logger }) {
|
|
6
6
|
return {
|
|
@@ -82,9 +82,11 @@ export function createPlanTools({ store, logger }) {
|
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
logger?.info?.(`backlog: ${identity.harness}:${identity.agent} planned ${epic.id} (${flat.length} tasks)`);
|
|
85
|
+
const warning = noSubscriptionWarning(store);
|
|
86
|
+
if (warning) logger?.warn?.(`backlog: ${warning.message}`);
|
|
85
87
|
return ok(
|
|
86
|
-
JSON.stringify({ epic: { id: epic.id, title: epic.title }, stories, dependencies }),
|
|
87
|
-
{ status: "ok", agentId: identity.agent, epicId: epic.id, tasks: flat.length }
|
|
88
|
+
JSON.stringify({ epic: { id: epic.id, title: epic.title }, stories, dependencies, ...(warning ? { warning } : {}) }),
|
|
89
|
+
{ status: "ok", agentId: identity.agent, epicId: epic.id, tasks: flat.length, ...(warning ? { warning } : {}) }
|
|
88
90
|
);
|
|
89
91
|
} catch (e) {
|
|
90
92
|
// The epic is the root; deleting it cascades everything written under it.
|
package/src/tools/shared.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
// shared.js — the pieces every tool handler needs: result shapes, note
|
|
2
2
|
// clamping, and the store-derived handoff text.
|
|
3
3
|
|
|
4
|
+
import { HUMAN_HARNESS } from "../reserved.js";
|
|
5
|
+
import { consumersFor } from "../webhook/delivery.js";
|
|
6
|
+
|
|
4
7
|
export function ok(text, details) {
|
|
5
8
|
return { content: [{ type: "text", text }], details };
|
|
6
9
|
}
|
|
@@ -26,6 +29,43 @@ export function clampNote(s, max = 2000) {
|
|
|
26
29
|
return s.length > max ? s.slice(0, max) + "…" : s;
|
|
27
30
|
}
|
|
28
31
|
|
|
32
|
+
// no_route: dispatch only offers admissions to harnesses that have an enabled
|
|
33
|
+
// subscription (the pump's `reachable` set), and delivery fans out through the
|
|
34
|
+
// same `consumersFor` predicate — so an assignment whose harness matches no
|
|
35
|
+
// subscription can never be woken, however healthy the dispatch server looks.
|
|
36
|
+
// The reserved human harness never routes by design, so it never warns.
|
|
37
|
+
export function noRouteWarning(store, harness) {
|
|
38
|
+
if (!harness || harness === HUMAN_HARNESS) return null;
|
|
39
|
+
if (consumersFor(store, harness).length > 0) return null;
|
|
40
|
+
return {
|
|
41
|
+
code: "no_route",
|
|
42
|
+
harness,
|
|
43
|
+
message:
|
|
44
|
+
`no enabled dispatch subscription matches harness "${harness}"; ` +
|
|
45
|
+
`this assignment is ready but unroutable. Register a receiver first: ` +
|
|
46
|
+
`winch webhook register --topic dispatch --harness ${harness} --url <receiver-url> --bearer <token> ` +
|
|
47
|
+
`or run the harness plugin with WINCH_EXECUTOR_ID + WINCH_WEBHOOK_BEARER ` +
|
|
48
|
+
`(WINCH_DISPATCH_URL must match the port winch webhook serve is listening on, default 38293).`,
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Plan-time variant: nothing is assigned yet, but every wake the plan will
|
|
53
|
+
// produce (assignment, epic-creator fan-out) needs at least one subscription
|
|
54
|
+
// to exist. With zero subscriptions the whole pipeline is inert.
|
|
55
|
+
export function noSubscriptionWarning(store) {
|
|
56
|
+
if (store.webhook.harnesses({ topic: "dispatch" }).length > 0) return null;
|
|
57
|
+
return {
|
|
58
|
+
code: "no_route",
|
|
59
|
+
harness: null,
|
|
60
|
+
message:
|
|
61
|
+
`no dispatch subscriptions are registered; assigned rows will queue but nothing can deliver a wake. ` +
|
|
62
|
+
`Register a receiver first: ` +
|
|
63
|
+
`winch webhook register --topic dispatch --harness <harness> --url <receiver-url> --bearer <token> ` +
|
|
64
|
+
`or run the harness plugin with WINCH_EXECUTOR_ID + WINCH_WEBHOOK_BEARER ` +
|
|
65
|
+
`(WINCH_DISPATCH_URL must match the port winch webhook serve is listening on, default 38293).`,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
29
69
|
// Artifacts upstream tasks recorded on this story: addArtifact events,
|
|
30
70
|
// explicit artifact rows, and done-result artifact lists, deduped.
|
|
31
71
|
export function collectStoryArtifacts(store, storyId) {
|