@zhin.js/agent 1.1.3 → 1.1.6
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 +2 -3
- package/lib/bootstrap.d.ts.map +1 -1
- package/lib/bootstrap.js +1 -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 +14 -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 +11 -0
- package/lib/config/zhin-agent-defaults.js.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/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/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 -35
- package/lib/init/configure-zhin-agent.d.ts.map +1 -1
- package/lib/init/configure-zhin-agent.js +1 -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 +12 -30
- 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 +58 -64
- 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 -12
- package/lib/media/media-normalize.d.ts.map +1 -1
- package/lib/media/media-normalize.js +0 -71
- 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 +54 -26
- package/lib/prompt/assembly.js.map +1 -1
- 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.map +1 -1
- package/lib/prompt/model-aware-builder.js +13 -14
- package/lib/prompt/model-aware-builder.js.map +1 -1
- package/lib/prompt/model-prompt-strategy.d.ts.map +1 -1
- package/lib/prompt/model-prompt-strategy.js +79 -0
- package/lib/prompt/model-prompt-strategy.js.map +1 -1
- package/lib/prompt/rules/critical-rules.d.ts.map +1 -1
- package/lib/prompt/rules/critical-rules.js +10 -12
- package/lib/prompt/rules/critical-rules.js.map +1 -1
- package/lib/prompt/system-prompt.d.ts +4 -23
- package/lib/prompt/system-prompt.d.ts.map +1 -1
- package/lib/prompt/system-prompt.js +22 -348
- 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 +16 -1
- package/lib/session/session-system.d.ts.map +1 -1
- package/lib/session/session-system.js +38 -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/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 +5 -4
- 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 +57 -42
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +32 -46
- package/lib/zhin-agent/index.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
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ask_user 常驻会话服务 — 单轨 middleware、排队、命令 bypass、Prompt/私聊统一。
|
|
3
|
-
*/
|
|
4
|
-
import { type Adapter, type Message, type Plugin } from '@zhin.js/core';
|
|
5
|
-
export type AskUserSessionKind = 'prompt' | 'sensitive_dm';
|
|
6
|
-
export interface AskUserOpenSpec {
|
|
7
|
-
sessionId: string;
|
|
8
|
-
kind: AskUserSessionKind;
|
|
9
|
-
message: Message;
|
|
10
|
-
questionType: string;
|
|
11
|
-
args: Record<string, unknown>;
|
|
12
|
-
timeoutMs: number;
|
|
13
|
-
botMaster?: string;
|
|
14
|
-
adapter?: Adapter;
|
|
15
|
-
groupOrigin?: Message;
|
|
16
|
-
}
|
|
17
|
-
export declare class AskUserSessionService {
|
|
18
|
-
private readonly plugin;
|
|
19
|
-
private readonly ownerQueues;
|
|
20
|
-
private readonly promptWaits;
|
|
21
|
-
private readonly disposeMiddleware;
|
|
22
|
-
constructor(plugin: Plugin);
|
|
23
|
-
static install(plugin: Plugin): AskUserSessionService;
|
|
24
|
-
static resetForTests(): void;
|
|
25
|
-
static get(): AskUserSessionService | undefined;
|
|
26
|
-
matchInbound(message: Message, root?: Plugin): 'consume' | 'bypass' | 'ignore';
|
|
27
|
-
isPendingReply(message: Message, root?: Plugin): boolean;
|
|
28
|
-
open(spec: AskUserOpenSpec): Promise<string>;
|
|
29
|
-
private hasPendingForMessage;
|
|
30
|
-
private tryMatchPrompt;
|
|
31
|
-
private tryMatchSensitiveDm;
|
|
32
|
-
private openPrompt;
|
|
33
|
-
private openSensitiveDm;
|
|
34
|
-
private sendSensitiveQuestion;
|
|
35
|
-
private timeoutFallback;
|
|
36
|
-
private finishOwnerEntry;
|
|
37
|
-
private resolveEndpointMaster;
|
|
38
|
-
private middleware;
|
|
39
|
-
}
|
|
40
|
-
//# sourceMappingURL=ask-user-session-service.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-session-service.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-session-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EAEL,KAAK,OAAO,EACZ,KAAK,OAAO,EAEZ,KAAK,MAAM,EAEZ,MAAM,eAAe,CAAC;AAQvB,MAAM,MAAM,kBAAkB,GAAG,QAAQ,GAAG,cAAc,CAAC;AAE3D,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,kBAAkB,CAAC;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AA4BD,qBAAa,qBAAqB;IAKpB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAiC;IAC7D,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAmC;IAC/D,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAAa;gBAElB,MAAM,EAAE,MAAM;IAI3C,MAAM,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB;IAOrD,MAAM,CAAC,aAAa,IAAI,IAAI;IAI5B,MAAM,CAAC,GAAG,IAAI,qBAAqB,GAAG,SAAS;IAI/C,YAAY,CACV,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,SAAS,GAAG,QAAQ,GAAG,QAAQ;IASlC,cAAc,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO;IAIlD,IAAI,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,MAAM,CAAC;IAOlD,OAAO,CAAC,oBAAoB;IAgB5B,OAAO,CAAC,cAAc;IAItB,OAAO,CAAC,mBAAmB;YAcb,UAAU;IA0DxB,OAAO,CAAC,eAAe;YA4BT,qBAAqB;IAgCnC,OAAO,CAAC,eAAe;IAKvB,OAAO,CAAC,gBAAgB;IAoBxB,OAAO,CAAC,qBAAqB;IAkB7B,OAAO,CAAC,UAAU,CAkChB;CACH"}
|
|
@@ -1,258 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ask_user 常驻会话服务 — 单轨 middleware、排队、命令 bypass、Prompt/私聊统一。
|
|
3
|
-
*/
|
|
4
|
-
import { Prompt, } from '@zhin.js/core';
|
|
5
|
-
import { errMsg } from '../discovery/utils.js';
|
|
6
|
-
import { notifyGroupOwnerAskUserResolved, buildGroupAskUserFollowUp } from '../collaboration/ask-user-bridge.js';
|
|
7
|
-
import { buildSensitiveOwnerQuestionText, formatOwnerResponse, } from './ask-user-tool.js';
|
|
8
|
-
function ownerKey(endpointId, masterId) {
|
|
9
|
-
return `${endpointId}:${masterId}`;
|
|
10
|
-
}
|
|
11
|
-
function promptKey(message) {
|
|
12
|
-
return `${message.$adapter}-${message.$endpoint}-${message.$channel?.type}:${message.$channel?.id}-${message.$sender?.id}`;
|
|
13
|
-
}
|
|
14
|
-
function isSlashCommand(message) {
|
|
15
|
-
const raw = String(message.$raw ?? '').trim();
|
|
16
|
-
return raw.startsWith('/');
|
|
17
|
-
}
|
|
18
|
-
let serviceInstance;
|
|
19
|
-
export class AskUserSessionService {
|
|
20
|
-
plugin;
|
|
21
|
-
ownerQueues = new Map();
|
|
22
|
-
promptWaits = new Map();
|
|
23
|
-
disposeMiddleware;
|
|
24
|
-
constructor(plugin) {
|
|
25
|
-
this.plugin = plugin;
|
|
26
|
-
this.disposeMiddleware = (plugin.root ?? plugin).addMiddleware(this.middleware.bind(this));
|
|
27
|
-
}
|
|
28
|
-
static install(plugin) {
|
|
29
|
-
if (!serviceInstance) {
|
|
30
|
-
serviceInstance = new AskUserSessionService(plugin);
|
|
31
|
-
}
|
|
32
|
-
return serviceInstance;
|
|
33
|
-
}
|
|
34
|
-
static resetForTests() {
|
|
35
|
-
serviceInstance = undefined;
|
|
36
|
-
}
|
|
37
|
-
static get() {
|
|
38
|
-
return serviceInstance;
|
|
39
|
-
}
|
|
40
|
-
matchInbound(message, root) {
|
|
41
|
-
if (isSlashCommand(message) && this.hasPendingForMessage(message, root)) {
|
|
42
|
-
return 'bypass';
|
|
43
|
-
}
|
|
44
|
-
if (this.tryMatchPrompt(message))
|
|
45
|
-
return 'consume';
|
|
46
|
-
if (this.tryMatchSensitiveDm(message, root))
|
|
47
|
-
return 'consume';
|
|
48
|
-
return 'ignore';
|
|
49
|
-
}
|
|
50
|
-
isPendingReply(message, root) {
|
|
51
|
-
return this.matchInbound(message, root) === 'consume';
|
|
52
|
-
}
|
|
53
|
-
async open(spec) {
|
|
54
|
-
if (spec.kind === 'prompt') {
|
|
55
|
-
return this.openPrompt(spec);
|
|
56
|
-
}
|
|
57
|
-
return this.openSensitiveDm(spec);
|
|
58
|
-
}
|
|
59
|
-
hasPendingForMessage(message, root) {
|
|
60
|
-
if (this.promptWaits.has(promptKey(message)))
|
|
61
|
-
return true;
|
|
62
|
-
const endpointId = String(message.$endpoint ?? '');
|
|
63
|
-
const senderId = String(message.$sender?.id ?? '');
|
|
64
|
-
if (endpointId && senderId) {
|
|
65
|
-
const direct = this.ownerQueues.get(ownerKey(endpointId, senderId));
|
|
66
|
-
if (direct?.active || direct?.waiting.length)
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
const ids = this.resolveEndpointMaster(message, root);
|
|
70
|
-
if (!ids)
|
|
71
|
-
return false;
|
|
72
|
-
const queue = this.ownerQueues.get(ownerKey(ids.endpointId, ids.masterId));
|
|
73
|
-
return Boolean(queue?.active || queue?.waiting.length);
|
|
74
|
-
}
|
|
75
|
-
tryMatchPrompt(message) {
|
|
76
|
-
return this.promptWaits.has(promptKey(message));
|
|
77
|
-
}
|
|
78
|
-
tryMatchSensitiveDm(message, root) {
|
|
79
|
-
if (message.$channel?.type !== 'private')
|
|
80
|
-
return false;
|
|
81
|
-
const senderId = String(message.$sender?.id ?? '');
|
|
82
|
-
const endpointId = String(message.$endpoint ?? '');
|
|
83
|
-
if (!senderId || !endpointId)
|
|
84
|
-
return false;
|
|
85
|
-
const direct = this.ownerQueues.get(ownerKey(endpointId, senderId));
|
|
86
|
-
if (direct?.active)
|
|
87
|
-
return true;
|
|
88
|
-
const ids = this.resolveEndpointMaster(message, root);
|
|
89
|
-
if (!ids || senderId !== ids.masterId)
|
|
90
|
-
return false;
|
|
91
|
-
return Boolean(this.ownerQueues.get(ownerKey(ids.endpointId, ids.masterId))?.active);
|
|
92
|
-
}
|
|
93
|
-
async openPrompt(spec) {
|
|
94
|
-
const host = this.plugin.root ?? this.plugin;
|
|
95
|
-
const prompt = new Prompt(host, spec.message);
|
|
96
|
-
const questionType = spec.questionType;
|
|
97
|
-
const args = spec.args;
|
|
98
|
-
const timeoutMs = spec.timeoutMs;
|
|
99
|
-
try {
|
|
100
|
-
switch (questionType) {
|
|
101
|
-
case 'number': {
|
|
102
|
-
const defaultNum = args.default_value != null ? Number(args.default_value) : undefined;
|
|
103
|
-
const result = await prompt.number(String(args.question ?? ''), timeoutMs, defaultNum, '输入超时,已取消');
|
|
104
|
-
return String(result);
|
|
105
|
-
}
|
|
106
|
-
case 'confirm': {
|
|
107
|
-
const result = await prompt.confirm(String(args.question ?? ''), 'yes', timeoutMs, false, '确认超时,已取消');
|
|
108
|
-
return result ? 'yes' : 'no';
|
|
109
|
-
}
|
|
110
|
-
case 'pick': {
|
|
111
|
-
const options = args.options;
|
|
112
|
-
if (!options?.length) {
|
|
113
|
-
return 'Error: type=pick 时必须提供 options 选项列表';
|
|
114
|
-
}
|
|
115
|
-
const pickOptions = options.map((o) => ({ label: o, value: o }));
|
|
116
|
-
const result = await prompt.pick(String(args.question ?? ''), {
|
|
117
|
-
type: 'text',
|
|
118
|
-
options: pickOptions,
|
|
119
|
-
timeout: timeoutMs,
|
|
120
|
-
}, '选择超时,已取消');
|
|
121
|
-
return String(result);
|
|
122
|
-
}
|
|
123
|
-
case 'text':
|
|
124
|
-
default: {
|
|
125
|
-
const result = await prompt.text(String(args.question ?? ''), timeoutMs, String(args.default_value ?? ''), '输入超时,已取消');
|
|
126
|
-
return result;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
}
|
|
130
|
-
catch (e) {
|
|
131
|
-
return `Owner 未响应或输入错误: ${errMsg(e)}`;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
openSensitiveDm(spec) {
|
|
135
|
-
const masterId = String(spec.botMaster ?? '');
|
|
136
|
-
const endpointId = String(spec.message.$endpoint ?? '');
|
|
137
|
-
const key = ownerKey(endpointId, masterId);
|
|
138
|
-
return new Promise((resolve) => {
|
|
139
|
-
const entry = {
|
|
140
|
-
spec,
|
|
141
|
-
resolve,
|
|
142
|
-
timer: setTimeout(() => { }, spec.timeoutMs),
|
|
143
|
-
};
|
|
144
|
-
entry.timer = setTimeout(() => {
|
|
145
|
-
this.finishOwnerEntry(key, entry, this.timeoutFallback(spec));
|
|
146
|
-
}, spec.timeoutMs);
|
|
147
|
-
const queue = this.ownerQueues.get(key) ?? { waiting: [] };
|
|
148
|
-
if (queue.active) {
|
|
149
|
-
queue.waiting.push(entry);
|
|
150
|
-
this.ownerQueues.set(key, queue);
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
queue.active = entry;
|
|
154
|
-
this.ownerQueues.set(key, queue);
|
|
155
|
-
void this.sendSensitiveQuestion(spec);
|
|
156
|
-
});
|
|
157
|
-
}
|
|
158
|
-
async sendSensitiveQuestion(spec) {
|
|
159
|
-
const { message, args, questionType, botMaster, adapter } = spec;
|
|
160
|
-
if (!botMaster || !adapter)
|
|
161
|
-
return;
|
|
162
|
-
const sceneId = String(message.$channel?.id ?? '');
|
|
163
|
-
const parentType = message.$channel?.type === 'channel' ? 'channel' : 'group';
|
|
164
|
-
const questionText = buildSensitiveOwnerQuestionText(message, String(args.question ?? ''), questionType, args.options);
|
|
165
|
-
try {
|
|
166
|
-
await adapter.sendMessage({
|
|
167
|
-
context: message.$adapter,
|
|
168
|
-
endpoint: message.$endpoint,
|
|
169
|
-
id: botMaster,
|
|
170
|
-
type: 'private',
|
|
171
|
-
parent: { type: parentType, id: sceneId },
|
|
172
|
-
content: questionText,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
catch (e) {
|
|
176
|
-
const key = ownerKey(String(message.$endpoint), botMaster);
|
|
177
|
-
const queue = this.ownerQueues.get(key);
|
|
178
|
-
const active = queue?.active;
|
|
179
|
-
if (active?.spec.sessionId === spec.sessionId) {
|
|
180
|
-
this.finishOwnerEntry(key, active, `Error: 无法向 Owner 发送私聊消息: ${errMsg(e)}`);
|
|
181
|
-
}
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
timeoutFallback(spec) {
|
|
185
|
-
if (spec.args.default_value != null)
|
|
186
|
-
return String(spec.args.default_value);
|
|
187
|
-
return 'Owner 未在规定时间内响应,操作已取消。';
|
|
188
|
-
}
|
|
189
|
-
finishOwnerEntry(key, entry, answer) {
|
|
190
|
-
clearTimeout(entry.timer);
|
|
191
|
-
const queue = this.ownerQueues.get(key);
|
|
192
|
-
if (!queue || queue.active !== entry)
|
|
193
|
-
return;
|
|
194
|
-
queue.active = undefined;
|
|
195
|
-
const groupOrigin = entry.spec.groupOrigin ?? entry.spec.message;
|
|
196
|
-
void notifyGroupOwnerAskUserResolved(groupOrigin, answer).catch(() => { });
|
|
197
|
-
entry.resolve(answer);
|
|
198
|
-
const next = queue.waiting.shift();
|
|
199
|
-
if (next) {
|
|
200
|
-
queue.active = next;
|
|
201
|
-
this.ownerQueues.set(key, queue);
|
|
202
|
-
void this.sendSensitiveQuestion(next.spec);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
this.ownerQueues.delete(key);
|
|
206
|
-
}
|
|
207
|
-
resolveEndpointMaster(message, root) {
|
|
208
|
-
const endpointId = String(message.$endpoint ?? '');
|
|
209
|
-
if (!endpointId || !root)
|
|
210
|
-
return undefined;
|
|
211
|
-
try {
|
|
212
|
-
const adapter = root.inject(message.$adapter);
|
|
213
|
-
const master = adapter?.endpoints?.get(endpointId)?.$config?.master;
|
|
214
|
-
if (master == null)
|
|
215
|
-
return undefined;
|
|
216
|
-
return { endpointId, masterId: String(master) };
|
|
217
|
-
}
|
|
218
|
-
catch {
|
|
219
|
-
return undefined;
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
middleware = async (message, next) => {
|
|
223
|
-
const match = this.matchInbound(message, this.plugin.root ?? this.plugin);
|
|
224
|
-
if (match === 'ignore')
|
|
225
|
-
return next();
|
|
226
|
-
if (match === 'bypass')
|
|
227
|
-
return next();
|
|
228
|
-
const promptWait = this.promptWaits.get(promptKey(message));
|
|
229
|
-
if (promptWait) {
|
|
230
|
-
clearTimeout(promptWait.timer);
|
|
231
|
-
this.promptWaits.delete(promptKey(message));
|
|
232
|
-
const raw = String(message.$raw ?? '');
|
|
233
|
-
promptWait.resolve(formatOwnerResponse(raw, promptWait.spec.questionType, promptWait.spec.args));
|
|
234
|
-
return;
|
|
235
|
-
}
|
|
236
|
-
const senderId = String(message.$sender?.id ?? '');
|
|
237
|
-
const endpointId = String(message.$endpoint ?? '');
|
|
238
|
-
let key = ownerKey(endpointId, senderId);
|
|
239
|
-
let queue = this.ownerQueues.get(key);
|
|
240
|
-
if (!queue?.active) {
|
|
241
|
-
const ids = this.resolveEndpointMaster(message, this.plugin.root ?? this.plugin);
|
|
242
|
-
if (ids) {
|
|
243
|
-
key = ownerKey(ids.endpointId, ids.masterId);
|
|
244
|
-
queue = this.ownerQueues.get(key);
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
const active = queue?.active;
|
|
248
|
-
if (!active)
|
|
249
|
-
return next();
|
|
250
|
-
const raw = String(message.$raw ?? '');
|
|
251
|
-
const formatted = formatOwnerResponse(raw, active.spec.questionType, active.spec.args);
|
|
252
|
-
const answer = active.spec.groupOrigin
|
|
253
|
-
? buildGroupAskUserFollowUp(active.spec.groupOrigin, formatted)
|
|
254
|
-
: formatted;
|
|
255
|
-
this.finishOwnerEntry(key, active, answer);
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
//# sourceMappingURL=ask-user-session-service.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-session-service.js","sourceRoot":"","sources":["../../src/builtin/ask-user-session-service.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,MAAM,GAMP,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,+BAA+B,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACjH,OAAO,EACL,+BAA+B,EAC/B,mBAAmB,GACpB,MAAM,oBAAoB,CAAC;AA2B5B,SAAS,QAAQ,CAAC,UAAkB,EAAE,QAAgB;IACpD,OAAO,GAAG,UAAU,IAAI,QAAQ,EAAE,CAAC;AACrC,CAAC;AAED,SAAS,SAAS,CAAC,OAAgB;IACjC,OAAO,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC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,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,CAAC;YACnB,MAAM,GAAG,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,IAAI,IAAI,CAAC,MAAM,CAAC,CAAC;YACjF,IAAI,GAAG,EAAE,CAAC;gBACR,GAAG,GAAG,QAAQ,CAAC,GAAG,CAAC,UAAU,EAAE,GAAG,CAAC,QAAQ,CAAC,CAAC;gBAC7C,KAAK,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;YACpC,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,KAAK,EAAE,MAAM,CAAC;QAC7B,IAAI,CAAC,MAAM;YAAE,OAAO,IAAI,EAAE,CAAC;QAE3B,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC;QACvC,MAAM,SAAS,GAAG,mBAAmB,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,YAAY,EAAE,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACvF,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,WAAW;YACpC,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,IAAI,CAAC,WAAW,EAAE,SAAS,CAAC;YAC/D,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,CAAC,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC;CACH"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ask_user 挂起会话注册表 — 委托 AskUserSessionService(常驻 middleware)。
|
|
3
|
-
*/
|
|
4
|
-
import type { Message, Plugin } from '@zhin.js/core';
|
|
5
|
-
import { AskUserSessionService } from './ask-user-session-service.js';
|
|
6
|
-
export interface PendingAskUserSession {
|
|
7
|
-
endpointId: string;
|
|
8
|
-
masterId: string;
|
|
9
|
-
groupOrigin?: Message;
|
|
10
|
-
registeredAt: number;
|
|
11
|
-
}
|
|
12
|
-
export declare function registerPendingAskUser(_session: PendingAskUserSession): void;
|
|
13
|
-
export declare function clearPendingAskUser(_endpointId: string, _masterId: string): void;
|
|
14
|
-
export declare function getPendingAskUser(_endpointId: string, _masterId: string): PendingAskUserSession | undefined;
|
|
15
|
-
/** 该私聊消息是否应作为 ask_user 回复消费(勿再触发 AI Handler)。 */
|
|
16
|
-
export declare function isAskUserPendingReply(message: Message, root?: Plugin): boolean;
|
|
17
|
-
export declare function ensureAskUserSessionService(plugin: Plugin): AskUserSessionService;
|
|
18
|
-
//# sourceMappingURL=ask-user-session.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-session.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-session.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAEtE,MAAM,WAAW,qBAAqB;IACpC,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,wBAAgB,sBAAsB,CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI,CAE5E;AAED,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAEhF;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAE3G;AAED,iDAAiD;AACjD,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,OAAO,EAChB,IAAI,CAAC,EAAE,MAAM,GACZ,OAAO,CAIT;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,qBAAqB,CAEjF"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { AskUserSessionService } from './ask-user-session-service.js';
|
|
2
|
-
export function registerPendingAskUser(_session) {
|
|
3
|
-
// legacy no-op:排队与会话状态由 AskUserSessionService 管理
|
|
4
|
-
}
|
|
5
|
-
export function clearPendingAskUser(_endpointId, _masterId) {
|
|
6
|
-
// legacy no-op
|
|
7
|
-
}
|
|
8
|
-
export function getPendingAskUser(_endpointId, _masterId) {
|
|
9
|
-
return undefined;
|
|
10
|
-
}
|
|
11
|
-
/** 该私聊消息是否应作为 ask_user 回复消费(勿再触发 AI Handler)。 */
|
|
12
|
-
export function isAskUserPendingReply(message, root) {
|
|
13
|
-
const service = AskUserSessionService.get();
|
|
14
|
-
if (!service)
|
|
15
|
-
return false;
|
|
16
|
-
return service.isPendingReply(message, root);
|
|
17
|
-
}
|
|
18
|
-
export function ensureAskUserSessionService(plugin) {
|
|
19
|
-
return AskUserSessionService.install(plugin);
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=ask-user-session.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-session.js","sourceRoot":"","sources":["../../src/builtin/ask-user-session.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAStE,MAAM,UAAU,sBAAsB,CAAC,QAA+B;IACpE,iDAAiD;AACnD,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,WAAmB,EAAE,SAAiB;IACxE,eAAe;AACjB,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB,EAAE,SAAiB;IACtE,OAAO,SAAS,CAAC;AACnB,CAAC;AAED,iDAAiD;AACjD,MAAM,UAAU,qBAAqB,CACnC,OAAgB,EAChB,IAAa;IAEb,MAAM,OAAO,GAAG,qBAAqB,CAAC,GAAG,EAAE,CAAC;IAC5C,IAAI,CAAC,OAAO;QAAE,OAAO,KAAK,CAAC;IAC3B,OAAO,OAAO,CAAC,cAAc,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,2BAA2B,CAAC,MAAc;IACxD,OAAO,qBAAqB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* ask_user — 默认在当前会话(群/频道/私聊)Prompt 提问;敏感确认走私聊 master(群来源带 parent)。
|
|
3
|
-
*/
|
|
4
|
-
import { type Plugin, type Message, type Tool, type ToolParametersSchema, type ToolResult, type Adapter } from '@zhin.js/core';
|
|
5
|
-
import { BuiltinBaseTool } from './builtin-base-tool.js';
|
|
6
|
-
export declare function askViaPrompt(plugin: Plugin, message: Message, args: Record<string, unknown>, questionType: string, timeoutMs: number): Promise<string>;
|
|
7
|
-
export declare function formatOwnerResponse(raw: string, questionType: string, args: Record<string, unknown>): string;
|
|
8
|
-
export declare function buildSensitiveOwnerQuestionText(commMessage: Message, question: string, questionType: string, options?: string[]): string;
|
|
9
|
-
export declare function askOwnerViaPrivateWithParent(plugin: Plugin, commMessage: Message, args: Record<string, unknown>, questionType: string, timeoutMs: number, botMaster: string, adapter: Adapter): Promise<string>;
|
|
10
|
-
export declare const ASK_USER_PARAMETERS: ToolParametersSchema;
|
|
11
|
-
export declare function createAskUserTool(plugin: Plugin): Tool;
|
|
12
|
-
export declare class AskUserBuiltinTool extends BuiltinBaseTool {
|
|
13
|
-
private readonly plugin;
|
|
14
|
-
readonly name = "ask_user";
|
|
15
|
-
readonly description = "Ask the user and wait for a reply. Default: prompt in the current session (group/channel/private) to the triggering user. Set sensitive=true only to confirm with the Endpoint Owner via private DM (group origin uses parent; no group-visible trace). Owner private chat: /approve always bash, /approve rule <regex>, /approve list, /approve revoke. write_file / edit_file / web_fetch hard-orchestration still requires per-action Owner confirm.";
|
|
16
|
-
readonly parameters: ToolParametersSchema<Record<string, any>>;
|
|
17
|
-
readonly kind = "interaction";
|
|
18
|
-
readonly executionTimeoutMs = 150000;
|
|
19
|
-
constructor(plugin: Plugin);
|
|
20
|
-
run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
|
|
21
|
-
}
|
|
22
|
-
//# sourceMappingURL=ask-user-tool.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-tool.d.ts","sourceRoot":"","sources":["../../src/builtin/ask-user-tool.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,KAAK,MAAM,EACX,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,oBAAoB,EACzB,KAAK,UAAU,EACf,KAAK,OAAO,EACb,MAAM,eAAe,CAAC;AAEvB,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AASzD,wBAAsB,YAAY,CAChC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,CAUjB;AAED,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CAgB5G;AAED,wBAAgB,+BAA+B,CAC7C,WAAW,EAAE,OAAO,EACpB,QAAQ,EAAE,MAAM,EAChB,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,MAAM,EAAE,GACjB,MAAM,CAaR;AAOD,wBAAsB,4BAA4B,CAChD,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,OAAO,EACpB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC7B,YAAY,EAAE,MAAM,EACpB,SAAS,EAAE,MAAM,EACjB,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC,CAajB;AAED,eAAO,MAAM,mBAAmB,EAAE,oBAuBjC,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAGtD;AAED,qBAAa,kBAAmB,SAAQ,eAAe;IAQzC,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPnC,QAAQ,CAAC,IAAI,cAAc;IAC3B,QAAQ,CAAC,WAAW,6bACwa;IAC5b,QAAQ,CAAC,UAAU,4CAAuB;IAC1C,QAAQ,CAAC,IAAI,iBAAiB;IAC9B,QAAQ,CAAC,kBAAkB,UAAW;gBAET,MAAM,EAAE,MAAM;IAgBrC,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC;CAiDrF"}
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { BuiltinBaseTool } from './builtin-base-tool.js';
|
|
3
|
-
import { shouldBlockDelegationAskUser } from '../collaboration/ask-user-bridge.js';
|
|
4
|
-
import { ensureAskUserSessionService } from './ask-user-session.js';
|
|
5
|
-
// ============================================================================
|
|
6
|
-
// Prompt / Owner 回复格式化
|
|
7
|
-
// ============================================================================
|
|
8
|
-
export async function askViaPrompt(plugin, message, args, questionType, timeoutMs) {
|
|
9
|
-
const service = ensureAskUserSessionService(plugin);
|
|
10
|
-
return service.open({
|
|
11
|
-
sessionId: randomUUID(),
|
|
12
|
-
kind: 'prompt',
|
|
13
|
-
message,
|
|
14
|
-
questionType,
|
|
15
|
-
args,
|
|
16
|
-
timeoutMs,
|
|
17
|
-
});
|
|
18
|
-
}
|
|
19
|
-
export function formatOwnerResponse(raw, questionType, args) {
|
|
20
|
-
switch (questionType) {
|
|
21
|
-
case 'confirm':
|
|
22
|
-
return raw.trim().toLowerCase() === 'yes' ? 'yes' : 'no';
|
|
23
|
-
case 'number':
|
|
24
|
-
return String(Number(raw) || 0);
|
|
25
|
-
case 'pick': {
|
|
26
|
-
const idx = Number(raw.trim());
|
|
27
|
-
const options = args.options || [];
|
|
28
|
-
if (idx >= 1 && idx <= options.length)
|
|
29
|
-
return options[idx - 1];
|
|
30
|
-
return raw;
|
|
31
|
-
}
|
|
32
|
-
case 'text':
|
|
33
|
-
default:
|
|
34
|
-
return raw;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
export function buildSensitiveOwnerQuestionText(commMessage, question, questionType, options) {
|
|
38
|
-
const sourceInfo = commMessage.$channel?.type !== 'private'
|
|
39
|
-
? `来源: ${commMessage.$channel?.type}(${commMessage.$channel?.id}) 用户: ${commMessage.$sender.id}`
|
|
40
|
-
: `来源: 私聊 用户: ${commMessage.$sender.id}`;
|
|
41
|
-
let questionText = `请求确认:\n${sourceInfo}\n\n${question}`;
|
|
42
|
-
if (questionType === 'confirm') {
|
|
43
|
-
questionText += '\n输入"yes"以确认';
|
|
44
|
-
}
|
|
45
|
-
else if (questionType === 'pick' && options?.length) {
|
|
46
|
-
questionText += '\n' + options.map((o, i) => `${i + 1}.${o}`).join('\n');
|
|
47
|
-
}
|
|
48
|
-
else if (questionType === 'number') {
|
|
49
|
-
questionText += '\n(请输入数字)';
|
|
50
|
-
}
|
|
51
|
-
return questionText;
|
|
52
|
-
}
|
|
53
|
-
function isGroupOrChannelScope(message) {
|
|
54
|
-
const scope = message.$channel?.type;
|
|
55
|
-
return scope === 'group' || scope === 'channel';
|
|
56
|
-
}
|
|
57
|
-
export async function askOwnerViaPrivateWithParent(plugin, commMessage, args, questionType, timeoutMs, botMaster, adapter) {
|
|
58
|
-
const service = ensureAskUserSessionService(plugin);
|
|
59
|
-
return service.open({
|
|
60
|
-
sessionId: randomUUID(),
|
|
61
|
-
kind: 'sensitive_dm',
|
|
62
|
-
message: commMessage,
|
|
63
|
-
questionType,
|
|
64
|
-
args,
|
|
65
|
-
timeoutMs,
|
|
66
|
-
botMaster,
|
|
67
|
-
adapter,
|
|
68
|
-
groupOrigin: commMessage,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
export const ASK_USER_PARAMETERS = {
|
|
72
|
-
type: 'object',
|
|
73
|
-
properties: {
|
|
74
|
-
question: { type: 'string', description: 'Question text to ask the user or Endpoint Owner' },
|
|
75
|
-
type: {
|
|
76
|
-
type: 'string',
|
|
77
|
-
enum: ['text', 'number', 'confirm', 'pick'],
|
|
78
|
-
description: 'Response type: text, number, confirm (yes/no), or pick (numbered options). Default: text',
|
|
79
|
-
},
|
|
80
|
-
options: {
|
|
81
|
-
type: 'array',
|
|
82
|
-
items: { type: 'string' },
|
|
83
|
-
description: 'Option labels when type=pick (required), e.g. ["Option A","Option B"]',
|
|
84
|
-
},
|
|
85
|
-
default_value: { type: 'string', description: 'Fallback value if the user does not reply before timeout' },
|
|
86
|
-
timeout: { type: 'number', description: 'Wait timeout in seconds. Default: 120' },
|
|
87
|
-
sensitive: {
|
|
88
|
-
type: 'boolean',
|
|
89
|
-
description: 'When true, send a private confirmation to the Endpoint Owner (group/channel origin includes parent scene). Use for exec approval, secrets, or other sensitive confirms. Do not set for ordinary clarification.',
|
|
90
|
-
},
|
|
91
|
-
},
|
|
92
|
-
required: ['question'],
|
|
93
|
-
};
|
|
94
|
-
export function createAskUserTool(plugin) {
|
|
95
|
-
ensureAskUserSessionService(plugin);
|
|
96
|
-
return new AskUserBuiltinTool(plugin).toTool();
|
|
97
|
-
}
|
|
98
|
-
export class AskUserBuiltinTool extends BuiltinBaseTool {
|
|
99
|
-
plugin;
|
|
100
|
-
name = 'ask_user';
|
|
101
|
-
description = 'Ask the user and wait for a reply. Default: prompt in the current session (group/channel/private) to the triggering user. Set sensitive=true only to confirm with the Endpoint Owner via private DM (group origin uses parent; no group-visible trace). Owner private chat: /approve always bash, /approve rule <regex>, /approve list, /approve revoke. write_file / edit_file / web_fetch hard-orchestration still requires per-action Owner confirm.';
|
|
102
|
-
parameters = ASK_USER_PARAMETERS;
|
|
103
|
-
kind = 'interaction';
|
|
104
|
-
executionTimeoutMs = 150_000;
|
|
105
|
-
constructor(plugin) {
|
|
106
|
-
super();
|
|
107
|
-
this.plugin = plugin;
|
|
108
|
-
this.tags.push('interaction', 'prompt');
|
|
109
|
-
this.keywords.push('询问', '确认', '提问', '用户输入', 'ask', 'confirm', 'prompt', '选择', '请问');
|
|
110
|
-
}
|
|
111
|
-
async run(args, commMessage) {
|
|
112
|
-
if (!commMessage) {
|
|
113
|
-
return 'Error: 当前上下文没有消息来源,无法提问。请改为在回复中直接询问。';
|
|
114
|
-
}
|
|
115
|
-
if (!this.plugin) {
|
|
116
|
-
return 'Error: 插件实例不可用,无法创建交互式提问。请改为在回复中直接询问。';
|
|
117
|
-
}
|
|
118
|
-
const timeoutMs = (args.timeout ?? 120) * 1000;
|
|
119
|
-
const questionType = args.type || 'text';
|
|
120
|
-
const recordArgs = args;
|
|
121
|
-
const question = String(args.question ?? '');
|
|
122
|
-
const platform = commMessage.$adapter;
|
|
123
|
-
const endpointId = commMessage.$endpoint;
|
|
124
|
-
const adapter = this.plugin.inject(platform);
|
|
125
|
-
const bot = adapter?.endpoints?.get(endpointId);
|
|
126
|
-
const botMaster = bot?.$config?.master;
|
|
127
|
-
const isPrivateMaster = commMessage.$channel?.type === 'private'
|
|
128
|
-
&& botMaster != null && String(commMessage.$sender.id) === String(botMaster);
|
|
129
|
-
if (isPrivateMaster) {
|
|
130
|
-
return askViaPrompt(this.plugin, commMessage, recordArgs, questionType, timeoutMs);
|
|
131
|
-
}
|
|
132
|
-
const delegationBlock = shouldBlockDelegationAskUser(commMessage, question, questionType);
|
|
133
|
-
if (delegationBlock)
|
|
134
|
-
return delegationBlock;
|
|
135
|
-
const sensitive = args.sensitive === true;
|
|
136
|
-
if (sensitive && isGroupOrChannelScope(commMessage)) {
|
|
137
|
-
if (!botMaster) {
|
|
138
|
-
return 'Error: 当前 Endpoint 未配置 master,无法进行敏感确认。请在 endpoints 配置中设置 master 字段。';
|
|
139
|
-
}
|
|
140
|
-
if (!adapter || typeof adapter.sendMessage !== 'function') {
|
|
141
|
-
return `Error: 无法获取适配器 ${platform},无法向 Owner 发送私聊确认。`;
|
|
142
|
-
}
|
|
143
|
-
return askOwnerViaPrivateWithParent(this.plugin, commMessage, recordArgs, questionType, timeoutMs, botMaster, adapter);
|
|
144
|
-
}
|
|
145
|
-
return askViaPrompt(this.plugin, commMessage, recordArgs, questionType, timeoutMs);
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
//# sourceMappingURL=ask-user-tool.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ask-user-tool.js","sourceRoot":"","sources":["../../src/builtin/ask-user-tool.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,4BAA4B,EAAE,MAAM,qCAAqC,CAAC;AAEnF,OAAO,EAAE,2BAA2B,EAAE,MAAM,uBAAuB,CAAC;AAEpE,+EAA+E;AAC/E,uBAAuB;AACvB,+EAA+E;AAE/E,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAc,EACd,OAAgB,EAChB,IAA6B,EAC7B,YAAoB,EACpB,SAAiB;IAEjB,MAAM,OAAO,GAAG,2BAA2B,CAAC,MAAM,CAAC,CAAC;IACpD,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,SAAS,EAAE,UAAU,EAAE;QACvB,IAAI,EAAE,QAAQ;QACd,OAAO;QACP,YAAY;QACZ,IAAI;QACJ,SAAS;KACV,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,GAAW,EAAE,YAAoB,EAAE,IAA6B;IAClG,QAAQ,YAAY,EAAE,CAAC;QACrB,KA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AAI,OAAO,OAAO,CAAC,WAAW,KAAK,UAAU,EAAE,CAAC;gBAC1D,OAAO,kBAAkB,QAAQ,oBAAoB,CAAC;YACxD,CAAC;YACD,OAAO,4BAA4B,CACjC,IAAI,CAAC,MAAM,EACX,WAAW,EACX,UAAU,EACV,YAAY,EACZ,SAAS,EACT,SAAS,EACT,OAAO,CACR,CAAC;QACJ,CAAC;QAED,OAAO,YAAY,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,CAAC,CAAC;IACrF,CAAC;CACF"}
|
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Deferred schema meta tools: discover, load_tool, load_skill
|
|
3
|
-
*/
|
|
4
|
-
import { type DeferredToolSessionSnapshot } from '@zhin.js/ai';
|
|
5
|
-
import type { Message, Tool, ToolParametersSchema, ToolResult } from '@zhin.js/core';
|
|
6
|
-
import type { SkillRegistry } from '../orchestrator/skill-registry.js';
|
|
7
|
-
import type { ToolCatalogItem } from '../tool-catalog/types.js';
|
|
8
|
-
import { type LoadSkillToolOptions } from './load-skill-tool.js';
|
|
9
|
-
import { BuiltinBaseTool } from './builtin-base-tool.js';
|
|
10
|
-
export declare const TOOLS_MUTATED_MARKER = "__zhin_tools_mutated__";
|
|
11
|
-
export interface DeferredToolRuntime {
|
|
12
|
-
sessionId: string;
|
|
13
|
-
catalog: ToolCatalogItem[];
|
|
14
|
-
skillRegistry: SkillRegistry | null;
|
|
15
|
-
snapshot: DeferredToolSessionSnapshot;
|
|
16
|
-
maxLoadedPerSession: number;
|
|
17
|
-
discoverTopK: number;
|
|
18
|
-
persistSnapshot: (snapshot: DeferredToolSessionSnapshot) => Promise<void>;
|
|
19
|
-
onSkillLoaded?: (name: string, instructions: string, toolNames: string[]) => void;
|
|
20
|
-
skillLoadOpts: LoadSkillToolOptions;
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 在独立 deferred runtime 下执行:load_tool / discover 的 snapshot 变更只影响本上下文,
|
|
24
|
-
* 不会污染父会话(此前 subagent 的 load_tool 会写父会话 snapshot)。
|
|
25
|
-
*/
|
|
26
|
-
export declare function runWithDeferredToolRuntime<T>(runtime: DeferredToolRuntime, fn: () => Promise<T>): Promise<T>;
|
|
27
|
-
export declare function bindDeferredToolRuntime(message: Message, runtime: DeferredToolRuntime): void;
|
|
28
|
-
export declare function getDeferredToolRuntime(message?: Message): DeferredToolRuntime | undefined;
|
|
29
|
-
export declare class DiscoverBuiltinTool extends BuiltinBaseTool {
|
|
30
|
-
readonly name = "discover";
|
|
31
|
-
readonly description = "Search deferred tools and skills by query. kind: tool|skill|all (default all). Empty query returns platform-matched skills.";
|
|
32
|
-
readonly parameters: ToolParametersSchema;
|
|
33
|
-
run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
|
|
34
|
-
}
|
|
35
|
-
export declare class LoadToolBuiltinTool extends BuiltinBaseTool {
|
|
36
|
-
readonly name = "load_tool";
|
|
37
|
-
readonly description = "Load a deferred tool schema into the session so it can be called.";
|
|
38
|
-
readonly parameters: ToolParametersSchema;
|
|
39
|
-
run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
|
|
40
|
-
}
|
|
41
|
-
export declare class LoadSkillBuiltinToolMeta extends BuiltinBaseTool {
|
|
42
|
-
private readonly skillOpts;
|
|
43
|
-
readonly name = "load_skill";
|
|
44
|
-
readonly description = "Load full skill instructions and unlock associated tools for this session.";
|
|
45
|
-
readonly parameters: ToolParametersSchema;
|
|
46
|
-
constructor(skillOpts: LoadSkillToolOptions);
|
|
47
|
-
run(args: Record<string, unknown>, commMessage?: Message): Promise<ToolResult>;
|
|
48
|
-
}
|
|
49
|
-
export declare function createDeferredMetaTools(skillOpts: LoadSkillToolOptions): Tool[];
|
|
50
|
-
export declare function isToolsMutatedResult(result: ToolResult): boolean;
|
|
51
|
-
//# sourceMappingURL=deferred-tool-meta.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|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