@cryer/star-cli 0.3.4 → 0.3.5
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 +5 -0
- package/README.zh-CN.md +4 -0
- package/dist/{chunk-K3R42LOX.js → chunk-OIDB2E5J.js} +33 -8
- package/dist/chunk-OIDB2E5J.js.map +1 -0
- package/dist/{loop-SDZVEQND.js → loop-H5RYTO2O.js} +2 -2
- package/dist/main.js +31 -9
- package/dist/main.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-K3R42LOX.js.map +0 -1
- /package/dist/{loop-SDZVEQND.js.map → loop-H5RYTO2O.js.map} +0 -0
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
import {
|
|
3
3
|
AgentLoop,
|
|
4
4
|
PLAN_MODE_PROMPT
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OIDB2E5J.js";
|
|
6
6
|
import "./chunk-B6P4VUBE.js";
|
|
7
7
|
export {
|
|
8
8
|
AgentLoop,
|
|
9
9
|
PLAN_MODE_PROMPT
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=loop-
|
|
11
|
+
//# sourceMappingURL=loop-H5RYTO2O.js.map
|
package/dist/main.js
CHANGED
|
@@ -44,7 +44,7 @@ import {
|
|
|
44
44
|
resolveSnapshotContent,
|
|
45
45
|
rewindToSnapshot,
|
|
46
46
|
summarizeMessages
|
|
47
|
-
} from "./chunk-
|
|
47
|
+
} from "./chunk-OIDB2E5J.js";
|
|
48
48
|
import {
|
|
49
49
|
envFilePath,
|
|
50
50
|
globalConfigPath,
|
|
@@ -827,6 +827,12 @@ function debugWarn(message) {
|
|
|
827
827
|
if (process.env.STAR_DEBUG === "1") process.stderr.write(`[star-cli] ${message}
|
|
828
828
|
`);
|
|
829
829
|
}
|
|
830
|
+
var META_WRITE_MAX_ATTEMPTS = 5;
|
|
831
|
+
var META_WRITE_RETRY_DELAY_MS = 25;
|
|
832
|
+
function isTransientFsError(error) {
|
|
833
|
+
const code = error.code;
|
|
834
|
+
return code === "EPERM" || code === "EACCES" || code === "EBUSY";
|
|
835
|
+
}
|
|
830
836
|
var FALLBACK_META = /* @__PURE__ */ Symbol("star.fallbackMeta");
|
|
831
837
|
function isFallbackMeta(meta) {
|
|
832
838
|
return meta[FALLBACK_META] === true;
|
|
@@ -901,17 +907,33 @@ var SessionStore = class _SessionStore {
|
|
|
901
907
|
// writers race the loop's own appends, and a truncated read once turned
|
|
902
908
|
// fallbackMeta's empty defaults into a persisted wipe of model/cwd/usage.
|
|
903
909
|
// A branded fallback meta is never written back for the same reason.
|
|
910
|
+
// A write that still fails after retries is dropped rather than thrown:
|
|
911
|
+
// meta.json is bookkeeping the cached meta rebuilds on the next write,
|
|
912
|
+
// while the conversation itself lives in messages.jsonl — killing the
|
|
913
|
+
// agent turn over a stale updatedAt would be the wrong trade.
|
|
904
914
|
writeMeta(meta) {
|
|
905
915
|
if (isFallbackMeta(meta)) return Promise.resolve();
|
|
906
916
|
const tmp = `${this.metaPath()}.tmp-${process.pid}-${this.metaTmpSeq++}`;
|
|
907
917
|
const run = this.metaWriteQueue.then(async () => {
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
})
|
|
914
|
-
|
|
918
|
+
for (let attempt = 0; attempt < META_WRITE_MAX_ATTEMPTS; attempt++) {
|
|
919
|
+
try {
|
|
920
|
+
await fs3.writeFile(tmp, JSON.stringify(meta, null, 2));
|
|
921
|
+
await fs3.rename(tmp, this.metaPath());
|
|
922
|
+
return;
|
|
923
|
+
} catch (error) {
|
|
924
|
+
if (isTransientFsError(error) && attempt + 1 < META_WRITE_MAX_ATTEMPTS) {
|
|
925
|
+
await new Promise(
|
|
926
|
+
(resolve) => setTimeout(resolve, META_WRITE_RETRY_DELAY_MS * (attempt + 1))
|
|
927
|
+
);
|
|
928
|
+
continue;
|
|
929
|
+
}
|
|
930
|
+
await fs3.unlink(tmp).catch(() => {
|
|
931
|
+
});
|
|
932
|
+
debugWarn(
|
|
933
|
+
`session ${this.id}: meta write failed (${error.code ?? String(error)}), skipping`
|
|
934
|
+
);
|
|
935
|
+
return;
|
|
936
|
+
}
|
|
915
937
|
}
|
|
916
938
|
});
|
|
917
939
|
this.metaWriteQueue = run.catch(() => {
|
|
@@ -5719,7 +5741,7 @@ ${plan.affected.length} file change(s) will be reverted, ${messageCount} message
|
|
|
5719
5741
|
`permissionMode: ${config.permissionMode}`,
|
|
5720
5742
|
`providers (${config.providers.length}): ${config.providers.map((p) => p.name).join(", ") || "(none)"}`,
|
|
5721
5743
|
`models (${config.models.length}): ${config.models.map((m) => m.name).join(", ") || "(none)"}`,
|
|
5722
|
-
`maxSteps: ${config.maxSteps}`,
|
|
5744
|
+
`maxSteps: ${config.maxSteps === 0 ? "unlimited" : config.maxSteps}`,
|
|
5723
5745
|
`contextMaxTokens: ${config.contextMaxTokens}`,
|
|
5724
5746
|
`compactThresholdTokens: ${config.compactThresholdTokens ?? "(context window)"}`,
|
|
5725
5747
|
`streamIdleTimeoutSec: ${config.streamIdleTimeoutSec}`,
|