skedyul 1.2.41 → 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.
Files changed (51) hide show
  1. package/dist/cli/commands/agents.d.ts +1 -0
  2. package/dist/cli/commands/chat.d.ts +1 -0
  3. package/dist/cli/commands/crm.d.ts +1 -0
  4. package/dist/cli/commands/skills.d.ts +1 -0
  5. package/dist/cli/index.js +17627 -6229
  6. package/dist/cli/utils/auth.js +495 -0
  7. package/dist/cli/utils/mock-context.d.ts +22 -0
  8. package/dist/cli/utils/sse.d.ts +100 -0
  9. package/dist/compiler/compiler.d.ts +12 -0
  10. package/dist/compiler/index.d.ts +2 -0
  11. package/dist/compiler/types.d.ts +173 -0
  12. package/dist/config/index.d.ts +1 -0
  13. package/dist/config/schema-loader.d.ts +156 -0
  14. package/dist/config/types/model.d.ts +28 -0
  15. package/dist/context/index.d.ts +2 -0
  16. package/dist/context/resolver.d.ts +51 -0
  17. package/dist/context/types.d.ts +217 -0
  18. package/dist/dedicated/server.js +10 -6
  19. package/dist/esm/index.mjs +9616 -444
  20. package/dist/events/index.d.ts +1 -0
  21. package/dist/events/types.d.ts +528 -0
  22. package/dist/index.d.ts +16 -0
  23. package/dist/index.js +9709 -455
  24. package/dist/memory/index.d.ts +4 -0
  25. package/dist/memory/service.d.ts +78 -0
  26. package/dist/memory/types.d.ts +169 -0
  27. package/dist/schemas/agent-schema-v3.d.ts +437 -0
  28. package/dist/schemas/agent-schema-v3.js +539 -0
  29. package/dist/schemas/agent-schema-v3.mjs +497 -0
  30. package/dist/schemas/agent-schema.d.ts +1504 -0
  31. package/dist/schemas/agent-schema.js +7896 -0
  32. package/dist/schemas/agent-schema.mjs +7867 -0
  33. package/dist/schemas/crm-schema.d.ts +448 -0
  34. package/dist/schemas/index.d.ts +2 -0
  35. package/dist/schemas.d.ts +69 -36
  36. package/dist/server.js +10 -6
  37. package/dist/serverless/server.mjs +10 -6
  38. package/dist/skills/index.d.ts +1 -0
  39. package/dist/skills/types.d.ts +355 -0
  40. package/dist/skills/types.js +281 -0
  41. package/dist/skills/types.mjs +234 -0
  42. package/dist/triggers/index.d.ts +2 -0
  43. package/dist/triggers/resolver.d.ts +31 -0
  44. package/dist/triggers/types.d.ts +313 -0
  45. package/dist/types/data-blocks.d.ts +105 -0
  46. package/dist/types/index.d.ts +2 -1
  47. package/dist/types/tool-response.d.ts +16 -0
  48. package/dist/types/tool.d.ts +30 -8
  49. package/dist/workflows/index.d.ts +1 -0
  50. package/dist/workflows/types.d.ts +295 -0
  51. package/package.json +19 -1
@@ -0,0 +1,234 @@
1
+ import { createRequire } from 'module'; const require = createRequire(import.meta.url);
2
+
3
+ // src/skills/types.ts
4
+ import { z } from "zod/v4";
5
+ var SKILL_SCHEMA_VERSION = "https://skedyul.com/schemas/skill/v1";
6
+ var SKILL_SCHEMA_VERSION_V2 = "https://skedyul.com/schemas/skill/v2";
7
+ var SkillSourceSchema = z.enum(["BUILTIN", "S3", "APP", "EXTERNAL"]);
8
+ var SkillToolRequirementSchema = z.object({
9
+ requires: z.array(z.string()).optional(),
10
+ provides: z.array(z.string()).optional()
11
+ });
12
+ var SkillToolSandboxSchema = z.object({
13
+ mock: z.unknown().optional()
14
+ });
15
+ var ToolConstraintsSchema = z.object({
16
+ maxCallsPerRun: z.number().optional(),
17
+ idempotent: z.boolean().optional(),
18
+ restricted: z.boolean().optional(),
19
+ tags: z.array(z.string()).optional()
20
+ });
21
+ var SkillToolDefinitionSchema = z.object({
22
+ tool: z.string(),
23
+ description: z.string().optional(),
24
+ overrides: z.record(z.string(), z.unknown()).optional(),
25
+ sandbox: SkillToolSandboxSchema.optional(),
26
+ requiresApproval: z.boolean().optional(),
27
+ constraints: ToolConstraintsSchema.optional()
28
+ });
29
+ var SkillToolsSchema = z.union([
30
+ SkillToolRequirementSchema,
31
+ z.array(SkillToolDefinitionSchema)
32
+ ]);
33
+ var SkillExampleSchema = z.object({
34
+ context: z.string().optional(),
35
+ input: z.string(),
36
+ reasoning: z.string().optional(),
37
+ output: z.string(),
38
+ tool_call: z.string().optional()
39
+ });
40
+ var SkillEvaluationMetricSchema = z.object({
41
+ metric: z.string(),
42
+ description: z.string().optional(),
43
+ threshold: z.number().optional()
44
+ });
45
+ var CRMContextSchema = z.object({
46
+ models: z.record(z.string(), z.array(z.string()))
47
+ // { modelHandle: [fieldHandles] }
48
+ });
49
+ var SkillYAMLSchema = z.object({
50
+ // Schema version
51
+ $schema: z.string().optional(),
52
+ // Identity
53
+ handle: z.string(),
54
+ name: z.string(),
55
+ version: z.string().optional(),
56
+ description: z.string().optional(),
57
+ // Instructions injected into agent system prompt
58
+ instructions: z.string(),
59
+ // Tool configuration - supports both v1 and v2 formats
60
+ tools: SkillToolsSchema.optional(),
61
+ // CRM context - specifies which models/fields to include in schema
62
+ crmContext: CRMContextSchema.optional(),
63
+ // Few-shot examples
64
+ examples: z.array(SkillExampleSchema).optional(),
65
+ // Evaluation criteria
66
+ evaluation: z.array(SkillEvaluationMetricSchema).optional(),
67
+ // Tags for discovery
68
+ tags: z.array(z.string()).optional()
69
+ });
70
+ var SkillYAMLV2Schema = z.object({
71
+ $schema: z.literal(SKILL_SCHEMA_VERSION_V2).optional(),
72
+ handle: z.string(),
73
+ name: z.string(),
74
+ version: z.string().optional(),
75
+ description: z.string().optional(),
76
+ instructions: z.string(),
77
+ tools: z.array(SkillToolDefinitionSchema).optional(),
78
+ crmContext: CRMContextSchema.optional(),
79
+ examples: z.array(SkillExampleSchema).optional(),
80
+ evaluation: z.array(SkillEvaluationMetricSchema).optional(),
81
+ tags: z.array(z.string()).optional()
82
+ });
83
+ var SkillVersionWeightSchema = z.object({
84
+ version: z.number(),
85
+ weight: z.number()
86
+ });
87
+ var SkillRefSchema = z.union([
88
+ z.string(),
89
+ // Just handle - uses latest published version
90
+ z.object({
91
+ skill: z.string(),
92
+ description: z.string().optional(),
93
+ // For AI SDK Agent Skills discovery
94
+ // Version selection (pick one):
95
+ version: z.number().optional(),
96
+ // Pin to specific version number
97
+ versions: z.array(SkillVersionWeightSchema).optional(),
98
+ // A/B testing weights
99
+ // Legacy support:
100
+ instructions: z.string().optional(),
101
+ // Inline instructions (deprecated)
102
+ enabled: z.boolean().optional()
103
+ })
104
+ ]);
105
+ var SkillMetadataSchema = z.object({
106
+ id: z.string(),
107
+ handle: z.string(),
108
+ name: z.string(),
109
+ version: z.string().optional(),
110
+ description: z.string().optional(),
111
+ source: SkillSourceSchema,
112
+ s3Key: z.string().optional(),
113
+ appVersionId: z.string().optional(),
114
+ workplaceId: z.string().optional(),
115
+ tags: z.array(z.string()).optional(),
116
+ createdAt: z.string().datetime().optional(),
117
+ updatedAt: z.string().datetime().optional()
118
+ });
119
+ var ResolvedSkillSchema = z.object({
120
+ handle: z.string(),
121
+ name: z.string(),
122
+ instructions: z.string().optional(),
123
+ description: z.string().optional(),
124
+ tools: z.array(z.string()).optional(),
125
+ examples: z.array(SkillExampleSchema).optional()
126
+ });
127
+ var LoadedSkillSchema = z.object({
128
+ handle: z.string(),
129
+ name: z.string(),
130
+ instructions: z.string().optional(),
131
+ description: z.string().optional(),
132
+ tools: z.array(SkillToolDefinitionSchema).optional(),
133
+ examples: z.array(SkillExampleSchema).optional()
134
+ });
135
+ function isV2SkillTools(tools) {
136
+ if (!tools) return false;
137
+ return Array.isArray(tools);
138
+ }
139
+ function getSkillToolNames(tools) {
140
+ if (!tools) return [];
141
+ if (isV2SkillTools(tools)) {
142
+ return tools.map((t) => t.tool);
143
+ }
144
+ return tools.requires || [];
145
+ }
146
+ function convertV1ToV2Tools(requires) {
147
+ return requires.map((tool) => ({ tool }));
148
+ }
149
+ function defineSkill(skill) {
150
+ return SkillYAMLSchema.parse(skill);
151
+ }
152
+ function validateSkillYAML(skill) {
153
+ const result = SkillYAMLSchema.safeParse(skill);
154
+ if (result.success) {
155
+ return { success: true, data: result.data };
156
+ }
157
+ return { success: false, error: result.error };
158
+ }
159
+ function formatSkillInstructions(skills) {
160
+ if (skills.length === 0) return "";
161
+ const sections = skills.map((skill) => {
162
+ if (!skill.instructions) {
163
+ return `## ${skill.name}
164
+
165
+ ${skill.description || "No description available."}`;
166
+ }
167
+ let section = `## ${skill.name}
168
+
169
+ ${skill.instructions}`;
170
+ if (skill.examples && skill.examples.length > 0) {
171
+ section += "\n\n### Examples\n";
172
+ for (const example of skill.examples) {
173
+ section += `
174
+ **Input:** ${example.input}
175
+ `;
176
+ if (example.reasoning) {
177
+ section += `**Reasoning:** ${example.reasoning}
178
+ `;
179
+ }
180
+ section += `**Output:** ${example.output}
181
+ `;
182
+ }
183
+ }
184
+ return section;
185
+ });
186
+ return `# Skills
187
+
188
+ ${sections.join("\n\n---\n\n")}`;
189
+ }
190
+ function formatSkillDiscovery(skills, workflowInstructions) {
191
+ if (skills.length === 0) return "";
192
+ const skillsList = skills.map((s) => `- **${s.name}**: ${s.description}`).join("\n");
193
+ const defaultWorkflow = `WORKFLOW FOR EVERY RESPONSE:
194
+ 1. Check the Current Context data to understand the current state
195
+ 2. Read the skill descriptions below - each tells you WHEN to use it
196
+ 3. Load the matching skill using \`system:skill:load\`
197
+ 4. Follow the skill's instructions exactly`;
198
+ const workflow = workflowInstructions ?? defaultWorkflow;
199
+ return `## Skills
200
+
201
+ ${workflow}
202
+
203
+ Available skills:
204
+ ${skillsList}
205
+
206
+ IMPORTANT: Always use the proper tool calls. Do NOT output XML-like tags in your response.`;
207
+ }
208
+ export {
209
+ CRMContextSchema,
210
+ LoadedSkillSchema,
211
+ ResolvedSkillSchema,
212
+ SKILL_SCHEMA_VERSION,
213
+ SKILL_SCHEMA_VERSION_V2,
214
+ SkillEvaluationMetricSchema,
215
+ SkillExampleSchema,
216
+ SkillMetadataSchema,
217
+ SkillRefSchema,
218
+ SkillSourceSchema,
219
+ SkillToolDefinitionSchema,
220
+ SkillToolRequirementSchema,
221
+ SkillToolSandboxSchema,
222
+ SkillToolsSchema,
223
+ SkillVersionWeightSchema,
224
+ SkillYAMLSchema,
225
+ SkillYAMLV2Schema,
226
+ ToolConstraintsSchema,
227
+ convertV1ToV2Tools,
228
+ defineSkill,
229
+ formatSkillDiscovery,
230
+ formatSkillInstructions,
231
+ getSkillToolNames,
232
+ isV2SkillTools,
233
+ validateSkillYAML
234
+ };
@@ -0,0 +1,2 @@
1
+ export { CRMDataSchema, SenderContextSchema, ThreadContextItemSchema, ParticipantContextSchema, TriggerContextSchema, InputMappingSchema, EventConditionsSchema, TriggerConfigSchema, ResolvedTriggerSchema, WorkflowInputDefinitionSchema, WorkflowInputSchemaSchema, TriggerResolutionError, type CRMData, type SenderContext, type ThreadContextItem, type ParticipantContext, type TriggerContext, type InputMapping, type EventConditions, type TriggerConfig, type ResolvedTrigger, type WorkflowInputDefinition, type WorkflowInputSchema, } from './types';
2
+ export { evaluateTemplate, evaluateCondition, resolveInputMappings, matchesTrigger, } from './resolver';
@@ -0,0 +1,31 @@
1
+ import type { TriggerContext, InputMapping, WorkflowInputSchema } from './types';
2
+ /**
3
+ * Simple Liquid-like template evaluation
4
+ * Supports basic property access: {{ thread.sender.crm.email }}
5
+ *
6
+ * For production, consider using a proper Liquid library like liquidjs
7
+ */
8
+ export declare function evaluateTemplate(template: string, context: TriggerContext): unknown;
9
+ /**
10
+ * Evaluate a condition expression against context
11
+ * Supports basic comparisons: {{ event.participant.kind == 'CONTACT' }}
12
+ *
13
+ * For production, consider using a proper expression evaluator
14
+ */
15
+ export declare function evaluateCondition(condition: string, context: TriggerContext): boolean;
16
+ /**
17
+ * Resolve input mappings against trigger context
18
+ */
19
+ export declare function resolveInputMappings(mappings: InputMapping, inputSchema: WorkflowInputSchema | undefined, context: TriggerContext): Promise<Record<string, unknown>>;
20
+ /**
21
+ * Check if a trigger matches an event based on subscriptions and conditions
22
+ */
23
+ export declare function matchesTrigger(trigger: {
24
+ workflow?: {
25
+ events?: {
26
+ subscribes?: string[];
27
+ condition?: string;
28
+ };
29
+ };
30
+ eventConditions?: Record<string, string>;
31
+ }, eventType: string, context: TriggerContext): boolean;
@@ -0,0 +1,313 @@
1
+ import { z } from 'zod/v4';
2
+ /**
3
+ * CRM data structure for context resolution
4
+ */
5
+ export declare const CRMDataSchema: z.ZodObject<{
6
+ model: z.ZodString;
7
+ instanceId: z.ZodString;
8
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
9
+ }, z.core.$strip>;
10
+ export type CRMData = z.infer<typeof CRMDataSchema>;
11
+ /**
12
+ * Sender context - who sent the triggering message/event
13
+ */
14
+ export declare const SenderContextSchema: z.ZodObject<{
15
+ kind: z.ZodEnum<{
16
+ CONTACT: "CONTACT";
17
+ MEMBER: "MEMBER";
18
+ AGENT: "AGENT";
19
+ WORKFLOW: "WORKFLOW";
20
+ }>;
21
+ displayName: z.ZodOptional<z.ZodString>;
22
+ crm: z.ZodOptional<z.ZodObject<{
23
+ model: z.ZodString;
24
+ instanceId: z.ZodString;
25
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
26
+ }, z.core.$strip>>;
27
+ }, z.core.$strip>;
28
+ export type SenderContext = z.infer<typeof SenderContextSchema>;
29
+ /**
30
+ * Thread context - linked CRM instances
31
+ */
32
+ export declare const ThreadContextItemSchema: z.ZodObject<{
33
+ handle: z.ZodString;
34
+ model: z.ZodString;
35
+ instanceId: z.ZodString;
36
+ data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
37
+ }, z.core.$strip>;
38
+ export type ThreadContextItem = z.infer<typeof ThreadContextItemSchema>;
39
+ /**
40
+ * Participant in thread context
41
+ */
42
+ export declare const ParticipantContextSchema: z.ZodObject<{
43
+ id: z.ZodString;
44
+ kind: z.ZodEnum<{
45
+ CONTACT: "CONTACT";
46
+ MEMBER: "MEMBER";
47
+ AGENT: "AGENT";
48
+ WORKFLOW: "WORKFLOW";
49
+ }>;
50
+ displayName: z.ZodOptional<z.ZodString>;
51
+ contactId: z.ZodOptional<z.ZodString>;
52
+ memberId: z.ZodOptional<z.ZodString>;
53
+ agentId: z.ZodOptional<z.ZodString>;
54
+ workflowId: z.ZodOptional<z.ZodString>;
55
+ }, z.core.$strip>;
56
+ export type ParticipantContext = z.infer<typeof ParticipantContextSchema>;
57
+ /**
58
+ * Full trigger context - available for input mapping evaluation
59
+ */
60
+ export declare const TriggerContextSchema: z.ZodObject<{
61
+ event: z.ZodObject<{
62
+ type: z.ZodUnion<readonly [z.ZodEnum<{
63
+ "thread.message.received": "thread.message.received";
64
+ "thread.message.sent": "thread.message.sent";
65
+ "thread.participant.joined": "thread.participant.joined";
66
+ "thread.participant.left": "thread.participant.left";
67
+ "thread.participant.mentioned": "thread.participant.mentioned";
68
+ "thread.context.changed": "thread.context.changed";
69
+ "thread.status.changed": "thread.status.changed";
70
+ "thread.agent.delegated": "thread.agent.delegated";
71
+ "thread.agent.completed": "thread.agent.completed";
72
+ "thread.workflow.triggered": "thread.workflow.triggered";
73
+ "thread.workflow.completed": "thread.workflow.completed";
74
+ "thread.follow_up.due": "thread.follow_up.due";
75
+ "thread.reminder.due": "thread.reminder.due";
76
+ }>, z.ZodString]>;
77
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
78
+ participant: z.ZodOptional<z.ZodObject<{
79
+ id: z.ZodString;
80
+ kind: z.ZodEnum<{
81
+ CONTACT: "CONTACT";
82
+ MEMBER: "MEMBER";
83
+ AGENT: "AGENT";
84
+ WORKFLOW: "WORKFLOW";
85
+ }>;
86
+ displayName: z.ZodOptional<z.ZodString>;
87
+ contactId: z.ZodOptional<z.ZodString>;
88
+ memberId: z.ZodOptional<z.ZodString>;
89
+ agentId: z.ZodOptional<z.ZodString>;
90
+ workflowId: z.ZodOptional<z.ZodString>;
91
+ }, z.core.$strip>>;
92
+ }, z.core.$strip>;
93
+ thread: z.ZodObject<{
94
+ id: z.ZodString;
95
+ title: z.ZodOptional<z.ZodString>;
96
+ status: z.ZodOptional<z.ZodString>;
97
+ sender: z.ZodOptional<z.ZodObject<{
98
+ kind: z.ZodEnum<{
99
+ CONTACT: "CONTACT";
100
+ MEMBER: "MEMBER";
101
+ AGENT: "AGENT";
102
+ WORKFLOW: "WORKFLOW";
103
+ }>;
104
+ displayName: z.ZodOptional<z.ZodString>;
105
+ crm: z.ZodOptional<z.ZodObject<{
106
+ model: z.ZodString;
107
+ instanceId: z.ZodString;
108
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
109
+ }, z.core.$strip>>;
110
+ }, z.core.$strip>>;
111
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
112
+ model: z.ZodString;
113
+ instanceId: z.ZodString;
114
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
115
+ }, z.core.$strip>>>;
116
+ participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
117
+ id: z.ZodString;
118
+ kind: z.ZodEnum<{
119
+ CONTACT: "CONTACT";
120
+ MEMBER: "MEMBER";
121
+ AGENT: "AGENT";
122
+ WORKFLOW: "WORKFLOW";
123
+ }>;
124
+ displayName: z.ZodOptional<z.ZodString>;
125
+ contactId: z.ZodOptional<z.ZodString>;
126
+ memberId: z.ZodOptional<z.ZodString>;
127
+ agentId: z.ZodOptional<z.ZodString>;
128
+ workflowId: z.ZodOptional<z.ZodString>;
129
+ }, z.core.$strip>>>;
130
+ }, z.core.$strip>;
131
+ workplace: z.ZodObject<{
132
+ id: z.ZodString;
133
+ name: z.ZodOptional<z.ZodString>;
134
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
135
+ }, z.core.$strip>;
136
+ }, z.core.$strip>;
137
+ export type TriggerContext = z.infer<typeof TriggerContextSchema>;
138
+ /**
139
+ * Input mapping - Liquid template string that resolves to a value
140
+ * e.g., "{{ thread.sender.crm }}" or "{{ thread.context.Customer }}"
141
+ */
142
+ export declare const InputMappingSchema: z.ZodRecord<z.ZodString, z.ZodString>;
143
+ export type InputMapping = z.infer<typeof InputMappingSchema>;
144
+ /**
145
+ * Event conditions - per-event-type conditions
146
+ * e.g., { "thread.participant.joined": "{{ event.participant.kind == 'CONTACT' }}" }
147
+ */
148
+ export declare const EventConditionsSchema: z.ZodRecord<z.ZodString, z.ZodString>;
149
+ export type EventConditions = z.infer<typeof EventConditionsSchema>;
150
+ /**
151
+ * Trigger configuration (stored in database)
152
+ */
153
+ export declare const TriggerConfigSchema: z.ZodObject<{
154
+ id: z.ZodString;
155
+ workflowId: z.ZodString;
156
+ workflowVersionId: z.ZodOptional<z.ZodString>;
157
+ workplaceId: z.ZodString;
158
+ handle: z.ZodString;
159
+ inputMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
160
+ eventConditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
161
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
162
+ type: z.ZodOptional<z.ZodString>;
163
+ isEnabled: z.ZodOptional<z.ZodBoolean>;
164
+ }, z.core.$strip>;
165
+ export type TriggerConfig = z.infer<typeof TriggerConfigSchema>;
166
+ /**
167
+ * Resolved trigger - after input mappings have been evaluated
168
+ */
169
+ export declare const ResolvedTriggerSchema: z.ZodObject<{
170
+ trigger: z.ZodObject<{
171
+ id: z.ZodString;
172
+ workflowId: z.ZodString;
173
+ workflowVersionId: z.ZodOptional<z.ZodString>;
174
+ workplaceId: z.ZodString;
175
+ handle: z.ZodString;
176
+ inputMappings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
177
+ eventConditions: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
178
+ config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
179
+ type: z.ZodOptional<z.ZodString>;
180
+ isEnabled: z.ZodOptional<z.ZodBoolean>;
181
+ }, z.core.$strip>;
182
+ workflow: z.ZodObject<{
183
+ id: z.ZodString;
184
+ handle: z.ZodString;
185
+ name: z.ZodOptional<z.ZodString>;
186
+ inputs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
187
+ events: z.ZodOptional<z.ZodObject<{
188
+ subscribes: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodEnum<{
189
+ "thread.message.received": "thread.message.received";
190
+ "thread.message.sent": "thread.message.sent";
191
+ "thread.participant.joined": "thread.participant.joined";
192
+ "thread.participant.left": "thread.participant.left";
193
+ "thread.participant.mentioned": "thread.participant.mentioned";
194
+ "thread.context.changed": "thread.context.changed";
195
+ "thread.status.changed": "thread.status.changed";
196
+ "thread.agent.delegated": "thread.agent.delegated";
197
+ "thread.agent.completed": "thread.agent.completed";
198
+ "thread.workflow.triggered": "thread.workflow.triggered";
199
+ "thread.workflow.completed": "thread.workflow.completed";
200
+ "thread.follow_up.due": "thread.follow_up.due";
201
+ "thread.reminder.due": "thread.reminder.due";
202
+ }>, z.ZodString]>>>;
203
+ condition: z.ZodOptional<z.ZodString>;
204
+ }, z.core.$strip>>;
205
+ }, z.core.$strip>;
206
+ inputs: z.ZodRecord<z.ZodString, z.ZodUnknown>;
207
+ context: z.ZodObject<{
208
+ event: z.ZodObject<{
209
+ type: z.ZodUnion<readonly [z.ZodEnum<{
210
+ "thread.message.received": "thread.message.received";
211
+ "thread.message.sent": "thread.message.sent";
212
+ "thread.participant.joined": "thread.participant.joined";
213
+ "thread.participant.left": "thread.participant.left";
214
+ "thread.participant.mentioned": "thread.participant.mentioned";
215
+ "thread.context.changed": "thread.context.changed";
216
+ "thread.status.changed": "thread.status.changed";
217
+ "thread.agent.delegated": "thread.agent.delegated";
218
+ "thread.agent.completed": "thread.agent.completed";
219
+ "thread.workflow.triggered": "thread.workflow.triggered";
220
+ "thread.workflow.completed": "thread.workflow.completed";
221
+ "thread.follow_up.due": "thread.follow_up.due";
222
+ "thread.reminder.due": "thread.reminder.due";
223
+ }>, z.ZodString]>;
224
+ payload: z.ZodRecord<z.ZodString, z.ZodUnknown>;
225
+ participant: z.ZodOptional<z.ZodObject<{
226
+ id: z.ZodString;
227
+ kind: z.ZodEnum<{
228
+ CONTACT: "CONTACT";
229
+ MEMBER: "MEMBER";
230
+ AGENT: "AGENT";
231
+ WORKFLOW: "WORKFLOW";
232
+ }>;
233
+ displayName: z.ZodOptional<z.ZodString>;
234
+ contactId: z.ZodOptional<z.ZodString>;
235
+ memberId: z.ZodOptional<z.ZodString>;
236
+ agentId: z.ZodOptional<z.ZodString>;
237
+ workflowId: z.ZodOptional<z.ZodString>;
238
+ }, z.core.$strip>>;
239
+ }, z.core.$strip>;
240
+ thread: z.ZodObject<{
241
+ id: z.ZodString;
242
+ title: z.ZodOptional<z.ZodString>;
243
+ status: z.ZodOptional<z.ZodString>;
244
+ sender: z.ZodOptional<z.ZodObject<{
245
+ kind: z.ZodEnum<{
246
+ CONTACT: "CONTACT";
247
+ MEMBER: "MEMBER";
248
+ AGENT: "AGENT";
249
+ WORKFLOW: "WORKFLOW";
250
+ }>;
251
+ displayName: z.ZodOptional<z.ZodString>;
252
+ crm: z.ZodOptional<z.ZodObject<{
253
+ model: z.ZodString;
254
+ instanceId: z.ZodString;
255
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
256
+ }, z.core.$strip>>;
257
+ }, z.core.$strip>>;
258
+ context: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
259
+ model: z.ZodString;
260
+ instanceId: z.ZodString;
261
+ data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
262
+ }, z.core.$strip>>>;
263
+ participants: z.ZodOptional<z.ZodArray<z.ZodObject<{
264
+ id: z.ZodString;
265
+ kind: z.ZodEnum<{
266
+ CONTACT: "CONTACT";
267
+ MEMBER: "MEMBER";
268
+ AGENT: "AGENT";
269
+ WORKFLOW: "WORKFLOW";
270
+ }>;
271
+ displayName: z.ZodOptional<z.ZodString>;
272
+ contactId: z.ZodOptional<z.ZodString>;
273
+ memberId: z.ZodOptional<z.ZodString>;
274
+ agentId: z.ZodOptional<z.ZodString>;
275
+ workflowId: z.ZodOptional<z.ZodString>;
276
+ }, z.core.$strip>>>;
277
+ }, z.core.$strip>;
278
+ workplace: z.ZodObject<{
279
+ id: z.ZodString;
280
+ name: z.ZodOptional<z.ZodString>;
281
+ settings: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
282
+ }, z.core.$strip>;
283
+ }, z.core.$strip>;
284
+ }, z.core.$strip>;
285
+ export type ResolvedTrigger = z.infer<typeof ResolvedTriggerSchema>;
286
+ /**
287
+ * Trigger resolution error
288
+ */
289
+ export declare class TriggerResolutionError extends Error {
290
+ readonly triggerId?: string | undefined;
291
+ readonly inputName?: string | undefined;
292
+ constructor(message: string, triggerId?: string | undefined, inputName?: string | undefined);
293
+ }
294
+ /**
295
+ * Workflow input schema definition
296
+ */
297
+ export declare const WorkflowInputDefinitionSchema: z.ZodObject<{
298
+ type: z.ZodString;
299
+ required: z.ZodOptional<z.ZodBoolean>;
300
+ description: z.ZodOptional<z.ZodString>;
301
+ default: z.ZodOptional<z.ZodUnknown>;
302
+ }, z.core.$strip>;
303
+ export type WorkflowInputDefinition = z.infer<typeof WorkflowInputDefinitionSchema>;
304
+ /**
305
+ * Workflow input schema (map of input name to definition)
306
+ */
307
+ export declare const WorkflowInputSchemaSchema: z.ZodRecord<z.ZodString, z.ZodObject<{
308
+ type: z.ZodString;
309
+ required: z.ZodOptional<z.ZodBoolean>;
310
+ description: z.ZodOptional<z.ZodString>;
311
+ default: z.ZodOptional<z.ZodUnknown>;
312
+ }, z.core.$strip>>;
313
+ export type WorkflowInputSchema = z.infer<typeof WorkflowInputSchemaSchema>;
@@ -0,0 +1,105 @@
1
+ /**
2
+ * DataBlock types for rich UI rendering of tool results.
3
+ * Apps can include dataBlocks in their tool responses to control
4
+ * how results are displayed in the agent chat UI.
5
+ */
6
+ /**
7
+ * Link structure for navigating to CRM views or external URLs.
8
+ */
9
+ export interface DataBlockLink {
10
+ modelHandle?: string;
11
+ modelHandlePlural?: string;
12
+ modelLabel?: string;
13
+ recordId?: string;
14
+ filters?: Record<string, unknown>;
15
+ url?: string;
16
+ }
17
+ /**
18
+ * Column definition for spreadsheet blocks.
19
+ */
20
+ export interface SpreadsheetColumn {
21
+ id: string;
22
+ label: string;
23
+ type?: string;
24
+ }
25
+ /**
26
+ * Spreadsheet block - tabular data with preview rows.
27
+ */
28
+ export interface SpreadsheetBlock {
29
+ type: 'spreadsheet';
30
+ title: string;
31
+ columns: SpreadsheetColumn[];
32
+ data: Array<{
33
+ id: string;
34
+ [key: string]: unknown;
35
+ }>;
36
+ totalRows: number;
37
+ link?: DataBlockLink;
38
+ }
39
+ /**
40
+ * Avatar configuration for profile blocks.
41
+ */
42
+ export interface ProfileAvatar {
43
+ initials?: string;
44
+ imageUrl?: string;
45
+ }
46
+ /**
47
+ * Field entry for profile blocks.
48
+ */
49
+ export interface ProfileField {
50
+ label: string;
51
+ value: string;
52
+ }
53
+ /**
54
+ * Profile block - entity card with key fields.
55
+ */
56
+ export interface ProfileBlock {
57
+ type: 'profile';
58
+ title: string;
59
+ subtitle?: string;
60
+ avatar?: ProfileAvatar;
61
+ fields: ProfileField[];
62
+ link?: DataBlockLink;
63
+ }
64
+ /**
65
+ * Field change entry showing old → new value transition.
66
+ */
67
+ export interface FieldChangeItem {
68
+ label: string;
69
+ oldValue: string | null;
70
+ newValue: string | null;
71
+ error?: {
72
+ code: string;
73
+ message: string;
74
+ };
75
+ }
76
+ /**
77
+ * Field changes block - shows old → new value transitions.
78
+ */
79
+ export interface FieldChangesBlock {
80
+ type: 'fieldChanges';
81
+ title: string;
82
+ subtitle?: string;
83
+ changes: FieldChangeItem[];
84
+ link?: DataBlockLink;
85
+ }
86
+ /**
87
+ * DateTime block - shows a calendar event/appointment with status.
88
+ */
89
+ export interface DateTimeBlock {
90
+ type: 'dateTime';
91
+ title: string;
92
+ subtitle?: string;
93
+ datetime: string;
94
+ timezone?: string;
95
+ duration?: number;
96
+ location?: string;
97
+ status?: 'confirmed' | 'pending' | 'cancelled';
98
+ icon?: 'calendar' | 'clock' | 'check';
99
+ link?: DataBlockLink;
100
+ }
101
+ /**
102
+ * Union of all data block types.
103
+ * Tools can return these in their results to be forwarded to the UI.
104
+ */
105
+ export type DataBlock = SpreadsheetBlock | ProfileBlock | FieldChangesBlock | DateTimeBlock;