aws-runtime-bridge 1.9.172 → 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 +314 -0
- package/README.md +61 -2
- package/dist/adapter/AcodeSdkAdapter.d.ts +374 -1
- package/dist/adapter/AcodeSdkAdapter.js +3 -3
- 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 +184 -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/bridge-temp-files.d.ts +1 -0
- package/dist/routes/bridge-temp-files.js +2 -0
- 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 +2021 -628
- 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 +15 -10
- package/dist/routes/file-browser.js +1 -1
- 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 +185 -0
- package/dist/routes/git.js +34 -34
- 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/sessions.js +1 -1
- 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 +6 -0
- package/dist/routes/tech-stack.js +2 -0
- package/dist/routes/terminal.d.ts +122 -0
- package/dist/routes/terminal.js +22 -22
- 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 +39 -0
- package/dist/services/agent-pty-manager.js +5 -4
- package/dist/services/agent-startup-memory.d.ts +34 -0
- package/dist/services/agent-startup-memory.js +4 -4
- 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 +65 -0
- package/dist/services/bridge-temp-files.js +2 -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 +42 -0
- package/dist/services/fileSnapshotStore.js +1 -1
- package/dist/services/gitignore.d.ts +21 -0
- package/dist/services/gitignore.js +2 -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/log-retention.js +1 -1
- 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 +43 -0
- package/dist/services/open-doc-events.js +2 -0
- package/dist/services/open-doc-registry.d.ts +59 -0
- package/dist/services/open-doc-registry.js +2 -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/request-invalid-dump.js +1 -1
- 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/runtime-resources-snapshot.js +2 -2
- 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 +30 -0
- package/dist/services/snapshot-retention.js +2 -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 +43 -0
- package/dist/services/tech-stack-scanner.js +2 -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 +99 -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 +2 -2
- 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 +12 -0
- package/package/acode/dist/__tests__/summary-request-helper.js +2 -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 +71 -0
- package/package/acode/dist/cache-control.js +2 -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 +388 -4
- package/package/acode/dist/compaction.js +19 -17
- 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 +110 -0
- package/package/acode/dist/microcompact.js +2 -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 +828 -9
- package/package/acode/dist/runtime.js +40 -33
- 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 +32 -0
- package/package/acode/dist/token-estimator.js +2 -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 +192 -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/ability-market-tools.js +1 -1
- package/package/aws-client-agent-mcp/dist/agent-client.d.ts +290 -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 +610 -0
- package/package/aws-client-agent-mcp/dist/mcp-server.js +25 -23
- 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 +102 -2
- package/package/aws-client-agent-mcp/dist/memory-store.js +27 -2
- package/package/aws-client-agent-mcp/dist/memory-tools.d.ts +18 -0
- package/package/aws-client-agent-mcp/dist/memory-tools.js +13 -9
- 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 +5 -1
- package/package/aws-client-agent-mcp/dist/server-memory-store.js +1 -1
- 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 +174 -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
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{cpSync as h,existsSync as d,mkdirSync as I,readdirSync as a,statSync as y}from"node:fs";import o from"node:path";import{getBridgeDataHome as S,getBridgeTemplateDir as k}from"../config.js";import{getUserAiConfigFile as w,getUserCapabilityAgentFile as U,getUserCapabilityDefaultsFile as R,getUserMcpDeployedDir as F,getUserMcpPackagesDir as P,getUserPluginsDeployedDir as x,getUserScopeRoot as C,getUserSkillsDeployedDir as v,getUserSkillsDir as A,isValidScopeId as g}from"../services/user-scope.js";import{createLogger as B}from"../utils/logger.js";const l=B("migrate-user-scopes");function E(e){const t=r=>{const c=e.indexOf(r);return c>=0?String(e[c+1]??"").trim():""},n=t("--tenant"),s=t("--user");if(!n||!s)throw new Error("\u5FC5\u987B\u63D0\u4F9B --tenant <tenantId> \u4E0E --user <userId>");if(!g(n)||!g(s))throw new Error("tenantId/userId \u53EA\u80FD\u5305\u542B\u5B57\u6BCD\u6570\u5B57\u4E0E _ . -");const i=t("--agents");return{tenantId:n,userId:s,dryRun:e.includes("--dry-run"),overwrite:e.includes("--overwrite"),agents:i?i.split(",").map(r=>r.trim()).filter(Boolean):[]}}let m=0,j=0;function W(e){I(o.dirname(e),{recursive:!0})}function u(e,t,n){if(!(!d(e)||!y(e).isFile())){if(d(t)&&!n.overwrite){j+=1;return}if(m+=1,n.dryRun){l.info("[dry-run] file %s \u2192 %s",e,t);return}W(t),h(e,t,{force:!0})}}function p(e,t,n){if(!d(e))return;let s=[];try{s=a(e)}catch{return}for(const i of s){if(i.startsWith("."))continue;const r=o.join(e,i),c=o.join(t,i);let f;try{f=y(r)}catch{continue}f.isDirectory()?p(r,c,n):f.isFile()&&u(r,c,n)}}function b(e){const t={tenantId:e.tenantId,userId:e.userId},n=k();if(!d(n)){l.info("\u9057\u7559\u6A21\u677F\u76EE\u5F55\u4E0D\u5B58\u5728\uFF08%s\uFF09\uFF0C\u65E0\u9700\u8FC1\u79FB",n);return}l.info("\u5F00\u59CB\u8FC1\u79FB\uFF1A%s \u2192 %s%s%s",n,C(t),e.dryRun?"\uFF08dry-run\uFF09":"",e.overwrite?"\uFF08\u8986\u76D6\u5DF2\u5B58\u5728\uFF09":""),u(o.join(n,"config.json"),w(t),e),p(o.join(n,"skills","deployed"),v(t),e);const s=o.join(n,"skills");if(d(s))for(const i of a(s)){if(i==="deployed"||i==="agents"||i==="config.json")continue;const r=o.join(s,i);try{if(!y(r).isDirectory())continue}catch{continue}p(r,o.join(A(t),i),e)}p(o.join(n,"mcp","deployed"),F(t),e),p(o.join(n,"mcp","packages"),P(t),e),p(o.join(n,"plugins","deployed"),x(t),e);for(const i of["skills","mcp","plugins"]){const r=o.join(n,i);u(o.join(r,"config.json"),R(t,i),e);const c=o.join(r,"agents");if(d(c))for(const f of a(c)){if(!f.endsWith(".json")||f.startsWith("."))continue;const D=f.slice(0,-5);u(o.join(c,f),U(t,i,D),e)}}l.info("\u8FC1\u79FB\u5B8C\u6210\uFF1A\u590D\u5236 %d \u4E2A\u6587\u4EF6\uFF0C\u8DF3\u8FC7 %d \u4E2A\u5DF2\u5B58\u5728\u6587\u4EF6\u3002\u9057\u7559\u5C42\u4FDD\u7559\uFF08\u53EA\u8BFB\u56DE\u9000\uFF09\u3002",m,j),e.dryRun&&l.info("dry-run \u7ED3\u675F\uFF1A\u672A\u5199\u5165\u4EFB\u4F55\u6587\u4EF6\u3002"),l.info("\u6570\u636E\u6839\uFF1A%s",S())}try{const e=E(process.argv.slice(2));b(e)}catch(e){l.error("\u8FC1\u79FB\u5931\u8D25\uFF1A%s",e instanceof Error?e.message:String(e)),process.exitCode=1}
|
|
2
|
+
|
|
@@ -1,12 +1,30 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
2
12
|
import type { IncomingMessage } from "node:http";
|
|
3
13
|
import type { Socket } from "node:net";
|
|
4
14
|
import type { NextFunction, Request, Response } from "express";
|
|
5
15
|
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
6
19
|
export declare function parseAllowIps(raw: unknown): string[];
|
|
7
20
|
|
|
8
21
|
export declare function isValidIpEntry(entry: string): boolean;
|
|
9
22
|
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
10
28
|
export declare function isIpAllowed(clientIp: string, entries: string[]): boolean;
|
|
11
29
|
|
|
12
30
|
export declare function getAccessControlEntries(): string[];
|
|
@@ -15,4 +33,7 @@ export declare function refreshAccessControlCache(): void;
|
|
|
15
33
|
|
|
16
34
|
export declare function accessControlMiddleware(req: Request, res: Response, next: NextFunction): void;
|
|
17
35
|
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
18
39
|
export declare function isUpgradeAllowed(request: IncomingMessage, socket: Socket): boolean;
|
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
3
14
|
export interface BgTaskOutputSubscriber {
|
|
4
15
|
onLine: (event: {
|
|
5
16
|
stream: "stdout" | "stderr";
|
|
@@ -47,9 +58,19 @@ export interface BgManagerLike {
|
|
|
47
58
|
getTaskOutputSnapshot(agentId: string, taskId: string, tailLines?: number): BgTaskOutputSnapshot | null;
|
|
48
59
|
subscribeTaskOutput(agentId: string, taskId: string, subscriber: BgTaskOutputSubscriber): (() => void) | null;
|
|
49
60
|
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
|
|
50
64
|
listTasksWithReconcile?(agentId: string, statusFilter?: string): Promise<BgTaskSummary[]>;
|
|
51
65
|
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
|
|
52
69
|
killTask?(agentId: string, taskId: string): Promise<unknown>;
|
|
53
70
|
}
|
|
54
71
|
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
55
76
|
export declare function getAcodeBgManager(): Promise<BgManagerLike | null>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{existsSync as i,mkdirSync as
|
|
1
|
+
import{existsSync as i,mkdirSync as A,rmSync as m,cpSync as g,symlinkSync as b,lstatSync as k,realpathSync as j}from"node:fs";import o from"node:path";import{getRuntimeHomeDir as x}from"../config.js";import{logger as d}from"../utils/logger.js";import{BRIDGE_PACKAGE_ROOT as E}from"../utils/sdk-package-loader.js";function u(){return E}function p(e=u()){return o.join(e,"package","acode")}function R(e=u()){return i(o.join(e,"src"))}function y(){return o.join(x(),".aws-bridge","acode")}function S(e){if(!i(e))return!0;const n=k(e);return n.isSymbolicLink()||n.isDirectory()}function C(e,n){if(!i(e))return!1;try{return j(e)===j(n)}catch{return!1}}function D(e,n){const t=o.join(e,"node_modules"),r=o.join(n,"node_modules");if(!i(t)){d.warn(`[runtime-bridge] ACode \u672A\u627E\u5230 bridge node_modules\uFF0C\u4F9D\u8D56\u89E3\u6790\u53EF\u80FD\u5931\u8D25: ${t}`);return}if(!C(r,t)){if(!S(r)){d.warn(`[runtime-bridge] ACode node_modules \u8DEF\u5F84\u5DF2\u5B58\u5728\u4F46\u4E0D\u662F\u76EE\u5F55\u6216\u94FE\u63A5\uFF0C\u5DF2\u4FDD\u7559: ${r}`);return}m(r,{recursive:!0,force:!0}),b(t,r,process.platform==="win32"?"junction":"dir")}}function $(){const e=u();return R(e)?o.join(p(e),"dist","index.js"):o.join(y(),"dist","index.js")}function L(){const e=u(),n=p(e),t=o.join(n,"dist"),r=o.join(t,"index.js");if(!i(r))return d.warn(`[runtime-bridge] \u672A\u627E\u5230 bundled ACode dist\uFF0CACode \u542F\u52A8\u53EF\u80FD\u5931\u8D25: ${r}`),null;if(R(e))return d.info(`[runtime-bridge] ACode \u672C\u5730\u5F00\u53D1\u6A21\u5F0F\uFF0C\u76F4\u63A5\u4F7F\u7528\u9879\u76EE dist: ${r}`),r;const s=y(),c=o.join(s,"dist");A(s,{recursive:!0}),m(c,{recursive:!0,force:!0}),g(t,c,{recursive:!0,force:!0,errorOnExist:!1});for(const a of["package.json","README.md"]){const f=o.join(n,a);i(f)&&g(f,o.join(s,a),{force:!0,errorOnExist:!1})}D(e,s);const l=o.join(c,"index.js");return d.info(`[runtime-bridge] ACode \u5DF2\u51C6\u5907: ${l}`),l}export{L as ensureAcodePackageReleased,$ as getReleasedAcodeEntryPath};
|
|
2
2
|
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
3
25
|
export declare function getSkillFarmRoot(): string;
|
|
4
26
|
|
|
5
27
|
export declare function getAgentSkillsFarmDir(agentId: string): string;
|
|
6
28
|
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
7
33
|
export declare function syncAgentSkillFarm(agentId: string): string | null;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cpSync as
|
|
1
|
+
import{cpSync as h,existsSync as y,lstatSync as p,mkdirSync as j,readdirSync as d,realpathSync as D,rmSync as S,symlinkSync as k}from"node:fs";import i from"node:path";import{getBridgeDataHome as w,getBridgeInstancePrivateSkillsDir as E,getBridgeInstanceSkillsDir as x,getBridgeTemplateSkillsDir as v}from"../config.js";import{createLogger as F}from"../utils/logger.js";import{getAgentOwner as B}from"./agent-ownership.js";import{isCapabilityEnabled as T}from"./instance-features.js";import{isLegacyFallbackDisabled as A,getUserSkillsDir as K,getUserSkillsDeployedDir as N}from"./user-scope.js";const l=F("agent-capability-sync"),L=process.platform==="win32"?"junction":"dir";function J(){return i.join(w(),"instance-runtime")}function C(e){return x(e)}function M(){return i.join(v(),"deployed")}function R(){return v()}function U(e){return E(e)}function g(e,r){if(!e||!y(e))return;let n=[];try{n=d(e)}catch{return}for(const s of n){if(s.startsWith("."))continue;const t=i.join(e,s);try{if(!y(i.join(t,"SKILL.md")))continue;r.set(s,t)}catch{continue}}}function W(e){const r=new Map,n=B(e);A()||(g(R(),r),g(M(),r)),n&&(g(K(n),r),g(N(n),r));const s=new Set,t=e?U(e):"";if(t&&y(t)){let o=[];try{o=d(t)}catch{o=[]}for(const a of o){if(a.startsWith("."))continue;const f=i.join(t,a);try{if(!y(i.join(f,"SKILL.md")))continue;r.set(a,f),s.add(a)}catch{continue}}}return{sources:r,privateNames:s}}function b(e,r){try{k(e,r,L)}catch(n){if(n.code==="EEXIST")try{if(p(r).isSymbolicLink()){S(r,{recursive:!0,force:!0}),k(e,r,L);return}l.warn("[farm] \u6280\u80FD\u540D %s \u4E0E\u519C\u573A\u4E2D\u771F\u5B9E\u76EE\u5F55\u51B2\u7A81\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",i.basename(r),r);return}catch{}l.warn("[farm] junction \u5931\u8D25\uFF0C\u56DE\u9000\u590D\u5236 %s \u2192 %s: %s",e,r,n instanceof Error?n.message:String(n));try{let t=!1;try{t=p(r).isSymbolicLink()}catch{t=!1}const o=y(r);if(o&&!t){l.warn("[farm] \u56DE\u9000\u590D\u5236\u76EE\u6807\u4E3A\u771F\u5B9E\u76EE\u5F55\uFF0C\u8DF3\u8FC7\uFF08\u4FDD\u7559\u7528\u6237\u76EE\u5F55\uFF09: %s",r);return}o&&t&&S(r,{recursive:!0,force:!0}),h(e,r,{recursive:!0})}catch(t){l.error("[farm] \u590D\u5236\u56DE\u9000\u4E5F\u5931\u8D25 %s: %s",r,t instanceof Error?t.message:String(t))}}}function Y(e,r){try{return i.resolve(D(e))===i.resolve(D(r))}catch{return!1}}function Q(e){if(!e)return null;const r=C(e);try{const{sources:n,privateNames:s}=W(e);j(r,{recursive:!0});const t=new Set;let o=[];try{o=d(r)}catch{o=[]}for(const c of o){const u=i.join(r,c);try{p(u).isSymbolicLink()&&t.add(c)}catch{continue}}let a=0,f=0;for(const[c,u]of n){const m=i.join(r,c);if(s.has(c)||T(e,"skills",c))t.has(c)?Y(m,u)||(S(m,{recursive:!0,force:!0}),b(u,m),a++):(b(u,m),a++);else if(t.has(c))try{S(m,{recursive:!0,force:!0}),f++}catch{}}for(const c of t)if(!n.has(c))try{S(i.join(r,c),{recursive:!0,force:!0}),f++}catch{}return(a>0||f>0)&&l.info("[farm] agent=%s \u6280\u80FD\u519C\u573A\u5DF2\u540C\u6B65: +%d \u94FE\u63A5, -%d \u53D6\u6D88\u94FE\u63A5 (\u5171 %d \u9879)",e,a,f,n.size),r}catch(n){return l.warn("[farm] agent=%s \u6280\u80FD\u519C\u573A\u540C\u6B65\u5931\u8D25\uFF08\u56DE\u9000\u5168\u5C40\u6280\u80FD\u76EE\u5F55\uFF09: %s",e,n instanceof Error?n.message:String(n)),null}}export{C as getAgentSkillsFarmDir,J as getSkillFarmRoot,Q as syncAgentSkillFarm};
|
|
2
2
|
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
2
7
|
import { type RingBufferEntry } from "./ring-buffer.js";
|
|
3
8
|
export interface BridgeEventPayload {
|
|
4
9
|
readonly category: "status" | "output" | "question" | "file_changed";
|
|
@@ -29,14 +34,29 @@ export interface BridgeEventPayload {
|
|
|
29
34
|
readonly size?: number;
|
|
30
35
|
}
|
|
31
36
|
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
32
41
|
declare class AgentEventStore {
|
|
33
42
|
private readonly agents;
|
|
34
43
|
private ensureBuffer;
|
|
35
44
|
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
36
48
|
append(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
|
|
37
49
|
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
38
56
|
appendOrMergeOutput(agentId: string, payload: BridgeEventPayload): RingBufferEntry<BridgeEventPayload>;
|
|
39
57
|
|
|
58
|
+
|
|
59
|
+
|
|
40
60
|
size(agentId: string): number;
|
|
41
61
|
}
|
|
42
62
|
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
import { type UserScope } from "./user-scope.js";
|
|
20
|
+
export interface AgentOwnerRecord {
|
|
21
|
+
tenantId: string;
|
|
22
|
+
userId: string;
|
|
23
|
+
|
|
24
|
+
operatorUserId?: string;
|
|
25
|
+
updatedAt: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export declare function invalidateAgentOwner(agentId: string): void;
|
|
29
|
+
|
|
30
|
+
export declare function clearAgentOwnerCache(): void;
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
export declare function registerAgentOwner(agentId: string, scope: UserScope, operatorUserId?: string): AgentOwnerRecord;
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
export declare function getAgentOwner(agentId: string): UserScope | null;
|
|
41
|
+
|
|
42
|
+
export declare function getAgentOwnerRecord(agentId: string): AgentOwnerRecord | null;
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
export declare function assertAgentOwnership(agentId: string, scope: UserScope | null | undefined): boolean;
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
export declare function listAgentsOwnedBy(scope: UserScope): string[];
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
export declare function removeAgentOwner(agentId: string): void;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{existsSync as p,mkdirSync as m,readdirSync as I,readFileSync as h,rmSync as S,writeFileSync as y}from"node:fs";import u from"node:path";import{getBridgeDataHome as O,getBridgeInstanceRuntimeDir as A}from"../config.js";import{createLogger as x}from"../utils/logger.js";import{normalizeUserScope as w,scopeEquals as a,sanitizeScopeId as j,setAgentOwnershipChecker as k}from"./user-scope.js";const D=x("agent-ownership"),o=new Map;function d(e){return u.join(A(e),"owner.json")}function c(e){return j(e)}function U(e){o.delete(c(e))}function J(){o.clear()}function g(e){const n=d(e);try{if(!p(n))return null;const t=JSON.parse(h(n,"utf8")),r=w(t.tenantId,t.userId);return r?{tenantId:r.tenantId,userId:r.userId,...t.operatorUserId?{operatorUserId:String(t.operatorUserId)}:{},updatedAt:String(t.updatedAt??new Date().toISOString())}:null}catch(t){return D.warn("[ownership] owner.json \u8BFB\u53D6\u5931\u8D25 agent=%s: %s",e,t instanceof Error?t.message:String(t)),null}}function N(e,n,t){const r=w(n.tenantId,n.userId);if(!r)throw new Error("registerAgentOwner: (tenantId, userId) \u4E0D\u5B8C\u6574");const s=f(e);if(s&&!a(s,r))throw new Error("agent-ownership-mismatch: agent \u5DF2\u5F52\u5C5E\u5176\u4ED6\u7528\u6237\uFF0C\u4E0D\u80FD\u8986\u76D6");const i={tenantId:r.tenantId,userId:r.userId,...t?{operatorUserId:t}:{},updatedAt:new Date().toISOString()},l=d(e);return m(u.dirname(l),{recursive:!0}),y(l,`${JSON.stringify(i,null,2)}
|
|
2
|
+
`,"utf8"),o.set(c(e),i),i}function f(e){const n=c(e);if(o.has(n)){const r=o.get(n);return r?{tenantId:r.tenantId,userId:r.userId}:null}const t=g(e);return o.set(n,t),t?{tenantId:t.tenantId,userId:t.userId}:null}function R(e){const n=c(e);if(o.has(n))return o.get(n)??null;const t=g(e);return o.set(n,t),t}function E(e,n){if(!n)return!1;const t=f(e);return t?a(t,n):!1}function q(e){const n=u.join(O(),"instance-runtime");let t=[];try{t=I(n)}catch{return[]}const r=[];for(const s of t){if(s.startsWith("."))continue;const i=f(s);i&&a(i,e)&&r.push(s)}return r}function H(e){try{S(d(e),{force:!0})}catch{}o.delete(c(e))}k((e,n)=>E(e,n));export{E as assertAgentOwnership,J as clearAgentOwnerCache,f as getAgentOwner,R as getAgentOwnerRecord,U as invalidateAgentOwner,q as listAgentsOwnedBy,N as registerAgentOwner,H as removeAgentOwner};
|
|
3
|
+
|
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
2
8
|
import { type ProcessInfo, type ProcessHealthStatus } from './process-detector.js';
|
|
3
9
|
import { type ProcessRecord, type ProcessState, type HealthStatus } from './process-registry.js';
|
|
4
10
|
|
|
11
|
+
|
|
12
|
+
|
|
5
13
|
export interface ProcessConfig {
|
|
6
14
|
agentId: string;
|
|
7
15
|
sessionId: string;
|
|
@@ -11,11 +19,15 @@ export interface ProcessConfig {
|
|
|
11
19
|
command: string;
|
|
12
20
|
}
|
|
13
21
|
|
|
22
|
+
|
|
23
|
+
|
|
14
24
|
export interface DiscoveredProcess extends ProcessInfo {
|
|
15
25
|
managementStatus: 'managed' | 'orphan' | 'unknown';
|
|
16
26
|
sessionId?: string;
|
|
17
27
|
}
|
|
18
28
|
|
|
29
|
+
|
|
30
|
+
|
|
19
31
|
export interface TerminationResult {
|
|
20
32
|
success: boolean;
|
|
21
33
|
agentId: string;
|
|
@@ -26,54 +38,163 @@ export interface TerminationResult {
|
|
|
26
38
|
message: string;
|
|
27
39
|
}
|
|
28
40
|
|
|
41
|
+
|
|
42
|
+
|
|
29
43
|
export interface ReclamationResult {
|
|
30
44
|
success: boolean;
|
|
31
45
|
pid: number;
|
|
32
46
|
action: 'adopted' | 'terminated' | 'failed';
|
|
33
47
|
}
|
|
34
48
|
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
35
58
|
export declare class AgentProcessManager {
|
|
36
59
|
private static instance;
|
|
37
60
|
private readonly registry;
|
|
38
61
|
|
|
62
|
+
|
|
63
|
+
|
|
39
64
|
private constructor();
|
|
40
65
|
|
|
66
|
+
|
|
67
|
+
|
|
41
68
|
static getInstance(): AgentProcessManager;
|
|
42
69
|
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
43
80
|
startProcess(config: ProcessConfig): Promise<void>;
|
|
44
81
|
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
|
|
45
89
|
discoverAllProcesses(): Promise<DiscoveredProcess[]>;
|
|
46
90
|
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
47
97
|
healthCheckAll(): Promise<Map<string, ProcessHealthStatus>>;
|
|
48
98
|
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
|
|
103
|
+
|
|
49
104
|
healthCheck(agentId: string): Promise<ProcessHealthStatus>;
|
|
50
105
|
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
51
117
|
stopProcess(agentId: string): Promise<TerminationResult>;
|
|
52
118
|
|
|
119
|
+
|
|
120
|
+
|
|
53
121
|
private sendSigterm;
|
|
54
122
|
|
|
123
|
+
|
|
124
|
+
|
|
55
125
|
private sendForceKill;
|
|
56
126
|
|
|
127
|
+
|
|
128
|
+
|
|
129
|
+
|
|
130
|
+
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
|
|
57
135
|
forceKill(agentId: string): Promise<TerminationResult>;
|
|
58
136
|
|
|
137
|
+
|
|
138
|
+
|
|
139
|
+
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
59
146
|
reclaimOrphan(agentId: string): Promise<ReclamationResult>;
|
|
60
147
|
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
|
|
151
|
+
|
|
61
152
|
scanAndReclaimAll(): Promise<Array<{
|
|
62
153
|
agentId: string;
|
|
63
154
|
pid: number;
|
|
64
155
|
action: string;
|
|
65
156
|
}>>;
|
|
66
157
|
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
|
|
67
163
|
markOrphaned(agentId: string): Promise<boolean>;
|
|
68
164
|
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
|
|
69
170
|
isManaged(agentId: string): boolean;
|
|
70
171
|
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
|
|
71
176
|
getAllManagedProcesses(): ProcessRecord[];
|
|
72
177
|
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
|
|
73
183
|
getManagedProcessesByState(state: ProcessState): ProcessRecord[];
|
|
74
184
|
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
|
|
75
189
|
getUnmanagedProcesses(): Promise<ProcessInfo[]>;
|
|
76
190
|
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
|
|
77
198
|
rebuildRegistry(sessions: Array<{
|
|
78
199
|
agentId: string;
|
|
79
200
|
sessionId: string;
|
|
@@ -83,16 +204,49 @@ export declare class AgentProcessManager {
|
|
|
83
204
|
mode?: 'sdk';
|
|
84
205
|
}>): Promise<void>;
|
|
85
206
|
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
|
|
86
211
|
getStats(): Record<ProcessState | 'total', number>;
|
|
87
212
|
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
|
|
88
223
|
cleanupStaleRegistry(): Promise<number>;
|
|
89
224
|
|
|
225
|
+
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
|
|
90
230
|
removeProcess(agentId: string): Promise<boolean>;
|
|
91
231
|
|
|
232
|
+
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
|
|
236
|
+
|
|
92
237
|
getProcess(agentId: string): ProcessRecord | undefined;
|
|
93
238
|
|
|
239
|
+
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
|
|
243
|
+
|
|
94
244
|
getProcessByPid(pid: number): ProcessRecord | undefined;
|
|
95
245
|
}
|
|
96
246
|
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
|
|
97
251
|
export declare function getAgentProcessManager(): AgentProcessManager;
|
|
98
252
|
export type { ProcessRecord, ProcessState, HealthStatus, ProcessInfo, ProcessHealthStatus };
|
|
@@ -1,6 +1,24 @@
|
|
|
1
1
|
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
2
16
|
import type { TerminalManager, TerminalCreateOpts, TerminalReadOpts, TerminalReadResult } from "@agentswork/acode";
|
|
3
17
|
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
4
22
|
export declare function detectNeedsInput(text: string): boolean;
|
|
5
23
|
export declare class AgentPtyManager implements TerminalManager {
|
|
6
24
|
private cursors;
|
|
@@ -13,7 +31,28 @@ export declare class AgentPtyManager implements TerminalManager {
|
|
|
13
31
|
read(id: string, opts: TerminalReadOpts): TerminalReadResult;
|
|
14
32
|
kill(id: string): void;
|
|
15
33
|
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
16
41
|
killByAgent(agentId: string): void;
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
listWaitingForInput(agentId: string): string[];
|
|
17
56
|
resize(id: string, cols: number, rows: number): void;
|
|
18
57
|
|
|
19
58
|
private touch;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import{ptySessions as
|
|
2
|
-
`).pop()??"";return!!(/[:?]\s*$/.test(
|
|
3
|
-
`),
|
|
4
|
-
`),
|
|
1
|
+
import{ptySessions as u,createPtySession as y,closePtySession as a,readPtyOutputBuffer as d}from"../routes/pty.js";const T=30*60*1e3,M=2e3,l=500;function p(c){const t=c.trimEnd();if(!t)return!1;const s=t.split(`
|
|
2
|
+
`).pop()??"";return!!(/[:?]\s*$/.test(s)||/\((?:yes\/no|Y\/N|y\/n)\)/i.test(s)||/\b[Yy]\/?[Nn]\b/.test(s)||/\(press RETURN\)/i.test(s)||/\(press ENTER\)/i.test(s)||/press ENTER[^]*continue/i.test(s))}function w(c){const t=d(c);if(!t)return"";const s=t.split(`
|
|
3
|
+
`);for(let e=s.length-1;e>=0;e-=1){const n=s[e]??"";if(n.trim())return n}return""}class I{constructor(){this.cursors=new Map,this.idleTimers=new Map}create(t){const s=t.shell&&t.shell.trim()?t.shell.trim():"auto",e=typeof t.cols=="number"&&t.cols>0?Math.min(t.cols,l):120,n=typeof t.rows=="number"&&t.rows>0?Math.min(t.rows,l):30,i=t.preCommand&&t.preCommand.trim()?t.preCommand:void 0,r=y({workspacePath:t.cwd,shell:s,cols:e,rows:n,preCommand:i,persistent:!0,ownerUserId:t.agentId}),o=u.get(r.id);return this.cursors.set(r.id,0),this.touch(r.id),{id:r.id,pid:o?.ptyProcess.pid}}write(t,s){const e=u.get(t);!e||e.status==="exited"||(e.ptyProcess.write(s.replace(/\n/g,"\r")),this.touch(t))}read(t,s){const e=u.get(t);if(!e)return{status:"closed",exit_code:null,output:"",needs_input:!1,truncated:!1};this.touch(t);const n=d(e),i=this.cursors.get(t)??0,r=i>=n.length?"":n.slice(i);this.cursors.set(t,n.length);const o=r.split(`
|
|
4
|
+
`),f=Math.min(Math.max(1,s.lines??200),M);let h=o,m=!1;o.length>f&&(h=o.slice(o.length-f),m=!0);const g=e.status==="running"&&p(r);return{status:e.status,exit_code:e.exitCode??null,output:h.join(`
|
|
5
|
+
`),needs_input:g,truncated:m}}kill(t){a(t,"agent-kill"),this.cursors.delete(t),this.clearIdle(t)}killByAgent(t){if(!t)return;const s=[];for(const[e,n]of u.entries())n.ownerUserId===t&&s.push(e);for(const e of s){try{a(e,`agent-stop:${t}`)}catch{}this.cursors.delete(e),this.clearIdle(e)}}listWaitingForInput(t){const s=[];for(const e of u.values())e.ownerUserId===t&&e.status==="running"&&p(w(e))&&s.push(e.id);return s}resize(t,s,e){const n=u.get(t);if(!n)return;const i=typeof s=="number"&&s>0?Math.min(s,l):120,r=typeof e=="number"&&e>0?Math.min(e,l):30;n.ptyProcess.resize(i,r)}touch(t){const s=this.idleTimers.get(t);s&&clearTimeout(s);const e=setTimeout(()=>{a(t,"agent-idle-timeout"),this.cursors.delete(t),this.idleTimers.delete(t)},T);e.unref?.(),this.idleTimers.set(t,e)}clearIdle(t){const s=this.idleTimers.get(t);s&&clearTimeout(s),this.idleTimers.delete(t)}}const _=new I;export{I as AgentPtyManager,_ as agentPtyManager,p as detectNeedsInput};
|
|
5
6
|
|
|
@@ -1,11 +1,45 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
3
19
|
export interface AgentStartupMemoryOptions {
|
|
4
20
|
schedulerBaseUrl?: string;
|
|
5
21
|
runtimeAccessToken?: string;
|
|
6
22
|
agentId?: string;
|
|
7
23
|
}
|
|
8
24
|
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
9
34
|
export declare function loadAgentStartupMemories(workspacePath: string, options?: AgentStartupMemoryOptions): Promise<string | undefined>;
|
|
10
35
|
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
|
|
11
45
|
export declare function buildAgentStartupMemorySnapshot(workspacePath: string, agentId: string | undefined): () => Promise<string | null>;
|