aws-runtime-bridge 1.9.175 → 1.9.179
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/CHANGELOG.md +188 -0
- package/README.md +61 -2
- package/dist/adapter/AcodeSdkAdapter.d.ts +369 -0
- package/dist/adapter/AcodeSdkAdapter.js +2 -2
- package/dist/adapter/AdapterRegistry.d.ts +28 -0
- package/dist/adapter/ClaudeSdkAdapter.d.ts +71 -0
- package/dist/adapter/CodexSdkAdapter.d.ts +14 -0
- package/dist/adapter/OpencodeSdkAdapter.d.ts +44 -0
- package/dist/adapter/acode-tool-names.d.ts +9 -0
- package/dist/adapter/idle-poll-loop.d.ts +20 -0
- package/dist/adapter/index.d.ts +3 -0
- package/dist/adapter/instance-ai-config-resolver.d.ts +20 -0
- package/dist/adapter/prompts.d.ts +12 -0
- package/dist/adapter/types.d.ts +182 -0
- package/dist/browser/browser-bootstrap.d.ts +15 -0
- package/dist/browser/browser-connect-token.d.ts +11 -0
- package/dist/browser/browser-frame-encode.d.ts +32 -0
- package/dist/browser/browser-pool.d.ts +129 -0
- package/dist/browser/browser-profile-store.d.ts +41 -0
- package/dist/browser/browser-ws-bridge.d.ts +20 -0
- package/dist/browser/built-in-browser-tools.d.ts +44 -0
- package/dist/browser/element-locator.d.ts +25 -0
- package/dist/browser/element-picker.d.ts +30 -0
- package/dist/browser/frame-encode.d.ts +19 -0
- package/dist/browser/input-dispatcher.d.ts +35 -0
- package/dist/browser/listener-store.d.ts +44 -0
- package/dist/browser/page-listener-manager.d.ts +88 -0
- package/dist/browser/page-listener-types.d.ts +38 -0
- package/dist/browser/screencast-differ.d.ts +10 -0
- package/dist/browser/screencast-manager.d.ts +94 -0
- package/dist/browser/snapshot-serializer.d.ts +56 -0
- package/dist/browser/ssrf-guard.d.ts +44 -0
- package/dist/browser/stealth.d.ts +21 -0
- package/dist/browser/step-archive.d.ts +13 -0
- package/dist/browser/types.d.ts +100 -0
- package/dist/browser/ws-server.d.ts +54 -0
- package/dist/config.d.ts +138 -2
- package/dist/config.js +2 -2
- package/dist/desktop/built-in-desktop-tools.d.ts +68 -0
- package/dist/desktop/built-in-desktop-tools.js +2 -1
- package/dist/desktop/desktop-control.d.ts +142 -0
- package/dist/desktop/desktop-control.js +2 -0
- package/dist/desktop/desktop-mcp-client.d.ts +28 -0
- package/dist/desktop/desktop-staleness.d.ts +66 -0
- package/dist/desktop/desktop-staleness.js +2 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.js +1 -1
- package/dist/middleware/auth.d.ts +26 -0
- package/dist/middleware/auth.js +1 -1
- package/dist/remote-desktop/computer-control.d.ts +3 -0
- package/dist/remote-desktop/coords.d.ts +6 -0
- package/dist/remote-desktop/frame-backpressure.d.ts +10 -0
- package/dist/remote-desktop/frame-encode.d.ts +3 -0
- package/dist/remote-desktop/index.js +2 -2
- package/dist/remote-desktop/input-dispatcher.d.ts +4 -0
- package/dist/remote-desktop/permission-manager.d.ts +3 -0
- package/dist/remote-desktop/screen-capture.d.ts +91 -0
- package/dist/remote-desktop/session-manager.d.ts +47 -0
- package/dist/remote-desktop/session-manager.js +1 -1
- package/dist/remote-desktop/system-backend.d.ts +64 -0
- package/dist/remote-desktop/types.d.ts +25 -0
- package/dist/remote-desktop/ui-automation.d.ts +11 -0
- package/dist/remote-desktop/win32-api.d.ts +10 -0
- package/dist/routes/acode-todos.d.ts +13 -0
- package/dist/routes/agent-state.d.ts +15 -0
- package/dist/routes/ai-sources.js +1 -1
- package/dist/routes/background-tasks.d.ts +18 -0
- package/dist/routes/background-tasks.js +2 -2
- package/dist/routes/browser-listeners.d.ts +17 -0
- package/dist/routes/browser-sessions.d.ts +10 -0
- package/dist/routes/capabilities.js +1 -1
- package/dist/routes/dashboard-icon.d.ts +9 -0
- package/dist/routes/dashboard-icon.js +2 -0
- package/dist/routes/dashboard-theme.d.ts +24 -0
- package/dist/routes/dashboard-theme.js +157 -0
- package/dist/routes/dashboard.d.ts +9 -0
- package/dist/routes/dashboard.js +1988 -625
- package/dist/routes/debug-mount.d.ts +16 -0
- package/dist/routes/desktop-control.d.ts +15 -0
- package/dist/routes/desktop-control.js +2 -0
- package/dist/routes/events.d.ts +4 -0
- package/dist/routes/file-browser.d.ts +11 -0
- package/dist/routes/file-change-diff.d.ts +25 -0
- package/dist/routes/file-diff-rollback.d.ts +28 -0
- package/dist/routes/file-snapshot.d.ts +7 -0
- package/dist/routes/git.d.ts +143 -0
- package/dist/routes/instance-tool-status.d.ts +5 -0
- package/dist/routes/instance.d.ts +8 -0
- package/dist/routes/instance.js +1 -1
- package/dist/routes/jdks.d.ts +4 -0
- package/dist/routes/launch.d.ts +5 -0
- package/dist/routes/lsp-providers.d.ts +11 -0
- package/dist/routes/lsp-providers.js +2 -0
- package/dist/routes/lsp.d.ts +41 -0
- package/dist/routes/lsp.js +4 -2
- package/dist/routes/mcp-extra.d.ts +15 -0
- package/dist/routes/mcp.d.ts +16 -0
- package/dist/routes/mcp.js +1 -1
- package/dist/routes/plugins.d.ts +19 -0
- package/dist/routes/plugins.js +1 -1
- package/dist/routes/processes.d.ts +4 -0
- package/dist/routes/properties.d.ts +4 -0
- package/dist/routes/pty.d.ts +29 -0
- package/dist/routes/runtime-binding.d.ts +3 -0
- package/dist/routes/sessions.d.ts +22 -0
- package/dist/routes/skills.d.ts +15 -0
- package/dist/routes/skills.js +1 -1
- package/dist/routes/sub-agents.d.ts +11 -0
- package/dist/routes/sub-agents.js +1 -1
- package/dist/routes/task-context.d.ts +5 -0
- package/dist/routes/tech-stack.d.ts +4 -0
- package/dist/routes/terminal.d.ts +122 -0
- package/dist/routes/terminal.js +16 -16
- package/dist/routes/workspace-index.d.ts +12 -0
- package/dist/routes/workspace-index.js +2 -0
- package/dist/routes/yml.d.ts +4 -0
- package/dist/scripts/migrate-user-scopes.d.ts +26 -0
- package/dist/scripts/migrate-user-scopes.js +2 -0
- package/dist/services/access-control.d.ts +21 -0
- package/dist/services/acode-bg-manager.d.ts +21 -0
- package/dist/services/acode-package.d.ts +10 -0
- package/dist/services/acode-package.js +1 -1
- package/dist/services/agent-capability-sync.d.ts +26 -0
- package/dist/services/agent-capability-sync.js +1 -1
- package/dist/services/agent-event-store.d.ts +20 -0
- package/dist/services/agent-ownership.d.ts +58 -0
- package/dist/services/agent-ownership.js +3 -0
- package/dist/services/agent-process-manager.d.ts +154 -0
- package/dist/services/agent-pty-manager.d.ts +37 -0
- package/dist/services/agent-startup-memory.d.ts +34 -0
- package/dist/services/agent-startup-memory.js +1 -1
- package/dist/services/ai-config-service.d.ts +26 -52
- package/dist/services/ai-config-service.js +1 -3
- package/dist/services/ai-source-apply.d.ts +7 -15
- package/dist/services/ai-source-apply.js +1 -1
- package/dist/services/auto-register.d.ts +165 -1
- package/dist/services/auto-register.js +1 -1
- package/dist/services/aws-client-agent-mcp.d.ts +14 -0
- package/dist/services/aws-client-agent-mcp.js +2 -2
- package/dist/services/bridge-package-publish-hooks.d.ts +14 -0
- package/dist/services/bridge-pairing.d.ts +82 -0
- package/dist/services/bridge-pairing.js +2 -0
- package/dist/services/bridge-temp-files.d.ts +29 -0
- package/dist/services/browser-session-manager.d.ts +71 -0
- package/dist/services/capability-config.d.ts +60 -15
- package/dist/services/capability-config.js +2 -2
- package/dist/services/change-cache-retention.d.ts +9 -0
- package/dist/services/changelog.d.ts +9 -0
- package/dist/services/cli-commands.d.ts +82 -0
- package/dist/services/cli-commands.js +6 -6
- package/dist/services/connection-key-rotation.d.ts +27 -0
- package/dist/services/connection-key-rotation.js +2 -0
- package/dist/services/debug-mount.d.ts +49 -0
- package/dist/services/desktop-mcp-manager.d.ts +103 -1
- package/dist/services/desktop-mcp-manager.js +1 -1
- package/dist/services/event-delta-pusher.d.ts +15 -0
- package/dist/services/fileSnapshotStore.d.ts +33 -0
- package/dist/services/gitignore.d.ts +9 -0
- package/dist/services/instance-ai-config-service.d.ts +9 -0
- package/dist/services/instance-ai-config-service.js +1 -1
- package/dist/services/instance-features.d.ts +127 -0
- package/dist/services/instance-features.js +1 -1
- package/dist/services/instance-init-service.d.ts +3 -0
- package/dist/services/instance-init-service.js +1 -1
- package/dist/services/instance-state.d.ts +23 -0
- package/dist/services/jdk-scanner.d.ts +15 -0
- package/dist/services/launch-manager.d.ts +138 -0
- package/dist/services/launch-metrics.d.ts +42 -0
- package/dist/services/launch-streams.d.ts +19 -0
- package/dist/services/lifecycle-state.d.ts +5 -0
- package/dist/services/log-retention.d.ts +38 -0
- package/dist/services/lsp/install-manager.d.ts +55 -0
- package/dist/services/lsp/install-manager.js +2 -0
- package/dist/services/lsp/provider-registry.d.ts +108 -0
- package/dist/services/lsp/provider-registry.js +2 -0
- package/dist/services/lsp/uri-rewrite.d.ts +44 -0
- package/dist/services/lsp/uri-rewrite.js +2 -0
- package/dist/services/lsp-stdio-bridge.d.ts +41 -4
- package/dist/services/lsp-stdio-bridge.js +3 -3
- package/dist/services/mcp-deploy.d.ts +45 -4
- package/dist/services/mcp-deploy.js +4 -4
- package/dist/services/mcp-env-injector.d.ts +52 -0
- package/dist/services/mcp-launch-binding-queue.d.ts +12 -0
- package/dist/services/mcp-package.d.ts +22 -0
- package/dist/services/mcp-package.js +1 -1
- package/dist/services/mcp-probe-client.d.ts +19 -0
- package/dist/services/mcp-probe-client.js +1 -1
- package/dist/services/open-doc-events.d.ts +22 -0
- package/dist/services/open-doc-registry.d.ts +35 -0
- package/dist/services/orphan-monitor.d.ts +43 -0
- package/dist/services/panel-auth.d.ts +24 -0
- package/dist/services/panel-env.d.ts +28 -0
- package/dist/services/plugin-deployment.d.ts +34 -1
- package/dist/services/plugin-deployment.js +2 -2
- package/dist/services/plugin-event-buffer.d.ts +21 -0
- package/dist/services/plugin-fs.d.ts +11 -0
- package/dist/services/plugin-handler-adapter.d.ts +13 -0
- package/dist/services/plugin-listener-runner.d.ts +10 -0
- package/dist/services/plugin-loader.d.ts +15 -0
- package/dist/services/plugin-manager.d.ts +95 -9
- package/dist/services/plugin-manager.js +4 -4
- package/dist/services/plugin-manifest.d.ts +14 -0
- package/dist/services/plugin-package.d.ts +13 -0
- package/dist/services/plugin-runtime.d.ts +15 -0
- package/dist/services/port-detector.d.ts +15 -0
- package/dist/services/process-detail.d.ts +3 -0
- package/dist/services/process-detector.d.ts +132 -0
- package/dist/services/process-registry.d.ts +120 -0
- package/dist/services/process-top.d.ts +6 -0
- package/dist/services/request-identity.d.ts +77 -0
- package/dist/services/request-identity.js +2 -0
- package/dist/services/request-invalid-dump.d.ts +4 -0
- package/dist/services/ring-buffer.d.ts +33 -0
- package/dist/services/runtime-binding.d.ts +56 -4
- package/dist/services/runtime-binding.js +4 -4
- package/dist/services/runtime-lifecycle-policy.d.ts +17 -0
- package/dist/services/runtime-resources-snapshot.d.ts +26 -0
- package/dist/services/sdk-tool-file-change-recorder.d.ts +9 -0
- package/dist/services/session-output.d.ts +63 -0
- package/dist/services/session-output.js +3 -3
- package/dist/services/skill-manager.d.ts +42 -5
- package/dist/services/skill-manager.js +3 -3
- package/dist/services/snapshot-retention.d.ts +23 -0
- package/dist/services/startup-config-wizard.d.ts +7 -1
- package/dist/services/startup-config-wizard.js +10 -10
- package/dist/services/system-metrics.d.ts +3 -0
- package/dist/services/tech-stack-scanner.d.ts +12 -0
- package/dist/services/terminal-persistence.d.ts +43 -0
- package/dist/services/tool-installer.d.ts +12 -0
- package/dist/services/tunnel-client.d.ts +57 -2
- package/dist/services/tunnel-client.js +1 -1
- package/dist/services/update-log.d.ts +6 -0
- package/dist/services/update-notifier.d.ts +17 -0
- package/dist/services/update-notifier.js +2 -2
- package/dist/services/user-scope.d.ts +115 -0
- package/dist/services/user-scope.js +2 -0
- package/dist/services/windows-service-manager.d.ts +12 -0
- package/dist/services/workspace-files.d.ts +64 -0
- package/dist/services/workspace-index/index-manager.d.ts +46 -0
- package/dist/services/workspace-index/index-manager.js +2 -0
- package/dist/services/workspace-index/indexer.d.ts +15 -0
- package/dist/services/workspace-index/indexer.js +2 -0
- package/dist/services/workspace-index/query.d.ts +74 -0
- package/dist/services/workspace-index/query.js +5 -0
- package/dist/services/workspace-index/resolver.d.ts +26 -0
- package/dist/services/workspace-index/resolver.js +2 -0
- package/dist/services/workspace-index/types.d.ts +89 -0
- package/dist/services/workspace-index/types.js +2 -0
- package/dist/services/workspace-watch.d.ts +4 -0
- package/dist/services/workspaceTaskChangeWatcher.d.ts +49 -0
- package/dist/services/workspaceTaskChangeWatcher.js +1 -1
- package/dist/types.d.ts +9 -0
- package/dist/utils/config-write-queue.d.ts +11 -0
- package/dist/utils/env-safety.d.ts +21 -0
- package/dist/utils/file-utils.d.ts +15 -0
- package/dist/utils/instance-ai-config-debug-logger.d.ts +15 -0
- package/dist/utils/lifecycle-log.d.ts +5 -0
- package/dist/utils/logger.d.ts +13 -0
- package/dist/utils/logger.js +2 -1
- package/dist/utils/npm-version.d.ts +10 -0
- package/dist/utils/path-utils.d.ts +12 -0
- package/dist/utils/scheduler-url.d.ts +18 -0
- package/dist/utils/scheduler-url.js +2 -0
- package/dist/utils/sdk-package-loader.d.ts +13 -0
- package/dist/utils/sdk-package-loader.js +1 -1
- package/dist/utils/target-identity.d.ts +31 -0
- package/dist/utils/target-identity.js +2 -0
- package/dist/utils/validation.d.ts +17 -0
- package/dist/utils/yaml-utils.d.ts +48 -0
- package/package/acode/dist/__tests__/summary-request-helper.d.ts +10 -0
- package/package/acode/dist/ask-user-question-tool.d.ts +17 -0
- package/package/acode/dist/await-complete-tool.d.ts +12 -0
- package/package/acode/dist/background-command-manager.d.ts +105 -0
- package/package/acode/dist/background-command-store.d.ts +27 -0
- package/package/acode/dist/background-command-tools.d.ts +8 -0
- package/package/acode/dist/background-output-ringbuffer.d.ts +15 -0
- package/package/acode/dist/built-in-file-tools.d.ts +65 -0
- package/package/acode/dist/built-in-symbols-tool.d.ts +3 -0
- package/package/acode/dist/builtins/commandArtifacts.d.ts +3 -0
- package/package/acode/dist/builtins/shellCommandPreparation.d.ts +17 -0
- package/package/acode/dist/builtins/shellCommandRunner.d.ts +4 -0
- package/package/acode/dist/builtins/shellOutputDecoder.d.ts +15 -0
- package/package/acode/dist/cache-control.d.ts +45 -0
- package/package/acode/dist/commands/commandLoader.d.ts +3 -0
- package/package/acode/dist/commands/commandParser.d.ts +3 -0
- package/package/acode/dist/commands/commandRegistry.d.ts +3 -0
- package/package/acode/dist/compaction.d.ts +354 -0
- package/package/acode/dist/config.d.ts +3 -0
- package/package/acode/dist/context-overflow.d.ts +32 -0
- package/package/acode/dist/fs-utils.d.ts +18 -0
- package/package/acode/dist/hooks/hookBus.d.ts +3 -0
- package/package/acode/dist/image-utils.d.ts +35 -0
- package/package/acode/dist/index.d.ts +1 -0
- package/package/acode/dist/index.js +1 -1
- package/package/acode/dist/mcpToolNames.d.ts +32 -0
- package/package/acode/dist/microcompact.d.ts +53 -0
- package/package/acode/dist/parsers/ast-cache.d.ts +41 -0
- package/package/acode/dist/parsers/file-index.d.ts +83 -0
- package/package/acode/dist/parsers/file-index.js +4 -0
- package/package/acode/dist/parsers/language-detector.d.ts +4 -0
- package/package/acode/dist/parsers/tree-sitter-loader.d.ts +12 -0
- package/package/acode/dist/parsers/types.d.ts +11 -0
- package/package/acode/dist/paths.d.ts +14 -0
- package/package/acode/dist/plugin-types.d.ts +34 -0
- package/package/acode/dist/read-file-state.d.ts +15 -0
- package/package/acode/dist/runtime-environment.d.ts +16 -0
- package/package/acode/dist/runtime.d.ts +824 -9
- package/package/acode/dist/runtime.js +21 -21
- package/package/acode/dist/skill-tool.d.ts +20 -0
- package/package/acode/dist/sub-agent-manager.d.ts +169 -0
- package/package/acode/dist/sub-agent-manager.js +1 -1
- package/package/acode/dist/sub-agent-store.d.ts +50 -0
- package/package/acode/dist/sub-agent-tools.d.ts +15 -0
- package/package/acode/dist/sub-agent-types.d.ts +13 -0
- package/package/acode/dist/terminal-tool.d.ts +15 -0
- package/package/acode/dist/terminal-types.d.ts +10 -0
- package/package/acode/dist/todo-store.d.ts +15 -0
- package/package/acode/dist/token-estimator.d.ts +17 -0
- package/package/acode/dist/tool-allocation.d.ts +113 -0
- package/package/acode/dist/tool-concurrency/index.d.ts +8 -0
- package/package/acode/dist/tool-concurrency/observability.d.ts +32 -0
- package/package/acode/dist/tool-concurrency/resource-lock.d.ts +30 -0
- package/package/acode/dist/tool-concurrency/scheduler.d.ts +19 -0
- package/package/acode/dist/tool-concurrency/types.d.ts +57 -0
- package/package/acode/dist/tool-group-manager.d.ts +195 -0
- package/package/acode/dist/tool-group-manager.js +4 -4
- package/package/acode/dist/types.d.ts +179 -0
- package/package/aws-client-agent-mcp/README.md +130 -215
- package/package/aws-client-agent-mcp/dist/ability-market-tools.d.ts +57 -0
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +277 -3
- package/package/aws-client-agent-mcp/dist/agent-client.js +1 -1
- package/package/aws-client-agent-mcp/dist/config.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/constants.d.ts +2 -0
- package/package/aws-client-agent-mcp/dist/context-manager.d.ts +70 -0
- package/package/aws-client-agent-mcp/dist/http-client.d.ts +61 -0
- package/package/aws-client-agent-mcp/dist/index.d.ts +10 -0
- package/package/aws-client-agent-mcp/dist/logger.d.ts +24 -0
- package/package/aws-client-agent-mcp/dist/mcp-server.d.ts +606 -1
- package/package/aws-client-agent-mcp/dist/mcp-server.js +4 -4
- package/package/aws-client-agent-mcp/dist/mcp-tools.d.ts +158 -0
- package/package/aws-client-agent-mcp/dist/mcp-tools.js +38 -22
- package/package/aws-client-agent-mcp/dist/memory-store.d.ts +81 -0
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/message-buffer.d.ts +86 -0
- package/package/aws-client-agent-mcp/dist/messageContent.d.ts +24 -0
- package/package/aws-client-agent-mcp/dist/office/office-equation.d.ts +19 -0
- package/package/aws-client-agent-mcp/dist/office/office-image.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/office/office-workspace.d.ts +29 -0
- package/package/aws-client-agent-mcp/dist/parent-lifecycle.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/runtime-launch-binding.d.ts +6 -0
- package/package/aws-client-agent-mcp/dist/server-memory-store.d.ts +4 -0
- package/package/aws-client-agent-mcp/dist/status-reporter.d.ts +41 -0
- package/package/aws-client-agent-mcp/dist/tool-groups.d.ts +136 -0
- package/package/aws-client-agent-mcp/dist/types.d.ts +123 -0
- package/package/aws-client-agent-mcp/dist/watchdog.d.ts +7 -0
- package/package/aws-client-agent-mcp/dist/websocket-client.d.ts +108 -0
- package/package.json +1 -1
|
@@ -1,8 +1,28 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
2
21
|
import { type ACodeCommandSpec, type ACodePluginBridge, type PluginInvokeContext, type PluginManageRequest, type PluginManageResult, type PluginSummary, type PluginToolInvocationResult, type PluginToolSchema, type JsonObject } from "@agentswork/acode";
|
|
3
22
|
import { type PluginEventMessage } from "./plugin-event-buffer.js";
|
|
4
23
|
export { isValidPluginName, validateManifest, validateAgainstSchema, renderCommandArgv, } from "./plugin-manifest.js";
|
|
5
24
|
export type { PluginUserConfigField, PluginHandlerDef, PluginToolDef, PluginTransportDef, PluginListenerDef, PluginManifest, } from "./plugin-manifest.js";
|
|
25
|
+
import { type UserScope } from "./user-scope.js";
|
|
6
26
|
export type { ListenerRuntime, LoadedPlugin, InstalledRecord, AgentState, SharedPluginEntry, } from "./plugin-runtime.js";
|
|
7
27
|
export interface PluginManagerOptions {
|
|
8
28
|
|
|
@@ -12,15 +32,33 @@ export interface PluginManagerOptions {
|
|
|
12
32
|
}
|
|
13
33
|
export declare class PluginManager {
|
|
14
34
|
private agents;
|
|
15
|
-
private readonly rootDir
|
|
35
|
+
private readonly rootDir?;
|
|
16
36
|
private readonly runtimeRootDir?;
|
|
17
37
|
|
|
38
|
+
private readonly deployStores;
|
|
39
|
+
|
|
18
40
|
private readonly listeners;
|
|
19
41
|
|
|
20
42
|
private readonly loader;
|
|
21
|
-
|
|
22
|
-
private readonly deploy;
|
|
23
43
|
constructor(options?: PluginManagerOptions);
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
private deployForScope;
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
private deployForAgent;
|
|
54
|
+
|
|
55
|
+
private get deploy();
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
private dataRootForAgent;
|
|
24
62
|
forAgent(agentId: string): ACodePluginBridge;
|
|
25
63
|
|
|
26
64
|
setOnPluginsChanged(cb: (agentId: string) => void): void;
|
|
@@ -38,6 +76,15 @@ export declare class PluginManager {
|
|
|
38
76
|
|
|
39
77
|
getPluginTools(agentId: string, pluginName: string): Promise<PluginToolSchema[]>;
|
|
40
78
|
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
41
88
|
debugMountPlugin(agentId: string, dir: string, config?: Record<string, string>): Promise<PluginManageResult>;
|
|
42
89
|
|
|
43
90
|
listDebugPlugins(agentId: string): Promise<PluginSummary[]>;
|
|
@@ -48,6 +95,9 @@ export declare class PluginManager {
|
|
|
48
95
|
private doManage;
|
|
49
96
|
private installPlugin;
|
|
50
97
|
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
51
101
|
installFromZip(agentId: string, zipBuffer: Buffer, originalName: string, config?: Record<string, string>): Promise<PluginManageResult>;
|
|
52
102
|
|
|
53
103
|
private installFromDirectory;
|
|
@@ -55,7 +105,11 @@ export declare class PluginManager {
|
|
|
55
105
|
private reloadPlugin;
|
|
56
106
|
private setEnabled;
|
|
57
107
|
|
|
58
|
-
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
saveSharedPlugin(zipBuffer: Buffer, originalName: string, defaultEnabled?: boolean, sha256?: string, scope?: UserScope): Promise<{
|
|
59
113
|
ok: boolean;
|
|
60
114
|
error?: string;
|
|
61
115
|
pluginName?: string;
|
|
@@ -63,7 +117,7 @@ export declare class PluginManager {
|
|
|
63
117
|
|
|
64
118
|
private suspendDeployedPluginAcrossAgents;
|
|
65
119
|
|
|
66
|
-
applySharedToKnownAgents(): Promise<Array<{
|
|
120
|
+
applySharedToKnownAgents(scope?: UserScope): Promise<Array<{
|
|
67
121
|
agentId: string;
|
|
68
122
|
installed: string[];
|
|
69
123
|
}>>;
|
|
@@ -76,14 +130,31 @@ export declare class PluginManager {
|
|
|
76
130
|
|
|
77
131
|
private backgroundTemplatePulls;
|
|
78
132
|
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
79
138
|
private pullTemplatePluginsFromCapabilities;
|
|
80
139
|
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
81
143
|
private queueTemplatePull;
|
|
82
144
|
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
|
|
83
150
|
private syncSharedIntoState;
|
|
84
151
|
|
|
85
152
|
private cleanupRuntimeDir;
|
|
86
153
|
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
|
|
87
158
|
applyCapabilities(agentId: string): Promise<void>;
|
|
88
159
|
drainEvents(agentId: string, opts?: {
|
|
89
160
|
maxPerKey?: number;
|
|
@@ -92,6 +163,8 @@ export declare class PluginManager {
|
|
|
92
163
|
events: PluginEventMessage[];
|
|
93
164
|
}>;
|
|
94
165
|
|
|
166
|
+
|
|
167
|
+
|
|
95
168
|
private pushDeprecatedNotice;
|
|
96
169
|
|
|
97
170
|
enqueueExternalEvent(agentId: string, pluginName: string, payload: Record<string, unknown>): Promise<{
|
|
@@ -100,6 +173,10 @@ export declare class PluginManager {
|
|
|
100
173
|
}>;
|
|
101
174
|
private agentState;
|
|
102
175
|
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
179
|
+
|
|
103
180
|
private hydrate;
|
|
104
181
|
private doHydrate;
|
|
105
182
|
private installedFile;
|
|
@@ -112,6 +189,10 @@ export declare class PluginManager {
|
|
|
112
189
|
|
|
113
190
|
private readSecrets;
|
|
114
191
|
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
115
196
|
private persistSecrets;
|
|
116
197
|
|
|
117
198
|
private ensureListenersRunning;
|
|
@@ -129,7 +210,9 @@ export declare class PluginManager {
|
|
|
129
210
|
|
|
130
211
|
stopAll(): Promise<void>;
|
|
131
212
|
|
|
132
|
-
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
listDeployed(scope?: UserScope): Promise<Array<{
|
|
133
216
|
pluginName: string;
|
|
134
217
|
version?: string;
|
|
135
218
|
fileName: string;
|
|
@@ -138,13 +221,16 @@ export declare class PluginManager {
|
|
|
138
221
|
deployed: boolean;
|
|
139
222
|
}>>;
|
|
140
223
|
|
|
141
|
-
deployedDefaultEnabled(): Record<string, boolean>;
|
|
224
|
+
deployedDefaultEnabled(scope?: UserScope): Record<string, boolean>;
|
|
142
225
|
|
|
143
|
-
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
removeDeployedPlugin(pluginName: string, scope?: UserScope): Promise<{
|
|
144
230
|
ok: boolean;
|
|
145
231
|
error?: string;
|
|
146
232
|
}>;
|
|
147
233
|
}
|
|
148
234
|
|
|
149
235
|
export declare const pluginManager: PluginManager;
|
|
150
|
-
export declare const reconcilePluginsDefaultsFromDeployed: () => number;
|
|
236
|
+
export declare const reconcilePluginsDefaultsFromDeployed: (scope: UserScope) => number;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import{existsSync as y,mkdirSync as D,readFileSync as S,readdirSync as I,rmSync as C,writeFileSync as $}from"node:fs";import{dirname as A,join as h}from"node:path";import{parseAcodeCommandMarkdown as F}from"@agentswork/acode";import{getBridgeTemplatePluginsDir as L}from"../config.js";import{sanitizeAgentId as v,downloadPluginZip as O,sanitizeArchiveFileName as R}from"../utils/file-utils.js";import{createLogger as M}from"../utils/logger.js";import{setDeployedDefaultsProvider as j,reconcileDefaultsFromDeployed as T}from"./capability-config.js";import{executeHandler as x}from"./plugin-handler-adapter.js";import{isCapabilityEnabled as z,getAgentPluginSources as q}from"./instance-features.js";import{PluginEventBuffer as V}from"./plugin-event-buffer.js";import{ListenerRunner as H}from"./plugin-listener-runner.js";import{PluginLoader as J,toSummary as w}from"./plugin-loader.js";import{extractPluginZip as E}from"./plugin-package.js";import{isRecord as k,isValidPluginName as K,validateAgainstSchema as W}from"./plugin-manifest.js";import{movePluginDir as N,rmWithRetry as P}from"./plugin-fs.js";import{PluginDeploymentStore as U}from"./plugin-deployment.js";import{isValidPluginName as pe,validateManifest as me,validateAgainstSchema as ye,renderCommandArgv as Se}from"./plugin-manifest.js";const u=M("plugin-manager");class Z{constructor(e={}){this.agents=new Map,this.listeners=new H,this.loader=new J,this.templatePullInFlight=new Set,this.backgroundTemplatePulls=new Set,this.rootDir=e.rootDir??L(),this.runtimeRootDir=e.runtimeRootDir,this.deploy=new U(this.rootDir,this.runtimeRootDir,this.loader)}forAgent(e){return{listPlugins:()=>this.list(e),getPluginTools:t=>this.getPluginTools(e,t),invokeTool:(t,s,n,i)=>this.invokeTool(e,t,s,n,i),manage:t=>this.manage(e,t),getCommandDirs:()=>this.getCommandDirs(e)}}setOnPluginsChanged(e){this.onPluginsChanged=e}notifyPluginsChanged(e){try{this.onPluginsChanged?.(e)}catch(t){u.warn("[agent:%s] onPluginsChanged \u56DE\u8C03\u5931\u8D25: %s",e,t instanceof Error?t.message:String(t))}}async getCommandDirs(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.enabled&&s.commandDir).map(s=>s.commandDir)}async getPluginCommands(e){const t=await this.hydrate(e),s=[];for(const n of t.plugins.values())!n.enabled||!n.commandDir||s.push(...this.parsePluginCommandDir(n));return s}parsePluginCommandDir(e){return this.parseCommandDir(e.name,e.commandDir)}parseCommandDir(e,t){const s=[];if(!t)return s;try{for(const n of I(t)){if(!n.endsWith(".md"))continue;const i=h(t,n);try{const r=F(i,S(i,"utf8"));r.plugin=e,s.push(r)}catch(r){u.warn("[plugin:%s] \u547D\u4EE4\u89E3\u6790\u5931\u8D25 %s: %s",e,n,r instanceof Error?r.message:String(r))}}}catch{}return s}async list(e){const t=await this.hydrate(e),s=new Map;for(const n of t.plugins.values()){const i=w(n);s.set(i.name,i)}for(const n of this.deploy.readSharedManifest()){const i=n.pluginName;if(!this.deploy.deployedPluginHealthy(i))continue;const o=s.get(i);if(o){String(o.source||"").startsWith("shared:")&&(o.enabled=this.effectiveSharedEnabled(e,n));continue}s.set(i,{name:i,version:this.deployedPluginVersion(i),status:"enabled",enabled:this.effectiveSharedEnabled(e,n),source:`shared:${n.fileName??`${i}.zip`}`,installedAt:new Date().toISOString(),toolCount:0,listeners:[]})}return[...s.values()].sort((n,i)=>n.name.localeCompare(i.name))}deployedPluginVersion(e){try{const t=JSON.parse(S(h(this.deploy.deployedPluginDir(e),"plugin.json"),"utf8"));return typeof t.version=="string"?t.version:void 0}catch{return}}async getPluginTools(e,t){const n=(await this.hydrate(e)).plugins.get(t);return!n||!n.enabled?[]:n.tools.map(i=>({plugin:n.name,name:i.name,title:i.title,description:i.description,inputSchema:i.inputSchema??{type:"object",properties:{}}}))}async debugMountPlugin(e,t,s={}){const n=String(t??"").trim();if(!n)return{ok:!1,error:"\u63D2\u4EF6\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A"};if(!y(n))return{ok:!1,error:`\u63D2\u4EF6\u76EE\u5F55\u4E0D\u5B58\u5728: ${n}`};const i=this.loader.loadManifestOnly(n);if(!i.ok)return i;const r=i.manifest.name,o=this.agentState(e),a=o.queue.then(async()=>{const l=await this.hydrate(e),c=l.plugins.get(r);c&&this.stopAllListeners(c);const g=this.loader.loadPluginFromDir(n,`debug:${n}`,new Date().toISOString(),s);if(!g.ok)return c&&this.startAllListeners(l,c),{ok:!1,error:`\u8C03\u8BD5\u6302\u8F7D\u5931\u8D25: ${g.error}`};const d=g.plugin;return d.debug=!0,l.plugins.set(d.name,d),this.startAllListeners(l,d),u.info("[agent:%s] \u63D2\u4EF6\u5DF2\u8C03\u8BD5\u6302\u8F7D: %s@%s\uFF08dir=%s\uFF09",l.agentId,d.name,d.version??"?",n),this.notifyPluginsChanged(l.agentId),{ok:!0,summary:w(d)}});return o.queue=a.catch(()=>{}),a}async listDebugPlugins(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.debug===!0).map(s=>w(s))}async debugPluginNames(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.debug===!0).map(s=>s.name)}async invokeTool(e,t,s,n,i){const r=await this.hydrate(e),o=r.plugins.get(t);if(!o)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u672A\u5B89\u88C5\uFF08\u53EF\u7528\u63D2\u4EF6: ${[...r.plugins.keys()].join(", ")||"\u65E0"}\uFF09`};if(!o.enabled)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u5DF2\u505C\u7528\uFF0C\u8BF7\u8BA9\u7528\u6237\u5728\u9762\u677F\u542F\u7528`};const a=o.tools.find(l=>l.name===s);if(!a)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u65E0\u5DE5\u5177 ${s}\uFF08\u53EF\u7528: ${o.tools.map(l=>l.name).join(", ")||"\u65E0"}\uFF09`};if(a.inputSchema){const l=W(a.inputSchema,n);if(l.length>0)return{ok:!1,error:`\u53C2\u6570\u6821\u9A8C\u5931\u8D25: ${l.join("; ")}`,inputSchema:a.inputSchema}}return x(e,o,a,n,i)}async manage(e,t){const s=this.agentState(e),n=s.queue.then(async()=>{const i=await this.hydrate(e);return this.doManage(i,t)});return s.queue=n.catch(()=>{}),n}async doManage(e,t){switch(t.action){case"list":return{ok:!0,plugins:await this.list(e.agentId)};case"install":return this.installPlugin(e,t);case"uninstall":return this.uninstallPlugin(e,t);case"reload":return this.reloadPlugin(e,t);case"enable":case"disable":return this.setEnabled(e,t,t.action==="enable");default:return{ok:!1,error:`\u672A\u77E5 action: ${String(t.action)}`}}}async installPlugin(e,t){const s=(t.source??"").trim();if(!s)return{ok:!1,error:"install \u9700\u8981 source\uFF08\u5F53\u524D\u652F\u6301 local:<\u63D2\u4EF6\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84>\uFF09"};const n=s.split(":",1)[0];if(n!=="local")return{ok:!1,error:`\u6682\u4E0D\u652F\u6301\u63D2\u4EF6\u6765\u6E90 "${n}:"\uFF08npm:/git: \u5728\u8DEF\u7EBF\u56FE\u4E2D\uFF1Bzip \u5305\u8BF7\u7528\u9762\u677F\u5BFC\u5165\u6216 POST /runtime/plugins/:agentId/upload\uFF09`};const i=s.slice(6).trim();return!i||!y(h(i,"plugin.json"))?{ok:!1,error:`\u63D2\u4EF6\u76EE\u5F55\u4E0D\u5B58\u5728\u6216\u7F3A\u5C11 plugin.json: ${i}`}:this.installFromDirectory(e,i,s,t.config)}async installFromZip(e,t,s,n){if(!t||t.length===0)return{ok:!1,error:"zip \u5305\u5185\u5BB9\u4E3A\u7A7A"};const i=this.agentState(e),r=i.queue.then(async()=>{await this.hydrate(e);const o=h(this.rootDir,"tmp",`upload-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const a=await E(t,o);return y(h(a.pluginDir,"plugin.json"))?(u.info("[agent:%s] zip \u5BFC\u5165: %s\uFF08%d \u4E2A\u6587\u4EF6\uFF09",e,s,a.fileCount),await this.installFromDirectory(i,a.pluginDir,`upload:${s}`,n)):{ok:!1,error:"zip \u5185\u672A\u627E\u5230 plugin.json\uFF08\u8BF7\u6253\u5305\u63D2\u4EF6\u76EE\u5F55\uFF0C\u4E14 zip \u5185\u8DEF\u5F84\u4F7F\u7528\u82F1\u6587\uFF09"}}catch(a){const l=a instanceof Error?a.message:String(a);return u.warn("[agent:%s] zip \u5BFC\u5165\u5931\u8D25: %s",e,l),{ok:!1,error:`zip \u5BFC\u5165\u5931\u8D25: ${l}`}}finally{await P(o,3,100).catch(()=>{})}});return i.queue=r.catch(()=>{}),r}async installFromDirectory(e,t,s,n){const i=this.loader.loadManifestOnly(t);if(!i.ok)return i;const r=i.manifest,o=r.name,a=this.loader.validateUserConfigValues(r,n??{});if(a)return{ok:!1,error:a};const l=this.loader.loadPluginFromDir(t,s,new Date().toISOString(),n??{});if(!l.ok)return u.warn("[agent:%s] \u63D2\u4EF6\u88C5\u8F7D\u6821\u9A8C\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,l.error),l;const c=h(this.rootDir,"cache",v(e.agentId),o),g=t===c,d=e.plugins.get(o);if(d&&this.stopAllListeners(d),!g)try{await P(c),await N(t,c)}catch(f){const b=f instanceof Error?f.message:String(f);return u.warn("[agent:%s] \u63D2\u4EF6\u79FB\u52A8\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,b),d&&this.startAllListeners(e,d),{ok:!1,error:`\u63D2\u4EF6\u79FB\u52A8\u5931\u8D25: ${b}`}}const m=this.loader.loadPluginFromDir(c,s,new Date().toISOString(),n??{});if(!m.ok){if(u.warn("[agent:%s] \u63D2\u4EF6\u88C5\u8F7D\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,m.error),!g)try{await N(c,t)}catch(f){u.warn("[agent:%s] \u88C5\u8F7D\u5931\u8D25\u540E\u65E0\u6CD5\u79FB\u56DE\u6E90\u76EE\u5F55\uFF08%s\uFF09\uFF0C\u5DF2\u4FDD\u7559\u7F13\u5B58\u526F\u672C",e.agentId,f instanceof Error?f.message:String(f))}if(d)try{this.startAllListeners(e,d)}catch(f){u.warn("[agent:%s] \u6062\u590D\u65E7\u5B9E\u4F8B\u76D1\u542C\u5931\u8D25: %s",e.agentId,f instanceof Error?f.message:String(f))}return m}const p=m.plugin;return e.plugins.set(p.name,p),this.persistInstalled(e),this.startAllListeners(e,p),u.info("[agent:%s] \u63D2\u4EF6\u5DF2\u5B89\u88C5: %s@%s",e.agentId,p.name,p.version??"?"),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:w(p)}}async uninstallPlugin(e,t){const s=(t.name??"").trim(),n=e.plugins.get(s);return n?(this.stopAllListeners(n),e.plugins.delete(s),n.tools.length>0&&this.pushDeprecatedNotice(e,s,"\u5DF2\u88AB\u5378\u8F7D"),this.deploy.readSharedManifest().some(r=>r.pluginName===s)&&this.deploy.removeRuntimeLink(e.agentId,s),this.persistInstalled(e),n.debug!==!0&&await P(n.dir),u.info("[agent:%s] \u63D2\u4EF6\u5DF2\u5378\u8F7D: %s",e.agentId,s),this.notifyPluginsChanged(e.agentId),{ok:!0}):{ok:!1,error:`\u63D2\u4EF6 ${s} \u672A\u5B89\u88C5`}}async reloadPlugin(e,t){const s=(t.name??"").trim(),n=e.plugins.get(s);if(!n)return{ok:!1,error:`\u63D2\u4EF6 ${s} \u672A\u5B89\u88C5`};const i=this.loader.loadPluginFromDir(n.dir,n.source,n.installedAt,n.configValues);if(!i.ok)return{ok:!1,error:`\u91CD\u8F7D\u5931\u8D25\uFF08\u4FDD\u7559\u65E7\u7248\u672C\u8FD0\u884C\uFF09: ${i.error}`};const r=i.plugin;return r.debug=n.debug,this.stopAllListeners(n),e.plugins.set(s,r),this.persistInstalled(e),this.startAllListeners(e,r),u.info("[agent:%s] \u63D2\u4EF6\u5DF2\u91CD\u8F7D: %s",e.agentId,s),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:w(r)}}async setEnabled(e,t,s){const n=(t.name??"").trim(),i=e.plugins.get(n);return i?(i.enabled=s,s?this.startAllListeners(e,i):(i.tools.length>0&&this.pushDeprecatedNotice(e,n,"\u5DF2\u505C\u7528"),this.stopAllListeners(i)),this.persistInstalled(e),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:w(i)}):{ok:!1,error:`\u63D2\u4EF6 ${n} \u672A\u5B89\u88C5`}}async saveSharedPlugin(e,t,s=!0,n){if(!e||e.length===0)return{ok:!1,error:"zip \u5305\u5185\u5BB9\u4E3A\u7A7A"};await this.deploy.migrateLegacySharedIfNeeded();const i=h(this.rootDir,"tmp",`deploy-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const r=await E(e,i),o=this.loader.loadManifestOnly(r.pluginDir);if(!o.ok)return o;const a=o.manifest.name,l=this.deploy.readSharedManifest().find(d=>d.pluginName===a);if(l&&l.sha256===n&&this.deploy.deployedPluginHealthy(a))return{ok:!0,pluginName:a};await this.suspendDeployedPluginAcrossAgents(a),this.deploy.replaceDeployedDir(a,r.pluginDir),await this.deploy.updateSharedManifest(d=>{const m=d.filter(p=>p.pluginName!==a);return m.push({pluginName:a,zipFile:l?.zipFile??`${a}.zip`,fileName:t,defaultEnabled:s,sha256:n}),m}),u.info("[shared] \u63D2\u4EF6\u5DF2\u90E8\u7F72\u5230 bridge: %s\uFF08\u6765\u6E90 %s%s\uFF09",a,t,n?`, sha256=${n.slice(0,12)}\u2026`:"");const g=(await this.applySharedToKnownAgents()).find(d=>d.installed.includes(a));return g&&u.info("[shared] \u5DF2\u540C\u6B65\u5230\u8FD0\u884C\u4E2D agent: %s",g.agentId),{ok:!0,pluginName:a}}catch(r){const o=r instanceof Error?r.message:String(r);return u.warn("[shared] \u63D2\u4EF6\u90E8\u7F72\u5931\u8D25\uFF08%s\uFF09: %s",t,o),{ok:!1,error:`\u63D2\u4EF6\u90E8\u7F72\u5931\u8D25: ${o}`}}finally{await P(i,3,100).catch(()=>{})}}async suspendDeployedPluginAcrossAgents(e){for(const t of[...this.agents.values()]){if(!t.hydrated)continue;const s=t.queue.then(async()=>{const n=t.plugins.get(e);n&&(this.stopAllListeners(n),t.plugins.delete(e),u.info("[agent:%s] \u5DF2\u6458\u9664\u63D2\u4EF6\u7B49\u5F85\u90E8\u7F72\u533A\u66F4\u65B0: %s",t.agentId,e))});t.queue=s.catch(()=>{}),await s}}async applySharedToKnownAgents(){const e=[];for(const t of this.agents.values()){if(!t.hydrated)continue;const s=await this.syncSharedIntoStateQueued(t);s.length>0&&e.push({agentId:t.agentId,installed:s})}return e}async syncSharedIntoStateQueued(e){const t=e.queue.then(()=>this.syncSharedIntoState(e));return e.queue=t.catch(()=>[]),t}effectiveSharedEnabled(e,t){return z(e,"plugins",t.pluginName)&&(t.defaultEnabled??!0)}async pullTemplatePluginsFromCapabilities(e){const t=q(e.agentId);if(!t)return;const s=this.deploy.readSharedManifest();for(const[n,i]of Object.entries(t)){if(!i.url)continue;const r=s.find(a=>a.pluginName===n);if(!r||!r.sha256||r.sha256===i.sha256&&this.deploy.deployedPluginHealthy(n)||this.templatePullInFlight.has(n))continue;this.templatePullInFlight.add(n);const o=h(this.rootDir,"tmp",`pull-${v(e.agentId)}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{D(o,{recursive:!0});let a=`${n}.zip`;try{const d=decodeURIComponent(i.url.split("/").pop()||"");d.toLowerCase().endsWith(".zip")&&(a=R(d,`${n}.zip`))}catch{}const l=await O({downloadUrl:i.url,fileName:a,sha256:i.sha256},o);if(!l)continue;const c=S(l.outputPath),g=await this.saveSharedPlugin(c,l.fileName,r.defaultEnabled??!0,i.sha256);g.ok?u.info("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u81EA\u52A8\u5BF9\u8D26\u66F4\u65B0\u6210\u529F: %s",e.agentId,g.pluginName??n):u.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u66F4\u65B0\u5931\u8D25: %s: %s",e.agentId,n,g.error)}catch(a){u.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6 %s \u66F4\u65B0\u5931\u8D25: %s",e.agentId,n,a instanceof Error?a.message:String(a))}finally{this.templatePullInFlight.delete(n),await P(o,3,100).catch(()=>{})}}}queueTemplatePull(e){this.backgroundTemplatePulls.has(e.agentId)||(this.backgroundTemplatePulls.add(e.agentId),this.pullTemplatePluginsFromCapabilities(e).catch(t=>{u.warn("[agent:%s] \u540E\u53F0\u63D2\u4EF6\u5BF9\u8D26\u66F4\u65B0\u5931\u8D25: %s",e.agentId,t instanceof Error?t.message:String(t))}).finally(()=>{this.backgroundTemplatePulls.delete(e.agentId)}))}async syncSharedIntoState(e){this.queueTemplatePull(e);const t=this.deploy.readSharedManifest(),s=new Set,n=[];let i=0;for(const r of t)if(s.add(r.pluginName),this.effectiveSharedEnabled(e.agentId,r)){const a=e.plugins.get(r.pluginName);if(!this.deploy.ensureRuntimeLink(e.agentId,r.pluginName))continue;const l=this.deploy.runtimeLinkPath(e.agentId,r.pluginName);if(!a){const c=this.loader.loadPluginFromDir(l,`shared:${r.fileName}`,new Date().toISOString(),{});c.ok?(e.plugins.set(c.plugin.name,c.plugin),n.push(c.plugin.name),u.info("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u5DF2\u6309\u5F00\u542F\u6001\u52A0\u8F7D: %s",e.agentId,r.pluginName)):u.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25: %s: %s",e.agentId,r.pluginName,c.error)}}else{const a=e.plugins.get(r.pluginName);a&&(this.stopAllListeners(a),e.plugins.delete(r.pluginName),i++),this.deploy.removeRuntimeLink(e.agentId,r.pluginName)}return this.cleanupRuntimeDir(e,s),this.persistInstalled(e),n}cleanupRuntimeDir(e,t){const s=this.deploy.runtimeDirFor(e.agentId);try{if(!y(s))return;const n=new Set(t);for(const i of I(s))!n.has(i)&&!e.plugins.has(i)&&this.deploy.removeRuntimeLink(e.agentId,i)}catch{}}async applyCapabilities(e){const t=await this.hydrate(e);await this.pullTemplatePluginsFromCapabilities(t),await this.syncSharedIntoState(t)}async drainEvents(e,t={}){const s=await this.hydrate(e);this.ensureListenersRunning(s);const n=s.buffer.drain(t);return{revision:n.revision,events:n.events}}pushDeprecatedNotice(e,t,s){e.buffer.push({plugin:t,event:"plugin-deprecated",priority:"urgent",receivedAt:Date.now(),message:{msgId:`plugin-deprecated-${t}-${Date.now()}`,channel:"plugin-event",senderId:`plugin:${t}`,senderName:`\u63D2\u4EF6[${t}]`,receiverId:e.agentId||void 0,content:`[plugin:${t}] plugin-deprecated
|
|
2
|
-
\u3010\u7CFB\u7EDF\u63D0\u793A\u3011\u63D2\u4EF6 ${t} ${s}\uFF0C\u5176\u63D0\u4F9B\u7684\u5DE5\u5177\u4E0D\u518D\u53EF\u8C03\u7528\uFF08\u5176 plugin:${t} \u6536\u7EB3\u7EC4\u5DF2\u5931\u6548\uFF09\u3002\u5982\u4ECD\u9700\u4F7F\u7528\u8BF7\u91CD\u65B0\u5B89\u88C5/\u542F\u7528\u8BE5\u63D2\u4EF6\u3002`,requireReply:!1,role:"system",timestamp:new Date().toISOString()}})}async enqueueExternalEvent(e,t,s){const n=await this.hydrate(e),
|
|
3
|
-
`,"utf8")}sensitiveKeysOf(e){return(e.userConfig??[]).filter(t=>t?.sensitive===!0&&typeof t.key=="string").map(t=>t.key)}stripSensitiveValues(e){const t=new Set(this.sensitiveKeysOf(e)),s={};for(const[n,
|
|
4
|
-
`,{encoding:"utf8",mode:384})}ensureListenersRunning(e){this.listeners.ensureRunning(e)}startAllListeners(e,t){this.listeners.startAll(e,t)}stopAllListeners(e){this.listeners.stopAll(e)}enqueueEvent(e,t,s,n){this.listeners.enqueue(e,t,s,n)}async getLogs(e,t){const n=(await this.hydrate(e)).plugins.get(t);if(!n)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u672A\u5B89\u88C5`,logs:[]};const
|
|
1
|
+
import{existsSync as y,mkdirSync as $,readFileSync as S,readdirSync as N,rmSync as M,writeFileSync as R}from"node:fs";import{dirname as C,join as f}from"node:path";import{parseAcodeCommandMarkdown as j}from"@agentswork/acode";import{getBridgeTemplatePluginsDir as k}from"../config.js";import{sanitizeAgentId as P,downloadPluginZip as T,sanitizeArchiveFileName as x}from"../utils/file-utils.js";import{createLogger as z}from"../utils/logger.js";import{getAgentOwner as w}from"./agent-ownership.js";import{setDeployedDefaultsProvider as q,reconcileDefaultsFromDeployed as _}from"./capability-config.js";import{isCapabilityEnabled as V,getAgentPluginSources as H}from"./instance-features.js";import{PluginDeploymentStore as A}from"./plugin-deployment.js";import{PluginEventBuffer as J}from"./plugin-event-buffer.js";import{movePluginDir as L,rmWithRetry as I}from"./plugin-fs.js";import{executeHandler as K}from"./plugin-handler-adapter.js";import{ListenerRunner as W}from"./plugin-listener-runner.js";import{PluginLoader as U,toSummary as D}from"./plugin-loader.js";import{isRecord as F,isValidPluginName as Z,validateAgainstSchema as Q}from"./plugin-manifest.js";import{extractPluginZip as O}from"./plugin-package.js";const d=z("plugin-manager");import{isValidPluginName as De,validateManifest as ve,validateAgainstSchema as ke,renderCommandArgv as Pe}from"./plugin-manifest.js";import{getUserPluginsDir as E,isLegacyFallbackDisabled as B}from"./user-scope.js";class G{constructor(e={}){this.agents=new Map,this.deployStores=new Map,this.listeners=new W,this.loader=new U,this.templatePullInFlight=new Set,this.backgroundTemplatePulls=new Set,this.rootDir=e.rootDir,this.runtimeRootDir=e.runtimeRootDir}deployForScope(e){const t=this.rootDir??E(e),s=`scope:${t}`;let n=this.deployStores.get(s);return n||(n=new A(t,this.runtimeRootDir,this.loader,B()?void 0:k()),this.deployStores.set(s,n)),n}deployForAgent(e){if(this.rootDir){const r="__injected__";let i=this.deployStores.get(r);return i||(i=new A(this.rootDir,this.runtimeRootDir,this.loader),this.deployStores.set(r,i)),i}const t=w(e);if(t)return this.deployForScope(t);const s="__legacy__";let n=this.deployStores.get(s);return n||(n=new A(k(),this.runtimeRootDir,this.loader),this.deployStores.set(s,n)),n}get deploy(){const e="__legacy__";let t=this.deployStores.get(e);return t||(t=new A(this.rootDir??k(),this.runtimeRootDir,this.loader),this.deployStores.set(e,t)),t}dataRootForAgent(e){if(this.rootDir)return this.rootDir;const t=w(e);return t?E(t):k()}forAgent(e){return{listPlugins:()=>this.list(e),getPluginTools:t=>this.getPluginTools(e,t),invokeTool:(t,s,n,r)=>this.invokeTool(e,t,s,n,r),manage:t=>this.manage(e,t),getCommandDirs:()=>this.getCommandDirs(e)}}setOnPluginsChanged(e){this.onPluginsChanged=e}notifyPluginsChanged(e){try{this.onPluginsChanged?.(e)}catch(t){d.warn("[agent:%s] onPluginsChanged \u56DE\u8C03\u5931\u8D25: %s",e,t instanceof Error?t.message:String(t))}}async getCommandDirs(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.enabled&&s.commandDir).map(s=>s.commandDir)}async getPluginCommands(e){const t=await this.hydrate(e),s=[];for(const n of t.plugins.values())!n.enabled||!n.commandDir||s.push(...this.parsePluginCommandDir(n));return s}parsePluginCommandDir(e){return this.parseCommandDir(e.name,e.commandDir)}parseCommandDir(e,t){const s=[];if(!t)return s;try{for(const n of N(t)){if(!n.endsWith(".md"))continue;const r=f(t,n);try{const i=j(r,S(r,"utf8"));i.plugin=e,s.push(i)}catch(i){d.warn("[plugin:%s] \u547D\u4EE4\u89E3\u6790\u5931\u8D25 %s: %s",e,n,i instanceof Error?i.message:String(i))}}}catch{}return s}async list(e){const t=await this.hydrate(e),s=new Map;for(const r of t.plugins.values()){const i=D(r);s.set(i.name,i)}const n=this.deployForAgent(e);for(const r of n.readSharedManifest()){const i=r.pluginName;if(!n.deployedPluginHealthy(i))continue;const o=s.get(i);if(o){String(o.source||"").startsWith("shared:")&&(o.enabled=this.effectiveSharedEnabled(e,r));continue}s.set(i,{name:i,version:this.deployedPluginVersion(e,i),status:"enabled",enabled:this.effectiveSharedEnabled(e,r),source:`shared:${r.fileName??`${i}.zip`}`,installedAt:new Date().toISOString(),toolCount:0,listeners:[]})}return[...s.values()].sort((r,i)=>r.name.localeCompare(i.name))}deployedPluginVersion(e,t){try{const s=this.deployForAgent(e).resolveDeployedSourceDir(t);if(!s)return;const n=JSON.parse(S(f(s,"plugin.json"),"utf8"));return typeof n.version=="string"?n.version:void 0}catch{return}}async getPluginTools(e,t){const n=(await this.hydrate(e)).plugins.get(t);return!n||!n.enabled?[]:n.tools.map(r=>({plugin:n.name,name:r.name,title:r.title,description:r.description,inputSchema:r.inputSchema??{type:"object",properties:{}}}))}async debugMountPlugin(e,t,s={}){const n=String(t??"").trim();if(!n)return{ok:!1,error:"\u63D2\u4EF6\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A"};if(!y(n))return{ok:!1,error:`\u63D2\u4EF6\u76EE\u5F55\u4E0D\u5B58\u5728: ${n}`};const r=this.loader.loadManifestOnly(n);if(!r.ok)return r;const i=r.manifest.name,l=this.agentState(e),o=l.queue.then(async()=>{const a=await this.hydrate(e),u=a.plugins.get(i);u&&this.stopAllListeners(u);const g=this.loader.loadPluginFromDir(n,`debug:${n}`,new Date().toISOString(),s);if(!g.ok)return u&&this.startAllListeners(a,u),{ok:!1,error:`\u8C03\u8BD5\u6302\u8F7D\u5931\u8D25: ${g.error}`};const c=g.plugin;return c.debug=!0,a.plugins.set(c.name,c),this.startAllListeners(a,c),d.info("[agent:%s] \u63D2\u4EF6\u5DF2\u8C03\u8BD5\u6302\u8F7D: %s@%s\uFF08dir=%s\uFF09",a.agentId,c.name,c.version??"?",n),this.notifyPluginsChanged(a.agentId),{ok:!0,summary:D(c)}});return l.queue=o.catch(()=>{}),o}async listDebugPlugins(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.debug===!0).map(s=>D(s))}async debugPluginNames(e){return[...(await this.hydrate(e)).plugins.values()].filter(s=>s.debug===!0).map(s=>s.name)}async invokeTool(e,t,s,n,r){const i=await this.hydrate(e),l=i.plugins.get(t);if(!l)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u672A\u5B89\u88C5\uFF08\u53EF\u7528\u63D2\u4EF6: ${[...i.plugins.keys()].join(", ")||"\u65E0"}\uFF09`};if(!l.enabled)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u5DF2\u505C\u7528\uFF0C\u8BF7\u8BA9\u7528\u6237\u5728\u9762\u677F\u542F\u7528`};const o=l.tools.find(a=>a.name===s);if(!o)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u65E0\u5DE5\u5177 ${s}\uFF08\u53EF\u7528: ${l.tools.map(a=>a.name).join(", ")||"\u65E0"}\uFF09`};if(o.inputSchema){const a=Q(o.inputSchema,n);if(a.length>0)return{ok:!1,error:`\u53C2\u6570\u6821\u9A8C\u5931\u8D25: ${a.join("; ")}`,inputSchema:o.inputSchema}}return K(e,l,o,n,r)}async manage(e,t){const s=this.agentState(e),n=s.queue.then(async()=>{const r=await this.hydrate(e);return this.doManage(r,t)});return s.queue=n.catch(()=>{}),n}async doManage(e,t){switch(t.action){case"list":return{ok:!0,plugins:await this.list(e.agentId)};case"install":return this.installPlugin(e,t);case"uninstall":return this.uninstallPlugin(e,t);case"reload":return this.reloadPlugin(e,t);case"enable":case"disable":return this.setEnabled(e,t,t.action==="enable");default:return{ok:!1,error:`\u672A\u77E5 action: ${String(t.action)}`}}}async installPlugin(e,t){const s=(t.source??"").trim();if(!s)return{ok:!1,error:"install \u9700\u8981 source\uFF08\u5F53\u524D\u652F\u6301 local:<\u63D2\u4EF6\u76EE\u5F55\u7EDD\u5BF9\u8DEF\u5F84>\uFF09"};const n=s.split(":",1)[0];if(n!=="local")return{ok:!1,error:`\u6682\u4E0D\u652F\u6301\u63D2\u4EF6\u6765\u6E90 "${n}:"\uFF08npm:/git: \u5728\u8DEF\u7EBF\u56FE\u4E2D\uFF1Bzip \u5305\u8BF7\u7528\u9762\u677F\u5BFC\u5165\u6216 POST /runtime/plugins/:agentId/upload\uFF09`};const r=s.slice(6).trim();return!r||!y(f(r,"plugin.json"))?{ok:!1,error:`\u63D2\u4EF6\u76EE\u5F55\u4E0D\u5B58\u5728\u6216\u7F3A\u5C11 plugin.json: ${r}`}:this.installFromDirectory(e,r,s,t.config)}async installFromZip(e,t,s,n){if(!t||t.length===0)return{ok:!1,error:"zip \u5305\u5185\u5BB9\u4E3A\u7A7A"};const r=this.agentState(e),i=r.queue.then(async()=>{await this.hydrate(e);const l=f(this.dataRootForAgent(e),"tmp",`upload-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const o=await O(t,l);return y(f(o.pluginDir,"plugin.json"))?(d.info("[agent:%s] zip \u5BFC\u5165: %s\uFF08%d \u4E2A\u6587\u4EF6\uFF09",e,s,o.fileCount),await this.installFromDirectory(r,o.pluginDir,`upload:${s}`,n)):{ok:!1,error:"zip \u5185\u672A\u627E\u5230 plugin.json\uFF08\u8BF7\u6253\u5305\u63D2\u4EF6\u76EE\u5F55\uFF0C\u4E14 zip \u5185\u8DEF\u5F84\u4F7F\u7528\u82F1\u6587\uFF09"}}catch(o){const a=o instanceof Error?o.message:String(o);return d.warn("[agent:%s] zip \u5BFC\u5165\u5931\u8D25: %s",e,a),{ok:!1,error:`zip \u5BFC\u5165\u5931\u8D25: ${a}`}}finally{await I(l,3,100).catch(()=>{})}});return r.queue=i.catch(()=>{}),i}async installFromDirectory(e,t,s,n){const r=this.loader.loadManifestOnly(t);if(!r.ok)return r;const i=r.manifest,l=i.name,o=this.loader.validateUserConfigValues(i,n??{});if(o)return{ok:!1,error:o};const a=this.loader.loadPluginFromDir(t,s,new Date().toISOString(),n??{});if(!a.ok)return d.warn("[agent:%s] \u63D2\u4EF6\u88C5\u8F7D\u6821\u9A8C\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,a.error),a;const u=f(this.dataRootForAgent(e.agentId),"cache",P(e.agentId),l),g=t===u,c=e.plugins.get(l);if(c&&this.stopAllListeners(c),!g)try{await I(u),await L(t,u)}catch(h){const b=h instanceof Error?h.message:String(h);return d.warn("[agent:%s] \u63D2\u4EF6\u79FB\u52A8\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,b),c&&this.startAllListeners(e,c),{ok:!1,error:`\u63D2\u4EF6\u79FB\u52A8\u5931\u8D25: ${b}`}}const m=this.loader.loadPluginFromDir(u,s,new Date().toISOString(),n??{});if(!m.ok){if(d.warn("[agent:%s] \u63D2\u4EF6\u88C5\u8F7D\u5931\u8D25\uFF08%s\uFF09: %s",e.agentId,s,m.error),!g)try{await L(u,t)}catch(h){d.warn("[agent:%s] \u88C5\u8F7D\u5931\u8D25\u540E\u65E0\u6CD5\u79FB\u56DE\u6E90\u76EE\u5F55\uFF08%s\uFF09\uFF0C\u5DF2\u4FDD\u7559\u7F13\u5B58\u526F\u672C",e.agentId,h instanceof Error?h.message:String(h))}if(c)try{this.startAllListeners(e,c)}catch(h){d.warn("[agent:%s] \u6062\u590D\u65E7\u5B9E\u4F8B\u76D1\u542C\u5931\u8D25: %s",e.agentId,h instanceof Error?h.message:String(h))}return m}const p=m.plugin;return e.plugins.set(p.name,p),this.persistInstalled(e),this.startAllListeners(e,p),d.info("[agent:%s] \u63D2\u4EF6\u5DF2\u5B89\u88C5: %s@%s",e.agentId,p.name,p.version??"?"),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:D(p)}}async uninstallPlugin(e,t){const s=(t.name??"").trim(),n=e.plugins.get(s);if(!n)return{ok:!1,error:`\u63D2\u4EF6 ${s} \u672A\u5B89\u88C5`};this.stopAllListeners(n),e.plugins.delete(s),n.tools.length>0&&this.pushDeprecatedNotice(e,s,"\u5DF2\u88AB\u5378\u8F7D");const r=this.deployForAgent(e.agentId);return r.readSharedManifest().some(l=>l.pluginName===s)&&r.removeRuntimeLink(e.agentId,s),this.persistInstalled(e),n.debug!==!0&&await I(n.dir),d.info("[agent:%s] \u63D2\u4EF6\u5DF2\u5378\u8F7D: %s",e.agentId,s),this.notifyPluginsChanged(e.agentId),{ok:!0}}async reloadPlugin(e,t){const s=(t.name??"").trim(),n=e.plugins.get(s);if(!n)return{ok:!1,error:`\u63D2\u4EF6 ${s} \u672A\u5B89\u88C5`};const r=this.loader.loadPluginFromDir(n.dir,n.source,n.installedAt,n.configValues);if(!r.ok)return{ok:!1,error:`\u91CD\u8F7D\u5931\u8D25\uFF08\u4FDD\u7559\u65E7\u7248\u672C\u8FD0\u884C\uFF09: ${r.error}`};const i=r.plugin;return i.debug=n.debug,this.stopAllListeners(n),e.plugins.set(s,i),this.persistInstalled(e),this.startAllListeners(e,i),d.info("[agent:%s] \u63D2\u4EF6\u5DF2\u91CD\u8F7D: %s",e.agentId,s),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:D(i)}}async setEnabled(e,t,s){const n=(t.name??"").trim(),r=e.plugins.get(n);return r?(r.enabled=s,s?this.startAllListeners(e,r):(r.tools.length>0&&this.pushDeprecatedNotice(e,n,"\u5DF2\u505C\u7528"),this.stopAllListeners(r)),this.persistInstalled(e),this.notifyPluginsChanged(e.agentId),{ok:!0,summary:D(r)}):{ok:!1,error:`\u63D2\u4EF6 ${n} \u672A\u5B89\u88C5`}}async saveSharedPlugin(e,t,s=!0,n,r){if(!e||e.length===0)return{ok:!1,error:"zip \u5305\u5185\u5BB9\u4E3A\u7A7A"};const i=r?this.deployForScope(r):this.deploy;await i.migrateLegacySharedIfNeeded();const l=f(r?E(r):this.rootDir??k(),"tmp",`deploy-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{const o=await O(e,l),a=this.loader.loadManifestOnly(o.pluginDir);if(!a.ok)return a;const u=a.manifest.name,g=i.readSharedManifest().find(p=>p.pluginName===u);if(g&&g.sha256===n&&i.deployedPluginHealthy(u))return{ok:!0,pluginName:u};await this.suspendDeployedPluginAcrossAgents(u,r),i.replaceDeployedDir(u,o.pluginDir),await i.updateSharedManifest(p=>{const h=p.filter(b=>b.pluginName!==u);return h.push({pluginName:u,zipFile:g?.zipFile??`${u}.zip`,fileName:t,defaultEnabled:s,sha256:n}),h}),d.info("[shared] \u63D2\u4EF6\u5DF2\u90E8\u7F72\u5230 bridge: %s\uFF08\u6765\u6E90 %s%s\uFF09",u,t,n?`, sha256=${n.slice(0,12)}\u2026`:"");const m=(await this.applySharedToKnownAgents(r)).find(p=>p.installed.includes(u));return m&&d.info("[shared] \u5DF2\u540C\u6B65\u5230\u8FD0\u884C\u4E2D agent: %s",m.agentId),{ok:!0,pluginName:u}}catch(o){const a=o instanceof Error?o.message:String(o);return d.warn("[shared] \u63D2\u4EF6\u90E8\u7F72\u5931\u8D25\uFF08%s\uFF09: %s",t,a),{ok:!1,error:`\u63D2\u4EF6\u90E8\u7F72\u5931\u8D25: ${a}`}}finally{await I(l,3,100).catch(()=>{})}}async suspendDeployedPluginAcrossAgents(e,t){for(const s of[...this.agents.values()]){if(!s.hydrated)continue;if(t){const r=w(s.agentId);if(r&&(r.tenantId!==t.tenantId||r.userId!==t.userId))continue}const n=s.queue.then(async()=>{const r=s.plugins.get(e);r&&(this.stopAllListeners(r),s.plugins.delete(e),d.info("[agent:%s] \u5DF2\u6458\u9664\u63D2\u4EF6\u7B49\u5F85\u90E8\u7F72\u533A\u66F4\u65B0: %s",s.agentId,e))});s.queue=n.catch(()=>{}),await n}}async applySharedToKnownAgents(e){const t=[];for(const s of this.agents.values()){if(!s.hydrated)continue;if(e){const r=w(s.agentId);if(r&&(r.tenantId!==e.tenantId||r.userId!==e.userId))continue}const n=await this.syncSharedIntoStateQueued(s);n.length>0&&t.push({agentId:s.agentId,installed:n})}return t}async syncSharedIntoStateQueued(e){const t=e.queue.then(()=>this.syncSharedIntoState(e));return e.queue=t.catch(()=>[]),t}effectiveSharedEnabled(e,t){return V(e,"plugins",t.pluginName)&&(t.defaultEnabled??!0)}async pullTemplatePluginsFromCapabilities(e){const t=H(e.agentId);if(!t)return;const s=this.deployForAgent(e.agentId),n=s.readSharedManifest();for(const[r,i]of Object.entries(t)){if(!i.url)continue;const l=n.find(a=>a.pluginName===r);if(!l||!l.sha256||l.sha256===i.sha256&&s.deployedPluginHealthy(r)||this.templatePullInFlight.has(r))continue;this.templatePullInFlight.add(r);const o=f(this.dataRootForAgent(e.agentId),"tmp",`pull-${P(e.agentId)}-${Date.now()}-${Math.random().toString(36).slice(2,8)}`);try{$(o,{recursive:!0});let a=`${r}.zip`;try{const m=decodeURIComponent(i.url.split("/").pop()||"");m.toLowerCase().endsWith(".zip")&&(a=x(m,`${r}.zip`))}catch{}const u=await T({downloadUrl:i.url,fileName:a,sha256:i.sha256},o);if(!u)continue;const g=S(u.outputPath),c=await this.saveSharedPlugin(g,u.fileName,l.defaultEnabled??!0,i.sha256,w(e.agentId)??void 0);c.ok?d.info("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u81EA\u52A8\u5BF9\u8D26\u66F4\u65B0\u6210\u529F: %s",e.agentId,c.pluginName??r):d.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u66F4\u65B0\u5931\u8D25: %s: %s",e.agentId,r,c.error)}catch(a){d.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6 %s \u66F4\u65B0\u5931\u8D25: %s",e.agentId,r,a instanceof Error?a.message:String(a))}finally{this.templatePullInFlight.delete(r),await I(o,3,100).catch(()=>{})}}}queueTemplatePull(e){this.backgroundTemplatePulls.has(e.agentId)||(this.backgroundTemplatePulls.add(e.agentId),this.pullTemplatePluginsFromCapabilities(e).catch(t=>{d.warn("[agent:%s] \u540E\u53F0\u63D2\u4EF6\u5BF9\u8D26\u66F4\u65B0\u5931\u8D25: %s",e.agentId,t instanceof Error?t.message:String(t))}).finally(()=>{this.backgroundTemplatePulls.delete(e.agentId)}))}async syncSharedIntoState(e){this.queueTemplatePull(e);const t=this.deployForAgent(e.agentId),s=t.readSharedManifest(),n=new Set,r=[];for(const i of s)if(n.add(i.pluginName),this.effectiveSharedEnabled(e.agentId,i)){const o=e.plugins.get(i.pluginName);if(!t.ensureRuntimeLink(e.agentId,i.pluginName))continue;const a=t.runtimeLinkPath(e.agentId,i.pluginName);if(!o){const u=this.loader.loadPluginFromDir(a,`shared:${i.fileName}`,new Date().toISOString(),{});u.ok?(e.plugins.set(u.plugin.name,u.plugin),r.push(u.plugin.name),d.info("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u5DF2\u6309\u5F00\u542F\u6001\u52A0\u8F7D: %s",e.agentId,i.pluginName)):d.warn("[agent:%s] \u5DF2\u90E8\u7F72\u63D2\u4EF6\u52A0\u8F7D\u5931\u8D25: %s: %s",e.agentId,i.pluginName,u.error)}}else{const o=e.plugins.get(i.pluginName);o&&(this.stopAllListeners(o),e.plugins.delete(i.pluginName)),t.removeRuntimeLink(e.agentId,i.pluginName)}return this.cleanupRuntimeDir(e,n),this.persistInstalled(e),r}cleanupRuntimeDir(e,t){const s=this.deployForAgent(e.agentId).runtimeDirFor(e.agentId);try{if(!y(s))return;const n=new Set(t),r=this.deployForAgent(e.agentId);for(const i of N(s))!n.has(i)&&!e.plugins.has(i)&&r.removeRuntimeLink(e.agentId,i)}catch{}}async applyCapabilities(e){const t=await this.hydrate(e);await this.pullTemplatePluginsFromCapabilities(t),await this.syncSharedIntoState(t)}async drainEvents(e,t={}){const s=await this.hydrate(e);this.ensureListenersRunning(s);const n=s.buffer.drain(t);return{revision:n.revision,events:n.events}}pushDeprecatedNotice(e,t,s){e.buffer.push({plugin:t,event:"plugin-deprecated",priority:"urgent",receivedAt:Date.now(),message:{msgId:`plugin-deprecated-${t}-${Date.now()}`,channel:"plugin-event",senderId:`plugin:${t}`,senderName:`\u63D2\u4EF6[${t}]`,receiverId:e.agentId||void 0,content:`[plugin:${t}] plugin-deprecated
|
|
2
|
+
\u3010\u7CFB\u7EDF\u63D0\u793A\u3011\u63D2\u4EF6 ${t} ${s}\uFF0C\u5176\u63D0\u4F9B\u7684\u5DE5\u5177\u4E0D\u518D\u53EF\u8C03\u7528\uFF08\u5176 plugin:${t} \u6536\u7EB3\u7EC4\u5DF2\u5931\u6548\uFF09\u3002\u5982\u4ECD\u9700\u4F7F\u7528\u8BF7\u91CD\u65B0\u5B89\u88C5/\u542F\u7528\u8BE5\u63D2\u4EF6\u3002`,requireReply:!1,role:"system",timestamp:new Date().toISOString()}})}async enqueueExternalEvent(e,t,s){const n=await this.hydrate(e),r=n.plugins.get(t);if(!r||!r.enabled)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u672A\u5B89\u88C5\u6216\u5DF2\u505C\u7528`};const i=typeof s.event=="string"?s.event:"",l=r.listeners.find(o=>o.transport.type==="http-callback"&&(!i||o.event===i));return l?(this.enqueueEvent(n,r,l,s),{ok:!0}):{ok:!1,error:`\u63D2\u4EF6 ${t} \u65E0\u5339\u914D\u7684 http-callback \u76D1\u542C\u5668\uFF08event=${i||"(\u7A7A)"}\uFF09`}}agentState(e){let t=this.agents.get(e);return t||(t={agentId:e,plugins:new Map,buffer:new J(e),hydrated:!1,queue:Promise.resolve(),eventSeq:0},this.agents.set(e,t)),t}async hydrate(e){const t=this.agentState(e);return t.hydratePromise||(t.hydratePromise=this.doHydrate(t).catch(s=>{throw t.hydratePromise=void 0,s})),await t.hydratePromise,t}async doHydrate(e){const t=e.agentId;await this.deployForAgent(t).migrateLegacySharedIfNeeded();const s=this.installedFile(t);if(!y(s)){await this.syncSharedIntoState(e).catch(()=>{}),e.hydrated=!0;return}try{const n=JSON.parse(S(s,"utf8")),r=this.readSecrets(t);for(const i of n.plugins??[]){if(String(i.source||"").startsWith("shared:"))continue;const o=f(this.dataRootForAgent(t),"cache",P(t),i.name);if(!y(f(o,"plugin.json"))){d.warn("[agent:%s] \u5DF2\u5B89\u88C5\u63D2\u4EF6\u76EE\u5F55\u7F3A\u5931\uFF0C\u8DF3\u8FC7: %s",t,i.name);continue}const a={...i.config,...r[i.name]??{}},u=this.loader.loadPluginFromDir(o,i.source,i.installedAt,a);if(u.ok){const g=u.plugin;g.enabled=i.enabled,e.plugins.set(g.name,g)}else d.warn("[agent:%s] \u63D2\u4EF6\u88C5\u8F7D\u5931\u8D25: %s: %s",t,i.name,u.error)}}catch(n){const r=n instanceof Error?n.message:String(n);d.error("[agent:%s] installed.json \u89E3\u6790\u5931\u8D25: %s",t,r)}await this.syncSharedIntoState(e).catch(n=>{d.warn("[agent:%s] \u5171\u4EAB\u63D2\u4EF6\u540C\u6B65\u5931\u8D25: %s",t,n instanceof Error?n.message:String(n))}),e.hydrated=!0}installedFile(e){return f(this.dataRootForAgent(e),"agents",P(e),"installed.json")}persistInstalled(e){this.persistSecrets(e);const t=this.installedFile(e.agentId);$(C(t),{recursive:!0});const s=[...e.plugins.values()].filter(n=>n.debug!==!0).map(n=>({name:n.name,source:n.source,installedAt:n.installedAt,enabled:n.enabled,config:this.stripSensitiveValues(n)}));R(t,`${JSON.stringify({version:1,plugins:s},null,2)}
|
|
3
|
+
`,"utf8")}sensitiveKeysOf(e){return(e.userConfig??[]).filter(t=>t?.sensitive===!0&&typeof t.key=="string").map(t=>t.key)}stripSensitiveValues(e){const t=new Set(this.sensitiveKeysOf(e)),s={};for(const[n,r]of Object.entries(e.configValues))t.has(n)||(s[n]=r);return s}secretsFile(e){return f(this.dataRootForAgent(e),"agents",P(e),"secrets.json")}readSecrets(e){try{const t=JSON.parse(S(this.secretsFile(e),"utf8"));if(!F(t)||!F(t.secrets))return{};const s={};for(const[n,r]of Object.entries(t.secrets)){if(!F(r))continue;const i={};for(const[l,o]of Object.entries(r))typeof o=="string"&&(i[l]=o);s[n]=i}return s}catch{return{}}}persistSecrets(e){const t={};for(const n of e.plugins.values()){if(n.debug===!0)continue;const r={};for(const i of this.sensitiveKeysOf(n)){const l=n.configValues[i];typeof l=="string"&&l.length>0&&(r[i]=l)}Object.keys(r).length>0&&(t[n.name]=r)}const s=this.secretsFile(e.agentId);if(Object.keys(t).length===0){try{M(s,{force:!0})}catch{}return}$(C(s),{recursive:!0}),R(s,`${JSON.stringify({version:1,secrets:t},null,2)}
|
|
4
|
+
`,{encoding:"utf8",mode:384})}ensureListenersRunning(e){this.listeners.ensureRunning(e)}startAllListeners(e,t){this.listeners.startAll(e,t)}stopAllListeners(e){this.listeners.stopAll(e)}enqueueEvent(e,t,s,n){this.listeners.enqueue(e,t,s,n)}async getLogs(e,t){const n=(await this.hydrate(e)).plugins.get(t);if(!n)return{ok:!1,error:`\u63D2\u4EF6 ${t} \u672A\u5B89\u88C5`,logs:[]};const r=[];for(const i of n.runtimes)r.push(`\u2500\u2500 listener ${i.def.event} (${i.def.transport?.type}) ${i.lastError?`[error: ${i.lastError}]`:""}`),r.push(...i.logs);return{ok:!0,logs:r}}async stopAgent(e){const t=this.agents.get(e);if(t){for(const s of t.plugins.values())this.stopAllListeners(s);this.agents.delete(e)}}async stopAll(){for(const e of[...this.agents.keys()])await this.stopAgent(e)}async listDeployed(e){const t=e?this.deployForScope(e):this.deploy;await t.migrateLegacySharedIfNeeded();const s=t.readSharedManifest(),n=[];for(const r of s){const i=t.deployedPluginDir(r.pluginName),l=t.deployedPluginHealthy(r.pluginName);let o;if(l)try{const a=JSON.parse(S(f(i,"plugin.json"),"utf8"));typeof a.version=="string"&&(o=a.version)}catch{}n.push({pluginName:r.pluginName,version:o,fileName:r.fileName??`${r.pluginName}.zip`,defaultEnabled:r.defaultEnabled!==!1,sha256:r.sha256,deployed:l})}return n}deployedDefaultEnabled(e){const s=(e?this.deployForScope(e):this.deploy).readSharedManifest(),n={};for(const r of s)n[r.pluginName]=r.defaultEnabled!==!1;return n}async removeDeployedPlugin(e,t){if(!Z(e))return{ok:!1,error:"pluginName \u975E\u6CD5\uFF08\u987B\u4E3A kebab-case\uFF0C1~64 \u5B57\u7B26\uFF09"};const s=t?this.deployForScope(t):this.deploy;await s.migrateLegacySharedIfNeeded();for(const n of[...this.agents.values()]){if(!n.hydrated)continue;if(t){const i=w(n.agentId);if(i&&(i.tenantId!==t.tenantId||i.userId!==t.userId))continue}const r=n.queue.then(async()=>{const i=n.plugins.get(e);i&&(this.stopAllListeners(i),n.plugins.delete(e)),s.removeRuntimeLink(n.agentId,e),this.persistInstalled(n)});n.queue=r.catch(()=>{}),await r}await s.updateSharedManifest(n=>n.filter(r=>r.pluginName!==e));try{s.removeDeployedDir(e)}catch(n){return{ok:!1,error:`\u90E8\u7F72\u76EE\u5F55\u6E05\u7406\u5931\u8D25: ${n instanceof Error?n.message:String(n)}`}}return d.info("[shared] \u63D2\u4EF6\u5DF2\u4ECE bridge \u79FB\u9664\u90E8\u7F72: %s",e),{ok:!0}}}const X=new G;q("plugins",v=>v?X.deployedDefaultEnabled(v):{});const ye=v=>_(v,"plugins");export{G as PluginManager,De as isValidPluginName,X as pluginManager,ye as reconcilePluginsDefaultsFromDeployed,Pe as renderCommandArgv,ke as validateAgainstSchema,ve as validateManifest};
|
|
5
5
|
|
|
@@ -1,4 +1,14 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
import type { PluginEventPriority } from "./plugin-event-buffer.js";
|
|
3
13
|
export interface PluginUserConfigField {
|
|
4
14
|
key: string;
|
|
@@ -73,6 +83,10 @@ export declare function getPath(obj: unknown, path: string): unknown;
|
|
|
73
83
|
export declare function truncate(text: string, max: number): string;
|
|
74
84
|
export declare function validateAgainstSchema(schema: unknown, value: unknown, path?: string): string[];
|
|
75
85
|
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
76
90
|
export declare function isValidPluginName(name: unknown): name is string;
|
|
77
91
|
export declare function validateManifest(manifest: Record<string, unknown>): string | null;
|
|
78
92
|
export declare function validateToolDef(item: unknown): string | null;
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
export interface PluginZipExtractResult {
|
|
3
13
|
|
|
4
14
|
pluginDir: string;
|
|
5
15
|
fileCount: number;
|
|
6
16
|
}
|
|
7
17
|
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
8
21
|
export declare function extractPluginZip(zipBuffer: Buffer, stagingRoot: string): Promise<PluginZipExtractResult>;
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
2
11
|
import type { ChildProcess } from "node:child_process";
|
|
3
12
|
import type { PluginStatus } from "@agentswork/acode";
|
|
4
13
|
import type { PluginEventBuffer } from "./plugin-event-buffer.js";
|
|
@@ -33,8 +42,14 @@ export interface LoadedPlugin {
|
|
|
33
42
|
runtimes: ListenerRuntime[];
|
|
34
43
|
moduleCache: Map<string, unknown>;
|
|
35
44
|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
36
48
|
debug?: boolean;
|
|
37
49
|
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
38
53
|
importNonce: number;
|
|
39
54
|
}
|
|
40
55
|
export interface InstalledRecord {
|
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
3
18
|
export declare function isProcessRunningAsync(pid: number): Promise<boolean>;
|
|
4
19
|
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
5
25
|
export declare function isProcessRunning(pid: number): Promise<boolean>;
|
|
6
26
|
|
|
27
|
+
|
|
28
|
+
|
|
7
29
|
export interface ProcessInfo {
|
|
8
30
|
pid: number;
|
|
9
31
|
command: string;
|
|
@@ -12,10 +34,26 @@ export interface ProcessInfo {
|
|
|
12
34
|
startedAt?: string;
|
|
13
35
|
}
|
|
14
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
15
41
|
export declare function findClaudeCodeProcesses(): Promise<ProcessInfo[]>;
|
|
16
42
|
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
17
53
|
export declare function findOrphanProcessByAgentId(agentId: string): Promise<ProcessInfo | undefined>;
|
|
18
54
|
|
|
55
|
+
|
|
56
|
+
|
|
19
57
|
interface ProcEntry {
|
|
20
58
|
processId: number;
|
|
21
59
|
parentProcessId: number;
|
|
@@ -23,29 +61,89 @@ interface ProcEntry {
|
|
|
23
61
|
commandLine: string | null;
|
|
24
62
|
}
|
|
25
63
|
|
|
64
|
+
|
|
65
|
+
|
|
26
66
|
export interface ProcessSnapshotEntry extends ProcEntry {
|
|
27
67
|
creationDate?: string | null;
|
|
28
68
|
workingSetSize?: number | null;
|
|
29
69
|
handleCount?: number | null;
|
|
30
70
|
}
|
|
31
71
|
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
32
77
|
export interface ProcessSnapshot {
|
|
33
78
|
entries: ProcessSnapshotEntry[];
|
|
34
79
|
}
|
|
35
80
|
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
|
|
36
90
|
export declare function captureProcessSnapshot(): Promise<ProcessSnapshot | undefined>;
|
|
37
91
|
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
38
103
|
export declare function findOrphanProcessByWorkspace(workspacePath: string): Promise<ProcessInfo | undefined>;
|
|
39
104
|
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
40
110
|
export declare function terminateProcess(pid: number): boolean;
|
|
41
111
|
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
|
|
42
121
|
export declare function terminateProcessTree(pid: number): Promise<{
|
|
43
122
|
terminated: number;
|
|
44
123
|
failed: number;
|
|
45
124
|
}>;
|
|
46
125
|
|
|
126
|
+
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
47
132
|
export declare function waitForProcessExit(pid: number, timeoutMs?: number): Promise<boolean>;
|
|
48
133
|
|
|
134
|
+
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
49
147
|
export declare function detectOrphanProcesses(persistedSessions: Array<{
|
|
50
148
|
agentId: string;
|
|
51
149
|
pid?: number;
|
|
@@ -60,6 +158,8 @@ export declare function detectOrphanProcesses(persistedSessions: Array<{
|
|
|
60
158
|
};
|
|
61
159
|
}>>;
|
|
62
160
|
|
|
161
|
+
|
|
162
|
+
|
|
63
163
|
export interface ProcessHealthStatus {
|
|
64
164
|
pid: number;
|
|
65
165
|
agentId: string;
|
|
@@ -70,15 +170,32 @@ export interface ProcessHealthStatus {
|
|
|
70
170
|
lastUpdate: Date;
|
|
71
171
|
}
|
|
72
172
|
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
|
|
73
179
|
export declare function checkProcessHealth(pid: number, agentId: string): Promise<ProcessHealthStatus>;
|
|
74
180
|
|
|
181
|
+
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
75
188
|
export declare function checkAllSessionsHealth(sessions: Array<{
|
|
76
189
|
agentId: string;
|
|
77
190
|
pid?: number;
|
|
78
191
|
}>, snapshot?: ProcessSnapshot): Promise<Map<string, ProcessHealthStatus>>;
|
|
79
192
|
|
|
193
|
+
|
|
194
|
+
|
|
80
195
|
export type ProcessManagementStatus = 'managed' | 'orphan' | 'unknown';
|
|
81
196
|
|
|
197
|
+
|
|
198
|
+
|
|
82
199
|
export interface DiscoveredProcessInfo extends ProcessInfo {
|
|
83
200
|
managementStatus: ProcessManagementStatus;
|
|
84
201
|
sessionId?: string;
|
|
@@ -86,8 +203,23 @@ export interface DiscoveredProcessInfo extends ProcessInfo {
|
|
|
86
203
|
lastSeen?: string;
|
|
87
204
|
}
|
|
88
205
|
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
89
216
|
export declare function discoverAllProcesses(managedPids?: Set<number>, managedAgentIds?: Set<string>): Promise<DiscoveredProcessInfo[]>;
|
|
90
217
|
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
91
223
|
export declare function discoverAllProcessesFull(registryExport: Array<{
|
|
92
224
|
agentId: string;
|
|
93
225
|
pid: number;
|