@evalops/maestro 0.10.8 → 0.10.11
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 +3 -1
- package/dist/agent/action-approval.d.ts +6 -0
- package/dist/agent/action-approval.d.ts.map +1 -1
- package/dist/agent/action-approval.js.map +1 -1
- package/dist/agent/agent.d.ts +13 -1
- package/dist/agent/agent.d.ts.map +1 -1
- package/dist/agent/agent.js +368 -1
- package/dist/agent/agent.js.map +1 -1
- package/dist/agent/auto-compaction.d.ts +4 -4
- package/dist/agent/auto-compaction.d.ts.map +1 -1
- package/dist/agent/auto-compaction.js.map +1 -1
- package/dist/agent/compaction-cleanup.d.ts +2 -0
- package/dist/agent/compaction-cleanup.d.ts.map +1 -1
- package/dist/agent/compaction-cleanup.js +17 -2
- package/dist/agent/compaction-cleanup.js.map +1 -1
- package/dist/agent/compaction.d.ts +3 -1
- package/dist/agent/compaction.d.ts.map +1 -1
- package/dist/agent/compaction.js +10 -2
- package/dist/agent/compaction.js.map +1 -1
- package/dist/agent/context-manager.d.ts +4 -0
- package/dist/agent/context-manager.d.ts.map +1 -1
- package/dist/agent/context-manager.js +8 -0
- package/dist/agent/context-manager.js.map +1 -1
- package/dist/agent/context-providers.d.ts +2 -0
- package/dist/agent/context-providers.d.ts.map +1 -1
- package/dist/agent/context-providers.js +3 -2
- package/dist/agent/context-providers.js.map +1 -1
- package/dist/agent/providers/google-gemini-cli.js +17 -5
- package/dist/agent/providers/google.js +174 -144
- package/dist/agent/providers/openai-codex-responses.d.ts +4 -0
- package/dist/agent/providers/openai-codex-responses.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-responses.js +637 -0
- package/dist/agent/providers/openai-codex-responses.js.map +1 -0
- package/dist/agent/providers/openai-codex-session.d.ts +18 -0
- package/dist/agent/providers/openai-codex-session.d.ts.map +1 -0
- package/dist/agent/providers/openai-codex-session.js +53 -0
- package/dist/agent/providers/openai-codex-session.js.map +1 -0
- package/dist/agent/providers/openai-responses-sdk.d.ts.map +1 -1
- package/dist/agent/providers/openai-responses-sdk.js +16 -6
- package/dist/agent/providers/openai-responses-sdk.js.map +1 -1
- package/dist/agent/providers/openai-shared.d.ts +12 -5
- package/dist/agent/providers/openai-shared.d.ts.map +1 -1
- package/dist/agent/providers/openai-shared.js +291 -2
- package/dist/agent/providers/openai-shared.js.map +1 -1
- package/dist/agent/providers/openai.d.ts +1 -1
- package/dist/agent/providers/openai.d.ts.map +1 -1
- package/dist/agent/providers/openai.js +48 -20
- package/dist/agent/providers/openai.js.map +1 -1
- package/dist/agent/providers/vertex.js +7 -0
- package/dist/agent/tracing.d.ts +16 -5
- package/dist/agent/tracing.d.ts.map +1 -1
- package/dist/agent/tracing.js +44 -2
- package/dist/agent/tracing.js.map +1 -1
- package/dist/agent/transport/create-provider-stream.d.ts.map +1 -1
- package/dist/agent/transport/create-provider-stream.js +9 -0
- package/dist/agent/transport/create-provider-stream.js.map +1 -1
- package/dist/agent/transport/tool-execution-bridge.d.ts +86 -0
- package/dist/agent/transport/tool-execution-bridge.d.ts.map +1 -0
- package/dist/agent/transport/tool-execution-bridge.js +665 -0
- package/dist/agent/transport/tool-execution-bridge.js.map +1 -0
- package/dist/agent/transport/tool-execution.d.ts +3 -0
- package/dist/agent/transport/tool-execution.d.ts.map +1 -1
- package/dist/agent/transport/tool-execution.js +16 -1
- package/dist/agent/transport/tool-execution.js.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts +7 -1
- package/dist/agent/transport/tool-safety-pipeline.d.ts.map +1 -1
- package/dist/agent/transport/tool-safety-pipeline.js +207 -40
- package/dist/agent/transport/tool-safety-pipeline.js.map +1 -1
- package/dist/agent/transport/tool-update-queue.d.ts +2 -0
- package/dist/agent/transport/tool-update-queue.d.ts.map +1 -1
- package/dist/agent/transport/tool-update-queue.js.map +1 -1
- package/dist/agent/transport.d.ts +3 -0
- package/dist/agent/transport.d.ts.map +1 -1
- package/dist/agent/transport.js +96 -16
- package/dist/agent/transport.js.map +1 -1
- package/dist/agent/types.d.ts +50 -2
- package/dist/agent/types.d.ts.map +1 -1
- package/dist/agent/types.js.map +1 -1
- package/dist/approvals/platform-action-approval.d.ts +32 -0
- package/dist/approvals/platform-action-approval.d.ts.map +1 -0
- package/dist/approvals/platform-action-approval.js +210 -0
- package/dist/approvals/platform-action-approval.js.map +1 -0
- package/dist/approvals/service-client.d.ts +56 -0
- package/dist/approvals/service-client.d.ts.map +1 -0
- package/dist/approvals/service-client.js +316 -0
- package/dist/approvals/service-client.js.map +1 -0
- package/dist/audit/logger.d.ts +4 -4
- package/dist/bootstrap/auth-setup.d.ts +2 -2
- package/dist/bootstrap/auth-setup.d.ts.map +1 -1
- package/dist/bootstrap/auth-setup.js +4 -7
- package/dist/bootstrap/auth-setup.js.map +1 -1
- package/dist/cli/args.d.ts +2 -0
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +29 -0
- package/dist/cli/args.js.map +1 -1
- package/dist/cli/commands/codex.d.ts +2 -0
- package/dist/cli/commands/codex.d.ts.map +1 -0
- package/dist/cli/commands/codex.js +65 -0
- package/dist/cli/commands/codex.js.map +1 -0
- package/dist/cli/commands/config.js +1 -1
- package/dist/cli/commands/config.js.map +1 -1
- package/dist/cli/commands/evalops.d.ts +2 -0
- package/dist/cli/commands/evalops.d.ts.map +1 -0
- package/dist/cli/commands/evalops.js +74 -0
- package/dist/cli/commands/evalops.js.map +1 -0
- package/dist/cli/commands/hosted-runner.d.ts +23 -0
- package/dist/cli/commands/hosted-runner.d.ts.map +1 -0
- package/dist/cli/commands/hosted-runner.js +241 -0
- package/dist/cli/commands/hosted-runner.js.map +1 -0
- package/dist/cli/commands/init.d.ts +4 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +140 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/memory.d.ts.map +1 -1
- package/dist/cli/commands/memory.js +23 -30
- package/dist/cli/commands/memory.js.map +1 -1
- package/dist/cli/commands/remote.d.ts +3 -0
- package/dist/cli/commands/remote.d.ts.map +1 -0
- package/dist/cli/commands/remote.js +631 -0
- package/dist/cli/commands/remote.js.map +1 -0
- package/dist/cli/commands/stats.d.ts +7 -0
- package/dist/cli/commands/stats.d.ts.map +1 -0
- package/dist/cli/commands/stats.js +167 -0
- package/dist/cli/commands/stats.js.map +1 -0
- package/dist/cli/headless-protocol.d.ts +16 -1
- package/dist/cli/headless-protocol.d.ts.map +1 -1
- package/dist/cli/headless-protocol.js +60 -4
- package/dist/cli/headless-protocol.js.map +1 -1
- package/dist/cli/headless.d.ts.map +1 -1
- package/dist/cli/headless.js +1 -0
- package/dist/cli/headless.js.map +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +44 -1
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/jsonl-writer.d.ts.map +1 -1
- package/dist/cli/jsonl-writer.js +19 -6
- package/dist/cli/jsonl-writer.js.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.d.ts.map +1 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js +17 -1
- package/dist/cli-tui/client-tools/client-tool-controller.js.map +1 -1
- package/dist/cli-tui/commands/access-command.js +1 -1
- package/dist/cli-tui/commands/access-command.js.map +1 -1
- package/dist/cli-tui/commands/audit-command.js +1 -1
- package/dist/cli-tui/commands/audit-command.js.map +1 -1
- package/dist/cli-tui/commands/command-catalog.d.ts +29 -0
- package/dist/cli-tui/commands/command-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-catalog.js +645 -0
- package/dist/cli-tui/commands/command-catalog.js.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts +12 -0
- package/dist/cli-tui/commands/command-registry-adapter.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-registry-adapter.js +120 -0
- package/dist/cli-tui/commands/command-registry-adapter.js.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts +14 -0
- package/dist/cli-tui/commands/command-suite-catalog.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-catalog.js +147 -0
- package/dist/cli-tui/commands/command-suite-catalog.js.map +1 -0
- package/dist/cli-tui/commands/{grouped-command-handlers.d.ts → command-suite-handlers.d.ts} +27 -26
- package/dist/cli-tui/commands/command-suite-handlers.d.ts.map +1 -0
- package/dist/cli-tui/commands/command-suite-handlers.js +110 -0
- package/dist/cli-tui/commands/command-suite-handlers.js.map +1 -0
- package/dist/cli-tui/commands/hotkeys-command.d.ts +1 -1
- package/dist/cli-tui/commands/hotkeys-command.d.ts.map +1 -1
- package/dist/cli-tui/commands/hotkeys-command.js +2 -2
- package/dist/cli-tui/commands/hotkeys-command.js.map +1 -1
- package/dist/cli-tui/commands/limits-command.js +1 -1
- package/dist/cli-tui/commands/limits-command.js.map +1 -1
- package/dist/cli-tui/commands/pii-command.js +1 -1
- package/dist/cli-tui/commands/pii-command.js.map +1 -1
- package/dist/cli-tui/commands/registry.d.ts +1 -1
- package/dist/cli-tui/commands/registry.d.ts.map +1 -1
- package/dist/cli-tui/commands/registry.js +29 -921
- package/dist/cli-tui/commands/registry.js.map +1 -1
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.d.ts +2 -1
- package/dist/cli-tui/commands/subcommands/auth-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/auth-commands.js +22 -6
- package/dist/cli-tui/commands/subcommands/auth-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/config-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/config-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/config-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/diag-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/diag-commands.js +5 -7
- package/dist/cli-tui/commands/subcommands/diag-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.d.ts +0 -2
- package/dist/cli-tui/commands/subcommands/git-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/git-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/git-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.d.ts +2 -2
- package/dist/cli-tui/commands/subcommands/index.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/index.js +2 -2
- package/dist/cli-tui/commands/subcommands/index.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/safety-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/safety-commands.js +12 -12
- package/dist/cli-tui/commands/subcommands/safety-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/session-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/session-commands.js +3 -3
- package/dist/cli-tui/commands/subcommands/session-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/tools-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/tools-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/tools-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.d.ts +0 -1
- package/dist/cli-tui/commands/subcommands/ui-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/ui-commands.js +5 -5
- package/dist/cli-tui/commands/subcommands/ui-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.d.ts +1 -2
- package/dist/cli-tui/commands/subcommands/undo-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/undo-commands.js +6 -6
- package/dist/cli-tui/commands/subcommands/undo-commands.js.map +1 -0
- package/dist/cli-tui/commands/subcommands/usage-commands.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.js +2 -2
- package/dist/cli-tui/commands/subcommands/usage-commands.js.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.d.ts +15 -15
- package/dist/cli-tui/commands/subcommands/utils.d.ts.map +1 -0
- package/dist/cli-tui/commands/{grouped → subcommands}/utils.js +13 -8
- package/dist/cli-tui/commands/subcommands/utils.js.map +1 -0
- package/dist/cli-tui/commands/types.d.ts +3 -3
- package/dist/cli-tui/commands/types.d.ts.map +1 -1
- package/dist/cli-tui/commands/types.js.map +1 -1
- package/dist/cli-tui/editor-view.d.ts +1 -1
- package/dist/cli-tui/editor-view.d.ts.map +1 -1
- package/dist/cli-tui/editor-view.js +1 -1
- package/dist/cli-tui/editor-view.js.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts +4 -0
- package/dist/cli-tui/oauth/oauth-flow-controller.d.ts.map +1 -1
- package/dist/cli-tui/oauth/oauth-flow-controller.js +76 -5
- package/dist/cli-tui/oauth/oauth-flow-controller.js.map +1 -1
- package/dist/cli-tui/run/run-controller.d.ts +2 -2
- package/dist/cli-tui/run/run-controller.d.ts.map +1 -1
- package/dist/cli-tui/run/run-controller.js +3 -2
- package/dist/cli-tui/run/run-controller.js.map +1 -1
- package/dist/cli-tui/run/run-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/run-shell-command.js +11 -3
- package/dist/cli-tui/run/run-shell-command.js.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.d.ts.map +1 -1
- package/dist/cli-tui/run/streaming-shell-command.js +11 -3
- package/dist/cli-tui/run/streaming-shell-command.js.map +1 -1
- package/dist/cli-tui/selectors/model-selector.d.ts.map +1 -1
- package/dist/cli-tui/selectors/model-selector.js +1 -0
- package/dist/cli-tui/selectors/model-selector.js.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts +8 -0
- package/dist/cli-tui/tui-renderer/agent-event-bridge.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js +23 -2
- package/dist/cli-tui/tui-renderer/agent-event-bridge.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts +3 -3
- package/dist/cli-tui/tui-renderer/command-registry-options.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/command-registry-options.js +12 -2
- package/dist/cli-tui/tui-renderer/command-registry-options.js.map +1 -1
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts +32 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.d.ts.map +1 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js +108 -0
- package/dist/cli-tui/tui-renderer/command-suite-wiring.js.map +1 -0
- package/dist/cli-tui/tui-renderer/input-controller.d.ts +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer/input-controller.js +2 -2
- package/dist/cli-tui/tui-renderer/input-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.d.ts +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js +1 -1
- package/dist/cli-tui/tui-renderer/ui-state-controller.js.map +1 -1
- package/dist/cli-tui/tui-renderer.d.ts +1 -3
- package/dist/cli-tui/tui-renderer.d.ts.map +1 -1
- package/dist/cli-tui/tui-renderer.js +37 -83
- package/dist/cli-tui/tui-renderer.js.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.d.ts +8 -0
- package/dist/cli-tui/utils/runtime-badges.d.ts.map +1 -1
- package/dist/cli-tui/utils/runtime-badges.js +58 -0
- package/dist/cli-tui/utils/runtime-badges.js.map +1 -1
- package/dist/cli.js +42555 -23133
- package/dist/cli.js.map +1 -1
- package/dist/config/env-vars.d.ts +4 -0
- package/dist/config/env-vars.d.ts.map +1 -1
- package/dist/config/env-vars.js +4 -0
- package/dist/config/env-vars.js.map +1 -1
- package/dist/config/feature-flags.d.ts +44 -0
- package/dist/config/feature-flags.d.ts.map +1 -1
- package/dist/config/feature-flags.js +214 -0
- package/dist/config/feature-flags.js.map +1 -1
- package/dist/connectors/service-client.d.ts +98 -0
- package/dist/connectors/service-client.d.ts.map +1 -0
- package/dist/connectors/service-client.js +459 -0
- package/dist/connectors/service-client.js.map +1 -0
- package/dist/conversation/render-model.d.ts.map +1 -1
- package/dist/conversation/render-model.js +53 -3
- package/dist/conversation/render-model.js.map +1 -1
- package/dist/db/health.d.ts +8 -0
- package/dist/db/health.d.ts.map +1 -0
- package/dist/db/health.js +64 -0
- package/dist/db/health.js.map +1 -0
- package/dist/db/migrate.d.ts +301 -0
- package/dist/db/migrate.d.ts.map +1 -1
- package/dist/db/migrate.js +186 -0
- package/dist/db/migrate.js.map +1 -1
- package/dist/db/migrations/0000_initial.sql +308 -0
- package/dist/db/migrations/0001_shared_sessions.sql +18 -0
- package/dist/db/migrations/0002_usage_metrics.sql +28 -0
- package/dist/db/migrations/0003_execution_traces.sql +18 -0
- package/dist/db/migrations/0004_workspace_config.sql +11 -0
- package/dist/db/migrations/0005_revenue_attribution.sql +31 -0
- package/dist/db/migrations/0006_hosted_session_storage.sql +51 -0
- package/dist/db/migrations/0007_reconcile_legacy_audit_hash_cache.sql +24 -0
- package/dist/db/migrations/0008_reconcile_legacy_webhook_deliveries.sql +290 -0
- package/dist/db/migrations/meta/0000_snapshot.json +2438 -0
- package/dist/db/migrations/meta/_journal.json +69 -0
- package/dist/db/schema.d.ts +2232 -844
- package/dist/db/schema.d.ts.map +1 -1
- package/dist/db/schema.js +187 -1
- package/dist/db/schema.js.map +1 -1
- package/dist/evalops/agent-bootstrap.d.ts +73 -0
- package/dist/evalops/agent-bootstrap.d.ts.map +1 -0
- package/dist/evalops/agent-bootstrap.js +380 -0
- package/dist/evalops/agent-bootstrap.js.map +1 -0
- package/dist/export-html.d.ts.map +1 -1
- package/dist/export-html.js +7 -4
- package/dist/export-html.js.map +1 -1
- package/dist/headless/utility-command-manager.d.ts +2 -1
- package/dist/headless/utility-command-manager.d.ts.map +1 -1
- package/dist/headless/utility-command-manager.js +12 -6
- package/dist/headless/utility-command-manager.js.map +1 -1
- package/dist/headless/utility-file-read.d.ts +1 -0
- package/dist/headless/utility-file-read.d.ts.map +1 -1
- package/dist/headless/utility-file-read.js +5 -1
- package/dist/headless/utility-file-read.js.map +1 -1
- package/dist/headless/utility-file-search.d.ts +1 -0
- package/dist/headless/utility-file-search.d.ts.map +1 -1
- package/dist/headless/utility-file-search.js +4 -1
- package/dist/headless/utility-file-search.js.map +1 -1
- package/dist/headless/utility-file-watch-manager.d.ts +2 -1
- package/dist/headless/utility-file-watch-manager.d.ts.map +1 -1
- package/dist/headless/utility-file-watch-manager.js +6 -2
- package/dist/headless/utility-file-watch-manager.js.map +1 -1
- package/dist/headless/workspace-root.d.ts +8 -0
- package/dist/headless/workspace-root.d.ts.map +1 -0
- package/dist/headless/workspace-root.js +74 -0
- package/dist/headless/workspace-root.js.map +1 -0
- package/dist/hooks/notification-hooks.d.ts +5 -0
- package/dist/hooks/notification-hooks.d.ts.map +1 -1
- package/dist/hooks/notification-hooks.js +4 -0
- package/dist/hooks/notification-hooks.js.map +1 -1
- package/dist/lsp/diagnostic-deltas.d.ts +20 -0
- package/dist/lsp/diagnostic-deltas.d.ts.map +1 -0
- package/dist/lsp/diagnostic-deltas.js +92 -0
- package/dist/lsp/diagnostic-deltas.js.map +1 -0
- package/dist/lsp/diagnostic-repair.d.ts +48 -0
- package/dist/lsp/diagnostic-repair.d.ts.map +1 -0
- package/dist/lsp/diagnostic-repair.js +143 -0
- package/dist/lsp/diagnostic-repair.js.map +1 -0
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +127 -37
- package/dist/main.js.map +1 -1
- package/dist/mcp/config.d.ts +4 -2
- package/dist/mcp/config.d.ts.map +1 -1
- package/dist/mcp/config.js +58 -14
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/index.d.ts +1 -0
- package/dist/mcp/index.d.ts.map +1 -1
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/index.js.map +1 -1
- package/dist/mcp/manager.d.ts +1 -0
- package/dist/mcp/manager.d.ts.map +1 -1
- package/dist/mcp/manager.js +1 -0
- package/dist/mcp/manager.js.map +1 -1
- package/dist/mcp/platform-plugin.d.ts +3 -0
- package/dist/mcp/platform-plugin.d.ts.map +1 -0
- package/dist/mcp/platform-plugin.js +117 -0
- package/dist/mcp/platform-plugin.js.map +1 -0
- package/dist/mcp/tool-bridge.d.ts +15 -0
- package/dist/mcp/tool-bridge.d.ts.map +1 -1
- package/dist/mcp/tool-bridge.js +194 -6
- package/dist/mcp/tool-bridge.js.map +1 -1
- package/dist/memory/platform-memory-client.d.ts +130 -0
- package/dist/memory/platform-memory-client.d.ts.map +1 -0
- package/dist/memory/platform-memory-client.js +330 -0
- package/dist/memory/platform-memory-client.js.map +1 -0
- package/dist/memory/service-client.d.ts.map +1 -1
- package/dist/memory/service-client.js +1 -2
- package/dist/memory/service-client.js.map +1 -1
- package/dist/models/builtin.d.ts.map +1 -1
- package/dist/models/builtin.js +137 -0
- package/dist/models/builtin.js.map +1 -1
- package/dist/models/config-loader.d.ts +10 -10
- package/dist/models/config-loader.d.ts.map +1 -1
- package/dist/models/config-loader.js +1 -0
- package/dist/models/config-loader.js.map +1 -1
- package/dist/models/registry.d.ts +1 -0
- package/dist/models/registry.d.ts.map +1 -1
- package/dist/models/registry.js +1 -0
- package/dist/models/registry.js.map +1 -1
- package/dist/oauth/connectors.d.ts +25 -0
- package/dist/oauth/connectors.d.ts.map +1 -0
- package/dist/oauth/connectors.js +253 -0
- package/dist/oauth/connectors.js.map +1 -0
- package/dist/oauth/device-identity.d.ts +18 -0
- package/dist/oauth/device-identity.d.ts.map +1 -0
- package/dist/oauth/device-identity.js +193 -0
- package/dist/oauth/device-identity.js.map +1 -0
- package/dist/oauth/evalops.d.ts.map +1 -1
- package/dist/oauth/evalops.js +74 -15
- package/dist/oauth/evalops.js.map +1 -1
- package/dist/oauth/index.d.ts +1 -1
- package/dist/oauth/index.d.ts.map +1 -1
- package/dist/oauth/index.js +31 -1
- package/dist/oauth/index.js.map +1 -1
- package/dist/oauth/openai-codex.d.ts +16 -0
- package/dist/oauth/openai-codex.d.ts.map +1 -0
- package/dist/oauth/openai-codex.js +300 -0
- package/dist/oauth/openai-codex.js.map +1 -0
- package/dist/opentelemetry.d.ts.map +1 -1
- package/dist/opentelemetry.js +9 -2
- package/dist/opentelemetry.js.map +1 -1
- package/dist/platform/agent-runtime-client.d.ts +279 -0
- package/dist/platform/agent-runtime-client.d.ts.map +1 -0
- package/dist/platform/agent-runtime-client.js +515 -0
- package/dist/platform/agent-runtime-client.js.map +1 -0
- package/dist/platform/cerebro-facts-client.d.ts +56 -0
- package/dist/platform/cerebro-facts-client.d.ts.map +1 -0
- package/dist/platform/cerebro-facts-client.js +297 -0
- package/dist/platform/cerebro-facts-client.js.map +1 -0
- package/dist/platform/client.d.ts +2 -1
- package/dist/platform/client.d.ts.map +1 -1
- package/dist/platform/client.js +9 -26
- package/dist/platform/client.js.map +1 -1
- package/dist/platform/core-services.d.ts +128 -0
- package/dist/platform/core-services.d.ts.map +1 -1
- package/dist/platform/core-services.js +128 -0
- package/dist/platform/core-services.js.map +1 -1
- package/dist/platform/maestro-timeline-client.d.ts +22 -0
- package/dist/platform/maestro-timeline-client.d.ts.map +1 -0
- package/dist/platform/maestro-timeline-client.js +373 -0
- package/dist/platform/maestro-timeline-client.js.map +1 -0
- package/dist/platform/tool-execution-client.d.ts +104 -0
- package/dist/platform/tool-execution-client.d.ts.map +1 -0
- package/dist/platform/tool-execution-client.js +284 -0
- package/dist/platform/tool-execution-client.js.map +1 -0
- package/dist/prompts/service-client.d.ts.map +1 -1
- package/dist/prompts/service-client.js +5 -2
- package/dist/prompts/service-client.js.map +1 -1
- package/dist/providers/anthropic-auth.d.ts.map +1 -1
- package/dist/providers/anthropic-auth.js +8 -6
- package/dist/providers/anthropic-auth.js.map +1 -1
- package/dist/providers/api-keys.d.ts +1 -0
- package/dist/providers/api-keys.d.ts.map +1 -1
- package/dist/providers/api-keys.js +5 -0
- package/dist/providers/api-keys.js.map +1 -1
- package/dist/providers/auth.d.ts +2 -1
- package/dist/providers/auth.d.ts.map +1 -1
- package/dist/providers/auth.js +26 -3
- package/dist/providers/auth.js.map +1 -1
- package/dist/remote-runner/attach-client.d.ts +41 -0
- package/dist/remote-runner/attach-client.d.ts.map +1 -0
- package/dist/remote-runner/attach-client.js +692 -0
- package/dist/remote-runner/attach-client.js.map +1 -0
- package/dist/remote-runner/client.d.ts +205 -0
- package/dist/remote-runner/client.d.ts.map +1 -0
- package/dist/remote-runner/client.js +633 -0
- package/dist/remote-runner/client.js.map +1 -0
- package/dist/safety/action-firewall.d.ts +6 -1
- package/dist/safety/action-firewall.d.ts.map +1 -1
- package/dist/safety/action-firewall.js +62 -26
- package/dist/safety/action-firewall.js.map +1 -1
- package/dist/safety/governance-service-client.d.ts +36 -0
- package/dist/safety/governance-service-client.d.ts.map +1 -0
- package/dist/safety/governance-service-client.js +279 -0
- package/dist/safety/governance-service-client.js.map +1 -0
- package/dist/safety/policy.d.ts +13 -2
- package/dist/safety/policy.d.ts.map +1 -1
- package/dist/safety/policy.js +474 -52
- package/dist/safety/policy.js.map +1 -1
- package/dist/sdk-tools.d.ts +21 -0
- package/dist/sdk-tools.d.ts.map +1 -1
- package/dist/sdk-tools.js +16 -0
- package/dist/sdk-tools.js.map +1 -1
- package/dist/server/app-context.d.ts +25 -0
- package/dist/server/app-context.d.ts.map +1 -1
- package/dist/server/app-context.js.map +1 -1
- package/dist/server/approval-service.d.ts +7 -8
- package/dist/server/approval-service.d.ts.map +1 -1
- package/dist/server/approval-service.js +12 -24
- package/dist/server/approval-service.js.map +1 -1
- package/dist/server/authz.d.ts +23 -2
- package/dist/server/authz.d.ts.map +1 -1
- package/dist/server/authz.js +153 -17
- package/dist/server/authz.js.map +1 -1
- package/dist/server/handlers/approvals.d.ts.map +1 -1
- package/dist/server/handlers/approvals.js +3 -10
- package/dist/server/handlers/approvals.js.map +1 -1
- package/dist/server/handlers/branch.d.ts.map +1 -1
- package/dist/server/handlers/branch.js +29 -20
- package/dist/server/handlers/branch.js.map +1 -1
- package/dist/server/handlers/bridge.d.ts.map +1 -1
- package/dist/server/handlers/bridge.js +3 -2
- package/dist/server/handlers/bridge.js.map +1 -1
- package/dist/server/handlers/chat-ws.d.ts.map +1 -1
- package/dist/server/handlers/chat-ws.js +23 -31
- package/dist/server/handlers/chat-ws.js.map +1 -1
- package/dist/server/handlers/chat.d.ts.map +1 -1
- package/dist/server/handlers/chat.js +105 -46
- package/dist/server/handlers/chat.js.map +1 -1
- package/dist/server/handlers/compliance.d.ts +3 -0
- package/dist/server/handlers/compliance.d.ts.map +1 -0
- package/dist/server/handlers/compliance.js +53 -0
- package/dist/server/handlers/compliance.js.map +1 -0
- package/dist/server/handlers/context.d.ts.map +1 -1
- package/dist/server/handlers/context.js +3 -8
- package/dist/server/handlers/context.js.map +1 -1
- package/dist/server/handlers/fleet.d.ts +4 -0
- package/dist/server/handlers/fleet.d.ts.map +1 -0
- package/dist/server/handlers/fleet.js +9 -0
- package/dist/server/handlers/fleet.js.map +1 -0
- package/dist/server/handlers/headless-sessions.d.ts +4 -0
- package/dist/server/handlers/headless-sessions.d.ts.map +1 -1
- package/dist/server/handlers/headless-sessions.js +168 -3
- package/dist/server/handlers/headless-sessions.js.map +1 -1
- package/dist/server/handlers/health.d.ts +31 -2
- package/dist/server/handlers/health.d.ts.map +1 -1
- package/dist/server/handlers/health.js +82 -8
- package/dist/server/handlers/health.js.map +1 -1
- package/dist/server/handlers/hosted-runner-drain.d.ts +128 -0
- package/dist/server/handlers/hosted-runner-drain.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-drain.js +373 -0
- package/dist/server/handlers/hosted-runner-drain.js.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts +17 -0
- package/dist/server/handlers/hosted-runner-identity.d.ts.map +1 -0
- package/dist/server/handlers/hosted-runner-identity.js +39 -0
- package/dist/server/handlers/hosted-runner-identity.js.map +1 -0
- package/dist/server/handlers/intelligent-router.d.ts +3 -0
- package/dist/server/handlers/intelligent-router.d.ts.map +1 -0
- package/dist/server/handlers/intelligent-router.js +141 -0
- package/dist/server/handlers/intelligent-router.js.map +1 -0
- package/dist/server/handlers/models.d.ts.map +1 -1
- package/dist/server/handlers/models.js +14 -0
- package/dist/server/handlers/models.js.map +1 -1
- package/dist/server/handlers/pending-requests.d.ts +8 -0
- package/dist/server/handlers/pending-requests.d.ts.map +1 -0
- package/dist/server/handlers/pending-requests.js +149 -0
- package/dist/server/handlers/pending-requests.js.map +1 -0
- package/dist/server/handlers/revenue-attribution.d.ts +3 -0
- package/dist/server/handlers/revenue-attribution.d.ts.map +1 -0
- package/dist/server/handlers/revenue-attribution.js +45 -0
- package/dist/server/handlers/revenue-attribution.js.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts +10 -0
- package/dist/server/handlers/runtime-app-server-ws.d.ts.map +1 -0
- package/dist/server/handlers/runtime-app-server-ws.js +206 -0
- package/dist/server/handlers/runtime-app-server-ws.js.map +1 -0
- package/dist/server/handlers/session-artifacts.js +2 -2
- package/dist/server/handlers/session-artifacts.js.map +1 -1
- package/dist/server/handlers/session-attachments.js +3 -3
- package/dist/server/handlers/session-attachments.js.map +1 -1
- package/dist/server/handlers/session-timeline.d.ts +11 -0
- package/dist/server/handlers/session-timeline.d.ts.map +1 -0
- package/dist/server/handlers/session-timeline.js +77 -0
- package/dist/server/handlers/session-timeline.js.map +1 -0
- package/dist/server/handlers/sessions.d.ts +11 -0
- package/dist/server/handlers/sessions.d.ts.map +1 -1
- package/dist/server/handlers/sessions.js +68 -100
- package/dist/server/handlers/sessions.js.map +1 -1
- package/dist/server/handlers/traces.d.ts +3 -0
- package/dist/server/handlers/traces.d.ts.map +1 -0
- package/dist/server/handlers/traces.js +60 -0
- package/dist/server/handlers/traces.js.map +1 -0
- package/dist/server/handlers/usage-analytics.d.ts +3 -0
- package/dist/server/handlers/usage-analytics.d.ts.map +1 -0
- package/dist/server/handlers/usage-analytics.js +40 -0
- package/dist/server/handlers/usage-analytics.js.map +1 -0
- package/dist/server/handlers/workspace-config.d.ts +3 -0
- package/dist/server/handlers/workspace-config.d.ts.map +1 -0
- package/dist/server/handlers/workspace-config.js +62 -0
- package/dist/server/handlers/workspace-config.js.map +1 -0
- package/dist/server/headless-in-process-host.d.ts +8 -1
- package/dist/server/headless-in-process-host.d.ts.map +1 -1
- package/dist/server/headless-in-process-host.js +6 -0
- package/dist/server/headless-in-process-host.js.map +1 -1
- package/dist/server/headless-runtime-service.d.ts +99 -1
- package/dist/server/headless-runtime-service.d.ts.map +1 -1
- package/dist/server/headless-runtime-service.js +286 -23
- package/dist/server/headless-runtime-service.js.map +1 -1
- package/dist/server/hosted-session-manager.d.ts +103 -0
- package/dist/server/hosted-session-manager.d.ts.map +1 -0
- package/dist/server/hosted-session-manager.js +629 -0
- package/dist/server/hosted-session-manager.js.map +1 -0
- package/dist/server/pending-request-payload.d.ts +4 -0
- package/dist/server/pending-request-payload.d.ts.map +1 -0
- package/dist/server/pending-request-payload.js +107 -0
- package/dist/server/pending-request-payload.js.map +1 -0
- package/dist/server/request-context.d.ts +4 -0
- package/dist/server/request-context.d.ts.map +1 -1
- package/dist/server/request-context.js +9 -0
- package/dist/server/request-context.js.map +1 -1
- package/dist/server/routes.d.ts.map +1 -1
- package/dist/server/routes.js +149 -1
- package/dist/server/routes.js.map +1 -1
- package/dist/server/runtime-ws-access.d.ts +16 -0
- package/dist/server/runtime-ws-access.d.ts.map +1 -0
- package/dist/server/runtime-ws-access.js +21 -0
- package/dist/server/runtime-ws-access.js.map +1 -0
- package/dist/server/server-middlewares.d.ts +1 -1
- package/dist/server/server-middlewares.d.ts.map +1 -1
- package/dist/server/server-middlewares.js +35 -27
- package/dist/server/server-middlewares.js.map +1 -1
- package/dist/server/server-request-manager.d.ts +8 -27
- package/dist/server/server-request-manager.d.ts.map +1 -1
- package/dist/server/server-request-manager.js +7 -0
- package/dist/server/server-request-manager.js.map +1 -1
- package/dist/server/server-utils.d.ts +2 -1
- package/dist/server/server-utils.d.ts.map +1 -1
- package/dist/server/server-utils.js +11 -1
- package/dist/server/server-utils.js.map +1 -1
- package/dist/server/session-event-env.d.ts +2 -0
- package/dist/server/session-event-env.d.ts.map +1 -0
- package/dist/server/session-event-env.js +8 -0
- package/dist/server/session-event-env.js.map +1 -0
- package/dist/server/session-initialization.d.ts +25 -4
- package/dist/server/session-initialization.d.ts.map +1 -1
- package/dist/server/session-initialization.js +22 -5
- package/dist/server/session-initialization.js.map +1 -1
- package/dist/server/session-scope.d.ts +4 -0
- package/dist/server/session-scope.d.ts.map +1 -1
- package/dist/server/session-scope.js +44 -4
- package/dist/server/session-scope.js.map +1 -1
- package/dist/server/session-timeline.d.ts +13 -0
- package/dist/server/session-timeline.d.ts.map +1 -0
- package/dist/server/session-timeline.js +566 -0
- package/dist/server/session-timeline.js.map +1 -0
- package/dist/services/compliance/controls.d.ts +6 -0
- package/dist/services/compliance/controls.d.ts.map +1 -0
- package/dist/services/compliance/controls.js +113 -0
- package/dist/services/compliance/controls.js.map +1 -0
- package/dist/services/compliance/index.d.ts +6 -0
- package/dist/services/compliance/index.d.ts.map +1 -0
- package/dist/services/compliance/index.js +5 -0
- package/dist/services/compliance/index.js.map +1 -0
- package/dist/services/compliance/normalize.d.ts +23 -0
- package/dist/services/compliance/normalize.d.ts.map +1 -0
- package/dist/services/compliance/normalize.js +226 -0
- package/dist/services/compliance/normalize.js.map +1 -0
- package/dist/services/compliance/recorder.d.ts +22 -0
- package/dist/services/compliance/recorder.d.ts.map +1 -0
- package/dist/services/compliance/recorder.js +89 -0
- package/dist/services/compliance/recorder.js.map +1 -0
- package/dist/services/compliance/service.d.ts +24 -0
- package/dist/services/compliance/service.d.ts.map +1 -0
- package/dist/services/compliance/service.js +426 -0
- package/dist/services/compliance/service.js.map +1 -0
- package/dist/services/compliance/types.d.ts +185 -0
- package/dist/services/compliance/types.d.ts.map +1 -0
- package/dist/services/compliance/types.js +2 -0
- package/dist/services/compliance/types.js.map +1 -0
- package/dist/services/intelligent-router/index.d.ts +5 -0
- package/dist/services/intelligent-router/index.d.ts.map +1 -0
- package/dist/services/intelligent-router/index.js +5 -0
- package/dist/services/intelligent-router/index.js.map +1 -0
- package/dist/services/intelligent-router/normalize.d.ts +9 -0
- package/dist/services/intelligent-router/normalize.d.ts.map +1 -0
- package/dist/services/intelligent-router/normalize.js +169 -0
- package/dist/services/intelligent-router/normalize.js.map +1 -0
- package/dist/services/intelligent-router/recorder.d.ts +24 -0
- package/dist/services/intelligent-router/recorder.d.ts.map +1 -0
- package/dist/services/intelligent-router/recorder.js +98 -0
- package/dist/services/intelligent-router/recorder.js.map +1 -0
- package/dist/services/intelligent-router/service.d.ts +22 -0
- package/dist/services/intelligent-router/service.d.ts.map +1 -0
- package/dist/services/intelligent-router/service.js +328 -0
- package/dist/services/intelligent-router/service.js.map +1 -0
- package/dist/services/intelligent-router/types.d.ts +98 -0
- package/dist/services/intelligent-router/types.d.ts.map +1 -0
- package/dist/services/intelligent-router/types.js +7 -0
- package/dist/services/intelligent-router/types.js.map +1 -0
- package/dist/services/revenue-attribution/index.d.ts +4 -0
- package/dist/services/revenue-attribution/index.d.ts.map +1 -0
- package/dist/services/revenue-attribution/index.js +4 -0
- package/dist/services/revenue-attribution/index.js.map +1 -0
- package/dist/services/revenue-attribution/normalize.d.ts +13 -0
- package/dist/services/revenue-attribution/normalize.d.ts.map +1 -0
- package/dist/services/revenue-attribution/normalize.js +155 -0
- package/dist/services/revenue-attribution/normalize.js.map +1 -0
- package/dist/services/revenue-attribution/service.d.ts +21 -0
- package/dist/services/revenue-attribution/service.d.ts.map +1 -0
- package/dist/services/revenue-attribution/service.js +248 -0
- package/dist/services/revenue-attribution/service.js.map +1 -0
- package/dist/services/revenue-attribution/types.d.ts +96 -0
- package/dist/services/revenue-attribution/types.d.ts.map +1 -0
- package/dist/services/revenue-attribution/types.js +7 -0
- package/dist/services/revenue-attribution/types.js.map +1 -0
- package/dist/services/traces/index.d.ts +5 -0
- package/dist/services/traces/index.d.ts.map +1 -0
- package/dist/services/traces/index.js +4 -0
- package/dist/services/traces/index.js.map +1 -0
- package/dist/services/traces/normalize.d.ts +20 -0
- package/dist/services/traces/normalize.d.ts.map +1 -0
- package/dist/services/traces/normalize.js +261 -0
- package/dist/services/traces/normalize.js.map +1 -0
- package/dist/services/traces/otel.d.ts +3 -0
- package/dist/services/traces/otel.d.ts.map +1 -0
- package/dist/services/traces/otel.js +173 -0
- package/dist/services/traces/otel.js.map +1 -0
- package/dist/services/traces/service.d.ts +17 -0
- package/dist/services/traces/service.d.ts.map +1 -0
- package/dist/services/traces/service.js +197 -0
- package/dist/services/traces/service.js.map +1 -0
- package/dist/services/traces/types.d.ts +130 -0
- package/dist/services/traces/types.d.ts.map +1 -0
- package/dist/services/traces/types.js +8 -0
- package/dist/services/traces/types.js.map +1 -0
- package/dist/services/usage-analytics/aggregation.d.ts +18 -0
- package/dist/services/usage-analytics/aggregation.d.ts.map +1 -0
- package/dist/services/usage-analytics/aggregation.js +130 -0
- package/dist/services/usage-analytics/aggregation.js.map +1 -0
- package/dist/services/usage-analytics/index.d.ts +5 -0
- package/dist/services/usage-analytics/index.d.ts.map +1 -0
- package/dist/services/usage-analytics/index.js +4 -0
- package/dist/services/usage-analytics/index.js.map +1 -0
- package/dist/services/usage-analytics/recorder.d.ts +16 -0
- package/dist/services/usage-analytics/recorder.d.ts.map +1 -0
- package/dist/services/usage-analytics/recorder.js +128 -0
- package/dist/services/usage-analytics/recorder.js.map +1 -0
- package/dist/services/usage-analytics/service.d.ts +15 -0
- package/dist/services/usage-analytics/service.d.ts.map +1 -0
- package/dist/services/usage-analytics/service.js +210 -0
- package/dist/services/usage-analytics/service.js.map +1 -0
- package/dist/services/usage-analytics/types.d.ts +80 -0
- package/dist/services/usage-analytics/types.d.ts.map +1 -0
- package/dist/services/usage-analytics/types.js +2 -0
- package/dist/services/usage-analytics/types.js.map +1 -0
- package/dist/services/workspace-config/index.d.ts +6 -0
- package/dist/services/workspace-config/index.d.ts.map +1 -0
- package/dist/services/workspace-config/index.js +5 -0
- package/dist/services/workspace-config/index.js.map +1 -0
- package/dist/services/workspace-config/middleware.d.ts +5 -0
- package/dist/services/workspace-config/middleware.d.ts.map +1 -0
- package/dist/services/workspace-config/middleware.js +98 -0
- package/dist/services/workspace-config/middleware.js.map +1 -0
- package/dist/services/workspace-config/normalize.d.ts +17 -0
- package/dist/services/workspace-config/normalize.d.ts.map +1 -0
- package/dist/services/workspace-config/normalize.js +148 -0
- package/dist/services/workspace-config/normalize.js.map +1 -0
- package/dist/services/workspace-config/policy.d.ts +16 -0
- package/dist/services/workspace-config/policy.d.ts.map +1 -0
- package/dist/services/workspace-config/policy.js +77 -0
- package/dist/services/workspace-config/policy.js.map +1 -0
- package/dist/services/workspace-config/service.d.ts +20 -0
- package/dist/services/workspace-config/service.d.ts.map +1 -0
- package/dist/services/workspace-config/service.js +162 -0
- package/dist/services/workspace-config/service.js.map +1 -0
- package/dist/services/workspace-config/types.d.ts +71 -0
- package/dist/services/workspace-config/types.d.ts.map +1 -0
- package/dist/services/workspace-config/types.js +2 -0
- package/dist/services/workspace-config/types.js.map +1 -0
- package/dist/session/manager.d.ts.map +1 -1
- package/dist/session/manager.js +10 -0
- package/dist/session/manager.js.map +1 -1
- package/dist/session/migration.d.ts.map +1 -1
- package/dist/session/migration.js +2 -1
- package/dist/session/migration.js.map +1 -1
- package/dist/session/session-memory.d.ts.map +1 -1
- package/dist/session/session-memory.js +7 -1
- package/dist/session/session-memory.js.map +1 -1
- package/dist/session/types.d.ts +1 -2
- package/dist/session/types.d.ts.map +1 -1
- package/dist/session/types.js +1 -22
- package/dist/session/types.js.map +1 -1
- package/dist/session/wire-format.d.ts +7 -0
- package/dist/session/wire-format.d.ts.map +1 -0
- package/dist/session/wire-format.generated.d.ts +95 -0
- package/dist/session/wire-format.generated.d.ts.map +1 -0
- package/dist/session/wire-format.generated.js +111 -0
- package/dist/session/wire-format.generated.js.map +1 -0
- package/dist/session/wire-format.js +145 -0
- package/dist/session/wire-format.js.map +1 -0
- package/dist/shared-memory/client.d.ts.map +1 -1
- package/dist/shared-memory/client.js +22 -22
- package/dist/shared-memory/client.js.map +1 -1
- package/dist/skills/artifact-metadata.d.ts +16 -0
- package/dist/skills/artifact-metadata.d.ts.map +1 -0
- package/dist/skills/artifact-metadata.js +86 -0
- package/dist/skills/artifact-metadata.js.map +1 -0
- package/dist/skills/loader.d.ts +2 -2
- package/dist/skills/loader.d.ts.map +1 -1
- package/dist/skills/loader.js +1 -0
- package/dist/skills/loader.js.map +1 -1
- package/dist/skills/service-client.d.ts +42 -0
- package/dist/skills/service-client.d.ts.map +1 -0
- package/dist/skills/service-client.js +258 -0
- package/dist/skills/service-client.js.map +1 -0
- package/dist/skills/tool.d.ts +3 -0
- package/dist/skills/tool.d.ts.map +1 -1
- package/dist/skills/tool.js +67 -5
- package/dist/skills/tool.js.map +1 -1
- package/dist/telemetry/index.d.ts +4 -0
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +5 -0
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/maestro-event-bus.d.ts +440 -0
- package/dist/telemetry/maestro-event-bus.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-bus.js +784 -0
- package/dist/telemetry/maestro-event-bus.js.map +1 -0
- package/dist/telemetry/maestro-event-catalog.d.ts +48 -0
- package/dist/telemetry/maestro-event-catalog.d.ts.map +1 -0
- package/dist/telemetry/maestro-event-catalog.js +69 -0
- package/dist/telemetry/maestro-event-catalog.js.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts +24 -0
- package/dist/telemetry/maestro-platform-replay-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js +400 -0
- package/dist/telemetry/maestro-platform-replay-fixture.js.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts +29 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.d.ts.map +1 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js +240 -0
- package/dist/telemetry/maestro-publisher-conformance-fixture.js.map +1 -0
- package/dist/telemetry/meter-service-client.d.ts +0 -33
- package/dist/telemetry/meter-service-client.d.ts.map +1 -1
- package/dist/telemetry/meter-service-client.js +22 -50
- package/dist/telemetry/meter-service-client.js.map +1 -1
- package/dist/telemetry/turn-tracker.d.ts.map +1 -1
- package/dist/telemetry/turn-tracker.js +5 -5
- package/dist/telemetry/turn-tracker.js.map +1 -1
- package/dist/telemetry/wide-events.d.ts +8 -0
- package/dist/telemetry/wide-events.d.ts.map +1 -1
- package/dist/telemetry/wide-events.js +28 -0
- package/dist/telemetry/wide-events.js.map +1 -1
- package/dist/telemetry.d.ts +1 -1
- package/dist/telemetry.d.ts.map +1 -1
- package/dist/telemetry.js +14 -4
- package/dist/telemetry.js.map +1 -1
- package/dist/timeline/redaction.d.ts +5 -0
- package/dist/timeline/redaction.d.ts.map +1 -0
- package/dist/timeline/redaction.js +119 -0
- package/dist/timeline/redaction.js.map +1 -0
- package/dist/tools/ask-user.d.ts +26 -0
- package/dist/tools/ask-user.d.ts.map +1 -1
- package/dist/tools/ask-user.js +33 -1
- package/dist/tools/ask-user.js.map +1 -1
- package/dist/tools/background/task-types.d.ts +1 -1
- package/dist/tools/edit.d.ts +2 -0
- package/dist/tools/edit.d.ts.map +1 -1
- package/dist/tools/edit.js +27 -7
- package/dist/tools/edit.js.map +1 -1
- package/dist/tools/index.d.ts +9 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/pipeline.d.ts.map +1 -1
- package/dist/tools/pipeline.js +16 -7
- package/dist/tools/pipeline.js.map +1 -1
- package/dist/tools/write.d.ts +2 -0
- package/dist/tools/write.d.ts.map +1 -1
- package/dist/tools/write.js +24 -6
- package/dist/tools/write.js.map +1 -1
- package/dist/tracking/cost-tracker.d.ts +15 -12
- package/dist/tracking/cost-tracker.d.ts.map +1 -1
- package/dist/tracking/cost-tracker.js +29 -40
- package/dist/tracking/cost-tracker.js.map +1 -1
- package/dist/utils/checkpoint-profiler.d.ts +29 -0
- package/dist/utils/checkpoint-profiler.d.ts.map +1 -0
- package/dist/utils/checkpoint-profiler.js +118 -0
- package/dist/utils/checkpoint-profiler.js.map +1 -0
- package/dist/utils/downstream-http.d.ts +21 -0
- package/dist/utils/downstream-http.d.ts.map +1 -0
- package/dist/utils/downstream-http.js +151 -0
- package/dist/utils/downstream-http.js.map +1 -0
- package/dist/utils/downstream.d.ts +18 -0
- package/dist/utils/downstream.d.ts.map +1 -0
- package/dist/utils/downstream.js +47 -0
- package/dist/utils/downstream.js.map +1 -0
- package/dist/utils/logger.d.ts +3 -1
- package/dist/utils/logger.d.ts.map +1 -1
- package/dist/utils/logger.js +12 -1
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/oauth-http.d.ts +8 -0
- package/dist/utils/oauth-http.d.ts.map +1 -0
- package/dist/utils/oauth-http.js +41 -0
- package/dist/utils/oauth-http.js.map +1 -0
- package/dist/utils/path-utils.d.ts +2 -0
- package/dist/utils/path-utils.d.ts.map +1 -0
- package/dist/utils/path-utils.js +12 -0
- package/dist/utils/path-utils.js.map +1 -0
- package/dist/utils/path-validation.d.ts +1 -1
- package/dist/utils/path-validation.d.ts.map +1 -1
- package/dist/utils/path-validation.js +3 -3
- package/dist/utils/path-validation.js.map +1 -1
- package/dist/version.json +2 -2
- package/dist/web-server.d.ts +7 -1
- package/dist/web-server.d.ts.map +1 -1
- package/dist/web-server.js +117 -15
- package/dist/web-server.js.map +1 -1
- package/dist/webhooks/delivery.d.ts.map +1 -1
- package/dist/webhooks/delivery.js +9 -12
- package/dist/webhooks/delivery.js.map +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/from-json.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/to-json.js +9 -10
- package/node_modules/@bufbuild/protobuf/dist/cjs/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/go_features_pb.js +38 -2
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/cjs/wkt/wrappers.js +24 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/descriptors.d.ts +12 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/from-binary.js +7 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/from-json.js +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/reflect/path.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/registry.js +24 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/to-json.js +10 -11
- package/node_modules/@bufbuild/protobuf/dist/esm/types.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.d.ts +9 -7
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/binary-encoding.js +18 -8
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.d.ts +4 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wire/text-encoding.js +8 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/api_pb.d.ts +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/compiler/plugin_pb.d.ts +2 -2
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.d.ts +37 -23
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/descriptor_pb.js +1 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/field_mask_pb.d.ts +32 -36
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.d.ts +65 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/go_features_pb.js +37 -1
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/timestamp_pb.d.ts +5 -5
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/gen/google/protobuf/type_pb.d.ts +3 -3
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.d.ts +10 -0
- package/node_modules/@bufbuild/protobuf/dist/esm/wkt/wrappers.js +23 -0
- package/node_modules/@bufbuild/protobuf/package.json +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts +305 -2
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js +34 -4
- package/node_modules/@evalops/contracts/dist/headless-protocol-schemas.generated.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.d.ts +88 -0
- package/node_modules/@evalops/contracts/dist/index.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/index.js +2 -0
- package/node_modules/@evalops/contracts/dist/index.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts +77 -77
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js +1 -1
- package/node_modules/@evalops/contracts/dist/proto/maestro/v1/headless_pb.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts +182 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js +83 -0
- package/node_modules/@evalops/contracts/dist/runtime-app-server.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts +133 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js +68 -0
- package/node_modules/@evalops/contracts/dist/runtime-server-request.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts +178 -0
- package/node_modules/@evalops/contracts/dist/schemas.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/schemas.js +165 -0
- package/node_modules/@evalops/contracts/dist/schemas.js.map +1 -1
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts +2 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.d.ts.map +1 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js +5 -0
- package/node_modules/@evalops/contracts/dist/typebox-utils.js.map +1 -0
- package/node_modules/@evalops/contracts/dist/validators.d.ts +4 -1
- package/node_modules/@evalops/contracts/dist/validators.d.ts.map +1 -1
- package/node_modules/@evalops/contracts/dist/validators.js +4 -1
- package/node_modules/@evalops/contracts/dist/validators.js.map +1 -1
- package/node_modules/@evalops/contracts/package.json +1 -1
- package/node_modules/@evalops/tui/package.json +1 -1
- package/node_modules/string-width/index.js +93 -9
- package/node_modules/string-width/package.json +1 -1
- package/package.json +32 -25
- package/dist/cli-tui/commands/grouped/auth-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/auth-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/config-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/diag-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/git-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/index.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/index.js.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/safety-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/session-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/tools-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/ui-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/undo-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/usage-commands.js.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped/utils.js.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.d.ts.map +0 -1
- package/dist/cli-tui/commands/grouped-command-handlers.js +0 -135
- package/dist/cli-tui/commands/grouped-command-handlers.js.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts +0 -78
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.d.ts.map +0 -1
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js +0 -129
- package/dist/cli-tui/tui-renderer/grouped-handlers-wiring.js.map +0 -1
- package/node_modules/@evalops/memory/dist/client.d.ts +0 -94
- package/node_modules/@evalops/memory/dist/client.js +0 -503
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.d.ts +0 -608
- package/node_modules/@evalops/memory/gen/proto/dist/memory/v1/memory_pb.js +0 -187
- package/node_modules/@evalops/memory/package.json +0 -26
- /package/dist/cli-tui/commands/{grouped → subcommands}/usage-commands.d.ts +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-attachments.js","sourceRoot":"","sources":["../../../src/server/handlers/session-attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,QAAQ,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,8BAA8B,EAAE,MAAM,qBAAqB,CAAC;AAErE,MAAM,gBAAgB,GAAG,mBA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,CAAC;gBACJ,cAAc,CAAC,wBAAwB,CACtC,WAAW,EACX,YAAY,EACZ,SAAS,CAAC,aAAa,CACvB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACR,8DAA8D;YAC/D,CAAC;QACF,CAAC;QAED,QAAQ,CACP,GAAG,EACH,GAAG,EACH;YACC,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,IAAI,EAAE,SAAS,CAAC,SAAS;YACzB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,aAAa,EAAE,SAAS,CAAC,aAAa;SACtC,EACD,IAAI,EACJ,GAAG,CACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;AACF,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport { extractDocumentText } from \"../../utils/document-extractor.js\";\nimport {\n\tbuildContentDisposition,\n\trespondWithApiError,\n\tsendJson,\n} from \"../server-utils.js\";\nimport { createSessionManagerForRequest } from \"../session-scope.js\";\n\nconst sessionIdPattern = /^[a-zA-Z0-9._-]+$/;\nconst attachmentIdPattern = /^[a-zA-Z0-9._-]+$/;\n\nfunction findAttachmentInSession(\n\tsession: { messages?: Array<unknown> },\n\tattachmentId: string,\n): {\n\tfileName: string;\n\tmimeType: string;\n\tcontentBase64: string;\n\tsize?: number;\n\textractedText?: string;\n} | null {\n\tconst messages = Array.isArray(session.messages) ? session.messages : [];\n\tfor (const msg of messages) {\n\t\tif (!msg || typeof msg !== \"object\") continue;\n\t\tconst maybeAttachments = (msg as { attachments?: unknown }).attachments;\n\t\tif (!Array.isArray(maybeAttachments)) continue;\n\n\t\tfor (const att of maybeAttachments) {\n\t\t\tif (!att || typeof att !== \"object\") continue;\n\t\t\tconst a = att as {\n\t\t\t\tid?: unknown;\n\t\t\t\tfileName?: unknown;\n\t\t\t\tmimeType?: unknown;\n\t\t\t\tcontent?: unknown;\n\t\t\t\tsize?: unknown;\n\t\t\t\textractedText?: unknown;\n\t\t\t};\n\t\t\tif (a.id !== attachmentId) continue;\n\t\t\tif (typeof a.fileName !== \"string\" || !a.fileName) return null;\n\t\t\tif (typeof a.mimeType !== \"string\" || !a.mimeType) return null;\n\t\t\tif (typeof a.content !== \"string\" || !a.content) return null;\n\t\t\treturn {\n\t\t\t\tfileName: a.fileName,\n\t\t\t\tmimeType: a.mimeType,\n\t\t\t\tcontentBase64: a.content,\n\t\t\t\tsize:\n\t\t\t\t\ttypeof a.size === \"number\" && Number.isFinite(a.size)\n\t\t\t\t\t\t? a.size\n\t\t\t\t\t\t: undefined,\n\t\t\t\textractedText:\n\t\t\t\t\ttypeof a.extractedText === \"string\" && a.extractedText.length > 0\n\t\t\t\t\t\t? a.extractedText\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}\n\t}\n\treturn null;\n}\n\nexport async function handleSessionAttachment(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tparams: { id: string; attachmentId: string },\n\tcors: Record<string, string>,\n) {\n\tconst sessionManager = createSessionManagerForRequest(req, true);\n\n\ttry {\n\t\tif (req.method !== \"GET\") {\n\t\t\tsendJson(res, 405, { error: \"Method not allowed\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = params.id;\n\t\tconst attachmentId = params.attachmentId;\n\n\t\tif (!sessionIdPattern.test(sessionId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid session id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\t\tif (!attachmentIdPattern.test(attachmentId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid attachment id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst session = await sessionManager.loadSession(sessionId);\n\t\tif (!session) {\n\t\t\tsendJson(res, 404, { error: \"Session not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst attachment = findAttachmentInSession(session, attachmentId);\n\t\tif (!attachment) {\n\t\t\tsendJson(res, 404, { error: \"Attachment not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst bytes = Buffer.from(attachment.contentBase64, \"base64\");\n\n\t\tconst requestUrl = new URL(req.url || \"/\", \"http://localhost\");\n\t\tconst download = requestUrl.searchParams.get(\"download\");\n\t\tconst shouldDownload = download === \"1\" || download === \"true\";\n\n\t\tres.writeHead(200, {\n\t\t\t\"Content-Type\": attachment.mimeType,\n\t\t\t\"Content-Length\": bytes.length,\n\t\t\t\"Cache-Control\": \"private, max-age=3600\",\n\t\t\t...(shouldDownload\n\t\t\t\t? {\n\t\t\t\t\t\t\"Content-Disposition\": buildContentDisposition(attachment.fileName),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...cors,\n\t\t});\n\t\tres.end(bytes);\n\t} catch (error) {\n\t\trespondWithApiError(res, error, 500, cors, req);\n\t}\n}\n\nexport async function handleSessionAttachmentExtract(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tparams: { id: string; attachmentId: string },\n\tcors: Record<string, string>,\n) {\n\tconst sessionManager = createSessionManagerForRequest(req, true);\n\n\ttry {\n\t\tif (req.method !== \"POST\") {\n\t\t\tsendJson(res, 405, { error: \"Method not allowed\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = params.id;\n\t\tconst attachmentId = params.attachmentId;\n\n\t\tif (!sessionIdPattern.test(sessionId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid session id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\t\tif (!attachmentIdPattern.test(attachmentId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid attachment id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst requestUrl = new URL(req.url || \"/\", \"http://localhost\");\n\t\tconst force = requestUrl.searchParams.get(\"force\");\n\t\tconst shouldForce = force === \"1\" || force === \"true\";\n\n\t\tconst session = await sessionManager.loadSession(sessionId);\n\t\tif (!session) {\n\t\t\tsendJson(res, 404, { error: \"Session not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst attachment = findAttachmentInSession(session, attachmentId);\n\t\tif (!attachment) {\n\t\t\tsendJson(res, 404, { error: \"Attachment not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tif (attachment.extractedText && !shouldForce) {\n\t\t\tsendJson(\n\t\t\t\tres,\n\t\t\t\t200,\n\t\t\t\t{\n\t\t\t\t\tfileName: attachment.fileName,\n\t\t\t\t\tformat: \"unknown\",\n\t\t\t\t\tsize: attachment.size ?? 0,\n\t\t\t\t\ttruncated: false,\n\t\t\t\t\textractedText: attachment.extractedText,\n\t\t\t\t\tcached: true,\n\t\t\t\t},\n\t\t\t\tcors,\n\t\t\t\treq,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst bytes = Buffer.from(attachment.contentBase64, \"base64\");\n\t\tconst extracted = await extractDocumentText({\n\t\t\tbuffer: bytes,\n\t\t\tfileName: attachment.fileName,\n\t\t\tmimeType: attachment.mimeType,\n\t\t});\n\n\t\tconst sessionFile = sessionManager.getSessionFileById(sessionId);\n\t\tif (sessionFile && typeof extracted.extractedText === \"string\") {\n\t\t\ttry {\n\t\t\t\tsessionManager.saveAttachmentExtraction(\n\t\t\t\t\tsessionFile,\n\t\t\t\t\tattachmentId,\n\t\t\t\t\textracted.extractedText,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// ignore persistence errors; extraction result still returned\n\t\t\t}\n\t\t}\n\n\t\tsendJson(\n\t\t\tres,\n\t\t\t200,\n\t\t\t{\n\t\t\t\tfileName: attachment.fileName,\n\t\t\t\tformat: extracted.format,\n\t\t\t\tsize: extracted.sizeBytes,\n\t\t\t\ttruncated: extracted.truncated,\n\t\t\t\textractedText: extracted.extractedText,\n\t\t\t},\n\t\t\tcors,\n\t\t\treq,\n\t\t);\n\t} catch (error) {\n\t\trespondWithApiError(res, error, 500, cors, req);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"session-attachments.js","sourceRoot":"","sources":["../../../src/server/handlers/session-attachments.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,mCAAmC,CAAC;AACxE,OAAO,EACN,uBAAuB,EACvB,mBAAmB,EACnB,QAAQ,GACR,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AAExE,MAAM,gBAAgB,GAAG,mBAAmB,CAAC;AAC7C,MAAM,mBAAmB,GAAG,mBAAmB,CAAC;AAEhD,SAAS,uBAAuB,CAC/B,OAAsC,EACtC,YAAoB;IAQpB,MAAM,QAAQ,GAAG,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC;IACzE,KAAK,MAAM,GAAG,IAAI,QAAQ,EAAE,CAAC;QAC5B,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,SAAS;QAC9C,MAAM,gBAAgB,GAAI,GAAiC,CAAC,WAAW,CAAC;QACxE,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,gBAAgB,CAAC;YAAE,SAAS;QAE/C,KAAK,MAAM,GAAG,IAAI,gBAAgB,EAAE,CAAC;YACpC,IAAI,CAAC,GAAG,IAAI,OAAO,GAAG,KAAK,QAAQ;gBAAE,SAAS;YAC9C,MAAM,CAAC,GAAG,GAOT,CAAC;YACF,IAAI,CAAC,CAAC,EAAE,KAAK,YAAY;gBAAE,SAAS;YACpC,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ;gBAAE,OAAO,IAAI,CAAC;YAC/D,IAAI,OAAO,CAAC,CAAC,QAAQ,KAAK,QAAQ,IAAI,CAAC,CAAC,CAAC,QAAQ;gBA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E,QAAQ,CAAC,CAAC;QAC9D,MAAM,SAAS,GAAG,MAAM,mBAAmB,CAAC;YAC3C,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,QAAQ,EAAE,UAAU,CAAC,QAAQ;SAC7B,CAAC,CAAC;QAEH,MAAM,WAAW,GAAG,cAAc,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACjE,IAAI,WAAW,IAAI,OAAO,SAAS,CAAC,aAAa,KAAK,QAAQ,EAAE,CAAC;YAChE,IAAI,CAAC;gBACJ,cAAc,CAAC,wBAAwB,CACtC,WAAW,EACX,YAAY,EACZ,SAAS,CAAC,aAAa,CACvB,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACR,8DAA8D;YAC/D,CAAC;QACF,CAAC;QAED,QAAQ,CACP,GAAG,EACH,GAAG,EACH;YACC,QAAQ,EAAE,UAAU,CAAC,QAAQ;YAC7B,MAAM,EAAE,SAAS,CAAC,MAAM;YACxB,IAAI,EAAE,SAAS,CAAC,SAAS;YACzB,SAAS,EAAE,SAAS,CAAC,SAAS;YAC9B,aAAa,EAAE,SAAS,CAAC,aAAa;SACtC,EACD,IAAI,EACJ,GAAG,CACH,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IACjD,CAAC;AACF,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport { extractDocumentText } from \"../../utils/document-extractor.js\";\nimport {\n\tbuildContentDisposition,\n\trespondWithApiError,\n\tsendJson,\n} from \"../server-utils.js\";\nimport { createWebSessionManagerForRequest } from \"../session-scope.js\";\n\nconst sessionIdPattern = /^[a-zA-Z0-9._-]+$/;\nconst attachmentIdPattern = /^[a-zA-Z0-9._-]+$/;\n\nfunction findAttachmentInSession(\n\tsession: { messages?: Array<unknown> },\n\tattachmentId: string,\n): {\n\tfileName: string;\n\tmimeType: string;\n\tcontentBase64: string;\n\tsize?: number;\n\textractedText?: string;\n} | null {\n\tconst messages = Array.isArray(session.messages) ? session.messages : [];\n\tfor (const msg of messages) {\n\t\tif (!msg || typeof msg !== \"object\") continue;\n\t\tconst maybeAttachments = (msg as { attachments?: unknown }).attachments;\n\t\tif (!Array.isArray(maybeAttachments)) continue;\n\n\t\tfor (const att of maybeAttachments) {\n\t\t\tif (!att || typeof att !== \"object\") continue;\n\t\t\tconst a = att as {\n\t\t\t\tid?: unknown;\n\t\t\t\tfileName?: unknown;\n\t\t\t\tmimeType?: unknown;\n\t\t\t\tcontent?: unknown;\n\t\t\t\tsize?: unknown;\n\t\t\t\textractedText?: unknown;\n\t\t\t};\n\t\t\tif (a.id !== attachmentId) continue;\n\t\t\tif (typeof a.fileName !== \"string\" || !a.fileName) return null;\n\t\t\tif (typeof a.mimeType !== \"string\" || !a.mimeType) return null;\n\t\t\tif (typeof a.content !== \"string\" || !a.content) return null;\n\t\t\treturn {\n\t\t\t\tfileName: a.fileName,\n\t\t\t\tmimeType: a.mimeType,\n\t\t\t\tcontentBase64: a.content,\n\t\t\t\tsize:\n\t\t\t\t\ttypeof a.size === \"number\" && Number.isFinite(a.size)\n\t\t\t\t\t\t? a.size\n\t\t\t\t\t\t: undefined,\n\t\t\t\textractedText:\n\t\t\t\t\ttypeof a.extractedText === \"string\" && a.extractedText.length > 0\n\t\t\t\t\t\t? a.extractedText\n\t\t\t\t\t\t: undefined,\n\t\t\t};\n\t\t}\n\t}\n\treturn null;\n}\n\nexport async function handleSessionAttachment(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tparams: { id: string; attachmentId: string },\n\tcors: Record<string, string>,\n) {\n\tconst sessionManager = createWebSessionManagerForRequest(req, true);\n\n\ttry {\n\t\tif (req.method !== \"GET\") {\n\t\t\tsendJson(res, 405, { error: \"Method not allowed\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = params.id;\n\t\tconst attachmentId = params.attachmentId;\n\n\t\tif (!sessionIdPattern.test(sessionId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid session id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\t\tif (!attachmentIdPattern.test(attachmentId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid attachment id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst session = await sessionManager.loadSession(sessionId);\n\t\tif (!session) {\n\t\t\tsendJson(res, 404, { error: \"Session not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst attachment = findAttachmentInSession(session, attachmentId);\n\t\tif (!attachment) {\n\t\t\tsendJson(res, 404, { error: \"Attachment not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst bytes = Buffer.from(attachment.contentBase64, \"base64\");\n\n\t\tconst requestUrl = new URL(req.url || \"/\", \"http://localhost\");\n\t\tconst download = requestUrl.searchParams.get(\"download\");\n\t\tconst shouldDownload = download === \"1\" || download === \"true\";\n\n\t\tres.writeHead(200, {\n\t\t\t\"Content-Type\": attachment.mimeType,\n\t\t\t\"Content-Length\": bytes.length,\n\t\t\t\"Cache-Control\": \"private, max-age=3600\",\n\t\t\t...(shouldDownload\n\t\t\t\t? {\n\t\t\t\t\t\t\"Content-Disposition\": buildContentDisposition(attachment.fileName),\n\t\t\t\t\t}\n\t\t\t\t: {}),\n\t\t\t...cors,\n\t\t});\n\t\tres.end(bytes);\n\t} catch (error) {\n\t\trespondWithApiError(res, error, 500, cors, req);\n\t}\n}\n\nexport async function handleSessionAttachmentExtract(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tparams: { id: string; attachmentId: string },\n\tcors: Record<string, string>,\n) {\n\tconst sessionManager = createWebSessionManagerForRequest(req, true);\n\n\ttry {\n\t\tif (req.method !== \"POST\") {\n\t\t\tsendJson(res, 405, { error: \"Method not allowed\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = params.id;\n\t\tconst attachmentId = params.attachmentId;\n\n\t\tif (!sessionIdPattern.test(sessionId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid session id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\t\tif (!attachmentIdPattern.test(attachmentId)) {\n\t\t\tsendJson(res, 400, { error: \"Invalid attachment id\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst requestUrl = new URL(req.url || \"/\", \"http://localhost\");\n\t\tconst force = requestUrl.searchParams.get(\"force\");\n\t\tconst shouldForce = force === \"1\" || force === \"true\";\n\n\t\tconst session = await sessionManager.loadSession(sessionId);\n\t\tif (!session) {\n\t\t\tsendJson(res, 404, { error: \"Session not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tconst attachment = findAttachmentInSession(session, attachmentId);\n\t\tif (!attachment) {\n\t\t\tsendJson(res, 404, { error: \"Attachment not found\" }, cors, req);\n\t\t\treturn;\n\t\t}\n\n\t\tif (attachment.extractedText && !shouldForce) {\n\t\t\tsendJson(\n\t\t\t\tres,\n\t\t\t\t200,\n\t\t\t\t{\n\t\t\t\t\tfileName: attachment.fileName,\n\t\t\t\t\tformat: \"unknown\",\n\t\t\t\t\tsize: attachment.size ?? 0,\n\t\t\t\t\ttruncated: false,\n\t\t\t\t\textractedText: attachment.extractedText,\n\t\t\t\t\tcached: true,\n\t\t\t\t},\n\t\t\t\tcors,\n\t\t\t\treq,\n\t\t\t);\n\t\t\treturn;\n\t\t}\n\n\t\tconst bytes = Buffer.from(attachment.contentBase64, \"base64\");\n\t\tconst extracted = await extractDocumentText({\n\t\t\tbuffer: bytes,\n\t\t\tfileName: attachment.fileName,\n\t\t\tmimeType: attachment.mimeType,\n\t\t});\n\n\t\tconst sessionFile = sessionManager.getSessionFileById(sessionId);\n\t\tif (sessionFile && typeof extracted.extractedText === \"string\") {\n\t\t\ttry {\n\t\t\t\tsessionManager.saveAttachmentExtraction(\n\t\t\t\t\tsessionFile,\n\t\t\t\t\tattachmentId,\n\t\t\t\t\textracted.extractedText,\n\t\t\t\t);\n\t\t\t} catch {\n\t\t\t\t// ignore persistence errors; extraction result still returned\n\t\t\t}\n\t\t}\n\n\t\tsendJson(\n\t\t\tres,\n\t\t\t200,\n\t\t\t{\n\t\t\t\tfileName: attachment.fileName,\n\t\t\t\tformat: extracted.format,\n\t\t\t\tsize: extracted.sizeBytes,\n\t\t\t\ttruncated: extracted.truncated,\n\t\t\t\textractedText: extracted.extractedText,\n\t\t\t},\n\t\t\tcors,\n\t\t\treq,\n\t\t);\n\t} catch (error) {\n\t\trespondWithApiError(res, error, 500, cors, req);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
|
+
import type { HostedRunnerContext } from "../app-context.js";
|
|
3
|
+
interface SessionTimelineParams {
|
|
4
|
+
id?: string;
|
|
5
|
+
}
|
|
6
|
+
interface SessionTimelineOptions {
|
|
7
|
+
hostedRunner?: HostedRunnerContext;
|
|
8
|
+
}
|
|
9
|
+
export declare function handleSessionTimeline(req: IncomingMessage, res: ServerResponse, params: SessionTimelineParams, cors: Record<string, string>, options?: SessionTimelineOptions): Promise<void>;
|
|
10
|
+
export {};
|
|
11
|
+
//# sourceMappingURL=session-timeline.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-timeline.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/session-timeline.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAIjE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAQ7D,UAAU,qBAAqB;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AAED,UAAU,sBAAsB;IAC/B,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACnC;AA8CD,wBAAsB,qBAAqB,CAC1C,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE,qBAAqB,EAC7B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAC5B,OAAO,CAAC,EAAE,sBAAsB,GAC9B,OAAO,CAAC,IAAI,CAAC,CAgDf"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { tryListMaestroTimelineWithPlatform } from "../../platform/maestro-timeline-client.js";
|
|
2
|
+
import { safeReadSessionEntries } from "../../session/session-context.js";
|
|
3
|
+
import { getAuthSubject } from "../authz.js";
|
|
4
|
+
import { getPendingComposerRequests } from "../pending-request-payload.js";
|
|
5
|
+
import { ApiError, respondWithApiError, sendJson } from "../server-utils.js";
|
|
6
|
+
import { createWebSessionManagerForRequest } from "../session-scope.js";
|
|
7
|
+
import { buildComposerRunTimeline } from "../session-timeline.js";
|
|
8
|
+
import { sessionIdPattern, verifySessionOwnership } from "./sessions.js";
|
|
9
|
+
function requireSessionId(params) {
|
|
10
|
+
const sessionId = params.id?.trim();
|
|
11
|
+
if (!sessionId || !sessionIdPattern.test(sessionId)) {
|
|
12
|
+
throw new ApiError(400, "Invalid session id");
|
|
13
|
+
}
|
|
14
|
+
return sessionId;
|
|
15
|
+
}
|
|
16
|
+
function hostedRunnerMatchesSession(hostedRunner, sessionId) {
|
|
17
|
+
if (!hostedRunner?.enabled) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const activeSessionId = hostedRunner.activeMaestroSessionId ??
|
|
21
|
+
hostedRunner.configuredMaestroSessionId;
|
|
22
|
+
return activeSessionId === sessionId;
|
|
23
|
+
}
|
|
24
|
+
async function tryBuildPlatformTimeline(sessionId, pendingRequestCount, options) {
|
|
25
|
+
const hostedRunner = options?.hostedRunner;
|
|
26
|
+
if (!hostedRunnerMatchesSession(hostedRunner, sessionId)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const agentRunId = hostedRunner?.agentRunId;
|
|
30
|
+
const remoteRunnerSessionId = hostedRunner?.runnerSessionId;
|
|
31
|
+
if (!agentRunId && !remoteRunnerSessionId) {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
return await tryListMaestroTimelineWithPlatform({
|
|
35
|
+
sessionId,
|
|
36
|
+
agentRunId,
|
|
37
|
+
remoteRunnerSessionId,
|
|
38
|
+
workspaceId: hostedRunner?.workspaceId,
|
|
39
|
+
pendingRequestCount,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
export async function handleSessionTimeline(req, res, params, cors, options) {
|
|
43
|
+
try {
|
|
44
|
+
if (req.method !== "GET") {
|
|
45
|
+
res.writeHead(405, cors);
|
|
46
|
+
res.end();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const sessionId = requireSessionId(params);
|
|
50
|
+
const sessionManager = createWebSessionManagerForRequest(req, true);
|
|
51
|
+
const session = await sessionManager.loadSession(sessionId);
|
|
52
|
+
if (!session) {
|
|
53
|
+
throw new ApiError(404, "Session not found");
|
|
54
|
+
}
|
|
55
|
+
const subject = getAuthSubject(req);
|
|
56
|
+
if (!verifySessionOwnership(session, subject)) {
|
|
57
|
+
throw new ApiError(403, "Access denied: session belongs to another user");
|
|
58
|
+
}
|
|
59
|
+
const sessionPath = sessionManager.getSessionFileById(sessionId);
|
|
60
|
+
const entries = sessionPath ? safeReadSessionEntries(sessionPath) : [];
|
|
61
|
+
const pendingRequests = getPendingComposerRequests(session.id);
|
|
62
|
+
const responseBody = (await tryBuildPlatformTimeline(session.id, pendingRequests.length, options)) ??
|
|
63
|
+
buildComposerRunTimeline({
|
|
64
|
+
sessionId: session.id,
|
|
65
|
+
entries,
|
|
66
|
+
messages: session.messages || [],
|
|
67
|
+
pendingRequests,
|
|
68
|
+
});
|
|
69
|
+
sendJson(res, 200, responseBody, cors, req);
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
if (!respondWithApiError(res, error, 500, cors, req)) {
|
|
73
|
+
sendJson(res, 500, { error: "Failed to load session timeline" }, cors, req);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=session-timeline.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-timeline.js","sourceRoot":"","sources":["../../../src/server/handlers/session-timeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,kCAAkC,EAAE,MAAM,2CAA2C,CAAC;AAC/F,OAAO,EAAE,sBAAsB,EAAE,MAAM,kCAAkC,CAAC;AAE1E,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAE,0BAA0B,EAAE,MAAM,+BAA+B,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,EAAE,iCAAiC,EAAE,MAAM,qBAAqB,CAAC;AACxE,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,eAAe,CAAC;AAUzE,SAAS,gBAAgB,CAAC,MAA6B;IACtD,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,EAAE,IAAI,EAAE,CAAC;IACpC,IAAI,CAAC,SAAS,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,CAAC;QACrD,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,oBAAoB,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,SAAS,CAAC;AAClB,CAAC;AAED,SAAS,0BAA0B,CAClC,YAA6C,EAC7C,SAAiB;IAEjB,IAAI,CAAC,YAAY,EAAE,OAAO,EAAE,CAAC;QAC5B,OAAO,KAAK,CAAC;IACd,CAAC;IACD,MAAM,eAAe,GACpB,YAAY,CAAC,sBAAsB;QACnC,YAAY,CAAC,0BAA0B,CAAC;IACzC,OAAO,eAAe,KAAK,SAAS,CAAC;AACtC,CAAC;AAED,KAAK,UA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sBAAsB,CAAC,OAAO,EAAE,OAAO,CAAC,EAAE,CAAC;YAC/C,MAAM,IAAI,QAAQ,CAAC,GAAG,EAAE,gDAAgD,CAAC,CAAC;QAC3E,CAAC;QAED,MAAM,WAAW,GAAG,cAAc,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC;QACjE,MAAM,OAAO,GAAG,WAAW,CAAC,CAAC,CAAC,sBAAsB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;QACvE,MAAM,eAAe,GAAG,0BAA0B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;QAC/D,MAAM,YAAY,GACjB,CAAC,MAAM,wBAAwB,CAC9B,OAAO,CAAC,EAAE,EACV,eAAe,CAAC,MAAM,EACtB,OAAO,CACP,CAAC;YACF,wBAAwB,CAAC;gBACxB,SAAS,EAAE,OAAO,CAAC,EAAE;gBACrB,OAAO;gBACP,QAAQ,EAAE,OAAO,CAAC,QAAQ,IAAI,EAAE;gBAChC,eAAe;aACf,CAAC,CAAC;QAEJ,QAAQ,CAAC,GAAG,EAAE,GAAG,EAAE,YAAY,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;IAC7C,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QAChB,IAAI,CAAC,mBAAmB,CAAC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,CAAC;YACtD,QAAQ,CACP,GAAG,EACH,GAAG,EACH,EAAE,KAAK,EAAE,iCAAiC,EAAE,EAC5C,IAAI,EACJ,GAAG,CACH,CAAC;QACH,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["import type { IncomingMessage, ServerResponse } from \"node:http\";\nimport type { ComposerRunTimelineResponse } from \"@evalops/contracts\";\nimport { tryListMaestroTimelineWithPlatform } from \"../../platform/maestro-timeline-client.js\";\nimport { safeReadSessionEntries } from \"../../session/session-context.js\";\nimport type { HostedRunnerContext } from \"../app-context.js\";\nimport { getAuthSubject } from \"../authz.js\";\nimport { getPendingComposerRequests } from \"../pending-request-payload.js\";\nimport { ApiError, respondWithApiError, sendJson } from \"../server-utils.js\";\nimport { createWebSessionManagerForRequest } from \"../session-scope.js\";\nimport { buildComposerRunTimeline } from \"../session-timeline.js\";\nimport { sessionIdPattern, verifySessionOwnership } from \"./sessions.js\";\n\ninterface SessionTimelineParams {\n\tid?: string;\n}\n\ninterface SessionTimelineOptions {\n\thostedRunner?: HostedRunnerContext;\n}\n\nfunction requireSessionId(params: SessionTimelineParams): string {\n\tconst sessionId = params.id?.trim();\n\tif (!sessionId || !sessionIdPattern.test(sessionId)) {\n\t\tthrow new ApiError(400, \"Invalid session id\");\n\t}\n\treturn sessionId;\n}\n\nfunction hostedRunnerMatchesSession(\n\thostedRunner: HostedRunnerContext | undefined,\n\tsessionId: string,\n): boolean {\n\tif (!hostedRunner?.enabled) {\n\t\treturn false;\n\t}\n\tconst activeSessionId =\n\t\thostedRunner.activeMaestroSessionId ??\n\t\thostedRunner.configuredMaestroSessionId;\n\treturn activeSessionId === sessionId;\n}\n\nasync function tryBuildPlatformTimeline(\n\tsessionId: string,\n\tpendingRequestCount: number,\n\toptions: SessionTimelineOptions | undefined,\n): Promise<ComposerRunTimelineResponse | null> {\n\tconst hostedRunner = options?.hostedRunner;\n\tif (!hostedRunnerMatchesSession(hostedRunner, sessionId)) {\n\t\treturn null;\n\t}\n\tconst agentRunId = hostedRunner?.agentRunId;\n\tconst remoteRunnerSessionId = hostedRunner?.runnerSessionId;\n\tif (!agentRunId && !remoteRunnerSessionId) {\n\t\treturn null;\n\t}\n\treturn await tryListMaestroTimelineWithPlatform({\n\t\tsessionId,\n\t\tagentRunId,\n\t\tremoteRunnerSessionId,\n\t\tworkspaceId: hostedRunner?.workspaceId,\n\t\tpendingRequestCount,\n\t});\n}\n\nexport async function handleSessionTimeline(\n\treq: IncomingMessage,\n\tres: ServerResponse,\n\tparams: SessionTimelineParams,\n\tcors: Record<string, string>,\n\toptions?: SessionTimelineOptions,\n): Promise<void> {\n\ttry {\n\t\tif (req.method !== \"GET\") {\n\t\t\tres.writeHead(405, cors);\n\t\t\tres.end();\n\t\t\treturn;\n\t\t}\n\n\t\tconst sessionId = requireSessionId(params);\n\t\tconst sessionManager = createWebSessionManagerForRequest(req, true);\n\t\tconst session = await sessionManager.loadSession(sessionId);\n\t\tif (!session) {\n\t\t\tthrow new ApiError(404, \"Session not found\");\n\t\t}\n\n\t\tconst subject = getAuthSubject(req);\n\t\tif (!verifySessionOwnership(session, subject)) {\n\t\t\tthrow new ApiError(403, \"Access denied: session belongs to another user\");\n\t\t}\n\n\t\tconst sessionPath = sessionManager.getSessionFileById(sessionId);\n\t\tconst entries = sessionPath ? safeReadSessionEntries(sessionPath) : [];\n\t\tconst pendingRequests = getPendingComposerRequests(session.id);\n\t\tconst responseBody: ComposerRunTimelineResponse =\n\t\t\t(await tryBuildPlatformTimeline(\n\t\t\t\tsession.id,\n\t\t\t\tpendingRequests.length,\n\t\t\t\toptions,\n\t\t\t)) ??\n\t\t\tbuildComposerRunTimeline({\n\t\t\t\tsessionId: session.id,\n\t\t\t\tentries,\n\t\t\t\tmessages: session.messages || [],\n\t\t\t\tpendingRequests,\n\t\t\t});\n\n\t\tsendJson(res, 200, responseBody, cors, req);\n\t} catch (error) {\n\t\tif (!respondWithApiError(res, error, 500, cors, req)) {\n\t\t\tsendJson(\n\t\t\t\tres,\n\t\t\t\t500,\n\t\t\t\t{ error: \"Failed to load session timeline\" },\n\t\t\t\tcors,\n\t\t\t\treq,\n\t\t\t);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
import type { IncomingMessage, ServerResponse } from "node:http";
|
|
2
2
|
export { checkShareRateLimit, resetShareRateLimit, stopShareRateLimiter, } from "./session-share-store.js";
|
|
3
3
|
export type { SessionExportFormat, SessionShareOptions, SessionUpdateBody, } from "./session-share-store.js";
|
|
4
|
+
export declare const sessionIdPattern: RegExp;
|
|
5
|
+
/**
|
|
6
|
+
* Verify that the authenticated subject has access to the session.
|
|
7
|
+
* Prevents IDOR attacks by checking session ownership fields.
|
|
8
|
+
*
|
|
9
|
+
* Returns true if access is allowed, false otherwise.
|
|
10
|
+
*/
|
|
11
|
+
export declare function verifySessionOwnership(session: {
|
|
12
|
+
owner?: unknown;
|
|
13
|
+
subject?: unknown;
|
|
14
|
+
}, subject: string): boolean;
|
|
4
15
|
/**
|
|
5
16
|
* Handle session list and CRUD operations
|
|
6
17
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/sessions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"sessions.d.ts","sourceRoot":"","sources":["../../../src/server/handlers/sessions.ts"],"names":[],"mappings":"AAsCA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AA4CjE,OAAO,EACN,mBAAmB,EACnB,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,0BAA0B,CAAC;AAClC,YAAY,EACX,mBAAmB,EACnB,mBAAmB,EACnB,iBAAiB,GACjB,MAAM,0BAA0B,CAAC;AAGlC,eAAO,MAAM,gBAAgB,QAAsB,CAAC;AAuBpD;;;;;GAKG;AACH,wBAAgB,sBAAsB,CACrC,OAAO,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAC;IAAC,OAAO,CAAC,EAAE,OAAO,CAAA;CAAE,EAC/C,OAAO,EAAE,MAAM,GACb,OAAO,CAiBT;AAyGD;;GAEG;AACH,wBAAsB,cAAc,CACnC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;IAAE,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,EACvB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBA4N5B;AAED;;GAEG;AACH,wBAAsB,kBAAkB,CACvC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAiG5B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,EACzB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBA8C5B;AAED;;;;;;GAMG;AACH,wBAAsB,6BAA6B,CAClD,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,EAAE,MAAM,CAAA;CAAE,EAC/C,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBA4D5B;AAED;;GAEG;AACH,wBAAsB,mBAAmB,CACxC,GAAG,EAAE,eAAe,EACpB,GAAG,EAAE,cAAc,EACnB,MAAM,EAAE;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,EACtB,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,iBAyI5B"}
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* |--------|------|-------------|
|
|
11
11
|
* | GET | `/api/sessions` | List all sessions with pagination |
|
|
12
12
|
* | GET | `/api/sessions/:id` | Get a specific session with messages |
|
|
13
|
+
* | GET | `/api/sessions/:id/timeline` | Get a redacted run timeline |
|
|
13
14
|
* | POST | `/api/sessions` | Create a new session |
|
|
14
15
|
* | PATCH | `/api/sessions/:id` | Update session metadata (title, tags, favorite) |
|
|
15
16
|
* | DELETE | `/api/sessions/:id` | Delete a session |
|
|
@@ -37,80 +38,21 @@ import crypto from "node:crypto";
|
|
|
37
38
|
import { readFileSync } from "node:fs";
|
|
38
39
|
import { scanOutboundSensitiveContent, summarizeOutboundSensitiveFindings, } from "../../safety/outbound-secret-preflight.js";
|
|
39
40
|
import { safeReadSessionEntries } from "../../session/session-context.js";
|
|
41
|
+
import { recordMaestroSessionEvent } from "../../telemetry/maestro-event-bus.js";
|
|
40
42
|
import { createLogger } from "../../utils/logger.js";
|
|
41
43
|
import { getAuthSubject } from "../authz.js";
|
|
42
|
-
import {
|
|
44
|
+
import { isHostedSessionManager } from "../hosted-session-manager.js";
|
|
45
|
+
import { getPendingServerRequestPayload } from "../pending-request-payload.js";
|
|
43
46
|
import { buildContentDisposition, readJsonBody, respondWithApiError, sendJson, } from "../server-utils.js";
|
|
44
|
-
import {
|
|
47
|
+
import { webSessionEventEnv } from "../session-event-env.js";
|
|
48
|
+
import { createWebSessionManagerForRequest, createWebSessionManagerForScope, decodeScopedSessionId, encodeScopedSessionId, resolveSessionScope, } from "../session-scope.js";
|
|
45
49
|
import { convertAppMessagesToComposer } from "../session-serialization.js";
|
|
46
50
|
import { exportToMarkdown, exportToText } from "./session-export-formatters.js";
|
|
47
51
|
import { checkShareRateLimit, createSharedSessionInDb, deleteExpiredShares, deleteShareByToken, tryAccessShare, } from "./session-share-store.js";
|
|
48
52
|
export { checkShareRateLimit, resetShareRateLimit, stopShareRateLimiter, } from "./session-share-store.js";
|
|
49
53
|
const logger = createLogger("sessions-handler");
|
|
50
|
-
const sessionIdPattern = /^[a-zA-Z0-9._-]+$/;
|
|
54
|
+
export const sessionIdPattern = /^[a-zA-Z0-9._-]+$/;
|
|
51
55
|
const attachmentIdPattern = /^[a-zA-Z0-9._-]+$/;
|
|
52
|
-
function getPendingServerRequestPayload(sessionId) {
|
|
53
|
-
const pending = serverRequestManager.listPending({ sessionId });
|
|
54
|
-
const pendingApprovalRequests = pending
|
|
55
|
-
.filter((entry) => entry.kind === "approval")
|
|
56
|
-
.map((entry) => ({
|
|
57
|
-
id: entry.id,
|
|
58
|
-
toolName: entry.toolName,
|
|
59
|
-
displayName: entry.displayName,
|
|
60
|
-
summaryLabel: entry.summaryLabel,
|
|
61
|
-
actionDescription: entry.actionDescription,
|
|
62
|
-
args: entry.args,
|
|
63
|
-
reason: entry.reason,
|
|
64
|
-
}));
|
|
65
|
-
const pendingClientToolRequests = pending
|
|
66
|
-
.filter((entry) => entry.kind === "client_tool" ||
|
|
67
|
-
entry.kind === "mcp_elicitation" ||
|
|
68
|
-
entry.kind === "user_input")
|
|
69
|
-
.map((entry) => ({
|
|
70
|
-
toolCallId: entry.callId,
|
|
71
|
-
toolName: entry.toolName,
|
|
72
|
-
args: entry.args,
|
|
73
|
-
kind: entry.kind,
|
|
74
|
-
reason: entry.reason,
|
|
75
|
-
}));
|
|
76
|
-
const pendingToolRetryRequests = pending
|
|
77
|
-
.filter((entry) => entry.kind === "tool_retry")
|
|
78
|
-
.map((entry) => {
|
|
79
|
-
const args = entry.args &&
|
|
80
|
-
typeof entry.args === "object" &&
|
|
81
|
-
!Array.isArray(entry.args)
|
|
82
|
-
? entry.args
|
|
83
|
-
: {};
|
|
84
|
-
return {
|
|
85
|
-
id: entry.id,
|
|
86
|
-
toolCallId: typeof args.tool_call_id === "string"
|
|
87
|
-
? args.tool_call_id
|
|
88
|
-
: entry.callId,
|
|
89
|
-
toolName: entry.toolName,
|
|
90
|
-
args: args.args,
|
|
91
|
-
errorMessage: typeof args.error_message === "string"
|
|
92
|
-
? args.error_message
|
|
93
|
-
: entry.reason,
|
|
94
|
-
attempt: typeof args.attempt === "number" && Number.isFinite(args.attempt)
|
|
95
|
-
? args.attempt
|
|
96
|
-
: 1,
|
|
97
|
-
maxAttempts: typeof args.max_attempts === "number" &&
|
|
98
|
-
Number.isFinite(args.max_attempts)
|
|
99
|
-
? args.max_attempts
|
|
100
|
-
: undefined,
|
|
101
|
-
summary: typeof args.summary === "string" ? args.summary : undefined,
|
|
102
|
-
};
|
|
103
|
-
});
|
|
104
|
-
return {
|
|
105
|
-
...(pendingApprovalRequests.length > 0 ? { pendingApprovalRequests } : {}),
|
|
106
|
-
...(pendingClientToolRequests.length > 0
|
|
107
|
-
? { pendingClientToolRequests }
|
|
108
|
-
: {}),
|
|
109
|
-
...(pendingToolRetryRequests.length > 0
|
|
110
|
-
? { pendingToolRetryRequests }
|
|
111
|
-
: {}),
|
|
112
|
-
};
|
|
113
|
-
}
|
|
114
56
|
function sendSensitiveContentBlockedResponse(req, res, cors, action, findings) {
|
|
115
57
|
sendJson(res, 409, {
|
|
116
58
|
error: `Sensitive content detected. Review and confirm before continuing with this ${action}.`,
|
|
@@ -124,7 +66,7 @@ function sendSensitiveContentBlockedResponse(req, res, cors, action, findings) {
|
|
|
124
66
|
*
|
|
125
67
|
* Returns true if access is allowed, false otherwise.
|
|
126
68
|
*/
|
|
127
|
-
function verifySessionOwnership(session, subject) {
|
|
69
|
+
export function verifySessionOwnership(session, subject) {
|
|
128
70
|
// Check explicit owner field
|
|
129
71
|
if (typeof session.owner === "string" && session.owner) {
|
|
130
72
|
return session.owner === subject;
|
|
@@ -209,7 +151,7 @@ async function resolveSharedSessionAccess(req, res, shareToken, cors) {
|
|
|
209
151
|
* Handle session list and CRUD operations
|
|
210
152
|
*/
|
|
211
153
|
export async function handleSessions(req, res, params, cors) {
|
|
212
|
-
const sessionManager =
|
|
154
|
+
const sessionManager = createWebSessionManagerForRequest(req, true);
|
|
213
155
|
const sessionId = params.id;
|
|
214
156
|
const url = new URL(req.url || "/api/sessions", "http://localhost");
|
|
215
157
|
const limitParam = url.searchParams.get("limit");
|
|
@@ -312,20 +254,25 @@ export async function handleSessions(req, res, params, cors) {
|
|
|
312
254
|
sendJson(res, 403, { error: "Access denied: session belongs to another user" }, cors, req);
|
|
313
255
|
return;
|
|
314
256
|
}
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
sendJson(res, 404, { error: "Session file not found" }, cors, req);
|
|
318
|
-
return;
|
|
319
|
-
}
|
|
320
|
-
// Apply updates - SessionManager supports favorite, title, and tags via meta entries
|
|
321
|
-
if (updates.favorite !== undefined) {
|
|
322
|
-
sessionManager.setSessionFavorite(sessionPath, updates.favorite);
|
|
323
|
-
}
|
|
324
|
-
if (updates.title !== undefined) {
|
|
325
|
-
sessionManager.setSessionTitle(sessionPath, updates.title);
|
|
257
|
+
if (isHostedSessionManager(sessionManager)) {
|
|
258
|
+
await sessionManager.updateSessionMetadata(sessionId, updates);
|
|
326
259
|
}
|
|
327
|
-
|
|
328
|
-
sessionManager.
|
|
260
|
+
else {
|
|
261
|
+
const sessionPath = sessionManager.getSessionFileById(sessionId);
|
|
262
|
+
if (!sessionPath) {
|
|
263
|
+
sendJson(res, 404, { error: "Session file not found" }, cors, req);
|
|
264
|
+
return;
|
|
265
|
+
}
|
|
266
|
+
// Apply updates - SessionManager supports favorite, title, and tags via meta entries
|
|
267
|
+
if (updates.favorite !== undefined) {
|
|
268
|
+
sessionManager.setSessionFavorite(sessionPath, updates.favorite);
|
|
269
|
+
}
|
|
270
|
+
if (updates.title !== undefined) {
|
|
271
|
+
sessionManager.setSessionTitle(sessionPath, updates.title);
|
|
272
|
+
}
|
|
273
|
+
if (updates.tags !== undefined) {
|
|
274
|
+
sessionManager.setSessionTags(sessionPath, updates.tags);
|
|
275
|
+
}
|
|
329
276
|
}
|
|
330
277
|
// Return the updated values directly (writes are applied synchronously to the file)
|
|
331
278
|
sendJson(res, 200, {
|
|
@@ -356,6 +303,14 @@ export async function handleSessions(req, res, params, cors) {
|
|
|
356
303
|
return;
|
|
357
304
|
}
|
|
358
305
|
await sessionManager.deleteSession(sessionId);
|
|
306
|
+
recordMaestroSessionEvent("MAESTRO_SESSION_STATE_CLOSED", {
|
|
307
|
+
sessionId,
|
|
308
|
+
closeReason: "MAESTRO_CLOSE_REASON_USER_STOPPED",
|
|
309
|
+
closeMessage: "Web session deleted",
|
|
310
|
+
correlation: { principal_id: subject },
|
|
311
|
+
env: webSessionEventEnv(),
|
|
312
|
+
metadata: { operation: "session.delete" },
|
|
313
|
+
});
|
|
359
314
|
res.writeHead(204, cors);
|
|
360
315
|
res.end();
|
|
361
316
|
}
|
|
@@ -375,7 +330,7 @@ export async function handleSessions(req, res, params, cors) {
|
|
|
375
330
|
* Handle session sharing - generate a shareable link
|
|
376
331
|
*/
|
|
377
332
|
export async function handleSessionShare(req, res, params, cors) {
|
|
378
|
-
const sessionManager =
|
|
333
|
+
const sessionManager = createWebSessionManagerForRequest(req, true);
|
|
379
334
|
const sessionId = params.id;
|
|
380
335
|
try {
|
|
381
336
|
if (req.method !== "POST") {
|
|
@@ -450,7 +405,7 @@ export async function handleSharedSession(req, res, params, cors) {
|
|
|
450
405
|
return;
|
|
451
406
|
}
|
|
452
407
|
const { scope, sessionId } = decodeScopedSessionId(resolvedSessionId);
|
|
453
|
-
const sessionManager =
|
|
408
|
+
const sessionManager = createWebSessionManagerForScope(scope, true);
|
|
454
409
|
const session = await sessionManager.loadSession(sessionId);
|
|
455
410
|
if (!session) {
|
|
456
411
|
sendJson(res, 404, { error: "Session not found" }, cors, req);
|
|
@@ -499,7 +454,7 @@ export async function handleSharedSessionAttachment(req, res, params, cors) {
|
|
|
499
454
|
return;
|
|
500
455
|
}
|
|
501
456
|
const { scope, sessionId } = decodeScopedSessionId(resolvedSessionId);
|
|
502
|
-
const sessionManager =
|
|
457
|
+
const sessionManager = createWebSessionManagerForScope(scope, true);
|
|
503
458
|
const session = await sessionManager.loadSession(sessionId);
|
|
504
459
|
if (!session) {
|
|
505
460
|
sendJson(res, 404, { error: "Session not found" }, cors, req);
|
|
@@ -535,7 +490,7 @@ export async function handleSharedSessionAttachment(req, res, params, cors) {
|
|
|
535
490
|
* Handle session export
|
|
536
491
|
*/
|
|
537
492
|
export async function handleSessionExport(req, res, params, cors) {
|
|
538
|
-
const sessionManager =
|
|
493
|
+
const sessionManager = createWebSessionManagerForRequest(req, true);
|
|
539
494
|
const sessionId = params.id;
|
|
540
495
|
try {
|
|
541
496
|
if (req.method !== "POST") {
|
|
@@ -560,23 +515,32 @@ export async function handleSessionExport(req, res, params, cors) {
|
|
|
560
515
|
const options = await readJsonBody(req);
|
|
561
516
|
const format = options.format || "json";
|
|
562
517
|
const messages = session.messages || [];
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
518
|
+
let jsonlEntries = undefined;
|
|
519
|
+
let jsonlSessionFile = null;
|
|
520
|
+
if (format === "jsonl") {
|
|
521
|
+
if (isHostedSessionManager(sessionManager)) {
|
|
522
|
+
jsonlEntries = await sessionManager.loadEntries(sessionId);
|
|
523
|
+
if (!jsonlEntries) {
|
|
524
|
+
sendJson(res, 404, { error: "Session not found" }, cors, req);
|
|
525
|
+
return;
|
|
526
|
+
}
|
|
527
|
+
}
|
|
528
|
+
else {
|
|
529
|
+
jsonlSessionFile = sessionManager.getSessionFileById(sessionId);
|
|
530
|
+
if (!jsonlSessionFile) {
|
|
567
531
|
sendJson(res, 404, { error: "Session file not found" }, cors, req);
|
|
568
|
-
return
|
|
532
|
+
return;
|
|
569
533
|
}
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
534
|
+
jsonlEntries = safeReadSessionEntries(jsonlSessionFile);
|
|
535
|
+
if (!jsonlEntries) {
|
|
536
|
+
return;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
575
539
|
}
|
|
576
540
|
if (!options.allowSensitiveContent) {
|
|
577
541
|
const scan = scanOutboundSensitiveContent({
|
|
578
542
|
title: session.title,
|
|
579
|
-
messages: format === "jsonl" ? jsonlEntries : messages,
|
|
543
|
+
messages: format === "jsonl" ? (jsonlEntries ?? []) : messages,
|
|
580
544
|
});
|
|
581
545
|
if (scan.blockingFindings.length > 0) {
|
|
582
546
|
sendSensitiveContentBlockedResponse(req, res, cors, "export", summarizeOutboundSensitiveFindings(scan.blockingFindings));
|
|
@@ -588,12 +552,16 @@ export async function handleSessionExport(req, res, params, cors) {
|
|
|
588
552
|
let filename;
|
|
589
553
|
switch (format) {
|
|
590
554
|
case "jsonl": {
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
555
|
+
if (isHostedSessionManager(sessionManager)) {
|
|
556
|
+
content = `${(jsonlEntries ?? []).map((entry) => JSON.stringify(entry)).join("\n")}\n`;
|
|
557
|
+
}
|
|
558
|
+
else {
|
|
559
|
+
if (!jsonlSessionFile) {
|
|
560
|
+
sendJson(res, 404, { error: "Session file not found" }, cors, req);
|
|
561
|
+
return;
|
|
562
|
+
}
|
|
563
|
+
content = readFileSync(jsonlSessionFile, "utf8");
|
|
595
564
|
}
|
|
596
|
-
content = readFileSync(sessionFile, "utf8");
|
|
597
565
|
contentType = "application/x-ndjson";
|
|
598
566
|
filename = `session-${sessionId}.jsonl`;
|
|
599
567
|
break;
|