@goodandready/dsh-agent-loop-guard 0.2.17 → 0.2.18
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/CHANGELOG.md +11 -0
- package/lib/index.js +20 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.2.18] - 2026-09-30
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Cordis Volatile Unwrapping (#93)**: Unwrapped Volatile settings references recursively via `plainConfig()` and `resolveConfig()` before and after Schemastery `Config(...)` validation, preventing `ValidationError: $.maxToolAttemptsPerTurn expected number but got [object Object]` during plugin activation under DSH 0.2.0-rc.2.
|
|
7
|
+
- **Strict Validation Integrity**: Preserved strict error throwing on invalid user types (e.g. non-numeric volatile values or arbitrary non-volatile objects) without silent coercion.
|
|
8
|
+
|
|
9
|
+
## [0.2.17] - 2026-09-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- **Settings Form ID Binding (#92)**: Keyed form presentation under the entry ID for DSH 0.1.7-rc.2 and 0.2.0 hosts.
|
|
13
|
+
|
|
3
14
|
## 0.2.16
|
|
4
15
|
|
|
5
16
|
### Fixed
|
package/lib/index.js
CHANGED
|
@@ -11,13 +11,25 @@ import { registerPluginUpdater, isTrustedTelemetryRequest } from './plugin-updat
|
|
|
11
11
|
export const name = '@goodandready/dsh-agent-loop-guard';
|
|
12
12
|
export const inject = ['tools', 'agents', 'sessions'];
|
|
13
13
|
|
|
14
|
+
export function isVolatileRef(value) {
|
|
15
|
+
return value !== null && typeof value === 'object' && !Array.isArray(value) && typeof value.get === 'function';
|
|
16
|
+
}
|
|
17
|
+
|
|
14
18
|
// Unwrap Volatile boxes before any caller reads a value. A volatile field holds a box
|
|
15
19
|
// rather than its value, and the Loader mutates those boxes in place.
|
|
16
20
|
export function plainConfig(value) {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
while (typeof value === 'function') {
|
|
22
|
+
value = value();
|
|
23
|
+
}
|
|
24
|
+
if (isVolatileRef(value)) return plainConfig(value.get());
|
|
25
|
+
if (value === null || typeof value !== 'object') return value;
|
|
26
|
+
if (Array.isArray(value)) return value.map(plainConfig);
|
|
27
|
+
return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, plainConfig(v)]));
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export function resolveConfig(raw) {
|
|
31
|
+
const unwrapped = plainConfig(raw);
|
|
32
|
+
return plainConfig(Config(unwrapped));
|
|
21
33
|
}
|
|
22
34
|
|
|
23
35
|
export const Config = Schema.object({
|
|
@@ -106,7 +118,7 @@ function logGuardViolation(ctx, event) {
|
|
|
106
118
|
|
|
107
119
|
export function apply(ctx, config = {}) {
|
|
108
120
|
const NS = name;
|
|
109
|
-
let getConfig = () =>
|
|
121
|
+
let getConfig = () => resolveConfig(ctx.fiber?.config ?? config) ?? {};
|
|
110
122
|
|
|
111
123
|
const syncFrom = (raw) => {
|
|
112
124
|
const maxCallsPerRepeatGroup = positiveInteger(raw.maxCallsPerRepeatGroup ?? raw.maxCallsPerToolPerTurn, 5);
|
|
@@ -169,12 +181,12 @@ export function apply(ctx, config = {}) {
|
|
|
169
181
|
if (typeof sctx.settings.describe === 'function') {
|
|
170
182
|
const desc = sctx.settings.describe().find((row) => row.ns === NS);
|
|
171
183
|
if (desc && desc.value && typeof desc.value === 'object') {
|
|
172
|
-
return
|
|
184
|
+
return resolveConfig(desc.value);
|
|
173
185
|
}
|
|
174
186
|
} else if (typeof sctx.settings.get === 'function') {
|
|
175
187
|
const val = sctx.settings.get(NS);
|
|
176
188
|
if (val && typeof val === 'object') {
|
|
177
|
-
return
|
|
189
|
+
return resolveConfig(val);
|
|
178
190
|
}
|
|
179
191
|
}
|
|
180
192
|
} catch (error) {
|
|
@@ -183,7 +195,7 @@ export function apply(ctx, config = {}) {
|
|
|
183
195
|
return null;
|
|
184
196
|
};
|
|
185
197
|
|
|
186
|
-
getConfig = () => readLiveSettings() ??
|
|
198
|
+
getConfig = () => readLiveSettings() ?? resolveConfig(ctx.fiber?.config ?? config) ?? {};
|
|
187
199
|
applyLiveConfig();
|
|
188
200
|
|
|
189
201
|
const disposeDocUpdated = typeof sctx.on === 'function'
|