@chatpanel/gateway 0.98.0 → 0.98.3
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/package.json +3 -3
- package/src/event.js +1 -1
- package/src/version.js +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chatpanel/gateway",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.3",
|
|
4
4
|
"description": "Local privacy gateway — redacts PII out of OpenAI/Anthropic API traffic before it reaches a model, then restores it in the reply. Point opencode, codex, aider, Claude Code, etc. at it.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@anthropic-ai/sandbox-runtime": "^0.0.77",
|
|
26
|
-
"@chatpanel/bridge": "^0.46.
|
|
27
|
-
"@chatpanel/events": "^0.
|
|
26
|
+
"@chatpanel/bridge": "^0.46.1",
|
|
27
|
+
"@chatpanel/events": "^0.361.0",
|
|
28
28
|
"@chatpanel/pii": "^0.15.0",
|
|
29
29
|
"@huggingface/transformers": "^4.2.0",
|
|
30
30
|
"defuddle": "^0.19.4",
|
package/src/event.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{isRef as n}from"./ref.js";const
|
|
1
|
+
import{isRef as n}from"./ref.js";const c=1,E=Object.freeze({turn:["started","ended"],assistant:["prompted","message","reasoning"],context:["assembled","attached","expanded","retrieved"],capability:["offered","granted","denied","activated","revoked","invoked","resulted"],privacy:["redacted","egress"],policy:["changed","guard_denied"],data:["created","updated","deleted"],automation:["fired","suppressed"],shim:["fired"]}),v=Object.freeze(Object.entries(E).flatMap(([e,r])=>r.map(s=>`${e}.${s}`))),w=Object.freeze(["user","rule","schedule","model","agent","channel"]),x=Object.freeze(["global","site","tab","session","agent"]),u=Object.freeze(["R","M","L","C","A","X","H"]),S=Object.freeze(["pure","idempotent","replay-safe","non-replayable"]),I=Object.freeze(["none","redacted","delegated"]);class a extends Error{constructor(r,s,d=null){super(s),this.name="EventError",this.code=r,this.detail=d}}const t=e=>typeof e=="string"&&e.length>0,o=e=>typeof e=="number"&&Number.isFinite(e),l=e=>Array.isArray(e);function i(e){return!!e&&w.includes(e.kind)&&t(e.id)}function A(e){return!!e&&x.includes(e.kind)&&t(e.id)}const O={"turn.started":e=>t(e.turnId),"turn.ended":e=>t(e.turnId),"assistant.prompted":e=>t(e.turnId)&&n(e.ref),"assistant.message":e=>t(e.turnId)&&n(e.ref),"assistant.reasoning":e=>t(e.turnId)&&n(e.ref),"context.assembled":e=>o(e.budget)&&o(e.used)&&!!e.parts&&typeof e.parts=="object"&&l(e.resident)&&e.resident.every(n)&&o(e.reachableCount),"context.attached":e=>n(e.ref),"context.expanded":e=>n(e.ref)&&o(e.tokens),"context.retrieved":e=>t(e.tool)&&o(e.count)&&l(e.sources)&&e.sources.every(r=>r&&typeof r=="object"&&o(r.rank)),"capability.offered":e=>t(e.capability)&&t(e.reason),"capability.granted":e=>t(e.capability)&&i(e.actor),"capability.denied":e=>t(e.capability)&&i(e.actor),"capability.activated":e=>t(e.capability)&&u.includes(e.classUsed),"capability.revoked":e=>t(e.capability)&&t(e.cause),"capability.invoked":e=>t(e.capability)&&i(e.actor)&&A(e.scope)&&S.includes(e.effects)&&(e.effects==="pure"||t(e.idempotencyKey)),"capability.resulted":e=>t(e.capability)&&typeof e.ok=="boolean"&&u.includes(e.classUsed)&&!!e.cost&&o(e.cost.ms),"privacy.redacted":e=>!!e.counts&&typeof e.counts=="object"&&Object.values(e.counts).every(o),"privacy.egress":e=>t(e.host)&&typeof e.redacted=="boolean"&&typeof e.controlled=="boolean","policy.changed":e=>t(e.dial)&&i(e.actor)&&"from"in e&&"to"in e,"policy.guard_denied":e=>t(e.capability)&&t(e.reason),"data.created":e=>n(e.ref),"data.updated":e=>n(e.ref),"data.deleted":e=>n(e.ref)&&typeof e.shredded=="boolean","automation.fired":e=>t(e.ruleId)&&u.includes(e.classUsed),"automation.suppressed":e=>t(e.ruleId)&&t(e.reason),"shim.fired":e=>t(e.shimId)&&(e.engine==null||t(e.engine))};function y(e){if(!e||typeof e!="object")throw new a("SHAPE","event must be an object");if(e.v!==c)throw new a("VERSION",`expected v=${c}, got ${e.v} — upcast first`,e.v);if(!t(e.id))throw new a("SHAPE","id required");if(!t(e.host))throw new a("SHAPE","host required");if(!Number.isInteger(e.seq)||e.seq<0)throw new a("SHAPE","seq must be a non-negative integer");if(!l(e.causes)||!e.causes.every(t))throw new a("SHAPE","causes must be string[]");if(!o(e.at))throw new a("SHAPE","at required (advisory wall clock)");if(!v.includes(e.type))throw new a("TYPE",`unknown type ${e.type}`,e.type);if(!e.payload||typeof e.payload!="object")throw new a("SHAPE","payload required");const r=O[e.type];if(r&&!r(e.payload))throw new a("PAYLOAD",`payload invalid for ${e.type}`,e.type);return e}function k(e){try{return y(e),!0}catch{return!1}}function P({host:e,seq:r=0,now:s=()=>Date.now(),newId:d}){if(!t(e))throw new a("SHAPE","host required");const b=d||(()=>globalThis.crypto.randomUUID());let f=r;return{get host(){return e},get seq(){return f},append(p,h,g=[]){const m=Object.freeze({v:c,id:b(),host:e,seq:f++,causes:Object.freeze([...g]),at:s(),type:p,payload:h});return y(m)}}}export{w as ACTOR_KINDS,v as ALL_TYPES,u as CLASSES,c as CURRENT_VERSION,S as EFFECTS,I as EGRESS,E as EVENT_TYPES,a as EventError,x as SCOPE_KINDS,P as createAppender,k as isValidEvent,y as validateEvent};
|
package/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="0.98.
|
|
1
|
+
const o="0.98.3";export{o as VERSION};
|