@friskai/frisk-js 0.2.3 → 0.2.4
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/adapters/claude/index.js +2 -1
- package/dist/adapters/claude/index.js.map +3 -3
- package/dist/adapters/langchain/frisk-tool-middleware.d.ts +3 -1
- package/dist/adapters/langchain/frisk-tool-middleware.d.ts.map +1 -1
- package/dist/adapters/langchain/index.js +15 -5
- package/dist/adapters/langchain/index.js.map +4 -4
- package/dist/core/tool-approval-request.d.ts +2 -1
- package/dist/core/tool-approval-request.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/dist/index.js.map +3 -3
- package/native/frisk-js.win32-arm64-msvc.node +0 -0
- package/native/frisk-js.win32-x64-msvc.node +0 -0
- package/native/index.cjs +52 -52
- package/package.json +1 -1
|
@@ -17,7 +17,8 @@ export interface FriskToolMiddlewareOptions {
|
|
|
17
17
|
};
|
|
18
18
|
logging?: FriskSDKLoggingOptions;
|
|
19
19
|
}
|
|
20
|
-
export declare const DENIED_TOOL_CALL_EXPLANATION = "This is not an error, this is a security measure by the purveyor of the agent. Do not retry this tool call with the same arguments. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have
|
|
20
|
+
export declare const DENIED_TOOL_CALL_EXPLANATION = "This is not an error, this is a security measure by the purveyor of the agent. Do not retry this tool call with the same arguments. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have been executed, unless otherwise stated.";
|
|
21
|
+
export declare const EXPIRED_TOOL_CALL_APPROVAL_EXPLANATION = "This is not an error, this is a security measure by the purveyor of the agent. Retrying this tool call will likely require a new request for external approval. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have been executed, unless otherwise stated.";
|
|
21
22
|
/**
|
|
22
23
|
* FriskToolMiddleware - Middleware for LangChain tool call interception
|
|
23
24
|
*
|
|
@@ -80,6 +81,7 @@ export declare class FriskToolMiddleware<TState extends {
|
|
|
80
81
|
private makeInterruptPayload;
|
|
81
82
|
private getToolCallResumeActionsByIdFromInterruptResponse;
|
|
82
83
|
private createEscalatedCanceledToolMessage;
|
|
84
|
+
private createEscalatedExpiredToolMessage;
|
|
83
85
|
private createEscalatedRejectedToolMessage;
|
|
84
86
|
private createDeniedToolCallMessage;
|
|
85
87
|
private createSyntheticToolCallMessage;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frisk-tool-middleware.d.ts","sourceRoot":"","sources":["../../../src/adapters/langchain/frisk-tool-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAa,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAmBxE,OAAO,EAAE,sBAAsB,EAAa,MAAM,eAAe,CAAA;AAGjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAMlD,OAAO,EAEL,qBAAqB,EAEtB,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;IACD,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED,eAAO,MAAM,4BAA4B,
|
|
1
|
+
{"version":3,"file":"frisk-tool-middleware.d.ts","sourceRoot":"","sources":["../../../src/adapters/langchain/frisk-tool-middleware.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EAAa,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAA;AAmBxE,OAAO,EAAE,sBAAsB,EAAa,MAAM,eAAe,CAAA;AAGjE,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAA;AAMlD,OAAO,EAEL,qBAAqB,EAEtB,MAAM,SAAS,CAAA;AAEhB;;GAEG;AACH,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,EAAE;QACT,YAAY,CAAC,EAAE,OAAO,CAAA;KACvB,CAAA;IACD,OAAO,CAAC,EAAE,sBAAsB,CAAA;CACjC;AAED,eAAO,MAAM,4BAA4B,kSAAkS,CAAA;AAE3U,eAAO,MAAM,sCAAsC,8TAA8T,CAAA;AAEjX;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,qBAAa,mBAAmB,CAC9B,MAAM,SAAS;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,GAAG;IAAE,QAAQ,EAAE,WAAW,EAAE,CAAA;CAAE,EACxE,QAAQ,SAAS,qBAAqB,GAAG,qBAAqB;IAG9D,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAW;IACzB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAAS;gBAEjC,KAAK,EAAE,cAAc,EAAE,OAAO,CAAC,EAAE,0BAA0B;IAQvE;;OAEG;IACH,IAAI,KAAK,IAAI,cAAc,CAE1B;IAEY,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,QAAQ,CAAC;;;;;;;IAmOjE;;OAEG;IACH,OAAO,CAAC,mBAAmB;IA2B3B,OAAO,CAAC,yCAAyC;IAYjD,OAAO,CAAC,oBAAoB;IA0B5B,OAAO,CAAC,iDAAiD;IAoEzD,OAAO,CAAC,kCAAkC;IAO1C,OAAO,CAAC,iCAAiC;IAOzC,OAAO,CAAC,kCAAkC;IAM1C,OAAO,CAAC,2BAA2B;IAQnC,OAAO,CAAC,8BAA8B;CAYvC"}
|
|
@@ -48422,6 +48422,7 @@ var ToolApprovalStatus;
|
|
|
48422
48422
|
ToolApprovalStatus2["APPROVED"] = "APPROVED";
|
|
48423
48423
|
ToolApprovalStatus2["REJECTED"] = "REJECTED";
|
|
48424
48424
|
ToolApprovalStatus2["CANCELED"] = "CANCELED";
|
|
48425
|
+
ToolApprovalStatus2["EXPIRED"] = "EXPIRED";
|
|
48425
48426
|
})(ToolApprovalStatus ||= {});
|
|
48426
48427
|
function getTimeoutSignal() {
|
|
48427
48428
|
if (typeof AbortSignal === "undefined") {
|
|
@@ -48867,7 +48868,8 @@ var interruptResponseSchema = {
|
|
|
48867
48868
|
};
|
|
48868
48869
|
|
|
48869
48870
|
// src/adapters/langchain/frisk-tool-middleware.ts
|
|
48870
|
-
var DENIED_TOOL_CALL_EXPLANATION = `This is not an error, this is a security measure by the purveyor of the agent. Do not retry this tool call with the same arguments. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have
|
|
48871
|
+
var DENIED_TOOL_CALL_EXPLANATION = `This is not an error, this is a security measure by the purveyor of the agent. Do not retry this tool call with the same arguments. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have been executed, unless otherwise stated.`;
|
|
48872
|
+
var EXPIRED_TOOL_CALL_APPROVAL_EXPLANATION = `This is not an error, this is a security measure by the purveyor of the agent. Retrying this tool call will likely require a new request for external approval. You may attempt to fulfill the underlying request using a different strategy. Other tool calls in this batch have been executed, unless otherwise stated.`;
|
|
48871
48873
|
|
|
48872
48874
|
class FriskToolMiddleware {
|
|
48873
48875
|
_frisk;
|
|
@@ -49007,6 +49009,10 @@ class FriskToolMiddleware {
|
|
|
49007
49009
|
acc.push(this.createEscalatedCanceledToolMessage(normalizedToolCall));
|
|
49008
49010
|
return acc;
|
|
49009
49011
|
}
|
|
49012
|
+
if (status === "EXPIRED" /* EXPIRED */) {
|
|
49013
|
+
acc.push(this.createEscalatedExpiredToolMessage(normalizedToolCall));
|
|
49014
|
+
return acc;
|
|
49015
|
+
}
|
|
49010
49016
|
if (status === "REJECTED" /* REJECTED */) {
|
|
49011
49017
|
acc.push(this.createEscalatedRejectedToolMessage(normalizedToolCall));
|
|
49012
49018
|
return acc;
|
|
@@ -49097,15 +49103,19 @@ class FriskToolMiddleware {
|
|
|
49097
49103
|
};
|
|
49098
49104
|
}
|
|
49099
49105
|
createEscalatedCanceledToolMessage(toolCall) {
|
|
49100
|
-
const content = `The caller canceled the request to ${toolCall.name} after it was escalated for approval. ${DENIED_TOOL_CALL_EXPLANATION}`;
|
|
49106
|
+
const content = `The caller canceled the request to ${toolCall.name} after it was escalated for external approval. ${DENIED_TOOL_CALL_EXPLANATION}`;
|
|
49107
|
+
return this.createSyntheticToolCallMessage(toolCall, content, "error");
|
|
49108
|
+
}
|
|
49109
|
+
createEscalatedExpiredToolMessage(toolCall) {
|
|
49110
|
+
const content = `This call to ${toolCall.name} was escalated for external approval, but the request expired before it could be approved. ${EXPIRED_TOOL_CALL_APPROVAL_EXPLANATION}`;
|
|
49101
49111
|
return this.createSyntheticToolCallMessage(toolCall, content, "error");
|
|
49102
49112
|
}
|
|
49103
49113
|
createEscalatedRejectedToolMessage(toolCall) {
|
|
49104
|
-
const content = `
|
|
49114
|
+
const content = `This call to ${toolCall.name} was denied after it was escalated for approval. ${DENIED_TOOL_CALL_EXPLANATION}`;
|
|
49105
49115
|
return this.createSyntheticToolCallMessage(toolCall, content, "error");
|
|
49106
49116
|
}
|
|
49107
49117
|
createDeniedToolCallMessage(toolCall, decision) {
|
|
49108
|
-
const content = `
|
|
49118
|
+
const content = `This call to ${toolCall.name} was denied. Reason: ${decision.reason}. ${DENIED_TOOL_CALL_EXPLANATION}`;
|
|
49109
49119
|
return this.createSyntheticToolCallMessage(toolCall, content, "error");
|
|
49110
49120
|
}
|
|
49111
49121
|
createSyntheticToolCallMessage(toolCall, content, status) {
|
|
@@ -49319,5 +49329,5 @@ export {
|
|
|
49319
49329
|
FRISK_SESSION_ID_KEY
|
|
49320
49330
|
};
|
|
49321
49331
|
|
|
49322
|
-
//# debugId=
|
|
49332
|
+
//# debugId=FD48160742D022E864756E2164756E21
|
|
49323
49333
|
//# sourceMappingURL=index.js.map
|