nexus-agents 8.60.0 → 8.60.1
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/dist/{chunk-TH7NLNPU.js → chunk-5ZVGPKNO.js} +202 -9
- package/dist/chunk-5ZVGPKNO.js.map +1 -0
- package/dist/{chunk-UEUHEBNI.js → chunk-C5CRQ5EH.js} +2 -2
- package/dist/{chunk-BQRZFAJU.js → chunk-GAEQEVSJ.js} +64 -17
- package/dist/chunk-GAEQEVSJ.js.map +1 -0
- package/dist/{chunk-GYOPH7LC.js → chunk-HMKX2LPT.js} +34 -299
- package/dist/chunk-HMKX2LPT.js.map +1 -0
- package/dist/{chunk-EVEYEV3W.js → chunk-L6ZP2JI4.js} +2 -2
- package/dist/{chunk-CMIKHBQS.js → chunk-O24AWSIT.js} +3 -3
- package/dist/{chunk-LAEKMOIF.js → chunk-Y5V2ZZOL.js} +3 -3
- package/dist/cli.js +8 -9
- package/dist/cli.js.map +1 -1
- package/dist/{consensus-vote-C2HYWT3Y.js → consensus-vote-2G4X4JVF.js} +4 -5
- package/dist/{improvement-review-VUJBBHIG.js → improvement-review-UG7RUEUT.js} +4 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +16 -18
- package/dist/index.js.map +1 -1
- package/dist/{issue-triage-XUUOXCXQ.js → issue-triage-CGMODLMK.js} +2 -3
- package/dist/{setup-data-dir-J7N2LE4T.js → setup-data-dir-LLB3HLXF.js} +3 -3
- package/package.json +1 -1
- package/dist/chunk-BQRZFAJU.js.map +0 -1
- package/dist/chunk-GYOPH7LC.js.map +0 -1
- package/dist/chunk-JZ7MTCXL.js +0 -217
- package/dist/chunk-JZ7MTCXL.js.map +0 -1
- package/dist/chunk-TH7NLNPU.js.map +0 -1
- /package/dist/{chunk-UEUHEBNI.js.map → chunk-C5CRQ5EH.js.map} +0 -0
- /package/dist/{chunk-EVEYEV3W.js.map → chunk-L6ZP2JI4.js.map} +0 -0
- /package/dist/{chunk-CMIKHBQS.js.map → chunk-O24AWSIT.js.map} +0 -0
- /package/dist/{chunk-LAEKMOIF.js.map → chunk-Y5V2ZZOL.js.map} +0 -0
- /package/dist/{consensus-vote-C2HYWT3Y.js.map → consensus-vote-2G4X4JVF.js.map} +0 -0
- /package/dist/{improvement-review-VUJBBHIG.js.map → improvement-review-UG7RUEUT.js.map} +0 -0
- /package/dist/{issue-triage-XUUOXCXQ.js.map → issue-triage-CGMODLMK.js.map} +0 -0
- /package/dist/{setup-data-dir-J7N2LE4T.js.map → setup-data-dir-LLB3HLXF.js.map} +0 -0
|
@@ -13,14 +13,6 @@ import {
|
|
|
13
13
|
resolveReputationGatingMode,
|
|
14
14
|
sanitizeInput
|
|
15
15
|
} from "./chunk-DIV6TBCN.js";
|
|
16
|
-
import {
|
|
17
|
-
MAX_STRIPPED_ELEMENTS_PER_EVENT,
|
|
18
|
-
createAuditTrail,
|
|
19
|
-
emitPolicyEvent,
|
|
20
|
-
emitReputationEvent,
|
|
21
|
-
emitSanitizationEvent,
|
|
22
|
-
emitTrustEvent
|
|
23
|
-
} from "./chunk-JZ7MTCXL.js";
|
|
24
16
|
import {
|
|
25
17
|
hasToken
|
|
26
18
|
} from "./chunk-TZN2E2WI.js";
|
|
@@ -59,6 +51,197 @@ function resolveFirewallPolicyMode(env = process.env, logger7) {
|
|
|
59
51
|
);
|
|
60
52
|
}
|
|
61
53
|
|
|
54
|
+
// src/security/audit-trail.ts
|
|
55
|
+
var MAX_EVENTS = 1e4;
|
|
56
|
+
var MAX_STRIPPED_ELEMENTS_PER_EVENT = 20;
|
|
57
|
+
var AuditTrail = class {
|
|
58
|
+
constructor(durableSink) {
|
|
59
|
+
this.durableSink = durableSink;
|
|
60
|
+
}
|
|
61
|
+
durableSink;
|
|
62
|
+
events = [];
|
|
63
|
+
nextId = 1;
|
|
64
|
+
/** Appends an event to the trail. Returns the assigned event ID. */
|
|
65
|
+
append(event) {
|
|
66
|
+
const id = `audit-${String(this.nextId++)}`;
|
|
67
|
+
const fullEvent = {
|
|
68
|
+
...event,
|
|
69
|
+
id,
|
|
70
|
+
timestamp: getTimeProvider().nowIso()
|
|
71
|
+
};
|
|
72
|
+
this.events.push(fullEvent);
|
|
73
|
+
this.enforceLimit();
|
|
74
|
+
if (this.durableSink !== void 0) {
|
|
75
|
+
try {
|
|
76
|
+
this.durableSink(fullEvent);
|
|
77
|
+
} catch {
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return id;
|
|
81
|
+
}
|
|
82
|
+
/** Queries events matching the given filter. */
|
|
83
|
+
query(filter = {}) {
|
|
84
|
+
let results = this.events;
|
|
85
|
+
if (filter.type !== void 0) {
|
|
86
|
+
results = results.filter((e) => e.type === filter.type);
|
|
87
|
+
}
|
|
88
|
+
if (filter.since !== void 0) {
|
|
89
|
+
results = filterSince(results, filter.since);
|
|
90
|
+
}
|
|
91
|
+
if (filter.until !== void 0) {
|
|
92
|
+
results = filterUntil(results, filter.until);
|
|
93
|
+
}
|
|
94
|
+
if (filter.trustTier !== void 0) {
|
|
95
|
+
results = filterByTrustTier(results, filter.trustTier);
|
|
96
|
+
}
|
|
97
|
+
if (filter.actionType !== void 0) {
|
|
98
|
+
results = filterByActionType(results, filter.actionType);
|
|
99
|
+
}
|
|
100
|
+
if (filter.actor !== void 0) {
|
|
101
|
+
results = filterByActor(results, filter.actor);
|
|
102
|
+
}
|
|
103
|
+
if (filter.violationRule !== void 0) {
|
|
104
|
+
results = filterByViolationRule(results, filter.violationRule);
|
|
105
|
+
}
|
|
106
|
+
const limit = filter.limit ?? results.length;
|
|
107
|
+
return results.slice(-limit);
|
|
108
|
+
}
|
|
109
|
+
/** Returns the total number of events. */
|
|
110
|
+
get size() {
|
|
111
|
+
return this.events.length;
|
|
112
|
+
}
|
|
113
|
+
/** Clears all events. */
|
|
114
|
+
clear() {
|
|
115
|
+
this.events = [];
|
|
116
|
+
}
|
|
117
|
+
/** Enforces MAX_EVENTS bound. */
|
|
118
|
+
enforceLimit() {
|
|
119
|
+
if (this.events.length > MAX_EVENTS) {
|
|
120
|
+
this.events = this.events.slice(-MAX_EVENTS);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
function filterSince(events, since) {
|
|
125
|
+
const sinceTime = new Date(since).getTime();
|
|
126
|
+
return events.filter((e) => new Date(e.timestamp).getTime() >= sinceTime);
|
|
127
|
+
}
|
|
128
|
+
function filterUntil(events, until) {
|
|
129
|
+
const untilTime = new Date(until).getTime();
|
|
130
|
+
return events.filter((e) => new Date(e.timestamp).getTime() <= untilTime);
|
|
131
|
+
}
|
|
132
|
+
function filterByTrustTier(events, tier) {
|
|
133
|
+
return events.filter((e) => {
|
|
134
|
+
if (e.type === "trust_classification") return e.assignedTier === tier;
|
|
135
|
+
if (e.type === "policy_gate") return e.inputTrustTier === tier;
|
|
136
|
+
if (e.type === "reputation") return e.effectiveTier === tier;
|
|
137
|
+
return true;
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
function filterByActionType(events, actionType) {
|
|
141
|
+
return events.filter(
|
|
142
|
+
(e) => (e.type === "policy_gate" || e.type === "corroboration") && e.actionType === actionType
|
|
143
|
+
);
|
|
144
|
+
}
|
|
145
|
+
function filterByActor(events, actor) {
|
|
146
|
+
return events.filter(
|
|
147
|
+
(e) => (e.type === "trust_classification" || e.type === "reputation") && e.username === actor
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
function filterByViolationRule(events, rule) {
|
|
151
|
+
return events.filter((e) => e.type === "policy_gate" && e.violationRules.includes(rule));
|
|
152
|
+
}
|
|
153
|
+
function emitTrustEvent(trail, data) {
|
|
154
|
+
return trail.append({
|
|
155
|
+
type: "trust_classification",
|
|
156
|
+
component: "trust-classifier",
|
|
157
|
+
...data
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function emitPolicyEvent(trail, data) {
|
|
161
|
+
return trail.append({
|
|
162
|
+
type: "policy_gate",
|
|
163
|
+
component: "policy-gate",
|
|
164
|
+
...data
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
function emitPipelinePolicyEvent(trail, data) {
|
|
168
|
+
return trail.append({
|
|
169
|
+
type: "policy_gate",
|
|
170
|
+
component: "pipeline-policy-evaluator",
|
|
171
|
+
...data
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
function emitCorroborationEvent(trail, data) {
|
|
175
|
+
return trail.append({
|
|
176
|
+
type: "corroboration",
|
|
177
|
+
component: "corroboration-validator",
|
|
178
|
+
...data
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
function emitReputationEvent(trail, data) {
|
|
182
|
+
return trail.append({
|
|
183
|
+
type: "reputation",
|
|
184
|
+
component: "reputation-model",
|
|
185
|
+
...data
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
function emitSanitizationEvent(trail, data) {
|
|
189
|
+
return trail.append({
|
|
190
|
+
type: "sanitization",
|
|
191
|
+
component: "input-sanitizer",
|
|
192
|
+
...data
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
function emitGraphExecutionEvent(trail, data) {
|
|
196
|
+
return trail.append({
|
|
197
|
+
type: "graph_execution",
|
|
198
|
+
component: "graph-executor",
|
|
199
|
+
...data
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
function createGraphAuditBridge(trail) {
|
|
203
|
+
return (event) => {
|
|
204
|
+
const nodeId = typeof event["nodeId"] === "string" ? event["nodeId"] : void 0;
|
|
205
|
+
const stepNumber = typeof event["stepNumber"] === "number" ? event["stepNumber"] : 0;
|
|
206
|
+
emitGraphExecutionEvent(trail, {
|
|
207
|
+
graphEvent: event.type,
|
|
208
|
+
...nodeId !== void 0 ? { nodeId } : {},
|
|
209
|
+
stepNumber,
|
|
210
|
+
detail: formatGraphEventDetail(event)
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
function formatNotCompleted(event) {
|
|
215
|
+
const detail = event["detail"];
|
|
216
|
+
const suffix = typeof detail === "string" && detail !== "" ? `: ${detail}` : "";
|
|
217
|
+
return `Node ${String(event["nodeId"])} ${String(event["reason"])} (did not complete)${suffix}`;
|
|
218
|
+
}
|
|
219
|
+
function formatCompletion(event) {
|
|
220
|
+
return event["halted"] === true ? `HALTED awaiting input after ${String(event["totalSteps"])} steps, ${String(event["durationMs"])}ms \u2014 NOT complete` : `Complete: ${String(event["totalSteps"])} steps, ${String(event["durationMs"])}ms`;
|
|
221
|
+
}
|
|
222
|
+
function formatGraphEventDetail(event) {
|
|
223
|
+
if (event.type === "node_not_completed") return formatNotCompleted(event);
|
|
224
|
+
switch (event.type) {
|
|
225
|
+
case "node_started":
|
|
226
|
+
return `Node ${String(event["nodeId"])} starting`;
|
|
227
|
+
case "node_completed":
|
|
228
|
+
return `Node ${String(event["nodeId"])} completed in ${String(event["durationMs"])}ms`;
|
|
229
|
+
case "node_error":
|
|
230
|
+
return `Node ${String(event["nodeId"])} failed: ${String(event["error"])}`;
|
|
231
|
+
case "state_updated":
|
|
232
|
+
return `State updated: ${String(event["updatedKeys"])}`;
|
|
233
|
+
case "step_completed":
|
|
234
|
+
return `Step ${String(event["stepNumber"])}: ${String(event["nodesExecuted"])} nodes`;
|
|
235
|
+
case "execution_complete":
|
|
236
|
+
return formatCompletion(event);
|
|
237
|
+
default:
|
|
238
|
+
return event.type;
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
function createAuditTrail(durableSink) {
|
|
242
|
+
return new AuditTrail(durableSink);
|
|
243
|
+
}
|
|
244
|
+
|
|
62
245
|
// src/security/audit-bridge.ts
|
|
63
246
|
var logger = createLogger({ component: "SecurityAuditBridge" });
|
|
64
247
|
function systemActor(id, name) {
|
|
@@ -2163,6 +2346,16 @@ function createIssueTriage(config) {
|
|
|
2163
2346
|
}
|
|
2164
2347
|
|
|
2165
2348
|
export {
|
|
2349
|
+
AuditTrail,
|
|
2350
|
+
emitTrustEvent,
|
|
2351
|
+
emitPolicyEvent,
|
|
2352
|
+
emitPipelinePolicyEvent,
|
|
2353
|
+
emitCorroborationEvent,
|
|
2354
|
+
emitReputationEvent,
|
|
2355
|
+
emitSanitizationEvent,
|
|
2356
|
+
emitGraphExecutionEvent,
|
|
2357
|
+
createGraphAuditBridge,
|
|
2358
|
+
createAuditTrail,
|
|
2166
2359
|
createDurableAuditSink,
|
|
2167
2360
|
createDurableAuditTrail,
|
|
2168
2361
|
FirewallPolicyModeSchema,
|
|
@@ -2200,4 +2393,4 @@ export {
|
|
|
2200
2393
|
IssueTriage,
|
|
2201
2394
|
createIssueTriage
|
|
2202
2395
|
};
|
|
2203
|
-
//# sourceMappingURL=chunk-
|
|
2396
|
+
//# sourceMappingURL=chunk-5ZVGPKNO.js.map
|