skedyul 0.3.18 → 0.3.19

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.
Files changed (44) hide show
  1. package/dist/.build-stamp +1 -1
  2. package/dist/cli/commands/validate.js +2 -2
  3. package/dist/config/app-config.d.ts +22 -7
  4. package/dist/config/app-config.js +5 -3
  5. package/dist/config/define.d.ts +129 -0
  6. package/dist/config/define.js +145 -0
  7. package/dist/config/index.d.ts +9 -2
  8. package/dist/config/index.js +19 -3
  9. package/dist/config/types/agent.d.ts +12 -12
  10. package/dist/config/types/agent.js +7 -3
  11. package/dist/config/types/base.d.ts +99 -0
  12. package/dist/config/types/base.js +47 -0
  13. package/dist/config/types/channel.d.ts +45 -22
  14. package/dist/config/types/channel.js +6 -0
  15. package/dist/config/types/compute.d.ts +9 -1
  16. package/dist/config/types/compute.js +5 -3
  17. package/dist/config/types/context.d.ts +46 -0
  18. package/dist/config/types/context.js +8 -0
  19. package/dist/config/types/env.d.ts +21 -5
  20. package/dist/config/types/env.js +7 -3
  21. package/dist/config/types/form.d.ts +361 -0
  22. package/dist/config/types/form.js +8 -0
  23. package/dist/config/types/index.d.ts +11 -2
  24. package/dist/config/types/index.js +24 -3
  25. package/dist/config/types/model.d.ts +103 -27
  26. package/dist/config/types/model.js +7 -0
  27. package/dist/config/types/navigation.d.ts +58 -0
  28. package/dist/config/types/navigation.js +8 -0
  29. package/dist/config/types/page.d.ts +28 -424
  30. package/dist/config/types/page.js +6 -3
  31. package/dist/config/types/resource.d.ts +3 -10
  32. package/dist/config/types/resource.js +3 -3
  33. package/dist/config/types/webhook.d.ts +33 -3
  34. package/dist/config/types/webhook.js +6 -3
  35. package/dist/config/types/workflow.d.ts +29 -3
  36. package/dist/config/types/workflow.js +6 -0
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +9 -1
  39. package/dist/schemas.d.ts +100 -100
  40. package/dist/types/index.d.ts +1 -0
  41. package/dist/types/mcp-protocol.d.ts +42 -0
  42. package/dist/types/mcp-protocol.js +7 -0
  43. package/dist/types/server.d.ts +2 -1
  44. package/package.json +1 -1
package/dist/.build-stamp CHANGED
@@ -1 +1 @@
1
- 1771814981231
1
+ 1771899916059
@@ -222,14 +222,14 @@ async function validateCommand(args) {
222
222
  if (provision?.models && provision.models.length > 0) {
223
223
  console.log('Models (INTERNAL):');
224
224
  for (const model of provision.models) {
225
- console.log(` ${model.handle}: ${model.name}`);
225
+ console.log(` ${model.handle}: ${model.label}`);
226
226
  }
227
227
  console.log('');
228
228
  }
229
229
  if (provision?.channels && provision.channels.length > 0) {
230
230
  console.log('Channels:');
231
231
  for (const channel of provision.channels) {
232
- console.log(` ${channel.handle}: ${channel.name}`);
232
+ console.log(` ${channel.handle}: ${channel.label}`);
233
233
  }
234
234
  console.log('');
235
235
  }
@@ -1,18 +1,26 @@
1
+ /**
2
+ * App configuration types.
3
+ *
4
+ * This module defines the main configuration interfaces for Skedyul apps.
5
+ */
1
6
  import type { ToolRegistry, WebhookRegistry, ToolMetadata, WebhookMetadata } from '../types';
2
- import type { EnvSchema, ComputeLayerType, ModelDefinition, RelationshipDefinition, ChannelDefinition, WorkflowDefinition, PageDefinition, NavigationConfig, AgentDefinition } from './types';
3
- export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, InstallHandlerResponseOAuth, InstallHandlerResponseStandard, HasOAuthCallback, ServerHooksWithOAuth, ServerHooksWithoutOAuth, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooks, } from '../types';
7
+ import type { EnvSchema, ComputeLayer, ModelDefinition, RelationshipDefinition, ChannelDefinition, WorkflowDefinition, PageDefinition, NavigationConfig, AgentDefinition } from './types';
4
8
  /**
5
9
  * Install configuration - defines per-install env vars and SHARED models.
10
+ * This is configured by users during app installation.
6
11
  */
7
12
  export interface InstallConfig {
8
- /** Per-install environment variables (collected from user during install, passed at runtime) */
13
+ /** Per-install environment variables (collected from user during install) */
9
14
  env?: EnvSchema;
10
15
  /** SHARED model definitions (mapped to user's existing data during installation) */
11
16
  models?: ModelDefinition[];
12
17
  /** Relationship definitions between SHARED models */
13
18
  relationships?: RelationshipDefinition[];
14
19
  }
15
- /** Provision-level configuration - auto-synced when app version is deployed */
20
+ /**
21
+ * Provision configuration - auto-synced when app version is deployed.
22
+ * This is configured by developers and shared across all installations.
23
+ */
16
24
  export interface ProvisionConfig {
17
25
  /** Global environment variables (developer-level, shared across all installs) */
18
26
  env?: EnvSchema;
@@ -29,6 +37,9 @@ export interface ProvisionConfig {
29
37
  /** Page definitions for app UI */
30
38
  pages?: PageDefinition[];
31
39
  }
40
+ /**
41
+ * Main Skedyul app configuration.
42
+ */
32
43
  export interface SkedyulConfig {
33
44
  /** App name */
34
45
  name: string;
@@ -37,7 +48,7 @@ export interface SkedyulConfig {
37
48
  /** App description */
38
49
  description?: string;
39
50
  /** Compute layer: 'serverless' (Lambda) or 'dedicated' (ECS/Docker) */
40
- computeLayer?: ComputeLayerType;
51
+ computeLayer?: ComputeLayer;
41
52
  /** Tool registry - direct object or dynamic import */
42
53
  tools?: ToolRegistry | Promise<{
43
54
  toolRegistry: ToolRegistry;
@@ -50,18 +61,22 @@ export interface SkedyulConfig {
50
61
  provision?: ProvisionConfig | Promise<{
51
62
  default: ProvisionConfig;
52
63
  }>;
53
- /** Install configuration - hooks for install/uninstall lifecycle */
64
+ /** Install configuration - direct object or dynamic import */
54
65
  install?: InstallConfig | Promise<{
55
66
  default: InstallConfig;
56
67
  }>;
57
68
  /** Agent definitions - multi-tenant agents with tool bindings */
58
69
  agents?: AgentDefinition[];
59
70
  }
71
+ /**
72
+ * Serializable config (for database storage).
73
+ * This is the resolved form of SkedyulConfig without functions or promises.
74
+ */
60
75
  export interface SerializableSkedyulConfig {
61
76
  name: string;
62
77
  version?: string;
63
78
  description?: string;
64
- computeLayer?: ComputeLayerType;
79
+ computeLayer?: ComputeLayer;
65
80
  /** Tool metadata (serialized from ToolRegistry) */
66
81
  tools?: ToolMetadata[];
67
82
  /** Webhook metadata (serialized from WebhookRegistry) */
@@ -1,9 +1,11 @@
1
1
  "use strict";
2
+ /**
3
+ * App configuration types.
4
+ *
5
+ * This module defines the main configuration interfaces for Skedyul apps.
6
+ */
2
7
  Object.defineProperty(exports, "__esModule", { value: true });
3
8
  exports.defineConfig = defineConfig;
4
- // ─────────────────────────────────────────────────────────────────────────────
5
- // Helper Function
6
- // ─────────────────────────────────────────────────────────────────────────────
7
9
  /**
8
10
  * Define a Skedyul app configuration with full type safety.
9
11
  */
@@ -0,0 +1,129 @@
1
+ /**
2
+ * Define helper functions for modular config files.
3
+ *
4
+ * These helpers provide type safety when defining resources in separate files.
5
+ * They are identity functions that simply return their input with proper typing.
6
+ *
7
+ * @example
8
+ * // models/compliance-record.ts
9
+ * import { defineModel } from 'skedyul'
10
+ *
11
+ * export default defineModel({
12
+ * handle: 'compliance_record',
13
+ * label: 'Compliance Record',
14
+ * scope: 'internal',
15
+ * fields: [...]
16
+ * })
17
+ */
18
+ import type { ModelDefinition } from './types/model';
19
+ import type { ChannelDefinition } from './types/channel';
20
+ import type { PageDefinition } from './types/page';
21
+ import type { WorkflowDefinition } from './types/workflow';
22
+ import type { AgentDefinition } from './types/agent';
23
+ import type { EnvSchema } from './types/env';
24
+ import type { NavigationConfig } from './types/navigation';
25
+ /**
26
+ * Define a model with full type safety.
27
+ *
28
+ * @example
29
+ * export default defineModel({
30
+ * handle: 'compliance_record',
31
+ * label: 'Compliance Record',
32
+ * labelPlural: 'Compliance Records',
33
+ * scope: 'internal',
34
+ * fields: [
35
+ * { handle: 'status', label: 'Status', type: 'string', owner: 'app' }
36
+ * ]
37
+ * })
38
+ */
39
+ export declare function defineModel(model: ModelDefinition): ModelDefinition;
40
+ /**
41
+ * Define a channel with full type safety.
42
+ *
43
+ * @example
44
+ * export default defineChannel({
45
+ * handle: 'sms',
46
+ * label: 'SMS',
47
+ * icon: 'message-square',
48
+ * fields: [...],
49
+ * capabilities: {
50
+ * messaging: { label: 'SMS Messages', send: 'send_sms' }
51
+ * }
52
+ * })
53
+ */
54
+ export declare function defineChannel(channel: ChannelDefinition): ChannelDefinition;
55
+ /**
56
+ * Define a page with full type safety.
57
+ *
58
+ * @example
59
+ * export default definePage({
60
+ * handle: 'phone-numbers',
61
+ * label: 'Phone Numbers',
62
+ * type: 'list',
63
+ * path: '/phone-numbers',
64
+ * blocks: [...]
65
+ * })
66
+ */
67
+ export declare function definePage(page: PageDefinition): PageDefinition;
68
+ /**
69
+ * Define a workflow with full type safety.
70
+ *
71
+ * @example
72
+ * export default defineWorkflow({
73
+ * handle: 'provision_number',
74
+ * label: 'Provision Number',
75
+ * path: './workflows/provision-number.yaml',
76
+ * actions: [...]
77
+ * })
78
+ */
79
+ export declare function defineWorkflow(workflow: WorkflowDefinition): WorkflowDefinition;
80
+ /**
81
+ * Define an agent with full type safety.
82
+ *
83
+ * @example
84
+ * export default defineAgent({
85
+ * handle: 'support_agent',
86
+ * label: 'Support Agent',
87
+ * description: 'Handles customer support inquiries',
88
+ * system: 'You are a helpful support agent...',
89
+ * tools: ['search_knowledge_base', 'create_ticket']
90
+ * })
91
+ */
92
+ export declare function defineAgent(agent: AgentDefinition): AgentDefinition;
93
+ /**
94
+ * Define environment variables with full type safety.
95
+ *
96
+ * @example
97
+ * export default defineEnv({
98
+ * TWILIO_ACCOUNT_SID: {
99
+ * label: 'Twilio Account SID',
100
+ * scope: 'provision',
101
+ * required: true,
102
+ * visibility: 'encrypted'
103
+ * },
104
+ * BUSINESS_PHONE: {
105
+ * label: 'Business Phone',
106
+ * scope: 'install',
107
+ * required: true
108
+ * }
109
+ * })
110
+ */
111
+ export declare function defineEnv(env: EnvSchema): EnvSchema;
112
+ /**
113
+ * Define navigation configuration with full type safety.
114
+ *
115
+ * @example
116
+ * export default defineNavigation({
117
+ * sidebar: {
118
+ * sections: [
119
+ * {
120
+ * title: 'Main',
121
+ * items: [
122
+ * { label: 'Dashboard', href: '/', icon: 'home' }
123
+ * ]
124
+ * }
125
+ * ]
126
+ * }
127
+ * })
128
+ */
129
+ export declare function defineNavigation(navigation: NavigationConfig): NavigationConfig;
@@ -0,0 +1,145 @@
1
+ "use strict";
2
+ /**
3
+ * Define helper functions for modular config files.
4
+ *
5
+ * These helpers provide type safety when defining resources in separate files.
6
+ * They are identity functions that simply return their input with proper typing.
7
+ *
8
+ * @example
9
+ * // models/compliance-record.ts
10
+ * import { defineModel } from 'skedyul'
11
+ *
12
+ * export default defineModel({
13
+ * handle: 'compliance_record',
14
+ * label: 'Compliance Record',
15
+ * scope: 'internal',
16
+ * fields: [...]
17
+ * })
18
+ */
19
+ Object.defineProperty(exports, "__esModule", { value: true });
20
+ exports.defineModel = defineModel;
21
+ exports.defineChannel = defineChannel;
22
+ exports.definePage = definePage;
23
+ exports.defineWorkflow = defineWorkflow;
24
+ exports.defineAgent = defineAgent;
25
+ exports.defineEnv = defineEnv;
26
+ exports.defineNavigation = defineNavigation;
27
+ /**
28
+ * Define a model with full type safety.
29
+ *
30
+ * @example
31
+ * export default defineModel({
32
+ * handle: 'compliance_record',
33
+ * label: 'Compliance Record',
34
+ * labelPlural: 'Compliance Records',
35
+ * scope: 'internal',
36
+ * fields: [
37
+ * { handle: 'status', label: 'Status', type: 'string', owner: 'app' }
38
+ * ]
39
+ * })
40
+ */
41
+ function defineModel(model) {
42
+ return model;
43
+ }
44
+ /**
45
+ * Define a channel with full type safety.
46
+ *
47
+ * @example
48
+ * export default defineChannel({
49
+ * handle: 'sms',
50
+ * label: 'SMS',
51
+ * icon: 'message-square',
52
+ * fields: [...],
53
+ * capabilities: {
54
+ * messaging: { label: 'SMS Messages', send: 'send_sms' }
55
+ * }
56
+ * })
57
+ */
58
+ function defineChannel(channel) {
59
+ return channel;
60
+ }
61
+ /**
62
+ * Define a page with full type safety.
63
+ *
64
+ * @example
65
+ * export default definePage({
66
+ * handle: 'phone-numbers',
67
+ * label: 'Phone Numbers',
68
+ * type: 'list',
69
+ * path: '/phone-numbers',
70
+ * blocks: [...]
71
+ * })
72
+ */
73
+ function definePage(page) {
74
+ return page;
75
+ }
76
+ /**
77
+ * Define a workflow with full type safety.
78
+ *
79
+ * @example
80
+ * export default defineWorkflow({
81
+ * handle: 'provision_number',
82
+ * label: 'Provision Number',
83
+ * path: './workflows/provision-number.yaml',
84
+ * actions: [...]
85
+ * })
86
+ */
87
+ function defineWorkflow(workflow) {
88
+ return workflow;
89
+ }
90
+ /**
91
+ * Define an agent with full type safety.
92
+ *
93
+ * @example
94
+ * export default defineAgent({
95
+ * handle: 'support_agent',
96
+ * label: 'Support Agent',
97
+ * description: 'Handles customer support inquiries',
98
+ * system: 'You are a helpful support agent...',
99
+ * tools: ['search_knowledge_base', 'create_ticket']
100
+ * })
101
+ */
102
+ function defineAgent(agent) {
103
+ return agent;
104
+ }
105
+ /**
106
+ * Define environment variables with full type safety.
107
+ *
108
+ * @example
109
+ * export default defineEnv({
110
+ * TWILIO_ACCOUNT_SID: {
111
+ * label: 'Twilio Account SID',
112
+ * scope: 'provision',
113
+ * required: true,
114
+ * visibility: 'encrypted'
115
+ * },
116
+ * BUSINESS_PHONE: {
117
+ * label: 'Business Phone',
118
+ * scope: 'install',
119
+ * required: true
120
+ * }
121
+ * })
122
+ */
123
+ function defineEnv(env) {
124
+ return env;
125
+ }
126
+ /**
127
+ * Define navigation configuration with full type safety.
128
+ *
129
+ * @example
130
+ * export default defineNavigation({
131
+ * sidebar: {
132
+ * sections: [
133
+ * {
134
+ * title: 'Main',
135
+ * items: [
136
+ * { label: 'Dashboard', href: '/', icon: 'home' }
137
+ * ]
138
+ * }
139
+ * ]
140
+ * }
141
+ * })
142
+ */
143
+ function defineNavigation(navigation) {
144
+ return navigation;
145
+ }
@@ -1,9 +1,16 @@
1
1
  /**
2
- * Config module - re-exports all config types and utilities
2
+ * Config module - re-exports all config types and utilities.
3
+ *
4
+ * NAMING CONVENTIONS:
5
+ * - All type literals use lowercase (e.g., 'string', 'internal', 'one-to-many')
6
+ * - Use `handle` for unique identifiers (snake_case)
7
+ * - Use `label` for display names (human-readable)
8
+ * - Use `description` for optional explanatory text
9
+ * - All definition types extend BaseDefinition
3
10
  */
4
11
  export * from './types';
5
12
  export type { InstallConfig, ProvisionConfig, SkedyulConfig, SerializableSkedyulConfig, } from './app-config';
6
13
  export { defineConfig } from './app-config';
7
- export type { InstallHandlerContext, InstallHandlerResult, InstallHandler, InstallHandlerResponseOAuth, InstallHandlerResponseStandard, HasOAuthCallback, ServerHooksWithOAuth, ServerHooksWithoutOAuth, ProvisionHandlerContext, ProvisionHandlerResult, ProvisionHandler, ServerHooks, } from './app-config';
14
+ export { defineModel, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, } from './define';
8
15
  export { CONFIG_FILE_NAMES, loadConfig, validateConfig } from './loader';
9
16
  export { getAllEnvKeys, getRequiredInstallEnvKeys } from './utils';
@@ -1,6 +1,13 @@
1
1
  "use strict";
2
2
  /**
3
- * Config module - re-exports all config types and utilities
3
+ * Config module - re-exports all config types and utilities.
4
+ *
5
+ * NAMING CONVENTIONS:
6
+ * - All type literals use lowercase (e.g., 'string', 'internal', 'one-to-many')
7
+ * - Use `handle` for unique identifiers (snake_case)
8
+ * - Use `label` for display names (human-readable)
9
+ * - Use `description` for optional explanatory text
10
+ * - All definition types extend BaseDefinition
4
11
  */
5
12
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
13
  if (k2 === undefined) k2 = k;
@@ -17,11 +24,20 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
17
24
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
18
25
  };
19
26
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.validateConfig = exports.loadConfig = exports.CONFIG_FILE_NAMES = exports.defineConfig = void 0;
21
- // Re-export all types
27
+ exports.getRequiredInstallEnvKeys = exports.getAllEnvKeys = exports.validateConfig = exports.loadConfig = exports.CONFIG_FILE_NAMES = exports.defineNavigation = exports.defineEnv = exports.defineAgent = exports.defineWorkflow = exports.definePage = exports.defineChannel = exports.defineModel = exports.defineConfig = void 0;
28
+ // Re-export all types from types/
22
29
  __exportStar(require("./types"), exports);
23
30
  var app_config_1 = require("./app-config");
24
31
  Object.defineProperty(exports, "defineConfig", { enumerable: true, get: function () { return app_config_1.defineConfig; } });
32
+ // Re-export define helpers for modular config files
33
+ var define_1 = require("./define");
34
+ Object.defineProperty(exports, "defineModel", { enumerable: true, get: function () { return define_1.defineModel; } });
35
+ Object.defineProperty(exports, "defineChannel", { enumerable: true, get: function () { return define_1.defineChannel; } });
36
+ Object.defineProperty(exports, "definePage", { enumerable: true, get: function () { return define_1.definePage; } });
37
+ Object.defineProperty(exports, "defineWorkflow", { enumerable: true, get: function () { return define_1.defineWorkflow; } });
38
+ Object.defineProperty(exports, "defineAgent", { enumerable: true, get: function () { return define_1.defineAgent; } });
39
+ Object.defineProperty(exports, "defineEnv", { enumerable: true, get: function () { return define_1.defineEnv; } });
40
+ Object.defineProperty(exports, "defineNavigation", { enumerable: true, get: function () { return define_1.defineNavigation; } });
25
41
  // Re-export loader utilities
26
42
  var loader_1 = require("./loader");
27
43
  Object.defineProperty(exports, "CONFIG_FILE_NAMES", { enumerable: true, get: function () { return loader_1.CONFIG_FILE_NAMES; } });
@@ -1,15 +1,15 @@
1
1
  /**
2
- * Definition for an app-provided agent.
3
- * Agents are created globally during provisioning and become available
2
+ * Agent definition types.
3
+ *
4
+ * Agents are AI assistants that can use tools to perform tasks.
5
+ * They are created globally during provisioning and become available
4
6
  * to workplaces that install the app.
5
7
  */
6
- export interface AgentDefinition {
7
- /** Unique identifier within the app (used for upserts) */
8
- handle: string;
9
- /** Display name */
10
- name: string;
11
- /** Description of what the agent does */
12
- description: string;
8
+ import type { BaseDefinition } from './base';
9
+ /**
10
+ * Agent definition.
11
+ */
12
+ export interface AgentDefinition extends BaseDefinition {
13
13
  /** System prompt (static, no templating) */
14
14
  system: string;
15
15
  /** Tool names to bind (must exist in this app's tools) */
@@ -21,9 +21,9 @@ export interface AgentDefinition {
21
21
  * Creates an AGENT-type tool and binds it to the parent.
22
22
  *
23
23
  * Values:
24
- * - 'composer' - Bind to the workspace's Composer agent
25
- * - '<handle>' - Bind to another agent in this app (by handle)
26
- * - undefined - Standalone agent (not callable by other agents)
24
+ * - 'composer': Bind to the workspace's Composer agent
25
+ * - '<handle>': Bind to another agent in this app (by handle)
26
+ * - undefined: Standalone agent (not callable by other agents)
27
27
  */
28
28
  parentAgent?: string;
29
29
  }
@@ -1,5 +1,9 @@
1
1
  "use strict";
2
- // ─────────────────────────────────────────────────────────────────────────────
3
- // Agent Definition
4
- // ─────────────────────────────────────────────────────────────────────────────
2
+ /**
3
+ * Agent definition types.
4
+ *
5
+ * Agents are AI assistants that can use tools to perform tasks.
6
+ * They are created globally during provisioning and become available
7
+ * to workplaces that install the app.
8
+ */
5
9
  Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Base types and common definitions for the Skedyul config system.
3
+ *
4
+ * ## NAMING CONVENTIONS
5
+ *
6
+ * ### Type Literals
7
+ * All type literals use **lowercase** (e.g., 'string', 'internal', 'one-to-many').
8
+ * This is more modern, aligns with TypeScript conventions, and is easier to type.
9
+ *
10
+ * ### Identifiers
11
+ * - `handle`: Unique identifier within the app (snake_case, e.g., 'compliance_record')
12
+ * - `label`: Human-readable display name
13
+ * - `description`: Optional explanatory text for documentation/UI
14
+ *
15
+ * ### Boolean Properties
16
+ * - Use bare names for static booleans (e.g., `required`, `disabled`, `hidden`)
17
+ * - Use `is` prefix only for computed/dynamic booleans that support Liquid templates
18
+ * (e.g., `isDisabled: boolean | string` where string is a Liquid template)
19
+ *
20
+ * ### Definition Types
21
+ * All definition types (Model, Channel, Page, Workflow, Agent) extend `BaseDefinition`
22
+ * which provides the common `handle`, `label`, and `description` properties.
23
+ *
24
+ * ## FILE STRUCTURE
25
+ *
26
+ * The config types are organized into focused modules:
27
+ * - `base.ts` - Common types (BaseDefinition, Scope, FieldOwner, etc.)
28
+ * - `model.ts` - Model and field definitions
29
+ * - `channel.ts` - Channel definitions
30
+ * - `workflow.ts` - Workflow definitions
31
+ * - `agent.ts` - Agent definitions
32
+ * - `page.ts` - Page definitions
33
+ * - `form.ts` - Form component definitions
34
+ * - `navigation.ts` - Navigation definitions
35
+ * - `context.ts` - Page context definitions
36
+ * - `env.ts` - Environment variable definitions
37
+ *
38
+ * ## SCOPE SYSTEM
39
+ *
40
+ * Resources can have two scopes:
41
+ * - `'internal'`: App-owned, created once per app version during provisioning
42
+ * - `'shared'`: User-mapped, configured during installation to link to existing data
43
+ *
44
+ * The scope is declared as a property on the resource, not by file location.
45
+ */
46
+ /**
47
+ * Base interface for all definition types.
48
+ * All models, channels, workflows, pages, agents, etc. extend this.
49
+ */
50
+ export interface BaseDefinition {
51
+ /** Unique identifier within the app (snake_case, e.g., 'compliance_record') */
52
+ handle: string;
53
+ /** Human-readable display name */
54
+ label: string;
55
+ /** Optional description for documentation/UI */
56
+ description?: string;
57
+ }
58
+ /**
59
+ * Scope determines when and how a resource is created.
60
+ * - 'internal': App-owned, created once per app version during provisioning
61
+ * - 'shared': User-mapped, configured during installation to link to existing data
62
+ */
63
+ export type Scope = 'internal' | 'shared';
64
+ /**
65
+ * Field owner determines who can modify a field's value.
66
+ * - 'app': Only the app can modify (via tools/webhooks)
67
+ * - 'workplace': Only the user can modify (via UI)
68
+ * - 'both': Either can modify
69
+ */
70
+ export type FieldOwner = 'app' | 'workplace' | 'both';
71
+ /**
72
+ * Visibility setting for environment variables.
73
+ * - 'visible': Value is shown in UI
74
+ * - 'encrypted': Value is hidden/masked in UI
75
+ */
76
+ export type Visibility = 'visible' | 'encrypted';
77
+ /**
78
+ * Compute layer determines how the app runs.
79
+ * - 'serverless': AWS Lambda - fast cold starts, pay-per-use, auto-scaling
80
+ * - 'dedicated': ECS/Docker - persistent connections, custom runtimes
81
+ */
82
+ export type ComputeLayer = 'serverless' | 'dedicated';
83
+ /**
84
+ * Standard filter type used for querying data.
85
+ * Format: { fieldHandle: { operator: value } }
86
+ * Operators: eq, ne, gt, gte, lt, lte, in, contains, etc.
87
+ */
88
+ export type StructuredFilter = Record<string, Record<string, string | number | boolean | (string | number | boolean)[]>>;
89
+ /**
90
+ * Option for select/dropdown fields.
91
+ */
92
+ export interface FieldOption {
93
+ /** Display text */
94
+ label: string;
95
+ /** Stored value */
96
+ value: string;
97
+ /** Optional color for status indicators (e.g., 'yellow', 'green', 'red') */
98
+ color?: string;
99
+ }
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ /**
3
+ * Base types and common definitions for the Skedyul config system.
4
+ *
5
+ * ## NAMING CONVENTIONS
6
+ *
7
+ * ### Type Literals
8
+ * All type literals use **lowercase** (e.g., 'string', 'internal', 'one-to-many').
9
+ * This is more modern, aligns with TypeScript conventions, and is easier to type.
10
+ *
11
+ * ### Identifiers
12
+ * - `handle`: Unique identifier within the app (snake_case, e.g., 'compliance_record')
13
+ * - `label`: Human-readable display name
14
+ * - `description`: Optional explanatory text for documentation/UI
15
+ *
16
+ * ### Boolean Properties
17
+ * - Use bare names for static booleans (e.g., `required`, `disabled`, `hidden`)
18
+ * - Use `is` prefix only for computed/dynamic booleans that support Liquid templates
19
+ * (e.g., `isDisabled: boolean | string` where string is a Liquid template)
20
+ *
21
+ * ### Definition Types
22
+ * All definition types (Model, Channel, Page, Workflow, Agent) extend `BaseDefinition`
23
+ * which provides the common `handle`, `label`, and `description` properties.
24
+ *
25
+ * ## FILE STRUCTURE
26
+ *
27
+ * The config types are organized into focused modules:
28
+ * - `base.ts` - Common types (BaseDefinition, Scope, FieldOwner, etc.)
29
+ * - `model.ts` - Model and field definitions
30
+ * - `channel.ts` - Channel definitions
31
+ * - `workflow.ts` - Workflow definitions
32
+ * - `agent.ts` - Agent definitions
33
+ * - `page.ts` - Page definitions
34
+ * - `form.ts` - Form component definitions
35
+ * - `navigation.ts` - Navigation definitions
36
+ * - `context.ts` - Page context definitions
37
+ * - `env.ts` - Environment variable definitions
38
+ *
39
+ * ## SCOPE SYSTEM
40
+ *
41
+ * Resources can have two scopes:
42
+ * - `'internal'`: App-owned, created once per app version during provisioning
43
+ * - `'shared'`: User-mapped, configured during installation to link to existing data
44
+ *
45
+ * The scope is declared as a property on the resource, not by file location.
46
+ */
47
+ Object.defineProperty(exports, "__esModule", { value: true });