skedyul 0.2.134 → 0.2.136

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 CHANGED
@@ -1 +1 @@
1
- 1770160446171
1
+ 1770176002055
package/dist/config.d.ts CHANGED
@@ -636,7 +636,7 @@ export interface WebhookHandlerDefinition {
636
636
  handler: WebhookHandlerFn;
637
637
  }
638
638
  export type Webhooks = Record<string, WebhookHandlerDefinition>;
639
- export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, } from './types';
639
+ export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooks, } from './types';
640
640
  /**
641
641
  * Install configuration - defines per-install env vars and lifecycle hooks.
642
642
  * Tool names reference tools in the tool registry, enabling agent-invocation.
@@ -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/index.d.ts CHANGED
@@ -11,4 +11,4 @@ declare const _default: {
11
11
  };
12
12
  export default _default;
13
13
  export { defineConfig, loadConfig, validateConfig, CONFIG_FILE_NAMES, getAllEnvKeys, getRequiredInstallEnvKeys, } from './config';
14
- export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, ComputeLayerType, InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, InstallConfig, ModelDefinition, ModelFieldDefinition, ResourceScope, FieldOwner, InternalFieldDataType, FieldOption, InlineFieldDefinition, AppFieldVisibility, RelationshipDefinition, RelationshipLink, RelationshipCardinality, OnDeleteBehavior, ChannelDefinition, ChannelCapability, ChannelCapabilityType, ChannelFieldDefinition, WorkflowDefinition, WorkflowAction, WorkflowActionInput, PageDefinition, PageBlockDefinition, PageFieldDefinition, PageActionDefinition, PageType, PageBlockType, PageFieldType, PageFieldSource, PageFormHeader, PageContextMode, PageContextItemDefinition, PageContextDefinition, PageInstanceFilter, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, WebhookHttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ProvisionConfig, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, StructuredFilter, } from './config';
14
+ export type { SkedyulConfig, SerializableSkedyulConfig, EnvVariableDefinition, EnvSchema, EnvVisibility, ComputeLayerType, InstallHandlerContext, InstallHandlerResult, InstallHandler, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooks, InstallConfig, ModelDefinition, ModelFieldDefinition, ResourceScope, FieldOwner, InternalFieldDataType, FieldOption, InlineFieldDefinition, AppFieldVisibility, RelationshipDefinition, RelationshipLink, RelationshipCardinality, OnDeleteBehavior, ChannelDefinition, ChannelCapability, ChannelCapabilityType, ChannelFieldDefinition, WorkflowDefinition, WorkflowAction, WorkflowActionInput, PageDefinition, PageBlockDefinition, PageFieldDefinition, PageActionDefinition, PageType, PageBlockType, PageFieldType, PageFieldSource, PageFormHeader, PageContextMode, PageContextItemDefinition, PageContextDefinition, PageInstanceFilter, NavigationItem, NavigationSection, NavigationSidebar, BreadcrumbItem, NavigationBreadcrumb, NavigationConfig, WebhookHttpMethod, WebhookRequest, WebhookHandlerContext, WebhookHandlerResponse, WebhookHandlerFn, WebhookHandlerDefinition, Webhooks, WebhookHandlerMetadata, ProvisionConfig, ModelDependency, ChannelDependency, WorkflowDependency, ResourceDependency, StructuredFilter, } from './config';
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
@@ -860,7 +860,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
860
860
  }
861
861
  // Handle /install endpoint for install handlers
862
862
  if (pathname === '/install' && req.method === 'POST') {
863
- if (!config.installHandler) {
863
+ if (!config.hooks?.install) {
864
864
  sendJSON(res, 404, { error: 'Install handler not configured' });
865
865
  return;
866
866
  }
@@ -887,13 +887,18 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
887
887
  app: installBody.context.app,
888
888
  };
889
889
  // Build request-scoped config for SDK access
890
+ // Use env from request body (contains generated token from workflow)
890
891
  const installRequestConfig = {
891
- baseUrl: process.env.SKEDYUL_API_URL ?? '',
892
- apiToken: process.env.SKEDYUL_API_TOKEN ?? '',
892
+ baseUrl: installBody.env?.SKEDYUL_API_URL ??
893
+ process.env.SKEDYUL_API_URL ??
894
+ '',
895
+ apiToken: installBody.env?.SKEDYUL_API_TOKEN ??
896
+ process.env.SKEDYUL_API_TOKEN ??
897
+ '',
893
898
  };
894
899
  try {
895
900
  const result = await (0, client_1.runWithConfig)(installRequestConfig, async () => {
896
- return await config.installHandler(installContext);
901
+ return await config.hooks.install(installContext);
897
902
  });
898
903
  sendJSON(res, 200, {
899
904
  env: result.env ?? {},
@@ -912,7 +917,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
912
917
  }
913
918
  // Handle /provision endpoint for provision handlers
914
919
  if (pathname === '/provision' && req.method === 'POST') {
915
- if (!config.provisionHandler) {
920
+ if (!config.hooks?.provision) {
916
921
  sendJSON(res, 404, { error: 'Provision handler not configured' });
917
922
  return;
918
923
  }
@@ -945,7 +950,7 @@ function createDedicatedServerInstance(config, tools, callTool, state, mcpServer
945
950
  };
946
951
  try {
947
952
  const result = await (0, client_1.runWithConfig)(provisionRequestConfig, async () => {
948
- return await config.provisionHandler(provisionContext);
953
+ return await config.hooks.provision(provisionContext);
949
954
  });
950
955
  sendJSON(res, 200, result);
951
956
  }
@@ -1382,7 +1387,7 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
1382
1387
  }
1383
1388
  // Handle /install endpoint for install handlers
1384
1389
  if (path === '/install' && method === 'POST') {
1385
- if (!config.installHandler) {
1390
+ if (!config.hooks?.install) {
1386
1391
  return createResponse(404, { error: 'Install handler not configured' }, headers);
1387
1392
  }
1388
1393
  let installBody;
@@ -1401,8 +1406,20 @@ function createServerlessInstance(config, tools, callTool, state, mcpServer, reg
1401
1406
  appInstallationId: installBody.context.appInstallationId,
1402
1407
  app: installBody.context.app,
1403
1408
  };
1409
+ // Build request-scoped config for SDK access
1410
+ // Use env from request body (contains generated token from workflow)
1411
+ const installRequestConfig = {
1412
+ baseUrl: installBody.env?.SKEDYUL_API_URL ??
1413
+ process.env.SKEDYUL_API_URL ??
1414
+ '',
1415
+ apiToken: installBody.env?.SKEDYUL_API_TOKEN ??
1416
+ process.env.SKEDYUL_API_TOKEN ??
1417
+ '',
1418
+ };
1404
1419
  try {
1405
- const result = await config.installHandler(installContext);
1420
+ const result = await (0, client_1.runWithConfig)(installRequestConfig, async () => {
1421
+ return await config.hooks.install(installContext);
1422
+ });
1406
1423
  return createResponse(200, { env: result.env ?? {}, redirect: result.redirect }, headers);
1407
1424
  }
1408
1425
  catch (err) {
package/dist/types.d.ts CHANGED
@@ -157,6 +157,16 @@ export interface CorsOptions {
157
157
  allowMethods?: string;
158
158
  allowHeaders?: string;
159
159
  }
160
+ /**
161
+ * Lifecycle hooks for the Skedyul server.
162
+ * These handlers are called during app installation and provisioning.
163
+ */
164
+ export interface ServerHooks {
165
+ /** Called during app installation to validate/normalize env and perform setup */
166
+ install?: InstallHandler;
167
+ /** Called after app version provisioning to set up version-level resources */
168
+ provision?: ProvisionHandler;
169
+ }
160
170
  export interface SkedyulServerConfig {
161
171
  computeLayer: ComputeLayer;
162
172
  metadata: ServerMetadata;
@@ -165,10 +175,8 @@ export interface SkedyulServerConfig {
165
175
  ttlExtendSeconds?: number;
166
176
  cors?: CorsOptions;
167
177
  coreApi?: CoreApiConfig;
168
- /** Optional install handler for the /install endpoint */
169
- installHandler?: InstallHandler;
170
- /** Optional provision handler for the /provision endpoint */
171
- provisionHandler?: ProvisionHandler;
178
+ /** Lifecycle hooks for install and provision handlers */
179
+ hooks?: ServerHooks;
172
180
  }
173
181
  export interface InstallHandlerContext {
174
182
  env: Record<string, string>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "skedyul",
3
- "version": "0.2.134",
3
+ "version": "0.2.136",
4
4
  "description": "The Skedyul SDK for Node.js",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",