@inkeep/agents-sdk 0.0.0-dev-20260120175022 → 0.0.0-dev-20260120193424
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/agent.d.ts +11 -0
- package/dist/agent.js +39 -1
- package/dist/builderFunctions.d.ts +52 -2
- package/dist/builderFunctions.js +51 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/trigger.d.ts +46 -0
- package/dist/trigger.js +65 -0
- package/dist/types.d.ts +3 -1
- package/package.json +2 -2
package/dist/agent.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Trigger, TriggerInterface } from "./trigger.js";
|
|
1
2
|
import { AgentConfig, AgentInterface, AllDelegateInputInterface, GenerateOptions, MessageInput, ModelSettings, RunResult, StreamResponse, SubAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
2
3
|
import { AgentStopWhen, FullAgentDefinition, StatusUpdateSettings } from "@inkeep/agents-core";
|
|
3
4
|
|
|
@@ -19,6 +20,8 @@ declare class Agent implements AgentInterface {
|
|
|
19
20
|
private statusUpdateSettings?;
|
|
20
21
|
private prompt?;
|
|
21
22
|
private stopWhen?;
|
|
23
|
+
private triggers;
|
|
24
|
+
private triggerMap;
|
|
22
25
|
constructor(config: AgentConfig);
|
|
23
26
|
/**
|
|
24
27
|
* Set or update the configuration (tenantId, projectId and apiUrl)
|
|
@@ -82,6 +85,14 @@ declare class Agent implements AgentInterface {
|
|
|
82
85
|
*/
|
|
83
86
|
getDefaultSubAgent(): SubAgentInterface | undefined;
|
|
84
87
|
/**
|
|
88
|
+
* Get all triggers for this agent
|
|
89
|
+
*/
|
|
90
|
+
getTriggers(): Record<string, Trigger>;
|
|
91
|
+
/**
|
|
92
|
+
* Add one or more triggers to the agent at runtime
|
|
93
|
+
*/
|
|
94
|
+
addTrigger(...triggers: TriggerInterface[]): void;
|
|
95
|
+
/**
|
|
85
96
|
* Get the agent ID
|
|
86
97
|
*/
|
|
87
98
|
getId(): string;
|
package/dist/agent.js
CHANGED
|
@@ -27,6 +27,8 @@ var Agent = class {
|
|
|
27
27
|
statusUpdateSettings;
|
|
28
28
|
prompt;
|
|
29
29
|
stopWhen;
|
|
30
|
+
triggers = [];
|
|
31
|
+
triggerMap = /* @__PURE__ */ new Map();
|
|
30
32
|
constructor(config) {
|
|
31
33
|
this.defaultSubAgent = config.defaultSubAgent;
|
|
32
34
|
this.tenantId = "default";
|
|
@@ -43,6 +45,8 @@ var Agent = class {
|
|
|
43
45
|
this.stopWhen = config.stopWhen ? { transferCountIs: config.stopWhen.transferCountIs } : void 0;
|
|
44
46
|
this.subAgents = resolveGetter(config.subAgents) || [];
|
|
45
47
|
this.agentMap = new Map(this.subAgents.map((agent$1) => [agent$1.getId(), agent$1]));
|
|
48
|
+
this.triggers = resolveGetter(config.triggers) || [];
|
|
49
|
+
this.triggerMap = new Map(this.triggers.map((trigger) => [trigger.getId(), trigger]));
|
|
46
50
|
if (this.defaultSubAgent) {
|
|
47
51
|
if (!this.subAgents.some((agent$1) => agent$1.getId() === this.defaultSubAgent?.getId())) this.subAgents.push(this.defaultSubAgent);
|
|
48
52
|
this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
|
|
@@ -52,7 +56,8 @@ var Agent = class {
|
|
|
52
56
|
agentId: this.agentId,
|
|
53
57
|
tenantId: this.tenantId,
|
|
54
58
|
agentCount: this.subAgents.length,
|
|
55
|
-
defaultSubAgent: this.defaultSubAgent?.getName()
|
|
59
|
+
defaultSubAgent: this.defaultSubAgent?.getName(),
|
|
60
|
+
triggerCount: this.triggers.length
|
|
56
61
|
}, "Agent created");
|
|
57
62
|
}
|
|
58
63
|
/**
|
|
@@ -221,6 +226,16 @@ var Agent = class {
|
|
|
221
226
|
}
|
|
222
227
|
}
|
|
223
228
|
}
|
|
229
|
+
const triggersObject = {};
|
|
230
|
+
for (const [triggerId, trigger] of this.triggerMap.entries()) {
|
|
231
|
+
const config = trigger.getConfig();
|
|
232
|
+
let processedInputSchema = config.inputSchema;
|
|
233
|
+
if (config.inputSchema && isZodSchema(config.inputSchema)) processedInputSchema = convertZodToJsonSchema(config.inputSchema);
|
|
234
|
+
triggersObject[triggerId] = {
|
|
235
|
+
...config,
|
|
236
|
+
inputSchema: processedInputSchema
|
|
237
|
+
};
|
|
238
|
+
}
|
|
224
239
|
return {
|
|
225
240
|
id: this.agentId,
|
|
226
241
|
name: this.agentName,
|
|
@@ -231,6 +246,7 @@ var Agent = class {
|
|
|
231
246
|
contextConfig: this.contextConfig?.toObject(),
|
|
232
247
|
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
233
248
|
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
249
|
+
...Object.keys(triggersObject).length > 0 && { triggers: triggersObject },
|
|
234
250
|
models: this.models,
|
|
235
251
|
stopWhen: this.stopWhen,
|
|
236
252
|
statusUpdates: processedStatusUpdates,
|
|
@@ -437,6 +453,28 @@ var Agent = class {
|
|
|
437
453
|
return this.defaultSubAgent;
|
|
438
454
|
}
|
|
439
455
|
/**
|
|
456
|
+
* Get all triggers for this agent
|
|
457
|
+
*/
|
|
458
|
+
getTriggers() {
|
|
459
|
+
const triggersObject = {};
|
|
460
|
+
for (const [id, trigger] of this.triggerMap.entries()) triggersObject[id] = trigger;
|
|
461
|
+
return triggersObject;
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* Add one or more triggers to the agent at runtime
|
|
465
|
+
*/
|
|
466
|
+
addTrigger(...triggers) {
|
|
467
|
+
for (const trigger of triggers) {
|
|
468
|
+
this.triggers.push(trigger);
|
|
469
|
+
this.triggerMap.set(trigger.getId(), trigger);
|
|
470
|
+
logger.info({
|
|
471
|
+
agentId: this.agentId,
|
|
472
|
+
triggerId: trigger.getId(),
|
|
473
|
+
triggerName: trigger.getName()
|
|
474
|
+
}, "Trigger added to agent");
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
/**
|
|
440
478
|
* Get the agent ID
|
|
441
479
|
*/
|
|
442
480
|
getId() {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Trigger } from "./trigger.js";
|
|
1
2
|
import { ArtifactComponent } from "./artifact-component.js";
|
|
2
3
|
import { Tool } from "./tool.js";
|
|
3
4
|
import { SubAgent } from "./subAgent.js";
|
|
@@ -8,7 +9,7 @@ import { AgentConfig, FunctionToolConfig, SubAgentConfig } from "./types.js";
|
|
|
8
9
|
import { Agent } from "./agent.js";
|
|
9
10
|
import { Project, ProjectConfig } from "./project.js";
|
|
10
11
|
import { StatusComponent as StatusComponent$1 } from "./status-component.js";
|
|
11
|
-
import { CredentialReferenceApiInsert, MCPToolConfig } from "@inkeep/agents-core";
|
|
12
|
+
import { CredentialReferenceApiInsert, MCPToolConfig, TriggerApiInsert } from "@inkeep/agents-core";
|
|
12
13
|
|
|
13
14
|
//#region src/builderFunctions.d.ts
|
|
14
15
|
|
|
@@ -268,5 +269,54 @@ declare function agentMcp(config: AgentMcpConfig): AgentMcpConfig;
|
|
|
268
269
|
* ```
|
|
269
270
|
*/
|
|
270
271
|
declare function functionTool(config: FunctionToolConfig): FunctionTool;
|
|
272
|
+
/**
|
|
273
|
+
* Creates a webhook trigger for external service integration.
|
|
274
|
+
*
|
|
275
|
+
* Triggers allow external services to invoke agents via webhooks.
|
|
276
|
+
* They support authentication, payload transformation, and input validation.
|
|
277
|
+
*
|
|
278
|
+
* @param config - Trigger configuration
|
|
279
|
+
* @returns A Trigger instance
|
|
280
|
+
*
|
|
281
|
+
* @example
|
|
282
|
+
* ```typescript
|
|
283
|
+
* import { z } from 'zod';
|
|
284
|
+
*
|
|
285
|
+
* // GitHub webhook trigger
|
|
286
|
+
* const githubTrigger = trigger({
|
|
287
|
+
* name: 'GitHub Events',
|
|
288
|
+
* description: 'Handle GitHub webhook events',
|
|
289
|
+
* enabled: true,
|
|
290
|
+
* inputSchema: z.object({
|
|
291
|
+
* action: z.string(),
|
|
292
|
+
* repository: z.object({
|
|
293
|
+
* name: z.string(),
|
|
294
|
+
* url: z.string()
|
|
295
|
+
* })
|
|
296
|
+
* }),
|
|
297
|
+
* outputTransform: {
|
|
298
|
+
* jmespath: '{action: action, repo: repository.name, url: repository.url}'
|
|
299
|
+
* },
|
|
300
|
+
* messageTemplate: 'GitHub {{action}} on repository {{repo}}: {{url}}',
|
|
301
|
+
* authentication: {
|
|
302
|
+
* type: 'api_key',
|
|
303
|
+
* data: { name: 'X-GitHub-Token', value: process.env.GITHUB_TOKEN },
|
|
304
|
+
* add_position: 'header'
|
|
305
|
+
* },
|
|
306
|
+
* signingSecret: process.env.GITHUB_WEBHOOK_SECRET
|
|
307
|
+
* });
|
|
308
|
+
*
|
|
309
|
+
* // Simple webhook trigger with no auth
|
|
310
|
+
* const simpleTrigger = trigger({
|
|
311
|
+
* name: 'Slack Message',
|
|
312
|
+
* description: 'Handle Slack messages',
|
|
313
|
+
* messageTemplate: 'New message: {{text}}',
|
|
314
|
+
* authentication: { type: 'none' }
|
|
315
|
+
* });
|
|
316
|
+
* ```
|
|
317
|
+
*/
|
|
318
|
+
declare function trigger(config: Omit<TriggerApiInsert, "id"> & {
|
|
319
|
+
id?: string;
|
|
320
|
+
}): Trigger;
|
|
271
321
|
//#endregion
|
|
272
|
-
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent };
|
|
322
|
+
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };
|
package/dist/builderFunctions.js
CHANGED
|
@@ -7,6 +7,7 @@ import { Project } from "./project.js";
|
|
|
7
7
|
import { StatusComponent as StatusComponent$1 } from "./status-component.js";
|
|
8
8
|
import { Tool } from "./tool.js";
|
|
9
9
|
import { SubAgent } from "./subAgent.js";
|
|
10
|
+
import { Trigger } from "./trigger.js";
|
|
10
11
|
import { CredentialReferenceApiInsertSchema, MCPToolConfigSchema } from "@inkeep/agents-core";
|
|
11
12
|
|
|
12
13
|
//#region src/builderFunctions.ts
|
|
@@ -322,6 +323,55 @@ function agentMcp(config) {
|
|
|
322
323
|
function functionTool(config) {
|
|
323
324
|
return new FunctionTool(config);
|
|
324
325
|
}
|
|
326
|
+
/**
|
|
327
|
+
* Creates a webhook trigger for external service integration.
|
|
328
|
+
*
|
|
329
|
+
* Triggers allow external services to invoke agents via webhooks.
|
|
330
|
+
* They support authentication, payload transformation, and input validation.
|
|
331
|
+
*
|
|
332
|
+
* @param config - Trigger configuration
|
|
333
|
+
* @returns A Trigger instance
|
|
334
|
+
*
|
|
335
|
+
* @example
|
|
336
|
+
* ```typescript
|
|
337
|
+
* import { z } from 'zod';
|
|
338
|
+
*
|
|
339
|
+
* // GitHub webhook trigger
|
|
340
|
+
* const githubTrigger = trigger({
|
|
341
|
+
* name: 'GitHub Events',
|
|
342
|
+
* description: 'Handle GitHub webhook events',
|
|
343
|
+
* enabled: true,
|
|
344
|
+
* inputSchema: z.object({
|
|
345
|
+
* action: z.string(),
|
|
346
|
+
* repository: z.object({
|
|
347
|
+
* name: z.string(),
|
|
348
|
+
* url: z.string()
|
|
349
|
+
* })
|
|
350
|
+
* }),
|
|
351
|
+
* outputTransform: {
|
|
352
|
+
* jmespath: '{action: action, repo: repository.name, url: repository.url}'
|
|
353
|
+
* },
|
|
354
|
+
* messageTemplate: 'GitHub {{action}} on repository {{repo}}: {{url}}',
|
|
355
|
+
* authentication: {
|
|
356
|
+
* type: 'api_key',
|
|
357
|
+
* data: { name: 'X-GitHub-Token', value: process.env.GITHUB_TOKEN },
|
|
358
|
+
* add_position: 'header'
|
|
359
|
+
* },
|
|
360
|
+
* signingSecret: process.env.GITHUB_WEBHOOK_SECRET
|
|
361
|
+
* });
|
|
362
|
+
*
|
|
363
|
+
* // Simple webhook trigger with no auth
|
|
364
|
+
* const simpleTrigger = trigger({
|
|
365
|
+
* name: 'Slack Message',
|
|
366
|
+
* description: 'Handle Slack messages',
|
|
367
|
+
* messageTemplate: 'New message: {{text}}',
|
|
368
|
+
* authentication: { type: 'none' }
|
|
369
|
+
* });
|
|
370
|
+
* ```
|
|
371
|
+
*/
|
|
372
|
+
function trigger(config) {
|
|
373
|
+
return new Trigger(config);
|
|
374
|
+
}
|
|
325
375
|
|
|
326
376
|
//#endregion
|
|
327
|
-
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent };
|
|
377
|
+
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Trigger, TriggerConfig, TriggerInterface } from "./trigger.js";
|
|
1
2
|
import { ArtifactComponent, ArtifactComponentInterface } from "./artifact-component.js";
|
|
2
3
|
import { Tool } from "./tool.js";
|
|
3
4
|
import { SubAgent } from "./subAgent.js";
|
|
@@ -8,7 +9,7 @@ import { FunctionTool } from "./function-tool.js";
|
|
|
8
9
|
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, DataComponentWithZodProps, ExternalAgentInterface, FetchDefinitionConfig, FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
9
10
|
import { Project } from "./project.js";
|
|
10
11
|
import { StatusComponent, StatusComponentInterface } from "./status-component.js";
|
|
11
|
-
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent } from "./builderFunctions.js";
|
|
12
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
12
13
|
import { CredentialProviderConfig, CredentialProviderType, CredentialStore, CustomCredentialConfig, InkeepCredentialProvider, KeychainCredentialConfig, MemoryCredentialConfig, NangoCredentialConfig, createCredentialProvider } from "./credential-provider.js";
|
|
13
14
|
import { CredentialReference, ExtractCredentialIds, UnionCredentialIds, credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
14
15
|
import { createEnvironmentSettings, registerEnvironmentSettings } from "./environment-settings.js";
|
|
@@ -17,4 +18,4 @@ import { createFullProjectViaAPI, deleteFullProjectViaAPI, getFullProjectViaAPI,
|
|
|
17
18
|
import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
18
19
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OpenTelemetryConfig, SpanOptions, SpanStatus, SpanStatusType, TelemetryConfig, TelemetryLogger, TelemetryMetrics, TelemetryProvider, TelemetrySpan, TelemetryTracer, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
19
20
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from "@inkeep/agents-core";
|
|
20
|
-
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, DataComponentWithZodProps, EvaluationClient, type EvaluationClientConfig, ExternalAgent, ExternalAgentInterface, type ExtractCredentialIds, FetchDefinitionConfig, FunctionTool, FunctionToolConfig, GOOGLE_MODELS, GenerateOptions, InkeepCredentialProvider, InkeepTelemetryProvider, type KeychainCredentialConfig, MCPToolConfig, MaxTurnsExceededError, type MemoryCredentialConfig, Message, MessageInput, ModelSettings, type NangoCredentialConfig, NoOpTelemetryProvider, OPENAI_MODELS, type OpenTelemetryConfig, Project, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SpanOptions, SpanStatus, type SpanStatusType, StatusComponent, type StatusComponentInterface, StreamEvent, StreamResponse, SubAgent, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, type TelemetryConfig, type TelemetryLogger, type TelemetryMetrics, type TelemetryProvider, type TelemetrySpan, type TelemetryTracer, Tool, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, type UnionCredentialIds, UserMessage, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, updateFullProjectViaAPI };
|
|
21
|
+
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, DataComponentWithZodProps, EvaluationClient, type EvaluationClientConfig, ExternalAgent, ExternalAgentInterface, type ExtractCredentialIds, FetchDefinitionConfig, FunctionTool, FunctionToolConfig, GOOGLE_MODELS, GenerateOptions, InkeepCredentialProvider, InkeepTelemetryProvider, type KeychainCredentialConfig, MCPToolConfig, MaxTurnsExceededError, type MemoryCredentialConfig, Message, MessageInput, ModelSettings, type NangoCredentialConfig, NoOpTelemetryProvider, OPENAI_MODELS, type OpenTelemetryConfig, Project, RequestSchemaConfig, RequestSchemaDefinition, RunResult, Runner, ServerConfig, type SpanOptions, SpanStatus, type SpanStatusType, StatusComponent, type StatusComponentInterface, StreamEvent, StreamResponse, SubAgent, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, type TelemetryConfig, type TelemetryLogger, type TelemetryMetrics, type TelemetryProvider, type TelemetrySpan, type TelemetryTracer, Tool, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, Trigger, type TriggerConfig, type TriggerInterface, type UnionCredentialIds, UserMessage, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, trigger, updateFullProjectViaAPI };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,8 @@ import { Project } from "./project.js";
|
|
|
6
6
|
import { StatusComponent } from "./status-component.js";
|
|
7
7
|
import { Tool } from "./tool.js";
|
|
8
8
|
import { SubAgent } from "./subAgent.js";
|
|
9
|
-
import {
|
|
9
|
+
import { Trigger } from "./trigger.js";
|
|
10
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
10
11
|
import { transfer } from "./builders.js";
|
|
11
12
|
import { InkeepCredentialProvider, createCredentialProvider } from "./credential-provider.js";
|
|
12
13
|
import { credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
@@ -17,4 +18,4 @@ import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
|
17
18
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, SpanStatus, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
18
19
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from "@inkeep/agents-core";
|
|
19
20
|
|
|
20
|
-
export { ANTHROPIC_MODELS, ArtifactComponent, ConsoleTelemetryProvider, DataComponent, EvaluationClient, ExternalAgent, FunctionTool, GOOGLE_MODELS, InkeepCredentialProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OPENAI_MODELS, Project, Runner, SpanStatus, StatusComponent, SubAgent, Tool, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, transfer, updateFullProjectViaAPI };
|
|
21
|
+
export { ANTHROPIC_MODELS, ArtifactComponent, ConsoleTelemetryProvider, DataComponent, EvaluationClient, ExternalAgent, FunctionTool, GOOGLE_MODELS, InkeepCredentialProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OPENAI_MODELS, Project, Runner, SpanStatus, StatusComponent, SubAgent, Tool, Trigger, agent, agentMcp, artifactComponent, createConsoleTelemetryProvider, createCredentialProvider, createEnvironmentSettings, createFullProjectViaAPI, createNoOpTelemetryProvider, createOpenTelemetryProvider, credential, credentialRef, dataComponent, deleteFullProjectViaAPI, evaluationClient, externalAgent, externalAgents, functionTool, getFullProjectViaAPI, getGlobalTelemetryProvider, isCredentialReference, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, setGlobalTelemetryProvider, statusComponent, stream, subAgent, transfer, trigger, updateFullProjectViaAPI };
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { TriggerApiInsert } from "@inkeep/agents-core";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
|
|
4
|
+
//#region src/trigger.d.ts
|
|
5
|
+
type TriggerConfig = Omit<TriggerApiInsert, "id" | "inputSchema"> & {
|
|
6
|
+
id?: string;
|
|
7
|
+
inputSchema?: Record<string, unknown> | z.ZodObject<any> | null;
|
|
8
|
+
};
|
|
9
|
+
type TriggerConfigWithZod = TriggerConfig;
|
|
10
|
+
interface TriggerInterface {
|
|
11
|
+
getId(): string;
|
|
12
|
+
getName(): string;
|
|
13
|
+
getConfig(): Omit<TriggerApiInsert, "id"> & {
|
|
14
|
+
id: string;
|
|
15
|
+
};
|
|
16
|
+
with(config: Partial<TriggerConfigWithZod>): Trigger;
|
|
17
|
+
}
|
|
18
|
+
declare class Trigger implements TriggerInterface {
|
|
19
|
+
private config;
|
|
20
|
+
private id;
|
|
21
|
+
constructor(config: TriggerConfigWithZod);
|
|
22
|
+
getId(): string;
|
|
23
|
+
getName(): string;
|
|
24
|
+
getConfig(): Omit<TriggerApiInsert, "id"> & {
|
|
25
|
+
id: string;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Creates a new Trigger with the given configuration overrides.
|
|
29
|
+
*
|
|
30
|
+
* @param config - Partial configuration to override
|
|
31
|
+
* @returns A new Trigger instance with the merged configuration
|
|
32
|
+
*
|
|
33
|
+
* example:
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const trigger = new Trigger({
|
|
36
|
+
* name: 'GitHub Webhook',
|
|
37
|
+
* messageTemplate: 'New event: {{action}}',
|
|
38
|
+
* authentication: { type: 'none' },
|
|
39
|
+
* });
|
|
40
|
+
* const customizedTrigger = trigger.with({ enabled: false });
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
with(config: Partial<TriggerConfigWithZod>): Trigger;
|
|
44
|
+
}
|
|
45
|
+
//#endregion
|
|
46
|
+
export { Trigger, TriggerConfig, TriggerInterface };
|
package/dist/trigger.js
ADDED
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { generateIdFromName } from "./utils/generateIdFromName.js";
|
|
2
|
+
import { getLogger } from "@inkeep/agents-core";
|
|
3
|
+
import { convertZodToJsonSchema, isZodSchema } from "@inkeep/agents-core/utils/schema-conversion";
|
|
4
|
+
|
|
5
|
+
//#region src/trigger.ts
|
|
6
|
+
const logger = getLogger("trigger");
|
|
7
|
+
var Trigger = class Trigger {
|
|
8
|
+
config;
|
|
9
|
+
id;
|
|
10
|
+
constructor(config) {
|
|
11
|
+
this.id = config.id || generateIdFromName(config.name);
|
|
12
|
+
let processedInputSchema;
|
|
13
|
+
if (config.inputSchema === null) processedInputSchema = void 0;
|
|
14
|
+
else if (config.inputSchema && isZodSchema(config.inputSchema)) processedInputSchema = convertZodToJsonSchema(config.inputSchema);
|
|
15
|
+
else processedInputSchema = config.inputSchema;
|
|
16
|
+
this.config = {
|
|
17
|
+
...config,
|
|
18
|
+
id: this.id,
|
|
19
|
+
inputSchema: processedInputSchema
|
|
20
|
+
};
|
|
21
|
+
logger.info({
|
|
22
|
+
triggerId: this.getId(),
|
|
23
|
+
triggerName: config.name
|
|
24
|
+
}, "Trigger constructor initialized");
|
|
25
|
+
}
|
|
26
|
+
getId() {
|
|
27
|
+
return this.id;
|
|
28
|
+
}
|
|
29
|
+
getName() {
|
|
30
|
+
return this.config.name;
|
|
31
|
+
}
|
|
32
|
+
getConfig() {
|
|
33
|
+
return this.config;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Creates a new Trigger with the given configuration overrides.
|
|
37
|
+
*
|
|
38
|
+
* @param config - Partial configuration to override
|
|
39
|
+
* @returns A new Trigger instance with the merged configuration
|
|
40
|
+
*
|
|
41
|
+
* example:
|
|
42
|
+
* ```typescript
|
|
43
|
+
* const trigger = new Trigger({
|
|
44
|
+
* name: 'GitHub Webhook',
|
|
45
|
+
* messageTemplate: 'New event: {{action}}',
|
|
46
|
+
* authentication: { type: 'none' },
|
|
47
|
+
* });
|
|
48
|
+
* const customizedTrigger = trigger.with({ enabled: false });
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
51
|
+
with(config) {
|
|
52
|
+
let processedInputSchema;
|
|
53
|
+
if (config.inputSchema !== void 0) if (config.inputSchema === null) processedInputSchema = void 0;
|
|
54
|
+
else if (isZodSchema(config.inputSchema)) processedInputSchema = convertZodToJsonSchema(config.inputSchema);
|
|
55
|
+
else processedInputSchema = config.inputSchema;
|
|
56
|
+
return new Trigger({
|
|
57
|
+
...this.config,
|
|
58
|
+
...config,
|
|
59
|
+
...processedInputSchema !== void 0 && { inputSchema: processedInputSchema }
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { Trigger };
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { TriggerInterface } from "./trigger.js";
|
|
1
2
|
import { ArtifactComponentInterface } from "./artifact-component.js";
|
|
2
3
|
import { Tool } from "./tool.js";
|
|
3
4
|
import { AgentMcpConfig } from "./builders.js";
|
|
@@ -199,6 +200,7 @@ interface AgentConfig {
|
|
|
199
200
|
summarizer?: ModelSettings;
|
|
200
201
|
};
|
|
201
202
|
statusUpdates?: StatusUpdateSettings;
|
|
203
|
+
triggers?: () => TriggerInterface[];
|
|
202
204
|
}
|
|
203
205
|
declare class AgentError extends Error {
|
|
204
206
|
code?: string | undefined;
|
|
@@ -300,4 +302,4 @@ interface BuilderAgentConfig {
|
|
|
300
302
|
relations?: BuilderRelationConfig[];
|
|
301
303
|
}
|
|
302
304
|
//#endregion
|
|
303
|
-
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, DataComponentWithZodProps, ExternalAgentInterface, FetchDefinitionConfig, type FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, type ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface };
|
|
305
|
+
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponentWithZodProps, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, DataComponentWithZodProps, ExternalAgentInterface, FetchDefinitionConfig, type FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, type ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, type TriggerInterface, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260120193424",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"js-yaml": "^4.1.0",
|
|
17
17
|
"typescript": "^5.3.3",
|
|
18
18
|
"zod": "^4.1.11",
|
|
19
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
19
|
+
"@inkeep/agents-core": "^0.0.0-dev-20260120193424"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/js-yaml": "^4.0.9",
|