xiaotime 0.6.1 → 0.8.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/dist/background.d.ts +47 -0
- package/dist/background.d.ts.map +1 -0
- package/dist/background.js +110 -0
- package/dist/background.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +70 -1
- package/dist/index.js.map +1 -1
- package/dist/ink/App.d.ts +1 -0
- package/dist/ink/App.d.ts.map +1 -1
- package/dist/ink/App.js +11 -3
- package/dist/ink/App.js.map +1 -1
- package/dist/ink/runSessionInk.d.ts.map +1 -1
- package/dist/ink/runSessionInk.js +50 -2
- package/dist/ink/runSessionInk.js.map +1 -1
- package/dist/ink/store.d.ts +11 -0
- package/dist/ink/store.d.ts.map +1 -1
- package/dist/ink/store.js +12 -0
- package/dist/ink/store.js.map +1 -1
- package/dist/mcp.d.ts +94 -0
- package/dist/mcp.d.ts.map +1 -0
- package/dist/mcp.js +282 -0
- package/dist/mcp.js.map +1 -0
- package/dist/room_agent.d.ts +7 -0
- package/dist/room_agent.d.ts.map +1 -0
- package/dist/room_agent.js +395 -0
- package/dist/room_agent.js.map +1 -0
- package/dist/settings.d.ts +9 -1
- package/dist/settings.d.ts.map +1 -1
- package/dist/settings.js +46 -4
- package/dist/settings.js.map +1 -1
- package/dist/skills.d.ts +14 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +112 -0
- package/dist/skills.js.map +1 -0
- package/dist/todos.d.ts +26 -0
- package/dist/todos.d.ts.map +1 -0
- package/dist/todos.js +55 -0
- package/dist/todos.js.map +1 -0
- package/dist/tools.d.ts +26 -0
- package/dist/tools.d.ts.map +1 -1
- package/dist/tools.js +496 -1
- package/dist/tools.js.map +1 -1
- package/dist/ws.d.ts.map +1 -1
- package/dist/ws.js +34 -2
- package/dist/ws.js.map +1 -1
- package/package.json +2 -1
package/dist/skills.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Client-loadable skills -- SPRINT-CLI-CAPABILITY-PARITY-1 (#14608).
|
|
3
|
+
*
|
|
4
|
+
* Skills the agent can discover and pull in the project it is working in:
|
|
5
|
+
* every <dir>/.claude/skills/[slug]/SKILL.md under the session cwd, plus a
|
|
6
|
+
* user-global ~/.xiaotime/skills/. list_skills shows what is available
|
|
7
|
+
* (name + one-line description from the frontmatter); load_skill returns a
|
|
8
|
+
* skill's full instructions for the agent to follow on demand.
|
|
9
|
+
*
|
|
10
|
+
* Scope note (#14608): this is the PULL form -- the agent asks for a local
|
|
11
|
+
* skill and follows it. AMBIENT injection of client skills into the LLM
|
|
12
|
+
* system prompt is server-side (the brain builds the prompt via
|
|
13
|
+
* shared/skills + pipeline.py), so that half is a companion server change,
|
|
14
|
+
* not a CLI one -- the same client/server boundary as sub-agents.
|
|
15
|
+
*/
|
|
16
|
+
import * as fs from "fs";
|
|
17
|
+
import * as os from "os";
|
|
18
|
+
import * as path from "path";
|
|
19
|
+
// Skill search roots: the project's .claude/skills + a user-global one.
|
|
20
|
+
export function skillRoots(baseDir = process.cwd()) {
|
|
21
|
+
return [
|
|
22
|
+
path.join(baseDir, ".claude", "skills"),
|
|
23
|
+
path.join(os.homedir(), ".xiaotime", "skills"),
|
|
24
|
+
];
|
|
25
|
+
}
|
|
26
|
+
// Pull name / description out of a SKILL.md leading frontmatter block
|
|
27
|
+
// (--- ... ---). Minimal on purpose -- a full YAML parse is not worth a
|
|
28
|
+
// dependency for two scalar fields. Falls back to the directory name.
|
|
29
|
+
export function parseFrontmatter(content, fallbackName) {
|
|
30
|
+
let name = fallbackName;
|
|
31
|
+
let description = "";
|
|
32
|
+
const m = content.match(/^---\s*\n([\s\S]*?)\n---/);
|
|
33
|
+
if (m) {
|
|
34
|
+
for (const line of m[1].split("\n")) {
|
|
35
|
+
const kv = line.match(/^(name|description)\s*:\s*(.+?)\s*$/i);
|
|
36
|
+
if (kv) {
|
|
37
|
+
const val = kv[2].replace(/^["']|["']$/g, "");
|
|
38
|
+
if (kv[1].toLowerCase() === "name")
|
|
39
|
+
name = val;
|
|
40
|
+
else
|
|
41
|
+
description = val;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return { name, description };
|
|
46
|
+
}
|
|
47
|
+
// Discover every skill under the search roots, de-duplicated by name
|
|
48
|
+
// (first root wins).
|
|
49
|
+
export function listSkills(baseDir = process.cwd()) {
|
|
50
|
+
const seen = new Set();
|
|
51
|
+
const out = [];
|
|
52
|
+
for (const root of skillRoots(baseDir)) {
|
|
53
|
+
let entries;
|
|
54
|
+
try {
|
|
55
|
+
entries = fs.readdirSync(root);
|
|
56
|
+
}
|
|
57
|
+
catch {
|
|
58
|
+
continue; // root does not exist -- fine
|
|
59
|
+
}
|
|
60
|
+
entries.sort();
|
|
61
|
+
for (const entry of entries) {
|
|
62
|
+
const dir = path.join(root, entry);
|
|
63
|
+
const skillFile = path.join(dir, "SKILL.md");
|
|
64
|
+
let stat;
|
|
65
|
+
try {
|
|
66
|
+
stat = fs.statSync(dir);
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (!stat.isDirectory() || !fs.existsSync(skillFile))
|
|
72
|
+
continue;
|
|
73
|
+
let content;
|
|
74
|
+
try {
|
|
75
|
+
content = fs.readFileSync(skillFile, "utf-8");
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
continue;
|
|
79
|
+
}
|
|
80
|
+
const meta = parseFrontmatter(content, entry);
|
|
81
|
+
if (seen.has(meta.name))
|
|
82
|
+
continue;
|
|
83
|
+
seen.add(meta.name);
|
|
84
|
+
out.push({ name: meta.name, description: meta.description, dir });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
// Return a skill's full SKILL.md text, or null if no such skill is found.
|
|
90
|
+
export function loadSkill(name, baseDir = process.cwd()) {
|
|
91
|
+
for (const skill of listSkills(baseDir)) {
|
|
92
|
+
if (skill.name === name) {
|
|
93
|
+
try {
|
|
94
|
+
return fs.readFileSync(path.join(skill.dir, "SKILL.md"), "utf-8");
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return null;
|
|
102
|
+
}
|
|
103
|
+
// Render the discovered skills as a name/description list.
|
|
104
|
+
export function renderSkillList(skills) {
|
|
105
|
+
if (skills.length === 0) {
|
|
106
|
+
return "(no local skills found under ./.claude/skills or ~/.xiaotime/skills)";
|
|
107
|
+
}
|
|
108
|
+
return skills
|
|
109
|
+
.map((s) => (s.description ? s.name + " -- " + s.description : s.name))
|
|
110
|
+
.join("\n");
|
|
111
|
+
}
|
|
112
|
+
//# sourceMappingURL=skills.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.js","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAQ7B,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,UAAkB,OAAO,CAAC,GAAG,EAAE;IACxD,OAAO;QACL,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,SAAS,EAAE,QAAQ,CAAC;QACvC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,OAAO,EAAE,EAAE,WAAW,EAAE,QAAQ,CAAC;KAC/C,CAAC;AACJ,CAAC;AAED,sEAAsE;AACtE,wEAAwE;AACxE,sEAAsE;AACtE,MAAM,UAAU,gBAAgB,CAC9B,OAAe,EACf,YAAoB;IAEpB,IAAI,IAAI,GAAG,YAAY,CAAC;IACxB,IAAI,WAAW,GAAG,EAAE,CAAC;IACrB,MAAM,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AO,IAAI,CAAC;YACd,CAAC;QACH,CAAC;IACH,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,2DAA2D;AAC3D,MAAM,UAAU,eAAe,CAAC,MAAmB;IACjD,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACxB,OAAO,sEAAsE,CAAC;IAChF,CAAC;IACD,OAAO,MAAM;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,MAAM,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;SACtE,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
package/dist/todos.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task/todo tracking — SPRINT-CLI-CAPABILITY-PARITY-1 (#14608).
|
|
3
|
+
*
|
|
4
|
+
* A working-memory aid for multi-step work: the agent writes the whole
|
|
5
|
+
* task list each time (the Claude-Code TodoWrite shape — the list is
|
|
6
|
+
* state the model owns, not an append log), and the rendered checklist
|
|
7
|
+
* comes back as the tool result so it lands in the transcript for both
|
|
8
|
+
* the classic and Ink surfaces without either needing bespoke render
|
|
9
|
+
* wiring. Kept in a session-global store so a future status bar can read
|
|
10
|
+
* the current list.
|
|
11
|
+
*/
|
|
12
|
+
export type TodoStatus = "pending" | "in_progress" | "completed";
|
|
13
|
+
export interface Todo {
|
|
14
|
+
content: string;
|
|
15
|
+
status: TodoStatus;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Replace the whole list. Throws on a malformed entry so the tool
|
|
19
|
+
* surfaces a real error instead of silently storing junk.
|
|
20
|
+
*/
|
|
21
|
+
export declare function setTodos(list: unknown): Todo[];
|
|
22
|
+
export declare function getTodos(): Todo[];
|
|
23
|
+
export declare function clearTodos(): void;
|
|
24
|
+
/** Render the list as a plain-text checklist (tool-result body). */
|
|
25
|
+
export declare function renderTodos(list?: Todo[]): string;
|
|
26
|
+
//# sourceMappingURL=todos.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.d.ts","sourceRoot":"","sources":["../src/todos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,UAAU,GAAG,SAAS,GAAG,aAAa,GAAG,WAAW,CAAC;AAEjE,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,UAAU,CAAC;CACpB;AAMD;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,GAAG,IAAI,EAAE,CAgB9C;AAED,wBAAgB,QAAQ,IAAI,IAAI,EAAE,CAEjC;AAED,wBAAgB,UAAU,IAAI,IAAI,CAEjC;AAQD,oEAAoE;AACpE,wBAAgB,WAAW,CAAC,IAAI,GAAE,IAAI,EAAU,GAAG,MAAM,CAKxD"}
|
package/dist/todos.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task/todo tracking — SPRINT-CLI-CAPABILITY-PARITY-1 (#14608).
|
|
3
|
+
*
|
|
4
|
+
* A working-memory aid for multi-step work: the agent writes the whole
|
|
5
|
+
* task list each time (the Claude-Code TodoWrite shape — the list is
|
|
6
|
+
* state the model owns, not an append log), and the rendered checklist
|
|
7
|
+
* comes back as the tool result so it lands in the transcript for both
|
|
8
|
+
* the classic and Ink surfaces without either needing bespoke render
|
|
9
|
+
* wiring. Kept in a session-global store so a future status bar can read
|
|
10
|
+
* the current list.
|
|
11
|
+
*/
|
|
12
|
+
const VALID = new Set(["pending", "in_progress", "completed"]);
|
|
13
|
+
let todos = [];
|
|
14
|
+
/**
|
|
15
|
+
* Replace the whole list. Throws on a malformed entry so the tool
|
|
16
|
+
* surfaces a real error instead of silently storing junk.
|
|
17
|
+
*/
|
|
18
|
+
export function setTodos(list) {
|
|
19
|
+
if (!Array.isArray(list)) {
|
|
20
|
+
throw new Error("todos must be an array of { content, status }");
|
|
21
|
+
}
|
|
22
|
+
const next = list.map((raw, i) => {
|
|
23
|
+
const item = raw;
|
|
24
|
+
const content = typeof item?.content === "string" ? item.content.trim() : "";
|
|
25
|
+
const status = String(item?.status ?? "");
|
|
26
|
+
if (!content)
|
|
27
|
+
throw new Error(`todo #${i + 1} is missing content`);
|
|
28
|
+
if (!VALID.has(status)) {
|
|
29
|
+
throw new Error(`todo #${i + 1} has invalid status "${status}" (use pending / in_progress / completed)`);
|
|
30
|
+
}
|
|
31
|
+
return { content, status: status };
|
|
32
|
+
});
|
|
33
|
+
todos = next;
|
|
34
|
+
return todos;
|
|
35
|
+
}
|
|
36
|
+
export function getTodos() {
|
|
37
|
+
return todos;
|
|
38
|
+
}
|
|
39
|
+
export function clearTodos() {
|
|
40
|
+
todos = [];
|
|
41
|
+
}
|
|
42
|
+
const MARK = {
|
|
43
|
+
completed: "[x]",
|
|
44
|
+
in_progress: "[~]",
|
|
45
|
+
pending: "[ ]",
|
|
46
|
+
};
|
|
47
|
+
/** Render the list as a plain-text checklist (tool-result body). */
|
|
48
|
+
export function renderTodos(list = todos) {
|
|
49
|
+
if (list.length === 0)
|
|
50
|
+
return "(no tasks)";
|
|
51
|
+
const done = list.filter((t) => t.status === "completed").length;
|
|
52
|
+
const lines = list.map((t) => `${MARK[t.status]} ${t.content}`);
|
|
53
|
+
return `Tasks (${done}/${list.length} done):\n${lines.join("\n")}`;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=todos.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"todos.js","sourceRoot":"","sources":["../src/todos.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AASH,MAAM,KAAK,GAAwB,IAAI,GAAG,CAAC,CAAC,SAAS,EAAE,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC;AAEpF,IAAI,KAA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AAC,OAAe,KAAK;IAC9C,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,YAAY,CAAC;IAC3C,MAAM,IAAI,GAAG,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,WAAW,CAAC,CAAC,MAAM,CAAC;IACjE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;IAChE,OAAO,UAAU,IAAI,IAAI,IAAI,CAAC,MAAM,YAAY,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC"}
|
package/dist/tools.d.ts
CHANGED
|
@@ -47,4 +47,30 @@ export declare function executeTool(call: ToolCall, ui: SessionUI): Promise<Tool
|
|
|
47
47
|
export declare function listRecursive(dir: string, pattern?: string, cap?: number): string[];
|
|
48
48
|
export declare function _listDirectoryMax(): number;
|
|
49
49
|
export declare function globToRegex(glob: string): RegExp;
|
|
50
|
+
/** Count non-overlapping occurrences of `needle` in `hay`. */
|
|
51
|
+
export declare function _countOccurrences(hay: string, needle: string): number;
|
|
52
|
+
/**
|
|
53
|
+
* Replace the first literal occurrence of `needle` with `repl`.
|
|
54
|
+
* Uses index-splicing (not String.replace) so `$&`/`$1` sequences in
|
|
55
|
+
* `repl` are inserted verbatim rather than interpreted as regex
|
|
56
|
+
* back-references (#14608 — the surgical-edit correctness trap).
|
|
57
|
+
*/
|
|
58
|
+
export declare function _replaceFirst(hay: string, needle: string, repl: string): string;
|
|
59
|
+
/**
|
|
60
|
+
* Recursively grep a directory tree. Skips dotfiles, node_modules,
|
|
61
|
+
* binary files (any NUL byte), and files larger than 2 MB. Returns
|
|
62
|
+
* `relpath:lineno:linetext` matches, capped at `cap`. Directory entries
|
|
63
|
+
* are visited in sorted order for deterministic output.
|
|
64
|
+
*/
|
|
65
|
+
export declare function grepTree(dir: string, regex: RegExp, glob?: string, cap?: number): {
|
|
66
|
+
matches: string[];
|
|
67
|
+
truncated: boolean;
|
|
68
|
+
};
|
|
69
|
+
/**
|
|
70
|
+
* Reduce an HTML document to readable text: drop script/style/comments
|
|
71
|
+
* and tags, decode the common named entities, and collapse whitespace.
|
|
72
|
+
* Intentionally minimal — enough to make a fetched page legible to the
|
|
73
|
+
* agent, not a full HTML parser.
|
|
74
|
+
*/
|
|
75
|
+
export declare function stripHtml(html: string): string;
|
|
50
76
|
//# sourceMappingURL=tools.d.ts.map
|
package/dist/tools.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"tools.d.ts","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAOH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAa/C,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC;AAED,MAAM,WAAW,UAAU;IACzB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;CACnB;AAiBD,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE;QACZ,IAAI,EAAE,QAAQ,CAAC;QACf,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE;YAAE,IAAI,EAAE,MAAM,CAAC;YA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