@moureau/pipeflow 0.0.1 → 0.0.3
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 +280 -130
- package/dist/cjs/agents/agent.js +1 -1
- package/dist/cjs/agents/agent.js.map +3 -3
- package/dist/cjs/agents/tools/tools.js +1 -1
- package/dist/cjs/agents/tools/tools.js.map +3 -3
- package/dist/cjs/client/client.js +2 -0
- package/dist/cjs/client/client.js.map +7 -0
- package/dist/cjs/client/index.js +2 -0
- package/dist/cjs/client/index.js.map +7 -0
- package/dist/cjs/client/json.js +2 -0
- package/dist/cjs/client/json.js.map +7 -0
- package/dist/cjs/client/protocol/websocket.js +2 -0
- package/dist/cjs/client/protocol/websocket.js.map +7 -0
- package/dist/cjs/client/protocol.js +2 -0
- package/dist/cjs/client/protocol.js.map +7 -0
- package/dist/cjs/conversations/conversation/conversation.js +1 -1
- package/dist/cjs/conversations/conversation/conversation.js.map +3 -3
- package/dist/cjs/conversations/conversations.js +1 -1
- package/dist/cjs/conversations/conversations.js.map +3 -3
- package/dist/cjs/conversations/index.js +1 -1
- package/dist/cjs/conversations/index.js.map +3 -3
- package/dist/cjs/conversations/orchestration/coordination/coordination.js +10 -0
- package/dist/cjs/conversations/orchestration/coordination/coordination.js.map +7 -0
- package/dist/cjs/conversations/orchestration/coordination/index.js +2 -0
- package/dist/cjs/conversations/orchestration/coordination/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js +4 -0
- package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/coordination-runner/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/generation/generation.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/generation/generation.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/generation/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/generation/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/history/history.js +4 -0
- package/dist/cjs/conversations/orchestration/orchestrator/history/history.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/history/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/history/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/index.js +1 -1
- package/dist/cjs/conversations/orchestration/orchestrator/index.js.map +3 -3
- package/dist/cjs/conversations/orchestration/orchestrator/orchestrator.js +1 -2
- package/dist/cjs/conversations/orchestration/orchestrator/orchestrator.js.map +3 -3
- package/dist/cjs/conversations/orchestration/orchestrator/routing/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/routing/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/routing/routing.js +23 -0
- package/dist/cjs/conversations/orchestration/orchestrator/routing/routing.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/speech/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/speech/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/speech/speech.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/speech/speech.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/tools/index.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/tools/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/orchestrator/tools/tools.js +2 -0
- package/dist/cjs/conversations/orchestration/orchestrator/tools/tools.js.map +7 -0
- package/dist/cjs/conversations/orchestration/test-harness.js +2 -0
- package/dist/cjs/conversations/orchestration/test-harness.js.map +7 -0
- package/dist/cjs/conversations/orchestration/text-chunker/index.js +2 -0
- package/dist/cjs/conversations/orchestration/text-chunker/index.js.map +7 -0
- package/dist/cjs/conversations/orchestration/text-chunker/text-chunker.js +3 -0
- package/dist/cjs/conversations/orchestration/text-chunker/text-chunker.js.map +7 -0
- package/dist/cjs/conversations/stream/conversation-stream.js +2 -0
- package/dist/cjs/conversations/stream/conversation-stream.js.map +7 -0
- package/dist/cjs/conversations/stream/index.js +2 -0
- package/dist/cjs/conversations/stream/index.js.map +7 -0
- package/dist/cjs/conversations/types.js +1 -1
- package/dist/cjs/conversations/types.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +3 -3
- package/dist/cjs/persistence/adapters/sqlite/sqlite.js +18 -14
- package/dist/cjs/persistence/adapters/sqlite/sqlite.js.map +3 -3
- package/dist/cjs/pipeflow/index.js +2 -0
- package/dist/cjs/pipeflow/index.js.map +7 -0
- package/dist/cjs/pipeflow/pipeflow.js +2 -0
- package/dist/cjs/pipeflow/pipeflow.js.map +7 -0
- package/dist/cjs/providers/index.js +1 -1
- package/dist/cjs/providers/index.js.map +2 -2
- package/dist/cjs/providers/llm/adapters/claude/claude.js +5 -0
- package/dist/cjs/providers/llm/adapters/claude/claude.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/claude/index.js +2 -0
- package/dist/cjs/providers/llm/adapters/claude/index.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/deepseek/deepseek.js +1 -1
- package/dist/cjs/providers/llm/adapters/deepseek/deepseek.js.map +3 -3
- package/dist/cjs/providers/llm/adapters/index.js +1 -1
- package/dist/cjs/providers/llm/adapters/index.js.map +3 -3
- package/dist/cjs/providers/llm/adapters/openai/index.js +2 -0
- package/dist/cjs/providers/llm/adapters/openai/index.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/openai/openai.js +2 -0
- package/dist/cjs/providers/llm/adapters/openai/openai.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/openai-compatible.js +10 -0
- package/dist/cjs/providers/llm/adapters/openai-compatible.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/openrouter/index.js +2 -0
- package/dist/cjs/providers/llm/adapters/openrouter/index.js.map +7 -0
- package/dist/cjs/providers/llm/adapters/openrouter/openrouter.js +2 -0
- package/dist/cjs/providers/llm/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/cjs/providers/llm/index.js +1 -1
- package/dist/cjs/providers/llm/index.js.map +3 -3
- package/dist/cjs/providers/llm/toolmode/index.js +2 -0
- package/dist/cjs/providers/llm/toolmode/index.js.map +7 -0
- package/dist/cjs/providers/llm/toolmode/toolmode.js +2 -0
- package/dist/cjs/providers/llm/toolmode/toolmode.js.map +7 -0
- package/dist/cjs/providers/llm/types.js +1 -1
- package/dist/cjs/providers/llm/types.js.map +3 -3
- package/dist/cjs/providers/stt/adapters/deepgram/deepgram.js +1 -1
- package/dist/cjs/providers/stt/adapters/deepgram/deepgram.js.map +3 -3
- package/dist/cjs/providers/stt/adapters/index.js +1 -1
- package/dist/cjs/providers/stt/adapters/index.js.map +3 -3
- package/dist/cjs/providers/stt/adapters/openrouter/index.js +2 -0
- package/dist/cjs/providers/stt/adapters/openrouter/index.js.map +7 -0
- package/dist/cjs/providers/stt/adapters/openrouter/openrouter.js +2 -0
- package/dist/cjs/providers/stt/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/cjs/providers/tts/adapters/index.js +1 -1
- package/dist/cjs/providers/tts/adapters/index.js.map +3 -3
- package/dist/cjs/providers/tts/adapters/kokoro/kokoro.js +4 -1
- package/dist/cjs/providers/tts/adapters/kokoro/kokoro.js.map +3 -3
- package/dist/cjs/providers/tts/adapters/openrouter/index.js +2 -0
- package/dist/cjs/providers/tts/adapters/openrouter/index.js.map +7 -0
- package/dist/cjs/providers/tts/adapters/openrouter/openrouter.js +2 -0
- package/dist/cjs/providers/tts/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/cjs/transport/streamobject/field-stream/field-stream.js +2 -0
- package/dist/cjs/transport/streamobject/field-stream/field-stream.js.map +7 -0
- package/dist/cjs/transport/streamobject/field-stream/index.js +2 -0
- package/dist/cjs/transport/streamobject/field-stream/index.js.map +7 -0
- package/dist/cjs/transport/streamobject/index.js +2 -0
- package/dist/cjs/transport/streamobject/index.js.map +7 -0
- package/dist/cjs/transport/streamobject/json-adapter/index.js +2 -0
- package/dist/cjs/transport/streamobject/json-adapter/index.js.map +7 -0
- package/dist/cjs/transport/streamobject/json-adapter/json-adapter.js +4 -0
- package/dist/cjs/transport/streamobject/json-adapter/json-adapter.js.map +7 -0
- package/dist/cjs/transport/streamobject/reference/index.js +2 -0
- package/dist/cjs/transport/streamobject/reference/index.js.map +7 -0
- package/dist/cjs/transport/streamobject/reference/reference.js +2 -0
- package/dist/cjs/transport/streamobject/reference/reference.js.map +7 -0
- package/dist/cjs/transport/streamobject/stream-object/index.js +2 -0
- package/dist/cjs/transport/streamobject/stream-object/index.js.map +7 -0
- package/dist/cjs/transport/streamobject/stream-object/stream-object.js +2 -0
- package/dist/cjs/transport/streamobject/stream-object/stream-object.js.map +7 -0
- package/dist/esm/agents/agent.js +1 -1
- package/dist/esm/agents/agent.js.map +3 -3
- package/dist/esm/agents/tools/tools.js +1 -1
- package/dist/esm/agents/tools/tools.js.map +3 -3
- package/dist/esm/client/client.js +2 -0
- package/dist/esm/client/client.js.map +7 -0
- package/dist/esm/client/index.js +2 -0
- package/dist/esm/client/index.js.map +7 -0
- package/dist/esm/client/json.js +2 -0
- package/dist/esm/client/json.js.map +7 -0
- package/dist/esm/client/protocol/websocket.js +2 -0
- package/dist/esm/client/protocol/websocket.js.map +7 -0
- package/dist/esm/client/protocol.js +1 -0
- package/dist/esm/client/protocol.js.map +7 -0
- package/dist/esm/conversations/conversation/conversation.js +1 -1
- package/dist/esm/conversations/conversation/conversation.js.map +3 -3
- package/dist/esm/conversations/conversations.js +1 -1
- package/dist/esm/conversations/conversations.js.map +3 -3
- package/dist/esm/conversations/index.js +1 -1
- package/dist/esm/conversations/index.js.map +3 -3
- package/dist/esm/conversations/orchestration/coordination/coordination.js +10 -0
- package/dist/esm/conversations/orchestration/coordination/coordination.js.map +7 -0
- package/dist/esm/conversations/orchestration/coordination/index.js +2 -0
- package/dist/esm/conversations/orchestration/coordination/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js +4 -0
- package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/coordination-runner/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/generation/generation.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/generation/generation.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/generation/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/generation/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/history/history.js +4 -0
- package/dist/esm/conversations/orchestration/orchestrator/history/history.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/history/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/history/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/index.js +1 -1
- package/dist/esm/conversations/orchestration/orchestrator/index.js.map +3 -3
- package/dist/esm/conversations/orchestration/orchestrator/orchestrator.js +1 -2
- package/dist/esm/conversations/orchestration/orchestrator/orchestrator.js.map +3 -3
- package/dist/esm/conversations/orchestration/orchestrator/routing/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/routing/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/routing/routing.js +23 -0
- package/dist/esm/conversations/orchestration/orchestrator/routing/routing.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/speech/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/speech/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/speech/speech.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/speech/speech.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/tools/index.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/tools/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/orchestrator/tools/tools.js +2 -0
- package/dist/esm/conversations/orchestration/orchestrator/tools/tools.js.map +7 -0
- package/dist/esm/conversations/orchestration/test-harness.js +2 -0
- package/dist/esm/conversations/orchestration/test-harness.js.map +7 -0
- package/dist/esm/conversations/orchestration/text-chunker/index.js +2 -0
- package/dist/esm/conversations/orchestration/text-chunker/index.js.map +7 -0
- package/dist/esm/conversations/orchestration/text-chunker/text-chunker.js +3 -0
- package/dist/esm/conversations/orchestration/text-chunker/text-chunker.js.map +7 -0
- package/dist/esm/conversations/stream/conversation-stream.js +2 -0
- package/dist/esm/conversations/stream/conversation-stream.js.map +7 -0
- package/dist/esm/conversations/stream/index.js +2 -0
- package/dist/esm/conversations/stream/index.js.map +7 -0
- package/dist/esm/conversations/types.js +1 -1
- package/dist/esm/conversations/types.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +3 -3
- package/dist/esm/persistence/adapters/sqlite/sqlite.js +18 -14
- package/dist/esm/persistence/adapters/sqlite/sqlite.js.map +3 -3
- package/dist/esm/pipeflow/index.js +2 -0
- package/dist/esm/pipeflow/index.js.map +7 -0
- package/dist/esm/pipeflow/pipeflow.js +2 -0
- package/dist/esm/pipeflow/pipeflow.js.map +7 -0
- package/dist/esm/providers/index.js +1 -1
- package/dist/esm/providers/index.js.map +3 -3
- package/dist/esm/providers/llm/adapters/claude/claude.js +5 -0
- package/dist/esm/providers/llm/adapters/claude/claude.js.map +7 -0
- package/dist/esm/providers/llm/adapters/claude/index.js +2 -0
- package/dist/esm/providers/llm/adapters/claude/index.js.map +7 -0
- package/dist/esm/providers/llm/adapters/deepseek/deepseek.js +1 -1
- package/dist/esm/providers/llm/adapters/deepseek/deepseek.js.map +3 -3
- package/dist/esm/providers/llm/adapters/index.js +1 -1
- package/dist/esm/providers/llm/adapters/index.js.map +3 -3
- package/dist/esm/providers/llm/adapters/openai/index.js +2 -0
- package/dist/esm/providers/llm/adapters/openai/index.js.map +7 -0
- package/dist/esm/providers/llm/adapters/openai/openai.js +2 -0
- package/dist/esm/providers/llm/adapters/openai/openai.js.map +7 -0
- package/dist/esm/providers/llm/adapters/openai-compatible.js +10 -0
- package/dist/esm/providers/llm/adapters/openai-compatible.js.map +7 -0
- package/dist/esm/providers/llm/adapters/openrouter/index.js +2 -0
- package/dist/esm/providers/llm/adapters/openrouter/index.js.map +7 -0
- package/dist/esm/providers/llm/adapters/openrouter/openrouter.js +2 -0
- package/dist/esm/providers/llm/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/esm/providers/llm/index.js +1 -1
- package/dist/esm/providers/llm/index.js.map +3 -3
- package/dist/esm/providers/llm/toolmode/index.js +2 -0
- package/dist/esm/providers/llm/toolmode/index.js.map +7 -0
- package/dist/esm/providers/llm/toolmode/toolmode.js +2 -0
- package/dist/esm/providers/llm/toolmode/toolmode.js.map +7 -0
- package/dist/esm/providers/llm/types.js +1 -0
- package/dist/esm/providers/llm/types.js.map +4 -4
- package/dist/esm/providers/stt/adapters/deepgram/deepgram.js +1 -1
- package/dist/esm/providers/stt/adapters/deepgram/deepgram.js.map +3 -3
- package/dist/esm/providers/stt/adapters/index.js +1 -1
- package/dist/esm/providers/stt/adapters/index.js.map +3 -3
- package/dist/esm/providers/stt/adapters/openrouter/index.js +2 -0
- package/dist/esm/providers/stt/adapters/openrouter/index.js.map +7 -0
- package/dist/esm/providers/stt/adapters/openrouter/openrouter.js +2 -0
- package/dist/esm/providers/stt/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/esm/providers/tts/adapters/index.js +1 -1
- package/dist/esm/providers/tts/adapters/index.js.map +3 -3
- package/dist/esm/providers/tts/adapters/kokoro/kokoro.js +4 -1
- package/dist/esm/providers/tts/adapters/kokoro/kokoro.js.map +3 -3
- package/dist/esm/providers/tts/adapters/openrouter/index.js +2 -0
- package/dist/esm/providers/tts/adapters/openrouter/index.js.map +7 -0
- package/dist/esm/providers/tts/adapters/openrouter/openrouter.js +2 -0
- package/dist/esm/providers/tts/adapters/openrouter/openrouter.js.map +7 -0
- package/dist/esm/transport/streamobject/field-stream/field-stream.js +2 -0
- package/dist/esm/transport/streamobject/field-stream/field-stream.js.map +7 -0
- package/dist/esm/transport/streamobject/field-stream/index.js +2 -0
- package/dist/esm/transport/streamobject/field-stream/index.js.map +7 -0
- package/dist/esm/transport/streamobject/index.js +2 -0
- package/dist/esm/transport/streamobject/index.js.map +7 -0
- package/dist/esm/transport/streamobject/json-adapter/index.js +2 -0
- package/dist/esm/transport/streamobject/json-adapter/index.js.map +7 -0
- package/dist/esm/transport/streamobject/json-adapter/json-adapter.js +4 -0
- package/dist/esm/transport/streamobject/json-adapter/json-adapter.js.map +7 -0
- package/dist/esm/transport/streamobject/reference/index.js +2 -0
- package/dist/esm/transport/streamobject/reference/index.js.map +7 -0
- package/dist/esm/transport/streamobject/reference/reference.js +2 -0
- package/dist/esm/transport/streamobject/reference/reference.js.map +7 -0
- package/dist/esm/transport/streamobject/stream-object/index.js +2 -0
- package/dist/esm/transport/streamobject/stream-object/index.js.map +7 -0
- package/dist/esm/transport/streamobject/stream-object/stream-object.js +2 -0
- package/dist/esm/transport/streamobject/stream-object/stream-object.js.map +7 -0
- package/dist/types/agents/agent.d.ts +3 -0
- package/dist/types/agents/tools/tools.d.ts +28 -6
- package/dist/types/client/client.d.ts +186 -0
- package/dist/types/client/index.d.ts +31 -0
- package/dist/types/client/json.d.ts +13 -0
- package/dist/types/client/protocol/websocket.d.ts +56 -0
- package/dist/types/client/protocol.d.ts +46 -0
- package/dist/types/conversations/conversation/conversation.d.ts +130 -6
- package/dist/types/conversations/conversations.d.ts +35 -1
- package/dist/types/conversations/index.d.ts +2 -1
- package/dist/types/conversations/orchestration/coordination/coordination.d.ts +192 -0
- package/dist/types/conversations/orchestration/coordination/index.d.ts +2 -0
- package/dist/types/conversations/orchestration/orchestrator/coordination-runner/coordination-runner.d.ts +108 -0
- package/dist/types/conversations/orchestration/orchestrator/coordination-runner/index.d.ts +2 -0
- package/dist/types/conversations/orchestration/orchestrator/generation/generation.d.ts +60 -0
- package/dist/types/conversations/orchestration/orchestrator/generation/index.d.ts +2 -0
- package/dist/types/conversations/orchestration/orchestrator/history/history.d.ts +62 -0
- package/dist/types/conversations/orchestration/orchestrator/history/index.d.ts +1 -0
- package/dist/types/conversations/orchestration/orchestrator/index.d.ts +10 -0
- package/dist/types/conversations/orchestration/orchestrator/orchestrator.d.ts +68 -31
- package/dist/types/conversations/orchestration/orchestrator/routing/index.d.ts +1 -0
- package/dist/types/conversations/orchestration/orchestrator/routing/routing.d.ts +19 -0
- package/dist/types/conversations/orchestration/orchestrator/speech/index.d.ts +2 -0
- package/dist/types/conversations/orchestration/orchestrator/speech/speech.d.ts +78 -0
- package/dist/types/conversations/orchestration/orchestrator/tools/index.d.ts +2 -0
- package/dist/types/conversations/orchestration/orchestrator/tools/tools.d.ts +65 -0
- package/dist/types/conversations/orchestration/test-harness.d.ts +100 -0
- package/dist/types/conversations/orchestration/text-chunker/index.d.ts +1 -0
- package/dist/types/conversations/orchestration/text-chunker/text-chunker.d.ts +39 -0
- package/dist/types/conversations/stream/conversation-stream.d.ts +42 -0
- package/dist/types/conversations/stream/index.d.ts +1 -0
- package/dist/types/conversations/types.d.ts +32 -0
- package/dist/types/index.d.ts +5 -38
- package/dist/types/pipeflow/index.d.ts +2 -0
- package/dist/types/pipeflow/pipeflow.d.ts +43 -0
- package/dist/types/providers/index.d.ts +1 -1
- package/dist/types/providers/llm/adapters/claude/claude.d.ts +45 -0
- package/dist/types/providers/llm/adapters/claude/index.d.ts +2 -0
- package/dist/types/providers/llm/adapters/deepseek/deepseek.d.ts +23 -2
- package/dist/types/providers/llm/adapters/index.d.ts +3 -0
- package/dist/types/providers/llm/adapters/openai/index.d.ts +2 -0
- package/dist/types/providers/llm/adapters/openai/openai.d.ts +45 -0
- package/dist/types/providers/llm/adapters/openai-compatible.d.ts +44 -0
- package/dist/types/providers/llm/adapters/openrouter/index.d.ts +2 -0
- package/dist/types/providers/llm/adapters/openrouter/openrouter.d.ts +60 -0
- package/dist/types/providers/llm/index.d.ts +5 -2
- package/dist/types/providers/llm/toolmode/index.d.ts +2 -0
- package/dist/types/providers/llm/toolmode/toolmode.d.ts +99 -0
- package/dist/types/providers/llm/types.d.ts +65 -0
- package/dist/types/providers/stt/adapters/deepgram/deepgram.d.ts +4 -1
- package/dist/types/providers/stt/adapters/index.d.ts +1 -0
- package/dist/types/providers/stt/adapters/openrouter/index.d.ts +2 -0
- package/dist/types/providers/stt/adapters/openrouter/openrouter.d.ts +196 -0
- package/dist/types/providers/tts/adapters/index.d.ts +1 -0
- package/dist/types/providers/tts/adapters/kokoro/kokoro.d.ts +18 -3
- package/dist/types/providers/tts/adapters/openrouter/index.d.ts +2 -0
- package/dist/types/providers/tts/adapters/openrouter/openrouter.d.ts +64 -0
- package/dist/types/transport/streamobject/field-stream/field-stream.d.ts +85 -0
- package/dist/types/transport/streamobject/field-stream/index.d.ts +2 -0
- package/dist/types/transport/streamobject/index.d.ts +8 -0
- package/dist/types/transport/streamobject/json-adapter/index.d.ts +2 -0
- package/dist/types/transport/streamobject/json-adapter/json-adapter.d.ts +65 -0
- package/dist/types/transport/streamobject/reference/index.d.ts +2 -0
- package/dist/types/transport/streamobject/reference/reference.d.ts +127 -0
- package/dist/types/transport/streamobject/stream-object/index.d.ts +2 -0
- package/dist/types/transport/streamobject/stream-object/stream-object.d.ts +31 -0
- package/package.json +29 -2
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import type { Agent } from "../../../agents/agent.js";
|
|
2
|
+
import type { LLM, LLMMessage, LLMToolDefinition } from "../../../providers/llm/types.js";
|
|
3
|
+
/**
|
|
4
|
+
* One task delegated to an agent: a self-contained prompt for a roster member.
|
|
5
|
+
*/
|
|
6
|
+
export interface DelegatedTask {
|
|
7
|
+
agent: string;
|
|
8
|
+
prompt: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The outcome of a delegated agent run (or sub-coordination, via `error`).
|
|
12
|
+
*/
|
|
13
|
+
export interface DelegationResult {
|
|
14
|
+
agent: string;
|
|
15
|
+
text: string;
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
/** What a coordination's LLM may decide to do next. */
|
|
19
|
+
export type DelegateAction = {
|
|
20
|
+
action: "agents";
|
|
21
|
+
tasks: DelegatedTask[];
|
|
22
|
+
} | {
|
|
23
|
+
action: "coordination";
|
|
24
|
+
coordination: string;
|
|
25
|
+
input?: unknown;
|
|
26
|
+
} | {
|
|
27
|
+
action: "clarify";
|
|
28
|
+
missing: string[];
|
|
29
|
+
} | {
|
|
30
|
+
action: "user";
|
|
31
|
+
question: string;
|
|
32
|
+
} | {
|
|
33
|
+
action: "complete";
|
|
34
|
+
output: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* The runtime a coordination reasons against: the roster, every registered
|
|
38
|
+
* coordination, and the primitives for delegating work. Supplied by the
|
|
39
|
+
* orchestrator, so coordinations never couple to it directly.
|
|
40
|
+
*/
|
|
41
|
+
export interface CoordinationRuntime {
|
|
42
|
+
readonly agents: readonly Agent[];
|
|
43
|
+
readonly coordinations: readonly Coordination[];
|
|
44
|
+
/** Shared LLM used for coordination reasoning. */
|
|
45
|
+
readonly llm: LLM;
|
|
46
|
+
/** Shared conversation history, seeded into fresh runs. */
|
|
47
|
+
readonly history: readonly LLMMessage[];
|
|
48
|
+
/** Run one or more agents in parallel (text-only) and return their outputs. */
|
|
49
|
+
delegateAgentTasks(tasks: DelegatedTask[]): Promise<DelegationResult[]>;
|
|
50
|
+
/**
|
|
51
|
+
* Ask the user a question. Never returns: it throws `CoordinationSuspension`
|
|
52
|
+
* carrying the innermost frame, which the orchestrator catches to park the
|
|
53
|
+
* execution until the user answers.
|
|
54
|
+
*/
|
|
55
|
+
askUser(frame: PendingFrame, question: string): Promise<never>;
|
|
56
|
+
/** Stream a delta to speech (TTS narration). */
|
|
57
|
+
onDelta(delta: string): void;
|
|
58
|
+
/** Flush pending narration (e.g. before delegating or suspending). */
|
|
59
|
+
flushSpeech(): void;
|
|
60
|
+
/** Speak a standalone sentence (e.g. a `complete` output). */
|
|
61
|
+
speak(sentence: string): void;
|
|
62
|
+
/** True once an interrupt/stop has cancelled this run. */
|
|
63
|
+
isCancelled(): boolean;
|
|
64
|
+
/** Throw if the run exceeded the coordination step budget. */
|
|
65
|
+
checkBudget(): void;
|
|
66
|
+
}
|
|
67
|
+
export interface CoordinationOptions {
|
|
68
|
+
name: string;
|
|
69
|
+
/** System prompt describing the coordination's reasoning role. */
|
|
70
|
+
prompt?: string;
|
|
71
|
+
/** Overrides the runtime's shared LLM for this coordination. */
|
|
72
|
+
llm?: LLM;
|
|
73
|
+
maxTokens?: number;
|
|
74
|
+
/** Hard wall-clock limit for a single run (including suspensions). */
|
|
75
|
+
maxDurationMs?: number;
|
|
76
|
+
/**
|
|
77
|
+
* Deterministic cap on user-question rounds per run (both the structured
|
|
78
|
+
* `clarify` action and open-ended `user` questions, across suspensions).
|
|
79
|
+
* Once exhausted, the coordination is told to state reasonable
|
|
80
|
+
* assumptions and complete. Defaults to 2.
|
|
81
|
+
*/
|
|
82
|
+
maxQuestionRounds?: number;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* A coordination registered in the orchestrator by name — the registry key
|
|
86
|
+
* is the coordination's name, so it is not repeated here.
|
|
87
|
+
*/
|
|
88
|
+
export type CoordinationRegistration = Omit<CoordinationOptions, "name">;
|
|
89
|
+
/**
|
|
90
|
+
* Render a batched clarification question from the missing details, so the
|
|
91
|
+
* wording is deterministic regardless of how the model phrases the labels.
|
|
92
|
+
*/
|
|
93
|
+
export declare function renderClarifyQuestion(missing: string[]): string;
|
|
94
|
+
/**
|
|
95
|
+
* The system prompt for a `clarify` coordination: a generic,
|
|
96
|
+
* domain-agnostic information-acquisition unit. It turns an underspecified
|
|
97
|
+
* request into a clear one by asking the user for missing details via the
|
|
98
|
+
* structured `clarify` action (batched), with a hard two-round cap enforced
|
|
99
|
+
* by the runtime. Register it alongside `understand`:
|
|
100
|
+
*
|
|
101
|
+
* ```ts
|
|
102
|
+
* coordinations: { clarify: { prompt: buildClarifyPrompt() } }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
export declare function buildClarifyPrompt(): string;
|
|
106
|
+
/**
|
|
107
|
+
* The resumable state of one coordination invocation. Plain data so it can be
|
|
108
|
+
* parked in a `PendingExecution` while waiting for the user.
|
|
109
|
+
*/
|
|
110
|
+
export interface CoordinationState {
|
|
111
|
+
messages: LLMMessage[];
|
|
112
|
+
startedAt: number;
|
|
113
|
+
/** Everything the coordination has spoken so far, for the final record. */
|
|
114
|
+
narration: string;
|
|
115
|
+
/** How many user-question rounds this run has used (across suspensions). */
|
|
116
|
+
questionRounds: number;
|
|
117
|
+
/** Tool call id awaiting a sub-coordination result, for resume replies. */
|
|
118
|
+
pendingToolCallId?: string;
|
|
119
|
+
}
|
|
120
|
+
/** One frame of a suspended execution stack (outermost first). */
|
|
121
|
+
export interface PendingFrame {
|
|
122
|
+
coordination: Coordination;
|
|
123
|
+
state: CoordinationState;
|
|
124
|
+
}
|
|
125
|
+
/** Thrown when a coordination asks the user; carries the whole frame stack. */
|
|
126
|
+
export declare class CoordinationSuspension extends Error {
|
|
127
|
+
readonly frames: PendingFrame[];
|
|
128
|
+
readonly question: string;
|
|
129
|
+
constructor(frames: PendingFrame[], question: string);
|
|
130
|
+
}
|
|
131
|
+
/** Thrown when a coordination run is cancelled (interrupt/stop). */
|
|
132
|
+
export declare class CoordinationCancelled extends Error {
|
|
133
|
+
constructor();
|
|
134
|
+
}
|
|
135
|
+
/** Thrown when a coordination exceeded its step or duration budget. */
|
|
136
|
+
export declare class CoordinationBudgetExceeded extends Error {
|
|
137
|
+
constructor(detail: string);
|
|
138
|
+
}
|
|
139
|
+
/**
|
|
140
|
+
* The tool definition that lets a coordination's LLM choose the next execution
|
|
141
|
+
* target: agents (one or more, in parallel), another coordination, the user,
|
|
142
|
+
* or completion.
|
|
143
|
+
*
|
|
144
|
+
* The parameters are deliberately FLAT (action enum + optional fields) even
|
|
145
|
+
* though the parser enforces a discriminated union per action. Why: Amazon
|
|
146
|
+
* Bedrock (nova) ignores `oneOf` in tool input schemas, which makes the tool
|
|
147
|
+
* effectively empty — the model stops calling it and answers directly instead
|
|
148
|
+
* (measured: 0/2 tool calls and ~5k-token essays vs reliable ~1s calls with
|
|
149
|
+
* the flat shape). The flat schema works across every provider tested; the
|
|
150
|
+
* discriminated contract is enforced when the call is parsed, and an invalid
|
|
151
|
+
* combination costs one bounded retry rather than a broken tool.
|
|
152
|
+
*/
|
|
153
|
+
export declare function delegateToolDefinition(agents: readonly Agent[], coordinations: readonly Coordination[]): LLMToolDefinition;
|
|
154
|
+
export declare function parseDelegateAction(argumentsJson: string, agents: readonly Agent[], coordinations: readonly Coordination[]): DelegateAction;
|
|
155
|
+
/**
|
|
156
|
+
* A hardcoded reasoning/control-flow unit. Unlike an `Agent` (input → LLM →
|
|
157
|
+
* output), a coordination decides *what should happen next*: run agents, pass
|
|
158
|
+
* work to another coordination, ask the user, or complete. Definitions are
|
|
159
|
+
* stateless; each invocation carries its own `CoordinationState`, which can be
|
|
160
|
+
* parked (suspended) while waiting for the user and resumed later.
|
|
161
|
+
*/
|
|
162
|
+
export declare class Coordination {
|
|
163
|
+
readonly name: string;
|
|
164
|
+
readonly prompt: string;
|
|
165
|
+
readonly maxTokens: number | undefined;
|
|
166
|
+
readonly maxDurationMs: number | undefined;
|
|
167
|
+
readonly maxQuestionRounds: number;
|
|
168
|
+
private readonly runtime;
|
|
169
|
+
private readonly llm;
|
|
170
|
+
private cachedToolDefinition;
|
|
171
|
+
private cachedSchema;
|
|
172
|
+
constructor(options: CoordinationOptions, runtime: CoordinationRuntime);
|
|
173
|
+
/** The delegate tool definition, generated once from the roster. */
|
|
174
|
+
private toolDefinition;
|
|
175
|
+
/** Parse a `delegate` tool call against the roster's strict schema. */
|
|
176
|
+
private parseDelegate;
|
|
177
|
+
/** Run the coordination with fresh state (seeded with the shared history). */
|
|
178
|
+
run(input?: unknown): Promise<unknown>;
|
|
179
|
+
/** Resume a suspended state with the user's answer. */
|
|
180
|
+
resume(state: CoordinationState, answer: string): Promise<unknown>;
|
|
181
|
+
/** Continue a suspended state with an injected message (e.g. a sub-result). */
|
|
182
|
+
continueWith(state: CoordinationState, message: LLMMessage): Promise<unknown>;
|
|
183
|
+
/**
|
|
184
|
+
* The coordination loop: one LLM round trip per iteration, choosing the next
|
|
185
|
+
* execution target via the `delegate` tool. Throws `CoordinationSuspension`
|
|
186
|
+
* when asking the user; the state carried in the suspension is resumable.
|
|
187
|
+
*/
|
|
188
|
+
private loop;
|
|
189
|
+
/** Delegate to a sub-coordination, attaching this frame on suspension. */
|
|
190
|
+
private delegateToCoordination;
|
|
191
|
+
private completeOutput;
|
|
192
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { Coordination, CoordinationSuspension, CoordinationCancelled, CoordinationBudgetExceeded, delegateToolDefinition, parseDelegateAction, } from "./coordination.js";
|
|
2
|
+
export type { CoordinationOptions, CoordinationRuntime, CoordinationState, DelegateAction, DelegatedTask, DelegationResult, PendingFrame, } from "./coordination.js";
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import type { Agent } from "../../../../agents/agent.js";
|
|
2
|
+
import type { Conversation } from "../../../conversation/conversation.js";
|
|
3
|
+
import type { LLM } from "../../../../providers/llm/types.js";
|
|
4
|
+
import type { Turn } from "../../../types.js";
|
|
5
|
+
import { Coordination, type CoordinationRegistration, type CoordinationRuntime } from "../../coordination/coordination.js";
|
|
6
|
+
import { ConversationHistory } from "../history/history.js";
|
|
7
|
+
import type { GenerationRunner } from "../generation/generation.js";
|
|
8
|
+
import type { SpeechPipeline } from "../speech/speech.js";
|
|
9
|
+
import type { ToolCallManager } from "../tools/tools.js";
|
|
10
|
+
export interface CoordinationRunnerOptions {
|
|
11
|
+
conversation: Conversation;
|
|
12
|
+
/** Live roster accessor (read at coordination-run time). */
|
|
13
|
+
agents(): Agent[];
|
|
14
|
+
/** Live shared-LLM accessor (undefined in transcription-only mode). */
|
|
15
|
+
llm(): LLM | undefined;
|
|
16
|
+
/** The conversation's message log, seeded into fresh coordination runs. */
|
|
17
|
+
history: ConversationHistory;
|
|
18
|
+
historyWindow: Parameters<ConversationHistory["windowed"]>[0];
|
|
19
|
+
speech: SpeechPipeline;
|
|
20
|
+
generation: GenerationRunner;
|
|
21
|
+
tools: ToolCallManager;
|
|
22
|
+
/** Safety bound on LLM reasoning steps per coordination execution. */
|
|
23
|
+
maxCoordinationSteps: number;
|
|
24
|
+
maxToolIterations: number;
|
|
25
|
+
temperature?: number;
|
|
26
|
+
maxTokens?: number;
|
|
27
|
+
/** The orchestrator's current generation epoch (bumped on interrupt/stop). */
|
|
28
|
+
currentEpoch(): number;
|
|
29
|
+
/** True while the orchestrator is started and the epoch is current. */
|
|
30
|
+
isCurrent(epoch: number): boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The application-specific execution of coordinations: binds the generic
|
|
34
|
+
* `Coordination` primitives to the orchestrator's machinery (roster, shared
|
|
35
|
+
* LLM, history, speech, delegation, budgets, cancellation) and owns the
|
|
36
|
+
* suspension/resume lifecycle — the parked frame stack, the step budget, and
|
|
37
|
+
* the coordination generation records.
|
|
38
|
+
*/
|
|
39
|
+
export declare class CoordinationRunner {
|
|
40
|
+
/** Coordinations registered by name (the key is the coordination's name). */
|
|
41
|
+
readonly coordinations: Record<string, Coordination>;
|
|
42
|
+
/** The built-in `understand` coordination, when one is active. */
|
|
43
|
+
understand: Coordination | null;
|
|
44
|
+
private readonly conversation;
|
|
45
|
+
private readonly agents;
|
|
46
|
+
private readonly llm;
|
|
47
|
+
private readonly history;
|
|
48
|
+
private readonly historyWindow;
|
|
49
|
+
private readonly speech;
|
|
50
|
+
private readonly generation;
|
|
51
|
+
private readonly tools;
|
|
52
|
+
private readonly maxCoordinationSteps;
|
|
53
|
+
private readonly maxToolIterations;
|
|
54
|
+
private readonly temperature;
|
|
55
|
+
private readonly maxTokens;
|
|
56
|
+
private readonly currentEpoch;
|
|
57
|
+
private readonly isCurrent;
|
|
58
|
+
private coordinationEpoch;
|
|
59
|
+
private coordinationStepCount;
|
|
60
|
+
private coordinationRunId;
|
|
61
|
+
private pendingExecution;
|
|
62
|
+
constructor(options: CoordinationRunnerOptions);
|
|
63
|
+
/**
|
|
64
|
+
* Register coordinations by name. The built-in `understand` runs unaddressed
|
|
65
|
+
* turns: it decides whether to delegate to agents, ask the user, or answer
|
|
66
|
+
* directly. Apps can override it by registering their own "understand" key,
|
|
67
|
+
* and add their own (e.g. clarify, review).
|
|
68
|
+
*/
|
|
69
|
+
register(registrations: Record<string, CoordinationRegistration>, agents: readonly Agent[]): void;
|
|
70
|
+
/** True while a coordination is parked waiting for the user to answer. */
|
|
71
|
+
hasPending(): boolean;
|
|
72
|
+
/** Drop a parked execution (interrupt, stop). */
|
|
73
|
+
cancel(): void;
|
|
74
|
+
/**
|
|
75
|
+
* Run the built-in `understand` coordination on an unaddressed turn. A
|
|
76
|
+
* streaming generation is opened for the conversation's default agent; the
|
|
77
|
+
* coordination's final answer (or question) completes it.
|
|
78
|
+
*/
|
|
79
|
+
runDefault(turn: Turn): Promise<void>;
|
|
80
|
+
/**
|
|
81
|
+
* Resume a parked coordination with the user's answer, propagating the
|
|
82
|
+
* result back up the frame stack to the outermost coordination.
|
|
83
|
+
*/
|
|
84
|
+
resume(turn: Turn): Promise<void>;
|
|
85
|
+
/**
|
|
86
|
+
* The runtime the coordinations reason against. Binds the coordination
|
|
87
|
+
* primitives (delegate to agents, ask the user, speech, budget, cancellation)
|
|
88
|
+
* to the runner's machinery without coupling `Coordination` to it.
|
|
89
|
+
*/
|
|
90
|
+
runtime(): CoordinationRuntime;
|
|
91
|
+
/** Complete the current generation and record the coordination's answer. */
|
|
92
|
+
private finalizeOutput;
|
|
93
|
+
/** Park a suspended coordination: record the question and store the stack. */
|
|
94
|
+
private recordSuspension;
|
|
95
|
+
/** Throw the suspension that parks a coordination waiting for the user. */
|
|
96
|
+
private askUser;
|
|
97
|
+
/** Enforce the per-execution reasoning step budget. */
|
|
98
|
+
private checkBudget;
|
|
99
|
+
private emitError;
|
|
100
|
+
/** Run delegated agent tasks in parallel and surface their work. */
|
|
101
|
+
private delegateAgentTasks;
|
|
102
|
+
/**
|
|
103
|
+
* Execute one dispatched task as a sub-generation: the target agent's own
|
|
104
|
+
* LLM, context, and tools, running text-only (no TTS). The final text is
|
|
105
|
+
* returned so the coordinator can merge it into the spoken answer.
|
|
106
|
+
*/
|
|
107
|
+
private runSubGeneration;
|
|
108
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import type { LLM, LLMToolCall, LLMToolDefinition, LLMMessage } from "../../../../providers/llm/types.js";
|
|
2
|
+
import type { ResolvedToolCall } from "../tools/tools.js";
|
|
3
|
+
export interface GenerationRequest {
|
|
4
|
+
/** Display name stamped on assistant tool-call messages. */
|
|
5
|
+
agentName: string;
|
|
6
|
+
llm: LLM;
|
|
7
|
+
/**
|
|
8
|
+
* The conversation messages; the loop appends the assistant tool-call
|
|
9
|
+
* message and the resolved tool results onto this array.
|
|
10
|
+
*/
|
|
11
|
+
messages: LLMMessage[];
|
|
12
|
+
tools: LLMToolDefinition[];
|
|
13
|
+
temperature?: number;
|
|
14
|
+
maxTokens?: number;
|
|
15
|
+
/** Safety bound on tool-call round trips per generation. */
|
|
16
|
+
maxToolIterations: number;
|
|
17
|
+
/** False once the run is stale (interrupt/stop); aborts the loop. */
|
|
18
|
+
isCurrent(): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Whether outgoing messages keep per-agent `name` fields on system and
|
|
21
|
+
* assistant messages. Multi-agent conversations need them so the model can
|
|
22
|
+
* tell which agent said what in the shared history. Single-agent
|
|
23
|
+
* conversations drop them: with one agent the names carry no information,
|
|
24
|
+
* and some providers render a message `name` as a role header ("Scout:")
|
|
25
|
+
* that weaker models imitate — every reply then starts by speaking the
|
|
26
|
+
* agent's name. Default true.
|
|
27
|
+
*/
|
|
28
|
+
agentNames?: boolean;
|
|
29
|
+
/** Streamed text; `textBefore` is the running text prior to this delta. */
|
|
30
|
+
onDelta?(delta: string, textBefore: string): void;
|
|
31
|
+
/** Hand tool calls to the application and resolve their results. */
|
|
32
|
+
resolveToolCalls(calls: LLMToolCall[]): Promise<ResolvedToolCall[]>;
|
|
33
|
+
}
|
|
34
|
+
export type GenerationStatus = "done" | "interrupted" | "error";
|
|
35
|
+
export interface GenerationOutcome {
|
|
36
|
+
/** Everything the model produced (or produced before failing). */
|
|
37
|
+
text: string;
|
|
38
|
+
status: GenerationStatus;
|
|
39
|
+
/** The provider error, when `status` is "error". */
|
|
40
|
+
error?: unknown;
|
|
41
|
+
/**
|
|
42
|
+
* How many tool rounds were resolved before the run ended (only present
|
|
43
|
+
* when at least one). Lets callers retry a no-output failure safely:
|
|
44
|
+
* re-running a generation whose tools already executed would repeat their
|
|
45
|
+
* side effects.
|
|
46
|
+
*/
|
|
47
|
+
toolRounds?: number;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Owns the LLM tool loop shared by top-level generations and delegated
|
|
51
|
+
* sub-generations: stream deltas, collect tool calls, resolve them through
|
|
52
|
+
* the application, and repeat up to `maxToolIterations`.
|
|
53
|
+
*
|
|
54
|
+
* It is deliberately ignorant of the conversation lifecycle — persistence,
|
|
55
|
+
* transcripts, speech, and history are the caller's concern, decided from
|
|
56
|
+
* the returned `GenerationOutcome`.
|
|
57
|
+
*/
|
|
58
|
+
export declare class GenerationRunner {
|
|
59
|
+
run(request: GenerationRequest): Promise<GenerationOutcome>;
|
|
60
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Conversation } from "../../../conversation/conversation.js";
|
|
2
|
+
import type { Generation, Participant, Turn } from "../../../types.js";
|
|
3
|
+
import type { LLMMessage } from "../../../../providers/llm/types.js";
|
|
4
|
+
/**
|
|
5
|
+
* A human-readable "now" stamp appended to dispatched prompts so
|
|
6
|
+
* time-sensitive tasks (flights, meetings, deadlines) have temporal context.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatTimeContext(date?: Date): string;
|
|
9
|
+
/**
|
|
10
|
+
* A short context suffix appended automatically to every user turn, so the
|
|
11
|
+
* model knows the time and who is speaking (and who else is in the
|
|
12
|
+
* conversation) — e.g. "enhance the message I just sent" resolves to a real
|
|
13
|
+
* user id. Applied once, when the turn enters history; every generation path
|
|
14
|
+
* (direct, coordination, delegated) seeds from that history.
|
|
15
|
+
*/
|
|
16
|
+
export declare function formatTurnContext(participant: Participant, participants: readonly Participant[], date?: Date): string;
|
|
17
|
+
/** How much conversational history an LLM request may carry. */
|
|
18
|
+
export interface HistoryWindow {
|
|
19
|
+
/** Keep at most this many user turns (the current turn is always kept). */
|
|
20
|
+
maxTurns: number;
|
|
21
|
+
/** Drop oldest whole messages until the window fits this many characters. */
|
|
22
|
+
maxChars: number;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* Bounds conversation history for an LLM request: keep the most recent
|
|
26
|
+
* `maxTurns` user turns (plus anything after them), then drop oldest whole
|
|
27
|
+
* messages until the window fits `maxChars`. The current turn is the last
|
|
28
|
+
* user message and always survives. Provider TTFT grows with input size, so
|
|
29
|
+
* a bounded window keeps requests in the fast regime.
|
|
30
|
+
*/
|
|
31
|
+
export declare function windowHistory(history: LLMMessage[], { maxTurns, maxChars }: HistoryWindow): LLMMessage[];
|
|
32
|
+
/**
|
|
33
|
+
* The conversation's LLM message log: every user turn and agent reply, plus
|
|
34
|
+
* the turn-context formatting and windowing applied when a request is built.
|
|
35
|
+
* The orchestrator's `Conversation` remains the source of truth for turns,
|
|
36
|
+
* transcripts, and generations — this is the derived prompt log only.
|
|
37
|
+
*/
|
|
38
|
+
export declare class ConversationHistory {
|
|
39
|
+
private readonly messages;
|
|
40
|
+
/**
|
|
41
|
+
* The user-message form of a turn: display name, text, and the automatic
|
|
42
|
+
* context suffix (time + speaker + roster) baked in at history time.
|
|
43
|
+
*/
|
|
44
|
+
turnMessage(turn: Turn, conversation: Conversation): string;
|
|
45
|
+
/** Append a participant turn as a user message. */
|
|
46
|
+
addUserTurn(turn: Turn, conversation: Conversation): void;
|
|
47
|
+
/** Append an agent reply as an assistant message. */
|
|
48
|
+
addAssistant(agentName: string, text: string): void;
|
|
49
|
+
/**
|
|
50
|
+
* Rehydrate from persisted turns and completed top-level generations.
|
|
51
|
+
* Sub-generations are summarized inside the coordinator's own answer, so
|
|
52
|
+
* only top-level responses rehydrate into history.
|
|
53
|
+
*/
|
|
54
|
+
rehydrate(turns: readonly Turn[], generations: readonly Generation[], conversation: Conversation): void;
|
|
55
|
+
/** The full message log. */
|
|
56
|
+
get all(): readonly LLMMessage[];
|
|
57
|
+
/**
|
|
58
|
+
* The message log bounded for an LLM request: the full log when `window`
|
|
59
|
+
* is `false`, otherwise the bounded window.
|
|
60
|
+
*/
|
|
61
|
+
windowed(window: HistoryWindow | false): LLMMessage[];
|
|
62
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ConversationHistory, formatTimeContext, formatTurnContext, windowHistory, type HistoryWindow, } from "./history.js";
|
|
@@ -1,2 +1,12 @@
|
|
|
1
1
|
export { Orchestrator } from "./orchestrator.js";
|
|
2
2
|
export type { OrchestratorOptions } from "./orchestrator.js";
|
|
3
|
+
export { ConversationHistory, formatTimeContext, formatTurnContext, windowHistory, type HistoryWindow, } from "./history.js";
|
|
4
|
+
export { buildUnderstandPrompt, findAddressedAgent, findAgentByName, pickAgent } from "./routing.js";
|
|
5
|
+
export { GenerationRunner } from "./generation.js";
|
|
6
|
+
export type { GenerationOutcome, GenerationRequest, GenerationStatus } from "./generation.js";
|
|
7
|
+
export { SpeechPipeline } from "./speech.js";
|
|
8
|
+
export type { SpeechPipelineOptions } from "./speech.js";
|
|
9
|
+
export { ToolCallManager } from "./tools.js";
|
|
10
|
+
export type { ResolvedToolCall } from "./tools.js";
|
|
11
|
+
export { CoordinationRunner } from "./coordination-runner.js";
|
|
12
|
+
export type { CoordinationRunnerOptions } from "./coordination-runner.js";
|
|
@@ -4,67 +4,109 @@ import type { Persistence } from "../../../persistence/persistence.js";
|
|
|
4
4
|
import type { LLM } from "../../../providers/llm/types.js";
|
|
5
5
|
import type { STT } from "../../../providers/stt/types.js";
|
|
6
6
|
import type { TTS } from "../../../providers/tts/types.js";
|
|
7
|
+
import type { CoordinationRegistration } from "../coordination/coordination.js";
|
|
8
|
+
import { type HistoryWindow } from "./history/history.js";
|
|
7
9
|
export interface OrchestratorOptions {
|
|
8
10
|
conversation: Conversation;
|
|
9
11
|
/**
|
|
10
|
-
* The
|
|
11
|
-
*
|
|
12
|
+
* The agents the orchestrator routes turns to. With more than one agent,
|
|
13
|
+
* unaddressed turns run through the built-in `understand` coordination,
|
|
14
|
+
* which can delegate to agents, ask the user, or answer directly. Omit
|
|
15
|
+
* for transcription-only mode (audio in, turns and transcripts out — no
|
|
16
|
+
* LLM or TTS required).
|
|
12
17
|
*/
|
|
13
|
-
|
|
14
|
-
/** Defaults to the agent's LLM. */
|
|
18
|
+
agents?: Agent[];
|
|
19
|
+
/** Defaults to the first agent's LLM. */
|
|
15
20
|
llm?: LLM;
|
|
16
|
-
|
|
17
|
-
|
|
21
|
+
/** STT for voice turns. Omit for text-only conversations (`send()`). */
|
|
22
|
+
stt?: STT;
|
|
23
|
+
/** TTS for spoken output. Not required for text-only conversations. */
|
|
18
24
|
tts?: TTS;
|
|
19
25
|
/** Used to rehydrate conversation history on start. */
|
|
20
26
|
persistence?: Persistence;
|
|
21
|
-
/** How long to wait for
|
|
27
|
+
/** How long to wait for a tool call to resolve (auto-executed or app-managed). */
|
|
22
28
|
toolTimeoutMs?: number;
|
|
23
29
|
/** Safety bound on tool-call round trips per generation. */
|
|
24
30
|
maxToolIterations?: number;
|
|
31
|
+
/**
|
|
32
|
+
* Execute the agents' tools automatically (default `true`), feeding each
|
|
33
|
+
* tool's result — or a caught error — back into the model loop, like
|
|
34
|
+
* `Agent.run()` does. Set `false` for the application-managed contract:
|
|
35
|
+
* listen for `tool-call` events and resolve each call yourself with
|
|
36
|
+
* `conversation.resolveToolCall()`. The `tool-call` event fires in both
|
|
37
|
+
* modes, so apps can observe every call.
|
|
38
|
+
*/
|
|
39
|
+
autoExecuteTools?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Additional coordinations the runtime can delegate to, registered by
|
|
42
|
+
* name (the key is the coordination's name).
|
|
43
|
+
*/
|
|
44
|
+
coordinations?: Record<string, CoordinationRegistration>;
|
|
45
|
+
/** Safety bound on LLM reasoning steps per coordination execution. */
|
|
46
|
+
maxCoordinationSteps?: number;
|
|
25
47
|
temperature?: number;
|
|
26
48
|
maxTokens?: number;
|
|
49
|
+
/**
|
|
50
|
+
* How much conversation history each LLM request carries (default
|
|
51
|
+
* `{ maxTurns: 5, maxChars: 4000 }` — provider TTFT grows with input size,
|
|
52
|
+
* and a bounded window keeps requests in the fast regime). Pass `false` to
|
|
53
|
+
* always send the full history.
|
|
54
|
+
*/
|
|
55
|
+
historyWindow?: HistoryWindow | false;
|
|
56
|
+
/**
|
|
57
|
+
* How many TTS synthesis requests may be in flight at once (default 2).
|
|
58
|
+
* More lets the sentences of a multi-sentence reply synthesize in parallel
|
|
59
|
+
* (kills the gaps between them) at the cost of provider concurrency — some
|
|
60
|
+
* free TTS variants rate-limit concurrent requests. Passed through to the
|
|
61
|
+
* speech pipeline; see `SpeechPipelineOptions.maxConcurrentRequests`.
|
|
62
|
+
*/
|
|
63
|
+
maxConcurrentTtsRequests?: number;
|
|
27
64
|
}
|
|
28
65
|
/**
|
|
29
|
-
* The realtime conversation state machine.
|
|
66
|
+
* The realtime conversation state machine and multi-agent coordinator.
|
|
30
67
|
*
|
|
31
|
-
* Wires the conversation to the providers
|
|
68
|
+
* Wires the conversation to the providers and routes each turn to an agent.
|
|
69
|
+
* The heavy machinery lives in focused collaborators — history, routing,
|
|
70
|
+
* generation, speech, tools, and coordination — so this class owns only the
|
|
71
|
+
* lifecycle and event wiring:
|
|
32
72
|
*
|
|
33
73
|
* ```text
|
|
34
|
-
* audio-in ──► STT ──► turn ──► LLM ──► TTS ──► audio-out
|
|
35
|
-
*
|
|
36
|
-
*
|
|
74
|
+
* audio-in ──► STT ──► turn ──► coordinator ──► agent ──► LLM ──► TTS ──► audio-out
|
|
75
|
+
* │
|
|
76
|
+
* └─► tool-call ──► tool runs ──► resume
|
|
37
77
|
* ```
|
|
38
78
|
*
|
|
39
79
|
* Deltas stream to TTS immediately (so the agent can narrate while a tool
|
|
40
|
-
* runs), tool calls pause the generation
|
|
41
|
-
*
|
|
42
|
-
*
|
|
80
|
+
* runs), tool calls pause the generation while the tool executes — the
|
|
81
|
+
* framework runs the agent's own tools by default, or the application
|
|
82
|
+
* resolves them when `autoExecuteTools` is off — and interruptions cancel
|
|
83
|
+
* the current generation, discarding any stale tool results or audio via a
|
|
84
|
+
* generation epoch.
|
|
43
85
|
*/
|
|
44
86
|
export declare class Orchestrator {
|
|
45
87
|
private readonly conversation;
|
|
46
|
-
private readonly
|
|
88
|
+
private readonly agents;
|
|
47
89
|
private readonly llm;
|
|
48
90
|
private readonly stt;
|
|
49
91
|
private readonly tts;
|
|
50
92
|
private readonly persistence;
|
|
51
|
-
private readonly toolTimeoutMs;
|
|
52
93
|
private readonly maxToolIterations;
|
|
94
|
+
private readonly historyWindow;
|
|
53
95
|
private readonly temperature;
|
|
54
96
|
private readonly maxTokens;
|
|
97
|
+
private readonly history;
|
|
98
|
+
private readonly speech;
|
|
99
|
+
private readonly tools;
|
|
100
|
+
private readonly generation;
|
|
101
|
+
private readonly coordination;
|
|
55
102
|
private started;
|
|
56
103
|
private generating;
|
|
57
104
|
private epoch;
|
|
105
|
+
private generationChain;
|
|
58
106
|
private readonly unsubscribers;
|
|
59
107
|
private readonly sttSessions;
|
|
60
|
-
private readonly history;
|
|
61
|
-
private readonly toolWaiters;
|
|
62
|
-
private generationChain;
|
|
63
|
-
private speechChain;
|
|
64
|
-
private speechBuffer;
|
|
65
108
|
private pendingTurns;
|
|
66
109
|
private pendingGenerations;
|
|
67
|
-
private audioSequence;
|
|
68
110
|
private turnSequence;
|
|
69
111
|
constructor(options: OrchestratorOptions);
|
|
70
112
|
/**
|
|
@@ -83,16 +125,11 @@ export declare class Orchestrator {
|
|
|
83
125
|
private onFinal;
|
|
84
126
|
private processTurn;
|
|
85
127
|
private onInterrupt;
|
|
86
|
-
|
|
128
|
+
/** Cancel every LLM in play: the shared one and each agent's own. */
|
|
129
|
+
private stopLlms;
|
|
87
130
|
private onProviderError;
|
|
88
131
|
private queueGeneration;
|
|
89
132
|
private generate;
|
|
90
133
|
private runGeneration;
|
|
91
|
-
private
|
|
92
|
-
private waitForToolResult;
|
|
93
|
-
private cancelToolWaiters;
|
|
94
|
-
private feedDelta;
|
|
95
|
-
private flushSpeech;
|
|
96
|
-
/** Synthesize a sentence and push the audio chunks out to the app. */
|
|
97
|
-
private speak;
|
|
134
|
+
private enqueueCoordinationRun;
|
|
98
135
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { buildUnderstandPrompt, findAddressedAgent, findAgentByName, pickAgent, } from "./routing.js";
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Agent } from "../../../../agents/agent.js";
|
|
2
|
+
/**
|
|
3
|
+
* Pick the agent that should handle a turn.
|
|
4
|
+
*
|
|
5
|
+
* The first agent whose name or alias appears in the turn text wins;
|
|
6
|
+
* otherwise the first agent in the roster is the default. Matching is
|
|
7
|
+
* case-insensitive substring matching, so "ask the technical specialist"
|
|
8
|
+
* addresses an agent named "Technical Specialist" (or aliased "tech").
|
|
9
|
+
*/
|
|
10
|
+
export declare function pickAgent(agents: readonly Agent[], text: string): Agent | null;
|
|
11
|
+
/**
|
|
12
|
+
* Like `pickAgent` but without the default: only returns an agent the turn
|
|
13
|
+
* explicitly addresses by name or alias.
|
|
14
|
+
*/
|
|
15
|
+
export declare function findAddressedAgent(agents: readonly Agent[], text: string): Agent | null;
|
|
16
|
+
/** Resolve a task's agent by exact name or alias (case-insensitive). */
|
|
17
|
+
export declare function findAgentByName(agents: readonly Agent[], nameOrAlias: string): Agent | null;
|
|
18
|
+
/** The built-in coordinator: understands the request and decides what's next. */
|
|
19
|
+
export declare function buildUnderstandPrompt(agents: readonly Agent[]): string;
|