crow-central-agency 0.24.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/LICENSE +21 -0
- package/README.md +139 -0
- package/dist/_shared/constants/system-agent.js +4 -0
- package/dist/_shared/constants/system-circle.js +7 -0
- package/dist/_shared/index.js +22 -0
- package/dist/_shared/schemas/agent-circle.schema.js +64 -0
- package/dist/_shared/schemas/agent-message.schema.js +50 -0
- package/dist/_shared/schemas/agent-runtime-state.schema.js +74 -0
- package/dist/_shared/schemas/agent-task.schema.js +85 -0
- package/dist/_shared/schemas/agent.schema.js +209 -0
- package/dist/_shared/schemas/api-response.schema.js +19 -0
- package/dist/_shared/schemas/artifact.schema.js +49 -0
- package/dist/_shared/schemas/discord-config.schema.js +21 -0
- package/dist/_shared/schemas/feed.schema.js +10 -0
- package/dist/_shared/schemas/graph.schema.js +28 -0
- package/dist/_shared/schemas/mcp-config.schema.js +49 -0
- package/dist/_shared/schemas/message-source.schema.js +30 -0
- package/dist/_shared/schemas/permission.schema.js +24 -0
- package/dist/_shared/schemas/scheduler.schema.js +32 -0
- package/dist/_shared/schemas/sensor.schema.js +7 -0
- package/dist/_shared/schemas/system-settings.schema.js +30 -0
- package/dist/_shared/schemas/websocket.schema.js +197 -0
- package/dist/_shared/utils/apply-agent-order.js +35 -0
- package/dist/_shared/utils/resolve-model.js +14 -0
- package/dist/agents/crow-agent.js +68 -0
- package/dist/agents/crow-task-dispatcher-agent.js +65 -0
- package/dist/bin/crow.js +25 -0
- package/dist/bootstrap.js +149 -0
- package/dist/bot-connectors/discord/discord-bot-manager.js +205 -0
- package/dist/bot-connectors/discord/discord-bot-manager.types.js +2 -0
- package/dist/bot-connectors/discord/discord-message-splitter.js +75 -0
- package/dist/cli.js +40 -0
- package/dist/config/constants.js +37 -0
- package/dist/config/env.js +71 -0
- package/dist/container.js +51 -0
- package/dist/core/error/app-error.js +12 -0
- package/dist/core/error/app-error.types.js +35 -0
- package/dist/core/error/request-error.js +14 -0
- package/dist/core/event-bus/event-bus.js +60 -0
- package/dist/core/event-bus/event-bus.types.js +2 -0
- package/dist/core/store/file-object-store-provider.js +267 -0
- package/dist/core/store/folder-file-store-provider.js +182 -0
- package/dist/core/store/object-store.types.js +19 -0
- package/dist/core/store/store-entry-utils.js +12 -0
- package/dist/feed/feed-reader.js +410 -0
- package/dist/feed/simply-feed-manager.js +528 -0
- package/dist/feed/simply-feed-manager.types.js +2 -0
- package/dist/feed/simply-feed.types.js +5 -0
- package/dist/feed/system-prompts.js +73 -0
- package/dist/mcp/agents/agents-mcp-server.js +20 -0
- package/dist/mcp/agents/get-last-agent-message.js +55 -0
- package/dist/mcp/agents/invoke-agent.js +61 -0
- package/dist/mcp/agents/list-agents.js +32 -0
- package/dist/mcp/agents/super-agent-mcp-server.js +17 -0
- package/dist/mcp/artifacts/artifacts-mcp-server-utils.js +58 -0
- package/dist/mcp/artifacts/artifacts-mcp-server.js +42 -0
- package/dist/mcp/artifacts/delete-artifact.js +34 -0
- package/dist/mcp/artifacts/delete-circle-artifact.js +37 -0
- package/dist/mcp/artifacts/list-artifacts.js +56 -0
- package/dist/mcp/artifacts/list-circle-artifacts.js +47 -0
- package/dist/mcp/artifacts/read-artifact.js +51 -0
- package/dist/mcp/artifacts/read-circle-artifact.js +45 -0
- package/dist/mcp/artifacts/write-artifact.js +48 -0
- package/dist/mcp/artifacts/write-circle-artifact.js +52 -0
- package/dist/mcp/crow-mcp-manager.js +169 -0
- package/dist/mcp/crow-mcp-manager.types.js +2 -0
- package/dist/mcp/feed/feed-format-utils.js +64 -0
- package/dist/mcp/feed/feed-mcp-server.js +31 -0
- package/dist/mcp/feed/feed-tool-utils.js +18 -0
- package/dist/mcp/feed/get-feed-item-content.js +56 -0
- package/dist/mcp/feed/get-feed-items.js +42 -0
- package/dist/mcp/feed/get-recent-feed-items.js +47 -0
- package/dist/mcp/feed/list-feeds.js +34 -0
- package/dist/mcp/feed/search-feed-items.js +45 -0
- package/dist/mcp/reminders/add-reminder.js +35 -0
- package/dist/mcp/reminders/delete-reminder.js +30 -0
- package/dist/mcp/reminders/list-reminders.js +35 -0
- package/dist/mcp/reminders/reminders-mcp-server-utils.js +46 -0
- package/dist/mcp/reminders/reminders-mcp-server.js +30 -0
- package/dist/mcp/tasks/add-task.js +33 -0
- package/dist/mcp/tasks/assign-task.js +59 -0
- package/dist/mcp/tasks/get-task-result.js +35 -0
- package/dist/mcp/tasks/get-task.js +33 -0
- package/dist/mcp/tasks/super-tasks-mcp-server.js +20 -0
- package/dist/mcp/tasks/tasks-mcp-server-utils.js +49 -0
- package/dist/mcp/tasks/tasks-mcp-server.js +20 -0
- package/dist/mcp/tool-utils.js +88 -0
- package/dist/public/assets/arc-DH58vMfF.js +1 -0
- package/dist/public/assets/architecture-YZFGNWBL-1m9lqWSV.js +1 -0
- package/dist/public/assets/architectureDiagram-Q4EWVU46-BVnLkK3k.js +36 -0
- package/dist/public/assets/array-BCJ35G43.js +1 -0
- package/dist/public/assets/blockDiagram-DXYQGD6D-Co8oTplZ.js +132 -0
- package/dist/public/assets/c4Diagram-AHTNJAMY-Bes-MC9n.js +10 -0
- package/dist/public/assets/channel-Cghhd-az.js +1 -0
- package/dist/public/assets/chunk-2KRD3SAO-BUytkKyL.js +1 -0
- package/dist/public/assets/chunk-4BX2VUAB-Dn9kswJO.js +1 -0
- package/dist/public/assets/chunk-4TB4RGXK-GlWEFzeh.js +206 -0
- package/dist/public/assets/chunk-55IACEB6-CLBoivXU.js +1 -0
- package/dist/public/assets/chunk-5FUZZQ4R-SClOVjWh.js +62 -0
- package/dist/public/assets/chunk-5PVQY5BW-MIjbgwbb.js +2 -0
- package/dist/public/assets/chunk-67CJDMHE-DP8uymOi.js +1 -0
- package/dist/public/assets/chunk-7N4EOEYR-Df8rpJKH.js +1 -0
- package/dist/public/assets/chunk-AA7GKIK3-dAaNh5qt.js +1 -0
- package/dist/public/assets/chunk-BSJP7CBP-BlpmbHL-.js +1 -0
- package/dist/public/assets/chunk-CIAEETIT-B-_lfawE.js +1 -0
- package/dist/public/assets/chunk-Dlc7tRH4.js +1 -0
- package/dist/public/assets/chunk-EDXVE4YY-Dw5wmbE0.js +1 -0
- package/dist/public/assets/chunk-ENJZ2VHE-CRfHGk9R.js +10 -0
- package/dist/public/assets/chunk-FMBD7UC4-Cj8B2TLo.js +15 -0
- package/dist/public/assets/chunk-FOC6F5B3-BKFxWPAX.js +1 -0
- package/dist/public/assets/chunk-ICPOFSXX-Bip6PjY8.js +122 -0
- package/dist/public/assets/chunk-K5T4RW27-wgB9Boph.js +94 -0
- package/dist/public/assets/chunk-KGLVRYIC-B1Ey7P8o.js +1 -0
- package/dist/public/assets/chunk-LIHQZDEY-CD13S_fk.js +1 -0
- package/dist/public/assets/chunk-ORNJ4GCN-CskU_c8H.js +1 -0
- package/dist/public/assets/chunk-OYMX7WX6-Byb_3pR2.js +231 -0
- package/dist/public/assets/chunk-QZHKN3VN-C4w1Z4n9.js +1 -0
- package/dist/public/assets/chunk-U2HBQHQK-CB9lh0yj.js +70 -0
- package/dist/public/assets/chunk-X2U36JSP-BVvKoGNC.js +1 -0
- package/dist/public/assets/chunk-YZCP3GAM-BYP7VVCC.js +1 -0
- package/dist/public/assets/chunk-ZZ45TVLE-DbAqKOsS.js +1 -0
- package/dist/public/assets/classDiagram-6PBFFD2Q-CmZm1qEg.js +1 -0
- package/dist/public/assets/classDiagram-v2-HSJHXN6E-CePyYtof.js +1 -0
- package/dist/public/assets/clone-B_aOe17F.js +1 -0
- package/dist/public/assets/cose-bilkent-S5V4N54A-HrzqJ7kC.js +1 -0
- package/dist/public/assets/cytoscape.esm-DjboS31m.js +321 -0
- package/dist/public/assets/dagre-KV5264BT-DdsqPPnb.js +4 -0
- package/dist/public/assets/dagre-YF86gDQP.js +1 -0
- package/dist/public/assets/defaultLocale-CIS5GEjP.js +1 -0
- package/dist/public/assets/diagram-5BDNPKRD-wPoSJ_m2.js +10 -0
- package/dist/public/assets/diagram-G4DWMVQ6-ClQiXdaB.js +24 -0
- package/dist/public/assets/diagram-MMDJMWI5-FZdXovC4.js +43 -0
- package/dist/public/assets/diagram-TYMM5635-BeVIh0rm.js +24 -0
- package/dist/public/assets/dist-B51l2n-9.js +1 -0
- package/dist/public/assets/erDiagram-SMLLAGMA-CnpDc5GA.js +85 -0
- package/dist/public/assets/flatten-8S-tbaze.js +1 -0
- package/dist/public/assets/flowDiagram-DWJPFMVM-BR2wH3NW.js +162 -0
- package/dist/public/assets/ganttDiagram-T4ZO3ILL-BMHy4t8T.js +292 -0
- package/dist/public/assets/gitGraph-7Q5UKJZL-CQAYryJq.js +1 -0
- package/dist/public/assets/gitGraphDiagram-UUTBAWPF-C2YD7dvF.js +106 -0
- package/dist/public/assets/graphlib-Khf04Kaj.js +1 -0
- package/dist/public/assets/identity-CWMh0UL-.js +1 -0
- package/dist/public/assets/index-BntlXc11.css +1 -0
- package/dist/public/assets/index-CnjNix5l.js +472 -0
- package/dist/public/assets/info-OMHHGYJF-HGzfCS3Q.js +1 -0
- package/dist/public/assets/infoDiagram-42DDH7IO-DJN_52xe.js +2 -0
- package/dist/public/assets/init-BMBYmmUa.js +1 -0
- package/dist/public/assets/ishikawaDiagram-UXIWVN3A-BhSmtJDu.js +70 -0
- package/dist/public/assets/journeyDiagram-VCZTEJTY-we_-vp8p.js +139 -0
- package/dist/public/assets/kanban-definition-6JOO6SKY-JZ-gNRX_.js +89 -0
- package/dist/public/assets/katex-zcd3p-VM.js +261 -0
- package/dist/public/assets/line-DDxkHKyY.js +1 -0
- package/dist/public/assets/linear-d7UHSQqm.js +1 -0
- package/dist/public/assets/mermaid-parser.core-CZDxisWB.js +4 -0
- package/dist/public/assets/mindmap-definition-QFDTVHPH-B2pEMikk.js +96 -0
- package/dist/public/assets/ordinal-BDTCIhXR.js +1 -0
- package/dist/public/assets/packet-4T2RLAQJ-BRNfV5ia.js +1 -0
- package/dist/public/assets/path-CIRGLb_6.js +1 -0
- package/dist/public/assets/pie-ZZUOXDRM-C3D0dwDl.js +1 -0
- package/dist/public/assets/pieDiagram-DEJITSTG-dn2h7roR.js +30 -0
- package/dist/public/assets/quadrantDiagram-34T5L4WZ-C1-ycBAn.js +7 -0
- package/dist/public/assets/radar-PYXPWWZC-BUJUf3zT.js +1 -0
- package/dist/public/assets/reduce-CrhS_VCc.js +1 -0
- package/dist/public/assets/requirementDiagram-MS252O5E-BW9GmaKc.js +84 -0
- package/dist/public/assets/rough.esm-DtEqI08j.js +1 -0
- package/dist/public/assets/sankeyDiagram-XADWPNL6-xq9V9HTT.js +10 -0
- package/dist/public/assets/sequenceDiagram-FGHM5R23-CJ0wT8j5.js +157 -0
- package/dist/public/assets/src-Cxc1bu7b.js +1 -0
- package/dist/public/assets/stateDiagram-FHFEXIEX-BYdWutSt.js +1 -0
- package/dist/public/assets/stateDiagram-v2-QKLJ7IA2-DDx3MEjM.js +1 -0
- package/dist/public/assets/timeline-definition-GMOUNBTQ-B0-7yvBq.js +120 -0
- package/dist/public/assets/treeView-SZITEDCU-CDEBXy_i.js +1 -0
- package/dist/public/assets/treemap-W4RFUUIX-BU1LThmA.js +1 -0
- package/dist/public/assets/vennDiagram-DHZGUBPP-ns7cjxkA.js +34 -0
- package/dist/public/assets/wardley-RL74JXVD-DKwuddHn.js +1 -0
- package/dist/public/assets/wardleyDiagram-NUSXRM2D-DDEJGTVl.js +20 -0
- package/dist/public/assets/xychartDiagram-5P7HB3ND-DDwarp5t.js +7 -0
- package/dist/public/crow.png +0 -0
- package/dist/public/index.html +30 -0
- package/dist/routes/agent.routes.js +144 -0
- package/dist/routes/artifact.routes.js +112 -0
- package/dist/routes/auth.routes.js +10 -0
- package/dist/routes/circle.routes.js +96 -0
- package/dist/routes/feed.routes.js +62 -0
- package/dist/routes/generation.routes.js +27 -0
- package/dist/routes/graph.routes.js +38 -0
- package/dist/routes/health.routes.js +9 -0
- package/dist/routes/mcp.routes.js +46 -0
- package/dist/routes/route-utils.js +16 -0
- package/dist/routes/sensor.routes.js +11 -0
- package/dist/routes/system-settings.routes.js +43 -0
- package/dist/routes/task.routes.js +84 -0
- package/dist/routines/agent-loop-routine.js +32 -0
- package/dist/routines/agent-reminder-routine.js +37 -0
- package/dist/routines/discord-routine.js +49 -0
- package/dist/routines/feed-cleanup-routine.js +59 -0
- package/dist/routines/feed-new-items-routine.js +94 -0
- package/dist/routines/inter-agent-task-routine.js +367 -0
- package/dist/routines/routine-manager.js +112 -0
- package/dist/routines/routine-manager.types.js +2 -0
- package/dist/routines/task-dispatch-routine.js +75 -0
- package/dist/runner/agent-runner.js +489 -0
- package/dist/runner/agent-runner.types.js +16 -0
- package/dist/runner/stream-processor.js +193 -0
- package/dist/runner/tool-activity-parser.js +59 -0
- package/dist/sensors/capture-client-info.js +15 -0
- package/dist/sensors/geolocation-sensor.js +89 -0
- package/dist/sensors/sensor-manager.js +42 -0
- package/dist/sensors/sensor-manager.types.js +2 -0
- package/dist/sensors/weather-sensor.js +128 -0
- package/dist/server/auth-hook.js +43 -0
- package/dist/server/auth-utils.js +16 -0
- package/dist/server/create-server.js +68 -0
- package/dist/server/error-handler.js +70 -0
- package/dist/server/request-context-hook.js +52 -0
- package/dist/server/request-context.js +20 -0
- package/dist/server/request-context.types.js +2 -0
- package/dist/server/setup-websocket.js +92 -0
- package/dist/services/agent-circle-manager.js +414 -0
- package/dist/services/agent-circle-manager.types.js +2 -0
- package/dist/services/agent-registry.js +342 -0
- package/dist/services/agent-registry.types.js +2 -0
- package/dist/services/agent-task-manager.js +381 -0
- package/dist/services/agent-task-manager.types.js +2 -0
- package/dist/services/artifact/artifact-adapter/word-adapter.js +24 -0
- package/dist/services/artifact/artifact-manager.js +313 -0
- package/dist/services/artifact/artifact-manager.types.js +2 -0
- package/dist/services/crow-scheduler.js +334 -0
- package/dist/services/crow-scheduler.types.js +2 -0
- package/dist/services/message-queue-manager.js +127 -0
- package/dist/services/message-queue-manager.types.js +2 -0
- package/dist/services/runtime/agent-runtime-manager.js +656 -0
- package/dist/services/runtime/agent-runtime-manager.types.js +2 -0
- package/dist/services/runtime/permission-handler.js +107 -0
- package/dist/services/runtime/permission-handler.types.js +2 -0
- package/dist/services/session/session-manager.js +60 -0
- package/dist/services/session/session-message-transformer.js +125 -0
- package/dist/services/system-settings-manager.js +52 -0
- package/dist/services/text-generation/md-generation.js +51 -0
- package/dist/services/text-generation/provider/openai-provider.js +161 -0
- package/dist/services/text-generation/text-generation-service.js +107 -0
- package/dist/services/text-generation/text-generation-service.types.js +14 -0
- package/dist/services/ws-broadcaster.js +51 -0
- package/dist/telemetry/agent-telemetry.js +122 -0
- package/dist/telemetry/setup.js +58 -0
- package/dist/utils/agent-config-sanitizer.js +18 -0
- package/dist/utils/date-utils.js +19 -0
- package/dist/utils/fs-utils.js +166 -0
- package/dist/utils/html-sanitizer.js +21 -0
- package/dist/utils/id-utils.js +23 -0
- package/dist/utils/logger.js +13 -0
- package/dist/utils/message-template.js +92 -0
- package/dist/utils/message-template.types.js +2 -0
- package/dist/utils/mime-type.js +45 -0
- package/dist/utils/nhm-extensions/table-custom-translator.js +63 -0
- package/dist/utils/validation.js +38 -0
- package/package.json +104 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 hmmroger
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
# Crow Central Agency
|
|
2
|
+
|
|
3
|
+
Multi-instance Claude Code manager with a bundled web UI for orchestrating multiple Claude Code agents from one place.
|
|
4
|
+
|
|
5
|
+
Use it to build research crews, monitoring watchdogs, content pipelines, support triagers, or anything else you can shape from agents coordinating with each other.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **Multi-agent dashboard** - run many Claude Code agents in parallel, each with its own workspace, model, persona, and tool set.
|
|
10
|
+
- **Agent coordination** - compose agents into layered relationships that produce and share artifacts, adaptable to a wide range of workflows and scenarios.
|
|
11
|
+
- **Flexible triggers** - ad-hoc chat, assigned tasks, reminders, or scheduled prompts on configurable day-of-week / time-of-day windows.
|
|
12
|
+
- **Rich configuration** - per-agent MCP servers, permission modes, Discord bots, RSS feeds (with optional LLM summarization), and AI-assisted persona / `AGENT.md` generation.
|
|
13
|
+
- **OpenTelemetry export** - optional traces and metrics for every agent query (see below).
|
|
14
|
+
|
|
15
|
+
## Requirements
|
|
16
|
+
|
|
17
|
+
- Node.js `>=24`
|
|
18
|
+
- Claude Code CLI available on `PATH` (or set `CLAUDE_CLI_PATH`)
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
1. **Install Node.js `>=24`.** Check your version with `node --version`. If it is missing or older, install from [nodejs.org](https://nodejs.org/) or use [nvm](https://github.com/nvm-sh/nvm) (`nvm install 24 && nvm use 24`).
|
|
23
|
+
|
|
24
|
+
2. **Install the Claude Code CLI.** Make sure the `claude` command is on your `PATH` (or point `CLAUDE_CLI_PATH` at the binary). Verify with `claude --version`.
|
|
25
|
+
|
|
26
|
+
3. **Create a `.env` file with an `ACCESS_KEY`.** Pick any non-empty string — a long random value is recommended. A dedicated folder like `~/.crow` keeps it out of your project directories:
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
mkdir -p ~/.crow
|
|
30
|
+
echo "ACCESS_KEY=your-secret-value" > ~/.crow/.env
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
TIP: Generate a strong value with `openssl rand -hex 32`.
|
|
34
|
+
|
|
35
|
+
4. **Start Crow**, pointing at the env file you just created:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npx crow-central-agency --env-file ~/.crow/.env
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
5. **Open [http://localhost:3101](http://localhost:3101)** in your browser. On first load the UI prompts for the access key — paste the same value you set in step 3.
|
|
42
|
+
|
|
43
|
+
### Run from a cloned repo
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
git clone https://github.com/hmmroger/crow-central-agency.git
|
|
47
|
+
cd crow-central-agency
|
|
48
|
+
npm install
|
|
49
|
+
npm run build
|
|
50
|
+
npm start -- --env-file ~/.crow/.env
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
`npm start` runs the same single-box entry point as the published CLI.
|
|
54
|
+
|
|
55
|
+
## Configuration
|
|
56
|
+
|
|
57
|
+
Crow reads configuration from environment variables. The simplest approach is to copy `.env.example` to `.env` in the directory you launch from — `dotenv` loads it automatically on startup.
|
|
58
|
+
|
|
59
|
+
```bash
|
|
60
|
+
cp .env.example .env
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Required: `ACCESS_KEY`
|
|
64
|
+
|
|
65
|
+
`ACCESS_KEY` is the only required variable. It is a shared secret between the server and the browser UI — you **choose the value yourself**; there is no default and no external provisioning.
|
|
66
|
+
|
|
67
|
+
1. Pick any non-empty string (a long random value is recommended, e.g. `openssl rand -hex 32`).
|
|
68
|
+
2. Set `ACCESS_KEY=<your value>` in `.env`.
|
|
69
|
+
3. On first load, the web UI prompts for the access key — enter the same value. It is then stored in the browser and sent as `Authorization: Bearer <key>` on API requests (and as a query param on the WebSocket connection).
|
|
70
|
+
|
|
71
|
+
Requests without a valid key receive `401 Unauthorized`.
|
|
72
|
+
|
|
73
|
+
### Custom env file path
|
|
74
|
+
|
|
75
|
+
To load a `.env` from a non-default location, pass `--env-file`:
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
npx crow-central-agency --env-file /path/to/custom.env
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
The same flag works with `npm start` when running from a clone:
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm start -- --env-file /path/to/custom.env
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
If `--env-file` is omitted, `dotenv` falls back to `.env` in the current working directory.
|
|
88
|
+
|
|
89
|
+
### Other variables
|
|
90
|
+
|
|
91
|
+
See `.env.example` for the full list, including:
|
|
92
|
+
|
|
93
|
+
- `HOST` / `PORT` — server bind address (defaults: `localhost:3101`). Keep `HOST=localhost` and front the server with a secure tunnel for remote access rather than binding to `0.0.0.0`.
|
|
94
|
+
- `CORS_ORIGINS` — only needed when the frontend is served from a different origin (e.g. during frontend dev). Single-box deployments can leave it unset.
|
|
95
|
+
- `CROW_SYSTEM_PATH` — directory for Crow's file-based storage. Defaults to `~/.crow`.
|
|
96
|
+
- `TEXT_GENERATION_*` — optional OpenAI-compatible endpoint that enables the AI-assisted persona / `AGENT.md` generation features in the agent editor.
|
|
97
|
+
- `FEED_TEXT_GENERATION_*` — optional OpenAI-compatible endpoint used by the feed manager to summarize feed items into a consistent length for better agent consumption.
|
|
98
|
+
- `OTEL_*` — optional OpenTelemetry export.
|
|
99
|
+
- `ANTHROPIC_API_KEY` — Anthropic API key.
|
|
100
|
+
|
|
101
|
+
## OpenTelemetry
|
|
102
|
+
|
|
103
|
+
Crow emits traces and metrics via `@opentelemetry/sdk-node`. Telemetry is off by default — set `OTEL_ENABLED=true` along with the standard OTel env vars (`OTEL_SERVICE_NAME`, `OTEL_EXPORTER_OTLP_ENDPOINT`, etc.) to export to your collector.
|
|
104
|
+
|
|
105
|
+
Built-in HTTP/Fastify/Undici instrumentations cover inbound requests and outgoing HTTP calls. On top of that, Crow adds agent-query instrumentation under the `crow.agent` tracer and meter.
|
|
106
|
+
|
|
107
|
+
> [!NOTE]
|
|
108
|
+
> Unlike typical operational telemetry, Crow's spans include user-authored content on attributes and events — notably `agent.name` and `tool.description` (the latter often derived from tool-use input). Error messages and recorded exceptions (`agent.error`) may also contain PII surfaced from underlying tools or model output. Anything you export is visible to whatever OTel backend you point at, so only send telemetry to a provider you trust.
|
|
109
|
+
|
|
110
|
+
### Traces — `crow.agent`
|
|
111
|
+
|
|
112
|
+
One span per agent query, named `agent.query`.
|
|
113
|
+
|
|
114
|
+
Span attributes:
|
|
115
|
+
|
|
116
|
+
- `agent.id`, `agent.name` — identity of the agent being queried
|
|
117
|
+
- `agent.source_type` — what triggered the query (e.g. `USER`, `TASK`, `LOOP`)
|
|
118
|
+
- `agent.session_id` — Claude Code session id (set once the `INIT` event arrives)
|
|
119
|
+
- `agent.done_type` — terminal reason (`aborted`, or the done-event type on success)
|
|
120
|
+
- `agent.duration_ms` — total query duration
|
|
121
|
+
- `agent.error` — error message on failure (span status set to `ERROR`, exception recorded with stack trace)
|
|
122
|
+
|
|
123
|
+
Span events:
|
|
124
|
+
|
|
125
|
+
- `tool_use` — emitted per tool invocation with `tool.name` and `tool.description`
|
|
126
|
+
- `message_done` — emitted per assistant message with `message.input_tokens`, `message.output_tokens`, `message.total_input_tokens` (the last includes cache-read and cache-creation tokens)
|
|
127
|
+
|
|
128
|
+
### Metrics — `crow.agent`
|
|
129
|
+
|
|
130
|
+
All metrics are tagged with `agent.id` and `agent.name`.
|
|
131
|
+
|
|
132
|
+
- `agent.query.input_tokens` (histogram, unit `tokens`) — total input tokens per assistant message, including cache-read and cache-creation tokens
|
|
133
|
+
- `agent.query.output_tokens` (histogram, unit `tokens`) — output tokens per assistant message
|
|
134
|
+
- `agent.query.duration` (histogram, unit `s`) — total duration of each agent query
|
|
135
|
+
- `agent.query.tool_use` (counter, unit `invocations`) — tool invocations, additionally tagged with `tool.name`
|
|
136
|
+
|
|
137
|
+
## License
|
|
138
|
+
|
|
139
|
+
MIT
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Well-known system circle constants.
|
|
3
|
+
* The Base Circle is a built-in circle for agents with no explicit circle membership.
|
|
4
|
+
*/
|
|
5
|
+
export const BASE_CIRCLE_ID = "__base_circle__";
|
|
6
|
+
export const BASE_CIRCLE_NAME = "Crow Circle";
|
|
7
|
+
//# sourceMappingURL=system-circle.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export { CLAUDE_MODELS, CLAUDE_CODE_MODEL_OPTIONS, DEFAULT_MODEL, AgentIdSchema, AgentConfigSchema, AgentConfigTemplateSchema, CreateAgentInputSchema, UpdateAgentInputSchema, ToolConfigSchema, PermissionModeSchema, SettingSourceSchema, LoopConfigSchema, ConfiguredFeedSchema, MAX_LOOP_TIMES, PERMISSION_MODE, SETTING_SOURCE, DEFAULT_SETTING_SOURCES, TOOL_MODE, DEFAULT_AVAILABLE_TOOLS, SUBAGENT_TOOL_NAME, AGENT_TYPE, } from "./schemas/agent.schema.js";
|
|
2
|
+
export { SchedulerTimeSchema, DAY_OF_WEEK, DayOfWeekSchema, TimeModeSchema, TIME_MODE, } from "./schemas/scheduler.schema.js";
|
|
3
|
+
export { createApiSuccessSchema, ApiErrorSchema, } from "./schemas/api-response.schema.js";
|
|
4
|
+
export { SessionUsageSchema, PendingPermissionInfoSchema, AgentRuntimeStateSchema, AgentActivitySchema, AGENT_ACTIVITY_TYPE, AGENT_STATUS, } from "./schemas/agent-runtime-state.schema.js";
|
|
5
|
+
export { ClientMessageSchema, ServerMessageSchema, SendMessageSchema, InjectMessageSchema, PermissionResponseWsSchema, AgentTextWsMessageSchema, AgentActivityWsMessageSchema, AgentResultWsMessageSchema, AgentStatusWsMessageSchema, AgentUpdatedWsMessageSchema, AgentUsageWsMessageSchema, PermissionRequestWsMessageSchema, PermissionCancelledWsMessageSchema, ErrorWsMessageSchema, AgentMessageWsMessageSchema, AgentToolProgressWsMessageSchema, TaskAddedWsMessageSchema, TaskUpdatedWsMessageSchema, TaskAssignedWsMessageSchema, TaskStateChangedWsMessageSchema, TaskDeletedWsMessageSchema, CircleCreatedWsMessageSchema, CircleUpdatedWsMessageSchema, CircleDeletedWsMessageSchema, RelationshipCreatedWsMessageSchema, RelationshipDeletedWsMessageSchema, CLIENT_MESSAGE_TYPE, SERVER_MESSAGE_TYPE, } from "./schemas/websocket.schema.js";
|
|
6
|
+
export { PERMISSION_DECISION, PermissionRequestSchema, PermissionResponseSchema, } from "./schemas/permission.schema.js";
|
|
7
|
+
export { AgentMessageSchema, AGENT_MESSAGE_ROLE, AGENT_MESSAGE_TYPE, } from "./schemas/agent-message.schema.js";
|
|
8
|
+
export { ARTIFACT_TYPE, ARTIFACT_CONTENT_TYPE, ArtifactTypeSchema, ArtifactContentTypeSchema, ArtifactMetadataSchema, } from "./schemas/artifact.schema.js";
|
|
9
|
+
export { AGENT_TASK_STATE, AGENT_TASK_SOURCE_TYPE, AgentTaskStateSchema, AgentTaskSourceSchema, AgentTaskItemSchema, AgentTaskDatabaseSchema, CreateTaskInputSchema, UpdateTaskInputSchema, UpdateTaskStateInputSchema, AssignTaskInputSchema, } from "./schemas/agent-task.schema.js";
|
|
10
|
+
export { MCP_CONFIG_TYPE, McpServerConfigSchema, CreateMcpConfigInputSchema, UpdateMcpConfigInputSchema, } from "./schemas/mcp-config.schema.js";
|
|
11
|
+
export { SensorInfoSchema } from "./schemas/sensor.schema.js";
|
|
12
|
+
export { AddFeedInputSchema, DetectFeedsInputSchema, } from "./schemas/feed.schema.js";
|
|
13
|
+
export { DiscordConfigSchema } from "./schemas/discord-config.schema.js";
|
|
14
|
+
export { SuperCrowSettingsSchema, UpdateSuperCrowSettingsInputSchema, DashboardSettingsSchema, UpdateDashboardSettingsInputSchema, } from "./schemas/system-settings.schema.js";
|
|
15
|
+
export { applyAgentOrder } from "./utils/apply-agent-order.js";
|
|
16
|
+
export { MODEL_ALIASES, resolveModel } from "./utils/resolve-model.js";
|
|
17
|
+
export { BASE_CIRCLE_ID, BASE_CIRCLE_NAME } from "./constants/system-circle.js";
|
|
18
|
+
export { ENTITY_TYPE, RELATIONSHIP_TYPE, AgentCircleSchema, CreateAgentCircleInputSchema, UpdateAgentCircleInputSchema, EntityTypeSchema, RelationshipTypeSchema, RelationshipSchema, CreateRelationshipInputSchema, CircleMemberSchema, } from "./schemas/agent-circle.schema.js";
|
|
19
|
+
export { CROW_SYSTEM_AGENT_ID, CROW_TASK_DISPATCHER_AGENT_ID } from "./constants/system-agent.js";
|
|
20
|
+
export { MESSAGE_SOURCE_TYPE, MessageSourceSchema, } from "./schemas/message-source.schema.js";
|
|
21
|
+
export { GraphNodeSchema, GraphEdgeSchema, GraphDataSchema, } from "./schemas/graph.schema.js";
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Entity types used in relationship source/target fields.
|
|
4
|
+
*/
|
|
5
|
+
export const ENTITY_TYPE = {
|
|
6
|
+
AGENT: "AGENT",
|
|
7
|
+
AGENT_CIRCLE: "AGENT_CIRCLE",
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Relationship types between entities.
|
|
11
|
+
* MEMBERSHIP means "source contains target as a member".
|
|
12
|
+
*/
|
|
13
|
+
export const RELATIONSHIP_TYPE = {
|
|
14
|
+
MEMBERSHIP: "MEMBERSHIP",
|
|
15
|
+
};
|
|
16
|
+
export const AgentCircleSchema = z.object({
|
|
17
|
+
/** Unique identifier - UUID for user-created circles, well-known string for system circles */
|
|
18
|
+
id: z.string().min(1),
|
|
19
|
+
/** Circle display name */
|
|
20
|
+
name: z.string().min(1).max(64),
|
|
21
|
+
/** Whether this is a built-in system circle (cannot be deleted) */
|
|
22
|
+
isSystemCircle: z.boolean().optional(),
|
|
23
|
+
/** Conventions or rules for the circle that agents should follow */
|
|
24
|
+
convention: z.string().optional(),
|
|
25
|
+
/** Display order for dashboard rendering (lower = first) */
|
|
26
|
+
displayOrder: z.number().optional(),
|
|
27
|
+
createdTimestamp: z.number(),
|
|
28
|
+
updatedTimestamp: z.number(),
|
|
29
|
+
});
|
|
30
|
+
export const CreateAgentCircleInputSchema = z.object({
|
|
31
|
+
name: z.string().min(1).max(64),
|
|
32
|
+
convention: z.string().optional(),
|
|
33
|
+
displayOrder: z.number().optional(),
|
|
34
|
+
});
|
|
35
|
+
export const UpdateAgentCircleInputSchema = z.object({
|
|
36
|
+
name: z.string().min(1).max(64).optional(),
|
|
37
|
+
convention: z.string().optional(),
|
|
38
|
+
displayOrder: z.number().optional(),
|
|
39
|
+
});
|
|
40
|
+
export const EntityTypeSchema = z.enum([ENTITY_TYPE.AGENT, ENTITY_TYPE.AGENT_CIRCLE]);
|
|
41
|
+
export const RelationshipTypeSchema = z.enum([RELATIONSHIP_TYPE.MEMBERSHIP]);
|
|
42
|
+
export const RelationshipSchema = z.object({
|
|
43
|
+
/** Unique identifier - UUID except for virtual relationship with system agents */
|
|
44
|
+
id: z.string().min(1),
|
|
45
|
+
sourceEntityId: z.string(),
|
|
46
|
+
sourceEntityType: EntityTypeSchema,
|
|
47
|
+
targetEntityId: z.string(),
|
|
48
|
+
targetEntityType: EntityTypeSchema,
|
|
49
|
+
relationshipType: RelationshipTypeSchema,
|
|
50
|
+
createdTimestamp: z.number(),
|
|
51
|
+
});
|
|
52
|
+
export const CreateRelationshipInputSchema = z.object({
|
|
53
|
+
sourceEntityId: z.string(),
|
|
54
|
+
sourceEntityType: EntityTypeSchema,
|
|
55
|
+
targetEntityId: z.string(),
|
|
56
|
+
targetEntityType: EntityTypeSchema,
|
|
57
|
+
relationshipType: RelationshipTypeSchema,
|
|
58
|
+
});
|
|
59
|
+
export const CircleMemberSchema = z.object({
|
|
60
|
+
relationshipId: z.string(),
|
|
61
|
+
entityId: z.string(),
|
|
62
|
+
entityType: EntityTypeSchema,
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=agent-circle.schema.js.map
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const AGENT_MESSAGE_ROLE = {
|
|
3
|
+
USER: "user",
|
|
4
|
+
AGENT: "agent",
|
|
5
|
+
SYSTEM: "system",
|
|
6
|
+
};
|
|
7
|
+
export const AGENT_MESSAGE_TYPE = {
|
|
8
|
+
TEXT: "TEXT",
|
|
9
|
+
THINKING: "THINKING",
|
|
10
|
+
TOOL_USE: "TOOL_USE",
|
|
11
|
+
};
|
|
12
|
+
/** Shared base fields for all agent messages */
|
|
13
|
+
const AgentMessageBase = z.object({
|
|
14
|
+
/** Unique message identifier (derived from SDK SessionMessage uuid) */
|
|
15
|
+
id: z.string(),
|
|
16
|
+
/** Message content - user text, agent markdown response, or tool activity description */
|
|
17
|
+
content: z.string(),
|
|
18
|
+
/** Timestamp for ordering */
|
|
19
|
+
timestamp: z.number(),
|
|
20
|
+
});
|
|
21
|
+
/** User or agent text message */
|
|
22
|
+
const TextMessageSchema = AgentMessageBase.extend({
|
|
23
|
+
role: z.enum([AGENT_MESSAGE_ROLE.USER, AGENT_MESSAGE_ROLE.AGENT]),
|
|
24
|
+
type: z.literal(AGENT_MESSAGE_TYPE.TEXT),
|
|
25
|
+
});
|
|
26
|
+
/** Agent thinking block (collapsed in UI by default) */
|
|
27
|
+
const ThinkingMessageSchema = AgentMessageBase.extend({
|
|
28
|
+
role: z.literal(AGENT_MESSAGE_ROLE.AGENT),
|
|
29
|
+
type: z.literal(AGENT_MESSAGE_TYPE.THINKING),
|
|
30
|
+
});
|
|
31
|
+
/** Tool use activity (system-generated) */
|
|
32
|
+
const ToolUseMessageSchema = AgentMessageBase.extend({
|
|
33
|
+
role: z.literal(AGENT_MESSAGE_ROLE.SYSTEM),
|
|
34
|
+
type: z.literal(AGENT_MESSAGE_TYPE.TOOL_USE),
|
|
35
|
+
/** Tool name - identifies which tool was used */
|
|
36
|
+
toolName: z.string(),
|
|
37
|
+
/** Raw tool input passed to the tool */
|
|
38
|
+
toolInput: z.record(z.string(), z.unknown()),
|
|
39
|
+
});
|
|
40
|
+
/**
|
|
41
|
+
* Agent message - the standard message data model for the conversation.
|
|
42
|
+
* Created exclusively by SessionManager from SDK SessionMessage data.
|
|
43
|
+
* Discriminated union on `type` enforces valid role/type combinations.
|
|
44
|
+
*/
|
|
45
|
+
export const AgentMessageSchema = z.discriminatedUnion("type", [
|
|
46
|
+
TextMessageSchema,
|
|
47
|
+
ThinkingMessageSchema,
|
|
48
|
+
ToolUseMessageSchema,
|
|
49
|
+
]);
|
|
50
|
+
//# sourceMappingURL=agent-message.schema.js.map
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { MessageSourceSchema } from "./message-source.schema.js";
|
|
3
|
+
export const AGENT_STATUS = {
|
|
4
|
+
IDLE: "idle",
|
|
5
|
+
ACTIVATING: "activating",
|
|
6
|
+
STREAMING: "streaming",
|
|
7
|
+
COMPACTING: "compacting",
|
|
8
|
+
};
|
|
9
|
+
export const AGENT_ACTIVITY_TYPE = {
|
|
10
|
+
GENERAL: "GENERAL",
|
|
11
|
+
QUERYSTART: "QUERYSTART",
|
|
12
|
+
TOOLUSE: "TOOLUSE",
|
|
13
|
+
};
|
|
14
|
+
export const AgentActivityCommonSchema = z.object({
|
|
15
|
+
id: z.string(),
|
|
16
|
+
timestamp: z.number(),
|
|
17
|
+
});
|
|
18
|
+
export const AgentQueryStartSchema = AgentActivityCommonSchema.extend({
|
|
19
|
+
type: z.literal(AGENT_ACTIVITY_TYPE.QUERYSTART),
|
|
20
|
+
});
|
|
21
|
+
export const AgentGeneralActivitySchema = AgentActivityCommonSchema.extend({
|
|
22
|
+
type: z.literal(AGENT_ACTIVITY_TYPE.GENERAL),
|
|
23
|
+
activity: z.string(),
|
|
24
|
+
description: z.string(),
|
|
25
|
+
subAgentId: z.string().optional(),
|
|
26
|
+
});
|
|
27
|
+
export const AgentToolUseActivitySchema = AgentActivityCommonSchema.extend({
|
|
28
|
+
type: z.literal(AGENT_ACTIVITY_TYPE.TOOLUSE),
|
|
29
|
+
toolName: z.string(),
|
|
30
|
+
description: z.string(),
|
|
31
|
+
input: z.unknown().optional(),
|
|
32
|
+
subAgentId: z.string().optional(),
|
|
33
|
+
});
|
|
34
|
+
export const AgentActivitySchema = z.discriminatedUnion("type", [
|
|
35
|
+
AgentGeneralActivitySchema,
|
|
36
|
+
AgentToolUseActivitySchema,
|
|
37
|
+
AgentQueryStartSchema,
|
|
38
|
+
]);
|
|
39
|
+
/**
|
|
40
|
+
* Session usage tracking - accumulated across queries in a session
|
|
41
|
+
*/
|
|
42
|
+
export const SessionUsageSchema = z.object({
|
|
43
|
+
inputTokens: z.number().default(0),
|
|
44
|
+
outputTokens: z.number().default(0),
|
|
45
|
+
totalCostUsd: z.number().default(0),
|
|
46
|
+
contextUsed: z.number().default(0),
|
|
47
|
+
contextTotal: z.number().default(0),
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Pending permission request metadata - persisted on runtime state
|
|
51
|
+
* so the frontend can recover pending permissions on refresh.
|
|
52
|
+
*/
|
|
53
|
+
export const PendingPermissionInfoSchema = z.object({
|
|
54
|
+
toolUseId: z.string(),
|
|
55
|
+
toolName: z.string(),
|
|
56
|
+
input: z.record(z.string(), z.unknown()).optional(),
|
|
57
|
+
decisionReason: z.string().optional(),
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Agent runtime state - maintained by the runtime manager per agent.
|
|
61
|
+
*/
|
|
62
|
+
export const AgentRuntimeStateSchema = z.object({
|
|
63
|
+
agentId: z.string(),
|
|
64
|
+
status: z
|
|
65
|
+
.enum([AGENT_STATUS.IDLE, AGENT_STATUS.ACTIVATING, AGENT_STATUS.STREAMING, AGENT_STATUS.COMPACTING])
|
|
66
|
+
.default(AGENT_STATUS.IDLE),
|
|
67
|
+
messageSource: MessageSourceSchema.optional(),
|
|
68
|
+
discordDmChannelId: z.string().optional(),
|
|
69
|
+
sessionId: z.string().optional(),
|
|
70
|
+
sessionUsage: SessionUsageSchema,
|
|
71
|
+
lastError: z.string().optional(),
|
|
72
|
+
pendingPermissions: z.array(PendingPermissionInfoSchema).optional(),
|
|
73
|
+
});
|
|
74
|
+
//# sourceMappingURL=agent-runtime-state.schema.js.map
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const AGENT_TASK_STATE = {
|
|
3
|
+
OPEN: "OPEN",
|
|
4
|
+
ACTIVE: "ACTIVE",
|
|
5
|
+
INCOMPLETE: "INCOMPLETE",
|
|
6
|
+
COMPLETED: "COMPLETED",
|
|
7
|
+
CLOSED: "CLOSED",
|
|
8
|
+
};
|
|
9
|
+
export const AGENT_TASK_SOURCE_TYPE = {
|
|
10
|
+
AGENT: "AGENT",
|
|
11
|
+
USER: "USER",
|
|
12
|
+
LOOP: "LOOP",
|
|
13
|
+
REMINDER: "REMINDER",
|
|
14
|
+
SYSTEM: "SYSTEM",
|
|
15
|
+
};
|
|
16
|
+
const UserSourceSchema = z.object({
|
|
17
|
+
sourceType: z.literal(AGENT_TASK_SOURCE_TYPE.USER),
|
|
18
|
+
});
|
|
19
|
+
const AgentSourceSchema = z.object({
|
|
20
|
+
sourceType: z.literal(AGENT_TASK_SOURCE_TYPE.AGENT),
|
|
21
|
+
agentId: z.string(),
|
|
22
|
+
});
|
|
23
|
+
const LoopSourceSchema = z.object({
|
|
24
|
+
sourceType: z.literal(AGENT_TASK_SOURCE_TYPE.LOOP),
|
|
25
|
+
});
|
|
26
|
+
const ReminderSourceSchema = z.object({
|
|
27
|
+
sourceType: z.literal(AGENT_TASK_SOURCE_TYPE.REMINDER),
|
|
28
|
+
});
|
|
29
|
+
const SystemSourceSchema = z.object({
|
|
30
|
+
sourceType: z.literal(AGENT_TASK_SOURCE_TYPE.SYSTEM),
|
|
31
|
+
});
|
|
32
|
+
export const AgentTaskSourceSchema = z.discriminatedUnion("sourceType", [
|
|
33
|
+
UserSourceSchema,
|
|
34
|
+
AgentSourceSchema,
|
|
35
|
+
LoopSourceSchema,
|
|
36
|
+
ReminderSourceSchema,
|
|
37
|
+
SystemSourceSchema,
|
|
38
|
+
]);
|
|
39
|
+
export const AgentTaskStateSchema = z.enum([
|
|
40
|
+
AGENT_TASK_STATE.OPEN,
|
|
41
|
+
AGENT_TASK_STATE.ACTIVE,
|
|
42
|
+
AGENT_TASK_STATE.INCOMPLETE,
|
|
43
|
+
AGENT_TASK_STATE.COMPLETED,
|
|
44
|
+
AGENT_TASK_STATE.CLOSED,
|
|
45
|
+
]);
|
|
46
|
+
export const AgentTaskItemSchema = z.object({
|
|
47
|
+
id: z.string(),
|
|
48
|
+
parentTaskId: z.string().optional(),
|
|
49
|
+
state: AgentTaskStateSchema,
|
|
50
|
+
originateSource: AgentTaskSourceSchema,
|
|
51
|
+
dispatchSource: AgentTaskSourceSchema.optional(),
|
|
52
|
+
ownerSource: AgentTaskSourceSchema.optional(),
|
|
53
|
+
task: z.string(),
|
|
54
|
+
taskResult: z.string().optional(),
|
|
55
|
+
subTaskIds: z.array(z.string()).optional(),
|
|
56
|
+
createdTimestamp: z.number(),
|
|
57
|
+
updatedTimestamp: z.number(),
|
|
58
|
+
});
|
|
59
|
+
export const AgentTaskDatabaseSchema = z.object({
|
|
60
|
+
version: z.number(),
|
|
61
|
+
tasks: z.array(AgentTaskItemSchema),
|
|
62
|
+
});
|
|
63
|
+
/** Input for creating a new task. Optionally assign an owner at creation time. */
|
|
64
|
+
export const CreateTaskInputSchema = z.object({
|
|
65
|
+
task: z.string().min(1, "Task description is required"),
|
|
66
|
+
ownerSource: AgentTaskSourceSchema.optional(),
|
|
67
|
+
parentTaskId: z.string().optional(),
|
|
68
|
+
});
|
|
69
|
+
/** Input for updating task content (only allowed when state is OPEN). */
|
|
70
|
+
export const UpdateTaskInputSchema = z.object({
|
|
71
|
+
task: z.string().min(1, "Task description is required"),
|
|
72
|
+
});
|
|
73
|
+
/**
|
|
74
|
+
* Input for transitioning a task to a new state via REST.
|
|
75
|
+
* Only includes states reachable by user action. OPEN is the initial
|
|
76
|
+
* state (not a valid target), and ACTIVE is system-driven by the runtime manager.
|
|
77
|
+
*/
|
|
78
|
+
export const UpdateTaskStateInputSchema = z.object({
|
|
79
|
+
state: z.enum([AGENT_TASK_STATE.INCOMPLETE, AGENT_TASK_STATE.COMPLETED, AGENT_TASK_STATE.CLOSED]),
|
|
80
|
+
});
|
|
81
|
+
/** Input for assigning a task. Accepts the owner source (who will handle the task). */
|
|
82
|
+
export const AssignTaskInputSchema = z.object({
|
|
83
|
+
ownerSource: AgentTaskSourceSchema,
|
|
84
|
+
});
|
|
85
|
+
//# sourceMappingURL=agent-task.schema.js.map
|