@kontextmind/kxm 0.7.16 → 0.7.18

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 (39) hide show
  1. package/.claude-plugin/marketplace.json +1 -1
  2. package/docs/README.md +1 -1
  3. package/docs/browser-automation.md +24 -1
  4. package/docs/prompts/browser-annotate-feedback.md +17 -0
  5. package/docs/prompts/browser-diagnose-recover.md +17 -0
  6. package/docs/prompts/browser-explore.md +17 -0
  7. package/docs/prompts/browser-repro-fix.md +17 -0
  8. package/docs/prompts/browser-start.md +17 -0
  9. package/docs/prompts/browser-takeover.md +17 -0
  10. package/docs/templates/README.md +1 -1
  11. package/package.json +8 -6
  12. package/plugins/kxm/.claude-plugin/plugin.json +1 -1
  13. package/plugins/kxm/dist/cli.js +43 -39
  14. package/plugins/kxm/dist/core.js +3 -2
  15. package/plugins/kxm/dist/extension.js +34472 -11328
  16. package/plugins/kxm/dist/mcp-server.js +1 -1
  17. package/plugins/kxm/dist/runtime.js +43 -39
  18. package/plugins/kxm/dist/server.js +43 -39
  19. package/plugins/kxm/dist/vnext-runtime-supervisor.js +40 -37
  20. package/plugins/kxm/package.json +4 -1
  21. package/plugins/kxm/src/extension.ts +9 -0
  22. package/plugins/kxm/src/mcp-server.ts +1 -1
  23. package/plugins/kxm/src/providers/claude-bridge/LICENSE +21 -0
  24. package/plugins/kxm/src/providers/claude-bridge/README.md +18 -0
  25. package/plugins/kxm/src/providers/claude-bridge/config.ts +53 -0
  26. package/plugins/kxm/src/providers/claude-bridge/convert.ts +180 -0
  27. package/plugins/kxm/src/providers/claude-bridge/index.ts +28 -0
  28. package/plugins/kxm/src/providers/claude-bridge/mcp-server.ts +59 -0
  29. package/plugins/kxm/src/providers/claude-bridge/models.ts +166 -0
  30. package/plugins/kxm/src/providers/claude-bridge/pi-compat.ts +215 -0
  31. package/plugins/kxm/src/providers/claude-bridge/prompt-stream.ts +89 -0
  32. package/plugins/kxm/src/providers/claude-bridge/provider.ts +286 -0
  33. package/plugins/kxm/src/providers/claude-bridge/query-state.ts +72 -0
  34. package/plugins/kxm/src/providers/claude-bridge/redact.ts +26 -0
  35. package/plugins/kxm/src/providers/claude-bridge/register.ts +124 -0
  36. package/plugins/kxm/src/providers/claude-bridge/stream.ts +390 -0
  37. package/plugins/kxm/src/providers/claude-bridge/tools.ts +140 -0
  38. package/plugins/kxm/src/redact.ts +3 -2
  39. package/scripts/build-runtime.mjs +5 -1
@@ -11,7 +11,7 @@
11
11
  "name": "kxm",
12
12
  "source": "./plugins/kxm",
13
13
  "description": "Durable workflows, peer agents, and kxm tui",
14
- "version": "0.7.16",
14
+ "version": "0.7.18",
15
15
  "category": "development",
16
16
  "tags": ["kxm", "multi-agent", "workflows", "mcp"]
17
17
  }
package/docs/README.md CHANGED
@@ -9,7 +9,7 @@ This documentation is organized by task. Start with the guide that matches what
9
9
  | [Configuration](configuration.md) | Users and operators | Understand every supported setting and default |
10
10
  | [Architecture](architecture.md) | Maintainers and integrators | Learn the component boundaries and message lifecycle |
11
11
  | [Agent Skills](agent-skills.md) | Users and integrators | Comprehensive skill suite covering all KXM commands with progressive disclosure |
12
- | [Browser automation](browser-automation.md) | Developers and operators | Self-hosted Steel on DOKS, agent-browser, Playwright, pass-cli, and human takeover |
12
+ | [Browser automation](browser-automation.md) | Developers and operators | Self-hosted Steel on DOKS, agent-browser, Playwright, pass-cli, and human takeover. See the [knowledge base](browser-automation.md#knowledge-base) and [prompt templates](browser-automation.md#prompt-templates) |
13
13
  | [Skills](skills.md) | Operators and skill authors | Governed candidate lifecycle; also the [repository work delivery](skills/repo-work-delivery.md) skill |
14
14
  | [Operations](operations.md) | Hub operators | Run, monitor, secure, and recover the service |
15
15
  | [Troubleshooting](troubleshooting.md) | Everyone | Diagnose common installation and delivery failures |
@@ -7,7 +7,7 @@ project: "kxm"
7
7
  status: "accepted"
8
8
  owner: "@operator"
9
9
  created: "2026-09-14"
10
- updated: "2026-09-14"
10
+ updated: "2026-09-15"
11
11
  authority: "instruction"
12
12
  confidence: "verified"
13
13
  summary: "Comprehensive guide to browser automation in KXM using self-hosted Steel on DOKS, agent-browser, Playwright, pass-cli, and human takeover."
@@ -114,3 +114,26 @@ When authentication challenges (MFA, CAPTCHA, SSO) are encountered:
114
114
  - **Session Timeouts**: Default 300s (5m), max 1800s (30m). Sessions terminate automatically on expiry.
115
115
  - **Orphan Sweeping**: Periodically sweep untracked sessions via `GET /v1/sessions` and release idle processes.
116
116
  - **Memory Protection**: Kubernetes mounts a 2Gi `emptyDir` memory volume at `/dev/shm` to prevent Chromium tab crashes without exhausting node memory.
117
+
118
+ ---
119
+
120
+ ## Knowledge base
121
+
122
+ - [How are credentials retrieved without exposing them to the model?](kb/how-credentials-retrieved-safely.md)
123
+ - [How do I capture a UI section and annotate changes for an agent?](kb/how-to-capture-and-annotate-section.md)
124
+ - [How do I connect Playwright to the existing Steel session?](kb/how-to-connect-playwright-to-steel.md)
125
+ - [How do I recover an expired session or remove an orphaned browser?](kb/how-to-recover-expired-session-or-orphan.md)
126
+ - [How does an agent resume after MFA?](kb/how-to-resume-after-mfa.md)
127
+ - [How do I take over a browser session to log in?](kb/how-to-take-over-session.md)
128
+ - [Why did authentication disappear?](kb/why-authentication-disappeared.md)
129
+ - [Why did automation open a different browser?](kb/why-automation-opened-different-browser.md)
130
+ - [Why can I view a session but not control it?](kb/why-session-viewer-cannot-control.md)
131
+
132
+ ## Prompt templates
133
+
134
+ - [Starting browser work](prompts/browser-start.md)
135
+ - [Exploring an application](prompts/browser-explore.md)
136
+ - [Requesting human takeover](prompts/browser-takeover.md)
137
+ - [Diagnosing and recovering a failed session](prompts/browser-diagnose-recover.md)
138
+ - [Reproducing a UI bug and writing a Playwright test](prompts/browser-repro-fix.md)
139
+ - [Capturing UI section annotations](prompts/browser-annotate-feedback.md)
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-006"
4
+ type: "prompt"
5
+ title: "Capturing UI Section Annotations and Sending Changes to Agent"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Turn annotated Steel UI-section feedback into source changes and recapture verified proof."
14
+ tags: ["browser", "annotation", "feedback", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-to-capture-and-annotate-section.md"]
16
+ ---
17
+
1
18
  # Task Template: Capturing UI Section Annotations and Sending Changes to Agent
2
19
 
3
20
  ## Purpose
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-004"
4
+ type: "prompt"
5
+ title: "Diagnosing and Recovering a Failed Browser Session"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Troubleshoot unresponsive Steel sessions, CDP attachment errors, auth loops, and orphaned browser containers."
14
+ tags: ["browser", "diagnostics", "recovery", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-to-recover-expired-session-or-orphan.md"]
16
+ ---
17
+
1
18
  # Task Template: Diagnosing and Recovering a Failed Browser Session
2
19
 
3
20
  ## Purpose
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-002"
4
+ type: "prompt"
5
+ title: "Exploring an Application with an Authenticated Session"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Exploratory discovery, DOM mapping, and journey inspection via agent-browser attached to a remote Steel session."
14
+ tags: ["browser", "explore", "agent-browser", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-to-connect-playwright-to-steel.md"]
16
+ ---
17
+
1
18
  # Task Template: Exploring an Application with an Authenticated Session
2
19
 
3
20
  ## Purpose
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-005"
4
+ type: "prompt"
5
+ title: "Reproducing a UI Bug and Producing a Playwright Regression Test"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Reproduce a UI defect on Steel, collect evidence, write a Playwright regression, and prove RED then GREEN."
14
+ tags: ["browser", "playwright", "repro", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-to-connect-playwright-to-steel.md"]
16
+ ---
17
+
1
18
  # Task Template: Reproducing a UI Bug and Producing a Playwright Regression Test
2
19
 
3
20
  ## Purpose
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-001"
4
+ type: "prompt"
5
+ title: "Starting Browser Work in a KXM Project"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Initialize a remote Steel browser session for a project task, verifying credentials, connectivity, and attachment endpoints before automation."
14
+ tags: ["browser", "steel", "session", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-credentials-retrieved-safely.md"]
16
+ ---
17
+
1
18
  # Task Template: Starting Browser Work in a KXM Project
2
19
 
3
20
  ## Purpose
@@ -1,3 +1,20 @@
1
+ ---
2
+ schema: "kxm.doc.v1"
3
+ id: "PROMPT-BROWSER-003"
4
+ type: "prompt"
5
+ title: "Requesting Human Authentication and Resuming Afterward"
6
+ project: "kxm"
7
+ status: "accepted"
8
+ owner: "@operator"
9
+ created: "2026-09-14"
10
+ updated: "2026-09-15"
11
+ authority: "instruction"
12
+ confidence: "verified"
13
+ summary: "Pause automation for MFA, OAuth, or CAPTCHA takeover, then resume after verified human success."
14
+ tags: ["browser", "takeover", "mfa", "prompt"]
15
+ related: ["docs/browser-automation.md", "docs/kb/how-to-take-over-session.md", "docs/kb/how-to-resume-after-mfa.md"]
16
+ ---
17
+
1
18
  # Task Template: Requesting Human Authentication and Resuming Afterward
2
19
 
3
20
  ## Purpose
@@ -40,7 +40,7 @@ This directory contains standardized Markdown documentation templates adapted fo
40
40
 
41
41
  ## Workflow Guide Integration Matrix
42
42
 
43
- The 12 templates map directly across the 7 Areas and 22 Workflows in [`docs/workflow-guide.md`](../workflow-guide.md):
43
+ The 11 templates map directly across the 7 Areas and 22 Workflows in [`docs/workflow-guide.md`](../workflow-guide.md):
44
44
 
45
45
  ```mermaid
46
46
  flowchart TD
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextmind/kxm",
3
- "version": "0.7.16",
3
+ "version": "0.7.18",
4
4
  "description": "KXM local-first multi-agent orchestration and operator dashboard",
5
5
  "type": "module",
6
6
  "author": "KontextMind",
@@ -69,6 +69,12 @@
69
69
  "./plugins/kxm/skills"
70
70
  ]
71
71
  },
72
+ "dependencies": {
73
+ "@anthropic-ai/claude-agent-sdk": "0.2.141",
74
+ "@earendil-works/pi-tui": "0.85.1",
75
+ "@modelcontextprotocol/sdk": "1.30.0",
76
+ "yaml": "^2.9.0"
77
+ },
72
78
  "peerDependencies": {
73
79
  "@earendil-works/pi-coding-agent": "*",
74
80
  "typebox": "*"
@@ -120,9 +126,5 @@
120
126
  "LICENSE",
121
127
  "SECURITY.md"
122
128
  ],
123
- "license": "MIT",
124
- "dependencies": {
125
- "@earendil-works/pi-tui": "0.85.1",
126
- "yaml": "^2.9.0"
127
- }
129
+ "license": "MIT"
128
130
  }
@@ -2,7 +2,7 @@
2
2
  "$schema": "https://json.schemastore.org/claude-code-plugin-manifest.json",
3
3
  "name": "kxm",
4
4
  "displayName": "KXM",
5
- "version": "0.7.16",
5
+ "version": "0.7.18",
6
6
  "description": "Headless multi-agent orchestration, durable workflows, and a live operator dashboard for Pi and Claude Code",
7
7
  "author": {
8
8
  "name": "KontextMind",
@@ -8072,36 +8072,38 @@ var require_Alias = __commonJS({
8072
8072
  if (node.anchor === this.source)
8073
8073
  found = node;
8074
8074
  }
8075
+ if (found && ctx) {
8076
+ const { anchors: anchors2, doc: doc2, maxAliasCount } = ctx;
8077
+ let data = anchors2.get(found);
8078
+ if (!data) {
8079
+ toJS.toJS(found, null, ctx);
8080
+ data = anchors2.get(found);
8081
+ }
8082
+ if (data?.res === void 0) {
8083
+ const msg = "This should not happen: Alias anchor was not resolved?";
8084
+ throw new ReferenceError(msg);
8085
+ }
8086
+ if (maxAliasCount >= 0) {
8087
+ data.count += 1;
8088
+ if (data.aliasCount === 0)
8089
+ data.aliasCount = getAliasCount(doc2, found, anchors2);
8090
+ if (data.count * data.aliasCount > maxAliasCount) {
8091
+ const msg = "Excessive alias count indicates a resource exhaustion attack";
8092
+ throw new ReferenceError(msg);
8093
+ }
8094
+ }
8095
+ }
8075
8096
  return found;
8076
8097
  }
8077
8098
  toJSON(_arg, ctx) {
8078
8099
  if (!ctx)
8079
8100
  return { source: this.source };
8080
- const { anchors: anchors2, doc, maxAliasCount } = ctx;
8081
- const source = this.resolve(doc, ctx);
8101
+ const source = this.resolve(ctx.doc, ctx);
8082
8102
  if (!source) {
8083
8103
  const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;
8084
8104
  throw new ReferenceError(msg);
8085
8105
  }
8086
- let data = anchors2.get(source);
8087
- if (!data) {
8088
- toJS.toJS(source, null, ctx);
8089
- data = anchors2.get(source);
8090
- }
8091
- if (data?.res === void 0) {
8092
- const msg = "This should not happen: Alias anchor was not resolved?";
8093
- throw new ReferenceError(msg);
8094
- }
8095
- if (maxAliasCount >= 0) {
8096
- data.count += 1;
8097
- if (data.aliasCount === 0)
8098
- data.aliasCount = getAliasCount(doc, source, anchors2);
8099
- if (data.count * data.aliasCount > maxAliasCount) {
8100
- const msg = "Excessive alias count indicates a resource exhaustion attack";
8101
- throw new ReferenceError(msg);
8102
- }
8103
- }
8104
- return data.res;
8106
+ return ctx.anchors.get(source).res;
8105
8107
  }
8106
8108
  toString(ctx, _onComment, _onChompKeep) {
8107
8109
  const src = `*${this.source}`;
@@ -12103,37 +12105,38 @@ var require_resolve_flow_scalar = __commonJS({
12103
12105
  }
12104
12106
  if (badChar)
12105
12107
  onError(0, "BAD_SCALAR_START", `Plain value cannot start with ${badChar}`);
12106
- return foldLines(source);
12108
+ return unfoldLines(source);
12107
12109
  }
12108
12110
  function singleQuotedValue(source, onError) {
12109
12111
  if (source[source.length - 1] !== "'" || source.length === 1)
12110
12112
  onError(source.length, "MISSING_CHAR", "Missing closing 'quote");
12111
- return foldLines(source.slice(1, -1)).replace(/''/g, "'");
12113
+ return unfoldLines(source.slice(1, -1)).replace(/''/g, "'");
12112
12114
  }
12113
- function foldLines(source) {
12114
- let first, line;
12115
+ function unfoldLines(source) {
12116
+ const line = /(.*?)\r?\n/sy;
12117
+ let match = line.exec(source);
12118
+ if (!match)
12119
+ return source;
12120
+ let trimEnd, trimBoth;
12115
12121
  try {
12116
- first = new RegExp("(.*?)(?<![ ])[ ]*\r?\n", "sy");
12117
- line = new RegExp("[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?\n", "sy");
12122
+ trimEnd = new RegExp("(?<![ ])[ ]+$");
12123
+ trimBoth = new RegExp("^[ ]+|(?<![ ])[ ]+$", "g");
12118
12124
  } catch {
12119
- first = /(.*?)[ \t]*\r?\n/sy;
12120
- line = /[ \t]*(.*?)[ \t]*\r?\n/sy;
12125
+ trimEnd = /[ \t]+$/;
12126
+ trimBoth = /^[ \t]+|[ \t]+$/g;
12121
12127
  }
12122
- let match = first.exec(source);
12123
- if (!match)
12124
- return source;
12125
- let res = match[1];
12128
+ let res = match[1].replace(trimEnd, "");
12126
12129
  let sep4 = " ";
12127
- let pos = first.lastIndex;
12128
- line.lastIndex = pos;
12130
+ let pos = line.lastIndex;
12129
12131
  while (match = line.exec(source)) {
12130
- if (match[1] === "") {
12132
+ const lm = match[1].replace(trimBoth, "");
12133
+ if (lm === "") {
12131
12134
  if (sep4 === "\n")
12132
12135
  res += sep4;
12133
12136
  else
12134
12137
  sep4 = "\n";
12135
12138
  } else {
12136
- res += sep4 + match[1];
12139
+ res += sep4 + lm;
12137
12140
  sep4 = " ";
12138
12141
  }
12139
12142
  pos = line.lastIndex;
@@ -25690,6 +25693,7 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
25690
25693
  // plugins/kxm/src/redact.ts
25691
25694
  var SECRET_PATTERNS = [
25692
25695
  /\bsk-[A-Za-z0-9_-]{8,}\b/g,
25696
+ /\bsk-ant-[A-Za-z0-9_-]{8,}\b/g,
25693
25697
  /\bghp_[A-Za-z0-9_]{20,}\b/g,
25694
25698
  /\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,
25695
25699
  /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/gi,
@@ -25697,9 +25701,9 @@ var SECRET_PATTERNS = [
25697
25701
  /\bya29\.[A-Za-z0-9._~+/-]+=*/g,
25698
25702
  /\b1\/\/[A-Za-z0-9_-]+/g,
25699
25703
  /\b1\/[A-Za-z0-9_-]{20,}/g,
25700
- /("?(?:access_token|refresh_token|id_token)"?\s*[:=]\s*")[^"]*(")/gi,
25704
+ /("?(?:access_token|refresh_token|id_token|sessionKey|session_key|claude_oauth_token|anthropicApiKey)"?\s*[:=]\s*")[^"]*(")/gi,
25701
25705
  /\bKXM_[A-Z0-9_]*(TOKEN|SECRET|KEY)[A-Z0-9_]*=\S+/gi,
25702
- /\b(GITHUB_TOKEN|GH_TOKEN|KXM_AUTH_TOKEN|KXM_WORKFLOW_SIGNAL_SECRET)=\S+/gi,
25706
+ /\b(GITHUB_TOKEN|GH_TOKEN|KXM_AUTH_TOKEN|KXM_WORKFLOW_SIGNAL_SECRET|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|CLAUDE_API_KEY)=\S+/gi,
25703
25707
  /\b[A-Fa-f0-9]{64}\b/g
25704
25708
  ];
25705
25709
  function redactSecrets(value) {
@@ -828,6 +828,7 @@ function workerResult(worker, payload) {
828
828
  // plugins/kxm/src/redact.ts
829
829
  var SECRET_PATTERNS = [
830
830
  /\bsk-[A-Za-z0-9_-]{8,}\b/g,
831
+ /\bsk-ant-[A-Za-z0-9_-]{8,}\b/g,
831
832
  /\bghp_[A-Za-z0-9_]{20,}\b/g,
832
833
  /\bgithub_pat_[A-Za-z0-9_]{20,}\b/g,
833
834
  /\bxox[baprs]-[A-Za-z0-9-]{10,}\b/gi,
@@ -835,9 +836,9 @@ var SECRET_PATTERNS = [
835
836
  /\bya29\.[A-Za-z0-9._~+/-]+=*/g,
836
837
  /\b1\/\/[A-Za-z0-9_-]+/g,
837
838
  /\b1\/[A-Za-z0-9_-]{20,}/g,
838
- /("?(?:access_token|refresh_token|id_token)"?\s*[:=]\s*")[^"]*(")/gi,
839
+ /("?(?:access_token|refresh_token|id_token|sessionKey|session_key|claude_oauth_token|anthropicApiKey)"?\s*[:=]\s*")[^"]*(")/gi,
839
840
  /\bKXM_[A-Z0-9_]*(TOKEN|SECRET|KEY)[A-Z0-9_]*=\S+/gi,
840
- /\b(GITHUB_TOKEN|GH_TOKEN|KXM_AUTH_TOKEN|KXM_WORKFLOW_SIGNAL_SECRET)=\S+/gi,
841
+ /\b(GITHUB_TOKEN|GH_TOKEN|KXM_AUTH_TOKEN|KXM_WORKFLOW_SIGNAL_SECRET|ANTHROPIC_API_KEY|ANTHROPIC_AUTH_TOKEN|CLAUDE_API_KEY)=\S+/gi,
841
842
  /\b[A-Fa-f0-9]{64}\b/g
842
843
  ];
843
844
  function redactSecrets(value) {