@downcity/agent 1.1.79 → 1.1.81
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 +1 -1
- package/bin/agent/local/Agent.d.ts +8 -121
- package/bin/agent/local/Agent.d.ts.map +1 -1
- package/bin/agent/local/Agent.js +63 -381
- package/bin/agent/local/Agent.js.map +1 -1
- package/bin/agent/local/AgentRuntimeFactory.d.ts +2 -2
- package/bin/agent/local/AgentRuntimeFactory.d.ts.map +1 -1
- package/bin/agent/local/AgentRuntimeFactory.js +2 -23
- package/bin/agent/local/AgentRuntimeFactory.js.map +1 -1
- package/bin/agent/local/services/AgentAssemblyService.d.ts +112 -0
- package/bin/agent/local/services/AgentAssemblyService.d.ts.map +1 -0
- package/bin/agent/local/services/AgentAssemblyService.js +135 -0
- package/bin/agent/local/services/AgentAssemblyService.js.map +1 -0
- package/bin/agent/local/services/AgentLifecycleService.d.ts +59 -0
- package/bin/agent/local/services/AgentLifecycleService.d.ts.map +1 -0
- package/bin/agent/local/services/AgentLifecycleService.js +136 -0
- package/bin/agent/local/services/AgentLifecycleService.js.map +1 -0
- package/bin/agent/local/services/AgentSessionManager.d.ts +106 -0
- package/bin/agent/local/services/AgentSessionManager.d.ts.map +1 -0
- package/bin/agent/local/services/AgentSessionManager.js +182 -0
- package/bin/agent/local/services/AgentSessionManager.js.map +1 -0
- package/bin/executor/Executor.d.ts +7 -24
- package/bin/executor/Executor.d.ts.map +1 -1
- package/bin/executor/Executor.js +73 -361
- package/bin/executor/Executor.js.map +1 -1
- package/bin/executor/SessionRunScope.d.ts +18 -34
- package/bin/executor/SessionRunScope.d.ts.map +1 -1
- package/bin/executor/SessionRunScope.js +42 -28
- package/bin/executor/SessionRunScope.js.map +1 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts +5 -3
- package/bin/executor/composer/context/LocalSessionContextComposer.d.ts.map +1 -1
- package/bin/executor/composer/context/LocalSessionContextComposer.js +11 -18
- package/bin/executor/composer/context/LocalSessionContextComposer.js.map +1 -1
- package/bin/executor/composer/context/SessionContextComposer.d.ts +8 -3
- package/bin/executor/composer/context/SessionContextComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/SessionSystemComposer.d.ts +2 -1
- package/bin/executor/composer/system/SessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts +2 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.d.ts.map +1 -1
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js +2 -4
- package/bin/executor/composer/system/default/DefaultSessionSystemComposer.js.map +1 -1
- package/bin/executor/core-engine/CoreEngineRunner.d.ts +62 -0
- package/bin/executor/core-engine/CoreEngineRunner.d.ts.map +1 -0
- package/bin/executor/core-engine/CoreEngineRunner.js +309 -0
- package/bin/executor/core-engine/CoreEngineRunner.js.map +1 -0
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts +5 -0
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.d.ts.map +1 -1
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js +2 -4
- package/bin/executor/core-engine/CoreEngineUiStreamCollector.js.map +1 -1
- package/bin/executor/services/ExecutorInflightService.d.ts +39 -0
- package/bin/executor/services/ExecutorInflightService.d.ts.map +1 -0
- package/bin/executor/services/ExecutorInflightService.js +75 -0
- package/bin/executor/services/ExecutorInflightService.js.map +1 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts +103 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.d.ts.map +1 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.js +87 -0
- package/bin/executor/services/ExecutorRecoveryPolicy.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts +19 -0
- package/bin/executor/tools/plugin/PluginToolBridge.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolBridge.js +143 -0
- package/bin/executor/tools/plugin/PluginToolBridge.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts +32 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.js +27 -0
- package/bin/executor/tools/plugin/PluginToolDefinition.js.map +1 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts +14 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.d.ts.map +1 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.js +19 -0
- package/bin/executor/tools/plugin/PluginToolSchemas.js.map +1 -0
- package/bin/executor/tools/plugin/types/PluginTool.d.ts +39 -0
- package/bin/executor/tools/plugin/types/PluginTool.d.ts.map +1 -0
- package/bin/executor/tools/plugin/types/PluginTool.js +9 -0
- package/bin/executor/tools/plugin/types/PluginTool.js.map +1 -0
- package/bin/executor/tools/shell/ShellToolBridge.js +3 -3
- package/bin/executor/tools/shell/ShellToolBridge.js.map +1 -1
- package/bin/executor/types/SessionRun.d.ts +18 -0
- package/bin/executor/types/SessionRun.d.ts.map +1 -1
- package/bin/index.d.ts +10 -1
- package/bin/index.d.ts.map +1 -1
- package/bin/index.js +3 -0
- package/bin/index.js.map +1 -1
- package/bin/plugin/core/BasePlugin.d.ts +2 -2
- package/bin/plugin/core/BasePlugin.d.ts.map +1 -1
- package/bin/plugin/core/BasePlugin.js.map +1 -1
- package/bin/plugin/core/ImagePlugin.d.ts +56 -0
- package/bin/plugin/core/ImagePlugin.d.ts.map +1 -0
- package/bin/plugin/core/ImagePlugin.js +109 -0
- package/bin/plugin/core/ImagePlugin.js.map +1 -0
- package/bin/session/Session.d.ts +14 -83
- package/bin/session/Session.d.ts.map +1 -1
- package/bin/session/Session.js +139 -362
- package/bin/session/Session.js.map +1 -1
- package/bin/session/SessionSystemBuilder.d.ts +2 -1
- package/bin/session/SessionSystemBuilder.d.ts.map +1 -1
- package/bin/session/SessionSystemBuilder.js +2 -3
- package/bin/session/SessionSystemBuilder.js.map +1 -1
- package/bin/session/services/SessionStateService.d.ts +132 -0
- package/bin/session/services/SessionStateService.d.ts.map +1 -0
- package/bin/session/services/SessionStateService.js +242 -0
- package/bin/session/services/SessionStateService.js.map +1 -0
- package/bin/session/services/SessionTurnService.d.ts +66 -0
- package/bin/session/services/SessionTurnService.d.ts.map +1 -0
- package/bin/session/services/SessionTurnService.js +137 -0
- package/bin/session/services/SessionTurnService.js.map +1 -0
- package/bin/session/services/SessionViewService.d.ts +105 -0
- package/bin/session/services/SessionViewService.d.ts.map +1 -0
- package/bin/session/services/SessionViewService.js +184 -0
- package/bin/session/services/SessionViewService.js.map +1 -0
- package/bin/types/agent/AgentOptions.d.ts +18 -0
- package/bin/types/agent/AgentOptions.d.ts.map +1 -1
- package/bin/types/agent/AgentTypes.d.ts +3 -1
- package/bin/types/agent/AgentTypes.d.ts.map +1 -1
- package/bin/types/agent/SessionTypes.d.ts.map +1 -1
- package/bin/types/executor/SessionRunContext.d.ts +66 -0
- package/bin/types/executor/SessionRunContext.d.ts.map +1 -0
- package/bin/types/executor/SessionRunContext.js +10 -0
- package/bin/types/executor/SessionRunContext.js.map +1 -0
- package/bin/types/plugin/ImagePlugin.d.ts +94 -0
- package/bin/types/plugin/ImagePlugin.d.ts.map +1 -0
- package/bin/types/plugin/ImagePlugin.js +10 -0
- package/bin/types/plugin/ImagePlugin.js.map +1 -0
- package/bin/types/session/SessionComposerOptions.d.ts +90 -0
- package/bin/types/session/SessionComposerOptions.d.ts.map +1 -0
- package/bin/types/session/SessionComposerOptions.js +10 -0
- package/bin/types/session/SessionComposerOptions.js.map +1 -0
- package/bin/types/session/SessionLocalState.d.ts +35 -0
- package/bin/types/session/SessionLocalState.d.ts.map +1 -0
- package/bin/types/session/SessionLocalState.js +10 -0
- package/bin/types/session/SessionLocalState.js.map +1 -0
- package/bin/types/session/SessionOptions.d.ts +85 -0
- package/bin/types/session/SessionOptions.d.ts.map +1 -0
- package/bin/types/session/SessionOptions.js +10 -0
- package/bin/types/session/SessionOptions.js.map +1 -0
- package/package.json +1 -1
- package/src/agent/local/Agent.ts +74 -433
- package/src/agent/local/AgentRuntimeFactory.ts +4 -25
- package/src/agent/local/services/AgentAssemblyService.ts +268 -0
- package/src/agent/local/services/AgentLifecycleService.ts +187 -0
- package/src/agent/local/services/AgentSessionManager.ts +291 -0
- package/src/executor/Executor.ts +103 -441
- package/src/executor/README.md +4 -4
- package/src/executor/SessionRunScope.ts +47 -71
- package/src/executor/composer/context/LocalSessionContextComposer.ts +24 -20
- package/src/executor/composer/context/SessionContextComposer.ts +13 -3
- package/src/executor/composer/system/SessionSystemComposer.ts +2 -1
- package/src/executor/composer/system/default/DefaultSessionSystemComposer.ts +3 -4
- package/src/executor/core-engine/CoreEngineRunner.ts +433 -0
- package/src/executor/core-engine/CoreEngineUiStreamCollector.ts +7 -5
- package/src/executor/services/ExecutorInflightService.ts +101 -0
- package/src/executor/services/ExecutorRecoveryPolicy.ts +213 -0
- package/src/executor/tools/plugin/PluginToolBridge.ts +161 -0
- package/src/executor/tools/plugin/PluginToolDefinition.ts +32 -0
- package/src/executor/tools/plugin/PluginToolSchemas.ts +20 -0
- package/src/executor/tools/plugin/types/PluginTool.ts +41 -0
- package/src/executor/tools/shell/ShellToolBridge.ts +3 -3
- package/src/executor/types/SessionRun.ts +20 -0
- package/src/index.ts +33 -0
- package/src/plugin/core/BasePlugin.ts +2 -2
- package/src/plugin/core/ImagePlugin.ts +128 -0
- package/src/session/Session.ts +178 -485
- package/src/session/SessionSystemBuilder.ts +3 -3
- package/src/session/services/SessionStateService.ts +341 -0
- package/src/session/services/SessionTurnService.ts +202 -0
- package/src/session/services/SessionViewService.ts +301 -0
- package/src/types/agent/AgentOptions.ts +25 -0
- package/src/types/agent/AgentTypes.ts +10 -0
- package/src/types/agent/SessionTypes.ts +1 -0
- package/src/types/executor/SessionRunContext.ts +76 -0
- package/src/types/plugin/ImagePlugin.ts +103 -0
- package/src/types/session/SessionComposerOptions.ts +107 -0
- package/src/types/session/SessionLocalState.ts +40 -0
- package/src/types/session/SessionOptions.ts +99 -0
- package/tsconfig.tsbuildinfo +1 -1
package/bin/index.js
CHANGED
|
@@ -9,13 +9,16 @@
|
|
|
9
9
|
// Agent 入口
|
|
10
10
|
export { Agent } from "./agent/local/Agent.js";
|
|
11
11
|
export { RemoteAgent } from "./agent/remote/RemoteAgent.js";
|
|
12
|
+
export { Session } from "./session/Session.js";
|
|
12
13
|
export { inferAgentModelLabel, normalizeAgentModel, } from "./model/CityModelAdapter.js";
|
|
13
14
|
// Plugin 作者 API
|
|
14
15
|
export { BasePlugin } from "./plugin/core/BasePlugin.js";
|
|
16
|
+
export { ImagePlugin } from "./plugin/core/ImagePlugin.js";
|
|
15
17
|
// Session 与即时执行集成
|
|
16
18
|
export { Executor } from "./executor/Executor.js";
|
|
17
19
|
export { drainDeferredPersistedUserMessages, getSessionRunScope, } from "./executor/SessionRunScope.js";
|
|
18
20
|
export { JsonlSessionHistoryComposer } from "./executor/composer/history/jsonl/JsonlSessionHistoryComposer.js";
|
|
21
|
+
export { LocalSessionContextComposer } from "./executor/composer/context/LocalSessionContextComposer.js";
|
|
19
22
|
export { JsonlSessionHistoryStore } from "./executor/store/history/jsonl/JsonlSessionHistoryStore.js";
|
|
20
23
|
export { JsonlSessionCompactionComposer } from "./executor/composer/compaction/jsonl/JsonlSessionCompactionComposer.js";
|
|
21
24
|
export { transformPromptsIntoSystemMessages } from "./executor/composer/system/default/PromptRenderer.js";
|
package/bin/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,WAAW;AACX,OAAO,EAAE,KAAK,EAAE,MAAM,wBAAwB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,+BAA+B,CAAC;AAC5D,OAAO,EACL,oBAAoB,EACpB,mBAAmB,GACpB,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index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AO,EACL,kCAAkC,GACnC,MAAM,gCAAgC,CAAC;AAExC,eAAe;AACf,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,sBAAsB;AACtB,OAAO,EACL,eAAe,EACf,cAAc,GACf,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAC3E,OAAO,EAAE,iCAAiC,EAAE,MAAM,qCAAqC,CAAC;AACxF,OAAO,EACL,8BAA8B,EAC9B,qCAAqC,GACtC,MAAM,wCAAwC,CAAC;AAEhD,iBAAiB;AACjB,OAAO,EAAE,0BAA0B,EAAE,MAAM,qCAAqC,CAAC;AAEjF,UAAU;AACV,OAAO,EACL,sBAAsB,EACtB,yBAAyB,EACzB,uBAAuB,GACxB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AACxD,OAAO,EACL,yBAAyB,GAC1B,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAE5E,KAAK;AACL,OAAO,EAAE,SAAS,EAAE,MAAM,EAAe,MAAM,0BAA0B,CAAC;AAmJ1E,iBAAiB;AACjB,OAAO,EACL,uBAAuB,EACvB,kBAAkB,EAClB,4BAA4B,EAC5B,oBAAoB,GACrB,MAAM,wCAAwC,CAAC"}
|
|
@@ -30,11 +30,11 @@ export declare abstract class BasePlugin implements Plugin {
|
|
|
30
30
|
/**
|
|
31
31
|
* 插件标题。
|
|
32
32
|
*/
|
|
33
|
-
readonly title
|
|
33
|
+
readonly title: string;
|
|
34
34
|
/**
|
|
35
35
|
* 插件说明。
|
|
36
36
|
*/
|
|
37
|
-
readonly description
|
|
37
|
+
readonly description: string;
|
|
38
38
|
/**
|
|
39
39
|
* 插件配置定义。
|
|
40
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAuC,CAAC;AAE9E;;GAEG;AACH,8BAAsB,UAAW,YAAW,MAAM;IAChD;;OAEG;IACH,SAAgB,iBAAiB,EAAE,iBAAiB,CAIlD;IAEF;;OAEG;IACH,SAAS,CAAC,KAAK,EAAE,YAAY,GAAG,IAAI,CAAC;gBAEzB,KAAK,GAAE,YAAY,GAAG,IAAW;IAI7C;;OAEG;IACH,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAE/B;;OAEG;IACH,QAAQ,CAAC,KAAK,MAAM;
|
|
1
|
+
{"version":3,"file":"BasePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EACV,MAAM,EACN,aAAa,EACb,kBAAkB,EAClB,oBAAoB,EACpB,sBAAsB,EACtB,WAAW,EACX,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,iBAAiB,EACjB,qBAAqB,EACtB,MAAM,0BAA0B,CAAC;AAClC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uCAAu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AI,YAAY;CAMvC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC9B;;OAEG;IACa,iBAAiB,GAAsB;QACrD,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;KACzB,CAAC;IAEF;;OAEG;IACO,KAAK,CAAsB;IAErC,YAAY,QAA6B,IAAI;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAOD;;OAEG;IACM,KAAK,
|
|
1
|
+
{"version":3,"file":"BasePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/BasePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAoBH;;GAEG;AACH,MAAM,OAAgB,UAAU;IAC9B;;OAEG;IACa,iBAAiB,GAAsB;QACrD,KAAK,EAAE,SAAS;QAChB,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;QACrB,KAAK,EAAE,OAAO,CAAC,OAAO,EAAE;KACzB,CAAC;IAEF;;OAEG;IACO,KAAK,CAAsB;IAErC,YAAY,QAA6B,IAAI;QAC3C,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAOD;;OAEG;IACM,KAAK,GAAW,EAAE,CAAC;IAE5B;;OAEG;IACM,WAAW,GAAW,EAAE,CAAC;IAElC;;OAEG;IACM,MAAM,CAA4C;IAE3D;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,KAAK,CAAyB;IAEvC;;OAEG;IACM,OAAO,GAAkB,EAAE,CAAC;IAErC;;OAEG;IACM,KAAK,CAAe;IAE7B;;OAEG;IACM,QAAQ,CAAkB;IAEnC;;OAEG;IACM,IAAI,CAAwB;IAErC;;OAEG;IACH,SAAS,CAAmB;IAc5B;;OAEG;IACH,SAAS,CAAC,KAA0B;QAClC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;QACnB,OAAO,IAAI,CAAC;IACd,CAAC;IAED;;OAEG;IACO,YAAY;QACpB,IAAI,IAAI,CAAC,KAAK;YAAE,OAAO,IAAI,CAAC,KAAK,CAAC;QAClC,MAAM,IAAI,KAAK,CACb,WAAW,IAAI,CAAC,IAAI,sCAAsC,CAC3D,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImagePlugin:Agent 内置图片生成插件。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 插件只负责把外部 image 函数暴露为 agent 可调用 action。
|
|
6
|
+
* - 具体模型、Provider、鉴权与上游协议由调用方传入的 image 函数处理。
|
|
7
|
+
* - action 返回 AI SDK UIMessage,后续由 plugin tool bridge 抽取 file parts 写回 assistant 消息。
|
|
8
|
+
*/
|
|
9
|
+
import type { AgentContext } from "../../types/runtime/agent/AgentContext.js";
|
|
10
|
+
import type { JsonObject, JsonValue } from "../../types/common/Json.js";
|
|
11
|
+
import type { ImagePluginOptions } from "../../types/plugin/ImagePlugin.js";
|
|
12
|
+
import { BasePlugin } from "../../plugin/core/BasePlugin.js";
|
|
13
|
+
/**
|
|
14
|
+
* Agent 图片生成插件。
|
|
15
|
+
*/
|
|
16
|
+
export declare class ImagePlugin extends BasePlugin {
|
|
17
|
+
/**
|
|
18
|
+
* 当前 plugin 稳定名称。
|
|
19
|
+
*/
|
|
20
|
+
readonly name: string;
|
|
21
|
+
/**
|
|
22
|
+
* 插件标题。
|
|
23
|
+
*/
|
|
24
|
+
readonly title: string;
|
|
25
|
+
/**
|
|
26
|
+
* 插件说明。
|
|
27
|
+
*/
|
|
28
|
+
readonly description: string;
|
|
29
|
+
private readonly image;
|
|
30
|
+
constructor(options: ImagePluginOptions);
|
|
31
|
+
/**
|
|
32
|
+
* 图片插件给模型的最小使用说明。
|
|
33
|
+
*/
|
|
34
|
+
system(_context: AgentContext): string;
|
|
35
|
+
/**
|
|
36
|
+
* 显式 action 集合。
|
|
37
|
+
*/
|
|
38
|
+
readonly actions: {
|
|
39
|
+
generate: {
|
|
40
|
+
execute: ({ payload }: {
|
|
41
|
+
payload: JsonValue;
|
|
42
|
+
}) => Promise<{
|
|
43
|
+
success: boolean;
|
|
44
|
+
data: JsonObject;
|
|
45
|
+
message: string;
|
|
46
|
+
error?: undefined;
|
|
47
|
+
} | {
|
|
48
|
+
success: boolean;
|
|
49
|
+
error: string;
|
|
50
|
+
message: string;
|
|
51
|
+
data?: undefined;
|
|
52
|
+
}>;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=ImagePlugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePlugin.d.ts","sourceRoot":"","sources":["../../../src/plugin/core/ImagePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAC1E,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACpE,OAAO,KAAK,EAEV,kBAAkB,EAEnB,MAAM,+BAA+B,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAqCzD;;GAEG;AACH,qBAAa,WAAY,SAAQ,UAAU;IACzC;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IAEtB;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAE7B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAA8B;gBAExC,OAAO,EAAE,kBAAkB;IAiBvC;;OAEG;IACH,MAAM,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM;IAStC;;OAEG;IACH,QAAQ,CAAC,OAAO;;mCAEiB;gBAAE,OAAO,EAAE,SAAS,CAAA;aAAE;;sBAMjB,UAAU;;;;;;;;;;MAY9C;CACH"}
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ImagePlugin:Agent 内置图片生成插件。
|
|
3
|
+
*
|
|
4
|
+
* 关键点(中文)
|
|
5
|
+
* - 插件只负责把外部 image 函数暴露为 agent 可调用 action。
|
|
6
|
+
* - 具体模型、Provider、鉴权与上游协议由调用方传入的 image 函数处理。
|
|
7
|
+
* - action 返回 AI SDK UIMessage,后续由 plugin tool bridge 抽取 file parts 写回 assistant 消息。
|
|
8
|
+
*/
|
|
9
|
+
import { BasePlugin } from "../../plugin/core/BasePlugin.js";
|
|
10
|
+
const DEFAULT_IMAGE_PLUGIN_NAME = "image";
|
|
11
|
+
const DEFAULT_IMAGE_PLUGIN_TITLE = "Image";
|
|
12
|
+
const DEFAULT_IMAGE_PLUGIN_DESCRIPTION = "Generate images and return them as assistant file parts.";
|
|
13
|
+
/**
|
|
14
|
+
* 判断值是否为普通对象。
|
|
15
|
+
*/
|
|
16
|
+
function to_record(value) {
|
|
17
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
18
|
+
return null;
|
|
19
|
+
return value;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 归一化模型传入的图片生成 payload。
|
|
23
|
+
*/
|
|
24
|
+
function normalize_image_payload(payload) {
|
|
25
|
+
const record = to_record(payload ?? {});
|
|
26
|
+
if (!record) {
|
|
27
|
+
throw new TypeError("ImagePlugin.generate payload must be an object");
|
|
28
|
+
}
|
|
29
|
+
return { ...record };
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* 校验 image 函数返回的 UIMessage。
|
|
33
|
+
*/
|
|
34
|
+
function normalize_image_result(result) {
|
|
35
|
+
const record = to_record(result);
|
|
36
|
+
if (!record || !Array.isArray(record.parts)) {
|
|
37
|
+
throw new TypeError("ImagePlugin image function must return an AI SDK UIMessage");
|
|
38
|
+
}
|
|
39
|
+
return result;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Agent 图片生成插件。
|
|
43
|
+
*/
|
|
44
|
+
export class ImagePlugin extends BasePlugin {
|
|
45
|
+
/**
|
|
46
|
+
* 当前 plugin 稳定名称。
|
|
47
|
+
*/
|
|
48
|
+
name;
|
|
49
|
+
/**
|
|
50
|
+
* 插件标题。
|
|
51
|
+
*/
|
|
52
|
+
title;
|
|
53
|
+
/**
|
|
54
|
+
* 插件说明。
|
|
55
|
+
*/
|
|
56
|
+
description;
|
|
57
|
+
image;
|
|
58
|
+
constructor(options) {
|
|
59
|
+
super();
|
|
60
|
+
const name = String(options.name || DEFAULT_IMAGE_PLUGIN_NAME).trim();
|
|
61
|
+
if (!name) {
|
|
62
|
+
throw new Error("ImagePlugin requires a non-empty name");
|
|
63
|
+
}
|
|
64
|
+
if (typeof options.image !== "function") {
|
|
65
|
+
throw new Error("ImagePlugin requires an image(input) function");
|
|
66
|
+
}
|
|
67
|
+
this.name = name;
|
|
68
|
+
this.title = String(options.title || DEFAULT_IMAGE_PLUGIN_TITLE).trim();
|
|
69
|
+
this.description = String(options.description || DEFAULT_IMAGE_PLUGIN_DESCRIPTION).trim();
|
|
70
|
+
this.image = options.image;
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* 图片插件给模型的最小使用说明。
|
|
74
|
+
*/
|
|
75
|
+
system(_context) {
|
|
76
|
+
return [
|
|
77
|
+
"Image generation is available through the plugin_call tool.",
|
|
78
|
+
`Call plugin "${this.name}" action "generate" when the user asks to create, render, draw, or edit an image.`,
|
|
79
|
+
"Pass a JSON payload with prompt, optional size/aspect_ratio/quality/n, and optional provider_options.",
|
|
80
|
+
"The generated image files will be attached to the final assistant message automatically.",
|
|
81
|
+
].join("\n");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* 显式 action 集合。
|
|
85
|
+
*/
|
|
86
|
+
actions = {
|
|
87
|
+
generate: {
|
|
88
|
+
execute: async ({ payload }) => {
|
|
89
|
+
try {
|
|
90
|
+
const input = normalize_image_payload(payload);
|
|
91
|
+
const message = normalize_image_result(await this.image(input));
|
|
92
|
+
return {
|
|
93
|
+
success: true,
|
|
94
|
+
data: message,
|
|
95
|
+
message: "image generated",
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return {
|
|
100
|
+
success: false,
|
|
101
|
+
error: String(error),
|
|
102
|
+
message: String(error),
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
//# sourceMappingURL=ImagePlugin.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ImagePlugin.js","sourceRoot":"","sources":["../../../src/plugin/core/ImagePlugin.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AASH,OAAO,EAAE,UAAU,EAAE,MAAM,6BAA6B,CAAC;AAEzD,MAAM,yBAAyB,GAAG,OAAO,CAAC;AAC1C,MAAM,0BAA0B,GAAG,OAAO,CAAC;AAC3C,MAAM,gCAAgC,GACpC,0DAA0D,CAAC;AAE7D;;GAEG;AACH,SAAS,SAAS,CAAC,KAAc;IAC/B,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,IAAI,CAAC;IAC7E,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED;;GAEG;AACH,SAAS,uBAAuB,CAAC,OAA8B;IAC7D,MAAM,MAAM,GAAG,SAAS,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IACxC,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,SAAS,CAAC,gDAAgD,CAAC,CAAC;IACxE,CAAC;IACD,OAAO,EAAE,G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;YAC7D,gBAAgB,IAAI,CAAC,IAAI,mFAAmF;YAC5G,uGAAuG;YACvG,0FAA0F;SAC3F,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IACf,CAAC;IAED;;OAEG;IACM,OAAO,GAAG;QACjB,QAAQ,EAAE;YACR,OAAO,EAAE,KAAK,EAAE,EAAE,OAAO,EAA0B,EAAE,EAAE;gBACrD,IAAI,CAAC;oBACH,MAAM,KAAK,GAAG,uBAAuB,CAAC,OAAO,CAAC,CAAC;oBAC/C,MAAM,OAAO,GAAG,sBAAsB,CAAC,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;oBAChE,OAAO;wBACL,OAAO,EAAE,IAAI;wBACb,IAAI,EAAE,OAAgC;wBACtC,OAAO,EAAE,iBAAiB;qBAC3B,CAAC;gBACJ,CAAC;gBAAC,OAAO,KAAK,EAAE,CAAC;oBACf,OAAO;wBACL,OAAO,EAAE,KAAK;wBACd,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC;wBACpB,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC;qBACvB,CAAC;gBACJ,CAAC;YACH,CAAC;SACF;KACF,CAAC;CACH"}
|
package/bin/session/Session.d.ts
CHANGED
|
@@ -3,60 +3,15 @@
|
|
|
3
3
|
*
|
|
4
4
|
* 关键点(中文)
|
|
5
5
|
* - 面向 `new Agent(...)` 的本地会话使用场景。
|
|
6
|
-
* -
|
|
6
|
+
* - 对外保留稳定 Session facade,把状态、turn、view 逻辑下沉到独立 service。
|
|
7
7
|
* - 内部继续复用 `Executor` / `JsonlSessionHistoryStore` / Composer 体系。
|
|
8
8
|
*/
|
|
9
|
-
import type {
|
|
10
|
-
import type { AgentSession, AgentSessionHistoryInput, AgentSessionHistoryPage, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionInfo, AgentSessionSetInput, AgentSessionSystemBlock, AgentSessionSystemSnapshot } from "../types/agent/AgentTypes.js";
|
|
9
|
+
import type { AgentSession, AgentSessionConfigSnapshot, AgentSessionForkInput, AgentSessionHistoryInput, AgentSessionHistoryPage, AgentSessionInfo, AgentSessionSetInput, AgentSessionSystemSnapshot } from "../types/agent/AgentTypes.js";
|
|
11
10
|
import type { SessionPort } from "../types/runtime/agent/AgentContext.js";
|
|
12
11
|
import type { AgentSessionSubscriber, AgentSessionUnsubscribe } from "../types/sdk/AgentSessionEvent.js";
|
|
13
12
|
import type { AgentSessionPromptInput } from "../types/sdk/AgentSessionPrompt.js";
|
|
14
13
|
import type { AgentSessionTurnHandle } from "../types/sdk/AgentSessionTurn.js";
|
|
15
|
-
type SessionOptions
|
|
16
|
-
/**
|
|
17
|
-
* 当前 agent 稳定标识。
|
|
18
|
-
*/
|
|
19
|
-
agentId: string;
|
|
20
|
-
/**
|
|
21
|
-
* 当前项目根目录。
|
|
22
|
-
*/
|
|
23
|
-
projectRoot: string;
|
|
24
|
-
/**
|
|
25
|
-
* 当前 sessionId。
|
|
26
|
-
*/
|
|
27
|
-
sessionId: string;
|
|
28
|
-
/**
|
|
29
|
-
* 当前 agent 默认工具集合。
|
|
30
|
-
*/
|
|
31
|
-
tools: Record<string, Tool>;
|
|
32
|
-
/**
|
|
33
|
-
* 统一日志器。
|
|
34
|
-
*/
|
|
35
|
-
logger: {
|
|
36
|
-
info(message: string, details?: Record<string, unknown>): void;
|
|
37
|
-
warn(message: string, details?: Record<string, unknown>): void;
|
|
38
|
-
};
|
|
39
|
-
/**
|
|
40
|
-
* 读取当前 SDK 调用方传入的 instruction system blocks。
|
|
41
|
-
*/
|
|
42
|
-
getInstructionSystemBlocks: () => AgentSessionSystemBlock[];
|
|
43
|
-
/**
|
|
44
|
-
* 读取当前 agent 显式注入的受托管 plugin system blocks。
|
|
45
|
-
*/
|
|
46
|
-
getManagedPluginSystemBlocks: () => Promise<AgentSessionSystemBlock[]>;
|
|
47
|
-
/**
|
|
48
|
-
* 读取当前 agent 显式注册 plugin 的 system blocks。
|
|
49
|
-
*/
|
|
50
|
-
getPluginSystemBlocks: () => Promise<AgentSessionSystemBlock[]>;
|
|
51
|
-
/**
|
|
52
|
-
* 在执行前确保当前 session 已完成宿主侧默认配置。
|
|
53
|
-
*
|
|
54
|
-
* 关键点(中文)
|
|
55
|
-
* - 这里通常由 `Agent` 注入,用于补齐默认 model 等一次性装配。
|
|
56
|
-
* - 所有执行入口都应通过这里兜底,避免只在 SDK `agent.createSession()` / `agent.getSession()` 链路上做配置。
|
|
57
|
-
*/
|
|
58
|
-
ensureConfigured?: (session: Session) => Promise<void>;
|
|
59
|
-
};
|
|
14
|
+
import type { SessionOptions } from "../types/session/SessionOptions.js";
|
|
60
15
|
/**
|
|
61
16
|
* SDK 本地 Session。
|
|
62
17
|
*/
|
|
@@ -70,20 +25,19 @@ export declare class Session implements AgentSession {
|
|
|
70
25
|
private readonly getManagedPluginSystemBlocks;
|
|
71
26
|
private readonly getPluginSystemBlocks;
|
|
72
27
|
private readonly ensureConfiguredHook?;
|
|
28
|
+
private readonly composers?;
|
|
73
29
|
private readonly historyStore;
|
|
74
30
|
private readonly historyComposer;
|
|
75
31
|
private readonly executor;
|
|
76
32
|
private readonly eventHub;
|
|
77
|
-
private readonly
|
|
78
|
-
private
|
|
79
|
-
private
|
|
80
|
-
private
|
|
81
|
-
private initializePromise;
|
|
82
|
-
private ensureConfiguredPromise;
|
|
33
|
+
private readonly localState;
|
|
34
|
+
private readonly stateService;
|
|
35
|
+
private readonly turnService;
|
|
36
|
+
private readonly viewService;
|
|
83
37
|
private runtimePort;
|
|
84
38
|
constructor(options: SessionOptions);
|
|
85
39
|
/**
|
|
86
|
-
* 初始化当前 session
|
|
40
|
+
* 初始化当前 session。
|
|
87
41
|
*/
|
|
88
42
|
initialize(): Promise<this>;
|
|
89
43
|
/**
|
|
@@ -96,36 +50,22 @@ export declare class Session implements AgentSession {
|
|
|
96
50
|
set(input: AgentSessionSetInput): Promise<void>;
|
|
97
51
|
/**
|
|
98
52
|
* 追加一条新的 Session prompt。
|
|
99
|
-
*
|
|
100
|
-
* 关键点(中文)
|
|
101
|
-
* - 这是 Session actor 模型下唯一的输入入口。
|
|
102
|
-
* - 首条输入、运行中补充输入、排到下一轮的输入,调用方式完全一致。
|
|
103
53
|
*/
|
|
104
54
|
prompt(input: AgentSessionPromptInput): Promise<AgentSessionTurnHandle>;
|
|
105
55
|
/**
|
|
106
56
|
* 订阅当前 Session 的未来事件。
|
|
107
|
-
*
|
|
108
|
-
* 关键点(中文)
|
|
109
|
-
* - 只广播订阅之后产生的事件。
|
|
110
|
-
* - 不做历史回放;历史仍通过 `history()` 读取。
|
|
111
57
|
*/
|
|
112
58
|
subscribe(subscriber: AgentSessionSubscriber): AgentSessionUnsubscribe;
|
|
113
59
|
/**
|
|
114
60
|
* 追加一条 user 文本消息。
|
|
115
61
|
*/
|
|
116
62
|
appendUserMessage(input: {
|
|
117
|
-
/**
|
|
118
|
-
* 需要写入的用户文本。
|
|
119
|
-
*/
|
|
120
63
|
text: string;
|
|
121
64
|
}): Promise<void>;
|
|
122
65
|
/**
|
|
123
66
|
* 追加一条 assistant 文本消息。
|
|
124
67
|
*/
|
|
125
68
|
appendAssistantMessage(input: {
|
|
126
|
-
/**
|
|
127
|
-
* 需要写入的 assistant 文本。
|
|
128
|
-
*/
|
|
129
69
|
text: string;
|
|
130
70
|
}): Promise<void>;
|
|
131
71
|
/**
|
|
@@ -137,12 +77,7 @@ export declare class Session implements AgentSession {
|
|
|
137
77
|
*/
|
|
138
78
|
history(input?: AgentSessionHistoryInput): Promise<AgentSessionHistoryPage>;
|
|
139
79
|
/**
|
|
140
|
-
* 读取当前 session 生效的 system
|
|
141
|
-
*
|
|
142
|
-
* 关键点(中文)
|
|
143
|
-
* - 返回内容与实际 run 时使用的 SDK system composer 同源。
|
|
144
|
-
* - 包含 instruction/core、受托管 plugin system、显式注册 plugin system 与 session 上下文。
|
|
145
|
-
* - 返回结构化快照,不把 system prompt 写入会话历史。
|
|
80
|
+
* 读取当前 session 生效的 system 快照。
|
|
146
81
|
*/
|
|
147
82
|
system(): Promise<AgentSessionSystemSnapshot>;
|
|
148
83
|
/**
|
|
@@ -165,13 +100,9 @@ export declare class Session implements AgentSession {
|
|
|
165
100
|
* 在执行前确保 session 已完成初始化与宿主装配。
|
|
166
101
|
*/
|
|
167
102
|
ensureReadyForExecution(): Promise<void>;
|
|
168
|
-
private
|
|
169
|
-
private
|
|
170
|
-
private
|
|
171
|
-
private
|
|
172
|
-
private createAndPersistUserPromptMessage;
|
|
173
|
-
private executePromptTurn;
|
|
174
|
-
private persistDeferredUserMessages;
|
|
103
|
+
private createChildSession;
|
|
104
|
+
private create_composer_context;
|
|
105
|
+
private resolve_composer;
|
|
106
|
+
private resolve_optional_composer;
|
|
175
107
|
}
|
|
176
|
-
export {};
|
|
177
108
|
//# sourceMappingURL=Session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/session/Session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"Session.d.ts","sourceRoot":"","sources":["../../src/session/Session.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAMH,OAAO,KAAK,EACV,YAAY,EACZ,0BAA0B,EAC1B,qBAAqB,EACrB,wBAAwB,EACxB,uBAAuB,EACvB,gBAAgB,EAChB,oBAAoB,EAEpB,0BAA0B,EAC3B,MAAM,6BAA6B,CAAC;AASrC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,uCAAuC,CAAC;AACzE,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,kCAAkC,CAAC;AAC1C,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AACjF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,iCAAiC,CAAC;AAe9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAExE;;GAEG;AACH,qBAAa,OAAQ,YAAW,YAAY;IAC1C,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