@oked/sdk 0.6.4 → 0.6.6

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.
@@ -1,5 +1,17 @@
1
1
  import type { RiskTier } from "./types.js";
2
2
  export declare function classify(toolName: string, toolInput: Record<string, unknown>): RiskTier;
3
+ /** Split a shell command into top-level segments on the operators that
4
+ * sequence separate commands: `|`, `||`, `&&`, `;`, and a bare newline (a
5
+ * newline separates commands in a multi-line script exactly like `;`).
6
+ * Operators inside quoted strings, command substitutions, and heredoc bodies —
7
+ * including the `"$(cat <<'EOF' … )"` heredoc form used for commit messages —
8
+ * are kept intact so message text isn't split. A backslash-escaped newline is a
9
+ * line continuation, not a separator. Returns trimmed, non-empty segments.
10
+ * With `pipes: false`, a pipeline (`a | b`) stays one segment: the card text
11
+ * reads a pipeline as one step (`printf … | himalaya message send`). */
12
+ export declare function splitTopLevel(cmd: string, opts?: {
13
+ pipes?: boolean;
14
+ }): string[];
3
15
  export type ShellWriteKind = "create" | "append" | "edit" | "touch" | "copy" | "move";
4
16
  export interface ShellWriteOp {
5
17
  kind: ShellWriteKind;
package/dist/classify.js CHANGED
@@ -218,6 +218,13 @@ const HIGH_STAKES_STAGE = [
218
218
  /^killall\b/,
219
219
  // Wide-open permissions.
220
220
  /^chmod\s+(?:-\S+\s+)*777\b/,
221
+ // GitHub CLI: merging a PR changes the base branch for everyone (and often
222
+ // deploys); deletes and archives can't be undone from here.
223
+ /^gh\s+pr\s+merge\b/,
224
+ /^gh\s+(?:repo|release|issue|label|gist|secret|variable|cache|run|ruleset)\s+delete\b/,
225
+ /^gh\s+repo\s+archive\b/,
226
+ // Railway deploys and tear-downs change a live service.
227
+ /^railway\s+(?:up|deploy|redeploy|down|delete)\b/,
221
228
  ];
222
229
  // curl request-method / request-body flags, scanned PER-STAGE (a single stage
223
230
  // has no top-level pipe, so `\bcurl\b.*` can't cross into another command — the
@@ -241,7 +248,34 @@ const HIGH_STAKES_CURL_STAGE = [
241
248
  // message delete, folder purge — are high_stakes in the full scan above.)
242
249
  const REVIEW_COMMANDS = [
243
250
  /^himalaya\s+message\s+(send|reply|forward)\b/,
251
+ // GitHub CLI writes other people see (comments, reviews, issues, releases)
252
+ // or that change the repo's settings and CI. They can be edited or undone.
253
+ /^gh\s+pr\s+(?:close|reopen|comment|review|edit|ready|lock|unlock)\b/,
254
+ /^gh\s+issue\s+(?:create|close|reopen|comment|edit|transfer|lock|unlock|pin|unpin)\b/,
255
+ /^gh\s+release\s+(?:create|edit|upload)\b/,
256
+ /^gh\s+repo\s+(?:create|edit|rename|fork)\b/,
257
+ /^gh\s+(?:secret|variable)\s+set\b/,
258
+ /^gh\s+workflow\s+(?:run|enable|disable)\b/,
259
+ /^gh\s+run\s+(?:cancel|rerun)\b/,
260
+ /^gh\s+(?:gist|label)\s+(?:create|edit)\b/,
244
261
  ];
262
+ /**
263
+ * `gh api` is curl for GitHub: a mutating method, or fields without a method
264
+ * (gh then sends a POST), is an outward write like a curl POST. A GraphQL call
265
+ * is a write only when it holds a mutation. Returns null for other commands.
266
+ */
267
+ function classifyGhApiStage(stage) {
268
+ if (!/^gh\s+api\b/.test(stage))
269
+ return null;
270
+ const method = stage.match(/\s(?:-X|--method)(?:\s+|=)?([A-Za-z]+)\b/)?.[1]?.toUpperCase();
271
+ if (method && method !== "GET" && method !== "HEAD")
272
+ return "high_stakes";
273
+ if (/^gh\s+api\s+graphql\b/.test(stage))
274
+ return /\bmutation\b/.test(stage) ? "high_stakes" : "safe";
275
+ if (!method && /\s(?:-f|-F|--field|--raw-field|--input)(?:\s|=)/.test(stage))
276
+ return "high_stakes";
277
+ return "safe";
278
+ }
245
279
  // Local-mutation MARKERS for DETECTED side effects. These never gate a prompt —
246
280
  // under the effect-based model anything not flagged destructive/outward/sensitive
247
281
  // already auto-allows. They exist only to pick the `warning` (logged) vs `safe`
@@ -437,8 +471,11 @@ function maxTier(a, b) {
437
471
  * Operators inside quoted strings, command substitutions, and heredoc bodies —
438
472
  * including the `"$(cat <<'EOF' … )"` heredoc form used for commit messages —
439
473
  * are kept intact so message text isn't split. A backslash-escaped newline is a
440
- * line continuation, not a separator. Returns trimmed, non-empty segments. */
441
- function splitTopLevel(cmd) {
474
+ * line continuation, not a separator. Returns trimmed, non-empty segments.
475
+ * With `pipes: false`, a pipeline (`a | b`) stays one segment: the card text
476
+ * reads a pipeline as one step (`printf … | himalaya message send`). */
477
+ export function splitTopLevel(cmd, opts = {}) {
478
+ const splitPipes = opts.pipes !== false;
442
479
  const out = [];
443
480
  let cur = "";
444
481
  let quote = null;
@@ -510,7 +547,7 @@ function splitTopLevel(cmd) {
510
547
  i += 2; // consume both operator chars
511
548
  continue;
512
549
  }
513
- if (ch === "|" || ch === ";") {
550
+ if (ch === ";" || (ch === "|" && splitPipes)) {
514
551
  out.push(cur.trim());
515
552
  cur = "";
516
553
  i++;
@@ -890,6 +927,9 @@ function classifyStageShellEffects(stage, ephemeralVars = new Set()) {
890
927
  return isLoopbackHttpStage(stage) ? "warning" : "high_stakes";
891
928
  }
892
929
  }
930
+ const ghApiTier = classifyGhApiStage(bareStage);
931
+ if (ghApiTier !== null)
932
+ return ghApiTier;
893
933
  // Variable assignments: `NAME=value` (pure) or `NAME=$(cmd) rest` (env prefix
894
934
  // / capture). Classify the command-substitution inners and any trailing
895
935
  // command; a purely literal assignment is safe. Dangerous substitutions were
@@ -1389,6 +1429,8 @@ const CCD_SAFE_TOOLS = new Map([
1389
1429
  ["ccd_pr", new Set(["bind_pr", "unbind_pr"])],
1390
1430
  ["ccd_view", new Set(["show_pane", "close_pane", "set_transcript_view"])],
1391
1431
  ["ccd_session", new Set(["spawn_task"])],
1432
+ // The task list under Claude's message and the end-of-turn summary box.
1433
+ ["ccd_turn", new Set(["update_plan", "wrap_up"])],
1392
1434
  ["ccd_window", new Set(["open_session_in", "close_split", "set_sidebar_collapsed"])],
1393
1435
  ["ccd_sidebar", new Set([
1394
1436
  "create_group", "create_section", "rename_group", "rename_section",
@@ -1438,6 +1480,13 @@ function classifyMcpTool(toolName, toolInput = {}) {
1438
1480
  // but each push is gated on its own. Log it, no prompt.
1439
1481
  if (parts.includes("ccd_pr") && tool === "set_monitor")
1440
1482
  return "warning";
1483
+ // Start a new local Claude session, or move this task into one. Its own tool
1484
+ // calls are gated by OKed like this one's, so log it, no prompt. A cloud or
1485
+ // SSH session runs outside this machine's hook, so it stays `review`.
1486
+ if (parts.includes("ccd_session") && (tool === "start_session" || tool === "hand_off_to_session")) {
1487
+ const target = toolInput.target;
1488
+ return target === undefined || target === "local" ? "warning" : "review";
1489
+ }
1441
1490
  if (parts.length === 3 && isClaudeDocsWrite(parts[1] || "", tool, toolInput))
1442
1491
  return "warning";
1443
1492
  const browserServer = parts.slice(1, -1).find((p) => BROWSER_MCP_SERVERS.has(p));
package/dist/describe.js CHANGED
@@ -9,7 +9,8 @@
9
9
  */
10
10
  import { existsSync, readFileSync, readdirSync } from "node:fs";
11
11
  import { basename, isAbsolute, join, resolve } from "node:path";
12
- import { extractShellWriteOps } from "./classify.js";
12
+ import { classify, extractShellWriteOps, splitTopLevel } from "./classify.js";
13
+ import { TIER_ORDER } from "./degraded.js";
13
14
  const BODY_PREVIEW_MAX = 200;
14
15
  const COMMAND_INLINE_MAX = 50;
15
16
  const DIFF_HUNK_MAX_LINES = 10;
@@ -94,15 +95,19 @@ function summarize(toolName, toolInput, ctx) {
94
95
  * command isn't a mutating HTTP request. Headlines the outward request ahead of
95
96
  * an incidental file redirect in a compound command.
96
97
  */
97
- function summarizeMutatingCurl(cmd) {
98
- if (!/\b(?:curl|wget)\b/.test(cmd))
98
+ function summarizeMutatingCurl(command) {
99
+ if (!/\b(?:curl|wget)\b/.test(command))
99
100
  return null;
101
+ // Read flags from the curl/wget step only: a `--json` or `-d` on another step
102
+ // (`gh pr view --json state`, `unzip -d dir`) is not this request's body.
103
+ const steps = splitTopLevel(command);
104
+ const step = steps.find((s) => /\b(?:curl|wget)\b/.test(s) && isMutatingCurlStep(s));
105
+ if (!step)
106
+ return null;
107
+ const cmd = ` ${step}`;
100
108
  // `(?:^|\s)` not `\b`: `-X` is preceded by whitespace, and `\b` requires a
101
109
  // word char before the `-`, so `\b-X` never matches the usual ` -X DELETE`.
102
110
  const methodM = cmd.match(/(?:^|\s)-X\s*(DELETE|POST|PUT|PATCH)\b|(?:^|\s)--request[=\s]+(DELETE|POST|PUT|PATCH)\b/i);
103
- const hasBody = /\s-d[\s=]|\s--data(?:-raw|-binary|-urlencode|-ascii)?[\s=]|\s-F[\s=]|\s--form[\s=]|\s(?:-T|--upload-file)[\s=]|\s--json[\s=]/.test(cmd);
104
- if (!methodM && !hasBody)
105
- return null;
106
111
  const method = (methodM?.[1] || methodM?.[2] || "POST").toUpperCase();
107
112
  const url = cmd.match(/https?:\/\/[^\s'"]+/)?.[0] || "";
108
113
  const host = url ? extractHost(url) : "URL";
@@ -117,10 +122,15 @@ function summarizeMutatingCurl(cmd) {
117
122
  target: endpoint,
118
123
  body: payload !== undefined
119
124
  ? truncateBody(payload)
120
- : cmd.length > COMMAND_INLINE_MAX ? truncateBody(cmd) : undefined,
125
+ : command.length > COMMAND_INLINE_MAX ? truncateBody(command) : undefined,
121
126
  kind,
122
127
  };
123
128
  }
129
+ function isMutatingCurlStep(step) {
130
+ const s = ` ${step}`;
131
+ return /(?:^|\s)-X\s*(DELETE|POST|PUT|PATCH)\b|(?:^|\s)--request[=\s]+(DELETE|POST|PUT|PATCH)\b/i.test(s) ||
132
+ /\s-d[\s=]|\s--data(?:-raw|-binary|-urlencode|-ascii)?[\s=]|\s-F[\s=]|\s--form[\s=]|\s(?:-T|--upload-file)[\s=]|\s--json[\s=]/.test(s);
133
+ }
124
134
  /** Path (+ query) of a URL, or undefined for a bare origin. */
125
135
  function extractPath(url) {
126
136
  try {
@@ -132,18 +142,38 @@ function extractPath(url) {
132
142
  return undefined;
133
143
  }
134
144
  }
135
- /** The value of the first curl request-body flag (-d, --data*, --json, -F, --form). */
145
+ /**
146
+ * The request body curl sends, from every body flag in order: `-d`/`--data*`
147
+ * values joined with `&` (as curl joins them), `--json` values joined as-is,
148
+ * and one line per `-F`/`--form` part. Only the first flag used to count, so
149
+ * `-d charge=ch_1 -d amount=4900` lost the amount.
150
+ */
136
151
  function extractCurlPayload(cmd) {
137
- const m = cmd.match(/\s(?:-d|--data(?:-raw|-binary|-urlencode|-ascii)?|--json|-F|--form)(?:\s+|=)(?:'([^']*)'|"((?:[^"\\]|\\.)*)"|([^\s'"|;&]+))/);
138
- if (!m)
139
- return undefined;
140
- const v = m[1] ?? m[2] ?? m[3];
141
- return v ? v : undefined;
152
+ const data = [];
153
+ const json = [];
154
+ const form = [];
155
+ const re = /\s(-d|--data(?:-raw|-binary|-urlencode|-ascii)?|--json|-F|--form)(?:\s+|=)(?:'([^']*)'|"((?:[^"\\]|\\.)*)"|([^\s'"|;&]+))/g;
156
+ for (const m of cmd.matchAll(re)) {
157
+ const v = m[2] ?? m[3] ?? m[4];
158
+ if (!v)
159
+ continue;
160
+ if (m[1] === "--json")
161
+ json.push(v);
162
+ else if (m[1] === "-F" || m[1] === "--form")
163
+ form.push(v);
164
+ else
165
+ data.push(v);
166
+ }
167
+ const parts = [data.join("&"), json.join(""), form.join("\n")].filter(Boolean);
168
+ return parts.length ? parts.join("\n") : undefined;
142
169
  }
143
170
  function summarizeBash(command, sizeBytes, cwd) {
144
171
  const cmd = (command || "").trim();
145
172
  if (!cmd)
146
173
  return { title: "Run empty command", kind: "unknown_bash" };
174
+ const compound = summarizeCompoundBash(cmd, sizeBytes, cwd);
175
+ if (compound)
176
+ return compound;
147
177
  // SQL detection runs before shell-write detection so that inline-interpreter
148
178
  // payloads (`node -e "..."`, `python -c "..."`) aren't misread as shell
149
179
  // redirects. JS arrow functions (`t => t.name`) and similar `=>` constructs
@@ -222,6 +252,9 @@ function summarizeBash(command, sizeBytes, cwd) {
222
252
  const m = cmd.match(/-m\s+["']([^"'$]+)["']/);
223
253
  return m ? { title: `Git commit "${truncate(m[1], 60)}"`, kind: "git_commit" } : { title: "Git commit", kind: "git_commit" };
224
254
  }
255
+ const gh = summarizeGh(cmd);
256
+ if (gh)
257
+ return gh;
225
258
  // gh pr create — reversible (PRs can be closed). Extract --title when present.
226
259
  if (/\bgh\s+pr\s+create\b/.test(cmd)) {
227
260
  const m = cmd.match(/--title\s+["']([^"']+)["']/);
@@ -292,6 +325,16 @@ function summarizeBash(command, sizeBytes, cwd) {
292
325
  const dockerRm = cmd.match(/\bdocker\s+rm\s+(\S+)/);
293
326
  if (dockerRm)
294
327
  return { title: "Remove Docker container", target: dockerRm[1], kind: "docker_rm" };
328
+ // Railway: deploys and tear-downs of a live service.
329
+ const railway = cmd.match(/\brailway\s+(up|deploy|redeploy|down|delete)\b(.*)$/s);
330
+ if (railway) {
331
+ const service = railway[2].match(/\s(?:-s|--service)[\s=]+(\S+)/)?.[1];
332
+ const env = railway[2].match(/\s(?:-e|--environment)[\s=]+(\S+)/)?.[1];
333
+ const verb = railway[1] === "down" ? "Remove the latest Railway deployment"
334
+ : railway[1] === "delete" ? "Delete the Railway project"
335
+ : railway[1] === "redeploy" ? "Redeploy on Railway" : "Deploy to Railway";
336
+ return { title: verb, target: service, annotation: env ? `(${env})` : undefined, kind: "deploy" };
337
+ }
295
338
  // npm / npx
296
339
  const npmScript = cmd.match(/\bnpm\s+run\s+(\S+)/);
297
340
  if (npmScript)
@@ -319,6 +362,108 @@ function summarizeBash(command, sizeBytes, cwd) {
319
362
  return { title: "Run command", body: truncateBody(cmd), kind: "unknown_bash" };
320
363
  return { title: cmd, kind: "unknown_bash" };
321
364
  }
365
+ /**
366
+ * A command of several steps (`;`, `&&`, `||`, newlines) takes its title from
367
+ * the step that set the tier, so `gh pr merge … ; gh pr view --json … ; curl
368
+ * -X POST …` reads "POST request to api.oked.ai", not a title built from bits
369
+ * of three steps. Other steps that need approval on their own are listed in the
370
+ * subline. Returns null when no step needs approval, or when the tier comes
371
+ * from a pattern that spans steps (`curl … | sh`): the whole-command rules
372
+ * below describe those.
373
+ */
374
+ function summarizeCompoundBash(cmd, sizeBytes, cwd) {
375
+ const steps = splitTopLevel(cmd, { pipes: false });
376
+ if (steps.length < 2)
377
+ return null;
378
+ const tiers = steps.map((s) => classify("Bash", { command: s }));
379
+ const rank = tiers.map((t) => TIER_ORDER[t]);
380
+ const top = Math.max(...rank);
381
+ if (top < TIER_ORDER.review)
382
+ return null;
383
+ if (TIER_ORDER[classify("Bash", { command: cmd })] !== top)
384
+ return null;
385
+ const lead = rank.indexOf(top);
386
+ const step = steps[lead];
387
+ // npm publish reads the package.json a preceding `cd` points at.
388
+ const r = (/\bnpm\s+publish\b/.test(step) && summarizeNpmPublish(cmd, cwd)) || summarizeBash(step, sizeBytes, cwd);
389
+ const also = [...new Set(steps
390
+ .filter((_, i) => i !== lead && rank[i] >= TIER_ORDER.review)
391
+ .map((s) => describeStep(s, cwd)))].filter((t) => t !== describeStep(step, cwd));
392
+ // The body shows the steps that need approval, not the setup and polling
393
+ // around them; the footnote says there are other steps.
394
+ const risky = steps.filter((_, i) => rank[i] >= TIER_ORDER.review);
395
+ const quiet = steps.length - risky.length;
396
+ return {
397
+ ...r,
398
+ subline: also.length ? `Also: ${also.join("; ")}` : r.subline,
399
+ body: r.body ?? truncateBody(risky.join("\n")),
400
+ footnote: r.footnote ?? (quiet ? "Other steps in this command need no approval" : undefined),
401
+ };
402
+ }
403
+ function describeStep(step, cwd) {
404
+ const r = summarizeBash(step, undefined, cwd);
405
+ return r.target && !r.title.includes(r.target) ? `${r.title} ${r.target}` : r.title;
406
+ }
407
+ /** GitHub CLI writes: which PR, issue or release, in which repo. */
408
+ function summarizeGh(cmd) {
409
+ const m = cmd.match(/\bgh\s+(pr|issue|release|repo|workflow|run|secret|variable|api)\s+(\S+)(.*)$/s);
410
+ if (!m)
411
+ return null;
412
+ const [, noun, verb, rest] = m;
413
+ const url = rest.match(/https:\/\/github\.com\/([^/\s]+\/[^/\s]+)\/(?:pull|issues)\/(\d+)/);
414
+ const repoFlag = rest.match(/\s(?:-R|--repo)[\s=]+(\S+)/)?.[1];
415
+ const repo = url?.[1] ?? repoFlag;
416
+ const num = url?.[2] ?? rest.match(/^\s+#?(\d+)\b/)?.[1];
417
+ const ref = num ? `#${num}` : "";
418
+ const where = repo ? ` in ${repo}` : "";
419
+ if (noun === "pr" && verb === "merge") {
420
+ const how = /\s(?:--squash|-s)\b/.test(rest) ? "squash" : /\s(?:--rebase|-r)\b/.test(rest) ? "rebase" : undefined;
421
+ const auto = /\s--auto\b/.test(rest);
422
+ return {
423
+ title: `Merge PR ${ref}${where}`.replace(/\s+/g, " ").trim(),
424
+ annotation: [how, auto ? "when checks pass" : undefined, /\s(?:--delete-branch|-d)\b/.test(rest) ? "deletes branch" : undefined]
425
+ .filter(Boolean).join(", ") || undefined,
426
+ kind: "git_pr_merge",
427
+ };
428
+ }
429
+ if (noun === "api") {
430
+ const args = ` ${verb}${rest}`;
431
+ const method = args.match(/\s(?:-X|--method)(?:\s+|=)?([A-Za-z]+)\b/)?.[1]?.toUpperCase();
432
+ // The endpoint is the first argument that is not a flag or a flag's value.
433
+ const endpoint = args
434
+ .replace(/\s(?:-X|--method|-H|--header|-f|-F|--field|--raw-field|--input|-q|--jq|-t|--template|--hostname|-p|--preview|--cache)(?:\s+|=)(?:'[^']*'|"(?:[^"\\]|\\.)*"|\S+)/g, " ")
435
+ .split(/\s+/).find((w) => w && !w.startsWith("-"))?.replace(/^['"]|['"]$/g, "");
436
+ if (endpoint === "graphql") {
437
+ const mutation = /\bmutation\b/.test(args);
438
+ return { title: mutation ? "Change data via GitHub GraphQL API" : "Query GitHub GraphQL API", body: truncateBody(cmd), kind: mutation ? "http_post" : "http_get" };
439
+ }
440
+ const m2 = method ?? (/\s(?:-f|-F|--field|--raw-field|--input)(?:\s|=)/.test(args) ? "POST" : "GET");
441
+ return {
442
+ title: `${m2} request to GitHub API`,
443
+ target: endpoint,
444
+ body: truncateBody(cmd),
445
+ kind: m2 === "DELETE" ? "http_delete" : m2 === "PUT" ? "http_put" : m2 === "GET" ? "http_get" : "http_post",
446
+ };
447
+ }
448
+ const outward = new Set(["merge", "close", "reopen", "comment", "review", "edit", "ready", "delete", "archive", "rename",
449
+ "create", "upload", "set", "run", "cancel", "rerun", "transfer", "fork", "enable", "disable"]);
450
+ if (!outward.has(verb) || (noun === "pr" && verb === "create"))
451
+ return null;
452
+ const thing = { pr: "PR", issue: "issue", release: "release", repo: "repo", workflow: "workflow", run: "workflow run", secret: "secret", variable: "variable" }[noun] ?? noun;
453
+ const name = noun === "release" || noun === "secret" || noun === "variable" || noun === "workflow"
454
+ ? rest.match(/^\s+([^\s-][^\s]*)/)?.[1] : undefined;
455
+ const body = rest.match(/\s(?:-b|--body)[\s=]+(?:'([^']*)'|"((?:[^"\\]|\\.)*)")/);
456
+ const obj = `${thing}${ref ? ` ${ref}` : name ? ` ${name}` : ""}`;
457
+ const phrase = verb === "comment" ? `Comment on ${obj}`
458
+ : verb === "ready" ? `Mark ${obj} ready for review`
459
+ : verb === "set" ? `Set ${obj}`
460
+ : `${verb.charAt(0).toUpperCase()}${verb.slice(1)} ${obj}`;
461
+ return {
462
+ title: `${phrase}${where}`,
463
+ body: body ? truncateBody(body[1] ?? body[2] ?? "") : undefined,
464
+ kind: noun === "pr" ? "git_pr_write" : "gh_write",
465
+ };
466
+ }
322
467
  /**
323
468
  * `npm publish` → which package and version, dist-tag, access, registry.
324
469
  * Name/version come from the package.json the publish will read: the cwd,
@@ -511,6 +656,105 @@ function sqlFromInterpreterBody(body) {
511
656
  return extracted;
512
657
  return DB_LIBRARY_RE.test(body) ? body : null;
513
658
  }
659
+ /**
660
+ * Shell words of `s` up to the first unquoted operator (| ; & < > or a
661
+ * newline), with quotes removed and `\"`-style escapes resolved. `quoted` marks
662
+ * a word that had a quoted part. Undefined when a quote is never closed.
663
+ */
664
+ function shellWords(s) {
665
+ const words = [];
666
+ let i = 0;
667
+ while (i < s.length) {
668
+ while (i < s.length && (s[i] === " " || s[i] === "\t"))
669
+ i++;
670
+ if (i >= s.length || /[|;&<>\n]/.test(s[i]))
671
+ break;
672
+ let text = "";
673
+ let quoted = false;
674
+ while (i < s.length && !/[\s|;&<>]/.test(s[i])) {
675
+ const c = s[i];
676
+ if (c === "'") {
677
+ const end = s.indexOf("'", i + 1);
678
+ if (end < 0)
679
+ return undefined;
680
+ text += s.slice(i + 1, end);
681
+ i = end + 1;
682
+ quoted = true;
683
+ }
684
+ else if (c === '"') {
685
+ let j = i + 1;
686
+ while (j < s.length && s[j] !== '"') {
687
+ if (s[j] === "\\" && /["\\$`]/.test(s[j + 1] ?? "")) {
688
+ text += s[j + 1];
689
+ j += 2;
690
+ }
691
+ else {
692
+ text += s[j++];
693
+ }
694
+ }
695
+ if (j >= s.length)
696
+ return undefined;
697
+ i = j + 1;
698
+ quoted = true;
699
+ }
700
+ else if (c === "\\" && i + 1 < s.length) {
701
+ text += s[i + 1];
702
+ i += 2;
703
+ }
704
+ else {
705
+ text += c;
706
+ i++;
707
+ }
708
+ }
709
+ words.push({ text, quoted });
710
+ }
711
+ return words;
712
+ }
713
+ // The flag that carries a statement, per SQL CLI. psql's `-e` is --echo-queries
714
+ // and takes no value, so it must not count there.
715
+ const SQL_CLI_STATEMENT_FLAGS = {
716
+ psql: { short: "-c", long: "--command" },
717
+ mysql: { short: "-e", long: "--execute" },
718
+ mariadb: { short: "-e", long: "--execute" },
719
+ sqlite3: { long: "-cmd" },
720
+ sqlite: { long: "-cmd" },
721
+ };
722
+ /**
723
+ * The SQL a psql / mysql / sqlite3 invocation runs, from its arguments.
724
+ * Every statement flag counts (`psql -c "SELECT 1" -c "DROP TABLE t"` runs
725
+ * both), so a harmless first statement can't hide a destructive one. With no
726
+ * flag, quoted positional arguments that read as SQL (`sqlite3 db "…"`), else
727
+ * a trailing quoted argument as before. Undefined when the arguments can't be
728
+ * read (unbalanced quotes), so the caller can fall back.
729
+ */
730
+ function sqlFromCliArgs(tool, args) {
731
+ const words = shellWords(args);
732
+ if (!words)
733
+ return undefined;
734
+ const flags = SQL_CLI_STATEMENT_FLAGS[tool];
735
+ const statements = [];
736
+ for (let k = 0; k < words.length; k++) {
737
+ const w = words[k].text;
738
+ if (w === flags.long || (flags.short && w === flags.short)) {
739
+ if (k + 1 < words.length)
740
+ statements.push(words[++k].text);
741
+ }
742
+ else if (w.startsWith(flags.long + "=")) {
743
+ statements.push(w.slice(flags.long.length + 1));
744
+ }
745
+ else if (flags.short && words[k].quoted && w.length > 2 && w.startsWith(flags.short)) {
746
+ statements.push(w.slice(2)); // -c"SELECT …"
747
+ }
748
+ }
749
+ if (statements.length)
750
+ return statements.join("\n");
751
+ const quoted = words.filter(w => w.quoted).map(w => w.text);
752
+ const sqlish = quoted.filter(q => SQL_KEYWORDS_RE.test(q));
753
+ if (sqlish.length)
754
+ return sqlish.join("\n");
755
+ const last = words[words.length - 1];
756
+ return last?.quoted && words.length > 1 && /["']\s*$/.test(args) ? last.text : null;
757
+ }
514
758
  export function findSqlInCommand(cmd) {
515
759
  // Inline interpreter flags: node -e, python -c, ruby -e, perl -e. Anchored to
516
760
  // a command position so a SQL-looking string elsewhere doesn't match.
@@ -521,15 +765,25 @@ export function findSqlInCommand(cmd) {
521
765
  if (sql)
522
766
  return sql;
523
767
  }
524
- // psql -c "..." / mysql -e "..." / sqlite3 db "..." — outer-quoted statement.
525
- // Anchored to the start of the command so "psql"/"mysql" appearing inside an
526
- // argument (another tool's --body, etc.) can't trigger a false SQL match.
527
- const dq = cmd.match(/^(?:\s*\w+=\S+\s+)*(?:sudo\s+)?(?:psql|mysql|sqlite3?|mariadb)\b[^"]*"([\s\S]+?)"\s*$/i);
528
- if (dq)
529
- return dq[1];
530
- const sq = cmd.match(/^(?:\s*\w+=\S+\s+)*(?:sudo\s+)?(?:psql|mysql|sqlite3?|mariadb)\b[^']*'([\s\S]+?)'\s*$/i);
531
- if (sq)
532
- return sq[1];
768
+ // psql -c "..." / mysql -e "..." / sqlite3 db "..." — read the arguments as
769
+ // shell words, so a quoted connection string before the statement
770
+ // (`psql "$DATABASE_URL" -c "DELETE …"`) isn't swallowed into it. Anchored to
771
+ // the start of the command so "psql"/"mysql" appearing inside an argument
772
+ // (another tool's --body, etc.) can't trigger a false SQL match.
773
+ const cli = cmd.match(/^(?:\s*\w+=\S+\s+)*(?:sudo\s+)?(psql|mysql|sqlite3?|mariadb)\b/i);
774
+ const fromArgs = cli ? sqlFromCliArgs(cli[1].toLowerCase(), cmd.slice(cli[0].length)) : null;
775
+ if (fromArgs)
776
+ return fromArgs;
777
+ if (fromArgs === undefined) {
778
+ // Unbalanced quotes: fall back to the outer-quoted span.
779
+ const dq = cmd.match(/^(?:\s*\w+=\S+\s+)*(?:sudo\s+)?(?:psql|mysql|sqlite3?|mariadb)\b[^"]*"([\s\S]+?)"\s*$/i);
780
+ if (dq)
781
+ return dq[1];
782
+ const sq = cmd.match(/^(?:\s*\w+=\S+\s+)*(?:sudo\s+)?(?:psql|mysql|sqlite3?|mariadb)\b[^']*'([\s\S]+?)'\s*$/i);
783
+ if (sq)
784
+ return sq[1];
785
+ }
786
+ // No statement in the arguments: a heredoc may still feed one (below).
533
787
  // Heredoc-piped script: <<EOF / <<'EOF' / <<"EOF" / <<-EOF. Only when the
534
788
  // command (outside the body) actually feeds the heredoc to a SQL CLI or
535
789
  // interpreter — otherwise a `gh`/`cat`/`mail` heredoc whose body merely
@@ -896,6 +1150,9 @@ function summarizeMcp(toolName, input) {
896
1150
  ? { title: "Give session access to folder", target: dir, footnote: "Claude can read and change files in this folder", kind: "folder_access" }
897
1151
  : { title: "Ask you to pick a folder for this session", kind: "folder_access" };
898
1152
  }
1153
+ const desktop = summarizeDesktopApp(parts[1] || "", tool, input);
1154
+ if (desktop)
1155
+ return desktop;
899
1156
  const browser = parts.slice(1, -1).find((p) => p === "Claude_Browser" || p === "claude-in-chrome");
900
1157
  if (browser)
901
1158
  return summarizeBrowser(parts[parts.length - 1] || "", input, browser);
@@ -963,10 +1220,31 @@ function summarizeMcp(toolName, input) {
963
1220
  return { title: `Submit ${selector} via ${server}`, kind: "mcp_submit" };
964
1221
  }
965
1222
  if (tool.startsWith("list_") || tool.startsWith("get_") || tool.startsWith("search_")) {
966
- return { title: `${toWords(tool)} via ${server}`, kind: "unknown_tool" };
1223
+ return { title: `${toSentence(tool)} via ${server}`, kind: "unknown_tool" };
967
1224
  }
968
1225
  return { title: `${toSentence(tool)} via ${server}`, kind: "unknown_tool" };
969
1226
  }
1227
+ /** Desktop app tools whose name alone does not say what they do. */
1228
+ function summarizeDesktopApp(server, tool, input) {
1229
+ const str = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
1230
+ if (server === "ccd_turn" && tool === "update_plan") {
1231
+ return { title: "Update the task list in the Claude app", kind: "session_housekeeping" };
1232
+ }
1233
+ if (server === "ccd_turn" && tool === "wrap_up") {
1234
+ return { title: "Show the end-of-turn summary in the Claude app", body: str(input.recap), kind: "session_housekeeping" };
1235
+ }
1236
+ if (server === "ccd_session" && (tool === "start_session" || tool === "hand_off_to_session")) {
1237
+ const where = input.target === "cloud" ? "in the cloud" : input.target === "ssh" ? `on ${str(input.host) ?? "an SSH host"}` : undefined;
1238
+ const title = tool === "hand_off_to_session" ? "Move this task to a new Claude session" : "Start a new Claude session";
1239
+ return {
1240
+ title: where ? `${title} ${where}` : title,
1241
+ target: str(input.title),
1242
+ body: str(input.prompt) ?? str(input.remaining_plan),
1243
+ kind: "session_start",
1244
+ };
1245
+ }
1246
+ return null;
1247
+ }
970
1248
  function identifyTarget(input) {
971
1249
  const id = input.id ?? input.name ?? input.path ?? input.target ?? input.repo ?? input.repository ?? null;
972
1250
  if (id == null)
@@ -1210,8 +1488,11 @@ function formatByteCount(bytes) {
1210
1488
  return `${Math.round(bytes / 1024)} KB`;
1211
1489
  return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
1212
1490
  }
1491
+ // Words shown in capitals. Only known acronyms: uppercasing every short word
1492
+ // turned "wrap_up" into "Wrap UP" and "get_repo" into "GET repo".
1493
+ const ACRONYMS = new Set(["pr", "prs", "url", "api", "sql", "ci", "id", "ids", "ui", "dns", "ssh", "sms", "pdf", "csv", "json", "html", "css", "aws", "gcp", "db", "vm", "ip", "mcp", "otp", "llm"]);
1213
1494
  function toWords(snake) {
1214
- return snake.replace(/_/g, " ").split(" ").map((w) => (w.length <= 3 ? w.toUpperCase() : w)).join(" ");
1495
+ return snake.replace(/_/g, " ").split(" ").map((w) => (ACRONYMS.has(w.toLowerCase()) ? w.toUpperCase() : w)).join(" ");
1215
1496
  }
1216
1497
  // "set_auto_merge" -> "Set auto merge", "bind_pr" -> "Bind PR": the first word
1217
1498
  // is a verb, so it is not read as an acronym.
package/dist/errors.d.ts CHANGED
@@ -4,11 +4,21 @@
4
4
  *
5
5
  * - OKedAuthError -> bad/missing API key. Always deny. Never an
6
6
  * outage, so degraded-mode does NOT apply.
7
- * - OKedBackendUnreachableError -> connect failure or 5xx. This is the
8
- * outage case degradedDecision() handles. A
9
- * request the backend accepted and then held
10
- * past a timer is NOT an outage: approve()
11
- * returns { decision: "timeout" } for it.
7
+ * - OKedBackendUnreachableError -> connect failure, 5xx, a hosting-platform
8
+ * reply instead of the backend (Railway
9
+ * "Application not found"), or any reply that
10
+ * is not JSON. This is the outage case
11
+ * degradedDecision() handles. A request the
12
+ * backend accepted and then held past a timer
13
+ * is NOT an outage: approve() returns
14
+ * { decision: "timeout" } for it.
15
+ *
16
+ * - OKedTooManyPendingError -> HTTP 429: too many approvals already wait for
17
+ * a decision. Always deny, with a message that
18
+ * says what to do. Never an outage.
19
+ *
20
+ * - OKedHttpError -> any other HTTP error from the backend. Always
21
+ * deny. Carries the status and a short detail.
12
22
  *
13
23
  * - OKedReceiptError -> the decision came with a receipt that does not
14
24
  * verify (or with none, when requireReceipt is
@@ -24,7 +34,19 @@ export declare class OKedAuthError extends Error {
24
34
  }
25
35
  export declare class OKedBackendUnreachableError extends Error {
26
36
  readonly cause?: unknown;
27
- constructor(message: string, cause?: unknown);
37
+ /** The HTTP status, when a reply came back at all. */
38
+ readonly status?: number;
39
+ constructor(message: string, cause?: unknown, status?: number);
40
+ }
41
+ export declare class OKedTooManyPendingError extends Error {
42
+ readonly status = 429;
43
+ constructor(detail?: string);
44
+ }
45
+ export declare class OKedHttpError extends Error {
46
+ readonly status: number;
47
+ /** A short, one-line part of the reply body. */
48
+ readonly detail: string;
49
+ constructor(status: number, detail: string);
28
50
  }
29
51
  export declare class OKedReceiptError extends Error {
30
52
  /** e.g. ["bad_signature"], ["subject_mismatch"], ["missing"] */
package/dist/errors.js CHANGED
@@ -4,11 +4,21 @@
4
4
  *
5
5
  * - OKedAuthError -> bad/missing API key. Always deny. Never an
6
6
  * outage, so degraded-mode does NOT apply.
7
- * - OKedBackendUnreachableError -> connect failure or 5xx. This is the
8
- * outage case degradedDecision() handles. A
9
- * request the backend accepted and then held
10
- * past a timer is NOT an outage: approve()
11
- * returns { decision: "timeout" } for it.
7
+ * - OKedBackendUnreachableError -> connect failure, 5xx, a hosting-platform
8
+ * reply instead of the backend (Railway
9
+ * "Application not found"), or any reply that
10
+ * is not JSON. This is the outage case
11
+ * degradedDecision() handles. A request the
12
+ * backend accepted and then held past a timer
13
+ * is NOT an outage: approve() returns
14
+ * { decision: "timeout" } for it.
15
+ *
16
+ * - OKedTooManyPendingError -> HTTP 429: too many approvals already wait for
17
+ * a decision. Always deny, with a message that
18
+ * says what to do. Never an outage.
19
+ *
20
+ * - OKedHttpError -> any other HTTP error from the backend. Always
21
+ * deny. Carries the status and a short detail.
12
22
  *
13
23
  * - OKedReceiptError -> the decision came with a receipt that does not
14
24
  * verify (or with none, when requireReceipt is
@@ -28,10 +38,33 @@ export class OKedAuthError extends Error {
28
38
  }
29
39
  export class OKedBackendUnreachableError extends Error {
30
40
  cause;
31
- constructor(message, cause) {
41
+ /** The HTTP status, when a reply came back at all. */
42
+ status;
43
+ constructor(message, cause, status) {
32
44
  super(message);
33
45
  this.name = "OKedBackendUnreachableError";
34
46
  this.cause = cause;
47
+ this.status = status;
48
+ }
49
+ }
50
+ export class OKedTooManyPendingError extends Error {
51
+ status = 429;
52
+ constructor(detail = "") {
53
+ super("OKed: too many approvals are waiting for your decision. " +
54
+ "Approve or deny them in Telegram or on the dashboard, then try again." +
55
+ (detail ? ` (HTTP 429: ${detail})` : " (HTTP 429)"));
56
+ this.name = "OKedTooManyPendingError";
57
+ }
58
+ }
59
+ export class OKedHttpError extends Error {
60
+ status;
61
+ /** A short, one-line part of the reply body. */
62
+ detail;
63
+ constructor(status, detail) {
64
+ super(`OKed backend error HTTP ${status}${detail ? `: ${detail}` : ""}`);
65
+ this.name = "OKedHttpError";
66
+ this.status = status;
67
+ this.detail = detail;
35
68
  }
36
69
  }
37
70
  export class OKedReceiptError extends Error {
package/dist/index.d.ts CHANGED
@@ -41,7 +41,7 @@ export declare class OKedClient {
41
41
  */
42
42
  heartbeat(): Promise<void>;
43
43
  }
44
- export { OKedAuthError, OKedBackendUnreachableError, OKedReceiptError } from "./errors.js";
44
+ export { OKedAuthError, OKedBackendUnreachableError, OKedHttpError, OKedReceiptError, OKedTooManyPendingError, } from "./errors.js";
45
45
  export { checkReceipt, keysFor, keysUrlAllowed, OKED_RECEIPT_KEYS_URL } from "./receipt.js";
46
46
  export { PINNED_RECEIPT_KEYS } from "./receipt-keys.js";
47
47
  export { verifyReceipt, verifyChain, shortReceiptId, type SignedReceipt, type ReceiptBody, type ReceiptKey, } from "@oked/receipt-core";
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readFileSync, writeFileSync, mkdirSync } from "fs";
2
2
  import { dirname } from "path";
3
3
  import { loadOKedConfig, OKED_RULES_CACHE_PATH, OKED_HEARTBEAT_PATH } from "./config.js";
4
- import { OKedAuthError, OKedBackendUnreachableError } from "./errors.js";
4
+ import { OKedAuthError, OKedBackendUnreachableError, OKedHttpError, OKedTooManyPendingError } from "./errors.js";
5
5
  import { randomUUID } from "crypto";
6
6
  import { checkReceipt, OKED_RECEIPT_KEYS_URL } from "./receipt.js";
7
7
  import { hostname } from "os";
@@ -197,28 +197,53 @@ export class OKedClient {
197
197
  }
198
198
  if (!res.ok) {
199
199
  const body = await res.text().catch(() => "");
200
- if (res.status === 401 || res.status === 403) {
201
- throw new OKedAuthError(`OKed backend error ${res.status}: ${body}`, res.status);
202
- }
200
+ const detail = shortDetail(body);
203
201
  // A gateway that gave up waiting on a held long-poll: same as above.
204
202
  if (res.status === 504)
205
203
  return HELD_TIMEOUT;
204
+ // Auth first, whatever the body: a bad key must never become an "outage",
205
+ // or degraded mode could allow an action with an invalid key.
206
+ if (res.status === 401 || res.status === 403) {
207
+ throw new OKedAuthError(`OKed backend error ${res.status}: ${body}`, res.status);
208
+ }
209
+ if (res.status === 429)
210
+ throw new OKedTooManyPendingError(errorField(body) || detail);
211
+ // The hosting platform answered instead of the backend (the backend is
212
+ // gone or not deployed), or something answered that is not the backend
213
+ // at all. Both are an outage, so degraded mode applies.
214
+ if (res.headers.get("x-railway-fallback") || /application not found/i.test(body)) {
215
+ throw new OKedBackendUnreachableError(`OKed backend unreachable: HTTP ${res.status}, the hosting platform answered "application not found" (${this.config.backendUrl})`, undefined, res.status);
216
+ }
217
+ if (!isJson(body)) {
218
+ throw new OKedBackendUnreachableError(`OKed backend unreachable: HTTP ${res.status} with a reply that is not JSON${detail ? `: ${detail}` : ""}`, undefined, res.status);
219
+ }
206
220
  if (res.status >= 500) {
207
- throw new OKedBackendUnreachableError(`OKed backend error ${res.status}: ${body}`);
221
+ throw new OKedBackendUnreachableError(`OKed backend error HTTP ${res.status}: ${detail}`, undefined, res.status);
208
222
  }
209
- throw new Error(`OKed backend error ${res.status}: ${body}`);
223
+ throw new OKedHttpError(res.status, errorField(body) || detail);
210
224
  }
211
225
  let result;
226
+ let text;
212
227
  try {
213
228
  // The backend sends headers at once and streams whitespace heartbeats
214
229
  // while it waits, so the wait for a human happens here, in the body.
215
- result = (await res.json());
230
+ text = await res.text();
216
231
  }
217
232
  catch (err) {
218
233
  if (isHeldRequestTimeout(err))
219
234
  return HELD_TIMEOUT;
220
235
  throw err;
221
236
  }
237
+ try {
238
+ result = JSON.parse(text);
239
+ if (!result || typeof result !== "object")
240
+ throw new Error("not an object");
241
+ }
242
+ catch {
243
+ // HTTP 200 with a body that is not our JSON: not the backend. An outage.
244
+ throw new OKedBackendUnreachableError(`OKed backend unreachable: HTTP ${res.status} with a reply that is not JSON` +
245
+ ` (content-type ${res.headers.get("content-type") || "none"})`, undefined, res.status);
246
+ }
222
247
  // Nobody acts on a decision we cannot prove: an invalid receipt throws
223
248
  // OKedReceiptError (every integration denies), and so does an approval
224
249
  // with no receipt while requireReceipt is on (the default).
@@ -320,6 +345,31 @@ const HELD_TIMEOUT = { approved: false, approval_id: null, decision: "timeout" }
320
345
  * abort (TimeoutError), or undici's 300s headers/body timeouts, which fire
321
346
  * regardless of the abort signal on a silent long-poll.
322
347
  */
348
+ function isJson(text) {
349
+ try {
350
+ JSON.parse(text);
351
+ return true;
352
+ }
353
+ catch {
354
+ return false;
355
+ }
356
+ }
357
+ /** One line, at most 200 characters: for error messages, never a whole page. */
358
+ function shortDetail(body) {
359
+ const line = body.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim();
360
+ return line.length > 200 ? line.slice(0, 197) + "..." : line;
361
+ }
362
+ /** The backend's own error text ({"error": "..."} or {"message": "..."}), if any. */
363
+ function errorField(body) {
364
+ try {
365
+ const j = JSON.parse(body);
366
+ const v = typeof j.error === "string" ? j.error : typeof j.message === "string" ? j.message : "";
367
+ return shortDetail(v);
368
+ }
369
+ catch {
370
+ return "";
371
+ }
372
+ }
323
373
  function isHeldRequestTimeout(err) {
324
374
  if (!err || typeof err !== "object")
325
375
  return false;
@@ -342,7 +392,7 @@ function isRetriableConnectError(err) {
342
392
  code === "ETIMEDOUT" ||
343
393
  code === "UND_ERR_CONNECT_TIMEOUT");
344
394
  }
345
- export { OKedAuthError, OKedBackendUnreachableError, OKedReceiptError } from "./errors.js";
395
+ export { OKedAuthError, OKedBackendUnreachableError, OKedHttpError, OKedReceiptError, OKedTooManyPendingError, } from "./errors.js";
346
396
  export { checkReceipt, keysFor, keysUrlAllowed, OKED_RECEIPT_KEYS_URL } from "./receipt.js";
347
397
  export { PINNED_RECEIPT_KEYS } from "./receipt-keys.js";
348
398
  export { verifyReceipt, verifyChain, shortReceiptId, } from "@oked/receipt-core";
package/dist/kinds.d.ts CHANGED
@@ -6,5 +6,5 @@
6
6
  * pattern maps to a kind, so historical rows stay attributable to the
7
7
  * classifier that produced them.
8
8
  */
9
- export declare const CLASSIFIER_VERSION = "v2";
10
- export type OperationKind = "file_create" | "file_append" | "file_edit" | "file_touch" | "file_copy" | "file_move" | "file_delete" | "sql_drop" | "sql_truncate" | "sql_alter" | "sql_create" | "sql_delete_rows" | "sql_delete_all_rows" | "sql_update_rows" | "sql_update_every_row" | "sql_insert" | "sql_query" | "git_push" | "git_force_push" | "git_reset_hard" | "git_clean" | "git_checkout" | "git_restore" | "git_commit" | "git_pr_create" | "ssh_remote" | "http_get" | "http_post" | "http_put" | "http_delete" | "http_pipe_to_shell" | "docker_up" | "docker_down" | "docker_rm" | "docker_rmi" | "docker_prune" | "npm_install" | "npm_run" | "npm_test" | "npm_publish" | "npm_unpublish" | "npx_deploy" | "kill_process" | "sudo" | "chmod_777" | "email_send" | "email_delete" | "email_purge" | "payment_charge" | "payment_create" | "chat_message" | "mcp_delete" | "mcp_update" | "mcp_create" | "mcp_post" | "mcp_publish" | "mcp_send" | "mcp_submit_form" | "mcp_fill" | "mcp_submit" | "mcp_query" | "browser_navigate" | "browser_interact" | "browser_script" | "browser_dev_server" | "folder_access" | "session_control" | "worktree" | "schedule" | "agent_message" | "web_fetch" | "monitor" | "artifact" | "agent_launch" | "shell_pipeline" | "unknown_bash" | "unknown_tool";
9
+ export declare const CLASSIFIER_VERSION = "v3";
10
+ export type OperationKind = "file_create" | "file_append" | "file_edit" | "file_touch" | "file_copy" | "file_move" | "file_delete" | "sql_drop" | "sql_truncate" | "sql_alter" | "sql_create" | "sql_delete_rows" | "sql_delete_all_rows" | "sql_update_rows" | "sql_update_every_row" | "sql_insert" | "sql_query" | "git_push" | "git_force_push" | "git_reset_hard" | "git_clean" | "git_checkout" | "git_restore" | "git_commit" | "git_pr_create" | "git_pr_merge" | "git_pr_write" | "gh_write" | "deploy" | "ssh_remote" | "http_get" | "http_post" | "http_put" | "http_delete" | "http_pipe_to_shell" | "docker_up" | "docker_down" | "docker_rm" | "docker_rmi" | "docker_prune" | "npm_install" | "npm_run" | "npm_test" | "npm_publish" | "npm_unpublish" | "npx_deploy" | "kill_process" | "sudo" | "chmod_777" | "email_send" | "email_delete" | "email_purge" | "payment_charge" | "payment_create" | "chat_message" | "mcp_delete" | "mcp_update" | "mcp_create" | "mcp_post" | "mcp_publish" | "mcp_send" | "mcp_submit_form" | "mcp_fill" | "mcp_submit" | "mcp_query" | "browser_navigate" | "browser_interact" | "browser_script" | "browser_dev_server" | "folder_access" | "session_control" | "session_housekeeping" | "session_start" | "worktree" | "schedule" | "agent_message" | "web_fetch" | "monitor" | "artifact" | "agent_launch" | "shell_pipeline" | "unknown_bash" | "unknown_tool";
package/dist/kinds.js CHANGED
@@ -6,4 +6,4 @@
6
6
  * pattern maps to a kind, so historical rows stay attributable to the
7
7
  * classifier that produced them.
8
8
  */
9
- export const CLASSIFIER_VERSION = "v2";
9
+ export const CLASSIFIER_VERSION = "v3";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oked/sdk",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "OKed SDK - human approval layer for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -45,7 +45,7 @@
45
45
  "access": "public"
46
46
  },
47
47
  "dependencies": {
48
- "@oked/receipt-core": "0.6.4"
48
+ "@oked/receipt-core": "0.6.6"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/node": "^22.13.10",