@longtable/cli 0.1.25 → 0.1.26
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/README.md +15 -19
- package/dist/cli.js +75 -97
- package/dist/debate.d.ts +0 -1
- package/dist/debate.js +2 -4
- package/dist/persona-router.d.ts +1 -0
- package/dist/persona-router.js +4 -1
- package/dist/project-session.d.ts +1 -1
- package/dist/project-session.js +17 -17
- package/package.json +7 -7
package/README.md
CHANGED
|
@@ -20,8 +20,7 @@ npm install -g @longtable/cli
|
|
|
20
20
|
```
|
|
21
21
|
|
|
22
22
|
The npm install only installs the CLI. It does not write Codex skills, MCP
|
|
23
|
-
config, hooks,
|
|
24
|
-
approval.
|
|
23
|
+
config, hooks, or provider runtime files without explicit setup approval.
|
|
25
24
|
|
|
26
25
|
## Primary Flow
|
|
27
26
|
|
|
@@ -91,9 +90,7 @@ longtable roles
|
|
|
91
90
|
longtable ask --cwd "<project-path>" --prompt "..."
|
|
92
91
|
longtable panel --prompt "..."
|
|
93
92
|
longtable sentinel --prompt "Should I define a new measurement construct?"
|
|
94
|
-
longtable hud --watch
|
|
95
93
|
longtable team --prompt "Review this measurement plan." --role editor,measurement_auditor --json
|
|
96
|
-
longtable team --tmux --prompt "Review this measurement plan."
|
|
97
94
|
longtable team --debate --prompt "Review this measurement plan." --role editor,measurement_auditor --json
|
|
98
95
|
longtable codex install-skills
|
|
99
96
|
longtable claude install-skills
|
|
@@ -111,6 +108,16 @@ longtable ask --prompt "lt panel: show the disagreement before I commit" --json
|
|
|
111
108
|
|
|
112
109
|
Natural language should be the default.
|
|
113
110
|
|
|
111
|
+
Codex UI Researcher Checkpoints are a core LongTable feature when enabled:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
longtable setup --provider codex --surfaces skills_mcp --checkpoint-ui strong
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
That setup writes the MCP configuration and Codex elicitation approval needed
|
|
118
|
+
for form-style checkpoint prompts. Without it, LongTable keeps the same
|
|
119
|
+
`QuestionRecord` pending and falls back to numbered text.
|
|
120
|
+
|
|
114
121
|
Explicit short forms are available when needed:
|
|
115
122
|
|
|
116
123
|
```text
|
|
@@ -152,10 +159,6 @@ Inside a LongTable project workspace, panel planning also appends an
|
|
|
152
159
|
`InvocationRecord` to `.longtable/state.json`, creates a pending follow-up
|
|
153
160
|
`QuestionRecord`, and refreshes `CURRENT.md`.
|
|
154
161
|
|
|
155
|
-
```bash
|
|
156
|
-
longtable decide --answer evidence --rationale "Need citation support before continuing."
|
|
157
|
-
```
|
|
158
|
-
|
|
159
162
|
Default panel roles include:
|
|
160
163
|
|
|
161
164
|
- `reviewer`
|
|
@@ -165,32 +168,25 @@ Default panel roles include:
|
|
|
165
168
|
|
|
166
169
|
Use `--role` to constrain the panel when the research problem is already clear.
|
|
167
170
|
|
|
168
|
-
## Sentinel
|
|
171
|
+
## Sentinel And Agent Team
|
|
169
172
|
|
|
170
173
|
`longtable sentinel` is an explicit gap/tacit check for prompts that may contain
|
|
171
174
|
measurement, theory, method, evidence, authorship, or tacit-assumption risks.
|
|
172
175
|
Use `--record` inside a LongTable workspace to store the finding as an
|
|
173
176
|
unconfirmed inferred hypothesis.
|
|
174
177
|
|
|
175
|
-
`longtable hud --watch` renders a compact view of the current project goal,
|
|
176
|
-
blocker, pending checkpoints, recent decisions, and invocation counts.
|
|
177
|
-
`longtable hud --tmux` opens that view in a tmux pane.
|
|
178
|
-
|
|
179
178
|
`longtable team` creates a file-backed agent-team review under
|
|
180
179
|
`.longtable/team/<id>/`: independent review, cross-review, and
|
|
181
180
|
synthesis/checkpoint. Use it when roles should inspect each other's concerns
|
|
182
181
|
before LongTable proposes a researcher decision.
|
|
183
182
|
|
|
184
|
-
`longtable team --tmux` opens role-specific panes for live discussion. The panes
|
|
185
|
-
can add logs, but the file-backed team artifact remains the source of truth.
|
|
186
|
-
|
|
187
183
|
`longtable team --debate` creates a fixed five-round debate record under
|
|
188
184
|
`.longtable/team/<id>/`: independent review, cross-review, rebuttal,
|
|
189
|
-
convergence, and synthesis/checkpoint.
|
|
190
|
-
|
|
185
|
+
convergence, and synthesis/checkpoint. The file-backed artifact directory is
|
|
186
|
+
the source of truth.
|
|
191
187
|
|
|
192
188
|
See `docs/AGENT-TEAM-README.md` in the repository for a user-facing guide to
|
|
193
|
-
panel, team,
|
|
189
|
+
panel, team, and debate surfaces.
|
|
194
190
|
|
|
195
191
|
## Evidence And Search Direction
|
|
196
192
|
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3
3
|
import { mkdir, mkdtemp, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
-
import {
|
|
4
|
+
import { execSync } from "node:child_process";
|
|
5
5
|
import { emitKeypressEvents } from "node:readline";
|
|
6
6
|
import { createInterface } from "node:readline/promises";
|
|
7
7
|
import { stdin as input, stdout as output, cwd, exit } from "node:process";
|
|
@@ -15,7 +15,7 @@ import { installCodexPromptAliases, listInstalledCodexPromptAliases, removeCodex
|
|
|
15
15
|
import { buildPersonaGuidance, parseInvocationDirective } from "./persona-router.js";
|
|
16
16
|
import { PERSONA_DEFINITIONS, listRoleDefinitions } from "./personas.js";
|
|
17
17
|
import { buildPanelFallback, renderPanelSummary } from "./panel.js";
|
|
18
|
-
import { appendInvocationRecordToWorkspace, assertWorkspaceNotBlocked, answerWorkspaceQuestion,
|
|
18
|
+
import { appendInvocationRecordToWorkspace, assertWorkspaceNotBlocked, answerWorkspaceQuestion, createWorkspaceFollowUpQuestions, createWorkspaceQuestion, createOrUpdateProjectWorkspace, inspectProjectWorkspace, loadWorkspaceState, loadProjectContextFromDirectory, renderProjectWorkspaceSummary, syncCurrentWorkspaceView } from "./project-session.js";
|
|
19
19
|
import { buildTeamDebate, buildTeamReview, renderTeamDebateSummary } from "./debate.js";
|
|
20
20
|
const VALID_MODES = new Set([
|
|
21
21
|
"explore",
|
|
@@ -42,7 +42,7 @@ const ANSI = {
|
|
|
42
42
|
green: "\u001B[32m"
|
|
43
43
|
};
|
|
44
44
|
const LONGTABLE_MCP_SERVER_NAME = "longtable-state";
|
|
45
|
-
const LONGTABLE_MCP_PACKAGE_VERSION = "0.1.
|
|
45
|
+
const LONGTABLE_MCP_PACKAGE_VERSION = "0.1.26";
|
|
46
46
|
const LONGTABLE_MCP_MARKER_START = "# LongTable state MCP START";
|
|
47
47
|
const LONGTABLE_MCP_MARKER_END = "# LongTable state MCP END";
|
|
48
48
|
function style(text, prefix) {
|
|
@@ -89,7 +89,7 @@ function usage() {
|
|
|
89
89
|
" longtable install [--json] [--path <file>] [--runtime-path <file>]",
|
|
90
90
|
" longtable mcp install [--provider codex|claude|all] [--write] [--checkpoint-ui off|interactive|strong] [--json] [--codex-config <path>] [--claude-settings <path>] [--package <spec>]",
|
|
91
91
|
" longtable sentinel --prompt <text> [--cwd <path>] [--json] [--record]",
|
|
92
|
-
" longtable team --prompt <text> [--role <role[,role]>] [--
|
|
92
|
+
" longtable team --prompt <text> [--role <role[,role]>] [--debate] [--rounds 3|5] [--cwd <path>] [--json]",
|
|
93
93
|
" longtable ask [--prompt <text>] [--print] [--json] [--setup <path>] [--cwd <path>]",
|
|
94
94
|
" longtable clarify --prompt <task-context> [--provider codex|claude] [--required|--advisory] [--print] [--cwd <path>] [--json] [--force]",
|
|
95
95
|
" longtable question --prompt <decision-context> [--title <text>] [--text <question>] [--provider codex|claude] [--required|--advisory] [--print] [--cwd <path>] [--json]",
|
|
@@ -622,12 +622,12 @@ function buildPermissionSetupChoices() {
|
|
|
622
622
|
{
|
|
623
623
|
id: "strong",
|
|
624
624
|
label: "Strong Researcher Checkpoint UI",
|
|
625
|
-
description: "Why:
|
|
625
|
+
description: "Why: makes Codex UI checkpoints the default for high-responsibility research decisions. What you get: MCP form checkpoints with a single decision field. Tradeoff: requires Codex MCP elicitation approval."
|
|
626
626
|
},
|
|
627
627
|
{
|
|
628
628
|
id: "interactive",
|
|
629
629
|
label: "Interactive checkpoint UI",
|
|
630
|
-
description: "Why: keeps UI prompts available for required checkpoints. What you get: MCP form checkpoints when supported. Tradeoff: requires Codex MCP elicitation approval."
|
|
630
|
+
description: "Why: keeps Codex UI prompts available for required checkpoints. What you get: MCP form checkpoints when supported. Tradeoff: requires Codex MCP elicitation approval."
|
|
631
631
|
},
|
|
632
632
|
{
|
|
633
633
|
id: "off",
|
|
@@ -768,7 +768,6 @@ async function runSetup(args) {
|
|
|
768
768
|
interventionPosture: effectiveIntervention,
|
|
769
769
|
checkpointUiMode: checkpointUi,
|
|
770
770
|
workspaceCreationPreference: workspacePreference,
|
|
771
|
-
tmuxMode: "standard",
|
|
772
771
|
teamMode: "panel"
|
|
773
772
|
};
|
|
774
773
|
if (surfaces === "skills_mcp_sentinel") {
|
|
@@ -1769,6 +1768,38 @@ function inferModeFromPrompt(prompt) {
|
|
|
1769
1768
|
}
|
|
1770
1769
|
return "explore";
|
|
1771
1770
|
}
|
|
1771
|
+
function inferCollaborationRoute(prompt) {
|
|
1772
|
+
const normalized = prompt.toLowerCase();
|
|
1773
|
+
const explicitDebate = /\bdebate\b|\bdebated\b|\brebuttal\b|\bconvergence\b|\bargue both sides\b/i.test(prompt) ||
|
|
1774
|
+
/토론|논쟁|반박|재반박|수렴/.test(prompt);
|
|
1775
|
+
if (explicitDebate) {
|
|
1776
|
+
return "debate";
|
|
1777
|
+
}
|
|
1778
|
+
const explicitTeam = /\bagent team\b|\bresearch team\b|\bteam review\b|\bteam-style\b|\buse a team\b/i.test(prompt) ||
|
|
1779
|
+
/에이전트\s*팀|연구\s*팀|팀\s*(리뷰|검토)|팀으로/.test(prompt);
|
|
1780
|
+
if (explicitTeam) {
|
|
1781
|
+
return "team";
|
|
1782
|
+
}
|
|
1783
|
+
const panelCue = /\bpanel\b|\bmulti[- ]?role\b|\bmultiple perspectives\b|\brole disagreement\b|\bdisagreement\b|\bconflict\b/i.test(prompt) ||
|
|
1784
|
+
/패널|여러\s*관점|복수\s*관점|역할.*불일치|불일치|충돌/.test(prompt);
|
|
1785
|
+
const multiPerspectiveCue = panelCue ||
|
|
1786
|
+
/\bperspectives?\b|\broles?\b|\breviewer and editor\b|\beditor and reviewer\b|\bmethods and measurement\b/i.test(prompt) ||
|
|
1787
|
+
/관점|역할|리뷰어.*에디터|에디터.*리뷰어|방법.*측정|측정.*방법/.test(prompt);
|
|
1788
|
+
if (!multiPerspectiveCue) {
|
|
1789
|
+
return null;
|
|
1790
|
+
}
|
|
1791
|
+
const trigger = classifyCheckpointTrigger(prompt, {});
|
|
1792
|
+
const highStakes = trigger.signal.artifactStakes === "external_submission" ||
|
|
1793
|
+
trigger.signal.artifactStakes === "study_protocol" ||
|
|
1794
|
+
trigger.requiresQuestionBeforeClosure;
|
|
1795
|
+
if (panelCue && trigger.signal.artifactStakes === "external_submission") {
|
|
1796
|
+
return "debate";
|
|
1797
|
+
}
|
|
1798
|
+
if (highStakes) {
|
|
1799
|
+
return "team";
|
|
1800
|
+
}
|
|
1801
|
+
return "panel";
|
|
1802
|
+
}
|
|
1772
1803
|
function parsePanelVisibility(value) {
|
|
1773
1804
|
if (value === "synthesis_only" ||
|
|
1774
1805
|
value === "show_on_conflict" ||
|
|
@@ -1820,6 +1851,9 @@ async function runModeCommand(mode, args) {
|
|
|
1820
1851
|
}
|
|
1821
1852
|
const setup = await loadOptionalSetup(typeof args.setup === "string" ? args.setup : undefined);
|
|
1822
1853
|
const projectContext = await loadProjectContextFromDirectory(workingDirectory);
|
|
1854
|
+
if (projectContext) {
|
|
1855
|
+
await assertWorkspaceNotBlocked(projectContext);
|
|
1856
|
+
}
|
|
1823
1857
|
const projectAware = await buildProjectAwarePrompt(prompt, workingDirectory);
|
|
1824
1858
|
const panelPreference = setup?.profileSeed.panelPreference;
|
|
1825
1859
|
const panelRequested = args.panel === true ||
|
|
@@ -2019,9 +2053,9 @@ function questionRecordToChoices(record) {
|
|
|
2019
2053
|
: [])
|
|
2020
2054
|
];
|
|
2021
2055
|
}
|
|
2022
|
-
function
|
|
2056
|
+
function renderFollowUpQuestions(questions) {
|
|
2023
2057
|
if (questions.length === 0) {
|
|
2024
|
-
return "No new
|
|
2058
|
+
return "No new follow-up questions are pending for this prompt.";
|
|
2025
2059
|
}
|
|
2026
2060
|
const width = 44;
|
|
2027
2061
|
const boxLine = (text = "") => `│ ${text.padEnd(width, " ")} │`;
|
|
@@ -2072,13 +2106,13 @@ function renderClarificationCard(questions) {
|
|
|
2072
2106
|
lines.push("Answer in a terminal with `longtable clarify --prompt ...`, or record choices with `longtable decide --question <id> --answer <value>`.");
|
|
2073
2107
|
return lines.join("\n");
|
|
2074
2108
|
}
|
|
2075
|
-
async function
|
|
2109
|
+
async function answerFollowUpQuestionsInTerminal(context, questions, provider) {
|
|
2076
2110
|
if (questions.length === 0) {
|
|
2077
2111
|
return;
|
|
2078
2112
|
}
|
|
2079
2113
|
const rl = createInterface({ input, output });
|
|
2080
2114
|
try {
|
|
2081
|
-
console.log(renderBrandBanner("LongTable", "
|
|
2115
|
+
console.log(renderBrandBanner("LongTable", "Follow-up Questions"));
|
|
2082
2116
|
console.log("");
|
|
2083
2117
|
for (let index = 0; index < questions.length; index += 1) {
|
|
2084
2118
|
const question = questions[index];
|
|
@@ -2109,7 +2143,7 @@ async function runClarify(args) {
|
|
|
2109
2143
|
}
|
|
2110
2144
|
const provider = args.provider === "claude" ? "claude" : args.provider === "codex" ? "codex" : undefined;
|
|
2111
2145
|
const required = args.required === true ? true : args.advisory === true ? false : undefined;
|
|
2112
|
-
const result = await
|
|
2146
|
+
const result = await createWorkspaceFollowUpQuestions({
|
|
2113
2147
|
context,
|
|
2114
2148
|
prompt,
|
|
2115
2149
|
provider,
|
|
@@ -2129,17 +2163,17 @@ async function runClarify(args) {
|
|
|
2129
2163
|
return;
|
|
2130
2164
|
}
|
|
2131
2165
|
if (args.print === true || !isInteractiveTerminal()) {
|
|
2132
|
-
console.log(
|
|
2166
|
+
console.log(renderFollowUpQuestions(result.questions));
|
|
2133
2167
|
return;
|
|
2134
2168
|
}
|
|
2135
|
-
await
|
|
2169
|
+
await answerFollowUpQuestionsInTerminal(context, result.questions, provider);
|
|
2136
2170
|
console.log("");
|
|
2137
|
-
console.log("LongTable
|
|
2171
|
+
console.log("LongTable follow-up decisions recorded");
|
|
2138
2172
|
console.log(`- answered: ${result.questions.length}`);
|
|
2139
2173
|
console.log(`- state: ${context.stateFilePath}`);
|
|
2140
2174
|
console.log(`- current: ${context.currentFilePath}`);
|
|
2141
2175
|
}
|
|
2142
|
-
async function
|
|
2176
|
+
async function runAutomaticFollowUpIfNeeded(prompt, args) {
|
|
2143
2177
|
if (args["no-clarify"] === true || args.print === true || args.json === true) {
|
|
2144
2178
|
return false;
|
|
2145
2179
|
}
|
|
@@ -2149,7 +2183,7 @@ async function runAutomaticClarificationIfNeeded(prompt, args) {
|
|
|
2149
2183
|
return false;
|
|
2150
2184
|
}
|
|
2151
2185
|
const provider = args.provider === "claude" ? "claude" : args.provider === "codex" ? "codex" : undefined;
|
|
2152
|
-
const result = await
|
|
2186
|
+
const result = await createWorkspaceFollowUpQuestions({
|
|
2153
2187
|
context,
|
|
2154
2188
|
prompt,
|
|
2155
2189
|
provider,
|
|
@@ -2159,17 +2193,22 @@ async function runAutomaticClarificationIfNeeded(prompt, args) {
|
|
|
2159
2193
|
return false;
|
|
2160
2194
|
}
|
|
2161
2195
|
if (!isInteractiveTerminal()) {
|
|
2162
|
-
console.log(
|
|
2196
|
+
console.log(renderFollowUpQuestions(result.questions));
|
|
2163
2197
|
return true;
|
|
2164
2198
|
}
|
|
2165
|
-
await
|
|
2199
|
+
await answerFollowUpQuestionsInTerminal(context, result.questions, provider);
|
|
2166
2200
|
return false;
|
|
2167
2201
|
}
|
|
2168
2202
|
async function runAsk(args) {
|
|
2203
|
+
const workingDirectory = typeof args.cwd === "string" ? args.cwd : cwd();
|
|
2169
2204
|
const prompt = await resolvePrompt(typeof args.prompt === "string" ? args.prompt : undefined);
|
|
2170
2205
|
if (!prompt) {
|
|
2171
2206
|
throw new Error("A prompt is required.");
|
|
2172
2207
|
}
|
|
2208
|
+
const projectContext = await loadProjectContextFromDirectory(workingDirectory);
|
|
2209
|
+
if (projectContext) {
|
|
2210
|
+
await assertWorkspaceNotBlocked(projectContext);
|
|
2211
|
+
}
|
|
2173
2212
|
const directive = parseInvocationDirective(prompt);
|
|
2174
2213
|
const effectivePrompt = directive.cleanedPrompt;
|
|
2175
2214
|
const inferred = directive.mode ?? inferModeFromPrompt(effectivePrompt);
|
|
@@ -2178,7 +2217,7 @@ async function runAsk(args) {
|
|
|
2178
2217
|
return;
|
|
2179
2218
|
}
|
|
2180
2219
|
const mode = inferred === "panel" ? "review" : inferred;
|
|
2181
|
-
if (await
|
|
2220
|
+
if (await runAutomaticFollowUpIfNeeded(effectivePrompt, args)) {
|
|
2182
2221
|
return;
|
|
2183
2222
|
}
|
|
2184
2223
|
const delegatedArgs = {
|
|
@@ -2188,7 +2227,18 @@ async function runAsk(args) {
|
|
|
2188
2227
|
if (directive.roles.length > 0 && typeof delegatedArgs.role !== "string") {
|
|
2189
2228
|
delegatedArgs.role = directive.roles.join(",");
|
|
2190
2229
|
}
|
|
2191
|
-
|
|
2230
|
+
const collaborationRoute = directive.collaboration ??
|
|
2231
|
+
(directive.panel || delegatedArgs.panel === true
|
|
2232
|
+
? "panel"
|
|
2233
|
+
: inferCollaborationRoute(effectivePrompt) ?? (inferred === "panel" ? "panel" : null));
|
|
2234
|
+
if (collaborationRoute === "team" || collaborationRoute === "debate") {
|
|
2235
|
+
await runTeam({
|
|
2236
|
+
...delegatedArgs,
|
|
2237
|
+
debate: collaborationRoute === "debate"
|
|
2238
|
+
});
|
|
2239
|
+
return;
|
|
2240
|
+
}
|
|
2241
|
+
if (collaborationRoute === "panel") {
|
|
2192
2242
|
await runPanelCommand({
|
|
2193
2243
|
...delegatedArgs,
|
|
2194
2244
|
visibility: "always_visible"
|
|
@@ -2200,9 +2250,6 @@ async function runAsk(args) {
|
|
|
2200
2250
|
function localId(prefix) {
|
|
2201
2251
|
return `${prefix}_${Date.now().toString(36)}_${Math.random().toString(36).slice(2, 8)}`;
|
|
2202
2252
|
}
|
|
2203
|
-
function shellEscape(value) {
|
|
2204
|
-
return `'${value.replaceAll("'", "'\\''")}'`;
|
|
2205
|
-
}
|
|
2206
2253
|
async function writeJsonFile(path, value) {
|
|
2207
2254
|
await writeFile(path, `${JSON.stringify(value, null, 2)}\n`, "utf8");
|
|
2208
2255
|
}
|
|
@@ -2329,8 +2376,7 @@ async function runTeam(args) {
|
|
|
2329
2376
|
roleFlag: typeof args.role === "string" ? args.role : undefined,
|
|
2330
2377
|
provider: setup?.providerSelection.provider,
|
|
2331
2378
|
visibility: "always_visible",
|
|
2332
|
-
roundCount: rounds
|
|
2333
|
-
tmux: args.tmux === true
|
|
2379
|
+
roundCount: rounds
|
|
2334
2380
|
});
|
|
2335
2381
|
await writeTeamDebateArtifacts(debate, teamDir, prompt);
|
|
2336
2382
|
const canRecordWorkspace = projectAware.projectContextFound && projectContext && existsSync(projectContext.stateFilePath);
|
|
@@ -2354,40 +2400,6 @@ async function runTeam(args) {
|
|
|
2354
2400
|
}, null, 2));
|
|
2355
2401
|
return;
|
|
2356
2402
|
}
|
|
2357
|
-
if (args.tmux === true) {
|
|
2358
|
-
const sessionName = `longtable-${teamId.replaceAll("_", "-")}`;
|
|
2359
|
-
const shell = process.env.SHELL || "/bin/sh";
|
|
2360
|
-
const launcher = process.argv[1] ?? "longtable";
|
|
2361
|
-
const leaderCommand = [
|
|
2362
|
-
`echo ${shellEscape(`LongTable debate ${teamId}`)}`,
|
|
2363
|
-
`echo ${shellEscape(`Artifacts: ${teamDir}`)}`,
|
|
2364
|
-
`echo ${shellEscape("Fixed rounds are recorded. Role panes can add live review logs.")}`,
|
|
2365
|
-
`echo ${shellEscape(`Checkpoint: ${debate.questionRecord.id}`)}`,
|
|
2366
|
-
`exec ${shellEscape(shell)}`
|
|
2367
|
-
].join("; ");
|
|
2368
|
-
execFileSync("tmux", ["new-session", "-d", "-s", sessionName, "-c", workingDirectory, leaderCommand], { stdio: "inherit" });
|
|
2369
|
-
for (const member of debate.plan.members) {
|
|
2370
|
-
const rolePrompt = [
|
|
2371
|
-
`LongTable autonomous debate role: ${member.label} (${member.role}).`,
|
|
2372
|
-
"Use the fixed debate artifacts as the shared record. Add live notes only; do not answer the researcher checkpoint.",
|
|
2373
|
-
`Artifacts: ${teamDir}`,
|
|
2374
|
-
"",
|
|
2375
|
-
projectAware.prompt
|
|
2376
|
-
].join("\n");
|
|
2377
|
-
const logPath = join(teamDir, `${member.role}.debate.log`);
|
|
2378
|
-
const command = [
|
|
2379
|
-
`node ${shellEscape(launcher)} review --role ${shellEscape(member.role)} --prompt ${shellEscape(rolePrompt)} --cwd ${shellEscape(workingDirectory)} 2>&1 | tee ${shellEscape(logPath)}`,
|
|
2380
|
-
`echo ${shellEscape(`Debate role log written to ${logPath}`)}`,
|
|
2381
|
-
`exec ${shellEscape(shell)}`
|
|
2382
|
-
].join("; ");
|
|
2383
|
-
execFileSync("tmux", ["split-window", "-t", sessionName, "-c", workingDirectory, command], { stdio: "inherit" });
|
|
2384
|
-
execFileSync("tmux", ["select-layout", "-t", sessionName, "tiled"], { stdio: "ignore" });
|
|
2385
|
-
}
|
|
2386
|
-
console.log(`LongTable tmux debate launched: ${sessionName}`);
|
|
2387
|
-
console.log(`Attach with: tmux attach -t ${sessionName}`);
|
|
2388
|
-
console.log(`Artifacts: ${teamDir}`);
|
|
2389
|
-
return;
|
|
2390
|
-
}
|
|
2391
2403
|
console.log(renderTeamDebateSummary(debate.run));
|
|
2392
2404
|
console.log(`- checkpoint: ${debate.questionRecord.id}`);
|
|
2393
2405
|
return;
|
|
@@ -2399,8 +2411,7 @@ async function runTeam(args) {
|
|
|
2399
2411
|
roleFlag: typeof args.role === "string" ? args.role : undefined,
|
|
2400
2412
|
provider: setup?.providerSelection.provider,
|
|
2401
2413
|
visibility: "always_visible",
|
|
2402
|
-
roundCount: rounds
|
|
2403
|
-
tmux: args.tmux === true
|
|
2414
|
+
roundCount: rounds
|
|
2404
2415
|
});
|
|
2405
2416
|
await writeTeamDebateArtifacts(team, teamDir, prompt);
|
|
2406
2417
|
const canRecordWorkspace = projectAware.projectContextFound && projectContext && existsSync(projectContext.stateFilePath);
|
|
@@ -2425,41 +2436,8 @@ async function runTeam(args) {
|
|
|
2425
2436
|
}, null, 2));
|
|
2426
2437
|
return;
|
|
2427
2438
|
}
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
console.log(`- checkpoint: ${team.questionRecord.id}`);
|
|
2431
|
-
return;
|
|
2432
|
-
}
|
|
2433
|
-
const sessionName = `longtable-${teamId.replaceAll("_", "-")}`;
|
|
2434
|
-
const shell = process.env.SHELL || "/bin/sh";
|
|
2435
|
-
const launcher = process.argv[1] ?? "longtable";
|
|
2436
|
-
const leaderCommand = [
|
|
2437
|
-
`echo ${shellEscape(`LongTable team ${teamId}`)}`,
|
|
2438
|
-
`echo ${shellEscape(`Artifacts: ${teamDir}`)}`,
|
|
2439
|
-
`echo ${shellEscape("Cross-review artifacts are recorded. Role panes can add live review logs.")}`,
|
|
2440
|
-
`echo ${shellEscape(`Checkpoint: ${team.questionRecord.id}`)}`,
|
|
2441
|
-
`exec ${shellEscape(shell)}`
|
|
2442
|
-
].join("; ");
|
|
2443
|
-
execFileSync("tmux", ["new-session", "-d", "-s", sessionName, "-c", workingDirectory, leaderCommand], { stdio: "inherit" });
|
|
2444
|
-
for (const member of team.plan.members) {
|
|
2445
|
-
const rolePrompt = [
|
|
2446
|
-
`LongTable team discussion role: ${member.label} (${member.role}).`,
|
|
2447
|
-
"Give claims, objections, open questions, and evidence needs. Address likely disagreement with other roles.",
|
|
2448
|
-
"",
|
|
2449
|
-
prompt
|
|
2450
|
-
].join("\n");
|
|
2451
|
-
const logPath = join(teamDir, `${member.role}.log`);
|
|
2452
|
-
const command = [
|
|
2453
|
-
`node ${shellEscape(launcher)} review --role ${shellEscape(member.role)} --prompt ${shellEscape(rolePrompt)} --cwd ${shellEscape(workingDirectory)} 2>&1 | tee ${shellEscape(logPath)}`,
|
|
2454
|
-
`echo ${shellEscape(`Role log written to ${logPath}`)}`,
|
|
2455
|
-
`exec ${shellEscape(shell)}`
|
|
2456
|
-
].join("; ");
|
|
2457
|
-
execFileSync("tmux", ["split-window", "-t", sessionName, "-c", workingDirectory, command], { stdio: "inherit" });
|
|
2458
|
-
execFileSync("tmux", ["select-layout", "-t", sessionName, "tiled"], { stdio: "ignore" });
|
|
2459
|
-
}
|
|
2460
|
-
console.log(`LongTable tmux team launched: ${sessionName}`);
|
|
2461
|
-
console.log(`Attach with: tmux attach -t ${sessionName}`);
|
|
2462
|
-
console.log(`Logs: ${teamDir}`);
|
|
2439
|
+
console.log(renderTeamDebateSummary(team.run));
|
|
2440
|
+
console.log(`- checkpoint: ${team.questionRecord.id}`);
|
|
2463
2441
|
}
|
|
2464
2442
|
async function runDecide(args) {
|
|
2465
2443
|
const workingDirectory = typeof args.cwd === "string" ? args.cwd : cwd();
|
package/dist/debate.d.ts
CHANGED
package/dist/debate.js
CHANGED
|
@@ -322,7 +322,7 @@ function buildTeamBundle(options, kind) {
|
|
|
322
322
|
prompt: options.prompt,
|
|
323
323
|
roles: plan.members,
|
|
324
324
|
status: "completed",
|
|
325
|
-
surface:
|
|
325
|
+
surface: "file_backed_debate",
|
|
326
326
|
interactionDepth: kind === "debate" ? "debated" : "cross_reviewed",
|
|
327
327
|
roundPolicy: kind === "debate" ? "fixed" : "team_cross_review",
|
|
328
328
|
roundCount,
|
|
@@ -371,9 +371,7 @@ function buildTeamBundle(options, kind) {
|
|
|
371
371
|
interactionDepth: run.interactionDepth,
|
|
372
372
|
panelPlan: plan,
|
|
373
373
|
teamDebateRun: run,
|
|
374
|
-
degradationReason:
|
|
375
|
-
? undefined
|
|
376
|
-
: "Tmux was not requested; file-backed debate artifacts are the canonical execution record."
|
|
374
|
+
degradationReason: "File-backed team artifacts are the canonical execution record."
|
|
377
375
|
};
|
|
378
376
|
return {
|
|
379
377
|
plan,
|
package/dist/persona-router.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface LongTableInvocationDirective {
|
|
|
12
12
|
explicit: boolean;
|
|
13
13
|
cleanedPrompt: string;
|
|
14
14
|
mode?: InteractionMode | "panel" | "status";
|
|
15
|
+
collaboration?: "panel" | "team" | "debate";
|
|
15
16
|
roles: CanonicalPersona[];
|
|
16
17
|
panel: boolean;
|
|
17
18
|
showConflicts: boolean;
|
package/dist/persona-router.js
CHANGED
|
@@ -7,7 +7,9 @@ const DIRECTIVE_MAP = [
|
|
|
7
7
|
{ key: "critique", mode: "critique" },
|
|
8
8
|
{ key: "draft", mode: "draft" },
|
|
9
9
|
{ key: "commit", mode: "commit" },
|
|
10
|
-
{ key: "panel", mode: "panel", panel: true, showConflicts: true },
|
|
10
|
+
{ key: "panel", mode: "panel", collaboration: "panel", panel: true, showConflicts: true },
|
|
11
|
+
{ key: "team", mode: "review", collaboration: "team", panel: true, showConflicts: true },
|
|
12
|
+
{ key: "debate", mode: "review", collaboration: "debate", panel: true, showConflicts: true },
|
|
11
13
|
{ key: "status", mode: "status" },
|
|
12
14
|
{ key: "editor", mode: "review", roles: ["editor"] },
|
|
13
15
|
{ key: "reviewer", mode: "review", roles: ["reviewer"] },
|
|
@@ -72,6 +74,7 @@ export function parseInvocationDirective(prompt) {
|
|
|
72
74
|
explicit: true,
|
|
73
75
|
cleanedPrompt: body || prompt,
|
|
74
76
|
mode: directive.mode,
|
|
77
|
+
collaboration: directive.collaboration,
|
|
75
78
|
roles: directive.roles ?? [],
|
|
76
79
|
panel: directive.panel === true,
|
|
77
80
|
showConflicts: directive.showConflicts === true
|
|
@@ -113,7 +113,7 @@ export declare function syncCurrentWorkspaceView(context: LongTableProjectContex
|
|
|
113
113
|
export declare function appendInvocationRecordToWorkspace(context: LongTableProjectContext, invocation: InvocationRecord, questions?: QuestionRecord[]): Promise<ResearchState>;
|
|
114
114
|
export declare function listBlockingWorkspaceQuestions(context: LongTableProjectContext): Promise<QuestionRecord[]>;
|
|
115
115
|
export declare function assertWorkspaceNotBlocked(context: LongTableProjectContext): Promise<void>;
|
|
116
|
-
export declare function
|
|
116
|
+
export declare function createWorkspaceFollowUpQuestions(options: {
|
|
117
117
|
context: LongTableProjectContext;
|
|
118
118
|
prompt: string;
|
|
119
119
|
provider?: ProviderKind;
|
package/dist/project-session.js
CHANGED
|
@@ -647,10 +647,10 @@ function optionsForCheckpointTrigger(family, checkpointKey) {
|
|
|
647
647
|
function includesAny(prompt, patterns) {
|
|
648
648
|
return patterns.some((pattern) => pattern.test(prompt));
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function followUpQuestionOptions(first, second, third, fourth) {
|
|
651
651
|
return [first, second, third, ...(fourth ? [fourth] : [])];
|
|
652
652
|
}
|
|
653
|
-
function
|
|
653
|
+
function buildFollowUpQuestionSpecs(prompt) {
|
|
654
654
|
const normalized = prompt.toLowerCase();
|
|
655
655
|
const specs = [];
|
|
656
656
|
function push(spec) {
|
|
@@ -664,7 +664,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
664
664
|
title: "Rubric update basis",
|
|
665
665
|
question: "How should LongTable use the available materials to update the rubric?",
|
|
666
666
|
whyNow: "Rubric updates can silently change grading criteria if LongTable guesses the calibration basis.",
|
|
667
|
-
options:
|
|
667
|
+
options: followUpQuestionOptions({ value: "calibrate_to_exemplars", label: "Calibrate criteria to exemplars", description: "Use strong submissions to refine what each criterion means.", recommended: true }, { value: "polish_existing", label: "Polish existing rubric only", description: "Keep criteria stable and improve wording or consistency." }, { value: "rewrite_structure", label: "Restructure the rubric", description: "Change categories or levels where the materials suggest a better structure." })
|
|
668
668
|
});
|
|
669
669
|
}
|
|
670
670
|
if (includesAny(normalized, [/\bexemplar\b/, /\bbest submission\b/, /\bselected submission\b/, /\bTA\b/i, /우수\s*답안|예시|선정|조교/])) {
|
|
@@ -673,7 +673,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
673
673
|
title: "Exemplar use",
|
|
674
674
|
question: "How should LongTable use selected exemplars or TA guidance?",
|
|
675
675
|
whyNow: "Exemplars can either calibrate criteria privately or become visible evidence inside the output.",
|
|
676
|
-
options:
|
|
676
|
+
options: followUpQuestionOptions({ value: "calibrate_only", label: "Use as private calibration", description: "Adjust criteria using exemplars without quoting them.", recommended: true }, { value: "include_deidentified_excerpts", label: "Include de-identified excerpts", description: "Add short anonymized examples where they clarify quality." }, { value: "separate_notes", label: "Keep examples in separate notes", description: "Use exemplars outside the main artifact." })
|
|
677
677
|
});
|
|
678
678
|
}
|
|
679
679
|
if (includesAny(normalized, [/\binstruction/, /\bguidance\b/, /\bsource\b/, /\bfile\b/, /\bdocx?\b/, /지침|가이드|문서|파일|자료/])) {
|
|
@@ -682,7 +682,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
682
682
|
title: "Source authority",
|
|
683
683
|
question: "If sources conflict or leave gaps, which source should LongTable privilege?",
|
|
684
684
|
whyNow: "Without an authority rule, LongTable may resolve conflicts by convenience rather than researcher intent.",
|
|
685
|
-
options:
|
|
685
|
+
options: followUpQuestionOptions({ value: "explicit_user_instruction", label: "Your explicit instruction", description: "Use the researcher's current instruction as the highest authority.", recommended: true }, { value: "project_files", label: "Project files", description: "Treat supplied files or existing artifacts as authoritative." }, { value: "external_guidance", label: "TA or external guidance", description: "Prioritize instructor, TA, venue, or policy guidance." })
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
688
|
if (includesAny(normalized, [/\bdeliver\b/, /\boutput\b/, /\btracked?[- ]?change/, /\bdocx?\b/, /\bmarkdown\b/, /\btable\b/, /전달|산출물|결과물|수정\s*표시|트랙|형식|포맷/])) {
|
|
@@ -691,7 +691,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
691
691
|
title: "Delivery format",
|
|
692
692
|
question: "How should LongTable deliver the clarified output?",
|
|
693
693
|
whyNow: "Format and change-tracking choices affect whether the result is usable for review or handoff.",
|
|
694
|
-
options:
|
|
694
|
+
options: followUpQuestionOptions({ value: "tracked_changes", label: "Tracked-change artifact", description: "Produce a reviewable changed version where possible.", recommended: true }, { value: "clean_final", label: "Clean final artifact", description: "Deliver the final version without change markup." }, { value: "summary_plus_artifact", label: "Summary plus artifact", description: "Include a concise change summary with the output." })
|
|
695
695
|
});
|
|
696
696
|
}
|
|
697
697
|
if (includesAny(normalized, [/\bupdate\b/, /\bchange\b/, /\bedit\b/, /\bfix\b/, /\bimplement\b/, /\bbuild\b/, /\bcreate\b/, /업데이트|수정|변경|구현|만들|고쳐/])) {
|
|
@@ -700,7 +700,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
700
700
|
title: "Autonomy boundary",
|
|
701
701
|
question: "How much should LongTable do before checking back with you?",
|
|
702
702
|
whyNow: "Execution requests can move from advice to authorship or artifact ownership unless the boundary is explicit.",
|
|
703
|
-
options:
|
|
703
|
+
options: followUpQuestionOptions({ value: "ask_then_act", label: "Clarify first, then act", description: "Ask needed questions before changing the artifact.", recommended: true }, { value: "act_with_defaults", label: "Act with visible defaults", description: "Proceed using recommended defaults and record them." }, { value: "recommend_only", label: "Recommend only", description: "Describe changes but do not alter artifacts." })
|
|
704
704
|
});
|
|
705
705
|
}
|
|
706
706
|
if (includesAny(normalized, [/\bperformance\b/, /\btest\b/, /\bevaluate\b/, /\bcheck\b/, /\bbenchmark\b/, /성능|테스트|평가|체크|검증/])) {
|
|
@@ -709,7 +709,7 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
709
709
|
title: "Evaluation target",
|
|
710
710
|
question: "What should LongTable treat as the main performance target?",
|
|
711
711
|
whyNow: "Performance checks can optimize for UX, correctness, trigger sensitivity, or delivery reliability.",
|
|
712
|
-
options:
|
|
712
|
+
options: followUpQuestionOptions({ value: "question_sensitivity", label: "Question sensitivity", description: "Check whether LongTable asks at the right knowledge-gap moments.", recommended: true }, { value: "renderer_convenience", label: "Renderer convenience", description: "Check whether the most convenient question UI is used." }, { value: "state_reliability", label: "State reliability", description: "Check whether questions and answers persist correctly." })
|
|
713
713
|
});
|
|
714
714
|
}
|
|
715
715
|
if (specs.length === 0) {
|
|
@@ -718,19 +718,19 @@ function buildClarificationQuestionSpecs(prompt) {
|
|
|
718
718
|
title: "Missing context",
|
|
719
719
|
question: "What should LongTable clarify before proceeding?",
|
|
720
720
|
whyNow: "The request can be answered in multiple ways, and choosing silently would hide a researcher judgment.",
|
|
721
|
-
options:
|
|
721
|
+
options: followUpQuestionOptions({ value: "scope", label: "Clarify scope first", description: "Ask what is included and excluded before acting.", recommended: true }, { value: "criteria", label: "Clarify success criteria", description: "Ask what would count as a good result." }, { value: "proceed", label: "Proceed with visible assumptions", description: "Continue, but make assumptions explicit." })
|
|
722
722
|
});
|
|
723
723
|
}
|
|
724
724
|
return specs;
|
|
725
725
|
}
|
|
726
|
-
const
|
|
727
|
-
function
|
|
728
|
-
return record.prompt.rationale.includes(`${
|
|
726
|
+
const FOLLOW_UP_PROMPT_PREFIX = "Follow-up prompt:";
|
|
727
|
+
function hasFollowUpPrompt(record, prompt) {
|
|
728
|
+
return record.prompt.rationale.includes(`${FOLLOW_UP_PROMPT_PREFIX} ${prompt}`);
|
|
729
729
|
}
|
|
730
|
-
export async function
|
|
730
|
+
export async function createWorkspaceFollowUpQuestions(options) {
|
|
731
731
|
const state = await loadResearchState(options.context.stateFilePath);
|
|
732
732
|
if (!options.force) {
|
|
733
|
-
const existing = (state.questionLog ?? []).filter((record) =>
|
|
733
|
+
const existing = (state.questionLog ?? []).filter((record) => hasFollowUpPrompt(record, options.prompt));
|
|
734
734
|
const pending = existing.filter((record) => record.status === "pending");
|
|
735
735
|
if (pending.length > 0) {
|
|
736
736
|
return { questions: pending, state, created: false, alreadyAnswered: false };
|
|
@@ -743,14 +743,14 @@ export async function createWorkspaceClarificationCard(options) {
|
|
|
743
743
|
const preferredSurfaces = options.provider === "claude"
|
|
744
744
|
? ["native_structured", "terminal_selector", "numbered"]
|
|
745
745
|
: ["mcp_elicitation", "terminal_selector", "numbered"];
|
|
746
|
-
const questions =
|
|
746
|
+
const questions = buildFollowUpQuestionSpecs(options.prompt).map((spec) => ({
|
|
747
747
|
id: createId("question_record"),
|
|
748
748
|
createdAt,
|
|
749
749
|
updatedAt: createdAt,
|
|
750
750
|
status: "pending",
|
|
751
751
|
prompt: {
|
|
752
752
|
id: createId("question_prompt"),
|
|
753
|
-
checkpointKey: `
|
|
753
|
+
checkpointKey: `follow_up_${spec.key}`,
|
|
754
754
|
title: spec.title,
|
|
755
755
|
question: spec.question,
|
|
756
756
|
type: "single_choice",
|
|
@@ -761,7 +761,7 @@ export async function createWorkspaceClarificationCard(options) {
|
|
|
761
761
|
source: "runtime_guidance",
|
|
762
762
|
rationale: [
|
|
763
763
|
spec.whyNow,
|
|
764
|
-
`${
|
|
764
|
+
`${FOLLOW_UP_PROMPT_PREFIX} ${options.prompt}`
|
|
765
765
|
],
|
|
766
766
|
preferredSurfaces: preferredSurfaces
|
|
767
767
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@longtable/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.26",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Researcher-facing LongTable CLI",
|
|
6
6
|
"type": "module",
|
|
@@ -28,12 +28,12 @@
|
|
|
28
28
|
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@longtable/checkpoints": "0.1.
|
|
32
|
-
"@longtable/core": "0.1.
|
|
33
|
-
"@longtable/memory": "0.1.
|
|
34
|
-
"@longtable/provider-claude": "0.1.
|
|
35
|
-
"@longtable/provider-codex": "0.1.
|
|
36
|
-
"@longtable/setup": "0.1.
|
|
31
|
+
"@longtable/checkpoints": "0.1.26",
|
|
32
|
+
"@longtable/core": "0.1.26",
|
|
33
|
+
"@longtable/memory": "0.1.26",
|
|
34
|
+
"@longtable/provider-claude": "0.1.26",
|
|
35
|
+
"@longtable/provider-codex": "0.1.26",
|
|
36
|
+
"@longtable/setup": "0.1.26"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"@types/node": "^22.10.1",
|