@cuylabs/agent-core 5.2.1 → 5.3.0
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/chat-loop/loop.d.ts.map +1 -1
- package/dist/agent/chat-loop/model-step-snapshot.d.ts +2 -0
- package/dist/agent/chat-loop/model-step-snapshot.d.ts.map +1 -1
- package/dist/agent/chat-loop/turn-tools.d.ts +2 -0
- package/dist/agent/chat-loop/turn-tools.d.ts.map +1 -1
- package/dist/agent/fork.d.ts +11 -0
- package/dist/agent/fork.d.ts.map +1 -1
- package/dist/agent/instance/index.d.ts +5 -0
- package/dist/agent/instance/index.d.ts.map +1 -1
- package/dist/agent/instance/tools.d.ts +4 -0
- package/dist/agent/instance/tools.d.ts.map +1 -1
- package/dist/agent/instance/turn-lifecycle.d.ts.map +1 -1
- package/dist/agent/types/config.d.ts +9 -0
- package/dist/agent/types/config.d.ts.map +1 -1
- package/dist/{chunk-BKHWKKSG.js → chunk-35A3XLI4.js} +101 -22
- package/dist/{chunk-V4MIDL5B.js → chunk-4NJ5GFVV.js} +1 -1
- package/dist/{chunk-I7EJGKUP.js → chunk-F2ZKMUW7.js} +16 -1
- package/dist/{chunk-556CPZ3J.js → chunk-MO7V4H4A.js} +53 -3
- package/dist/{chunk-TIHPYVAJ.js → chunk-XK5Z7MDH.js} +84 -7
- package/dist/dispatch/index.js +1 -1
- package/dist/dispatch/runtime.d.ts.map +1 -1
- package/dist/dispatch/types.d.ts +3 -0
- package/dist/dispatch/types.d.ts.map +1 -1
- package/dist/execution/index.js +1 -1
- package/dist/execution/turn/index.js +1 -1
- package/dist/index.js +145 -87
- package/dist/profiles/apply.d.ts.map +1 -1
- package/dist/profiles/index.d.ts +2 -1
- package/dist/profiles/index.d.ts.map +1 -1
- package/dist/profiles/index.js +13 -1
- package/dist/profiles/patterns.d.ts +12 -4
- package/dist/profiles/patterns.d.ts.map +1 -1
- package/dist/profiles/types.d.ts +2 -0
- package/dist/profiles/types.d.ts.map +1 -1
- package/dist/prompt/index.js +2 -2
- package/dist/skill/discovery/discover.d.ts.map +1 -1
- package/dist/skill/index.js +1 -1
- package/dist/skill/types.d.ts +13 -0
- package/dist/skill/types.d.ts.map +1 -1
- package/dist/subagents/index.js +2 -2
- package/dist/subagents/roles/discovery.d.ts +2 -0
- package/dist/subagents/roles/discovery.d.ts.map +1 -1
- package/dist/subagents/roles/markdown-profile.d.ts +7 -4
- package/dist/subagents/roles/markdown-profile.d.ts.map +1 -1
- package/dist/team/index.js +2 -2
- package/dist/tool/index.js +7 -7
- package/package.json +1 -1
- package/dist/{chunk-2R4Y2QNH.js → chunk-UEEHZ4QH.js} +5 -5
|
@@ -3,26 +3,95 @@ function globToRegex(pattern) {
|
|
|
3
3
|
const escaped = pattern.replace(/[.+^${}()|[\]\\]/g, "\\$&").replace(/\*/g, ".*").replace(/\?/g, ".");
|
|
4
4
|
return new RegExp(`^${escaped}$`, "i");
|
|
5
5
|
}
|
|
6
|
+
function compilePatterns(patterns) {
|
|
7
|
+
return patterns.map(globToRegex);
|
|
8
|
+
}
|
|
6
9
|
function matchesPatterns(id, patterns) {
|
|
7
|
-
return patterns.some((pattern) =>
|
|
10
|
+
return patterns.some((pattern) => pattern.test(id));
|
|
11
|
+
}
|
|
12
|
+
function hasToolVisibilityFilter(options) {
|
|
13
|
+
return Boolean(
|
|
14
|
+
options?.match || options?.allow?.length || options?.deny?.length
|
|
15
|
+
);
|
|
8
16
|
}
|
|
9
|
-
function
|
|
17
|
+
function matchesToolVisibility(id, options = {}) {
|
|
18
|
+
return createToolVisibilityMatcher(options)(id);
|
|
19
|
+
}
|
|
20
|
+
function createToolVisibilityMatcher(options = {}) {
|
|
10
21
|
const allowPatterns = options.allow ?? [];
|
|
11
22
|
const denyPatterns = options.deny ?? [];
|
|
12
|
-
|
|
13
|
-
|
|
23
|
+
const allowRegexes = compilePatterns(allowPatterns);
|
|
24
|
+
const denyRegexes = compilePatterns(denyPatterns);
|
|
25
|
+
const customMatcher = options.match;
|
|
26
|
+
return (id) => {
|
|
27
|
+
if (customMatcher && !customMatcher(id)) {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
const matchesAllow = allowRegexes.length === 0 || matchesPatterns(id, allowRegexes);
|
|
14
31
|
if (!matchesAllow) {
|
|
15
32
|
return false;
|
|
16
33
|
}
|
|
17
|
-
const matchesDeny =
|
|
18
|
-
if (matchesDeny &&
|
|
34
|
+
const matchesDeny = denyRegexes.length > 0 && matchesPatterns(id, denyRegexes);
|
|
35
|
+
if (matchesDeny && allowRegexes.length === 0) {
|
|
19
36
|
return false;
|
|
20
37
|
}
|
|
21
38
|
return true;
|
|
22
|
-
}
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
function filterTools(tools, options = {}) {
|
|
42
|
+
const matches = createToolVisibilityMatcher(options);
|
|
43
|
+
return tools.filter((tool) => matches(tool.id));
|
|
44
|
+
}
|
|
45
|
+
function filterToolRecord(tools, options) {
|
|
46
|
+
if (!hasToolVisibilityFilter(options)) {
|
|
47
|
+
return tools;
|
|
48
|
+
}
|
|
49
|
+
const filtered = {};
|
|
50
|
+
const matches = createToolVisibilityMatcher(options);
|
|
51
|
+
for (const [id, tool] of Object.entries(tools)) {
|
|
52
|
+
if (matches(id)) {
|
|
53
|
+
filtered[id] = tool;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return filtered;
|
|
57
|
+
}
|
|
58
|
+
function filterToolMap(tools, options) {
|
|
59
|
+
if (!hasToolVisibilityFilter(options)) {
|
|
60
|
+
return tools;
|
|
61
|
+
}
|
|
62
|
+
const filtered = /* @__PURE__ */ new Map();
|
|
63
|
+
const matches = createToolVisibilityMatcher(options);
|
|
64
|
+
for (const [id, tool] of tools) {
|
|
65
|
+
if (matches(id)) {
|
|
66
|
+
filtered.set(id, tool);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return filtered;
|
|
70
|
+
}
|
|
71
|
+
function composeToolVisibilityFilters(parent, child) {
|
|
72
|
+
if (!hasToolVisibilityFilter(parent)) {
|
|
73
|
+
return child;
|
|
74
|
+
}
|
|
75
|
+
if (!hasToolVisibilityFilter(child)) {
|
|
76
|
+
return parent;
|
|
77
|
+
}
|
|
78
|
+
const parentMatches = createToolVisibilityMatcher(parent);
|
|
79
|
+
const childMatches = createToolVisibilityMatcher(child);
|
|
80
|
+
return {
|
|
81
|
+
match: (id) => parentMatches(id) && childMatches(id)
|
|
82
|
+
};
|
|
23
83
|
}
|
|
24
84
|
|
|
25
85
|
// src/profiles/apply.ts
|
|
86
|
+
function profileToolVisibility(profile) {
|
|
87
|
+
if (!profile.allowTools?.length && !profile.denyTools?.length) {
|
|
88
|
+
return void 0;
|
|
89
|
+
}
|
|
90
|
+
return {
|
|
91
|
+
...profile.allowTools?.length ? { allow: [...profile.allowTools] } : {},
|
|
92
|
+
...profile.denyTools?.length ? { deny: [...profile.denyTools] } : {}
|
|
93
|
+
};
|
|
94
|
+
}
|
|
26
95
|
function applyProfile(profile, availableTools, baseSystemPrompt) {
|
|
27
96
|
const tools = filterTools(availableTools, {
|
|
28
97
|
allow: profile.allowTools,
|
|
@@ -32,10 +101,12 @@ function applyProfile(profile, availableTools, baseSystemPrompt) {
|
|
|
32
101
|
if (systemPrompt && baseSystemPrompt) {
|
|
33
102
|
systemPrompt = systemPrompt.replace("{basePrompt}", baseSystemPrompt);
|
|
34
103
|
}
|
|
104
|
+
const toolVisibility = profileToolVisibility(profile);
|
|
35
105
|
return {
|
|
36
106
|
name: profile.name,
|
|
37
107
|
systemPrompt,
|
|
38
108
|
tools: tools.length > 0 ? tools : void 0,
|
|
109
|
+
...toolVisibility ? { toolVisibility } : {},
|
|
39
110
|
temperature: profile.temperature,
|
|
40
111
|
maxSteps: profile.maxSteps,
|
|
41
112
|
reasoningLevel: profile.reasoningLevel,
|
|
@@ -95,7 +166,13 @@ function createProfile(options) {
|
|
|
95
166
|
}
|
|
96
167
|
|
|
97
168
|
export {
|
|
169
|
+
hasToolVisibilityFilter,
|
|
170
|
+
matchesToolVisibility,
|
|
171
|
+
createToolVisibilityMatcher,
|
|
98
172
|
filterTools,
|
|
173
|
+
filterToolRecord,
|
|
174
|
+
filterToolMap,
|
|
175
|
+
composeToolVisibilityFilters,
|
|
99
176
|
applyProfile,
|
|
100
177
|
mergeProfiles,
|
|
101
178
|
createProfile
|
package/dist/dispatch/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/dispatch/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/dispatch/runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAOH,OAAO,KAAK,EAKV,eAAe,EAIf,2BAA2B,EAC5B,MAAM,YAAY,CAAC;AAmHpB;;;;;;GAMG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,2BAA2B,GACnC,eAAe,CA2PjB"}
|
package/dist/dispatch/types.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import type { LanguageModel } from "ai";
|
|
|
2
2
|
import type { Agent } from "../agent/instance/index.js";
|
|
3
3
|
import type { AgentMiddleware } from "../middleware/types.js";
|
|
4
4
|
import type { Profile } from "../profiles/types.js";
|
|
5
|
+
import type { PromptConfig } from "../prompt/types.js";
|
|
5
6
|
import type { Tool } from "../tool/tool.js";
|
|
6
7
|
export declare const DISPATCH_STATES: readonly ["running", "completed", "failed", "cancelled"];
|
|
7
8
|
export type DispatchState = (typeof DISPATCH_STATES)[number];
|
|
@@ -11,7 +12,9 @@ export interface DispatchRole {
|
|
|
11
12
|
description: string;
|
|
12
13
|
profile?: Profile;
|
|
13
14
|
systemPrompt?: string;
|
|
15
|
+
prompt?: PromptConfig;
|
|
14
16
|
model?: LanguageModel;
|
|
17
|
+
skills?: string[];
|
|
15
18
|
maxSteps?: number;
|
|
16
19
|
additionalMiddleware?: AgentMiddleware[];
|
|
17
20
|
additionalTools?: Tool.AnyInfo[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/dispatch/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACxC,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,4BAA4B,CAAC;AACxD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,eAAO,MAAM,eAAe,0DAKlB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,CAAC,OAAO,eAAe,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7D,eAAO,MAAM,yBAAyB,0GAM5B,CAAC;AAEX,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oBAAoB,CAAC,EAAE,eAAe,EAAE,CAAC;IACzC,eAAe,CAAC,EAAE,IAAI,CAAC,OAAO,EAAE,CAAC;IACjC;;;OAGG;IACH,oBAAoB,CAAC,EAAE,OAAO,CAAC;CAChC;AAED,MAAM,WAAW,qBAAqB;IACpC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,wBAAwB;IACvC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,CAA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,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC/D,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IAC7D,IAAI,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAAC;CAChE;AAED,MAAM,WAAW,2BAA2B;IAC1C,MAAM,EAAE,KAAK,CAAC;IACd,KAAK,EAAE,SAAS,YAAY,EAAE,CAAC;IAC/B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,MAAM,CAAC;IACxB,YAAY,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,CAAC,OAAO,EAAE,eAAe,KAAK,SAAS,IAAI,CAAC,OAAO,EAAE,CAAC;IACzE,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,KAAK,KAAK,CAAC;CAC3D;AAED,eAAO,MAAM,kCAAkC,IAAI,CAAC;AACpD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,eAAO,MAAM,mCAAmC,aAAa,CAAC"}
|
package/dist/execution/index.js
CHANGED
|
@@ -43,6 +43,7 @@ import {
|
|
|
43
43
|
mergeAgentTurnStateProgress
|
|
44
44
|
} from "../chunk-E66PKKDL.js";
|
|
45
45
|
import "../chunk-DYZGHHDB.js";
|
|
46
|
+
import "../chunk-CGP6UNCQ.js";
|
|
46
47
|
import {
|
|
47
48
|
convertAgentMessagesToModelMessages
|
|
48
49
|
} from "../chunk-3ABZ5MIT.js";
|
|
@@ -59,7 +60,6 @@ import "../chunk-CNM6OROH.js";
|
|
|
59
60
|
import "../chunk-I6PKJ7XQ.js";
|
|
60
61
|
import "../chunk-T33MQXUP.js";
|
|
61
62
|
import "../chunk-FII65CN7.js";
|
|
62
|
-
import "../chunk-CGP6UNCQ.js";
|
|
63
63
|
import "../chunk-S6AKEPAX.js";
|
|
64
64
|
export {
|
|
65
65
|
AgentTurnEngine,
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
mergeAgentTurnStateProgress
|
|
21
21
|
} from "../../chunk-E66PKKDL.js";
|
|
22
22
|
import "../../chunk-DYZGHHDB.js";
|
|
23
|
+
import "../../chunk-CGP6UNCQ.js";
|
|
23
24
|
import "../../chunk-3ABZ5MIT.js";
|
|
24
25
|
import "../../chunk-STDJYXYK.js";
|
|
25
26
|
import "../../chunk-JUIL2NJC.js";
|
|
@@ -29,7 +30,6 @@ import "../../chunk-CNM6OROH.js";
|
|
|
29
30
|
import "../../chunk-I6PKJ7XQ.js";
|
|
30
31
|
import "../../chunk-T33MQXUP.js";
|
|
31
32
|
import "../../chunk-FII65CN7.js";
|
|
32
|
-
import "../../chunk-CGP6UNCQ.js";
|
|
33
33
|
import "../../chunk-S6AKEPAX.js";
|
|
34
34
|
export {
|
|
35
35
|
AgentTurnEngine,
|
package/dist/index.js
CHANGED
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
parseSubAgentRoleFrontmatter,
|
|
40
40
|
parseSubAgentToolSpec,
|
|
41
41
|
toSubAgentRole
|
|
42
|
-
} from "./chunk-
|
|
42
|
+
} from "./chunk-35A3XLI4.js";
|
|
43
43
|
import {
|
|
44
44
|
InMemoryMailboxStore,
|
|
45
45
|
InMemoryTaskBoardStore,
|
|
@@ -58,7 +58,7 @@ import {
|
|
|
58
58
|
formatCoordinatorTaskNotifications,
|
|
59
59
|
formatCoordinatorWorkerReports,
|
|
60
60
|
teamPermissionPolicy
|
|
61
|
-
} from "./chunk-
|
|
61
|
+
} from "./chunk-UEEHZ4QH.js";
|
|
62
62
|
import {
|
|
63
63
|
ToolRegistry,
|
|
64
64
|
createToolSearchTool,
|
|
@@ -102,10 +102,16 @@ import {
|
|
|
102
102
|
} from "./chunk-MO3N6M32.js";
|
|
103
103
|
import {
|
|
104
104
|
applyProfile,
|
|
105
|
+
composeToolVisibilityFilters,
|
|
105
106
|
createProfile,
|
|
107
|
+
createToolVisibilityMatcher,
|
|
108
|
+
filterToolMap,
|
|
109
|
+
filterToolRecord,
|
|
106
110
|
filterTools,
|
|
111
|
+
hasToolVisibilityFilter,
|
|
112
|
+
matchesToolVisibility,
|
|
107
113
|
mergeProfiles
|
|
108
|
-
} from "./chunk-
|
|
114
|
+
} from "./chunk-XK5Z7MDH.js";
|
|
109
115
|
import {
|
|
110
116
|
Profiles,
|
|
111
117
|
careful,
|
|
@@ -138,7 +144,7 @@ import {
|
|
|
138
144
|
getTemplate,
|
|
139
145
|
loadGlobalInstructions,
|
|
140
146
|
summarizeEnvironment
|
|
141
|
-
} from "./chunk-
|
|
147
|
+
} from "./chunk-4NJ5GFVV.js";
|
|
142
148
|
import {
|
|
143
149
|
DEFAULT_EXTERNAL_DIRS,
|
|
144
150
|
DEFAULT_MAX_SCAN_DEPTH,
|
|
@@ -153,11 +159,65 @@ import {
|
|
|
153
159
|
loadSkillContent,
|
|
154
160
|
loadSkillMetadata,
|
|
155
161
|
parseFrontmatter
|
|
156
|
-
} from "./chunk-
|
|
162
|
+
} from "./chunk-F2ZKMUW7.js";
|
|
157
163
|
import "./chunk-VOUEJSW6.js";
|
|
158
164
|
import {
|
|
159
165
|
assembleModelContext
|
|
160
166
|
} from "./chunk-TYQWH6XH.js";
|
|
167
|
+
import {
|
|
168
|
+
createCompositeDispatchTaskExecutor,
|
|
169
|
+
createDispatchExternalTaskControl,
|
|
170
|
+
createDispatchTaskExecutor,
|
|
171
|
+
createRuntimeDispatchExecutor,
|
|
172
|
+
createRuntimeDispatchTargets,
|
|
173
|
+
ensureNonEmpty,
|
|
174
|
+
mergeInspection
|
|
175
|
+
} from "./chunk-JZRLCTSD.js";
|
|
176
|
+
import {
|
|
177
|
+
DEFAULT_DISPATCH_TOOL_IDS,
|
|
178
|
+
DEFAULT_LOCAL_DISPATCH_CONCURRENCY,
|
|
179
|
+
DEFAULT_LOCAL_DISPATCH_DEPTH,
|
|
180
|
+
DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX,
|
|
181
|
+
DISPATCH_STATES,
|
|
182
|
+
createDispatchTools,
|
|
183
|
+
createLocalDispatchRuntime,
|
|
184
|
+
createSubAgentRunSession,
|
|
185
|
+
ensureSessionLoaded,
|
|
186
|
+
getVisibleSessionMessages,
|
|
187
|
+
repairOrphanedToolCalls
|
|
188
|
+
} from "./chunk-MO7V4H4A.js";
|
|
189
|
+
import {
|
|
190
|
+
InMemorySessionStore,
|
|
191
|
+
LocalSessionTurnLock,
|
|
192
|
+
SESSION_FORMAT_VERSION,
|
|
193
|
+
SessionManager,
|
|
194
|
+
buildEntryPath,
|
|
195
|
+
buildMessagesFromEntries,
|
|
196
|
+
buildRecentMessagesFromEntries,
|
|
197
|
+
buildRecentMessagesFromEntryMap,
|
|
198
|
+
configureDefaultSessionManager,
|
|
199
|
+
createMessageEntry,
|
|
200
|
+
createMetadataEntry,
|
|
201
|
+
deserializeMessage,
|
|
202
|
+
extractSessionInfo,
|
|
203
|
+
generateEntryId,
|
|
204
|
+
getDefaultSessionManager,
|
|
205
|
+
getLeafId,
|
|
206
|
+
parseJSONL,
|
|
207
|
+
serializeMessage,
|
|
208
|
+
toJSONL,
|
|
209
|
+
toJSONLBatch
|
|
210
|
+
} from "./chunk-EDKZOPUV.js";
|
|
211
|
+
import {
|
|
212
|
+
sleep
|
|
213
|
+
} from "./chunk-SZ2XBPTW.js";
|
|
214
|
+
import {
|
|
215
|
+
MAX_BYTES,
|
|
216
|
+
MAX_LINES,
|
|
217
|
+
Tool,
|
|
218
|
+
normalizeToolReplayPolicy,
|
|
219
|
+
truncateOutput
|
|
220
|
+
} from "./chunk-MJML3A2F.js";
|
|
161
221
|
import "./chunk-3NBTQHVV.js";
|
|
162
222
|
import {
|
|
163
223
|
createEventBus
|
|
@@ -241,6 +301,23 @@ import {
|
|
|
241
301
|
shouldFallbackOnSummaryFailure,
|
|
242
302
|
shouldPruneContext
|
|
243
303
|
} from "./chunk-DYZGHHDB.js";
|
|
304
|
+
import {
|
|
305
|
+
AGENT_CONTEXT_FRAGMENT_CLOSE,
|
|
306
|
+
AGENT_CONTEXT_FRAGMENT_OPEN,
|
|
307
|
+
AGENT_CONTEXT_FRAGMENT_TAG,
|
|
308
|
+
applyAgentContextFragments,
|
|
309
|
+
applyAgentContextFragmentsWithReport,
|
|
310
|
+
createAgentContextFragmentMessage,
|
|
311
|
+
estimateConversationTokens,
|
|
312
|
+
estimateMessageTokens,
|
|
313
|
+
estimateTokens,
|
|
314
|
+
getAgentContextFragmentMetadata,
|
|
315
|
+
isAgentContextFragmentMessage,
|
|
316
|
+
isRenderedAgentContextFragment,
|
|
317
|
+
normalizeAgentContextFragment,
|
|
318
|
+
parseRenderedAgentContextFragment,
|
|
319
|
+
renderAgentContextFragment
|
|
320
|
+
} from "./chunk-CGP6UNCQ.js";
|
|
244
321
|
import {
|
|
245
322
|
DEFAULT_MAX_OUTPUT_TOKENS,
|
|
246
323
|
DEFAULT_MAX_STEPS,
|
|
@@ -364,77 +441,6 @@ import {
|
|
|
364
441
|
resolveCapability
|
|
365
442
|
} from "./chunk-FII65CN7.js";
|
|
366
443
|
import "./chunk-SPBFQXOT.js";
|
|
367
|
-
import {
|
|
368
|
-
createCompositeDispatchTaskExecutor,
|
|
369
|
-
createDispatchExternalTaskControl,
|
|
370
|
-
createDispatchTaskExecutor,
|
|
371
|
-
createRuntimeDispatchExecutor,
|
|
372
|
-
createRuntimeDispatchTargets,
|
|
373
|
-
ensureNonEmpty,
|
|
374
|
-
mergeInspection
|
|
375
|
-
} from "./chunk-JZRLCTSD.js";
|
|
376
|
-
import {
|
|
377
|
-
DEFAULT_DISPATCH_TOOL_IDS,
|
|
378
|
-
DEFAULT_LOCAL_DISPATCH_CONCURRENCY,
|
|
379
|
-
DEFAULT_LOCAL_DISPATCH_DEPTH,
|
|
380
|
-
DEFAULT_LOCAL_DISPATCH_TITLE_PREFIX,
|
|
381
|
-
DISPATCH_STATES,
|
|
382
|
-
createDispatchTools,
|
|
383
|
-
createLocalDispatchRuntime,
|
|
384
|
-
createSubAgentRunSession,
|
|
385
|
-
ensureSessionLoaded,
|
|
386
|
-
getVisibleSessionMessages,
|
|
387
|
-
repairOrphanedToolCalls
|
|
388
|
-
} from "./chunk-556CPZ3J.js";
|
|
389
|
-
import {
|
|
390
|
-
InMemorySessionStore,
|
|
391
|
-
LocalSessionTurnLock,
|
|
392
|
-
SESSION_FORMAT_VERSION,
|
|
393
|
-
SessionManager,
|
|
394
|
-
buildEntryPath,
|
|
395
|
-
buildMessagesFromEntries,
|
|
396
|
-
buildRecentMessagesFromEntries,
|
|
397
|
-
buildRecentMessagesFromEntryMap,
|
|
398
|
-
configureDefaultSessionManager,
|
|
399
|
-
createMessageEntry,
|
|
400
|
-
createMetadataEntry,
|
|
401
|
-
deserializeMessage,
|
|
402
|
-
extractSessionInfo,
|
|
403
|
-
generateEntryId,
|
|
404
|
-
getDefaultSessionManager,
|
|
405
|
-
getLeafId,
|
|
406
|
-
parseJSONL,
|
|
407
|
-
serializeMessage,
|
|
408
|
-
toJSONL,
|
|
409
|
-
toJSONLBatch
|
|
410
|
-
} from "./chunk-EDKZOPUV.js";
|
|
411
|
-
import {
|
|
412
|
-
sleep
|
|
413
|
-
} from "./chunk-SZ2XBPTW.js";
|
|
414
|
-
import {
|
|
415
|
-
MAX_BYTES,
|
|
416
|
-
MAX_LINES,
|
|
417
|
-
Tool,
|
|
418
|
-
normalizeToolReplayPolicy,
|
|
419
|
-
truncateOutput
|
|
420
|
-
} from "./chunk-MJML3A2F.js";
|
|
421
|
-
import {
|
|
422
|
-
AGENT_CONTEXT_FRAGMENT_CLOSE,
|
|
423
|
-
AGENT_CONTEXT_FRAGMENT_OPEN,
|
|
424
|
-
AGENT_CONTEXT_FRAGMENT_TAG,
|
|
425
|
-
applyAgentContextFragments,
|
|
426
|
-
applyAgentContextFragmentsWithReport,
|
|
427
|
-
createAgentContextFragmentMessage,
|
|
428
|
-
estimateConversationTokens,
|
|
429
|
-
estimateMessageTokens,
|
|
430
|
-
estimateTokens,
|
|
431
|
-
getAgentContextFragmentMetadata,
|
|
432
|
-
isAgentContextFragmentMessage,
|
|
433
|
-
isRenderedAgentContextFragment,
|
|
434
|
-
normalizeAgentContextFragment,
|
|
435
|
-
parseRenderedAgentContextFragment,
|
|
436
|
-
renderAgentContextFragment
|
|
437
|
-
} from "./chunk-CGP6UNCQ.js";
|
|
438
444
|
import {
|
|
439
445
|
ClientCredentialsProvider,
|
|
440
446
|
createDiagnosticFetch,
|
|
@@ -2515,9 +2521,18 @@ function getAgentToolIds(tools) {
|
|
|
2515
2521
|
function getAgentTools(tools) {
|
|
2516
2522
|
return Array.from(tools.values());
|
|
2517
2523
|
}
|
|
2524
|
+
function getAgentVisibleTools(tools, toolVisibility) {
|
|
2525
|
+
return filterTools(getAgentTools(tools), toolVisibility);
|
|
2526
|
+
}
|
|
2527
|
+
function getAgentVisibleToolIds(tools, toolVisibility) {
|
|
2528
|
+
return getAgentVisibleTools(tools, toolVisibility).map((tool) => tool.id);
|
|
2529
|
+
}
|
|
2518
2530
|
function hasAgentTool(tools, toolId) {
|
|
2519
2531
|
return tools.has(toolId);
|
|
2520
2532
|
}
|
|
2533
|
+
function hasAgentVisibleTool(tools, toolId, toolVisibility) {
|
|
2534
|
+
return tools.has(toolId) && matchesToolVisibility(toolId, toolVisibility);
|
|
2535
|
+
}
|
|
2521
2536
|
function hasAgentHumanInputTools(tools) {
|
|
2522
2537
|
return [...tools.values()].some(
|
|
2523
2538
|
(tool) => tool.capabilitiesHint?.humanInput === true
|
|
@@ -2530,10 +2545,11 @@ function resolveForkOptions(options, parentTools, systemPrompt) {
|
|
|
2530
2545
|
return options;
|
|
2531
2546
|
}
|
|
2532
2547
|
const applied = applyProfile(options.profile, parentTools, systemPrompt);
|
|
2548
|
+
const appliedOptions = { ...applied };
|
|
2549
|
+
delete appliedOptions.tools;
|
|
2533
2550
|
return {
|
|
2534
|
-
...
|
|
2535
|
-
...options
|
|
2536
|
-
tools: options.tools ?? applied.tools
|
|
2551
|
+
...appliedOptions,
|
|
2552
|
+
...options
|
|
2537
2553
|
};
|
|
2538
2554
|
}
|
|
2539
2555
|
function resolveChildPromptConfig(options) {
|
|
@@ -2577,6 +2593,11 @@ function createForkedAgentConfig(options) {
|
|
|
2577
2593
|
promptBuilder
|
|
2578
2594
|
} = options;
|
|
2579
2595
|
const tools = forkOptions.tools ?? parentTools;
|
|
2596
|
+
const parentToolVisibility = forkOptions.inheritToolVisibility === false ? void 0 : parentConfig.toolVisibility;
|
|
2597
|
+
const toolVisibility = composeToolVisibilityFilters(
|
|
2598
|
+
parentToolVisibility,
|
|
2599
|
+
forkOptions.toolVisibility
|
|
2600
|
+
);
|
|
2580
2601
|
const childPrompt = resolveChildPromptConfig({
|
|
2581
2602
|
forkOptions,
|
|
2582
2603
|
promptBuilder,
|
|
@@ -2603,6 +2624,7 @@ function createForkedAgentConfig(options) {
|
|
|
2603
2624
|
contextWindow: parentConfig.contextWindow,
|
|
2604
2625
|
memory: parentConfig.memory,
|
|
2605
2626
|
mcp: mcpManager,
|
|
2627
|
+
...toolVisibility ? { toolVisibility } : {},
|
|
2606
2628
|
turnToolProviders: forkOptions.turnToolProviders ?? parentConfig.turnToolProviders,
|
|
2607
2629
|
middleware: resolveForkMiddleware(forkOptions, middlewareRunner)
|
|
2608
2630
|
};
|
|
@@ -2695,7 +2717,11 @@ async function resolveTurnTools(options) {
|
|
|
2695
2717
|
if (resolved.cleanup) {
|
|
2696
2718
|
cleanup.push(resolved.cleanup);
|
|
2697
2719
|
}
|
|
2698
|
-
|
|
2720
|
+
const visibleTools = filterTools(
|
|
2721
|
+
resolved.tools ?? [],
|
|
2722
|
+
options.toolVisibility ?? {}
|
|
2723
|
+
);
|
|
2724
|
+
for (const tool of visibleTools) {
|
|
2699
2725
|
if (options.baseTools.has(tool.id) || tools.has(tool.id)) {
|
|
2700
2726
|
throw new Error(
|
|
2701
2727
|
`Turn tool provider "${provider.name}" returned duplicate tool "${tool.id}"`
|
|
@@ -2703,7 +2729,11 @@ async function resolveTurnTools(options) {
|
|
|
2703
2729
|
}
|
|
2704
2730
|
tools.set(tool.id, tool);
|
|
2705
2731
|
}
|
|
2706
|
-
|
|
2732
|
+
const visibleMcpTools = filterToolRecord(
|
|
2733
|
+
resolved.mcpTools ?? {},
|
|
2734
|
+
options.toolVisibility
|
|
2735
|
+
);
|
|
2736
|
+
for (const [name, tool] of Object.entries(visibleMcpTools)) {
|
|
2707
2737
|
if (options.baseMcpTools[name] || mcpTools[name]) {
|
|
2708
2738
|
throw new Error(
|
|
2709
2739
|
`Turn tool provider "${provider.name}" returned duplicate MCP tool "${name}"`
|
|
@@ -2756,8 +2786,12 @@ async function cleanupTurnTools(cleanup) {
|
|
|
2756
2786
|
|
|
2757
2787
|
// src/agent/chat-loop/model-step-snapshot.ts
|
|
2758
2788
|
function createChatModelStepToolRecord(params) {
|
|
2789
|
+
const registeredTools = mergeTurnTools(
|
|
2790
|
+
params.liveTools,
|
|
2791
|
+
params.resolvedTurnTools.tools
|
|
2792
|
+
);
|
|
2759
2793
|
return createAgentToolRecord(
|
|
2760
|
-
|
|
2794
|
+
filterToolMap(registeredTools, params.toolVisibility)
|
|
2761
2795
|
);
|
|
2762
2796
|
}
|
|
2763
2797
|
function createAgentToolRecord(tools) {
|
|
@@ -2770,7 +2804,8 @@ function createAgentToolRecord(tools) {
|
|
|
2770
2804
|
async function createChatModelStepSnapshot(params) {
|
|
2771
2805
|
const tools = createChatModelStepToolRecord({
|
|
2772
2806
|
liveTools: params.liveTools,
|
|
2773
|
-
resolvedTurnTools: params.resolvedTurnTools
|
|
2807
|
+
resolvedTurnTools: params.resolvedTurnTools,
|
|
2808
|
+
toolVisibility: params.config.toolVisibility
|
|
2774
2809
|
});
|
|
2775
2810
|
const systemPrompts = await buildAgentSystemPrompts({
|
|
2776
2811
|
config: params.config,
|
|
@@ -3059,7 +3094,8 @@ async function* runChatLoop(deps) {
|
|
|
3059
3094
|
abort
|
|
3060
3095
|
},
|
|
3061
3096
|
baseTools: liveTools,
|
|
3062
|
-
baseMcpTools: mcpTools
|
|
3097
|
+
baseMcpTools: mcpTools,
|
|
3098
|
+
toolVisibility: config.toolVisibility
|
|
3063
3099
|
});
|
|
3064
3100
|
} catch (error) {
|
|
3065
3101
|
const errorInstance = error instanceof Error ? error : new Error(String(error));
|
|
@@ -3080,7 +3116,8 @@ async function* runChatLoop(deps) {
|
|
|
3080
3116
|
};
|
|
3081
3117
|
let toolRecord = createChatModelStepToolRecord({
|
|
3082
3118
|
liveTools,
|
|
3083
|
-
resolvedTurnTools
|
|
3119
|
+
resolvedTurnTools,
|
|
3120
|
+
toolVisibility: config.toolVisibility
|
|
3084
3121
|
});
|
|
3085
3122
|
const prevOnApplied = interventionCtrl.onApplied;
|
|
3086
3123
|
let streamingStateStarted = false;
|
|
@@ -3330,7 +3367,10 @@ async function* runAgentChatTurn(params) {
|
|
|
3330
3367
|
});
|
|
3331
3368
|
turnTracker.startTurn(turnId);
|
|
3332
3369
|
await repairOrphanedToolCalls(sessions);
|
|
3333
|
-
const mcpTools =
|
|
3370
|
+
const mcpTools = filterToolRecord(
|
|
3371
|
+
await runtime.ensureMcpConnected(),
|
|
3372
|
+
runtime.config.toolVisibility
|
|
3373
|
+
);
|
|
3334
3374
|
const loop = runChatLoop({
|
|
3335
3375
|
sessionId,
|
|
3336
3376
|
turnId,
|
|
@@ -3628,6 +3668,15 @@ var Agent = class _Agent {
|
|
|
3628
3668
|
hasTool(toolId) {
|
|
3629
3669
|
return hasAgentTool(this.tools, toolId);
|
|
3630
3670
|
}
|
|
3671
|
+
getVisibleToolIds() {
|
|
3672
|
+
return getAgentVisibleToolIds(this.tools, this.config.toolVisibility);
|
|
3673
|
+
}
|
|
3674
|
+
getVisibleTools() {
|
|
3675
|
+
return getAgentVisibleTools(this.tools, this.config.toolVisibility);
|
|
3676
|
+
}
|
|
3677
|
+
hasVisibleTool(toolId) {
|
|
3678
|
+
return hasAgentVisibleTool(this.tools, toolId, this.config.toolVisibility);
|
|
3679
|
+
}
|
|
3631
3680
|
// ============================================================================
|
|
3632
3681
|
// Session Management
|
|
3633
3682
|
// ============================================================================
|
|
@@ -3770,6 +3819,9 @@ var Agent = class _Agent {
|
|
|
3770
3819
|
getPromptBuilder() {
|
|
3771
3820
|
return this.promptBuilder;
|
|
3772
3821
|
}
|
|
3822
|
+
getPromptConfig() {
|
|
3823
|
+
return this.config.prompt;
|
|
3824
|
+
}
|
|
3773
3825
|
isUsingPromptPipeline() {
|
|
3774
3826
|
return this.promptBuilder !== void 0;
|
|
3775
3827
|
}
|
|
@@ -3777,7 +3829,7 @@ var Agent = class _Agent {
|
|
|
3777
3829
|
await this.ensureSkillTools();
|
|
3778
3830
|
return await buildAgentSystemPrompts({
|
|
3779
3831
|
config: this.config,
|
|
3780
|
-
toolIds:
|
|
3832
|
+
toolIds: this.getVisibleToolIds(),
|
|
3781
3833
|
sessionId,
|
|
3782
3834
|
override,
|
|
3783
3835
|
promptBuilder: this.promptBuilder,
|
|
@@ -4289,6 +4341,7 @@ export {
|
|
|
4289
4341
|
commitOutput,
|
|
4290
4342
|
commitStep,
|
|
4291
4343
|
compactAgentMessages,
|
|
4344
|
+
composeToolVisibilityFilters,
|
|
4292
4345
|
configureDefaultSessionManager,
|
|
4293
4346
|
configureResolver,
|
|
4294
4347
|
configureSubAgents,
|
|
@@ -4350,6 +4403,7 @@ export {
|
|
|
4350
4403
|
createTelemetryConfig,
|
|
4351
4404
|
createThresholdApprovalRule,
|
|
4352
4405
|
createToolSearchTool,
|
|
4406
|
+
createToolVisibilityMatcher,
|
|
4353
4407
|
createTrustedSessionApprovalPolicy,
|
|
4354
4408
|
createTurnTracker,
|
|
4355
4409
|
createWaitAgentTool,
|
|
@@ -4384,6 +4438,8 @@ export {
|
|
|
4384
4438
|
extractSessionInfo,
|
|
4385
4439
|
failAgentTurnState,
|
|
4386
4440
|
failAgentWorkflowTurnState,
|
|
4441
|
+
filterToolMap,
|
|
4442
|
+
filterToolRecord,
|
|
4387
4443
|
filterTools,
|
|
4388
4444
|
findCapabilityOverride,
|
|
4389
4445
|
formatApprovalDeniedReason,
|
|
@@ -4435,6 +4491,7 @@ export {
|
|
|
4435
4491
|
getToolRisk,
|
|
4436
4492
|
getUsableTokenLimit,
|
|
4437
4493
|
getUserSubAgentRolesDir,
|
|
4494
|
+
hasToolVisibilityFilter,
|
|
4438
4495
|
httpServer,
|
|
4439
4496
|
inferContextWindow,
|
|
4440
4497
|
inferProvider,
|
|
@@ -4465,6 +4522,7 @@ export {
|
|
|
4465
4522
|
matchApprovalRisks,
|
|
4466
4523
|
matchApprovalSessions,
|
|
4467
4524
|
matchApprovalStringPrefixes,
|
|
4525
|
+
matchesToolVisibility,
|
|
4468
4526
|
mergeAgentTurnStateProgress,
|
|
4469
4527
|
mergeInspection,
|
|
4470
4528
|
mergeProfiles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/profiles/apply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/profiles/apply.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,iBAAiB,CAAC;AAE5C,OAAO,KAAK,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAe1D;;GAEG;AACH,wBAAgB,YAAY,CAC1B,OAAO,EAAE,OAAO,EAChB,cAAc,EAAE,IAAI,CAAC,OAAO,EAAE,EAC9B,gBAAgB,CAAC,EAAE,MAAM,GACxB,cAAc,CAsBhB;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,QAAQ,EAAE,OAAO,EAAE,GAAG,OAAO,CAoD7D;AAED;;GAEG;AACH,wBAAgB,aAAa,CAC3B,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAC3C,OAAO,CAKT"}
|
package/dist/profiles/index.d.ts
CHANGED
|
@@ -8,7 +8,8 @@
|
|
|
8
8
|
* - `builtins` owns the bundled profile catalog
|
|
9
9
|
*/
|
|
10
10
|
export type { AppliedProfile, Profile } from "./types.js";
|
|
11
|
-
export {
|
|
11
|
+
export type { ToolVisibilityFilter } from "./patterns.js";
|
|
12
|
+
export { composeToolVisibilityFilters, createToolVisibilityMatcher, filterToolMap, filterToolRecord, filterTools, hasToolVisibilityFilter, matchesToolVisibility, } from "./patterns.js";
|
|
12
13
|
export { applyProfile, createProfile, mergeProfiles } from "./apply.js";
|
|
13
14
|
export { Profiles, careful, code, explore, plan, quick, review, watch, } from "./builtins.js";
|
|
14
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profiles/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1D,YAAY,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AAC1D,OAAO,EACL,4BAA4B,EAC5B,2BAA2B,EAC3B,aAAa,EACb,gBAAgB,EAChB,WAAW,EACX,uBAAuB,EACvB,qBAAqB,GACtB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AACxE,OAAO,EACL,QAAQ,EACR,OAAO,EACP,IAAI,EACJ,OAAO,EACP,IAAI,EACJ,KAAK,EACL,MAAM,EACN,KAAK,GACN,MAAM,eAAe,CAAC"}
|
package/dist/profiles/index.js
CHANGED
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
applyProfile,
|
|
3
|
+
composeToolVisibilityFilters,
|
|
3
4
|
createProfile,
|
|
5
|
+
createToolVisibilityMatcher,
|
|
6
|
+
filterToolMap,
|
|
7
|
+
filterToolRecord,
|
|
4
8
|
filterTools,
|
|
9
|
+
hasToolVisibilityFilter,
|
|
10
|
+
matchesToolVisibility,
|
|
5
11
|
mergeProfiles
|
|
6
|
-
} from "../chunk-
|
|
12
|
+
} from "../chunk-XK5Z7MDH.js";
|
|
7
13
|
import {
|
|
8
14
|
Profiles,
|
|
9
15
|
careful,
|
|
@@ -19,9 +25,15 @@ export {
|
|
|
19
25
|
applyProfile,
|
|
20
26
|
careful,
|
|
21
27
|
code,
|
|
28
|
+
composeToolVisibilityFilters,
|
|
22
29
|
createProfile,
|
|
30
|
+
createToolVisibilityMatcher,
|
|
23
31
|
explore,
|
|
32
|
+
filterToolMap,
|
|
33
|
+
filterToolRecord,
|
|
24
34
|
filterTools,
|
|
35
|
+
hasToolVisibilityFilter,
|
|
36
|
+
matchesToolVisibility,
|
|
25
37
|
mergeProfiles,
|
|
26
38
|
plan,
|
|
27
39
|
quick,
|