spacecode 2.1.0 → 2.1.1
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/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/repl.mjs +27 -14
- package/package.json +1 -1
package/dist/repl.mjs
CHANGED
|
@@ -97392,8 +97392,9 @@ function validateSubmission(text) {
|
|
|
97392
97392
|
function withCursor(row, col) {
|
|
97393
97393
|
return `${row.slice(0, col)}\x1B[7m${row[col] ?? " "}\x1B[27m${row.slice(col + 1)}`;
|
|
97394
97394
|
}
|
|
97395
|
-
function PromptEditor({ onSubmit, disabled, history, listFiles: listFiles2, onTab, locked = false, promptGlyph: promptGlyph2 = ">", onEmptyEnter }) {
|
|
97395
|
+
function PromptEditor({ onSubmit, disabled, history, listFiles: listFiles2, onTab, locked = false, promptGlyph: promptGlyph2 = ">", onEmptyEnter, unicode = true }) {
|
|
97396
97396
|
const { exit } = use_app_default();
|
|
97397
|
+
const { columns } = useTerminalSize();
|
|
97397
97398
|
const { isRawModeSupported } = use_stdin_default();
|
|
97398
97399
|
const [buf, setBuf] = (0, import_react29.useState)(() => createBuffer());
|
|
97399
97400
|
const [hint, setHint] = (0, import_react29.useState)(null);
|
|
@@ -97545,24 +97546,27 @@ function PromptEditor({ onSubmit, disabled, history, listFiles: listFiles2, onTa
|
|
|
97545
97546
|
if (!isRawModeSupported) {
|
|
97546
97547
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...paint("delete"), children: 'Interactive input needs a TTY (stdin is not a terminal). Use `spacecode -p "<prompt>"` for headless runs.' });
|
|
97547
97548
|
}
|
|
97548
|
-
if (disabled && buf.text === "") return null;
|
|
97549
97549
|
const rows = lines(buf);
|
|
97550
97550
|
const { line, col } = lineCol(buf);
|
|
97551
97551
|
const matches = shell ? [] : slashMatches(buf.text, SLASH_COMMANDS);
|
|
97552
97552
|
const picks = mention && files ? rankPaths(files, mention.query, PICKER_ROWS) : [];
|
|
97553
97553
|
const pickAt = Math.min(sel, Math.max(picks.length - 1, 0));
|
|
97554
97554
|
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { flexDirection: "column", children: [
|
|
97555
|
-
rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
97555
|
+
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Box_default, { flexDirection: "column", borderStyle: unicode ? "round" : "classic", borderColor: paint("secondary").color, borderDimColor: disabled, paddingX: 1, width: Math.min(columns, MAX_STATIC_LINE), children: rows.map((row, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Box_default, { children: [
|
|
97556
97556
|
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...paint(shell ? "action" : "agent"), bold: true, dimColor: disabled, children: i === 0 ? shell ? "! " : `${promptGlyph2} ` : " " }),
|
|
97557
|
-
/* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: disabled, children: i === line && !disabled ? withCursor(row, col) : row })
|
|
97558
|
-
] }, i)),
|
|
97557
|
+
disabled && !locked && buf.text === "" ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...paint("secondary"), children: "turn running - type to queue your next prompt" }) : /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { dimColor: disabled, children: i === line && !disabled ? withCursor(row, col) : row })
|
|
97558
|
+
] }, i)) }),
|
|
97559
97559
|
matches.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { ...paint("secondary"), children: [
|
|
97560
|
-
matches.map((c) => `/${c.name} \u2014 ${c.description}`).join(" "),
|
|
97560
|
+
matches.map((c) => `/${c.name} ${unicode ? "\u2014" : "-"} ${c.description}`).join(" "),
|
|
97561
97561
|
" (Tab to complete)"
|
|
97562
97562
|
] }),
|
|
97563
97563
|
shell && buf.text === "" && !disabled && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...paint("secondary"), children: "shell mode: runs on your machine, not sent to the model (Backspace exits)" }),
|
|
97564
|
-
picks.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...i === pickAt ? paint("action") : paint("secondary"), children: `${i === pickAt ? "\u203A" : " "} ${p}` }, p)),
|
|
97565
|
-
picks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.
|
|
97564
|
+
picks.map((p, i) => /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...i === pickAt ? paint("action") : paint("secondary"), children: `${i === pickAt ? unicode ? "\u203A" : ">" : " "} ${p}` }, p)),
|
|
97565
|
+
picks.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(Text, { ...paint("secondary"), children: [
|
|
97566
|
+
"(",
|
|
97567
|
+
unicode ? "\u2191/\u2193" : "up/down",
|
|
97568
|
+
" select, Tab or Enter to insert)"
|
|
97569
|
+
] }),
|
|
97566
97570
|
hint && /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(Text, { ...paint("delete"), children: hint })
|
|
97567
97571
|
] });
|
|
97568
97572
|
}
|
|
@@ -97579,6 +97583,8 @@ var init_PromptEditor = __esm({
|
|
|
97579
97583
|
init_slash_menu();
|
|
97580
97584
|
init_slash_commands();
|
|
97581
97585
|
init_theme();
|
|
97586
|
+
init_hints();
|
|
97587
|
+
await init_useTerminalSize();
|
|
97582
97588
|
import_jsx_runtime9 = __toESM(require_jsx_runtime(), 1);
|
|
97583
97589
|
PICKER_ROWS = 6;
|
|
97584
97590
|
}
|
|
@@ -98155,8 +98161,8 @@ async function runAgentLoop(prompt, config, executor, emit, signal, existingMess
|
|
|
98155
98161
|
const toolInput = block.input ?? {};
|
|
98156
98162
|
const startTime = Date.now();
|
|
98157
98163
|
let result;
|
|
98158
|
-
const onOutput = (
|
|
98159
|
-
emitToolOutput(emit, { type: "tool_output", id, stream, text });
|
|
98164
|
+
const onOutput = (_reportedId, stream, text) => {
|
|
98165
|
+
emitToolOutput(emit, { type: "tool_output", id: toolId, stream, text });
|
|
98160
98166
|
};
|
|
98161
98167
|
try {
|
|
98162
98168
|
result = await executor.execute(toolName, toolInput, onOutput);
|
|
@@ -99955,6 +99961,7 @@ function useReplController({ repoName: repoName2, yolo: yolo2, mentions: mention
|
|
|
99955
99961
|
const [turns, setTurns] = (0, import_react30.useState)([]);
|
|
99956
99962
|
const turnIdRef = (0, import_react30.useRef)(0);
|
|
99957
99963
|
const [isRunning, setIsRunning] = (0, import_react30.useState)(false);
|
|
99964
|
+
const [livePrompt, setLivePrompt] = (0, import_react30.useState)(null);
|
|
99958
99965
|
const [history, setHistory] = (0, import_react30.useState)([]);
|
|
99959
99966
|
const [turnTokens, setTurnTokens] = (0, import_react30.useState)(null);
|
|
99960
99967
|
const [sessionTokens, setSessionTokens] = (0, import_react30.useState)({ input: 0, output: 0 });
|
|
@@ -100319,6 +100326,7 @@ ${tools.map((t) => ` ${t.name}`).join("\n")}`);
|
|
|
100319
100326
|
return;
|
|
100320
100327
|
}
|
|
100321
100328
|
setIsRunning(true);
|
|
100329
|
+
setLivePrompt(prompt);
|
|
100322
100330
|
setNotices([]);
|
|
100323
100331
|
setEvents([]);
|
|
100324
100332
|
setTurnTokens(null);
|
|
@@ -100385,6 +100393,7 @@ ${tools.map((t) => ` ${t.name}`).join("\n")}`);
|
|
|
100385
100393
|
retained
|
|
100386
100394
|
);
|
|
100387
100395
|
setTurnStartedAt(null);
|
|
100396
|
+
setLivePrompt(null);
|
|
100388
100397
|
setEvents([]);
|
|
100389
100398
|
refuseAllConfirms();
|
|
100390
100399
|
abortRef.current = null;
|
|
@@ -100429,7 +100438,7 @@ ${tools.map((t) => ` ${t.name}`).join("\n")}`);
|
|
|
100429
100438
|
}),
|
|
100430
100439
|
[sessions, applySession]
|
|
100431
100440
|
);
|
|
100432
|
-
return { turns, events, isRunning, turnTokens, notices, pending, mode, todos, stats, submit, retry, mentions, replayed, resume };
|
|
100441
|
+
return { turns, events, isRunning, livePrompt, turnTokens, notices, pending, mode, todos, stats, submit, retry, mentions, replayed, resume };
|
|
100433
100442
|
}
|
|
100434
100443
|
var import_react30, apiUrl;
|
|
100435
100444
|
var init_useReplController = __esm({
|
|
@@ -100721,7 +100730,7 @@ function App2({ repoName: repoName2, onboardingMode: onboardingMode2, launchCoun
|
|
|
100721
100730
|
const { isRawModeSupported } = use_stdin_default();
|
|
100722
100731
|
const [resumeFound, setResumeFound] = (0, import_react33.useState)(null);
|
|
100723
100732
|
const openResume = (0, import_react33.useCallback)((found) => setResumeFound(found), []);
|
|
100724
|
-
const { turns, events, isRunning, notices, pending, mode, todos, stats, submit, retry, mentions, replayed, resume } = useReplController({ repoName: repoName2, yolo: yolo2, sessions: sessionStore, resumeLatest: resumeLatest2, onViewTurns: openViewer, onViewResume: isRawModeSupported && interactivePicker ? openResume : void 0, isEscOwned });
|
|
100733
|
+
const { turns, events, isRunning, livePrompt, notices, pending, mode, todos, stats, submit, retry, mentions, replayed, resume } = useReplController({ repoName: repoName2, yolo: yolo2, sessions: sessionStore, resumeLatest: resumeLatest2, onViewTurns: openViewer, onViewResume: isRawModeSupported && interactivePicker ? openResume : void 0, isEscOwned });
|
|
100725
100734
|
const { columns, rows } = useTerminalSize();
|
|
100726
100735
|
const viewing = viewingRaw && !pending;
|
|
100727
100736
|
const picking = resumeFound !== null && !pending;
|
|
@@ -100797,12 +100806,16 @@ function App2({ repoName: repoName2, onboardingMode: onboardingMode2, launchCoun
|
|
|
100797
100806
|
}
|
|
100798
100807
|
),
|
|
100799
100808
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Box_default, { flexDirection: "column", display: viewing || picking ? "none" : "flex", children: [
|
|
100800
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.
|
|
100809
|
+
livePrompt !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsxs)(Text, { ...paint("secondary"), children: [
|
|
100810
|
+
"> ",
|
|
100811
|
+
livePrompt
|
|
100812
|
+
] }),
|
|
100813
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(EventRenderer, { deferErrors: true, events, liveMaxLines: Math.max(6, rows - 15), focusId: focusing ? focusId : null, openId: focusing ? openId : null, detailRows: Math.max(4, rows - 14), waitingId: waitingStep?.id ?? null, prompt: promptNode }),
|
|
100801
100814
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(TodoChecklist, { todos }),
|
|
100802
100815
|
pending && !waitingStep && promptNode,
|
|
100803
100816
|
isRunning && !pending && stats.elapsedMs !== null && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...paint("secondary"), children: formatThinking(stats.elapsedMs, stats.approxTokens, activeGlyphs().rail === "\u2502") }),
|
|
100804
100817
|
focusing && /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...paint("secondary"), children: activeGlyphs().rail === "\u2502" ? "step focus: \u2191\u2193 or tab move \xB7 enter open/close \xB7 esc back to the prompt" : "step focus: up/down or tab move - enter open/close - esc back to the prompt" }),
|
|
100805
|
-
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PromptEditor, { onEmptyEnter: isRunning ? void 0 : retry, promptGlyph: promptGlyph(mode, activeGlyphs().rail === "\u2502"), onSubmit: submit, disabled: isRunning, history: promptHistory, listFiles: mentions.list, onTab: enterFocus, locked: focusing || viewing || picking || Boolean(pending) }),
|
|
100818
|
+
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(PromptEditor, { onEmptyEnter: isRunning ? void 0 : retry, promptGlyph: promptGlyph(mode, activeGlyphs().rail === "\u2502"), unicode: activeGlyphs().rail === "\u2502", onSubmit: submit, disabled: isRunning, history: promptHistory, listFiles: mentions.list, onTab: enterFocus, locked: focusing || viewing || picking || Boolean(pending) }),
|
|
100806
100819
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...footer.level === "critical" ? paint("delete") : footer.level === "warn" ? paint("needsYou") : paint("secondary"), children: footer.text }),
|
|
100807
100820
|
/* @__PURE__ */ (0, import_jsx_runtime12.jsx)(Text, { ...paint("secondary"), children: formatHints({ running: isRunning, asking: Boolean(pending), columns }, activeGlyphs().sep) })
|
|
100808
100821
|
] })
|