agentcorp-broker 0.1.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/CONTRIBUTING.md +20 -0
- package/LICENSE +201 -0
- package/README.md +250 -0
- package/SECURITY.md +23 -0
- package/dist/audit.d.ts +25 -0
- package/dist/audit.js +203 -0
- package/dist/audit.js.map +1 -0
- package/dist/broker.d.ts +103 -0
- package/dist/broker.js +805 -0
- package/dist/broker.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +712 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +3 -0
- package/dist/config.js +41 -0
- package/dist/config.js.map +1 -0
- package/dist/console/console.css +794 -0
- package/dist/console/console.js +802 -0
- package/dist/console/index.html +309 -0
- package/dist/credentials.d.ts +16 -0
- package/dist/credentials.js +72 -0
- package/dist/credentials.js.map +1 -0
- package/dist/database.d.ts +119 -0
- package/dist/database.js +1356 -0
- package/dist/database.js.map +1 -0
- package/dist/diagnostics.d.ts +44 -0
- package/dist/diagnostics.js +357 -0
- package/dist/diagnostics.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +14 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp.d.ts +3 -0
- package/dist/mcp.js +215 -0
- package/dist/mcp.js.map +1 -0
- package/dist/migrations.d.ts +13 -0
- package/dist/migrations.js +266 -0
- package/dist/migrations.js.map +1 -0
- package/dist/policy.d.ts +22 -0
- package/dist/policy.js +33 -0
- package/dist/policy.js.map +1 -0
- package/dist/server.d.ts +49 -0
- package/dist/server.js +529 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio-adapter.d.ts +230 -0
- package/dist/stdio-adapter.js +406 -0
- package/dist/stdio-adapter.js.map +1 -0
- package/dist/tui.d.ts +26 -0
- package/dist/tui.js +291 -0
- package/dist/tui.js.map +1 -0
- package/dist/types.d.ts +355 -0
- package/dist/types.js +85 -0
- package/dist/types.js.map +1 -0
- package/docs/ARCHITECTURE.md +119 -0
- package/docs/README.md +37 -0
- package/docs/RELEASING.md +228 -0
- package/docs/ROADMAP.md +112 -0
- package/docs/cli-reference.md +133 -0
- package/docs/dogfooding-report.md +83 -0
- package/docs/getting-started.md +228 -0
- package/docs/guides/antigravity-setup.md +84 -0
- package/docs/guides/claude-cursor-setup.md +76 -0
- package/docs/guides/codex-setup.md +75 -0
- package/docs/guides/human-console.md +177 -0
- package/docs/mcp-tools-reference.md +235 -0
- package/docs/policy-guide.md +105 -0
- package/examples/org.toml +65 -0
- package/package.json +68 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to AgentCorp will be documented in this file.
|
|
4
|
+
This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) after the first public release.
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.1.0-alpha.1] — 2026-09-06
|
|
11
|
+
|
|
12
|
+
Initial public developer preview release of AgentCorp: a local-first coordination broker for teams of AI agents.
|
|
13
|
+
|
|
14
|
+
### Core Architecture & Coordination Broker
|
|
15
|
+
- **Local-First MCP Broker**: Implemented single-writer, multi-reader architecture coordinating AI agents across distinct roles without coupling agents to a single vendor, framework, or model.
|
|
16
|
+
- **Role Isolation & Access Control**: Strict caller role authentication enforcing allowed peer communications and role-scoped artifact visibility rules defined in `org.toml`.
|
|
17
|
+
- **Approval-Bound Task Activation**: Gated task handoffs where tasks remain in `proposed` state and are hidden from intended assignees until linked proposals are human-approved.
|
|
18
|
+
- **Prioritized Work Queue (`get_work_queue`)**: Unified endpoint returning unread messages, active tasks, live role presence, and ranked actionable suggestions in one call.
|
|
19
|
+
- **Idempotent Handoff Acceptance (`accept_handoff`)**: Atomically acknowledges approved proposals and initiates task transitions without duplicate executions.
|
|
20
|
+
|
|
21
|
+
### Reliability, Self-Healing & Concurrency
|
|
22
|
+
- **Resilient Stdio MCP Proxy**: Automatic daemon discovery, bounded exponential backoff (100ms–2000ms), and transparent auto-spawn recovery when the broker daemon restarts or crashes.
|
|
23
|
+
- **Cross-Process Startup Lock**: Atomic file-locking mechanism (`.agentcorp/daemon.json.lock`) with active PID probes and stale lock recovery (>10s) ensuring exactly one daemon spawns per project.
|
|
24
|
+
- **Working Directory Isolation**: Automatic path resolution allowing MCP host processes to run from arbitrary working directories while automatically deriving project-scoped database, credentials, logs, and daemon control files from `org.toml`.
|
|
25
|
+
- **Mutation Idempotency (`idempotency_key`)**: Role-scoped composite primary key `(role_id, key)` with SHA-256 operation and payload hash validation, rejecting cross-role key collisions and stale mismatches.
|
|
26
|
+
- **Re-Entrant Atomic Transactions**: SQLite transaction management with depth tracking guaranteeing atomic commits and clean rollbacks for business mutations and idempotency records.
|
|
27
|
+
- **Concurrent Database Startup**: Installs SQLite's busy handler before WAL negotiation and migrations so simultaneous worker connections wait for initialization locks instead of failing intermittently.
|
|
28
|
+
- **Collision-Free Daemon Default**: Background startup now selects an available loopback port by default and records actionable startup failures in the bounded daemon log.
|
|
29
|
+
|
|
30
|
+
### Persistence, Migrations & Bounded Storage
|
|
31
|
+
- **Transactional SQLite Persistence**: Built on Node.js 22 built-in `node:sqlite` with WAL journal mode, busy timeouts, and versioned schema migrations (Versions 1 through 7).
|
|
32
|
+
- **Hard Resource Bounds**: Enforced 2 MB HTTP body limits, 1 MB message payload limits, 5 MB artifact limits, and configurable audit payload extraction budgets (`max_audit_payload_bytes`).
|
|
33
|
+
- **Opaque Cursor Pagination**: Cursor-based pagination across inboxes, tasks, threads, approvals, and artifacts.
|
|
34
|
+
- **History Pruning & Compaction**: `agentcorp prune` command with foreign-key reply chain detachment, dry-run simulation, and SQLite WAL compaction (`agentcorp compact`).
|
|
35
|
+
|
|
36
|
+
### Human Oversight & Operational Observability
|
|
37
|
+
- **Human Review CLI (`agentcorp review`)**: Interactive terminal-native review loop with approve, edit-and-approve, reject, skip, and quit actions.
|
|
38
|
+
- **Dark Glassmorphic Web Dashboard (`agentcorp console`)**: Live real-time dashboard powered by Server-Sent Events (`/api/events`) with side-by-side JSON diff editor and live status telemetry.
|
|
39
|
+
- **Role Presence & Activity Freshness**: Telemetry tracking role liveness, last seen timestamps, and activity freshness (`fresh`, `idle`, `stale`).
|
|
40
|
+
- **Diagnostic Health Check (`agentcorp doctor`)**: Comprehensive operational diagnostics inspecting configuration, database schema, credentials, daemon health, and crash logs.
|
|
41
|
+
- **Structured Log Rotation & Sanitization**: Bounded rotating daemon logs (`.agentcorp/daemon.log`, 5 MB max with 3 backups) with payload redaction protecting conversation confidentiality, alongside fatal crash diagnostics (`.agentcorp/crash.log`).
|
|
42
|
+
|
|
43
|
+
### Release Engineering & Documentation
|
|
44
|
+
- **Strict Test Typechecking**: The default TypeScript check now covers both production source and tests, with a separate production-only build configuration.
|
|
45
|
+
- **Package Boundary Regression Test**: The clean-install smoke suite asserts that source, tests, runtime state, internal design notes, and binary documentation assets cannot enter the npm tarball.
|
|
46
|
+
- **Beginner and Maintainer Guides**: Added end-to-end first-workflow, troubleshooting, GitHub setup, npm preview publication, verification, and recovery instructions.
|
|
47
|
+
- **Dogfooding Findings**: Documented the observed Codex-Gemini collaboration strengths, host-lifecycle friction, and a bounded adapter architecture for future autonomous invocation.
|
|
48
|
+
|
|
49
|
+
### Audit Integrity & Truncation Semantics
|
|
50
|
+
- **Explicit Audit Semantics**: Formatted Markdown and JSON audit exports (`coord/audit.md`, `coord/audit.json`) distinguishing row-limit truncation (`rowLimitTruncated`) from field-level clipping (`fieldClippingActive`).
|
|
51
|
+
- **SQLite-Layer Payload Bounding**: UTF-8 BLOB-cast byte-aware truncation using `OCTET_LENGTH` and `SUBSTR` preventing native and V8 heap inflation on oversized audit records.
|
|
52
|
+
- **Memory-Isolated Approvals**: Omission of discarded `edited_payload` from SQL query projections.
|
package/CONTRIBUTING.md
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# Contributing to AgentCorp
|
|
2
|
+
|
|
3
|
+
Thank you for helping build vendor-neutral agent coordination infrastructure.
|
|
4
|
+
|
|
5
|
+
## Local setup
|
|
6
|
+
|
|
7
|
+
1. Install Node.js 22.13 or newer.
|
|
8
|
+
2. Run `npm ci` for a lockfile-reproducible dependency install.
|
|
9
|
+
3. Run `npm run check`, `npm run build`, and `npm test` before opening a pull request.
|
|
10
|
+
|
|
11
|
+
Keep changes focused and add tests for new behavior. Protocol or persistence
|
|
12
|
+
changes should update the design spec or an architecture note. Security
|
|
13
|
+
invariants must fail closed: an error must never deliver a message, approve a
|
|
14
|
+
transition, or broaden artifact visibility.
|
|
15
|
+
|
|
16
|
+
Use Conventional Commit-style subjects when practical, such as `feat:`,
|
|
17
|
+
`fix:`, `docs:`, and `test:`.
|
|
18
|
+
|
|
19
|
+
By contributing, you agree that your contribution is licensed under the
|
|
20
|
+
Apache License 2.0.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 AgentCorp contributors
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,250 @@
|
|
|
1
|
+
# AgentCorp
|
|
2
|
+
|
|
3
|
+
AgentCorp is a local-first coordination broker for teams of AI agents. It gives
|
|
4
|
+
MCP-capable agents stable roles, typed messages, durable tasks, approval gates,
|
|
5
|
+
and access-controlled artifacts without coupling the agents to one vendor or
|
|
6
|
+
model.
|
|
7
|
+
|
|
8
|
+
> Status: **developer preview (0.1.0-alpha.1)**.
|
|
9
|
+
> Central long-lived broker daemon, terminal-native human console & review loop,
|
|
10
|
+
> real-time SSE event pipeline with 15s keep-alive heartbeat, dark glassmorphic web dashboard, and audit exports.
|
|
11
|
+
|
|
12
|
+

|
|
13
|
+
|
|
14
|
+
## What works today
|
|
15
|
+
|
|
16
|
+
- Long-lived broker daemon over MCP Streamable HTTP, Admin REST API, and Server-Sent Events (`/api/events`)
|
|
17
|
+
- Terminal-native human console (`agentcorp console`) and interactive review loop (`agentcorp review`)
|
|
18
|
+
- Sleek dark glassmorphic web dashboard with live push updates and side-by-side JSON diff editor
|
|
19
|
+
- Thin role-bound stdio adapters proxying to the central daemon
|
|
20
|
+
- Role definitions and allowed communication paths loaded from `org.toml`
|
|
21
|
+
- Per-role and admin credentials stored securely in `.agentcorp/credentials.json`
|
|
22
|
+
- Role-bound MCP connections with connection-enforced caller identity
|
|
23
|
+
- Typed messages with durable status history
|
|
24
|
+
- Approval-bound task handoffs: intended assignees cannot see or start proposed work before approval
|
|
25
|
+
- Prioritized per-role work queues with executable next-action suggestions
|
|
26
|
+
- Idempotent handoff acceptance that acknowledges and starts approved work in one call
|
|
27
|
+
- Safe-by-default approval policy evaluation
|
|
28
|
+
- Human approve, edit-and-approve, and reject commands with full audit logging
|
|
29
|
+
- Validated task lifecycle transitions
|
|
30
|
+
- SHA-256-addressed artifact metadata with role-scoped read checks
|
|
31
|
+
- Transactional SQLite persistence with versioned schema migrations
|
|
32
|
+
- Automated human-readable Markdown and JSON audit trail exports (`coord/`)
|
|
33
|
+
- Public TypeScript API plus the `agentcorp` CLI
|
|
34
|
+
|
|
35
|
+
## Requirements
|
|
36
|
+
|
|
37
|
+
- Node.js 22.13 or newer
|
|
38
|
+
|
|
39
|
+
AgentCorp uses Node's built-in `node:sqlite` module to avoid native npm
|
|
40
|
+
dependencies. On Node 22 it may print an experimental-feature warning; it does
|
|
41
|
+
not require an experimental flag from 22.13 onward.
|
|
42
|
+
|
|
43
|
+
## Quick start
|
|
44
|
+
|
|
45
|
+
New to Node.js, terminals, or MCP? Follow the complete
|
|
46
|
+
[beginner setup guide](./docs/getting-started.md). The short path is below.
|
|
47
|
+
|
|
48
|
+
Until the first npm release, run the CLI from this repository:
|
|
49
|
+
|
|
50
|
+
```sh
|
|
51
|
+
npm install
|
|
52
|
+
npm run build
|
|
53
|
+
node dist/cli.js init
|
|
54
|
+
node dist/cli.js validate
|
|
55
|
+
node dist/cli.js start
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
After publication:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm install --global agentcorp-broker
|
|
62
|
+
agentcorp init
|
|
63
|
+
agentcorp validate
|
|
64
|
+
agentcorp start
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
`agentcorp init` creates an architect/developer organization with conservative
|
|
68
|
+
approval defaults and generates local credentials under `.agentcorp/credentials.json`.
|
|
69
|
+
Runtime state under `.agentcorp/` should not be committed.
|
|
70
|
+
|
|
71
|
+
## Connect agents over MCP
|
|
72
|
+
|
|
73
|
+
Each local MCP connection is bound to exactly one configured role. When your
|
|
74
|
+
MCP host does not preserve the project working directory, pass an absolute path
|
|
75
|
+
to `--config`. AgentCorp automatically derives project-scoped `--db`, `--credentials`,
|
|
76
|
+
and daemon control paths relative to the config file (or you can provide explicit overrides):
|
|
77
|
+
|
|
78
|
+
```json
|
|
79
|
+
{
|
|
80
|
+
"mcpServers": {
|
|
81
|
+
"agentcorp-architect": {
|
|
82
|
+
"command": "agentcorp",
|
|
83
|
+
"args": [
|
|
84
|
+
"--config", "/absolute/project/org.toml",
|
|
85
|
+
"mcp", "--role", "architect"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Configure the second agent with the same config path, changing only the final
|
|
93
|
+
role to `developer`. You may also explicitly provide `--db /absolute/project/.agentcorp/agentcorp.db`
|
|
94
|
+
if using a custom database location.
|
|
95
|
+
|
|
96
|
+
The MCP tool surface includes 15 tools:
|
|
97
|
+
|
|
98
|
+
- `register_role`, `whoami`
|
|
99
|
+
- `create_task`, `list_tasks`, `get_work_queue`, `update_task_status`
|
|
100
|
+
- `send_message`, `get_inbox`, `acknowledge_message`, `accept_handoff`, `get_thread`
|
|
101
|
+
- `create_artifact`, `list_artifacts`, `get_artifact`
|
|
102
|
+
- `get_operation`
|
|
103
|
+
|
|
104
|
+
## Efficient agent loop
|
|
105
|
+
|
|
106
|
+
Use `get_work_queue` as the first AgentCorp call in every agent session and
|
|
107
|
+
again after each handoff or status change. It combines unread messages, active
|
|
108
|
+
tasks, live role presence, and prioritized next actions so an agent does not need
|
|
109
|
+
to independently reconcile `get_inbox`, `list_tasks`, and task threads.
|
|
110
|
+
|
|
111
|
+
For a gated task handoff:
|
|
112
|
+
|
|
113
|
+
1. The planner creates the task with an intended `assigned_to` and sends a
|
|
114
|
+
linked `proposal`.
|
|
115
|
+
2. Until that proposal is approved, the task remains `proposed` and is hidden
|
|
116
|
+
from the intended assignee.
|
|
117
|
+
3. Approval atomically activates the task as `assigned` and exposes the
|
|
118
|
+
proposal in the assignee's work queue.
|
|
119
|
+
4. The assignee calls `accept_handoff` once. AgentCorp acknowledges the proposal
|
|
120
|
+
and requests the `in_progress` transition without creating duplicates on
|
|
121
|
+
retries.
|
|
122
|
+
|
|
123
|
+
> [!IMPORTANT]
|
|
124
|
+
> **LLM Wake Limitations & Handoff Best Practices**:
|
|
125
|
+
> - **Passive MCP Protocol**: MCP servers expose tools over standard JSON-RPC; they **cannot independently wake an idle LLM** inside an external host (Antigravity, Codex, Cursor, Claude Desktop). Standing agent instructions must invoke `get_work_queue` at session start.
|
|
126
|
+
> - **Lightweight ID / Summary Handoffs**: When agents coordinate or hand off work, always pass concise IDs and brief summaries (e.g., `taskId`, `messageId`, summary of diffs/artifacts) rather than dumping whole codebase contexts or large files into prompt memory. Artifacts should be retrieved on demand with `get_artifact`.
|
|
127
|
+
|
|
128
|
+
## Human approval console
|
|
129
|
+
|
|
130
|
+
AgentCorp offers first-class human-in-the-loop oversight designed for terminal-first developer workflows with an optional live web dashboard.
|
|
131
|
+
|
|
132
|
+
### 1. Terminal-Native Interaction (Preferred)
|
|
133
|
+
|
|
134
|
+
Launch the status summary or dive straight into interactive sign-off:
|
|
135
|
+
|
|
136
|
+
```sh
|
|
137
|
+
# View daemon status, task counts, and pending approvals
|
|
138
|
+
agentcorp console
|
|
139
|
+
|
|
140
|
+
# Interactive sign-off loop ([a]pprove, [e]dit & approve, [r]eject, [s]kip, [q]uit)
|
|
141
|
+
agentcorp review
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### 2. Live Web Dashboard
|
|
145
|
+
|
|
146
|
+
Open the modern dark glassmorphic dashboard with live push updates over Server-Sent Events (`/api/events`):
|
|
147
|
+
|
|
148
|
+
```sh
|
|
149
|
+
agentcorp console --browser
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Features include:
|
|
153
|
+
- Real-time approval feed with side-by-side JSON diff editor
|
|
154
|
+
- Role presence indicators (online, idle, offline) and connection health
|
|
155
|
+
- Role inboxes & active task threads
|
|
156
|
+
- Artifact catalog viewer
|
|
157
|
+
- Runtime policy inspector and instant toggle switch (enable / disable)
|
|
158
|
+
|
|
159
|
+
### 3. Direct Scriptable CLI Commands
|
|
160
|
+
|
|
161
|
+
Messages and transitions that do not match an `auto_approve` rule are held by default.
|
|
162
|
+
|
|
163
|
+
```sh
|
|
164
|
+
agentcorp approvals list
|
|
165
|
+
agentcorp approvals approve <approval-id> --note "Reviewed"
|
|
166
|
+
agentcorp approvals approve <approval-id> --payload '{"revised":"payload"}'
|
|
167
|
+
agentcorp approvals reject <approval-id> --note "Needs a safer plan"
|
|
168
|
+
agentcorp policies list
|
|
169
|
+
agentcorp policies set '{"id":"safe-reports","subject":"message","priority":80,"message_type":"report","risk_tags":["read_only"],"action":"auto_approve"}'
|
|
170
|
+
agentcorp policies disable safe-reports
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
The recipient cannot see a pending message. Approval changes its state to
|
|
174
|
+
`delivered`; rejection keeps it out of the inbox.
|
|
175
|
+
|
|
176
|
+
## Storage lifecycle and bounding
|
|
177
|
+
|
|
178
|
+
AgentCorp enforces bounded memory and disk usage to protect long-running daemons from denial of service and memory exhaustion:
|
|
179
|
+
|
|
180
|
+
- **Size limits**:
|
|
181
|
+
- HTTP body: 2 MB maximum (returns HTTP 413 `PAYLOAD_TOO_LARGE`).
|
|
182
|
+
- Message payload: 1 MB maximum (`PAYLOAD_TOO_LARGE`).
|
|
183
|
+
- Artifact content: 5 MB maximum (`ARTIFACT_TOO_LARGE`).
|
|
184
|
+
- Audit payload budget: Operator-configurable (`max_audit_payload_bytes`, defaults to 64 KB).
|
|
185
|
+
- **Cursor pagination**:
|
|
186
|
+
- Task, message, inbox, and artifact queries are bounded to 50 items by default (max 200).
|
|
187
|
+
- MCP tools and Admin REST endpoints support `limit` and opaque `cursor` pagination with optional `envelope` payloads and `X-Next-Cursor` headers.
|
|
188
|
+
- **History pruning and WAL compaction**:
|
|
189
|
+
```sh
|
|
190
|
+
# Dry-run simulate pruning resolved tasks and messages older than 30 days
|
|
191
|
+
agentcorp prune --older-than 30
|
|
192
|
+
|
|
193
|
+
# Execute pruning and compact SQLite database
|
|
194
|
+
agentcorp prune --older-than 30 --execute --compact
|
|
195
|
+
|
|
196
|
+
# Manually checkpoint WAL and vacuum freed pages
|
|
197
|
+
agentcorp compact
|
|
198
|
+
```
|
|
199
|
+
- **Bounded audit export**:
|
|
200
|
+
```sh
|
|
201
|
+
# Export the 100 most recent records or only records since a timestamp
|
|
202
|
+
agentcorp audit export --limit 100 --since 2026-09-01T00:00:00Z
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
## Self-healing, observability, and idempotency
|
|
206
|
+
|
|
207
|
+
AgentCorp includes enterprise-grade operational safeguards to guarantee durable multi-agent sessions:
|
|
208
|
+
|
|
209
|
+
- **Resilient Stdio MCP Proxy**: When running inside an IDE via stdio (`agentcorp mcp --role developer`), the proxy wraps connections with auto-reconnection and bounded exponential backoff. If the central daemon process crashes or restarts, running agent sessions transparently recover without transport exceptions.
|
|
210
|
+
- **Mutation Idempotency & Operation Lookup**: Mutations (`create_task`, `send_message`, `create_artifact`, `accept_handoff`, `update_task_status`) accept an optional `idempotency_key`. Replays return the exact recorded response without duplicate side effects. Agents can query cached outcomes at any time using `get_operation`.
|
|
211
|
+
- **Role Presence & Last-Seen Telemetry**: Every authenticated agent interaction touches role presence. `get_work_queue`, `/health`, `/api/status`, and the Web Console report real-time statuses (`online` <1m, `idle` 1–5m, `offline` >5m).
|
|
212
|
+
- **Bounded Rotating Daemon Logs & Crash Diagnostics**: Daemon events are written to `.agentcorp/daemon.log` with size-bounded rotation (5 MB with 3 backups). Uncaught exceptions record complete diagnostic forensics into `.agentcorp/crash.log`.
|
|
213
|
+
- **System Doctor**: Run `agentcorp doctor` at any time to verify configuration validity, database integrity (`PRAGMA integrity_check`), credential coverage, daemon status, and log health.
|
|
214
|
+
|
|
215
|
+
## Policy semantics
|
|
216
|
+
|
|
217
|
+
Policies are initially seeded from `org.toml` into SQLite. After the first run,
|
|
218
|
+
the database is the source of truth. Rules are evaluated by descending
|
|
219
|
+
`priority`; every populated condition on a rule must match. Risk tags use
|
|
220
|
+
subset matching: all tags named by the rule must be present on the request.
|
|
221
|
+
|
|
222
|
+
If no rule matches, AgentCorp requires human approval. The reserved
|
|
223
|
+
`delegate_to_role` action is rejected in v0 rather than silently weakened.
|
|
224
|
+
|
|
225
|
+
## Development
|
|
226
|
+
|
|
227
|
+
```sh
|
|
228
|
+
npm run check
|
|
229
|
+
npm test
|
|
230
|
+
npm run build
|
|
231
|
+
npm pack --dry-run
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
The main design document is [docs/design-spec.md](./docs/design-spec.md).
|
|
235
|
+
The delivery sequence and design gaps are tracked in
|
|
236
|
+
[docs/ROADMAP.md](./docs/ROADMAP.md).
|
|
237
|
+
Maintainers should follow the [release guide](./docs/RELEASING.md); do not
|
|
238
|
+
publish directly from an unverified working tree.
|
|
239
|
+
|
|
240
|
+
## Security model
|
|
241
|
+
|
|
242
|
+
AgentCorp 0.1.0-alpha.1 enforces caller identity, communication routing, policy gating, and artifact access control through its central authenticated daemon over MCP Streamable HTTP and role-bound stdio adapters using header-only bearer tokens.
|
|
243
|
+
|
|
244
|
+
As a local developer preview, AgentCorp does not sandbox an underlying agent's general shell or filesystem access. Keep `.agentcorp/credentials.json`, `.agentcorp/agentcorp.db`, and the administrative CLI unavailable to untrusted processes. Role capabilities are currently descriptive metadata, and host-agent capability sandboxing is scheduled for Milestone 4.
|
|
245
|
+
|
|
246
|
+
See [SECURITY.md](./SECURITY.md) for reporting and deployment guidance.
|
|
247
|
+
|
|
248
|
+
## License
|
|
249
|
+
|
|
250
|
+
Apache-2.0. See [LICENSE](./LICENSE).
|
package/SECURITY.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Security policy
|
|
2
|
+
|
|
3
|
+
AgentCorp is a developer preview (0.1.0-alpha.1) and has not yet received an independent
|
|
4
|
+
security audit. Do not use as a hostile multi-tenant security boundary.
|
|
5
|
+
|
|
6
|
+
## Supported versions
|
|
7
|
+
|
|
8
|
+
Only the latest published preview version receives security fixes before 1.0.
|
|
9
|
+
|
|
10
|
+
## Reporting a vulnerability
|
|
11
|
+
|
|
12
|
+
Please report vulnerabilities privately through GitHub Security Advisories at
|
|
13
|
+
[https://github.com/Shash-J/AgentCorp/security/advisories](https://github.com/Shash-J/AgentCorp/security/advisories).
|
|
14
|
+
Do not open a public issue containing exploit details. Include affected versions,
|
|
15
|
+
reproduction steps, impact, and any known mitigation.
|
|
16
|
+
|
|
17
|
+
## Deployment guidance
|
|
18
|
+
|
|
19
|
+
- Restrict filesystem access to `.agentcorp/agentcorp.db`.
|
|
20
|
+
- Do not expose the stdio process directly to a network.
|
|
21
|
+
- Keep administrative approval commands unavailable to agent processes.
|
|
22
|
+
- Review `auto_approve` rules narrowly and prefer explicit risk tags.
|
|
23
|
+
- Treat external artifact URIs as untrusted input.
|
package/dist/audit.d.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { AgentCorpBroker } from "./broker.js";
|
|
2
|
+
import { type AuditArtifactRecord, type AuditExportOptions, type AuditSnapshotMetadata, type AuditTaskRecord, type MessageRecord, type PendingApproval } from "./types.js";
|
|
3
|
+
export interface AuditSnapshot {
|
|
4
|
+
exportedAt: string;
|
|
5
|
+
company: string;
|
|
6
|
+
metadata: AuditSnapshotMetadata;
|
|
7
|
+
roles: Array<{
|
|
8
|
+
id: string;
|
|
9
|
+
model?: string | undefined;
|
|
10
|
+
capabilities: string[];
|
|
11
|
+
allowedPeers: string[];
|
|
12
|
+
boundAgent?: string | undefined;
|
|
13
|
+
}>;
|
|
14
|
+
tasks: AuditTaskRecord[];
|
|
15
|
+
messages: MessageRecord[];
|
|
16
|
+
approvals: PendingApproval[];
|
|
17
|
+
artifacts: AuditArtifactRecord[];
|
|
18
|
+
}
|
|
19
|
+
export declare function generateAuditSnapshot(broker: AgentCorpBroker, options?: AuditExportOptions): AuditSnapshot;
|
|
20
|
+
export declare function formatAuditMarkdown(snapshot: AuditSnapshot): string;
|
|
21
|
+
export declare function exportAuditTrail(broker: AgentCorpBroker, outputDir?: string, options?: AuditExportOptions): {
|
|
22
|
+
markdownPath: string;
|
|
23
|
+
jsonPath: string;
|
|
24
|
+
snapshot: AuditSnapshot;
|
|
25
|
+
};
|