@taloswork/ose-shared 0.1.15 → 0.1.17
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/package.json +3 -3
- package/skills/document/SKILL.md +20 -15
- package/skills/document/assets/fonts/fonts.json +1 -1
- package/skills/document/bin/deck-build.cjs +2 -1
- package/skills/document/bin/deck-chart.cjs +2 -1
- package/skills/document/bin/deck-qa.cjs +58 -43
- package/skills/document/bin/doc-convert.cjs +53971 -14710
- package/skills/document/bin/doc-fill.cjs +7 -5
- package/skills/document/bin/doc-gen.cjs +66172 -27127
- package/skills/document/bin/doc-scan.cjs +13 -9
- package/skills/document/bin/doc-text.cjs +13 -9
- package/skills/document/bin/doc-validate.cjs +15 -12
- package/skills/document/bin/html2pptx.cjs +84 -40
- package/skills/document/bin/ocr.cjs +14 -4
- package/skills/document/bin/pdf-form.cjs +31 -14
- package/skills/document/bin/pdf-images.cjs +22 -4
- package/skills/document/bin/pdf-ops.cjs +31 -14
- package/skills/document/bin/pdf-render.cjs +21 -3
- package/skills/document/bin/pdf-tables.cjs +7 -1
- package/skills/document/bin/pptx-clone.cjs +9 -16
- package/skills/document/bin/pptx-slide.cjs +9 -16
- package/skills/document/bin/template-skin.cjs +7 -1
- package/skills/document/bin/xlsx-recalc.cjs +9 -2
- package/skills/document/bin-reference.md +5 -5
- package/skills/document/content-pipeline.md +18 -21
- package/skills/document/deck-design.md +2 -2
- package/skills/document/rewrite.md +21 -16
- package/skills/document/vision.md +1 -1
- package/skills/expert-create/LICENSE.txt +7 -0
- package/skills/expert-create/SKILL.md +106 -0
- package/skills/expert-create/bin/expert-create.cjs +96 -0
- package/skills/expert-create/references/role-guide.md +24 -0
- package/skills/image-layout/SKILL.md +3 -3
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// expert-create — thin client for the Talos app's local expert service.
|
|
3
|
+
// All validation and every file write happen in the app; this only forwards.
|
|
4
|
+
//
|
|
5
|
+
// expert-create list
|
|
6
|
+
// expert-create show <id>
|
|
7
|
+
// expert-create create <draft.json> (Talos asks the user to confirm)
|
|
8
|
+
// expert-create update <id> <patch.json> (Talos asks the user to confirm)
|
|
9
|
+
// expert-create delete <id> (Talos asks the user to confirm)
|
|
10
|
+
"use strict";
|
|
11
|
+
const { readFileSync } = require("node:fs");
|
|
12
|
+
const http = require("node:http");
|
|
13
|
+
|
|
14
|
+
function die(message, code) { process.stderr.write(`expert-create: ${message}\n`); process.exit(code); }
|
|
15
|
+
const USAGE = "usage: expert-create list | show <id> | create <draft.json> | update <id> <patch.json> | delete <id>";
|
|
16
|
+
|
|
17
|
+
function readJson(path) {
|
|
18
|
+
let raw;
|
|
19
|
+
try { raw = readFileSync(path, "utf8"); } catch (e) { die(`cannot read ${path}: ${e.message}`, 66); }
|
|
20
|
+
try { return JSON.parse(raw); } catch (e) { die(`${path} is not valid JSON: ${e.message}`, 65); }
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
function request(argv) {
|
|
24
|
+
const [action, a, b] = argv;
|
|
25
|
+
switch (action) {
|
|
26
|
+
case "list": return { action };
|
|
27
|
+
case "show": case "delete": if (!a) die(USAGE, 64); return { action, id: a };
|
|
28
|
+
case "create": if (!a) die(USAGE, 64); return { action, draft: readJson(a) };
|
|
29
|
+
case "update": if (!a || !b) die(USAGE, 64); return { action, id: a, patch: readJson(b) };
|
|
30
|
+
default: die(USAGE, 64);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
// What a refused or unanswered confirmation left undone, per action.
|
|
35
|
+
const UNDONE = {
|
|
36
|
+
create: ["creation", "created"],
|
|
37
|
+
update: ["edit", "changed"],
|
|
38
|
+
delete: ["deletion", "deleted"],
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
function errorCode(text) {
|
|
42
|
+
try { return JSON.parse(text).error; } catch { return undefined; }
|
|
43
|
+
}
|
|
44
|
+
function messageOf(text) {
|
|
45
|
+
try { const m = JSON.parse(text).message; return typeof m === "string" ? m : undefined; } catch { return undefined; }
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// node:http, not global fetch: fetch (undici) drops a response whose headers
|
|
49
|
+
// take over 300 s, and a create, update or delete waits on the user's
|
|
50
|
+
// confirmation for up to 5 minutes. The app ends that wait itself (HTTP 408).
|
|
51
|
+
function post(url, token, body) {
|
|
52
|
+
return new Promise((resolve, reject) => {
|
|
53
|
+
const payload = Buffer.from(JSON.stringify(body));
|
|
54
|
+
const req = http.request(`${url}/expert`, {
|
|
55
|
+
method: "POST",
|
|
56
|
+
headers: { authorization: `Bearer ${token}`, "content-type": "application/json", "content-length": payload.length },
|
|
57
|
+
}, (res) => {
|
|
58
|
+
const chunks = [];
|
|
59
|
+
res.on("data", (c) => chunks.push(c));
|
|
60
|
+
res.on("end", () => resolve({ status: res.statusCode ?? 0, text: Buffer.concat(chunks).toString("utf8") }));
|
|
61
|
+
res.on("error", reject);
|
|
62
|
+
});
|
|
63
|
+
req.on("error", reject);
|
|
64
|
+
req.end(payload);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
async function main() {
|
|
69
|
+
const body = request(process.argv.slice(2));
|
|
70
|
+
const url = process.env.TALOS_EXPERT_URL;
|
|
71
|
+
const token = process.env.TALOS_EXPERT_TOKEN;
|
|
72
|
+
// Talos hands these only to a conversation with the user; a scheduled task,
|
|
73
|
+
// a sub-agent or a channel session never has them.
|
|
74
|
+
if (!url || !token) die("this needs the Talos app and a conversation with the user (TALOS_EXPERT_URL is not set). Scheduled tasks and sub-agents cannot change experts; do not write expert files yourself.", 69);
|
|
75
|
+
let res;
|
|
76
|
+
try {
|
|
77
|
+
res = await post(url, token, body);
|
|
78
|
+
} catch (e) { die(`cannot reach the Talos app: ${e.message}`, 69); }
|
|
79
|
+
const { status, text } = res;
|
|
80
|
+
const undone = UNDONE[body.action];
|
|
81
|
+
const error = errorCode(text);
|
|
82
|
+
if (undone && status === 409 && error === "cancelled_by_user") die(`the user cancelled the ${undone[0]}; nothing was ${undone[1]}`, 3);
|
|
83
|
+
if (undone && status === 408) die(`confirmation timed out; nothing was ${undone[1]}`, 4);
|
|
84
|
+
// The update would leave the expert as it is: the app wrote nothing and
|
|
85
|
+
// asked the user nothing.
|
|
86
|
+
if (status === 422 && error === "no_change") die(`${messageOf(text) ?? "the patch changes nothing"}; nothing was changed`, 5);
|
|
87
|
+
// Talos itself is not ready (no runtime yet, or the profile changed while
|
|
88
|
+
// the dialog was open). Not the request's fault, so not exit 1 ("fix the
|
|
89
|
+
// field and retry"): a retry would ask the user again about a runtime that
|
|
90
|
+
// is not the one they were shown.
|
|
91
|
+
if (status === 503 && error === "not_ready") die(`the Talos app is not ready (it is starting or switched profile); nothing was ${undone ? undone[1] : "done"}. Do not retry; tell the user.`, 69);
|
|
92
|
+
if (status < 200 || status >= 300) die(`HTTP ${status}${text ? `: ${text}` : ""}`, 1);
|
|
93
|
+
process.stdout.write(`${text}\n`);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
main();
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# Writing an expert's role
|
|
2
|
+
|
|
3
|
+
The role is the first thing the model reads in every conversation with this
|
|
4
|
+
expert, before Talos's own rules and tools. Keep it about the domain and the
|
|
5
|
+
voice; Talos already explains its tools, files and safety rules — do not repeat
|
|
6
|
+
or override them.
|
|
7
|
+
|
|
8
|
+
Structure, in this order, as plain Markdown:
|
|
9
|
+
|
|
10
|
+
1. **Who you are** — one or two sentences: the role, who it serves.
|
|
11
|
+
2. **What you do** — the concrete jobs, as a short list.
|
|
12
|
+
3. **How you work** — the method: what to check first, what to ask the user
|
|
13
|
+
before starting, the order of work, the quality bar.
|
|
14
|
+
4. **What you deliver** — formats and shapes of the output (a PDF report, an
|
|
15
|
+
Excel model, a list of options with a recommendation).
|
|
16
|
+
5. **Boundaries** — what this expert does not do, and when to say so.
|
|
17
|
+
|
|
18
|
+
Rules:
|
|
19
|
+
- Write instructions to the model ("Ask for the target market before…"), not a
|
|
20
|
+
description of a product.
|
|
21
|
+
- Be specific to the domain; a generic "be helpful and accurate" adds nothing.
|
|
22
|
+
- No tool names, file paths or claims about Talos features — they change and
|
|
23
|
+
the role would mislead.
|
|
24
|
+
- Under ~600 words is usually enough; length is not quality.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: image-layout
|
|
3
|
-
description: "Use when EXISTING images (files already on disk) are combined or altered as pixels: 拼图 / 拼接 / 宫格 / 九宫格 / 长图 / 对比图 / 加水印 / 加标签 / 裁剪 / 圆角 / 缩放, stitch / combine / collage / contact sheet / side-by-side / before-after / watermark / label / crop / resize. The mechanical test: if the images do not exist as files yet, this is NOT the skill. Do NOT trigger for generating NEW images, INCLUDING when the request names a layout word ('生成一张九宫格的图' is one generated picture); documents (document skill);
|
|
3
|
+
description: "Use when EXISTING images (files already on disk) are combined or altered as pixels: 拼图 / 拼接 / 宫格 / 九宫格 / 长图 / 对比图 / 加水印 / 加标签 / 裁剪 / 圆角 / 缩放, stitch / combine / collage / contact sheet / side-by-side / before-after / watermark / label / crop / resize. The mechanical test: if the images do not exist as files yet, this is NOT the skill. Do NOT trigger for generating NEW images, INCLUDING when the request names a layout word ('生成一张九宫格的图' is one generated picture); documents (document skill); social-post cards (social-cards); or upscaling / background removal, which need a model."
|
|
4
4
|
license: Proprietary. LICENSE.txt has complete terms
|
|
5
5
|
---
|
|
6
6
|
|
|
@@ -146,7 +146,7 @@ tool.
|
|
|
146
146
|
creates imagery, it only arranges what exists.
|
|
147
147
|
- **A PDF / Word / PowerPoint deliverable** → the document skill (`doc-gen`,
|
|
148
148
|
`html2pptx`). Do not build a "poster" here and call it a document.
|
|
149
|
-
- **
|
|
150
|
-
|
|
149
|
+
- **Cards for a social post** → `social-cards` (`render`), which owns card
|
|
150
|
+
templates, every platform's card size and their QA.
|
|
151
151
|
- **Pixel-level algorithms** — background removal, super-resolution,
|
|
152
152
|
content-aware fill. CSS cannot do these; they need a model.
|