@dudko.dev/agent-web 0.0.41 → 0.0.42
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/README.md +7 -3
- package/dist/agent-web.js +133 -133
- package/dist/agent-web.js.map +1 -1
- package/dist/{chunk-4FBTBE74.js → chunk-2MLHZ6LQ.js} +2 -2
- package/dist/{chunk-L7Y3QRAM.js → chunk-DAREMCXF.js} +2 -2
- package/dist/{chunk-YUA2BHRM.js → chunk-ZSZSSJS4.js} +402 -13
- package/dist/chunk-ZSZSSJS4.js.map +1 -0
- package/dist/{elicitation-BA1knkdA.d.cts → elicitation-DS-84_bF.d.cts} +123 -9
- package/dist/{elicitation-BA1knkdA.d.ts → elicitation-DS-84_bF.d.ts} +123 -9
- package/dist/index.cjs +145 -23
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +69 -23
- package/dist/index.js.map +1 -1
- package/dist/mcp.cjs +352 -9
- package/dist/mcp.cjs.map +1 -1
- package/dist/mcp.d.cts +12 -6
- package/dist/mcp.d.ts +12 -6
- package/dist/mcp.js +8 -3
- package/dist/mcp.js.map +1 -1
- package/dist/{sandbox-ZDQIIZS7.js → sandbox-3VRX47UY.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-YUA2BHRM.js.map +0 -1
- /package/dist/{chunk-4FBTBE74.js.map → chunk-2MLHZ6LQ.js.map} +0 -0
- /package/dist/{chunk-L7Y3QRAM.js.map → chunk-DAREMCXF.js.map} +0 -0
- /package/dist/{sandbox-ZDQIIZS7.js.map → sandbox-3VRX47UY.js.map} +0 -0
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageModel, ToolSet, Experimental_DecisionModel, Tool, FilePart, ImageModel, SpeechModel, TranscriptionModel, SystemModelMessage, ModelMessage, generateText, streamText } from 'ai';
|
|
2
|
-
import { V as VaultOptions, M as McpSkillSource, a as McpSkillConsent, b as McpSkillGrants, c as McpSkillRunConsent, d as McpSkillConsentView, e as
|
|
3
|
-
export { I as IndexedDBVault,
|
|
2
|
+
import { V as VaultOptions, M as McpSkillSource, a as McpSkillConsent, b as McpSkillGrants, c as McpSkillRunConsent, d as McpSkillConsentView, e as McpSkillSnapshotMemory, f as McpElicitationSchema, g as McpElicitationReason, h as McpAppToolResult } from './elicitation-DS-84_bF.cjs';
|
|
3
|
+
export { I as IndexedDBVault, i as MCP_APPS_EXTENSION, j as MCP_APP_MAX_HTML_CHARS, k as MCP_APP_MAX_RESULT_CHARS, l as MCP_APP_MIME_TYPE, m as MCP_SKILLS_EXTENSION, n as MCP_SKILLS_MAX_PER_SERVER, o as MCP_SKILLS_MAX_TOTAL, p as MCP_SKILL_BODY_MAX_CHARS, q as MCP_SKILL_CONSENTS, r as MCP_SKILL_CONSENT_DEFAULT, s as MCP_SKILL_DESCRIPTION_MAX_CHARS, t as MCP_SKILL_DIRECTORY_ENTRIES_MAX, u as MCP_SKILL_FILE_MAX_CHARS, v as MCP_SKILL_MAX_RESOURCES, w as MCP_SKILL_MAX_TOTAL_BYTES, x as MCP_SKILL_SNAPSHOTS_MAX_BYTES, y as MCP_SKILL_SNAPSHOT_MAX_DEPTH, z as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, A as MCP_SKILL_URI_MAX_CHARS, B as McpAppCsp, C as McpAppPermissions, D as McpAppResource, E as McpAppVisibility, F as McpElicitationFieldSchema, G as McpSkillsOptions, H as McpSkillsSetting, S as SkillDirectoryListing, J as mcpAppOrigin, K as mcpSkillEntryRefusal, L as mcpSkillPreamble, N as mcpSkillUriRefusal } from './elicitation-DS-84_bF.cjs';
|
|
4
4
|
import { A as AgentToolSet, a as AgentTool } from './types-DwSMj_Xs.cjs';
|
|
5
5
|
export { p as promptHintOf } from './types-DwSMj_Xs.cjs';
|
|
6
6
|
import { z, ZodType } from 'zod';
|
|
@@ -849,6 +849,8 @@ interface SkillToolsMcp {
|
|
|
849
849
|
sources: readonly McpSkillSource[];
|
|
850
850
|
/** The run's consent scope: a person is asked through the agent's approval gate. */
|
|
851
851
|
scope?: McpSkillConsentScope;
|
|
852
|
+
/** What the agent's snapshots of generated skills hold (a skill added by URI counts there). */
|
|
853
|
+
memory?: McpSkillSnapshotMemory;
|
|
852
854
|
}
|
|
853
855
|
/**
|
|
854
856
|
* The built-in `load_skill` / `read_skill_file` tools. `onLoad` fires when a
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LanguageModel, ToolSet, Experimental_DecisionModel, Tool, FilePart, ImageModel, SpeechModel, TranscriptionModel, SystemModelMessage, ModelMessage, generateText, streamText } from 'ai';
|
|
2
|
-
import { V as VaultOptions, M as McpSkillSource, a as McpSkillConsent, b as McpSkillGrants, c as McpSkillRunConsent, d as McpSkillConsentView, e as
|
|
3
|
-
export { I as IndexedDBVault,
|
|
2
|
+
import { V as VaultOptions, M as McpSkillSource, a as McpSkillConsent, b as McpSkillGrants, c as McpSkillRunConsent, d as McpSkillConsentView, e as McpSkillSnapshotMemory, f as McpElicitationSchema, g as McpElicitationReason, h as McpAppToolResult } from './elicitation-DS-84_bF.js';
|
|
3
|
+
export { I as IndexedDBVault, i as MCP_APPS_EXTENSION, j as MCP_APP_MAX_HTML_CHARS, k as MCP_APP_MAX_RESULT_CHARS, l as MCP_APP_MIME_TYPE, m as MCP_SKILLS_EXTENSION, n as MCP_SKILLS_MAX_PER_SERVER, o as MCP_SKILLS_MAX_TOTAL, p as MCP_SKILL_BODY_MAX_CHARS, q as MCP_SKILL_CONSENTS, r as MCP_SKILL_CONSENT_DEFAULT, s as MCP_SKILL_DESCRIPTION_MAX_CHARS, t as MCP_SKILL_DIRECTORY_ENTRIES_MAX, u as MCP_SKILL_FILE_MAX_CHARS, v as MCP_SKILL_MAX_RESOURCES, w as MCP_SKILL_MAX_TOTAL_BYTES, x as MCP_SKILL_SNAPSHOTS_MAX_BYTES, y as MCP_SKILL_SNAPSHOT_MAX_DEPTH, z as MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES, A as MCP_SKILL_URI_MAX_CHARS, B as McpAppCsp, C as McpAppPermissions, D as McpAppResource, E as McpAppVisibility, F as McpElicitationFieldSchema, G as McpSkillsOptions, H as McpSkillsSetting, S as SkillDirectoryListing, J as mcpAppOrigin, K as mcpSkillEntryRefusal, L as mcpSkillPreamble, N as mcpSkillUriRefusal } from './elicitation-DS-84_bF.js';
|
|
4
4
|
import { A as AgentToolSet, a as AgentTool } from './types-DwSMj_Xs.js';
|
|
5
5
|
export { p as promptHintOf } from './types-DwSMj_Xs.js';
|
|
6
6
|
import { z, ZodType } from 'zod';
|
|
@@ -849,6 +849,8 @@ interface SkillToolsMcp {
|
|
|
849
849
|
sources: readonly McpSkillSource[];
|
|
850
850
|
/** The run's consent scope: a person is asked through the agent's approval gate. */
|
|
851
851
|
scope?: McpSkillConsentScope;
|
|
852
|
+
/** What the agent's snapshots of generated skills hold (a skill added by URI counts there). */
|
|
853
|
+
memory?: McpSkillSnapshotMemory;
|
|
852
854
|
}
|
|
853
855
|
/**
|
|
854
856
|
* The built-in `load_skill` / `read_skill_file` tools. `onLoad` fires when a
|
package/dist/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
getOrCreateVaultKey,
|
|
12
12
|
mcpAppOrigin,
|
|
13
13
|
renderMcpInstructions
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-2MLHZ6LQ.js";
|
|
15
15
|
import {
|
|
16
16
|
AttachmentsNotSupportedError,
|
|
17
17
|
ContextWindowExceededError,
|
|
@@ -95,7 +95,7 @@ import {
|
|
|
95
95
|
toolRunContextOf,
|
|
96
96
|
withDeadline,
|
|
97
97
|
wrapToolsForRun
|
|
98
|
-
} from "./chunk-
|
|
98
|
+
} from "./chunk-DAREMCXF.js";
|
|
99
99
|
import {
|
|
100
100
|
FILES_STORE,
|
|
101
101
|
KEYS_STORE,
|
|
@@ -106,9 +106,13 @@ import {
|
|
|
106
106
|
MCP_SKILL_CONSENTS,
|
|
107
107
|
MCP_SKILL_CONSENT_DEFAULT,
|
|
108
108
|
MCP_SKILL_DESCRIPTION_MAX_CHARS,
|
|
109
|
+
MCP_SKILL_DIRECTORY_ENTRIES_MAX,
|
|
109
110
|
MCP_SKILL_FILE_MAX_CHARS,
|
|
110
111
|
MCP_SKILL_MAX_RESOURCES,
|
|
111
112
|
MCP_SKILL_MAX_TOTAL_BYTES,
|
|
113
|
+
MCP_SKILL_SNAPSHOTS_MAX_BYTES,
|
|
114
|
+
MCP_SKILL_SNAPSHOT_MAX_DEPTH,
|
|
115
|
+
MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES,
|
|
112
116
|
MCP_SKILL_URI_MAX_CHARS,
|
|
113
117
|
RUNS_STORE,
|
|
114
118
|
SECRETS_STORE,
|
|
@@ -117,6 +121,7 @@ import {
|
|
|
117
121
|
assignMcpSkillNames,
|
|
118
122
|
collectMcpSkillSources,
|
|
119
123
|
createMcpSkillRunConsent,
|
|
124
|
+
createMcpSkillSnapshotMemory,
|
|
120
125
|
decideMcpSkillConsent,
|
|
121
126
|
isMcpSkillName,
|
|
122
127
|
mcpSkillBodyText,
|
|
@@ -135,10 +140,12 @@ import {
|
|
|
135
140
|
openAgentWebDB,
|
|
136
141
|
recordMcpSkillConsent,
|
|
137
142
|
resolveMcpSkillConsent,
|
|
138
|
-
|
|
143
|
+
resolveMcpSkillPath,
|
|
139
144
|
resolveMcpSkillServer,
|
|
140
|
-
selectMcpSkills
|
|
141
|
-
|
|
145
|
+
selectMcpSkills,
|
|
146
|
+
skillDirectoryListing,
|
|
147
|
+
skillDirectoryOf
|
|
148
|
+
} from "./chunk-ZSZSSJS4.js";
|
|
142
149
|
|
|
143
150
|
// src/caching.ts
|
|
144
151
|
var resolveCaching = (s) => {
|
|
@@ -618,17 +625,24 @@ var McpSkillDeniedError = class extends Error {
|
|
|
618
625
|
return this.message;
|
|
619
626
|
}
|
|
620
627
|
};
|
|
621
|
-
var mcpSkillOf = (source, record2, name, byUri) => {
|
|
628
|
+
var mcpSkillOf = (source, record2, name, byUri, memory) => {
|
|
622
629
|
const skill = {
|
|
623
630
|
name,
|
|
624
|
-
description: mcpSkillDescription(record2.description, source.server),
|
|
631
|
+
description: mcpSkillDescription(record2.description, source.server, record2.dynamic === true),
|
|
625
632
|
content: "",
|
|
626
633
|
mcp: { server: source.server, uri: record2.uri }
|
|
627
634
|
};
|
|
628
|
-
mcpSkillStates.set(skill, { source, record: record2, ...byUri ? { byUri: true } : {} });
|
|
635
|
+
mcpSkillStates.set(skill, { source, record: record2, memory, ...byUri ? { byUri: true } : {} });
|
|
629
636
|
return skill;
|
|
630
637
|
};
|
|
631
|
-
var
|
|
638
|
+
var memoryOf = (skills) => {
|
|
639
|
+
for (const skill of skills) {
|
|
640
|
+
const memory = mcpSkillStates.get(skill)?.memory;
|
|
641
|
+
if (memory) return memory;
|
|
642
|
+
}
|
|
643
|
+
return void 0;
|
|
644
|
+
};
|
|
645
|
+
var createMcpSkills = (sources, names, warn, memory = createMcpSkillSnapshotMemory()) => {
|
|
632
646
|
const own = new Set(names);
|
|
633
647
|
const taken = new Set(own);
|
|
634
648
|
const { kept, notices } = selectMcpSkills(
|
|
@@ -659,12 +673,12 @@ var createMcpSkills = (sources, names, warn) => {
|
|
|
659
673
|
`[mcp] ${source.server}: its skill "${record2.name}" has the name of one of this agent's own skills; the agent's keeps the name, the server's is "${name}"`
|
|
660
674
|
);
|
|
661
675
|
}
|
|
662
|
-
out.push(mcpSkillOf(source, record2, name, added.has(record2)));
|
|
676
|
+
out.push(mcpSkillOf(source, record2, name, added.has(record2), memory));
|
|
663
677
|
}
|
|
664
678
|
}
|
|
665
679
|
return out;
|
|
666
680
|
};
|
|
667
|
-
var addMcpSkillByUri = async (skills, sources, requested, signal) => {
|
|
681
|
+
var addMcpSkillByUri = async (skills, sources, requested, signal, memory) => {
|
|
668
682
|
const refused = mcpSkillUriRefusal(requested.uri);
|
|
669
683
|
if (refused) throw new Error(`load_skill: ${refused}`);
|
|
670
684
|
const able = sources.filter((s) => typeof s.get === "function");
|
|
@@ -689,13 +703,22 @@ var addMcpSkillByUri = async (skills, sources, requested, signal) => {
|
|
|
689
703
|
const meanwhile = held();
|
|
690
704
|
if (meanwhile) return meanwhile;
|
|
691
705
|
const name = assignAddedMcpSkillName(source.server, record2, new Set(skills.map((s) => s.name)));
|
|
692
|
-
const skill = mcpSkillOf(
|
|
706
|
+
const skill = mcpSkillOf(
|
|
707
|
+
source,
|
|
708
|
+
record2,
|
|
709
|
+
name,
|
|
710
|
+
true,
|
|
711
|
+
memoryOf(skills) ?? memory ?? createMcpSkillSnapshotMemory()
|
|
712
|
+
);
|
|
693
713
|
skills.push(skill);
|
|
694
714
|
return skill;
|
|
695
715
|
};
|
|
696
716
|
var fetchMcpSkill = async (state, signal) => {
|
|
697
717
|
if (state.fetched) return state.fetched;
|
|
698
|
-
state.fetching ??= state.source.load(state.record.uri,
|
|
718
|
+
state.fetching ??= state.source.load(state.record.uri, {
|
|
719
|
+
...signal ? { signal } : {},
|
|
720
|
+
memory: state.memory
|
|
721
|
+
});
|
|
699
722
|
try {
|
|
700
723
|
state.fetched = await state.fetching;
|
|
701
724
|
return state.fetched;
|
|
@@ -756,7 +779,8 @@ var acquireMcpSkill = async (skill, skills, scope, opts = {}) => {
|
|
|
756
779
|
body: fetched.body,
|
|
757
780
|
consent,
|
|
758
781
|
...state.byUri ? { byUri: true } : {},
|
|
759
|
-
...enclosing ? { nestedIn: enclosing } : {}
|
|
782
|
+
...enclosing ? { nestedIn: enclosing } : {},
|
|
783
|
+
...fetched.snapshot ? { snapshot: fetched.snapshot } : {}
|
|
760
784
|
});
|
|
761
785
|
const answer = await scope.ask(opts.input ?? { name: skill.name }, view, opts.signal);
|
|
762
786
|
if (answer.by === "person") {
|
|
@@ -801,8 +825,16 @@ var readMcpSkillFile = async (skill, skills, requested, scope, signal) => {
|
|
|
801
825
|
}
|
|
802
826
|
const state = mcpSkillStates.get(skill);
|
|
803
827
|
const loaded = state.loaded;
|
|
804
|
-
const target =
|
|
828
|
+
const target = resolveMcpSkillPath(loaded.files, requested);
|
|
805
829
|
if ("refused" in target) throw new Error(`skill "${skill.name}": ${target.refused}`);
|
|
830
|
+
if ("dir" in target) {
|
|
831
|
+
const drift = await state.source.readDirectory?.(
|
|
832
|
+
loaded,
|
|
833
|
+
target.dir,
|
|
834
|
+
signal ? { signal } : void 0
|
|
835
|
+
);
|
|
836
|
+
return skillDirectoryListing(skill.name, target.dir, target, drift);
|
|
837
|
+
}
|
|
806
838
|
const text = await state.source.readFile(loaded, target.path, signal ? { signal } : void 0);
|
|
807
839
|
return mcpSkillFileText(state.source.server, state.record.uri, target.path, text);
|
|
808
840
|
};
|
|
@@ -869,7 +901,8 @@ var createSkillTools = (skills, onLoad, mcp) => {
|
|
|
869
901
|
skills,
|
|
870
902
|
servers,
|
|
871
903
|
{ server, uri },
|
|
872
|
-
signalOf(options)
|
|
904
|
+
signalOf(options),
|
|
905
|
+
mcp?.memory
|
|
873
906
|
);
|
|
874
907
|
return load(skill2, { server, uri }, signalOf(options));
|
|
875
908
|
}
|
|
@@ -895,12 +928,15 @@ var createSkillTools = (skills, onLoad, mcp) => {
|
|
|
895
928
|
}
|
|
896
929
|
});
|
|
897
930
|
const readFile = tool({
|
|
898
|
-
description:
|
|
931
|
+
description: `Read one of a skill's bundled files (paths are listed by load_skill); a directory path ("templates/", "." for the root) returns its listing.`,
|
|
899
932
|
inputSchema: jsonSchema({
|
|
900
933
|
type: "object",
|
|
901
934
|
properties: {
|
|
902
935
|
name: { type: "string", description: "The skill name" },
|
|
903
|
-
path: {
|
|
936
|
+
path: {
|
|
937
|
+
type: "string",
|
|
938
|
+
description: "The file path, relative to the skill, or a directory to list"
|
|
939
|
+
}
|
|
904
940
|
},
|
|
905
941
|
required: ["name", "path"],
|
|
906
942
|
additionalProperties: false
|
|
@@ -913,8 +949,12 @@ var createSkillTools = (skills, onLoad, mcp) => {
|
|
|
913
949
|
}
|
|
914
950
|
const file = skill.files?.find((f) => f.path === path);
|
|
915
951
|
if (!file) {
|
|
916
|
-
const
|
|
917
|
-
|
|
952
|
+
const paths = (skill.files ?? []).map((f) => f.path);
|
|
953
|
+
const directory = skillDirectoryOf(paths, path);
|
|
954
|
+
if (directory) return skillDirectoryListing(skill.name, directory.dir, directory);
|
|
955
|
+
throw new Error(
|
|
956
|
+
`skill "${name}" has no file "${path}"; files: ${paths.join(", ") || "none"}`
|
|
957
|
+
);
|
|
918
958
|
}
|
|
919
959
|
return file.content;
|
|
920
960
|
}
|
|
@@ -5513,7 +5553,7 @@ var createAgent = async (config) => {
|
|
|
5513
5553
|
config.availableTools,
|
|
5514
5554
|
config.excludedTools
|
|
5515
5555
|
);
|
|
5516
|
-
const sandbox = config.sandbox ? (await import("./sandbox-
|
|
5556
|
+
const sandbox = config.sandbox ? (await import("./sandbox-3VRX47UY.js")).createSandbox(
|
|
5517
5557
|
config.sandbox === true ? {} : config.sandbox,
|
|
5518
5558
|
hostTools,
|
|
5519
5559
|
(m) => log.warn(m)
|
|
@@ -5526,12 +5566,14 @@ var createAgent = async (config) => {
|
|
|
5526
5566
|
const spawnBuiltIn = Boolean(dynamicSubagents) && config.tools?.[SPAWN_SUBAGENT_TOOL] === void 0 && baseTools[SPAWN_SUBAGENT_TOOL] !== void 0;
|
|
5527
5567
|
const mcpInstructions = config.mcpInstructions === false ? "" : renderMcpInstructions(collectMcpInstructions(baseTools));
|
|
5528
5568
|
const mcpSkillSources = collectMcpSkillSources(baseTools);
|
|
5569
|
+
const mcpSkillMemory = createMcpSkillSnapshotMemory();
|
|
5529
5570
|
if (!seed) {
|
|
5530
5571
|
skills.push(
|
|
5531
5572
|
...createMcpSkills(
|
|
5532
5573
|
mcpSkillSources,
|
|
5533
5574
|
skills.map((s) => s.name),
|
|
5534
|
-
(m) => log.warn(m)
|
|
5575
|
+
(m) => log.warn(m),
|
|
5576
|
+
mcpSkillMemory
|
|
5535
5577
|
)
|
|
5536
5578
|
);
|
|
5537
5579
|
}
|
|
@@ -5735,7 +5777,7 @@ ${renderActiveSkills(active)}`
|
|
|
5735
5777
|
createSkillTools(
|
|
5736
5778
|
skills,
|
|
5737
5779
|
(s) => activateSkill(s.name, "tool"),
|
|
5738
|
-
mcpSkillSources.length ? { sources: mcpSkillSources, scope: skillScope } : void 0
|
|
5780
|
+
mcpSkillSources.length ? { sources: mcpSkillSources, scope: skillScope, memory: mcpSkillMemory } : void 0
|
|
5739
5781
|
)
|
|
5740
5782
|
);
|
|
5741
5783
|
}
|
|
@@ -8359,9 +8401,13 @@ export {
|
|
|
8359
8401
|
MCP_SKILL_CONSENTS,
|
|
8360
8402
|
MCP_SKILL_CONSENT_DEFAULT,
|
|
8361
8403
|
MCP_SKILL_DESCRIPTION_MAX_CHARS,
|
|
8404
|
+
MCP_SKILL_DIRECTORY_ENTRIES_MAX,
|
|
8362
8405
|
MCP_SKILL_FILE_MAX_CHARS,
|
|
8363
8406
|
MCP_SKILL_MAX_RESOURCES,
|
|
8364
8407
|
MCP_SKILL_MAX_TOTAL_BYTES,
|
|
8408
|
+
MCP_SKILL_SNAPSHOTS_MAX_BYTES,
|
|
8409
|
+
MCP_SKILL_SNAPSHOT_MAX_DEPTH,
|
|
8410
|
+
MCP_SKILL_SNAPSHOT_MAX_DIRECTORIES,
|
|
8365
8411
|
MCP_SKILL_URI_MAX_CHARS,
|
|
8366
8412
|
MEDIA_AUDIO_TYPES,
|
|
8367
8413
|
MEDIA_DEFAULT_MAX_CALLS,
|