@evalops/maestro 0.10.22 → 0.10.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/agent/agent.d.ts +2 -2
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +1 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/keys.d.ts +2 -5
- package/dist/agent/keys.d.ts.map +1 -1
- package/dist/agent/keys.js +4 -5
- package/dist/agent/keys.js.map +1 -1
- package/dist/agent/modes.d.ts +2 -2
- package/dist/agent/modes.d.ts.map +1 -1
- package/dist/agent/modes.js +6 -7
- package/dist/agent/modes.js.map +1 -1
- package/dist/agent/providers/anthropic.d.ts.map +1 -1
- package/dist/agent/providers/anthropic.js +4 -4
- package/dist/agent/providers/anthropic.js.map +1 -1
- package/dist/agent/providers/google.js +1 -1
- package/dist/agent/swarm/executor.d.ts +2 -0
- package/dist/agent/swarm/executor.d.ts.map +1 -1
- package/dist/agent/swarm/executor.js +208 -35
- package/dist/agent/swarm/executor.js.map +1 -1
- package/dist/agent/swarm/types.d.ts +2 -0
- package/dist/agent/swarm/types.d.ts.map +1 -1
- package/dist/agent/swarm/types.js.map +1 -1
- package/dist/agent/tool-capability-types.d.ts +36 -0
- package/dist/agent/tool-capability-types.d.ts.map +1 -0
- package/dist/agent/tool-capability-types.js +2 -0
- package/dist/agent/tool-capability-types.js.map +1 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts +13 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -1
- package/dist/agent/transport/tool-execution-bridge.js +28 -15
- package/dist/agent/transport/tool-execution-bridge.js.map +1 -1
- package/dist/agent/transport/transport-utils.d.ts.map +1 -1
- package/dist/agent/transport/transport-utils.js +2 -3
- package/dist/agent/transport/transport-utils.js.map +1 -1
- package/dist/agent/transport.js +1 -1
- package/dist/agent/transport.js.map +1 -1
- package/dist/agent/type-guards.d.ts +1 -1
- package/dist/agent/type-guards.js +1 -1
- package/dist/agent/type-guards.js.map +1 -1
- package/dist/agent/types.d.ts +5 -3
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js +2 -2
- package/dist/agent/types.js.map +1 -1
- package/dist/app-server/daemon-lifecycle-api.d.ts +31 -0
- package/dist/app-server/daemon-lifecycle-api.d.ts.map +1 -0
- package/dist/app-server/daemon-lifecycle-api.js +259 -0
- package/dist/app-server/daemon-lifecycle-api.js.map +1 -0
- package/dist/app-server/external-agent-import-api.d.ts +30 -0
- package/dist/app-server/external-agent-import-api.d.ts.map +1 -0
- package/dist/app-server/external-agent-import-api.js +553 -0
- package/dist/app-server/external-agent-import-api.js.map +1 -0
- package/dist/app-server/host-control-api.d.ts +30 -0
- package/dist/app-server/host-control-api.d.ts.map +1 -0
- package/dist/app-server/host-control-api.js +343 -0
- package/dist/app-server/host-control-api.js.map +1 -0
- package/dist/app-server/in-process-client.d.ts +2 -2
- package/dist/app-server/in-process-client.d.ts.map +1 -1
- package/dist/app-server/in-process-client.js.map +1 -1
- package/dist/app-server/network-governance-api.d.ts +26 -0
- package/dist/app-server/network-governance-api.d.ts.map +1 -0
- package/dist/app-server/network-governance-api.js +476 -0
- package/dist/app-server/network-governance-api.js.map +1 -0
- package/dist/app-server/plugin-bundle-api.d.ts +17 -0
- package/dist/app-server/plugin-bundle-api.d.ts.map +1 -0
- package/dist/app-server/plugin-bundle-api.js +219 -0
- package/dist/app-server/plugin-bundle-api.js.map +1 -0
- package/dist/app-server/policy-control-api.d.ts +14 -0
- package/dist/app-server/policy-control-api.d.ts.map +1 -0
- package/dist/app-server/policy-control-api.js +200 -0
- package/dist/app-server/policy-control-api.js.map +1 -0
- package/dist/app-server/protocol-modes-api.d.ts +22 -0
- package/dist/app-server/protocol-modes-api.d.ts.map +1 -0
- package/dist/app-server/protocol-modes-api.js +124 -0
- package/dist/app-server/protocol-modes-api.js.map +1 -0
- package/dist/app-server/sandbox-proof-api.d.ts +21 -0
- package/dist/app-server/sandbox-proof-api.d.ts.map +1 -0
- package/dist/app-server/sandbox-proof-api.js +127 -0
- package/dist/app-server/sandbox-proof-api.js.map +1 -0
- package/dist/app-server/session-api.d.ts +93 -3
- package/dist/app-server/session-api.d.ts.map +1 -1
- package/dist/app-server/session-api.js +706 -18
- package/dist/app-server/session-api.js.map +1 -1
- package/dist/audit/logger.d.ts +1 -1
- package/dist/bootstrap/auth-setup.d.ts.map +1 -1
- package/dist/bootstrap/auth-setup.js +17 -2
- package/dist/bootstrap/auth-setup.js.map +1 -1
- package/dist/bootstrap/model-resolution-setup.d.ts.map +1 -1
- package/dist/bootstrap/model-resolution-setup.js +19 -4
- package/dist/bootstrap/model-resolution-setup.js.map +1 -1
- package/dist/cli/args.d.ts +2 -2
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +2 -2
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/a2a.d.ts.map +1 -1
- package/dist/cli/commands/a2a.js +226 -14
- package/dist/cli/commands/a2a.js.map +1 -1
- package/dist/cli/commands/anthropic.d.ts +1 -1
- package/dist/cli/commands/anthropic.d.ts.map +1 -1
- package/dist/cli/commands/anthropic.js +3 -68
- package/dist/cli/commands/anthropic.js.map +1 -1
- package/dist/cli/commands/modes.js +1 -1
- package/dist/cli/commands/modes.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +5 -7
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/rpc-mode.d.ts +1 -1
- package/dist/cli/rpc-mode.js +1 -1
- package/dist/cli/rpc-mode.js.map +1 -1
- package/dist/cli/session.js +1 -1
- package/dist/cli/session.js.map +1 -1
- package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -1
- package/dist/cli-tui/commands/command-catalog.js +7 -12
- package/dist/cli-tui/commands/command-catalog.js.map +1 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.d.ts +1 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.d.ts.map +1 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.js +4 -12
- package/dist/cli-tui/commands/subcommands/auth-commands.js.map +1 -1
- package/dist/cli-tui/custom-editor.d.ts +1 -1
- package/dist/cli-tui/custom-editor.js +2 -2
- package/dist/cli-tui/custom-editor.js.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.js +19 -23
- package/dist/cli-tui/oauth/oauth-flow-controller.js.map +1 -1
- package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/model-selector.js +0 -1
- package/dist/cli-tui/selectors/model-selector.js.map +1 -1
- package/dist/cli-tui/selectors/oauth-selector-view.d.ts +2 -2
- package/dist/cli-tui/selectors/oauth-selector-view.d.ts.map +1 -1
- package/dist/cli-tui/selectors/oauth-selector-view.js.map +1 -1
- package/dist/cli-tui/selectors/oauth-selector.d.ts +2 -2
- package/dist/cli-tui/selectors/oauth-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/oauth-selector.js +3 -4
- package/dist/cli-tui/selectors/oauth-selector.js.map +1 -1
- package/dist/cli-tui/tui-renderer/mcp-events-setup.js +1 -1
- package/dist/cli-tui/tui-renderer/mcp-events-setup.js.map +1 -1
- package/dist/cli-tui/tui-renderer.js +2 -2
- package/dist/cli-tui/tui-renderer.js.map +1 -1
- package/dist/cli-tui/utils/footer-utils.d.ts +1 -1
- package/dist/cli-tui/utils/footer-utils.js +1 -1
- package/dist/cli-tui/utils/footer-utils.js.map +1 -1
- package/dist/cli.js +15171 -14298
- package/dist/commands/prompts.d.ts +1 -1
- package/dist/commands/prompts.js +1 -1
- package/dist/commands/prompts.js.map +1 -1
- package/dist/config/constants.d.ts +2 -2
- package/dist/config/constants.d.ts.map +1 -1
- package/dist/config/constants.js +2 -2
- package/dist/config/constants.js.map +1 -1
- package/dist/config/index.d.ts +1 -1
- package/dist/config/index.js +1 -1
- package/dist/config/index.js.map +1 -1
- package/dist/config/toml-config.js +3 -3
- package/dist/config/toml-config.js.map +1 -1
- package/dist/db/client.d.ts +2 -2
- package/dist/db/client.js +2 -2
- package/dist/db/client.js.map +1 -1
- package/dist/db/migrate.d.ts +1 -1
- package/dist/db/migrate.js +1 -1
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/schema.d.ts +2 -2
- package/dist/db/schema.js +1 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/errors/index.d.ts +2 -2
- package/dist/errors/index.js +2 -2
- package/dist/errors/index.js.map +1 -1
- package/dist/main.d.ts +4 -5
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +17 -14
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts +15 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +50 -26
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/fathom-cua.d.ts.map +1 -1
- package/dist/mcp/fathom-cua.js +10 -0
- package/dist/mcp/fathom-cua.js.map +1 -1
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +32 -1
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/tool-bridge.d.ts.map +1 -1
- package/dist/mcp/tool-bridge.js +12 -3
- package/dist/mcp/tool-bridge.js.map +1 -1
- package/dist/mcp/tool-capabilities.d.ts +5 -0
- package/dist/mcp/tool-capabilities.d.ts.map +1 -0
- package/dist/mcp/tool-capabilities.js +271 -0
- package/dist/mcp/tool-capabilities.js.map +1 -0
- package/dist/mcp/types.d.ts +6 -1
- package/dist/mcp/types.d.ts.map +1 -1
- package/dist/mcp/types.js.map +1 -1
- package/dist/models/config-loader.d.ts +1 -1
- package/dist/models/factory-integration.d.ts +1 -1
- package/dist/models/factory-integration.js +1 -1
- package/dist/models/factory-integration.js.map +1 -1
- package/dist/node_modules/@evalops/contracts/dist/artifacts.d.ts +58 -0
- package/dist/node_modules/@evalops/contracts/dist/artifacts.d.ts.map +1 -0
- package/dist/node_modules/@evalops/contracts/dist/artifacts.js +191 -0
- package/dist/node_modules/@evalops/contracts/dist/artifacts.js.map +1 -0
- package/dist/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +10 -10
- package/dist/node_modules/@evalops/contracts/dist/index.d.ts +4 -3
- package/dist/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
- package/dist/node_modules/@evalops/contracts/dist/index.js +3 -2
- package/dist/node_modules/@evalops/contracts/dist/index.js.map +1 -1
- package/dist/node_modules/@evalops/contracts/dist/maestro-app-server.d.ts +1182 -14
- package/dist/node_modules/@evalops/contracts/dist/maestro-app-server.d.ts.map +1 -1
- package/dist/node_modules/@evalops/contracts/dist/maestro-app-server.js +450 -1
- package/dist/node_modules/@evalops/contracts/dist/maestro-app-server.js.map +1 -1
- package/dist/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +1 -1
- package/dist/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +3 -3
- package/dist/node_modules/@evalops/contracts/package.json +1 -1
- package/dist/node_modules/@evalops/tui/package.json +1 -1
- package/dist/oauth/connectors.d.ts +2 -2
- package/dist/oauth/connectors.d.ts.map +1 -1
- package/dist/oauth/connectors.js +3 -5
- package/dist/oauth/connectors.js.map +1 -1
- package/dist/oauth/github-copilot.d.ts +1 -1
- package/dist/oauth/github-copilot.js +1 -1
- package/dist/oauth/github-copilot.js.map +1 -1
- package/dist/oauth/index.d.ts +10 -8
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +54 -31
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/openai.d.ts +1 -1
- package/dist/oauth/openai.js +2 -2
- package/dist/oauth/openai.js.map +1 -1
- package/dist/platform/a2a-completion-audit.d.ts +41 -0
- package/dist/platform/a2a-completion-audit.d.ts.map +1 -0
- package/dist/platform/a2a-completion-audit.js +177 -0
- package/dist/platform/a2a-completion-audit.js.map +1 -0
- package/dist/platform/a2a-task-ledger.d.ts.map +1 -1
- package/dist/platform/a2a-task-ledger.js +17 -0
- package/dist/platform/a2a-task-ledger.js.map +1 -1
- package/dist/platform/a2a-telemetry-inspect.d.ts +58 -0
- package/dist/platform/a2a-telemetry-inspect.d.ts.map +1 -0
- package/dist/platform/a2a-telemetry-inspect.js +224 -0
- package/dist/platform/a2a-telemetry-inspect.js.map +1 -0
- package/dist/platform/agent-registry-client.d.ts +8 -0
- package/dist/platform/agent-registry-client.d.ts.map +1 -1
- package/dist/platform/agent-registry-client.js +9 -1
- package/dist/platform/agent-registry-client.js.map +1 -1
- package/dist/providers/api-keys.d.ts +2 -2
- package/dist/providers/api-keys.js +2 -2
- package/dist/providers/api-keys.js.map +1 -1
- package/dist/providers/auth.d.ts +3 -6
- package/dist/providers/auth.d.ts.map +1 -1
- package/dist/providers/auth.js +1 -40
- package/dist/providers/auth.js.map +1 -1
- package/dist/rpc/index.d.ts +2 -2
- package/dist/rpc/index.js +2 -2
- package/dist/rpc/index.js.map +1 -1
- package/dist/rpc/rpc-types.d.ts +1 -1
- package/dist/rpc/rpc-types.js +1 -1
- package/dist/rpc/rpc-types.js.map +1 -1
- package/dist/safety/nested-agent-guard.js +1 -1
- package/dist/safety/nested-agent-guard.js.map +1 -1
- package/dist/safety/policy.d.ts +2 -2
- package/dist/safety/policy.js +2 -2
- package/dist/safety/policy.js.map +1 -1
- package/dist/safety/validators/network-policy-validator.d.ts +8 -0
- package/dist/safety/validators/network-policy-validator.d.ts.map +1 -1
- package/dist/safety/validators/network-policy-validator.js +29 -4
- package/dist/safety/validators/network-policy-validator.js.map +1 -1
- package/dist/sandbox/local-sandbox.d.ts +1 -1
- package/dist/sandbox/local-sandbox.js +1 -1
- package/dist/sandbox/local-sandbox.js.map +1 -1
- package/dist/server/app-context.d.ts +2 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/handlers/attachments.d.ts.map +1 -1
- package/dist/server/handlers/attachments.js +1 -0
- package/dist/server/handlers/attachments.js.map +1 -1
- package/dist/server/handlers/models.d.ts.map +1 -1
- package/dist/server/handlers/models.js +3 -1
- package/dist/server/handlers/models.js.map +1 -1
- package/dist/server/handlers/session-artifacts.d.ts.map +1 -1
- package/dist/server/handlers/session-artifacts.js +13 -74
- package/dist/server/handlers/session-artifacts.js.map +1 -1
- package/dist/server/handlers/session-attachments.d.ts.map +1 -1
- package/dist/server/handlers/session-attachments.js +2 -0
- package/dist/server/handlers/session-attachments.js.map +1 -1
- package/dist/server/handlers/sessions.js +1 -1
- package/dist/server/handlers/sessions.js.map +1 -1
- package/dist/server/handlers/status.d.ts +2 -0
- package/dist/server/handlers/status.d.ts.map +1 -1
- package/dist/server/handlers/status.js +3 -2
- package/dist/server/handlers/status.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +32 -3
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-session-manager.d.ts +2 -0
- package/dist/server/hosted-session-manager.d.ts.map +1 -1
- package/dist/server/hosted-session-manager.js +9 -0
- package/dist/server/hosted-session-manager.js.map +1 -1
- package/dist/server/model-selection.d.ts.map +1 -1
- package/dist/server/model-selection.js +9 -1
- package/dist/server/model-selection.js.map +1 -1
- package/dist/server/rate-limiter.d.ts +1 -1
- package/dist/server/rate-limiter.js +1 -1
- package/dist/server/rate-limiter.js.map +1 -1
- package/dist/server/router.d.ts +2 -2
- package/dist/server/router.js.map +1 -1
- package/dist/server/session-serialization.d.ts +9 -9
- package/dist/server/session-serialization.js +15 -15
- package/dist/server/session-serialization.js.map +1 -1
- package/dist/session/manager.d.ts +5 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +56 -8
- package/dist/session/manager.js.map +1 -1
- package/dist/session/session-catalog.d.ts +2 -0
- package/dist/session/session-catalog.d.ts.map +1 -1
- package/dist/session/session-catalog.js +6 -0
- package/dist/session/session-catalog.js.map +1 -1
- package/dist/session/session-context.d.ts +2 -0
- package/dist/session/session-context.d.ts.map +1 -1
- package/dist/session/session-context.js +15 -0
- package/dist/session/session-context.js.map +1 -1
- package/dist/session/types.d.ts +7 -0
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js.map +1 -1
- package/dist/session/wire-format.generated.d.ts +1 -0
- package/dist/session/wire-format.generated.d.ts.map +1 -1
- package/dist/session/wire-format.generated.js +1 -0
- package/dist/session/wire-format.generated.js.map +1 -1
- package/dist/shared-memory/contract.d.ts +4 -4
- package/dist/shared-memory/contract.js +2 -2
- package/dist/shared-memory/contract.js.map +1 -1
- package/dist/telemetry/index.d.ts +2 -2
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +2 -2
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts +57 -0
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-bus.js +59 -1
- package/dist/telemetry/maestro-event-bus.js.map +1 -1
- package/dist/telemetry/maestro-event-catalog.d.ts +17 -1
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -1
- package/dist/telemetry/maestro-event-catalog.js +24 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -1
- package/dist/telemetry/mcp-beacon.d.ts +2 -0
- package/dist/telemetry/mcp-beacon.d.ts.map +1 -1
- package/dist/telemetry/mcp-beacon.js +15 -0
- package/dist/telemetry/mcp-beacon.js.map +1 -1
- package/dist/telemetry/metrics.d.ts +62 -0
- package/dist/telemetry/metrics.d.ts.map +1 -1
- package/dist/telemetry/metrics.js +84 -0
- package/dist/telemetry/metrics.js.map +1 -1
- package/dist/telemetry.d.ts +44 -0
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +84 -2
- package/dist/telemetry.js.map +1 -1
- package/dist/theme/theme-loader.js +2 -2
- package/dist/theme/theme-loader.js.map +1 -1
- package/dist/theme/theme-schema.json +2 -2
- package/dist/theme/theme.d.ts +1 -1
- package/dist/theme/theme.js.map +1 -1
- package/dist/tools/background/task-types.d.ts +1 -1
- package/dist/tools/extract-document.d.ts +1 -0
- package/dist/tools/extract-document.d.ts.map +1 -1
- package/dist/tools/extract-document.js +2 -1
- package/dist/tools/extract-document.js.map +1 -1
- package/dist/tools/index.d.ts +55 -55
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/tool-dsl.d.ts +1 -1
- package/dist/tools/tool-dsl.js +1 -1
- package/dist/tools/tool-dsl.js.map +1 -1
- package/dist/utils/document-extractor.d.ts +1 -0
- package/dist/utils/document-extractor.d.ts.map +1 -1
- package/dist/utils/document-extractor.js +320 -40
- package/dist/utils/document-extractor.js.map +1 -1
- package/dist/utils/logger.d.ts +1 -1
- package/dist/utils/logger.js +1 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/version.json +2 -2
- package/dist/web-server.d.ts +1 -1
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +12 -8
- package/dist/web-server.js.map +1 -1
- package/package.json +4 -2
- package/dist/oauth/anthropic.d.ts +0 -17
- package/dist/oauth/anthropic.d.ts.map +0 -1
- package/dist/oauth/anthropic.js +0 -81
- package/dist/oauth/anthropic.js.map +0 -1
- package/dist/providers/anthropic-auth.d.ts +0 -75
- package/dist/providers/anthropic-auth.d.ts.map +0 -1
- package/dist/providers/anthropic-auth.js +0 -221
- package/dist/providers/anthropic-auth.js.map +0 -1
|
@@ -1,9 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { resolve } from "node:path";
|
|
2
|
+
import { maestroAppServerClientMethods, maestroAppServerProtocolVersion, maestroAppServerSupportedProtocolVersions, } from "@evalops/contracts";
|
|
2
3
|
import { getRegisteredModels } from "../models/registry.js";
|
|
3
4
|
import { safeReadSessionEntries } from "../session/session-context.js";
|
|
4
5
|
import { buildSessionGraphProjection, } from "../session/session-graph-projection.js";
|
|
6
|
+
import { MaestroAppServerDaemonLifecycleError, createMaestroAppServerDaemonLifecycle, } from "./daemon-lifecycle-api.js";
|
|
7
|
+
import { MaestroAppServerExternalAgentImportError, createMaestroAppServerExternalAgentImport, normalizeExternalAgentImportParams, } from "./external-agent-import-api.js";
|
|
8
|
+
import { MaestroAppServerHostControlError, createMaestroAppServerHostControl, } from "./host-control-api.js";
|
|
9
|
+
import { MaestroAppServerNetworkGovernanceError, createMaestroAppServerNetworkGovernance, } from "./network-governance-api.js";
|
|
10
|
+
import { MaestroAppServerPluginBundleError, createMaestroAppServerPluginBundleApi, } from "./plugin-bundle-api.js";
|
|
11
|
+
import { MaestroAppServerPolicyControlError, createMaestroAppServerPolicyControl, } from "./policy-control-api.js";
|
|
12
|
+
import { MaestroAppServerProtocolModesError, createMaestroAppServerProtocolModes, } from "./protocol-modes-api.js";
|
|
13
|
+
import { MaestroAppServerSandboxProofError, createMaestroAppServerSandboxProof, normalizeSandboxProofParams, } from "./sandbox-proof-api.js";
|
|
5
14
|
const DEFAULT_PAGE_LIMIT = 50;
|
|
6
15
|
const MAX_PAGE_LIMIT = 100;
|
|
16
|
+
export { createMaestroAppServerDaemonLifecycle, } from "./daemon-lifecycle-api.js";
|
|
17
|
+
export { createMaestroAppServerExternalAgentImport, } from "./external-agent-import-api.js";
|
|
18
|
+
export { createMaestroAppServerPluginBundleApi, } from "./plugin-bundle-api.js";
|
|
19
|
+
export { createMaestroAppServerProtocolModes, } from "./protocol-modes-api.js";
|
|
20
|
+
export { createMaestroAppServerSandboxProof, } from "./sandbox-proof-api.js";
|
|
7
21
|
export class MaestroAppServerError extends Error {
|
|
8
22
|
constructor(code, message) {
|
|
9
23
|
super(message);
|
|
@@ -50,10 +64,14 @@ function requireThreadId(params) {
|
|
|
50
64
|
return threadId;
|
|
51
65
|
}
|
|
52
66
|
function toThreadSummary(metadata, summary) {
|
|
53
|
-
|
|
67
|
+
const archived = summary?.archived ?? metadata.archived ?? false;
|
|
68
|
+
const archivedAt = archived
|
|
69
|
+
? (summary?.archivedAt ?? metadata.archivedAt)
|
|
70
|
+
: undefined;
|
|
71
|
+
const thread = {
|
|
54
72
|
id: metadata.id,
|
|
55
73
|
source: "session",
|
|
56
|
-
status: "notLoaded",
|
|
74
|
+
status: archived ? "archived" : "notLoaded",
|
|
57
75
|
title: summary?.title ?? metadata.title ?? metadata.summary,
|
|
58
76
|
summary: metadata.summary,
|
|
59
77
|
resumeSummary: summary?.resumeSummary ?? metadata.resumeSummary,
|
|
@@ -65,13 +83,19 @@ function toThreadSummary(metadata, summary) {
|
|
|
65
83
|
messageCount: metadata.messageCount,
|
|
66
84
|
favorite: summary?.favorite ?? metadata.favorite,
|
|
67
85
|
tags: summary?.tags ?? metadata.tags,
|
|
86
|
+
archived,
|
|
68
87
|
};
|
|
88
|
+
if (archivedAt) {
|
|
89
|
+
thread.archivedAt = archivedAt;
|
|
90
|
+
}
|
|
91
|
+
return thread;
|
|
69
92
|
}
|
|
70
93
|
function toThreadSummaryFromSessionSummary(summary) {
|
|
71
|
-
|
|
94
|
+
const archived = summary.archived ?? false;
|
|
95
|
+
const thread = {
|
|
72
96
|
id: summary.id,
|
|
73
97
|
source: "session",
|
|
74
|
-
status: "notLoaded",
|
|
98
|
+
status: archived ? "archived" : "notLoaded",
|
|
75
99
|
title: summary.title ?? summary.subject,
|
|
76
100
|
summary: summary.summary ?? summary.title ?? summary.subject,
|
|
77
101
|
resumeSummary: summary.resumeSummary,
|
|
@@ -82,13 +106,19 @@ function toThreadSummaryFromSessionSummary(summary) {
|
|
|
82
106
|
messageCount: summary.messageCount,
|
|
83
107
|
favorite: summary.favorite,
|
|
84
108
|
tags: summary.tags,
|
|
109
|
+
archived,
|
|
85
110
|
};
|
|
111
|
+
if (archived && summary.archivedAt) {
|
|
112
|
+
thread.archivedAt = summary.archivedAt;
|
|
113
|
+
}
|
|
114
|
+
return thread;
|
|
86
115
|
}
|
|
87
116
|
function toThreadSummaryFromLoadedSession(loaded) {
|
|
88
|
-
|
|
117
|
+
const archived = loaded.archived ?? false;
|
|
118
|
+
const thread = {
|
|
89
119
|
id: loaded.id,
|
|
90
120
|
source: "session",
|
|
91
|
-
status: "notLoaded",
|
|
121
|
+
status: archived ? "archived" : "notLoaded",
|
|
92
122
|
title: loaded.title ?? loaded.subject,
|
|
93
123
|
summary: loaded.summary ?? loaded.title ?? loaded.subject,
|
|
94
124
|
resumeSummary: loaded.resumeSummary,
|
|
@@ -99,7 +129,12 @@ function toThreadSummaryFromLoadedSession(loaded) {
|
|
|
99
129
|
messageCount: loaded.messageCount,
|
|
100
130
|
favorite: loaded.favorite,
|
|
101
131
|
tags: loaded.tags,
|
|
132
|
+
archived,
|
|
102
133
|
};
|
|
134
|
+
if (archived && loaded.archivedAt) {
|
|
135
|
+
thread.archivedAt = loaded.archivedAt;
|
|
136
|
+
}
|
|
137
|
+
return thread;
|
|
103
138
|
}
|
|
104
139
|
function appMessageContent(message) {
|
|
105
140
|
return "content" in message ? message.content : message;
|
|
@@ -213,6 +248,37 @@ async function requireExistingThreadReference(store, threadId) {
|
|
|
213
248
|
async function flushSessionWrites(store) {
|
|
214
249
|
await store.flush?.();
|
|
215
250
|
}
|
|
251
|
+
async function restoreSessionBinding(store, sessionReference, leafId) {
|
|
252
|
+
if (!sessionReference) {
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
const dbSessionId = sessionReference.startsWith("db:")
|
|
256
|
+
? sessionReference.slice("db:".length)
|
|
257
|
+
: undefined;
|
|
258
|
+
let restored = false;
|
|
259
|
+
if (dbSessionId && store.resumeSession) {
|
|
260
|
+
restored = await store.resumeSession(dbSessionId);
|
|
261
|
+
}
|
|
262
|
+
if (!restored) {
|
|
263
|
+
await store.setSessionFile?.(sessionReference);
|
|
264
|
+
}
|
|
265
|
+
if (leafId === null) {
|
|
266
|
+
await store.resetLeaf?.();
|
|
267
|
+
}
|
|
268
|
+
else if (leafId && store.branch) {
|
|
269
|
+
await store.branch(leafId);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
function getCurrentLeafId(store) {
|
|
273
|
+
return store.getLeafId?.() ?? store.getCurrentLeafId?.() ?? null;
|
|
274
|
+
}
|
|
275
|
+
function isActiveThreadSessionFile(store, sessionFile) {
|
|
276
|
+
const activeSessionFile = store.getSessionFile?.();
|
|
277
|
+
if (!activeSessionFile) {
|
|
278
|
+
return false;
|
|
279
|
+
}
|
|
280
|
+
return resolve(activeSessionFile) === resolve(sessionFile);
|
|
281
|
+
}
|
|
216
282
|
async function summarizeThreadAfterMutation(store, threadId) {
|
|
217
283
|
await flushSessionWrites(store);
|
|
218
284
|
const loaded = await store.loadSession(threadId, {
|
|
@@ -351,7 +417,38 @@ function mergeProviderCapabilities(current, model, providerName) {
|
|
|
351
417
|
},
|
|
352
418
|
};
|
|
353
419
|
}
|
|
354
|
-
export function createMaestroAppServerSessionApi(store) {
|
|
420
|
+
export function createMaestroAppServerSessionApi(store, options = {}) {
|
|
421
|
+
const hostControl = options.hostControl === false
|
|
422
|
+
? undefined
|
|
423
|
+
: (options.hostControl ??
|
|
424
|
+
createMaestroAppServerHostControl({
|
|
425
|
+
onNotification: options.onNotification,
|
|
426
|
+
}));
|
|
427
|
+
const policyControl = options.policyControl === false
|
|
428
|
+
? undefined
|
|
429
|
+
: (options.policyControl ?? createMaestroAppServerPolicyControl());
|
|
430
|
+
const networkGovernance = options.networkGovernance === false
|
|
431
|
+
? undefined
|
|
432
|
+
: (options.networkGovernance ??
|
|
433
|
+
createMaestroAppServerNetworkGovernance());
|
|
434
|
+
const sandboxProof = options.sandboxProof === false
|
|
435
|
+
? undefined
|
|
436
|
+
: (options.sandboxProof ?? createMaestroAppServerSandboxProof());
|
|
437
|
+
const pluginBundles = options.pluginBundles === false
|
|
438
|
+
? undefined
|
|
439
|
+
: (options.pluginBundles ?? createMaestroAppServerPluginBundleApi());
|
|
440
|
+
const daemonLifecycle = options.daemonLifecycle === false
|
|
441
|
+
? undefined
|
|
442
|
+
: (options.daemonLifecycle ?? createMaestroAppServerDaemonLifecycle());
|
|
443
|
+
const protocolModes = options.protocolModes === false
|
|
444
|
+
? undefined
|
|
445
|
+
: (options.protocolModes ?? createMaestroAppServerProtocolModes());
|
|
446
|
+
const daemonLifecycleCapabilities = daemonLifecycle?.capabilities() ?? {
|
|
447
|
+
daemonStatus: false,
|
|
448
|
+
remoteControlStatus: false,
|
|
449
|
+
remoteControlLease: false,
|
|
450
|
+
remoteControlDrain: false,
|
|
451
|
+
};
|
|
355
452
|
const canUpdateThreadMetadata = Boolean(store.setSessionTitle &&
|
|
356
453
|
store.saveSessionSummary &&
|
|
357
454
|
store.saveSessionResumeSummary &&
|
|
@@ -359,26 +456,254 @@ export function createMaestroAppServerSessionApi(store) {
|
|
|
359
456
|
store.setSessionTags);
|
|
360
457
|
const canSetThreadName = Boolean(store.setSessionTitle);
|
|
361
458
|
const canUseThreadGoals = Boolean(store.setSessionAppServerGoal && store.loadEntries);
|
|
459
|
+
const canMutateSessionPersistence = store.canCreateSession?.() ?? true;
|
|
460
|
+
const externalAgentImport = options.externalAgentImport === false || !canMutateSessionPersistence
|
|
461
|
+
? undefined
|
|
462
|
+
: (options.externalAgentImport ??
|
|
463
|
+
createMaestroAppServerExternalAgentImport({ store }));
|
|
464
|
+
const canStartThreads = Boolean(store.createSession && canMutateSessionPersistence);
|
|
465
|
+
const canForkThreads = Boolean(canMutateSessionPersistence &&
|
|
466
|
+
store.createBranchedSession &&
|
|
467
|
+
store.setSessionFile);
|
|
468
|
+
const canArchiveThreads = Boolean(canMutateSessionPersistence && store.setSessionArchived);
|
|
469
|
+
const canDeleteThreads = Boolean(canMutateSessionPersistence && store.deleteSession);
|
|
470
|
+
const canUseHostControl = Boolean(hostControl);
|
|
471
|
+
const canUseFilesystemWatch = Boolean(hostControl?.supportsWatch());
|
|
472
|
+
const canUsePolicyControl = Boolean(policyControl);
|
|
473
|
+
const canUseNetworkGovernance = Boolean(networkGovernance);
|
|
474
|
+
const canUseSandboxProof = Boolean(sandboxProof);
|
|
475
|
+
const canUseExternalAgentImport = Boolean(externalAgentImport);
|
|
476
|
+
const canUsePluginBundles = Boolean(pluginBundles);
|
|
362
477
|
return {
|
|
363
478
|
initialize() {
|
|
364
479
|
return {
|
|
365
480
|
protocolVersion: maestroAppServerProtocolVersion,
|
|
481
|
+
supportedProtocolVersions: [
|
|
482
|
+
...maestroAppServerSupportedProtocolVersions,
|
|
483
|
+
],
|
|
366
484
|
serverInfo: {
|
|
367
485
|
name: "maestro",
|
|
368
486
|
},
|
|
369
487
|
capabilities: {
|
|
370
488
|
sessions: true,
|
|
489
|
+
protocolModes: Boolean(protocolModes),
|
|
371
490
|
modelList: true,
|
|
372
491
|
modelProviderCapabilities: true,
|
|
492
|
+
managedPolicy: canUsePolicyControl,
|
|
493
|
+
requirements: canUsePolicyControl,
|
|
494
|
+
networkProxy: canUseNetworkGovernance,
|
|
495
|
+
networkAudit: canUseNetworkGovernance,
|
|
496
|
+
sandboxProbe: canUseSandboxProof,
|
|
497
|
+
sandboxProof: canUseSandboxProof,
|
|
498
|
+
externalAgentImport: canUseExternalAgentImport,
|
|
499
|
+
pluginBundles: canUsePluginBundles,
|
|
500
|
+
daemonStatus: daemonLifecycleCapabilities.daemonStatus,
|
|
501
|
+
remoteControlStatus: daemonLifecycleCapabilities.remoteControlStatus,
|
|
502
|
+
remoteControlLease: daemonLifecycleCapabilities.remoteControlLease,
|
|
503
|
+
remoteControlDrain: daemonLifecycleCapabilities.remoteControlDrain,
|
|
504
|
+
commandExec: canUseHostControl,
|
|
505
|
+
commandProcessControl: canUseHostControl,
|
|
506
|
+
filesystem: canUseHostControl,
|
|
507
|
+
filesystemWatch: canUseFilesystemWatch,
|
|
373
508
|
threadList: true,
|
|
374
509
|
threadRead: true,
|
|
375
510
|
threadMetadataUpdate: canUpdateThreadMetadata,
|
|
376
511
|
threadNameSet: canSetThreadName,
|
|
377
512
|
threadGoals: canUseThreadGoals,
|
|
513
|
+
threadStart: canStartThreads,
|
|
514
|
+
threadFork: canForkThreads,
|
|
515
|
+
threadArchive: canArchiveThreads,
|
|
516
|
+
threadDelete: canDeleteThreads,
|
|
378
517
|
turnsList: true,
|
|
379
518
|
},
|
|
380
519
|
};
|
|
381
520
|
},
|
|
521
|
+
checkProtocolMode(method) {
|
|
522
|
+
return protocolModes?.checkMethod(method) ?? { allowed: true };
|
|
523
|
+
},
|
|
524
|
+
async listProtocolModes(params = {}) {
|
|
525
|
+
if (!protocolModes) {
|
|
526
|
+
throw new MaestroAppServerError(-32601, "Protocol modes are not available");
|
|
527
|
+
}
|
|
528
|
+
return protocolModes.listModes(params);
|
|
529
|
+
},
|
|
530
|
+
async setProtocolMode(params = {}) {
|
|
531
|
+
if (!protocolModes) {
|
|
532
|
+
throw new MaestroAppServerError(-32601, "Protocol modes are not available");
|
|
533
|
+
}
|
|
534
|
+
return protocolModes.setMode(params);
|
|
535
|
+
},
|
|
536
|
+
async readPolicy() {
|
|
537
|
+
if (!policyControl) {
|
|
538
|
+
throw new MaestroAppServerError(-32601, "Managed policy is not available");
|
|
539
|
+
}
|
|
540
|
+
return policyControl.readPolicy();
|
|
541
|
+
},
|
|
542
|
+
async checkPolicy(params = {}) {
|
|
543
|
+
if (!policyControl) {
|
|
544
|
+
throw new MaestroAppServerError(-32601, "Managed policy is not available");
|
|
545
|
+
}
|
|
546
|
+
return policyControl.checkPolicy(params);
|
|
547
|
+
},
|
|
548
|
+
async listRequirements() {
|
|
549
|
+
if (!policyControl) {
|
|
550
|
+
throw new MaestroAppServerError(-32601, "Requirements are not available");
|
|
551
|
+
}
|
|
552
|
+
return policyControl.listRequirements();
|
|
553
|
+
},
|
|
554
|
+
async fetchNetwork(params = {}) {
|
|
555
|
+
if (!networkGovernance) {
|
|
556
|
+
throw new MaestroAppServerError(-32601, "Network proxy is not available");
|
|
557
|
+
}
|
|
558
|
+
return networkGovernance.fetch(params);
|
|
559
|
+
},
|
|
560
|
+
async listNetworkAudit(params = {}) {
|
|
561
|
+
if (!networkGovernance) {
|
|
562
|
+
throw new MaestroAppServerError(-32601, "Network audit is not available");
|
|
563
|
+
}
|
|
564
|
+
return networkGovernance.listAudit(params);
|
|
565
|
+
},
|
|
566
|
+
async probeSandbox(params = {}) {
|
|
567
|
+
if (!sandboxProof) {
|
|
568
|
+
throw new MaestroAppServerError(-32601, "Sandbox probe is not available");
|
|
569
|
+
}
|
|
570
|
+
normalizeSandboxProofParams(params);
|
|
571
|
+
return sandboxProof.probe();
|
|
572
|
+
},
|
|
573
|
+
async runSandboxProof(params = {}) {
|
|
574
|
+
if (!sandboxProof) {
|
|
575
|
+
throw new MaestroAppServerError(-32601, "Sandbox proof is not available");
|
|
576
|
+
}
|
|
577
|
+
const normalizedParams = normalizeSandboxProofParams(params);
|
|
578
|
+
return sandboxProof.runProof(normalizedParams);
|
|
579
|
+
},
|
|
580
|
+
async importExternalAgent(params = {}) {
|
|
581
|
+
if (!externalAgentImport) {
|
|
582
|
+
throw new MaestroAppServerError(-32601, "External agent import is not available");
|
|
583
|
+
}
|
|
584
|
+
const normalizedParams = normalizeExternalAgentImportParams(params);
|
|
585
|
+
return externalAgentImport.importBundle(normalizedParams);
|
|
586
|
+
},
|
|
587
|
+
async listPluginBundles(params = {}) {
|
|
588
|
+
if (!pluginBundles) {
|
|
589
|
+
throw new MaestroAppServerError(-32601, "Plugin bundle lifecycle is not available");
|
|
590
|
+
}
|
|
591
|
+
return pluginBundles.listBundles(params);
|
|
592
|
+
},
|
|
593
|
+
async installPluginBundle(params = {}) {
|
|
594
|
+
if (!pluginBundles) {
|
|
595
|
+
throw new MaestroAppServerError(-32601, "Plugin bundle lifecycle is not available");
|
|
596
|
+
}
|
|
597
|
+
return pluginBundles.installBundle(params);
|
|
598
|
+
},
|
|
599
|
+
async removePluginBundle(params = {}) {
|
|
600
|
+
if (!pluginBundles) {
|
|
601
|
+
throw new MaestroAppServerError(-32601, "Plugin bundle lifecycle is not available");
|
|
602
|
+
}
|
|
603
|
+
return pluginBundles.removeBundle(params);
|
|
604
|
+
},
|
|
605
|
+
async readDaemonStatus(params = {}) {
|
|
606
|
+
if (!daemonLifecycle) {
|
|
607
|
+
throw new MaestroAppServerError(-32601, "Daemon lifecycle is not available");
|
|
608
|
+
}
|
|
609
|
+
return daemonLifecycle.status(params);
|
|
610
|
+
},
|
|
611
|
+
async readRemoteControlStatus(params = {}) {
|
|
612
|
+
if (!daemonLifecycle) {
|
|
613
|
+
throw new MaestroAppServerError(-32601, "Remote control lifecycle is not available");
|
|
614
|
+
}
|
|
615
|
+
return daemonLifecycle.remoteControlStatus(params);
|
|
616
|
+
},
|
|
617
|
+
async readRemoteControlLease(params = {}) {
|
|
618
|
+
if (!daemonLifecycle) {
|
|
619
|
+
throw new MaestroAppServerError(-32601, "Remote control lease is not available");
|
|
620
|
+
}
|
|
621
|
+
return daemonLifecycle.readLease(params);
|
|
622
|
+
},
|
|
623
|
+
async heartbeatRemoteControlLease(params = {}) {
|
|
624
|
+
if (!daemonLifecycle) {
|
|
625
|
+
throw new MaestroAppServerError(-32601, "Remote control lease is not available");
|
|
626
|
+
}
|
|
627
|
+
return daemonLifecycle.heartbeatLease(params);
|
|
628
|
+
},
|
|
629
|
+
async drainRemoteControl(params = {}) {
|
|
630
|
+
if (!daemonLifecycle) {
|
|
631
|
+
throw new MaestroAppServerError(-32601, "Remote control drain is not available");
|
|
632
|
+
}
|
|
633
|
+
return daemonLifecycle.drain(params);
|
|
634
|
+
},
|
|
635
|
+
async execCommand(params = {}) {
|
|
636
|
+
if (!hostControl) {
|
|
637
|
+
throw new MaestroAppServerError(-32601, "Command exec is not available");
|
|
638
|
+
}
|
|
639
|
+
return hostControl.execCommand(params);
|
|
640
|
+
},
|
|
641
|
+
async writeCommandStdin(params = {}) {
|
|
642
|
+
if (!hostControl) {
|
|
643
|
+
throw new MaestroAppServerError(-32601, "Command process control is not available");
|
|
644
|
+
}
|
|
645
|
+
return hostControl.writeCommandStdin(params);
|
|
646
|
+
},
|
|
647
|
+
async terminateCommand(params = {}) {
|
|
648
|
+
if (!hostControl) {
|
|
649
|
+
throw new MaestroAppServerError(-32601, "Command process control is not available");
|
|
650
|
+
}
|
|
651
|
+
return hostControl.terminateCommand(params);
|
|
652
|
+
},
|
|
653
|
+
async readFile(params = {}) {
|
|
654
|
+
if (!hostControl) {
|
|
655
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
656
|
+
}
|
|
657
|
+
return hostControl.readFile(params);
|
|
658
|
+
},
|
|
659
|
+
async writeFile(params = {}) {
|
|
660
|
+
if (!hostControl) {
|
|
661
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
662
|
+
}
|
|
663
|
+
return hostControl.writeFile(params);
|
|
664
|
+
},
|
|
665
|
+
async readDirectory(params = {}) {
|
|
666
|
+
if (!hostControl) {
|
|
667
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
668
|
+
}
|
|
669
|
+
return hostControl.readDirectory(params);
|
|
670
|
+
},
|
|
671
|
+
async getMetadata(params = {}) {
|
|
672
|
+
if (!hostControl) {
|
|
673
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
674
|
+
}
|
|
675
|
+
return hostControl.getMetadata(params);
|
|
676
|
+
},
|
|
677
|
+
async createDirectory(params = {}) {
|
|
678
|
+
if (!hostControl) {
|
|
679
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
680
|
+
}
|
|
681
|
+
return hostControl.createDirectory(params);
|
|
682
|
+
},
|
|
683
|
+
async remove(params = {}) {
|
|
684
|
+
if (!hostControl) {
|
|
685
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
686
|
+
}
|
|
687
|
+
return hostControl.remove(params);
|
|
688
|
+
},
|
|
689
|
+
async copy(params = {}) {
|
|
690
|
+
if (!hostControl) {
|
|
691
|
+
throw new MaestroAppServerError(-32601, "Filesystem is not available");
|
|
692
|
+
}
|
|
693
|
+
return hostControl.copy(params);
|
|
694
|
+
},
|
|
695
|
+
async watch(params = {}) {
|
|
696
|
+
if (!hostControl) {
|
|
697
|
+
throw new MaestroAppServerError(-32601, "Filesystem watch is not available");
|
|
698
|
+
}
|
|
699
|
+
return hostControl.watch(params);
|
|
700
|
+
},
|
|
701
|
+
async unwatch(params = {}) {
|
|
702
|
+
if (!hostControl) {
|
|
703
|
+
throw new MaestroAppServerError(-32601, "Filesystem watch is not available");
|
|
704
|
+
}
|
|
705
|
+
return hostControl.unwatch(params);
|
|
706
|
+
},
|
|
382
707
|
async listModels(params = {}) {
|
|
383
708
|
const provider = optionalTrimmedString(params.provider, "provider");
|
|
384
709
|
const api = optionalTrimmedString(params.api, "api");
|
|
@@ -406,23 +731,50 @@ export function createMaestroAppServerSessionApi(store) {
|
|
|
406
731
|
async listThreads(params = {}) {
|
|
407
732
|
const limit = normalizeLimit(params.limit);
|
|
408
733
|
const offset = decodeCursor(params.cursor);
|
|
734
|
+
const includeArchived = optionalBoolean(params.includeArchived, "includeArchived") ?? false;
|
|
409
735
|
const metadata = store.loadAllSessions();
|
|
410
736
|
if (metadata.length === 0) {
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
737
|
+
const page = [];
|
|
738
|
+
let rawOffset = offset;
|
|
739
|
+
let cursorAfterPage = offset;
|
|
740
|
+
let hasMoreVisible = false;
|
|
741
|
+
let exhausted = false;
|
|
742
|
+
while (!hasMoreVisible && !exhausted) {
|
|
743
|
+
const summaries = await store.listSessions({
|
|
744
|
+
limit: limit + 1,
|
|
745
|
+
offset: rawOffset,
|
|
746
|
+
});
|
|
747
|
+
exhausted = summaries.length <= limit;
|
|
748
|
+
for (const summary of summaries) {
|
|
749
|
+
rawOffset += 1;
|
|
750
|
+
if (includeArchived || !summary.archived) {
|
|
751
|
+
if (page.length < limit) {
|
|
752
|
+
page.push(summary);
|
|
753
|
+
cursorAfterPage = rawOffset;
|
|
754
|
+
}
|
|
755
|
+
else {
|
|
756
|
+
hasMoreVisible = true;
|
|
757
|
+
break;
|
|
758
|
+
}
|
|
759
|
+
}
|
|
760
|
+
}
|
|
761
|
+
if (summaries.length === 0) {
|
|
762
|
+
exhausted = true;
|
|
763
|
+
}
|
|
764
|
+
}
|
|
416
765
|
return {
|
|
417
766
|
threads: page.map(toThreadSummaryFromSessionSummary),
|
|
418
|
-
nextCursor:
|
|
767
|
+
nextCursor: hasMoreVisible ? encodeCursor(cursorAfterPage) : null,
|
|
419
768
|
};
|
|
420
769
|
}
|
|
421
|
-
const
|
|
770
|
+
const visible = includeArchived
|
|
771
|
+
? metadata
|
|
772
|
+
: metadata.filter((session) => !session.archived);
|
|
773
|
+
const page = visible.slice(offset, offset + limit);
|
|
422
774
|
const nextOffset = offset + page.length;
|
|
423
775
|
return {
|
|
424
776
|
threads: page.map((session) => toThreadSummary(session)),
|
|
425
|
-
nextCursor: nextOffset <
|
|
777
|
+
nextCursor: nextOffset < visible.length ? encodeCursor(nextOffset) : null,
|
|
426
778
|
};
|
|
427
779
|
},
|
|
428
780
|
async readThread(params = {}) {
|
|
@@ -555,6 +907,117 @@ export function createMaestroAppServerSessionApi(store) {
|
|
|
555
907
|
await verifyThreadGoalPersisted(store, threadId, null);
|
|
556
908
|
return { threadId, goal: null };
|
|
557
909
|
},
|
|
910
|
+
async startThread(params = {}) {
|
|
911
|
+
const createThreadSession = store.createSession;
|
|
912
|
+
if (!canStartThreads || !createThreadSession) {
|
|
913
|
+
throw new MaestroAppServerError(-32601, "Thread start is not available");
|
|
914
|
+
}
|
|
915
|
+
const title = optionalTrimmedString(params.title, "title");
|
|
916
|
+
const previousSessionFile = store.getSessionFile?.();
|
|
917
|
+
const previousLeafId = getCurrentLeafId(store);
|
|
918
|
+
let created;
|
|
919
|
+
try {
|
|
920
|
+
created = await createThreadSession.call(store, title ? { title } : undefined);
|
|
921
|
+
}
|
|
922
|
+
finally {
|
|
923
|
+
await restoreSessionBinding(store, previousSessionFile, previousLeafId);
|
|
924
|
+
}
|
|
925
|
+
await flushSessionWrites(store);
|
|
926
|
+
return {
|
|
927
|
+
thread: await summarizeThreadAfterMutation(store, created.id),
|
|
928
|
+
};
|
|
929
|
+
},
|
|
930
|
+
async forkThread(params = {}) {
|
|
931
|
+
const createBranchedSession = store.createBranchedSession;
|
|
932
|
+
if (!canForkThreads || !createBranchedSession) {
|
|
933
|
+
throw new MaestroAppServerError(-32601, "Thread fork is not available");
|
|
934
|
+
}
|
|
935
|
+
const threadId = requireThreadId(params);
|
|
936
|
+
const leafEntryId = optionalTrimmedString(params.leafEntryId, "leafEntryId");
|
|
937
|
+
if (!leafEntryId) {
|
|
938
|
+
throw new MaestroAppServerError(-32602, "Missing leafEntryId");
|
|
939
|
+
}
|
|
940
|
+
const title = optionalTrimmedString(params.title, "title");
|
|
941
|
+
const sessionFile = await requireExistingThreadReference(store, threadId);
|
|
942
|
+
const previousSessionFile = store.getSessionFile?.();
|
|
943
|
+
const previousLeafId = getCurrentLeafId(store);
|
|
944
|
+
let forkedThreadId;
|
|
945
|
+
try {
|
|
946
|
+
await store.setSessionFile?.(sessionFile);
|
|
947
|
+
let forkedSessionFile;
|
|
948
|
+
try {
|
|
949
|
+
forkedSessionFile = createBranchedSession.call(store, leafEntryId);
|
|
950
|
+
}
|
|
951
|
+
catch (error) {
|
|
952
|
+
if (error instanceof Error &&
|
|
953
|
+
error.message === `Entry ${leafEntryId} not found`) {
|
|
954
|
+
throw new MaestroAppServerError(-32602, "Unknown leafEntryId");
|
|
955
|
+
}
|
|
956
|
+
throw error;
|
|
957
|
+
}
|
|
958
|
+
const forkedEntries = safeReadSessionEntries(forkedSessionFile);
|
|
959
|
+
const forkedHeader = forkedEntries.find((entry) => entry.type === "session");
|
|
960
|
+
forkedThreadId =
|
|
961
|
+
forkedHeader && "id" in forkedHeader ? forkedHeader.id : undefined;
|
|
962
|
+
if (!forkedThreadId) {
|
|
963
|
+
throw new MaestroAppServerError(-32000, "Thread fork did not produce a readable session");
|
|
964
|
+
}
|
|
965
|
+
if (title && store.setSessionTitle) {
|
|
966
|
+
await store.setSessionTitle(forkedSessionFile, title);
|
|
967
|
+
}
|
|
968
|
+
}
|
|
969
|
+
finally {
|
|
970
|
+
await restoreSessionBinding(store, previousSessionFile, previousLeafId);
|
|
971
|
+
}
|
|
972
|
+
await flushSessionWrites(store);
|
|
973
|
+
return {
|
|
974
|
+
thread: await summarizeThreadAfterMutation(store, forkedThreadId),
|
|
975
|
+
parentThreadId: threadId,
|
|
976
|
+
forkedFromEntryId: leafEntryId,
|
|
977
|
+
};
|
|
978
|
+
},
|
|
979
|
+
async archiveThread(params = {}) {
|
|
980
|
+
const setSessionArchived = store.setSessionArchived;
|
|
981
|
+
if (!canArchiveThreads || !setSessionArchived) {
|
|
982
|
+
throw new MaestroAppServerError(-32601, "Thread archive is not available");
|
|
983
|
+
}
|
|
984
|
+
const threadId = requireThreadId(params);
|
|
985
|
+
const sessionFile = await requireExistingThreadReference(store, threadId);
|
|
986
|
+
await setSessionArchived.call(store, sessionFile, true);
|
|
987
|
+
const thread = await summarizeThreadAfterMutation(store, threadId);
|
|
988
|
+
if (!thread.archived) {
|
|
989
|
+
throw new MaestroAppServerError(-32000, "Thread archive update was not persisted");
|
|
990
|
+
}
|
|
991
|
+
return { thread, archived: true };
|
|
992
|
+
},
|
|
993
|
+
async unarchiveThread(params = {}) {
|
|
994
|
+
const setSessionArchived = store.setSessionArchived;
|
|
995
|
+
if (!canArchiveThreads || !setSessionArchived) {
|
|
996
|
+
throw new MaestroAppServerError(-32601, "Thread archive is not available");
|
|
997
|
+
}
|
|
998
|
+
const threadId = requireThreadId(params);
|
|
999
|
+
const sessionFile = await requireExistingThreadReference(store, threadId);
|
|
1000
|
+
await setSessionArchived.call(store, sessionFile, false);
|
|
1001
|
+
const thread = await summarizeThreadAfterMutation(store, threadId);
|
|
1002
|
+
if (thread.archived) {
|
|
1003
|
+
throw new MaestroAppServerError(-32000, "Thread archive update was not persisted");
|
|
1004
|
+
}
|
|
1005
|
+
return { thread, archived: false };
|
|
1006
|
+
},
|
|
1007
|
+
async deleteThread(params = {}) {
|
|
1008
|
+
const deleteSession = store.deleteSession;
|
|
1009
|
+
if (!canDeleteThreads || !deleteSession) {
|
|
1010
|
+
throw new MaestroAppServerError(-32601, "Thread delete is not available");
|
|
1011
|
+
}
|
|
1012
|
+
const threadId = requireThreadId(params);
|
|
1013
|
+
const sessionFile = await requireExistingThreadReference(store, threadId);
|
|
1014
|
+
if (isActiveThreadSessionFile(store, sessionFile)) {
|
|
1015
|
+
throw new MaestroAppServerError(-32000, "Cannot delete the currently active thread");
|
|
1016
|
+
}
|
|
1017
|
+
await deleteSession.call(store, threadId);
|
|
1018
|
+
await flushSessionWrites(store);
|
|
1019
|
+
return { threadId, deleted: true };
|
|
1020
|
+
},
|
|
558
1021
|
async listTurns(params = {}) {
|
|
559
1022
|
const threadId = requireThreadId(params);
|
|
560
1023
|
const limit = normalizeLimit(params.limit);
|
|
@@ -616,13 +1079,32 @@ export async function handleMaestroAppServerRequest(api, request) {
|
|
|
616
1079
|
if (!isSupportedMethod(request.method)) {
|
|
617
1080
|
throw new MaestroAppServerError(-32601, "Method not found");
|
|
618
1081
|
}
|
|
619
|
-
|
|
1082
|
+
const method = request.method;
|
|
1083
|
+
const protocolModeDecision = api.checkProtocolMode?.(method) ?? {
|
|
1084
|
+
allowed: true,
|
|
1085
|
+
};
|
|
1086
|
+
if (!protocolModeDecision.allowed) {
|
|
1087
|
+
throw new MaestroAppServerError(-32003, protocolModeDecision.reason ?? "Method blocked by protocol mode");
|
|
1088
|
+
}
|
|
1089
|
+
switch (method) {
|
|
620
1090
|
case "initialize":
|
|
621
1091
|
return {
|
|
622
1092
|
jsonrpc: "2.0",
|
|
623
1093
|
id,
|
|
624
1094
|
result: api.initialize(),
|
|
625
1095
|
};
|
|
1096
|
+
case "protocol/mode/list":
|
|
1097
|
+
return {
|
|
1098
|
+
jsonrpc: "2.0",
|
|
1099
|
+
id,
|
|
1100
|
+
result: await api.listProtocolModes(request.params),
|
|
1101
|
+
};
|
|
1102
|
+
case "protocol/mode/set":
|
|
1103
|
+
return {
|
|
1104
|
+
jsonrpc: "2.0",
|
|
1105
|
+
id,
|
|
1106
|
+
result: await api.setProtocolMode(request.params),
|
|
1107
|
+
};
|
|
626
1108
|
case "model/list":
|
|
627
1109
|
return {
|
|
628
1110
|
jsonrpc: "2.0",
|
|
@@ -635,6 +1117,174 @@ export async function handleMaestroAppServerRequest(api, request) {
|
|
|
635
1117
|
id,
|
|
636
1118
|
result: await api.readModelProviderCapabilities(request.params),
|
|
637
1119
|
};
|
|
1120
|
+
case "policy/read":
|
|
1121
|
+
return {
|
|
1122
|
+
jsonrpc: "2.0",
|
|
1123
|
+
id,
|
|
1124
|
+
result: await api.readPolicy(request.params),
|
|
1125
|
+
};
|
|
1126
|
+
case "policy/check":
|
|
1127
|
+
return {
|
|
1128
|
+
jsonrpc: "2.0",
|
|
1129
|
+
id,
|
|
1130
|
+
result: await api.checkPolicy(request.params),
|
|
1131
|
+
};
|
|
1132
|
+
case "requirements/list":
|
|
1133
|
+
return {
|
|
1134
|
+
jsonrpc: "2.0",
|
|
1135
|
+
id,
|
|
1136
|
+
result: await api.listRequirements(request.params),
|
|
1137
|
+
};
|
|
1138
|
+
case "network/fetch":
|
|
1139
|
+
return {
|
|
1140
|
+
jsonrpc: "2.0",
|
|
1141
|
+
id,
|
|
1142
|
+
result: await api.fetchNetwork(request.params),
|
|
1143
|
+
};
|
|
1144
|
+
case "network/audit/list":
|
|
1145
|
+
return {
|
|
1146
|
+
jsonrpc: "2.0",
|
|
1147
|
+
id,
|
|
1148
|
+
result: await api.listNetworkAudit(request.params),
|
|
1149
|
+
};
|
|
1150
|
+
case "sandbox/probe":
|
|
1151
|
+
return {
|
|
1152
|
+
jsonrpc: "2.0",
|
|
1153
|
+
id,
|
|
1154
|
+
result: await api.probeSandbox(request.params),
|
|
1155
|
+
};
|
|
1156
|
+
case "sandbox/proof/run":
|
|
1157
|
+
return {
|
|
1158
|
+
jsonrpc: "2.0",
|
|
1159
|
+
id,
|
|
1160
|
+
result: await api.runSandboxProof(request.params),
|
|
1161
|
+
};
|
|
1162
|
+
case "externalAgent/import":
|
|
1163
|
+
return {
|
|
1164
|
+
jsonrpc: "2.0",
|
|
1165
|
+
id,
|
|
1166
|
+
result: await api.importExternalAgent(request.params),
|
|
1167
|
+
};
|
|
1168
|
+
case "pluginBundle/list":
|
|
1169
|
+
return {
|
|
1170
|
+
jsonrpc: "2.0",
|
|
1171
|
+
id,
|
|
1172
|
+
result: await api.listPluginBundles(request.params),
|
|
1173
|
+
};
|
|
1174
|
+
case "pluginBundle/install":
|
|
1175
|
+
return {
|
|
1176
|
+
jsonrpc: "2.0",
|
|
1177
|
+
id,
|
|
1178
|
+
result: await api.installPluginBundle(request.params),
|
|
1179
|
+
};
|
|
1180
|
+
case "pluginBundle/remove":
|
|
1181
|
+
return {
|
|
1182
|
+
jsonrpc: "2.0",
|
|
1183
|
+
id,
|
|
1184
|
+
result: await api.removePluginBundle(request.params),
|
|
1185
|
+
};
|
|
1186
|
+
case "daemon/status":
|
|
1187
|
+
return {
|
|
1188
|
+
jsonrpc: "2.0",
|
|
1189
|
+
id,
|
|
1190
|
+
result: await api.readDaemonStatus(request.params),
|
|
1191
|
+
};
|
|
1192
|
+
case "remoteControl/status":
|
|
1193
|
+
return {
|
|
1194
|
+
jsonrpc: "2.0",
|
|
1195
|
+
id,
|
|
1196
|
+
result: await api.readRemoteControlStatus(request.params),
|
|
1197
|
+
};
|
|
1198
|
+
case "remoteControl/lease/read":
|
|
1199
|
+
return {
|
|
1200
|
+
jsonrpc: "2.0",
|
|
1201
|
+
id,
|
|
1202
|
+
result: await api.readRemoteControlLease(request.params),
|
|
1203
|
+
};
|
|
1204
|
+
case "remoteControl/lease/heartbeat":
|
|
1205
|
+
return {
|
|
1206
|
+
jsonrpc: "2.0",
|
|
1207
|
+
id,
|
|
1208
|
+
result: await api.heartbeatRemoteControlLease(request.params),
|
|
1209
|
+
};
|
|
1210
|
+
case "remoteControl/drain":
|
|
1211
|
+
return {
|
|
1212
|
+
jsonrpc: "2.0",
|
|
1213
|
+
id,
|
|
1214
|
+
result: await api.drainRemoteControl(request.params),
|
|
1215
|
+
};
|
|
1216
|
+
case "command/exec":
|
|
1217
|
+
return {
|
|
1218
|
+
jsonrpc: "2.0",
|
|
1219
|
+
id,
|
|
1220
|
+
result: await api.execCommand(request.params),
|
|
1221
|
+
};
|
|
1222
|
+
case "command/exec/write":
|
|
1223
|
+
return {
|
|
1224
|
+
jsonrpc: "2.0",
|
|
1225
|
+
id,
|
|
1226
|
+
result: await api.writeCommandStdin(request.params),
|
|
1227
|
+
};
|
|
1228
|
+
case "command/exec/terminate":
|
|
1229
|
+
return {
|
|
1230
|
+
jsonrpc: "2.0",
|
|
1231
|
+
id,
|
|
1232
|
+
result: await api.terminateCommand(request.params),
|
|
1233
|
+
};
|
|
1234
|
+
case "fs/readFile":
|
|
1235
|
+
return {
|
|
1236
|
+
jsonrpc: "2.0",
|
|
1237
|
+
id,
|
|
1238
|
+
result: await api.readFile(request.params),
|
|
1239
|
+
};
|
|
1240
|
+
case "fs/writeFile":
|
|
1241
|
+
return {
|
|
1242
|
+
jsonrpc: "2.0",
|
|
1243
|
+
id,
|
|
1244
|
+
result: await api.writeFile(request.params),
|
|
1245
|
+
};
|
|
1246
|
+
case "fs/readDirectory":
|
|
1247
|
+
return {
|
|
1248
|
+
jsonrpc: "2.0",
|
|
1249
|
+
id,
|
|
1250
|
+
result: await api.readDirectory(request.params),
|
|
1251
|
+
};
|
|
1252
|
+
case "fs/getMetadata":
|
|
1253
|
+
return {
|
|
1254
|
+
jsonrpc: "2.0",
|
|
1255
|
+
id,
|
|
1256
|
+
result: await api.getMetadata(request.params),
|
|
1257
|
+
};
|
|
1258
|
+
case "fs/createDirectory":
|
|
1259
|
+
return {
|
|
1260
|
+
jsonrpc: "2.0",
|
|
1261
|
+
id,
|
|
1262
|
+
result: await api.createDirectory(request.params),
|
|
1263
|
+
};
|
|
1264
|
+
case "fs/remove":
|
|
1265
|
+
return {
|
|
1266
|
+
jsonrpc: "2.0",
|
|
1267
|
+
id,
|
|
1268
|
+
result: await api.remove(request.params),
|
|
1269
|
+
};
|
|
1270
|
+
case "fs/copy":
|
|
1271
|
+
return {
|
|
1272
|
+
jsonrpc: "2.0",
|
|
1273
|
+
id,
|
|
1274
|
+
result: await api.copy(request.params),
|
|
1275
|
+
};
|
|
1276
|
+
case "fs/watch":
|
|
1277
|
+
return {
|
|
1278
|
+
jsonrpc: "2.0",
|
|
1279
|
+
id,
|
|
1280
|
+
result: await api.watch(request.params),
|
|
1281
|
+
};
|
|
1282
|
+
case "fs/unwatch":
|
|
1283
|
+
return {
|
|
1284
|
+
jsonrpc: "2.0",
|
|
1285
|
+
id,
|
|
1286
|
+
result: await api.unwatch(request.params),
|
|
1287
|
+
};
|
|
638
1288
|
case "thread/list":
|
|
639
1289
|
return {
|
|
640
1290
|
jsonrpc: "2.0",
|
|
@@ -679,6 +1329,36 @@ export async function handleMaestroAppServerRequest(api, request) {
|
|
|
679
1329
|
id,
|
|
680
1330
|
result: await api.clearThreadGoal(request.params),
|
|
681
1331
|
};
|
|
1332
|
+
case "thread/start":
|
|
1333
|
+
return {
|
|
1334
|
+
jsonrpc: "2.0",
|
|
1335
|
+
id,
|
|
1336
|
+
result: await api.startThread(request.params),
|
|
1337
|
+
};
|
|
1338
|
+
case "thread/fork":
|
|
1339
|
+
return {
|
|
1340
|
+
jsonrpc: "2.0",
|
|
1341
|
+
id,
|
|
1342
|
+
result: await api.forkThread(request.params),
|
|
1343
|
+
};
|
|
1344
|
+
case "thread/archive":
|
|
1345
|
+
return {
|
|
1346
|
+
jsonrpc: "2.0",
|
|
1347
|
+
id,
|
|
1348
|
+
result: await api.archiveThread(request.params),
|
|
1349
|
+
};
|
|
1350
|
+
case "thread/unarchive":
|
|
1351
|
+
return {
|
|
1352
|
+
jsonrpc: "2.0",
|
|
1353
|
+
id,
|
|
1354
|
+
result: await api.unarchiveThread(request.params),
|
|
1355
|
+
};
|
|
1356
|
+
case "thread/delete":
|
|
1357
|
+
return {
|
|
1358
|
+
jsonrpc: "2.0",
|
|
1359
|
+
id,
|
|
1360
|
+
result: await api.deleteThread(request.params),
|
|
1361
|
+
};
|
|
682
1362
|
case "thread/turns/list":
|
|
683
1363
|
return {
|
|
684
1364
|
jsonrpc: "2.0",
|
|
@@ -690,7 +1370,15 @@ export async function handleMaestroAppServerRequest(api, request) {
|
|
|
690
1370
|
}
|
|
691
1371
|
}
|
|
692
1372
|
catch (error) {
|
|
693
|
-
if (error instanceof MaestroAppServerError
|
|
1373
|
+
if (error instanceof MaestroAppServerError ||
|
|
1374
|
+
error instanceof MaestroAppServerHostControlError ||
|
|
1375
|
+
error instanceof MaestroAppServerNetworkGovernanceError ||
|
|
1376
|
+
error instanceof MaestroAppServerPolicyControlError ||
|
|
1377
|
+
error instanceof MaestroAppServerSandboxProofError ||
|
|
1378
|
+
error instanceof MaestroAppServerExternalAgentImportError ||
|
|
1379
|
+
error instanceof MaestroAppServerPluginBundleError ||
|
|
1380
|
+
error instanceof MaestroAppServerDaemonLifecycleError ||
|
|
1381
|
+
error instanceof MaestroAppServerProtocolModesError) {
|
|
694
1382
|
return {
|
|
695
1383
|
jsonrpc: "2.0",
|
|
696
1384
|
id,
|