@thegitai/cli 1.0.0-preview.37 → 1.0.0-preview.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.
@@ -122,6 +122,16 @@ export function validateServerModel(modelId, serverModels) {
122
122
  }
123
123
  return requested;
124
124
  }
125
+ export function resolveResumedSessionModel(storedModelId, serverModels) {
126
+ if (serverModels.models.some((model) => model.id === storedModelId)) {
127
+ return { modelId: storedModelId, fellBack: false };
128
+ }
129
+ const fallbackId = serverModels.models[0]?.id;
130
+ return {
131
+ modelId: fallbackId ?? storedModelId,
132
+ fellBack: fallbackId != null,
133
+ };
134
+ }
125
135
  export function updateSelectedModelCache({ config, selectedModelId, serverModels, env = process.env, }) {
126
136
  writeCachedServerModels({
127
137
  serverUrl: normalizeServerUrl(config.serverUrl),
@@ -2289,7 +2289,14 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
2289
2289
  }));
2290
2290
  try {
2291
2291
  const snapshot = await loadInteractiveSession(selected.id);
2292
- applySessionSnapshot(session, snapshot);
2292
+ const requestedModelId = Number(snapshot.modelId);
2293
+ const knownModels = currentServerModels.models.some((model) => model.id === requestedModelId)
2294
+ ? currentServerModels
2295
+ : await refreshServerModels();
2296
+ const { modelId: resolvedModelId, fellBack } = models.resolveResumedSessionModel(requestedModelId, knownModels);
2297
+ applySessionSnapshot(session, snapshot, {
2298
+ modelOverride: fellBack ? resolvedModelId : undefined,
2299
+ });
2293
2300
  setBackgroundJobSession(session.sessionId);
2294
2301
  setScratchSession(session.sessionId);
2295
2302
  setImageStoreSession(session.sessionId);
@@ -2314,6 +2321,15 @@ export async function runClientInteractive({ appendPromptHistory, authConfig, de
2314
2321
  kind: 'system',
2315
2322
  title: 'Session',
2316
2323
  },
2324
+ ...(fellBack
2325
+ ? [
2326
+ {
2327
+ body: `This session's model is no longer available — switched to ${formatModelLabel(resolvedModelId, knownModels.models)}. Conversation history preserved.`,
2328
+ kind: 'system',
2329
+ title: 'Model',
2330
+ },
2331
+ ]
2332
+ : []),
2317
2333
  ...buildTranscriptFromSessionHistory(session.history),
2318
2334
  ]);
2319
2335
  await remountTui();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@thegitai/cli",
3
- "version": "1.0.0-preview.37",
3
+ "version": "1.0.0-preview.38",
4
4
  "description": "TheGitAI is an agentic AI coding tool for your terminal. It reads and searches your repository, writes and edits files, runs your tests, and verifies the change before handing it back.",
5
5
  "keywords": [
6
6
  "agentic-ai",
@@ -44,11 +44,11 @@
44
44
  "@lydell/node-pty-linux-x64": "1.1.0",
45
45
  "@lydell/node-pty-win32-arm64": "1.1.0",
46
46
  "@lydell/node-pty-win32-x64": "1.1.0",
47
- "@thegitai/tui-darwin-arm64": "1.0.0-preview.37",
48
- "@thegitai/tui-darwin-x64": "1.0.0-preview.37",
49
- "@thegitai/tui-linux-arm64": "1.0.0-preview.37",
50
- "@thegitai/tui-linux-x64": "1.0.0-preview.37",
51
- "@thegitai/tui-win32-x64": "1.0.0-preview.37",
47
+ "@thegitai/tui-darwin-arm64": "1.0.0-preview.38",
48
+ "@thegitai/tui-darwin-x64": "1.0.0-preview.38",
49
+ "@thegitai/tui-linux-arm64": "1.0.0-preview.38",
50
+ "@thegitai/tui-linux-x64": "1.0.0-preview.38",
51
+ "@thegitai/tui-win32-x64": "1.0.0-preview.38",
52
52
  "@vscode/ripgrep": "1.18.0"
53
53
  },
54
54
  "repository": {