@elevasis/sdk 0.7.7 → 0.7.9
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/cli.cjs
CHANGED
|
@@ -43883,7 +43883,7 @@ function wrapAction(commandName, fn) {
|
|
|
43883
43883
|
// package.json
|
|
43884
43884
|
var package_default = {
|
|
43885
43885
|
name: "@elevasis/sdk",
|
|
43886
|
-
version: "0.7.
|
|
43886
|
+
version: "0.7.9",
|
|
43887
43887
|
description: "SDK for building Elevasis organization resources",
|
|
43888
43888
|
type: "module",
|
|
43889
43889
|
bin: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1777,6 +1777,7 @@ type Database = {
|
|
|
1777
1777
|
expires_at: string | null;
|
|
1778
1778
|
human_checkpoint: string | null;
|
|
1779
1779
|
id: string;
|
|
1780
|
+
idempotency_key: string | null;
|
|
1780
1781
|
metadata: Json | null;
|
|
1781
1782
|
organization_id: string;
|
|
1782
1783
|
origin_execution_id: string;
|
|
@@ -1798,6 +1799,7 @@ type Database = {
|
|
|
1798
1799
|
expires_at?: string | null;
|
|
1799
1800
|
human_checkpoint?: string | null;
|
|
1800
1801
|
id?: string;
|
|
1802
|
+
idempotency_key?: string | null;
|
|
1801
1803
|
metadata?: Json | null;
|
|
1802
1804
|
organization_id: string;
|
|
1803
1805
|
origin_execution_id: string;
|
|
@@ -1819,6 +1821,7 @@ type Database = {
|
|
|
1819
1821
|
expires_at?: string | null;
|
|
1820
1822
|
human_checkpoint?: string | null;
|
|
1821
1823
|
id?: string;
|
|
1824
|
+
idempotency_key?: string | null;
|
|
1822
1825
|
metadata?: Json | null;
|
|
1823
1826
|
organization_id?: string;
|
|
1824
1827
|
origin_execution_id?: string;
|
|
@@ -3342,6 +3345,7 @@ interface CompanyEnrichmentData {
|
|
|
3342
3345
|
scrapedAt?: string;
|
|
3343
3346
|
};
|
|
3344
3347
|
websiteCrawl?: {
|
|
3348
|
+
companyDescription?: string;
|
|
3345
3349
|
services?: string[];
|
|
3346
3350
|
specialties?: string[];
|
|
3347
3351
|
staff?: Array<{
|
|
@@ -3349,8 +3353,16 @@ interface CompanyEnrichmentData {
|
|
|
3349
3353
|
title?: string;
|
|
3350
3354
|
email?: string;
|
|
3351
3355
|
}>;
|
|
3356
|
+
automationGaps?: string[];
|
|
3357
|
+
targetAudience?: string;
|
|
3358
|
+
category?: string;
|
|
3359
|
+
segment?: string;
|
|
3360
|
+
recentWin?: string;
|
|
3352
3361
|
emailCount?: number;
|
|
3362
|
+
pageCount?: number;
|
|
3363
|
+
totalChars?: number;
|
|
3353
3364
|
crawledAt?: string;
|
|
3365
|
+
extractedAt?: string;
|
|
3354
3366
|
};
|
|
3355
3367
|
website?: {
|
|
3356
3368
|
missionVision?: string;
|
|
@@ -6128,6 +6140,7 @@ type ApprovalToolMap = {
|
|
|
6128
6140
|
humanCheckpoint?: string;
|
|
6129
6141
|
metadata?: Record<string, unknown>;
|
|
6130
6142
|
expiresAt?: string;
|
|
6143
|
+
idempotencyKey?: string;
|
|
6131
6144
|
};
|
|
6132
6145
|
result: {
|
|
6133
6146
|
id: string;
|
package/dist/worker/index.js
CHANGED
|
@@ -5025,6 +5025,35 @@ var execution = createAdapter("execution", ["trigger", "triggerAsync"]);
|
|
|
5025
5025
|
var email = createAdapter("email", ["send"]);
|
|
5026
5026
|
|
|
5027
5027
|
// src/worker/index.ts
|
|
5028
|
+
function captureConsole(executionId, logs) {
|
|
5029
|
+
const origLog = console.log;
|
|
5030
|
+
const origWarn = console.warn;
|
|
5031
|
+
const origError = console.error;
|
|
5032
|
+
const postLog = (level, message, logContext) => {
|
|
5033
|
+
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5034
|
+
const entry = { level, message, timestamp, context: logContext };
|
|
5035
|
+
logs.push(entry);
|
|
5036
|
+
parentPort.postMessage({
|
|
5037
|
+
type: "log",
|
|
5038
|
+
entry: { level, message, timestamp, executionId, context: logContext }
|
|
5039
|
+
});
|
|
5040
|
+
};
|
|
5041
|
+
const capture = (level, orig) => (...args) => {
|
|
5042
|
+
postLog(level, args.map(String).join(" "));
|
|
5043
|
+
orig(...args);
|
|
5044
|
+
};
|
|
5045
|
+
console.log = capture("info", origLog);
|
|
5046
|
+
console.warn = capture("warn", origWarn);
|
|
5047
|
+
console.error = capture("error", origError);
|
|
5048
|
+
return {
|
|
5049
|
+
restore: () => {
|
|
5050
|
+
console.log = origLog;
|
|
5051
|
+
console.warn = origWarn;
|
|
5052
|
+
console.error = origError;
|
|
5053
|
+
},
|
|
5054
|
+
postLog
|
|
5055
|
+
};
|
|
5056
|
+
}
|
|
5028
5057
|
function resolveNext(next, data) {
|
|
5029
5058
|
if (next === null) return null;
|
|
5030
5059
|
if (next.type === "linear") return next.target;
|
|
@@ -5051,25 +5080,7 @@ function serializeNext(next) {
|
|
|
5051
5080
|
}
|
|
5052
5081
|
async function executeWorkflow(workflow, input, context) {
|
|
5053
5082
|
const logs = [];
|
|
5054
|
-
const postLog = (
|
|
5055
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5056
|
-
const entry = { level, message, timestamp, context: logContext };
|
|
5057
|
-
logs.push(entry);
|
|
5058
|
-
parentPort.postMessage({
|
|
5059
|
-
type: "log",
|
|
5060
|
-
entry: { level, message, timestamp, executionId: context.executionId, context: logContext }
|
|
5061
|
-
});
|
|
5062
|
-
};
|
|
5063
|
-
const origLog = console.log;
|
|
5064
|
-
const origWarn = console.warn;
|
|
5065
|
-
const origError = console.error;
|
|
5066
|
-
const capture = (level, orig) => (...args) => {
|
|
5067
|
-
postLog(level, args.map(String).join(" "));
|
|
5068
|
-
orig(...args);
|
|
5069
|
-
};
|
|
5070
|
-
console.log = capture("info", origLog);
|
|
5071
|
-
console.warn = capture("warn", origWarn);
|
|
5072
|
-
console.error = capture("error", origError);
|
|
5083
|
+
const { restore, postLog } = captureConsole(context.executionId, logs);
|
|
5073
5084
|
try {
|
|
5074
5085
|
let currentData = workflow.contract.inputSchema ? workflow.contract.inputSchema.parse(input) : input;
|
|
5075
5086
|
let stepId = workflow.entryPoint;
|
|
@@ -5149,9 +5160,7 @@ async function executeWorkflow(workflow, input, context) {
|
|
|
5149
5160
|
}
|
|
5150
5161
|
return { output: currentData, logs };
|
|
5151
5162
|
} finally {
|
|
5152
|
-
|
|
5153
|
-
console.warn = origWarn;
|
|
5154
|
-
console.error = origError;
|
|
5163
|
+
restore();
|
|
5155
5164
|
}
|
|
5156
5165
|
}
|
|
5157
5166
|
function buildWorkerExecutionContext(params) {
|
|
@@ -5307,25 +5316,7 @@ function startWorker(org) {
|
|
|
5307
5316
|
const agentDef = agents.get(resourceId);
|
|
5308
5317
|
if (agentDef) {
|
|
5309
5318
|
const logs = [];
|
|
5310
|
-
const
|
|
5311
|
-
const origWarn = console.warn;
|
|
5312
|
-
const origError = console.error;
|
|
5313
|
-
const postLog = (level, message) => {
|
|
5314
|
-
const timestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
5315
|
-
const entry = { level, message, timestamp };
|
|
5316
|
-
logs.push(entry);
|
|
5317
|
-
parentPort.postMessage({
|
|
5318
|
-
type: "log",
|
|
5319
|
-
entry: { level, message, timestamp, executionId }
|
|
5320
|
-
});
|
|
5321
|
-
};
|
|
5322
|
-
const capture = (level, orig) => (...args) => {
|
|
5323
|
-
postLog(level, args.map(String).join(" "));
|
|
5324
|
-
orig(...args);
|
|
5325
|
-
};
|
|
5326
|
-
console.log = capture("info", origLog);
|
|
5327
|
-
console.warn = capture("warn", origWarn);
|
|
5328
|
-
console.error = capture("error", origError);
|
|
5319
|
+
const { restore } = captureConsole(executionId, logs);
|
|
5329
5320
|
const startTime = Date.now();
|
|
5330
5321
|
try {
|
|
5331
5322
|
console.log(`[SDK-WORKER] Running agent '${resourceId}' (${agentDef.tools.length} tools)`);
|
|
@@ -5360,9 +5351,7 @@ function startWorker(org) {
|
|
|
5360
5351
|
metrics: { durationMs }
|
|
5361
5352
|
});
|
|
5362
5353
|
} finally {
|
|
5363
|
-
|
|
5364
|
-
console.warn = origWarn;
|
|
5365
|
-
console.error = origError;
|
|
5354
|
+
restore();
|
|
5366
5355
|
}
|
|
5367
5356
|
return;
|
|
5368
5357
|
}
|
package/package.json
CHANGED
|
@@ -52,7 +52,7 @@ All adapters are imported from `@elevasis/sdk/worker` -- the same subpath as `pl
|
|
|
52
52
|
|
|
53
53
|
| Import | Methods |
|
|
54
54
|
| --------------- | ------- |
|
|
55
|
-
| `
|
|
55
|
+
| `acqDb` | 35 |
|
|
56
56
|
| `scheduler` | 9 |
|
|
57
57
|
| `storage` | 5 |
|
|
58
58
|
| `pdf` | 2 |
|
|
@@ -77,7 +77,7 @@ import {
|
|
|
77
77
|
createApifyAdapter, createGmailAdapter, createMailsoAdapter,
|
|
78
78
|
createTombaAdapter,
|
|
79
79
|
// Platform adapters
|
|
80
|
-
|
|
80
|
+
acqDb, scheduler, storage, pdf, approval, notifications, llm, execution, email,
|
|
81
81
|
// Generic factory
|
|
82
82
|
createAdapter,
|
|
83
83
|
} from '@elevasis/sdk/worker'
|
|
@@ -601,12 +601,12 @@ const { category, confidence, summary } = response.output
|
|
|
601
601
|
|
|
602
602
|
---
|
|
603
603
|
|
|
604
|
-
##
|
|
604
|
+
## AcqDb Adapter
|
|
605
605
|
|
|
606
|
-
Singleton -- 35 methods for acquisition
|
|
606
|
+
Singleton -- 35 methods for acquisition database management (lists, companies, contacts, deals, deal-sync). `organizationId` is injected server-side -- never pass it.
|
|
607
607
|
|
|
608
608
|
```typescript
|
|
609
|
-
import {
|
|
609
|
+
import { acqDb } from '@elevasis/sdk/worker'
|
|
610
610
|
```
|
|
611
611
|
|
|
612
612
|
### Methods
|
|
@@ -674,16 +674,16 @@ import { lead } from '@elevasis/sdk/worker'
|
|
|
674
674
|
### Example
|
|
675
675
|
|
|
676
676
|
```typescript
|
|
677
|
-
const deal = await
|
|
677
|
+
const deal = await acqDb.getDealByEmail({ email: 'jane@acme.com' })
|
|
678
678
|
if (!deal) {
|
|
679
|
-
await
|
|
679
|
+
await acqDb.upsertDeal({
|
|
680
680
|
attioDealId: 'deal-123',
|
|
681
681
|
contactEmail: 'jane@acme.com',
|
|
682
682
|
})
|
|
683
683
|
}
|
|
684
684
|
|
|
685
685
|
// Bulk import contacts
|
|
686
|
-
await
|
|
686
|
+
await acqDb.bulkImportContacts({
|
|
687
687
|
listId: 'list-abc',
|
|
688
688
|
contacts: [
|
|
689
689
|
{ email: 'a@example.com', firstName: 'Alice' },
|
|
@@ -30,7 +30,7 @@ const result = await llm.generate({ messages: [...] })
|
|
|
30
30
|
import { platform } from '@elevasis/sdk/worker'
|
|
31
31
|
|
|
32
32
|
const result = await platform.call({
|
|
33
|
-
tool: '
|
|
33
|
+
tool: 'acqDb', // tool name
|
|
34
34
|
method: 'upsertDeal', // method exposed by that tool
|
|
35
35
|
params: { ... }, // method-specific parameters
|
|
36
36
|
})
|
|
@@ -137,7 +137,7 @@ Nine built-in platform services are available without a `credential` field. All
|
|
|
137
137
|
|
|
138
138
|
| Tool Key | Methods | Purpose |
|
|
139
139
|
| -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------- |
|
|
140
|
-
| `
|
|
140
|
+
| `acqDb` | 35 methods (CRUD + sync) | Acquisition database -- `acqDb` singleton adapter |
|
|
141
141
|
| `email` | `send` | Send platform email to org members -- `email` singleton adapter |
|
|
142
142
|
| `storage` | `upload`, `download`, `createSignedUrl`, `delete`, `list` | File storage -- `storage` singleton adapter |
|
|
143
143
|
| `pdf` | `render`, `renderToBuffer` | PDF rendering -- `pdf` singleton adapter |
|