@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,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kya investigate - deterministic detectors over the local trail: incident
|
|
3
|
+
* grouping plus markdown fix briefs shaped for coding agents. No LLM calls.
|
|
4
|
+
*/
|
|
5
|
+
import type { ParsedArgs } from "../parse-args.js";
|
|
6
|
+
export interface InvestigateCliOptions {
|
|
7
|
+
readonly json: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare function investigateOptionsFromArgs(parsed: ParsedArgs): InvestigateCliOptions;
|
|
10
|
+
export declare function runInvestigate(opts: InvestigateCliOptions, io: {
|
|
11
|
+
log: (s: string) => void;
|
|
12
|
+
}, cwd: string, env: NodeJS.ProcessEnv): Promise<number>;
|
|
13
|
+
//# sourceMappingURL=investigate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investigate.d.ts","sourceRoot":"","sources":["../../src/commands/investigate.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAQnD,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;CACxB;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,UAAU,GAAG,qBAAqB,CAEpF;AAED,wBAAsB,cAAc,CAClC,IAAI,EAAE,qBAAqB,EAC3B,EAAE,EAAE;IAAE,GAAG,EAAE,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,EAChC,GAAG,EAAE,MAAM,EACX,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,OAAO,CAAC,MAAM,CAAC,CAmBjB"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { flagBool } from "../parse-args.js";
|
|
2
|
+
import { readTrail } from "../trail.js";
|
|
3
|
+
import { investigateTrail, renderInvestigateReport, } from "../investigate/index.js";
|
|
4
|
+
export function investigateOptionsFromArgs(parsed) {
|
|
5
|
+
return { json: flagBool(parsed.flags, "json") };
|
|
6
|
+
}
|
|
7
|
+
export async function runInvestigate(opts, io, cwd, env) {
|
|
8
|
+
const events = readTrail(cwd, env);
|
|
9
|
+
const result = investigateTrail(events);
|
|
10
|
+
if (opts.json) {
|
|
11
|
+
io.log(JSON.stringify({
|
|
12
|
+
findings: result.findings,
|
|
13
|
+
incidents: result.incidents,
|
|
14
|
+
briefs: Object.fromEntries(result.briefs),
|
|
15
|
+
}, null, 2));
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
io.log(renderInvestigateReport(result));
|
|
19
|
+
}
|
|
20
|
+
return 0;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=investigate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"investigate.js","sourceRoot":"","sources":["../../src/commands/investigate.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AACxC,OAAO,EACL,gBAAgB,EAChB,uBAAuB,GACxB,MAAM,yBAAyB,CAAC;AAMjC,MAAM,UAAU,0BAA0B,CAAC,MAAkB;IAC3D,OAAO,EAAE,IAAI,EAAE,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,EAAE,CAAC;AAClD,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAClC,IAA2B,EAC3B,EAAgC,EAChC,GAAW,EACX,GAAsB;IAEtB,MAAM,MAAM,GAAG,SAAS,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;IACnC,MAAM,MAAM,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QACd,EAAE,CAAC,GAAG,CACJ,IAAI,CAAC,SAAS,CACZ;YACE,QAAQ,EAAE,MAAM,CAAC,QAAQ;YACzB,SAAS,EAAE,MAAM,CAAC,SAAS;YAC3B,MAAM,EAAE,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,MAAM,CAAC;SAC1C,EACD,IAAI,EACJ,CAAC,CACF,CACF,CAAC;IACJ,CAAC;SAAM,CAAC;QACN,EAAE,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1C,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notify-flush.d.ts","sourceRoot":"","sources":["../../src/commands/notify-flush.ts"],"names":[],"mappings":"AAWA,wBAAsB,cAAc,CAClC,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,GAAG,EAAE,MAAM,GACV,OAAO,CAAC,MAAM,CAAC,CAqCjB"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* kya notify-flush - internal helper spawned detached by hook/wrap (see
|
|
3
|
+
* src/notify/dispatch.ts). Delivers the event handed over in KYA_NOTIFY_EVENT
|
|
4
|
+
* to configured webhooks and the OTLP exporter, then exits. Never prints,
|
|
5
|
+
* never fails hard: it is a best-effort side channel.
|
|
6
|
+
*/
|
|
7
|
+
import { kyaHome, readFileConfig } from "../config.js";
|
|
8
|
+
import { notifyOnTrailEvent } from "../notify/index.js";
|
|
9
|
+
import { exportVerdictSpan, resolveOtlpExportConfig } from "../otel/exporter.js";
|
|
10
|
+
export async function runNotifyFlush(env, cwd) {
|
|
11
|
+
const raw = env.KYA_NOTIFY_EVENT;
|
|
12
|
+
if (!raw)
|
|
13
|
+
return 0;
|
|
14
|
+
let event;
|
|
15
|
+
try {
|
|
16
|
+
const parsed = JSON.parse(raw);
|
|
17
|
+
if (!parsed || typeof parsed.toolId !== "string" || typeof parsed.verdict !== "string") {
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
event = parsed;
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return 0;
|
|
24
|
+
}
|
|
25
|
+
// Project config wins over the global one (same precedence as resolveConfig).
|
|
26
|
+
const fileConfig = {
|
|
27
|
+
...readFileConfig(kyaHome(env)),
|
|
28
|
+
...readFileConfig(cwd),
|
|
29
|
+
};
|
|
30
|
+
await notifyOnTrailEvent(event, fileConfig, env).catch(() => undefined);
|
|
31
|
+
const otlp = resolveOtlpExportConfig(env, fileConfig);
|
|
32
|
+
if (otlp) {
|
|
33
|
+
await exportVerdictSpan({
|
|
34
|
+
ts: event.ts,
|
|
35
|
+
sessionId: event.sessionId,
|
|
36
|
+
toolId: event.toolId,
|
|
37
|
+
verdict: event.verdict,
|
|
38
|
+
reasonCode: event.reasonCode,
|
|
39
|
+
mode: event.mode,
|
|
40
|
+
...(event.host ? { host: event.host } : {}),
|
|
41
|
+
...(event.tokensIn !== undefined ? { tokensIn: event.tokensIn } : {}),
|
|
42
|
+
...(event.tokensOut !== undefined ? { tokensOut: event.tokensOut } : {}),
|
|
43
|
+
}, otlp).catch(() => undefined);
|
|
44
|
+
}
|
|
45
|
+
return 0;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=notify-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E,KAAK,CAAC,EAAE;YACZ,SAAS,EAAE,KAAK,CAAC,SAAS;YAC1B,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,OAAO,EAAE,KAAK,CAAC,OAAO;YACtB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,IAAI,EAAE,KAAK,CAAC,IAAI;YAChB,GAAG,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3C,GAAG,CAAC,KAAK,CAAC,QAAQ,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;YACrE,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACzE,EACD,IAAI,CACL,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,SAAS,CAAC,CAAC;IAC3B,CAAC;IACD,OAAO,CAAC,CAAC;AACX,CAAC"}
|
package/dist/commands/orr.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* kya orr run
|
|
2
|
+
* kya orr run - Phase O1 read-only ORR board emitter.
|
|
3
3
|
* Reporting orchestrator only: not a second PEP; never mints principals or allows side effects.
|
|
4
4
|
*/
|
|
5
5
|
import type { ParsedArgs } from "../parse-args.js";
|
|
@@ -72,9 +72,9 @@ export interface OrrRunOptions {
|
|
|
72
72
|
readonly failOn?: "no_go" | "conditional";
|
|
73
73
|
readonly quiet: boolean;
|
|
74
74
|
readonly jsonStdout: boolean;
|
|
75
|
-
/** Optional OpenSSF Scorecard / readiness JSON. Evidence only
|
|
75
|
+
/** Optional OpenSSF Scorecard / readiness JSON. Evidence only - not a PEP. */
|
|
76
76
|
readonly scorecardPath?: string;
|
|
77
|
-
/** Optional AgentShield SecurityReport JSON dump. Evidence only
|
|
77
|
+
/** Optional AgentShield SecurityReport JSON dump. Evidence only - not a PEP. */
|
|
78
78
|
readonly agentshieldJsonPath?: string;
|
|
79
79
|
/** Optional usage JSON (array). Observe-only showback. */
|
|
80
80
|
readonly usagePath?: string;
|
package/dist/commands/orr.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* kya orr run
|
|
2
|
+
* kya orr run - Phase O1 read-only ORR board emitter.
|
|
3
3
|
* Reporting orchestrator only: not a second PEP; never mints principals or allows side effects.
|
|
4
4
|
*/
|
|
5
5
|
import { existsSync, mkdirSync, readdirSync, readFileSync, lstatSync, realpathSync, statSync, writeFileSync, } from "node:fs";
|
|
@@ -218,7 +218,7 @@ export function readScorecardEvidence(scorecardPath) {
|
|
|
218
218
|
category: "enterprise_readiness",
|
|
219
219
|
severity: "info",
|
|
220
220
|
title: "Scorecard file not found",
|
|
221
|
-
detail: `${scorecardPath} was requested as an optional producer. Evidence only
|
|
221
|
+
detail: `${scorecardPath} was requested as an optional producer. Evidence only - not a PEP.`,
|
|
222
222
|
evidence: abs,
|
|
223
223
|
source_tool: "openssf.scorecard",
|
|
224
224
|
},
|
|
@@ -346,7 +346,7 @@ export function runSaFirstPartyProbes(root) {
|
|
|
346
346
|
category: "agent_factory_lifecycle",
|
|
347
347
|
severity: "high",
|
|
348
348
|
title: "Agent create path may be scope-auth only",
|
|
349
|
-
detail: "Factory doctrine: principal mint should be policy-gated (APPROVED). ORR reports only
|
|
349
|
+
detail: "Factory doctrine: principal mint should be policy-gated (APPROVED). ORR reports only - does not mint.",
|
|
350
350
|
evidence: "sa.first_party text probe",
|
|
351
351
|
});
|
|
352
352
|
}
|
|
@@ -361,7 +361,7 @@ export function runSaFirstPartyProbes(root) {
|
|
|
361
361
|
category: "cost_budget_gates",
|
|
362
362
|
severity: "info",
|
|
363
363
|
title: "No in-loop step/token/retry ceilings detected",
|
|
364
|
-
detail: "Look for max_steps, max_tokens, max_retries, or maxCost in the agent loop. Soft gate only
|
|
364
|
+
detail: "Look for max_steps, max_tokens, max_retries, or maxCost in the agent loop. Soft gate only - ORR does not kill spend.",
|
|
365
365
|
evidence: "sa.first_party text probe",
|
|
366
366
|
});
|
|
367
367
|
}
|
|
@@ -493,7 +493,7 @@ export function formatOrrMarkdown(report) {
|
|
|
493
493
|
.join("\n");
|
|
494
494
|
const showbackMd = formatShowbackMarkdown(report.showback);
|
|
495
495
|
const cards = report.scorecards
|
|
496
|
-
.map((s) => `- \`${s.category}\` / \`${s.name}\`: **${s.result}** (${s.hardness})${s.note ? `
|
|
496
|
+
.map((s) => `- \`${s.category}\` / \`${s.name}\`: **${s.result}** (${s.hardness})${s.note ? ` - ${s.note}` : ""}`)
|
|
497
497
|
.join("\n");
|
|
498
498
|
return `# ORR: ${report.target.name}
|
|
499
499
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Hidden daemon entry: runs the live receipt server in the foreground and
|
|
3
3
|
* publishes `.kya/receipt-server.json` (pid, url, token) once listening.
|
|
4
|
-
* Spawned detached by `ensureReceiptDaemon`
|
|
4
|
+
* Spawned detached by `ensureReceiptDaemon` - never invoked by users directly.
|
|
5
5
|
*/
|
|
6
6
|
import type { ResolvedConfig } from "../config.js";
|
|
7
7
|
export declare function runReceiptServe(config: ResolvedConfig, input: {
|
|
@@ -17,7 +17,7 @@ export async function runReceiptServe(config, input) {
|
|
|
17
17
|
await live.waitUntilClosed;
|
|
18
18
|
}
|
|
19
19
|
finally {
|
|
20
|
-
// Only remove the state file if it is still ours
|
|
20
|
+
// Only remove the state file if it is still ours - a successor daemon
|
|
21
21
|
// spawned during our slow shutdown must not lose its state.
|
|
22
22
|
clearDaemonState(config.cwd, process.pid);
|
|
23
23
|
}
|
|
@@ -34,13 +34,15 @@ export declare function runReceipt(config: ResolvedConfig, input: {
|
|
|
34
34
|
}): Promise<ReceiptResult>;
|
|
35
35
|
/**
|
|
36
36
|
* `kya receipt --share`: build the redacted share payload from the current
|
|
37
|
-
* window's receipt model and POST it to the hosted platform.
|
|
38
|
-
*
|
|
37
|
+
* window's receipt model and POST it to the hosted platform. Single attempt
|
|
38
|
+
* by default; input.shareRetries (max 3) opts into bounded backoff retries.
|
|
39
|
+
* Returns the public URL on success; failures are returned (not thrown).
|
|
39
40
|
*/
|
|
40
41
|
export declare function runReceiptShare(config: ResolvedConfig, input: {
|
|
41
42
|
sessionId?: string;
|
|
42
43
|
days?: number;
|
|
43
44
|
shareUrl?: string;
|
|
45
|
+
shareRetries?: number;
|
|
44
46
|
}, env?: NodeJS.ProcessEnv): Promise<ShareResult>;
|
|
45
47
|
export declare function receiptInputFromArgs(parsed: ParsedArgs): {
|
|
46
48
|
sessionId: string | undefined;
|
|
@@ -48,6 +50,7 @@ export declare function receiptInputFromArgs(parsed: ParsedArgs): {
|
|
|
48
50
|
open: boolean;
|
|
49
51
|
outDir: string | undefined;
|
|
50
52
|
searchQuery: string | undefined;
|
|
53
|
+
shareRetries: number;
|
|
51
54
|
};
|
|
52
55
|
export declare function formatReceiptHuman(r: ReceiptResult): string;
|
|
53
56
|
export declare function openPath(target: string): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../src/commands/receipt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,OAAO,
|
|
1
|
+
{"version":3,"file":"receipt.d.ts","sourceRoot":"","sources":["../../src/commands/receipt.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAUnD,OAAO,EAKL,KAAK,WAAW,EACjB,MAAM,qBAAqB,CA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cAAc,EACtB,KAAK,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAA;CAAE,EACtF,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,WAAW,CAAC,CAYtB;AAED,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,UAAU;;;;;;;EAWtD;AAED,wBAAgB,kBAAkB,CAAC,CAAC,EAAE,aAAa,GAAG,MAAM,CAa3D;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,CAS7C"}
|
package/dist/commands/receipt.js
CHANGED
|
@@ -6,7 +6,7 @@ import { assertNoSecrets } from "../dash/render.js";
|
|
|
6
6
|
import { loadReceiptModel, renderReceiptHtml, renderReceiptMarkdown, } from "../receipt/render-receipt.js";
|
|
7
7
|
import { ensureReceiptDaemon } from "../receipt/daemon.js";
|
|
8
8
|
import { receiptsDir } from "../trail.js";
|
|
9
|
-
import { buildSharePayload, shareBaseUrl,
|
|
9
|
+
import { buildSharePayload, clampShareRetries, shareBaseUrl, shareReceiptWithRetry, } from "../receipt/share.js";
|
|
10
10
|
export const DEFAULT_RECEIPT_DAYS = 3;
|
|
11
11
|
export async function runReceipt(config, input) {
|
|
12
12
|
const sessionId = input.sessionId?.trim();
|
|
@@ -58,8 +58,9 @@ export async function runReceipt(config, input) {
|
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* `kya receipt --share`: build the redacted share payload from the current
|
|
61
|
-
* window's receipt model and POST it to the hosted platform.
|
|
62
|
-
*
|
|
61
|
+
* window's receipt model and POST it to the hosted platform. Single attempt
|
|
62
|
+
* by default; input.shareRetries (max 3) opts into bounded backoff retries.
|
|
63
|
+
* Returns the public URL on success; failures are returned (not thrown).
|
|
63
64
|
*/
|
|
64
65
|
export async function runReceiptShare(config, input, env = process.env) {
|
|
65
66
|
const sessionId = input.sessionId?.trim();
|
|
@@ -68,8 +69,9 @@ export async function runReceiptShare(config, input, env = process.env) {
|
|
|
68
69
|
: DEFAULT_RECEIPT_DAYS;
|
|
69
70
|
const model = loadReceiptModel({ cwd: config.cwd, sessionId, days, live: false });
|
|
70
71
|
const payload = buildSharePayload(model);
|
|
71
|
-
return
|
|
72
|
+
return shareReceiptWithRetry(payload, {
|
|
72
73
|
baseUrl: shareBaseUrl(input.shareUrl, env),
|
|
74
|
+
retries: input.shareRetries ?? 0,
|
|
73
75
|
});
|
|
74
76
|
}
|
|
75
77
|
export function receiptInputFromArgs(parsed) {
|
|
@@ -81,6 +83,7 @@ export function receiptInputFromArgs(parsed) {
|
|
|
81
83
|
open: parsed.flags["open"] === true || parsed.flags["open"] === "true",
|
|
82
84
|
outDir: flagString(parsed.flags, "out", "out-dir", "outDir"),
|
|
83
85
|
searchQuery: flagString(parsed.flags, "q", "query", "search"),
|
|
86
|
+
shareRetries: clampShareRetries(flagString(parsed.flags, "share-retries", "shareRetries")),
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
export function formatReceiptHuman(r) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"receipt.js","sourceRoot":"","sources":["../../src/commands/receipt.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAG3C,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,qBAAqB,GACtB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,WAA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,MAAM,EAAE;KAClB,CAAC;IACF,IAAI,CAAC,CAAC,OAAO,EAAE,CAAC;QACd,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;QACjC,KAAK,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;IACjE,CAAC;IACD,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,MAAc;IACrC,IAAI,OAAO,CAAC,GAAG,CAAC,cAAc,KAAK,GAAG;QAAE,OAAO;IAC/C,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;IAClC,MAAM,GAAG,GAAG,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC;IACzF,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC;IACxE,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,GAAG,EAAE,EAAE;QACxB,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,2BAA2B,GAAG,CAAC,OAAO,IAAI,CAAC,CAAC;IACnE,CAAC,CAAC,CAAC;IACH,KAAK,CAAC,KAAK,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -19,7 +19,7 @@ export async function runServeMcp(config, options, client) {
|
|
|
19
19
|
host: config.host,
|
|
20
20
|
agentId: config.agentId,
|
|
21
21
|
// Offline (KYA_OFFLINE=1, as `kya start`/`kya connect` wire for hosts):
|
|
22
|
-
// start keyless
|
|
22
|
+
// start keyless - initialize/tools/list work; tool calls still fail
|
|
23
23
|
// closed at call time without a key.
|
|
24
24
|
requireApiKey: !config.offline,
|
|
25
25
|
});
|
package/dist/commands/start.d.ts
CHANGED
|
@@ -45,8 +45,8 @@ export interface GateBootstrapDeps {
|
|
|
45
45
|
export declare function gateBootstrapEnabled(flag: boolean | undefined, env?: NodeJS.ProcessEnv): boolean;
|
|
46
46
|
/**
|
|
47
47
|
* Gate bootstrap for `kya start`: scaffold gateways.json, import third-party
|
|
48
|
-
* servers discovered in host configs, then
|
|
49
|
-
* govern
|
|
48
|
+
* servers discovered in host configs, then - only when there is something to
|
|
49
|
+
* govern - install the binary, start the supervisor, and route the source
|
|
50
50
|
* hosts through the gateway (direct entries removed, originals backed up
|
|
51
51
|
* under .kya/backups). Every step warns and continues: start never fails
|
|
52
52
|
* because of the gateway, and host configs are only touched once the
|
package/dist/commands/start.js
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
* `.cursor/mcp.json` in cwd), user-level MCP configs for hosts with evidence
|
|
7
7
|
* of installation (config file present, or the host's config dir exists),
|
|
8
8
|
* and PreToolUse hooks for hook-capable hosts (claude, grok, kimi).
|
|
9
|
-
* All go through merge-only logic
|
|
9
|
+
* All go through merge-only logic - never clobber. The gateway bootstrap
|
|
10
10
|
* (bootstrapGate) then imports third-party MCP servers found in those host
|
|
11
|
-
* configs into gateways.json and routes them through the local gateway
|
|
11
|
+
* configs into gateways.json and routes them through the local gateway -
|
|
12
12
|
* warn-and-continue throughout, skippable via --no-gate / KYA_GATE=off.
|
|
13
13
|
*/
|
|
14
14
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -38,8 +38,8 @@ function errMsg(err) {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Gate bootstrap for `kya start`: scaffold gateways.json, import third-party
|
|
41
|
-
* servers discovered in host configs, then
|
|
42
|
-
* govern
|
|
41
|
+
* servers discovered in host configs, then - only when there is something to
|
|
42
|
+
* govern - install the binary, start the supervisor, and route the source
|
|
43
43
|
* hosts through the gateway (direct entries removed, originals backed up
|
|
44
44
|
* under .kya/backups). Every step warns and continues: start never fails
|
|
45
45
|
* because of the gateway, and host configs are only touched once the
|
|
@@ -57,7 +57,7 @@ export async function bootstrapGate(config, input) {
|
|
|
57
57
|
servers = readGateways(env).servers;
|
|
58
58
|
}
|
|
59
59
|
catch (err) {
|
|
60
|
-
warnings.push(`gateways.json needs a hand fix (${errMsg(err)})
|
|
60
|
+
warnings.push(`gateways.json needs a hand fix (${errMsg(err)}) - gateway bootstrap skipped`);
|
|
61
61
|
return {
|
|
62
62
|
imported: [],
|
|
63
63
|
serverCount: 0,
|
|
@@ -65,7 +65,7 @@ export async function bootstrapGate(config, input) {
|
|
|
65
65
|
backups: [],
|
|
66
66
|
rewiredHosts: [],
|
|
67
67
|
warnings,
|
|
68
|
-
summary: "gateway: gateways.json is not usable
|
|
68
|
+
summary: "gateway: gateways.json is not usable - fix it by hand, then re-run kya start",
|
|
69
69
|
};
|
|
70
70
|
}
|
|
71
71
|
const importedIds = imported.map((s) => s.id);
|
|
@@ -77,7 +77,7 @@ export async function bootstrapGate(config, input) {
|
|
|
77
77
|
backups: [],
|
|
78
78
|
rewiredHosts: [],
|
|
79
79
|
warnings,
|
|
80
|
-
summary: "gateway: no third-party MCP servers found
|
|
80
|
+
summary: "gateway: no third-party MCP servers found - add one to any host config and re-run kya start",
|
|
81
81
|
};
|
|
82
82
|
}
|
|
83
83
|
const ensure = input.deps?.ensureBinary ?? ((e) => ensureGateBinary({ env: e }));
|
|
@@ -85,7 +85,7 @@ export async function bootstrapGate(config, input) {
|
|
|
85
85
|
await ensure(env);
|
|
86
86
|
}
|
|
87
87
|
catch (err) {
|
|
88
|
-
warnings.push(`gateway binary could not be installed (${errMsg(err)})
|
|
88
|
+
warnings.push(`gateway binary could not be installed (${errMsg(err)}) - continuing without the gateway; host configs untouched`);
|
|
89
89
|
return {
|
|
90
90
|
imported: importedIds,
|
|
91
91
|
serverCount: servers.length,
|
|
@@ -93,7 +93,7 @@ export async function bootstrapGate(config, input) {
|
|
|
93
93
|
backups: [],
|
|
94
94
|
rewiredHosts: [],
|
|
95
95
|
warnings,
|
|
96
|
-
summary: `gateway: ${servers.length} server${servers.length === 1 ? "" : "s"} configured but the binary is unavailable (offline?)
|
|
96
|
+
summary: `gateway: ${servers.length} server${servers.length === 1 ? "" : "s"} configured but the binary is unavailable (offline?) - re-run kya start when online`,
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
99
|
const runGate = input.deps?.runGate ?? ((c, e) => runGateRun(c, { env: e }));
|
|
@@ -102,7 +102,7 @@ export async function bootstrapGate(config, input) {
|
|
|
102
102
|
run = await runGate(config, env);
|
|
103
103
|
}
|
|
104
104
|
catch (err) {
|
|
105
|
-
warnings.push(`gateway failed to start (${errMsg(err)})
|
|
105
|
+
warnings.push(`gateway failed to start (${errMsg(err)}) - continuing without it; host configs untouched`);
|
|
106
106
|
return {
|
|
107
107
|
imported: importedIds,
|
|
108
108
|
serverCount: servers.length,
|
|
@@ -110,7 +110,7 @@ export async function bootstrapGate(config, input) {
|
|
|
110
110
|
backups: [],
|
|
111
111
|
rewiredHosts: [],
|
|
112
112
|
warnings,
|
|
113
|
-
summary: "gateway: configured but the listener did not come up
|
|
113
|
+
summary: "gateway: configured but the listener did not come up - see `kya gate doctor`",
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
116
|
// Route only entries the gateway actually imported from that host: the gate
|
|
@@ -143,13 +143,13 @@ export async function bootstrapGate(config, input) {
|
|
|
143
143
|
rewiredHosts.push(host);
|
|
144
144
|
}
|
|
145
145
|
catch (err) {
|
|
146
|
-
warnings.push(`${host}: could not route through the gateway (${errMsg(err)})
|
|
146
|
+
warnings.push(`${host}: could not route through the gateway (${errMsg(err)}) - its existing servers are kept`);
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
const addr = run.url.replace(/^https?:\/\//, "");
|
|
150
150
|
const summary = importedIds.length
|
|
151
151
|
? `gateway: ${importedIds.length} server${importedIds.length === 1 ? "" : "s"} imported (${importedIds.join(", ")}), gateway running on ${addr}` +
|
|
152
|
-
(backups.length ? "
|
|
152
|
+
(backups.length ? " - originals backed up to .kya/backups/" : "")
|
|
153
153
|
: `gateway: running on ${addr} (${servers.length} server${servers.length === 1 ? "" : "s"}: ${servers.map((s) => s.id).join(", ")})`;
|
|
154
154
|
return {
|
|
155
155
|
imported: importedIds,
|
|
@@ -174,12 +174,12 @@ function seedTrailIfEmpty(cwd) {
|
|
|
174
174
|
verdict: "ALLOW",
|
|
175
175
|
reasonCode: "ALLOW",
|
|
176
176
|
mode: "observe",
|
|
177
|
-
summary: "KYA started
|
|
177
|
+
summary: "KYA started - wire MCP in your host, then wrap tools here",
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
/**
|
|
181
181
|
* Config dirs that count as evidence a host is installed even before its
|
|
182
|
-
* config file exists (home dir itself never counts
|
|
182
|
+
* config file exists (home dir itself never counts - ~/.claude.json's parent
|
|
183
183
|
* is ~). Any other host qualifies only when its config file already exists.
|
|
184
184
|
*/
|
|
185
185
|
const EVIDENCE_DIRS = {
|
|
@@ -285,8 +285,8 @@ export async function runStart(config, input = {}) {
|
|
|
285
285
|
running: false,
|
|
286
286
|
backups: [],
|
|
287
287
|
rewiredHosts: [],
|
|
288
|
-
warnings: [`gateway bootstrap failed (${errMsg(err)})
|
|
289
|
-
summary: "gateway: bootstrap failed
|
|
288
|
+
warnings: [`gateway bootstrap failed (${errMsg(err)}) - continuing without it`],
|
|
289
|
+
summary: "gateway: bootstrap failed - kya start continues without the gateway",
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
292
|
}
|
|
@@ -327,10 +327,10 @@ export async function runStart(config, input = {}) {
|
|
|
327
327
|
reportPid,
|
|
328
328
|
reportReused,
|
|
329
329
|
next: `${hostNotes} ` +
|
|
330
|
-
"The report runs in the background
|
|
330
|
+
"The report runs in the background - reopen with `kya receipt --open`, " +
|
|
331
331
|
"stop with `kya stop`." +
|
|
332
332
|
(hooksWired.length
|
|
333
|
-
? " Hooks take effect in new sessions
|
|
333
|
+
? " Hooks take effect in new sessions - claude, grok, and kimi all load hooks at session start."
|
|
334
334
|
: ""),
|
|
335
335
|
};
|
|
336
336
|
}
|
|
@@ -343,7 +343,7 @@ export function formatStartHuman(r) {
|
|
|
343
343
|
? `wired hosts: ${r.wiredHosts.map((h) => `${h.label} (${h.path})`).join(", ")}`
|
|
344
344
|
: undefined,
|
|
345
345
|
r.hooksWired.length
|
|
346
|
-
? `hooks: ${r.hooksWired.map((h) => h.label).join(", ")} (PreToolUse interception
|
|
346
|
+
? `hooks: ${r.hooksWired.map((h) => h.label).join(", ")} (PreToolUse interception - applies to new sessions)`
|
|
347
347
|
: undefined,
|
|
348
348
|
r.gate ? r.gate.summary : undefined,
|
|
349
349
|
...(r.gate?.warnings.map((w) => `gateway warning: ${w}`) ?? []),
|
package/dist/commands/stop.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `kya stop`
|
|
2
|
+
* `kya stop` - stop the background live-receipt server started by `kya start`.
|
|
3
3
|
* `--all` additionally sweeps orphaned `receipt-serve` daemons from other
|
|
4
4
|
* cwds or older installs that the cwd state file does not know about.
|
|
5
5
|
*/
|
package/dist/commands/stop.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `kya stop`
|
|
2
|
+
* `kya stop` - stop the background live-receipt server started by `kya start`.
|
|
3
3
|
* `--all` additionally sweeps orphaned `receipt-serve` daemons from other
|
|
4
4
|
* cwds or older installs that the cwd state file does not know about.
|
|
5
5
|
*/
|
|
@@ -23,7 +23,7 @@ export async function runStop(cwd, options = {}) {
|
|
|
23
23
|
let stale = false;
|
|
24
24
|
if (state) {
|
|
25
25
|
if (pidAlive(state.pid) && !isReceiptDaemonProcess(state.pid)) {
|
|
26
|
-
// Planted or recycled pid
|
|
26
|
+
// Planted or recycled pid - never signal a foreign process.
|
|
27
27
|
clearDaemonState(cwd);
|
|
28
28
|
stale = true;
|
|
29
29
|
}
|
|
@@ -43,7 +43,7 @@ export async function runStop(cwd, options = {}) {
|
|
|
43
43
|
if (options.all) {
|
|
44
44
|
const platform = options.platform ?? process.platform;
|
|
45
45
|
if (platform === "win32") {
|
|
46
|
-
// tasklist exposes no command lines, so orphans cannot be identified
|
|
46
|
+
// tasklist exposes no command lines, so orphans cannot be identified -
|
|
47
47
|
// report the limitation instead of claiming none are running.
|
|
48
48
|
sweepUnsupported = true;
|
|
49
49
|
extraStopped = [];
|
|
@@ -64,7 +64,7 @@ export async function runStop(cwd, options = {}) {
|
|
|
64
64
|
extraStopped = extra;
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
// --all also stops the local gateway (kya gate run)
|
|
67
|
+
// --all also stops the local gateway (kya gate run) - supervisor, binary
|
|
68
68
|
// child, plus orphan sweeps of stray gate-serve supervisors and kya-gate
|
|
69
69
|
// binaries.
|
|
70
70
|
let gateStopped = false;
|
|
@@ -104,13 +104,13 @@ export async function runStop(cwd, options = {}) {
|
|
|
104
104
|
export function formatStopHuman(r) {
|
|
105
105
|
const lines = [];
|
|
106
106
|
if (r.stale) {
|
|
107
|
-
lines.push(`state file was stale (pid ${r.pid} is not the report server)
|
|
107
|
+
lines.push(`state file was stale (pid ${r.pid} is not the report server) - cleared it`);
|
|
108
108
|
}
|
|
109
109
|
else {
|
|
110
110
|
lines.push(r.stopped ? `stopped report server (pid ${r.pid})` : "no report server running");
|
|
111
111
|
}
|
|
112
112
|
if (r.sweepUnsupported) {
|
|
113
|
-
lines.push("sweep of other receipt daemons is not supported on this platform (win32)
|
|
113
|
+
lines.push("sweep of other receipt daemons is not supported on this platform (win32) - any orphans must be stopped manually");
|
|
114
114
|
}
|
|
115
115
|
else if (r.extraStopped) {
|
|
116
116
|
lines.push(r.extraStopped.length > 0
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export type PackageManager = "npm" | "pnpm" | "yarn" | "volta" | "npx" | "unknown";
|
|
2
|
+
export interface UpdateCommandIo {
|
|
3
|
+
readonly log: (msg: string) => void;
|
|
4
|
+
readonly error: (msg: string) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function detectPackageManager(execPath: string): PackageManager;
|
|
7
|
+
export declare function buildInstallCommand(manager: PackageManager): {
|
|
8
|
+
command: string;
|
|
9
|
+
args: readonly string[];
|
|
10
|
+
hint?: string;
|
|
11
|
+
} | null;
|
|
12
|
+
export declare function manualUpdateCommand(): string;
|
|
13
|
+
export interface UpdateCommandDeps {
|
|
14
|
+
readonly execPath?: string;
|
|
15
|
+
readonly run?: (command: string, args: readonly string[]) => Promise<number>;
|
|
16
|
+
readonly io?: UpdateCommandIo;
|
|
17
|
+
}
|
|
18
|
+
export declare function runUpdate(deps?: UpdateCommandDeps): Promise<number>;
|
|
19
|
+
//# sourceMappingURL=update.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update.d.ts","sourceRoot":"","sources":["../../src/commands/update.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,cAAc,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,SAAS,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,QAAQ,CAAC,KAAK,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAC;CACvC;AAOD,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,cAAc,CAuBrE;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,cAAc,GAAG;IAC5D,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,SAAS,MAAM,EAAE,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,GAAG,IAAI,CAmBP;AAED,wBAAgB,mBAAmB,IAAI,MAAM,CAE5C;AAUD,MAAM,WAAW,iBAAiB;IAChC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,MAAM,EAAE,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7E,QAAQ,CAAC,EAAE,CAAC,EAAE,eAAe,CAAC;CAC/B;AAED,wBAAsB,SAAS,CAAC,IAAI,GAAE,iBAAsB,GAAG,OAAO,CAAC,MAAM,CAAC,CA0B7E"}
|