@goodandready/dsh-approval-gate 0.1.17 → 0.1.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 +8 -0
- package/lib/contract-guard.js +147 -0
- package/lib/dispatcher.js +209 -207
- package/lib/engine.js +48 -0
- package/lib/index.js +21 -1
- package/lib/inspect.js +573 -520
- package/lib/messages.js +39 -0
- package/lib/overengineering.js +97 -0
- package/lib/paths.js +378 -320
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -230,6 +230,14 @@ export const Config = Schema.object({
|
|
|
230
230
|
classifierTimeoutPolicy: Schema.union(["strict", "permissive"]).default("strict").volatile(),
|
|
231
231
|
/** Maximum context characters for classifier prompt (#117). */
|
|
232
232
|
classifierMaxContext: Schema.number().default(1000).volatile(),
|
|
233
|
+
/** Maximum payload bytes for tool arguments (#71). */
|
|
234
|
+
maxPayloadBytes: Schema.number().default(65536).volatile(),
|
|
235
|
+
/** Isolate temporary directories to workspace/.dsh/tmp (#102). */
|
|
236
|
+
isolateTempRoots: Schema.boolean().default(true).volatile(),
|
|
237
|
+
/** Maximum allowed created files per session to prevent overengineering (#89). */
|
|
238
|
+
maxFilesPerSession: Schema.number().default(10).volatile(),
|
|
239
|
+
/** Task contract boundary rules (#87). */
|
|
240
|
+
taskContract: Schema.any().volatile(),
|
|
233
241
|
/** Security engine instance (internal/testing). */
|
|
234
242
|
engine: Schema.any().hidden(),
|
|
235
243
|
});
|
|
@@ -281,7 +289,15 @@ export function apply(ctx, config) {
|
|
|
281
289
|
: null;
|
|
282
290
|
|
|
283
291
|
const engine = (config && config.engine) || cfg.engine || new SecurityEngine({
|
|
284
|
-
inspectConfig: {
|
|
292
|
+
inspectConfig: {
|
|
293
|
+
toolName: toolName,
|
|
294
|
+
fileWriteTools: fileWriteTools,
|
|
295
|
+
workspaceDir: cfg.workspaceDir || "",
|
|
296
|
+
maxPayloadBytes: cfg.maxPayloadBytes !== undefined ? cfg.maxPayloadBytes : 65536,
|
|
297
|
+
isolateTempRoots: cfg.isolateTempRoots !== false,
|
|
298
|
+
},
|
|
299
|
+
taskContract: cfg.taskContract || undefined,
|
|
300
|
+
maxFilesPerSession: cfg.maxFilesPerSession !== undefined ? cfg.maxFilesPerSession : 10,
|
|
285
301
|
bands: new BandsEngine({ toolRegistry: ctx && ctx.tools }),
|
|
286
302
|
classifier,
|
|
287
303
|
timeoutPolicy: cfg.classifierTimeoutPolicy || "strict",
|
|
@@ -555,3 +571,7 @@ export {
|
|
|
555
571
|
isLowRiskExecution,
|
|
556
572
|
LlmClassifier,
|
|
557
573
|
} from "./classifier.js";
|
|
574
|
+
export { ContractGuard } from "./contract-guard.js";
|
|
575
|
+
export { OverengineeringGuard, DEFAULT_MAX_FILES_PER_SESSION } from "./overengineering.js";
|
|
576
|
+
export { resolveTempRoot, isGlobalTempPath, checkTempIsolation } from "./paths.js";
|
|
577
|
+
export { computePayloadSize, scanPromptInjection } from "./inspect.js";
|