claude-code-session-manager 0.138.0 → 0.140.0
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/.claude-plugin/marketplace.json +1 -1
- package/README.md +352 -79
- package/dist/assets/AppSettings-CMFEM68R.js +2 -0
- package/dist/assets/History--JwsFnbn.js +2 -0
- package/dist/assets/HomeClaudeConfig-ijEXs--3.js +3 -0
- package/dist/assets/{Panel-CeDiyuNn.js → Panel-CALyU0pe.js} +1 -1
- package/dist/assets/ProjectClaudeConfig-sdlA-fUb.js +26 -0
- package/dist/assets/Scheduler-YT3j8SUa.js +16 -0
- package/dist/assets/{SkillReferenceGraph-CFMK8NJh.js → SkillReferenceGraph-CxAuwhNN.js} +1 -1
- package/dist/assets/Skills-DtRzghn5.js +67 -0
- package/dist/assets/{TiptapBody-D1kTj-tn.js → TiptapBody-DApeu7x8.js} +60 -54
- package/dist/assets/ViewTabs-B7qLXRAH.js +1 -0
- package/dist/assets/{VoiceButton-CZeyPM31.js → VoiceButton-DtStfv1H.js} +1 -1
- package/dist/assets/{historyTotals-B00l64Jw.js → historyTotals-ydfnwepc.js} +1 -1
- package/dist/assets/index-CtxruO1L.js +3121 -0
- package/dist/assets/{index-62tyjEQB.css → index-DKXdXfka.css} +1 -1
- package/dist/index.html +2 -2
- package/dist-web/app.css +1 -1
- package/dist-web/app.js +467 -451
- package/package.json +17 -6
- package/plugins/AGENTS.md +60 -0
- package/plugins/CLAUDE.md +1 -60
- package/plugins/session-manager-dev/.claude-plugin/plugin.json +1 -1
- package/plugins/session-manager-dev/skills/builder/SKILL.md +12 -4
- package/plugins/session-manager-dev/skills/builder/scripts/publish-preflight.cjs +255 -0
- package/plugins/session-manager-dev/skills/develop/SKILL.md +36 -22
- package/plugins/session-manager-dev/skills/maintaining-md-network/SKILL.md +5 -4
- package/plugins/session-manager-dev/skills/maintaining-md-network/audit.md +4 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/drift-check.md +16 -12
- package/plugins/session-manager-dev/skills/maintaining-md-network/migrate-to-agents-md.md +15 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/placement.md +50 -2
- package/plugins/session-manager-dev/skills/maintaining-md-network/plan.md +10 -10
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/drift-check.cjs +117 -112
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdDuplicates.cjs +182 -0
- package/plugins/session-manager-dev/skills/maintaining-md-network/scripts/mdLinks.cjs +340 -0
- package/scripts/README.md +2 -0
- package/scripts/hooks/guard-tool-risk.cjs +91 -0
- package/scripts/hooks/lib/guard-tool-risk-policy.cjs +217 -0
- package/scripts/ops-sweep.cjs +53 -23
- package/scripts/scheduler-mcp-server.cjs +360 -35
- package/src/main/build-info.json +4 -4
- package/src/main/chatRunner.cjs +2 -2
- package/src/main/config.cjs +112 -8
- package/src/main/docEdit.cjs +6 -1
- package/src/main/exchanges.cjs +70 -5
- package/src/main/files.cjs +7 -27
- package/src/main/health.cjs +48 -15
- package/src/main/historyAggregator.cjs +172 -63
- package/src/main/historyDashboard.cjs +87 -17
- package/src/main/index.cjs +78 -4
- package/src/main/ipcSchemas.cjs +233 -20
- package/src/main/lib/AGENTS.md +54 -0
- package/src/main/lib/CLAUDE.md +1 -54
- package/src/main/lib/agent-cli/adapters/codex.cjs +5 -2
- package/src/main/lib/agent-cli/agentCliIpc.cjs +18 -2
- package/src/main/lib/agent-cli/agentCliSessionStore.cjs +1 -0
- package/src/main/lib/agent-cli/agentCliTurn.cjs +20 -2
- package/src/main/lib/agent-cli/geminiContextDefaults.cjs +94 -0
- package/src/main/lib/claude/effectiveModelInfo.cjs +92 -22
- package/src/main/lib/claude/jobSandboxPolicy.cjs +202 -0
- package/src/main/lib/claude/modelPricing.cjs +148 -0
- package/src/main/lib/claude/personaToolScope.cjs +12 -6
- package/src/main/lib/claude/rateLimitDetect.cjs +13 -2
- package/src/main/lib/claude/runClaudeP.cjs +6 -1
- package/src/main/lib/claude/toolRiskIpc.cjs +177 -0
- package/src/main/lib/claude/toolRiskMarks.cjs +373 -0
- package/src/main/lib/demo-video-kit/seedKit.cjs +27 -6
- package/src/main/lib/ephemeralCwd.cjs +37 -2
- package/src/main/lib/epic/delegationReadiness.cjs +42 -9
- package/src/main/lib/epic/epicAdminRoutes.cjs +121 -0
- package/src/main/lib/epic/epicJobReceipt.cjs +87 -0
- package/src/main/lib/epic/epicOutsideRead.cjs +423 -0
- package/src/main/lib/epic/epicOutsideState.cjs +233 -0
- package/src/main/lib/epic/epicSettle.cjs +1 -1
- package/src/main/lib/epic/epicStateWatcher.cjs +157 -0
- package/src/main/lib/epic/epicSweepValidator.cjs +7 -2
- package/src/main/lib/epic/epicValidationHook.cjs +24 -4
- package/src/main/lib/epic/externalRef.cjs +37 -0
- package/src/main/lib/epic/externalRefIndex.cjs +136 -0
- package/src/main/lib/epic/guardSpawnSettings.cjs +57 -1
- package/src/main/lib/epic/restorableSessions.cjs +151 -17
- package/src/main/lib/epic/transcriptUsage.cjs +197 -0
- package/src/main/lib/externalContract.cjs +137 -0
- package/src/main/lib/feedback-remote/crossProjectFeedback.cjs +176 -5
- package/src/main/lib/feedback-remote/crossProjectReply.cjs +186 -9
- package/src/main/lib/feedback-remote/customerFeedbackAdminRoutes.cjs +16 -6
- package/src/main/lib/feedback-remote/customerFeedbackClient.cjs +50 -8
- package/src/main/lib/feedback-remote/customerFeedbackInbox.cjs +218 -4
- package/src/main/lib/feedback-remote/customerFeedbackIpc.cjs +19 -3
- package/src/main/lib/feedback-remote/feedbackImages.cjs +171 -0
- package/src/main/lib/feedback-remote/localAdminHttp.cjs +11 -10
- package/src/main/lib/feedback-remote/macroAdminRoutes.cjs +167 -21
- package/src/main/lib/feedback-remote/needsYouAdminRoutes.cjs +133 -0
- package/src/main/lib/feedback-remote/needsYouIpc.cjs +50 -0
- package/src/main/lib/feedback-remote/needsYouStore.cjs +285 -0
- package/src/main/lib/feedback-remote/projectHomeAdminRoutes.cjs +98 -1
- package/src/main/lib/feedback-remote/remoteIpcDispatch.cjs +5 -0
- package/src/main/lib/git/branchSweep.cjs +209 -4
- package/src/main/lib/git/gitWorktree.cjs +41 -5
- package/src/main/lib/guardShims.cjs +1 -1
- package/src/main/lib/historyRollup.cjs +58 -5
- package/src/main/lib/insideHome.cjs +27 -1
- package/src/main/lib/mcpToolCatalog.cjs +232 -25
- package/src/main/lib/mdDocCensus.cjs +59 -78
- package/src/main/lib/mdDocRefs.cjs +71 -93
- package/src/main/lib/mdNetworkScan.cjs +245 -250
- package/src/main/lib/mdReviewRecord.cjs +22 -9
- package/src/main/lib/memoryMdNetwork.cjs +5 -12
- package/src/main/lib/opsOwnership.cjs +18 -2
- package/src/main/lib/opsRetentionSettings.cjs +28 -4
- package/src/main/lib/persona-macro/agentAdminRoutes.cjs +121 -0
- package/src/main/lib/persona-macro/macroJobDispatch.cjs +90 -20
- package/src/main/lib/persona-macro/macroJobIpc.cjs +144 -46
- package/src/main/lib/persona-macro/macroJobStatus.cjs +87 -9
- package/src/main/lib/persona-macro/macroLibrary.cjs +95 -5
- package/src/main/lib/persona-macro/personaImportHealth.cjs +78 -17
- package/src/main/lib/persona-macro/projectVideoToolCheck.cjs +96 -0
- package/src/main/lib/persona-macro/shippedPersonaSeeds.cjs +11 -0
- package/src/main/lib/prd/depSlugResolve.cjs +104 -4
- package/src/main/lib/prd/prdAdminRoutes.cjs +35 -2
- package/src/main/lib/prd/prdCreate.cjs +351 -23
- package/src/main/lib/prd/prdDisposition.cjs +11 -2
- package/src/main/lib/prd/prdFrontmatter.cjs +96 -3
- package/src/main/lib/process/loginItem.cjs +171 -0
- package/src/main/lib/process/loginItemPlan.cjs +193 -0
- package/src/main/lib/project-pages/playerBridge.cjs +4 -0
- package/src/main/lib/project-pages/videoReview.cjs +268 -0
- package/src/main/lib/project-pages/videoReviewIpc.cjs +229 -0
- package/src/main/lib/promptSessionSchema.cjs +4 -0
- package/src/main/lib/remoteTranscriptTail.cjs +32 -1
- package/src/main/lib/scheduler/cpuSample.cjs +131 -4
- package/src/main/lib/scheduler/fixPlanSlug.cjs +4 -3
- package/src/main/lib/scheduler/loadGate.cjs +24 -6
- package/src/main/lib/scheduler/planRecordHarvest.cjs +108 -0
- package/src/main/lib/scheduler/planRecordRetention.cjs +144 -0
- package/src/main/lib/scheduler/queueStore.cjs +7 -0
- package/src/main/lib/scheduler/rcaReport.cjs +21 -1
- package/src/main/lib/scheduler/reaperHelpers.cjs +35 -5
- package/src/main/lib/scheduler/runLogRetention.cjs +104 -3
- package/src/main/lib/scheduler/scheduleJobSchema.cjs +3 -0
- package/src/main/lib/scheduler/schedulerBatch.cjs +25 -48
- package/src/main/lib/scheduler/schedulerPaths.cjs +12 -0
- package/src/main/lib/scheduler/sessionSlots.cjs +176 -21
- package/src/main/lib/scheduler/validationQuality.cjs +282 -0
- package/src/main/lib/scheduler/validatorVerdictSchema.cjs +254 -0
- package/src/main/lib/tasks/taskAdminRoutes.cjs +641 -0
- package/src/main/lib/tasks/taskIpc.cjs +80 -0
- package/src/main/lib/tasks/taskLedger.cjs +502 -0
- package/src/main/lib/tasks/taskRun.cjs +313 -0
- package/src/main/lib/tasks/taskSwitch.cjs +120 -0
- package/src/main/lib/telemetry/auditEvents.cjs +176 -0
- package/src/main/lib/telemetry/eventsAdminRoutes.cjs +45 -0
- package/src/main/loginItemIpc.cjs +35 -0
- package/src/main/loopEfficiencyHandlers.cjs +11 -2
- package/src/main/projectPages.cjs +6 -15
- package/src/main/promptSessionEvents.cjs +9 -1
- package/src/main/queueOps.cjs +260 -3
- package/src/main/runVerify.cjs +53 -25
- package/src/main/scheduler/AGENTS.md +26 -0
- package/src/main/scheduler/CLAUDE.md +1 -26
- package/src/main/scheduler/budget.cjs +239 -9
- package/src/main/scheduler/cancelDependents.cjs +154 -0
- package/src/main/scheduler/prdParser.cjs +4 -1
- package/src/main/scheduler/starvation.cjs +20 -18
- package/src/main/scheduler.cjs +774 -64
- package/src/main/supervisor.cjs +5 -1
- package/src/main/templates/PRD_AUTHORING.md +7 -1
- package/src/main/transcripts.cjs +62 -7
- package/src/main/validationQualityHandlers.cjs +199 -0
- package/src/main/webRemote.cjs +132 -20
- package/src/preload/api.d.ts +434 -28
- package/src/preload/apiSurface.cjs +7 -0
- package/src/preload/apiSurface.json +485 -81
- package/src/preload/index.cjs +38 -5
- package/src/seed/agents/validator.md +19 -8
- package/dist/assets/AgentLibrary-C1d_D7uQ.js +0 -2
- package/dist/assets/AppSettings-CgDhqrsU.js +0 -2
- package/dist/assets/Button-Bk23rEnZ.js +0 -1
- package/dist/assets/DocumentEditorPane-BqY5Nq6W.js +0 -1
- package/dist/assets/Extensions-CXem-uwI.js +0 -2
- package/dist/assets/History-BwO3coo4.js +0 -2
- package/dist/assets/Library-BDV69fSe.js +0 -32
- package/dist/assets/ListDetail-CD-Fm6mh.js +0 -1
- package/dist/assets/ProjectClaudeConfig-NjdKdwe8.js +0 -25
- package/dist/assets/ProvenanceBadge-Bu8NmI_R.js +0 -1
- package/dist/assets/Scheduler-CkhTvG7C.js +0 -16
- package/dist/assets/Settings-COT34hBF.js +0 -2
- package/dist/assets/Skills-BgexoUkQ.js +0 -29
- package/dist/assets/SourceChip-BXjcdeb1.js +0 -1
- package/dist/assets/SystemPrompt-CeeH3EeW.js +0 -1
- package/dist/assets/Toggle-CENi19iK.js +0 -1
- package/dist/assets/ViewTabs-DDBb0x96.js +0 -1
- package/dist/assets/claude-settings-schema-COigsajx.js +0 -3
- package/dist/assets/index-CgCxpunJ.js +0 -3116
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# src/main/lib/ — scoped context
|
|
2
|
+
|
|
3
|
+
Shared main-process helpers (CommonJS `.cjs`). Layout source of truth: `scripts/lib-layout.json`.
|
|
4
|
+
|
|
5
|
+
## What's here
|
|
6
|
+
|
|
7
|
+
- `agent-cli/` — other agent CLIs: registry, adapters, session store, turn planner, IPC.
|
|
8
|
+
- `app-preview/` — Epic dev-server preview processes (spawn, URL detect, stop, orphan sweep).
|
|
9
|
+
- `claude/` — claude CLI binary, caps, model/effort resolution.
|
|
10
|
+
- `demo-video-kit/` — demo-video build tools (capture, sound, frames, checks), seeded to `~/.claude/session-manager/demo-video-kit/`.
|
|
11
|
+
- `epic/` — Epic mint, worktrees, active index, spawn plan/cwd, transcripts.
|
|
12
|
+
- `feedback-remote/` — cross-project and customer feedback conduits.
|
|
13
|
+
- `git/` — git exec, worktrees, branch sweeps, job worktrees.
|
|
14
|
+
- `persona-macro/` — agent persona schema/merge, macro library, builtin macros.
|
|
15
|
+
- `prd/` — PRD parsing helpers, admin routes, dep-slug resolution, plan validation.
|
|
16
|
+
- `process/` — child processes, kill tree, env cleaning, pid liveness, instance lock.
|
|
17
|
+
- `project-pages/` — Project Home pages library, competitor matrix store/HTML, player bridge.
|
|
18
|
+
- `scheduler/` — dispatch loop, session slots, gates, supervisors, queue helpers.
|
|
19
|
+
- `tasks/` — Task ledger, switch, runner, admin routes and IPC (one headless claude -p run per project); store: [`tasks/README.md`](../../../session-manager-operations/tasks/README.md).
|
|
20
|
+
- `telemetry/` — audit/ops error logs, crash and OTLP telemetry.
|
|
21
|
+
- `util/` — generic pure helpers (atomic fs, kebab, home/cwd encoding, JSON extract, tail).
|
|
22
|
+
- top-level files — cross-cutting modules that fit no domain (`opsOwnership`, `activeSessions`, `projectRootResolve`, `cwdClassify`).
|
|
23
|
+
- `__tests__/` — tests for top-level modules; subfolders carry their own.
|
|
24
|
+
|
|
25
|
+
## Where a new module goes
|
|
26
|
+
|
|
27
|
+
Put it in the subfolder whose domain it serves; pure and domain-free goes in `util/`.
|
|
28
|
+
A new top-level `lib/` module needs a stated reason (no domain fits) in its header comment,
|
|
29
|
+
and a `scripts/lib-layout.json` entry. Never add a subfolder for one file.
|
|
30
|
+
|
|
31
|
+
## Reuse before writing
|
|
32
|
+
|
|
33
|
+
Each of these was found duplicated once. Grep first; extend the canonical one.
|
|
34
|
+
|
|
35
|
+
| Need | Canonical | Function |
|
|
36
|
+
| --- | --- | --- |
|
|
37
|
+
| Atomic write (tmp+rename) | `util/atomicFs.cjs` | `writeTextAtomic[Sync]`, `writeJsonAtomic[Sync]` |
|
|
38
|
+
| JSON read with fallback | `util/atomicFs.cjs` | `readJsonOr`, `readJsonOrSync` |
|
|
39
|
+
| PID liveness | `process/pidAlive.cjs` | `pidAlive` |
|
|
40
|
+
| Kebab / slug | `util/kebabCase.cjs` | `kebabCase` |
|
|
41
|
+
| Project root, read-only/total (never throws) | `activeSessions.cjs` | `projectRootOf` |
|
|
42
|
+
| Project root, validated; `opsInternal:'refuse'` for writers | `opsOwnership.cjs` | `resolveProjectRoot` |
|
|
43
|
+
| Project root + Epic from session/epic hints | `projectRootResolve.cjs` | `resolveProjectContext` |
|
|
44
|
+
| Ops-root path (single-writer law) | `opsOwnership.cjs` | `opsPath` |
|
|
45
|
+
| Run git | `git/gitExec.cjs` | `execGit` |
|
|
46
|
+
| Spawn `claude -p` (only machine-wide cap) | `scheduler/sessionSlots.cjs` | `acquire`, `release` |
|
|
47
|
+
|
|
48
|
+
Pin `--model` on every `claude -p` spawn.
|
|
49
|
+
|
|
50
|
+
## What must NOT be assumed
|
|
51
|
+
|
|
52
|
+
- No private process caps, no hand-rolled tmp+rename, no new `JSON.parse(readFileSync)` fallbacks.
|
|
53
|
+
- Never call `activeSessions.cjs` `allProjectCwds`/`activeProjectCwds` on an IPC, boot or timer hot path: they scan `~/.claude/projects` synchronously (7k+ dirs, 0.3-4 s; the 2026-10-25 OOM crashes).
|
|
54
|
+
- `ipcSchemas.cjs` `validated()` passes the zod-parsed payload, which strips unknown keys: an IPC key rename the schema misses silently drops the key (2026-11-07 persona wipe). Rename keys and schema in one PRD; prefer `.strict()`.
|
package/src/main/lib/CLAUDE.md
CHANGED
|
@@ -1,54 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Shared main-process helpers (CommonJS `.cjs`). Layout source of truth: `scripts/lib-layout.json`.
|
|
4
|
-
|
|
5
|
-
## What's here
|
|
6
|
-
|
|
7
|
-
- `agent-cli/` — other agent CLIs: registry, adapters, session store, turn planner, IPC.
|
|
8
|
-
- `app-preview/` — Epic dev-server preview processes (spawn, URL detect, stop, orphan sweep).
|
|
9
|
-
- `claude/` — claude CLI binary, caps, model/effort resolution.
|
|
10
|
-
- `demo-video-kit/` — demo-video build tools (capture, sound, frames, checks), seeded to `~/.claude/session-manager/demo-video-kit/`.
|
|
11
|
-
- `epic/` — Epic mint, worktrees, active index, spawn plan/cwd, transcripts.
|
|
12
|
-
- `feedback-remote/` — cross-project and customer feedback conduits.
|
|
13
|
-
- `git/` — git exec, worktrees, branch sweeps, job worktrees.
|
|
14
|
-
- `persona-macro/` — agent persona schema/merge, macro library, builtin macros.
|
|
15
|
-
- `prd/` — PRD parsing helpers, admin routes, dep-slug resolution, plan validation.
|
|
16
|
-
- `process/` — child processes, kill tree, env cleaning, pid liveness, instance lock.
|
|
17
|
-
- `project-pages/` — Project Home pages library, competitor matrix store/HTML, player bridge.
|
|
18
|
-
- `scheduler/` — dispatch loop, session slots, gates, supervisors, queue helpers.
|
|
19
|
-
- `telemetry/` — audit/ops error logs, crash and OTLP telemetry.
|
|
20
|
-
- `util/` — generic pure helpers (atomic fs, kebab, home/cwd encoding, JSON extract, tail).
|
|
21
|
-
- top-level files — cross-cutting modules that fit no domain (`opsOwnership`, `activeSessions`, `projectRootResolve`, `cwdClassify`).
|
|
22
|
-
- `__tests__/` — tests for top-level modules; subfolders carry their own.
|
|
23
|
-
|
|
24
|
-
## Where a new module goes
|
|
25
|
-
|
|
26
|
-
Put it in the subfolder whose domain it serves; pure and domain-free goes in `util/`.
|
|
27
|
-
A new top-level `lib/` module needs a stated reason (no domain fits) in its header comment,
|
|
28
|
-
and a `scripts/lib-layout.json` entry. Never add a subfolder for one file.
|
|
29
|
-
|
|
30
|
-
## Reuse before writing
|
|
31
|
-
|
|
32
|
-
Each of these was found duplicated once. Grep first; extend the canonical one.
|
|
33
|
-
|
|
34
|
-
| Need | Canonical | Function |
|
|
35
|
-
| --- | --- | --- |
|
|
36
|
-
| Atomic write (tmp+rename) | `util/atomicFs.cjs` | `writeTextAtomic[Sync]`, `writeJsonAtomic[Sync]` |
|
|
37
|
-
| JSON read with fallback | `util/atomicFs.cjs` | `readJsonOr`, `readJsonOrSync` |
|
|
38
|
-
| PID liveness | `process/pidAlive.cjs` | `pidAlive` |
|
|
39
|
-
| Kebab / slug | `util/kebabCase.cjs` | `kebabCase` |
|
|
40
|
-
| Project root, read-only/total (never throws) | `activeSessions.cjs` | `projectRootOf` |
|
|
41
|
-
| Project root, validated; `opsInternal:'refuse'` for writers | `opsOwnership.cjs` | `resolveProjectRoot` |
|
|
42
|
-
| Project root + Epic from session/epic hints | `projectRootResolve.cjs` | `resolveProjectContext` |
|
|
43
|
-
| Ops-root path (single-writer law) | `opsOwnership.cjs` | `opsPath` |
|
|
44
|
-
| Run git | `git/gitExec.cjs` | `execGit` |
|
|
45
|
-
| Spawn `claude -p` (only machine-wide cap) | `scheduler/sessionSlots.cjs` | `acquire`, `release` |
|
|
46
|
-
|
|
47
|
-
Pin `--model` on every `claude -p` spawn.
|
|
48
|
-
|
|
49
|
-
## What must NOT be assumed
|
|
50
|
-
|
|
51
|
-
- Never `path.join` an agent cwd to build an ops path — use `opsPath`.
|
|
52
|
-
- No private process caps, no hand-rolled tmp+rename, no new `JSON.parse(readFileSync)` fallbacks.
|
|
53
|
-
- Never call `activeSessions.cjs` `allProjectCwds`/`activeProjectCwds` on an IPC, boot or timer hot path: they scan `~/.claude/projects` synchronously (7k+ dirs, 0.3-4 s; the 2026-10-25 OOM crashes).
|
|
54
|
-
- `ipcSchemas.cjs` `validated()` passes the zod-parsed payload, which strips unknown keys: an IPC key rename the schema misses silently drops the key (2026-11-07 persona wipe). Rename keys and schema in one PRD; prefer `.strict()`.
|
|
1
|
+
@AGENTS.md
|
|
@@ -8,6 +8,9 @@ const {
|
|
|
8
8
|
} = require('../agentCliEvents.cjs');
|
|
9
9
|
|
|
10
10
|
const BYPASS = '--dangerously-bypass-approvals-and-sandbox';
|
|
11
|
+
// Root-level config override: in a folder with no AGENTS.md, Codex reads CLAUDE.md instead.
|
|
12
|
+
// Must precede the subcommand head (spawn argv, no shell — the quotes are part of the TOML value).
|
|
13
|
+
const FALLBACK = ['-c', 'project_doc_fallback_filenames=["CLAUDE.md"]'];
|
|
11
14
|
|
|
12
15
|
function modelArgs(model) {
|
|
13
16
|
return typeof model === 'string' && model ? ['-m', model] : [];
|
|
@@ -20,14 +23,14 @@ function hasId(id) {
|
|
|
20
23
|
function headlessSpawn({ prompt, nativeSessionId, model } = {}) {
|
|
21
24
|
const head = hasId(nativeSessionId) ? ['exec', 'resume', nativeSessionId] : ['exec'];
|
|
22
25
|
return {
|
|
23
|
-
args: [...head, '--json', BYPASS, '--skip-git-repo-check', ...modelArgs(model), '-'],
|
|
26
|
+
args: [...FALLBACK, ...head, '--json', BYPASS, '--skip-git-repo-check', ...modelArgs(model), '-'],
|
|
24
27
|
stdin: prompt,
|
|
25
28
|
};
|
|
26
29
|
}
|
|
27
30
|
|
|
28
31
|
function interactiveArgs({ nativeSessionId, model } = {}) {
|
|
29
32
|
const head = hasId(nativeSessionId) ? ['resume', nativeSessionId] : [];
|
|
30
|
-
return [...head, BYPASS, ...modelArgs(model)];
|
|
33
|
+
return [...FALLBACK, ...head, BYPASS, ...modelArgs(model)];
|
|
31
34
|
}
|
|
32
35
|
|
|
33
36
|
const str = (v) => (typeof v === 'string' ? v : undefined);
|
|
@@ -17,6 +17,7 @@ const { validated } = require('../../ipcSchemas.cjs');
|
|
|
17
17
|
const registry = require('./agentCliRegistry.cjs');
|
|
18
18
|
const { readNativeSession } = require('./agentCliSessionStore.cjs');
|
|
19
19
|
const { findEpicByClaudeSessionId } = require('../claude/agentModelResolve.cjs');
|
|
20
|
+
const { ensureGeminiSystemDefaults } = require('./geminiContextDefaults.cjs');
|
|
20
21
|
|
|
21
22
|
const detectSchema = z.object({ refresh: z.boolean().optional() }).strict();
|
|
22
23
|
const terminalCommandSchema = z.object({
|
|
@@ -37,6 +38,8 @@ function withDefaults(deps) {
|
|
|
37
38
|
readNativeSession: d.readNativeSession || readNativeSession,
|
|
38
39
|
adapterFor: d.adapterFor || registry.adapterFor,
|
|
39
40
|
detectAgentClis: d.detectAgentClis || registry.detectAgentClis,
|
|
41
|
+
ensureGeminiSystemDefaults: d.ensureGeminiSystemDefaults || ensureGeminiSystemDefaults,
|
|
42
|
+
platform: typeof d.platform === 'string' ? d.platform : process.platform,
|
|
40
43
|
};
|
|
41
44
|
}
|
|
42
45
|
|
|
@@ -89,8 +92,21 @@ async function buildTerminalCommand({ cwd, claudeSessionId }, deps) {
|
|
|
89
92
|
} catch (e) {
|
|
90
93
|
return { ok: false, message: `Could not build the ${entry.label} command: ${e && e.message ? e.message : String(e)}` };
|
|
91
94
|
}
|
|
92
|
-
const
|
|
93
|
-
return { ok: true, command };
|
|
95
|
+
const base = [binPath, ...(Array.isArray(args) ? args : [])].map(shellQuote).join(' ');
|
|
96
|
+
return { ok: true, command: geminiEnvPrefix(cli, d) + base };
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Gemini only: `GEMINI_CLI_SYSTEM_DEFAULTS_PATH='<file>' ` so the Terminal view
|
|
101
|
+
* loads the same AGENTS.md map as chat turns. POSIX `VAR=value cmd` syntax, so
|
|
102
|
+
* win32 gets no prefix; a null/throwing defaults helper also yields ''.
|
|
103
|
+
*/
|
|
104
|
+
function geminiEnvPrefix(cli, d) {
|
|
105
|
+
if (cli !== 'gemini' || d.platform === 'win32') return '';
|
|
106
|
+
let res = null;
|
|
107
|
+
try { res = d.ensureGeminiSystemDefaults({ platform: d.platform }); } catch { res = null; }
|
|
108
|
+
if (!res || typeof res.path !== 'string' || !res.path) return '';
|
|
109
|
+
return `GEMINI_CLI_SYSTEM_DEFAULTS_PATH=${shellQuote(res.path)} `;
|
|
94
110
|
}
|
|
95
111
|
|
|
96
112
|
/**
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
const registry = require('./agentCliRegistry.cjs');
|
|
13
13
|
const sessionStore = require('./agentCliSessionStore.cjs');
|
|
14
|
+
const geminiContextDefaults = require('./geminiContextDefaults.cjs');
|
|
14
15
|
|
|
15
16
|
const NOOP_TRANSCRIPT = Object.freeze({ userPrompt() {}, event() {}, close() {} });
|
|
16
17
|
|
|
@@ -22,6 +23,7 @@ function withDefaults(deps) {
|
|
|
22
23
|
catalog: d.catalog || registry.AGENT_CLI_CATALOG,
|
|
23
24
|
readNativeSession: d.readNativeSession || sessionStore.readNativeSession,
|
|
24
25
|
createTranscriptWriter: d.createTranscriptWriter || sessionStore.createTranscriptWriter,
|
|
26
|
+
ensureGeminiSystemDefaults: d.ensureGeminiSystemDefaults || geminiContextDefaults.ensureGeminiSystemDefaults,
|
|
25
27
|
env: d.env || process.env,
|
|
26
28
|
};
|
|
27
29
|
}
|
|
@@ -37,9 +39,22 @@ function pickAuthEnv(entry, env) {
|
|
|
37
39
|
return out;
|
|
38
40
|
}
|
|
39
41
|
|
|
42
|
+
/**
|
|
43
|
+
* Gemini only: point GEMINI_CLI_SYSTEM_DEFAULTS_PATH at the SM-owned defaults
|
|
44
|
+
* file that adds AGENTS.md to context.fileName. Null / throw → no key, the
|
|
45
|
+
* turn runs exactly as before.
|
|
46
|
+
*/
|
|
47
|
+
function geminiContextEnv(d) {
|
|
48
|
+
try {
|
|
49
|
+
const res = d.ensureGeminiSystemDefaults({ env: d.env });
|
|
50
|
+
if (res && typeof res.path === 'string' && res.path) return { GEMINI_CLI_SYSTEM_DEFAULTS_PATH: res.path };
|
|
51
|
+
} catch { /* best effort: no AGENTS.md map, turn still runs */ }
|
|
52
|
+
return {};
|
|
53
|
+
}
|
|
54
|
+
|
|
40
55
|
/**
|
|
41
56
|
* @param {{ epic: object, claudeSessionId: string, cwd: string, prompt: string, deps?: object }} opts
|
|
42
|
-
* @returns {{ ok: true, command: string, args: string[], stdin: string, envExtra: Record<string,string>,
|
|
57
|
+
* @returns {{ ok: true, command: string, args: string[], cwd: string, stdin: string, envExtra: Record<string,string>,
|
|
43
58
|
* parser: { push(line: string): object[], end(o: { exitCode: number|null }): object[] },
|
|
44
59
|
* transcript: { userPrompt(t: string): void, event(e: object): void, close(): void }, cli: string }
|
|
45
60
|
* | { ok: false, code: string, message: string }}
|
|
@@ -87,9 +102,12 @@ function planAgentCliTurn({ epic, claudeSessionId, cwd, prompt, deps } = {}) {
|
|
|
87
102
|
return {
|
|
88
103
|
ok: true,
|
|
89
104
|
command,
|
|
105
|
+
// The spawn cwd is the one passed in (chatRunner passes the Epic worktree's execCwd) —
|
|
106
|
+
// Codex starts its AGENTS.md / CLAUDE.md walk there.
|
|
107
|
+
cwd,
|
|
90
108
|
args: Array.isArray(spawnPlan.args) ? spawnPlan.args : [],
|
|
91
109
|
stdin: typeof spawnPlan.stdin === 'string' ? spawnPlan.stdin : '',
|
|
92
|
-
envExtra: pickAuthEnv(entry, d.env),
|
|
110
|
+
envExtra: cli === 'gemini' ? { ...pickAuthEnv(entry, d.env), ...geminiContextEnv(d) } : pickAuthEnv(entry, d.env),
|
|
93
111
|
parser: adapter.createParser(),
|
|
94
112
|
transcript,
|
|
95
113
|
cli,
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
// SM-owned Gemini CLI system-defaults file. Gemini CLI reads only GEMINI.md as
|
|
3
|
+
// context by default, so a Gemini Epic in an AGENTS.md project would start with
|
|
4
|
+
// no project map. This writes a copy of the machine's real system-defaults
|
|
5
|
+
// file (lowest settings layer, so user/project context.fileName still wins)
|
|
6
|
+
// with AGENTS.md and GEMINI.md added to context.fileName, under the agent-cli
|
|
7
|
+
// state root, and returns its path for GEMINI_CLI_SYSTEM_DEFAULTS_PATH.
|
|
8
|
+
// CLAUDE.md is deliberately NOT added: Gemini follows @-imports, so a
|
|
9
|
+
// CLAUDE.md stub (@AGENTS.md) beside AGENTS.md would load the map twice.
|
|
10
|
+
// Pure helper: injected env/platform/fs/dir; no spawn, no network.
|
|
11
|
+
|
|
12
|
+
const nodeFs = require('node:fs');
|
|
13
|
+
const path = require('node:path');
|
|
14
|
+
const { writeJsonAtomicSync } = require('../util/atomicFs.cjs');
|
|
15
|
+
const { rootDir } = require('./agentCliSessionStore.cjs');
|
|
16
|
+
|
|
17
|
+
const OUTPUT_FILE = 'gemini-system-defaults.json';
|
|
18
|
+
const CONTEXT_NAMES = ['AGENTS.md', 'GEMINI.md'];
|
|
19
|
+
|
|
20
|
+
const PLATFORM_DEFAULTS = {
|
|
21
|
+
linux: '/etc/gemini-cli/system-defaults.json',
|
|
22
|
+
darwin: '/Library/Application Support/GeminiCli/system-defaults.json',
|
|
23
|
+
win32: 'C:\\ProgramData\\gemini-cli\\system-defaults.json',
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
function isPlainObject(v) {
|
|
27
|
+
return !!v && typeof v === 'object' && !Array.isArray(v);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/** The path Gemini CLI itself would read system defaults from. */
|
|
31
|
+
function realSystemDefaultsPath({ env = process.env, platform = process.platform } = {}) {
|
|
32
|
+
const override = env && env.GEMINI_CLI_SYSTEM_DEFAULTS_PATH;
|
|
33
|
+
if (typeof override === 'string' && override.trim()) return override;
|
|
34
|
+
return PLATFORM_DEFAULTS[platform] || PLATFORM_DEFAULTS.linux;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Read the real file. Missing → {}; unreadable, malformed, or not a JSON
|
|
39
|
+
* object → undefined (caller returns null and writes nothing).
|
|
40
|
+
*/
|
|
41
|
+
function readRealDefaults(fs, file) {
|
|
42
|
+
let raw;
|
|
43
|
+
try {
|
|
44
|
+
raw = fs.readFileSync(file, 'utf8');
|
|
45
|
+
} catch (e) {
|
|
46
|
+
if (e && e.code === 'ENOENT') return {};
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
if (String(raw).trim() === '') return {};
|
|
50
|
+
let parsed;
|
|
51
|
+
try {
|
|
52
|
+
parsed = JSON.parse(raw);
|
|
53
|
+
} catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
return isPlainObject(parsed) ? parsed : undefined;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
function mergedFileNames(existing) {
|
|
60
|
+
const base = typeof existing === 'string'
|
|
61
|
+
? [existing]
|
|
62
|
+
: Array.isArray(existing) ? existing.filter((n) => typeof n === 'string') : [];
|
|
63
|
+
const out = [];
|
|
64
|
+
for (const n of [...base, ...CONTEXT_NAMES]) if (!out.includes(n)) out.push(n);
|
|
65
|
+
return out;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
function ensureGeminiSystemDefaults({
|
|
69
|
+
env = process.env,
|
|
70
|
+
platform = process.platform,
|
|
71
|
+
fs = nodeFs,
|
|
72
|
+
dir,
|
|
73
|
+
} = {}) {
|
|
74
|
+
const real = readRealDefaults(fs, realSystemDefaultsPath({ env, platform }));
|
|
75
|
+
if (real === undefined) return null;
|
|
76
|
+
const context = isPlainObject(real.context) ? real.context : {};
|
|
77
|
+
const merged = {
|
|
78
|
+
...real,
|
|
79
|
+
context: { ...context, fileName: mergedFileNames(context.fileName) },
|
|
80
|
+
};
|
|
81
|
+
const outFile = path.join(dir || rootDir(), OUTPUT_FILE);
|
|
82
|
+
const next = `${JSON.stringify(merged, null, 2)}\n`;
|
|
83
|
+
let current = null;
|
|
84
|
+
try { current = fs.readFileSync(outFile, 'utf8'); } catch { /* not written yet */ }
|
|
85
|
+
if (current !== next) writeJsonAtomicSync(outFile, merged, { mode: 0o600 });
|
|
86
|
+
return { path: outFile };
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
module.exports = {
|
|
90
|
+
ensureGeminiSystemDefaults,
|
|
91
|
+
realSystemDefaultsPath,
|
|
92
|
+
OUTPUT_FILE,
|
|
93
|
+
CONTEXT_NAMES,
|
|
94
|
+
};
|
|
@@ -201,39 +201,105 @@ function readTail(filePath, maxBytes, deps) {
|
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
// The alias families whose concrete ids carry the family name (claude-opus-5-5 for opus).
|
|
205
|
+
// best / opusplan / default name no single family, so they get no family check.
|
|
206
|
+
const MODEL_FAMILIES = new Set(['opus', 'sonnet', 'haiku', 'fable']);
|
|
207
|
+
|
|
208
|
+
/** The family an alias names ('opus[1m]' -> 'opus'), or null when it names none. */
|
|
209
|
+
function aliasFamily(modelAlias) {
|
|
210
|
+
if (!modelAlias) return null;
|
|
211
|
+
const base = modelAlias.replace(/\[[^\]]*\]$/, '');
|
|
212
|
+
return MODEL_FAMILIES.has(base) ? base : null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// What a concrete model id looks like: 'claude-' then lower-case letters,
|
|
216
|
+
// digits, dots or hyphens, with an optional bracket suffix ('[1m]'). Anything
|
|
217
|
+
// else — '<synthetic>', a string torn out of quoted source text — is refused.
|
|
218
|
+
const MODEL_ID_SHAPE = /^claude-[a-z0-9.-]+(\[[a-z0-9]+\])?$/;
|
|
219
|
+
|
|
220
|
+
/** Each line of `text` parsed as JSON; lines that do not parse (a cut last line) are skipped. */
|
|
221
|
+
function parseJsonLines(text) {
|
|
222
|
+
const out = [];
|
|
223
|
+
for (const line of text.split('\n')) {
|
|
224
|
+
if (!line.startsWith('{')) continue;
|
|
225
|
+
try {
|
|
226
|
+
out.push(JSON.parse(line));
|
|
227
|
+
} catch {
|
|
228
|
+
// incomplete or non-JSON line — no evidence
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
return out;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* True when `id` is acceptable evidence for `modelAlias`: a concrete id (never
|
|
236
|
+
* an alias) and, for a family alias, one whose name contains that family — so
|
|
237
|
+
* an opus persona can never be reported as running a fable or sonnet id.
|
|
238
|
+
*/
|
|
239
|
+
function fitsAlias(id, modelAlias) {
|
|
240
|
+
if (typeof id !== 'string' || !MODEL_ID_SHAPE.test(id)) return false;
|
|
241
|
+
if (!isConcreteModelId(id)) return false;
|
|
242
|
+
const family = aliasFamily(modelAlias);
|
|
243
|
+
return !family || id.includes(family);
|
|
244
|
+
}
|
|
245
|
+
|
|
204
246
|
/**
|
|
205
247
|
* Evidence source 1: the scheduler already logs the persona-resolved model
|
|
206
248
|
* at dispatch (scheduler.cjs's executeJob, ~line 4473: `[scheduler]
|
|
207
249
|
* agentType=... persona=... model=...`). Scans this project's hot queue.json
|
|
208
250
|
* jobs[] AND its archived history.jsonl for the most recent job whose
|
|
209
|
-
* agentType matches, then reads that job's own run log for the line
|
|
210
|
-
*
|
|
251
|
+
* agentType matches, then reads that job's own run log for the line — only
|
|
252
|
+
* from a line that starts with it and stands before the first JSON line, so
|
|
253
|
+
* the same text quoted inside a later line never counts. That line holds what
|
|
254
|
+
* was passed to `--model` — usually the alias itself — so when it is an alias,
|
|
255
|
+
* the concrete id is the `model` field of the first parsed system/init line.
|
|
256
|
+
* A job with no fitting, id-shaped value gives no evidence and the next newest
|
|
257
|
+
* job is tried. O(J log J) to sort J candidate
|
|
258
|
+
* jobs, O(min(logSize, cap)) per log read.
|
|
211
259
|
*/
|
|
212
|
-
function findLatestSchedulerModel(cwd, agentType, deps) {
|
|
260
|
+
function findLatestSchedulerModel(cwd, agentType, modelAlias, deps) {
|
|
213
261
|
const jobs = [...readHotJobsForCwd(cwd, deps), ...readHistoryEntriesForCwd(cwd, deps)];
|
|
214
262
|
const matches = jobs.filter((j) => j && j.agentType === agentType && j.runId && j.slug);
|
|
215
263
|
matches.sort((a, b) => jobTimestampMs(b) - jobTimestampMs(a));
|
|
216
264
|
|
|
217
|
-
const
|
|
265
|
+
const headerRe = /^\[scheduler\] agentType=\S+ persona=.*? model=(\S+)/;
|
|
218
266
|
for (const job of matches) {
|
|
219
267
|
const logPath = path.join(schedulerPaths.runsDir(), job.runId, `${job.slug}.log`);
|
|
220
268
|
const head = readHead(logPath, MAX_RUN_LOG_HEAD_BYTES, deps);
|
|
221
269
|
if (!head) continue;
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
270
|
+
const lines = head.split('\n');
|
|
271
|
+
// The scheduler's own header stands before the CLI's first JSON line;
|
|
272
|
+
// the same text inside a later (JSON) line is quoted content, not a header.
|
|
273
|
+
let logged = null;
|
|
274
|
+
let firstJson = lines.length;
|
|
275
|
+
for (let i = 0; i < lines.length; i++) {
|
|
276
|
+
if (lines[i].startsWith('{')) { firstJson = i; break; }
|
|
277
|
+
const m = headerRe.exec(lines[i]);
|
|
278
|
+
if (m && logged === null) logged = m[1];
|
|
279
|
+
}
|
|
280
|
+
if (!logged) continue;
|
|
281
|
+
if (isConcreteModelId(logged)) {
|
|
282
|
+
if (fitsAlias(logged, modelAlias)) return logged;
|
|
283
|
+
continue;
|
|
284
|
+
}
|
|
285
|
+
// Alias: the concrete id is the model field of the first system/init line.
|
|
286
|
+
const init = parseJsonLines(lines.slice(firstJson).join('\n'))
|
|
287
|
+
.find((o) => o && o.type === 'system' && o.subtype === 'init');
|
|
288
|
+
if (init && fitsAlias(init.model, modelAlias)) return init.model;
|
|
226
289
|
}
|
|
227
290
|
return null;
|
|
228
291
|
}
|
|
229
292
|
|
|
230
293
|
/**
|
|
231
294
|
* Evidence source 2: the most recent Epic (active-index.json entry) created
|
|
232
|
-
* with this agentType
|
|
233
|
-
* `
|
|
234
|
-
*
|
|
295
|
+
* with this agentType AND the model being resolved — a session whose own
|
|
296
|
+
* `model` override names anything else ran a different model and says
|
|
297
|
+
* nothing about this persona. Read via its own claude-session transcript:
|
|
298
|
+
* message.model of the last parsed `type:'assistant'` line that fits (so
|
|
299
|
+
* '<synthetic>' and quoted text never count). O(E log E) to sort E candidate
|
|
300
|
+
* Epics, O(min(transcriptSize, cap)) per transcript read.
|
|
235
301
|
*/
|
|
236
|
-
function findLatestTranscriptModel(cwd, agentType, deps) {
|
|
302
|
+
function findLatestTranscriptModel(cwd, agentType, modelAlias, deps) {
|
|
237
303
|
const readActiveIndex = deps.readActiveIndex || require('../epic/epicMint.cjs').readActiveIndex;
|
|
238
304
|
let sessions;
|
|
239
305
|
try {
|
|
@@ -241,20 +307,24 @@ function findLatestTranscriptModel(cwd, agentType, deps) {
|
|
|
241
307
|
} catch {
|
|
242
308
|
return null;
|
|
243
309
|
}
|
|
244
|
-
const matches = Object.values(sessions || {}).filter((s) => s && s.agentType === agentType && s.claudeSessionId
|
|
310
|
+
const matches = Object.values(sessions || {}).filter((s) => s && s.agentType === agentType && s.claudeSessionId
|
|
311
|
+
&& (!s.model || s.model === modelAlias));
|
|
245
312
|
matches.sort((a, b) => (Date.parse(b.createdAt || 0) || 0) - (Date.parse(a.createdAt || 0) || 0));
|
|
246
313
|
|
|
247
314
|
const homeDir = deps.homeDir || os.homedir();
|
|
248
|
-
const re = /"model":"([^"]+)"/g;
|
|
249
315
|
for (const session of matches) {
|
|
250
316
|
const filePath = resolveEpicTranscriptPath({ cwd, claudeSessionId: session.claudeSessionId, deps: { homeDir } }).path;
|
|
251
317
|
if (!filePath) continue;
|
|
252
318
|
const tail = readTail(filePath, MAX_TRANSCRIPT_TAIL_BYTES, deps);
|
|
253
319
|
if (!tail) continue;
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
320
|
+
// message.model of the last fitting assistant line; quoted text never counts.
|
|
321
|
+
const entries = parseJsonLines(tail);
|
|
322
|
+
for (let i = entries.length - 1; i >= 0; i--) {
|
|
323
|
+
const e = entries[i];
|
|
324
|
+
if (!e || e.type !== 'assistant') continue;
|
|
325
|
+
const id = e.message && e.message.model;
|
|
326
|
+
if (fitsAlias(id, modelAlias)) return id;
|
|
327
|
+
}
|
|
258
328
|
}
|
|
259
329
|
return null;
|
|
260
330
|
}
|
|
@@ -309,18 +379,18 @@ async function resolveEffectiveModelInfo({ cwd, agentType, deps = {} } = {}) {
|
|
|
309
379
|
// Agentless: no per-agent evidence to look up (it would match every agentless job).
|
|
310
380
|
if (!agentType) return result;
|
|
311
381
|
|
|
312
|
-
// Evidence is never derived via
|
|
313
|
-
// (which
|
|
382
|
+
// Evidence is never derived via lib/claude/modelPricing.cjs's priceForModel
|
|
383
|
+
// (which prices any unknown id at a family fallback with estimated:true) —
|
|
314
384
|
// deliberately: that is a pricing heuristic, and borrowing it here would
|
|
315
385
|
// turn "we don't know" into a confident wrong answer.
|
|
316
|
-
const schedulerHit = findLatestSchedulerModel(normalizedCwd, agentType, deps);
|
|
386
|
+
const schedulerHit = findLatestSchedulerModel(normalizedCwd, agentType, modelAlias, deps);
|
|
317
387
|
if (schedulerHit) {
|
|
318
388
|
result.resolvedModelId = schedulerHit;
|
|
319
389
|
result.resolvedFrom = 'scheduler-run';
|
|
320
390
|
return result;
|
|
321
391
|
}
|
|
322
392
|
|
|
323
|
-
const transcriptHit = findLatestTranscriptModel(normalizedCwd, agentType, deps);
|
|
393
|
+
const transcriptHit = findLatestTranscriptModel(normalizedCwd, agentType, modelAlias, deps);
|
|
324
394
|
if (transcriptHit) {
|
|
325
395
|
result.resolvedModelId = transcriptHit;
|
|
326
396
|
result.resolvedFrom = 'transcript';
|