@elevasis/sdk 0.4.2 → 0.4.3

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
@@ -43808,7 +43808,7 @@ async function apiDelete(endpoint, apiUrl = resolveApiUrl()) {
43808
43808
  }
43809
43809
 
43810
43810
  // src/cli/version.ts
43811
- var SDK_VERSION = "0.4.2";
43811
+ var SDK_VERSION = "0.4.3";
43812
43812
 
43813
43813
  // src/cli/commands/deploy.ts
43814
43814
  var import_meta2 = {};
package/dist/index.d.ts CHANGED
@@ -1926,9 +1926,9 @@ interface ElevasConfig {
1926
1926
  /**
1927
1927
  * Runtime values for SDK developers.
1928
1928
  *
1929
- * These are standalone definitions (not re-exported from @repo/core)
1929
+ * These are standalone definitions (not re-exported from the core package)
1930
1930
  * to avoid pulling in the entire execution engine dependency tree (~3.5MB).
1931
- * Values are identical to their @repo/core counterparts.
1931
+ * Values are identical to their core package counterparts.
1932
1932
  */
1933
1933
  /** Step connection type for multi-step workflows */
1934
1934
  declare enum StepType {
@@ -0,0 +1,19 @@
1
+ /**
2
+ * SDK Worker Runtime
3
+ *
4
+ * Runs inside a worker_threads Worker, replacing the HTTP-based server runtime.
5
+ * Communicates with the parent (API process) via postMessage().
6
+ *
7
+ * Message protocol:
8
+ * Parent -> Worker: { type: 'manifest' }
9
+ * Worker -> Parent: { type: 'manifest', workflows: [...], agents: [...] }
10
+ *
11
+ * Parent -> Worker: { type: 'execute', resourceId, executionId, input, organizationId?, organizationName? }
12
+ * Worker -> Parent: { type: 'result', status, output?, error?, logs }
13
+ *
14
+ * Worker -> Parent: { type: 'tool-call', id, tool, method, params, credential? }
15
+ * Parent -> Worker: { type: 'tool-result', id, result?, error?, code? }
16
+ */
17
+ import type { OrganizationResources } from '../index.js';
18
+ export { platform, PlatformToolError } from './platform.js';
19
+ export declare function startWorker(org: OrganizationResources): void;
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Platform Tool Proxy (Worker Side)
3
+ *
4
+ * Provides platform.call() for external developers to invoke platform tools
5
+ * from within worker threads. Communicates with the parent process via
6
+ * postMessage() -- the parent dispatches to the real service layer.
7
+ */
8
+ /** Inbound tool-result from parent */
9
+ interface ToolResultMessage {
10
+ type: 'tool-result';
11
+ id: string;
12
+ result?: unknown;
13
+ error?: string;
14
+ code?: string;
15
+ }
16
+ export declare class PlatformToolError extends Error {
17
+ /** ToolingErrorType code from the platform */
18
+ readonly code: string;
19
+ /** Whether the error is retryable */
20
+ readonly retryable: boolean;
21
+ constructor(message: string,
22
+ /** ToolingErrorType code from the platform */
23
+ code: string,
24
+ /** Whether the error is retryable */
25
+ retryable: boolean);
26
+ }
27
+ /**
28
+ * Handle a tool-result message from the parent process.
29
+ * Called from the parentPort.on('message') handler in index.ts.
30
+ */
31
+ export declare function handleToolResult(msg: ToolResultMessage): void;
32
+ export declare const platform: {
33
+ /**
34
+ * Call a platform tool from the worker thread.
35
+ *
36
+ * @param options.tool - Tool name (e.g., 'gmail', 'storage', 'attio')
37
+ * @param options.method - Method name (e.g., 'sendEmail', 'upload')
38
+ * @param options.params - Method parameters
39
+ * @param options.credential - Credential name (required for integration tools)
40
+ * @returns Promise resolving to the tool result
41
+ * @throws PlatformToolError on failure (with code and retryable fields)
42
+ */
43
+ call(options: {
44
+ tool: string;
45
+ method: string;
46
+ params?: unknown;
47
+ credential?: string;
48
+ }): Promise<unknown>;
49
+ };
50
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@elevasis/sdk",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "description": "SDK for building Elevasis organization resources",
5
5
  "comment:bin": "IMPORTANT: This package shares the 'elevasis' binary name with @repo/cli. They never conflict because @elevasis/sdk must NEVER be added as a dependency of any workspace package (apps/*, packages/*, organizations/*). Workspace projects use @repo/cli for the 'elevasis' binary. External developers (outside the workspace) get this SDK's binary via npm install.",
6
6
  "type": "module",
@@ -14,6 +14,7 @@
14
14
  "import": "./dist/index.js"
15
15
  },
16
16
  "./worker": {
17
+ "types": "./dist/types/worker/index.d.ts",
17
18
  "import": "./dist/worker/index.js"
18
19
  }
19
20
  },
@@ -21,6 +22,8 @@
21
22
  "dist/index.js",
22
23
  "dist/index.d.ts",
23
24
  "dist/worker/index.js",
25
+ "dist/types/worker/index.d.ts",
26
+ "dist/types/worker/platform.d.ts",
24
27
  "dist/cli.cjs"
25
28
  ],
26
29
  "dependencies": {
@@ -42,11 +45,12 @@
42
45
  "tsup": "^8.0.0",
43
46
  "typescript": "5.9.2",
44
47
  "zod": "^4.1.0",
45
- "@repo/typescript-config": "0.0.0",
46
- "@repo/core": "0.0.0"
48
+ "@repo/core": "0.0.0",
49
+ "@repo/typescript-config": "0.0.0"
47
50
  },
48
51
  "scripts": {
49
52
  "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\"",
50
- "check-types": "tsc --noEmit"
53
+ "check-types": "tsc --noEmit",
54
+ "test:bundle": "pnpm build && vitest run --config vitest.bundle.config.ts"
51
55
  }
52
56
  }