@fickydev/pigent 0.1.9 → 0.1.10
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/CHANGELOG.md +10 -0
- package/TODO.md +18 -12
- package/agents/assistant/agent.yaml +0 -5
- package/drizzle/migrations/0002_bouncy_leper_queen.sql +13 -0
- package/drizzle/migrations/0003_secret_stone_men.sql +11 -0
- package/drizzle/migrations/meta/0002_snapshot.json +606 -0
- package/drizzle/migrations/meta/0003_snapshot.json +681 -0
- package/drizzle/migrations/meta/_journal.json +14 -0
- package/package.json +1 -1
- package/pigent.yaml +16 -0
- package/src/agents/BotCommandHandler.ts +109 -15
- package/src/config/loadConfig.ts +1 -0
- package/src/config/schemas.ts +14 -8
- package/src/daemon/AgentDaemon.ts +8 -1
- package/src/daemon/Scheduler.ts +224 -0
- package/src/daemon/taskDue.ts +4 -0
- package/src/db/repositories/TaskConfigRepository.ts +63 -0
- package/src/db/repositories/TaskRepository.ts +129 -0
- package/src/db/repositories/index.ts +4 -0
- package/src/db/schema.ts +30 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,16 @@
|
|
|
4
4
|
|
|
5
5
|
### Added
|
|
6
6
|
|
|
7
|
+
- Added `task_runs` table and `TaskRepository` for scheduled task persistence.
|
|
8
|
+
- Added `Scheduler` module with global tick, per-task due check, lock, NOOP handling, and channel output.
|
|
9
|
+
- Added `scheduler` block to root config (`pigent.yaml`) with `tickIntervalMs` and `tasks[]`.
|
|
10
|
+
- Added `agent` field to task config to reference which agent executes the task.
|
|
11
|
+
- Replaced per-agent `heartbeat` config with daemon-level scheduler.
|
|
12
|
+
- Wired scheduler into daemon start/stop lifecycle.
|
|
13
|
+
- Added `task_configs` table and `TaskConfigRepository` for runtime task CRUD.
|
|
14
|
+
- Added `/task list`, `/task create <intervalMs> <prompt>`, `/task remove <id>` Telegram commands.
|
|
15
|
+
- Scheduler loads tasks from both config file and database, supports hot-add and hot-remove.
|
|
16
|
+
|
|
7
17
|
- Added `bunx @fickydev/pigent <dir>` scaffold/setup/run CLI path.
|
|
8
18
|
- Added one-command setup-and-run CLI at `src/cli/run.ts` and `bun run run`.
|
|
9
19
|
- Added interactive setup CLI at `src/cli/setup.ts` and `bun run setup`.
|
package/TODO.md
CHANGED
|
@@ -145,17 +145,23 @@
|
|
|
145
145
|
- [x] Prototype one prompt through Pi SDK
|
|
146
146
|
- [x] Decide CLI fallback strategy if SDK gaps appear
|
|
147
147
|
|
|
148
|
-
##
|
|
149
|
-
|
|
150
|
-
- [
|
|
151
|
-
- [
|
|
152
|
-
- [
|
|
153
|
-
- [
|
|
154
|
-
- [
|
|
155
|
-
- [x]
|
|
156
|
-
- [
|
|
157
|
-
- [
|
|
158
|
-
- [
|
|
148
|
+
## Scheduler
|
|
149
|
+
|
|
150
|
+
- [x] Define task config schema
|
|
151
|
+
- [x] Move task config from per-agent to daemon-level (`pigent.yaml`)
|
|
152
|
+
- [x] Add `task_runs` database table
|
|
153
|
+
- [x] Implement `TaskRepository`
|
|
154
|
+
- [x] Create `Scheduler` module (global tick, per-task due check, lock, NOOP, channel output)
|
|
155
|
+
- [x] Wire scheduler into daemon start/stop
|
|
156
|
+
- [x] Update example root config with scheduler block
|
|
157
|
+
- [x] Add `task_configs` DB table for runtime task definitions
|
|
158
|
+
- [x] Add `TaskConfigRepository`
|
|
159
|
+
- [x] Add `/task list` command
|
|
160
|
+
- [x] Add `/task create <intervalMs> <prompt>` command
|
|
161
|
+
- [x] Add `/task remove <id>` command
|
|
162
|
+
- [x] Scheduler loads tasks from both config file + DB
|
|
163
|
+
- [ ] Add max task runs per hour rate limit
|
|
164
|
+
- [ ] Add `/task status` or similar command
|
|
159
165
|
|
|
160
166
|
## Policy And Safety
|
|
161
167
|
|
|
@@ -196,11 +202,11 @@
|
|
|
196
202
|
|
|
197
203
|
## Tests
|
|
198
204
|
|
|
205
|
+
- [x] Unit test `isTaskDue` logic
|
|
199
206
|
- [ ] Unit test config validation
|
|
200
207
|
- [ ] Unit test Telegram update normalization
|
|
201
208
|
- [ ] Unit test routing rules
|
|
202
209
|
- [ ] Unit test session key generation
|
|
203
|
-
- [ ] Unit test heartbeat `NOOP` behavior
|
|
204
210
|
- [ ] Unit test model selection priority
|
|
205
211
|
- [ ] Unit test Telegram `/model` command parsing
|
|
206
212
|
- [ ] Unit test Telegram model picker callback parsing
|
|
@@ -10,11 +10,6 @@ extensions: []
|
|
|
10
10
|
channels:
|
|
11
11
|
telegram:
|
|
12
12
|
enabled: false
|
|
13
|
-
heartbeat:
|
|
14
|
-
enabled: false
|
|
15
|
-
intervalMs: 600000
|
|
16
|
-
prompt: |
|
|
17
|
-
Check assigned tasks. If no useful action is needed, reply exactly: NOOP.
|
|
18
13
|
permissions:
|
|
19
14
|
canRunShell: false
|
|
20
15
|
canEditFiles: false
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
CREATE TABLE `task_runs` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`agent_id` text NOT NULL,
|
|
4
|
+
`task_id` text NOT NULL,
|
|
5
|
+
`prompt` text NOT NULL,
|
|
6
|
+
`session_id` text,
|
|
7
|
+
`status` text NOT NULL,
|
|
8
|
+
`result` text,
|
|
9
|
+
`error` text,
|
|
10
|
+
`started_at` integer,
|
|
11
|
+
`finished_at` integer,
|
|
12
|
+
`created_at` integer NOT NULL
|
|
13
|
+
);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
CREATE TABLE `task_configs` (
|
|
2
|
+
`id` text PRIMARY KEY NOT NULL,
|
|
3
|
+
`agent` text NOT NULL,
|
|
4
|
+
`interval_ms` integer NOT NULL,
|
|
5
|
+
`prompt` text NOT NULL,
|
|
6
|
+
`channel` text DEFAULT 'telegram' NOT NULL,
|
|
7
|
+
`chat_id` text NOT NULL,
|
|
8
|
+
`enabled` integer DEFAULT true NOT NULL,
|
|
9
|
+
`created_at` integer NOT NULL,
|
|
10
|
+
`updated_at` integer NOT NULL
|
|
11
|
+
);
|