mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-07 14:30:44 +00:00
* fix(bootstrap): workspace bootstrap prompt routing * Fix bootstrap routing edge cases * Refine bootstrap mode routing and reset prompts * Fix bootstrap workspace routing for embedded runs * Fix embedded bootstrap compile follow-up * Align bare reset bootstrap file access * Honor reset override model for bootstrap gating * Align chat reset bootstrap topology
90 lines
2.4 KiB
TypeScript
90 lines
2.4 KiB
TypeScript
import { describe, expect, it } from "vitest";
|
|
import { resolveBootstrapMode } from "./bootstrap-mode.js";
|
|
|
|
describe("resolveBootstrapMode", () => {
|
|
it("returns none when bootstrap is not pending", () => {
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: false,
|
|
runKind: "default",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("none");
|
|
});
|
|
|
|
it("returns full for primary interactive canonical runs with file access", () => {
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "default",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("full");
|
|
});
|
|
|
|
it("returns limited for primary interactive copied-sandbox runs with file access", () => {
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "default",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: false,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("limited");
|
|
});
|
|
|
|
it("returns none for cron, heartbeat, and non-primary runs", () => {
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "cron",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("none");
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "heartbeat",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("none");
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "default",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: false,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: true,
|
|
}),
|
|
).toBe("none");
|
|
});
|
|
|
|
it("returns none when the run cannot access bootstrap files normally", () => {
|
|
expect(
|
|
resolveBootstrapMode({
|
|
bootstrapPending: true,
|
|
runKind: "default",
|
|
isInteractiveUserFacing: true,
|
|
isPrimaryRun: true,
|
|
isCanonicalWorkspace: true,
|
|
hasBootstrapFileAccess: false,
|
|
}),
|
|
).toBe("none");
|
|
});
|
|
});
|