@aiwayds/dsh-tui-pi 2.1.1 → 2.2.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/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  pi-style terminal UI for [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness) (dsh) — a plugin suite that turns dsh into a pi-like coding-agent experience: pi-tui look & feel, dsh slash commands, GitHub light/dark themes and a powerline footer.
6
6
 
7
- **Requires dsh >= 0.1.2-alpha.4** — the plugin targets the 0.1.2-alpha host line only (the rc line is no longer supported; see [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.4-single-target.md)).
7
+ **Requires dsh >= 0.1.2-alpha.4** — the plugin targets the 0.1.2-alpha host line only (the rc line is no longer supported; see [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.3-single-target.md)).
8
8
 
9
9
  https://github.com/user-attachments/assets/6a7e00bb-1fd0-4bc5-9070-457f1e9fa54d
10
10
 
package/README.zh-CN.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  面向 [DeepSeek Harness](https://github.com/deepseek-ai/deepseek-harness)(dsh)的 pi 风格终端 UI——一套把 dsh 变成 pi 式编码代理体验的插件套件:pi-tui 的外观与交互、dsh 斜杠命令、GitHub 明/暗主题和 powerline 状态栏。
6
6
 
7
- **要求 dsh >= 0.1.2-alpha.4** —— 本插件只面向 0.1.2-alpha 宿主线(不再支持 rc 线,见 [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.4-single-target.md))。
7
+ **要求 dsh >= 0.1.2-alpha.4** —— 本插件只面向 0.1.2-alpha 宿主线(不再支持 rc 线,见 [ADR 0002](docs/adr/0002-target-dsh-0.1.2-alpha.3-single-target.md))。
8
8
 
9
9
  https://github.com/user-attachments/assets/6a7e00bb-1fd0-4bc5-9070-457f1e9fa54d
10
10
 
@@ -54,7 +54,7 @@ export type AgentParseResult = {
54
54
  ok: false;
55
55
  error: string;
56
56
  };
57
- /** The dsh agents directory (`~/.dsh/agents`, under the dsh home). */
57
+ /** The dsh agents directory (`$DSH_HOME/agents`, under the dsh home). */
58
58
  export declare function agentsDir(): string;
59
59
  /**
60
60
  * The legacy agents directory from the first shipped layout (`~/dsh/agents`,
@@ -26,9 +26,10 @@
26
26
  import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs';
27
27
  import { homedir } from 'node:os';
28
28
  import { basename, join } from 'node:path';
29
- /** The dsh agents directory (`~/.dsh/agents`, under the dsh home). */
29
+ import { dshHome } from "./append-system.js";
30
+ /** The dsh agents directory (`$DSH_HOME/agents`, under the dsh home). */
30
31
  export function agentsDir() {
31
- return join(homedir(), '.dsh', 'agents');
32
+ return join(dshHome(), 'agents');
32
33
  }
33
34
  /**
34
35
  * The legacy agents directory from the first shipped layout (`~/dsh/agents`,
@@ -1 +1 @@
1
- {"version":3,"file":"agent-manager.js","sourceRoot":"","sources":["../src/agent-manager.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,SAAS,CAAA;AACzF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAA;AACjC,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAgC1C,sEAAsE;AACtE,MAAM,UAAU,SAAS;IACvB,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAA;AAC1C,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,eAAe;IAC7B,OAAO,IAAI,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,QAAQ,CAAC,CAAA;AACzC,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,sBAAsB,CACpC,YAAoB,SAAS,EAAE,EAC/B,YAAoB,eAAe,EAAE;IAErC,MAAM,EAAE,MAAM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AK,KAAK,SAAS,EAAE,CAAC;YACnC,MAAM,SAAS,GAAG,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;YACrD,IAAI,SAAS,KAAK,SAAS;gBAAE,KAAK,CAAC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAA;QAC3D,CAAC;QACD,aAAa,CAAC,IAAI,CAAC,SAAS,EAAE,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,EAAE,mBAAmB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC,CAAA;QACpG,MAAM,EAAE,CAAA;IACV,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,CAAA;AAC3B,CAAC;AAED,sEAAsE;AACtE,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAA;AACvB,CAAC"}
@@ -0,0 +1,97 @@
1
+ /**
2
+ * Profile-aware agent runtime composition — the single import seam for the
3
+ * dsh-subagent-registry contract (`workspaceProfileName` /
4
+ * `composeAgentRuntime` / `readModelProfilesDoc`, re-exported from the
5
+ * package root).
6
+ *
7
+ * The registry is probed once at module load. A registry build that has not
8
+ * shipped the contract yet (or one that fails to load) degrades to the
9
+ * built-in equivalent computed from this repo's own model-profiles store, so
10
+ * the /agents display and the scoped edit path keep working; once the
11
+ * registry ships the contract the very same call sites use it — no code
12
+ * changes needed.
13
+ *
14
+ * Composition semantics (shared with the registry's composeAgentRuntime,
15
+ * mirrored here so the fallback displays exactly what a spawn resolves):
16
+ * effective = frontmatter baseline ⊕ pinned profile overrides, per field —
17
+ * a recorded NON-EMPTY override wins; an absent/empty recorded value falls
18
+ * back to the baseline (an empty entry is the "recorded as inherit" shape,
19
+ * which in this model means the baseline still applies). `thinking` is
20
+ * whitelisted against the known effort ids, so a hand-edited store can
21
+ * never ship a host-rejected value. No pin, an unknown profile, a missing
22
+ * store or an unlistd agent → the baseline.
23
+ *
24
+ * Edit scoping uses the same store the writes land in: when the workspace is
25
+ * pinned to an existing profile, /agents model/think edits update that
26
+ * profile's per-agent overrides (model-profiles.json, workspace-scoped —
27
+ * the frontmatter baseline is untouched); otherwise they write the agent
28
+ * file's frontmatter, the pre-profile baseline behavior.
29
+ */
30
+ import { type ModelProfilesDoc } from './model-profiles.ts';
31
+ /** The baseline values an agent file's frontmatter carries. `null` = the key is absent (inherit). */
32
+ export interface AgentRuntimeBase {
33
+ model?: string | null;
34
+ thinking?: string | null;
35
+ }
36
+ /** Composed effective values for a spawned agent. Absent = inherit the default. */
37
+ export interface AgentRuntimeValues {
38
+ model?: string;
39
+ thinking?: string;
40
+ }
41
+ /** Whether the registry shipped the contract (diagnostics / report hook). */
42
+ export declare function registryContractAvailable(): boolean;
43
+ /**
44
+ * Pure composition: frontmatter baseline ⊕ pinned profile overrides,
45
+ * resolved against `doc`/`startDir` explicitly — the test surface,
46
+ * semantically identical to the registry composer (per-field override,
47
+ * absent/empty recorded values fall back to the baseline).
48
+ */
49
+ export declare function composeAgentValuesFromDoc(agentName: string, base: AgentRuntimeBase, doc: ModelProfilesDoc, startDir: string): AgentRuntimeValues;
50
+ /**
51
+ * The values to DISPLAY for one agent: frontmatter baseline ⊕ pinned
52
+ * profile overrides. Uses the registry composer when available, the
53
+ * built-in equivalent otherwise.
54
+ */
55
+ export declare function composeAgentValues(agentName: string, base: AgentRuntimeBase, opts?: {
56
+ startDir?: string;
57
+ home?: string;
58
+ }): AgentRuntimeValues;
59
+ /** Where an /agents model/think edit lands. */
60
+ export type AgentEditTarget = {
61
+ kind: 'profile';
62
+ name: string;
63
+ } | {
64
+ kind: 'frontmatter';
65
+ };
66
+ /**
67
+ * The edit target for model/think edits in this workspace: pinned to an
68
+ * existing profile → that profile's per-agent overrides; no pin (or the
69
+ * pinned profile no longer exists) → the frontmatter baseline.
70
+ */
71
+ export declare function agentEditTarget(opts?: {
72
+ startDir?: string;
73
+ home?: string;
74
+ }): AgentEditTarget;
75
+ /** One agent model/think edit payload (`null` = clear back to inherit). */
76
+ export interface AgentEditPayload {
77
+ model?: string | null;
78
+ thinking?: string | null;
79
+ }
80
+ export interface AgentEditResult {
81
+ /** Where the edit landed (drives the flash message / scope note). */
82
+ target: AgentEditTarget;
83
+ /** Error message when the write failed. */
84
+ error?: string;
85
+ }
86
+ /**
87
+ * Commit one agent model/thinking edit through the workspace-scoped path —
88
+ * the SINGLE write site (decision + write share one doc read, so the target
89
+ * cannot go stale mid-commit): the pinned profile's per-agent override when
90
+ * the workspace is pinned to an existing profile (model-profiles.json via
91
+ * the existing atomic save path, frontmatter untouched), the agent file's
92
+ * frontmatter otherwise.
93
+ */
94
+ export declare function commitAgentModelEdit(agentName: string, agentFile: string, edit: AgentEditPayload, opts?: {
95
+ startDir?: string;
96
+ home?: string;
97
+ }): AgentEditResult;
@@ -0,0 +1,151 @@
1
+ /**
2
+ * Profile-aware agent runtime composition — the single import seam for the
3
+ * dsh-subagent-registry contract (`workspaceProfileName` /
4
+ * `composeAgentRuntime` / `readModelProfilesDoc`, re-exported from the
5
+ * package root).
6
+ *
7
+ * The registry is probed once at module load. A registry build that has not
8
+ * shipped the contract yet (or one that fails to load) degrades to the
9
+ * built-in equivalent computed from this repo's own model-profiles store, so
10
+ * the /agents display and the scoped edit path keep working; once the
11
+ * registry ships the contract the very same call sites use it — no code
12
+ * changes needed.
13
+ *
14
+ * Composition semantics (shared with the registry's composeAgentRuntime,
15
+ * mirrored here so the fallback displays exactly what a spawn resolves):
16
+ * effective = frontmatter baseline ⊕ pinned profile overrides, per field —
17
+ * a recorded NON-EMPTY override wins; an absent/empty recorded value falls
18
+ * back to the baseline (an empty entry is the "recorded as inherit" shape,
19
+ * which in this model means the baseline still applies). `thinking` is
20
+ * whitelisted against the known effort ids, so a hand-edited store can
21
+ * never ship a host-rejected value. No pin, an unknown profile, a missing
22
+ * store or an unlistd agent → the baseline.
23
+ *
24
+ * Edit scoping uses the same store the writes land in: when the workspace is
25
+ * pinned to an existing profile, /agents model/think edits update that
26
+ * profile's per-agent overrides (model-profiles.json, workspace-scoped —
27
+ * the frontmatter baseline is untouched); otherwise they write the agent
28
+ * file's frontmatter, the pre-profile baseline behavior.
29
+ */
30
+ var __rewriteRelativeImportExtension = (this && this.__rewriteRelativeImportExtension) || function (path, preserveJsx) {
31
+ if (typeof path === "string" && /^\.\.?\//.test(path)) {
32
+ return path.replace(/\.(tsx)$|((?:\.d)?)((?:\.[^./]+?)?)\.([cm]?)ts$/i, function (m, tsx, d, ext, cm) {
33
+ return tsx ? preserveJsx ? ".jsx" : ".js" : d && (!ext || !cm) ? m : (d + ext + "." + cm.toLowerCase() + "js");
34
+ });
35
+ }
36
+ return path;
37
+ };
38
+ import { dshHome } from "./append-system.js";
39
+ import { loadModelProfiles, modelProfilesPath, resolvePinnedProfile, saveModelProfiles, } from "./model-profiles.js";
40
+ import { updateAgentFrontmatter } from "./agent-manager.js";
41
+ /** Probe the registry once; the result is cached for the process lifetime.
42
+ * The specifier is passed as a variable so TypeScript keeps the registry's
43
+ * type graph OUT of this project (its peer closures may declare conflicting
44
+ * session-event augmentations) — compatibility is checked structurally at
45
+ * runtime instead. */
46
+ async function probeRegistryRuntime() {
47
+ const specifier = '@aiwayds/dsh-subagent-registry';
48
+ try {
49
+ const mod = (await import(__rewriteRelativeImportExtension(specifier)));
50
+ if (typeof mod['composeAgentRuntime'] !== 'function'
51
+ || typeof mod['workspaceProfileName'] !== 'function'
52
+ || typeof mod['readModelProfilesDoc'] !== 'function')
53
+ return null;
54
+ return mod;
55
+ }
56
+ catch {
57
+ return null;
58
+ }
59
+ }
60
+ const registryRuntime = await probeRegistryRuntime();
61
+ /** Whether the registry shipped the contract (diagnostics / report hook). */
62
+ export function registryContractAvailable() {
63
+ return registryRuntime !== null;
64
+ }
65
+ /** The reasoning-effort ids the host accepts (mirrors the registry's THINKING_LEVELS). */
66
+ const THINKING_LEVELS = ['off', 'low', 'medium', 'high', 'max'];
67
+ /**
68
+ * Pure composition: frontmatter baseline ⊕ pinned profile overrides,
69
+ * resolved against `doc`/`startDir` explicitly — the test surface,
70
+ * semantically identical to the registry composer (per-field override,
71
+ * absent/empty recorded values fall back to the baseline).
72
+ */
73
+ export function composeAgentValuesFromDoc(agentName, base, doc, startDir) {
74
+ const effective = {
75
+ ...(typeof base.model === 'string' && base.model !== '' ? { model: base.model } : {}),
76
+ ...(typeof base.thinking === 'string' && THINKING_LEVELS.includes(base.thinking) ? { thinking: base.thinking } : {}),
77
+ };
78
+ const profile = resolvePinnedProfile(doc, startDir);
79
+ const entry = profile?.agents[agentName];
80
+ if (entry === undefined)
81
+ return effective;
82
+ const model = entry.model;
83
+ if (model !== undefined && model !== '')
84
+ effective.model = model;
85
+ const thinking = entry.thinking;
86
+ if (thinking !== undefined && THINKING_LEVELS.includes(thinking))
87
+ effective.thinking = thinking;
88
+ return effective;
89
+ }
90
+ /**
91
+ * The values to DISPLAY for one agent: frontmatter baseline ⊕ pinned
92
+ * profile overrides. Uses the registry composer when available, the
93
+ * built-in equivalent otherwise.
94
+ */
95
+ export function composeAgentValues(agentName, base, opts = {}) {
96
+ const startDir = opts.startDir ?? process.cwd();
97
+ if (registryRuntime !== null) {
98
+ return registryRuntime.composeAgentRuntime(agentName, base, { startDir });
99
+ }
100
+ const doc = loadModelProfiles(modelProfilesPath(opts.home ?? dshHome()));
101
+ return composeAgentValuesFromDoc(agentName, base, doc, startDir);
102
+ }
103
+ /**
104
+ * The edit target for model/think edits in this workspace: pinned to an
105
+ * existing profile → that profile's per-agent overrides; no pin (or the
106
+ * pinned profile no longer exists) → the frontmatter baseline.
107
+ */
108
+ export function agentEditTarget(opts = {}) {
109
+ const doc = loadModelProfiles(modelProfilesPath(opts.home ?? dshHome()));
110
+ const profile = resolvePinnedProfile(doc, opts.startDir ?? process.cwd());
111
+ return profile === undefined ? { kind: 'frontmatter' } : { kind: 'profile', name: profile.name };
112
+ }
113
+ /**
114
+ * Commit one agent model/thinking edit through the workspace-scoped path —
115
+ * the SINGLE write site (decision + write share one doc read, so the target
116
+ * cannot go stale mid-commit): the pinned profile's per-agent override when
117
+ * the workspace is pinned to an existing profile (model-profiles.json via
118
+ * the existing atomic save path, frontmatter untouched), the agent file's
119
+ * frontmatter otherwise.
120
+ */
121
+ export function commitAgentModelEdit(agentName, agentFile, edit, opts = {}) {
122
+ const path = modelProfilesPath(opts.home ?? dshHome());
123
+ const doc = loadModelProfiles(path);
124
+ const profile = resolvePinnedProfile(doc, opts.startDir ?? process.cwd());
125
+ if (profile !== undefined) {
126
+ // Merge semantics: a thinking-only edit keeps the recorded model (and
127
+ // vice versa); a null value clears that one key back to inherit.
128
+ const entry = { ...(profile.agents[agentName] ?? {}) };
129
+ if (edit.model !== undefined) {
130
+ if (edit.model === null)
131
+ delete entry.model;
132
+ else
133
+ entry.model = edit.model;
134
+ }
135
+ if (edit.thinking !== undefined) {
136
+ if (edit.thinking === null)
137
+ delete entry.thinking;
138
+ else
139
+ entry.thinking = edit.thinking;
140
+ }
141
+ profile.agents[agentName] = entry;
142
+ const error = saveModelProfiles(path, doc);
143
+ return { target: { kind: 'profile', name: profile.name }, ...(error !== undefined ? { error } : {}) };
144
+ }
145
+ const error = updateAgentFrontmatter(agentFile, {
146
+ model: edit.model ?? null,
147
+ thinking: edit.thinking ?? null,
148
+ });
149
+ return { target: { kind: 'frontmatter' }, ...(error !== undefined ? { error } : {}) };
150
+ }
151
+ //# sourceMappingURL=agent-runtime.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agent-runtime.js","sourceRoot":"","sources":["../src/agent-runtime.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;;;;;;;;;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EACL,iBAAiB,EACjB,iBAAiB,EACjB,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,qBAAqB,CAAA;AAC5B,OAAO,EAAE,sBAAsB,EAAE,MAAM,o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,QAAQ,CAAA;QACrC,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,SAAS,CAAC,GAAG,KAAK,CAAA;QACjC,MAAM,KAAK,GAAG,iBAAiB,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;QAC1C,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;IACvG,CAAC;IACD,MAAM,KAAK,GAAG,sBAAsB,CAAC,SAAS,EAAE;QAC9C,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI;QACzB,QAAQ,EAAE,IAAI,CAAC,QAAQ,IAAI,IAAI;KAChC,CAAC,CAAA;IACF,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,GAAG,CAAC,KAAK,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAA;AACvF,CAAC"}
package/lib/agents.d.ts CHANGED
@@ -16,8 +16,14 @@
16
16
  * `dsh-tui` settings namespace. Also the initial view when no agent
17
17
  * files exist yet, so the caps stay configurable before any agent.
18
18
  *
19
- * Edits go straight to the frontmatter of the agent's markdown file and
20
- * take effect the next time the agent is spawned.
19
+ * Edits go through the workspace-scoped path: when this directory tree is
20
+ * pinned to an existing profile, model/think edits land in that profile's
21
+ * per-agent overrides ($DSH_HOME/model-profiles.json) and the frontmatter
22
+ * baseline is untouched; otherwise they write the agent file's frontmatter
23
+ * as before. The table and the fields window always show the COMPOSED
24
+ * values (frontmatter baseline ⊕ pinned-profile overrides — what a spawned
25
+ * agent actually gets), so an edit never looks like a no-op.
26
+ * `deep` stays a frontmatter-only key (profiles have no deep override).
21
27
  */
22
28
  import type { Context } from '@deepseek-ai/cordis';
23
29
  import { type TUI } from '@earendil-works/pi-tui';
package/lib/agents.js CHANGED
@@ -16,11 +16,18 @@
16
16
  * `dsh-tui` settings namespace. Also the initial view when no agent
17
17
  * files exist yet, so the caps stay configurable before any agent.
18
18
  *
19
- * Edits go straight to the frontmatter of the agent's markdown file and
20
- * take effect the next time the agent is spawned.
19
+ * Edits go through the workspace-scoped path: when this directory tree is
20
+ * pinned to an existing profile, model/think edits land in that profile's
21
+ * per-agent overrides ($DSH_HOME/model-profiles.json) and the frontmatter
22
+ * baseline is untouched; otherwise they write the agent file's frontmatter
23
+ * as before. The table and the fields window always show the COMPOSED
24
+ * values (frontmatter baseline ⊕ pinned-profile overrides — what a spawned
25
+ * agent actually gets), so an edit never looks like a no-op.
26
+ * `deep` stays a frontmatter-only key (profiles have no deep override).
21
27
  */
22
28
  import { getKeybindings, } from '@earendil-works/pi-tui';
23
29
  import { agentsDir, listAgentFiles, migrateLegacyAgentsDir, seedFromZcode, updateAgentFrontmatter, zcodeAgentsDir, } from "./agent-manager.js";
30
+ import { agentEditTarget, commitAgentModelEdit, composeAgentValues, } from "./agent-runtime.js";
24
31
  import { EditField } from "./settings.js";
25
32
  import { readSubagentLimits, writeSubagentLimit } from "./theme-settings.js";
26
33
  import { autoColumns, FieldPanel, PanelHost, TablePanel, ViewerPanel, } from "./panels.js";
@@ -77,24 +84,28 @@ function parseLimitInput(text) {
77
84
  return { kind: 'value', value: Number(trimmed) };
78
85
  }
79
86
  /** The four agent-table columns under the auto layout: NAME/MODEL/DEEP fit
80
- * the loaded agents (capped), DESCRIPTION runs to the right edge. */
81
- function agentColumns(agents) {
87
+ * the loaded agents (capped), DESCRIPTION runs to the right edge. The
88
+ * model cell shows the COMPOSED value (frontmatter ⊕ pinned profile). */
89
+ function agentColumns(agents, cell) {
82
90
  return autoColumns([
83
91
  { key: 'name', title: 'name', cap: 16 },
84
92
  { key: 'model', title: 'model', cap: 30 },
85
93
  { key: 'deep', title: 'deep', align: 'right' },
86
94
  { key: 'description', title: 'description' },
87
- ], agents, (agent, key) => agentCell(agent, { key }));
95
+ ], agents, cell);
88
96
  }
89
- /** Cell text for one agent table row. */
90
- function agentCell(agent, column) {
91
- const meta = agent.meta;
92
- switch (column.key) {
93
- case 'name': return meta.displayName ?? meta.name;
94
- case 'model': return meta.model ?? '(inherit)';
95
- case 'deep': return String(meta.deep);
96
- default: return meta.description ?? '';
97
- }
97
+ /** Cell text for one agent table row, model column COMPOSED (baseline ⊕
98
+ * pinned-profile overrides — what a spawned agent actually gets). */
99
+ function agentCellFor(effective) {
100
+ return (agent, column) => {
101
+ const meta = agent.meta;
102
+ switch (column.key) {
103
+ case 'name': return meta.displayName ?? meta.name;
104
+ case 'model': return effective.get(meta.name)?.model ?? '(inherit)';
105
+ case 'deep': return String(meta.deep);
106
+ default: return meta.description ?? '';
107
+ }
108
+ };
98
109
  }
99
110
  /** The colored-dot title line of the fields window. */
100
111
  function agentTitle(theme, meta) {
@@ -192,6 +203,24 @@ export async function openAgentManager(ctx, tui, theme, restoreFocus, preselect)
192
203
  migrateLegacyAgentsDir(dir);
193
204
  const seed = seedFromZcode(dir);
194
205
  const { agents, broken } = listAgentFiles(dir);
206
+ const cwd = process.cwd();
207
+ /** Where model/think edits land in this workspace (decided at open; the
208
+ * commit rechecks against the same store, so the two cannot diverge). */
209
+ const editTarget = agentEditTarget({ startDir: cwd });
210
+ /** Composed runtime value per agent (baseline ⊕ pinned profile), resolved
211
+ * on open and after each edit — never inside a render callback (iron
212
+ * rule 1: no I/O in render). */
213
+ const effective = new Map();
214
+ const refreshEffective = () => {
215
+ effective.clear();
216
+ for (const agent of agents) {
217
+ effective.set(agent.meta.name, composeAgentValues(agent.meta.name, {
218
+ model: agent.meta.model ?? null,
219
+ thinking: agent.meta.thinking ?? null,
220
+ }, { startDir: cwd }));
221
+ }
222
+ };
223
+ refreshEffective();
195
224
  const changed = [];
196
225
  let detailStatus;
197
226
  let limitsStatus;
@@ -213,9 +242,9 @@ export async function openAgentManager(ctx, tui, theme, restoreFocus, preselect)
213
242
  pendingPreselect = undefined;
214
243
  const table = new TablePanel(theme, {
215
244
  title: '● Agents',
216
- columns: agentColumns(agents),
245
+ columns: agentColumns(agents, (agent, key) => agentCellFor(effective)(agent, { key })),
217
246
  rows: agents,
218
- renderCell: agentCell,
247
+ renderCell: agentCellFor(effective),
219
248
  preselect: preselectIndex !== undefined && preselectIndex >= 0 ? preselectIndex : undefined,
220
249
  footer: '↑↓ navigate · Enter open · Esc back · l limits',
221
250
  // Defensive: an empty table (never shown, but guards the round-trip)
@@ -242,10 +271,14 @@ export async function openAgentManager(ctx, tui, theme, restoreFocus, preselect)
242
271
  };
243
272
  const showFields = (agent) => {
244
273
  const meta = agent.meta;
274
+ const eff = effective.get(meta.name);
245
275
  const content = (meta.description ?? '(no description)').split('\n');
276
+ content.push(editTarget.kind === 'profile'
277
+ ? `model/think edits apply to profile "${editTarget.name}" (workspace-scoped — the frontmatter baseline stays untouched)`
278
+ : 'no workspace profile pin — edits write the frontmatter baseline (global)');
246
279
  const fields = [
247
- { key: 'model', value: meta.model ?? '(inherit — default model)', editable: true },
248
- { key: 'thinking', value: meta.thinking ?? '(inherit)', editable: true },
280
+ { key: 'model', value: eff?.model ?? '(inherit — default model)', editable: true },
281
+ { key: 'thinking', value: eff?.thinking ?? '(inherit)', editable: true },
249
282
  { key: 'deep', value: String(meta.deep), editable: true },
250
283
  ];
251
284
  const view = new FieldPanel(theme, {
@@ -272,37 +305,44 @@ export async function openAgentManager(ctx, tui, theme, restoreFocus, preselect)
272
305
  });
273
306
  fieldsHandle = host.open(view);
274
307
  };
275
- /** Commit path shared by model/think edits: write, mutate, flash, re-show. */
276
- const writeAndFlash = (agent, error, message) => {
277
- if (error !== undefined) {
278
- detailStatus = `✘ ${error}`;
279
- }
280
- else {
281
- if (!changed.includes(agent.meta.name))
282
- changed.push(agent.meta.name);
283
- detailStatus = message;
284
- }
285
- showFields(agent);
308
+ /** The agent meta as the user sees it: composed values feed the picker's
309
+ * preselect (a profile override is what the fields window shows). */
310
+ const effectiveMeta = (agent) => {
311
+ const eff = effective.get(agent.meta.name);
312
+ return eff === undefined
313
+ ? agent.meta
314
+ : { ...agent.meta, model: eff.model, thinking: eff.thinking };
286
315
  };
287
316
  const changeModel = async (agent) => {
288
- const picked = await pickAgentModel(ctx, tui, theme, agent.meta, host);
317
+ const picked = await pickAgentModel(ctx, tui, theme, effectiveMeta(agent), host);
289
318
  if (picked === undefined) {
290
319
  showFields(agent);
291
320
  return;
292
321
  }
293
- const error = updateAgentFrontmatter(agent.path, {
322
+ const result = commitAgentModelEdit(agent.meta.name, agent.path, {
294
323
  model: picked.model,
295
324
  thinking: picked.thinking,
296
- });
297
- if (error === undefined) {
325
+ }, { startDir: cwd });
326
+ if (result.error !== undefined) {
327
+ detailStatus = `✘ ${result.error}`;
328
+ showFields(agent);
329
+ return;
330
+ }
331
+ if (result.target.kind === 'frontmatter') {
298
332
  agent.meta.model = picked.model;
299
333
  agent.meta.thinking = picked.thinking ?? undefined;
300
334
  }
335
+ refreshEffective();
336
+ if (!changed.includes(agent.meta.name))
337
+ changed.push(agent.meta.name);
301
338
  const thinkText = picked.thinking !== null ? ` · think ${picked.thinking}` : '';
302
- writeAndFlash(agent, error, `saved ${agent.meta.name} ${picked.model}${thinkText}`);
339
+ const scopeNote = result.target.kind === 'profile' ? ` (profile "${result.target.name}")` : '';
340
+ detailStatus = `saved ${agent.meta.name} → ${picked.model}${thinkText}${scopeNote}`;
341
+ showFields(agent);
303
342
  };
304
343
  const changeThinking = async (agent) => {
305
- if (agent.meta.model === undefined) {
344
+ const model = effective.get(agent.meta.name)?.model;
345
+ if (model === undefined) {
306
346
  detailStatus = '✘ no model set — pick a model first (m)';
307
347
  showFields(agent);
308
348
  return;
@@ -313,35 +353,45 @@ export async function openAgentManager(ctx, tui, theme, restoreFocus, preselect)
313
353
  showFields(agent);
314
354
  return;
315
355
  }
316
- const slash = agent.meta.model.indexOf('/');
356
+ const slash = model.indexOf('/');
317
357
  if (slash <= 0) {
318
- detailStatus = `✘ cannot resolve think levels for ${agent.meta.model}`;
358
+ detailStatus = `✘ cannot resolve think levels for ${model}`;
319
359
  showFields(agent);
320
360
  return;
321
361
  }
322
362
  let efforts;
323
363
  try {
324
- efforts = (await llm.resolveModelInfo(agent.meta.model.slice(0, slash), agent.meta.model.slice(slash + 1))).reasoning?.efforts;
364
+ efforts = (await llm.resolveModelInfo(model.slice(0, slash), model.slice(slash + 1))).reasoning?.efforts;
325
365
  }
326
366
  catch {
327
367
  efforts = undefined;
328
368
  }
329
369
  if (efforts === undefined || efforts.length === 0) {
330
- detailStatus = `✘ ${agent.meta.model} exposes no think levels`;
370
+ detailStatus = `✘ ${model} exposes no think levels`;
331
371
  showFields(agent);
332
372
  return;
333
373
  }
334
- const currentEffort = agent.meta.thinking;
374
+ const currentEffort = effective.get(agent.meta.name)?.thinking;
335
375
  const chosen = await openEffortPicker(tui, theme, efforts, currentEffort, () => { }, () => fieldsHandle?.hide());
336
376
  if (chosen === undefined) {
337
377
  showFields(agent);
338
378
  return;
339
379
  }
340
380
  const thinking = chosen.effort === 'default' ? null : chosen.effort;
341
- const error = updateAgentFrontmatter(agent.path, { thinking });
342
- if (error === undefined)
381
+ const result = commitAgentModelEdit(agent.meta.name, agent.path, { thinking }, { startDir: cwd });
382
+ if (result.error !== undefined) {
383
+ detailStatus = `✘ ${result.error}`;
384
+ showFields(agent);
385
+ return;
386
+ }
387
+ if (result.target.kind === 'frontmatter')
343
388
  agent.meta.thinking = thinking ?? undefined;
344
- writeAndFlash(agent, error, `saved ${agent.meta.name} → think ${thinking ?? 'inherit'}`);
389
+ refreshEffective();
390
+ if (!changed.includes(agent.meta.name))
391
+ changed.push(agent.meta.name);
392
+ const scopeNote = result.target.kind === 'profile' ? ` (profile "${result.target.name}")` : '';
393
+ detailStatus = `saved ${agent.meta.name} → think ${thinking ?? 'inherit'}${scopeNote}`;
394
+ showFields(agent);
345
395
  };
346
396
  const showDeepEditor = (agent) => {
347
397
  let committed = false;