talentos 1.5.0 → 1.6.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.
@@ -0,0 +1,291 @@
1
+ import { readFile, realpath, stat } from "node:fs/promises";
2
+ import { basename, dirname, extname, isAbsolute, relative, resolve, sep, } from "node:path";
3
+ import { deniedSegment } from "./upload-file.js";
4
+ // `talentos publish` (W87): a TalentOS web app is one self-contained page, so
5
+ // the page's own files (styles, scripts, images, fonts) go inside it, as
6
+ // inline <style> and <script> and as data: URIs. The server owns every rule
7
+ // (size, sandbox, credentials) and re-checks the result; this file refuses
8
+ // only what it can say more plainly than the server: a missing file, a file
9
+ // outside the folder, or a second page.
10
+ export class PublishRefusal extends Error {
11
+ }
12
+ function refuse(message) {
13
+ throw new PublishRefusal(message);
14
+ }
15
+ const MIME_TYPES = {
16
+ ".avif": "image/avif",
17
+ ".css": "text/css",
18
+ ".gif": "image/gif",
19
+ ".ico": "image/x-icon",
20
+ ".jpeg": "image/jpeg",
21
+ ".jpg": "image/jpeg",
22
+ ".js": "text/javascript",
23
+ ".json": "application/json",
24
+ ".m4a": "audio/mp4",
25
+ ".mjs": "text/javascript",
26
+ ".mp3": "audio/mpeg",
27
+ ".mp4": "video/mp4",
28
+ ".otf": "font/otf",
29
+ ".png": "image/png",
30
+ ".svg": "image/svg+xml",
31
+ ".ttf": "font/ttf",
32
+ ".wav": "audio/wav",
33
+ ".webm": "video/webm",
34
+ ".webp": "image/webp",
35
+ ".woff": "font/woff",
36
+ ".woff2": "font/woff2",
37
+ };
38
+ const PAGE_EXTENSIONS = new Set([".htm", ".html"]);
39
+ // Raw-text elements first, so a tag spelled inside a script or style is never
40
+ // read as markup; then comments; then any other start tag.
41
+ const MARKUP = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>|<style\b([^>]*)>([\s\S]*?)<\/style\s*>|<!--[\s\S]*?-->|<([a-zA-Z][\w-]*)(\s[^>]*)?>/gu;
42
+ const ATTRIBUTE = /([^\s"'<>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gu;
43
+ const CSS_URL = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)\s]*))\s*\)/giu;
44
+ const SCHEME = /^[a-z][a-z\d+.-]*:/iu;
45
+ const TITLE = /<title\b[^>]*>([\s\S]*?)<\/title\s*>/iu;
46
+ const WHITESPACE = /\s+/u;
47
+ const SELF_CLOSING = /\/\s*$/u;
48
+ const QUERY_OR_HASH = /[?#].*$/u;
49
+ /** Puts the page at `target` (a folder's index.html, or one .html file) and its local files into one page. */
50
+ export async function bundleSite(target) {
51
+ const { entry, root } = await locateEntry(target);
52
+ const site = new Site(root, entry);
53
+ const source = await readFile(entry, "utf8");
54
+ const html = await site.inlinePage(source, dirname(entry));
55
+ const title = decodeText(TITLE.exec(source)?.[1] ?? "").trim() ||
56
+ basename(root) ||
57
+ "Untitled page";
58
+ return { entry, html, title };
59
+ }
60
+ async function locateEntry(target) {
61
+ let found;
62
+ try {
63
+ found = await stat(target);
64
+ }
65
+ catch {
66
+ return refuse(`There is nothing at ${target}.`);
67
+ }
68
+ if (found.isDirectory()) {
69
+ const root = await realpath(target);
70
+ const entry = resolve(root, "index.html");
71
+ if (!(await isFile(entry))) {
72
+ refuse(`There is no index.html in ${target}. Point at the page to publish, or the folder that holds it.`);
73
+ }
74
+ return { entry, root };
75
+ }
76
+ if (!PAGE_EXTENSIONS.has(extname(target).toLowerCase())) {
77
+ refuse(`${target} is not a web page. Point at an .html file or a folder.`);
78
+ }
79
+ const entry = await realpath(target);
80
+ return { entry, root: dirname(entry) };
81
+ }
82
+ async function isFile(path) {
83
+ try {
84
+ return (await stat(path)).isFile();
85
+ }
86
+ catch {
87
+ return false;
88
+ }
89
+ }
90
+ class Site {
91
+ entry;
92
+ root;
93
+ constructor(root, entry) {
94
+ this.entry = entry;
95
+ this.root = root;
96
+ }
97
+ async inlinePage(source, base) {
98
+ return await replaceAsync(source, MARKUP, async (match, groups) => {
99
+ const [scriptAttrs, scriptBody, styleAttrs, styleBody, tag, tagAttrs] = groups;
100
+ if (scriptAttrs !== undefined) {
101
+ return await this.inlineScript(match, scriptAttrs, scriptBody ?? "", base);
102
+ }
103
+ if (styleAttrs !== undefined) {
104
+ return `<style${styleAttrs}>${await this.inlineCss(styleBody ?? "", base)}</style>`;
105
+ }
106
+ if (tag === undefined) {
107
+ return match;
108
+ }
109
+ return await this.inlineTag(match, tag.toLowerCase(), tagAttrs ?? "", base);
110
+ });
111
+ }
112
+ async inlineScript(match, rawAttrs, body, base) {
113
+ const attrs = parseAttributes(rawAttrs);
114
+ const src = attrs.find((attr) => attr.name === "src")?.value;
115
+ if (src === undefined || !isLocal(src) || body.trim() !== "") {
116
+ return match;
117
+ }
118
+ const code = (await this.read(src, base)).toString("utf8");
119
+ const kept = attrs.filter((attr) => !["async", "defer", "integrity", "src"].includes(attr.name));
120
+ // A literal </script inside the code would end the element early.
121
+ return `<script${renderAttributes(kept)}>${code.replace(/<\/(script)/giu, "<\\/$1")}</script>`;
122
+ }
123
+ async inlineTag(match, tag, rawAttrs, base) {
124
+ const attrs = parseAttributes(rawAttrs);
125
+ const value = (name) => attrs.find((attr) => attr.name === name)?.value;
126
+ if (tag === "link") {
127
+ const href = value("href");
128
+ const rel = (value("rel") ?? "").toLowerCase().split(WHITESPACE);
129
+ if (href === undefined || !isLocal(href)) {
130
+ // An icon, preload or font from another site: TalentOS pages load
131
+ // nothing from the network, and the server says so for a stylesheet.
132
+ return rel.includes("stylesheet") ? match : "";
133
+ }
134
+ if (!rel.includes("stylesheet")) {
135
+ // The sandbox refuses every <link>; an icon or preload is decoration.
136
+ return "";
137
+ }
138
+ const css = (await this.read(href, base)).toString("utf8");
139
+ const cssBase = dirname(this.resolveInside(href, base));
140
+ const media = value("media");
141
+ const mediaAttr = media ? ` media="${escapeAttribute(media)}"` : "";
142
+ return `<style${mediaAttr}>${await this.inlineCss(css, cssBase)}</style>`;
143
+ }
144
+ if (tag === "a" || tag === "area") {
145
+ const href = value("href");
146
+ if (href === undefined || !isLocal(href)) {
147
+ return match;
148
+ }
149
+ const linked = this.resolveInside(href, base);
150
+ if (linked === this.entry || linked === this.root) {
151
+ // A link home from the one page: the page is already open.
152
+ return `<${tag}${renderAttributes(attrs.map((attr) => attr.name === "href" ? { name: "href", value: "#" } : attr))}>`;
153
+ }
154
+ const page = stripQuery(href);
155
+ if (PAGE_EXTENSIONS.has(extname(page).toLowerCase()) ||
156
+ page.endsWith("/")) {
157
+ refuse(`This site has more than one page (it links to ${page}). TalentOS hosts one page for now: put everything on index.html, or publish each page on its own.`);
158
+ }
159
+ refuse(`The page links to ${page} to open or download it. A TalentOS page can't open other files: remove the link or show the content on the page.`);
160
+ }
161
+ let changed = false;
162
+ const next = [];
163
+ for (const attr of attrs) {
164
+ const inlined = await this.inlineAttribute(attr, base);
165
+ changed = changed || inlined !== attr.value;
166
+ next.push({ name: attr.name, value: inlined });
167
+ }
168
+ if (!changed) {
169
+ return match;
170
+ }
171
+ const selfClosing = SELF_CLOSING.test(rawAttrs) ? " /" : "";
172
+ return `<${tag}${renderAttributes(next)}${selfClosing}>`;
173
+ }
174
+ async inlineAttribute(attr, base) {
175
+ const { name, value } = attr;
176
+ if (value === undefined) {
177
+ return value;
178
+ }
179
+ if (name === "src" || name === "poster") {
180
+ return isLocal(value) ? await this.dataUri(value, base) : value;
181
+ }
182
+ if (name === "srcset") {
183
+ const candidates = await Promise.all(value.split(",").map(async (candidate) => {
184
+ const [url = "", ...descriptor] = candidate.trim().split(WHITESPACE);
185
+ const inlined = isLocal(url) ? await this.dataUri(url, base) : url;
186
+ return [inlined, ...descriptor].join(" ");
187
+ }));
188
+ return candidates.join(", ");
189
+ }
190
+ if (name === "style") {
191
+ return await this.inlineCss(value, base);
192
+ }
193
+ return value;
194
+ }
195
+ async inlineCss(css, base) {
196
+ return await replaceAsync(css, CSS_URL, async (match, groups) => {
197
+ const url = (groups[0] ?? groups[1] ?? groups[2] ?? "").trim();
198
+ return isLocal(url) ? `url("${await this.dataUri(url, base)}")` : match;
199
+ });
200
+ }
201
+ async dataUri(url, base) {
202
+ const bytes = await this.read(url, base);
203
+ const type = MIME_TYPES[extname(stripQuery(url)).toLowerCase()] ??
204
+ "application/octet-stream";
205
+ return `data:${type};base64,${bytes.toString("base64")}`;
206
+ }
207
+ resolveInside(url, base) {
208
+ let path = stripQuery(url);
209
+ try {
210
+ path = decodeURIComponent(path);
211
+ }
212
+ catch {
213
+ // Not percent-encoded after all: use it as written.
214
+ }
215
+ return path.startsWith("/")
216
+ ? resolve(this.root, `.${path}`)
217
+ : resolve(base, path);
218
+ }
219
+ // Only a regular file inside the published folder, never a credential file,
220
+ // whatever the page names: the page is the agent's to write.
221
+ async read(url, base) {
222
+ const wanted = this.resolveInside(url, base);
223
+ const shown = relative(this.root, wanted) || url;
224
+ let real;
225
+ try {
226
+ real = await realpath(wanted);
227
+ }
228
+ catch {
229
+ return refuse(`The page uses ${shown}, which is not in the folder. Add the file or remove it from the page.`);
230
+ }
231
+ const inside = relative(this.root, real);
232
+ if (inside.startsWith("..") || isAbsolute(inside)) {
233
+ refuse(`The page uses ${url}, which is outside the folder being published. Copy it into the folder.`);
234
+ }
235
+ if (deniedSegment(inside.split(sep))) {
236
+ refuse(`The page uses ${inside}, which looks like a credential or settings file, so nothing was published.`);
237
+ }
238
+ if (!(await isFile(real))) {
239
+ refuse(`The page uses ${shown}, which is not a file.`);
240
+ }
241
+ return await readFile(real);
242
+ }
243
+ }
244
+ function isLocal(url) {
245
+ const trimmed = url.trim();
246
+ return (trimmed !== "" &&
247
+ !trimmed.startsWith("#") &&
248
+ !trimmed.startsWith("//") &&
249
+ !SCHEME.test(trimmed));
250
+ }
251
+ function stripQuery(url) {
252
+ return url.trim().replace(QUERY_OR_HASH, "");
253
+ }
254
+ function parseAttributes(raw) {
255
+ return [...raw.matchAll(ATTRIBUTE)].map((match) => ({
256
+ name: (match[1] ?? "").toLowerCase(),
257
+ value: match[2] ?? match[3] ?? match[4],
258
+ }));
259
+ }
260
+ function renderAttributes(attrs) {
261
+ return attrs
262
+ .map((attr) => attr.value === undefined
263
+ ? ` ${attr.name}`
264
+ : ` ${attr.name}="${escapeAttribute(attr.value)}"`)
265
+ .join("");
266
+ }
267
+ // Values are kept as written (entities and all); only the quote we wrap them
268
+ // in needs escaping.
269
+ function escapeAttribute(value) {
270
+ return value.replace(/"/gu, "&quot;");
271
+ }
272
+ function decodeText(value) {
273
+ return value
274
+ .replace(/&lt;/gu, "<")
275
+ .replace(/&gt;/gu, ">")
276
+ .replace(/&quot;/gu, '"')
277
+ .replace(/&#39;/gu, "'")
278
+ .replace(/&amp;/gu, "&");
279
+ }
280
+ async function replaceAsync(text, pattern, replace) {
281
+ const parts = [];
282
+ let last = 0;
283
+ for (const match of text.matchAll(pattern)) {
284
+ const index = match.index ?? 0;
285
+ parts.push(Promise.resolve(text.slice(last, index)));
286
+ parts.push(replace(match[0], match.slice(1)));
287
+ last = index + match[0].length;
288
+ }
289
+ parts.push(Promise.resolve(text.slice(last)));
290
+ return (await Promise.all(parts)).join("");
291
+ }
@@ -0,0 +1,30 @@
1
+ import { mkdir, readFile, writeFile } from "node:fs/promises";
2
+ import { dirname, join } from "node:path";
3
+ import { configDir } from "./config.js";
4
+ export function publishedPagesPath(env = process.env) {
5
+ return join(configDir(env), "published.json");
6
+ }
7
+ async function readAll(path) {
8
+ try {
9
+ const parsed = JSON.parse(await readFile(path, "utf8"));
10
+ return parsed && typeof parsed === "object"
11
+ ? parsed
12
+ : {};
13
+ }
14
+ catch {
15
+ return {};
16
+ }
17
+ }
18
+ /** The app this page went to on this deployment, if any. */
19
+ export async function publishedPage(entry, apiUrl, path = publishedPagesPath()) {
20
+ const page = (await readAll(path))[entry];
21
+ return page?.apiUrl === apiUrl ? page : undefined;
22
+ }
23
+ export async function rememberPublishedPage(entry, page, path = publishedPagesPath()) {
24
+ const pages = await readAll(path);
25
+ pages[entry] = page;
26
+ await mkdir(dirname(path), { mode: 0o700, recursive: true });
27
+ await writeFile(path, `${JSON.stringify(pages, null, 2)}\n`, {
28
+ mode: 0o600,
29
+ });
30
+ }
@@ -1,6 +1,8 @@
1
1
  export const OAUTH_NEXT = {
2
+ antigravity: "Antigravity CLI: open /mcp and authenticate talentos.",
2
3
  claude: "Claude Code: run /mcp, pick talentos, choose Authenticate.",
3
4
  codex: "Codex: run `codex mcp login talentos`.",
5
+ gemini: "Gemini CLI: run /mcp auth talentos.",
4
6
  };
5
7
  export function setupEntry(url, key) {
6
8
  return {
@@ -12,8 +14,20 @@ export function setupEntry(url, key) {
12
14
  export function setupSnippet(client, mode, connection) {
13
15
  const { apiUrl, key, url } = connection;
14
16
  switch (client) {
17
+ // Antigravity CLI: remote servers take `serverUrl` (antigravity.google/docs/mcp).
18
+ case "antigravity":
19
+ return JSON.stringify({
20
+ mcpServers: {
21
+ talentos: mode === "oauth"
22
+ ? { serverUrl: url }
23
+ : {
24
+ serverUrl: url,
25
+ headers: { Authorization: `Bearer ${key}` },
26
+ },
27
+ },
28
+ }, null, 2);
15
29
  case "claude":
16
- return `claude mcp add --scope user --transport http talentos ${url}${mode === "key" ? ` --header "Authorization: Bearer ${key}"` : ""}`;
30
+ return `claude mcp add --scope user --transport http talentos ${url}${mode === "key" ? ` --header 'Authorization: Bearer ${key}'` : ""}`;
17
31
  case "codex":
18
32
  return [
19
33
  "[mcp_servers.talentos]",
@@ -28,20 +42,29 @@ export function setupSnippet(client, mode, connection) {
28
42
  ]),
29
43
  ].join("\n");
30
44
  case "cursor":
31
- return JSON.stringify(setupEntry(url, key), null, 2);
45
+ return JSON.stringify(setupEntry(url,
46
+ // biome-ignore lint/suspicious/noTemplateCurlyInString: Cursor's native environment interpolation.
47
+ connection.inheritKey ? "${env:TALENTOS_API_KEY}" : key), null, 2);
32
48
  case "gemini":
33
49
  return JSON.stringify({
34
50
  mcpServers: {
35
- talentos: {
36
- httpUrl: url,
37
- headers: { Authorization: `Bearer ${key}` },
38
- },
51
+ talentos: mode === "oauth"
52
+ ? { httpUrl: url }
53
+ : { httpUrl: url, headers: { Authorization: `Bearer ${key}` } },
39
54
  },
40
55
  }, null, 2);
41
56
  default:
42
57
  throw new Error(`Unknown setup client: ${client}`);
43
58
  }
44
59
  }
60
+ /**
61
+ * The one message a member pastes into any agent. It carries its own fallback
62
+ * for an agent that cannot open links or change its own settings (a chat
63
+ * app), so even then the agent tells the person the one next step.
64
+ */
65
+ export function startMessage(origin) {
66
+ return `Set up TalentOS for me. The guide is at ${origin}/start. If you can't open links or change your own settings, tell me to add this custom connector: ${origin}/mcp`;
67
+ }
45
68
  export function renderStartGuide(origin, apiOrigin = origin) {
46
69
  const url = `${origin}/mcp`;
47
70
  const connection = {
@@ -54,13 +77,30 @@ export function renderStartGuide(origin, apiOrigin = origin) {
54
77
  const snippet = (client, mode) => setupSnippet(client, mode, connection);
55
78
  return `# Connect your agent to TalentOS
56
79
 
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).
80
+ Paste this into your agent:
81
+ \`\`\`text
82
+ ${startMessage(origin)}
83
+ \`\`\`
84
+
85
+ Act as the member who asked you to connect. The person signs in and consents; never approve for them. Work in your own session; delegate to their Talent only when explicitly asked (it uses their AI credits).
58
86
 
59
87
  MCP server (Streamable HTTP): ${url}
60
88
 
61
- ## 1. Connect once
89
+ ## 1. Agent: set up and verify
90
+
91
+ Identify the client you are running in. With terminal and filesystem access:
62
92
 
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.
93
+ 1. Set umask 077, then back up its config to a new private mode-600 copy outside repositories. Never print or paste the config or backup's contents, including tool output.
94
+ 2. Merge only TalentOS with a JSON/TOML-aware edit run locally; preserve other servers and settings, without duplicates. Validate the JSON or TOML before saving; check the client's MCP server list.
95
+ 3. Have the member sign in. Registration, sign-in and loading tools are separate steps; reload the client/session if needed.
96
+
97
+ If you cannot change your own settings (ChatGPT, Claude, Grok, Gemini and other chat apps), give the person only your own app's step from the list below, and wait. Coding sessions without config/terminal access also hand the exact command to the user.
98
+
99
+ After either path, call this client's \`whoami\` with \`{}\`. Do not claim success until \`whoami\` succeeds. Confirm the member and company with the user before any write. On failure, run \`npx -y talentos@1 doctor --api-url ${apiOrigin}\` and follow its next step. Reconnect after changing company or revoking a key.
100
+
101
+ ## 2. Connect once
102
+
103
+ Any client: add the server URL with no header and let it sign in (OAuth): the member clicks Allow on the TalentOS page. Use a key only when the client has no OAuth for remote servers, or for headless/CI. If sign-in is refused because the workspace has not turned it on, a client with a key mode uses the key fallback below (Antigravity CLI: \`init --for antigravity\`, which stores the key privately). CLI: Node 22.23.4–22.x or 24.22.1–24.x.
64
104
 
65
105
  **Claude Code** — run:
66
106
  \`\`\`sh
@@ -68,53 +108,73 @@ ${snippet("claude", "oauth")}
68
108
  \`\`\`
69
109
  ${OAUTH_NEXT.claude} Restart the session if needed.
70
110
 
71
- **Codex** — add this to ~/.codex/config.toml (keep other servers):
111
+ In auto mode the user runs this \`!\` line, then authenticates via \`/mcp\`; you cannot send it for them:
112
+ \`\`\`text
113
+ !${snippet("claude", "oauth")}
114
+ \`\`\`
115
+
116
+ **Codex** — merge into ~/.codex/config.toml:
72
117
  \`\`\`toml
73
118
  ${snippet("codex", "oauth")}
74
119
  \`\`\`
75
- Then run \`codex mcp login talentos\`. In a remote terminal use \`codex mcp login talentos --no-browser\` and follow its browser instructions.
120
+ Run \`codex mcp login talentos\` (add \`--no-browser\` on a remote terminal).
76
121
 
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.
122
+ **Antigravity CLI** (agy) — merge into ~/.gemini/config/mcp_config.json, then open \`/mcp\` and authenticate talentos:
123
+ \`\`\`json
124
+ ${snippet("antigravity", "oauth")}
125
+ \`\`\`
78
126
 
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.
127
+ **Gemini CLI** — run \`gemini mcp add --scope user --transport http talentos ${url}\`, then \`/mcp auth talentos\` in Gemini (needs a local browser).
80
128
 
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:
129
+ **Cursor** — key fallback; merge into ~/.cursor/mcp.json. Keep the environment reference; never substitute a literal key:
82
130
  \`\`\`json
83
131
  ${snippet("cursor", "key")}
84
132
  \`\`\`
85
- Reload Cursor and enable talentos in MCP settings.
133
+ Launch Cursor with the variable set (a GUI launch may not inherit it); reload and enable talentos.
86
134
 
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\`.
135
+ **Any other client** — add ${url} as a Streamable HTTP server named talentos and sign in. Without OAuth, send \`Authorization: Bearer <key>\` through the client's own environment-variable syntax; stdio-only clients launch \`npx -y talentos@1 mcp\` with the variables below.
136
+
137
+ **Server bot** (Hermes, OpenClaw, your own) — sign in as above; if \`set_wake_up\` is offered, call it once with your https address and the key it expects. The owner's Allow in Settings, Agents turns it on.
138
+
139
+ **Apps (the user does this)** — never paste a key into chat. Plan or admin access may be required.
140
+ - ChatGPT: Settings → Apps → Advanced settings → Developer mode, then create an app: URL \`${url}\`, OAuth, Connect. It still checks with you before deleting or overwriting anything.
141
+ - Claude.ai: Settings → Connectors → Add custom connector: TalentOS, URL \`${url}\`, Connect; when it asks to use TalentOS, choose "Always allow" (not "Allow once").
142
+ - Grok: Settings → Connect Apps → Add a custom connector: Name TalentOS, Server URL \`${url}\`, Add MCP, then sign in.
143
+ - Gemini app: Settings → Connectors → + Custom: URL \`${url}\`, Connect. If it asks for a client ID, use a terminal agent instead.
144
+ - Antigravity app: Customizations → Installed → MCP Servers → Copy Config File Path; add talentos with \`serverUrl\` \`${url}\` as for Antigravity CLI, then Authenticate, Allow, paste the code back, Submit.
92
145
 
93
146
  ### Key fallback: headless / CI
94
147
 
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:
148
+ Member: create a personal key in TalentOS Settings → Agents → Advanced keys. Inject TALENTOS_API_KEY via your secret manager; keep it out of chat, repositories and logs. Set endpoints:
96
149
  \`\`\`sh
97
150
  export TALENTOS_API_URL='${apiOrigin}'
98
151
  export MCP_PUBLIC_ORIGIN='${origin}'
99
152
  npx -y talentos@1 whoami
100
153
  \`\`\`
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
- \`\`\`
154
+ Claude Code: keep the single quotes so the shell stores the reference; start Claude with TALENTOS_API_KEY set. Remove an existing entry first (\`claude mcp remove --scope user talentos\`):
105
155
  \`\`\`sh
106
156
  ${snippet("claude", "key")}
107
157
  \`\`\`
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:
158
+ Codex: Replace the existing [mcp_servers.talentos] section (no duplicate):
109
159
  \`\`\`toml
110
160
  ${snippet("codex", "key")}
111
161
  \`\`\`
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.
162
+ Gemini CLI: merge into ~/.gemini/settings.json; Gemini expands the variable:
163
+ \`\`\`json
164
+ ${snippet("gemini", "key")}
165
+ \`\`\`
113
166
 
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.
167
+ CLI-assisted setup: \`npx -y talentos@1 init --for claude --oauth --no-pull --api-url ${apiOrigin}\` (or \`--for codex\`, \`gemini\`, \`antigravity\`).
115
168
 
116
- ## 2. Verify before working
169
+ ## 3. Discover tools and work
117
170
 
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.
171
+ The MCP \`tools/list\` response is authoritative: visibility depends on permissions and enabled flags. Examples: \`whoami\`, \`catch_up\`, \`list_rooms\`, \`read_room\`, \`post_message\`, \`read_file\`, \`create_file\`, \`create_web_app\`, \`list_skills\`, \`get_skill\`, \`memory_read\`, \`remember\`; delegation to the Talent only when asked: \`delegate_task\`, \`get_task\`.
172
+
173
+ **CLI equivalent:** \`tools\` lists tools with input schemas; \`call\` invokes them. It needs its own connection: \`npx -y talentos@1 login --api-url ${apiOrigin}\` (member approves in browser), or the key above in CI:
174
+ \`\`\`sh
175
+ HEADLESS_CLI_V1=true npx -y talentos@1 tools --json --api-url ${apiOrigin}
176
+ HEADLESS_CLI_V1=true npx -y talentos@1 call whoami --json '{}' --api-url ${apiOrigin}
177
+ \`\`\`
178
+ Use a discovered name/schema for \`call <tool> --json '<args>'\`. Same server permissions and human approvals. stdout is one \`{ok,data|error,next?}\` object; failures exit nonzero.
119
179
  `;
120
180
  }
@@ -40,7 +40,7 @@ export class UploadRefusal extends Error {
40
40
  function refuse(message) {
41
41
  throw new UploadRefusal(message);
42
42
  }
43
- function deniedSegment(segments) {
43
+ export function deniedSegment(segments) {
44
44
  return segments.find((segment) => DENIED_SEGMENTS.has(segment.toLowerCase()) || DENIED_NAME.test(segment));
45
45
  }
46
46
  // Opens the file the model named, or refuses. Symlinks are resolved first and
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talentos",
3
- "version": "1.5.0",
3
+ "version": "1.6.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": {
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "talentos",
3
3
  "displayName": "TalentOS",
4
- "version": "0.1.0",
4
+ "version": "0.1.1",
5
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
6
  "author": { "name": "TalentOS", "url": "https://talentos.so" },
7
7
  "homepage": "https://talentos.so",
@@ -9,8 +9,9 @@ This command is for explicit delegation only. For anything the user did not ask
9
9
  to hand over, do the work yourself with the tools you have and use TalentOS only
10
10
  for company context.
11
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
12
+ - If the `talentos` MCP server offers `delegate_task`, call it with the request
13
+ as `ask`, `to` set to `my_talent`, and a `requestId` of your own that you reuse
14
+ if you retry. Then poll `get_task` until it finishes or needs the user's answer
14
15
  (`answer_task`).
15
16
  - Otherwise call `ask_talent` with the request, then poll `get_thread` for the
16
17
  reply. Stop polling after about two minutes and give the user the thread link: