cuonztech-agent-harness 0.8.0 → 0.10.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.
@@ -0,0 +1,53 @@
1
+ import { describesWriting, descriptionOpensWithReadVerb, descriptionSaysReadOnly } from "./classification-doubt.js";
2
+ const WRITE_WORDS = new Set([
3
+ "create", "add", "insert", "append", "prepend", "update", "edit", "modify", "change", "patch", "put", "set",
4
+ "delete", "remove", "drop", "destroy", "purge", "clear", "erase", "reset", "restore", "recover",
5
+ "rename", "replace", "move", "copy", "clone", "duplicate", "push", "merge", "fork", "rebase", "revert",
6
+ "apply", "deploy", "undeploy", "publish", "unpublish", "send", "post", "reply", "forward", "submit",
7
+ "write", "save", "store", "persist", "upload", "import", "sync", "cancel", "approve", "reject",
8
+ "deny", "book", "pay", "charge", "refund", "transfer", "withdraw", "deposit", "purchase", "buy",
9
+ "register", "subscribe", "unsubscribe", "invite", "assign", "unassign", "close", "reopen",
10
+ "enable", "disable", "toggle", "pause", "resume", "start", "stop", "restart", "kill", "terminate",
11
+ "schedule", "sign", "revoke", "grant", "mark", "archive", "unarchive", "pin", "unpin", "star",
12
+ "unstar", "like", "follow", "unfollow", "link", "unlink", "attach", "detach", "scale", "promote",
13
+ "rollout", "rollback", "cordon", "drain", "install", "uninstall", "upgrade", "downgrade",
14
+ "migrate", "cleanup", "flush", "commit", "increment", "decrement", "lock", "unlock", "mute",
15
+ "unmute", "rotate", "enroll",
16
+ ]);
17
+ const STRONG_READ_WORDS = new Set([
18
+ "get", "list", "search", "find", "fetch", "retrieve", "query", "describe", "read", "show", "lookup",
19
+ ]);
20
+ // "slackPostMessage", "API-post-page", "kubectl_apply", "Ändern_Status" -> lower-case words.
21
+ // Letters by Unicode class: a word in another script stays one word.
22
+ export function nameWords(name) {
23
+ return name
24
+ .replace(/(\p{Ll}|\p{N})(\p{Lu})/gu, "$1 $2")
25
+ .split(/[^\p{L}\p{N}]+/u)
26
+ .filter((w) => w.length > 0)
27
+ .map((w) => w.toLowerCase());
28
+ }
29
+ export function classifyByVerbWords(name, description) {
30
+ const words = nameWords(name);
31
+ const write = words.some((w) => WRITE_WORDS.has(w));
32
+ const read = words.some((w) => STRONG_READ_WORDS.has(w));
33
+ let guess = "unclassified";
34
+ if (write && !read)
35
+ guess = "write";
36
+ else if (read && !write)
37
+ guess = "read";
38
+ if (guess === "unclassified" || !description)
39
+ return guess;
40
+ // The description is a second witness: a contradiction means no guess.
41
+ if (guess === "write" && (descriptionOpensWithReadVerb(description) || descriptionSaysReadOnly(description)))
42
+ return "unclassified";
43
+ if (guess === "read" && describesWriting(description) !== null)
44
+ return "unclassified";
45
+ return guess;
46
+ }
47
+ // A name that STARTS like a read but goes on to write ("get_or_create_user", "read_and_delete",
48
+ // "fetch_and_store", "search_and_replace"): the read prefix alone would call it a read.
49
+ export function readPrefixThenWrites(name) {
50
+ const words = nameWords(name);
51
+ const conj = words.findIndex((w, i) => i > 0 && (w === "and" || w === "or" || w === "then"));
52
+ return conj !== -1 && words.slice(conj + 1).some((w) => WRITE_WORDS.has(w));
53
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cuonztech-agent-harness",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
4
  "mcpName": "io.github.cuonztech/agent-harness",
5
5
  "description": "Chaos-Proxy für MCP-Server: injiziert F1-F5-Fehlerszenarien (Ghost-Write nach Timeout, 429, defektes JSON, Duplicate Dispatch, 500) vor einem echten Upstream-MCP-Server und prüft, ob ein Agent Schreibvorgänge doppelt ausführt. Mit Resilience Score und System-Prompt-Patches für beobachtetes Fehlverhalten.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -6,12 +6,12 @@
6
6
  "url": "https://github.com/cuonztech/agent-harness",
7
7
  "source": "github"
8
8
  },
9
- "version": "0.8.0",
9
+ "version": "0.10.0",
10
10
  "packages": [
11
11
  {
12
12
  "registryType": "npm",
13
13
  "identifier": "cuonztech-agent-harness",
14
- "version": "0.8.0",
14
+ "version": "0.10.0",
15
15
  "transport": {
16
16
  "type": "stdio"
17
17
  }