witnora 0.8.1 → 0.9.0

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.
Files changed (87) hide show
  1. package/README.md +275 -12
  2. package/dist/artifact-manifest.js +37 -0
  3. package/dist/artifact-validation.js +102 -0
  4. package/dist/badge.js +31 -0
  5. package/dist/browser-adapter.js +156 -0
  6. package/dist/bundle.js +100 -0
  7. package/dist/cli.js +971 -0
  8. package/dist/command-help.js +71 -0
  9. package/dist/companion-artifacts.js +170 -0
  10. package/dist/conformance.js +115 -0
  11. package/dist/control-plane.js +409 -0
  12. package/dist/corpus-governance.js +126 -0
  13. package/dist/corpus-store.js +239 -0
  14. package/dist/corpus.js +438 -0
  15. package/dist/credentials.js +127 -0
  16. package/dist/evidence-signing.js +85 -0
  17. package/dist/failure-review.js +188 -0
  18. package/dist/guided-setup.js +101 -0
  19. package/dist/index.js +16 -0
  20. package/dist/lab.js +323 -0
  21. package/dist/local-server.js +491 -0
  22. package/dist/monitor.js +100 -0
  23. package/dist/normalizers.js +265 -0
  24. package/dist/onboarding-templates.js +158 -0
  25. package/dist/release-gate.js +457 -0
  26. package/dist/report.js +165 -0
  27. package/dist/runner.js +349 -0
  28. package/dist/sandbox.js +424 -0
  29. package/dist/schema-validator.js +503 -0
  30. package/dist/try.js +135 -0
  31. package/dist/types.js +3 -0
  32. package/dist/vendor/onegent-runtime/browser-adapter-kit.d.ts +107 -0
  33. package/dist/vendor/onegent-runtime/browser-adapter-kit.d.ts.map +1 -0
  34. package/dist/vendor/onegent-runtime/browser-adapter-kit.js +187 -0
  35. package/dist/vendor/onegent-runtime/browser-enforcement-runtime.d.ts +183 -0
  36. package/dist/vendor/onegent-runtime/browser-enforcement-runtime.d.ts.map +1 -0
  37. package/dist/vendor/onegent-runtime/browser-enforcement-runtime.js +344 -0
  38. package/dist/vendor/onegent-runtime/controlled-adapter.d.ts +6 -0
  39. package/dist/vendor/onegent-runtime/controlled-adapter.d.ts.map +1 -0
  40. package/dist/vendor/onegent-runtime/controlled-adapter.js +40 -0
  41. package/dist/vendor/onegent-runtime/mock-procurement.d.ts +6 -0
  42. package/dist/vendor/onegent-runtime/mock-procurement.d.ts.map +1 -0
  43. package/dist/vendor/onegent-runtime/mock-procurement.js +33 -0
  44. package/dist/vendor/onegent-runtime/policies.d.ts +6 -0
  45. package/dist/vendor/onegent-runtime/policies.d.ts.map +1 -0
  46. package/dist/vendor/onegent-runtime/policies.js +109 -0
  47. package/dist/vendor/onegent-runtime/risk.d.ts +3 -0
  48. package/dist/vendor/onegent-runtime/risk.d.ts.map +1 -0
  49. package/dist/vendor/onegent-runtime/risk.js +54 -0
  50. package/dist/vendor/onegent-runtime/sandbox-adapter-kit.d.ts +45 -0
  51. package/dist/vendor/onegent-runtime/sandbox-adapter-kit.d.ts.map +1 -0
  52. package/dist/vendor/onegent-runtime/sandbox-adapter-kit.js +148 -0
  53. package/dist/vendor/onegent-runtime/sandbox-harness.d.ts +167 -0
  54. package/dist/vendor/onegent-runtime/sandbox-harness.d.ts.map +1 -0
  55. package/dist/vendor/onegent-runtime/sandbox-harness.js +729 -0
  56. package/dist/vendor/onegent-runtime/sandbox-hosted.d.ts +77 -0
  57. package/dist/vendor/onegent-runtime/sandbox-hosted.d.ts.map +1 -0
  58. package/dist/vendor/onegent-runtime/sandbox-hosted.js +152 -0
  59. package/dist/vendor/onegent-runtime/sdk.d.ts +29 -0
  60. package/dist/vendor/onegent-runtime/sdk.d.ts.map +1 -0
  61. package/dist/vendor/onegent-runtime/sdk.js +140 -0
  62. package/dist/vendor/onegent-runtime/service.d.ts +27 -0
  63. package/dist/vendor/onegent-runtime/service.d.ts.map +1 -0
  64. package/dist/vendor/onegent-runtime/service.js +423 -0
  65. package/dist/vendor/onegent-runtime/store.d.ts +16 -0
  66. package/dist/vendor/onegent-runtime/store.d.ts.map +1 -0
  67. package/dist/vendor/onegent-runtime/store.js +29 -0
  68. package/dist/vendor/onegent-runtime/stripe-test-readonly.d.ts +79 -0
  69. package/dist/vendor/onegent-runtime/stripe-test-readonly.d.ts.map +1 -0
  70. package/dist/vendor/onegent-runtime/stripe-test-readonly.js +163 -0
  71. package/dist/vendor/onegent-runtime/trust-crypto.d.ts +11 -0
  72. package/dist/vendor/onegent-runtime/trust-crypto.d.ts.map +1 -0
  73. package/dist/vendor/onegent-runtime/trust-crypto.js +70 -0
  74. package/dist/vendor/onegent-runtime/trust-types.d.ts +163 -0
  75. package/dist/vendor/onegent-runtime/trust-types.d.ts.map +1 -0
  76. package/dist/vendor/onegent-runtime/trust-types.js +7 -0
  77. package/dist/vendor/onegent-runtime/trusted-recorder.d.ts +49 -0
  78. package/dist/vendor/onegent-runtime/trusted-recorder.d.ts.map +1 -0
  79. package/dist/vendor/onegent-runtime/trusted-recorder.js +347 -0
  80. package/dist/vendor/onegent-runtime/types.d.ts +287 -0
  81. package/dist/vendor/onegent-runtime/types.d.ts.map +1 -0
  82. package/dist/vendor/onegent-runtime/types.js +1 -0
  83. package/dist/vendor/onegent-runtime/vendor-sandbox-egress.d.ts +49 -0
  84. package/dist/vendor/onegent-runtime/vendor-sandbox-egress.d.ts.map +1 -0
  85. package/dist/vendor/onegent-runtime/vendor-sandbox-egress.js +152 -0
  86. package/package.json +33 -13
  87. package/bin/witnora.js +0 -3
@@ -0,0 +1,49 @@
1
+ export type VendorSandboxHttpMethod = "GET";
2
+ export interface VendorSandboxResourceRule {
3
+ id: string;
4
+ method: VendorSandboxHttpMethod;
5
+ pathPattern: RegExp;
6
+ }
7
+ export interface VendorSandboxEgressPolicy {
8
+ vendor: string;
9
+ allowedOrigin: string;
10
+ resources: readonly VendorSandboxResourceRule[];
11
+ timeoutMs: number;
12
+ maxRequestsPerMinute: number;
13
+ }
14
+ export type VendorSandboxAuditOutcome = "allowed" | "denied" | "rate_limited" | "timeout" | "http_error" | "failed";
15
+ export interface VendorSandboxRequestAudit {
16
+ requestId: string;
17
+ timestamp: string;
18
+ vendor: string;
19
+ resource: string;
20
+ method: VendorSandboxHttpMethod;
21
+ origin: string;
22
+ outcome: VendorSandboxAuditOutcome;
23
+ durationMs: number;
24
+ status?: number;
25
+ errorCode?: VendorSandboxEgressErrorCode;
26
+ }
27
+ export type VendorSandboxEgressErrorCode = "ORIGIN_DENIED" | "METHOD_DENIED" | "RESOURCE_DENIED" | "RATE_LIMITED" | "TIMEOUT" | "HTTP_ERROR" | "REQUEST_FAILED";
28
+ export declare class VendorSandboxEgressError extends Error {
29
+ readonly code: VendorSandboxEgressErrorCode;
30
+ readonly status?: number | undefined;
31
+ constructor(code: VendorSandboxEgressErrorCode, message: string, status?: number | undefined);
32
+ }
33
+ export interface VendorSandboxEgressRequest {
34
+ resource: string;
35
+ method: VendorSandboxHttpMethod;
36
+ path: string;
37
+ headers?: HeadersInit;
38
+ }
39
+ export interface BoundedVendorSandboxEgress {
40
+ requestJson(request: VendorSandboxEgressRequest): Promise<unknown>;
41
+ getAuditLog(): VendorSandboxRequestAudit[];
42
+ }
43
+ export interface BoundedVendorSandboxEgressOptions {
44
+ policy: VendorSandboxEgressPolicy;
45
+ fetch?: typeof fetch;
46
+ now?: () => number;
47
+ }
48
+ export declare function createBoundedVendorSandboxEgress(options: BoundedVendorSandboxEgressOptions): BoundedVendorSandboxEgress;
49
+ //# sourceMappingURL=vendor-sandbox-egress.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"vendor-sandbox-egress.d.ts","sourceRoot":"","sources":["../../../../onegent-runtime/src/vendor-sandbox-egress.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,yBAAyB;IACxC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,uBAAuB,CAAC;IAChC,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,yBAAyB;IACxC,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,EAAE,MAAM,CAAC;IACtB,SAAS,EAAE,SAAS,yBAAyB,EAAE,CAAC;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ACrB,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAID,wBAAgB,gCAAgC,CAC9C,OAAO,EAAE,iCAAiC,GACzC,0BAA0B,CA+G5B"}
@@ -0,0 +1,152 @@
1
+ export class VendorSandboxEgressError extends Error {
2
+ code;
3
+ status;
4
+ constructor(code, message, status) {
5
+ super(message);
6
+ this.code = code;
7
+ this.status = status;
8
+ this.name = "VendorSandboxEgressError";
9
+ }
10
+ }
11
+ const MAX_AUDIT_ENTRIES = 100;
12
+ export function createBoundedVendorSandboxEgress(options) {
13
+ const policy = validatePolicy(options.policy);
14
+ const requestFetch = options.fetch ?? fetch;
15
+ const now = options.now ?? Date.now;
16
+ const audit = [];
17
+ let requestSequence = 0;
18
+ let windowStartedAt = now();
19
+ let requestsInWindow = 0;
20
+ const record = (entry) => {
21
+ audit.push(Object.freeze({ ...entry }));
22
+ if (audit.length > MAX_AUDIT_ENTRIES)
23
+ audit.splice(0, audit.length - MAX_AUDIT_ENTRIES);
24
+ };
25
+ return Object.freeze({
26
+ requestJson: async (request) => {
27
+ const startedAt = now();
28
+ const requestId = `${policy.vendor}-${++requestSequence}`;
29
+ const method = request.method;
30
+ const url = safeUrl(request.path, policy.allowedOrigin);
31
+ const baseAudit = {
32
+ requestId,
33
+ timestamp: new Date(startedAt).toISOString(),
34
+ vendor: policy.vendor,
35
+ resource: request.resource,
36
+ method,
37
+ origin: url?.origin ?? policy.allowedOrigin,
38
+ };
39
+ const deny = (error) => {
40
+ record({ ...baseAudit, outcome: "denied", durationMs: elapsed(now, startedAt), errorCode: error.code });
41
+ throw error;
42
+ };
43
+ if (!url || url.origin !== policy.allowedOrigin || url.protocol !== "https:" || url.username || url.password || url.hash) {
44
+ return deny(new VendorSandboxEgressError("ORIGIN_DENIED", "Vendor sandbox request origin is not allowlisted."));
45
+ }
46
+ const resource = policy.resources.find((entry) => entry.id === request.resource);
47
+ if (!resource) {
48
+ return deny(new VendorSandboxEgressError("RESOURCE_DENIED", "Vendor sandbox resource is not allowlisted."));
49
+ }
50
+ if (method !== resource.method) {
51
+ return deny(new VendorSandboxEgressError("METHOD_DENIED", "Vendor sandbox HTTP method is not allowlisted for this resource."));
52
+ }
53
+ resource.pathPattern.lastIndex = 0;
54
+ if (!resource.pathPattern.test(`${url.pathname}${url.search}`)) {
55
+ return deny(new VendorSandboxEgressError("RESOURCE_DENIED", "Vendor sandbox path is not allowlisted for this resource."));
56
+ }
57
+ const current = now();
58
+ if (current - windowStartedAt >= 60_000) {
59
+ windowStartedAt = current;
60
+ requestsInWindow = 0;
61
+ }
62
+ if (requestsInWindow >= policy.maxRequestsPerMinute) {
63
+ const error = new VendorSandboxEgressError("RATE_LIMITED", "Vendor sandbox request limit exceeded. Retry after the current one-minute window.");
64
+ record({ ...baseAudit, outcome: "rate_limited", durationMs: elapsed(now, startedAt), errorCode: error.code });
65
+ throw error;
66
+ }
67
+ requestsInWindow += 1;
68
+ const controller = new AbortController();
69
+ let timedOut = false;
70
+ let timeout;
71
+ const operation = (async () => {
72
+ const response = await requestFetch(url, {
73
+ method,
74
+ headers: request.headers,
75
+ redirect: "error",
76
+ signal: controller.signal,
77
+ });
78
+ if (!response.ok) {
79
+ throw new VendorSandboxEgressError("HTTP_ERROR", `Vendor sandbox returned HTTP ${response.status}.`, response.status);
80
+ }
81
+ return { payload: await response.json(), status: response.status };
82
+ })();
83
+ const timeoutOperation = new Promise((_, reject) => {
84
+ timeout = setTimeout(() => {
85
+ timedOut = true;
86
+ controller.abort();
87
+ reject(new VendorSandboxEgressError("TIMEOUT", `Vendor sandbox request exceeded ${policy.timeoutMs} ms.`));
88
+ }, policy.timeoutMs);
89
+ });
90
+ try {
91
+ const result = await Promise.race([operation, timeoutOperation]);
92
+ record({ ...baseAudit, outcome: "allowed", durationMs: elapsed(now, startedAt), status: result.status });
93
+ return result.payload;
94
+ }
95
+ catch (cause) {
96
+ const error = cause instanceof VendorSandboxEgressError
97
+ ? cause
98
+ : timedOut
99
+ ? new VendorSandboxEgressError("TIMEOUT", `Vendor sandbox request exceeded ${policy.timeoutMs} ms.`)
100
+ : new VendorSandboxEgressError("REQUEST_FAILED", "Vendor sandbox request failed.");
101
+ record({
102
+ ...baseAudit,
103
+ outcome: error.code === "TIMEOUT" ? "timeout" : error.code === "HTTP_ERROR" ? "http_error" : "failed",
104
+ durationMs: elapsed(now, startedAt),
105
+ status: error.status,
106
+ errorCode: error.code,
107
+ });
108
+ throw error;
109
+ }
110
+ finally {
111
+ if (timeout)
112
+ clearTimeout(timeout);
113
+ }
114
+ },
115
+ getAuditLog: () => audit.map((entry) => ({ ...entry })),
116
+ });
117
+ }
118
+ function validatePolicy(policy) {
119
+ const origin = new URL(policy.allowedOrigin);
120
+ if (origin.protocol !== "https:" || origin.origin !== policy.allowedOrigin || origin.pathname !== "/" || origin.search || origin.hash) {
121
+ throw new Error("Vendor sandbox allowedOrigin must be an exact HTTPS origin without a path.");
122
+ }
123
+ if (!policy.vendor.trim())
124
+ throw new Error("Vendor sandbox policy vendor is required.");
125
+ if (!Number.isSafeInteger(policy.timeoutMs) || policy.timeoutMs < 100 || policy.timeoutMs > 30_000) {
126
+ throw new Error("Vendor sandbox timeoutMs must be an integer from 100 to 30000.");
127
+ }
128
+ if (!Number.isSafeInteger(policy.maxRequestsPerMinute) || policy.maxRequestsPerMinute < 1 || policy.maxRequestsPerMinute > 60) {
129
+ throw new Error("Vendor sandbox maxRequestsPerMinute must be an integer from 1 to 60.");
130
+ }
131
+ if (policy.resources.length === 0 || new Set(policy.resources.map((entry) => entry.id)).size !== policy.resources.length) {
132
+ throw new Error("Vendor sandbox policy requires unique resource rules.");
133
+ }
134
+ return Object.freeze({
135
+ ...policy,
136
+ resources: Object.freeze(policy.resources.map((entry) => Object.freeze({
137
+ ...entry,
138
+ pathPattern: new RegExp(entry.pathPattern.source, entry.pathPattern.flags),
139
+ }))),
140
+ });
141
+ }
142
+ function safeUrl(path, origin) {
143
+ try {
144
+ return new URL(path, `${origin}/`);
145
+ }
146
+ catch {
147
+ return undefined;
148
+ }
149
+ }
150
+ function elapsed(now, startedAt) {
151
+ return Math.max(0, Math.round(now() - startedAt));
152
+ }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "witnora",
3
- "version": "0.8.1",
4
- "description": "Canonical Witnora CLI entry point for autonomous-system evidence and assurance.",
3
+ "version": "0.9.0",
4
+ "description": "Witnora evidence, assurance release gates, runtime records, and regression CI for autonomous AI systems.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "homepage": "https://witnora.com/",
@@ -14,29 +14,49 @@
14
14
  "url": "https://github.com/Kakarottoooo/agentcert/issues"
15
15
  },
16
16
  "keywords": [
17
- "ai-agents",
18
- "assurance",
19
- "evidence",
20
- "audit",
17
+ "agent",
18
+ "browser-agent",
19
+ "ci",
20
+ "playwright",
21
21
  "agent-security",
22
- "runtime-verification"
22
+ "llm",
23
+ "mcp",
24
+ "tripwire",
25
+ "evidence",
26
+ "assurance",
27
+ "authorization",
28
+ "audit"
23
29
  ],
24
30
  "bin": {
25
- "witnora": "bin/witnora.js"
31
+ "witnora": "dist/cli.js"
32
+ },
33
+ "exports": {
34
+ "./cli": "./dist/cli.js",
35
+ "./browser-adapter-kit": {
36
+ "types": "./dist/vendor/onegent-runtime/browser-adapter-kit.d.ts",
37
+ "import": "./dist/vendor/onegent-runtime/browser-adapter-kit.js"
38
+ }
26
39
  },
27
40
  "files": [
28
- "bin",
41
+ "dist",
29
42
  "README.md",
30
43
  "package.json"
31
44
  ],
32
45
  "scripts": {
33
- "test": "node --test tests/*.test.mjs",
34
- "prepack": "npm test"
46
+ "build": "node -e \"require('fs').rmSync('dist',{recursive:true,force:true})\" && tsc -p tsconfig.json && tsc -p tsconfig.onegent-vendor.json",
47
+ "prepack": "npm run build",
48
+ "test": "vitest run tests",
49
+ "demo:report": "node dist/cli.js report --mcpbench ../../examples/reports/passing/results.json --out .witnora/demo --subject demo-agent"
35
50
  },
36
51
  "engines": {
37
52
  "node": ">=20"
38
53
  },
39
- "dependencies": {
40
- "agentcert": "0.8.1"
54
+ "devDependencies": {
55
+ "@types/node": "^24.10.1",
56
+ "typescript": "^5.9.3",
57
+ "vitest": "^4.0.13"
58
+ },
59
+ "optionalDependencies": {
60
+ "pg": "^8.16.3"
41
61
  }
42
62
  }
package/bin/witnora.js DELETED
@@ -1,3 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- await import("agentcert/cli");