talentos 1.4.21 → 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.
Files changed (43) hide show
  1. package/README.md +82 -7
  2. package/dist/agent/adapters.js +12 -2
  3. package/dist/agent/codex-policy.js +13 -0
  4. package/dist/agent/codex-probe.js +3 -1
  5. package/dist/agent/native/codex-fence.js +1 -1
  6. package/dist/agent/native/codex-launch.js +1 -3
  7. package/dist/agent/native/gate.js +11 -3
  8. package/dist/agent/native/hook-entry.js +8 -1
  9. package/dist/agent/native/touch.js +15 -6
  10. package/dist/agent/serve.js +4 -2
  11. package/dist/agent/talentos-content.js +33 -0
  12. package/dist/args.js +10 -1
  13. package/dist/claude-plugin.js +82 -0
  14. package/dist/client.js +17 -4
  15. package/dist/commands/doctor.js +371 -0
  16. package/dist/commands/init.js +59 -8
  17. package/dist/commands/login.js +10 -1
  18. package/dist/commands/mcp.js +16 -1
  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/download-file.js +75 -0
  25. package/dist/format.js +12 -0
  26. package/dist/index.js +102 -19
  27. package/dist/install.js +55 -36
  28. package/dist/mcp-proxy.js +18 -0
  29. package/dist/memory-wire.js +22 -0
  30. package/dist/output.js +107 -0
  31. package/dist/setup.generated.js +120 -0
  32. package/dist/skill-files.js +1 -1
  33. package/dist/skill-sync-state.js +38 -0
  34. package/dist/watch.js +39 -0
  35. package/package.json +3 -2
  36. package/plugin/.claude-plugin/marketplace.json +12 -0
  37. package/plugin/plugins/talentos/.claude-plugin/plugin.json +9 -0
  38. package/plugin/plugins/talentos/.mcp.json +8 -0
  39. package/plugin/plugins/talentos/commands/ask-talent.md +20 -0
  40. package/plugin/plugins/talentos/commands/catch-up.md +16 -0
  41. package/plugin/plugins/talentos/commands/remember.md +15 -0
  42. package/plugin/plugins/talentos/hooks/hooks.json +17 -0
  43. package/plugin/plugins/talentos/scripts/session-start.mjs +177 -0
package/README.md CHANGED
@@ -41,14 +41,67 @@ overwritten by slug.
41
41
 
42
42
  | agent | what `init` writes |
43
43
  | --- | --- |
44
- | Claude Code | `claude mcp add --scope user --transport http talentos <url> --header ...` (prints the command if `claude` is not on your PATH) |
45
- | Cursor | `~/.cursor/mcp.json` → `mcpServers.talentos` (other servers kept, mode 0600) |
46
- | Codex | `~/.codex/config.toml` → `[mcp_servers.talentos]`, the stdio proxy carrying `TALENTOS_API_KEY` and `TALENTOS_API_URL` (mode 0600) |
44
+ | Claude Code | `claude mcp add --scope user --transport http talentos <url> --header ...` (prints the command if `claude` is not on your PATH). With `--oauth`: the TalentOS plugin, below |
45
+ | Cursor | `~/.cursor/mcp.json` → `mcpServers.talentos` (other servers kept, mode 0600). Same with `--oauth`: Cursor keeps the key for now |
46
+ | Codex | `~/.codex/config.toml` → `[mcp_servers.talentos]`, the stdio proxy carrying `TALENTOS_API_KEY` and `TALENTOS_API_URL` (mode 0600). With `--oauth`: `url = ...` only |
47
47
 
48
- **Nothing is written inside the repo except pulled skills.** Your API key lives in
48
+ **Nothing is written inside the repo except pulled skills** (and the `.talentos-sync.json` that tracks them). Your API key lives in
49
49
  `~/.config/talentos/config.json` and in those user-level agent configs, never in
50
50
  a file your team could check in.
51
51
 
52
+ ## Browser sign-in: `init --oauth`
53
+
54
+ ```bash
55
+ npx talentos@1 init --oauth
56
+ ```
57
+
58
+ `--oauth` (or `HEADLESS_SETUP_V1=true`) sets Claude Code and Codex up without a
59
+ key in their config; you sign in once in the browser. It is opt-in until the server
60
+ accepts these clients' sign-in ([#15810](https://github.com/TalentOSOfficial/talentos-team/issues/15810)); [Agent access](../../docs/features/agent-access/README.md#headless-setup-claude-code-plugin-oauth-first-init-skills-sync-doctor) has the rules.
61
+
62
+ - **Claude Code** gets the `talentos` plugin: the remote server, a SessionStart
63
+ primer (who you are, your Talent, how to use TalentOS, inside 2 s and silent
64
+ offline) and three slash commands: `/talentos:catch-up`, `/talentos:remember`
65
+ and `/talentos:ask-talent` (hand work to your Talent only when you say so).
66
+ `init` copies the plugin to `~/.talentos/claude-marketplace`, runs `claude
67
+ plugin marketplace add` and `claude plugin install talentos@talentos`, and
68
+ falls back to `claude mcp add` when your Claude Code has no plugin command.
69
+ Then run `/mcp`, pick talentos and choose Authenticate.
70
+ - **Cursor** keeps the key entry in `~/.cursor/mcp.json` for now: the server has
71
+ no sign-in for it yet, and `doctor` says so.
72
+ - **Codex** gets `url = ...` in `~/.codex/config.toml`; run
73
+ `codex mcp login talentos`.
74
+
75
+ The plugin's live primer line needs the key `init` stored (a hook cannot use
76
+ Claude Code's browser sign-in); without a key it prints a static primer.
77
+
78
+ ## Check your setup
79
+
80
+ ```bash
81
+ npx talentos@1 doctor
82
+ ```
83
+
84
+ Says in plain words whether TalentOS answers with the key on this machine and
85
+ whether Claude Code, Cursor and Codex are set up, with one fix under each
86
+ problem. It changes nothing, never prints a key, and exits 1 when something
87
+ needs a fix.
88
+
89
+ ## Keep skills in sync
90
+
91
+ ```bash
92
+ npx talentos@1 skills sync [--for claude|cursor|codex|all] [--global]
93
+ ```
94
+
95
+ Only skills TalentOS changed are fetched and rewritten. It never overwrites
96
+ your work (it tracks what it wrote, including what `init` and `skills pull`
97
+ wrote, in `.talentos-sync.json`): a skill you edited (or deleted) stays as it is,
98
+ and is reported, once TalentOS has a newer version; a folder it did not write is left alone
99
+ unless every file already matches; files you added and skills TalentOS no
100
+ longer lists are never deleted. `skills pull` is the explicit overwrite. To sync
101
+ at the start of every Claude Code session, set `TALENTOS_SKILLS_SYNC=1` in
102
+ Claude Code's `env` setting: company skills go to `~/.claude/skills`, at most
103
+ once per six hours, in the background.
104
+
52
105
  ## Login on its own
53
106
 
54
107
  ```bash
@@ -78,6 +131,22 @@ before it is sent, and stored only once TalentOS accepts it.
78
131
  | `codex` | the `~/.codex/config.toml` entry (stdio, via `npx -y talentos@1 mcp`, with the API url in its env) |
79
132
  | `json` | a generic `mcpServers` entry (print only) |
80
133
 
134
+ ## MCP tools and machine output
135
+
136
+ The prepared 1.5.0 release is unpublished; James owns publication. Enable
137
+ `HEADLESS_CLI_V1=true` in the CLI process to try its contract:
138
+
139
+ ```sh
140
+ talentos tools --json
141
+ talentos call whoami --json '{}'
142
+ talentos task status '<taskId>' --json
143
+ talentos task watch '<taskId>' --json
144
+ talentos doctor --json
145
+ ```
146
+
147
+ The [CLI contract](../../docs/features/agent-access/README.md#cli-output-and-task-continuation)
148
+ defines output, error results, task continuation and human approval boundaries.
149
+
81
150
  ## Commands
82
151
 
83
152
  ### Agents in Rooms
@@ -115,7 +184,8 @@ private pending receipt if a response is lost; it permits recovery after the
115
184
  one-use link has been consumed.
116
185
 
117
186
  ```
118
- talentos init [--for claude|cursor|codex|all] [--no-pull] [--name <device>]
187
+ talentos init [--for claude|cursor|codex|all] [--no-pull] [--oauth] [--name <device>]
188
+ talentos doctor [--json] [--api-url <url>]
119
189
 
120
190
  talentos login [--key <key>] [--api-url <url>] [--name <device>]
121
191
  talentos logout
@@ -128,6 +198,7 @@ talentos skills list [--mine|--company] [-q <query>]
128
198
  talentos skills get <id|slug> [--out <dir>] # prints SKILL.md, or writes the package
129
199
  talentos skills push <SKILL.md|dir> [--id <skillId>]
130
200
  talentos skills pull [--for claude|cursor|codex|all] [--global] [--to <dir>] [--mine|--company]
201
+ talentos skills sync [--for claude|cursor|codex|all] [--global] [--to <dir>] [--mine|--company] [--quiet]
131
202
  talentos skills share <id> # refuses: Share this Skill from TalentOS.
132
203
 
133
204
  talentos memory search "<query>" [--personal|--company]
@@ -149,7 +220,8 @@ slug both land: the second goes to `<slug>-<last 6 of its id>`.
149
220
  After `skills push`, `skills get`, `ask` and `routines run`, the last line is
150
221
  `Open: <url>` — the deep link to that skill or thread in TalentOS.
151
222
 
152
- Every command takes `--json` to print the raw structured result instead of text.
223
+ See [MCP tools and machine output](#mcp-tools-and-machine-output) for automation and task continuation.
224
+
153
225
  `talentos --help` and `talentos <group> --help` print usage.
154
226
 
155
227
  A skill package is a `SKILL.md` (YAML frontmatter with `name` and `description`,
@@ -163,7 +235,10 @@ file or the folder that contains it; a folder is walked recursively, skipping
163
235
  | --- | --- |
164
236
  | `~/.config/talentos/config.json` | `{ apiUrl, apiKey }`, mode 0600 (honours `XDG_CONFIG_HOME`) |
165
237
  | `TALENTOS_API_KEY` | overrides the stored key |
238
+ | `MCP_PUBLIC_ORIGIN` | optional HTTPS origin for remote MCP install snippets; unset uses the saved API origin. Keep `TALENTOS_API_URL` on the REST/gateway deployment. |
166
239
  | `TALENTOS_API_URL` | overrides the stored API url (default `https://woozy-oyster-769.convex.site`) |
240
+ | `HEADLESS_SETUP_V1` | `true` or `1` makes `init` use the browser sign-in setup, like `--oauth` |
241
+ | `TALENTOS_SKILLS_SYNC` | `1` lets the Claude Code plugin sync skills when a session starts |
167
242
  | `--api-url` | overrides both, for one command |
168
243
 
169
244
  ## Exit codes
@@ -171,4 +246,4 @@ file or the folder that contains it; a folder is walked recursively, skipping
171
246
  | code | meaning |
172
247
  | --- | --- |
173
248
  | 0 | success |
174
- | 1 | any failure — one line on stderr, nothing on stdout |
249
+ | 1 | failure; with `HEADLESS_CLI_V1=true --json`, one error envelope on stdout; otherwise a message on stderr |
@@ -20,6 +20,7 @@ import { classifyProviderFailure, matchFailureText, ProviderFailureError, } from
20
20
  import { READ_PAGE_TOOL, ROOM_WEB_MCP_ENTRY, ROOM_WEB_SERVER, } from "./room-page.js";
21
21
  import { prepareRoomProfile, ROOM_CATALOG_FILE, ROOM_MCP_FILE, } from "./room-profile.js";
22
22
  import { roomProvider } from "./room-providers.js";
23
+ import { isTalentOSContentUrl } from "./talentos-content.js";
23
24
  const CHILD_ENV = [
24
25
  "HOME",
25
26
  "PATH",
@@ -395,7 +396,10 @@ export function readProviderEvent(provider, value) {
395
396
  return {
396
397
  status: WEB_STATUS[names[0] ?? ""] ?? "Using room tools…",
397
398
  // Any of the turn's calls, not only the first: they run together.
398
- ...(names.some((name) => name in WEB_STATUS)
399
+ ...(message.content.some((part) => part.type === "tool_use" &&
400
+ (part.name ?? "") in WEB_STATUS &&
401
+ (part.name === "WebSearch" ||
402
+ !isTalentOSContentUrl(part.input?.url)))
399
403
  ? { web: true }
400
404
  : {}),
401
405
  };
@@ -427,7 +431,13 @@ export function readProviderEvent(provider, value) {
427
431
  return { status: "Using room tools…" };
428
432
  }
429
433
  if (event.type === "item.started" && item?.type === "web_search") {
430
- return { status: SEARCHING, web: true };
434
+ return {
435
+ status: SEARCHING,
436
+ ...(item.action?.type === "open_page" &&
437
+ isTalentOSContentUrl(item.action.url)
438
+ ? {}
439
+ : { web: true }),
440
+ };
431
441
  }
432
442
  }
433
443
  return {};
@@ -2,6 +2,12 @@
2
2
  // server: the shell fence (#10987). The proxy classifies the command.
3
3
  export const ROOM_LOCAL_TOOLS = ["run_command"];
4
4
  export const ROOM_TOOLS = [
5
+ "recall",
6
+ "update_memory",
7
+ "forget",
8
+ "save_progress",
9
+ "resume",
10
+ "import_memories",
5
11
  "add_todo",
6
12
  "list_rooms",
7
13
  "list_threads",
@@ -20,6 +26,8 @@ export const ROOM_TOOLS = [
20
26
  "get_skill",
21
27
  "list_skills",
22
28
  "search_memory",
29
+ "memory_outline",
30
+ "memory_read",
23
31
  "list_connections",
24
32
  "use_connection",
25
33
  "change_connection",
@@ -28,6 +36,7 @@ export const ROOM_TOOLS = [
28
36
  "get_thread",
29
37
  "list_routines",
30
38
  "run_routine",
39
+ "update_routine",
31
40
  "remember",
32
41
  "save_skill",
33
42
  "suggest_change",
@@ -38,6 +47,7 @@ export const ROOM_TOOLS = [
38
47
  "create_web_app",
39
48
  "export_file",
40
49
  "revise_web_app",
50
+ "share_file_to_room",
41
51
  "upload_file",
42
52
  "prepare_upload",
43
53
  "commit_upload",
@@ -51,6 +61,9 @@ export const ROOM_TOOLS = [
51
61
  "start_thread",
52
62
  "rename_thread",
53
63
  "share_link",
64
+ "find_people",
65
+ "message_person",
66
+ "person_replies",
54
67
  "room_default_set",
55
68
  "room_default_remove",
56
69
  "whoami",
@@ -17,6 +17,8 @@ export const PROBE_REVISION = 3;
17
17
  // to /mcp, so the stand-in lists later than that: only a launch that makes Codex
18
18
  // wait for the room server passes.
19
19
  export const SLOW_LIST_MS = 1500;
20
+ /** Test hook: when the boundary proof's stand-in lists. A test that shortens it shortens its fixture's grace with it. */
21
+ export const proofTiming = { slowListMs: SLOW_LIST_MS };
20
22
  const RESOURCE_REFUSAL = /Method not found|unknown MCP server/u;
21
23
  // Codex 0.165+ refuses a read aimed at a server it does not have with this line
22
24
  // alone, without the "resources/read failed:" prefix older ones put first
@@ -545,7 +547,7 @@ async function proveCodexBoundary(binary, version, catalog, stop, web = false) {
545
547
  catalogPath,
546
548
  mcpCommand: process.execPath,
547
549
  // One slow listing is enough to prove Codex waits; keep resume quick.
548
- mcpArgs: [mcp, String(turn === 0 ? SLOW_LIST_MS : 0)],
550
+ mcpArgs: [mcp, String(turn === 0 ? proofTiming.slowListMs : 0)],
549
551
  prompt: "Verify the room boundary.",
550
552
  sessionId: session,
551
553
  web,
@@ -17,7 +17,7 @@ import { ROOM_LOCAL_TOOLS, ROOM_TOOLS } from "../codex-policy.js";
17
17
  // Image generation is the one tool the launch may add: the hook sees each call
18
18
  // and its reference images before Codex reads them, on a Codex that passed the
19
19
  // owner image proof (codex-owner-images.ts). It is on only for the owner's own
20
- // ask in a room where they are the only person.
20
+ // ask.
21
21
  export const ROOM_SERVER = "talentos_room";
22
22
  // R2 (#10987): the exact Codex versions allowed full setup live on the server
23
23
  // (convex/externalAgents/codexFence.model.ts) and arrive with each heartbeat and each
@@ -17,11 +17,9 @@ export function codexRoomMcpEntry(input) {
17
17
  export async function prepareCodexOwnerLaunch(input) {
18
18
  const jobDir = join(input.directory, "jobs", input.jobId.replace(/[^\w-]/gu, ""));
19
19
  await mkdir(jobDir, { recursive: true, mode: 0o700 });
20
- // Codex's own image tool: the owner's own ask, in a room where they are the
21
- // only person, on a proven Codex. Everything else keeps today's launch.
20
+ // The stored requester gates use of the owner's image tool, even in shared Rooms.
22
21
  const images = input.imagesProven === true &&
23
22
  input.ownAsk === true &&
24
- input.sharedRoom !== true &&
25
23
  input.codexHome !== undefined
26
24
  ? { dir: join(input.codexHome, "generated_images") }
27
25
  : undefined;
@@ -368,10 +368,18 @@ export class NativeGate {
368
368
  const env = await this.loginEnv();
369
369
  // Claude: an update in place replaces the binary the probe proved, so it is
370
370
  // checked again per job (a stat and a --version, never the probe itself).
371
+ // Re-prove the new binary here and keep `probe` OK while it runs: dropping
372
+ // it to "none" made the heartbeat report the computer not ready, and the
373
+ // server then cancelled the in-flight native job before the probe passed.
371
374
  if (this.agent.provider !== "codex" && !(await this.claudeUnchanged(env))) {
372
- this.probe = "none";
373
- fell(CLAUDE_CHANGED);
374
- return;
375
+ try {
376
+ await this.runProbe();
377
+ }
378
+ catch {
379
+ this.probe = "failed";
380
+ fell(CLAUDE_CHANGED);
381
+ return;
382
+ }
375
383
  }
376
384
  // Codex: the per-job fence checks come before any workspace is created.
377
385
  const codex = this.agent.provider === "codex"
@@ -22,6 +22,7 @@ import { readsWeb, taintsJob, touchesPrivate } from "./touch.js";
22
22
  const WHITESPACE = /\s+/gu;
23
23
  // Just inside the server's 15 minute ask lifetime and the hook's own timeout.
24
24
  export const HOLD_MS = 14 * 60_000;
25
+ const IMAGES_OFF = "The image tool is off for this request. Do not retry or work around it; say in one plain line that you could not make the picture.";
25
26
  /**
26
27
  * R5's marker: the model changed something in this workspace. It lasts as long
27
28
  * as the thread's workspace, not the job (#14875): the next job runs what this
@@ -203,7 +204,13 @@ export async function runHook(jobDir, raw, holdMs = HOLD_MS) {
203
204
  triggerId: context.triggerId,
204
205
  writeRoots: context.writeRoots,
205
206
  };
206
- verdict = classifyCall(call, policy);
207
+ // The launch turns the image tool on only for the owner's own ask on a
208
+ // proven Codex, and says so in the context; any other job (a teammate's
209
+ // ask) is refused the call even if Codex lists the tool anyway.
210
+ verdict =
211
+ tool === OWNER_IMAGE_HOOK_TOOL && !context.images
212
+ ? { allow: false, reason: IMAGES_OFF, tier: 0 }
213
+ : classifyCall(call, policy);
207
214
  const touches = touchesPrivate(call, policy, verdict.allow);
208
215
  const web = readsWeb(call, policy);
209
216
  const taints = web || taintsJob(call, policy, verdict.allow ? undefined : verdict.ask);
@@ -1,4 +1,5 @@
1
1
  import { basename } from "node:path";
2
+ import { isTalentOSContentUrl } from "../talentos-content.js";
2
3
  import { OWNER_IMAGE_HOOK_TOOL, referencedImages } from "./owner-pictures.js";
3
4
  import { canonical, isInside } from "./paths.js";
4
5
  import { applyPatchPaths, splitGit, } from "./policy.js";
@@ -176,27 +177,35 @@ function shellReadsWeb(source) {
176
177
  return parsed.commands.some(({ argv }) => {
177
178
  const program = basename(argv[0]?.text ?? "");
178
179
  // A script handed an address (`node scrape.js https://...`) reads it.
179
- return (WEB_PROGRAMS.has(program) || argv.some((word) => URL_WORD.test(word.text)));
180
+ return ((WEB_PROGRAMS.has(program) &&
181
+ (program === "gh" ||
182
+ !argv.some((word) => isTalentOSContentUrl(word.text)))) ||
183
+ argv.some((word) => URL_WORD.test(word.text) && !isTalentOSContentUrl(word.text)));
180
184
  });
181
185
  }
182
186
  /**
183
- * Did this call read the web or another room (CLI 1.4.18)? Narrower than
187
+ * Did this call read the external web (CLI 1.4.18)? Narrower than
184
188
  * `taintsJob`: a local MCP tool, a read outside the folder or an approved
185
189
  * script taints the job but is not this. Full access runs the owner's own
186
190
  * scripts until a job does this, and the "It read the web" card reads it. A
187
191
  * script that fetches without naming an address is not seen (James, 2026-11-04:
188
192
  * everything except a push and what follows a real web read).
189
193
  */
190
- export function readsWeb(call, context) {
194
+ export function readsWeb(call, _context) {
191
195
  const { tool } = call;
192
- if (tool === "WebSearch" || tool === "WebFetch") {
196
+ if (tool === "WebSearch") {
193
197
  return true;
194
198
  }
199
+ if (tool === "WebFetch") {
200
+ return !isTalentOSContentUrl(call.toolInput.url);
201
+ }
195
202
  if (tool.startsWith(ROOM_SERVER_PREFIX)) {
196
- return (readsOtherRoom(call, context.roomId) || readsOtherRoomFile(call, context));
203
+ // Room authorization belongs to the server. Its own files and attachments
204
+ // are company context, including ids absent from the initial packet.
205
+ return false;
197
206
  }
198
207
  if (tool.startsWith("mcp__")) {
199
- return WEB_TOOL_NAME.test(tool);
208
+ return (WEB_TOOL_NAME.test(tool) && !isTalentOSContentUrl(call.toolInput.url));
200
209
  }
201
210
  return (tool === "Bash" &&
202
211
  (fetchesOutside(call) || shellReadsWeb(text(call.toolInput.command))));
@@ -257,7 +257,7 @@ export async function serveAgent(config, directory, version, stop, verify, optio
257
257
  if (active && !active.answered && Date.now() >= active.deadline) {
258
258
  active.cancel.abort();
259
259
  }
260
- }, 1000);
260
+ }, options.lease?.watchMs ?? 1000);
261
261
  try {
262
262
  await verify?.();
263
263
  await heartbeat();
@@ -534,7 +534,9 @@ export async function serveAgent(config, directory, version, stop, verify, optio
534
534
  cancel.abort();
535
535
  }
536
536
  failService(error);
537
- await delay(2000, undefined, { signal }).catch(() => {
537
+ await delay(options.lease?.retryMs ?? 2000, undefined, {
538
+ signal,
539
+ }).catch(() => {
538
540
  /* Shutdown interrupts the timer. */
539
541
  });
540
542
  }
@@ -0,0 +1,33 @@
1
+ // Only first-party room/file routes: the marketing site and arbitrary URLs
2
+ // (including lookalike domains) remain external web input.
3
+ const APP_HOSTS = new Set(["app.talentos.so", "staging.talentos.so"]);
4
+ const ROOM_FILE_PATH = /^\/(?:app|admin)\/rooms\/[^/]+\/?$/u;
5
+ const ATTACHMENT_PATHS = new Set([
6
+ "/api/files/download",
7
+ "/api/agents/artifact-edit-draft",
8
+ "/api/rooms/attachments/download",
9
+ "/api/rooms/files/svg",
10
+ ]);
11
+ const VERSION_DOWNLOAD_PATH = /^\/api\/artifacts\/[^/]+\/versions\/[^/]+\/download-all$/u;
12
+ const PREVIEW_PATH = /^\/api\/artifacts\/preview\/[A-Za-z0-9_-]{43}$/u;
13
+ export function isTalentOSContentUrl(value) {
14
+ if (typeof value !== "string") {
15
+ return false;
16
+ }
17
+ try {
18
+ const url = new URL(value);
19
+ return (url.protocol === "https:" &&
20
+ !url.username &&
21
+ !url.password &&
22
+ !url.port &&
23
+ APP_HOSTS.has(url.hostname) &&
24
+ (PREVIEW_PATH.test(url.pathname) ||
25
+ ATTACHMENT_PATHS.has(url.pathname) ||
26
+ VERSION_DOWNLOAD_PATH.test(url.pathname) ||
27
+ (ROOM_FILE_PATH.test(url.pathname) &&
28
+ Boolean(url.searchParams.get("file")))));
29
+ }
30
+ catch {
31
+ return false;
32
+ }
33
+ }
package/dist/args.js CHANGED
@@ -19,6 +19,8 @@ const CLI_OPTIONS = {
19
19
  global: { type: "boolean" },
20
20
  apply: { type: "boolean" },
21
21
  "no-pull": { type: "boolean" },
22
+ oauth: { type: "boolean" },
23
+ quiet: { type: "boolean" },
22
24
  url: { type: "string" },
23
25
  yes: { type: "boolean" },
24
26
  agent: { type: "string" },
@@ -28,7 +30,14 @@ const CLI_OPTIONS = {
28
30
  surface: { type: "string" },
29
31
  };
30
32
  /** Groups whose first positional is a sub-command rather than an argument. */
31
- const ACTION_GROUPS = new Set(["agent", "mcp", "skills", "memory", "routines"]);
33
+ const ACTION_GROUPS = new Set([
34
+ "agent",
35
+ "mcp",
36
+ "skills",
37
+ "memory",
38
+ "routines",
39
+ "task",
40
+ ]);
32
41
  export function parseArgv(argv) {
33
42
  const { values, positionals } = parse(argv);
34
43
  const group = positionals[0];
@@ -0,0 +1,82 @@
1
+ import { cp, mkdir, readFile, rm, writeFile } from "node:fs/promises";
2
+ import { join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { claudeRun, mcpUrl } from "./install.js";
5
+ export const PLUGIN_ID = "talentos@talentos";
6
+ const MARKETPLACE = "talentos";
7
+ const MCP_FILE = join("plugins", "talentos", ".mcp.json");
8
+ const STEP_TIMEOUT_MS = 60_000;
9
+ /** The marketplace folder the npm package ships: `../plugin` from src and dist. */
10
+ export function pluginSourceDir() {
11
+ return fileURLToPath(new URL("../plugin/", import.meta.url));
12
+ }
13
+ /**
14
+ * Claude Code reads a directory marketplace in place, and an `npx` cache is
15
+ * temporary, so `init` keeps its own copy in a folder of its own.
16
+ */
17
+ export function stagedMarketplaceDir(home) {
18
+ return join(home, ".talentos", "claude-marketplace");
19
+ }
20
+ /**
21
+ * Copies the shipped marketplace to `dest`, with the plugin's server pointed at
22
+ * `mcpUrl`. The plugin holds no key: Claude Code signs the member in itself.
23
+ */
24
+ export async function stagePlugin(options) {
25
+ const source = options.source ?? pluginSourceDir();
26
+ await rm(options.dest, { force: true, recursive: true });
27
+ await mkdir(options.dest, { recursive: true, mode: 0o700 });
28
+ await cp(source, options.dest, { recursive: true });
29
+ const file = join(options.dest, MCP_FILE);
30
+ const config = JSON.parse(await readFile(file, "utf8"));
31
+ for (const server of Object.values(config.mcpServers)) {
32
+ server.url = options.mcpUrl;
33
+ }
34
+ await writeFile(file, `${JSON.stringify(config, null, 2)}\n`);
35
+ }
36
+ /**
37
+ * Installs the `talentos` Claude Code plugin at user scope: the remote server
38
+ * (OAuth), the SessionStart primer and the slash commands. `applied: false`
39
+ * means the caller should fall back to `claude mcp add`; nothing is thrown for
40
+ * a Claude Code that simply has no `plugin` command.
41
+ */
42
+ export async function installClaudePlugin(options) {
43
+ const run = options.run ?? claudeRun;
44
+ const probe = run(["plugin", "--help"], { timeout: STEP_TIMEOUT_MS });
45
+ if (probe.error !== undefined) {
46
+ return { applied: false, detail: "the `claude` command is not on PATH" };
47
+ }
48
+ if (probe.status !== 0) {
49
+ return {
50
+ applied: false,
51
+ detail: "this Claude Code has no `claude plugin` command (update it)",
52
+ };
53
+ }
54
+ const dest = stagedMarketplaceDir(options.home);
55
+ await stagePlugin({
56
+ dest,
57
+ mcpUrl: mcpUrl({ apiUrl: options.apiUrl }),
58
+ source: options.source,
59
+ });
60
+ const step = (args) => run(args, { timeout: STEP_TIMEOUT_MS });
61
+ const added = step(["plugin", "marketplace", "add", dest, "--scope", "user"]);
62
+ if (added.status !== 0) {
63
+ return failed("could not add the TalentOS plugin marketplace", added);
64
+ }
65
+ // A re-run replaced the copy in place; these pick the new files up. Both are
66
+ // best effort: a first install has nothing to update.
67
+ step(["plugin", "marketplace", "update", MARKETPLACE]);
68
+ const installed = step(["plugin", "install", PLUGIN_ID, "--scope", "user"]);
69
+ if (installed.status !== 0) {
70
+ return failed("could not install the TalentOS plugin", installed);
71
+ }
72
+ step(["plugin", "update", PLUGIN_ID, "--scope", "user"]);
73
+ step(["plugin", "enable", PLUGIN_ID, "--scope", "user"]);
74
+ // The plugin brings its own server; an entry `init` wrote earlier would show
75
+ // up twice. Absent is the common case, so a failure here is ignored.
76
+ step(["mcp", "remove", "--scope", "user", "talentos"]);
77
+ return { applied: true, detail: `Claude Code plugin ${PLUGIN_ID} (OAuth)` };
78
+ }
79
+ function failed(why, result) {
80
+ const line = (result.stderr || result.stdout || "").trim().split("\n")[0];
81
+ return { applied: false, detail: line ? `${why}: ${line}` : why };
82
+ }
package/dist/client.js CHANGED
@@ -27,25 +27,38 @@ export class AgentClient {
27
27
  this.credentials = credentials;
28
28
  this.retryDelaysMs = retryDelaysMs;
29
29
  }
30
- async call(name, args) {
30
+ async call(name, args, options) {
31
31
  const client = await this.connect();
32
- const result = (await withFriendlyErrors(() => client.callTool({ name, arguments: args })));
32
+ const result = (await withFriendlyErrors(() => client.callTool({ name, arguments: args }, undefined, options)));
33
33
  const text = firstText(result);
34
34
  if (result.isError) {
35
35
  throw new Error(text || `Tool ${name} failed.`);
36
36
  }
37
37
  return { text, data: result.structuredContent };
38
38
  }
39
- async listTools() {
39
+ async listTools(cursor) {
40
40
  return await this.whileServerIsAway(async () => {
41
41
  const client = await this.connect();
42
- return await withFriendlyErrors(() => client.listTools());
42
+ return await withFriendlyErrors(() => client.listTools(cursor ? { cursor } : undefined));
43
43
  });
44
44
  }
45
45
  async callTool(params) {
46
46
  const client = await this.connect();
47
47
  return (await withFriendlyErrors(() => client.callTool(params)));
48
48
  }
49
+ async fetchOriginal(path, signal) {
50
+ const origin = new URL(this.credentials.apiUrl);
51
+ const url = new URL(path, origin);
52
+ if (url.origin !== origin.origin ||
53
+ url.pathname !== "/agent/v1/files/original") {
54
+ throw new Error("The server returned an invalid original-file reference.");
55
+ }
56
+ return await fetch(url, {
57
+ headers: { Authorization: `Bearer ${this.credentials.apiKey}` },
58
+ redirect: "error",
59
+ signal,
60
+ });
61
+ }
49
62
  async close() {
50
63
  const client = this.client;
51
64
  this.client = undefined;