@leonidstern/labit 0.6.3-main.1 → 0.6.3-main.10

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.
@@ -2,7 +2,7 @@ import {
2
2
  WAIT_SAID,
3
3
  findLab,
4
4
  labCall
5
- } from "./chunk-LNYMIFDQ.mjs";
5
+ } from "./chunk-QTMKKULT.mjs";
6
6
  import {
7
7
  mySession
8
8
  } from "./chunk-X4RYDWNI.mjs";
@@ -38,7 +38,7 @@ async function runMcp({ HERE, ME, CMD, VERSION, WRITE_SHORT, AGENTS, agentKind,
38
38
  done({ ok: !err, text: (stdout || "") + (err && !stdout ? stderr || err.message : "") });
39
39
  });
40
40
  });
41
- const forTools = (t) => t.replace(/^Answer each: .*$/m, "Answer each with the `reply` tool (id, text, resolve: true when done), then call `wait` again.");
41
+ const forTools = (t) => t.replace(/^Answer each: .*$/m, "Answer each with the `reply` tool (id, text, intent: done when it is done, question when you need the person), then call `wait` again.");
42
42
  const text = (t, isError = false) => ({ content: [{ type: "text", text: forTools(t).trim() || "(nothing)" }], ...isError ? { isError } : {} });
43
43
  const tools = [
44
44
  {
@@ -51,12 +51,13 @@ async function runMcp({ HERE, ME, CMD, VERSION, WRITE_SHORT, AGENTS, agentKind,
51
51
  {
52
52
  name: "reply",
53
53
  title: "Answer on a pin",
54
- description: `Answer on a pin in the local lab, by the id \`comments\` shows. resolve: true closes the thread. ${WRITE_SHORT}`,
54
+ description: `Answer on a pin in the local lab, by the id \`comments\` shows. intent says what the answer is: done (the thread closes), working (you're on it) or question (you need the person). resolve: true closes the thread. ${WRITE_SHORT}`,
55
55
  inputSchema: {
56
56
  type: "object",
57
57
  properties: {
58
58
  id: { type: "string", description: "The comment id" },
59
- text: { type: "string", description: 'What you did, e.g. "Done: the title is red"' },
59
+ text: { type: "string", description: 'What you did, e.g. "The title is red"' },
60
+ intent: { type: "string", enum: ["done", "working", "question"], description: "done: the ask is done; working: you are on it; question: you need the person" },
60
61
  resolve: { type: "boolean", description: "Close the thread" },
61
62
  dir: { type: "string", description: "The project folder, if the server started somewhere else (default: the client's root or the folder it started in)" }
62
63
  },
@@ -65,6 +66,24 @@ async function runMcp({ HERE, ME, CMD, VERSION, WRITE_SHORT, AGENTS, agentKind,
65
66
  },
66
67
  annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
67
68
  },
69
+ {
70
+ name: "pin",
71
+ title: "Leave your own pin",
72
+ description: `Leave your own pin on a spot of a page in the local lab: for suggestions and questions about the page, one pin per point, numbered, instead of a list in a reply. Returns the pin's id. ${WRITE_SHORT}`,
73
+ inputSchema: {
74
+ type: "object",
75
+ properties: {
76
+ selector: { type: "string", description: 'CSS selector of the element, e.g. "#pricing h2"' },
77
+ text: { type: "string", description: 'The suggestion or question, e.g. "1. The price is easy to miss: make it bigger?"' },
78
+ page: { type: "string", description: "The page: its path (/pricing), file (pricing.html) or address. Default: the lab's only page" },
79
+ at: { type: "string", description: 'Where on the element, x,y as shares of it (default "0.5,0.5", its middle)' },
80
+ dir: { type: "string", description: "The project folder, if the server started somewhere else (default: the client's root or the folder it started in)" }
81
+ },
82
+ required: ["selector", "text"],
83
+ additionalProperties: false
84
+ },
85
+ annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: false, openWorldHint: false }
86
+ },
68
87
  {
69
88
  name: "wait",
70
89
  title: "Wait for the next pin",
@@ -115,8 +134,17 @@ async function runMcp({ HERE, ME, CMD, VERSION, WRITE_SHORT, AGENTS, agentKind,
115
134
  if (typeof a.id !== "string" || !a.id.trim()) return text("`id` is required: the comment id that `comments` shows.", true);
116
135
  if (typeof a.text !== "string" || !a.text.trim()) return text("`text` is required: what you did.", true);
117
136
  if (a.resolve !== void 0 && typeof a.resolve !== "boolean") return text("`resolve` must be true or false.", true);
137
+ const flag = { done: "--done", working: "--on-it", question: "--question" }[a.intent];
138
+ if (a.intent !== void 0 && !flag) return text("`intent` must be done, working or question.", true);
118
139
  if (a.dir !== void 0 && typeof a.dir !== "string") return text("`dir` must be a folder path.", true);
119
- const r = await run(["reply", a.id, a.text, ...a.resolve ? ["--resolve"] : []], 3e4, project(a));
140
+ const r = await run(["reply", a.id, a.text, ...flag ? [flag] : [], ...a.resolve ? ["--resolve"] : []], 3e4, project(a));
141
+ return text(r.text, !r.ok);
142
+ }
143
+ if (name === "pin") {
144
+ for (const k of ["selector", "text"])
145
+ if (typeof a[k] !== "string" || !a[k].trim()) return text(`\`${k}\` is required: ${k === "selector" ? "the CSS selector of the element" : "your suggestion or question"}.`, true);
146
+ for (const k of ["page", "at", "dir"]) if (a[k] !== void 0 && typeof a[k] !== "string") return text(`\`${k}\` must be a string.`, true);
147
+ const r = await run(["pin", ...a.page ? ["--page", a.page] : [], ...a.at ? ["--at", a.at] : [], "--", a.selector, a.text], 3e4, project(a));
120
148
  return text(r.text, !r.ok);
121
149
  }
122
150
  if (a.seconds !== void 0 && (typeof a.seconds !== "number" || !Number.isFinite(a.seconds))) return text("`seconds` must be a number.", true);
@@ -7,7 +7,7 @@ import {
7
7
  import fs from "node:fs";
8
8
  import os from "node:os";
9
9
  import path from "node:path";
10
- var SHORTCUTS = { toggle: "m", comment: "1", go: "2", zoom: "3", pointer: "4", chat: "c", next: "w", pause: "p", done: "d", reply: "r", resolve: "e" };
10
+ var SHORTCUTS = { toggle: "m", comment: "1", go: "2", pointer: "3", chat: "c", next: "w", pause: "p", done: "d", reply: "r", resolve: "e" };
11
11
  var SPEC = {
12
12
  port: { type: "number", def: 4400, min: 1 },
13
13
  proxy: { type: "string", def: "", only: "project" },
@@ -22,7 +22,6 @@ var SPEC = {
22
22
  name: { type: "string", def: "", only: "personal" },
23
23
  model: { type: "string", def: "", only: "personal" },
24
24
  shortcuts: { type: "shortcuts", def: SHORTCUTS },
25
- zoom: { type: "zoom", def: { skill: "" }, only: "project" },
26
25
  // What is being tried here (lib/flags.ts). Off unless a file or the ⋯ menu turns one on.
27
26
  flags: { type: "flags", def: flagDefaults() }
28
27
  };
@@ -75,12 +74,6 @@ var check = (key, v, file, problems) => {
75
74
  }
76
75
  return out;
77
76
  }
78
- if (s.type === "zoom") {
79
- if (!v || typeof v !== "object" || typeof v.skill !== "string") return bad('must be { "skill": "<path to a .md file>" }');
80
- const skill = path.resolve(path.dirname(file), v.skill);
81
- if (!fs.existsSync(skill)) return bad(`.skill: no file ${skill}`);
82
- return { skill };
83
- }
84
77
  if (typeof v !== s.type) return bad(`must be a ${s.type}`);
85
78
  if (s.type === "number" && (!Number.isFinite(v) || v < (s.min ?? -Infinity))) return bad(`must be a number of at least ${s.min}`);
86
79
  if (s.type === "string" && key === "folder") return path.resolve(path.dirname(file), v);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@leonidstern/labit",
3
- "version": "0.6.3-main.1",
3
+ "version": "0.6.3-main.10",
4
4
  "description": "Pin comments on pages, read by your agent as plain text. Local mode: comment on pages on your computer and Claude answers on the pins.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -8,7 +8,6 @@
8
8
  },
9
9
  "files": [
10
10
  "dist/",
11
- "api/",
12
11
  "public/_lab/comments.js",
13
12
  "public/_lab/lab.css",
14
13
  "public/_lab/favicon.svg",