@zhin.js/agent 0.1.32 → 0.2.1
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 +1 -1
- package/lib/agent-prompt/resolver.js +4 -4
- package/lib/agent-prompt/resolver.js.map +1 -1
- package/lib/ai-event-bus.d.ts.map +1 -1
- package/lib/ai-event-bus.js +20 -31
- 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/assistant/home-policy.d.ts +2 -2
- package/lib/assistant/home-policy.d.ts.map +1 -1
- package/lib/assistant/home-policy.js +28 -10
- package/lib/assistant/home-policy.js.map +1 -1
- package/lib/assistant/home-tools.js +14 -14
- package/lib/assistant/home-tools.js.map +1 -1
- package/lib/assistant/index.d.ts +1 -1
- package/lib/assistant/index.js +1 -1
- package/lib/assistant/legacy-convert.d.ts +3 -8
- package/lib/assistant/legacy-convert.d.ts.map +1 -1
- package/lib/assistant/legacy-convert.js +8 -8
- package/lib/assistant/legacy-convert.js.map +1 -1
- package/lib/assistant/notification-router.js +6 -6
- package/lib/assistant/notification-router.js.map +1 -1
- package/lib/assistant/types.d.ts +1 -1
- package/lib/assistant/types.d.ts.map +1 -1
- package/lib/builtin/activate-skill-tool.d.ts +2 -2
- package/lib/builtin/activate-skill-tool.d.ts.map +1 -1
- package/lib/builtin/activate-skill-tool.js +1 -1
- package/lib/builtin/activate-skill-tool.js.map +1 -1
- package/lib/builtin/analyze-media-tool.d.ts +2 -2
- package/lib/builtin/analyze-media-tool.d.ts.map +1 -1
- package/lib/builtin/analyze-media-tool.js +3 -3
- package/lib/builtin/analyze-media-tool.js.map +1 -1
- package/lib/builtin/ask-user-tool.d.ts +4 -4
- package/lib/builtin/ask-user-tool.d.ts.map +1 -1
- package/lib/builtin/ask-user-tool.js +16 -16
- package/lib/builtin/ask-user-tool.js.map +1 -1
- package/lib/builtin/bash-tool.d.ts +2 -2
- package/lib/builtin/bash-tool.d.ts.map +1 -1
- package/lib/builtin/bash-tool.js +8 -3
- package/lib/builtin/bash-tool.js.map +1 -1
- package/lib/builtin/builtin-base-tool.d.ts +2 -2
- package/lib/builtin/builtin-base-tool.d.ts.map +1 -1
- package/lib/builtin/edit-file-tool.d.ts +2 -2
- package/lib/builtin/edit-file-tool.d.ts.map +1 -1
- package/lib/builtin/edit-file-tool.js +6 -6
- package/lib/builtin/edit-file-tool.js.map +1 -1
- package/lib/builtin/glob-tool.d.ts +2 -2
- package/lib/builtin/glob-tool.d.ts.map +1 -1
- package/lib/builtin/glob-tool.js +3 -3
- package/lib/builtin/glob-tool.js.map +1 -1
- package/lib/builtin/grep-tool.d.ts +2 -2
- package/lib/builtin/grep-tool.d.ts.map +1 -1
- package/lib/builtin/grep-tool.js +3 -3
- package/lib/builtin/grep-tool.js.map +1 -1
- package/lib/builtin/install-skill-tool.d.ts +2 -2
- package/lib/builtin/install-skill-tool.d.ts.map +1 -1
- package/lib/builtin/install-skill-tool.js +1 -1
- package/lib/builtin/install-skill-tool.js.map +1 -1
- package/lib/builtin/list-dir-tool.d.ts +2 -2
- package/lib/builtin/list-dir-tool.d.ts.map +1 -1
- package/lib/builtin/list-dir-tool.js +3 -3
- package/lib/builtin/list-dir-tool.js.map +1 -1
- package/lib/builtin/memory-search-tool.d.ts.map +1 -1
- package/lib/builtin/memory-search-tool.js +5 -11
- package/lib/builtin/memory-search-tool.js.map +1 -1
- package/lib/builtin/memory-upsert-tool.d.ts.map +1 -1
- package/lib/builtin/memory-upsert-tool.js +10 -16
- package/lib/builtin/memory-upsert-tool.js.map +1 -1
- package/lib/builtin/orchestration-tools.d.ts +2 -2
- package/lib/builtin/orchestration-tools.d.ts.map +1 -1
- package/lib/builtin/orchestration-tools.js +5 -11
- package/lib/builtin/orchestration-tools.js.map +1 -1
- package/lib/builtin/read-file-tool.d.ts +2 -2
- package/lib/builtin/read-file-tool.d.ts.map +1 -1
- package/lib/builtin/read-file-tool.js +4 -4
- package/lib/builtin/read-file-tool.js.map +1 -1
- package/lib/builtin/spawn-task-tool.d.ts +6 -6
- package/lib/builtin/spawn-task-tool.d.ts.map +1 -1
- package/lib/builtin/spawn-task-tool.js +10 -17
- package/lib/builtin/spawn-task-tool.js.map +1 -1
- package/lib/builtin/todo-read-tool.d.ts +2 -2
- package/lib/builtin/todo-read-tool.d.ts.map +1 -1
- package/lib/builtin/todo-read-tool.js +1 -1
- package/lib/builtin/todo-read-tool.js.map +1 -1
- package/lib/builtin/todo-write-tool.d.ts +2 -2
- package/lib/builtin/todo-write-tool.d.ts.map +1 -1
- package/lib/builtin/todo-write-tool.js +1 -1
- package/lib/builtin/todo-write-tool.js.map +1 -1
- package/lib/builtin/web-fetch-tool.d.ts +2 -2
- package/lib/builtin/web-fetch-tool.d.ts.map +1 -1
- package/lib/builtin/web-fetch-tool.js +2 -2
- package/lib/builtin/web-fetch-tool.js.map +1 -1
- package/lib/builtin/web-search-locale.d.ts +4 -4
- package/lib/builtin/web-search-locale.d.ts.map +1 -1
- package/lib/builtin/web-search-locale.js +4 -3
- package/lib/builtin/web-search-locale.js.map +1 -1
- package/lib/builtin/web-search-tool.d.ts +3 -3
- package/lib/builtin/web-search-tool.d.ts.map +1 -1
- package/lib/builtin/web-search-tool.js +3 -3
- package/lib/builtin/web-search-tool.js.map +1 -1
- package/lib/builtin/write-file-tool.d.ts +2 -2
- package/lib/builtin/write-file-tool.d.ts.map +1 -1
- package/lib/builtin/write-file-tool.js +6 -6
- package/lib/builtin/write-file-tool.js.map +1 -1
- package/lib/common-adapter-tools.js +3 -3
- package/lib/common-adapter-tools.js.map +1 -1
- package/lib/config/fix-ai-config.d.ts +9 -0
- package/lib/config/fix-ai-config.d.ts.map +1 -0
- package/lib/config/fix-ai-config.js +69 -0
- package/lib/config/fix-ai-config.js.map +1 -0
- package/lib/config/index.d.ts +5 -0
- package/lib/config/index.d.ts.map +1 -0
- package/lib/config/index.js +5 -0
- package/lib/config/index.js.map +1 -0
- package/lib/config/types.d.ts +1 -1
- package/lib/config/types.d.ts.map +1 -1
- package/lib/cron-engine.d.ts.map +1 -1
- package/lib/cron-engine.js +4 -4
- package/lib/cron-engine.js.map +1 -1
- package/lib/deferred-worker-runner.d.ts +2 -2
- package/lib/deferred-worker-runner.d.ts.map +1 -1
- package/lib/deferred-worker-runner.js +3 -3
- package/lib/discovery/tools.d.ts +1 -1
- package/lib/discovery/tools.d.ts.map +1 -1
- package/lib/discovery/tools.js +21 -6
- package/lib/discovery/tools.js.map +1 -1
- package/lib/hooks.d.ts +1 -1
- package/lib/hooks.d.ts.map +1 -1
- package/lib/hooks.js +1 -1
- package/lib/hooks.js.map +1 -1
- package/lib/index.d.ts +5 -4
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +3 -2
- package/lib/index.js.map +1 -1
- package/lib/init/create-zhin-agent.d.ts.map +1 -1
- package/lib/init/create-zhin-agent.js +20 -9
- package/lib/init/create-zhin-agent.js.map +1 -1
- package/lib/init/introspection-args.d.ts +1 -1
- package/lib/init/introspection-args.js +1 -1
- package/lib/init/introspection-args.js.map +1 -1
- package/lib/init/introspection-collectors.d.ts +2 -2
- package/lib/init/introspection-collectors.d.ts.map +1 -1
- package/lib/init/introspection-collectors.js +4 -4
- package/lib/init/introspection-collectors.js.map +1 -1
- package/lib/init/introspection-commands-format.d.ts +3 -3
- package/lib/init/introspection-commands-format.d.ts.map +1 -1
- package/lib/init/introspection-commands-format.js +6 -6
- package/lib/init/introspection-commands-format.js.map +1 -1
- package/lib/init/introspection-rest.d.ts +2 -2
- package/lib/init/introspection-rest.d.ts.map +1 -1
- package/lib/init/introspection-rest.js +4 -4
- package/lib/init/introspection-rest.js.map +1 -1
- package/lib/init/management-command-guard.d.ts +9 -0
- package/lib/init/management-command-guard.d.ts.map +1 -0
- package/lib/init/management-command-guard.js +20 -0
- package/lib/init/management-command-guard.js.map +1 -0
- package/lib/init/message-media.d.ts +2 -2
- package/lib/init/message-media.d.ts.map +1 -1
- package/lib/init/message-media.js +1 -1
- package/lib/init/message-media.js.map +1 -1
- package/lib/init/register-ai-trigger.d.ts.map +1 -1
- package/lib/init/register-ai-trigger.js +43 -58
- package/lib/init/register-ai-trigger.js.map +1 -1
- package/lib/init/register-builtin-tools.js +8 -8
- 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 +2 -0
- 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 +5 -10
- package/lib/init/register-group-session-passive.js.map +1 -1
- package/lib/init/register-introspection-commands.d.ts.map +1 -1
- package/lib/init/register-introspection-commands.js +16 -8
- package/lib/init/register-introspection-commands.js.map +1 -1
- package/lib/init/register-management-tools.d.ts.map +1 -1
- package/lib/init/register-management-tools.js +31 -43
- package/lib/init/register-management-tools.js.map +1 -1
- package/lib/init/register-owner-approve-commands.js +13 -13
- package/lib/init/register-owner-approve-commands.js.map +1 -1
- package/lib/init/register-typing-indicator.d.ts +3 -3
- package/lib/init/register-typing-indicator.js +41 -41
- package/lib/init/register-typing-indicator.js.map +1 -1
- package/lib/init/upgrade-agent-db-schema.d.ts.map +1 -1
- package/lib/init/upgrade-agent-db-schema.js +5 -4
- package/lib/init/upgrade-agent-db-schema.js.map +1 -1
- package/lib/init/upgrade-endpoint-id-schema.d.ts +12 -0
- package/lib/init/upgrade-endpoint-id-schema.d.ts.map +1 -0
- package/lib/init/upgrade-endpoint-id-schema.js +58 -0
- package/lib/init/upgrade-endpoint-id-schema.js.map +1 -0
- package/lib/mcp-client/connection.d.ts.map +1 -1
- package/lib/mcp-client/connection.js +2 -1
- package/lib/mcp-client/connection.js.map +1 -1
- package/lib/mcp-client/index.d.ts.map +1 -1
- package/lib/mcp-client/index.js +7 -1
- package/lib/mcp-client/index.js.map +1 -1
- package/lib/media/constants.d.ts +1 -1
- package/lib/media/constants.d.ts.map +1 -1
- package/lib/media/constants.js +1 -1
- package/lib/media/constants.js.map +1 -1
- package/lib/media/deliver-subagent-result.d.ts.map +1 -1
- package/lib/media/deliver-subagent-result.js +6 -5
- package/lib/media/deliver-subagent-result.js.map +1 -1
- package/lib/memory-layers.d.ts +3 -3
- package/lib/memory-layers.d.ts.map +1 -1
- package/lib/memory-layers.js +3 -3
- package/lib/memory-layers.js.map +1 -1
- package/lib/monitoring/metrics.d.ts +16 -0
- package/lib/monitoring/metrics.d.ts.map +1 -1
- package/lib/monitoring/metrics.js +47 -0
- package/lib/monitoring/metrics.js.map +1 -1
- package/lib/orchestrator/agent-dispatcher.d.ts +2 -0
- package/lib/orchestrator/agent-dispatcher.d.ts.map +1 -1
- package/lib/orchestrator/agent-dispatcher.js +6 -0
- package/lib/orchestrator/agent-dispatcher.js.map +1 -1
- package/lib/orchestrator/delegation-processor.d.ts +1 -0
- package/lib/orchestrator/delegation-processor.d.ts.map +1 -1
- package/lib/orchestrator/delegation-processor.js +14 -8
- package/lib/orchestrator/delegation-processor.js.map +1 -1
- package/lib/orchestrator/hook-registry.js.map +1 -1
- package/lib/orchestrator/mission-milestone-notify.d.ts +3 -3
- package/lib/orchestrator/mission-milestone-notify.d.ts.map +1 -1
- package/lib/orchestrator/mission-milestone-notify.js +15 -10
- package/lib/orchestrator/mission-milestone-notify.js.map +1 -1
- package/lib/orchestrator/mission-runner.d.ts +2 -3
- package/lib/orchestrator/mission-runner.d.ts.map +1 -1
- package/lib/orchestrator/mission-runner.js +13 -11
- package/lib/orchestrator/mission-runner.js.map +1 -1
- package/lib/orchestrator/orchestration-repository.d.ts +6 -0
- package/lib/orchestrator/orchestration-repository.d.ts.map +1 -1
- package/lib/orchestrator/orchestration-repository.js +30 -0
- package/lib/orchestrator/orchestration-repository.js.map +1 -1
- package/lib/orchestrator/owner-confirm-orchestration.d.ts +3 -3
- package/lib/orchestrator/owner-confirm-orchestration.d.ts.map +1 -1
- package/lib/orchestrator/owner-confirm-orchestration.js +5 -5
- package/lib/orchestrator/owner-confirm-orchestration.js.map +1 -1
- package/lib/orchestrator/remote-agent-registry.d.ts +2 -0
- package/lib/orchestrator/remote-agent-registry.d.ts.map +1 -1
- package/lib/orchestrator/remote-agent-registry.js +34 -4
- package/lib/orchestrator/remote-agent-registry.js.map +1 -1
- package/lib/orchestrator/remote-task-poller.d.ts +1 -0
- package/lib/orchestrator/remote-task-poller.d.ts.map +1 -1
- package/lib/orchestrator/remote-task-poller.js +6 -0
- package/lib/orchestrator/remote-task-poller.js.map +1 -1
- package/lib/orchestrator/task-queue.d.ts +18 -3
- package/lib/orchestrator/task-queue.d.ts.map +1 -1
- package/lib/orchestrator/task-queue.js +52 -6
- package/lib/orchestrator/task-queue.js.map +1 -1
- package/lib/orchestrator/tool-registry.d.ts +4 -5
- package/lib/orchestrator/tool-registry.d.ts.map +1 -1
- package/lib/orchestrator/tool-registry.js +7 -11
- package/lib/orchestrator/tool-registry.js.map +1 -1
- package/lib/orchestrator/tool-selection.d.ts +7 -6
- package/lib/orchestrator/tool-selection.d.ts.map +1 -1
- package/lib/orchestrator/tool-selection.js +47 -38
- package/lib/orchestrator/tool-selection.js.map +1 -1
- package/lib/orchestrator/types.d.ts +5 -7
- package/lib/orchestrator/types.d.ts.map +1 -1
- package/lib/routing/route-matcher.d.ts +1 -1
- package/lib/routing/route-matcher.d.ts.map +1 -1
- package/lib/routing/route-matcher.js +3 -3
- package/lib/routing/route-matcher.js.map +1 -1
- package/lib/security/anomaly-detection.d.ts +2 -0
- package/lib/security/anomaly-detection.d.ts.map +1 -1
- package/lib/security/anomaly-detection.js +4 -0
- package/lib/security/anomaly-detection.js.map +1 -1
- package/lib/security/audit-logger.d.ts +3 -3
- package/lib/security/audit-logger.d.ts.map +1 -1
- package/lib/security/audit-logger.js +3 -2
- package/lib/security/audit-logger.js.map +1 -1
- package/lib/security/budget-limiter.d.ts +3 -0
- package/lib/security/budget-limiter.d.ts.map +1 -1
- package/lib/security/budget-limiter.js +17 -0
- package/lib/security/budget-limiter.js.map +1 -1
- package/lib/security/comm-message-context.d.ts +20 -0
- package/lib/security/comm-message-context.d.ts.map +1 -0
- package/lib/security/comm-message-context.js +19 -0
- package/lib/security/comm-message-context.js.map +1 -0
- package/lib/security/dangerous-tool-policy.d.ts +4 -4
- package/lib/security/dangerous-tool-policy.d.ts.map +1 -1
- package/lib/security/dangerous-tool-policy.js +39 -31
- package/lib/security/dangerous-tool-policy.js.map +1 -1
- package/lib/security/exec-policy.js +9 -9
- package/lib/security/exec-policy.js.map +1 -1
- package/lib/security/file-role-policy.d.ts +1 -1
- package/lib/security/file-role-policy.d.ts.map +1 -1
- package/lib/security/file-role-policy.js +4 -5
- package/lib/security/file-role-policy.js.map +1 -1
- package/lib/security/index.d.ts +5 -1
- package/lib/security/index.d.ts.map +1 -1
- package/lib/security/index.js +21 -4
- package/lib/security/index.js.map +1 -1
- package/lib/security/network-policy.d.ts +2 -0
- package/lib/security/network-policy.d.ts.map +1 -1
- package/lib/security/network-policy.js +4 -0
- package/lib/security/network-policy.js.map +1 -1
- package/lib/security/owner-approve-always-store.d.ts +18 -16
- package/lib/security/owner-approve-always-store.d.ts.map +1 -1
- package/lib/security/owner-approve-always-store.js +133 -117
- package/lib/security/owner-approve-always-store.js.map +1 -1
- package/lib/security/sandbox-enhanced.d.ts +3 -0
- package/lib/security/sandbox-enhanced.d.ts.map +1 -1
- package/lib/security/sandbox-enhanced.js +41 -16
- package/lib/security/sandbox-enhanced.js.map +1 -1
- package/lib/security/sandbox.d.ts +2 -3
- package/lib/security/sandbox.d.ts.map +1 -1
- package/lib/security/sandbox.js +39 -20
- package/lib/security/sandbox.js.map +1 -1
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +7 -1
- package/lib/service.js.map +1 -1
- package/lib/stability/memory-pressure.d.ts +31 -0
- package/lib/stability/memory-pressure.d.ts.map +1 -0
- package/lib/stability/memory-pressure.js +104 -0
- package/lib/stability/memory-pressure.js.map +1 -0
- package/lib/stability/registry-cleanup.d.ts +5 -0
- package/lib/stability/registry-cleanup.d.ts.map +1 -0
- package/lib/stability/registry-cleanup.js +20 -0
- package/lib/stability/registry-cleanup.js.map +1 -0
- package/lib/subagent-ai-events.d.ts +2 -2
- package/lib/subagent-ai-events.d.ts.map +1 -1
- package/lib/subagent-ai-events.js +5 -22
- package/lib/subagent-ai-events.js.map +1 -1
- package/lib/subagent-goal-notify.d.ts +4 -4
- package/lib/subagent-goal-notify.d.ts.map +1 -1
- package/lib/subagent-goal-notify.js +6 -5
- package/lib/subagent-goal-notify.js.map +1 -1
- package/lib/subagent.d.ts +3 -11
- package/lib/subagent.d.ts.map +1 -1
- package/lib/subagent.js +9 -9
- package/lib/subagent.js.map +1 -1
- package/lib/task-executor.d.ts +1 -0
- package/lib/task-executor.d.ts.map +1 -1
- package/lib/task-executor.js +27 -11
- package/lib/task-executor.js.map +1 -1
- package/lib/typing-indicator/adapter-integration.d.ts +22 -22
- package/lib/typing-indicator/adapter-integration.d.ts.map +1 -1
- package/lib/typing-indicator/adapter-integration.js +47 -47
- package/lib/typing-indicator/adapter-integration.js.map +1 -1
- package/lib/typing-indicator/index.d.ts +4 -2
- package/lib/typing-indicator/index.d.ts.map +1 -1
- package/lib/typing-indicator/index.js +11 -1
- package/lib/typing-indicator/index.js.map +1 -1
- package/lib/typing-indicator/integration.d.ts +8 -8
- package/lib/typing-indicator/integration.d.ts.map +1 -1
- package/lib/typing-indicator/integration.js +14 -14
- package/lib/typing-indicator/integration.js.map +1 -1
- package/lib/zhin-agent/agent-loop-standalone.d.ts +2 -2
- package/lib/zhin-agent/agent-loop-standalone.d.ts.map +1 -1
- package/lib/zhin-agent/agent-loop-standalone.js +5 -5
- package/lib/zhin-agent/agent-loop-standalone.js.map +1 -1
- package/lib/zhin-agent/agent-loop-turn.d.ts +4 -4
- package/lib/zhin-agent/agent-loop-turn.d.ts.map +1 -1
- package/lib/zhin-agent/agent-loop-turn.js +8 -8
- package/lib/zhin-agent/agent-loop-turn.js.map +1 -1
- package/lib/zhin-agent/builtin-tools.d.ts.map +1 -1
- package/lib/zhin-agent/compaction-runtime.d.ts +6 -2
- package/lib/zhin-agent/compaction-runtime.d.ts.map +1 -1
- package/lib/zhin-agent/compaction-runtime.js +25 -1
- package/lib/zhin-agent/compaction-runtime.js.map +1 -1
- package/lib/zhin-agent/config.d.ts +5 -5
- package/lib/zhin-agent/config.d.ts.map +1 -1
- package/lib/zhin-agent/config.js +2 -0
- package/lib/zhin-agent/config.js.map +1 -1
- package/lib/zhin-agent/deferred-delivery.d.ts +3 -3
- package/lib/zhin-agent/deferred-delivery.d.ts.map +1 -1
- package/lib/zhin-agent/deferred-delivery.js +5 -5
- package/lib/zhin-agent/deferred-delivery.js.map +1 -1
- package/lib/zhin-agent/event-emitter.d.ts +2 -2
- package/lib/zhin-agent/event-emitter.d.ts.map +1 -1
- package/lib/zhin-agent/event-emitter.js +7 -7
- package/lib/zhin-agent/event-emitter.js.map +1 -1
- package/lib/zhin-agent/index.d.ts +12 -12
- package/lib/zhin-agent/index.d.ts.map +1 -1
- package/lib/zhin-agent/index.js +60 -92
- package/lib/zhin-agent/index.js.map +1 -1
- package/lib/zhin-agent/model-resolver.d.ts.map +1 -1
- package/lib/zhin-agent/model-resolver.js +2 -0
- package/lib/zhin-agent/model-resolver.js.map +1 -1
- package/lib/zhin-agent/persist-deferred-context.d.ts +2 -2
- package/lib/zhin-agent/persist-deferred-context.d.ts.map +1 -1
- package/lib/zhin-agent/persist-deferred-context.js +3 -9
- package/lib/zhin-agent/persist-deferred-context.js.map +1 -1
- package/lib/zhin-agent/prompt-assembly.d.ts +5 -5
- package/lib/zhin-agent/prompt-assembly.d.ts.map +1 -1
- package/lib/zhin-agent/prompt-assembly.js +11 -11
- package/lib/zhin-agent/prompt-assembly.js.map +1 -1
- package/lib/zhin-agent/prompt-controller.d.ts +4 -3
- package/lib/zhin-agent/prompt-controller.d.ts.map +1 -1
- package/lib/zhin-agent/prompt-controller.js +14 -2
- package/lib/zhin-agent/prompt-controller.js.map +1 -1
- package/lib/zhin-agent/prompt-templates.d.ts +2 -0
- package/lib/zhin-agent/prompt-templates.d.ts.map +1 -1
- package/lib/zhin-agent/prompt-templates.js +11 -0
- package/lib/zhin-agent/prompt-templates.js.map +1 -1
- package/lib/zhin-agent/prompt.d.ts +8 -8
- package/lib/zhin-agent/prompt.d.ts.map +1 -1
- package/lib/zhin-agent/prompt.js +42 -54
- package/lib/zhin-agent/prompt.js.map +1 -1
- package/lib/zhin-agent/session-io.d.ts +8 -8
- package/lib/zhin-agent/session-io.d.ts.map +1 -1
- package/lib/zhin-agent/session-io.js +45 -30
- package/lib/zhin-agent/session-io.js.map +1 -1
- package/lib/zhin-agent/session-tree-commands.d.ts +3 -3
- package/lib/zhin-agent/session-tree-commands.d.ts.map +1 -1
- package/lib/zhin-agent/session-tree-commands.js +7 -19
- package/lib/zhin-agent/session-tree-commands.js.map +1 -1
- package/lib/zhin-agent/tool-orchestration.d.ts +3 -3
- package/lib/zhin-agent/tool-orchestration.d.ts.map +1 -1
- package/lib/zhin-agent/tool-orchestration.js +9 -15
- package/lib/zhin-agent/tool-orchestration.js.map +1 -1
- package/lib/zhin-agent/tool-runtime.d.ts +2 -2
- package/lib/zhin-agent/tool-runtime.d.ts.map +1 -1
- package/lib/zhin-agent/tool-runtime.js +2 -2
- package/lib/zhin-agent/tool-runtime.js.map +1 -1
- package/lib/zhin-agent/tool-search-orchestrator.d.ts +2 -2
- package/lib/zhin-agent/tool-search-orchestrator.d.ts.map +1 -1
- package/lib/zhin-agent/tool-search-orchestrator.js +9 -9
- package/lib/zhin-agent/tool-search-orchestrator.js.map +1 -1
- package/lib/zhin-agent/turn-pipeline.d.ts +4 -3
- package/lib/zhin-agent/turn-pipeline.d.ts.map +1 -1
- package/lib/zhin-agent/turn-pipeline.js +37 -59
- package/lib/zhin-agent/turn-pipeline.js.map +1 -1
- package/lib/zhin-agent/turn-user-message.d.ts +2 -2
- package/lib/zhin-agent/turn-user-message.d.ts.map +1 -1
- package/lib/zhin-agent/turn-user-message.js +2 -2
- package/lib/zhin-agent/turn-user-message.js.map +1 -1
- package/lib/zhin-agent/web-search-locale-attach.d.ts +2 -2
- package/lib/zhin-agent/web-search-locale-attach.d.ts.map +1 -1
- package/lib/zhin-agent/web-search-locale-attach.js +5 -4
- package/lib/zhin-agent/web-search-locale-attach.js.map +1 -1
- package/lib/zhin-agent/zhin-agent-private.d.ts +7 -7
- package/lib/zhin-agent/zhin-agent-private.d.ts.map +1 -1
- package/package.json +15 -5
- package/lib/security/bash-tool-context.d.ts +0 -20
- package/lib/security/bash-tool-context.d.ts.map +0 -1
- package/lib/security/bash-tool-context.js +0 -19
- package/lib/security/bash-tool-context.js.map +0 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { WEB_SEARCH_LOCALE_EXTRA_KEY, normalizeWebSearchLocaleHint, } from '../builtin/web-search-locale.js';
|
|
2
|
-
export async function attachWebSearchLocale(
|
|
3
|
-
const
|
|
2
|
+
export async function attachWebSearchLocale(commMessage, userId, userProfiles) {
|
|
3
|
+
const turn = commMessage;
|
|
4
|
+
const extra = { ...(turn.extra ?? {}) };
|
|
4
5
|
const existing = extra[WEB_SEARCH_LOCALE_EXTRA_KEY];
|
|
5
6
|
if (typeof existing === 'string' && existing.trim()) {
|
|
6
7
|
extra[WEB_SEARCH_LOCALE_EXTRA_KEY] = normalizeWebSearchLocaleHint(existing);
|
|
7
|
-
return { ...
|
|
8
|
+
return { ...commMessage, extra };
|
|
8
9
|
}
|
|
9
10
|
const [preferred, language] = await Promise.all([
|
|
10
11
|
userProfiles.get(userId, 'preferred_language'),
|
|
@@ -14,6 +15,6 @@ export async function attachWebSearchLocale(context, userId, userProfiles) {
|
|
|
14
15
|
if (hint) {
|
|
15
16
|
extra[WEB_SEARCH_LOCALE_EXTRA_KEY] = normalizeWebSearchLocaleHint(hint);
|
|
16
17
|
}
|
|
17
|
-
return { ...
|
|
18
|
+
return { ...commMessage, extra };
|
|
18
19
|
}
|
|
19
20
|
//# sourceMappingURL=web-search-locale-attach.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"web-search-locale-attach.js","sourceRoot":"","sources":["../../src/zhin-agent/web-search-locale-attach.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,
|
|
1
|
+
{"version":3,"file":"web-search-locale-attach.js","sourceRoot":"","sources":["../../src/zhin-agent/web-search-locale-attach.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,GAC7B,MAAM,iCAAiC,CAAC;AAEzC,MAAM,CAAC,KAAK,UAAU,qBAAqB,CACzC,WAAoB,EACpB,MAAc,EACd,YAA8B;IAE9B,MAAM,IAAI,GAAG,WAA+B,CAAC;IAC7C,MAAM,KAAK,GAA4B,EAAE,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC;IACjE,MAAM,QAAQ,GAAG,KAAK,CAAC,2BAA2B,CAAC,CAAC;IACpD,IAAI,OAAO,QAAQ,KAAK,QAAQ,IAAI,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC;QACpD,KAAK,CAAC,2BAA2B,CAAC,GAAG,4BAA4B,CAAC,QAAQ,CAAC,CAAC;QAC5E,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,EAAa,CAAC;IAC9C,CAAC;IACD,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CAAC;QAC9C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC;QAC9C,YAAY,CAAC,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC;KACrC,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,CAAC,SAAS,IAAI,QAAQ,CAAC,EAAE,IAAI,EAAE,CAAC;IAC7C,IAAI,IAAI,EAAE,CAAC;QACT,KAAK,CAAC,2BAA2B,CAAC,GAAG,4BAA4B,CAAC,IAAI,CAAC,CAAC;IAC1E,CAAC;IACD,OAAO,EAAE,GAAG,WAAW,EAAE,KAAK,EAAa,CAAC;AAC9C,CAAC"}
|
|
@@ -7,7 +7,7 @@ import type { OutputElement } from '@zhin.js/ai';
|
|
|
7
7
|
import type { AgentSessionStore, ContextRepository, IMSessionStore, ImTranscriptStore, MemoryAgentSessionStore, MemoryIMSessionStore } from '@zhin.js/ai';
|
|
8
8
|
import type { ModelRegistry } from '@zhin.js/ai';
|
|
9
9
|
import type { Plugin } from '@zhin.js/core';
|
|
10
|
-
import type { Tool,
|
|
10
|
+
import type { Tool, Message } from '../orchestrator/types.js';
|
|
11
11
|
import type { SkillRegistry } from '../orchestrator/skill-registry.js';
|
|
12
12
|
import type { AgentOrchestrator } from '../orchestrator/index.js';
|
|
13
13
|
import type { SubagentManager } from '../subagent.js';
|
|
@@ -63,26 +63,26 @@ export interface ZhinAgentPrivate {
|
|
|
63
63
|
finalizeActiveTurn(partial: Omit<ZhinAgentTurnMetrics, 'usage' | 'mainUsage' | 'subagentUsage'> & {
|
|
64
64
|
usage: Usage;
|
|
65
65
|
}): Promise<void>;
|
|
66
|
-
emitSessionNewEvent(sessionId: string,
|
|
67
|
-
emitSessionCompactEvent(sessionId: string,
|
|
66
|
+
emitSessionNewEvent(sessionId: string, commMessage: Message, mode: 'text' | 'multimodal', content: string, reply: string): void;
|
|
67
|
+
emitSessionCompactEvent(sessionId: string, commMessage: Message, mode: 'text' | 'multimodal', info: {
|
|
68
68
|
microSavedTokens: number;
|
|
69
69
|
autoSavedTokens: number;
|
|
70
70
|
totalTokensBefore: number;
|
|
71
71
|
totalTokensAfter: number;
|
|
72
72
|
}): void;
|
|
73
73
|
buildDisciplinedPrompt(basePrompt: string): string;
|
|
74
|
-
resolveAgentToolsForTurn(allTools: AgentTool[],
|
|
74
|
+
resolveAgentToolsForTurn(allTools: AgentTool[], commMessage: Message): {
|
|
75
75
|
tools: AgentTool[];
|
|
76
76
|
deferredStats?: string;
|
|
77
77
|
};
|
|
78
|
-
runDeferredWorker(goal: string, toolQuery: string | undefined,
|
|
78
|
+
runDeferredWorker(goal: string, toolQuery: string | undefined, commMessage: Message, allTools: AgentTool[]): Promise<string>;
|
|
79
79
|
getDeferredAutoContinueDepth(sessionKey: string): number;
|
|
80
80
|
resetDeferredAutoContinueDepth(sessionKey: string): void;
|
|
81
|
-
continueAfterDeferredWorker(
|
|
81
|
+
continueAfterDeferredWorker(commMessage: Message, taskId: string, goal: string, result: DeferredWorkerResult): Promise<void>;
|
|
82
82
|
}
|
|
83
83
|
export declare function asPrivate(agent: {
|
|
84
84
|
getTurnProvider(): AIProvider;
|
|
85
85
|
getActiveBinding(): ResolvedAgentBinding | null;
|
|
86
86
|
}): ZhinAgentPrivate;
|
|
87
|
-
export type { OnChunkCallback, OutputElement, Tool,
|
|
87
|
+
export type { OnChunkCallback, OutputElement, Tool, Message, Plugin, ContentPart };
|
|
88
88
|
//# sourceMappingURL=zhin-agent-private.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zhin-agent-private.d.ts","sourceRoot":"","sources":["../../src/zhin-agent/zhin-agent-private.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAC7E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EACV,iBAAiB,EACjB,iBAAiB,EACjB,cAAc,EACd,iBAAiB,EACjB,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,K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
|
{
|
|
2
2
|
"name": "@zhin.js/agent",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"description": "Zhin AI Agent — session, ZhinAgent, init; composes @zhin.js/core providers and tools",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./lib/index.js",
|
|
@@ -10,6 +10,16 @@
|
|
|
10
10
|
"types": "./lib/index.d.ts",
|
|
11
11
|
"development": "./src/index.ts",
|
|
12
12
|
"import": "./lib/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./config": {
|
|
15
|
+
"types": "./lib/config/index.d.ts",
|
|
16
|
+
"development": "./src/config/index.ts",
|
|
17
|
+
"import": "./lib/config/index.js"
|
|
18
|
+
},
|
|
19
|
+
"./task-executor": {
|
|
20
|
+
"types": "./lib/task-executor.d.ts",
|
|
21
|
+
"development": "./src/task-executor.ts",
|
|
22
|
+
"import": "./lib/task-executor.js"
|
|
13
23
|
}
|
|
14
24
|
},
|
|
15
25
|
"files": [
|
|
@@ -19,9 +29,9 @@
|
|
|
19
29
|
"he": "^1.2.0",
|
|
20
30
|
"zod": "^4.4.3",
|
|
21
31
|
"js-yaml": "^4.2.0",
|
|
22
|
-
"@zhin.js/ai": "1.1
|
|
23
|
-
"@zhin.js/core": "1.1
|
|
24
|
-
"@zhin.js/logger": "0.1.
|
|
32
|
+
"@zhin.js/ai": "1.2.1",
|
|
33
|
+
"@zhin.js/core": "1.2.1",
|
|
34
|
+
"@zhin.js/logger": "0.1.71"
|
|
25
35
|
},
|
|
26
36
|
"peerDependencies": {
|
|
27
37
|
"@modelcontextprotocol/sdk": "^1.29.0"
|
|
@@ -35,7 +45,7 @@
|
|
|
35
45
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
36
46
|
"@types/he": "^1.2.3",
|
|
37
47
|
"@types/js-yaml": "^4.0.9",
|
|
38
|
-
"@types/node": "^25.9.
|
|
48
|
+
"@types/node": "^25.9.2",
|
|
39
49
|
"rimraf": "^6.0.0",
|
|
40
50
|
"typescript": "^6.0.3"
|
|
41
51
|
},
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { ToolContext } from '@zhin.js/core';
|
|
2
|
-
export interface BashToolExecutionScope {
|
|
3
|
-
toolContext?: ToolContext;
|
|
4
|
-
/**
|
|
5
|
-
* Worker / 异步子 Agent 的执行上下文标记。
|
|
6
|
-
* 该标记本身不再决定审批行为;审批由各路径的 execApprovalMode 控制。
|
|
7
|
-
*/
|
|
8
|
-
directExecution?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function getCurrentBashToolContext(): ToolContext | undefined;
|
|
11
|
-
export declare function isDirectAgentExecution(): boolean;
|
|
12
|
-
export interface RunWithBashToolContextOptions {
|
|
13
|
-
directExecution?: boolean;
|
|
14
|
-
}
|
|
15
|
-
export declare function runWithBashToolContext<T>(ctx: ToolContext | undefined, fn: () => T, options?: RunWithBashToolContextOptions): T;
|
|
16
|
-
export declare function runWithBashToolContext<T>(ctx: ToolContext | undefined, fn: () => Promise<T>, options?: RunWithBashToolContextOptions): Promise<T>;
|
|
17
|
-
/** 子 Agent / Deferred Worker:在独立执行上下文中运行 bash(审批策略由 execApprovalMode 决定) */
|
|
18
|
-
export declare function runWithDirectAgentExecution<T>(ctx: ToolContext | undefined, fn: () => T): T;
|
|
19
|
-
export declare function runWithDirectAgentExecution<T>(ctx: ToolContext | undefined, fn: () => Promise<T>): Promise<T>;
|
|
20
|
-
//# sourceMappingURL=bash-tool-context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash-tool-context.d.ts","sourceRoot":"","sources":["../../src/security/bash-tool-context.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAEjD,MAAM,WAAW,sBAAsB;IACrC,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B;;;OAGG;IACH,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAID,wBAAgB,yBAAyB,IAAI,WAAW,GAAG,SAAS,CAEnE;AAED,wBAAgB,sBAAsB,IAAI,OAAO,CAEhD;AAED,MAAM,WAAW,6BAA6B;IAC5C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,EAAE,EAAE,MAAM,CAAC,EACX,OAAO,CAAC,EAAE,6BAA6B,GACtC,CAAC,CAAC;AACL,wBAAgB,sBAAsB,CAAC,CAAC,EACtC,GAAG,EAAE,WAAW,GAAG,SAAS,EAC5B,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,EACpB,OAAO,CAAC,EAAE,6BAA6B,GACtC,OAAO,CAAC,CAAC,CAAC,CAAC;AASd,4EAA4E;AAC5E,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;AAC7F,wBAAgB,2BAA2B,CAAC,CAAC,EAAE,GAAG,EAAE,WAAW,GAAG,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 在 @zhin.js/ai Agent 执行工具期间挂载当前 {@link ToolContext},
|
|
3
|
-
* 供 {@link checkExecPolicy} 等无法从 `tool.execute(args)` 拿到上下文的模块读取(如 icqq bash 放行规则)。
|
|
4
|
-
*/
|
|
5
|
-
import { AsyncLocalStorage } from 'node:async_hooks';
|
|
6
|
-
const als = new AsyncLocalStorage();
|
|
7
|
-
export function getCurrentBashToolContext() {
|
|
8
|
-
return als.getStore()?.toolContext;
|
|
9
|
-
}
|
|
10
|
-
export function isDirectAgentExecution() {
|
|
11
|
-
return als.getStore()?.directExecution === true;
|
|
12
|
-
}
|
|
13
|
-
export function runWithBashToolContext(ctx, fn, options) {
|
|
14
|
-
return als.run({ toolContext: ctx, directExecution: options?.directExecution }, fn);
|
|
15
|
-
}
|
|
16
|
-
export function runWithDirectAgentExecution(ctx, fn) {
|
|
17
|
-
return runWithBashToolContext(ctx, fn, { directExecution: true });
|
|
18
|
-
}
|
|
19
|
-
//# sourceMappingURL=bash-tool-context.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bash-tool-context.js","sourceRoot":"","sources":["../../src/security/bash-tool-context.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAYrD,MAAM,GAAG,GAAG,IAAI,iBAAiB,EAAsC,CAAC;AAExE,MAAM,UAAU,yBAAyB;IACvC,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC;AACrC,CAAC;AAED,MAAM,UAAU,sBAAsB;IACpC,OAAO,GAAG,CAAC,QAAQ,EAAE,EAAE,eAAe,KAAK,IAAI,CAAC;AAClD,CAAC;AAgBD,MAAM,UAAU,sBAAsB,CACpC,GAA4B,EAC5B,EAAwB,EACxB,OAAuC;IAEvC,OAAO,GAAG,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,EAAE,EAAE,CAAC,CAAC;AACtF,CAAC;AAKD,MAAM,UAAU,2BAA2B,CACzC,GAA4B,EAC5B,EAAwB;IAExB,OAAO,sBAAsB,CAAC,GAAG,EAAE,EAAE,EAAE,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;AACpE,CAAC"}
|