agent-office 0.4.9 → 0.6.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.
Files changed (189) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +259 -228
  3. package/dist/commands/cron-requests.d.ts +7 -0
  4. package/dist/commands/cron-requests.d.ts.map +1 -0
  5. package/dist/commands/cron-requests.js +31 -0
  6. package/dist/commands/cron-requests.js.map +1 -0
  7. package/dist/commands/crons.d.ts +10 -0
  8. package/dist/commands/crons.d.ts.map +1 -0
  9. package/dist/commands/crons.js +45 -0
  10. package/dist/commands/crons.js.map +1 -0
  11. package/dist/commands/hello.d.ts +5 -0
  12. package/dist/commands/hello.d.ts.map +1 -0
  13. package/dist/commands/hello.js +4 -0
  14. package/dist/commands/hello.js.map +1 -0
  15. package/dist/commands/messages.d.ts +5 -0
  16. package/dist/commands/messages.d.ts.map +1 -0
  17. package/dist/commands/messages.js +18 -0
  18. package/dist/commands/messages.js.map +1 -0
  19. package/dist/commands/sessions.d.ts +13 -0
  20. package/dist/commands/sessions.d.ts.map +1 -0
  21. package/dist/commands/sessions.js +58 -0
  22. package/dist/commands/sessions.js.map +1 -0
  23. package/dist/commands/task-columns.d.ts +2 -0
  24. package/dist/commands/task-columns.d.ts.map +1 -0
  25. package/dist/commands/task-columns.js +13 -0
  26. package/dist/commands/task-columns.js.map +1 -0
  27. package/dist/commands/tasks.d.ts +11 -0
  28. package/dist/commands/tasks.d.ts.map +1 -0
  29. package/dist/commands/tasks.js +75 -0
  30. package/dist/commands/tasks.js.map +1 -0
  31. package/dist/config.test.d.ts +2 -0
  32. package/dist/config.test.d.ts.map +1 -0
  33. package/dist/config.test.js +50 -0
  34. package/dist/config.test.js.map +1 -0
  35. package/dist/db/index.d.ts +6 -70
  36. package/dist/db/index.d.ts.map +1 -0
  37. package/dist/db/index.js +4 -11
  38. package/dist/db/index.js.map +1 -0
  39. package/dist/db/mock-storage.d.ts +79 -0
  40. package/dist/db/mock-storage.d.ts.map +1 -0
  41. package/dist/db/mock-storage.js +381 -0
  42. package/dist/db/mock-storage.js.map +1 -0
  43. package/dist/db/mock-storage.test.d.ts +2 -0
  44. package/dist/db/mock-storage.test.d.ts.map +1 -0
  45. package/dist/db/mock-storage.test.js +234 -0
  46. package/dist/db/mock-storage.test.js.map +1 -0
  47. package/dist/db/postgresql-storage.d.ts +10 -8
  48. package/dist/db/postgresql-storage.d.ts.map +1 -0
  49. package/dist/db/postgresql-storage.js +76 -42
  50. package/dist/db/postgresql-storage.js.map +1 -0
  51. package/dist/db/sqlite-storage.d.ts +9 -8
  52. package/dist/db/sqlite-storage.d.ts.map +1 -0
  53. package/dist/db/sqlite-storage.js +75 -41
  54. package/dist/db/sqlite-storage.js.map +1 -0
  55. package/dist/db/storage-base.d.ts +7 -8
  56. package/dist/db/storage-base.d.ts.map +1 -0
  57. package/dist/db/storage-base.js +3 -2
  58. package/dist/db/storage-base.js.map +1 -0
  59. package/dist/db/storage.d.ts +12 -12
  60. package/dist/db/storage.d.ts.map +1 -0
  61. package/dist/db/storage.js +1 -0
  62. package/dist/db/storage.js.map +1 -0
  63. package/dist/db/types.d.ts +67 -0
  64. package/dist/db/types.d.ts.map +1 -0
  65. package/dist/db/types.js +2 -0
  66. package/dist/db/types.js.map +1 -0
  67. package/dist/index.d.ts +2 -0
  68. package/dist/index.d.ts.map +1 -0
  69. package/dist/index.js +397 -0
  70. package/dist/index.js.map +1 -0
  71. package/dist/index.test.d.ts +2 -0
  72. package/dist/index.test.d.ts.map +1 -0
  73. package/dist/index.test.js +49 -0
  74. package/dist/index.test.js.map +1 -0
  75. package/dist/lib/output.d.ts +2 -0
  76. package/dist/lib/output.d.ts.map +1 -0
  77. package/dist/lib/output.js +8 -0
  78. package/dist/lib/output.js.map +1 -0
  79. package/dist/services/cron-service.constraints.test.d.ts +2 -0
  80. package/dist/services/cron-service.constraints.test.d.ts.map +1 -0
  81. package/dist/services/cron-service.constraints.test.js +90 -0
  82. package/dist/services/cron-service.constraints.test.js.map +1 -0
  83. package/dist/services/cron-service.d.ts +45 -0
  84. package/dist/services/cron-service.d.ts.map +1 -0
  85. package/dist/services/cron-service.js +157 -0
  86. package/dist/services/cron-service.js.map +1 -0
  87. package/dist/services/cron-service.test.d.ts +2 -0
  88. package/dist/services/cron-service.test.d.ts.map +1 -0
  89. package/dist/services/cron-service.test.js +280 -0
  90. package/dist/services/cron-service.test.js.map +1 -0
  91. package/dist/services/index.d.ts +5 -0
  92. package/dist/services/index.d.ts.map +1 -0
  93. package/dist/services/index.js +5 -0
  94. package/dist/services/index.js.map +1 -0
  95. package/dist/services/message-service.d.ts +16 -0
  96. package/dist/services/message-service.d.ts.map +1 -0
  97. package/dist/services/message-service.js +39 -0
  98. package/dist/services/message-service.js.map +1 -0
  99. package/dist/services/message-service.test.d.ts +2 -0
  100. package/dist/services/message-service.test.d.ts.map +1 -0
  101. package/dist/services/message-service.test.js +145 -0
  102. package/dist/services/message-service.test.js.map +1 -0
  103. package/dist/services/session-service.constraints.test.d.ts +2 -0
  104. package/dist/services/session-service.constraints.test.d.ts.map +1 -0
  105. package/dist/services/session-service.constraints.test.js +34 -0
  106. package/dist/services/session-service.constraints.test.js.map +1 -0
  107. package/dist/services/session-service.d.ts +27 -0
  108. package/dist/services/session-service.d.ts.map +1 -0
  109. package/dist/services/session-service.js +55 -0
  110. package/dist/services/session-service.js.map +1 -0
  111. package/dist/services/session-service.test.d.ts +2 -0
  112. package/dist/services/session-service.test.d.ts.map +1 -0
  113. package/dist/services/session-service.test.js +87 -0
  114. package/dist/services/session-service.test.js.map +1 -0
  115. package/dist/services/task-service.d.ts +25 -0
  116. package/dist/services/task-service.d.ts.map +1 -0
  117. package/dist/services/task-service.js +87 -0
  118. package/dist/services/task-service.js.map +1 -0
  119. package/dist/services/task-service.test.d.ts +2 -0
  120. package/dist/services/task-service.test.d.ts.map +1 -0
  121. package/dist/services/task-service.test.js +180 -0
  122. package/dist/services/task-service.test.js.map +1 -0
  123. package/package.json +40 -42
  124. package/dist/cli.d.ts +0 -2
  125. package/dist/cli.js +0 -317
  126. package/dist/commands/communicator.d.ts +0 -9
  127. package/dist/commands/communicator.js +0 -2231
  128. package/dist/commands/manage.d.ts +0 -5
  129. package/dist/commands/manage.js +0 -20
  130. package/dist/commands/notifier.d.ts +0 -11
  131. package/dist/commands/notifier.js +0 -100
  132. package/dist/commands/screensaver.d.ts +0 -8
  133. package/dist/commands/screensaver.js +0 -1280
  134. package/dist/commands/serve.d.ts +0 -13
  135. package/dist/commands/serve.js +0 -95
  136. package/dist/commands/task-board.d.ts +0 -29
  137. package/dist/commands/task-board.js +0 -251
  138. package/dist/commands/worker.d.ts +0 -16
  139. package/dist/commands/worker.js +0 -145
  140. package/dist/db/migrate.d.ts +0 -2
  141. package/dist/db/migrate.js +0 -3
  142. package/dist/lib/agentic-coding-server.d.ts +0 -66
  143. package/dist/lib/agentic-coding-server.js +0 -7
  144. package/dist/lib/notifier.d.ts +0 -18
  145. package/dist/lib/notifier.js +0 -15
  146. package/dist/lib/opencode-coding-server.d.ts +0 -11
  147. package/dist/lib/opencode-coding-server.js +0 -66
  148. package/dist/lib/pi-coding-server.d.ts +0 -20
  149. package/dist/lib/pi-coding-server.js +0 -162
  150. package/dist/manage/app.d.ts +0 -6
  151. package/dist/manage/app.js +0 -128
  152. package/dist/manage/components/AgentCode.d.ts +0 -8
  153. package/dist/manage/components/AgentCode.js +0 -73
  154. package/dist/manage/components/CreateSession.d.ts +0 -8
  155. package/dist/manage/components/CreateSession.js +0 -37
  156. package/dist/manage/components/CronList.d.ts +0 -9
  157. package/dist/manage/components/CronList.js +0 -321
  158. package/dist/manage/components/CronRequests.d.ts +0 -8
  159. package/dist/manage/components/CronRequests.js +0 -181
  160. package/dist/manage/components/DeleteSession.d.ts +0 -7
  161. package/dist/manage/components/DeleteSession.js +0 -55
  162. package/dist/manage/components/InjectText.d.ts +0 -8
  163. package/dist/manage/components/InjectText.js +0 -51
  164. package/dist/manage/components/ItemSelector.d.ts +0 -7
  165. package/dist/manage/components/ItemSelector.js +0 -20
  166. package/dist/manage/components/MenuSelect.d.ts +0 -13
  167. package/dist/manage/components/MenuSelect.js +0 -22
  168. package/dist/manage/components/MyMail.d.ts +0 -9
  169. package/dist/manage/components/MyMail.js +0 -143
  170. package/dist/manage/components/Profile.d.ts +0 -8
  171. package/dist/manage/components/Profile.js +0 -60
  172. package/dist/manage/components/ReadMail.d.ts +0 -8
  173. package/dist/manage/components/ReadMail.js +0 -110
  174. package/dist/manage/components/SendMessage.d.ts +0 -9
  175. package/dist/manage/components/SendMessage.js +0 -79
  176. package/dist/manage/components/SessionList.d.ts +0 -9
  177. package/dist/manage/components/SessionList.js +0 -608
  178. package/dist/manage/components/SessionSidebar.d.ts +0 -6
  179. package/dist/manage/components/SessionSidebar.js +0 -24
  180. package/dist/manage/components/TailMessages.d.ts +0 -8
  181. package/dist/manage/components/TailMessages.js +0 -126
  182. package/dist/manage/hooks/useApi.d.ts +0 -147
  183. package/dist/manage/hooks/useApi.js +0 -181
  184. package/dist/server/cron.d.ts +0 -25
  185. package/dist/server/cron.js +0 -107
  186. package/dist/server/index.d.ts +0 -4
  187. package/dist/server/index.js +0 -22
  188. package/dist/server/routes.d.ts +0 -13
  189. package/dist/server/routes.js +0 -1396
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 Richard Anaya
3
+ Copyright (c) 2024 Richard Anaya
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/README.md CHANGED
@@ -1,349 +1,380 @@
1
1
  # agent-office
2
2
 
3
- An office for your AI agents. Manage multiple [OpenCode](https://opencode.ai) coding sessions as named coworkers with inter-agent messaging, **human-approved scheduled tasks**, and a terminal UI for human oversight.
3
+ A multi-agent office management system CLI for coordinating AI coworkers, messages, scheduled tasks, and project workflows.
4
4
 
5
- ## Overview
5
+ ## Features
6
6
 
7
- `agent-office` sits between a human operator and one or more AI coding agents running on an OpenCode server. It wraps raw OpenCode sessions with named identities, a messaging system, and cron-based scheduling -- creating an "office" where AI agents are coworkers that communicate, take direction, and operate autonomously.
7
+ - **Coworker Management**: Create and manage AI agent coworkers with descriptions, philosophy, and visual descriptions
8
+ - **Message System**: Send and receive messages between coworkers with read/unread tracking
9
+ - **Cron Jobs**: Schedule automated messages with cron expressions (with optional approval workflow)
10
+ - **Task Board**: Kanban-style task management with columns, assignments, and dependencies
11
+ - **TOON Format**: All output encoded in TOON (Token-Oriented Object Notation) by default for compact, LLM-friendly output
12
+ - **JSON Option**: Use `--json` flag for traditional JSON output
13
+ - **Multiple Storage Backends**: SQLite or PostgreSQL support
14
+ - **Comprehensive Testing**: 148 tests with full coverage
8
15
 
9
- **For humans**, there are three interfaces:
16
+ ## Installation
17
+
18
+ ```bash
19
+ npm install -g agent-office
20
+ ```
21
+
22
+ Or use with npx:
10
23
 
11
- - **`serve`** -- an HTTP server that manages sessions, messages, and **cron job approval workflow**, backed by PostgreSQL and a running OpenCode server
12
- - **`manage`** -- a full-screen terminal UI (React Ink) for creating coworkers, sending messages, browsing mail, **approving/rejecting cron requests**, and observing agent activity
13
- - **`communicator web`** -- a browser-based chat interface for conversing with a specific agent in real time
24
+ ```bash
25
+ npx agent-office --help
26
+ ```
14
27
 
15
- **For AI agents**, there is a CLI:
28
+ ## Development
16
29
 
17
- - **`worker`** -- subcommands that agents invoke from within their OpenCode sessions to clock in, message coworkers, set status, and **request cron jobs** (which require human approval)
30
+ Install dependencies:
18
31
 
32
+ ```bash
33
+ npm install
19
34
  ```
20
- +---------------------+
21
- | OpenCode Server |
22
- | :4096 |
23
- +---------+-----------+
24
- |
25
- +--------------+ +---------+-----------+ +--------------+
26
- | TUI (manage) |<-->| agent-office serve |<-->| PostgreSQL |
27
- | Ink/React | | :7654 | | |
28
- +--------------+ | | +--------------+
29
- | CronScheduler |
30
- +--------------+ | |
31
- | Communicator |<-->| |
32
- | Web (HTMX) | | |
33
- | :7655 | +---------+-----------+
34
- +--------------+ |
35
- | /worker/* endpoints
36
- +---------+-----------+
37
- | AI Agent Workers |
38
- | (running inside |
39
- | OpenCode sessions) |
40
- +-----------------------+
35
+
36
+ Run in watch mode:
37
+
38
+ ```bash
39
+ npm run dev
41
40
  ```
42
41
 
43
- ## Installation
42
+ Run once:
44
43
 
45
44
  ```bash
46
- npm install -g agent-office
45
+ npm run start
47
46
  ```
48
47
 
49
- Or run without installing:
48
+ ## Build
49
+
50
+ Compile TypeScript to JavaScript:
50
51
 
51
52
  ```bash
52
- npx agent-office --help
53
+ npm run build
53
54
  ```
54
55
 
55
- ## Requirements
56
+ ## Global Options
57
+
58
+ - `--sqlite <path>` - SQLite database file path (env: `AGENT_OFFICE_SQLITE`)
59
+ - `--postgresql <url>` - PostgreSQL connection URL (env: `AGENT_OFFICE_POSTGRESQL`)
60
+ - `--json` - Output in JSON format instead of TOON (default: false)
61
+ - `-V, --version` - Show version
62
+ - `-h, --help` - Show help
56
63
 
57
- - Node.js >= 18
58
- - A running [OpenCode](https://opencode.ai) server (`opencode serve`)
59
- - A PostgreSQL database
64
+ ## Output Formats
60
65
 
61
- ## Quick Start
66
+ ### TOON (Default)
62
67
 
63
- ### 1. Start the server
68
+ Token-Oriented Object Notation - a compact, human-readable format optimized for LLM prompts:
64
69
 
65
70
  ```bash
66
- agent-office serve \
67
- --database-url "postgresql://user:pass@localhost:5432/mydb" \
68
- --opencode-url "http://localhost:4096" \
69
- --password mysecret
71
+ $ npx agent-office --sqlite ./data.db list-coworkers
72
+ [2]{name,agent,status,description,created_at}:
73
+ Alice,claude,active,"AI assistant",2024-01-15T10:30:00.000Z
74
+ Bob,gpt-4,available,null,2024-01-15T10:25:00.000Z
70
75
  ```
71
76
 
72
- The server runs migrations automatically on startup and initializes the cron scheduler.
77
+ ### JSON
73
78
 
74
- ### 2. Open the manager
75
-
76
- In another terminal:
79
+ Use `--json` flag anywhere in the command for traditional JSON output:
77
80
 
78
81
  ```bash
79
- agent-office manage --password mysecret
82
+ $ npx agent-office --sqlite ./data.db --json list-coworkers
83
+ [
84
+ {
85
+ "name": "Alice",
86
+ "agent": "claude",
87
+ "status": "active",
88
+ "description": "AI assistant",
89
+ "created_at": "2024-01-15T10:30:00.000Z"
90
+ }
91
+ ]
80
92
  ```
81
93
 
82
- From the TUI you can create coworkers, send them messages, browse mail, manage cron jobs, and observe their sessions.
94
+ ## Commands
95
+
96
+ ### Coworker Management
83
97
 
84
- ### 3. Chat with a coworker in the browser
98
+ **list-coworkers** - List all coworkers (sessions)
85
99
 
86
100
  ```bash
87
- agent-office communicator web "Alice" --password mysecret
101
+ npx agent-office --sqlite ./data.db list-coworkers
88
102
  ```
89
103
 
90
- Opens a web-based chat interface at `http://127.0.0.1:7655` for real-time conversation with the named coworker.
104
+ **create-coworker** - Create a new coworker
91
105
 
92
- ## How It Works
106
+ ```bash
107
+ npx agent-office --sqlite ./data.db create-coworker --name Alice --id alice-001 --agent claude
108
+ ```
109
+
110
+ **get-coworker-info** - Get coworker details
93
111
 
94
- ### Session Lifecycle
112
+ ```bash
113
+ npx agent-office --sqlite ./data.db get-coworker-info --name Alice
114
+ ```
95
115
 
96
- 1. **Create** -- A human creates a named coworker via the TUI or API. This creates an OpenCode session, stores the mapping in PostgreSQL, and sends an enrollment message containing a clock-in command.
116
+ **update-coworker** - Update coworker information
97
117
 
98
- 2. **Clock In** -- The AI agent sees the enrollment message in its session, runs `agent-office worker clock-in <token>`, and receives a welcome briefing with its name, the human manager's identity, all available CLI commands, and a privacy notice.
118
+ ```bash
119
+ # Set status
120
+ npx agent-office --sqlite ./data.db update-coworker --name Alice --status busy
99
121
 
100
- 3. **Work** - - The agent operates in its OpenCode session. It communicates with the human and other agents by running `agent-office worker send-message`. It can set its status and **request cron jobs** (which require human approval).
122
+ # Set description and philosophy
123
+ npx agent-office --sqlite ./data.db update-coworker --name Alice \
124
+ --description "Senior AI developer" \
125
+ --philosophy "Write clean, maintainable code" \
126
+ --visual-description "A friendly robot wearing glasses"
101
127
 
102
- 4. **Message Delivery** -- Messages are stored in PostgreSQL and simultaneously injected as prompts into the recipient's OpenCode session. This means agents see messages immediately in their active session context.
128
+ # Clear a field (omit the value)
129
+ npx agent-office --sqlite ./data.db update-coworker --name Alice --status
130
+ ```
103
131
 
104
- 5. **Reset** - - A session can be reverted to its initial state (clearing all conversation history) and re-enrolled.
132
+ **delete-coworker** - Delete a coworker and all their data (messages, cron jobs, cron requests)
105
133
 
106
- 6. **Delete** -- Deleting a coworker removes both the OpenCode session and the database record.
134
+ ```bash
135
+ npx agent-office --sqlite ./data.db delete-coworker --name Alice
136
+ ```
107
137
 
108
- ### Privacy Model
138
+ ### Message Commands
109
139
 
110
- Agent sessions are private by design. The welcome message tells each agent:
140
+ **send-message** - Send a message to one or more recipients
111
141
 
112
- > Nobody -- not your human manager, not your coworkers -- can see anything you think, reason, or write inside this session. Your work is completely private until you explicitly send a message.
142
+ ```bash
143
+ npx agent-office --sqlite ./data.db send-message --from Alice --to Bob Charlie --body "Hello team!"
144
+ ```
113
145
 
114
- This means agents must actively communicate to report progress, ask questions, or share results.
146
+ **check-unread-mail** - Check if there is unread mail for a coworker
115
147
 
116
- ### Cron Job Approval Workflow
148
+ ```bash
149
+ npx agent-office --sqlite ./data.db check-unread-mail --coworker Bob
150
+ # Output: hasUnread: true
151
+ ```
117
152
 
118
- To maintain human oversight over automated tasks, cron jobs require approval before becoming active:
153
+ **get-unread-mail** - Get all unread mail for a coworker and mark as read
119
154
 
120
- 1. **Request** -- AI agents use `agent-office worker cron request` to submit a cron job request with name, schedule, message, and timezone
121
- 2. **Review** -- Human managers see pending requests in the TUI under "Cron requests" or via API
122
- 3. **Approve/Reject** -- Managers can approve requests (creates active cron job) or reject with notes
123
- 4. **Notification** -- Workers receive messages about approval/rejection with manager feedback
124
- 5. **Active Jobs** -- Approved cron jobs appear in `agent-office worker cron list` and execute according to schedule
155
+ ```bash
156
+ npx agent-office --sqlite ./data.db get-unread-mail --coworker Bob
157
+ ```
125
158
 
126
- This workflow ensures:
127
- - No automated tasks run without human review
128
- - Managers can provide feedback on scheduling decisions
129
- - Clear audit trail of all cron job requests and decisions
130
- - Workers understand the approval process and can resubmit if needed
159
+ ### Cron Job Commands
131
160
 
132
- ### Authentication
161
+ **list-crons** - List all cron jobs
133
162
 
134
- Two authentication schemes run in parallel:
163
+ ```bash
164
+ npx agent-office --sqlite ./data.db list-crons
165
+ ```
135
166
 
136
- - **Bearer token** -- Human operators authenticate with `Authorization: Bearer <password>` for all management endpoints.
137
- - **Agent code** -- AI agents authenticate with a UUID passed as `?code=<uuid>` for all `/worker/*` endpoints. Each agent gets a unique code generated at session creation time.
167
+ **create-cron** - Create a new cron job directly
138
168
 
139
- ## Environment Variables
169
+ ```bash
170
+ npx agent-office --sqlite ./data.db create-cron \
171
+ --name "Daily Standup" \
172
+ --coworker Alice \
173
+ --schedule "0 9 * * *" \
174
+ --message "Time for daily standup" \
175
+ --timezone "America/New_York"
176
+ ```
140
177
 
141
- Copy `.env.example` to `.env` for local development:
178
+ **delete-cron** - Delete a cron job
142
179
 
143
180
  ```bash
144
- cp .env.example .env
181
+ npx agent-office --sqlite ./data.db delete-cron --id 1
145
182
  ```
146
183
 
147
- | Variable | Description | Default |
148
- |---|---|---|
149
- | `DATABASE_URL` | PostgreSQL connection string | (required) |
150
- | `AGENT_OFFICE_PASSWORD` | API password for human access | (required) |
151
- | `OPENCODE_URL` | OpenCode server URL | `http://localhost:4096` |
152
- | `AGENT_OFFICE_URL` | Server URL for manage/communicator clients | `http://127.0.0.1:7654` |
184
+ **enable-cron** - Enable a cron job
153
185
 
154
- ## Commands
186
+ ```bash
187
+ npx agent-office --sqlite ./data.db enable-cron --id 1
188
+ ```
189
+
190
+ **disable-cron** - Disable a cron job
155
191
 
156
- ### `agent-office serve`
192
+ ```bash
193
+ npx agent-office --sqlite ./data.db disable-cron --id 1
194
+ ```
157
195
 
158
- Starts the HTTP server. Connects to PostgreSQL, runs migrations, and initializes the cron scheduler.
196
+ **cron-history** - Get cron job execution history
159
197
 
198
+ ```bash
199
+ npx agent-office --sqlite ./data.db cron-history --id 1 --limit 10
160
200
  ```
161
- Options:
162
- --database-url <url> PostgreSQL connection string (env: DATABASE_URL)
163
- --opencode-url <url> OpenCode server URL (default: http://localhost:4096)
164
- --host <host> Bind host (default: 127.0.0.1)
165
- --port <port> Bind port (default: 7654)
166
- --password <password> REQUIRED. API password (env: AGENT_OFFICE_PASSWORD)
201
+
202
+ **check-cron-job** - Check if a cron job should run this minute
203
+
204
+ ```bash
205
+ npx agent-office --sqlite ./data.db check-cron-job --id 1
206
+ # Output: shouldRun: true
167
207
  ```
168
208
 
169
- ### `agent-office manage`
209
+ ### Cron Request Commands (Approval Workflow)
170
210
 
171
- Opens the full-screen terminal UI. All operations go through the HTTP server -- the TUI never touches PostgreSQL or OpenCode directly.
211
+ **list-cron-requests** - List all cron job requests
172
212
 
213
+ ```bash
214
+ npx agent-office --sqlite ./data.db list-cron-requests
173
215
  ```
174
- Options:
175
- --url <url> Server URL (default: http://127.0.0.1:7654)
176
- --password <password> REQUIRED. API password (env: AGENT_OFFICE_PASSWORD)
216
+
217
+ **request-cron** - Request a new cron job (requires approval)
218
+
219
+ ```bash
220
+ npx agent-office --sqlite ./data.db request-cron \
221
+ --name "Weekly Report" \
222
+ --coworker Alice \
223
+ --schedule "0 9 * * 1" \
224
+ --message "Generate weekly report"
177
225
  ```
178
226
 
179
- #### TUI Features
227
+ **get-cron-request** - Get details of a cron request
180
228
 
181
- | Screen | Description |
182
- |---|---|
183
- | **Coworkers** | Table of all agents showing name, status, mode, session ID, and masked agent code. Keyboard: `c` create, `d` delete, `r` reveal code, `g` regenerate code, `x` revert session, `X` revert all, `t` tail messages, `i` inject text, `m` coworker mail |
184
- | **Send message** | Select a recipient and compose a message |
185
- | **My mail** | View received and sent messages. `r` reply, `m` mark read, `a` mark all read. Tab between received/sent |
186
- | **Cron jobs** | Table of scheduled tasks with name, coworker, schedule, next run, and status. Create, delete, enable/disable, view history |
187
- | **Cron requests** | Approve or reject pending cron job requests from workers. View request details, approve with notes, reject with reason |
188
- | **My profile** | Set your display name and description (visible to agents in their welcome message) |
229
+ ```bash
230
+ npx agent-office --sqlite ./data.db get-cron-request --id 1
231
+ ```
189
232
 
190
- A sidebar shows all coworkers with live status indicators, refreshed every 5 seconds. An unread mail badge appears in the header.
233
+ **approve-cron-request** - Approve a pending cron request
191
234
 
192
- ### `agent-office communicator web <coworker>`
235
+ ```bash
236
+ npx agent-office --sqlite ./data.db approve-cron-request \
237
+ --id 1 \
238
+ --reviewer Bob \
239
+ --notes "Looks good, approved for production"
240
+ ```
193
241
 
194
- Launches a browser-based chat interface for real-time conversation with a specific agent.
242
+ **reject-cron-request** - Reject a pending cron request
195
243
 
244
+ ```bash
245
+ npx agent-office --sqlite ./data.db reject-cron-request \
246
+ --id 1 \
247
+ --reviewer Bob \
248
+ --notes "Please use a different schedule"
196
249
  ```
197
- Arguments:
198
- <coworker> Name of the coworker to chat with
199
250
 
200
- Options:
201
- --url <url> Server URL (default: http://127.0.0.1:7654)
202
- --password <password> API password (env: AGENT_OFFICE_PASSWORD)
203
- --host <host> Communicator bind host (default: 127.0.0.1)
204
- --port <port> Communicator bind port (default: 7655)
205
- --xai-key <key> xAI API key for voice chat (enables voice button)
251
+ **delete-cron-request** - Delete a cron request
252
+
253
+ ```bash
254
+ npx agent-office --sqlite ./data.db delete-cron-request --id 1
206
255
  ```
207
256
 
208
- Features: dark theme, iMessage-style chat bubbles, auto-scroll, Enter to send (Shift+Enter for newline), live message polling (5s), unread indicators, status display, and a reset button to revert the agent's session. **Voice mode**: When an xAI API key is provided, a microphone button appears for voice conversations with full tool access (read/write/edit/bash).
257
+ ### Task Board Commands
258
+
259
+ **list-tasks** - List all tasks
209
260
 
210
- ### `agent-office worker` (for AI agents)
261
+ ```bash
262
+ npx agent-office --sqlite ./data.db list-tasks
263
+ npx agent-office --sqlite ./data.db list-tasks --assignee Alice
264
+ npx agent-office --sqlite ./data.db list-tasks --column "working on"
265
+ ```
211
266
 
212
- All worker commands authenticate via a token in the format `<agent_code>@<server_url>`.
267
+ **add-task** - Create a new task
213
268
 
214
269
  ```bash
215
- # Clock in and receive your briefing
216
- agent-office worker clock-in <token>
270
+ npx agent-office --sqlite ./data.db add-task \
271
+ --title "Implement auth" \
272
+ --description "Add JWT authentication" \
273
+ --column "idea" \
274
+ --assignee Alice
275
+ ```
276
+
277
+ **get-task** - Get a task by ID
217
278
 
218
- # List coworkers and the human manager
219
- agent-office worker list-coworkers <token>
279
+ ```bash
280
+ npx agent-office --sqlite ./data.db get-task --id 1
281
+ ```
220
282
 
221
- # Set or clear your public status (max 140 chars)
222
- agent-office worker set-status --status "Working on auth module" <token>
223
- agent-office worker set-status --clear <token>
283
+ **update-task** - Update a task
224
284
 
225
- # Send a message to one or more recipients
226
- agent-office worker send-message --name Alice --name Bob --body "Status update: PR is ready" <token>
285
+ ```bash
286
+ npx agent-office --sqlite ./data.db update-task \
287
+ --id 1 \
288
+ --title "Updated title" \
289
+ --description "Updated description"
290
+ ```
227
291
 
228
- # If your message body contains $ characters, escape them to avoid shell variable expansion
229
- agent-office worker send-message --name Alice --body "Cost is \$50" <token>
292
+ **delete-task** - Delete a task
230
293
 
231
- # > Warning: always escape $ in --body when using double quotes in bash, or use single quotes.
232
- # > Unescaped $ will be silently expanded by the shell before the message is sent.
294
+ ```bash
295
+ npx agent-office --sqlite ./data.db delete-task --id 1
296
+ ```
233
297
 
234
- # Cron job management (requires human approval)
235
- agent-office worker cron list <token> # View your approved cron jobs
236
- agent-office worker cron request --name "daily-report" --schedule "0 9 * * *" --message "Send daily status" --respond-to "Manager" <token>
237
- agent-office worker cron request --name "weekly" --schedule "0 9 * * 1" --message "Weekly sync" --timezone "America/New_York" --respond-to "Manager" <token>
238
- agent-office worker cron requests <token> # View status of all your requests (pending/approved/rejected)
239
- agent-office worker cron delete <token> <id> # Delete your approved cron jobs
240
- agent-office worker cron enable <token> <id> # Enable your approved cron jobs
241
- agent-office worker cron disable <token> <id> # Disable your approved cron jobs
242
- agent-office worker cron history <token> <id> # View execution history
298
+ **assign-task** - Assign a task to someone
243
299
 
300
+ ```bash
301
+ npx agent-office --sqlite ./data.db assign-task --id 1 --assignee Bob
244
302
  ```
245
303
 
246
- ## REST API
304
+ **unassign-task** - Remove assignment from a task
247
305
 
248
- ### Authenticated Endpoints (Bearer token required)
306
+ ```bash
307
+ npx agent-office --sqlite ./data.db unassign-task --id 1
308
+ ```
249
309
 
250
- | Method | Path | Description |
251
- |---|---|---|
252
- | `GET` | `/health` | Health check |
253
- | `GET` | `/modes` | List available agent modes from the OpenCode server |
254
- | `GET` | `/sessions` | List all sessions |
255
- | `POST` | `/sessions` | Create a session. Body: `{ name, agent? }` |
256
- | `DELETE` | `/sessions/:name` | Delete a session |
257
- | `POST` | `/sessions/:name/regenerate-code` | Regenerate the agent code UUID |
258
- | `GET` | `/sessions/:name/messages` | Fetch messages. Query: `?limit=N` (max 100) |
259
- | `POST` | `/sessions/:name/inject` | Inject text. Body: `{ text }` |
260
- | `POST` | `/sessions/:name/revert-to-start` | Revert session and re-enroll |
261
- | `POST` | `/sessions/revert-all` | Revert all sessions |
262
- | `GET` | `/config` | Get all config values |
263
- | `PUT` | `/config` | Set a config value. Body: `{ key, value }` |
264
- | `GET` | `/messages/:name` | Get messages for a person. Query: `?sent=true`, `?unread_only=true` |
265
- | `POST` | `/messages` | Send a message. Body: `{ from, to: string[], body }` |
266
- | `POST` | `/messages/:id/read` | Mark a message as read |
267
- | `GET` | `/crons` | List approved cron jobs. Query: `?session_name=<name>` |
268
- | `POST` | `/crons` | Create a cron job (admin only). Body: `{ name, session_name, schedule, message, timezone? }` |
269
- | `DELETE` | `/crons/:id` | Delete a cron job |
270
- | `POST` | `/crons/:id/enable` | Enable a cron job |
271
- | `POST` | `/crons/:id/disable` | Disable a cron job |
272
- | `GET` | `/crons/:id/history` | Cron execution history. Query: `?limit=N` |
273
- | `GET` | `/cron-requests` | List all cron requests. Query: `?status=<status>&session_name=<name>` |
274
- | `POST` | `/cron-requests/:id/approve` | Approve a cron request. Body: `{ notes? }` |
275
- | `POST` | `/cron-requests/:id/reject` | Reject a cron request. Body: `{ notes? }` |
310
+ **move-task** - Move a task to a different column
276
311
 
312
+ ```bash
313
+ npx agent-office --sqlite ./data.db move-task --id 1 --column "ready for review"
314
+ ```
277
315
 
278
- ### Worker Endpoints (agent code auth via `?code=<uuid>`)
316
+ **task-stats** - Show task statistics by column
279
317
 
280
- | Method | Path | Description |
281
- |---|---|---|
282
- | `GET` | `/worker/clock-in` | Clock in and receive welcome briefing |
283
- | `GET` | `/worker/list-coworkers` | List all other agents and the human manager |
284
- | `POST` | `/worker/set-status` | Set or clear status. Body: `{ status }` |
285
- | `POST` | `/worker/send-message` | Send a message. Body: `{ to: string[], body }` |
286
- | `GET` | `/worker/crons` | List own approved cron jobs |
287
- | `GET` | `/worker/cron-requests` | List own cron job requests (pending/approved/rejected) |
288
- | `POST` | `/worker/cron-requests` | Request a new cron job (requires human approval) |
289
- | `DELETE` | `/worker/crons/:id` | Delete own approved cron job |
290
- | `POST` | `/worker/crons/:id/enable` | Enable own approved cron job |
291
- | `POST` | `/worker/crons/:id/disable` | Disable own approved cron job |
292
- | `GET` | `/worker/crons/:id/history` | View own cron job history |
318
+ ```bash
319
+ npx agent-office --sqlite ./data.db task-stats
320
+ ```
293
321
 
322
+ **list-task-columns** - List all valid task board columns
294
323
 
295
- ## Architecture
324
+ ```bash
325
+ npx agent-office --sqlite ./data.db list-task-columns
326
+ ```
296
327
 
297
- ### Database Schema
328
+ ## Task Board Columns
298
329
 
299
- The server uses PostgreSQL with automatic migrations. Tables:
330
+ Valid columns for tasks:
300
331
 
301
- - **`sessions`** -- Maps coworker names to OpenCode session IDs with agent codes, agent modes, and status
302
- - **`config`** -- Key-value store for application settings (`human_name`, `human_description`)
303
- - **`messages`** -- Inter-agent and human-agent mail with read/injected tracking
304
- - **`cron_requests`** -- Pending cron job requests requiring human approval with status, reviewer notes, and timestamps
305
- - **`cron_jobs`** -- Approved scheduled tasks tied to sessions with cron expressions and timezone support
306
- - **`cron_history`** -- Execution log for cron jobs with success/failure tracking
332
+ - `idea` - New ideas and proposals
333
+ - `approved idea` - Approved ideas ready to work on
334
+ - `working on` - Currently in progress
335
+ - `blocked` - Blocked by dependencies or issues
336
+ - `ready for review` - Completed, awaiting review
337
+ - `done` - Finished tasks
307
338
 
308
- ### Agentic Coding Server Abstraction
339
+ ## Testing
309
340
 
310
- The application does not depend on the OpenCode SDK directly. Instead, all OpenCode interactions go through an `AgenticCodingServer` interface (`src/lib/agentic-coding-server.ts`) with six methods:
341
+ Run all tests:
311
342
 
312
- ```typescript
313
- interface AgenticCodingServer {
314
- createSession(): Promise<string>
315
- deleteSession(sessionID: string): Promise<void>
316
- sendMessage(sessionID: string, text: string, agent?: string): Promise<void>
317
- getMessages(sessionID: string, limit?: number): Promise<SessionMessage[]>
318
- revertSession(sessionID: string, messageID: string): Promise<void>
319
- getAgentModes(): Promise<AgentMode[]>
320
- }
343
+ ```bash
344
+ npm test
321
345
  ```
322
346
 
323
- The concrete `OpenCodeCodingServer` implementation (`src/lib/opencode-coding-server.ts`) encapsulates all SDK interactions. Only the server entrypoint (`src/commands/serve.ts`) knows the concrete class -- everything else depends on the interface.
324
-
325
- ## Development
347
+ Run tests with coverage:
326
348
 
327
349
  ```bash
328
- # Install dependencies
329
- npm install
350
+ npm run test:coverage
351
+ ```
330
352
 
331
- # Copy and edit environment
332
- cp .env.example .env
353
+ Watch mode for tests:
333
354
 
334
- # Run server with hot reload
335
- npm run dev:serve -- --password secret
355
+ ```bash
356
+ npm run test:watch
357
+ ```
336
358
 
337
- # Run TUI (in another terminal)
338
- npm run dev:manage -- --password secret
359
+ ## Scripts
339
360
 
340
- # Run communicator (in another terminal)
341
- npm run dev:communicator -- "Alice" --password secret
361
+ - `npm run dev` - Run with watch mode
362
+ - `npm run start` - Run once
363
+ - `npm run build` - Compile TypeScript
364
+ - `npm run typecheck` - Type check without emitting
365
+ - `npm run lint` - Run ESLint
366
+ - `npm run format` - Format code with Prettier
367
+ - `npm test` - Run tests
368
+ - `npm run test:watch` - Run tests in watch mode
369
+ - `npm run test:coverage` - Run tests with coverage report
342
370
 
343
- # Build
344
- npm run build
345
- ```
371
+ ## Architecture
372
+
373
+ - **Commands** (`src/commands/`) - Thin CLI wrappers that handle output formatting
374
+ - **Services** (`src/services/`) - Business logic with comprehensive test coverage
375
+ - **Storage** (`src/db/`) - SQLite and PostgreSQL implementations with migrations
376
+ - **Mock Storage** (`src/db/mock-storage.ts`) - In-memory implementation for testing
346
377
 
347
378
  ## License
348
379
 
349
- MIT
380
+ MIT License - Copyright (c) 2024 Richard Anaya
@@ -0,0 +1,7 @@
1
+ import { AgentOfficeStorage } from '../db/index.js';
2
+ export declare function listCronRequests(storage: AgentOfficeStorage, useJson: boolean): Promise<void>;
3
+ export declare function getCronRequest(storage: AgentOfficeStorage, id: number, useJson: boolean): Promise<void>;
4
+ export declare function approveCronRequest(storage: AgentOfficeStorage, id: number, reviewedBy: string, reviewerNotes: string | undefined, useJson: boolean): Promise<void>;
5
+ export declare function rejectCronRequest(storage: AgentOfficeStorage, id: number, reviewedBy: string, reviewerNotes: string | undefined, useJson: boolean): Promise<void>;
6
+ export declare function deleteCronRequest(storage: AgentOfficeStorage, id: number, useJson: boolean): Promise<void>;
7
+ //# sourceMappingURL=cron-requests.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cron-requests.d.ts","sourceRoot":"","sources":["../../src/commands/cron-requests.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAInD,wBAAsB,gBAAgB,CAAC,OAAO,EAAE,kBAAkB,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAInG;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAO7G;AAED,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,iBAAiB,CACrC,OAAO,EAAE,kBAAkB,EAC3B,EAAE,EAAE,MAAM,EACV,UAAU,EAAE,MAAM,EAClB,aAAa,EAAE,MAAM,GAAG,SAAS,EACjC,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,kBAAkB,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAIhH"}