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
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { readFile, realpath, stat } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, extname, isAbsolute, relative, resolve, sep, } from "node:path";
|
|
3
|
+
import { deniedSegment } from "./upload-file.js";
|
|
4
|
+
// `talentos publish` (W87): a TalentOS web app is one self-contained page, so
|
|
5
|
+
// the page's own files (styles, scripts, images, fonts) go inside it, as
|
|
6
|
+
// inline <style> and <script> and as data: URIs. The server owns every rule
|
|
7
|
+
// (size, sandbox, credentials) and re-checks the result; this file refuses
|
|
8
|
+
// only what it can say more plainly than the server: a missing file, a file
|
|
9
|
+
// outside the folder, or a second page.
|
|
10
|
+
export class PublishRefusal extends Error {
|
|
11
|
+
}
|
|
12
|
+
function refuse(message) {
|
|
13
|
+
throw new PublishRefusal(message);
|
|
14
|
+
}
|
|
15
|
+
const MIME_TYPES = {
|
|
16
|
+
".avif": "image/avif",
|
|
17
|
+
".css": "text/css",
|
|
18
|
+
".gif": "image/gif",
|
|
19
|
+
".ico": "image/x-icon",
|
|
20
|
+
".jpeg": "image/jpeg",
|
|
21
|
+
".jpg": "image/jpeg",
|
|
22
|
+
".js": "text/javascript",
|
|
23
|
+
".json": "application/json",
|
|
24
|
+
".m4a": "audio/mp4",
|
|
25
|
+
".mjs": "text/javascript",
|
|
26
|
+
".mp3": "audio/mpeg",
|
|
27
|
+
".mp4": "video/mp4",
|
|
28
|
+
".otf": "font/otf",
|
|
29
|
+
".png": "image/png",
|
|
30
|
+
".svg": "image/svg+xml",
|
|
31
|
+
".ttf": "font/ttf",
|
|
32
|
+
".wav": "audio/wav",
|
|
33
|
+
".webm": "video/webm",
|
|
34
|
+
".webp": "image/webp",
|
|
35
|
+
".woff": "font/woff",
|
|
36
|
+
".woff2": "font/woff2",
|
|
37
|
+
};
|
|
38
|
+
const PAGE_EXTENSIONS = new Set([".htm", ".html"]);
|
|
39
|
+
// Raw-text elements first, so a tag spelled inside a script or style is never
|
|
40
|
+
// read as markup; then comments; then any other start tag.
|
|
41
|
+
const MARKUP = /<script\b([^>]*)>([\s\S]*?)<\/script\s*>|<style\b([^>]*)>([\s\S]*?)<\/style\s*>|<!--[\s\S]*?-->|<([a-zA-Z][\w-]*)(\s[^>]*)?>/gu;
|
|
42
|
+
const ATTRIBUTE = /([^\s"'<>/=]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'=<>`]+)))?/gu;
|
|
43
|
+
const CSS_URL = /url\(\s*(?:"([^"]*)"|'([^']*)'|([^)\s]*))\s*\)/giu;
|
|
44
|
+
const SCHEME = /^[a-z][a-z\d+.-]*:/iu;
|
|
45
|
+
const TITLE = /<title\b[^>]*>([\s\S]*?)<\/title\s*>/iu;
|
|
46
|
+
const WHITESPACE = /\s+/u;
|
|
47
|
+
const SELF_CLOSING = /\/\s*$/u;
|
|
48
|
+
const QUERY_OR_HASH = /[?#].*$/u;
|
|
49
|
+
/** Puts the page at `target` (a folder's index.html, or one .html file) and its local files into one page. */
|
|
50
|
+
export async function bundleSite(target) {
|
|
51
|
+
const { entry, root } = await locateEntry(target);
|
|
52
|
+
const site = new Site(root, entry);
|
|
53
|
+
const source = await readFile(entry, "utf8");
|
|
54
|
+
const html = await site.inlinePage(source, dirname(entry));
|
|
55
|
+
const title = decodeText(TITLE.exec(source)?.[1] ?? "").trim() ||
|
|
56
|
+
basename(root) ||
|
|
57
|
+
"Untitled page";
|
|
58
|
+
return { entry, html, title };
|
|
59
|
+
}
|
|
60
|
+
async function locateEntry(target) {
|
|
61
|
+
let found;
|
|
62
|
+
try {
|
|
63
|
+
found = await stat(target);
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return refuse(`There is nothing at ${target}.`);
|
|
67
|
+
}
|
|
68
|
+
if (found.isDirectory()) {
|
|
69
|
+
const root = await realpath(target);
|
|
70
|
+
const entry = resolve(root, "index.html");
|
|
71
|
+
if (!(await isFile(entry))) {
|
|
72
|
+
refuse(`There is no index.html in ${target}. Point at the page to publish, or the folder that holds it.`);
|
|
73
|
+
}
|
|
74
|
+
return { entry, root };
|
|
75
|
+
}
|
|
76
|
+
if (!PAGE_EXTENSIONS.has(extname(target).toLowerCase())) {
|
|
77
|
+
refuse(`${target} is not a web page. Point at an .html file or a folder.`);
|
|
78
|
+
}
|
|
79
|
+
const entry = await realpath(target);
|
|
80
|
+
return { entry, root: dirname(entry) };
|
|
81
|
+
}
|
|
82
|
+
async function isFile(path) {
|
|
83
|
+
try {
|
|
84
|
+
return (await stat(path)).isFile();
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
class Site {
|
|
91
|
+
entry;
|
|
92
|
+
root;
|
|
93
|
+
constructor(root, entry) {
|
|
94
|
+
this.entry = entry;
|
|
95
|
+
this.root = root;
|
|
96
|
+
}
|
|
97
|
+
async inlinePage(source, base) {
|
|
98
|
+
return await replaceAsync(source, MARKUP, async (match, groups) => {
|
|
99
|
+
const [scriptAttrs, scriptBody, styleAttrs, styleBody, tag, tagAttrs] = groups;
|
|
100
|
+
if (scriptAttrs !== undefined) {
|
|
101
|
+
return await this.inlineScript(match, scriptAttrs, scriptBody ?? "", base);
|
|
102
|
+
}
|
|
103
|
+
if (styleAttrs !== undefined) {
|
|
104
|
+
return `<style${styleAttrs}>${await this.inlineCss(styleBody ?? "", base)}</style>`;
|
|
105
|
+
}
|
|
106
|
+
if (tag === undefined) {
|
|
107
|
+
return match;
|
|
108
|
+
}
|
|
109
|
+
return await this.inlineTag(match, tag.toLowerCase(), tagAttrs ?? "", base);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
async inlineScript(match, rawAttrs, body, base) {
|
|
113
|
+
const attrs = parseAttributes(rawAttrs);
|
|
114
|
+
const src = attrs.find((attr) => attr.name === "src")?.value;
|
|
115
|
+
if (src === undefined || !isLocal(src) || body.trim() !== "") {
|
|
116
|
+
return match;
|
|
117
|
+
}
|
|
118
|
+
const code = (await this.read(src, base)).toString("utf8");
|
|
119
|
+
const kept = attrs.filter((attr) => !["async", "defer", "integrity", "src"].includes(attr.name));
|
|
120
|
+
// A literal </script inside the code would end the element early.
|
|
121
|
+
return `<script${renderAttributes(kept)}>${code.replace(/<\/(script)/giu, "<\\/$1")}</script>`;
|
|
122
|
+
}
|
|
123
|
+
async inlineTag(match, tag, rawAttrs, base) {
|
|
124
|
+
const attrs = parseAttributes(rawAttrs);
|
|
125
|
+
const value = (name) => attrs.find((attr) => attr.name === name)?.value;
|
|
126
|
+
if (tag === "link") {
|
|
127
|
+
const href = value("href");
|
|
128
|
+
const rel = (value("rel") ?? "").toLowerCase().split(WHITESPACE);
|
|
129
|
+
if (href === undefined || !isLocal(href)) {
|
|
130
|
+
// An icon, preload or font from another site: TalentOS pages load
|
|
131
|
+
// nothing from the network, and the server says so for a stylesheet.
|
|
132
|
+
return rel.includes("stylesheet") ? match : "";
|
|
133
|
+
}
|
|
134
|
+
if (!rel.includes("stylesheet")) {
|
|
135
|
+
// The sandbox refuses every <link>; an icon or preload is decoration.
|
|
136
|
+
return "";
|
|
137
|
+
}
|
|
138
|
+
const css = (await this.read(href, base)).toString("utf8");
|
|
139
|
+
const cssBase = dirname(this.resolveInside(href, base));
|
|
140
|
+
const media = value("media");
|
|
141
|
+
const mediaAttr = media ? ` media="${escapeAttribute(media)}"` : "";
|
|
142
|
+
return `<style${mediaAttr}>${await this.inlineCss(css, cssBase)}</style>`;
|
|
143
|
+
}
|
|
144
|
+
if (tag === "a" || tag === "area") {
|
|
145
|
+
const href = value("href");
|
|
146
|
+
if (href === undefined || !isLocal(href)) {
|
|
147
|
+
return match;
|
|
148
|
+
}
|
|
149
|
+
const linked = this.resolveInside(href, base);
|
|
150
|
+
if (linked === this.entry || linked === this.root) {
|
|
151
|
+
// A link home from the one page: the page is already open.
|
|
152
|
+
return `<${tag}${renderAttributes(attrs.map((attr) => attr.name === "href" ? { name: "href", value: "#" } : attr))}>`;
|
|
153
|
+
}
|
|
154
|
+
const page = stripQuery(href);
|
|
155
|
+
if (PAGE_EXTENSIONS.has(extname(page).toLowerCase()) ||
|
|
156
|
+
page.endsWith("/")) {
|
|
157
|
+
refuse(`This site has more than one page (it links to ${page}). TalentOS hosts one page for now: put everything on index.html, or publish each page on its own.`);
|
|
158
|
+
}
|
|
159
|
+
refuse(`The page links to ${page} to open or download it. A TalentOS page can't open other files: remove the link or show the content on the page.`);
|
|
160
|
+
}
|
|
161
|
+
let changed = false;
|
|
162
|
+
const next = [];
|
|
163
|
+
for (const attr of attrs) {
|
|
164
|
+
const inlined = await this.inlineAttribute(attr, base);
|
|
165
|
+
changed = changed || inlined !== attr.value;
|
|
166
|
+
next.push({ name: attr.name, value: inlined });
|
|
167
|
+
}
|
|
168
|
+
if (!changed) {
|
|
169
|
+
return match;
|
|
170
|
+
}
|
|
171
|
+
const selfClosing = SELF_CLOSING.test(rawAttrs) ? " /" : "";
|
|
172
|
+
return `<${tag}${renderAttributes(next)}${selfClosing}>`;
|
|
173
|
+
}
|
|
174
|
+
async inlineAttribute(attr, base) {
|
|
175
|
+
const { name, value } = attr;
|
|
176
|
+
if (value === undefined) {
|
|
177
|
+
return value;
|
|
178
|
+
}
|
|
179
|
+
if (name === "src" || name === "poster") {
|
|
180
|
+
return isLocal(value) ? await this.dataUri(value, base) : value;
|
|
181
|
+
}
|
|
182
|
+
if (name === "srcset") {
|
|
183
|
+
const candidates = await Promise.all(value.split(",").map(async (candidate) => {
|
|
184
|
+
const [url = "", ...descriptor] = candidate.trim().split(WHITESPACE);
|
|
185
|
+
const inlined = isLocal(url) ? await this.dataUri(url, base) : url;
|
|
186
|
+
return [inlined, ...descriptor].join(" ");
|
|
187
|
+
}));
|
|
188
|
+
return candidates.join(", ");
|
|
189
|
+
}
|
|
190
|
+
if (name === "style") {
|
|
191
|
+
return await this.inlineCss(value, base);
|
|
192
|
+
}
|
|
193
|
+
return value;
|
|
194
|
+
}
|
|
195
|
+
async inlineCss(css, base) {
|
|
196
|
+
return await replaceAsync(css, CSS_URL, async (match, groups) => {
|
|
197
|
+
const url = (groups[0] ?? groups[1] ?? groups[2] ?? "").trim();
|
|
198
|
+
return isLocal(url) ? `url("${await this.dataUri(url, base)}")` : match;
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
async dataUri(url, base) {
|
|
202
|
+
const bytes = await this.read(url, base);
|
|
203
|
+
const type = MIME_TYPES[extname(stripQuery(url)).toLowerCase()] ??
|
|
204
|
+
"application/octet-stream";
|
|
205
|
+
return `data:${type};base64,${bytes.toString("base64")}`;
|
|
206
|
+
}
|
|
207
|
+
resolveInside(url, base) {
|
|
208
|
+
let path = stripQuery(url);
|
|
209
|
+
try {
|
|
210
|
+
path = decodeURIComponent(path);
|
|
211
|
+
}
|
|
212
|
+
catch {
|
|
213
|
+
// Not percent-encoded after all: use it as written.
|
|
214
|
+
}
|
|
215
|
+
return path.startsWith("/")
|
|
216
|
+
? resolve(this.root, `.${path}`)
|
|
217
|
+
: resolve(base, path);
|
|
218
|
+
}
|
|
219
|
+
// Only a regular file inside the published folder, never a credential file,
|
|
220
|
+
// whatever the page names: the page is the agent's to write.
|
|
221
|
+
async read(url, base) {
|
|
222
|
+
const wanted = this.resolveInside(url, base);
|
|
223
|
+
const shown = relative(this.root, wanted) || url;
|
|
224
|
+
let real;
|
|
225
|
+
try {
|
|
226
|
+
real = await realpath(wanted);
|
|
227
|
+
}
|
|
228
|
+
catch {
|
|
229
|
+
return refuse(`The page uses ${shown}, which is not in the folder. Add the file or remove it from the page.`);
|
|
230
|
+
}
|
|
231
|
+
const inside = relative(this.root, real);
|
|
232
|
+
if (inside.startsWith("..") || isAbsolute(inside)) {
|
|
233
|
+
refuse(`The page uses ${url}, which is outside the folder being published. Copy it into the folder.`);
|
|
234
|
+
}
|
|
235
|
+
if (deniedSegment(inside.split(sep))) {
|
|
236
|
+
refuse(`The page uses ${inside}, which looks like a credential or settings file, so nothing was published.`);
|
|
237
|
+
}
|
|
238
|
+
if (!(await isFile(real))) {
|
|
239
|
+
refuse(`The page uses ${shown}, which is not a file.`);
|
|
240
|
+
}
|
|
241
|
+
return await readFile(real);
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
function isLocal(url) {
|
|
245
|
+
const trimmed = url.trim();
|
|
246
|
+
return (trimmed !== "" &&
|
|
247
|
+
!trimmed.startsWith("#") &&
|
|
248
|
+
!trimmed.startsWith("//") &&
|
|
249
|
+
!SCHEME.test(trimmed));
|
|
250
|
+
}
|
|
251
|
+
function stripQuery(url) {
|
|
252
|
+
return url.trim().replace(QUERY_OR_HASH, "");
|
|
253
|
+
}
|
|
254
|
+
function parseAttributes(raw) {
|
|
255
|
+
return [...raw.matchAll(ATTRIBUTE)].map((match) => ({
|
|
256
|
+
name: (match[1] ?? "").toLowerCase(),
|
|
257
|
+
value: match[2] ?? match[3] ?? match[4],
|
|
258
|
+
}));
|
|
259
|
+
}
|
|
260
|
+
function renderAttributes(attrs) {
|
|
261
|
+
return attrs
|
|
262
|
+
.map((attr) => attr.value === undefined
|
|
263
|
+
? ` ${attr.name}`
|
|
264
|
+
: ` ${attr.name}="${escapeAttribute(attr.value)}"`)
|
|
265
|
+
.join("");
|
|
266
|
+
}
|
|
267
|
+
// Values are kept as written (entities and all); only the quote we wrap them
|
|
268
|
+
// in needs escaping.
|
|
269
|
+
function escapeAttribute(value) {
|
|
270
|
+
return value.replace(/"/gu, """);
|
|
271
|
+
}
|
|
272
|
+
function decodeText(value) {
|
|
273
|
+
return value
|
|
274
|
+
.replace(/</gu, "<")
|
|
275
|
+
.replace(/>/gu, ">")
|
|
276
|
+
.replace(/"/gu, '"')
|
|
277
|
+
.replace(/'/gu, "'")
|
|
278
|
+
.replace(/&/gu, "&");
|
|
279
|
+
}
|
|
280
|
+
async function replaceAsync(text, pattern, replace) {
|
|
281
|
+
const parts = [];
|
|
282
|
+
let last = 0;
|
|
283
|
+
for (const match of text.matchAll(pattern)) {
|
|
284
|
+
const index = match.index ?? 0;
|
|
285
|
+
parts.push(Promise.resolve(text.slice(last, index)));
|
|
286
|
+
parts.push(replace(match[0], match.slice(1)));
|
|
287
|
+
last = index + match[0].length;
|
|
288
|
+
}
|
|
289
|
+
parts.push(Promise.resolve(text.slice(last)));
|
|
290
|
+
return (await Promise.all(parts)).join("");
|
|
291
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { configDir } from "./config.js";
|
|
4
|
+
export function publishedPagesPath(env = process.env) {
|
|
5
|
+
return join(configDir(env), "published.json");
|
|
6
|
+
}
|
|
7
|
+
async function readAll(path) {
|
|
8
|
+
try {
|
|
9
|
+
const parsed = JSON.parse(await readFile(path, "utf8"));
|
|
10
|
+
return parsed && typeof parsed === "object"
|
|
11
|
+
? parsed
|
|
12
|
+
: {};
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
return {};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
/** The app this page went to on this deployment, if any. */
|
|
19
|
+
export async function publishedPage(entry, apiUrl, path = publishedPagesPath()) {
|
|
20
|
+
const page = (await readAll(path))[entry];
|
|
21
|
+
return page?.apiUrl === apiUrl ? page : undefined;
|
|
22
|
+
}
|
|
23
|
+
export async function rememberPublishedPage(entry, page, path = publishedPagesPath()) {
|
|
24
|
+
const pages = await readAll(path);
|
|
25
|
+
pages[entry] = page;
|
|
26
|
+
await mkdir(dirname(path), { mode: 0o700, recursive: true });
|
|
27
|
+
await writeFile(path, `${JSON.stringify(pages, null, 2)}\n`, {
|
|
28
|
+
mode: 0o600,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
export const OAUTH_NEXT = {
|
|
2
|
+
antigravity: "Antigravity CLI: open /mcp and authenticate talentos.",
|
|
3
|
+
claude: "Claude Code: run /mcp, pick talentos, choose Authenticate.",
|
|
4
|
+
codex: "Codex: run `codex mcp login talentos`.",
|
|
5
|
+
gemini: "Gemini CLI: run /mcp auth talentos.",
|
|
6
|
+
};
|
|
7
|
+
export function setupEntry(url, key) {
|
|
8
|
+
return {
|
|
9
|
+
mcpServers: {
|
|
10
|
+
talentos: { url, headers: { Authorization: `Bearer ${key}` } },
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export function setupSnippet(client, mode, connection) {
|
|
15
|
+
const { apiUrl, key, url } = connection;
|
|
16
|
+
switch (client) {
|
|
17
|
+
// Antigravity CLI: remote servers take `serverUrl` (antigravity.google/docs/mcp).
|
|
18
|
+
case "antigravity":
|
|
19
|
+
return JSON.stringify({
|
|
20
|
+
mcpServers: {
|
|
21
|
+
talentos: mode === "oauth"
|
|
22
|
+
? { serverUrl: url }
|
|
23
|
+
: {
|
|
24
|
+
serverUrl: url,
|
|
25
|
+
headers: { Authorization: `Bearer ${key}` },
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
}, null, 2);
|
|
29
|
+
case "claude":
|
|
30
|
+
return `claude mcp add --scope user --transport http talentos ${url}${mode === "key" ? ` --header 'Authorization: Bearer ${key}'` : ""}`;
|
|
31
|
+
case "codex":
|
|
32
|
+
return [
|
|
33
|
+
"[mcp_servers.talentos]",
|
|
34
|
+
...(mode === "oauth"
|
|
35
|
+
? [`url = ${JSON.stringify(url)}`]
|
|
36
|
+
: [
|
|
37
|
+
'command = "npx"',
|
|
38
|
+
'args = ["-y", "talentos@1", "mcp"]',
|
|
39
|
+
connection.inheritKey
|
|
40
|
+
? 'env_vars = ["TALENTOS_API_KEY", "TALENTOS_API_URL"]'
|
|
41
|
+
: `env = { TALENTOS_API_KEY = ${JSON.stringify(key)}, TALENTOS_API_URL = ${JSON.stringify(apiUrl)} }`,
|
|
42
|
+
]),
|
|
43
|
+
].join("\n");
|
|
44
|
+
case "cursor":
|
|
45
|
+
return JSON.stringify(setupEntry(url,
|
|
46
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: Cursor's native environment interpolation.
|
|
47
|
+
connection.inheritKey ? "${env:TALENTOS_API_KEY}" : key), null, 2);
|
|
48
|
+
case "gemini":
|
|
49
|
+
return JSON.stringify({
|
|
50
|
+
mcpServers: {
|
|
51
|
+
talentos: mode === "oauth"
|
|
52
|
+
? { httpUrl: url }
|
|
53
|
+
: { httpUrl: url, headers: { Authorization: `Bearer ${key}` } },
|
|
54
|
+
},
|
|
55
|
+
}, null, 2);
|
|
56
|
+
default:
|
|
57
|
+
throw new Error(`Unknown setup client: ${client}`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The one message a member pastes into any agent. It carries its own fallback
|
|
62
|
+
* for an agent that cannot open links or change its own settings (a chat
|
|
63
|
+
* app), so even then the agent tells the person the one next step.
|
|
64
|
+
*/
|
|
65
|
+
export function startMessage(origin) {
|
|
66
|
+
return `Set up TalentOS for me. The guide is at ${origin}/start. If you can't open links or change your own settings, tell me to add this custom connector: ${origin}/mcp`;
|
|
67
|
+
}
|
|
68
|
+
export function renderStartGuide(origin, apiOrigin = origin) {
|
|
69
|
+
const url = `${origin}/mcp`;
|
|
70
|
+
const connection = {
|
|
71
|
+
apiUrl: apiOrigin,
|
|
72
|
+
// biome-ignore lint/suspicious/noTemplateCurlyInString: the client expands this environment placeholder.
|
|
73
|
+
key: "${TALENTOS_API_KEY}",
|
|
74
|
+
url,
|
|
75
|
+
inheritKey: true,
|
|
76
|
+
};
|
|
77
|
+
const snippet = (client, mode) => setupSnippet(client, mode, connection);
|
|
78
|
+
return `# Connect your agent to TalentOS
|
|
79
|
+
|
|
80
|
+
Paste this into your agent:
|
|
81
|
+
\`\`\`text
|
|
82
|
+
${startMessage(origin)}
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
Act as the member who asked you to connect. The person signs in and consents; never approve for them. Work in your own session; delegate to their Talent only when explicitly asked (it uses their AI credits).
|
|
86
|
+
|
|
87
|
+
MCP server (Streamable HTTP): ${url}
|
|
88
|
+
|
|
89
|
+
## 1. Agent: set up and verify
|
|
90
|
+
|
|
91
|
+
Identify the client you are running in. With terminal and filesystem access:
|
|
92
|
+
|
|
93
|
+
1. Set umask 077, then back up its config to a new private mode-600 copy outside repositories. Never print or paste the config or backup's contents, including tool output.
|
|
94
|
+
2. Merge only TalentOS with a JSON/TOML-aware edit run locally; preserve other servers and settings, without duplicates. Validate the JSON or TOML before saving; check the client's MCP server list.
|
|
95
|
+
3. Have the member sign in. Registration, sign-in and loading tools are separate steps; reload the client/session if needed.
|
|
96
|
+
|
|
97
|
+
If you cannot change your own settings (ChatGPT, Claude, Grok, Gemini and other chat apps), give the person only your own app's step from the list below, and wait. Coding sessions without config/terminal access also hand the exact command to the user.
|
|
98
|
+
|
|
99
|
+
After either path, call this client's \`whoami\` with \`{}\`. Do not claim success until \`whoami\` succeeds. Confirm the member and company with the user before any write. On failure, run \`npx -y talentos@1 doctor --api-url ${apiOrigin}\` and follow its next step. Reconnect after changing company or revoking a key.
|
|
100
|
+
|
|
101
|
+
## 2. Connect once
|
|
102
|
+
|
|
103
|
+
Any client: add the server URL with no header and let it sign in (OAuth): the member clicks Allow on the TalentOS page. Use a key only when the client has no OAuth for remote servers, or for headless/CI. If sign-in is refused because the workspace has not turned it on, a client with a key mode uses the key fallback below (Antigravity CLI: \`init --for antigravity\`, which stores the key privately). CLI: Node 22.23.4–22.x or 24.22.1–24.x.
|
|
104
|
+
|
|
105
|
+
**Claude Code** — run:
|
|
106
|
+
\`\`\`sh
|
|
107
|
+
${snippet("claude", "oauth")}
|
|
108
|
+
\`\`\`
|
|
109
|
+
${OAUTH_NEXT.claude} Restart the session if needed.
|
|
110
|
+
|
|
111
|
+
In auto mode the user runs this \`!\` line, then authenticates via \`/mcp\`; you cannot send it for them:
|
|
112
|
+
\`\`\`text
|
|
113
|
+
!${snippet("claude", "oauth")}
|
|
114
|
+
\`\`\`
|
|
115
|
+
|
|
116
|
+
**Codex** — merge into ~/.codex/config.toml:
|
|
117
|
+
\`\`\`toml
|
|
118
|
+
${snippet("codex", "oauth")}
|
|
119
|
+
\`\`\`
|
|
120
|
+
Run \`codex mcp login talentos\` (add \`--no-browser\` on a remote terminal).
|
|
121
|
+
|
|
122
|
+
**Antigravity CLI** (agy) — merge into ~/.gemini/config/mcp_config.json, then open \`/mcp\` and authenticate talentos:
|
|
123
|
+
\`\`\`json
|
|
124
|
+
${snippet("antigravity", "oauth")}
|
|
125
|
+
\`\`\`
|
|
126
|
+
|
|
127
|
+
**Gemini CLI** — run \`gemini mcp add --scope user --transport http talentos ${url}\`, then \`/mcp auth talentos\` in Gemini (needs a local browser).
|
|
128
|
+
|
|
129
|
+
**Cursor** — key fallback; merge into ~/.cursor/mcp.json. Keep the environment reference; never substitute a literal key:
|
|
130
|
+
\`\`\`json
|
|
131
|
+
${snippet("cursor", "key")}
|
|
132
|
+
\`\`\`
|
|
133
|
+
Launch Cursor with the variable set (a GUI launch may not inherit it); reload and enable talentos.
|
|
134
|
+
|
|
135
|
+
**Any other client** — add ${url} as a Streamable HTTP server named talentos and sign in. Without OAuth, send \`Authorization: Bearer <key>\` through the client's own environment-variable syntax; stdio-only clients launch \`npx -y talentos@1 mcp\` with the variables below.
|
|
136
|
+
|
|
137
|
+
**Server bot** (Hermes, OpenClaw, your own) — sign in as above; if \`set_wake_up\` is offered, call it once with your https address and the key it expects. The owner's Allow in Settings, Agents turns it on.
|
|
138
|
+
|
|
139
|
+
**Apps (the user does this)** — never paste a key into chat. Plan or admin access may be required.
|
|
140
|
+
- ChatGPT: Settings → Apps → Advanced settings → Developer mode, then create an app: URL \`${url}\`, OAuth, Connect. It still checks with you before deleting or overwriting anything.
|
|
141
|
+
- Claude.ai: Settings → Connectors → Add custom connector: TalentOS, URL \`${url}\`, Connect; when it asks to use TalentOS, choose "Always allow" (not "Allow once").
|
|
142
|
+
- Grok: Settings → Connect Apps → Add a custom connector: Name TalentOS, Server URL \`${url}\`, Add MCP, then sign in.
|
|
143
|
+
- Gemini app: Settings → Connectors → + Custom: URL \`${url}\`, Connect. If it asks for a client ID, use a terminal agent instead.
|
|
144
|
+
- Antigravity app: Customizations → Installed → MCP Servers → Copy Config File Path; add talentos with \`serverUrl\` \`${url}\` as for Antigravity CLI, then Authenticate, Allow, paste the code back, Submit.
|
|
145
|
+
|
|
146
|
+
### Key fallback: headless / CI
|
|
147
|
+
|
|
148
|
+
Member: create a personal key in TalentOS Settings → Agents → Advanced keys. Inject TALENTOS_API_KEY via your secret manager; keep it out of chat, repositories and logs. Set endpoints:
|
|
149
|
+
\`\`\`sh
|
|
150
|
+
export TALENTOS_API_URL='${apiOrigin}'
|
|
151
|
+
export MCP_PUBLIC_ORIGIN='${origin}'
|
|
152
|
+
npx -y talentos@1 whoami
|
|
153
|
+
\`\`\`
|
|
154
|
+
Claude Code: keep the single quotes so the shell stores the reference; start Claude with TALENTOS_API_KEY set. Remove an existing entry first (\`claude mcp remove --scope user talentos\`):
|
|
155
|
+
\`\`\`sh
|
|
156
|
+
${snippet("claude", "key")}
|
|
157
|
+
\`\`\`
|
|
158
|
+
Codex: Replace the existing [mcp_servers.talentos] section (no duplicate):
|
|
159
|
+
\`\`\`toml
|
|
160
|
+
${snippet("codex", "key")}
|
|
161
|
+
\`\`\`
|
|
162
|
+
Gemini CLI: merge into ~/.gemini/settings.json; Gemini expands the variable:
|
|
163
|
+
\`\`\`json
|
|
164
|
+
${snippet("gemini", "key")}
|
|
165
|
+
\`\`\`
|
|
166
|
+
|
|
167
|
+
CLI-assisted setup: \`npx -y talentos@1 init --for claude --oauth --no-pull --api-url ${apiOrigin}\` (or \`--for codex\`, \`gemini\`, \`antigravity\`).
|
|
168
|
+
|
|
169
|
+
## 3. Discover tools and work
|
|
170
|
+
|
|
171
|
+
The MCP \`tools/list\` response is authoritative: visibility depends on permissions and enabled flags. Examples: \`whoami\`, \`catch_up\`, \`list_rooms\`, \`read_room\`, \`post_message\`, \`read_file\`, \`create_file\`, \`create_web_app\`, \`list_skills\`, \`get_skill\`, \`memory_read\`, \`remember\`; delegation to the Talent only when asked: \`delegate_task\`, \`get_task\`.
|
|
172
|
+
|
|
173
|
+
**CLI equivalent:** \`tools\` lists tools with input schemas; \`call\` invokes them. It needs its own connection: \`npx -y talentos@1 login --api-url ${apiOrigin}\` (member approves in browser), or the key above in CI:
|
|
174
|
+
\`\`\`sh
|
|
175
|
+
HEADLESS_CLI_V1=true npx -y talentos@1 tools --json --api-url ${apiOrigin}
|
|
176
|
+
HEADLESS_CLI_V1=true npx -y talentos@1 call whoami --json '{}' --api-url ${apiOrigin}
|
|
177
|
+
\`\`\`
|
|
178
|
+
Use a discovered name/schema for \`call <tool> --json '<args>'\`. Same server permissions and human approvals. stdout is one \`{ok,data|error,next?}\` object; failures exit nonzero.
|
|
179
|
+
`;
|
|
180
|
+
}
|
package/dist/skill-files.js
CHANGED
|
@@ -46,7 +46,7 @@ export async function writeSkillPackage(dir, slug, files) {
|
|
|
46
46
|
* and a Windows drive or UNC path, none of which need a `..` segment to land
|
|
47
47
|
* outside the folder — while a name like `..notes.md` is perfectly legitimate.
|
|
48
48
|
*/
|
|
49
|
-
function escapesRoot(root, path) {
|
|
49
|
+
export function escapesRoot(root, path) {
|
|
50
50
|
if (isAbsolute(path) || win32.isAbsolute(path)) {
|
|
51
51
|
return true;
|
|
52
52
|
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
/** Lives next to the skill folders it describes; delete it to start over. */
|
|
5
|
+
export const SYNC_MANIFEST = ".talentos-sync.json";
|
|
6
|
+
export function hashFiles(files) {
|
|
7
|
+
return Object.fromEntries(files.map((file) => [file.path, sha(file.text)]));
|
|
8
|
+
}
|
|
9
|
+
export function sha(text) {
|
|
10
|
+
return createHash("sha256").update(text).digest("hex");
|
|
11
|
+
}
|
|
12
|
+
export async function readText(path) {
|
|
13
|
+
try {
|
|
14
|
+
return await readFile(path, "utf8");
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
export async function readManifest(dir) {
|
|
21
|
+
const raw = await readText(join(dir, SYNC_MANIFEST));
|
|
22
|
+
if (raw === undefined) {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
25
|
+
try {
|
|
26
|
+
const parsed = JSON.parse(raw);
|
|
27
|
+
return parsed && typeof parsed === "object" ? parsed : {};
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
// An unreadable manifest means nothing is known to be ours: every existing
|
|
31
|
+
// folder is then "differs", never overwritten.
|
|
32
|
+
return {};
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
export async function writeManifest(dir, manifest) {
|
|
36
|
+
await mkdir(dir, { recursive: true });
|
|
37
|
+
await writeFile(join(dir, SYNC_MANIFEST), `${JSON.stringify(manifest, null, 2)}\n`, "utf8");
|
|
38
|
+
}
|
package/dist/upload-file.js
CHANGED
|
@@ -40,7 +40,7 @@ export class UploadRefusal extends Error {
|
|
|
40
40
|
function refuse(message) {
|
|
41
41
|
throw new UploadRefusal(message);
|
|
42
42
|
}
|
|
43
|
-
function deniedSegment(segments) {
|
|
43
|
+
export function deniedSegment(segments) {
|
|
44
44
|
return segments.find((segment) => DENIED_SEGMENTS.has(segment.toLowerCase()) || DENIED_NAME.test(segment));
|
|
45
45
|
}
|
|
46
46
|
// Opens the file the model named, or refuses. Symlinks are resolved first and
|
package/dist/watch.js
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
const DEFAULT_WAIT_SECONDS = 40;
|
|
2
|
+
const DEFAULT_WATCH_MS = 10 * 60_000;
|
|
3
|
+
/** Follows existing work; a server read is never retried or replaced by a write. */
|
|
4
|
+
export async function watch(options) {
|
|
5
|
+
const deadline = options.deadline ?? Date.now() + DEFAULT_WATCH_MS;
|
|
6
|
+
const controller = new AbortController();
|
|
7
|
+
const interrupt = () => controller.abort();
|
|
8
|
+
const timeout = setTimeout(interrupt, Math.max(0, deadline - Date.now()));
|
|
9
|
+
timeout.unref();
|
|
10
|
+
process.once("SIGINT", interrupt);
|
|
11
|
+
try {
|
|
12
|
+
let current = await options.read(undefined, 0, controller.signal);
|
|
13
|
+
options.onChange(current);
|
|
14
|
+
while (options.isRunning(current) &&
|
|
15
|
+
!controller.signal.aborted &&
|
|
16
|
+
Date.now() < deadline) {
|
|
17
|
+
const remainingSeconds = Math.ceil((deadline - Date.now()) / 1000);
|
|
18
|
+
let next;
|
|
19
|
+
try {
|
|
20
|
+
next = await options.read(current, Math.min(options.waitSeconds ?? DEFAULT_WAIT_SECONDS, remainingSeconds), controller.signal);
|
|
21
|
+
}
|
|
22
|
+
catch (error) {
|
|
23
|
+
if (controller.signal.aborted) {
|
|
24
|
+
return current;
|
|
25
|
+
}
|
|
26
|
+
throw error;
|
|
27
|
+
}
|
|
28
|
+
if (options.version(next) !== options.version(current)) {
|
|
29
|
+
options.onChange(next);
|
|
30
|
+
}
|
|
31
|
+
current = next;
|
|
32
|
+
}
|
|
33
|
+
return current;
|
|
34
|
+
}
|
|
35
|
+
finally {
|
|
36
|
+
clearTimeout(timeout);
|
|
37
|
+
process.removeListener("SIGINT", interrupt);
|
|
38
|
+
}
|
|
39
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "talentos",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.0",
|
|
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 agent.",
|
|
6
6
|
"repository": {
|
|
@@ -12,7 +12,8 @@
|
|
|
12
12
|
"talentos": "./dist/index.js"
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist"
|
|
15
|
+
"dist",
|
|
16
|
+
"plugin"
|
|
16
17
|
],
|
|
17
18
|
"engines": {
|
|
18
19
|
"node": ">=22.23.4 <23 || >=24.22.1 <25"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "talentos",
|
|
3
|
+
"owner": { "name": "TalentOS", "url": "https://talentos.so" },
|
|
4
|
+
"description": "TalentOS for Claude Code: your company's memory, Skills and Talent.",
|
|
5
|
+
"plugins": [
|
|
6
|
+
{
|
|
7
|
+
"name": "talentos",
|
|
8
|
+
"source": "./plugins/talentos",
|
|
9
|
+
"description": "Connect Claude Code to your company's TalentOS: sign in once in the browser, then use shared memory, Skills, Routines and your Talent."
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "talentos",
|
|
3
|
+
"displayName": "TalentOS",
|
|
4
|
+
"version": "0.1.1",
|
|
5
|
+
"description": "Connect Claude Code to your company's TalentOS: sign in once in the browser, then use shared memory, Skills, Routines and your Talent.",
|
|
6
|
+
"author": { "name": "TalentOS", "url": "https://talentos.so" },
|
|
7
|
+
"homepage": "https://talentos.so",
|
|
8
|
+
"keywords": ["talentos", "memory", "skills", "mcp"]
|
|
9
|
+
}
|