yepanywhere 0.1.0
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/bundled/@yep-anywhere/shared/dist/app-types.d.ts +229 -0
- package/bundled/@yep-anywhere/shared/dist/app-types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/app-types.js +46 -0
- package/bundled/@yep-anywhere/shared/dist/app-types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.d.ts +16 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.js +17 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/DocumentContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.d.ts +15 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.js +10 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ImageContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.d.ts +6 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/TextContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.d.ts +7 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.js +7 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ThinkingContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.d.ts +24 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.js +13 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolResultContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.d.ts +8 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.js +8 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/content/ToolUseContentSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts +78 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.js +13 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/AssistantEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts +18 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js +19 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/BaseEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.d.ts +13 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.js +14 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/FileHistorySnapshotEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.d.ts +68 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.js +37 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/QueueOperationEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.d.ts +8 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.js +7 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SummaryEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts +52 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js +29 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/SystemEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts +72 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.js +10 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/UserEntrySchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.d.ts +14 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.js +39 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/entry/normalizeQueueOperationContent.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.d.ts +15 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js +26 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/guards.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts +566 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.js +39 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.d.ts +93 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.js +40 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/AssistantMessageSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.d.ts +105 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.js +20 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/message/UserMessageSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.d.ts +53 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.js +54 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/CommonToolSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.d.ts +9 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.js +9 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/StructuredPatchSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.d.ts +32 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.js +12 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/TodoSchema.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts +288 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js +293 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/ToolResultSchemas.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.d.ts +83 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.js +10 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/tool/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.d.ts +42 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.js +11 -0
- package/bundled/@yep-anywhere/shared/dist/claude-sdk-schema/types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/content.d.ts +99 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/content.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/content.js +64 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/content.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts +17 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js +17 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts +600 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js +282 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/session.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/types.d.ts +7 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/types.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/codex-schema/types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/dag.d.ts +35 -0
- package/bundled/@yep-anywhere/shared/dist/dag.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/dag.js +75 -0
- package/bundled/@yep-anywhere/shared/dist/dag.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/filePathDetection.d.ts +72 -0
- package/bundled/@yep-anywhere/shared/dist/filePathDetection.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/filePathDetection.js +376 -0
- package/bundled/@yep-anywhere/shared/dist/filePathDetection.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.d.ts +95 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.js +57 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/content.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.d.ts +174 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.js +117 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/events.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.d.ts +18 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.js +18 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.d.ts +267 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.js +147 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/session.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.d.ts +7 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/gemini-schema/types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.d.ts +30 -0
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.js +58 -0
- package/bundled/@yep-anywhere/shared/dist/ideMetadata.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/index.d.ts +24 -0
- package/bundled/@yep-anywhere/shared/dist/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/index.js +17 -0
- package/bundled/@yep-anywhere/shared/dist/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts +457 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js +217 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/events.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.d.ts +23 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.js +23 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.d.ts +149 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.js +158 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/session.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts +7 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/opencode-schema/types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/projectId.d.ts +48 -0
- package/bundled/@yep-anywhere/shared/dist/projectId.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/projectId.js +74 -0
- package/bundled/@yep-anywhere/shared/dist/projectId.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.d.ts +171 -0
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.js +189 -0
- package/bundled/@yep-anywhere/shared/dist/session/SessionView.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts +31 -0
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.js +2 -0
- package/bundled/@yep-anywhere/shared/dist/session/UnifiedSession.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/index.d.ts +3 -0
- package/bundled/@yep-anywhere/shared/dist/session/index.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/session/index.js +2 -0
- package/bundled/@yep-anywhere/shared/dist/session/index.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/types.d.ts +172 -0
- package/bundled/@yep-anywhere/shared/dist/types.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/types.js +33 -0
- package/bundled/@yep-anywhere/shared/dist/types.js.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/upload.d.ts +58 -0
- package/bundled/@yep-anywhere/shared/dist/upload.d.ts.map +1 -0
- package/bundled/@yep-anywhere/shared/dist/upload.js +6 -0
- package/bundled/@yep-anywhere/shared/dist/upload.js.map +1 -0
- package/bundled/@yep-anywhere/shared/package.json +7 -0
- package/client-dist/assets/index-C7DeAWG4.css +1 -0
- package/client-dist/assets/index-yX0HPwrz.js +147 -0
- package/client-dist/badge-96.png +0 -0
- package/client-dist/badge.svg +20 -0
- package/client-dist/debug-streaming.html +746 -0
- package/client-dist/favicon.ico +0 -0
- package/client-dist/icon-192.png +0 -0
- package/client-dist/icon-512.png +0 -0
- package/client-dist/icon.svg +27 -0
- package/client-dist/index.html +35 -0
- package/client-dist/manifest.json +23 -0
- package/client-dist/sw.js +482 -0
- package/dist/app.d.ts +67 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +236 -0
- package/dist/app.js.map +1 -0
- package/dist/augments/augment-generator.d.ts +30 -0
- package/dist/augments/augment-generator.d.ts.map +1 -0
- package/dist/augments/augment-generator.js +171 -0
- package/dist/augments/augment-generator.js.map +1 -0
- package/dist/augments/block-detector.d.ts +81 -0
- package/dist/augments/block-detector.d.ts.map +1 -0
- package/dist/augments/block-detector.js +615 -0
- package/dist/augments/block-detector.js.map +1 -0
- package/dist/augments/edit-augments.d.ts +138 -0
- package/dist/augments/edit-augments.d.ts.map +1 -0
- package/dist/augments/edit-augments.js +665 -0
- package/dist/augments/edit-augments.js.map +1 -0
- package/dist/augments/index.d.ts +14 -0
- package/dist/augments/index.d.ts.map +1 -0
- package/dist/augments/index.js +20 -0
- package/dist/augments/index.js.map +1 -0
- package/dist/augments/markdown-augments.d.ts +33 -0
- package/dist/augments/markdown-augments.d.ts.map +1 -0
- package/dist/augments/markdown-augments.js +128 -0
- package/dist/augments/markdown-augments.js.map +1 -0
- package/dist/augments/read-augments.d.ts +40 -0
- package/dist/augments/read-augments.d.ts.map +1 -0
- package/dist/augments/read-augments.js +64 -0
- package/dist/augments/read-augments.js.map +1 -0
- package/dist/augments/stream-coordinator.d.ts +32 -0
- package/dist/augments/stream-coordinator.d.ts.map +1 -0
- package/dist/augments/stream-coordinator.js +115 -0
- package/dist/augments/stream-coordinator.js.map +1 -0
- package/dist/augments/write-augments.d.ts +32 -0
- package/dist/augments/write-augments.d.ts.map +1 -0
- package/dist/augments/write-augments.js +27 -0
- package/dist/augments/write-augments.js.map +1 -0
- package/dist/auth/AuthService.d.ts +98 -0
- package/dist/auth/AuthService.d.ts.map +1 -0
- package/dist/auth/AuthService.js +217 -0
- package/dist/auth/AuthService.js.map +1 -0
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.d.ts.map +1 -0
- package/dist/auth/index.js +3 -0
- package/dist/auth/index.js.map +1 -0
- package/dist/auth/routes.d.ts +13 -0
- package/dist/auth/routes.d.ts.map +1 -0
- package/dist/auth/routes.js +149 -0
- package/dist/auth/routes.js.map +1 -0
- package/dist/cli.d.ts +19 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +152 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +76 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +124 -0
- package/dist/config.js.map +1 -0
- package/dist/dev-mock.d.ts +18 -0
- package/dist/dev-mock.d.ts.map +1 -0
- package/dist/dev-mock.js +260 -0
- package/dist/dev-mock.js.map +1 -0
- package/dist/frontend/index.d.ts +10 -0
- package/dist/frontend/index.d.ts.map +1 -0
- package/dist/frontend/index.js +10 -0
- package/dist/frontend/index.js.map +1 -0
- package/dist/frontend/proxy.d.ts +70 -0
- package/dist/frontend/proxy.d.ts.map +1 -0
- package/dist/frontend/proxy.js +329 -0
- package/dist/frontend/proxy.js.map +1 -0
- package/dist/frontend/static.d.ts +16 -0
- package/dist/frontend/static.d.ts.map +1 -0
- package/dist/frontend/static.js +106 -0
- package/dist/frontend/static.js.map +1 -0
- package/dist/highlighting/index.d.ts +43 -0
- package/dist/highlighting/index.d.ts.map +1 -0
- package/dist/highlighting/index.js +224 -0
- package/dist/highlighting/index.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +259 -0
- package/dist/index.js.map +1 -0
- package/dist/indexes/SessionIndexService.d.ts +106 -0
- package/dist/indexes/SessionIndexService.d.ts.map +1 -0
- package/dist/indexes/SessionIndexService.js +356 -0
- package/dist/indexes/SessionIndexService.js.map +1 -0
- package/dist/indexes/index.d.ts +3 -0
- package/dist/indexes/index.d.ts.map +1 -0
- package/dist/indexes/index.js +2 -0
- package/dist/indexes/index.js.map +1 -0
- package/dist/indexes/types.d.ts +55 -0
- package/dist/indexes/types.d.ts.map +1 -0
- package/dist/indexes/types.js +8 -0
- package/dist/indexes/types.js.map +1 -0
- package/dist/logging/index.d.ts +2 -0
- package/dist/logging/index.d.ts.map +1 -0
- package/dist/logging/index.js +2 -0
- package/dist/logging/index.js.map +1 -0
- package/dist/logging/logger.d.ts +81 -0
- package/dist/logging/logger.d.ts.map +1 -0
- package/dist/logging/logger.js +257 -0
- package/dist/logging/logger.js.map +1 -0
- package/dist/maintenance/debug-routes.d.ts +39 -0
- package/dist/maintenance/debug-routes.d.ts.map +1 -0
- package/dist/maintenance/debug-routes.js +561 -0
- package/dist/maintenance/debug-routes.js.map +1 -0
- package/dist/maintenance/index.d.ts +3 -0
- package/dist/maintenance/index.d.ts.map +1 -0
- package/dist/maintenance/index.js +3 -0
- package/dist/maintenance/index.js.map +1 -0
- package/dist/maintenance/server.d.ts +53 -0
- package/dist/maintenance/server.d.ts.map +1 -0
- package/dist/maintenance/server.js +419 -0
- package/dist/maintenance/server.js.map +1 -0
- package/dist/metadata/SessionMetadataService.d.ts +96 -0
- package/dist/metadata/SessionMetadataService.d.ts.map +1 -0
- package/dist/metadata/SessionMetadataService.js +209 -0
- package/dist/metadata/SessionMetadataService.js.map +1 -0
- package/dist/metadata/index.d.ts +2 -0
- package/dist/metadata/index.d.ts.map +1 -0
- package/dist/metadata/index.js +2 -0
- package/dist/metadata/index.js.map +1 -0
- package/dist/middleware/auth.d.ts +18 -0
- package/dist/middleware/auth.d.ts.map +1 -0
- package/dist/middleware/auth.js +53 -0
- package/dist/middleware/auth.js.map +1 -0
- package/dist/middleware/security.d.ts +4 -0
- package/dist/middleware/security.d.ts.map +1 -0
- package/dist/middleware/security.js +28 -0
- package/dist/middleware/security.js.map +1 -0
- package/dist/notifications/NotificationService.d.ts +76 -0
- package/dist/notifications/NotificationService.d.ts.map +1 -0
- package/dist/notifications/NotificationService.js +155 -0
- package/dist/notifications/NotificationService.js.map +1 -0
- package/dist/notifications/index.d.ts +2 -0
- package/dist/notifications/index.d.ts.map +1 -0
- package/dist/notifications/index.js +2 -0
- package/dist/notifications/index.js.map +1 -0
- package/dist/projects/codex-scanner.d.ts +52 -0
- package/dist/projects/codex-scanner.d.ts.map +1 -0
- package/dist/projects/codex-scanner.js +167 -0
- package/dist/projects/codex-scanner.js.map +1 -0
- package/dist/projects/gemini-project-map.d.ts +54 -0
- package/dist/projects/gemini-project-map.d.ts.map +1 -0
- package/dist/projects/gemini-project-map.js +116 -0
- package/dist/projects/gemini-project-map.js.map +1 -0
- package/dist/projects/gemini-scanner.d.ts +58 -0
- package/dist/projects/gemini-scanner.d.ts.map +1 -0
- package/dist/projects/gemini-scanner.js +210 -0
- package/dist/projects/gemini-scanner.js.map +1 -0
- package/dist/projects/index.d.ts +16 -0
- package/dist/projects/index.d.ts.map +1 -0
- package/dist/projects/index.js +17 -0
- package/dist/projects/index.js.map +1 -0
- package/dist/projects/paths.d.ts +127 -0
- package/dist/projects/paths.d.ts.map +1 -0
- package/dist/projects/paths.js +185 -0
- package/dist/projects/paths.js.map +1 -0
- package/dist/projects/scanner.d.ts +45 -0
- package/dist/projects/scanner.d.ts.map +1 -0
- package/dist/projects/scanner.js +287 -0
- package/dist/projects/scanner.js.map +1 -0
- package/dist/push/PushNotifier.d.ts +48 -0
- package/dist/push/PushNotifier.d.ts.map +1 -0
- package/dist/push/PushNotifier.js +145 -0
- package/dist/push/PushNotifier.js.map +1 -0
- package/dist/push/PushService.d.ts +95 -0
- package/dist/push/PushService.d.ts.map +1 -0
- package/dist/push/PushService.js +245 -0
- package/dist/push/PushService.js.map +1 -0
- package/dist/push/index.d.ts +9 -0
- package/dist/push/index.d.ts.map +1 -0
- package/dist/push/index.js +8 -0
- package/dist/push/index.js.map +1 -0
- package/dist/push/routes.d.ts +10 -0
- package/dist/push/routes.d.ts.map +1 -0
- package/dist/push/routes.js +111 -0
- package/dist/push/routes.js.map +1 -0
- package/dist/push/types.d.ts +80 -0
- package/dist/push/types.d.ts.map +1 -0
- package/dist/push/types.js +5 -0
- package/dist/push/types.js.map +1 -0
- package/dist/push/vapid.d.ts +42 -0
- package/dist/push/vapid.d.ts.map +1 -0
- package/dist/push/vapid.js +132 -0
- package/dist/push/vapid.js.map +1 -0
- package/dist/recents/RecentsService.d.ts +77 -0
- package/dist/recents/RecentsService.d.ts.map +1 -0
- package/dist/recents/RecentsService.js +155 -0
- package/dist/recents/RecentsService.js.map +1 -0
- package/dist/recents/index.d.ts +2 -0
- package/dist/recents/index.d.ts.map +1 -0
- package/dist/recents/index.js +2 -0
- package/dist/recents/index.js.map +1 -0
- package/dist/routes/activity.d.ts +7 -0
- package/dist/routes/activity.d.ts.map +1 -0
- package/dist/routes/activity.js +80 -0
- package/dist/routes/activity.js.map +1 -0
- package/dist/routes/beads.d.ts +42 -0
- package/dist/routes/beads.d.ts.map +1 -0
- package/dist/routes/beads.js +101 -0
- package/dist/routes/beads.js.map +1 -0
- package/dist/routes/debug-streaming.d.ts +7 -0
- package/dist/routes/debug-streaming.d.ts.map +1 -0
- package/dist/routes/debug-streaming.js +88 -0
- package/dist/routes/debug-streaming.js.map +1 -0
- package/dist/routes/dev.d.ts +11 -0
- package/dist/routes/dev.d.ts.map +1 -0
- package/dist/routes/dev.js +55 -0
- package/dist/routes/dev.js.map +1 -0
- package/dist/routes/files.d.ts +7 -0
- package/dist/routes/files.d.ts.map +1 -0
- package/dist/routes/files.js +429 -0
- package/dist/routes/files.js.map +1 -0
- package/dist/routes/global-sessions.d.ts +76 -0
- package/dist/routes/global-sessions.d.ts.map +1 -0
- package/dist/routes/global-sessions.js +207 -0
- package/dist/routes/global-sessions.js.map +1 -0
- package/dist/routes/health.d.ts +3 -0
- package/dist/routes/health.d.ts.map +1 -0
- package/dist/routes/health.js +6 -0
- package/dist/routes/health.js.map +1 -0
- package/dist/routes/inbox.d.ts +45 -0
- package/dist/routes/inbox.d.ts.map +1 -0
- package/dist/routes/inbox.js +174 -0
- package/dist/routes/inbox.js.map +1 -0
- package/dist/routes/processes.d.ts +16 -0
- package/dist/routes/processes.d.ts.map +1 -0
- package/dist/routes/processes.js +82 -0
- package/dist/routes/processes.js.map +1 -0
- package/dist/routes/projects.d.ts +30 -0
- package/dist/routes/projects.d.ts.map +1 -0
- package/dist/routes/projects.js +316 -0
- package/dist/routes/projects.js.map +1 -0
- package/dist/routes/providers.d.ts +9 -0
- package/dist/routes/providers.d.ts.map +1 -0
- package/dist/routes/providers.js +63 -0
- package/dist/routes/providers.js.map +1 -0
- package/dist/routes/recents.d.ts +14 -0
- package/dist/routes/recents.d.ts.map +1 -0
- package/dist/routes/recents.js +82 -0
- package/dist/routes/recents.js.map +1 -0
- package/dist/routes/sessions.d.ts +26 -0
- package/dist/routes/sessions.d.ts.map +1 -0
- package/dist/routes/sessions.js +962 -0
- package/dist/routes/sessions.js.map +1 -0
- package/dist/routes/stream.d.ts +7 -0
- package/dist/routes/stream.d.ts.map +1 -0
- package/dist/routes/stream.js +561 -0
- package/dist/routes/stream.js.map +1 -0
- package/dist/routes/upload.d.ts +14 -0
- package/dist/routes/upload.d.ts.map +1 -0
- package/dist/routes/upload.js +278 -0
- package/dist/routes/upload.js.map +1 -0
- package/dist/sdk/cli-detection.d.ts +47 -0
- package/dist/sdk/cli-detection.d.ts.map +1 -0
- package/dist/sdk/cli-detection.js +122 -0
- package/dist/sdk/cli-detection.js.map +1 -0
- package/dist/sdk/messageLogger.d.ts +15 -0
- package/dist/sdk/messageLogger.d.ts.map +1 -0
- package/dist/sdk/messageLogger.js +68 -0
- package/dist/sdk/messageLogger.js.map +1 -0
- package/dist/sdk/messageQueue.d.ts +49 -0
- package/dist/sdk/messageQueue.d.ts.map +1 -0
- package/dist/sdk/messageQueue.js +186 -0
- package/dist/sdk/messageQueue.js.map +1 -0
- package/dist/sdk/mock.d.ts +16 -0
- package/dist/sdk/mock.d.ts.map +1 -0
- package/dist/sdk/mock.js +81 -0
- package/dist/sdk/mock.js.map +1 -0
- package/dist/sdk/providers/__mocks__/base.d.ts +78 -0
- package/dist/sdk/providers/__mocks__/base.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/base.js +185 -0
- package/dist/sdk/providers/__mocks__/base.js.map +1 -0
- package/dist/sdk/providers/__mocks__/claude.d.ts +33 -0
- package/dist/sdk/providers/__mocks__/claude.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/claude.js +146 -0
- package/dist/sdk/providers/__mocks__/claude.js.map +1 -0
- package/dist/sdk/providers/__mocks__/codex.d.ts +45 -0
- package/dist/sdk/providers/__mocks__/codex.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/codex.js +160 -0
- package/dist/sdk/providers/__mocks__/codex.js.map +1 -0
- package/dist/sdk/providers/__mocks__/factory.d.ts +40 -0
- package/dist/sdk/providers/__mocks__/factory.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/factory.js +183 -0
- package/dist/sdk/providers/__mocks__/factory.js.map +1 -0
- package/dist/sdk/providers/__mocks__/gemini.d.ts +43 -0
- package/dist/sdk/providers/__mocks__/gemini.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/gemini.js +198 -0
- package/dist/sdk/providers/__mocks__/gemini.js.map +1 -0
- package/dist/sdk/providers/__mocks__/index.d.ts +23 -0
- package/dist/sdk/providers/__mocks__/index.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/index.js +25 -0
- package/dist/sdk/providers/__mocks__/index.js.map +1 -0
- package/dist/sdk/providers/__mocks__/opencode.d.ts +33 -0
- package/dist/sdk/providers/__mocks__/opencode.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/opencode.js +136 -0
- package/dist/sdk/providers/__mocks__/opencode.js.map +1 -0
- package/dist/sdk/providers/__mocks__/types.d.ts +50 -0
- package/dist/sdk/providers/__mocks__/types.d.ts.map +1 -0
- package/dist/sdk/providers/__mocks__/types.js +8 -0
- package/dist/sdk/providers/__mocks__/types.js.map +1 -0
- package/dist/sdk/providers/claude.d.ts +63 -0
- package/dist/sdk/providers/claude.d.ts.map +1 -0
- package/dist/sdk/providers/claude.js +252 -0
- package/dist/sdk/providers/claude.js.map +1 -0
- package/dist/sdk/providers/codex-oss.d.ts +108 -0
- package/dist/sdk/providers/codex-oss.d.ts.map +1 -0
- package/dist/sdk/providers/codex-oss.js +744 -0
- package/dist/sdk/providers/codex-oss.js.map +1 -0
- package/dist/sdk/providers/codex.d.ts +82 -0
- package/dist/sdk/providers/codex.d.ts.map +1 -0
- package/dist/sdk/providers/codex.js +597 -0
- package/dist/sdk/providers/codex.js.map +1 -0
- package/dist/sdk/providers/gemini.d.ts +78 -0
- package/dist/sdk/providers/gemini.d.ts.map +1 -0
- package/dist/sdk/providers/gemini.js +536 -0
- package/dist/sdk/providers/gemini.js.map +1 -0
- package/dist/sdk/providers/index.d.ts +22 -0
- package/dist/sdk/providers/index.d.ts.map +1 -0
- package/dist/sdk/providers/index.js +53 -0
- package/dist/sdk/providers/index.js.map +1 -0
- package/dist/sdk/providers/opencode.d.ts +95 -0
- package/dist/sdk/providers/opencode.d.ts.map +1 -0
- package/dist/sdk/providers/opencode.js +586 -0
- package/dist/sdk/providers/opencode.js.map +1 -0
- package/dist/sdk/providers/types.d.ts +99 -0
- package/dist/sdk/providers/types.d.ts.map +1 -0
- package/dist/sdk/providers/types.js +2 -0
- package/dist/sdk/providers/types.js.map +1 -0
- package/dist/sdk/real.d.ts +20 -0
- package/dist/sdk/real.d.ts.map +1 -0
- package/dist/sdk/real.js +22 -0
- package/dist/sdk/real.js.map +1 -0
- package/dist/sdk/types.d.ts +113 -0
- package/dist/sdk/types.d.ts.map +1 -0
- package/dist/sdk/types.js +3 -0
- package/dist/sdk/types.js.map +1 -0
- package/dist/sessions/Session.d.ts +80 -0
- package/dist/sessions/Session.d.ts.map +1 -0
- package/dist/sessions/Session.js +119 -0
- package/dist/sessions/Session.js.map +1 -0
- package/dist/sessions/codex-reader.d.ts +166 -0
- package/dist/sessions/codex-reader.d.ts.map +1 -0
- package/dist/sessions/codex-reader.js +664 -0
- package/dist/sessions/codex-reader.js.map +1 -0
- package/dist/sessions/dag.d.ts +62 -0
- package/dist/sessions/dag.d.ts.map +1 -0
- package/dist/sessions/dag.js +175 -0
- package/dist/sessions/dag.js.map +1 -0
- package/dist/sessions/fork.d.ts +34 -0
- package/dist/sessions/fork.d.ts.map +1 -0
- package/dist/sessions/fork.js +58 -0
- package/dist/sessions/fork.js.map +1 -0
- package/dist/sessions/gemini-reader.d.ts +103 -0
- package/dist/sessions/gemini-reader.d.ts.map +1 -0
- package/dist/sessions/gemini-reader.js +332 -0
- package/dist/sessions/gemini-reader.js.map +1 -0
- package/dist/sessions/normalization.d.ts +7 -0
- package/dist/sessions/normalization.d.ts.map +1 -0
- package/dist/sessions/normalization.js +429 -0
- package/dist/sessions/normalization.js.map +1 -0
- package/dist/sessions/opencode-reader.d.ts +99 -0
- package/dist/sessions/opencode-reader.d.ts.map +1 -0
- package/dist/sessions/opencode-reader.js +370 -0
- package/dist/sessions/opencode-reader.js.map +1 -0
- package/dist/sessions/reader.d.ts +118 -0
- package/dist/sessions/reader.d.ts.map +1 -0
- package/dist/sessions/reader.js +444 -0
- package/dist/sessions/reader.js.map +1 -0
- package/dist/sessions/types.d.ts +77 -0
- package/dist/sessions/types.d.ts.map +1 -0
- package/dist/sessions/types.js +8 -0
- package/dist/sessions/types.js.map +1 -0
- package/dist/supervisor/ExternalSessionTracker.d.ts +94 -0
- package/dist/supervisor/ExternalSessionTracker.d.ts.map +1 -0
- package/dist/supervisor/ExternalSessionTracker.js +507 -0
- package/dist/supervisor/ExternalSessionTracker.js.map +1 -0
- package/dist/supervisor/Process.d.ts +230 -0
- package/dist/supervisor/Process.d.ts.map +1 -0
- package/dist/supervisor/Process.js +878 -0
- package/dist/supervisor/Process.js.map +1 -0
- package/dist/supervisor/Supervisor.d.ts +191 -0
- package/dist/supervisor/Supervisor.d.ts.map +1 -0
- package/dist/supervisor/Supervisor.js +933 -0
- package/dist/supervisor/Supervisor.js.map +1 -0
- package/dist/supervisor/WorkerQueue.d.ts +113 -0
- package/dist/supervisor/WorkerQueue.d.ts.map +1 -0
- package/dist/supervisor/WorkerQueue.js +148 -0
- package/dist/supervisor/WorkerQueue.js.map +1 -0
- package/dist/supervisor/types.d.ts +176 -0
- package/dist/supervisor/types.d.ts.map +1 -0
- package/dist/supervisor/types.js +7 -0
- package/dist/supervisor/types.js.map +1 -0
- package/dist/testing/mockProjectData.d.ts +5 -0
- package/dist/testing/mockProjectData.d.ts.map +1 -0
- package/dist/testing/mockProjectData.js +27 -0
- package/dist/testing/mockProjectData.js.map +1 -0
- package/dist/uploads/index.d.ts +3 -0
- package/dist/uploads/index.d.ts.map +1 -0
- package/dist/uploads/index.js +2 -0
- package/dist/uploads/index.js.map +1 -0
- package/dist/uploads/manager.d.ts +84 -0
- package/dist/uploads/manager.d.ts.map +1 -0
- package/dist/uploads/manager.js +215 -0
- package/dist/uploads/manager.js.map +1 -0
- package/dist/utils/fileLock.d.ts +57 -0
- package/dist/utils/fileLock.d.ts.map +1 -0
- package/dist/utils/fileLock.js +91 -0
- package/dist/utils/fileLock.js.map +1 -0
- package/dist/watcher/BatchProcessor.d.ts +58 -0
- package/dist/watcher/BatchProcessor.d.ts.map +1 -0
- package/dist/watcher/BatchProcessor.js +105 -0
- package/dist/watcher/BatchProcessor.js.map +1 -0
- package/dist/watcher/EventBus.d.ts +157 -0
- package/dist/watcher/EventBus.d.ts.map +1 -0
- package/dist/watcher/EventBus.js +36 -0
- package/dist/watcher/EventBus.js.map +1 -0
- package/dist/watcher/FileWatcher.d.ts +42 -0
- package/dist/watcher/FileWatcher.d.ts.map +1 -0
- package/dist/watcher/FileWatcher.js +165 -0
- package/dist/watcher/FileWatcher.js.map +1 -0
- package/dist/watcher/SourceWatcher.d.ts +36 -0
- package/dist/watcher/SourceWatcher.d.ts.map +1 -0
- package/dist/watcher/SourceWatcher.js +97 -0
- package/dist/watcher/SourceWatcher.js.map +1 -0
- package/dist/watcher/index.d.ts +9 -0
- package/dist/watcher/index.d.ts.map +1 -0
- package/dist/watcher/index.js +5 -0
- package/dist/watcher/index.js.map +1 -0
- package/package.json +54 -0
- package/scripts/postinstall.js +48 -0
|
@@ -0,0 +1,962 @@
|
|
|
1
|
+
import { isUrlProjectId, thinkingOptionToTokens, } from "@yep-anywhere/shared";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { computeEditAugment, } from "../augments/edit-augments.js";
|
|
4
|
+
import { augmentTextBlocks, renderMarkdownToHtml, } from "../augments/markdown-augments.js";
|
|
5
|
+
import { computeReadAugment } from "../augments/read-augments.js";
|
|
6
|
+
import { computeWriteAugment, } from "../augments/write-augments.js";
|
|
7
|
+
import { CodexSessionReader } from "../sessions/codex-reader.js";
|
|
8
|
+
import { cloneClaudeSession } from "../sessions/fork.js";
|
|
9
|
+
import { GeminiSessionReader } from "../sessions/gemini-reader.js";
|
|
10
|
+
import { normalizeSession } from "../sessions/normalization.js";
|
|
11
|
+
/**
|
|
12
|
+
* Type guard to check if a result is a QueuedResponse
|
|
13
|
+
*/
|
|
14
|
+
function isQueuedResponse(result) {
|
|
15
|
+
return "queued" in result && result.queued === true;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Type guard to check if a result is a QueueFullResponse
|
|
19
|
+
*/
|
|
20
|
+
function isQueueFullResponse(result) {
|
|
21
|
+
return "error" in result && result.error === "queue_full";
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Convert SDK messages to client Message format.
|
|
25
|
+
* Used for mock SDK sessions where messages aren't persisted to disk.
|
|
26
|
+
*/
|
|
27
|
+
function sdkMessagesToClientMessages(sdkMessages) {
|
|
28
|
+
const messages = [];
|
|
29
|
+
for (const msg of sdkMessages) {
|
|
30
|
+
// Only include user and assistant messages with content
|
|
31
|
+
if ((msg.type === "user" || msg.type === "assistant") &&
|
|
32
|
+
msg.message?.content) {
|
|
33
|
+
const rawContent = msg.message.content;
|
|
34
|
+
// Both user and assistant messages can have string or array content.
|
|
35
|
+
// User messages with tool_result blocks have array content that must be preserved.
|
|
36
|
+
// Assistant messages need ContentBlock[] format for preprocessMessages to render.
|
|
37
|
+
let content;
|
|
38
|
+
if (typeof rawContent === "string") {
|
|
39
|
+
// String content: keep as-is for user messages, wrap in text block for assistant
|
|
40
|
+
content =
|
|
41
|
+
msg.type === "user"
|
|
42
|
+
? rawContent
|
|
43
|
+
: [{ type: "text", text: rawContent }];
|
|
44
|
+
}
|
|
45
|
+
else if (Array.isArray(rawContent)) {
|
|
46
|
+
// Array content: pass through as ContentBlock[] for both user and assistant
|
|
47
|
+
content = rawContent;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
// Unknown content type - skip this message
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
messages.push({
|
|
54
|
+
id: msg.uuid ?? `msg-${Date.now()}-${messages.length}`,
|
|
55
|
+
type: msg.type,
|
|
56
|
+
role: msg.type,
|
|
57
|
+
content,
|
|
58
|
+
timestamp: new Date().toISOString(),
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return messages;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Embed Edit augment data directly into tool_use inputs.
|
|
66
|
+
* Adds _structuredPatch and _diffHtml to Edit tool_use input blocks.
|
|
67
|
+
*/
|
|
68
|
+
async function augmentEditInputs(messages) {
|
|
69
|
+
const promises = [];
|
|
70
|
+
for (const msg of messages) {
|
|
71
|
+
// Only assistant messages have tool_use blocks
|
|
72
|
+
if (msg.type !== "assistant")
|
|
73
|
+
continue;
|
|
74
|
+
// Content is in msg.message.content (nested structure from SDK)
|
|
75
|
+
const content = msg.message?.content;
|
|
76
|
+
if (!Array.isArray(content))
|
|
77
|
+
continue;
|
|
78
|
+
for (const block of content) {
|
|
79
|
+
if (block.type === "tool_use" &&
|
|
80
|
+
block.name === "Edit" &&
|
|
81
|
+
block.id &&
|
|
82
|
+
block.input) {
|
|
83
|
+
const input = block.input;
|
|
84
|
+
// Validate required fields and hasn't been augmented yet
|
|
85
|
+
if (input.file_path &&
|
|
86
|
+
typeof input.old_string === "string" &&
|
|
87
|
+
typeof input.new_string === "string" &&
|
|
88
|
+
!input._structuredPatch) {
|
|
89
|
+
const toolUseId = block.id;
|
|
90
|
+
promises.push(computeEditAugment(toolUseId, {
|
|
91
|
+
file_path: input.file_path,
|
|
92
|
+
old_string: input.old_string,
|
|
93
|
+
new_string: input.new_string,
|
|
94
|
+
})
|
|
95
|
+
.then((augment) => {
|
|
96
|
+
input._structuredPatch = augment.structuredPatch;
|
|
97
|
+
input._diffHtml = augment.diffHtml;
|
|
98
|
+
})
|
|
99
|
+
.catch(() => {
|
|
100
|
+
// Ignore augment computation errors
|
|
101
|
+
}));
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
await Promise.all(promises);
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Embed Write augment data directly into tool_use inputs.
|
|
110
|
+
* Adds _highlightedContentHtml to Write tool_use input blocks.
|
|
111
|
+
*/
|
|
112
|
+
async function augmentWriteInputs(messages) {
|
|
113
|
+
const promises = [];
|
|
114
|
+
for (const msg of messages) {
|
|
115
|
+
// Only assistant messages have tool_use blocks
|
|
116
|
+
if (msg.type !== "assistant")
|
|
117
|
+
continue;
|
|
118
|
+
// Content is in msg.message.content (nested structure from SDK)
|
|
119
|
+
const content = msg.message?.content;
|
|
120
|
+
if (!Array.isArray(content))
|
|
121
|
+
continue;
|
|
122
|
+
for (const block of content) {
|
|
123
|
+
if (block.type === "tool_use" && block.name === "Write" && block.input) {
|
|
124
|
+
const input = block.input;
|
|
125
|
+
// Validate required fields and hasn't been augmented yet
|
|
126
|
+
if (typeof input.file_path === "string" &&
|
|
127
|
+
typeof input.content === "string" &&
|
|
128
|
+
!input._highlightedContentHtml) {
|
|
129
|
+
promises.push(computeWriteAugment({
|
|
130
|
+
file_path: input.file_path,
|
|
131
|
+
content: input.content,
|
|
132
|
+
})
|
|
133
|
+
.then((augment) => {
|
|
134
|
+
if (augment) {
|
|
135
|
+
input._highlightedContentHtml = augment.highlightedHtml;
|
|
136
|
+
input._highlightedLanguage = augment.language;
|
|
137
|
+
input._highlightedTruncated = augment.truncated;
|
|
138
|
+
}
|
|
139
|
+
})
|
|
140
|
+
.catch(() => {
|
|
141
|
+
// Ignore augment computation errors
|
|
142
|
+
}));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
await Promise.all(promises);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Render ExitPlanMode plan HTML directly into messages.
|
|
151
|
+
* Adds _renderedHtml to tool_use input and tool_result structured data.
|
|
152
|
+
*/
|
|
153
|
+
async function augmentExitPlanModeMessages(messages) {
|
|
154
|
+
const promises = [];
|
|
155
|
+
for (const msg of messages) {
|
|
156
|
+
// Check assistant messages for ExitPlanMode tool_use
|
|
157
|
+
if (msg.type === "assistant") {
|
|
158
|
+
const content = msg.message?.content;
|
|
159
|
+
if (!Array.isArray(content))
|
|
160
|
+
continue;
|
|
161
|
+
for (const block of content) {
|
|
162
|
+
if (block.type === "tool_use" &&
|
|
163
|
+
block.name === "ExitPlanMode" &&
|
|
164
|
+
block.input) {
|
|
165
|
+
const input = block.input;
|
|
166
|
+
if (input.plan && !input._renderedHtml) {
|
|
167
|
+
promises.push(renderMarkdownToHtml(input.plan)
|
|
168
|
+
.then((html) => {
|
|
169
|
+
input._renderedHtml = html;
|
|
170
|
+
})
|
|
171
|
+
.catch(() => {
|
|
172
|
+
// Ignore render errors
|
|
173
|
+
}));
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
// Check user messages for ExitPlanMode tool_result
|
|
179
|
+
if (msg.type === "user") {
|
|
180
|
+
const toolUseResult = msg.toolUseResult;
|
|
181
|
+
const toolUseResultSnake = msg
|
|
182
|
+
.tool_use_result;
|
|
183
|
+
const result = toolUseResult ?? toolUseResultSnake;
|
|
184
|
+
if (result?.plan && !result._renderedHtml) {
|
|
185
|
+
promises.push(renderMarkdownToHtml(result.plan)
|
|
186
|
+
.then((html) => {
|
|
187
|
+
result._renderedHtml = html;
|
|
188
|
+
})
|
|
189
|
+
.catch(() => {
|
|
190
|
+
// Ignore render errors
|
|
191
|
+
}));
|
|
192
|
+
}
|
|
193
|
+
// Check for Read tool_result and augment with syntax highlighting
|
|
194
|
+
const readResult = (toolUseResult ?? toolUseResultSnake);
|
|
195
|
+
if (readResult?.type === "text" &&
|
|
196
|
+
readResult.file?.filePath &&
|
|
197
|
+
readResult.file?.content &&
|
|
198
|
+
!readResult._highlightedContentHtml) {
|
|
199
|
+
promises.push(computeReadAugment({
|
|
200
|
+
file_path: readResult.file.filePath,
|
|
201
|
+
content: readResult.file.content,
|
|
202
|
+
})
|
|
203
|
+
.then((augment) => {
|
|
204
|
+
if (augment) {
|
|
205
|
+
readResult._highlightedContentHtml = augment.highlightedHtml;
|
|
206
|
+
readResult._highlightedLanguage = augment.language;
|
|
207
|
+
readResult._highlightedTruncated = augment.truncated;
|
|
208
|
+
if (augment.renderedMarkdownHtml) {
|
|
209
|
+
readResult._renderedMarkdownHtml =
|
|
210
|
+
augment.renderedMarkdownHtml;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
})
|
|
214
|
+
.catch(() => {
|
|
215
|
+
// Ignore augment computation errors
|
|
216
|
+
}));
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
await Promise.all(promises);
|
|
221
|
+
}
|
|
222
|
+
export function createSessionsRoutes(deps) {
|
|
223
|
+
const routes = new Hono();
|
|
224
|
+
// GET /api/projects/:projectId/sessions/:sessionId/agents - Get agent mappings
|
|
225
|
+
// Used to find agent sessions for pending Tasks on page reload
|
|
226
|
+
routes.get("/projects/:projectId/sessions/:sessionId/agents", async (c) => {
|
|
227
|
+
const projectId = c.req.param("projectId");
|
|
228
|
+
// Validate projectId format at API boundary
|
|
229
|
+
if (!isUrlProjectId(projectId)) {
|
|
230
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
231
|
+
}
|
|
232
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
233
|
+
if (!project) {
|
|
234
|
+
return c.json({ error: "Project not found" }, 404);
|
|
235
|
+
}
|
|
236
|
+
const reader = deps.readerFactory(project);
|
|
237
|
+
const mappings = await reader.getAgentMappings();
|
|
238
|
+
return c.json({ mappings });
|
|
239
|
+
});
|
|
240
|
+
// GET /api/projects/:projectId/sessions/:sessionId/agents/:agentId - Get agent session content
|
|
241
|
+
// Used for lazy-loading completed Tasks
|
|
242
|
+
routes.get("/projects/:projectId/sessions/:sessionId/agents/:agentId", async (c) => {
|
|
243
|
+
const projectId = c.req.param("projectId");
|
|
244
|
+
const agentId = c.req.param("agentId");
|
|
245
|
+
// Validate projectId format at API boundary
|
|
246
|
+
if (!isUrlProjectId(projectId)) {
|
|
247
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
248
|
+
}
|
|
249
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
250
|
+
if (!project) {
|
|
251
|
+
return c.json({ error: "Project not found" }, 404);
|
|
252
|
+
}
|
|
253
|
+
const reader = deps.readerFactory(project);
|
|
254
|
+
const agentSession = await reader.getAgentSession(agentId);
|
|
255
|
+
if (!agentSession) {
|
|
256
|
+
return c.json({ error: "Agent session not found" }, 404);
|
|
257
|
+
}
|
|
258
|
+
// Add server-rendered HTML to text blocks for markdown display
|
|
259
|
+
await augmentTextBlocks(agentSession.messages);
|
|
260
|
+
return c.json(agentSession);
|
|
261
|
+
});
|
|
262
|
+
// GET /api/projects/:projectId/sessions/:sessionId/metadata - Get session metadata only (no messages)
|
|
263
|
+
// Lightweight endpoint for refreshing title, status, etc. without re-fetching all messages
|
|
264
|
+
routes.get("/projects/:projectId/sessions/:sessionId/metadata", async (c) => {
|
|
265
|
+
const projectId = c.req.param("projectId");
|
|
266
|
+
const sessionId = c.req.param("sessionId");
|
|
267
|
+
// Validate projectId format at API boundary
|
|
268
|
+
if (!isUrlProjectId(projectId)) {
|
|
269
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
270
|
+
}
|
|
271
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
272
|
+
if (!project) {
|
|
273
|
+
return c.json({ error: "Project not found" }, 404);
|
|
274
|
+
}
|
|
275
|
+
// Check if session is actively owned by a process
|
|
276
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
277
|
+
// Check if session is being controlled by an external program
|
|
278
|
+
const isExternal = deps.externalTracker?.isExternal(sessionId) ?? false;
|
|
279
|
+
// Determine the session status
|
|
280
|
+
const status = process
|
|
281
|
+
? {
|
|
282
|
+
state: "owned",
|
|
283
|
+
processId: process.id,
|
|
284
|
+
permissionMode: process.permissionMode,
|
|
285
|
+
modeVersion: process.modeVersion,
|
|
286
|
+
}
|
|
287
|
+
: isExternal
|
|
288
|
+
? { state: "external" }
|
|
289
|
+
: { state: "idle" };
|
|
290
|
+
// Get session metadata (custom title, archived, starred)
|
|
291
|
+
const metadata = deps.sessionMetadataService?.getMetadata(sessionId);
|
|
292
|
+
// Get notification data (lastSeenAt, hasUnread)
|
|
293
|
+
const lastSeenEntry = deps.notificationService?.getLastSeen(sessionId);
|
|
294
|
+
const lastSeenAt = lastSeenEntry?.timestamp;
|
|
295
|
+
// Get pending input request from active process
|
|
296
|
+
const pendingInputRequest = process?.state.type === "waiting-input" ? process.state.request : null;
|
|
297
|
+
// Read minimal session info from disk (just for title/timestamps, no messages)
|
|
298
|
+
const reader = deps.readerFactory(project);
|
|
299
|
+
const sessionSummary = await reader.getSessionSummary(sessionId, projectId);
|
|
300
|
+
if (!sessionSummary && !process) {
|
|
301
|
+
return c.json({ error: "Session not found" }, 404);
|
|
302
|
+
}
|
|
303
|
+
// Calculate hasUnread if we have session summary
|
|
304
|
+
const hasUnread = deps.notificationService && sessionSummary
|
|
305
|
+
? deps.notificationService.hasUnread(sessionId, sessionSummary.updatedAt)
|
|
306
|
+
: undefined;
|
|
307
|
+
return c.json({
|
|
308
|
+
session: {
|
|
309
|
+
id: sessionId,
|
|
310
|
+
projectId,
|
|
311
|
+
title: sessionSummary?.title ?? null,
|
|
312
|
+
fullTitle: sessionSummary?.fullTitle ?? null,
|
|
313
|
+
createdAt: sessionSummary?.createdAt ?? new Date().toISOString(),
|
|
314
|
+
updatedAt: sessionSummary?.updatedAt ?? new Date().toISOString(),
|
|
315
|
+
messageCount: sessionSummary?.messageCount ?? 0,
|
|
316
|
+
model: sessionSummary?.model,
|
|
317
|
+
customTitle: metadata?.customTitle,
|
|
318
|
+
isArchived: metadata?.isArchived,
|
|
319
|
+
isStarred: metadata?.isStarred,
|
|
320
|
+
lastSeenAt,
|
|
321
|
+
hasUnread,
|
|
322
|
+
},
|
|
323
|
+
status,
|
|
324
|
+
pendingInputRequest,
|
|
325
|
+
});
|
|
326
|
+
});
|
|
327
|
+
// GET /api/projects/:projectId/sessions/:sessionId - Get session detail
|
|
328
|
+
// Optional query param: ?afterMessageId=<id> for incremental fetching
|
|
329
|
+
routes.get("/projects/:projectId/sessions/:sessionId", async (c) => {
|
|
330
|
+
const projectId = c.req.param("projectId");
|
|
331
|
+
const sessionId = c.req.param("sessionId");
|
|
332
|
+
const afterMessageId = c.req.query("afterMessageId");
|
|
333
|
+
// Validate projectId format at API boundary
|
|
334
|
+
if (!isUrlProjectId(projectId)) {
|
|
335
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
336
|
+
}
|
|
337
|
+
// Use getOrCreateProject to support Codex projects that may not be in the scan cache yet
|
|
338
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
339
|
+
if (!project) {
|
|
340
|
+
return c.json({ error: "Project not found" }, 404);
|
|
341
|
+
}
|
|
342
|
+
// Check if session is actively owned by a process
|
|
343
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
344
|
+
// Check if session is being controlled by an external program
|
|
345
|
+
const isExternal = deps.externalTracker?.isExternal(sessionId) ?? false;
|
|
346
|
+
// Check if we've ever owned this session (for orphan detection)
|
|
347
|
+
// Only mark tools as "aborted" if we owned the session and know it terminated
|
|
348
|
+
const wasEverOwned = deps.supervisor.wasEverOwned(sessionId);
|
|
349
|
+
// Always try to read from disk first (even for owned sessions)
|
|
350
|
+
const reader = deps.readerFactory(project);
|
|
351
|
+
let loadedSession = await reader.getSession(sessionId, project.id, afterMessageId, {
|
|
352
|
+
// Only include orphaned tool info if:
|
|
353
|
+
// 1. We previously owned this session (not external)
|
|
354
|
+
// 2. No active process (tools aren't potentially in progress)
|
|
355
|
+
// When we own the session, tools without results might be pending approval
|
|
356
|
+
includeOrphans: wasEverOwned && !process,
|
|
357
|
+
});
|
|
358
|
+
// For Claude projects, also check for Codex sessions if primary reader didn't find it
|
|
359
|
+
// This handles mixed projects that have sessions from multiple providers
|
|
360
|
+
if (!loadedSession &&
|
|
361
|
+
project.provider === "claude" &&
|
|
362
|
+
deps.codexScanner &&
|
|
363
|
+
deps.codexSessionsDir) {
|
|
364
|
+
const codexSessions = await deps.codexScanner.getSessionsForProject(project.path);
|
|
365
|
+
if (codexSessions.length > 0) {
|
|
366
|
+
const codexReader = new CodexSessionReader({
|
|
367
|
+
sessionsDir: deps.codexSessionsDir,
|
|
368
|
+
projectPath: project.path,
|
|
369
|
+
});
|
|
370
|
+
loadedSession = await codexReader.getSession(sessionId, project.id, afterMessageId, { includeOrphans: wasEverOwned && !process });
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
// For Claude/Codex projects, also check for Gemini sessions if still not found
|
|
374
|
+
// This handles mixed projects that have sessions from multiple providers
|
|
375
|
+
if (!loadedSession &&
|
|
376
|
+
(project.provider === "claude" || project.provider === "codex") &&
|
|
377
|
+
deps.geminiScanner &&
|
|
378
|
+
deps.geminiSessionsDir) {
|
|
379
|
+
const geminiSessions = await deps.geminiScanner.getSessionsForProject(project.path);
|
|
380
|
+
if (geminiSessions.length > 0) {
|
|
381
|
+
const geminiReader = new GeminiSessionReader({
|
|
382
|
+
sessionsDir: deps.geminiSessionsDir,
|
|
383
|
+
projectPath: project.path,
|
|
384
|
+
hashToCwd: await deps.geminiScanner.getHashToCwd(),
|
|
385
|
+
});
|
|
386
|
+
loadedSession = await geminiReader.getSession(sessionId, project.id, afterMessageId, { includeOrphans: wasEverOwned && !process });
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
const session = loadedSession ? normalizeSession(loadedSession) : null;
|
|
390
|
+
// Determine the session status
|
|
391
|
+
const status = process
|
|
392
|
+
? {
|
|
393
|
+
state: "owned",
|
|
394
|
+
processId: process.id,
|
|
395
|
+
permissionMode: process.permissionMode,
|
|
396
|
+
modeVersion: process.modeVersion,
|
|
397
|
+
}
|
|
398
|
+
: isExternal
|
|
399
|
+
? { state: "external" }
|
|
400
|
+
: (session?.status ?? { state: "idle" });
|
|
401
|
+
// Get pending input request from active process (for tool approval prompts)
|
|
402
|
+
// This ensures clients get pending requests immediately without waiting for SSE
|
|
403
|
+
const pendingInputRequest = process?.state.type === "waiting-input" ? process.state.request : null;
|
|
404
|
+
if (!session) {
|
|
405
|
+
// Session file doesn't exist yet - only valid if we own the process
|
|
406
|
+
if (process) {
|
|
407
|
+
// Get messages from process memory (for mock SDK that doesn't persist to disk)
|
|
408
|
+
const processMessages = sdkMessagesToClientMessages(process.getMessageHistory());
|
|
409
|
+
// Get metadata even for new sessions (in case it was set before file was written)
|
|
410
|
+
const metadata = deps.sessionMetadataService?.getMetadata(sessionId);
|
|
411
|
+
// Get notification data for new sessions too
|
|
412
|
+
const lastSeenEntry = deps.notificationService?.getLastSeen(sessionId);
|
|
413
|
+
const newSessionUpdatedAt = new Date().toISOString();
|
|
414
|
+
const hasUnread = deps.notificationService
|
|
415
|
+
? deps.notificationService.hasUnread(sessionId, newSessionUpdatedAt)
|
|
416
|
+
: undefined;
|
|
417
|
+
return c.json({
|
|
418
|
+
session: {
|
|
419
|
+
id: sessionId,
|
|
420
|
+
projectId,
|
|
421
|
+
title: null,
|
|
422
|
+
createdAt: new Date().toISOString(),
|
|
423
|
+
updatedAt: newSessionUpdatedAt,
|
|
424
|
+
messageCount: processMessages.length,
|
|
425
|
+
status,
|
|
426
|
+
messages: processMessages,
|
|
427
|
+
customTitle: metadata?.customTitle,
|
|
428
|
+
isArchived: metadata?.isArchived,
|
|
429
|
+
isStarred: metadata?.isStarred,
|
|
430
|
+
lastSeenAt: lastSeenEntry?.timestamp,
|
|
431
|
+
hasUnread,
|
|
432
|
+
provider: process.provider,
|
|
433
|
+
// Model is unknown for new sessions until first message is written to disk
|
|
434
|
+
},
|
|
435
|
+
messages: processMessages,
|
|
436
|
+
status,
|
|
437
|
+
pendingInputRequest,
|
|
438
|
+
});
|
|
439
|
+
}
|
|
440
|
+
return c.json({ error: "Session not found" }, 404);
|
|
441
|
+
}
|
|
442
|
+
// Get session metadata (custom title, archived, starred)
|
|
443
|
+
const metadata = deps.sessionMetadataService?.getMetadata(sessionId);
|
|
444
|
+
// Get notification data (lastSeenAt, hasUnread)
|
|
445
|
+
const lastSeenEntry = deps.notificationService?.getLastSeen(sessionId);
|
|
446
|
+
const lastSeenAt = lastSeenEntry?.timestamp;
|
|
447
|
+
const hasUnread = deps.notificationService
|
|
448
|
+
? deps.notificationService.hasUnread(sessionId, session.updatedAt)
|
|
449
|
+
: undefined;
|
|
450
|
+
// Embed Edit augment data directly into tool_use inputs
|
|
451
|
+
// This adds _structuredPatch and _diffHtml to the input
|
|
452
|
+
await augmentEditInputs(session.messages);
|
|
453
|
+
// Embed Write augment data directly into tool_use inputs
|
|
454
|
+
// This adds _highlightedContentHtml to the input
|
|
455
|
+
await augmentWriteInputs(session.messages);
|
|
456
|
+
// Embed rendered HTML directly into text blocks
|
|
457
|
+
// This adds _html to text content blocks
|
|
458
|
+
await augmentTextBlocks(session.messages);
|
|
459
|
+
// Render ExitPlanMode plan HTML directly into messages
|
|
460
|
+
// This adds _renderedHtml to tool_use input and tool_result structured data
|
|
461
|
+
await augmentExitPlanModeMessages(session.messages);
|
|
462
|
+
return c.json({
|
|
463
|
+
session: {
|
|
464
|
+
...session,
|
|
465
|
+
status,
|
|
466
|
+
customTitle: metadata?.customTitle,
|
|
467
|
+
isArchived: metadata?.isArchived,
|
|
468
|
+
isStarred: metadata?.isStarred,
|
|
469
|
+
// Model comes from the session reader (extracted from JSONL)
|
|
470
|
+
model: session.model,
|
|
471
|
+
lastSeenAt,
|
|
472
|
+
hasUnread,
|
|
473
|
+
},
|
|
474
|
+
messages: session.messages,
|
|
475
|
+
status,
|
|
476
|
+
pendingInputRequest,
|
|
477
|
+
});
|
|
478
|
+
});
|
|
479
|
+
// POST /api/projects/:projectId/sessions - Start new session
|
|
480
|
+
routes.post("/projects/:projectId/sessions", async (c) => {
|
|
481
|
+
const projectId = c.req.param("projectId");
|
|
482
|
+
// Validate projectId format at API boundary
|
|
483
|
+
if (!isUrlProjectId(projectId)) {
|
|
484
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
485
|
+
}
|
|
486
|
+
// Use getOrCreateProject to allow starting sessions in new directories
|
|
487
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
488
|
+
if (!project) {
|
|
489
|
+
return c.json({ error: "Project not found or path does not exist" }, 404);
|
|
490
|
+
}
|
|
491
|
+
let body;
|
|
492
|
+
try {
|
|
493
|
+
body = await c.req.json();
|
|
494
|
+
}
|
|
495
|
+
catch {
|
|
496
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
497
|
+
}
|
|
498
|
+
if (!body.message) {
|
|
499
|
+
return c.json({ error: "Message is required" }, 400);
|
|
500
|
+
}
|
|
501
|
+
const userMessage = {
|
|
502
|
+
text: body.message,
|
|
503
|
+
images: body.images,
|
|
504
|
+
documents: body.documents,
|
|
505
|
+
attachments: body.attachments,
|
|
506
|
+
mode: body.mode,
|
|
507
|
+
tempId: body.tempId,
|
|
508
|
+
};
|
|
509
|
+
// Convert thinking option to token budget
|
|
510
|
+
const maxThinkingTokens = body.thinking && body.thinking !== "off"
|
|
511
|
+
? thinkingOptionToTokens(body.thinking)
|
|
512
|
+
: undefined;
|
|
513
|
+
// Convert model option (undefined or "default" means use CLI default)
|
|
514
|
+
const model = body.model && body.model !== "default" ? body.model : undefined;
|
|
515
|
+
const result = await deps.supervisor.startSession(project.path, userMessage, body.mode, { model, maxThinkingTokens, providerName: body.provider });
|
|
516
|
+
// Check if queue is full
|
|
517
|
+
if (isQueueFullResponse(result)) {
|
|
518
|
+
return c.json({ error: "Queue is full", maxQueueSize: result.maxQueueSize }, 503);
|
|
519
|
+
}
|
|
520
|
+
// Check if request was queued
|
|
521
|
+
if (isQueuedResponse(result)) {
|
|
522
|
+
return c.json(result, 202); // 202 Accepted - queued for processing
|
|
523
|
+
}
|
|
524
|
+
return c.json({
|
|
525
|
+
sessionId: result.sessionId,
|
|
526
|
+
processId: result.id,
|
|
527
|
+
permissionMode: result.permissionMode,
|
|
528
|
+
modeVersion: result.modeVersion,
|
|
529
|
+
});
|
|
530
|
+
});
|
|
531
|
+
// POST /api/projects/:projectId/sessions/create - Create session without starting agent
|
|
532
|
+
// Used for two-phase flow: create session first, upload files, then send first message
|
|
533
|
+
routes.post("/projects/:projectId/sessions/create", async (c) => {
|
|
534
|
+
const projectId = c.req.param("projectId");
|
|
535
|
+
// Validate projectId format at API boundary
|
|
536
|
+
if (!isUrlProjectId(projectId)) {
|
|
537
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
538
|
+
}
|
|
539
|
+
// Use getOrCreateProject to allow starting sessions in new directories
|
|
540
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
541
|
+
if (!project) {
|
|
542
|
+
return c.json({ error: "Project not found or path does not exist" }, 404);
|
|
543
|
+
}
|
|
544
|
+
let body = {};
|
|
545
|
+
try {
|
|
546
|
+
body = await c.req.json();
|
|
547
|
+
}
|
|
548
|
+
catch {
|
|
549
|
+
// Body is optional for this endpoint
|
|
550
|
+
}
|
|
551
|
+
// Convert thinking option to token budget
|
|
552
|
+
const maxThinkingTokens = body.thinking && body.thinking !== "off"
|
|
553
|
+
? thinkingOptionToTokens(body.thinking)
|
|
554
|
+
: undefined;
|
|
555
|
+
// Convert model option (undefined or "default" means use CLI default)
|
|
556
|
+
const model = body.model && body.model !== "default" ? body.model : undefined;
|
|
557
|
+
const result = await deps.supervisor.createSession(project.path, body.mode, {
|
|
558
|
+
model,
|
|
559
|
+
maxThinkingTokens,
|
|
560
|
+
providerName: body.provider,
|
|
561
|
+
});
|
|
562
|
+
// Check if queue is full
|
|
563
|
+
if (isQueueFullResponse(result)) {
|
|
564
|
+
return c.json({ error: "Queue is full", maxQueueSize: result.maxQueueSize }, 503);
|
|
565
|
+
}
|
|
566
|
+
// Check if request was queued
|
|
567
|
+
if (isQueuedResponse(result)) {
|
|
568
|
+
return c.json(result, 202); // 202 Accepted - queued for processing
|
|
569
|
+
}
|
|
570
|
+
return c.json({
|
|
571
|
+
sessionId: result.sessionId,
|
|
572
|
+
processId: result.id,
|
|
573
|
+
permissionMode: result.permissionMode,
|
|
574
|
+
modeVersion: result.modeVersion,
|
|
575
|
+
});
|
|
576
|
+
});
|
|
577
|
+
// POST /api/projects/:projectId/sessions/:sessionId/resume - Resume session
|
|
578
|
+
routes.post("/projects/:projectId/sessions/:sessionId/resume", async (c) => {
|
|
579
|
+
const projectId = c.req.param("projectId");
|
|
580
|
+
const sessionId = c.req.param("sessionId");
|
|
581
|
+
// Validate projectId format at API boundary
|
|
582
|
+
if (!isUrlProjectId(projectId)) {
|
|
583
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
584
|
+
}
|
|
585
|
+
// Use getOrCreateProject to allow resuming in directories that may have been moved
|
|
586
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
587
|
+
if (!project) {
|
|
588
|
+
return c.json({ error: "Project not found or path does not exist" }, 404);
|
|
589
|
+
}
|
|
590
|
+
let body;
|
|
591
|
+
try {
|
|
592
|
+
body = await c.req.json();
|
|
593
|
+
}
|
|
594
|
+
catch {
|
|
595
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
596
|
+
}
|
|
597
|
+
if (!body.message) {
|
|
598
|
+
return c.json({ error: "Message is required" }, 400);
|
|
599
|
+
}
|
|
600
|
+
const userMessage = {
|
|
601
|
+
text: body.message,
|
|
602
|
+
images: body.images,
|
|
603
|
+
documents: body.documents,
|
|
604
|
+
attachments: body.attachments,
|
|
605
|
+
mode: body.mode,
|
|
606
|
+
tempId: body.tempId,
|
|
607
|
+
};
|
|
608
|
+
// Convert thinking option to token budget
|
|
609
|
+
const maxThinkingTokens = body.thinking && body.thinking !== "off"
|
|
610
|
+
? thinkingOptionToTokens(body.thinking)
|
|
611
|
+
: undefined;
|
|
612
|
+
// Convert model option (undefined or "default" means use CLI default)
|
|
613
|
+
const model = body.model && body.model !== "default" ? body.model : undefined;
|
|
614
|
+
const result = await deps.supervisor.resumeSession(sessionId, project.path, userMessage, body.mode, { model, maxThinkingTokens, providerName: body.provider });
|
|
615
|
+
// Check if queue is full
|
|
616
|
+
if (isQueueFullResponse(result)) {
|
|
617
|
+
return c.json({ error: "Queue is full", maxQueueSize: result.maxQueueSize }, 503);
|
|
618
|
+
}
|
|
619
|
+
// Check if request was queued
|
|
620
|
+
if (isQueuedResponse(result)) {
|
|
621
|
+
return c.json(result, 202); // 202 Accepted - queued for processing
|
|
622
|
+
}
|
|
623
|
+
return c.json({
|
|
624
|
+
processId: result.id,
|
|
625
|
+
permissionMode: result.permissionMode,
|
|
626
|
+
modeVersion: result.modeVersion,
|
|
627
|
+
});
|
|
628
|
+
});
|
|
629
|
+
// POST /api/sessions/:sessionId/messages - Queue message
|
|
630
|
+
routes.post("/sessions/:sessionId/messages", async (c) => {
|
|
631
|
+
const sessionId = c.req.param("sessionId");
|
|
632
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
633
|
+
if (!process) {
|
|
634
|
+
return c.json({ error: "No active process for session" }, 404);
|
|
635
|
+
}
|
|
636
|
+
let body;
|
|
637
|
+
try {
|
|
638
|
+
body = await c.req.json();
|
|
639
|
+
}
|
|
640
|
+
catch {
|
|
641
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
642
|
+
}
|
|
643
|
+
if (!body.message) {
|
|
644
|
+
return c.json({ error: "Message is required" }, 400);
|
|
645
|
+
}
|
|
646
|
+
const userMessage = {
|
|
647
|
+
text: body.message,
|
|
648
|
+
images: body.images,
|
|
649
|
+
documents: body.documents,
|
|
650
|
+
attachments: body.attachments,
|
|
651
|
+
mode: body.mode,
|
|
652
|
+
tempId: body.tempId,
|
|
653
|
+
};
|
|
654
|
+
// Check if process is terminated
|
|
655
|
+
if (process.isTerminated) {
|
|
656
|
+
return c.json({
|
|
657
|
+
error: "Process terminated",
|
|
658
|
+
reason: process.terminationReason,
|
|
659
|
+
}, 410); // 410 Gone
|
|
660
|
+
}
|
|
661
|
+
// Convert thinking option to token budget
|
|
662
|
+
const maxThinkingTokens = body.thinking && body.thinking !== "off"
|
|
663
|
+
? thinkingOptionToTokens(body.thinking)
|
|
664
|
+
: undefined;
|
|
665
|
+
// Use queueMessageToSession which handles thinking mode changes
|
|
666
|
+
// If thinking mode changed, it will restart the process automatically
|
|
667
|
+
const result = await deps.supervisor.queueMessageToSession(sessionId, process.projectPath, userMessage, body.mode, { maxThinkingTokens });
|
|
668
|
+
if (!result.success) {
|
|
669
|
+
return c.json({
|
|
670
|
+
error: "Failed to queue message",
|
|
671
|
+
reason: result.error,
|
|
672
|
+
}, 410); // 410 Gone - process is no longer available
|
|
673
|
+
}
|
|
674
|
+
return c.json({
|
|
675
|
+
queued: true,
|
|
676
|
+
restarted: result.restarted,
|
|
677
|
+
processId: result.process.id,
|
|
678
|
+
});
|
|
679
|
+
});
|
|
680
|
+
// PUT /api/sessions/:sessionId/mode - Update permission mode without sending a message
|
|
681
|
+
routes.put("/sessions/:sessionId/mode", async (c) => {
|
|
682
|
+
const sessionId = c.req.param("sessionId");
|
|
683
|
+
const body = await c.req.json();
|
|
684
|
+
if (!body.mode) {
|
|
685
|
+
return c.json({ error: "mode is required" }, 400);
|
|
686
|
+
}
|
|
687
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
688
|
+
if (!process) {
|
|
689
|
+
return c.json({ error: "No active process for session" }, 404);
|
|
690
|
+
}
|
|
691
|
+
process.setPermissionMode(body.mode);
|
|
692
|
+
return c.json({
|
|
693
|
+
permissionMode: process.permissionMode,
|
|
694
|
+
modeVersion: process.modeVersion,
|
|
695
|
+
});
|
|
696
|
+
});
|
|
697
|
+
// PUT /api/sessions/:sessionId/hold - Set hold (soft pause) mode
|
|
698
|
+
routes.put("/sessions/:sessionId/hold", async (c) => {
|
|
699
|
+
const sessionId = c.req.param("sessionId");
|
|
700
|
+
const body = await c.req.json();
|
|
701
|
+
if (typeof body.hold !== "boolean") {
|
|
702
|
+
return c.json({ error: "hold is required (boolean)" }, 400);
|
|
703
|
+
}
|
|
704
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
705
|
+
if (!process) {
|
|
706
|
+
return c.json({ error: "No active process for session" }, 404);
|
|
707
|
+
}
|
|
708
|
+
process.setHold(body.hold);
|
|
709
|
+
return c.json({
|
|
710
|
+
isHeld: process.isHeld,
|
|
711
|
+
holdSince: process.holdSince?.toISOString() ?? null,
|
|
712
|
+
state: process.state.type,
|
|
713
|
+
});
|
|
714
|
+
});
|
|
715
|
+
// GET /api/sessions/:sessionId/pending-input - Get pending input request
|
|
716
|
+
routes.get("/sessions/:sessionId/pending-input", async (c) => {
|
|
717
|
+
const sessionId = c.req.param("sessionId");
|
|
718
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
719
|
+
if (!process) {
|
|
720
|
+
return c.json({ request: null });
|
|
721
|
+
}
|
|
722
|
+
// Use getPendingInputRequest which works for both mock and real SDK
|
|
723
|
+
const request = process.getPendingInputRequest();
|
|
724
|
+
return c.json({ request });
|
|
725
|
+
});
|
|
726
|
+
// GET /api/sessions/:sessionId/process - Get process info for a session
|
|
727
|
+
routes.get("/sessions/:sessionId/process", async (c) => {
|
|
728
|
+
const sessionId = c.req.param("sessionId");
|
|
729
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
730
|
+
if (!process) {
|
|
731
|
+
return c.json({ process: null });
|
|
732
|
+
}
|
|
733
|
+
return c.json({ process: process.getInfo() });
|
|
734
|
+
});
|
|
735
|
+
// POST /api/sessions/:sessionId/input - Respond to input request
|
|
736
|
+
routes.post("/sessions/:sessionId/input", async (c) => {
|
|
737
|
+
const sessionId = c.req.param("sessionId");
|
|
738
|
+
const process = deps.supervisor.getProcessForSession(sessionId);
|
|
739
|
+
if (!process) {
|
|
740
|
+
return c.json({ error: "No active process for session" }, 404);
|
|
741
|
+
}
|
|
742
|
+
if (process.state.type !== "waiting-input") {
|
|
743
|
+
return c.json({ error: "No pending input request" }, 400);
|
|
744
|
+
}
|
|
745
|
+
let body;
|
|
746
|
+
try {
|
|
747
|
+
body = await c.req.json();
|
|
748
|
+
}
|
|
749
|
+
catch {
|
|
750
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
751
|
+
}
|
|
752
|
+
if (!body.requestId || !body.response) {
|
|
753
|
+
return c.json({ error: "requestId and response are required" }, 400);
|
|
754
|
+
}
|
|
755
|
+
// Handle approve_accept_edits: approve and switch permission mode
|
|
756
|
+
const isApproveAcceptEdits = body.response === "approve_accept_edits";
|
|
757
|
+
// Normalize response to approve/deny
|
|
758
|
+
const normalizedResponse = body.response === "approve" ||
|
|
759
|
+
body.response === "allow" ||
|
|
760
|
+
body.response === "approve_accept_edits"
|
|
761
|
+
? "approve"
|
|
762
|
+
: "deny";
|
|
763
|
+
// Call respondToInput which resolves the SDK's canUseTool promise
|
|
764
|
+
const accepted = process.respondToInput(body.requestId, normalizedResponse, body.answers, body.feedback);
|
|
765
|
+
if (!accepted) {
|
|
766
|
+
return c.json({ error: "Invalid request ID or no pending request" }, 400);
|
|
767
|
+
}
|
|
768
|
+
// If approve_accept_edits, switch the permission mode
|
|
769
|
+
if (isApproveAcceptEdits) {
|
|
770
|
+
process.setPermissionMode("acceptEdits");
|
|
771
|
+
}
|
|
772
|
+
return c.json({ accepted: true });
|
|
773
|
+
});
|
|
774
|
+
// POST /api/sessions/:sessionId/mark-seen - Mark session as seen (read)
|
|
775
|
+
routes.post("/sessions/:sessionId/mark-seen", async (c) => {
|
|
776
|
+
const sessionId = c.req.param("sessionId");
|
|
777
|
+
if (!deps.notificationService) {
|
|
778
|
+
return c.json({ error: "Notification service not available" }, 503);
|
|
779
|
+
}
|
|
780
|
+
let body = {};
|
|
781
|
+
try {
|
|
782
|
+
body = await c.req.json();
|
|
783
|
+
}
|
|
784
|
+
catch {
|
|
785
|
+
// Body is optional
|
|
786
|
+
}
|
|
787
|
+
await deps.notificationService.markSeen(sessionId, body.timestamp, body.messageId);
|
|
788
|
+
return c.json({ marked: true });
|
|
789
|
+
});
|
|
790
|
+
// DELETE /api/sessions/:sessionId/mark-seen - Mark session as unread
|
|
791
|
+
routes.delete("/sessions/:sessionId/mark-seen", async (c) => {
|
|
792
|
+
const sessionId = c.req.param("sessionId");
|
|
793
|
+
if (!deps.notificationService) {
|
|
794
|
+
return c.json({ error: "Notification service not available" }, 503);
|
|
795
|
+
}
|
|
796
|
+
await deps.notificationService.clearSession(sessionId);
|
|
797
|
+
// Emit event so other tabs/clients can update
|
|
798
|
+
if (deps.eventBus) {
|
|
799
|
+
deps.eventBus.emit({
|
|
800
|
+
type: "session-seen",
|
|
801
|
+
sessionId,
|
|
802
|
+
timestamp: "", // Empty timestamp signals "unread"
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
return c.json({ marked: false });
|
|
806
|
+
});
|
|
807
|
+
// GET /api/notifications/last-seen - Get all last seen entries
|
|
808
|
+
routes.get("/notifications/last-seen", async (c) => {
|
|
809
|
+
if (!deps.notificationService) {
|
|
810
|
+
return c.json({ error: "Notification service not available" }, 503);
|
|
811
|
+
}
|
|
812
|
+
return c.json({ lastSeen: deps.notificationService.getAllLastSeen() });
|
|
813
|
+
});
|
|
814
|
+
// GET /api/debug/metadata - Debug endpoint to inspect metadata service state
|
|
815
|
+
routes.get("/debug/metadata", (c) => {
|
|
816
|
+
if (!deps.sessionMetadataService) {
|
|
817
|
+
return c.json({ error: "Session metadata service not available", available: false }, 503);
|
|
818
|
+
}
|
|
819
|
+
const allMetadata = deps.sessionMetadataService.getAllMetadata();
|
|
820
|
+
const sessionCount = Object.keys(allMetadata).length;
|
|
821
|
+
const starredCount = Object.values(allMetadata).filter((m) => m.isStarred).length;
|
|
822
|
+
const archivedCount = Object.values(allMetadata).filter((m) => m.isArchived).length;
|
|
823
|
+
const filePath = deps.sessionMetadataService.getFilePath();
|
|
824
|
+
return c.json({
|
|
825
|
+
available: true,
|
|
826
|
+
filePath,
|
|
827
|
+
sessionCount,
|
|
828
|
+
starredCount,
|
|
829
|
+
archivedCount,
|
|
830
|
+
});
|
|
831
|
+
});
|
|
832
|
+
// PUT /api/sessions/:sessionId/metadata - Update session metadata (title, archived, starred)
|
|
833
|
+
routes.put("/sessions/:sessionId/metadata", async (c) => {
|
|
834
|
+
const sessionId = c.req.param("sessionId");
|
|
835
|
+
if (!deps.sessionMetadataService) {
|
|
836
|
+
return c.json({ error: "Session metadata service not available" }, 503);
|
|
837
|
+
}
|
|
838
|
+
let body = {};
|
|
839
|
+
try {
|
|
840
|
+
body = await c.req.json();
|
|
841
|
+
}
|
|
842
|
+
catch {
|
|
843
|
+
return c.json({ error: "Invalid JSON body" }, 400);
|
|
844
|
+
}
|
|
845
|
+
// At least one field must be provided
|
|
846
|
+
if (body.title === undefined &&
|
|
847
|
+
body.archived === undefined &&
|
|
848
|
+
body.starred === undefined) {
|
|
849
|
+
return c.json({ error: "At least title, archived, or starred must be provided" }, 400);
|
|
850
|
+
}
|
|
851
|
+
await deps.sessionMetadataService.updateMetadata(sessionId, {
|
|
852
|
+
title: body.title,
|
|
853
|
+
archived: body.archived,
|
|
854
|
+
starred: body.starred,
|
|
855
|
+
});
|
|
856
|
+
// Emit SSE event so sidebar and other clients can update
|
|
857
|
+
if (deps.eventBus) {
|
|
858
|
+
deps.eventBus.emit({
|
|
859
|
+
type: "session-metadata-changed",
|
|
860
|
+
sessionId,
|
|
861
|
+
title: body.title,
|
|
862
|
+
archived: body.archived,
|
|
863
|
+
starred: body.starred,
|
|
864
|
+
timestamp: new Date().toISOString(),
|
|
865
|
+
});
|
|
866
|
+
}
|
|
867
|
+
return c.json({ updated: true });
|
|
868
|
+
});
|
|
869
|
+
// POST /api/projects/:projectId/sessions/:sessionId/clone - Clone a session
|
|
870
|
+
routes.post("/projects/:projectId/sessions/:sessionId/clone", async (c) => {
|
|
871
|
+
const projectId = c.req.param("projectId");
|
|
872
|
+
const sessionId = c.req.param("sessionId");
|
|
873
|
+
// Validate projectId format at API boundary
|
|
874
|
+
if (!isUrlProjectId(projectId)) {
|
|
875
|
+
return c.json({ error: "Invalid project ID format" }, 400);
|
|
876
|
+
}
|
|
877
|
+
const project = await deps.scanner.getOrCreateProject(projectId);
|
|
878
|
+
if (!project) {
|
|
879
|
+
return c.json({ error: "Project not found" }, 404);
|
|
880
|
+
}
|
|
881
|
+
// Only Claude sessions can be cloned for now
|
|
882
|
+
if (project.provider !== "claude") {
|
|
883
|
+
return c.json({ error: "Clone is only supported for Claude sessions" }, 400);
|
|
884
|
+
}
|
|
885
|
+
let body = {};
|
|
886
|
+
try {
|
|
887
|
+
body = await c.req.json();
|
|
888
|
+
}
|
|
889
|
+
catch {
|
|
890
|
+
// Body is optional
|
|
891
|
+
}
|
|
892
|
+
try {
|
|
893
|
+
// Get session directory from project
|
|
894
|
+
const sessionDir = project.sessionDir;
|
|
895
|
+
if (!sessionDir) {
|
|
896
|
+
return c.json({ error: "Session directory not found" }, 500);
|
|
897
|
+
}
|
|
898
|
+
// Get original session to extract title for the clone
|
|
899
|
+
const reader = deps.readerFactory(project);
|
|
900
|
+
const originalSession = await reader.getSessionSummary(sessionId, projectId);
|
|
901
|
+
const result = await cloneClaudeSession(sessionDir, sessionId);
|
|
902
|
+
// Build clone title: use provided title, or derive from original
|
|
903
|
+
let cloneTitle = body.title;
|
|
904
|
+
if (!cloneTitle && deps.sessionMetadataService) {
|
|
905
|
+
// Check for custom title first, then fall back to auto-generated title
|
|
906
|
+
const originalMetadata = deps.sessionMetadataService.getMetadata(sessionId);
|
|
907
|
+
const originalTitle = originalMetadata?.customTitle ?? originalSession?.title;
|
|
908
|
+
if (originalTitle) {
|
|
909
|
+
cloneTitle = `${originalTitle} [cloned]`;
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
// Set the clone title
|
|
913
|
+
if (cloneTitle && deps.sessionMetadataService) {
|
|
914
|
+
await deps.sessionMetadataService.updateMetadata(result.newSessionId, {
|
|
915
|
+
title: cloneTitle,
|
|
916
|
+
});
|
|
917
|
+
}
|
|
918
|
+
return c.json({
|
|
919
|
+
sessionId: result.newSessionId,
|
|
920
|
+
messageCount: result.entries,
|
|
921
|
+
clonedFrom: sessionId,
|
|
922
|
+
provider: "claude",
|
|
923
|
+
});
|
|
924
|
+
}
|
|
925
|
+
catch (error) {
|
|
926
|
+
const message = error instanceof Error ? error.message : "Failed to clone session";
|
|
927
|
+
return c.json({ error: message }, 500);
|
|
928
|
+
}
|
|
929
|
+
});
|
|
930
|
+
// ============ Worker Queue Endpoints ============
|
|
931
|
+
// GET /api/status/workers - Get worker activity for safe restart indicator
|
|
932
|
+
routes.get("/status/workers", (c) => {
|
|
933
|
+
const activity = deps.supervisor.getWorkerActivity();
|
|
934
|
+
return c.json(activity);
|
|
935
|
+
});
|
|
936
|
+
// GET /api/queue - Get all queued requests
|
|
937
|
+
routes.get("/queue", (c) => {
|
|
938
|
+
const queue = deps.supervisor.getQueueInfo();
|
|
939
|
+
const poolStatus = deps.supervisor.getWorkerPoolStatus();
|
|
940
|
+
return c.json({ queue, ...poolStatus });
|
|
941
|
+
});
|
|
942
|
+
// GET /api/queue/:queueId - Get specific queue entry position
|
|
943
|
+
routes.get("/queue/:queueId", (c) => {
|
|
944
|
+
const queueId = c.req.param("queueId");
|
|
945
|
+
const position = deps.supervisor.getQueuePosition(queueId);
|
|
946
|
+
if (position === undefined) {
|
|
947
|
+
return c.json({ error: "Queue entry not found" }, 404);
|
|
948
|
+
}
|
|
949
|
+
return c.json({ queueId, position });
|
|
950
|
+
});
|
|
951
|
+
// DELETE /api/queue/:queueId - Cancel a queued request
|
|
952
|
+
routes.delete("/queue/:queueId", (c) => {
|
|
953
|
+
const queueId = c.req.param("queueId");
|
|
954
|
+
const cancelled = deps.supervisor.cancelQueuedRequest(queueId);
|
|
955
|
+
if (!cancelled) {
|
|
956
|
+
return c.json({ error: "Queue entry not found or already processed" }, 404);
|
|
957
|
+
}
|
|
958
|
+
return c.json({ cancelled: true });
|
|
959
|
+
});
|
|
960
|
+
return routes;
|
|
961
|
+
}
|
|
962
|
+
//# sourceMappingURL=sessions.js.map
|