xiaotime 0.6.1 → 0.7.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/ink/runSessionInk.d.ts.map +1 -1
- package/dist/ink/runSessionInk.js +16 -2
- package/dist/ink/runSessionInk.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/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 +23 -2
- package/dist/ws.js.map +1 -1
- package/package.json +1 -1
package/dist/settings.d.ts
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
* managed-task envelope; this is a UX gate for client-side tool
|
|
37
37
|
* approvals. Two allowlists, two audiences, two update cadences.
|
|
38
38
|
*/
|
|
39
|
-
export type AllowlistTool = "shell_command" | "write_file" | "git_commit";
|
|
39
|
+
export type AllowlistTool = "shell_command" | "write_file" | "git_commit" | "edit" | "web_fetch" | "run_background";
|
|
40
40
|
export interface AllowlistEntry {
|
|
41
41
|
tool: AllowlistTool;
|
|
42
42
|
pattern: string;
|
|
@@ -88,6 +88,14 @@ export declare function appendAllowlist(entry: {
|
|
|
88
88
|
* future commits.
|
|
89
89
|
*/
|
|
90
90
|
export declare function derivePattern(tool: AllowlistTool, input: Record<string, unknown>): string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Extract the lowercased host from a URL for web_fetch allowlist
|
|
93
|
+
* scoping. Returns null for anything that isn't a parseable http(s)
|
|
94
|
+
* URL — a non-http scheme must never be allowlistable, and an
|
|
95
|
+
* unparseable string must fall through to the prompt, never persist a
|
|
96
|
+
* broken entry (mirrors the flag-only guard in shell_command).
|
|
97
|
+
*/
|
|
98
|
+
export declare function _urlHost(raw: string): string | null;
|
|
91
99
|
/**
|
|
92
100
|
* Check whether a tool invocation matches any entry in the
|
|
93
101
|
* allowlist. Matching semantics differ per tool:
|
package/dist/settings.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH,MAAM,MAAM,aAAa,
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAMH,MAAM,MAAM,aAAa,GACrB,eAAe,GACf,YAAY,GACZ,YAAY,GACZ,MAAM,GACN,WAAW,GACX,gBAAgB,CAAC;AAWrB,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,aAAa,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AASD;;;;;GAKG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAKtC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,aAAa,IAAI,cAAc,EAAE,CAoChD;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,KAAK,EAAE;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,GAC9C,IAAI,CAwCN;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAC3B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAC7B,MAAM,GAAG,IAAI,CA6Df;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CASnD;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC9B,SAAS,EAAE,cAAc,EAAE,GAC1B,cAAc,GAAG,IAAI,CA2BvB"}
|
package/dist/settings.js
CHANGED
|
@@ -43,6 +43,9 @@ const ALLOWLIST_TOOLS = new Set([
|
|
|
43
43
|
"shell_command",
|
|
44
44
|
"write_file",
|
|
45
45
|
"git_commit",
|
|
46
|
+
"edit",
|
|
47
|
+
"web_fetch",
|
|
48
|
+
"run_background",
|
|
46
49
|
]);
|
|
47
50
|
/**
|
|
48
51
|
* Settings-file location. Resolved lazily per call so the
|
|
@@ -157,7 +160,9 @@ export function appendAllowlist(entry) {
|
|
|
157
160
|
* future commits.
|
|
158
161
|
*/
|
|
159
162
|
export function derivePattern(tool, input) {
|
|
160
|
-
if (tool === "shell_command") {
|
|
163
|
+
if (tool === "shell_command" || tool === "run_background") {
|
|
164
|
+
// run_background executes an arbitrary command line just like
|
|
165
|
+
// shell_command — same command-prefix allowlist derivation (#14608).
|
|
161
166
|
const cmd = String(input.command ?? "").trim();
|
|
162
167
|
if (!cmd)
|
|
163
168
|
return null;
|
|
@@ -184,7 +189,9 @@ export function derivePattern(tool, input) {
|
|
|
184
189
|
}
|
|
185
190
|
return result.join(" ");
|
|
186
191
|
}
|
|
187
|
-
if (tool === "write_file") {
|
|
192
|
+
if (tool === "write_file" || tool === "edit") {
|
|
193
|
+
// `edit` is a path-scoped file mutation, same as write_file — it
|
|
194
|
+
// shares the directory-glob allowlist semantics (#14608).
|
|
188
195
|
const p = String(input.path ?? "");
|
|
189
196
|
if (!p)
|
|
190
197
|
return null;
|
|
@@ -203,8 +210,37 @@ export function derivePattern(tool, input) {
|
|
|
203
210
|
if (tool === "git_commit") {
|
|
204
211
|
return "*";
|
|
205
212
|
}
|
|
213
|
+
if (tool === "web_fetch") {
|
|
214
|
+
// Host-scoped: allowlisting a fetch blesses the whole origin, so
|
|
215
|
+
// "run and don't ask again" on https://docs.foo.com/a permits
|
|
216
|
+
// https://docs.foo.com/b but never a different host (#14608).
|
|
217
|
+
const raw = String(input.url ?? "").trim();
|
|
218
|
+
if (!raw)
|
|
219
|
+
return null;
|
|
220
|
+
const host = _urlHost(raw);
|
|
221
|
+
return host === null ? null : `host:${host}`;
|
|
222
|
+
}
|
|
206
223
|
return null;
|
|
207
224
|
}
|
|
225
|
+
/**
|
|
226
|
+
* Extract the lowercased host from a URL for web_fetch allowlist
|
|
227
|
+
* scoping. Returns null for anything that isn't a parseable http(s)
|
|
228
|
+
* URL — a non-http scheme must never be allowlistable, and an
|
|
229
|
+
* unparseable string must fall through to the prompt, never persist a
|
|
230
|
+
* broken entry (mirrors the flag-only guard in shell_command).
|
|
231
|
+
*/
|
|
232
|
+
export function _urlHost(raw) {
|
|
233
|
+
let u;
|
|
234
|
+
try {
|
|
235
|
+
u = new URL(raw);
|
|
236
|
+
}
|
|
237
|
+
catch {
|
|
238
|
+
return null;
|
|
239
|
+
}
|
|
240
|
+
if (u.protocol !== "http:" && u.protocol !== "https:")
|
|
241
|
+
return null;
|
|
242
|
+
return u.host.toLowerCase();
|
|
243
|
+
}
|
|
208
244
|
/**
|
|
209
245
|
* Check whether a tool invocation matches any entry in the
|
|
210
246
|
* allowlist. Matching semantics differ per tool:
|
|
@@ -228,13 +264,13 @@ export function matchAllowlist(tool, input, allowlist) {
|
|
|
228
264
|
continue;
|
|
229
265
|
if (tool === "git_commit")
|
|
230
266
|
return entry;
|
|
231
|
-
if (tool === "shell_command") {
|
|
267
|
+
if (tool === "shell_command" || tool === "run_background") {
|
|
232
268
|
const derived = derivePattern(tool, input);
|
|
233
269
|
if (derived !== null && derived === entry.pattern)
|
|
234
270
|
return entry;
|
|
235
271
|
continue;
|
|
236
272
|
}
|
|
237
|
-
if (tool === "write_file") {
|
|
273
|
+
if (tool === "write_file" || tool === "edit") {
|
|
238
274
|
const raw = String(input.path ?? "");
|
|
239
275
|
if (!raw)
|
|
240
276
|
continue;
|
|
@@ -247,6 +283,12 @@ export function matchAllowlist(tool, input, allowlist) {
|
|
|
247
283
|
return entry;
|
|
248
284
|
continue;
|
|
249
285
|
}
|
|
286
|
+
if (tool === "web_fetch") {
|
|
287
|
+
const derived = derivePattern(tool, input);
|
|
288
|
+
if (derived !== null && derived === entry.pattern)
|
|
289
|
+
return entry;
|
|
290
|
+
continue;
|
|
291
|
+
}
|
|
250
292
|
}
|
|
251
293
|
return null;
|
|
252
294
|
}
|
package/dist/settings.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../src/settings.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAUzB,MAAM,eAAe,GAA+B,IAAI,GAAG,CAAC;IAC1D,eAAe;IACf,YAAY;IACZ,YAAY;IAC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AAM,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;IACzD,CAAC;IACD,8DAA8D;IAC9D,8DAA8D;IAC9D,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;QAC5B,MAAM,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QACpC,OAAO,CAAC,KAAK,MAAM,IAAI,CAAC,CAAC,UAAU,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC;IACpD,CAAC;IACD,OAAO,CAAC,KAAK,OAAO,CAAC;AACvB,CAAC"}
|
package/dist/skills.d.ts
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface SkillMeta {
|
|
2
|
+
name: string;
|
|
3
|
+
description: string;
|
|
4
|
+
dir: string;
|
|
5
|
+
}
|
|
6
|
+
export declare function skillRoots(baseDir?: string): string[];
|
|
7
|
+
export declare function parseFrontmatter(content: string, fallbackName: string): {
|
|
8
|
+
name: string;
|
|
9
|
+
description: string;
|
|
10
|
+
};
|
|
11
|
+
export declare function listSkills(baseDir?: string): SkillMeta[];
|
|
12
|
+
export declare function loadSkill(name: string, baseDir?: string): string | null;
|
|
13
|
+
export declare function renderSkillList(skills: SkillMeta[]): string;
|
|
14
|
+
//# sourceMappingURL=skills.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"skills.d.ts","sourceRoot":"","sources":["../src/skills.ts"],"names":[],"mappings":"AAoBA,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,GAAG,EAAE,MAAM,CAAC;CACb;AAGD,wBAAgB,UAAU,CAAC,OAAO,GAAE,MAAsB,GAAG,MAAM,EAAE,CAKpE;AAKD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,MAAM,EACf,YAAY,EAAE,MAAM,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAA;CAAE,CAevC;AAID,wBAAgB,UAAU,CAAC,OAAO,GAAE,MAAsB,GAAG,SAAS,EAAE,CAkCvE;AAGD,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,GAAE,MAAsB,GAAG,MAAM,GAAG,IAAI,CAWtF;AAGD,wBAAgB,eAAe,CAAC,MAAM,EAAE,SAAS,EAAE,GAAG,MAAM,CAO3D"}
|
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,EAA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O,CAAC,GAAG,EAAE;IACrE,KAAK,MAAM,KAAK,IAAI,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACxC,IAAI,KAAK,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC;gBACH,OAAO,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,UAAU,CAAC,EAAE,OAAO,CAAC,CAAC;YACpE,CAAC;YAAC,MAAM,CAAC;gBACP,OAAO,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,KAAK,GAAW,EAAE,CAAC;AAEvB;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,IAAa;IACpC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,+CAA+C,CAAC,CAAC;IACnE,CAAC;IACD,MAAM,IAAI,GAAW,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;QACvC,MAAM,IAAI,GAAG,GAA8C,CAAC;QAC5D,MAAM,OAAO,GAAG,OAAO,IAAI,EAAE,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC7E,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,EAAE,MAAM,IAAI,EAAE,CAAC,CAAC;QAC1C,IAAI,CAAC,OAAO;YAAE,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC;QACnE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC;YACvB,MAAM,IAAI,KAAK,CAAC,SAAS,CAAC,GAAG,CAAC,wBAAwB,MAAM,2CAA2C,CAAC,CAAC;QAC3G,CAAC;QACD,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAoB,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;IACH,KAAK,GAAG,IAAI,CAAC;IACb,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,QAAQ;IACtB,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,KAAK,GAAG,EAAE,CAAC;AACb,CAAC;AAED,MAAM,IAAI,GAA+B;IACvC,SAAS,EAAE,KAAK;IAChB,WAAW,EAAE,KAAK;IAClB,OAAO,EAAE,KAAK;CACf,CAAC;AAEF,oEAAoE;AACpE,MAAM,UAAU,WAAW,CAAC,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,W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