skedyul 0.2.135 → 0.2.137
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/.build-stamp +1 -1
- package/dist/config.d.ts +33 -0
- package/dist/errors.d.ts +77 -0
- package/dist/errors.js +99 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +8 -1
- package/dist/schemas.d.ts +19 -0
- package/dist/schemas.js +21 -1
- package/dist/server.js +29 -6
- package/package.json +1 -1
package/dist/.build-stamp
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
1770183335160
|
package/dist/config.d.ts
CHANGED
|
@@ -649,6 +649,35 @@ export interface InstallConfig {
|
|
|
649
649
|
/** Tool name to invoke when app is uninstalled (for cleanup) */
|
|
650
650
|
onUninstall?: string;
|
|
651
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* Definition for an app-provided agent.
|
|
654
|
+
* Agents are created globally during provisioning and become available
|
|
655
|
+
* to workplaces that install the app.
|
|
656
|
+
*/
|
|
657
|
+
export interface AgentDefinition {
|
|
658
|
+
/** Unique identifier within the app (used for upserts) */
|
|
659
|
+
handle: string;
|
|
660
|
+
/** Display name */
|
|
661
|
+
name: string;
|
|
662
|
+
/** Description of what the agent does */
|
|
663
|
+
description: string;
|
|
664
|
+
/** System prompt (static, no templating) */
|
|
665
|
+
system: string;
|
|
666
|
+
/** Tool names to bind (must exist in this app's tools) */
|
|
667
|
+
tools: string[];
|
|
668
|
+
/** Optional LLM model override (defaults to workspace default) */
|
|
669
|
+
llmModelId?: string;
|
|
670
|
+
/**
|
|
671
|
+
* Parent agent that can call this agent.
|
|
672
|
+
* Creates an AGENT-type tool and binds it to the parent.
|
|
673
|
+
*
|
|
674
|
+
* Values:
|
|
675
|
+
* - 'composer' - Bind to the workspace's Composer agent
|
|
676
|
+
* - '<handle>' - Bind to another agent in this app (by handle)
|
|
677
|
+
* - undefined - Standalone agent (not callable by other agents)
|
|
678
|
+
*/
|
|
679
|
+
parentAgent?: string;
|
|
680
|
+
}
|
|
652
681
|
/** Provision-level configuration - auto-synced when app version is deployed */
|
|
653
682
|
export interface ProvisionConfig {
|
|
654
683
|
/** Global environment variables (developer-level, shared across all installs) */
|
|
@@ -691,6 +720,8 @@ export interface SkedyulConfig {
|
|
|
691
720
|
install?: InstallConfig | Promise<{
|
|
692
721
|
default: InstallConfig;
|
|
693
722
|
}>;
|
|
723
|
+
/** Agent definitions - multi-tenant agents with tool bindings */
|
|
724
|
+
agents?: AgentDefinition[];
|
|
694
725
|
}
|
|
695
726
|
export interface SerializableSkedyulConfig {
|
|
696
727
|
name: string;
|
|
@@ -703,6 +734,8 @@ export interface SerializableSkedyulConfig {
|
|
|
703
734
|
webhooks?: WebhookMetadata[];
|
|
704
735
|
/** Provision config (fully resolved) */
|
|
705
736
|
provision?: ProvisionConfig;
|
|
737
|
+
/** Agent definitions (stored as-is) */
|
|
738
|
+
agents?: AgentDefinition[];
|
|
706
739
|
}
|
|
707
740
|
export interface WebhookHandlerMetadata {
|
|
708
741
|
name: string;
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Error types for install handlers.
|
|
3
|
+
*
|
|
4
|
+
* These errors can be thrown by install handlers to indicate specific failure modes.
|
|
5
|
+
* The server will recognize these errors and return structured error responses
|
|
6
|
+
* that the frontend can display inline on the install form.
|
|
7
|
+
*/
|
|
8
|
+
export type InstallErrorCode = 'MISSING_REQUIRED_FIELD' | 'AUTHENTICATION_FAILED' | 'INVALID_CONFIGURATION' | 'CONNECTION_FAILED';
|
|
9
|
+
/**
|
|
10
|
+
* Base error class for install handler errors.
|
|
11
|
+
*
|
|
12
|
+
* @example
|
|
13
|
+
* ```typescript
|
|
14
|
+
* throw new InstallError('Something went wrong', 'INVALID_CONFIGURATION')
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
export declare class InstallError extends Error {
|
|
18
|
+
code: InstallErrorCode;
|
|
19
|
+
field?: string;
|
|
20
|
+
constructor(message: string, code: InstallErrorCode, field?: string);
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Error thrown when a required field is missing.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```typescript
|
|
27
|
+
* if (!ctx.env.API_KEY) {
|
|
28
|
+
* throw new MissingRequiredFieldError('API_KEY')
|
|
29
|
+
* }
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export declare class MissingRequiredFieldError extends InstallError {
|
|
33
|
+
constructor(fieldName: string, message?: string);
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Error thrown when authentication/credential verification fails.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```typescript
|
|
40
|
+
* try {
|
|
41
|
+
* await apiClient.verifyCredentials()
|
|
42
|
+
* } catch (error) {
|
|
43
|
+
* throw new AuthenticationError('Invalid API credentials. Please check your username and password.')
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare class AuthenticationError extends InstallError {
|
|
48
|
+
constructor(message?: string);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Error thrown when the configuration is invalid.
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```typescript
|
|
55
|
+
* if (!isValidUrl(ctx.env.API_URL)) {
|
|
56
|
+
* throw new InvalidConfigurationError('API_URL', 'Invalid URL format')
|
|
57
|
+
* }
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
60
|
+
export declare class InvalidConfigurationError extends InstallError {
|
|
61
|
+
constructor(fieldName?: string, message?: string);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Error thrown when a connection to an external service fails.
|
|
65
|
+
*
|
|
66
|
+
* @example
|
|
67
|
+
* ```typescript
|
|
68
|
+
* try {
|
|
69
|
+
* await fetch(apiUrl)
|
|
70
|
+
* } catch (error) {
|
|
71
|
+
* throw new ConnectionError('Unable to connect to the API server. Please check the URL.')
|
|
72
|
+
* }
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
export declare class ConnectionError extends InstallError {
|
|
76
|
+
constructor(message?: string);
|
|
77
|
+
}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Error types for install handlers.
|
|
4
|
+
*
|
|
5
|
+
* These errors can be thrown by install handlers to indicate specific failure modes.
|
|
6
|
+
* The server will recognize these errors and return structured error responses
|
|
7
|
+
* that the frontend can display inline on the install form.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = void 0;
|
|
11
|
+
/**
|
|
12
|
+
* Base error class for install handler errors.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```typescript
|
|
16
|
+
* throw new InstallError('Something went wrong', 'INVALID_CONFIGURATION')
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
class InstallError extends Error {
|
|
20
|
+
constructor(message, code, field) {
|
|
21
|
+
super(message);
|
|
22
|
+
this.name = 'InstallError';
|
|
23
|
+
this.code = code;
|
|
24
|
+
this.field = field;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.InstallError = InstallError;
|
|
28
|
+
/**
|
|
29
|
+
* Error thrown when a required field is missing.
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```typescript
|
|
33
|
+
* if (!ctx.env.API_KEY) {
|
|
34
|
+
* throw new MissingRequiredFieldError('API_KEY')
|
|
35
|
+
* }
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
class MissingRequiredFieldError extends InstallError {
|
|
39
|
+
constructor(fieldName, message) {
|
|
40
|
+
super(message ?? `${fieldName} is required`, 'MISSING_REQUIRED_FIELD', fieldName);
|
|
41
|
+
this.name = 'MissingRequiredFieldError';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
exports.MissingRequiredFieldError = MissingRequiredFieldError;
|
|
45
|
+
/**
|
|
46
|
+
* Error thrown when authentication/credential verification fails.
|
|
47
|
+
*
|
|
48
|
+
* @example
|
|
49
|
+
* ```typescript
|
|
50
|
+
* try {
|
|
51
|
+
* await apiClient.verifyCredentials()
|
|
52
|
+
* } catch (error) {
|
|
53
|
+
* throw new AuthenticationError('Invalid API credentials. Please check your username and password.')
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
class AuthenticationError extends InstallError {
|
|
58
|
+
constructor(message) {
|
|
59
|
+
super(message ?? 'Authentication failed', 'AUTHENTICATION_FAILED');
|
|
60
|
+
this.name = 'AuthenticationError';
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.AuthenticationError = AuthenticationError;
|
|
64
|
+
/**
|
|
65
|
+
* Error thrown when the configuration is invalid.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```typescript
|
|
69
|
+
* if (!isValidUrl(ctx.env.API_URL)) {
|
|
70
|
+
* throw new InvalidConfigurationError('API_URL', 'Invalid URL format')
|
|
71
|
+
* }
|
|
72
|
+
* ```
|
|
73
|
+
*/
|
|
74
|
+
class InvalidConfigurationError extends InstallError {
|
|
75
|
+
constructor(fieldName, message) {
|
|
76
|
+
super(message ?? 'Invalid configuration', 'INVALID_CONFIGURATION', fieldName);
|
|
77
|
+
this.name = 'InvalidConfigurationError';
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.InvalidConfigurationError = InvalidConfigurationError;
|
|
81
|
+
/**
|
|
82
|
+
* Error thrown when a connection to an external service fails.
|
|
83
|
+
*
|
|
84
|
+
* @example
|
|
85
|
+
* ```typescript
|
|
86
|
+
* try {
|
|
87
|
+
* await fetch(apiUrl)
|
|
88
|
+
* } catch (error) {
|
|
89
|
+
* throw new ConnectionError('Unable to connect to the API server. Please check the URL.')
|
|
90
|
+
* }
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
class ConnectionError extends InstallError {
|
|
94
|
+
constructor(message) {
|
|
95
|
+
super(message ?? 'Connection failed', 'CONNECTION_FAILED');
|
|
96
|
+
this.name = 'ConnectionError';
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.ConnectionError = ConnectionError;
|
package/dist/index.d.ts
CHANGED
|
@@ -3,6 +3,8 @@ export * from './types';
|
|
|
3
3
|
export * from './schemas';
|
|
4
4
|
export { server } from './server';
|
|
5
5
|
export { DEFAULT_DOCKERFILE } from './dockerfile';
|
|
6
|
+
export { InstallError, MissingRequiredFieldError, AuthenticationError, InvalidConfigurationError, ConnectionError, } from './errors';
|
|
7
|
+
export type { InstallErrorCode } from './errors';
|
|
6
8
|
export { z };
|
|
7
9
|
export { workplace, communicationChannel, instance, token, file, webhook, resource, contactAssociationLink, configure, getConfig, runWithConfig, } from './core/client';
|
|
8
10
|
export type { InstanceContext, InstanceData, InstanceMeta, InstancePagination, InstanceListResult, InstanceListArgs, FileUrlResponse, FileUploadParams, FileUploadResult, WebhookCreateResult, WebhookListItem, WebhookDeleteByNameOptions, WebhookListOptions, ResourceLinkParams, ResourceLinkResult, ContactAssociationLinkCreateParams, ContactAssociationLinkCreateResult, } from './core/client';
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.DEFAULT_DOCKERFILE = exports.server = void 0;
|
|
17
|
+
exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.CONFIG_FILE_NAMES = exports.validateConfig = exports.loadConfig = exports.defineConfig = exports.runWithConfig = exports.getConfig = exports.configure = exports.contactAssociationLink = exports.resource = exports.webhook = exports.file = exports.token = exports.instance = exports.communicationChannel = exports.workplace = exports.z = exports.ConnectionError = exports.InvalidConfigurationError = exports.AuthenticationError = exports.MissingRequiredFieldError = exports.InstallError = exports.DEFAULT_DOCKERFILE = exports.server = void 0;
|
|
18
18
|
const zod_1 = require("zod");
|
|
19
19
|
Object.defineProperty(exports, "z", { enumerable: true, get: function () { return zod_1.z; } });
|
|
20
20
|
__exportStar(require("./types"), exports);
|
|
@@ -23,6 +23,13 @@ var server_1 = require("./server");
|
|
|
23
23
|
Object.defineProperty(exports, "server", { enumerable: true, get: function () { return server_1.server; } });
|
|
24
24
|
var dockerfile_1 = require("./dockerfile");
|
|
25
25
|
Object.defineProperty(exports, "DEFAULT_DOCKERFILE", { enumerable: true, get: function () { return dockerfile_1.DEFAULT_DOCKERFILE; } });
|
|
26
|
+
// Install handler errors
|
|
27
|
+
var errors_1 = require("./errors");
|
|
28
|
+
Object.defineProperty(exports, "InstallError", { enumerable: true, get: function () { return errors_1.InstallError; } });
|
|
29
|
+
Object.defineProperty(exports, "MissingRequiredFieldError", { enumerable: true, get: function () { return errors_1.MissingRequiredFieldError; } });
|
|
30
|
+
Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: function () { return errors_1.AuthenticationError; } });
|
|
31
|
+
Object.defineProperty(exports, "InvalidConfigurationError", { enumerable: true, get: function () { return errors_1.InvalidConfigurationError; } });
|
|
32
|
+
Object.defineProperty(exports, "ConnectionError", { enumerable: true, get: function () { return errors_1.ConnectionError; } });
|
|
26
33
|
var client_1 = require("./core/client");
|
|
27
34
|
Object.defineProperty(exports, "workplace", { enumerable: true, get: function () { return client_1.workplace; } });
|
|
28
35
|
Object.defineProperty(exports, "communicationChannel", { enumerable: true, get: function () { return client_1.communicationChannel; } });
|
package/dist/schemas.d.ts
CHANGED
|
@@ -2788,6 +2788,16 @@ export declare const WebhooksSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
|
2788
2788
|
}>>;
|
|
2789
2789
|
handler: z.ZodUnknown;
|
|
2790
2790
|
}, z.core.$strip>>;
|
|
2791
|
+
export declare const AgentDefinitionSchema: z.ZodObject<{
|
|
2792
|
+
handle: z.ZodString;
|
|
2793
|
+
name: z.ZodString;
|
|
2794
|
+
description: z.ZodString;
|
|
2795
|
+
system: z.ZodString;
|
|
2796
|
+
tools: z.ZodArray<z.ZodString>;
|
|
2797
|
+
llmModelId: z.ZodOptional<z.ZodString>;
|
|
2798
|
+
parentAgent: z.ZodOptional<z.ZodString>;
|
|
2799
|
+
}, z.core.$strip>;
|
|
2800
|
+
export type AgentDefinition = z.infer<typeof AgentDefinitionSchema>;
|
|
2791
2801
|
export declare const ProvisionConfigSchema: z.ZodObject<{
|
|
2792
2802
|
env: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
2793
2803
|
label: z.ZodString;
|
|
@@ -4058,6 +4068,15 @@ export declare const SkedyulConfigSchema: z.ZodObject<{
|
|
|
4058
4068
|
}, z.core.$strip>>;
|
|
4059
4069
|
}, z.core.$strip>>>;
|
|
4060
4070
|
}, z.core.$strip>, z.ZodUnknown]>>;
|
|
4071
|
+
agents: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
4072
|
+
handle: z.ZodString;
|
|
4073
|
+
name: z.ZodString;
|
|
4074
|
+
description: z.ZodString;
|
|
4075
|
+
system: z.ZodString;
|
|
4076
|
+
tools: z.ZodArray<z.ZodString>;
|
|
4077
|
+
llmModelId: z.ZodOptional<z.ZodString>;
|
|
4078
|
+
parentAgent: z.ZodOptional<z.ZodString>;
|
|
4079
|
+
}, z.core.$strip>>>;
|
|
4061
4080
|
}, z.core.$strip>;
|
|
4062
4081
|
export type ParsedSkedyulConfig = z.infer<typeof SkedyulConfigSchema>;
|
|
4063
4082
|
export declare function safeParseConfig(data: unknown): ParsedSkedyulConfig | null;
|
package/dist/schemas.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ListItemTemplateSchema = exports.FileSettingComponentDefinitionSchema = exports.ImageSettingComponentDefinitionSchema = exports.TimePickerComponentDefinitionSchema = exports.DatePickerComponentDefinitionSchema = exports.CheckboxComponentDefinitionSchema = exports.ComboboxComponentDefinitionSchema = exports.SelectComponentDefinitionSchema = exports.TextareaComponentDefinitionSchema = exports.InputComponentDefinitionSchema = exports.FormLayoutConfigDefinitionSchema = exports.FormLayoutRowDefinitionSchema = exports.FormLayoutColumnDefinitionSchema = exports.RelationshipExtensionSchema = exports.FieldSettingButtonPropsSchema = exports.FormV2StylePropsSchema = exports.PageActionDefinitionSchema = exports.PageFormHeaderSchema = exports.PageFieldSourceSchema = exports.PageFieldTypeSchema = exports.PageBlockTypeSchema = exports.PageTypeSchema = exports.WorkflowDefinitionSchema = exports.WorkflowActionSchema = exports.WorkflowActionInputSchema = exports.ChannelDefinitionSchema = exports.ChannelFieldDefinitionSchema = exports.ChannelCapabilitySchema = exports.ChannelCapabilityTypeSchema = exports.RelationshipDefinitionSchema = exports.RelationshipLinkSchema = exports.OnDeleteBehaviorSchema = exports.RelationshipCardinalitySchema = exports.ModelDefinitionSchema = exports.ModelFieldDefinitionSchema = exports.AppFieldVisibilitySchema = exports.InlineFieldDefinitionSchema = exports.FieldOptionSchema = exports.FieldDataTypeSchema = exports.ResourceDependencySchema = exports.WorkflowDependencySchema = exports.ChannelDependencySchema = exports.ModelDependencySchema = exports.StructuredFilterSchema = exports.FieldOwnerSchema = exports.ResourceScopeSchema = exports.ComputeLayerTypeSchema = exports.EnvSchemaSchema = exports.EnvVariableDefinitionSchema = exports.EnvVisibilitySchema = void 0;
|
|
4
|
-
exports.MessageSendOutputSchema = exports.MessageSendInputSchema = exports.MessageSendMessageSchema = exports.MessageSendContactSchema = exports.MessageSendSubscriptionSchema = exports.MessageSendChannelSchema = exports.SkedyulConfigSchema = exports.ProvisionConfigSchema = exports.WebhooksSchema = exports.WebhookHandlerDefinitionSchema = exports.WebhookTypeSchema = exports.WebhookHttpMethodSchema = exports.PageDefinitionSchema = exports.NavigationConfigSchema = exports.NavigationBreadcrumbSchema = exports.BreadcrumbItemSchema = exports.NavigationSidebarSchema = exports.NavigationSectionSchema = exports.NavigationItemSchema = exports.PageInstanceFilterSchema = exports.PageContextDefinitionSchema = exports.PageContextItemDefinitionSchema = exports.PageContextFiltersSchema = exports.PageContextModeSchema = exports.PageBlockDefinitionSchema = exports.ModelMapperBlockDefinitionSchema = exports.ListBlockDefinitionSchema = exports.LegacyFormBlockDefinitionSchema = exports.PageFieldDefinitionSchema = exports.CardBlockDefinitionSchema = exports.CardBlockHeaderSchema = exports.FormV2PropsDefinitionSchema = exports.FormV2ComponentDefinitionSchema = exports.FieldSettingComponentDefinitionSchema = exports.ModalFormDefinitionSchema = exports.AlertComponentDefinitionSchema = exports.EmptyFormComponentDefinitionSchema = exports.ListComponentDefinitionSchema = void 0;
|
|
4
|
+
exports.MessageSendOutputSchema = exports.MessageSendInputSchema = exports.MessageSendMessageSchema = exports.MessageSendContactSchema = exports.MessageSendSubscriptionSchema = exports.MessageSendChannelSchema = exports.SkedyulConfigSchema = exports.ProvisionConfigSchema = exports.AgentDefinitionSchema = exports.WebhooksSchema = exports.WebhookHandlerDefinitionSchema = exports.WebhookTypeSchema = exports.WebhookHttpMethodSchema = exports.PageDefinitionSchema = exports.NavigationConfigSchema = exports.NavigationBreadcrumbSchema = exports.BreadcrumbItemSchema = exports.NavigationSidebarSchema = exports.NavigationSectionSchema = exports.NavigationItemSchema = exports.PageInstanceFilterSchema = exports.PageContextDefinitionSchema = exports.PageContextItemDefinitionSchema = exports.PageContextFiltersSchema = exports.PageContextModeSchema = exports.PageBlockDefinitionSchema = exports.ModelMapperBlockDefinitionSchema = exports.ListBlockDefinitionSchema = exports.LegacyFormBlockDefinitionSchema = exports.PageFieldDefinitionSchema = exports.CardBlockDefinitionSchema = exports.CardBlockHeaderSchema = exports.FormV2PropsDefinitionSchema = exports.FormV2ComponentDefinitionSchema = exports.FieldSettingComponentDefinitionSchema = exports.ModalFormDefinitionSchema = exports.AlertComponentDefinitionSchema = exports.EmptyFormComponentDefinitionSchema = exports.ListComponentDefinitionSchema = void 0;
|
|
5
5
|
exports.safeParseConfig = safeParseConfig;
|
|
6
6
|
exports.isModelDependency = isModelDependency;
|
|
7
7
|
exports.isChannelDependency = isChannelDependency;
|
|
@@ -668,6 +668,25 @@ exports.WebhooksSchema = zod_1.z.record(zod_1.z.string(), exports.WebhookHandler
|
|
|
668
668
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
669
669
|
// Provision Config Schema
|
|
670
670
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
671
|
+
// Agent Definition Schema
|
|
672
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
673
|
+
exports.AgentDefinitionSchema = zod_1.z.object({
|
|
674
|
+
/** Unique identifier within the app (used for upserts) */
|
|
675
|
+
handle: zod_1.z.string().regex(/^[a-z0-9_-]+$/, 'Handle must be lowercase alphanumeric with dashes/underscores'),
|
|
676
|
+
/** Display name */
|
|
677
|
+
name: zod_1.z.string().min(1),
|
|
678
|
+
/** Description of what the agent does */
|
|
679
|
+
description: zod_1.z.string(),
|
|
680
|
+
/** System prompt (static, no templating) */
|
|
681
|
+
system: zod_1.z.string(),
|
|
682
|
+
/** Tool names to bind (can be empty for orchestrator agents) */
|
|
683
|
+
tools: zod_1.z.array(zod_1.z.string()),
|
|
684
|
+
/** Optional LLM model override */
|
|
685
|
+
llmModelId: zod_1.z.string().optional(),
|
|
686
|
+
/** Parent agent that can call this agent ('composer' or another agent handle) */
|
|
687
|
+
parentAgent: zod_1.z.string().optional(),
|
|
688
|
+
});
|
|
689
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
671
690
|
exports.ProvisionConfigSchema = zod_1.z.object({
|
|
672
691
|
env: exports.EnvSchemaSchema.optional(),
|
|
673
692
|
models: zod_1.z.array(exports.ModelDefinitionSchema).optional(),
|
|
@@ -689,6 +708,7 @@ exports.SkedyulConfigSchema = zod_1.z.object({
|
|
|
689
708
|
tools: zod_1.z.unknown().optional(),
|
|
690
709
|
webhooks: zod_1.z.unknown().optional(),
|
|
691
710
|
provision: zod_1.z.union([exports.ProvisionConfigSchema, zod_1.z.unknown()]).optional(),
|
|
711
|
+
agents: zod_1.z.array(exports.AgentDefinitionSchema).optional(),
|
|
692
712
|
});
|
|
693
713
|
function safeParseConfig(data) {
|
|
694
714
|
const result = exports.SkedyulConfigSchema.safeParse(data);
|
package/dist/server.js
CHANGED
|
@@ -44,6 +44,7 @@ const streamableHttp_js_1 = require("@modelcontextprotocol/sdk/server/streamable
|
|
|
44
44
|
const z = __importStar(require("zod"));
|
|
45
45
|
const service_1 = require("./core/service");
|
|
46
46
|
const client_1 = require("./core/client");
|
|
47
|
+
const errors_1 = require("./errors");
|
|
47
48
|
function normalizeBilling(billing) {
|
|
48
49
|
if (!billing || typeof billing.credits !== 'number') {
|
|
49
50
|
return { credits: 0 };
|
|
@@ -906,12 +907,24 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
|
|
|
906
907
|
});
|
|
907
908
|
}
|
|
908
909
|
catch (err) {
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
910
|
+
// Check for typed install errors
|
|
911
|
+
if (err instanceof errors_1.InstallError) {
|
|
912
|
+
sendJSON(res, 400, {
|
|
913
|
+
error: {
|
|
914
|
+
code: err.code,
|
|
915
|
+
message: err.message,
|
|
916
|
+
field: err.field,
|
|
917
|
+
},
|
|
918
|
+
});
|
|
919
|
+
}
|
|
920
|
+
else {
|
|
921
|
+
sendJSON(res, 500, {
|
|
922
|
+
error: {
|
|
923
|
+
code: -32603,
|
|
924
|
+
message: err instanceof Error ? err.message : String(err ?? ''),
|
|
925
|
+
},
|
|
926
|
+
});
|
|
927
|
+
}
|
|
915
928
|
}
|
|
916
929
|
return;
|
|
917
930
|
}
|
|
@@ -1423,6 +1436,16 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
|
|
|
1423
1436
|
return createResponse(200, { env: result.env ?? {}, redirect: result.redirect }, headers);
|
|
1424
1437
|
}
|
|
1425
1438
|
catch (err) {
|
|
1439
|
+
// Check for typed install errors
|
|
1440
|
+
if (err instanceof errors_1.InstallError) {
|
|
1441
|
+
return createResponse(400, {
|
|
1442
|
+
error: {
|
|
1443
|
+
code: err.code,
|
|
1444
|
+
message: err.message,
|
|
1445
|
+
field: err.field,
|
|
1446
|
+
},
|
|
1447
|
+
}, headers);
|
|
1448
|
+
}
|
|
1426
1449
|
return createResponse(500, {
|
|
1427
1450
|
error: {
|
|
1428
1451
|
code: -32603,
|