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
@@ -0,0 +1,21 @@
1
+ ---
2
+ description: Explicitly hand a task to your TalentOS Talent (you do the rest yourself)
3
+ argument-hint: "<what you want your Talent to do>"
4
+ ---
5
+
6
+ The user asked you to hand this to their TalentOS Talent: $ARGUMENTS
7
+
8
+ This command is for explicit delegation only. For anything the user did not ask
9
+ to hand over, do the work yourself with the tools you have and use TalentOS only
10
+ for company context.
11
+
12
+ - If the `talentos` MCP server offers `delegate_task`, call it with the request
13
+ as `ask`, `to` set to `my_talent`, and a `requestId` of your own that you reuse
14
+ if you retry. Then poll `get_task` until it finishes or needs the user's answer
15
+ (`answer_task`).
16
+ - Otherwise call `ask_talent` with the request, then poll `get_thread` for the
17
+ reply. Stop polling after about two minutes and give the user the thread link:
18
+ the Talent keeps working and delivers the result in TalentOS.
19
+ - Say what you handed over, in one line.
20
+ - If the tool is not available in this connection, say so plainly and suggest
21
+ `npx talentos@1 ask "<message>"`.
@@ -0,0 +1,16 @@
1
+ ---
2
+ description: What changed at your company since you last looked
3
+ argument-hint: "[topic]"
4
+ ---
5
+
6
+ Catch me up on my company using TalentOS for context. $ARGUMENTS
7
+
8
+ 1. If the `talentos` MCP server offers a `catch_up` tool, call it and summarise
9
+ the result in a few short bullets.
10
+ 2. Otherwise call `whoami`, then `list_threads` and `search_memory` (scope
11
+ `all`) for anything recent that matches my topic, and summarise what you find.
12
+ 3. Name what needs a decision from me first. Keep it under ten lines.
13
+
14
+ If the `talentos` server asks you to sign in, tell me to run `/mcp`, pick
15
+ `talentos` and choose Authenticate. Do not guess at company facts: say so when
16
+ TalentOS has nothing on a point.
@@ -0,0 +1,15 @@
1
+ ---
2
+ description: Save one fact to your Talent's memory (or propose it to the company)
3
+ argument-hint: "<fact> [--company]"
4
+ ---
5
+
6
+ Save this to TalentOS memory: $ARGUMENTS
7
+
8
+ - Call the `remember` tool with one short, declarative sentence as `content`.
9
+ - `scope` is `personal` unless I wrote `--company` or said it is for the whole
10
+ team. Company facts from a member are proposed for review, not saved at once:
11
+ tell me which happened.
12
+ - Never save secrets, passwords or keys. If my text has one, leave it out and
13
+ say so.
14
+ - If `remember` is not available in this connection, say so plainly and suggest
15
+ `npx talentos@1 memory add "<fact>"` instead.
@@ -0,0 +1,17 @@
1
+ {
2
+ "hooks": {
3
+ "SessionStart": [
4
+ {
5
+ "matcher": "startup|resume|clear|compact",
6
+ "hooks": [
7
+ {
8
+ "type": "command",
9
+ "command": "node",
10
+ "args": ["${CLAUDE_PLUGIN_ROOT}/scripts/session-start.mjs"],
11
+ "timeout": 2
12
+ }
13
+ ]
14
+ }
15
+ ]
16
+ }
17
+ }
@@ -0,0 +1,177 @@
1
+ // SessionStart hook of the TalentOS Claude Code plugin. Prints a short
2
+ // company-context primer for Claude. Dependency-free and fast: the whole run
3
+ // stays inside 2 s, and anything that goes wrong prints nothing and exits 0,
4
+ // so a session never waits on, or is told about, TalentOS being offline.
5
+ //
6
+ // A hook cannot use the OAuth sign-in Claude Code holds for the plugin's MCP
7
+ // server, so the live line (who you are, your Talent, counts) needs the key
8
+ // `npx talentos@1 init` stored on this machine. Without a key it prints the
9
+ // static primer and makes no network call. The key only ever goes to the url
10
+ // it was stored with.
11
+ import { spawn } from "node:child_process";
12
+ import { readFileSync, statSync, utimesSync, writeFileSync } from "node:fs";
13
+ import { homedir, tmpdir } from "node:os";
14
+ import { join } from "node:path";
15
+ import { pathToFileURL } from "node:url";
16
+
17
+ const BUDGET_MS = 1900;
18
+ const FETCH_MS = 1500;
19
+ const SYNC_EVERY_MS = 6 * 60 * 60 * 1000;
20
+ const FIELD_MAX = 80;
21
+ const TRAILING_SLASHES = /\/+$/u;
22
+
23
+ export const STATIC_PRIMER = [
24
+ "TalentOS is connected to this session through the `talentos` MCP server (if it asks you to sign in, run /mcp, pick talentos, choose Authenticate).",
25
+ "It holds the company's shared memory, Skills, Routines and people, and the user's Talent.",
26
+ "You do the user's work yourself; use TalentOS for company context (call `search_memory` before answering how this team works or what the user prefers) and hand work to their Talent only when the user explicitly asks.",
27
+ "Slash commands: /talentos:catch-up, /talentos:remember, /talentos:ask-talent.",
28
+ ].join(" ");
29
+
30
+ /** One line of the primer from a `whoami` result; undefined when it is not one. */
31
+ export function livePrimer(who) {
32
+ const member = clean(who?.member?.name) || clean(who?.member?.email);
33
+ const organization = clean(who?.organization?.name);
34
+ if (!(member && organization)) {
35
+ return;
36
+ }
37
+ const talent = clean(who?.talent?.name);
38
+ const counts = who?.counts ?? {};
39
+ return [
40
+ `TalentOS: signed in as ${member} at ${organization}.`,
41
+ talent ? `Their Talent is ${talent}.` : undefined,
42
+ typeof counts.companySkills === "number" &&
43
+ typeof counts.mySkills === "number"
44
+ ? `${counts.companySkills} company and ${counts.mySkills} personal Skills.`
45
+ : undefined,
46
+ typeof counts.routines === "number"
47
+ ? `${counts.routines} Routines.`
48
+ : undefined,
49
+ STATIC_PRIMER,
50
+ ]
51
+ .filter(Boolean)
52
+ .join(" ");
53
+ }
54
+
55
+ /** One line, control characters (newlines included) turned into spaces. */
56
+ function clean(value) {
57
+ if (typeof value !== "string") {
58
+ return "";
59
+ }
60
+ return Array.from(value.slice(0, FIELD_MAX * 4), (char) => {
61
+ const code = char.charCodeAt(0);
62
+ return code < 32 || code === 127 ? " " : char;
63
+ })
64
+ .join("")
65
+ .trim()
66
+ .slice(0, FIELD_MAX);
67
+ }
68
+
69
+ export function readCredentials(env, read = readFileSync) {
70
+ const stored = (() => {
71
+ try {
72
+ const root =
73
+ env.XDG_CONFIG_HOME || join(env.HOME || homedir(), ".config");
74
+ return JSON.parse(read(join(root, "talentos", "config.json"), "utf8"));
75
+ } catch {
76
+ return {};
77
+ }
78
+ })();
79
+ const apiKey = env.TALENTOS_API_KEY || stored.apiKey;
80
+ const apiUrl = env.TALENTOS_API_URL || stored.apiUrl;
81
+ if (typeof apiKey !== "string" || typeof apiUrl !== "string" || !apiKey) {
82
+ return;
83
+ }
84
+ return { apiKey, apiUrl: apiUrl.trim().replace(TRAILING_SLASHES, "") };
85
+ }
86
+
87
+ async function fetchWhoami({ apiKey, apiUrl }) {
88
+ const response = await fetch(`${apiUrl}/mcp`, {
89
+ body: JSON.stringify({
90
+ id: 1,
91
+ jsonrpc: "2.0",
92
+ method: "tools/call",
93
+ params: { arguments: {}, name: "whoami" },
94
+ }),
95
+ headers: {
96
+ Accept: "application/json, text/event-stream",
97
+ Authorization: `Bearer ${apiKey}`,
98
+ "Content-Type": "application/json",
99
+ },
100
+ method: "POST",
101
+ signal: AbortSignal.timeout(FETCH_MS),
102
+ });
103
+ if (!response.ok) {
104
+ return;
105
+ }
106
+ const body = await response.json();
107
+ return body?.result?.isError ? undefined : body?.result?.structuredContent;
108
+ }
109
+
110
+ /** Fire-and-forget Skills sync, opt-in and at most once per SYNC_EVERY_MS. */
111
+ function startSkillsSync(env) {
112
+ const stamp = join(
113
+ tmpdir(),
114
+ `talentos-skills-sync-${process.getuid?.() ?? 0}`
115
+ );
116
+ try {
117
+ if (Date.now() - statSync(stamp).mtimeMs < SYNC_EVERY_MS) {
118
+ return;
119
+ }
120
+ utimesSync(stamp, new Date(), new Date());
121
+ } catch {
122
+ writeFileSync(stamp, "");
123
+ }
124
+ spawn(
125
+ "npx",
126
+ [
127
+ "-y",
128
+ "talentos@1",
129
+ "skills",
130
+ "sync",
131
+ "--for",
132
+ "claude",
133
+ "--global",
134
+ "--company",
135
+ "--quiet",
136
+ ],
137
+ {
138
+ detached: true,
139
+ env,
140
+ shell: process.platform === "win32",
141
+ stdio: "ignore",
142
+ windowsHide: true,
143
+ }
144
+ ).unref();
145
+ }
146
+
147
+ async function main(env) {
148
+ setTimeout(() => process.exit(0), BUDGET_MS).unref();
149
+ const credentials = readCredentials(env);
150
+ let primer = STATIC_PRIMER;
151
+ if (credentials) {
152
+ try {
153
+ primer = livePrimer(await fetchWhoami(credentials));
154
+ } catch {
155
+ primer = undefined;
156
+ }
157
+ if (env.TALENTOS_SKILLS_SYNC === "1" && primer) {
158
+ try {
159
+ startSkillsSync(env);
160
+ } catch {
161
+ // Sync is a courtesy; the primer matters more.
162
+ }
163
+ }
164
+ }
165
+ if (primer) {
166
+ process.stdout.write(
167
+ `${JSON.stringify({ hookSpecificOutput: { additionalContext: primer, hookEventName: "SessionStart" } })}\n`
168
+ );
169
+ }
170
+ }
171
+
172
+ if (import.meta.url === pathToFileURL(process.argv[1] ?? "").href) {
173
+ main(process.env).then(
174
+ () => process.exit(0),
175
+ () => process.exit(0)
176
+ );
177
+ }