@goodandready/dsh-agent-loop-guard 0.2.16 → 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 +38 -17
- package/package.json +5 -2
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,20 +11,41 @@ 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
|
+
|
|
18
|
+
// Unwrap Volatile boxes before any caller reads a value. A volatile field holds a box
|
|
19
|
+
// rather than its value, and the Loader mutates those boxes in place.
|
|
20
|
+
export function plainConfig(value) {
|
|
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));
|
|
33
|
+
}
|
|
34
|
+
|
|
14
35
|
export const Config = Schema.object({
|
|
15
|
-
maxToolAttemptsPerTurn: Schema.number().min(0).default(64),
|
|
16
|
-
maxProgressToolCallsPerTurn: Schema.number().min(1).default(16),
|
|
17
|
-
progressToolNames: Schema.array(Schema.string()).default(['todo_write']),
|
|
18
|
-
maxCallsPerRepeatGroup: Schema.number().min(1).default(5),
|
|
19
|
-
maxCallsPerToolPerTurn: Schema.number().min(1).default(5).description('Deprecated: legacy alias for maxCallsPerRepeatGroup'),
|
|
20
|
-
strictTools: Schema.array(Schema.string()).default([]),
|
|
21
|
-
strictToolLimit: Schema.number().min(1).default(3),
|
|
22
|
-
blockExactDuplicates: Schema.boolean().default(true),
|
|
23
|
-
dryRunMode: Schema.boolean().default(false),
|
|
24
|
-
assistantOutputGuard: Schema.boolean().default(true),
|
|
25
|
-
maxRepeatedAssistantLines: Schema.number().min(1).default(5),
|
|
26
|
-
maxRepeatedAssistantBlocks: Schema.number().min(1).default(5),
|
|
27
|
-
maxAssistantBlockChars: Schema.number().min(256).default(16_384),
|
|
36
|
+
maxToolAttemptsPerTurn: Schema.number().volatile().min(0).default(64),
|
|
37
|
+
maxProgressToolCallsPerTurn: Schema.number().volatile().min(1).default(16),
|
|
38
|
+
progressToolNames: Schema.array(Schema.string()).volatile().default(['todo_write']),
|
|
39
|
+
maxCallsPerRepeatGroup: Schema.number().volatile().min(1).default(5),
|
|
40
|
+
maxCallsPerToolPerTurn: Schema.number().volatile().min(1).default(5).description('Deprecated: legacy alias for maxCallsPerRepeatGroup'),
|
|
41
|
+
strictTools: Schema.array(Schema.string()).volatile().default([]),
|
|
42
|
+
strictToolLimit: Schema.number().volatile().min(1).default(3),
|
|
43
|
+
blockExactDuplicates: Schema.boolean().volatile().default(true),
|
|
44
|
+
dryRunMode: Schema.boolean().volatile().default(false),
|
|
45
|
+
assistantOutputGuard: Schema.boolean().volatile().default(true),
|
|
46
|
+
maxRepeatedAssistantLines: Schema.number().volatile().min(1).default(5),
|
|
47
|
+
maxRepeatedAssistantBlocks: Schema.number().volatile().min(1).default(5),
|
|
48
|
+
maxAssistantBlockChars: Schema.number().volatile().min(256).default(16_384),
|
|
28
49
|
});
|
|
29
50
|
|
|
30
51
|
function callIdFromEvent(event) {
|
|
@@ -97,7 +118,7 @@ function logGuardViolation(ctx, event) {
|
|
|
97
118
|
|
|
98
119
|
export function apply(ctx, config = {}) {
|
|
99
120
|
const NS = name;
|
|
100
|
-
let getConfig = () =>
|
|
121
|
+
let getConfig = () => resolveConfig(ctx.fiber?.config ?? config) ?? {};
|
|
101
122
|
|
|
102
123
|
const syncFrom = (raw) => {
|
|
103
124
|
const maxCallsPerRepeatGroup = positiveInteger(raw.maxCallsPerRepeatGroup ?? raw.maxCallsPerToolPerTurn, 5);
|
|
@@ -160,12 +181,12 @@ export function apply(ctx, config = {}) {
|
|
|
160
181
|
if (typeof sctx.settings.describe === 'function') {
|
|
161
182
|
const desc = sctx.settings.describe().find((row) => row.ns === NS);
|
|
162
183
|
if (desc && desc.value && typeof desc.value === 'object') {
|
|
163
|
-
return
|
|
184
|
+
return resolveConfig(desc.value);
|
|
164
185
|
}
|
|
165
186
|
} else if (typeof sctx.settings.get === 'function') {
|
|
166
187
|
const val = sctx.settings.get(NS);
|
|
167
188
|
if (val && typeof val === 'object') {
|
|
168
|
-
return
|
|
189
|
+
return resolveConfig(val);
|
|
169
190
|
}
|
|
170
191
|
}
|
|
171
192
|
} catch (error) {
|
|
@@ -174,7 +195,7 @@ export function apply(ctx, config = {}) {
|
|
|
174
195
|
return null;
|
|
175
196
|
};
|
|
176
197
|
|
|
177
|
-
getConfig = () => readLiveSettings() ??
|
|
198
|
+
getConfig = () => readLiveSettings() ?? resolveConfig(ctx.fiber?.config ?? config) ?? {};
|
|
178
199
|
applyLiveConfig();
|
|
179
200
|
|
|
180
201
|
const disposeDocUpdated = typeof sctx.on === 'function'
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@goodandready/dsh-agent-loop-guard",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.18",
|
|
4
4
|
"description": "Fail-closed runtime tool-call loop guard for DeepSeek Harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"license": "MIT",
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
45
|
-
"@deepseek-ai/schemastery": "^3.18.
|
|
45
|
+
"@deepseek-ai/schemastery": "^3.18.4",
|
|
46
46
|
"@deepseek-ai/dsh-settings": "^0.1.7-rc.2 || ^0.2.0-rc.1"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
@@ -52,5 +52,8 @@
|
|
|
52
52
|
"homepage": "https://github.com/GooDAnDReaDY/dsh-agent-loop-guard",
|
|
53
53
|
"bugs": {
|
|
54
54
|
"url": "https://github.com/GooDAnDReaDY/dsh-agent-loop-guard/issues"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@deepseek-ai/schemastery": "^3.18.4"
|
|
55
58
|
}
|
|
56
59
|
}
|