@jingyi0605/codingns 0.7.4 → 0.8.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/README.md +6 -0
- package/bin/codingns.mjs +747 -28
- package/bin/office-mcp-server.mjs +620 -0
- package/dist/public/assets/{AdaptiveButlerPage-CgBX49t-.js → AdaptiveButlerPage-BsgVNRAa.js} +1 -1
- package/dist/public/assets/{App-tXOqoHNl.js → App-tPcbyRdS.js} +3 -3
- package/dist/public/assets/{BootstrapPage-DoRMz87R.js → BootstrapPage--MDOigQi.js} +1 -1
- package/dist/public/assets/{ConversationPage-DXR6Hp4O.js → ConversationPage-BBss5ED8.js} +6 -6
- package/dist/public/assets/{DesktopDetachPreviewPage-Cyk-ZYCk.js → DesktopDetachPreviewPage-CB8DoqwU.js} +1 -1
- package/dist/public/assets/{DesktopWindowPage-DNVNK3hs.js → DesktopWindowPage-GtIx5m8K.js} +1 -1
- package/dist/public/assets/FileContextPanel-BcM7AIT4.js +1 -0
- package/dist/public/assets/{GitSidebar-Cr3Z9OUI.js → GitSidebar-CMtkaxuI.js} +2 -2
- package/dist/public/assets/{MobileCreateSessionSheet-DMW0V6GJ.js → MobileCreateSessionSheet-CrFY41_8.js} +1 -1
- package/dist/public/assets/{MobileTopHeaderFrame-CkdnZ_MU.js → MobileTopHeaderFrame-DGVOzXyg.js} +1 -1
- package/dist/public/assets/{MobileWorkspaceSwitcherHeader-KIbqBYJN.js → MobileWorkspaceSwitcherHeader-DLkACTnQ.js} +1 -1
- package/dist/public/assets/{RelayConnectEntryPage-DIRBH3hw.js → RelayConnectEntryPage-0MPPjxtQ.js} +1 -1
- package/dist/public/assets/{ServerSettingsModal-C-9RxdWP.js → ServerSettingsModal-vgOhwus4.js} +1 -1
- package/dist/public/assets/{SessionIndexPage-bRlIydRA.js → SessionIndexPage-KK626Ra9.js} +1 -1
- package/dist/public/assets/{SettingsPage-CMEt4ua9.js → SettingsPage-B3edBJIo.js} +2 -2
- package/dist/public/assets/{TerminalManagerPanel-2bi9wVhT.js → TerminalManagerPanel-BxlhZp8c.js} +1 -1
- package/dist/public/assets/{TerminalPage-DayZz2Tf.js → TerminalPage-B6Rdhylx.js} +1 -1
- package/dist/public/assets/{TerminalRuntimeFallbackModal-DgwYcp-Y.js → TerminalRuntimeFallbackModal-BVLfrpSa.js} +1 -1
- package/dist/public/assets/{ToolFilesPage-YvnP_FXW.js → ToolFilesPage-N_gwwUjD.js} +1 -1
- package/dist/public/assets/{ToolGitPage-GMcQKtV9.js → ToolGitPage-DOcuuWM1.js} +1 -1
- package/dist/public/assets/{ToolProcessesPage-DFIQ7BCd.js → ToolProcessesPage-D-FfJ7Re.js} +1 -1
- package/dist/public/assets/{ToolsHomePage-CSilFzXR.js → ToolsHomePage-CHfPxd20.js} +1 -1
- package/dist/public/assets/{WorkbenchLandingPage-1VtToSz9.js → WorkbenchLandingPage-CTTnfovY.js} +1 -1
- package/dist/public/assets/WorkbenchLayout-CbpJg0g1.js +244 -0
- package/dist/public/assets/{WorkbenchModal-BWXYSXmC.js → WorkbenchModal-Bt_1fYmM.js} +1 -1
- package/dist/public/assets/WorkbenchShellRoute-B4XB8SwG.css +1 -0
- package/dist/public/assets/WorkbenchShellRoute-DyaMnPfS.js +1 -0
- package/dist/public/assets/{WorkspaceDebugDetailPage-Ux8_Q7la.js → WorkspaceDebugDetailPage-s7yuDIxR.js} +1 -1
- package/dist/public/assets/{WorkspaceDetailPage-B402p99m.js → WorkspaceDetailPage-Cf-gVpqK.js} +1 -1
- package/dist/public/assets/{WorkspaceHomePage-D2pob6HI.js → WorkspaceHomePage-COf6I8sT.js} +1 -1
- package/dist/public/assets/{client-runtime-manager-C5D76ewj.js → client-runtime-manager-DGdKvYzx.js} +1 -1
- package/dist/public/assets/file-tree-icon-BeHqeru9.js +590 -0
- package/dist/public/assets/index-CcaQt50x.css +1 -0
- package/dist/public/assets/index-CuzMc7q2.js +42 -0
- package/dist/public/assets/{login-direct-candidate-resolver-wXSaB0i7.js → login-direct-candidate-resolver-DEP_xCmR.js} +1 -1
- package/dist/public/assets/{model-switch-api-CPtou49j.js → model-switch-api-c6kcbBGm.js} +1 -1
- package/dist/public/assets/{preferences-service-CdaK7zA8.js → preferences-service-CV6Ih0BG.js} +1 -1
- package/dist/public/assets/{realtime-client-BjQazYsK.js → realtime-client-CRCx5xBt.js} +1 -1
- package/dist/public/assets/{relay-entry-BwE5nw0l.js → relay-entry-C751A-Sm.js} +1 -1
- package/dist/public/assets/{terminal-runtime-meta-C-Lbyx2i.js → terminal-runtime-meta-CRAVR-8G.js} +1 -1
- package/dist/public/assets/{useRegisteredDebugTemplates-BM7-c-gx.js → useRegisteredDebugTemplates-D6YtNS0r.js} +1 -1
- package/dist/public/index.html +2 -2
- package/dist/server/config/env.d.ts +3 -0
- package/dist/server/config/env.js +67 -1
- package/dist/server/config/env.js.map +1 -1
- package/dist/server/config/opencode-base-url-resolver.d.ts +3 -2
- package/dist/server/config/opencode-base-url-resolver.js +64 -24
- package/dist/server/config/opencode-base-url-resolver.js.map +1 -1
- package/dist/server/middlewares/auth-guard.js +4 -0
- package/dist/server/middlewares/auth-guard.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.d.ts +168 -1
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js +205 -4
- package/dist/server/modules/assistant-capability/assistant-capability-controller.js.map +1 -1
- package/dist/server/modules/assistant-capability/assistant-capability-service.d.ts +296 -2
- package/dist/server/modules/assistant-capability/assistant-capability-service.js +872 -3
- package/dist/server/modules/assistant-capability/assistant-capability-service.js.map +1 -1
- package/dist/server/modules/auth/auth-service.d.ts +21 -1
- package/dist/server/modules/auth/auth-service.js +64 -0
- package/dist/server/modules/auth/auth-service.js.map +1 -1
- package/dist/server/modules/browser-runtime/browser-profile-service.d.ts +26 -0
- package/dist/server/modules/browser-runtime/browser-profile-service.js +85 -0
- package/dist/server/modules/browser-runtime/browser-profile-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.d.ts +69 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js +83 -0
- package/dist/server/modules/browser-runtime/browser-runtime-controller.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.d.ts +56 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.js +215 -0
- package/dist/server/modules/browser-runtime/browser-runtime-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.d.ts +65 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.js +432 -0
- package/dist/server/modules/browser-runtime/browser-task-execution-support.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.d.ts +7 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.js +21 -0
- package/dist/server/modules/browser-runtime/browser-task-executor-registry.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.d.ts +55 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.js +2 -0
- package/dist/server/modules/browser-runtime/browser-task-executor.js.map +1 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.d.ts +31 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.js +55 -0
- package/dist/server/modules/browser-runtime/browser-task-payload.js.map +1 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.d.ts +19 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js +219 -0
- package/dist/server/modules/browser-runtime/opencli-bridge-browser-executor.js.map +1 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.d.ts +15 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js +33 -0
- package/dist/server/modules/browser-runtime/opencli-browser-bridge-service.js.map +1 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.d.ts +16 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.js +272 -0
- package/dist/server/modules/browser-runtime/playwright-browser-executor.js.map +1 -0
- package/dist/server/modules/butler/butler-auth-service.js +4 -0
- package/dist/server/modules/butler/butler-auth-service.js.map +1 -1
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js +1 -0
- package/dist/server/modules/butler/butler-inbox-instruction-adapter.js.map +1 -1
- package/dist/server/modules/butler/butler-session-summary-service.d.ts +1 -0
- package/dist/server/modules/butler/butler-session-summary-service.js +5 -3
- package/dist/server/modules/butler/butler-session-summary-service.js.map +1 -1
- package/dist/server/modules/butler/butler-workspace-context.js +23 -0
- package/dist/server/modules/butler/butler-workspace-context.js.map +1 -1
- package/dist/server/modules/debug-target/debug-target-service.d.ts +2 -0
- package/dist/server/modules/debug-target/debug-target-service.js +14 -0
- package/dist/server/modules/debug-target/debug-target-service.js.map +1 -1
- package/dist/server/modules/document-runtime/document-docx-fallback-renderer.py +139 -0
- package/dist/server/modules/document-runtime/document-export-executor.d.ts +50 -0
- package/dist/server/modules/document-runtime/document-export-executor.js +827 -0
- package/dist/server/modules/document-runtime/document-export-executor.js.map +1 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.d.ts +127 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.js +131 -0
- package/dist/server/modules/document-runtime/document-runtime-controller.js.map +1 -0
- package/dist/server/modules/document-runtime/document-runtime-service.d.ts +125 -0
- package/dist/server/modules/document-runtime/document-runtime-service.js +706 -0
- package/dist/server/modules/document-runtime/document-runtime-service.js.map +1 -0
- package/dist/server/modules/office/office-controller.d.ts +77 -0
- package/dist/server/modules/office/office-controller.js +174 -0
- package/dist/server/modules/office/office-controller.js.map +1 -0
- package/dist/server/modules/office/office-preview-link-service.d.ts +27 -0
- package/dist/server/modules/office/office-preview-link-service.js +121 -0
- package/dist/server/modules/office/office-preview-link-service.js.map +1 -0
- package/dist/server/modules/office/office-service.d.ts +67 -0
- package/dist/server/modules/office/office-service.js +359 -0
- package/dist/server/modules/office/office-service.js.map +1 -0
- package/dist/server/modules/opencli/opencli-bridge-skill-service.js +38 -14
- package/dist/server/modules/opencli/opencli-bridge-skill-service.js.map +1 -1
- package/dist/server/modules/opencli/opencli-install-discovery.d.ts +4 -0
- package/dist/server/modules/opencli/opencli-install-discovery.js +94 -0
- package/dist/server/modules/opencli/opencli-install-discovery.js.map +1 -1
- package/dist/server/modules/opencli/opencli-runtime-builder.js +29 -0
- package/dist/server/modules/opencli/opencli-runtime-builder.js.map +1 -1
- package/dist/server/modules/opencli/opencli-runtime-guard.d.ts +2 -0
- package/dist/server/modules/opencli/opencli-runtime-guard.js +5 -0
- package/dist/server/modules/opencli/opencli-runtime-guard.js.map +1 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.d.ts +70 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.js +83 -0
- package/dist/server/modules/ops-runtime/ops-runtime-controller.js.map +1 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.d.ts +80 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.js +327 -0
- package/dist/server/modules/ops-runtime/ops-runtime-service.js.map +1 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.d.ts +41 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.js +478 -0
- package/dist/server/modules/ops-runtime/ssh-ops-executor.js.map +1 -0
- package/dist/server/modules/presentation/presentation-controller.d.ts +22 -0
- package/dist/server/modules/presentation/presentation-controller.js +59 -0
- package/dist/server/modules/presentation/presentation-controller.js.map +1 -0
- package/dist/server/modules/presentation/presentation-export-task-service.d.ts +24 -0
- package/dist/server/modules/presentation/presentation-export-task-service.js +137 -0
- package/dist/server/modules/presentation/presentation-export-task-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-export-types.d.ts +12 -0
- package/dist/server/modules/presentation/presentation-export-types.js +2 -0
- package/dist/server/modules/presentation/presentation-export-types.js.map +1 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.d.ts +20 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.js +29 -0
- package/dist/server/modules/presentation/presentation-pdf-export-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.d.ts +20 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.js +64 -0
- package/dist/server/modules/presentation/presentation-pptx-export-service.js.map +1 -0
- package/dist/server/modules/presentation/presentation-renderer.d.ts +21 -0
- package/dist/server/modules/presentation/presentation-renderer.js +208 -0
- package/dist/server/modules/presentation/presentation-renderer.js.map +1 -0
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js +3 -3
- package/dist/server/modules/relay-tunnel/relay-tunnel-gateway-service.js.map +1 -1
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js +6 -1
- package/dist/server/modules/relay-tunnel/relay-tunnel-service.js.map +1 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js +2 -1
- package/dist/server/modules/sessions/codex-app-server-helper-process.js.map +1 -1
- package/dist/server/modules/sessions/session-controller.d.ts +1 -0
- package/dist/server/modules/sessions/session-controller.js +59 -4
- package/dist/server/modules/sessions/session-controller.js.map +1 -1
- package/dist/server/modules/sessions/session-history-service.js +17 -5
- package/dist/server/modules/sessions/session-history-service.js.map +1 -1
- package/dist/server/modules/sessions/session-live-runtime-service.d.ts +5 -1
- package/dist/server/modules/sessions/session-live-runtime-service.js +86 -8
- package/dist/server/modules/sessions/session-live-runtime-service.js.map +1 -1
- package/dist/server/modules/sessions/session-provider-config-service.d.ts +25 -1
- package/dist/server/modules/sessions/session-provider-config-service.js +54 -5
- package/dist/server/modules/sessions/session-provider-config-service.js.map +1 -1
- package/dist/server/modules/sessions/workspace-office-mcp-config.d.ts +14 -0
- package/dist/server/modules/sessions/workspace-office-mcp-config.js +54 -0
- package/dist/server/modules/sessions/workspace-office-mcp-config.js.map +1 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.d.ts +27 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.js +109 -0
- package/dist/server/modules/sessions/workspace-session-auth-service.js.map +1 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.d.ts +50 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js +332 -0
- package/dist/server/modules/sessions/workspace-session-runtime-context-service.js.map +1 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js +5 -0
- package/dist/server/modules/skills/assistant-runtime-skill-catalog.js.map +1 -1
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/SKILL.md +67 -0
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/agents/openai.yaml +4 -0
- package/dist/server/modules/skills/builtin-skills/codingns-workspace-session/references/cli-workflow.md +133 -0
- package/dist/server/modules/skills/skill-controller.d.ts +7 -0
- package/dist/server/modules/skills/skill-controller.js +7 -0
- package/dist/server/modules/skills/skill-controller.js.map +1 -1
- package/dist/server/modules/skills/skill-manager-service.d.ts +61 -0
- package/dist/server/modules/skills/skill-manager-service.js +218 -0
- package/dist/server/modules/skills/skill-manager-service.js.map +1 -1
- package/dist/server/modules/skills/skill-name-policy.js +2 -1
- package/dist/server/modules/skills/skill-name-policy.js.map +1 -1
- package/dist/server/modules/tasks/task-helper-client.d.ts +1 -0
- package/dist/server/modules/tasks/task-helper-client.js +45 -9
- package/dist/server/modules/tasks/task-helper-client.js.map +1 -1
- package/dist/server/modules/tasks/task-types.d.ts +5 -0
- package/dist/server/modules/tasks/task-types.js +6 -1
- package/dist/server/modules/tasks/task-types.js.map +1 -1
- package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js +2 -1
- package/dist/server/modules/terminal/runtime/conpty-session-agent-process.js.map +1 -1
- package/dist/server/modules/terminal/runtime/node-pty-loader.d.ts +5 -0
- package/dist/server/modules/terminal/runtime/node-pty-loader.js +68 -0
- package/dist/server/modules/terminal/runtime/node-pty-loader.js.map +1 -0
- package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js +2 -1
- package/dist/server/modules/terminal/runtime/pty-broker-agent-process.js.map +1 -1
- package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js +6 -9
- package/dist/server/modules/terminal/runtime/pty-host-attachment-manager.js.map +1 -1
- package/dist/server/modules/terminal/runtime/pty-runtime-manager.js +6 -9
- package/dist/server/modules/terminal/runtime/pty-runtime-manager.js.map +1 -1
- package/dist/server/routes/assistant.d.ts +2 -1
- package/dist/server/routes/assistant.js +20 -1
- package/dist/server/routes/assistant.js.map +1 -1
- package/dist/server/routes/browser-runtime.d.ts +3 -0
- package/dist/server/routes/browser-runtime.js +14 -0
- package/dist/server/routes/browser-runtime.js.map +1 -0
- package/dist/server/routes/document-runtime.d.ts +3 -0
- package/dist/server/routes/document-runtime.js +18 -0
- package/dist/server/routes/document-runtime.js.map +1 -0
- package/dist/server/routes/office.d.ts +3 -0
- package/dist/server/routes/office.js +16 -0
- package/dist/server/routes/office.js.map +1 -0
- package/dist/server/routes/ops-runtime.d.ts +3 -0
- package/dist/server/routes/ops-runtime.js +13 -0
- package/dist/server/routes/ops-runtime.js.map +1 -0
- package/dist/server/routes/presentation.d.ts +3 -0
- package/dist/server/routes/presentation.js +5 -0
- package/dist/server/routes/presentation.js.map +1 -0
- package/dist/server/routes/skills.js +1 -0
- package/dist/server/routes/skills.js.map +1 -1
- package/dist/server/server/create-server.d.ts +36 -0
- package/dist/server/server/create-server.js +215 -4
- package/dist/server/server/create-server.js.map +1 -1
- package/dist/server/server/release-manifest-sync.d.ts +1 -0
- package/dist/server/server/release-manifest-sync.js +2 -2
- package/dist/server/server/release-manifest-sync.js.map +1 -1
- package/dist/server/server/start-host.js +1 -1
- package/dist/server/server/start-host.js.map +1 -1
- package/dist/server/storage/repositories/auth-token-repository.js +22 -6
- package/dist/server/storage/repositories/auth-token-repository.js.map +1 -1
- package/dist/server/storage/repositories/browser-profile-repository.d.ts +18 -0
- package/dist/server/storage/repositories/browser-profile-repository.js +134 -0
- package/dist/server/storage/repositories/browser-profile-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-comment-repository.d.ts +10 -0
- package/dist/server/storage/repositories/document-comment-repository.js +118 -0
- package/dist/server/storage/repositories/document-comment-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-repository.d.ts +16 -0
- package/dist/server/storage/repositories/document-repository.js +109 -0
- package/dist/server/storage/repositories/document-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-revision-repository.d.ts +10 -0
- package/dist/server/storage/repositories/document-revision-repository.js +79 -0
- package/dist/server/storage/repositories/document-revision-repository.js.map +1 -0
- package/dist/server/storage/repositories/document-template-repository.d.ts +13 -0
- package/dist/server/storage/repositories/document-template-repository.js +244 -0
- package/dist/server/storage/repositories/document-template-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-approval-repository.d.ts +11 -0
- package/dist/server/storage/repositories/office-approval-repository.js +109 -0
- package/dist/server/storage/repositories/office-approval-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-artifact-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-artifact-repository.js +89 -0
- package/dist/server/storage/repositories/office-artifact-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-audit-event-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-audit-event-repository.js +54 -0
- package/dist/server/storage/repositories/office-audit-event-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-connector-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-connector-repository.js +97 -0
- package/dist/server/storage/repositories/office-connector-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-receipt-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-receipt-repository.js +48 -0
- package/dist/server/storage/repositories/office-receipt-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.d.ts +8 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.js +60 -0
- package/dist/server/storage/repositories/office-rollback-record-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-task-repository.d.ts +19 -0
- package/dist/server/storage/repositories/office-task-repository.js +199 -0
- package/dist/server/storage/repositories/office-task-repository.js.map +1 -0
- package/dist/server/storage/repositories/office-task-step-repository.d.ts +10 -0
- package/dist/server/storage/repositories/office-task-step-repository.js +110 -0
- package/dist/server/storage/repositories/office-task-step-repository.js.map +1 -0
- package/dist/server/storage/repositories/ops-target-repository.d.ts +16 -0
- package/dist/server/storage/repositories/ops-target-repository.js +119 -0
- package/dist/server/storage/repositories/ops-target-repository.js.map +1 -0
- package/dist/server/storage/repositories/session-binding-repository.d.ts +4 -0
- package/dist/server/storage/repositories/session-binding-repository.js +70 -69
- package/dist/server/storage/repositories/session-binding-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-changed-file-repository.d.ts +6 -0
- package/dist/server/storage/repositories/session-changed-file-repository.js +44 -43
- package/dist/server/storage/repositories/session-changed-file-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-fork-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-fork-repository.js +42 -41
- package/dist/server/storage/repositories/session-fork-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-index-repository.d.ts +5 -0
- package/dist/server/storage/repositories/session-index-repository.js +153 -152
- package/dist/server/storage/repositories/session-index-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-attachment-repository.d.ts +7 -0
- package/dist/server/storage/repositories/session-message-attachment-repository.js +91 -90
- package/dist/server/storage/repositories/session-message-attachment-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-message-origin-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-message-origin-repository.js +25 -24
- package/dist/server/storage/repositories/session-message-origin-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-state-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-state-repository.js +35 -34
- package/dist/server/storage/repositories/session-state-repository.js.map +1 -1
- package/dist/server/storage/repositories/session-status-snapshot-repository.d.ts +2 -0
- package/dist/server/storage/repositories/session-status-snapshot-repository.js +25 -24
- package/dist/server/storage/repositories/session-status-snapshot-repository.js.map +1 -1
- package/dist/server/storage/sqlite/client.js +123 -1
- package/dist/server/storage/sqlite/client.js.map +1 -1
- package/dist/server/storage/sqlite/schema.sql +300 -1
- package/dist/server/types/domain.d.ts +205 -1
- package/package.json +14 -7
- package/scripts/postinstall.mjs +159 -7
- package/dist/public/assets/FileContextPanel-xGTYDclT.js +0 -1
- package/dist/public/assets/WorkbenchLayout-DScHaza9.js +0 -244
- package/dist/public/assets/WorkbenchShellRoute-DN6LdrqC.js +0 -1
- package/dist/public/assets/WorkbenchShellRoute-DhQo_0vu.css +0 -1
- package/dist/public/assets/file-tree-icon-lfU9Ag77.js +0 -3
- package/dist/public/assets/index-CFYXCsyx.css +0 -1
- package/dist/public/assets/index-NGxWr8Ix.js +0 -42
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.d.ts +0 -42
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js +0 -346
- package/node_modules/@codingns/session-sync-core/dist/claude-message-utils.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js +0 -80
- package/node_modules/@codingns/session-sync-core/dist/codex-resume-history.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/index.d.ts +0 -18
- package/node_modules/@codingns/session-sync-core/dist/index.js +0 -19
- package/node_modules/@codingns/session-sync-core/dist/index.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.d.ts +0 -18
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js +0 -659
- package/node_modules/@codingns/session-sync-core/dist/kimi-message-normalizer.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.d.ts +0 -11
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js +0 -72
- package/node_modules/@codingns/session-sync-core/dist/kimi-shared.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.d.ts +0 -67
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js +0 -752
- package/node_modules/@codingns/session-sync-core/dist/patch-builder.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.d.ts +0 -48
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js +0 -1184
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-code.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.d.ts +0 -11
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js +0 -105
- package/node_modules/@codingns/session-sync-core/dist/providers/claude-session-store.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.d.ts +0 -84
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js +0 -2436
- package/node_modules/@codingns/session-sync-core/dist/providers/codex.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.d.ts +0 -47
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js +0 -1480
- package/node_modules/@codingns/session-sync-core/dist/providers/gemini.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.d.ts +0 -33
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js +0 -684
- package/node_modules/@codingns/session-sync-core/dist/providers/kimi.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.d.ts +0 -9
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js +0 -17
- package/node_modules/@codingns/session-sync-core/dist/providers/legna-code.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js +0 -8
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-permissions.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.d.ts +0 -48
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js +0 -373
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode-shared.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.d.ts +0 -61
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js +0 -1191
- package/node_modules/@codingns/session-sync-core/dist/providers/opencode.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.d.ts +0 -27
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js +0 -415
- package/node_modules/@codingns/session-sync-core/dist/providers/utils.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/registry.d.ts +0 -7
- package/node_modules/@codingns/session-sync-core/dist/registry.js +0 -22
- package/node_modules/@codingns/session-sync-core/dist/registry.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.d.ts +0 -24
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js +0 -329
- package/node_modules/@codingns/session-sync-core/dist/runtime/active-run-registry.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.d.ts +0 -30
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js +0 -939
- package/node_modules/@codingns/session-sync-core/dist/runtime/claude-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.d.ts +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js +0 -16
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-permissions.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.d.ts +0 -70
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js +0 -2571
- package/node_modules/@codingns/session-sync-core/dist/runtime/codex-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.d.ts +0 -21
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js +0 -561
- package/node_modules/@codingns/session-sync-core/dist/runtime/gemini-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.d.ts +0 -38
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js +0 -911
- package/node_modules/@codingns/session-sync-core/dist/runtime/kimi-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.d.ts +0 -15
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js +0 -16
- package/node_modules/@codingns/session-sync-core/dist/runtime/legna-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.d.ts +0 -37
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js +0 -963
- package/node_modules/@codingns/session-sync-core/dist/runtime/opencode-runtime.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.d.ts +0 -21
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js +0 -168
- package/node_modules/@codingns/session-sync-core/dist/runtime/provider-runtime-service.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.d.ts +0 -152
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js +0 -2
- package/node_modules/@codingns/session-sync-core/dist/runtime/types.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/services.d.ts +0 -28
- package/node_modules/@codingns/session-sync-core/dist/services.js +0 -148
- package/node_modules/@codingns/session-sync-core/dist/services.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.d.ts +0 -6
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js +0 -9
- package/node_modules/@codingns/session-sync-core/dist/sqlite/node-sqlite.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/dist/types.d.ts +0 -198
- package/node_modules/@codingns/session-sync-core/dist/types.js +0 -2
- package/node_modules/@codingns/session-sync-core/dist/types.js.map +0 -1
- package/node_modules/@codingns/session-sync-core/package.json +0 -33
|
@@ -1,752 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 将各 provider 的编辑操作统一转换为 Codex apply_patch 格式,
|
|
3
|
-
* 使前端可复用同一套 diff 预览渲染逻辑。
|
|
4
|
-
*
|
|
5
|
-
* apply_patch 格式规范:
|
|
6
|
-
* *** Begin Patch
|
|
7
|
-
* *** Update File: <path> | *** Add File: <path> | *** Delete File: <path>
|
|
8
|
-
* @@ -old_start,old_count +new_start,new_count @@
|
|
9
|
-
* context line
|
|
10
|
-
* -removed line
|
|
11
|
-
* +added line
|
|
12
|
-
* *** End Patch
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* 将 Claude Code 的 Edit 工具输入转换为 apply_patch 格式。
|
|
16
|
-
* Edit 工具参数:{ file_path, old_string, new_string, replace_all? }
|
|
17
|
-
*/
|
|
18
|
-
export function buildApplyPatchFromClaudeEdit(input) {
|
|
19
|
-
const filePath = extractStringField(input, "file_path");
|
|
20
|
-
if (!filePath) {
|
|
21
|
-
return null;
|
|
22
|
-
}
|
|
23
|
-
const oldString = extractStringField(input, "old_string");
|
|
24
|
-
const newString = extractStringField(input, "new_string");
|
|
25
|
-
const oldLines = oldString.length > 0 ? oldString.split("\n") : [];
|
|
26
|
-
const newLines = newString.length > 0 ? newString.split("\n") : [];
|
|
27
|
-
return buildApplyPatchText([
|
|
28
|
-
{
|
|
29
|
-
action: "update",
|
|
30
|
-
filePath,
|
|
31
|
-
hunks: [{ oldLines, newLines }]
|
|
32
|
-
}
|
|
33
|
-
]);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 将 Claude Code 的 Write 工具输入转换为 apply_patch 格式。
|
|
37
|
-
* Write 工具参数:{ file_path, content }
|
|
38
|
-
* Write 是全量写入,视作新增文件处理。
|
|
39
|
-
*/
|
|
40
|
-
export function buildApplyPatchFromClaudeWrite(input) {
|
|
41
|
-
const filePath = extractStringField(input, "file_path");
|
|
42
|
-
if (!filePath) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
45
|
-
const content = extractStringField(input, "content");
|
|
46
|
-
const contentLines = content.length > 0 ? content.split("\n") : [];
|
|
47
|
-
return buildApplyPatchText([
|
|
48
|
-
{
|
|
49
|
-
action: "add",
|
|
50
|
-
filePath,
|
|
51
|
-
contentLines
|
|
52
|
-
}
|
|
53
|
-
]);
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* 将 OpenCode 的 patch 部分(仅含文件路径列表)转换为 apply_patch 格式。
|
|
57
|
-
* OpenCode 的 patch part 只提供文件名,不含实际 diff 内容,
|
|
58
|
-
* 转换后前端仍可显示变更文件列表。
|
|
59
|
-
*/
|
|
60
|
-
export function buildApplyPatchFromOpenCodePatch(files) {
|
|
61
|
-
if (files.length === 0) {
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
return buildApplyPatchText(files.map((filePath) => ({
|
|
65
|
-
action: "update",
|
|
66
|
-
filePath,
|
|
67
|
-
hunks: []
|
|
68
|
-
})));
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* 将只包含文件路径和变更类型的结果转换成 apply_patch。
|
|
72
|
-
* 这类数据常见于 Codex 的 `fileChange` 事件,本身没有 diff,
|
|
73
|
-
* 但前端至少可以据此展示文件级编辑摘要。
|
|
74
|
-
*/
|
|
75
|
-
export function buildApplyPatchFromFileChangeList(changes) {
|
|
76
|
-
const normalizedChanges = changes
|
|
77
|
-
.map((change) => {
|
|
78
|
-
const filePath = normalizePatchPath(change.path);
|
|
79
|
-
if (!filePath) {
|
|
80
|
-
return null;
|
|
81
|
-
}
|
|
82
|
-
return {
|
|
83
|
-
filePath,
|
|
84
|
-
action: normalizePatchAction(change.kind)
|
|
85
|
-
};
|
|
86
|
-
})
|
|
87
|
-
.filter((change) => Boolean(change));
|
|
88
|
-
if (normalizedChanges.length === 0) {
|
|
89
|
-
return null;
|
|
90
|
-
}
|
|
91
|
-
return buildApplyPatchText(normalizedChanges.map((change) => {
|
|
92
|
-
if (change.action === "add") {
|
|
93
|
-
return {
|
|
94
|
-
action: "add",
|
|
95
|
-
filePath: change.filePath,
|
|
96
|
-
contentLines: []
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
if (change.action === "delete") {
|
|
100
|
-
return {
|
|
101
|
-
action: "delete",
|
|
102
|
-
filePath: change.filePath
|
|
103
|
-
};
|
|
104
|
-
}
|
|
105
|
-
return {
|
|
106
|
-
action: "update",
|
|
107
|
-
filePath: change.filePath,
|
|
108
|
-
hunks: []
|
|
109
|
-
};
|
|
110
|
-
}));
|
|
111
|
-
}
|
|
112
|
-
/**
|
|
113
|
-
* Codex 新版本可能把文件编辑包在 exec_command/write_stdin 的命令文本里。
|
|
114
|
-
* 优先识别真实 apply_patch;其次从常见 `text.replace(old, new)` 脚本里还原行级 diff;
|
|
115
|
-
* 实在没有 old/new 信息时,才退回文件级编辑摘要。
|
|
116
|
-
*/
|
|
117
|
-
export function buildApplyPatchFromCodexCommandLikeValue(value) {
|
|
118
|
-
const texts = collectCodexCommandLikeTexts(value);
|
|
119
|
-
for (const text of texts) {
|
|
120
|
-
const patchText = extractFullApplyPatchText(text);
|
|
121
|
-
if (patchText) {
|
|
122
|
-
return normalizeApplyPatchText(patchText) ?? patchText;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
const editEntries = mergeCodexCommandEditEntries(texts.flatMap((text) => extractCodexCommandEditEntries(text)));
|
|
126
|
-
if (editEntries.length > 0) {
|
|
127
|
-
return buildApplyPatchText(editEntries);
|
|
128
|
-
}
|
|
129
|
-
const paths = dedupePatchPaths(texts.flatMap((text) => extractCodexCommandEditPaths(text)));
|
|
130
|
-
if (paths.length === 0) {
|
|
131
|
-
return null;
|
|
132
|
-
}
|
|
133
|
-
return buildApplyPatchFromFileChangeList(paths.map((filePath) => ({
|
|
134
|
-
path: filePath,
|
|
135
|
-
kind: "update"
|
|
136
|
-
})));
|
|
137
|
-
}
|
|
138
|
-
/**
|
|
139
|
-
* 将供应商返回的“松散 patch 输入”兜底规范成 apply_patch。
|
|
140
|
-
* 常见坏格式有两种:
|
|
141
|
-
* 1. 只有 `@@ ...` hunk,没有 `*** Begin Patch`
|
|
142
|
-
* 2. 只有文件路径列表,真正的 diff 已经丢了
|
|
143
|
-
*/
|
|
144
|
-
export function normalizeApplyPatchText(input, options) {
|
|
145
|
-
const normalizedInput = input.replace(/\r\n/g, "\n").trim();
|
|
146
|
-
if (!normalizedInput) {
|
|
147
|
-
return null;
|
|
148
|
-
}
|
|
149
|
-
if (isFullApplyPatchText(normalizedInput)) {
|
|
150
|
-
return normalizedInput;
|
|
151
|
-
}
|
|
152
|
-
const fallbackPaths = dedupePatchPaths(options?.fallbackPaths ?? []);
|
|
153
|
-
if (fallbackPaths.length !== 1 || !looksLikeLooseApplyPatchBody(normalizedInput)) {
|
|
154
|
-
return null;
|
|
155
|
-
}
|
|
156
|
-
return [
|
|
157
|
-
"*** Begin Patch",
|
|
158
|
-
`*** Update File: ${fallbackPaths[0]}`,
|
|
159
|
-
normalizedInput,
|
|
160
|
-
"*** End Patch"
|
|
161
|
-
].join("\n");
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* 从工具输出文本中提取“Updated the following files”里的文件路径。
|
|
165
|
-
* Codex 的 apply_patch 成功结果经常只在这里保留目标文件列表。
|
|
166
|
-
*/
|
|
167
|
-
export function extractApplyPatchTargetPathsFromToolOutput(output) {
|
|
168
|
-
const resolvedText = unwrapToolOutputText(output);
|
|
169
|
-
if (!resolvedText) {
|
|
170
|
-
return [];
|
|
171
|
-
}
|
|
172
|
-
const lines = resolvedText.replace(/\r\n/g, "\n").split("\n");
|
|
173
|
-
const collected = [];
|
|
174
|
-
let inUpdatedFilesSection = false;
|
|
175
|
-
for (const rawLine of lines) {
|
|
176
|
-
const line = rawLine.trim();
|
|
177
|
-
if (!inUpdatedFilesSection) {
|
|
178
|
-
if (/^Success\.\s+Updated the following files:/i.test(line)) {
|
|
179
|
-
inUpdatedFilesSection = true;
|
|
180
|
-
}
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
if (!line) {
|
|
184
|
-
if (collected.length > 0) {
|
|
185
|
-
break;
|
|
186
|
-
}
|
|
187
|
-
continue;
|
|
188
|
-
}
|
|
189
|
-
const matched = line.match(/^[A-Z?]\s+(.+)$/);
|
|
190
|
-
const candidatePath = normalizePatchPath(matched?.[1] ?? line);
|
|
191
|
-
if (!candidatePath) {
|
|
192
|
-
break;
|
|
193
|
-
}
|
|
194
|
-
collected.push(candidatePath);
|
|
195
|
-
}
|
|
196
|
-
return dedupePatchPaths(collected);
|
|
197
|
-
}
|
|
198
|
-
/**
|
|
199
|
-
* 将通用文件编辑类工具参数转换为 apply_patch。
|
|
200
|
-
* 兼容 Gemini 等 provider 常见的字段风格:
|
|
201
|
-
* - 新建/覆盖写入:{ file_path|filePath|path, content|new_content|newContent }
|
|
202
|
-
* - 单次编辑:{ file_path|filePath|path, old_string|oldText|search, new_string|newText|replacement }
|
|
203
|
-
* - 多次编辑:{ file_path|filePath|path, edits: [{ old_string, new_string }, ...] }
|
|
204
|
-
*/
|
|
205
|
-
export function buildApplyPatchFromStructuredFileTool(input) {
|
|
206
|
-
const filePath = extractFirstStringField(input, ["file_path", "filePath", "path"]);
|
|
207
|
-
if (!filePath) {
|
|
208
|
-
return null;
|
|
209
|
-
}
|
|
210
|
-
const directContent = extractFirstStringField(input, ["content", "new_content", "newContent"]);
|
|
211
|
-
if (directContent) {
|
|
212
|
-
return buildApplyPatchText([
|
|
213
|
-
{
|
|
214
|
-
action: "add",
|
|
215
|
-
filePath,
|
|
216
|
-
contentLines: directContent.split("\n")
|
|
217
|
-
}
|
|
218
|
-
]);
|
|
219
|
-
}
|
|
220
|
-
const directEdit = extractStructuredEdit(input);
|
|
221
|
-
if (directEdit) {
|
|
222
|
-
return buildApplyPatchText([
|
|
223
|
-
{
|
|
224
|
-
action: "update",
|
|
225
|
-
filePath,
|
|
226
|
-
hunks: [directEdit]
|
|
227
|
-
}
|
|
228
|
-
]);
|
|
229
|
-
}
|
|
230
|
-
const edits = Array.isArray(input.edits) ? input.edits : [];
|
|
231
|
-
const normalizedEdits = edits
|
|
232
|
-
.map((edit) => normalizeEditRecord(edit))
|
|
233
|
-
.filter((edit) => Boolean(edit));
|
|
234
|
-
if (normalizedEdits.length === 0) {
|
|
235
|
-
return null;
|
|
236
|
-
}
|
|
237
|
-
return buildApplyPatchText([
|
|
238
|
-
{
|
|
239
|
-
action: "update",
|
|
240
|
-
filePath,
|
|
241
|
-
hunks: normalizedEdits
|
|
242
|
-
}
|
|
243
|
-
]);
|
|
244
|
-
}
|
|
245
|
-
function buildApplyPatchText(entries) {
|
|
246
|
-
const lines = ["*** Begin Patch"];
|
|
247
|
-
for (const entry of entries) {
|
|
248
|
-
if (entry.action === "add") {
|
|
249
|
-
lines.push(`*** Add File: ${entry.filePath}`);
|
|
250
|
-
for (const contentLine of entry.contentLines) {
|
|
251
|
-
lines.push(`+${contentLine}`);
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
else if (entry.action === "delete") {
|
|
255
|
-
lines.push(`*** Delete File: ${entry.filePath}`);
|
|
256
|
-
}
|
|
257
|
-
else {
|
|
258
|
-
lines.push(`*** Update File: ${entry.filePath}`);
|
|
259
|
-
if (entry.hunks.length === 0) {
|
|
260
|
-
// 无 diff 内容时仅列出文件,跳过 hunk
|
|
261
|
-
continue;
|
|
262
|
-
}
|
|
263
|
-
for (const hunk of entry.hunks) {
|
|
264
|
-
lines.push(`@@ -1,${hunk.oldLines.length} +1,${hunk.newLines.length} @@`);
|
|
265
|
-
for (const oldLine of hunk.oldLines) {
|
|
266
|
-
lines.push(`-${oldLine}`);
|
|
267
|
-
}
|
|
268
|
-
for (const newLine of hunk.newLines) {
|
|
269
|
-
lines.push(`+${newLine}`);
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
lines.push("*** End Patch");
|
|
275
|
-
return lines.join("\n");
|
|
276
|
-
}
|
|
277
|
-
function extractStringField(record, field) {
|
|
278
|
-
const value = record[field];
|
|
279
|
-
return typeof value === "string" ? value : "";
|
|
280
|
-
}
|
|
281
|
-
function extractFirstStringField(record, fields) {
|
|
282
|
-
for (const field of fields) {
|
|
283
|
-
const value = extractStringField(record, field);
|
|
284
|
-
if (value) {
|
|
285
|
-
return value;
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return "";
|
|
289
|
-
}
|
|
290
|
-
function extractStructuredEdit(input) {
|
|
291
|
-
return normalizeEditRecord(input);
|
|
292
|
-
}
|
|
293
|
-
function normalizeEditRecord(value) {
|
|
294
|
-
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
295
|
-
return null;
|
|
296
|
-
}
|
|
297
|
-
const record = value;
|
|
298
|
-
const oldValue = extractFirstStringField(record, [
|
|
299
|
-
"old_string",
|
|
300
|
-
"oldString",
|
|
301
|
-
"old_text",
|
|
302
|
-
"oldText",
|
|
303
|
-
"search",
|
|
304
|
-
"searchText"
|
|
305
|
-
]);
|
|
306
|
-
const newValue = extractFirstStringField(record, [
|
|
307
|
-
"new_string",
|
|
308
|
-
"newString",
|
|
309
|
-
"new_text",
|
|
310
|
-
"newText",
|
|
311
|
-
"replacement",
|
|
312
|
-
"replacementText",
|
|
313
|
-
"replace"
|
|
314
|
-
]);
|
|
315
|
-
if (!oldValue && !newValue) {
|
|
316
|
-
return null;
|
|
317
|
-
}
|
|
318
|
-
return {
|
|
319
|
-
oldLines: oldValue.length > 0 ? oldValue.split("\n") : [],
|
|
320
|
-
newLines: newValue.length > 0 ? newValue.split("\n") : []
|
|
321
|
-
};
|
|
322
|
-
}
|
|
323
|
-
function collectCodexCommandLikeTexts(value, depth = 0) {
|
|
324
|
-
if (depth > 4 || value === undefined || value === null) {
|
|
325
|
-
return [];
|
|
326
|
-
}
|
|
327
|
-
if (typeof value === "string") {
|
|
328
|
-
const texts = [value];
|
|
329
|
-
const unescapedText = expandEscapedCodexCommandText(value);
|
|
330
|
-
if (unescapedText) {
|
|
331
|
-
texts.push(unescapedText);
|
|
332
|
-
}
|
|
333
|
-
const parsed = parseJsonLikeValue(value);
|
|
334
|
-
if (parsed !== null) {
|
|
335
|
-
texts.push(...collectCodexCommandLikeTexts(parsed, depth + 1));
|
|
336
|
-
}
|
|
337
|
-
texts.push(...extractJsonQuotedCommandTexts(value));
|
|
338
|
-
return texts;
|
|
339
|
-
}
|
|
340
|
-
if (Array.isArray(value)) {
|
|
341
|
-
return value.flatMap((entry) => collectCodexCommandLikeTexts(entry, depth + 1));
|
|
342
|
-
}
|
|
343
|
-
if (typeof value !== "object") {
|
|
344
|
-
return [];
|
|
345
|
-
}
|
|
346
|
-
const record = value;
|
|
347
|
-
return [
|
|
348
|
-
stringifyCommandLikeValue(value),
|
|
349
|
-
...["cmd", "command", "input", "arguments", "output", "aggregated_output", "aggregatedOutput"].flatMap((key) => collectCodexCommandLikeTexts(record[key], depth + 1))
|
|
350
|
-
];
|
|
351
|
-
}
|
|
352
|
-
function expandEscapedCodexCommandText(value) {
|
|
353
|
-
if (!value.includes("\\n") || !looksLikeCodexCommandEdit(value)) {
|
|
354
|
-
return null;
|
|
355
|
-
}
|
|
356
|
-
const expanded = value.replace(/\\r\\n/g, "\n").replace(/\\n/g, "\n");
|
|
357
|
-
return expanded === value ? null : expanded;
|
|
358
|
-
}
|
|
359
|
-
function extractJsonQuotedCommandTexts(value) {
|
|
360
|
-
if (!looksLikeCodexCommandEdit(value)) {
|
|
361
|
-
return [];
|
|
362
|
-
}
|
|
363
|
-
const texts = [];
|
|
364
|
-
const pattern = /"(?:\\.|[^"\\])*"/g;
|
|
365
|
-
let match;
|
|
366
|
-
while ((match = pattern.exec(value)) !== null) {
|
|
367
|
-
try {
|
|
368
|
-
const decoded = JSON.parse(match[0]);
|
|
369
|
-
if (typeof decoded === "string" && looksLikeCodexCommandEdit(decoded)) {
|
|
370
|
-
texts.push(decoded);
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
catch {
|
|
374
|
-
// 不是合法 JSON 字符串时跳过,不能猜。
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
return texts;
|
|
378
|
-
}
|
|
379
|
-
function parseJsonLikeValue(value) {
|
|
380
|
-
const trimmed = value.trim();
|
|
381
|
-
if (!trimmed || !/^[{[]/.test(trimmed)) {
|
|
382
|
-
return null;
|
|
383
|
-
}
|
|
384
|
-
try {
|
|
385
|
-
return JSON.parse(trimmed);
|
|
386
|
-
}
|
|
387
|
-
catch {
|
|
388
|
-
return null;
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
function stringifyCommandLikeValue(value) {
|
|
392
|
-
if (typeof value === "string") {
|
|
393
|
-
return value;
|
|
394
|
-
}
|
|
395
|
-
try {
|
|
396
|
-
return JSON.stringify(value);
|
|
397
|
-
}
|
|
398
|
-
catch {
|
|
399
|
-
return "";
|
|
400
|
-
}
|
|
401
|
-
}
|
|
402
|
-
function extractFullApplyPatchText(value) {
|
|
403
|
-
const normalized = value.replace(/\r\n/g, "\n");
|
|
404
|
-
const startMatch = /(?:^|\n)\*\*\* Begin Patch(?:\n|$)/.exec(normalized);
|
|
405
|
-
if (!startMatch) {
|
|
406
|
-
return null;
|
|
407
|
-
}
|
|
408
|
-
const start = startMatch.index + (startMatch[0].startsWith("\n") ? 1 : 0);
|
|
409
|
-
const endPattern = /(?:^|\n)\*\*\* End Patch(?:\n|$)/g;
|
|
410
|
-
endPattern.lastIndex = start;
|
|
411
|
-
const endMatch = endPattern.exec(normalized);
|
|
412
|
-
if (!endMatch) {
|
|
413
|
-
return null;
|
|
414
|
-
}
|
|
415
|
-
const end = endMatch.index + (endMatch[0].startsWith("\n") ? 1 : 0) + "*** End Patch".length;
|
|
416
|
-
return normalized.slice(start, end).trim();
|
|
417
|
-
}
|
|
418
|
-
function extractCodexCommandEditEntries(value) {
|
|
419
|
-
if (!looksLikeCodexCommandEdit(value)) {
|
|
420
|
-
return [];
|
|
421
|
-
}
|
|
422
|
-
const filePaths = extractCodexCommandEditPaths(value);
|
|
423
|
-
const replacements = extractPythonTextReplaceEdits(value);
|
|
424
|
-
if (filePaths.length !== 1 || replacements.length === 0) {
|
|
425
|
-
return [];
|
|
426
|
-
}
|
|
427
|
-
return [
|
|
428
|
-
{
|
|
429
|
-
action: "update",
|
|
430
|
-
filePath: filePaths[0],
|
|
431
|
-
hunks: replacements.map((replacement) => ({
|
|
432
|
-
oldLines: splitPatchLiteralLines(replacement.oldText),
|
|
433
|
-
newLines: splitPatchLiteralLines(replacement.newText)
|
|
434
|
-
}))
|
|
435
|
-
}
|
|
436
|
-
];
|
|
437
|
-
}
|
|
438
|
-
function mergeCodexCommandEditEntries(entries) {
|
|
439
|
-
const mergedUpdates = new Map();
|
|
440
|
-
const others = [];
|
|
441
|
-
for (const entry of entries) {
|
|
442
|
-
if (entry.action !== "update") {
|
|
443
|
-
others.push(entry);
|
|
444
|
-
continue;
|
|
445
|
-
}
|
|
446
|
-
const existing = mergedUpdates.get(entry.filePath);
|
|
447
|
-
if (existing) {
|
|
448
|
-
existing.hunks.push(...entry.hunks);
|
|
449
|
-
}
|
|
450
|
-
else {
|
|
451
|
-
mergedUpdates.set(entry.filePath, {
|
|
452
|
-
action: "update",
|
|
453
|
-
filePath: entry.filePath,
|
|
454
|
-
hunks: [...entry.hunks]
|
|
455
|
-
});
|
|
456
|
-
}
|
|
457
|
-
}
|
|
458
|
-
return [...mergedUpdates.values(), ...others];
|
|
459
|
-
}
|
|
460
|
-
function extractPythonTextReplaceEdits(value) {
|
|
461
|
-
const stringVariables = collectPythonStringVariables(value);
|
|
462
|
-
const replacements = [];
|
|
463
|
-
for (const args of extractPythonReplaceCallArgs(value)) {
|
|
464
|
-
if (args.length < 2) {
|
|
465
|
-
continue;
|
|
466
|
-
}
|
|
467
|
-
const oldText = resolvePythonReplaceArgument(args[0], stringVariables);
|
|
468
|
-
const newText = resolvePythonReplaceArgument(args[1], stringVariables);
|
|
469
|
-
if (oldText === null || newText === null) {
|
|
470
|
-
continue;
|
|
471
|
-
}
|
|
472
|
-
replacements.push({ oldText, newText });
|
|
473
|
-
}
|
|
474
|
-
return replacements;
|
|
475
|
-
}
|
|
476
|
-
function collectPythonStringVariables(value) {
|
|
477
|
-
const variables = new Map();
|
|
478
|
-
const assignmentPattern = /\b([A-Za-z_]\w*)\s*=\s*(?:[rRuUbBfF]{0,3})?["']/g;
|
|
479
|
-
let match;
|
|
480
|
-
while ((match = assignmentPattern.exec(value)) !== null) {
|
|
481
|
-
const variableName = match[1] ?? "";
|
|
482
|
-
const literalStart = findPythonLiteralStart(value, assignmentPattern.lastIndex - 1);
|
|
483
|
-
if (!variableName || literalStart < 0) {
|
|
484
|
-
continue;
|
|
485
|
-
}
|
|
486
|
-
const parsed = parsePythonStringLiteralAt(value, literalStart);
|
|
487
|
-
if (!parsed) {
|
|
488
|
-
continue;
|
|
489
|
-
}
|
|
490
|
-
variables.set(variableName, parsed.value);
|
|
491
|
-
assignmentPattern.lastIndex = parsed.end;
|
|
492
|
-
}
|
|
493
|
-
return variables;
|
|
494
|
-
}
|
|
495
|
-
function extractPythonReplaceCallArgs(value) {
|
|
496
|
-
const calls = [];
|
|
497
|
-
let searchFrom = 0;
|
|
498
|
-
while (searchFrom < value.length) {
|
|
499
|
-
const replaceIndex = value.indexOf(".replace(", searchFrom);
|
|
500
|
-
if (replaceIndex < 0) {
|
|
501
|
-
break;
|
|
502
|
-
}
|
|
503
|
-
const argsStart = replaceIndex + ".replace(".length;
|
|
504
|
-
const argsEnd = findMatchingParen(value, argsStart - 1);
|
|
505
|
-
if (argsEnd < 0) {
|
|
506
|
-
break;
|
|
507
|
-
}
|
|
508
|
-
calls.push(splitTopLevelArguments(value.slice(argsStart, argsEnd)));
|
|
509
|
-
searchFrom = argsEnd + 1;
|
|
510
|
-
}
|
|
511
|
-
return calls;
|
|
512
|
-
}
|
|
513
|
-
function resolvePythonReplaceArgument(value, variables) {
|
|
514
|
-
const trimmed = value.trim();
|
|
515
|
-
if (/^[A-Za-z_]\w*$/.test(trimmed)) {
|
|
516
|
-
return variables.get(trimmed) ?? null;
|
|
517
|
-
}
|
|
518
|
-
const literalStart = findPythonLiteralStart(trimmed, 0);
|
|
519
|
-
if (literalStart < 0) {
|
|
520
|
-
return null;
|
|
521
|
-
}
|
|
522
|
-
const parsed = parsePythonStringLiteralAt(trimmed, literalStart);
|
|
523
|
-
return parsed?.value ?? null;
|
|
524
|
-
}
|
|
525
|
-
function splitTopLevelArguments(value) {
|
|
526
|
-
const args = [];
|
|
527
|
-
let start = 0;
|
|
528
|
-
let depth = 0;
|
|
529
|
-
let index = 0;
|
|
530
|
-
while (index < value.length) {
|
|
531
|
-
const literalStart = findPythonLiteralStart(value, index);
|
|
532
|
-
if (literalStart === index) {
|
|
533
|
-
const parsed = parsePythonStringLiteralAt(value, literalStart);
|
|
534
|
-
if (parsed) {
|
|
535
|
-
index = parsed.end;
|
|
536
|
-
continue;
|
|
537
|
-
}
|
|
538
|
-
}
|
|
539
|
-
const char = value[index];
|
|
540
|
-
if (char === "(" || char === "[" || char === "{") {
|
|
541
|
-
depth += 1;
|
|
542
|
-
}
|
|
543
|
-
else if (char === ")" || char === "]" || char === "}") {
|
|
544
|
-
depth = Math.max(0, depth - 1);
|
|
545
|
-
}
|
|
546
|
-
else if (char === "," && depth === 0) {
|
|
547
|
-
args.push(value.slice(start, index).trim());
|
|
548
|
-
start = index + 1;
|
|
549
|
-
}
|
|
550
|
-
index += 1;
|
|
551
|
-
}
|
|
552
|
-
args.push(value.slice(start).trim());
|
|
553
|
-
return args;
|
|
554
|
-
}
|
|
555
|
-
function findMatchingParen(value, openIndex) {
|
|
556
|
-
let depth = 0;
|
|
557
|
-
let index = openIndex;
|
|
558
|
-
while (index < value.length) {
|
|
559
|
-
const literalStart = findPythonLiteralStart(value, index);
|
|
560
|
-
if (literalStart === index) {
|
|
561
|
-
const parsed = parsePythonStringLiteralAt(value, literalStart);
|
|
562
|
-
if (parsed) {
|
|
563
|
-
index = parsed.end;
|
|
564
|
-
continue;
|
|
565
|
-
}
|
|
566
|
-
}
|
|
567
|
-
const char = value[index];
|
|
568
|
-
if (char === "(") {
|
|
569
|
-
depth += 1;
|
|
570
|
-
}
|
|
571
|
-
else if (char === ")") {
|
|
572
|
-
depth -= 1;
|
|
573
|
-
if (depth === 0) {
|
|
574
|
-
return index;
|
|
575
|
-
}
|
|
576
|
-
}
|
|
577
|
-
index += 1;
|
|
578
|
-
}
|
|
579
|
-
return -1;
|
|
580
|
-
}
|
|
581
|
-
function findPythonLiteralStart(value, startIndex) {
|
|
582
|
-
let index = startIndex;
|
|
583
|
-
while (index < value.length && /\s/.test(value[index] ?? "")) {
|
|
584
|
-
index += 1;
|
|
585
|
-
}
|
|
586
|
-
while (index < value.length && /[rRuUbBfF]/.test(value[index] ?? "")) {
|
|
587
|
-
index += 1;
|
|
588
|
-
}
|
|
589
|
-
const char = value[index];
|
|
590
|
-
return char === "'" || char === '"' ? index : -1;
|
|
591
|
-
}
|
|
592
|
-
function parsePythonStringLiteralAt(value, quoteIndex) {
|
|
593
|
-
const quote = value[quoteIndex];
|
|
594
|
-
if (quote !== "'" && quote !== '"') {
|
|
595
|
-
return null;
|
|
596
|
-
}
|
|
597
|
-
const triple = value.slice(quoteIndex, quoteIndex + 3) === quote.repeat(3);
|
|
598
|
-
const contentStart = quoteIndex + (triple ? 3 : 1);
|
|
599
|
-
const endMarker = triple ? quote.repeat(3) : quote;
|
|
600
|
-
const rawLiteral = hasRawPythonStringPrefix(value, quoteIndex);
|
|
601
|
-
let index = contentStart;
|
|
602
|
-
let result = "";
|
|
603
|
-
while (index < value.length) {
|
|
604
|
-
if (value.startsWith(endMarker, index)) {
|
|
605
|
-
return {
|
|
606
|
-
value: result,
|
|
607
|
-
end: index + endMarker.length
|
|
608
|
-
};
|
|
609
|
-
}
|
|
610
|
-
const char = value[index] ?? "";
|
|
611
|
-
if (!rawLiteral && char === "\\") {
|
|
612
|
-
const next = value[index + 1] ?? "";
|
|
613
|
-
result += decodeSimplePythonEscape(next);
|
|
614
|
-
index += 2;
|
|
615
|
-
continue;
|
|
616
|
-
}
|
|
617
|
-
result += char;
|
|
618
|
-
index += 1;
|
|
619
|
-
}
|
|
620
|
-
return null;
|
|
621
|
-
}
|
|
622
|
-
function hasRawPythonStringPrefix(value, quoteIndex) {
|
|
623
|
-
let prefixStart = quoteIndex;
|
|
624
|
-
while (prefixStart > 0 && /[A-Za-z]/.test(value[prefixStart - 1] ?? "")) {
|
|
625
|
-
prefixStart -= 1;
|
|
626
|
-
}
|
|
627
|
-
return /r/i.test(value.slice(prefixStart, quoteIndex));
|
|
628
|
-
}
|
|
629
|
-
function decodeSimplePythonEscape(value) {
|
|
630
|
-
switch (value) {
|
|
631
|
-
case "n":
|
|
632
|
-
return "\n";
|
|
633
|
-
case "r":
|
|
634
|
-
return "\r";
|
|
635
|
-
case "t":
|
|
636
|
-
return "\t";
|
|
637
|
-
case "\\":
|
|
638
|
-
return "\\";
|
|
639
|
-
case "'":
|
|
640
|
-
return "'";
|
|
641
|
-
case '"':
|
|
642
|
-
return '"';
|
|
643
|
-
default:
|
|
644
|
-
return value;
|
|
645
|
-
}
|
|
646
|
-
}
|
|
647
|
-
function splitPatchLiteralLines(value) {
|
|
648
|
-
return value.replace(/\r\n/g, "\n").split("\n");
|
|
649
|
-
}
|
|
650
|
-
function extractCodexCommandEditPaths(value) {
|
|
651
|
-
if (!looksLikeCodexCommandEdit(value)) {
|
|
652
|
-
return [];
|
|
653
|
-
}
|
|
654
|
-
return dedupePatchPaths([
|
|
655
|
-
...extractPythonPathConstructorEditPaths(value),
|
|
656
|
-
...extractWriteFileSyncEditPaths(value)
|
|
657
|
-
]);
|
|
658
|
-
}
|
|
659
|
-
function looksLikeCodexCommandEdit(value) {
|
|
660
|
-
return (/\.write_(?:text|bytes)\s*\(/.test(value) ||
|
|
661
|
-
/\bwriteFileSync\s*\(/.test(value) ||
|
|
662
|
-
/\bcat\s+>\s*\S+/.test(value) ||
|
|
663
|
-
/\btee\s+\S+/.test(value));
|
|
664
|
-
}
|
|
665
|
-
function extractPythonPathConstructorEditPaths(value) {
|
|
666
|
-
const paths = [];
|
|
667
|
-
const chainedPattern = /\bPath\(\s*(["'`])([^"'`\n]+)\1\s*\)\.write_(?:text|bytes)\s*\(/g;
|
|
668
|
-
let chainedMatch;
|
|
669
|
-
while ((chainedMatch = chainedPattern.exec(value)) !== null) {
|
|
670
|
-
paths.push(chainedMatch[2] ?? "");
|
|
671
|
-
}
|
|
672
|
-
const assignmentPattern = /\b([A-Za-z_]\w*)\s*=\s*Path\(\s*(["'`])([^"'`\n]+)\2\s*\)/g;
|
|
673
|
-
let assignmentMatch;
|
|
674
|
-
while ((assignmentMatch = assignmentPattern.exec(value)) !== null) {
|
|
675
|
-
const variableName = assignmentMatch[1] ?? "";
|
|
676
|
-
const filePath = assignmentMatch[3] ?? "";
|
|
677
|
-
if (variableName && new RegExp(`\\b${escapeRegExp(variableName)}\\.write_(?:text|bytes)\\s*\\(`).test(value)) {
|
|
678
|
-
paths.push(filePath);
|
|
679
|
-
}
|
|
680
|
-
}
|
|
681
|
-
return paths;
|
|
682
|
-
}
|
|
683
|
-
function extractWriteFileSyncEditPaths(value) {
|
|
684
|
-
const paths = [];
|
|
685
|
-
const pattern = /\bwriteFileSync\(\s*(["'`])([^"'`\n]+)\1/g;
|
|
686
|
-
let match;
|
|
687
|
-
while ((match = pattern.exec(value)) !== null) {
|
|
688
|
-
paths.push(match[2] ?? "");
|
|
689
|
-
}
|
|
690
|
-
return paths;
|
|
691
|
-
}
|
|
692
|
-
function escapeRegExp(value) {
|
|
693
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
694
|
-
}
|
|
695
|
-
function normalizePatchAction(value) {
|
|
696
|
-
const normalized = value?.trim().toLowerCase() ?? "";
|
|
697
|
-
if (normalized === "add" || normalized === "create" || normalized === "new") {
|
|
698
|
-
return "add";
|
|
699
|
-
}
|
|
700
|
-
if (normalized === "delete" || normalized === "remove" || normalized === "removed") {
|
|
701
|
-
return "delete";
|
|
702
|
-
}
|
|
703
|
-
return "update";
|
|
704
|
-
}
|
|
705
|
-
function normalizePatchPath(value) {
|
|
706
|
-
return typeof value === "string" ? value.trim() : "";
|
|
707
|
-
}
|
|
708
|
-
function dedupePatchPaths(paths) {
|
|
709
|
-
return [...new Set(paths.map((path) => normalizePatchPath(path)).filter((path) => path.length > 0))];
|
|
710
|
-
}
|
|
711
|
-
function isFullApplyPatchText(input) {
|
|
712
|
-
return input.includes("*** Begin Patch") && input.includes("*** End Patch");
|
|
713
|
-
}
|
|
714
|
-
function looksLikeLooseApplyPatchBody(input) {
|
|
715
|
-
return (input.startsWith("@@") ||
|
|
716
|
-
input.startsWith("*** Update File: ") ||
|
|
717
|
-
input.startsWith("*** Add File: ") ||
|
|
718
|
-
input.startsWith("*** Delete File: ") ||
|
|
719
|
-
input.includes("\n@@") ||
|
|
720
|
-
input.startsWith("+") ||
|
|
721
|
-
input.startsWith("-"));
|
|
722
|
-
}
|
|
723
|
-
function unwrapToolOutputText(output) {
|
|
724
|
-
const normalized = output.trim();
|
|
725
|
-
if (!normalized) {
|
|
726
|
-
return "";
|
|
727
|
-
}
|
|
728
|
-
if (!normalized.startsWith("{")) {
|
|
729
|
-
return normalized;
|
|
730
|
-
}
|
|
731
|
-
try {
|
|
732
|
-
const parsed = JSON.parse(normalized);
|
|
733
|
-
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
734
|
-
return normalized;
|
|
735
|
-
}
|
|
736
|
-
const record = parsed;
|
|
737
|
-
if (typeof record.output === "string" && record.output.trim().length > 0) {
|
|
738
|
-
return record.output;
|
|
739
|
-
}
|
|
740
|
-
if (typeof record.result === "string" && record.result.trim().length > 0) {
|
|
741
|
-
return record.result;
|
|
742
|
-
}
|
|
743
|
-
if (typeof record.message === "string" && record.message.trim().length > 0) {
|
|
744
|
-
return record.message;
|
|
745
|
-
}
|
|
746
|
-
}
|
|
747
|
-
catch {
|
|
748
|
-
return normalized;
|
|
749
|
-
}
|
|
750
|
-
return normalized;
|
|
751
|
-
}
|
|
752
|
-
//# sourceMappingURL=patch-builder.js.map
|