longtable 0.1.7 → 0.1.9

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.
Files changed (3) hide show
  1. package/package.json +35 -35
  2. package/src/repo.mjs +20 -0
  3. package/src/run.mjs +19 -3
package/package.json CHANGED
@@ -1,35 +1,35 @@
1
- {
2
- "name": "longtable",
3
- "version": "0.1.7",
4
- "description": "Brings your own Claude Code or Codex to your team's table on longtable.chat, quietly, on your own plan.",
5
- "homepage": "https://longtable.chat",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/TarikAlHadethi/Longtable.git",
9
- "directory": "packages/connect"
10
- },
11
- "license": "MIT",
12
- "type": "module",
13
- "bin": {
14
- "longtable": "bin/longtable.mjs"
15
- },
16
- "files": [
17
- "bin",
18
- "src",
19
- "README.md"
20
- ],
21
- "engines": {
22
- "node": ">=20"
23
- },
24
- "dependencies": {
25
- "@lydell/node-pty": "1.2.0-beta.15",
26
- "@xterm/headless": "^6.0.0"
27
- },
28
- "keywords": [
29
- "longtable",
30
- "claude",
31
- "codex",
32
- "ai",
33
- "team"
34
- ]
35
- }
1
+ {
2
+ "name": "longtable",
3
+ "version": "0.1.9",
4
+ "description": "Brings your own Claude Code or Codex to your team's table on longtable.chat, quietly, on your own plan.",
5
+ "homepage": "https://longtable.chat",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/TarikAlHadethi/Longtable.git",
9
+ "directory": "packages/connect"
10
+ },
11
+ "license": "MIT",
12
+ "type": "module",
13
+ "bin": {
14
+ "longtable": "bin/longtable.mjs"
15
+ },
16
+ "files": [
17
+ "bin",
18
+ "src",
19
+ "README.md"
20
+ ],
21
+ "engines": {
22
+ "node": ">=20"
23
+ },
24
+ "dependencies": {
25
+ "@lydell/node-pty": "1.2.0-beta.15",
26
+ "@xterm/headless": "^6.0.0"
27
+ },
28
+ "keywords": [
29
+ "longtable",
30
+ "claude",
31
+ "codex",
32
+ "ai",
33
+ "team"
34
+ ]
35
+ }
package/src/repo.mjs CHANGED
@@ -149,6 +149,26 @@ export function changedSoFar(tableId, work) {
149
149
  return { files, gone, text, unread };
150
150
  }
151
151
 
152
+ // Make the place for a copy: its branch, pushed with one empty commit of its own on top of the latest default branch,
153
+ // so the hosting sees something new and puts it up. If the branch is already there, it is left as it is.
154
+ export function openBranch(tableId, branch) {
155
+ safeBranch(branch);
156
+ const G = join(home, "copies", tableId, ".git");
157
+ try {
158
+ git(["--git-dir", G, "ls-remote", "--exit-code", "origin", `refs/heads/${branch}`]);
159
+ git(["--git-dir", G, "fetch", "--quiet", "--depth", "1", "--no-tags", "origin", `refs/heads/${branch}`]);
160
+ return git(["--git-dir", G, "rev-parse", "FETCH_HEAD"]);
161
+ } catch (e) {
162
+ if (e.status !== 2) throw new Error("this computer could not reach the project's repository");
163
+ }
164
+ const head = git(["--git-dir", G, "rev-parse", "HEAD"]);
165
+ const tree = git(["--git-dir", G, "rev-parse", `${head}^{tree}`]);
166
+ const who = { ...quiet, GIT_AUTHOR_NAME: "Longtable", GIT_AUTHOR_EMAIL: "longtable@users.noreply.github.com", GIT_COMMITTER_NAME: "Longtable", GIT_COMMITTER_EMAIL: "longtable@users.noreply.github.com" };
167
+ const commit = git(["--git-dir", G, "commit-tree", tree, "-p", head, "-m", "A copy of its own"], who);
168
+ git(["--git-dir", G, "push", "--quiet", "origin", `${commit}:refs/heads/${branch}`]);
169
+ return commit;
170
+ }
171
+
152
172
  // One commit of a sandbox, as a patch the team's AI can read to see what the client ended up with.
153
173
  export function patchOf(tableId, branch, commit) {
154
174
  safeBranch(branch);
package/src/run.mjs CHANGED
@@ -10,7 +10,7 @@ import { client } from "./api.mjs";
10
10
  import { ask, findClaude } from "./claude.mjs";
11
11
  import { askCodex, codexLimits, findCodex } from "./codex.mjs";
12
12
  import { packCode } from "./pack.mjs";
13
- import { changedSoFar, freshCopy, landWork, openWork, patchOf, workBranch } from "./repo.mjs";
13
+ import { changedSoFar, freshCopy, landWork, openBranch, openWork, patchOf, workBranch } from "./repo.mjs";
14
14
  import { hideSecrets, home, loadSecret, log, readConfig } from "./store.mjs";
15
15
 
16
16
  const SOURCES = {
@@ -118,9 +118,18 @@ function recent(history, room) {
118
118
  }
119
119
  return out;
120
120
  }
121
+ // The plain facts of the table: who is there, whose AI is on, and what its clients are still waiting on.
122
+ function facts(job) {
123
+ const people = (job.people || []).map((p) => `${p.name} (${p.role}${p.ai ? `, ${p.ai === "codex" ? "ChatGPT" : "Claude"} connected` : ""})`).join(", ");
124
+ const asked = (job.requests || []).map((r) => `- ${r.from}: "${r.title}" (${r.status})`).join(NL);
125
+ const clients = (job.people || []).some((p) => p.role === "client");
126
+ return [`At the table: ${people || "nobody else"}.`,
127
+ clients ? `What its clients have asked for that is still open:${NL}${asked || "(nothing open)"}` : "No client has joined this table yet, so nothing has been asked by one."].join(NL);
128
+ }
121
129
  const fence = (job) => {
122
130
  const who = (m) => (m.by_ai ? `${m.name}'s AI` : m.client ? `${m.name} (the client, asking)` : m.name);
123
131
  const parts = [];
132
+ if (job.people?.length) parts.push(facts(job));
124
133
  if (job.pinned?.length) parts.push("Pinned notes:\n" + job.pinned.map((n) => `(${n.title || n.kind}) ${n.body}`).join("\n"));
125
134
  if (job.related?.length) parts.push("Related earlier messages from other chats:\n" + job.related.map((m) => `[${m.chat}] ${who(m)}: ${m.body}`).join("\n"));
126
135
  const talk = recent(job.history, 120000);
@@ -202,14 +211,14 @@ export function listenPrompt(job) {
202
211
  // The conversation as far back as a generous size reaches, never a fixed number of messages.
203
212
  const before = recent(job.history, 48000).map((m) => `${who(m)}: ${short(m.body, 3000)}`).join(NL);
204
213
  const tasks = (job.tasks || []).map((t, i) => `T${i + 1}: "${t.title}" (${t.status === "working" ? "being worked on now" : t.status}, asked by ${t.asked_by || "someone"}, in ${t.chat})`).join(NL);
205
- return ["<<<TABLE", inert([`Work the AIs have taken on lately:${NL}${tasks || "(none)"}`, "", before || "(nothing earlier)", `${job.asker}: ${short(job.question, 6000)}`].join(NL)), "TABLE>>>"].join(NL);
214
+ return ["<<<TABLE", inert([facts(job), "", `Work the AIs have taken on lately:${NL}${tasks || "(none)"}`, "", before || "(nothing earlier)", `${job.asker}: ${short(job.question, 6000)}`].join(NL)), "TABLE>>>"].join(NL);
206
215
  }
207
216
  export function listenSystem(job) {
208
217
  return [
209
218
  `You are the listener at "${job.table_name}", a table where a software team talks and their AIs can read and change the project's code. You see the conversation in the chat "${job.chat_name}" and the list of work the AIs have taken on. Read the whole conversation: people talk at length with each other, and what they want from the AIs often only makes sense from what was said many messages back. Decide what the AIs should do about the newest ones, and nothing more.`,
210
219
  `You are deciding about ${job.asker}'s newest message, the last one below, and what ${job.asker} wants. If someone else asked for something else around the same time, that is being decided separately: leave it out of your decision and out of any title.`,
211
220
  "silent: the people are talking to each other, thinking aloud, joking, or nothing is wanted from an AI. When you are not sure, choose silent.",
212
- "reply: they want a quick word from the AI that needs no look at the code: a hello to the AI, a question about what was said above, or a short question back when a request is too vague to act on. Write that word in reply, one to three plain sentences. Never guess about the code in a reply.",
221
+ "reply: they want a quick word from the AI that needs no look at the code: a hello to the AI, a question about what was said above, or a short question back when a request is too vague to act on. Write that word in reply, one to three plain sentences. You may answer from the facts you are given: who is at the table, what its clients have asked for, and what work is under way. Never guess about the code in a reply, and never offer to do something: either it is a look or work, or you say what you know.",
213
222
  "look: they want a question about the project answered, or an opinion or input, and it needs reading the code but no change to it.",
214
223
  "work: they want the code changed, built or fixed, or they said yes to a change an AI offered.",
215
224
  "When you choose work: if it is a follow-up to, a change to, or a fix of one of the listed pieces of work, put that one's label (like T2) in task and leave title empty; if it is something new, leave task empty and give it a plain title of three to six words that people would recognise. People talking about work that is already under way is not a new request: stay silent unless they ask for something or change what they want.",
@@ -453,6 +462,13 @@ async function workSandbox(rpc, seat, engines, job) {
453
462
  if (!engines.claude) throw new Error("Claude Code is not on this computer");
454
463
  if (!seat.source) throw new Error("this connection has no code to work on");
455
464
  freshCopy(seat.table_id, seat.source);
465
+ if (job.probe) {
466
+ // Only making the place for a copy: no AI is asked anything.
467
+ const commit = openBranch(seat.table_id, job.branch);
468
+ await rpc("runner_finish", { token: seat.token, job: job.job_id, answer: "", info: { commit } });
469
+ log(`sandbox job ${job.job_id}: made ${job.branch}`);
470
+ return;
471
+ }
456
472
  const opened = openWork(seat.table_id, job.branch, "work", { refresh: true });
457
473
  let note = "";
458
474
  let told = 0;