@inkeep/agents-api 0.0.0-dev-20260209202045 → 0.0.0-dev-20260209225959
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/.well-known/workflow/v1/flow.cjs +44 -44
- package/dist/.well-known/workflow/v1/flow.cjs.debug.json +2 -2
- package/dist/.well-known/workflow/v1/manifest.debug.json +16 -16
- package/dist/.well-known/workflow/v1/step.cjs +130 -130
- package/dist/.well-known/workflow/v1/step.cjs.debug.json +2 -2
- package/dist/createApp.d.ts +2 -2
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/mcp.d.ts +2 -2
- package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/users.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/Agent.js +18 -14
- package/dist/domains/run/services/PendingToolApprovalManager.js +1 -1
- package/dist/domains/run/services/ToolApprovalUiBus.d.ts +1 -0
- package/dist/domains/run/services/ToolApprovalUiBus.js +2 -1
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/domains/run/utils/tool-result.d.ts +11 -0
- package/dist/domains/run/utils/tool-result.js +15 -0
- package/dist/factory.d.ts +267 -267
- package/dist/index.d.ts +266 -266
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +5 -5
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types12 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/invitations.d.ts
|
|
6
6
|
declare const invitationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types12.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types5 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types7 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/passwordResetLinks.d.ts
|
|
6
6
|
declare const passwordResetLinksRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types7.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { passwordResetLinksRoutes as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types11 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/users.d.ts
|
|
6
6
|
declare const usersRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types11.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { usersRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types9 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/mcp/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types9.BlankEnv, hono_types9.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -21,6 +21,7 @@ import { generateToolId } from "../utils/agent-operations.js";
|
|
|
21
21
|
import { ArtifactCreateSchema, ArtifactReferenceSchema } from "../utils/artifact-component-schema.js";
|
|
22
22
|
import { withJsonPostProcessing } from "../utils/json-postprocessor.js";
|
|
23
23
|
import { calculateBreakdownTotal, estimateTokens } from "../utils/token-estimator.js";
|
|
24
|
+
import { createDeniedToolResult, isToolResultDenied } from "../utils/tool-result.js";
|
|
24
25
|
import { createDelegateToAgentTool, createTransferToAgentTool } from "./relationTools.js";
|
|
25
26
|
import { SystemPromptBuilder } from "./SystemPromptBuilder.js";
|
|
26
27
|
import { PromptConfig, V1_BREAKDOWN_SCHEMA } from "./versions/v1/PromptConfig.js";
|
|
@@ -354,7 +355,7 @@ var Agent = class {
|
|
|
354
355
|
needsApproval,
|
|
355
356
|
inDelegatedAgent: this.isDelegatedAgent
|
|
356
357
|
});
|
|
357
|
-
const isDeniedResult =
|
|
358
|
+
const isDeniedResult = isToolResultDenied(result);
|
|
358
359
|
if (streamRequestId && streamHelper && !isInternalToolForUi) if (isDeniedResult) await streamHelper.writeToolOutputDenied({ toolCallId });
|
|
359
360
|
else await streamHelper.writeToolOutputAvailable({
|
|
360
361
|
toolCallId,
|
|
@@ -508,14 +509,16 @@ var Agent = class {
|
|
|
508
509
|
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
509
510
|
type: "approval-resolved",
|
|
510
511
|
toolCallId,
|
|
511
|
-
approved: false
|
|
512
|
+
approved: false,
|
|
513
|
+
reason: approvalResult.reason
|
|
512
514
|
});
|
|
513
515
|
}
|
|
514
516
|
return tracer.startActiveSpan("tool.approval_denied", { attributes: {
|
|
515
517
|
"tool.name": toolName,
|
|
516
518
|
"tool.callId": toolCallId,
|
|
517
519
|
"subAgent.id": this.config.id,
|
|
518
|
-
"subAgent.name": this.config.name
|
|
520
|
+
"subAgent.name": this.config.name,
|
|
521
|
+
"tool.approval.reason": approvalResult.reason
|
|
519
522
|
} }, (denialSpan) => {
|
|
520
523
|
logger.info({
|
|
521
524
|
toolName,
|
|
@@ -524,11 +527,7 @@ var Agent = class {
|
|
|
524
527
|
}, "Tool execution denied by user");
|
|
525
528
|
denialSpan.setStatus({ code: SpanStatusCode.OK });
|
|
526
529
|
denialSpan.end();
|
|
527
|
-
return
|
|
528
|
-
__inkeepToolDenied: true,
|
|
529
|
-
toolCallId,
|
|
530
|
-
reason: approvalResult.reason
|
|
531
|
-
};
|
|
530
|
+
return createDeniedToolResult(toolCallId, approvalResult.reason);
|
|
532
531
|
});
|
|
533
532
|
}
|
|
534
533
|
tracer.startActiveSpan("tool.approval_approved", { attributes: {
|
|
@@ -926,7 +925,8 @@ var Agent = class {
|
|
|
926
925
|
if (streamRequestId$1) await toolApprovalUiBus.publish(streamRequestId$1, {
|
|
927
926
|
type: "approval-resolved",
|
|
928
927
|
toolCallId,
|
|
929
|
-
approved: false
|
|
928
|
+
approved: false,
|
|
929
|
+
reason: approvalResult.reason
|
|
930
930
|
});
|
|
931
931
|
}
|
|
932
932
|
return tracer.startActiveSpan("tool.approval_denied", { attributes: {
|
|
@@ -942,11 +942,7 @@ var Agent = class {
|
|
|
942
942
|
}, "Function tool execution denied by user");
|
|
943
943
|
denialSpan.setStatus({ code: SpanStatusCode.OK });
|
|
944
944
|
denialSpan.end();
|
|
945
|
-
return
|
|
946
|
-
__inkeepToolDenied: true,
|
|
947
|
-
toolCallId,
|
|
948
|
-
reason: approvalResult.reason
|
|
949
|
-
};
|
|
945
|
+
return createDeniedToolResult(toolCallId, approvalResult.reason);
|
|
950
946
|
});
|
|
951
947
|
}
|
|
952
948
|
tracer.startActiveSpan("tool.approval_approved", { attributes: {
|
|
@@ -1445,6 +1441,14 @@ var Agent = class {
|
|
|
1445
1441
|
*/
|
|
1446
1442
|
formatToolResult(toolName, args, result, toolCallId) {
|
|
1447
1443
|
const input = args ? JSON.stringify(args, null, 2) : "No input";
|
|
1444
|
+
if (isToolResultDenied(result)) return [
|
|
1445
|
+
`## Tool: ${toolName}`,
|
|
1446
|
+
"",
|
|
1447
|
+
`### 🔧 TOOL_CALL_ID: ${toolCallId}`,
|
|
1448
|
+
"",
|
|
1449
|
+
`### Output`,
|
|
1450
|
+
result.reason
|
|
1451
|
+
].join("\n");
|
|
1448
1452
|
let parsedResult = result;
|
|
1449
1453
|
if (typeof result === "string") try {
|
|
1450
1454
|
parsedResult = JSON.parse(result);
|
|
@@ -89,7 +89,7 @@ var PendingToolApprovalManager = class PendingToolApprovalManager {
|
|
|
89
89
|
this.pendingApprovals.delete(toolCallId);
|
|
90
90
|
approval.resolve({
|
|
91
91
|
approved: false,
|
|
92
|
-
reason: reason
|
|
92
|
+
reason: `The user declined to run this tool. ${reason ? `Reason: ${reason}` : ""}`
|
|
93
93
|
});
|
|
94
94
|
return true;
|
|
95
95
|
}
|
|
@@ -33,7 +33,8 @@ var ToolApprovalUiBus = class {
|
|
|
33
33
|
streamRequestId,
|
|
34
34
|
eventType: event.type,
|
|
35
35
|
toolCallId: event.toolCallId,
|
|
36
|
-
error: error instanceof Error ? error.message : String(error)
|
|
36
|
+
error: error instanceof Error ? error.message : String(error),
|
|
37
|
+
reason: event.reason
|
|
37
38
|
}, "ToolApprovalUiBus listener failed");
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core1 from "@inkeep/agents-core";
|
|
2
2
|
import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/utils/token-estimator.d.ts
|
|
@@ -17,7 +17,7 @@ interface AssembleResult {
|
|
|
17
17
|
/** The assembled prompt string */
|
|
18
18
|
prompt: string;
|
|
19
19
|
/** Token breakdown for each component */
|
|
20
|
-
breakdown:
|
|
20
|
+
breakdown: _inkeep_agents_core1.ContextBreakdown;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
//#region src/domains/run/utils/tool-result.d.ts
|
|
2
|
+
declare const INKEEP_TOOL_DENIED_KEY = "__inkeepToolDenied";
|
|
3
|
+
interface DeniedToolResult {
|
|
4
|
+
[INKEEP_TOOL_DENIED_KEY]: true;
|
|
5
|
+
toolCallId: string;
|
|
6
|
+
reason?: string;
|
|
7
|
+
}
|
|
8
|
+
declare function isToolResultDenied(result: unknown): result is DeniedToolResult;
|
|
9
|
+
declare function createDeniedToolResult(toolCallId: string, reason?: string): DeniedToolResult;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { DeniedToolResult, INKEEP_TOOL_DENIED_KEY, createDeniedToolResult, isToolResultDenied };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
//#region src/domains/run/utils/tool-result.ts
|
|
2
|
+
const INKEEP_TOOL_DENIED_KEY = "__inkeepToolDenied";
|
|
3
|
+
function isToolResultDenied(result) {
|
|
4
|
+
return !!result && typeof result === "object" && INKEEP_TOOL_DENIED_KEY in result && result[INKEEP_TOOL_DENIED_KEY] === true;
|
|
5
|
+
}
|
|
6
|
+
function createDeniedToolResult(toolCallId, reason) {
|
|
7
|
+
return {
|
|
8
|
+
[INKEEP_TOOL_DENIED_KEY]: true,
|
|
9
|
+
toolCallId,
|
|
10
|
+
reason
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
//#endregion
|
|
15
|
+
export { INKEEP_TOOL_DENIED_KEY, createDeniedToolResult, isToolResultDenied };
|