@aigne/core 1.72.0 → 1.74.0-beta
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 +11 -11
- package/dist/_virtual/rolldown_runtime.cjs +29 -0
- package/dist/agents/agent.cjs +874 -0
- package/dist/agents/agent.d.cts +967 -0
- package/dist/agents/agent.d.cts.map +1 -0
- package/dist/agents/agent.d.mts +967 -0
- package/dist/agents/agent.d.mts.map +1 -0
- package/dist/agents/agent.mjs +863 -0
- package/dist/agents/agent.mjs.map +1 -0
- package/dist/agents/ai-agent.cjs +524 -0
- package/dist/agents/ai-agent.d.cts +401 -0
- package/dist/agents/ai-agent.d.cts.map +1 -0
- package/dist/agents/ai-agent.d.mts +401 -0
- package/dist/agents/ai-agent.d.mts.map +1 -0
- package/dist/agents/ai-agent.mjs +519 -0
- package/dist/agents/ai-agent.mjs.map +1 -0
- package/dist/agents/chat-model.cjs +397 -0
- package/dist/agents/chat-model.d.cts +674 -0
- package/dist/agents/chat-model.d.cts.map +1 -0
- package/dist/agents/chat-model.d.mts +674 -0
- package/dist/agents/chat-model.d.mts.map +1 -0
- package/dist/agents/chat-model.mjs +391 -0
- package/dist/agents/chat-model.mjs.map +1 -0
- package/dist/agents/guide-rail-agent.cjs +17 -0
- package/dist/agents/guide-rail-agent.d.cts +67 -0
- package/dist/agents/guide-rail-agent.d.cts.map +1 -0
- package/dist/agents/guide-rail-agent.d.mts +67 -0
- package/dist/agents/guide-rail-agent.d.mts.map +1 -0
- package/dist/agents/guide-rail-agent.mjs +17 -0
- package/dist/agents/guide-rail-agent.mjs.map +1 -0
- package/dist/agents/image-agent.cjs +74 -0
- package/dist/agents/image-agent.d.cts +44 -0
- package/dist/agents/image-agent.d.cts.map +1 -0
- package/dist/agents/image-agent.d.mts +44 -0
- package/dist/agents/image-agent.d.mts.map +1 -0
- package/dist/agents/image-agent.mjs +72 -0
- package/dist/agents/image-agent.mjs.map +1 -0
- package/dist/agents/image-model.cjs +83 -0
- package/dist/agents/image-model.d.cts +276 -0
- package/dist/agents/image-model.d.cts.map +1 -0
- package/dist/agents/image-model.d.mts +276 -0
- package/dist/agents/image-model.d.mts.map +1 -0
- package/dist/agents/image-model.mjs +81 -0
- package/dist/agents/image-model.mjs.map +1 -0
- package/dist/agents/mcp-agent.cjs +307 -0
- package/dist/agents/mcp-agent.d.cts +235 -0
- package/dist/agents/mcp-agent.d.cts.map +1 -0
- package/dist/agents/mcp-agent.d.mts +235 -0
- package/dist/agents/mcp-agent.d.mts.map +1 -0
- package/dist/agents/mcp-agent.mjs +303 -0
- package/dist/agents/mcp-agent.mjs.map +1 -0
- package/dist/agents/model.cjs +143 -0
- package/dist/agents/model.d.cts +257 -0
- package/dist/agents/model.d.cts.map +1 -0
- package/dist/agents/model.d.mts +257 -0
- package/dist/agents/model.d.mts.map +1 -0
- package/dist/agents/model.mjs +136 -0
- package/dist/agents/model.mjs.map +1 -0
- package/dist/agents/team-agent.cjs +342 -0
- package/dist/agents/team-agent.d.cts +390 -0
- package/dist/agents/team-agent.d.cts.map +1 -0
- package/dist/agents/team-agent.d.mts +390 -0
- package/dist/agents/team-agent.d.mts.map +1 -0
- package/dist/agents/team-agent.mjs +339 -0
- package/dist/agents/team-agent.mjs.map +1 -0
- package/dist/agents/transform-agent.cjs +77 -0
- package/dist/agents/transform-agent.d.cts +99 -0
- package/dist/agents/transform-agent.d.cts.map +1 -0
- package/dist/agents/transform-agent.d.mts +99 -0
- package/dist/agents/transform-agent.d.mts.map +1 -0
- package/dist/agents/transform-agent.mjs +76 -0
- package/dist/agents/transform-agent.mjs.map +1 -0
- package/dist/agents/types.cjs +30 -0
- package/dist/agents/types.d.cts +34 -0
- package/dist/agents/types.d.cts.map +1 -0
- package/dist/agents/types.d.mts +34 -0
- package/dist/agents/types.d.mts.map +1 -0
- package/dist/agents/types.mjs +25 -0
- package/dist/agents/types.mjs.map +1 -0
- package/dist/agents/user-agent.cjs +87 -0
- package/dist/agents/user-agent.d.cts +32 -0
- package/dist/agents/user-agent.d.cts.map +1 -0
- package/dist/agents/user-agent.d.mts +32 -0
- package/dist/agents/user-agent.d.mts.map +1 -0
- package/dist/agents/user-agent.mjs +88 -0
- package/dist/agents/user-agent.mjs.map +1 -0
- package/dist/agents/video-model.cjs +66 -0
- package/dist/agents/video-model.d.cts +286 -0
- package/dist/agents/video-model.d.cts.map +1 -0
- package/dist/agents/video-model.d.mts +286 -0
- package/dist/agents/video-model.d.mts.map +1 -0
- package/dist/agents/video-model.mjs +64 -0
- package/dist/agents/video-model.mjs.map +1 -0
- package/dist/aigne/aigne.cjs +235 -0
- package/dist/aigne/aigne.d.cts +340 -0
- package/dist/aigne/aigne.d.cts.map +1 -0
- package/dist/aigne/aigne.d.mts +340 -0
- package/dist/aigne/aigne.d.mts.map +1 -0
- package/dist/aigne/aigne.mjs +235 -0
- package/dist/aigne/aigne.mjs.map +1 -0
- package/dist/aigne/context.cjs +377 -0
- package/dist/aigne/context.d.cts +226 -0
- package/dist/aigne/context.d.cts.map +1 -0
- package/dist/aigne/context.d.mts +226 -0
- package/dist/aigne/context.d.mts.map +1 -0
- package/dist/aigne/context.mjs +376 -0
- package/dist/aigne/context.mjs.map +1 -0
- package/dist/aigne/index.cjs +4 -0
- package/dist/aigne/index.d.mts +5 -0
- package/dist/aigne/index.mjs +6 -0
- package/dist/aigne/message-queue.cjs +102 -0
- package/dist/aigne/message-queue.d.cts +52 -0
- package/dist/aigne/message-queue.d.cts.map +1 -0
- package/dist/aigne/message-queue.d.mts +52 -0
- package/dist/aigne/message-queue.d.mts.map +1 -0
- package/dist/aigne/message-queue.mjs +99 -0
- package/dist/aigne/message-queue.mjs.map +1 -0
- package/dist/aigne/type.d.cts +32 -0
- package/dist/aigne/type.d.cts.map +1 -0
- package/dist/aigne/type.d.mts +32 -0
- package/dist/aigne/type.d.mts.map +1 -0
- package/dist/aigne/usage.cjs +29 -0
- package/dist/aigne/usage.d.cts +32 -0
- package/dist/aigne/usage.d.cts.map +1 -0
- package/dist/aigne/usage.d.mts +32 -0
- package/dist/aigne/usage.d.mts.map +1 -0
- package/dist/aigne/usage.mjs +28 -0
- package/dist/aigne/usage.mjs.map +1 -0
- package/dist/index.cjs +142 -0
- package/dist/index.d.cts +29 -0
- package/dist/index.d.mts +31 -0
- package/dist/index.mjs +31 -0
- package/dist/loader/agent-js.cjs +23 -0
- package/dist/loader/agent-js.d.cts +9 -0
- package/dist/loader/agent-js.d.cts.map +1 -0
- package/dist/loader/agent-js.d.mts +10 -0
- package/dist/loader/agent-js.d.mts.map +1 -0
- package/dist/loader/agent-js.mjs +23 -0
- package/dist/loader/agent-js.mjs.map +1 -0
- package/dist/loader/agent-yaml.cjs +109 -0
- package/dist/loader/agent-yaml.d.cts +87 -0
- package/dist/loader/agent-yaml.d.cts.map +1 -0
- package/dist/loader/agent-yaml.d.mts +87 -0
- package/dist/loader/agent-yaml.d.mts.map +1 -0
- package/dist/loader/agent-yaml.mjs +106 -0
- package/dist/loader/agent-yaml.mjs.map +1 -0
- package/dist/loader/agents.cjs +19 -0
- package/dist/loader/agents.d.cts +9 -0
- package/dist/loader/agents.d.cts.map +1 -0
- package/dist/loader/agents.d.mts +9 -0
- package/dist/loader/agents.d.mts.map +1 -0
- package/dist/loader/agents.mjs +20 -0
- package/dist/loader/agents.mjs.map +1 -0
- package/dist/loader/error.cjs +6 -0
- package/dist/loader/error.d.cts +5 -0
- package/dist/loader/error.d.cts.map +1 -0
- package/dist/loader/error.d.mts +5 -0
- package/dist/loader/error.d.mts.map +1 -0
- package/dist/loader/error.mjs +6 -0
- package/dist/loader/error.mjs.map +1 -0
- package/dist/loader/function-agent.cjs +9 -0
- package/dist/loader/function-agent.d.cts +7 -0
- package/dist/loader/function-agent.d.cts.map +1 -0
- package/dist/loader/function-agent.d.mts +7 -0
- package/dist/loader/function-agent.d.mts.map +1 -0
- package/dist/loader/function-agent.mjs +9 -0
- package/dist/loader/function-agent.mjs.map +1 -0
- package/dist/loader/index.cjs +233 -0
- package/dist/loader/index.d.cts +255 -0
- package/dist/loader/index.d.cts.map +1 -0
- package/dist/loader/index.d.mts +255 -0
- package/dist/loader/index.d.mts.map +1 -0
- package/dist/loader/index.mjs +228 -0
- package/dist/loader/index.mjs.map +1 -0
- package/dist/loader/schema.cjs +135 -0
- package/dist/loader/schema.d.cts +177 -0
- package/dist/loader/schema.d.cts.map +1 -0
- package/dist/loader/schema.d.mts +177 -0
- package/dist/loader/schema.d.mts.map +1 -0
- package/dist/loader/schema.mjs +127 -0
- package/dist/loader/schema.mjs.map +1 -0
- package/dist/memory/index.cjs +3 -0
- package/dist/memory/index.d.mts +3 -0
- package/dist/memory/index.mjs +5 -0
- package/dist/memory/memory.cjs +134 -0
- package/dist/memory/memory.d.cts +103 -0
- package/dist/memory/memory.d.cts.map +1 -0
- package/dist/memory/memory.d.mts +103 -0
- package/dist/memory/memory.d.mts.map +1 -0
- package/dist/memory/memory.mjs +133 -0
- package/dist/memory/memory.mjs.map +1 -0
- package/dist/memory/recorder.cjs +61 -0
- package/dist/memory/recorder.d.cts +98 -0
- package/dist/memory/recorder.d.cts.map +1 -0
- package/dist/memory/recorder.d.mts +98 -0
- package/dist/memory/recorder.d.mts.map +1 -0
- package/dist/memory/recorder.mjs +59 -0
- package/dist/memory/recorder.mjs.map +1 -0
- package/dist/memory/retriever.cjs +60 -0
- package/dist/memory/retriever.d.cts +111 -0
- package/dist/memory/retriever.d.cts.map +1 -0
- package/dist/memory/retriever.d.mts +111 -0
- package/dist/memory/retriever.d.mts.map +1 -0
- package/dist/memory/retriever.mjs +58 -0
- package/dist/memory/retriever.mjs.map +1 -0
- package/dist/prompt/agent-session.cjs +700 -0
- package/dist/prompt/agent-session.d.cts +167 -0
- package/dist/prompt/agent-session.d.cts.map +1 -0
- package/dist/prompt/agent-session.d.mts +167 -0
- package/dist/prompt/agent-session.d.mts.map +1 -0
- package/dist/prompt/agent-session.mjs +700 -0
- package/dist/prompt/agent-session.mjs.map +1 -0
- package/dist/prompt/compact/compactor.cjs +50 -0
- package/dist/prompt/compact/compactor.mjs +50 -0
- package/dist/prompt/compact/compactor.mjs.map +1 -0
- package/dist/prompt/compact/session-memory-extractor.cjs +137 -0
- package/dist/prompt/compact/session-memory-extractor.mjs +137 -0
- package/dist/prompt/compact/session-memory-extractor.mjs.map +1 -0
- package/dist/prompt/compact/types.cjs +59 -0
- package/dist/prompt/compact/types.d.cts +341 -0
- package/dist/prompt/compact/types.d.cts.map +1 -0
- package/dist/prompt/compact/types.d.mts +341 -0
- package/dist/prompt/compact/types.d.mts.map +1 -0
- package/dist/prompt/compact/types.mjs +49 -0
- package/dist/prompt/compact/types.mjs.map +1 -0
- package/dist/prompt/compact/user-memory-extractor.cjs +118 -0
- package/dist/prompt/compact/user-memory-extractor.mjs +118 -0
- package/dist/prompt/compact/user-memory-extractor.mjs.map +1 -0
- package/dist/prompt/context/afs/history.cjs +30 -0
- package/dist/prompt/context/afs/history.mjs +30 -0
- package/dist/prompt/context/afs/history.mjs.map +1 -0
- package/dist/prompt/context/afs/index.cjs +60 -0
- package/dist/prompt/context/afs/index.mjs +61 -0
- package/dist/prompt/context/afs/index.mjs.map +1 -0
- package/dist/prompt/context/index.cjs +18 -0
- package/dist/prompt/context/index.mjs +19 -0
- package/dist/prompt/context/index.mjs.map +1 -0
- package/dist/prompt/filters/index.cjs +22 -0
- package/dist/prompt/filters/index.mjs +21 -0
- package/dist/prompt/filters/index.mjs.map +1 -0
- package/dist/prompt/prompt-builder.cjs +291 -0
- package/dist/prompt/prompt-builder.d.cts +57 -0
- package/dist/prompt/prompt-builder.d.cts.map +1 -0
- package/dist/prompt/prompt-builder.d.mts +57 -0
- package/dist/prompt/prompt-builder.d.mts.map +1 -0
- package/dist/prompt/prompt-builder.mjs +291 -0
- package/dist/prompt/prompt-builder.mjs.map +1 -0
- package/dist/prompt/prompts/afs-builtin-prompt.cjs +12 -0
- package/dist/prompt/prompts/afs-builtin-prompt.mjs +13 -0
- package/dist/prompt/prompts/afs-builtin-prompt.mjs.map +1 -0
- package/dist/prompt/prompts/memory-message-template.cjs +10 -0
- package/dist/prompt/prompts/memory-message-template.mjs +10 -0
- package/dist/prompt/prompts/memory-message-template.mjs.map +1 -0
- package/dist/prompt/prompts/structured-stream-instructions.cjs +30 -0
- package/dist/prompt/prompts/structured-stream-instructions.mjs +30 -0
- package/dist/prompt/prompts/structured-stream-instructions.mjs.map +1 -0
- package/dist/prompt/skills/afs/agent-skill/agent-skill.cjs +66 -0
- package/dist/prompt/skills/afs/agent-skill/agent-skill.mjs +66 -0
- package/dist/prompt/skills/afs/agent-skill/agent-skill.mjs.map +1 -0
- package/dist/prompt/skills/afs/agent-skill/skill-loader.cjs +42 -0
- package/dist/prompt/skills/afs/agent-skill/skill-loader.mjs +41 -0
- package/dist/prompt/skills/afs/agent-skill/skill-loader.mjs.map +1 -0
- package/dist/prompt/skills/afs/base.cjs +9 -0
- package/dist/prompt/skills/afs/base.mjs +10 -0
- package/dist/prompt/skills/afs/base.mjs.map +1 -0
- package/dist/prompt/skills/afs/delete.cjs +50 -0
- package/dist/prompt/skills/afs/delete.mjs +50 -0
- package/dist/prompt/skills/afs/delete.mjs.map +1 -0
- package/dist/prompt/skills/afs/edit.cjs +92 -0
- package/dist/prompt/skills/afs/edit.mjs +92 -0
- package/dist/prompt/skills/afs/edit.mjs.map +1 -0
- package/dist/prompt/skills/afs/exec.cjs +36 -0
- package/dist/prompt/skills/afs/exec.mjs +36 -0
- package/dist/prompt/skills/afs/exec.mjs.map +1 -0
- package/dist/prompt/skills/afs/index.cjs +28 -0
- package/dist/prompt/skills/afs/index.mjs +29 -0
- package/dist/prompt/skills/afs/index.mjs.map +1 -0
- package/dist/prompt/skills/afs/list.cjs +69 -0
- package/dist/prompt/skills/afs/list.mjs +69 -0
- package/dist/prompt/skills/afs/list.mjs.map +1 -0
- package/dist/prompt/skills/afs/read.cjs +86 -0
- package/dist/prompt/skills/afs/read.mjs +86 -0
- package/dist/prompt/skills/afs/read.mjs.map +1 -0
- package/dist/prompt/skills/afs/rename.cjs +53 -0
- package/dist/prompt/skills/afs/rename.mjs +53 -0
- package/dist/prompt/skills/afs/rename.mjs.map +1 -0
- package/dist/prompt/skills/afs/search.cjs +63 -0
- package/dist/prompt/skills/afs/search.mjs +63 -0
- package/dist/prompt/skills/afs/search.mjs.map +1 -0
- package/dist/prompt/skills/afs/write.cjs +51 -0
- package/dist/prompt/skills/afs/write.mjs +51 -0
- package/dist/prompt/skills/afs/write.mjs.map +1 -0
- package/dist/prompt/template.cjs +229 -0
- package/dist/prompt/template.d.cts +247 -0
- package/dist/prompt/template.d.cts.map +1 -0
- package/dist/prompt/template.d.mts +247 -0
- package/dist/prompt/template.d.mts.map +1 -0
- package/dist/prompt/template.mjs +219 -0
- package/dist/prompt/template.mjs.map +1 -0
- package/dist/utils/agent-utils.cjs +49 -0
- package/dist/utils/agent-utils.d.cts +22 -0
- package/dist/utils/agent-utils.d.cts.map +1 -0
- package/dist/utils/agent-utils.d.mts +22 -0
- package/dist/utils/agent-utils.d.mts.map +1 -0
- package/dist/utils/agent-utils.mjs +46 -0
- package/dist/utils/agent-utils.mjs.map +1 -0
- package/dist/utils/camelize.cjs +34 -0
- package/dist/utils/camelize.d.cts +9 -0
- package/dist/utils/camelize.d.cts.map +1 -0
- package/dist/utils/camelize.d.mts +9 -0
- package/dist/utils/camelize.d.mts.map +1 -0
- package/dist/utils/camelize.mjs +33 -0
- package/dist/utils/camelize.mjs.map +1 -0
- package/dist/utils/event-stream.cjs +136 -0
- package/dist/utils/event-stream.d.cts +20 -0
- package/dist/utils/event-stream.d.cts.map +1 -0
- package/dist/utils/event-stream.d.mts +20 -0
- package/dist/utils/event-stream.d.mts.map +1 -0
- package/dist/utils/event-stream.mjs +133 -0
- package/dist/utils/event-stream.mjs.map +1 -0
- package/dist/utils/fetch.cjs +32 -0
- package/dist/utils/fetch.d.cts +8 -0
- package/dist/utils/fetch.d.cts.map +1 -0
- package/dist/utils/fetch.d.mts +8 -0
- package/dist/utils/fetch.d.mts.map +1 -0
- package/dist/utils/fetch.mjs +32 -0
- package/dist/utils/fetch.mjs.map +1 -0
- package/dist/utils/json-schema.cjs +107 -0
- package/dist/utils/json-schema.d.cts +20 -0
- package/dist/utils/json-schema.d.cts.map +1 -0
- package/dist/utils/json-schema.d.mts +20 -0
- package/dist/utils/json-schema.d.mts.map +1 -0
- package/dist/utils/json-schema.mjs +102 -0
- package/dist/utils/json-schema.mjs.map +1 -0
- package/dist/utils/json-utils.cjs +46 -0
- package/dist/utils/json-utils.d.cts +28 -0
- package/dist/utils/json-utils.d.cts.map +1 -0
- package/dist/utils/json-utils.d.mts +28 -0
- package/dist/utils/json-utils.d.mts.map +1 -0
- package/dist/utils/json-utils.mjs +44 -0
- package/dist/utils/json-utils.mjs.map +1 -0
- package/dist/utils/logger.cjs +72 -0
- package/dist/utils/logger.d.cts +41 -0
- package/dist/utils/logger.d.cts.map +1 -0
- package/dist/utils/logger.d.mts +41 -0
- package/dist/utils/logger.d.mts.map +1 -0
- package/dist/utils/logger.mjs +68 -0
- package/dist/utils/logger.mjs.map +1 -0
- package/dist/utils/mcp-utils.cjs +53 -0
- package/dist/utils/mcp-utils.d.cts +10 -0
- package/dist/utils/mcp-utils.d.cts.map +1 -0
- package/dist/utils/mcp-utils.d.mts +10 -0
- package/dist/utils/mcp-utils.d.mts.map +1 -0
- package/dist/utils/mcp-utils.mjs +51 -0
- package/dist/utils/mcp-utils.mjs.map +1 -0
- package/dist/utils/model-utils.cjs +12 -0
- package/dist/utils/model-utils.d.cts +8 -0
- package/dist/utils/model-utils.d.cts.map +1 -0
- package/dist/utils/model-utils.d.mts +8 -0
- package/dist/utils/model-utils.d.mts.map +1 -0
- package/dist/utils/model-utils.mjs +12 -0
- package/dist/utils/model-utils.mjs.map +1 -0
- package/dist/utils/promise.cjs +17 -0
- package/dist/utils/promise.d.cts +10 -0
- package/dist/utils/promise.d.cts.map +1 -0
- package/dist/utils/promise.d.mts +10 -0
- package/dist/utils/promise.d.mts.map +1 -0
- package/dist/utils/promise.mjs +17 -0
- package/dist/utils/promise.mjs.map +1 -0
- package/dist/utils/prompts.cjs +19 -0
- package/dist/utils/prompts.d.cts +6 -0
- package/dist/utils/prompts.d.cts.map +1 -0
- package/dist/utils/prompts.d.mts +6 -0
- package/dist/utils/prompts.d.mts.map +1 -0
- package/dist/utils/prompts.mjs +18 -0
- package/dist/utils/prompts.mjs.map +1 -0
- package/dist/utils/queue.cjs +273 -0
- package/dist/utils/queue.d.cts +60 -0
- package/dist/utils/queue.d.cts.map +1 -0
- package/dist/utils/queue.d.mts +60 -0
- package/dist/utils/queue.d.mts.map +1 -0
- package/dist/utils/queue.mjs +271 -0
- package/dist/utils/queue.mjs.map +1 -0
- package/dist/utils/role-utils.cjs +40 -0
- package/dist/utils/role-utils.d.cts +32 -0
- package/dist/utils/role-utils.d.cts.map +1 -0
- package/dist/utils/role-utils.d.mts +32 -0
- package/dist/utils/role-utils.d.mts.map +1 -0
- package/dist/utils/role-utils.mjs +38 -0
- package/dist/utils/role-utils.mjs.map +1 -0
- package/dist/utils/stream-polyfill.cjs +37 -0
- package/dist/utils/stream-polyfill.d.cts +1 -0
- package/dist/utils/stream-polyfill.d.mts +1 -0
- package/dist/utils/stream-polyfill.mjs +38 -0
- package/dist/utils/stream-polyfill.mjs.map +1 -0
- package/dist/utils/stream-utils.cjs +187 -0
- package/dist/utils/stream-utils.d.cts +30 -0
- package/dist/utils/stream-utils.d.cts.map +1 -0
- package/dist/utils/stream-utils.d.mts +30 -0
- package/dist/utils/stream-utils.d.mts.map +1 -0
- package/dist/utils/stream-utils.mjs +174 -0
- package/dist/utils/stream-utils.mjs.map +1 -0
- package/dist/utils/structured-stream-extractor.cjs +63 -0
- package/dist/utils/structured-stream-extractor.d.cts +23 -0
- package/dist/utils/structured-stream-extractor.d.cts.map +1 -0
- package/dist/utils/structured-stream-extractor.d.mts +23 -0
- package/dist/utils/structured-stream-extractor.d.mts.map +1 -0
- package/dist/utils/structured-stream-extractor.mjs +64 -0
- package/dist/utils/structured-stream-extractor.mjs.map +1 -0
- package/dist/utils/test/agent-response.cjs +16 -0
- package/dist/utils/test/agent-response.d.cts +12 -0
- package/dist/utils/test/agent-response.d.cts.map +1 -0
- package/dist/utils/test/agent-response.d.mts +13 -0
- package/dist/utils/test/agent-response.d.mts.map +1 -0
- package/dist/utils/test/agent-response.mjs +17 -0
- package/dist/utils/test/agent-response.mjs.map +1 -0
- package/dist/utils/test/openai-like-utils.cjs +73 -0
- package/dist/utils/test/openai-like-utils.d.cts +13 -0
- package/dist/utils/test/openai-like-utils.d.cts.map +1 -0
- package/dist/utils/test/openai-like-utils.d.mts +14 -0
- package/dist/utils/test/openai-like-utils.d.mts.map +1 -0
- package/dist/utils/test/openai-like-utils.mjs +68 -0
- package/dist/utils/test/openai-like-utils.mjs.map +1 -0
- package/dist/utils/token-estimator.cjs +57 -0
- package/dist/utils/token-estimator.d.cts +13 -0
- package/dist/utils/token-estimator.d.cts.map +1 -0
- package/dist/utils/token-estimator.d.mts +13 -0
- package/dist/utils/token-estimator.d.mts.map +1 -0
- package/dist/utils/token-estimator.mjs +57 -0
- package/dist/utils/token-estimator.mjs.map +1 -0
- package/dist/utils/type-utils.cjs +159 -0
- package/dist/utils/type-utils.d.cts +32 -0
- package/dist/utils/type-utils.d.cts.map +1 -0
- package/dist/utils/type-utils.d.mts +32 -0
- package/dist/utils/type-utils.d.mts.map +1 -0
- package/dist/utils/type-utils.mjs +141 -0
- package/dist/utils/type-utils.mjs.map +1 -0
- package/dist/utils/typed-event-emitter.cjs +0 -0
- package/dist/utils/typed-event-emitter.d.cts +13 -0
- package/dist/utils/typed-event-emitter.d.cts.map +1 -0
- package/dist/utils/typed-event-emitter.d.mts +13 -0
- package/dist/utils/typed-event-emitter.d.mts.map +1 -0
- package/dist/utils/typed-event-emitter.mjs +1 -0
- package/package.json +143 -62
- package/CHANGELOG.md +0 -2584
- package/lib/cjs/agents/agent.d.ts +0 -961
- package/lib/cjs/agents/agent.js +0 -961
- package/lib/cjs/agents/ai-agent.d.ts +0 -395
- package/lib/cjs/agents/ai-agent.js +0 -572
- package/lib/cjs/agents/chat-model.d.ts +0 -672
- package/lib/cjs/agents/chat-model.js +0 -457
- package/lib/cjs/agents/guide-rail-agent.d.ts +0 -62
- package/lib/cjs/agents/guide-rail-agent.js +0 -14
- package/lib/cjs/agents/image-agent.d.ts +0 -38
- package/lib/cjs/agents/image-agent.js +0 -71
- package/lib/cjs/agents/image-model.d.ts +0 -270
- package/lib/cjs/agents/image-model.js +0 -91
- package/lib/cjs/agents/mcp-agent.d.ts +0 -231
- package/lib/cjs/agents/mcp-agent.js +0 -366
- package/lib/cjs/agents/model.d.ts +0 -252
- package/lib/cjs/agents/model.js +0 -180
- package/lib/cjs/agents/team-agent.d.ts +0 -382
- package/lib/cjs/agents/team-agent.js +0 -386
- package/lib/cjs/agents/transform-agent.d.ts +0 -94
- package/lib/cjs/agents/transform-agent.js +0 -80
- package/lib/cjs/agents/types.d.ts +0 -31
- package/lib/cjs/agents/types.js +0 -40
- package/lib/cjs/agents/user-agent.d.ts +0 -27
- package/lib/cjs/agents/user-agent.js +0 -90
- package/lib/cjs/agents/video-model.d.ts +0 -280
- package/lib/cjs/agents/video-model.js +0 -67
- package/lib/cjs/aigne/aigne.d.ts +0 -335
- package/lib/cjs/aigne/aigne.js +0 -248
- package/lib/cjs/aigne/context.d.ts +0 -220
- package/lib/cjs/aigne/context.js +0 -423
- package/lib/cjs/aigne/index.d.ts +0 -4
- package/lib/cjs/aigne/index.js +0 -20
- package/lib/cjs/aigne/message-queue.d.ts +0 -48
- package/lib/cjs/aigne/message-queue.js +0 -109
- package/lib/cjs/aigne/type.d.ts +0 -26
- package/lib/cjs/aigne/type.js +0 -2
- package/lib/cjs/aigne/usage.d.ts +0 -28
- package/lib/cjs/aigne/usage.js +0 -34
- package/lib/cjs/index.d.ts +0 -21
- package/lib/cjs/index.js +0 -37
- package/lib/cjs/loader/agent-js.d.ts +0 -2
- package/lib/cjs/loader/agent-js.js +0 -21
- package/lib/cjs/loader/agent-yaml.d.ts +0 -78
- package/lib/cjs/loader/agent-yaml.js +0 -120
- package/lib/cjs/loader/agents.d.ts +0 -4
- package/lib/cjs/loader/agents.js +0 -17
- package/lib/cjs/loader/error.d.ts +0 -2
- package/lib/cjs/loader/error.js +0 -6
- package/lib/cjs/loader/function-agent.d.ts +0 -2
- package/lib/cjs/loader/function-agent.js +0 -7
- package/lib/cjs/loader/index.d.ts +0 -247
- package/lib/cjs/loader/index.js +0 -266
- package/lib/cjs/loader/schema.d.ts +0 -167
- package/lib/cjs/loader/schema.js +0 -162
- package/lib/cjs/memory/index.d.ts +0 -3
- package/lib/cjs/memory/index.js +0 -19
- package/lib/cjs/memory/memory.d.ts +0 -93
- package/lib/cjs/memory/memory.js +0 -147
- package/lib/cjs/memory/recorder.d.ts +0 -93
- package/lib/cjs/memory/recorder.js +0 -63
- package/lib/cjs/memory/retriever.d.ts +0 -106
- package/lib/cjs/memory/retriever.js +0 -60
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/prompt/agent-session.d.ts +0 -163
- package/lib/cjs/prompt/agent-session.js +0 -1008
- package/lib/cjs/prompt/compact/compactor.d.ts +0 -7
- package/lib/cjs/prompt/compact/compactor.js +0 -52
- package/lib/cjs/prompt/compact/session-memory-extractor.d.ts +0 -7
- package/lib/cjs/prompt/compact/session-memory-extractor.js +0 -143
- package/lib/cjs/prompt/compact/types.d.ts +0 -336
- package/lib/cjs/prompt/compact/types.js +0 -53
- package/lib/cjs/prompt/compact/user-memory-extractor.d.ts +0 -7
- package/lib/cjs/prompt/compact/user-memory-extractor.js +0 -124
- package/lib/cjs/prompt/context/afs/history.d.ts +0 -9
- package/lib/cjs/prompt/context/afs/history.js +0 -33
- package/lib/cjs/prompt/context/afs/index.d.ts +0 -20
- package/lib/cjs/prompt/context/afs/index.js +0 -54
- package/lib/cjs/prompt/context/index.d.ts +0 -31
- package/lib/cjs/prompt/context/index.js +0 -18
- package/lib/cjs/prompt/filters/index.d.ts +0 -2
- package/lib/cjs/prompt/filters/index.js +0 -51
- package/lib/cjs/prompt/prompt-builder.d.ts +0 -50
- package/lib/cjs/prompt/prompt-builder.js +0 -352
- package/lib/cjs/prompt/prompts/afs-builtin-prompt.d.ts +0 -4
- package/lib/cjs/prompt/prompts/afs-builtin-prompt.js +0 -36
- package/lib/cjs/prompt/prompts/memory-message-template.d.ts +0 -1
- package/lib/cjs/prompt/prompts/memory-message-template.js +0 -8
- package/lib/cjs/prompt/prompts/structured-stream-instructions.d.ts +0 -7
- package/lib/cjs/prompt/prompts/structured-stream-instructions.js +0 -27
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.d.ts +0 -19
- package/lib/cjs/prompt/skills/afs/agent-skill/agent-skill.js +0 -69
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.d.ts +0 -12
- package/lib/cjs/prompt/skills/afs/agent-skill/skill-loader.js +0 -50
- package/lib/cjs/prompt/skills/afs/base.d.ts +0 -4
- package/lib/cjs/prompt/skills/afs/base.js +0 -8
- package/lib/cjs/prompt/skills/afs/delete.d.ts +0 -19
- package/lib/cjs/prompt/skills/afs/delete.js +0 -54
- package/lib/cjs/prompt/skills/afs/edit.d.ts +0 -24
- package/lib/cjs/prompt/skills/afs/edit.js +0 -124
- package/lib/cjs/prompt/skills/afs/exec.d.ts +0 -16
- package/lib/cjs/prompt/skills/afs/exec.js +0 -43
- package/lib/cjs/prompt/skills/afs/index.d.ts +0 -3
- package/lib/cjs/prompt/skills/afs/index.js +0 -26
- package/lib/cjs/prompt/skills/afs/list.d.ts +0 -24
- package/lib/cjs/prompt/skills/afs/list.js +0 -81
- package/lib/cjs/prompt/skills/afs/read.d.ts +0 -28
- package/lib/cjs/prompt/skills/afs/read.js +0 -105
- package/lib/cjs/prompt/skills/afs/rename.d.ts +0 -21
- package/lib/cjs/prompt/skills/afs/rename.js +0 -59
- package/lib/cjs/prompt/skills/afs/search.d.ts +0 -24
- package/lib/cjs/prompt/skills/afs/search.js +0 -71
- package/lib/cjs/prompt/skills/afs/write.d.ts +0 -20
- package/lib/cjs/prompt/skills/afs/write.js +0 -59
- package/lib/cjs/prompt/template.d.ts +0 -243
- package/lib/cjs/prompt/template.js +0 -265
- package/lib/cjs/utils/agent-utils.d.ts +0 -13
- package/lib/cjs/utils/agent-utils.js +0 -60
- package/lib/cjs/utils/camelize.d.ts +0 -7
- package/lib/cjs/utils/camelize.js +0 -38
- package/lib/cjs/utils/event-stream.d.ts +0 -15
- package/lib/cjs/utils/event-stream.js +0 -158
- package/lib/cjs/utils/fetch.d.ts +0 -4
- package/lib/cjs/utils/fetch.js +0 -36
- package/lib/cjs/utils/json-schema.d.ts +0 -15
- package/lib/cjs/utils/json-schema.js +0 -123
- package/lib/cjs/utils/json-utils.d.ts +0 -24
- package/lib/cjs/utils/json-utils.js +0 -48
- package/lib/cjs/utils/logger.d.ts +0 -39
- package/lib/cjs/utils/logger.js +0 -81
- package/lib/cjs/utils/mcp-utils.d.ts +0 -5
- package/lib/cjs/utils/mcp-utils.js +0 -52
- package/lib/cjs/utils/model-utils.d.ts +0 -3
- package/lib/cjs/utils/model-utils.js +0 -10
- package/lib/cjs/utils/promise.d.ts +0 -6
- package/lib/cjs/utils/promise.js +0 -12
- package/lib/cjs/utils/prompts.d.ts +0 -2
- package/lib/cjs/utils/prompts.js +0 -22
- package/lib/cjs/utils/queue.d.ts +0 -57
- package/lib/cjs/utils/queue.js +0 -318
- package/lib/cjs/utils/role-utils.d.ts +0 -31
- package/lib/cjs/utils/role-utils.js +0 -37
- package/lib/cjs/utils/stream-polyfill.d.ts +0 -1
- package/lib/cjs/utils/stream-polyfill.js +0 -38
- package/lib/cjs/utils/stream-utils.d.ts +0 -26
- package/lib/cjs/utils/stream-utils.js +0 -235
- package/lib/cjs/utils/structured-stream-extractor.d.ts +0 -14
- package/lib/cjs/utils/structured-stream-extractor.js +0 -68
- package/lib/cjs/utils/token-estimator.d.ts +0 -9
- package/lib/cjs/utils/token-estimator.js +0 -66
- package/lib/cjs/utils/type-utils.d.ts +0 -31
- package/lib/cjs/utils/type-utils.js +0 -202
- package/lib/cjs/utils/typed-event-emitter.d.ts +0 -10
- package/lib/cjs/utils/typed-event-emitter.js +0 -2
- package/lib/dts/agents/agent.d.ts +0 -961
- package/lib/dts/agents/ai-agent.d.ts +0 -395
- package/lib/dts/agents/chat-model.d.ts +0 -672
- package/lib/dts/agents/guide-rail-agent.d.ts +0 -62
- package/lib/dts/agents/image-agent.d.ts +0 -38
- package/lib/dts/agents/image-model.d.ts +0 -270
- package/lib/dts/agents/mcp-agent.d.ts +0 -231
- package/lib/dts/agents/model.d.ts +0 -252
- package/lib/dts/agents/team-agent.d.ts +0 -382
- package/lib/dts/agents/transform-agent.d.ts +0 -94
- package/lib/dts/agents/types.d.ts +0 -31
- package/lib/dts/agents/user-agent.d.ts +0 -27
- package/lib/dts/agents/video-model.d.ts +0 -280
- package/lib/dts/aigne/aigne.d.ts +0 -335
- package/lib/dts/aigne/context.d.ts +0 -220
- package/lib/dts/aigne/index.d.ts +0 -4
- package/lib/dts/aigne/message-queue.d.ts +0 -48
- package/lib/dts/aigne/type.d.ts +0 -26
- package/lib/dts/aigne/usage.d.ts +0 -28
- package/lib/dts/index.d.ts +0 -21
- package/lib/dts/loader/agent-js.d.ts +0 -2
- package/lib/dts/loader/agent-yaml.d.ts +0 -78
- package/lib/dts/loader/agents.d.ts +0 -4
- package/lib/dts/loader/error.d.ts +0 -2
- package/lib/dts/loader/function-agent.d.ts +0 -2
- package/lib/dts/loader/index.d.ts +0 -247
- package/lib/dts/loader/schema.d.ts +0 -167
- package/lib/dts/memory/index.d.ts +0 -3
- package/lib/dts/memory/memory.d.ts +0 -93
- package/lib/dts/memory/recorder.d.ts +0 -93
- package/lib/dts/memory/retriever.d.ts +0 -106
- package/lib/dts/prompt/agent-session.d.ts +0 -163
- package/lib/dts/prompt/compact/compactor.d.ts +0 -7
- package/lib/dts/prompt/compact/session-memory-extractor.d.ts +0 -7
- package/lib/dts/prompt/compact/types.d.ts +0 -336
- package/lib/dts/prompt/compact/user-memory-extractor.d.ts +0 -7
- package/lib/dts/prompt/context/afs/history.d.ts +0 -9
- package/lib/dts/prompt/context/afs/index.d.ts +0 -20
- package/lib/dts/prompt/context/index.d.ts +0 -31
- package/lib/dts/prompt/filters/index.d.ts +0 -2
- package/lib/dts/prompt/prompt-builder.d.ts +0 -50
- package/lib/dts/prompt/prompts/afs-builtin-prompt.d.ts +0 -4
- package/lib/dts/prompt/prompts/memory-message-template.d.ts +0 -1
- package/lib/dts/prompt/prompts/structured-stream-instructions.d.ts +0 -7
- package/lib/dts/prompt/skills/afs/agent-skill/agent-skill.d.ts +0 -19
- package/lib/dts/prompt/skills/afs/agent-skill/skill-loader.d.ts +0 -12
- package/lib/dts/prompt/skills/afs/base.d.ts +0 -4
- package/lib/dts/prompt/skills/afs/delete.d.ts +0 -19
- package/lib/dts/prompt/skills/afs/edit.d.ts +0 -24
- package/lib/dts/prompt/skills/afs/exec.d.ts +0 -16
- package/lib/dts/prompt/skills/afs/index.d.ts +0 -3
- package/lib/dts/prompt/skills/afs/list.d.ts +0 -24
- package/lib/dts/prompt/skills/afs/read.d.ts +0 -28
- package/lib/dts/prompt/skills/afs/rename.d.ts +0 -21
- package/lib/dts/prompt/skills/afs/search.d.ts +0 -24
- package/lib/dts/prompt/skills/afs/write.d.ts +0 -20
- package/lib/dts/prompt/template.d.ts +0 -243
- package/lib/dts/utils/agent-utils.d.ts +0 -13
- package/lib/dts/utils/camelize.d.ts +0 -7
- package/lib/dts/utils/event-stream.d.ts +0 -15
- package/lib/dts/utils/fetch.d.ts +0 -4
- package/lib/dts/utils/json-schema.d.ts +0 -15
- package/lib/dts/utils/json-utils.d.ts +0 -24
- package/lib/dts/utils/logger.d.ts +0 -39
- package/lib/dts/utils/mcp-utils.d.ts +0 -5
- package/lib/dts/utils/model-utils.d.ts +0 -3
- package/lib/dts/utils/promise.d.ts +0 -6
- package/lib/dts/utils/prompts.d.ts +0 -2
- package/lib/dts/utils/queue.d.ts +0 -57
- package/lib/dts/utils/role-utils.d.ts +0 -31
- package/lib/dts/utils/stream-polyfill.d.ts +0 -1
- package/lib/dts/utils/stream-utils.d.ts +0 -26
- package/lib/dts/utils/structured-stream-extractor.d.ts +0 -14
- package/lib/dts/utils/token-estimator.d.ts +0 -9
- package/lib/dts/utils/type-utils.d.ts +0 -31
- package/lib/dts/utils/typed-event-emitter.d.ts +0 -10
- package/lib/esm/agents/agent.d.ts +0 -961
- package/lib/esm/agents/agent.js +0 -911
- package/lib/esm/agents/ai-agent.d.ts +0 -395
- package/lib/esm/agents/ai-agent.js +0 -535
- package/lib/esm/agents/chat-model.d.ts +0 -672
- package/lib/esm/agents/chat-model.js +0 -419
- package/lib/esm/agents/guide-rail-agent.d.ts +0 -62
- package/lib/esm/agents/guide-rail-agent.js +0 -11
- package/lib/esm/agents/image-agent.d.ts +0 -38
- package/lib/esm/agents/image-agent.js +0 -64
- package/lib/esm/agents/image-model.d.ts +0 -270
- package/lib/esm/agents/image-model.js +0 -87
- package/lib/esm/agents/mcp-agent.d.ts +0 -231
- package/lib/esm/agents/mcp-agent.js +0 -325
- package/lib/esm/agents/model.d.ts +0 -252
- package/lib/esm/agents/model.js +0 -143
- package/lib/esm/agents/team-agent.d.ts +0 -382
- package/lib/esm/agents/team-agent.js +0 -346
- package/lib/esm/agents/transform-agent.d.ts +0 -94
- package/lib/esm/agents/transform-agent.js +0 -73
- package/lib/esm/agents/types.d.ts +0 -31
- package/lib/esm/agents/types.js +0 -30
- package/lib/esm/agents/user-agent.d.ts +0 -27
- package/lib/esm/agents/user-agent.js +0 -86
- package/lib/esm/agents/video-model.d.ts +0 -280
- package/lib/esm/agents/video-model.js +0 -63
- package/lib/esm/aigne/aigne.d.ts +0 -335
- package/lib/esm/aigne/aigne.js +0 -244
- package/lib/esm/aigne/context.d.ts +0 -220
- package/lib/esm/aigne/context.js +0 -416
- package/lib/esm/aigne/index.d.ts +0 -4
- package/lib/esm/aigne/index.js +0 -4
- package/lib/esm/aigne/message-queue.d.ts +0 -48
- package/lib/esm/aigne/message-queue.js +0 -104
- package/lib/esm/aigne/type.d.ts +0 -26
- package/lib/esm/aigne/type.js +0 -1
- package/lib/esm/aigne/usage.d.ts +0 -28
- package/lib/esm/aigne/usage.js +0 -30
- package/lib/esm/index.d.ts +0 -21
- package/lib/esm/index.js +0 -21
- package/lib/esm/loader/agent-js.d.ts +0 -2
- package/lib/esm/loader/agent-js.js +0 -18
- package/lib/esm/loader/agent-yaml.d.ts +0 -78
- package/lib/esm/loader/agent-yaml.js +0 -113
- package/lib/esm/loader/agents.d.ts +0 -4
- package/lib/esm/loader/agents.js +0 -14
- package/lib/esm/loader/error.d.ts +0 -2
- package/lib/esm/loader/error.js +0 -2
- package/lib/esm/loader/function-agent.d.ts +0 -2
- package/lib/esm/loader/function-agent.js +0 -4
- package/lib/esm/loader/index.d.ts +0 -247
- package/lib/esm/loader/index.js +0 -258
- package/lib/esm/loader/schema.d.ts +0 -167
- package/lib/esm/loader/schema.js +0 -153
- package/lib/esm/memory/index.d.ts +0 -3
- package/lib/esm/memory/index.js +0 -3
- package/lib/esm/memory/memory.d.ts +0 -93
- package/lib/esm/memory/memory.js +0 -142
- package/lib/esm/memory/recorder.d.ts +0 -93
- package/lib/esm/memory/recorder.js +0 -59
- package/lib/esm/memory/retriever.d.ts +0 -106
- package/lib/esm/memory/retriever.js +0 -56
- package/lib/esm/package.json +0 -3
- package/lib/esm/prompt/agent-session.d.ts +0 -163
- package/lib/esm/prompt/agent-session.js +0 -968
- package/lib/esm/prompt/compact/compactor.d.ts +0 -7
- package/lib/esm/prompt/compact/compactor.js +0 -48
- package/lib/esm/prompt/compact/session-memory-extractor.d.ts +0 -7
- package/lib/esm/prompt/compact/session-memory-extractor.js +0 -139
- package/lib/esm/prompt/compact/types.d.ts +0 -336
- package/lib/esm/prompt/compact/types.js +0 -50
- package/lib/esm/prompt/compact/user-memory-extractor.d.ts +0 -7
- package/lib/esm/prompt/compact/user-memory-extractor.js +0 -120
- package/lib/esm/prompt/context/afs/history.d.ts +0 -9
- package/lib/esm/prompt/context/afs/history.js +0 -30
- package/lib/esm/prompt/context/afs/index.d.ts +0 -20
- package/lib/esm/prompt/context/afs/index.js +0 -51
- package/lib/esm/prompt/context/index.d.ts +0 -31
- package/lib/esm/prompt/context/index.js +0 -15
- package/lib/esm/prompt/filters/index.d.ts +0 -2
- package/lib/esm/prompt/filters/index.js +0 -15
- package/lib/esm/prompt/prompt-builder.d.ts +0 -50
- package/lib/esm/prompt/prompt-builder.js +0 -348
- package/lib/esm/prompt/prompts/afs-builtin-prompt.d.ts +0 -4
- package/lib/esm/prompt/prompts/afs-builtin-prompt.js +0 -32
- package/lib/esm/prompt/prompts/memory-message-template.d.ts +0 -1
- package/lib/esm/prompt/prompts/memory-message-template.js +0 -5
- package/lib/esm/prompt/prompts/structured-stream-instructions.d.ts +0 -7
- package/lib/esm/prompt/prompts/structured-stream-instructions.js +0 -24
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.d.ts +0 -19
- package/lib/esm/prompt/skills/afs/agent-skill/agent-skill.js +0 -65
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.d.ts +0 -12
- package/lib/esm/prompt/skills/afs/agent-skill/skill-loader.js +0 -43
- package/lib/esm/prompt/skills/afs/base.d.ts +0 -4
- package/lib/esm/prompt/skills/afs/base.js +0 -4
- package/lib/esm/prompt/skills/afs/delete.d.ts +0 -19
- package/lib/esm/prompt/skills/afs/delete.js +0 -50
- package/lib/esm/prompt/skills/afs/edit.d.ts +0 -24
- package/lib/esm/prompt/skills/afs/edit.js +0 -120
- package/lib/esm/prompt/skills/afs/exec.d.ts +0 -16
- package/lib/esm/prompt/skills/afs/exec.js +0 -39
- package/lib/esm/prompt/skills/afs/index.d.ts +0 -3
- package/lib/esm/prompt/skills/afs/index.js +0 -23
- package/lib/esm/prompt/skills/afs/list.d.ts +0 -24
- package/lib/esm/prompt/skills/afs/list.js +0 -77
- package/lib/esm/prompt/skills/afs/read.d.ts +0 -28
- package/lib/esm/prompt/skills/afs/read.js +0 -101
- package/lib/esm/prompt/skills/afs/rename.d.ts +0 -21
- package/lib/esm/prompt/skills/afs/rename.js +0 -55
- package/lib/esm/prompt/skills/afs/search.d.ts +0 -24
- package/lib/esm/prompt/skills/afs/search.js +0 -67
- package/lib/esm/prompt/skills/afs/write.d.ts +0 -20
- package/lib/esm/prompt/skills/afs/write.js +0 -55
- package/lib/esm/prompt/template.d.ts +0 -243
- package/lib/esm/prompt/template.js +0 -249
- package/lib/esm/utils/agent-utils.d.ts +0 -13
- package/lib/esm/utils/agent-utils.js +0 -54
- package/lib/esm/utils/camelize.d.ts +0 -7
- package/lib/esm/utils/camelize.js +0 -34
- package/lib/esm/utils/event-stream.d.ts +0 -15
- package/lib/esm/utils/event-stream.js +0 -151
- package/lib/esm/utils/fetch.d.ts +0 -4
- package/lib/esm/utils/fetch.js +0 -33
- package/lib/esm/utils/json-schema.d.ts +0 -15
- package/lib/esm/utils/json-schema.js +0 -114
- package/lib/esm/utils/json-utils.d.ts +0 -24
- package/lib/esm/utils/json-utils.js +0 -41
- package/lib/esm/utils/logger.d.ts +0 -39
- package/lib/esm/utils/logger.js +0 -73
- package/lib/esm/utils/mcp-utils.d.ts +0 -5
- package/lib/esm/utils/mcp-utils.js +0 -47
- package/lib/esm/utils/model-utils.d.ts +0 -3
- package/lib/esm/utils/model-utils.js +0 -7
- package/lib/esm/utils/promise.d.ts +0 -6
- package/lib/esm/utils/promise.js +0 -9
- package/lib/esm/utils/prompts.d.ts +0 -2
- package/lib/esm/utils/prompts.js +0 -18
- package/lib/esm/utils/queue.d.ts +0 -57
- package/lib/esm/utils/queue.js +0 -315
- package/lib/esm/utils/role-utils.d.ts +0 -31
- package/lib/esm/utils/role-utils.js +0 -33
- package/lib/esm/utils/stream-polyfill.d.ts +0 -1
- package/lib/esm/utils/stream-polyfill.js +0 -37
- package/lib/esm/utils/stream-utils.d.ts +0 -26
- package/lib/esm/utils/stream-utils.js +0 -217
- package/lib/esm/utils/structured-stream-extractor.d.ts +0 -14
- package/lib/esm/utils/structured-stream-extractor.js +0 -64
- package/lib/esm/utils/token-estimator.d.ts +0 -9
- package/lib/esm/utils/token-estimator.js +0 -63
- package/lib/esm/utils/type-utils.d.ts +0 -31
- package/lib/esm/utils/type-utils.js +0 -181
- package/lib/esm/utils/typed-event-emitter.d.ts +0 -10
- package/lib/esm/utils/typed-event-emitter.js +0 -1
package/lib/cjs/loader/schema.js
DELETED
|
@@ -1,162 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getInstructionsSchema = exports.imageModelSchema = exports.chatModelSchema = exports.defaultInputSchema = exports.inputOutputSchema = void 0;
|
|
4
|
-
exports.optionalize = optionalize;
|
|
5
|
-
exports.camelizeSchema = camelizeSchema;
|
|
6
|
-
exports.preprocessSchema = preprocessSchema;
|
|
7
|
-
exports.instructionsToPromptBuilder = instructionsToPromptBuilder;
|
|
8
|
-
const index_js_1 = require("@aigne/platform-helpers/nodejs/index.js");
|
|
9
|
-
const yaml_1 = require("yaml");
|
|
10
|
-
const zod_1 = require("zod");
|
|
11
|
-
const agent_js_1 = require("../agents/agent.js");
|
|
12
|
-
const chat_model_js_1 = require("../agents/chat-model.js");
|
|
13
|
-
const prompt_builder_js_1 = require("../prompt/prompt-builder.js");
|
|
14
|
-
const template_js_1 = require("../prompt/template.js");
|
|
15
|
-
const camelize_js_1 = require("../utils/camelize.js");
|
|
16
|
-
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
17
|
-
const inputOutputSchema = ({ path }) => {
|
|
18
|
-
const includeExternalSchema = async (schema) => {
|
|
19
|
-
if (schema?.type === "object" && schema.properties) {
|
|
20
|
-
return {
|
|
21
|
-
...schema,
|
|
22
|
-
properties: Object.fromEntries(await Promise.all(Object.entries(schema.properties).map(async ([key, value]) => [
|
|
23
|
-
key,
|
|
24
|
-
await includeExternalSchema(value),
|
|
25
|
-
]))),
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
if (schema?.type === "array" && schema.items) {
|
|
29
|
-
return { ...schema, items: await includeExternalSchema(schema.items) };
|
|
30
|
-
}
|
|
31
|
-
// Load nested schemas from file
|
|
32
|
-
if (typeof schema === "string") {
|
|
33
|
-
const raw = await index_js_1.nodejs.fs.readFile(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), schema), "utf8");
|
|
34
|
-
return nestedJsonSchema.parseAsync((0, yaml_1.parse)(raw));
|
|
35
|
-
}
|
|
36
|
-
return schema;
|
|
37
|
-
};
|
|
38
|
-
const nestedJsonSchema = zod_1.z
|
|
39
|
-
.object({
|
|
40
|
-
type: zod_1.z.string(),
|
|
41
|
-
})
|
|
42
|
-
.passthrough()
|
|
43
|
-
.transform((v) => includeExternalSchema(v));
|
|
44
|
-
const jsonSchemaSchema = zod_1.z
|
|
45
|
-
.object({
|
|
46
|
-
type: zod_1.z.literal("object"),
|
|
47
|
-
properties: zod_1.z.record(zod_1.z.any()),
|
|
48
|
-
required: zod_1.z.array(zod_1.z.string()).optional(),
|
|
49
|
-
additionalProperties: zod_1.z.boolean().optional(),
|
|
50
|
-
})
|
|
51
|
-
.transform((v) => includeExternalSchema(v));
|
|
52
|
-
return zod_1.z.union([
|
|
53
|
-
zod_1.z
|
|
54
|
-
.string()
|
|
55
|
-
.transform((v) => index_js_1.nodejs.fs
|
|
56
|
-
.readFile(index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(path), v), "utf8")
|
|
57
|
-
.then((raw) => jsonSchemaSchema.parseAsync((0, yaml_1.parse)(raw)))),
|
|
58
|
-
jsonSchemaSchema,
|
|
59
|
-
]);
|
|
60
|
-
};
|
|
61
|
-
exports.inputOutputSchema = inputOutputSchema;
|
|
62
|
-
exports.defaultInputSchema = zod_1.z.record(zod_1.z.string(), (0, agent_js_1.getterSchema)(zod_1.z.unknown()));
|
|
63
|
-
const chatModelObjectSchema = camelizeSchema(zod_1.z
|
|
64
|
-
.object({
|
|
65
|
-
model: optionalize((0, agent_js_1.getterSchema)(zod_1.z.string())),
|
|
66
|
-
temperature: optionalize((0, agent_js_1.getterSchema)(zod_1.z.number().min(0).max(2))),
|
|
67
|
-
topP: optionalize((0, agent_js_1.getterSchema)(zod_1.z.number().min(0))),
|
|
68
|
-
frequencyPenalty: optionalize((0, agent_js_1.getterSchema)(zod_1.z.number().min(-2).max(2))),
|
|
69
|
-
presencePenalty: optionalize((0, agent_js_1.getterSchema)(zod_1.z.number().min(-2).max(2))),
|
|
70
|
-
thinkingEffort: optionalize((0, agent_js_1.getterSchema)(zod_1.z.union([
|
|
71
|
-
zod_1.z.number().int(),
|
|
72
|
-
zod_1.z.literal("high"),
|
|
73
|
-
zod_1.z.literal("medium"),
|
|
74
|
-
zod_1.z.literal("low"),
|
|
75
|
-
zod_1.z.literal("minimal"),
|
|
76
|
-
]))),
|
|
77
|
-
})
|
|
78
|
-
.passthrough());
|
|
79
|
-
exports.chatModelSchema = zod_1.z
|
|
80
|
-
.preprocess((v) => {
|
|
81
|
-
if (!(0, type_utils_js_1.isRecord)(v))
|
|
82
|
-
return v;
|
|
83
|
-
return {
|
|
84
|
-
...v,
|
|
85
|
-
model: v.model ||
|
|
86
|
-
(v.provider && v.name ? `${v.provider || ""}:${v.name || ""}` : undefined) ||
|
|
87
|
-
undefined,
|
|
88
|
-
};
|
|
89
|
-
}, zod_1.z.union([zod_1.z.string(), chatModelObjectSchema]))
|
|
90
|
-
.transform((v) => typeof v === "string" ? { model: v } : v);
|
|
91
|
-
const imageModelObjectSchema = camelizeSchema(zod_1.z
|
|
92
|
-
.object({
|
|
93
|
-
model: optionalize((0, agent_js_1.getterSchema)(zod_1.z.string())),
|
|
94
|
-
})
|
|
95
|
-
.passthrough());
|
|
96
|
-
exports.imageModelSchema = zod_1.z
|
|
97
|
-
.union([zod_1.z.string(), imageModelObjectSchema])
|
|
98
|
-
.transform((v) => typeof v === "string" ? { model: v } : v);
|
|
99
|
-
function optionalize(schema) {
|
|
100
|
-
return schema.nullish().transform((v) => v ?? undefined);
|
|
101
|
-
}
|
|
102
|
-
function camelizeSchema(schema, { shallow = true } = {}) {
|
|
103
|
-
return zod_1.z.preprocess((v) => ((0, type_utils_js_1.isRecord)(v) ? (0, camelize_js_1.camelize)(v, shallow) : v), schema);
|
|
104
|
-
}
|
|
105
|
-
function preprocessSchema(fn, schema) {
|
|
106
|
-
return zod_1.z.preprocess(fn, schema);
|
|
107
|
-
}
|
|
108
|
-
const instructionItemSchema = camelizeSchema(zod_1.z.union([
|
|
109
|
-
zod_1.z.object({
|
|
110
|
-
role: chat_model_js_1.roleSchema.default("system"),
|
|
111
|
-
url: zod_1.z.string(),
|
|
112
|
-
cacheControl: optionalize(zod_1.z.object({
|
|
113
|
-
type: zod_1.z.literal("ephemeral"),
|
|
114
|
-
ttl: optionalize(zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")])),
|
|
115
|
-
})),
|
|
116
|
-
}),
|
|
117
|
-
zod_1.z.object({
|
|
118
|
-
role: chat_model_js_1.roleSchema.default("system"),
|
|
119
|
-
content: zod_1.z.string(),
|
|
120
|
-
cacheControl: optionalize(zod_1.z.object({
|
|
121
|
-
type: zod_1.z.literal("ephemeral"),
|
|
122
|
-
ttl: optionalize(zod_1.z.union([zod_1.z.literal("5m"), zod_1.z.literal("1h")])),
|
|
123
|
-
})),
|
|
124
|
-
}),
|
|
125
|
-
]));
|
|
126
|
-
const parseInstructionItem = ({ filepath }) => async ({ role, cacheControl, ...v }) => {
|
|
127
|
-
if (role === "tool")
|
|
128
|
-
throw new Error(`'tool' role is not allowed in instruction item in agent file ${filepath}`);
|
|
129
|
-
if ("content" in v && typeof v.content === "string") {
|
|
130
|
-
return { role, content: v.content, path: filepath, cacheControl };
|
|
131
|
-
}
|
|
132
|
-
if ("url" in v && typeof v.url === "string") {
|
|
133
|
-
const url = index_js_1.nodejs.path.isAbsolute(v.url)
|
|
134
|
-
? v.url
|
|
135
|
-
: index_js_1.nodejs.path.join(index_js_1.nodejs.path.dirname(filepath), v.url);
|
|
136
|
-
return index_js_1.nodejs.fs
|
|
137
|
-
.readFile(url, "utf8")
|
|
138
|
-
.then((content) => ({ role, content, path: url, cacheControl }));
|
|
139
|
-
}
|
|
140
|
-
throw new Error(`Invalid instruction item in agent file ${filepath}. Expected 'content' or 'url' property`);
|
|
141
|
-
};
|
|
142
|
-
const getInstructionsSchema = ({ filepath }) => zod_1.z
|
|
143
|
-
.union([zod_1.z.string(), instructionItemSchema, zod_1.z.array(instructionItemSchema)])
|
|
144
|
-
.transform(async (v) => {
|
|
145
|
-
if (typeof v === "string")
|
|
146
|
-
return [{ role: "system", content: v, path: filepath }];
|
|
147
|
-
if (Array.isArray(v)) {
|
|
148
|
-
return Promise.all(v.map((item) => parseInstructionItem({ filepath })(item)));
|
|
149
|
-
}
|
|
150
|
-
return [await parseInstructionItem({ filepath })(v)];
|
|
151
|
-
});
|
|
152
|
-
exports.getInstructionsSchema = getInstructionsSchema;
|
|
153
|
-
function instructionsToPromptBuilder(instructions) {
|
|
154
|
-
return new prompt_builder_js_1.PromptBuilder({
|
|
155
|
-
instructions: typeof instructions === "string"
|
|
156
|
-
? instructions
|
|
157
|
-
: template_js_1.ChatMessagesTemplate.from((0, template_js_1.parseChatMessages)(instructions.map((i) => ({
|
|
158
|
-
...i,
|
|
159
|
-
options: { workingDir: index_js_1.nodejs.path.dirname(i.path) },
|
|
160
|
-
})))),
|
|
161
|
-
});
|
|
162
|
-
}
|
package/lib/cjs/memory/index.js
DELETED
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./memory.js"), exports);
|
|
18
|
-
__exportStar(require("./recorder.js"), exports);
|
|
19
|
-
__exportStar(require("./retriever.js"), exports);
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { Agent, type AgentInvokeOptions, type AgentOptions, type Message } from "../agents/agent.js";
|
|
2
|
-
import type { Context } from "../aigne/context.js";
|
|
3
|
-
import type { MessagePayload } from "../aigne/message-queue.js";
|
|
4
|
-
import { MemoryRecorder, type MemoryRecorderInput, type MemoryRecorderOptions, type MemoryRecorderOutput } from "./recorder.js";
|
|
5
|
-
import { MemoryRetriever, type MemoryRetrieverInput, type MemoryRetrieverOptions, type MemoryRetrieverOutput } from "./retriever.js";
|
|
6
|
-
export interface Memory {
|
|
7
|
-
id: string;
|
|
8
|
-
sessionId?: string | null;
|
|
9
|
-
content: unknown;
|
|
10
|
-
createdAt: string;
|
|
11
|
-
}
|
|
12
|
-
export declare const newMemoryId: () => string;
|
|
13
|
-
export interface MemoryAgentOptions extends Partial<Pick<MemoryAgent, "autoUpdate">>, Pick<AgentOptions, "subscribeTopic" | "skills"> {
|
|
14
|
-
recorder?: MemoryRecorder | MemoryRecorderOptions["process"] | MemoryRecorderOptions;
|
|
15
|
-
retriever?: MemoryRetriever | MemoryRetrieverOptions["process"] | MemoryRetrieverOptions;
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* A specialized agent responsible for managing, storing, and retrieving memories within the agent system.
|
|
19
|
-
*
|
|
20
|
-
* MemoryAgent serves as a bridge between application logic and memory storage/retrieval mechanisms.
|
|
21
|
-
* It delegates the actual memory operations to specialized recorder and retriever agents that
|
|
22
|
-
* are attached as skills. This agent doesn't directly process messages like other agents but
|
|
23
|
-
* instead provides memory management capabilities to the system.
|
|
24
|
-
*/
|
|
25
|
-
export declare class MemoryAgent extends Agent {
|
|
26
|
-
tag: string;
|
|
27
|
-
/**
|
|
28
|
-
* Creates a new MemoryAgent instance.
|
|
29
|
-
*/
|
|
30
|
-
constructor(options: MemoryAgentOptions);
|
|
31
|
-
private _retriever?;
|
|
32
|
-
/**
|
|
33
|
-
* Agent used for retrieving memories from storage.
|
|
34
|
-
*
|
|
35
|
-
* This retriever is automatically added to the agent's skills when set.
|
|
36
|
-
* Setting a new retriever will remove any previously set retriever from skills.
|
|
37
|
-
*/
|
|
38
|
-
get retriever(): MemoryRetriever | undefined;
|
|
39
|
-
set retriever(value: MemoryRetriever | undefined);
|
|
40
|
-
private _recorder?;
|
|
41
|
-
/**
|
|
42
|
-
* Agent used for recording and storing new memories.
|
|
43
|
-
*
|
|
44
|
-
* This recorder is automatically added to the agent's skills when set.
|
|
45
|
-
* Setting a new recorder will remove any previously set recorder from skills.
|
|
46
|
-
*/
|
|
47
|
-
get recorder(): MemoryRecorder | undefined;
|
|
48
|
-
set recorder(value: MemoryRecorder | undefined);
|
|
49
|
-
/**
|
|
50
|
-
* Controls whether to automatically update the memory when agent call completes.
|
|
51
|
-
*
|
|
52
|
-
* When true, the agent will automatically record any relevant information
|
|
53
|
-
* after completing operations, creating a history of interactions.
|
|
54
|
-
*/
|
|
55
|
-
autoUpdate?: boolean;
|
|
56
|
-
/**
|
|
57
|
-
* Indicates whether this agent can be directly called.
|
|
58
|
-
*
|
|
59
|
-
* MemoryAgent is designed to be used as a supporting component rather than
|
|
60
|
-
* being directly invoked for processing, so this returns false.
|
|
61
|
-
*/
|
|
62
|
-
get isCallable(): boolean;
|
|
63
|
-
/**
|
|
64
|
-
* The standard message processing method required by the Agent interface.
|
|
65
|
-
*
|
|
66
|
-
* MemoryAgent doesn't directly process messages like other agents, so this method
|
|
67
|
-
* throws an error when called. Use the specialized retrieve() and record() methods instead.
|
|
68
|
-
*/
|
|
69
|
-
process(_input: Message, _options: AgentInvokeOptions): Promise<Message>;
|
|
70
|
-
/**
|
|
71
|
-
* Retrieves memories based on the provided input criteria.
|
|
72
|
-
*
|
|
73
|
-
* Delegates the actual retrieval operation to the configured retriever agent.
|
|
74
|
-
*
|
|
75
|
-
* @param input - The retrieval parameters (can include search terms, limits, etc.)
|
|
76
|
-
* @param context - The execution context
|
|
77
|
-
* @returns A promise resolving to the retrieved memories
|
|
78
|
-
* @throws Error - If no retriever has been initialized
|
|
79
|
-
*/
|
|
80
|
-
retrieve(input: MemoryRetrieverInput, context: Context): Promise<MemoryRetrieverOutput>;
|
|
81
|
-
/**
|
|
82
|
-
* Records new memories based on the provided input content.
|
|
83
|
-
*
|
|
84
|
-
* Delegates the actual recording operation to the configured recorder agent.
|
|
85
|
-
*
|
|
86
|
-
* @param input - The content to be recorded as memories
|
|
87
|
-
* @param context - The execution context
|
|
88
|
-
* @returns A promise resolving to the recorded memories
|
|
89
|
-
* @throws Error - If no recorder has been initialized
|
|
90
|
-
*/
|
|
91
|
-
record(input: MemoryRecorderInput, context: Context): Promise<MemoryRecorderOutput>;
|
|
92
|
-
onMessage({ role, source, message, context }: MessagePayload): Promise<void>;
|
|
93
|
-
}
|
package/lib/cjs/memory/memory.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryAgent = exports.newMemoryId = void 0;
|
|
4
|
-
const uuid_1 = require("@aigne/uuid");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const agent_js_1 = require("../agents/agent.js");
|
|
7
|
-
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
8
|
-
const recorder_js_1 = require("./recorder.js");
|
|
9
|
-
const retriever_js_1 = require("./retriever.js");
|
|
10
|
-
const newMemoryId = () => (0, uuid_1.v7)();
|
|
11
|
-
exports.newMemoryId = newMemoryId;
|
|
12
|
-
/**
|
|
13
|
-
* A specialized agent responsible for managing, storing, and retrieving memories within the agent system.
|
|
14
|
-
*
|
|
15
|
-
* MemoryAgent serves as a bridge between application logic and memory storage/retrieval mechanisms.
|
|
16
|
-
* It delegates the actual memory operations to specialized recorder and retriever agents that
|
|
17
|
-
* are attached as skills. This agent doesn't directly process messages like other agents but
|
|
18
|
-
* instead provides memory management capabilities to the system.
|
|
19
|
-
*/
|
|
20
|
-
class MemoryAgent extends agent_js_1.Agent {
|
|
21
|
-
tag = "MemoryAgent";
|
|
22
|
-
/**
|
|
23
|
-
* Creates a new MemoryAgent instance.
|
|
24
|
-
*/
|
|
25
|
-
constructor(options) {
|
|
26
|
-
(0, type_utils_js_1.checkArguments)("MemoryAgent", memoryAgentOptionsSchema, options);
|
|
27
|
-
super({
|
|
28
|
-
subscribeTopic: options.subscribeTopic,
|
|
29
|
-
skills: options.skills,
|
|
30
|
-
});
|
|
31
|
-
this.recorder =
|
|
32
|
-
options.recorder instanceof recorder_js_1.MemoryRecorder
|
|
33
|
-
? options.recorder
|
|
34
|
-
: options.recorder &&
|
|
35
|
-
new recorder_js_1.MemoryRecorder(typeof options.recorder === "function"
|
|
36
|
-
? { process: options.recorder }
|
|
37
|
-
: options.recorder);
|
|
38
|
-
this.retriever =
|
|
39
|
-
options.retriever instanceof retriever_js_1.MemoryRetriever
|
|
40
|
-
? options.retriever
|
|
41
|
-
: options.retriever &&
|
|
42
|
-
new retriever_js_1.MemoryRetriever(typeof options.retriever === "function"
|
|
43
|
-
? { process: options.retriever }
|
|
44
|
-
: options.retriever);
|
|
45
|
-
this.autoUpdate = options.autoUpdate;
|
|
46
|
-
}
|
|
47
|
-
_retriever;
|
|
48
|
-
/**
|
|
49
|
-
* Agent used for retrieving memories from storage.
|
|
50
|
-
*
|
|
51
|
-
* This retriever is automatically added to the agent's skills when set.
|
|
52
|
-
* Setting a new retriever will remove any previously set retriever from skills.
|
|
53
|
-
*/
|
|
54
|
-
get retriever() {
|
|
55
|
-
return this._retriever;
|
|
56
|
-
}
|
|
57
|
-
set retriever(value) {
|
|
58
|
-
if (this._retriever)
|
|
59
|
-
(0, type_utils_js_1.remove)(this.skills, [this._retriever]);
|
|
60
|
-
this._retriever = value;
|
|
61
|
-
if (value)
|
|
62
|
-
this.skills.push(value);
|
|
63
|
-
}
|
|
64
|
-
_recorder;
|
|
65
|
-
/**
|
|
66
|
-
* Agent used for recording and storing new memories.
|
|
67
|
-
*
|
|
68
|
-
* This recorder is automatically added to the agent's skills when set.
|
|
69
|
-
* Setting a new recorder will remove any previously set recorder from skills.
|
|
70
|
-
*/
|
|
71
|
-
get recorder() {
|
|
72
|
-
return this._recorder;
|
|
73
|
-
}
|
|
74
|
-
set recorder(value) {
|
|
75
|
-
if (this._recorder)
|
|
76
|
-
(0, type_utils_js_1.remove)(this.skills, [this._recorder]);
|
|
77
|
-
this._recorder = value;
|
|
78
|
-
if (value)
|
|
79
|
-
this.skills.push(value);
|
|
80
|
-
}
|
|
81
|
-
/**
|
|
82
|
-
* Controls whether to automatically update the memory when agent call completes.
|
|
83
|
-
*
|
|
84
|
-
* When true, the agent will automatically record any relevant information
|
|
85
|
-
* after completing operations, creating a history of interactions.
|
|
86
|
-
*/
|
|
87
|
-
autoUpdate;
|
|
88
|
-
/**
|
|
89
|
-
* Indicates whether this agent can be directly called.
|
|
90
|
-
*
|
|
91
|
-
* MemoryAgent is designed to be used as a supporting component rather than
|
|
92
|
-
* being directly invoked for processing, so this returns false.
|
|
93
|
-
*/
|
|
94
|
-
get isCallable() {
|
|
95
|
-
return false;
|
|
96
|
-
}
|
|
97
|
-
/**
|
|
98
|
-
* The standard message processing method required by the Agent interface.
|
|
99
|
-
*
|
|
100
|
-
* MemoryAgent doesn't directly process messages like other agents, so this method
|
|
101
|
-
* throws an error when called. Use the specialized retrieve() and record() methods instead.
|
|
102
|
-
*/
|
|
103
|
-
async process(_input, _options) {
|
|
104
|
-
throw new Error("Method not implemented.");
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Retrieves memories based on the provided input criteria.
|
|
108
|
-
*
|
|
109
|
-
* Delegates the actual retrieval operation to the configured retriever agent.
|
|
110
|
-
*
|
|
111
|
-
* @param input - The retrieval parameters (can include search terms, limits, etc.)
|
|
112
|
-
* @param context - The execution context
|
|
113
|
-
* @returns A promise resolving to the retrieved memories
|
|
114
|
-
* @throws Error - If no retriever has been initialized
|
|
115
|
-
*/
|
|
116
|
-
async retrieve(input, context) {
|
|
117
|
-
if (!this.retriever)
|
|
118
|
-
throw new Error("MemoryAgent retriever not initialized");
|
|
119
|
-
return context.invoke(this.retriever, input);
|
|
120
|
-
}
|
|
121
|
-
/**
|
|
122
|
-
* Records new memories based on the provided input content.
|
|
123
|
-
*
|
|
124
|
-
* Delegates the actual recording operation to the configured recorder agent.
|
|
125
|
-
*
|
|
126
|
-
* @param input - The content to be recorded as memories
|
|
127
|
-
* @param context - The execution context
|
|
128
|
-
* @returns A promise resolving to the recorded memories
|
|
129
|
-
* @throws Error - If no recorder has been initialized
|
|
130
|
-
*/
|
|
131
|
-
async record(input, context) {
|
|
132
|
-
if (!this.recorder)
|
|
133
|
-
throw new Error("MemoryAgent recorder not initialized");
|
|
134
|
-
return context.invoke(this.recorder, input);
|
|
135
|
-
}
|
|
136
|
-
async onMessage({ role, source, message, context }) {
|
|
137
|
-
this.record({ content: [role === "user" ? { input: message } : { output: message, source }] }, context);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
exports.MemoryAgent = MemoryAgent;
|
|
141
|
-
const memoryAgentOptionsSchema = zod_1.z.object({
|
|
142
|
-
retriever: zod_1.z.custom().optional(),
|
|
143
|
-
recorder: zod_1.z.custom().optional(),
|
|
144
|
-
autoUpdate: zod_1.z.boolean().optional(),
|
|
145
|
-
subscribeTopic: zod_1.z.union([zod_1.z.string(), zod_1.z.array(zod_1.z.string())]).optional(),
|
|
146
|
-
skills: zod_1.z.array(zod_1.z.custom()).optional(),
|
|
147
|
-
});
|
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
import { type ZodType, z } from "zod";
|
|
2
|
-
import { Agent, type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type FunctionAgentFn, type Message } from "../agents/agent.js";
|
|
3
|
-
import type { PromiseOrValue } from "../utils/type-utils.js";
|
|
4
|
-
import type { Memory } from "./memory.js";
|
|
5
|
-
/**
|
|
6
|
-
* Input for memory recording operations.
|
|
7
|
-
*
|
|
8
|
-
* This interface represents the data needed to record new memories
|
|
9
|
-
* in the system. The content array can contain any type of data that
|
|
10
|
-
* should be stored as memories.
|
|
11
|
-
*/
|
|
12
|
-
export interface MemoryRecorderInput extends Message {
|
|
13
|
-
content: {
|
|
14
|
-
input?: Message;
|
|
15
|
-
output?: Message;
|
|
16
|
-
source?: string;
|
|
17
|
-
}[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* @hidden
|
|
21
|
-
*/
|
|
22
|
-
export declare const memoryRecorderInputSchema: ZodType<MemoryRecorderInput>;
|
|
23
|
-
/**
|
|
24
|
-
* Output from memory recording operations.
|
|
25
|
-
*
|
|
26
|
-
* This interface represents the result of recording new memories,
|
|
27
|
-
* including the newly created memory objects with their IDs and timestamps.
|
|
28
|
-
*/
|
|
29
|
-
export interface MemoryRecorderOutput extends Message {
|
|
30
|
-
/**
|
|
31
|
-
* Array of newly created memory objects.
|
|
32
|
-
* Each memory includes a unique ID, the stored content, and a creation timestamp.
|
|
33
|
-
*/
|
|
34
|
-
memories: Memory[];
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* @hidden
|
|
38
|
-
*/
|
|
39
|
-
export declare const memoryRecorderOutputSchema: z.ZodObject<{
|
|
40
|
-
memories: z.ZodArray<z.ZodObject<{
|
|
41
|
-
id: z.ZodString;
|
|
42
|
-
content: ZodType<{}, z.ZodTypeDef, {}>;
|
|
43
|
-
createdAt: z.ZodString;
|
|
44
|
-
}, "strip", z.ZodTypeAny, {
|
|
45
|
-
id: string;
|
|
46
|
-
content: {};
|
|
47
|
-
createdAt: string;
|
|
48
|
-
}, {
|
|
49
|
-
id: string;
|
|
50
|
-
content: {};
|
|
51
|
-
createdAt: string;
|
|
52
|
-
}>, "many">;
|
|
53
|
-
}, "strip", z.ZodTypeAny, {
|
|
54
|
-
memories: {
|
|
55
|
-
id: string;
|
|
56
|
-
content: {};
|
|
57
|
-
createdAt: string;
|
|
58
|
-
}[];
|
|
59
|
-
}, {
|
|
60
|
-
memories: {
|
|
61
|
-
id: string;
|
|
62
|
-
content: {};
|
|
63
|
-
createdAt: string;
|
|
64
|
-
}[];
|
|
65
|
-
}>;
|
|
66
|
-
export interface MemoryRecorderOptions extends Omit<AgentOptions<MemoryRecorderInput, MemoryRecorderOutput>, "inputSchema" | "outputSchema"> {
|
|
67
|
-
process?: FunctionAgentFn<MemoryRecorderInput, MemoryRecorderOutput>;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Abstract base class for agents that record and store memories.
|
|
71
|
-
*
|
|
72
|
-
* The MemoryRecorder serves as a foundation for implementing specific memory storage
|
|
73
|
-
* mechanisms. Implementations of this class are responsible for:
|
|
74
|
-
*
|
|
75
|
-
* 1. Converting input content into standardized memory objects
|
|
76
|
-
* 2. Assigning unique IDs to new memories
|
|
77
|
-
* 3. Storing memories in an appropriate backend (database, file system, etc.)
|
|
78
|
-
* 4. Ensuring proper timestamping of memories
|
|
79
|
-
*
|
|
80
|
-
* Custom implementations should extend this class and provide concrete
|
|
81
|
-
* implementations of the process method to handle the actual storage logic.
|
|
82
|
-
*/
|
|
83
|
-
export declare class MemoryRecorder extends Agent<MemoryRecorderInput, MemoryRecorderOutput> {
|
|
84
|
-
tag: string;
|
|
85
|
-
/**
|
|
86
|
-
* Creates a new MemoryRecorder instance with predefined input and output schemas.
|
|
87
|
-
*
|
|
88
|
-
* @param options - Configuration options for the memory recorder agent
|
|
89
|
-
*/
|
|
90
|
-
constructor(options: MemoryRecorderOptions);
|
|
91
|
-
private _process?;
|
|
92
|
-
process(input: MemoryRecorderInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<MemoryRecorderOutput>>;
|
|
93
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MemoryRecorder = exports.memoryRecorderOutputSchema = exports.memoryRecorderInputSchema = void 0;
|
|
4
|
-
const zod_1 = require("zod");
|
|
5
|
-
const agent_js_1 = require("../agents/agent.js");
|
|
6
|
-
/**
|
|
7
|
-
* @hidden
|
|
8
|
-
*/
|
|
9
|
-
exports.memoryRecorderInputSchema = zod_1.z.object({
|
|
10
|
-
content: zod_1.z.array(zod_1.z.object({
|
|
11
|
-
input: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
12
|
-
output: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()).optional(),
|
|
13
|
-
source: zod_1.z.string().optional(),
|
|
14
|
-
})),
|
|
15
|
-
});
|
|
16
|
-
/**
|
|
17
|
-
* @hidden
|
|
18
|
-
*/
|
|
19
|
-
exports.memoryRecorderOutputSchema = zod_1.z.object({
|
|
20
|
-
memories: zod_1.z.array(zod_1.z.object({
|
|
21
|
-
id: zod_1.z.string(),
|
|
22
|
-
content: zod_1.z.custom(),
|
|
23
|
-
createdAt: zod_1.z.string().datetime(),
|
|
24
|
-
})),
|
|
25
|
-
});
|
|
26
|
-
/**
|
|
27
|
-
* Abstract base class for agents that record and store memories.
|
|
28
|
-
*
|
|
29
|
-
* The MemoryRecorder serves as a foundation for implementing specific memory storage
|
|
30
|
-
* mechanisms. Implementations of this class are responsible for:
|
|
31
|
-
*
|
|
32
|
-
* 1. Converting input content into standardized memory objects
|
|
33
|
-
* 2. Assigning unique IDs to new memories
|
|
34
|
-
* 3. Storing memories in an appropriate backend (database, file system, etc.)
|
|
35
|
-
* 4. Ensuring proper timestamping of memories
|
|
36
|
-
*
|
|
37
|
-
* Custom implementations should extend this class and provide concrete
|
|
38
|
-
* implementations of the process method to handle the actual storage logic.
|
|
39
|
-
*/
|
|
40
|
-
class MemoryRecorder extends agent_js_1.Agent {
|
|
41
|
-
tag = "MemoryRecorderAgent";
|
|
42
|
-
/**
|
|
43
|
-
* Creates a new MemoryRecorder instance with predefined input and output schemas.
|
|
44
|
-
*
|
|
45
|
-
* @param options - Configuration options for the memory recorder agent
|
|
46
|
-
*/
|
|
47
|
-
constructor(options) {
|
|
48
|
-
super({
|
|
49
|
-
...options,
|
|
50
|
-
inputSchema: exports.memoryRecorderInputSchema,
|
|
51
|
-
outputSchema: exports.memoryRecorderOutputSchema,
|
|
52
|
-
});
|
|
53
|
-
this._process = options.process;
|
|
54
|
-
}
|
|
55
|
-
_process;
|
|
56
|
-
process(input, options) {
|
|
57
|
-
if (!this._process) {
|
|
58
|
-
throw new Error("MemoryRecorder process function is not defined.");
|
|
59
|
-
}
|
|
60
|
-
return this._process.apply(this, [input, options]);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
exports.MemoryRecorder = MemoryRecorder;
|