talentos 1.4.10 → 1.4.12
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 +3 -3
- package/dist/agent/adapters.js +207 -14
- package/dist/agent/codex-policy.js +22 -0
- package/dist/agent/codex-probe.js +114 -30
- package/dist/agent/gemini-login.js +74 -0
- package/dist/agent/gemini-policy.js +91 -0
- package/dist/agent/gemini-probe.js +308 -0
- package/dist/agent/mcp-entry.js +22 -9
- package/dist/agent/native/approvals.js +15 -11
- package/dist/agent/native/codex-launch.js +3 -0
- package/dist/agent/native/config.js +4 -2
- package/dist/agent/native/gate.js +160 -8
- package/dist/agent/native/hook-entry.js +33 -8
- package/dist/agent/native/launch.js +3 -0
- package/dist/agent/native/native-issue.js +3 -3
- package/dist/agent/native/policy.js +62 -14
- package/dist/agent/native/probe.js +13 -1
- package/dist/agent/native/touch.js +33 -1
- package/dist/agent/node-floor.js +140 -0
- package/dist/agent/provider-failure.js +2 -2
- package/dist/agent/provider-login.js +134 -0
- package/dist/agent/room-profile.js +41 -4
- package/dist/agent/serve.js +75 -9
- package/dist/agent-config.js +6 -1
- package/dist/agent-http.js +57 -0
- package/dist/agent-link.js +4 -2
- package/dist/agent-session.js +137 -0
- package/dist/args.js +1 -0
- package/dist/client.js +11 -2
- package/dist/commands/agent-native.js +0 -3
- package/dist/commands/agent-serve.js +7 -2
- package/dist/commands/agent-session.js +160 -0
- package/dist/commands/agent.js +37 -3
- package/dist/commands/init.js +2 -2
- package/dist/commands/login.js +2 -2
- package/dist/gateway-install.js +50 -11
- package/dist/index.js +13 -4
- package/dist/install.js +39 -14
- package/dist/mcp-proxy.js +30 -2
- package/dist/provider-binary.js +12 -2
- package/package.json +2 -2
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
|
-
|
|
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
|
|
127
|
-
if (
|
|
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
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
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
|
|
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
|
|
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
|
|
86
|
+
return await callHeld(client, { name, arguments: args }, shutdownSignal);
|
|
59
87
|
});
|
|
60
88
|
server.onclose = () => stopAllRunCommands();
|
|
61
89
|
await server.connect(new StdioServerTransport());
|
package/dist/provider-binary.js
CHANGED
|
@@ -1,11 +1,21 @@
|
|
|
1
1
|
import { accessSync, constants, statSync } from "node:fs";
|
|
2
2
|
import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
|
|
3
3
|
import { homeDir } from "./install.js";
|
|
4
|
+
const BINARY = {
|
|
5
|
+
claude_code: "claude",
|
|
6
|
+
codex: "codex",
|
|
7
|
+
gemini_cli: "gemini",
|
|
8
|
+
};
|
|
9
|
+
const LABEL = {
|
|
10
|
+
claude_code: "Claude Code",
|
|
11
|
+
codex: "Codex",
|
|
12
|
+
gemini_cli: "Gemini CLI",
|
|
13
|
+
};
|
|
4
14
|
export class ProviderBinaryError extends Error {
|
|
5
15
|
exitCode = 78;
|
|
6
16
|
}
|
|
7
17
|
export function resolveProviderBinary(provider, configured) {
|
|
8
|
-
const binary = provider
|
|
18
|
+
const binary = BINARY[provider];
|
|
9
19
|
const candidates = configured
|
|
10
20
|
? [configured]
|
|
11
21
|
: (process.env.PATH ?? "")
|
|
@@ -28,7 +38,7 @@ export function resolveProviderBinary(provider, configured) {
|
|
|
28
38
|
/* Try the next PATH directory. */
|
|
29
39
|
}
|
|
30
40
|
}
|
|
31
|
-
const label = provider
|
|
41
|
+
const label = LABEL[provider];
|
|
32
42
|
throw new ProviderBinaryError(`${label} not found at ${configured ?? join(homeDir(), ".local/bin", binary)}; run talentos agent repair`);
|
|
33
43
|
}
|
|
34
44
|
export function providerPathEnv(binary, home = homeDir(), includeRuntimeNode = true) {
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "talentos",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.12",
|
|
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
|
|
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",
|