@ai-agent-forge/agent-forge 0.88.1 → 0.88.2
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/CHANGELOG.md +44 -0
- package/bundled-plugins/agent-loop-policy/agent-forge.json +1 -1
- package/bundled-plugins/agent-loop-policy/plugin.json +1 -1
- package/bundled-plugins/coding-tools/agent-forge.json +1 -1
- package/bundled-plugins/coding-tools/plugin.json +1 -1
- package/bundled-plugins/compaction-policy/agent-forge.json +1 -1
- package/bundled-plugins/compaction-policy/plugin.json +1 -1
- package/bundled-plugins/overflow-policy/agent-forge.json +1 -1
- package/bundled-plugins/overflow-policy/plugin.json +1 -1
- package/bundled-plugins/provider-failover/agent-forge.json +1 -1
- package/bundled-plugins/provider-failover/plugin.json +1 -1
- package/bundled-plugins/retry-policy/agent-forge.json +1 -1
- package/bundled-plugins/retry-policy/plugin.json +1 -1
- package/dist/bundle/.build-manifest.json +68 -58
- package/dist/bundle/chunks/{chunk-D3ARGZFR.js → chunk-44I47ACN.js} +3 -3
- package/dist/bundle/chunks/{chunk-Z72JWUZ4.js → chunk-6F5JWGKE.js} +1 -1
- package/dist/bundle/chunks/{chunk-LZOEQITZ.js → chunk-HTC5K5SM.js} +56 -45
- package/dist/bundle/chunks/{chunk-AQLNTW2B.js → chunk-LSP24WNH.js} +8 -7
- package/dist/bundle/chunks/image-resize-worker.js +3 -3
- package/dist/bundle/chunks/{virtual-modules-WF6WRHP7.js → virtual-modules-MRXD3RWG.js} +1 -1
- package/dist/bundle/cli.js +1 -1
- package/dist/bundle/client.js +1 -1
- package/dist/bundle/index.js +1 -1
- package/dist/bundle/rpc-entry.js +1 -1
- package/dist/cli/plugin-command.d.ts.map +1 -1
- package/dist/cli/plugin-command.js +8 -2
- package/dist/cli/plugin-command.js.map +1 -1
- package/dist/core/agent-session-internal.d.ts +2 -0
- package/dist/core/agent-session-internal.d.ts.map +1 -1
- package/dist/core/agent-session-internal.js.map +1 -1
- package/dist/core/agent-session-services.d.ts +2 -0
- package/dist/core/agent-session-services.d.ts.map +1 -1
- package/dist/core/agent-session-services.js +1 -0
- package/dist/core/agent-session-services.js.map +1 -1
- package/dist/core/agent-session-store.d.ts.map +1 -1
- package/dist/core/agent-session-store.js +6 -1
- package/dist/core/agent-session-store.js.map +1 -1
- package/dist/core/agent-session-tools.d.ts.map +1 -1
- package/dist/core/agent-session-tools.js +13 -0
- package/dist/core/agent-session-tools.js.map +1 -1
- package/dist/core/agent-session.d.ts +24 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +58 -4
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/cli.js +2 -0
- package/dist/core/i18n/locales/zh-cn/cli.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/index.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/index.js +2 -0
- package/dist/core/i18n/locales/zh-cn/index.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js +5 -0
- package/dist/core/i18n/locales/zh-cn/interactive-mode.js.map +1 -1
- package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts +7 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.d.ts.map +1 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.js +15 -0
- package/dist/core/i18n/locales/zh-cn/session-cleanup.js.map +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.d.ts.map +1 -1
- package/dist/core/i18n/locales/zh-cn/slash-commands.js +1 -0
- package/dist/core/i18n/locales/zh-cn/slash-commands.js.map +1 -1
- package/dist/core/sdk.d.ts.map +1 -1
- package/dist/core/sdk.js +24 -1
- package/dist/core/sdk.js.map +1 -1
- package/dist/core/session-cleanup.d.ts +49 -0
- package/dist/core/session-cleanup.d.ts.map +1 -0
- package/dist/core/session-cleanup.js +159 -0
- package/dist/core/session-cleanup.js.map +1 -0
- package/dist/core/session-index.d.ts +75 -0
- package/dist/core/session-index.d.ts.map +1 -0
- package/dist/core/session-index.js +455 -0
- package/dist/core/session-index.js.map +1 -0
- package/dist/core/session-manager.d.ts +9 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +202 -47
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +5 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +12 -1
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/capability-mount.d.ts +40 -0
- package/dist/core/tools/capability-mount.d.ts.map +1 -0
- package/dist/core/tools/capability-mount.js +112 -0
- package/dist/core/tools/capability-mount.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +1 -0
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/components/assistant-message.d.ts +3 -0
- package/dist/modes/interactive/components/assistant-message.d.ts.map +1 -1
- package/dist/modes/interactive/components/assistant-message.js +27 -5
- package/dist/modes/interactive/components/assistant-message.js.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector-search.js +5 -1
- package/dist/modes/interactive/components/session-selector-search.js.map +1 -1
- package/dist/modes/interactive/components/session-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/session-selector.js +9 -0
- package/dist/modes/interactive/components/session-selector.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +17 -0
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +43 -0
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-run-group.d.ts +44 -0
- package/dist/modes/interactive/components/tool-run-group.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-run-group.js +121 -0
- package/dist/modes/interactive/components/tool-run-group.js.map +1 -0
- package/dist/modes/interactive/interactive-commands.d.ts +2 -0
- package/dist/modes/interactive/interactive-commands.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-commands.js +7 -0
- package/dist/modes/interactive/interactive-commands.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts +18 -0
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +85 -3
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/plugins/ecosystem/cli.d.ts.map +1 -1
- package/dist/plugins/ecosystem/cli.js +6 -3
- package/dist/plugins/ecosystem/cli.js.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts +7 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js +50 -3
- package/dist/plugins/ecosystem/node-plugin-bootstrap.js.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts +28 -16
- package/dist/plugins/ecosystem/plugin-bootstrap.d.ts.map +1 -1
- package/dist/plugins/ecosystem/plugin-bootstrap.js +35 -33
- package/dist/plugins/ecosystem/plugin-bootstrap.js.map +1 -1
- package/dist/profile/plugin-profiles.d.ts +1 -1
- package/dist/profile/plugin-profiles.d.ts.map +1 -1
- package/dist/profile/plugin-profiles.js +18 -0
- package/dist/profile/plugin-profiles.js.map +1 -1
- package/dist/profiles/builtin-suites.d.ts +14 -4
- package/dist/profiles/builtin-suites.d.ts.map +1 -1
- package/dist/profiles/builtin-suites.js +20 -5
- package/dist/profiles/builtin-suites.js.map +1 -1
- package/docs/settings.md +354 -354
- package/docs/usage.md +292 -292
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/examples/extensions/with-deps/plugin.json +1 -1
- package/package.json +1 -1
- package/examples/extensions/mcp-stdio/index.d.ts +0 -64
- package/examples/extensions/mcp-stdio/index.d.ts.map +0 -1
- package/examples/extensions/mcp-stdio/index.js +0 -292
- package/examples/extensions/mcp-stdio/index.js.map +0 -1
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* Modes use this class and add their own I/O layer on top.
|
|
14
14
|
*/
|
|
15
15
|
import { readFileSync } from "node:fs";
|
|
16
|
+
import { readFile as readFileUtf8 } from "node:fs/promises";
|
|
16
17
|
import { resolve } from "node:path";
|
|
17
18
|
import { contentText } from "@agent-forge/ai";
|
|
18
19
|
import { clampThinkingLevel, cleanupSessionResources, getSupportedThinkingLevels, streamSimple, } from "@agent-forge/ai/compat";
|
|
@@ -36,6 +37,7 @@ import { BOOTSTRAP_AGENT_LOOP_PLUGIN_ID, BOOTSTRAP_LIFECYCLE_PLUGIN_ID, BOOTSTRA
|
|
|
36
37
|
import { t } from "./i18n/index.js";
|
|
37
38
|
import { expandPromptTemplate } from "./prompt-templates.js";
|
|
38
39
|
import { createSessionJsonlArtifact } from "./session-export.js";
|
|
40
|
+
import { createCapabilityMountTools } from "./tools/capability-mount.js";
|
|
39
41
|
import { createToolSearchTool } from "./tools/tool-search.js";
|
|
40
42
|
/**
|
|
41
43
|
* Parse a skill block from message text.
|
|
@@ -151,6 +153,8 @@ export class AgentSession {
|
|
|
151
153
|
_resourceLoader;
|
|
152
154
|
_customTools;
|
|
153
155
|
_deferredToolPluginIds;
|
|
156
|
+
_deferredCapabilityCards = [];
|
|
157
|
+
_capabilityMountToolsRegistered = false;
|
|
154
158
|
/** Abort reason supplied to the in-flight abort(); consumed by the interruption marker. */
|
|
155
159
|
_pendingAbortReason;
|
|
156
160
|
/** Set when the in-flight prompt run produced an aborted terminal assistant turn. */
|
|
@@ -283,6 +287,7 @@ export class AgentSession {
|
|
|
283
287
|
this._resourceLoader = config.resourceLoader;
|
|
284
288
|
this._customTools = config.customTools ?? [];
|
|
285
289
|
this._deferredToolPluginIds = new Set(config.deferredToolPluginIds ?? []);
|
|
290
|
+
this._deferredCapabilityCards = [...(config.deferredCapabilityCards ?? [])];
|
|
286
291
|
if (this._deferredToolPluginIds.size > 0) {
|
|
287
292
|
this._customTools.push(createToolSearchTool({
|
|
288
293
|
listAllToolNames: () => Array.from(this._toolRegistry.keys()),
|
|
@@ -294,6 +299,10 @@ export class AgentSession {
|
|
|
294
299
|
setActiveToolsByName: (toolNames) => this.setActiveToolsByName(toolNames),
|
|
295
300
|
}));
|
|
296
301
|
}
|
|
302
|
+
if (this._deferredCapabilityCards.length > 0) {
|
|
303
|
+
this._capabilityMountToolsRegistered = true;
|
|
304
|
+
this._customTools.push(...this._createCapabilityMountTools());
|
|
305
|
+
}
|
|
297
306
|
this._cwd = config.cwd;
|
|
298
307
|
this._modelRuntime = config.modelRuntime;
|
|
299
308
|
this._initialActiveToolNames = config.initialActiveToolNames;
|
|
@@ -1010,10 +1019,11 @@ export class AgentSession {
|
|
|
1010
1019
|
(!tool.source.startsWith("agent-forge.builtin.") && !tool.source.startsWith("agent-forge.plugin.")) ||
|
|
1011
1020
|
tool.readonlySafe === true)
|
|
1012
1021
|
// Deferred plugin tools register but stay out of the active set on
|
|
1013
|
-
// this explicit-activation path too, until tool_search
|
|
1014
|
-
// setActiveTools names them (same contract as the
|
|
1015
|
-
// agent-session-tools.ts).
|
|
1016
|
-
.filter((tool) => !this._deferredToolPluginIds.has(tool.source)
|
|
1022
|
+
// this explicit-activation path too, until tool_search /
|
|
1023
|
+
// capability_mount or setActiveTools names them (same contract as the
|
|
1024
|
+
// default path in agent-session-tools.ts).
|
|
1025
|
+
.filter((tool) => !this._deferredToolPluginIds.has(tool.source) &&
|
|
1026
|
+
!this._deferredCapabilityCards.some((card) => card.pluginId === tool.source))
|
|
1017
1027
|
.map((tool) => tool.name)
|
|
1018
1028
|
.filter((name) => !previousToolNames.has(name));
|
|
1019
1029
|
this._refreshToolRegistry({
|
|
@@ -2042,6 +2052,50 @@ export class AgentSession {
|
|
|
2042
2052
|
_refreshToolRegistry(options) {
|
|
2043
2053
|
refreshToolRegistry(this._internal, options);
|
|
2044
2054
|
}
|
|
2055
|
+
/** Registry tool names whose owning capability plugin is `pluginId`. */
|
|
2056
|
+
_toolNamesForPlugin(pluginId) {
|
|
2057
|
+
return Array.from(this._toolDefinitions.entries())
|
|
2058
|
+
.filter(([, entry]) => entry.sourceInfo.source === pluginId)
|
|
2059
|
+
.map(([name]) => name);
|
|
2060
|
+
}
|
|
2061
|
+
_readManual(manualPath) {
|
|
2062
|
+
return readFileUtf8(manualPath, "utf8");
|
|
2063
|
+
}
|
|
2064
|
+
_createCapabilityMountTools() {
|
|
2065
|
+
return createCapabilityMountTools({
|
|
2066
|
+
getCards: () => this._deferredCapabilityCards,
|
|
2067
|
+
toolNamesForPlugin: (pluginId) => {
|
|
2068
|
+
const names = this._toolNamesForPlugin(pluginId);
|
|
2069
|
+
// readonly narrowing (宪法 §6): the registry keeps non-readonlySafe
|
|
2070
|
+
// tools even in readonly sessions (the normal load path filters them
|
|
2071
|
+
// at activation); mount must not smuggle them past that gate.
|
|
2072
|
+
if (this._capabilityMode !== "readonly")
|
|
2073
|
+
return names;
|
|
2074
|
+
const readonlySafe = new Set((this._capabilityRuntime?.listTools() ?? [])
|
|
2075
|
+
.filter((tool) => tool.source === pluginId)
|
|
2076
|
+
.filter((tool) => tool.readonlySafe === true)
|
|
2077
|
+
.map((tool) => tool.name));
|
|
2078
|
+
return names.filter((name) => readonlySafe.has(name));
|
|
2079
|
+
},
|
|
2080
|
+
getActiveToolNames: () => this.getActiveToolNames(),
|
|
2081
|
+
setActiveToolsByName: (toolNames) => this.setActiveToolsByName(toolNames),
|
|
2082
|
+
readManual: (manualPath) => this._readManual(manualPath),
|
|
2083
|
+
});
|
|
2084
|
+
}
|
|
2085
|
+
/**
|
|
2086
|
+
* Register on-demand capability cards after construction (插件按需挂载与能力手册设计 §4).
|
|
2087
|
+
* The sdk assembly calls this once the plugin pool settles, before loading;
|
|
2088
|
+
* first call also injects the capability_mount / capability_unmount pair.
|
|
2089
|
+
* Idempotent: later calls replace the card set.
|
|
2090
|
+
*/
|
|
2091
|
+
registerDeferredCapabilityCards(cards) {
|
|
2092
|
+
this._deferredCapabilityCards = [...cards];
|
|
2093
|
+
if (this._deferredCapabilityCards.length === 0 || this._capabilityMountToolsRegistered)
|
|
2094
|
+
return;
|
|
2095
|
+
this._capabilityMountToolsRegistered = true;
|
|
2096
|
+
this._customTools.push(...this._createCapabilityMountTools());
|
|
2097
|
+
this._refreshToolRegistry();
|
|
2098
|
+
}
|
|
2045
2099
|
_syncCapabilityTools() {
|
|
2046
2100
|
syncCapabilityTools(this._internal);
|
|
2047
2101
|
}
|