@evalops/maestro 0.10.29 → 0.10.31
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/compaction/cut-points.d.ts +157 -0
- package/dist/agent/compaction/cut-points.d.ts.map +1 -0
- package/dist/agent/compaction/cut-points.js +341 -0
- package/dist/agent/compaction/cut-points.js.map +1 -0
- package/dist/agent/compaction.d.ts +4 -144
- package/dist/agent/compaction.d.ts.map +1 -1
- package/dist/agent/compaction.js +5 -340
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/transport/events.d.ts +23 -0
- package/dist/agent/transport/events.d.ts.map +1 -0
- package/dist/agent/transport/events.js +69 -0
- package/dist/agent/transport/events.js.map +1 -0
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +1 -68
- package/dist/agent/transport.js.map +1 -1
- package/dist/cli.js +247 -203
- package/dist/node_modules/@evalops/contracts/package.json +1 -1
- package/dist/node_modules/@evalops/tui/package.json +1 -1
- package/dist/server/agent-runtime-ledger.d.ts +18 -3
- package/dist/server/agent-runtime-ledger.d.ts.map +1 -1
- package/dist/server/agent-runtime-ledger.js +45 -1
- package/dist/server/agent-runtime-ledger.js.map +1 -1
- package/dist/tools/parallel-ripgrep.d.ts.map +1 -1
- package/dist/tools/parallel-ripgrep.js +1 -10
- package/dist/tools/parallel-ripgrep.js.map +1 -1
- package/dist/tools/ripgrep-utils.d.ts +1 -0
- package/dist/tools/ripgrep-utils.d.ts.map +1 -1
- package/dist/tools/ripgrep-utils.js +9 -0
- package/dist/tools/ripgrep-utils.js.map +1 -1
- package/dist/tools/search.d.ts.map +1 -1
- package/dist/tools/search.js +4 -4
- package/dist/tools/search.js.map +1 -1
- package/dist/version.json +2 -2
- package/package.json +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type SkillArtifactMetadata } from "../../skills/artifact-metadata.js";
|
|
2
|
+
import type { AgentEvent } from "../types.js";
|
|
3
|
+
type GovernedToolOutcome = "approval_required" | "approval_pending" | "authentication_required" | "denied" | "rate_limited";
|
|
4
|
+
export declare class AgentEventQueue {
|
|
5
|
+
private events;
|
|
6
|
+
private pending?;
|
|
7
|
+
private wake?;
|
|
8
|
+
push(event: AgentEvent): void;
|
|
9
|
+
shift(): AgentEvent | undefined;
|
|
10
|
+
wait(): Promise<void>;
|
|
11
|
+
clearPendingWaiter(): void;
|
|
12
|
+
}
|
|
13
|
+
export declare function isDynamicToolApprovalEvent(event: AgentEvent): boolean;
|
|
14
|
+
export declare function getGovernedToolResultEventMetadata(details: unknown): {
|
|
15
|
+
errorCode?: string;
|
|
16
|
+
approvalRequestId?: string;
|
|
17
|
+
governedOutcome?: GovernedToolOutcome;
|
|
18
|
+
};
|
|
19
|
+
export declare function getSkillToolResultEventMetadata(details: unknown): {
|
|
20
|
+
skillMetadata?: SkillArtifactMetadata;
|
|
21
|
+
};
|
|
22
|
+
export {};
|
|
23
|
+
//# sourceMappingURL=events.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../../src/agent/transport/events.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,qBAAqB,EAE1B,MAAM,mCAAmC,CAAC;AAC3C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,KAAK,mBAAmB,GACrB,mBAAmB,GACnB,kBAAkB,GAClB,yBAAyB,GACzB,QAAQ,GACR,cAAc,CAAC;AAElB,qBAAa,eAAe;IAC3B,OAAO,CAAC,MAAM,CAAoB;IAClC,OAAO,CAAC,OAAO,CAAC,CAAgB;IAChC,OAAO,CAAC,IAAI,CAAC,CAAa;IAE1B,IAAI,CAAC,KAAK,EAAE,UAAU,GAAG,IAAI;IAU7B,KAAK,IAAI,UAAU,GAAG,SAAS;IAI/B,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC;IAYrB,kBAAkB,IAAI,IAAI;CAI1B;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAKrE;AAED,wBAAgB,kCAAkC,CAAC,OAAO,EAAE,OAAO,GAAG;IACrE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,mBAAmB,CAAC;CACtC,CA+BA;AAED,wBAAgB,+BAA+B,CAAC,OAAO,EAAE,OAAO,GAAG;IAClE,aAAa,CAAC,EAAE,qBAAqB,CAAC;CACtC,CAIA"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getSkillArtifactMetadataFromDetails, } from "../../skills/artifact-metadata.js";
|
|
2
|
+
export class AgentEventQueue {
|
|
3
|
+
constructor() {
|
|
4
|
+
this.events = [];
|
|
5
|
+
}
|
|
6
|
+
push(event) {
|
|
7
|
+
this.events.push(event);
|
|
8
|
+
if (this.wake) {
|
|
9
|
+
const wake = this.wake;
|
|
10
|
+
this.pending = undefined;
|
|
11
|
+
this.wake = undefined;
|
|
12
|
+
wake();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
shift() {
|
|
16
|
+
return this.events.shift();
|
|
17
|
+
}
|
|
18
|
+
wait() {
|
|
19
|
+
if (this.events.length > 0) {
|
|
20
|
+
return Promise.resolve();
|
|
21
|
+
}
|
|
22
|
+
if (!this.pending) {
|
|
23
|
+
this.pending = new Promise((resolve) => {
|
|
24
|
+
this.wake = resolve;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
return this.pending;
|
|
28
|
+
}
|
|
29
|
+
clearPendingWaiter() {
|
|
30
|
+
this.pending = undefined;
|
|
31
|
+
this.wake = undefined;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export function isDynamicToolApprovalEvent(event) {
|
|
35
|
+
return (event.type === "action_approval_required" ||
|
|
36
|
+
event.type === "action_approval_resolved");
|
|
37
|
+
}
|
|
38
|
+
export function getGovernedToolResultEventMetadata(details) {
|
|
39
|
+
if (!details || typeof details !== "object") {
|
|
40
|
+
return {};
|
|
41
|
+
}
|
|
42
|
+
const governedOutcome = details
|
|
43
|
+
.governedOutcome;
|
|
44
|
+
if (!governedOutcome || typeof governedOutcome !== "object") {
|
|
45
|
+
return {};
|
|
46
|
+
}
|
|
47
|
+
const normalized = governedOutcome;
|
|
48
|
+
const classification = typeof normalized.classification === "string"
|
|
49
|
+
? normalized.classification
|
|
50
|
+
: undefined;
|
|
51
|
+
const errorCode = typeof normalized.code === "string" && normalized.code.trim().length > 0
|
|
52
|
+
? normalized.code.trim()
|
|
53
|
+
: classification;
|
|
54
|
+
const approvalRequestId = typeof normalized.approvalRequestId === "string" &&
|
|
55
|
+
normalized.approvalRequestId.trim().length > 0
|
|
56
|
+
? normalized.approvalRequestId.trim()
|
|
57
|
+
: undefined;
|
|
58
|
+
return {
|
|
59
|
+
errorCode,
|
|
60
|
+
approvalRequestId,
|
|
61
|
+
governedOutcome: classification,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
export function getSkillToolResultEventMetadata(details) {
|
|
65
|
+
return {
|
|
66
|
+
skillMetadata: getSkillArtifactMetadataFromDetails(details),
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=events.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../../../src/agent/transport/events.ts"],"names":[],"mappings":"AAAA,OAAO,EAEN,mCAAmC,GACnC,MAAM,mCAAmC,CAAC;AAU3C,MAAM,OAAO,eAAe;IAA5B;QACS,WAAM,GAAiB,EAAE,CAAC;IAkCnC,CAAC;IA9BA,IAAI,CAAC,KAAiB;QACrB,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;QACxB,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;YACf,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;YACvB,IAAI,CAAC,OAAO,GAAG,SAAS,CAAC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AC,cAAsC;QACpD,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,SAAS,GACd,OAAO,UAAU,CAAC,IAAI,KAAK,QAAQ,IAAI,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QACvE,CAAC,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE;QACxB,CAAC,CAAC,cAAc,CAAC;IACnB,MAAM,iBAAiB,GACtB,OAAO,UAAU,CAAC,iBAAiB,KAAK,QAAQ;QAChD,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE,CAAC,MAAM,GAAG,CAAC;QAC7C,CAAC,CAAC,UAAU,CAAC,iBAAiB,CAAC,IAAI,EAAE;QACrC,CAAC,CAAC,SAAS,CAAC;IAEd,OAAO;QACN,SAAS;QACT,iBAAiB;QACjB,eAAe,EAAE,cAAc;KAC/B,CAAC;AACH,CAAC;AAED,MAAM,UAAU,+BAA+B,CAAC,OAAgB;IAG/D,OAAO;QACN,aAAa,EAAE,mCAAmC,CAAC,OAAO,CAAC;KAC3D,CAAC;AACH,CAAC","sourcesContent":["import {\n\ttype SkillArtifactMetadata,\n\tgetSkillArtifactMetadataFromDetails,\n} from \"../../skills/artifact-metadata.js\";\nimport type { AgentEvent } from \"../types.js\";\n\ntype GovernedToolOutcome =\n\t| \"approval_required\"\n\t| \"approval_pending\"\n\t| \"authentication_required\"\n\t| \"denied\"\n\t| \"rate_limited\";\n\nexport class AgentEventQueue {\n\tprivate events: AgentEvent[] = [];\n\tprivate pending?: Promise<void>;\n\tprivate wake?: () => void;\n\n\tpush(event: AgentEvent): void {\n\t\tthis.events.push(event);\n\t\tif (this.wake) {\n\t\t\tconst wake = this.wake;\n\t\t\tthis.pending = undefined;\n\t\t\tthis.wake = undefined;\n\t\t\twake();\n\t\t}\n\t}\n\n\tshift(): AgentEvent | undefined {\n\t\treturn this.events.shift();\n\t}\n\n\twait(): Promise<void> {\n\t\tif (this.events.length > 0) {\n\t\t\treturn Promise.resolve();\n\t\t}\n\t\tif (!this.pending) {\n\t\t\tthis.pending = new Promise<void>((resolve) => {\n\t\t\t\tthis.wake = resolve;\n\t\t\t});\n\t\t}\n\t\treturn this.pending;\n\t}\n\n\tclearPendingWaiter(): void {\n\t\tthis.pending = undefined;\n\t\tthis.wake = undefined;\n\t}\n}\n\nexport function isDynamicToolApprovalEvent(event: AgentEvent): boolean {\n\treturn (\n\t\tevent.type === \"action_approval_required\" ||\n\t\tevent.type === \"action_approval_resolved\"\n\t);\n}\n\nexport function getGovernedToolResultEventMetadata(details: unknown): {\n\terrorCode?: string;\n\tapprovalRequestId?: string;\n\tgovernedOutcome?: GovernedToolOutcome;\n} {\n\tif (!details || typeof details !== \"object\") {\n\t\treturn {};\n\t}\n\n\tconst governedOutcome = (details as { governedOutcome?: unknown })\n\t\t.governedOutcome;\n\tif (!governedOutcome || typeof governedOutcome !== \"object\") {\n\t\treturn {};\n\t}\n\n\tconst normalized = governedOutcome as Record<string, unknown>;\n\tconst classification =\n\t\ttypeof normalized.classification === \"string\"\n\t\t\t? (normalized.classification as GovernedToolOutcome)\n\t\t\t: undefined;\n\tconst errorCode =\n\t\ttypeof normalized.code === \"string\" && normalized.code.trim().length > 0\n\t\t\t? normalized.code.trim()\n\t\t\t: classification;\n\tconst approvalRequestId =\n\t\ttypeof normalized.approvalRequestId === \"string\" &&\n\t\tnormalized.approvalRequestId.trim().length > 0\n\t\t\t? normalized.approvalRequestId.trim()\n\t\t\t: undefined;\n\n\treturn {\n\t\terrorCode,\n\t\tapprovalRequestId,\n\t\tgovernedOutcome: classification,\n\t};\n}\n\nexport function getSkillToolResultEventMetadata(details: unknown): {\n\tskillMetadata?: SkillArtifactMetadata;\n} {\n\treturn {\n\t\tskillMetadata: getSkillArtifactMetadataFromDetails(details),\n\t};\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transport.d.ts","sourceRoot":"","sources":["../../src/agent/transport.ts"],"names":[],"mappings":"AAAA;;;;;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|
57
57
|
import { createSafetyMiddleware, } from "../safety/safety-middleware.js";
|
|
58
58
|
import { SemanticJudge } from "../safety/semantic-judge.js";
|
|
59
59
|
import { WorkflowStateError, WorkflowStateTracker, applyWorkflowStateHooks, isWorkflowTrackedTool, } from "../safety/workflow-state.js";
|
|
60
|
-
import { getSkillArtifactMetadataFromDetails, } from "../skills/artifact-metadata.js";
|
|
61
60
|
import { getPathScopedMutation, isParallelSafeTool, isReadOnlyTool, pathScopesOverlap, } from "../tools/parallel-execution.js";
|
|
62
61
|
import { trackUsage } from "../tracking/cost-tracker.js";
|
|
63
62
|
import { getTrainingHeaders } from "../training.js";
|
|
64
63
|
import { getStoredCredentials } from "./keys.js";
|
|
65
64
|
import { createProviderStream } from "./transport/create-provider-stream.js";
|
|
65
|
+
import { AgentEventQueue, getGovernedToolResultEventMetadata, getSkillToolResultEventMetadata, isDynamicToolApprovalEvent, } from "./transport/events.js";
|
|
66
66
|
import { clearReusableToolResultState, clearRunScopedReusableToolResultState, cloneToolOutcomeForCall, computeReusableToolResultSnapshot, createToolMetadataCache, decrementPendingReusableToolSafetyCheck, getReusableToolRegistrySignature, getReusableToolResultCacheKey, hasPendingMutatingToolExecution, hasReusableToolResultState, incrementPendingReusableToolSafetyCheck, invalidateReusableToolResultsAfterMutation, recordReusableToolExecutionBridgeOutput, resolvePlatformToolExecutionBridge, trackReusableToolResult, } from "./transport/reusable-tool-results.js";
|
|
67
67
|
import { createToolExecutionPromise } from "./transport/tool-execution.js";
|
|
68
68
|
import { evaluateToolSafety, } from "./transport/tool-safety-pipeline.js";
|
|
69
69
|
import { createToolUpdateQueue, waitForNextExecutionOrUpdate, } from "./transport/tool-update-queue.js";
|
|
70
70
|
import { calculateCost, resolveEnvCredential, } from "./transport/transport-utils.js";
|
|
71
|
-
class AgentEventQueue {
|
|
72
|
-
constructor() {
|
|
73
|
-
this.events = [];
|
|
74
|
-
}
|
|
75
|
-
push(event) {
|
|
76
|
-
this.events.push(event);
|
|
77
|
-
if (this.wake) {
|
|
78
|
-
const wake = this.wake;
|
|
79
|
-
this.pending = undefined;
|
|
80
|
-
this.wake = undefined;
|
|
81
|
-
wake();
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
shift() {
|
|
85
|
-
return this.events.shift();
|
|
86
|
-
}
|
|
87
|
-
wait() {
|
|
88
|
-
if (this.events.length > 0) {
|
|
89
|
-
return Promise.resolve();
|
|
90
|
-
}
|
|
91
|
-
if (!this.pending) {
|
|
92
|
-
this.pending = new Promise((resolve) => {
|
|
93
|
-
this.wake = resolve;
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return this.pending;
|
|
97
|
-
}
|
|
98
|
-
clearPendingWaiter() {
|
|
99
|
-
this.pending = undefined;
|
|
100
|
-
this.wake = undefined;
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
function isDynamicToolApprovalEvent(event) {
|
|
104
|
-
return (event.type === "action_approval_required" ||
|
|
105
|
-
event.type === "action_approval_resolved");
|
|
106
|
-
}
|
|
107
|
-
function getGovernedToolResultEventMetadata(details) {
|
|
108
|
-
if (!details || typeof details !== "object") {
|
|
109
|
-
return {};
|
|
110
|
-
}
|
|
111
|
-
const governedOutcome = details
|
|
112
|
-
.governedOutcome;
|
|
113
|
-
if (!governedOutcome || typeof governedOutcome !== "object") {
|
|
114
|
-
return {};
|
|
115
|
-
}
|
|
116
|
-
const normalized = governedOutcome;
|
|
117
|
-
const classification = typeof normalized.classification === "string"
|
|
118
|
-
? normalized.classification
|
|
119
|
-
: undefined;
|
|
120
|
-
const errorCode = typeof normalized.code === "string" && normalized.code.trim().length > 0
|
|
121
|
-
? normalized.code.trim()
|
|
122
|
-
: classification;
|
|
123
|
-
const approvalRequestId = typeof normalized.approvalRequestId === "string" &&
|
|
124
|
-
normalized.approvalRequestId.trim().length > 0
|
|
125
|
-
? normalized.approvalRequestId.trim()
|
|
126
|
-
: undefined;
|
|
127
|
-
return {
|
|
128
|
-
errorCode,
|
|
129
|
-
approvalRequestId,
|
|
130
|
-
governedOutcome: classification,
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
function getSkillToolResultEventMetadata(details) {
|
|
134
|
-
return {
|
|
135
|
-
skillMetadata: getSkillArtifactMetadataFromDetails(details),
|
|
136
|
-
};
|
|
137
|
-
}
|
|
138
71
|
/**
|
|
139
72
|
* Provider Transport - Multi-provider LLM communication with safety controls
|
|
140
73
|
*
|