agent-contracts 0.19.3 → 0.19.5
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/cli-contract.yaml +56 -19
- package/dist/cli.js +73 -35
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +36 -11
- package/dist/index.js.map +1 -1
- package/dsl_base/agent-contracts.yaml +18 -0
- package/dsl_base/agent-runtime.config.yaml +2 -0
- package/dsl_base/agents/dsl-auditor.yaml +176 -0
- package/dsl_base/agents/dsl-designer.yaml +433 -0
- package/dsl_base/artifacts.yaml +73 -0
- package/dsl_base/audit-test.config.yaml +2 -0
- package/dsl_base/components.yaml +110 -0
- package/dsl_base/guardrail-policies.yaml +18 -0
- package/dsl_base/guardrails.yaml +46 -0
- package/dsl_base/handoff-types.yaml +182 -0
- package/dsl_base/tasks.yaml +269 -0
- package/dsl_base/tools.yaml +50 -0
- package/dsl_base/validations.yaml +66 -0
- package/dsl_base/workflow.yaml +91 -0
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -1757,7 +1757,7 @@ declare function buildAuditContext(auditType: AuditType, dsl: Dsl, config: Resol
|
|
|
1757
1757
|
|
|
1758
1758
|
declare function formatAuditResult(r: AuditRunResult, format: OutputFormat): string;
|
|
1759
1759
|
declare function formatAuditResults(results: AuditRunResult[], format: OutputFormat): string;
|
|
1760
|
-
declare function computeExitCode(results: AuditRunResult[]): number;
|
|
1760
|
+
declare function computeExitCode(results: AuditRunResult[], failOn?: string): number;
|
|
1761
1761
|
|
|
1762
1762
|
interface ResolvedCheck {
|
|
1763
1763
|
guardrail_id: string;
|
package/dist/index.js
CHANGED
|
@@ -49347,18 +49347,27 @@ async function resolveRefsDeep(data, baseDir, resolving, rootDoc) {
|
|
|
49347
49347
|
}
|
|
49348
49348
|
resolving.add(refValue);
|
|
49349
49349
|
const target = resolveJsonPointer(rootDoc, refValue);
|
|
49350
|
-
const
|
|
49350
|
+
const resolved = await resolveRefsDeep(
|
|
49351
49351
|
deepClone(target),
|
|
49352
49352
|
baseDir,
|
|
49353
49353
|
resolving,
|
|
49354
49354
|
rootDoc
|
|
49355
49355
|
);
|
|
49356
49356
|
resolving.delete(refValue);
|
|
49357
|
-
return
|
|
49357
|
+
return resolved;
|
|
49358
49358
|
}
|
|
49359
|
-
const
|
|
49359
|
+
const hashIdx = refValue.indexOf("#");
|
|
49360
|
+
const filePart = hashIdx >= 0 ? refValue.slice(0, hashIdx) : refValue;
|
|
49361
|
+
const fragment = hashIdx >= 0 ? refValue.slice(hashIdx) : null;
|
|
49362
|
+
const refTarget = resolve(baseDir, filePart);
|
|
49360
49363
|
const s2 = await fsStat(refTarget).catch(() => null);
|
|
49361
49364
|
if (s2?.isDirectory()) {
|
|
49365
|
+
if (fragment) {
|
|
49366
|
+
throw new DslLoadError(
|
|
49367
|
+
`Cannot use JSON Pointer fragment with directory $ref: ${refValue}`,
|
|
49368
|
+
refTarget
|
|
49369
|
+
);
|
|
49370
|
+
}
|
|
49362
49371
|
if (resolving.has(refTarget)) {
|
|
49363
49372
|
throw new DslLoadError(
|
|
49364
49373
|
`Circular $ref detected: ${refTarget}`,
|
|
@@ -49381,14 +49390,24 @@ async function resolveRefsDeep(data, baseDir, resolving, rootDoc) {
|
|
|
49381
49390
|
}
|
|
49382
49391
|
resolving.add(refTarget);
|
|
49383
49392
|
const content = await readYaml(refTarget);
|
|
49384
|
-
const
|
|
49393
|
+
const fileRoot = fragment ? content : rootDoc;
|
|
49394
|
+
let fileData = await resolveRefsDeep(
|
|
49385
49395
|
content,
|
|
49386
49396
|
dirname(refTarget),
|
|
49387
49397
|
resolving,
|
|
49388
|
-
|
|
49398
|
+
fileRoot
|
|
49389
49399
|
);
|
|
49390
49400
|
resolving.delete(refTarget);
|
|
49391
|
-
|
|
49401
|
+
if (fragment && fragment.startsWith("#/")) {
|
|
49402
|
+
if (!isRecord(fileData)) {
|
|
49403
|
+
throw new DslLoadError(
|
|
49404
|
+
`Cannot resolve fragment "${fragment}" in ${refTarget}: file content is not an object`,
|
|
49405
|
+
refTarget
|
|
49406
|
+
);
|
|
49407
|
+
}
|
|
49408
|
+
fileData = resolveJsonPointer(fileData, fragment);
|
|
49409
|
+
}
|
|
49410
|
+
return fileData;
|
|
49392
49411
|
}
|
|
49393
49412
|
let obj = data;
|
|
49394
49413
|
if (hasRefs(obj)) {
|
|
@@ -55080,16 +55099,22 @@ function formatAuditResults(results, format2) {
|
|
|
55080
55099
|
}
|
|
55081
55100
|
return results.map((r3) => formatAuditResult(r3, format2)).join("\n\n");
|
|
55082
55101
|
}
|
|
55083
|
-
function computeExitCode(results) {
|
|
55102
|
+
function computeExitCode(results, failOn) {
|
|
55084
55103
|
for (const r3 of results) {
|
|
55085
55104
|
if (r3.status === "error") {
|
|
55086
|
-
if (r3.errorMessage?.includes("not installed")
|
|
55087
|
-
return
|
|
55105
|
+
if (r3.errorMessage?.includes("not installed")) return 11;
|
|
55106
|
+
if (r3.errorMessage?.includes("adapter") || r3.errorMessage?.includes("API")) return 12;
|
|
55107
|
+
return 1;
|
|
55088
55108
|
}
|
|
55089
55109
|
}
|
|
55110
|
+
const severityRank = { info: 0, warning: 1, error: 2, critical: 3 };
|
|
55111
|
+
const threshold = severityRank[failOn ?? "critical"] ?? 3;
|
|
55090
55112
|
for (const r3 of results) {
|
|
55091
|
-
if (r3.data?.critical_gaps
|
|
55092
|
-
|
|
55113
|
+
if (r3.data?.critical_gaps) {
|
|
55114
|
+
for (const gap of r3.data.critical_gaps) {
|
|
55115
|
+
const rank = severityRank[gap.severity ?? ""] ?? 0;
|
|
55116
|
+
if (rank >= threshold) return 10;
|
|
55117
|
+
}
|
|
55093
55118
|
}
|
|
55094
55119
|
}
|
|
55095
55120
|
return 0;
|