@elevasis/sdk 0.1.0 → 0.2.0
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 +29 -115
- package/dist/index.js +32 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -1,79 +1,5 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
-
/**
|
|
4
|
-
* Error categories for observability grouping and classification.
|
|
5
|
-
* Used to categorize errors in the execution_errors table metadata.
|
|
6
|
-
*/
|
|
7
|
-
type ExecutionErrorCategory = 'llm' | 'tool' | 'workflow' | 'agent' | 'validation' | 'system';
|
|
8
|
-
/**
|
|
9
|
-
* Abstract base class for all execution engine errors.
|
|
10
|
-
* Enforces contract for execution_errors table insertion with explicit type,
|
|
11
|
-
* severity, category, and context properties.
|
|
12
|
-
*
|
|
13
|
-
* All execution engine errors MUST extend this class to ensure proper error
|
|
14
|
-
* tracking and observability in the execution_errors table.
|
|
15
|
-
*
|
|
16
|
-
* @example
|
|
17
|
-
* ```typescript
|
|
18
|
-
* export class MyExecutionError extends ExecutionError {
|
|
19
|
-
* readonly type = 'my_execution_error' as const
|
|
20
|
-
* readonly severity = 'warning' as const
|
|
21
|
-
* readonly category = 'workflow' as const
|
|
22
|
-
*
|
|
23
|
-
* constructor(message: string, context?: Record<string, unknown>) {
|
|
24
|
-
* super(message, context)
|
|
25
|
-
* }
|
|
26
|
-
* }
|
|
27
|
-
* ```
|
|
28
|
-
*/
|
|
29
|
-
declare abstract class ExecutionError extends Error {
|
|
30
|
-
/**
|
|
31
|
-
* Error type identifier for execution_errors table.
|
|
32
|
-
* Should be a unique, snake_case string that identifies this specific error class.
|
|
33
|
-
* Used for filtering, aggregation, and error-specific handling in observability systems.
|
|
34
|
-
*/
|
|
35
|
-
abstract readonly type: string;
|
|
36
|
-
/**
|
|
37
|
-
* Error severity level for execution_errors table.
|
|
38
|
-
* - critical: System failures, auth issues, resource exhaustion - execution cannot continue
|
|
39
|
-
* - warning: Transient failures, configuration errors - execution may retry or requires user correction
|
|
40
|
-
* - info: Validation failures, expected user errors - user/developer action needed
|
|
41
|
-
*/
|
|
42
|
-
abstract readonly severity: 'critical' | 'warning' | 'info';
|
|
43
|
-
/**
|
|
44
|
-
* Error category for observability grouping.
|
|
45
|
-
* Used to categorize errors in dashboards and analytics.
|
|
46
|
-
*/
|
|
47
|
-
abstract readonly category: ExecutionErrorCategory;
|
|
48
|
-
/**
|
|
49
|
-
* Additional context/metadata for the error.
|
|
50
|
-
* Stored in execution_errors.metadata JSONB column.
|
|
51
|
-
*/
|
|
52
|
-
readonly context?: Record<string, unknown>;
|
|
53
|
-
/**
|
|
54
|
-
* @param message - Human-readable error message
|
|
55
|
-
* @param context - Additional context/metadata for observability
|
|
56
|
-
*/
|
|
57
|
-
constructor(message: string, context?: Record<string, unknown>);
|
|
58
|
-
/**
|
|
59
|
-
* Indicates whether this error type is retryable.
|
|
60
|
-
* Default: false (safe default - only retry when explicitly safe to do so)
|
|
61
|
-
*
|
|
62
|
-
* Subclasses should override to return true for retryable scenarios:
|
|
63
|
-
* - Network/infrastructure errors (exponential backoff)
|
|
64
|
-
* - Rate limiting (linear backoff)
|
|
65
|
-
* - Service availability (exponential backoff)
|
|
66
|
-
* - Circuit breaker (circuit breaker's own delay)
|
|
67
|
-
*
|
|
68
|
-
* DO NOT retry:
|
|
69
|
-
* - Authentication/authorization errors
|
|
70
|
-
* - Validation errors
|
|
71
|
-
* - Configuration errors
|
|
72
|
-
* - Resource exhaustion errors
|
|
73
|
-
*/
|
|
74
|
-
isRetryable(): boolean;
|
|
75
|
-
}
|
|
76
|
-
|
|
77
3
|
/**
|
|
78
4
|
* Workflow-specific logging types
|
|
79
5
|
*/
|
|
@@ -525,16 +451,16 @@ interface WorkflowStepDefinition {
|
|
|
525
451
|
description: string;
|
|
526
452
|
}
|
|
527
453
|
type StepHandler = (input: unknown, context: ExecutionContext) => Promise<unknown>;
|
|
528
|
-
declare enum StepType {
|
|
454
|
+
declare enum StepType$1 {
|
|
529
455
|
LINEAR = "linear",
|
|
530
456
|
CONDITIONAL = "conditional"
|
|
531
457
|
}
|
|
532
458
|
interface LinearNext {
|
|
533
|
-
type: StepType.LINEAR;
|
|
459
|
+
type: StepType$1.LINEAR;
|
|
534
460
|
target: string;
|
|
535
461
|
}
|
|
536
462
|
interface ConditionalNext {
|
|
537
|
-
type: StepType.CONDITIONAL;
|
|
463
|
+
type: StepType$1.CONDITIONAL;
|
|
538
464
|
routes: Array<{
|
|
539
465
|
condition: (data: unknown) => boolean;
|
|
540
466
|
target: string;
|
|
@@ -1162,44 +1088,6 @@ interface Tool {
|
|
|
1162
1088
|
* Used across platform tools and integration tools
|
|
1163
1089
|
*/
|
|
1164
1090
|
type ToolingErrorType = 'service_unavailable' | 'permission_denied' | 'adapter_not_found' | 'method_not_found' | 'tool_not_found' | 'credentials_missing' | 'credentials_invalid' | 'rate_limit_exceeded' | 'server_unavailable' | 'auth_error' | 'api_error' | 'validation_error' | 'network_error' | 'timeout_error' | 'unknown_error';
|
|
1165
|
-
/**
|
|
1166
|
-
* Tooling error class
|
|
1167
|
-
* Provides structured error information for tool failures across all tool types
|
|
1168
|
-
*
|
|
1169
|
-
* Severity mapping:
|
|
1170
|
-
* - critical: credentials_missing, credentials_invalid, permission_denied, auth_error,
|
|
1171
|
-
* adapter_not_found, method_not_found, tool_not_found
|
|
1172
|
-
* - info: validation_error
|
|
1173
|
-
* - warning: All other types (retryable transient errors)
|
|
1174
|
-
*
|
|
1175
|
-
* Category: tool (tool execution errors)
|
|
1176
|
-
*/
|
|
1177
|
-
declare class ToolingError extends ExecutionError {
|
|
1178
|
-
readonly errorType: ToolingErrorType;
|
|
1179
|
-
readonly details?: unknown | undefined;
|
|
1180
|
-
readonly type: "tooling_error";
|
|
1181
|
-
readonly category: "tool";
|
|
1182
|
-
constructor(errorType: ToolingErrorType, message: string, details?: unknown | undefined);
|
|
1183
|
-
/**
|
|
1184
|
-
* Derive severity based on error type
|
|
1185
|
-
*/
|
|
1186
|
-
get severity(): 'critical' | 'warning' | 'info';
|
|
1187
|
-
/**
|
|
1188
|
-
* Check if error is retryable
|
|
1189
|
-
*/
|
|
1190
|
-
isRetryable(): boolean;
|
|
1191
|
-
/**
|
|
1192
|
-
* Convert to JSON for logging
|
|
1193
|
-
*/
|
|
1194
|
-
toJSON(): {
|
|
1195
|
-
name: string;
|
|
1196
|
-
type: ToolingErrorType;
|
|
1197
|
-
message: string;
|
|
1198
|
-
severity: "critical" | "warning" | "info";
|
|
1199
|
-
category: "tool";
|
|
1200
|
-
details: unknown;
|
|
1201
|
-
};
|
|
1202
|
-
}
|
|
1203
1091
|
|
|
1204
1092
|
/**
|
|
1205
1093
|
* Supported integration types
|
|
@@ -1557,5 +1445,31 @@ interface ElevasConfig {
|
|
|
1557
1445
|
};
|
|
1558
1446
|
}
|
|
1559
1447
|
|
|
1448
|
+
/**
|
|
1449
|
+
* Runtime values for SDK developers.
|
|
1450
|
+
*
|
|
1451
|
+
* These are standalone definitions (not re-exported from @repo/core)
|
|
1452
|
+
* to avoid pulling in the entire execution engine dependency tree (~3.5MB).
|
|
1453
|
+
* Values are identical to their @repo/core counterparts.
|
|
1454
|
+
*/
|
|
1455
|
+
/** Step connection type for multi-step workflows */
|
|
1456
|
+
declare enum StepType {
|
|
1457
|
+
LINEAR = "linear",
|
|
1458
|
+
CONDITIONAL = "conditional"
|
|
1459
|
+
}
|
|
1460
|
+
/** Base error class for execution errors */
|
|
1461
|
+
declare class ExecutionError extends Error {
|
|
1462
|
+
readonly type: string;
|
|
1463
|
+
readonly context?: Record<string, unknown>;
|
|
1464
|
+
constructor(message: string, context?: Record<string, unknown>);
|
|
1465
|
+
isRetryable(): boolean;
|
|
1466
|
+
}
|
|
1467
|
+
/** Error thrown from tool execution handlers */
|
|
1468
|
+
declare class ToolingError extends ExecutionError {
|
|
1469
|
+
readonly errorType: string;
|
|
1470
|
+
readonly details?: unknown;
|
|
1471
|
+
constructor(errorType: string, message: string, details?: unknown);
|
|
1472
|
+
}
|
|
1473
|
+
|
|
1560
1474
|
export { ExecutionError, StepType, ToolingError };
|
|
1561
1475
|
export type { AgentConfig, AgentConstraints, AgentDefinition, ConditionalNext, Contract, DomainDefinition, ElevasConfig, EventTriggerConfig, ExecutionContext, ExecutionInterface, ExecutionMetadata, FormField, FormFieldType, FormSchema, IntegrationDefinition, LLMModel, LinearNext, ModelConfig, NextConfig, OrganizationResources, ResourceDefinition, ResourceDomain, ResourceMetricsConfig, ResourceStatus, ResourceType, ScheduleTriggerConfig, StepHandler, Tool, ToolExecutionOptions, ToolingErrorType, TriggerConfig, TriggerDefinition, WebhookProviderType, WebhookTriggerConfig, WorkflowConfig, WorkflowDefinition, WorkflowStep };
|
package/dist/index.js
CHANGED
|
@@ -1 +1,33 @@
|
|
|
1
|
+
// src/runtime.ts
|
|
2
|
+
var StepType = /* @__PURE__ */ ((StepType2) => {
|
|
3
|
+
StepType2["LINEAR"] = "linear";
|
|
4
|
+
StepType2["CONDITIONAL"] = "conditional";
|
|
5
|
+
return StepType2;
|
|
6
|
+
})(StepType || {});
|
|
7
|
+
var ExecutionError = class extends Error {
|
|
8
|
+
type;
|
|
9
|
+
context;
|
|
10
|
+
constructor(message, context) {
|
|
11
|
+
super(message);
|
|
12
|
+
this.name = this.constructor.name;
|
|
13
|
+
this.type = "execution_error";
|
|
14
|
+
this.context = context;
|
|
15
|
+
if (Error.captureStackTrace) {
|
|
16
|
+
Error.captureStackTrace(this, this.constructor);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
isRetryable() {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
var ToolingError = class extends ExecutionError {
|
|
24
|
+
errorType;
|
|
25
|
+
details;
|
|
26
|
+
constructor(errorType, message, details) {
|
|
27
|
+
super(message, { type: errorType, details });
|
|
28
|
+
this.errorType = errorType;
|
|
29
|
+
this.details = details;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
1
32
|
|
|
33
|
+
export { ExecutionError, StepType, ToolingError };
|