deepcode-ai 1.1.34 → 1.1.35

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/dist/index.js CHANGED
@@ -3359,6 +3359,7 @@ function isSimpleDirectCommand(input) {
3359
3359
  }
3360
3360
  function resolveExecutionTarget(config, session, mode, explicitProvider) {
3361
3361
  const modeOverride = config.modeDefaults?.[mode];
3362
+ const hasPinnedProvider = Boolean(explicitProvider ?? modeOverride?.provider) || session.metadata.providerPinned === true;
3362
3363
  const provider = explicitProvider ?? modeOverride?.provider ?? session.provider ?? config.defaultProvider ?? resolveUsableProviderTarget(config, []).provider;
3363
3364
  const modeModel = modeOverride?.provider && modeOverride.provider !== provider ? void 0 : modeOverride?.model;
3364
3365
  const model = modeModel ?? (provider === session.provider ? session.model : void 0) ?? resolveConfiguredModelForProvider(config, provider);
@@ -3368,6 +3369,9 @@ function resolveExecutionTarget(config, session, mode, explicitProvider) {
3368
3369
  if (hasProviderCredentials(config.providers[provider], provider) && model) {
3369
3370
  return { provider, model };
3370
3371
  }
3372
+ if (hasPinnedProvider) {
3373
+ return { provider, model };
3374
+ }
3371
3375
  const fallback = resolveUsableProviderTarget(config, [
3372
3376
  explicitProvider,
3373
3377
  modeOverride?.provider,
@@ -10579,7 +10583,7 @@ function resolveSessionTarget(config, overrides = {}) {
10579
10583
  requestedProvider,
10580
10584
  config.defaultProvider
10581
10585
  ]);
10582
- const parsedSelection = overrides.model ? parseModelSelection(overrides.model, requestedProvider ?? fallback.provider) : null;
10586
+ const parsedSelection = overrides.model ? requestedProvider ? { provider: requestedProvider, model: overrides.model.trim() } : parseModelSelection(overrides.model, fallback.provider) : null;
10583
10587
  if (overrides.model && !parsedSelection) {
10584
10588
  throw new Error(
10585
10589
  `Invalid model selection: ${overrides.model}. Use "<model>" or "<provider>/<model>".`
@@ -25863,7 +25867,7 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
25863
25867
  const handleAutocomplete = useCallback12(
25864
25868
  (indexToUse) => {
25865
25869
  if (indexToUse < 0 || indexToUse >= suggestions.length) {
25866
- return;
25870
+ return null;
25867
25871
  }
25868
25872
  const suggestion = suggestions[indexToUse].value;
25869
25873
  let start = completionStart;
@@ -25874,7 +25878,7 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
25874
25878
  end = lineOffset + slashCompletionRange.completionEnd;
25875
25879
  }
25876
25880
  if (start === -1 || end === -1) {
25877
- return;
25881
+ return null;
25878
25882
  }
25879
25883
  let suggestionText = suggestion;
25880
25884
  if (completionMode === "SLASH") {
@@ -25887,11 +25891,20 @@ function useCommandCompletion(buffer, cwd, slashCommands, commandContext, revers
25887
25891
  if (charAfterCompletion !== " ") {
25888
25892
  suggestionText += " ";
25889
25893
  }
25894
+ const startOffset = logicalPosToOffset(buffer.lines, cursorRow, start);
25895
+ const endOffset = logicalPosToOffset(buffer.lines, cursorRow, end);
25896
+ const currentText = toCodePoints(buffer.text);
25897
+ const nextText = [
25898
+ ...currentText.slice(0, startOffset),
25899
+ suggestionText,
25900
+ ...currentText.slice(endOffset)
25901
+ ].join("");
25890
25902
  buffer.replaceRangeByOffset(
25891
- logicalPosToOffset(buffer.lines, cursorRow, start),
25892
- logicalPosToOffset(buffer.lines, cursorRow, end),
25903
+ startOffset,
25904
+ endOffset,
25893
25905
  suggestionText
25894
25906
  );
25907
+ return nextText;
25895
25908
  },
25896
25909
  [
25897
25910
  cursorRow,
@@ -27104,22 +27117,22 @@ ${currentText}`);
27104
27117
  }
27105
27118
  const acceptActiveCompletionSuggestion = () => {
27106
27119
  if (completion.suggestions.length === 0) {
27107
- return false;
27120
+ return null;
27108
27121
  }
27109
27122
  const targetIndex = completion.activeSuggestionIndex === -1 ? 0 : completion.activeSuggestionIndex;
27110
27123
  if (targetIndex >= completion.suggestions.length) {
27111
- return false;
27124
+ return null;
27112
27125
  }
27113
- completion.handleAutocomplete(targetIndex);
27126
+ const completedText = completion.handleAutocomplete(targetIndex);
27114
27127
  exportCompletion.navigatedRef.current = false;
27115
27128
  setExpandedSuggestionIndex(-1);
27116
- return true;
27129
+ return completedText;
27117
27130
  };
27118
27131
  if (completion.isPerfectMatch && keyMatchers[
27119
27132
  "return"
27120
27133
  /* RETURN */
27121
27134
  ](key)) {
27122
- if (completion.showSuggestions && exportCompletion.navigatedRef.current && exportCompletion.navigatedTextRef.current === buffer.text && acceptActiveCompletionSuggestion()) {
27135
+ if (completion.showSuggestions && exportCompletion.navigatedRef.current && exportCompletion.navigatedTextRef.current === buffer.text && acceptActiveCompletionSuggestion() !== null) {
27123
27136
  return true;
27124
27137
  }
27125
27138
  handleSubmitAndClear(buffer.text);
@@ -27162,9 +27175,9 @@ ${currentText}`);
27162
27175
  "acceptSuggestion"
27163
27176
  /* ACCEPT_SUGGESTION */
27164
27177
  ](key) && !key.paste) {
27165
- const accepted = acceptActiveCompletionSuggestion();
27166
- if (accepted && key.name === "return" && isExactRunnableSlashCommand(buffer.text.trim(), slashCommands)) {
27167
- handleSubmitAndClear(buffer.text);
27178
+ const completedText = acceptActiveCompletionSuggestion();
27179
+ if (completedText !== null && key.name === "return" && isExactRunnableSlashCommand(completedText.trim(), slashCommands)) {
27180
+ handleSubmitAndClear(completedText);
27168
27181
  }
27169
27182
  return true;
27170
27183
  }
@@ -28328,7 +28341,7 @@ function parseVersion2(version) {
28328
28341
  if (!match) return null;
28329
28342
  return [Number(match[1]), Number(match[2]), Number(match[3])];
28330
28343
  }
28331
- var VERSION = "1.1.34".length > 0 ? "1.1.34" : "0.0.0-dev";
28344
+ var VERSION = "1.1.35".length > 0 ? "1.1.35" : "0.0.0-dev";
28332
28345
  var updateCommand = {
28333
28346
  name: "update",
28334
28347
  description: "Check published DeepCode versions",
@@ -30085,6 +30098,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30085
30098
  if (!runtime || !session) return;
30086
30099
  session.provider = provider2;
30087
30100
  session.model = resolveConfiguredModelForProvider(runtime.config, provider2);
30101
+ session.metadata = { ...session.metadata, providerPinned: true };
30088
30102
  runtime.sessions.save(session);
30089
30103
  setTargetSource("session");
30090
30104
  setCurrentModel(session.model ?? "(unconfigured)");
@@ -30105,6 +30119,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30105
30119
  if (!runtime || !session) return;
30106
30120
  const normalized2 = model2.trim();
30107
30121
  session.model = normalized2.length > 0 ? normalized2 : void 0;
30122
+ session.metadata = { ...session.metadata, providerPinned: true };
30108
30123
  runtime.sessions.save(session);
30109
30124
  setTargetSource("session");
30110
30125
  setCurrentModel(session.model ?? "(unconfigured)");
@@ -30296,10 +30311,17 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30296
30311
  session = existing;
30297
30312
  if (provider) session.provider = target.provider;
30298
30313
  if (model) session.model = target.model;
30314
+ if (provider || model) {
30315
+ session.metadata = { ...session.metadata, providerPinned: true };
30316
+ }
30299
30317
  runtime.sessions.save(session);
30300
30318
  resumed = true;
30301
30319
  } else {
30302
30320
  session = runtime.sessions.create(target);
30321
+ if (provider || model) {
30322
+ session.metadata = { ...session.metadata, providerPinned: true };
30323
+ runtime.sessions.save(session);
30324
+ }
30303
30325
  addHistoryItem(
30304
30326
  { type: "warning", text: `Session ${resumeSessionId} not found; starting new session.` },
30305
30327
  Date.now()
@@ -30307,6 +30329,10 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
30307
30329
  }
30308
30330
  } else {
30309
30331
  session = runtime.sessions.create(target);
30332
+ if (provider || model) {
30333
+ session.metadata = { ...session.metadata, providerPinned: true };
30334
+ runtime.sessions.save(session);
30335
+ }
30310
30336
  }
30311
30337
  runtimeRef.current = runtime;
30312
30338
  sessionRef.current = session;
@@ -31070,6 +31096,7 @@ var AppContainer = ({ cwd, config, provider, model, resumeSessionId }) => {
31070
31096
  if (session) {
31071
31097
  session.provider = provider2;
31072
31098
  session.model = configuredModel;
31099
+ session.metadata = { ...session.metadata, providerPinned: true };
31073
31100
  runtime?.sessions.save(session);
31074
31101
  setProviderLabel(formatProviderLabel(session.provider, session.model));
31075
31102
  setCurrentModel(session.model ?? "(unconfigured)");