vibe-coding-master 0.7.11 → 0.7.13

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.
@@ -1,5 +1,6 @@
1
1
  import path from "node:path";
2
2
  import { ROLE_NAMES, isDispatchableRole } from "../../shared/constants.js";
3
+ import { CCR_GPT_SESSION_MODEL, isCcrSessionModel } from "../../shared/types/session.js";
3
4
  import { VcmError } from "../errors.js";
4
5
  import { resolveRepoPath } from "../adapters/filesystem.js";
5
6
  import { submitTerminalInput } from "../runtime/terminal-submit.js";
@@ -54,6 +55,7 @@ export function createSessionService(deps) {
54
55
  const permissionMode = normalizeClaudePermissionMode(input.permissionMode ?? persisted?.permissionMode);
55
56
  const model = normalizeClaudeModel(input.model ?? persisted?.model);
56
57
  const effort = normalizeClaudeEffort(input.effort ?? persisted?.effort);
58
+ const modelEnvironment = await getModelLaunchEnvironment(model);
57
59
  const resumeClaudeSessionId = launchMode === "resume"
58
60
  ? persisted?.claudeSessionId
59
61
  : undefined;
@@ -89,7 +91,7 @@ export function createSessionService(deps) {
89
91
  VCM_TASK_SLUG: taskSlug,
90
92
  VCM_ROLE: role,
91
93
  VCM_SESSION_ID: claudeSessionId || undefined
92
- }),
94
+ }, modelEnvironment),
93
95
  cols: input.cols,
94
96
  rows: input.rows
95
97
  });
@@ -158,6 +160,7 @@ export function createSessionService(deps) {
158
160
  const permissionMode = normalizeClaudePermissionMode(input.permissionMode ?? persisted?.permissionMode);
159
161
  const model = normalizeClaudeModel(input.model ?? persisted?.model);
160
162
  const effort = normalizeClaudeEffort(input.effort ?? persisted?.effort ?? "medium");
163
+ const modelEnvironment = await getModelLaunchEnvironment(model);
161
164
  const resumeClaudeSessionId = launchMode === "resume"
162
165
  ? persisted?.claudeSessionId
163
166
  : undefined;
@@ -208,7 +211,7 @@ export function createSessionService(deps) {
208
211
  VCM_TASK_SLUG: PROJECT_TRANSLATOR_SCOPE,
209
212
  VCM_ROLE: TRANSLATOR_ROLE,
210
213
  VCM_SESSION_ID: claudeSessionId || undefined
211
- }),
214
+ }, modelEnvironment),
212
215
  cols: input.cols,
213
216
  rows: input.rows
214
217
  });
@@ -267,6 +270,7 @@ export function createSessionService(deps) {
267
270
  const permissionMode = normalizeClaudePermissionMode(input.permissionMode ?? persisted?.permissionMode);
268
271
  const model = normalizeClaudeModel(input.model ?? persisted?.model);
269
272
  const effort = normalizeClaudeEffort(input.effort ?? persisted?.effort ?? "medium");
273
+ const modelEnvironment = await getModelLaunchEnvironment(model);
270
274
  const resumeClaudeSessionId = launchMode === "resume"
271
275
  ? persisted?.claudeSessionId
272
276
  : undefined;
@@ -313,7 +317,7 @@ export function createSessionService(deps) {
313
317
  VCM_TASK_SLUG: PROJECT_HARNESS_ENGINEER_SCOPE,
314
318
  VCM_ROLE: HARNESS_ENGINEER_ROLE,
315
319
  VCM_SESSION_ID: claudeSessionId || undefined
316
- }),
320
+ }, modelEnvironment),
317
321
  cols: input.cols,
318
322
  rows: input.rows
319
323
  });
@@ -476,6 +480,7 @@ export function createSessionService(deps) {
476
480
  const permissionMode = normalizeClaudePermissionMode(session.permissionMode);
477
481
  const model = normalizeClaudeModel(session.model);
478
482
  const effort = normalizeClaudeEffort(session.effort);
483
+ const modelEnvironment = await getModelLaunchEnvironment(model);
479
484
  // Spawn (`claude --resume`) always anchors at the base repoRoot so resume works
480
485
  // even if the persisted task cwd was deleted. `--resume` then restores the
481
486
  // session's own last cwd (tracked on `session.cwd`), so the `/cd` migrate below
@@ -499,7 +504,7 @@ export function createSessionService(deps) {
499
504
  VCM_TASK_SLUG: normalizeProjectScopedRecordForPersistence(session).taskSlug,
500
505
  VCM_ROLE: session.role,
501
506
  VCM_SESSION_ID: session.claudeSessionId
502
- })
507
+ }, modelEnvironment)
503
508
  });
504
509
  if ((await waitForSessionInputReady(runtimeSession.id)) === "exited") {
505
510
  deps.registry.remove(runtimeSession.id);
@@ -542,6 +547,20 @@ export function createSessionService(deps) {
542
547
  await persistProjectScopedToolSession(repoRoot, resumed);
543
548
  return migrateRunningProjectToolSessionCwd(repoRoot, resumed, targetCwd);
544
549
  }
550
+ async function getModelLaunchEnvironment(model) {
551
+ if (!isCcrSessionModel(model)) {
552
+ return {};
553
+ }
554
+ if (!deps.ccrIntegration) {
555
+ throw new VcmError({
556
+ code: "CCR_UNAVAILABLE",
557
+ message: "CCR integration is not available in this VCM runtime.",
558
+ statusCode: 409,
559
+ hint: "Enable and configure CCR GPT models before starting this session."
560
+ });
561
+ }
562
+ return deps.ccrIntegration.getLaunchEnvironment(model);
563
+ }
545
564
  function isRuntimeSessionAlive(session) {
546
565
  if (!session || isExitedStatus(session.status) || session.pid === undefined) {
547
566
  return false;
@@ -650,6 +669,9 @@ export function createSessionService(deps) {
650
669
  return updated;
651
670
  }
652
671
  return {
672
+ async assertModelLaunchReady(model = "default") {
673
+ await getModelLaunchEnvironment(normalizeClaudeModel(model));
674
+ },
653
675
  startProjectTranslatorSession(repoRoot, input = {}) {
654
676
  return launchProjectTranslatorSession(repoRoot, input, "fresh");
655
677
  },
@@ -700,6 +722,7 @@ export function createSessionService(deps) {
700
722
  if (!existing) {
701
723
  return launchProjectTranslatorSession(repoRoot, input, "fresh");
702
724
  }
725
+ await getModelLaunchEnvironment(normalizeClaudeModel(input.model ?? existing.model));
703
726
  if (deps.runtime.getSession(existing.id)) {
704
727
  await deps.runtime.stop(existing.id);
705
728
  }
@@ -825,6 +848,7 @@ export function createSessionService(deps) {
825
848
  if (!existing) {
826
849
  return launchProjectHarnessEngineerSession(repoRoot, input, "fresh");
827
850
  }
851
+ await getModelLaunchEnvironment(normalizeClaudeModel(input.model ?? existing.model));
828
852
  if (deps.runtime.getSession(existing.id)) {
829
853
  await deps.runtime.stop(existing.id);
830
854
  }
@@ -935,6 +959,7 @@ export function createSessionService(deps) {
935
959
  if (!existing) {
936
960
  return launchRoleSession(repoRoot, taskSlug, role, input, "fresh");
937
961
  }
962
+ await getModelLaunchEnvironment(normalizeClaudeModel(input.model ?? existing.model));
938
963
  if (deps.runtime.getSession(existing.id)) {
939
964
  await deps.runtime.stop(existing.id);
940
965
  }
@@ -1433,7 +1458,8 @@ function normalizeClaudePermissionMode(value) {
1433
1458
  function normalizeClaudeModel(value) {
1434
1459
  if (value === "opus"
1435
1460
  || value === "sonnet"
1436
- || value === "fable") {
1461
+ || value === "fable"
1462
+ || value === CCR_GPT_SESSION_MODEL) {
1437
1463
  return value;
1438
1464
  }
1439
1465
  return "default";
@@ -1459,9 +1485,10 @@ function formatClaudeCdCommand(targetCwd) {
1459
1485
  function isExitedStatus(status) {
1460
1486
  return status === "exited" || status === "crashed" || status === "missing";
1461
1487
  }
1462
- function withClaudeCodeRuntimeEnv(env) {
1488
+ function withClaudeCodeRuntimeEnv(env, modelEnvironment = {}) {
1463
1489
  return {
1464
1490
  ...env,
1491
+ ...modelEnvironment,
1465
1492
  CLAUDE_CODE_DISABLE_AUTO_MEMORY
1466
1493
  };
1467
1494
  }
@@ -19,24 +19,51 @@ export const CLAUDE_MODEL_OPTIONS = [
19
19
  {
20
20
  value: "default",
21
21
  label: "Default",
22
- description: "Account default"
22
+ description: "Account default",
23
+ source: "claude",
24
+ available: true
23
25
  },
24
26
  {
25
27
  value: "fable",
26
28
  label: "Fable",
27
- description: "Claude Fable"
29
+ description: "Claude Fable",
30
+ source: "claude",
31
+ available: true
28
32
  },
29
33
  {
30
34
  value: "opus",
31
35
  label: "Opus",
32
- description: "Latest Opus"
36
+ description: "Latest Opus",
37
+ source: "claude",
38
+ available: true
33
39
  },
34
40
  {
35
41
  value: "sonnet",
36
42
  label: "Sonnet",
37
- description: "Latest Sonnet"
43
+ description: "Latest Sonnet",
44
+ source: "claude",
45
+ available: true
38
46
  }
39
47
  ];
48
+ export const CCR_GATEWAY_BASE_URL = "http://host.docker.internal:3456";
49
+ export const CCR_GPT_MODEL_ID = "Codex API/gpt-5.6-sol";
50
+ export const CCR_GPT_SESSION_MODEL = `ccr:${CCR_GPT_MODEL_ID}`;
51
+ export function isCcrSessionModel(model) {
52
+ return model === CCR_GPT_SESSION_MODEL;
53
+ }
54
+ export function createSessionModelOptions(ccrAvailable = false, unavailableReason = "CCR GPT models are unavailable.") {
55
+ return [
56
+ ...CLAUDE_MODEL_OPTIONS,
57
+ {
58
+ value: CCR_GPT_SESSION_MODEL,
59
+ label: "GPT-5.6 Sol (CCR)",
60
+ description: "GPT-5.6 Sol through the host CCR gateway",
61
+ source: "ccr",
62
+ available: ccrAvailable,
63
+ ...(ccrAvailable ? {} : { unavailableReason })
64
+ }
65
+ ];
66
+ }
40
67
  const BASE_EFFORT_OPTIONS = [
41
68
  {
42
69
  value: "default",