@igorjpimenta/brayer 0.0.0-stage → 2026.10.28-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/.migrations/0000_initial.sql +133 -0
- package/.migrations/0001_awesome_ben_parker.sql +8 -0
- package/.migrations/meta/0000_snapshot.json +931 -0
- package/.migrations/meta/0001_snapshot.json +983 -0
- package/.migrations/meta/_journal.json +20 -0
- package/LICENSE +21 -0
- package/README.md +245 -2
- package/bin/brayer.js +7 -0
- package/package.json +42 -4
- package/plugins/openclaw/brayer/index.js +119 -0
- package/plugins/openclaw/brayer/meta.js +23 -0
- package/plugins/openclaw/brayer/openclaw.plugin.json +14 -0
- package/plugins/openclaw/brayer/package.json +37 -0
- package/plugins/openclaw/brayer/session.js +30 -0
- package/plugins/openclaw/brayer/webhook.js +125 -0
- package/plugins/opencode/brayer/identity.js +11 -0
- package/plugins/opencode/brayer/index.js +92 -0
- package/plugins/opencode/brayer/package.json +27 -0
- package/plugins/opencode/brayer/session.js +25 -0
- package/plugins/shared/contract.js +193 -0
- package/plugins/wake/brayer/bin/brayer-wake.js +7 -0
- package/plugins/wake/brayer/index.js +125 -0
- package/plugins/wake/brayer/package.json +29 -0
- package/src/claim-webhook.js +66 -0
- package/src/cli.js +164 -0
- package/src/config.js +63 -0
- package/src/db.js +24 -0
- package/src/events-ws.js +121 -0
- package/src/evidence.js +42 -0
- package/src/identity.js +32 -0
- package/src/ids.js +17 -0
- package/src/mcp.js +114 -0
- package/src/schema.js +168 -0
- package/src/store/attempts.js +103 -0
- package/src/store/checkpoints.js +76 -0
- package/src/store/claims.js +139 -0
- package/src/store/events.js +24 -0
- package/src/store/evidence.js +67 -0
- package/src/store/orders.js +70 -0
- package/src/store/resume.js +38 -0
- package/src/store/rows.js +118 -0
- package/src/store/util.js +3 -0
- package/src/store/verdicts.js +61 -0
- package/src/store/webhooks.js +56 -0
- package/src/store.js +53 -0
- package/src/tools/attempts.js +75 -0
- package/src/tools/handoff.js +120 -0
- package/src/tools/index.js +28 -0
- package/src/tools/orders.js +146 -0
- package/src/tools/shared.js +7 -0
- package/src/tools/verdicts.js +46 -0
- package/src/version.js +5 -0
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
CREATE TABLE `attempts` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`work_order_id` text NOT NULL,
|
|
4
|
+
`harness` text NOT NULL,
|
|
5
|
+
`agent` text NOT NULL,
|
|
6
|
+
`session_ref` text,
|
|
7
|
+
`model` text,
|
|
8
|
+
`status` text NOT NULL,
|
|
9
|
+
`started_at` integer NOT NULL,
|
|
10
|
+
`ended_at` integer,
|
|
11
|
+
`tokens_in` integer DEFAULT 0 NOT NULL,
|
|
12
|
+
`tokens_out` integer DEFAULT 0 NOT NULL,
|
|
13
|
+
`cache_read` integer DEFAULT 0 NOT NULL,
|
|
14
|
+
`cost_usd` real DEFAULT 0 NOT NULL,
|
|
15
|
+
`tool_calls` integer DEFAULT 0 NOT NULL,
|
|
16
|
+
`error` text,
|
|
17
|
+
`checkpoint_id` text,
|
|
18
|
+
FOREIGN KEY (`work_order_id`) REFERENCES `work_orders`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
19
|
+
CONSTRAINT "attempts_status" CHECK("attempts"."status" IN ('running', 'finished', 'failed', 'abandoned'))
|
|
20
|
+
);
|
|
21
|
+
--> statement-breakpoint
|
|
22
|
+
CREATE INDEX `idx_attempts_order` ON `attempts` (`work_order_id`);--> statement-breakpoint
|
|
23
|
+
CREATE TABLE `checkpoints` (
|
|
24
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
25
|
+
`work_order_id` text NOT NULL,
|
|
26
|
+
`attempt_id` text NOT NULL,
|
|
27
|
+
`kind` text NOT NULL,
|
|
28
|
+
`goal` text,
|
|
29
|
+
`state_json` text NOT NULL,
|
|
30
|
+
`summary` text,
|
|
31
|
+
`confidence` real,
|
|
32
|
+
`resume_recipe` text,
|
|
33
|
+
`tree_hash` text,
|
|
34
|
+
`created_at` integer NOT NULL,
|
|
35
|
+
FOREIGN KEY (`work_order_id`) REFERENCES `work_orders`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
36
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE cascade
|
|
37
|
+
);
|
|
38
|
+
--> statement-breakpoint
|
|
39
|
+
CREATE INDEX `idx_checkpoints_order` ON `checkpoints` (`work_order_id`);--> statement-breakpoint
|
|
40
|
+
CREATE INDEX `idx_checkpoints_attempt` ON `checkpoints` (`attempt_id`);--> statement-breakpoint
|
|
41
|
+
CREATE TABLE `events` (
|
|
42
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
43
|
+
`work_order_id` text NOT NULL,
|
|
44
|
+
`attempt_id` text,
|
|
45
|
+
`from_status` text,
|
|
46
|
+
`to_status` text,
|
|
47
|
+
`kind` text,
|
|
48
|
+
`actor` text,
|
|
49
|
+
`note` text,
|
|
50
|
+
`session_ref` text,
|
|
51
|
+
`at` integer NOT NULL,
|
|
52
|
+
FOREIGN KEY (`work_order_id`) REFERENCES `work_orders`(`id`) ON UPDATE no action ON DELETE cascade
|
|
53
|
+
);
|
|
54
|
+
--> statement-breakpoint
|
|
55
|
+
CREATE INDEX `idx_events_order` ON `events` (`work_order_id`);--> statement-breakpoint
|
|
56
|
+
CREATE TABLE `evidence` (
|
|
57
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
58
|
+
`work_order_id` text NOT NULL,
|
|
59
|
+
`attempt_id` text NOT NULL,
|
|
60
|
+
`kind` text NOT NULL,
|
|
61
|
+
`uri` text NOT NULL,
|
|
62
|
+
`sha256` text NOT NULL,
|
|
63
|
+
`summary` text,
|
|
64
|
+
`command` text,
|
|
65
|
+
`exit_code` integer,
|
|
66
|
+
`status` text,
|
|
67
|
+
`verifier` text,
|
|
68
|
+
`created_at` integer NOT NULL,
|
|
69
|
+
FOREIGN KEY (`work_order_id`) REFERENCES `work_orders`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
70
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
71
|
+
CONSTRAINT "evidence_kind" CHECK("evidence"."kind" IN ('diff', 'test', 'lint', 'screenshot', 'artifact', 'log'))
|
|
72
|
+
);
|
|
73
|
+
--> statement-breakpoint
|
|
74
|
+
CREATE INDEX `idx_evidence_order` ON `evidence` (`work_order_id`);--> statement-breakpoint
|
|
75
|
+
CREATE INDEX `idx_evidence_attempt` ON `evidence` (`attempt_id`);--> statement-breakpoint
|
|
76
|
+
CREATE TABLE `playbooks` (
|
|
77
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
78
|
+
`name` text NOT NULL,
|
|
79
|
+
`version` integer DEFAULT 1 NOT NULL,
|
|
80
|
+
`trigger` text,
|
|
81
|
+
`procedure` text NOT NULL,
|
|
82
|
+
`provenance` text,
|
|
83
|
+
`eval_score` real,
|
|
84
|
+
`status` text DEFAULT 'draft' NOT NULL,
|
|
85
|
+
`created_at` integer NOT NULL
|
|
86
|
+
);
|
|
87
|
+
--> statement-breakpoint
|
|
88
|
+
CREATE TABLE `verdicts` (
|
|
89
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
90
|
+
`work_order_id` text NOT NULL,
|
|
91
|
+
`attempt_id` text,
|
|
92
|
+
`decision` text NOT NULL,
|
|
93
|
+
`reason` text,
|
|
94
|
+
`actor` text NOT NULL,
|
|
95
|
+
`policy` text,
|
|
96
|
+
`evidence_ids` text,
|
|
97
|
+
`created_at` integer NOT NULL,
|
|
98
|
+
FOREIGN KEY (`work_order_id`) REFERENCES `work_orders`(`id`) ON UPDATE no action ON DELETE cascade,
|
|
99
|
+
FOREIGN KEY (`attempt_id`) REFERENCES `attempts`(`id`) ON UPDATE no action ON DELETE set null,
|
|
100
|
+
CONSTRAINT "verdicts_decision" CHECK("verdicts"."decision" IN ('approve', 'reject', 'escalate', 'rollback'))
|
|
101
|
+
);
|
|
102
|
+
--> statement-breakpoint
|
|
103
|
+
CREATE INDEX `idx_verdicts_order` ON `verdicts` (`work_order_id`);--> statement-breakpoint
|
|
104
|
+
CREATE TABLE `work_orders` (
|
|
105
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
106
|
+
`title` text NOT NULL,
|
|
107
|
+
`goal` text NOT NULL,
|
|
108
|
+
`constraints` text,
|
|
109
|
+
`acceptance` text NOT NULL,
|
|
110
|
+
`status` text NOT NULL,
|
|
111
|
+
`priority` integer DEFAULT 50 NOT NULL,
|
|
112
|
+
`workspace` text,
|
|
113
|
+
`repo` text,
|
|
114
|
+
`branch` text,
|
|
115
|
+
`budget_tokens` integer,
|
|
116
|
+
`budget_usd` real,
|
|
117
|
+
`model_policy` text,
|
|
118
|
+
`approval_mode` text DEFAULT 'human' NOT NULL,
|
|
119
|
+
`parent_id` text,
|
|
120
|
+
`assignee` text,
|
|
121
|
+
`claim_expires_at` integer,
|
|
122
|
+
`lease_seconds` integer,
|
|
123
|
+
`last_heartbeat` integer,
|
|
124
|
+
`attempt_count` integer DEFAULT 0 NOT NULL,
|
|
125
|
+
`created_at` integer NOT NULL,
|
|
126
|
+
`updated_at` integer NOT NULL,
|
|
127
|
+
`closed_at` integer,
|
|
128
|
+
CONSTRAINT "work_orders_status" CHECK("work_orders"."status" IN ('draft', 'ready', 'claimed', 'running', 'review', 'approved', 'rejected', 'blocked', 'done', 'cancelled')),
|
|
129
|
+
CONSTRAINT "work_orders_approval_mode" CHECK("work_orders"."approval_mode" IN ('auto', 'evidence', 'human'))
|
|
130
|
+
);
|
|
131
|
+
--> statement-breakpoint
|
|
132
|
+
CREATE INDEX `idx_work_orders_status_priority` ON `work_orders` (`status`,`priority`);--> statement-breakpoint
|
|
133
|
+
CREATE INDEX `idx_work_orders_assignee` ON `work_orders` (`assignee`);
|