@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.
Files changed (239) hide show
  1. package/.mcp.json +1 -1
  2. package/README.md +72 -30
  3. package/amp/settings.example.json +1 -1
  4. package/claude/claude_desktop_config.example.json +1 -1
  5. package/cline/cline_mcp_settings.example.json +1 -1
  6. package/copilot/mcp-config.example.json +1 -1
  7. package/dist/certify/attest.js +5 -5
  8. package/dist/certify/catalog.d.ts +1 -1
  9. package/dist/certify/catalog.js +3 -3
  10. package/dist/certify/context.js +1 -1
  11. package/dist/certify/evaluate.d.ts +2 -2
  12. package/dist/certify/evaluate.js +12 -12
  13. package/dist/certify/live.js +2 -2
  14. package/dist/certify/render.d.ts +1 -1
  15. package/dist/certify/render.js +10 -10
  16. package/dist/cli.d.ts +2 -2
  17. package/dist/cli.d.ts.map +1 -1
  18. package/dist/cli.js +49 -16
  19. package/dist/cli.js.map +1 -1
  20. package/dist/commands/certify.d.ts +1 -1
  21. package/dist/commands/certify.js +3 -3
  22. package/dist/commands/connect.d.ts +2 -2
  23. package/dist/commands/connect.js +22 -22
  24. package/dist/commands/dash.js +4 -4
  25. package/dist/commands/gate-serve.js +3 -3
  26. package/dist/commands/gate.d.ts +1 -1
  27. package/dist/commands/gate.js +16 -16
  28. package/dist/commands/hook.d.ts +1 -1
  29. package/dist/commands/hook.d.ts.map +1 -1
  30. package/dist/commands/hook.js +55 -18
  31. package/dist/commands/hook.js.map +1 -1
  32. package/dist/commands/import-traces.d.ts +16 -0
  33. package/dist/commands/import-traces.d.ts.map +1 -0
  34. package/dist/commands/import-traces.js +18 -0
  35. package/dist/commands/import-traces.js.map +1 -0
  36. package/dist/commands/init.js +1 -1
  37. package/dist/commands/investigate.d.ts +13 -0
  38. package/dist/commands/investigate.d.ts.map +1 -0
  39. package/dist/commands/investigate.js +22 -0
  40. package/dist/commands/investigate.js.map +1 -0
  41. package/dist/commands/notify-flush.d.ts +2 -0
  42. package/dist/commands/notify-flush.d.ts.map +1 -0
  43. package/dist/commands/notify-flush.js +47 -0
  44. package/dist/commands/notify-flush.js.map +1 -0
  45. package/dist/commands/orr.d.ts +3 -3
  46. package/dist/commands/orr.js +5 -5
  47. package/dist/commands/receipt-serve.d.ts +1 -1
  48. package/dist/commands/receipt-serve.js +1 -1
  49. package/dist/commands/serve-mcp.js +1 -1
  50. package/dist/commands/start.d.ts +2 -2
  51. package/dist/commands/start.js +20 -20
  52. package/dist/commands/stop.d.ts +1 -1
  53. package/dist/commands/stop.js +6 -6
  54. package/dist/commands/update.d.ts +19 -0
  55. package/dist/commands/update.d.ts.map +1 -0
  56. package/dist/commands/update.js +96 -0
  57. package/dist/commands/update.js.map +1 -0
  58. package/dist/commands/wire-hooks.d.ts +1 -1
  59. package/dist/commands/wire-hooks.js +14 -14
  60. package/dist/commands/wrap.d.ts.map +1 -1
  61. package/dist/commands/wrap.js +12 -7
  62. package/dist/commands/wrap.js.map +1 -1
  63. package/dist/config.d.ts +4 -4
  64. package/dist/config.js +5 -5
  65. package/dist/dash/dash.d.ts +1 -1
  66. package/dist/dash/dash.js +3 -3
  67. package/dist/dash/entitlement.d.ts +1 -1
  68. package/dist/dash/entitlement.js +1 -1
  69. package/dist/dash/render.js +2 -2
  70. package/dist/dash/screens/enterprise.js +9 -9
  71. package/dist/dash/screens/free.js +5 -5
  72. package/dist/diff-preview.d.ts +1 -1
  73. package/dist/diff-preview.js +2 -2
  74. package/dist/errors.d.ts +1 -1
  75. package/dist/errors.js +1 -1
  76. package/dist/fs-atomic.d.ts +1 -1
  77. package/dist/fs-atomic.js +2 -2
  78. package/dist/gate/binary.js +4 -4
  79. package/dist/gate/config-gen.d.ts +1 -1
  80. package/dist/gate/config-gen.js +7 -7
  81. package/dist/gate/config.d.ts +2 -2
  82. package/dist/gate/config.js +6 -6
  83. package/dist/gate/daemon.js +1 -1
  84. package/dist/gate/discover.d.ts +2 -2
  85. package/dist/gate/discover.js +7 -7
  86. package/dist/gate/hosted-sync.js +1 -1
  87. package/dist/gate/otlp-decode.d.ts +2 -2
  88. package/dist/gate/otlp-decode.js +2 -2
  89. package/dist/gate/otlp-receiver.d.ts +1 -1
  90. package/dist/gate/otlp-receiver.js +3 -3
  91. package/dist/host-reload.js +11 -11
  92. package/dist/host-tools.d.ts +1 -1
  93. package/dist/host-tools.js +1 -1
  94. package/dist/importers/formats.d.ts +26 -0
  95. package/dist/importers/formats.d.ts.map +1 -0
  96. package/dist/importers/formats.js +281 -0
  97. package/dist/importers/formats.js.map +1 -0
  98. package/dist/importers/index.d.ts +26 -0
  99. package/dist/importers/index.d.ts.map +1 -0
  100. package/dist/importers/index.js +122 -0
  101. package/dist/importers/index.js.map +1 -0
  102. package/dist/index.d.ts +1 -1
  103. package/dist/index.js +1 -1
  104. package/dist/investigate/detectors.d.ts +35 -0
  105. package/dist/investigate/detectors.d.ts.map +1 -0
  106. package/dist/investigate/detectors.js +277 -0
  107. package/dist/investigate/detectors.js.map +1 -0
  108. package/dist/investigate/fix-brief.d.ts +3 -0
  109. package/dist/investigate/fix-brief.d.ts.map +1 -0
  110. package/dist/investigate/fix-brief.js +88 -0
  111. package/dist/investigate/fix-brief.js.map +1 -0
  112. package/dist/investigate/incidents.d.ts +19 -0
  113. package/dist/investigate/incidents.d.ts.map +1 -0
  114. package/dist/investigate/incidents.js +84 -0
  115. package/dist/investigate/incidents.js.map +1 -0
  116. package/dist/investigate/index.d.ts +25 -0
  117. package/dist/investigate/index.d.ts.map +1 -0
  118. package/dist/investigate/index.js +46 -0
  119. package/dist/investigate/index.js.map +1 -0
  120. package/dist/mcp/protocol.d.ts +2 -2
  121. package/dist/mcp/protocol.d.ts.map +1 -1
  122. package/dist/mcp/protocol.js +39 -8
  123. package/dist/mcp/protocol.js.map +1 -1
  124. package/dist/mcp/stdio.d.ts +1 -1
  125. package/dist/mcp/stdio.js +2 -2
  126. package/dist/mcp-servers.d.ts +2 -2
  127. package/dist/mcp-servers.js +2 -2
  128. package/dist/node-upgrade.d.ts +2 -2
  129. package/dist/node-upgrade.js +9 -9
  130. package/dist/notify/dispatch.d.ts +20 -0
  131. package/dist/notify/dispatch.d.ts.map +1 -0
  132. package/dist/notify/dispatch.js +52 -0
  133. package/dist/notify/dispatch.js.map +1 -0
  134. package/dist/notify/index.d.ts +39 -0
  135. package/dist/notify/index.d.ts.map +1 -0
  136. package/dist/notify/index.js +119 -0
  137. package/dist/notify/index.js.map +1 -0
  138. package/dist/notify/sender.d.ts +56 -0
  139. package/dist/notify/sender.d.ts.map +1 -0
  140. package/dist/notify/sender.js +139 -0
  141. package/dist/notify/sender.js.map +1 -0
  142. package/dist/notify/templates.d.ts +33 -0
  143. package/dist/notify/templates.d.ts.map +1 -0
  144. package/dist/notify/templates.js +119 -0
  145. package/dist/notify/templates.js.map +1 -0
  146. package/dist/offline-evaluate.d.ts +2 -2
  147. package/dist/offline-evaluate.js +3 -3
  148. package/dist/orr/agentshield.d.ts +2 -2
  149. package/dist/orr/agentshield.js +4 -4
  150. package/dist/orr/scorecard.d.ts +1 -1
  151. package/dist/orr/scorecard.js +3 -3
  152. package/dist/otel/exporter.d.ts +64 -0
  153. package/dist/otel/exporter.d.ts.map +1 -0
  154. package/dist/otel/exporter.js +243 -0
  155. package/dist/otel/exporter.js.map +1 -0
  156. package/dist/parse-args.d.ts +1 -1
  157. package/dist/parse-args.js +1 -1
  158. package/dist/receipt/auto-open.d.ts +1 -1
  159. package/dist/receipt/auto-open.js +1 -1
  160. package/dist/receipt/daemon.d.ts +6 -6
  161. package/dist/receipt/daemon.js +15 -15
  162. package/dist/receipt/dashboard.d.ts +1 -1
  163. package/dist/receipt/dashboard.js +2 -2
  164. package/dist/receipt/embeddings.d.ts +15 -4
  165. package/dist/receipt/embeddings.d.ts.map +1 -1
  166. package/dist/receipt/embeddings.js +116 -35
  167. package/dist/receipt/embeddings.js.map +1 -1
  168. package/dist/receipt/enrich.d.ts +2 -2
  169. package/dist/receipt/enrich.js +5 -5
  170. package/dist/receipt/gate-card.d.ts +2 -2
  171. package/dist/receipt/gate-card.d.ts.map +1 -1
  172. package/dist/receipt/gate-card.js +3 -3
  173. package/dist/receipt/live-server.d.ts.map +1 -1
  174. package/dist/receipt/live-server.js +22 -8
  175. package/dist/receipt/live-server.js.map +1 -1
  176. package/dist/receipt/receipt-css.d.ts +1 -1
  177. package/dist/receipt/receipt-css.d.ts.map +1 -1
  178. package/dist/receipt/receipt-css.js +72 -11
  179. package/dist/receipt/receipt-css.js.map +1 -1
  180. package/dist/receipt/render-receipt.d.ts +1 -1
  181. package/dist/receipt/render-receipt.d.ts.map +1 -1
  182. package/dist/receipt/render-receipt.js +138 -87
  183. package/dist/receipt/render-receipt.js.map +1 -1
  184. package/dist/receipt/share.d.ts +2 -2
  185. package/dist/receipt/share.js +5 -5
  186. package/dist/sample-tools.d.ts +1 -1
  187. package/dist/sample-tools.js +1 -1
  188. package/dist/sandbox/mock-driver.d.ts +1 -1
  189. package/dist/sandbox/mock-driver.js +1 -1
  190. package/dist/sdk/a2a.d.ts +2 -2
  191. package/dist/sdk/a2a.js +1 -1
  192. package/dist/sdk/adapters/claude-agent.d.ts +1 -1
  193. package/dist/sdk/adapters/claude-agent.js +1 -1
  194. package/dist/sdk/adapters/langgraph.d.ts +1 -1
  195. package/dist/sdk/adapters/langgraph.js +1 -1
  196. package/dist/sdk/adapters/mastra.d.ts +1 -1
  197. package/dist/sdk/adapters/mastra.js +1 -1
  198. package/dist/sdk/adapters/openai-agents.d.ts +1 -1
  199. package/dist/sdk/adapters/openai-agents.js +1 -1
  200. package/dist/sdk/adapters/vercel-ai.d.ts +2 -2
  201. package/dist/sdk/adapters/vercel-ai.js +1 -1
  202. package/dist/sdk/govern.d.ts +2 -2
  203. package/dist/sdk/govern.js +3 -3
  204. package/dist/sdk/index.d.ts +1 -1
  205. package/dist/sdk/index.js +1 -1
  206. package/dist/showback/trail-usage.d.ts +30 -0
  207. package/dist/showback/trail-usage.d.ts.map +1 -0
  208. package/dist/showback/trail-usage.js +50 -0
  209. package/dist/showback/trail-usage.js.map +1 -0
  210. package/dist/sign/evidence-bundle.d.ts +6 -6
  211. package/dist/sign/evidence-bundle.js +5 -5
  212. package/dist/star-cta.d.ts +1 -1
  213. package/dist/star-cta.d.ts.map +1 -1
  214. package/dist/star-cta.js +3 -3
  215. package/dist/trail-summary.d.ts +1 -1
  216. package/dist/trail-summary.js +3 -3
  217. package/dist/trail.d.ts +8 -2
  218. package/dist/trail.d.ts.map +1 -1
  219. package/dist/trail.js +18 -5
  220. package/dist/trail.js.map +1 -1
  221. package/dist/update-check.d.ts +17 -0
  222. package/dist/update-check.d.ts.map +1 -0
  223. package/dist/update-check.js +134 -0
  224. package/dist/update-check.js.map +1 -0
  225. package/droid/README.md +1 -1
  226. package/droid/mcp.example.json +1 -1
  227. package/gemini/settings.example.json +1 -1
  228. package/grok/README.md +1 -1
  229. package/kilo/kilo.example.json +1 -1
  230. package/kimi/mcp.example.json +1 -1
  231. package/kiro/mcp.example.json +1 -1
  232. package/manifest.json +1 -1
  233. package/mastracode/mcp.example.json +1 -1
  234. package/mcp.json +1 -1
  235. package/openai/codex.config.example.toml +1 -1
  236. package/opencode/opencode.example.json +1 -1
  237. package/package.json +2 -2
  238. package/qwen/settings.example.json +1 -1
  239. package/server.json +2 -2
@@ -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 — never clobber. The gateway bootstrap
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 — only when there is something to
42
- * govern — install the binary, start the supervisor, and route the source
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)}) — gateway bootstrap skipped`);
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 — fix it by hand, then re-run kya start",
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 — add one to any host config and re-run kya start",
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)}) — continuing without the gateway; host configs untouched`);
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?) — re-run kya start when online`,
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)}) — continuing without it; host configs untouched`);
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 — see `kya gate doctor`",
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)}) — its existing servers are kept`);
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 ? " — originals backed up to .kya/backups/" : "")
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 — wire MCP in your host, then wrap tools here",
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 — ~/.claude.json's parent
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)}) — continuing without it`],
289
- summary: "gateway: bootstrap failed — kya start continues without the gateway",
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 — reopen with `kya receipt --open`, " +
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 — claude, grok, and kimi all load hooks at session start."
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 — applies to new sessions)`
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}`) ?? []),
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `kya stop` — stop the background live-receipt server started by `kya start`.
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
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * `kya stop` — stop the background live-receipt server started by `kya start`.
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 — never signal a foreign process.
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) — supervisor, binary
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) — cleared it`);
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) — any orphans must be stopped manually");
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"}
@@ -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,KAAK,CAAC,CAAC,CAAC;CAC/B,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAC,QAAgB;IACnD,IAAI,IAAI,GAAG,QAAQ,CAAC;IACpB,IAAI,CAAC;QACH,IAAI,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,iFAAiF;IACnF,CAAC;IACD,MAAM,KAAK,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IACjC,IAAI,KAAK,CAAC,QAAQ,CAAC,QAAQ,CAAC;QAAE,OAAO,OAAO,CAAC;IAC7C,IAAI,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC;IACjG,sFAAsF;IACtF,IACE,KAAK,CAAC,QAAQ,CAAC,aAAa,CAA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AAG,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 — but a literal string cannot hold a single quote or a newline, so
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 — install `kya hook --host <id>` as a PreToolUse hook in a
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) — safe cycle
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 — 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`);
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 — refusing to clobber it`);
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 — refusing to clobber it`);
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 — refusing to clobber it`);
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 — the result would be invalid TOML.
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 — but a literal string cannot hold a single quote or a newline, so
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 — move the kya install to a path without quotes and re-run the hook wiring`);
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 — appending [[hooks]] would produce invalid TOML; fix the config by hand, then re-run the hook wiring`);
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 — quoted variants of our own block still match), --force
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 — not ours to rewrite.
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}" — supported: ${HOOK_HOSTS.join(", ")}`);
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;AAMxB,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,QAA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AAC,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"}
@@ -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
- appendTrail(config.cwd, {
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 — do not execute; wrap never retries around the PEP",
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 — wrap still does not execute the side effect"
71
- : "unknown verdict — treat as blocked",
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 — recorded on trail, no Hold ticket (host still owns OK?). Use --hold or KYA_HOLD=1 for org Hold path",
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} — kya approve --id ${approval.id} (human). wrap does not execute`,
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;AAY3E,oGAAoG;AACpG,MAAM,UAAU,eAAe,CAAC,OAA2B,EAAE,QAAkB;IAC7E,MAAM,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,WAAW,EAAE,CAAC;IACxC,IAAI,CAAC,KAAK,OAAO;QAAE,OAAO,CAAC,CAAC;IAC5B,IAAI,CAAC,KAAK,iBAAiB;QAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IACrD,OAAO,CAAC,CAAC;AACX,CAAC;AAED,MAAM,UA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C,QAAQ,CAAC,MAAM,EAAE;YAC7D,CAAC,CAAC,SAAS;QACb,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,aAAa,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,SAAS;QAChE,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS;QAChD,MAAM,CAAC,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) — no network, no paid cloud. */
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 — no Hold ticket /
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 — home of the global trail. */
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` — a certify "pass — gate mode is hold"
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 — home of the global trail. */
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` — a certify "pass — gate mode is hold"
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 — the same precedence resolveGateMode
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 — no API key required.
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 — refuse silent allow-all against control plane (use --offline for local sample evaluate)");
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");
@@ -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 — production PEP is HTTP. */
54
+ /** Offline sample used by tests - production PEP is HTTP. */
55
55
  export declare function offlinePolicyPair(): {
56
56
  deny: PolicyEvaluateResponse;
57
57
  requireApprove: PolicyEvaluateResponse;