avantgate 2.1.0 → 2.3.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.
- package/README.md +10 -22
- package/dist/chunk-Z6QOMLZ2.mjs +55 -0
- package/dist/control-layer.d.ts +20 -2
- package/dist/control-layer.d.ts.map +1 -1
- package/dist/custom-terms.d.ts +8 -0
- package/dist/custom-terms.d.ts.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +367 -34
- package/dist/index.mjs +358 -34
- package/dist/middleware.d.ts +15 -0
- package/dist/middleware.d.ts.map +1 -0
- package/dist/presets.d.ts +13 -0
- package/dist/presets.d.ts.map +1 -0
- package/dist/secret-guard.d.ts +5 -0
- package/dist/secret-guard.d.ts.map +1 -1
- package/dist/types.d.ts +47 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/ui/index.d.ts +1 -0
- package/dist/ui/index.d.ts.map +1 -1
- package/dist/ui/index.js +65 -0
- package/dist/ui/index.mjs +6 -0
- package/dist/ui/react/index.mjs +4 -51
- package/package.json +10 -13
package/dist/ui/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { createToolEnvelope, type ToolExecutionEnvelope, type ToolMergeStrategy, type UIIntent, type UIIntentAction, } from "./envelope";
|
|
2
2
|
export { createCanvasReducer, isSafeKey, mergeUniqueEntities, updateEntityInPlace, type CanvasContentState, type CanvasState, } from "./reducer";
|
|
3
3
|
export { defineCanvas } from "./define-canvas";
|
|
4
|
+
export { createViewRegistry, type CanvasRendererProps, type CanvasViewComponent, type CanvasViewContext, isValidSafeUrl, } from "./react";
|
|
4
5
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/ui/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/ui/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAClB,KAAK,qBAAqB,EAC1B,KAAK,iBAAiB,EACtB,KAAK,QAAQ,EACb,KAAK,cAAc,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EACL,mBAAmB,EACnB,SAAS,EACT,mBAAmB,EACnB,mBAAmB,EACnB,KAAK,kBAAkB,EACvB,KAAK,WAAW,GACjB,MAAM,WAAW,CAAC;AAEnB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,OAAO,EACL,kBAAkB,EAClB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACtB,cAAc,GACf,MAAM,SAAS,CAAC"}
|
package/dist/ui/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,6 +17,14 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/ui/index.ts
|
|
@@ -22,8 +32,10 @@ var ui_exports = {};
|
|
|
22
32
|
__export(ui_exports, {
|
|
23
33
|
createCanvasReducer: () => createCanvasReducer,
|
|
24
34
|
createToolEnvelope: () => createToolEnvelope,
|
|
35
|
+
createViewRegistry: () => createViewRegistry,
|
|
25
36
|
defineCanvas: () => defineCanvas,
|
|
26
37
|
isSafeKey: () => isSafeKey,
|
|
38
|
+
isValidSafeUrl: () => isValidSafeUrl,
|
|
27
39
|
mergeUniqueEntities: () => mergeUniqueEntities,
|
|
28
40
|
updateEntityInPlace: () => updateEntityInPlace
|
|
29
41
|
});
|
|
@@ -159,12 +171,65 @@ var defineCanvas = () => {
|
|
|
159
171
|
canvasReducer: createCanvasReducer()
|
|
160
172
|
};
|
|
161
173
|
};
|
|
174
|
+
|
|
175
|
+
// src/ui/react/create-view-registry.ts
|
|
176
|
+
var import_react = __toESM(require("react"));
|
|
177
|
+
var createViewRegistry = (registry) => {
|
|
178
|
+
const CanvasRenderer = ({
|
|
179
|
+
state,
|
|
180
|
+
context = {}
|
|
181
|
+
}) => {
|
|
182
|
+
if (!state?.content) {
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
const kind = state.content.kind;
|
|
186
|
+
const Component = registry[kind];
|
|
187
|
+
if (!Component) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
return import_react.default.createElement(Component, {
|
|
191
|
+
data: state.content,
|
|
192
|
+
context,
|
|
193
|
+
activeIntent: state.activeIntent
|
|
194
|
+
});
|
|
195
|
+
};
|
|
196
|
+
return {
|
|
197
|
+
registry,
|
|
198
|
+
CanvasRenderer
|
|
199
|
+
};
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
// src/ui/react/sanitize.ts
|
|
203
|
+
var ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
204
|
+
var isValidSafeUrl = (rawUrl) => {
|
|
205
|
+
if (!rawUrl || typeof rawUrl !== "string") {
|
|
206
|
+
return false;
|
|
207
|
+
}
|
|
208
|
+
const trimmed = rawUrl.trim();
|
|
209
|
+
if (!trimmed) {
|
|
210
|
+
return false;
|
|
211
|
+
}
|
|
212
|
+
if (trimmed.startsWith("#")) {
|
|
213
|
+
return true;
|
|
214
|
+
}
|
|
215
|
+
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
216
|
+
return true;
|
|
217
|
+
}
|
|
218
|
+
try {
|
|
219
|
+
const parsed = new URL(trimmed);
|
|
220
|
+
return ALLOWED_PROTOCOLS.has(parsed.protocol);
|
|
221
|
+
} catch {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
};
|
|
162
225
|
// Annotate the CommonJS export names for ESM import in node:
|
|
163
226
|
0 && (module.exports = {
|
|
164
227
|
createCanvasReducer,
|
|
165
228
|
createToolEnvelope,
|
|
229
|
+
createViewRegistry,
|
|
166
230
|
defineCanvas,
|
|
167
231
|
isSafeKey,
|
|
232
|
+
isValidSafeUrl,
|
|
168
233
|
mergeUniqueEntities,
|
|
169
234
|
updateEntityInPlace
|
|
170
235
|
});
|
package/dist/ui/index.mjs
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createViewRegistry,
|
|
3
|
+
isValidSafeUrl
|
|
4
|
+
} from "../chunk-Z6QOMLZ2.mjs";
|
|
1
5
|
import "../chunk-Y6FXYEAI.mjs";
|
|
2
6
|
|
|
3
7
|
// src/ui/envelope.ts
|
|
@@ -133,8 +137,10 @@ var defineCanvas = () => {
|
|
|
133
137
|
export {
|
|
134
138
|
createCanvasReducer,
|
|
135
139
|
createToolEnvelope,
|
|
140
|
+
createViewRegistry,
|
|
136
141
|
defineCanvas,
|
|
137
142
|
isSafeKey,
|
|
143
|
+
isValidSafeUrl,
|
|
138
144
|
mergeUniqueEntities,
|
|
139
145
|
updateEntityInPlace
|
|
140
146
|
};
|
package/dist/ui/react/index.mjs
CHANGED
|
@@ -1,55 +1,8 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createViewRegistry,
|
|
3
|
+
isValidSafeUrl
|
|
4
|
+
} from "../../chunk-Z6QOMLZ2.mjs";
|
|
1
5
|
import "../../chunk-Y6FXYEAI.mjs";
|
|
2
|
-
|
|
3
|
-
// src/ui/react/create-view-registry.ts
|
|
4
|
-
import React from "react";
|
|
5
|
-
var createViewRegistry = (registry) => {
|
|
6
|
-
const CanvasRenderer = ({
|
|
7
|
-
state,
|
|
8
|
-
context = {}
|
|
9
|
-
}) => {
|
|
10
|
-
if (!state?.content) {
|
|
11
|
-
return null;
|
|
12
|
-
}
|
|
13
|
-
const kind = state.content.kind;
|
|
14
|
-
const Component = registry[kind];
|
|
15
|
-
if (!Component) {
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
return React.createElement(Component, {
|
|
19
|
-
data: state.content,
|
|
20
|
-
context,
|
|
21
|
-
activeIntent: state.activeIntent
|
|
22
|
-
});
|
|
23
|
-
};
|
|
24
|
-
return {
|
|
25
|
-
registry,
|
|
26
|
-
CanvasRenderer
|
|
27
|
-
};
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
// src/ui/react/sanitize.ts
|
|
31
|
-
var ALLOWED_PROTOCOLS = /* @__PURE__ */ new Set(["http:", "https:"]);
|
|
32
|
-
var isValidSafeUrl = (rawUrl) => {
|
|
33
|
-
if (!rawUrl || typeof rawUrl !== "string") {
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
const trimmed = rawUrl.trim();
|
|
37
|
-
if (!trimmed) {
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
if (trimmed.startsWith("#")) {
|
|
41
|
-
return true;
|
|
42
|
-
}
|
|
43
|
-
if (trimmed.startsWith("/") && !trimmed.startsWith("//")) {
|
|
44
|
-
return true;
|
|
45
|
-
}
|
|
46
|
-
try {
|
|
47
|
-
const parsed = new URL(trimmed);
|
|
48
|
-
return ALLOWED_PROTOCOLS.has(parsed.protocol);
|
|
49
|
-
} catch {
|
|
50
|
-
return false;
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
6
|
export {
|
|
54
7
|
createViewRegistry,
|
|
55
8
|
isValidSafeUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "avantgate",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "Zero-infrastructure, in-process AI Application Firewall (AI-WAF), privacy control plane & headless UI canvas for TypeScript: real-time prompt guardrails, zero-egress PII redaction, deterministic tool envelopes, anti-IDOR defense, pre-flight token budgets, and multi-model failover.",
|
|
5
5
|
"author": "Gatewall Team",
|
|
6
6
|
"license": "MIT",
|
|
@@ -69,16 +69,16 @@
|
|
|
69
69
|
"import": "./dist/client/index.mjs",
|
|
70
70
|
"require": "./dist/client/index.js"
|
|
71
71
|
},
|
|
72
|
-
"./ui": {
|
|
73
|
-
"types": "./dist/ui/index.d.ts",
|
|
74
|
-
"import": "./dist/ui/index.mjs",
|
|
75
|
-
"require": "./dist/ui/index.js"
|
|
76
|
-
},
|
|
77
72
|
"./ui/react": {
|
|
78
73
|
"types": "./dist/ui/react/index.d.ts",
|
|
79
74
|
"import": "./dist/ui/react/index.mjs",
|
|
80
75
|
"require": "./dist/ui/react/index.js"
|
|
81
76
|
},
|
|
77
|
+
"./ui": {
|
|
78
|
+
"types": "./dist/ui/index.d.ts",
|
|
79
|
+
"import": "./dist/ui/index.mjs",
|
|
80
|
+
"require": "./dist/ui/index.js"
|
|
81
|
+
},
|
|
82
82
|
"./package.json": "./package.json"
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
@@ -96,7 +96,9 @@
|
|
|
96
96
|
],
|
|
97
97
|
"scripts": {
|
|
98
98
|
"build": "tsup src/index.ts src/finance/index.ts src/agent/index.ts src/workflow/index.ts src/client/index.ts src/ui/index.ts src/ui/react/index.ts --format cjs --format esm --clean && tsc --emitDeclarationOnly --outDir dist",
|
|
99
|
-
"test": "tsx tests/avantgate.test.ts && tsx tests/preflight-budget.test.ts && tsx tests/sqlite-pricing-adapter.test.ts && tsx tests/financial-normalizer.test.ts && tsx tests/prompt-builder.test.ts && tsx tests/pii-extended.test.ts && tsx tests/output-dlp-secret-guard.test.ts && npm run test:agent && npm run test:workflow && npm run test:client && npm run test:ui",
|
|
99
|
+
"test": "tsx tests/avantgate.test.ts && tsx tests/preflight-budget.test.ts && tsx tests/sqlite-pricing-adapter.test.ts && tsx tests/financial-normalizer.test.ts && tsx tests/prompt-builder.test.ts && tsx tests/pii-extended.test.ts && tsx tests/output-dlp-secret-guard.test.ts && tsx tests/middleware-lifecycle.test.ts && tsx tests/presets.test.ts && npm run test:agent && npm run test:workflow && npm run test:client && npm run test:ui",
|
|
100
|
+
"test:presets": "tsx tests/presets.test.ts",
|
|
101
|
+
"test:middleware": "tsx tests/middleware-lifecycle.test.ts",
|
|
100
102
|
"test:ui": "tsx tests/ui/envelope.test.ts && tsx tests/ui/reducer.test.ts && tsx tests/ui/sanitize.test.ts && tsx tests/ui/react-registry.test.tsx",
|
|
101
103
|
"test:secrets": "tsx tests/output-dlp-secret-guard.test.ts",
|
|
102
104
|
"test:pricing": "tsx tests/sqlite-pricing-adapter.test.ts",
|
|
@@ -107,12 +109,6 @@
|
|
|
107
109
|
"test:workflow": "tsx tests/workflow/workflow-saga.test.ts && tsx tests/workflow/workflow-abort.test.ts",
|
|
108
110
|
"test:client": "tsx tests/client/browser-exporter.test.ts && tsx tests/client/use-avantgate-task.test.ts && tsx tests/client/task-runner.test.ts",
|
|
109
111
|
"test:demo": "tsx tests/agent/prospect-ai-demo-scenario.test.ts",
|
|
110
|
-
"gatewall": "npm --prefix gatewall run dev",
|
|
111
|
-
"gatewall:dev": "npm --prefix gatewall run dev",
|
|
112
|
-
"gatewall:build": "npm --prefix gatewall run build",
|
|
113
|
-
"gatewall:seed": "npm --prefix gatewall run seed:mock",
|
|
114
|
-
"gatewall:start": "npm --prefix gatewall run start",
|
|
115
|
-
"gatewall:docker": "docker compose up -d",
|
|
116
112
|
"lint": "tsc --noEmit",
|
|
117
113
|
"prepublishOnly": "npm run build && npm test"
|
|
118
114
|
},
|
|
@@ -139,3 +135,4 @@
|
|
|
139
135
|
"url": "https://github.com/thienban/avantGate/issues"
|
|
140
136
|
}
|
|
141
137
|
}
|
|
138
|
+
|