talentos 1.1.0 → 1.1.2

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/dist/index.js CHANGED
@@ -3,13 +3,14 @@ import { readFileSync } from "node:fs";
3
3
  import { redactAgentOutput } from "./agent-link.js";
4
4
  import { parseArgv } from "./args.js";
5
5
  import { emit } from "./format.js";
6
+ import { ProviderBinaryError } from "./provider-binary.js";
6
7
  const USAGE = `talentos — your team's skills, memory and Talent, from any coding agent.
7
8
 
8
9
  Usage: talentos <command> [options]
9
10
 
10
11
  Commands:
11
12
  init Connect this machine's agents to TalentOS
12
- agent <link|status|list|unlink|logs> Bring your own agent into Rooms
13
+ agent <link|repair|status|list|unlink|logs> Bring your own agent into Rooms
13
14
  login Authorize this machine
14
15
  logout Forget the key stored on this machine
15
16
  whoami Show the member and org this key acts as
@@ -32,6 +33,7 @@ const GROUP_USAGE = {
32
33
  talentos agent status | list [--json] [--agent <id>]
33
34
  talentos agent unlink [name] [--agent <id>]
34
35
  talentos agent logs [--agent <id>]
36
+ talentos agent repair [--agent <id>]
35
37
  talentos agent serve --agent <id>
36
38
 
37
39
  The link command checks the provider's CLI login, mints the key locally, and
@@ -143,5 +145,5 @@ main(process.argv.slice(2)).catch((error) => {
143
145
  }
144
146
  });
145
147
  process.stderr.write(`${redactAgentOutput(message, fragments).split("\n")[0]}\n`);
146
- process.exit(1);
148
+ process.exit(error instanceof ProviderBinaryError ? error.exitCode : 1);
147
149
  });
@@ -0,0 +1,47 @@
1
+ import { accessSync, constants, statSync } from "node:fs";
2
+ import { delimiter, dirname, isAbsolute, join, resolve } from "node:path";
3
+ import { homeDir } from "./install.js";
4
+ export class ProviderBinaryError extends Error {
5
+ exitCode = 78;
6
+ }
7
+ export function resolveProviderBinary(provider, configured) {
8
+ const binary = provider === "claude_code" ? "claude" : "codex";
9
+ const candidates = configured
10
+ ? [configured]
11
+ : (process.env.PATH ?? "")
12
+ .split(delimiter)
13
+ .filter(Boolean)
14
+ .map((directory) => resolve(directory, process.platform === "win32" ? `${binary}.exe` : binary));
15
+ for (const candidate of candidates) {
16
+ if (!isAbsolute(candidate)) {
17
+ continue;
18
+ }
19
+ try {
20
+ accessSync(candidate, constants.X_OK);
21
+ if (!statSync(candidate).isFile()) {
22
+ continue;
23
+ }
24
+ // Preserve stable provider symlinks; realpaths can point into deleted versions.
25
+ return candidate;
26
+ }
27
+ catch {
28
+ /* Try the next PATH directory. */
29
+ }
30
+ }
31
+ const label = provider === "claude_code" ? "Claude Code" : "Codex";
32
+ throw new ProviderBinaryError(`${label} not found at ${configured ?? join(homeDir(), ".local/bin", binary)}; run talentos agent repair`);
33
+ }
34
+ export function providerPathEnv(binary, home = homeDir(), includeRuntimeNode = true) {
35
+ return [
36
+ ...new Set([
37
+ ...(binary ? [dirname(binary)] : []),
38
+ ...(includeRuntimeNode ? [dirname(process.execPath)] : []),
39
+ join(home, ".local/bin"),
40
+ join(home, ".npm-global/bin"),
41
+ "/opt/homebrew/bin",
42
+ "/usr/local/bin",
43
+ "/usr/bin",
44
+ "/bin",
45
+ ]),
46
+ ].join(delimiter);
47
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "talentos",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "type": "module",
5
5
  "description": "TalentOS CLI: push and pull skills, read and write team memory, and delegate work to your Talent from any coding agent.",
6
6
  "repository": {