@thecorporation/corp-tools 26.3.18 → 26.3.20

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.d.ts CHANGED
@@ -15,6 +15,7 @@ interface CorpConfig {
15
15
  };
16
16
  active_entity_id: string;
17
17
  active_entity_ids?: Record<string, string>;
18
+ last_references?: Record<string, string>;
18
19
  [key: string]: unknown;
19
20
  }
20
21
  interface ToolCall {
@@ -3084,6 +3085,12 @@ declare class CorpAPIClient {
3084
3085
  listDigests(): Promise<DigestSummary[]>;
3085
3086
  triggerDigest(): Promise<DigestTriggerResponse>;
3086
3087
  getDigest(key: string): Promise<DigestSummary>;
3088
+ syncReferences(kind: string, items: Array<{
3089
+ resource_id: string;
3090
+ label: string;
3091
+ }>, entityId?: string): Promise<{
3092
+ references: ApiRecord[];
3093
+ }>;
3087
3094
  listEntities(): Promise<ApiRecord[]>;
3088
3095
  listContacts(entityId: string): Promise<ApiRecord[]>;
3089
3096
  getContact(id: string, entityId: string): Promise<ApiRecord>;
@@ -3095,7 +3102,7 @@ declare class CorpAPIClient {
3095
3102
  getCapTable(entityId: string): Promise<ApiRecord>;
3096
3103
  getSafeNotes(entityId: string): Promise<ApiRecord[]>;
3097
3104
  createSafeNote(data: ApiRecord): Promise<ApiRecord>;
3098
- /** Extract transfer-workflow info (no dedicated list endpoint for share transfers). */
3105
+ listShareTransfers(entityId: string): Promise<ApiRecord[]>;
3099
3106
  getShareTransfers(entityId: string): Promise<ApiRecord[]>;
3100
3107
  getValuations(entityId: string): Promise<ApiRecord[]>;
3101
3108
  getCurrent409a(entityId: string): Promise<ApiRecord>;
@@ -3111,6 +3118,7 @@ declare class CorpAPIClient {
3111
3118
  acceptEquityRound(roundId: string, data: AcceptEquityRoundRequest): Promise<EquityRoundResponse>;
3112
3119
  previewRoundConversion(data: PreviewRoundConversionRequest): Promise<ApiRecord>;
3113
3120
  executeRoundConversion(data: ExecuteRoundConversionRequest): Promise<ApiRecord>;
3121
+ listEquityRounds(entityId: string): Promise<ApiRecord[]>;
3114
3122
  startEquityRound(data: ApiRecord): Promise<ApiRecord>;
3115
3123
  addRoundSecurity(roundId: string, data: ApiRecord): Promise<ApiRecord>;
3116
3124
  issueRound(roundId: string, data: ApiRecord): Promise<ApiRecord>;
@@ -3126,6 +3134,7 @@ declare class CorpAPIClient {
3126
3134
  castVote(entityId: string, meetingId: string, itemId: string, data: ApiRecord): Promise<VoteResponse>;
3127
3135
  sendNotice(meetingId: string, entityId: string): Promise<MeetingResponse>;
3128
3136
  adjournMeeting(meetingId: string, entityId: string): Promise<MeetingResponse>;
3137
+ reopenMeeting(meetingId: string, entityId: string): Promise<MeetingResponse>;
3129
3138
  cancelMeeting(meetingId: string, entityId: string): Promise<MeetingResponse>;
3130
3139
  finalizeAgendaItem(meetingId: string, itemId: string, data: ApiRecord): Promise<AgendaItemResponse>;
3131
3140
  computeResolution(meetingId: string, itemId: string, entityId: string, data: ApiRecord): Promise<ResolutionResponse>;
@@ -3138,12 +3147,21 @@ declare class CorpAPIClient {
3138
3147
  getSigningLink(documentId: string, entityId: string): Promise<ApiRecord>;
3139
3148
  validatePreviewPdf(entityId: string, documentId: string): Promise<ApiRecord>;
3140
3149
  getPreviewPdfUrl(entityId: string, documentId: string): string;
3150
+ listInvoices(entityId: string): Promise<ApiRecord[]>;
3151
+ listBankAccounts(entityId: string): Promise<ApiRecord[]>;
3152
+ listPayments(entityId: string): Promise<ApiRecord[]>;
3153
+ listPayrollRuns(entityId: string): Promise<ApiRecord[]>;
3154
+ listDistributions(entityId: string): Promise<ApiRecord[]>;
3155
+ listReconciliations(entityId: string): Promise<ApiRecord[]>;
3141
3156
  createInvoice(data: ApiRecord): Promise<ApiRecord>;
3142
3157
  runPayroll(data: ApiRecord): Promise<ApiRecord>;
3143
3158
  submitPayment(data: ApiRecord): Promise<ApiRecord>;
3144
3159
  openBankAccount(data: ApiRecord): Promise<ApiRecord>;
3145
3160
  classifyContractor(data: ApiRecord): Promise<ApiRecord>;
3146
3161
  reconcileLedger(data: ApiRecord): Promise<ApiRecord>;
3162
+ listTaxFilings(entityId: string): Promise<ApiRecord[]>;
3163
+ listDeadlines(entityId: string): Promise<ApiRecord[]>;
3164
+ listContractorClassifications(entityId: string): Promise<ApiRecord[]>;
3147
3165
  fileTaxDocument(data: ApiRecord): Promise<ApiRecord>;
3148
3166
  trackDeadline(data: ApiRecord): Promise<ApiRecord>;
3149
3167
  getBillingStatus(): Promise<ApiRecord>;
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,89 @@ 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`);
272
297
  }
273
298
  generateContract(data) {
274
299
  return this.post("/v1/contracts", data);
275
300
  }
276
301
  getSigningLink(documentId, entityId) {
277
- return this.get(`/v1/sign/${documentId}`, { entity_id: entityId });
302
+ return this.get(`/v1/sign/${pathSegment(documentId)}`, { entity_id: entityId });
278
303
  }
279
304
  async validatePreviewPdf(entityId, documentId) {
280
305
  const resp = await this.request("GET", "/v1/documents/preview/pdf/validate", void 0, { entity_id: entityId, document_id: documentId });
@@ -286,6 +311,24 @@ var CorpAPIClient = class {
286
311
  return `${this.apiUrl}/v1/documents/preview/pdf?${qs}`;
287
312
  }
288
313
  // --- Finance ---
314
+ listInvoices(entityId) {
315
+ return this.get(`/v1/entities/${pathSegment(entityId)}/invoices`);
316
+ }
317
+ listBankAccounts(entityId) {
318
+ return this.get(`/v1/entities/${pathSegment(entityId)}/bank-accounts`);
319
+ }
320
+ listPayments(entityId) {
321
+ return this.get(`/v1/entities/${pathSegment(entityId)}/payments`);
322
+ }
323
+ listPayrollRuns(entityId) {
324
+ return this.get(`/v1/entities/${pathSegment(entityId)}/payroll-runs`);
325
+ }
326
+ listDistributions(entityId) {
327
+ return this.get(`/v1/entities/${pathSegment(entityId)}/distributions`);
328
+ }
329
+ listReconciliations(entityId) {
330
+ return this.get(`/v1/entities/${pathSegment(entityId)}/reconciliations`);
331
+ }
289
332
  createInvoice(data) {
290
333
  return this.post("/v1/treasury/invoices", data);
291
334
  }
@@ -305,6 +348,15 @@ var CorpAPIClient = class {
305
348
  return this.post("/v1/ledger/reconcile", data);
306
349
  }
307
350
  // --- Tax ---
351
+ listTaxFilings(entityId) {
352
+ return this.get(`/v1/entities/${pathSegment(entityId)}/tax-filings`);
353
+ }
354
+ listDeadlines(entityId) {
355
+ return this.get(`/v1/entities/${pathSegment(entityId)}/deadlines`);
356
+ }
357
+ listContractorClassifications(entityId) {
358
+ return this.get(`/v1/entities/${pathSegment(entityId)}/contractor-classifications`);
359
+ }
308
360
  fileTaxDocument(data) {
309
361
  return this.post("/v1/tax/filings", data);
310
362
  }
@@ -333,10 +385,10 @@ var CorpAPIClient = class {
333
385
  }
334
386
  // --- Formations ---
335
387
  getFormation(id) {
336
- return this.get(`/v1/formations/${id}`);
388
+ return this.get(`/v1/formations/${pathSegment(id)}`);
337
389
  }
338
390
  getFormationDocuments(id) {
339
- return this.get(`/v1/formations/${id}/documents`);
391
+ return this.get(`/v1/formations/${pathSegment(id)}/documents`);
340
392
  }
341
393
  createFormation(data) {
342
394
  return this.post("/v1/formations", data);
@@ -348,17 +400,17 @@ var CorpAPIClient = class {
348
400
  return this.post("/v1/formations/pending", data);
349
401
  }
350
402
  addFounder(entityId, data) {
351
- return this.post(`/v1/formations/${entityId}/founders`, data);
403
+ return this.post(`/v1/formations/${pathSegment(entityId)}/founders`, data);
352
404
  }
353
405
  finalizeFormation(entityId, data = {}) {
354
- return this.post(`/v1/formations/${entityId}/finalize`, data);
406
+ return this.post(`/v1/formations/${pathSegment(entityId)}/finalize`, data);
355
407
  }
356
408
  // --- Human obligations ---
357
409
  getHumanObligations() {
358
- return this.get(`/v1/workspaces/${this.workspaceId}/human-obligations`);
410
+ return this.get(`/v1/workspaces/${pathSegment(this.workspaceId)}/human-obligations`);
359
411
  }
360
412
  getSignerToken(obligationId) {
361
- return this.post(`/v1/human-obligations/${obligationId}/signer-token`);
413
+ return this.post(`/v1/human-obligations/${pathSegment(obligationId)}/signer-token`);
362
414
  }
363
415
  // --- Demo ---
364
416
  seedDemo(name) {
@@ -371,32 +423,32 @@ var CorpAPIClient = class {
371
423
  };
372
424
  const jurisdiction = data.jurisdiction ?? data.new_jurisdiction;
373
425
  if (jurisdiction) body.jurisdiction = jurisdiction;
374
- return this.post(`/v1/entities/${entityId}/convert`, body);
426
+ return this.post(`/v1/entities/${pathSegment(entityId)}/convert`, body);
375
427
  }
376
428
  dissolveEntity(entityId, data) {
377
- return this.post(`/v1/entities/${entityId}/dissolve`, data);
429
+ return this.post(`/v1/entities/${pathSegment(entityId)}/dissolve`, data);
378
430
  }
379
431
  // --- Agents ---
380
432
  listAgents() {
381
433
  return this.get("/v1/agents");
382
434
  }
383
435
  getAgent(id) {
384
- return this.get(`/v1/agents/${id}/resolved`);
436
+ return this.get(`/v1/agents/${pathSegment(id)}/resolved`);
385
437
  }
386
438
  createAgent(data) {
387
439
  return this.post("/v1/agents", data);
388
440
  }
389
441
  updateAgent(id, data) {
390
- return this.patch(`/v1/agents/${id}`, data);
442
+ return this.patch(`/v1/agents/${pathSegment(id)}`, data);
391
443
  }
392
444
  deleteAgent(id) {
393
- return this.patch(`/v1/agents/${id}`, { status: "disabled" });
445
+ return this.patch(`/v1/agents/${pathSegment(id)}`, { status: "disabled" });
394
446
  }
395
447
  sendAgentMessage(id, message) {
396
- return this.post(`/v1/agents/${id}/messages`, { message });
448
+ return this.post(`/v1/agents/${pathSegment(id)}/messages`, { message });
397
449
  }
398
450
  addAgentSkill(id, data) {
399
- return this.post(`/v1/agents/${id}/skills`, data);
451
+ return this.post(`/v1/agents/${pathSegment(id)}/skills`, data);
400
452
  }
401
453
  listSupportedModels() {
402
454
  return this.get("/v1/models");
@@ -406,29 +458,29 @@ var CorpAPIClient = class {
406
458
  return this.post("/v1/governance-bodies", data);
407
459
  }
408
460
  createGovernanceSeat(bodyId, entityId, data) {
409
- return this.postWithParams(`/v1/governance-bodies/${bodyId}/seats`, data, { entity_id: entityId });
461
+ return this.postWithParams(`/v1/governance-bodies/${pathSegment(bodyId)}/seats`, data, { entity_id: entityId });
410
462
  }
411
463
  // --- Work Items ---
412
464
  listWorkItems(entityId, params) {
413
- return this.get(`/v1/entities/${entityId}/work-items`, params);
465
+ return this.get(`/v1/entities/${pathSegment(entityId)}/work-items`, params);
414
466
  }
415
467
  getWorkItem(entityId, workItemId) {
416
- return this.get(`/v1/entities/${entityId}/work-items/${workItemId}`);
468
+ return this.get(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}`);
417
469
  }
418
470
  createWorkItem(entityId, data) {
419
- return this.post(`/v1/entities/${entityId}/work-items`, data);
471
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items`, data);
420
472
  }
421
473
  claimWorkItem(entityId, workItemId, data) {
422
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/claim`, data);
474
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/claim`, data);
423
475
  }
424
476
  completeWorkItem(entityId, workItemId, data) {
425
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/complete`, data);
477
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/complete`, data);
426
478
  }
427
479
  releaseWorkItem(entityId, workItemId) {
428
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/release`, {});
480
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/release`, {});
429
481
  }
430
482
  cancelWorkItem(entityId, workItemId) {
431
- return this.post(`/v1/entities/${entityId}/work-items/${workItemId}/cancel`, {});
483
+ return this.post(`/v1/entities/${pathSegment(entityId)}/work-items/${pathSegment(workItemId)}/cancel`, {});
432
484
  }
433
485
  // --- API Keys ---
434
486
  listApiKeys() {
@@ -436,7 +488,7 @@ var CorpAPIClient = class {
436
488
  }
437
489
  // --- Obligations ---
438
490
  assignObligation(obligationId, contactId) {
439
- return this.patch(`/v1/obligations/${obligationId}/assign`, { contact_id: contactId });
491
+ return this.patch(`/v1/obligations/${pathSegment(obligationId)}/assign`, { contact_id: contactId });
440
492
  }
441
493
  // --- Config ---
442
494
  getConfig() {