@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
|
@@ -1,672 +0,0 @@
|
|
|
1
|
-
import { type ZodType, z } from "zod";
|
|
2
|
-
import { type PromiseOrValue } from "../utils/type-utils.js";
|
|
3
|
-
import { type AgentInvokeOptions, type AgentOptions, type AgentProcessResult, type AgentResponse, type AgentResponseStream, type GetterSchema, type Message } from "./agent.js";
|
|
4
|
-
import { type FileType, type FileUnionContent, Model } from "./model.js";
|
|
5
|
-
export declare class StructuredOutputError extends Error {
|
|
6
|
-
}
|
|
7
|
-
export interface ChatModelOptions extends Omit<AgentOptions<ChatModelInput, ChatModelOutput>, "model" | "inputSchema" | "outputSchema"> {
|
|
8
|
-
model?: string;
|
|
9
|
-
modelOptions?: ChatModelInputOptionsWithGetter;
|
|
10
|
-
}
|
|
11
|
-
/**
|
|
12
|
-
* ChatModel is an abstract base class for interacting with Large Language Models (LLMs).
|
|
13
|
-
*
|
|
14
|
-
* This class extends the Agent class and provides a common interface for handling model inputs,
|
|
15
|
-
* outputs, and capabilities. Specific model implementations (like OpenAI, Anthropic, etc.)
|
|
16
|
-
* should inherit from this class and implement their specific functionalities.
|
|
17
|
-
*
|
|
18
|
-
* @example
|
|
19
|
-
* Here's how to implement a custom ChatModel:
|
|
20
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model}
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* Here's an example showing streaming response with readable stream:
|
|
24
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-streaming}
|
|
25
|
-
*
|
|
26
|
-
* @example
|
|
27
|
-
* Here's an example showing streaming response with async generator:
|
|
28
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-streaming-async-generator}
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* Here's an example with tool calls:
|
|
32
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
33
|
-
*/
|
|
34
|
-
export declare abstract class ChatModel extends Model<ChatModelInput, ChatModelOutput> {
|
|
35
|
-
options?: ChatModelOptions | undefined;
|
|
36
|
-
tag: string;
|
|
37
|
-
constructor(options?: ChatModelOptions | undefined);
|
|
38
|
-
get credential(): PromiseOrValue<{
|
|
39
|
-
url?: string;
|
|
40
|
-
apiKey?: string;
|
|
41
|
-
model?: string;
|
|
42
|
-
}>;
|
|
43
|
-
/**
|
|
44
|
-
* Indicates whether the model supports parallel tool calls
|
|
45
|
-
*
|
|
46
|
-
* Defaults to true, subclasses can override this property based on
|
|
47
|
-
* specific model capabilities
|
|
48
|
-
*/
|
|
49
|
-
protected supportsParallelToolCalls: boolean;
|
|
50
|
-
/**
|
|
51
|
-
* Gets the model's supported capabilities
|
|
52
|
-
*
|
|
53
|
-
* Currently returns capabilities including: whether parallel tool calls are supported
|
|
54
|
-
*
|
|
55
|
-
* @returns An object containing model capabilities
|
|
56
|
-
*/
|
|
57
|
-
getModelCapabilities(): {
|
|
58
|
-
supportsParallelToolCalls: boolean;
|
|
59
|
-
};
|
|
60
|
-
getModelOptions(input: Message, options: AgentInvokeOptions): Promise<ChatModelInputOptions>;
|
|
61
|
-
private validateToolNames;
|
|
62
|
-
countTokens(input: ChatModelInput): Promise<number>;
|
|
63
|
-
/**
|
|
64
|
-
* Normalizes tool names to ensure compatibility with language models
|
|
65
|
-
*
|
|
66
|
-
* This method converts tool names to a format that complies with model requirements
|
|
67
|
-
* by replacing hyphens and whitespace characters with underscores. The normalized
|
|
68
|
-
* names are used for tool calls while preserving the original names for reference.
|
|
69
|
-
*
|
|
70
|
-
* @param name - The original tool name to normalize
|
|
71
|
-
* @returns A promise that resolves to the normalized tool name
|
|
72
|
-
*/
|
|
73
|
-
protected normalizeToolName(name: string): Promise<string>;
|
|
74
|
-
/**
|
|
75
|
-
* Performs preprocessing operations before handling input
|
|
76
|
-
*
|
|
77
|
-
* Primarily checks if token usage exceeds limits, throwing an exception if limits are exceeded
|
|
78
|
-
*
|
|
79
|
-
* @param input Input message
|
|
80
|
-
* @param options Options for invoking the agent
|
|
81
|
-
* @throws Error if token usage exceeds maximum limit
|
|
82
|
-
*/
|
|
83
|
-
protected preprocess(input: ChatModelInput, options: AgentInvokeOptions): Promise<void>;
|
|
84
|
-
/**
|
|
85
|
-
* Performs postprocessing operations after handling output
|
|
86
|
-
*
|
|
87
|
-
* Primarily updates token usage statistics in the context
|
|
88
|
-
*
|
|
89
|
-
* @param input Input message
|
|
90
|
-
* @param output Output message
|
|
91
|
-
* @param options Options for invoking the agent
|
|
92
|
-
*/
|
|
93
|
-
protected postprocess(input: ChatModelInput, output: ChatModelOutput, options: AgentInvokeOptions): Promise<void>;
|
|
94
|
-
/**
|
|
95
|
-
* Processes input messages and generates model responses
|
|
96
|
-
*
|
|
97
|
-
* This is the core method that must be implemented by all ChatModel subclasses.
|
|
98
|
-
* It handles the communication with the underlying language model,
|
|
99
|
-
* processes the input messages, and generates appropriate responses.
|
|
100
|
-
*
|
|
101
|
-
* Implementations should handle:
|
|
102
|
-
* - Conversion of input format to model-specific format
|
|
103
|
-
* - Sending requests to the language model
|
|
104
|
-
* - Processing model responses
|
|
105
|
-
* - Handling streaming responses if supported
|
|
106
|
-
* - Proper error handling and retries
|
|
107
|
-
* - Token counting and usage tracking
|
|
108
|
-
* - Tool call processing if applicable
|
|
109
|
-
*
|
|
110
|
-
* @param input - The standardized input containing messages and model options
|
|
111
|
-
* @param options - The options for invoking the agent, including context and limits
|
|
112
|
-
* @returns A promise or direct value containing the model's response
|
|
113
|
-
*/
|
|
114
|
-
abstract process(input: ChatModelInput, options: AgentInvokeOptions): PromiseOrValue<AgentProcessResult<ChatModelOutput>>;
|
|
115
|
-
protected processAgentOutput(input: ChatModelInput, output: Exclude<AgentResponse<ChatModelOutput>, AgentResponseStream<ChatModelOutput>>, options: AgentInvokeOptions): Promise<ChatModelOutput>;
|
|
116
|
-
protected validateJsonSchema<T>(schema: object, data: T, options?: {
|
|
117
|
-
safe?: false;
|
|
118
|
-
}): T;
|
|
119
|
-
protected validateJsonSchema<T>(schema: object, data: T, options: {
|
|
120
|
-
safe: true;
|
|
121
|
-
}): z.SafeParseReturnType<T, T>;
|
|
122
|
-
protected validateJsonSchema<T>(schema: object, data: T, options?: {
|
|
123
|
-
safe?: boolean;
|
|
124
|
-
}): T | z.SafeParseReturnType<T, T>;
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Input message format for ChatModel
|
|
128
|
-
*
|
|
129
|
-
* Contains an array of messages to send to the model, response format settings,
|
|
130
|
-
* tool definitions, and model-specific options
|
|
131
|
-
*
|
|
132
|
-
* @example
|
|
133
|
-
* Here's a basic ChatModel input example:
|
|
134
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model}
|
|
135
|
-
*
|
|
136
|
-
* @example
|
|
137
|
-
* Here's an example with tool calling:
|
|
138
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
139
|
-
*/
|
|
140
|
-
export interface ChatModelInput extends Message {
|
|
141
|
-
/**
|
|
142
|
-
* Array of messages to send to the model
|
|
143
|
-
*/
|
|
144
|
-
messages: ChatModelInputMessage[];
|
|
145
|
-
/**
|
|
146
|
-
* Specifies the expected response format
|
|
147
|
-
*/
|
|
148
|
-
responseFormat?: ChatModelInputResponseFormat;
|
|
149
|
-
outputFileType?: FileType;
|
|
150
|
-
/**
|
|
151
|
-
* List of tools available for the model to use
|
|
152
|
-
*/
|
|
153
|
-
tools?: ChatModelInputTool[];
|
|
154
|
-
/**
|
|
155
|
-
* Specifies the tool selection strategy
|
|
156
|
-
*/
|
|
157
|
-
toolChoice?: ChatModelInputToolChoice;
|
|
158
|
-
/**
|
|
159
|
-
* Model-specific configuration options
|
|
160
|
-
*/
|
|
161
|
-
modelOptions?: ChatModelInputOptions;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* Message role types
|
|
165
|
-
*
|
|
166
|
-
* - system: System instructions
|
|
167
|
-
* - user: User messages
|
|
168
|
-
* - agent: Agent/assistant messages
|
|
169
|
-
* - tool: Tool call responses
|
|
170
|
-
*/
|
|
171
|
-
export type Role = "system" | "user" | "agent" | "tool";
|
|
172
|
-
export declare const roleSchema: z.ZodUnion<[z.ZodLiteral<"system">, z.ZodLiteral<"user">, z.ZodLiteral<"agent">, z.ZodLiteral<"tool">]>;
|
|
173
|
-
/**
|
|
174
|
-
* Structure of input messages
|
|
175
|
-
*
|
|
176
|
-
* Defines the format of each message sent to the model, including
|
|
177
|
-
* role, content, and tool call related information
|
|
178
|
-
*/
|
|
179
|
-
export interface ChatModelInputMessage {
|
|
180
|
-
/**
|
|
181
|
-
* Role of the message (system, user, agent, or tool)
|
|
182
|
-
*/
|
|
183
|
-
role: Role;
|
|
184
|
-
/**
|
|
185
|
-
* Message content, can be text or multimodal content array
|
|
186
|
-
*/
|
|
187
|
-
content?: ChatModelInputMessageContent;
|
|
188
|
-
/**
|
|
189
|
-
* Tool call details when the agent wants to execute tool calls
|
|
190
|
-
*/
|
|
191
|
-
toolCalls?: {
|
|
192
|
-
id: string;
|
|
193
|
-
type: "function";
|
|
194
|
-
function: {
|
|
195
|
-
name: string;
|
|
196
|
-
arguments: Message;
|
|
197
|
-
};
|
|
198
|
-
metadata?: Record<string, any>;
|
|
199
|
-
}[];
|
|
200
|
-
/**
|
|
201
|
-
* For tool response messages, specifies the corresponding tool call ID
|
|
202
|
-
*/
|
|
203
|
-
toolCallId?: string;
|
|
204
|
-
/**
|
|
205
|
-
* Name of the message sender (for multi-agent scenarios)
|
|
206
|
-
*/
|
|
207
|
-
name?: string;
|
|
208
|
-
/**
|
|
209
|
-
* Cache control marker for the entire message (only supported by Claude)
|
|
210
|
-
*
|
|
211
|
-
* This is syntactic sugar that applies cacheControl to the last content block
|
|
212
|
-
* of the message. See {@link CacheControl} for details.
|
|
213
|
-
*/
|
|
214
|
-
cacheControl?: CacheControl;
|
|
215
|
-
}
|
|
216
|
-
/**
|
|
217
|
-
* Type of input message content
|
|
218
|
-
*
|
|
219
|
-
* Can be a simple string, or a mixed array of text and image content
|
|
220
|
-
*/
|
|
221
|
-
export type ChatModelInputMessageContent = string | UnionContent[];
|
|
222
|
-
/**
|
|
223
|
-
* Text content type
|
|
224
|
-
*
|
|
225
|
-
* Used for text parts of message content
|
|
226
|
-
*/
|
|
227
|
-
export type TextContent = {
|
|
228
|
-
type: "text";
|
|
229
|
-
text: string;
|
|
230
|
-
isThinking?: boolean;
|
|
231
|
-
isAgentSkill?: boolean;
|
|
232
|
-
/**
|
|
233
|
-
* Cache control marker (only supported by Claude)
|
|
234
|
-
*
|
|
235
|
-
* When set, this content block will be marked as a cache breakpoint.
|
|
236
|
-
* See {@link CacheControl} for details.
|
|
237
|
-
*/
|
|
238
|
-
cacheControl?: CacheControl;
|
|
239
|
-
};
|
|
240
|
-
export declare const textContentSchema: z.ZodObject<{
|
|
241
|
-
type: z.ZodLiteral<"text">;
|
|
242
|
-
text: z.ZodString;
|
|
243
|
-
cacheControl: ZodType<{
|
|
244
|
-
type: "ephemeral";
|
|
245
|
-
ttl?: "5m" | "1h" | undefined;
|
|
246
|
-
} | undefined, z.ZodTypeDef, {
|
|
247
|
-
type: "ephemeral";
|
|
248
|
-
ttl?: "5m" | "1h" | undefined;
|
|
249
|
-
} | undefined>;
|
|
250
|
-
}, "strip", z.ZodTypeAny, {
|
|
251
|
-
type: "text";
|
|
252
|
-
text: string;
|
|
253
|
-
cacheControl?: {
|
|
254
|
-
type: "ephemeral";
|
|
255
|
-
ttl?: "5m" | "1h" | undefined;
|
|
256
|
-
} | undefined;
|
|
257
|
-
}, {
|
|
258
|
-
type: "text";
|
|
259
|
-
text: string;
|
|
260
|
-
cacheControl?: {
|
|
261
|
-
type: "ephemeral";
|
|
262
|
-
ttl?: "5m" | "1h" | undefined;
|
|
263
|
-
} | undefined;
|
|
264
|
-
}>;
|
|
265
|
-
export type UnionContent = TextContent | FileUnionContent;
|
|
266
|
-
export declare const unionContentSchema: z.ZodDiscriminatedUnion<"type", [z.ZodObject<{
|
|
267
|
-
type: z.ZodLiteral<"text">;
|
|
268
|
-
text: z.ZodString;
|
|
269
|
-
cacheControl: ZodType<{
|
|
270
|
-
type: "ephemeral";
|
|
271
|
-
ttl?: "5m" | "1h" | undefined;
|
|
272
|
-
} | undefined, z.ZodTypeDef, {
|
|
273
|
-
type: "ephemeral";
|
|
274
|
-
ttl?: "5m" | "1h" | undefined;
|
|
275
|
-
} | undefined>;
|
|
276
|
-
}, "strip", z.ZodTypeAny, {
|
|
277
|
-
type: "text";
|
|
278
|
-
text: string;
|
|
279
|
-
cacheControl?: {
|
|
280
|
-
type: "ephemeral";
|
|
281
|
-
ttl?: "5m" | "1h" | undefined;
|
|
282
|
-
} | undefined;
|
|
283
|
-
}, {
|
|
284
|
-
type: "text";
|
|
285
|
-
text: string;
|
|
286
|
-
cacheControl?: {
|
|
287
|
-
type: "ephemeral";
|
|
288
|
-
ttl?: "5m" | "1h" | undefined;
|
|
289
|
-
} | undefined;
|
|
290
|
-
}>, z.ZodObject<{
|
|
291
|
-
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
292
|
-
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
293
|
-
} & {
|
|
294
|
-
type: z.ZodLiteral<"local">;
|
|
295
|
-
path: z.ZodString;
|
|
296
|
-
}, "strip", z.ZodTypeAny, {
|
|
297
|
-
path: string;
|
|
298
|
-
type: "local";
|
|
299
|
-
filename?: string | undefined;
|
|
300
|
-
mimeType?: string | undefined;
|
|
301
|
-
}, {
|
|
302
|
-
path: string;
|
|
303
|
-
type: "local";
|
|
304
|
-
filename?: string | undefined;
|
|
305
|
-
mimeType?: string | undefined;
|
|
306
|
-
}>, z.ZodObject<{
|
|
307
|
-
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
308
|
-
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
309
|
-
} & {
|
|
310
|
-
type: z.ZodLiteral<"url">;
|
|
311
|
-
url: z.ZodString;
|
|
312
|
-
}, "strip", z.ZodTypeAny, {
|
|
313
|
-
type: "url";
|
|
314
|
-
url: string;
|
|
315
|
-
filename?: string | undefined;
|
|
316
|
-
mimeType?: string | undefined;
|
|
317
|
-
}, {
|
|
318
|
-
type: "url";
|
|
319
|
-
url: string;
|
|
320
|
-
filename?: string | undefined;
|
|
321
|
-
mimeType?: string | undefined;
|
|
322
|
-
}>, z.ZodObject<{
|
|
323
|
-
filename: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
324
|
-
mimeType: ZodType<string | undefined, z.ZodTypeDef, string | undefined>;
|
|
325
|
-
} & {
|
|
326
|
-
type: z.ZodLiteral<"file">;
|
|
327
|
-
data: z.ZodString;
|
|
328
|
-
}, "strip", z.ZodTypeAny, {
|
|
329
|
-
type: "file";
|
|
330
|
-
data: string;
|
|
331
|
-
filename?: string | undefined;
|
|
332
|
-
mimeType?: string | undefined;
|
|
333
|
-
}, {
|
|
334
|
-
type: "file";
|
|
335
|
-
data: string;
|
|
336
|
-
filename?: string | undefined;
|
|
337
|
-
mimeType?: string | undefined;
|
|
338
|
-
}>]>;
|
|
339
|
-
/**
|
|
340
|
-
* Model response format settings
|
|
341
|
-
*
|
|
342
|
-
* Can be specified as plain text format or according to a JSON Schema
|
|
343
|
-
*/
|
|
344
|
-
export type ChatModelInputResponseFormat = {
|
|
345
|
-
type: "text";
|
|
346
|
-
} | {
|
|
347
|
-
type: "json_schema";
|
|
348
|
-
jsonSchema: {
|
|
349
|
-
name: string;
|
|
350
|
-
description?: string;
|
|
351
|
-
schema: Record<string, unknown>;
|
|
352
|
-
strict?: boolean;
|
|
353
|
-
};
|
|
354
|
-
};
|
|
355
|
-
/**
|
|
356
|
-
* Tool definition provided to the model
|
|
357
|
-
*
|
|
358
|
-
* Defines a function tool, including name, description and parameter structure
|
|
359
|
-
*
|
|
360
|
-
* @example
|
|
361
|
-
* Here's an example showing how to use tools:
|
|
362
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
363
|
-
*/
|
|
364
|
-
export interface ChatModelInputTool {
|
|
365
|
-
/**
|
|
366
|
-
* Tool type, currently only "function" is supported
|
|
367
|
-
*/
|
|
368
|
-
type: "function";
|
|
369
|
-
/**
|
|
370
|
-
* Function tool definition
|
|
371
|
-
*/
|
|
372
|
-
function: {
|
|
373
|
-
/**
|
|
374
|
-
* Function name
|
|
375
|
-
*/
|
|
376
|
-
name: string;
|
|
377
|
-
/**
|
|
378
|
-
* Function description
|
|
379
|
-
*/
|
|
380
|
-
description?: string;
|
|
381
|
-
/**
|
|
382
|
-
* Function parameter structure definition
|
|
383
|
-
*/
|
|
384
|
-
parameters: object;
|
|
385
|
-
};
|
|
386
|
-
/**
|
|
387
|
-
* Provider-specific metadata for the tool
|
|
388
|
-
* For example, Gemini's thought_signature
|
|
389
|
-
*/
|
|
390
|
-
metadata?: Record<string, any>;
|
|
391
|
-
/**
|
|
392
|
-
* Cache control marker (only supported by Claude)
|
|
393
|
-
*
|
|
394
|
-
* When set, this tool definition will be marked as a cache breakpoint.
|
|
395
|
-
* Typically applied to the last tool in the tools array.
|
|
396
|
-
* See {@link CacheControl} for details.
|
|
397
|
-
*/
|
|
398
|
-
cacheControl?: CacheControl;
|
|
399
|
-
}
|
|
400
|
-
/**
|
|
401
|
-
* Tool selection strategy
|
|
402
|
-
*
|
|
403
|
-
* Determines how the model selects and uses tools:
|
|
404
|
-
* - "auto": Automatically decides whether to use tools
|
|
405
|
-
* - "none": Does not use any tools
|
|
406
|
-
* - "required": Must use tools
|
|
407
|
-
* - object: Specifies a particular tool function
|
|
408
|
-
*
|
|
409
|
-
* @example
|
|
410
|
-
* Here's an example showing how to use tools:
|
|
411
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
412
|
-
*/
|
|
413
|
-
export type ChatModelInputToolChoice = "auto" | "none" | "required" | {
|
|
414
|
-
type: "function";
|
|
415
|
-
function: {
|
|
416
|
-
name: string;
|
|
417
|
-
description?: string;
|
|
418
|
-
};
|
|
419
|
-
};
|
|
420
|
-
export type Modality = "text" | "image" | "audio";
|
|
421
|
-
/**
|
|
422
|
-
* Cache control marker for prompt caching
|
|
423
|
-
*
|
|
424
|
-
* Used to mark content blocks, messages, or tools for caching.
|
|
425
|
-
* Currently only supported by Anthropic (Claude) models.
|
|
426
|
-
*/
|
|
427
|
-
export interface CacheControl {
|
|
428
|
-
/**
|
|
429
|
-
* Cache type (currently only "ephemeral" is supported)
|
|
430
|
-
*/
|
|
431
|
-
type: "ephemeral";
|
|
432
|
-
/**
|
|
433
|
-
* Cache TTL (Time To Live)
|
|
434
|
-
* - "5m": 5 minutes (default)
|
|
435
|
-
* - "1h": 1 hour
|
|
436
|
-
*/
|
|
437
|
-
ttl?: "5m" | "1h";
|
|
438
|
-
}
|
|
439
|
-
/**
|
|
440
|
-
* Cache configuration options
|
|
441
|
-
*
|
|
442
|
-
* Controls how prompt caching is used for supported providers.
|
|
443
|
-
* Prompt caching can significantly reduce costs and latency by reusing
|
|
444
|
-
* previously processed prompts (system messages, tool definitions, etc.).
|
|
445
|
-
*/
|
|
446
|
-
export interface CacheConfig {
|
|
447
|
-
/**
|
|
448
|
-
* Whether to enable prompt caching
|
|
449
|
-
*
|
|
450
|
-
* - OpenAI: Ignored (always enabled automatically)
|
|
451
|
-
* - Gemini: Controls explicit caching
|
|
452
|
-
* - Claude: Controls whether to add cache_control markers
|
|
453
|
-
*
|
|
454
|
-
* @default true
|
|
455
|
-
*/
|
|
456
|
-
enabled?: boolean;
|
|
457
|
-
/**
|
|
458
|
-
* Cache TTL (Time To Live)
|
|
459
|
-
*
|
|
460
|
-
* - OpenAI: Ignored (automatic)
|
|
461
|
-
* - Gemini: Supports custom seconds
|
|
462
|
-
* - Claude: Only supports "5m" or "1h"
|
|
463
|
-
*
|
|
464
|
-
* @default "5m"
|
|
465
|
-
*/
|
|
466
|
-
ttl?: "5m" | "1h" | number;
|
|
467
|
-
/**
|
|
468
|
-
* Caching strategy
|
|
469
|
-
*
|
|
470
|
-
* - "auto": Automatically add cache breakpoints at optimal locations
|
|
471
|
-
* - "manual": Require explicit cacheControl markers on messages/tools
|
|
472
|
-
*
|
|
473
|
-
* @default "auto"
|
|
474
|
-
*/
|
|
475
|
-
strategy?: "auto" | "manual";
|
|
476
|
-
/**
|
|
477
|
-
* Auto cache breakpoint locations (only effective when strategy="auto")
|
|
478
|
-
*
|
|
479
|
-
* @default { tools: true, system: true, lastMessage: false }
|
|
480
|
-
*/
|
|
481
|
-
autoBreakpoints?: {
|
|
482
|
-
/** Cache tool definitions */
|
|
483
|
-
tools?: boolean;
|
|
484
|
-
/** Cache system messages */
|
|
485
|
-
system?: boolean;
|
|
486
|
-
/** Cache last message in conversation history */
|
|
487
|
-
lastMessage?: boolean;
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
/**
|
|
491
|
-
* Default cache configuration
|
|
492
|
-
*
|
|
493
|
-
* Enables automatic caching for system messages and tool definitions,
|
|
494
|
-
* which typically provides the best cost/performance tradeoff.
|
|
495
|
-
*/
|
|
496
|
-
export declare const DEFAULT_CACHE_CONFIG: CacheConfig;
|
|
497
|
-
/**
|
|
498
|
-
* Model-specific configuration options
|
|
499
|
-
*
|
|
500
|
-
* Contains various parameters for controlling model behavior, such as model name, temperature, etc.
|
|
501
|
-
*/
|
|
502
|
-
export interface ChatModelInputOptions extends Record<string, unknown> {
|
|
503
|
-
/**
|
|
504
|
-
* Model name or version
|
|
505
|
-
*/
|
|
506
|
-
model?: string;
|
|
507
|
-
/**
|
|
508
|
-
* Temperature parameter, controls randomness (0-1)
|
|
509
|
-
*/
|
|
510
|
-
temperature?: number;
|
|
511
|
-
/**
|
|
512
|
-
* Top-p parameter, controls vocabulary diversity
|
|
513
|
-
*/
|
|
514
|
-
topP?: number;
|
|
515
|
-
/**
|
|
516
|
-
* Frequency penalty parameter, reduces repetition
|
|
517
|
-
*/
|
|
518
|
-
frequencyPenalty?: number;
|
|
519
|
-
/**
|
|
520
|
-
* Presence penalty parameter, encourages diversity
|
|
521
|
-
*/
|
|
522
|
-
presencePenalty?: number;
|
|
523
|
-
/**
|
|
524
|
-
* Whether to allow parallel tool calls
|
|
525
|
-
*/
|
|
526
|
-
parallelToolCalls?: boolean;
|
|
527
|
-
modalities?: Modality[];
|
|
528
|
-
preferInputFileType?: "file" | "url";
|
|
529
|
-
reasoningEffort?: number | "minimal" | "low" | "medium" | "high";
|
|
530
|
-
/**
|
|
531
|
-
* Cache configuration for prompt caching
|
|
532
|
-
*
|
|
533
|
-
* Enables caching of system messages, tool definitions, and conversation history
|
|
534
|
-
* to reduce costs and latency. See {@link CacheConfig} for details.
|
|
535
|
-
*
|
|
536
|
-
* @default DEFAULT_CACHE_CONFIG (enabled with auto strategy)
|
|
537
|
-
*/
|
|
538
|
-
cacheConfig?: CacheConfig;
|
|
539
|
-
}
|
|
540
|
-
export type ChatModelInputOptionsWithGetter = GetterSchema<ChatModelInputOptions>;
|
|
541
|
-
/**
|
|
542
|
-
* Output message format for ChatModel
|
|
543
|
-
*
|
|
544
|
-
* Contains model response content, which can be text, JSON data, tool calls, and usage statistics
|
|
545
|
-
*
|
|
546
|
-
* @example
|
|
547
|
-
* Here's a basic output example:
|
|
548
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model}
|
|
549
|
-
*
|
|
550
|
-
* @example
|
|
551
|
-
* Here's an example with tool calls:
|
|
552
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
553
|
-
*/
|
|
554
|
-
export interface ChatModelOutput extends Message {
|
|
555
|
-
/**
|
|
556
|
-
* Text format response content
|
|
557
|
-
*/
|
|
558
|
-
text?: string;
|
|
559
|
-
/**
|
|
560
|
-
* Model's internal thoughts (if supported)
|
|
561
|
-
*/
|
|
562
|
-
thoughts?: string;
|
|
563
|
-
/**
|
|
564
|
-
* JSON format response content
|
|
565
|
-
*/
|
|
566
|
-
json?: object;
|
|
567
|
-
/**
|
|
568
|
-
* List of tools the model requested to call
|
|
569
|
-
*/
|
|
570
|
-
toolCalls?: ChatModelOutputToolCall[];
|
|
571
|
-
/**
|
|
572
|
-
* Token usage statistics
|
|
573
|
-
*/
|
|
574
|
-
usage?: ChatModelOutputUsage;
|
|
575
|
-
/**
|
|
576
|
-
* Model name or version used
|
|
577
|
-
*/
|
|
578
|
-
model?: string;
|
|
579
|
-
files?: FileUnionContent[];
|
|
580
|
-
}
|
|
581
|
-
/**
|
|
582
|
-
* Tool call information in model output
|
|
583
|
-
*
|
|
584
|
-
* Describes tool calls requested by the model, including tool ID and call parameters
|
|
585
|
-
*
|
|
586
|
-
* @example
|
|
587
|
-
* Here's an example with tool calls:
|
|
588
|
-
* {@includeCode ../../test/agents/chat-model.test.ts#example-chat-model-tools}
|
|
589
|
-
*/
|
|
590
|
-
export interface ChatModelOutputToolCall {
|
|
591
|
-
/**
|
|
592
|
-
* Unique ID of the tool call
|
|
593
|
-
*/
|
|
594
|
-
id: string;
|
|
595
|
-
/**
|
|
596
|
-
* Tool type, currently only "function" is supported
|
|
597
|
-
*/
|
|
598
|
-
type: "function";
|
|
599
|
-
/**
|
|
600
|
-
* Function call details
|
|
601
|
-
*/
|
|
602
|
-
function: {
|
|
603
|
-
/**
|
|
604
|
-
* Name of the function being called
|
|
605
|
-
*/
|
|
606
|
-
name: string;
|
|
607
|
-
/**
|
|
608
|
-
* Arguments for the function call
|
|
609
|
-
*/
|
|
610
|
-
arguments: Message;
|
|
611
|
-
};
|
|
612
|
-
/**
|
|
613
|
-
* Provider-specific metadata for the tool call
|
|
614
|
-
* For example, Gemini's thought_signature
|
|
615
|
-
*/
|
|
616
|
-
metadata?: Record<string, any>;
|
|
617
|
-
}
|
|
618
|
-
/**
|
|
619
|
-
* Model usage statistics
|
|
620
|
-
*
|
|
621
|
-
* Records the number of input and output tokens for tracking model usage
|
|
622
|
-
*/
|
|
623
|
-
export interface ChatModelOutputUsage {
|
|
624
|
-
/**
|
|
625
|
-
* Number of input tokens
|
|
626
|
-
*/
|
|
627
|
-
inputTokens: number;
|
|
628
|
-
/**
|
|
629
|
-
* Number of output tokens
|
|
630
|
-
*/
|
|
631
|
-
outputTokens: number;
|
|
632
|
-
/**
|
|
633
|
-
* AIGNE Hub credit usage
|
|
634
|
-
*/
|
|
635
|
-
aigneHubCredits?: number;
|
|
636
|
-
/**
|
|
637
|
-
* Number of tokens written to cache (first time caching)
|
|
638
|
-
* Only applicable for providers that support explicit cache creation (e.g., Anthropic)
|
|
639
|
-
*/
|
|
640
|
-
cacheCreationInputTokens?: number;
|
|
641
|
-
/**
|
|
642
|
-
* Number of tokens read from cache (cache hit)
|
|
643
|
-
* Supported by OpenAI, Anthropic, and Gemini
|
|
644
|
-
*/
|
|
645
|
-
cacheReadInputTokens?: number;
|
|
646
|
-
/**
|
|
647
|
-
* Credit prefix
|
|
648
|
-
*/
|
|
649
|
-
creditPrefix?: "$" | "€" | "¥";
|
|
650
|
-
}
|
|
651
|
-
export declare const chatModelOutputUsageSchema: z.ZodObject<{
|
|
652
|
-
inputTokens: z.ZodNumber;
|
|
653
|
-
outputTokens: z.ZodNumber;
|
|
654
|
-
aigneHubCredits: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
655
|
-
cacheCreationInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
656
|
-
cacheReadInputTokens: ZodType<number | undefined, z.ZodTypeDef, number | undefined>;
|
|
657
|
-
creditPrefix: ZodType<"$" | "€" | "¥" | undefined, z.ZodTypeDef, "$" | "€" | "¥" | undefined>;
|
|
658
|
-
}, "strip", z.ZodTypeAny, {
|
|
659
|
-
inputTokens: number;
|
|
660
|
-
outputTokens: number;
|
|
661
|
-
aigneHubCredits?: number | undefined;
|
|
662
|
-
cacheCreationInputTokens?: number | undefined;
|
|
663
|
-
cacheReadInputTokens?: number | undefined;
|
|
664
|
-
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
665
|
-
}, {
|
|
666
|
-
inputTokens: number;
|
|
667
|
-
outputTokens: number;
|
|
668
|
-
aigneHubCredits?: number | undefined;
|
|
669
|
-
cacheCreationInputTokens?: number | undefined;
|
|
670
|
-
cacheReadInputTokens?: number | undefined;
|
|
671
|
-
creditPrefix?: "$" | "€" | "¥" | undefined;
|
|
672
|
-
}>;
|