@kraken-ai/platform 0.0.4 → 0.0.7

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/server.d.cts CHANGED
@@ -1,32 +1,269 @@
1
- import { P as PlatformConnector, c as PlatformAgent, y as ConnectorSchema } from './types-_lfbhFJH.cjs';
2
- import { ToolDefinition } from 'kraken-ai';
3
- import 'zod';
4
-
5
- interface ConnectorServerOptions {
6
- readonly port?: number;
7
- readonly host?: string;
8
- readonly handlerTimeoutMs?: number;
1
+ /** MCP tool annotations per the MCP spec (v1.27.1) */
2
+ export interface ToolAnnotations {
3
+ readonly readOnlyHint?: boolean;
4
+ readonly destructiveHint?: boolean;
5
+ readonly idempotentHint?: boolean;
6
+ readonly openWorldHint?: boolean;
9
7
  }
10
- interface ConnectorServerHandle {
11
- readonly port: number;
12
- readonly close: () => Promise<void>;
8
+ /** Explicit MCP content pass-through (returned by mcpResult() helper) */
9
+ export interface McpContent {
10
+ readonly __mcpPassThrough: true;
11
+ readonly content: ReadonlyArray<{
12
+ readonly type: string;
13
+ [key: string]: unknown;
14
+ }>;
15
+ readonly isError?: boolean;
13
16
  }
14
- declare const startConnectorServer: (connector: PlatformConnector, options?: ConnectorServerOptions) => Promise<ConnectorServerHandle>;
15
-
16
- declare const runDev: (agent: PlatformAgent) => Promise<never>;
17
-
18
- type ToolOverride = (args: Record<string, unknown>) => Promise<unknown> | unknown;
19
- declare class MockToolSet {
20
- private readonly defs;
21
- private readonly overrides;
22
- private readonly toolNames;
23
- constructor(tools: ToolDefinition[], overrides?: Record<string, ToolOverride>);
24
- static fromConnectors(connectors: ConnectorSchema[], opts?: {
25
- include?: string[];
26
- overrides?: Record<string, ToolOverride>;
27
- }): MockToolSet;
28
- definitions(): ToolDefinition[];
29
- call(name: string, params: Record<string, unknown>): Promise<unknown>;
17
+ /**
18
+ * Union of valid handler return types.
19
+ * Prevents returning unsupported types at compile time.
20
+ */
21
+ export type ConnectorHandlerResult = string | number | boolean | Record<string, unknown> | ReadonlyArray<unknown> | McpContent | null | undefined;
22
+ /** Minimal context passed to resource/prompt handlers — business logic only */
23
+ export interface ConnectorHandlerContext {
24
+ readonly signal: AbortSignal;
25
+ }
26
+ /** MCP-native resource content (text or binary) */
27
+ export type ResourceContent = {
28
+ readonly uri: string;
29
+ readonly mimeType?: string;
30
+ readonly text: string;
31
+ } | {
32
+ readonly uri: string;
33
+ readonly mimeType?: string;
34
+ readonly blob: string;
35
+ };
36
+ /** MCP-native ReadResourceResult — returned by resource read handlers */
37
+ export interface ReadResourceResult {
38
+ readonly contents: ReadonlyArray<ResourceContent>;
39
+ }
40
+ /** MCP-native prompt message content */
41
+ export type PromptMessageContent = {
42
+ readonly type: "text";
43
+ readonly text: string;
44
+ } | {
45
+ readonly type: "image";
46
+ readonly data: string;
47
+ readonly mimeType: string;
48
+ };
49
+ /** MCP-native GetPromptResult — returned by prompt get handlers */
50
+ export interface GetPromptResult {
51
+ readonly description?: string;
52
+ readonly messages: ReadonlyArray<{
53
+ readonly role: "user" | "assistant";
54
+ readonly content: PromptMessageContent;
55
+ }>;
56
+ }
57
+ /** A tool definition within a connector */
58
+ export interface ConnectorToolDef<TInput extends z.ZodType = z.ZodType> {
59
+ readonly description: string;
60
+ readonly input: TInput;
61
+ readonly annotations?: ToolAnnotations;
62
+ handler(args: z.infer<TInput>): Promise<ConnectorHandlerResult> | ConnectorHandlerResult;
63
+ }
64
+ /** A resource definition within a connector */
65
+ export interface ConnectorResourceDef {
66
+ readonly description: string;
67
+ readonly uri: string;
68
+ readonly mimeType?: string;
69
+ read(ctx: ConnectorHandlerContext): Promise<ReadResourceResult> | ReadResourceResult;
70
+ }
71
+ /** A prompt definition within a connector */
72
+ export interface ConnectorPromptDef {
73
+ readonly description: string;
74
+ readonly arguments?: ReadonlyArray<{
75
+ readonly name: string;
76
+ readonly description?: string;
77
+ readonly required?: boolean;
78
+ }>;
79
+ get(args: Record<string, string>, ctx: ConnectorHandlerContext): Promise<GetPromptResult> | GetPromptResult;
80
+ }
81
+ /** Output of defineConnector() — frozen, carries handlers for server builder */
82
+ export interface PlatformConnector {
83
+ readonly __type: "PlatformConnector";
84
+ readonly name: string;
85
+ readonly description?: string;
86
+ readonly instructions?: string;
87
+ readonly tools?: Readonly<Record<string, ConnectorToolDef>>;
88
+ readonly resources?: Readonly<Record<string, ConnectorResourceDef>>;
89
+ readonly prompts?: Readonly<Record<string, ConnectorPromptDef>>;
90
+ }
91
+ /** JSON Schema representation of a tool's parameters, sent to the LLM. */
92
+ export interface ToolDefinition {
93
+ name: string;
94
+ description: string;
95
+ parameters: Record<string, unknown>;
96
+ }
97
+ /** Google model ID. */
98
+ export type GoogleModelId = "gemini-3.1-pro-preview" | "gemini-3-flash-preview";
99
+ /** OpenAI model ID. */
100
+ export type OpenAIModelId = "gpt-5.4" | "gpt-4o" | "gpt-4o-mini";
101
+ /** A provider-qualified model string (e.g. `"google/gemini-3.1-pro-preview"`). */
102
+ export type ModelString = `google/${GoogleModelId}` | `openai/${OpenAIModelId}`;
103
+ declare const agentDefinitionSchema: z.ZodObject<{
104
+ name: z.ZodString;
105
+ model: z.ZodString;
106
+ instructions: z.ZodString;
107
+ description: z.ZodOptional<z.ZodString>;
108
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ temperature: z.ZodOptional<z.ZodNumber>;
110
+ allowTemperatureOverride: z.ZodOptional<z.ZodBoolean>;
111
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
112
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
113
+ low: "low";
114
+ medium: "medium";
115
+ high: "high";
116
+ }>>;
117
+ logLevel: z.ZodOptional<z.ZodEnum<{
118
+ error: "error";
119
+ silent: "silent";
120
+ debug: "debug";
121
+ info: "info";
122
+ warn: "warn";
123
+ }>>;
124
+ }, z.core.$strict>;
125
+ export type AgentDefinition = Omit<z.infer<typeof agentDefinitionSchema>, "model"> & {
126
+ model: ModelString;
127
+ };
128
+ declare const platformAgentConfigSchema: z.ZodObject<{
129
+ agent: z.ZodObject<{
130
+ name: z.ZodString;
131
+ model: z.ZodString;
132
+ instructions: z.ZodString;
133
+ description: z.ZodOptional<z.ZodString>;
134
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ temperature: z.ZodOptional<z.ZodNumber>;
136
+ allowTemperatureOverride: z.ZodOptional<z.ZodBoolean>;
137
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
138
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
139
+ low: "low";
140
+ medium: "medium";
141
+ high: "high";
142
+ }>>;
143
+ logLevel: z.ZodOptional<z.ZodEnum<{
144
+ error: "error";
145
+ silent: "silent";
146
+ debug: "debug";
147
+ info: "info";
148
+ warn: "warn";
149
+ }>>;
150
+ }, z.core.$strict>;
151
+ connectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
152
+ triggers: z.ZodArray<z.ZodDiscriminatedUnion<[
153
+ z.ZodObject<{
154
+ type: z.ZodLiteral<"cron">;
155
+ expression: z.ZodString;
156
+ timezone: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>,
158
+ z.ZodObject<{
159
+ type: z.ZodLiteral<"webhook">;
160
+ path: z.ZodString;
161
+ method: z.ZodOptional<z.ZodEnum<{
162
+ POST: "POST";
163
+ GET: "GET";
164
+ }>>;
165
+ }, z.core.$strip>,
166
+ z.ZodObject<{
167
+ type: z.ZodLiteral<"event">;
168
+ source: z.ZodString;
169
+ event: z.ZodString;
170
+ }, z.core.$strip>,
171
+ z.ZodObject<{
172
+ type: z.ZodLiteral<"api">;
173
+ }, z.core.$strip>,
174
+ z.ZodObject<{
175
+ type: z.ZodLiteral<"manual">;
176
+ }, z.core.$strip>
177
+ ], "type">>;
178
+ identity: z.ZodOptional<z.ZodObject<{
179
+ basePermissions: z.ZodArray<z.ZodString>;
180
+ requestablePermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ jitPolicy: z.ZodOptional<z.ZodEnum<{
182
+ "auto-approve": "auto-approve";
183
+ "policy-based": "policy-based";
184
+ "require-approval": "require-approval";
185
+ }>>;
186
+ maxJitDurationMinutes: z.ZodOptional<z.ZodNumber>;
187
+ }, z.core.$strip>>;
188
+ resources: z.ZodOptional<z.ZodObject<{
189
+ maxTokens: z.ZodOptional<z.ZodNumber>;
190
+ maxCostUsd: z.ZodOptional<z.ZodNumber>;
191
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
192
+ }, z.core.$strip>>;
193
+ retries: z.ZodOptional<z.ZodObject<{
194
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
195
+ backoffSeconds: z.ZodOptional<z.ZodNumber>;
196
+ }, z.core.$strip>>;
197
+ concurrency: z.ZodOptional<z.ZodObject<{
198
+ maxParallelRuns: z.ZodOptional<z.ZodNumber>;
199
+ }, z.core.$strip>>;
200
+ fast: z.ZodOptional<z.ZodBoolean>;
201
+ team: z.ZodOptional<z.ZodObject<{
202
+ members: z.ZodArray<z.ZodString>;
203
+ maxConcurrentWorkers: z.ZodOptional<z.ZodNumber>;
204
+ maxTokenBudgetPerWorker: z.ZodOptional<z.ZodNumber>;
205
+ maxDurationPerWorker: z.ZodOptional<z.ZodNumber>;
206
+ }, z.core.$strip>>;
207
+ notifications: z.ZodOptional<z.ZodObject<{
208
+ slack: z.ZodOptional<z.ZodString>;
209
+ onSuccess: z.ZodOptional<z.ZodBoolean>;
210
+ onFailure: z.ZodOptional<z.ZodBoolean>;
211
+ onTimeout: z.ZodOptional<z.ZodBoolean>;
212
+ }, z.core.$strip>>;
213
+ environment: z.ZodOptional<z.ZodEnum<{
214
+ dev: "dev";
215
+ staging: "staging";
216
+ prod: "prod";
217
+ }>>;
218
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
+ }, z.core.$strict>;
220
+ export type PlatformAgentConfig = Omit<z.infer<typeof platformAgentConfigSchema>, "agent"> & {
221
+ agent: AgentDefinition;
222
+ };
223
+ export interface PlatformAgent {
224
+ readonly __type: "PlatformAgent";
225
+ readonly config: PlatformAgentConfig;
226
+ readonly runtime?: unknown;
227
+ /** In-memory schemas for action variants. Not serialized — runtime use only. */
228
+ readonly actionZodSchemas?: Record<string, import("zod").ZodObject<import("zod").ZodRawShape>>;
229
+ /** Action handler functions. Not serialized — runtime use only. */
230
+ readonly actionHandlers?: Readonly<Record<string, (payload: unknown) => Promise<void>>>;
231
+ /** Action webhook URLs. Not serialized — runtime use only. */
232
+ readonly actionWebhooks?: Readonly<Record<string, string | undefined>>;
233
+ /** Team member PlatformAgent objects. Not serialized — runtime use only (dev mode delegation). */
234
+ readonly teamAgents?: readonly PlatformAgent[];
235
+ }
236
+ export interface ConnectorServerOptions {
237
+ readonly port?: number;
238
+ readonly host?: string;
239
+ readonly handlerTimeoutMs?: number;
240
+ }
241
+ export interface ConnectorServerHandle {
242
+ readonly port: number;
243
+ readonly close: () => Promise<void>;
244
+ }
245
+ export declare const startConnectorServer: (connector: PlatformConnector, options?: ConnectorServerOptions) => Promise<ConnectorServerHandle>;
246
+ export interface ConnectorSchema {
247
+ id: string;
248
+ tools: Array<{
249
+ name: string;
250
+ description: string;
251
+ parameters: Record<string, unknown>;
252
+ }>;
253
+ }
254
+ export declare const runDev: (agent: PlatformAgent) => Promise<never>;
255
+ export type ToolOverride = (args: Record<string, unknown>) => Promise<unknown> | unknown;
256
+ export declare class MockToolSet {
257
+ private readonly defs;
258
+ private readonly overrides;
259
+ private readonly toolNames;
260
+ constructor(tools: ToolDefinition[], overrides?: Record<string, ToolOverride>);
261
+ static fromConnectors(connectors: ConnectorSchema[], opts?: {
262
+ include?: string[];
263
+ overrides?: Record<string, ToolOverride>;
264
+ }): MockToolSet;
265
+ definitions(): ToolDefinition[];
266
+ call(name: string, params: Record<string, unknown>): Promise<unknown>;
30
267
  }
31
268
 
32
- export { type ConnectorServerHandle, type ConnectorServerOptions, MockToolSet, runDev, startConnectorServer };
269
+ export {};
package/dist/server.d.ts CHANGED
@@ -1,32 +1,269 @@
1
- import { P as PlatformConnector, c as PlatformAgent, y as ConnectorSchema } from './types-_lfbhFJH.js';
2
- import { ToolDefinition } from 'kraken-ai';
3
- import 'zod';
4
-
5
- interface ConnectorServerOptions {
6
- readonly port?: number;
7
- readonly host?: string;
8
- readonly handlerTimeoutMs?: number;
1
+ /** MCP tool annotations per the MCP spec (v1.27.1) */
2
+ export interface ToolAnnotations {
3
+ readonly readOnlyHint?: boolean;
4
+ readonly destructiveHint?: boolean;
5
+ readonly idempotentHint?: boolean;
6
+ readonly openWorldHint?: boolean;
9
7
  }
10
- interface ConnectorServerHandle {
11
- readonly port: number;
12
- readonly close: () => Promise<void>;
8
+ /** Explicit MCP content pass-through (returned by mcpResult() helper) */
9
+ export interface McpContent {
10
+ readonly __mcpPassThrough: true;
11
+ readonly content: ReadonlyArray<{
12
+ readonly type: string;
13
+ [key: string]: unknown;
14
+ }>;
15
+ readonly isError?: boolean;
13
16
  }
14
- declare const startConnectorServer: (connector: PlatformConnector, options?: ConnectorServerOptions) => Promise<ConnectorServerHandle>;
15
-
16
- declare const runDev: (agent: PlatformAgent) => Promise<never>;
17
-
18
- type ToolOverride = (args: Record<string, unknown>) => Promise<unknown> | unknown;
19
- declare class MockToolSet {
20
- private readonly defs;
21
- private readonly overrides;
22
- private readonly toolNames;
23
- constructor(tools: ToolDefinition[], overrides?: Record<string, ToolOverride>);
24
- static fromConnectors(connectors: ConnectorSchema[], opts?: {
25
- include?: string[];
26
- overrides?: Record<string, ToolOverride>;
27
- }): MockToolSet;
28
- definitions(): ToolDefinition[];
29
- call(name: string, params: Record<string, unknown>): Promise<unknown>;
17
+ /**
18
+ * Union of valid handler return types.
19
+ * Prevents returning unsupported types at compile time.
20
+ */
21
+ export type ConnectorHandlerResult = string | number | boolean | Record<string, unknown> | ReadonlyArray<unknown> | McpContent | null | undefined;
22
+ /** Minimal context passed to resource/prompt handlers — business logic only */
23
+ export interface ConnectorHandlerContext {
24
+ readonly signal: AbortSignal;
25
+ }
26
+ /** MCP-native resource content (text or binary) */
27
+ export type ResourceContent = {
28
+ readonly uri: string;
29
+ readonly mimeType?: string;
30
+ readonly text: string;
31
+ } | {
32
+ readonly uri: string;
33
+ readonly mimeType?: string;
34
+ readonly blob: string;
35
+ };
36
+ /** MCP-native ReadResourceResult — returned by resource read handlers */
37
+ export interface ReadResourceResult {
38
+ readonly contents: ReadonlyArray<ResourceContent>;
39
+ }
40
+ /** MCP-native prompt message content */
41
+ export type PromptMessageContent = {
42
+ readonly type: "text";
43
+ readonly text: string;
44
+ } | {
45
+ readonly type: "image";
46
+ readonly data: string;
47
+ readonly mimeType: string;
48
+ };
49
+ /** MCP-native GetPromptResult — returned by prompt get handlers */
50
+ export interface GetPromptResult {
51
+ readonly description?: string;
52
+ readonly messages: ReadonlyArray<{
53
+ readonly role: "user" | "assistant";
54
+ readonly content: PromptMessageContent;
55
+ }>;
56
+ }
57
+ /** A tool definition within a connector */
58
+ export interface ConnectorToolDef<TInput extends z.ZodType = z.ZodType> {
59
+ readonly description: string;
60
+ readonly input: TInput;
61
+ readonly annotations?: ToolAnnotations;
62
+ handler(args: z.infer<TInput>): Promise<ConnectorHandlerResult> | ConnectorHandlerResult;
63
+ }
64
+ /** A resource definition within a connector */
65
+ export interface ConnectorResourceDef {
66
+ readonly description: string;
67
+ readonly uri: string;
68
+ readonly mimeType?: string;
69
+ read(ctx: ConnectorHandlerContext): Promise<ReadResourceResult> | ReadResourceResult;
70
+ }
71
+ /** A prompt definition within a connector */
72
+ export interface ConnectorPromptDef {
73
+ readonly description: string;
74
+ readonly arguments?: ReadonlyArray<{
75
+ readonly name: string;
76
+ readonly description?: string;
77
+ readonly required?: boolean;
78
+ }>;
79
+ get(args: Record<string, string>, ctx: ConnectorHandlerContext): Promise<GetPromptResult> | GetPromptResult;
80
+ }
81
+ /** Output of defineConnector() — frozen, carries handlers for server builder */
82
+ export interface PlatformConnector {
83
+ readonly __type: "PlatformConnector";
84
+ readonly name: string;
85
+ readonly description?: string;
86
+ readonly instructions?: string;
87
+ readonly tools?: Readonly<Record<string, ConnectorToolDef>>;
88
+ readonly resources?: Readonly<Record<string, ConnectorResourceDef>>;
89
+ readonly prompts?: Readonly<Record<string, ConnectorPromptDef>>;
90
+ }
91
+ /** JSON Schema representation of a tool's parameters, sent to the LLM. */
92
+ export interface ToolDefinition {
93
+ name: string;
94
+ description: string;
95
+ parameters: Record<string, unknown>;
96
+ }
97
+ /** Google model ID. */
98
+ export type GoogleModelId = "gemini-3.1-pro-preview" | "gemini-3-flash-preview";
99
+ /** OpenAI model ID. */
100
+ export type OpenAIModelId = "gpt-5.4" | "gpt-4o" | "gpt-4o-mini";
101
+ /** A provider-qualified model string (e.g. `"google/gemini-3.1-pro-preview"`). */
102
+ export type ModelString = `google/${GoogleModelId}` | `openai/${OpenAIModelId}`;
103
+ declare const agentDefinitionSchema: z.ZodObject<{
104
+ name: z.ZodString;
105
+ model: z.ZodString;
106
+ instructions: z.ZodString;
107
+ description: z.ZodOptional<z.ZodString>;
108
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
109
+ temperature: z.ZodOptional<z.ZodNumber>;
110
+ allowTemperatureOverride: z.ZodOptional<z.ZodBoolean>;
111
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
112
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
113
+ low: "low";
114
+ medium: "medium";
115
+ high: "high";
116
+ }>>;
117
+ logLevel: z.ZodOptional<z.ZodEnum<{
118
+ error: "error";
119
+ silent: "silent";
120
+ debug: "debug";
121
+ info: "info";
122
+ warn: "warn";
123
+ }>>;
124
+ }, z.core.$strict>;
125
+ export type AgentDefinition = Omit<z.infer<typeof agentDefinitionSchema>, "model"> & {
126
+ model: ModelString;
127
+ };
128
+ declare const platformAgentConfigSchema: z.ZodObject<{
129
+ agent: z.ZodObject<{
130
+ name: z.ZodString;
131
+ model: z.ZodString;
132
+ instructions: z.ZodString;
133
+ description: z.ZodOptional<z.ZodString>;
134
+ skills: z.ZodOptional<z.ZodArray<z.ZodString>>;
135
+ temperature: z.ZodOptional<z.ZodNumber>;
136
+ allowTemperatureOverride: z.ZodOptional<z.ZodBoolean>;
137
+ maxOutputTokens: z.ZodOptional<z.ZodNumber>;
138
+ thinkingLevel: z.ZodOptional<z.ZodEnum<{
139
+ low: "low";
140
+ medium: "medium";
141
+ high: "high";
142
+ }>>;
143
+ logLevel: z.ZodOptional<z.ZodEnum<{
144
+ error: "error";
145
+ silent: "silent";
146
+ debug: "debug";
147
+ info: "info";
148
+ warn: "warn";
149
+ }>>;
150
+ }, z.core.$strict>;
151
+ connectors: z.ZodOptional<z.ZodArray<z.ZodString>>;
152
+ triggers: z.ZodArray<z.ZodDiscriminatedUnion<[
153
+ z.ZodObject<{
154
+ type: z.ZodLiteral<"cron">;
155
+ expression: z.ZodString;
156
+ timezone: z.ZodOptional<z.ZodString>;
157
+ }, z.core.$strip>,
158
+ z.ZodObject<{
159
+ type: z.ZodLiteral<"webhook">;
160
+ path: z.ZodString;
161
+ method: z.ZodOptional<z.ZodEnum<{
162
+ POST: "POST";
163
+ GET: "GET";
164
+ }>>;
165
+ }, z.core.$strip>,
166
+ z.ZodObject<{
167
+ type: z.ZodLiteral<"event">;
168
+ source: z.ZodString;
169
+ event: z.ZodString;
170
+ }, z.core.$strip>,
171
+ z.ZodObject<{
172
+ type: z.ZodLiteral<"api">;
173
+ }, z.core.$strip>,
174
+ z.ZodObject<{
175
+ type: z.ZodLiteral<"manual">;
176
+ }, z.core.$strip>
177
+ ], "type">>;
178
+ identity: z.ZodOptional<z.ZodObject<{
179
+ basePermissions: z.ZodArray<z.ZodString>;
180
+ requestablePermissions: z.ZodOptional<z.ZodArray<z.ZodString>>;
181
+ jitPolicy: z.ZodOptional<z.ZodEnum<{
182
+ "auto-approve": "auto-approve";
183
+ "policy-based": "policy-based";
184
+ "require-approval": "require-approval";
185
+ }>>;
186
+ maxJitDurationMinutes: z.ZodOptional<z.ZodNumber>;
187
+ }, z.core.$strip>>;
188
+ resources: z.ZodOptional<z.ZodObject<{
189
+ maxTokens: z.ZodOptional<z.ZodNumber>;
190
+ maxCostUsd: z.ZodOptional<z.ZodNumber>;
191
+ timeoutSeconds: z.ZodOptional<z.ZodNumber>;
192
+ }, z.core.$strip>>;
193
+ retries: z.ZodOptional<z.ZodObject<{
194
+ maxAttempts: z.ZodOptional<z.ZodNumber>;
195
+ backoffSeconds: z.ZodOptional<z.ZodNumber>;
196
+ }, z.core.$strip>>;
197
+ concurrency: z.ZodOptional<z.ZodObject<{
198
+ maxParallelRuns: z.ZodOptional<z.ZodNumber>;
199
+ }, z.core.$strip>>;
200
+ fast: z.ZodOptional<z.ZodBoolean>;
201
+ team: z.ZodOptional<z.ZodObject<{
202
+ members: z.ZodArray<z.ZodString>;
203
+ maxConcurrentWorkers: z.ZodOptional<z.ZodNumber>;
204
+ maxTokenBudgetPerWorker: z.ZodOptional<z.ZodNumber>;
205
+ maxDurationPerWorker: z.ZodOptional<z.ZodNumber>;
206
+ }, z.core.$strip>>;
207
+ notifications: z.ZodOptional<z.ZodObject<{
208
+ slack: z.ZodOptional<z.ZodString>;
209
+ onSuccess: z.ZodOptional<z.ZodBoolean>;
210
+ onFailure: z.ZodOptional<z.ZodBoolean>;
211
+ onTimeout: z.ZodOptional<z.ZodBoolean>;
212
+ }, z.core.$strip>>;
213
+ environment: z.ZodOptional<z.ZodEnum<{
214
+ dev: "dev";
215
+ staging: "staging";
216
+ prod: "prod";
217
+ }>>;
218
+ actions: z.ZodOptional<z.ZodArray<z.ZodString>>;
219
+ }, z.core.$strict>;
220
+ export type PlatformAgentConfig = Omit<z.infer<typeof platformAgentConfigSchema>, "agent"> & {
221
+ agent: AgentDefinition;
222
+ };
223
+ export interface PlatformAgent {
224
+ readonly __type: "PlatformAgent";
225
+ readonly config: PlatformAgentConfig;
226
+ readonly runtime?: unknown;
227
+ /** In-memory schemas for action variants. Not serialized — runtime use only. */
228
+ readonly actionZodSchemas?: Record<string, import("zod").ZodObject<import("zod").ZodRawShape>>;
229
+ /** Action handler functions. Not serialized — runtime use only. */
230
+ readonly actionHandlers?: Readonly<Record<string, (payload: unknown) => Promise<void>>>;
231
+ /** Action webhook URLs. Not serialized — runtime use only. */
232
+ readonly actionWebhooks?: Readonly<Record<string, string | undefined>>;
233
+ /** Team member PlatformAgent objects. Not serialized — runtime use only (dev mode delegation). */
234
+ readonly teamAgents?: readonly PlatformAgent[];
235
+ }
236
+ export interface ConnectorServerOptions {
237
+ readonly port?: number;
238
+ readonly host?: string;
239
+ readonly handlerTimeoutMs?: number;
240
+ }
241
+ export interface ConnectorServerHandle {
242
+ readonly port: number;
243
+ readonly close: () => Promise<void>;
244
+ }
245
+ export declare const startConnectorServer: (connector: PlatformConnector, options?: ConnectorServerOptions) => Promise<ConnectorServerHandle>;
246
+ export interface ConnectorSchema {
247
+ id: string;
248
+ tools: Array<{
249
+ name: string;
250
+ description: string;
251
+ parameters: Record<string, unknown>;
252
+ }>;
253
+ }
254
+ export declare const runDev: (agent: PlatformAgent) => Promise<never>;
255
+ export type ToolOverride = (args: Record<string, unknown>) => Promise<unknown> | unknown;
256
+ export declare class MockToolSet {
257
+ private readonly defs;
258
+ private readonly overrides;
259
+ private readonly toolNames;
260
+ constructor(tools: ToolDefinition[], overrides?: Record<string, ToolOverride>);
261
+ static fromConnectors(connectors: ConnectorSchema[], opts?: {
262
+ include?: string[];
263
+ overrides?: Record<string, ToolOverride>;
264
+ }): MockToolSet;
265
+ definitions(): ToolDefinition[];
266
+ call(name: string, params: Record<string, unknown>): Promise<unknown>;
30
267
  }
31
268
 
32
- export { type ConnectorServerHandle, type ConnectorServerOptions, MockToolSet, runDev, startConnectorServer };
269
+ export {};
package/dist/server.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
- ENTITY_NAME_REGEX,
2
+ PRIMITIVE_NAME_REGEX,
3
3
  buildActionOutputSchema,
4
4
  cyan,
5
5
  dim,
6
6
  green,
7
- isValidEntityName,
7
+ isValidPrimitiveName,
8
8
  startConnectorServer,
9
9
  wrapToolError,
10
10
  wrapToolResult,
11
11
  yellow
12
- } from "./chunk-PPT6GGYL.js";
12
+ } from "./chunk-FTLOWV2N.js";
13
13
 
14
14
  // src/dev.ts
15
15
  import { readFileSync } from "fs";
@@ -67,7 +67,7 @@ import { resolve } from "path";
67
67
  import { tool } from "kraken-ai";
68
68
  var isPlatformConnector = (v) => v != null && typeof v === "object" && v.__type === "PlatformConnector";
69
69
  var importConnector = async (name, projectRoot) => {
70
- const basePath = resolve(projectRoot, "connectors", name, "index");
70
+ const basePath = resolve(projectRoot, "src", "connectors", name, "index");
71
71
  for (const ext of [".ts", ".js"]) {
72
72
  try {
73
73
  const mod = await import(`${basePath}${ext}`);
@@ -192,9 +192,9 @@ var loadConnectorTools = async (connectorNames, projectRoot) => {
192
192
  const root = projectRoot ?? process.cwd();
193
193
  const connectors = [];
194
194
  for (const name of connectorNames) {
195
- if (!isValidEntityName(name)) {
195
+ if (!isValidPrimitiveName(name)) {
196
196
  console.warn(
197
- `[connector] Invalid connector name "${name}" \u2014 must match ${ENTITY_NAME_REGEX}. Skipping.`
197
+ `[connector] Invalid connector name "${name}" \u2014 must match ${PRIMITIVE_NAME_REGEX}. Skipping.`
198
198
  );
199
199
  continue;
200
200
  }
@@ -227,7 +227,7 @@ var loadDotenv = () => {
227
227
  var FRONTMATTER_RE = /^---\n[\s\S]*?\n---\n([\s\S]*)$/;
228
228
  var resolveSkillContent = (refs) => refs.map((ref) => {
229
229
  try {
230
- return readFileSync(`skills/${ref}`, "utf-8");
230
+ return readFileSync(`src/skills/${ref}`, "utf-8");
231
231
  } catch {
232
232
  return ref;
233
233
  }
@@ -270,12 +270,13 @@ ${connectorInstructions.join("\n\n")}`;
270
270
 
271
271
  ${actionInstructions}`;
272
272
  }
273
- outputSchema = buildActionOutputSchema({
274
- __type: "PlatformActions",
275
- config: pa.config.actions ?? { variants: {} },
276
- zodSchemas: pa.actionZodSchemas,
277
- handlers: pa.actionHandlers ?? {}
278
- });
273
+ const actions = Object.entries(pa.actionZodSchemas).map(([name2, zodSchema]) => ({
274
+ __type: "PlatformAction",
275
+ name: name2,
276
+ config: { schema: {}, hasHandler: false },
277
+ zodSchema
278
+ }));
279
+ outputSchema = buildActionOutputSchema(actions);
279
280
  }
280
281
  let team;
281
282
  if (pa.teamAgents && pa.teamAgents.length > 0) {
@@ -355,18 +356,12 @@ var runDev = async (agent) => {
355
356
  if (result.status === "complete") {
356
357
  const output = typeof result.output === "string" ? result.output : JSON.stringify(result.output, null, 2);
357
358
  if (hasActions && agent.actionZodSchemas && result.output != null && typeof result.output === "object" && "action" in result.output) {
358
- const webhooks = {};
359
- if (agent.config.actions?.variants) {
360
- for (const [k, v] of Object.entries(agent.config.actions.variants)) {
361
- webhooks[k] = v.webhook;
362
- }
363
- }
364
359
  try {
365
360
  const dispatched = await dispatchDevAction(
366
361
  result.output,
367
362
  agent.actionZodSchemas,
368
363
  agent.actionHandlers,
369
- webhooks
364
+ agent.actionWebhooks ?? {}
370
365
  );
371
366
  console.log(`
372
367
  ${cyan("Action:")} ${green(dispatched.actionName)}`);