talentos 1.4.22 → 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.
Files changed (45) hide show
  1. package/README.md +120 -17
  2. package/dist/agent/adapters.js +12 -2
  3. package/dist/agent/codex-policy.js +71 -0
  4. package/dist/agent/native/touch.js +18 -8
  5. package/dist/agent/provider-failure.js +9 -2
  6. package/dist/agent/serve.js +28 -5
  7. package/dist/agent/talentos-content.js +33 -0
  8. package/dist/agent-link.js +31 -3
  9. package/dist/args.js +14 -1
  10. package/dist/claude-plugin.js +82 -0
  11. package/dist/client.js +8 -4
  12. package/dist/commands/agent.js +1 -1
  13. package/dist/commands/approvals.js +145 -0
  14. package/dist/commands/doctor.js +427 -0
  15. package/dist/commands/init.js +78 -9
  16. package/dist/commands/login.js +10 -1
  17. package/dist/commands/mcp.js +17 -2
  18. package/dist/commands/publish.js +74 -0
  19. package/dist/commands/skills-sync.js +174 -0
  20. package/dist/commands/skills.js +24 -4
  21. package/dist/commands/task.js +77 -0
  22. package/dist/commands/tools.js +56 -0
  23. package/dist/config.js +34 -0
  24. package/dist/format.js +12 -0
  25. package/dist/hosting-skill.js +67 -0
  26. package/dist/index.js +129 -23
  27. package/dist/install.js +126 -38
  28. package/dist/memory-wire.js +22 -0
  29. package/dist/output.js +107 -0
  30. package/dist/publish-site.js +291 -0
  31. package/dist/published-pages.js +30 -0
  32. package/dist/setup.generated.js +180 -0
  33. package/dist/skill-files.js +1 -1
  34. package/dist/skill-sync-state.js +38 -0
  35. package/dist/upload-file.js +1 -1
  36. package/dist/watch.js +39 -0
  37. package/package.json +3 -2
  38. package/plugin/.claude-plugin/marketplace.json +12 -0
  39. package/plugin/plugins/talentos/.claude-plugin/plugin.json +9 -0
  40. package/plugin/plugins/talentos/.mcp.json +8 -0
  41. package/plugin/plugins/talentos/commands/ask-talent.md +21 -0
  42. package/plugin/plugins/talentos/commands/catch-up.md +16 -0
  43. package/plugin/plugins/talentos/commands/remember.md +15 -0
  44. package/plugin/plugins/talentos/hooks/hooks.json +17 -0
  45. package/plugin/plugins/talentos/scripts/session-start.mjs +177 -0
@@ -0,0 +1,427 @@
1
+ import { join } from "node:path";
2
+ import { PLUGIN_ID } from "../claude-plugin.js";
3
+ import { AgentClient } from "../client.js";
4
+ import { mcpUrlFor, readConfig, resolveApiUrl, } from "../config.js";
5
+ import { bold, dim, emit, emitJson } from "../format.js";
6
+ import { claudeRun, defaultProbe, homeDir, onPath, readCodexSection, readIfPresent, } from "../install.js";
7
+ import { CliError, cliContractEnabled, nextActions, withApiUrl, } from "../output.js";
8
+ import { fetchWhoami, memberLabel } from "./whoami.js";
9
+ const WHOAMI_TIMEOUT_MS = 15_000;
10
+ const CLAUDE_TIMEOUT_MS = 10_000;
11
+ const BEARER = /^Bearer\s+/u;
12
+ const FAILED_LINE = /✗|failed/iu;
13
+ const CODEX_URL = /^\s*url\s*=\s*"([^"]*)"/mu;
14
+ const CODEX_KEY = /TALENTOS_API_KEY\s*=\s*"([^"]*)"/u;
15
+ const CODEX_API_URL = /TALENTOS_API_URL\s*=\s*"([^"]*)"/u;
16
+ const QUOTED_CLI_COMMAND = /`(npx talentos@1 [^`]+)`/gu;
17
+ const FIX_COMMAND = /^(npx|claude) /u;
18
+ const FIX_INIT = "npx talentos@1 init";
19
+ /**
20
+ * Plain-language state of this machine: is TalentOS reachable with the key on
21
+ * it, and is each AI client set up. Every problem carries the one fix. Reads
22
+ * only: nothing is written and no key is printed.
23
+ */
24
+ export async function diagnose(deps) {
25
+ const report = {
26
+ connection: await checkConnection(deps),
27
+ clients: [
28
+ checkClaude(deps),
29
+ await checkCursor(deps),
30
+ await checkCodex(deps),
31
+ await checkJsonClient(deps, GEMINI_CLIENT),
32
+ await checkJsonClient(deps, ANTIGRAVITY_CLIENT),
33
+ ],
34
+ };
35
+ if (cliContractEnabled()) {
36
+ report.apiUrl = deps.config.apiUrl;
37
+ for (const finding of [...report.connection, ...report.clients]) {
38
+ if (finding.fix?.startsWith("npx talentos@1 ")) {
39
+ finding.fix = withApiUrl(finding.fix, report.apiUrl);
40
+ }
41
+ else if (finding.fix) {
42
+ finding.fix = finding.fix.replaceAll(QUOTED_CLI_COMMAND, (_match, command) => `\`${withApiUrl(command, report.apiUrl)}\``);
43
+ }
44
+ }
45
+ }
46
+ return report;
47
+ }
48
+ async function checkConnection(deps) {
49
+ if (!deps.config.apiKey) {
50
+ return [
51
+ {
52
+ status: "problem",
53
+ title: "This machine is not signed in to TalentOS.",
54
+ fix: FIX_INIT,
55
+ },
56
+ ];
57
+ }
58
+ try {
59
+ const who = await deps.who();
60
+ return [
61
+ {
62
+ status: "ok",
63
+ title: `Signed in as ${memberLabel(who.member)} · ${who.organization.name}`,
64
+ },
65
+ {
66
+ status: "note",
67
+ title: who.talent
68
+ ? `Your Talent is ${who.talent.name}. ${who.counts.companySkills} company and ${who.counts.mySkills} personal Skills, ${who.counts.routines} Routines.`
69
+ : "Your company has no Talent yet. Ask an admin to set one up in TalentOS.",
70
+ },
71
+ ];
72
+ }
73
+ catch (error) {
74
+ return [connectionProblem(error, deps.config.apiUrl)];
75
+ }
76
+ }
77
+ function connectionProblem(error, apiUrl) {
78
+ const message = error instanceof Error ? error.message : String(error);
79
+ if (message.includes("Cannot reach") || message.includes("timed out")) {
80
+ return {
81
+ status: "problem",
82
+ title: `Cannot reach TalentOS at ${apiUrl}.`,
83
+ fix: "Check your internet connection, then run `npx talentos@1 doctor` again.",
84
+ };
85
+ }
86
+ if (message.includes("Not logged in or key revoked")) {
87
+ return {
88
+ status: "problem",
89
+ title: "TalentOS no longer accepts the key on this machine.",
90
+ fix: "npx talentos@1 login",
91
+ };
92
+ }
93
+ return {
94
+ status: "problem",
95
+ title: `TalentOS answered with an error: ${message.split("\n")[0]}`,
96
+ fix: "npx talentos@1 login",
97
+ };
98
+ }
99
+ function checkClaude(deps) {
100
+ const claude = deps.claude;
101
+ if (claude === undefined) {
102
+ return { status: "note", title: "Claude Code: not found on this machine." };
103
+ }
104
+ const listed = claude(["plugin", "list", "--json"], {
105
+ timeout: CLAUDE_TIMEOUT_MS,
106
+ });
107
+ const plugin = parsePlugins(listed.stdout).find((entry) => entry.id === PLUGIN_ID);
108
+ const pluginFix = `${FIX_INIT} --for claude --oauth`;
109
+ const fix = `${FIX_INIT} --for claude`;
110
+ if (plugin?.errors?.length) {
111
+ return {
112
+ status: "problem",
113
+ title: `Claude Code: the TalentOS plugin failed to load (${plugin.errors[0]}).`,
114
+ fix: pluginFix,
115
+ };
116
+ }
117
+ if (plugin) {
118
+ return plugin.enabled === false
119
+ ? {
120
+ status: "problem",
121
+ title: "Claude Code: the TalentOS plugin is installed but turned off.",
122
+ fix: `claude plugin enable ${PLUGIN_ID}`,
123
+ }
124
+ : {
125
+ status: "ok",
126
+ title: "Claude Code: TalentOS plugin installed. If its tools are missing, run /mcp and choose Authenticate.",
127
+ };
128
+ }
129
+ const servers = claude(["mcp", "list"], { timeout: CLAUDE_TIMEOUT_MS });
130
+ if (servers.error !== undefined) {
131
+ // `claude mcp list` health-checks every server and can hang on a dead one.
132
+ return {
133
+ status: "note",
134
+ title: "Claude Code: could not check its MCP servers in time.",
135
+ };
136
+ }
137
+ const line = servers.stdout
138
+ ?.split("\n")
139
+ .find((entry) => entry.trimStart().startsWith("talentos"));
140
+ if (line !== undefined) {
141
+ return FAILED_LINE.test(line)
142
+ ? {
143
+ status: "problem",
144
+ title: "Claude Code lists TalentOS but cannot connect to it.",
145
+ fix,
146
+ }
147
+ : {
148
+ status: "ok",
149
+ title: "Claude Code: set up as an MCP server (no plugin, so no company primer or /talentos commands).",
150
+ };
151
+ }
152
+ return {
153
+ status: "problem",
154
+ title: "Claude Code is not set up for TalentOS.",
155
+ fix,
156
+ };
157
+ }
158
+ function parsePlugins(stdout) {
159
+ try {
160
+ const parsed = JSON.parse(stdout ?? "[]");
161
+ return Array.isArray(parsed) ? parsed : [];
162
+ }
163
+ catch {
164
+ return [];
165
+ }
166
+ }
167
+ async function checkCursor(deps) {
168
+ const raw = await readIfPresent(join(deps.home, ".cursor", "mcp.json"));
169
+ const fix = `${FIX_INIT} --for cursor`;
170
+ const notSetUp = {
171
+ status: "problem",
172
+ title: "Cursor is not set up for TalentOS.",
173
+ fix,
174
+ };
175
+ if (raw === undefined) {
176
+ return deps.cursorPresent
177
+ ? notSetUp
178
+ : { status: "note", title: "Cursor: not found on this machine." };
179
+ }
180
+ let entry;
181
+ try {
182
+ entry = JSON.parse(raw)
183
+ .mcpServers?.talentos;
184
+ }
185
+ catch {
186
+ return {
187
+ status: "problem",
188
+ title: "Cursor: ~/.cursor/mcp.json is not valid JSON.",
189
+ fix: "Fix the file (or delete it), then run `npx talentos@1 init --for cursor`.",
190
+ };
191
+ }
192
+ if (entry === undefined) {
193
+ return notSetUp;
194
+ }
195
+ const key = entry.headers?.Authorization?.replace(BEARER, "");
196
+ if (key === undefined) {
197
+ return {
198
+ status: "problem",
199
+ title: "Cursor has no key for TalentOS. Cursor uses this machine's key for now; browser sign-in is not available for it yet.",
200
+ fix,
201
+ };
202
+ }
203
+ const finding = keyedClientFinding("Cursor", {
204
+ config: deps.config,
205
+ fix,
206
+ key,
207
+ url: entry.url,
208
+ });
209
+ return finding.status === "ok"
210
+ ? {
211
+ ...finding,
212
+ title: `${finding.title} Cursor uses the key for now; browser sign-in is not available for it yet.`,
213
+ }
214
+ : finding;
215
+ }
216
+ const GEMINI_CLIENT = {
217
+ file: "~/.gemini/settings.json",
218
+ label: "Gemini CLI",
219
+ path: [".gemini", "settings.json"],
220
+ signIn: "Run /mcp auth talentos in Gemini if it asks you to sign in.",
221
+ target: "gemini",
222
+ urlKey: "httpUrl",
223
+ };
224
+ const ANTIGRAVITY_CLIENT = {
225
+ file: "~/.gemini/config/mcp_config.json",
226
+ label: "Antigravity CLI",
227
+ path: [".gemini", "config", "mcp_config.json"],
228
+ signIn: "Open /mcp and authenticate talentos if it asks you to sign in.",
229
+ target: "antigravity",
230
+ urlKey: "serverUrl",
231
+ };
232
+ // Gemini CLI and Antigravity CLI keep TalentOS under `mcpServers.talentos`
233
+ // in a JSON file, with a key header or none (browser sign-in).
234
+ async function checkJsonClient(deps, client) {
235
+ const raw = await readIfPresent(join(deps.home, ...client.path));
236
+ const fix = `${FIX_INIT} --for ${client.target}`;
237
+ if (raw === undefined) {
238
+ return {
239
+ status: "note",
240
+ title: `${client.label}: not found on this machine.`,
241
+ };
242
+ }
243
+ let entry;
244
+ try {
245
+ entry = JSON.parse(raw).mcpServers?.talentos;
246
+ }
247
+ catch {
248
+ return {
249
+ status: "problem",
250
+ title: `${client.label}: ${client.file} is not plain JSON.`,
251
+ // Never "delete it": the file holds the member's other settings.
252
+ fix: `Add the talentos entry by hand, or remove its comments and run \`npx talentos@1 init --for ${client.target}\`.`,
253
+ };
254
+ }
255
+ if (entry === undefined) {
256
+ return {
257
+ status: "problem",
258
+ title: `${client.label} is not set up for TalentOS.`,
259
+ fix,
260
+ };
261
+ }
262
+ return keyedClientFinding(client.label, {
263
+ config: deps.config,
264
+ fix,
265
+ key: entry.headers?.Authorization?.replace(BEARER, ""),
266
+ signIn: client.signIn,
267
+ url: entry[client.urlKey],
268
+ });
269
+ }
270
+ async function checkCodex(deps) {
271
+ const raw = await readIfPresent(join(deps.home, ".codex", "config.toml"));
272
+ const fix = `${FIX_INIT} --for codex`;
273
+ if (raw === undefined) {
274
+ return { status: "note", title: "Codex: not found on this machine." };
275
+ }
276
+ const block = readCodexSection(raw, "talentos");
277
+ if (block === undefined) {
278
+ return {
279
+ status: "problem",
280
+ title: "Codex is not set up for TalentOS.",
281
+ fix,
282
+ };
283
+ }
284
+ const url = block.match(CODEX_URL)?.[1];
285
+ if (url !== undefined) {
286
+ return keyedClientFinding("Codex", {
287
+ config: deps.config,
288
+ fix,
289
+ key: undefined,
290
+ url,
291
+ signIn: "Run `codex mcp login talentos` if it asks you to sign in.",
292
+ });
293
+ }
294
+ const key = block.match(CODEX_KEY)?.[1];
295
+ const apiUrl = block.match(CODEX_API_URL)?.[1];
296
+ // The stdio proxy talks to its own API url, not the public MCP address.
297
+ if (apiUrl !== undefined &&
298
+ resolveApiUrl(apiUrl, apiUrl) !== deps.config.apiUrl) {
299
+ return {
300
+ status: "problem",
301
+ title: `Codex points at ${apiUrl}, not ${deps.config.apiUrl}.`,
302
+ fix,
303
+ };
304
+ }
305
+ return keyedClientFinding("Codex", {
306
+ config: deps.config,
307
+ fix,
308
+ key,
309
+ url: undefined,
310
+ });
311
+ }
312
+ /**
313
+ * A client entry is fine when its address is the one for this machine's API
314
+ * url and, for a key entry, the key is the one stored here. A key entry's key
315
+ * is never printed; it is compared only.
316
+ */
317
+ function keyedClientFinding(label, entry) {
318
+ const expected = mcpUrlFor(entry.config.apiUrl);
319
+ if (entry.url !== undefined && entry.url !== expected) {
320
+ return {
321
+ status: "problem",
322
+ title: `${label} points at ${entry.url}, not ${expected}.`,
323
+ fix: entry.fix,
324
+ };
325
+ }
326
+ if (entry.key === undefined) {
327
+ return {
328
+ status: "ok",
329
+ title: `${label}: set up for browser sign-in. ${entry.signIn ?? "If it asks you to sign in, follow the prompt."}`,
330
+ };
331
+ }
332
+ if (entry.config.apiKey && entry.key !== entry.config.apiKey) {
333
+ return {
334
+ status: "problem",
335
+ title: `${label} uses an older key than the one on this machine.`,
336
+ fix: entry.fix,
337
+ };
338
+ }
339
+ return {
340
+ status: "ok",
341
+ title: `${label}: set up with this machine's key.`,
342
+ };
343
+ }
344
+ const MARKS = { note: "·", ok: "✓", problem: "✗" };
345
+ export function renderReport(report) {
346
+ const rerun = withApiUrl("npx talentos@1 doctor", report.apiUrl);
347
+ const mark = (finding) => MARKS[finding.status];
348
+ const lines = (findings) => findings.flatMap((finding) => [
349
+ `${mark(finding)} ${finding.title}`,
350
+ ...(finding.fix ? [` Fix: ${finding.fix}`] : []),
351
+ ]);
352
+ const problems = [...report.connection, ...report.clients].filter((finding) => finding.status === "problem").length;
353
+ return [
354
+ bold("TalentOS connection"),
355
+ ...lines(report.connection),
356
+ "",
357
+ bold("Your AI tools"),
358
+ ...lines(report.clients),
359
+ "",
360
+ problems === 0
361
+ ? "Everything looks good."
362
+ : `${problems} thing${problems === 1 ? "" : "s"} to fix. Run the Fix line under each ✗, then \`${rerun}\` again.`,
363
+ dim("Nothing was changed and no key was printed."),
364
+ ...(cliContractEnabled() && problems > 0
365
+ ? [
366
+ `Next: ${[...report.connection, ...report.clients].find((finding) => finding.status === "problem")?.fix ?? "Check the findings above"}; then run \`${rerun}\` again.`,
367
+ ]
368
+ : []),
369
+ ].join("\n");
370
+ }
371
+ export async function runDoctor(parsed) {
372
+ const config = await readConfig();
373
+ const apiUrl = resolveApiUrl(parsed.options["api-url"], config.apiUrl);
374
+ const home = homeDir();
375
+ const probe = defaultProbe();
376
+ const report = await diagnose({
377
+ claude: onPath("claude") ? claudeRun : undefined,
378
+ config: { ...config, apiUrl },
379
+ cursorPresent: probe.exists(join(home, ".cursor")) ||
380
+ probe.exists(join(probe.cwd, ".cursor")),
381
+ home,
382
+ who: () => whoamiWithTimeout({ ...config, apiUrl }),
383
+ });
384
+ if (parsed.options.json) {
385
+ emitJson(report);
386
+ }
387
+ else {
388
+ emit(renderReport(report));
389
+ }
390
+ const failed = [...report.connection, ...report.clients].some((finding) => finding.status === "problem");
391
+ if (cliContractEnabled()) {
392
+ const actions = doctorNext(report);
393
+ nextActions(actions);
394
+ if (failed && parsed.options.json) {
395
+ const first = [...report.connection, ...report.clients].find((finding) => finding.status === "problem");
396
+ throw new CliError("DIAGNOSTIC_FAILED", first?.title ?? "This machine needs attention.", actions);
397
+ }
398
+ }
399
+ if (failed) {
400
+ process.exitCode = 1;
401
+ }
402
+ }
403
+ function doctorNext(report) {
404
+ return [...report.connection, ...report.clients]
405
+ .filter((finding) => finding.status === "problem")
406
+ .map((finding) => ({
407
+ command: finding.fix && FIX_COMMAND.test(finding.fix)
408
+ ? finding.fix
409
+ : withApiUrl("npx talentos@1 doctor", report.apiUrl),
410
+ why: `${finding.title} ${finding.fix ?? "Check the findings."} Then run ${withApiUrl("npx talentos@1 doctor", report.apiUrl)} again.`,
411
+ }));
412
+ }
413
+ async function whoamiWithTimeout(config) {
414
+ const client = new AgentClient({
415
+ apiKey: config.apiKey ?? "",
416
+ apiUrl: config.apiUrl,
417
+ });
418
+ const timeout = new Promise((_, reject) => {
419
+ setTimeout(() => reject(new Error("Cannot reach TalentOS: timed out.")), WHOAMI_TIMEOUT_MS).unref();
420
+ });
421
+ try {
422
+ return await Promise.race([fetchWhoami(client), timeout]);
423
+ }
424
+ finally {
425
+ await client.close();
426
+ }
427
+ }
@@ -1,7 +1,11 @@
1
+ import { installClaudePlugin } from "../claude-plugin.js";
1
2
  import { withClient } from "../client.js";
2
- import { bold, dim, emit } from "../format.js";
3
- import { agentLabel, agentTargetsFor, applyInstall, buildInstallSnippet, defaultProbe, detectAgents, homeDir, pullDirs, } from "../install.js";
3
+ import { bold, dim, emit, emitJson } from "../format.js";
4
+ import { hostingSkillDirs, installHostingSkill } from "../hosting-skill.js";
5
+ import { agentLabel, agentTargetsFor, applyInstall, buildInstallSnippet, defaultProbe, detectAgents, homeDir, oauthNext, pullDirs, setupModeFrom, } from "../install.js";
6
+ import { machineOutput, nextActions } from "../output.js";
4
7
  import { authorize, currentSession } from "./login.js";
8
+ import { hostingAvailable } from "./publish.js";
5
9
  import { pullInto } from "./skills.js";
6
10
  import { memberLabel } from "./whoami.js";
7
11
  const DONE = "✓";
@@ -13,21 +17,43 @@ const TRAILING_PUNCTUATION = /[.:\s]+$/;
13
17
  * already look for them.
14
18
  */
15
19
  export async function runInit(parsed) {
20
+ const mode = setupModeFrom(parsed.options);
16
21
  const session = await signIn(parsed);
17
22
  const targets = chosenTargets(parsed.options.for);
18
23
  if (targets.length === 0) {
19
- step(false, "No agent found. Re-run with --for claude|cursor|codex.");
24
+ step(false, "No agent found. Re-run with --for claude|cursor|codex|gemini|antigravity.");
20
25
  }
21
26
  const configured = [];
22
27
  for (const target of targets) {
23
- if (await configure(target, session.credentials)) {
28
+ if (await configure(target, session.credentials, mode)) {
24
29
  configured.push(target);
25
30
  }
26
31
  }
27
32
  const pulled = parsed.options["no-pull"]
28
33
  ? undefined
29
34
  : await pullShared(parsed, targets);
30
- emit(summary(configured, pulled));
35
+ if (!parsed.options["no-pull"]) {
36
+ await installHosting(parsed, targets);
37
+ }
38
+ emit(summary(configured, pulled, mode));
39
+ if (machineOutput()) {
40
+ emitJson({ configured, pulled: pulled ?? null, mode });
41
+ nextActions([
42
+ {
43
+ command: "talentos whoami --json",
44
+ why: "Verify the connected member and company before writing.",
45
+ },
46
+ ]);
47
+ if (configured.length === 0 || configured.length !== targets.length) {
48
+ process.exitCode = 1;
49
+ nextActions([
50
+ {
51
+ command: "talentos doctor --json",
52
+ why: "Some clients need setup; check the diagnostics.",
53
+ },
54
+ ]);
55
+ }
56
+ }
31
57
  }
32
58
  async function signIn(parsed) {
33
59
  const stored = await currentSession(parsed);
@@ -42,11 +68,11 @@ function chosenTargets(forOption) {
42
68
  ? detectAgents(defaultProbe())
43
69
  : agentTargetsFor(forOption);
44
70
  }
45
- async function configure(target, credentials) {
71
+ async function configure(target, credentials, mode) {
46
72
  const label = agentLabel(target);
47
- const snippet = () => buildInstallSnippet(target, credentials);
73
+ const snippet = () => buildInstallSnippet(target, credentials, mode);
48
74
  try {
49
- const outcome = await applyInstall(target, credentials);
75
+ const outcome = await installFor(target, credentials, mode);
50
76
  if (outcome.applied) {
51
77
  step(true, `${label} → ${outcome.detail}`);
52
78
  return true;
@@ -58,6 +84,23 @@ async function configure(target, credentials) {
58
84
  }
59
85
  return false;
60
86
  }
87
+ /**
88
+ * Claude Code gets its plugin when OAuth is on and its `claude` supports
89
+ * plugins; anything the plugin cannot do falls back to `claude mcp add`.
90
+ */
91
+ export async function installFor(target, credentials, mode) {
92
+ if (target === "claude" && mode === "oauth") {
93
+ const plugin = await installClaudePlugin({
94
+ apiUrl: credentials.apiUrl,
95
+ home: homeDir(),
96
+ });
97
+ if (plugin.applied) {
98
+ return plugin;
99
+ }
100
+ step(false, `Claude Code plugin skipped: ${plugin.detail}`);
101
+ }
102
+ return await applyInstall(target, credentials, homeDir(), mode);
103
+ }
61
104
  /** Every failure ends the same way: why, then the command to run by hand. */
62
105
  export function manualInstallNotice(label, reason, snippet) {
63
106
  const why = reason.replace(TRAILING_PUNCTUATION, "");
@@ -79,14 +122,40 @@ async function pullShared(parsed, targets) {
79
122
  : `${pulled.length} skill(s) → ${dirs.join(", ")}`);
80
123
  return pulled.length;
81
124
  }
82
- function summary(configured, pulled) {
125
+ /**
126
+ * The Host on TalentOS skill, at user level so every project has it, only
127
+ * where the workspace has hosting on (the server shows the publish tool).
128
+ */
129
+ async function installHosting(parsed, targets) {
130
+ const available = await withClient(parsed.options["api-url"], (client) => hostingAvailable(client));
131
+ if (!available || targets.length === 0) {
132
+ return;
133
+ }
134
+ const dirs = hostingSkillDirs(homeDir(), targets);
135
+ await installHostingSkill(dirs);
136
+ step(true, `Host on TalentOS skill → ${dirs.join(", ")}`);
137
+ }
138
+ function summary(configured, pulled, mode) {
83
139
  const agents = configured.length === 0 ? "none" : configured.map(agentLabel).join(", ");
84
140
  return [
85
141
  "",
86
142
  bold("TalentOS is connected."),
87
143
  `Agents configured: ${agents}`,
88
144
  `Skills written: ${pulled ?? "skipped (--no-pull)"}`,
145
+ ...(mode === "oauth"
146
+ ? [
147
+ "Sign in once in your browser:",
148
+ ...configured.flatMap((target) => {
149
+ const next = oauthNext(target);
150
+ return next ? [` ${next}`] : [];
151
+ }),
152
+ ...(configured.includes("cursor")
153
+ ? ["Cursor keeps using this machine's key for now."]
154
+ : []),
155
+ ]
156
+ : []),
89
157
  dim("Next: ask your agent to call the talentos whoami tool."),
158
+ dim("Anything not working? Run `npx talentos@1 doctor`."),
90
159
  ].join("\n");
91
160
  }
92
161
  function step(done, text) {
@@ -1,7 +1,8 @@
1
1
  import { AgentClient, UNAUTHORIZED } from "../client.js";
2
2
  import { clearConfig, readConfig, resolveApiUrl, writeConfig, } from "../config.js";
3
- import { bold, emit } from "../format.js";
3
+ import { bold, emit, emitJson } from "../format.js";
4
4
  import { checkPastedKey, defaultDeviceName, fetchLoginStatus, mintKey, openBrowser, startLogin, } from "../login.js";
5
+ import { machineOutput } from "../output.js";
5
6
  import { fetchWhoami, renderWhoami } from "./whoami.js";
6
7
  const POLL_INTERVAL_MS = 2000;
7
8
  /** A 5xx or a dropped wifi must not discard a key the member just approved. */
@@ -9,6 +10,10 @@ const MAX_POLL_FAILURES = 5;
9
10
  const REJECTED_KEY = "TalentOS rejected that key. Create a new one in Settings → Agents, or run `talentos login` without --key.";
10
11
  export async function runLogin(parsed) {
11
12
  const session = await authorize(parsed);
13
+ if (machineOutput()) {
14
+ emitJson(session.who);
15
+ return;
16
+ }
12
17
  emit(`${bold("Logged in.")}\n${renderWhoami(session.who)}`);
13
18
  }
14
19
  /** The handshake: mint or accept a key, prove it works, then store it. */
@@ -44,6 +49,10 @@ export async function currentSession(parsed) {
44
49
  }
45
50
  export async function runLogout() {
46
51
  await clearConfig();
52
+ if (machineOutput()) {
53
+ emitJson({ loggedOut: true });
54
+ return;
55
+ }
47
56
  emit("Logged out. The key on the server is still valid until you revoke it.");
48
57
  }
49
58
  async function approveNewKey(apiUrl, parsed) {
@@ -1,7 +1,8 @@
1
1
  import { AgentClient } from "../client.js";
2
2
  import { requireCredentials, resolveApiUrl } from "../config.js";
3
- import { dim, emit } from "../format.js";
3
+ import { dim, emit, emitJson } from "../format.js";
4
4
  import { agentLabel, applyInstall, buildInstallSnippet, installHint, isAgentTarget, isMcpInstallTarget, MCP_INSTALL_TARGETS, } from "../install.js";
5
+ import { machineOutput } from "../output.js";
5
6
  export async function runMcp(parsed) {
6
7
  if (parsed.action === "install") {
7
8
  await runMcpInstall(parsed);
@@ -32,13 +33,27 @@ async function runMcpInstall(parsed) {
32
33
  }
33
34
  // Hint on stderr so `talentos mcp install cursor > mcp.json` writes only JSON.
34
35
  process.stderr.write(`${dim(installHint(target))}\n\n`);
36
+ if (machineOutput()) {
37
+ emitJson({ target, snippet: buildInstallSnippet(target, credentials) });
38
+ return;
39
+ }
35
40
  emit(buildInstallSnippet(target, credentials));
36
41
  }
37
42
  async function installFor(target, credentials) {
38
43
  if (!isAgentTarget(target)) {
39
- throw new Error("--apply needs a client to write to: claude, cursor or codex.");
44
+ throw new Error("--apply needs a client to write to: claude, cursor, codex, gemini or antigravity.");
40
45
  }
41
46
  const outcome = await applyInstall(target, credentials);
47
+ if (machineOutput()) {
48
+ emitJson({
49
+ target,
50
+ ...outcome,
51
+ ...(outcome.applied
52
+ ? {}
53
+ : { snippet: buildInstallSnippet(target, credentials) }),
54
+ });
55
+ return;
56
+ }
42
57
  if (outcome.applied) {
43
58
  emit(`Configured ${agentLabel(target)} — ${outcome.detail}`);
44
59
  return;