@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/aigne/aigne.d.ts
DELETED
|
@@ -1,335 +0,0 @@
|
|
|
1
|
-
import { AIGNEObserver } from "@aigne/observability-api";
|
|
2
|
-
import type { Agent, AgentResponse, AgentResponseStream, Message } from "../agents/agent.js";
|
|
3
|
-
import type { ChatModel } from "../agents/chat-model.js";
|
|
4
|
-
import type { ImageModel } from "../agents/image-model.js";
|
|
5
|
-
import type { UserAgent } from "../agents/user-agent.js";
|
|
6
|
-
import { type LoadOptions } from "../loader/index.js";
|
|
7
|
-
import { AIGNEContext, type Context, type InvokeOptions, type UserContext } from "./context.js";
|
|
8
|
-
import { type MessagePayload, MessageQueue, type MessageQueueListener, type Unsubscribe } from "./message-queue.js";
|
|
9
|
-
import type { AIGNECLIAgents, AIGNEMetadata } from "./type.js";
|
|
10
|
-
import type { ContextLimits } from "./usage.js";
|
|
11
|
-
/**
|
|
12
|
-
* Options for the AIGNE class.
|
|
13
|
-
*/
|
|
14
|
-
export interface AIGNEOptions {
|
|
15
|
-
/**
|
|
16
|
-
* Optional root directory for this AIGNE instance.
|
|
17
|
-
* This is used to resolve relative paths for agents and skills.
|
|
18
|
-
*/
|
|
19
|
-
rootDir?: string;
|
|
20
|
-
/**
|
|
21
|
-
* The name of the AIGNE instance.
|
|
22
|
-
*/
|
|
23
|
-
name?: string;
|
|
24
|
-
/**
|
|
25
|
-
* The description of the AIGNE instance.
|
|
26
|
-
*/
|
|
27
|
-
description?: string;
|
|
28
|
-
/**
|
|
29
|
-
* Global model to use for all agents not specifying a model.
|
|
30
|
-
*/
|
|
31
|
-
model?: ChatModel;
|
|
32
|
-
/**
|
|
33
|
-
* Optional image model to use for image processing tasks.
|
|
34
|
-
*/
|
|
35
|
-
imageModel?: ImageModel;
|
|
36
|
-
/**
|
|
37
|
-
* Skills to use for the AIGNE instance.
|
|
38
|
-
*/
|
|
39
|
-
skills?: Agent[];
|
|
40
|
-
/**
|
|
41
|
-
* Agents to use for the AIGNE instance.
|
|
42
|
-
*/
|
|
43
|
-
agents?: Agent[];
|
|
44
|
-
mcpServer?: {
|
|
45
|
-
agents?: Agent[];
|
|
46
|
-
};
|
|
47
|
-
cli?: AIGNECLIAgents;
|
|
48
|
-
/**
|
|
49
|
-
* Limits for the AIGNE instance, such as timeout, max tokens, max invocations, etc.
|
|
50
|
-
*/
|
|
51
|
-
limits?: ContextLimits;
|
|
52
|
-
/**
|
|
53
|
-
* Observer for the AIGNE instance.
|
|
54
|
-
*/
|
|
55
|
-
observer?: AIGNEObserver;
|
|
56
|
-
metadata?: AIGNEMetadata;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* AIGNE is a class that orchestrates multiple agents to build complex AI applications.
|
|
60
|
-
* It serves as the central coordination point for agent interactions, message passing, and execution flow.
|
|
61
|
-
*
|
|
62
|
-
* @example
|
|
63
|
-
* Here's a simple example of how to use AIGNE:
|
|
64
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-simple}
|
|
65
|
-
*
|
|
66
|
-
* @example
|
|
67
|
-
* Here's an example of how to use AIGNE with streaming response:
|
|
68
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-streaming}
|
|
69
|
-
*/
|
|
70
|
-
export declare class AIGNE<U extends UserContext = UserContext> {
|
|
71
|
-
/**
|
|
72
|
-
* Loads an AIGNE instance from a directory containing an aigne.yaml file and agent definitions.
|
|
73
|
-
* This static method provides a convenient way to initialize an AIGNE system from configuration files.
|
|
74
|
-
*
|
|
75
|
-
* @param path - Path to the directory containing the aigne.yaml file.
|
|
76
|
-
* @param options - Options to override the loaded configuration.
|
|
77
|
-
* @returns A fully initialized AIGNE instance with configured agents and skills.
|
|
78
|
-
*/
|
|
79
|
-
static load(path: string, options?: Omit<AIGNEOptions, keyof LoadOptions> & LoadOptions): Promise<AIGNE>;
|
|
80
|
-
/**
|
|
81
|
-
* Creates a new AIGNE instance with the specified options.
|
|
82
|
-
*
|
|
83
|
-
* @param options - Configuration options for the AIGNE instance including name, description, model, and agents.
|
|
84
|
-
*/
|
|
85
|
-
constructor(options?: AIGNEOptions);
|
|
86
|
-
/**
|
|
87
|
-
* Optional root directory for this AIGNE instance.
|
|
88
|
-
*/
|
|
89
|
-
rootDir?: string;
|
|
90
|
-
/**
|
|
91
|
-
* Optional name identifier for this AIGNE instance.
|
|
92
|
-
*/
|
|
93
|
-
name?: string;
|
|
94
|
-
/**
|
|
95
|
-
* Optional description of this AIGNE instance's purpose or functionality.
|
|
96
|
-
*/
|
|
97
|
-
description?: string;
|
|
98
|
-
/**
|
|
99
|
-
* Global model to use for all agents that don't specify their own model.
|
|
100
|
-
*/
|
|
101
|
-
model?: ChatModel;
|
|
102
|
-
/**
|
|
103
|
-
* Optional image model to use for image processing tasks.
|
|
104
|
-
*/
|
|
105
|
-
imageModel?: ImageModel;
|
|
106
|
-
/**
|
|
107
|
-
* Usage limits applied to this AIGNE instance's execution.
|
|
108
|
-
*/
|
|
109
|
-
limits?: ContextLimits;
|
|
110
|
-
/**
|
|
111
|
-
* Message queue for handling inter-agent communication.
|
|
112
|
-
*
|
|
113
|
-
* @hidden
|
|
114
|
-
*/
|
|
115
|
-
readonly messageQueue: MessageQueue;
|
|
116
|
-
/**
|
|
117
|
-
* Collection of all context IDs created by this AIGNE instance.
|
|
118
|
-
*/
|
|
119
|
-
readonly contextIds: Set<string>;
|
|
120
|
-
/**
|
|
121
|
-
* Collection of skill agents available to this AIGNE instance.
|
|
122
|
-
* Provides indexed access by skill name.
|
|
123
|
-
*/
|
|
124
|
-
readonly skills: Agent<any, any>[] & {
|
|
125
|
-
[key: string]: Agent<any, any>;
|
|
126
|
-
};
|
|
127
|
-
/**
|
|
128
|
-
* Collection of primary agents managed by this AIGNE instance.
|
|
129
|
-
* Provides indexed access by agent name.
|
|
130
|
-
*/
|
|
131
|
-
readonly agents: Agent<any, any>[] & {
|
|
132
|
-
[key: string]: Agent<any, any>;
|
|
133
|
-
};
|
|
134
|
-
readonly mcpServer: {
|
|
135
|
-
agents: Agent<any, any>[] & {
|
|
136
|
-
[key: string]: Agent<any, any>;
|
|
137
|
-
};
|
|
138
|
-
};
|
|
139
|
-
readonly cli: AIGNECLIAgents;
|
|
140
|
-
/**
|
|
141
|
-
* Observer for the AIGNE instance.
|
|
142
|
-
*/
|
|
143
|
-
readonly observer?: AIGNEObserver;
|
|
144
|
-
/**
|
|
145
|
-
* Metadata for the AIGNE instance.
|
|
146
|
-
*/
|
|
147
|
-
readonly metadata: AIGNEMetadata;
|
|
148
|
-
/**
|
|
149
|
-
* Adds one or more agents to this AIGNE instance.
|
|
150
|
-
* Each agent is attached to this AIGNE instance, allowing it to access the AIGNE's resources.
|
|
151
|
-
*
|
|
152
|
-
* @param agents - One or more Agent instances to add to this AIGNE.
|
|
153
|
-
*/
|
|
154
|
-
addAgent(...agents: Agent[]): void;
|
|
155
|
-
/**
|
|
156
|
-
* Creates a new execution context for this AIGNE instance.
|
|
157
|
-
* Contexts isolate state for different flows or conversations.
|
|
158
|
-
*
|
|
159
|
-
* @returns A new AIGNEContext instance bound to this AIGNE.
|
|
160
|
-
*/
|
|
161
|
-
newContext(options?: Partial<Pick<Context, "userContext" | "memories">>): AIGNEContext;
|
|
162
|
-
/**
|
|
163
|
-
* Creates a user agent for consistent interactions with a specified agent.
|
|
164
|
-
* This method allows you to create a wrapper around an agent for repeated invocations.
|
|
165
|
-
*
|
|
166
|
-
* @param agent - Target agent to be wrapped for consistent invocation
|
|
167
|
-
* @returns A user agent instance that provides a convenient interface for interacting with the target agent
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* Here's an example of how to create a user agent and invoke it consistently:
|
|
171
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-user-agent}
|
|
172
|
-
*/
|
|
173
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>): UserAgent<I, O>;
|
|
174
|
-
/**
|
|
175
|
-
* Invokes an agent with a message and returns both the output and the active agent.
|
|
176
|
-
* This overload is useful when you need to track which agent was ultimately responsible for generating the response.
|
|
177
|
-
*
|
|
178
|
-
* @param agent - Target agent to invoke
|
|
179
|
-
* @param message - Input message to send to the agent
|
|
180
|
-
* @param options.returnActiveAgent - Must be true to return the final active agent
|
|
181
|
-
* @param options.streaming - Must be false to return a response stream
|
|
182
|
-
* @returns A promise resolving to a tuple containing the agent's response and the final active agent
|
|
183
|
-
*/
|
|
184
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I & Message, options: InvokeOptions<U> & {
|
|
185
|
-
returnActiveAgent: true;
|
|
186
|
-
streaming?: false;
|
|
187
|
-
}): Promise<[O, Agent]>;
|
|
188
|
-
/**
|
|
189
|
-
* Invokes an agent with a message and returns both a stream of the response and the active agent.
|
|
190
|
-
* This overload is useful when you need streaming responses while also tracking which agent provided them.
|
|
191
|
-
*
|
|
192
|
-
* @param agent - Target agent to invoke
|
|
193
|
-
* @param message - Input message to send to the agent
|
|
194
|
-
* @param options.returnActiveAgent - Must be true to return the final active agent
|
|
195
|
-
* @param options.streaming - Must be true to return a response stream
|
|
196
|
-
* @returns A promise resolving to a tuple containing the agent's response stream and a promise for the final agent
|
|
197
|
-
*/
|
|
198
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I & Message, options: InvokeOptions<U> & {
|
|
199
|
-
returnActiveAgent: true;
|
|
200
|
-
streaming: true;
|
|
201
|
-
}): Promise<[AgentResponseStream<O>, Promise<Agent>]>;
|
|
202
|
-
/**
|
|
203
|
-
* Invokes an agent with a message and returns just the output.
|
|
204
|
-
* This is the standard way to invoke an agent when you only need the response.
|
|
205
|
-
*
|
|
206
|
-
* @param agent - Target agent to invoke
|
|
207
|
-
* @param message - Input message to send to the agent
|
|
208
|
-
* @param options - Optional configuration parameters for the invocation
|
|
209
|
-
* @returns A promise resolving to the agent's complete response
|
|
210
|
-
*
|
|
211
|
-
* @example
|
|
212
|
-
* Here's a simple example of how to invoke an agent:
|
|
213
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-simple}
|
|
214
|
-
*/
|
|
215
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I & Message, options?: InvokeOptions<U> & {
|
|
216
|
-
returnActiveAgent?: false;
|
|
217
|
-
streaming?: false;
|
|
218
|
-
}): Promise<O>;
|
|
219
|
-
/**
|
|
220
|
-
* Invokes an agent with a message and returns a stream of the response.
|
|
221
|
-
* This allows processing the response incrementally as it's being generated.
|
|
222
|
-
*
|
|
223
|
-
* @param agent - Target agent to invoke
|
|
224
|
-
* @param message - Input message to send to the agent
|
|
225
|
-
* @param options - Configuration with streaming enabled to receive incremental response chunks
|
|
226
|
-
* @returns A promise resolving to a stream of the agent's response that can be consumed incrementally
|
|
227
|
-
*
|
|
228
|
-
* @example
|
|
229
|
-
* Here's an example of how to invoke an agent with streaming response:
|
|
230
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-streaming}
|
|
231
|
-
*/
|
|
232
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message: I & Message, options: InvokeOptions<U> & {
|
|
233
|
-
returnActiveAgent?: false;
|
|
234
|
-
streaming: true;
|
|
235
|
-
}): Promise<AgentResponseStream<O>>;
|
|
236
|
-
/**
|
|
237
|
-
* General implementation signature that handles all overload cases.
|
|
238
|
-
* This unified signature supports all the different invocation patterns defined by the overloads.
|
|
239
|
-
*
|
|
240
|
-
* @param agent - Target agent to invoke or wrap
|
|
241
|
-
* @param message - Optional input message to send to the agent
|
|
242
|
-
* @param options - Optional configuration parameters for the invocation
|
|
243
|
-
* @returns Either a UserAgent (when no message provided) or a promise resolving to the agent's response
|
|
244
|
-
* with optional active agent information based on the provided options
|
|
245
|
-
*/
|
|
246
|
-
invoke<I extends Message, O extends Message>(agent: Agent<I, O>, message?: I & Message, options?: InvokeOptions<U>): UserAgent<I, O> | Promise<AgentResponse<O> | [AgentResponse<O>, Agent]>;
|
|
247
|
-
/**
|
|
248
|
-
* Publishes a message to the message queue for inter-agent communication.
|
|
249
|
-
* This method broadcasts a message to all subscribers of the specified topic(s).
|
|
250
|
-
* It creates a new context internally and delegates to the context's publish method.
|
|
251
|
-
*
|
|
252
|
-
* @param topic - The topic or array of topics to publish the message to
|
|
253
|
-
* @param payload - The message payload to be delivered to subscribers
|
|
254
|
-
* @param options - Optional configuration parameters for the publish operation
|
|
255
|
-
*
|
|
256
|
-
* @example
|
|
257
|
-
* Here's an example of how to publish a message:
|
|
258
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-publish-message}
|
|
259
|
-
*/
|
|
260
|
-
publish(topic: string | string[], payload: Omit<MessagePayload, "context"> | Message, options?: InvokeOptions<U>): void;
|
|
261
|
-
/**
|
|
262
|
-
* Subscribes to receive the next message on a specific topic.
|
|
263
|
-
* This overload returns a Promise that resolves with the next message published to the topic.
|
|
264
|
-
* It's useful for one-time message handling or when using async/await patterns.
|
|
265
|
-
*
|
|
266
|
-
* @param topic - The topic to subscribe to
|
|
267
|
-
* @returns A Promise that resolves with the next message payload published to the specified topic
|
|
268
|
-
*
|
|
269
|
-
* @example
|
|
270
|
-
* Here's an example of how to subscribe to a topic and receive the next message:
|
|
271
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-publish-message}
|
|
272
|
-
*/
|
|
273
|
-
subscribe(topic: string | string[], listener?: undefined): Promise<MessagePayload>;
|
|
274
|
-
/**
|
|
275
|
-
* Subscribes to messages on a specific topic with a listener callback.
|
|
276
|
-
* This overload registers a listener function that will be called for each message published to the topic.
|
|
277
|
-
* It's useful for continuous message handling or event-driven architectures.
|
|
278
|
-
*
|
|
279
|
-
* @param topic - The topic to subscribe to
|
|
280
|
-
* @param listener - Callback function that will be invoked when messages arrive on the specified topic
|
|
281
|
-
* @returns An Unsubscribe function that can be called to cancel the subscription
|
|
282
|
-
*
|
|
283
|
-
* @example
|
|
284
|
-
* Here's an example of how to subscribe to a topic with a listener:
|
|
285
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-subscribe-topic}
|
|
286
|
-
*/
|
|
287
|
-
subscribe(topic: string | string[], listener: MessageQueueListener): Unsubscribe;
|
|
288
|
-
/**
|
|
289
|
-
* Generic subscribe signature that handles both Promise and listener patterns.
|
|
290
|
-
* This is the implementation signature that supports both overloaded behaviors.
|
|
291
|
-
*
|
|
292
|
-
* @param topic - The topic to subscribe to
|
|
293
|
-
* @param listener - Optional callback function
|
|
294
|
-
* @returns Either a Promise for the next message or an Unsubscribe function
|
|
295
|
-
*/
|
|
296
|
-
subscribe(topic: string | string[], listener?: MessageQueueListener): Unsubscribe | Promise<MessagePayload>;
|
|
297
|
-
/**
|
|
298
|
-
* Unsubscribes a listener from a specific topic in the message queue.
|
|
299
|
-
* This method stops a previously registered listener from receiving further messages.
|
|
300
|
-
* It should be called when message processing is complete or when the component is no longer interested
|
|
301
|
-
* in messages published to the specified topic.
|
|
302
|
-
*
|
|
303
|
-
* @param topic - The topic to unsubscribe from
|
|
304
|
-
* @param listener - The listener function that was previously subscribed to the topic
|
|
305
|
-
*
|
|
306
|
-
* @example
|
|
307
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-subscribe-topic}
|
|
308
|
-
*/
|
|
309
|
-
unsubscribe(topic: string | string[], listener: MessageQueueListener): void;
|
|
310
|
-
/**
|
|
311
|
-
* Gracefully shuts down the AIGNE instance and all its agents and skills.
|
|
312
|
-
* This ensures proper cleanup of resources before termination.
|
|
313
|
-
*
|
|
314
|
-
* @returns A promise that resolves when shutdown is complete.
|
|
315
|
-
*
|
|
316
|
-
* @example
|
|
317
|
-
* Here's an example of shutdown an AIGNE instance:
|
|
318
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown}
|
|
319
|
-
*/
|
|
320
|
-
shutdown(): Promise<void>;
|
|
321
|
-
/**
|
|
322
|
-
* Asynchronous dispose method for the AIGNE instance.
|
|
323
|
-
*
|
|
324
|
-
* @example
|
|
325
|
-
* Here's an example of using async dispose:
|
|
326
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown-using}
|
|
327
|
-
*/
|
|
328
|
-
[Symbol.asyncDispose](): Promise<void>;
|
|
329
|
-
/**
|
|
330
|
-
* Initializes handlers for process exit events to ensure clean shutdown.
|
|
331
|
-
* This registers handlers for SIGINT/SIGTERM to properly terminate all agents.
|
|
332
|
-
* Note: 'exit' event cannot run async code, so we handle cleanup in signal handlers.
|
|
333
|
-
*/
|
|
334
|
-
private initProcessExitHandler;
|
|
335
|
-
}
|
package/lib/cjs/aigne/aigne.js
DELETED
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AIGNE = void 0;
|
|
4
|
-
const observability_api_1 = require("@aigne/observability-api");
|
|
5
|
-
const zod_1 = require("zod");
|
|
6
|
-
const index_js_1 = require("../loader/index.js");
|
|
7
|
-
const type_utils_js_1 = require("../utils/type-utils.js");
|
|
8
|
-
const context_js_1 = require("./context.js");
|
|
9
|
-
const message_queue_js_1 = require("./message-queue.js");
|
|
10
|
-
/**
|
|
11
|
-
* AIGNE is a class that orchestrates multiple agents to build complex AI applications.
|
|
12
|
-
* It serves as the central coordination point for agent interactions, message passing, and execution flow.
|
|
13
|
-
*
|
|
14
|
-
* @example
|
|
15
|
-
* Here's a simple example of how to use AIGNE:
|
|
16
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-simple}
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* Here's an example of how to use AIGNE with streaming response:
|
|
20
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-streaming}
|
|
21
|
-
*/
|
|
22
|
-
class AIGNE {
|
|
23
|
-
/**
|
|
24
|
-
* Loads an AIGNE instance from a directory containing an aigne.yaml file and agent definitions.
|
|
25
|
-
* This static method provides a convenient way to initialize an AIGNE system from configuration files.
|
|
26
|
-
*
|
|
27
|
-
* @param path - Path to the directory containing the aigne.yaml file.
|
|
28
|
-
* @param options - Options to override the loaded configuration.
|
|
29
|
-
* @returns A fully initialized AIGNE instance with configured agents and skills.
|
|
30
|
-
*/
|
|
31
|
-
static async load(path, options = {}) {
|
|
32
|
-
const { agents = [], skills = [], model, imageModel, ...aigne } = await (0, index_js_1.load)(path, options);
|
|
33
|
-
return new AIGNE({
|
|
34
|
-
...aigne,
|
|
35
|
-
...options,
|
|
36
|
-
model,
|
|
37
|
-
imageModel,
|
|
38
|
-
agents: agents.concat(options?.agents ?? []),
|
|
39
|
-
skills: skills.concat(options?.skills ?? []),
|
|
40
|
-
metadata: options?.metadata,
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
/**
|
|
44
|
-
* Creates a new AIGNE instance with the specified options.
|
|
45
|
-
*
|
|
46
|
-
* @param options - Configuration options for the AIGNE instance including name, description, model, and agents.
|
|
47
|
-
*/
|
|
48
|
-
constructor(options) {
|
|
49
|
-
if (options)
|
|
50
|
-
(0, type_utils_js_1.checkArguments)("AIGNE", aigneOptionsSchema, options);
|
|
51
|
-
this.rootDir = options?.rootDir;
|
|
52
|
-
this.name = options?.name;
|
|
53
|
-
this.description = options?.description;
|
|
54
|
-
this.model = options?.model;
|
|
55
|
-
this.imageModel = options?.imageModel;
|
|
56
|
-
this.limits = options?.limits;
|
|
57
|
-
this.observer =
|
|
58
|
-
process.env.AIGNE_OBSERVABILITY_DISABLED === "true"
|
|
59
|
-
? undefined
|
|
60
|
-
: (options?.observer ?? new observability_api_1.AIGNEObserver());
|
|
61
|
-
if (options?.skills?.length)
|
|
62
|
-
this.skills.push(...options.skills);
|
|
63
|
-
if (options?.agents?.length)
|
|
64
|
-
this.addAgent(...options.agents);
|
|
65
|
-
if (options?.mcpServer?.agents?.length)
|
|
66
|
-
this.mcpServer.agents.push(...options.mcpServer.agents);
|
|
67
|
-
this.cli = options?.cli ?? {};
|
|
68
|
-
this.observer?.serve();
|
|
69
|
-
this.initProcessExitHandler();
|
|
70
|
-
this.metadata = options?.metadata ?? {};
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* Optional root directory for this AIGNE instance.
|
|
74
|
-
*/
|
|
75
|
-
rootDir;
|
|
76
|
-
/**
|
|
77
|
-
* Optional name identifier for this AIGNE instance.
|
|
78
|
-
*/
|
|
79
|
-
name;
|
|
80
|
-
/**
|
|
81
|
-
* Optional description of this AIGNE instance's purpose or functionality.
|
|
82
|
-
*/
|
|
83
|
-
description;
|
|
84
|
-
/**
|
|
85
|
-
* Global model to use for all agents that don't specify their own model.
|
|
86
|
-
*/
|
|
87
|
-
model;
|
|
88
|
-
/**
|
|
89
|
-
* Optional image model to use for image processing tasks.
|
|
90
|
-
*/
|
|
91
|
-
imageModel;
|
|
92
|
-
/**
|
|
93
|
-
* Usage limits applied to this AIGNE instance's execution.
|
|
94
|
-
*/
|
|
95
|
-
limits;
|
|
96
|
-
/**
|
|
97
|
-
* Message queue for handling inter-agent communication.
|
|
98
|
-
*
|
|
99
|
-
* @hidden
|
|
100
|
-
*/
|
|
101
|
-
messageQueue = new message_queue_js_1.MessageQueue();
|
|
102
|
-
/**
|
|
103
|
-
* Collection of all context IDs created by this AIGNE instance.
|
|
104
|
-
*/
|
|
105
|
-
contextIds = new Set();
|
|
106
|
-
/**
|
|
107
|
-
* Collection of skill agents available to this AIGNE instance.
|
|
108
|
-
* Provides indexed access by skill name.
|
|
109
|
-
*/
|
|
110
|
-
skills = (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((i) => i.name === name));
|
|
111
|
-
/**
|
|
112
|
-
* Collection of primary agents managed by this AIGNE instance.
|
|
113
|
-
* Provides indexed access by agent name.
|
|
114
|
-
*/
|
|
115
|
-
agents = (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((i) => i.name === name));
|
|
116
|
-
mcpServer = {
|
|
117
|
-
agents: (0, type_utils_js_1.createAccessorArray)([], (arr, name) => arr.find((i) => i.name === name)),
|
|
118
|
-
};
|
|
119
|
-
cli = {};
|
|
120
|
-
/**
|
|
121
|
-
* Observer for the AIGNE instance.
|
|
122
|
-
*/
|
|
123
|
-
observer;
|
|
124
|
-
/**
|
|
125
|
-
* Metadata for the AIGNE instance.
|
|
126
|
-
*/
|
|
127
|
-
metadata = {};
|
|
128
|
-
/**
|
|
129
|
-
* Adds one or more agents to this AIGNE instance.
|
|
130
|
-
* Each agent is attached to this AIGNE instance, allowing it to access the AIGNE's resources.
|
|
131
|
-
*
|
|
132
|
-
* @param agents - One or more Agent instances to add to this AIGNE.
|
|
133
|
-
*/
|
|
134
|
-
addAgent(...agents) {
|
|
135
|
-
(0, type_utils_js_1.checkArguments)("AIGNE.addAgent", aigneAddAgentArgsSchema, agents);
|
|
136
|
-
for (const agent of agents) {
|
|
137
|
-
this.agents.push(agent);
|
|
138
|
-
agent.attach(this);
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
/**
|
|
142
|
-
* Creates a new execution context for this AIGNE instance.
|
|
143
|
-
* Contexts isolate state for different flows or conversations.
|
|
144
|
-
*
|
|
145
|
-
* @returns A new AIGNEContext instance bound to this AIGNE.
|
|
146
|
-
*/
|
|
147
|
-
newContext(options) {
|
|
148
|
-
const context = new context_js_1.AIGNEContext(this);
|
|
149
|
-
if (options?.userContext)
|
|
150
|
-
context.userContext = options.userContext;
|
|
151
|
-
if (options?.memories)
|
|
152
|
-
context.memories = options.memories;
|
|
153
|
-
return context;
|
|
154
|
-
}
|
|
155
|
-
invoke(agent, message, options) {
|
|
156
|
-
this.observer?.serve();
|
|
157
|
-
const context = new context_js_1.AIGNEContext(this);
|
|
158
|
-
return context.invoke(agent, message, { ...options, newContext: false });
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* Publishes a message to the message queue for inter-agent communication.
|
|
162
|
-
* This method broadcasts a message to all subscribers of the specified topic(s).
|
|
163
|
-
* It creates a new context internally and delegates to the context's publish method.
|
|
164
|
-
*
|
|
165
|
-
* @param topic - The topic or array of topics to publish the message to
|
|
166
|
-
* @param payload - The message payload to be delivered to subscribers
|
|
167
|
-
* @param options - Optional configuration parameters for the publish operation
|
|
168
|
-
*
|
|
169
|
-
* @example
|
|
170
|
-
* Here's an example of how to publish a message:
|
|
171
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-publish-message}
|
|
172
|
-
*/
|
|
173
|
-
publish(topic, payload, options) {
|
|
174
|
-
this.observer?.serve();
|
|
175
|
-
return new context_js_1.AIGNEContext(this).publish(topic, payload, options);
|
|
176
|
-
}
|
|
177
|
-
subscribe(topic, listener) {
|
|
178
|
-
return this.messageQueue.subscribe(topic, listener);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Unsubscribes a listener from a specific topic in the message queue.
|
|
182
|
-
* This method stops a previously registered listener from receiving further messages.
|
|
183
|
-
* It should be called when message processing is complete or when the component is no longer interested
|
|
184
|
-
* in messages published to the specified topic.
|
|
185
|
-
*
|
|
186
|
-
* @param topic - The topic to unsubscribe from
|
|
187
|
-
* @param listener - The listener function that was previously subscribed to the topic
|
|
188
|
-
*
|
|
189
|
-
* @example
|
|
190
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-subscribe-topic}
|
|
191
|
-
*/
|
|
192
|
-
unsubscribe(topic, listener) {
|
|
193
|
-
this.messageQueue.unsubscribe(topic, listener);
|
|
194
|
-
}
|
|
195
|
-
/**
|
|
196
|
-
* Gracefully shuts down the AIGNE instance and all its agents and skills.
|
|
197
|
-
* This ensures proper cleanup of resources before termination.
|
|
198
|
-
*
|
|
199
|
-
* @returns A promise that resolves when shutdown is complete.
|
|
200
|
-
*
|
|
201
|
-
* @example
|
|
202
|
-
* Here's an example of shutdown an AIGNE instance:
|
|
203
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown}
|
|
204
|
-
*/
|
|
205
|
-
async shutdown() {
|
|
206
|
-
// Close observer first to flush any pending traces
|
|
207
|
-
await this.observer?.close(Array.from(this.contextIds));
|
|
208
|
-
for (const tool of this.skills) {
|
|
209
|
-
await tool.shutdown();
|
|
210
|
-
}
|
|
211
|
-
for (const agent of this.agents) {
|
|
212
|
-
await agent.shutdown();
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
/**
|
|
216
|
-
* Asynchronous dispose method for the AIGNE instance.
|
|
217
|
-
*
|
|
218
|
-
* @example
|
|
219
|
-
* Here's an example of using async dispose:
|
|
220
|
-
* {@includeCode ../../test/aigne/aigne.test.ts#example-shutdown-using}
|
|
221
|
-
*/
|
|
222
|
-
async [Symbol.asyncDispose]() {
|
|
223
|
-
await this.shutdown();
|
|
224
|
-
}
|
|
225
|
-
/**
|
|
226
|
-
* Initializes handlers for process exit events to ensure clean shutdown.
|
|
227
|
-
* This registers handlers for SIGINT/SIGTERM to properly terminate all agents.
|
|
228
|
-
* Note: 'exit' event cannot run async code, so we handle cleanup in signal handlers.
|
|
229
|
-
*/
|
|
230
|
-
initProcessExitHandler() {
|
|
231
|
-
const originalExit = process.exit;
|
|
232
|
-
// @ts-ignore
|
|
233
|
-
process.exit = (...args) => {
|
|
234
|
-
this.shutdown().finally(() => originalExit(...args));
|
|
235
|
-
};
|
|
236
|
-
const shutdownAndExit = () => this.shutdown().finally(() => originalExit(0));
|
|
237
|
-
process.on("SIGINT", shutdownAndExit);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
exports.AIGNE = AIGNE;
|
|
241
|
-
const aigneOptionsSchema = zod_1.z.object({
|
|
242
|
-
model: zod_1.z.custom().optional(),
|
|
243
|
-
imageModel: zod_1.z.custom().optional(),
|
|
244
|
-
skills: zod_1.z.array(zod_1.z.custom()).optional(),
|
|
245
|
-
agents: zod_1.z.array(zod_1.z.custom()).optional(),
|
|
246
|
-
observer: zod_1.z.custom().optional(),
|
|
247
|
-
});
|
|
248
|
-
const aigneAddAgentArgsSchema = zod_1.z.array(zod_1.z.custom());
|