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.
- package/README.md +120 -17
- package/dist/agent/adapters.js +12 -2
- package/dist/agent/codex-policy.js +71 -0
- package/dist/agent/native/touch.js +18 -8
- package/dist/agent/provider-failure.js +9 -2
- package/dist/agent/serve.js +28 -5
- package/dist/agent/talentos-content.js +33 -0
- package/dist/agent-link.js +31 -3
- package/dist/args.js +14 -1
- package/dist/claude-plugin.js +82 -0
- package/dist/client.js +8 -4
- package/dist/commands/agent.js +1 -1
- package/dist/commands/approvals.js +145 -0
- package/dist/commands/doctor.js +427 -0
- package/dist/commands/init.js +78 -9
- package/dist/commands/login.js +10 -1
- package/dist/commands/mcp.js +17 -2
- package/dist/commands/publish.js +74 -0
- package/dist/commands/skills-sync.js +174 -0
- package/dist/commands/skills.js +24 -4
- package/dist/commands/task.js +77 -0
- package/dist/commands/tools.js +56 -0
- package/dist/config.js +34 -0
- package/dist/format.js +12 -0
- package/dist/hosting-skill.js +67 -0
- package/dist/index.js +129 -23
- package/dist/install.js +126 -38
- package/dist/memory-wire.js +22 -0
- package/dist/output.js +107 -0
- package/dist/publish-site.js +291 -0
- package/dist/published-pages.js +30 -0
- package/dist/setup.generated.js +180 -0
- package/dist/skill-files.js +1 -1
- package/dist/skill-sync-state.js +38 -0
- package/dist/upload-file.js +1 -1
- package/dist/watch.js +39 -0
- package/package.json +3 -2
- package/plugin/.claude-plugin/marketplace.json +12 -0
- package/plugin/plugins/talentos/.claude-plugin/plugin.json +9 -0
- package/plugin/plugins/talentos/.mcp.json +8 -0
- package/plugin/plugins/talentos/commands/ask-talent.md +21 -0
- package/plugin/plugins/talentos/commands/catch-up.md +16 -0
- package/plugin/plugins/talentos/commands/remember.md +15 -0
- package/plugin/plugins/talentos/hooks/hooks.json +17 -0
- package/plugin/plugins/talentos/scripts/session-start.mjs +177 -0
package/dist/args.js
CHANGED
|
@@ -19,16 +19,29 @@ 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" },
|
|
25
27
|
"upload-root": { type: "string" },
|
|
26
28
|
"upload-scratch": { type: "string" },
|
|
27
29
|
"owner-job-dir": { type: "string" },
|
|
30
|
+
provider: { type: "string" },
|
|
28
31
|
surface: { type: "string" },
|
|
32
|
+
title: { type: "string" },
|
|
33
|
+
replace: { type: "boolean" },
|
|
29
34
|
};
|
|
30
35
|
/** Groups whose first positional is a sub-command rather than an argument. */
|
|
31
|
-
const ACTION_GROUPS = new Set([
|
|
36
|
+
const ACTION_GROUPS = new Set([
|
|
37
|
+
"agent",
|
|
38
|
+
"mcp",
|
|
39
|
+
"skills",
|
|
40
|
+
"memory",
|
|
41
|
+
"routines",
|
|
42
|
+
"task",
|
|
43
|
+
"approvals",
|
|
44
|
+
]);
|
|
32
45
|
export function parseArgv(argv) {
|
|
33
46
|
const { values, positionals } = parse(argv);
|
|
34
47
|
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,19 +27,23 @@ export class AgentClient {
|
|
|
27
27
|
this.credentials = credentials;
|
|
28
28
|
this.retryDelaysMs = retryDelaysMs;
|
|
29
29
|
}
|
|
30
|
-
|
|
30
|
+
/** The deployment this client talks to. */
|
|
31
|
+
get apiUrl() {
|
|
32
|
+
return this.credentials.apiUrl;
|
|
33
|
+
}
|
|
34
|
+
async call(name, args, options) {
|
|
31
35
|
const client = await this.connect();
|
|
32
|
-
const result = (await withFriendlyErrors(() => client.callTool({ name, arguments: args })));
|
|
36
|
+
const result = (await withFriendlyErrors(() => client.callTool({ name, arguments: args }, undefined, options)));
|
|
33
37
|
const text = firstText(result);
|
|
34
38
|
if (result.isError) {
|
|
35
39
|
throw new Error(text || `Tool ${name} failed.`);
|
|
36
40
|
}
|
|
37
41
|
return { text, data: result.structuredContent };
|
|
38
42
|
}
|
|
39
|
-
async listTools() {
|
|
43
|
+
async listTools(cursor) {
|
|
40
44
|
return await this.whileServerIsAway(async () => {
|
|
41
45
|
const client = await this.connect();
|
|
42
|
-
return await withFriendlyErrors(() => client.listTools());
|
|
46
|
+
return await withFriendlyErrors(() => client.listTools(cursor ? { cursor } : undefined));
|
|
43
47
|
});
|
|
44
48
|
}
|
|
45
49
|
async callTool(params) {
|
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);
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { withClient } from "../client.js";
|
|
2
|
+
import { emit, emitJson } from "../format.js";
|
|
3
|
+
import { CliError, cliContractEnabled, nextActions, withApiUrl, } from "../output.js";
|
|
4
|
+
import { watch } from "../watch.js";
|
|
5
|
+
// `talentos approvals` (ADR 0120): read-only. It lists, reads or follows the
|
|
6
|
+
// approvals the member has not yet decided, and prints the link they open in
|
|
7
|
+
// TalentOS. It has no allow, deny or open-and-approve: an approval is the
|
|
8
|
+
// member's tap on their own device, and anything the CLI could do the AI
|
|
9
|
+
// running beside it could do too.
|
|
10
|
+
const ACTIONS = new Set(["list", "status", "watch"]);
|
|
11
|
+
// approval_status answers at once, so the pause between reads is ours; it grows
|
|
12
|
+
// while nothing changes and resets on a change.
|
|
13
|
+
const POLL_START_SECONDS = 3;
|
|
14
|
+
const POLL_MAX_SECONDS = 15;
|
|
15
|
+
const MS = 1000;
|
|
16
|
+
const TOOL_MISSING = /Tool approval_status not found/i;
|
|
17
|
+
export async function runApprovals(parsed) {
|
|
18
|
+
if (!cliContractEnabled()) {
|
|
19
|
+
throw new CliError("FEATURE_DISABLED", "Approval commands need HEADLESS_CLI_V1=true until release.");
|
|
20
|
+
}
|
|
21
|
+
const action = parsed.action ?? "list";
|
|
22
|
+
const approvalId = parsed.args[0];
|
|
23
|
+
if (!ACTIONS.has(action) ||
|
|
24
|
+
parsed.args.length > 1 ||
|
|
25
|
+
(action === "list" && approvalId !== undefined)) {
|
|
26
|
+
throw new CliError("INVALID_ARGUMENT", "Usage: talentos approvals [list|status|watch] [approvalId] [--json]");
|
|
27
|
+
}
|
|
28
|
+
const id = action === "list" ? undefined : approvalId;
|
|
29
|
+
await withClient(parsed.options["api-url"], async (client) => {
|
|
30
|
+
const read = async (signal) => {
|
|
31
|
+
try {
|
|
32
|
+
return (await client.call("approval_status", id === undefined ? {} : { approvalId: id }, signal ? { signal } : undefined)).data;
|
|
33
|
+
}
|
|
34
|
+
catch (error) {
|
|
35
|
+
// A server without the tool (older, or the flag is off) says so in
|
|
36
|
+
// protocol words; the member gets a plain line.
|
|
37
|
+
if (error instanceof Error && TOOL_MISSING.test(error.message)) {
|
|
38
|
+
throw new Error("Following approvals isn't turned on for your workspace yet.");
|
|
39
|
+
}
|
|
40
|
+
throw error;
|
|
41
|
+
}
|
|
42
|
+
};
|
|
43
|
+
let latest;
|
|
44
|
+
if (action === "watch") {
|
|
45
|
+
const pacer = createPacer();
|
|
46
|
+
latest = await watch({
|
|
47
|
+
isRunning: waiting,
|
|
48
|
+
onChange: (value) => {
|
|
49
|
+
pacer.reset();
|
|
50
|
+
emit(render(value));
|
|
51
|
+
},
|
|
52
|
+
read: async (previous, waitSeconds, signal) => {
|
|
53
|
+
if (previous !== undefined && waitSeconds > 0) {
|
|
54
|
+
await sleep(pacer.next(waitSeconds) * MS, signal);
|
|
55
|
+
}
|
|
56
|
+
return await read(signal);
|
|
57
|
+
},
|
|
58
|
+
version: signature,
|
|
59
|
+
// The helper's wait ceiling (it also caps it at the time left): the
|
|
60
|
+
// pacer starts at POLL_START_SECONDS and grows to it.
|
|
61
|
+
waitSeconds: POLL_MAX_SECONDS,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
latest = await read();
|
|
66
|
+
}
|
|
67
|
+
const next = nextFor(latest, parsed.options["api-url"], id);
|
|
68
|
+
nextActions(next);
|
|
69
|
+
if (parsed.options.json) {
|
|
70
|
+
emitJson(latest);
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
if (action !== "watch") {
|
|
74
|
+
emit(render(latest));
|
|
75
|
+
}
|
|
76
|
+
for (const action of next) {
|
|
77
|
+
emit(`Next: ${action.command} — ${action.why}`);
|
|
78
|
+
}
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function waiting(value) {
|
|
82
|
+
return value.approvals.some((approval) => approval.status === "awaiting_human");
|
|
83
|
+
}
|
|
84
|
+
function signature(value) {
|
|
85
|
+
return value.approvals
|
|
86
|
+
.map((approval) => `${approval.approvalId}:${approval.status}`)
|
|
87
|
+
.join(",");
|
|
88
|
+
}
|
|
89
|
+
function nextFor(value, apiUrl, approvalId) {
|
|
90
|
+
const pending = value.approvals.filter((approval) => approval.status === "awaiting_human");
|
|
91
|
+
if (pending.length === 0) {
|
|
92
|
+
return [];
|
|
93
|
+
}
|
|
94
|
+
const where = pending.find((approval) => approval.link)?.link;
|
|
95
|
+
return [
|
|
96
|
+
{
|
|
97
|
+
// A watch of one card keeps following that card, so its decline is seen.
|
|
98
|
+
command: withApiUrl(approvalId === undefined
|
|
99
|
+
? "talentos approvals watch"
|
|
100
|
+
: `talentos approvals watch ${shellQuote(approvalId)}`, apiUrl),
|
|
101
|
+
why: `Only the member can decide, in TalentOS${where ? ` (${where})` : ""}. Watching changes nothing; follow again afterwards.`,
|
|
102
|
+
},
|
|
103
|
+
];
|
|
104
|
+
}
|
|
105
|
+
function render(value) {
|
|
106
|
+
if (value.approvals.length === 0) {
|
|
107
|
+
return "Nothing of yours is waiting for the member's approval.";
|
|
108
|
+
}
|
|
109
|
+
return value.approvals
|
|
110
|
+
.map((approval) => `${approval.status}: ${approval.what}${approval.link ? `\n Open: ${approval.link}` : ""}`)
|
|
111
|
+
.join("\n");
|
|
112
|
+
}
|
|
113
|
+
/** A pause that ends early, quietly, when the watch is cancelled. */
|
|
114
|
+
function sleep(ms, signal) {
|
|
115
|
+
return new Promise((resolve) => {
|
|
116
|
+
const timer = setTimeout(done, ms);
|
|
117
|
+
function done() {
|
|
118
|
+
clearTimeout(timer);
|
|
119
|
+
signal.removeEventListener("abort", done);
|
|
120
|
+
resolve();
|
|
121
|
+
}
|
|
122
|
+
signal.addEventListener("abort", done, { once: true });
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function shellQuote(value) {
|
|
126
|
+
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* The pause between reads: it starts at POLL_START_SECONDS, doubles while
|
|
130
|
+
* nothing changes up to the ceiling the watch passes in, and starts over on a
|
|
131
|
+
* change.
|
|
132
|
+
*/
|
|
133
|
+
export function createPacer() {
|
|
134
|
+
let quiet = 0;
|
|
135
|
+
return {
|
|
136
|
+
next(ceilingSeconds) {
|
|
137
|
+
const pause = Math.min(POLL_START_SECONDS * 2 ** quiet, ceilingSeconds);
|
|
138
|
+
quiet += 1;
|
|
139
|
+
return pause;
|
|
140
|
+
},
|
|
141
|
+
reset() {
|
|
142
|
+
quiet = 0;
|
|
143
|
+
},
|
|
144
|
+
};
|
|
145
|
+
}
|