@elevasis/sdk 0.5.21 → 0.5.23
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 +78 -3
- package/dist/index.d.ts +651 -325
- package/dist/templates.js +74 -2
- package/dist/types/worker/adapters/instantly.d.ts +1 -1
- package/dist/types/worker/adapters/llm.d.ts +20 -2
- package/dist/worker/index.js +24 -3
- package/package.json +10 -10
package/dist/templates.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// package.json
|
|
2
2
|
|
|
3
3
|
// src/cli/commands/templates/core/workspace.ts
|
|
4
|
-
var TEMPLATE_VERSION =
|
|
4
|
+
var TEMPLATE_VERSION = 32;
|
|
5
5
|
function configTemplate() {
|
|
6
6
|
return `import type { ElevasConfig } from '@elevasis/sdk'
|
|
7
7
|
|
|
@@ -1744,6 +1744,77 @@ When all plan steps are marked COMPLETE, **suggest** completing the task -- neve
|
|
|
1744
1744
|
- Completed tasks move OUT of \`docs/in-progress/\` to \`docs/<relevant-dir>/\`
|
|
1745
1745
|
`;
|
|
1746
1746
|
}
|
|
1747
|
+
function claudeLoggingRuleTemplate() {
|
|
1748
|
+
return `---
|
|
1749
|
+
description: Logging conventions for workflow and agent handlers
|
|
1750
|
+
paths:
|
|
1751
|
+
- src/**
|
|
1752
|
+
---
|
|
1753
|
+
|
|
1754
|
+
# Logging
|
|
1755
|
+
|
|
1756
|
+
## Always Use \`context.logger\` in Handlers
|
|
1757
|
+
|
|
1758
|
+
**Never use \`console.log\`, \`console.warn\`, or \`console.error\` in step/agent handlers.**
|
|
1759
|
+
The platform does not capture \`console.*\` output \u2014 it will not appear in execution logs.
|
|
1760
|
+
|
|
1761
|
+
\`\`\`typescript
|
|
1762
|
+
// \u274C WRONG \u2014 invisible in Command Center
|
|
1763
|
+
handler: async (rawInput) => {
|
|
1764
|
+
console.log('Processing...')
|
|
1765
|
+
}
|
|
1766
|
+
|
|
1767
|
+
// \u2705 CORRECT \u2014 visible in Command Center
|
|
1768
|
+
handler: async (rawInput, context) => {
|
|
1769
|
+
context.logger.info('Processing...')
|
|
1770
|
+
}
|
|
1771
|
+
\`\`\`
|
|
1772
|
+
|
|
1773
|
+
## Logger Methods
|
|
1774
|
+
|
|
1775
|
+
\`\`\`typescript
|
|
1776
|
+
context.logger.debug('Verbose detail \u2014 shown in debug mode only')
|
|
1777
|
+
context.logger.info('Normal progress messages')
|
|
1778
|
+
context.logger.warn('Non-fatal issue \u2014 skipped, retried, partial result')
|
|
1779
|
+
context.logger.error('Fatal error or unexpected failure')
|
|
1780
|
+
\`\`\`
|
|
1781
|
+
|
|
1782
|
+
## Extensive Logging Standard
|
|
1783
|
+
|
|
1784
|
+
Every handler should log:
|
|
1785
|
+
|
|
1786
|
+
1. **Entry** \u2014 step name + key input params (category, count, domain, etc.)
|
|
1787
|
+
2. **Progress** \u2014 inside loops: per-item status (processed, skipped, failed)
|
|
1788
|
+
3. **Decisions** \u2014 idempotency skips, early exits, conditional branches
|
|
1789
|
+
4. **Summary** \u2014 counts at the end (X processed, Y skipped, Z errors)
|
|
1790
|
+
|
|
1791
|
+
\`\`\`typescript
|
|
1792
|
+
handler: async (rawInput, context) => {
|
|
1793
|
+
const data = rawInput as SomeType
|
|
1794
|
+
context.logger.info(\`[step-name] Starting \u2014 \${data.items.length} items\`)
|
|
1795
|
+
|
|
1796
|
+
let processed = 0, skipped = 0
|
|
1797
|
+
for (const item of data.items) {
|
|
1798
|
+
if (item.alreadyDone) {
|
|
1799
|
+
skipped++
|
|
1800
|
+
context.logger.info(\`[step-name] Skipping \${item.name} \u2014 already complete\`)
|
|
1801
|
+
continue
|
|
1802
|
+
}
|
|
1803
|
+
// ...
|
|
1804
|
+
processed++
|
|
1805
|
+
context.logger.info(\`[step-name] Processed \${item.name}\`)
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1808
|
+
context.logger.info(\`[step-name] Done \u2014 \${processed} processed, \${skipped} skipped\`)
|
|
1809
|
+
}
|
|
1810
|
+
\`\`\`
|
|
1811
|
+
|
|
1812
|
+
## Warnings vs Errors
|
|
1813
|
+
|
|
1814
|
+
- \`warn\`: skipped item, not found in DB, LLM timeout on one domain (processing continues)
|
|
1815
|
+
- \`error\`: step-level failures that propagate as thrown errors (log before throwing if possible)
|
|
1816
|
+
`;
|
|
1817
|
+
}
|
|
1747
1818
|
function claudePostEditValidateHookTemplate() {
|
|
1748
1819
|
return `#!/usr/bin/env node
|
|
1749
1820
|
// post-edit-validate.mjs
|
|
@@ -2105,7 +2176,8 @@ function getManagedTemplates(ctx = {}) {
|
|
|
2105
2176
|
".claude/rules/docs-authoring.md": claudeDocsAuthoringRuleTemplate,
|
|
2106
2177
|
".claude/rules/memory-conventions.md": claudeMemoryConventionsRuleTemplate,
|
|
2107
2178
|
".claude/rules/project-map.md": claudeProjectMapRuleTemplate,
|
|
2108
|
-
".claude/rules/task-tracking.md": claudeTaskTrackingRuleTemplate
|
|
2179
|
+
".claude/rules/task-tracking.md": claudeTaskTrackingRuleTemplate,
|
|
2180
|
+
".claude/rules/logging.md": claudeLoggingRuleTemplate
|
|
2109
2181
|
};
|
|
2110
2182
|
}
|
|
2111
2183
|
|
|
@@ -9,6 +9,6 @@ import type { InstantlyToolMap } from '../../types/index.js';
|
|
|
9
9
|
* Create a typed Instantly adapter bound to a specific credential.
|
|
10
10
|
*
|
|
11
11
|
* @param credential - Credential name as configured in the command center
|
|
12
|
-
* @returns Object with
|
|
12
|
+
* @returns Object with 16 typed methods for Instantly email outreach operations
|
|
13
13
|
*/
|
|
14
14
|
export declare function createInstantlyAdapter(credential: string): import("./create-adapter.js").TypedAdapter<InstantlyToolMap>;
|
|
@@ -6,7 +6,22 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Types are shared with the server-side LLM engine via @repo/core/execution.
|
|
8
8
|
*/
|
|
9
|
-
import type { LLMGenerateRequest, LLMGenerateResponse } from '../../types/index.js';
|
|
9
|
+
import type { LLMGenerateRequest, LLMGenerateResponse, LLMModel } from '../../types/index.js';
|
|
10
|
+
type LLMProvider = 'openai' | 'anthropic' | 'openrouter' | 'google';
|
|
11
|
+
/**
|
|
12
|
+
* SDK LLM generate params.
|
|
13
|
+
* Extends LLMGenerateRequest with optional typed provider/model for worker→platform dispatch.
|
|
14
|
+
* When provided, these override the resource-level model config server-side.
|
|
15
|
+
* When omitted, the resource's default ModelConfig is used.
|
|
16
|
+
*/
|
|
17
|
+
export interface SDKLLMGenerateParams extends Omit<LLMGenerateRequest, 'signal' | 'responseSchema'> {
|
|
18
|
+
/** LLM provider — typed to prevent invalid provider strings */
|
|
19
|
+
provider?: LLMProvider;
|
|
20
|
+
/** Model identifier — must be a supported LLMModel when provided */
|
|
21
|
+
model?: LLMModel;
|
|
22
|
+
/** JSON Schema for structured output (optional — omit for unstructured text) */
|
|
23
|
+
responseSchema?: unknown;
|
|
24
|
+
}
|
|
10
25
|
/**
|
|
11
26
|
* Typed LLM adapter for structured output generation.
|
|
12
27
|
*
|
|
@@ -19,6 +34,8 @@ import type { LLMGenerateRequest, LLMGenerateResponse } from '../../types/index.
|
|
|
19
34
|
* import { llm } from '@elevasis/sdk/worker'
|
|
20
35
|
*
|
|
21
36
|
* const response = await llm.generate({
|
|
37
|
+
* provider: 'anthropic',
|
|
38
|
+
* model: 'claude-sonnet-4-5',
|
|
22
39
|
* messages: [{ role: 'user', content: 'Summarize this document...' }],
|
|
23
40
|
* responseSchema: { type: 'object', properties: { summary: { type: 'string' } } },
|
|
24
41
|
* })
|
|
@@ -26,5 +43,6 @@ import type { LLMGenerateRequest, LLMGenerateResponse } from '../../types/index.
|
|
|
26
43
|
* ```
|
|
27
44
|
*/
|
|
28
45
|
export declare const llm: {
|
|
29
|
-
generate: <T = unknown>(params:
|
|
46
|
+
generate: <T = unknown>(params: SDKLLMGenerateParams) => Promise<LLMGenerateResponse<T>>;
|
|
30
47
|
};
|
|
48
|
+
export {};
|
package/dist/worker/index.js
CHANGED
|
@@ -4788,7 +4788,17 @@ function createAdapter(tool, methods, credential) {
|
|
|
4788
4788
|
for (const method of methods) {
|
|
4789
4789
|
adapter[method] = (params) => platform.call({ tool, method, params: params ?? {}, credential });
|
|
4790
4790
|
}
|
|
4791
|
-
|
|
4791
|
+
const registeredMethods = new Set(methods);
|
|
4792
|
+
return new Proxy(adapter, {
|
|
4793
|
+
get(target, prop, receiver) {
|
|
4794
|
+
if (typeof prop === "string" && !registeredMethods.has(prop) && !(prop in target)) {
|
|
4795
|
+
throw new Error(
|
|
4796
|
+
`${tool}.${prop} is not a registered method. Available: ${[...registeredMethods].join(", ")}. Add '${prop}' to createAdapter('${tool}', [...]) in the SDK adapter.`
|
|
4797
|
+
);
|
|
4798
|
+
}
|
|
4799
|
+
return Reflect.get(target, prop, receiver);
|
|
4800
|
+
}
|
|
4801
|
+
});
|
|
4792
4802
|
}
|
|
4793
4803
|
|
|
4794
4804
|
// src/worker/adapters/attio.ts
|
|
@@ -4811,7 +4821,7 @@ function createAttioAdapter(credential) {
|
|
|
4811
4821
|
}
|
|
4812
4822
|
|
|
4813
4823
|
// src/worker/adapters/apify.ts
|
|
4814
|
-
var METHODS2 = ["runActor", "getDatasetItems"];
|
|
4824
|
+
var METHODS2 = ["runActor", "getDatasetItems", "startActor"];
|
|
4815
4825
|
function createApifyAdapter(credential) {
|
|
4816
4826
|
return createAdapter("apify", METHODS2, credential);
|
|
4817
4827
|
}
|
|
@@ -4859,7 +4869,18 @@ var METHODS6 = [
|
|
|
4859
4869
|
"removeFromSubsequence",
|
|
4860
4870
|
"getEmails",
|
|
4861
4871
|
"updateInterestStatus",
|
|
4862
|
-
"addToCampaign"
|
|
4872
|
+
"addToCampaign",
|
|
4873
|
+
"listCampaigns",
|
|
4874
|
+
"getCampaign",
|
|
4875
|
+
"updateCampaign",
|
|
4876
|
+
"pauseCampaign",
|
|
4877
|
+
"activateCampaign",
|
|
4878
|
+
"getCampaignAnalytics",
|
|
4879
|
+
"getStepAnalytics",
|
|
4880
|
+
"bulkAddLeads",
|
|
4881
|
+
"getAccountHealth",
|
|
4882
|
+
"createInboxTest",
|
|
4883
|
+
"createCampaign"
|
|
4863
4884
|
];
|
|
4864
4885
|
function createInstantlyAdapter(credential) {
|
|
4865
4886
|
return createAdapter("instantly", METHODS6, credential);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@elevasis/sdk",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.23",
|
|
4
4
|
"description": "SDK for building Elevasis organization resources",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -32,11 +32,6 @@
|
|
|
32
32
|
"dist/types/templates.d.ts",
|
|
33
33
|
"reference/"
|
|
34
34
|
],
|
|
35
|
-
"scripts": {
|
|
36
|
-
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --external:jiti --banner:js=\"#!/usr/bin/env node\" && node scripts/copy-reference-docs.mjs && node scripts/generate-navigation.mjs",
|
|
37
|
-
"check-types": "tsc --noEmit",
|
|
38
|
-
"test:bundle": "pnpm build && vitest run --config vitest.bundle.config.ts"
|
|
39
|
-
},
|
|
40
35
|
"dependencies": {
|
|
41
36
|
"esbuild": "^0.25.0",
|
|
42
37
|
"jiti": "^2.0.0"
|
|
@@ -45,8 +40,6 @@
|
|
|
45
40
|
"zod": "^4.1.0"
|
|
46
41
|
},
|
|
47
42
|
"devDependencies": {
|
|
48
|
-
"@repo/core": "workspace:*",
|
|
49
|
-
"@repo/typescript-config": "workspace:*",
|
|
50
43
|
"@types/node": "^22.0.0",
|
|
51
44
|
"chalk": "^5.3.0",
|
|
52
45
|
"commander": "^11.0.0",
|
|
@@ -57,6 +50,13 @@
|
|
|
57
50
|
"rollup-plugin-dts": "^6.3.0",
|
|
58
51
|
"tsup": "^8.0.0",
|
|
59
52
|
"typescript": "5.9.2",
|
|
60
|
-
"zod": "^4.1.0"
|
|
53
|
+
"zod": "^4.1.0",
|
|
54
|
+
"@repo/core": "0.0.0",
|
|
55
|
+
"@repo/typescript-config": "0.0.0"
|
|
56
|
+
},
|
|
57
|
+
"scripts": {
|
|
58
|
+
"build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.core-dts.json && tsc -p tsconfig.build.json && tsup && rollup -c rollup.dts.config.mjs && esbuild src/cli/index.ts --bundle --platform=node --outfile=dist/cli.cjs --format=cjs --external:esbuild --external:jiti --banner:js=\"#!/usr/bin/env node\" && node scripts/copy-reference-docs.mjs && node scripts/generate-navigation.mjs",
|
|
59
|
+
"check-types": "tsc --noEmit",
|
|
60
|
+
"test:bundle": "pnpm build && vitest run --config vitest.bundle.config.ts"
|
|
61
61
|
}
|
|
62
|
-
}
|
|
62
|
+
}
|