paseo-plugin-zcode-provider 0.0.0-stage → 0.1.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.
Files changed (134) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE.md +29 -0
  3. package/README.md +98 -2
  4. package/client/diagnostics.tsx +397 -0
  5. package/client/setup.tsx +347 -0
  6. package/icon.svg +1 -0
  7. package/index.client.tsx +22 -0
  8. package/index.server.ts +21 -0
  9. package/package.json +75 -4
  10. package/paseo-plugin.json +6 -0
  11. package/server/attachments.ts +150 -0
  12. package/server/build-info.ts +2 -0
  13. package/server/conversation.ts +319 -0
  14. package/server/diagnostics.ts +235 -0
  15. package/server/discovery/discover.ts +225 -0
  16. package/server/discovery/manifest.ts +36 -0
  17. package/server/discovery/types.ts +30 -0
  18. package/server/errors.ts +36 -0
  19. package/server/host/bridge.ts +463 -0
  20. package/server/host/schemas.ts +119 -0
  21. package/server/logger.ts +19 -0
  22. package/server/mapping.ts +270 -0
  23. package/server/models.ts +68 -0
  24. package/server/persistence.ts +146 -0
  25. package/server/presentation.ts +428 -0
  26. package/server/provider.ts +831 -0
  27. package/server/runtime/managed.ts +501 -0
  28. package/server/runtime/pins.ts +72 -0
  29. package/server/runtime-setup.ts +102 -0
  30. package/server/session-types.ts +49 -0
  31. package/server/session.ts +866 -0
  32. package/server/status.ts +89 -0
  33. package/server/timeline.ts +18 -0
  34. package/server/vendor/zcode/LICENSE +202 -0
  35. package/server/vendor/zcode/NOTICE.md +70 -0
  36. package/server/vendor/zcode/THIRD-PARTY-NOTICES.md +37 -0
  37. package/server/vendor/zcode/packages/model-option-map/src/compiler.ts +92 -0
  38. package/server/vendor/zcode/packages/model-option-map/src/evaluator.ts +214 -0
  39. package/server/vendor/zcode/packages/model-option-map/src/index.ts +5 -0
  40. package/server/vendor/zcode/packages/model-option-map/src/merge-patch.ts +97 -0
  41. package/server/vendor/zcode/packages/model-option-map/src/option-maps.ts +42 -0
  42. package/server/vendor/zcode/packages/model-option-map/src/parser.ts +240 -0
  43. package/server/vendor/zcode/packages/model-option-map/src/tokenizer.ts +141 -0
  44. package/server/vendor/zcode/packages/model-option-map/src/types.ts +36 -0
  45. package/server/vendor/zcode/packages/rpc/src/buffer.ts +88 -0
  46. package/server/vendor/zcode/packages/rpc/src/channelClient.ts +275 -0
  47. package/server/vendor/zcode/packages/rpc/src/channelServer.ts +283 -0
  48. package/server/vendor/zcode/packages/rpc/src/channels.shared.ts +66 -0
  49. package/server/vendor/zcode/packages/rpc/src/channels.ts +4 -0
  50. package/server/vendor/zcode/packages/rpc/src/delayedChannel.ts +17 -0
  51. package/server/vendor/zcode/packages/rpc/src/foundation.ts +260 -0
  52. package/server/vendor/zcode/packages/rpc/src/protocol.ts +397 -0
  53. package/server/vendor/zcode/packages/rpc/src/proxy-channel.ts +213 -0
  54. package/server/vendor/zcode/packages/rpc/src/serialization.ts +291 -0
  55. package/server/vendor/zcode/packages/shared/src/account-provider-state.ts +13 -0
  56. package/server/vendor/zcode/packages/shared/src/background-bash-output.ts +24 -0
  57. package/server/vendor/zcode/packages/shared/src/background-task-controls.ts +404 -0
  58. package/server/vendor/zcode/packages/shared/src/bash-output-display.ts +11 -0
  59. package/server/vendor/zcode/packages/shared/src/bots.ts +558 -0
  60. package/server/vendor/zcode/packages/shared/src/browser-use/backend.ts +80 -0
  61. package/server/vendor/zcode/packages/shared/src/browser-use/command-metadata.ts +170 -0
  62. package/server/vendor/zcode/packages/shared/src/browser-use/commands.ts +588 -0
  63. package/server/vendor/zcode/packages/shared/src/browser-use/result.ts +130 -0
  64. package/server/vendor/zcode/packages/shared/src/browser-use/snapshot.ts +77 -0
  65. package/server/vendor/zcode/packages/shared/src/command-types.ts +96 -0
  66. package/server/vendor/zcode/packages/shared/src/config-schema.ts +8 -0
  67. package/server/vendor/zcode/packages/shared/src/cuaAccessibilitySettings.ts +41 -0
  68. package/server/vendor/zcode/packages/shared/src/database-startup.ts +178 -0
  69. package/server/vendor/zcode/packages/shared/src/env.ts +63 -0
  70. package/server/vendor/zcode/packages/shared/src/execution-output-preview.ts +14 -0
  71. package/server/vendor/zcode/packages/shared/src/localTtft.ts +192 -0
  72. package/server/vendor/zcode/packages/shared/src/model-config.ts +123 -0
  73. package/server/vendor/zcode/packages/shared/src/model-execution.ts +23 -0
  74. package/server/vendor/zcode/packages/shared/src/model-provider-family.ts +171 -0
  75. package/server/vendor/zcode/packages/shared/src/model-provider-types.ts +81 -0
  76. package/server/vendor/zcode/packages/shared/src/model-selection.ts +60 -0
  77. package/server/vendor/zcode/packages/shared/src/oauth.ts +203 -0
  78. package/server/vendor/zcode/packages/shared/src/official-mcp-auth.ts +272 -0
  79. package/server/vendor/zcode/packages/shared/src/official-mcp-tool-error.ts +68 -0
  80. package/server/vendor/zcode/packages/shared/src/process-diagnostic.ts +42 -0
  81. package/server/vendor/zcode/packages/shared/src/protocol.ts +369 -0
  82. package/server/vendor/zcode/packages/shared/src/provider-family-connection-selection.ts +32 -0
  83. package/server/vendor/zcode/packages/shared/src/remoteAssetInstallMode.ts +11 -0
  84. package/server/vendor/zcode/packages/shared/src/remoteResourcePackages.ts +91 -0
  85. package/server/vendor/zcode/packages/shared/src/runtimeEnv.ts +315 -0
  86. package/server/vendor/zcode/packages/shared/src/settings-source.ts +10 -0
  87. package/server/vendor/zcode/packages/shared/src/usage-quota.ts +74 -0
  88. package/server/vendor/zcode/packages/shared/src/usage-stats.ts +462 -0
  89. package/server/vendor/zcode/packages/shared/src/validationAppSettings.ts +562 -0
  90. package/server/vendor/zcode/packages/shared/src/workspacePurpose.ts +2 -0
  91. package/server/vendor/zcode/packages/shared/src/wslUserValidation.ts +33 -0
  92. package/server/vendor/zcode/packages/shared/src/zcode-agent-policy.ts +25 -0
  93. package/server/vendor/zcode/packages/shared/src/zcode-media-policy.ts +10 -0
  94. package/server/vendor/zcode/packages/shared/src/zcode-protocol/index.ts +3720 -0
  95. package/server/vendor/zcode/packages/shared/src/zcode-protocol-legacy-types.ts +529 -0
  96. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/apply.ts +218 -0
  97. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/attachment-ref.ts +14 -0
  98. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/command.ts +482 -0
  99. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/core.ts +100 -0
  100. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/create-workflow-display.ts +156 -0
  101. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/cuaPermission.ts +41 -0
  102. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/delta.ts +147 -0
  103. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/input-intent.ts +69 -0
  104. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/rows.ts +432 -0
  105. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/session-config.ts +43 -0
  106. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/sessions-index-workflow-activity.ts +195 -0
  107. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/sessions-index.ts +85 -0
  108. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/shared-context-import.ts +38 -0
  109. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/shared-context-ref.ts +10 -0
  110. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/snapshot.ts +509 -0
  111. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/submission.ts +5 -0
  112. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/toolDisplay.ts +264 -0
  113. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/transport.ts +1152 -0
  114. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-assembler.ts +574 -0
  115. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-binary.ts +65 -0
  116. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-codec.ts +240 -0
  117. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire-fault.ts +39 -0
  118. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/wire.ts +159 -0
  119. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-artifacts.ts +291 -0
  120. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-observation-display.ts +281 -0
  121. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-row-meta.ts +163 -0
  122. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-run-settings-command.ts +62 -0
  123. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-runs-delta.ts +517 -0
  124. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workflow-runs.ts +512 -0
  125. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workspace-config.ts +81 -0
  126. package/server/vendor/zcode/packages/shared/src/zcode-protocol-v4/workspace-hook-review.ts +210 -0
  127. package/server/vendor/zcode/packages/shared/src/zcode-task-mode-schema.ts +6 -0
  128. package/server/vendor/zcode/packages/shared/src/zcode-task-types-core.ts +1187 -0
  129. package/server/vendor/zcode/packages/shared/src/zcodeEndpoint.ts +296 -0
  130. package/server/vendor/zcode/provenance.json +405 -0
  131. package/shared/diagnostics.ts +52 -0
  132. package/shared/runtime-setup.ts +75 -0
  133. package/vendor/acp-registry/LICENSE +176 -0
  134. package/vendor/paseo/LICENSE +211 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 supermomonga
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/NOTICE.md ADDED
@@ -0,0 +1,29 @@
1
+ # ライセンスの適用範囲
2
+
3
+ 本プロジェクトのオリジナルコードは [MIT License](LICENSE)(Copyright (c) 2026 supermomonga)で提供します。移植元の `paseo-zcode-patcher` と `zcode-acp` の該当コードも同じ著作者のオリジナルコードです。
4
+
5
+ 第三者素材のライセンスや権利は変更しません。`icon.svg` には以下の Apache-2.0 の条件が適用されます。`images/zcode-conversation.png` は著作者提供のスクリーンショットで、含まれる第三者アプリの画面・ロゴ・商標への権利を本プロジェクトの MIT License で許諾するものではありません。
6
+
7
+ # ソースの由来
8
+
9
+ `server/discovery`、`server/host`、`server/protocol`、マッピングとセッション処理、および対応テストは、同じ所有者の [paseo-zcode-patcher](https://github.com/supermomonga/paseo-zcode-patcher/tree/572100368774df7632728a72568466ac3632d458) の `patches/paseo-v0.7.2-zcode.patch` に含まれる ZCode 実装を基にしています。Paseo の内部 AgentClient 依存を除去し、公開 Provider API、JSON 検証、接続の終了処理を追加・変更しています。
10
+
11
+ プラグイン本体には ZCode の Agent・認証・ツール・保存エンジン、認証情報、モデル設定を同梱しません。統合 CLI の stdio Services Server は、利用者が設定画面でセットアップを開始したときに取得します。
12
+
13
+ # ZCode ランタイムの配布
14
+
15
+ ZCode は統合 CLI を配布していないため、このリポジトリは `zcode-runtime-v<version>` タグの GitHub Release で、統合 CLI 配布物の非公式ビルドを配布します(ADR 15)。CI が公開タグの無改変ソースを公式 `scripts/build-zcode.mjs` でビルドし、上流の `LICENSE`(Apache-2.0)、`NOTICE.md`、`THIRD-PARTY-NOTICES.md` と、出典・ビルド記録の `BUILD-INFO.json` を配布物に加えます。ソースは改変しません。第三者コンポーネントはそれぞれのライセンスに従い、上流が `third-party/inventory.json` で確認中とする項目もそのまま引き継ぎます。このビルドは ZCode・Z.ai の承認や保守を受けたものではなく、ZCode・Z.ai の商標の使用許諾も含みません。
16
+
17
+ Node.js は利用者のマシンが nodejs.org の公式成果物を直接取得します。このリポジトリは Node.js を再配布しません。
18
+
19
+ `server/vendor/zcode` は [zai-org/ZCode](https://github.com/zai-org/ZCode/tree/29628c9acdb81b703bbd4080c207a0e7ce5e276e) の RPC、V4 契約、wire 組み立てと純粋な差分適用、および必要なスキーマ依存を含みます。第一者コードは [上流 LICENSE](server/vendor/zcode/LICENSE) の Apache-2.0、RPC と wire codec の VS Code 由来部分は [MIT の通知](server/vendor/zcode/THIRD-PARTY-NOTICES.md) の条件を保持します。[上流 NOTICE](server/vendor/zcode/NOTICE.md) は全文を保持しており、上流製品全体の説明です。そこに記載された全機能・依存がプラグインへ同梱されることを意味しません。
20
+
21
+ ファイルごとの出典・SHA-256、private workspace import の変更、第三者通知の抽出範囲を [provenance.json](server/vendor/zcode/provenance.json) に記録しています。取得・照合は `scripts/sync-zcode-source.mjs` で行います。`npm run build` はこれらのライセンス・通知を `dist/licenses/zcode` にも配置します。
22
+
23
+ 開発 SDK は `@getpaseo/plugin@0.9.0-beta.1` です。ビルドは `@getpaseo/plugin/server/provider` と `zod` を外部モジュールとして維持し、Paseo に解決させます。
24
+
25
+ `icon.svg` は [Paseo main c424f829 の glm-acp-agent.svg](https://github.com/getpaseo/paseo/blob/c424f82922fcd36aa9cc9e473644bca04417b420/packages/app/src/assets/acp-provider-icons/glm-acp-agent.svg) のコピーです。この SVG は [ACP Registry の glm-acp-agent/icon.svg](https://github.com/agentclientprotocol/registry/blob/f3826ddd6e35951ea9b7fd0cf43c35a30c3c64cd/glm-acp-agent/icon.svg) とバイト単位で一致します。ACP Registry は Apache-2.0 で配布されており、その [LICENSE](vendor/acp-registry/LICENSE) を保持しています。アイコンは変更していません。商標への権利や公式の承認を示すものではありません。
26
+
27
+ アイコンの出典に対応する上流ライセンスを [vendor/paseo/LICENSE](vendor/paseo/LICENSE) に保持しています。Copyright (c) 2025-present Mohamed Boudra。
28
+
29
+ リリース監視スクリプトとワークフローは、[zcode-acp commit 7b3af187d7ee732e9043aed873a863fc855625c2](https://github.com/supermomonga/zcode-acp/tree/7b3af187d7ee732e9043aed873a863fc855625c2) の `scripts/check-zcode-releases.ts`、対応テスト、`.github/workflows/zcode-release-check.yml` を参考にしています。対応バージョンより新しいリリースの取得、変更履歴付きIssue作成、クローズ済みを含む重複防止をNode.js向けに実装し、Paseoのプレリリース・正式版にも適用しています。
package/README.md CHANGED
@@ -1,3 +1,99 @@
1
- # Temporary Holding Version
1
+ # ZCode Provider for Paseo
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Use ZCode models, tools and conversations through Paseo's public Provider API. The plugin launches the **official stdio Services Server from the integrated ZCode CLI distribution**, which it can set up for you. Authentication, models, tools and conversation storage remain owned by ZCode. ZCode Desktop is not required.
4
+
5
+ > Mode/Plan restoration is guaranteed when Paseo supplies both saved settings on resume. Without them, the pinned ZCode source can restore an older editing mode and drop Plan. That upstream defect remains unresolved and is outside the supported restoration contract. See [verification and remaining checks](docs/verification.md).
6
+
7
+ This is an unofficial plugin. It is not endorsed or maintained by ZCode or Z.ai. The official RPC/V4 implementation is public source, but it is not a stable third-party SDK.
8
+
9
+ ## Requirements
10
+
11
+ | Setting | Requirement |
12
+ | -------------- | ------------------------------------------------------------------------------------------------------------ |
13
+ | Paseo | 0.8.0 or later; development SDK 0.9.0-beta.1 |
14
+ | Plugin Node.js | 22.12.0 or later (the Paseo daemon's runtime) |
15
+ | Managed setup | darwin-arm64, linux-x64, linux-arm64, win-x64, win-arm64 |
16
+ | ZCode | Managed: 3.14.3 with Node.js 24.21.0. Overrides: stable Server 3.14.0+ / Agent 0.16.9+ with Node.js 24.14.0+ |
17
+
18
+ ## Installation
19
+
20
+ Enable **Settings → Plugins → Enable plugins** for the target daemon, then install the [npm package](https://www.npmjs.com/package/paseo-plugin-zcode-provider) and inspect:
21
+
22
+ ```bash
23
+ paseo plugin add npm:paseo-plugin-zcode-provider
24
+ paseo plugin ls
25
+ ```
26
+
27
+ You can also paste `npm:paseo-plugin-zcode-provider` into **Settings → Plugins → Plugin source**. npm packages require Paseo 0.9.0 or later and npm on the daemon host. Paseo installs the released version and compiles the plugin. Update with `paseo plugin update zcode-provider`. Plugins execute with the daemon user's permissions.
28
+
29
+ To follow the `main` branch instead, install the Git repository with `paseo plugin add supermomonga/paseo-plugin-zcode-provider`. Paseo prepares the checkout with `npm ci`.
30
+
31
+ ## Setup
32
+
33
+ Open **Settings → Plugins → zcode-provider → Setup** and choose **Download and install**. The screen lists every download, its SHA-256, size and license before you start. Setup runs on the machine hosting the daemon:
34
+
35
+ - Node.js 24.21.0 from nodejs.org.
36
+ - The ZCode runtime 3.14.3 from this repository's [releases](https://github.com/supermomonga/paseo-plugin-zcode-provider/releases/tag/zcode-runtime-v3.14.3). ZCode does not publish its integrated CLI, so this is an **unofficial build** of the unmodified public source, made and verified by CI. It is not endorsed or maintained by ZCode or Z.ai.
37
+
38
+ Both archives are verified against SHA-256 values pinned in the plugin and extracted to the daemon user's data directory:
39
+
40
+ | OS | Destination |
41
+ | ------------- | ----------------------------------------------------- |
42
+ | Windows | `%LOCALAPPDATA%\paseo-plugin-zcode-provider\runtimes` |
43
+ | macOS / Linux | `~/.local/share/paseo-plugin-zcode-provider/runtimes` |
44
+
45
+ An absolute `XDG_DATA_HOME` replaces the base directory on every OS. `PATH` and other installations are not changed. The plugin never installs anything until you start setup.
46
+
47
+ After setup, the screen shows a login command. Run it in a terminal on the daemon machine to sign in through ZCode's browser authorization (`--no-browser` prints the URL). Then choose **ZCode** when creating an agent. The plugin neither decrypts nor copies credentials.
48
+
49
+ **Remove** on the same screen deletes the managed runtime; `paseo plugin remove` does not. ZCode settings, logins and conversations are kept.
50
+
51
+ ### Using your own runtime
52
+
53
+ Set both variables in the daemon's environment and restart the daemon to bypass the managed runtime:
54
+
55
+ ```bash
56
+ export PASEO_ZCODE_RUNTIME=/absolute/path/to/zcode # extracted integrated CLI distribution
57
+ export PASEO_ZCODE_NODE=/absolute/path/to/node # ordinary Node.js 24.14.0 or later
58
+ ```
59
+
60
+ `PASEO_ZCODE_RUNTIME` must contain `server/remote/zcode-server.cjs`, `agent/zcode.cjs`, its provider configuration, and `package.json`. Setting only one variable is an error. Newer stable versions are allowed, including major versions; passing the minimum check does not certify compatibility. A terminal export does not change an already running Desktop application. Electron, `process.execPath` and Desktop discovery are never used.
61
+
62
+ Session environment variables are forwarded, subject to ZCode's own proxy, certificate and runtime environment handling.
63
+
64
+ The source baseline is `29628c9acdb81b703bbd4080c207a0e7ce5e276e` (ZCode `v3.14.3`). The managed runtime passed the stdio runtime contract on all five managed platforms in CI. See the [verification record](docs/verification.md) for exact coverage.
65
+
66
+ ## Behavior
67
+
68
+ - Models and reasoning options come from ZCode. Editing modes are `build`, `edit`, and `yolo`; `settings.plan_mode` is independent.
69
+ - Text, thoughts, tools, subagent progress, usage and history use V4 snapshots and deltas. Tool output is marked when ZCode truncates it. Usage is cumulative; repeated snapshots do not add it again.
70
+ - Text submitted during generation uses native guidance. Attachments use the native queue. Paseo reports one run across these native turns and completes it only after all accepted input has been consumed and foreground work has ended.
71
+ - Acceptance is reported once, after the native acknowledgement. Unknown delivery results are never automatically resent. Stop identifies the current native execution, disables automatic queue execution and removes pending input. A new explicit run enables the queue again.
72
+ - Native permission IDs, option values, questions and Plan approval retain their meanings. Question auto-resolution is disabled for each owned Server. Workspace hook trust is reviewed through the official CLI; it is not represented as “allow once.”
73
+ - Each session owns its Server process and environment. Metadata requests use temporary Servers. Closing stdin gives ZCode time to clean up before process termination.
74
+
75
+ The plugin uses ZCode's own skills, MCP configuration and tools. Browser/Computer Use, generic rewind, independent Paseo child agents, hook-review UI and Goal/Workflow controls are outside this migration. `prompt.output_schema`, custom system prompts and `persist:false` are unsupported. MCP `alwaysLoad` is unsupported; stdio MCP commands must be absolute paths. Standard Paseo quota and initial usage UI limitations are not filled with substitute displays.
76
+
77
+ ## Persistence
78
+
79
+ New handles use **version 3**. Versions 1 and 2 are rejected without migration or replacement. Old Paseo sessions are outside this migration.
80
+
81
+ Unsent conversations are deferred drafts. Before the first prompt, the plugin atomically saves the logical-to-native ID mapping under `$XDG_STATE_HOME/paseo-plugin-zcode-provider/sessions-v3`, or `~/.local/state/paseo-plugin-zcode-provider/sessions-v3`. It stores identifiers and workspace paths, not message bodies. Preserve this directory for backup. A mapping write failure prevents sending. Corrupt mappings and missing native conversations fail explicitly; no replacement conversation is created.
82
+
83
+ New conversations support listing, resume and paged V4 history. Mode/Plan restoration requires both `mode` and `settings.plan_mode` saved by Paseo. The plugin applies them after native restore and confirms the resulting state before reporting the session ready. Omitted settings retain whatever ZCode returns, which can be stale on the pinned source; restoration of those values is not guaranteed. There is no private Plan restoration store. [ADR 14](docs/adr/0014-paseoの保存設定を再適用する復元を保証範囲とする.md) limits the guarantee to this supported path; settings-free restoration is checked separately with `npm run test:native-restore`. Existing ZCode databases may be migrated by ZCode itself on startup; the native tests isolate the home, configuration and database.
84
+
85
+ ## Diagnostics
86
+
87
+ **Settings → Plugins → zcode-provider → Diagnostics** shows whether the managed runtime or the environment override is in use, the runtime and Node.js paths and versions, Server/Agent versions and hashes, minimum-version assessment and mapping location. The screen is read-only. Its optional version check does not prove that authentication or a model call succeeds.
88
+
89
+ ```bash
90
+ paseo plugin logs zcode-provider
91
+ ```
92
+
93
+ For failures, report the operation, error code, structured diagnostic and versions/hashes. Native stderr, raw errors, credentials and conversation bodies are excluded from diagnostics. Review any additional material before sharing. Reports are not sent automatically.
94
+
95
+ ## Development and license
96
+
97
+ See [development](docs/development.md), [verification](docs/verification.md), [remaining work](docs/todo.md), [ADR 13](docs/adr/0013-公開ソースの公式stdio-serverとv4会話状態を採用する.md) and [ADR 15](docs/adr/0015-プラグイン管理のzcodeランタイムとnode-jsを設定画面から導入する.md).
98
+
99
+ Original code is [MIT](LICENSE). Vendored ZCode RPC/contracts retain their upstream license and provenance. The ZCode runtime releases are Apache-2.0 builds of unmodified upstream source and include ZCode's LICENSE, NOTICE.md and THIRD-PARTY-NOTICES.md; third-party components keep their own terms. Node.js is downloaded from nodejs.org, not redistributed. The icon retains Apache-2.0 attribution; the historical screenshot includes third-party UI and branding. See [NOTICE](NOTICE.md).
@@ -0,0 +1,397 @@
1
+ import { useCallback, useEffect, useState } from "react";
2
+ import { Text, View } from "react-native";
3
+ import { type PluginSurfaceProps, useRpc } from "@getpaseo/plugin/client";
4
+ import {
5
+ SettingsAction,
6
+ SettingsCard,
7
+ SettingsRow,
8
+ SettingsSection,
9
+ } from "@getpaseo/plugin/client/ui";
10
+ import {
11
+ zcodeDiagnostics,
12
+ type DiagnosticsResult,
13
+ } from "../shared/diagnostics";
14
+
15
+ function Value({
16
+ children,
17
+ color,
18
+ compact,
19
+ }: {
20
+ children: string;
21
+ color: string;
22
+ compact: boolean;
23
+ }) {
24
+ return (
25
+ <Text
26
+ selectable
27
+ style={{ color, fontSize: compact ? 13 : 14, lineHeight: 20 }}
28
+ >
29
+ {children}
30
+ </Text>
31
+ );
32
+ }
33
+
34
+ function Installation({ result, theme, compact }: SectionProps) {
35
+ return (
36
+ <SettingsSection title="ZCode installation">
37
+ <SettingsCard>
38
+ <SettingsRow
39
+ label="Install root"
40
+ hint={
41
+ result.source === "managed"
42
+ ? "Managed runtime installed from the Setup screen"
43
+ : "PASEO_ZCODE_RUNTIME"
44
+ }
45
+ >
46
+ <Value color={theme.colors.foreground} compact={compact}>
47
+ {result.installRoot}
48
+ </Value>
49
+ </SettingsRow>
50
+ <SettingsRow label="Platform">
51
+ <Value color={theme.colors.foreground} compact={compact}>
52
+ {result.platform}
53
+ </Value>
54
+ </SettingsRow>
55
+ <SettingsRow label="ZCode Server version">
56
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
57
+ {result.appVersion ?? "Not reported"}
58
+ </Value>
59
+ </SettingsRow>
60
+ <SettingsRow label="Agent version">
61
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
62
+ {result.cliVersion ?? "Not reported"}
63
+ </Value>
64
+ </SettingsRow>
65
+ <SettingsRow label="Provider plugin version">
66
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
67
+ {result.providerVersion}
68
+ </Value>
69
+ </SettingsRow>
70
+ </SettingsCard>
71
+ </SettingsSection>
72
+ );
73
+ }
74
+
75
+ function Compatibility({ result, theme, compact }: SectionProps) {
76
+ const supported = result.compatibility === "supported";
77
+ return (
78
+ <SettingsSection title="Compatibility">
79
+ <SettingsCard>
80
+ <SettingsRow label="Status">
81
+ <Value
82
+ color={
83
+ supported ? theme.colors.statusSuccess : theme.colors.statusDanger
84
+ }
85
+ compact={compact}
86
+ >
87
+ {supported ? "Supported" : "Unsupported"}
88
+ </Value>
89
+ </SettingsRow>
90
+ <SettingsRow label="Reason">
91
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
92
+ {result.compatibilityReason}
93
+ </Value>
94
+ </SettingsRow>
95
+ <SettingsRow
96
+ label="Node.js"
97
+ hint={
98
+ result.source === "managed" ? "Managed Node.js" : "PASEO_ZCODE_NODE"
99
+ }
100
+ >
101
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
102
+ {`${result.nodeExecutable} (${result.nodeVersion})`}
103
+ </Value>
104
+ </SettingsRow>
105
+ <SettingsRow label="Server SHA-256">
106
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
107
+ {result.serverSha256}
108
+ </Value>
109
+ </SettingsRow>
110
+ <SettingsRow label="Agent SHA-256">
111
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
112
+ {result.agentSha256}
113
+ </Value>
114
+ </SettingsRow>
115
+ <SettingsRow label="Install root permissions">
116
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
117
+ {result.writableInstallRoot ? "Writable" : "Read-only"}
118
+ </Value>
119
+ </SettingsRow>
120
+ </SettingsCard>
121
+ </SettingsSection>
122
+ );
123
+ }
124
+
125
+ function HostCheck({
126
+ result,
127
+ busy,
128
+ onRun,
129
+ theme,
130
+ compact,
131
+ }: SectionProps & { busy: boolean; onRun(): void }) {
132
+ const smoke = result.smoke;
133
+ return (
134
+ <SettingsSection title="Host check">
135
+ <SettingsCard>
136
+ <SettingsRow
137
+ label="Result"
138
+ hint="Checks the configured Node.js and Server versions. No prompt is sent."
139
+ >
140
+ <Value
141
+ color={
142
+ smoke === undefined
143
+ ? theme.colors.foregroundMuted
144
+ : smoke.passed
145
+ ? theme.colors.statusSuccess
146
+ : theme.colors.statusDanger
147
+ }
148
+ compact={compact}
149
+ >
150
+ {smoke === undefined
151
+ ? "Not run"
152
+ : smoke.passed
153
+ ? "Passed"
154
+ : "Failed"}
155
+ </Value>
156
+ </SettingsRow>
157
+ {smoke === undefined ? null : (
158
+ <>
159
+ {smoke.error === undefined ? null : (
160
+ <SettingsRow label="Error">
161
+ <Value color={theme.colors.statusDanger} compact={compact}>
162
+ {smoke.error}
163
+ </Value>
164
+ </SettingsRow>
165
+ )}
166
+ </>
167
+ )}
168
+ </SettingsCard>
169
+ <SettingsAction
170
+ label="stdio Server"
171
+ actionLabel={busy ? "Checking…" : "Run host check"}
172
+ disabled={busy}
173
+ onPress={onRun}
174
+ />
175
+ </SettingsSection>
176
+ );
177
+ }
178
+
179
+ function SessionStorage({ result, theme, compact }: SectionProps) {
180
+ return (
181
+ <SettingsSection title="Session storage">
182
+ <SettingsCard>
183
+ <SettingsRow
184
+ label="Resume mapping directory"
185
+ hint="Stores identifiers and workspace paths, not message contents."
186
+ >
187
+ <Value color={theme.colors.foreground} compact={compact}>
188
+ {result.sessionsDirectory}
189
+ </Value>
190
+ </SettingsRow>
191
+ </SettingsCard>
192
+ </SettingsSection>
193
+ );
194
+ }
195
+
196
+ interface SectionProps {
197
+ result: Extract<DiagnosticsResult, { status: "ready" }>;
198
+ theme: PluginSurfaceProps["theme"];
199
+ compact: boolean;
200
+ }
201
+
202
+ function ReadyView({
203
+ result,
204
+ busy,
205
+ onCheck,
206
+ onSmoke,
207
+ theme,
208
+ compact,
209
+ }: {
210
+ result: Extract<DiagnosticsResult, { status: "ready" }>;
211
+ busy: boolean;
212
+ onCheck(): void;
213
+ onSmoke(): void;
214
+ theme: PluginSurfaceProps["theme"];
215
+ compact: boolean;
216
+ }) {
217
+ return (
218
+ <View style={{ gap: compact ? 16 : 24 }}>
219
+ <Installation result={result} theme={theme} compact={compact} />
220
+ <Compatibility result={result} theme={theme} compact={compact} />
221
+ <HostCheck
222
+ result={result}
223
+ busy={busy}
224
+ onRun={onSmoke}
225
+ theme={theme}
226
+ compact={compact}
227
+ />
228
+ <SessionStorage result={result} theme={theme} compact={compact} />
229
+ <SettingsSection title="Detection">
230
+ <SettingsAction
231
+ label="Installed ZCode"
232
+ actionLabel={busy ? "Checking…" : "Check again"}
233
+ disabled={busy}
234
+ onPress={onCheck}
235
+ />
236
+ </SettingsSection>
237
+ </View>
238
+ );
239
+ }
240
+
241
+ function FailedView({
242
+ result,
243
+ busy,
244
+ onCheck,
245
+ theme,
246
+ compact,
247
+ }: {
248
+ result: Extract<DiagnosticsResult, { status: "failed" }>;
249
+ busy: boolean;
250
+ onCheck(): void;
251
+ theme: PluginSurfaceProps["theme"];
252
+ compact: boolean;
253
+ }) {
254
+ return (
255
+ <View style={{ gap: compact ? 16 : 24 }}>
256
+ <SettingsSection title="ZCode diagnostics">
257
+ <SettingsCard>
258
+ <SettingsRow label="Result">
259
+ <Value color={theme.colors.statusDanger} compact={compact}>
260
+ Failed
261
+ </Value>
262
+ </SettingsRow>
263
+ <SettingsRow label="Error code">
264
+ <Value color={theme.colors.foreground} compact={compact}>
265
+ {result.code}
266
+ </Value>
267
+ </SettingsRow>
268
+ <SettingsRow label="Message">
269
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
270
+ {result.message}
271
+ </Value>
272
+ </SettingsRow>
273
+ <SettingsRow
274
+ label="Diagnostic report"
275
+ hint="Safe to attach to a GitHub issue; credentials, prompts, and raw native errors are excluded."
276
+ >
277
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
278
+ {result.diagnostic}
279
+ </Value>
280
+ </SettingsRow>
281
+ <SettingsRow label="Provider plugin version">
282
+ <Value color={theme.colors.foregroundMuted} compact={compact}>
283
+ {result.providerVersion}
284
+ </Value>
285
+ </SettingsRow>
286
+ </SettingsCard>
287
+ <SettingsAction
288
+ label="Installed ZCode"
289
+ actionLabel={busy ? "Checking…" : "Check again"}
290
+ disabled={busy}
291
+ onPress={onCheck}
292
+ />
293
+ </SettingsSection>
294
+ </View>
295
+ );
296
+ }
297
+
298
+ export function DiagnosticsScreen({ theme, layout }: PluginSurfaceProps) {
299
+ const run = useRpc(zcodeDiagnostics);
300
+ const [result, setResult] = useState<DiagnosticsResult | null>(null);
301
+ const [requestError, setRequestError] = useState<string | null>(null);
302
+ const [busy, setBusy] = useState(true);
303
+
304
+ const check = useCallback(
305
+ async (smoke: boolean) => {
306
+ setBusy(true);
307
+ try {
308
+ setResult(await run({ smoke }));
309
+ setRequestError(null);
310
+ } catch (cause) {
311
+ setRequestError(
312
+ cause instanceof Error
313
+ ? cause.message
314
+ : "The diagnostics request failed.",
315
+ );
316
+ } finally {
317
+ setBusy(false);
318
+ }
319
+ },
320
+ [run],
321
+ );
322
+
323
+ useEffect(() => {
324
+ void check(false);
325
+ }, [check]);
326
+
327
+ if (result === null) {
328
+ return (
329
+ <SettingsSection title="ZCode diagnostics">
330
+ <SettingsCard>
331
+ <SettingsRow label="Status">
332
+ <Value
333
+ color={theme.colors.foregroundMuted}
334
+ compact={layout.compact}
335
+ >
336
+ {requestError ?? "Checking the ZCode installation…"}
337
+ </Value>
338
+ </SettingsRow>
339
+ </SettingsCard>
340
+ {requestError === null ? null : (
341
+ <SettingsAction
342
+ label="Diagnostics request"
343
+ actionLabel={busy ? "Checking…" : "Try again"}
344
+ disabled={busy}
345
+ onPress={() => void check(false)}
346
+ />
347
+ )}
348
+ </SettingsSection>
349
+ );
350
+ }
351
+
352
+ const props = {
353
+ busy,
354
+ onCheck: () => void check(false),
355
+ onSmoke: () => void check(true),
356
+ theme,
357
+ compact: layout.compact,
358
+ };
359
+ return result.status === "ready" ? (
360
+ <>
361
+ <ReadyView result={result} {...props} />
362
+ {requestError === null ? null : (
363
+ <RequestError
364
+ message={requestError}
365
+ theme={theme}
366
+ compact={layout.compact}
367
+ />
368
+ )}
369
+ </>
370
+ ) : (
371
+ <FailedView result={result} {...props} />
372
+ );
373
+ }
374
+
375
+ function RequestError({
376
+ message,
377
+ theme,
378
+ compact,
379
+ }: {
380
+ message: string;
381
+ theme: PluginSurfaceProps["theme"];
382
+ compact: boolean;
383
+ }) {
384
+ return (
385
+ <SettingsSection title="Last request">
386
+ <Text
387
+ accessibilityRole="alert"
388
+ style={{
389
+ color: theme.colors.statusDanger,
390
+ fontSize: compact ? 13 : 14,
391
+ }}
392
+ >
393
+ {message}
394
+ </Text>
395
+ </SettingsSection>
396
+ );
397
+ }