talentos 1.4.22 → 1.5.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/dist/install.js CHANGED
@@ -3,12 +3,13 @@ import { existsSync } from "node:fs";
3
3
  import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
4
4
  import { homedir } from "node:os";
5
5
  import { dirname, join } from "node:path";
6
+ import { mcpUrlFor } from "./config.js";
7
+ import { OAUTH_NEXT, setupEntry, setupSnippet } from "./setup.generated.js";
6
8
  export const AGENT_TARGETS = ["claude", "cursor", "codex"];
7
9
  export const MCP_INSTALL_TARGETS = [...AGENT_TARGETS, "json"];
8
10
  /** Cursor and Codex both auto-load `.agents/skills`; Claude Code reads its own. */
9
11
  const AGENTS_SKILLS_DIR = ".agents/skills";
10
12
  const CLAUDE_SKILLS_DIR = ".claude/skills";
11
- const CODEX_HEADER = "[mcp_servers.talentos]";
12
13
  const TOML_HEADER_START = "[";
13
14
  const TRAILING_NEWLINES = /\n*$/;
14
15
  export const CONFIG_MODE = 0o600;
@@ -21,7 +22,7 @@ const AGENT_SPECS = {
21
22
  label: "Claude Code",
22
23
  hint: "Run this once:",
23
24
  detect: (probe) => probe.which("claude") || probe.exists(join(probe.home, ".claude")),
24
- render: (credentials) => `claude mcp add --scope user --transport http talentos ${mcpUrl(credentials)} --header "Authorization: ${bearer(credentials)}"`,
25
+ render: (credentials, mode) => clientSnippet("claude", credentials, mode),
25
26
  skillDirs: [CLAUDE_SKILLS_DIR],
26
27
  },
27
28
  cursor: {
@@ -30,7 +31,9 @@ const AGENT_SPECS = {
30
31
  detect: (probe) => probe.exists(join(probe.home, ".cursor")) ||
31
32
  probe.exists(join(probe.cwd, ".cursor")),
32
33
  configPath: (home) => join(home, ".cursor", "mcp.json"),
33
- render: (credentials) => JSON.stringify(cursorEntry(credentials), null, 2),
34
+ // Cursor stays on the key in every mode: the server has no OAuth join rule
35
+ // for it yet (#15810).
36
+ render: (credentials) => clientSnippet("cursor", credentials, "key"),
34
37
  merge: (existing, credentials) => mergeCursorConfig(existing, credentials),
35
38
  skillDirs: [AGENTS_SKILLS_DIR],
36
39
  },
@@ -39,15 +42,12 @@ const AGENT_SPECS = {
39
42
  hint: "Add to ~/.codex/config.toml:",
40
43
  detect: (probe) => probe.exists(join(probe.home, ".codex")),
41
44
  configPath: (home) => join(home, ".codex", "config.toml"),
42
- // Codex speaks stdio only, so it launches this CLI as a proxy. The url
43
- // travels with the key: a staging key must not reach production.
44
- render: (credentials) => [
45
- CODEX_HEADER,
46
- 'command = "npx"',
47
- 'args = ["-y", "talentos@1", "mcp"]',
48
- `env = { TALENTOS_API_KEY = "${credentials.apiKey}", TALENTOS_API_URL = "${credentials.apiUrl}" }`,
49
- ].join("\n"),
50
- merge: (existing, credentials) => upsertCodexBlock(existing, credentials),
45
+ // `key`: Codex launches this CLI as a stdio proxy; the url travels with the
46
+ // key, because a staging key must not reach production. `oauth`: Codex
47
+ // speaks to the remote server itself and `codex mcp login talentos` signs
48
+ // the member in.
49
+ render: (credentials, mode) => clientSnippet("codex", credentials, mode),
50
+ merge: (existing, credentials, mode) => upsertCodexBlock(existing, credentials, mode),
51
51
  skillDirs: [AGENTS_SKILLS_DIR],
52
52
  },
53
53
  };
@@ -73,11 +73,20 @@ export function agentTargetsFor(value) {
73
73
  export function installHint(target) {
74
74
  return isAgentTarget(target) ? AGENT_SPECS[target].hint : GENERIC_HINT;
75
75
  }
76
- export function buildInstallSnippet(target, credentials) {
76
+ export function buildInstallSnippet(target, credentials, mode = "key") {
77
77
  return isAgentTarget(target)
78
- ? AGENT_SPECS[target].render(credentials)
78
+ ? AGENT_SPECS[target].render(credentials, mode)
79
79
  : JSON.stringify(cursorEntry(credentials), null, 2);
80
80
  }
81
+ /**
82
+ * The OAuth-first setup is dark: `--oauth` or `HEADLESS_SETUP_V1=true` turns it
83
+ * on. Until the server accepts these clients' loopback sign-in (see the
84
+ * agent-access doc), the default stays the key every client uses today.
85
+ */
86
+ export function setupModeFrom(options, env = process.env) {
87
+ const flag = env.HEADLESS_SETUP_V1?.trim().toLowerCase();
88
+ return options.oauth || flag === "true" || flag === "1" ? "oauth" : "key";
89
+ }
81
90
  /** Where Codex keeps its user-level MCP servers. */
82
91
  export function codexConfigPath(home) {
83
92
  return (AGENT_SPECS.codex.configPath?.(home) ?? join(home, ".codex", "config.toml"));
@@ -120,8 +129,8 @@ export function mergeCursorConfig(existing, credentials) {
120
129
  };
121
130
  return `${JSON.stringify(next, null, 2)}\n`;
122
131
  }
123
- export function upsertCodexBlock(existing, credentials) {
124
- return upsertCodexSection(existing, "talentos", AGENT_SPECS.codex.render(credentials));
132
+ export function upsertCodexBlock(existing, credentials, mode = "key") {
133
+ return upsertCodexSection(existing, "talentos", AGENT_SPECS.codex.render(credentials, mode));
125
134
  }
126
135
  /** Replaces or appends the `[mcp_servers.<server>]` block, leaving the rest. */
127
136
  export function upsertCodexSection(existing, server, block) {
@@ -146,6 +155,14 @@ export function removeCodexSection(existing, server) {
146
155
  const rest = [...lines.slice(0, bounds.start), ...lines.slice(bounds.end)];
147
156
  return `${rest.join("\n").replace(TRAILING_NEWLINES, "")}\n`;
148
157
  }
158
+ /** The lines of the `[mcp_servers.<server>]` block (header excluded), if any. */
159
+ export function readCodexSection(existing, server) {
160
+ const lines = existing.split("\n");
161
+ const bounds = codexSectionBounds(lines, server);
162
+ return bounds === undefined
163
+ ? undefined
164
+ : lines.slice(bounds.start + 1, bounds.end).join("\n");
165
+ }
149
166
  function codexSectionBounds(lines, server) {
150
167
  const header = `[mcp_servers.${server}]`;
151
168
  const start = lines.findIndex((line) => line.trim() === header);
@@ -161,17 +178,17 @@ function codexSectionBounds(lines, server) {
161
178
  * Writes the MCP config for one agent at USER level. Nothing lands inside the
162
179
  * repo: a checked-in config would leak the member's key to the whole team.
163
180
  */
164
- export async function applyInstall(target, credentials, home = defaultProbe().home) {
181
+ export async function applyInstall(target, credentials, home = defaultProbe().home, mode = "key") {
165
182
  const spec = AGENT_SPECS[target];
166
183
  const path = spec.configPath?.(home);
167
184
  if (path === undefined || spec.merge === undefined) {
168
- return applyClaudeInstall(credentials);
185
+ return applyClaudeInstall(credentials, mode);
169
186
  }
170
- const next = spec.merge(await readIfPresent(path), credentials);
187
+ const next = spec.merge(await readIfPresent(path), credentials, mode);
171
188
  await mkdir(dirname(path), { recursive: true, mode: 0o700 });
172
189
  await writeFile(path, next, { mode: CONFIG_MODE });
173
- // writeFile's mode only applies when it creates the file, and this one holds
174
- // the member's API key.
190
+ // writeFile's mode only applies when it creates the file, and in `key` mode
191
+ // this one holds the member's API key.
175
192
  await chmod(path, CONFIG_MODE);
176
193
  return { applied: true, detail: path };
177
194
  }
@@ -182,7 +199,7 @@ export async function applyInstall(target, credentials, home = defaultProbe().ho
182
199
  export function shellArgs(args, platform = process.platform) {
183
200
  return platform === "win32" ? args.map((arg) => `"${arg}"`) : args;
184
201
  }
185
- function applyClaudeInstall(credentials) {
202
+ function applyClaudeInstall(credentials, mode) {
186
203
  if (!onPath("claude")) {
187
204
  return { applied: false, detail: "the `claude` command is not on PATH" };
188
205
  }
@@ -203,8 +220,9 @@ function applyClaudeInstall(credentials) {
203
220
  "http",
204
221
  "talentos",
205
222
  mcpUrl(credentials),
206
- "--header",
207
- `Authorization: ${bearer(credentials)}`,
223
+ ...(mode === "oauth"
224
+ ? []
225
+ : ["--header", `Authorization: Bearer ${credentials.apiKey}`]),
208
226
  ]);
209
227
  if (added.status !== 0) {
210
228
  throw new Error(firstLine(added.stderr) || "`claude mcp add` failed");
@@ -242,14 +260,7 @@ function parseCursorConfig(existing) {
242
260
  }
243
261
  }
244
262
  function cursorEntry(credentials) {
245
- return {
246
- mcpServers: {
247
- talentos: {
248
- url: mcpUrl(credentials),
249
- headers: { Authorization: bearer(credentials) },
250
- },
251
- },
252
- };
263
+ return setupEntry(mcpUrl(credentials), credentials.apiKey);
253
264
  }
254
265
  export async function readIfPresent(path) {
255
266
  try {
@@ -267,12 +278,20 @@ export function onPath(command) {
267
278
  });
268
279
  return probe.error === undefined && probe.status === 0;
269
280
  }
270
- function mcpUrl(credentials) {
271
- return `${credentials.apiUrl}/mcp`;
281
+ /** The MCP address written into client configs for this API url. */
282
+ export function mcpUrl(credentials) {
283
+ return mcpUrlFor(credentials.apiUrl);
272
284
  }
273
- function bearer(credentials) {
274
- return `Bearer ${credentials.apiKey}`;
285
+ function clientSnippet(target, credentials, mode) {
286
+ return setupSnippet(target, mode, {
287
+ apiUrl: credentials.apiUrl,
288
+ key: credentials.apiKey,
289
+ url: mcpUrl(credentials),
290
+ });
275
291
  }
276
292
  function firstLine(text) {
277
293
  return text?.trim().split("\n")[0] ?? "";
278
294
  }
295
+ export function oauthNext(target) {
296
+ return OAUTH_NEXT[target];
297
+ }
@@ -0,0 +1,22 @@
1
+ // Standalone npm package: keep this decoder aligned with the v1 wire spec in
2
+ // docs/features/agent-access/memory-wire-format.md, without Convex imports.
3
+ export function unescapeMemoryText(text) {
4
+ return text.replace(/\\(\\|u[\da-f]{4})/giu, (_, encoded) => encoded === "\\"
5
+ ? "\\"
6
+ : String.fromCharCode(Number.parseInt(encoded.slice(1), 16)));
7
+ }
8
+ export function decodeMemoryRead(text, data) {
9
+ const open = "<teammate_message>\n";
10
+ const close = "\n</teammate_message>";
11
+ if (data.bodyEncoding !== "talentos-memory-v1" ||
12
+ !text.startsWith(open) ||
13
+ !text.endsWith(close) ||
14
+ !Number.isSafeInteger(data.bodyStart) ||
15
+ !Number.isSafeInteger(data.bodyLength) ||
16
+ data.bodyStart < open.length ||
17
+ data.bodyLength < 0 ||
18
+ data.bodyStart + data.bodyLength !== text.length - close.length) {
19
+ throw new Error("Unsupported or incomplete Memory read. Refresh memory_read.");
20
+ }
21
+ return unescapeMemoryText(text.slice(data.bodyStart, data.bodyStart + data.bodyLength));
22
+ }
package/dist/output.js ADDED
@@ -0,0 +1,107 @@
1
+ import { AsyncLocalStorage } from "node:async_hooks";
2
+ import { redactAgentOutput } from "./agent-link.js";
3
+ export class CliError extends Error {
4
+ code;
5
+ next;
6
+ details;
7
+ constructor(code, message, next, details) {
8
+ super(message);
9
+ this.code = code;
10
+ this.next = next;
11
+ this.details = details;
12
+ }
13
+ }
14
+ const output = new AsyncLocalStorage();
15
+ const AUTH_ERROR = /not logged in|key revoked|rejected that key|unauthorized|\b401\b/iu;
16
+ const ARGUMENT_ERROR = /usage:|unknown (command|option)|argument|--help/iu;
17
+ const TALENTOS_COMMAND = /^(?:talentos|npx(?: -y)? talentos(?:@\S+)?)(?:\s|$)/u;
18
+ const NETWORK_ERROR = /cannot reach|fetch failed|ECONNREFUSED|ENOTFOUND/iu;
19
+ export function cliContractEnabled() {
20
+ return process.env.HEADLESS_CLI_V1 === "true";
21
+ }
22
+ export function machineOutput() {
23
+ return output.getStore();
24
+ }
25
+ export function nextActions(next) {
26
+ const current = machineOutput();
27
+ if (current) {
28
+ current.next = next;
29
+ }
30
+ }
31
+ export function withApiUrl(command, apiUrl) {
32
+ if (!(apiUrl && TALENTOS_COMMAND.test(command)) ||
33
+ command.includes(" --api-url ")) {
34
+ return command;
35
+ }
36
+ return `${command} --api-url '${apiUrl.replaceAll("'", "'\\''")}'`;
37
+ }
38
+ function contextualNext(next, apiUrl) {
39
+ return next?.map((action) => ({
40
+ ...action,
41
+ command: withApiUrl(action.command, apiUrl),
42
+ }));
43
+ }
44
+ /** One envelope after the command settles; nested progress goes to stderr. */
45
+ export async function runJsonCommand(run, secrets) {
46
+ const result = {};
47
+ await output.run(result, async () => {
48
+ try {
49
+ await run();
50
+ if (process.exitCode) {
51
+ throw new CliError("COMMAND_FAILED", result.message ?? "The command needs attention.", result.next);
52
+ }
53
+ writeEnvelope({
54
+ ok: true,
55
+ data: result.data ?? (result.message ? { message: result.message } : null),
56
+ ...(result.next?.length
57
+ ? { next: contextualNext(result.next, result.apiUrl) }
58
+ : {}),
59
+ });
60
+ }
61
+ catch (error) {
62
+ const message = redactAgentOutput(error instanceof Error ? error.message : String(error), secrets);
63
+ const failure = error instanceof CliError ? error : classifyError(message);
64
+ writeEnvelope({
65
+ ok: false,
66
+ error: {
67
+ code: failure.code,
68
+ message,
69
+ ...(failure.details === undefined
70
+ ? {}
71
+ : { details: failure.details }),
72
+ },
73
+ ...(failure.next?.length
74
+ ? { next: contextualNext(failure.next, result.apiUrl) }
75
+ : {}),
76
+ });
77
+ process.exitCode ||= 1;
78
+ }
79
+ });
80
+ }
81
+ function classifyError(message) {
82
+ if (AUTH_ERROR.test(message)) {
83
+ return new CliError("UNAUTHENTICATED", message, [
84
+ {
85
+ command: "talentos login",
86
+ why: "Sign in with the member's current key.",
87
+ },
88
+ ]);
89
+ }
90
+ if (ARGUMENT_ERROR.test(message)) {
91
+ return new CliError("INVALID_ARGUMENT", message, [
92
+ { command: "talentos --help", why: "Check the command and its options." },
93
+ ]);
94
+ }
95
+ if (NETWORK_ERROR.test(message)) {
96
+ return new CliError("UNAVAILABLE", message, [
97
+ {
98
+ command: "talentos doctor",
99
+ why: "Check the connection before trying again.",
100
+ },
101
+ ]);
102
+ }
103
+ return new CliError("COMMAND_FAILED", message);
104
+ }
105
+ function writeEnvelope(value) {
106
+ process.stdout.write(`${JSON.stringify(value)}\n`);
107
+ }
@@ -0,0 +1,120 @@
1
+ export const OAUTH_NEXT = {
2
+ claude: "Claude Code: run /mcp, pick talentos, choose Authenticate.",
3
+ codex: "Codex: run `codex mcp login talentos`.",
4
+ };
5
+ export function setupEntry(url, key) {
6
+ return {
7
+ mcpServers: {
8
+ talentos: { url, headers: { Authorization: `Bearer ${key}` } },
9
+ },
10
+ };
11
+ }
12
+ export function setupSnippet(client, mode, connection) {
13
+ const { apiUrl, key, url } = connection;
14
+ switch (client) {
15
+ case "claude":
16
+ return `claude mcp add --scope user --transport http talentos ${url}${mode === "key" ? ` --header "Authorization: Bearer ${key}"` : ""}`;
17
+ case "codex":
18
+ return [
19
+ "[mcp_servers.talentos]",
20
+ ...(mode === "oauth"
21
+ ? [`url = ${JSON.stringify(url)}`]
22
+ : [
23
+ 'command = "npx"',
24
+ 'args = ["-y", "talentos@1", "mcp"]',
25
+ connection.inheritKey
26
+ ? 'env_vars = ["TALENTOS_API_KEY", "TALENTOS_API_URL"]'
27
+ : `env = { TALENTOS_API_KEY = ${JSON.stringify(key)}, TALENTOS_API_URL = ${JSON.stringify(apiUrl)} }`,
28
+ ]),
29
+ ].join("\n");
30
+ case "cursor":
31
+ return JSON.stringify(setupEntry(url, key), null, 2);
32
+ case "gemini":
33
+ return JSON.stringify({
34
+ mcpServers: {
35
+ talentos: {
36
+ httpUrl: url,
37
+ headers: { Authorization: `Bearer ${key}` },
38
+ },
39
+ },
40
+ }, null, 2);
41
+ default:
42
+ throw new Error(`Unknown setup client: ${client}`);
43
+ }
44
+ }
45
+ export function renderStartGuide(origin, apiOrigin = origin) {
46
+ const url = `${origin}/mcp`;
47
+ const connection = {
48
+ apiUrl: apiOrigin,
49
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: the client expands this environment placeholder.
50
+ key: "${TALENTOS_API_KEY}",
51
+ url,
52
+ inheritKey: true,
53
+ };
54
+ const snippet = (client, mode) => setupSnippet(client, mode, connection);
55
+ return `# Connect your agent to TalentOS
56
+
57
+ Act as the member who asked you to connect. Ask them to complete browser sign-in and consent; never approve for them. Use only the tools their connection offers. Work in your own session unless they explicitly ask you to delegate to their Talent (which uses their AI credits).
58
+
59
+ MCP server (Streamable HTTP): ${url}
60
+
61
+ ## 1. Connect once
62
+
63
+ Prefer OAuth below when enabled for this workspace. If sign-in is unavailable, use the key fallback. Node 22.23.4 or newer supported Node 24 is needed for the CLI.
64
+
65
+ **Claude Code** — run:
66
+ \`\`\`sh
67
+ ${snippet("claude", "oauth")}
68
+ \`\`\`
69
+ ${OAUTH_NEXT.claude} Restart the session if needed.
70
+
71
+ **Codex** — add this to ~/.codex/config.toml (keep other servers):
72
+ \`\`\`toml
73
+ ${snippet("codex", "oauth")}
74
+ \`\`\`
75
+ Then run \`codex mcp login talentos\`. In a remote terminal use \`codex mcp login talentos --no-browser\` and follow its browser instructions.
76
+
77
+ **ChatGPT** — in Settings → Apps → Advanced settings enable Developer mode (if your plan/workspace permits it). Create a custom app with MCP server URL \`${url}\` and OAuth, then Connect. Select TalentOS in the chat's tools. If custom apps are unavailable, use a supported terminal client.
78
+
79
+ **Claude.ai** — Settings → Connectors → Add custom connector: name TalentOS, Remote MCP server URL \`${url}\`. Add, then Connect and finish OAuth. Enable the connector in your chat. Your plan or workspace may require an admin to allow custom connectors.
80
+
81
+ **Cursor** — native OAuth is not supported by TalentOS for Cursor yet. Use the key fallback below and merge this into ~/.cursor/mcp.json, replacing the placeholder with the member's key in that private file:
82
+ \`\`\`json
83
+ ${snippet("cursor", "key")}
84
+ \`\`\`
85
+ Reload Cursor and enable talentos in MCP settings.
86
+
87
+ **Gemini CLI** — native OAuth is not supported by TalentOS for Gemini yet. Use the key fallback and merge into ~/.gemini/settings.json:
88
+ \`\`\`json
89
+ ${snippet("gemini", "key")}
90
+ \`\`\`
91
+ Gemini expands the environment variable; restart Gemini with it set and check \`/mcp\`.
92
+
93
+ ### Key fallback: headless / CI
94
+
95
+ The member creates a personal key in TalentOS Settings → Agents → Advanced keys. Supply TALENTOS_API_KEY through your secret manager; never paste it into chat, a repository, or logs. Set the matching endpoint:
96
+ \`\`\`sh
97
+ export TALENTOS_API_URL='${apiOrigin}'
98
+ export MCP_PUBLIC_ORIGIN='${origin}'
99
+ npx -y talentos@1 whoami
100
+ \`\`\`
101
+ For Claude Code, remove an existing OAuth entry first (only if present), then add the key entry with the secret in the environment:
102
+ \`\`\`sh
103
+ claude mcp remove --scope user talentos
104
+ \`\`\`
105
+ \`\`\`sh
106
+ ${snippet("claude", "key")}
107
+ \`\`\`
108
+ For Codex, pass the secret through its environment. Replace the existing [mcp_servers.talentos] section in ~/.codex/config.toml (do not append a duplicate), then restart Codex with the variables above set:
109
+ \`\`\`toml
110
+ ${snippet("codex", "key")}
111
+ \`\`\`
112
+ Other stdio-only clients launch \`npx -y talentos@1 mcp\` with those variables. ChatGPT and Claude.ai use browser OAuth; do not put a key in their chats.
113
+
114
+ The CLI can configure Claude Code, Codex and Cursor together: \`npx -y talentos@1 init --oauth --no-pull --api-url ${apiOrigin}\`. This also asks the member to authorize the CLI; each OAuth client signs in separately. Omit --oauth for key-based setup.
115
+
116
+ ## 2. Verify before working
117
+
118
+ Call the connected server's \`whoami\` tool with \`{}\`. Confirm the returned member and company with the user before any write. CLI fallback: \`npx -y talentos@1 whoami\`. If it fails, run \`npx -y talentos@1 doctor --api-url ${apiOrigin}\` and follow its next step. Reconnect after changing company or revoking a key.
119
+ `;
120
+ }
@@ -46,7 +46,7 @@ export async function writeSkillPackage(dir, slug, files) {
46
46
  * and a Windows drive or UNC path, none of which need a `..` segment to land
47
47
  * outside the folder — while a name like `..notes.md` is perfectly legitimate.
48
48
  */
49
- function escapesRoot(root, path) {
49
+ export function escapesRoot(root, path) {
50
50
  if (isAbsolute(path) || win32.isAbsolute(path)) {
51
51
  return true;
52
52
  }
@@ -0,0 +1,38 @@
1
+ import { createHash } from "node:crypto";
2
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
3
+ import { join } from "node:path";
4
+ /** Lives next to the skill folders it describes; delete it to start over. */
5
+ export const SYNC_MANIFEST = ".talentos-sync.json";
6
+ export function hashFiles(files) {
7
+ return Object.fromEntries(files.map((file) => [file.path, sha(file.text)]));
8
+ }
9
+ export function sha(text) {
10
+ return createHash("sha256").update(text).digest("hex");
11
+ }
12
+ export async function readText(path) {
13
+ try {
14
+ return await readFile(path, "utf8");
15
+ }
16
+ catch {
17
+ return;
18
+ }
19
+ }
20
+ export async function readManifest(dir) {
21
+ const raw = await readText(join(dir, SYNC_MANIFEST));
22
+ if (raw === undefined) {
23
+ return {};
24
+ }
25
+ try {
26
+ const parsed = JSON.parse(raw);
27
+ return parsed && typeof parsed === "object" ? parsed : {};
28
+ }
29
+ catch {
30
+ // An unreadable manifest means nothing is known to be ours: every existing
31
+ // folder is then "differs", never overwritten.
32
+ return {};
33
+ }
34
+ }
35
+ export async function writeManifest(dir, manifest) {
36
+ await mkdir(dir, { recursive: true });
37
+ await writeFile(join(dir, SYNC_MANIFEST), `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
38
+ }
package/dist/watch.js ADDED
@@ -0,0 +1,39 @@
1
+ const DEFAULT_WAIT_SECONDS = 40;
2
+ const DEFAULT_WATCH_MS = 10 * 60_000;
3
+ /** Follows existing work; a server read is never retried or replaced by a write. */
4
+ export async function watch(options) {
5
+ const deadline = options.deadline ?? Date.now() + DEFAULT_WATCH_MS;
6
+ const controller = new AbortController();
7
+ const interrupt = () => controller.abort();
8
+ const timeout = setTimeout(interrupt, Math.max(0, deadline - Date.now()));
9
+ timeout.unref();
10
+ process.once("SIGINT", interrupt);
11
+ try {
12
+ let current = await options.read(undefined, 0, controller.signal);
13
+ options.onChange(current);
14
+ while (options.isRunning(current) &&
15
+ !controller.signal.aborted &&
16
+ Date.now() < deadline) {
17
+ const remainingSeconds = Math.ceil((deadline - Date.now()) / 1000);
18
+ let next;
19
+ try {
20
+ next = await options.read(current, Math.min(options.waitSeconds ?? DEFAULT_WAIT_SECONDS, remainingSeconds), controller.signal);
21
+ }
22
+ catch (error) {
23
+ if (controller.signal.aborted) {
24
+ return current;
25
+ }
26
+ throw error;
27
+ }
28
+ if (options.version(next) !== options.version(current)) {
29
+ options.onChange(next);
30
+ }
31
+ current = next;
32
+ }
33
+ return current;
34
+ }
35
+ finally {
36
+ clearTimeout(timeout);
37
+ process.removeListener("SIGINT", interrupt);
38
+ }
39
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talentos",
3
- "version": "1.4.22",
3
+ "version": "1.5.0",
4
4
  "type": "module",
5
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": {
@@ -12,7 +12,8 @@
12
12
  "talentos": "./dist/index.js"
13
13
  },
14
14
  "files": [
15
- "dist"
15
+ "dist",
16
+ "plugin"
16
17
  ],
17
18
  "engines": {
18
19
  "node": ">=22.23.4 <23 || >=24.22.1 <25"
@@ -0,0 +1,12 @@
1
+ {
2
+ "name": "talentos",
3
+ "owner": { "name": "TalentOS", "url": "https://talentos.so" },
4
+ "description": "TalentOS for Claude Code: your company's memory, Skills and Talent.",
5
+ "plugins": [
6
+ {
7
+ "name": "talentos",
8
+ "source": "./plugins/talentos",
9
+ "description": "Connect Claude Code to your company's TalentOS: sign in once in the browser, then use shared memory, Skills, Routines and your Talent."
10
+ }
11
+ ]
12
+ }
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "talentos",
3
+ "displayName": "TalentOS",
4
+ "version": "0.1.0",
5
+ "description": "Connect Claude Code to your company's TalentOS: sign in once in the browser, then use shared memory, Skills, Routines and your Talent.",
6
+ "author": { "name": "TalentOS", "url": "https://talentos.so" },
7
+ "homepage": "https://talentos.so",
8
+ "keywords": ["talentos", "memory", "skills", "mcp"]
9
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "mcpServers": {
3
+ "talentos": {
4
+ "type": "http",
5
+ "url": "https://woozy-oyster-769.convex.site/mcp"
6
+ }
7
+ }
8
+ }
@@ -0,0 +1,20 @@
1
+ ---
2
+ description: Explicitly hand a task to your TalentOS Talent (you do the rest yourself)
3
+ argument-hint: "<what you want your Talent to do>"
4
+ ---
5
+
6
+ The user asked you to hand this to their TalentOS Talent: $ARGUMENTS
7
+
8
+ This command is for explicit delegation only. For anything the user did not ask
9
+ to hand over, do the work yourself with the tools you have and use TalentOS only
10
+ for company context.
11
+
12
+ - If the `talentos` MCP server offers `start_task`, call it with the request and
13
+ then poll `get_task` until it finishes or needs the user's answer
14
+ (`answer_task`).
15
+ - Otherwise call `ask_talent` with the request, then poll `get_thread` for the
16
+ reply. Stop polling after about two minutes and give the user the thread link:
17
+ the Talent keeps working and delivers the result in TalentOS.
18
+ - Say what you handed over, in one line.
19
+ - If the tool is not available in this connection, say so plainly and suggest
20
+ `npx talentos@1 ask "<message>"`.
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: What changed at your company since you last looked
3
+ argument-hint: "[topic]"
4
+ ---
5
+
6
+ Catch me up on my company using TalentOS for context. $ARGUMENTS
7
+
8
+ 1. If the `talentos` MCP server offers a `catch_up` tool, call it and summarise
9
+ the result in a few short bullets.
10
+ 2. Otherwise call `whoami`, then `list_threads` and `search_memory` (scope
11
+ `all`) for anything recent that matches my topic, and summarise what you find.
12
+ 3. Name what needs a decision from me first. Keep it under ten lines.
13
+
14
+ If the `talentos` server asks you to sign in, tell me to run `/mcp`, pick
15
+ `talentos` and choose Authenticate. Do not guess at company facts: say so when
16
+ TalentOS has nothing on a point.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Save one fact to your Talent's memory (or propose it to the company)
3
+ argument-hint: "<fact> [--company]"
4
+ ---
5
+
6
+ Save this to TalentOS memory: $ARGUMENTS
7
+
8
+ - Call the `remember` tool with one short, declarative sentence as `content`.
9
+ - `scope` is `personal` unless I wrote `--company` or said it is for the whole
10
+ team. Company facts from a member are proposed for review, not saved at once:
11
+ tell me which happened.
12
+ - Never save secrets, passwords or keys. If my text has one, leave it out and
13
+ say so.
14
+ - If `remember` is not available in this connection, say so plainly and suggest
15
+ `npx talentos@1 memory add "<fact>"` instead.
@@ -0,0 +1,17 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|resume|clear|compact",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node",
10
+ "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/session-start.mjs"],
11
+ "timeout": 2
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ }