@thecorporation/agent 0.1.0 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,22 +1,24 @@
1
1
  # @thecorporation/agent
2
2
 
3
- Corporate governance agent powered by [Pi](https://github.com/nicholasgasior/pi-coding-agent). Adds 35 tools for entity formation, equity management, payroll, compliance, and more.
3
+ Corporate governance agent extension for the [Pi coding agent](https://github.com/nicholasgasior/pi-coding-agent). Adds 36 tools for entity formation, equity management, payroll, compliance, and more.
4
+
5
+ Part of [The Corporation](https://thecorporation.ai) — agent-native corporate infrastructure.
4
6
 
5
7
  ## Install
6
8
 
7
9
  ```bash
8
- npm i -g @mariozechner/pi-coding-agent @thecorporation/agent
10
+ npm install -g @mariozechner/pi-coding-agent @thecorporation/agent
9
11
  ```
10
12
 
11
13
  ## Usage
12
14
 
13
15
  ```bash
14
- corp # interactive mode — launches Pi with corporate tools
15
- corp -p "list entities" # one-shot mode
16
- corp -p "form an LLC" # guided entity formation
16
+ corp-agent # interactive mode — launches Pi with corporate tools
17
+ corp-agent -p "list entities" # one-shot mode
18
+ corp-agent -p "form an LLC" # guided entity formation
17
19
  ```
18
20
 
19
- The `corp` command:
21
+ The `corp-agent` command:
20
22
 
21
23
  1. Copies the corporate tools extension into your project's `.pi/extensions/`
22
24
  2. Seeds `.pi/AGENT.md` with corporate context (only if not already present)
@@ -36,11 +38,68 @@ Create `~/.corp/config.json`:
36
38
 
37
39
  Or use environment variables: `CORP_API_URL`, `CORP_CONFIG_DIR`.
38
40
 
39
- ## What's Included
41
+ ## Tools
42
+
43
+ ### Read Tools (auto-approved)
44
+
45
+ | Tool | Description |
46
+ |---|---|
47
+ | `get_workspace_status` | Workspace summary with entity/document/grant counts |
48
+ | `list_entities` | List all companies in the workspace |
49
+ | `get_cap_table` | Full cap table for an entity |
50
+ | `list_documents` | List documents for an entity |
51
+ | `list_safe_notes` | List SAFE notes for an entity |
52
+ | `list_agents` | List autonomous agents |
53
+ | `get_checklist` | Read the workspace checklist |
54
+ | `get_document_link` | Get a document download/preview link |
55
+ | `get_signing_link` | Generate a signing URL |
56
+ | `list_obligations` | List compliance obligations with urgency tiers |
57
+ | `get_billing_status` | Show billing tier and usage |
58
+
59
+ ### Write Tools (require confirmation)
60
+
61
+ | Tool | Description |
62
+ |---|---|
63
+ | `form_entity` | Form a new LLC or corporation |
64
+ | `convert_entity` | Convert entity type (e.g. LLC to C-Corp) |
65
+ | `dissolve_entity` | Initiate entity dissolution |
66
+ | `issue_equity` | Issue shares or membership units |
67
+ | `issue_safe` | Issue a SAFE note |
68
+ | `transfer_shares` | Transfer shares between parties |
69
+ | `calculate_distribution` | Calculate and record a distribution |
70
+ | `create_invoice` | Create an invoice |
71
+ | `run_payroll` | Run payroll for a pay period |
72
+ | `submit_payment` | Submit a payment (ACH, wire, check) |
73
+ | `open_bank_account` | Open a business bank account |
74
+ | `reconcile_ledger` | Reconcile the entity ledger |
75
+ | `generate_contract` | Generate a contract from template |
76
+ | `file_tax_document` | File a tax document (1099, K-1, etc.) |
77
+ | `track_deadline` | Track a compliance deadline |
78
+ | `classify_contractor` | Analyze contractor classification risk |
79
+ | `convene_meeting` | Convene a governance meeting |
80
+ | `schedule_meeting` | Schedule a meeting |
81
+ | `cast_vote` | Cast a vote on a meeting agenda item |
82
+ | `update_checklist` | Update the workspace checklist |
83
+ | `create_agent` | Create an autonomous AI agent |
84
+ | `send_agent_message` | Send a message to an agent |
85
+ | `update_agent` | Update agent configuration |
86
+ | `add_agent_skill` | Add a skill to an agent |
87
+
88
+ ## Slash Commands
89
+
90
+ | Command | Description |
91
+ |---|---|
92
+ | `/status` | Workspace overview |
93
+ | `/entities` | Browse entities interactively |
94
+ | `/cap-table [entity_id]` | View cap table |
95
+ | `/obligations` | Compliance obligations by urgency |
96
+ | `/documents [entity_id]` | List documents with signing status |
97
+ | `/billing` | Billing tier and usage |
98
+
99
+ ## Links
40
100
 
41
- - **30 corporate tools** — entities, equity, documents, finance, compliance, agents
42
- - **5 slash commands** — `/corp-status`, `/corp-login`, `/corp-switch`, `/corp-entities`, `/corp-agents`
43
- - **Write-tool confirmation gating** — destructive operations require user approval
101
+ - [thecorporation.ai](https://thecorporation.ai)
102
+ - [GitHub](https://github.com/thecorporationai/thecorporation-mono/tree/main/packages/agent)
44
103
 
45
104
  ## License
46
105
 
package/extension/corp.ts CHANGED
@@ -75,7 +75,6 @@ const READ_ONLY_TOOLS = new Set([
75
75
  "list_safe_notes",
76
76
  "list_agents",
77
77
  "get_checklist",
78
- "get_document_link",
79
78
  "get_signing_link",
80
79
  "list_obligations",
81
80
  "get_billing_status",
@@ -404,7 +403,7 @@ const listObligations = {
404
403
  tier: Type.Optional(Type.String({ description: "Filter: overdue, due_today, d1, d7, d14, d30, upcoming" })),
405
404
  }),
406
405
  async execute(toolCallId: string, params: any, signal: any) {
407
- const q = params.tier ? `?tier=${params.tier}` : "";
406
+ const q = params.tier ? `?tier=${encodeURIComponent(params.tier)}` : "";
408
407
  const data = await apiCall("GET", `/v1/obligations/summary${q}`);
409
408
  return { content: [{ type: "text" as const, text: JSON.stringify(data) }], details: data };
410
409
  },
@@ -1233,27 +1232,38 @@ export default function (pi: ExtensionAPI) {
1233
1232
  // (services/agents, local dev) they remain available.
1234
1233
  const BLOCKED_BUILTIN_TOOLS = new Set(["bash", "write", "edit"]);
1235
1234
  const isHostedWeb = process.env.CORP_TERMINAL === "web";
1235
+ const corpToolNames = new Set(allTools.map((t) => t.name));
1236
+ const headlessWritePolicy = (process.env.CORP_HEADLESS_WRITE_POLICY || "deny").toLowerCase();
1236
1237
 
1237
1238
  // ── Write Tool Confirmation ─────────────────────────────────
1238
1239
  pi.on("tool_call", async (event: any, ctx: any) => {
1239
- // Headless mode: auto-approve all tool calls
1240
- if (process.env.CORP_AUTO_APPROVE === "1") return;
1241
-
1242
1240
  const name = event.toolName ?? event.toolCall?.name;
1243
1241
  if (!name) return;
1244
1242
 
1245
- // Block Pi built-in file write and bash tools in hosted web terminal
1246
- if (isHostedWeb && BLOCKED_BUILTIN_TOOLS.has(name)) {
1243
+ const isHeadless = process.env.CORP_AUTO_APPROVE === "1" || !ctx?.hasUI;
1244
+
1245
+ // Always block risky built-in mutation tools in hosted and headless contexts.
1246
+ if ((isHostedWeb || isHeadless) && BLOCKED_BUILTIN_TOOLS.has(name)) {
1247
1247
  return {
1248
1248
  block: true,
1249
1249
  reason: `The ${name} tool is not available. Use corporate operations tools instead.`,
1250
1250
  };
1251
1251
  }
1252
1252
 
1253
+ // Headless mode: fail closed for write actions unless explicitly allowed.
1254
+ if (isHeadless) {
1255
+ if (!corpToolNames.has(name)) return;
1256
+ if (READ_ONLY_TOOLS.has(name)) return;
1257
+ if (headlessWritePolicy === "allow") return;
1258
+ return {
1259
+ block: true,
1260
+ reason: "Approval required: mutating actions are blocked in unattended mode.",
1261
+ };
1262
+ }
1263
+
1253
1264
  if (READ_ONLY_TOOLS.has(name)) return; // auto-approve reads
1254
1265
 
1255
1266
  // Only intercept our corp tools
1256
- const corpToolNames = new Set(allTools.map((t) => t.name));
1257
1267
  if (!corpToolNames.has(name)) return;
1258
1268
 
1259
1269
  const args = event.input ?? event.toolCall?.args ?? {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thecorporation/agent",
3
- "version": "0.1.0",
3
+ "version": "1.0.5",
4
4
  "description": "TheCorporation agent — 35 corporate governance tools for the Pi coding agent",
5
5
  "type": "module",
6
6
  "bin": {