skedyul 1.2.40 → 1.2.43
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/commands/agents.d.ts +1 -0
- package/dist/cli/commands/chat.d.ts +1 -0
- package/dist/cli/commands/crm.d.ts +1 -0
- package/dist/cli/commands/skills.d.ts +1 -0
- package/dist/cli/index.js +17636 -6197
- package/dist/cli/utils/auth.js +495 -0
- package/dist/cli/utils/mock-context.d.ts +22 -0
- package/dist/cli/utils/sse.d.ts +100 -0
- package/dist/compiler/compiler.d.ts +12 -0
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/types.d.ts +173 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/schema-loader.d.ts +156 -0
- package/dist/config/types/model.d.ts +28 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/resolver.d.ts +51 -0
- package/dist/context/types.d.ts +217 -0
- package/dist/dedicated/server.js +60 -15
- package/dist/esm/index.mjs +9815 -458
- package/dist/events/index.d.ts +1 -0
- package/dist/events/types.d.ts +528 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9912 -458
- package/dist/memory/index.d.ts +4 -0
- package/dist/memory/service.d.ts +78 -0
- package/dist/memory/types.d.ts +169 -0
- package/dist/schemas/agent-schema-v3.d.ts +437 -0
- package/dist/schemas/agent-schema-v3.js +539 -0
- package/dist/schemas/agent-schema-v3.mjs +497 -0
- package/dist/schemas/agent-schema.d.ts +1504 -0
- package/dist/schemas/agent-schema.js +7896 -0
- package/dist/schemas/agent-schema.mjs +7867 -0
- package/dist/schemas/crm-schema.d.ts +448 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas.d.ts +69 -36
- package/dist/server.js +60 -15
- package/dist/serverless/server.mjs +60 -15
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/types.d.ts +355 -0
- package/dist/skills/types.js +281 -0
- package/dist/skills/types.mjs +234 -0
- package/dist/triggers/index.d.ts +2 -0
- package/dist/triggers/resolver.d.ts +31 -0
- package/dist/triggers/types.d.ts +313 -0
- package/dist/types/data-blocks.d.ts +105 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/tool-response.d.ts +202 -0
- package/dist/types/tool.d.ts +157 -28
- package/dist/workflows/index.d.ts +1 -0
- package/dist/workflows/types.d.ts +295 -0
- package/package.json +19 -1
package/dist/types/index.d.ts
CHANGED
|
@@ -9,11 +9,13 @@ export type { InvocationType, ServerHookHandle, InvocationContext, } from './inv
|
|
|
9
9
|
export { createToolCallContext, createServerHookContext, createWebhookContext, createWorkflowStepContext, } from './invocation';
|
|
10
10
|
export type { ToolTrigger, ProvisionToolContext, FieldChangeToolContext, PageActionToolContext, FormSubmitToolContext, AgentToolContext, WorkflowToolContext, ToolExecutionContext, } from './tool-context';
|
|
11
11
|
export { isProvisionContext, isRuntimeContext } from './tool-context';
|
|
12
|
-
export type { BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, } from './tool';
|
|
12
|
+
export type { ToolResult, ToolSuccess, ToolFailure, ErrorCode, ErrorCategory, ToolWarning, ToolPagination, ToolBilling, ToolRetry, ToolTiming, ToolCompletionHints, ToolConfig, BillingInfo, ToolResponseMeta, ToolEffect, ToolError, ToolExecutionResult, ToolSchemaWithJson, ToolSchema, ToolHandler, ToolDefinition, ToolRegistryEntry, ToolRegistry, ToolName, ToolMetadata, ToolCallResponse, } from './tool';
|
|
13
13
|
export { ToolResponseMetaSchema } from './tool';
|
|
14
|
+
export { createSuccessResponse, createListResponse, createErrorResponse, createValidationError, createNotFoundError, createAuthError, createRateLimitError, createExternalError, createTimeoutError, createPermissionError, createConflictError, isSuccess, isFailure, isRetryable, getRetryDelay, } from './tool-response';
|
|
14
15
|
export type { HealthStatus, ComputeLayer, DedicatedServerInstance, ServerlessServerInstance, SkedyulServerInstance, } from './server';
|
|
15
16
|
export type { InstallHandlerContext, InstallHandlerResponseOAuth, InstallHandlerResponseStandard, HasOAuthCallback, InstallHandlerResult, InstallHandler, UninstallHandlerContext, UninstallHandlerResult, UninstallHandler, OAuthCallbackContext, OAuthCallbackResult, OAuthCallbackHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooksWithOAuth, ServerHooksWithoutOAuth, ServerHooks, } from './handlers';
|
|
16
17
|
export type { APIGatewayProxyEvent, APIGatewayProxyResult } from './aws';
|
|
17
18
|
export type { WebhookWireRequest, HandlerRawRequest, WebhookRequest, WebhookResponse, ProvisionWebhookContext, RuntimeWebhookContext, WebhookContext, WebhookHandler, WebhookLifecycleContext, CommunicationChannelLifecycleContext, WebhookLifecycleResult, WebhookLifecycleHook, WebhookInvocationMode, WebhookType, WebhookDefinition, WebhookRegistry, WebhookName, WebhookMetadata, } from './webhook';
|
|
18
19
|
export { isRuntimeWebhookContext } from './webhook';
|
|
19
20
|
export type { MCPError, MCPContentItem, MCPResult, MCPResponse, MCPRequest, } from './mcp-protocol';
|
|
21
|
+
export type { DataBlock, DataBlockLink, SpreadsheetBlock, SpreadsheetColumn, ProfileBlock, ProfileAvatar, ProfileField, FieldChangesBlock, FieldChangeItem, DateTimeBlock, } from './data-blocks';
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
import type { ToolSuccess, ToolFailure, ToolResult, ErrorCode, ErrorCategory, ToolWarning, ToolPagination, ToolBilling, ToolEffect, ToolRetry } from './tool';
|
|
2
|
+
import type { DataBlock } from './data-blocks';
|
|
3
|
+
/**
|
|
4
|
+
* Create a successful tool result.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```ts
|
|
8
|
+
* import { createSuccessResponse } from 'skedyul'
|
|
9
|
+
*
|
|
10
|
+
* return createSuccessResponse({ order: orderData })
|
|
11
|
+
*
|
|
12
|
+
* // With dataBlocks for rich UI rendering
|
|
13
|
+
* return createSuccessResponse(
|
|
14
|
+
* { booking: bookingData },
|
|
15
|
+
* {
|
|
16
|
+
* dataBlocks: [{
|
|
17
|
+
* type: 'dateTime',
|
|
18
|
+
* title: 'Booking Confirmed',
|
|
19
|
+
* datetime: '2026-05-20T14:00:00',
|
|
20
|
+
* status: 'confirmed',
|
|
21
|
+
* }]
|
|
22
|
+
* }
|
|
23
|
+
* )
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare function createSuccessResponse<T>(output: T, options?: {
|
|
27
|
+
/** Rich data blocks for UI rendering (profiles, spreadsheets, datetime cards) */
|
|
28
|
+
dataBlocks?: DataBlock[];
|
|
29
|
+
warnings?: ToolWarning[];
|
|
30
|
+
pagination?: ToolPagination;
|
|
31
|
+
billing?: ToolBilling;
|
|
32
|
+
effect?: ToolEffect;
|
|
33
|
+
}): ToolSuccess<T>;
|
|
34
|
+
/**
|
|
35
|
+
* Create a successful list response with pagination.
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```ts
|
|
39
|
+
* import { createListResponse } from 'skedyul'
|
|
40
|
+
*
|
|
41
|
+
* return createListResponse(items, { hasMore: true, total: 100 })
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
export declare function createListResponse<T>(items: T[], pagination: ToolPagination, options?: {
|
|
45
|
+
warnings?: ToolWarning[];
|
|
46
|
+
billing?: ToolBilling;
|
|
47
|
+
}): ToolSuccess<T[]>;
|
|
48
|
+
/**
|
|
49
|
+
* Create a failed tool result with full control over error details.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```ts
|
|
53
|
+
* import { createErrorResponse } from 'skedyul'
|
|
54
|
+
*
|
|
55
|
+
* return createErrorResponse('NOT_FOUND', 'Order not found')
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
export declare function createErrorResponse(code: ErrorCode, message: string, options?: {
|
|
59
|
+
category?: ErrorCategory;
|
|
60
|
+
field?: string;
|
|
61
|
+
details?: Record<string, unknown>;
|
|
62
|
+
retry?: ToolRetry;
|
|
63
|
+
partialOutput?: unknown;
|
|
64
|
+
billing?: ToolBilling;
|
|
65
|
+
effect?: ToolEffect;
|
|
66
|
+
}): ToolFailure;
|
|
67
|
+
/**
|
|
68
|
+
* Create a validation error result.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* import { createValidationError } from 'skedyul'
|
|
73
|
+
*
|
|
74
|
+
* return createValidationError('Email is required', 'email')
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare function createValidationError(message: string, field?: string, details?: Record<string, unknown>): ToolFailure;
|
|
78
|
+
/**
|
|
79
|
+
* Create a not found error result.
|
|
80
|
+
*
|
|
81
|
+
* @example
|
|
82
|
+
* ```ts
|
|
83
|
+
* import { createNotFoundError } from 'skedyul'
|
|
84
|
+
*
|
|
85
|
+
* return createNotFoundError('Order', orderId)
|
|
86
|
+
* // Error message: "Order 'abc123' not found"
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
89
|
+
export declare function createNotFoundError(resource: string, identifier?: string): ToolFailure;
|
|
90
|
+
/**
|
|
91
|
+
* Create an authentication error result.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* import { createAuthError } from 'skedyul'
|
|
96
|
+
*
|
|
97
|
+
* return createAuthError('Invalid API key')
|
|
98
|
+
* return createAuthError('Token expired', { expired: true })
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
export declare function createAuthError(message: string, options?: {
|
|
102
|
+
expired?: boolean;
|
|
103
|
+
retry?: ToolRetry;
|
|
104
|
+
}): ToolFailure;
|
|
105
|
+
/**
|
|
106
|
+
* Create a rate limit error result.
|
|
107
|
+
*
|
|
108
|
+
* @example
|
|
109
|
+
* ```ts
|
|
110
|
+
* import { createRateLimitError } from 'skedyul'
|
|
111
|
+
*
|
|
112
|
+
* return createRateLimitError(60000) // Retry after 60 seconds
|
|
113
|
+
* ```
|
|
114
|
+
*/
|
|
115
|
+
export declare function createRateLimitError(retryAfterMs?: number): ToolFailure;
|
|
116
|
+
/**
|
|
117
|
+
* Create an external service error result.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* import { createExternalError } from 'skedyul'
|
|
122
|
+
*
|
|
123
|
+
* return createExternalError('Petbooqz API', 'Connection timeout')
|
|
124
|
+
* ```
|
|
125
|
+
*/
|
|
126
|
+
export declare function createExternalError(service: string, message: string, options?: {
|
|
127
|
+
retry?: ToolRetry;
|
|
128
|
+
details?: Record<string, unknown>;
|
|
129
|
+
}): ToolFailure;
|
|
130
|
+
/**
|
|
131
|
+
* Create a timeout error result.
|
|
132
|
+
*
|
|
133
|
+
* @example
|
|
134
|
+
* ```ts
|
|
135
|
+
* import { createTimeoutError } from 'skedyul'
|
|
136
|
+
*
|
|
137
|
+
* return createTimeoutError('Request timed out after 30 seconds')
|
|
138
|
+
* ```
|
|
139
|
+
*/
|
|
140
|
+
export declare function createTimeoutError(message?: string, options?: {
|
|
141
|
+
retry?: ToolRetry;
|
|
142
|
+
}): ToolFailure;
|
|
143
|
+
/**
|
|
144
|
+
* Create a permission denied error result.
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* import { createPermissionError } from 'skedyul'
|
|
149
|
+
*
|
|
150
|
+
* return createPermissionError('You do not have access to this resource')
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
export declare function createPermissionError(message?: string): ToolFailure;
|
|
154
|
+
/**
|
|
155
|
+
* Create a conflict error result (e.g., duplicate resource).
|
|
156
|
+
*
|
|
157
|
+
* @example
|
|
158
|
+
* ```ts
|
|
159
|
+
* import { createConflictError } from 'skedyul'
|
|
160
|
+
*
|
|
161
|
+
* return createConflictError('A client with this email already exists')
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
export declare function createConflictError(message: string, field?: string): ToolFailure;
|
|
165
|
+
/**
|
|
166
|
+
* Type guard to check if a result is successful.
|
|
167
|
+
*
|
|
168
|
+
* @example
|
|
169
|
+
* ```ts
|
|
170
|
+
* if (isSuccess(result)) {
|
|
171
|
+
* console.log(result.output) // TypeScript knows output exists
|
|
172
|
+
* }
|
|
173
|
+
* ```
|
|
174
|
+
*/
|
|
175
|
+
export declare function isSuccess<T>(result: ToolResult<T>): result is ToolSuccess<T>;
|
|
176
|
+
/**
|
|
177
|
+
* Type guard to check if a result is a failure.
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* if (isFailure(result)) {
|
|
182
|
+
* console.log(result.error.code) // TypeScript knows error exists
|
|
183
|
+
* }
|
|
184
|
+
* ```
|
|
185
|
+
*/
|
|
186
|
+
export declare function isFailure(result: ToolResult<unknown>): result is ToolFailure;
|
|
187
|
+
/**
|
|
188
|
+
* Check if an error is retryable based on its category and retry hints.
|
|
189
|
+
*
|
|
190
|
+
* @example
|
|
191
|
+
* ```ts
|
|
192
|
+
* if (isFailure(result) && isRetryable(result)) {
|
|
193
|
+
* // Schedule retry
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
export declare function isRetryable(result: ToolFailure): boolean;
|
|
198
|
+
/**
|
|
199
|
+
* Get the suggested retry delay in milliseconds.
|
|
200
|
+
* Returns undefined if no retry hint is available.
|
|
201
|
+
*/
|
|
202
|
+
export declare function getRetryDelay(result: ToolFailure): number | undefined;
|
package/dist/types/tool.d.ts
CHANGED
|
@@ -5,45 +5,175 @@ import type { ToolExecutionContext } from './tool-context';
|
|
|
5
5
|
* These tools receive no user input - all data comes from context.
|
|
6
6
|
*/
|
|
7
7
|
export type ProvisionToolInput = Record<string, never>;
|
|
8
|
+
/**
|
|
9
|
+
* Standardized error codes for consistent handling across tools.
|
|
10
|
+
* Custom codes are allowed for tool-specific errors.
|
|
11
|
+
*/
|
|
12
|
+
export type ErrorCode = 'VALIDATION_ERROR' | 'NOT_FOUND' | 'AUTH_INVALID' | 'AUTH_EXPIRED' | 'PERMISSION_DENIED' | 'RATE_LIMITED' | 'TIMEOUT' | 'EXTERNAL_SERVICE_ERROR' | 'INTERNAL_ERROR' | 'QUOTA_EXCEEDED' | 'CONFLICT' | string;
|
|
13
|
+
/**
|
|
14
|
+
* Error category for smart retry logic.
|
|
15
|
+
* - validation: Don't retry, fix the input
|
|
16
|
+
* - auth: May need user action (re-login)
|
|
17
|
+
* - network: Retry with backoff
|
|
18
|
+
* - timeout: Retry with longer timeout
|
|
19
|
+
* - external: Retry with backoff
|
|
20
|
+
* - internal: May retry, but likely a bug
|
|
21
|
+
*/
|
|
22
|
+
export type ErrorCategory = 'validation' | 'auth' | 'network' | 'timeout' | 'external' | 'internal';
|
|
23
|
+
/**
|
|
24
|
+
* Structured error information with category for smart retry logic.
|
|
25
|
+
*/
|
|
26
|
+
export interface ToolError {
|
|
27
|
+
code: ErrorCode;
|
|
28
|
+
message: string;
|
|
29
|
+
category?: ErrorCategory;
|
|
30
|
+
field?: string;
|
|
31
|
+
details?: Record<string, unknown>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retry guidance for transient failures.
|
|
35
|
+
*/
|
|
36
|
+
export interface ToolRetry {
|
|
37
|
+
allowed: boolean;
|
|
38
|
+
afterMs?: number;
|
|
39
|
+
maxAttempts?: number;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Non-fatal warning that doesn't prevent success.
|
|
43
|
+
*/
|
|
44
|
+
export interface ToolWarning {
|
|
45
|
+
code: string;
|
|
46
|
+
message: string;
|
|
47
|
+
field?: string;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Pagination metadata for list operations.
|
|
51
|
+
*/
|
|
52
|
+
export interface ToolPagination {
|
|
53
|
+
hasMore: boolean;
|
|
54
|
+
total?: number;
|
|
55
|
+
nextCursor?: string;
|
|
56
|
+
page?: number;
|
|
57
|
+
limit?: number;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Billing/usage information.
|
|
61
|
+
*/
|
|
62
|
+
export interface ToolBilling {
|
|
63
|
+
credits: number;
|
|
64
|
+
tokens?: number;
|
|
65
|
+
cost?: number;
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Client-side effects to execute after tool completion.
|
|
69
|
+
*/
|
|
70
|
+
export interface ToolEffect {
|
|
71
|
+
redirect?: string;
|
|
72
|
+
toast?: {
|
|
73
|
+
type: 'success' | 'error' | 'warning' | 'info';
|
|
74
|
+
message: string;
|
|
75
|
+
};
|
|
76
|
+
refresh?: string[];
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Execution timing for observability.
|
|
80
|
+
*/
|
|
81
|
+
export interface ToolTiming {
|
|
82
|
+
durationMs: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Hints for controlling tool completion behavior in agent loops.
|
|
86
|
+
* Used to prevent duplicate calls and determine when to stop tool execution.
|
|
87
|
+
*/
|
|
88
|
+
export interface ToolCompletionHints {
|
|
89
|
+
/** Maximum times this tool can be called per agent run. Default: unlimited */
|
|
90
|
+
maxCallsPerRun?: number;
|
|
91
|
+
/** If true, tool is safe to call multiple times with same args (no side effects) */
|
|
92
|
+
idempotent?: boolean;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Configuration options for tool execution behavior.
|
|
96
|
+
* Groups timeout, retry, and completion hint settings.
|
|
97
|
+
*/
|
|
98
|
+
export interface ToolConfig {
|
|
99
|
+
/** Timeout in milliseconds. Defaults to 10000 (10 seconds) if not specified. */
|
|
100
|
+
timeout?: number;
|
|
101
|
+
/** Maximum retry attempts. Defaults to 1 (no retries) if not specified. */
|
|
102
|
+
retries?: number;
|
|
103
|
+
/** Hints for controlling tool completion behavior in agent loops */
|
|
104
|
+
completionHints?: ToolCompletionHints;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* Successful tool execution result.
|
|
108
|
+
* Output is guaranteed to exist.
|
|
109
|
+
*/
|
|
110
|
+
export interface ToolSuccess<T = unknown> {
|
|
111
|
+
success: true;
|
|
112
|
+
output: T;
|
|
113
|
+
/** Rich data blocks for UI rendering (profiles, spreadsheets, datetime cards) */
|
|
114
|
+
dataBlocks?: import('./data-blocks').DataBlock[];
|
|
115
|
+
warnings?: ToolWarning[];
|
|
116
|
+
pagination?: ToolPagination;
|
|
117
|
+
billing?: ToolBilling;
|
|
118
|
+
effect?: ToolEffect;
|
|
119
|
+
timing?: ToolTiming;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Failed tool execution result.
|
|
123
|
+
* Error is guaranteed to exist, output is not available.
|
|
124
|
+
*/
|
|
125
|
+
export interface ToolFailure {
|
|
126
|
+
success: false;
|
|
127
|
+
error: ToolError;
|
|
128
|
+
retry?: ToolRetry;
|
|
129
|
+
partialOutput?: unknown;
|
|
130
|
+
billing?: ToolBilling;
|
|
131
|
+
effect?: ToolEffect;
|
|
132
|
+
timing?: ToolTiming;
|
|
133
|
+
}
|
|
134
|
+
/**
|
|
135
|
+
* Tool execution result - either success or failure.
|
|
136
|
+
* Use `result.success` to narrow the type.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```ts
|
|
140
|
+
* const result = await tool.handler(input, context)
|
|
141
|
+
* if (result.success) {
|
|
142
|
+
* console.log(result.output) // TypeScript knows output exists
|
|
143
|
+
* } else {
|
|
144
|
+
* console.log(result.error.code) // TypeScript knows error exists
|
|
145
|
+
* }
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
export type ToolResult<T = unknown> = ToolSuccess<T> | ToolFailure;
|
|
149
|
+
/**
|
|
150
|
+
* @deprecated Use ToolBilling instead
|
|
151
|
+
*/
|
|
8
152
|
export interface BillingInfo {
|
|
9
153
|
credits: number;
|
|
10
154
|
}
|
|
11
155
|
/**
|
|
12
156
|
* Standardized metadata for tool responses.
|
|
13
|
-
*
|
|
157
|
+
* @deprecated Use ToolResult discriminated union instead
|
|
14
158
|
*/
|
|
15
159
|
export declare const ToolResponseMetaSchema: z.ZodObject<{
|
|
16
160
|
success: z.ZodBoolean;
|
|
17
161
|
message: z.ZodString;
|
|
18
162
|
toolName: z.ZodString;
|
|
19
163
|
}, z.core.$strip>;
|
|
20
|
-
export type ToolResponseMeta = z.infer<typeof ToolResponseMetaSchema>;
|
|
21
164
|
/**
|
|
22
|
-
*
|
|
23
|
-
* These are separate from the data output and represent navigation/UI actions.
|
|
165
|
+
* @deprecated Use ToolResult discriminated union instead
|
|
24
166
|
*/
|
|
25
|
-
export
|
|
26
|
-
/** URL to navigate to after the tool completes */
|
|
27
|
-
redirect?: string;
|
|
28
|
-
}
|
|
167
|
+
export type ToolResponseMeta = z.infer<typeof ToolResponseMetaSchema>;
|
|
29
168
|
/**
|
|
30
|
-
*
|
|
31
|
-
*
|
|
169
|
+
* Legacy tool execution result type.
|
|
170
|
+
* @deprecated Use ToolResult<T> instead. This type is kept for backward compatibility.
|
|
32
171
|
*/
|
|
33
|
-
export interface ToolError {
|
|
34
|
-
code: string;
|
|
35
|
-
message: string;
|
|
36
|
-
}
|
|
37
172
|
export interface ToolExecutionResult<Output = unknown> {
|
|
38
|
-
/** Tool-specific output data. Null on error. */
|
|
39
173
|
output: Output | null;
|
|
40
|
-
/** Billing information */
|
|
41
174
|
billing: BillingInfo;
|
|
42
|
-
/** Standardized response metadata for AI evaluation and debugging */
|
|
43
175
|
meta: ToolResponseMeta;
|
|
44
|
-
/** Optional client-side effects to execute */
|
|
45
176
|
effect?: ToolEffect;
|
|
46
|
-
/** Structured error information (null/undefined if no error) */
|
|
47
177
|
error?: ToolError | null;
|
|
48
178
|
}
|
|
49
179
|
export interface ToolSchemaWithJson<Schema extends z.ZodTypeAny = z.ZodTypeAny> {
|
|
@@ -54,8 +184,9 @@ export type ToolSchema<Schema extends z.ZodTypeAny = z.ZodTypeAny> = Schema | To
|
|
|
54
184
|
/**
|
|
55
185
|
* Tool handler function signature.
|
|
56
186
|
* Receives tool-specific input as first argument and standardized context as second.
|
|
187
|
+
* Supports both new ToolResult and legacy ToolExecutionResult return types.
|
|
57
188
|
*/
|
|
58
|
-
export type ToolHandler<Input, Output> = (input: Input, context: ToolExecutionContext) => Promise<ToolExecutionResult<Output>> | ToolExecutionResult<Output>;
|
|
189
|
+
export type ToolHandler<Input, Output> = (input: Input, context: ToolExecutionContext) => Promise<ToolResult<Output> | ToolExecutionResult<Output>> | ToolResult<Output> | ToolExecutionResult<Output>;
|
|
59
190
|
export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema extends z.ZodTypeAny = z.ZodType<Input>, OutputSchema extends z.ZodTypeAny = z.ZodType<Output>> {
|
|
60
191
|
name: string;
|
|
61
192
|
label?: string;
|
|
@@ -63,10 +194,8 @@ export interface ToolDefinition<Input = unknown, Output = unknown, InputSchema e
|
|
|
63
194
|
inputSchema: ToolSchema<InputSchema>;
|
|
64
195
|
handler: ToolHandler<Input, Output>;
|
|
65
196
|
outputSchema?: ToolSchema<OutputSchema>;
|
|
66
|
-
/**
|
|
67
|
-
|
|
68
|
-
/** Maximum retry attempts. Defaults to 1 (no retries) if not specified. */
|
|
69
|
-
retries?: number;
|
|
197
|
+
/** Tool execution configuration (timeout, retries, completion hints) */
|
|
198
|
+
config?: ToolConfig;
|
|
70
199
|
[key: string]: unknown;
|
|
71
200
|
}
|
|
72
201
|
export interface ToolRegistryEntry {
|
|
@@ -76,6 +205,8 @@ export interface ToolRegistryEntry {
|
|
|
76
205
|
inputSchema: ToolSchema;
|
|
77
206
|
handler: unknown;
|
|
78
207
|
outputSchema?: ToolSchema;
|
|
208
|
+
/** Tool execution configuration (timeout, retries, completion hints) */
|
|
209
|
+
config?: ToolConfig;
|
|
79
210
|
[key: string]: unknown;
|
|
80
211
|
}
|
|
81
212
|
export type ToolRegistry = Record<string, ToolRegistryEntry>;
|
|
@@ -86,10 +217,8 @@ export interface ToolMetadata {
|
|
|
86
217
|
description: string;
|
|
87
218
|
inputSchema?: Record<string, unknown>;
|
|
88
219
|
outputSchema?: Record<string, unknown>;
|
|
89
|
-
/**
|
|
90
|
-
|
|
91
|
-
/** Maximum retry attempts. Defaults to 1 (no retries) if not specified. */
|
|
92
|
-
retries?: number;
|
|
220
|
+
/** Tool execution configuration (timeout, retries, completion hints) */
|
|
221
|
+
config?: ToolConfig;
|
|
93
222
|
}
|
|
94
223
|
/**
|
|
95
224
|
* Response from a tool call.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { WORKFLOW_SCHEMA_VERSION, WorkflowInputSchema, WorkflowStepInputSchema, WorkflowStepSchema, WorkflowRuntimeSchema, WorkflowYAMLSchema, WorkflowMetadataSchema, WorkflowExecutionStatusSchema, WorkflowExecutionResultSchema, type WorkflowInput, type WorkflowStepInput, type WorkflowStep, type WorkflowRuntime, type WorkflowYAML, type WorkflowMetadata, type WorkflowExecutionStatus, type WorkflowExecutionResult, defineWorkflowYAML, validateWorkflowYAML, } from './types';
|