gentle-pi 4.8.0 → 4.9.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.
- package/README.md +60 -0
- package/assets/agents/gentle-ai-explore.md +1 -1
- package/assets/agents/gentle-ai-verify.md +1 -1
- package/assets/agents/gentle-ai-worker.md +10 -9
- package/assets/design-canvas/canvas-boards.js +22 -2
- package/assets/design-canvas/canvas-boot.js +3 -1
- package/assets/design-canvas/canvas-i18n-es.js +5 -0
- package/assets/design-canvas/canvas-menu.js +13 -7
- package/assets/design-canvas/canvas-messages.js +1 -1
- package/assets/design-canvas/canvas-rail.js +5 -2
- package/assets/design-canvas/canvas-store.js +3 -0
- package/assets/design-canvas/canvas-theme.js +69 -0
- package/assets/design-canvas/canvas.css +27 -2
- package/assets/design-canvas/index.html +3 -0
- package/assets/design-canvas/inspector.js +28 -5
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/migrations/agent-body-history.json +6 -0
- package/assets/orchestrator-delegation.md +1 -5
- package/assets/orchestrator-full-delegation-card.md +9 -13
- package/assets/orchestrator-full-delegation.md +2 -2
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-tracking.md +6 -6
- package/assets/orchestrator-verification.md +4 -4
- package/assets/orchestrator-writer.md +12 -12
- package/assets/orchestrator.md +2 -2
- package/bin/gentle-shell.mjs +77 -1
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +1 -1
- package/docs/delegated-verification.md +6 -4
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +703 -25
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +65 -3
- package/docs/images/desktop/chat.png +0 -0
- package/docs/images/desktop/palette.png +0 -0
- package/docs/images/desktop/todo.png +0 -0
- package/docs/install-wizard.md +1 -1
- package/docs/odd-preparation-continuity.md +1 -1
- package/docs/readme-reference.md +44 -15
- package/docs/work-continuity.md +10 -7
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +47 -8
- package/extensions/gentle-agents.ts +206 -37
- package/extensions/gentle-ai.ts +234 -24
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +145 -12
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +69 -7
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +13 -3
- package/herdr/RECIPE.md +157 -0
- package/herdr/keys.json +14 -0
- package/herdr/layouts/gentle-shell.json +202 -0
- package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-agents/main.js +190 -0
- package/herdr/mods/gentle-agents/mod.json +1 -0
- package/herdr/mods/gentle-agents/snapshot.js +469 -0
- package/herdr/mods/gentle-agents/tokens.js +273 -0
- package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
- package/herdr/mods/gentle-chat/actions.js +180 -0
- package/herdr/mods/gentle-chat/feed.js +321 -0
- package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
- package/herdr/mods/gentle-chat/icons/check.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
- package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
- package/herdr/mods/gentle-chat/icons/down.svg +1 -0
- package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
- package/herdr/mods/gentle-chat/icons/send.svg +1 -0
- package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
- package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
- package/herdr/mods/gentle-chat/icons/term.svg +1 -0
- package/herdr/mods/gentle-chat/icons/user.svg +1 -0
- package/herdr/mods/gentle-chat/icons/x.svg +1 -0
- package/herdr/mods/gentle-chat/main.js +968 -0
- package/herdr/mods/gentle-chat/mod.json +1 -0
- package/herdr/mods/gentle-chat/session.js +212 -0
- package/herdr/mods/gentle-chat/snapshot.js +469 -0
- package/herdr/mods/gentle-chat/tokens.js +137 -0
- package/herdr/mods/gentle-chat/ui.js +883 -0
- package/herdr/mods/gentle-confirm/main.js +60 -0
- package/herdr/mods/gentle-confirm/mod.json +1 -0
- package/herdr/mods/gentle-inspector/actions.js +180 -0
- package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
- package/herdr/mods/gentle-inspector/main.js +500 -0
- package/herdr/mods/gentle-inspector/mod.json +1 -0
- package/herdr/mods/gentle-inspector/snapshot.js +469 -0
- package/herdr/mods/gentle-inspector/tokens.js +273 -0
- package/herdr/mods/gentle-palette/actions.js +180 -0
- package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
- package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
- package/herdr/mods/gentle-palette/icons/check.svg +1 -0
- package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
- package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
- package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
- package/herdr/mods/gentle-palette/icons/review.svg +1 -0
- package/herdr/mods/gentle-palette/icons/search.svg +1 -0
- package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
- package/herdr/mods/gentle-palette/icons/term.svg +1 -0
- package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
- package/herdr/mods/gentle-palette/main.js +333 -0
- package/herdr/mods/gentle-palette/mod.json +1 -0
- package/herdr/mods/gentle-palette/snapshot.js +469 -0
- package/herdr/mods/gentle-palette/tokens.js +273 -0
- package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
- package/herdr/mods/gentle-pane/icons/close.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
- package/herdr/mods/gentle-pane/icons/term.svg +1 -0
- package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
- package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
- package/herdr/mods/gentle-pane/main.js +91 -0
- package/herdr/mods/gentle-pane/mod.json +1 -0
- package/herdr/mods/gentle-pane/snapshot.js +469 -0
- package/herdr/mods/gentle-pane/tokens.js +273 -0
- package/herdr/mods/gentle-sidebar/actions.js +180 -0
- package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
- package/herdr/mods/gentle-sidebar/main.js +171 -0
- package/herdr/mods/gentle-sidebar/mod.json +1 -0
- package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
- package/herdr/mods/gentle-sidebar/tokens.js +273 -0
- package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
- package/herdr/mods/gentle-spaces/machines.js +31 -0
- package/herdr/mods/gentle-spaces/main.js +299 -0
- package/herdr/mods/gentle-spaces/mod.json +1 -0
- package/herdr/mods/gentle-spaces/snapshot.js +469 -0
- package/herdr/mods/gentle-spaces/tokens.js +273 -0
- package/herdr/mods/gentle-status/actions.js +180 -0
- package/herdr/mods/gentle-status/main.js +192 -0
- package/herdr/mods/gentle-status/mod.json +1 -0
- package/herdr/mods/gentle-status/snapshot.js +469 -0
- package/herdr/mods/gentle-status/tokens.js +273 -0
- package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
- package/herdr/mods/gentle-tabs/main.js +171 -0
- package/herdr/mods/gentle-tabs/mod.json +1 -0
- package/herdr/mods/gentle-tabs/snapshot.js +469 -0
- package/herdr/mods/gentle-tabs/tokens.js +273 -0
- package/herdr/mods/gentle-tokens/main.js +20 -0
- package/herdr/mods/gentle-tokens/mod.json +1 -0
- package/herdr/mods/gentle-tokens/snapshot.js +469 -0
- package/herdr/mods/gentle-tokens/tokens.js +273 -0
- package/herdr/preview.png +0 -0
- package/herdr/themes/gentle-shell-dark.json +33 -0
- package/herdr/themes/gentle-shell-light.json +34 -0
- package/lib/agents-protocol.ts +2 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +1 -0
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +1 -1
- package/lib/change-diff.ts +104 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/design-canvas-assets.ts +2 -0
- package/lib/desktop-agents-service.ts +31 -10
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-feed-actions.ts +804 -0
- package/lib/desktop-feed-answers.ts +129 -0
- package/lib/desktop-feed-sources.ts +184 -0
- package/lib/desktop-feed-stats.ts +98 -0
- package/lib/desktop-feed-store.ts +124 -0
- package/lib/desktop-feed.ts +788 -0
- package/lib/desktop-jobs-service.ts +34 -7
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +112 -3
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +162 -8
- package/lib/desktop-rpc-jobs.ts +118 -9
- package/lib/desktop-rpc-permissions.ts +154 -3
- package/lib/desktop-rpc-review.ts +180 -0
- package/lib/desktop-rpc-session.ts +203 -0
- package/lib/desktop-rpc-sessions.ts +250 -0
- package/lib/desktop-rpc-stats.ts +187 -0
- package/lib/desktop-rpc-updates.ts +143 -0
- package/lib/desktop-rpc.ts +116 -5
- package/lib/desktop-session-service.ts +223 -0
- package/lib/desktop-sessions-service.ts +249 -0
- package/lib/desktop-stats-service.ts +142 -0
- package/lib/desktop-updates-service.ts +268 -0
- package/lib/gentle-shell-desktop.ts +1370 -0
- package/lib/gentle-shell-launcher.ts +45 -3
- package/lib/herdr-desktop-events.ts +40 -0
- package/lib/herdr-desktop-status.ts +229 -0
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/native-review-cli.ts +7 -0
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/stats-collector.ts +56 -27
- package/lib/tower-actions.ts +100 -0
- package/lib/tower-hub.ts +73 -0
- package/lib/tower-launch.ts +111 -0
- package/lib/tower-open.ts +99 -0
- package/lib/tower-presence.ts +70 -0
- package/lib/tower-server.ts +234 -0
- package/lib/tower-snapshot.ts +298 -0
- package/lib/update-status.ts +238 -0
- package/lib/verifier-settle-reminder.ts +1 -1
- package/package.json +13 -4
- package/runtime/design-canvas-assets.mjs +2 -0
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +7 -0
- package/runtime/tower-actions.mjs +101 -0
- package/runtime/tower-hub.mjs +74 -0
- package/runtime/tower-launch.mjs +112 -0
- package/runtime/tower-open.mjs +100 -0
- package/runtime/tower-presence.mjs +71 -0
- package/runtime/tower-server.mjs +234 -0
- package/runtime/tower-snapshot.mjs +299 -0
- package/scripts/build-full-delegation-card.mjs +1 -21
- package/scripts/build-runtime-modules.mjs +9 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/verify-package-files.mjs +35 -15
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +3 -3
- package/tests/agent-prompt-diet-contract.test.ts +2 -2
- package/tests/append-system-prompt-route.test.ts +16 -5
- package/tests/ask-user-choice.test.ts +78 -21
- package/tests/ask-user-question.test.ts +59 -5
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +139 -26
- package/tests/change-diff.test.ts +75 -0
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- package/tests/design-canvas-i18n.test.ts +24 -22
- package/tests/design-canvas-inspector.test.ts +67 -0
- package/tests/design-canvas-modules.test.ts +3 -2
- package/tests/design-canvas-rail.test.ts +10 -10
- package/tests/design-canvas-store.test.ts +9 -0
- package/tests/design-canvas-theme.test.ts +198 -0
- package/tests/design-canvas-tokens.test.ts +1 -1
- package/tests/desktop-feed-actions-guards.test.ts +595 -0
- package/tests/desktop-feed-actions.test.ts +761 -0
- package/tests/desktop-feed-live-work.test.ts +209 -0
- package/tests/desktop-feed-performance.test.ts +369 -0
- package/tests/desktop-feed-plan-profiles.test.ts +509 -0
- package/tests/desktop-feed-send-prompt.test.ts +303 -0
- package/tests/desktop-feed-tool-summaries.test.ts +69 -0
- package/tests/desktop-feed.test.ts +615 -0
- package/tests/desktop-rpc-agents.test.ts +428 -2
- package/tests/desktop-rpc-changes.test.ts +608 -0
- package/tests/desktop-rpc-config-watch.test.ts +1159 -0
- package/tests/desktop-rpc-config.test.ts +11 -1
- package/tests/desktop-rpc-design.test.ts +11 -1
- package/tests/desktop-rpc-jobs.test.ts +402 -5
- package/tests/desktop-rpc-permissions.test.ts +11 -1
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-session.test.ts +642 -0
- package/tests/desktop-rpc-sessions.test.ts +647 -0
- package/tests/desktop-rpc-stats.test.ts +431 -0
- package/tests/desktop-rpc-updates.test.ts +525 -0
- package/tests/desktop-rpc-usage.test.ts +11 -1
- package/tests/desktop-rpc.test.ts +43 -2
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +20 -1
- package/tests/gentle-agents.test.ts +519 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-installer.test.ts +52 -52
- package/tests/gentle-ai.test.ts +75 -16
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-desktop-bin.test.ts +125 -0
- package/tests/gentle-shell-desktop.test.ts +927 -0
- package/tests/gentle-shell-launcher-tower.test.ts +104 -0
- package/tests/gentle-shell.test.ts +3 -0
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/independent-recovery-delivery.test.ts +16 -4
- package/tests/installer-server.test.ts +2 -2
- package/tests/lazy-module-contradictions-contract.test.ts +27 -4
- package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
- package/tests/native-review-capability-contract.test.ts +9 -1
- package/tests/no-self-pause-contract.test.ts +23 -13
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +19 -3
- package/tests/orchestrator-budget.test.ts +3 -1
- package/tests/orchestrator-prompt-budget.test.ts +2 -1
- package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
- package/tests/package-manifest.test.ts +10 -10
- package/tests/pi-routing-measured-values.test.ts +24 -0
- package/tests/primary-session-prompt.test.ts +25 -0
- package/tests/profile-fast-tier.test.ts +66 -1
- package/tests/provider-defect-handoff.test.ts +118 -100
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-due-public-boundary.test.ts +2 -1
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +310 -16
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +5 -3
- package/tests/skill-registry.test.ts +54 -0
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +17 -0
- package/tests/task-size-routing-contract.test.ts +7 -3
- package/tests/tower-actions.test.ts +247 -0
- package/tests/tower-artifacts.test.ts +114 -0
- package/tests/tower-open.test.ts +97 -0
- package/tests/tower-presence.test.ts +175 -0
- package/tests/tower-server.test.ts +122 -0
- package/tests/tower-snapshot.test.ts +236 -0
- package/tests/tower-web-echo.test.ts +125 -0
- package/tests/tower-web-hover.test.ts +251 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +5 -5
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-first-launch-contract.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +83 -17
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
package/docs/desktop-rpc.md
CHANGED
|
@@ -62,12 +62,12 @@ Returns the currently implemented contract; clients must not infer support from
|
|
|
62
62
|
"schema": "gentle-shell.desktop-rpc/v1",
|
|
63
63
|
"command": "gentle:desktop",
|
|
64
64
|
"widget": "gentle-desktop-rpc",
|
|
65
|
-
"methods": ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "apply_profile", "list_subagents", "cancel_subagent"],
|
|
66
|
-
"events": ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update"]
|
|
65
|
+
"methods": ["capabilities", "get_snapshot", "get_config", "set_config", "get_permission_mode", "set_permission_mode", "get_subscription_usage", "refresh_subscription_usage", "get_design_canvas", "list_jobs", "cancel_job", "get_job_output", "apply_profile", "list_subagents", "cancel_subagent", "get_subagent_thread", "list_sessions", "switch_session", "get_changes", "get_change_diff", "get_review_mode", "set_review_mode", "get_usage_stats", "get_update_status"],
|
|
66
|
+
"events": ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update", "review_mode_changed", "session_snapshot"]
|
|
67
67
|
}
|
|
68
68
|
```
|
|
69
69
|
|
|
70
|
-
The permission methods, the bounded config read and write, the subscription-usage read and refresh, the design-canvas read, the background-jobs list and
|
|
70
|
+
The permission methods, the bounded config read and write, the subscription-usage read and refresh, the design-canvas read, the background-jobs list, cancel, and output read, the profile apply, the subagents list, cancel, and thread read, the review-mode read and change, the cross-session usage-stats read, the update-status read, and the `config_changed`, `permission_mode_changed`, `rate_limit`, `design_canvas`, `jobs_update`, `profile_applied`, `agents_update`, and `review_mode_changed` events are advertised because this extension wires them. `set_config` and `config_changed` are advertised only because the config bridge actually implements that writer — advertising is not a forward-looking wish list. The design slice advertises exactly its one read method and its one transition event, not the canvas `open`/`stop` actions, which stay the `gentle_design` tool's job. The jobs slice advertises exactly its list, cancel, and output-read methods and its one registry-change event, not the `bash_background`/`monitor` start tools, which stay agent tools. The profiles slice advertises exactly its one apply method and its one applied event; profile edits stay `set_config`. The subagents slice advertises exactly its list, cancel, and thread-read methods and its one transition event, not the agent dispatch tools, which stay agent tools. `session_snapshot` is the one entry that depends on the session: it is listed only while the feed owner seam (`extensions/gentle-desktop-feed.ts`) is wired for this session, and absent otherwise; the `get_snapshot` method itself is always listed. The review slice advertises exactly its read and change methods and its one change event; review start, skip, and consent stay terminal-only. The stats slice advertises exactly its one read method and no event: usage stats are an explicit read. The updates slice advertises exactly its one read method and no event; running an update stays the launcher's job. Method availability is not a claim that every dependency is loaded — see [Permission limits](#permission-limits), [Configuration limits](#configuration-limits), [Usage limits](#usage-limits), [Design limits](#design-limits), [Jobs limits](#jobs-limits), [Profiles limits](#profiles-limits), [Subagents limits](#subagents-limits), [Review limits](#review-limits), [Stats limits](#stats-limits), and [Updates limits](#updates-limits).
|
|
71
71
|
|
|
72
72
|
### `get_snapshot`
|
|
73
73
|
|
|
@@ -96,6 +96,43 @@ The projection carries only store identity, scope, mutability, status, and revis
|
|
|
96
96
|
|
|
97
97
|
This snapshot does not project permission state: use `get_permission_mode` for that. `sequence` is the number of delivered events, so a client that saw `seq: 4` expects `sequence: 4` from a fresh snapshot unless it missed an event.
|
|
98
98
|
|
|
99
|
+
#### Session sections
|
|
100
|
+
|
|
101
|
+
`get_snapshot` accepts one optional param, `sections`: the session state the TUI sidebar and the Herdr feed show, read live from the feed owner's projection (`buildDesktopFeedSnapshot`, schema `gentle-shell.desktop-feed/v1`) through an in-process seam, never from the feed's file.
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
106
|
+
"requestId": "desktop-43",
|
|
107
|
+
"method": "get_snapshot",
|
|
108
|
+
"params": { "sections": ["todo", "changes", "activity"] }
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Without a `sections` key the request is the legacy read above, byte-for-byte (other params stay ignored as before). With it, params are exactly `{ "sections": [...] }`: a non-empty array of unique names from `project`, `model`, `context`, `cost`, `usage`, `profiles`, `permission`, `todo`, `changes`, `agents`, `jobs`, `review`, `stats`, `activity`, `pendingQuestion`, `commands`. Any other shape, an unknown or repeated name, or an extra key is `invalid_request`, before any owner work. The answer keeps `state.config` exactly as the legacy read and adds `state.session` with the requested sections in that canonical order:
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
117
|
+
"sequence": 4,
|
|
118
|
+
"state": {
|
|
119
|
+
"config": { "stores": ["…as above…"] },
|
|
120
|
+
"session": {
|
|
121
|
+
"todo": { "items": [{ "id": 2, "title": "Build feed", "state": "in_progress", "note": null }], "progress": { "done": 1, "total": 2, "open": 1 }, "current": "Build feed", "truncated": false },
|
|
122
|
+
"changes": {
|
|
123
|
+
"files": [{ "path": "lib/a.ts", "root": "root-70e56188b8da", "status": "modified", "added": 3, "deleted": 1 }],
|
|
124
|
+
"summary": { "files": 1, "added": 3, "deleted": 1 },
|
|
125
|
+
"worktrees": [{ "root": "root-70e56188b8da", "branch": "feat/x", "files": 1 }],
|
|
126
|
+
"truncated": false
|
|
127
|
+
},
|
|
128
|
+
"activity": { "state": "working", "streaming": true, "phase": "implementing", "phaseLabel": "implementing…", "blockedLabel": null, "agents": 0, "jobs": 0, "label": "Working" }
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Each section is the feed's own shape (see `DesktopFeedSnapshot` in `lib/desktop-feed.ts`) with two path-free changes: `project` is `{ "name", "branch", "dirty" }`, where `name` is the basename of the working directory (`null` for a filesystem root such as `/` or a drive root such as `C:\`), and in `changes` every worktree `root` is an opaque, stable label (`root-` plus 12 hex characters) while every file carries a `path` relative to its worktree plus that worktree's `root` label (`null`, with the bare file name, for a path no worktree holds). Windows-style roots (a drive letter or backslashes) match their files case- and separator-insensitively; POSIX roots match case-sensitively. A worktree whose root is `/` or a bare drive gets `root: null` and never relativizes a path: its files cross as bare file names with `root: null`. A section the session has nothing for is `null`, as in the feed (`changes` before the first scan, `review` before a review, `pendingQuestion` with no open question). When the feed is not running for this session (the extension is not loaded, the process is not Gentle Shell, or the session is not live) the answer is `session_unavailable`; `get_snapshot` without `sections` is unaffected. A read never emits an event.
|
|
135
|
+
|
|
99
136
|
### `get_config`
|
|
100
137
|
|
|
101
138
|
Reads one existing configuration store through the owner that already reads it. Desktop names a store identifier, never a path: the request accepts exactly one param.
|
|
@@ -267,7 +304,7 @@ Outside a resolvable Git worktree `pins` reports `writeTargets: []`: there is no
|
|
|
267
304
|
`revision` is a `sha256` digest over canonical JSON (sorted keys, `undefined` members dropped) of `{store, status, value}` for that read. It is stable across equivalent reads: reformatting a file, reordering its keys, or touching its mtime does not move it, while any change to normalized content does. The same caveat as `writeRevision` applies: a read that produced no content (`missing`, `invalid`) digests only `{store, status}`, so two different broken files for one store share a read revision. It is deliberately not a transaction token:
|
|
268
305
|
|
|
269
306
|
- it is computed **at read time**, after the owner normalized the content, not from file bytes and not from an owner-maintained counter;
|
|
270
|
-
- there is no
|
|
307
|
+
- there is no cross-process lock, and the only change notification is the best-effort external `config_changed` event (see [`config_changed`](#config_changed)), so two processes can each see a different revision at the same wall-clock moment, and when a watcher is missing nobody is told that the other one wrote;
|
|
271
308
|
- a multi-layer store (`models`, `subagents`, `pins`) can change between the individual layer reads that make up one projection; that projection is still a truthful report of the layers that were read;
|
|
272
309
|
- it orders nothing, so it must never be compared between sessions or used as a precondition for a write. `expectedRevision` is the only precondition this contract accepts, and it is compared against `writeTargets[].writeRevision` — never against `revision`.
|
|
273
310
|
|
|
@@ -722,7 +759,7 @@ Each entry carries only the whitelisted fields of the owner's `JobRecord`:
|
|
|
722
759
|
| `endedAt` | When a non-running job ended, present only after it ends. |
|
|
723
760
|
| `exitCode` | The job's own exit code, present only when the owner recorded one (`null` for an exit without a code). |
|
|
724
761
|
|
|
725
|
-
No command text, working directory, output path or tail, environment, owner session id, monitor counters, or error string ever crosses the wire. The list is bounded: running jobs first (newest start first), then recently-finished jobs (newest end first) within a 60-second linger, capped at 50 entries, so the answer can never grow with the process lifetime. When the jobs owner is absent (the owning extension is not loaded), the answer is `jobs_unavailable` — never a fabricated empty list.
|
|
762
|
+
No command text, working directory, output path or tail, environment, owner session id, monitor counters, or error string ever crosses the wire in a list entry; a job's output tail is available only through the separate, owner-verified [`get_job_output`](#get_job_output) read. The list is bounded: running jobs first (newest start first), then recently-finished jobs (newest end first) within a 60-second linger, capped at 50 entries, so the answer can never grow with the process lifetime. When the jobs owner is absent (the owning extension is not loaded), the answer is `jobs_unavailable` — never a fabricated empty list.
|
|
726
763
|
|
|
727
764
|
### `cancel_job`
|
|
728
765
|
|
|
@@ -752,6 +789,46 @@ Only the `id` key is accepted; any other key, a non-string or empty `id`, or a r
|
|
|
752
789
|
|
|
753
790
|
The response is the **actual post-action state**, re-read from the owner — never an echo of the request. A job that was already terminal (an `exited`, `stopped`, or `failed` job) answers that terminal state with `status` unchanged and no `changed` marker, and emits no event; there is no race-driven error for a job that finished just before the cancel. The response line always precedes its `jobs_update` event.
|
|
754
791
|
|
|
792
|
+
### `get_job_output`
|
|
793
|
+
|
|
794
|
+
Reads one background job's bounded output tail from the existing jobs owner: the registry's own in-memory tail (the last 20 lines, at most 2 000 characters per line — `TAIL_LINES`/`MAX_TAIL_LINE_CHARS` in `lib/background-jobs.ts`). It is a pollable read: it never starts, stops, or changes a job, never reads the job's log file, and emits no event. Params are exactly `{ id }`.
|
|
795
|
+
|
|
796
|
+
```json
|
|
797
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-60", "method": "get_job_output", "params": { "id": "job-1" } }
|
|
798
|
+
```
|
|
799
|
+
|
|
800
|
+
| Param | Required | Type | Meaning |
|
|
801
|
+
| --- | --- | --- | --- |
|
|
802
|
+
| `id` | yes | non-empty string | The job to read, as reported by `list_jobs` or `jobs_update`. |
|
|
803
|
+
|
|
804
|
+
Only the `id` key is accepted; any other key, a non-string or empty `id`, or a `job_id` key is `invalid_request`, answered before any owner work. The id is resolved against the active owner session with the same ownership rule `list_jobs` and `cancel_job` apply: an unknown id or a job owned by another session is a typed `not_found`, never another session's output.
|
|
805
|
+
|
|
806
|
+
```json
|
|
807
|
+
{
|
|
808
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
809
|
+
"kind": "response",
|
|
810
|
+
"requestId": "desktop-60",
|
|
811
|
+
"ok": true,
|
|
812
|
+
"data": {
|
|
813
|
+
"job": { "id": "job-1", "label": "CI for PR 42", "status": "running", "startedAt": 1788600000000 },
|
|
814
|
+
"output": "✓ lint\n✓ typecheck\nrunning tests 100%",
|
|
815
|
+
"truncated": true
|
|
816
|
+
}
|
|
817
|
+
}
|
|
818
|
+
```
|
|
819
|
+
|
|
820
|
+
| Field | Meaning |
|
|
821
|
+
| --- | --- |
|
|
822
|
+
| `job` | The same whitelisted projection as one `list_jobs` entry (`id`, `label`, `status`, `startedAt`, `endedAt?`, `exitCode?`), so a poller knows when the job has ended. |
|
|
823
|
+
| `output` | The tail as one plain-text field: the kept lines joined by `\n`, oldest first. Empty when the job has printed nothing yet. |
|
|
824
|
+
| `truncated` | `true` once the tail stopped being the job's whole output: earlier lines were dropped, or a line longer than 2 000 characters was shortened to its newest characters after a leading `…`. |
|
|
825
|
+
|
|
826
|
+
**Terminal control sequences are stripped server-side; the text is plain.** The owner tail keeps raw job output (it only joins chunks and strips a trailing CR), so progress bars and colored output carry ANSI escape sequences. This method removes CSI sequences (colors, cursor moves, 7- and 8-bit), OSC sequences (window titles, hyperlinks; BEL- or ST-terminated, or unterminated to the end of the line), DCS/SOS/PM/APC strings, and the remaining two-character escapes; a line that redraws itself with carriage returns shows only its last non-empty segment, which is what a terminal would leave visible; every other control character except tab is removed. A consumer renders `output` as plain text and must not expect, or interpret, escape sequences in it. Truncation is multi-byte safe: a half UTF-16 character left by a fixed-length cut is removed, never sent.
|
|
827
|
+
|
|
828
|
+
**The tail is not sanitized for content.** The wire carries no command, working directory, output path, environment, owner session id, monitor counter, or error string as a field, and nothing is inferred from the label. But `output` is arbitrary process output, and it can legitimately contain whatever the job printed: echoed commands, paths, tokens, or other secrets. That content is the job owner's own data; requesting it is the consumer session's standing decision. A consumer should treat it like terminal output — show it to the session owner, never log or forward it as if it were redacted.
|
|
829
|
+
|
|
830
|
+
The answer is bounded by construction: at most 20 lines and 40 019 UTF-16 code units (20 × 2 001 plus 19 newlines). The bridge re-validates the owner's answer, re-applies that bound (keeping the newest output and setting `truncated`), and re-normalizes it before it reaches the wire. When the jobs owner is absent, or the loaded owner adapter predates the output read, the answer is `jobs_unavailable`; a throwing or malformed owner answer is also `jobs_unavailable`, with no raw error on the wire. There is no `job_output` event: a client that shows a live tail polls this method.
|
|
831
|
+
|
|
755
832
|
### `list_subagents`
|
|
756
833
|
|
|
757
834
|
Reads the live subagents the existing agents owner already owns (the single parent-session `TaskStore`), projected into the safe wire shape. Params must be an empty object.
|
|
@@ -802,7 +879,7 @@ Each entry carries only the whitelisted fields of the owner's `TaskRecord`:
|
|
|
802
879
|
| `lastStep` | A closed phase label derived from the task status, never the raw owner step text: `queued`, `waiting`, `running`, a fixed safe active step (`starting`, `writing`, `cleaning up`, `generating tool arguments`, `question dismissed`, `answered`, `interrupted`), or the generic terminal reason (`completed`, `failed`, `cancelled`, `timed_out`). Raw `TaskRecord.lastStep` text can carry an error message, a stderr tail, or a provider body, so it is mapped into this closed vocabulary and never forwarded. |
|
|
803
880
|
| `usage` | The helper's accumulated usage: `total` tokens, `cost`, and — once the run settled — the final-assistant `input`, `output`, `cache` (read + write), and `reasoning` token breakdown. The breakdown fields are absent for an in-flight task whose breakdown is not recorded yet, and for a restored finished task whose run never recorded one. |
|
|
804
881
|
|
|
805
|
-
No prompt text, tool arguments or output, working directory, session path, result, error text, or full session internals ever cross the wire. The list is bounded: active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries, so the answer can never grow with the process lifetime. When the agents owner is absent (the owning extension is not loaded), the answer is `agents_unavailable` — never a fabricated empty list.
|
|
882
|
+
No prompt text, tool arguments or output, working directory, session path, result, error text, or full session internals ever cross the wire in a list entry; tool arguments, tool output, and thread text are only readable, bounded, through [`get_subagent_thread`](#get_subagent_thread). The list is bounded: active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries, so the answer can never grow with the process lifetime. When the agents owner is absent (the owning extension is not loaded), the answer is `agents_unavailable` — never a fabricated empty list.
|
|
806
883
|
|
|
807
884
|
### `cancel_subagent`
|
|
808
885
|
|
|
@@ -836,6 +913,104 @@ The response is the **actual post-action state**, re-read from the owner — nev
|
|
|
836
913
|
- A **running** task is cancelled asynchronously: `runner.cancel` returns `true` but the store has not transitioned yet, so the response reports the still-`running` state and emits **no immediate event**. The real transition (the child exit to `cancelled`) arrives later through the normal `agents_update` path. A repeated in-flight cancel is likewise `changed: false` with no event.
|
|
837
914
|
- An already-terminal task returns its terminal state with no event; there is no race-driven error for a task that finished just before the cancel. An unknown or foreign id is a typed `not_found`. The response line always precedes any `agents_update` event.
|
|
838
915
|
|
|
916
|
+
### `get_subagent_thread`
|
|
917
|
+
|
|
918
|
+
Reads one subagent's bounded activity thread from the same `TaskStore` the `gentle-agents.activity/v1` widget projects, so a client can show what a finished or background subagent did. Params are `{ id, sinceVersion? }`.
|
|
919
|
+
|
|
920
|
+
```json
|
|
921
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-62", "method": "get_subagent_thread", "params": { "id": "m3a1-worker", "sinceVersion": 41 } }
|
|
922
|
+
```
|
|
923
|
+
|
|
924
|
+
| Param | Required | Type | Meaning |
|
|
925
|
+
| --- | --- | --- | --- |
|
|
926
|
+
| `id` | yes | non-empty string | The subagent to read, as reported by `list_subagents`. |
|
|
927
|
+
| `sinceVersion` | no | non-negative integer | The `version` of the client's last read of this thread. |
|
|
928
|
+
|
|
929
|
+
Only the `id` and `sinceVersion` keys are accepted; any other key, a non-string or empty `id`, or a `sinceVersion` that is not a non-negative integer is `invalid_request`, rejected before the owner is reached. The id is resolved with the same ownership rule as `list_subagents` and `cancel_subagent`: only a subagent whose parent session is the calling session is readable; an unknown id, a subagent of another session, or a finished subagent the store has already evicted is a typed `not_found`. When the agents owner is not loaded, the answer is `agents_unavailable`. A read has no side effect and never emits an event.
|
|
930
|
+
|
|
931
|
+
```json
|
|
932
|
+
{
|
|
933
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
934
|
+
"kind": "response",
|
|
935
|
+
"requestId": "desktop-62",
|
|
936
|
+
"ok": true,
|
|
937
|
+
"data": {
|
|
938
|
+
"id": "m3a1-worker",
|
|
939
|
+
"version": 57,
|
|
940
|
+
"items": [
|
|
941
|
+
{ "kind": "text", "text": "Mapping the repository layout." },
|
|
942
|
+
{ "kind": "tool", "name": "read", "args": "{\"path\":\"README.md\"}", "running": false, "isError": false, "output": "# Project…" },
|
|
943
|
+
{ "kind": "note", "text": "retrying (2/3)" }
|
|
944
|
+
],
|
|
945
|
+
"dropped": 0,
|
|
946
|
+
"truncated": false
|
|
947
|
+
}
|
|
948
|
+
}
|
|
949
|
+
```
|
|
950
|
+
|
|
951
|
+
| Field | Meaning |
|
|
952
|
+
| --- | --- |
|
|
953
|
+
| `id` | The subagent the thread belongs to. |
|
|
954
|
+
| `version` | The store's thread version. It grows with every change to the thread, including in-place changes to an existing item. |
|
|
955
|
+
| `items` | The thread, oldest first, in the exact projection and bounds of `gentle-agents.activity/v1`: the last 40 items; `text`, `thinking`, and `note` items carry `text` (at most 2 000 characters); `tool` items carry `name`, `args` (the JSON-encoded arguments, at most 500 characters), `running`, `isError`, and `output` (at most 500 characters). A cut field ends with `…`. The list is then bounded to 256 KB by the same halving the widget applies. |
|
|
956
|
+
| `dropped` | How many older items the store itself evicted from this thread (beyond its own 400-item retention). They are gone and no read can return them. |
|
|
957
|
+
| `truncated` | `true` when the store still holds more items than `items` carries (the 40-item window or the byte bound cut older ones). |
|
|
958
|
+
|
|
959
|
+
`sinceVersion` makes polling cheap. When it equals the current `version`, nothing changed since that read: `items` is empty and `truncated` is `false`. Any other value returns the whole bounded window. The store keeps one version per thread, not per item, and an item can change after it first appears (streamed text merges into the last text item; a tool item receives its output and end state later), so the whole window is the smallest answer guaranteed to contain every changed item. A client replaces its view with the returned items.
|
|
960
|
+
|
|
961
|
+
Tool args and output are the subagent's own data: they contain whatever its tools received and printed, which can include file contents, command output, or anything else the subagent read. They are bounded, not redacted. Text, thinking, and note items are likewise the subagent's own output (a note can carry an error message). Prompt text, the working directory, the session path, the tool call id, and the result are not part of a thread item.
|
|
962
|
+
|
|
963
|
+
### `get_usage_stats`
|
|
964
|
+
|
|
965
|
+
Reads cross-session usage — the same history `/gentle:stats` shows — through the stats owner's own loader and the same `aggregateStats` aggregation the panel runs, so the panel and Desktop never disagree. Params are optional `range` and `scope`.
|
|
966
|
+
|
|
967
|
+
```json
|
|
968
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-61", "method": "get_usage_stats", "params": { "range": "30d", "scope": "all" } }
|
|
969
|
+
```
|
|
970
|
+
|
|
971
|
+
| Param | Required | Values | Meaning |
|
|
972
|
+
| --- | --- | --- | --- |
|
|
973
|
+
| `range` | no | `7d` (default), `30d`, `all` | The local calendar days counted: the last 7 or 30 days including today, or everything. |
|
|
974
|
+
| `scope` | no | `project` (default), `all` | `project` counts only sessions whose working directory is this session's; `all` counts every session. |
|
|
975
|
+
|
|
976
|
+
Any other key, or any other value (including `null`), is rejected as `invalid_request` before the owner is asked. A read has no side effect: it never writes, and never emits an event.
|
|
977
|
+
|
|
978
|
+
Success:
|
|
979
|
+
|
|
980
|
+
```json
|
|
981
|
+
{
|
|
982
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
983
|
+
"kind": "response",
|
|
984
|
+
"requestId": "desktop-61",
|
|
985
|
+
"ok": true,
|
|
986
|
+
"data": {
|
|
987
|
+
"range": "30d",
|
|
988
|
+
"scope": "all",
|
|
989
|
+
"totals": { "sessions": 3, "messages": 4, "inputTokens": 1310, "outputTokens": 155, "cacheReadTokens": 1000, "cacheWriteTokens": 200, "totalTokens": 2665, "cost": 1.76 },
|
|
990
|
+
"byModel": [
|
|
991
|
+
{ "model": "claude-opus-5-5", "messages": 2, "tokens": 1365, "cost": 0.51, "share": 0.512 },
|
|
992
|
+
{ "model": "gpt-5.5", "messages": 2, "tokens": 1300, "cost": 1.25, "share": 0.488 }
|
|
993
|
+
],
|
|
994
|
+
"byDay": [{ "day": "2026-09-20", "tokens": 1000 }, { "day": "2026-10-08", "tokens": 300 }, { "day": "2026-10-09", "tokens": 1365 }],
|
|
995
|
+
"byProject": [
|
|
996
|
+
{ "name": "alpha", "sessions": 2, "messages": 3, "tokens": 2365, "cost": 1.51 },
|
|
997
|
+
{ "name": "beta", "sessions": 1, "messages": 1, "tokens": 300, "cost": 0.25 }
|
|
998
|
+
],
|
|
999
|
+
"truncated": { "byModel": false, "byDay": false, "byProject": false }
|
|
1000
|
+
}
|
|
1001
|
+
}
|
|
1002
|
+
```
|
|
1003
|
+
|
|
1004
|
+
| Field | Meaning |
|
|
1005
|
+
| --- | --- |
|
|
1006
|
+
| `totals` | Sessions with at least one assistant usage record in range, those records (`messages`), their token counts, `totalTokens` (each record's own total, or the sum of its parts when it has none), and `cost` in the provider's currency units. Totals always cover the whole range, even when an array below is truncated. |
|
|
1007
|
+
| `byModel` | One row per model id, largest `tokens` first; `share` is the model's fraction of `totals.totalTokens`. At most 50 rows. |
|
|
1008
|
+
| `byDay` | Tokens per local calendar day (`YYYY-MM-DD`) with any usage, oldest first. At most 400 rows: the most recent days are kept. |
|
|
1009
|
+
| `byProject` | Present only for `scope: "all"`. One row per working directory, shown by its display name (the last path segment, never the path), largest `tokens` first. Two directories with the same last segment stay two rows. At most 50 rows. |
|
|
1010
|
+
| `truncated` | `true` for each array that had more rows than its bound. `byProject` appears only with `byProject`. |
|
|
1011
|
+
|
|
1012
|
+
Model ids and project names longer than 128 characters are cut. No session id, path, provider, prompt, or message text ever crosses the wire. The panel's other figures (streaks, most active day, longest session) are not part of this answer. When no sessions root can be read, or the stats owner is not loaded, the answer is `stats_unavailable` — never a fabricated zero.
|
|
1013
|
+
|
|
839
1014
|
### `apply_profile`
|
|
840
1015
|
|
|
841
1016
|
Applies one saved profile through the `/gentle:profiles` screen's own actions: `mode: "default"` runs **Make default for new sessions**, and `mode: "session"` runs **Use in this session**. There is no second apply implementation, so the diff confirmation, the pinned-repository rule, and the rollback are the screen's own.
|
|
@@ -902,6 +1077,307 @@ Otherwise the answer is the outcome, with the screen's notices as `notes` (`leve
|
|
|
902
1077
|
|
|
903
1078
|
Only one apply runs at a time in a Pi process, across sessions. A request that arrives while another apply is running answers `profile_apply_busy` and changes nothing. While an apply runs, `set_config` for `profiles`, `profile_fallbacks`, and `pins` also answers `profile_apply_busy` and writes nothing: the apply rewrites the profiles store (and restores it on failure) from the snapshot it read, so an edit accepted mid-apply would otherwise be lost. Retry after the apply answers. The `/gentle:profiles` screen's Use in this session and Make default (including the save they make first) take the same gate, so they never run alongside a Desktop apply and a Desktop apply answers `profile_apply_busy` while one of them runs.
|
|
904
1079
|
|
|
1080
|
+
### `list_sessions`
|
|
1081
|
+
|
|
1082
|
+
Lists saved Pi sessions through Pi's own session owner (`SessionManager.list` / `listAll`), newest first, so a client can offer a "resume session" list without reading Pi's session files or settings.
|
|
1083
|
+
|
|
1084
|
+
```json
|
|
1085
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-70", "method": "list_sessions", "params": { "scope": "project", "limit": 20 } }
|
|
1086
|
+
```
|
|
1087
|
+
|
|
1088
|
+
| Param | Required | Type | Meaning |
|
|
1089
|
+
| --- | --- | --- | --- |
|
|
1090
|
+
| `scope` | no | `"project"` or `"all"` | `project` (default) lists the active project's sessions; `all` lists every project's. |
|
|
1091
|
+
| `limit` | no | integer 1–50 | Page size; default 20. |
|
|
1092
|
+
| `cursor` | no | string | The opaque `nextCursor` of the previous page. |
|
|
1093
|
+
|
|
1094
|
+
Any other key, a non-integer or out-of-range `limit`, an unknown `scope`, or a cursor this slice did not issue is `invalid_request`, answered before any session is read. The session directory is resolved exactly as Pi's `/resume` resolves it, from the live session manager: `project` is `list(cwd, sessionDir)`, and `all` is `listAll()` for the default directory or `listAll(sessionDir)` for a custom `sessionDir` (settings, `--session-dir`, or `PI_CODING_AGENT_SESSION_DIR`). A read has no side effect and never emits an event.
|
|
1095
|
+
|
|
1096
|
+
Success:
|
|
1097
|
+
|
|
1098
|
+
```json
|
|
1099
|
+
{
|
|
1100
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1101
|
+
"kind": "response",
|
|
1102
|
+
"requestId": "desktop-70",
|
|
1103
|
+
"ok": true,
|
|
1104
|
+
"data": {
|
|
1105
|
+
"sessions": [
|
|
1106
|
+
{ "id": "0b5c9a12-7d4e-4f3a-9c1e-2a6b8d0f4e31", "name": "Release prep", "modified": 1793577600000, "messageCount": 14, "firstMessage": "Prepare the 1.4 release notes", "project": "gentle-shell", "current": true },
|
|
1107
|
+
{ "id": "5e21f0aa-3b7c-4d18-8f6e-91c2d4b7a053", "modified": 1793491200000, "messageCount": 3, "firstMessage": "Why does the build fail on Windows?", "project": "gentle-shell", "current": false }
|
|
1108
|
+
],
|
|
1109
|
+
"nextCursor": "WzE3OTM0OTEyMDAwMDAsIjVlMjFmMGFhIl0"
|
|
1110
|
+
}
|
|
1111
|
+
}
|
|
1112
|
+
```
|
|
1113
|
+
|
|
1114
|
+
| Field | Meaning |
|
|
1115
|
+
| --- | --- |
|
|
1116
|
+
| `id` | Pi's session id; pass it to `switch_session`. |
|
|
1117
|
+
| `name` | The name the user gave the session, present only when set; at most 200 characters. |
|
|
1118
|
+
| `modified` | Last activity (latest message time, else the session start), in milliseconds. |
|
|
1119
|
+
| `messageCount` | Messages in the session file, as Pi counts them. |
|
|
1120
|
+
| `firstMessage` | The first user message with whitespace collapsed, at most 200 characters; a cut ends with `…`. Pi reports `(no messages)` for an empty session. |
|
|
1121
|
+
| `project` | The display name of the session's project: the last segment of its working directory, or `unknown`. Never a path. |
|
|
1122
|
+
| `current` | `true` for the session this Pi process is running. |
|
|
1123
|
+
|
|
1124
|
+
No file path, working directory, parent-session path, or full message text ever crosses the wire. `nextCursor` is present only when more sessions follow; it is a keyset position (last time and id), so sessions saved between pages never shift or repeat entries. When no Desktop command has bound a session context, or the context has no session manager or session directory (an in-memory session), the answer is `sessions_unavailable`.
|
|
1125
|
+
|
|
1126
|
+
### `switch_session`
|
|
1127
|
+
|
|
1128
|
+
Switches this Pi process to a saved session by id. The id is resolved through Pi's owner (`SessionManager.findById`, plus the exact id in Pi's all-sessions listing for `scope: "all"`), and the switch is the command context's own `switchSession`. The session file path never crosses the wire, in either direction.
|
|
1129
|
+
|
|
1130
|
+
```json
|
|
1131
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-71", "method": "switch_session", "params": { "id": "5e21f0aa-3b7c-4d18-8f6e-91c2d4b7a053" } }
|
|
1132
|
+
```
|
|
1133
|
+
|
|
1134
|
+
| Param | Required | Type | Meaning |
|
|
1135
|
+
| --- | --- | --- | --- |
|
|
1136
|
+
| `id` | yes | non-empty string, at most 256 characters | A session id from `list_sessions`. |
|
|
1137
|
+
| `scope` | no | `"project"` or `"all"` | Where the id is resolved: `project` (default) or every project. Pass the scope the id was listed with. |
|
|
1138
|
+
|
|
1139
|
+
Any other key (including a Pi-style `sessionPath`), a missing or empty `id`, or an unknown `scope` is `invalid_request`. An id that does not resolve in the requested scope is `not_found`, and nothing is switched. When no Desktop command has bound a session context, or that context cannot switch, the answer is `sessions_unavailable`.
|
|
1140
|
+
|
|
1141
|
+
```json
|
|
1142
|
+
{
|
|
1143
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1144
|
+
"kind": "response",
|
|
1145
|
+
"requestId": "desktop-71",
|
|
1146
|
+
"ok": true,
|
|
1147
|
+
"data": { "id": "5e21f0aa-3b7c-4d18-8f6e-91c2d4b7a053", "changed": true }
|
|
1148
|
+
}
|
|
1149
|
+
```
|
|
1150
|
+
|
|
1151
|
+
- **Switching to the current session** is a no-op: `{ "id": …, "changed": false }`, no switch, no event.
|
|
1152
|
+
- **A cancelled switch** (an extension's `session_before_switch` handler cancelled it) answers `{ "id": …, "changed": false, "cancelled": true }`; the session is unchanged.
|
|
1153
|
+
- **A refused switch** (for example the session's working directory no longer exists) answers `sessions_unavailable` with a fixed message; Pi's error, which names paths, never crosses.
|
|
1154
|
+
- **The sequence resets.** A switch starts a new session, exactly like Pi's own `switch_session`: the old session receives `session_shutdown`, the new one starts with a fresh channel, and event `seq` starts again at 1. The response is published by the new session, after it started, still correlated by `requestId`; an event of the new session may precede it. Fetch `get_snapshot` after a switch.
|
|
1155
|
+
- **One switch at a time; nothing is lost.** From the moment a `switch_session` is dispatched until it answers, every other Desktop request (any method, including another `switch_session` and `capabilities`) is answered at once with the retryable `session_switching` error and does nothing. A request that was already waiting on an owner when the switch tears the session down is answered `session_switching` right before the teardown, and a request Pi delivers to the replaced session during the replacement is answered `session_switching` too. Every request gets exactly one response; only the switch itself answers from the new session. This includes `capabilities` and `get_snapshot`: they are refused too, because their answer would describe the session being replaced. Retry every refused request, including those two, after the switch's response arrives. A switch that ends without replacing the session (cancelled, refused, or `not_found`) releases the gate at once. Use a fresh `requestId` per request: the exemption for the in-flight switch is by `requestId`.
|
|
1156
|
+
- **A streaming turn is aborted.** Pi settles any active response before it replaces the session, so a switch during a streaming turn aborts that turn and persists it to the old session first, as Pi's own `switch_session` does.
|
|
1157
|
+
- This slice emits no event of its own.
|
|
1158
|
+
|
|
1159
|
+
### `get_changes`
|
|
1160
|
+
|
|
1161
|
+
Reads the session's uncommitted changes from the same owner `/gentle:changes` uses: the shell's `WorktreeChangesTracker` over the session's roots (its own repository and every worktree its subagents used), each against its `HEAD`, untracked files included. Params must be an empty object.
|
|
1162
|
+
|
|
1163
|
+
```json
|
|
1164
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-70", "method": "get_changes", "params": {} }
|
|
1165
|
+
```
|
|
1166
|
+
|
|
1167
|
+
Success:
|
|
1168
|
+
|
|
1169
|
+
```json
|
|
1170
|
+
{
|
|
1171
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1172
|
+
"kind": "response",
|
|
1173
|
+
"requestId": "desktop-70",
|
|
1174
|
+
"ok": true,
|
|
1175
|
+
"data": {
|
|
1176
|
+
"roots": [{ "id": "root-1", "label": "gentle-shell" }],
|
|
1177
|
+
"files": [
|
|
1178
|
+
{ "root": "root-1", "path": "lib/shell-changes.ts", "status": "modified", "added": 12, "deleted": 3 },
|
|
1179
|
+
{ "root": "root-1", "path": "notes.md", "status": "untracked", "added": 4, "deleted": 0 }
|
|
1180
|
+
],
|
|
1181
|
+
"truncated": false
|
|
1182
|
+
}
|
|
1183
|
+
}
|
|
1184
|
+
```
|
|
1185
|
+
|
|
1186
|
+
| Field | Meaning |
|
|
1187
|
+
| --- | --- |
|
|
1188
|
+
| `roots[].id` | An opaque, session-scoped root identifier (`root-1`, `root-2`, …). It names a root for `get_change_diff`; it is not a path. |
|
|
1189
|
+
| `roots[].label` | A display name: the root's directory name. Never an absolute path. Two roots can share a label; `id` tells them apart. |
|
|
1190
|
+
| `files[].root` | The `id` of the root the file belongs to. |
|
|
1191
|
+
| `files[].path` | The path relative to its root, exactly as Git reports it (`/` separators). |
|
|
1192
|
+
| `files[].status` | One of `modified`, `added`, `deleted`, `renamed`, or `untracked`. |
|
|
1193
|
+
| `files[].added`, `files[].deleted` | Line counts from `git diff --numstat HEAD`; an untracked file counts its own lines. |
|
|
1194
|
+
| `truncated` | `true` when more than 200 files changed across all roots; `files` then holds the first 200 (roots in owner order, paths sorted within each root). |
|
|
1195
|
+
|
|
1196
|
+
Only roots with changes are listed, so a clean session answers `roots: []` and `files: []`. A read refreshes the owner's scan the way opening the panel does; it starts, writes, or stages nothing and never emits an event. Any params key is `invalid_request`. `changes_unavailable` answers when the session has no root to scan or when Git failed for any root: a failed scan is never reported as a clean root.
|
|
1197
|
+
|
|
1198
|
+
### `get_change_diff`
|
|
1199
|
+
|
|
1200
|
+
Reads one changed file's unified diff, the same Git diff the `/gentle:changes` panel shows for it: a tracked file is `git diff HEAD -- <path>`, an untracked file is a diff against an empty file. Unlike the panel, it runs with `--no-textconv --no-ext-diff` and `-c core.fsmonitor=false`, so it never executes a command the repository's configuration names; for a file with a `.gitattributes` textconv driver or an external diff driver the text is Git's plain diff and can differ from the panel. Params are exactly `{ root, path }`, both strings.
|
|
1201
|
+
|
|
1202
|
+
```json
|
|
1203
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-71", "method": "get_change_diff", "params": { "root": "root-1", "path": "notes.md" } }
|
|
1204
|
+
```
|
|
1205
|
+
|
|
1206
|
+
Success:
|
|
1207
|
+
|
|
1208
|
+
```json
|
|
1209
|
+
{
|
|
1210
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1211
|
+
"kind": "response",
|
|
1212
|
+
"requestId": "desktop-71",
|
|
1213
|
+
"ok": true,
|
|
1214
|
+
"data": {
|
|
1215
|
+
"root": "root-1",
|
|
1216
|
+
"path": "notes.md",
|
|
1217
|
+
"diff": "diff --git a/notes.md b/notes.md\nnew file mode 100644\n--- /dev/null\n+++ b/notes.md\n@@ -0,0 +1,4 @@\n+…\n",
|
|
1218
|
+
"truncated": false
|
|
1219
|
+
}
|
|
1220
|
+
}
|
|
1221
|
+
```
|
|
1222
|
+
|
|
1223
|
+
`path` must be a file in the owner's current change set for that root, matched exactly against the owner's own file list (no normalization, no case folding). Anything else answers `not_found`: an unknown or stale root id, a root's absolute path or label in place of its id, a path outside the set (including a clean tracked file or `.git/config` that exists on disk), `..` traversal, an absolute path, a path whose directory resolves outside the root through a link (Git for Windows lists files behind a junction as part of the tree), or a path whose directory resolves inside the repository's git dir or common dir (for example a junction to `.git` inside the root). The method can never read an arbitrary file.
|
|
1224
|
+
|
|
1225
|
+
A diff is file content: it can contain whatever the user's files contain, secrets included, exactly as the panel would show them. Nothing beyond the diff text is added — no absolute path, no Git command. `diff` is capped at 256 KiB of UTF-8, cut after the last whole line inside the bound (or on a character boundary for one very long line), with `truncated: true`. A diff past the panel's own 1 MiB bound, where the panel shows a "too large" notice, still answers its first 256 KiB with `truncated: true`. An empty `diff` means Git reported no difference. Wrong param types or extra keys are `invalid_request`; Git failing or timing out is `changes_unavailable`. A read never emits an event.
|
|
1226
|
+
|
|
1227
|
+
### `get_review_mode`
|
|
1228
|
+
|
|
1229
|
+
Reads the receipt-driven development (RDD) switch for this session's workspace through the same native review CLI adapter `/gentle:review-mode` uses (`gentle-ai review mode status --json`). It has no side effects and emits no event.
|
|
1230
|
+
|
|
1231
|
+
```json
|
|
1232
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-70", "method": "get_review_mode", "params": {} }
|
|
1233
|
+
```
|
|
1234
|
+
|
|
1235
|
+
`params` must be empty; any key is `invalid_request`.
|
|
1236
|
+
|
|
1237
|
+
```json
|
|
1238
|
+
{
|
|
1239
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1240
|
+
"kind": "response",
|
|
1241
|
+
"requestId": "desktop-70",
|
|
1242
|
+
"ok": true,
|
|
1243
|
+
"data": {
|
|
1244
|
+
"effective": "disabled",
|
|
1245
|
+
"source": "global",
|
|
1246
|
+
"scopes": { "global": "disabled", "clone": "unset" }
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1249
|
+
```
|
|
1250
|
+
|
|
1251
|
+
| Field | Values | Meaning |
|
|
1252
|
+
| --- | --- | --- |
|
|
1253
|
+
| `effective` | `enabled`, `disabled`, `unknown` | Whether reviews run in this workspace. |
|
|
1254
|
+
| `source` | `default`, `global`, `clone`, `unknown` | Which setting decided `effective`: no setting (on by default), the machine-wide setting, or this repository's setting. |
|
|
1255
|
+
| `scopes.global`, `scopes.clone` | `enabled`, `disabled`, `unset`, `unknown` | The stored machine-wide and repository settings. |
|
|
1256
|
+
|
|
1257
|
+
A failed, timed-out, or unrecognized read answers `effective: "unknown"` with every other field `unknown`. It fails closed and never guesses. When `gentle-ai` is not installed or does not support the command, the answer is `review_unavailable` instead.
|
|
1258
|
+
|
|
1259
|
+
### `set_review_mode`
|
|
1260
|
+
|
|
1261
|
+
Changes the switch. Because the switch is the user's, a change takes two calls: the first answers a confirmation and writes nothing, and only a second call carrying that confirmation's token writes.
|
|
1262
|
+
|
|
1263
|
+
```json
|
|
1264
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-71", "method": "set_review_mode", "params": { "enabled": false, "scope": "global" } }
|
|
1265
|
+
```
|
|
1266
|
+
|
|
1267
|
+
| Param | Required | Type | Meaning |
|
|
1268
|
+
| --- | --- | --- | --- |
|
|
1269
|
+
| `enabled` | yes | boolean | `true` turns reviews on, `false` turns them off. |
|
|
1270
|
+
| `scope` | yes | `"clone"` or `"global"` | `clone` changes this repository's setting; `global` changes the machine-wide setting. |
|
|
1271
|
+
| `confirmationToken` | no | string, 1–128 characters | The `token` from a previous `confirmation_required` answer for the same `enabled` and `scope`. |
|
|
1272
|
+
|
|
1273
|
+
Any other key or a malformed value is `invalid_request`, rejected before the owner is reached. The first call answers the current mode and the dialog to show:
|
|
1274
|
+
|
|
1275
|
+
```json
|
|
1276
|
+
{
|
|
1277
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1278
|
+
"kind": "response",
|
|
1279
|
+
"requestId": "desktop-71",
|
|
1280
|
+
"ok": true,
|
|
1281
|
+
"data": {
|
|
1282
|
+
"status": "confirmation_required",
|
|
1283
|
+
"enabled": false,
|
|
1284
|
+
"scope": "global",
|
|
1285
|
+
"mode": { "effective": "enabled", "source": "default", "scopes": { "global": "unset", "clone": "unset" } },
|
|
1286
|
+
"confirmation": {
|
|
1287
|
+
"title": "Turn review mode off machine-wide?",
|
|
1288
|
+
"message": "Receipt-driven development is currently on (decided by the default). Reviews will be off for every repository on this machine.",
|
|
1289
|
+
"token": "9b2e…"
|
|
1290
|
+
}
|
|
1291
|
+
}
|
|
1292
|
+
}
|
|
1293
|
+
```
|
|
1294
|
+
|
|
1295
|
+
Desktop must show `title` and `message` to the human and resend with `confirmationToken` only after the human approves. Declining means not resending.
|
|
1296
|
+
|
|
1297
|
+
- **The token is bound to what was shown.** It is a sha256 over `enabled`, `scope`, the exact title and message, and the owner state they were computed from (both stored settings, the effective mode, its source, and the owner's revision when it reports one). A wrong token, or a stale one because the switch changed in between (in the TUI, in Herdr, or in another process), answers `confirmation_required` again with the current text and a fresh token, and writes nothing.
|
|
1298
|
+
- **The token is not authentication.** As with `apply_profile`, whoever can write Pi's RPC stdin can read and resend it; getting a human to confirm is Desktop's job.
|
|
1299
|
+
- **No confirmation without a known state.** When the current state cannot be read, the answer is `review_unavailable` and nothing is written.
|
|
1300
|
+
|
|
1301
|
+
With a matching token the owner writes the setting, re-reads the switch, and answers the re-read state:
|
|
1302
|
+
|
|
1303
|
+
```json
|
|
1304
|
+
{
|
|
1305
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1306
|
+
"kind": "response",
|
|
1307
|
+
"requestId": "desktop-72",
|
|
1308
|
+
"ok": true,
|
|
1309
|
+
"data": {
|
|
1310
|
+
"status": "applied",
|
|
1311
|
+
"enabled": false,
|
|
1312
|
+
"scope": "global",
|
|
1313
|
+
"changed": true,
|
|
1314
|
+
"mode": { "effective": "disabled", "source": "global", "scopes": { "global": "disabled", "clone": "unset" } }
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
```
|
|
1318
|
+
|
|
1319
|
+
The semantics are the owner's own. A machine-wide off wins over a repository setting, so `enabled: true` with `scope: "clone"` only clears this repository's off setting and cannot override a machine-wide off: it answers `applied` with `effective: "disabled"` and `source: "global"`, and its confirmation message says so before anything is written. `changed` is `true` only when the re-read state differs from the state the confirmation was computed from, in `effective`, `source`, or either scope. A no-op answers `changed: false`. When the re-read itself fails, `mode` is the fail-closed unknown shape and `changed` is `false`. A write whose outcome is unknown (it failed or timed out after starting) answers `review_unavailable` and is never retried; re-read with `get_review_mode`.
|
|
1320
|
+
|
|
1321
|
+
Only one `set_review_mode` runs at a time in a Pi process. A request that arrives while another is running answers `review_mode_busy` and changes nothing. `get_review_mode` is never blocked.
|
|
1322
|
+
|
|
1323
|
+
### `get_update_status`
|
|
1324
|
+
|
|
1325
|
+
Reports whether Gentle Shell, Pi, and Pi's packages have updates, from the sources that already own those answers: Gentle Shell's own channel and version resolution, the release lookup `gentle-shell upgrade` uses, and Pi's own package update check (the one behind its "Package updates are available" notice). The only param is an optional `refresh`.
|
|
1326
|
+
|
|
1327
|
+
```json
|
|
1328
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-71", "method": "get_update_status", "params": { "refresh": true } }
|
|
1329
|
+
```
|
|
1330
|
+
|
|
1331
|
+
| Param | Required | Values | Meaning |
|
|
1332
|
+
| --- | --- | --- | --- |
|
|
1333
|
+
| `refresh` | no | `false` (default), `true` | `false` answers from what is already known and does no network work: the launcher's recorded release lookup (`startupReleaseCheck` in the launcher config) and the result of an earlier refresh in this Pi process. `true` runs the lookups once, all bounded by one 15-second deadline; concurrent refreshes share one run. |
|
|
1334
|
+
|
|
1335
|
+
Any other key, or a non-boolean `refresh` (including `null`), is rejected as `invalid_request` before anything is read. A read has no side effect: a refresh result lives only in this process's memory, nothing is written (not even the launcher's cache), and no event is emitted.
|
|
1336
|
+
|
|
1337
|
+
Success:
|
|
1338
|
+
|
|
1339
|
+
```json
|
|
1340
|
+
{
|
|
1341
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1342
|
+
"kind": "response",
|
|
1343
|
+
"requestId": "desktop-71",
|
|
1344
|
+
"ok": true,
|
|
1345
|
+
"data": {
|
|
1346
|
+
"refreshed": true,
|
|
1347
|
+
"offline": false,
|
|
1348
|
+
"gentleShell": { "current": "4.8.0", "latest": "4.9.0", "channel": "release", "state": "update_available", "command": "gentle-shell upgrade", "checkedAt": "2026-11-17T12:00:00.000Z" },
|
|
1349
|
+
"pi": { "current": "1.5.2", "latest": null, "state": "unknown", "command": "gentle-shell update", "checkedAt": null },
|
|
1350
|
+
"packages": {
|
|
1351
|
+
"available": true,
|
|
1352
|
+
"items": [
|
|
1353
|
+
{ "name": "pi-web-access", "kind": "npm", "scope": "user", "current": "1.4.0", "latest": null, "pinned": false, "state": "update_available" },
|
|
1354
|
+
{ "name": "github.com/user/repo", "kind": "git", "scope": "project", "current": null, "latest": null, "pinned": true, "state": "skipped" }
|
|
1355
|
+
],
|
|
1356
|
+
"truncated": false,
|
|
1357
|
+
"command": "gentle-shell update --extensions",
|
|
1358
|
+
"checkedAt": "2026-11-17T12:00:00.000Z"
|
|
1359
|
+
}
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
```
|
|
1363
|
+
|
|
1364
|
+
| Field | Meaning |
|
|
1365
|
+
| --- | --- |
|
|
1366
|
+
| `refreshed` | `true` only when this answer ran the lookups (`refresh: true` and not offline). |
|
|
1367
|
+
| `offline` | `PI_OFFLINE` is set (any value). Then nothing is looked up, even with `refresh: true`, and every looked-up item of a refresh answers `unknown`. A plain read still shows earlier answers with their `checkedAt`. |
|
|
1368
|
+
| `gentleShell.channel` | `bundled` (a bundled prefix install), `gentle-ai-managed` (gentle-pi loaded as the `npm:gentle-pi` Pi package, the way the Gentle AI managed stack declares it), `main` or `release` (the channel record `gentle-shell upgrade` keeps; no record means `release`), or `unknown` when that record cannot be read. |
|
|
1369
|
+
| `gentleShell.latest` | The latest stable `gentle-pi` release; for `main`, the first 12 characters of the latest `main` commit. `null` when unknown. |
|
|
1370
|
+
| `gentleShell.command`, `pi.command`, `packages.command` | Fixed text for that kind of install: `gentle-shell upgrade` (`release`, `bundled`), `gentle-shell upgrade --channel main` (`main`), `gentle-shell update --extensions` (`gentle-ai-managed`, and packages), and `gentle-shell update` (Pi). `null` for an `unknown` channel. Never built from user input. |
|
|
1371
|
+
| `state` (Gentle Shell, Pi) | `update_available` when the latest version is newer (the launcher's own stable-version comparison; for `main`, the running version does not carry the latest commit), `up_to_date` only when a successful lookup returned exactly the running version, otherwise `unknown`: never looked up, offline, failed, timed out, or not comparable (a prerelease or a newer local build). |
|
|
1372
|
+
| `pi.latest` | Only a bundled install can name the latest Pi (its own `publishedPi` lookup). Elsewhere the latest Pi is resolved only through the package manager that owns it while `gentle-shell update` runs, so it stays `null` and `unknown`. |
|
|
1373
|
+
| `packages.items` | One row per configured Pi package (Pi's own listing), in Pi's order, at most 100. `name` is Pi's display name (npm name or `host/path`) or a local package's last path segment; `current` is an installed npm package's version. |
|
|
1374
|
+
| `packages.items[].state` | `update_available` when Pi's check reports a newer version; `no_update_reported` when it did not (Pi's check treats a failed lookup like "no update", so this is never claimed as up to date); `skipped` for a package Pi never checks (pinned, local, or not installed); `unknown` when not checked yet, offline, the check failed or timed out, or Pi's parser could not classify the source. |
|
|
1375
|
+
| `packages.items[].latest` | Pi's check reports only that a newer version exists, not which one: always `null`. |
|
|
1376
|
+
| `packages.available` | `false` when Pi's package listing could not be read; `items` is then empty. |
|
|
1377
|
+
| `checkedAt` | When the answer shown was looked up (ISO 8601), per item: a refresh's time, or the launcher's recorded lookup time. `null` when no lookup backs the answer. |
|
|
1378
|
+
|
|
1379
|
+
No absolute path, raw package source, registry URL, token, command line, or lookup output crosses the wire. A failed lookup is reported as `unknown`, never by its message. Running an update is out of scope: the client shows the command, and the launcher runs it. `updates_unavailable` answers only when the session is not bound or was replaced during the read, or a source fails unexpectedly.
|
|
1380
|
+
|
|
905
1381
|
## Responses
|
|
906
1382
|
|
|
907
1383
|
Success:
|
|
@@ -931,7 +1407,7 @@ Failure:
|
|
|
931
1407
|
}
|
|
932
1408
|
```
|
|
933
1409
|
|
|
934
|
-
Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invalid_data`, `revision_conflict`, `write_failed`, `unsupported_method`, `permission_unavailable`, `permission_denied`, `config_unavailable`, `usage_unavailable`, `design_unavailable`, `jobs_unavailable`, `agents_unavailable`, `profiles_unavailable`, `unknown_profile`, `profile_apply_busy`, `not_found`, and `internal_error`. A request that cannot supply a valid correlation ID uses `requestId: null`. State/provider failures use the generic `internal_error` message rather than exposing raw paths, credentials, or provider errors. Transport failures from `setWidget` are never retried as a second response.
|
|
1410
|
+
Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invalid_data`, `revision_conflict`, `write_failed`, `unsupported_method`, `permission_unavailable`, `permission_denied`, `config_unavailable`, `usage_unavailable`, `design_unavailable`, `jobs_unavailable`, `agents_unavailable`, `profiles_unavailable`, `unknown_profile`, `profile_apply_busy`, `sessions_unavailable`, `session_switching`, `review_unavailable`, `review_mode_busy`, `stats_unavailable`, `not_found`, and `internal_error`. A request that cannot supply a valid correlation ID uses `requestId: null`. State/provider failures use the generic `internal_error` message rather than exposing raw paths, credentials, or provider errors. Transport failures from `setWidget` are never retried as a second response.
|
|
935
1411
|
|
|
936
1412
|
| Code | Meaning |
|
|
937
1413
|
| --- | --- |
|
|
@@ -949,10 +1425,16 @@ Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invali
|
|
|
949
1425
|
| `design_unavailable` | The design canvas owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
950
1426
|
| `jobs_unavailable` | The background-jobs owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
951
1427
|
| `agents_unavailable` | The subagents owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
1428
|
+
| `changes_unavailable` | The changes owner did not answer for this session (the owning extension is not loaded, or the session changed), the session has no root to scan, or Git failed or timed out. Nothing was changed. |
|
|
952
1429
|
| `profiles_unavailable` | The profiles owner did not answer for this session (the owning extension is not loaded, the session changed, or no Desktop command bound a session context). Nothing was written. |
|
|
953
1430
|
| `unknown_profile` | `apply_profile` named a profile that is not saved in `profiles.json`. No routing, settings, agents, or pins were written (a missing `profiles.json` may have been seeded). |
|
|
954
1431
|
| `profile_apply_busy` | An `apply_profile` is still running; returned to a second `apply_profile` and to `set_config` for `profiles`, `profile_fallbacks`, or `pins`. Nothing was written by this request. |
|
|
955
|
-
| `
|
|
1432
|
+
| `sessions_unavailable` | No Desktop command bound a session context, the context has no session manager, session directory, or `switchSession`, the installed Pi lacks the session owner calls, reading sessions failed, or Pi refused the switch. Nothing was switched. |
|
|
1433
|
+
| `session_switching` | A `switch_session` was in flight when this request arrived (or the switch tore the session down while this request waited on an owner). Nothing was done; retry after the switch answers. |
|
|
1434
|
+
| `review_unavailable` | The review-mode owner did not answer for this session (extension not loaded, subagent child, or no Desktop command bound a session context), `gentle-ai` is not installed or does not support `review mode`, `set_review_mode` could not read the current state, or a write's outcome is unknown. The message says which; it never carries a path, CLI output, or a command line. |
|
|
1435
|
+
| `review_mode_busy` | A `set_review_mode` is still running. Nothing was written by this request. |
|
|
1436
|
+
| `stats_unavailable` | No sessions root could be read, or the stats owner did not answer for this session (the owning extension is not loaded, or the session changed). Nothing was read. |
|
|
1437
|
+
| `not_found` | `cancel_job` or `get_job_output` named a job id, or `cancel_subagent` or `get_subagent_thread` named a subagent id, that does not exist, belongs to another session, or was already evicted by the store; or `switch_session` named an id that does not resolve in the requested scope; or `get_change_diff` named a root and path that are not a file in the owner's current change set. Nothing was stopped, read, or switched. |
|
|
956
1438
|
| `internal_error` | Unexpected failure; message stays generic. |
|
|
957
1439
|
|
|
958
1440
|
## Events
|
|
@@ -969,11 +1451,16 @@ Domain events use the same widget channel:
|
|
|
969
1451
|
}
|
|
970
1452
|
```
|
|
971
1453
|
|
|
972
|
-
The event name above is illustrative; `capabilities` is authoritative for implemented events. `seq` starts at 1 after successful delivery in each newly started session and resets on session shutdown or
|
|
1454
|
+
The event name above is illustrative; `capabilities` is authoritative for implemented events. `seq` starts at 1 after successful delivery in each newly started session and resets on session shutdown, reload, or a session switch (Pi's own `switch_session` or this channel's). After shutdown the channel does not answer further commands. Clients should fetch `get_snapshot` after connecting and whenever they detect a sequence gap. Responses do not increment the event sequence.
|
|
973
1455
|
|
|
974
1456
|
### `permission_mode_changed`
|
|
975
1457
|
|
|
976
|
-
Emitted
|
|
1458
|
+
Emitted in two ways:
|
|
1459
|
+
|
|
1460
|
+
- **`source: "desktop"`**: at most once per successful `set_permission_mode`, always after its response line, and never for rejected, unavailable, or no-op requests.
|
|
1461
|
+
- **`source: "external"`**: asynchronously, when the session mode or the persisted default changes outside Desktop RPC (for example `/gentle:mode`, `/gentle:mode default`, or `/gentle:yolo`).
|
|
1462
|
+
|
|
1463
|
+
A Desktop change:
|
|
977
1464
|
|
|
978
1465
|
```json
|
|
979
1466
|
{
|
|
@@ -991,11 +1478,44 @@ Emitted at most once per successful `set_permission_mode`, always after its resp
|
|
|
991
1478
|
}
|
|
992
1479
|
```
|
|
993
1480
|
|
|
994
|
-
`source
|
|
1481
|
+
For `source: "desktop"`, `persisted` reports whether that request saved the default. If the owner cannot confirm the state right after a `set_permission_mode` (the session was replaced or revoked meanwhile), the answer is `permission_unavailable` with no event, never an echo of the requested mode.
|
|
1482
|
+
|
|
1483
|
+
An external change:
|
|
1484
|
+
|
|
1485
|
+
```json
|
|
1486
|
+
{
|
|
1487
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1488
|
+
"kind": "event",
|
|
1489
|
+
"seq": 2,
|
|
1490
|
+
"event": "permission_mode_changed",
|
|
1491
|
+
"data": {
|
|
1492
|
+
"mode": "yolo",
|
|
1493
|
+
"previous_mode": "normal",
|
|
1494
|
+
"default_mode": "normal",
|
|
1495
|
+
"persisted": false,
|
|
1496
|
+
"source": "external"
|
|
1497
|
+
}
|
|
1498
|
+
}
|
|
1499
|
+
```
|
|
1500
|
+
|
|
1501
|
+
External changes are driven by the permission owner's existing in-process observer (the one the desktop feed uses); there is no polling and no file watcher. Every owner notification restarts a debounce window of about 250 ms; when it closes, the channel re-reads the owner and emits only when `mode` or `default_mode` differs from the last state this channel reported (a `get_permission_mode` answer, a `set_permission_mode` answer, or an earlier event). `previous_mode` is the mode of that last reported state, and `persisted` is `true` when the persisted default is what changed. Consequences:
|
|
1502
|
+
|
|
1503
|
+
- a Desktop `set_permission_mode` is never echoed as an external event: its response records the confirmed state first, and an observer window that closes while a Desktop request is still applying waits for it;
|
|
1504
|
+
- a burst inside one window is one event with the final state, and a change undone inside the window emits nothing;
|
|
1505
|
+
- owner-side changes surface the same way, for example the owner revoking YOLO when the workspace or interactive host changes;
|
|
1506
|
+
- a default written to the policy file by another process does not notify this process's owner, so it becomes visible on the next `get_permission_mode` and emits nothing;
|
|
1507
|
+
- without the permission owner (extension not loaded), there are no external events and the methods answer `permission_unavailable`.
|
|
1508
|
+
|
|
1509
|
+
Observation starts on `session_start` for an interactive RPC host only, and stops on session shutdown and on session switch. Re-read with `get_permission_mode` after reconnecting or switching sessions.
|
|
995
1510
|
|
|
996
1511
|
### `config_changed`
|
|
997
1512
|
|
|
998
|
-
Emitted
|
|
1513
|
+
Emitted in two ways:
|
|
1514
|
+
|
|
1515
|
+
- **`source: "desktop"`**: at most once per successful `set_config` that actually changed its target, always after its response line, and never for rejected, unavailable, conflicted, or no-op requests.
|
|
1516
|
+
- **`source: "external"`**: asynchronously and best effort, when a store's revision changes outside Desktop RPC (`/gentle:profiles`, an editor saving `profiles.json`, the installer, or another `pi` process).
|
|
1517
|
+
|
|
1518
|
+
A Desktop write:
|
|
999
1519
|
|
|
1000
1520
|
```json
|
|
1001
1521
|
{
|
|
@@ -1014,7 +1534,41 @@ Emitted at most once per successful `set_config` that actually changed its targe
|
|
|
1014
1534
|
}
|
|
1015
1535
|
```
|
|
1016
1536
|
|
|
1017
|
-
`store`, `scope`, `revision`, and `writeRevision` are the resulting values, identical to the response that precedes the event, so a client that missed the response can reconcile from the event alone.
|
|
1537
|
+
For `source: "desktop"`, `store`, `scope`, `revision`, and `writeRevision` are the resulting values, identical to the response that precedes the event, so a client that missed the response can reconcile from the event alone.
|
|
1538
|
+
|
|
1539
|
+
An external change:
|
|
1540
|
+
|
|
1541
|
+
```json
|
|
1542
|
+
{
|
|
1543
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1544
|
+
"kind": "event",
|
|
1545
|
+
"seq": 3,
|
|
1546
|
+
"event": "config_changed",
|
|
1547
|
+
"data": {
|
|
1548
|
+
"store": "profiles",
|
|
1549
|
+
"scope": "global",
|
|
1550
|
+
"revision": "sha256:5f1d0c7a9e2b4d6f8a0c2e4b6d8f0a1c",
|
|
1551
|
+
"status": "ok",
|
|
1552
|
+
"source": "external"
|
|
1553
|
+
}
|
|
1554
|
+
}
|
|
1555
|
+
```
|
|
1556
|
+
|
|
1557
|
+
`store`, `scope`, `revision`, and `status` match what `get_config` and `get_snapshot` would answer for that store at that moment. There is no `value`, no `writeTarget` or `writeRevision` (an external writer may have touched any layer), and no path; read the store with `get_config` for its content and write targets.
|
|
1558
|
+
|
|
1559
|
+
Detection watches the owner files' directories, non-recursively, for an interactive RPC host only: the config home (`profiles.json`, `profile-fallbacks.json`, `models.json`), the agent home and its `gentle-ai/` directory (global `subagents.json`, the managed-assets manifest), the session cwd's `.pi/` and `.pi/gentle-ai/` (project `subagents.json` and `models.json`, the `repo` pin), and the Git common dir's `gentle-ai/` (the `local` pin) when the cwd is a resolvable worktree. Only events for those owner file names count. About 250 ms after the last relevant event, every store's revision is recomputed with the same readers `get_config` uses, and an event is emitted only for a store whose revision differs from the last revision this channel reported (a `get_config` answer, a `get_snapshot` projection, a `set_config` answer, or an earlier event). Consequences:
|
|
1560
|
+
|
|
1561
|
+
- a Desktop `set_config` is never echoed: its response records the resulting revision before the owner's own rename wakes the watcher;
|
|
1562
|
+
- reformatting a file, rewriting identical content, or undoing a change inside the window emits nothing, because the revision did not move;
|
|
1563
|
+
- a burst inside one window yields at most one event per changed store, and `pins` moves too when a `profiles` change makes a pin stale or valid.
|
|
1564
|
+
|
|
1565
|
+
`source` says whether the event answers a Desktop write **to that same store**. A Desktop write can change another store's derived state: for example a `set_config` on `profiles` that drops the profile a pin names makes `pins` stale. The `profiles` change is the `source: "desktop"` event that follows the response; the `pins` change arrives later through the watcher, exactly once, as `source: "external"`.
|
|
1566
|
+
|
|
1567
|
+
A directory that does not exist yet (for example a project without `.pi/`, or a fresh `<git-common-dir>/gentle-ai/`) is watched through its nearest existing ancestor, non-recursively and only for the creation of the next path segment. When that segment appears the ancestor watcher is closed and the next level is watched, until the owner directory itself is; each step recomputes once, so a pin that `/gentle:profiles` writes into a new directory raises exactly one event. A watched directory that is later removed reports its stores (now `missing`) and falls back to the same ancestor watching, so recreating it and writing the store again raises one event.
|
|
1568
|
+
|
|
1569
|
+
When a Desktop command binds a different session cwd, the watchers move with it, and the stores whose layers depend on the cwd (`models` and `subagents` project layers, and `pins`) are re-read at that moment: each one whose revision differs from the last one this channel reported is announced with `source: "external"` and becomes the new baseline, so a later unrelated change never carries stale extra events. If a change was detected but its debounce window had not closed when the cwd moved, every store is re-read instead, so that change is reported rather than dropped with the old watchers.
|
|
1570
|
+
|
|
1571
|
+
This is **best effort**, and `get_snapshot` revisions stay the source of truth. A path with no existing ancestor, an unsupported platform, or an exhausted watcher limit simply produces no external events for that directory; the channel keeps working and never reports an error for it. Watchers are created on `session_start` and are disposed, ancestor watchers included, on session shutdown and on session switch. A client that must not miss a change still compares `get_snapshot` revisions after connecting and after a sequence gap.
|
|
1018
1572
|
|
|
1019
1573
|
### `rate_limit`
|
|
1020
1574
|
|
|
@@ -1136,6 +1690,41 @@ Follows an `apply_profile` answer whose `status` is `applied`, after the respons
|
|
|
1136
1690
|
|
|
1137
1691
|
`source` is always `desktop`: an apply from the `/gentle:profiles` screen emits nothing on this channel. `confirmation_required`, `not_applied`, and every error emit nothing. Clients that show profile state should re-read `get_config` for `profiles` after this event.
|
|
1138
1692
|
|
|
1693
|
+
### `session_snapshot`
|
|
1694
|
+
|
|
1695
|
+
Carries the session sections whose content changed since the last `session_snapshot` (or since the bridge subscribed at session start), in the same path-free shapes as `get_snapshot`'s `state.session`:
|
|
1696
|
+
|
|
1697
|
+
```json
|
|
1698
|
+
{
|
|
1699
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1700
|
+
"kind": "event",
|
|
1701
|
+
"seq": 5,
|
|
1702
|
+
"event": "session_snapshot",
|
|
1703
|
+
"data": { "sections": { "pendingQuestion": { "kind": "prompt", "question": "Pick one", "terminalOnly": true, "…": "…" } } }
|
|
1704
|
+
}
|
|
1705
|
+
```
|
|
1706
|
+
|
|
1707
|
+
It is emitted when the feed publishes, on the feed's own tiers: within 16 ms for urgent state (an open or answered question, the permission mode, an idle/working/blocked transition, a held prompt), otherwise after a 250 ms debounce, and at most once per second while the session is busy. A flush that changes nothing emits nothing, and a section is included only when its content changed; a job's `elapsedMs`, which moves on every flush, is not a change (derive it from `startedAt`). A client that needs the whole state reads `get_snapshot` with `sections` after connecting or after a sequence gap. Advertised only while the feed seam is wired.
|
|
1708
|
+
|
|
1709
|
+
### `review_mode_changed`
|
|
1710
|
+
|
|
1711
|
+
Follows a confirmed `set_review_mode` whose re-read state differs from the state the confirmation was computed from, after the response line.
|
|
1712
|
+
|
|
1713
|
+
```json
|
|
1714
|
+
{
|
|
1715
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1716
|
+
"kind": "event",
|
|
1717
|
+
"seq": 4,
|
|
1718
|
+
"event": "review_mode_changed",
|
|
1719
|
+
"data": {
|
|
1720
|
+
"mode": { "effective": "disabled", "source": "global", "scopes": { "global": "disabled", "clone": "unset" } },
|
|
1721
|
+
"previousMode": { "effective": "enabled", "source": "default", "scopes": { "global": "unset", "clone": "unset" } }
|
|
1722
|
+
}
|
|
1723
|
+
}
|
|
1724
|
+
```
|
|
1725
|
+
|
|
1726
|
+
`mode` is identical to the response's `mode`. `confirmation_required`, a no-op (`changed: false`), an unreadable re-read, and every error emit nothing. A change made in the TUI, in Herdr, or by another process emits nothing on this channel; re-read with `get_review_mode`.
|
|
1727
|
+
|
|
1139
1728
|
## Configuration limits
|
|
1140
1729
|
|
|
1141
1730
|
- **One reader and one writer per store.** Each `get_config` answer and each `set_config` write comes from the module that already owns that file (`agent-profiles.ts`, `model-routing-authority.ts`, `model-fallback-store.ts`, `agents-config.ts`, `agent-profile-pin.ts`, `agent-assets.ts`). There is no second store, no cached copy, no parallel parser, no shadow precedence, and no re-implemented invariant: the merge rules are the owner's own (`readSavedModelConfig`, `parseAgentsConfig`, `evaluateProfilePin`) and the writes are the owner's validated atomic writers (`writeProfilesFileSync`, `writeFallbacksFile`, `writeProfilePinSync`).
|
|
@@ -1145,15 +1734,15 @@ Follows an `apply_profile` answer whose `status` is `applied`, after the respons
|
|
|
1145
1734
|
- **Per-process guard, not a transaction.** The `expectedRevision` check and the owner's atomic rename happen in one synchronous step, so concurrent Desktop requests in one process cannot both commit from the same revision. Across processes there is no lock: another `pi` process, `/gentle:profiles`, or the installer can write between the check and the rename, and this contract cannot detect that. Treat `expectedRevision` as conflict detection, not as mutual exclusion.
|
|
1146
1735
|
- **No paths, no secrets.** Physical paths are rejected as request input and never appear in a response, an event, or an error message. Content is limited to what these stores hold: profile names, routing entries, fallback chains, pin names, layer statuses, and asset ownership keys and hashes. `managed_assets` is additionally filtered to ownership-shaped entries — a relative asset path below the agent home plus a 64-hex sha256 digest — so an absolute path, a traversal segment, or an arbitrary string in the manifest is omitted rather than echoed. No credential, token, auth file, provider error, or conversation content is read or returned.
|
|
1147
1736
|
- **Truthful normalization.** Content is what the owner's normalizer produced. Entries an owner drops (an unsafe agent key, an unknown thinking level, a stale `active` marker) are absent from `value`; if everything was dropped, the store reads `ok` with an empty map rather than being reported as `invalid`. A file the owner cannot parse at all reads `invalid`. A **write** may not rely on that leniency: data the normalizer would drop is rejected as `invalid_data`, so a Desktop write can never delete content it does not understand.
|
|
1148
|
-
- **
|
|
1149
|
-
- **This slice does not implement** permission changes beyond the existing slice, subscription usage beyond the read/refresh contract below, subagents beyond the list/cancel contract below, music, profile application, store materialization, or any Gentle Desktop client change.
|
|
1737
|
+
- **Best-effort external events.** A change made by another `pi` process, by `/gentle:profiles`, by an editor, or by the installer produces a debounced `config_changed` with `source: "external"` when the owner directory can be watched and the store's revision really moved (see [`config_changed`](#config_changed)). When a watcher cannot be created, nothing is pushed for that directory and the change becomes visible on the next read. There is no polling and no cached copy: the watcher only decides when to recompute revisions with the owner readers.
|
|
1738
|
+
- **This slice does not implement** permission changes beyond the existing slice, subscription usage beyond the read/refresh contract below, subagents beyond the list/cancel/thread-read contract below, music, profile application, store materialization, or any Gentle Desktop client change.
|
|
1150
1739
|
|
|
1151
1740
|
## Permission limits
|
|
1152
1741
|
|
|
1153
1742
|
- The methods delegate to the Gentle AI extension's permission owner in the same Pi process. When that extension is not loaded, both methods answer `permission_unavailable` instead of guessing state.
|
|
1154
1743
|
- Session changes require the owner's interactive-host admission: the TUI, or an RPC process with `GENTLE_SHELL_INTERACTIVE_HOST=1`. Headless RPC children and subagent children stay closed exactly as before.
|
|
1155
1744
|
- Permission control is never an agent-callable tool; only `/gentle:desktop` over the interactive RPC channel reaches it.
|
|
1156
|
-
-
|
|
1745
|
+
- Permission state adds no filesystem watcher and no second store: external `permission_mode_changed` events follow the owner's in-process observer. Config is limited to the `get_config` and `set_config` contract in [Configuration limits](#configuration-limits); subscription usage is limited to the `get_subscription_usage` and `refresh_subscription_usage` contract in [Usage limits](#usage-limits); background jobs are limited to the `list_jobs`, `cancel_job`, and `get_job_output` contract in [Jobs limits](#jobs-limits); subagents are limited to the `list_subagents`, `cancel_subagent`, and `get_subagent_thread` contract in [Subagents limits](#subagents-limits); changed files are limited to the `get_changes` and `get_change_diff` contract in [Changes limits](#changes-limits); cross-session usage is limited to the `get_usage_stats` read in [Stats limits](#stats-limits); update status is limited to the `get_update_status` read in [Updates limits](#updates-limits); music and any Desktop client change are not implemented.
|
|
1157
1746
|
- Requests are not queued. Pi's own RPC loop dispatches prompts concurrently, so overlapping `set_permission_mode` calls reach the owner in whatever order their own reads finish, and one can apply right after the other. What stays guaranteed: every request gets exactly one correlated response, responses never cross, and each response and its optional event are published as an adjacent pair with a monotonic `seq`. Send permission requests one at a time and correlate with `requestId`; the maintainer probe does exactly that.
|
|
1158
1747
|
|
|
1159
1748
|
### Trust boundary
|
|
@@ -1183,24 +1772,30 @@ Follows an `apply_profile` answer whose `status` is `applied`, after the respons
|
|
|
1183
1772
|
|
|
1184
1773
|
## Jobs limits
|
|
1185
1774
|
|
|
1186
|
-
- **One owner, no second registry or process manager.** `list_jobs`, `cancel_job`, and the `jobs_update` event reach the existing jobs owner — the single parent-session `JobRegistry` plus the parent `MonitorController` — through a defensive, versioned owner-service adapter, the jobs analogue of the usage and design seams. There is no second registry, no second process manager, no subagent cancellation, and no cached copy.
|
|
1187
|
-
- **List
|
|
1775
|
+
- **One owner, no second registry or process manager.** `list_jobs`, `cancel_job`, `get_job_output`, and the `jobs_update` event reach the existing jobs owner — the single parent-session `JobRegistry` plus the parent `MonitorController` — through a defensive, versioned owner-service adapter, the jobs analogue of the usage and design seams. There is no second registry, no second process manager, no subagent cancellation, and no cached copy.
|
|
1776
|
+
- **List, cancel, and output read only.** This slice has exactly three methods, `list_jobs`, `cancel_job`, and `get_job_output`, and one event, `jobs_update`. It does not start jobs: `bash_background` and `monitor` stay agent tools, and there is no run/start method on this channel. `cancel_job` is `job_stop`'s exact stop path — the monitor controller's `cancel` (dropping timers and pending lines) followed by the registry's `stop` (aborting the process tree) — not a second stop implementation.
|
|
1188
1777
|
- **Safe projection only.** The wire carries exactly `id`, `label`, `status`, `startedAt`, `endedAt?`, and `exitCode?`. No command text, working directory, output path or tail, environment, owner session id, monitor counters, or error string is ever returned or logged. A foreign field on an owner entry is dropped by the projection, never echoed.
|
|
1189
1778
|
- **Bounded list.** `list_jobs` returns running jobs first (newest start first), then recently-finished jobs (newest end first) within a 60-second linger, capped at 50 entries. Finished jobs older than the linger drop out, so the answer can never grow with the process lifetime. That expiry is time-based and emits no `jobs_update`; a client that shows finished jobs should age them out with the same 60-second linger or re-read `list_jobs`.
|
|
1190
1779
|
- **No-op and failure mean no event.** A `cancel_job` on an already-terminal job answers that terminal state with no event, and a `cancel_job` on an unknown or foreign id answers `not_found` with no event. A `job_stop` that finds the job already terminal likewise changes nothing and emits nothing. Only an actual registry change (start, settle, or a running→stopped transition) emits `jobs_update`.
|
|
1191
1780
|
- **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a job started or stopped by the agent (or any other path through the owner) still arrives as a `jobs_update` event. Every actual registry change funnels through the owner's single `refreshJobStatus` path, including a monitor's self-timeout/flood stop, so no stop path can bypass the notification. The bridge dedupes byte-identical projected lists, so a stop that also flushes pending lines still emits exactly once. Session replacement or shutdown disconnects the observer and drops late outcomes, and the router's own publisher guard drops superseded events. A changed `cancel_job`'s response always precedes its event.
|
|
1192
|
-
- **
|
|
1781
|
+
- **Bounded, plain, owner-verified output.** `get_job_output` returns only the owner's existing in-memory tail (at most 20 lines of at most 2 000 characters), never the job's log file, with terminal control sequences stripped and a `truncated` flag. It applies the same ownership rule as `list_jobs`. The tail is the job's own unsanitized process output and can contain anything the job printed, including secrets; the method does not, and cannot, redact it. It is a read with no event; there is no `job_output` event, so a live tail is polled.
|
|
1782
|
+
- **Output outlives the list entry.** A finished job leaves `list_jobs` after the 60-second linger, but `get_job_output` keeps answering for it, for the same session, as long as the owner registry still holds it — exactly like `cancel_job`. A client must not treat a missing list entry as proof that the output is gone.
|
|
1783
|
+
- **A cut can leave escape-parameter text.** The owner shortens a line longer than 2 000 characters to its newest characters before this method sees it. When that cut lands inside an escape sequence, the ESC byte is gone, so a fragment of the sequence's parameters (for example `5;196m`) can remain as visible text after the leading `…`. This is a known cosmetic limit of the owner cut; the answer still never carries an ESC byte or any control character other than tab.
|
|
1784
|
+
- **Truthful absence.** When the owning extension is not loaded, `list_jobs`, `cancel_job`, and `get_job_output` answer `jobs_unavailable` rather than inventing an empty list, a fake stop, or an empty tail. A job that exists but belongs to another session is indistinguishable from an unknown id at this boundary: both answer `not_found`.
|
|
1193
1785
|
|
|
1194
1786
|
## Subagents limits
|
|
1195
1787
|
|
|
1196
1788
|
- **One owner, no second store or runner.** `list_subagents`, `cancel_subagent`, and the `agents_update` event reach the existing agents owner — the single parent-session `TaskStore` plus the parent `AgentRunner` — through a defensive, versioned owner-service adapter, the agents analogue of the jobs seam. There is no second store, no second runner, no subagent spawning, and no cached copy.
|
|
1197
|
-
- **List
|
|
1198
|
-
- **Safe projection only.**
|
|
1789
|
+
- **List, cancel, and thread read only.** This slice has exactly three methods, `list_subagents`, `cancel_subagent`, and `get_subagent_thread`, and one event, `agents_update`. It does not start subagents: the agent dispatch tools stay agent tools, and there is no run/start method on this channel. `cancel_subagent` is the agents panel's exact stop path — `runner.cancel` — not a second stop implementation and never a request to the model to stop itself.
|
|
1790
|
+
- **Safe projection only.** A list or cancel entry carries exactly `id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, and `usage` (`total`, `cost`, and the final-assistant `input`/`output`/`cache`/`reasoning` breakdown when recorded). `lastStep` is a closed, status-derived phase label, never the raw owner step text, which can carry an error message, a stderr tail, or a provider body. No prompt text, working directory, session path, result, error text, or full session internals is ever returned or logged, and tool arguments, tool output, and thread text (including a streamed error note) appear only in a bounded `get_subagent_thread` item. A foreign field on an owner entry is dropped by the projection, never echoed.
|
|
1199
1791
|
- **Bounded list.** `list_subagents` returns active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries. The store already evicts finished tasks beyond its own retention, so the answer can never grow with the process lifetime.
|
|
1200
1792
|
- **No-op and failure mean no event.** A `cancel_subagent` on an already-terminal task answers that terminal state with no event, and a `cancel_subagent` on an unknown or foreign id answers `not_found` with no event. A running task's cancel is requested but asynchronous: the response reports the still-`running` state and emits no immediate byte-identical event; only the real store transition (the child exit to `cancelled`) emits through the normal `agents_update` path. Only an actual TaskStore transition (add, status change, or the completion-time usage recording) emits `agents_update`.
|
|
1201
1793
|
- **Usage persists across restore.** The completion-time usage breakdown is written to the task's history record, so a restored finished task keeps its final breakdown. A task whose run never recorded a breakdown (no final-assistant observation) has no breakdown fields after restore.
|
|
1202
1794
|
- **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a subagent started or settled by the agent (or any other path through the owner) still arrives as an `agents_update` event. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, so a settle that records usage right after its status change still emits exactly once. Session replacement or shutdown disconnects the observer, cancels the pending coalesced flush, and drops late outcomes, and the router's own publisher guard drops superseded events. A changed `cancel_subagent`'s response always precedes its event.
|
|
1203
|
-
- **
|
|
1795
|
+
- **Thread read is the widget's projection.** `get_subagent_thread` reuses the `gentle-agents.activity/v1` per-thread projection and bounds (`projectRpcThread`, then `boundRpcThread`, in `lib/agents-rpc-publisher.ts`): the last 40 items, 2 000 characters per text item, 500 for tool args and output, and the 256 KB halving. It is a read behind the `cancel_subagent` ownership check, emits no event, and adds no channel: it is one more read on the existing owner-service adapter. Tool args and output are the subagent's own data — whatever its tools received and printed — bounded but not redacted.
|
|
1796
|
+
- **`sinceVersion` is thread-level.** The store keeps one version per thread, not per item, and items change in place (streamed text, tool output, tool end), so `sinceVersion` returns either nothing (unchanged) or the whole bounded window, never a partial diff.
|
|
1797
|
+
- **Tool names are not length-capped.** Like the `gentle-agents.activity/v1` widget, a thread item's tool `name` is forwarded without a length cap, so a single huge tool name can keep one item above the 256 KB halving target (halving never drops below one item). Capping it is a follow-up for the widget and this method together, so the two keep the same projection.
|
|
1798
|
+
- **Truthful absence.** When the owning extension is not loaded, `list_subagents`, `cancel_subagent`, and `get_subagent_thread` answer `agents_unavailable` rather than inventing an empty list, a fake stop, or an empty thread. A task that exists but belongs to another session is indistinguishable from an unknown id at this boundary: both answer `not_found`.
|
|
1204
1799
|
- **Unproven live-child boundary.** The deterministic tests drive the real owner with a real `TaskStore` and a real `AgentRunner` over a fake child (never a real process), and the maintainer probe lists the owner-loaded empty list without starting a child. This slice does not yet prove a live `cancel_subagent` of a running child over the installed runtime end to end; the in-process real-owner test exercises the real `runner.cancel` path and its eventual `agents_update`, but a real OS child is out of scope.
|
|
1205
1800
|
|
|
1206
1801
|
## Profiles limits
|
|
@@ -1210,6 +1805,65 @@ Follows an `apply_profile` answer whose `status` is `applied`, after the respons
|
|
|
1210
1805
|
- **Confirmation is Desktop's job.** The token binds an apply to the title and message that were shown and to the exact saved profile; it is not a proof that a person saw them.
|
|
1211
1806
|
- **Truthful absence.** When the owning extension is not loaded, `apply_profile` answers `profiles_unavailable` rather than inventing an outcome.
|
|
1212
1807
|
|
|
1808
|
+
## Session limits
|
|
1809
|
+
|
|
1810
|
+
- **One owner, one schema.** `get_snapshot { sections }` and `session_snapshot` read the feed extension's live projection through a defensive, versioned owner-service adapter (`gentle:desktop:session-service`, the session analogue of the jobs seam). There is no second state store, no tool-event replay, and no read of the feed file under the agent home.
|
|
1811
|
+
- **Path-free projection.** No `identity` block, no `pid`/`ppid`/`ancestors`, no session file, no agent dir, and no absolute path from the projection crosses the wire: `project.cwd` becomes its basename `project.name`, worktree roots become opaque labels, and file paths are relative to their worktree. This rule covers every structural field the projection derives (working directory, worktree roots, file paths, identity).
|
|
1812
|
+
- **Free text passes as written.** Text a person or the agent wrote (pending question titles and options, todo titles and notes, activity and blocker labels, command descriptions) crosses exactly as the feed shows it, even when it contains a path: redacting inside text would corrupt it. This follows the `list_jobs` label precedent, where an explicit label is the agent's own wording and is kept.
|
|
1813
|
+
- **Bounded.** Arrays and text keep the feed's own caps (for example 200 changed files, 100 todos, 50 jobs and subagents, 200 commands, 500-character text, 2000-character question text), so the payload never grows with the session's lifetime. The channel has no separate response byte limit; requests stay under 64 KiB.
|
|
1814
|
+
- **Truthful absence.** When the feed is not running for the session, `sections` answer `session_unavailable` and `capabilities` omit `session_snapshot` rather than inventing an empty state. The feed runs only in Gentle Shell (not plain Pi), in the TUI or an interactive RPC host, and never in subagent children.
|
|
1815
|
+
|
|
1816
|
+
## Sessions limits
|
|
1817
|
+
|
|
1818
|
+
- **One owner, no second scanner.** `list_sessions` and `switch_session` call Pi's own `SessionManager.list`, `listAll`, and `findById`, with the session directory read from the live session manager, the same calls Pi's `/resume` makes. There is no session index, cache, file parser, or settings reader in this slice, and the session-history and stats scanners are not reused for it.
|
|
1819
|
+
- **Ids in, ids out.** The wire carries session ids, never a session file path, working directory, or parent-session path. The path Pi resolves stays inside the process and goes straight to the command context's `switchSession`.
|
|
1820
|
+
- **Bounded projection.** Each entry carries exactly `id`, `name?`, `modified`, `messageCount?`, `firstMessage` (at most 200 characters), `project` (a display name), and `current`. The full conversation text Pi reads for search is never returned. A page holds at most 50 entries.
|
|
1821
|
+
- **The listing reads files.** Pi reads every session file in scope to build its list, so `scope: "all"` over a large history costs as much as Pi's own `/resume` across all projects. Prefer `project` and page with `limit`.
|
|
1822
|
+
- **A switch replaces the session.** Every per-session bridge and the router restart with the new session; event `seq` restarts at 1, and Desktop should re-read `get_snapshot` and any state it shows. A switch during a streaming turn aborts that turn first (Pi's behavior). A failure after Pi already tore the old session down cannot be answered by either session.
|
|
1823
|
+
- **Exactly once across a switch.** Pi dispatches prompts concurrently, so requests sent right after a `switch_session` can reach the session being replaced. The router refuses them with `session_switching` while the switch is in flight, answers any request still waiting on an owner right before the teardown, and the replaced instance answers late deliveries through the UI object it extracted before Pi invalidated its context. The switch's own response comes from the new session.
|
|
1824
|
+
- **No agent tool.** Sessions are reachable only through `/gentle:desktop` over the interactive RPC channel.
|
|
1825
|
+
|
|
1826
|
+
## Changes limits
|
|
1827
|
+
|
|
1828
|
+
- **One owner, no second tracker.** `get_changes` and `get_change_diff` reach the existing `/gentle:changes` owner — the shell's `WorktreeChangesTracker` over `sessionChangeRoots` — through a defensive, versioned owner-service adapter, the changes analogue of the usage and jobs seams. There is no second scan, no watcher, and no cached copy. `loadFileDiff` lives in `lib/change-diff.ts`, shared by the panel and this slice, so both run the same Git arguments over the same bounded runner.
|
|
1829
|
+
- **Read only, no event.** This slice has exactly two methods and no event. It never stages, reverts, commits, or opens a file. Every `get_changes` and every `get_change_diff` rescans the worktree, as the panel does when it opens, which also refreshes the shell's own changes widget.
|
|
1830
|
+
- **No repository-configured commands in the diff.** `get_change_diff` passes `--no-textconv --no-ext-diff` and `-c core.fsmonitor=false`, so a `.gitattributes` textconv driver, an external diff driver, or an fsmonitor hook configured in the repository never runs for a Desktop read. The panel keeps Git's default behavior, so the two can differ for files with such a driver. The rescan itself is the panel's own `git status` and `git diff --numstat`, unchanged.
|
|
1831
|
+
- **Confinement.** A diff is served only for a file the owner itself lists for that root, by exact match, and only when the file's directory resolves inside the root and outside the repository's git dir and common dir (resolved through links, so an alias such as a junction to `.git` is refused). Request paths that are absolute or contain `..` segments or control characters are refused before the owner is asked; the owner's exact match is the real boundary. The file entry, its status, and so its Git arguments always come from the owner's list, never from the request.
|
|
1832
|
+
- **Opaque roots.** A root crosses the wire only as an opaque id and its directory name. Ids are assigned per owner adapter (per session); after a session change, call `get_changes` again before `get_change_diff`.
|
|
1833
|
+
- **Bounded.** `get_changes` carries at most 200 files with `truncated`, the desktop feed's bound. `get_change_diff` carries at most 256 KiB of diff text with `truncated`; the Git run itself stays under the panel's 1 MiB bound.
|
|
1834
|
+
- **Content, not metadata.** Diff text is the user's file content and can carry anything those files carry. Errors stay generic: Git output, absolute paths, and Git commands never appear in an error.
|
|
1835
|
+
- **Truthful absence.** When the owning extension is not loaded, the session has no root to scan, or Git fails for any root, both methods answer `changes_unavailable` rather than an empty list.
|
|
1836
|
+
- **Same baseline as the panel.** Both methods diff against `HEAD`, like the panel today; when the panel moves to session-baseline diffs (#765), this slice follows it.
|
|
1837
|
+
|
|
1838
|
+
## Review limits
|
|
1839
|
+
|
|
1840
|
+
- **One owner, no second adapter.** `get_review_mode` and `set_review_mode` reach the `/gentle:review-mode` owner in `extensions/gentle-ai.ts` through a defensive, versioned owner-service adapter, like the profiles seam. Every read and write is that owner's `executeReviewMode` call over the native review CLI adapter, so status-cache invalidation and pending-consent cleanup on a disable are the TUI's own. The Desktop side never spawns `gentle-ai` and keeps no copy of the switch.
|
|
1841
|
+
- **Fail closed.** A read is bounded by the same timeout as the RDD status line (`GENTLE_PI_RDD_STATUS_TIMEOUT_MS`, 3 seconds by default) and a write by 10 seconds. A failed, timed-out, or unrecognized read is `unknown`, never a guess. A native failure is classified as unavailable (`gentle-ai` missing or the command unsupported), unknown, or failed; its message, exit detail, and paths never cross.
|
|
1842
|
+
- **User-owned switch.** This slice never changes the switch on its own: only a confirmed `set_review_mode` writes, and subagent children never answer the seam. Review start, skip, and candidate consent stay terminal-only.
|
|
1843
|
+
- **Token binds, it does not authenticate.** The confirmation token binds a change to the request and the exact state and text that were shown, so a stale or mismatched token never writes. It is not a secret: anyone who can write Pi's RPC stdin can read it and send it back.
|
|
1844
|
+
- **Desktop-only gate.** The single-flight gate serializes `set_review_mode` requests from Desktop in one Pi process. It does not gate the terminal `/gentle:review-mode` command, Herdr, or another process; a change from one of those between the two calls makes the token stale, and the second call asks again.
|
|
1845
|
+
- **A reset never writes late.** When the session is replaced or shut down while a confirmed `set_review_mode` is still discovering the owner or reading the current state, the write is not attempted and no event is emitted. That request gets no answer, because the router drops outcomes for a superseded session. A client that got no answer re-reads with `get_review_mode` and asks again.
|
|
1846
|
+
- **Truthful absence.** When the owning extension is not loaded, both methods answer `review_unavailable` rather than inventing a mode.
|
|
1847
|
+
|
|
1848
|
+
## Stats limits
|
|
1849
|
+
|
|
1850
|
+
- **One owner, one loader, one aggregation.** `get_usage_stats` reaches the `/gentle:stats` owner in `extensions/gentle-stats.ts` through a defensive, versioned owner-service adapter, the stats analogue of the jobs seam. The owner reads the same sessions roots as the panel (the active home and the user's original Pi home) with the panel's own loader instance, so both share one size/mtime cache: an unchanged session file is never re-read. Totals, models, and days come from the panel's `aggregateStats` with the requested range and scope; each project row is that same aggregation scoped to one project. There is no second parser, cache, or store.
|
|
1851
|
+
- **Shared in-flight load.** The loader answers concurrent loads of the same roots with one in-flight scan, so overlapping Desktop requests (or a request while the panel is loading) read the history once. The scan is asynchronous and streams files line by line; nothing is persisted.
|
|
1852
|
+
- **Read only, no event.** This slice has exactly one method and no event. History changes as sessions run; a client re-reads when it wants fresh numbers.
|
|
1853
|
+
- **Safe, bounded projection.** The wire carries counts, token sums, costs, model ids, day keys, and project display names only. Arrays are capped (models 50, days 400, projects 50) with a `truncated` flag per array; totals stay complete. A session's id, path, provider, or message text never crosses, and a raw read failure is answered with the fixed `stats_unavailable` message.
|
|
1854
|
+
- **Truthful absence.** When no sessions root can be read, or the owner is not loaded, the answer is `stats_unavailable`. A readable root with no usage answers zeros, which is the truth.
|
|
1855
|
+
- **Same numbers as the panel, including its gaps.** Records the panel counts are counted here too: an assistant record with zero usage still counts as a message (see #1921). This slice does not change what the aggregation counts.
|
|
1856
|
+
|
|
1857
|
+
## Updates limits
|
|
1858
|
+
|
|
1859
|
+
- **One source of truth.** Every fact comes from an existing resolver or check, imported, never copied: `runningBundledPrefix`, Pi's `DefaultPackageManager` listing, and `readChannel` for the channel; `latestRelease` and `resolveMainCommit` (the lookups `gentle-shell upgrade` uses) for Gentle Shell; the launcher's `startupReleaseCheck` record through `parseStartupReleaseCache` for the cached release; `findStartupUpdate`'s stable-version comparison; Pi's exported `VERSION`; `publishedPi` for a bundled Pi; and Pi's own `checkForAvailableUpdates` for packages. Pi's source parser (`parseSource`) is not part of Pi's typed surface; it is called defensively, and a parser that is missing or changed reports the package as `unknown`.
|
|
1860
|
+
- **Cache only without `refresh`.** A plain read never reaches the network. It reads the launcher config, the channel record, Pi's settings, and installed packages' `package.json`. Pi's listing may ask npm for its global root once when a user package is not in Pi's own install folder, exactly as `pi list` does.
|
|
1861
|
+
- **Bounded refresh.** One deadline (15 seconds) bounds every lookup; a lookup that ignores cancellation (Pi's package check cannot be cancelled) is dropped when the deadline passes and reported `unknown`. Concurrent refreshes share one run.
|
|
1862
|
+
- **Never "up to date" by default.** Only a successful lookup that returned exactly the running version is `up_to_date`. Failed, offline, timed-out, or incomparable answers are `unknown`, and a package Pi's check did not list is `no_update_reported`, because Pi's check cannot tell a failed lookup from no update.
|
|
1863
|
+
- **Memory only.** A refresh result is kept in this Pi process's memory and answers later plain reads (across a session switch too); it is never written, so the launcher's own cache and its startup notice are unchanged.
|
|
1864
|
+
- **Gaps stated.** Pi's latest version is known only in a bundled install. Package `latest` is always `null`. A git package has no `current`. `gentle-ai-managed` is detected only when the running gentle-pi is the `npm:gentle-pi` package Pi installed.
|
|
1865
|
+
- **Read only, no event.** This slice has exactly one method and no event, and it never runs an update.
|
|
1866
|
+
|
|
1213
1867
|
## Verification
|
|
1214
1868
|
|
|
1215
1869
|
```sh
|
|
@@ -1217,11 +1871,19 @@ node --experimental-strip-types --test \
|
|
|
1217
1871
|
tests/desktop-rpc.test.ts \
|
|
1218
1872
|
tests/desktop-rpc-permissions.test.ts \
|
|
1219
1873
|
tests/desktop-rpc-config.test.ts \
|
|
1874
|
+
tests/desktop-rpc-config-watch.test.ts \
|
|
1220
1875
|
tests/desktop-rpc-usage.test.ts \
|
|
1221
1876
|
tests/desktop-rpc-design.test.ts \
|
|
1222
1877
|
tests/desktop-rpc-jobs.test.ts \
|
|
1223
1878
|
tests/desktop-rpc-agents.test.ts \
|
|
1224
1879
|
tests/desktop-rpc-profiles.test.ts \
|
|
1880
|
+
tests/desktop-rpc-session.test.ts \
|
|
1881
|
+
tests/desktop-rpc-sessions.test.ts \
|
|
1882
|
+
tests/desktop-rpc-changes.test.ts \
|
|
1883
|
+
tests/change-diff.test.ts \
|
|
1884
|
+
tests/desktop-rpc-review.test.ts \
|
|
1885
|
+
tests/desktop-rpc-stats.test.ts \
|
|
1886
|
+
tests/desktop-rpc-updates.test.ts \
|
|
1225
1887
|
tests/maintainer/desktop-rpc.maintest.ts
|
|
1226
1888
|
```
|
|
1227
1889
|
|
|
@@ -1231,14 +1893,28 @@ The design tests use only injected fake canvas/server/browser factories and a fa
|
|
|
1231
1893
|
|
|
1232
1894
|
The usage tests use a fake owner service and a fake fetch/modelRegistry only: they cover the five statuses, the safe projection and plan-only-when-public rule, provider filters, unknown-provider `unavailable`, invalid params, refresh delegation with the provider filter forwarded, the response-before-event order over the router, the Anthropic typed `unsupported` no-op, the out-of-scope `out_of_scope` no-op (including the real owner never reaching the fetcher), content-based change detection (a same-millisecond payload change emits once, byte-equivalent data stays a no-op), late-discovery disposal after a reset, no duplicate event on no-op/failed refresh, raw-error and secret redaction, header-driven `rate_limit` events, stale-session disconnects, and the versioned adapter discovery. One test runs the real `gentleShell` owner seam to prove Claude's 5h/7d windows arrive as structured snapshots from response headers, never header text.
|
|
1233
1895
|
|
|
1234
|
-
The jobs tests use the existing background-job fake (the same fake shell operations and monitor controller as the background-jobs tests) and a fake owner service only: they cover the whitelisted projection and field redaction, the bounded running + recent-finished selection, list/cancel param shapes, the active-session filter, owner absence (`jobs_unavailable`, never a fabricated empty list), the `job_stop` stop path (monitor cancel + registry stop), already-terminal idempotency with no event, unknown and foreign-session `not_found`, invalid params rejected before discovery, agent-driven `jobs_update` events with foreign-session filtering, the response-before-event order over the router, session reset disconnecting observers and dropping late outcomes, late-discovery disposal, and the versioned adapter discovery. They also drive the real `job_stop` tool to prove the change descriptor distinguishes a running→stopped stop from a no-op stop.
|
|
1896
|
+
The jobs tests use the existing background-job fake (the same fake shell operations and monitor controller as the background-jobs tests) and a fake owner service only: they cover the whitelisted projection and field redaction, the bounded running + recent-finished selection, list/cancel/output param shapes, the active-session filter, owner absence (`jobs_unavailable`, never a fabricated empty list), the `job_stop` stop path (monitor cancel + registry stop), already-terminal idempotency with no event, unknown and foreign-session `not_found`, invalid params rejected before discovery, agent-driven `jobs_update` events with foreign-session filtering, the response-before-event order over the router, session reset disconnecting observers and dropping late outcomes, late-discovery disposal, and the versioned adapter discovery. They also drive the real `job_stop` tool to prove the change descriptor distinguishes a running→stopped stop from a no-op stop. For `get_job_output` they cover the plain-text normalization (CSI, OSC, two-character escapes, carriage-return progress lines, control characters, and half characters left by a cut), the owner's 20-line and per-line bounds and the `truncated` flag, own versus foreign and unknown ids, invalid params rejected before discovery, an absent, outdated, throwing, or malformed owner answering `jobs_unavailable`, no event on a read, the real `gentle-agents` owner answering its own job, and the transport answer without an owner.
|
|
1897
|
+
|
|
1898
|
+
The subagents tests use a real `TaskStore` plus a fake runner (never a child process) and a fake owner service only: they cover the whitelisted model/usage/cost projection and field redaction, the `get_subagent_thread` projection matching the activity widget's thread exactly (40-item window, per-field bounds, store `version` and `dropped`, `truncated`, and the byte-bound halving), its `sinceVersion` unchanged and changed answers, its param shapes rejected before discovery, unknown and foreign-session `not_found`, an absent, older, throwing, or malformed owner answering `agents_unavailable` without leaking, and a single response line with no event, the closed `lastStep` vocabulary (raw error/path/secret/provider text never crosses), the bounded active + recent-finished selection, list/cancel param shapes, the active-session filter, owner absence (`agents_unavailable`, never a fabricated empty list), the `runner.cancel` stop path and its boolean result, already-terminal idempotency with no event, unknown and foreign-session `not_found`, invalid params rejected before discovery, agent-driven `agents_update` events with foreign-session filtering, content dedupe and burst coalescing, the response-before-event order over the router, session reset disconnecting observers and dropping late outcomes, late-discovery disposal, and the versioned adapter discovery. They also run the real `gentleAgents` owner seam in-process over a fake child (real `TaskStore` + real `AgentRunner`, never a real process): a truthful empty list, a typed `not_found` cancel, a live-task cancel that honors `runner.cancel`'s result with no immediate event and one eventual `agents_update`, an owned thread read through the activity projection with a foreign-session `not_found`, and the persisted usage breakdown surviving `saveTask`/`loadStoredTask` restore.
|
|
1899
|
+
|
|
1900
|
+
The session tests load the real desktop RPC and feed extensions on one fake Pi with fake timers and an isolated agent home: they cover the strict `sections` params, the path-free projection (basename, opaque roots, relative multi-worktree paths), a byte-identical `get_snapshot` without `sections` with and without the feed, `session_unavailable` and the missing `session_snapshot` capability without the feed, reads that emit no event, and `session_snapshot` carrying only changed sections on the feed's routine (250 ms) and urgent (16 ms) tiers, with no event for an unchanged flush.
|
|
1235
1901
|
|
|
1236
|
-
The
|
|
1902
|
+
The changes tests load the real `gentleShell` owner and this extension together over temporary Git repositories (real `git`; a wrapped runner only to force a failure). They cover the opaque root id and directory-name label with no absolute path anywhere on the wire, root-relative paths and statuses, the 200-file cap, `get_change_diff` answering byte-for-byte what the panel's `loadFileDiff` answers for tracked and untracked files (including `/dev/null` on Windows), the 256 KiB cut on a line boundary and the head of a diff past the panel's 1 MiB bound, `not_found` for an unknown root, a root's absolute path or label in place of its id, a clean tracked file and `.git/config` that exist on disk, a missing file, `..` traversal, absolute paths, `./`, backslash, case, and trailing-space aliases, and a file behind a directory link (a junction on Windows), `invalid_request` for wrong shapes with no Git run, `changes_unavailable` without an owner, without a repository, and when Git status or the diff fails (with no Git output on the wire), one response line and no event per read, that the owner answers discovery only for its own live session, that a repository textconv driver never runs for `get_change_diff` while the panel's default call still honors it, that a junction to `.git` inside the root is refused, odd Windows path forms (`file.ts.`, `::$DATA`, short names, `\\?\` and UNC prefixes, trailing `/`), a stale root id from a previous session, and directories swapped to junctions after listing. `tests/change-diff.test.ts` proves the panel's `loadFileDiff` export is the shared lib function and keeps its arguments, bound notice, and failure behavior on real Git.
|
|
1237
1903
|
|
|
1238
1904
|
The profiles tests use a fake owner service only: they cover param validation, owner absence (`profiles_unavailable`), the result shapes, the `profile_applied` event only after `applied`, and that the token changes with the mode, name, title, message, and profile content. The owner itself is covered in `tests/gentle-ai.test.ts`, which drives the real screen actions in a temporary config home: a default apply asks the screen's diff and writes nothing without its token, a wrong or stale token asks again and writes nothing, an unknown profile writes nothing, a session apply binds without writing shared state, and only one apply runs at a time.
|
|
1239
1905
|
|
|
1906
|
+
The review tests use a fake owner service and a fake native review adapter only; they never run `gentle-ai`, so nothing on the machine is toggled. They cover the wire projection of every source and scope, fail-closed `unknown` on a failed, timed-out, malformed, or throwing read, `review_unavailable` for a missing owner, host, adapter, or unsupported command, strict params rejected before discovery, the first call writing nothing, a matching token writing then re-reading, wrong and stale tokens asking again with a fresh token, the process-wide single-flight gate, clone enable under a global off (dialog text and a `changed: false` no-op), a scope-only change emitting the event, failed writes emitting nothing and carrying no CLI detail, the response-before-event order over the transport, and the versioned adapter discovery. They also load the real `extensions/gentle-ai.ts` owner over a fake adapter to prove the STATUS, write-with-scope, re-read call sequence, the error classification, the bounded read, and that a subagent child never answers.
|
|
1907
|
+
|
|
1908
|
+
The stats tests write session files into a temporary sessions root outside the worktree and load the real `gentle-stats` owner with the real Desktop transport: they cover the advertised method with no new event, the 7-day/current-project defaults, every range and scope against `aggregateStats`, project display names and the absence of paths, session ids, providers, and message text, the model/day/project bounds with `truncated` and complete totals, reads through the owner's single loader with concurrent requests sharing one load, invalid params rejected before any load, `stats_unavailable` for unreadable roots and for an absent owner, the owner leaving the bus on shutdown, a session reset dropping an in-flight read, throwing or malformed owner reads, and the versioned adapter discovery. `tests/stats-collector.test.ts` pins the shared in-flight load and the readable-root check.
|
|
1909
|
+
|
|
1910
|
+
The update-status tests drive the real Desktop transport with injected sources that count every lookup that would reach the network: they cover the advertised method with no new event, plain reads answering from the launcher's recorded lookup with no network work, a refresh running each lookup once with its check time and later plain reads answering from it, `up_to_date` only for an exact match after a successful lookup, newer local builds and prereleases staying `unknown`, failed lookups answering `unknown` with no error text on the wire while plain reads keep the last good result, the refresh deadline with lookups that never settle, concurrent refreshes sharing one run, `PI_OFFLINE` doing no lookup and claiming nothing, the main-channel commit comparison, each channel's fixed command, Pi without a reachable latest source, every package state, the 100-row bound with `truncated`, an unreadable listing, display names free of paths, URLs, and credentials, params rejected before any source work, and `updates_unavailable` for an unbound session, a throwing source, and a read a reset superseded. Two tests run the real sources against a temporary agent dir, launcher config, channel record, and a fake fetch: Pi's own listing and parser, the launcher's release record, the channel record (missing, `main`, malformed), Pi's `VERSION`, the release lookup's single request, and Pi's own package check reporting nothing under `PI_OFFLINE`.
|
|
1911
|
+
|
|
1240
1912
|
The config tests build six stores in a temporary root and inject the worktree identity, so no real user config, agent home, or repository pin is read. On the read side they cover every store, current path precedence, missing and malformed layers, revision stability and change, the read-only split, rejected stores/params/paths, the bounded snapshot projection, and a byte-and-mtime comparison proving a read never mutates a store. On the write side they cover a valid write for each writable store and both pin layers, clearing either pin layer and observing the winner fall back, clearing an already-missing layer as a no-op, clearing and replacing an unreadable layer, creating a missing store, a stale or missing `expectedRevision` (including on a clear), the documented rejection order (envelope, then store identity, then mutability, then revision, then payload), data the owner would drop, malformed pin clear shapes, extra and physical-path keys, every read-only store, a forced owner write failure (the store path is a directory) answering `write_failed` with no path, OS code, or event and an unchanged tree, the no-op path with untouched bytes and mtime, the resulting disk bytes, revision movement and its invalid-state coarseness, the response-then-event order over the real transport, and that a stopped session neither answers nor writes. They also re-check that the config dispatcher still falls through to the permission bridge.
|
|
1241
1913
|
|
|
1914
|
+
The external-change tests inject the directory watcher factory and a fake clock, so no assertion depends on real filesystem notification timing. They cover debounce coalescing and window restart, name filtering in shared directories, the real `fs.watch` watcher closing itself when its directory is removed (on Windows a removed directory otherwise keeps the process alive), watcher-creation failure (one directory and every directory) leaving `get_config`, `get_snapshot`, and `set_config` working with no error and no event, an external `profiles` edit producing one `config_changed` with `source: "external"` and no content or path, unchanged recomputed revisions (reformatting, change-and-undo) emitting nothing, a Desktop `set_config` never echoed as external, pin layers watched in the session worktree and re-targeted when the cwd changes, the cwd-dependent stores re-read and announced once on a re-target, a change still debounced when the cwd moves flushed rather than lost, a removed owner directory re-armed through its ancestor with exactly one event after it is recreated and written, a Desktop `profiles` write that makes a pin stale reported as one external `pins` event, a missing owner directory watched through its nearest existing ancestor and upgraded step by step (and closed on dispose), real `fs.watch` runs (rename-replace, Desktop write without echo, delete, recreate, a late `.pi/` directory, a local pin written into a fresh `<git-common-dir>/gentle-ai/`, nothing after reset), disposal on session shutdown and session switch (watchers closed, pending recompute cancelled, nothing published), no watcher and no owner subscription for TUI or headless hosts, `/gentle:mode` and `/gentle:mode default` producing external `permission_mode_changed` events over the real `registerYoloSessionPolicy` owner, a Desktop `set_permission_mode` never echoed (including an owner window that closes while the set is in flight), an external change right after a Desktop set's response still reported, a throwing emitter never propagating, a re-read in flight across a reset never emitting, `wire()` never rejecting when the owner throws, observation stopping on shutdown and restarting with a fresh sequence, and a missing permission owner leaving config events intact.
|
|
1915
|
+
|
|
1916
|
+
The sessions tests write real Pi session files into an isolated root (a custom session directory, and a default agent directory through `PI_CODING_AGENT_DIR`) and run Pi's real `SessionManager` through the Desktop command: they cover the project and all-projects scopes for both a custom and the default session directory, newest-first order, the whitelisted projection (no path, cwd, session file, or full message text), the bounded `firstMessage`, the display-only `project`, `current`, keyset paging and its end, param validation before any owner work, `sessions_unavailable` without a bound context, a late list dropped after a reset, a switch that hands Pi the owner-resolved file and answers from the replacement session with a fresh sequence, the current-session no-op, `not_found` outside the requested scope, a cancelled switch, a refused switch with no raw error, `session_switching` for every request dispatched while a switch is in flight (and the gate's release after a cancelled or failed switch), a request pending on an owner at teardown answered exactly once, a command delivered to the replaced instance answered without touching its stale context, path-, glob-, and prefix-shaped ids that never resolve, another project's entries exposing only its display name, forged cursors, and a backslash name projected unchanged. The router tests cover the gate and `abandonPending` (one answer, the kept request still answered by its outcome, late outcomes dropped).
|
|
1917
|
+
|
|
1242
1918
|
The maintainer probes run the installed Pi runtime with isolated HOME, agent home, config home, session, and temporary directories and no provider or network. They cover:
|
|
1243
1919
|
|
|
1244
1920
|
1. transport only — this extension alone proves slash-command dispatch, correlation, and that capabilities advertise the permission, config, usage, design, jobs, and subagents domains;
|
|
@@ -1248,6 +1924,8 @@ The maintainer probes run the installed Pi runtime with isolated HOME, agent hom
|
|
|
1248
1924
|
5. usage owner — the real `extensions/gentle-shell.ts` usage owner is loaded alongside this extension, and the probe reads `get_subscription_usage` for `anthropic` and `openai-codex` and observes truthful offline `pending` answers with no event and no live provider fetch. It never calls `refresh_subscription_usage` against a live provider;
|
|
1249
1925
|
6. design owner — the real `extensions/gentle-design.ts` design owner is loaded alongside this extension, and the probe reads `get_design_canvas` (with and without `includeUrl`) and observes the truthful owner-loaded stopped state (`running: false`, `slug: null`, `connectedClients: 0`, `designs: []`) with no event and no tokenized URL. It never starts a canvas server or opens a browser;
|
|
1250
1926
|
7. jobs owner — the real `extensions/gentle-agents.ts` jobs owner is loaded alongside this extension, and the probe reads `list_jobs` and observes the truthful owner-loaded empty list (`jobs: []`) with no event and no command or output path on the wire. It never starts a job;
|
|
1251
|
-
8. subagents owner — the real `extensions/gentle-agents.ts` subagents owner is loaded alongside this extension, and the probe reads `list_subagents` and observes the truthful owner-loaded empty list (`agents: []`) with no event and no prompt text, session path, or working directory on the wire. It never starts a child
|
|
1927
|
+
8. subagents owner — the real `extensions/gentle-agents.ts` subagents owner is loaded alongside this extension, and the probe reads `list_subagents` and observes the truthful owner-loaded empty list (`agents: []`) with no event and no prompt text, session path, or working directory on the wire. It never starts a child;
|
|
1928
|
+
9. sessions — with a session pre-seeded in the probe's `--session-dir`, the probe lists it through `list_sessions`, switches to it by id, receives the correlated response from the replacement session, reads `get_snapshot` at sequence 0, sees the session listed as `current`, gets `changed: false` for a second switch, and reads the seeded conversation through Pi's `get_messages`. No session file or absolute path appears on the wire. Three more probes send requests back to back right after a `switch_session` and check that each gets exactly one response and that the session then listed as current matches the switch that answered `changed: true`: another switch plus `list_sessions` (each `session_switching` or a real answer); a second switch to the same id (`session_switching`, final session unchanged); and `get_snapshot`, `capabilities`, and `list_jobs` (each `session_switching`).
|
|
1929
|
+
10. update status — with `PI_OFFLINE=1`, the probe reads `get_update_status` plainly and with `refresh: true`, and observes `offline: true`, `refreshed: false`, the `release` channel and its fixed command, Pi's real version with an `unknown` latest, an empty package list, no `up_to_date` claim, no event, and no absolute path on the wire. It never reaches the network.
|
|
1252
1930
|
|
|
1253
1931
|
What this does not prove: a live Desktop conversation approving the request. The probe writes RPC stdin itself, so it demonstrates that the production owner accepts the change and reports it truthfully, not that a person consented. It also does not cover `persist: true` end to end; persistence is covered by the owner and focused unit tests. Nothing in this slice proves a cross-process guarantee either: the probes use one process, which is exactly the scope `expectedRevision` provides. The design probe does not prove a live browser canvas: it only proves the owner-loaded stopped state without starting a server, while open/refresh/stop transitions and URL trust are covered by the injected-canvas unit tests. The jobs probe does not prove a live job or a live `cancel_job` kill: it only proves the owner-loaded empty list without starting a job, while the stop path, terminal idempotency, and events are covered by the fake-registry unit tests. The subagents probe does not prove a live subagent or a live `cancel_subagent` of a running child: it only proves the owner-loaded empty list without starting a child, while the runner cancel path, terminal idempotency, and events are covered by the fake-runner unit tests.
|