@shield-agent/kya 0.21.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/LIMITATIONS.md +1 -0
- package/README.md +90 -31
- 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 +4 -2
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +110 -37
- 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.d.ts.map +1 -1
- package/dist/commands/gate-serve.js +19 -5
- package/dist/commands/gate-serve.js.map +1 -1
- 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/receipt.d.ts +5 -2
- package/dist/commands/receipt.d.ts.map +1 -1
- package/dist/commands/receipt.js +7 -4
- package/dist/commands/receipt.js.map +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 +21 -2
- package/dist/receipt/share.d.ts.map +1 -1
- package/dist/receipt/share.js +68 -5
- package/dist/receipt/share.js.map +1 -1
- 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/telemetry.d.ts +135 -0
- package/dist/telemetry.d.ts.map +1 -0
- package/dist/telemetry.js +427 -0
- package/dist/telemetry.js.map +1 -0
- 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 +4 -3
- package/qwen/settings.example.json +1 -1
- package/server.json +2 -2
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `kya update` - explicit self-update to the latest npm version.
|
|
3
|
+
*
|
|
4
|
+
* Tries to detect the package manager that installed the current binary
|
|
5
|
+
* (npm/pnpm/yarn/volta) and run the appropriate global install command.
|
|
6
|
+
* Falls back to printing the manual install command when detection fails.
|
|
7
|
+
*/
|
|
8
|
+
import { realpathSync } from "node:fs";
|
|
9
|
+
import { spawn } from "node:child_process";
|
|
10
|
+
const defaultIo = {
|
|
11
|
+
log: (m) => console.log(m),
|
|
12
|
+
error: (m) => console.error(m),
|
|
13
|
+
};
|
|
14
|
+
export function detectPackageManager(execPath) {
|
|
15
|
+
let path = execPath;
|
|
16
|
+
try {
|
|
17
|
+
path = realpathSync(execPath);
|
|
18
|
+
}
|
|
19
|
+
catch {
|
|
20
|
+
/* path may not exist in tests or for deleted binaries; fall back to argv path */
|
|
21
|
+
}
|
|
22
|
+
const lower = path.toLowerCase();
|
|
23
|
+
if (lower.includes(".volta"))
|
|
24
|
+
return "volta";
|
|
25
|
+
if (lower.includes("_npx") || lower.includes(".npm/_npx") || lower.includes("npx"))
|
|
26
|
+
return "npx";
|
|
27
|
+
// pnpm global dir patterns: pnpm/global, .pnpm-store, or the pnpm-managed module path
|
|
28
|
+
if (lower.includes("pnpm/global") ||
|
|
29
|
+
lower.includes(".pnpm-store") ||
|
|
30
|
+
lower.includes("/pnpm/") ||
|
|
31
|
+
lower.includes("\\pnpm\\")) {
|
|
32
|
+
return "pnpm";
|
|
33
|
+
}
|
|
34
|
+
if (lower.includes("yarn/global") || lower.includes(".config/yarn"))
|
|
35
|
+
return "yarn";
|
|
36
|
+
// npm is the default; node_modules under an npm-managed global tree.
|
|
37
|
+
if (lower.includes("node_modules"))
|
|
38
|
+
return "npm";
|
|
39
|
+
return "unknown";
|
|
40
|
+
}
|
|
41
|
+
export function buildInstallCommand(manager) {
|
|
42
|
+
switch (manager) {
|
|
43
|
+
case "volta":
|
|
44
|
+
return { command: "volta", args: ["install", "@shield-agent/kya@latest"] };
|
|
45
|
+
case "pnpm":
|
|
46
|
+
return { command: "pnpm", args: ["add", "-g", "@shield-agent/kya@latest"] };
|
|
47
|
+
case "yarn":
|
|
48
|
+
return { command: "yarn", args: ["global", "add", "@shield-agent/kya@latest"] };
|
|
49
|
+
case "npm":
|
|
50
|
+
return { command: "npm", args: ["i", "-g", "@shield-agent/kya@latest"] };
|
|
51
|
+
case "npx":
|
|
52
|
+
return {
|
|
53
|
+
command: "npm",
|
|
54
|
+
args: ["i", "-g", "@shield-agent/kya@latest"],
|
|
55
|
+
hint: "npx runs a temporary copy. Install globally to keep updates:",
|
|
56
|
+
};
|
|
57
|
+
default:
|
|
58
|
+
return null;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
export function manualUpdateCommand() {
|
|
62
|
+
return "npm i -g @shield-agent/kya@latest";
|
|
63
|
+
}
|
|
64
|
+
function defaultRun(command, args) {
|
|
65
|
+
return new Promise((resolve, reject) => {
|
|
66
|
+
const child = spawn(command, [...args], { stdio: "inherit" });
|
|
67
|
+
child.on("error", reject);
|
|
68
|
+
child.on("close", (code) => resolve(code ?? 1));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
export async function runUpdate(deps = {}) {
|
|
72
|
+
const io = deps.io ?? defaultIo;
|
|
73
|
+
const execPath = deps.execPath ?? (process.argv[1] ?? "");
|
|
74
|
+
const manager = detectPackageManager(execPath);
|
|
75
|
+
const install = buildInstallCommand(manager);
|
|
76
|
+
if (!install) {
|
|
77
|
+
io.log(`Could not detect the package manager that installed KYA.`);
|
|
78
|
+
io.log(`Run this manually: ${manualUpdateCommand()}`);
|
|
79
|
+
return 0;
|
|
80
|
+
}
|
|
81
|
+
if (install.hint) {
|
|
82
|
+
io.log(install.hint);
|
|
83
|
+
}
|
|
84
|
+
const commandStr = `${install.command} ${install.args.join(" ")}`;
|
|
85
|
+
io.log(`Running: ${commandStr}`);
|
|
86
|
+
const run = deps.run ?? defaultRun;
|
|
87
|
+
const code = await run(install.command, install.args);
|
|
88
|
+
if (code === 0) {
|
|
89
|
+
io.log("KYA updated. Restart your terminal or run `hash -r` if the old binary is still on PATH.");
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
io.error(`Update command exited with code ${code}. Try running it manually:\n ${commandStr}`);
|
|
93
|
+
}
|
|
94
|
+
return code;
|
|
95
|
+
}
|
|
96
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.js","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAS3C,MAAM,SAAS,GAAoB;IACjC,GAAG,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;IAC1B,KAAK,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,KAA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I,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;IAC1D,MAAM,OAAO,GAAG,oBAAoB,CAAC,QAAQ,CAAC,CAAC;IAC/C,MAAM,OAAO,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE7C,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,EAAE,CAAC,GAAG,CAAC,0DAA0D,CAAC,CAAC;QACnE,EAAE,CAAC,GAAG,CAAC,sBAAsB,mBAAmB,EAAE,EAAE,CAAC,CAAC;QACtD,OAAO,CAAC,CAAC;IACX,CAAC;IAED,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,EAAE,CAAC,GAAG,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,CAAC;IAED,MAAM,UAAU,GAAG,GAAG,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC;IAClE,EAAE,CAAC,GAAG,CAAC,YAAY,UAAU,EAAE,CAAC,CAAC;IACjC,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,IAAI,UAAU,CAAC;IACnC,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACtD,IAAI,IAAI,KAAK,CAAC,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,CAAC,yFAAyF,CAAC,CAAC;IACpG,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,KAAK,CAAC,mCAAmC,IAAI,iCAAiC,UAAU,EAAE,CAAC,CAAC;IACjG,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -18,7 +18,7 @@ export declare function hookCommand(hostId: string): string;
|
|
|
18
18
|
/**
|
|
19
19
|
* Build the [[hooks]] TOML block for a command string. The command goes into
|
|
20
20
|
* a TOML literal string (single quotes) so the embedded JSON-quoted paths are
|
|
21
|
-
* safe
|
|
21
|
+
* safe - but a literal string cannot hold a single quote or a newline, so
|
|
22
22
|
* refuse those instead of writing invalid TOML into the user's config.
|
|
23
23
|
*/
|
|
24
24
|
export declare function kimiHooksBlockText(command: string): string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Hook wiring
|
|
2
|
+
* Hook wiring - install `kya hook --host <id>` as a PreToolUse hook in a
|
|
3
3
|
* coding host's user config. Same write discipline as connect.ts: merge-only
|
|
4
4
|
* for host-owned files (claude settings.json, kimi config.toml), whole-file
|
|
5
5
|
* ownership for the kya-managed grok hook file, all writes symlink-safe and
|
|
@@ -9,7 +9,7 @@ import { existsSync, readFileSync } from "node:fs";
|
|
|
9
9
|
import { join } from "node:path";
|
|
10
10
|
import { UsageError } from "../errors.js";
|
|
11
11
|
import { atomicWriteSync } from "../fs-atomic.js";
|
|
12
|
-
// imports from connect.ts are call-time only (shared fs/registry helpers)
|
|
12
|
+
// imports from connect.ts are call-time only (shared fs/registry helpers) - safe cycle
|
|
13
13
|
import { cliJsPath, CONNECT_REGISTRY, createTarget, writeTarget, } from "./connect.js";
|
|
14
14
|
export const HOOK_HOSTS = ["claude", "grok", "kimi"];
|
|
15
15
|
/** Whether a host has verified PreToolUse hook wiring. */
|
|
@@ -53,20 +53,20 @@ function wireClaudeSettings(path, force) {
|
|
|
53
53
|
raw = JSON.parse(readFileSync(target, "utf8"));
|
|
54
54
|
}
|
|
55
55
|
catch {
|
|
56
|
-
// Never rewrite a host's real config we cannot parse
|
|
57
|
-
throw new UsageError(`${path} is not valid JSON
|
|
56
|
+
// Never rewrite a host's real config we cannot parse - that destroys settings.
|
|
57
|
+
throw new UsageError(`${path} is not valid JSON - fix it by hand or back it up and delete it, then re-run the hook wiring`);
|
|
58
58
|
}
|
|
59
59
|
if (typeof raw !== "object" || raw === null || Array.isArray(raw)) {
|
|
60
|
-
throw new UsageError(`${path} is valid JSON but not an object
|
|
60
|
+
throw new UsageError(`${path} is valid JSON but not an object - refusing to clobber it`);
|
|
61
61
|
}
|
|
62
62
|
const hooks = raw["hooks"];
|
|
63
63
|
if (hooks !== undefined && (typeof hooks !== "object" || hooks === null || Array.isArray(hooks))) {
|
|
64
|
-
throw new UsageError(`${path} has "hooks" but it is not an object
|
|
64
|
+
throw new UsageError(`${path} has "hooks" but it is not an object - refusing to clobber it`);
|
|
65
65
|
}
|
|
66
66
|
const hooksObj = (hooks ?? {});
|
|
67
67
|
const preToolUse = hooksObj["PreToolUse"];
|
|
68
68
|
if (preToolUse !== undefined && !Array.isArray(preToolUse)) {
|
|
69
|
-
throw new UsageError(`${path} has "hooks.PreToolUse" but it is not an array
|
|
69
|
+
throw new UsageError(`${path} has "hooks.PreToolUse" but it is not an array - refusing to clobber it`);
|
|
70
70
|
}
|
|
71
71
|
const entries = (preToolUse ?? []);
|
|
72
72
|
const isKyaEntry = (e) => e != null &&
|
|
@@ -104,7 +104,7 @@ function wireGrokHooks(path) {
|
|
|
104
104
|
}
|
|
105
105
|
const KIMI_HOOKS_HEADER_RE = /^[^\S\n]*\[\[hooks\]\][^\S\n]*(?:#.*)?$/m;
|
|
106
106
|
// A plain [hooks] table or a top-level `hooks = …` scalar cannot coexist with
|
|
107
|
-
// an appended [[hooks]] array
|
|
107
|
+
// an appended [[hooks]] array - the result would be invalid TOML.
|
|
108
108
|
const KIMI_PLAIN_HOOKS_TABLE_RE = /^[^\S\n]*\[hooks\]/m;
|
|
109
109
|
// Deliberately stricter than its sibling: an indented `hooks = …` at top level
|
|
110
110
|
// is rare, and a false-positive refusal is the safe direction here.
|
|
@@ -112,12 +112,12 @@ const KIMI_TOP_LEVEL_HOOKS_RE = /^hooks\s*=/m;
|
|
|
112
112
|
/**
|
|
113
113
|
* Build the [[hooks]] TOML block for a command string. The command goes into
|
|
114
114
|
* a TOML literal string (single quotes) so the embedded JSON-quoted paths are
|
|
115
|
-
* safe
|
|
115
|
+
* safe - but a literal string cannot hold a single quote or a newline, so
|
|
116
116
|
* refuse those instead of writing invalid TOML into the user's config.
|
|
117
117
|
*/
|
|
118
118
|
export function kimiHooksBlockText(command) {
|
|
119
119
|
if (command.includes("'") || command.includes("\n") || command.includes("\r")) {
|
|
120
|
-
throw new UsageError(`the kya hook command contains a single quote or newline and cannot be embedded in Kimi's TOML config
|
|
120
|
+
throw new UsageError(`the kya hook command contains a single quote or newline and cannot be embedded in Kimi's TOML config - move the kya install to a path without quotes and re-run the hook wiring`);
|
|
121
121
|
}
|
|
122
122
|
return [
|
|
123
123
|
"[[hooks]]",
|
|
@@ -132,13 +132,13 @@ function kimiHooksBlock(hostId) {
|
|
|
132
132
|
}
|
|
133
133
|
function assertKimiAppendable(path, text) {
|
|
134
134
|
if (KIMI_PLAIN_HOOKS_TABLE_RE.test(text) || KIMI_TOP_LEVEL_HOOKS_RE.test(text)) {
|
|
135
|
-
throw new UsageError(`${path} already has a [hooks] table or a top-level hooks key
|
|
135
|
+
throw new UsageError(`${path} already has a [hooks] table or a top-level hooks key - appending [[hooks]] would produce invalid TOML; fix the config by hand, then re-run the hook wiring`);
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
138
|
/**
|
|
139
139
|
* Minimal TOML wiring for Kimi: append a [[hooks]] array element at EOF, skip
|
|
140
140
|
* when the command identity already appears anywhere in the file (idempotent
|
|
141
|
-
* by substring
|
|
141
|
+
* by substring - quoted variants of our own block still match), --force
|
|
142
142
|
* replaces the containing block (header line through the next table header or
|
|
143
143
|
* EOF). Writes exactly the fields Kimi's config loader accepts.
|
|
144
144
|
*/
|
|
@@ -165,7 +165,7 @@ function wireKimiToml(path, force) {
|
|
|
165
165
|
const headers = [...beforeIdentity.matchAll(new RegExp(KIMI_HOOKS_HEADER_RE.source, "gm"))];
|
|
166
166
|
const start = headers.length === 0 ? -1 : headers[headers.length - 1].index;
|
|
167
167
|
if (start === -1) {
|
|
168
|
-
// Identity outside any [[hooks]] block
|
|
168
|
+
// Identity outside any [[hooks]] block - not ours to rewrite.
|
|
169
169
|
assertKimiAppendable(path, text);
|
|
170
170
|
const sep = text.endsWith("\n") ? "" : "\n";
|
|
171
171
|
atomicWriteSync(target, `${text}${sep}${block}`);
|
|
@@ -202,7 +202,7 @@ export function wireHook(input) {
|
|
|
202
202
|
status = wireKimiToml(path, force);
|
|
203
203
|
break;
|
|
204
204
|
default:
|
|
205
|
-
throw new UsageError(`unknown hook host "${input.host}"
|
|
205
|
+
throw new UsageError(`unknown hook host "${input.host}" - supported: ${HOOK_HOSTS.join(", ")}`);
|
|
206
206
|
}
|
|
207
207
|
return { host: key, label, path, status };
|
|
208
208
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/commands/wrap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,aAAa,EACb,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"wrap.d.ts","sourceRoot":"","sources":["../../src/commands/wrap.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,EACL,aAAa,EACb,KAAK,gBAAgB,EACtB,MAAM,cAAc,CAAC;AAEtB,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAEnD,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,gBAAgB,CAAC;AAOxB,MAAM,WAAW,UAAU;IACzB,QAAQ,CAAC,IAAI,EAAE,cAAc,CAAC;IAC9B,QAAQ,CAAC,UAAU,EAAE,SAAS,CAAC;IAC/B,QAAQ,CAAC,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IACrC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,oGAAoG;AACpG,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,QAAQ,CAAC,EAAE,OAAO,GAAG,MAAM,CAKvF;AAED,wBAAgB,YAAY,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAEvD;AAwCD,wBAAsB,OAAO,CAC3B,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE;IACL,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,EACD,MAAM,CAAC,EAAE,aAAa,GACrB,OAAO,CAAC,UAAU,CAAC,CAoFrB;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,UAAU;;;;;;;;;EAMnD;AAED,wBAAgB,eAAe,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAmB1D"}
|
package/dist/commands/wrap.js
CHANGED
|
@@ -8,6 +8,7 @@ import { appendTrail, defaultSessionId } from "../trail.js";
|
|
|
8
8
|
import { assertNoSecrets } from "../dash/render.js";
|
|
9
9
|
import { deriveDiffPreview } from "../diff-preview.js";
|
|
10
10
|
import { deriveTargetPath, deriveTrailSummary } from "../trail-summary.js";
|
|
11
|
+
import { maybeSpawnNotifyFlush } from "../notify/dispatch.js";
|
|
11
12
|
/** Shell-safe: DENY → 1, Hold ticket pending → 4, ALLOW or observe → 0. Never means a write ran. */
|
|
12
13
|
export function verdictExitCode(verdict, observed) {
|
|
13
14
|
const v = (verdict ?? "").toUpperCase();
|
|
@@ -34,7 +35,7 @@ function recordTrail(config, evalResult, mode, args) {
|
|
|
34
35
|
diffPreview = "[redacted]";
|
|
35
36
|
}
|
|
36
37
|
}
|
|
37
|
-
|
|
38
|
+
const trailEvent = {
|
|
38
39
|
ts: new Date().toISOString(),
|
|
39
40
|
sessionId: defaultSessionId(),
|
|
40
41
|
host: config.host,
|
|
@@ -47,7 +48,11 @@ function recordTrail(config, evalResult, mode, args) {
|
|
|
47
48
|
...(summary ? { summary } : {}),
|
|
48
49
|
...(diffPreview ? { diffPreview } : {}),
|
|
49
50
|
...(targetPath ? { targetPath } : {}),
|
|
50
|
-
}
|
|
51
|
+
};
|
|
52
|
+
appendTrail(config.cwd, trailEvent);
|
|
53
|
+
// Webhooks + OTLP export ride a detached helper; wrap never waits on the
|
|
54
|
+
// network. No-op unless a sink is configured.
|
|
55
|
+
maybeSpawnNotifyFlush({ env: process.env, cwd: config.cwd, event: trailEvent });
|
|
51
56
|
}
|
|
52
57
|
export async function runWrap(config, input, client) {
|
|
53
58
|
const evalResult = await runEvalTool(config, input, client);
|
|
@@ -58,7 +63,7 @@ export async function runWrap(config, input, client) {
|
|
|
58
63
|
return {
|
|
59
64
|
eval: evalResult,
|
|
60
65
|
sideEffect: "blocked",
|
|
61
|
-
next: "denied
|
|
66
|
+
next: "denied - do not execute; wrap never retries around the PEP",
|
|
62
67
|
};
|
|
63
68
|
}
|
|
64
69
|
if (verdict !== "REQUIRE_APPROVE") {
|
|
@@ -67,8 +72,8 @@ export async function runWrap(config, input, client) {
|
|
|
67
72
|
eval: evalResult,
|
|
68
73
|
sideEffect: "blocked",
|
|
69
74
|
next: verdict === "ALLOW"
|
|
70
|
-
? "evaluate ALLOW
|
|
71
|
-
: "unknown verdict
|
|
75
|
+
? "evaluate ALLOW - wrap still does not execute the side effect"
|
|
76
|
+
: "unknown verdict - treat as blocked",
|
|
72
77
|
};
|
|
73
78
|
}
|
|
74
79
|
// REQUIRE_APPROVE: default observe (no second human prompt / no ticket)
|
|
@@ -78,7 +83,7 @@ export async function runWrap(config, input, client) {
|
|
|
78
83
|
eval: evalResult,
|
|
79
84
|
sideEffect: "blocked",
|
|
80
85
|
observed: true,
|
|
81
|
-
next: "observed REQUIRE_APPROVE
|
|
86
|
+
next: "observed REQUIRE_APPROVE - recorded on trail, no Hold ticket (host still owns OK?). Use --hold or KYA_HOLD=1 for org Hold path",
|
|
82
87
|
};
|
|
83
88
|
}
|
|
84
89
|
if (offline) {
|
|
@@ -119,7 +124,7 @@ export async function runWrap(config, input, client) {
|
|
|
119
124
|
sideEffect: "blocked",
|
|
120
125
|
approval,
|
|
121
126
|
workItemId,
|
|
122
|
-
next: `pending ${approval.id}
|
|
127
|
+
next: `pending ${approval.id} - kya approve --id ${approval.id} (human). wrap does not execute`,
|
|
123
128
|
};
|
|
124
129
|
}
|
|
125
130
|
export function wrapInputFromArgs(parsed) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../src/commands/wrap.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAE/C,OAAO,EACL,aAAa,GAEd,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EACL,qBAAqB,EACrB,WAAW,GAEZ,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"wrap.js","sourceRoot":"","sources":["../../src/comm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IAAI,CAAC,OAAO;YACjB,CAAC,CAAC,2CAA2C;YAC7C,CAAC,CAAC,SAAS;QACb,mCAAmC;KACpC;SACE,MAAM,CAAC,OAAO,CAAC;SACf,IAAI,CAAC,IAAI,CAAC,CAAC;AAChB,CAAC"}
|
package/dist/config.d.ts
CHANGED
|
@@ -20,10 +20,10 @@ export interface ResolvedConfig {
|
|
|
20
20
|
readonly json: boolean;
|
|
21
21
|
/** When true, empty api key is allowed only for pure local file ops (init). */
|
|
22
22
|
readonly allowMissingApiKey: boolean;
|
|
23
|
-
/** Offline sample evaluate (demo / CT)
|
|
23
|
+
/** Offline sample evaluate (demo / CT) - no network, no paid cloud. */
|
|
24
24
|
readonly offline: boolean;
|
|
25
25
|
/**
|
|
26
|
-
* When false (default), REQUIRE_APPROVE is recorded only
|
|
26
|
+
* When false (default), REQUIRE_APPROVE is recorded only - no Hold ticket /
|
|
27
27
|
* second human prompt. Armed by --hold / KYA_HOLD=1 / "gateMode":"hold" in
|
|
28
28
|
* .kya/config.json (flags > env > config > observe, see resolveGateMode).
|
|
29
29
|
*/
|
|
@@ -43,14 +43,14 @@ export interface ResolveOptions {
|
|
|
43
43
|
export declare function configDir(cwd: string): string;
|
|
44
44
|
/** User-level home for KYA state; KYA_HOME overrides (tests, sandboxes). */
|
|
45
45
|
export declare function kyaHome(env?: NodeJS.ProcessEnv): string;
|
|
46
|
-
/** Global KYA state dir: <KYA_HOME|home>/.kya
|
|
46
|
+
/** Global KYA state dir: <KYA_HOME|home>/.kya - home of the global trail. */
|
|
47
47
|
export declare function globalConfigDir(env?: NodeJS.ProcessEnv): string;
|
|
48
48
|
export declare function configFilePath(cwd: string): string;
|
|
49
49
|
export declare function readFileConfig(cwd: string): KyaFileConfig;
|
|
50
50
|
export declare function writeFileConfig(cwd: string, patch: KyaFileConfig): KyaFileConfig;
|
|
51
51
|
/**
|
|
52
52
|
* Gate mode resolution, shared by the gate itself (wrap / hook / eval via
|
|
53
|
-
* resolveConfig) and by `kya certify`
|
|
53
|
+
* resolveConfig) and by `kya certify` - a certify "pass - gate mode is hold"
|
|
54
54
|
* is only an honest claim when both read this one resolver.
|
|
55
55
|
*
|
|
56
56
|
* Precedence: CLI flags (--offline / --hold) > env (KYA_OFFLINE / KYA_HOLD,
|
package/dist/config.js
CHANGED
|
@@ -11,7 +11,7 @@ export function configDir(cwd) {
|
|
|
11
11
|
export function kyaHome(env = process.env) {
|
|
12
12
|
return env.KYA_HOME?.trim() || homedir();
|
|
13
13
|
}
|
|
14
|
-
/** Global KYA state dir: <KYA_HOME|home>/.kya
|
|
14
|
+
/** Global KYA state dir: <KYA_HOME|home>/.kya - home of the global trail. */
|
|
15
15
|
export function globalConfigDir(env = process.env) {
|
|
16
16
|
return join(kyaHome(env), ".kya");
|
|
17
17
|
}
|
|
@@ -67,7 +67,7 @@ function fileGateMode(file) {
|
|
|
67
67
|
}
|
|
68
68
|
/**
|
|
69
69
|
* Gate mode resolution, shared by the gate itself (wrap / hook / eval via
|
|
70
|
-
* resolveConfig) and by `kya certify`
|
|
70
|
+
* resolveConfig) and by `kya certify` - a certify "pass - gate mode is hold"
|
|
71
71
|
* is only an honest claim when both read this one resolver.
|
|
72
72
|
*
|
|
73
73
|
* Precedence: CLI flags (--offline / --hold) > env (KYA_OFFLINE / KYA_HOLD,
|
|
@@ -106,7 +106,7 @@ export function resolveConfig(options = {}) {
|
|
|
106
106
|
const tenantHint = env.KYA_TENANT_HINT;
|
|
107
107
|
const json = flags["json"] === true || flags["json"] === "true";
|
|
108
108
|
// Gate mode: flags > env (KYA_OFFLINE/KYA_HOLD) > "gateMode" in
|
|
109
|
-
// .kya/config.json > observe
|
|
109
|
+
// .kya/config.json > observe - the same precedence resolveGateMode
|
|
110
110
|
// reports, so the gate and `kya certify` can never disagree. Flags/env
|
|
111
111
|
// win as a tier: the config key applies only when no flag/env gate
|
|
112
112
|
// switch is set.
|
|
@@ -115,12 +115,12 @@ export function resolveConfig(options = {}) {
|
|
|
115
115
|
const configMode = flagEnvOffline || flagEnvHold ? undefined : fileGateMode(file);
|
|
116
116
|
const offline = options.offline === true || flagEnvOffline || configMode === "offline";
|
|
117
117
|
const holdEnabled = flagEnvHold || configMode === "hold";
|
|
118
|
-
// Offline sample evaluate never hits the control plane
|
|
118
|
+
// Offline sample evaluate never hits the control plane - no API key required.
|
|
119
119
|
const requireApiKey = offline
|
|
120
120
|
? false
|
|
121
121
|
: (options.requireApiKey ?? !options.allowMissingApiKey);
|
|
122
122
|
if (requireApiKey && (!apiKey || apiKey.trim() === "")) {
|
|
123
|
-
throw new AuthRequiredError("KYA_API_KEY is empty or missing
|
|
123
|
+
throw new AuthRequiredError("KYA_API_KEY is empty or missing - refuse silent allow-all against control plane (use --offline for local sample evaluate)");
|
|
124
124
|
}
|
|
125
125
|
if (!baseUrl && !offline) {
|
|
126
126
|
throw new UsageError("KYA_BASE_URL is required");
|
package/dist/dash/dash.d.ts
CHANGED
|
@@ -51,7 +51,7 @@ export interface DashSnapshot {
|
|
|
51
51
|
}[];
|
|
52
52
|
}
|
|
53
53
|
export declare function renderDash(config: ResolvedConfig, options: DashOptions, env?: NodeJS.ProcessEnv): Promise<DashSnapshot>;
|
|
54
|
-
/** Offline sample used by tests
|
|
54
|
+
/** Offline sample used by tests - production PEP is HTTP. */
|
|
55
55
|
export declare function offlinePolicyPair(): {
|
|
56
56
|
deny: PolicyEvaluateResponse;
|
|
57
57
|
requireApprove: PolicyEvaluateResponse;
|
package/dist/dash/dash.js
CHANGED
|
@@ -191,7 +191,7 @@ async function loadCases(client) {
|
|
|
191
191
|
if (!Array.isArray(rows)) {
|
|
192
192
|
return [
|
|
193
193
|
"Cases list is not available on this plane.",
|
|
194
|
-
"Use the web console /app/kya/cases (observational
|
|
194
|
+
"Use the web console /app/kya/cases (observational - not a PEP).",
|
|
195
195
|
];
|
|
196
196
|
}
|
|
197
197
|
return casesBody(rows);
|
|
@@ -199,7 +199,7 @@ async function loadCases(client) {
|
|
|
199
199
|
catch {
|
|
200
200
|
return [
|
|
201
201
|
"GET /api/v1/kya/cases is not on this plane yet.",
|
|
202
|
-
"Use the web console /app/kya/cases. Observational only
|
|
202
|
+
"Use the web console /app/kya/cases. Observational only - does not approve submit.",
|
|
203
203
|
];
|
|
204
204
|
}
|
|
205
205
|
}
|
|
@@ -220,7 +220,7 @@ async function loadEdge(client) {
|
|
|
220
220
|
return { error: "edge status unavailable" };
|
|
221
221
|
}
|
|
222
222
|
}
|
|
223
|
-
/** Offline sample used by tests
|
|
223
|
+
/** Offline sample used by tests - production PEP is HTTP. */
|
|
224
224
|
export function offlinePolicyPair() {
|
|
225
225
|
return {
|
|
226
226
|
deny: evaluateOffline({
|
|
@@ -25,7 +25,7 @@ export interface ResolveEntitlementInput {
|
|
|
25
25
|
readonly now?: Date;
|
|
26
26
|
readonly licensePublicKeyPem?: string;
|
|
27
27
|
}
|
|
28
|
-
/** Placeholder verify key
|
|
28
|
+
/** Placeholder verify key - real issuers replace via KYA_LICENSE_PUBKEY. */
|
|
29
29
|
export declare const DEFAULT_LICENSE_PUBKEY_PEM = "-----BEGIN PUBLIC KEY-----\nMCowBQYDK2VwAyEA//////////////////////////////////////////8=\n-----END PUBLIC KEY-----\n";
|
|
30
30
|
export declare function isEnterprisePane(pane: string): pane is EnterprisePane;
|
|
31
31
|
export declare function paneAllowed(ent: Entitlement, pane: DashPane): boolean;
|
package/dist/dash/entitlement.js
CHANGED
|
@@ -16,7 +16,7 @@ export const FREE_PANES = [
|
|
|
16
16
|
"mcp",
|
|
17
17
|
"sandbox",
|
|
18
18
|
];
|
|
19
|
-
/** Placeholder verify key
|
|
19
|
+
/** Placeholder verify key - real issuers replace via KYA_LICENSE_PUBKEY. */
|
|
20
20
|
export const DEFAULT_LICENSE_PUBKEY_PEM = `-----BEGIN PUBLIC KEY-----
|
|
21
21
|
MCowBQYDK2VwAyEA//////////////////////////////////////////8=
|
|
22
22
|
-----END PUBLIC KEY-----
|
package/dist/dash/render.js
CHANGED
|
@@ -42,7 +42,7 @@ export function enterpriseNavLine(ent, active) {
|
|
|
42
42
|
.map((p) => (p === active ? `[${p.toUpperCase()}]` : p))
|
|
43
43
|
.join(" ")}`);
|
|
44
44
|
}
|
|
45
|
-
return clip("ent: (hidden on FREE
|
|
45
|
+
return clip("ent: (hidden on FREE - set KYA_DASH_PLAN=enterprise to unlock)");
|
|
46
46
|
}
|
|
47
47
|
export function lockedPane(pane) {
|
|
48
48
|
return [
|
|
@@ -91,7 +91,7 @@ export function assertNoSecrets(text, extra) {
|
|
|
91
91
|
/\bsession=[^\s;&"']{8,}/i,
|
|
92
92
|
/-----BEGIN [A-Z0-9 ]*PRIVATE KEY-----/i,
|
|
93
93
|
/-----END [A-Z0-9 ]*PRIVATE KEY-----/i,
|
|
94
|
-
// Keyword assignments require a realistically long value
|
|
94
|
+
// Keyword assignments require a realistically long value - short benign
|
|
95
95
|
// mentions ("refreshed token: ab12cd34") must not DoS every render.
|
|
96
96
|
/\b(password|passwd|secret|token|api[_-]?key)\s*[:=]\s*(?!\[redacted\])[^\s#"']{16,}/i,
|
|
97
97
|
/\bxox[baprs]-[A-Za-z0-9-]{10,}/i,
|
|
@@ -5,12 +5,12 @@ export function dashboardBody(k) {
|
|
|
5
5
|
"",
|
|
6
6
|
...table(["kpi", "value"], [
|
|
7
7
|
["pending approvals", String(k.pendingApprovals)],
|
|
8
|
-
["agents registered", Number.isFinite(k.agentCount) ? String(k.agentCount) : "
|
|
9
|
-
["observed sessions", String(k.sessionCount ?? "
|
|
10
|
-
["high-risk sessions", String(k.highRiskSessions ?? "
|
|
11
|
-
["policy denies", String(k.policyDeny ?? "
|
|
12
|
-
["approve required", String(k.approveRequired ?? "
|
|
13
|
-
["approve granted", String(k.approveGranted ?? "
|
|
8
|
+
["agents registered", Number.isFinite(k.agentCount) ? String(k.agentCount) : "-"],
|
|
9
|
+
["observed sessions", String(k.sessionCount ?? "-")],
|
|
10
|
+
["high-risk sessions", String(k.highRiskSessions ?? "-")],
|
|
11
|
+
["policy denies", String(k.policyDeny ?? "-")],
|
|
12
|
+
["approve required", String(k.approveRequired ?? "-")],
|
|
13
|
+
["approve granted", String(k.approveGranted ?? "-")],
|
|
14
14
|
]),
|
|
15
15
|
"",
|
|
16
16
|
"Actions that change production still wait for a person.",
|
|
@@ -18,7 +18,7 @@ export function dashboardBody(k) {
|
|
|
18
18
|
}
|
|
19
19
|
export function casesBody(rows) {
|
|
20
20
|
return [
|
|
21
|
-
"Evidence & cases (optional disputes pack). Observational
|
|
21
|
+
"Evidence & cases (optional disputes pack). Observational - does not approve submit.",
|
|
22
22
|
"",
|
|
23
23
|
...table(["id", "status", "amount"], rows.map((c) => [c.id, c.status ?? "", c.amount ?? ""])),
|
|
24
24
|
];
|
|
@@ -32,14 +32,14 @@ export function metricsBody(m) {
|
|
|
32
32
|
}
|
|
33
33
|
export function edgeBody(flags) {
|
|
34
34
|
return [
|
|
35
|
-
"Edge / Gatekeeper (read-only). Complement
|
|
35
|
+
"Edge / Gatekeeper (read-only). Complement - not a second PEP.",
|
|
36
36
|
"",
|
|
37
37
|
...table(["flag", "value"], Object.entries(flags).map(([k, v]) => [k, String(v)])),
|
|
38
38
|
];
|
|
39
39
|
}
|
|
40
40
|
export function settingsBody(lines) {
|
|
41
41
|
return [
|
|
42
|
-
"Settings (licensed). Team / SSO / keys / billing
|
|
42
|
+
"Settings (licensed). Team / SSO / keys / billing - same surfaces as the web console.",
|
|
43
43
|
"",
|
|
44
44
|
...(lines.length ? lines : ["Connect a plane to load tenant settings."]),
|
|
45
45
|
];
|
|
@@ -10,7 +10,7 @@ export function homeBody(input) {
|
|
|
10
10
|
`offline ${input.offline ? "yes (sample tools, not production PEP)" : "no"}`,
|
|
11
11
|
`api key ${input.hasApiKey ? "set" : "empty (fail-closed on live panes)"}`,
|
|
12
12
|
`plane ${input.offline ? "offline" : input.baseUrl}`,
|
|
13
|
-
`agentId ${input.agentId ?? "(none
|
|
13
|
+
`agentId ${input.agentId ?? "(none - kya register-agent)"}`,
|
|
14
14
|
"",
|
|
15
15
|
"2 policy (e force-eval / w wrap) 3 agents (k kill, confirm y)",
|
|
16
16
|
"4 approvals (i invoke) 5 sessions (b/R shrink, confirm y)",
|
|
@@ -34,7 +34,7 @@ export function policyOfflineBody() {
|
|
|
34
34
|
env: { host: "ide" },
|
|
35
35
|
});
|
|
36
36
|
return [
|
|
37
|
-
"Policy playground (offline sample
|
|
37
|
+
"Policy playground (offline sample - not the production PEP).",
|
|
38
38
|
"Sole PEP in production is Shield HTTP evaluate.",
|
|
39
39
|
"",
|
|
40
40
|
...table(["tool", "verdict", "reason"], [
|
|
@@ -84,7 +84,7 @@ export function agentsLiveBody(rows, cursor = 0) {
|
|
|
84
84
|
export function sandboxBody(input) {
|
|
85
85
|
const lines = [
|
|
86
86
|
"Sandbox (opt-in Firecracker wrap). Not MCP. Never auto-exec.",
|
|
87
|
-
`KYA_SANDBOX ${input.backend || "(unset
|
|
87
|
+
`KYA_SANDBOX ${input.backend || "(unset - set mock|firecracker)"}`,
|
|
88
88
|
"Spawn/exec go through evaluate first. DENY / Hold block side effects.",
|
|
89
89
|
"",
|
|
90
90
|
];
|
|
@@ -137,7 +137,7 @@ export function sessionsLiveBody(rows, cursor = 0) {
|
|
|
137
137
|
}
|
|
138
138
|
export function orrBody(summary) {
|
|
139
139
|
return [
|
|
140
|
-
"ORR board (reporting only
|
|
140
|
+
"ORR board (reporting only - not a second PEP).",
|
|
141
141
|
"Scanners are evidence. Sole PEP remains Shield KYA.",
|
|
142
142
|
"",
|
|
143
143
|
summary
|
|
@@ -152,7 +152,7 @@ export function mcpBody(input) {
|
|
|
152
152
|
" kya serve-mcp --port 13920",
|
|
153
153
|
" tools: kya.policy_evaluate | kya.session_ingest | kya.request_approval",
|
|
154
154
|
`host ${input.host}`,
|
|
155
|
-
`api key ${input.hasApiKey ? "set" : "empty
|
|
155
|
+
`api key ${input.hasApiKey ? "set" : "empty - serve-mcp will fail-closed"}`,
|
|
156
156
|
"Dash will not start the server (it would steal this TTY).",
|
|
157
157
|
];
|
|
158
158
|
}
|
package/dist/diff-preview.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export interface WireChangeFields {
|
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The three change fields the hosted plane persists on the tool event.
|
|
21
|
-
* Undefined when opted out or when nothing safe/useful was derivable
|
|
21
|
+
* Undefined when opted out or when nothing safe/useful was derivable -
|
|
22
22
|
* evaluate still happens, the fields are simply omitted from the body.
|
|
23
23
|
*/
|
|
24
24
|
export declare function deriveWireChangeFields(toolId: string, args?: unknown, env?: NodeJS.ProcessEnv): WireChangeFields | undefined;
|
package/dist/diff-preview.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Clipped, redacted change preview for the activity receipt.
|
|
3
|
-
* Never persists full patches
|
|
3
|
+
* Never persists full patches - hard caps + redaction only.
|
|
4
4
|
*/
|
|
5
5
|
import { deriveTargetPath, deriveTrailSummary, redactTrailText } from "./trail-summary.js";
|
|
6
6
|
import { assertNoSecrets } from "./dash/render.js";
|
|
@@ -203,7 +203,7 @@ export function sendPreviewsEnabled(env = process.env) {
|
|
|
203
203
|
}
|
|
204
204
|
/**
|
|
205
205
|
* The three change fields the hosted plane persists on the tool event.
|
|
206
|
-
* Undefined when opted out or when nothing safe/useful was derivable
|
|
206
|
+
* Undefined when opted out or when nothing safe/useful was derivable -
|
|
207
207
|
* evaluate still happens, the fields are simply omitted from the body.
|
|
208
208
|
*/
|
|
209
209
|
export function deriveWireChangeFields(toolId, args, env = process.env) {
|
package/dist/errors.d.ts
CHANGED
package/dist/errors.js
CHANGED
package/dist/fs-atomic.d.ts
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Crash-safe write: tmp file in the same directory, then rename onto the
|
|
3
3
|
* target (atomic on POSIX and win32 within one volume). A mid-write crash
|
|
4
4
|
* leaves the original config intact; the tmp file is removed best-effort.
|
|
5
|
-
* An existing target's file mode is carried over
|
|
5
|
+
* An existing target's file mode is carried over - a rename would otherwise
|
|
6
6
|
* turn a 0600 config into the umask default.
|
|
7
7
|
*/
|
|
8
8
|
export declare function atomicWriteSync(target: string, content: string): void;
|
package/dist/fs-atomic.js
CHANGED
|
@@ -7,7 +7,7 @@ import { chmodSync, renameSync, rmSync, statSync, writeFileSync } from "node:fs"
|
|
|
7
7
|
* Crash-safe write: tmp file in the same directory, then rename onto the
|
|
8
8
|
* target (atomic on POSIX and win32 within one volume). A mid-write crash
|
|
9
9
|
* leaves the original config intact; the tmp file is removed best-effort.
|
|
10
|
-
* An existing target's file mode is carried over
|
|
10
|
+
* An existing target's file mode is carried over - a rename would otherwise
|
|
11
11
|
* turn a 0600 config into the umask default.
|
|
12
12
|
*/
|
|
13
13
|
export function atomicWriteSync(target, content) {
|
|
@@ -18,7 +18,7 @@ export function atomicWriteSync(target, content) {
|
|
|
18
18
|
mode = statSync(target).mode;
|
|
19
19
|
}
|
|
20
20
|
catch {
|
|
21
|
-
/* new file
|
|
21
|
+
/* new file - keep default mode */
|
|
22
22
|
}
|
|
23
23
|
writeFileSync(tmp, content, "utf8");
|
|
24
24
|
if (mode !== undefined) {
|