talentos 1.4.9 → 1.4.11

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/install.js CHANGED
@@ -9,10 +9,9 @@ export const MCP_INSTALL_TARGETS = [...AGENT_TARGETS, "json"];
9
9
  const AGENTS_SKILLS_DIR = ".agents/skills";
10
10
  const CLAUDE_SKILLS_DIR = ".claude/skills";
11
11
  const CODEX_HEADER = "[mcp_servers.talentos]";
12
- const CODEX_SUBTABLE = "[mcp_servers.talentos.";
13
12
  const TOML_HEADER_START = "[";
14
13
  const TRAILING_NEWLINES = /\n*$/;
15
- const CONFIG_MODE = 0o600;
14
+ export const CONFIG_MODE = 0o600;
16
15
  const GENERIC_HINT = "Add to your client's MCP config:";
17
16
  /** A dead MCP server makes `claude mcp list` hang; `init` must not hang with it. */
18
17
  const CLAUDE_LIST_TIMEOUT_MS = 10_000;
@@ -79,6 +78,10 @@ export function buildInstallSnippet(target, credentials) {
79
78
  ? AGENT_SPECS[target].render(credentials)
80
79
  : JSON.stringify(cursorEntry(credentials), null, 2);
81
80
  }
81
+ /** Where Codex keeps its user-level MCP servers. */
82
+ export function codexConfigPath(home) {
83
+ return (AGENT_SPECS.codex.configPath?.(home) ?? join(home, ".codex", "config.toml"));
84
+ }
82
85
  export function homeDir(env = process.env) {
83
86
  // An empty HOME is unset; taking it literally would write the key into
84
87
  // whatever directory the CLI was started from.
@@ -118,19 +121,41 @@ export function mergeCursorConfig(existing, credentials) {
118
121
  return `${JSON.stringify(next, null, 2)}\n`;
119
122
  }
120
123
  export function upsertCodexBlock(existing, credentials) {
121
- const block = AGENT_SPECS.codex.render(credentials);
124
+ return upsertCodexSection(existing, "talentos", AGENT_SPECS.codex.render(credentials));
125
+ }
126
+ /** Replaces or appends the `[mcp_servers.<server>]` block, leaving the rest. */
127
+ export function upsertCodexSection(existing, server, block) {
122
128
  if (existing === undefined || existing.trim() === "") {
123
129
  return `${block}\n`;
124
130
  }
125
131
  const lines = existing.split("\n");
126
- const start = lines.findIndex((line) => line.trim() === CODEX_HEADER);
127
- if (start === -1) {
132
+ const bounds = codexSectionBounds(lines, server);
133
+ if (bounds === undefined) {
128
134
  return `${existing.replace(TRAILING_NEWLINES, "")}\n\n${block}\n`;
129
135
  }
130
- const rest = lines.slice(start + 1).findIndex(isForeignHeader);
131
- const end = rest === -1 ? lines.length : start + 1 + rest;
132
- const replacement = end === lines.length ? [block] : [block, ""];
133
- return `${[...lines.slice(0, start), ...replacement, ...lines.slice(end)].join("\n").replace(TRAILING_NEWLINES, "")}\n`;
136
+ const replacement = bounds.end === lines.length ? [block] : [block, ""];
137
+ return `${[...lines.slice(0, bounds.start), ...replacement, ...lines.slice(bounds.end)].join("\n").replace(TRAILING_NEWLINES, "")}\n`;
138
+ }
139
+ /** Drops the `[mcp_servers.<server>]` block; unchanged when there is none. */
140
+ export function removeCodexSection(existing, server) {
141
+ const lines = existing.split("\n");
142
+ const bounds = codexSectionBounds(lines, server);
143
+ if (bounds === undefined) {
144
+ return existing;
145
+ }
146
+ const rest = [...lines.slice(0, bounds.start), ...lines.slice(bounds.end)];
147
+ return `${rest.join("\n").replace(TRAILING_NEWLINES, "")}\n`;
148
+ }
149
+ function codexSectionBounds(lines, server) {
150
+ const header = `[mcp_servers.${server}]`;
151
+ const start = lines.findIndex((line) => line.trim() === header);
152
+ if (start === -1) {
153
+ return;
154
+ }
155
+ const rest = lines
156
+ .slice(start + 1)
157
+ .findIndex((line) => isForeignHeader(line, `[mcp_servers.${server}.`));
158
+ return { end: rest === -1 ? lines.length : start + 1 + rest, start };
134
159
  }
135
160
  /**
136
161
  * Writes the MCP config for one agent at USER level. Nothing lands inside the
@@ -186,7 +211,7 @@ function applyClaudeInstall(credentials) {
186
211
  }
187
212
  return { applied: true, detail: "claude mcp add --scope user" };
188
213
  }
189
- function claudeRun(args, options = {}) {
214
+ export function claudeRun(args, options = {}) {
190
215
  return spawnSync("claude", shellArgs(args), {
191
216
  encoding: "utf8",
192
217
  shell: process.platform === "win32",
@@ -194,9 +219,9 @@ function claudeRun(args, options = {}) {
194
219
  ...options,
195
220
  });
196
221
  }
197
- function isForeignHeader(line) {
222
+ function isForeignHeader(line, subtable) {
198
223
  const trimmed = line.trimStart();
199
- return (trimmed.startsWith(TOML_HEADER_START) && !trimmed.startsWith(CODEX_SUBTABLE));
224
+ return trimmed.startsWith(TOML_HEADER_START) && !trimmed.startsWith(subtable);
200
225
  }
201
226
  function skillDirNames(target) {
202
227
  if (target === undefined) {
@@ -226,7 +251,7 @@ function cursorEntry(credentials) {
226
251
  },
227
252
  };
228
253
  }
229
- async function readIfPresent(path) {
254
+ export async function readIfPresent(path) {
230
255
  try {
231
256
  return await readFile(path, "utf8");
232
257
  }
@@ -234,7 +259,7 @@ async function readIfPresent(path) {
234
259
  return;
235
260
  }
236
261
  }
237
- function onPath(command) {
262
+ export function onPath(command) {
238
263
  const probe = spawnSync(command, shellArgs(["--version"]), {
239
264
  stdio: "ignore",
240
265
  shell: process.platform === "win32",
package/dist/mcp-proxy.js CHANGED
@@ -5,6 +5,23 @@ import { handleRunCommand, RUN_COMMAND_TOOL, stopAllRunCommands, wireShutdown, }
5
5
  import { UploadRefusal, uploadFile } from "./upload-file.js";
6
6
  // The two server steps behind upload_file. The model sees only upload_file.
7
7
  const UPLOAD_STEP_TOOLS = new Set(["prepare_upload", "commit_upload"]);
8
+ // A write held for its owner's OK (#13163): the server answers "still waiting"
9
+ // every ~50 s (a request longer than 60 s is cut by the MCP client, 300 s by
10
+ // fetch) while the card stays open for 5 minutes. Ask again, the same call, so
11
+ // the model sees one long call; the 8th answer is the server's final word.
12
+ const STILL_WAITING = "Still waiting for the owner to approve this change";
13
+ const HELD_ASKS_MAX = 8;
14
+ async function callHeld(client, params, signal) {
15
+ let result = await client.callTool(params);
16
+ for (let asks = 1; asks < HELD_ASKS_MAX && !signal.aborted; asks++) {
17
+ const first = result.isError ? result.content?.[0] : undefined;
18
+ if (!(first?.type === "text" && first.text.startsWith(STILL_WAITING))) {
19
+ break;
20
+ }
21
+ result = await client.callTool(params);
22
+ }
23
+ return result;
24
+ }
8
25
  /**
9
26
  * stdio front end for clients that cannot speak streamable HTTP (Codex, older
10
27
  * desktop builds). It forwards tool listing and calls verbatim so the tool set
@@ -29,8 +46,19 @@ ownerJobDir) {
29
46
  stdin: process.stdin,
30
47
  });
31
48
  process.once("exit", () => stopAllRunCommands());
49
+ // Codex lists once, as its turn starts. Connecting and listing now means the
50
+ // answer is usually ready by the time it asks, instead of paying the
51
+ // connection and the round trip then. Only that first request takes it, its
52
+ // failure included (the client already waited out a server that is away, so a
53
+ // second round of waiting would pass Codex's own startup timeout); a later
54
+ // listing asks the server again.
55
+ let headStart = client.listTools();
56
+ // The failure is the first request's to report, not an unhandled rejection.
57
+ headStart.catch(() => undefined);
32
58
  server.setRequestHandler(ListToolsRequestSchema, async () => {
33
- const listed = await client.listTools();
59
+ const pending = headStart ?? client.listTools();
60
+ headStart = undefined;
61
+ const listed = await pending;
34
62
  const tools = listed.tools.filter((tool) => !UPLOAD_STEP_TOOLS.has(tool.name));
35
63
  return {
36
64
  ...listed,
@@ -55,7 +83,7 @@ ownerJobDir) {
55
83
  isError: true,
56
84
  };
57
85
  }
58
- return await client.callTool({ name, arguments: args });
86
+ return await callHeld(client, { name, arguments: args }, shutdownSignal);
59
87
  });
60
88
  server.onclose = () => stopAllRunCommands();
61
89
  await server.connect(new StdioServerTransport());
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "talentos",
3
- "version": "1.4.9",
3
+ "version": "1.4.11",
4
4
  "type": "module",
5
- "description": "TalentOS CLI: push and pull skills, read and write team memory, and delegate work to your Talent from any coding agent.",
5
+ "description": "TalentOS CLI: push and pull skills, read and write team memory, and delegate work to your Talent from any agent.",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/TalentOSOfficial/talentos-team.git",