@igorjpimenta/winch 2026.11.23-beta.1 → 2026.11.23-beta.3
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/0014_usage_events.sql +30 -0
- package/.migrations/meta/0012_snapshot.json +2 -2
- package/.migrations/meta/0013_snapshot.json +9 -9
- package/.migrations/meta/0014_snapshot.json +2121 -0
- package/.migrations/meta/_journal.json +7 -0
- package/README.md +26 -6
- package/package.json +1 -1
- package/plugins/README.md +11 -0
- package/plugins/openclaw/winch/README.md +24 -1
- package/plugins/openclaw/winch/index.js +24 -3
- package/plugins/openclaw/winch/package.json +3 -2
- 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 +89 -2
- package/src/config.js +7 -0
- package/src/merges.js +147 -12
- package/src/schema.js +30 -0
- package/src/store/artifacts.js +71 -0
- package/src/store/index.js +3 -0
- package/src/store/usage.js +85 -0
- package/src/tools/definitions.js +16 -1
- package/src/tools/index.js +16 -0
- package/src/tools/report.js +59 -4
- package/src/tools/shared.js +9 -0
- package/src/webhook/server.js +57 -0
|
@@ -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
|
+
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"version": "6",
|
|
3
3
|
"dialect": "sqlite",
|
|
4
4
|
"id": "87814314-95fb-4521-9988-42fce3b9ead4",
|
|
5
|
-
"prevId": "
|
|
5
|
+
"prevId": "75303db3-17f1-4026-9ccb-d4e28d3909da",
|
|
6
6
|
"tables": {
|
|
7
7
|
"admission_attempts": {
|
|
8
8
|
"name": "admission_attempts",
|
|
@@ -1781,9 +1781,9 @@
|
|
|
1781
1781
|
}
|
|
1782
1782
|
},
|
|
1783
1783
|
"foreignKeys": {
|
|
1784
|
-
"
|
|
1785
|
-
"name": "
|
|
1786
|
-
"tableFrom": "
|
|
1784
|
+
"webhook_deliveries_admission_id_admission_queue_id_fk": {
|
|
1785
|
+
"name": "webhook_deliveries_admission_id_admission_queue_id_fk",
|
|
1786
|
+
"tableFrom": "webhook_deliveries",
|
|
1787
1787
|
"tableTo": "admission_queue",
|
|
1788
1788
|
"columnsFrom": [
|
|
1789
1789
|
"admission_id"
|
|
@@ -1800,7 +1800,7 @@
|
|
|
1800
1800
|
"checkConstraints": {
|
|
1801
1801
|
"delivery_status": {
|
|
1802
1802
|
"name": "delivery_status",
|
|
1803
|
-
"value": "\"
|
|
1803
|
+
"value": "\"webhook_deliveries\".\"status\" IN ('pending', 'delivering', 'delivered', 'dead', 'cancelled')"
|
|
1804
1804
|
}
|
|
1805
1805
|
}
|
|
1806
1806
|
},
|
|
@@ -1868,10 +1868,10 @@
|
|
|
1868
1868
|
}
|
|
1869
1869
|
},
|
|
1870
1870
|
"foreignKeys": {
|
|
1871
|
-
"
|
|
1872
|
-
"name": "
|
|
1873
|
-
"tableFrom": "
|
|
1874
|
-
"tableTo": "
|
|
1871
|
+
"webhook_delivery_attempts_delivery_id_webhook_deliveries_id_fk": {
|
|
1872
|
+
"name": "webhook_delivery_attempts_delivery_id_webhook_deliveries_id_fk",
|
|
1873
|
+
"tableFrom": "webhook_delivery_attempts",
|
|
1874
|
+
"tableTo": "webhook_deliveries",
|
|
1875
1875
|
"columnsFrom": [
|
|
1876
1876
|
"delivery_id"
|
|
1877
1877
|
],
|