skedyul 1.2.40 → 1.2.43
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli/commands/agents.d.ts +1 -0
- package/dist/cli/commands/chat.d.ts +1 -0
- package/dist/cli/commands/crm.d.ts +1 -0
- package/dist/cli/commands/skills.d.ts +1 -0
- package/dist/cli/index.js +17636 -6197
- package/dist/cli/utils/auth.js +495 -0
- package/dist/cli/utils/mock-context.d.ts +22 -0
- package/dist/cli/utils/sse.d.ts +100 -0
- package/dist/compiler/compiler.d.ts +12 -0
- package/dist/compiler/index.d.ts +2 -0
- package/dist/compiler/types.d.ts +173 -0
- package/dist/config/index.d.ts +1 -0
- package/dist/config/schema-loader.d.ts +156 -0
- package/dist/config/types/model.d.ts +28 -0
- package/dist/context/index.d.ts +2 -0
- package/dist/context/resolver.d.ts +51 -0
- package/dist/context/types.d.ts +217 -0
- package/dist/dedicated/server.js +60 -15
- package/dist/esm/index.mjs +9815 -458
- package/dist/events/index.d.ts +1 -0
- package/dist/events/types.d.ts +528 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.js +9912 -458
- package/dist/memory/index.d.ts +4 -0
- package/dist/memory/service.d.ts +78 -0
- package/dist/memory/types.d.ts +169 -0
- package/dist/schemas/agent-schema-v3.d.ts +437 -0
- package/dist/schemas/agent-schema-v3.js +539 -0
- package/dist/schemas/agent-schema-v3.mjs +497 -0
- package/dist/schemas/agent-schema.d.ts +1504 -0
- package/dist/schemas/agent-schema.js +7896 -0
- package/dist/schemas/agent-schema.mjs +7867 -0
- package/dist/schemas/crm-schema.d.ts +448 -0
- package/dist/schemas/index.d.ts +2 -0
- package/dist/schemas.d.ts +69 -36
- package/dist/server.js +60 -15
- package/dist/serverless/server.mjs +60 -15
- package/dist/skills/index.d.ts +1 -0
- package/dist/skills/types.d.ts +355 -0
- package/dist/skills/types.js +281 -0
- package/dist/skills/types.mjs +234 -0
- package/dist/triggers/index.d.ts +2 -0
- package/dist/triggers/resolver.d.ts +31 -0
- package/dist/triggers/types.d.ts +313 -0
- package/dist/types/data-blocks.d.ts +105 -0
- package/dist/types/index.d.ts +3 -1
- package/dist/types/tool-response.d.ts +202 -0
- package/dist/types/tool.d.ts +157 -28
- package/dist/workflows/index.d.ts +1 -0
- package/dist/workflows/types.d.ts +295 -0
- package/package.json +19 -1
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { ResolvedSkill } from '../skills/types';
|
|
2
|
+
/**
|
|
3
|
+
* Validation error from compilation
|
|
4
|
+
*/
|
|
5
|
+
export interface ValidationError {
|
|
6
|
+
path: string;
|
|
7
|
+
message: string;
|
|
8
|
+
severity: 'error' | 'warning';
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Validation warning from compilation
|
|
12
|
+
*/
|
|
13
|
+
export interface ValidationWarning {
|
|
14
|
+
path: string;
|
|
15
|
+
message: string;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Resolved persona configuration
|
|
19
|
+
*/
|
|
20
|
+
export interface ResolvedPersona {
|
|
21
|
+
name: string;
|
|
22
|
+
style: string;
|
|
23
|
+
format?: {
|
|
24
|
+
maxChars?: number;
|
|
25
|
+
noEmojis?: boolean;
|
|
26
|
+
noHyphens?: boolean;
|
|
27
|
+
noBulletPoints?: boolean;
|
|
28
|
+
maxQuestionsPerMessage?: number;
|
|
29
|
+
noSignOffs?: boolean;
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Resolved tool configuration
|
|
34
|
+
*/
|
|
35
|
+
export interface ResolvedTool {
|
|
36
|
+
id: string;
|
|
37
|
+
kind: 'SYSTEM' | 'AGENT' | 'MCP';
|
|
38
|
+
name: string;
|
|
39
|
+
server?: string;
|
|
40
|
+
approval?: {
|
|
41
|
+
required: boolean;
|
|
42
|
+
conditions?: string[];
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Event configuration
|
|
47
|
+
*/
|
|
48
|
+
export interface EventConfig {
|
|
49
|
+
subscribes: string[];
|
|
50
|
+
emits: string[];
|
|
51
|
+
waits: Array<{
|
|
52
|
+
event: string;
|
|
53
|
+
timeout?: string;
|
|
54
|
+
onTimeout?: string;
|
|
55
|
+
}>;
|
|
56
|
+
cancels: string[];
|
|
57
|
+
condition?: string;
|
|
58
|
+
cancelCondition?: string;
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Memory configuration for IR
|
|
62
|
+
*/
|
|
63
|
+
export interface IRMemoryConfig {
|
|
64
|
+
working?: {
|
|
65
|
+
strategy: 'full' | 'rolling_summary' | 'sliding_window';
|
|
66
|
+
maxTokens: number;
|
|
67
|
+
summarizeAt?: number;
|
|
68
|
+
};
|
|
69
|
+
persistent?: {
|
|
70
|
+
namespace?: string;
|
|
71
|
+
};
|
|
72
|
+
semantic?: {
|
|
73
|
+
enabled: boolean;
|
|
74
|
+
topK: number;
|
|
75
|
+
scope: 'thread' | 'instance' | 'workspace';
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Policy configuration
|
|
80
|
+
*/
|
|
81
|
+
export interface PolicyConfig {
|
|
82
|
+
response?: {
|
|
83
|
+
requiresApproval: boolean;
|
|
84
|
+
conditions?: string[];
|
|
85
|
+
};
|
|
86
|
+
rules: string[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Runtime configuration
|
|
90
|
+
*/
|
|
91
|
+
export interface IRRuntimeConfig {
|
|
92
|
+
model: string;
|
|
93
|
+
timeout: string;
|
|
94
|
+
retry?: {
|
|
95
|
+
attempts?: number;
|
|
96
|
+
backoff?: 'linear' | 'exponential';
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Agent Intermediate Representation (IR)
|
|
101
|
+
* This is the compiled form of an agent YAML
|
|
102
|
+
*/
|
|
103
|
+
export interface AgentIR {
|
|
104
|
+
version: string;
|
|
105
|
+
handle: string;
|
|
106
|
+
name: string;
|
|
107
|
+
description?: string;
|
|
108
|
+
persona?: ResolvedPersona;
|
|
109
|
+
skills: ResolvedSkill[];
|
|
110
|
+
tools: ResolvedTool[];
|
|
111
|
+
events: EventConfig;
|
|
112
|
+
memory: IRMemoryConfig;
|
|
113
|
+
policies: PolicyConfig;
|
|
114
|
+
runtime: IRRuntimeConfig;
|
|
115
|
+
errors: ValidationError[];
|
|
116
|
+
warnings: ValidationWarning[];
|
|
117
|
+
requiredPermissions: string[];
|
|
118
|
+
estimatedTokens: number;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Workflow step in IR
|
|
122
|
+
*/
|
|
123
|
+
export interface WorkflowStepIR {
|
|
124
|
+
id: string;
|
|
125
|
+
service: string;
|
|
126
|
+
cmd: string;
|
|
127
|
+
needs: string[];
|
|
128
|
+
inputs: Record<string, unknown>;
|
|
129
|
+
condition?: string;
|
|
130
|
+
timeout?: string;
|
|
131
|
+
retry?: {
|
|
132
|
+
attempts?: number;
|
|
133
|
+
backoff?: 'linear' | 'exponential';
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Workflow Intermediate Representation (IR)
|
|
138
|
+
*/
|
|
139
|
+
export interface WorkflowIR {
|
|
140
|
+
version: string;
|
|
141
|
+
handle: string;
|
|
142
|
+
name: string;
|
|
143
|
+
description?: string;
|
|
144
|
+
inputs: Record<string, {
|
|
145
|
+
type: string;
|
|
146
|
+
required: boolean;
|
|
147
|
+
description?: string;
|
|
148
|
+
default?: unknown;
|
|
149
|
+
}>;
|
|
150
|
+
events: EventConfig;
|
|
151
|
+
steps: WorkflowStepIR[];
|
|
152
|
+
runtime: {
|
|
153
|
+
durable: boolean;
|
|
154
|
+
timeout?: string;
|
|
155
|
+
retry?: {
|
|
156
|
+
attempts?: number;
|
|
157
|
+
backoff?: 'linear' | 'exponential';
|
|
158
|
+
};
|
|
159
|
+
};
|
|
160
|
+
errors: ValidationError[];
|
|
161
|
+
warnings: ValidationWarning[];
|
|
162
|
+
stepOrder: string[];
|
|
163
|
+
hasCycles: boolean;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Compilation result
|
|
167
|
+
*/
|
|
168
|
+
export interface CompilationResult<T> {
|
|
169
|
+
success: boolean;
|
|
170
|
+
ir?: T;
|
|
171
|
+
errors: ValidationError[];
|
|
172
|
+
warnings: ValidationWarning[];
|
|
173
|
+
}
|
package/dist/config/index.d.ts
CHANGED
|
@@ -13,5 +13,6 @@ export type { InstallConfig, ProvisionConfig, BuildConfig, CorsOptions, SkedyulC
|
|
|
13
13
|
export { defineConfig } from './app-config';
|
|
14
14
|
export { defineModel, defineChannel, definePage, defineWorkflow, defineAgent, defineEnv, defineNavigation, } from './define';
|
|
15
15
|
export { CONFIG_FILE_NAMES, loadConfig, validateConfig } from './loader';
|
|
16
|
+
export { SCHEMA_FILE_EXTENSIONS, loadSchema, saveSchema, serializeSchemaToJson, serializeSchemaToTypeScript, transformToBackendSchema, transformFromBackendSchema, type LoadSchemaOptions, type LoadSchemaResult, type SerializeSchemaOptions, type BackendModelDefinition, type BackendFieldDefinition, type BackendRelationshipDefinition, type BackendDesiredSchema, } from './schema-loader';
|
|
16
17
|
export { loadAndResolveConfig, serializeResolvedConfig, type ResolvedConfig } from './resolver';
|
|
17
18
|
export { getAllEnvKeys, getRequiredInstallEnvKeys } from './utils';
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import { type CRMSchema } from '../schemas/crm-schema';
|
|
2
|
+
export declare const SCHEMA_FILE_EXTENSIONS: string[];
|
|
3
|
+
export interface LoadSchemaOptions {
|
|
4
|
+
/** Validate the schema after loading (default: true) */
|
|
5
|
+
validate?: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface LoadSchemaResult {
|
|
8
|
+
schema: CRMSchema;
|
|
9
|
+
filePath: string;
|
|
10
|
+
format: 'typescript' | 'json';
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Load a CRM schema from a file.
|
|
14
|
+
* Supports both .schema.ts (TypeScript) and .schema.json (JSON) formats.
|
|
15
|
+
*
|
|
16
|
+
* @param schemaPath - Path to the schema file
|
|
17
|
+
* @param options - Loading options
|
|
18
|
+
* @returns The loaded and validated schema
|
|
19
|
+
* @throws Error if the file doesn't exist, can't be parsed, or fails validation
|
|
20
|
+
*/
|
|
21
|
+
export declare function loadSchema(schemaPath: string, options?: LoadSchemaOptions): Promise<LoadSchemaResult>;
|
|
22
|
+
export interface SerializeSchemaOptions {
|
|
23
|
+
/** Include $schema field in JSON output (default: true) */
|
|
24
|
+
includeSchemaUrl?: boolean;
|
|
25
|
+
/** Pretty print JSON (default: true) */
|
|
26
|
+
pretty?: boolean;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Serialize a CRM schema to JSON string.
|
|
30
|
+
*/
|
|
31
|
+
export declare function serializeSchemaToJson(schema: CRMSchema, options?: SerializeSchemaOptions): string;
|
|
32
|
+
/**
|
|
33
|
+
* Serialize a CRM schema to TypeScript string.
|
|
34
|
+
*/
|
|
35
|
+
export declare function serializeSchemaToTypeScript(schema: CRMSchema): string;
|
|
36
|
+
/**
|
|
37
|
+
* Save a CRM schema to a file.
|
|
38
|
+
* Format is determined by file extension.
|
|
39
|
+
*/
|
|
40
|
+
export declare function saveSchema(schema: CRMSchema, outputPath: string, options?: SerializeSchemaOptions): Promise<void>;
|
|
41
|
+
/**
|
|
42
|
+
* Backend-compatible model definition.
|
|
43
|
+
*/
|
|
44
|
+
export interface BackendModelDefinition {
|
|
45
|
+
handle: string;
|
|
46
|
+
name: string;
|
|
47
|
+
namePlural?: string;
|
|
48
|
+
labelTemplate: string;
|
|
49
|
+
description?: string;
|
|
50
|
+
icon?: string;
|
|
51
|
+
fields?: BackendFieldDefinition[];
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Backend-compatible field definition.
|
|
55
|
+
*/
|
|
56
|
+
export interface BackendFieldDefinition {
|
|
57
|
+
handle: string;
|
|
58
|
+
label: string;
|
|
59
|
+
type: string;
|
|
60
|
+
helpText?: string | null;
|
|
61
|
+
isList?: boolean;
|
|
62
|
+
isUnique?: boolean;
|
|
63
|
+
requirement?: string;
|
|
64
|
+
defaultValue?: {
|
|
65
|
+
value: unknown[];
|
|
66
|
+
};
|
|
67
|
+
definition?: string | {
|
|
68
|
+
type: string;
|
|
69
|
+
options?: Array<{
|
|
70
|
+
value: string;
|
|
71
|
+
label: string;
|
|
72
|
+
color?: string | null;
|
|
73
|
+
}>;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Backend-compatible relationship definition.
|
|
78
|
+
*/
|
|
79
|
+
export interface BackendRelationshipDefinition {
|
|
80
|
+
source: {
|
|
81
|
+
model: string;
|
|
82
|
+
field: string;
|
|
83
|
+
label: string;
|
|
84
|
+
};
|
|
85
|
+
target: {
|
|
86
|
+
model: string;
|
|
87
|
+
field: string;
|
|
88
|
+
label: string;
|
|
89
|
+
};
|
|
90
|
+
cardinality: string;
|
|
91
|
+
onDelete?: string;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Backend-compatible block definition.
|
|
95
|
+
*/
|
|
96
|
+
export interface BackendBlockDefinition {
|
|
97
|
+
type: string;
|
|
98
|
+
title?: string;
|
|
99
|
+
config?: unknown;
|
|
100
|
+
default?: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Backend-compatible page definition.
|
|
104
|
+
*/
|
|
105
|
+
export interface BackendPageDefinition {
|
|
106
|
+
path: string;
|
|
107
|
+
type: string;
|
|
108
|
+
title: string;
|
|
109
|
+
icon?: string;
|
|
110
|
+
modelHandle: string;
|
|
111
|
+
parentPath?: string;
|
|
112
|
+
baseQuery?: unknown;
|
|
113
|
+
blocks?: BackendBlockDefinition[];
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* Backend-compatible navigation item definition.
|
|
117
|
+
*/
|
|
118
|
+
export interface BackendNavigationItemDefinition {
|
|
119
|
+
label: string;
|
|
120
|
+
icon?: string;
|
|
121
|
+
path: string;
|
|
122
|
+
sortIndex?: number;
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Backend-compatible navigation definition.
|
|
126
|
+
*/
|
|
127
|
+
export interface BackendNavigationDefinition {
|
|
128
|
+
sidebar?: BackendNavigationItemDefinition[];
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Backend-compatible desired schema format.
|
|
132
|
+
*/
|
|
133
|
+
export interface BackendDesiredSchema {
|
|
134
|
+
models: BackendModelDefinition[];
|
|
135
|
+
relationships: BackendRelationshipDefinition[];
|
|
136
|
+
fieldDefinitions: Array<{
|
|
137
|
+
handle: string;
|
|
138
|
+
type: string;
|
|
139
|
+
options?: Array<{
|
|
140
|
+
value: string;
|
|
141
|
+
label: string;
|
|
142
|
+
color?: string | null;
|
|
143
|
+
}>;
|
|
144
|
+
}>;
|
|
145
|
+
pages?: BackendPageDefinition[];
|
|
146
|
+
navigation?: BackendNavigationDefinition;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Transform a CRM schema to the backend's DesiredSchema format.
|
|
150
|
+
*/
|
|
151
|
+
export declare function transformToBackendSchema(schema: CRMSchema): BackendDesiredSchema;
|
|
152
|
+
/**
|
|
153
|
+
* Transform a backend schema to CRM schema format.
|
|
154
|
+
* Used when pulling schema from a workplace.
|
|
155
|
+
*/
|
|
156
|
+
export declare function transformFromBackendSchema(backendSchema: BackendDesiredSchema, name: string, description?: string, version?: string): CRMSchema;
|
|
@@ -68,6 +68,32 @@ export interface FieldVisibility {
|
|
|
68
68
|
/** Show in filter panels */
|
|
69
69
|
filters?: boolean;
|
|
70
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Field mutability - controls which operations can modify this field.
|
|
73
|
+
* Used to generate different tool schemas for different agent types.
|
|
74
|
+
* - 'always': Field can be set on create and updated anytime (default)
|
|
75
|
+
* - 'restricted': Field can be set on create, but updates require a dedicated tool
|
|
76
|
+
* (generates individual update tools like update_email, update_phone)
|
|
77
|
+
* - 'create_only': Field can only be set on create, excluded from all update tools
|
|
78
|
+
* - 'immutable': Field cannot be set by agents (system-managed)
|
|
79
|
+
*/
|
|
80
|
+
export type FieldMutability = 'always' | 'restricted' | 'create_only' | 'immutable';
|
|
81
|
+
/**
|
|
82
|
+
* AI-specific metadata for fields.
|
|
83
|
+
* Controls how AI agents understand and interact with fields.
|
|
84
|
+
*/
|
|
85
|
+
export interface FieldAIMeta {
|
|
86
|
+
/** AI-specific description explaining how to populate this field */
|
|
87
|
+
description?: string;
|
|
88
|
+
/**
|
|
89
|
+
* Field mutability - controls which operations can modify this field.
|
|
90
|
+
* - 'always': Included in create and update tools (default)
|
|
91
|
+
* - 'restricted': Included in create, generates dedicated update tool
|
|
92
|
+
* - 'create_only': Included in create only, excluded from all update tools
|
|
93
|
+
* - 'immutable': Excluded from all agent tools (system-managed)
|
|
94
|
+
*/
|
|
95
|
+
mutability?: FieldMutability;
|
|
96
|
+
}
|
|
71
97
|
/**
|
|
72
98
|
* Field definition within a model.
|
|
73
99
|
*/
|
|
@@ -111,6 +137,8 @@ export interface FieldDefinition {
|
|
|
111
137
|
visibility?: FieldVisibility;
|
|
112
138
|
/** Who controls the field definition: 'app' or 'shared' */
|
|
113
139
|
owner?: FieldOwner;
|
|
140
|
+
/** AI-specific metadata for agent interactions */
|
|
141
|
+
aiMeta?: FieldAIMeta;
|
|
114
142
|
}
|
|
115
143
|
/**
|
|
116
144
|
* Model definition.
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { CRMContextSchema, SenderContextSchema, ThreadContextItemSchema, ThreadInfoSchema, AgentContextSchema, MockSenderContextSchema, MockThreadContextSchema, MockContextSchema, SandboxConfigSchema, type CRMContext, type SenderContext, type ThreadContextItem, type ThreadInfo, type AgentContext, type MockSenderContext, type MockThreadContext, type MockContext, type SandboxConfig, } from './types';
|
|
2
|
+
export { buildAgentContext, buildContextFromMock, formatContextForPrompt, getContextByHandle, getContextByModel, } from './resolver';
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import type { AgentContext, ThreadContextItem, MockContext } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* Build agent context from thread data
|
|
4
|
+
* This is a utility for building the context object that gets passed to agents
|
|
5
|
+
*/
|
|
6
|
+
export declare function buildAgentContext(params: {
|
|
7
|
+
thread: {
|
|
8
|
+
id: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
status?: string;
|
|
11
|
+
kind?: string;
|
|
12
|
+
};
|
|
13
|
+
sender: {
|
|
14
|
+
kind: 'CONTACT' | 'MEMBER' | 'AGENT' | 'WORKFLOW';
|
|
15
|
+
displayName?: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
role?: string;
|
|
18
|
+
permissions?: string[];
|
|
19
|
+
crm?: {
|
|
20
|
+
model: string;
|
|
21
|
+
instanceId: string;
|
|
22
|
+
data: Record<string, unknown>;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
contexts?: Array<{
|
|
26
|
+
handle: string;
|
|
27
|
+
model: string;
|
|
28
|
+
instanceId: string;
|
|
29
|
+
data?: Record<string, unknown>;
|
|
30
|
+
}>;
|
|
31
|
+
workplace?: {
|
|
32
|
+
id: string;
|
|
33
|
+
name?: string;
|
|
34
|
+
};
|
|
35
|
+
}): AgentContext;
|
|
36
|
+
/**
|
|
37
|
+
* Build agent context from mock context (for sandbox testing)
|
|
38
|
+
*/
|
|
39
|
+
export declare function buildContextFromMock(mockContext: MockContext, threadId: string, workplaceId?: string): AgentContext;
|
|
40
|
+
/**
|
|
41
|
+
* Format context for system prompt injection
|
|
42
|
+
*/
|
|
43
|
+
export declare function formatContextForPrompt(context: AgentContext): string;
|
|
44
|
+
/**
|
|
45
|
+
* Get CRM data from context by model handle
|
|
46
|
+
*/
|
|
47
|
+
export declare function getContextByHandle(context: AgentContext, handle: string): ThreadContextItem | undefined;
|
|
48
|
+
/**
|
|
49
|
+
* Get CRM data from context by model type
|
|
50
|
+
*/
|
|
51
|
+
export declare function getContextByModel(context: AgentContext, model: string): ThreadContextItem | undefined;
|
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
import { z } from 'zod/v4';
|
|
2
|
+
/**
|
|
3
|
+
* CRM context - data from a CRM instance
|
|
4
|
+
*/
|
|
5
|
+
export declare const CRMContextSchema: 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 CRMContext = z.infer<typeof CRMContextSchema>;
|
|
11
|
+
/**
|
|
12
|
+
* Sender context - who sent the message
|
|
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
|
+
email: z.ZodOptional<z.ZodString>;
|
|
23
|
+
role: z.ZodOptional<z.ZodString>;
|
|
24
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
25
|
+
crm: z.ZodOptional<z.ZodObject<{
|
|
26
|
+
model: z.ZodString;
|
|
27
|
+
instanceId: z.ZodString;
|
|
28
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
29
|
+
}, z.core.$strip>>;
|
|
30
|
+
}, z.core.$strip>;
|
|
31
|
+
export type SenderContext = z.infer<typeof SenderContextSchema>;
|
|
32
|
+
/**
|
|
33
|
+
* Thread context item - a linked CRM instance
|
|
34
|
+
*/
|
|
35
|
+
export declare const ThreadContextItemSchema: z.ZodObject<{
|
|
36
|
+
handle: z.ZodString;
|
|
37
|
+
model: z.ZodString;
|
|
38
|
+
instanceId: z.ZodString;
|
|
39
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
40
|
+
}, z.core.$strip>;
|
|
41
|
+
export type ThreadContextItem = z.infer<typeof ThreadContextItemSchema>;
|
|
42
|
+
/**
|
|
43
|
+
* Thread info in context
|
|
44
|
+
*/
|
|
45
|
+
export declare const ThreadInfoSchema: z.ZodObject<{
|
|
46
|
+
id: z.ZodString;
|
|
47
|
+
title: z.ZodOptional<z.ZodString>;
|
|
48
|
+
status: z.ZodOptional<z.ZodString>;
|
|
49
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
50
|
+
}, z.core.$strip>;
|
|
51
|
+
export type ThreadInfo = z.infer<typeof ThreadInfoSchema>;
|
|
52
|
+
/**
|
|
53
|
+
* Full agent context - what the agent sees
|
|
54
|
+
*/
|
|
55
|
+
export declare const AgentContextSchema: z.ZodObject<{
|
|
56
|
+
sender: z.ZodObject<{
|
|
57
|
+
kind: z.ZodEnum<{
|
|
58
|
+
CONTACT: "CONTACT";
|
|
59
|
+
MEMBER: "MEMBER";
|
|
60
|
+
AGENT: "AGENT";
|
|
61
|
+
WORKFLOW: "WORKFLOW";
|
|
62
|
+
}>;
|
|
63
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
64
|
+
email: z.ZodOptional<z.ZodString>;
|
|
65
|
+
role: z.ZodOptional<z.ZodString>;
|
|
66
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
67
|
+
crm: z.ZodOptional<z.ZodObject<{
|
|
68
|
+
model: z.ZodString;
|
|
69
|
+
instanceId: z.ZodString;
|
|
70
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
71
|
+
}, z.core.$strip>>;
|
|
72
|
+
}, z.core.$strip>;
|
|
73
|
+
contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
74
|
+
handle: z.ZodString;
|
|
75
|
+
model: z.ZodString;
|
|
76
|
+
instanceId: z.ZodString;
|
|
77
|
+
data: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
78
|
+
}, z.core.$strip>>>;
|
|
79
|
+
thread: z.ZodObject<{
|
|
80
|
+
id: z.ZodString;
|
|
81
|
+
title: z.ZodOptional<z.ZodString>;
|
|
82
|
+
status: z.ZodOptional<z.ZodString>;
|
|
83
|
+
kind: z.ZodOptional<z.ZodString>;
|
|
84
|
+
}, z.core.$strip>;
|
|
85
|
+
workplace: z.ZodOptional<z.ZodObject<{
|
|
86
|
+
id: z.ZodString;
|
|
87
|
+
name: z.ZodOptional<z.ZodString>;
|
|
88
|
+
}, z.core.$strip>>;
|
|
89
|
+
}, z.core.$strip>;
|
|
90
|
+
export type AgentContext = z.infer<typeof AgentContextSchema>;
|
|
91
|
+
/**
|
|
92
|
+
* Mock context for sandbox testing
|
|
93
|
+
*/
|
|
94
|
+
/**
|
|
95
|
+
* Mock subscription - channel identifier for the contact
|
|
96
|
+
*/
|
|
97
|
+
export declare const MockSubscriptionSchema: z.ZodObject<{
|
|
98
|
+
identifierValue: z.ZodString;
|
|
99
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
100
|
+
}, z.core.$strip>;
|
|
101
|
+
export type MockSubscription = z.infer<typeof MockSubscriptionSchema>;
|
|
102
|
+
/**
|
|
103
|
+
* Mock association - CRM instance linked to a contact
|
|
104
|
+
*/
|
|
105
|
+
export declare const MockAssociationSchema: z.ZodObject<{
|
|
106
|
+
id: z.ZodOptional<z.ZodString>;
|
|
107
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
export type MockAssociation = z.infer<typeof MockAssociationSchema>;
|
|
110
|
+
/**
|
|
111
|
+
* Mock contact - mirrors production contact structure
|
|
112
|
+
*/
|
|
113
|
+
export declare const MockContactSchema: z.ZodObject<{
|
|
114
|
+
id: z.ZodOptional<z.ZodString>;
|
|
115
|
+
name: z.ZodOptional<z.ZodString>;
|
|
116
|
+
subscription: z.ZodOptional<z.ZodObject<{
|
|
117
|
+
identifierValue: z.ZodString;
|
|
118
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
119
|
+
}, z.core.$strip>>;
|
|
120
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
121
|
+
id: z.ZodOptional<z.ZodString>;
|
|
122
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
123
|
+
}, z.core.$strip>>>;
|
|
124
|
+
}, z.core.$strip>;
|
|
125
|
+
export type MockContact = z.infer<typeof MockContactSchema>;
|
|
126
|
+
export declare const MockSenderContextSchema: z.ZodObject<{
|
|
127
|
+
kind: z.ZodEnum<{
|
|
128
|
+
contact: "contact";
|
|
129
|
+
member: "member";
|
|
130
|
+
}>;
|
|
131
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
132
|
+
role: z.ZodOptional<z.ZodString>;
|
|
133
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
134
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
135
|
+
id: z.ZodOptional<z.ZodString>;
|
|
136
|
+
name: z.ZodOptional<z.ZodString>;
|
|
137
|
+
subscription: z.ZodOptional<z.ZodObject<{
|
|
138
|
+
identifierValue: z.ZodString;
|
|
139
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>>;
|
|
141
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
142
|
+
id: z.ZodOptional<z.ZodString>;
|
|
143
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
144
|
+
}, z.core.$strip>>>;
|
|
145
|
+
}, z.core.$strip>>;
|
|
146
|
+
}, z.core.$strip>;
|
|
147
|
+
export type MockSenderContext = z.infer<typeof MockSenderContextSchema>;
|
|
148
|
+
export declare const MockThreadContextSchema: z.ZodObject<{
|
|
149
|
+
handle: z.ZodString;
|
|
150
|
+
model: z.ZodString;
|
|
151
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
152
|
+
}, z.core.$strip>;
|
|
153
|
+
export type MockThreadContext = z.infer<typeof MockThreadContextSchema>;
|
|
154
|
+
export declare const MockContextSchema: z.ZodObject<{
|
|
155
|
+
sender: z.ZodObject<{
|
|
156
|
+
kind: z.ZodEnum<{
|
|
157
|
+
contact: "contact";
|
|
158
|
+
member: "member";
|
|
159
|
+
}>;
|
|
160
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
161
|
+
role: z.ZodOptional<z.ZodString>;
|
|
162
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
163
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
164
|
+
id: z.ZodOptional<z.ZodString>;
|
|
165
|
+
name: z.ZodOptional<z.ZodString>;
|
|
166
|
+
subscription: z.ZodOptional<z.ZodObject<{
|
|
167
|
+
identifierValue: z.ZodString;
|
|
168
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
169
|
+
}, z.core.$strip>>;
|
|
170
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
171
|
+
id: z.ZodOptional<z.ZodString>;
|
|
172
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
173
|
+
}, z.core.$strip>>>;
|
|
174
|
+
}, z.core.$strip>>;
|
|
175
|
+
}, z.core.$strip>;
|
|
176
|
+
contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
|
+
handle: z.ZodString;
|
|
178
|
+
model: z.ZodString;
|
|
179
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
180
|
+
}, z.core.$strip>>>;
|
|
181
|
+
}, z.core.$strip>;
|
|
182
|
+
export type MockContext = z.infer<typeof MockContextSchema>;
|
|
183
|
+
/**
|
|
184
|
+
* Sandbox configuration in agent YAML
|
|
185
|
+
*/
|
|
186
|
+
export declare const SandboxConfigSchema: z.ZodObject<{
|
|
187
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
188
|
+
mockContext: z.ZodOptional<z.ZodObject<{
|
|
189
|
+
sender: z.ZodObject<{
|
|
190
|
+
kind: z.ZodEnum<{
|
|
191
|
+
contact: "contact";
|
|
192
|
+
member: "member";
|
|
193
|
+
}>;
|
|
194
|
+
displayName: z.ZodOptional<z.ZodString>;
|
|
195
|
+
role: z.ZodOptional<z.ZodString>;
|
|
196
|
+
permissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
197
|
+
contact: z.ZodOptional<z.ZodObject<{
|
|
198
|
+
id: z.ZodOptional<z.ZodString>;
|
|
199
|
+
name: z.ZodOptional<z.ZodString>;
|
|
200
|
+
subscription: z.ZodOptional<z.ZodObject<{
|
|
201
|
+
identifierValue: z.ZodString;
|
|
202
|
+
channelHandle: z.ZodOptional<z.ZodString>;
|
|
203
|
+
}, z.core.$strip>>;
|
|
204
|
+
associations: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodObject<{
|
|
205
|
+
id: z.ZodOptional<z.ZodString>;
|
|
206
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
207
|
+
}, z.core.$strip>>>;
|
|
208
|
+
}, z.core.$strip>>;
|
|
209
|
+
}, z.core.$strip>;
|
|
210
|
+
contexts: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
211
|
+
handle: z.ZodString;
|
|
212
|
+
model: z.ZodString;
|
|
213
|
+
data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
214
|
+
}, z.core.$strip>>>;
|
|
215
|
+
}, z.core.$strip>>;
|
|
216
|
+
}, z.core.$strip>;
|
|
217
|
+
export type SandboxConfig = z.infer<typeof SandboxConfigSchema>;
|