@igorjpimenta/winch 2026.11.22-beta.3 → 2026.11.23-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/.migrations/0013_webhook_delivery_tables.sql +2 -0
- package/.migrations/0014_usage_events.sql +30 -0
- package/.migrations/meta/0012_snapshot.json +2 -2
- package/.migrations/meta/0013_snapshot.json +1900 -0
- package/.migrations/meta/0014_snapshot.json +2121 -0
- package/.migrations/meta/_journal.json +15 -1
- package/README.md +27 -43
- package/package.json +1 -1
- package/plugins/README.md +13 -2
- package/plugins/openclaw/winch/README.md +7 -1
- package/plugins/openclaw/winch/index.js +24 -3
- package/plugins/openclaw/winch/package.json +2 -1
- package/plugins/openclaw/winch/usage.js +111 -0
- package/plugins/opencode/winch/hooks.js +16 -2
- package/plugins/opencode/winch/index.js +20 -2
- package/plugins/opencode/winch/package.json +4 -3
- package/plugins/opencode/winch/usage.js +120 -0
- package/src/cli.js +5 -16
- package/src/config.js +3 -7
- package/src/schema.js +33 -3
- package/src/store/delivery.js +16 -16
- package/src/store/events.js +1 -1
- package/src/store/index.js +5 -2
- package/src/store/usage.js +85 -0
- package/src/tools/assign.js +1 -1
- package/src/tools/definitions.js +0 -1
- package/src/tools/index.js +16 -0
- package/src/watcher.js +3 -13
- package/src/{dispatch.js → webhook/core.js} +4 -12
- package/src/{dispatch-webhook.js → webhook/delivery.js} +2 -2
- package/src/webhook/envelope.js +131 -0
- package/src/{dispatch-server.js → webhook/server.js} +65 -12
- package/src/events-ws.js +0 -269
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
CREATE TABLE `usage_events` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`item_id` text NOT NULL,
|
|
4
|
+
`session_id` text,
|
|
5
|
+
`attempt_id` text,
|
|
6
|
+
`harness` text NOT NULL,
|
|
7
|
+
`agent_id` text NOT NULL,
|
|
8
|
+
`external_session_id` text NOT NULL,
|
|
9
|
+
`model` text,
|
|
10
|
+
`tokens_in` integer,
|
|
11
|
+
`tokens_out` integer,
|
|
12
|
+
`cache_read` integer,
|
|
13
|
+
`cost_usd` real,
|
|
14
|
+
`tool_calls` integer,
|
|
15
|
+
`source` text DEFAULT 'api' NOT NULL,
|
|
16
|
+
`turn_ref` text,
|
|
17
|
+
`created_at` integer NOT NULL,
|
|
18
|
+
FOREIGN KEY (`item_id`) REFERENCES `items`(`id`) ON UPDATE no action ON DELETE restrict,
|
|
19
|
+
FOREIGN KEY (`session_id`) REFERENCES `work_sessions`(`id`) ON UPDATE no action ON DELETE set null,
|
|
20
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE set null,
|
|
21
|
+
CONSTRAINT "usage_source" CHECK("usage_events"."source" IN ('api')),
|
|
22
|
+
CONSTRAINT "usage_nonneg" CHECK(("usage_events"."tokens_in" IS NULL OR "usage_events"."tokens_in" >= 0) AND ("usage_events"."tokens_out" IS NULL OR "usage_events"."tokens_out" >= 0) AND ("usage_events"."cache_read" IS NULL OR "usage_events"."cache_read" >= 0) AND ("usage_events"."cost_usd" IS NULL OR "usage_events"."cost_usd" >= 0) AND ("usage_events"."tool_calls" IS NULL OR "usage_events"."tool_calls" >= 0))
|
|
23
|
+
);
|
|
24
|
+
--> statement-breakpoint
|
|
25
|
+
CREATE INDEX `idx_usage_item` ON `usage_events` (`item_id`);--> statement-breakpoint
|
|
26
|
+
CREATE INDEX `idx_usage_session` ON `usage_events` (`session_id`);--> statement-breakpoint
|
|
27
|
+
CREATE INDEX `idx_usage_attempt` ON `usage_events` (`attempt_id`);--> statement-breakpoint
|
|
28
|
+
CREATE INDEX `idx_usage_created` ON `usage_events` (`created_at`);--> statement-breakpoint
|
|
29
|
+
CREATE INDEX `idx_usage_identity` ON `usage_events` (`harness`,`agent_id`,`external_session_id`);--> statement-breakpoint
|
|
30
|
+
CREATE UNIQUE INDEX `uq_usage_turn` ON `usage_events` (`harness`,`agent_id`,`external_session_id`,`turn_ref`) WHERE "usage_events"."turn_ref" IS NOT NULL;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": "6",
|
|
3
3
|
"dialect": "sqlite",
|
|
4
|
-
"id": "
|
|
4
|
+
"id": "75303db3-17f1-4026-9ccb-d4e28d3909da",
|
|
5
5
|
"prevId": "28f4b593-644f-4990-a26d-f8011defb590",
|
|
6
6
|
"tables": {
|
|
7
7
|
"admission_attempts": {
|
|
@@ -1897,4 +1897,4 @@
|
|
|
1897
1897
|
"internal": {
|
|
1898
1898
|
"indexes": {}
|
|
1899
1899
|
}
|
|
1900
|
-
}
|
|
1900
|
+
}
|