@scotthuang/agent-knock-knock 0.16.6 → 0.16.7

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 (73) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/README.md +16 -8
  3. package/connectors/deepseek-harness/README.md +91 -19
  4. package/connectors/pi/README.md +18 -7
  5. package/dist/src/claude-agent-discovery-cache.d.ts +6 -0
  6. package/dist/src/claude-agent-discovery-cache.js +41 -0
  7. package/dist/src/claude-agent-discovery-cache.js.map +1 -0
  8. package/dist/src/claude-native-discovery.d.ts +1 -0
  9. package/dist/src/claude-native-discovery.js +107 -47
  10. package/dist/src/claude-native-discovery.js.map +1 -1
  11. package/dist/src/claude-terminal-agent-observation.d.ts +4 -0
  12. package/dist/src/claude-terminal-agent-observation.js +58 -5
  13. package/dist/src/claude-terminal-agent-observation.js.map +1 -1
  14. package/dist/src/claude-terminal-registry-observation.d.ts +18 -0
  15. package/dist/src/claude-terminal-registry-observation.js +31 -0
  16. package/dist/src/claude-terminal-registry-observation.js.map +1 -1
  17. package/dist/src/cli-core.js +5 -3
  18. package/dist/src/cli-core.js.map +1 -1
  19. package/dist/src/cli-runtime-context.d.ts +7 -1
  20. package/dist/src/cli-runtime-context.js +30 -2
  21. package/dist/src/cli-runtime-context.js.map +1 -1
  22. package/dist/src/cli-usage.js +1 -1
  23. package/dist/src/codex-native-cli-adapter.js +30 -1
  24. package/dist/src/codex-native-cli-adapter.js.map +1 -1
  25. package/dist/src/codex-native-public-projection.d.ts +155 -1
  26. package/dist/src/codex-native-public-projection.js +29 -0
  27. package/dist/src/codex-native-public-projection.js.map +1 -1
  28. package/dist/src/codex-store-adapter.d.ts +6 -2
  29. package/dist/src/codex-store-adapter.js +18 -7
  30. package/dist/src/codex-store-adapter.js.map +1 -1
  31. package/dist/src/conversation-list.d.ts +1 -1
  32. package/dist/src/conversation-list.js +24 -3
  33. package/dist/src/conversation-list.js.map +1 -1
  34. package/dist/src/conversation-routing-cli-adapter.js +1 -1
  35. package/dist/src/conversation-routing-cli-adapter.js.map +1 -1
  36. package/dist/src/conversation-usage-guidance.js +18 -1
  37. package/dist/src/conversation-usage-guidance.js.map +1 -1
  38. package/dist/src/herdr-terminal-control-provider.d.ts +1 -0
  39. package/dist/src/herdr-terminal-control-provider.js +14 -2
  40. package/dist/src/herdr-terminal-control-provider.js.map +1 -1
  41. package/dist/src/semantic-tool-list-projection.js +2 -1
  42. package/dist/src/semantic-tool-list-projection.js.map +1 -1
  43. package/dist/src/semantic-tool-private-authority.js +3 -2
  44. package/dist/src/semantic-tool-private-authority.js.map +1 -1
  45. package/dist/src/semantic-tool-runtime.js +2 -0
  46. package/dist/src/semantic-tool-runtime.js.map +1 -1
  47. package/dist/src/semantic-tool-schemas.js +1 -1
  48. package/dist/src/semantic-tool-schemas.js.map +1 -1
  49. package/dist/src/terminal-control-provider.d.ts +3 -1
  50. package/dist/src/terminal-control-provider.js +90 -52
  51. package/dist/src/terminal-control-provider.js.map +1 -1
  52. package/dist/src/terminal-list-cli-adapter.d.ts +7 -0
  53. package/dist/src/terminal-list-cli-adapter.js +48 -71
  54. package/dist/src/terminal-list-cli-adapter.js.map +1 -1
  55. package/dist/src/terminal-list-facts.d.ts +13 -1
  56. package/dist/src/terminal-list-facts.js +54 -3
  57. package/dist/src/terminal-list-facts.js.map +1 -1
  58. package/dist/src/terminal-list-inventory.d.ts +3 -0
  59. package/dist/src/terminal-list-inventory.js +15 -16
  60. package/dist/src/terminal-list-inventory.js.map +1 -1
  61. package/dist/src/terminal-list-native-identity-recheck.d.ts +5 -2
  62. package/dist/src/terminal-list-native-identity-recheck.js +13 -7
  63. package/dist/src/terminal-list-native-identity-recheck.js.map +1 -1
  64. package/dist/src/terminal-process-source.d.ts +4 -1
  65. package/dist/src/terminal-process-source.js +18 -4
  66. package/dist/src/terminal-process-source.js.map +1 -1
  67. package/dist/src/terminal-runtime-cli-adapter.d.ts +1 -0
  68. package/dist/src/terminal-runtime-cli-adapter.js +57 -8
  69. package/dist/src/terminal-runtime-cli-adapter.js.map +1 -1
  70. package/docs/command-discovery-performance.md +153 -0
  71. package/docs/list-output.md +15 -6
  72. package/package.json +1 -1
  73. package/templates/openclaw-skills/agent-knock-knock/SKILL.md +2 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.16.7 / Pi 0.1.0-poc.15 / DeepSeek Harness 0.1.0-rc.19 — 2026-10-29
4
+
5
+ - Reduce repeated discovery work within one CLI command: share in-flight Claude reader and terminal probes, isolate the memo between commands, inspect known Claude targets directly, and bound parallel process checks. Execution identity and input fences remain fresh and are never cached as authority.
6
+ - Make default List a lightweight inventory. Detailed approval/composer/task scans are deferred to Status, explicit `--approval-scan` / `noApprovalScan: false`, and execution preflight. Deferred or unknown observations are not proof that a session is input-ready. Keep unavailable or unresolved operations explicit.
7
+ - Preserve the existing default-list treatment of verified unstarted Codex candidates. Only ambiguous same-home/workspace groups receive additional snapshot verification; unavailable evidence keeps candidates visible, and task bodies are excluded from the inventory.
8
+ - Keep detailed Claude List confidence consistent with the exact native identity resolved during that same command. This presentation update does not grant cached input authority or promote unavailable identity evidence.
9
+ - Publish coordinated Pi and DSH connector updates with exact core **0.16.7** dependencies and synchronized Skill guidance. Existing Host compatibility ranges, callback ownership, persistent recovery and prerelease `next` tags remain unchanged.
10
+ - Preserve the PR #484 measurement record as development evidence. Its environment-specific read-only timing samples are not universal latency guarantees; complete Status includes additional safety checks and can remain slower than direct inspection.
11
+
12
+ ## DeepSeek Harness 0.1.0-rc.18 — 2026-10-29
13
+
14
+ - Add DSH connector author/keywords and a clearer installation/discovery entry. Keep `next` for the prerelease connector and exact core **0.16.6**; no core or Pi release or runtime compatibility expansion.
15
+ - Publish an AKK-maintained format-1 market index using exact published npm versions and reviewed DSH peer ranges, avoiding the old bare-package `latest` selection. It is an opt-in third-party source, not a default official market or endorsement.
16
+ - Repair npm README cross-directory links and clarify POSIX resident-Web, prerelease, clean-restart, approval and callback boundaries. Reuse the existing AKK demo with its actual controller environment identified.
17
+
3
18
  ## 0.16.6 / Pi 0.1.0-poc.14 / DeepSeek Harness 0.1.0-rc.17 — 2026-10-28
4
19
 
5
20
  - Align Claude List offers with managed Send and native thread-lifecycle admission. Check the applicable transcript-boundary and exact idle-reader requirements, retain bounded readiness diagnostics in compact List, and provide actionable recovery guidance. Execution still captures fresh evidence; List observations do not grant cached input authority.
package/README.md CHANGED
@@ -75,7 +75,7 @@ That is the terminal first-task flow. For terminal setup and multiple panes, see
75
75
  ## Install for Pi
76
76
 
77
77
  Pi can be the controller Host without OpenClaw. The connector supports Pi `1.2.0`
78
- and retains `0.84.4` compatibility. It includes AKK `0.14.7`, with direct CLI and
78
+ and retains `0.84.4` compatibility. It includes AKK `0.16.7`, with direct CLI and
79
79
  Desktop capabilities governed by the same target-specific boundaries above.
80
80
 
81
81
  ```bash
@@ -88,16 +88,24 @@ Pi should show `AKK ready`. With a supported coding-agent conversation open, ent
88
88
 
89
89
  ## Install for DeepSeek Harness
90
90
 
91
- The connector targets DeepSeek Harness Web `0.2.0-rc.2` (upstream `latest`,
92
- **still a release candidate**). It includes AKK `0.14.7`. See the connector guide
93
- for the separate alpha and older-version validation boundaries.
91
+ Let DeepSeek Harness delegate to your existing Codex CLI, Codex Desktop and
92
+ Claude Code sessions. Use a resident POSIX **DSH Web 0.2.1-rc.2** Host (the
93
+ reviewed baseline), Node.js `>=22.19.0`, and `pnpm`. The connector pins AKK
94
+ **0.16.7**; newer unlisted DSH versions are not automatically compatible.
94
95
 
95
96
  ```bash
96
97
  dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@next
97
- dsh web
98
98
  ```
99
99
 
100
- Open a Web conversation and enter `/akk list`. The connector gives every conversation `/akk`, the same capability-handshake-verified semantic tool catalog, the bundled `agent-knock-knock` skill, and callbacks to the exact Harness Agent that initiated the work. See the [DeepSeek Harness connector guide](connectors/deepseek-harness/README.md).
100
+ Use `@next` or an explicit reviewed RC, not the bare package name. Finish
101
+ existing work, cleanly restart the Web Host after installation, then enter
102
+ `/akk list` in a Web conversation. Do not start a second Host to reload it.
103
+
104
+ Prefer the DSH plugin UI? Add the [AKK-maintained index](https://raw.githubusercontent.com/scotthuang/agent-knock-knock/main/market/dsh/index.json)
105
+ to **Plugins → Discover**; it installs a pinned published version. This is a
106
+ third-party source, not a default official market. The
107
+ [DSH connector guide](connectors/deepseek-harness/README.md) covers the exact
108
+ setup, compatibility matrix, callbacks, approvals and demo.
101
109
 
102
110
  ## See It in Action
103
111
 
@@ -206,8 +214,8 @@ can use a supported terminal route. Claude Code direct control is available unde
206
214
  | Claude Code direct connection | macOS, compatible native peer protocol `1`, and Python 3 available to AKK. Live observations include `2.1.295` and `2.1.296`; these are not minimum versions. Standard `claude` and configured wrappers use the same adapter. See the [direct guide](docs/claude-cli-direct.md) for task and interaction boundaries. |
207
215
  | Terminal coding agents | Reviewed Codex profiles include `0.160.0`, `0.162.1`, `0.164.0` and `0.165.0`; Claude fixtures include `2.1.285`, with live observations on `2.1.295`/`2.1.296`. An otherwise eligible, complete `x.y.z` Claude version may attempt supported controls through runtime validation even without an exact regression profile. Actual identity, protocol and UI evidence determine availability; unknown dialogs are not guessed. |
208
216
  | OpenClaw | `2026.6.5`+; plugin API and Gateway `2026.5.12`+ |
209
- | Pi connector | Pi `1.2.0` and `0.84.4`; connector `0.1.0-poc.14` (`next`), pinned AKK `0.16.6` |
210
- | DeepSeek Harness connector | Web `0.2.1-rc.2` (RC); connector `0.1.0-rc.17` (`next`), pinned AKK `0.16.6`. See its guide for previous RC, alpha and legacy coverage. |
217
+ | Pi connector | Pi `1.2.0` and `0.84.4`; connector `0.1.0-poc.15` (`next`), pinned AKK `0.16.7` |
218
+ | DeepSeek Harness connector | Web `0.2.1-rc.2` (RC); connector `0.1.0-rc.19` (`next`), pinned AKK `0.16.7`. See its guide for previous RC, alpha and legacy coverage. |
211
219
  | Runtime | Node.js `22.19.0`+ on macOS or Linux |
212
220
 
213
221
  The adjacent OpenClaw boundary `2026.5.10-beta.2` is intentionally unsupported. Herdr versions are observations, not an allowlist: discovery verifies live identity and read capabilities, while input requires a matching CLI schema declaration or verified baseline behavior. An untested server without input evidence exposes only verified read capabilities. Desktop controls validate the live native contract. Desktop catalog presence alone does not prove the conversation is open or controllable. See each connector guide, the [Pi/DSH validation matrix](docs/pi-dsh-compatibility.md), and the Desktop guide for tested boundaries and limitations.
@@ -1,5 +1,11 @@
1
1
  # Agent Knock Knock for DeepSeek Harness
2
2
 
3
+ Let your DeepSeek Harness agent delegate to **Codex CLI, Codex Desktop and
4
+ Claude Code**, follow progress and receive results in the same DSH conversation.
5
+
6
+ [Install](#five-minute-quick-start) · [DSH Discover](#find-akk-in-dsh-discover) ·
7
+ [Demo](#demo) · [Support](https://github.com/scotthuang/agent-knock-knock/blob/main/SUPPORT.md)
8
+
3
9
  This package is the native DeepSeek Harness Web connector for Agent Knock
4
10
  Knock (AKK). When the Web Host mounts the bundle, it adds `/akk`, the AKK
5
11
  semantic tools supplied by its pinned runtime, and the bundled
@@ -13,7 +19,7 @@ tests, lockfile, bundle manifest, and connector-specific release tag.
13
19
 
14
20
  ## Compatibility
15
21
 
16
- Connector **0.1.0-rc.17** pins AKK **0.16.6** in its package and lockfile,
22
+ Connector **0.1.0-rc.19** pins AKK **0.16.7** in its package and lockfile,
17
23
  including scoped persistent callback recovery and verified running-process
18
24
  Codex version discovery, with the 0.165.0 adaptation and accurate Claude
19
25
  pane-observation diagnostics. It exposes that runtime's 27 semantic tools,
@@ -24,13 +30,25 @@ monitoring records (24 hours by default), plus active or unresolved records.
24
30
  A newer root checkout does not silently replace this pinned dependency. This
25
31
  prerelease uses the `next` dist-tag.
26
32
 
27
- The development baseline is DeepSeek Harness **0.2.1-rc.2** with Cordis
28
- **4.0.5**. This is a release candidate, not a stable release; as checked on
29
- 2026-10-17, npm `next` points here while `latest` still points to
30
- **0.2.0-rc.2**. Do not downgrade a newer installed RC just to follow `latest`.
31
- Previously reviewed Hosts `0.1.1-rc.2`, `0.1.2-alpha.1`, `0.1.5-rc.2`,
32
- `0.2.0-rc.2`, and preview `0.2.1-alpha.2` remain accepted. Use a resident POSIX Web Host
33
- and Node.js `>=22.19.0`.
33
+ The reviewed baseline is **DeepSeek Harness Web 0.2.1-rc.2** and **Cordis
34
+ 4.0.5**. These are prerelease compatibility claims, not a stable-version
35
+ endorsement. On 2026-10-29, upstream DSH `latest` is `0.2.1-rc.2`, while
36
+ `next` is `0.2.1-rc.4` and `alpha` is `0.2.2-alpha.2`; the latter two are **not
37
+ validated or accepted by this connector**. Do not replace an existing Host
38
+ with a different release merely to follow a tag.
39
+
40
+ | Scope | Declared / validated boundary |
41
+ | --- | --- |
42
+ | Current Web baseline | DSH `0.2.1-rc.2`, Cordis `4.0.5` |
43
+ | Previously reviewed DSH RCs | `0.1.1-rc.2`, `0.1.5-rc.2`, `0.2.0-rc.2` |
44
+ | Separate preview coverage | `0.1.2-alpha.1`, `0.2.1-alpha.2` |
45
+ | Accepted Cordis peers | `4.0.1`, `4.0.2`, `4.0.4`, `4.0.5-alpha.1`, `4.0.5` (not a continuous range) |
46
+ | Platform / runtime | Resident POSIX Web Host, Node.js `>=22.19.0`, `pnpm` on `PATH` |
47
+ | Outside validated scope | DSH Desktop embedded launcher, headless/one-shot Host, Windows named pipes; newer unlisted DSH releases |
48
+
49
+ The versioned validation notes below distinguish live Host checks from fixtures
50
+ and earlier compatibility runs. This metadata/documentation release does not
51
+ add a new Host compatibility claim.
34
52
 
35
53
  Activation locates the real `@deepseek-ai/dsh` launcher and requires the
36
54
  launcher, `dsh-base`, `dsh-agent`, `dsh-commands`, `dsh-llm`, `dsh-skill`, and
@@ -53,10 +71,46 @@ Headless/one-shot Harness processes, Windows named pipes, and DSH Desktop's
53
71
  embedded launcher are outside this connector's validated scope. Existing Codex CLI backend and Desktop connections need no
54
72
  terminal container when their advertised capability is available. Claude Code
55
73
  and terminal-specific operations retain their documented transport conditions;
56
- see [core compatibility](../../README.md#compatibility) and the
57
- [Pi/DSH validation matrix](../../docs/pi-dsh-compatibility.md). This connector does
74
+ see [core compatibility](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.7/README.md#compatibility) and the
75
+ [Pi/DSH validation matrix](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.7/docs/pi-dsh-compatibility.md). This connector does
58
76
  not launch replacement coding processes or create terminal panes.
59
77
 
78
+ ## Demo
79
+
80
+ Existing AKK demo by [@scotthuang](https://github.com/scotthuang):
81
+ OpenClaw/WeChat delegates a task to Codex Desktop, handles an explicitly
82
+ authorized approval, and brings the result back to chat. This edited clip shows
83
+ AKK core capabilities, **not the DSH interface**.
84
+
85
+ https://github.com/user-attachments/assets/cc20a609-7907-4996-977e-0b88d8ba6388
86
+
87
+ ## Find AKK in DSH Discover
88
+
89
+ This is an **AKK-maintained third-party index**, not a default DSH market or an
90
+ official endorsement. DSH does not ship with built-in index sources.
91
+
92
+ 1. In a supported DSH Web profile, open **Plugins → Experimental plugins →
93
+ Custom plugin market** and enable it.
94
+ 2. Open **Discover → Add index source** and paste this HTTPS URL:
95
+
96
+ ```text
97
+ https://raw.githubusercontent.com/scotthuang/agent-knock-knock/main/market/dsh/index.json
98
+ ```
99
+
100
+ 3. Search for **Agent Knock Knock**. Check the confirmation shows the package
101
+ `@scotthuang/agent-knock-knock-deepseek-harness`, an explicit reviewed RC
102
+ version and the npm registry. Confirm only that expected package/version.
103
+ 4. Finish existing work and cleanly restart the Web Host after installation;
104
+ this connector is not hot-loaded. Then run `/akk list` in a Web conversation.
105
+
106
+ The index pins a published version, so market installation does not resolve the
107
+ old bare-package `latest` tag. All listed connector versions are prereleases;
108
+ DSH can recommend a compatible prerelease when the entry has no stable version.
109
+ The source URL is stable, but its selected version can change after future
110
+ verified releases. CLI users can use `@next` or the exact version shown in
111
+ this README. See the [official market guide](https://deepseek-harness.github.io/deepseek-harness/guide/plugin-market)
112
+ and the [index maintenance notes](https://github.com/scotthuang/agent-knock-knock/tree/main/market/dsh).
113
+
60
114
  ## Five-minute quick start
61
115
 
62
116
  ### 1. Check the prerequisites
@@ -82,7 +136,7 @@ can select an older `latest` build.
82
136
  DSH `0.2.1-rc.2` requires connector `0.1.0-rc.6` or a later release that
83
137
  explicitly supports that Host. Connector `0.1.0-rc.5` does not support this RC.
84
138
  Use `next`, or pin
85
- `@scotthuang/agent-knock-knock-deepseek-harness@0.1.0-rc.17`.
139
+ `@scotthuang/agent-knock-knock-deepseek-harness@0.1.0-rc.19`.
86
140
 
87
141
  ```sh
88
142
  dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@next
@@ -392,7 +446,7 @@ exact reviewed version:
392
446
 
393
447
  ```sh
394
448
  dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@next
395
- dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@0.1.0-rc.17
449
+ dsh plugin --profile web add @scotthuang/agent-knock-knock-deepseek-harness@0.1.0-rc.19
396
450
  ```
397
451
 
398
452
  Restart the Web Host after either operation. The connector pins the exact AKK
@@ -420,10 +474,10 @@ dsh plugin --profile web add "file:$(pwd -P)/connectors/deepseek-harness"
420
474
  ```
421
475
 
422
476
  Restart `dsh web` after installation. The child package currently installs and
423
- tests against its pinned AKK runtime `0.16.6`; building the current repository
477
+ tests against its pinned AKK runtime `0.16.7`; building the current repository
424
478
  root does not silently replace that dependency. Before core publication, test
425
479
  the candidate core tarball in isolation as described in the
426
- [coordinated release policy](../../CONTRIBUTING.md#coordinated-package-releases);
480
+ [coordinated release policy](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.7/CONTRIBUTING.md#coordinated-package-releases);
427
481
  the registry-based `npm ci` above requires that exact core to be published.
428
482
  Testing connector changes against another AKK runtime requires an explicit
429
483
  dependency change and
@@ -431,6 +485,24 @@ compatibility review rather than an implicit local link.
431
485
 
432
486
  ## Tests and release status
433
487
 
488
+ Connector **`0.1.0-rc.19`** pins AKK **`0.16.7`** and its synchronized Skill.
489
+ It carries [PR #484](https://github.com/scotthuang/agent-knock-knock/pull/484):
490
+ command-scoped discovery reuse and targeted inspection reduce repeated reader
491
+ and terminal probes. Default List defers detailed approval/composer scans;
492
+ unscanned state is not approval or Send authority, and Status and mutating
493
+ operations keep fresh identity and input checks. DSH Host versions, persistent
494
+ callback ownership and the prerelease `next` policy are unchanged. The
495
+ [performance record](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.7/docs/command-discovery-performance.md)
496
+ covers the PR's development measurements, not universal latency guarantees or
497
+ a new DSH live-model/channel acceptance run.
498
+
499
+ Connector **`0.1.0-rc.18`** keeps exact core **`0.16.6`** and the existing
500
+ runtime/Host compatibility behavior. This release adds npm discovery metadata,
501
+ a clearer DSH entry and explicit-version market installation guidance, and
502
+ replaces cross-directory README links with public URLs that work on npm.
503
+ The curated index uses published registry metadata and the official format-1
504
+ contract; adding an index or publishing a community post is not official approval.
505
+
434
506
  Connector **`0.1.0-rc.17`** pins AKK **`0.16.6`** and its synchronized Skill.
435
507
  It carries [PR #478](https://github.com/scotthuang/agent-knock-knock/pull/478):
436
508
  Claude List and execution share each operation's reader and idle checks;
@@ -457,7 +529,7 @@ coordinated dependency refresh adds no new DSH live-model or external-channel
457
529
  delivery claim and remains on npm `next`.
458
530
 
459
531
  Connector **`0.1.0-rc.15`** pins AKK **`0.16.4`** and its synchronized Skill.
460
- It carries the [Codex CLI 0.165.0 compatibility update](../../docs/codex-0.165.0-compatibility.md):
532
+ It carries the [Codex CLI 0.165.0 compatibility update](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.6/docs/codex-0.165.0-compatibility.md):
461
533
  exact frontend/backend version reporting, native terminal profiles, Terra model
462
534
  label handling, and manual folder-trust blocking. Existing task identities,
463
535
  monitor deadlines and callback receipts are preserved. Host version ranges and
@@ -530,13 +602,13 @@ remains available when no controllable terminal counterpart exists. Codex stays
530
602
  backend-first. Existing task routes, interaction authority, the DSH Host/peer
531
603
  policy, independent Store and callback ownership remain unchanged. This
532
604
  dependency update does not claim a new DSH live-model or external-channel
533
- delivery test. See the [Claude direct-control guide](../../docs/claude-cli-direct.md)
605
+ delivery test. See the [Claude direct-control guide](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.6/docs/claude-cli-direct.md)
534
606
  for prerequisites and operation-specific limits. The connector remains on `next`.
535
607
 
536
608
  Connector **`0.1.0-rc.9`** pins AKK **`0.14.17`** and carries its Codex CLI
537
609
  `0.164.0` compatibility changes and reviewed Skill. The DSH Host/peer version
538
610
  policy, independent Store, typed interactions and callback ownership are
539
- unchanged. The core [compatibility matrix](../../docs/codex-0.164.0-compatibility.md)
611
+ unchanged. The core [compatibility matrix](https://github.com/scotthuang/agent-knock-knock/blob/v0.16.6/docs/codex-0.164.0-compatibility.md)
540
612
  separates native backend task/approval/question checks from terminal capture
541
613
  regressions and retained limits. This dependency refresh does not claim a new
542
614
  DSH live-model or external-channel delivery run. It remains on npm `next`.
@@ -565,7 +637,7 @@ npm run pack:check
565
637
 
566
638
  These commands typecheck the connector, run its fast wiring/profile/IPC/schema
567
639
  tests, and inspect the package tarball. They do not publish anything. The
568
- `0.1.0-rc.17` lockfile uses the published DeepSeek Harness `0.2.1-rc.2`
640
+ `0.1.0-rc.19` lockfile uses the published DeepSeek Harness `0.2.1-rc.2`
569
641
  SDK packages and Cordis `4.0.5`. Its real ToolRuntime regression checks
570
642
  canonical result rendering, exact Agent ownership, typed questionnaire payloads,
571
643
  and rejection before dispatch when targets are ambiguous or stale. This is
@@ -610,7 +682,7 @@ gate to both connectors. Their package versions are validated independently.
610
682
  Publishing additionally requires both explicit flags:
611
683
 
612
684
  ```sh
613
- npm run release:check -- --publish --confirm-version 0.1.0-rc.17
685
+ npm run release:check -- --publish --confirm-version 0.1.0-rc.19
614
686
  ```
615
687
 
616
688
  Prereleases use npm tag `next`; stable versions use `latest`. Repository tags
@@ -12,7 +12,7 @@ socket.
12
12
 
13
13
  ## Status and compatibility
14
14
 
15
- Connector **0.1.0-poc.14** pins AKK **0.16.6**, including CLI direct
15
+ Connector **0.1.0-poc.15** pins AKK **0.16.7**, including CLI direct
16
16
  connections, Codex Desktop, Recovery, state-derived List guidance and verified
17
17
  running-process Codex version discovery, with the 0.165.0 adaptation and accurate
18
18
  Claude pane-observation diagnostics. Its generated Skill and registered tools
@@ -35,7 +35,7 @@ The current compatibility contract is intentionally exact:
35
35
  supported older runtime, installed from the official
36
36
  `@earendil-works/pi-coding-agent` package.
37
37
  - Node.js `22.19.0` or newer.
38
- - AKK `0.16.6`, pinned by this connector's package and lockfile. A different
38
+ - AKK `0.16.7`, pinned by this connector's package and lockfile. A different
39
39
  version at the repository root is not substituted automatically. Before core
40
40
  publication, test its candidate tarball in isolation under the
41
41
  [coordinated release policy](../../CONTRIBUTING.md#coordinated-package-releases).
@@ -87,8 +87,8 @@ pi list
87
87
  ```
88
88
 
89
89
  Using `next` follows compatible Pi connector prereleases. To pin this exact
90
- core `0.16.6` connector, install
91
- `npm:@scotthuang/agent-knock-knock-pi@0.1.0-poc.14`; exact versions are pinned
90
+ core `0.16.7` connector, install
91
+ `npm:@scotthuang/agent-knock-knock-pi@0.1.0-poc.15`; exact versions are pinned
92
92
  and are not advanced by Pi's bulk update command.
93
93
 
94
94
  ### 4. Start Pi
@@ -453,7 +453,7 @@ Harness independently; it does not require their package versions to match.
453
453
  Publishing Pi additionally requires explicit version confirmation:
454
454
 
455
455
  ```sh
456
- npm run release:check -- --publish --confirm-version 0.1.0-poc.14
456
+ npm run release:check -- --publish --confirm-version 0.1.0-poc.15
457
457
  ```
458
458
 
459
459
  Prereleases use npm tag `next`; stable versions use `latest`. Tags and GitHub
@@ -503,6 +503,17 @@ a presentation change, not evidence that a candidate is disconnected, and it
503
503
  does not change Send routing or callback ownership. Sole empty conversations
504
504
  and exact frontend associations remain visible.
505
505
 
506
+ Connector **`0.1.0-poc.15`** pins AKK **`0.16.7`** and its synchronized Skill.
507
+ It carries [PR #484](https://github.com/scotthuang/agent-knock-knock/pull/484):
508
+ command-scoped discovery reuse and targeted inspection reduce repeated reader
509
+ and terminal probes. Default List defers detailed approval/composer scans;
510
+ unscanned state is not approval or Send authority, and Status and mutating
511
+ operations keep fresh identity and input checks. Pi Host versions, callback
512
+ ownership and the prerelease `next` policy are unchanged. Performance samples
513
+ in the [core record](../../docs/command-discovery-performance.md) are observations
514
+ from the PR's development verification, not universal latency guarantees or a
515
+ new Pi live-model/channel acceptance run.
516
+
506
517
  Connector **`0.1.0-poc.14`** pins AKK **`0.16.6`** and its synchronized Skill.
507
518
  It carries [PR #478](https://github.com/scotthuang/agent-knock-knock/pull/478):
508
519
  Claude List and execution share each operation's reader and idle checks;
@@ -601,8 +612,8 @@ or external-channel delivery run.
601
612
 
602
613
  These are POC acceptance results, not a promise of compatibility with every
603
614
  future Pi, Codex, Claude Code, tmux, or Herdr release. Version
604
- `0.1.0-poc.14` is an npm prerelease distributed through the `next` dist-tag;
605
- its publication is coordinated with core `0.16.6` and the DSH connector.
615
+ `0.1.0-poc.15` is an npm prerelease distributed through the `next` dist-tag;
616
+ its publication is coordinated with core `0.16.7` and the DSH connector.
606
617
  ClawHub publication remains a separate channel.
607
618
 
608
619
  ## Deliberate POC limits
@@ -0,0 +1,6 @@
1
+ type Reader = (file: string, args: string[], env?: NodeJS.ProcessEnv) => Promise<string>;
2
+ /** Share the expensive reader only for discovery; registry/process/socket checks remain separate. */
3
+ export declare function readClaudeAgentDiscovery(configDir: string, reader: string, run?: Reader): Promise<string>;
4
+ /** Read-only List enrichment may consume its completed discovery; execution preflights never use this. */
5
+ export declare function completedClaudeAgentDiscovery(configDir: string, reader: string): string | undefined;
6
+ export {};
@@ -0,0 +1,41 @@
1
+ import { execFile } from "node:child_process";
2
+ import fs from "node:fs";
3
+ import path from "node:path";
4
+ import { cliEnv, cliExecutionMemo } from "./cli-runtime-context.js";
5
+ import { resolveOptionalExecutable } from "./cli-command-runtime.js";
6
+ const runReader = (file, args, env) => new Promise((resolve, reject) => {
7
+ execFile(file, args, { env, timeout: 10_000, maxBuffer: 10 * 1024 * 1024, encoding: "utf8" }, (error, stdout) => error ? reject(error) : resolve(stdout));
8
+ });
9
+ function canonical(value) {
10
+ try {
11
+ return fs.realpathSync(value);
12
+ }
13
+ catch {
14
+ return path.resolve(value);
15
+ }
16
+ }
17
+ function snapshot(configDir, reader, run) {
18
+ const readers = cliExecutionMemo("claude-agent-discovery", run, () => new Map());
19
+ const key = JSON.stringify([canonical(configDir), reader]);
20
+ let entry = readers.get(key);
21
+ if (!entry)
22
+ readers.set(key, entry = {});
23
+ return entry;
24
+ }
25
+ /** Share the expensive reader only for discovery; registry/process/socket checks remain separate. */
26
+ export function readClaudeAgentDiscovery(configDir, reader, run = runReader) {
27
+ // The production cache key and launched executable must agree, including HOME/PATH fallback.
28
+ const executable = run === runReader ? resolveOptionalExecutable(reader) : reader;
29
+ const entry = snapshot(configDir, executable, run);
30
+ if (entry.output !== undefined)
31
+ return Promise.resolve(entry.output);
32
+ return entry.pending ??= Promise.resolve().then(() => run(executable, ["agents", "--json", "--all"], { ...cliEnv(), CLAUDE_CONFIG_DIR: configDir })).then(output => {
33
+ entry.output = output;
34
+ return output;
35
+ }).finally(() => { entry.pending = undefined; });
36
+ }
37
+ /** Read-only List enrichment may consume its completed discovery; execution preflights never use this. */
38
+ export function completedClaudeAgentDiscovery(configDir, reader) {
39
+ return snapshot(configDir, resolveOptionalExecutable(reader), runReader).output;
40
+ }
41
+ //# sourceMappingURL=claude-agent-discovery-cache.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude-agent-discovery-cache.js","sourceRoot":"","sources":["../../src/claude-agent-discovery-cache.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AACpE,OAAO,EAAE,yBAAyB,EAAE,MAAM,0BAA0B,CAAC;AAKrE,MAAM,SAAS,GAAW,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,CAAC,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;IAC7E,QAAQ,CAAC,IAAI,EAAE,IAAI,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,EAC1F,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;AAChE,CAAC,CAAC,CAAC;AAEH,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,CAAC;QAAC,OAAO,EAAE,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC;QAAC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAAC,CAAC;AAC9E,CAAC;AAED,SAAS,QAAQ,CAAC,SAAiB,EAAE,MAAc,EAAE,GAAW;IAC9D,MAAM,OAAO,GAAG,gBAAgB,CAAC,wBAAwB,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,GAAG,EAAoB,CAAC,CAAC;IACnG,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,SAAS,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3D,IAAI,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,KAAK;QAAE,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,GAAG,EAAE,CAAC,CAAC;IACzC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU,wBAAwB,CAAC,SAAiB,EAAE,MAAc,EAAE,GAAG,GAAW,SAAS;IACjG,6FAA6F;IAC7F,MAAM,UAAU,GAAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;IAClF,MAAM,KAAK,GAAG,QAAQ,CAAC,SAAS,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;IACnD,IAAI,KAAK,CAAC,MAAM,KAAK,SAAS;QAAE,OAAO,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IACrE,OAAO,KAAK,CAAC,OAAO,KAAK,OAAO,CAAC,OAAO,EAAE,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,UAAU,EAAE,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EACjG,EAAE,GAAG,MAAM,EAAE,EAAE,iBAAiB,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QAC5D,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC;QACtB,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC,OAAO,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;AACrD,CAAC;AAED,0GAA0G;AAC1G,MAAM,UAAU,6BAA6B,CAAC,SAAiB,EAAE,MAAc;IAC7E,OAAO,QAAQ,CAAC,SAAS,EAAE,yBAAyB,CAAC,MAAM,CAAC,EAAE,SAAS,CAAC,CAAC,MAAM,CAAC;AAClF,CAAC"}
@@ -15,6 +15,7 @@ export interface ClaudeNativeDiscoveryResult {
15
15
  }
16
16
  export declare function runClaudeNativeCommand(file: string, args: string[], env?: NodeJS.ProcessEnv): Promise<string>;
17
17
  export declare function readClaudeNativeRegistry(configDir: string, pid: number): Promise<Record<string, unknown>>;
18
+ /** The agent-list row and owned registry must describe the same supported inbox. */
18
19
  export declare function validateClaudeNativeRegistry(configDir: string, row: Record<string, unknown>, options?: ClaudeNativeDiscoveryOptions): Promise<ClaudeNativeCatalogEntry>;
19
20
  export declare function discoverClaudeNativeSessions(options?: ClaudeNativeDiscoveryOptions): Promise<ClaudeNativeDiscoveryResult>;
20
21
  export declare function inspectClaudeNativeSession(identity: ClaudeNativeIdentity, options?: ClaudeNativeDiscoveryOptions): Promise<ClaudeNativeCatalogEntry>;
@@ -3,6 +3,8 @@ import { lstat, readFile, realpath } from "node:fs/promises";
3
3
  import os from "node:os";
4
4
  import path from "node:path";
5
5
  import { promisify } from "node:util";
6
+ import { readClaudeAgentDiscovery } from "./claude-agent-discovery-cache.js";
7
+ import { cliExecutionMemoAsync } from "./cli-runtime-context.js";
6
8
  import { ClaudeNativeError, createClaudeNativeConversationId, validateClaudeNativeIdentity } from "./claude-native-identity.js";
7
9
  const execFile = promisify(execFileCallback);
8
10
  export async function runClaudeNativeCommand(file, args, env) {
@@ -11,9 +13,11 @@ export async function runClaudeNativeCommand(file, args, env) {
11
13
  }
12
14
  /** Only an executable launch failure establishes that the configured reader is unavailable. */
13
15
  async function readClaudeNativeAgentOutput(configDir, options) {
14
- const run = options.run ?? runClaudeNativeCommand;
15
16
  try {
16
- return await run(options.claudePath ?? "claude", ["agents", "--json", "--all"], { ...process.env, CLAUDE_CONFIG_DIR: configDir });
17
+ const output = await readClaudeAgentDiscovery(configDir, options.claudePath ?? "claude", options.run);
18
+ if (Buffer.byteLength(output) > 2 * 1024 * 1024)
19
+ throw new Error("Claude native discovery exceeds its output limit");
20
+ return output;
17
21
  }
18
22
  catch (error) {
19
23
  if (error?.code === "ENOENT" || error?.code === "EACCES") {
@@ -48,76 +52,132 @@ export async function readClaudeNativeRegistry(configDir, pid) {
48
52
  throw new ClaudeNativeError("invalid_registry", "Native registry entry exceeds limit");
49
53
  return record(JSON.parse(await readFile(file, "utf8")));
50
54
  }
51
- /** The agent-list row and owned registry must describe the same supported inbox. */
52
- function catalogFields(m, row, identity) {
53
- if (m.pid !== identity.pid || row.pid !== identity.pid || row.sessionId !== identity.sessionId || row.kind !== "interactive"
54
- || !absolute(m.cwd) || row.cwd !== m.cwd || typeof m.version !== "string" || !/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/u.test(m.version)
55
+ function registryIdentity(configDir, m, pid) {
56
+ const processStart = typeof m.procStart === "string" ? m.procStart.trim().replace(/\s+/gu, " ") : "";
57
+ return validateClaudeNativeIdentity({ configDir, sessionId: String(m.sessionId), pid, processStart });
58
+ }
59
+ function registryFields(m, identity) {
60
+ if (m.pid !== identity.pid || !absolute(m.cwd)
61
+ || typeof m.version !== "string" || !/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/u.test(m.version)
55
62
  || m.peerProtocol !== 1 || !Array.isArray(m.peerFeatures) || !m.peerFeatures.every(x => typeof x === "string")
56
63
  || !absolute(m.messagingSocketPath) || path.basename(m.messagingSocketPath) !== `${identity.pid}.sock`) {
57
- throw new ClaudeNativeError("unsupported_contract", "Claude native registry and agent list do not prove a supported live identity");
64
+ throw new ClaudeNativeError("unsupported_contract", "Claude native registry does not prove a supported live identity");
58
65
  }
59
66
  return { cwd: m.cwd, version: m.version, socketPath: m.messagingSocketPath,
60
67
  peerProtocol: 1, peerFeatures: m.peerFeatures };
61
68
  }
62
- export async function validateClaudeNativeRegistry(configDir, row, options = {}) {
63
- const pid = Number(row.pid), m = await readClaudeNativeRegistry(configDir, pid);
64
- const processStart = typeof m.procStart === "string" ? m.procStart.trim().replace(/\s+/gu, " ") : "";
65
- const identity = validateClaudeNativeIdentity({ configDir, sessionId: String(m.sessionId), pid, processStart });
66
- const fields = catalogFields(m, row, identity);
69
+ /** Never cache execution fences: every targeted inspection observes the current process and socket. */
70
+ async function assertLiveNativeRegistry(identity, fields, options) {
67
71
  const run = options.run ?? runClaudeNativeCommand;
68
- const processInfo = (await run("/bin/ps", ["-p", String(pid), "-o", "uid=", "-o", "lstart="], { ...process.env, LC_ALL: "C", TZ: "UTC" })).trim().replace(/\s+/gu, " ");
69
- if (processInfo !== `${process.getuid?.()} ${processStart}`)
72
+ const processInfo = (await run("/bin/ps", ["-p", String(identity.pid), "-o", "uid=", "-o", "lstart="], { ...process.env, LC_ALL: "C", TZ: "UTC" })).trim().replace(/\s+/gu, " ");
73
+ if (processInfo !== `${process.getuid?.()} ${identity.processStart}`)
70
74
  throw new ClaudeNativeError("process_changed", "Claude process identity changed");
71
- const socketPath = fields.socketPath;
72
- await owned(await realpath(path.dirname(socketPath)), "directory");
73
- await owned(socketPath, "socket");
75
+ await owned(await realpath(path.dirname(fields.socketPath)), "directory");
76
+ await owned(fields.socketPath, "socket");
77
+ }
78
+ function catalogEntry(identity, fields, row, status) {
74
79
  const statusMap = { idle: "idle", busy: "working", waiting: "waiting" };
75
- // Both sources must agree. Unknown or racing state remains observable, never sendable.
76
- const status = m.status === row.status && typeof m.status === "string"
77
- ? statusMap[m.status] ?? "unknown" : "unknown";
78
80
  return { ...identity, ...fields, nativeId: createClaudeNativeConversationId(identity),
79
- ...(typeof row.name === "string" ? { name: row.name.slice(0, 512) } : {}), status,
81
+ ...(typeof row.name === "string" ? { name: row.name.slice(0, 512) } : {}),
82
+ status: typeof status === "string" ? statusMap[status] ?? "unknown" : "unknown",
80
83
  ...(typeof row.waitingFor === "string" ? { waitingFor: row.waitingFor.slice(0, 256) } : {}), observedAt: new Date().toISOString() };
81
84
  }
82
- export async function discoverClaudeNativeSessions(options = {}) {
85
+ /** The agent-list row and owned registry must describe the same supported inbox. */
86
+ export async function validateClaudeNativeRegistry(configDir, row, options = {}) {
87
+ const pid = Number(row.pid), m = await readClaudeNativeRegistry(configDir, pid);
88
+ const identity = registryIdentity(configDir, m, pid), fields = registryFields(m, identity);
89
+ if (row.pid !== identity.pid || row.sessionId !== identity.sessionId || row.kind !== "interactive" || row.cwd !== m.cwd) {
90
+ throw new ClaudeNativeError("unsupported_contract", "Claude native registry and agent list do not prove a supported live identity");
91
+ }
92
+ await assertLiveNativeRegistry(identity, fields, options);
93
+ // Both sources must agree. Unknown or racing state remains observable, never sendable.
94
+ return catalogEntry(identity, fields, row, m.status === row.status ? m.status : undefined);
95
+ }
96
+ async function discoverConfigDirectory(configured, options) {
83
97
  const errors = [], sessions = [];
84
- const configDirs = [...new Set(options.configDirs ?? [process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude")])];
85
- if ((options.platform ?? process.platform) !== "darwin")
86
- return { sessions, errors: [{ configDir: "", code: "unsupported_platform" }] };
87
- for (const configured of configDirs.slice(0, 16)) {
88
- let configDir = path.resolve(configured);
89
- try {
90
- configDir = await realpath(configDir);
91
- const raw = JSON.parse(await readClaudeNativeAgentOutput(configDir, options));
92
- if (!Array.isArray(raw) || raw.length > 4096)
93
- throw new ClaudeNativeError("invalid_agent_list", "Invalid Claude agents list");
94
- for (const value of raw) {
95
- const row = record(value);
96
- if (row.kind !== "interactive")
97
- continue;
98
+ let configDir = path.resolve(configured);
99
+ try {
100
+ configDir = await realpath(configDir);
101
+ const raw = JSON.parse(await readClaudeNativeAgentOutput(configDir, options));
102
+ if (!Array.isArray(raw) || raw.length > 4096)
103
+ throw new ClaudeNativeError("invalid_agent_list", "Invalid Claude agents list");
104
+ // Bounded parallel PID checks retain input ordering without spawning one process per row at once.
105
+ for (let index = 0; index < raw.length; index += 8) {
106
+ const pending = [];
107
+ let malformed;
108
+ for (const value of raw.slice(index, index + 8)) {
109
+ let row;
98
110
  try {
99
- const entry = await validateClaudeNativeRegistry(configDir, row, options);
100
- if (sessions.some(s => s.nativeId === entry.nativeId))
101
- throw new ClaudeNativeError("duplicate_identity", "Duplicate native agent identity");
102
- sessions.push(entry);
111
+ row = record(value);
103
112
  }
104
113
  catch (error) {
105
- errors.push({ configDir, code: error instanceof ClaudeNativeError ? error.code : "registry_unavailable" });
114
+ malformed = error;
115
+ break;
106
116
  }
117
+ if (row.kind !== "interactive")
118
+ continue;
119
+ pending.push(validateClaudeNativeRegistry(configDir, row, options).catch(error => ({ configDir,
120
+ code: error instanceof ClaudeNativeError ? error.code : "registry_unavailable" })));
107
121
  }
122
+ for (const value of await Promise.all(pending)) {
123
+ if ("nativeId" in value)
124
+ sessions.push(value);
125
+ else
126
+ errors.push(value);
127
+ }
128
+ if (malformed)
129
+ throw malformed;
108
130
  }
109
- catch (error) {
110
- errors.push({ configDir, code: error instanceof ClaudeNativeError ? error.code : "discovery_unavailable" });
131
+ }
132
+ catch (error) {
133
+ errors.push({ configDir, code: error instanceof ClaudeNativeError ? error.code : "discovery_unavailable" });
134
+ }
135
+ return { sessions, errors };
136
+ }
137
+ async function discoverConfiguredSessions(configDirs, options) {
138
+ const errors = [], sessions = [], seen = new Set();
139
+ for (let index = 0; index < configDirs.length; index += 4) {
140
+ const results = await Promise.all(configDirs.slice(index, index + 4).map(dir => discoverConfigDirectory(dir, options)));
141
+ for (const result of results) {
142
+ errors.push(...result.errors);
143
+ for (const entry of result.sessions) {
144
+ if (seen.has(entry.nativeId))
145
+ errors.push({ configDir: entry.configDir, code: "duplicate_identity" });
146
+ else {
147
+ seen.add(entry.nativeId);
148
+ sessions.push(entry);
149
+ }
150
+ }
111
151
  }
112
152
  }
113
153
  return { sessions, errors };
114
154
  }
155
+ export async function discoverClaudeNativeSessions(options = {}) {
156
+ const configDirs = [...new Set(options.configDirs ?? [process.env.CLAUDE_CONFIG_DIR || path.join(os.homedir(), ".claude")])].slice(0, 16);
157
+ const platform = options.platform ?? process.platform;
158
+ if (platform !== "darwin")
159
+ return { sessions: [], errors: [{ configDir: "", code: "unsupported_platform" }] };
160
+ const namespace = `claude-native-discovery:${JSON.stringify([configDirs, options.claudePath ?? "claude", platform])}`;
161
+ const snapshot = await cliExecutionMemoAsync(namespace, options.run ?? runClaudeNativeCommand, () => discoverConfiguredSessions(configDirs, options));
162
+ return structuredClone(snapshot);
163
+ }
115
164
  export async function inspectClaudeNativeSession(identity, options = {}) {
116
165
  const wanted = validateClaudeNativeIdentity(identity);
117
- const result = await discoverClaudeNativeSessions({ ...options, configDirs: [wanted.configDir] });
118
- const found = result.sessions.find(s => s.nativeId === createClaudeNativeConversationId(wanted));
119
- if (!found)
166
+ if ((options.platform ?? process.platform) !== "darwin")
167
+ throw new ClaudeNativeError("unsupported_platform", "Claude native inspection is currently validated on macOS only");
168
+ const configDir = await realpath(wanted.configDir), m = await readClaudeNativeRegistry(configDir, wanted.pid);
169
+ const current = registryIdentity(configDir, m, wanted.pid);
170
+ if (createClaudeNativeConversationId(current) !== createClaudeNativeConversationId(wanted)) {
120
171
  throw new ClaudeNativeError("identity_unavailable", "Exact Claude CLI process/session is no longer available");
121
- return found;
172
+ }
173
+ // Interactive registry ownership is the targeted counterpart of the agents-row filter.
174
+ // A parked foreground process displays a background job; it is not that job's inbox.
175
+ if (m.kind !== "interactive" || m.parkedJobId !== undefined
176
+ || m.pidDomain !== undefined && m.pidDomain !== (options.platform ?? process.platform)) {
177
+ throw new ClaudeNativeError("unsupported_contract", "Claude target is not an ordinary interactive session");
178
+ }
179
+ const fields = registryFields(m, current);
180
+ await assertLiveNativeRegistry(current, fields, options);
181
+ return catalogEntry(current, fields, m, m.status);
122
182
  }
123
183
  //# sourceMappingURL=claude-native-discovery.js.map