talentos 1.5.0 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -13
- package/dist/agent/adapters.js +8 -0
- package/dist/agent/codex-policy.js +93 -0
- package/dist/agent/gemini-room.js +6 -0
- package/dist/agent/hermes-room.js +6 -0
- package/dist/agent/model-report.js +68 -0
- package/dist/agent/native/touch.js +3 -2
- package/dist/agent/provider-failure.js +9 -2
- package/dist/agent/serve.js +34 -5
- package/dist/agent-link.js +31 -3
- package/dist/args.js +4 -0
- package/dist/client.js +4 -0
- package/dist/commands/agent.js +1 -1
- package/dist/commands/approvals.js +145 -0
- package/dist/commands/doctor.js +56 -0
- package/dist/commands/init.js +19 -1
- package/dist/commands/mcp.js +1 -1
- package/dist/commands/publish.js +74 -0
- package/dist/hosting-skill.js +67 -0
- package/dist/index.js +29 -6
- package/dist/install.js +71 -2
- package/dist/publish-site.js +291 -0
- package/dist/published-pages.js +30 -0
- package/dist/setup.generated.js +101 -47
- package/dist/skill-files.js +5 -3
- package/dist/upload-file.js +1 -1
- package/package.json +1 -1
- package/plugin/plugins/talentos/.claude-plugin/plugin.json +1 -1
- package/plugin/plugins/talentos/commands/ask-talent.md +3 -2
- package/plugin/plugins/talentos/scripts/session-start.mjs +11 -1
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,15 +24,21 @@ 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
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
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
|
|
|
@@ -44,6 +47,8 @@ overwritten by slug.
|
|
|
44
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 |
|
|
45
48
|
| Cursor | `~/.cursor/mcp.json` → `mcpServers.talentos` (other servers kept, mode 0600). Same with `--oauth`: Cursor keeps the key for now |
|
|
46
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
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
|
|
@@ -129,24 +134,30 @@ before it is sent, and stored only once TalentOS accepts it.
|
|
|
129
134
|
| `claude` | a `claude mcp add --scope user --transport http` command |
|
|
130
135
|
| `cursor` | the `~/.cursor/mcp.json` entry |
|
|
131
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`) |
|
|
132
139
|
| `json` | a generic `mcpServers` entry (print only) |
|
|
133
140
|
|
|
134
141
|
## MCP tools and machine output
|
|
135
142
|
|
|
136
|
-
|
|
137
|
-
`HEADLESS_CLI_V1=true` in the CLI process to try its contract:
|
|
143
|
+
Enable `HEADLESS_CLI_V1=true` in the CLI process to try its contract:
|
|
138
144
|
|
|
139
145
|
```sh
|
|
140
146
|
talentos tools --json
|
|
141
147
|
talentos call whoami --json '{}'
|
|
142
148
|
talentos task status '<taskId>' --json
|
|
143
149
|
talentos task watch '<taskId>' --json
|
|
150
|
+
talentos approvals watch --json
|
|
144
151
|
talentos doctor --json
|
|
145
152
|
```
|
|
146
153
|
|
|
147
154
|
The [CLI contract](../../docs/features/agent-access/README.md#cli-output-and-task-continuation)
|
|
148
155
|
defines output, error results, task continuation and human approval boundaries.
|
|
149
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
|
+
|
|
150
161
|
## Commands
|
|
151
162
|
|
|
152
163
|
### Agents in Rooms
|
|
@@ -160,8 +171,9 @@ and left untouched. A room-only job (a teammate's ask, a not-ready owner job,
|
|
|
160
171
|
every Codex job) runs in its own empty folder and does not load your CLAUDE.md,
|
|
161
172
|
rules, hooks, memory or Codex AGENTS.md and skills (not even their names); only
|
|
162
173
|
your provider login is used. Final text posts automatically.
|
|
163
|
-
|
|
164
|
-
|
|
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.
|
|
165
177
|
Signing-key provisioning and real staging latency proofs are
|
|
166
178
|
tracked in [Agent access](../../docs/features/agent-access/README.md).
|
|
167
179
|
|
|
@@ -207,8 +219,21 @@ talentos memory add "<fact>" [--company]
|
|
|
207
219
|
talentos ask "<message>" [--thread <id>] [--no-wait]
|
|
208
220
|
talentos routines list
|
|
209
221
|
talentos routines run <id>
|
|
222
|
+
|
|
223
|
+
talentos publish [folder|page.html] [--title <title>] [--replace]
|
|
210
224
|
```
|
|
211
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
|
+
|
|
212
237
|
`skills pull` writes to `./.agents/skills` by default. `--for claude` writes to
|
|
213
238
|
`./.claude/skills`, `--for all` writes both, and `--global` puts the same folders
|
|
214
239
|
under your home directory; an explicit `--to` wins over all of them.
|
|
@@ -222,12 +247,14 @@ After `skills push`, `skills get`, `ask` and `routines run`, the last line is
|
|
|
222
247
|
|
|
223
248
|
See [MCP tools and machine output](#mcp-tools-and-machine-output) for automation and task continuation.
|
|
224
249
|
|
|
225
|
-
`talentos --help`
|
|
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.
|
|
226
253
|
|
|
227
254
|
A skill package is a `SKILL.md` (YAML frontmatter with `name` and `description`,
|
|
228
255
|
body = the instructions) plus any supporting files next to it. `push` accepts the
|
|
229
256
|
file or the folder that contains it; a folder is walked recursively, skipping
|
|
230
|
-
`node_modules` and `.git`, capped at
|
|
257
|
+
`node_modules` and `.git`, capped at 1,000 text files and 4 MiB (what the server accepts).
|
|
231
258
|
|
|
232
259
|
## Config and environment
|
|
233
260
|
|
|
@@ -237,6 +264,7 @@ file or the folder that contains it; a folder is walked recursively, skipping
|
|
|
237
264
|
| `TALENTOS_API_KEY` | overrides the stored key |
|
|
238
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. |
|
|
239
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` |
|
|
240
268
|
| `HEADLESS_SETUP_V1` | `true` or `1` makes `init` use the browser sign-in setup, like `--oauth` |
|
|
241
269
|
| `TALENTOS_SKILLS_SYNC` | `1` lets the Claude Code plugin sync skills when a session starts |
|
|
242
270
|
| `--api-url` | overrides both, for one command |
|
package/dist/agent/adapters.js
CHANGED
|
@@ -12,6 +12,7 @@ import { providerPathEnv, resolveProviderBinary } from "../provider-binary.js";
|
|
|
12
12
|
import { codexImagesProven, probeCodexImages } from "./codex-image-probe.js";
|
|
13
13
|
import { codexRoomArgs, ROOM_DIRECT_TOOLS, ROOM_PROXY_ONLY_TOOLS, } from "./codex-policy.js";
|
|
14
14
|
import { binaryIdentity, CodexBoundaryError, CodexProbeInterrupted, codexWebProven, probeCodexBoundary, } from "./codex-probe.js";
|
|
15
|
+
import { modelReporter, reportableModel } from "./model-report.js";
|
|
15
16
|
import { prepareCodexOwnerLaunch } from "./native/codex-launch.js";
|
|
16
17
|
import { prepareOwnerLaunch } from "./native/launch.js";
|
|
17
18
|
import { readReceipts, readWorkspaceResultReceipts, } from "./native/receipts.js";
|
|
@@ -370,6 +371,11 @@ export function readProviderEvent(provider, value) {
|
|
|
370
371
|
const event = value;
|
|
371
372
|
const room = roomProvider(provider);
|
|
372
373
|
if (provider === "claude_code") {
|
|
374
|
+
// The `system` / `init` event of --output-format stream-json names the model.
|
|
375
|
+
if (event.type === "system" && event.subtype === "init") {
|
|
376
|
+
const model = reportableModel(event.model);
|
|
377
|
+
return model ? { model } : {};
|
|
378
|
+
}
|
|
373
379
|
if (event.type === "result") {
|
|
374
380
|
if (event.is_error) {
|
|
375
381
|
return {
|
|
@@ -739,6 +745,7 @@ export async function runProvider(input) {
|
|
|
739
745
|
}
|
|
740
746
|
try {
|
|
741
747
|
let text = "", segment = "", failure, failed = false, sawResult = false, webReported = false;
|
|
748
|
+
const reportModel = modelReporter(input.model);
|
|
742
749
|
if (!child.stdout) {
|
|
743
750
|
throw new Error("Provider output is unavailable.");
|
|
744
751
|
}
|
|
@@ -756,6 +763,7 @@ export async function runProvider(input) {
|
|
|
756
763
|
}
|
|
757
764
|
const event = readProviderEvent(config.provider, value);
|
|
758
765
|
mark("firstEvent");
|
|
766
|
+
reportModel(event.model);
|
|
759
767
|
if (event.status) {
|
|
760
768
|
mark("firstTool");
|
|
761
769
|
}
|
|
@@ -1,9 +1,92 @@
|
|
|
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
|
+
"list_starter_routines",
|
|
12
|
+
"add_starter_routine",
|
|
13
|
+
"dismiss_starter_routine",
|
|
14
|
+
"add_shared_routine_to_my_library",
|
|
15
|
+
"rate_marketplace_item",
|
|
16
|
+
"comment_on_marketplace_item",
|
|
17
|
+
"list_my_marketplace_comments",
|
|
18
|
+
"delete_my_marketplace_comment",
|
|
19
|
+
"read_my_chat",
|
|
20
|
+
"read_my_retained_draft",
|
|
21
|
+
"remove_agent_memory",
|
|
22
|
+
"restore_my_chat",
|
|
23
|
+
"delete_my_chat",
|
|
24
|
+
"stop_my_turn",
|
|
25
|
+
"retry_my_turn",
|
|
26
|
+
"edit_my_queued_message",
|
|
27
|
+
"set_today_done",
|
|
28
|
+
"update_my_profile",
|
|
29
|
+
"dismiss_connection_warning",
|
|
30
|
+
"send_feedback",
|
|
31
|
+
"update_my_settings",
|
|
32
|
+
"save_file_to_library",
|
|
33
|
+
"memory_folder",
|
|
34
|
+
"memory_add_file",
|
|
35
|
+
"saved_file",
|
|
36
|
+
"list_my_files",
|
|
37
|
+
"file_versions",
|
|
38
|
+
"manage_file",
|
|
39
|
+
"organize_files",
|
|
40
|
+
"change_my_message",
|
|
41
|
+
"change_room_fact",
|
|
42
|
+
"list_room_decisions",
|
|
43
|
+
"list_meetings",
|
|
44
|
+
"read_meeting",
|
|
45
|
+
"set_room_view",
|
|
46
|
+
"update_meeting_notes",
|
|
47
|
+
"manage_meeting",
|
|
48
|
+
"list_room_context",
|
|
49
|
+
"room_context",
|
|
50
|
+
"leave_room",
|
|
51
|
+
"duplicate_room",
|
|
52
|
+
"reorder_rooms",
|
|
53
|
+
"set_room_personal_memory",
|
|
54
|
+
"read_film",
|
|
55
|
+
"manage_film",
|
|
56
|
+
"list_designs",
|
|
57
|
+
"manage_design",
|
|
58
|
+
"list_audio_clips",
|
|
59
|
+
"manage_audio_link",
|
|
60
|
+
"list_my_requests",
|
|
61
|
+
"respond_to_request",
|
|
62
|
+
"cancel_request",
|
|
63
|
+
"answer_availability",
|
|
64
|
+
];
|
|
1
65
|
// Served by our LOCAL stdio proxy in an owner-native Codex job, not by the
|
|
2
66
|
// server: the shell fence (#10987). The proxy classifies the command.
|
|
3
67
|
export const ROOM_LOCAL_TOOLS = ["run_command"];
|
|
4
68
|
export const ROOM_TOOLS = [
|
|
69
|
+
"artifact_audience_set",
|
|
70
|
+
"room_share",
|
|
71
|
+
"room_unshare",
|
|
72
|
+
"publish_link",
|
|
73
|
+
"unpublish_link",
|
|
74
|
+
"artifact_marketplace_publish",
|
|
75
|
+
"artifact_marketplace_unpublish",
|
|
76
|
+
"skill_audience_set",
|
|
77
|
+
"routine_audience_set",
|
|
78
|
+
"skill_room_share",
|
|
79
|
+
"skill_room_unshare",
|
|
80
|
+
"routine_room_share",
|
|
81
|
+
"routine_room_unshare",
|
|
82
|
+
"skill_marketplace_publish",
|
|
83
|
+
"skill_marketplace_unpublish",
|
|
84
|
+
"routine_marketplace_publish",
|
|
85
|
+
"routine_marketplace_unpublish",
|
|
5
86
|
"recall",
|
|
87
|
+
"read_you_page",
|
|
6
88
|
"update_memory",
|
|
89
|
+
"update_you_page",
|
|
7
90
|
"forget",
|
|
8
91
|
"save_progress",
|
|
9
92
|
"resume",
|
|
@@ -23,29 +106,36 @@ export const ROOM_TOOLS = [
|
|
|
23
106
|
"read_web_page",
|
|
24
107
|
"read_app_state",
|
|
25
108
|
"write_app_state",
|
|
109
|
+
"read_app_activity",
|
|
26
110
|
"get_skill",
|
|
27
111
|
"list_skills",
|
|
28
112
|
"search_memory",
|
|
29
113
|
"memory_outline",
|
|
30
114
|
"memory_read",
|
|
115
|
+
"memory_facts",
|
|
116
|
+
"memory_edit_section",
|
|
31
117
|
"list_connections",
|
|
32
118
|
"use_connection",
|
|
33
119
|
"change_connection",
|
|
34
120
|
"prepare_connection",
|
|
35
121
|
"ask_talent",
|
|
36
122
|
"get_thread",
|
|
123
|
+
"wait_for_result",
|
|
37
124
|
"list_routines",
|
|
38
125
|
"run_routine",
|
|
39
126
|
"update_routine",
|
|
40
127
|
"remember",
|
|
41
128
|
"save_skill",
|
|
42
129
|
"suggest_change",
|
|
130
|
+
"edit_sheet_cells",
|
|
131
|
+
"get_sheet_edit",
|
|
43
132
|
"patch_live_page",
|
|
44
133
|
"create_file",
|
|
45
134
|
"create_deck",
|
|
46
135
|
"create_spreadsheet",
|
|
47
136
|
"create_web_app",
|
|
48
137
|
"export_file",
|
|
138
|
+
"export_web_app",
|
|
49
139
|
"revise_web_app",
|
|
50
140
|
"share_file_to_room",
|
|
51
141
|
"upload_file",
|
|
@@ -55,6 +145,8 @@ export const ROOM_TOOLS = [
|
|
|
55
145
|
"ask_owner",
|
|
56
146
|
"delete_own_message",
|
|
57
147
|
"edit_own_message",
|
|
148
|
+
"set_file_pinned",
|
|
149
|
+
"forward_message",
|
|
58
150
|
"react_to_message",
|
|
59
151
|
"post_to_thread",
|
|
60
152
|
"reply_to_comment",
|
|
@@ -67,6 +159,7 @@ export const ROOM_TOOLS = [
|
|
|
67
159
|
"room_default_set",
|
|
68
160
|
"room_default_remove",
|
|
69
161
|
"whoami",
|
|
162
|
+
"onboarding_dismiss",
|
|
70
163
|
];
|
|
71
164
|
// The upload tools run in the talentos CLI's stdio proxy (mcp-proxy.ts), which
|
|
72
165
|
// reads the file from the job's folder and streams it to storage; the server's
|
|
@@ -4,6 +4,7 @@ import { writePrivateFile } from "../agent-config.js";
|
|
|
4
4
|
import { GEMINI_CREDENTIAL_FILES, geminiSignedIn, readGeminiLogin, } from "./gemini-login.js";
|
|
5
5
|
import { geminiRoomArgs, geminiRoomPolicy, geminiRoomSettings, } from "./gemini-policy.js";
|
|
6
6
|
import { GeminiBoundaryError, probeGeminiBoundary } from "./gemini-probe.js";
|
|
7
|
+
import { reportableModel } from "./model-report.js";
|
|
7
8
|
import { matchFailureText } from "./provider-failure.js";
|
|
8
9
|
import { RoomIsolationError, } from "./room-provider.js";
|
|
9
10
|
// What the room launch needs from this Gemini CLI: its own policy files, the
|
|
@@ -19,6 +20,11 @@ const GEMINI_ROOM_FLAGS = [
|
|
|
19
20
|
// stream-json: init, message (user and assistant chunks), tool_use,
|
|
20
21
|
// tool_result, error (a warning) and result (status and stats).
|
|
21
22
|
function readGeminiEvent(event) {
|
|
23
|
+
// The init event names the model (agent trust A1).
|
|
24
|
+
if (event.type === "init") {
|
|
25
|
+
const model = reportableModel(event.model);
|
|
26
|
+
return model ? { model } : {};
|
|
27
|
+
}
|
|
22
28
|
if (event.type === "message" && event.role === "assistant") {
|
|
23
29
|
return typeof event.content === "string"
|
|
24
30
|
? { textDelta: event.content }
|
|
@@ -4,6 +4,7 @@ import { writePrivateFile } from "../agent-config.js";
|
|
|
4
4
|
import { HERMES_CREDENTIAL_FILES, hermesSignedIn, readHermesLogin, } from "./hermes-login.js";
|
|
5
5
|
import { hermesRoomArgs, hermesRoomConfig, stopHermesGateway, } from "./hermes-policy.js";
|
|
6
6
|
import { HermesBoundaryError, probeHermesBoundary } from "./hermes-probe.js";
|
|
7
|
+
import { reportableModel } from "./model-report.js";
|
|
7
8
|
import { matchFailureText } from "./provider-failure.js";
|
|
8
9
|
import { RoomIsolationError, } from "./room-provider.js";
|
|
9
10
|
// What the room launch needs from this Hermes Agent: a query from a file or
|
|
@@ -23,6 +24,11 @@ const NOT_CONFIGURED = /credentials or agent init failed/iu;
|
|
|
23
24
|
// closing result {exit_code, text, error}. A failed run's `text` is Hermes' own
|
|
24
25
|
// prose about the failure, so it is never used as the answer.
|
|
25
26
|
function readHermesEvent(event) {
|
|
27
|
+
// The system/init event names the model (agent trust A1).
|
|
28
|
+
if (event.type === "system" && event.subtype === "init") {
|
|
29
|
+
const model = reportableModel(event.model);
|
|
30
|
+
return model ? { model } : {};
|
|
31
|
+
}
|
|
26
32
|
if (event.type === "text") {
|
|
27
33
|
return typeof event.text === "string" ? { textDelta: event.text } : {};
|
|
28
34
|
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
// The model a provider's own output names (agent trust A1, #17220): the CLI
|
|
2
|
+
// tells TalentOS which model a job's provider said it ran, once per job, after
|
|
3
|
+
// the provider's first event. Only a model id is ever read out of the output
|
|
4
|
+
// and sent: never a path, a key or text. What the CLI does not read: the
|
|
5
|
+
// owner's configured default (`~/.claude/settings.json`, `config.toml`), which
|
|
6
|
+
// is not the model a run used (an env override or a rate-limit fallback changes
|
|
7
|
+
// it). If a provider's output names none, nothing is sent. The server
|
|
8
|
+
// normalizes and bounds it again, and treats it as the client's word, never
|
|
9
|
+
// verified.
|
|
10
|
+
// What the server stores (convex/externalAgentModels/model.model.ts), plus the
|
|
11
|
+
// bracket suffix it drops (`claude-opus-4-5[1m]`). A model id is a short name.
|
|
12
|
+
const MODEL_ID = /^[a-z0-9][a-z0-9._:/+-]{0,62}(?:\[[a-z0-9._-]{1,16}\])?$/u;
|
|
13
|
+
// The prefixes of provider and forge keys, and a long unbroken run (a hash or a
|
|
14
|
+
// token): neither is a model id, so neither ever leaves the machine here.
|
|
15
|
+
const KEY_PREFIX = /^(?:sk|pk|rk|ghp|gho|ghs|ghu|github_pat|glpat|xox[a-z]|akia|asia|eyj)[-_]/u;
|
|
16
|
+
const BLOB = /[a-z0-9]{32,}/u;
|
|
17
|
+
// A link passes the character rule, so it is refused by name, as on the server.
|
|
18
|
+
const LINK = /:\/\/|www\./u;
|
|
19
|
+
// What a model id is not: a path (`..`, `//`, more than two `/`), an account
|
|
20
|
+
// (`arn:`), a number (nine or more digits in a row) or something with no
|
|
21
|
+
// letter. The same rule as the server's (convex/externalAgentModels/
|
|
22
|
+
// model.model.ts): change both.
|
|
23
|
+
const NOT_AN_ID = /\.\.|\/\/|(?:^|[^a-z])arn:|\d{9,}|\/[^/]*\/[^/]*\//u;
|
|
24
|
+
const HAS_LETTER = /[a-z]/u;
|
|
25
|
+
// A catalog path keeps only its last segment (Fireworks'
|
|
26
|
+
// `accounts/fireworks/models/llama-v3p3-70b-instruct`, Vertex's
|
|
27
|
+
// `projects/<project>/models/x`), so the account or project in front never
|
|
28
|
+
// leaves this machine. Only these three shapes (`models/<id>`,
|
|
29
|
+
// `accounts/<x>/models/<id>`, `projects/<x>/models/<id>`): a local path whose
|
|
30
|
+
// folder is called `models` is refused, not shortened. The same as the
|
|
31
|
+
// server's (model.model.ts).
|
|
32
|
+
const MODELS_PATH = /^(?:models|accounts\/[^/]+\/models|projects\/[^/]+\/models)\/([^/]+)$/iu;
|
|
33
|
+
/** The model id in a provider event field, or undefined for anything else. */
|
|
34
|
+
export function reportableModel(value) {
|
|
35
|
+
if (typeof value !== "string") {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const model = value.trim().replace(MODELS_PATH, "$1");
|
|
39
|
+
const folded = model.toLowerCase();
|
|
40
|
+
return MODEL_ID.test(folded) &&
|
|
41
|
+
HAS_LETTER.test(folded) &&
|
|
42
|
+
!(KEY_PREFIX.test(folded) ||
|
|
43
|
+
BLOB.test(folded) ||
|
|
44
|
+
LINK.test(folded) ||
|
|
45
|
+
NOT_AN_ID.test(folded))
|
|
46
|
+
? model
|
|
47
|
+
: undefined;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Reports the job's model at most once, without waiting: it is a label, so a
|
|
51
|
+
* slow, failed or refused call (an older server answers 404) never fails or
|
|
52
|
+
* delays the job, and is never retried.
|
|
53
|
+
*/
|
|
54
|
+
export function modelReporter(send) {
|
|
55
|
+
let sent = false;
|
|
56
|
+
return (model) => {
|
|
57
|
+
if (sent || !model || !send) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
sent = true;
|
|
61
|
+
try {
|
|
62
|
+
Promise.resolve(send(model)).catch(() => undefined);
|
|
63
|
+
}
|
|
64
|
+
catch {
|
|
65
|
+
// Nothing to do: the label is best effort.
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
@@ -52,11 +52,12 @@ function readsOtherRoom(call, jobRoomId) {
|
|
|
52
52
|
const aimed = call.toolInput.roomId;
|
|
53
53
|
return aimed !== undefined && aimed !== jobRoomId;
|
|
54
54
|
}
|
|
55
|
-
// read_file and
|
|
55
|
+
// read_file, read_app_state and read_app_activity name no room, so the id has
|
|
56
|
+
// to: only a file id
|
|
56
57
|
// the packet listed for the job's room, or an attachment of the message that
|
|
57
58
|
// started the job (the owner's own words), stays inside it (#13471). A read by
|
|
58
59
|
// versionId or another messageId, or a job with no list, fails closed.
|
|
59
|
-
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));
|
|
60
61
|
function readsOtherRoomFile(call, context) {
|
|
61
62
|
if (!BY_ID_TOOLS.has(call.tool)) {
|
|
62
63
|
return false;
|
|
@@ -55,10 +55,17 @@ export class ProviderFailureError extends Error {
|
|
|
55
55
|
this.reason = reason;
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
/**
|
|
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
|
-
|
|
67
|
+
if (error instanceof ProviderBinaryError) {
|
|
68
|
+
return "missing_binary";
|
|
69
|
+
}
|
|
70
|
+
return error instanceof Error ? "crashed" : undefined;
|
|
64
71
|
}
|
package/dist/agent/serve.js
CHANGED
|
@@ -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 = (
|
|
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
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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;
|
|
@@ -486,6 +509,12 @@ export async function serveAgent(config, directory, version, stop, verify, optio
|
|
|
486
509
|
webRead: async () => {
|
|
487
510
|
await gateway.request(`/agent-gateway/jobs/${job.jobId}/web-read`, { leaseToken: job.leaseToken }, signal);
|
|
488
511
|
},
|
|
512
|
+
// The model the provider's own output named, once per job (agent
|
|
513
|
+
// trust A1, #17220). A label: a refusal or an older server's 404
|
|
514
|
+
// is ignored by the runner.
|
|
515
|
+
model: async (model) => {
|
|
516
|
+
await gateway.request(`/agent-gateway/jobs/${job.jobId}/model`, { leaseToken: job.leaseToken, model }, signal);
|
|
517
|
+
},
|
|
489
518
|
// Room tools and the current packet carry continuity. Replaying
|
|
490
519
|
// provider history grows forever and carries stale file copies.
|
|
491
520
|
signal: AbortSignal.any([signal, cancel.signal]),
|
|
@@ -574,7 +603,7 @@ export async function serveAgent(config, directory, version, stop, verify, optio
|
|
|
574
603
|
continue;
|
|
575
604
|
}
|
|
576
605
|
await new Promise((resolve) => {
|
|
577
|
-
const timer = setTimeout(finish, push ?
|
|
606
|
+
const timer = setTimeout(finish, push && !claimFailed ? PUSH_CLAIM_MS : claimPollInterval(lastJobAt));
|
|
578
607
|
function finish() {
|
|
579
608
|
clearTimeout(timer);
|
|
580
609
|
signal.removeEventListener("abort", finish);
|
package/dist/agent-link.js
CHANGED
|
@@ -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
|
-
|
|
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 === "
|
|
42
|
+
(provider === "any" ||
|
|
43
|
+
provider === "claude_code" ||
|
|
16
44
|
provider === "codex" ||
|
|
17
45
|
provider === "gemini_cli" ||
|
|
18
46
|
provider === "hermes_agent") &&
|
package/dist/args.js
CHANGED
|
@@ -27,7 +27,10 @@ const CLI_OPTIONS = {
|
|
|
27
27
|
"upload-root": { type: "string" },
|
|
28
28
|
"upload-scratch": { type: "string" },
|
|
29
29
|
"owner-job-dir": { type: "string" },
|
|
30
|
+
provider: { type: "string" },
|
|
30
31
|
surface: { type: "string" },
|
|
32
|
+
title: { type: "string" },
|
|
33
|
+
replace: { type: "boolean" },
|
|
31
34
|
};
|
|
32
35
|
/** Groups whose first positional is a sub-command rather than an argument. */
|
|
33
36
|
const ACTION_GROUPS = new Set([
|
|
@@ -37,6 +40,7 @@ const ACTION_GROUPS = new Set([
|
|
|
37
40
|
"memory",
|
|
38
41
|
"routines",
|
|
39
42
|
"task",
|
|
43
|
+
"approvals",
|
|
40
44
|
]);
|
|
41
45
|
export function parseArgv(argv) {
|
|
42
46
|
const { values, positionals } = parse(argv);
|
package/dist/client.js
CHANGED
|
@@ -27,6 +27,10 @@ export class AgentClient {
|
|
|
27
27
|
this.credentials = credentials;
|
|
28
28
|
this.retryDelaysMs = retryDelaysMs;
|
|
29
29
|
}
|
|
30
|
+
/** The deployment this client talks to. */
|
|
31
|
+
get apiUrl() {
|
|
32
|
+
return this.credentials.apiUrl;
|
|
33
|
+
}
|
|
30
34
|
async call(name, args, options) {
|
|
31
35
|
const client = await this.connect();
|
|
32
36
|
const result = (await withFriendlyErrors(() => client.callTool({ name, arguments: args }, undefined, options)));
|
package/dist/commands/agent.js
CHANGED
|
@@ -143,7 +143,7 @@ export async function runAgent(parsed, dependencies = {}) {
|
|
|
143
143
|
}
|
|
144
144
|
}
|
|
145
145
|
export async function installLinkedAgent(parsed, dependencies = {}) {
|
|
146
|
-
const link = parseAgentLink(parsed.options.url ?? "");
|
|
146
|
+
const link = parseAgentLink(parsed.options.url ?? "", parsed.options.provider);
|
|
147
147
|
// The Connect dialog shows each step and the reason a link stopped (#15553).
|
|
148
148
|
const report = dependencies.reportProgress ??
|
|
149
149
|
linkProgressReporter(link, parsed.options["api-url"] ?? process.env.TALENTOS_API_URL);
|