@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
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { lookup } from 'node:dns/promises';
|
|
2
|
+
import * as http from 'node:http';
|
|
3
|
+
import * as https from 'node:https';
|
|
4
|
+
import { isIP } from 'node:net';
|
|
5
|
+
import { checkUrlNetworkAccess, isBlockedSsrfHostname, NetworkAccessDeniedError, } from './network-policy.js';
|
|
6
|
+
/** Turn-scoped network module: policy, DNS pinning, redirects, timeout, and body limits. */
|
|
7
|
+
export class TurnNetworkClient {
|
|
8
|
+
policy;
|
|
9
|
+
signal;
|
|
10
|
+
transport;
|
|
11
|
+
constructor(policy, signal, transport = new NodeNetworkTransport()) {
|
|
12
|
+
this.policy = policy;
|
|
13
|
+
this.signal = signal;
|
|
14
|
+
this.transport = transport;
|
|
15
|
+
}
|
|
16
|
+
async getText(url, options = {}) {
|
|
17
|
+
const maxRedirects = options.maxRedirects ?? 5;
|
|
18
|
+
const maxBytes = options.maxBytes ?? 2 * 1024 * 1024;
|
|
19
|
+
const timeoutMs = options.timeoutMs ?? 15_000;
|
|
20
|
+
const signal = AbortSignal.any([this.signal, AbortSignal.timeout(timeoutMs)]);
|
|
21
|
+
let current = url;
|
|
22
|
+
for (let redirect = 0; redirect <= maxRedirects; redirect += 1) {
|
|
23
|
+
signal.throwIfAborted();
|
|
24
|
+
const parsed = authorizeNetworkUrl(current, this.policy);
|
|
25
|
+
const response = await this.transport.request(parsed, options.headers ?? {}, signal, maxBytes);
|
|
26
|
+
if (response.status < 300 || response.status >= 400) {
|
|
27
|
+
return Object.freeze({ url: parsed.href, ...response });
|
|
28
|
+
}
|
|
29
|
+
const location = response.headers.location;
|
|
30
|
+
if (!location)
|
|
31
|
+
return Object.freeze({ url: parsed.href, ...response });
|
|
32
|
+
if (redirect === maxRedirects) {
|
|
33
|
+
throw new NetworkAccessDeniedError(`Network redirect limit exceeded (${maxRedirects})`);
|
|
34
|
+
}
|
|
35
|
+
current = new URL(location, parsed).href;
|
|
36
|
+
}
|
|
37
|
+
throw new NetworkAccessDeniedError('Network redirect state is invalid');
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
export class NodeNetworkTransport {
|
|
41
|
+
async request(url, headers, signal, maxBytes) {
|
|
42
|
+
const addresses = isIP(url.hostname)
|
|
43
|
+
? [{ address: url.hostname, family: isIP(url.hostname) }]
|
|
44
|
+
: await lookup(url.hostname, { all: true, verbatim: true });
|
|
45
|
+
if (addresses.length === 0)
|
|
46
|
+
throw new Error(`DNS returned no address for ${url.hostname}`);
|
|
47
|
+
for (const entry of addresses) {
|
|
48
|
+
if (isBlockedSsrfHostname(entry.address)) {
|
|
49
|
+
throw new NetworkAccessDeniedError(`DNS target ${entry.address} for ${url.hostname} is private or dangerous`);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
const selected = addresses[0];
|
|
53
|
+
return requestPinnedAddress(url, selected.address, headers, signal, maxBytes);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function authorizeNetworkUrl(url, policy) {
|
|
57
|
+
if (!policy.network.enabled) {
|
|
58
|
+
throw new NetworkAccessDeniedError('Turn has no network authority');
|
|
59
|
+
}
|
|
60
|
+
const decision = checkUrlNetworkAccess(url, {
|
|
61
|
+
httpsOnly: policy.network.httpsOnly,
|
|
62
|
+
allowedDomains: [...(policy.network.allowedDomains ?? [])],
|
|
63
|
+
});
|
|
64
|
+
if (!decision.allowed)
|
|
65
|
+
throw new NetworkAccessDeniedError(decision.reason ?? 'Network target denied');
|
|
66
|
+
return new URL(url);
|
|
67
|
+
}
|
|
68
|
+
function requestPinnedAddress(url, address, headers, signal, maxBytes) {
|
|
69
|
+
const requester = url.protocol === 'https:' ? https : http;
|
|
70
|
+
return new Promise((resolve, reject) => {
|
|
71
|
+
const request = requester.request({
|
|
72
|
+
protocol: url.protocol,
|
|
73
|
+
hostname: address,
|
|
74
|
+
port: url.port || undefined,
|
|
75
|
+
path: `${url.pathname}${url.search}`,
|
|
76
|
+
method: 'GET',
|
|
77
|
+
headers: { ...headers, Host: url.host, 'Accept-Encoding': 'identity' },
|
|
78
|
+
signal,
|
|
79
|
+
...(url.protocol === 'https:' && !isIP(url.hostname) ? { servername: url.hostname } : {}),
|
|
80
|
+
}, (response) => {
|
|
81
|
+
const chunks = [];
|
|
82
|
+
let size = 0;
|
|
83
|
+
response.on('data', (chunk) => {
|
|
84
|
+
const buffer = Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk);
|
|
85
|
+
size += buffer.length;
|
|
86
|
+
if (size > maxBytes) {
|
|
87
|
+
response.destroy(new Error(`Network response exceeds ${maxBytes} bytes`));
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
chunks.push(buffer);
|
|
91
|
+
});
|
|
92
|
+
response.once('error', reject);
|
|
93
|
+
response.once('end', () => resolve(Object.freeze({
|
|
94
|
+
status: response.statusCode ?? 0,
|
|
95
|
+
statusText: response.statusMessage ?? '',
|
|
96
|
+
headers: Object.freeze(normalizeHeaders(response.headers)),
|
|
97
|
+
body: Buffer.concat(chunks).toString('utf8'),
|
|
98
|
+
})));
|
|
99
|
+
});
|
|
100
|
+
request.once('error', reject);
|
|
101
|
+
request.end();
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
function normalizeHeaders(headers) {
|
|
105
|
+
return Object.fromEntries(Object.entries(headers).flatMap(([name, value]) => {
|
|
106
|
+
if (value === undefined)
|
|
107
|
+
return [];
|
|
108
|
+
return [[name.toLowerCase(), Array.isArray(value) ? value.join(', ') : value]];
|
|
109
|
+
}));
|
|
110
|
+
}
|
|
111
|
+
//# sourceMappingURL=turn-network-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"turn-network-client.js","sourceRoot":"","sources":["../../src/security/turn-network-client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAC3C,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,KAAK,KAAK,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,UAAU,CAAC;AAEhC,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,wBAAwB,GACzB,MAAM,qBAAqB,CAAC;AA0B7B,4FAA4F;AAC5F,MAAM,OAAO,iBAAiB;IAET;IACA;IACA;IAHnB,YACmB,MAA4B,EAC5B,MAAmB,EACnB,YAA8B,IAAI,oBAAoB,EAAE;QAFxD,WAAM,GAAN,MAAM,CAAsB;QAC5B,WAAM,GAAN,MAAM,CAAa;QACnB,cAAS,GAAT,SAAS,CAA+C;IACxE,CAAC;IAEJ,KAAK,CAAC,OAAO,CAAC,GAAW,EAAE,UAAiC,EAAE;QAC5D,MAAM,YAAY,GAAG,OAAO,CAAC,YAAY,IAAI,CA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E,CAAC;IAChB,CAAC,CAAC,CAAC;AACL,CAAC;AAED,SAAS,gBAAgB,CAAC,OAAiC;IACzD,OAAO,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;QAC1E,IAAI,KAAK,KAAK,SAAS;YAAE,OAAO,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,EAAE,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IACjF,CAAC,CAAC,CAAC,CAAC;AACN,CAAC"}
|
package/lib/service.d.ts
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* AIService — AI 服务核心类
|
|
3
3
|
* 统一管理多个模型提供商,提供会话和 Agent 能力
|
|
4
4
|
*/
|
|
5
|
-
import { type
|
|
6
|
-
import { type AIProvider, type AIConfig, type
|
|
5
|
+
import { type AITriggerConfig, type AIAccessConfig, type Tool } from '@zhin.js/core';
|
|
6
|
+
import { type AIProvider, type AIConfig, type AgentTool, type Usage, type ImageGenerationDefaults, type ModelRegistry, type ContextConfig } from '@zhin.js/ai';
|
|
7
7
|
import type { AgentRunInput } from './media/media-types.js';
|
|
8
8
|
import { type NormalizedAiRoutingConfig } from './config/normalize-ai-config.js';
|
|
9
9
|
import { AgentBindingRegistry } from './config/agent-binding-registry.js';
|
|
@@ -42,7 +42,6 @@ export declare class AIService {
|
|
|
42
42
|
private accessConfig;
|
|
43
43
|
private agentConfig;
|
|
44
44
|
private imageGenerationGlobal?;
|
|
45
|
-
private plugin?;
|
|
46
45
|
private customTools;
|
|
47
46
|
private _modelRegistry;
|
|
48
47
|
readonly loopHooks: PluginAILoopHookRegistry;
|
|
@@ -52,7 +51,6 @@ export declare class AIService {
|
|
|
52
51
|
/** 运行时合并 *.agent.md 发现结果 */
|
|
53
52
|
setDiscoveredAgents(fileMetas: import('./discovery/agents.js').AgentMeta[]): void;
|
|
54
53
|
isReady(): boolean;
|
|
55
|
-
setPlugin(plugin: Plugin): void;
|
|
56
54
|
setModelRegistry(registry: ModelRegistry): void;
|
|
57
55
|
getModelRegistry(): ModelRegistry | null;
|
|
58
56
|
registerTool(tool: AgentTool): () => void;
|
|
@@ -66,7 +64,7 @@ export declare class AIService {
|
|
|
66
64
|
* IM / ZhinAgent 流水线用的常驻 Tool 实例(未经 normalize;与 ToolFeature 工具合并后由 collectRelevantTools 绑定 context)。
|
|
67
65
|
*/
|
|
68
66
|
getResidentToolsAsTools(): Tool[];
|
|
69
|
-
/**
|
|
67
|
+
/** Standalone service tools only; turn-owned interaction is projected by AgentRuntime. */
|
|
70
68
|
private refreshBuiltinAgentTools;
|
|
71
69
|
getContextConfig(): ContextConfig;
|
|
72
70
|
getTriggerConfig(): AITriggerConfig;
|
|
@@ -90,14 +88,6 @@ export declare class AIService {
|
|
|
90
88
|
provider: string;
|
|
91
89
|
models: string[];
|
|
92
90
|
}[]>;
|
|
93
|
-
chat(request: ChatCompletionRequest, providerName?: string): Promise<ChatCompletionResponse>;
|
|
94
|
-
chatStream(request: ChatCompletionRequest, providerName?: string): AsyncIterable<ChatCompletionChunk>;
|
|
95
|
-
ask(question: string, options?: {
|
|
96
|
-
provider?: string;
|
|
97
|
-
model?: string;
|
|
98
|
-
systemPrompt?: string;
|
|
99
|
-
temperature?: number;
|
|
100
|
-
}): Promise<string>;
|
|
101
91
|
private resolveServiceAgentTools;
|
|
102
92
|
createAgent(options?: CreateServiceAgentOptions): ServiceAgent;
|
|
103
93
|
runAgent(task: AgentRunInput, options?: CreateServiceAgentOptions): Promise<ServiceAgentResult>;
|
package/lib/service.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.d.ts","sourceRoot":"","sources":["../src/service.ts"],"names":[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eTool } from './orchestrator/tool-selection.js';
|
|
9
9
|
import { createWebSearchTool } from './builtin/web-search-tool.js';
|
|
10
|
-
import { createAskUserTool } from './builtin/ask-user-tool.js';
|
|
11
10
|
import { registerProviderInstances } from './config/provider-instance.js';
|
|
12
11
|
import { normalizeAiRoutingConfig } from './config/normalize-ai-config.js';
|
|
13
12
|
import { validateAiRoutingConfig } from './config/validate-ai-config.js';
|
|
@@ -26,7 +25,6 @@ export class AIService {
|
|
|
26
25
|
accessConfig;
|
|
27
26
|
agentConfig;
|
|
28
27
|
imageGenerationGlobal;
|
|
29
|
-
plugin;
|
|
30
28
|
customTools = new Map();
|
|
31
29
|
_modelRegistry = null;
|
|
32
30
|
loopHooks = new PluginAILoopHookRegistry();
|
|
@@ -64,10 +62,6 @@ export class AIService {
|
|
|
64
62
|
isReady() {
|
|
65
63
|
return this.providers.size > 0;
|
|
66
64
|
}
|
|
67
|
-
setPlugin(plugin) {
|
|
68
|
-
this.plugin = plugin;
|
|
69
|
-
this.refreshBuiltinAgentTools();
|
|
70
|
-
}
|
|
71
65
|
setModelRegistry(registry) { this._modelRegistry = registry; }
|
|
72
66
|
getModelRegistry() { return this._modelRegistry; }
|
|
73
67
|
registerTool(tool) { this.customTools.set(tool.name, tool); return () => { this.customTools.delete(tool.name); }; }
|
|
@@ -90,17 +84,11 @@ export class AIService {
|
|
|
90
84
|
* IM / ZhinAgent 流水线用的常驻 Tool 实例(未经 normalize;与 ToolFeature 工具合并后由 collectRelevantTools 绑定 context)。
|
|
91
85
|
*/
|
|
92
86
|
getResidentToolsAsTools() {
|
|
93
|
-
|
|
94
|
-
if (this.plugin)
|
|
95
|
-
tools.push(createAskUserTool(this.plugin));
|
|
96
|
-
return tools;
|
|
87
|
+
return [createWebSearchTool()];
|
|
97
88
|
}
|
|
98
|
-
/**
|
|
89
|
+
/** Standalone service tools only; turn-owned interaction is projected by AgentRuntime. */
|
|
99
90
|
refreshBuiltinAgentTools() {
|
|
100
|
-
|
|
101
|
-
if (this.plugin)
|
|
102
|
-
next.push(normalizeTool(createAskUserTool(this.plugin)));
|
|
103
|
-
this.builtinTools = next;
|
|
91
|
+
this.builtinTools = [normalizeTool(createWebSearchTool())];
|
|
104
92
|
}
|
|
105
93
|
getContextConfig() { return this.contextConfig; }
|
|
106
94
|
getTriggerConfig() { return this.triggerConfig; }
|
|
@@ -155,26 +143,6 @@ export class AIService {
|
|
|
155
143
|
}
|
|
156
144
|
return result;
|
|
157
145
|
}
|
|
158
|
-
async chat(request, providerName) {
|
|
159
|
-
return this.getProvider(providerName).chat(request);
|
|
160
|
-
}
|
|
161
|
-
async *chatStream(request, providerName) {
|
|
162
|
-
yield* this.getProvider(providerName).chatStream(request);
|
|
163
|
-
}
|
|
164
|
-
async ask(question, options = {}) {
|
|
165
|
-
const messages = [];
|
|
166
|
-
if (options.systemPrompt)
|
|
167
|
-
messages.push({ role: 'system', content: options.systemPrompt });
|
|
168
|
-
messages.push({ role: 'user', content: question });
|
|
169
|
-
const provider = this.getProvider(options.provider);
|
|
170
|
-
const response = await provider.chat({
|
|
171
|
-
model: options.model || provider.models[0],
|
|
172
|
-
messages,
|
|
173
|
-
temperature: options.temperature,
|
|
174
|
-
});
|
|
175
|
-
const content = response.choices[0]?.message?.content;
|
|
176
|
-
return typeof content === 'string' ? content : '';
|
|
177
|
-
}
|
|
178
146
|
resolveServiceAgentTools(options) {
|
|
179
147
|
const tools = [];
|
|
180
148
|
if (options.useBuiltinTools !== false)
|
package/lib/service.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"service.js","sourceRoot":"","sources":["../src/service.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAA6C,sBAAsB,EAAa,MAAM,eAAe,CAAC;AAC7G,OAAO,EAAoI,2BAA2B,EAAE,MAAM,aAAa,CAAC;A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,oBAAoB,CAAC,MAAiC;IAC7D,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO;QACvB,SAAS,EAAE,MAAM,CAAC,SAAS;QAC3B,KAAK,EAAE,MAAM,CAAC,KAAK;QACnB,UAAU,EAAE,MAAM,CAAC,UAAU;QAC7B,KAAK,EAAE,MAAM,CAAC,KAAK;KACpB,CAAC;AACJ,CAAC"}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ApprovalPort — blocking HITL only (ADR 0041).
|
|
3
|
-
* Stream events publish via AgentStreamBus separately.
|
|
4
|
-
*/
|
|
1
|
+
/** Blocking human-in-the-loop security authority. */
|
|
5
2
|
export interface ApprovalRequestInput {
|
|
6
3
|
requestId: string;
|
|
7
4
|
toolName: string;
|
|
8
5
|
question: string;
|
|
9
6
|
timeoutMs?: number;
|
|
7
|
+
/** The adapter must settle promptly and deny when the owning Turn is cancelled. */
|
|
8
|
+
signal: AbortSignal;
|
|
10
9
|
}
|
|
11
10
|
export interface ApprovalPort {
|
|
12
11
|
/** False means this transport cannot make an approval decision for this turn. */
|
|
@@ -14,7 +13,5 @@ export interface ApprovalPort {
|
|
|
14
13
|
requestApproval(input: ApprovalRequestInput): Promise<boolean>;
|
|
15
14
|
resolveApproval?(requestId: string, approved: boolean): boolean;
|
|
16
15
|
}
|
|
17
|
-
/** @deprecated Use ApprovalPort. Kept for existing IM/HTTP adapters. */
|
|
18
|
-
export type SessionInteractionPort = ApprovalPort;
|
|
19
16
|
export declare function isApprovalPortAvailable(port: ApprovalPort | undefined): port is ApprovalPort;
|
|
20
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=approval-port.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-port.d.ts","sourceRoot":"","sources":["../../src/session/approval-port.ts"],"names":[],"mappings":"AAAA,qDAAqD;AACrD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mFAAmF;IACnF,MAAM,EAAE,WAAW,CAAC;CACrB;AAED,MAAM,WAAW,YAAY;IAC3B,iFAAiF;IACjF,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;IAC/D,eAAe,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;CACjE;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,YAAY,GAAG,SAAS,GAAG,IAAI,IAAI,YAAY,CAE5F"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"approval-port.js","sourceRoot":"","sources":["../../src/session/approval-port.ts"],"names":[],"mappings":"AAiBA,MAAM,UAAU,uBAAuB,CAAC,IAA8B;IACpE,OAAO,OAAO,CAAC,IAAI,IAAI,IAAI,CAAC,SAAS,KAAK,KAAK,CAAC,CAAC;AACnD,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* HTTP approval park adapter — instance-scoped waiter (ADR 0041).
|
|
3
3
|
*/
|
|
4
4
|
import { HttpApprovalWaiter } from './http-approval-waiter.js';
|
|
5
|
-
import type {
|
|
6
|
-
export declare class HttpApprovalAdapter implements
|
|
5
|
+
import type { ApprovalPort, ApprovalRequestInput } from './approval-port.js';
|
|
6
|
+
export declare class HttpApprovalAdapter implements ApprovalPort {
|
|
7
7
|
readonly waiter: HttpApprovalWaiter;
|
|
8
8
|
requestApproval(input: ApprovalRequestInput): Promise<boolean>;
|
|
9
9
|
resolveApproval(requestId: string, approved: boolean): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-approval-adapter.d.ts","sourceRoot":"","sources":["../../src/session/http-approval-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"http-approval-adapter.d.ts","sourceRoot":"","sources":["../../src/session/http-approval-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,qBAAa,mBAAoB,YAAW,YAAY;IACtD,QAAQ,CAAC,MAAM,qBAA4B;IAErC,eAAe,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQpE,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;CAG/D"}
|
|
@@ -6,7 +6,7 @@ export class HttpApprovalAdapter {
|
|
|
6
6
|
waiter = new HttpApprovalWaiter();
|
|
7
7
|
async requestApproval(input) {
|
|
8
8
|
try {
|
|
9
|
-
return await this.waiter.wait(input.requestId, input.timeoutMs ?? 300_000);
|
|
9
|
+
return await this.waiter.wait(input.requestId, input.timeoutMs ?? 300_000, input.signal);
|
|
10
10
|
}
|
|
11
11
|
catch {
|
|
12
12
|
return false;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-approval-adapter.js","sourceRoot":"","sources":["../../src/session/http-approval-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,MAAM,OAAO,mBAAmB;IACrB,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAE3C,KAAK,CAAC,eAAe,CAAC,KAA2B;QAC/C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,OAAO,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"http-approval-adapter.js","sourceRoot":"","sources":["../../src/session/http-approval-adapter.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,MAAM,OAAO,mBAAmB;IACrB,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;IAE3C,KAAK,CAAC,eAAe,CAAC,KAA2B;QAC/C,IAAI,CAAC;YACH,OAAO,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,IAAI,OAAO,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3F,CAAC;QAAC,MAAM,CAAC;YACP,OAAO,KAAK,CAAC;QACf,CAAC;IACH,CAAC;IAED,eAAe,CAAC,SAAiB,EAAE,QAAiB;QAClD,OAAO,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAClD,CAAC;CACF"}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export declare class HttpApprovalWaiter {
|
|
5
5
|
private readonly pending;
|
|
6
|
-
wait(requestId: string, timeoutMs?: number): Promise<boolean>;
|
|
6
|
+
wait(requestId: string, timeoutMs?: number, signal?: AbortSignal): Promise<boolean>;
|
|
7
7
|
resolve(requestId: string, approved: boolean): boolean;
|
|
8
8
|
has(requestId: string): boolean;
|
|
9
9
|
dispose(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-approval-waiter.d.ts","sourceRoot":"","sources":["../../src/session/http-approval-waiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,SAAU,GAAG,OAAO,CAAC,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"http-approval-waiter.d.ts","sourceRoot":"","sources":["../../src/session/http-approval-waiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,qBAAa,kBAAkB;IAC7B,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAE1D,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,SAAU,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC;IAiCpF,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO;IAStD,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAI/B,OAAO,IAAI,IAAI;CAOhB"}
|
|
@@ -3,16 +3,39 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export class HttpApprovalWaiter {
|
|
5
5
|
pending = new Map();
|
|
6
|
-
wait(requestId, timeoutMs = 300_000) {
|
|
6
|
+
wait(requestId, timeoutMs = 300_000, signal) {
|
|
7
7
|
if (this.pending.has(requestId)) {
|
|
8
8
|
return Promise.reject(new Error(`Duplicate approval request: ${requestId}`));
|
|
9
9
|
}
|
|
10
10
|
return new Promise((resolve, reject) => {
|
|
11
|
+
const onAbort = () => {
|
|
12
|
+
const entry = this.pending.get(requestId);
|
|
13
|
+
if (!entry)
|
|
14
|
+
return;
|
|
15
|
+
clearTimeout(entry.timer);
|
|
16
|
+
this.pending.delete(requestId);
|
|
17
|
+
reject(signal?.reason instanceof Error ? signal.reason : new Error('Approval cancelled'));
|
|
18
|
+
};
|
|
11
19
|
const timer = setTimeout(() => {
|
|
20
|
+
signal?.removeEventListener('abort', onAbort);
|
|
12
21
|
this.pending.delete(requestId);
|
|
13
22
|
reject(new Error(`Approval timed out: ${requestId}`));
|
|
14
23
|
}, timeoutMs);
|
|
15
|
-
this.pending.set(requestId, {
|
|
24
|
+
this.pending.set(requestId, {
|
|
25
|
+
resolve: (approved) => {
|
|
26
|
+
signal?.removeEventListener('abort', onAbort);
|
|
27
|
+
resolve(approved);
|
|
28
|
+
},
|
|
29
|
+
reject: (error) => {
|
|
30
|
+
signal?.removeEventListener('abort', onAbort);
|
|
31
|
+
reject(error);
|
|
32
|
+
},
|
|
33
|
+
timer,
|
|
34
|
+
});
|
|
35
|
+
if (signal?.aborted)
|
|
36
|
+
onAbort();
|
|
37
|
+
else
|
|
38
|
+
signal?.addEventListener('abort', onAbort, { once: true });
|
|
16
39
|
});
|
|
17
40
|
}
|
|
18
41
|
resolve(requestId, approved) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"http-approval-waiter.js","sourceRoot":"","sources":["../../src/session/http-approval-waiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,OAAO,kBAAkB;IACZ,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE1D,IAAI,CAAC,SAAiB,EAAE,SAAS,GAAG,OAAO;
|
|
1
|
+
{"version":3,"file":"http-approval-waiter.js","sourceRoot":"","sources":["../../src/session/http-approval-waiter.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,OAAO,kBAAkB;IACZ,OAAO,GAAG,IAAI,GAAG,EAAuB,CAAC;IAE1D,IAAI,CAAC,SAAiB,EAAE,SAAS,GAAG,OAAO,EAAE,MAAoB;QAC/D,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,EAAE,CAAC;YAChC,OAAO,OAAO,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,SAAS,EAAE,CAAC,CAAC,CAAC;QAC/E,CAAC;QACD,OAAO,IAAI,OAAO,CAAU,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;YAC9C,MAAM,OAAO,GAAG,GAAG,EAAE;gBACnB,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;gBAC1C,IAAI,CAAC,KAAK;oBAAE,OAAO;gBACnB,YAAY,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C,GAAG,CAAC,SAAS,CAAC,CAAC;QAC1C,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QACzB,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAC/B,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QACxB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,GAAG,CAAC,SAAiB;QACnB,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACrC,CAAC;IAED,OAAO;QACL,KAAK,MAAM,CAAC,EAAE,KAAK,CAAC,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACrC,YAAY,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;YAC1B,KAAK,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC,CAAC;QACzD,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;IACvB,CAAC;CACF"}
|
package/lib/session/index.d.ts
CHANGED
|
@@ -3,15 +3,18 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export type { Session, CreateSessionInput, SessionStore, SessionStrategy, SessionSystemConfig, } from './contracts.js';
|
|
5
5
|
export type { SessionIODeps } from './session-io.js';
|
|
6
|
-
export type { TurnSessionPrep } from './session-system.js';
|
|
6
|
+
export type { IngressTurnSessionPrep, TurnSessionPrep } from './session-system.js';
|
|
7
7
|
export { SessionSystem, createSessionSystem } from './session-system.js';
|
|
8
8
|
export { CollaborationSessionStrategy, SimpleSessionStrategy, } from './strategies.js';
|
|
9
|
-
export { buildUserMessageExtra, prepareUserContentForSession, layerInboundUserTurnBody, resolveTurnUserMessage, formatUserContentForSession,
|
|
9
|
+
export { buildUserMessageExtra, prepareUserContentForSession, layerInboundUserTurnBody, resolveTurnUserMessage, formatUserContentForSession, buildAgentSessionCreateInput, buildImTranscriptQuery, buildHistoryMessagesFromContext, resolveSessionIsNewBeforeCreate, beginTurnSession, touchSession, archiveSessionByKey, } from './session-io.js';
|
|
10
10
|
export { resolveAgentTurnSessionKey, resolveAgentSessionKeyForTurn, resolveArtifactRunId, } from '../collaboration/resolve-agent-session-key.js';
|
|
11
|
-
export {
|
|
11
|
+
export { recordPassiveGroupObservation, consumePassiveGroupContextForTurn, } from './passive-group-session.js';
|
|
12
|
+
export type { PassiveGroupObservation } from './passive-group-session.js';
|
|
12
13
|
export { pushPassiveGroupLine, drainPassiveGroupBuffer, peekPassiveGroupBuffer, formatPassiveGroupContextBlock, prunePassiveLines, MAX_PASSIVE_LINES, PASSIVE_TTL_MS, } from './passive-group-buffer.js';
|
|
13
14
|
export type { PassiveGroupLine } from './passive-group-buffer.js';
|
|
14
15
|
export { listSessionTreeForCommMessage, jumpSessionTreeForCommMessage, } from './session-tree-commands.js';
|
|
15
16
|
export { summarizeAbandonedBranchIfNeeded, } from './branch-summarization-runtime.js';
|
|
16
17
|
export type { BranchSummarizationOptions } from './branch-summarization-runtime.js';
|
|
18
|
+
export { beginIngressTurnSession, buildTurnSessionCreateInput, buildTurnTranscriptQuery, layerIngressUserBody, resolveIngressUserMessage, } from './turn-ingress-session.js';
|
|
19
|
+
export type { ResolvedIngressUserMessage } from './turn-ingress-session.js';
|
|
17
20
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EACV,OAAO,EACP,kBAAkB,EAClB,YAAY,EACZ,eAAe,EACf,mBAAmB,GACpB,MAAM,gBAAgB,CAAC;AAExB,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/session/index.ts"],"names":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B,yBAAyB,GAC1B,MAAM,2BAA2B,CAAC;AACnC,YAAY,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC"}
|
package/lib/session/index.js
CHANGED
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export { SessionSystem, createSessionSystem } from './session-system.js';
|
|
5
5
|
export { CollaborationSessionStrategy, SimpleSessionStrategy, } from './strategies.js';
|
|
6
|
-
export { buildUserMessageExtra, prepareUserContentForSession, layerInboundUserTurnBody, resolveTurnUserMessage, formatUserContentForSession,
|
|
6
|
+
export { buildUserMessageExtra, prepareUserContentForSession, layerInboundUserTurnBody, resolveTurnUserMessage, formatUserContentForSession, buildAgentSessionCreateInput, buildImTranscriptQuery, buildHistoryMessagesFromContext, resolveSessionIsNewBeforeCreate, beginTurnSession, touchSession, archiveSessionByKey, } from './session-io.js';
|
|
7
7
|
export { resolveAgentTurnSessionKey, resolveAgentSessionKeyForTurn, resolveArtifactRunId, } from '../collaboration/resolve-agent-session-key.js';
|
|
8
|
-
export {
|
|
8
|
+
export { recordPassiveGroupObservation, consumePassiveGroupContextForTurn, } from './passive-group-session.js';
|
|
9
9
|
export { pushPassiveGroupLine, drainPassiveGroupBuffer, peekPassiveGroupBuffer, formatPassiveGroupContextBlock, prunePassiveLines, MAX_PASSIVE_LINES, PASSIVE_TTL_MS, } from './passive-group-buffer.js';
|
|
10
10
|
export { listSessionTreeForCommMessage, jumpSessionTreeForCommMessage, } from './session-tree-commands.js';
|
|
11
11
|
export { summarizeAbandonedBranchIfNeeded, } from './branch-summarization-runtime.js';
|
|
12
|
+
export { beginIngressTurnSession, buildTurnSessionCreateInput, buildTurnTranscriptQuery, layerIngressUserBody, resolveIngressUserMessage, } from './turn-ingress-session.js';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/lib/session/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/session/index.ts"],"names":[],"mappings":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
1
|
-
/**
|
|
2
|
-
* 群/频道 Passive Group 上下文 — session key SSOT + buffer record/drain。
|
|
3
|
-
*/
|
|
4
|
-
import type { Message } from '@zhin.js/core';
|
|
5
|
-
import type { CollaborationScene } from '../collaboration/types.js';
|
|
6
1
|
import type { ZhinAgentPrivate } from '../internal/agent-host.js';
|
|
7
|
-
export
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
2
|
+
export interface PassiveGroupObservation {
|
|
3
|
+
readonly sessionKey: string;
|
|
4
|
+
readonly senderId: string;
|
|
5
|
+
readonly senderName: string;
|
|
6
|
+
readonly text: string;
|
|
7
|
+
}
|
|
8
|
+
export declare function recordPassiveGroupObservation(agent: Pick<ZhinAgentPrivate, 'agentSessionStore'>, observation: PassiveGroupObservation): Promise<void>;
|
|
9
|
+
export declare function consumePassiveGroupContextForTurn(sessionKey: string): string | null;
|
|
12
10
|
//# sourceMappingURL=passive-group-session.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"passive-group-session.d.ts","sourceRoot":"","sources":["../../src/session/passive-group-session.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"passive-group-session.d.ts","sourceRoot":"","sources":["../../src/session/passive-group-session.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,2BAA2B,CAAC;AAElE,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACvB;AAED,wBAAsB,6BAA6B,CACjD,KAAK,EAAE,IAAI,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,EAClD,WAAW,EAAE,uBAAuB,GACnC,OAAO,CAAC,IAAI,CAAC,CAaf;AAED,wBAAgB,iCAAiC,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAInF"}
|
|
@@ -1,36 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Passive group context is keyed by the canonical Agent session identity.
|
|
3
|
+
* IM and collaboration adapters resolve that identity before entering here.
|
|
4
|
+
*/
|
|
5
|
+
import { buildAgentSessionCreateInput } from './session-io.js';
|
|
3
6
|
import { drainPassiveGroupBuffer, formatPassiveGroupContextBlock, pushPassiveGroupLine, } from './passive-group-buffer.js';
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
export function resolvePassiveGroupSessionKey(message, cell) {
|
|
12
|
-
return resolveAgentTurnSessionKey(message, cell);
|
|
13
|
-
}
|
|
14
|
-
export async function recordPassiveGroupMessage(agent, message, rawText, cell) {
|
|
15
|
-
const { content } = prepareUserContentForSession(message, rawText);
|
|
16
|
-
if (!content.trim())
|
|
7
|
+
export async function recordPassiveGroupObservation(agent, observation) {
|
|
8
|
+
const sessionKey = observation.sessionKey.trim();
|
|
9
|
+
const text = observation.text.trim();
|
|
10
|
+
if (!sessionKey)
|
|
11
|
+
throw new TypeError('Passive group observation requires a session key');
|
|
12
|
+
if (!text)
|
|
17
13
|
return;
|
|
18
|
-
|
|
19
|
-
const sessionInput = buildSessionCreateInput(sessionKey, message);
|
|
20
|
-
await agent.agentSessionStore.getOrCreateActive(sessionInput);
|
|
14
|
+
await agent.agentSessionStore.getOrCreateActive(buildAgentSessionCreateInput(sessionKey));
|
|
21
15
|
pushPassiveGroupLine(sessionKey, {
|
|
22
|
-
senderId:
|
|
23
|
-
senderName:
|
|
24
|
-
text
|
|
16
|
+
senderId: normalizeIdentity(observation.senderId),
|
|
17
|
+
senderName: normalizeIdentity(observation.senderName),
|
|
18
|
+
text,
|
|
25
19
|
at: Date.now(),
|
|
26
20
|
});
|
|
27
21
|
}
|
|
28
|
-
export function consumePassiveGroupContextForTurn(
|
|
29
|
-
const
|
|
30
|
-
|
|
22
|
+
export function consumePassiveGroupContextForTurn(sessionKey) {
|
|
23
|
+
const key = sessionKey.trim();
|
|
24
|
+
if (!key)
|
|
25
|
+
throw new TypeError('Passive group context requires a session key');
|
|
26
|
+
return formatPassiveGroupContextBlock(drainPassiveGroupBuffer(key));
|
|
31
27
|
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
28
|
+
function normalizeIdentity(value) {
|
|
29
|
+
const normalized = value.trim().replace(/[\]\s]+/g, '_');
|
|
30
|
+
return normalized ? normalized.slice(0, 64) : 'unknown';
|
|
35
31
|
}
|
|
36
32
|
//# sourceMappingURL=passive-group-session.js.map
|