@oked/sdk 0.6.6 → 0.6.8
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/dist/classify.d.ts +14 -0
- package/dist/classify.js +194 -5
- package/dist/describe.js +161 -16
- package/dist/kinds.d.ts +1 -1
- package/package.json +2 -2
package/dist/classify.d.ts
CHANGED
|
@@ -30,6 +30,20 @@ export interface ShellWriteOp {
|
|
|
30
30
|
* body, so SQL/code detection still runs. The opener line is always preserved.
|
|
31
31
|
*/
|
|
32
32
|
export declare function stripHeredocBodies(command: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* Drop the bodies of heredocs fed to a code interpreter, for the SHELL-pattern
|
|
35
|
+
* scans only (the same policy as `-e`/`-c` bodies below). A Python script that
|
|
36
|
+
* edits a file whose text says "git push --force" or "npm publish" is not a
|
|
37
|
+
* force push or a publish. SQL detection still reads the intact body.
|
|
38
|
+
*/
|
|
39
|
+
export declare function stripCodeHeredocBodies(command: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Blank the inside of quoted arguments of text commands, for the SHELL-pattern
|
|
42
|
+
* scans only, so `git commit -m "curl -d sends JSON"` or `grep "curl -X POST"`
|
|
43
|
+
* is not read as a POST. A step that pipes on (`echo '…' | sh`) keeps its text,
|
|
44
|
+
* because the next command may run it.
|
|
45
|
+
*/
|
|
46
|
+
export declare function blankTextCommandArgs(command: string): string;
|
|
33
47
|
export declare function stripInlineScriptBodies(command: string): string;
|
|
34
48
|
/**
|
|
35
49
|
* Blank the interior of quoted curl request bodies, keeping the quotes and the
|
package/dist/classify.js
CHANGED
|
@@ -143,6 +143,29 @@ const DELETE_LEAD = /^(?:(?:sudo|command|exec|builtin|time|nice|xargs|then|do|el
|
|
|
143
143
|
// { ). Deliberately NOT after `;`/`|`/`&`/a quote, so a delete word sitting in
|
|
144
144
|
// quoted DATA (echo text, a commit message) doesn't match.
|
|
145
145
|
const DELETE_COMMAND_RE = /(?:^|[\n`({]|\$\()\s*(?:rm|rmdir|trash|trash-put)\b/;
|
|
146
|
+
const NPX_DEPLOY_RE = /\bnpx\s+.*\s+deploy\b/;
|
|
147
|
+
/**
|
|
148
|
+
* `prisma migrate deploy` against a DATABASE_URL on this machine (localhost,
|
|
149
|
+
* 127.0.0.1, ::1) set in the same command: it changes a local test database,
|
|
150
|
+
* not a live one, so the `npx … deploy` rule does not apply. Without a local
|
|
151
|
+
* DATABASE_URL in the command the URL comes from the environment, which can be
|
|
152
|
+
* production, so the rule still applies.
|
|
153
|
+
*/
|
|
154
|
+
function isLocalPrismaDeploy(command) {
|
|
155
|
+
if (!/\bprisma\s+migrate\s+deploy\b/.test(command))
|
|
156
|
+
return false;
|
|
157
|
+
const urls = [...command.matchAll(/DATABASE_URL=["']?([a-z]+:\/\/[^\s"';&|]+)/g)].map((m) => m[1]);
|
|
158
|
+
if (urls.length === 0)
|
|
159
|
+
return false;
|
|
160
|
+
return urls.every((u) => {
|
|
161
|
+
try {
|
|
162
|
+
return ["localhost", "127.0.0.1", "[::1]"].includes(new URL(u).hostname);
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
167
|
+
});
|
|
168
|
+
}
|
|
146
169
|
// Bash commands classified as high stakes (destructive, irreversible, external).
|
|
147
170
|
// Scanned on the FULL command (some patterns, e.g. download|shell, span a pipe).
|
|
148
171
|
// File deletion lives in DELETE_PATTERNS (per-stage) instead, see above.
|
|
@@ -172,7 +195,7 @@ const HIGH_STAKES_COMMANDS = [
|
|
|
172
195
|
/\bcurl\s+.*\|\s*(bash|sh|zsh)\b/,
|
|
173
196
|
/\bnpm\s+publish\b/,
|
|
174
197
|
/\bnpm\s+unpublish\b/,
|
|
175
|
-
|
|
198
|
+
NPX_DEPLOY_RE,
|
|
176
199
|
// NOTE: ssh is intentionally NOT a blanket high_stakes here. ssh is a
|
|
177
200
|
// transport — the real effect is whatever runs on the remote host — so it's
|
|
178
201
|
// classified by its remote command in classifySshStage (a read-only remote
|
|
@@ -302,6 +325,8 @@ const WARNING_COMMANDS = [
|
|
|
302
325
|
// high_stakes in the full scan above and wins before reaching here.
|
|
303
326
|
/^git\s+push\b/,
|
|
304
327
|
/^gh\s+pr\s+create\b/,
|
|
328
|
+
// Prisma migrations reach here only for a local database (see isLocalPrismaDeploy).
|
|
329
|
+
/^(?:\w+=\S+\s+)*npx\s+prisma\s+migrate\s+deploy\b/,
|
|
305
330
|
// Package installs always mutate node_modules and run dependency postinstall
|
|
306
331
|
// scripts — a known local mutation worth an audit line.
|
|
307
332
|
/^npm\s+(install|ci|i|update|upgrade|rebuild|prune|dedupe)\b/,
|
|
@@ -331,6 +356,70 @@ function isEphemeralPath(filePath) {
|
|
|
331
356
|
// binding declared in an earlier one. Safe because the whole binding is visible
|
|
332
357
|
// in this single inspected command string — no environment-resolution guess.
|
|
333
358
|
const MKTEMP_ASSIGN_RE = /^(?:export\s+|declare\s+|local\s+|readonly\s+)?(\w+)=["']?(?:\$\(|`)\s*mktemp\b/;
|
|
359
|
+
// Process names and command lines of local dev servers and dev tooling: Node
|
|
360
|
+
// and Python app servers, bundlers, package-manager scripts, and Node scripts.
|
|
361
|
+
const DEV_PROCESS_RE = /\b(?:node|nodemon|tsx|ts-node|vite|next|nuxt|astro|remix|webpack(?:-dev-server)?|esbuild|parcel|turbo|npm|pnpm|yarn|bun|deno|wrangler|miniflare|uvicorn|gunicorn|flask|runserver|rails|puma|http\.server|http-server|live-server|serve|hugo|jekyll|storybook|expo|metro)\b|\.(?:[cm]?js|tsx?)\b/;
|
|
362
|
+
/**
|
|
363
|
+
* A kill of a local dev server: `pkill -f "tsx src/main.ts"`, `killall node`,
|
|
364
|
+
* `kill $(pgrep -f vite)`, or a kill of whatever listens on a port
|
|
365
|
+
* (`kill $(lsof -t -iTCP:3000 -sTCP:LISTEN)`). Oren chose `review` (no Face
|
|
366
|
+
* ID) for these on 2026-10-18. A bare `kill <pid>` names no process, so it
|
|
367
|
+
* stays high stakes.
|
|
368
|
+
*/
|
|
369
|
+
function isDevServerKill(stage) {
|
|
370
|
+
const pkill = stage.match(/^pkill\s+(.+)$/);
|
|
371
|
+
if (pkill) {
|
|
372
|
+
const args = splitArgs(pkill[1]).filter((a) => !a.startsWith("-") || a === "-f");
|
|
373
|
+
const pattern = unquote(args[args.indexOf("-f") + 1] ?? args[args.length - 1] ?? "");
|
|
374
|
+
return DEV_PROCESS_RE.test(pattern);
|
|
375
|
+
}
|
|
376
|
+
const killall = stage.match(/^killall\s+(.+)$/);
|
|
377
|
+
if (killall) {
|
|
378
|
+
const names = splitArgs(killall[1]).filter((a) => !a.startsWith("-")).map(unquote);
|
|
379
|
+
return names.length > 0 && names.every((n) => DEV_PROCESS_RE.test(n));
|
|
380
|
+
}
|
|
381
|
+
const kill = stage.match(/^kill\s+(?:-\w+\s+)*\$\((.+)\)\s*(?:2>\/dev\/null)?$/);
|
|
382
|
+
if (kill) {
|
|
383
|
+
const inner = kill[1].trim();
|
|
384
|
+
if (/^lsof\b/.test(inner) && /-i\s*(?:tcp|TCP|udp)?:?\d+|-iTCP:\d+/.test(inner))
|
|
385
|
+
return true;
|
|
386
|
+
const pg = inner.match(/^pgrep\s+(?:-\w+\s+)*(?:-f\s+)?(.+)$/);
|
|
387
|
+
if (pg)
|
|
388
|
+
return DEV_PROCESS_RE.test(unquote(pg[1].trim()));
|
|
389
|
+
}
|
|
390
|
+
return false;
|
|
391
|
+
}
|
|
392
|
+
// Entries in the ephemeral set that are not variable names: `path:<p>` is a
|
|
393
|
+
// file an earlier stage created, `cwd:temp` means the shell is in a temp dir.
|
|
394
|
+
const CREATED_PATH = "path:";
|
|
395
|
+
const TEMP_CWD = "cwd:temp";
|
|
396
|
+
// An earlier stage exported a DATABASE_URL on this machine (see isLocalPrismaDeploy).
|
|
397
|
+
const LOCAL_DB = "db:local";
|
|
398
|
+
function noteEphemeralEffects(stage, into) {
|
|
399
|
+
const assign = stage.match(/^(?:export\s+)?(\w+)=("[^"$`]*"|'[^']*'|[^\s;&|$`'"()]+)$/);
|
|
400
|
+
if (assign && isEphemeralPath(unquote(assign[2])))
|
|
401
|
+
into.add(assign[1]);
|
|
402
|
+
for (const op of extractShellWriteOps(stage)) {
|
|
403
|
+
if (op.kind === "create" || op.kind === "copy" || op.kind === "touch")
|
|
404
|
+
into.add(CREATED_PATH + unquote(op.target));
|
|
405
|
+
}
|
|
406
|
+
const dbUrl = stage.match(/^(?:export\s+)?DATABASE_URL=["']?([a-z]+:\/\/[^\s"';&|]+)["']?$/);
|
|
407
|
+
if (dbUrl) {
|
|
408
|
+
if (isLocalPrismaDeploy(`DATABASE_URL=${dbUrl[1]} prisma migrate deploy`))
|
|
409
|
+
into.add(LOCAL_DB);
|
|
410
|
+
else
|
|
411
|
+
into.delete(LOCAL_DB);
|
|
412
|
+
}
|
|
413
|
+
const cd = stage.match(/^cd\s+(.+)$/);
|
|
414
|
+
if (cd) {
|
|
415
|
+
const dir = unquote(cd[1].trim());
|
|
416
|
+
const temp = /^"?\$\(\s*mktemp\b/.test(cd[1].trim()) || isEphemeralPath(dir) || isEphemeralVar(dir, into);
|
|
417
|
+
if (temp)
|
|
418
|
+
into.add(TEMP_CWD);
|
|
419
|
+
else
|
|
420
|
+
into.delete(TEMP_CWD);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
334
423
|
function collectMktempVars(stage, into) {
|
|
335
424
|
const m = stage.match(MKTEMP_ASSIGN_RE);
|
|
336
425
|
if (m)
|
|
@@ -588,7 +677,8 @@ function isEphemeralOnlyDeletion(command, ephemeralVars = new Set()) {
|
|
|
588
677
|
return false;
|
|
589
678
|
return targets.every((a) => {
|
|
590
679
|
const t = unquote(a);
|
|
591
|
-
return isEphemeralPath(t) || isEphemeralVar(t, ephemeralVars)
|
|
680
|
+
return isEphemeralPath(t) || isEphemeralVar(t, ephemeralVars) || ephemeralVars.has(CREATED_PATH + t) ||
|
|
681
|
+
(ephemeralVars.has(TEMP_CWD) && /^[\w.-][\w./-]*$/.test(t) && !t.split("/").includes(".."));
|
|
592
682
|
});
|
|
593
683
|
}
|
|
594
684
|
/**
|
|
@@ -856,7 +946,7 @@ function classifyBashCommand(command, ephemeralVars = new Set()) {
|
|
|
856
946
|
// surface via `intact` — that is the accepted shell-only-opacity
|
|
857
947
|
// trade-off; see classifyStageShellEffects.)
|
|
858
948
|
const intact = stripHeredocBodies(command).trim();
|
|
859
|
-
const stripped = stripCurlDataBodies(stripInlineScriptBodies(intact)).trim();
|
|
949
|
+
const stripped = blankTextCommandArgs(stripCurlDataBodies(stripInlineScriptBodies(stripCodeHeredocBodies(intact)))).trim();
|
|
860
950
|
// High-stakes scan on the FULL (body-stripped) command, before any splitting.
|
|
861
951
|
// These patterns use \b and several intentionally span an operator (e.g.
|
|
862
952
|
// `curl … | bash`, `wget … | sh` — download-and-execute), so they have to be
|
|
@@ -865,9 +955,19 @@ function classifyBashCommand(command, ephemeralVars = new Set()) {
|
|
|
865
955
|
// deletion is NOT here — it's per-stage below so the ephemeral-temp downgrade
|
|
866
956
|
// can run.)
|
|
867
957
|
for (const pattern of HIGH_STAKES_COMMANDS) {
|
|
958
|
+
if (pattern === NPX_DEPLOY_RE && (isLocalPrismaDeploy(stripped) ||
|
|
959
|
+
(ephemeralVars.has(LOCAL_DB) && /\bprisma\s+migrate\s+deploy\b/.test(stripped))))
|
|
960
|
+
continue;
|
|
868
961
|
if (pattern.test(stripped))
|
|
869
962
|
return "high_stakes";
|
|
870
963
|
}
|
|
964
|
+
// Text piped into a shell (`echo '…' | sh`, `printf … | bash`) runs as code
|
|
965
|
+
// that no stage shows on its own. At least `review`; a known high-stakes
|
|
966
|
+
// pattern above (curl | sh) already returned.
|
|
967
|
+
const pipesToShell = splitTopLevel(stripped, { pipes: false }).some((step) => {
|
|
968
|
+
const parts = splitTopLevel(step);
|
|
969
|
+
return parts.length > 1 && parts.slice(1).some((p) => /^(?:sudo\s+)?(?:ba|z|k|da)?sh\b(?!\s+-n\b)/.test(p));
|
|
970
|
+
});
|
|
871
971
|
// Compound commands: split on top-level `|`, `||`, `&&`, `;` and take the
|
|
872
972
|
// highest tier. Split the body-INTACT view so each stage keeps its SQL
|
|
873
973
|
// visible; recursion re-derives both views per stage. (Blanking a script body
|
|
@@ -882,7 +982,17 @@ function classifyBashCommand(command, ephemeralVars = new Set()) {
|
|
|
882
982
|
const vars = new Set(ephemeralVars);
|
|
883
983
|
for (const stage of stages)
|
|
884
984
|
collectMktempVars(stage, vars);
|
|
885
|
-
|
|
985
|
+
// Throwaway paths that only EARLIER stages make known: a file an earlier
|
|
986
|
+
// stage created (`cat > _smoke.mjs <<EOF … ; rm _smoke.mjs`), a variable set
|
|
987
|
+
// to a literal temp path (`W=/tmp/wt; rm -rf $W`), and a `cd` into a temp
|
|
988
|
+
// dir (relative paths then live in it). Gathered in order, so a delete
|
|
989
|
+
// before the create still counts as a real delete.
|
|
990
|
+
let worst = pipesToShell ? "review" : "safe";
|
|
991
|
+
for (const stage of stages) {
|
|
992
|
+
worst = maxTier(worst, classifyBashCommand(stage, vars));
|
|
993
|
+
noteEphemeralEffects(stripHeredocBodies(stage), vars);
|
|
994
|
+
}
|
|
995
|
+
return worst;
|
|
886
996
|
}
|
|
887
997
|
// ---- single stage from here ----
|
|
888
998
|
// SQL severity from the body-INTACT view: an interpreter wrapper (python -c,
|
|
@@ -891,7 +1001,7 @@ function classifyBashCommand(command, ephemeralVars = new Set()) {
|
|
|
891
1001
|
// shell pass short-circuits to `safe` (e.g. an assignment-prefixed node -e).
|
|
892
1002
|
const sql = findSqlInCommand(intact);
|
|
893
1003
|
const sqlTier = sql ? classifySqlSeverity(sql) : "safe";
|
|
894
|
-
return maxTier(sqlTier, classifyStageShellEffects(stripped, ephemeralVars));
|
|
1004
|
+
return maxTier(maxTier(sqlTier, pipesToShell ? "review" : "safe"), classifyStageShellEffects(stripped, ephemeralVars));
|
|
895
1005
|
}
|
|
896
1006
|
/**
|
|
897
1007
|
* Shell-effect classification of a SINGLE, already-body-stripped stage. No SQL
|
|
@@ -913,6 +1023,16 @@ function classifyStageShellEffects(stage, ephemeralVars = new Set()) {
|
|
|
913
1023
|
// can't fire inside an argument). These don't span pipes, so `^`-anchoring is
|
|
914
1024
|
// precise and avoids prose false-positives.
|
|
915
1025
|
const bareStage = stage.replace(/^sudo\s+/, "");
|
|
1026
|
+
// Stopping a process whose command line names a temp or scratchpad path (a
|
|
1027
|
+
// test database or server the session started there) is local cleanup.
|
|
1028
|
+
if (/^pkill\s+(?:-\w+\s+)*-f\s+/.test(bareStage)) {
|
|
1029
|
+
const pattern = unquote(splitArgs(bareStage.replace(/^pkill\s+(?:-\w+\s+)*-f\s+/, ""))[0] ?? "");
|
|
1030
|
+
if (/(?:^|\/)scratchpad\//.test(pattern) || EPHEMERAL_PATH_RE.test(pattern))
|
|
1031
|
+
return "warning";
|
|
1032
|
+
}
|
|
1033
|
+
// Stopping a local dev server is review: it asks, without Face ID.
|
|
1034
|
+
if (isDevServerKill(bareStage))
|
|
1035
|
+
return "review";
|
|
916
1036
|
for (const pattern of HIGH_STAKES_STAGE) {
|
|
917
1037
|
if (pattern.test(bareStage))
|
|
918
1038
|
return "high_stakes";
|
|
@@ -927,6 +1047,10 @@ function classifyStageShellEffects(stage, ephemeralVars = new Set()) {
|
|
|
927
1047
|
return isLoopbackHttpStage(stage) ? "warning" : "high_stakes";
|
|
928
1048
|
}
|
|
929
1049
|
}
|
|
1050
|
+
// `DATABASE_URL=<local> npx prisma migrate deploy`: the assignment prefix
|
|
1051
|
+
// below would classify the bare `npx … deploy` without its local URL.
|
|
1052
|
+
if (/^(?:\w+=\S+\s+)*npx\s+prisma\s+migrate\s+deploy\b/.test(bareStage) && isLocalPrismaDeploy(bareStage))
|
|
1053
|
+
return "warning";
|
|
930
1054
|
const ghApiTier = classifyGhApiStage(bareStage);
|
|
931
1055
|
if (ghApiTier !== null)
|
|
932
1056
|
return ghApiTier;
|
|
@@ -1060,6 +1184,56 @@ export function stripHeredocBodies(command) {
|
|
|
1060
1184
|
}
|
|
1061
1185
|
return out.join("\n");
|
|
1062
1186
|
}
|
|
1187
|
+
// Interpreters (not shells) whose heredoc body is code: `python3 - <<'EOF'`,
|
|
1188
|
+
// `node - <<EOF`, `psql <<SQL`. Shell heredocs (`bash <<EOF`) stay scannable.
|
|
1189
|
+
const CODE_HEREDOC_RE = /(?:^|\||&&|;|\$\(|`)\s*(?:\w+=\S+\s+)*(?:sudo\s+)?(?:psql|mysql|mariadb|sqlite3?|node|python\d?(?:\.\d+)?|ruby|perl|deno|bun)\b[^\n|;&]*<</;
|
|
1190
|
+
/**
|
|
1191
|
+
* Drop the bodies of heredocs fed to a code interpreter, for the SHELL-pattern
|
|
1192
|
+
* scans only (the same policy as `-e`/`-c` bodies below). A Python script that
|
|
1193
|
+
* edits a file whose text says "git push --force" or "npm publish" is not a
|
|
1194
|
+
* force push or a publish. SQL detection still reads the intact body.
|
|
1195
|
+
*/
|
|
1196
|
+
export function stripCodeHeredocBodies(command) {
|
|
1197
|
+
const lines = command.split("\n");
|
|
1198
|
+
const out = [];
|
|
1199
|
+
let i = 0;
|
|
1200
|
+
while (i < lines.length) {
|
|
1201
|
+
const line = lines[i];
|
|
1202
|
+
out.push(line);
|
|
1203
|
+
const openers = [...line.matchAll(/<<-?\s*(["']?)([A-Za-z_][A-Za-z0-9_]*)\1/g)];
|
|
1204
|
+
if (openers.length > 0 && CODE_HEREDOC_RE.test(line)) {
|
|
1205
|
+
const delim = openers[openers.length - 1][2];
|
|
1206
|
+
i++;
|
|
1207
|
+
while (i < lines.length && lines[i].trim() !== delim)
|
|
1208
|
+
i++;
|
|
1209
|
+
if (i < lines.length)
|
|
1210
|
+
i++;
|
|
1211
|
+
continue;
|
|
1212
|
+
}
|
|
1213
|
+
i++;
|
|
1214
|
+
}
|
|
1215
|
+
return out.join("\n");
|
|
1216
|
+
}
|
|
1217
|
+
// Commands whose quoted arguments are text, never run: a commit message, a
|
|
1218
|
+
// search pattern, a PR body, printed text. `gh api` is left out: its fields are
|
|
1219
|
+
// a request payload (a GraphQL mutation, for example).
|
|
1220
|
+
const TEXT_ARG_COMMAND_RE = /^(?:\w+=(?:"[^"]*"|'[^']*'|\S+)\s+)*(?:git|grep|egrep|fgrep|rg|echo|printf|gh(?!\s+api\b))\b/;
|
|
1221
|
+
/**
|
|
1222
|
+
* Blank the inside of quoted arguments of text commands, for the SHELL-pattern
|
|
1223
|
+
* scans only, so `git commit -m "curl -d sends JSON"` or `grep "curl -X POST"`
|
|
1224
|
+
* is not read as a POST. A step that pipes on (`echo '…' | sh`) keeps its text,
|
|
1225
|
+
* because the next command may run it.
|
|
1226
|
+
*/
|
|
1227
|
+
export function blankTextCommandArgs(command) {
|
|
1228
|
+
return splitTopLevel(command, { pipes: false })
|
|
1229
|
+
.map((step) => {
|
|
1230
|
+
if (!TEXT_ARG_COMMAND_RE.test(step) || splitTopLevel(step).length > 1)
|
|
1231
|
+
return step;
|
|
1232
|
+
// A quoted redirect target (`>> "$HOME/.ssh/authorized_keys"`) is a path, not text.
|
|
1233
|
+
return step.replace(/'[^']*'|"(?:[^"\\]|\\.)*"/g, (q, at) => /[<>]\s*$/.test(step.slice(0, at)) ? q : q[0] + " ".repeat(Math.max(0, q.length - 2)) + q[0]);
|
|
1234
|
+
})
|
|
1235
|
+
.join("\n");
|
|
1236
|
+
}
|
|
1063
1237
|
// Interpreters whose inline `-e`/`-c`/`--eval` (and perl/deno one-liner) body is
|
|
1064
1238
|
// opaque CODE — not shell. We blank that body before the SHELL-pattern scans so
|
|
1065
1239
|
// tokens embedded as code or data (`rm`, `curl -d`, a `>` redirect) don't trip a
|
|
@@ -1489,6 +1663,21 @@ function classifyMcpTool(toolName, toolInput = {}) {
|
|
|
1489
1663
|
}
|
|
1490
1664
|
if (parts.length === 3 && isClaudeDocsWrite(parts[1] || "", tool, toolInput))
|
|
1491
1665
|
return "warning";
|
|
1666
|
+
// The desktop app's iOS Simulator: a local test device. Looking at it is
|
|
1667
|
+
// safe; taps, typing and installing a local build change only the
|
|
1668
|
+
// simulator, like page clicks in the built-in browser, so they are logged.
|
|
1669
|
+
if (parts.includes("Claude_Code_iOS_Simulator")) {
|
|
1670
|
+
if (tool === "control") {
|
|
1671
|
+
const action = toolInput.action;
|
|
1672
|
+
if (action === "screenshot" || action === "attach" || action === "detach")
|
|
1673
|
+
return "safe";
|
|
1674
|
+
if (["tap", "swipe", "touch_path", "touch2_path", "text", "button", "open_url", "launch"].includes(action))
|
|
1675
|
+
return "warning";
|
|
1676
|
+
return "review";
|
|
1677
|
+
}
|
|
1678
|
+
if (tool === "build")
|
|
1679
|
+
return "warning";
|
|
1680
|
+
}
|
|
1492
1681
|
const browserServer = parts.slice(1, -1).find((p) => BROWSER_MCP_SERVERS.has(p));
|
|
1493
1682
|
if (browserServer)
|
|
1494
1683
|
return classifyBrowserTool(tool, toolInput, browserServer);
|
package/dist/describe.js
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { existsSync, readFileSync, readdirSync } from "node:fs";
|
|
11
11
|
import { basename, isAbsolute, join, resolve } from "node:path";
|
|
12
|
-
import { classify, extractShellWriteOps, splitTopLevel } from "./classify.js";
|
|
12
|
+
import { blankTextCommandArgs, classify, extractShellWriteOps, splitTopLevel, stripCodeHeredocBodies } from "./classify.js";
|
|
13
13
|
import { TIER_ORDER } from "./degraded.js";
|
|
14
14
|
const BODY_PREVIEW_MAX = 200;
|
|
15
15
|
const COMMAND_INLINE_MAX = 50;
|
|
@@ -100,8 +100,10 @@ function summarizeMutatingCurl(command) {
|
|
|
100
100
|
return null;
|
|
101
101
|
// Read flags from the curl/wget step only: a `--json` or `-d` on another step
|
|
102
102
|
// (`gh pr view --json state`, `unzip -d dir`) is not this request's body.
|
|
103
|
+
// Quoted text of git, grep and echo is not a request (a commit message that
|
|
104
|
+
// says "curl -d" is not a POST): look for curl in the blanked view.
|
|
103
105
|
const steps = splitTopLevel(command);
|
|
104
|
-
const step = steps.find((s) => /\b(?:curl|wget)\b/.test(s) && isMutatingCurlStep(s));
|
|
106
|
+
const step = steps.find((s) => /\b(?:curl|wget)\b/.test(blankTextCommandArgs(s)) && isMutatingCurlStep(s));
|
|
105
107
|
if (!step)
|
|
106
108
|
return null;
|
|
107
109
|
const cmd = ` ${step}`;
|
|
@@ -168,7 +170,7 @@ function extractCurlPayload(cmd) {
|
|
|
168
170
|
return parts.length ? parts.join("\n") : undefined;
|
|
169
171
|
}
|
|
170
172
|
function summarizeBash(command, sizeBytes, cwd) {
|
|
171
|
-
|
|
173
|
+
let cmd = (command || "").trim();
|
|
172
174
|
if (!cmd)
|
|
173
175
|
return { title: "Run empty command", kind: "unknown_bash" };
|
|
174
176
|
const compound = summarizeCompoundBash(cmd, sizeBytes, cwd);
|
|
@@ -181,6 +183,18 @@ function summarizeBash(command, sizeBytes, cwd) {
|
|
|
181
183
|
const sql = findSqlInCommand(cmd);
|
|
182
184
|
if (sql)
|
|
183
185
|
return summarizeSql(sql, cmd);
|
|
186
|
+
// A Python or Node script fed by a heredoc is code: show it as a script, and
|
|
187
|
+
// read the rest of the command without the script body, so its text
|
|
188
|
+
// ("npm publish", "git push --force") does not name the card.
|
|
189
|
+
const script = summarizeCodeHeredoc(cmd);
|
|
190
|
+
if (script)
|
|
191
|
+
return script;
|
|
192
|
+
cmd = stripCodeHeredocBodies(cmd);
|
|
193
|
+
// Text piped into a shell runs as a script that no step shows by name.
|
|
194
|
+
const toShell = cmd.match(/^(.*?)\|\s*(?:sudo\s+)?((?:ba|z|k|da)?sh)\b(?!\s+-n\b)/s);
|
|
195
|
+
if (toShell && !/\b(?:curl|wget)\b/.test(toShell[1]) && splitTopLevel(cmd, { pipes: false }).length === 1) {
|
|
196
|
+
return { title: `Run text as a ${toShell[2]} script`, body: truncateBody(cmd), kind: "shell_pipeline" };
|
|
197
|
+
}
|
|
184
198
|
// A mutating curl/wget (POST/PUT/DELETE, or a request body) is described
|
|
185
199
|
// BEFORE shell-write detection. In a compound command the outward request is
|
|
186
200
|
// the headline operation, while a `> log` redirect is incidental — otherwise
|
|
@@ -204,8 +218,12 @@ function summarizeBash(command, sizeBytes, cwd) {
|
|
|
204
218
|
// the generic "Run command".
|
|
205
219
|
const rmMatch = cmd.match(/\b(?:rm|trash|trash-put|rmdir)\s+(?:(-rf?|-fr|--recursive|-r)\s+)?([^\n]+)/);
|
|
206
220
|
if (rmMatch) {
|
|
207
|
-
|
|
208
|
-
const
|
|
221
|
+
// Recursive only with an r/R flag: `rm -f x` deletes one file.
|
|
222
|
+
const flags = (rmMatch[1] ? `${rmMatch[1]} ` : "") + rmMatch[2];
|
|
223
|
+
const recursive = /(?:^|\s)(?:-[a-zA-Z]*[rR][a-zA-Z]*|--recursive)(?=\s|$)/.test(flags.split(/[;&|\n]/)[0]);
|
|
224
|
+
// `D=/some/dir; rm -f $D/x` shows the real path, not `$D/x`.
|
|
225
|
+
const vars = literalAssignments(cmd);
|
|
226
|
+
const targets = parseRmTargets(rmMatch[2]).map((t) => expandVars(t, vars));
|
|
209
227
|
if (targets.length <= 1) {
|
|
210
228
|
const target = targets[0] || "files";
|
|
211
229
|
const sqlExt = !recursive && /\.sql$/i.test(target);
|
|
@@ -237,6 +255,19 @@ function summarizeBash(command, sizeBytes, cwd) {
|
|
|
237
255
|
? { title: "Force push", target, kind: "git_force_push" }
|
|
238
256
|
: { title: "Push", target, kind: "git_push" };
|
|
239
257
|
}
|
|
258
|
+
const branchDelete = cmd.match(/\bgit\s+branch\s+(?:-D|--delete\s+--force|-d|--delete)\s+([^\s;&|]+)/);
|
|
259
|
+
if (branchDelete) {
|
|
260
|
+
const forced = /\bgit\s+branch\s+(?:-D|--delete\s+--force)\b/.test(cmd);
|
|
261
|
+
return {
|
|
262
|
+
title: "Delete local Git branch",
|
|
263
|
+
target: branchDelete[1],
|
|
264
|
+
annotation: forced ? "even if not merged" : undefined,
|
|
265
|
+
kind: "git_branch_delete",
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
const prisma = summarizePrismaDeploy(cmd);
|
|
269
|
+
if (prisma)
|
|
270
|
+
return prisma;
|
|
240
271
|
if (/\bgit\s+reset\s+--hard\b/.test(cmd))
|
|
241
272
|
return { title: "Hard reset — discard all local changes", kind: "git_reset_hard" };
|
|
242
273
|
if (/\bgit\s+clean\s+-f/.test(cmd))
|
|
@@ -250,7 +281,8 @@ function summarizeBash(command, sizeBytes, cwd) {
|
|
|
250
281
|
// message is a command substitution / heredoc — `-m "$(cat <<'EOF' … )"` —
|
|
251
282
|
// since that has no clean inline title to extract.
|
|
252
283
|
const m = cmd.match(/-m\s+["']([^"'$]+)["']/);
|
|
253
|
-
|
|
284
|
+
// The subject line only: a multi-line message made a multi-line title.
|
|
285
|
+
return m ? { title: `Git commit "${truncate(m[1].split("\n")[0].trim(), 60)}"`, kind: "git_commit" } : { title: "Git commit", kind: "git_commit" };
|
|
254
286
|
}
|
|
255
287
|
const gh = summarizeGh(cmd);
|
|
256
288
|
if (gh)
|
|
@@ -303,11 +335,7 @@ function summarizeBash(command, sizeBytes, cwd) {
|
|
|
303
335
|
// so "kill" inside echo text (e.g. "killing it") doesn't mislabel.
|
|
304
336
|
const killM = cmd.match(/(?:^|[\n;&|`({]|\$\(|\b(?:sudo|then|do|else|command|xargs)\s+)\s*(killall|pkill|kill)\b/);
|
|
305
337
|
if (killM) {
|
|
306
|
-
return {
|
|
307
|
-
title: killM[1].toLowerCase() === "kill" ? "Kill process" : "Kill processes",
|
|
308
|
-
body: truncateBody(cmd),
|
|
309
|
-
kind: "kill_process",
|
|
310
|
-
};
|
|
338
|
+
return { ...killTarget(cmd.slice((killM.index ?? 0) + killM[0].length - killM[1].length)), body: truncateBody(cmd), kind: "kill_process" };
|
|
311
339
|
}
|
|
312
340
|
// Multi-step pipeline
|
|
313
341
|
if (/&&|\|\||;/.test(cmd))
|
|
@@ -383,12 +411,17 @@ function summarizeCompoundBash(cmd, sizeBytes, cwd) {
|
|
|
383
411
|
if (TIER_ORDER[classify("Bash", { command: cmd })] !== top)
|
|
384
412
|
return null;
|
|
385
413
|
const lead = rank.indexOf(top);
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
const
|
|
414
|
+
// Variables set by earlier steps (`D=/dir; rm $D/x`) show as their values.
|
|
415
|
+
const vars = literalAssignments(cmd);
|
|
416
|
+
const step = expandVars(steps[lead], vars);
|
|
417
|
+
// npm publish reads the package.json a preceding `cd` points at; prisma reads
|
|
418
|
+
// a DATABASE_URL an earlier step exported.
|
|
419
|
+
const r = (/\bnpm\s+publish\b/.test(step) && summarizeNpmPublish(cmd, cwd)) ||
|
|
420
|
+
summarizePrismaDeploy(/\bprisma\s+migrate\s+deploy\b/.test(step) ? cmd : "") ||
|
|
421
|
+
summarizeBash(step, sizeBytes, cwd);
|
|
389
422
|
const also = [...new Set(steps
|
|
390
423
|
.filter((_, i) => i !== lead && rank[i] >= TIER_ORDER.review)
|
|
391
|
-
.map((s) => describeStep(s, cwd)))].filter((t) => t !== describeStep(step, cwd));
|
|
424
|
+
.map((s) => describeStep(expandVars(s, vars), cwd)))].filter((t) => t !== describeStep(step, cwd));
|
|
392
425
|
// The body shows the steps that need approval, not the setup and polling
|
|
393
426
|
// around them; the footnote says there are other steps.
|
|
394
427
|
const risky = steps.filter((_, i) => rank[i] >= TIER_ORDER.review);
|
|
@@ -646,7 +679,11 @@ const INTERPRETER_CONSUMER_RE = /(?:^|\||&&|;|\$\(|`)\s*(?:\w+=\S+\s+)*(?:sudo\s
|
|
|
646
679
|
// words but no .execute()-style call and no DB library cannot run SQL: it is
|
|
647
680
|
// text processing (a Python script that edits a source file whose comments
|
|
648
681
|
// say "DELETE FROM", for example), so it must not be shown as a SQL statement.
|
|
649
|
-
|
|
682
|
+
//
|
|
683
|
+
// The library must be loaded (import, require, from, use), not only named: a
|
|
684
|
+
// script that edits describe.ts, whose text says "psql" and "sqlite3", or a
|
|
685
|
+
// schema.prisma file, names a library without using one.
|
|
686
|
+
const DB_LIBRARY_RE = /(?:\bimport\s+|\bfrom\s+)['"]?(?:sqlite3|better-sqlite3|psycopg2?|psycopg|pymysql|MySQLdb|mysql2?|sqlalchemy|duckdb|knex|pg|@prisma\/client)\b|\brequire\(\s*['"](?:sqlite3|better-sqlite3|pg|mysql2?|knex|duckdb|@prisma\/client)['"]|\bnew\s+PrismaClient\b|\buse\s+DBI\b|\bSequel\.connect\b|\bsqlite3\.connect\s*\(|\bpsycopg2?\.connect\s*\(/;
|
|
650
687
|
// SQL to run from an interpreter body (node -e, python -c, `python - <<EOF`).
|
|
651
688
|
function sqlFromInterpreterBody(body) {
|
|
652
689
|
if (!SQL_KEYWORDS_RE.test(body))
|
|
@@ -1227,6 +1264,27 @@ function summarizeMcp(toolName, input) {
|
|
|
1227
1264
|
/** Desktop app tools whose name alone does not say what they do. */
|
|
1228
1265
|
function summarizeDesktopApp(server, tool, input) {
|
|
1229
1266
|
const str = (v) => (typeof v === "string" && v.trim() ? v.trim() : undefined);
|
|
1267
|
+
if (server === "Claude_Code_iOS_Simulator" && tool === "control")
|
|
1268
|
+
return summarizeSimulator(input);
|
|
1269
|
+
if (server === "scheduled-tasks") {
|
|
1270
|
+
const name = str(input.title) ?? str(input.taskId);
|
|
1271
|
+
const when = str(input.cronExpression) ? `cron ${str(input.cronExpression)}` : str(input.fireAt) ? `once at ${str(input.fireAt)}` : undefined;
|
|
1272
|
+
const verb = { create_scheduled_task: "Create a scheduled task", update_scheduled_task: "Change a scheduled task",
|
|
1273
|
+
run_scheduled_task: "Run a scheduled task now", delete_scheduled_task: "Delete a scheduled task" }[tool];
|
|
1274
|
+
if (verb) {
|
|
1275
|
+
const change = tool === "update_scheduled_task"
|
|
1276
|
+
? [input.prompt !== undefined ? "prompt" : "", when ? "schedule" : "", input.enabled === false ? "pause" : input.enabled === true ? "resume" : ""].filter(Boolean).join(", ")
|
|
1277
|
+
: "";
|
|
1278
|
+
return {
|
|
1279
|
+
title: verb,
|
|
1280
|
+
target: name,
|
|
1281
|
+
annotation: [when, change ? `changes: ${change}` : ""].filter(Boolean).join(" · ") || undefined,
|
|
1282
|
+
body: str(input.prompt),
|
|
1283
|
+
footnote: tool === "create_scheduled_task" ? "Claude runs this prompt on its own on this schedule" : undefined,
|
|
1284
|
+
kind: "schedule",
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
}
|
|
1230
1288
|
if (server === "ccd_turn" && tool === "update_plan") {
|
|
1231
1289
|
return { title: "Update the task list in the Claude app", kind: "session_housekeeping" };
|
|
1232
1290
|
}
|
|
@@ -1245,6 +1303,27 @@ function summarizeDesktopApp(server, tool, input) {
|
|
|
1245
1303
|
}
|
|
1246
1304
|
return null;
|
|
1247
1305
|
}
|
|
1306
|
+
/** The desktop app's iOS Simulator tool: one `control` tool, many actions. */
|
|
1307
|
+
function summarizeSimulator(input) {
|
|
1308
|
+
const a = typeof input.action === "string" ? input.action : "";
|
|
1309
|
+
const at = typeof input.x === "number" && typeof input.y === "number" ? `(${input.x}, ${input.y})` : undefined;
|
|
1310
|
+
const titles = {
|
|
1311
|
+
attach: "Show the iOS Simulator panel", detach: "Close the iOS Simulator panel", screenshot: "Take an iOS Simulator screenshot",
|
|
1312
|
+
launch: "Install and open an app in the iOS Simulator", tap: "Tap in the iOS Simulator", swipe: "Swipe in the iOS Simulator",
|
|
1313
|
+
touch_path: "Drag in the iOS Simulator", touch2_path: "Pinch or rotate in the iOS Simulator", text: "Type text in the iOS Simulator",
|
|
1314
|
+
button: "Press a button in the iOS Simulator", open_url: "Open a link in the iOS Simulator",
|
|
1315
|
+
};
|
|
1316
|
+
const target = a === "launch" ? (typeof input.bundle_id === "string" ? input.bundle_id : typeof input.app_path === "string" ? shortenPath(input.app_path) : undefined)
|
|
1317
|
+
: a === "open_url" ? input.url
|
|
1318
|
+
: a === "button" ? input.name
|
|
1319
|
+
: at;
|
|
1320
|
+
return {
|
|
1321
|
+
title: titles[a] ?? `Use the iOS Simulator${a ? ` (${a})` : ""}`,
|
|
1322
|
+
target,
|
|
1323
|
+
body: a === "text" && typeof input.text === "string" ? input.text : undefined,
|
|
1324
|
+
kind: "simulator",
|
|
1325
|
+
};
|
|
1326
|
+
}
|
|
1248
1327
|
function identifyTarget(input) {
|
|
1249
1328
|
const id = input.id ?? input.name ?? input.path ?? input.target ?? input.repo ?? input.repository ?? null;
|
|
1250
1329
|
if (id == null)
|
|
@@ -1568,6 +1647,72 @@ function parseRmTargets(argsString) {
|
|
|
1568
1647
|
}
|
|
1569
1648
|
return targets;
|
|
1570
1649
|
}
|
|
1650
|
+
/** What a kill stops: a pattern, process names, a port, or process ids. */
|
|
1651
|
+
function killTarget(step) {
|
|
1652
|
+
const line = step.split(/\n|;|&&|\|\|/)[0].trim();
|
|
1653
|
+
const words = (s) => (s.match(/'[^']*'|"[^"]*"|\S+/g) ?? []).map((w) => w.replace(/^['"]|['"]$/g, ""));
|
|
1654
|
+
if (/^pkill\b/.test(line)) {
|
|
1655
|
+
const w = words(line.replace(/\|.*$/, "")).slice(1).filter((x) => !/^-(?!f$)/.test(x));
|
|
1656
|
+
const f = w.indexOf("-f");
|
|
1657
|
+
return { title: "Stop processes matching", target: (f >= 0 ? w[f + 1] : w[w.length - 1]) || undefined };
|
|
1658
|
+
}
|
|
1659
|
+
if (/^killall\b/.test(line)) {
|
|
1660
|
+
return { title: "Stop processes named", target: words(line).slice(1).filter((x) => !x.startsWith("-")).join(", ") || undefined };
|
|
1661
|
+
}
|
|
1662
|
+
const port = line.match(/lsof\b[^)]*?-i\s*(?:tcp|TCP|udp)?:?(\d+)|-iTCP:(\d+)/);
|
|
1663
|
+
if (port)
|
|
1664
|
+
return { title: "Stop the process on port", target: port[1] ?? port[2] };
|
|
1665
|
+
const pg = line.match(/\$\(\s*pgrep\s+(?:-\w+\s+)*(?:-f\s+)?(['"]?)(.+?)\1\s*\)/);
|
|
1666
|
+
if (pg)
|
|
1667
|
+
return { title: "Stop processes matching", target: pg[2] };
|
|
1668
|
+
const pids = words(line).slice(1).filter((x) => /^\d+$/.test(x));
|
|
1669
|
+
if (pids.length)
|
|
1670
|
+
return { title: pids.length === 1 ? "Stop process" : "Stop processes", target: `PID ${pids.join(", ")}` };
|
|
1671
|
+
return { title: "Stop processes" };
|
|
1672
|
+
}
|
|
1673
|
+
/** `python3 - <<'EOF' … EOF` (one step): "Run a Python script" with the script as the body. */
|
|
1674
|
+
function summarizeCodeHeredoc(cmd) {
|
|
1675
|
+
if (splitTopLevel(cmd).length > 1)
|
|
1676
|
+
return null;
|
|
1677
|
+
const m = cmd.match(/^(?:\w+=\S+\s+)*(?:sudo\s+)?(node|python\d?(?:\.\d+)?|ruby|perl|deno|bun)\b[^\n]*<<-?\s*(["']?)([A-Za-z_]\w*)\2[^\n]*\n([\s\S]*?)\n\s*\3\s*$/);
|
|
1678
|
+
if (!m)
|
|
1679
|
+
return null;
|
|
1680
|
+
const lang = m[1].startsWith("python") ? "Python" : m[1] === "node" ? "Node" : m[1].charAt(0).toUpperCase() + m[1].slice(1);
|
|
1681
|
+
const files = [...m[4].matchAll(/(?:open|readFileSync|writeFileSync|Path)\(\s*['"]([^'"]+)['"]/g)].map((f) => f[1]);
|
|
1682
|
+
const edits = /\.write\(|writeFileSync|write_text\(/.test(m[4]);
|
|
1683
|
+
return {
|
|
1684
|
+
title: edits && files.length ? `Edit file with a ${lang} script` : `Run a ${lang} script`,
|
|
1685
|
+
target: files.length ? [...new Set(files)].map(shortenPath).join("\n") : undefined,
|
|
1686
|
+
body: truncateBody(m[4]),
|
|
1687
|
+
kind: edits ? "file_edit" : "script_run",
|
|
1688
|
+
};
|
|
1689
|
+
}
|
|
1690
|
+
/** `prisma migrate deploy`: which database, from a DATABASE_URL set in the command. */
|
|
1691
|
+
function summarizePrismaDeploy(cmd) {
|
|
1692
|
+
if (!/\bprisma\s+migrate\s+deploy\b/.test(cmd))
|
|
1693
|
+
return null;
|
|
1694
|
+
const url = cmd.match(/DATABASE_URL=["']?([a-z]+:\/\/[^\s"';&|]+)/)?.[1];
|
|
1695
|
+
let db;
|
|
1696
|
+
if (url) {
|
|
1697
|
+
try {
|
|
1698
|
+
const u = new URL(url);
|
|
1699
|
+
db = `${u.hostname}${u.port ? `:${u.port}` : ""}${u.pathname}`;
|
|
1700
|
+
}
|
|
1701
|
+
catch { /* keep undefined */ }
|
|
1702
|
+
}
|
|
1703
|
+
return { title: "Apply Prisma database migrations", target: db, annotation: db ? undefined : "to the database in DATABASE_URL", kind: "sql_migrate" };
|
|
1704
|
+
}
|
|
1705
|
+
/** `NAME=value` assignments with a literal value (no `$(…)`, no backticks), in order. */
|
|
1706
|
+
function literalAssignments(cmd) {
|
|
1707
|
+
const vars = new Map();
|
|
1708
|
+
const re = /(?:^|[;&|\n(]\s*)(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)=("[^"$`]*"|'[^']*'|[^\s;&|$`'"()]+)(?=[\s;&|)]|$)/g;
|
|
1709
|
+
for (const m of cmd.matchAll(re))
|
|
1710
|
+
vars.set(m[1], m[2].replace(/^["']|["']$/g, ""));
|
|
1711
|
+
return vars;
|
|
1712
|
+
}
|
|
1713
|
+
function expandVars(token, vars) {
|
|
1714
|
+
return token.replace(/\$\{?([A-Za-z_][A-Za-z0-9_]*)\}?/g, (whole, name) => vars.get(name) ?? whole);
|
|
1715
|
+
}
|
|
1571
1716
|
function stripQuotes(s) {
|
|
1572
1717
|
return s.replace(/^['"]|['"]$/g, "");
|
|
1573
1718
|
}
|
package/dist/kinds.d.ts
CHANGED
|
@@ -7,4 +7,4 @@
|
|
|
7
7
|
* classifier that produced them.
|
|
8
8
|
*/
|
|
9
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";
|
|
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" | "sql_migrate" | "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" | "git_branch_delete" | "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" | "simulator" | "script_run" | "worktree" | "schedule" | "agent_message" | "web_fetch" | "monitor" | "artifact" | "agent_launch" | "shell_pipeline" | "unknown_bash" | "unknown_tool";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@oked/sdk",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.8",
|
|
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.
|
|
48
|
+
"@oked/receipt-core": "0.6.8"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@types/node": "^22.13.10",
|