longtable 0.1.27 → 0.1.28

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "longtable",
3
- "version": "0.1.27",
3
+ "version": "0.1.28",
4
4
  "description": "Brings your own Claude Code or Codex to your team's table on longtable.chat, quietly, on your own plan.",
5
5
  "homepage": "https://longtable.chat",
6
6
  "repository": {
package/src/claude.mjs CHANGED
@@ -162,11 +162,14 @@ export function ask({ claude, cwd, prompt, system, schema, model, tools = "Read,
162
162
  for (const part of e.message?.content || []) {
163
163
  if (part.type !== "tool_use") continue;
164
164
  const where = String(part.input?.file_path || part.input?.path || "");
165
- const file = where.split(/[/\\]/).pop();
165
+ // The path inside the project when it is in it (src/booking/StaffPicker.tsx), else the file's name alone.
166
+ const inside = where && where.toLowerCase().startsWith(String(cwd).toLowerCase()) ? where.slice(String(cwd).length).replace(/^[/\\]+/, "").replace(/\\/g, "/") : "";
167
+ const file = inside && inside.length <= 80 ? inside : where.split(/[/\\]/).pop();
166
168
  if (/[/\\]\.longtable-yours([/\\]|$)/.test(where) || /^\.longtable-yours([/\\]|$)/.test(where)) onNote("reading what it knows");
167
169
  // A command is named by its program only: the rest of a command line can hold a secret.
168
170
  else if (part.name === "Bash") onNote(`running ${String(part.input?.command || "").trim().split(/\s+/)[0].replace(/[^A-Za-z0-9._-]/g, "").slice(0, 30) || "a command"}`);
169
- else onNote(part.name === "Edit" || part.name === "Write" ? `editing ${file}` : part.name === "Read" ? `reading ${file}` : "searching the code");
171
+ else onNote(part.name === "Edit" || part.name === "Write" ? `editing ${file}` : part.name === "Read" ? `reading ${file}`
172
+ : (part.name === "Grep" || part.name === "Glob") && part.input?.pattern ? `searching for ${String(part.input.pattern).replace(/\s+/g, " ").slice(0, 40)}` : "searching the code");
170
173
  }
171
174
  }
172
175
  });
package/src/run.mjs CHANGED
@@ -534,7 +534,7 @@ async function workPacked(rpc, seat, engines, job, copy) {
534
534
  // One of their own prompts or skills, or one of the table's, when their message runs one: the same as on Claude.
535
535
  const cmd = job.command?.mine ? loadCommand(seat, job.question) : null;
536
536
  const prompt = `${cmd ? commandPrompt(job.me, cmd) : ""}${buildPrompt(job)}\n\n<<<CODE\n${inert(pack.text)}\nCODE>>>${PAGE_KINDS.has(job.kind) ? pagesPrompt(job) : ""}`;
537
- const result = await askCodex({ codex: engines.codex, prompt: `${systemFor({ ...job, packed: true })}\n\n${prompt}`, schema, model: seat.model || undefined, effort: job.effort || null, timeoutMs: 5 * 60 * 1000 });
537
+ const result = await askCodex({ codex: engines.codex, prompt: `${systemFor({ ...job, packed: true })}\n\n${prompt}`, schema, model: seat.model || undefined, effort: job.effort || "medium", timeoutMs: 5 * 60 * 1000 });
538
538
  if (result.tools.length) throw new Error(`Codex tried to use tools (${result.tools.join(", ")}); its answer was dropped`);
539
539
  const s = result.structured_output || {};
540
540
  const text = job.kind === "view" || job.kind === "review" ? s.view : job.kind === "intro" ? `${s.knows}\n\nI can check: ${s.can_check}` : s.answer;
@@ -683,11 +683,14 @@ async function workSandbox(rpc, seat, engines, job) {
683
683
  told = Date.now();
684
684
  try { if ((await rpc("runner_beat", { token: seat.token, job: job.job_id, note })) === false) control.kill?.(); } catch (e) { if (/connection was removed/i.test(e.message)) control.kill?.(); }
685
685
  };
686
+ // The newest note reaches the room within a second, and the room is told at most once a second.
687
+ let pending = null;
688
+ const soon = () => { if (!pending) pending = setTimeout(() => { pending = null; tell(); }, Math.max(0, 1000 - (Date.now() - told))); };
686
689
  const beat = setInterval(tell, 20000);
687
690
  try {
688
691
  // A change in a copy is a short piece of work: ten minutes and sixty steps, on the team's plan.
689
692
  const result = await ask({ claude: engines.claude, cwd: opened.dir, edit: true, long: false, control,
690
- onNote: (n) => { if (n !== note) { note = n; if (Date.now() - told > 4000) tell(); } },
693
+ onNote: (n) => { if (n !== note) { note = n; soon(); } },
691
694
  prompt: sandboxPrompt(job), system: sandboxSystem(job), schema: KINDS.sandbox.schema, model: seat.model || process.env.LONGTABLE_MODEL });
692
695
  if (result.is_error) throw new Error(result.result || "Claude Code reported an error");
693
696
  const s = result.structured_output || {};
@@ -842,6 +845,9 @@ async function work(rpc, seat, engines, raw) {
842
845
  told = Date.now();
843
846
  try { if ((await rpc("runner_beat", { token: seat.token, job: job.job_id, note })) === false) control.kill?.(); } catch (e) { if (/connection was removed/i.test(e.message)) control.kill?.(); }
844
847
  };
848
+ // The newest note reaches the room within a second, and the room is told at most once a second.
849
+ let pending = null;
850
+ const soon = () => { if (!pending) pending = setTimeout(() => { pending = null; tell(); }, Math.max(0, 1000 - (Date.now() - told))); };
845
851
  beat = setInterval(tell, 20000);
846
852
  const dir = opened ? opened.dir : copy.dir;
847
853
  // And the whole of it beside the code, to read when the question needs it. Never in a folder that is committed
@@ -879,8 +885,7 @@ async function work(rpc, seat, engines, raw) {
879
885
  cwd: dir,
880
886
  edit: doing,
881
887
  long: doing,
882
- // What it is doing reaches the room within a few seconds of changing, and no more often than that.
883
- onNote: (n) => { if (n !== note) { note = n; if (Date.now() - told > 4000) tell(); } },
888
+ onNote: (n) => { if (n !== note) { note = n; soon(); } },
884
889
  control,
885
890
  prompt: yours(job) + (cmd ? commandPrompt(job.me, cmd) : "") + (doing ? `${buildPrompt(job)}\n\n${full ? FULL_DOING(branch) : DOING(branch)}` : buildPrompt(job) + (full ? `\n\n${FULL_READING}` : "")) + fromSandbox(seat, job)
886
891
  + materialsPrompt(job.materials) + attachedPrompt(attached, dir) + (PAGE_KINDS.has(job.kind) ? pagesPrompt(job) : "")
@@ -889,7 +894,7 @@ async function work(rpc, seat, engines, raw) {
889
894
  addDirs: laid ? laid.dirs : [],
890
895
  schema: KINDS[job.kind].schema,
891
896
  model: seat.model || process.env.LONGTABLE_MODEL,
892
- effort: job.effort || null,
897
+ effort: job.effort || "medium",
893
898
  fast: job.fast === true,
894
899
  }).catch((e) => {
895
900
  // Only short jobs have a time limit now; if one that was changing files hits it, what it changed still lands.