@zonease/aiworker-cli 0.2.0 → 0.3.0
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 +216 -167
- package/aiworker.js +207 -200
- package/drizzle/fleet/0000_fine_havok.sql +23 -0
- package/drizzle/fleet/meta/0000_snapshot.json +165 -0
- package/drizzle/fleet/meta/_journal.json +13 -0
- package/drizzle/worker/0000_spooky_kat_farrell.sql +112 -0
- package/drizzle/worker/0001_secret_dagger.sql +1 -0
- package/drizzle/worker/0002_jazzy_moondragon.sql +13 -0
- package/drizzle/worker/0003_rare_cloak.sql +7 -0
- package/drizzle/worker/meta/0000_snapshot.json +719 -0
- package/drizzle/worker/meta/0001_snapshot.json +726 -0
- package/drizzle/worker/meta/0002_snapshot.json +814 -0
- package/drizzle/worker/meta/0003_snapshot.json +873 -0
- package/drizzle/worker/meta/_journal.json +34 -0
- package/package.json +3 -2
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
CREATE TABLE `audit_events` (
|
|
2
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
3
|
+
`at` text NOT NULL,
|
|
4
|
+
`actor` text NOT NULL,
|
|
5
|
+
`action` text NOT NULL,
|
|
6
|
+
`worker_id` text,
|
|
7
|
+
`detail` text
|
|
8
|
+
);
|
|
9
|
+
--> statement-breakpoint
|
|
10
|
+
CREATE INDEX `audit_events_worker_id_idx` ON `audit_events` (`worker_id`);--> statement-breakpoint
|
|
11
|
+
CREATE TABLE `registered_workers` (
|
|
12
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
13
|
+
`base_url` text NOT NULL,
|
|
14
|
+
`display_name` text NOT NULL,
|
|
15
|
+
`api_token_enc` text NOT NULL,
|
|
16
|
+
`nonce` text NOT NULL,
|
|
17
|
+
`auth_tag` text NOT NULL,
|
|
18
|
+
`added_at` text NOT NULL,
|
|
19
|
+
`added_by` text NOT NULL,
|
|
20
|
+
`last_seen_at` text,
|
|
21
|
+
`last_seen_state` text,
|
|
22
|
+
`last_config_version` integer
|
|
23
|
+
);
|
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": "6",
|
|
3
|
+
"dialect": "sqlite",
|
|
4
|
+
"id": "43336a7a-f75f-44b7-bc26-13b072eff453",
|
|
5
|
+
"prevId": "00000000-0000-0000-0000-000000000000",
|
|
6
|
+
"tables": {
|
|
7
|
+
"audit_events": {
|
|
8
|
+
"name": "audit_events",
|
|
9
|
+
"columns": {
|
|
10
|
+
"id": {
|
|
11
|
+
"name": "id",
|
|
12
|
+
"type": "integer",
|
|
13
|
+
"primaryKey": true,
|
|
14
|
+
"notNull": true,
|
|
15
|
+
"autoincrement": true
|
|
16
|
+
},
|
|
17
|
+
"at": {
|
|
18
|
+
"name": "at",
|
|
19
|
+
"type": "text",
|
|
20
|
+
"primaryKey": false,
|
|
21
|
+
"notNull": true,
|
|
22
|
+
"autoincrement": false
|
|
23
|
+
},
|
|
24
|
+
"actor": {
|
|
25
|
+
"name": "actor",
|
|
26
|
+
"type": "text",
|
|
27
|
+
"primaryKey": false,
|
|
28
|
+
"notNull": true,
|
|
29
|
+
"autoincrement": false
|
|
30
|
+
},
|
|
31
|
+
"action": {
|
|
32
|
+
"name": "action",
|
|
33
|
+
"type": "text",
|
|
34
|
+
"primaryKey": false,
|
|
35
|
+
"notNull": true,
|
|
36
|
+
"autoincrement": false
|
|
37
|
+
},
|
|
38
|
+
"worker_id": {
|
|
39
|
+
"name": "worker_id",
|
|
40
|
+
"type": "text",
|
|
41
|
+
"primaryKey": false,
|
|
42
|
+
"notNull": false,
|
|
43
|
+
"autoincrement": false
|
|
44
|
+
},
|
|
45
|
+
"detail": {
|
|
46
|
+
"name": "detail",
|
|
47
|
+
"type": "text",
|
|
48
|
+
"primaryKey": false,
|
|
49
|
+
"notNull": false,
|
|
50
|
+
"autoincrement": false
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
"indexes": {
|
|
54
|
+
"audit_events_worker_id_idx": {
|
|
55
|
+
"name": "audit_events_worker_id_idx",
|
|
56
|
+
"columns": [
|
|
57
|
+
"worker_id"
|
|
58
|
+
],
|
|
59
|
+
"isUnique": false
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
"foreignKeys": {},
|
|
63
|
+
"compositePrimaryKeys": {},
|
|
64
|
+
"uniqueConstraints": {},
|
|
65
|
+
"checkConstraints": {}
|
|
66
|
+
},
|
|
67
|
+
"registered_workers": {
|
|
68
|
+
"name": "registered_workers",
|
|
69
|
+
"columns": {
|
|
70
|
+
"id": {
|
|
71
|
+
"name": "id",
|
|
72
|
+
"type": "text",
|
|
73
|
+
"primaryKey": true,
|
|
74
|
+
"notNull": true,
|
|
75
|
+
"autoincrement": false
|
|
76
|
+
},
|
|
77
|
+
"base_url": {
|
|
78
|
+
"name": "base_url",
|
|
79
|
+
"type": "text",
|
|
80
|
+
"primaryKey": false,
|
|
81
|
+
"notNull": true,
|
|
82
|
+
"autoincrement": false
|
|
83
|
+
},
|
|
84
|
+
"display_name": {
|
|
85
|
+
"name": "display_name",
|
|
86
|
+
"type": "text",
|
|
87
|
+
"primaryKey": false,
|
|
88
|
+
"notNull": true,
|
|
89
|
+
"autoincrement": false
|
|
90
|
+
},
|
|
91
|
+
"api_token_enc": {
|
|
92
|
+
"name": "api_token_enc",
|
|
93
|
+
"type": "text",
|
|
94
|
+
"primaryKey": false,
|
|
95
|
+
"notNull": true,
|
|
96
|
+
"autoincrement": false
|
|
97
|
+
},
|
|
98
|
+
"nonce": {
|
|
99
|
+
"name": "nonce",
|
|
100
|
+
"type": "text",
|
|
101
|
+
"primaryKey": false,
|
|
102
|
+
"notNull": true,
|
|
103
|
+
"autoincrement": false
|
|
104
|
+
},
|
|
105
|
+
"auth_tag": {
|
|
106
|
+
"name": "auth_tag",
|
|
107
|
+
"type": "text",
|
|
108
|
+
"primaryKey": false,
|
|
109
|
+
"notNull": true,
|
|
110
|
+
"autoincrement": false
|
|
111
|
+
},
|
|
112
|
+
"added_at": {
|
|
113
|
+
"name": "added_at",
|
|
114
|
+
"type": "text",
|
|
115
|
+
"primaryKey": false,
|
|
116
|
+
"notNull": true,
|
|
117
|
+
"autoincrement": false
|
|
118
|
+
},
|
|
119
|
+
"added_by": {
|
|
120
|
+
"name": "added_by",
|
|
121
|
+
"type": "text",
|
|
122
|
+
"primaryKey": false,
|
|
123
|
+
"notNull": true,
|
|
124
|
+
"autoincrement": false
|
|
125
|
+
},
|
|
126
|
+
"last_seen_at": {
|
|
127
|
+
"name": "last_seen_at",
|
|
128
|
+
"type": "text",
|
|
129
|
+
"primaryKey": false,
|
|
130
|
+
"notNull": false,
|
|
131
|
+
"autoincrement": false
|
|
132
|
+
},
|
|
133
|
+
"last_seen_state": {
|
|
134
|
+
"name": "last_seen_state",
|
|
135
|
+
"type": "text",
|
|
136
|
+
"primaryKey": false,
|
|
137
|
+
"notNull": false,
|
|
138
|
+
"autoincrement": false
|
|
139
|
+
},
|
|
140
|
+
"last_config_version": {
|
|
141
|
+
"name": "last_config_version",
|
|
142
|
+
"type": "integer",
|
|
143
|
+
"primaryKey": false,
|
|
144
|
+
"notNull": false,
|
|
145
|
+
"autoincrement": false
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
"indexes": {},
|
|
149
|
+
"foreignKeys": {},
|
|
150
|
+
"compositePrimaryKeys": {},
|
|
151
|
+
"uniqueConstraints": {},
|
|
152
|
+
"checkConstraints": {}
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
"views": {},
|
|
156
|
+
"enums": {},
|
|
157
|
+
"_meta": {
|
|
158
|
+
"schemas": {},
|
|
159
|
+
"tables": {},
|
|
160
|
+
"columns": {}
|
|
161
|
+
},
|
|
162
|
+
"internal": {
|
|
163
|
+
"indexes": {}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
CREATE TABLE `agent_tasks` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`prompt` text NOT NULL,
|
|
4
|
+
`status` text NOT NULL,
|
|
5
|
+
`conversation_id` text,
|
|
6
|
+
`created_at` text NOT NULL,
|
|
7
|
+
`finished_at` text,
|
|
8
|
+
`result` text,
|
|
9
|
+
`error` text
|
|
10
|
+
);
|
|
11
|
+
--> statement-breakpoint
|
|
12
|
+
CREATE TABLE `conversations` (
|
|
13
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
14
|
+
`task_id` text,
|
|
15
|
+
`channel` text NOT NULL,
|
|
16
|
+
`chat_id` text NOT NULL,
|
|
17
|
+
`thread_id` text,
|
|
18
|
+
`status` text DEFAULT 'open' NOT NULL,
|
|
19
|
+
`summary` text,
|
|
20
|
+
`started_at` text NOT NULL,
|
|
21
|
+
`last_active_at` text NOT NULL,
|
|
22
|
+
`closed_at` text,
|
|
23
|
+
FOREIGN KEY (`task_id`) REFERENCES `agent_tasks`(`id`) ON UPDATE no action ON DELETE no action
|
|
24
|
+
);
|
|
25
|
+
--> statement-breakpoint
|
|
26
|
+
CREATE TABLE `evolution_observations` (
|
|
27
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
28
|
+
`conversation_id` text,
|
|
29
|
+
`kind` text NOT NULL,
|
|
30
|
+
`payload` text NOT NULL,
|
|
31
|
+
`noticed_at` text NOT NULL
|
|
32
|
+
);
|
|
33
|
+
--> statement-breakpoint
|
|
34
|
+
CREATE TABLE `execution_logs` (
|
|
35
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
36
|
+
`conversation_id` text,
|
|
37
|
+
`tool_name` text NOT NULL,
|
|
38
|
+
`params` text,
|
|
39
|
+
`result` text,
|
|
40
|
+
`duration` integer,
|
|
41
|
+
`created_at` text NOT NULL
|
|
42
|
+
);
|
|
43
|
+
--> statement-breakpoint
|
|
44
|
+
CREATE TABLE `messages` (
|
|
45
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
46
|
+
`conversation_id` text NOT NULL,
|
|
47
|
+
`role` text NOT NULL,
|
|
48
|
+
`content` text NOT NULL,
|
|
49
|
+
`tool_calls` text,
|
|
50
|
+
`tool_call_id` text,
|
|
51
|
+
`tokens_in` integer,
|
|
52
|
+
`tokens_out` integer,
|
|
53
|
+
`created_at` text NOT NULL,
|
|
54
|
+
FOREIGN KEY (`conversation_id`) REFERENCES `conversations`(`id`) ON UPDATE no action ON DELETE cascade
|
|
55
|
+
);
|
|
56
|
+
--> statement-breakpoint
|
|
57
|
+
CREATE TABLE `skill_bindings` (
|
|
58
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
59
|
+
`source` text NOT NULL,
|
|
60
|
+
`brain_name` text,
|
|
61
|
+
`skill_name` text NOT NULL,
|
|
62
|
+
`enabled` integer DEFAULT true NOT NULL,
|
|
63
|
+
`priority` integer DEFAULT 0 NOT NULL,
|
|
64
|
+
`config` text,
|
|
65
|
+
`created_at` text NOT NULL,
|
|
66
|
+
`updated_at` text NOT NULL
|
|
67
|
+
);
|
|
68
|
+
--> statement-breakpoint
|
|
69
|
+
CREATE UNIQUE INDEX `skill_bindings_source_brain_name_idx` ON `skill_bindings` (`source`,`brain_name`,`skill_name`);--> statement-breakpoint
|
|
70
|
+
CREATE TABLE `skill_drafts` (
|
|
71
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
72
|
+
`proposed_name` text NOT NULL,
|
|
73
|
+
`source` text NOT NULL,
|
|
74
|
+
`body_markdown` text NOT NULL,
|
|
75
|
+
`rationale` text DEFAULT '' NOT NULL,
|
|
76
|
+
`status` text DEFAULT 'pending' NOT NULL,
|
|
77
|
+
`created_at` text NOT NULL,
|
|
78
|
+
`decided_at` text,
|
|
79
|
+
`decided_by` text
|
|
80
|
+
);
|
|
81
|
+
--> statement-breakpoint
|
|
82
|
+
CREATE TABLE `worker_config` (
|
|
83
|
+
`pk` text PRIMARY KEY DEFAULT 'default' NOT NULL,
|
|
84
|
+
`config_json` text NOT NULL,
|
|
85
|
+
`version` integer DEFAULT 1 NOT NULL,
|
|
86
|
+
`updated_at` text NOT NULL,
|
|
87
|
+
`updated_by` text
|
|
88
|
+
);
|
|
89
|
+
--> statement-breakpoint
|
|
90
|
+
CREATE TABLE `worker_identity` (
|
|
91
|
+
`pk` text PRIMARY KEY DEFAULT 'default' NOT NULL,
|
|
92
|
+
`worker_id` text NOT NULL,
|
|
93
|
+
`api_token_enc` text NOT NULL,
|
|
94
|
+
`nonce` text NOT NULL,
|
|
95
|
+
`auth_tag` text NOT NULL,
|
|
96
|
+
`bootstrap_shown_at` text NOT NULL,
|
|
97
|
+
`created_at` text NOT NULL,
|
|
98
|
+
`rotated_at` text
|
|
99
|
+
);
|
|
100
|
+
--> statement-breakpoint
|
|
101
|
+
CREATE UNIQUE INDEX `worker_identity_worker_id_unique` ON `worker_identity` (`worker_id`);--> statement-breakpoint
|
|
102
|
+
CREATE TABLE `worker_secrets` (
|
|
103
|
+
`id` integer PRIMARY KEY AUTOINCREMENT NOT NULL,
|
|
104
|
+
`key` text NOT NULL,
|
|
105
|
+
`value_enc` text NOT NULL,
|
|
106
|
+
`nonce` text NOT NULL,
|
|
107
|
+
`auth_tag` text NOT NULL,
|
|
108
|
+
`created_at` text NOT NULL,
|
|
109
|
+
`updated_at` text NOT NULL
|
|
110
|
+
);
|
|
111
|
+
--> statement-breakpoint
|
|
112
|
+
CREATE UNIQUE INDEX `worker_secrets_key_unique` ON `worker_secrets` (`key`);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ALTER TABLE `messages` ADD `rich_metadata` text;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE `cron_jobs` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`expression` text NOT NULL,
|
|
4
|
+
`prompt` text NOT NULL,
|
|
5
|
+
`channel` text NOT NULL,
|
|
6
|
+
`chat_id` text NOT NULL,
|
|
7
|
+
`account_id` text NOT NULL,
|
|
8
|
+
`enabled` integer DEFAULT true NOT NULL,
|
|
9
|
+
`last_run_at` text,
|
|
10
|
+
`next_run_at` text,
|
|
11
|
+
`created_at` text NOT NULL,
|
|
12
|
+
`updated_at` text NOT NULL
|
|
13
|
+
);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
CREATE INDEX `agent_tasks_created_at_idx` ON `agent_tasks` (`created_at`);--> statement-breakpoint
|
|
2
|
+
CREATE INDEX `conversations_lookup_idx` ON `conversations` (`channel`,`chat_id`,`thread_id`,`status`);--> statement-breakpoint
|
|
3
|
+
CREATE INDEX `conversations_last_active_at_idx` ON `conversations` (`last_active_at`);--> statement-breakpoint
|
|
4
|
+
CREATE INDEX `cron_jobs_due_idx` ON `cron_jobs` (`enabled`,`next_run_at`);--> statement-breakpoint
|
|
5
|
+
CREATE INDEX `evolution_observations_noticed_at_idx` ON `evolution_observations` (`noticed_at`);--> statement-breakpoint
|
|
6
|
+
CREATE INDEX `execution_logs_conversation_id_idx` ON `execution_logs` (`conversation_id`);--> statement-breakpoint
|
|
7
|
+
CREATE INDEX `messages_conversation_id_idx` ON `messages` (`conversation_id`);
|