@inkeep/agents-sdk 0.47.5 → 0.48.1
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 +37 -1
- package/dist/artifact-component.d.ts +1 -1
- package/dist/artifact-component.js +1 -3
- package/dist/builderFunctions.d.ts +45 -2
- package/dist/builderFunctions.js +44 -1
- package/dist/builders.d.ts +3 -3
- package/dist/data-component.d.ts +1 -1
- package/dist/data-component.js +1 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +4 -2
- package/dist/project.d.ts +3 -1
- package/dist/project.js +17 -0
- package/dist/scheduled-trigger.d.ts +43 -0
- package/dist/scheduled-trigger.js +56 -0
- package/dist/skill-loader.d.ts +6 -0
- package/dist/skill-loader.js +28 -0
- package/dist/subAgent.d.ts +8 -2
- package/dist/subAgent.js +32 -0
- package/dist/types.d.ts +35 -16
- package/package.json +4 -3
package/dist/agent.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScheduledTrigger, ScheduledTriggerInterface } from "./scheduled-trigger.js";
|
|
1
2
|
import { Trigger, TriggerInterface } from "./trigger.js";
|
|
2
3
|
import { AgentConfig, AgentInterface, AllDelegateInputInterface, GenerateOptions, MessageInput, ModelSettings, RunResult, StreamResponse, SubAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
3
4
|
import { AgentStopWhen, FullAgentDefinition, StatusUpdateSettings } from "@inkeep/agents-core";
|
|
@@ -22,6 +23,8 @@ declare class Agent implements AgentInterface {
|
|
|
22
23
|
private stopWhen?;
|
|
23
24
|
private triggers;
|
|
24
25
|
private triggerMap;
|
|
26
|
+
private scheduledTriggers;
|
|
27
|
+
private scheduledTriggerMap;
|
|
25
28
|
constructor(config: AgentConfig);
|
|
26
29
|
/**
|
|
27
30
|
* Set or update the configuration (tenantId, projectId and apiUrl)
|
|
@@ -93,6 +96,14 @@ declare class Agent implements AgentInterface {
|
|
|
93
96
|
*/
|
|
94
97
|
addTrigger(...triggers: TriggerInterface[]): void;
|
|
95
98
|
/**
|
|
99
|
+
* Get all scheduled triggers for this agent
|
|
100
|
+
*/
|
|
101
|
+
getScheduledTriggers(): Record<string, ScheduledTrigger>;
|
|
102
|
+
/**
|
|
103
|
+
* Add one or more scheduled triggers to the agent at runtime
|
|
104
|
+
*/
|
|
105
|
+
addScheduledTrigger(...triggers: ScheduledTriggerInterface[]): void;
|
|
106
|
+
/**
|
|
96
107
|
* Get the agent ID
|
|
97
108
|
*/
|
|
98
109
|
getId(): string;
|
package/dist/agent.js
CHANGED
|
@@ -28,6 +28,8 @@ var Agent = class {
|
|
|
28
28
|
stopWhen;
|
|
29
29
|
triggers = [];
|
|
30
30
|
triggerMap = /* @__PURE__ */ new Map();
|
|
31
|
+
scheduledTriggers = [];
|
|
32
|
+
scheduledTriggerMap = /* @__PURE__ */ new Map();
|
|
31
33
|
constructor(config) {
|
|
32
34
|
this.defaultSubAgent = config.defaultSubAgent;
|
|
33
35
|
this.tenantId = "default";
|
|
@@ -46,6 +48,8 @@ var Agent = class {
|
|
|
46
48
|
this.agentMap = new Map(this.subAgents.map((agent$1) => [agent$1.getId(), agent$1]));
|
|
47
49
|
this.triggers = resolveGetter(config.triggers) || [];
|
|
48
50
|
this.triggerMap = new Map(this.triggers.map((trigger) => [trigger.getId(), trigger]));
|
|
51
|
+
this.scheduledTriggers = resolveGetter(config.scheduledTriggers) || [];
|
|
52
|
+
this.scheduledTriggerMap = new Map(this.scheduledTriggers.map((trigger) => [trigger.getId(), trigger]));
|
|
49
53
|
if (this.defaultSubAgent) {
|
|
50
54
|
if (!this.subAgents.some((agent$1) => agent$1.getId() === this.defaultSubAgent?.getId())) this.subAgents.push(this.defaultSubAgent);
|
|
51
55
|
this.agentMap.set(this.defaultSubAgent.getId(), this.defaultSubAgent);
|
|
@@ -56,7 +60,8 @@ var Agent = class {
|
|
|
56
60
|
tenantId: this.tenantId,
|
|
57
61
|
agentCount: this.subAgents.length,
|
|
58
62
|
defaultSubAgent: this.defaultSubAgent?.getName(),
|
|
59
|
-
triggerCount: this.triggers.length
|
|
63
|
+
triggerCount: this.triggers.length,
|
|
64
|
+
scheduledTriggerCount: this.scheduledTriggers.length
|
|
60
65
|
}, "Agent initialized");
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
@@ -149,6 +154,11 @@ var Agent = class {
|
|
|
149
154
|
headers: headersMapping[toolId] || null,
|
|
150
155
|
toolPolicies: toolPoliciesMapping[toolId] || null
|
|
151
156
|
}));
|
|
157
|
+
const resolvedSkills = subAgent.getSkills().map((skillRef, idx) => ({
|
|
158
|
+
id: skillRef.id,
|
|
159
|
+
index: skillRef.index ?? idx,
|
|
160
|
+
...skillRef.alwaysLoaded !== void 0 && { alwaysLoaded: skillRef.alwaysLoaded }
|
|
161
|
+
}));
|
|
152
162
|
subAgentsObject[subAgent.getId()] = {
|
|
153
163
|
id: subAgent.getId(),
|
|
154
164
|
name: subAgent.getName(),
|
|
@@ -171,6 +181,7 @@ var Agent = class {
|
|
|
171
181
|
canUse,
|
|
172
182
|
dataComponents: dataComponents.length > 0 ? dataComponents : void 0,
|
|
173
183
|
artifactComponents: artifactComponents.length > 0 ? artifactComponents : void 0,
|
|
184
|
+
skills: resolvedSkills.length > 0 ? resolvedSkills : void 0,
|
|
174
185
|
type: "internal"
|
|
175
186
|
};
|
|
176
187
|
}
|
|
@@ -235,6 +246,8 @@ var Agent = class {
|
|
|
235
246
|
inputSchema: processedInputSchema
|
|
236
247
|
};
|
|
237
248
|
}
|
|
249
|
+
const scheduledTriggersObject = {};
|
|
250
|
+
for (const [triggerId, trigger] of this.scheduledTriggerMap.entries()) scheduledTriggersObject[triggerId] = trigger.getConfig();
|
|
238
251
|
return {
|
|
239
252
|
id: this.agentId,
|
|
240
253
|
name: this.agentName,
|
|
@@ -246,6 +259,7 @@ var Agent = class {
|
|
|
246
259
|
...Object.keys(functionToolsObject).length > 0 && { functionTools: functionToolsObject },
|
|
247
260
|
...Object.keys(functionsObject).length > 0 && { functions: functionsObject },
|
|
248
261
|
triggers: triggersObject,
|
|
262
|
+
scheduledTriggers: scheduledTriggersObject,
|
|
249
263
|
models: this.models,
|
|
250
264
|
stopWhen: this.stopWhen,
|
|
251
265
|
statusUpdates: processedStatusUpdates,
|
|
@@ -474,6 +488,28 @@ var Agent = class {
|
|
|
474
488
|
}
|
|
475
489
|
}
|
|
476
490
|
/**
|
|
491
|
+
* Get all scheduled triggers for this agent
|
|
492
|
+
*/
|
|
493
|
+
getScheduledTriggers() {
|
|
494
|
+
const scheduledTriggersObject = {};
|
|
495
|
+
for (const [id, trigger] of this.scheduledTriggerMap.entries()) scheduledTriggersObject[id] = trigger;
|
|
496
|
+
return scheduledTriggersObject;
|
|
497
|
+
}
|
|
498
|
+
/**
|
|
499
|
+
* Add one or more scheduled triggers to the agent at runtime
|
|
500
|
+
*/
|
|
501
|
+
addScheduledTrigger(...triggers) {
|
|
502
|
+
for (const trigger of triggers) {
|
|
503
|
+
this.scheduledTriggers.push(trigger);
|
|
504
|
+
this.scheduledTriggerMap.set(trigger.getId(), trigger);
|
|
505
|
+
logger.info({
|
|
506
|
+
agentId: this.agentId,
|
|
507
|
+
scheduledTriggerId: trigger.getId(),
|
|
508
|
+
scheduledTriggerName: trigger.getName()
|
|
509
|
+
}, "Scheduled trigger added to agent");
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
477
513
|
* Get the agent ID
|
|
478
514
|
*/
|
|
479
515
|
getId() {
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
|
|
4
4
|
//#region src/artifact-component.d.ts
|
|
5
5
|
type ArtifactComponentConfigWithZod = Omit<ArtifactComponentInsert, "tenantId" | "projectId" | "props"> & {
|
|
6
|
-
props
|
|
6
|
+
props: ArtifactComponentInsert["props"] | z.ZodObject<any>;
|
|
7
7
|
};
|
|
8
8
|
interface ArtifactComponentInterface {
|
|
9
9
|
config: Omit<ArtifactComponentInsert, "tenantId" | "projectId">;
|
|
@@ -12,9 +12,7 @@ var ArtifactComponent = class {
|
|
|
12
12
|
id;
|
|
13
13
|
constructor(config) {
|
|
14
14
|
this.id = config.id || generateIdFromName(config.name);
|
|
15
|
-
|
|
16
|
-
if (config.props && isZodSchema(config.props)) processedProps = convertZodToJsonSchemaWithPreview(config.props);
|
|
17
|
-
else processedProps = config.props;
|
|
15
|
+
const processedProps = isZodSchema(config.props) ? convertZodToJsonSchemaWithPreview(config.props) : config.props;
|
|
18
16
|
this.config = {
|
|
19
17
|
...config,
|
|
20
18
|
id: this.id,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScheduledTrigger } from "./scheduled-trigger.js";
|
|
1
2
|
import { Trigger } from "./trigger.js";
|
|
2
3
|
import { ArtifactComponent } from "./artifact-component.js";
|
|
3
4
|
import { Tool } from "./tool.js";
|
|
@@ -9,7 +10,7 @@ import { AgentConfig, FunctionToolConfig, SubAgentConfig } from "./types.js";
|
|
|
9
10
|
import { Agent } from "./agent.js";
|
|
10
11
|
import { Project, ProjectConfig } from "./project.js";
|
|
11
12
|
import { StatusComponent as StatusComponent$1 } from "./status-component.js";
|
|
12
|
-
import { CredentialReferenceApiInsert, MCPToolConfig, TriggerApiInsert } from "@inkeep/agents-core";
|
|
13
|
+
import { CredentialReferenceApiInsert, MCPToolConfig, ScheduledTriggerInsert, TriggerApiInsert } from "@inkeep/agents-core";
|
|
13
14
|
|
|
14
15
|
//#region src/builderFunctions.d.ts
|
|
15
16
|
|
|
@@ -368,5 +369,47 @@ declare function functionTool(config: FunctionToolConfig): FunctionTool;
|
|
|
368
369
|
declare function trigger(config: Omit<TriggerApiInsert, "id"> & {
|
|
369
370
|
id?: string;
|
|
370
371
|
}): Trigger;
|
|
372
|
+
/**
|
|
373
|
+
* Creates a scheduled trigger for time-based agent execution.
|
|
374
|
+
*
|
|
375
|
+
* Scheduled triggers allow agents to be invoked on a schedule using cron expressions
|
|
376
|
+
* or at a specific one-time date/time.
|
|
377
|
+
*
|
|
378
|
+
* @param config - Scheduled trigger configuration
|
|
379
|
+
* @returns A ScheduledTrigger instance
|
|
380
|
+
*
|
|
381
|
+
* @example
|
|
382
|
+
* ```typescript
|
|
383
|
+
* // Daily report at 9 AM
|
|
384
|
+
* const dailyReport = scheduledTrigger({
|
|
385
|
+
* name: 'Daily Report',
|
|
386
|
+
* cronExpression: '0 9 * * *',
|
|
387
|
+
* messageTemplate: 'Generate the daily report for {{date}}',
|
|
388
|
+
* payload: { date: '{{now}}' },
|
|
389
|
+
* });
|
|
390
|
+
*
|
|
391
|
+
* // One-time migration task
|
|
392
|
+
* const migrationTask = scheduledTrigger({
|
|
393
|
+
* name: 'Migration Task',
|
|
394
|
+
* runAt: '2024-12-31T23:59:59Z',
|
|
395
|
+
* messageTemplate: 'Run the end-of-year migration',
|
|
396
|
+
* maxRetries: 5,
|
|
397
|
+
* timeoutSeconds: 600,
|
|
398
|
+
* });
|
|
399
|
+
*
|
|
400
|
+
* // Hourly health check with retry configuration
|
|
401
|
+
* const healthCheck = scheduledTrigger({
|
|
402
|
+
* name: 'Hourly Health Check',
|
|
403
|
+
* cronExpression: '0 * * * *',
|
|
404
|
+
* messageTemplate: 'Check system health',
|
|
405
|
+
* maxRetries: 3,
|
|
406
|
+
* retryDelaySeconds: 30,
|
|
407
|
+
* timeoutSeconds: 120,
|
|
408
|
+
* });
|
|
409
|
+
* ```
|
|
410
|
+
*/
|
|
411
|
+
declare function scheduledTrigger(config: Omit<ScheduledTriggerInsert, "id"> & {
|
|
412
|
+
id?: string;
|
|
413
|
+
}): ScheduledTrigger;
|
|
371
414
|
//#endregion
|
|
372
|
-
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };
|
|
415
|
+
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, scheduledTrigger, statusComponent, subAgent, trigger };
|
package/dist/builderFunctions.js
CHANGED
|
@@ -4,6 +4,7 @@ import { Agent } from "./agent.js";
|
|
|
4
4
|
import { ArtifactComponent } from "./artifact-component.js";
|
|
5
5
|
import { DataComponent } from "./data-component.js";
|
|
6
6
|
import { Project } from "./project.js";
|
|
7
|
+
import { ScheduledTrigger } from "./scheduled-trigger.js";
|
|
7
8
|
import { StatusComponent as StatusComponent$1 } from "./status-component.js";
|
|
8
9
|
import { Tool } from "./tool.js";
|
|
9
10
|
import { SubAgent } from "./subAgent.js";
|
|
@@ -451,6 +452,48 @@ function trigger(config) {
|
|
|
451
452
|
}
|
|
452
453
|
return new Trigger(config);
|
|
453
454
|
}
|
|
455
|
+
/**
|
|
456
|
+
* Creates a scheduled trigger for time-based agent execution.
|
|
457
|
+
*
|
|
458
|
+
* Scheduled triggers allow agents to be invoked on a schedule using cron expressions
|
|
459
|
+
* or at a specific one-time date/time.
|
|
460
|
+
*
|
|
461
|
+
* @param config - Scheduled trigger configuration
|
|
462
|
+
* @returns A ScheduledTrigger instance
|
|
463
|
+
*
|
|
464
|
+
* @example
|
|
465
|
+
* ```typescript
|
|
466
|
+
* // Daily report at 9 AM
|
|
467
|
+
* const dailyReport = scheduledTrigger({
|
|
468
|
+
* name: 'Daily Report',
|
|
469
|
+
* cronExpression: '0 9 * * *',
|
|
470
|
+
* messageTemplate: 'Generate the daily report for {{date}}',
|
|
471
|
+
* payload: { date: '{{now}}' },
|
|
472
|
+
* });
|
|
473
|
+
*
|
|
474
|
+
* // One-time migration task
|
|
475
|
+
* const migrationTask = scheduledTrigger({
|
|
476
|
+
* name: 'Migration Task',
|
|
477
|
+
* runAt: '2024-12-31T23:59:59Z',
|
|
478
|
+
* messageTemplate: 'Run the end-of-year migration',
|
|
479
|
+
* maxRetries: 5,
|
|
480
|
+
* timeoutSeconds: 600,
|
|
481
|
+
* });
|
|
482
|
+
*
|
|
483
|
+
* // Hourly health check with retry configuration
|
|
484
|
+
* const healthCheck = scheduledTrigger({
|
|
485
|
+
* name: 'Hourly Health Check',
|
|
486
|
+
* cronExpression: '0 * * * *',
|
|
487
|
+
* messageTemplate: 'Check system health',
|
|
488
|
+
* maxRetries: 3,
|
|
489
|
+
* retryDelaySeconds: 30,
|
|
490
|
+
* timeoutSeconds: 120,
|
|
491
|
+
* });
|
|
492
|
+
* ```
|
|
493
|
+
*/
|
|
494
|
+
function scheduledTrigger(config) {
|
|
495
|
+
return new ScheduledTrigger(config);
|
|
496
|
+
}
|
|
454
497
|
|
|
455
498
|
//#endregion
|
|
456
|
-
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger };
|
|
499
|
+
export { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, scheduledTrigger, statusComponent, subAgent, trigger };
|
package/dist/builders.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Tool } from "./tool.js";
|
|
2
2
|
import { SubAgent } from "./subAgent.js";
|
|
3
3
|
import { TransferConfig } from "./types.js";
|
|
4
|
-
import { CredentialReferenceApiInsert, McpToolSelection, ToolPolicy } from "@inkeep/agents-core";
|
|
4
|
+
import { CredentialReferenceApiInsert, JsonSchemaForLlmSchemaType, McpToolSelection, ToolPolicy } from "@inkeep/agents-core";
|
|
5
5
|
import { z } from "zod";
|
|
6
6
|
|
|
7
7
|
//#region src/builders.d.ts
|
|
@@ -40,10 +40,10 @@ interface ComponentConfig {
|
|
|
40
40
|
description: string;
|
|
41
41
|
}
|
|
42
42
|
interface ArtifactComponentConfig extends ComponentConfig {
|
|
43
|
-
props:
|
|
43
|
+
props: JsonSchemaForLlmSchemaType | z.ZodObject<any>;
|
|
44
44
|
}
|
|
45
45
|
interface DataComponentConfig extends ComponentConfig {
|
|
46
|
-
props:
|
|
46
|
+
props: JsonSchemaForLlmSchemaType | z.ZodObject<any>;
|
|
47
47
|
render?: {
|
|
48
48
|
component: string;
|
|
49
49
|
mockData: Record<string, unknown>;
|
package/dist/data-component.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
|
|
4
4
|
//#region src/data-component.d.ts
|
|
5
5
|
type DataComponentConfigWithZod = Omit<DataComponentInsert, "tenantId" | "projectId" | "props" | "render"> & {
|
|
6
|
-
props
|
|
6
|
+
props: DataComponentInsert["props"] | z.ZodObject<any>;
|
|
7
7
|
render?: {
|
|
8
8
|
component: string;
|
|
9
9
|
mockData: Record<string, unknown>;
|
package/dist/data-component.js
CHANGED
|
@@ -12,9 +12,7 @@ var DataComponent = class {
|
|
|
12
12
|
id;
|
|
13
13
|
constructor(config) {
|
|
14
14
|
this.id = config.id || generateIdFromName(config.name);
|
|
15
|
-
|
|
16
|
-
if (config.props && isZodSchema(config.props)) processedProps = convertZodToJsonSchema(config.props);
|
|
17
|
-
else processedProps = config.props;
|
|
15
|
+
const processedProps = isZodSchema(config.props) ? convertZodToJsonSchema(config.props) : config.props;
|
|
18
16
|
this.config = {
|
|
19
17
|
...config,
|
|
20
18
|
id: this.id,
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScheduledTrigger, ScheduledTriggerConfig, ScheduledTriggerInterface } from "./scheduled-trigger.js";
|
|
1
2
|
import { Trigger, TriggerConfig, TriggerInterface } from "./trigger.js";
|
|
2
3
|
import { ArtifactComponent, ArtifactComponentInterface } from "./artifact-component.js";
|
|
3
4
|
import { Tool } from "./tool.js";
|
|
@@ -6,16 +7,17 @@ import { transfer } from "./builders.js";
|
|
|
6
7
|
import { DataComponent, DataComponentInterface } from "./data-component.js";
|
|
7
8
|
import { ExternalAgent, externalAgent, externalAgents } from "./external-agent.js";
|
|
8
9
|
import { FunctionTool } from "./function-tool.js";
|
|
9
|
-
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface,
|
|
10
|
+
import { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, ServerConfig, SkillDefinition, SkillReference, StreamEvent, StreamResponse, SubAgentCanUseType, SubAgentConfig, SubAgentInterface, SystemMessage, ToolCall, ToolConfig, ToolExecutionError, ToolMessage, ToolResult, TransferConfig, TransferError, UserMessage, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
10
11
|
import { Project } from "./project.js";
|
|
11
12
|
import { StatusComponent, StatusComponentInterface } from "./status-component.js";
|
|
12
|
-
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
13
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, scheduledTrigger, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
13
14
|
import { CredentialProviderConfig, CredentialProviderType, CredentialStore, CustomCredentialConfig, InkeepCredentialProvider, KeychainCredentialConfig, MemoryCredentialConfig, NangoCredentialConfig, createCredentialProvider } from "./credential-provider.js";
|
|
14
15
|
import { CredentialReference, ExtractCredentialIds, UnionCredentialIds, credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
15
16
|
import { createEnvironmentSettings, registerEnvironmentSettings } from "./environment-settings.js";
|
|
16
17
|
import { EvaluationClient, EvaluationClientConfig, evaluationClient } from "./evaluationClient.js";
|
|
17
18
|
import { createFullProjectViaAPI, deleteFullProjectViaAPI, getFullProjectViaAPI, updateFullProjectViaAPI } from "./projectFullClient.js";
|
|
18
19
|
import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
20
|
+
import { loadSkills } from "./skill-loader.js";
|
|
19
21
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OpenTelemetryConfig, SpanOptions, SpanStatus, SpanStatusType, TelemetryConfig, TelemetryLogger, TelemetryMetrics, TelemetryProvider, TelemetrySpan, TelemetryTracer, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
20
22
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS, SignatureSource, SignatureVerificationConfig, SignedComponent } from "@inkeep/agents-core";
|
|
21
|
-
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface,
|
|
23
|
+
export { ANTHROPIC_MODELS, AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, ArtifactComponent, type ArtifactComponentInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ConsoleTelemetryProvider, type CredentialProviderConfig, type CredentialProviderType, type CredentialReference, type CredentialStore, type CustomCredentialConfig, DataComponent, type DataComponentInterface, 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, ScheduledTrigger, type ScheduledTriggerConfig, type ScheduledTriggerInterface, ServerConfig, type SignatureSource, type SignatureVerificationConfig, type SignedComponent, SkillDefinition, SkillReference, 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, loadSkills, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, scheduledTrigger, setGlobalTelemetryProvider, statusComponent, stream, subAgent, subAgentExternalAgentInterface, subAgentTeamAgentInterface, transfer, trigger, updateFullProjectViaAPI };
|
package/dist/index.js
CHANGED
|
@@ -3,11 +3,12 @@ import { FunctionTool } from "./function-tool.js";
|
|
|
3
3
|
import { ArtifactComponent } from "./artifact-component.js";
|
|
4
4
|
import { DataComponent } from "./data-component.js";
|
|
5
5
|
import { Project } from "./project.js";
|
|
6
|
+
import { ScheduledTrigger } from "./scheduled-trigger.js";
|
|
6
7
|
import { StatusComponent } from "./status-component.js";
|
|
7
8
|
import { Tool } from "./tool.js";
|
|
8
9
|
import { SubAgent } from "./subAgent.js";
|
|
9
10
|
import { Trigger } from "./trigger.js";
|
|
10
|
-
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
11
|
+
import { agent, agentMcp, artifactComponent, credential, dataComponent, functionTool, mcpServer, mcpTool, project, scheduledTrigger, statusComponent, subAgent, trigger } from "./builderFunctions.js";
|
|
11
12
|
import { transfer } from "./builders.js";
|
|
12
13
|
import { InkeepCredentialProvider, createCredentialProvider } from "./credential-provider.js";
|
|
13
14
|
import { credentialRef, isCredentialReference } from "./credential-ref.js";
|
|
@@ -15,7 +16,8 @@ import { createEnvironmentSettings, registerEnvironmentSettings } from "./enviro
|
|
|
15
16
|
import { EvaluationClient, evaluationClient } from "./evaluationClient.js";
|
|
16
17
|
import { ExternalAgent, externalAgent, externalAgents } from "./external-agent.js";
|
|
17
18
|
import { Runner, raceAgents, run, stream } from "./runner.js";
|
|
19
|
+
import { loadSkills } from "./skill-loader.js";
|
|
18
20
|
import { ConsoleTelemetryProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, SpanStatus, createConsoleTelemetryProvider, createNoOpTelemetryProvider, createOpenTelemetryProvider, getGlobalTelemetryProvider, setGlobalTelemetryProvider } from "./telemetry-provider.js";
|
|
19
21
|
import { ANTHROPIC_MODELS, GOOGLE_MODELS, OPENAI_MODELS } from "@inkeep/agents-core";
|
|
20
22
|
|
|
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 };
|
|
23
|
+
export { ANTHROPIC_MODELS, ArtifactComponent, ConsoleTelemetryProvider, DataComponent, EvaluationClient, ExternalAgent, FunctionTool, GOOGLE_MODELS, InkeepCredentialProvider, InkeepTelemetryProvider, NoOpTelemetryProvider, OPENAI_MODELS, Project, Runner, ScheduledTrigger, 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, loadSkills, mcpServer, mcpTool, project, raceAgents, registerEnvironmentSettings, run, scheduledTrigger, setGlobalTelemetryProvider, statusComponent, stream, subAgent, transfer, trigger, updateFullProjectViaAPI };
|
package/dist/project.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { ArtifactComponent } from "./artifact-component.js";
|
|
|
2
2
|
import { Tool } from "./tool.js";
|
|
3
3
|
import { DataComponent } from "./data-component.js";
|
|
4
4
|
import { ExternalAgent } from "./external-agent.js";
|
|
5
|
-
import { ModelSettings } from "./types.js";
|
|
5
|
+
import { ModelSettings, SkillDefinition } from "./types.js";
|
|
6
6
|
import { Agent } from "./agent.js";
|
|
7
7
|
import { CredentialReferenceApiInsert, FullProjectDefinition, StopWhen } from "@inkeep/agents-core";
|
|
8
8
|
|
|
@@ -27,6 +27,7 @@ interface ProjectConfig {
|
|
|
27
27
|
dataComponents?: () => DataComponent[];
|
|
28
28
|
artifactComponents?: () => ArtifactComponent[];
|
|
29
29
|
credentialReferences?: () => CredentialReferenceApiInsert[];
|
|
30
|
+
skills?: () => SkillDefinition[];
|
|
30
31
|
}
|
|
31
32
|
/**
|
|
32
33
|
* Project interface for operations
|
|
@@ -98,6 +99,7 @@ declare class Project implements ProjectInterface {
|
|
|
98
99
|
private projectArtifactComponents;
|
|
99
100
|
private projectExternalAgents;
|
|
100
101
|
private externalAgentMap;
|
|
102
|
+
private skills;
|
|
101
103
|
constructor(config: ProjectConfig);
|
|
102
104
|
/**
|
|
103
105
|
* Set or update the configuration (tenantId and apiUrl)
|
package/dist/project.js
CHANGED
|
@@ -48,6 +48,7 @@ var Project = class {
|
|
|
48
48
|
projectArtifactComponents = [];
|
|
49
49
|
projectExternalAgents = [];
|
|
50
50
|
externalAgentMap = /* @__PURE__ */ new Map();
|
|
51
|
+
skills = [];
|
|
51
52
|
constructor(config) {
|
|
52
53
|
this.projectId = config.id;
|
|
53
54
|
this.projectName = config.name;
|
|
@@ -56,6 +57,7 @@ var Project = class {
|
|
|
56
57
|
this.baseURL = process.env.INKEEP_API_URL || "http://localhost:3002";
|
|
57
58
|
this.models = config.models;
|
|
58
59
|
this.stopWhen = config.stopWhen;
|
|
60
|
+
this.skills = config.skills ? config.skills() : [];
|
|
59
61
|
if (config.agents) {
|
|
60
62
|
this.agents = config.agents();
|
|
61
63
|
this.agentMap = new Map(this.agents.map((agent) => [agent.getId(), agent]));
|
|
@@ -321,6 +323,8 @@ var Project = class {
|
|
|
321
323
|
const artifactComponentsObject = {};
|
|
322
324
|
const credentialReferencesObject = {};
|
|
323
325
|
const externalAgentsObject = {};
|
|
326
|
+
const skillsObject = {};
|
|
327
|
+
const skillTimestamp = (/* @__PURE__ */ new Date()).toISOString();
|
|
324
328
|
const credentialUsageMap = {};
|
|
325
329
|
for (const agent of this.agents) {
|
|
326
330
|
logger.info({ agentId: agent.getId() }, "Agent id");
|
|
@@ -552,6 +556,18 @@ var Project = class {
|
|
|
552
556
|
}
|
|
553
557
|
}
|
|
554
558
|
logger.info({ externalAgentsObject }, "External agents object");
|
|
559
|
+
for (const skill of this.skills) {
|
|
560
|
+
if (!skill.id) continue;
|
|
561
|
+
skillsObject[skill.id] = {
|
|
562
|
+
id: skill.id,
|
|
563
|
+
name: skill.name,
|
|
564
|
+
description: skill.description,
|
|
565
|
+
content: skill.content,
|
|
566
|
+
metadata: skill.metadata ?? null,
|
|
567
|
+
createdAt: skill.createdAt ?? skillTimestamp,
|
|
568
|
+
updatedAt: skill.updatedAt ?? skillTimestamp
|
|
569
|
+
};
|
|
570
|
+
}
|
|
555
571
|
for (const tool of this.projectTools) {
|
|
556
572
|
const toolId = tool.getId();
|
|
557
573
|
if (!toolsObject[toolId]) {
|
|
@@ -623,6 +639,7 @@ var Project = class {
|
|
|
623
639
|
artifactComponents: Object.keys(artifactComponentsObject).length > 0 ? artifactComponentsObject : void 0,
|
|
624
640
|
externalAgents: Object.keys(externalAgentsObject).length > 0 ? externalAgentsObject : void 0,
|
|
625
641
|
credentialReferences: Object.keys(credentialReferencesObject).length > 0 ? credentialReferencesObject : void 0,
|
|
642
|
+
skills: Object.keys(skillsObject).length > 0 ? skillsObject : void 0,
|
|
626
643
|
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
627
644
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
628
645
|
};
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { ScheduledTriggerInsert } from "@inkeep/agents-core";
|
|
2
|
+
|
|
3
|
+
//#region src/scheduled-trigger.d.ts
|
|
4
|
+
type ScheduledTriggerConfig = Omit<ScheduledTriggerInsert, "id"> & {
|
|
5
|
+
id?: string;
|
|
6
|
+
};
|
|
7
|
+
interface ScheduledTriggerInterface {
|
|
8
|
+
getId(): string;
|
|
9
|
+
getName(): string;
|
|
10
|
+
getConfig(): Omit<ScheduledTriggerInsert, "id"> & {
|
|
11
|
+
id: string;
|
|
12
|
+
};
|
|
13
|
+
with(config: Partial<ScheduledTriggerConfig>): ScheduledTrigger;
|
|
14
|
+
}
|
|
15
|
+
declare class ScheduledTrigger implements ScheduledTriggerInterface {
|
|
16
|
+
private config;
|
|
17
|
+
private id;
|
|
18
|
+
constructor(config: ScheduledTriggerConfig);
|
|
19
|
+
getId(): string;
|
|
20
|
+
getName(): string;
|
|
21
|
+
getConfig(): Omit<ScheduledTriggerInsert, "id"> & {
|
|
22
|
+
id: string;
|
|
23
|
+
};
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new ScheduledTrigger with the given configuration overrides.
|
|
26
|
+
*
|
|
27
|
+
* @param config - Partial configuration to override
|
|
28
|
+
* @returns A new ScheduledTrigger instance with the merged configuration
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const trigger = new ScheduledTrigger({
|
|
33
|
+
* name: 'Daily Report',
|
|
34
|
+
* cronExpression: '0 9 * * *',
|
|
35
|
+
* messageTemplate: 'Generate daily report for {{date}}',
|
|
36
|
+
* });
|
|
37
|
+
* const disabled = trigger.with({ enabled: false });
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
with(config: Partial<ScheduledTriggerConfig>): ScheduledTrigger;
|
|
41
|
+
}
|
|
42
|
+
//#endregion
|
|
43
|
+
export { ScheduledTrigger, ScheduledTriggerConfig, ScheduledTriggerInterface };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { generateIdFromName } from "./utils/generateIdFromName.js";
|
|
2
|
+
import { getLogger } from "@inkeep/agents-core";
|
|
3
|
+
|
|
4
|
+
//#region src/scheduled-trigger.ts
|
|
5
|
+
const logger = getLogger("scheduled-trigger");
|
|
6
|
+
var ScheduledTrigger = class ScheduledTrigger {
|
|
7
|
+
config;
|
|
8
|
+
id;
|
|
9
|
+
constructor(config) {
|
|
10
|
+
this.id = config.id || generateIdFromName(config.name);
|
|
11
|
+
this.config = {
|
|
12
|
+
...config,
|
|
13
|
+
id: this.id
|
|
14
|
+
};
|
|
15
|
+
logger.info({
|
|
16
|
+
scheduledTriggerId: this.getId(),
|
|
17
|
+
scheduledTriggerName: config.name,
|
|
18
|
+
cronExpression: config.cronExpression,
|
|
19
|
+
runAt: config.runAt
|
|
20
|
+
}, "ScheduledTrigger constructor initialized");
|
|
21
|
+
}
|
|
22
|
+
getId() {
|
|
23
|
+
return this.id;
|
|
24
|
+
}
|
|
25
|
+
getName() {
|
|
26
|
+
return this.config.name;
|
|
27
|
+
}
|
|
28
|
+
getConfig() {
|
|
29
|
+
return this.config;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Creates a new ScheduledTrigger with the given configuration overrides.
|
|
33
|
+
*
|
|
34
|
+
* @param config - Partial configuration to override
|
|
35
|
+
* @returns A new ScheduledTrigger instance with the merged configuration
|
|
36
|
+
*
|
|
37
|
+
* @example
|
|
38
|
+
* ```typescript
|
|
39
|
+
* const trigger = new ScheduledTrigger({
|
|
40
|
+
* name: 'Daily Report',
|
|
41
|
+
* cronExpression: '0 9 * * *',
|
|
42
|
+
* messageTemplate: 'Generate daily report for {{date}}',
|
|
43
|
+
* });
|
|
44
|
+
* const disabled = trigger.with({ enabled: false });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
with(config) {
|
|
48
|
+
return new ScheduledTrigger({
|
|
49
|
+
...this.config,
|
|
50
|
+
...config
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
//#endregion
|
|
56
|
+
export { ScheduledTrigger };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
|
+
import { SkillFrontmatterSchema } from "@inkeep/agents-core/client-exports";
|
|
4
|
+
import { simplematter } from "simplematter";
|
|
5
|
+
|
|
6
|
+
//#region src/skill-loader.ts
|
|
7
|
+
function getParentDirName(filePath) {
|
|
8
|
+
return path.basename(path.dirname(filePath));
|
|
9
|
+
}
|
|
10
|
+
function loadSkills(directoryPath) {
|
|
11
|
+
return fs.globSync("*/SKILL.md", { cwd: directoryPath }).map((filePath) => {
|
|
12
|
+
const resolvedPath = path.join(directoryPath, filePath);
|
|
13
|
+
const [frontmatter, document] = simplematter(fs.readFileSync(resolvedPath, "utf8"));
|
|
14
|
+
const { name, description, metadata } = SkillFrontmatterSchema.parse(frontmatter);
|
|
15
|
+
const id = getParentDirName(filePath);
|
|
16
|
+
if (name !== id) throw new Error(`Skill name "${name}" does not match directory "${id}"`);
|
|
17
|
+
return {
|
|
18
|
+
id,
|
|
19
|
+
name,
|
|
20
|
+
description,
|
|
21
|
+
metadata,
|
|
22
|
+
content: document.trim()
|
|
23
|
+
};
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { loadSkills };
|
package/dist/subAgent.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Tool } from "./tool.js";
|
|
2
|
-
import { AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, SubAgentConfig, SubAgentInterface, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
2
|
+
import { AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, SkillDefinition, SubAgentConfig, SubAgentInterface, subAgentExternalAgentInterface, subAgentTeamAgentInterface } from "./types.js";
|
|
3
3
|
import { ArtifactComponentApiInsert, DataComponentApiInsert } from "@inkeep/agents-core";
|
|
4
4
|
|
|
5
5
|
//#region src/subAgent.d.ts
|
|
6
6
|
declare class SubAgent implements SubAgentInterface {
|
|
7
7
|
config: SubAgentConfig;
|
|
8
|
-
readonly type
|
|
8
|
+
readonly type = "internal";
|
|
9
9
|
private baseURL;
|
|
10
10
|
private tenantId;
|
|
11
11
|
private projectId;
|
|
@@ -27,6 +27,12 @@ declare class SubAgent implements SubAgentInterface {
|
|
|
27
27
|
getExternalAgentDelegates(): subAgentExternalAgentInterface[];
|
|
28
28
|
getTeamAgentDelegates(): subAgentTeamAgentInterface[];
|
|
29
29
|
getDelegates(): AllDelegateOutputInterface[];
|
|
30
|
+
getSkills(): Array<{
|
|
31
|
+
id: string;
|
|
32
|
+
index?: number;
|
|
33
|
+
alwaysLoaded?: boolean;
|
|
34
|
+
skill?: SkillDefinition;
|
|
35
|
+
}>;
|
|
30
36
|
getDataComponents(): DataComponentApiInsert[];
|
|
31
37
|
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
32
38
|
addTool(_name: string, tool: Tool): void;
|
package/dist/subAgent.js
CHANGED
|
@@ -127,6 +127,38 @@ var SubAgent = class {
|
|
|
127
127
|
...this.getExternalAgentDelegates()
|
|
128
128
|
];
|
|
129
129
|
}
|
|
130
|
+
getSkills() {
|
|
131
|
+
const skills = resolveGetter(this.config.skills);
|
|
132
|
+
if (!skills) return [];
|
|
133
|
+
return skills.map((entry, idx) => {
|
|
134
|
+
if (!entry) return null;
|
|
135
|
+
if (typeof entry === "string") return {
|
|
136
|
+
id: entry,
|
|
137
|
+
index: idx
|
|
138
|
+
};
|
|
139
|
+
if ("id" in entry) {
|
|
140
|
+
const skillEntry = entry;
|
|
141
|
+
const hasSkillDefinition = typeof skillEntry.content === "string" || typeof skillEntry.name === "string";
|
|
142
|
+
const alwaysLoaded = typeof skillEntry.alwaysLoaded === "boolean" ? skillEntry.alwaysLoaded : void 0;
|
|
143
|
+
return {
|
|
144
|
+
id: skillEntry.id,
|
|
145
|
+
index: skillEntry.index ?? idx,
|
|
146
|
+
...alwaysLoaded !== void 0 && { alwaysLoaded },
|
|
147
|
+
...hasSkillDefinition && { skill: skillEntry }
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
if ("skillId" in entry) {
|
|
151
|
+
const skillEntry = entry;
|
|
152
|
+
const alwaysLoaded = typeof skillEntry.alwaysLoaded === "boolean" ? skillEntry.alwaysLoaded : void 0;
|
|
153
|
+
return {
|
|
154
|
+
id: skillEntry.skillId,
|
|
155
|
+
index: skillEntry.index ?? idx,
|
|
156
|
+
...alwaysLoaded !== void 0 && { alwaysLoaded }
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
return null;
|
|
160
|
+
}).filter((p) => !!p);
|
|
161
|
+
}
|
|
130
162
|
getDataComponents() {
|
|
131
163
|
return (resolveGetter(this.config.dataComponents) || []).map((comp) => {
|
|
132
164
|
if (comp && typeof comp.getId === "function") return {
|
package/dist/types.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { ScheduledTriggerInterface } from "./scheduled-trigger.js";
|
|
1
2
|
import { TriggerInterface } from "./trigger.js";
|
|
2
3
|
import { ArtifactComponentInterface } from "./artifact-component.js";
|
|
3
4
|
import { Tool } from "./tool.js";
|
|
@@ -9,18 +10,7 @@ import { AgentConversationHistoryConfig, AgentStopWhen, ArtifactComponentApiInse
|
|
|
9
10
|
import { z } from "zod";
|
|
10
11
|
|
|
11
12
|
//#region src/types.d.ts
|
|
12
|
-
|
|
13
|
-
id: string;
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
props?: z.ZodObject<any>;
|
|
17
|
-
}
|
|
18
|
-
interface DataComponentWithZodProps {
|
|
19
|
-
id: string;
|
|
20
|
-
name: string;
|
|
21
|
-
description: string;
|
|
22
|
-
props?: z.ZodObject<any>;
|
|
23
|
-
}
|
|
13
|
+
|
|
24
14
|
/**
|
|
25
15
|
* Tool instance that may have additional metadata attached during agent processing
|
|
26
16
|
*/
|
|
@@ -66,6 +56,27 @@ interface ToolResult {
|
|
|
66
56
|
result: any;
|
|
67
57
|
error?: string;
|
|
68
58
|
}
|
|
59
|
+
interface SkillDefinition {
|
|
60
|
+
id: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
content: string;
|
|
64
|
+
metadata: Record<string, string> | null;
|
|
65
|
+
createdAt?: string;
|
|
66
|
+
updatedAt?: string;
|
|
67
|
+
}
|
|
68
|
+
type SkillReference = string | {
|
|
69
|
+
id: string;
|
|
70
|
+
index?: number;
|
|
71
|
+
alwaysLoaded?: boolean;
|
|
72
|
+
} | {
|
|
73
|
+
skillId: string;
|
|
74
|
+
index?: number;
|
|
75
|
+
alwaysLoaded?: boolean;
|
|
76
|
+
} | (SkillDefinition & {
|
|
77
|
+
index?: number;
|
|
78
|
+
alwaysLoaded?: boolean;
|
|
79
|
+
});
|
|
69
80
|
type AllDelegateInputInterface = SubAgentInterface | subAgentExternalAgentInterface | ExternalAgentInterface | AgentInterface | subAgentTeamAgentInterface;
|
|
70
81
|
type AllDelegateOutputInterface = SubAgentInterface | subAgentExternalAgentInterface | subAgentTeamAgentInterface;
|
|
71
82
|
type SubAgentCanUseType = Tool | AgentMcpConfig | FunctionTool;
|
|
@@ -74,8 +85,9 @@ interface SubAgentConfig extends Omit<SubAgentApiInsert, "projectId"> {
|
|
|
74
85
|
canUse?: () => SubAgentCanUseType[];
|
|
75
86
|
canTransferTo?: () => SubAgentInterface[];
|
|
76
87
|
canDelegateTo?: () => AllDelegateInputInterface[];
|
|
77
|
-
|
|
78
|
-
|
|
88
|
+
skills?: () => SkillReference[];
|
|
89
|
+
dataComponents?: () => (DataComponentApiInsert | DataComponentInterface)[];
|
|
90
|
+
artifactComponents?: () => (ArtifactComponentApiInsert | ArtifactComponentInterface)[];
|
|
79
91
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
80
92
|
}
|
|
81
93
|
interface ToolConfig extends ToolInsert {
|
|
@@ -201,6 +213,7 @@ interface AgentConfig {
|
|
|
201
213
|
};
|
|
202
214
|
statusUpdates?: StatusUpdateSettings;
|
|
203
215
|
triggers?: () => TriggerInterface[];
|
|
216
|
+
scheduledTriggers?: () => ScheduledTriggerInterface[];
|
|
204
217
|
}
|
|
205
218
|
declare class AgentError extends Error {
|
|
206
219
|
code?: string | undefined;
|
|
@@ -231,6 +244,12 @@ interface SubAgentInterface {
|
|
|
231
244
|
getExternalAgentDelegates(): subAgentExternalAgentInterface[];
|
|
232
245
|
getDataComponents(): DataComponentApiInsert[];
|
|
233
246
|
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
247
|
+
getSkills(): Array<{
|
|
248
|
+
id: string;
|
|
249
|
+
index?: number;
|
|
250
|
+
alwaysLoaded?: boolean;
|
|
251
|
+
skill?: SkillDefinition;
|
|
252
|
+
}>;
|
|
234
253
|
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
235
254
|
addTool(name: string, tool: any): void;
|
|
236
255
|
addTransfer(...agents: SubAgentInterface[]): void;
|
|
@@ -261,7 +280,7 @@ type subAgentTeamAgentInterface = {
|
|
|
261
280
|
};
|
|
262
281
|
interface AgentInterface {
|
|
263
282
|
init(): Promise<void>;
|
|
264
|
-
setConfig(tenantId: string, projectId: string, apiUrl: string): void;
|
|
283
|
+
setConfig(tenantId: string, projectId: string, apiUrl: string, skills?: SkillDefinition[]): void;
|
|
265
284
|
getId(): string;
|
|
266
285
|
getName(): string;
|
|
267
286
|
getDescription(): string | undefined;
|
|
@@ -302,4 +321,4 @@ interface BuilderAgentConfig {
|
|
|
302
321
|
relations?: BuilderRelationConfig[];
|
|
303
322
|
}
|
|
304
323
|
//#endregion
|
|
305
|
-
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface,
|
|
324
|
+
export { AgentConfig, AgentError, AgentInterface, AgentResponse, AgentTool, AllDelegateInputInterface, AllDelegateOutputInterface, AssistantMessage, BuilderAgentConfig, BuilderRelationConfig, BuilderToolConfig, ExternalAgentInterface, FetchDefinitionConfig, type FunctionToolConfig, GenerateOptions, MCPToolConfig, MaxTurnsExceededError, Message, MessageInput, type ModelSettings, RequestSchemaConfig, RequestSchemaDefinition, RunResult, type ScheduledTriggerInterface, ServerConfig, SkillDefinition, SkillReference, 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.
|
|
3
|
+
"version": "0.48.1",
|
|
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",
|
|
@@ -13,14 +13,15 @@
|
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
15
|
"@yarnpkg/lockfile": "^1.1.0",
|
|
16
|
+
"simplematter": "^1.0.0",
|
|
16
17
|
"js-yaml": "^4.1.0",
|
|
17
18
|
"typescript": "^5.3.3",
|
|
18
19
|
"zod": "^4.3.6",
|
|
19
|
-
"@inkeep/agents-core": "^0.
|
|
20
|
+
"@inkeep/agents-core": "^0.48.1"
|
|
20
21
|
},
|
|
21
22
|
"devDependencies": {
|
|
22
23
|
"@types/js-yaml": "^4.0.9",
|
|
23
|
-
"@types/node": "^
|
|
24
|
+
"@types/node": "^22.19.3",
|
|
24
25
|
"@types/yarnpkg__lockfile": "^1.1.0",
|
|
25
26
|
"@vitest/coverage-v8": "^3.2.4",
|
|
26
27
|
"vitest": "^3.2.4"
|