@thecorporation/corp-tools 26.3.21 → 26.3.22
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 +21 -1
- package/dist/index.js +280 -10
- package/dist/index.js.map +1 -1
- package/package.json +9 -1
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ interface CorpConfig {
|
|
|
14
14
|
email: string;
|
|
15
15
|
};
|
|
16
16
|
active_entity_id: string;
|
|
17
|
+
data_dir: string;
|
|
17
18
|
active_entity_ids?: Record<string, string>;
|
|
18
19
|
last_references?: Record<string, string>;
|
|
19
20
|
[key: string]: unknown;
|
|
@@ -3358,6 +3359,13 @@ declare class CorpAPIClient {
|
|
|
3358
3359
|
listApiKeys(): Promise<ApiRecord[]>;
|
|
3359
3360
|
assignObligation(obligationId: string, contactId: string): Promise<ApiRecord>;
|
|
3360
3361
|
getConfig(): Promise<ApiRecord>;
|
|
3362
|
+
listServiceCatalog(): Promise<ApiRecord[]>;
|
|
3363
|
+
createServiceRequest(data: ApiRecord): Promise<ApiRecord>;
|
|
3364
|
+
getServiceRequest(id: string, entityId: string): Promise<ApiRecord>;
|
|
3365
|
+
listServiceRequests(entityId: string): Promise<ApiRecord[]>;
|
|
3366
|
+
beginServiceCheckout(id: string, data: ApiRecord): Promise<ApiRecord>;
|
|
3367
|
+
fulfillServiceRequest(id: string, data: ApiRecord): Promise<ApiRecord>;
|
|
3368
|
+
cancelServiceRequest(id: string, data: ApiRecord): Promise<ApiRecord>;
|
|
3361
3369
|
submitFeedback(message: string, category?: string, email?: string): Promise<{
|
|
3362
3370
|
feedback_id: string;
|
|
3363
3371
|
submitted_at: string;
|
|
@@ -3589,4 +3597,16 @@ type WorkItemStatus = (typeof WorkItemStatus)[number];
|
|
|
3589
3597
|
declare const WorkflowType: readonly ["transfer", "fundraising"];
|
|
3590
3598
|
type WorkflowType = (typeof WorkflowType)[number];
|
|
3591
3599
|
|
|
3592
|
-
|
|
3600
|
+
declare function generateFernetKey(): string;
|
|
3601
|
+
declare function generateSecret(length?: number): string;
|
|
3602
|
+
declare function loadEnvFile(path: string): void;
|
|
3603
|
+
declare function ensureEnvFile(envPath: string): void;
|
|
3604
|
+
|
|
3605
|
+
declare function resolveBinaryPath(processUrl: string): string;
|
|
3606
|
+
interface ProcessRequestOptions {
|
|
3607
|
+
dataDir?: string;
|
|
3608
|
+
}
|
|
3609
|
+
declare function processRequest(processUrl: string, method: string, pathWithQuery: string, headers: Record<string, string>, body?: string, options?: ProcessRequestOptions): Response;
|
|
3610
|
+
declare function resetCache(): void;
|
|
3611
|
+
|
|
3612
|
+
export { type AcceptEquityRoundRequest, type AcceptRoundRequest, AccountType, type AddFounderRequest, type AddFounderResponse, type AddSecurityRequest, type AgendaItemResponse, AgendaItemStatus, AgendaItemType, type AgentResponse, AgentStatus, AntiDilutionMethod, type ApiRecord, type ApplyEquityRoundTermsRequest, type ApplyRoundTermsRequest, AssigneeType, type AttachResolutionDocumentRequest, AuthoritySource, AuthorityTier, BankAccountStatus, BankAccountType, type BoardApproveEquityRoundRequest, type BoardApproveRoundRequest, BodyStatus, BodyType, CapTableAccess, CapTableBasis, type CapTableHolderSummary, type CapTableInstrument, type CapTableInstrumentSummary, type CapTableResponse, type CastVoteRequest, ClassificationResult, type ComputeResolutionRequest, ContactCategory, type ContactProfileResponse, type ContactResponse, ContactStatus, ContactType, ContractStatus, ContractTemplateType, ControlType, type ConveneMeetingRequest, type ConvertEntityRequest, CorpAPIClient, type CorpConfig, type CreateAgentRequest, type CreateContactRequest, type CreateEquityRoundRequest, type CreateExecutionIntentRequest, type CreateFormationRequest, type CreatePendingFormationRequest, type CreateRoundRequest, Currency, DeadlineSeverity, DeadlineStatus, type DigestSummary, type DigestTriggerResponse, type DissolveEntityRequest, DistributionStatus, DistributionType, DocumentRequestStatus, type DocumentResponse, DocumentStatus, type DocumentSummary, DocumentType, EntityType, type EquityRoundResponse, EquityRoundStatus, EscalationStatus, type ExecuteRoundConversionRequest, type FinalizeAgendaItemRequest, type FormationGatesResponse, type FormationResponse, FormationState, FormationStatus, type FormationStatusResponse, type FormationWithCapTableResponse, GENERATED_TOOL_DEFINITIONS, GlAccountCode, GovernanceAuditEventType, type GovernanceBodyResponse, GovernanceMode, type GovernanceSeatResponse, GovernanceTriggerSource, GovernanceTriggerType, GoverningDocType, GrantType, HolderType, HttpMethod, IncidentSeverity, IncidentStatus, InstrumentKind, InstrumentStatus, type IntentResponse, IntentStatus, InvestorType, type InvoiceResponse, InvoiceStatus, type IssueStagedRoundResponse, JournalEntryStatus, type LLMResponse, LegalEntityRole, type MeetingResponse, MeetingStatus, MeetingType, MemberRole, NetworkEgress, type ObligationResponse, ObligationStatus, type ObligationsSummaryResponse, OfficerTitle, PaymentMethod, PaymentStatus, PayrollStatus, type PendingFormationResponse, PositionStatus, type PreviewRoundConversionRequest, type ProcessRequestOptions, QuorumStatus, QuorumThreshold, READ_ONLY_TOOLS, ReceiptStatus, ReconciliationStatus, Recurrence, ReferenceKind, type ResolutionResponse, ResolutionType, RiskLevel, type RoundResponse, SYSTEM_PROMPT_BASE, SafeStatus, SafeType, type ScheduleMeetingRequest, Scope, SeatRole, SeatStatus, SessionExpiredError, Side, type StartStagedRoundRequest, TOOL_DEFINITIONS, TOOL_REGISTRY, TaxFilingStatus, type ToolCall, type ToolContext, TransactionPacketStatus, TransferStatus, TransferType, TransfereeRights, Transport, type UpdateAgentRequest, type UpdateContactRequest, ValuationMethodology, ValuationStatus, ValuationType, type VoteResponse, VoteValue, VotingMethod, WorkItemActorTypeValue, WorkItemStatus, WorkflowType, type WorkspaceContactSummary, type WorkspaceEntitySummary, type WorkspaceStatusResponse, type WrittenConsentRequest, type WrittenConsentResponse, describeToolCall, ensureEnvFile, ensureSafeInstrument, executeTool, formatConfigSection, generateFernetKey, generateSecret, isWriteTool, loadEnvFile, processRequest, provisionWorkspace, resetCache, resolveBinaryPath };
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,235 @@
|
|
|
1
|
+
// src/process-transport.ts
|
|
2
|
+
import { execFileSync } from "child_process";
|
|
3
|
+
import { existsSync as existsSync2, readFileSync as readFileSync2 } from "fs";
|
|
4
|
+
import { resolve, join } from "path";
|
|
5
|
+
import { homedir } from "os";
|
|
6
|
+
import { createRequire } from "module";
|
|
7
|
+
|
|
8
|
+
// src/env.ts
|
|
9
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
10
|
+
import { randomBytes } from "crypto";
|
|
11
|
+
var ENV_TEMPLATE = `# Corporation API server configuration
|
|
12
|
+
# Generated by: corp serve
|
|
13
|
+
|
|
14
|
+
# Required \u2014 secret for signing JWTs
|
|
15
|
+
JWT_SECRET={{JWT_SECRET}}
|
|
16
|
+
|
|
17
|
+
# Required \u2014 Fernet key for encrypting secrets at rest (base64url, 32 bytes)
|
|
18
|
+
SECRETS_MASTER_KEY={{SECRETS_MASTER_KEY}}
|
|
19
|
+
|
|
20
|
+
# Required \u2014 bearer token for internal worker-to-server auth
|
|
21
|
+
INTERNAL_WORKER_TOKEN={{INTERNAL_WORKER_TOKEN}}
|
|
22
|
+
|
|
23
|
+
# Server port (default: 8000)
|
|
24
|
+
# PORT=8000
|
|
25
|
+
|
|
26
|
+
# Data directory for git repos (default: ./data/repos)
|
|
27
|
+
# DATA_DIR=./data/repos
|
|
28
|
+
|
|
29
|
+
# Redis URL for agent job queue (optional)
|
|
30
|
+
# REDIS_URL=redis://localhost:6379/0
|
|
31
|
+
|
|
32
|
+
# LLM proxy upstream (default: https://openrouter.ai/api/v1)
|
|
33
|
+
# LLM_UPSTREAM_URL=https://openrouter.ai/api/v1
|
|
34
|
+
|
|
35
|
+
# PEM-encoded Ed25519 key for signing git commits (optional)
|
|
36
|
+
# COMMIT_SIGNING_KEY=
|
|
37
|
+
|
|
38
|
+
# Max agent queue depth (default: 1000)
|
|
39
|
+
# MAX_QUEUE_DEPTH=1000
|
|
40
|
+
`;
|
|
41
|
+
function generateFernetKey() {
|
|
42
|
+
return randomBytes(32).toString("base64url") + "=";
|
|
43
|
+
}
|
|
44
|
+
function generateSecret(length = 32) {
|
|
45
|
+
return randomBytes(length).toString("hex");
|
|
46
|
+
}
|
|
47
|
+
function loadEnvFile(path) {
|
|
48
|
+
if (!existsSync(path)) return;
|
|
49
|
+
const content = readFileSync(path, "utf-8");
|
|
50
|
+
for (const line of content.split("\n")) {
|
|
51
|
+
const trimmed = line.trim();
|
|
52
|
+
if (!trimmed || trimmed.startsWith("#")) continue;
|
|
53
|
+
const eqIdx = trimmed.indexOf("=");
|
|
54
|
+
if (eqIdx === -1) continue;
|
|
55
|
+
const key = trimmed.slice(0, eqIdx).trim();
|
|
56
|
+
const value = trimmed.slice(eqIdx + 1).trim().replace(/^["']|["']$/g, "");
|
|
57
|
+
if (!process.env[key]) {
|
|
58
|
+
process.env[key] = value;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function ensureEnvFile(envPath) {
|
|
63
|
+
if (existsSync(envPath)) return;
|
|
64
|
+
console.log("No .env file found. Generating one with dev defaults...\n");
|
|
65
|
+
const content = ENV_TEMPLATE.replace("{{JWT_SECRET}}", generateSecret()).replace("{{SECRETS_MASTER_KEY}}", generateFernetKey()).replace("{{INTERNAL_WORKER_TOKEN}}", generateSecret());
|
|
66
|
+
writeFileSync(envPath, content, "utf-8");
|
|
67
|
+
console.log(` Created ${envPath}
|
|
68
|
+
`);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/process-transport.ts
|
|
72
|
+
var require2 = createRequire(import.meta.url);
|
|
73
|
+
var cachedBinaryPath;
|
|
74
|
+
function resolveBinaryPath(processUrl) {
|
|
75
|
+
if (cachedBinaryPath !== void 0) return cachedBinaryPath;
|
|
76
|
+
const parsed = new URL(processUrl);
|
|
77
|
+
if (parsed.pathname && parsed.pathname !== "/") {
|
|
78
|
+
cachedBinaryPath = parsed.pathname;
|
|
79
|
+
return cachedBinaryPath;
|
|
80
|
+
}
|
|
81
|
+
const envBin = process.env.CORP_SERVER_BIN;
|
|
82
|
+
if (envBin && existsSync2(envBin)) {
|
|
83
|
+
cachedBinaryPath = envBin;
|
|
84
|
+
return cachedBinaryPath;
|
|
85
|
+
}
|
|
86
|
+
try {
|
|
87
|
+
const server = require2("@thecorporation/server");
|
|
88
|
+
const pkgPath = server.getBinaryPath?.();
|
|
89
|
+
if (pkgPath) {
|
|
90
|
+
cachedBinaryPath = pkgPath;
|
|
91
|
+
return pkgPath;
|
|
92
|
+
}
|
|
93
|
+
} catch {
|
|
94
|
+
}
|
|
95
|
+
cachedBinaryPath = resolve("services/api-rs/target/release/api-rs");
|
|
96
|
+
return cachedBinaryPath;
|
|
97
|
+
}
|
|
98
|
+
function parseStatusFromStderr(stderr) {
|
|
99
|
+
const lines = stderr.split("\n");
|
|
100
|
+
for (let i = lines.length - 1; i >= 0; i--) {
|
|
101
|
+
const match = lines[i].match(/^HTTP (\d+)$/);
|
|
102
|
+
if (match) return parseInt(match[1], 10);
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
var STATUS_TEXT = {
|
|
107
|
+
200: "OK",
|
|
108
|
+
201: "Created",
|
|
109
|
+
204: "No Content",
|
|
110
|
+
400: "Bad Request",
|
|
111
|
+
401: "Unauthorized",
|
|
112
|
+
403: "Forbidden",
|
|
113
|
+
404: "Not Found",
|
|
114
|
+
409: "Conflict",
|
|
115
|
+
422: "Unprocessable Entity",
|
|
116
|
+
500: "Internal Server Error"
|
|
117
|
+
};
|
|
118
|
+
function buildProcessResponse(status, body) {
|
|
119
|
+
return {
|
|
120
|
+
status,
|
|
121
|
+
ok: status >= 200 && status < 300,
|
|
122
|
+
statusText: STATUS_TEXT[status] ?? String(status),
|
|
123
|
+
headers: new Headers({ "content-type": "application/json" }),
|
|
124
|
+
json: async () => JSON.parse(body),
|
|
125
|
+
text: async () => body,
|
|
126
|
+
body: null,
|
|
127
|
+
bodyUsed: false,
|
|
128
|
+
redirected: false,
|
|
129
|
+
type: "basic",
|
|
130
|
+
url: "",
|
|
131
|
+
clone: () => buildProcessResponse(status, body),
|
|
132
|
+
arrayBuffer: async () => new TextEncoder().encode(body).buffer,
|
|
133
|
+
blob: async () => new Blob([body]),
|
|
134
|
+
formData: async () => {
|
|
135
|
+
throw new Error("not supported");
|
|
136
|
+
},
|
|
137
|
+
bytes: async () => new TextEncoder().encode(body)
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
var CORP_CONFIG_DIR = process.env.CORP_CONFIG_DIR || join(homedir(), ".corp");
|
|
141
|
+
function readJsonFileSafe(path) {
|
|
142
|
+
try {
|
|
143
|
+
if (!existsSync2(path)) return null;
|
|
144
|
+
return JSON.parse(readFileSync2(path, "utf-8"));
|
|
145
|
+
} catch {
|
|
146
|
+
return null;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function loadServerSecretsFromAuth() {
|
|
150
|
+
const auth = readJsonFileSafe(join(CORP_CONFIG_DIR, "auth.json"));
|
|
151
|
+
if (!auth) return null;
|
|
152
|
+
const ss = auth.server_secrets;
|
|
153
|
+
if (!ss || typeof ss !== "object") return null;
|
|
154
|
+
const s = ss;
|
|
155
|
+
if (typeof s.jwt_secret === "string" && typeof s.secrets_master_key === "string" && typeof s.internal_worker_token === "string") {
|
|
156
|
+
return { jwt_secret: s.jwt_secret, secrets_master_key: s.secrets_master_key, internal_worker_token: s.internal_worker_token };
|
|
157
|
+
}
|
|
158
|
+
return null;
|
|
159
|
+
}
|
|
160
|
+
function loadDataDirFromConfig() {
|
|
161
|
+
const cfg = readJsonFileSafe(join(CORP_CONFIG_DIR, "config.json"));
|
|
162
|
+
if (!cfg) return void 0;
|
|
163
|
+
const dataDir = typeof cfg.data_dir === "string" ? cfg.data_dir : void 0;
|
|
164
|
+
return dataDir || void 0;
|
|
165
|
+
}
|
|
166
|
+
var envLoaded = false;
|
|
167
|
+
function ensureEnv() {
|
|
168
|
+
if (envLoaded) return;
|
|
169
|
+
const secrets = loadServerSecretsFromAuth();
|
|
170
|
+
if (secrets) {
|
|
171
|
+
if (!process.env.JWT_SECRET) process.env.JWT_SECRET = secrets.jwt_secret;
|
|
172
|
+
if (!process.env.SECRETS_MASTER_KEY) process.env.SECRETS_MASTER_KEY = secrets.secrets_master_key;
|
|
173
|
+
if (!process.env.INTERNAL_WORKER_TOKEN) process.env.INTERNAL_WORKER_TOKEN = secrets.internal_worker_token;
|
|
174
|
+
envLoaded = true;
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const envPath = resolve(process.cwd(), ".env");
|
|
178
|
+
ensureEnvFile(envPath);
|
|
179
|
+
loadEnvFile(envPath);
|
|
180
|
+
envLoaded = true;
|
|
181
|
+
}
|
|
182
|
+
function processRequest(processUrl, method, pathWithQuery, headers, body, options) {
|
|
183
|
+
ensureEnv();
|
|
184
|
+
const binPath = resolveBinaryPath(processUrl);
|
|
185
|
+
const args = ["--skip-validation", "call"];
|
|
186
|
+
const dataDir = options?.dataDir ?? loadDataDirFromConfig();
|
|
187
|
+
if (dataDir) {
|
|
188
|
+
args.push("--data-dir", dataDir);
|
|
189
|
+
}
|
|
190
|
+
args.push(method, pathWithQuery);
|
|
191
|
+
for (const [key, value] of Object.entries(headers)) {
|
|
192
|
+
args.push("-H", `${key}: ${value}`);
|
|
193
|
+
}
|
|
194
|
+
if (body) {
|
|
195
|
+
args.push("--stdin");
|
|
196
|
+
}
|
|
197
|
+
try {
|
|
198
|
+
const stdout = execFileSync(binPath, args, {
|
|
199
|
+
input: body ?? void 0,
|
|
200
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
201
|
+
maxBuffer: 10 * 1024 * 1024,
|
|
202
|
+
env: process.env
|
|
203
|
+
});
|
|
204
|
+
return buildProcessResponse(200, stdout.toString("utf-8"));
|
|
205
|
+
} catch (err) {
|
|
206
|
+
const execErr = err;
|
|
207
|
+
if (execErr.stdout === void 0 && execErr.stderr === void 0) {
|
|
208
|
+
throw new Error(
|
|
209
|
+
`No api-rs binary found. Install @thecorporation/server or set CORP_SERVER_BIN.
|
|
210
|
+
Attempted: ${binPath}
|
|
211
|
+
Error: ${execErr.message ?? String(err)}`
|
|
212
|
+
);
|
|
213
|
+
}
|
|
214
|
+
const stderr = execErr.stderr?.toString("utf-8") ?? "";
|
|
215
|
+
const stdout = execErr.stdout?.toString("utf-8") ?? "";
|
|
216
|
+
const status = parseStatusFromStderr(stderr);
|
|
217
|
+
if (status !== null) {
|
|
218
|
+
return buildProcessResponse(status, stdout);
|
|
219
|
+
}
|
|
220
|
+
const isConfigError = stderr.includes("panic") || stderr.includes("INTERNAL_WORKER_TOKEN") || stderr.includes("JWT_SECRET") || stderr.includes("SECRETS_MASTER_KEY");
|
|
221
|
+
if (isConfigError) {
|
|
222
|
+
throw new Error("Server configuration incomplete. Run 'corp setup' to configure local mode.");
|
|
223
|
+
}
|
|
224
|
+
throw new Error(`api-rs process failed:
|
|
225
|
+
${stderr || stdout || String(err)}`);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
function resetCache() {
|
|
229
|
+
cachedBinaryPath = void 0;
|
|
230
|
+
envLoaded = false;
|
|
231
|
+
}
|
|
232
|
+
|
|
1
233
|
// src/api-client.ts
|
|
2
234
|
var SessionExpiredError = class extends Error {
|
|
3
235
|
constructor() {
|
|
@@ -51,7 +283,7 @@ var CorpAPIClient = class {
|
|
|
51
283
|
apiKey;
|
|
52
284
|
workspaceId;
|
|
53
285
|
constructor(apiUrl, apiKey, workspaceId) {
|
|
54
|
-
this.apiUrl = apiUrl.replace(/\/+$/, "");
|
|
286
|
+
this.apiUrl = apiUrl.startsWith("process://") ? apiUrl : apiUrl.replace(/\/+$/, "");
|
|
55
287
|
this.apiKey = apiKey;
|
|
56
288
|
this.workspaceId = workspaceId;
|
|
57
289
|
}
|
|
@@ -63,11 +295,17 @@ var CorpAPIClient = class {
|
|
|
63
295
|
};
|
|
64
296
|
}
|
|
65
297
|
async request(method, path, body, params) {
|
|
66
|
-
let
|
|
298
|
+
let fullPath = path;
|
|
67
299
|
if (params) {
|
|
68
300
|
const qs = new URLSearchParams(params).toString();
|
|
69
|
-
if (qs)
|
|
301
|
+
if (qs) fullPath += `?${qs}`;
|
|
70
302
|
}
|
|
303
|
+
if (this.apiUrl.startsWith("process://")) {
|
|
304
|
+
const hdrs = this.headers();
|
|
305
|
+
const bodyStr = body !== void 0 ? JSON.stringify(body) : void 0;
|
|
306
|
+
return processRequest(this.apiUrl, method, fullPath, hdrs, bodyStr);
|
|
307
|
+
}
|
|
308
|
+
const url = `${this.apiUrl}${fullPath}`;
|
|
71
309
|
const opts = { method, headers: this.headers() };
|
|
72
310
|
if (body !== void 0) opts.body = JSON.stringify(body);
|
|
73
311
|
return fetch(url, opts);
|
|
@@ -313,6 +551,9 @@ var CorpAPIClient = class {
|
|
|
313
551
|
return { entity_id: entityId, document_id: documentId };
|
|
314
552
|
}
|
|
315
553
|
getPreviewPdfUrl(entityId, documentId) {
|
|
554
|
+
if (this.apiUrl.startsWith("process://")) {
|
|
555
|
+
throw new Error("getPreviewPdfUrl is not available in process transport mode \u2014 use validatePreviewPdf() and fetch the PDF via the API instead");
|
|
556
|
+
}
|
|
316
557
|
const qs = new URLSearchParams({ entity_id: entityId, document_id: documentId }).toString();
|
|
317
558
|
return `${this.apiUrl}/v1/documents/preview/pdf?${qs}`;
|
|
318
559
|
}
|
|
@@ -524,6 +765,28 @@ var CorpAPIClient = class {
|
|
|
524
765
|
getConfig() {
|
|
525
766
|
return this.get("/v1/config");
|
|
526
767
|
}
|
|
768
|
+
// --- Services ---
|
|
769
|
+
listServiceCatalog() {
|
|
770
|
+
return this.get("/v1/services/catalog");
|
|
771
|
+
}
|
|
772
|
+
createServiceRequest(data) {
|
|
773
|
+
return this.post("/v1/services/requests", data);
|
|
774
|
+
}
|
|
775
|
+
getServiceRequest(id, entityId) {
|
|
776
|
+
return this.get(`/v1/services/requests/${pathSegment(id)}`, { entity_id: entityId });
|
|
777
|
+
}
|
|
778
|
+
listServiceRequests(entityId) {
|
|
779
|
+
return this.get(`/v1/entities/${pathSegment(entityId)}/service-requests`);
|
|
780
|
+
}
|
|
781
|
+
beginServiceCheckout(id, data) {
|
|
782
|
+
return this.post(`/v1/services/requests/${pathSegment(id)}/checkout`, data);
|
|
783
|
+
}
|
|
784
|
+
fulfillServiceRequest(id, data) {
|
|
785
|
+
return this.post(`/v1/services/requests/${pathSegment(id)}/fulfill`, data);
|
|
786
|
+
}
|
|
787
|
+
cancelServiceRequest(id, data) {
|
|
788
|
+
return this.post(`/v1/services/requests/${pathSegment(id)}/cancel`, data);
|
|
789
|
+
}
|
|
527
790
|
// --- Feedback ---
|
|
528
791
|
submitFeedback(message, category, email) {
|
|
529
792
|
return this.post("/v1/feedback", { message, category, email });
|
|
@@ -540,8 +803,8 @@ var CorpAPIClient = class {
|
|
|
540
803
|
};
|
|
541
804
|
|
|
542
805
|
// src/tools.ts
|
|
543
|
-
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "fs";
|
|
544
|
-
import { join } from "path";
|
|
806
|
+
import { readFileSync as readFileSync3, writeFileSync as writeFileSync2, mkdirSync, existsSync as existsSync3 } from "fs";
|
|
807
|
+
import { join as join2 } from "path";
|
|
545
808
|
|
|
546
809
|
// src/tool-defs.generated.ts
|
|
547
810
|
var GENERATED_TOOL_DEFINITIONS = [
|
|
@@ -1472,14 +1735,14 @@ var documentActions = {
|
|
|
1472
1735
|
};
|
|
1473
1736
|
var checklistActions = {
|
|
1474
1737
|
get: async (_args, _client, ctx) => {
|
|
1475
|
-
const path =
|
|
1476
|
-
if (
|
|
1738
|
+
const path = join2(ctx.dataDir, "checklist.md");
|
|
1739
|
+
if (existsSync3(path)) return { checklist: readFileSync3(path, "utf-8") };
|
|
1477
1740
|
return { checklist: null, message: "No checklist yet." };
|
|
1478
1741
|
},
|
|
1479
1742
|
update: async (args, _client, ctx) => {
|
|
1480
|
-
const path =
|
|
1743
|
+
const path = join2(ctx.dataDir, "checklist.md");
|
|
1481
1744
|
mkdirSync(ctx.dataDir, { recursive: true });
|
|
1482
|
-
|
|
1745
|
+
writeFileSync2(path, args.checklist);
|
|
1483
1746
|
return { status: "updated", checklist: args.checklist };
|
|
1484
1747
|
}
|
|
1485
1748
|
};
|
|
@@ -2073,10 +2336,17 @@ export {
|
|
|
2073
2336
|
WorkItemStatus,
|
|
2074
2337
|
WorkflowType,
|
|
2075
2338
|
describeToolCall,
|
|
2339
|
+
ensureEnvFile,
|
|
2076
2340
|
ensureSafeInstrument,
|
|
2077
2341
|
executeTool,
|
|
2078
2342
|
formatConfigSection,
|
|
2343
|
+
generateFernetKey,
|
|
2344
|
+
generateSecret,
|
|
2079
2345
|
isWriteTool,
|
|
2080
|
-
|
|
2346
|
+
loadEnvFile,
|
|
2347
|
+
processRequest,
|
|
2348
|
+
provisionWorkspace,
|
|
2349
|
+
resetCache,
|
|
2350
|
+
resolveBinaryPath
|
|
2081
2351
|
};
|
|
2082
2352
|
//# sourceMappingURL=index.js.map
|