@shield-agent/kya 0.22.0 → 0.23.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/.mcp.json +1 -1
- package/README.md +72 -30
- package/amp/settings.example.json +1 -1
- package/claude/claude_desktop_config.example.json +1 -1
- package/cline/cline_mcp_settings.example.json +1 -1
- package/copilot/mcp-config.example.json +1 -1
- package/dist/certify/attest.js +5 -5
- package/dist/certify/catalog.d.ts +1 -1
- package/dist/certify/catalog.js +3 -3
- package/dist/certify/context.js +1 -1
- package/dist/certify/evaluate.d.ts +2 -2
- package/dist/certify/evaluate.js +12 -12
- package/dist/certify/live.js +2 -2
- package/dist/certify/render.d.ts +1 -1
- package/dist/certify/render.js +10 -10
- package/dist/cli.d.ts +2 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +49 -16
- package/dist/cli.js.map +1 -1
- package/dist/commands/certify.d.ts +1 -1
- package/dist/commands/certify.js +3 -3
- package/dist/commands/connect.d.ts +2 -2
- package/dist/commands/connect.js +22 -22
- package/dist/commands/dash.js +4 -4
- package/dist/commands/gate-serve.js +3 -3
- package/dist/commands/gate.d.ts +1 -1
- package/dist/commands/gate.js +16 -16
- package/dist/commands/hook.d.ts +1 -1
- package/dist/commands/hook.d.ts.map +1 -1
- package/dist/commands/hook.js +55 -18
- package/dist/commands/hook.js.map +1 -1
- package/dist/commands/import-traces.d.ts +16 -0
- package/dist/commands/import-traces.d.ts.map +1 -0
- package/dist/commands/import-traces.js +18 -0
- package/dist/commands/import-traces.js.map +1 -0
- package/dist/commands/init.js +1 -1
- package/dist/commands/investigate.d.ts +13 -0
- package/dist/commands/investigate.d.ts.map +1 -0
- package/dist/commands/investigate.js +22 -0
- package/dist/commands/investigate.js.map +1 -0
- package/dist/commands/notify-flush.d.ts +2 -0
- package/dist/commands/notify-flush.d.ts.map +1 -0
- package/dist/commands/notify-flush.js +47 -0
- package/dist/commands/notify-flush.js.map +1 -0
- package/dist/commands/orr.d.ts +3 -3
- package/dist/commands/orr.js +5 -5
- package/dist/commands/receipt-serve.d.ts +1 -1
- package/dist/commands/receipt-serve.js +1 -1
- package/dist/commands/serve-mcp.js +1 -1
- package/dist/commands/start.d.ts +2 -2
- package/dist/commands/start.js +20 -20
- package/dist/commands/stop.d.ts +1 -1
- package/dist/commands/stop.js +6 -6
- package/dist/commands/update.d.ts +19 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +96 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/commands/wire-hooks.d.ts +1 -1
- package/dist/commands/wire-hooks.js +14 -14
- package/dist/commands/wrap.d.ts.map +1 -1
- package/dist/commands/wrap.js +12 -7
- package/dist/commands/wrap.js.map +1 -1
- package/dist/config.d.ts +4 -4
- package/dist/config.js +5 -5
- package/dist/dash/dash.d.ts +1 -1
- package/dist/dash/dash.js +3 -3
- package/dist/dash/entitlement.d.ts +1 -1
- package/dist/dash/entitlement.js +1 -1
- package/dist/dash/render.js +2 -2
- package/dist/dash/screens/enterprise.js +9 -9
- package/dist/dash/screens/free.js +5 -5
- package/dist/diff-preview.d.ts +1 -1
- package/dist/diff-preview.js +2 -2
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +1 -1
- package/dist/fs-atomic.d.ts +1 -1
- package/dist/fs-atomic.js +2 -2
- package/dist/gate/binary.js +4 -4
- package/dist/gate/config-gen.d.ts +1 -1
- package/dist/gate/config-gen.js +7 -7
- package/dist/gate/config.d.ts +2 -2
- package/dist/gate/config.js +6 -6
- package/dist/gate/daemon.js +1 -1
- package/dist/gate/discover.d.ts +2 -2
- package/dist/gate/discover.js +7 -7
- package/dist/gate/hosted-sync.js +1 -1
- package/dist/gate/otlp-decode.d.ts +2 -2
- package/dist/gate/otlp-decode.js +2 -2
- package/dist/gate/otlp-receiver.d.ts +1 -1
- package/dist/gate/otlp-receiver.js +3 -3
- package/dist/host-reload.js +11 -11
- package/dist/host-tools.d.ts +1 -1
- package/dist/host-tools.js +1 -1
- package/dist/importers/formats.d.ts +26 -0
- package/dist/importers/formats.d.ts.map +1 -0
- package/dist/importers/formats.js +281 -0
- package/dist/importers/formats.js.map +1 -0
- package/dist/importers/index.d.ts +26 -0
- package/dist/importers/index.d.ts.map +1 -0
- package/dist/importers/index.js +122 -0
- package/dist/importers/index.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/investigate/detectors.d.ts +35 -0
- package/dist/investigate/detectors.d.ts.map +1 -0
- package/dist/investigate/detectors.js +277 -0
- package/dist/investigate/detectors.js.map +1 -0
- package/dist/investigate/fix-brief.d.ts +3 -0
- package/dist/investigate/fix-brief.d.ts.map +1 -0
- package/dist/investigate/fix-brief.js +88 -0
- package/dist/investigate/fix-brief.js.map +1 -0
- package/dist/investigate/incidents.d.ts +19 -0
- package/dist/investigate/incidents.d.ts.map +1 -0
- package/dist/investigate/incidents.js +84 -0
- package/dist/investigate/incidents.js.map +1 -0
- package/dist/investigate/index.d.ts +25 -0
- package/dist/investigate/index.d.ts.map +1 -0
- package/dist/investigate/index.js +46 -0
- package/dist/investigate/index.js.map +1 -0
- package/dist/mcp/protocol.d.ts +2 -2
- package/dist/mcp/protocol.d.ts.map +1 -1
- package/dist/mcp/protocol.js +39 -8
- package/dist/mcp/protocol.js.map +1 -1
- package/dist/mcp/stdio.d.ts +1 -1
- package/dist/mcp/stdio.js +2 -2
- package/dist/mcp-servers.d.ts +2 -2
- package/dist/mcp-servers.js +2 -2
- package/dist/node-upgrade.d.ts +2 -2
- package/dist/node-upgrade.js +9 -9
- package/dist/notify/dispatch.d.ts +20 -0
- package/dist/notify/dispatch.d.ts.map +1 -0
- package/dist/notify/dispatch.js +52 -0
- package/dist/notify/dispatch.js.map +1 -0
- package/dist/notify/index.d.ts +39 -0
- package/dist/notify/index.d.ts.map +1 -0
- package/dist/notify/index.js +119 -0
- package/dist/notify/index.js.map +1 -0
- package/dist/notify/sender.d.ts +56 -0
- package/dist/notify/sender.d.ts.map +1 -0
- package/dist/notify/sender.js +139 -0
- package/dist/notify/sender.js.map +1 -0
- package/dist/notify/templates.d.ts +33 -0
- package/dist/notify/templates.d.ts.map +1 -0
- package/dist/notify/templates.js +119 -0
- package/dist/notify/templates.js.map +1 -0
- package/dist/offline-evaluate.d.ts +2 -2
- package/dist/offline-evaluate.js +3 -3
- package/dist/orr/agentshield.d.ts +2 -2
- package/dist/orr/agentshield.js +4 -4
- package/dist/orr/scorecard.d.ts +1 -1
- package/dist/orr/scorecard.js +3 -3
- package/dist/otel/exporter.d.ts +64 -0
- package/dist/otel/exporter.d.ts.map +1 -0
- package/dist/otel/exporter.js +243 -0
- package/dist/otel/exporter.js.map +1 -0
- package/dist/parse-args.d.ts +1 -1
- package/dist/parse-args.js +1 -1
- package/dist/receipt/auto-open.d.ts +1 -1
- package/dist/receipt/auto-open.js +1 -1
- package/dist/receipt/daemon.d.ts +6 -6
- package/dist/receipt/daemon.js +15 -15
- package/dist/receipt/dashboard.d.ts +1 -1
- package/dist/receipt/dashboard.js +2 -2
- package/dist/receipt/embeddings.d.ts +15 -4
- package/dist/receipt/embeddings.d.ts.map +1 -1
- package/dist/receipt/embeddings.js +116 -35
- package/dist/receipt/embeddings.js.map +1 -1
- package/dist/receipt/enrich.d.ts +2 -2
- package/dist/receipt/enrich.js +5 -5
- package/dist/receipt/gate-card.d.ts +2 -2
- package/dist/receipt/gate-card.d.ts.map +1 -1
- package/dist/receipt/gate-card.js +3 -3
- package/dist/receipt/live-server.d.ts.map +1 -1
- package/dist/receipt/live-server.js +22 -8
- package/dist/receipt/live-server.js.map +1 -1
- package/dist/receipt/receipt-css.d.ts +1 -1
- package/dist/receipt/receipt-css.d.ts.map +1 -1
- package/dist/receipt/receipt-css.js +72 -11
- package/dist/receipt/receipt-css.js.map +1 -1
- package/dist/receipt/render-receipt.d.ts +1 -1
- package/dist/receipt/render-receipt.d.ts.map +1 -1
- package/dist/receipt/render-receipt.js +138 -87
- package/dist/receipt/render-receipt.js.map +1 -1
- package/dist/receipt/share.d.ts +2 -2
- package/dist/receipt/share.js +5 -5
- package/dist/sample-tools.d.ts +1 -1
- package/dist/sample-tools.js +1 -1
- package/dist/sandbox/mock-driver.d.ts +1 -1
- package/dist/sandbox/mock-driver.js +1 -1
- package/dist/sdk/a2a.d.ts +2 -2
- package/dist/sdk/a2a.js +1 -1
- package/dist/sdk/adapters/claude-agent.d.ts +1 -1
- package/dist/sdk/adapters/claude-agent.js +1 -1
- package/dist/sdk/adapters/langgraph.d.ts +1 -1
- package/dist/sdk/adapters/langgraph.js +1 -1
- package/dist/sdk/adapters/mastra.d.ts +1 -1
- package/dist/sdk/adapters/mastra.js +1 -1
- package/dist/sdk/adapters/openai-agents.d.ts +1 -1
- package/dist/sdk/adapters/openai-agents.js +1 -1
- package/dist/sdk/adapters/vercel-ai.d.ts +2 -2
- package/dist/sdk/adapters/vercel-ai.js +1 -1
- package/dist/sdk/govern.d.ts +2 -2
- package/dist/sdk/govern.js +3 -3
- package/dist/sdk/index.d.ts +1 -1
- package/dist/sdk/index.js +1 -1
- package/dist/showback/trail-usage.d.ts +30 -0
- package/dist/showback/trail-usage.d.ts.map +1 -0
- package/dist/showback/trail-usage.js +50 -0
- package/dist/showback/trail-usage.js.map +1 -0
- package/dist/sign/evidence-bundle.d.ts +6 -6
- package/dist/sign/evidence-bundle.js +5 -5
- package/dist/star-cta.d.ts +1 -1
- package/dist/star-cta.d.ts.map +1 -1
- package/dist/star-cta.js +3 -3
- package/dist/trail-summary.d.ts +1 -1
- package/dist/trail-summary.js +3 -3
- package/dist/trail.d.ts +8 -2
- package/dist/trail.d.ts.map +1 -1
- package/dist/trail.js +18 -5
- package/dist/trail.js.map +1 -1
- package/dist/update-check.d.ts +17 -0
- package/dist/update-check.d.ts.map +1 -0
- package/dist/update-check.js +134 -0
- package/dist/update-check.js.map +1 -0
- package/droid/README.md +1 -1
- package/droid/mcp.example.json +1 -1
- package/gemini/settings.example.json +1 -1
- package/grok/README.md +1 -1
- package/kilo/kilo.example.json +1 -1
- package/kimi/mcp.example.json +1 -1
- package/kiro/mcp.example.json +1 -1
- package/manifest.json +1 -1
- package/mastracode/mcp.example.json +1 -1
- package/mcp.json +1 -1
- package/openai/codex.config.example.toml +1 -1
- package/opencode/opencode.example.json +1 -1
- package/package.json +2 -2
- package/qwen/settings.example.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook delivery for trail verdicts. Reliability contract (a notify failure must never change
|
|
3
|
+
* what the gate does with the tool call itself):
|
|
4
|
+
*
|
|
5
|
+
* - up to 3 retries after the first attempt, backoff 250ms / 1s / 4s with up to +25% jitter;
|
|
6
|
+
* - per-attempt timeout (default 3s) via AbortController;
|
|
7
|
+
* - process-wide rate limit: max 20 sends per rolling minute, overflow counted and dropped;
|
|
8
|
+
* - per-URL circuit breaker: 5 consecutive failed deliveries open the circuit for 5 minutes,
|
|
9
|
+
* while open the URL gets nothing (drops counted separately);
|
|
10
|
+
* - nothing in this module throws.
|
|
11
|
+
*/
|
|
12
|
+
export type NotifyFetchLike = (input: string, init?: RequestInit) => Promise<Pick<Response, "ok" | "status">>;
|
|
13
|
+
export interface NotifyDeps {
|
|
14
|
+
readonly fetchImpl?: NotifyFetchLike;
|
|
15
|
+
/** Test seam: replaces the backoff wait. */
|
|
16
|
+
readonly sleep?: (ms: number) => Promise<void>;
|
|
17
|
+
/** Test seam: jitter source, defaults to Math.random. */
|
|
18
|
+
readonly random?: () => number;
|
|
19
|
+
/** Test seam: clock for the rate window and circuit breaker. */
|
|
20
|
+
readonly nowMs?: () => number;
|
|
21
|
+
}
|
|
22
|
+
export interface SendOptions {
|
|
23
|
+
readonly url: string;
|
|
24
|
+
readonly body: string;
|
|
25
|
+
readonly headers?: Record<string, string>;
|
|
26
|
+
readonly timeoutMs?: number;
|
|
27
|
+
/** Test seam: replaces RETRY_DELAYS_MS. */
|
|
28
|
+
readonly retryDelaysMs?: readonly number[];
|
|
29
|
+
}
|
|
30
|
+
export declare const DEFAULT_TIMEOUT_MS = 3000;
|
|
31
|
+
/** Wait before retry attempts 1..3 (the first send is immediate, so 4 sends worst case). */
|
|
32
|
+
export declare const RETRY_DELAYS_MS: readonly number[];
|
|
33
|
+
export declare const JITTER_RATIO = 0.25;
|
|
34
|
+
export declare const RATE_LIMIT_MAX_SENDS = 20;
|
|
35
|
+
export declare const RATE_LIMIT_WINDOW_MS = 60000;
|
|
36
|
+
export declare const CIRCUIT_FAILURES_TO_OPEN = 5;
|
|
37
|
+
export declare const CIRCUIT_OPEN_MS: number;
|
|
38
|
+
/** Snapshot of drop counters, for `kya` diagnostics and tests. */
|
|
39
|
+
export declare function notifyStats(): {
|
|
40
|
+
droppedByRateLimit: number;
|
|
41
|
+
droppedByCircuitOpen: number;
|
|
42
|
+
};
|
|
43
|
+
/** Test helper: clears the rate window, the drop counters and every circuit. */
|
|
44
|
+
export declare function resetNotifyState(): void;
|
|
45
|
+
/** Single attempt. ok only on a 2xx; timeout, abort, redirect and network errors are all false. */
|
|
46
|
+
export declare function postWebhook(url: string, body: string, opts?: {
|
|
47
|
+
headers?: Record<string, string>;
|
|
48
|
+
timeoutMs?: number;
|
|
49
|
+
}, fetchImpl?: NotifyFetchLike): Promise<boolean>;
|
|
50
|
+
/**
|
|
51
|
+
* Deliver one serialized payload with retries. Returns whether it was delivered (or at least
|
|
52
|
+
* accepted by the receiver). Rate-limited attempts drop the whole delivery without counting as a
|
|
53
|
+
* receiver failure; an exhausted retry sequence feeds the circuit breaker. Never throws.
|
|
54
|
+
*/
|
|
55
|
+
export declare function sendWithRetry(opts: SendOptions, deps?: NotifyDeps): Promise<boolean>;
|
|
56
|
+
//# sourceMappingURL=sender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender.d.ts","sourceRoot":"","sources":["../../src/notify/sender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,eAAe,GAAG,CAC5B,KAAK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,gBAAgB,IAAI,IAAI,CAKvC;AA4CD,mGAAmG;AACnG,wBAAsB,WAAW,CAC/B,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,EACZ,IAAI,GAAE;IAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAAC,SAAS,CAAC,EAAE,MAAM,CAAA;CAAO,EACnE,SAAS,GAAE,eAAuB,GACjC,OAAO,CAAC,OAAO,CAAC,CAyBlB;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,GAAE,UAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CAkC9F"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Webhook delivery for trail verdicts. Reliability contract (a notify failure must never change
|
|
3
|
+
* what the gate does with the tool call itself):
|
|
4
|
+
*
|
|
5
|
+
* - up to 3 retries after the first attempt, backoff 250ms / 1s / 4s with up to +25% jitter;
|
|
6
|
+
* - per-attempt timeout (default 3s) via AbortController;
|
|
7
|
+
* - process-wide rate limit: max 20 sends per rolling minute, overflow counted and dropped;
|
|
8
|
+
* - per-URL circuit breaker: 5 consecutive failed deliveries open the circuit for 5 minutes,
|
|
9
|
+
* while open the URL gets nothing (drops counted separately);
|
|
10
|
+
* - nothing in this module throws.
|
|
11
|
+
*/
|
|
12
|
+
export const DEFAULT_TIMEOUT_MS = 3_000;
|
|
13
|
+
/** Wait before retry attempts 1..3 (the first send is immediate, so 4 sends worst case). */
|
|
14
|
+
export const RETRY_DELAYS_MS = [250, 1_000, 4_000];
|
|
15
|
+
export const JITTER_RATIO = 0.25;
|
|
16
|
+
export const RATE_LIMIT_MAX_SENDS = 20;
|
|
17
|
+
export const RATE_LIMIT_WINDOW_MS = 60_000;
|
|
18
|
+
export const CIRCUIT_FAILURES_TO_OPEN = 5;
|
|
19
|
+
export const CIRCUIT_OPEN_MS = 5 * 60_000;
|
|
20
|
+
// Process-wide state: the hook path is spawn-per-tool-call in some hosts, but long-lived MCP /
|
|
21
|
+
// gateway processes share one limiter so a flood of denies cannot hammer a receiver.
|
|
22
|
+
const sendTimestamps = [];
|
|
23
|
+
let droppedByRateLimit = 0;
|
|
24
|
+
let droppedByCircuitOpen = 0;
|
|
25
|
+
const circuits = new Map();
|
|
26
|
+
/** Snapshot of drop counters, for `kya` diagnostics and tests. */
|
|
27
|
+
export function notifyStats() {
|
|
28
|
+
return { droppedByRateLimit, droppedByCircuitOpen };
|
|
29
|
+
}
|
|
30
|
+
/** Test helper: clears the rate window, the drop counters and every circuit. */
|
|
31
|
+
export function resetNotifyState() {
|
|
32
|
+
sendTimestamps.length = 0;
|
|
33
|
+
droppedByRateLimit = 0;
|
|
34
|
+
droppedByCircuitOpen = 0;
|
|
35
|
+
circuits.clear();
|
|
36
|
+
}
|
|
37
|
+
/** One POST against the rolling-minute quota. False (and counted) when the window is full. */
|
|
38
|
+
function consumeSendQuota(nowMs) {
|
|
39
|
+
while (sendTimestamps.length > 0 && nowMs - (sendTimestamps[0] ?? 0) >= RATE_LIMIT_WINDOW_MS) {
|
|
40
|
+
sendTimestamps.shift();
|
|
41
|
+
}
|
|
42
|
+
if (sendTimestamps.length >= RATE_LIMIT_MAX_SENDS) {
|
|
43
|
+
droppedByRateLimit += 1;
|
|
44
|
+
return false;
|
|
45
|
+
}
|
|
46
|
+
sendTimestamps.push(nowMs);
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function circuitOpen(url, nowMs) {
|
|
50
|
+
const state = circuits.get(url);
|
|
51
|
+
if (state === undefined)
|
|
52
|
+
return false;
|
|
53
|
+
if (state.openUntil > nowMs)
|
|
54
|
+
return true;
|
|
55
|
+
if (state.failures >= CIRCUIT_FAILURES_TO_OPEN) {
|
|
56
|
+
// Cooldown elapsed: half-open, the next delivery decides.
|
|
57
|
+
state.failures = 0;
|
|
58
|
+
state.openUntil = 0;
|
|
59
|
+
}
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
function recordDeliverySuccess(url) {
|
|
63
|
+
circuits.delete(url);
|
|
64
|
+
}
|
|
65
|
+
function recordDeliveryFailure(url, nowMs) {
|
|
66
|
+
const state = circuits.get(url) ?? { failures: 0, openUntil: 0 };
|
|
67
|
+
state.failures += 1;
|
|
68
|
+
if (state.failures >= CIRCUIT_FAILURES_TO_OPEN) {
|
|
69
|
+
state.openUntil = nowMs + CIRCUIT_OPEN_MS;
|
|
70
|
+
}
|
|
71
|
+
circuits.set(url, state);
|
|
72
|
+
}
|
|
73
|
+
function backoffWithJitter(baseMs, random) {
|
|
74
|
+
return baseMs + Math.floor(baseMs * JITTER_RATIO * random());
|
|
75
|
+
}
|
|
76
|
+
/** Single attempt. ok only on a 2xx; timeout, abort, redirect and network errors are all false. */
|
|
77
|
+
export async function postWebhook(url, body, opts = {}, fetchImpl = fetch) {
|
|
78
|
+
const controller = new AbortController();
|
|
79
|
+
const timeoutMs = opts.timeoutMs !== undefined && Number.isFinite(opts.timeoutMs) && opts.timeoutMs > 0
|
|
80
|
+
? opts.timeoutMs
|
|
81
|
+
: DEFAULT_TIMEOUT_MS;
|
|
82
|
+
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
83
|
+
try {
|
|
84
|
+
const res = await fetchImpl(url, {
|
|
85
|
+
method: "POST",
|
|
86
|
+
headers: {
|
|
87
|
+
"content-type": "application/json",
|
|
88
|
+
"user-agent": "shield-agent-kya-cli/notify",
|
|
89
|
+
...opts.headers,
|
|
90
|
+
},
|
|
91
|
+
body,
|
|
92
|
+
redirect: "error",
|
|
93
|
+
signal: controller.signal,
|
|
94
|
+
});
|
|
95
|
+
return res.ok;
|
|
96
|
+
}
|
|
97
|
+
catch {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
finally {
|
|
101
|
+
clearTimeout(timer);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Deliver one serialized payload with retries. Returns whether it was delivered (or at least
|
|
106
|
+
* accepted by the receiver). Rate-limited attempts drop the whole delivery without counting as a
|
|
107
|
+
* receiver failure; an exhausted retry sequence feeds the circuit breaker. Never throws.
|
|
108
|
+
*/
|
|
109
|
+
export async function sendWithRetry(opts, deps = {}) {
|
|
110
|
+
try {
|
|
111
|
+
const nowMs = deps.nowMs ?? Date.now;
|
|
112
|
+
const sleep = deps.sleep ?? ((ms) => new Promise((r) => setTimeout(r, ms)));
|
|
113
|
+
const random = deps.random ?? Math.random;
|
|
114
|
+
const fetchImpl = deps.fetchImpl ?? fetch;
|
|
115
|
+
const delays = opts.retryDelaysMs ?? RETRY_DELAYS_MS;
|
|
116
|
+
if (circuitOpen(opts.url, nowMs())) {
|
|
117
|
+
droppedByCircuitOpen += 1;
|
|
118
|
+
return false;
|
|
119
|
+
}
|
|
120
|
+
for (let attempt = 0; attempt <= delays.length; attempt++) {
|
|
121
|
+
if (attempt > 0) {
|
|
122
|
+
await sleep(backoffWithJitter(delays[attempt - 1] ?? 0, random));
|
|
123
|
+
}
|
|
124
|
+
if (!consumeSendQuota(nowMs()))
|
|
125
|
+
return false;
|
|
126
|
+
const ok = await postWebhook(opts.url, opts.body, { headers: opts.headers, timeoutMs: opts.timeoutMs }, fetchImpl);
|
|
127
|
+
if (ok) {
|
|
128
|
+
recordDeliverySuccess(opts.url);
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
recordDeliveryFailure(opts.url, nowMs());
|
|
133
|
+
return false;
|
|
134
|
+
}
|
|
135
|
+
catch {
|
|
136
|
+
return false;
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=sender.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sender.js","sourceRoot":"","sources":["../../src/notify/sender.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AA0BH,MAAM,CAAC,MAAM,kBAAkB,GAAG,KAAK,CAAC;AACxC,4FAA4F;AAC5F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ail verdict notifications (slack / linear / jira / generic).
|
|
3
|
+
* Every builder works from the already-redacted trail fields only - raw tool args and diff content
|
|
4
|
+
* never reach this module, and the allow-list below is the complete set of fields a payload may carry.
|
|
5
|
+
*/
|
|
6
|
+
import type { TrailEvent } from "../trail.js";
|
|
7
|
+
export type NotifyTemplate = "slack" | "linear" | "jira" | "generic";
|
|
8
|
+
export declare const NOTIFY_TEMPLATES: readonly NotifyTemplate[];
|
|
9
|
+
/** `kind` marker on the generic payload so receivers can route without inspecting fields. */
|
|
10
|
+
export declare const NOTIFY_KIND = "kya.trail.verdict";
|
|
11
|
+
/**
|
|
12
|
+
* The ONLY trail fields a payload may carry: ts, sessionId, toolId, verdict, reasonCode, mode,
|
|
13
|
+
* plus the optional redacted/host fields when present. argsHash, diffPreview and neverEvent are
|
|
14
|
+
* excluded by omission; the trail never holds raw args at all.
|
|
15
|
+
*/
|
|
16
|
+
export declare function allowedEventFields(event: TrailEvent): Record<string, string>;
|
|
17
|
+
/** One-line headline shared by every template, e.g. "KYA DENY: shell.exec (NEVER_COMMAND)". */
|
|
18
|
+
export declare function headline(event: TrailEvent): string;
|
|
19
|
+
/** Slack incoming-webhook shape: top-level text fallback plus Block Kit blocks. */
|
|
20
|
+
export declare function buildSlackPayload(event: TrailEvent): Record<string, unknown>;
|
|
21
|
+
/** Linear create-issue-shaped body (title / description / priority). DENY is urgent. */
|
|
22
|
+
export declare function buildLinearPayload(event: TrailEvent): Record<string, unknown>;
|
|
23
|
+
/** Jira create-issue-shaped body (fields.summary / fields.description / issuetype). */
|
|
24
|
+
export declare function buildJiraPayload(event: TrailEvent): Record<string, unknown>;
|
|
25
|
+
/** Generic: the allow-listed event fields plus a routing kind. */
|
|
26
|
+
export declare function buildGenericPayload(event: TrailEvent): Record<string, unknown>;
|
|
27
|
+
export declare function buildPayload(template: NotifyTemplate, event: TrailEvent): Record<string, unknown>;
|
|
28
|
+
/**
|
|
29
|
+
* Last-resort body when assertNoSecrets rejects the full payload: four fields only, no free text
|
|
30
|
+
* (summary / targetPath are the fields that could carry a leaked secret).
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildMinimizedPayload(event: TrailEvent): Record<string, unknown>;
|
|
33
|
+
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/notify/templates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,SAAS,CAAC;AAErE,eAAO,MAAM,gBAAgB,EAAE,SAAS,cAAc,EAA2C,CAAC;AAElG,6FAA6F;AAC7F,eAAO,MAAM,WAAW,sBAAsB,CAAC;AAE/C;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAgB5E;AAED,+FAA+F;AAC/F,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAElD;AAmBD,mFAAmF;AACnF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAe5E;AAED,wFAAwF;AACxF,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAM7E;AAED,uFAAuF;AACvF,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQ3E;AAED,kEAAkE;AAClE,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAE9E;AAED,wBAAgB,YAAY,CAAC,QAAQ,EAAE,cAAc,EAAE,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAWjG;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAOhF"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export const NOTIFY_TEMPLATES = ["slack", "linear", "jira", "generic"];
|
|
2
|
+
/** `kind` marker on the generic payload so receivers can route without inspecting fields. */
|
|
3
|
+
export const NOTIFY_KIND = "kya.trail.verdict";
|
|
4
|
+
/**
|
|
5
|
+
* The ONLY trail fields a payload may carry: ts, sessionId, toolId, verdict, reasonCode, mode,
|
|
6
|
+
* plus the optional redacted/host fields when present. argsHash, diffPreview and neverEvent are
|
|
7
|
+
* excluded by omission; the trail never holds raw args at all.
|
|
8
|
+
*/
|
|
9
|
+
export function allowedEventFields(event) {
|
|
10
|
+
const out = {
|
|
11
|
+
ts: event.ts,
|
|
12
|
+
sessionId: event.sessionId,
|
|
13
|
+
toolId: event.toolId,
|
|
14
|
+
verdict: event.verdict,
|
|
15
|
+
reasonCode: event.reasonCode,
|
|
16
|
+
mode: event.mode,
|
|
17
|
+
};
|
|
18
|
+
if (event.host !== undefined)
|
|
19
|
+
out["host"] = event.host;
|
|
20
|
+
if (event.product !== undefined)
|
|
21
|
+
out["product"] = event.product;
|
|
22
|
+
if (event.project !== undefined)
|
|
23
|
+
out["project"] = event.project;
|
|
24
|
+
if (event.packId !== undefined)
|
|
25
|
+
out["packId"] = event.packId;
|
|
26
|
+
if (event.summary !== undefined)
|
|
27
|
+
out["summary"] = event.summary;
|
|
28
|
+
if (event.targetPath !== undefined)
|
|
29
|
+
out["targetPath"] = event.targetPath;
|
|
30
|
+
return out;
|
|
31
|
+
}
|
|
32
|
+
/** One-line headline shared by every template, e.g. "KYA DENY: shell.exec (NEVER_COMMAND)". */
|
|
33
|
+
export function headline(event) {
|
|
34
|
+
return `KYA ${event.verdict}: ${event.toolId} (${event.reasonCode})`;
|
|
35
|
+
}
|
|
36
|
+
function descriptionLines(event) {
|
|
37
|
+
const f = allowedEventFields(event);
|
|
38
|
+
const lines = [
|
|
39
|
+
`verdict: ${f["verdict"]}`,
|
|
40
|
+
`tool: ${f["toolId"]}`,
|
|
41
|
+
`reason: ${f["reasonCode"]}`,
|
|
42
|
+
`mode: ${f["mode"]}`,
|
|
43
|
+
`session: ${f["sessionId"]}`,
|
|
44
|
+
`ts: ${f["ts"]}`,
|
|
45
|
+
];
|
|
46
|
+
if (f["product"] !== undefined)
|
|
47
|
+
lines.push(`product: ${f["product"]}`);
|
|
48
|
+
if (f["host"] !== undefined)
|
|
49
|
+
lines.push(`host: ${f["host"]}`);
|
|
50
|
+
if (f["targetPath"] !== undefined)
|
|
51
|
+
lines.push(`target: ${f["targetPath"]}`);
|
|
52
|
+
if (f["summary"] !== undefined)
|
|
53
|
+
lines.push(`summary: ${f["summary"]}`);
|
|
54
|
+
return lines;
|
|
55
|
+
}
|
|
56
|
+
/** Slack incoming-webhook shape: top-level text fallback plus Block Kit blocks. */
|
|
57
|
+
export function buildSlackPayload(event) {
|
|
58
|
+
const f = allowedEventFields(event);
|
|
59
|
+
const fields = ["toolId", "reasonCode", "mode", "sessionId", "ts"]
|
|
60
|
+
.map((k) => ({ type: "mrkdwn", text: `*${k}*\n${f[k]}` }));
|
|
61
|
+
if (f["targetPath"] !== undefined) {
|
|
62
|
+
fields.push({ type: "mrkdwn", text: `*target*\n${f["targetPath"]}` });
|
|
63
|
+
}
|
|
64
|
+
const blocks = [
|
|
65
|
+
{ type: "header", text: { type: "plain_text", text: `KYA verdict: ${event.verdict}` } },
|
|
66
|
+
{ type: "section", fields },
|
|
67
|
+
];
|
|
68
|
+
if (f["summary"] !== undefined) {
|
|
69
|
+
blocks.push({ type: "section", text: { type: "mrkdwn", text: f["summary"] } });
|
|
70
|
+
}
|
|
71
|
+
return { text: headline(event), blocks };
|
|
72
|
+
}
|
|
73
|
+
/** Linear create-issue-shaped body (title / description / priority). DENY is urgent. */
|
|
74
|
+
export function buildLinearPayload(event) {
|
|
75
|
+
return {
|
|
76
|
+
title: headline(event),
|
|
77
|
+
description: descriptionLines(event).join("\n"),
|
|
78
|
+
priority: event.verdict === "DENY" ? 1 : 2,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/** Jira create-issue-shaped body (fields.summary / fields.description / issuetype). */
|
|
82
|
+
export function buildJiraPayload(event) {
|
|
83
|
+
return {
|
|
84
|
+
fields: {
|
|
85
|
+
summary: headline(event),
|
|
86
|
+
description: descriptionLines(event).join("\n"),
|
|
87
|
+
issuetype: { name: "Task" },
|
|
88
|
+
},
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/** Generic: the allow-listed event fields plus a routing kind. */
|
|
92
|
+
export function buildGenericPayload(event) {
|
|
93
|
+
return { kind: NOTIFY_KIND, event: allowedEventFields(event) };
|
|
94
|
+
}
|
|
95
|
+
export function buildPayload(template, event) {
|
|
96
|
+
switch (template) {
|
|
97
|
+
case "slack":
|
|
98
|
+
return buildSlackPayload(event);
|
|
99
|
+
case "linear":
|
|
100
|
+
return buildLinearPayload(event);
|
|
101
|
+
case "jira":
|
|
102
|
+
return buildJiraPayload(event);
|
|
103
|
+
default:
|
|
104
|
+
return buildGenericPayload(event);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Last-resort body when assertNoSecrets rejects the full payload: four fields only, no free text
|
|
109
|
+
* (summary / targetPath are the fields that could carry a leaked secret).
|
|
110
|
+
*/
|
|
111
|
+
export function buildMinimizedPayload(event) {
|
|
112
|
+
return {
|
|
113
|
+
toolId: event.toolId,
|
|
114
|
+
verdict: event.verdict,
|
|
115
|
+
reasonCode: event.reasonCode,
|
|
116
|
+
ts: event.ts,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=templates.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/notify/templates.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AAC,KAAiB;IAChD,OAAO;QACL,MAAM,EAAE;YACN,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;YACxB,WAAW,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;YAC/C,SAAS,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE;SAC5B;KACF,CAAC;AACJ,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,mBAAmB,CAAC,KAAiB;IACnD,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,kBAAkB,CAAC,KAAK,CAAC,EAAE,CAAC;AACjE,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,QAAwB,EAAE,KAAiB;IACtE,QAAQ,QAAQ,EAAE,CAAC;QACjB,KAAK,OAAO;YACV,OAAO,iBAAiB,CAAC,KAAK,CAAC,CAAC;QAClC,KAAK,QAAQ;YACX,OAAO,kBAAkB,CAAC,KAAK,CAAC,CAAC;QACnC,KAAK,MAAM;YACT,OAAO,gBAAgB,CAAC,KAAK,CAAC,CAAC;QACjC;YACE,OAAO,mBAAmB,CAAC,KAAK,CAAC,CAAC;IACtC,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CAAC,KAAiB;IACrD,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,OAAO,EAAE,KAAK,CAAC,OAAO;QACtB,UAAU,EAAE,KAAK,CAAC,UAAU;QAC5B,EAAE,EAAE,KAAK,CAAC,EAAE;KACb,CAAC;AACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Offline sample policy evaluate for light-install demos.
|
|
3
|
-
* Not a second production PEP
|
|
3
|
+
* Not a second production PEP - production injects HTTP evaluate against Shield.
|
|
4
4
|
* Same sample tools as docs/dev/kya-custom-tools-sample.md (R8: packs off),
|
|
5
5
|
* plus the well-known host tool vocabulary in host-tools.ts.
|
|
6
6
|
*/
|
|
@@ -17,7 +17,7 @@ export declare function applySessionRisk(base: {
|
|
|
17
17
|
reasonCode: string;
|
|
18
18
|
};
|
|
19
19
|
/**
|
|
20
|
-
* Local fixture evaluate
|
|
20
|
+
* Local fixture evaluate - day-1 offline demo without paid cloud or full console.
|
|
21
21
|
* Doctrine: sole production PEP remains Shield HTTP; this is demo/CT only.
|
|
22
22
|
*/
|
|
23
23
|
export declare function evaluateOffline(req: PolicyEvaluateRequest, host?: Host): PolicyEvaluateResponse;
|
package/dist/offline-evaluate.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Offline sample policy evaluate for light-install demos.
|
|
3
|
-
* Not a second production PEP
|
|
3
|
+
* Not a second production PEP - production injects HTTP evaluate against Shield.
|
|
4
4
|
* Same sample tools as docs/dev/kya-custom-tools-sample.md (R8: packs off),
|
|
5
5
|
* plus the well-known host tool vocabulary in host-tools.ts.
|
|
6
6
|
*/
|
|
@@ -22,7 +22,7 @@ function baseTier(toolId, irreversible, actionClass) {
|
|
|
22
22
|
return { verdict: "ALLOW", reasonCode: "ALLOW" };
|
|
23
23
|
}
|
|
24
24
|
// Clearly destructive admin names on a KNOWN MCP server deny outright, even
|
|
25
|
-
// when the caller declared risk signals
|
|
25
|
+
// when the caller declared risk signals - mirroring sample-tool NEVER.
|
|
26
26
|
const mcp = parseMcpToolId(toolId);
|
|
27
27
|
if (mcp && /drop|truncate|purge|transfer/.test(mcp.tool)) {
|
|
28
28
|
return { verdict: "DENY", reasonCode: "NEVER_EVENT" };
|
|
@@ -79,7 +79,7 @@ export function applySessionRisk(base, risk) {
|
|
|
79
79
|
return base;
|
|
80
80
|
}
|
|
81
81
|
/**
|
|
82
|
-
* Local fixture evaluate
|
|
82
|
+
* Local fixture evaluate - day-1 offline demo without paid cloud or full console.
|
|
83
83
|
* Doctrine: sole production PEP remains Shield HTTP; this is demo/CT only.
|
|
84
84
|
*/
|
|
85
85
|
export function evaluateOffline(req, host = "ide") {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Optional ORR producer for affaan-m/agentshield (CLI `agentshield`).
|
|
3
|
-
* Evidence only
|
|
3
|
+
* Evidence only - never a PEP. Never `--fix`, never MiniClaw, never npx -y.
|
|
4
4
|
*/
|
|
5
5
|
import type { OrrCoverageGap, OrrFinding } from "../commands/orr.js";
|
|
6
6
|
export declare const AGENTSHIELD_PRODUCER_ID = "harness.agentshield";
|
|
@@ -23,7 +23,7 @@ export declare function buildAgentShieldArgv(absPath: string): {
|
|
|
23
23
|
};
|
|
24
24
|
export declare function redactEvidence(s: string): string;
|
|
25
25
|
export declare function looksLikeRealSecret(s: string): boolean;
|
|
26
|
-
/** Secrets category: judge evidence / fix.before only
|
|
26
|
+
/** Secrets category: judge evidence / fix.before only - never path/title text. */
|
|
27
27
|
export declare function secretsValueLooksReal(evidence: string, fixBefore: string): boolean;
|
|
28
28
|
export declare function mapAgentShieldFinding(raw: unknown): OrrFinding | null;
|
|
29
29
|
export declare function ingestAgentShieldReport(parsed: unknown): OrrFinding[];
|
package/dist/orr/agentshield.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Optional ORR producer for affaan-m/agentshield (CLI `agentshield`).
|
|
3
|
-
* Evidence only
|
|
3
|
+
* Evidence only - never a PEP. Never `--fix`, never MiniClaw, never npx -y.
|
|
4
4
|
*/
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
@@ -65,7 +65,7 @@ export function looksLikeRealSecret(s) {
|
|
|
65
65
|
return false;
|
|
66
66
|
return false;
|
|
67
67
|
}
|
|
68
|
-
/** Secrets category: judge evidence / fix.before only
|
|
68
|
+
/** Secrets category: judge evidence / fix.before only - never path/title text. */
|
|
69
69
|
export function secretsValueLooksReal(evidence, fixBefore) {
|
|
70
70
|
const value = [evidence, fixBefore].filter(Boolean).join("\n");
|
|
71
71
|
if (!value.trim())
|
|
@@ -120,7 +120,7 @@ export function ingestAgentShieldReport(parsed) {
|
|
|
120
120
|
category: "engineering_craft",
|
|
121
121
|
severity: "info",
|
|
122
122
|
title: "AgentShield report ingested as evidence",
|
|
123
|
-
detail: `${mapped.length} finding(s) mapped. Evidence only
|
|
123
|
+
detail: `${mapped.length} finding(s) mapped. Evidence only - not a PEP.`,
|
|
124
124
|
evidence: "harness.agentshield JSON ingest",
|
|
125
125
|
source_tool: AGENTSHIELD_PRODUCER_ID,
|
|
126
126
|
},
|
|
@@ -136,7 +136,7 @@ export function readAgentShieldJson(path) {
|
|
|
136
136
|
category: "engineering_craft",
|
|
137
137
|
severity: "info",
|
|
138
138
|
title: "AgentShield JSON not found",
|
|
139
|
-
detail: `${path} was requested as an optional producer. Evidence only
|
|
139
|
+
detail: `${path} was requested as an optional producer. Evidence only - not a PEP.`,
|
|
140
140
|
evidence: abs,
|
|
141
141
|
source_tool: AGENTSHIELD_PRODUCER_ID,
|
|
142
142
|
},
|
package/dist/orr/scorecard.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Optional ORR producer for OpenSSF Scorecard (CLI `scorecard`).
|
|
3
|
-
* Evidence only
|
|
3
|
+
* Evidence only - never a PEP. Never --fix, never npx -y.
|
|
4
4
|
*/
|
|
5
5
|
import type { OrrCoverageGap, OrrFinding } from "../commands/orr.js";
|
|
6
6
|
export declare const SCORECARD_PRODUCER_ID = "openssf.scorecard";
|
package/dist/orr/scorecard.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Optional ORR producer for OpenSSF Scorecard (CLI `scorecard`).
|
|
3
|
-
* Evidence only
|
|
3
|
+
* Evidence only - never a PEP. Never --fix, never npx -y.
|
|
4
4
|
*/
|
|
5
5
|
import { spawnSync } from "node:child_process";
|
|
6
6
|
export const SCORECARD_PRODUCER_ID = "openssf.scorecard";
|
|
@@ -24,7 +24,7 @@ export function ingestScorecardJson(parsed, evidencePath) {
|
|
|
24
24
|
title: "Scorecard ingested as evidence",
|
|
25
25
|
detail: score === undefined
|
|
26
26
|
? "Scorecard dump loaded. Does not ALLOW side effects."
|
|
27
|
-
: `Scorecard score=${score} (evidence only
|
|
27
|
+
: `Scorecard score=${score} (evidence only - not a PEP).`,
|
|
28
28
|
evidence: evidencePath,
|
|
29
29
|
source_tool: SCORECARD_PRODUCER_ID,
|
|
30
30
|
},
|
|
@@ -40,7 +40,7 @@ export function ingestScorecardJson(parsed, evidencePath) {
|
|
|
40
40
|
category: "enterprise_readiness",
|
|
41
41
|
severity: "info",
|
|
42
42
|
title: `Scorecard ${name}`,
|
|
43
|
-
detail: `score=${String(checkScore ?? "n/a")}
|
|
43
|
+
detail: `score=${String(checkScore ?? "n/a")} - evidence only`,
|
|
44
44
|
evidence: evidencePath,
|
|
45
45
|
source_tool: SCORECARD_PRODUCER_ID,
|
|
46
46
|
});
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Best-effort OTLP/HTTP export of KYA verdicts as GenAI spans. Opt-in:
|
|
3
|
+
* disabled unless an endpoint is configured (env KYA_OTLP_EXPORT_ENDPOINT or
|
|
4
|
+
* "otlpExport" in .kya/config.json). Fire-and-forget: export NEVER blocks,
|
|
5
|
+
* delays, or changes a verdict. Every failure is swallowed and counted
|
|
6
|
+
* in-memory for a future status surface.
|
|
7
|
+
*
|
|
8
|
+
* Privacy: only verdict metadata ships (tool id, verdict, reason code, mode,
|
|
9
|
+
* host, session id, token counts when known). Tool args, prompts, approval
|
|
10
|
+
* bodies, and API keys are never exported - same rule as docs/otlp.md.
|
|
11
|
+
*
|
|
12
|
+
* No new dependencies: one hand-built OTLP/JSON payload and the global fetch.
|
|
13
|
+
*/
|
|
14
|
+
export interface OtlpExportConfig {
|
|
15
|
+
/** Base OTLP/HTTP endpoint, e.g. http://127.0.0.1:4318 ("/v1/traces" appended). */
|
|
16
|
+
readonly endpoint: string;
|
|
17
|
+
/** Extra headers (auth tokens live here or on the Collector, never in code). */
|
|
18
|
+
readonly headers?: Readonly<Record<string, string>>;
|
|
19
|
+
/** Permit plaintext http to a non-loopback host. Default false. */
|
|
20
|
+
readonly insecure?: boolean;
|
|
21
|
+
}
|
|
22
|
+
export interface VerdictEvent {
|
|
23
|
+
readonly ts?: string;
|
|
24
|
+
readonly sessionId: string;
|
|
25
|
+
readonly toolId: string;
|
|
26
|
+
readonly verdict: string;
|
|
27
|
+
readonly reasonCode: string;
|
|
28
|
+
readonly mode: string;
|
|
29
|
+
readonly host?: string;
|
|
30
|
+
/** GenAI usage, when the caller knows it. */
|
|
31
|
+
readonly tokensIn?: number;
|
|
32
|
+
readonly tokensOut?: number;
|
|
33
|
+
}
|
|
34
|
+
/** In-memory counters for a future status command; process-local only. */
|
|
35
|
+
export declare function otlpExportStats(): {
|
|
36
|
+
attempted: number;
|
|
37
|
+
exported: number;
|
|
38
|
+
failed: number;
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* Resolve export config from env > parsed .kya/config.json. Accepts the parsed
|
|
42
|
+
* config object so callers that already read the file (resolveConfig) need no
|
|
43
|
+
* config.ts change. Returns undefined when disabled (no endpoint anywhere).
|
|
44
|
+
*/
|
|
45
|
+
export declare function resolveOtlpExportConfig(env?: NodeJS.ProcessEnv, configJson?: unknown): OtlpExportConfig | undefined;
|
|
46
|
+
/** One OTLP/JSON ExportTraceServiceRequest carrying exactly one verdict span. */
|
|
47
|
+
export declare function buildVerdictTracePayload(event: VerdictEvent): unknown;
|
|
48
|
+
/**
|
|
49
|
+
* Export one verdict span. Never throws, never blocks the caller beyond the
|
|
50
|
+
* 2s timeout budget, and never touches the verdict itself. No-op when the
|
|
51
|
+
* config is undefined (unconfigured) or the endpoint fails the scheme check.
|
|
52
|
+
*/
|
|
53
|
+
export declare function exportVerdictSpan(event: VerdictEvent, config: OtlpExportConfig | undefined): Promise<void>;
|
|
54
|
+
export interface OtlpExportSelfTestResult {
|
|
55
|
+
readonly ok: boolean;
|
|
56
|
+
readonly detail: string;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* CLI-invocable self-test: POST one synthetic span and report the outcome.
|
|
60
|
+
* Unlike exportVerdictSpan it reports failure detail instead of only counting
|
|
61
|
+
* it - still never throws.
|
|
62
|
+
*/
|
|
63
|
+
export declare function otlpExportSelfTest(config: OtlpExportConfig | undefined): Promise<OtlpExportSelfTestResult>;
|
|
64
|
+
//# sourceMappingURL=exporter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"exporter.d.ts","sourceRoot":"","sources":["../../src/otel/exporter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AASH,MAAM,WAAW,gBAAgB;IAC/B,mFAAmF;IACnF,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,gFAAgF;IAChF,QAAQ,CAAC,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACpD,mEAAmE;IACnE,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,EAAE,CAAC,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,6CAA6C;IAC7C,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC7B;AAUD,0EAA0E;AAC1E,wBAAgB,eAAe,IAAI;IAAE,SAAS,E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