@zhin.js/agent 1.1.2 → 1.1.5
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 +52 -52
- package/lib/activity-feedback/adapter-integration.d.ts +8 -9
- package/lib/activity-feedback/adapter-integration.d.ts.map +1 -1
- package/lib/activity-feedback/adapter-integration.js +22 -18
- package/lib/activity-feedback/adapter-integration.js.map +1 -1
- package/lib/activity-feedback/ai-bus.d.ts.map +1 -1
- package/lib/activity-feedback/ai-bus.js +7 -1
- package/lib/activity-feedback/ai-bus.js.map +1 -1
- package/lib/activity-feedback/event-context.d.ts +1 -1
- package/lib/activity-feedback/event-context.d.ts.map +1 -1
- package/lib/activity-feedback/event-context.js +9 -6
- package/lib/activity-feedback/event-context.js.map +1 -1
- package/lib/activity-feedback/index.d.ts +3 -2
- package/lib/activity-feedback/index.d.ts.map +1 -1
- package/lib/activity-feedback/index.js +3 -2
- package/lib/activity-feedback/index.js.map +1 -1
- package/lib/activity-feedback/manager.d.ts +4 -1
- package/lib/activity-feedback/manager.d.ts.map +1 -1
- package/lib/activity-feedback/manager.js +10 -8
- package/lib/activity-feedback/manager.js.map +1 -1
- package/lib/activity-feedback/subagent-prefix.d.ts +17 -0
- package/lib/activity-feedback/subagent-prefix.d.ts.map +1 -0
- package/lib/activity-feedback/subagent-prefix.js +54 -0
- package/lib/activity-feedback/subagent-prefix.js.map +1 -0
- package/lib/agent-prompt/registry.js +1 -1
- package/lib/agent-prompt/registry.js.map +1 -1
- package/lib/agent-prompt/resolver.d.ts.map +1 -1
- package/lib/agent-prompt/resolver.js +5 -7
- package/lib/agent-prompt/resolver.js.map +1 -1
- package/lib/ai-event-bus.js +2 -2
- package/lib/ai-event-bus.js.map +1 -1
- package/lib/ai-event-subscriber.d.ts +1 -1
- package/lib/ai-event-subscriber.d.ts.map +1 -1
- package/lib/ai-event-subscriber.js +1 -1
- package/lib/ai-event-subscriber.js.map +1 -1
- package/lib/aop/index.d.ts +1 -1
- package/lib/aop/index.d.ts.map +1 -1
- package/lib/aop/index.js +1 -1
- package/lib/aop/index.js.map +1 -1
- package/lib/aop/pipeline/pipeline-service.d.ts +2 -0
- package/lib/aop/pipeline/pipeline-service.d.ts.map +1 -1
- package/lib/aop/pipeline/pipeline-service.js +26 -14
- package/lib/aop/pipeline/pipeline-service.js.map +1 -1
- package/lib/assistant/bootstrap-assistant-home.d.ts +31 -0
- package/lib/assistant/bootstrap-assistant-home.d.ts.map +1 -0
- package/lib/assistant/bootstrap-assistant-home.js +97 -0
- package/lib/assistant/bootstrap-assistant-home.js.map +1 -0
- package/lib/assistant/deliver-schedule-to-adapter.d.ts +3 -3
- package/lib/assistant/deliver-schedule-to-adapter.d.ts.map +1 -1
- package/lib/assistant/deliver-schedule-to-adapter.js +2 -6
- package/lib/assistant/deliver-schedule-to-adapter.js.map +1 -1
- package/lib/assistant/domains/{home-assistant.d.ts → ha-home-backend.d.ts} +16 -13
- package/lib/assistant/domains/ha-home-backend.d.ts.map +1 -0
- package/lib/assistant/domains/{home-assistant.js → ha-home-backend.js} +32 -7
- package/lib/assistant/domains/ha-home-backend.js.map +1 -0
- package/lib/assistant/domains/ha-ws-transport.d.ts +59 -0
- package/lib/assistant/domains/ha-ws-transport.d.ts.map +1 -0
- package/lib/assistant/domains/ha-ws-transport.js +135 -0
- package/lib/assistant/domains/ha-ws-transport.js.map +1 -0
- package/lib/assistant/domains/home-entity.d.ts +5 -0
- package/lib/assistant/domains/home-entity.d.ts.map +1 -0
- package/lib/assistant/domains/home-entity.js +8 -0
- package/lib/assistant/domains/home-entity.js.map +1 -0
- package/lib/assistant/domains/home-state-watch.d.ts +40 -0
- package/lib/assistant/domains/home-state-watch.d.ts.map +1 -0
- package/lib/assistant/domains/home-state-watch.js +118 -0
- package/lib/assistant/domains/home-state-watch.js.map +1 -0
- package/lib/assistant/home-config.d.ts +21 -7
- package/lib/assistant/home-config.d.ts.map +1 -1
- package/lib/assistant/home-config.js +5 -0
- package/lib/assistant/home-config.js.map +1 -1
- package/lib/assistant/home-facade.d.ts +73 -0
- package/lib/assistant/home-facade.d.ts.map +1 -0
- package/lib/assistant/home-facade.js +144 -0
- package/lib/assistant/home-facade.js.map +1 -0
- package/lib/assistant/home-policy.d.ts +3 -2
- package/lib/assistant/home-policy.d.ts.map +1 -1
- package/lib/assistant/home-policy.js +8 -36
- package/lib/assistant/home-policy.js.map +1 -1
- package/lib/assistant/home-tools.d.ts +9 -12
- package/lib/assistant/home-tools.d.ts.map +1 -1
- package/lib/assistant/home-tools.js +94 -135
- package/lib/assistant/home-tools.js.map +1 -1
- package/lib/assistant/index.d.ts +18 -11
- package/lib/assistant/index.d.ts.map +1 -1
- package/lib/assistant/index.js +10 -7
- package/lib/assistant/index.js.map +1 -1
- package/lib/assistant/job-creator.d.ts +3 -3
- package/lib/assistant/job-creator.d.ts.map +1 -1
- package/lib/assistant/job-creator.js +6 -11
- package/lib/assistant/job-creator.js.map +1 -1
- package/lib/assistant/job-engine.d.ts +1 -1
- package/lib/assistant/job-engine.d.ts.map +1 -1
- package/lib/assistant/job-engine.js +11 -22
- package/lib/assistant/job-engine.js.map +1 -1
- package/lib/assistant/job-scheduler.d.ts +0 -3
- package/lib/assistant/job-scheduler.d.ts.map +1 -1
- package/lib/assistant/job-scheduler.js +5 -3
- package/lib/assistant/job-scheduler.js.map +1 -1
- package/lib/assistant/job-store.d.ts.map +1 -1
- package/lib/assistant/job-store.js +31 -3
- package/lib/assistant/job-store.js.map +1 -1
- package/lib/assistant/job-worker.d.ts +2 -9
- package/lib/assistant/job-worker.d.ts.map +1 -1
- package/lib/assistant/job-worker.js +42 -36
- package/lib/assistant/job-worker.js.map +1 -1
- package/lib/assistant/notification-router.d.ts +2 -1
- package/lib/assistant/notification-router.d.ts.map +1 -1
- package/lib/assistant/notification-router.js +18 -9
- package/lib/assistant/notification-router.js.map +1 -1
- package/lib/assistant/runtime-registry.d.ts +4 -3
- package/lib/assistant/runtime-registry.d.ts.map +1 -1
- package/lib/assistant/runtime-registry.js +7 -16
- package/lib/assistant/runtime-registry.js.map +1 -1
- package/lib/assistant/schedule-execution.d.ts +0 -17
- package/lib/assistant/schedule-execution.d.ts.map +1 -1
- package/lib/assistant/schedule-execution.js +0 -41
- package/lib/assistant/schedule-execution.js.map +1 -1
- package/lib/assistant/schedule-job-service.d.ts +4 -2
- package/lib/assistant/schedule-job-service.d.ts.map +1 -1
- package/lib/assistant/schedule-job-service.js +38 -8
- package/lib/assistant/schedule-job-service.js.map +1 -1
- package/lib/assistant/types.d.ts +3 -0
- package/lib/assistant/types.d.ts.map +1 -1
- package/lib/assistant/types.js.map +1 -1
- package/lib/authoring/entries/tools.d.ts +1 -1
- package/lib/authoring/entries/tools.d.ts.map +1 -1
- package/lib/authoring/entries/tools.js +1 -1
- package/lib/authoring/entries/tools.js.map +1 -1
- package/lib/authoring/index.d.ts +1 -1
- package/lib/authoring/index.d.ts.map +1 -1
- package/lib/authoring/index.js +1 -1
- package/lib/authoring/index.js.map +1 -1
- package/lib/authoring/tool-policy.d.ts +1 -1
- package/lib/authoring/tool-policy.d.ts.map +1 -1
- package/lib/authoring/tool-policy.js +1 -1
- package/lib/authoring/tool-policy.js.map +1 -1
- package/lib/bootstrap.d.ts +14 -3
- package/lib/bootstrap.d.ts.map +1 -1
- package/lib/bootstrap.js +66 -12
- package/lib/bootstrap.js.map +1 -1
- package/lib/builtin/analyze-media-tool.d.ts.map +1 -1
- package/lib/builtin/analyze-media-tool.js +0 -12
- package/lib/builtin/analyze-media-tool.js.map +1 -1
- package/lib/builtin/bash-tool.d.ts.map +1 -1
- package/lib/builtin/bash-tool.js +0 -6
- package/lib/builtin/bash-tool.js.map +1 -1
- package/lib/builtin/bing-search-html.d.ts +1 -17
- package/lib/builtin/bing-search-html.d.ts.map +1 -1
- package/lib/builtin/bing-search-html.js +12 -10
- package/lib/builtin/bing-search-html.js.map +1 -1
- package/lib/builtin/edit-file-tool.d.ts.map +1 -1
- package/lib/builtin/edit-file-tool.js +0 -7
- package/lib/builtin/edit-file-tool.js.map +1 -1
- package/lib/builtin/glob-tool.d.ts.map +1 -1
- package/lib/builtin/glob-tool.js +0 -5
- package/lib/builtin/glob-tool.js.map +1 -1
- package/lib/builtin/grep-tool.d.ts.map +1 -1
- package/lib/builtin/grep-tool.js +0 -5
- package/lib/builtin/grep-tool.js.map +1 -1
- package/lib/builtin/list-dir-tool.d.ts.map +1 -1
- package/lib/builtin/list-dir-tool.js +0 -5
- package/lib/builtin/list-dir-tool.js.map +1 -1
- package/lib/builtin/memory-search-tool.js +1 -1
- package/lib/builtin/memory-search-tool.js.map +1 -1
- package/lib/builtin/memory-upsert-tool.js +1 -1
- package/lib/builtin/memory-upsert-tool.js.map +1 -1
- package/lib/builtin/read-file-tool.d.ts.map +1 -1
- package/lib/builtin/read-file-tool.js +0 -13
- package/lib/builtin/read-file-tool.js.map +1 -1
- package/lib/builtin/spawn-task-tool.d.ts.map +1 -1
- package/lib/builtin/spawn-task-tool.js +8 -10
- package/lib/builtin/spawn-task-tool.js.map +1 -1
- package/lib/builtin/web-fetch-tool.d.ts.map +1 -1
- package/lib/builtin/web-fetch-tool.js +9 -28
- package/lib/builtin/web-fetch-tool.js.map +1 -1
- package/lib/builtin/web-search-tool.d.ts.map +1 -1
- package/lib/builtin/web-search-tool.js +10 -0
- package/lib/builtin/web-search-tool.js.map +1 -1
- package/lib/builtin/write-file-tool.d.ts.map +1 -1
- package/lib/builtin/write-file-tool.js +0 -7
- package/lib/builtin/write-file-tool.js.map +1 -1
- package/lib/builtin-tools.d.ts +3 -14
- package/lib/builtin-tools.d.ts.map +1 -1
- package/lib/builtin-tools.js +3 -14
- package/lib/builtin-tools.js.map +1 -1
- package/lib/collaboration/collab-admin-gate.d.ts +1 -1
- package/lib/collaboration/collab-admin-gate.d.ts.map +1 -1
- package/lib/collaboration/collab-admin-gate.js +8 -8
- package/lib/collaboration/collab-admin-gate.js.map +1 -1
- package/lib/collaboration/collab-utils.d.ts +15 -0
- package/lib/collaboration/collab-utils.d.ts.map +1 -0
- package/lib/collaboration/collab-utils.js +37 -0
- package/lib/collaboration/collab-utils.js.map +1 -0
- package/lib/collaboration/collaboration-artifact-repository.d.ts +2 -0
- package/lib/collaboration/collaboration-artifact-repository.d.ts.map +1 -1
- package/lib/collaboration/collaboration-artifact-repository.js +17 -5
- package/lib/collaboration/collaboration-artifact-repository.js.map +1 -1
- package/lib/collaboration/collaboration-commands.d.ts +3 -3
- package/lib/collaboration/collaboration-commands.d.ts.map +1 -1
- package/lib/collaboration/collaboration-commands.js +25 -156
- package/lib/collaboration/collaboration-commands.js.map +1 -1
- package/lib/collaboration/collaboration-config.d.ts +5 -5
- package/lib/collaboration/collaboration-config.d.ts.map +1 -1
- package/lib/collaboration/collaboration-config.js +19 -19
- package/lib/collaboration/collaboration-config.js.map +1 -1
- package/lib/collaboration/collaboration-context.d.ts +5 -2
- package/lib/collaboration/collaboration-context.d.ts.map +1 -1
- package/lib/collaboration/collaboration-context.js +39 -27
- package/lib/collaboration/collaboration-context.js.map +1 -1
- package/lib/collaboration/collaboration-db-model.d.ts +2 -2
- package/lib/collaboration/collaboration-db-model.d.ts.map +1 -1
- package/lib/collaboration/collaboration-db-model.js +2 -2
- package/lib/collaboration/collaboration-db-model.js.map +1 -1
- package/lib/collaboration/collaboration-delegation.d.ts +2 -2
- package/lib/collaboration/collaboration-delegation.d.ts.map +1 -1
- package/lib/collaboration/collaboration-delegation.js +4 -6
- package/lib/collaboration/collaboration-delegation.js.map +1 -1
- package/lib/collaboration/collaboration-dispatch.d.ts +4 -4
- package/lib/collaboration/collaboration-dispatch.d.ts.map +1 -1
- package/lib/collaboration/collaboration-dispatch.js +12 -12
- package/lib/collaboration/collaboration-dispatch.js.map +1 -1
- package/lib/collaboration/collaboration-kernel-bridge.d.ts +3 -3
- package/lib/collaboration/collaboration-kernel-bridge.d.ts.map +1 -1
- package/lib/collaboration/collaboration-kernel-bridge.js +15 -16
- package/lib/collaboration/collaboration-kernel-bridge.js.map +1 -1
- package/lib/collaboration/collaboration-outbound.d.ts +7 -7
- package/lib/collaboration/collaboration-outbound.d.ts.map +1 -1
- package/lib/collaboration/collaboration-outbound.js +38 -41
- package/lib/collaboration/collaboration-outbound.js.map +1 -1
- package/lib/collaboration/collaboration-scene-repository.d.ts +17 -15
- package/lib/collaboration/collaboration-scene-repository.d.ts.map +1 -1
- package/lib/collaboration/collaboration-scene-repository.js +43 -32
- package/lib/collaboration/collaboration-scene-repository.js.map +1 -1
- package/lib/collaboration/collaboration-turn-snapshot.d.ts +3 -3
- package/lib/collaboration/collaboration-turn-snapshot.d.ts.map +1 -1
- package/lib/collaboration/collaboration-turn-snapshot.js +6 -6
- package/lib/collaboration/collaboration-turn-snapshot.js.map +1 -1
- package/lib/collaboration/delegation-state.d.ts +6 -6
- package/lib/collaboration/delegation-state.d.ts.map +1 -1
- package/lib/collaboration/delegation-state.js +17 -17
- package/lib/collaboration/delegation-state.js.map +1 -1
- package/lib/collaboration/endpoint-identity.d.ts +4 -4
- package/lib/collaboration/endpoint-identity.d.ts.map +1 -1
- package/lib/collaboration/endpoint-identity.js +17 -25
- package/lib/collaboration/endpoint-identity.js.map +1 -1
- package/lib/collaboration/group-message.d.ts +5 -5
- package/lib/collaboration/group-message.d.ts.map +1 -1
- package/lib/collaboration/group-message.js +10 -71
- package/lib/collaboration/group-message.js.map +1 -1
- package/lib/collaboration/im-mention-delegate.d.ts +1 -1
- package/lib/collaboration/im-mention-delegate.d.ts.map +1 -1
- package/lib/collaboration/im-mention-delegate.js +2 -2
- package/lib/collaboration/im-mention-delegate.js.map +1 -1
- package/lib/collaboration/inbound-peer-handback.d.ts +1 -1
- package/lib/collaboration/inbound-peer-handback.d.ts.map +1 -1
- package/lib/collaboration/inbound-peer-handback.js +13 -17
- package/lib/collaboration/inbound-peer-handback.js.map +1 -1
- package/lib/collaboration/inbound-spawn-task.d.ts.map +1 -1
- package/lib/collaboration/inbound-spawn-task.js +7 -8
- package/lib/collaboration/inbound-spawn-task.js.map +1 -1
- package/lib/collaboration/inbound-turn-tools.d.ts +1 -1
- package/lib/collaboration/inbound-turn-tools.d.ts.map +1 -1
- package/lib/collaboration/inbound-turn-tools.js +8 -3
- package/lib/collaboration/inbound-turn-tools.js.map +1 -1
- package/lib/collaboration/index.d.ts +1 -5
- package/lib/collaboration/index.d.ts.map +1 -1
- package/lib/collaboration/index.js +1 -4
- package/lib/collaboration/index.js.map +1 -1
- package/lib/collaboration/init-observe-hook.d.ts +8 -11
- package/lib/collaboration/init-observe-hook.d.ts.map +1 -1
- package/lib/collaboration/init-observe-hook.js +18 -40
- package/lib/collaboration/init-observe-hook.js.map +1 -1
- package/lib/collaboration/init-wizard-service.d.ts +2 -2
- package/lib/collaboration/init-wizard-service.d.ts.map +1 -1
- package/lib/collaboration/init-wizard-service.js +9 -11
- package/lib/collaboration/init-wizard-service.js.map +1 -1
- package/lib/collaboration/outbound-resolver.d.ts +3 -3
- package/lib/collaboration/outbound-resolver.d.ts.map +1 -1
- package/lib/collaboration/outbound-resolver.js +18 -18
- package/lib/collaboration/outbound-resolver.js.map +1 -1
- package/lib/collaboration/peer-policy.d.ts +7 -7
- package/lib/collaboration/peer-policy.d.ts.map +1 -1
- package/lib/collaboration/peer-policy.js +19 -19
- package/lib/collaboration/peer-policy.js.map +1 -1
- package/lib/collaboration/resolve-agent-session-key.js +2 -2
- package/lib/collaboration/resolve-agent-session-key.js.map +1 -1
- package/lib/collaboration/runtime-inbound-gate.d.ts.map +1 -1
- package/lib/collaboration/runtime-inbound-gate.js +26 -32
- package/lib/collaboration/runtime-inbound-gate.js.map +1 -1
- package/lib/collaboration/scene-identity-service.d.ts +13 -11
- package/lib/collaboration/scene-identity-service.d.ts.map +1 -1
- package/lib/collaboration/scene-identity-service.js +33 -22
- package/lib/collaboration/scene-identity-service.js.map +1 -1
- package/lib/collaboration/scene-service.d.ts +5 -3
- package/lib/collaboration/scene-service.d.ts.map +1 -1
- package/lib/collaboration/scene-service.js +17 -12
- package/lib/collaboration/scene-service.js.map +1 -1
- package/lib/collaboration/structured-ai-outbound.d.ts +1 -1
- package/lib/collaboration/structured-ai-outbound.d.ts.map +1 -1
- package/lib/collaboration/structured-ai-outbound.js +8 -9
- package/lib/collaboration/structured-ai-outbound.js.map +1 -1
- package/lib/collaboration/turn-plan-resolver.d.ts +2 -2
- package/lib/collaboration/turn-plan-resolver.d.ts.map +1 -1
- package/lib/collaboration/turn-plan-resolver.js +12 -12
- package/lib/collaboration/turn-plan-resolver.js.map +1 -1
- package/lib/collaboration/types.d.ts +6 -6
- package/lib/collaboration/types.d.ts.map +1 -1
- package/lib/collaboration/wire-collaboration-storage.d.ts.map +1 -1
- package/lib/collaboration/wire-collaboration-storage.js +0 -2
- package/lib/collaboration/wire-collaboration-storage.js.map +1 -1
- package/lib/common-adapter-tools.js +1 -1
- package/lib/common-adapter-tools.js.map +1 -1
- package/lib/config/agent-interfaces.d.ts +1 -2
- package/lib/config/agent-interfaces.d.ts.map +1 -1
- package/lib/config/fix-ai-config.d.ts.map +1 -1
- package/lib/config/fix-ai-config.js +52 -3
- package/lib/config/fix-ai-config.js.map +1 -1
- package/lib/config/index.d.ts +1 -1
- package/lib/config/index.d.ts.map +1 -1
- package/lib/config/index.js.map +1 -1
- package/lib/config/normalize-ai-config.d.ts +4 -2
- package/lib/config/normalize-ai-config.d.ts.map +1 -1
- package/lib/config/normalize-ai-config.js +29 -81
- package/lib/config/normalize-ai-config.js.map +1 -1
- package/lib/config/validate-ai-config.d.ts.map +1 -1
- package/lib/config/validate-ai-config.js +10 -0
- package/lib/config/validate-ai-config.js.map +1 -1
- package/lib/config/zhin-agent-config.d.ts +20 -0
- package/lib/config/zhin-agent-config.d.ts.map +1 -1
- package/lib/config/zhin-agent-defaults.d.ts.map +1 -1
- package/lib/config/zhin-agent-defaults.js +14 -0
- package/lib/config/zhin-agent-defaults.js.map +1 -1
- package/lib/config/zhin-agent-dependencies.d.ts +1 -0
- package/lib/config/zhin-agent-dependencies.d.ts.map +1 -1
- package/lib/context/context-system.d.ts +4 -2
- package/lib/context/context-system.d.ts.map +1 -1
- package/lib/context/context-system.js +15 -12
- package/lib/context/context-system.js.map +1 -1
- package/lib/context/contracts.d.ts +3 -3
- package/lib/context/contracts.d.ts.map +1 -1
- package/lib/context/default-builders.js +3 -3
- package/lib/context/default-builders.js.map +1 -1
- package/lib/context/im-turn-context-adapter.d.ts +9 -0
- package/lib/context/im-turn-context-adapter.d.ts.map +1 -0
- package/lib/context/im-turn-context-adapter.js +54 -0
- package/lib/context/im-turn-context-adapter.js.map +1 -0
- package/lib/context/index.d.ts +2 -2
- package/lib/context/index.d.ts.map +1 -1
- package/lib/context/index.js +1 -1
- package/lib/context/index.js.map +1 -1
- package/lib/context/turn-envelope.d.ts +5 -4
- package/lib/context/turn-envelope.d.ts.map +1 -1
- package/lib/context/turn-envelope.js +43 -50
- package/lib/context/turn-envelope.js.map +1 -1
- package/lib/core/agent-core-run.d.ts +37 -14
- package/lib/core/agent-core-run.d.ts.map +1 -1
- package/lib/core/agent-core-run.js +79 -182
- package/lib/core/agent-core-run.js.map +1 -1
- package/lib/core/agent-loop-standalone.d.ts.map +1 -1
- package/lib/core/agent-loop-standalone.js +35 -34
- package/lib/core/agent-loop-standalone.js.map +1 -1
- package/lib/core/agent-run-shared.d.ts +4 -0
- package/lib/core/agent-run-shared.d.ts.map +1 -0
- package/lib/core/agent-run-shared.js +8 -0
- package/lib/core/agent-run-shared.js.map +1 -0
- package/lib/core/compose-deps.d.ts.map +1 -1
- package/lib/core/compose-deps.js +1 -2
- package/lib/core/compose-deps.js.map +1 -1
- package/lib/core/spawn-delegation.d.ts +23 -0
- package/lib/core/spawn-delegation.d.ts.map +1 -0
- package/lib/core/spawn-delegation.js +64 -0
- package/lib/core/spawn-delegation.js.map +1 -0
- package/lib/core/tool-execution-authority.d.ts +21 -0
- package/lib/core/tool-execution-authority.d.ts.map +1 -0
- package/lib/core/tool-execution-authority.js +2 -0
- package/lib/core/tool-execution-authority.js.map +1 -0
- package/lib/core/turn-event-mapper.d.ts.map +1 -1
- package/lib/core/turn-event-mapper.js +13 -0
- package/lib/core/turn-event-mapper.js.map +1 -1
- package/lib/deferred-worker-runner.d.ts.map +1 -1
- package/lib/deferred-worker-runner.js +9 -23
- package/lib/deferred-worker-runner.js.map +1 -1
- package/lib/discovery/agent-surface-info.d.ts.map +1 -1
- package/lib/discovery/agent-surface-info.js +7 -2
- package/lib/discovery/agent-surface-info.js.map +1 -1
- package/lib/discovery/skills.js +3 -3
- package/lib/discovery/skills.js.map +1 -1
- package/lib/discovery/tools.js +2 -2
- package/lib/discovery/tools.js.map +1 -1
- package/lib/event/event-emitter.d.ts.map +1 -1
- package/lib/event/event-emitter.js +2 -13
- package/lib/event/event-emitter.js.map +1 -1
- package/lib/event/session-events.d.ts +3 -2
- package/lib/event/session-events.d.ts.map +1 -1
- package/lib/event/session-events.js.map +1 -1
- package/lib/event/turn-event.d.ts +35 -2
- package/lib/event/turn-event.d.ts.map +1 -1
- package/lib/event/turn-event.js +4 -1
- package/lib/event/turn-event.js.map +1 -1
- package/lib/event/turn-to-agent-stream.js +20 -0
- package/lib/event/turn-to-agent-stream.js.map +1 -1
- package/lib/hooks.d.ts +1 -1
- package/lib/hooks.d.ts.map +1 -1
- package/lib/index.d.ts +34 -27
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +26 -21
- package/lib/index.js.map +1 -1
- package/lib/ingress/capability-ingress.d.ts +3 -1
- package/lib/ingress/capability-ingress.d.ts.map +1 -1
- package/lib/ingress/capability-ingress.js +10 -6
- package/lib/ingress/capability-ingress.js.map +1 -1
- package/lib/init/configure-zhin-agent.d.ts +7 -34
- package/lib/init/configure-zhin-agent.d.ts.map +1 -1
- package/lib/init/configure-zhin-agent.js +5 -1
- package/lib/init/configure-zhin-agent.js.map +1 -1
- package/lib/init/create-zhin-agent.d.ts.map +1 -1
- package/lib/init/create-zhin-agent.js +64 -78
- package/lib/init/create-zhin-agent.js.map +1 -1
- package/lib/init/dispose-zhin-agent.d.ts +6 -22
- package/lib/init/dispose-zhin-agent.d.ts.map +1 -1
- package/lib/init/dispose-zhin-agent.js +1 -2
- package/lib/init/dispose-zhin-agent.js.map +1 -1
- package/lib/init/introspection-collectors.js +2 -2
- package/lib/init/introspection-collectors.js.map +1 -1
- package/lib/init/register-ai-service.d.ts.map +1 -1
- package/lib/init/register-ai-service.js +3 -4
- package/lib/init/register-ai-service.js.map +1 -1
- package/lib/init/register-builtin-tools.d.ts.map +1 -1
- package/lib/init/register-builtin-tools.js +20 -31
- package/lib/init/register-builtin-tools.js.map +1 -1
- package/lib/init/register-db-upgrade.d.ts.map +1 -1
- package/lib/init/register-db-upgrade.js +5 -9
- package/lib/init/register-db-upgrade.js.map +1 -1
- package/lib/init/register-group-session-passive.d.ts.map +1 -1
- package/lib/init/register-group-session-passive.js +15 -10
- package/lib/init/register-group-session-passive.js.map +1 -1
- package/lib/init/register-init-wizard-guardrail.d.ts.map +1 -1
- package/lib/init/register-init-wizard-guardrail.js +6 -11
- package/lib/init/register-init-wizard-guardrail.js.map +1 -1
- package/lib/init/register-introspection-commands.d.ts.map +1 -1
- package/lib/init/register-introspection-commands.js +20 -1
- package/lib/init/register-introspection-commands.js.map +1 -1
- package/lib/init/register-mcp-from-config.js +4 -4
- package/lib/init/register-mcp-from-config.js.map +1 -1
- package/lib/init/upgrade-endpoint-id-schema.d.ts +2 -2
- package/lib/init/upgrade-endpoint-id-schema.d.ts.map +1 -1
- package/lib/init/upgrade-endpoint-id-schema.js +3 -3
- package/lib/init/upgrade-endpoint-id-schema.js.map +1 -1
- package/lib/init.d.ts +4 -22
- package/lib/init.d.ts.map +1 -1
- package/lib/init.js +6 -57
- package/lib/init.js.map +1 -1
- package/lib/interaction/index.d.ts +2 -0
- package/lib/interaction/index.d.ts.map +1 -0
- package/lib/interaction/index.js +2 -0
- package/lib/interaction/index.js.map +1 -0
- package/lib/interaction/interaction-router.d.ts +20 -0
- package/lib/interaction/interaction-router.d.ts.map +1 -0
- package/lib/interaction/interaction-router.js +146 -0
- package/lib/interaction/interaction-router.js.map +1 -0
- package/lib/internal/agent-host.d.ts +59 -67
- package/lib/internal/agent-host.d.ts.map +1 -1
- package/lib/internal/ai-service-refs.d.ts +8 -0
- package/lib/internal/ai-service-refs.d.ts.map +1 -0
- package/lib/internal/ai-service-refs.js +7 -0
- package/lib/internal/ai-service-refs.js.map +1 -0
- package/lib/internal/as-private.d.ts +3 -6
- package/lib/internal/as-private.d.ts.map +1 -1
- package/lib/internal/as-private.js.map +1 -1
- package/lib/internal/host-types.d.ts +26 -3
- package/lib/internal/host-types.d.ts.map +1 -1
- package/lib/internal/prompt-trace.d.ts.map +1 -1
- package/lib/internal/prompt-trace.js +4 -15
- package/lib/internal/prompt-trace.js.map +1 -1
- package/lib/internal/turn-context.d.ts +1 -6
- package/lib/internal/turn-context.d.ts.map +1 -1
- package/lib/internal/turn-context.js +0 -9
- package/lib/internal/turn-context.js.map +1 -1
- package/lib/journal/file-journal-store.d.ts +21 -0
- package/lib/journal/file-journal-store.d.ts.map +1 -0
- package/lib/journal/file-journal-store.js +200 -0
- package/lib/journal/file-journal-store.js.map +1 -0
- package/lib/journal/index.d.ts +3 -0
- package/lib/journal/index.d.ts.map +1 -0
- package/lib/journal/index.js +3 -0
- package/lib/journal/index.js.map +1 -0
- package/lib/journal/persistent-turn-journal.d.ts +13 -0
- package/lib/journal/persistent-turn-journal.d.ts.map +1 -0
- package/lib/journal/persistent-turn-journal.js +72 -0
- package/lib/journal/persistent-turn-journal.js.map +1 -0
- package/lib/media/index.d.ts +0 -1
- package/lib/media/index.d.ts.map +1 -1
- package/lib/media/index.js +0 -1
- package/lib/media/index.js.map +1 -1
- package/lib/media/media-capabilities.d.ts.map +1 -1
- package/lib/media/media-capabilities.js +0 -6
- package/lib/media/media-capabilities.js.map +1 -1
- package/lib/media/media-normalize.d.ts +1 -7
- package/lib/media/media-normalize.d.ts.map +1 -1
- package/lib/media/media-normalize.js +0 -47
- package/lib/media/media-normalize.js.map +1 -1
- package/lib/media/media-router.d.ts +1 -2
- package/lib/media/media-router.d.ts.map +1 -1
- package/lib/media/media-router.js +2 -10
- package/lib/media/media-router.js.map +1 -1
- package/lib/media/resolve-config.d.ts.map +1 -1
- package/lib/media/resolve-config.js +1 -28
- package/lib/media/resolve-config.js.map +1 -1
- package/lib/media/subagent-inbound.d.ts +2 -2
- package/lib/media/subagent-inbound.d.ts.map +1 -1
- package/lib/media/subagent-inbound.js +2 -7
- package/lib/media/subagent-inbound.js.map +1 -1
- package/lib/media/vision-capability.d.ts +1 -3
- package/lib/media/vision-capability.d.ts.map +1 -1
- package/lib/media/vision-capability.js +0 -15
- package/lib/media/vision-capability.js.map +1 -1
- package/lib/memory/compaction-runtime.d.ts +3 -4
- package/lib/memory/compaction-runtime.d.ts.map +1 -1
- package/lib/memory/compaction-runtime.js +0 -10
- package/lib/memory/compaction-runtime.js.map +1 -1
- package/lib/memory/memory-system.d.ts.map +1 -1
- package/lib/memory/memory-system.js +1 -2
- package/lib/memory/memory-system.js.map +1 -1
- package/lib/memory-entry-registry.d.ts +6 -0
- package/lib/memory-entry-registry.d.ts.map +1 -1
- package/lib/memory-entry-registry.js +19 -3
- package/lib/memory-entry-registry.js.map +1 -1
- package/lib/memory-layers.d.ts +2 -2
- package/lib/memory-layers.d.ts.map +1 -1
- package/lib/memory-layers.js +11 -22
- package/lib/memory-layers.js.map +1 -1
- package/lib/orchestration-runtime-registry.d.ts +3 -1
- package/lib/orchestration-runtime-registry.d.ts.map +1 -1
- package/lib/orchestration-runtime-registry.js +9 -4
- package/lib/orchestration-runtime-registry.js.map +1 -1
- package/lib/orchestrator/agent-dispatcher.d.ts +3 -38
- package/lib/orchestrator/agent-dispatcher.d.ts.map +1 -1
- package/lib/orchestrator/agent-dispatcher.js +2 -155
- package/lib/orchestrator/agent-dispatcher.js.map +1 -1
- package/lib/orchestrator/bootstrap-executors.d.ts +5 -1
- package/lib/orchestrator/bootstrap-executors.d.ts.map +1 -1
- package/lib/orchestrator/bootstrap-executors.js +65 -36
- package/lib/orchestrator/bootstrap-executors.js.map +1 -1
- package/lib/orchestrator/index.d.ts +1 -1
- package/lib/orchestrator/index.d.ts.map +1 -1
- package/lib/orchestrator/index.js +1 -1
- package/lib/orchestrator/index.js.map +1 -1
- package/lib/orchestrator/orchestration-mappers.js +8 -8
- package/lib/orchestrator/orchestration-mappers.js.map +1 -1
- package/lib/orchestrator/orchestration-service.d.ts +18 -9
- package/lib/orchestrator/orchestration-service.d.ts.map +1 -1
- package/lib/orchestrator/orchestration-service.js +50 -47
- package/lib/orchestrator/orchestration-service.js.map +1 -1
- package/lib/orchestrator/remote-agent-registry.d.ts +3 -3
- package/lib/orchestrator/remote-agent-registry.d.ts.map +1 -1
- package/lib/orchestrator/remote-agent-registry.js +9 -13
- package/lib/orchestrator/remote-agent-registry.js.map +1 -1
- package/lib/orchestrator/remote-task-executor.d.ts.map +1 -1
- package/lib/orchestrator/remote-task-executor.js +12 -4
- package/lib/orchestrator/remote-task-executor.js.map +1 -1
- package/lib/orchestrator/remote-task-poller.d.ts +3 -2
- package/lib/orchestrator/remote-task-poller.d.ts.map +1 -1
- package/lib/orchestrator/remote-task-poller.js +18 -15
- package/lib/orchestrator/remote-task-poller.js.map +1 -1
- package/lib/orchestrator/role-configs.d.ts +30 -0
- package/lib/orchestrator/role-configs.d.ts.map +1 -0
- package/lib/orchestrator/role-configs.js +133 -0
- package/lib/orchestrator/role-configs.js.map +1 -0
- package/lib/orchestrator/task-queue.d.ts +3 -2
- package/lib/orchestrator/task-queue.d.ts.map +1 -1
- package/lib/orchestrator/task-queue.js +12 -11
- package/lib/orchestrator/task-queue.js.map +1 -1
- package/lib/orchestrator/tool-selection.d.ts +4 -3
- package/lib/orchestrator/tool-selection.d.ts.map +1 -1
- package/lib/orchestrator/tool-selection.js +17 -14
- package/lib/orchestrator/tool-selection.js.map +1 -1
- package/lib/orchestrator/types.d.ts +3 -2
- package/lib/orchestrator/types.d.ts.map +1 -1
- package/lib/outbound/send-proactive.js +1 -1
- package/lib/outbound/send-proactive.js.map +1 -1
- package/lib/plugin-ai-hook-bus.d.ts +3 -6
- package/lib/plugin-ai-hook-bus.d.ts.map +1 -1
- package/lib/plugin-ai-hook-bus.js +2 -20
- package/lib/plugin-ai-hook-bus.js.map +1 -1
- package/lib/plugin-runtime/agent-host-port.d.ts +25 -0
- package/lib/plugin-runtime/agent-host-port.d.ts.map +1 -1
- package/lib/plugin-runtime/agent-host-port.js.map +1 -1
- package/lib/plugin-runtime/agent-runtime.d.ts +61 -8
- package/lib/plugin-runtime/agent-runtime.d.ts.map +1 -1
- package/lib/plugin-runtime/agent-runtime.js +226 -11
- package/lib/plugin-runtime/agent-runtime.js.map +1 -1
- package/lib/plugin-runtime/capability-ingress.d.ts +4 -4
- package/lib/plugin-runtime/capability-ingress.d.ts.map +1 -1
- package/lib/plugin-runtime/capability-ingress.js +46 -20
- package/lib/plugin-runtime/capability-ingress.js.map +1 -1
- package/lib/plugin-runtime/capability-tools.d.ts +17 -0
- package/lib/plugin-runtime/capability-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/capability-tools.js +55 -0
- package/lib/plugin-runtime/capability-tools.js.map +1 -0
- package/lib/plugin-runtime/deferred-capability-plan.d.ts +30 -0
- package/lib/plugin-runtime/deferred-capability-plan.d.ts.map +1 -0
- package/lib/plugin-runtime/deferred-capability-plan.js +152 -0
- package/lib/plugin-runtime/deferred-capability-plan.js.map +1 -0
- package/lib/plugin-runtime/full-agent-turn-engine.d.ts +17 -0
- package/lib/plugin-runtime/full-agent-turn-engine.d.ts.map +1 -0
- package/lib/plugin-runtime/full-agent-turn-engine.js +174 -0
- package/lib/plugin-runtime/full-agent-turn-engine.js.map +1 -0
- package/lib/plugin-runtime/host-mcp-projection.d.ts +10 -0
- package/lib/plugin-runtime/host-mcp-projection.d.ts.map +1 -0
- package/lib/plugin-runtime/host-mcp-projection.js +33 -0
- package/lib/plugin-runtime/host-mcp-projection.js.map +1 -0
- package/lib/plugin-runtime/host-tool-projection.d.ts +21 -0
- package/lib/plugin-runtime/host-tool-projection.d.ts.map +1 -0
- package/lib/plugin-runtime/host-tool-projection.js +22 -0
- package/lib/plugin-runtime/host-tool-projection.js.map +1 -0
- package/lib/plugin-runtime/index.d.ts +10 -0
- package/lib/plugin-runtime/index.d.ts.map +1 -1
- package/lib/plugin-runtime/index.js +10 -0
- package/lib/plugin-runtime/index.js.map +1 -1
- package/lib/plugin-runtime/native-file-tools.d.ts +9 -0
- package/lib/plugin-runtime/native-file-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/native-file-tools.js +240 -0
- package/lib/plugin-runtime/native-file-tools.js.map +1 -0
- package/lib/plugin-runtime/native-interaction-tools.d.ts +8 -0
- package/lib/plugin-runtime/native-interaction-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/native-interaction-tools.js +72 -0
- package/lib/plugin-runtime/native-interaction-tools.js.map +1 -0
- package/lib/plugin-runtime/native-todo-tools.d.ts +26 -0
- package/lib/plugin-runtime/native-todo-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/native-todo-tools.js +152 -0
- package/lib/plugin-runtime/native-todo-tools.js.map +1 -0
- package/lib/plugin-runtime/native-web-tools.d.ts +10 -0
- package/lib/plugin-runtime/native-web-tools.d.ts.map +1 -0
- package/lib/plugin-runtime/native-web-tools.js +120 -0
- package/lib/plugin-runtime/native-web-tools.js.map +1 -0
- package/lib/prompt/assembly.d.ts +19 -9
- package/lib/prompt/assembly.d.ts.map +1 -1
- package/lib/prompt/assembly.js +64 -25
- package/lib/prompt/assembly.js.map +1 -1
- package/lib/prompt/git-context.d.ts +7 -0
- package/lib/prompt/git-context.d.ts.map +1 -0
- package/lib/prompt/git-context.js +75 -0
- package/lib/prompt/git-context.js.map +1 -0
- package/lib/prompt/index.d.ts +3 -2
- package/lib/prompt/index.d.ts.map +1 -1
- package/lib/prompt/index.js +2 -2
- package/lib/prompt/index.js.map +1 -1
- package/lib/prompt/model-aware-builder.d.ts +8 -0
- package/lib/prompt/model-aware-builder.d.ts.map +1 -0
- package/lib/prompt/model-aware-builder.js +61 -0
- package/lib/prompt/model-aware-builder.js.map +1 -0
- package/lib/prompt/model-prompt-strategy.d.ts +12 -0
- package/lib/prompt/model-prompt-strategy.d.ts.map +1 -0
- package/lib/prompt/model-prompt-strategy.js +171 -0
- package/lib/prompt/model-prompt-strategy.js.map +1 -0
- package/lib/prompt/rules/code-references.d.ts +2 -0
- package/lib/prompt/rules/code-references.d.ts.map +1 -0
- package/lib/prompt/rules/code-references.js +11 -0
- package/lib/prompt/rules/code-references.js.map +1 -0
- package/lib/prompt/rules/critical-rules.d.ts +2 -0
- package/lib/prompt/rules/critical-rules.d.ts.map +1 -0
- package/lib/prompt/rules/critical-rules.js +17 -0
- package/lib/prompt/rules/critical-rules.js.map +1 -0
- package/lib/prompt/rules/editing.d.ts +2 -0
- package/lib/prompt/rules/editing.d.ts.map +1 -0
- package/lib/prompt/rules/editing.js +18 -0
- package/lib/prompt/rules/editing.js.map +1 -0
- package/lib/prompt/rules/error-handling.d.ts +2 -0
- package/lib/prompt/rules/error-handling.d.ts.map +1 -0
- package/lib/prompt/rules/error-handling.js +18 -0
- package/lib/prompt/rules/error-handling.js.map +1 -0
- package/lib/prompt/rules/index.d.ts +8 -0
- package/lib/prompt/rules/index.d.ts.map +1 -0
- package/lib/prompt/rules/index.js +8 -0
- package/lib/prompt/rules/index.js.map +1 -0
- package/lib/prompt/rules/memory.d.ts +2 -0
- package/lib/prompt/rules/memory.d.ts.map +1 -0
- package/lib/prompt/rules/memory.js +13 -0
- package/lib/prompt/rules/memory.js.map +1 -0
- package/lib/prompt/rules/task-completion.d.ts +2 -0
- package/lib/prompt/rules/task-completion.d.ts.map +1 -0
- package/lib/prompt/rules/task-completion.js +11 -0
- package/lib/prompt/rules/task-completion.js.map +1 -0
- package/lib/prompt/rules/workflow-rules.d.ts +2 -0
- package/lib/prompt/rules/workflow-rules.d.ts.map +1 -0
- package/lib/prompt/rules/workflow-rules.js +27 -0
- package/lib/prompt/rules/workflow-rules.js.map +1 -0
- package/lib/prompt/system-prompt.d.ts +19 -22
- package/lib/prompt/system-prompt.d.ts.map +1 -1
- package/lib/prompt/system-prompt.js +82 -262
- package/lib/prompt/system-prompt.js.map +1 -1
- package/lib/prompt/templates.d.ts +3 -6
- package/lib/prompt/templates.d.ts.map +1 -1
- package/lib/prompt/templates.js +17 -21
- package/lib/prompt/templates.js.map +1 -1
- package/lib/prompt/turn-prompt-profile.d.ts +16 -0
- package/lib/prompt/turn-prompt-profile.d.ts.map +1 -0
- package/lib/prompt/turn-prompt-profile.js +2 -0
- package/lib/prompt/turn-prompt-profile.js.map +1 -0
- package/lib/routing/route-matcher.d.ts +2 -2
- package/lib/routing/route-matcher.d.ts.map +1 -1
- package/lib/routing/route-matcher.js +1 -1
- package/lib/routing/route-matcher.js.map +1 -1
- package/lib/routing/subagent-summarize.d.ts.map +1 -1
- package/lib/routing/subagent-summarize.js +1 -6
- package/lib/routing/subagent-summarize.js.map +1 -1
- package/lib/schedule-domain/audit-logger.d.ts +38 -0
- package/lib/schedule-domain/audit-logger.d.ts.map +1 -0
- package/lib/schedule-domain/audit-logger.js +27 -0
- package/lib/schedule-domain/audit-logger.js.map +1 -0
- package/lib/schedule-domain/budget-guard.d.ts +27 -0
- package/lib/schedule-domain/budget-guard.d.ts.map +1 -0
- package/lib/schedule-domain/budget-guard.js +48 -0
- package/lib/schedule-domain/budget-guard.js.map +1 -0
- package/lib/schedule-domain/execution-domain.d.ts +49 -0
- package/lib/schedule-domain/execution-domain.d.ts.map +1 -0
- package/lib/schedule-domain/execution-domain.js +125 -0
- package/lib/schedule-domain/execution-domain.js.map +1 -0
- package/lib/schedule-domain/index.d.ts +8 -0
- package/lib/schedule-domain/index.d.ts.map +1 -0
- package/lib/schedule-domain/index.js +8 -0
- package/lib/schedule-domain/index.js.map +1 -0
- package/lib/schedule-domain/output-validator.d.ts +7 -0
- package/lib/schedule-domain/output-validator.d.ts.map +1 -0
- package/lib/schedule-domain/output-validator.js +36 -0
- package/lib/schedule-domain/output-validator.js.map +1 -0
- package/lib/schedule-domain/prompt-assembler.d.ts +22 -0
- package/lib/schedule-domain/prompt-assembler.d.ts.map +1 -0
- package/lib/schedule-domain/prompt-assembler.js +75 -0
- package/lib/schedule-domain/prompt-assembler.js.map +1 -0
- package/lib/schedule-domain/security-harness.d.ts +19 -0
- package/lib/schedule-domain/security-harness.d.ts.map +1 -0
- package/lib/schedule-domain/security-harness.js +89 -0
- package/lib/schedule-domain/security-harness.js.map +1 -0
- package/lib/schedule-domain/tool-resolver.d.ts +20 -0
- package/lib/schedule-domain/tool-resolver.d.ts.map +1 -0
- package/lib/schedule-domain/tool-resolver.js +80 -0
- package/lib/schedule-domain/tool-resolver.js.map +1 -0
- package/lib/schedule-domain/turn-context.d.ts +9 -0
- package/lib/schedule-domain/turn-context.d.ts.map +1 -0
- package/lib/schedule-domain/turn-context.js +36 -0
- package/lib/schedule-domain/turn-context.js.map +1 -0
- package/lib/schedule-manager.d.ts +12 -13
- package/lib/schedule-manager.d.ts.map +1 -1
- package/lib/schedule-manager.js +91 -155
- package/lib/schedule-manager.js.map +1 -1
- package/lib/security/anomaly-detection.d.ts +3 -6
- package/lib/security/anomaly-detection.d.ts.map +1 -1
- package/lib/security/anomaly-detection.js +24 -31
- package/lib/security/anomaly-detection.js.map +1 -1
- package/lib/security/audit-logger.d.ts +5 -4
- package/lib/security/audit-logger.d.ts.map +1 -1
- package/lib/security/audit-logger.js +17 -25
- package/lib/security/audit-logger.js.map +1 -1
- package/lib/security/dangerous-tool-policy.d.ts +1 -1
- package/lib/security/dangerous-tool-policy.d.ts.map +1 -1
- package/lib/security/dangerous-tool-policy.js +6 -25
- package/lib/security/dangerous-tool-policy.js.map +1 -1
- package/lib/security/exec-policy.d.ts +2 -1
- package/lib/security/exec-policy.d.ts.map +1 -1
- package/lib/security/exec-policy.js +6 -11
- package/lib/security/exec-policy.js.map +1 -1
- package/lib/security/file-policy.d.ts.map +1 -1
- package/lib/security/file-policy.js +1 -0
- package/lib/security/file-policy.js.map +1 -1
- package/lib/security/file-role-policy.d.ts.map +1 -1
- package/lib/security/file-role-policy.js +1 -4
- package/lib/security/file-role-policy.js.map +1 -1
- package/lib/security/index.d.ts +0 -2
- package/lib/security/index.d.ts.map +1 -1
- package/lib/security/index.js +0 -2
- package/lib/security/index.js.map +1 -1
- package/lib/security/network-policy-context.d.ts +7 -0
- package/lib/security/network-policy-context.d.ts.map +1 -0
- package/lib/security/network-policy-context.js +9 -0
- package/lib/security/network-policy-context.js.map +1 -0
- package/lib/security/network-policy.d.ts +14 -1
- package/lib/security/network-policy.d.ts.map +1 -1
- package/lib/security/network-policy.js +70 -3
- package/lib/security/network-policy.js.map +1 -1
- package/lib/security/owner-approve-always-store.d.ts +1 -1
- package/lib/security/owner-approve-always-store.d.ts.map +1 -1
- package/lib/security/owner-approve-always-store.js +12 -12
- package/lib/security/owner-approve-always-store.js.map +1 -1
- package/lib/security/policy-facade.d.ts +27 -0
- package/lib/security/policy-facade.d.ts.map +1 -1
- package/lib/security/policy-facade.js +190 -3
- package/lib/security/policy-facade.js.map +1 -1
- package/lib/security/sandbox.d.ts +2 -7
- package/lib/security/sandbox.d.ts.map +1 -1
- package/lib/security/sandbox.js +12 -21
- package/lib/security/sandbox.js.map +1 -1
- package/lib/security/turn-file-authority.d.ts +14 -0
- package/lib/security/turn-file-authority.d.ts.map +1 -0
- package/lib/security/turn-file-authority.js +101 -0
- package/lib/security/turn-file-authority.js.map +1 -0
- package/lib/security/turn-network-client.d.ts +30 -0
- package/lib/security/turn-network-client.d.ts.map +1 -0
- package/lib/security/turn-network-client.js +111 -0
- package/lib/security/turn-network-client.js.map +1 -0
- package/lib/service.d.ts +3 -13
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +3 -35
- package/lib/service.js.map +1 -1
- package/lib/session/{session-interaction-port.d.ts → approval-port.d.ts} +4 -7
- package/lib/session/approval-port.d.ts.map +1 -0
- package/lib/session/{session-interaction-port.js → approval-port.js} +1 -1
- package/lib/session/approval-port.js.map +1 -0
- package/lib/session/http-approval-adapter.d.ts +2 -2
- package/lib/session/http-approval-adapter.d.ts.map +1 -1
- package/lib/session/http-approval-adapter.js +1 -1
- package/lib/session/http-approval-adapter.js.map +1 -1
- package/lib/session/http-approval-waiter.d.ts +1 -1
- package/lib/session/http-approval-waiter.d.ts.map +1 -1
- package/lib/session/http-approval-waiter.js +25 -2
- package/lib/session/http-approval-waiter.js.map +1 -1
- package/lib/session/index.d.ts +6 -3
- package/lib/session/index.d.ts.map +1 -1
- package/lib/session/index.js +3 -2
- package/lib/session/index.js.map +1 -1
- package/lib/session/passive-group-session.d.ts +8 -10
- package/lib/session/passive-group-session.d.ts.map +1 -1
- package/lib/session/passive-group-session.js +23 -27
- package/lib/session/passive-group-session.js.map +1 -1
- package/lib/session/resolve-approval-port.d.ts +7 -0
- package/lib/session/resolve-approval-port.d.ts.map +1 -0
- package/lib/session/resolve-approval-port.js +13 -0
- package/lib/session/resolve-approval-port.js.map +1 -0
- package/lib/session/session-io.d.ts +3 -4
- package/lib/session/session-io.d.ts.map +1 -1
- package/lib/session/session-io.js +7 -15
- package/lib/session/session-io.js.map +1 -1
- package/lib/session/session-system.d.ts +22 -1
- package/lib/session/session-system.d.ts.map +1 -1
- package/lib/session/session-system.js +72 -10
- package/lib/session/session-system.js.map +1 -1
- package/lib/session/session-tree-commands.d.ts.map +1 -1
- package/lib/session/session-tree-commands.js +2 -4
- package/lib/session/session-tree-commands.js.map +1 -1
- package/lib/session/turn-ingress-session.d.ts +23 -0
- package/lib/session/turn-ingress-session.d.ts.map +1 -0
- package/lib/session/turn-ingress-session.js +89 -0
- package/lib/session/turn-ingress-session.js.map +1 -0
- package/lib/session-tree-runtime-registry.d.ts +3 -1
- package/lib/session-tree-runtime-registry.d.ts.map +1 -1
- package/lib/session-tree-runtime-registry.js +6 -4
- package/lib/session-tree-runtime-registry.js.map +1 -1
- package/lib/stability/memory-pressure.d.ts.map +1 -1
- package/lib/stability/memory-pressure.js +4 -21
- package/lib/stability/memory-pressure.js.map +1 -1
- package/lib/subagent/subagent-runtime.d.ts.map +1 -1
- package/lib/subagent/subagent-runtime.js +1 -5
- package/lib/subagent/subagent-runtime.js.map +1 -1
- package/lib/subagent/subagent-system-init.js +2 -2
- package/lib/subagent/subagent-system-init.js.map +1 -1
- package/lib/subagent-ai-events.d.ts +3 -0
- package/lib/subagent-ai-events.d.ts.map +1 -1
- package/lib/subagent-ai-events.js +4 -1
- package/lib/subagent-ai-events.js.map +1 -1
- package/lib/subagent-goal-notify.d.ts +1 -1
- package/lib/subagent-goal-notify.d.ts.map +1 -1
- package/lib/subagent-goal-notify.js +1 -1
- package/lib/subagent-goal-notify.js.map +1 -1
- package/lib/subagent-parent-context.d.ts +9 -0
- package/lib/subagent-parent-context.d.ts.map +1 -1
- package/lib/subagent-parent-context.js +8 -0
- package/lib/subagent-parent-context.js.map +1 -1
- package/lib/task-executor.d.ts +14 -25
- package/lib/task-executor.d.ts.map +1 -1
- package/lib/task-executor.js +106 -137
- package/lib/task-executor.js.map +1 -1
- package/lib/tool/builtin-policy-extractors.d.ts +2 -0
- package/lib/tool/builtin-policy-extractors.d.ts.map +1 -0
- package/lib/tool/builtin-policy-extractors.js +65 -0
- package/lib/tool/builtin-policy-extractors.js.map +1 -0
- package/lib/tool/classic-tool-execution-authority.d.ts +22 -0
- package/lib/tool/classic-tool-execution-authority.d.ts.map +1 -0
- package/lib/tool/classic-tool-execution-authority.js +79 -0
- package/lib/tool/classic-tool-execution-authority.js.map +1 -0
- package/lib/tool/contracts.d.ts +2 -2
- package/lib/tool/contracts.d.ts.map +1 -1
- package/lib/tool/contracts.js +1 -1
- package/lib/tool/deferred-resolution.d.ts +5 -3
- package/lib/tool/deferred-resolution.d.ts.map +1 -1
- package/lib/tool/deferred-resolution.js +31 -5
- package/lib/tool/deferred-resolution.js.map +1 -1
- package/lib/tool/index.d.ts +2 -0
- package/lib/tool/index.d.ts.map +1 -1
- package/lib/tool/index.js +1 -0
- package/lib/tool/index.js.map +1 -1
- package/lib/tool/prepare-turn-tools.d.ts +2 -0
- package/lib/tool/prepare-turn-tools.d.ts.map +1 -1
- package/lib/tool/prepare-turn-tools.js +62 -10
- package/lib/tool/prepare-turn-tools.js.map +1 -1
- package/lib/tool/runtime.d.ts +1 -1
- package/lib/tool/runtime.d.ts.map +1 -1
- package/lib/tool/runtime.js +1 -1
- package/lib/tool/runtime.js.map +1 -1
- package/lib/tool/sources.d.ts +5 -2
- package/lib/tool/sources.d.ts.map +1 -1
- package/lib/tool/sources.js +4 -4
- package/lib/tool/sources.js.map +1 -1
- package/lib/tool/tool-approval-gate.d.ts +3 -3
- package/lib/tool/tool-approval-gate.d.ts.map +1 -1
- package/lib/tool/tool-approval-gate.js +2 -1
- package/lib/tool/tool-approval-gate.js.map +1 -1
- package/lib/tool/tool-runtime.d.ts +52 -0
- package/lib/tool/tool-runtime.d.ts.map +1 -0
- package/lib/tool/tool-runtime.js +101 -0
- package/lib/tool/tool-runtime.js.map +1 -0
- package/lib/tool/tool-system.d.ts +7 -3
- package/lib/tool/tool-system.d.ts.map +1 -1
- package/lib/tool/tool-system.js +12 -6
- package/lib/tool/tool-system.js.map +1 -1
- package/lib/tool/turn-tool-runtime.d.ts +29 -0
- package/lib/tool/turn-tool-runtime.d.ts.map +1 -0
- package/lib/tool/turn-tool-runtime.js +89 -0
- package/lib/tool/turn-tool-runtime.js.map +1 -0
- package/lib/tool-catalog/deferred-turn-controller.d.ts +30 -0
- package/lib/tool-catalog/deferred-turn-controller.d.ts.map +1 -0
- package/lib/tool-catalog/deferred-turn-controller.js +126 -0
- package/lib/tool-catalog/deferred-turn-controller.js.map +1 -0
- package/lib/turn/auto-continue.d.ts +6 -15
- package/lib/turn/auto-continue.d.ts.map +1 -1
- package/lib/turn/auto-continue.js +43 -31
- package/lib/turn/auto-continue.js.map +1 -1
- package/lib/turn/deferred-turn-state.d.ts +29 -0
- package/lib/turn/deferred-turn-state.d.ts.map +1 -0
- package/lib/turn/deferred-turn-state.js +35 -0
- package/lib/turn/deferred-turn-state.js.map +1 -0
- package/lib/turn/execute-agent-turn.d.ts +14 -0
- package/lib/turn/execute-agent-turn.d.ts.map +1 -0
- package/lib/turn/execute-agent-turn.js +171 -0
- package/lib/turn/execute-agent-turn.js.map +1 -0
- package/lib/turn/inbound-media.d.ts +3 -3
- package/lib/turn/inbound-media.d.ts.map +1 -1
- package/lib/turn/inbound-media.js +11 -4
- package/lib/turn/inbound-media.js.map +1 -1
- package/lib/turn/index.d.ts +8 -1
- package/lib/turn/index.d.ts.map +1 -1
- package/lib/turn/index.js +5 -1
- package/lib/turn/index.js.map +1 -1
- package/lib/turn/journal-integrity.d.ts +5 -0
- package/lib/turn/journal-integrity.d.ts.map +1 -0
- package/lib/turn/journal-integrity.js +8 -0
- package/lib/turn/journal-integrity.js.map +1 -0
- package/lib/turn/process-stream.d.ts.map +1 -1
- package/lib/turn/process-stream.js +21 -55
- package/lib/turn/process-stream.js.map +1 -1
- package/lib/turn/prompt-controller.d.ts +7 -4
- package/lib/turn/prompt-controller.d.ts.map +1 -1
- package/lib/turn/prompt-controller.js +23 -11
- package/lib/turn/prompt-controller.js.map +1 -1
- package/lib/turn/subagent-auto-continue.d.ts +2 -0
- package/lib/turn/subagent-auto-continue.d.ts.map +1 -1
- package/lib/turn/subagent-auto-continue.js +17 -1
- package/lib/turn/subagent-auto-continue.js.map +1 -1
- package/lib/turn/task-continuation.d.ts +3 -6
- package/lib/turn/task-continuation.d.ts.map +1 -1
- package/lib/turn/task-continuation.js +10 -13
- package/lib/turn/task-continuation.js.map +1 -1
- package/lib/turn/turn-complete.d.ts +1 -0
- package/lib/turn/turn-complete.d.ts.map +1 -1
- package/lib/turn/turn-complete.js +3 -2
- package/lib/turn/turn-complete.js.map +1 -1
- package/lib/turn/turn-context-bridge.d.ts +0 -4
- package/lib/turn/turn-context-bridge.d.ts.map +1 -1
- package/lib/turn/turn-context-bridge.js +0 -10
- package/lib/turn/turn-context-bridge.js.map +1 -1
- package/lib/turn/turn-event-source.d.ts +15 -0
- package/lib/turn/turn-event-source.d.ts.map +1 -0
- package/lib/turn/turn-event-source.js +61 -0
- package/lib/turn/turn-event-source.js.map +1 -0
- package/lib/turn/turn-ingress.d.ts +157 -0
- package/lib/turn/turn-ingress.d.ts.map +1 -0
- package/lib/turn/turn-ingress.js +76 -0
- package/lib/turn/turn-ingress.js.map +1 -0
- package/lib/turn/turn-metrics.d.ts.map +1 -1
- package/lib/turn/turn-metrics.js +10 -9
- package/lib/turn/turn-metrics.js.map +1 -1
- package/lib/turn/turn-pipeline.d.ts +10 -3
- package/lib/turn/turn-pipeline.d.ts.map +1 -1
- package/lib/turn/turn-pipeline.js +73 -41
- package/lib/turn/turn-pipeline.js.map +1 -1
- package/lib/typing-indicator/adapter-integration.d.ts +3 -5
- package/lib/typing-indicator/adapter-integration.d.ts.map +1 -1
- package/lib/typing-indicator/adapter-integration.js.map +1 -1
- package/lib/typing-indicator/index.d.ts +4 -4
- package/lib/typing-indicator/index.d.ts.map +1 -1
- package/lib/typing-indicator/index.js +25 -29
- package/lib/typing-indicator/index.js.map +1 -1
- package/lib/typing-indicator/integration.d.ts +6 -8
- package/lib/typing-indicator/integration.d.ts.map +1 -1
- package/lib/typing-indicator/integration.js +12 -10
- package/lib/typing-indicator/integration.js.map +1 -1
- package/lib/utils/keyed-mutex.d.ts +10 -0
- package/lib/utils/keyed-mutex.d.ts.map +1 -0
- package/lib/utils/keyed-mutex.js +34 -0
- package/lib/utils/keyed-mutex.js.map +1 -0
- package/lib/zhin-agent/index.d.ts +71 -76
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +51 -157
- package/lib/zhin-agent/index.js.map +1 -1
- package/lib/zhin-agent/runtime-modules.d.ts +1 -0
- package/lib/zhin-agent/runtime-modules.d.ts.map +1 -1
- package/lib/zhin-agent/runtime-modules.js +16 -0
- package/lib/zhin-agent/runtime-modules.js.map +1 -1
- package/package.json +13 -11
- package/lib/assistant/domains/home-assistant.d.ts.map +0 -1
- package/lib/assistant/domains/home-assistant.js.map +0 -1
- package/lib/assistant/schedule-message.d.ts +0 -9
- package/lib/assistant/schedule-message.d.ts.map +0 -1
- package/lib/assistant/schedule-message.js +0 -23
- package/lib/assistant/schedule-message.js.map +0 -1
- package/lib/assistant/schedule-tool-runtime.d.ts +0 -7
- package/lib/assistant/schedule-tool-runtime.d.ts.map +0 -1
- package/lib/assistant/schedule-tool-runtime.js +0 -50
- package/lib/assistant/schedule-tool-runtime.js.map +0 -1
- package/lib/builtin/ask-user-session-service.d.ts +0 -40
- package/lib/builtin/ask-user-session-service.d.ts.map +0 -1
- package/lib/builtin/ask-user-session-service.js +0 -258
- package/lib/builtin/ask-user-session-service.js.map +0 -1
- package/lib/builtin/ask-user-session.d.ts +0 -18
- package/lib/builtin/ask-user-session.d.ts.map +0 -1
- package/lib/builtin/ask-user-session.js +0 -21
- package/lib/builtin/ask-user-session.js.map +0 -1
- package/lib/builtin/ask-user-tool.d.ts +0 -22
- package/lib/builtin/ask-user-tool.d.ts.map +0 -1
- package/lib/builtin/ask-user-tool.js +0 -148
- package/lib/builtin/ask-user-tool.js.map +0 -1
- package/lib/builtin/deferred-tool-meta.d.ts +0 -51
- package/lib/builtin/deferred-tool-meta.d.ts.map +0 -1
- package/lib/builtin/deferred-tool-meta.js +0 -143
- package/lib/builtin/deferred-tool-meta.js.map +0 -1
- package/lib/collaboration/ask-user-bridge.d.ts +0 -9
- package/lib/collaboration/ask-user-bridge.d.ts.map +0 -1
- package/lib/collaboration/ask-user-bridge.js +0 -73
- package/lib/collaboration/ask-user-bridge.js.map +0 -1
- package/lib/collaboration/bootstrap-agent-runtimes.d.ts +0 -22
- package/lib/collaboration/bootstrap-agent-runtimes.d.ts.map +0 -1
- package/lib/collaboration/bootstrap-agent-runtimes.js +0 -106
- package/lib/collaboration/bootstrap-agent-runtimes.js.map +0 -1
- package/lib/collaboration/inbound-turn-compat.d.ts +0 -32
- package/lib/collaboration/inbound-turn-compat.d.ts.map +0 -1
- package/lib/collaboration/inbound-turn-compat.js +0 -30
- package/lib/collaboration/inbound-turn-compat.js.map +0 -1
- package/lib/collaboration/runtime-registry.d.ts +0 -18
- package/lib/collaboration/runtime-registry.d.ts.map +0 -1
- package/lib/collaboration/runtime-registry.js +0 -45
- package/lib/collaboration/runtime-registry.js.map +0 -1
- package/lib/init/management-command-guard.d.ts +0 -6
- package/lib/init/management-command-guard.d.ts.map +0 -1
- package/lib/init/management-command-guard.js +0 -6
- package/lib/init/management-command-guard.js.map +0 -1
- package/lib/init/output-renderer.d.ts +0 -7
- package/lib/init/output-renderer.d.ts.map +0 -1
- package/lib/init/output-renderer.js +0 -44
- package/lib/init/output-renderer.js.map +0 -1
- package/lib/init/register-home-tools.d.ts +0 -2
- package/lib/init/register-home-tools.d.ts.map +0 -1
- package/lib/init/register-home-tools.js +0 -51
- package/lib/init/register-home-tools.js.map +0 -1
- package/lib/init/register-owner-approve-commands.d.ts +0 -10
- package/lib/init/register-owner-approve-commands.d.ts.map +0 -1
- package/lib/init/register-owner-approve-commands.js +0 -12
- package/lib/init/register-owner-approve-commands.js.map +0 -1
- package/lib/media/constants.d.ts +0 -3
- package/lib/media/constants.d.ts.map +0 -1
- package/lib/media/constants.js +0 -3
- package/lib/media/constants.js.map +0 -1
- package/lib/orchestrator/owner-confirm-orchestration.d.ts +0 -39
- package/lib/orchestrator/owner-confirm-orchestration.d.ts.map +0 -1
- package/lib/orchestrator/owner-confirm-orchestration.js +0 -92
- package/lib/orchestrator/owner-confirm-orchestration.js.map +0 -1
- package/lib/orchestrator/owner-orchestration-constants.d.ts +0 -6
- package/lib/orchestrator/owner-orchestration-constants.d.ts.map +0 -1
- package/lib/orchestrator/owner-orchestration-constants.js +0 -10
- package/lib/orchestrator/owner-orchestration-constants.js.map +0 -1
- package/lib/security/dangerous-tool-policy-hook.d.ts +0 -6
- package/lib/security/dangerous-tool-policy-hook.d.ts.map +0 -1
- package/lib/security/dangerous-tool-policy-hook.js +0 -41
- package/lib/security/dangerous-tool-policy-hook.js.map +0 -1
- package/lib/security/exec-policy-hook.d.ts +0 -7
- package/lib/security/exec-policy-hook.d.ts.map +0 -1
- package/lib/security/exec-policy-hook.js +0 -29
- package/lib/security/exec-policy-hook.js.map +0 -1
- package/lib/security/file-policy-hook.d.ts +0 -6
- package/lib/security/file-policy-hook.d.ts.map +0 -1
- package/lib/security/file-policy-hook.js +0 -30
- package/lib/security/file-policy-hook.js.map +0 -1
- package/lib/security/sandbox-enhanced.d.ts +0 -173
- package/lib/security/sandbox-enhanced.d.ts.map +0 -1
- package/lib/security/sandbox-enhanced.js +0 -665
- package/lib/security/sandbox-enhanced.js.map +0 -1
- package/lib/session/im-approval-adapter.d.ts +0 -12
- package/lib/session/im-approval-adapter.d.ts.map +0 -1
- package/lib/session/im-approval-adapter.js +0 -24
- package/lib/session/im-approval-adapter.js.map +0 -1
- package/lib/session/resolve-session-interaction-port.d.ts +0 -9
- package/lib/session/resolve-session-interaction-port.d.ts.map +0 -1
- package/lib/session/resolve-session-interaction-port.js +0 -17
- package/lib/session/resolve-session-interaction-port.js.map +0 -1
- package/lib/session/session-interaction-port.d.ts.map +0 -1
- package/lib/session/session-interaction-port.js.map +0 -1
|
@@ -6,8 +6,13 @@ import type { AgentRunJournal } from '@zhin.js/ai/agent-stream';
|
|
|
6
6
|
import { type ToolCallRecord } from './tool-calls-user-format.js';
|
|
7
7
|
import type { HostPromptTurnHooks } from '../internal/host-types.js';
|
|
8
8
|
import type { AgentCore } from './agent-core.js';
|
|
9
|
-
import type { ZhinAgentPrivate, OnChunkCallback
|
|
9
|
+
import type { ZhinAgentPrivate, OnChunkCallback } from '../internal/agent-host.js';
|
|
10
|
+
import type { ToolCatalogItem } from '../tool-catalog/types.js';
|
|
10
11
|
import type { TurnEvent } from '../event/turn-event.js';
|
|
12
|
+
import type { AgentPromptProfile } from '../prompt/turn-prompt-profile.js';
|
|
13
|
+
import type { TurnContextView } from '../context/turn-envelope.js';
|
|
14
|
+
import type { ToolExecutionAuthority } from './tool-execution-authority.js';
|
|
15
|
+
import type { PluginAILoopHookRegistry } from '../plugin-loop-hooks.js';
|
|
11
16
|
export interface AgentLoopTurnInput {
|
|
12
17
|
host: ZhinAgentPrivate;
|
|
13
18
|
core?: AgentCore;
|
|
@@ -15,10 +20,21 @@ export interface AgentLoopTurnInput {
|
|
|
15
20
|
/** 本轮 user 消息 extra(入库 agent_messages.extra) */
|
|
16
21
|
userMessageExtra?: import('@zhin.js/ai').AgentMessageExtra;
|
|
17
22
|
rawContent: string;
|
|
18
|
-
|
|
19
|
-
|
|
23
|
+
promptProfile: AgentPromptProfile;
|
|
24
|
+
turnContext: TurnContextView;
|
|
20
25
|
allTools: AgentTool[];
|
|
21
26
|
resolvedTools: AgentTool[];
|
|
27
|
+
toolExecution: ToolExecutionAuthority;
|
|
28
|
+
/** Canonical capability authority journals tool facts itself; classic loops map them. */
|
|
29
|
+
toolEventSource?: 'loop' | 'authority';
|
|
30
|
+
loopHooks?: PluginAILoopHookRegistry;
|
|
31
|
+
promptRuntime?: Readonly<{
|
|
32
|
+
bootstrapContext?: string;
|
|
33
|
+
activeSkillsContext?: string;
|
|
34
|
+
agentNickname?: string;
|
|
35
|
+
modelId?: string;
|
|
36
|
+
providerAlias?: string;
|
|
37
|
+
}>;
|
|
22
38
|
personaEnhanced: string;
|
|
23
39
|
modelId: string;
|
|
24
40
|
modelCandidates: string[];
|
|
@@ -27,22 +43,29 @@ export interface AgentLoopTurnInput {
|
|
|
27
43
|
promptHooks?: HostPromptTurnHooks;
|
|
28
44
|
signal?: AbortSignal;
|
|
29
45
|
deferredStats?: string;
|
|
46
|
+
/** Turn-owned deferred selection authority. Required for deferred loading. */
|
|
47
|
+
deferredController?: Readonly<{
|
|
48
|
+
loadedToolNames(): string[];
|
|
49
|
+
}>;
|
|
50
|
+
/** Catalog paired with deferredController for this exact Turn. */
|
|
51
|
+
toolCatalog?: readonly ToolCatalogItem[];
|
|
52
|
+
/** Direct tool sets bypass deferred catalog/snapshot/meta-tool machinery. */
|
|
53
|
+
toolLoading?: 'deferred' | 'direct';
|
|
54
|
+
/** Isolated executions neither load nor append conversational history. */
|
|
55
|
+
conversationPersistence?: 'session' | 'none';
|
|
30
56
|
/** Tool name aliases: LLM-facing name → actual tool name */
|
|
31
57
|
toolAliases?: Record<string, string>;
|
|
32
58
|
/** Optional TurnEvent tap (processStream / diagnostics) */
|
|
33
59
|
onTurnEvent?: (event: TurnEvent) => void;
|
|
34
60
|
/** Ordered public event journal for this stream turn. */
|
|
35
61
|
journal?: AgentRunJournal;
|
|
62
|
+
/**
|
|
63
|
+
* Snapshot generation for ToolRuntime validation.
|
|
64
|
+
* Plugin Runtime hosts pass SnapshotStore / AgentCapabilities.generation;
|
|
65
|
+
* legacy paths keep the `0` placeholder.
|
|
66
|
+
*/
|
|
67
|
+
generation?: number;
|
|
36
68
|
}
|
|
37
|
-
/** Optional second argument for tools that support cooperative cancellation. */
|
|
38
|
-
export interface AgentToolExecutionContext {
|
|
39
|
-
readonly signal?: AbortSignal;
|
|
40
|
-
readonly sessionId: string;
|
|
41
|
-
readonly toolCallId: string;
|
|
42
|
-
readonly toolName: string;
|
|
43
|
-
}
|
|
44
|
-
type CancellableToolExecute<TResult = unknown> = (args: Record<string, unknown>, legacyContext?: Message, executionContext?: AgentToolExecutionContext) => TResult | Promise<TResult>;
|
|
45
|
-
export declare function executeCancellableTool<TResult>(execute: CancellableToolExecute<TResult>, args: Record<string, unknown>, legacyContext: Message, context: AgentToolExecutionContext): Promise<TResult>;
|
|
46
69
|
export interface AgentLoopTurnResult {
|
|
47
70
|
reply: string;
|
|
48
71
|
usage: Usage;
|
|
@@ -51,12 +74,13 @@ export interface AgentLoopTurnResult {
|
|
|
51
74
|
model: string;
|
|
52
75
|
toolCalls: ToolCallRecord[];
|
|
53
76
|
thinking?: string;
|
|
77
|
+
/** Conversation projection applied only after the durable terminal commits. */
|
|
78
|
+
projectConversation?: () => Promise<void>;
|
|
54
79
|
}
|
|
55
80
|
export interface AgentLoopVisionTurnInput {
|
|
56
81
|
host: ZhinAgentPrivate;
|
|
57
82
|
core?: AgentCore;
|
|
58
83
|
sessionId: string;
|
|
59
|
-
commMessage: Message;
|
|
60
84
|
visionSystemPrompt: string;
|
|
61
85
|
userMessages: AgentMessage[];
|
|
62
86
|
modelCandidates: string[];
|
|
@@ -71,5 +95,4 @@ export type AgentLoopVisionTurnResult = AgentLoopTurnResult & {
|
|
|
71
95
|
export declare function runAgentLoopVisionTurnRun(input: AgentLoopVisionTurnInput): AsyncGenerator<TurnEvent, AgentLoopVisionTurnResult>;
|
|
72
96
|
export declare function collectAgentLoopTurnRun<R>(gen: AsyncGenerator<TurnEvent, R>, onTurnEvent?: (event: TurnEvent) => void): Promise<R>;
|
|
73
97
|
export declare function runAgentLoopTextTurnRun(input: AgentLoopTurnInput): AsyncGenerator<TurnEvent, AgentLoopTurnResult>;
|
|
74
|
-
export {};
|
|
75
98
|
//# sourceMappingURL=agent-core-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agent-core-run.d.ts","sourceRoot":"","sources":["../../src/core/agent-core-run.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"agent-core-run.d.ts","sourceRoot":"","sources":["../../src/core/agent-core-run.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,KAAK,EAA6G,KAAK,YAAY,EAA+D,MAAM,aAAa,CAAC;AACpP,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAQhE,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAK1F,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,2BAA2B,CAAC;AACrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAKnF,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC;AAChE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAKxD,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AACnE,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAC5E,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AAmExE,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,OAAO,aAAa,EAAE,iBAAiB,CAAC;IAC3D,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,kBAAkB,CAAC;IAClC,WAAW,EAAE,eAAe,CAAC;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,aAAa,EAAE,SAAS,EAAE,CAAC;IAC3B,aAAa,EAAE,sBAAsB,CAAC;IACtC,yFAAyF;IACzF,eAAe,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;IACvC,SAAS,CAAC,EAAE,wBAAwB,CAAC;IACrC,aAAa,CAAC,EAAE,QAAQ,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,mBAAmB,CAAC,EAAE,MAAM,CAAC;QAC7B,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;KACxB,CAAC,CAAC;IACH,eAAe,EAAE,MAAM,CAAC;IACxB,OAAO,EAAE,MAAM,CAAC;IAChB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,eAAe,CAAC,EAAE,YAAY,EAAE,CAAC;IACjC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,QAAQ,CAAC;QAAE,eAAe,IAAI,MAAM,EAAE,CAAA;KAAE,CAAC,CAAC;IAC/D,kEAAkE;IAClE,WAAW,CAAC,EAAE,SAAS,eAAe,EAAE,CAAC;IACzC,6EAA6E;IAC7E,WAAW,CAAC,EAAE,UAAU,GAAG,QAAQ,CAAC;IACpC,0EAA0E;IAC1E,uBAAuB,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC7C,4DAA4D;IAC5D,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,2DAA2D;IAC3D,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACzC,yDAAyD;IACzD,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B;;;;OAIG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,YAAY,CAAC;IACtC,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,cAAc,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,gBAAgB,CAAC;IACvB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,YAAY,EAAE,YAAY,EAAE,CAAC;IAC7B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,OAAO,CAAC,EAAE,eAAe,CAAC;IAC1B,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;CAC1C;AAED,MAAM,MAAM,yBAAyB,GAAG,mBAAmB,GAAG;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,CAAC;AAoIrF,wBAAuB,yBAAyB,CAC9C,KAAK,EAAE,wBAAwB,GAC9B,cAAc,CAAC,SAAS,EAAE,yBAAyB,CAAC,CAuBtD;AAED,wBAAsB,uBAAuB,CAAC,CAAC,EAC7C,GAAG,EAAE,cAAc,CAAC,SAAS,EAAE,CAAC,CAAC,EACjC,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,GACvC,OAAO,CAAC,CAAC,CAAC,CAMZ;AAED,wBAAuB,uBAAuB,CAC5C,KAAK,EAAE,kBAAkB,GACxB,cAAc,CAAC,SAAS,EAAE,mBAAmB,CAAC,CAgZhD"}
|
|
@@ -3,28 +3,25 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { aiOutboundJsonSchema, buildAiOutboundPromptHint } from '@zhin.js/core';
|
|
5
5
|
import { formatCompact, truncatePreview, getLogger } from '@zhin.js/logger';
|
|
6
|
-
import { agentLoop, agentContextFrom, assistantText, createUserMessage, getLlmTransportModel,
|
|
7
|
-
import {
|
|
6
|
+
import { agentLoop, agentContextFrom, assistantText, createUserMessage, getLlmTransportModel, agentToolsToLlmTools } from '@zhin.js/ai';
|
|
7
|
+
import { tokenUsageToLegacy } from './agent-run-shared.js';
|
|
8
8
|
import { applyExecPolicyToTools } from '../security/exec-policy.js';
|
|
9
|
-
import { createOwnerOrchestratedToolResultTransform } from '../orchestrator/owner-confirm-orchestration.js';
|
|
10
9
|
import { resolveModelHarness } from '../config/model-harness-runtime.js';
|
|
11
10
|
import { buildAgentPathSystemPrompt, buildChatPathSystemPrompt, describeAgentPathPromptSections } from '../prompt/assembly.js';
|
|
12
11
|
import { logPromptComposition } from '../internal/prompt-trace.js';
|
|
13
12
|
import { planToolRun } from '../tool/runtime.js';
|
|
14
13
|
import { sanitizeAssistantReply, unwrapJsonStringLayers } from './text-sanitize.js';
|
|
15
14
|
import { formatToolCallsForUser } from './tool-calls-user-format.js';
|
|
15
|
+
import { shouldSuppressReplyForSpawnDelegation } from './spawn-delegation.js';
|
|
16
16
|
import { transformContextWithCompaction } from '../memory/compaction-runtime.js';
|
|
17
17
|
import { logPhase, tokenUsageLogFields, logAgentLoopIterationEnd } from '../internal/phase-trace.js';
|
|
18
18
|
import { buildAgentPromptCacheStreamOptions } from '../config/index.js';
|
|
19
|
-
import {
|
|
20
|
-
import { persistDeferredToolSnapshot, buildLlmToolsForProvider } from '../tool/deferred-resolution.js';
|
|
21
|
-
import { runToolApprovalGate } from '../tool/tool-approval-gate.js';
|
|
19
|
+
import { buildLlmToolsForProvider } from '../tool/deferred-resolution.js';
|
|
22
20
|
import { applyToolToModelOutput } from '../tool/tool-model-output.js';
|
|
23
|
-
import {
|
|
24
|
-
import { resolveDeferredToolsConfig, resolveAlwaysLoadedSet } from '../tool-catalog/resolve-config.js';
|
|
21
|
+
import { resolveAlwaysLoadedSet } from '../tool-catalog/resolve-config.js';
|
|
25
22
|
import { resolveDeferredApiTools } from '../tool-catalog/tool-catalog.js';
|
|
26
|
-
import { buildSkillLoadOptsForAgent } from '../skill/skill-load-opts.js';
|
|
27
23
|
import { createTurnEventMapperState, mapAgentEventToTurnEvents, } from './turn-event-mapper.js';
|
|
24
|
+
import { TurnJournalCommitError } from '../turn/journal-integrity.js';
|
|
28
25
|
const logger = getLogger('ZhinAgent:AgentLoopTurn');
|
|
29
26
|
/** 入库前解开模型误包的 JSON 字符串,避免下一轮历史继续叠转义。 */
|
|
30
27
|
function normalizeAssistantMessageText(assistant) {
|
|
@@ -54,16 +51,6 @@ function logAssistantIterationFailure(assistant, modelId, sessionId) {
|
|
|
54
51
|
error: truncatePreview(assistant.errorMessage, 500),
|
|
55
52
|
}));
|
|
56
53
|
}
|
|
57
|
-
function resolveAIService(plugin) {
|
|
58
|
-
if (!plugin)
|
|
59
|
-
return undefined;
|
|
60
|
-
try {
|
|
61
|
-
return plugin.inject?.('ai');
|
|
62
|
-
}
|
|
63
|
-
catch {
|
|
64
|
-
return undefined;
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
54
|
/** ai.agent.outputSchema 配置 → 传给 LLM 的 JSON Schema(true/'segments' 用 zhin 出站契约)。 */
|
|
68
55
|
function resolveAgentOutputSchema(value) {
|
|
69
56
|
if (!value)
|
|
@@ -72,13 +59,6 @@ function resolveAgentOutputSchema(value) {
|
|
|
72
59
|
return aiOutboundJsonSchema;
|
|
73
60
|
return value;
|
|
74
61
|
}
|
|
75
|
-
function tokenUsageToLegacy(usage) {
|
|
76
|
-
return {
|
|
77
|
-
prompt_tokens: usage.input,
|
|
78
|
-
completion_tokens: usage.output,
|
|
79
|
-
total_tokens: usage.totalTokens,
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
62
|
function toolResultToAgentMessage(toolCall, result, isError) {
|
|
83
63
|
const text = typeof result === 'string'
|
|
84
64
|
? result
|
|
@@ -94,34 +74,6 @@ function toolResultToAgentMessage(toolCall, result, isError) {
|
|
|
94
74
|
timestamp: Date.now(),
|
|
95
75
|
};
|
|
96
76
|
}
|
|
97
|
-
export async function executeCancellableTool(execute, args, legacyContext, context) {
|
|
98
|
-
throwIfToolExecutionAborted(context.signal);
|
|
99
|
-
const execution = Promise.resolve().then(() => execute(args, legacyContext, context));
|
|
100
|
-
const result = await raceToolExecutionAbort(execution, context.signal);
|
|
101
|
-
throwIfToolExecutionAborted(context.signal);
|
|
102
|
-
return result;
|
|
103
|
-
}
|
|
104
|
-
function throwIfToolExecutionAborted(signal) {
|
|
105
|
-
if (!signal?.aborted)
|
|
106
|
-
return;
|
|
107
|
-
throw signal.reason instanceof Error ? signal.reason : new Error('Tool execution cancelled');
|
|
108
|
-
}
|
|
109
|
-
function raceToolExecutionAbort(execution, signal) {
|
|
110
|
-
if (!signal)
|
|
111
|
-
return execution;
|
|
112
|
-
throwIfToolExecutionAborted(signal);
|
|
113
|
-
return new Promise((resolve, reject) => {
|
|
114
|
-
const onAbort = () => reject(signal.reason instanceof Error ? signal.reason : new Error('Tool execution cancelled'));
|
|
115
|
-
signal.addEventListener('abort', onAbort, { once: true });
|
|
116
|
-
void execution.then((result) => {
|
|
117
|
-
signal.removeEventListener('abort', onAbort);
|
|
118
|
-
resolve(result);
|
|
119
|
-
}, (error) => {
|
|
120
|
-
signal.removeEventListener('abort', onAbort);
|
|
121
|
-
reject(error);
|
|
122
|
-
});
|
|
123
|
-
});
|
|
124
|
-
}
|
|
125
77
|
function turnEndFromLegacyUsage(reply, usage) {
|
|
126
78
|
return {
|
|
127
79
|
type: 'turn_end',
|
|
@@ -134,7 +86,7 @@ function turnEndFromLegacyUsage(reply, usage) {
|
|
|
134
86
|
};
|
|
135
87
|
}
|
|
136
88
|
async function* runAgentLoopVisionTurnOnceRun(input) {
|
|
137
|
-
const { host, sessionId,
|
|
89
|
+
const { host, sessionId, visionSystemPrompt, modelId, onChunk, promptHooks, signal } = input;
|
|
138
90
|
const repo = host.contextRepository;
|
|
139
91
|
const providerAlias = host.getTurnProvider().name;
|
|
140
92
|
const llmModel = getLlmTransportModel(providerAlias, modelId);
|
|
@@ -272,31 +224,37 @@ export async function collectAgentLoopTurnRun(gen, onTurnEvent) {
|
|
|
272
224
|
}
|
|
273
225
|
}
|
|
274
226
|
export async function* runAgentLoopTextTurnRun(input) {
|
|
275
|
-
const { host, sessionId, userMessageExtra,
|
|
227
|
+
const { host, sessionId, userMessageExtra, allTools, resolvedTools, personaEnhanced, modelId, onChunk, promptHooks, signal, } = input;
|
|
276
228
|
const repo = host.contextRepository;
|
|
277
229
|
const providerAlias = host.getTurnProvider().name;
|
|
278
230
|
const llmModel = getLlmTransportModel(providerAlias, modelId);
|
|
279
|
-
const
|
|
231
|
+
const persistentConversation = input.conversationPersistence !== 'none';
|
|
232
|
+
const loaded = persistentConversation
|
|
233
|
+
? await repo.loadContext(sessionId)
|
|
234
|
+
: { messages: [] };
|
|
280
235
|
const promptMessages = input.initialMessages?.length
|
|
281
236
|
? input.initialMessages
|
|
282
237
|
: [createUserMessage(input.rawContent)];
|
|
283
|
-
const
|
|
238
|
+
const directTools = input.toolLoading === 'direct';
|
|
239
|
+
const hasTools = directTools ? resolvedTools.length > 0 : allTools.length > 0;
|
|
240
|
+
const toolRun = hasTools && !directTools
|
|
284
241
|
? await planToolRun(resolvedTools, host.config.preExecTimeout)
|
|
285
242
|
: { mode: 'agent', preExecution: { tools: [], data: '' } };
|
|
286
243
|
const preData = toolRun.preExecution.data;
|
|
287
|
-
const hasTools = allTools.length > 0;
|
|
288
244
|
const outputSchema = resolveAgentOutputSchema(host.config.outputSchema);
|
|
289
245
|
let systemPrompt = hasTools
|
|
290
246
|
? await buildAgentPathSystemPrompt(host, {
|
|
247
|
+
profile: input.promptProfile,
|
|
248
|
+
turn: input.turnContext,
|
|
291
249
|
content: input.rawContent,
|
|
292
|
-
commMessage: contextForTools,
|
|
293
250
|
sessionId,
|
|
294
251
|
personaEnhanced,
|
|
295
252
|
preData,
|
|
296
253
|
deferredStats: input.deferredStats,
|
|
297
254
|
modelSdk: llmModel.sdk,
|
|
255
|
+
runtime: input.promptRuntime,
|
|
298
256
|
})
|
|
299
|
-
: buildChatPathSystemPrompt(host, personaEnhanced,
|
|
257
|
+
: buildChatPathSystemPrompt(host, personaEnhanced, input.promptProfile);
|
|
300
258
|
if (outputSchema) {
|
|
301
259
|
systemPrompt = `${systemPrompt}\n\n${buildAiOutboundPromptHint({})}`;
|
|
302
260
|
}
|
|
@@ -305,42 +263,29 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
305
263
|
approvalMode: host.config.execApprovalMode,
|
|
306
264
|
})
|
|
307
265
|
: [];
|
|
308
|
-
|
|
309
|
-
const catalog =
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
const skillLoadOpts = buildSkillLoadOptsForAgent(host);
|
|
313
|
-
bindDeferredToolRuntime(contextForTools, {
|
|
314
|
-
sessionId,
|
|
315
|
-
catalog,
|
|
316
|
-
skillRegistry: host.skillRegistry,
|
|
317
|
-
snapshot: sessionSnapshot,
|
|
318
|
-
maxLoadedPerSession: deferredCfg.maxLoadedPerSession,
|
|
319
|
-
discoverTopK: deferredCfg.discoverTopK,
|
|
320
|
-
persistSnapshot: async (snap) => {
|
|
321
|
-
sessionSnapshot = snap;
|
|
322
|
-
host.lastDeferredSessionSnapshot = snap;
|
|
323
|
-
await persistDeferredToolSnapshot(host, sessionId, snap);
|
|
324
|
-
},
|
|
325
|
-
onSkillLoaded: (_name, instructions) => {
|
|
326
|
-
host.appendActiveSkillsContext(instructions);
|
|
327
|
-
},
|
|
328
|
-
skillLoadOpts,
|
|
329
|
-
});
|
|
266
|
+
const deferredController = directTools ? undefined : input.deferredController;
|
|
267
|
+
const catalog = directTools ? [] : [...(input.toolCatalog ?? [])];
|
|
268
|
+
if (!directTools && hasTools && (!deferredController || catalog.length === 0)) {
|
|
269
|
+
throw new Error('Deferred tool loading requires a turn-owned controller and catalog');
|
|
330
270
|
}
|
|
331
271
|
const refreshResolvedTools = () => {
|
|
272
|
+
if (directTools)
|
|
273
|
+
return resolvedTools;
|
|
332
274
|
const alwaysLoaded = resolveAlwaysLoadedSet(host.config);
|
|
333
|
-
const loaded =
|
|
275
|
+
const loaded = deferredController.loadedToolNames();
|
|
334
276
|
return resolveDeferredApiTools(catalog, alwaysLoaded, loaded);
|
|
335
277
|
};
|
|
336
278
|
if (hasTools) {
|
|
337
|
-
const sections =
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
279
|
+
const sections = input.promptProfile.kind === 'interactive'
|
|
280
|
+
? await describeAgentPathPromptSections(host, {
|
|
281
|
+
turn: input.turnContext,
|
|
282
|
+
content: input.rawContent,
|
|
283
|
+
sessionId,
|
|
284
|
+
deferredStats: input.deferredStats,
|
|
285
|
+
modelSdk: llmModel.sdk,
|
|
286
|
+
runtime: input.promptRuntime,
|
|
287
|
+
})
|
|
288
|
+
: [];
|
|
344
289
|
logPromptComposition({
|
|
345
290
|
config: host.promptTraceConfig,
|
|
346
291
|
sessionId,
|
|
@@ -367,37 +312,20 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
367
312
|
const maxIterations = hasTools
|
|
368
313
|
? (harness.maxIterations ?? host.config.maxIterations)
|
|
369
314
|
: 1;
|
|
370
|
-
// Plugin Runtime Agent Host has no Feature root Plugin — skip owner hard-orch.
|
|
371
|
-
const orchestrationPlugin = host.emitter.getHostPlugin() ?? undefined;
|
|
372
|
-
const disableHardOrchestration = !orchestrationPlugin;
|
|
373
|
-
if (disableHardOrchestration) {
|
|
374
|
-
logger.debug(formatCompact({
|
|
375
|
-
note: 'no_host_plugin',
|
|
376
|
-
hint: 'runtime_agent_host; owner hard-orchestration disabled',
|
|
377
|
-
}));
|
|
378
|
-
}
|
|
379
|
-
const transformToolResult = createOwnerOrchestratedToolResultTransform({
|
|
380
|
-
commMessage: contextForTools,
|
|
381
|
-
disableHardOrchestration,
|
|
382
|
-
plugin: orchestrationPlugin,
|
|
383
|
-
});
|
|
384
315
|
const legacyByName = new Map(agentTools.map((t) => [t.name, t]));
|
|
385
|
-
let llmTools =
|
|
316
|
+
let llmTools = directTools
|
|
317
|
+
? agentToolsToLlmTools(agentTools)
|
|
318
|
+
: buildLlmToolsForProvider(llmModel.sdk, catalog, agentTools, resolveAlwaysLoadedSet(host.config), deferredController?.loadedToolNames() ?? []);
|
|
386
319
|
const toolCalls = [];
|
|
387
320
|
let iterations = 0;
|
|
388
321
|
let lastAssistantText = '';
|
|
389
322
|
let lastUsage;
|
|
323
|
+
const conversationBatches = [];
|
|
390
324
|
logPhase(host.phaseConfig, 'agent_loop.turn.start', sessionId, {
|
|
391
325
|
model: modelId,
|
|
392
326
|
maxIterations,
|
|
393
327
|
toolCount: agentTools.length,
|
|
394
328
|
});
|
|
395
|
-
if (hasTools) {
|
|
396
|
-
await host.emitter.dispatch('ai.agent.start', host.emitter.createPayload(sessionId, contextForTools, 'text', {
|
|
397
|
-
path: 'agent',
|
|
398
|
-
model: modelId,
|
|
399
|
-
}));
|
|
400
|
-
}
|
|
401
329
|
const loopContext = agentContextFrom({
|
|
402
330
|
systemPrompt,
|
|
403
331
|
messages: loaded.messages,
|
|
@@ -410,12 +338,13 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
410
338
|
legacyByName.clear();
|
|
411
339
|
for (const t of nextAgentTools)
|
|
412
340
|
legacyByName.set(t.name, t);
|
|
413
|
-
llmTools =
|
|
341
|
+
llmTools = directTools
|
|
342
|
+
? agentToolsToLlmTools(nextAgentTools)
|
|
343
|
+
: buildLlmToolsForProvider(llmModel.sdk, catalog, nextAgentTools, resolveAlwaysLoadedSet(host.config), deferredController?.loadedToolNames() ?? []);
|
|
414
344
|
return llmTools;
|
|
415
345
|
};
|
|
416
346
|
const contextWindow = llmModel.contextWindow ?? host.config.contextTokens;
|
|
417
|
-
const
|
|
418
|
-
const loopHooks = aiService?.loopHooks;
|
|
347
|
+
const loopHooks = input.loopHooks;
|
|
419
348
|
const loopConfig = {
|
|
420
349
|
model: llmModel,
|
|
421
350
|
maxIterations,
|
|
@@ -430,27 +359,25 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
430
359
|
...(outputSchema ? { outputSchema } : {}),
|
|
431
360
|
},
|
|
432
361
|
convertToLlm: (messages) => messages,
|
|
433
|
-
transformContext: async (messages, ctxSignal) => transformContextWithCompaction(messages, ctxSignal, {
|
|
362
|
+
transformContext: async (messages, ctxSignal) => persistentConversation ? transformContextWithCompaction(messages, ctxSignal, {
|
|
434
363
|
host,
|
|
435
364
|
sessionId,
|
|
436
|
-
commMessage: contextForTools,
|
|
437
365
|
model: llmModel,
|
|
438
366
|
compactionConfig: host.config.compaction,
|
|
439
367
|
contextWindow,
|
|
440
368
|
mode: 'text',
|
|
441
369
|
loopHooks,
|
|
442
|
-
}),
|
|
443
|
-
onContextOverflow: async (messages, ctxSignal) => transformContextWithCompaction(messages, ctxSignal, {
|
|
370
|
+
}) : messages,
|
|
371
|
+
onContextOverflow: async (messages, ctxSignal) => persistentConversation ? transformContextWithCompaction(messages, ctxSignal, {
|
|
444
372
|
host,
|
|
445
373
|
sessionId,
|
|
446
|
-
commMessage: contextForTools,
|
|
447
374
|
model: llmModel,
|
|
448
375
|
compactionConfig: host.config.compaction,
|
|
449
376
|
contextWindow,
|
|
450
377
|
mode: 'text',
|
|
451
378
|
force: true,
|
|
452
379
|
loopHooks,
|
|
453
|
-
}),
|
|
380
|
+
}) : messages,
|
|
454
381
|
getSteeringMessages: promptHooks?.getSteeringMessages,
|
|
455
382
|
getFollowUpMessages: promptHooks?.getFollowUpMessages,
|
|
456
383
|
executeTool: async (toolCall, _tools, toolSignal) => {
|
|
@@ -466,7 +393,7 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
466
393
|
toolInput: effectiveArgs,
|
|
467
394
|
toolSource: legacyByName.get(resolvedName)?.source,
|
|
468
395
|
sessionId,
|
|
469
|
-
|
|
396
|
+
turn: input.turnContext,
|
|
470
397
|
});
|
|
471
398
|
if (preDecision.decision === 'deny') {
|
|
472
399
|
const reason = preDecision.reason;
|
|
@@ -481,35 +408,14 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
481
408
|
if (!legacy) {
|
|
482
409
|
return toolResultToAgentMessage(toolCall, `工具「${resolvedName}」执行失败:工具不存在或所属插件未启用。`, true);
|
|
483
410
|
}
|
|
484
|
-
const httpSessionId = readHttpSessionId(contextForTools);
|
|
485
|
-
const approvalDenied = await runToolApprovalGate({
|
|
486
|
-
toolName: resolvedName,
|
|
487
|
-
args: effectiveArgs,
|
|
488
|
-
sessionId,
|
|
489
|
-
commMessage: contextForTools,
|
|
490
|
-
policy: legacy.approval,
|
|
491
|
-
plugin: orchestrationPlugin,
|
|
492
|
-
bus: host.orchestrator?.agentStreamBus,
|
|
493
|
-
port: resolveSessionInteractionPort(contextForTools, orchestrationPlugin, host.httpApprovalAdapter, host.approvalPort),
|
|
494
|
-
publishCtx: { sessionId, httpSessionId },
|
|
495
|
-
onceStore: host.orchestrator?.approvalOnce,
|
|
496
|
-
journal: input.journal,
|
|
497
|
-
});
|
|
498
|
-
if (approvalDenied) {
|
|
499
|
-
toolCalls.push({ tool: resolvedName, args: effectiveArgs, result: approvalDenied });
|
|
500
|
-
return toolResultToAgentMessage(toolCall, approvalDenied, true);
|
|
501
|
-
}
|
|
502
|
-
const t0 = performance.now();
|
|
503
|
-
const executionSignal = toolSignal ?? signal;
|
|
504
411
|
try {
|
|
505
|
-
const
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
}
|
|
511
|
-
const
|
|
512
|
-
const rawText = await applyToolToModelOutput(legacy, raw, effectiveArgs);
|
|
412
|
+
const outcome = await input.toolExecution.execute(legacy, effectiveArgs, toolCall.id);
|
|
413
|
+
if (outcome.status !== 'completed') {
|
|
414
|
+
const reason = outcome.status === 'failed' ? outcome.error : outcome.reason;
|
|
415
|
+
toolCalls.push({ tool: resolvedName, args: effectiveArgs, result: reason });
|
|
416
|
+
return toolResultToAgentMessage(toolCall, reason, true);
|
|
417
|
+
}
|
|
418
|
+
const rawText = await applyToolToModelOutput(legacy, outcome.output, effectiveArgs);
|
|
513
419
|
// PostToolUse interception
|
|
514
420
|
let resultText = rawText;
|
|
515
421
|
if (hookRegistry) {
|
|
@@ -518,9 +424,9 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
518
424
|
toolName: resolvedName,
|
|
519
425
|
toolInput: effectiveArgs,
|
|
520
426
|
toolOutput: rawText,
|
|
521
|
-
durationMs,
|
|
427
|
+
durationMs: outcome.durationMs,
|
|
522
428
|
sessionId,
|
|
523
|
-
|
|
429
|
+
turn: input.turnContext,
|
|
524
430
|
});
|
|
525
431
|
if (postDecision.decision === 'reject') {
|
|
526
432
|
toolCalls.push({ tool: resolvedName, args: effectiveArgs, result: postDecision.reason });
|
|
@@ -532,37 +438,23 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
532
438
|
: JSON.stringify(postDecision.modifiedOutput);
|
|
533
439
|
}
|
|
534
440
|
}
|
|
535
|
-
const
|
|
536
|
-
toolName: resolvedName,
|
|
537
|
-
toolCallId: toolCall.id,
|
|
538
|
-
args: effectiveArgs,
|
|
539
|
-
result: resultText,
|
|
540
|
-
});
|
|
541
|
-
const finalText = typeof transformed === 'string' ? transformed : String(transformed);
|
|
441
|
+
const finalText = resultText;
|
|
542
442
|
toolCalls.push({ tool: resolvedName, args: effectiveArgs, result: finalText });
|
|
543
|
-
host.emitter.emit('ai.tool.result', host.emitter.createPayload(sessionId, contextForTools, 'text', {
|
|
544
|
-
path: 'agent',
|
|
545
|
-
toolName: resolvedName,
|
|
546
|
-
result: finalText,
|
|
547
|
-
}));
|
|
548
443
|
return toolResultToAgentMessage(toolCall, finalText, false);
|
|
549
444
|
}
|
|
550
445
|
catch (err) {
|
|
551
|
-
|
|
446
|
+
if (err instanceof TurnJournalCommitError)
|
|
447
|
+
throw err;
|
|
448
|
+
if (signal?.aborted) {
|
|
449
|
+
throw signal.reason instanceof Error ? signal.reason : new Error('Tool execution cancelled');
|
|
450
|
+
}
|
|
552
451
|
const message = err instanceof Error ? err.message : String(err);
|
|
553
452
|
const failure = `工具「${resolvedName}」执行失败:${message}`;
|
|
554
453
|
toolCalls.push({ tool: resolvedName, args: effectiveArgs, result: failure });
|
|
555
454
|
return toolResultToAgentMessage(toolCall, failure, true);
|
|
556
455
|
}
|
|
557
456
|
},
|
|
558
|
-
beforeToolCall: async ({ toolCall }) => {
|
|
559
|
-
host.emitter.emit('ai.tool.call', host.emitter.createPayload(sessionId, contextForTools, 'text', {
|
|
560
|
-
path: 'agent',
|
|
561
|
-
toolName: toolCall.name,
|
|
562
|
-
args: toolCall.arguments,
|
|
563
|
-
}));
|
|
564
|
-
return loopHooks?.runBeforeToolCall({ toolCall, sessionId });
|
|
565
|
-
},
|
|
457
|
+
beforeToolCall: async ({ toolCall }) => loopHooks?.runBeforeToolCall({ toolCall, sessionId }),
|
|
566
458
|
afterToolCall: async ({ toolCall, result }) => {
|
|
567
459
|
await loopHooks?.runAfterToolCall({ toolCall, result, sessionId });
|
|
568
460
|
},
|
|
@@ -583,6 +475,9 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
583
475
|
};
|
|
584
476
|
for await (const event of agentLoop(promptMessages, loopContext, loopConfig, signal)) {
|
|
585
477
|
for (const te of mapAgentEventToTurnEvents(event, mapperState)) {
|
|
478
|
+
if (input.toolEventSource === 'authority'
|
|
479
|
+
&& (te.type === 'tool_call' || te.type === 'tool_result'))
|
|
480
|
+
continue;
|
|
586
481
|
emitTurnEvent(te);
|
|
587
482
|
yield te;
|
|
588
483
|
}
|
|
@@ -617,7 +512,9 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
617
512
|
const userBatch = event.userMessages ?? promptMessages;
|
|
618
513
|
const batch = [...userBatch, ...event.messages];
|
|
619
514
|
const messageExtras = batch.map((msg, i) => (msg.role === 'user' && i < userBatch.length ? userMessageExtra : undefined));
|
|
620
|
-
|
|
515
|
+
if (persistentConversation) {
|
|
516
|
+
conversationBatches.push({ messages: batch, messageExtras });
|
|
517
|
+
}
|
|
621
518
|
}
|
|
622
519
|
}
|
|
623
520
|
if (signal?.aborted) {
|
|
@@ -634,6 +531,7 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
634
531
|
model: modelId,
|
|
635
532
|
toolCalls,
|
|
636
533
|
thinking,
|
|
534
|
+
projectConversation: () => appendConversationBatches(repo, sessionId, conversationBatches),
|
|
637
535
|
};
|
|
638
536
|
}
|
|
639
537
|
const reply = sanitizeAssistantReply(lastAssistantText, {
|
|
@@ -643,20 +541,13 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
643
541
|
if (spawnedSubagent) {
|
|
644
542
|
await host.getActiveTurnTracker()?.waitForPendingSubagents();
|
|
645
543
|
}
|
|
646
|
-
const delegatedOnly =
|
|
544
|
+
const delegatedOnly = shouldSuppressReplyForSpawnDelegation(toolCalls)
|
|
647
545
|
&& !toolCalls.some(tc => tc.tool === 'run_deferred_task')
|
|
648
546
|
&& !toolCalls.some(tc => tc.tool === 'generate_image'
|
|
649
547
|
&& tc.result
|
|
650
548
|
&& typeof tc.result === 'object'
|
|
651
549
|
&& typeof tc.result.image === 'string');
|
|
652
550
|
const finalReply = delegatedOnly ? '' : reply;
|
|
653
|
-
if (hasTools) {
|
|
654
|
-
await host.emitter.dispatch('ai.agent.finish', host.emitter.createPayload(sessionId, contextForTools, 'text', {
|
|
655
|
-
path: 'agent',
|
|
656
|
-
model: modelId,
|
|
657
|
-
iterations,
|
|
658
|
-
}));
|
|
659
|
-
}
|
|
660
551
|
logPhase(host.phaseConfig, 'agent_loop.turn.end', sessionId, {
|
|
661
552
|
iterations,
|
|
662
553
|
...tokenUsageLogFields(lastUsage),
|
|
@@ -674,6 +565,12 @@ export async function* runAgentLoopTextTurnRun(input) {
|
|
|
674
565
|
model: modelId,
|
|
675
566
|
toolCalls,
|
|
676
567
|
thinking,
|
|
568
|
+
projectConversation: () => appendConversationBatches(repo, sessionId, conversationBatches),
|
|
677
569
|
};
|
|
678
570
|
}
|
|
571
|
+
async function appendConversationBatches(repo, sessionId, batches) {
|
|
572
|
+
for (const batch of batches) {
|
|
573
|
+
await repo.appendMessages(sessionId, batch.messages, { messageExtras: batch.messageExtras });
|
|
574
|
+
}
|
|
575
|
+
}
|
|
679
576
|
//# sourceMappingURL=agent-core-run.js.map
|