motifcode 0.3.2 → 0.3.3
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/build-info.json +2 -2
- package/dist/motif.js +14 -7
- package/package.json +1 -1
package/dist/build-info.json
CHANGED
package/dist/motif.js
CHANGED
|
@@ -7430,16 +7430,22 @@ async function runBash(command, cwd, timeoutMs, policy, scratch, signal) {
|
|
|
7430
7430
|
}
|
|
7431
7431
|
return { ok: r.code === 0, output: r.output.trim() || `(exit ${r.code})` };
|
|
7432
7432
|
}
|
|
7433
|
+
function toLogicalLines(text) {
|
|
7434
|
+
if (text === "") return [];
|
|
7435
|
+
const normalized = text.endsWith("\n") ? text.slice(0, -1) : text;
|
|
7436
|
+
return normalized.split("\n");
|
|
7437
|
+
}
|
|
7433
7438
|
function readSlice(path, cwd, offset, limit) {
|
|
7434
7439
|
try {
|
|
7435
7440
|
const text = readFileSync5(resolve4(cwd, path), "utf8");
|
|
7436
|
-
const lines = text
|
|
7441
|
+
const lines = toLogicalLines(text);
|
|
7437
7442
|
const start = Math.max(0, (offset ?? 1) - 1);
|
|
7438
7443
|
const end = limit !== void 0 ? start + limit : lines.length;
|
|
7439
7444
|
const slice = lines.slice(start, end);
|
|
7440
7445
|
const numbered = slice.map((l, i) => `${start + i + 1} ${l}`).join("\n");
|
|
7441
|
-
const
|
|
7442
|
-
|
|
7446
|
+
const remaining = Math.max(0, lines.length - end);
|
|
7447
|
+
const more = remaining > 0 ? numbered ? `
|
|
7448
|
+
\u2026 ${remaining} more lines` : `\u2026 ${remaining} more lines` : "";
|
|
7443
7449
|
return { ok: true, output: numbered + more };
|
|
7444
7450
|
} catch (err) {
|
|
7445
7451
|
return { ok: false, output: String(err) };
|
|
@@ -7454,7 +7460,7 @@ function writeFile(path, content, cwd) {
|
|
|
7454
7460
|
const lines = content === "" ? 0 : content.split("\n").length;
|
|
7455
7461
|
return {
|
|
7456
7462
|
ok: true,
|
|
7457
|
-
output: `${existed ? "replaced" : "created"} ${path} (${lines} lines, ${content
|
|
7463
|
+
output: `${existed ? "replaced" : "created"} ${path} (${lines} lines, ${Buffer.byteLength(content, "utf8")} bytes)`
|
|
7458
7464
|
};
|
|
7459
7465
|
} catch (err) {
|
|
7460
7466
|
return { ok: false, output: String(err) };
|
|
@@ -9218,7 +9224,7 @@ function saveUserSetting(key, value, home = homedir4()) {
|
|
|
9218
9224
|
}
|
|
9219
9225
|
|
|
9220
9226
|
// packages/cli/src/main.ts
|
|
9221
|
-
var VERSION = "0.3.
|
|
9227
|
+
var VERSION = "0.3.3";
|
|
9222
9228
|
var SHORT_FLAGS = { p: "print", c: "continue", i: "interactive", v: "verbose", h: "help" };
|
|
9223
9229
|
var BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
|
|
9224
9230
|
"print",
|
|
@@ -9821,6 +9827,7 @@ user file ${stored.userPath}${existsSync10(stored.userPath) ? "" : " (absent
|
|
|
9821
9827
|
const activeToolNames = CORE_TOOL_NAMES.slice(0, activeTools.length);
|
|
9822
9828
|
const schemaHash = toolSchemaHash(activeTools);
|
|
9823
9829
|
const promptHash = systemPromptHash(systemFor(channel));
|
|
9830
|
+
const printOnly = args.flags["print"] === true || args.flags["p"] === true;
|
|
9824
9831
|
let task;
|
|
9825
9832
|
if (resumeFrom) {
|
|
9826
9833
|
const blocker = checkResumable(resumeFrom, {
|
|
@@ -9834,7 +9841,7 @@ user file ${stored.userPath}${existsSync10(stored.userPath) ? "" : " (absent
|
|
|
9834
9841
|
return 2;
|
|
9835
9842
|
}
|
|
9836
9843
|
task = resumeFrom.task ?? "";
|
|
9837
|
-
process.stdout.write(
|
|
9844
|
+
(printOnly ? process.stderr : process.stdout).write(
|
|
9838
9845
|
`resuming ${resumeFrom.header.runId} from turn ${resumeFrom.checkpoint.turn}${resumeFrom.truncatedTail ? " (last record was truncated)" : ""}
|
|
9839
9846
|
`
|
|
9840
9847
|
);
|
|
@@ -9842,7 +9849,6 @@ user file ${stored.userPath}${existsSync10(stored.userPath) ? "" : " (absent
|
|
|
9842
9849
|
task = args.rest.join(" ").trim();
|
|
9843
9850
|
}
|
|
9844
9851
|
const wantsChat = args.flags["interactive"] === true || args.flags["chat"] === true || args.flags["continue"] === true;
|
|
9845
|
-
const printOnly = args.flags["print"] === true || args.flags["p"] === true;
|
|
9846
9852
|
const tty = Boolean(process.stdin.isTTY && process.stdout.isTTY);
|
|
9847
9853
|
if (wantsChat && !tty) {
|
|
9848
9854
|
throw new UsageError("--interactive needs a terminal on stdin and stdout");
|
|
@@ -9929,6 +9935,7 @@ user file ${stored.userPath}${existsSync10(stored.userPath) ? "" : " (absent
|
|
|
9929
9935
|
maxTurns,
|
|
9930
9936
|
...maxOutputTokens !== void 0 ? { maxOutputTokens } : {},
|
|
9931
9937
|
...seed !== void 0 ? { seed } : {},
|
|
9938
|
+
...resumeFrom?.checkpoint ? { resume: resumeFrom.checkpoint } : {},
|
|
9932
9939
|
replyEnds: true,
|
|
9933
9940
|
confirmDone: false
|
|
9934
9941
|
});
|