@goodandready/dsh-agent-loop-guard 0.2.14 → 0.2.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/CHANGELOG.md +14 -0
- package/lib/index.js +64 -10
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,10 +1,24 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.16
|
|
4
|
+
|
|
5
|
+
### Fixed
|
|
6
|
+
- **Peer gate on DSH 0.2.0-rc.1** (#58): DSH skips a profile bundle whose `peerDependencies` exclude the running version, so this plugin was absent from the profile with no error in the UI. Every `@deepseek-ai/dsh-*` peer now names both the 0.1.7-rc.2 and 0.2.0-rc.1 lines, because semver does not admit a prerelease of the next minor into a range that does not name it.
|
|
7
|
+
|
|
3
8
|
All notable changes to this project will be documented in this file.
|
|
4
9
|
|
|
5
10
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
11
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
12
|
|
|
13
|
+
## [0.2.15] - 2026-09-25
|
|
14
|
+
|
|
15
|
+
### Fixed
|
|
16
|
+
- **SettingsForms API Migration**: Replaced legacy, removed `sctx.settings.register()` call with modern DSH 0.1.7-rc.1 `SettingsForms` lifecycle integration (#85).
|
|
17
|
+
- **Presentation Policy**: Configured `sctx.settings.configure({ auto: false }, ctx.fiber)` to register page policy with proper disposer in `sctx.effect`.
|
|
18
|
+
- **Live Settings Resolution**: Resolved live configuration via `sctx.settings.describe()` and subscribed to `settings/document-updated` event.
|
|
19
|
+
- **Config Reload Contract**: Supported `app-boot/config-reload` and `internal/update` events for runtime guard limit re-synchronization.
|
|
20
|
+
- **Optional Dependency**: Removed `settings` from top-level required `inject` array, enabling the plugin to run cleanly in headless or minimal environments.
|
|
21
|
+
|
|
8
22
|
## [0.2.14] - 2026-09-24
|
|
9
23
|
|
|
10
24
|
### Added
|
package/lib/index.js
CHANGED
|
@@ -9,7 +9,7 @@ import { AssistantOutputGuardState, assistantTextFromMessage } from './assistant
|
|
|
9
9
|
import { registerPluginUpdater, isTrustedTelemetryRequest } from './plugin-updater.js';
|
|
10
10
|
|
|
11
11
|
export const name = '@goodandready/dsh-agent-loop-guard';
|
|
12
|
-
export const inject = ['tools', 'agents', 'sessions'
|
|
12
|
+
export const inject = ['tools', 'agents', 'sessions'];
|
|
13
13
|
|
|
14
14
|
export const Config = Schema.object({
|
|
15
15
|
maxToolAttemptsPerTurn: Schema.number().min(0).default(64),
|
|
@@ -97,7 +97,7 @@ function logGuardViolation(ctx, event) {
|
|
|
97
97
|
|
|
98
98
|
export function apply(ctx, config = {}) {
|
|
99
99
|
const NS = name;
|
|
100
|
-
let getConfig = () => Config(config) ?? {};
|
|
100
|
+
let getConfig = () => Config(ctx.fiber?.config ?? config) ?? {};
|
|
101
101
|
|
|
102
102
|
const syncFrom = (raw) => {
|
|
103
103
|
const maxCallsPerRepeatGroup = positiveInteger(raw.maxCallsPerRepeatGroup ?? raw.maxCallsPerToolPerTurn, 5);
|
|
@@ -138,18 +138,72 @@ export function apply(ctx, config = {}) {
|
|
|
138
138
|
if (typeof assistantState.updateConfig === 'function') assistantState.updateConfig(raw);
|
|
139
139
|
};
|
|
140
140
|
|
|
141
|
+
if (typeof ctx.on === 'function') {
|
|
142
|
+
ctx.on('app-boot/config-reload', () => applyLiveConfig());
|
|
143
|
+
ctx.on('internal/update', () => applyLiveConfig());
|
|
144
|
+
}
|
|
145
|
+
|
|
141
146
|
ctx.inject(['settings'], (sctx) => {
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
147
|
+
if (!sctx?.settings) return;
|
|
148
|
+
|
|
149
|
+
let disposeConfigure;
|
|
145
150
|
try {
|
|
146
|
-
if (typeof
|
|
147
|
-
sctx.
|
|
148
|
-
} else if (typeof scope.subscribe === 'function') {
|
|
149
|
-
sctx.effect(() => scope.subscribe(() => applyLiveConfig()));
|
|
151
|
+
if (typeof sctx.settings.configure === 'function') {
|
|
152
|
+
disposeConfigure = sctx.settings.configure({ auto: false }, ctx.fiber);
|
|
150
153
|
}
|
|
151
154
|
} catch (error) {
|
|
152
|
-
ctx.logger?.warn?.('dsh-agent-loop-guard: settings
|
|
155
|
+
ctx.logger?.warn?.('dsh-agent-loop-guard: settings configure failed: ' + (error instanceof Error ? error.message : String(error)));
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const readLiveSettings = () => {
|
|
159
|
+
try {
|
|
160
|
+
if (typeof sctx.settings.describe === 'function') {
|
|
161
|
+
const desc = sctx.settings.describe().find((row) => row.ns === NS);
|
|
162
|
+
if (desc && desc.value && typeof desc.value === 'object') {
|
|
163
|
+
return Config(desc.value);
|
|
164
|
+
}
|
|
165
|
+
} else if (typeof sctx.settings.get === 'function') {
|
|
166
|
+
const val = sctx.settings.get(NS);
|
|
167
|
+
if (val && typeof val === 'object') {
|
|
168
|
+
return Config(val);
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
} catch (error) {
|
|
172
|
+
ctx.logger?.warn?.('dsh-agent-loop-guard: settings describe failed: ' + (error instanceof Error ? error.message : String(error)));
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
getConfig = () => readLiveSettings() ?? Config(ctx.fiber?.config ?? config) ?? {};
|
|
178
|
+
applyLiveConfig();
|
|
179
|
+
|
|
180
|
+
const disposeDocUpdated = typeof sctx.on === 'function'
|
|
181
|
+
? sctx.on('settings/document-updated', (updatedNs) => {
|
|
182
|
+
if (updatedNs === NS) {
|
|
183
|
+
applyLiveConfig();
|
|
184
|
+
}
|
|
185
|
+
})
|
|
186
|
+
: null;
|
|
187
|
+
|
|
188
|
+
const cleanup = () => {
|
|
189
|
+
if (typeof disposeConfigure === 'function') {
|
|
190
|
+
try {
|
|
191
|
+
disposeConfigure();
|
|
192
|
+
} catch (error) {
|
|
193
|
+
ctx.logger?.debug?.('dsh-agent-loop-guard: disposeConfigure error: ' + (error instanceof Error ? error.message : String(error)));
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
if (typeof disposeDocUpdated === 'function') {
|
|
197
|
+
try {
|
|
198
|
+
disposeDocUpdated();
|
|
199
|
+
} catch (error) {
|
|
200
|
+
ctx.logger?.debug?.('dsh-agent-loop-guard: disposeDocUpdated error: ' + (error instanceof Error ? error.message : String(error)));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
};
|
|
204
|
+
|
|
205
|
+
if (typeof sctx.effect === 'function') {
|
|
206
|
+
sctx.effect(() => cleanup, 'dsh-agent-loop-guard: settings');
|
|
153
207
|
}
|
|
154
208
|
});
|
|
155
209
|
|
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.16",
|
|
4
4
|
"description": "Fail-closed runtime tool-call loop guard for DeepSeek Harness.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"@deepseek-ai/cordis": "^4.0.1",
|
|
45
45
|
"@deepseek-ai/schemastery": "^3.18.1",
|
|
46
|
-
"@deepseek-ai/dsh-settings": "^0.1.0-rc.
|
|
46
|
+
"@deepseek-ai/dsh-settings": "^0.1.7-rc.2 || ^0.2.0-rc.1"
|
|
47
47
|
},
|
|
48
48
|
"repository": {
|
|
49
49
|
"type": "git",
|