@bastani/atomic 0.8.28-alpha.4 → 0.8.29-alpha.2

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 (134) hide show
  1. package/CHANGELOG.md +75 -0
  2. package/dist/builtin/cursor/CHANGELOG.md +27 -0
  3. package/dist/builtin/cursor/LICENSE +26 -0
  4. package/dist/builtin/cursor/README.md +22 -0
  5. package/dist/builtin/cursor/index.ts +9 -0
  6. package/dist/builtin/cursor/package.json +46 -0
  7. package/dist/builtin/cursor/src/auth.ts +352 -0
  8. package/dist/builtin/cursor/src/catalog-cache.ts +155 -0
  9. package/dist/builtin/cursor/src/config.ts +123 -0
  10. package/dist/builtin/cursor/src/conversation-state.ts +135 -0
  11. package/dist/builtin/cursor/src/cursor-models-raw.json +583 -0
  12. package/dist/builtin/cursor/src/model-mapper.ts +270 -0
  13. package/dist/builtin/cursor/src/models.ts +54 -0
  14. package/dist/builtin/cursor/src/native-loader.ts +71 -0
  15. package/dist/builtin/cursor/src/proto/README.md +34 -0
  16. package/dist/builtin/cursor/src/proto/agent_pb.ts +15294 -0
  17. package/dist/builtin/cursor/src/proto/protobuf-codec.ts +717 -0
  18. package/dist/builtin/cursor/src/provider.ts +301 -0
  19. package/dist/builtin/cursor/src/stream.ts +564 -0
  20. package/dist/builtin/cursor/src/transport.ts +791 -0
  21. package/dist/builtin/intercom/CHANGELOG.md +10 -0
  22. package/dist/builtin/intercom/package.json +2 -2
  23. package/dist/builtin/intercom/skills/intercom/SKILL.md +5 -5
  24. package/dist/builtin/mcp/CHANGELOG.md +10 -0
  25. package/dist/builtin/mcp/package.json +3 -3
  26. package/dist/builtin/subagents/CHANGELOG.md +18 -0
  27. package/dist/builtin/subagents/README.md +7 -3
  28. package/dist/builtin/subagents/agents/codebase-online-researcher.md +9 -24
  29. package/dist/builtin/subagents/agents/debugger.md +3 -5
  30. package/dist/builtin/subagents/package.json +4 -4
  31. package/dist/builtin/subagents/src/runs/background/subagent-runner.ts +2 -1
  32. package/dist/builtin/subagents/src/runs/foreground/execution.ts +2 -1
  33. package/dist/builtin/subagents/src/runs/shared/parallel-utils.ts +1 -0
  34. package/dist/builtin/subagents/src/runs/shared/pi-args.ts +19 -2
  35. package/dist/builtin/subagents/src/runs/shared/structured-output.ts +271 -10
  36. package/dist/builtin/subagents/src/runs/shared/subagent-prompt-runtime.ts +12 -39
  37. package/dist/builtin/subagents/src/shared/types.ts +1 -0
  38. package/dist/builtin/subagents/src/shared/utils.ts +50 -10
  39. package/dist/builtin/subagents/src/slash/saved-chain-mapping.ts +77 -0
  40. package/dist/builtin/subagents/src/slash/slash-commands.ts +1 -55
  41. package/dist/builtin/web-access/CHANGELOG.md +11 -1
  42. package/dist/builtin/web-access/README.md +1 -1
  43. package/dist/builtin/web-access/github-extract.ts +1 -1
  44. package/dist/builtin/web-access/package.json +3 -3
  45. package/dist/builtin/workflows/CHANGELOG.md +44 -0
  46. package/dist/builtin/workflows/README.md +19 -1
  47. package/dist/builtin/workflows/package.json +2 -2
  48. package/dist/builtin/workflows/skills/research-codebase/SKILL.md +17 -3
  49. package/dist/builtin/workflows/src/extension/wiring.ts +17 -1
  50. package/dist/builtin/workflows/src/extension/workflow-schema.ts +34 -0
  51. package/dist/builtin/workflows/src/runs/foreground/executor.ts +13 -2
  52. package/dist/builtin/workflows/src/runs/foreground/stage-runner.ts +86 -14
  53. package/dist/builtin/workflows/src/shared/authoring-contract.d.ts +11 -3
  54. package/dist/builtin/workflows/src/shared/types.ts +8 -4
  55. package/dist/builtin/workflows/src/tui/overlay-adapter.ts +64 -2
  56. package/dist/builtin/workflows/src/tui/workflow-attach-pane.ts +8 -8
  57. package/dist/builtin/workflows/src/tui/workflow-status.ts +2 -0
  58. package/dist/core/builtin-packages.d.ts.map +1 -1
  59. package/dist/core/builtin-packages.js +6 -0
  60. package/dist/core/builtin-packages.js.map +1 -1
  61. package/dist/core/extensions/index.d.ts +1 -1
  62. package/dist/core/extensions/index.d.ts.map +1 -1
  63. package/dist/core/extensions/index.js.map +1 -1
  64. package/dist/core/extensions/types.d.ts +20 -0
  65. package/dist/core/extensions/types.d.ts.map +1 -1
  66. package/dist/core/extensions/types.js.map +1 -1
  67. package/dist/core/model-resolver.d.ts +1 -0
  68. package/dist/core/model-resolver.d.ts.map +1 -1
  69. package/dist/core/model-resolver.js +17 -8
  70. package/dist/core/model-resolver.js.map +1 -1
  71. package/dist/core/package-manager.d.ts +11 -9
  72. package/dist/core/package-manager.d.ts.map +1 -1
  73. package/dist/core/package-manager.js +55 -10
  74. package/dist/core/package-manager.js.map +1 -1
  75. package/dist/core/project-trust.d.ts +1 -0
  76. package/dist/core/project-trust.d.ts.map +1 -1
  77. package/dist/core/project-trust.js +3 -3
  78. package/dist/core/project-trust.js.map +1 -1
  79. package/dist/core/resource-loader.d.ts +9 -0
  80. package/dist/core/resource-loader.d.ts.map +1 -1
  81. package/dist/core/resource-loader.js +72 -9
  82. package/dist/core/resource-loader.js.map +1 -1
  83. package/dist/core/sdk.d.ts +3 -3
  84. package/dist/core/sdk.d.ts.map +1 -1
  85. package/dist/core/sdk.js +5 -5
  86. package/dist/core/sdk.js.map +1 -1
  87. package/dist/core/tools/index.d.ts +1 -0
  88. package/dist/core/tools/index.d.ts.map +1 -1
  89. package/dist/core/tools/index.js +1 -0
  90. package/dist/core/tools/index.js.map +1 -1
  91. package/dist/core/tools/structured-output.d.ts +39 -0
  92. package/dist/core/tools/structured-output.d.ts.map +1 -0
  93. package/dist/core/tools/structured-output.js +141 -0
  94. package/dist/core/tools/structured-output.js.map +1 -0
  95. package/dist/index.d.ts +1 -1
  96. package/dist/index.d.ts.map +1 -1
  97. package/dist/index.js +1 -1
  98. package/dist/index.js.map +1 -1
  99. package/dist/main.d.ts.map +1 -1
  100. package/dist/main.js +36 -14
  101. package/dist/main.js.map +1 -1
  102. package/dist/modes/interactive/components/login-dialog.d.ts +3 -0
  103. package/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
  104. package/dist/modes/interactive/components/login-dialog.js +16 -0
  105. package/dist/modes/interactive/components/login-dialog.js.map +1 -1
  106. package/dist/modes/interactive/interactive-mode.d.ts +11 -0
  107. package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
  108. package/dist/modes/interactive/interactive-mode.js +158 -11
  109. package/dist/modes/interactive/interactive-mode.js.map +1 -1
  110. package/dist/modes/print-mode.d.ts.map +1 -1
  111. package/dist/modes/print-mode.js +39 -0
  112. package/dist/modes/print-mode.js.map +1 -1
  113. package/docs/custom-provider.md +1 -0
  114. package/docs/extensions.md +2 -2
  115. package/docs/models.md +2 -0
  116. package/docs/packages.md +3 -1
  117. package/docs/providers.md +15 -0
  118. package/docs/sdk.md +61 -0
  119. package/docs/security.md +1 -1
  120. package/docs/subagents.md +21 -0
  121. package/docs/usage.md +2 -0
  122. package/docs/workflows.md +10 -7
  123. package/examples/extensions/README.md +1 -1
  124. package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
  125. package/examples/extensions/custom-provider-anthropic/package.json +1 -1
  126. package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
  127. package/examples/extensions/gondolin/package-lock.json +2 -2
  128. package/examples/extensions/gondolin/package.json +1 -1
  129. package/examples/extensions/sandbox/package-lock.json +2 -2
  130. package/examples/extensions/sandbox/package.json +1 -1
  131. package/examples/extensions/structured-output.ts +22 -53
  132. package/examples/extensions/with-deps/package-lock.json +2 -2
  133. package/examples/extensions/with-deps/package.json +1 -1
  134. package/package.json +12 -9
@@ -209,6 +209,10 @@ export class InteractiveMode {
209
209
  this.extensionInput = undefined;
210
210
  this.extensionEditor = undefined;
211
211
  this.extensionTerminalInputUnsubscribers = new Set();
212
+ this.blockingInlineCustomUiDepth = 0;
213
+ this.deferredInlineCustomUiFocusDepth = 0;
214
+ this.pendingInlineCustomUiFocus = undefined;
215
+ this.hostCustomUiStateListeners = new Set();
212
216
  // Extension widgets (components rendered above/below the editor)
213
217
  this.extensionWidgetsAbove = new Map();
214
218
  this.extensionWidgetsBelow = new Map();
@@ -1708,6 +1712,69 @@ export class InteractiveMode {
1708
1712
  }
1709
1713
  this.extensionTerminalInputUnsubscribers.clear();
1710
1714
  }
1715
+ getHostCustomUiState() {
1716
+ const focusDeferred = this.blockingInlineCustomUiDepth > 0 && this.pendingInlineCustomUiFocus !== undefined;
1717
+ return {
1718
+ blockingInlineCustomUiDepth: this.blockingInlineCustomUiDepth,
1719
+ blockingInlineCustomUiActive: this.blockingInlineCustomUiDepth > 0,
1720
+ ...(focusDeferred ? { blockingInlineCustomUiFocusDeferred: true } : {}),
1721
+ };
1722
+ }
1723
+ notifyHostCustomUiStateListeners() {
1724
+ const state = this.getHostCustomUiState();
1725
+ for (const listener of this.hostCustomUiStateListeners) {
1726
+ try {
1727
+ listener(state);
1728
+ }
1729
+ catch {
1730
+ /* ignore observer errors */
1731
+ }
1732
+ }
1733
+ }
1734
+ beginHostInlineCustomUi() {
1735
+ let released = false;
1736
+ this.blockingInlineCustomUiDepth++;
1737
+ this.notifyHostCustomUiStateListeners();
1738
+ return () => {
1739
+ if (released)
1740
+ return;
1741
+ released = true;
1742
+ this.blockingInlineCustomUiDepth = Math.max(0, this.blockingInlineCustomUiDepth - 1);
1743
+ this.notifyHostCustomUiStateListeners();
1744
+ };
1745
+ }
1746
+ beginInlineCustomUiFocusDeferral() {
1747
+ let released = false;
1748
+ this.deferredInlineCustomUiFocusDepth++;
1749
+ return () => {
1750
+ if (released)
1751
+ return;
1752
+ released = true;
1753
+ this.deferredInlineCustomUiFocusDepth = Math.max(0, this.deferredInlineCustomUiFocusDepth - 1);
1754
+ if (this.deferredInlineCustomUiFocusDepth === 0) {
1755
+ this.focusHostInlineCustomUi();
1756
+ }
1757
+ };
1758
+ }
1759
+ shouldDeferInlineCustomUiFocus() {
1760
+ return this.deferredInlineCustomUiFocusDepth > 0;
1761
+ }
1762
+ focusHostInlineCustomUi() {
1763
+ const component = this.pendingInlineCustomUiFocus;
1764
+ if (component === undefined)
1765
+ return false;
1766
+ this.pendingInlineCustomUiFocus = undefined;
1767
+ this.ui.setFocus(component);
1768
+ this.ui.requestRender();
1769
+ this.notifyHostCustomUiStateListeners();
1770
+ return true;
1771
+ }
1772
+ onHostCustomUiStateChange(listener) {
1773
+ this.hostCustomUiStateListeners.add(listener);
1774
+ return () => {
1775
+ this.hostCustomUiStateListeners.delete(listener);
1776
+ };
1777
+ }
1711
1778
  createProjectTrustContext(cwd) {
1712
1779
  const ui = this.createExtensionUIContext();
1713
1780
  return {
@@ -1732,6 +1799,9 @@ export class InteractiveMode {
1732
1799
  input: (title, placeholder, opts) => this.showExtensionInput(title, placeholder, opts),
1733
1800
  notify: (message, type) => this.showExtensionNotify(message, type),
1734
1801
  requestRender: () => this.ui.requestRender(),
1802
+ getHostCustomUiState: () => this.getHostCustomUiState(),
1803
+ onHostCustomUiStateChange: (listener) => this.onHostCustomUiStateChange(listener),
1804
+ focusHostInlineCustomUi: () => this.focusHostInlineCustomUi(),
1735
1805
  onTerminalInput: (handler) => this.addExtensionTerminalInputListener(handler),
1736
1806
  setStatus: (key, text) => this.setExtensionStatus(key, text),
1737
1807
  setWorkingMessage: (message) => {
@@ -1994,17 +2064,20 @@ export class InteractiveMode {
1994
2064
  async showExtensionCustom(factory, options) {
1995
2065
  const savedText = this.editor.getText();
1996
2066
  const isOverlay = options?.overlay ?? false;
1997
- const restoreEditor = () => {
2067
+ const restoreEditor = (focusEditor) => {
1998
2068
  this.editorContainer.clear();
1999
2069
  this.editorContainer.addChild(this.editor);
2000
2070
  this.editor.setText(savedText);
2001
- this.ui.setFocus(this.editor);
2071
+ if (focusEditor)
2072
+ this.ui.setFocus(this.editor);
2002
2073
  this.ui.requestRender();
2003
2074
  };
2004
2075
  return new Promise((resolve, reject) => {
2005
2076
  let component;
2006
2077
  let closed = false;
2007
2078
  let mounted = false;
2079
+ let releaseHostInlineCustomUi;
2080
+ let releaseOverlayInlineCustomUiFocusDeferral;
2008
2081
  const disposeComponent = () => {
2009
2082
  try {
2010
2083
  component?.dispose?.();
@@ -2013,16 +2086,28 @@ export class InteractiveMode {
2013
2086
  /* ignore dispose errors */
2014
2087
  }
2015
2088
  };
2089
+ const releaseHostCustomUi = () => {
2090
+ if (component !== undefined && this.pendingInlineCustomUiFocus === component) {
2091
+ this.pendingInlineCustomUiFocus = undefined;
2092
+ this.notifyHostCustomUiStateListeners();
2093
+ }
2094
+ releaseHostInlineCustomUi?.();
2095
+ };
2016
2096
  const cleanupAbortListener = () => {
2017
2097
  options?.signal?.removeEventListener("abort", abortCustomUi);
2018
2098
  };
2019
2099
  const closeMountedUi = () => {
2020
2100
  if (!mounted)
2021
2101
  return;
2022
- if (isOverlay)
2102
+ if (isOverlay) {
2103
+ releaseOverlayInlineCustomUiFocusDeferral?.();
2104
+ releaseOverlayInlineCustomUiFocusDeferral = undefined;
2023
2105
  this.ui.hideOverlay();
2024
- else
2025
- restoreEditor();
2106
+ }
2107
+ else {
2108
+ restoreEditor(!this.shouldDeferInlineCustomUiFocus() &&
2109
+ this.pendingInlineCustomUiFocus !== component);
2110
+ }
2026
2111
  };
2027
2112
  const close = (result) => {
2028
2113
  if (closed)
@@ -2030,8 +2115,9 @@ export class InteractiveMode {
2030
2115
  closed = true;
2031
2116
  cleanupAbortListener();
2032
2117
  closeMountedUi();
2033
- resolve(result);
2034
2118
  disposeComponent();
2119
+ releaseHostCustomUi();
2120
+ resolve(result);
2035
2121
  };
2036
2122
  const rejectAndClose = (reason) => {
2037
2123
  if (closed)
@@ -2040,6 +2126,7 @@ export class InteractiveMode {
2040
2126
  cleanupAbortListener();
2041
2127
  closeMountedUi();
2042
2128
  disposeComponent();
2129
+ releaseHostCustomUi();
2043
2130
  reject(reason);
2044
2131
  };
2045
2132
  function abortCustomUi() {
@@ -2049,8 +2136,23 @@ export class InteractiveMode {
2049
2136
  abortCustomUi();
2050
2137
  return;
2051
2138
  }
2139
+ releaseHostInlineCustomUi = isOverlay
2140
+ ? undefined
2141
+ : this.beginHostInlineCustomUi();
2142
+ if (options?.signal?.aborted) {
2143
+ abortCustomUi();
2144
+ return;
2145
+ }
2052
2146
  options?.signal?.addEventListener("abort", abortCustomUi, { once: true });
2053
- Promise.resolve(factory(this.ui, theme, this.keybindings, close))
2147
+ let factoryResult;
2148
+ try {
2149
+ factoryResult = factory(this.ui, theme, this.keybindings, close);
2150
+ }
2151
+ catch (err) {
2152
+ rejectAndClose(err);
2153
+ return;
2154
+ }
2155
+ Promise.resolve(factoryResult)
2054
2156
  .then((c) => {
2055
2157
  if (closed) {
2056
2158
  try {
@@ -2077,13 +2179,56 @@ export class InteractiveMode {
2077
2179
  };
2078
2180
  const handle = this.ui.showOverlay(component, resolveOptions());
2079
2181
  mounted = true;
2080
- // Expose handle to caller for visibility control
2081
- options?.onHandle?.(handle);
2182
+ if (options?.deferInlineCustomUiFocus) {
2183
+ let releaseDeferral = this.beginInlineCustomUiFocusDeferral();
2184
+ releaseOverlayInlineCustomUiFocusDeferral = () => {
2185
+ releaseDeferral?.();
2186
+ releaseDeferral = undefined;
2187
+ };
2188
+ const release = () => {
2189
+ releaseOverlayInlineCustomUiFocusDeferral?.();
2190
+ releaseOverlayInlineCustomUiFocusDeferral = undefined;
2191
+ };
2192
+ const wrappedHandle = {
2193
+ hide: () => {
2194
+ release();
2195
+ handle.hide();
2196
+ },
2197
+ setHidden: (hidden) => {
2198
+ if (hidden)
2199
+ release();
2200
+ handle.setHidden(hidden);
2201
+ if (!hidden && releaseDeferral === undefined) {
2202
+ releaseDeferral = this.beginInlineCustomUiFocusDeferral();
2203
+ releaseOverlayInlineCustomUiFocusDeferral = () => {
2204
+ releaseDeferral?.();
2205
+ releaseDeferral = undefined;
2206
+ };
2207
+ }
2208
+ },
2209
+ isHidden: () => handle.isHidden(),
2210
+ focus: () => handle.focus(),
2211
+ unfocus: (unfocusOptions) => handle.unfocus(unfocusOptions),
2212
+ isFocused: () => handle.isFocused(),
2213
+ };
2214
+ // Expose handle to caller for visibility control
2215
+ options?.onHandle?.(wrappedHandle);
2216
+ }
2217
+ else {
2218
+ // Expose handle to caller for visibility control
2219
+ options?.onHandle?.(handle);
2220
+ }
2082
2221
  }
2083
2222
  else {
2084
2223
  this.editorContainer.clear();
2085
2224
  this.editorContainer.addChild(component);
2086
- this.ui.setFocus(component);
2225
+ if (this.shouldDeferInlineCustomUiFocus()) {
2226
+ this.pendingInlineCustomUiFocus = component;
2227
+ this.notifyHostCustomUiStateListeners();
2228
+ }
2229
+ else {
2230
+ this.ui.setFocus(component);
2231
+ }
2087
2232
  mounted = true;
2088
2233
  this.ui.requestRender();
2089
2234
  }
@@ -4349,7 +4494,9 @@ export class InteractiveMode {
4349
4494
  try {
4350
4495
  await this.session.modelRegistry.authStorage.login(providerId, {
4351
4496
  onAuth: (info) => {
4352
- dialog.showAuth(info.url, info.instructions);
4497
+ dialog.showAuth(info.url, info.instructions, {
4498
+ showCancelHint: !usesCallbackServer,
4499
+ });
4353
4500
  if (usesCallbackServer) {
4354
4501
  // Show input for manual paste, racing with callback
4355
4502
  dialog