@thecorporation/corp-tools 0.1.0 → 1.0.3
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 +156 -0
- package/dist/index.d.ts +66 -3
- package/dist/index.js +98 -39
- package/dist/index.js.map +1 -1
- package/package.json +4 -2
package/README.md
ADDED
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
# @thecorporation/corp-tools
|
|
2
|
+
|
|
3
|
+
Shared API client, tool definitions, and execution engine for The Corporation. Used by [`@thecorporation/cli`](https://www.npmjs.com/package/@thecorporation/cli), [`@thecorporation/mcp-server`](https://www.npmjs.com/package/@thecorporation/mcp-server), and the chat service.
|
|
4
|
+
|
|
5
|
+
Part of [The Corporation](https://thecorporation.ai) — agent-native corporate infrastructure.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @thecorporation/corp-tools
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
### API Client
|
|
16
|
+
|
|
17
|
+
```js
|
|
18
|
+
import { CorpAPIClient } from "@thecorporation/corp-tools";
|
|
19
|
+
|
|
20
|
+
const client = new CorpAPIClient(
|
|
21
|
+
"https://api.thecorporation.ai",
|
|
22
|
+
"sk_...",
|
|
23
|
+
"ws_..."
|
|
24
|
+
);
|
|
25
|
+
|
|
26
|
+
const status = await client.getStatus();
|
|
27
|
+
const entities = await client.listEntities();
|
|
28
|
+
const capTable = await client.getCapTable(entityId);
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
### Equity round close workflow (v1)
|
|
32
|
+
|
|
33
|
+
```js
|
|
34
|
+
// 1) Create round + terms
|
|
35
|
+
const round = await client.createEquityRound({
|
|
36
|
+
entity_id,
|
|
37
|
+
issuer_legal_entity_id,
|
|
38
|
+
name: "Series A",
|
|
39
|
+
round_price_cents: 100,
|
|
40
|
+
target_raise_cents: 100000000,
|
|
41
|
+
conversion_target_instrument_id,
|
|
42
|
+
metadata: {}
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
await client.applyEquityRoundTerms(round.round_id, {
|
|
46
|
+
entity_id,
|
|
47
|
+
anti_dilution_method: "none",
|
|
48
|
+
conversion_precedence: ["safe"],
|
|
49
|
+
protective_provisions: {}
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
// 2) Governance board approval
|
|
53
|
+
await client.boardApproveEquityRound(round.round_id, {
|
|
54
|
+
entity_id,
|
|
55
|
+
meeting_id,
|
|
56
|
+
resolution_id
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// 3) Accept with authorized intent
|
|
60
|
+
const acceptIntent = await client.createExecutionIntent({
|
|
61
|
+
entity_id,
|
|
62
|
+
intent_type: "equity.round.accept",
|
|
63
|
+
authority_tier: "tier_2",
|
|
64
|
+
description: "Accept approved round",
|
|
65
|
+
metadata: { round_id: round.round_id }
|
|
66
|
+
});
|
|
67
|
+
await client.evaluateIntent(acceptIntent.intent_id, entity_id);
|
|
68
|
+
await client.authorizeIntent(acceptIntent.intent_id, entity_id);
|
|
69
|
+
await client.acceptEquityRound(round.round_id, {
|
|
70
|
+
entity_id,
|
|
71
|
+
intent_id: acceptIntent.intent_id
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
// 4) Execute conversion with authorized execute intent
|
|
75
|
+
const executeIntent = await client.createExecutionIntent({
|
|
76
|
+
entity_id,
|
|
77
|
+
intent_type: "equity.round.execute_conversion",
|
|
78
|
+
authority_tier: "tier_2",
|
|
79
|
+
description: "Execute round conversion",
|
|
80
|
+
metadata: { round_id: round.round_id }
|
|
81
|
+
});
|
|
82
|
+
await client.evaluateIntent(executeIntent.intent_id, entity_id);
|
|
83
|
+
await client.authorizeIntent(executeIntent.intent_id, entity_id);
|
|
84
|
+
await client.executeRoundConversion({
|
|
85
|
+
entity_id,
|
|
86
|
+
round_id: round.round_id,
|
|
87
|
+
intent_id: executeIntent.intent_id
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Breaking change (v1, February 28, 2026):
|
|
92
|
+
- `POST /v1/equity/conversions/execute` requires `intent_id`.
|
|
93
|
+
- Round close order is `apply-terms -> board-approve -> accept -> execute`.
|
|
94
|
+
|
|
95
|
+
### Tool Execution
|
|
96
|
+
|
|
97
|
+
```js
|
|
98
|
+
import {
|
|
99
|
+
TOOL_DEFINITIONS,
|
|
100
|
+
TOOL_REGISTRY,
|
|
101
|
+
executeTool,
|
|
102
|
+
isWriteTool,
|
|
103
|
+
} from "@thecorporation/corp-tools";
|
|
104
|
+
|
|
105
|
+
// OpenAI-compatible function definitions for LLM tool calling
|
|
106
|
+
console.log(TOOL_DEFINITIONS);
|
|
107
|
+
|
|
108
|
+
// Execute a tool call
|
|
109
|
+
const result = await executeTool("form_entity", args, client, { dataDir: "." });
|
|
110
|
+
|
|
111
|
+
// Check if a tool mutates state (useful for confirmation gating)
|
|
112
|
+
isWriteTool("form_entity"); // true
|
|
113
|
+
isWriteTool("list_entities"); // false
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### System Prompt
|
|
117
|
+
|
|
118
|
+
```js
|
|
119
|
+
import { SYSTEM_PROMPT_BASE, formatConfigSection } from "@thecorporation/corp-tools";
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## Tools
|
|
123
|
+
|
|
124
|
+
36 tools across corporate governance domains:
|
|
125
|
+
|
|
126
|
+
| Category | Tools |
|
|
127
|
+
|---|---|
|
|
128
|
+
| **Entities** | `form_entity`, `convert_entity`, `dissolve_entity`, `list_entities` |
|
|
129
|
+
| **Equity** | `issue_equity`, `issue_safe`, `transfer_shares`, `calculate_distribution`, `get_cap_table`, `list_safe_notes` |
|
|
130
|
+
| **Finance** | `create_invoice`, `run_payroll`, `submit_payment`, `open_bank_account`, `reconcile_ledger`, `classify_contractor` |
|
|
131
|
+
| **Documents** | `generate_contract`, `list_documents`, `get_document_link`, `get_signing_link` |
|
|
132
|
+
| **Governance** | `convene_meeting`, `schedule_meeting`, `cast_vote` |
|
|
133
|
+
| **Tax** | `file_tax_document`, `track_deadline` |
|
|
134
|
+
| **Agents** | `create_agent`, `send_agent_message`, `update_agent`, `add_agent_skill`, `list_agents` |
|
|
135
|
+
| **Workspace** | `get_workspace_status`, `list_obligations`, `get_billing_status`, `get_checklist`, `update_checklist`, `get_signer_link` |
|
|
136
|
+
|
|
137
|
+
## Exports
|
|
138
|
+
|
|
139
|
+
- `CorpAPIClient` — typed API client with methods for every endpoint
|
|
140
|
+
- `TOOL_DEFINITIONS` / `GENERATED_TOOL_DEFINITIONS` — OpenAI-compatible function schemas
|
|
141
|
+
- `TOOL_REGISTRY` — name-to-definition lookup
|
|
142
|
+
- `READ_ONLY_TOOLS` — set of tool names that don't mutate state
|
|
143
|
+
- `executeTool()` — dispatches a tool call and returns the result
|
|
144
|
+
- `isWriteTool()` — checks whether a tool mutates state
|
|
145
|
+
- `describeToolCall()` — human-readable description of a tool call
|
|
146
|
+
- `SYSTEM_PROMPT_BASE` / `formatConfigSection()` — system prompt utilities
|
|
147
|
+
- `provisionWorkspace()` — provisions a new workspace
|
|
148
|
+
|
|
149
|
+
## Links
|
|
150
|
+
|
|
151
|
+
- [thecorporation.ai](https://thecorporation.ai)
|
|
152
|
+
- [GitHub](https://github.com/thecorporationai/thecorporation-mono/tree/main/packages/corp-tools)
|
|
153
|
+
|
|
154
|
+
## License
|
|
155
|
+
|
|
156
|
+
MIT
|
package/dist/index.d.ts
CHANGED
|
@@ -32,6 +32,58 @@ interface LLMResponse {
|
|
|
32
32
|
finish_reason: string | null;
|
|
33
33
|
}
|
|
34
34
|
type ApiRecord = Record<string, unknown>;
|
|
35
|
+
interface CreateEquityRoundRequest {
|
|
36
|
+
entity_id: string;
|
|
37
|
+
issuer_legal_entity_id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
pre_money_cents?: number;
|
|
40
|
+
round_price_cents?: number;
|
|
41
|
+
target_raise_cents?: number;
|
|
42
|
+
conversion_target_instrument_id?: string;
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
interface ApplyEquityRoundTermsRequest {
|
|
46
|
+
entity_id: string;
|
|
47
|
+
anti_dilution_method: string;
|
|
48
|
+
conversion_precedence?: string[];
|
|
49
|
+
protective_provisions?: Record<string, unknown>;
|
|
50
|
+
}
|
|
51
|
+
interface BoardApproveEquityRoundRequest {
|
|
52
|
+
entity_id: string;
|
|
53
|
+
meeting_id: string;
|
|
54
|
+
resolution_id: string;
|
|
55
|
+
}
|
|
56
|
+
interface AcceptEquityRoundRequest {
|
|
57
|
+
entity_id: string;
|
|
58
|
+
intent_id: string;
|
|
59
|
+
accepted_by_contact_id?: string;
|
|
60
|
+
}
|
|
61
|
+
interface PreviewRoundConversionRequest {
|
|
62
|
+
entity_id: string;
|
|
63
|
+
round_id: string;
|
|
64
|
+
source_reference?: string;
|
|
65
|
+
}
|
|
66
|
+
interface ExecuteRoundConversionRequest {
|
|
67
|
+
entity_id: string;
|
|
68
|
+
round_id: string;
|
|
69
|
+
intent_id: string;
|
|
70
|
+
source_reference?: string;
|
|
71
|
+
}
|
|
72
|
+
interface CreateExecutionIntentRequest {
|
|
73
|
+
entity_id: string;
|
|
74
|
+
intent_type: string;
|
|
75
|
+
authority_tier: string;
|
|
76
|
+
description: string;
|
|
77
|
+
metadata?: Record<string, unknown>;
|
|
78
|
+
}
|
|
79
|
+
interface EquityRoundResponse extends ApiRecord {
|
|
80
|
+
round_id: string;
|
|
81
|
+
status: string;
|
|
82
|
+
}
|
|
83
|
+
interface IntentResponse extends ApiRecord {
|
|
84
|
+
intent_id: string;
|
|
85
|
+
status: string;
|
|
86
|
+
}
|
|
35
87
|
|
|
36
88
|
declare class SessionExpiredError extends Error {
|
|
37
89
|
constructor();
|
|
@@ -46,6 +98,7 @@ declare class CorpAPIClient {
|
|
|
46
98
|
private request;
|
|
47
99
|
private get;
|
|
48
100
|
private post;
|
|
101
|
+
private postWithParams;
|
|
49
102
|
private patch;
|
|
50
103
|
private del;
|
|
51
104
|
getStatus(): Promise<ApiRecord>;
|
|
@@ -70,12 +123,22 @@ declare class CorpAPIClient {
|
|
|
70
123
|
issueSafe(data: ApiRecord): Promise<ApiRecord>;
|
|
71
124
|
transferShares(data: ApiRecord): Promise<ApiRecord>;
|
|
72
125
|
calculateDistribution(data: ApiRecord): Promise<ApiRecord>;
|
|
126
|
+
createEquityRound(data: CreateEquityRoundRequest): Promise<EquityRoundResponse>;
|
|
127
|
+
applyEquityRoundTerms(roundId: string, data: ApplyEquityRoundTermsRequest): Promise<ApiRecord>;
|
|
128
|
+
boardApproveEquityRound(roundId: string, data: BoardApproveEquityRoundRequest): Promise<EquityRoundResponse>;
|
|
129
|
+
acceptEquityRound(roundId: string, data: AcceptEquityRoundRequest): Promise<EquityRoundResponse>;
|
|
130
|
+
previewRoundConversion(data: PreviewRoundConversionRequest): Promise<ApiRecord>;
|
|
131
|
+
executeRoundConversion(data: ExecuteRoundConversionRequest): Promise<ApiRecord>;
|
|
132
|
+
createExecutionIntent(data: CreateExecutionIntentRequest): Promise<IntentResponse>;
|
|
133
|
+
evaluateIntent(intentId: string, entityId: string): Promise<ApiRecord>;
|
|
134
|
+
authorizeIntent(intentId: string, entityId: string): Promise<ApiRecord>;
|
|
73
135
|
listGovernanceBodies(entityId: string): Promise<ApiRecord[]>;
|
|
74
136
|
getGovernanceSeats(bodyId: string): Promise<ApiRecord[]>;
|
|
75
137
|
listMeetings(bodyId: string): Promise<ApiRecord[]>;
|
|
76
138
|
getMeetingResolutions(meetingId: string): Promise<ApiRecord[]>;
|
|
77
|
-
|
|
78
|
-
|
|
139
|
+
scheduleMeeting(data: ApiRecord): Promise<ApiRecord>;
|
|
140
|
+
conveneMeeting(meetingId: string, entityId: string, data: ApiRecord): Promise<ApiRecord>;
|
|
141
|
+
castVote(entityId: string, meetingId: string, itemId: string, data: ApiRecord): Promise<ApiRecord>;
|
|
79
142
|
getEntityDocuments(entityId: string): Promise<ApiRecord[]>;
|
|
80
143
|
generateContract(data: ApiRecord): Promise<ApiRecord>;
|
|
81
144
|
getSigningLink(documentId: string): ApiRecord;
|
|
@@ -149,4 +212,4 @@ interface ToolFunction {
|
|
|
149
212
|
declare const TOOL_REGISTRY: Record<string, ToolFunction>;
|
|
150
213
|
declare const READ_ONLY_TOOLS: Set<string>;
|
|
151
214
|
|
|
152
|
-
export { type ApiRecord, CorpAPIClient, type CorpConfig, GENERATED_TOOL_DEFINITIONS, type LLMResponse, READ_ONLY_TOOLS, SYSTEM_PROMPT_BASE, SessionExpiredError, TOOL_DEFINITIONS, TOOL_REGISTRY, type ToolCall, type ToolContext, describeToolCall, executeTool, formatConfigSection, isWriteTool, provisionWorkspace };
|
|
215
|
+
export { type AcceptEquityRoundRequest, type ApiRecord, type ApplyEquityRoundTermsRequest, type BoardApproveEquityRoundRequest, CorpAPIClient, type CorpConfig, type CreateEquityRoundRequest, type CreateExecutionIntentRequest, type EquityRoundResponse, type ExecuteRoundConversionRequest, GENERATED_TOOL_DEFINITIONS, type IntentResponse, type LLMResponse, type PreviewRoundConversionRequest, READ_ONLY_TOOLS, SYSTEM_PROMPT_BASE, SessionExpiredError, TOOL_DEFINITIONS, TOOL_REGISTRY, type ToolCall, type ToolContext, describeToolCall, executeTool, formatConfigSection, isWriteTool, provisionWorkspace };
|
package/dist/index.js
CHANGED
|
@@ -55,6 +55,12 @@ var CorpAPIClient = class {
|
|
|
55
55
|
if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);
|
|
56
56
|
return resp.json();
|
|
57
57
|
}
|
|
58
|
+
async postWithParams(path, body, params) {
|
|
59
|
+
const resp = await this.request("POST", path, body, params);
|
|
60
|
+
if (resp.status === 401) throw new SessionExpiredError();
|
|
61
|
+
if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);
|
|
62
|
+
return resp.json();
|
|
63
|
+
}
|
|
58
64
|
async patch(path, body) {
|
|
59
65
|
const resp = await this.request("PATCH", path, body);
|
|
60
66
|
if (resp.status === 401) throw new SessionExpiredError();
|
|
@@ -140,6 +146,35 @@ var CorpAPIClient = class {
|
|
|
140
146
|
calculateDistribution(data) {
|
|
141
147
|
return this.post("/v1/distributions", data);
|
|
142
148
|
}
|
|
149
|
+
// --- Equity rounds (v1) ---
|
|
150
|
+
createEquityRound(data) {
|
|
151
|
+
return this.post("/v1/equity/rounds", data);
|
|
152
|
+
}
|
|
153
|
+
applyEquityRoundTerms(roundId, data) {
|
|
154
|
+
return this.post(`/v1/equity/rounds/${roundId}/apply-terms`, data);
|
|
155
|
+
}
|
|
156
|
+
boardApproveEquityRound(roundId, data) {
|
|
157
|
+
return this.post(`/v1/equity/rounds/${roundId}/board-approve`, data);
|
|
158
|
+
}
|
|
159
|
+
acceptEquityRound(roundId, data) {
|
|
160
|
+
return this.post(`/v1/equity/rounds/${roundId}/accept`, data);
|
|
161
|
+
}
|
|
162
|
+
previewRoundConversion(data) {
|
|
163
|
+
return this.post("/v1/equity/conversions/preview", data);
|
|
164
|
+
}
|
|
165
|
+
executeRoundConversion(data) {
|
|
166
|
+
return this.post("/v1/equity/conversions/execute", data);
|
|
167
|
+
}
|
|
168
|
+
// --- Intent lifecycle helpers ---
|
|
169
|
+
createExecutionIntent(data) {
|
|
170
|
+
return this.post("/v1/execution/intents", data);
|
|
171
|
+
}
|
|
172
|
+
evaluateIntent(intentId, entityId) {
|
|
173
|
+
return this.postWithParams(`/v1/intents/${intentId}/evaluate`, {}, { entity_id: entityId });
|
|
174
|
+
}
|
|
175
|
+
authorizeIntent(intentId, entityId) {
|
|
176
|
+
return this.postWithParams(`/v1/intents/${intentId}/authorize`, {}, { entity_id: entityId });
|
|
177
|
+
}
|
|
143
178
|
// --- Governance ---
|
|
144
179
|
listGovernanceBodies(entityId) {
|
|
145
180
|
return this.get(`/v1/entities/${entityId}/governance-bodies`);
|
|
@@ -153,11 +188,14 @@ var CorpAPIClient = class {
|
|
|
153
188
|
getMeetingResolutions(meetingId) {
|
|
154
189
|
return this.get(`/v1/meetings/${meetingId}/resolutions`);
|
|
155
190
|
}
|
|
156
|
-
|
|
191
|
+
scheduleMeeting(data) {
|
|
157
192
|
return this.post("/v1/meetings", data);
|
|
158
193
|
}
|
|
159
|
-
|
|
160
|
-
return this.
|
|
194
|
+
conveneMeeting(meetingId, entityId, data) {
|
|
195
|
+
return this.postWithParams(`/v1/meetings/${meetingId}/convene`, data, { entity_id: entityId });
|
|
196
|
+
}
|
|
197
|
+
castVote(entityId, meetingId, itemId, data) {
|
|
198
|
+
return this.postWithParams(`/v1/meetings/${meetingId}/agenda-items/${itemId}/vote`, data, { entity_id: entityId });
|
|
161
199
|
}
|
|
162
200
|
// --- Documents ---
|
|
163
201
|
getEntityDocuments(entityId) {
|
|
@@ -174,7 +212,7 @@ var CorpAPIClient = class {
|
|
|
174
212
|
}
|
|
175
213
|
// --- Finance ---
|
|
176
214
|
createInvoice(data) {
|
|
177
|
-
return this.post("/v1/invoices", data);
|
|
215
|
+
return this.post("/v1/treasury/invoices", data);
|
|
178
216
|
}
|
|
179
217
|
runPayroll(data) {
|
|
180
218
|
return this.post("/v1/payroll/runs", data);
|
|
@@ -662,6 +700,7 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
662
700
|
"entity_id",
|
|
663
701
|
"customer_name",
|
|
664
702
|
"amount_cents",
|
|
703
|
+
"description",
|
|
665
704
|
"due_date"
|
|
666
705
|
]
|
|
667
706
|
}
|
|
@@ -900,34 +939,23 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
900
939
|
"parameters": {
|
|
901
940
|
"type": "object",
|
|
902
941
|
"properties": {
|
|
903
|
-
"
|
|
942
|
+
"entity_id": {
|
|
904
943
|
"type": "string"
|
|
905
944
|
},
|
|
906
|
-
"
|
|
945
|
+
"meeting_id": {
|
|
907
946
|
"type": "string"
|
|
908
947
|
},
|
|
909
|
-
"
|
|
948
|
+
"present_seat_ids": {
|
|
910
949
|
"type": "array",
|
|
911
950
|
"items": {
|
|
912
951
|
"type": "string"
|
|
913
952
|
}
|
|
914
|
-
},
|
|
915
|
-
"entity_id": {
|
|
916
|
-
"type": "string"
|
|
917
|
-
},
|
|
918
|
-
"governance_body_id": {
|
|
919
|
-
"type": "string"
|
|
920
|
-
},
|
|
921
|
-
"scheduled_date": {
|
|
922
|
-
"type": "string"
|
|
923
953
|
}
|
|
924
954
|
},
|
|
925
955
|
"required": [
|
|
926
956
|
"entity_id",
|
|
927
|
-
"
|
|
928
|
-
"
|
|
929
|
-
"title",
|
|
930
|
-
"scheduled_date"
|
|
957
|
+
"meeting_id",
|
|
958
|
+
"present_seat_ids"
|
|
931
959
|
]
|
|
932
960
|
}
|
|
933
961
|
}
|
|
@@ -940,6 +968,9 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
940
968
|
"parameters": {
|
|
941
969
|
"type": "object",
|
|
942
970
|
"properties": {
|
|
971
|
+
"entity_id": {
|
|
972
|
+
"type": "string"
|
|
973
|
+
},
|
|
943
974
|
"meeting_id": {
|
|
944
975
|
"type": "string"
|
|
945
976
|
},
|
|
@@ -949,16 +980,17 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
949
980
|
"voter_id": {
|
|
950
981
|
"type": "string"
|
|
951
982
|
},
|
|
952
|
-
"
|
|
983
|
+
"vote_value": {
|
|
953
984
|
"type": "string",
|
|
954
985
|
"description": "for, against, abstain, or recusal"
|
|
955
986
|
}
|
|
956
987
|
},
|
|
957
988
|
"required": [
|
|
989
|
+
"entity_id",
|
|
958
990
|
"meeting_id",
|
|
959
991
|
"agenda_item_id",
|
|
960
992
|
"voter_id",
|
|
961
|
-
"
|
|
993
|
+
"vote_value"
|
|
962
994
|
]
|
|
963
995
|
}
|
|
964
996
|
}
|
|
@@ -971,6 +1003,9 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
971
1003
|
"parameters": {
|
|
972
1004
|
"type": "object",
|
|
973
1005
|
"properties": {
|
|
1006
|
+
"entity_id": {
|
|
1007
|
+
"type": "string"
|
|
1008
|
+
},
|
|
974
1009
|
"body_id": {
|
|
975
1010
|
"type": "string"
|
|
976
1011
|
},
|
|
@@ -980,10 +1015,10 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
980
1015
|
"title": {
|
|
981
1016
|
"type": "string"
|
|
982
1017
|
},
|
|
983
|
-
"
|
|
1018
|
+
"scheduled_date": {
|
|
984
1019
|
"type": "string"
|
|
985
1020
|
},
|
|
986
|
-
"
|
|
1021
|
+
"agenda_item_titles": {
|
|
987
1022
|
"type": "array",
|
|
988
1023
|
"items": {
|
|
989
1024
|
"type": "string"
|
|
@@ -991,10 +1026,10 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
991
1026
|
}
|
|
992
1027
|
},
|
|
993
1028
|
"required": [
|
|
1029
|
+
"entity_id",
|
|
994
1030
|
"body_id",
|
|
995
1031
|
"meeting_type",
|
|
996
|
-
"title"
|
|
997
|
-
"proposed_date"
|
|
1032
|
+
"title"
|
|
998
1033
|
]
|
|
999
1034
|
}
|
|
1000
1035
|
}
|
|
@@ -1233,6 +1268,13 @@ var GENERATED_TOOL_DEFINITIONS = [
|
|
|
1233
1268
|
];
|
|
1234
1269
|
|
|
1235
1270
|
// src/tools.ts
|
|
1271
|
+
function requiredString(args, key) {
|
|
1272
|
+
const value = args[key];
|
|
1273
|
+
if (typeof value !== "string" || value.trim().length === 0) {
|
|
1274
|
+
throw new Error(`Missing required field: ${key}`);
|
|
1275
|
+
}
|
|
1276
|
+
return value;
|
|
1277
|
+
}
|
|
1236
1278
|
var TOOL_HANDLERS = {
|
|
1237
1279
|
get_workspace_status: async (_args, client) => client.getStatus(),
|
|
1238
1280
|
list_obligations: async (args, client) => client.getObligations(args.tier),
|
|
@@ -1279,6 +1321,9 @@ var TOOL_HANDLERS = {
|
|
|
1279
1321
|
args.amount_cents = args.line_items.reduce((sum, item) => sum + (item.amount_cents ?? 0), 0);
|
|
1280
1322
|
}
|
|
1281
1323
|
if (!("amount_cents" in args)) args.amount_cents = 0;
|
|
1324
|
+
if (!("description" in args) || typeof args.description !== "string" || args.description.trim().length === 0) {
|
|
1325
|
+
args.description = "Invoice";
|
|
1326
|
+
}
|
|
1282
1327
|
return client.createInvoice(args);
|
|
1283
1328
|
},
|
|
1284
1329
|
run_payroll: async (args, client) => client.runPayroll(args),
|
|
@@ -1304,18 +1349,28 @@ var TOOL_HANDLERS = {
|
|
|
1304
1349
|
},
|
|
1305
1350
|
schedule_meeting: async (args, client) => {
|
|
1306
1351
|
const body = {
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1352
|
+
entity_id: requiredString(args, "entity_id"),
|
|
1353
|
+
body_id: requiredString(args, "body_id"),
|
|
1354
|
+
meeting_type: requiredString(args, "meeting_type"),
|
|
1355
|
+
title: requiredString(args, "title")
|
|
1311
1356
|
};
|
|
1312
|
-
|
|
1313
|
-
|
|
1357
|
+
const scheduledDate = args.scheduled_date ?? args.proposed_date;
|
|
1358
|
+
if (typeof scheduledDate === "string" && scheduledDate.trim().length > 0) {
|
|
1359
|
+
body.scheduled_date = scheduledDate;
|
|
1360
|
+
}
|
|
1361
|
+
const agendaItems = args.agenda_item_titles ?? args.agenda_items;
|
|
1362
|
+
if (Array.isArray(agendaItems)) body.agenda_item_titles = agendaItems;
|
|
1363
|
+
return client.scheduleMeeting(body);
|
|
1314
1364
|
},
|
|
1315
|
-
cast_vote: async (args, client) => client.castVote(
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
1365
|
+
cast_vote: async (args, client) => client.castVote(
|
|
1366
|
+
requiredString(args, "entity_id"),
|
|
1367
|
+
requiredString(args, "meeting_id"),
|
|
1368
|
+
requiredString(args, "agenda_item_id"),
|
|
1369
|
+
{
|
|
1370
|
+
voter_id: requiredString(args, "voter_id"),
|
|
1371
|
+
vote_value: requiredString(args, "vote_value")
|
|
1372
|
+
}
|
|
1373
|
+
),
|
|
1319
1374
|
update_checklist: async (args, _client, ctx) => {
|
|
1320
1375
|
const path = join(ctx.dataDir, "checklist.md");
|
|
1321
1376
|
mkdirSync(ctx.dataDir, { recursive: true });
|
|
@@ -1356,7 +1411,13 @@ var TOOL_HANDLERS = {
|
|
|
1356
1411
|
classify_contractor: async (args, client) => client.classifyContractor(args),
|
|
1357
1412
|
reconcile_ledger: async (args, client) => client.reconcileLedger(args),
|
|
1358
1413
|
track_deadline: async (args, client) => client.trackDeadline(args),
|
|
1359
|
-
convene_meeting: async (args, client) => client.conveneMeeting(
|
|
1414
|
+
convene_meeting: async (args, client) => client.conveneMeeting(
|
|
1415
|
+
requiredString(args, "meeting_id"),
|
|
1416
|
+
requiredString(args, "entity_id"),
|
|
1417
|
+
{
|
|
1418
|
+
present_seat_ids: Array.isArray(args.present_seat_ids) ? args.present_seat_ids : []
|
|
1419
|
+
}
|
|
1420
|
+
),
|
|
1360
1421
|
create_agent: async (args, client) => client.createAgent(args),
|
|
1361
1422
|
send_agent_message: async (args, client) => client.sendAgentMessage(args.agent_id, args.body),
|
|
1362
1423
|
update_agent: async (args, client) => client.updateAgent(args.agent_id, args),
|
|
@@ -1371,7 +1432,6 @@ var READ_ONLY_TOOLS = /* @__PURE__ */ new Set([
|
|
|
1371
1432
|
"list_safe_notes",
|
|
1372
1433
|
"list_agents",
|
|
1373
1434
|
"get_checklist",
|
|
1374
|
-
"get_document_link",
|
|
1375
1435
|
"get_signing_link",
|
|
1376
1436
|
"list_obligations",
|
|
1377
1437
|
"get_billing_status"
|
|
@@ -1604,7 +1664,6 @@ var READ_ONLY_TOOLS2 = /* @__PURE__ */ new Set([
|
|
|
1604
1664
|
"list_safe_notes",
|
|
1605
1665
|
"list_agents",
|
|
1606
1666
|
"get_checklist",
|
|
1607
|
-
"get_document_link",
|
|
1608
1667
|
"get_signing_link",
|
|
1609
1668
|
"list_obligations",
|
|
1610
1669
|
"get_billing_status"
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/api-client.ts","../src/tools.ts","../src/tool-defs.generated.ts","../src/tool-descriptions.ts","../src/system-prompt.ts","../src/definitions.ts"],"sourcesContent":["import type { ApiRecord } from \"./types.js\";\n\nexport class SessionExpiredError extends Error {\n constructor() {\n super(\"Your API key is no longer valid. Run 'corp setup' to re-authenticate.\");\n this.name = \"SessionExpiredError\";\n }\n}\n\nexport async function provisionWorkspace(\n apiUrl: string,\n name?: string\n): Promise<ApiRecord> {\n const url = `${apiUrl.replace(/\\/+$/, \"\")}/v1/workspaces/provision`;\n const body: Record<string, string> = {};\n if (name) body.name = name;\n const resp = await fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n });\n if (!resp.ok) throw new Error(`Provision failed: ${resp.status} ${resp.statusText}`);\n return resp.json() as Promise<ApiRecord>;\n}\n\nexport class CorpAPIClient {\n readonly apiUrl: string;\n readonly apiKey: string;\n readonly workspaceId: string;\n\n constructor(apiUrl: string, apiKey: string, workspaceId: string) {\n this.apiUrl = apiUrl.replace(/\\/+$/, \"\");\n this.apiKey = apiKey;\n this.workspaceId = workspaceId;\n }\n\n private headers(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n };\n }\n\n private async request(method: string, path: string, body?: unknown, params?: Record<string, string>): Promise<Response> {\n let url = `${this.apiUrl}${path}`;\n if (params) {\n const qs = new URLSearchParams(params).toString();\n if (qs) url += `?${qs}`;\n }\n const opts: RequestInit = { method, headers: this.headers() };\n if (body !== undefined) opts.body = JSON.stringify(body);\n return fetch(url, opts);\n }\n\n private async get(path: string, params?: Record<string, string>): Promise<unknown> {\n const resp = await this.request(\"GET\", path, undefined, params);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async post(path: string, body?: unknown): Promise<unknown> {\n const resp = await this.request(\"POST\", path, body);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async patch(path: string, body?: unknown): Promise<unknown> {\n const resp = await this.request(\"PATCH\", path, body);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async del(path: string): Promise<void> {\n const resp = await this.request(\"DELETE\", path);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n }\n\n // --- Workspace ---\n getStatus() { return this.get(`/v1/workspaces/${this.workspaceId}/status`) as Promise<ApiRecord>; }\n\n // --- Obligations ---\n getObligations(tier?: string) {\n const params: Record<string, string> = {};\n if (tier) params.tier = tier;\n return this.get(\"/v1/obligations/summary\", params) as Promise<ApiRecord>;\n }\n\n // --- Digests ---\n listDigests() { return this.get(\"/v1/digests\") as Promise<ApiRecord[]>; }\n triggerDigest() { return this.post(\"/v1/digests/trigger\") as Promise<ApiRecord>; }\n getDigest(key: string) { return this.get(`/v1/digests/${key}`) as Promise<ApiRecord>; }\n\n // --- Entities ---\n listEntities() { return this.get(`/v1/workspaces/${this.workspaceId}/entities`) as Promise<ApiRecord[]>; }\n\n // --- Contacts ---\n listContacts() { return this.get(`/v1/workspaces/${this.workspaceId}/contacts`) as Promise<ApiRecord[]>; }\n getContact(id: string) { return this.get(`/v1/contacts/${id}`) as Promise<ApiRecord>; }\n getContactProfile(id: string) { return this.get(`/v1/contacts/${id}/profile`) as Promise<ApiRecord>; }\n createContact(data: ApiRecord) { return this.post(`/v1/workspaces/${this.workspaceId}/contacts`, data) as Promise<ApiRecord>; }\n updateContact(id: string, data: ApiRecord) { return this.patch(`/v1/contacts/${id}`, data) as Promise<ApiRecord>; }\n getNotificationPrefs(contactId: string) { return this.get(`/v1/contacts/${contactId}/notification-prefs`) as Promise<ApiRecord>; }\n updateNotificationPrefs(contactId: string, prefs: ApiRecord) { return this.patch(`/v1/contacts/${contactId}/notification-prefs`, prefs) as Promise<ApiRecord>; }\n\n // --- Cap Table ---\n getCapTable(entityId: string) { return this.get(`/v1/entities/${entityId}/cap-table`) as Promise<ApiRecord>; }\n getSafeNotes(entityId: string) { return this.get(`/v1/entities/${entityId}/safe-notes`) as Promise<ApiRecord[]>; }\n getShareTransfers(entityId: string) { return this.get(`/v1/entities/${entityId}/share-transfers`) as Promise<ApiRecord[]>; }\n getValuations(entityId: string) { return this.get(`/v1/entities/${entityId}/valuations`) as Promise<ApiRecord[]>; }\n getCurrent409a(entityId: string) { return this.get(`/v1/entities/${entityId}/current-409a`) as Promise<ApiRecord>; }\n issueEquity(data: ApiRecord) { return this.post(\"/v1/equity/grants\", data) as Promise<ApiRecord>; }\n issueSafe(data: ApiRecord) { return this.post(\"/v1/safe-notes\", data) as Promise<ApiRecord>; }\n transferShares(data: ApiRecord) { return this.post(\"/v1/share-transfers\", data) as Promise<ApiRecord>; }\n calculateDistribution(data: ApiRecord) { return this.post(\"/v1/distributions\", data) as Promise<ApiRecord>; }\n\n // --- Governance ---\n listGovernanceBodies(entityId: string) { return this.get(`/v1/entities/${entityId}/governance-bodies`) as Promise<ApiRecord[]>; }\n getGovernanceSeats(bodyId: string) { return this.get(`/v1/governance-bodies/${bodyId}/seats`) as Promise<ApiRecord[]>; }\n listMeetings(bodyId: string) { return this.get(`/v1/governance-bodies/${bodyId}/meetings`) as Promise<ApiRecord[]>; }\n getMeetingResolutions(meetingId: string) { return this.get(`/v1/meetings/${meetingId}/resolutions`) as Promise<ApiRecord[]>; }\n conveneMeeting(data: ApiRecord) { return this.post(\"/v1/meetings\", data) as Promise<ApiRecord>; }\n castVote(meetingId: string, itemId: string, data: ApiRecord) { return this.post(`/v1/meetings/${meetingId}/agenda-items/${itemId}/vote`, data) as Promise<ApiRecord>; }\n\n // --- Documents ---\n getEntityDocuments(entityId: string) { return this.get(`/v1/formations/${entityId}/documents`) as Promise<ApiRecord[]>; }\n generateContract(data: ApiRecord) { return this.post(\"/v1/contracts\", data) as Promise<ApiRecord>; }\n getSigningLink(documentId: string): ApiRecord {\n return {\n document_id: documentId,\n signing_url: `https://humans.thecorporation.ai/sign/${documentId}`,\n };\n }\n\n // --- Finance ---\n createInvoice(data: ApiRecord) { return this.post(\"/v1/invoices\", data) as Promise<ApiRecord>; }\n runPayroll(data: ApiRecord) { return this.post(\"/v1/payroll/runs\", data) as Promise<ApiRecord>; }\n submitPayment(data: ApiRecord) { return this.post(\"/v1/payments\", data) as Promise<ApiRecord>; }\n openBankAccount(data: ApiRecord) { return this.post(\"/v1/bank-accounts\", data) as Promise<ApiRecord>; }\n classifyContractor(data: ApiRecord) { return this.post(\"/v1/contractors/classify\", data) as Promise<ApiRecord>; }\n reconcileLedger(data: ApiRecord) { return this.post(\"/v1/ledger/reconcile\", data) as Promise<ApiRecord>; }\n\n // --- Tax ---\n fileTaxDocument(data: ApiRecord) { return this.post(\"/v1/tax/filings\", data) as Promise<ApiRecord>; }\n trackDeadline(data: ApiRecord) { return this.post(\"/v1/deadlines\", data) as Promise<ApiRecord>; }\n\n // --- Billing ---\n getBillingStatus() { return this.get(\"/v1/billing/status\", { workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n getBillingPlans() {\n return (this.get(\"/v1/billing/plans\") as Promise<unknown>).then((data) => {\n if (typeof data === \"object\" && data !== null && \"plans\" in data) {\n return (data as { plans: ApiRecord[] }).plans;\n }\n return data as ApiRecord[];\n });\n }\n createBillingPortal() { return this.post(\"/v1/billing/portal\", { workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n createBillingCheckout(tier: string, entityId?: string) {\n const body: ApiRecord = { tier };\n if (entityId) body.entity_id = entityId;\n return this.post(\"/v1/billing/checkout\", body) as Promise<ApiRecord>;\n }\n\n // --- Formations ---\n getFormation(id: string) { return this.get(`/v1/formations/${id}`) as Promise<ApiRecord>; }\n getFormationDocuments(id: string) { return this.get(`/v1/formations/${id}/documents`) as Promise<ApiRecord[]>; }\n createFormation(data: ApiRecord) { return this.post(\"/v1/formations\", data) as Promise<ApiRecord>; }\n\n // --- Human obligations ---\n getHumanObligations() { return this.get(`/v1/workspaces/${this.workspaceId}/human-obligations`) as Promise<ApiRecord[]>; }\n getSignerToken(obligationId: string) { return this.post(`/v1/human-obligations/${obligationId}/signer-token`) as Promise<ApiRecord>; }\n\n // --- Demo ---\n seedDemo(name: string) { return this.post(\"/v1/demo/seed\", { name, workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n\n // --- Entities writes ---\n convertEntity(entityId: string, data: ApiRecord) { return this.post(`/v1/entities/${entityId}/convert`, data) as Promise<ApiRecord>; }\n dissolveEntity(entityId: string, data: ApiRecord) { return this.post(`/v1/entities/${entityId}/dissolve`, data) as Promise<ApiRecord>; }\n\n // --- Agents ---\n listAgents() { return this.get(\"/v1/agents\") as Promise<ApiRecord[]>; }\n getAgent(id: string) { return this.get(`/v1/agents/${id}`) as Promise<ApiRecord>; }\n createAgent(data: ApiRecord) { return this.post(\"/v1/agents\", data) as Promise<ApiRecord>; }\n updateAgent(id: string, data: ApiRecord) { return this.patch(`/v1/agents/${id}`, data) as Promise<ApiRecord>; }\n deleteAgent(id: string) { return this.del(`/v1/agents/${id}`); }\n sendAgentMessage(id: string, body: string) { return this.post(`/v1/agents/${id}/messages`, { body }) as Promise<ApiRecord>; }\n listAgentExecutions(id: string) { return this.get(`/v1/agents/${id}/executions`) as Promise<ApiRecord[]>; }\n getAgentUsage(id: string) { return this.get(`/v1/agents/${id}/usage`) as Promise<ApiRecord>; }\n addAgentSkill(id: string, data: ApiRecord) { return this.post(`/v1/agents/${id}/skills`, data) as Promise<ApiRecord>; }\n listSupportedModels() { return this.get(\"/v1/models\") as Promise<ApiRecord[]>; }\n\n // --- Approvals ---\n listPendingApprovals() { return this.get(\"/v1/approvals/pending\") as Promise<ApiRecord[]>; }\n respondApproval(id: string, decision: string, message = \"\") { return this.patch(`/v1/approvals/${id}`, { decision, message }) as Promise<ApiRecord>; }\n\n // --- API Keys ---\n listApiKeys() { return this.get(\"/v1/api-keys\", { workspace_id: this.workspaceId }) as Promise<ApiRecord[]>; }\n\n // --- Obligations ---\n assignObligation(obligationId: string, contactId: string) {\n return this.patch(`/v1/obligations/${obligationId}/assign`, { contact_id: contactId }) as Promise<ApiRecord>;\n }\n\n // --- Config ---\n getConfig() { return this.get(\"/v1/config\") as Promise<ApiRecord>; }\n\n // --- Link/Claim ---\n async createLink(): Promise<ApiRecord> {\n const resp = await this.request(\"POST\", \"/v1/workspaces/link\");\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json() as Promise<ApiRecord>;\n }\n}\n","import type { CorpAPIClient } from \"./api-client.js\";\nimport { readFileSync, writeFileSync, mkdirSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\n\nexport interface ToolContext {\n dataDir: string;\n onEntityFormed?: (entityId: string) => void;\n}\n\ntype ToolHandler = (args: Record<string, unknown>, client: CorpAPIClient, ctx: ToolContext) => Promise<unknown>;\n\nconst TOOL_HANDLERS: Record<string, ToolHandler> = {\n get_workspace_status: async (_args, client) => client.getStatus(),\n list_obligations: async (args, client) => client.getObligations(args.tier as string | undefined),\n list_entities: async (_args, client) => client.listEntities(),\n get_cap_table: async (args, client) => client.getCapTable(args.entity_id as string),\n list_documents: async (args, client) => client.getEntityDocuments(args.entity_id as string),\n list_safe_notes: async (args, client) => client.getSafeNotes(args.entity_id as string),\n list_agents: async (_args, client) => client.listAgents(),\n get_billing_status: async (_args, client) => {\n const [status, plans] = await Promise.all([client.getBillingStatus(), client.getBillingPlans()]);\n return { status, plans };\n },\n\n form_entity: async (args, client, ctx) => {\n const entityType = args.entity_type as string;\n let jurisdiction = (args.jurisdiction as string) || \"\";\n if (!jurisdiction || jurisdiction.length === 2) {\n jurisdiction = entityType === \"llc\" ? \"US-WY\" : \"US-DE\";\n }\n const members = (args.members ?? []) as Record<string, unknown>[];\n if (!members.length) return { error: \"Members are required.\" };\n // Normalize: ensure investor_type defaults, convert ownership_pct > 1 to 0-1 scale\n for (const m of members) {\n if (!m.investor_type) m.investor_type = \"natural_person\";\n if (typeof m.ownership_pct === \"number\" && (m.ownership_pct as number) > 1) {\n m.ownership_pct = (m.ownership_pct as number) / 100;\n }\n }\n const result = await client.createFormation({\n entity_type: entityType, legal_name: args.entity_name, jurisdiction,\n members, workspace_id: client.workspaceId,\n });\n const entityId = result.entity_id as string;\n if (entityId && ctx.onEntityFormed) {\n ctx.onEntityFormed(entityId);\n }\n return result;\n },\n\n issue_equity: async (args, client) => client.issueEquity(args),\n issue_safe: async (args, client) => client.issueSafe(args),\n create_invoice: async (args, client) => {\n if (!(\"amount_cents\" in args) && Array.isArray(args.line_items)) {\n args.amount_cents = (args.line_items as Record<string, number>[])\n .reduce((sum, item) => sum + (item.amount_cents ?? 0), 0);\n }\n if (!(\"amount_cents\" in args)) args.amount_cents = 0;\n return client.createInvoice(args);\n },\n run_payroll: async (args, client) => client.runPayroll(args),\n submit_payment: async (args, client) => client.submitPayment(args),\n open_bank_account: async (args, client) => {\n const body: Record<string, unknown> = { entity_id: args.entity_id };\n if (args.institution_name) body.institution_name = args.institution_name;\n return client.openBankAccount(body);\n },\n generate_contract: async (args, client) => client.generateContract(args),\n file_tax_document: async (args, client) => client.fileTaxDocument(args),\n\n get_signer_link: async (args, client) => {\n const result = await client.getSignerToken(args.obligation_id as string);\n const token = result.token as string ?? \"\";\n const obligationId = args.obligation_id as string;\n const humansBase = client.apiUrl.replace(\"://api.\", \"://humans.\");\n return {\n signer_url: `${humansBase}/human/${obligationId}?token=${token}`,\n obligation_id: obligationId,\n expires_in_seconds: result.expires_in ?? 900,\n message: \"Share this link with the signer. Link expires in 15 minutes.\",\n };\n },\n\n schedule_meeting: async (args, client) => {\n const body: Record<string, unknown> = {\n body_id: args.body_id, meeting_type: args.meeting_type,\n title: args.title, proposed_date: args.proposed_date,\n };\n if (args.agenda_items) body.agenda_item_titles = args.agenda_items;\n return client.conveneMeeting(body);\n },\n\n cast_vote: async (args, client) =>\n client.castVote(args.meeting_id as string, args.agenda_item_id as string, {\n voter_id: args.voter_id, vote_value: args.vote,\n }),\n\n update_checklist: async (args, _client, ctx) => {\n const path = join(ctx.dataDir, \"checklist.md\");\n mkdirSync(ctx.dataDir, { recursive: true });\n writeFileSync(path, args.checklist as string);\n return { status: \"updated\", checklist: args.checklist };\n },\n\n get_checklist: async (_args, _client, ctx) => {\n const path = join(ctx.dataDir, \"checklist.md\");\n if (existsSync(path)) return { checklist: readFileSync(path, \"utf-8\") };\n return { checklist: null, message: \"No checklist yet.\" };\n },\n\n get_document_link: async (args, client) => {\n const docId = args.document_id as string;\n try {\n const resp = await fetch(`${client.apiUrl}/v1/documents/${docId}/request-copy`, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${client.apiKey}`, \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ email: \"owner@workspace\" }),\n });\n if (!resp.ok) throw new Error(\"request-copy failed\");\n const result = await resp.json() as Record<string, string>;\n let downloadUrl = result.download_url ?? \"\";\n if (downloadUrl.startsWith(\"/\")) downloadUrl = client.apiUrl + downloadUrl;\n return { document_id: docId, download_url: downloadUrl, expires_in: \"24 hours\" };\n } catch {\n return {\n document_id: docId,\n download_url: `${client.apiUrl}/v1/documents/${docId}/pdf`,\n note: \"Use your API key to authenticate the download.\",\n };\n }\n },\n\n get_signing_link: async (args, client) => client.getSigningLink(args.document_id as string),\n convert_entity: async (args, client) => client.convertEntity(args.entity_id as string, args),\n dissolve_entity: async (args, client) => client.dissolveEntity(args.entity_id as string, args),\n transfer_shares: async (args, client) => client.transferShares(args),\n calculate_distribution: async (args, client) => client.calculateDistribution(args),\n classify_contractor: async (args, client) => client.classifyContractor(args),\n reconcile_ledger: async (args, client) => client.reconcileLedger(args),\n track_deadline: async (args, client) => client.trackDeadline(args),\n convene_meeting: async (args, client) => client.conveneMeeting(args),\n\n create_agent: async (args, client) => client.createAgent(args),\n send_agent_message: async (args, client) => client.sendAgentMessage(args.agent_id as string, args.body as string),\n update_agent: async (args, client) => client.updateAgent(args.agent_id as string, args),\n add_agent_skill: async (args, client) => client.addAgentSkill(args.agent_id as string, args),\n};\n\n// Tool definitions are generated from the backend OpenAPI spec.\n// Regenerate: make generate-tools\nexport const TOOL_DEFINITIONS: Record<string, unknown>[] = GENERATED_TOOL_DEFINITIONS;\n\nconst READ_ONLY_TOOLS = new Set([\n \"get_workspace_status\", \"list_entities\", \"get_cap_table\", \"list_documents\",\n \"list_safe_notes\", \"list_agents\", \"get_checklist\", \"get_document_link\",\n \"get_signing_link\", \"list_obligations\", \"get_billing_status\",\n]);\n\nexport function isWriteTool(name: string): boolean {\n return !READ_ONLY_TOOLS.has(name);\n}\n\nexport async function executeTool(\n name: string,\n args: Record<string, unknown>,\n client: CorpAPIClient,\n ctx: ToolContext,\n): Promise<string> {\n const handler = TOOL_HANDLERS[name];\n if (!handler) return JSON.stringify({ error: `Unknown tool: ${name}` });\n try {\n const result = await handler(args, client, ctx);\n return JSON.stringify(result, null, 0);\n } catch (err) {\n return JSON.stringify({ error: String(err) });\n }\n}\n","// AUTO-GENERATED from backend OpenAPI spec — do not edit by hand.\n// Regenerate: make generate-tools\n\nexport const GENERATED_TOOL_DEFINITIONS: Record<string, unknown>[] = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_workspace_status\",\n \"description\": \"Get workspace status summary\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_entities\",\n \"description\": \"List all entities in the workspace\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_cap_table\",\n \"description\": \"Get cap table for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_documents\",\n \"description\": \"List documents for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_safe_notes\",\n \"description\": \"List SAFE notes for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_agents\",\n \"description\": \"List all agents in the workspace\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_obligations\",\n \"description\": \"List obligations with urgency tiers\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"tier\": {\n \"type\": \"string\"\n }\n },\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_billing_status\",\n \"description\": \"Get billing status and plans\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"form_entity\",\n \"description\": \"Form a new business entity (LLC or corporation)\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"llc\",\n \"corporation\"\n ]\n },\n \"entity_name\": {\n \"type\": \"string\"\n },\n \"jurisdiction\": {\n \"type\": \"string\"\n },\n \"members\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"investor_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"natural_person\",\n \"agent\",\n \"entity\"\n ]\n },\n \"email\": {\n \"type\": \"string\"\n },\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"ownership_pct\": {\n \"type\": \"number\"\n },\n \"membership_units\": {\n \"type\": \"integer\"\n },\n \"share_count\": {\n \"type\": \"integer\"\n },\n \"share_class\": {\n \"type\": \"string\"\n },\n \"role\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"investor_type\"\n ]\n }\n }\n },\n \"required\": [\n \"entity_type\",\n \"entity_name\",\n \"jurisdiction\",\n \"members\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"issue_equity\",\n \"description\": \"Issue an equity grant\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"grant_type\": {\n \"type\": \"string\"\n },\n \"shares\": {\n \"type\": \"integer\"\n },\n \"recipient_name\": {\n \"type\": \"string\"\n },\n \"vesting_schedule\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"grant_type\",\n \"shares\",\n \"recipient_name\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"issue_safe\",\n \"description\": \"Issue a SAFE note\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"investor_name\": {\n \"type\": \"string\"\n },\n \"principal_amount_cents\": {\n \"type\": \"integer\"\n },\n \"safe_type\": {\n \"type\": \"string\"\n },\n \"valuation_cap_cents\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"investor_name\",\n \"principal_amount_cents\",\n \"safe_type\",\n \"valuation_cap_cents\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"transfer_shares\",\n \"description\": \"Transfer shares between holders\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"share_class_id\": {\n \"type\": \"string\"\n },\n \"from_holder\": {\n \"type\": \"string\"\n },\n \"to_holder\": {\n \"type\": \"string\"\n },\n \"transfer_type\": {\n \"type\": \"string\"\n },\n \"shares\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"from_holder\",\n \"to_holder\",\n \"shares\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"calculate_distribution\",\n \"description\": \"Calculate a distribution\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"total_amount_cents\": {\n \"type\": \"integer\"\n },\n \"distribution_type\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"total_amount_cents\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"create_invoice\",\n \"description\": \"Create an invoice\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"customer_name\": {\n \"type\": \"string\"\n },\n \"amount_cents\": {\n \"type\": \"integer\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"due_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"customer_name\",\n \"amount_cents\",\n \"due_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"run_payroll\",\n \"description\": \"Run payroll\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"pay_period_start\": {\n \"type\": \"string\"\n },\n \"pay_period_end\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"pay_period_start\",\n \"pay_period_end\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"submit_payment\",\n \"description\": \"Submit a payment\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"amount_cents\": {\n \"type\": \"integer\"\n },\n \"recipient\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"amount_cents\",\n \"recipient\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"open_bank_account\",\n \"description\": \"Open a business bank account\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"institution_name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"generate_contract\",\n \"description\": \"Generate a contract from a template\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"template_type\": {\n \"type\": \"string\"\n },\n \"parameters\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"template_type\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"file_tax_document\",\n \"description\": \"File a tax document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"document_type\": {\n \"type\": \"string\"\n },\n \"tax_year\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"document_type\",\n \"tax_year\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"track_deadline\",\n \"description\": \"Track a compliance deadline\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"deadline_type\": {\n \"type\": \"string\"\n },\n \"due_date\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"recurrence\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"deadline_type\",\n \"due_date\",\n \"description\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"classify_contractor\",\n \"description\": \"Classify contractor risk\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"contractor_name\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"hours_per_week\": {\n \"type\": \"integer\"\n },\n \"exclusive_client\": {\n \"type\": \"boolean\"\n },\n \"duration_months\": {\n \"type\": \"integer\"\n },\n \"provides_tools\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"contractor_name\",\n \"state\",\n \"hours_per_week\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"reconcile_ledger\",\n \"description\": \"Reconcile an entity's ledger\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"start_date\": {\n \"type\": \"string\"\n },\n \"end_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"start_date\",\n \"end_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convene_meeting\",\n \"description\": \"Convene a governance meeting\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"meeting_type\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"agenda_item_titles\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"governance_body_id\": {\n \"type\": \"string\"\n },\n \"scheduled_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"governance_body_id\",\n \"meeting_type\",\n \"title\",\n \"scheduled_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"cast_vote\",\n \"description\": \"Cast a vote on an agenda item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"meeting_id\": {\n \"type\": \"string\"\n },\n \"agenda_item_id\": {\n \"type\": \"string\"\n },\n \"voter_id\": {\n \"type\": \"string\"\n },\n \"vote\": {\n \"type\": \"string\",\n \"description\": \"for, against, abstain, or recusal\"\n }\n },\n \"required\": [\n \"meeting_id\",\n \"agenda_item_id\",\n \"voter_id\",\n \"vote\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"schedule_meeting\",\n \"description\": \"Schedule a board or member meeting\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"body_id\": {\n \"type\": \"string\"\n },\n \"meeting_type\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"proposed_date\": {\n \"type\": \"string\"\n },\n \"agenda_items\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"body_id\",\n \"meeting_type\",\n \"title\",\n \"proposed_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_signer_link\",\n \"description\": \"Generate a signing link for a human obligation\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"obligation_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"obligation_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_document_link\",\n \"description\": \"Get a download link for a document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"document_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"document_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_entity\",\n \"description\": \"Convert entity type\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"new_entity_type\": {\n \"type\": \"string\"\n },\n \"new_jurisdiction\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"new_entity_type\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"dissolve_entity\",\n \"description\": \"Dissolve an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": \"string\"\n },\n \"effective_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"reason\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"add_agent_skill\",\n \"description\": \"Add a skill to an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"skill_name\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"instructions\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\",\n \"skill_name\",\n \"description\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_checklist\",\n \"description\": \"Get the user's onboarding checklist\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"update_checklist\",\n \"description\": \"Update the user's onboarding checklist\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"checklist\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"checklist\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_signing_link\",\n \"description\": \"Get a signing link for a document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"document_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"document_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"create_agent\",\n \"description\": \"Create a new agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"system_prompt\": {\n \"type\": \"string\"\n },\n \"model\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"system_prompt\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"send_agent_message\",\n \"description\": \"Send a message to an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"body\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\",\n \"body\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"update_agent\",\n \"description\": \"Update an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\"\n ]\n }\n }\n }\n];\n\n","function centsToUsd(cents: number): string {\n return \"$\" + (cents / 100).toLocaleString(\"en-US\", { minimumFractionDigits: 0, maximumFractionDigits: 0 });\n}\n\nexport function describeToolCall(name: string, args: Record<string, unknown>): string {\n const a = { ...args } as Record<string, unknown>;\n for (const k of [\"amount_cents\", \"principal_amount_cents\", \"total_amount_cents\", \"valuation_cap_cents\"]) {\n if (k in a) {\n try { a._amount = centsToUsd(Number(a[k])); } catch { a._amount = String(a[k]); }\n }\n }\n a._amount ??= \"?\";\n a.institution_name ??= \"Mercury\";\n a.payment_method ??= \"ach\";\n\n const fmts: Record<string, string> = {\n form_entity: 'Form a new {entity_type} named \"{entity_name}\" in {jurisdiction}',\n convert_entity: \"Convert entity to {new_entity_type}\",\n dissolve_entity: \"Dissolve entity — {dissolution_reason}\",\n issue_equity: \"Issue {shares} {grant_type} shares to {recipient_name}\",\n transfer_shares: \"Transfer {shares} shares to {to_recipient_name}\",\n issue_safe: \"Issue SAFE note to {investor_name} for {_amount}\",\n calculate_distribution: \"Calculate {distribution_type} distribution of {_amount}\",\n create_invoice: \"Create invoice for {customer_name} — {_amount}\",\n run_payroll: \"Run payroll for {pay_period_start} to {pay_period_end}\",\n submit_payment: \"Submit {_amount} payment to {recipient} via {payment_method}\",\n open_bank_account: \"Open bank account at {institution_name}\",\n reconcile_ledger: \"Reconcile ledger from {start_date} to {end_date}\",\n generate_contract: \"Generate {template_type} contract for {counterparty_name}\",\n file_tax_document: \"File {document_type} for tax year {tax_year}\",\n track_deadline: \"Track {deadline_type} deadline — {description}\",\n classify_contractor: \"Classify contractor {contractor_name} in {state}\",\n convene_meeting: \"Convene {meeting_type} meeting\",\n cast_vote: \"Cast {vote} vote\",\n schedule_meeting: \"Schedule {meeting_type} meeting: {title}\",\n update_checklist: \"Update workspace checklist\",\n create_agent: 'Create agent \"{name}\"',\n send_agent_message: \"Send message to agent\",\n update_agent: \"Update agent configuration\",\n add_agent_skill: 'Add skill \"{skill_name}\" to agent',\n };\n\n const fmt = fmts[name];\n if (fmt) {\n try {\n return fmt.replace(/\\{(\\w+)\\}/g, (_, k: string) => String(a[k] ?? \"?\"));\n } catch { /* fall through */ }\n }\n return name.replace(/_/g, \" \");\n}\n","/**\n * System prompt base and config formatter.\n */\n\nexport const SYSTEM_PROMPT_BASE = `You are a corporate governance assistant for TheCorporation, an agentic corporate governance platform.\n\n## Context\n{context}\n\n## Capabilities\nYou can perform the full range of corporate operations:\n\n**Read operations:**\n- View workspace status, entities, cap tables, documents\n- List SAFE notes, equity grants, agents\n- Check deadlines and compliance status\n\n**Write operations:**\n- Form new LLCs and corporations in any US jurisdiction\n- Issue equity (common, preferred, options, units)\n- Issue SAFE notes to investors\n- Transfer shares between holders\n- Convert entities (LLC <> Corporation)\n- Create invoices, run payroll, submit payments\n- Open bank accounts, reconcile ledgers\n- Generate contracts (NDAs, employment offers, consulting agreements)\n- File tax documents (1099-NEC, K-1, 941, W-2, estimated tax)\n- Generate signing links for documents (human-only signing)\n- Track compliance deadlines\n- Classify contractor risk (employee vs 1099)\n- Convene governance meetings and cast votes\n- Dissolve entities with full wind-down workflow\n\n## Rules\n- All monetary values are in integer cents ($1,000 = 100000).\n- Be concise and helpful.\n- **You MUST confirm with the user before calling ANY write tool.** Describe what you are about to do and wait for explicit approval. Never execute tools speculatively or \"on behalf of\" the user without their go-ahead.\n- Don't ask for info available in platform config — use the correct values automatically.\n- If only one option exists for a field, use it without asking.\n- Don't make up data — only present what the tools return.\n- If a tool returns an error, explain it simply without exposing raw error details.\n- NEVER create an agent to answer a question you can answer yourself. You are the assistant — answer questions directly using your knowledge and the read tools.\n\n## Agent Rules\n- Agents are for **delegating recurring corporate operations tasks** that the user explicitly requests — e.g. \"process incoming invoices\", \"monitor compliance deadlines\", \"handle payroll every two weeks\".\n- Agents are NOT for research, answering questions, or one-off lookups. If the user asks a question, YOU answer it.\n- NEVER proactively suggest or create an agent unless the user specifically asks for one.\n- Agent tools require a paid plan.\n\n## Entity Formation Rules\n- When forming an entity, you MUST ask about all founding members and their ownership allocations BEFORE calling the form_entity tool.\n- For LLCs, ownership percentages must total 100%.\n\n## Document Signing Rules\n- You CANNOT sign documents on behalf of users. Signing is a human action.\n- Use \\`get_signing_link\\` to generate a signing URL for a document.\n- Present the signing link so users can open it and sign themselves.\n- NEVER attempt to sign, execute, or complete signature actions automatically.\n- The \\`get_signing_link\\` tool does NOT sign anything — it only returns a URL.\n\n## User Journey\nAfter completing any action, ALWAYS present the logical next step(s) as a\nnumbered list. The user should never wonder \"what now?\" — guide them forward.\n\nAfter entity formation:\n1. The \\`form_entity\\` response includes a \\`documents\\` array with document IDs. These documents are created immediately — they are NEVER \"still being generated\" or delayed.\n2. Immediately call \\`get_signing_link\\` for each document ID in the response to get signing URLs.\n3. Present the signing links to the user right away. Do NOT tell the user to \"check back later\" or that documents are \"being prepared\" — they already exist.\n4. Then: \"Documents signed! Next: apply for an EIN, open a bank account, or issue equity.\"\n\nAfter document generation:\n1. Present signing links immediately — don't wait for the user to ask.\n2. Use the document IDs from the tool response — do NOT call \\`list_documents\\` to re-fetch them.\n\nAfter signing:\n1. \"Documents are signed! Next: file for EIN, open a bank account, or add team members.\"\n\nAfter equity issuance:\n1. \"Equity issued! Next: generate the stock certificate for signing, or issue more grants.\"\n\nGeneral pattern:\n- Always end with 1-2 concrete next actions the user can take.\n- Phrase them as questions or suggestions: \"Would you like to [next step]?\"\n- If there are signing obligations, proactively generate and present the signing links.\n- Never just say \"done\" — always show what comes next.\n\nAfter major actions, use update_checklist to track progress. Use markdown checkbox\nformat (- [x] / - [ ]). Call get_checklist first to see current state, then\nupdate_checklist with checked-off items. This helps users see where they are.\n\n{extra_sections}`;\n\ninterface ConfigItem {\n value: string;\n label?: string;\n}\n\nexport function formatConfigSection(cfgData: Record<string, unknown>): string {\n const lines: string[] = [];\n\n const entityTypes = cfgData.entity_types as ConfigItem[] | undefined;\n if (entityTypes?.length) {\n const vals = entityTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Entity types: ${vals}`);\n }\n\n const jurisdictions = cfgData.jurisdictions as Record<string, ConfigItem[]> | undefined;\n if (jurisdictions) {\n for (const [etype, jurs] of Object.entries(jurisdictions)) {\n const jurVals = jurs.map((j) => `${j.label} (${j.value})`).join(\", \");\n lines.push(`Jurisdictions for ${etype}: ${jurVals}`);\n }\n }\n\n const invTypes = cfgData.investor_types as ConfigItem[] | undefined;\n if (invTypes?.length) {\n const vals = invTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Investor types: ${vals}`);\n }\n\n const workers = cfgData.worker_classifications as ConfigItem[] | undefined;\n if (workers?.length) {\n const vals = workers.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Worker classifications: ${vals}`);\n }\n\n const vesting = cfgData.vesting_schedules as ConfigItem[] | undefined;\n if (vesting?.length) {\n const vals = vesting.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Vesting schedules: ${vals}`);\n }\n\n const safeTypes = cfgData.safe_types as ConfigItem[] | undefined;\n if (safeTypes?.length) {\n const vals = safeTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`SAFE types: ${vals}`);\n }\n\n const compTypes = cfgData.compensation_types as ConfigItem[] | undefined;\n if (compTypes?.length) {\n const vals = compTypes.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Compensation types: ${vals}`);\n }\n\n const bodyTypes = cfgData.governance_body_types as ConfigItem[] | undefined;\n if (bodyTypes?.length) {\n const vals = bodyTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Governance body types: ${vals}`);\n }\n\n const quorum = cfgData.quorum_rules as ConfigItem[] | undefined;\n if (quorum?.length) {\n const vals = quorum.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Quorum rules: ${vals}`);\n }\n\n const voting = cfgData.voting_methods as ConfigItem[] | undefined;\n if (voting?.length) {\n const vals = voting.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Voting methods: ${vals}`);\n }\n\n if (!lines.length) return \"\";\n\n const configYaml = lines.map((line) => `- ${line}`).join(\"\\n\");\n return (\n \"\\n## Platform Configuration\\n\" +\n \"The following are the ONLY valid values supported by this platform. \" +\n \"Do not offer or accept values outside these lists.\\n\\n\" +\n configYaml + \"\\n\"\n );\n}\n","/**\n * Tool registry and classification helpers.\n * Re-exports from existing modules + builds a registry from generated defs.\n */\n\nimport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\n\nexport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\nexport { isWriteTool } from \"./tools.js\";\nexport { describeToolCall } from \"./tool-descriptions.js\";\n\ninterface ToolFunction {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n}\n\ninterface ToolDef {\n type: string;\n function: ToolFunction;\n}\n\n/** Registry: tool name → function metadata (description + parameters). */\nexport const TOOL_REGISTRY: Record<string, ToolFunction> = {};\n\nfor (const td of GENERATED_TOOL_DEFINITIONS as unknown as ToolDef[]) {\n TOOL_REGISTRY[td.function.name] = td.function;\n}\n\nexport const READ_ONLY_TOOLS = new Set([\n \"get_workspace_status\", \"list_entities\", \"get_cap_table\", \"list_documents\",\n \"list_safe_notes\", \"list_agents\", \"get_checklist\", \"get_document_link\",\n \"get_signing_link\", \"list_obligations\", \"get_billing_status\",\n]);\n"],"mappings":";AAEO,IAAM,sBAAN,cAAkC,M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","names":["READ_ONLY_TOOLS"]}
|
|
1
|
+
{"version":3,"sources":["../src/api-client.ts","../src/tools.ts","../src/tool-defs.generated.ts","../src/tool-descriptions.ts","../src/system-prompt.ts","../src/definitions.ts"],"sourcesContent":["import type {\n AcceptEquityRoundRequest,\n ApiRecord,\n ApplyEquityRoundTermsRequest,\n BoardApproveEquityRoundRequest,\n CreateEquityRoundRequest,\n CreateExecutionIntentRequest,\n EquityRoundResponse,\n ExecuteRoundConversionRequest,\n IntentResponse,\n PreviewRoundConversionRequest,\n} from \"./types.js\";\n\nexport class SessionExpiredError extends Error {\n constructor() {\n super(\"Your API key is no longer valid. Run 'corp setup' to re-authenticate.\");\n this.name = \"SessionExpiredError\";\n }\n}\n\nexport async function provisionWorkspace(\n apiUrl: string,\n name?: string\n): Promise<ApiRecord> {\n const url = `${apiUrl.replace(/\\/+$/, \"\")}/v1/workspaces/provision`;\n const body: Record<string, string> = {};\n if (name) body.name = name;\n const resp = await fetch(url, {\n method: \"POST\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(body),\n });\n if (!resp.ok) throw new Error(`Provision failed: ${resp.status} ${resp.statusText}`);\n return resp.json() as Promise<ApiRecord>;\n}\n\nexport class CorpAPIClient {\n readonly apiUrl: string;\n readonly apiKey: string;\n readonly workspaceId: string;\n\n constructor(apiUrl: string, apiKey: string, workspaceId: string) {\n this.apiUrl = apiUrl.replace(/\\/+$/, \"\");\n this.apiKey = apiKey;\n this.workspaceId = workspaceId;\n }\n\n private headers(): Record<string, string> {\n return {\n Authorization: `Bearer ${this.apiKey}`,\n \"Content-Type\": \"application/json\",\n Accept: \"application/json\",\n };\n }\n\n private async request(method: string, path: string, body?: unknown, params?: Record<string, string>): Promise<Response> {\n let url = `${this.apiUrl}${path}`;\n if (params) {\n const qs = new URLSearchParams(params).toString();\n if (qs) url += `?${qs}`;\n }\n const opts: RequestInit = { method, headers: this.headers() };\n if (body !== undefined) opts.body = JSON.stringify(body);\n return fetch(url, opts);\n }\n\n private async get(path: string, params?: Record<string, string>): Promise<unknown> {\n const resp = await this.request(\"GET\", path, undefined, params);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async post(path: string, body?: unknown): Promise<unknown> {\n const resp = await this.request(\"POST\", path, body);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async postWithParams(path: string, body: unknown, params: Record<string, string>): Promise<unknown> {\n const resp = await this.request(\"POST\", path, body, params);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async patch(path: string, body?: unknown): Promise<unknown> {\n const resp = await this.request(\"PATCH\", path, body);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json();\n }\n\n private async del(path: string): Promise<void> {\n const resp = await this.request(\"DELETE\", path);\n if (resp.status === 401) throw new SessionExpiredError();\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n }\n\n // --- Workspace ---\n getStatus() { return this.get(`/v1/workspaces/${this.workspaceId}/status`) as Promise<ApiRecord>; }\n\n // --- Obligations ---\n getObligations(tier?: string) {\n const params: Record<string, string> = {};\n if (tier) params.tier = tier;\n return this.get(\"/v1/obligations/summary\", params) as Promise<ApiRecord>;\n }\n\n // --- Digests ---\n listDigests() { return this.get(\"/v1/digests\") as Promise<ApiRecord[]>; }\n triggerDigest() { return this.post(\"/v1/digests/trigger\") as Promise<ApiRecord>; }\n getDigest(key: string) { return this.get(`/v1/digests/${key}`) as Promise<ApiRecord>; }\n\n // --- Entities ---\n listEntities() { return this.get(`/v1/workspaces/${this.workspaceId}/entities`) as Promise<ApiRecord[]>; }\n\n // --- Contacts ---\n listContacts() { return this.get(`/v1/workspaces/${this.workspaceId}/contacts`) as Promise<ApiRecord[]>; }\n getContact(id: string) { return this.get(`/v1/contacts/${id}`) as Promise<ApiRecord>; }\n getContactProfile(id: string) { return this.get(`/v1/contacts/${id}/profile`) as Promise<ApiRecord>; }\n createContact(data: ApiRecord) { return this.post(`/v1/workspaces/${this.workspaceId}/contacts`, data) as Promise<ApiRecord>; }\n updateContact(id: string, data: ApiRecord) { return this.patch(`/v1/contacts/${id}`, data) as Promise<ApiRecord>; }\n getNotificationPrefs(contactId: string) { return this.get(`/v1/contacts/${contactId}/notification-prefs`) as Promise<ApiRecord>; }\n updateNotificationPrefs(contactId: string, prefs: ApiRecord) { return this.patch(`/v1/contacts/${contactId}/notification-prefs`, prefs) as Promise<ApiRecord>; }\n\n // --- Cap Table ---\n getCapTable(entityId: string) { return this.get(`/v1/entities/${entityId}/cap-table`) as Promise<ApiRecord>; }\n getSafeNotes(entityId: string) { return this.get(`/v1/entities/${entityId}/safe-notes`) as Promise<ApiRecord[]>; }\n getShareTransfers(entityId: string) { return this.get(`/v1/entities/${entityId}/share-transfers`) as Promise<ApiRecord[]>; }\n getValuations(entityId: string) { return this.get(`/v1/entities/${entityId}/valuations`) as Promise<ApiRecord[]>; }\n getCurrent409a(entityId: string) { return this.get(`/v1/entities/${entityId}/current-409a`) as Promise<ApiRecord>; }\n issueEquity(data: ApiRecord) { return this.post(\"/v1/equity/grants\", data) as Promise<ApiRecord>; }\n issueSafe(data: ApiRecord) { return this.post(\"/v1/safe-notes\", data) as Promise<ApiRecord>; }\n transferShares(data: ApiRecord) { return this.post(\"/v1/share-transfers\", data) as Promise<ApiRecord>; }\n calculateDistribution(data: ApiRecord) { return this.post(\"/v1/distributions\", data) as Promise<ApiRecord>; }\n\n // --- Equity rounds (v1) ---\n createEquityRound(data: CreateEquityRoundRequest) {\n return this.post(\"/v1/equity/rounds\", data) as Promise<EquityRoundResponse>;\n }\n applyEquityRoundTerms(roundId: string, data: ApplyEquityRoundTermsRequest) {\n return this.post(`/v1/equity/rounds/${roundId}/apply-terms`, data) as Promise<ApiRecord>;\n }\n boardApproveEquityRound(roundId: string, data: BoardApproveEquityRoundRequest) {\n return this.post(`/v1/equity/rounds/${roundId}/board-approve`, data) as Promise<EquityRoundResponse>;\n }\n acceptEquityRound(roundId: string, data: AcceptEquityRoundRequest) {\n return this.post(`/v1/equity/rounds/${roundId}/accept`, data) as Promise<EquityRoundResponse>;\n }\n previewRoundConversion(data: PreviewRoundConversionRequest) {\n return this.post(\"/v1/equity/conversions/preview\", data) as Promise<ApiRecord>;\n }\n executeRoundConversion(data: ExecuteRoundConversionRequest) {\n return this.post(\"/v1/equity/conversions/execute\", data) as Promise<ApiRecord>;\n }\n\n // --- Intent lifecycle helpers ---\n createExecutionIntent(data: CreateExecutionIntentRequest) {\n return this.post(\"/v1/execution/intents\", data) as Promise<IntentResponse>;\n }\n evaluateIntent(intentId: string, entityId: string) {\n return this.postWithParams(`/v1/intents/${intentId}/evaluate`, {}, { entity_id: entityId }) as Promise<ApiRecord>;\n }\n authorizeIntent(intentId: string, entityId: string) {\n return this.postWithParams(`/v1/intents/${intentId}/authorize`, {}, { entity_id: entityId }) as Promise<ApiRecord>;\n }\n\n // --- Governance ---\n listGovernanceBodies(entityId: string) { return this.get(`/v1/entities/${entityId}/governance-bodies`) as Promise<ApiRecord[]>; }\n getGovernanceSeats(bodyId: string) { return this.get(`/v1/governance-bodies/${bodyId}/seats`) as Promise<ApiRecord[]>; }\n listMeetings(bodyId: string) { return this.get(`/v1/governance-bodies/${bodyId}/meetings`) as Promise<ApiRecord[]>; }\n getMeetingResolutions(meetingId: string) { return this.get(`/v1/meetings/${meetingId}/resolutions`) as Promise<ApiRecord[]>; }\n scheduleMeeting(data: ApiRecord) { return this.post(\"/v1/meetings\", data) as Promise<ApiRecord>; }\n conveneMeeting(meetingId: string, entityId: string, data: ApiRecord) {\n return this.postWithParams(`/v1/meetings/${meetingId}/convene`, data, { entity_id: entityId }) as Promise<ApiRecord>;\n }\n castVote(entityId: string, meetingId: string, itemId: string, data: ApiRecord) {\n return this.postWithParams(`/v1/meetings/${meetingId}/agenda-items/${itemId}/vote`, data, { entity_id: entityId }) as Promise<ApiRecord>;\n }\n\n // --- Documents ---\n getEntityDocuments(entityId: string) { return this.get(`/v1/formations/${entityId}/documents`) as Promise<ApiRecord[]>; }\n generateContract(data: ApiRecord) { return this.post(\"/v1/contracts\", data) as Promise<ApiRecord>; }\n getSigningLink(documentId: string): ApiRecord {\n return {\n document_id: documentId,\n signing_url: `https://humans.thecorporation.ai/sign/${documentId}`,\n };\n }\n\n // --- Finance ---\n createInvoice(data: ApiRecord) { return this.post(\"/v1/treasury/invoices\", data) as Promise<ApiRecord>; }\n runPayroll(data: ApiRecord) { return this.post(\"/v1/payroll/runs\", data) as Promise<ApiRecord>; }\n submitPayment(data: ApiRecord) { return this.post(\"/v1/payments\", data) as Promise<ApiRecord>; }\n openBankAccount(data: ApiRecord) { return this.post(\"/v1/bank-accounts\", data) as Promise<ApiRecord>; }\n classifyContractor(data: ApiRecord) { return this.post(\"/v1/contractors/classify\", data) as Promise<ApiRecord>; }\n reconcileLedger(data: ApiRecord) { return this.post(\"/v1/ledger/reconcile\", data) as Promise<ApiRecord>; }\n\n // --- Tax ---\n fileTaxDocument(data: ApiRecord) { return this.post(\"/v1/tax/filings\", data) as Promise<ApiRecord>; }\n trackDeadline(data: ApiRecord) { return this.post(\"/v1/deadlines\", data) as Promise<ApiRecord>; }\n\n // --- Billing ---\n getBillingStatus() { return this.get(\"/v1/billing/status\", { workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n getBillingPlans() {\n return (this.get(\"/v1/billing/plans\") as Promise<unknown>).then((data) => {\n if (typeof data === \"object\" && data !== null && \"plans\" in data) {\n return (data as { plans: ApiRecord[] }).plans;\n }\n return data as ApiRecord[];\n });\n }\n createBillingPortal() { return this.post(\"/v1/billing/portal\", { workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n createBillingCheckout(tier: string, entityId?: string) {\n const body: ApiRecord = { tier };\n if (entityId) body.entity_id = entityId;\n return this.post(\"/v1/billing/checkout\", body) as Promise<ApiRecord>;\n }\n\n // --- Formations ---\n getFormation(id: string) { return this.get(`/v1/formations/${id}`) as Promise<ApiRecord>; }\n getFormationDocuments(id: string) { return this.get(`/v1/formations/${id}/documents`) as Promise<ApiRecord[]>; }\n createFormation(data: ApiRecord) { return this.post(\"/v1/formations\", data) as Promise<ApiRecord>; }\n\n // --- Human obligations ---\n getHumanObligations() { return this.get(`/v1/workspaces/${this.workspaceId}/human-obligations`) as Promise<ApiRecord[]>; }\n getSignerToken(obligationId: string) { return this.post(`/v1/human-obligations/${obligationId}/signer-token`) as Promise<ApiRecord>; }\n\n // --- Demo ---\n seedDemo(name: string) { return this.post(\"/v1/demo/seed\", { name, workspace_id: this.workspaceId }) as Promise<ApiRecord>; }\n\n // --- Entities writes ---\n convertEntity(entityId: string, data: ApiRecord) { return this.post(`/v1/entities/${entityId}/convert`, data) as Promise<ApiRecord>; }\n dissolveEntity(entityId: string, data: ApiRecord) { return this.post(`/v1/entities/${entityId}/dissolve`, data) as Promise<ApiRecord>; }\n\n // --- Agents ---\n listAgents() { return this.get(\"/v1/agents\") as Promise<ApiRecord[]>; }\n getAgent(id: string) { return this.get(`/v1/agents/${id}`) as Promise<ApiRecord>; }\n createAgent(data: ApiRecord) { return this.post(\"/v1/agents\", data) as Promise<ApiRecord>; }\n updateAgent(id: string, data: ApiRecord) { return this.patch(`/v1/agents/${id}`, data) as Promise<ApiRecord>; }\n deleteAgent(id: string) { return this.del(`/v1/agents/${id}`); }\n sendAgentMessage(id: string, body: string) { return this.post(`/v1/agents/${id}/messages`, { body }) as Promise<ApiRecord>; }\n listAgentExecutions(id: string) { return this.get(`/v1/agents/${id}/executions`) as Promise<ApiRecord[]>; }\n getAgentUsage(id: string) { return this.get(`/v1/agents/${id}/usage`) as Promise<ApiRecord>; }\n addAgentSkill(id: string, data: ApiRecord) { return this.post(`/v1/agents/${id}/skills`, data) as Promise<ApiRecord>; }\n listSupportedModels() { return this.get(\"/v1/models\") as Promise<ApiRecord[]>; }\n\n // --- Approvals ---\n listPendingApprovals() { return this.get(\"/v1/approvals/pending\") as Promise<ApiRecord[]>; }\n respondApproval(id: string, decision: string, message = \"\") { return this.patch(`/v1/approvals/${id}`, { decision, message }) as Promise<ApiRecord>; }\n\n // --- API Keys ---\n listApiKeys() { return this.get(\"/v1/api-keys\", { workspace_id: this.workspaceId }) as Promise<ApiRecord[]>; }\n\n // --- Obligations ---\n assignObligation(obligationId: string, contactId: string) {\n return this.patch(`/v1/obligations/${obligationId}/assign`, { contact_id: contactId }) as Promise<ApiRecord>;\n }\n\n // --- Config ---\n getConfig() { return this.get(\"/v1/config\") as Promise<ApiRecord>; }\n\n // --- Link/Claim ---\n async createLink(): Promise<ApiRecord> {\n const resp = await this.request(\"POST\", \"/v1/workspaces/link\");\n if (!resp.ok) throw new Error(`${resp.status} ${resp.statusText}`);\n return resp.json() as Promise<ApiRecord>;\n }\n}\n","import type { CorpAPIClient } from \"./api-client.js\";\nimport { readFileSync, writeFileSync, mkdirSync, existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\n\nexport interface ToolContext {\n dataDir: string;\n onEntityFormed?: (entityId: string) => void;\n}\n\ntype ToolHandler = (args: Record<string, unknown>, client: CorpAPIClient, ctx: ToolContext) => Promise<unknown>;\n\nfunction requiredString(args: Record<string, unknown>, key: string): string {\n const value = args[key];\n if (typeof value !== \"string\" || value.trim().length === 0) {\n throw new Error(`Missing required field: ${key}`);\n }\n return value;\n}\n\nconst TOOL_HANDLERS: Record<string, ToolHandler> = {\n get_workspace_status: async (_args, client) => client.getStatus(),\n list_obligations: async (args, client) => client.getObligations(args.tier as string | undefined),\n list_entities: async (_args, client) => client.listEntities(),\n get_cap_table: async (args, client) => client.getCapTable(args.entity_id as string),\n list_documents: async (args, client) => client.getEntityDocuments(args.entity_id as string),\n list_safe_notes: async (args, client) => client.getSafeNotes(args.entity_id as string),\n list_agents: async (_args, client) => client.listAgents(),\n get_billing_status: async (_args, client) => {\n const [status, plans] = await Promise.all([client.getBillingStatus(), client.getBillingPlans()]);\n return { status, plans };\n },\n\n form_entity: async (args, client, ctx) => {\n const entityType = args.entity_type as string;\n let jurisdiction = (args.jurisdiction as string) || \"\";\n if (!jurisdiction || jurisdiction.length === 2) {\n jurisdiction = entityType === \"llc\" ? \"US-WY\" : \"US-DE\";\n }\n const members = (args.members ?? []) as Record<string, unknown>[];\n if (!members.length) return { error: \"Members are required.\" };\n // Normalize: ensure investor_type defaults, convert ownership_pct > 1 to 0-1 scale\n for (const m of members) {\n if (!m.investor_type) m.investor_type = \"natural_person\";\n if (typeof m.ownership_pct === \"number\" && (m.ownership_pct as number) > 1) {\n m.ownership_pct = (m.ownership_pct as number) / 100;\n }\n }\n const result = await client.createFormation({\n entity_type: entityType, legal_name: args.entity_name, jurisdiction,\n members, workspace_id: client.workspaceId,\n });\n const entityId = result.entity_id as string;\n if (entityId && ctx.onEntityFormed) {\n ctx.onEntityFormed(entityId);\n }\n return result;\n },\n\n issue_equity: async (args, client) => client.issueEquity(args),\n issue_safe: async (args, client) => client.issueSafe(args),\n create_invoice: async (args, client) => {\n if (!(\"amount_cents\" in args) && Array.isArray(args.line_items)) {\n args.amount_cents = (args.line_items as Record<string, number>[])\n .reduce((sum, item) => sum + (item.amount_cents ?? 0), 0);\n }\n if (!(\"amount_cents\" in args)) args.amount_cents = 0;\n if (!(\"description\" in args) || typeof args.description !== \"string\" || args.description.trim().length === 0) {\n args.description = \"Invoice\";\n }\n return client.createInvoice(args);\n },\n run_payroll: async (args, client) => client.runPayroll(args),\n submit_payment: async (args, client) => client.submitPayment(args),\n open_bank_account: async (args, client) => {\n const body: Record<string, unknown> = { entity_id: args.entity_id };\n if (args.institution_name) body.institution_name = args.institution_name;\n return client.openBankAccount(body);\n },\n generate_contract: async (args, client) => client.generateContract(args),\n file_tax_document: async (args, client) => client.fileTaxDocument(args),\n\n get_signer_link: async (args, client) => {\n const result = await client.getSignerToken(args.obligation_id as string);\n const token = result.token as string ?? \"\";\n const obligationId = args.obligation_id as string;\n const humansBase = client.apiUrl.replace(\"://api.\", \"://humans.\");\n return {\n signer_url: `${humansBase}/human/${obligationId}?token=${token}`,\n obligation_id: obligationId,\n expires_in_seconds: result.expires_in ?? 900,\n message: \"Share this link with the signer. Link expires in 15 minutes.\",\n };\n },\n\n schedule_meeting: async (args, client) => {\n const body: Record<string, unknown> = {\n entity_id: requiredString(args, \"entity_id\"),\n body_id: requiredString(args, \"body_id\"),\n meeting_type: requiredString(args, \"meeting_type\"),\n title: requiredString(args, \"title\"),\n };\n const scheduledDate = args.scheduled_date ?? args.proposed_date;\n if (typeof scheduledDate === \"string\" && scheduledDate.trim().length > 0) {\n body.scheduled_date = scheduledDate;\n }\n const agendaItems = args.agenda_item_titles ?? args.agenda_items;\n if (Array.isArray(agendaItems)) body.agenda_item_titles = agendaItems;\n return client.scheduleMeeting(body);\n },\n\n cast_vote: async (args, client) =>\n client.castVote(\n requiredString(args, \"entity_id\"),\n requiredString(args, \"meeting_id\"),\n requiredString(args, \"agenda_item_id\"),\n {\n voter_id: requiredString(args, \"voter_id\"),\n vote_value: requiredString(args, \"vote_value\"),\n },\n ),\n\n update_checklist: async (args, _client, ctx) => {\n const path = join(ctx.dataDir, \"checklist.md\");\n mkdirSync(ctx.dataDir, { recursive: true });\n writeFileSync(path, args.checklist as string);\n return { status: \"updated\", checklist: args.checklist };\n },\n\n get_checklist: async (_args, _client, ctx) => {\n const path = join(ctx.dataDir, \"checklist.md\");\n if (existsSync(path)) return { checklist: readFileSync(path, \"utf-8\") };\n return { checklist: null, message: \"No checklist yet.\" };\n },\n\n get_document_link: async (args, client) => {\n const docId = args.document_id as string;\n try {\n const resp = await fetch(`${client.apiUrl}/v1/documents/${docId}/request-copy`, {\n method: \"POST\",\n headers: { Authorization: `Bearer ${client.apiKey}`, \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ email: \"owner@workspace\" }),\n });\n if (!resp.ok) throw new Error(\"request-copy failed\");\n const result = await resp.json() as Record<string, string>;\n let downloadUrl = result.download_url ?? \"\";\n if (downloadUrl.startsWith(\"/\")) downloadUrl = client.apiUrl + downloadUrl;\n return { document_id: docId, download_url: downloadUrl, expires_in: \"24 hours\" };\n } catch {\n return {\n document_id: docId,\n download_url: `${client.apiUrl}/v1/documents/${docId}/pdf`,\n note: \"Use your API key to authenticate the download.\",\n };\n }\n },\n\n get_signing_link: async (args, client) => client.getSigningLink(args.document_id as string),\n convert_entity: async (args, client) => client.convertEntity(args.entity_id as string, args),\n dissolve_entity: async (args, client) => client.dissolveEntity(args.entity_id as string, args),\n transfer_shares: async (args, client) => client.transferShares(args),\n calculate_distribution: async (args, client) => client.calculateDistribution(args),\n classify_contractor: async (args, client) => client.classifyContractor(args),\n reconcile_ledger: async (args, client) => client.reconcileLedger(args),\n track_deadline: async (args, client) => client.trackDeadline(args),\n convene_meeting: async (args, client) => client.conveneMeeting(\n requiredString(args, \"meeting_id\"),\n requiredString(args, \"entity_id\"),\n {\n present_seat_ids: Array.isArray(args.present_seat_ids) ? args.present_seat_ids : [],\n },\n ),\n\n create_agent: async (args, client) => client.createAgent(args),\n send_agent_message: async (args, client) => client.sendAgentMessage(args.agent_id as string, args.body as string),\n update_agent: async (args, client) => client.updateAgent(args.agent_id as string, args),\n add_agent_skill: async (args, client) => client.addAgentSkill(args.agent_id as string, args),\n};\n\n// Tool definitions are generated from the backend OpenAPI spec.\n// Regenerate: make generate-tools\nexport const TOOL_DEFINITIONS: Record<string, unknown>[] = GENERATED_TOOL_DEFINITIONS;\n\nconst READ_ONLY_TOOLS = new Set([\n \"get_workspace_status\", \"list_entities\", \"get_cap_table\", \"list_documents\",\n \"list_safe_notes\", \"list_agents\", \"get_checklist\",\n \"get_signing_link\", \"list_obligations\", \"get_billing_status\",\n]);\n\nexport function isWriteTool(name: string): boolean {\n return !READ_ONLY_TOOLS.has(name);\n}\n\nexport async function executeTool(\n name: string,\n args: Record<string, unknown>,\n client: CorpAPIClient,\n ctx: ToolContext,\n): Promise<string> {\n const handler = TOOL_HANDLERS[name];\n if (!handler) return JSON.stringify({ error: `Unknown tool: ${name}` });\n try {\n const result = await handler(args, client, ctx);\n return JSON.stringify(result, null, 0);\n } catch (err) {\n return JSON.stringify({ error: String(err) });\n }\n}\n","// AUTO-GENERATED from backend OpenAPI spec — do not edit by hand.\n// Regenerate: make generate-tools\n\nexport const GENERATED_TOOL_DEFINITIONS: Record<string, unknown>[] = [\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_workspace_status\",\n \"description\": \"Get workspace status summary\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_entities\",\n \"description\": \"List all entities in the workspace\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_cap_table\",\n \"description\": \"Get cap table for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_documents\",\n \"description\": \"List documents for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_safe_notes\",\n \"description\": \"List SAFE notes for an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_agents\",\n \"description\": \"List all agents in the workspace\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"list_obligations\",\n \"description\": \"List obligations with urgency tiers\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"tier\": {\n \"type\": \"string\"\n }\n },\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_billing_status\",\n \"description\": \"Get billing status and plans\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"form_entity\",\n \"description\": \"Form a new business entity (LLC or corporation)\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"llc\",\n \"corporation\"\n ]\n },\n \"entity_name\": {\n \"type\": \"string\"\n },\n \"jurisdiction\": {\n \"type\": \"string\"\n },\n \"members\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"investor_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"natural_person\",\n \"agent\",\n \"entity\"\n ]\n },\n \"email\": {\n \"type\": \"string\"\n },\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"ownership_pct\": {\n \"type\": \"number\"\n },\n \"membership_units\": {\n \"type\": \"integer\"\n },\n \"share_count\": {\n \"type\": \"integer\"\n },\n \"share_class\": {\n \"type\": \"string\"\n },\n \"role\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"investor_type\"\n ]\n }\n }\n },\n \"required\": [\n \"entity_type\",\n \"entity_name\",\n \"jurisdiction\",\n \"members\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"issue_equity\",\n \"description\": \"Issue an equity grant\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"grant_type\": {\n \"type\": \"string\"\n },\n \"shares\": {\n \"type\": \"integer\"\n },\n \"recipient_name\": {\n \"type\": \"string\"\n },\n \"vesting_schedule\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"grant_type\",\n \"shares\",\n \"recipient_name\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"issue_safe\",\n \"description\": \"Issue a SAFE note\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"investor_name\": {\n \"type\": \"string\"\n },\n \"principal_amount_cents\": {\n \"type\": \"integer\"\n },\n \"safe_type\": {\n \"type\": \"string\"\n },\n \"valuation_cap_cents\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"investor_name\",\n \"principal_amount_cents\",\n \"safe_type\",\n \"valuation_cap_cents\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"transfer_shares\",\n \"description\": \"Transfer shares between holders\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"share_class_id\": {\n \"type\": \"string\"\n },\n \"from_holder\": {\n \"type\": \"string\"\n },\n \"to_holder\": {\n \"type\": \"string\"\n },\n \"transfer_type\": {\n \"type\": \"string\"\n },\n \"shares\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"from_holder\",\n \"to_holder\",\n \"shares\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"calculate_distribution\",\n \"description\": \"Calculate a distribution\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"total_amount_cents\": {\n \"type\": \"integer\"\n },\n \"distribution_type\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"total_amount_cents\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"create_invoice\",\n \"description\": \"Create an invoice\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"customer_name\": {\n \"type\": \"string\"\n },\n \"amount_cents\": {\n \"type\": \"integer\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"due_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"customer_name\",\n \"amount_cents\",\n \"description\",\n \"due_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"run_payroll\",\n \"description\": \"Run payroll\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"pay_period_start\": {\n \"type\": \"string\"\n },\n \"pay_period_end\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"pay_period_start\",\n \"pay_period_end\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"submit_payment\",\n \"description\": \"Submit a payment\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"amount_cents\": {\n \"type\": \"integer\"\n },\n \"recipient\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"amount_cents\",\n \"recipient\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"open_bank_account\",\n \"description\": \"Open a business bank account\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"institution_name\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"generate_contract\",\n \"description\": \"Generate a contract from a template\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"template_type\": {\n \"type\": \"string\"\n },\n \"parameters\": {\n \"type\": \"object\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"template_type\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"file_tax_document\",\n \"description\": \"File a tax document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"document_type\": {\n \"type\": \"string\"\n },\n \"tax_year\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"document_type\",\n \"tax_year\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"track_deadline\",\n \"description\": \"Track a compliance deadline\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"deadline_type\": {\n \"type\": \"string\"\n },\n \"due_date\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"recurrence\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"deadline_type\",\n \"due_date\",\n \"description\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"classify_contractor\",\n \"description\": \"Classify contractor risk\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"contractor_name\": {\n \"type\": \"string\"\n },\n \"state\": {\n \"type\": \"string\"\n },\n \"hours_per_week\": {\n \"type\": \"integer\"\n },\n \"exclusive_client\": {\n \"type\": \"boolean\"\n },\n \"duration_months\": {\n \"type\": \"integer\"\n },\n \"provides_tools\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"contractor_name\",\n \"state\",\n \"hours_per_week\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"reconcile_ledger\",\n \"description\": \"Reconcile an entity's ledger\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"start_date\": {\n \"type\": \"string\"\n },\n \"end_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"start_date\",\n \"end_date\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convene_meeting\",\n \"description\": \"Convene a governance meeting\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"meeting_id\": {\n \"type\": \"string\"\n },\n \"present_seat_ids\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"entity_id\",\n \"meeting_id\",\n \"present_seat_ids\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"cast_vote\",\n \"description\": \"Cast a vote on an agenda item\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"meeting_id\": {\n \"type\": \"string\"\n },\n \"agenda_item_id\": {\n \"type\": \"string\"\n },\n \"voter_id\": {\n \"type\": \"string\"\n },\n \"vote_value\": {\n \"type\": \"string\",\n \"description\": \"for, against, abstain, or recusal\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"meeting_id\",\n \"agenda_item_id\",\n \"voter_id\",\n \"vote_value\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"schedule_meeting\",\n \"description\": \"Schedule a board or member meeting\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"body_id\": {\n \"type\": \"string\"\n },\n \"meeting_type\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\"\n },\n \"scheduled_date\": {\n \"type\": \"string\"\n },\n \"agenda_item_titles\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"entity_id\",\n \"body_id\",\n \"meeting_type\",\n \"title\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_signer_link\",\n \"description\": \"Generate a signing link for a human obligation\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"obligation_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"obligation_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_document_link\",\n \"description\": \"Get a download link for a document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"document_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"document_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"convert_entity\",\n \"description\": \"Convert entity type\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"new_entity_type\": {\n \"type\": \"string\"\n },\n \"new_jurisdiction\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"new_entity_type\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"dissolve_entity\",\n \"description\": \"Dissolve an entity\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"entity_id\": {\n \"type\": \"string\"\n },\n \"reason\": {\n \"type\": \"string\"\n },\n \"effective_date\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"entity_id\",\n \"reason\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"add_agent_skill\",\n \"description\": \"Add a skill to an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"skill_name\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"instructions\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\",\n \"skill_name\",\n \"description\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_checklist\",\n \"description\": \"Get the user's onboarding checklist\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {},\n \"required\": []\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"update_checklist\",\n \"description\": \"Update the user's onboarding checklist\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"checklist\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"checklist\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"get_signing_link\",\n \"description\": \"Get a signing link for a document\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"document_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"document_id\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"create_agent\",\n \"description\": \"Create a new agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"system_prompt\": {\n \"type\": \"string\"\n },\n \"model\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"name\",\n \"system_prompt\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"send_agent_message\",\n \"description\": \"Send a message to an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"body\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\",\n \"body\"\n ]\n }\n }\n },\n {\n \"type\": \"function\",\n \"function\": {\n \"name\": \"update_agent\",\n \"description\": \"Update an agent\",\n \"parameters\": {\n \"type\": \"object\",\n \"properties\": {\n \"agent_id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"agent_id\"\n ]\n }\n }\n }\n];\n","function centsToUsd(cents: number): string {\n return \"$\" + (cents / 100).toLocaleString(\"en-US\", { minimumFractionDigits: 0, maximumFractionDigits: 0 });\n}\n\nexport function describeToolCall(name: string, args: Record<string, unknown>): string {\n const a = { ...args } as Record<string, unknown>;\n for (const k of [\"amount_cents\", \"principal_amount_cents\", \"total_amount_cents\", \"valuation_cap_cents\"]) {\n if (k in a) {\n try { a._amount = centsToUsd(Number(a[k])); } catch { a._amount = String(a[k]); }\n }\n }\n a._amount ??= \"?\";\n a.institution_name ??= \"Mercury\";\n a.payment_method ??= \"ach\";\n\n const fmts: Record<string, string> = {\n form_entity: 'Form a new {entity_type} named \"{entity_name}\" in {jurisdiction}',\n convert_entity: \"Convert entity to {new_entity_type}\",\n dissolve_entity: \"Dissolve entity — {dissolution_reason}\",\n issue_equity: \"Issue {shares} {grant_type} shares to {recipient_name}\",\n transfer_shares: \"Transfer {shares} shares to {to_recipient_name}\",\n issue_safe: \"Issue SAFE note to {investor_name} for {_amount}\",\n calculate_distribution: \"Calculate {distribution_type} distribution of {_amount}\",\n create_invoice: \"Create invoice for {customer_name} — {_amount}\",\n run_payroll: \"Run payroll for {pay_period_start} to {pay_period_end}\",\n submit_payment: \"Submit {_amount} payment to {recipient} via {payment_method}\",\n open_bank_account: \"Open bank account at {institution_name}\",\n reconcile_ledger: \"Reconcile ledger from {start_date} to {end_date}\",\n generate_contract: \"Generate {template_type} contract for {counterparty_name}\",\n file_tax_document: \"File {document_type} for tax year {tax_year}\",\n track_deadline: \"Track {deadline_type} deadline — {description}\",\n classify_contractor: \"Classify contractor {contractor_name} in {state}\",\n convene_meeting: \"Convene {meeting_type} meeting\",\n cast_vote: \"Cast {vote} vote\",\n schedule_meeting: \"Schedule {meeting_type} meeting: {title}\",\n update_checklist: \"Update workspace checklist\",\n create_agent: 'Create agent \"{name}\"',\n send_agent_message: \"Send message to agent\",\n update_agent: \"Update agent configuration\",\n add_agent_skill: 'Add skill \"{skill_name}\" to agent',\n };\n\n const fmt = fmts[name];\n if (fmt) {\n try {\n return fmt.replace(/\\{(\\w+)\\}/g, (_, k: string) => String(a[k] ?? \"?\"));\n } catch { /* fall through */ }\n }\n return name.replace(/_/g, \" \");\n}\n","/**\n * System prompt base and config formatter.\n */\n\nexport const SYSTEM_PROMPT_BASE = `You are a corporate governance assistant for TheCorporation, an agentic corporate governance platform.\n\n## Context\n{context}\n\n## Capabilities\nYou can perform the full range of corporate operations:\n\n**Read operations:**\n- View workspace status, entities, cap tables, documents\n- List SAFE notes, equity grants, agents\n- Check deadlines and compliance status\n\n**Write operations:**\n- Form new LLCs and corporations in any US jurisdiction\n- Issue equity (common, preferred, options, units)\n- Issue SAFE notes to investors\n- Transfer shares between holders\n- Convert entities (LLC <> Corporation)\n- Create invoices, run payroll, submit payments\n- Open bank accounts, reconcile ledgers\n- Generate contracts (NDAs, employment offers, consulting agreements)\n- File tax documents (1099-NEC, K-1, 941, W-2, estimated tax)\n- Generate signing links for documents (human-only signing)\n- Track compliance deadlines\n- Classify contractor risk (employee vs 1099)\n- Convene governance meetings and cast votes\n- Dissolve entities with full wind-down workflow\n\n## Rules\n- All monetary values are in integer cents ($1,000 = 100000).\n- Be concise and helpful.\n- **You MUST confirm with the user before calling ANY write tool.** Describe what you are about to do and wait for explicit approval. Never execute tools speculatively or \"on behalf of\" the user without their go-ahead.\n- Don't ask for info available in platform config — use the correct values automatically.\n- If only one option exists for a field, use it without asking.\n- Don't make up data — only present what the tools return.\n- If a tool returns an error, explain it simply without exposing raw error details.\n- NEVER create an agent to answer a question you can answer yourself. You are the assistant — answer questions directly using your knowledge and the read tools.\n\n## Agent Rules\n- Agents are for **delegating recurring corporate operations tasks** that the user explicitly requests — e.g. \"process incoming invoices\", \"monitor compliance deadlines\", \"handle payroll every two weeks\".\n- Agents are NOT for research, answering questions, or one-off lookups. If the user asks a question, YOU answer it.\n- NEVER proactively suggest or create an agent unless the user specifically asks for one.\n- Agent tools require a paid plan.\n\n## Entity Formation Rules\n- When forming an entity, you MUST ask about all founding members and their ownership allocations BEFORE calling the form_entity tool.\n- For LLCs, ownership percentages must total 100%.\n\n## Document Signing Rules\n- You CANNOT sign documents on behalf of users. Signing is a human action.\n- Use \\`get_signing_link\\` to generate a signing URL for a document.\n- Present the signing link so users can open it and sign themselves.\n- NEVER attempt to sign, execute, or complete signature actions automatically.\n- The \\`get_signing_link\\` tool does NOT sign anything — it only returns a URL.\n\n## User Journey\nAfter completing any action, ALWAYS present the logical next step(s) as a\nnumbered list. The user should never wonder \"what now?\" — guide them forward.\n\nAfter entity formation:\n1. The \\`form_entity\\` response includes a \\`documents\\` array with document IDs. These documents are created immediately — they are NEVER \"still being generated\" or delayed.\n2. Immediately call \\`get_signing_link\\` for each document ID in the response to get signing URLs.\n3. Present the signing links to the user right away. Do NOT tell the user to \"check back later\" or that documents are \"being prepared\" — they already exist.\n4. Then: \"Documents signed! Next: apply for an EIN, open a bank account, or issue equity.\"\n\nAfter document generation:\n1. Present signing links immediately — don't wait for the user to ask.\n2. Use the document IDs from the tool response — do NOT call \\`list_documents\\` to re-fetch them.\n\nAfter signing:\n1. \"Documents are signed! Next: file for EIN, open a bank account, or add team members.\"\n\nAfter equity issuance:\n1. \"Equity issued! Next: generate the stock certificate for signing, or issue more grants.\"\n\nGeneral pattern:\n- Always end with 1-2 concrete next actions the user can take.\n- Phrase them as questions or suggestions: \"Would you like to [next step]?\"\n- If there are signing obligations, proactively generate and present the signing links.\n- Never just say \"done\" — always show what comes next.\n\nAfter major actions, use update_checklist to track progress. Use markdown checkbox\nformat (- [x] / - [ ]). Call get_checklist first to see current state, then\nupdate_checklist with checked-off items. This helps users see where they are.\n\n{extra_sections}`;\n\ninterface ConfigItem {\n value: string;\n label?: string;\n}\n\nexport function formatConfigSection(cfgData: Record<string, unknown>): string {\n const lines: string[] = [];\n\n const entityTypes = cfgData.entity_types as ConfigItem[] | undefined;\n if (entityTypes?.length) {\n const vals = entityTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Entity types: ${vals}`);\n }\n\n const jurisdictions = cfgData.jurisdictions as Record<string, ConfigItem[]> | undefined;\n if (jurisdictions) {\n for (const [etype, jurs] of Object.entries(jurisdictions)) {\n const jurVals = jurs.map((j) => `${j.label} (${j.value})`).join(\", \");\n lines.push(`Jurisdictions for ${etype}: ${jurVals}`);\n }\n }\n\n const invTypes = cfgData.investor_types as ConfigItem[] | undefined;\n if (invTypes?.length) {\n const vals = invTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Investor types: ${vals}`);\n }\n\n const workers = cfgData.worker_classifications as ConfigItem[] | undefined;\n if (workers?.length) {\n const vals = workers.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Worker classifications: ${vals}`);\n }\n\n const vesting = cfgData.vesting_schedules as ConfigItem[] | undefined;\n if (vesting?.length) {\n const vals = vesting.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Vesting schedules: ${vals}`);\n }\n\n const safeTypes = cfgData.safe_types as ConfigItem[] | undefined;\n if (safeTypes?.length) {\n const vals = safeTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`SAFE types: ${vals}`);\n }\n\n const compTypes = cfgData.compensation_types as ConfigItem[] | undefined;\n if (compTypes?.length) {\n const vals = compTypes.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Compensation types: ${vals}`);\n }\n\n const bodyTypes = cfgData.governance_body_types as ConfigItem[] | undefined;\n if (bodyTypes?.length) {\n const vals = bodyTypes.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Governance body types: ${vals}`);\n }\n\n const quorum = cfgData.quorum_rules as ConfigItem[] | undefined;\n if (quorum?.length) {\n const vals = quorum.map((t) => `\"${t.value}\"`).join(\", \");\n lines.push(`Quorum rules: ${vals}`);\n }\n\n const voting = cfgData.voting_methods as ConfigItem[] | undefined;\n if (voting?.length) {\n const vals = voting.map((t) => `${t.label} (${t.value})`).join(\", \");\n lines.push(`Voting methods: ${vals}`);\n }\n\n if (!lines.length) return \"\";\n\n const configYaml = lines.map((line) => `- ${line}`).join(\"\\n\");\n return (\n \"\\n## Platform Configuration\\n\" +\n \"The following are the ONLY valid values supported by this platform. \" +\n \"Do not offer or accept values outside these lists.\\n\\n\" +\n configYaml + \"\\n\"\n );\n}\n","/**\n * Tool registry and classification helpers.\n * Re-exports from existing modules + builds a registry from generated defs.\n */\n\nimport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\n\nexport { GENERATED_TOOL_DEFINITIONS } from \"./tool-defs.generated.js\";\nexport { isWriteTool } from \"./tools.js\";\nexport { describeToolCall } from \"./tool-descriptions.js\";\n\ninterface ToolFunction {\n name: string;\n description: string;\n parameters: Record<string, unknown>;\n}\n\ninterface ToolDef {\n type: string;\n function: ToolFunction;\n}\n\n/** Registry: tool name → function metadata (description + parameters). */\nexport const TOOL_REGISTRY: Record<string, ToolFunction> = {};\n\nfor (const td of GENERATED_TOOL_DEFINITIONS as unknown as ToolDef[]) {\n TOOL_REGISTRY[td.function.name] = td.function;\n}\n\nexport const READ_ONLY_TOOLS = new Set([\n \"get_workspace_status\", \"list_entities\", \"get_cap_table\", \"list_documents\",\n \"list_safe_notes\", \"list_agents\", \"get_checklist\",\n \"get_signing_link\", \"list_obligations\", \"get_billing_status\",\n]);\n"],"mappings":";AAaO,IAAM,sBAAN,cAAkC,MAAM;AAAA,EAC7C,cAAc;AACZ,UAAM,uEAAuE;AAC7E,SAAK,OAAO;AAAA,EACd;AACF;AAEA,eAAsB,mBACpB,QACA,MACoB;AACpB,QAAM,MAAM,GAAG,OAAO,QAAQ,QAAQ,EAAE,CAAC;AACzC,QAAM,OAA+B,CAAC;AACtC,MAAI,KAAM,MAAK,OAAO;AACtB,QAAM,OAAO,MAAM,MAAM,KAAK;AAAA,IAC5B,QAAQ;AAAA,IACR,SAAS,EAAE,gBAAgB,mBAAmB;AAAA,IAC9C,MAAM,KAAK,UAAU,IAAI;AAAA,EAC3B,CAAC;AACD,MAAI,CAAC,KAAK,GAAI,OAAM,IAAI,MAAM,qBAAqB,KAAK,MAAM,IAAI,KAAK,UAAU,EAAE;AACnF,SAAO,KAAK,KAAK;AACnB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;AAC7D,SACE,4JAGA,aAAa;AAEjB;;;ACpJO,IAAM,gBAA8C,CAAC;AAE5D,WAAW,MAAM,4BAAoD;AACnE,gBAAc,GAAG,SAAS,IAAI,IAAI,GAAG;AACvC;AAEO,IAAMA,mBAAkB,oBAAI,IAAI;AAAA,EACrC;AAAA,EAAwB;AAAA,EAAiB;AAAA,EAAiB;AAAA,EAC1D;AAAA,EAAmB;AAAA,EAAe;AAAA,EAClC;AAAA,EAAoB;AAAA,EAAoB;AAC1C,CAAC;","names":["READ_ONLY_TOOLS"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thecorporation/corp-tools",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "Shared corporate tool handlers, API client, and types",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -16,7 +16,9 @@
|
|
|
16
16
|
],
|
|
17
17
|
"scripts": {
|
|
18
18
|
"build": "tsup",
|
|
19
|
-
"dev": "tsup --watch"
|
|
19
|
+
"dev": "tsup --watch",
|
|
20
|
+
"generate:tools": "python3 ../../scripts/dev/generate_tool_defs.py --api-url http://localhost:8000 > src/tool-defs.generated.ts",
|
|
21
|
+
"check:tools": "python3 ../../scripts/dev/check_tool_sync.py"
|
|
20
22
|
},
|
|
21
23
|
"devDependencies": {
|
|
22
24
|
"tsup": "^8.4.0",
|