longtable 0.1.28 → 0.1.29

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.28",
3
+ "version": "0.1.29",
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
@@ -113,7 +113,9 @@ export function ask({ claude, cwd, prompt, system, schema, model, tools = "Read,
113
113
  // Streamed output carries the plan's usage limits (a rate_limit_event) as well as the result.
114
114
  const args = full
115
115
  ? ["-p", "--output-format", "stream-json", "--verbose", "--no-session-persistence",
116
- "--permission-mode", edit ? "acceptEdits" : "default", "--permission-prompt-tool", "mcp__longtable__approve",
116
+ // Their own choice of how it asks (manual, accept edits, auto, plan), else as before: edits go ahead in work.
117
+ "--permission-mode", full.mode === "plan" ? "plan" : full.mode === "auto" ? "auto" : full.mode === "manual" ? "default" : full.mode === "acceptEdits" || edit ? "acceptEdits" : "default",
118
+ "--permission-prompt-tool", "mcp__longtable__approve",
117
119
  "--mcp-config", full.mcp, "--max-turns", edit ? (long ? "10000" : "200") : "60"]
118
120
  : ["-p", "--output-format", "stream-json", "--verbose", "--no-session-persistence", "--restricted", "--permission-mode", edit ? "acceptEdits" : "dontAsk",
119
121
  "--strict-mcp-config", "--max-turns", edit ? (long ? "10000" : "60") : tools ? "25" : "4", "--tools", tools];
@@ -122,7 +124,8 @@ export function ask({ claude, cwd, prompt, system, schema, model, tools = "Read,
122
124
  // their own folder (full.project), never from the branch being worked on, which other people's AIs push to.
123
125
  args.push("--setting-sources", "user");
124
126
  // Only the connection pushes, and only the task's branch: their Claude never pushes itself, whatever their rules.
125
- args.push("--disallowedTools", "Bash(git push:*)", "Bash(git push)", ...(edit ? [] : ["Edit", "Write", "NotebookEdit"]));
127
+ // In plan mode the plan is its answer here: there is no plan to approve, so it never asks to leave plan mode.
128
+ args.push("--disallowedTools", "Bash(git push:*)", "Bash(git push)", ...(edit ? [] : ["Edit", "Write", "NotebookEdit"]), ...(full.mode === "plan" ? ["ExitPlanMode"] : []));
126
129
  if (full.allow?.length) args.push("--allowedTools", ...full.allow);
127
130
  }
128
131
  if (system) args.push("--append-system-prompt", system);
package/src/run.mjs CHANGED
@@ -824,7 +824,10 @@ async function work(rpc, seat, engines, raw) {
824
824
  // A view for the back room only reads, and so does anything asked while no code is connected.
825
825
  // With several AIs, one of them does the work, the others look it over on its branch, and the table's answer
826
826
  // reports it; none of those last two change anything.
827
- const doing = !!seat.source && (job.kind === "work" || (job.kind === "answer" && !job.worker));
827
+ // In plan mode their person wants the plan first: it reads and proposes, and nothing is changed. Their mode is for
828
+ // their own requests to their full Claude Code, as it is for Claude Code at home.
829
+ const planning = job.full === true && job.mode === "plan";
830
+ const doing = !!seat.source && !planning && (job.kind === "work" || (job.kind === "answer" && !job.worker));
828
831
  const onBranch = !!seat.source && !!job.work_read && (job.kind === "review" || job.kind === "combine");
829
832
  const branch = doing || onBranch ? job.branch || workBranch(job.chat_name) : null;
830
833
  // Their full Claude Code, when they turned it on: in a git worktree of their own repository, with their own
@@ -880,14 +883,14 @@ async function work(rpc, seat, engines, raw) {
880
883
  if (cmd) log(`job ${job.job_id}: running their /${cmd.name}`);
881
884
  if (full) { fullRun = await fullSetup(rpc, seat, job); log(`job ${job.job_id}: running as their full Claude Code in ${opened.dir}`); }
882
885
  const result = await ask({
883
- full: fullRun ? { mcp: fullRun.mcp, allow: fullRun.allow, project: fullRun.project } : null,
886
+ full: fullRun ? { mcp: fullRun.mcp, allow: fullRun.allow, project: fullRun.project, mode: job.mode || null } : null,
884
887
  claude,
885
888
  cwd: dir,
886
889
  edit: doing,
887
890
  long: doing,
888
891
  onNote: (n) => { if (n !== note) { note = n; soon(); } },
889
892
  control,
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)
893
+ 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}` : "") + (planning && ["work", "answer"].includes(job.kind) ? `\n\n${PLANNING}` : "")) + fromSandbox(seat, job)
891
894
  + materialsPrompt(job.materials) + attachedPrompt(attached, dir) + (PAGE_KINDS.has(job.kind) ? pagesPrompt(job) : "")
892
895
  + (job.command && !job.command.mine ? `${NL}${NL}${job.asker}'s message runs their own AI's command /${job.command.name}${job.command.about ? ` (${job.command.about})` : ""}. Their own AI has its instructions; you do not. Help with what it is for.` : ""),
893
896
  system: [systemFor({ ...job, doing, full }), ...(laid ? pointedSystem(job.me, laid, dir) : [])].join(NL),
@@ -974,6 +977,9 @@ async function work(rpc, seat, engines, raw) {
974
977
  // What a full Claude Code run needs: a key for this one job (the approval server asks with that, never with the
975
978
  // device token), the MCP config that starts the approval server, kept in a file of the connection's own and removed
976
979
  // when the job ends, and the person's "always allow" answers for this table.
980
+ // Plan mode, as in Claude Code: the plan first, nothing changed.
981
+ const PLANNING = "Your person has you in plan mode: read what you need, then answer with the plan, what you would change, where and why, step by step. Change nothing and run nothing that changes anything. They will say when to go ahead.";
982
+
977
983
  async function fullSetup(rpc, seat, job) {
978
984
  const key = await rpc("runner_job_key", { token: seat.token, job: job.job_id });
979
985
  const always = join(home, "allow", `${safeTable(seat.table_id)}.json`);