switchback-core 2026.10.15 → 2026.10.16
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/package.json +1 -1
- package/src/config-editor.ts +17 -1
- package/src/index.ts +7 -1
package/package.json
CHANGED
package/src/config-editor.ts
CHANGED
|
@@ -36,7 +36,7 @@ import { join } from "node:path";
|
|
|
36
36
|
import { writeFileAtomic } from "./atomic-write.ts";
|
|
37
37
|
import { isMap, isSeq, parseDocument, type Document, type YAMLMap, type YAMLSeq } from "yaml";
|
|
38
38
|
import { ConfigError, piConfigDir, validateFileConfig } from "./config.ts";
|
|
39
|
-
import type { ModelId, SwitchbackFileConfig } from "./types.ts";
|
|
39
|
+
import type { IdleResetConfig, ModelId, SwitchbackFileConfig } from "./types.ts";
|
|
40
40
|
|
|
41
41
|
/** Which switchback.yaml layer the editor has open. */
|
|
42
42
|
export type ConfigLayer = "global" | "project";
|
|
@@ -405,6 +405,22 @@ export function countDecisionModelReferences(loaded: LoadedLayer, address: strin
|
|
|
405
405
|
return count;
|
|
406
406
|
}
|
|
407
407
|
|
|
408
|
+
/**
|
|
409
|
+
* Set or clear a model's `idleReset:` option. A duration ("30m", "2h", ...)
|
|
410
|
+
* returns to the head of the fallback list after that much idle time;
|
|
411
|
+
* `classifier` asks the decision model; `null` deletes the key, which is the
|
|
412
|
+
* loader's default (`never`). Validation of the value itself is the loader's
|
|
413
|
+
* job at save time, so an unknown value surfaces with the loader's message.
|
|
414
|
+
*/
|
|
415
|
+
export function setIdleReset(loaded: LoadedLayer, virtualId: string, option: IdleResetConfig | null): void {
|
|
416
|
+
const { node } = findModelNode(loaded, virtualId);
|
|
417
|
+
if (option === null) {
|
|
418
|
+
node.delete("idleReset");
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
node.set("idleReset", option);
|
|
422
|
+
}
|
|
423
|
+
|
|
408
424
|
/** Set the top-level `debug:` flag (per-switch diagnostics notifications). */
|
|
409
425
|
export function setDebug(loaded: LoadedLayer, enabled: boolean): void {
|
|
410
426
|
loaded.doc.set("debug", enabled);
|
package/src/index.ts
CHANGED
|
@@ -53,13 +53,18 @@ export {
|
|
|
53
53
|
disableModel,
|
|
54
54
|
disabledFilePath,
|
|
55
55
|
enableModel,
|
|
56
|
+
getPinnedModel,
|
|
56
57
|
isBlocked,
|
|
57
58
|
isDisabled,
|
|
59
|
+
pinFilePath,
|
|
58
60
|
readBlockedMap,
|
|
59
61
|
readDisabledMap,
|
|
60
|
-
|
|
62
|
+
readPinMap,
|
|
63
|
+
setPinnedModel,
|
|
61
64
|
stateFilePath,
|
|
65
|
+
unblockModel,
|
|
62
66
|
} from "./state.ts";
|
|
67
|
+
export type { PinMap } from "./state.ts";
|
|
63
68
|
export {
|
|
64
69
|
readCrashMap,
|
|
65
70
|
recordCrash,
|
|
@@ -115,6 +120,7 @@ export {
|
|
|
115
120
|
setDecisionModel,
|
|
116
121
|
setDebug,
|
|
117
122
|
setFallbacks,
|
|
123
|
+
setIdleReset,
|
|
118
124
|
setVirtualModelName,
|
|
119
125
|
updateDecisionModel,
|
|
120
126
|
} from "./config-editor.ts";
|