@myrialabs/clopen 0.4.36 → 0.4.38

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.
Files changed (115) hide show
  1. package/README.md +2 -2
  2. package/backend/auth/permissions.ts +14 -0
  3. package/backend/bootstrap.ts +16 -0
  4. package/backend/database/crypto/envelope.test.ts +93 -0
  5. package/backend/database/crypto/envelope.ts +127 -0
  6. package/backend/database/crypto/index.ts +22 -0
  7. package/backend/database/crypto/master-key.ts +129 -0
  8. package/backend/database/crypto/secret-columns.ts +147 -0
  9. package/backend/database/migrations/071_create_notes_tables.ts +90 -0
  10. package/backend/database/migrations/072_encrypt_stored_secrets.ts +107 -0
  11. package/backend/database/migrations/073_create_integration_tables.ts +119 -0
  12. package/backend/database/migrations/074_create_work_tables.ts +94 -0
  13. package/backend/database/migrations/index.ts +28 -0
  14. package/backend/database/queries/db-client-connection-queries.ts +23 -12
  15. package/backend/database/queries/engine-queries.ts +23 -10
  16. package/backend/database/queries/index.ts +6 -1
  17. package/backend/database/queries/integration-queries.ts +297 -0
  18. package/backend/database/queries/mcp-server-queries.ts +38 -11
  19. package/backend/database/queries/note-queries.test.ts +190 -0
  20. package/backend/database/queries/note-queries.ts +269 -0
  21. package/backend/database/queries/profile-queries.ts +1 -1
  22. package/backend/database/queries/ssh-connection-queries.ts +19 -8
  23. package/backend/database/queries/work-queries.ts +210 -0
  24. package/backend/engine/docs/artifacts.md +22 -9
  25. package/backend/files/os-clipboard.test.ts +209 -0
  26. package/backend/files/os-clipboard.ts +567 -0
  27. package/backend/git/conflict-state.test.ts +396 -0
  28. package/backend/git/git-executor.ts +6 -0
  29. package/backend/git/git-parser.ts +144 -48
  30. package/backend/git/git-service.ts +727 -57
  31. package/backend/git/push-target.test.ts +264 -0
  32. package/backend/http/integration-hooks.ts +42 -0
  33. package/backend/http/notes-images.test.ts +228 -0
  34. package/backend/http/notes-images.ts +196 -0
  35. package/backend/index.ts +9 -0
  36. package/backend/integrations/accounts.ts +229 -0
  37. package/backend/integrations/health.ts +146 -0
  38. package/backend/integrations/index.ts +36 -0
  39. package/backend/integrations/projections/index.ts +120 -0
  40. package/backend/integrations/projections/mcp-projector.test.ts +204 -0
  41. package/backend/integrations/projections/mcp-projector.ts +159 -0
  42. package/backend/integrations/projections/types.ts +51 -0
  43. package/backend/integrations/registry/define.ts +38 -0
  44. package/backend/integrations/registry/index.ts +56 -0
  45. package/backend/integrations/registry/providers/context7.ts +44 -0
  46. package/backend/integrations/registry/providers/firecrawl.ts +41 -0
  47. package/backend/integrations/registry/providers/github.ts +78 -0
  48. package/backend/integrations/registry/types.ts +96 -0
  49. package/backend/integrations/webhooks/gateway.ts +160 -0
  50. package/backend/integrations/webhooks/verify.ts +65 -0
  51. package/backend/mcp/README.md +25 -3
  52. package/backend/mcp/external/config.ts +35 -1
  53. package/backend/mcp/index.ts +1 -1
  54. package/backend/mcp/internal/config.ts +1 -1
  55. package/backend/notes/access.test.ts +82 -0
  56. package/backend/notes/access.ts +27 -0
  57. package/backend/notes/storage.test.ts +77 -0
  58. package/backend/notes/storage.ts +114 -0
  59. package/backend/permissions/service.ts +2 -2
  60. package/backend/profiles/service.ts +1 -1
  61. package/backend/project/status-manager.ts +20 -0
  62. package/backend/projects/project-cleanup.ts +6 -0
  63. package/backend/work/bindings.ts +124 -0
  64. package/backend/work/index.ts +42 -0
  65. package/backend/work/prompts.ts +150 -0
  66. package/backend/work/providers/github/actions-logs.ts +180 -0
  67. package/backend/work/providers/github/adapter.test.ts +88 -0
  68. package/backend/work/providers/github/adapter.ts +1255 -0
  69. package/backend/work/providers/github/client.ts +280 -0
  70. package/backend/work/providers/github/list-range.test.ts +158 -0
  71. package/backend/work/providers/github/token-kind.test.ts +42 -0
  72. package/backend/work/pull-requests.ts +242 -0
  73. package/backend/work/registry.ts +27 -0
  74. package/backend/work/service.ts +436 -0
  75. package/backend/work/start-work.test.ts +71 -0
  76. package/backend/work/start-work.ts +232 -0
  77. package/backend/work/types.ts +180 -0
  78. package/backend/ws/files/clipboard.ts +78 -0
  79. package/backend/ws/files/index.ts +5 -0
  80. package/backend/ws/git/branch-name.ts +6 -5
  81. package/backend/ws/git/branch.ts +43 -1
  82. package/backend/ws/git/commit-message.ts +13 -10
  83. package/backend/ws/git/conflict.ts +106 -3
  84. package/backend/ws/git/diff-budget.test.ts +125 -0
  85. package/backend/ws/git/diff-budget.ts +279 -0
  86. package/backend/ws/git/log.ts +25 -0
  87. package/backend/ws/git/remote.ts +75 -1
  88. package/backend/ws/index.ts +11 -1
  89. package/backend/ws/integrations/crud.ts +219 -0
  90. package/backend/ws/integrations/index.ts +22 -0
  91. package/backend/ws/mcp/crud.ts +25 -1
  92. package/backend/ws/notes/index.ts +278 -0
  93. package/backend/ws/profiles/crud.ts +1 -1
  94. package/backend/ws/work/actions.ts +206 -0
  95. package/backend/ws/work/context.ts +51 -0
  96. package/backend/ws/work/crud.ts +347 -0
  97. package/backend/ws/work/index.ts +17 -0
  98. package/backend/ws/work/pull-requests.ts +177 -0
  99. package/backend/ws/work/schemas.ts +226 -0
  100. package/dist/assets/{index-Bg-SUCFg.js → index-CyH7fSbR.js} +1 -1
  101. package/dist/assets/{index-Cz4YpHVi.js → index-DSHIANSy.js} +1 -1
  102. package/dist/assets/main-D2IOjftb.css +1 -0
  103. package/dist/assets/main-DM-tHKbW.js +1152 -0
  104. package/dist/index.html +2 -2
  105. package/package.json +1 -1
  106. package/shared/constants/engine-tools.ts +1 -1
  107. package/shared/constants/tool-icons.ts +33 -0
  108. package/shared/types/database/schema.ts +41 -0
  109. package/shared/types/git.ts +123 -0
  110. package/shared/types/integrations.ts +140 -0
  111. package/shared/types/stores/settings.ts +8 -0
  112. package/shared/types/work.ts +426 -0
  113. package/shared/utils/logger.ts +3 -0
  114. package/dist/assets/main-9G7IpQpK.css +0 -1
  115. package/dist/assets/main-BofFsH8E.js +0 -1085
package/dist/index.html CHANGED
@@ -58,8 +58,8 @@
58
58
  }
59
59
  })();
60
60
  </script>
61
- <script type="module" crossorigin src="/assets/main-BofFsH8E.js"></script>
62
- <link rel="stylesheet" crossorigin href="/assets/main-9G7IpQpK.css">
61
+ <script type="module" crossorigin src="/assets/main-DM-tHKbW.js"></script>
62
+ <link rel="stylesheet" crossorigin href="/assets/main-D2IOjftb.css">
63
63
  </head>
64
64
  <body
65
65
  class="min-h-dvh bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100 transition-colors duration-200"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@myrialabs/clopen",
3
- "version": "0.4.36",
3
+ "version": "0.4.38",
4
4
  "description": "All-in-one web workspace for AI coding agents — Claude Code, OpenCode, Codex, Copilot, Qwen Code, Pi, Cline, and Cursor — with chat, terminal, git, browser preview, database client, checkpoints, and real-time collaboration",
5
5
  "author": "Myria Labs",
6
6
  "license": "MIT",
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Built-in tool catalog per engine — the inventory the Permissions UI offers for
3
- * allow/deny rules, alongside MCP tools (from Connectors) and subagent tool
3
+ * allow/deny rules, alongside MCP tools (from Integrations) and subagent tool
4
4
  * allowlists.
5
5
  *
6
6
  * Tool NAMES must match what each engine reports at its permission hook, or a
@@ -47,3 +47,36 @@ export function getToolIcon(tool: string): ToolIcon | null {
47
47
  const key = STACK_TOOL_ICON_KEY[tool];
48
48
  return key ? TOOL_ICONS[key] : null;
49
49
  }
50
+
51
+ // ============================================================================
52
+ // Integration brand marks
53
+ //
54
+ // Keyed by PROVIDER ID, so a provider declares no icon field of its own and one
55
+ // whose artwork has not been added yet falls back to a generic glyph instead of
56
+ // blocking the entry.
57
+ //
58
+ // The same rule as above applies: an inline SVG with a light and a dark
59
+ // variant, rendered with `{@html}`. A monochrome glyph tinted with the theme
60
+ // foreground stops being a logo, so a provider goes in here only once its real
61
+ // mark is available — never as a traced approximation.
62
+ // ============================================================================
63
+
64
+ export const PROVIDER_ICONS: Record<string, ToolIcon> = {
65
+ // Official marks, taken from each vendor's own site. GitHub's Octocat is one
66
+ // artwork whose fill flips with the theme — its own brand guidance is
67
+ // "black on light, white on dark", so the two variants differ only in fill.
68
+ // Context7 ships a
69
+ // light/dark pair (the wordmark is dropped — only the square mark is used at
70
+ // this size). Firecrawl's flame is one artwork whose inner fill tracks the
71
+ // surface behind it, so the two variants differ only in that fill; the source
72
+ // viewBox is the site's layout box rather than the glyph's, so it is re-framed
73
+ // on the mark's own bounding box or it renders small and off-centre at 24px.
74
+ context7: { light: '<svg width="24" height="24" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="28" height="28" rx="4" fill="black"/><path d="M10.5724 15.2565C10.5724 17.5025 9.6613 19.3778 8.17805 21.1047H11.6319L11.6319 22.7786H6.33459V21.1895C7.95557 19.3566 8.58065 17.8628 8.58065 15.2565L10.5724 15.2565Z" fill="white"/><path d="M17.4276 15.2565C17.4276 17.5025 18.3387 19.3778 19.822 21.1047H16.3681V22.7786H21.6654V21.1895C20.0444 19.3566 19.4194 17.8628 19.4194 15.2565H17.4276Z" fill="white"/><path d="M10.5724 12.7435C10.5724 10.4975 9.66131 8.62224 8.17807 6.89532L11.6319 6.89532V5.22137L6.33461 5.22137V6.81056C7.95558 8.64343 8.58066 10.1373 8.58066 12.7435L10.5724 12.7435Z" fill="white"/><path d="M17.4276 12.7435C17.4276 10.4975 18.3387 8.62224 19.822 6.89532L16.3681 6.89532L16.3681 5.22138L21.6654 5.22138V6.81056C20.0445 8.64343 19.4194 10.1373 19.4194 12.7435H17.4276Z" fill="white"/></svg>', dark: '<svg width="24" height="24" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg"><rect width="28" height="28" rx="4" fill="white"/><path d="M10.5724 15.2565C10.5724 17.5025 9.6613 19.3778 8.17805 21.1047H11.6319L11.6319 22.7786H6.33459V21.1895C7.95557 19.3566 8.58065 17.8628 8.58065 15.2565L10.5724 15.2565Z" fill="black"/><path d="M17.4276 15.2565C17.4276 17.5025 18.3387 19.3778 19.822 21.1047H16.3681V22.7786H21.6654V21.1895C20.0444 19.3566 19.4194 17.8628 19.4194 15.2565H17.4276Z" fill="black"/><path d="M10.5724 12.7435C10.5724 10.4975 9.66131 8.62224 8.17807 6.89532L11.6319 6.89532V5.22137L6.33461 5.22137V6.81056C7.95558 8.64343 8.58066 10.1373 8.58066 12.7435L10.5724 12.7435Z" fill="black"/><path d="M17.4276 12.7435C17.4276 10.4975 18.3387 8.62224 19.822 6.89532L16.3681 6.89532L16.3681 5.22138L21.6654 5.22138V6.81056C20.0444 8.64343 19.4194 10.1373 19.4194 12.7435H17.4276Z" fill="black"/></svg>' },
75
+ firecrawl: { light: '<svg width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="8 34 560 560" xmlns="http://www.w3.org/2000/svg"><g><g transform=" translate(293.035, 553.013) scale(0.97724, 0.97724) translate(-533.035, -800.013)"><path d=" M603.4 416.3 C581,433 586.6,450.2 583.9,466.6 C583.2,470.5 577.8,469.2 576.5,465.7 C559.5,447 549.5,423.6 559.3,394.4 C577.2,340.8 614.2,311.2 594.2,288.4 C591,284.8 591.8,284.3 590.2,288.8 C572.5,339 363,338 428,536 C430.9,544.8 430.2,555.2 429.5,565.8 C429.3,569 427.1,571.3 424.2,570.1 C401.5,560.8 395.4,525.8 390.4,516.3 C389,513.6 387.5,514.5 385.7,518 C381,524.1 377.9,532.3 374.2,538.5 C336.9,600.7 343.6,664.3 368,715 C368.9,716.9 369.9,718.7 370.9,720.6 C371.9,722.7 373.1,724.8 374.2,726.8 C391.8,758.3 416,783.8 439.8,799.3 C442.6,801.2 446.3,798.5 445.3,795.2 C437.1,767.6 642.8,744.8 634.7,795.2 C634.1,798.6 637.3,801.3 640.2,799.4 C659.9,786.5 680.2,766.8 695.2,742 C696.4,740 697.6,738 698.7,735.9 C699.5,734.5 700.2,733.1 701,731.6 C711.2,711.6 717.8,688.8 718.1,663.6 C718.3,643.8 714.6,622.5 705.5,600.1 C703.8,595.8 700.2,616.5 684.4,613.3 C682.9,613 691.2,586.1 692.1,570.6 C692.4,563.3 690.7,544.7 683.2,524.1 C667.8,481.1 615.5,466.2 609.6,417.3 C609.2,414.6 605.5,414.7 603.4,416.3z " fill="#fa5d19" fill-opacity="1" fill-rule="nonzero"></animate></path></g><g transform=" translate(300, 470.504) scale(0.9650799999999999, 0.9650799999999999) translate(-510.283, -685.815)"><path d=" M410.1 771.9 C412.9,773.7 416.6,771.1 415.6,767.8 C407.4,740.2 411.5,708.6 427.7,684.6 C455.3,643.2 510.6,603.1 501.8,548.7 C501.2,545.3 505.3,543 507.9,545.4 C546.9,581 554.6,629 548.2,672 C547.6,675.7 552.3,677.7 554.7,674.8 C560.6,667.3 567.9,660.7 575.9,655.8 C577.8,654.6 580.5,655.5 581.2,657.7 C594.2,695.6 617.7,725.6 605,767.8 C604,771.1 607.6,773.8 610.5,771.9 C610.5,771.9 610.5,827.2 610.5,827.2 C610.5,827.2 410.1,827.2 410.1,827.2 C410.1,827.2 410.1,771.9 410.1,771.9z " fill="#ffffff" fill-opacity="1" fill-rule="nonzero"></path></g></g></svg>', dark: '<svg width="24" height="24" preserveAspectRatio="xMidYMid meet" viewBox="8 34 560 560" xmlns="http://www.w3.org/2000/svg"><g><g transform=" translate(293.035, 553.013) scale(0.97724, 0.97724) translate(-533.035, -800.013)"><path d=" M603.4 416.3 C581,433 586.6,450.2 583.9,466.6 C583.2,470.5 577.8,469.2 576.5,465.7 C559.5,447 549.5,423.6 559.3,394.4 C577.2,340.8 614.2,311.2 594.2,288.4 C591,284.8 591.8,284.3 590.2,288.8 C572.5,339 363,338 428,536 C430.9,544.8 430.2,555.2 429.5,565.8 C429.3,569 427.1,571.3 424.2,570.1 C401.5,560.8 395.4,525.8 390.4,516.3 C389,513.6 387.5,514.5 385.7,518 C381,524.1 377.9,532.3 374.2,538.5 C336.9,600.7 343.6,664.3 368,715 C368.9,716.9 369.9,718.7 370.9,720.6 C371.9,722.7 373.1,724.8 374.2,726.8 C391.8,758.3 416,783.8 439.8,799.3 C442.6,801.2 446.3,798.5 445.3,795.2 C437.1,767.6 642.8,744.8 634.7,795.2 C634.1,798.6 637.3,801.3 640.2,799.4 C659.9,786.5 680.2,766.8 695.2,742 C696.4,740 697.6,738 698.7,735.9 C699.5,734.5 700.2,733.1 701,731.6 C711.2,711.6 717.8,688.8 718.1,663.6 C718.3,643.8 714.6,622.5 705.5,600.1 C703.8,595.8 700.2,616.5 684.4,613.3 C682.9,613 691.2,586.1 692.1,570.6 C692.4,563.3 690.7,544.7 683.2,524.1 C667.8,481.1 615.5,466.2 609.6,417.3 C609.2,414.6 605.5,414.7 603.4,416.3z " fill="#fa5d19" fill-opacity="1" fill-rule="nonzero"></animate></path></g><g transform=" translate(300, 470.504) scale(0.9650799999999999, 0.9650799999999999) translate(-510.283, -685.815)"><path d=" M410.1 771.9 C412.9,773.7 416.6,771.1 415.6,767.8 C407.4,740.2 411.5,708.6 427.7,684.6 C455.3,643.2 510.6,603.1 501.8,548.7 C501.2,545.3 505.3,543 507.9,545.4 C546.9,581 554.6,629 548.2,672 C547.6,675.7 552.3,677.7 554.7,674.8 C560.6,667.3 567.9,660.7 575.9,655.8 C577.8,654.6 580.5,655.5 581.2,657.7 C594.2,695.6 617.7,725.6 605,767.8 C604,771.1 607.6,773.8 610.5,771.9 C610.5,771.9 610.5,827.2 610.5,827.2 C610.5,827.2 410.1,827.2 410.1,827.2 C410.1,827.2 410.1,771.9 410.1,771.9z " fill="#0f172a" fill-opacity="1" fill-rule="nonzero"></path></g></g></svg>' },
76
+ github: { light: '<svg width="24" height="24" viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#24292f"/></svg>', dark: '<svg width="24" height="24" viewBox="0 0 98 96" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M48.854 0C21.839 0 0 22 0 49.217c0 21.756 13.993 40.172 33.405 46.69 2.427.49 3.316-1.059 3.316-2.362 0-1.141-.08-5.052-.08-9.127-13.59 2.934-16.42-5.867-16.42-5.867-2.184-5.704-5.42-7.17-5.42-7.17-4.448-3.015.324-3.015.324-3.015 4.934.326 7.523 5.052 7.523 5.052 4.367 7.496 11.404 5.378 14.235 4.074.404-3.178 1.699-5.378 3.074-6.6-10.839-1.141-22.243-5.378-22.243-24.283 0-5.378 1.94-9.778 5.014-13.2-.485-1.222-2.184-6.275.486-13.038 0 0 4.125-1.304 13.426 5.052a46.97 46.97 0 0 1 12.214-1.63c4.125 0 8.33.571 12.213 1.63 9.302-6.356 13.427-5.052 13.427-5.052 2.67 6.763.97 11.816.485 13.038 3.155 3.422 5.015 7.822 5.015 13.2 0 18.905-11.404 23.06-22.324 24.283 1.78 1.548 3.316 4.481 3.316 9.126 0 6.6-.08 11.897-.08 13.526 0 1.304.89 2.853 3.316 2.364 19.412-6.52 33.405-24.935 33.405-46.691C97.707 22 75.788 0 48.854 0z" fill="#ffffff"/></svg>' }
77
+ };
78
+
79
+ /** Resolve the brand mark for an integration provider, or null to fall back. */
80
+ export function getProviderIcon(providerId: string): ToolIcon | null {
81
+ return PROVIDER_ICONS[providerId] ?? null;
82
+ }
@@ -283,3 +283,44 @@ export interface DBSshPortForwardRow {
283
283
  updated_at: string;
284
284
  }
285
285
 
286
+ /** Who may read and write every note inside a collection. */
287
+ export type NoteScope = 'project' | 'global';
288
+
289
+ export interface NoteCollection {
290
+ id: string;
291
+ name: string;
292
+ /** `project` — members of `project_id`. `global` — every signed-in user. */
293
+ scope: NoteScope;
294
+ /** Set when `scope` is `project`, null when `scope` is `global`. */
295
+ project_id: string | null;
296
+ created_by: string | null;
297
+ created_at: string;
298
+ updated_at: string;
299
+ }
300
+
301
+ export interface Note {
302
+ /** Access is inherited from this collection; a note carries no scope of its own. */
303
+ collection_id: string;
304
+ id: string;
305
+ title: string | null;
306
+ content: string;
307
+ created_by: string | null;
308
+ created_at: string;
309
+ updated_at: string;
310
+ }
311
+
312
+ export interface NoteImage {
313
+ id: string;
314
+ note_id: string;
315
+ file_name: string;
316
+ mime_type: string;
317
+ size: number;
318
+ /** Relative to the data dir, forward-slashed — resolve via `resolveNoteImagePath`. */
319
+ storage_path: string;
320
+ created_at: string;
321
+ }
322
+
323
+ export type NoteWithImages = Note & { images: NoteImage[] };
324
+
325
+ export type NoteCollectionWithNotes = NoteCollection & { notes: NoteWithImages[] };
326
+
@@ -46,6 +46,12 @@ export interface GitBranch {
46
46
  name: string;
47
47
  isCurrent: boolean;
48
48
  isRemote: boolean;
49
+ /**
50
+ * The branch this one tracks, e.g. `origin/main`. Populated from
51
+ * `%(upstream:short)`, or from `branch.<name>.remote`/`.merge` when the
52
+ * configured remote is a bare URL — which is what `gh pr checkout` writes for
53
+ * a fork PR, and which has no remote-tracking ref for git to name.
54
+ */
49
55
  upstream?: string;
50
56
  ahead: number;
51
57
  behind: number;
@@ -163,10 +169,107 @@ export interface GitConflictMarker {
163
169
  baseContent?: string;
164
170
  }
165
171
 
172
+ /**
173
+ * How git recorded the conflict, derived from the porcelain XY code. Only
174
+ * `both-modified` and `both-added` carry inline `<<<<<<<` markers; the rest are
175
+ * add/delete disagreements where the only meaningful answer is "keep the file"
176
+ * or "delete the file", which is why they need their own UI affordance.
177
+ */
178
+ export type GitConflictKind =
179
+ | 'both-modified' // UU
180
+ | 'both-added' // AA
181
+ | 'added-by-us' // AU
182
+ | 'added-by-them' // UA
183
+ | 'deleted-by-us' // DU
184
+ | 'deleted-by-them' // UD
185
+ | 'both-deleted'; // DD
186
+
187
+ /** Ways a single conflicted path can be resolved. */
188
+ export type GitConflictResolution =
189
+ /** Take the whole file from our side (`git checkout --ours`). */
190
+ | 'ours'
191
+ /** Take the whole file from their side (`git checkout --theirs`). */
192
+ | 'theirs'
193
+ /** Write caller-supplied content, then stage it. */
194
+ | 'custom'
195
+ /** Keep the working-tree file as it stands (`git add`). */
196
+ | 'keep'
197
+ /** Resolve as deleted (`git rm`). */
198
+ | 'delete'
199
+ /** Put the conflict markers back (`git checkout --merge`). */
200
+ | 'reset';
201
+
166
202
  export interface GitConflictFile {
167
203
  path: string;
204
+ /** Working-tree text. Empty when `contentOmitted` is true. */
168
205
  content: string;
169
206
  markers: GitConflictMarker[];
207
+ kind: GitConflictKind;
208
+ /** True when the file has no text side to edit (binary, missing, or oversized). */
209
+ contentOmitted: boolean;
210
+ /** Why the content was omitted — drives the resolver's fallback UI. */
211
+ omitReason?: 'binary' | 'missing' | 'too-large';
212
+ /** Working-tree size in bytes, when the file exists. */
213
+ size?: number;
214
+ }
215
+
216
+ /**
217
+ * Everything the UI needs to explain (and finish) an in-progress operation.
218
+ *
219
+ * `oursLabel`/`theirsLabel` exist because the two sides swap meaning between
220
+ * merge and rebase: rebasing replays your commits onto the upstream, so `ours`
221
+ * is the branch you are rebasing *onto* and `theirs` is your own commit — the
222
+ * exact opposite of a merge. Showing the raw words without the branch names is
223
+ * the single biggest source of wrong resolutions.
224
+ */
225
+ export interface GitOperationState {
226
+ operation: GitOperation | null;
227
+ /** 1-based position in a multi-commit replay (rebase only). */
228
+ step?: number;
229
+ /** Total commits in the replay (rebase only). */
230
+ total?: number;
231
+ /** Human label for the `ours` side, e.g. "main". */
232
+ oursLabel: string;
233
+ /** Human label for the `theirs` side, e.g. "your commit". */
234
+ theirsLabel: string;
235
+ /** Subject of the commit being replayed, when there is one. */
236
+ currentCommit?: string;
237
+ /** Paths still unmerged. `--continue` is refused while this is non-zero. */
238
+ unmergedCount: number;
239
+ canContinue: boolean;
240
+ canSkip: boolean;
241
+ /**
242
+ * Unmerged paths with no operation sentinel — a `stash pop`/`apply` that hit
243
+ * a conflict. The stash entry survives a failed pop, so aborting here must
244
+ * say so rather than implying the work is gone.
245
+ */
246
+ stashConflict: boolean;
247
+ }
248
+
249
+ // ============================================
250
+ // Push Target
251
+ // ============================================
252
+
253
+ /**
254
+ * Where `git push` will actually send this branch.
255
+ *
256
+ * The panel used to push to whichever remote its dropdown had selected, with
257
+ * `-u`. On a fork PR checked out for review that pushed the contributor's work
258
+ * into the main repository as a new branch, and the `-u` rewrote the branch's
259
+ * remote so every later push went there too. Resolving the real destination —
260
+ * and showing it — is what keeps that from happening.
261
+ */
262
+ export interface GitPushTarget {
263
+ /** Remote name, or a bare URL when that is how the branch is configured. */
264
+ remote: string;
265
+ /** Branch name on the far side, which need not match the local name. */
266
+ remoteBranch: string;
267
+ /** False when the branch tracks nothing, so a push has to pick a destination. */
268
+ hasUpstream: boolean;
269
+ /** True when `remote` is a URL rather than a configured remote name. */
270
+ isUrl: boolean;
271
+ /** The local branch this was resolved for. */
272
+ branch: string;
170
273
  }
171
274
 
172
275
  // ============================================
@@ -208,6 +311,26 @@ export interface GitTag {
208
311
  isAnnotated: boolean;
209
312
  }
210
313
 
314
+ // ============================================
315
+ // Reflog
316
+ // ============================================
317
+
318
+ /**
319
+ * One `git reflog` row. This is the repo's undo journal: it still holds commits
320
+ * that branch deletes, resets and rebases have orphaned, so it is the only way
321
+ * back from a destructive action.
322
+ */
323
+ export interface GitReflogEntry {
324
+ hash: string;
325
+ hashShort: string;
326
+ /** Reflog selector, e.g. `HEAD@{3}`. */
327
+ selector: string;
328
+ /** The recorded action, e.g. `rebase (finish)` or `commit`. */
329
+ action: string;
330
+ subject: string;
331
+ date: string;
332
+ }
333
+
211
334
  // ============================================
212
335
  // Commit Message Generation
213
336
  // ============================================
@@ -0,0 +1,140 @@
1
+ /**
2
+ * Third-party integrations — shared vocabulary.
3
+ *
4
+ * A connected account is NOT a feature. It is a credential with capabilities.
5
+ * Settings → Integrations is where you connect; what an integration DOES lives
6
+ * in the surface that owns that kind of work. These types are the contract
7
+ * between the two, and they are shared because the hub renders provider
8
+ * metadata the backend registry declares.
9
+ */
10
+
11
+ /**
12
+ * What an account can offer, and therefore which surface it projects onto.
13
+ *
14
+ * The full set is declared here from the start so a provider can honestly say
15
+ * what it supports, but only the surfaces that exist can be projected. Today
16
+ * that is `agent-tools`; each later surface registers its own projector.
17
+ */
18
+ export const INTEGRATION_CAPABILITIES = [
19
+ 'agent-tools',
20
+ /** Issues, pull requests and CI — the Issues & PRs surface. */
21
+ 'work',
22
+ 'deployments',
23
+ 'database',
24
+ 'worktree-branching',
25
+ 'notifications',
26
+ 'inbound-events'
27
+ ] as const;
28
+
29
+ export type IntegrationCapability = typeof INTEGRATION_CAPABILITIES[number];
30
+
31
+ /** How the credential is obtained. */
32
+ export type IntegrationAuthMethod =
33
+ | 'api-key'
34
+ | 'oauth-device'
35
+ | 'oauth-code'
36
+ | 'mcp-oauth'
37
+ | 'connection-string'
38
+ | 'none';
39
+
40
+ /**
41
+ * Declared as a const array rather than a bare union so the WebSocket schema can
42
+ * be generated from it. A `t.String()` there would widen `category` back to
43
+ * `string` on the client and quietly break every lookup keyed by it.
44
+ */
45
+ export const INTEGRATION_CATEGORIES = [
46
+ 'source-control',
47
+ 'issues',
48
+ 'deployment',
49
+ 'database',
50
+ 'observability',
51
+ 'chat',
52
+ 'research',
53
+ 'design',
54
+ 'developer-services',
55
+ 'secrets'
56
+ ] as const;
57
+
58
+ export type IntegrationCategory = typeof INTEGRATION_CATEGORIES[number];
59
+
60
+ /** One field of a provider's credential, as rendered by the connect dialog. */
61
+ export interface IntegrationCredentialField {
62
+ /** Key inside the account's credentials object. */
63
+ name: string;
64
+ label: string;
65
+ placeholder?: string;
66
+ help?: string;
67
+ isSecret: boolean;
68
+ isRequired: boolean;
69
+ }
70
+
71
+ /** Health of a connected account, mirroring the MCP probe vocabulary. */
72
+ export type IntegrationStatus = 'unknown' | 'ok' | 'needs_auth' | 'needs_config' | 'error';
73
+
74
+ /** A provider as the hub sees it. No icon field — the brand mark is keyed by id. */
75
+ export interface IntegrationProviderInfo {
76
+ id: string;
77
+ name: string;
78
+ category: IntegrationCategory;
79
+ description: string;
80
+ docsUrl?: string;
81
+ authMethod: IntegrationAuthMethod;
82
+ credentialFields: IntegrationCredentialField[];
83
+ capabilities: IntegrationCapability[];
84
+ defaultCapabilities: IntegrationCapability[];
85
+ /** True when connecting projects an MCP server row. */
86
+ providesAgentTools: boolean;
87
+ /** True when the provider can receive inbound webhooks. */
88
+ acceptsWebhooks: boolean;
89
+ }
90
+
91
+ /** A connected account as the hub sees it. Credential VALUES never cross this line. */
92
+ export interface IntegrationAccountInfo {
93
+ id: string;
94
+ provider: string;
95
+ label: string;
96
+ projectId: string | null;
97
+ authMethod: IntegrationAuthMethod;
98
+ /** Which credential fields currently hold a value — never the values themselves. */
99
+ configuredFields: string[];
100
+ capabilities: IntegrationCapability[];
101
+ status: IntegrationStatus;
102
+ statusDetail: string | null;
103
+ checkedAt: string | null;
104
+ isEnabled: boolean;
105
+ createdAt: string;
106
+ updatedAt: string;
107
+ /** Surfaces this account currently owns a row on. */
108
+ projections: IntegrationProjectionInfo[];
109
+ }
110
+
111
+ export interface IntegrationProjectionInfo {
112
+ capability: IntegrationCapability;
113
+ targetKind: IntegrationTargetKind;
114
+ targetId: string;
115
+ /** True when the row existed before the account did and will be handed back on disconnect. */
116
+ adopted: boolean;
117
+ }
118
+
119
+ /** Surfaces a capability can project onto. One entry per row in the architecture table. */
120
+ export type IntegrationTargetKind = 'mcp_server' | 'db_client_connection';
121
+
122
+ /**
123
+ * Secrets-at-rest health, surfaced as a banner in the hub.
124
+ *
125
+ * A non-zero count means the active key cannot open values that are in the
126
+ * database — almost always a restored backup meeting a freshly generated key.
127
+ */
128
+ export interface SecretsHealth {
129
+ /** Where the active master key came from. */
130
+ keySource: 'env' | 'file';
131
+ /** Fingerprint of the active key — matches the stamp inside every envelope. */
132
+ keyFingerprint: string;
133
+ /** Values the active key could not open since process start. */
134
+ failureCount: number;
135
+ lastFailureAt: string | null;
136
+ /** Fingerprints seen on values we could not open. */
137
+ unknownKeyFingerprints: string[];
138
+ /** Declared secret columns still holding plaintext. */
139
+ unsealedColumns: { table: string; column: string; count: number }[];
140
+ }
@@ -71,6 +71,14 @@ export interface AppSettings {
71
71
  chatAppearance: 'classic' | 'compact';
72
72
  /** Git diff viewer layout — true = side-by-side (2 columns), false = inline (1 column). Default: true. */
73
73
  gitDiffSideBySide: boolean;
74
+ /**
75
+ * Issue/pull-request diff layout. Default: false (inline, 1 column).
76
+ *
77
+ * Separate from the Git panel's: a review diff shares its pane with a file
78
+ * tree and a header, so two columns start narrow, and reading someone
79
+ * else's change is mostly reading the new side.
80
+ */
81
+ workDiffSideBySide: boolean;
74
82
  /** AI commit message generator configuration */
75
83
  commitGenerator: CommitGeneratorSettings;
76
84
  /** AI authoring model for artifact generation (optional; falls back to assistant model) */