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
package/README.md CHANGED
@@ -17,9 +17,6 @@ same server over stdio for clients that cannot speak streamable HTTP.
17
17
  Every command below pins `talentos@1`, the major that speaks the hosted MCP endpoint.
18
18
  The `0.x` releases are the retired stdio wrapper and no longer work.
19
19
 
20
- Release 1.1.0 includes Rooms agent linking, the gateway, and the `create_deck`
21
- MCP permission. `talentos@1` picks it up automatically after publication.
22
-
23
20
  ```bash
24
21
  npx talentos@1 init
25
22
  ```
@@ -27,28 +24,89 @@ npx talentos@1 init
27
24
  `init` is the whole setup in one command. It:
28
25
 
29
26
  1. **Signs you in** — skipped when the key already on this machine still works.
30
- 2. **Detects your agents** — Claude Code (the `claude` command on your
31
- PATH, or `~/.claude`), Cursor (`~/.cursor` or `./.cursor`), Codex (`~/.codex`).
32
- `--for claude|cursor|codex|all` overrides detection.
27
+ 2. **Detects your agents**: Claude Code (the `claude` command on your PATH, or
28
+ `~/.claude`), Cursor (`~/.cursor` or `./.cursor`), Codex (`~/.codex`),
29
+ Gemini CLI (the `gemini` command on your PATH) and Antigravity CLI (the `agy`
30
+ command on your PATH, or `~/.gemini/antigravity-cli`).
31
+ `--for claude|cursor|codex|gemini|antigravity|all` overrides detection.
33
32
  3. **Writes the MCP config** for each of them, at user level (see the table below).
34
33
  4. **Pulls the company's skills** into `./.agents/skills` — the folder Cursor and
35
34
  Codex auto-load — plus `./.claude/skills` when Claude Code is here. `--no-pull`
36
35
  skips this.
37
36
 
38
- Then ask your agent to call the `talentos` `whoami` tool. Re-running `init` is
37
+ Then restart or reload the agent so it loads the new tools (Claude Code: a new
38
+ session, or `/mcp`; Cursor: reload and enable `talentos` in MCP settings; Codex:
39
+ restart), and ask it to call the `talentos` `whoami` tool. Other agents (OpenCode,
40
+ Claude Desktop) are set up by hand; `talentos mcp install json`
41
+ prints the snippet. Re-running `init` is
39
42
  safe: the config entry is replaced (so a new key takes effect) and skills are
40
43
  overwritten by slug.
41
44
 
42
45
  | agent | what `init` writes |
43
46
  | --- | --- |
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) |
47
+ | 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 |
48
+ | Cursor | `~/.cursor/mcp.json` → `mcpServers.talentos` (other servers kept, mode 0600). Same with `--oauth`: Cursor keeps the key for now |
49
+ | Codex | `~/.codex/config.toml` → `[mcp_servers.talentos]`, the stdio proxy carrying `TALENTOS_API_KEY` and `TALENTOS_API_URL` (mode 0600). With `--oauth`: `url = ...` only |
50
+ | Gemini CLI | `~/.gemini/settings.json` → `mcpServers.talentos` (other servers and settings kept, mode 0600). With `--oauth`: no key; run `/mcp auth talentos` in Gemini |
51
+ | Antigravity CLI | `~/.gemini/config/mcp_config.json` → `mcpServers.talentos`. With `--oauth`: no key; open `/mcp` and authenticate |
47
52
 
48
- **Nothing is written inside the repo except pulled skills.** Your API key lives in
53
+ **Nothing is written inside the repo except pulled skills** (and the `.talentos-sync.json` that tracks them). Your API key lives in
49
54
  `~/.config/talentos/config.json` and in those user-level agent configs, never in
50
55
  a file your team could check in.
51
56
 
57
+ ## Browser sign-in: `init --oauth`
58
+
59
+ ```bash
60
+ npx talentos@1 init --oauth
61
+ ```
62
+
63
+ `--oauth` (or `HEADLESS_SETUP_V1=true`) sets Claude Code and Codex up without a
64
+ key in their config; you sign in once in the browser. It is opt-in until the server
65
+ 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.
66
+
67
+ - **Claude Code** gets the `talentos` plugin: the remote server, a SessionStart
68
+ primer (who you are, your Talent, how to use TalentOS, inside 2 s and silent
69
+ offline) and three slash commands: `/talentos:catch-up`, `/talentos:remember`
70
+ and `/talentos:ask-talent` (hand work to your Talent only when you say so).
71
+ `init` copies the plugin to `~/.talentos/claude-marketplace`, runs `claude
72
+ plugin marketplace add` and `claude plugin install talentos@talentos`, and
73
+ falls back to `claude mcp add` when your Claude Code has no plugin command.
74
+ Then run `/mcp`, pick talentos and choose Authenticate.
75
+ - **Cursor** keeps the key entry in `~/.cursor/mcp.json` for now: the server has
76
+ no sign-in for it yet, and `doctor` says so.
77
+ - **Codex** gets `url = ...` in `~/.codex/config.toml`; run
78
+ `codex mcp login talentos`.
79
+
80
+ The plugin's live primer line needs the key `init` stored (a hook cannot use
81
+ Claude Code's browser sign-in); without a key it prints a static primer.
82
+
83
+ ## Check your setup
84
+
85
+ ```bash
86
+ npx talentos@1 doctor
87
+ ```
88
+
89
+ Says in plain words whether TalentOS answers with the key on this machine and
90
+ whether Claude Code, Cursor and Codex are set up, with one fix under each
91
+ problem. It changes nothing, never prints a key, and exits 1 when something
92
+ needs a fix.
93
+
94
+ ## Keep skills in sync
95
+
96
+ ```bash
97
+ npx talentos@1 skills sync [--for claude|cursor|codex|all] [--global]
98
+ ```
99
+
100
+ Only skills TalentOS changed are fetched and rewritten. It never overwrites
101
+ your work (it tracks what it wrote, including what `init` and `skills pull`
102
+ wrote, in `.talentos-sync.json`): a skill you edited (or deleted) stays as it is,
103
+ and is reported, once TalentOS has a newer version; a folder it did not write is left alone
104
+ unless every file already matches; files you added and skills TalentOS no
105
+ longer lists are never deleted. `skills pull` is the explicit overwrite. To sync
106
+ at the start of every Claude Code session, set `TALENTOS_SKILLS_SYNC=1` in
107
+ Claude Code's `env` setting: company skills go to `~/.claude/skills`, at most
108
+ once per six hours, in the background.
109
+
52
110
  ## Login on its own
53
111
 
54
112
  ```bash
@@ -76,8 +134,30 @@ before it is sent, and stored only once TalentOS accepts it.
76
134
  | `claude` | a `claude mcp add --scope user --transport http` command |
77
135
  | `cursor` | the `~/.cursor/mcp.json` entry |
78
136
  | `codex` | the `~/.codex/config.toml` entry (stdio, via `npx -y talentos@1 mcp`, with the API url in its env) |
137
+ | `gemini` | the `~/.gemini/settings.json` entry (`httpUrl`) |
138
+ | `antigravity` | the `~/.gemini/config/mcp_config.json` entry (`serverUrl`) |
79
139
  | `json` | a generic `mcpServers` entry (print only) |
80
140
 
141
+ ## MCP tools and machine output
142
+
143
+ Enable `HEADLESS_CLI_V1=true` in the CLI process to try its contract:
144
+
145
+ ```sh
146
+ talentos tools --json
147
+ talentos call whoami --json '{}'
148
+ talentos task status '<taskId>' --json
149
+ talentos task watch '<taskId>' --json
150
+ talentos approvals watch --json
151
+ talentos doctor --json
152
+ ```
153
+
154
+ The [CLI contract](../../docs/features/agent-access/README.md#cli-output-and-task-continuation)
155
+ defines output, error results, task continuation and human approval boundaries.
156
+
157
+ `talentos approvals [list|status|watch] [id]` reads `approval_status` (server flag
158
+ `HEADLESS_APPROVAL_STATUS_V1`) and prints the TalentOS link where the member
159
+ decides. It has no allow or deny, by design ([ADR 0120](../../docs/adr/0120-a-member-decides-their-ais-approvals-from-a-signed-in-link-and-the-ai-only-watches.md)).
160
+
81
161
  ## Commands
82
162
 
83
163
  ### Agents in Rooms
@@ -91,8 +171,9 @@ and left untouched. A room-only job (a teammate's ask, a not-ready owner job,
91
171
  every Codex job) runs in its own empty folder and does not load your CLAUDE.md,
92
172
  rules, hooks, memory or Codex AGENTS.md and skills (not even their names); only
93
173
  your provider login is used. Final text posts automatically.
94
- The service heartbeats every 20 seconds and stops the child if its lease is
95
- lost. A required CLI update installs under the agent directory between turns.
174
+ Idle, the service heartbeats as often as the server asks (every 45 seconds; 20
175
+ against a server that names no interval). A running job renews its lease every
176
+ 20 seconds, or 10 for an owner job, and the child stops if the lease is lost. A required CLI update installs under the agent directory between turns.
96
177
  Signing-key provisioning and real staging latency proofs are
97
178
  tracked in [Agent access](../../docs/features/agent-access/README.md).
98
179
 
@@ -115,7 +196,8 @@ private pending receipt if a response is lost; it permits recovery after the
115
196
  one-use link has been consumed.
116
197
 
117
198
  ```
118
- talentos init [--for claude|cursor|codex|all] [--no-pull] [--name <device>]
199
+ talentos init [--for claude|cursor|codex|all] [--no-pull] [--oauth] [--name <device>]
200
+ talentos doctor [--json] [--api-url <url>]
119
201
 
120
202
  talentos login [--key <key>] [--api-url <url>] [--name <device>]
121
203
  talentos logout
@@ -128,6 +210,7 @@ talentos skills list [--mine|--company] [-q <query>]
128
210
  talentos skills get <id|slug> [--out <dir>] # prints SKILL.md, or writes the package
129
211
  talentos skills push <SKILL.md|dir> [--id <skillId>]
130
212
  talentos skills pull [--for claude|cursor|codex|all] [--global] [--to <dir>] [--mine|--company]
213
+ talentos skills sync [--for claude|cursor|codex|all] [--global] [--to <dir>] [--mine|--company] [--quiet]
131
214
  talentos skills share <id> # refuses: Share this Skill from TalentOS.
132
215
 
133
216
  talentos memory search "<query>" [--personal|--company]
@@ -136,8 +219,21 @@ talentos memory add "<fact>" [--company]
136
219
  talentos ask "<message>" [--thread <id>] [--no-wait]
137
220
  talentos routines list
138
221
  talentos routines run <id>
222
+
223
+ talentos publish [folder|page.html] [--title <title>] [--replace]
139
224
  ```
140
225
 
226
+ `publish` saves a web page to your TalentOS Library and prints its link. Only you
227
+ can open it until you share it. It reads the folder's `index.html` (or the one
228
+ `.html` file you name) and puts the page's own styles, scripts, images and fonts
229
+ inside it. It hosts one page per site and loads nothing from other websites.
230
+ Publishing the same page again updates the same app, and TalentOS keeps every
231
+ version. If someone changed the app in TalentOS since, nothing is replaced
232
+ unless you add `--replace`. The CLI remembers which app each page went to in
233
+ `published.json` beside its config.
234
+ `init` also installs a **Host on TalentOS** skill for this where your workspace
235
+ has hosting on. With that skill, telling your agent "host it" is enough.
236
+
141
237
  `skills pull` writes to `./.agents/skills` by default. `--for claude` writes to
142
238
  `./.claude/skills`, `--for all` writes both, and `--global` puts the same folders
143
239
  under your home directory; an explicit `--to` wins over all of them.
@@ -149,8 +245,11 @@ slug both land: the second goes to `<slug>-<last 6 of its id>`.
149
245
  After `skills push`, `skills get`, `ask` and `routines run`, the last line is
150
246
  `Open: <url>` — the deep link to that skill or thread in TalentOS.
151
247
 
152
- Every command takes `--json` to print the raw structured result instead of text.
153
- `talentos --help` and `talentos <group> --help` print usage.
248
+ See [MCP tools and machine output](#mcp-tools-and-machine-output) for automation and task continuation.
249
+
250
+ `talentos --help` lists every command, including `tools`, `call`, `task`,
251
+ `approvals` and the `agent` subcommands the block above leaves out;
252
+ `talentos <group> --help` prints usage.
154
253
 
155
254
  A skill package is a `SKILL.md` (YAML frontmatter with `name` and `description`,
156
255
  body = the instructions) plus any supporting files next to it. `push` accepts the
@@ -163,7 +262,11 @@ file or the folder that contains it; a folder is walked recursively, skipping
163
262
  | --- | --- |
164
263
  | `~/.config/talentos/config.json` | `{ apiUrl, apiKey }`, mode 0600 (honours `XDG_CONFIG_HOME`) |
165
264
  | `TALENTOS_API_KEY` | overrides the stored key |
265
+ | `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
266
  | `TALENTOS_API_URL` | overrides the stored API url (default `https://woozy-oyster-769.convex.site`) |
267
+ | `HEADLESS_CLI_V1` | exact `true` turns on the `--json` envelope, `tools`/`call`, `task status|watch` and `approvals` |
268
+ | `HEADLESS_SETUP_V1` | `true` or `1` makes `init` use the browser sign-in setup, like `--oauth` |
269
+ | `TALENTOS_SKILLS_SYNC` | `1` lets the Claude Code plugin sync skills when a session starts |
167
270
  | `--api-url` | overrides both, for one command |
168
271
 
169
272
  ## Exit codes
@@ -171,4 +274,4 @@ file or the folder that contains it; a folder is walked recursively, skipping
171
274
  | code | meaning |
172
275
  | --- | --- |
173
276
  | 0 | success |
174
- | 1 | any failure — one line on stderr, nothing on stdout |
277
+ | 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 {};
@@ -1,7 +1,62 @@
1
+ // Private member-session tools are offered by the session MCP server, never by a room-job adapter.
2
+ export const MEMBER_SESSION_TOOLS = [
3
+ "list_notifications",
4
+ "mark_notification_read",
5
+ "dismiss_my_retained_draft",
6
+ "get_my_settings",
7
+ "list_agent_memory",
8
+ "list_my_chats",
9
+ "list_my_today",
10
+ "pin_my_chat",
11
+ "read_my_chat",
12
+ "read_my_retained_draft",
13
+ "remove_agent_memory",
14
+ "restore_my_chat",
15
+ "set_today_done",
16
+ "update_my_profile",
17
+ "update_my_settings",
18
+ "save_file_to_library",
19
+ "memory_add_file",
20
+ "list_my_files",
21
+ "file_versions",
22
+ "manage_file",
23
+ "organize_files",
24
+ "change_my_message",
25
+ "change_room_fact",
26
+ "list_room_decisions",
27
+ "read_meeting",
28
+ "set_room_view",
29
+ "update_meeting_notes",
30
+ "list_room_context",
31
+ "room_context",
32
+ ];
1
33
  // Served by our LOCAL stdio proxy in an owner-native Codex job, not by the
2
34
  // server: the shell fence (#10987). The proxy classifies the command.
3
35
  export const ROOM_LOCAL_TOOLS = ["run_command"];
4
36
  export const ROOM_TOOLS = [
37
+ "artifact_audience_set",
38
+ "room_share",
39
+ "room_unshare",
40
+ "publish_link",
41
+ "unpublish_link",
42
+ "artifact_marketplace_publish",
43
+ "artifact_marketplace_unpublish",
44
+ "skill_audience_set",
45
+ "routine_audience_set",
46
+ "skill_room_share",
47
+ "skill_room_unshare",
48
+ "routine_room_share",
49
+ "routine_room_unshare",
50
+ "skill_marketplace_publish",
51
+ "skill_marketplace_unpublish",
52
+ "routine_marketplace_publish",
53
+ "routine_marketplace_unpublish",
54
+ "recall",
55
+ "update_memory",
56
+ "forget",
57
+ "save_progress",
58
+ "resume",
59
+ "import_memories",
5
60
  "add_todo",
6
61
  "list_rooms",
7
62
  "list_threads",
@@ -17,9 +72,14 @@ export const ROOM_TOOLS = [
17
72
  "read_web_page",
18
73
  "read_app_state",
19
74
  "write_app_state",
75
+ "read_app_activity",
20
76
  "get_skill",
21
77
  "list_skills",
22
78
  "search_memory",
79
+ "memory_outline",
80
+ "memory_read",
81
+ "memory_facts",
82
+ "memory_edit_section",
23
83
  "list_connections",
24
84
  "use_connection",
25
85
  "change_connection",
@@ -28,16 +88,21 @@ export const ROOM_TOOLS = [
28
88
  "get_thread",
29
89
  "list_routines",
30
90
  "run_routine",
91
+ "update_routine",
31
92
  "remember",
32
93
  "save_skill",
33
94
  "suggest_change",
95
+ "edit_sheet_cells",
96
+ "get_sheet_edit",
34
97
  "patch_live_page",
35
98
  "create_file",
36
99
  "create_deck",
37
100
  "create_spreadsheet",
38
101
  "create_web_app",
39
102
  "export_file",
103
+ "export_web_app",
40
104
  "revise_web_app",
105
+ "share_file_to_room",
41
106
  "upload_file",
42
107
  "prepare_upload",
43
108
  "commit_upload",
@@ -45,15 +110,21 @@ export const ROOM_TOOLS = [
45
110
  "ask_owner",
46
111
  "delete_own_message",
47
112
  "edit_own_message",
113
+ "set_file_pinned",
114
+ "forward_message",
48
115
  "react_to_message",
49
116
  "post_to_thread",
50
117
  "reply_to_comment",
51
118
  "start_thread",
52
119
  "rename_thread",
53
120
  "share_link",
121
+ "find_people",
122
+ "message_person",
123
+ "person_replies",
54
124
  "room_default_set",
55
125
  "room_default_remove",
56
126
  "whoami",
127
+ "onboarding_dismiss",
57
128
  ];
58
129
  // The upload tools run in the talentos CLI's stdio proxy (mcp-proxy.ts), which
59
130
  // reads the file from the job's folder and streams it to storage; the server's
@@ -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";
@@ -51,11 +52,12 @@ function readsOtherRoom(call, jobRoomId) {
51
52
  const aimed = call.toolInput.roomId;
52
53
  return aimed !== undefined && aimed !== jobRoomId;
53
54
  }
54
- // read_file and read_app_state name no room, so the id has to: only a file id
55
+ // read_file, read_app_state and read_app_activity name no room, so the id has
56
+ // to: only a file id
55
57
  // the packet listed for the job's room, or an attachment of the message that
56
58
  // started the job (the owner's own words), stays inside it (#13471). A read by
57
59
  // versionId or another messageId, or a job with no list, fails closed.
58
- const BY_ID_TOOLS = new Set(["read_file", "read_app_state"].map((name) => ROOM_SERVER_PREFIX + name));
60
+ const BY_ID_TOOLS = new Set(["read_file", "read_app_state", "read_app_activity"].map((name) => ROOM_SERVER_PREFIX + name));
59
61
  function readsOtherRoomFile(call, context) {
60
62
  if (!BY_ID_TOOLS.has(call.tool)) {
61
63
  return false;
@@ -176,27 +178,35 @@ function shellReadsWeb(source) {
176
178
  return parsed.commands.some(({ argv }) => {
177
179
  const program = basename(argv[0]?.text ?? "");
178
180
  // 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)));
181
+ return ((WEB_PROGRAMS.has(program) &&
182
+ (program === "gh" ||
183
+ !argv.some((word) => isTalentOSContentUrl(word.text)))) ||
184
+ argv.some((word) => URL_WORD.test(word.text) && !isTalentOSContentUrl(word.text)));
180
185
  });
181
186
  }
182
187
  /**
183
- * Did this call read the web or another room (CLI 1.4.18)? Narrower than
188
+ * Did this call read the external web (CLI 1.4.18)? Narrower than
184
189
  * `taintsJob`: a local MCP tool, a read outside the folder or an approved
185
190
  * script taints the job but is not this. Full access runs the owner's own
186
191
  * scripts until a job does this, and the "It read the web" card reads it. A
187
192
  * script that fetches without naming an address is not seen (James, 2026-11-04:
188
193
  * everything except a push and what follows a real web read).
189
194
  */
190
- export function readsWeb(call, context) {
195
+ export function readsWeb(call, _context) {
191
196
  const { tool } = call;
192
- if (tool === "WebSearch" || tool === "WebFetch") {
197
+ if (tool === "WebSearch") {
193
198
  return true;
194
199
  }
200
+ if (tool === "WebFetch") {
201
+ return !isTalentOSContentUrl(call.toolInput.url);
202
+ }
195
203
  if (tool.startsWith(ROOM_SERVER_PREFIX)) {
196
- return (readsOtherRoom(call, context.roomId) || readsOtherRoomFile(call, context));
204
+ // Room authorization belongs to the server. Its own files and attachments
205
+ // are company context, including ids absent from the initial packet.
206
+ return false;
197
207
  }
198
208
  if (tool.startsWith("mcp__")) {
199
- return WEB_TOOL_NAME.test(tool);
209
+ return (WEB_TOOL_NAME.test(tool) && !isTalentOSContentUrl(call.toolInput.url));
200
210
  }
201
211
  return (tool === "Bash" &&
202
212
  (fetchesOutside(call) || shellReadsWeb(text(call.toolInput.command))));
@@ -55,10 +55,17 @@ export class ProviderFailureError extends Error {
55
55
  this.reason = reason;
56
56
  }
57
57
  }
58
- /** The reason to send for a job that threw; absent keeps the generic failure. */
58
+ /**
59
+ * The reason to send for a job that threw. Any other thrown error (an output
60
+ * over its limit, a broken stream) is a crash: an absent reason made the room
61
+ * guess at a sign-in or usage limit that was fine (#16148).
62
+ */
59
63
  export function failureReasonOf(error) {
60
64
  if (error instanceof ProviderFailureError) {
61
65
  return error.reason;
62
66
  }
63
- return error instanceof ProviderBinaryError ? "missing_binary" : undefined;
67
+ if (error instanceof ProviderBinaryError) {
68
+ return "missing_binary";
69
+ }
70
+ return error instanceof Error ? "crashed" : undefined;
64
71
  }
@@ -21,6 +21,9 @@ import { failureReasonOf } from "./provider-failure.js";
21
21
  import { ProviderLoginWatch, probeProviderLogin } from "./provider-login.js";
22
22
  import { sweepRoomJobs } from "./room-profile.js";
23
23
  const HEARTBEAT_MS = 20_000;
24
+ // With push on, a claim on a timer is only a backstop: push wakes the loop for
25
+ // a new job, and so does a heartbeat that reports one waiting (#15948).
26
+ const PUSH_CLAIM_MS = 5 * 60_000;
24
27
  // A native job holds a 30 s server lease and is re-derived on every renewal.
25
28
  const NATIVE_RENEW_MS = 10_000;
26
29
  // A launch waits this long for the server before it starts the provider anyway.
@@ -105,6 +108,15 @@ export async function serveAgent(config, directory, version, stop, verify, optio
105
108
  wakeResolve?.();
106
109
  };
107
110
  let active;
111
+ // Idle, the server names the beat on each reply (an older one names none);
112
+ // a job's lease renewals keep their own.
113
+ const defaultIdleBeatMs = options.lease?.beatMs ?? HEARTBEAT_MS;
114
+ let idleBeatMs = defaultIdleBeatMs;
115
+ // A claim that met a server away (a deploy) is retried at the poll pace.
116
+ let claimFailed = false;
117
+ // Aborted by a claim, so the job's renewals start without waiting out an
118
+ // idle beat.
119
+ let idleWait = new AbortController();
108
120
  let minimum = version,
109
121
  // The Node range of an update this computer declined, reported until the
110
122
  // update is no longer blocked.
@@ -153,6 +165,10 @@ export async function serveAgent(config, directory, version, stop, verify, optio
153
165
  }, signal);
154
166
  if (response) {
155
167
  minimum = response.cliMinVersion;
168
+ idleBeatMs =
169
+ typeof response.heartbeatMs === "number"
170
+ ? Math.max(HEARTBEAT_MS, response.heartbeatMs)
171
+ : defaultIdleBeatMs;
156
172
  // The server's exact list of Codex versions allowed full setup; the
157
173
  // background probe waits for it.
158
174
  gate.setCodexTested?.(response.codexFenceTested);
@@ -174,7 +190,10 @@ export async function serveAgent(config, directory, version, stop, verify, optio
174
190
  post: (path, body) => gateway.request(path, body, signal),
175
191
  })
176
192
  : undefined;
177
- const beat = (native) => options.lease?.beatMs ?? (native ? NATIVE_RENEW_MS : HEARTBEAT_MS);
193
+ const beat = (job) => job
194
+ ? (options.lease?.beatMs ??
195
+ (job.native ? NATIVE_RENEW_MS : HEARTBEAT_MS))
196
+ : idleBeatMs;
178
197
  const holdFor = (native) => options.lease?.holdMs ?? holdMs(native);
179
198
  let failedRenewals = 0;
180
199
  // The server is away: a 5xx or no answer at all, as during a Convex push.
@@ -244,9 +263,10 @@ export async function serveAgent(config, directory, version, stop, verify, optio
244
263
  if (active?.job.native && active.owner && !gate.optedIn()) {
245
264
  active.cancel.abort();
246
265
  }
247
- await delay(Math.max(1, renewDelayMs(beat(Boolean(active?.job.native)), failedRenewals) -
248
- (Date.now() - started)), undefined, { signal }).catch(() => {
249
- /* Shutdown interrupts the timer. */
266
+ idleWait = new AbortController();
267
+ await delay(Math.max(1, renewDelayMs(beat(active?.job), failedRenewals) -
268
+ (Date.now() - started)), undefined, { signal: AbortSignal.any([signal, idleWait.signal]) }).catch(() => {
269
+ /* Shutdown or a claim interrupts the timer. */
250
270
  });
251
271
  }
252
272
  };
@@ -351,9 +371,11 @@ export async function serveAgent(config, directory, version, stop, verify, optio
351
371
  const claimStartedAt = Date.now();
352
372
  try {
353
373
  job = await gateway.request("/agent-gateway/claim", { cliVersion: version, deviceId }, signal);
374
+ claimFailed = false;
354
375
  }
355
376
  catch (error) {
356
377
  failService(error);
378
+ claimFailed = serverAway(error);
357
379
  job = null;
358
380
  }
359
381
  if (job) {
@@ -367,6 +389,7 @@ export async function serveAgent(config, directory, version, stop, verify, optio
367
389
  answered: false,
368
390
  };
369
391
  active = current;
392
+ idleWait.abort();
370
393
  let lastStatusAt = 0;
371
394
  // Until then, room progress lines wait so the room-only reason is read.
372
395
  let reasonUntil = 0;
@@ -574,7 +597,7 @@ export async function serveAgent(config, directory, version, stop, verify, optio
574
597
  continue;
575
598
  }
576
599
  await new Promise((resolve) => {
577
- const timer = setTimeout(finish, push ? HEARTBEAT_MS : claimPollInterval(lastJobAt));
600
+ const timer = setTimeout(finish, push && !claimFailed ? PUSH_CLAIM_MS : claimPollInterval(lastJobAt));
578
601
  function finish() {
579
602
  clearTimeout(timer);
580
603
  signal.removeEventListener("abort", finish);
@@ -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
+ }
@@ -1,10 +1,37 @@
1
1
  const INVALID_LINK = "Get a new setup prompt from TalentOS and pass its complete URL with --url.";
2
- const SETUP_PATH = /^\/agent-setup\/(claude_code|codex|gemini_cli|hermes_agent)\/?$/;
2
+ const SETUP_PATH = /^\/agent-setup\/(any|claude_code|codex|gemini_cli|hermes_agent)\/?$/;
3
+ // The CLIs a universal link (/agent-setup/any) can connect: the ones the
4
+ // server seats in rooms.
5
+ const UNIVERSAL_PROVIDERS = ["claude_code", "codex", "gemini_cli"];
6
+ const NAME_YOUR_CLI = "This link works for any agent: add --provider claude_code, codex or gemini_cli for the CLI you are.";
3
7
  const FRAGMENT_TOKEN = /((?:#|%23)token(?:=|%3d))[^\s"'<>]+/giu;
4
8
  const RAW_KEY = /\btos_[a-z\d_-]+/giu;
5
9
  const BEARER = /\bBearer\s+\S+/giu;
6
10
  const TOKEN_WHITESPACE = /\s/u;
7
- export function parseAgentLink(value) {
11
+ /**
12
+ * The setup link and the provider it connects. A per-agent link names its
13
+ * provider in its path, and `named` (from --provider) must match it. A
14
+ * universal link (`/agent-setup/any`) names none, so `named` is required and
15
+ * must be one of the CLIs the server seats; TalentOS still checks that CLI on
16
+ * this computer before it connects.
17
+ */
18
+ export function parseAgentLink(value, named) {
19
+ const link = parseSetupUrl(value);
20
+ if (link.provider === "any") {
21
+ if (!isUniversalProvider(named)) {
22
+ throw new Error(NAME_YOUR_CLI);
23
+ }
24
+ return { ...link, provider: named };
25
+ }
26
+ if (named !== undefined && named !== link.provider) {
27
+ throw new Error(`This link is for ${link.provider}. Drop --provider, or ask for a new prompt from TalentOS.`);
28
+ }
29
+ return { ...link, provider: link.provider };
30
+ }
31
+ function isUniversalProvider(value) {
32
+ return UNIVERSAL_PROVIDERS.includes(value);
33
+ }
34
+ function parseSetupUrl(value) {
8
35
  try {
9
36
  const url = new URL(value);
10
37
  const provider = SETUP_PATH.exec(url.pathname)?.[1];
@@ -12,7 +39,8 @@ export function parseAgentLink(value) {
12
39
  const tokens = fragment.getAll("token");
13
40
  const token = tokens[0];
14
41
  if (!(isSecureUrl(url) &&
15
- (provider === "claude_code" ||
42
+ (provider === "any" ||
43
+ provider === "claude_code" ||
16
44
  provider === "codex" ||
17
45
  provider === "gemini_cli" ||
18
46
  provider === "hermes_agent") &&