@thecorporation/corp-tools 26.3.18 → 26.3.21

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/dist/index.js CHANGED
@@ -5,19 +5,30 @@ var SessionExpiredError = class extends Error {
5
5
  this.name = "SessionExpiredError";
6
6
  }
7
7
  };
8
+ var MAX_ERROR_DETAIL_LEN = 500;
9
+ function sanitizeErrorDetail(value) {
10
+ const sanitized = value.replace(/[\u0000-\u001f\u007f-\u009f\u001b]/g, " ").replace(/\s+/g, " ").trim();
11
+ if (!sanitized) {
12
+ return "request failed";
13
+ }
14
+ return sanitized.length > MAX_ERROR_DETAIL_LEN ? `${sanitized.slice(0, MAX_ERROR_DETAIL_LEN)}...` : sanitized;
15
+ }
16
+ function pathSegment(value) {
17
+ return encodeURIComponent(String(value));
18
+ }
8
19
  async function extractErrorMessage(resp) {
9
20
  try {
10
21
  const text = await resp.text();
11
22
  try {
12
23
  const json = JSON.parse(text);
13
24
  const val = json.error || json.message || json.detail;
14
- if (val == null) return text;
15
- return typeof val === "string" ? val : JSON.stringify(val);
25
+ if (val == null) return sanitizeErrorDetail(text);
26
+ return sanitizeErrorDetail(typeof val === "string" ? val : JSON.stringify(val));
16
27
  } catch {
17
- return text;
28
+ return sanitizeErrorDetail(text);
18
29
  }
19
30
  } catch {
20
- return resp.statusText;
31
+ return sanitizeErrorDetail(resp.statusText);
21
32
  }
22
33
  }
23
34
  async function provisionWorkspace(apiUrl, name) {
@@ -94,7 +105,7 @@ var CorpAPIClient = class {
94
105
  }
95
106
  // --- Workspace ---
96
107
  getStatus() {
97
- return this.get(`/v1/workspaces/${this.workspaceId}/status`);
108
+ return this.get(`/v1/workspaces/${pathSegment(this.workspaceId)}/status`);
98
109
  }
99
110
  // --- Obligations ---
100
111
  getObligations(tier) {
@@ -110,7 +121,13 @@ var CorpAPIClient = class {
110
121
  return this.post("/v1/digests/trigger");
111
122
  }
112
123
  getDigest(key) {
113
- return this.get(`/v1/digests/${key}`);
124
+ return this.get(`/v1/digests/${pathSegment(key)}`);
125
+ }
126
+ // --- References ---
127
+ syncReferences(kind, items, entityId) {
128
+ const body = { kind, items };
129
+ if (entityId) body.entity_id = entityId;
130
+ return this.post("/v1/references/sync", body);
114
131
  }
115
132
  // --- Entities ---
116
133
  listEntities() {
@@ -118,45 +135,47 @@ var CorpAPIClient = class {
118
135
  }
119
136
  // --- Contacts ---
120
137
  listContacts(entityId) {
121
- return this.get(`/v1/entities/${entityId}/contacts`);
138
+ return this.get(`/v1/entities/${pathSegment(entityId)}/contacts`);
122
139
  }
123
140
  getContact(id, entityId) {
124
- return this.get(`/v1/contacts/${id}`, { entity_id: entityId });
141
+ return this.get(`/v1/contacts/${pathSegment(id)}`, { entity_id: entityId });
125
142
  }
126
143
  getContactProfile(id, entityId) {
127
- return this.get(`/v1/contacts/${id}/profile`, { entity_id: entityId });
144
+ return this.get(`/v1/contacts/${pathSegment(id)}/profile`, { entity_id: entityId });
128
145
  }
129
146
  createContact(data) {
130
147
  return this.post("/v1/contacts", data);
131
148
  }
132
149
  updateContact(id, data) {
133
- return this.patch(`/v1/contacts/${id}`, data);
150
+ return this.patch(`/v1/contacts/${pathSegment(id)}`, data);
134
151
  }
135
152
  getNotificationPrefs(contactId) {
136
- return this.get(`/v1/contacts/${contactId}/notification-prefs`);
153
+ return this.get(`/v1/contacts/${pathSegment(contactId)}/notification-prefs`);
137
154
  }
138
155
  updateNotificationPrefs(contactId, prefs) {
139
- return this.patch(`/v1/contacts/${contactId}/notification-prefs`, prefs);
156
+ return this.patch(`/v1/contacts/${pathSegment(contactId)}/notification-prefs`, prefs);
140
157
  }
141
158
  // --- Cap Table ---
142
159
  getCapTable(entityId) {
143
- return this.get(`/v1/entities/${entityId}/cap-table`);
160
+ return this.get(`/v1/entities/${pathSegment(entityId)}/cap-table`);
144
161
  }
145
162
  async getSafeNotes(entityId) {
146
- return this.get(`/v1/entities/${entityId}/safe-notes`);
163
+ return this.get(`/v1/entities/${pathSegment(entityId)}/safe-notes`);
147
164
  }
148
165
  createSafeNote(data) {
149
166
  return this.post("/v1/safe-notes", data);
150
167
  }
151
- /** Extract transfer-workflow info (no dedicated list endpoint for share transfers). */
152
- async getShareTransfers(entityId) {
153
- return [{ _note: "Use transfer workflows: POST /v1/equity/transfer-workflows to initiate transfers.", entity_id: entityId }];
168
+ listShareTransfers(entityId) {
169
+ return this.get(`/v1/entities/${pathSegment(entityId)}/share-transfers`);
170
+ }
171
+ getShareTransfers(entityId) {
172
+ return this.listShareTransfers(entityId);
154
173
  }
155
174
  getValuations(entityId) {
156
- return this.get(`/v1/entities/${entityId}/valuations`);
175
+ return this.get(`/v1/entities/${pathSegment(entityId)}/valuations`);
157
176
  }
158
177
  getCurrent409a(entityId) {
159
- return this.get(`/v1/entities/${entityId}/current-409a`);
178
+ return this.get(`/v1/entities/${pathSegment(entityId)}/current-409a`);
160
179
  }
161
180
  createValuation(data) {
162
181
  return this.post("/v1/valuations", data);
@@ -165,12 +184,12 @@ var CorpAPIClient = class {
165
184
  return this.post("/v1/equity/instruments", data);
166
185
  }
167
186
  submitValuationForApproval(valuationId, entityId) {
168
- return this.post(`/v1/valuations/${valuationId}/submit-for-approval`, { entity_id: entityId });
187
+ return this.post(`/v1/valuations/${pathSegment(valuationId)}/submit-for-approval`, { entity_id: entityId });
169
188
  }
170
189
  approveValuation(valuationId, entityId, resolutionId) {
171
190
  const body = { entity_id: entityId };
172
191
  if (resolutionId) body.resolution_id = resolutionId;
173
- return this.post(`/v1/valuations/${valuationId}/approve`, body);
192
+ return this.post(`/v1/valuations/${pathSegment(valuationId)}/approve`, body);
174
193
  }
175
194
  transferShares(data) {
176
195
  return this.post("/v1/equity/transfer-workflows", data);
@@ -183,13 +202,13 @@ var CorpAPIClient = class {
183
202
  return this.post("/v1/equity/rounds", data);
184
203
  }
185
204
  applyEquityRoundTerms(roundId, data) {
186
- return this.post(`/v1/equity/rounds/${roundId}/apply-terms`, data);
205
+ return this.post(`/v1/equity/rounds/${pathSegment(roundId)}/apply-terms`, data);
187
206
  }
188
207
  boardApproveEquityRound(roundId, data) {
189
- return this.post(`/v1/equity/rounds/${roundId}/board-approve`, data);
208
+ return this.post(`/v1/equity/rounds/${pathSegment(roundId)}/board-approve`, data);
190
209
  }
191
210
  acceptEquityRound(roundId, data) {
192
- return this.post(`/v1/equity/rounds/${roundId}/accept`, data);
211
+ return this.post(`/v1/equity/rounds/${pathSegment(roundId)}/accept`, data);
193
212
  }
194
213
  previewRoundConversion(data) {
195
214
  return this.post("/v1/equity/conversions/preview", data);
@@ -198,83 +217,95 @@ var CorpAPIClient = class {
198
217
  return this.post("/v1/equity/conversions/execute", data);
199
218
  }
200
219
  // --- Staged equity rounds ---
220
+ listEquityRounds(entityId) {
221
+ return this.get(`/v1/entities/${pathSegment(entityId)}/equity-rounds`);
222
+ }
201
223
  startEquityRound(data) {
202
224
  return this.post("/v1/equity/rounds/staged", data);
203
225
  }
204
226
  addRoundSecurity(roundId, data) {
205
- return this.post(`/v1/equity/rounds/${roundId}/securities`, data);
227
+ return this.post(`/v1/equity/rounds/${pathSegment(roundId)}/securities`, data);
206
228
  }
207
229
  issueRound(roundId, data) {
208
- return this.post(`/v1/equity/rounds/${roundId}/issue`, data);
230
+ return this.post(`/v1/equity/rounds/${pathSegment(roundId)}/issue`, data);
209
231
  }
210
232
  // --- Intent lifecycle helpers ---
211
233
  createExecutionIntent(data) {
212
234
  return this.post("/v1/execution/intents", data);
213
235
  }
214
236
  evaluateIntent(intentId, entityId) {
215
- return this.postWithParams(`/v1/intents/${intentId}/evaluate`, {}, { entity_id: entityId });
237
+ return this.postWithParams(`/v1/intents/${pathSegment(intentId)}/evaluate`, {}, { entity_id: entityId });
216
238
  }
217
239
  authorizeIntent(intentId, entityId) {
218
- return this.postWithParams(`/v1/intents/${intentId}/authorize`, {}, { entity_id: entityId });
240
+ return this.postWithParams(`/v1/intents/${pathSegment(intentId)}/authorize`, {}, { entity_id: entityId });
219
241
  }
220
242
  // --- Governance ---
221
243
  listGovernanceBodies(entityId) {
222
- return this.get(`/v1/entities/${entityId}/governance-bodies`);
244
+ return this.get(`/v1/entities/${pathSegment(entityId)}/governance-bodies`);
223
245
  }
224
246
  getGovernanceSeats(bodyId, entityId) {
225
- return this.get(`/v1/governance-bodies/${bodyId}/seats`, { entity_id: entityId });
247
+ return this.get(`/v1/governance-bodies/${pathSegment(bodyId)}/seats`, { entity_id: entityId });
226
248
  }
227
249
  listMeetings(bodyId, entityId) {
228
- return this.get(`/v1/governance-bodies/${bodyId}/meetings`, { entity_id: entityId });
250
+ return this.get(`/v1/governance-bodies/${pathSegment(bodyId)}/meetings`, { entity_id: entityId });
229
251
  }
230
252
  getMeetingResolutions(meetingId, entityId) {
231
- return this.get(`/v1/meetings/${meetingId}/resolutions`, { entity_id: entityId });
253
+ return this.get(`/v1/meetings/${pathSegment(meetingId)}/resolutions`, { entity_id: entityId });
232
254
  }
233
255
  scheduleMeeting(data) {
234
256
  return this.post("/v1/meetings", data);
235
257
  }
236
258
  conveneMeeting(meetingId, entityId, data) {
237
- return this.postWithParams(`/v1/meetings/${meetingId}/convene`, data, { entity_id: entityId });
259
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/convene`, data, { entity_id: entityId });
238
260
  }
239
261
  castVote(entityId, meetingId, itemId, data) {
240
- return this.postWithParams(`/v1/meetings/${meetingId}/agenda-items/${itemId}/vote`, data, { entity_id: entityId });
262
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/agenda-items/${pathSegment(itemId)}/vote`, data, { entity_id: entityId });
241
263
  }
242
264
  sendNotice(meetingId, entityId) {
243
- return this.postWithParams(`/v1/meetings/${meetingId}/notice`, {}, { entity_id: entityId });
265
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/notice`, {}, { entity_id: entityId });
244
266
  }
245
267
  adjournMeeting(meetingId, entityId) {
246
- return this.postWithParams(`/v1/meetings/${meetingId}/adjourn`, {}, { entity_id: entityId });
268
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/adjourn`, {}, { entity_id: entityId });
269
+ }
270
+ reopenMeeting(meetingId, entityId) {
271
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/reopen`, {}, { entity_id: entityId });
247
272
  }
248
273
  cancelMeeting(meetingId, entityId) {
249
- return this.postWithParams(`/v1/meetings/${meetingId}/cancel`, {}, { entity_id: entityId });
274
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/cancel`, {}, { entity_id: entityId });
250
275
  }
251
276
  finalizeAgendaItem(meetingId, itemId, data) {
252
- return this.post(`/v1/meetings/${meetingId}/agenda-items/${itemId}/finalize`, data);
277
+ return this.post(`/v1/meetings/${pathSegment(meetingId)}/agenda-items/${pathSegment(itemId)}/finalize`, data);
253
278
  }
254
279
  computeResolution(meetingId, itemId, entityId, data) {
255
- return this.postWithParams(`/v1/meetings/${meetingId}/agenda-items/${itemId}/resolution`, data, { entity_id: entityId });
280
+ return this.postWithParams(`/v1/meetings/${pathSegment(meetingId)}/agenda-items/${pathSegment(itemId)}/resolution`, data, { entity_id: entityId });
256
281
  }
257
282
  attachResolutionDocument(meetingId, resolutionId, data) {
258
- return this.post(`/v1/meetings/${meetingId}/resolutions/${resolutionId}/attach-document`, data);
283
+ return this.post(`/v1/meetings/${pathSegment(meetingId)}/resolutions/${pathSegment(resolutionId)}/attach-document`, data);
259
284
  }
260
285
  writtenConsent(data) {
261
286
  return this.post("/v1/meetings/written-consent", data);
262
287
  }
263
288
  listAgendaItems(meetingId, entityId) {
264
- return this.get(`/v1/meetings/${meetingId}/agenda-items`, { entity_id: entityId });
289
+ return this.get(`/v1/meetings/${pathSegment(meetingId)}/agenda-items`, { entity_id: entityId });
265
290
  }
266
291
  listVotes(meetingId, itemId, entityId) {
267
- return this.get(`/v1/meetings/${meetingId}/agenda-items/${itemId}/votes`, { entity_id: entityId });
292
+ return this.get(`/v1/meetings/${pathSegment(meetingId)}/agenda-items/${pathSegment(itemId)}/votes`, { entity_id: entityId });
268
293
  }
269
294
  // --- Documents ---
270
295
  getEntityDocuments(entityId) {
271
- return this.get(`/v1/formations/${entityId}/documents`);
296
+ return this.get(`/v1/formations/${pathSegment(entityId)}/documents`);
297
+ }
298
+ getDocument(documentId, entityId) {
299
+ return this.get(`/v1/documents/${pathSegment(documentId)}`, { entity_id: entityId });
300
+ }
301
+ signDocument(documentId, entityId, data) {
302
+ return this.postWithParams(`/v1/documents/${pathSegment(documentId)}/sign`, data, { entity_id: entityId });
272
303
  }
273
304
  generateContract(data) {
274
305
  return this.post("/v1/contracts", data);
275
306
  }
276
307
  getSigningLink(documentId, entityId) {
277
- return this.get(`/v1/sign/${documentId}`, { entity_id: entityId });
308
+ return this.get(`/v1/sign/${pathSegment(documentId)}`, { entity_id: entityId });
278
309
  }
279
310
  async validatePreviewPdf(entityId, documentId) {
280
311
  const resp = await this.request("GET", "/v1/documents/preview/pdf/validate", void 0, { entity_id: entityId, document_id: documentId });
@@ -286,6 +317,24 @@ var CorpAPIClient = class {
286
317
  return `${this.apiUrl}/v1/documents/preview/pdf?${qs}`;
287
318
  }
288
319
  // --- Finance ---
320
+ listInvoices(entityId) {
321
+ return this.get(`/v1/entities/${pathSegment(entityId)}/invoices`);
322
+ }
323
+ listBankAccounts(entityId) {
324
+ return this.get(`/v1/entities/${pathSegment(entityId)}/bank-accounts`);
325
+ }
326
+ listPayments(entityId) {
327
+ return this.get(`/v1/entities/${pathSegment(entityId)}/payments`);
328
+ }
329
+ listPayrollRuns(entityId) {
330
+ return this.get(`/v1/entities/${pathSegment(entityId)}/payroll-runs`);
331
+ }
332
+ listDistributions(entityId) {
333
+ return this.get(`/v1/entities/${pathSegment(entityId)}/distributions`);
334
+ }
335
+ listReconciliations(entityId) {
336
+ return this.get(`/v1/entities/${pathSegment(entityId)}/reconciliations`);
337
+ }
289
338
  createInvoice(data) {
290
339
  return this.post("/v1/treasury/invoices", data);
291
340
  }
@@ -305,6 +354,15 @@ var CorpAPIClient = class {
305
354
  return this.post("/v1/ledger/reconcile", data);
306
355
  }
307
356
  // --- Tax ---
357
+ listTaxFilings(entityId) {
358
+ return this.get(`/v1/entities/${pathSegment(entityId)}/tax-filings`);
359
+ }
360
+ listDeadlines(entityId) {
361
+ return this.get(`/v1/entities/${pathSegment(entityId)}/deadlines`);
362
+ }
363
+ listContractorClassifications(entityId) {
364
+ return this.get(`/v1/entities/${pathSegment(entityId)}/contractor-classifications`);
365
+ }
308
366
  fileTaxDocument(data) {
309
367
  return this.post("/v1/tax/filings", data);
310
368
  }
@@ -333,10 +391,10 @@ var CorpAPIClient = class {
333
391
  }
334
392
  // --- Formations ---
335
393
  getFormation(id) {
336
- return this.get(`/v1/formations/${id}`);
394
+ return this.get(`/v1/formations/${pathSegment(id)}`);
337
395
  }
338
396
  getFormationDocuments(id) {
339
- return this.get(`/v1/formations/${id}/documents`);
397
+ return this.get(`/v1/formations/${pathSegment(id)}/documents`);
340
398
  }
341
399
  createFormation(data) {
342
400
  return this.post("/v1/formations", data);
@@ -348,21 +406,45 @@ var CorpAPIClient = class {
348
406
  return this.post("/v1/formations/pending", data);
349
407
  }
350
408
  addFounder(entityId, data) {
351
- return this.post(`/v1/formations/${entityId}/founders`, data);
409
+ return this.post(`/v1/formations/${pathSegment(entityId)}/founders`, data);
352
410
  }
353
411
  finalizeFormation(entityId, data = {}) {
354
- return this.post(`/v1/formations/${entityId}/finalize`, data);
412
+ return this.post(`/v1/formations/${pathSegment(entityId)}/finalize`, data);
413
+ }
414
+ markFormationDocumentsSigned(entityId) {
415
+ return this.post(`/v1/formations/${pathSegment(entityId)}/mark-documents-signed`);
416
+ }
417
+ getFormationGates(entityId) {
418
+ return this.get(`/v1/formations/${pathSegment(entityId)}/gates`);
419
+ }
420
+ recordFilingAttestation(entityId, data) {
421
+ return this.post(`/v1/formations/${pathSegment(entityId)}/filing-attestation`, data);
422
+ }
423
+ addRegisteredAgentConsentEvidence(entityId, data) {
424
+ return this.post(`/v1/formations/${pathSegment(entityId)}/registered-agent-consent-evidence`, data);
425
+ }
426
+ submitFiling(entityId) {
427
+ return this.post(`/v1/formations/${pathSegment(entityId)}/submit-filing`);
428
+ }
429
+ confirmFiling(entityId, data) {
430
+ return this.post(`/v1/formations/${pathSegment(entityId)}/filing-confirmation`, data);
431
+ }
432
+ applyEin(entityId) {
433
+ return this.post(`/v1/formations/${pathSegment(entityId)}/apply-ein`);
434
+ }
435
+ confirmEin(entityId, data) {
436
+ return this.post(`/v1/formations/${pathSegment(entityId)}/ein-confirmation`, data);
355
437
  }
356
438
  // --- Human obligations ---
357
439
  getHumanObligations() {
358
- return this.get(`/v1/workspaces/${this.workspaceId}/human-obligations`);
440
+ return this.get(`/v1/workspaces/${pathSegment(this.workspaceId)}/human-obligations`);
359
441
  }
360
442
  getSignerToken(obligationId) {
361
- return this.post(`/v1/human-obligations/${obligationId}/signer-token`);
443
+ return this.post(`/v1/human-obligations/${pathSegment(obligationId)}/signer-token`);
362
444
  }
363
445
  // --- Demo ---
364
- seedDemo(name) {
365
- return this.post("/v1/demo/seed", { name, workspace_id: this.workspaceId });
446
+ seedDemo(data) {
447
+ return this.post("/v1/demo/seed", data);
366
448
  }
367
449
  // --- Entities writes ---
368
450
  convertEntity(entityId, data) {
@@ -371,32 +453,32 @@ var CorpAPIClient = class {
371
453
  };
372
454
  const jurisdiction = data.jurisdiction ?? data.new_jurisdiction;
373
455
  if (jurisdiction) body.jurisdiction = jurisdiction;
374
- return this.post(`/v1/entities/${entityId}/convert`, body);
456
+ return this.post(`/v1/entities/${pathSegment(entityId)}/convert`, body);
375
457
  }
376
458
  dissolveEntity(entityId, data) {
377
- return this.post(`/v1/entities/${entityId}/dissolve`, data);
459
+ return this.post(`/v1/entities/${pathSegment(entityId)}/dissolve`, data);
378
460
  }
379
461
  // --- Agents ---
380
462
  listAgents() {
381
463
  return this.get("/v1/agents");
382
464
  }
383
465
  getAgent(id) {
384
- return this.get(`/v1/agents/${id}/resolved`);
466
+ return this.get(`/v1/agents/${pathSegment(id)}/resolved`);
385
467
  }
386
468
  createAgent(data) {
387
469
  return this.post("/v1/agents", data);
388
470
  }
389
471
  updateAgent(id, data) {
390
- return this.patch(`/v1/agents/${id}`, data);
472
+ return this.patch(`/v1/agents/${pathSegment(id)}`, data);
391
473
  }
392
474
  deleteAgent(id) {
393
- return this.patch(`/v1/agents/${id}`, { status: "disabled" });
475
+ return this.patch(`/v1/agents/${pathSegment(id)}`, { status: "disabled" });
394
476
  }
395
477
  sendAgentMessage(id, message) {
396
- return this.post(`/v1/agents/${id}/messages`, { message });
478
+ return this.post(`/v1/agents/${pathSegment(id)}/messages`, { message });
397
479
  }
398
480
  addAgentSkill(id, data) {
399
- return this.post(`/v1/agents/${id}/skills`, data);
481
+ return this.post(`/v1/agents/${pathSegment(id)}/skills`, data);
400
482
  }
401
483
  listSupportedModels() {
402
484
  return this.get("/v1/models");
@@ -406,29 +488,29 @@ var CorpAPIClient = class {
406
488
  return this.post("/v1/governance-bodies", data);
407
489
  }
408
490
  createGovernanceSeat(bodyId, entityId, data) {
409
- return this.postWithParams(`/v1/governance-bodies/${bodyId}/seats`, data, { entity_id: entityId });
491
+ return this.postWithParams(`/v1/governance-bodies/${pathSegment(bodyId)}/seats`, data, { entity_id: entityId });
410
492
  }
411
493
  // --- Work Items ---
412
494
  listWorkItems(entityId, params) {
413
- return this.get(`/v1/entities/${entityId}/work-items`, params);
495
+ return this.get(`/v1/entities/${pathSegment(entityId)}/work-items`, params);
414
496
  }
415
497
  getWorkItem(entityId, workItemId) {
416
- return this.get(`/v1/entities/${entityId}/work-items/${workItemId}`);
498
+ return this.get(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}`);
417
499
  }
418
500
  createWorkItem(entityId, data) {
419
- return this.post(`/v1/entities/${entityId}/work-items`, data);
501
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items`, data);
420
502
  }
421
503
  claimWorkItem(entityId, workItemId, data) {
422
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/claim`, data);
504
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/claim`, data);
423
505
  }
424
506
  completeWorkItem(entityId, workItemId, data) {
425
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/complete`, data);
507
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/complete`, data);
426
508
  }
427
509
  releaseWorkItem(entityId, workItemId) {
428
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/release`, {});
510
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/release`, {});
429
511
  }
430
512
  cancelWorkItem(entityId, workItemId) {
431
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/cancel`, {});
513
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/cancel`, {});
432
514
  }
433
515
  // --- API Keys ---
434
516
  listApiKeys() {
@@ -436,7 +518,7 @@ var CorpAPIClient = class {
436
518
  }
437
519
  // --- Obligations ---
438
520
  assignObligation(obligationId, contactId) {
439
- return this.patch(`/v1/obligations/${obligationId}/assign`, { contact_id: contactId });
521
+ return this.patch(`/v1/obligations/${pathSegment(obligationId)}/assign`, { contact_id: contactId });
440
522
  }
441
523
  // --- Config ---
442
524
  getConfig() {
@@ -1869,8 +1951,11 @@ var QuorumThreshold = ["majority", "supermajority", "unanimous"];
1869
1951
  var ReceiptStatus = ["pending", "executed", "failed"];
1870
1952
  var ReconciliationStatus = ["balanced", "discrepancy"];
1871
1953
  var Recurrence = ["one_time", "monthly", "quarterly", "annual"];
1954
+ var ReferenceKind = ["entity", "contact", "share_transfer", "invoice", "bank_account", "payment", "payroll_run", "distribution", "reconciliation", "tax_filing", "deadline", "classification", "body", "meeting", "seat", "agenda_item", "resolution", "document", "work_item", "agent", "valuation", "safe_note", "instrument", "share_class", "round"];
1872
1955
  var ResolutionType = ["ordinary", "special", "unanimous_written_consent"];
1873
1956
  var RiskLevel = ["low", "medium", "high"];
1957
+ var SafeStatus = ["issued", "converted", "cancelled"];
1958
+ var SafeType = ["post_money", "pre_money", "mfn"];
1874
1959
  var Scope = ["formation_create", "formation_read", "formation_sign", "equity_read", "equity_write", "equity_transfer", "governance_read", "governance_write", "governance_vote", "treasury_read", "treasury_write", "treasury_approve", "contacts_read", "contacts_write", "execution_read", "execution_write", "branch_create", "branch_merge", "branch_delete", "admin", "internal_worker_read", "internal_worker_write", "secrets_manage", "all"];
1875
1960
  var SeatRole = ["chair", "member", "officer", "observer"];
1876
1961
  var SeatStatus = ["active", "resigned", "expired"];
@@ -1886,6 +1971,7 @@ var ValuationStatus = ["draft", "pending_approval", "approved", "expired", "supe
1886
1971
  var ValuationType = ["four_oh_nine_a", "llc_profits_interest", "fair_market_value", "gift", "estate", "other"];
1887
1972
  var VoteValue = ["for", "against", "abstain", "recusal"];
1888
1973
  var VotingMethod = ["per_capita", "per_unit"];
1974
+ var WorkItemActorTypeValue = ["contact", "agent"];
1889
1975
  var WorkItemStatus = ["open", "claimed", "completed", "cancelled"];
1890
1976
  var WorkflowType = ["transfer", "fundraising"];
1891
1977
  export {
@@ -1959,9 +2045,12 @@ export {
1959
2045
  ReceiptStatus,
1960
2046
  ReconciliationStatus,
1961
2047
  Recurrence,
2048
+ ReferenceKind,
1962
2049
  ResolutionType,
1963
2050
  RiskLevel,
1964
2051
  SYSTEM_PROMPT_BASE,
2052
+ SafeStatus,
2053
+ SafeType,
1965
2054
  Scope,
1966
2055
  SeatRole,
1967
2056
  SeatStatus,
@@ -1980,6 +2069,7 @@ export {
1980
2069
  ValuationType,
1981
2070
  VoteValue,
1982
2071
  VotingMethod,
2072
+ WorkItemActorTypeValue,
1983
2073
  WorkItemStatus,
1984
2074
  WorkflowType,
1985
2075
  describeToolCall,