@inkeep/agents-sdk 0.11.3 → 0.12.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/index.cjs +33 -65
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +33 -65
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -38,10 +38,13 @@ var ArtifactComponent = class {
|
|
|
38
38
|
"ArtifactComponent constructor initialized"
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
-
// Set context (tenantId and
|
|
42
|
-
setContext(tenantId, projectId) {
|
|
41
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
42
|
+
setContext(tenantId, projectId, baseURL) {
|
|
43
43
|
this.tenantId = tenantId;
|
|
44
44
|
this.projectId = projectId;
|
|
45
|
+
if (baseURL) {
|
|
46
|
+
this.baseURL = baseURL;
|
|
47
|
+
}
|
|
45
48
|
}
|
|
46
49
|
// Compute ID from name using same slug transformation as agents
|
|
47
50
|
getId() {
|
|
@@ -180,10 +183,13 @@ var DataComponent = class {
|
|
|
180
183
|
"DataComponent constructor initialized"
|
|
181
184
|
);
|
|
182
185
|
}
|
|
183
|
-
// Set context (tenantId and
|
|
184
|
-
setContext(tenantId, projectId) {
|
|
186
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
187
|
+
setContext(tenantId, projectId, baseURL) {
|
|
185
188
|
this.tenantId = tenantId;
|
|
186
189
|
this.projectId = projectId;
|
|
190
|
+
if (baseURL) {
|
|
191
|
+
this.baseURL = baseURL;
|
|
192
|
+
}
|
|
187
193
|
}
|
|
188
194
|
// Compute ID from name using same slug transformation as agents
|
|
189
195
|
getId() {
|
|
@@ -313,10 +319,13 @@ var Tool = class {
|
|
|
313
319
|
"Tool constructor initialized"
|
|
314
320
|
);
|
|
315
321
|
}
|
|
316
|
-
// Set context (tenantId and
|
|
317
|
-
setContext(tenantId, projectId) {
|
|
322
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
323
|
+
setContext(tenantId, projectId, baseURL) {
|
|
318
324
|
this.tenantId = tenantId;
|
|
319
325
|
this.projectId = projectId;
|
|
326
|
+
if (baseURL) {
|
|
327
|
+
this.baseURL = baseURL;
|
|
328
|
+
}
|
|
320
329
|
}
|
|
321
330
|
// Compute ID from name using same slug transformation as agents
|
|
322
331
|
getId() {
|
|
@@ -494,10 +503,13 @@ var Agent = class {
|
|
|
494
503
|
"Agent constructor initialized"
|
|
495
504
|
);
|
|
496
505
|
}
|
|
497
|
-
// Set context (tenantId and
|
|
498
|
-
setContext(tenantId, projectId) {
|
|
506
|
+
// Set context (tenantId, projectId, and baseURL) from external source (graph, CLI, etc)
|
|
507
|
+
setContext(tenantId, projectId, baseURL) {
|
|
499
508
|
this.tenantId = tenantId;
|
|
500
509
|
this.projectId = projectId;
|
|
510
|
+
if (baseURL) {
|
|
511
|
+
this.baseURL = baseURL;
|
|
512
|
+
}
|
|
501
513
|
}
|
|
502
514
|
// Return the configured ID
|
|
503
515
|
getId() {
|
|
@@ -1208,20 +1220,25 @@ var AgentGraph = class {
|
|
|
1208
1220
|
if (this.isInternalAgent(agent2)) {
|
|
1209
1221
|
const internalAgent = agent2;
|
|
1210
1222
|
if (internalAgent.setContext) {
|
|
1211
|
-
internalAgent.setContext(tenantId, projectId);
|
|
1223
|
+
internalAgent.setContext(tenantId, projectId, apiUrl);
|
|
1212
1224
|
}
|
|
1213
1225
|
const tools = internalAgent.getTools();
|
|
1214
1226
|
for (const [_, toolInstance] of Object.entries(tools)) {
|
|
1215
1227
|
if (toolInstance && typeof toolInstance === "object") {
|
|
1216
1228
|
if ("setContext" in toolInstance && typeof toolInstance.setContext === "function") {
|
|
1217
|
-
toolInstance.setContext(tenantId, projectId);
|
|
1229
|
+
toolInstance.setContext(tenantId, projectId, apiUrl);
|
|
1218
1230
|
}
|
|
1219
1231
|
}
|
|
1220
1232
|
}
|
|
1233
|
+
} else {
|
|
1234
|
+
const externalAgent2 = agent2;
|
|
1235
|
+
if (externalAgent2.setContext) {
|
|
1236
|
+
externalAgent2.setContext(tenantId, apiUrl);
|
|
1237
|
+
}
|
|
1221
1238
|
}
|
|
1222
1239
|
}
|
|
1223
1240
|
if (this.contextConfig?.setContext) {
|
|
1224
|
-
this.contextConfig.setContext(tenantId, projectId);
|
|
1241
|
+
this.contextConfig.setContext(tenantId, projectId, apiUrl);
|
|
1225
1242
|
}
|
|
1226
1243
|
logger6.info(
|
|
1227
1244
|
{
|
|
@@ -2621,58 +2638,6 @@ var Project = class {
|
|
|
2621
2638
|
"Initializing project using full project endpoint"
|
|
2622
2639
|
);
|
|
2623
2640
|
try {
|
|
2624
|
-
const projectMetadata = {
|
|
2625
|
-
id: this.projectId,
|
|
2626
|
-
name: this.projectName,
|
|
2627
|
-
description: this.projectDescription || "",
|
|
2628
|
-
models: this.models,
|
|
2629
|
-
stopWhen: this.stopWhen,
|
|
2630
|
-
graphs: {},
|
|
2631
|
-
// Empty graphs object for now
|
|
2632
|
-
tools: {},
|
|
2633
|
-
// Empty tools object
|
|
2634
|
-
credentialReferences: void 0,
|
|
2635
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2636
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2637
|
-
};
|
|
2638
|
-
logger8.info(
|
|
2639
|
-
{
|
|
2640
|
-
projectId: this.projectId,
|
|
2641
|
-
mode: "api-client",
|
|
2642
|
-
apiUrl: this.baseURL
|
|
2643
|
-
},
|
|
2644
|
-
"Creating project metadata first"
|
|
2645
|
-
);
|
|
2646
|
-
await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
|
|
2647
|
-
logger8.info(
|
|
2648
|
-
{
|
|
2649
|
-
projectId: this.projectId
|
|
2650
|
-
},
|
|
2651
|
-
"Project metadata created successfully"
|
|
2652
|
-
);
|
|
2653
|
-
const initPromises = this.graphs.map(async (graph) => {
|
|
2654
|
-
try {
|
|
2655
|
-
await graph.init();
|
|
2656
|
-
logger8.debug(
|
|
2657
|
-
{
|
|
2658
|
-
projectId: this.projectId,
|
|
2659
|
-
graphId: graph.getId()
|
|
2660
|
-
},
|
|
2661
|
-
"Graph initialized in project"
|
|
2662
|
-
);
|
|
2663
|
-
} catch (error) {
|
|
2664
|
-
logger8.error(
|
|
2665
|
-
{
|
|
2666
|
-
projectId: this.projectId,
|
|
2667
|
-
graphId: graph.getId(),
|
|
2668
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
2669
|
-
},
|
|
2670
|
-
"Failed to initialize graph in project"
|
|
2671
|
-
);
|
|
2672
|
-
throw error;
|
|
2673
|
-
}
|
|
2674
|
-
});
|
|
2675
|
-
await Promise.all(initPromises);
|
|
2676
2641
|
const projectDefinition = await this.toFullProjectDefinition();
|
|
2677
2642
|
logger8.info(
|
|
2678
2643
|
{
|
|
@@ -3243,9 +3208,12 @@ var ExternalAgent = class {
|
|
|
3243
3208
|
throw error;
|
|
3244
3209
|
}
|
|
3245
3210
|
}
|
|
3246
|
-
// Set context (tenantId) from external source (graph, CLI, etc)
|
|
3247
|
-
setContext(tenantId) {
|
|
3211
|
+
// Set context (tenantId and baseURL) from external source (graph, CLI, etc)
|
|
3212
|
+
setContext(tenantId, baseURL) {
|
|
3248
3213
|
this.tenantId = tenantId;
|
|
3214
|
+
if (baseURL) {
|
|
3215
|
+
this.baseURL = baseURL;
|
|
3216
|
+
}
|
|
3249
3217
|
}
|
|
3250
3218
|
// Compute ID from name using a simple slug transformation
|
|
3251
3219
|
getId() {
|
package/dist/index.d.cts
CHANGED
|
@@ -18,7 +18,7 @@ declare class Tool implements ToolInterface {
|
|
|
18
18
|
private initialized;
|
|
19
19
|
private projectId;
|
|
20
20
|
constructor(config: Omit<MCPToolConfig$1, 'tenantId' | 'projectId'>);
|
|
21
|
-
setContext(tenantId: string, projectId: string): void;
|
|
21
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
22
22
|
getId(): string;
|
|
23
23
|
getName(): string;
|
|
24
24
|
getDescription(): string;
|
|
@@ -39,7 +39,7 @@ interface ArtifactComponentInterface {
|
|
|
39
39
|
getDescription(): ArtifactComponentInsert['description'];
|
|
40
40
|
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
41
41
|
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
42
|
-
setContext(tenantId: string, projectId: string): void;
|
|
42
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
43
43
|
}
|
|
44
44
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
45
45
|
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -49,7 +49,7 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
49
49
|
private initialized;
|
|
50
50
|
private id;
|
|
51
51
|
constructor(config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>);
|
|
52
|
-
setContext(tenantId: string, projectId: string): void;
|
|
52
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
53
53
|
getId(): string;
|
|
54
54
|
getName(): string;
|
|
55
55
|
getDescription(): string;
|
|
@@ -131,7 +131,7 @@ interface DataComponentInterface {
|
|
|
131
131
|
getName(): DataComponentInsert['name'];
|
|
132
132
|
getDescription(): DataComponentInsert['description'];
|
|
133
133
|
getProps(): DataComponentInsert['props'];
|
|
134
|
-
setContext(tenantId: string, projectId: string): void;
|
|
134
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
135
135
|
}
|
|
136
136
|
declare class DataComponent implements DataComponentInterface {
|
|
137
137
|
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -141,7 +141,7 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
141
141
|
private initialized;
|
|
142
142
|
private id;
|
|
143
143
|
constructor(config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>);
|
|
144
|
-
setContext(tenantId: string, projectId: string): void;
|
|
144
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
145
145
|
getId(): string;
|
|
146
146
|
getName(): string;
|
|
147
147
|
getDescription(): string;
|
|
@@ -170,7 +170,7 @@ declare class ExternalAgent implements ExternalAgentInterface {
|
|
|
170
170
|
* Initialize the external agent by upserting it in the database
|
|
171
171
|
*/
|
|
172
172
|
init(): Promise<void>;
|
|
173
|
-
setContext(tenantId: string): void;
|
|
173
|
+
setContext(tenantId: string, baseURL?: string): void;
|
|
174
174
|
getId(): string;
|
|
175
175
|
private upsertExternalAgent;
|
|
176
176
|
/**
|
|
@@ -414,7 +414,7 @@ interface AgentInterface {
|
|
|
414
414
|
getDelegates(): AllAgentInterface[];
|
|
415
415
|
getDataComponents(): DataComponentApiInsert[];
|
|
416
416
|
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
417
|
-
setContext(tenantId: string, projectId: string): void;
|
|
417
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
418
418
|
addTool(name: string, tool: any): void;
|
|
419
419
|
addTransfer(...agents: AgentInterface[]): void;
|
|
420
420
|
addDelegate(...agents: AgentInterface[]): void;
|
|
@@ -429,7 +429,7 @@ interface ExternalAgentInterface {
|
|
|
429
429
|
getBaseUrl(): string;
|
|
430
430
|
getCredentialReferenceId(): string | undefined;
|
|
431
431
|
getHeaders(): Record<string, string> | undefined;
|
|
432
|
-
setContext?(tenantId: string): void;
|
|
432
|
+
setContext?(tenantId: string, baseURL?: string): void;
|
|
433
433
|
}
|
|
434
434
|
interface GraphInterface {
|
|
435
435
|
init(): Promise<void>;
|
|
@@ -479,7 +479,7 @@ declare class Agent implements AgentInterface {
|
|
|
479
479
|
private projectId;
|
|
480
480
|
private initialized;
|
|
481
481
|
constructor(config: AgentConfig);
|
|
482
|
-
setContext(tenantId: string, projectId: string): void;
|
|
482
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
483
483
|
getId(): string;
|
|
484
484
|
getName(): string;
|
|
485
485
|
getInstructions(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ declare class Tool implements ToolInterface {
|
|
|
18
18
|
private initialized;
|
|
19
19
|
private projectId;
|
|
20
20
|
constructor(config: Omit<MCPToolConfig$1, 'tenantId' | 'projectId'>);
|
|
21
|
-
setContext(tenantId: string, projectId: string): void;
|
|
21
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
22
22
|
getId(): string;
|
|
23
23
|
getName(): string;
|
|
24
24
|
getDescription(): string;
|
|
@@ -39,7 +39,7 @@ interface ArtifactComponentInterface {
|
|
|
39
39
|
getDescription(): ArtifactComponentInsert['description'];
|
|
40
40
|
getSummaryProps(): ArtifactComponentInsert['summaryProps'];
|
|
41
41
|
getFullProps(): ArtifactComponentInsert['fullProps'];
|
|
42
|
-
setContext(tenantId: string, projectId: string): void;
|
|
42
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
43
43
|
}
|
|
44
44
|
declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
45
45
|
config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -49,7 +49,7 @@ declare class ArtifactComponent implements ArtifactComponentInterface {
|
|
|
49
49
|
private initialized;
|
|
50
50
|
private id;
|
|
51
51
|
constructor(config: Omit<ArtifactComponentInsert, 'tenantId' | 'projectId'>);
|
|
52
|
-
setContext(tenantId: string, projectId: string): void;
|
|
52
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
53
53
|
getId(): string;
|
|
54
54
|
getName(): string;
|
|
55
55
|
getDescription(): string;
|
|
@@ -131,7 +131,7 @@ interface DataComponentInterface {
|
|
|
131
131
|
getName(): DataComponentInsert['name'];
|
|
132
132
|
getDescription(): DataComponentInsert['description'];
|
|
133
133
|
getProps(): DataComponentInsert['props'];
|
|
134
|
-
setContext(tenantId: string, projectId: string): void;
|
|
134
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
135
135
|
}
|
|
136
136
|
declare class DataComponent implements DataComponentInterface {
|
|
137
137
|
config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>;
|
|
@@ -141,7 +141,7 @@ declare class DataComponent implements DataComponentInterface {
|
|
|
141
141
|
private initialized;
|
|
142
142
|
private id;
|
|
143
143
|
constructor(config: Omit<DataComponentInsert, 'tenantId' | 'projectId'>);
|
|
144
|
-
setContext(tenantId: string, projectId: string): void;
|
|
144
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
145
145
|
getId(): string;
|
|
146
146
|
getName(): string;
|
|
147
147
|
getDescription(): string;
|
|
@@ -170,7 +170,7 @@ declare class ExternalAgent implements ExternalAgentInterface {
|
|
|
170
170
|
* Initialize the external agent by upserting it in the database
|
|
171
171
|
*/
|
|
172
172
|
init(): Promise<void>;
|
|
173
|
-
setContext(tenantId: string): void;
|
|
173
|
+
setContext(tenantId: string, baseURL?: string): void;
|
|
174
174
|
getId(): string;
|
|
175
175
|
private upsertExternalAgent;
|
|
176
176
|
/**
|
|
@@ -414,7 +414,7 @@ interface AgentInterface {
|
|
|
414
414
|
getDelegates(): AllAgentInterface[];
|
|
415
415
|
getDataComponents(): DataComponentApiInsert[];
|
|
416
416
|
getArtifactComponents(): ArtifactComponentApiInsert[];
|
|
417
|
-
setContext(tenantId: string, projectId: string): void;
|
|
417
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
418
418
|
addTool(name: string, tool: any): void;
|
|
419
419
|
addTransfer(...agents: AgentInterface[]): void;
|
|
420
420
|
addDelegate(...agents: AgentInterface[]): void;
|
|
@@ -429,7 +429,7 @@ interface ExternalAgentInterface {
|
|
|
429
429
|
getBaseUrl(): string;
|
|
430
430
|
getCredentialReferenceId(): string | undefined;
|
|
431
431
|
getHeaders(): Record<string, string> | undefined;
|
|
432
|
-
setContext?(tenantId: string): void;
|
|
432
|
+
setContext?(tenantId: string, baseURL?: string): void;
|
|
433
433
|
}
|
|
434
434
|
interface GraphInterface {
|
|
435
435
|
init(): Promise<void>;
|
|
@@ -479,7 +479,7 @@ declare class Agent implements AgentInterface {
|
|
|
479
479
|
private projectId;
|
|
480
480
|
private initialized;
|
|
481
481
|
constructor(config: AgentConfig);
|
|
482
|
-
setContext(tenantId: string, projectId: string): void;
|
|
482
|
+
setContext(tenantId: string, projectId: string, baseURL?: string): void;
|
|
483
483
|
getId(): string;
|
|
484
484
|
getName(): string;
|
|
485
485
|
getInstructions(): string;
|
package/dist/index.js
CHANGED
|
@@ -36,10 +36,13 @@ var ArtifactComponent = class {
|
|
|
36
36
|
"ArtifactComponent constructor initialized"
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
|
-
// Set context (tenantId and
|
|
40
|
-
setContext(tenantId, projectId) {
|
|
39
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
40
|
+
setContext(tenantId, projectId, baseURL) {
|
|
41
41
|
this.tenantId = tenantId;
|
|
42
42
|
this.projectId = projectId;
|
|
43
|
+
if (baseURL) {
|
|
44
|
+
this.baseURL = baseURL;
|
|
45
|
+
}
|
|
43
46
|
}
|
|
44
47
|
// Compute ID from name using same slug transformation as agents
|
|
45
48
|
getId() {
|
|
@@ -178,10 +181,13 @@ var DataComponent = class {
|
|
|
178
181
|
"DataComponent constructor initialized"
|
|
179
182
|
);
|
|
180
183
|
}
|
|
181
|
-
// Set context (tenantId and
|
|
182
|
-
setContext(tenantId, projectId) {
|
|
184
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
185
|
+
setContext(tenantId, projectId, baseURL) {
|
|
183
186
|
this.tenantId = tenantId;
|
|
184
187
|
this.projectId = projectId;
|
|
188
|
+
if (baseURL) {
|
|
189
|
+
this.baseURL = baseURL;
|
|
190
|
+
}
|
|
185
191
|
}
|
|
186
192
|
// Compute ID from name using same slug transformation as agents
|
|
187
193
|
getId() {
|
|
@@ -311,10 +317,13 @@ var Tool = class {
|
|
|
311
317
|
"Tool constructor initialized"
|
|
312
318
|
);
|
|
313
319
|
}
|
|
314
|
-
// Set context (tenantId and
|
|
315
|
-
setContext(tenantId, projectId) {
|
|
320
|
+
// Set context (tenantId, projectId, and baseURL) from external source (agent, graph, CLI, etc)
|
|
321
|
+
setContext(tenantId, projectId, baseURL) {
|
|
316
322
|
this.tenantId = tenantId;
|
|
317
323
|
this.projectId = projectId;
|
|
324
|
+
if (baseURL) {
|
|
325
|
+
this.baseURL = baseURL;
|
|
326
|
+
}
|
|
318
327
|
}
|
|
319
328
|
// Compute ID from name using same slug transformation as agents
|
|
320
329
|
getId() {
|
|
@@ -492,10 +501,13 @@ var Agent = class {
|
|
|
492
501
|
"Agent constructor initialized"
|
|
493
502
|
);
|
|
494
503
|
}
|
|
495
|
-
// Set context (tenantId and
|
|
496
|
-
setContext(tenantId, projectId) {
|
|
504
|
+
// Set context (tenantId, projectId, and baseURL) from external source (graph, CLI, etc)
|
|
505
|
+
setContext(tenantId, projectId, baseURL) {
|
|
497
506
|
this.tenantId = tenantId;
|
|
498
507
|
this.projectId = projectId;
|
|
508
|
+
if (baseURL) {
|
|
509
|
+
this.baseURL = baseURL;
|
|
510
|
+
}
|
|
499
511
|
}
|
|
500
512
|
// Return the configured ID
|
|
501
513
|
getId() {
|
|
@@ -1206,20 +1218,25 @@ var AgentGraph = class {
|
|
|
1206
1218
|
if (this.isInternalAgent(agent2)) {
|
|
1207
1219
|
const internalAgent = agent2;
|
|
1208
1220
|
if (internalAgent.setContext) {
|
|
1209
|
-
internalAgent.setContext(tenantId, projectId);
|
|
1221
|
+
internalAgent.setContext(tenantId, projectId, apiUrl);
|
|
1210
1222
|
}
|
|
1211
1223
|
const tools = internalAgent.getTools();
|
|
1212
1224
|
for (const [_, toolInstance] of Object.entries(tools)) {
|
|
1213
1225
|
if (toolInstance && typeof toolInstance === "object") {
|
|
1214
1226
|
if ("setContext" in toolInstance && typeof toolInstance.setContext === "function") {
|
|
1215
|
-
toolInstance.setContext(tenantId, projectId);
|
|
1227
|
+
toolInstance.setContext(tenantId, projectId, apiUrl);
|
|
1216
1228
|
}
|
|
1217
1229
|
}
|
|
1218
1230
|
}
|
|
1231
|
+
} else {
|
|
1232
|
+
const externalAgent2 = agent2;
|
|
1233
|
+
if (externalAgent2.setContext) {
|
|
1234
|
+
externalAgent2.setContext(tenantId, apiUrl);
|
|
1235
|
+
}
|
|
1219
1236
|
}
|
|
1220
1237
|
}
|
|
1221
1238
|
if (this.contextConfig?.setContext) {
|
|
1222
|
-
this.contextConfig.setContext(tenantId, projectId);
|
|
1239
|
+
this.contextConfig.setContext(tenantId, projectId, apiUrl);
|
|
1223
1240
|
}
|
|
1224
1241
|
logger6.info(
|
|
1225
1242
|
{
|
|
@@ -2619,58 +2636,6 @@ var Project = class {
|
|
|
2619
2636
|
"Initializing project using full project endpoint"
|
|
2620
2637
|
);
|
|
2621
2638
|
try {
|
|
2622
|
-
const projectMetadata = {
|
|
2623
|
-
id: this.projectId,
|
|
2624
|
-
name: this.projectName,
|
|
2625
|
-
description: this.projectDescription || "",
|
|
2626
|
-
models: this.models,
|
|
2627
|
-
stopWhen: this.stopWhen,
|
|
2628
|
-
graphs: {},
|
|
2629
|
-
// Empty graphs object for now
|
|
2630
|
-
tools: {},
|
|
2631
|
-
// Empty tools object
|
|
2632
|
-
credentialReferences: void 0,
|
|
2633
|
-
createdAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2634
|
-
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
2635
|
-
};
|
|
2636
|
-
logger8.info(
|
|
2637
|
-
{
|
|
2638
|
-
projectId: this.projectId,
|
|
2639
|
-
mode: "api-client",
|
|
2640
|
-
apiUrl: this.baseURL
|
|
2641
|
-
},
|
|
2642
|
-
"Creating project metadata first"
|
|
2643
|
-
);
|
|
2644
|
-
await updateFullProjectViaAPI(this.tenantId, this.baseURL, this.projectId, projectMetadata);
|
|
2645
|
-
logger8.info(
|
|
2646
|
-
{
|
|
2647
|
-
projectId: this.projectId
|
|
2648
|
-
},
|
|
2649
|
-
"Project metadata created successfully"
|
|
2650
|
-
);
|
|
2651
|
-
const initPromises = this.graphs.map(async (graph) => {
|
|
2652
|
-
try {
|
|
2653
|
-
await graph.init();
|
|
2654
|
-
logger8.debug(
|
|
2655
|
-
{
|
|
2656
|
-
projectId: this.projectId,
|
|
2657
|
-
graphId: graph.getId()
|
|
2658
|
-
},
|
|
2659
|
-
"Graph initialized in project"
|
|
2660
|
-
);
|
|
2661
|
-
} catch (error) {
|
|
2662
|
-
logger8.error(
|
|
2663
|
-
{
|
|
2664
|
-
projectId: this.projectId,
|
|
2665
|
-
graphId: graph.getId(),
|
|
2666
|
-
error: error instanceof Error ? error.message : "Unknown error"
|
|
2667
|
-
},
|
|
2668
|
-
"Failed to initialize graph in project"
|
|
2669
|
-
);
|
|
2670
|
-
throw error;
|
|
2671
|
-
}
|
|
2672
|
-
});
|
|
2673
|
-
await Promise.all(initPromises);
|
|
2674
2639
|
const projectDefinition = await this.toFullProjectDefinition();
|
|
2675
2640
|
logger8.info(
|
|
2676
2641
|
{
|
|
@@ -3241,9 +3206,12 @@ var ExternalAgent = class {
|
|
|
3241
3206
|
throw error;
|
|
3242
3207
|
}
|
|
3243
3208
|
}
|
|
3244
|
-
// Set context (tenantId) from external source (graph, CLI, etc)
|
|
3245
|
-
setContext(tenantId) {
|
|
3209
|
+
// Set context (tenantId and baseURL) from external source (graph, CLI, etc)
|
|
3210
|
+
setContext(tenantId, baseURL) {
|
|
3246
3211
|
this.tenantId = tenantId;
|
|
3212
|
+
if (baseURL) {
|
|
3213
|
+
this.baseURL = baseURL;
|
|
3214
|
+
}
|
|
3247
3215
|
}
|
|
3248
3216
|
// Compute ID from name using a simple slug transformation
|
|
3249
3217
|
getId() {
|
package/package.json
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"description": "Agents SDK for building and managing agents in the Inkeep Agent Framework",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"clean-package": "./clean-package.config.json",
|
|
8
8
|
"dependencies": {
|
|
9
9
|
"nanoid": "^5.1.5",
|
|
10
|
-
"zod": "^4.1.
|
|
11
|
-
"@inkeep/agents-core": "^0.
|
|
10
|
+
"zod": "^4.1.11",
|
|
11
|
+
"@inkeep/agents-core": "^0.12.1"
|
|
12
12
|
},
|
|
13
13
|
"devDependencies": {
|
|
14
14
|
"@types/node": "^20.11.24",
|