gentle-pi 4.7.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 +115 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +14 -13
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +476 -0
- package/assets/design-canvas/canvas-boot.js +219 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +397 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +219 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +351 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +167 -0
- package/assets/design-canvas/canvas-theme.js +69 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +773 -17
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +120 -36
- package/assets/design-canvas/inspector.js +574 -21
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +30 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +5 -9
- package/assets/orchestrator-full-delegation-card.md +11 -16
- package/assets/orchestrator-full-delegation.md +9 -9
- package/assets/orchestrator-memory.md +4 -4
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +13 -17
- package/assets/orchestrator-verification.md +12 -10
- package/assets/orchestrator-writer.md +13 -13
- package/assets/orchestrator.md +20 -24
- package/bin/gentle-shell.mjs +205 -10
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/orchestration/pi.md +2 -1
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/routing/pi.md +16 -16
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +23 -5
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +1931 -0
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +102 -17
- 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 +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +113 -32
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +19 -6
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +48 -9
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +436 -66
- package/extensions/gentle-ai.ts +809 -158
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +276 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +174 -59
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +260 -225
- 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/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +17 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +92 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/change-diff.ts +104 -0
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +38 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +315 -0
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-design-service.ts +233 -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 +290 -0
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +403 -0
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +885 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +290 -0
- package/lib/desktop-rpc-permissions.ts +328 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- 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-usage.ts +229 -0
- package/lib/desktop-rpc.ts +336 -0
- 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/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- 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/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +86 -4
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- 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/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +14 -5
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +39 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +86 -4
- package/runtime/review-integration-v2.mjs +56 -3
- 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/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +5 -21
- package/scripts/build-runtime-modules.mjs +10 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +61 -20
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +26 -7
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +78 -21
- package/tests/ask-user-question.test.ts +61 -6
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +148 -27
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/change-diff.test.ts +75 -0
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -878
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +528 -0
- package/tests/design-canvas-inspector.test.ts +1004 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +91 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +189 -0
- package/tests/design-canvas-theme.test.ts +198 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- 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 +1319 -0
- 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 +1462 -0
- package/tests/desktop-rpc-design.test.ts +672 -0
- package/tests/desktop-rpc-jobs.test.ts +1193 -0
- package/tests/desktop-rpc-permissions.test.ts +321 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-safety.test.ts +119 -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 +707 -0
- package/tests/desktop-rpc.test.ts +293 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +30 -41
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +48 -0
- package/tests/gentle-agents.test.ts +848 -8
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +195 -21
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-bundled.test.ts +91 -5
- 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-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +121 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +35 -9
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +181 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +907 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +19 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +33 -15
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +99 -31
- package/tests/orchestrator-budget.test.ts +32 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +12 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +249 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +15 -14
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-routing-measured-values.test.ts +24 -0
- package/tests/pi-update-launcher.test.ts +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -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 +124 -99
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-controller.test.ts +2 -1
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator.test.ts +271 -4
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +27 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +312 -18
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +124 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +983 -306
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +386 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +49 -14
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- 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/update-agent-body-history.test.ts +138 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +88 -12
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +136 -27
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +184 -0
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- package/tests/yolo-mode.test.ts +39 -0
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,1931 @@
|
|
|
1
|
+
# Gentle Desktop RPC
|
|
2
|
+
|
|
3
|
+
Gentle Shell exposes a structured control channel for Gentle Desktop without changing or patching `pi-coding-agent`. It uses Pi's public extension-command and Extension UI RPC mechanisms.
|
|
4
|
+
|
|
5
|
+
## Activation
|
|
6
|
+
|
|
7
|
+
Start Pi in RPC mode with the interactive-host marker:
|
|
8
|
+
|
|
9
|
+
```sh
|
|
10
|
+
GENTLE_SHELL_INTERACTIVE_HOST=1 pi --mode rpc
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
The channel is inactive in the TUI and in headless RPC children. It does not register an agent-callable tool.
|
|
14
|
+
|
|
15
|
+
## Transport
|
|
16
|
+
|
|
17
|
+
Desktop sends an ordinary Pi `prompt` command. Its `message` contains `/gentle:desktop` followed by one JSON request:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"id": "pi-42",
|
|
22
|
+
"type": "prompt",
|
|
23
|
+
"message": "/gentle:desktop {\"schema\":\"gentle-shell.desktop-rpc/v1\",\"requestId\":\"desktop-42\",\"method\":\"capabilities\",\"params\":{}}"
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Pi's response to this command only reports prompt disposition:
|
|
28
|
+
|
|
29
|
+
```json
|
|
30
|
+
{
|
|
31
|
+
"id": "pi-42",
|
|
32
|
+
"type": "response",
|
|
33
|
+
"command": "prompt",
|
|
34
|
+
"success": true,
|
|
35
|
+
"data": { "disposition": "handled" }
|
|
36
|
+
}
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
The domain response arrives independently as an `extension_ui_request` with `method: "setWidget"`, `widgetKey: "gentle-desktop-rpc"`, and one JSON string in `widgetLines`. Its `requestId` correlates it with the Desktop request, not with the outer Pi prompt ID.
|
|
40
|
+
|
|
41
|
+
Registered extension commands are consumed by Pi. The real-runtime maintainer probe also verifies that this transport leaves `get_messages` empty rather than adding control traffic to the conversation.
|
|
42
|
+
|
|
43
|
+
## Requests
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
48
|
+
"requestId": "desktop-42",
|
|
49
|
+
"method": "get_snapshot",
|
|
50
|
+
"params": {}
|
|
51
|
+
}
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Requests are limited to 64 KiB. `requestId` is required and limited to 128 characters. Method names use lowercase snake case and are limited to 64 characters.
|
|
55
|
+
|
|
56
|
+
### `capabilities`
|
|
57
|
+
|
|
58
|
+
Returns the currently implemented contract; clients must not infer support from a later specification version:
|
|
59
|
+
|
|
60
|
+
```json
|
|
61
|
+
{
|
|
62
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
63
|
+
"command": "gentle:desktop",
|
|
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", "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
|
+
}
|
|
68
|
+
```
|
|
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, 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
|
+
|
|
72
|
+
### `get_snapshot`
|
|
73
|
+
|
|
74
|
+
Returns the current event sequence and a bounded state projection:
|
|
75
|
+
|
|
76
|
+
```json
|
|
77
|
+
{
|
|
78
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
79
|
+
"sequence": 0,
|
|
80
|
+
"state": {
|
|
81
|
+
"config": {
|
|
82
|
+
"stores": [
|
|
83
|
+
{ "store": "profiles", "scope": "global", "readOnly": false, "status": "ok", "revision": "sha256:1f0c…" },
|
|
84
|
+
{ "store": "models", "scope": "global+project", "readOnly": true, "status": "ok", "revision": "sha256:9a42…" },
|
|
85
|
+
{ "store": "profile_fallbacks", "scope": "global", "readOnly": false, "status": "missing", "revision": "sha256:3c11…" },
|
|
86
|
+
{ "store": "subagents", "scope": "global+project", "readOnly": true, "status": "ok", "revision": "sha256:77be…" },
|
|
87
|
+
{ "store": "pins", "scope": "local+repo", "readOnly": false, "status": "ok", "revision": "sha256:0d19…" },
|
|
88
|
+
{ "store": "managed_assets", "scope": "global", "readOnly": true, "status": "ok", "revision": "sha256:be05…" }
|
|
89
|
+
]
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
The projection carries only store identity, scope, mutability, status, and revision — never store content, never a path. It is the cheap way for a client to notice that one of the six revisions moved and then call `get_config` for that store. `state` is `{}` when no Desktop command has bound a session context yet, or when that context has no working directory: without one, the project and pin layers cannot be read truthfully, so nothing is projected instead of a guess.
|
|
96
|
+
|
|
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
|
+
|
|
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
|
+
|
|
136
|
+
### `get_config`
|
|
137
|
+
|
|
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.
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
143
|
+
"requestId": "desktop-46",
|
|
144
|
+
"method": "get_config",
|
|
145
|
+
"params": { "store": "profiles" }
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
| Param | Required | Type | Meaning |
|
|
150
|
+
| --- | --- | --- | --- |
|
|
151
|
+
| `store` | yes | one of the six store identifiers below | The store to read. |
|
|
152
|
+
|
|
153
|
+
Any other key — including `scope`, `path`, `file`, or `physical_path` — is rejected as `invalid_request`. A string that is not a known store identifier is rejected as `unknown_store`. Neither case reads anything.
|
|
154
|
+
|
|
155
|
+
| `store` | Owner reader | `scope` | `readOnly` | Content |
|
|
156
|
+
| --- | --- | --- | --- | --- |
|
|
157
|
+
| `profiles` | `readProfilesFileResult` over `<configHome>/profiles.json` | `global` | `false` | Normalized `AgentProfilesFile`: `kind`, `version`, optional `active`, `profiles`, optional `workflow`. Writable — see [`set_config`](#set_config). |
|
|
158
|
+
| `models` | `readSavedModelConfig` over `<configHome>/models.json` + `<cwd>/.pi/gentle-ai/models.json` | `global+project` | `true` | Saved routing map, global winning per agent, kept to safe agent keys. |
|
|
159
|
+
| `profile_fallbacks` | `readFallbacksFile` over `<configHome>/profile-fallbacks.json` | `global` | `false` | Normalized `FallbacksFile`: per-profile, per-agent ordered chains. Writable — see [`set_config`](#set_config). |
|
|
160
|
+
| `subagents` | `parseAgentsConfig` over `<agentHome>/subagents.json` + `<cwd>/.pi/subagents.json` | `global+project` | `true` | Normalized `AgentsConfig` the runtime would launch with. A layer that cannot be parsed is skipped and the remaining layer still merges, exactly like the runtime reader. |
|
|
161
|
+
| `pins` | `readProfilePinStatus` + `evaluateProfilePin` over the local pin and the repo declaration | `local+repo` | `false` | `resolved`, the winning layer and profile, plus the `invalid` and `stale` layers. Writable per layer — see [`set_config`](#set_config). |
|
|
162
|
+
| `managed_assets` | `readManagedAssetsManifestResult` over `<agentHome>/gentle-ai/managed-assets.json` | `global` | `true` | The installer's ownership manifest (`schemaVersion`, `assets`), filtered to ownership-shaped entries: relative asset paths below the agent home and 64-hex sha256 digests. Anything else is omitted, never echoed. |
|
|
163
|
+
|
|
164
|
+
Success:
|
|
165
|
+
|
|
166
|
+
```json
|
|
167
|
+
{
|
|
168
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
169
|
+
"kind": "response",
|
|
170
|
+
"requestId": "desktop-46",
|
|
171
|
+
"ok": true,
|
|
172
|
+
"data": {
|
|
173
|
+
"store": "profiles",
|
|
174
|
+
"scope": "global",
|
|
175
|
+
"readOnly": false,
|
|
176
|
+
"status": "ok",
|
|
177
|
+
"revision": "sha256:1f0c8c0f5bd34a1e27f4ba6d0f9c2f5b",
|
|
178
|
+
"value": {
|
|
179
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
180
|
+
"version": 1,
|
|
181
|
+
"active": "team",
|
|
182
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
183
|
+
},
|
|
184
|
+
"layers": [{ "source": "global", "status": "ok" }],
|
|
185
|
+
"writeTargets": [{ "target": "global", "status": "ok", "writeRevision": "sha256:8f2a…" }]
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
| Field | Meaning |
|
|
191
|
+
| --- | --- |
|
|
192
|
+
| `store` | The store identifier that was read. |
|
|
193
|
+
| `scope` | Which owner layers this store is assembled from: `global`, `global+project`, or `local+repo`. |
|
|
194
|
+
| `readOnly` | `false` for the three authoritative stores (`profiles`, `profile_fallbacks`, `pins`); `true` for the three derived or installer-owned stores (`models`, `subagents`, `managed_assets`). |
|
|
195
|
+
| `status` | `ok` (normalized content follows), `missing` (no layer produced content because no layer file exists), or `invalid` (layers exist but none of them produced content). See [Layer semantics](#layer-semantics). |
|
|
196
|
+
| `revision` | Opaque read-time digest of the canonical normalized content. See [Revision limits](#revision-limits). |
|
|
197
|
+
| `value` | Normalized owner content, present when the store produced one. Absent when a layer is missing or invalid. |
|
|
198
|
+
| `layers` | Per-layer status, `global` then `project`, or `local` then `repo`. Each entry is `ok`, `missing`, or `invalid` for the file that layer owns. |
|
|
199
|
+
| `writeTargets` | Present only for the three writable stores. One entry per file the owner rewrites, with that file's own `writeRevision` — the token `set_config` requires. See [Write targets](#write-targets). |
|
|
200
|
+
|
|
201
|
+
#### Layer semantics
|
|
202
|
+
|
|
203
|
+
`status` answers for the store; `layers` answers for each file it is assembled from. For a merged store the two are different questions:
|
|
204
|
+
|
|
205
|
+
- `profiles`, `profile_fallbacks`, and `managed_assets` have one layer, so `status` is that layer's status.
|
|
206
|
+
- `subagents` mirrors the runtime reader: a layer that cannot be parsed is skipped and the remaining layer still merges. `status` is `ok` as soon as one layer is usable, and `layers` still names the broken one.
|
|
207
|
+
- `models` keeps the owner's merge rule, which rejects the saved routing when a layer it reads is malformed; there `status` is `invalid` even if the other layer is fine.
|
|
208
|
+
- `missing` means every layer file is absent. `invalid` means layer files exist but none produced content; in that case the owner would fall back to its own defaults, which are not the content of this store, so no `value` is returned.
|
|
209
|
+
|
|
210
|
+
A malformed project `subagents.json` next to a valid global file therefore still returns content:
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"store": "subagents",
|
|
215
|
+
"scope": "global+project",
|
|
216
|
+
"readOnly": true,
|
|
217
|
+
"status": "ok",
|
|
218
|
+
"revision": "sha256:77be0c3c1f7e4b0d9a2d6a6c5d1f8e34",
|
|
219
|
+
"value": { "defaultMode": "task", "modelProfiles": { "explore": { "model": { "provider": "anthropic", "id": "claude-sonnet-4" } } } },
|
|
220
|
+
"layers": [
|
|
221
|
+
{ "source": "global", "status": "ok" },
|
|
222
|
+
{ "source": "project", "status": "invalid" }
|
|
223
|
+
]
|
|
224
|
+
}
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Missing and malformed stores are reported, never repaired:
|
|
228
|
+
|
|
229
|
+
```json
|
|
230
|
+
{
|
|
231
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
232
|
+
"kind": "response",
|
|
233
|
+
"requestId": "desktop-47",
|
|
234
|
+
"ok": true,
|
|
235
|
+
"data": {
|
|
236
|
+
"store": "models",
|
|
237
|
+
"scope": "global+project",
|
|
238
|
+
"readOnly": true,
|
|
239
|
+
"status": "invalid",
|
|
240
|
+
"revision": "sha256:5a61d4d3f5ab4f7f2f2f2cbb8ac7e2b1",
|
|
241
|
+
"layers": [
|
|
242
|
+
{ "source": "global", "status": "invalid" },
|
|
243
|
+
{ "source": "project", "status": "ok" }
|
|
244
|
+
]
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
`pins` always carries a `value` describing what the layers amount to, because a broken or stale pin is exactly the state an operator needs to see:
|
|
250
|
+
|
|
251
|
+
```json
|
|
252
|
+
{
|
|
253
|
+
"store": "pins",
|
|
254
|
+
"scope": "local+repo",
|
|
255
|
+
"readOnly": false,
|
|
256
|
+
"status": "ok",
|
|
257
|
+
"revision": "sha256:0d19c0b7f0a94c29d5c33a0b1c9e6d21",
|
|
258
|
+
"value": {
|
|
259
|
+
"resolved": true,
|
|
260
|
+
"winner": { "source": "repo", "profile": "team" },
|
|
261
|
+
"invalid": [],
|
|
262
|
+
"stale": [{ "source": "local", "profile": "retired" }]
|
|
263
|
+
},
|
|
264
|
+
"layers": [
|
|
265
|
+
{ "source": "local", "status": "ok" },
|
|
266
|
+
{ "source": "repo", "status": "ok" }
|
|
267
|
+
]
|
|
268
|
+
}
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
Outside a resolvable Git worktree there are no pin layers to report, so `pins` answers `status: "invalid"` with `value.reason: "worktree_unresolved"` and an empty `layers` array. No layer path is ever returned: the owner reports paths for the TUI panel, and this projection drops them.
|
|
272
|
+
|
|
273
|
+
`pins.status` has exactly three meanings:
|
|
274
|
+
|
|
275
|
+
- `ok` — a layer named a profile the global profiles store still defines; `value.winner` says which layer and profile.
|
|
276
|
+
- `missing` — neither pin file exists, so there is nothing to resolve.
|
|
277
|
+
- `invalid` — pin files exist but no layer resolves (all `invalid` or `stale`), or the session cwd is not a resolvable Git worktree. Only this status carries `value.reason`, and only the non-worktree case has an empty `layers` array.
|
|
278
|
+
|
|
279
|
+
A single broken or stale layer does not make the store `invalid` while another layer resolves: that layer is named under `value.invalid` (a file that is not a pin) or `value.stale` (a name the profiles store dropped), and its `layers` entry keeps the per-file status.
|
|
280
|
+
|
|
281
|
+
Reads have no side effect. A `get_config` request never creates, rewrites, repairs, or re-serializes a store, never writes the permission default, and emits no event. A reader that finds a malformed file reports it as `invalid` in `layers` — and as the store `status` only when no layer is usable — while leaving the bytes untouched.
|
|
282
|
+
|
|
283
|
+
#### Write targets
|
|
284
|
+
|
|
285
|
+
A write target is one file, not one store. `get_config` reports it only for a writable store, and `set_config` requires the revision of the exact target it is about to replace:
|
|
286
|
+
|
|
287
|
+
| `store` | `target` values | File |
|
|
288
|
+
| --- | --- | --- |
|
|
289
|
+
| `profiles` | `global` | `<configHome>/profiles.json` |
|
|
290
|
+
| `profile_fallbacks` | `global` | `<configHome>/profile-fallbacks.json` |
|
|
291
|
+
| `pins` | `local`, `repo` | `<git-common-dir>/gentle-ai/profile-pin.json`, `<worktree-root>/.pi/gentle-ai/profile.json` |
|
|
292
|
+
|
|
293
|
+
`writeRevision` is the digest of that one target's state: `sha256` over canonical JSON of `{store, target, status, value}`. When the target reads `ok`, `value` is the owner-normalized file content (for a pin layer, the profile name it holds), so any content change moves the digest. When the target reads `missing` or `invalid`, `value` is absent and the digest covers **only `{store, target, status}`** — the owner produced no content to hash, and this contract does not hash raw bytes. Two consequences follow, and they are limits rather than incidents:
|
|
294
|
+
|
|
295
|
+
- a target that is missing and a different target state can never collide, because `status` differs;
|
|
296
|
+
- two **different** broken files of the same target share one `writeRevision`, so replacing one `invalid` file with another produces no detectable conflict. `expectedRevision` proves "this target is currently broken", not "this target is currently broken in exactly this way".
|
|
297
|
+
|
|
298
|
+
It is deliberately a different token from the store's `revision`, which for `pins` describes the merged evaluation of both layers and therefore cannot identify the file a write replaces. A missing target has a write revision of its own (`status: "missing"`), which is what makes a first, creating write possible without inventing a token.
|
|
299
|
+
|
|
300
|
+
Outside a resolvable Git worktree `pins` reports `writeTargets: []`: there is no truthful pin file for the session, so no target is offered and no pin write is accepted.
|
|
301
|
+
|
|
302
|
+
### Revision limits
|
|
303
|
+
|
|
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:
|
|
305
|
+
|
|
306
|
+
- it is computed **at read time**, after the owner normalized the content, not from file bytes and not from an owner-maintained counter;
|
|
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;
|
|
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;
|
|
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`.
|
|
310
|
+
|
|
311
|
+
### `set_config`
|
|
312
|
+
|
|
313
|
+
Writes one existing, owner-maintained store. Desktop names a store and, for `pins`, the layer; it never names a path, and there is no generic physical-file target.
|
|
314
|
+
|
|
315
|
+
```json
|
|
316
|
+
{
|
|
317
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
318
|
+
"requestId": "desktop-48",
|
|
319
|
+
"method": "set_config",
|
|
320
|
+
"params": {
|
|
321
|
+
"store": "profiles",
|
|
322
|
+
"data": {
|
|
323
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
324
|
+
"version": 1,
|
|
325
|
+
"active": "team",
|
|
326
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
327
|
+
},
|
|
328
|
+
"expectedRevision": "sha256:8f2a0c5e2d7b4319a6f80e1c93b4d271"
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
```
|
|
332
|
+
|
|
333
|
+
| Param | Required | Type | Meaning |
|
|
334
|
+
| --- | --- | --- | --- |
|
|
335
|
+
| `store` | yes | `profiles` \| `profile_fallbacks` \| `pins` | The one store to write. |
|
|
336
|
+
| `data` | yes | store-specific object (below) | The **complete** new content of that store, not a patch. |
|
|
337
|
+
| `expectedRevision` | yes | string | `writeTargets[].writeRevision` of the target as the client last read it. |
|
|
338
|
+
|
|
339
|
+
Exactly these three keys are accepted. Any other key — including `scope`, `path`, `file`, or `physical_path` — is rejected as `invalid_request` before anything is read or written. An unknown store string is `unknown_store`. A write to `models`, `subagents`, or `managed_assets` is `read_only`, rejected before its `data` is inspected, because the reason the write cannot happen is the store, not the payload.
|
|
340
|
+
|
|
341
|
+
#### `data` for `profiles`
|
|
342
|
+
|
|
343
|
+
The complete `AgentProfilesFile`, exactly as the owner serializes it:
|
|
344
|
+
|
|
345
|
+
```json
|
|
346
|
+
{
|
|
347
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
348
|
+
"version": 1,
|
|
349
|
+
"active": "team",
|
|
350
|
+
"profiles": {
|
|
351
|
+
"team": {
|
|
352
|
+
"explore": { "model": "anthropic/claude-sonnet-4" },
|
|
353
|
+
"orchestrator": { "model": "openai/gpt-5" }
|
|
354
|
+
}
|
|
355
|
+
},
|
|
356
|
+
"workflow": { "team": { "orchestratorMode": "full-delegation" } }
|
|
357
|
+
}
|
|
358
|
+
```
|
|
359
|
+
|
|
360
|
+
| Field | Required | Meaning |
|
|
361
|
+
| --- | --- | --- |
|
|
362
|
+
| `kind` | yes | Exactly `gentle-pi.agent_model_profiles`. |
|
|
363
|
+
| `version` | yes | Exactly `1`. |
|
|
364
|
+
| `active` | no | Name of the globally active profile. Omitting it clears the marker. |
|
|
365
|
+
| `profiles` | yes | Profile name → routing map (agent name → `{model?, thinking?, tier?}`). Agent keys and model ids must satisfy the owner's safe-key policy. |
|
|
366
|
+
| `workflow` | no | Profile name → `{orchestratorMode: "organic" \| "full-delegation"}`. Non-default modes only; an all-organic map is not persisted. |
|
|
367
|
+
|
|
368
|
+
#### `data` for `profile_fallbacks`
|
|
369
|
+
|
|
370
|
+
The complete `FallbacksFile`, exactly as the owner normalizes it:
|
|
371
|
+
|
|
372
|
+
```json
|
|
373
|
+
{
|
|
374
|
+
"kind": "gentle-pi.profile_model_fallbacks",
|
|
375
|
+
"version": 1,
|
|
376
|
+
"profiles": {
|
|
377
|
+
"team": {
|
|
378
|
+
"*": [{ "model": "openai/gpt-shared" }],
|
|
379
|
+
"worker": [{ "model": "openai/gpt-fallback", "thinking": "low" }]
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`*` is the profile-wide default chain. Each chain is at most 8 steps, each step is `{model, thinking?}`, and a model appears at most once per chain.
|
|
386
|
+
|
|
387
|
+
#### `data` for `pins`
|
|
388
|
+
|
|
389
|
+
One selected layer and what it should hold — a profile to pin, or `null` to clear it:
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{ "source": "local", "profile": "team" }
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
```json
|
|
396
|
+
{ "source": "repo", "profile": null }
|
|
397
|
+
```
|
|
398
|
+
|
|
399
|
+
| Field | Required | Meaning |
|
|
400
|
+
| --- | --- | --- |
|
|
401
|
+
| `source` | yes | `local` (clone-wide, Git common dir) or `repo` (committable, per worktree). The layer is chosen by this field, never by which file happens to exist. |
|
|
402
|
+
| `profile` | yes | Name of a profile the `profiles` store currently defines, **or `null` to remove this layer's pin file**. |
|
|
403
|
+
|
|
404
|
+
`source` must be `local` or `repo`; there is no default and no inference. Exactly `{source, profile}` is accepted — the layer is never inferred from a path, and one request never touches both layers. A name the profiles store does not define is rejected, so this channel can never write the stale pin the owner's precedence rule would then skip; a clear names no profile, so the profiles store is not consulted.
|
|
405
|
+
|
|
406
|
+
`profile: null` is the explicit clear and goes through the owner's own `clearProfilePinSync`. It removes that one pin file and leaves the other layer exactly as it is, so the next read falls back to the lower layer and then to the global routing. Clearing a layer whose file does not exist is already the desired state: the response is `changed: false` and no event is emitted. Clearing a layer whose file exists but is not a readable pin still removes it — the request proved it saw that `invalid` layer through `writeRevision`, so this is an explicit removal, not a silent repair.
|
|
407
|
+
|
|
408
|
+
A layer whose file currently reads `invalid` is likewise a valid target for a set: replacing a broken pin with a valid one is an explicit operation.
|
|
409
|
+
|
|
410
|
+
#### Validation and revision guard
|
|
411
|
+
|
|
412
|
+
The checks below run in this order, and the first one that fails answers the request. Nothing is read or written after a rejection.
|
|
413
|
+
|
|
414
|
+
1. **Envelope** (`invalid_request`): exactly the keys `store`, `data`, and `expectedRevision`; `store` must be a string; `data` must be present. A request missing `data` is malformed whatever store or revision it names, so this check comes before the store rules — a `models` write without `data` is `invalid_request`, not `read_only`. Store contents are not looked at here.
|
|
415
|
+
2. **Store identity** (`unknown_store`): the string must be one of the six store identifiers.
|
|
416
|
+
3. **Mutability** (`read_only`): `models`, `subagents`, and `managed_assets` are rejected before their `data` is inspected or their revision is compared, so any payload gets the same answer.
|
|
417
|
+
4. **Usable revision** (`revision_conflict`): `expectedRevision` must be a non-empty string. Absent, empty, and non-string tokens are all "the client did not prove it saw the current state", and this is decided before the payload is validated.
|
|
418
|
+
5. **Session roots** (`config_unavailable`): the bound session must have a working directory.
|
|
419
|
+
6. **Payload** (`invalid_data`): `data` is validated by the owner's own normalizer (`normalizeProfilesFile`, `normalizeFallbacksFile`, the pin name and store rules). A value the owner would reject is `invalid_data`. So is any value the owner's normalizer would **rewrite or silently drop** — an illegal profile or agent name, a stale `active` marker, an unknown workflow mode, an empty fallback chain, the `effort` alias, an organic workflow entry, an unknown routing member. A write is applied complete or not at all, so a client can never delete or silently reshape content by sending it: send exactly the canonical form `get_config` returned. For `pins`, `profile` must be a defined profile name or the literal `null`; a missing, empty, non-string, or unknown `profile`, an extra `data` key, and a `source` other than `local`/`repo` are all `invalid_data`, and a pin request outside a resolvable Git worktree is `config_unavailable`.
|
|
420
|
+
7. **Revision comparison** (`revision_conflict`): the target's current `writeRevision` is read from disk and compared with `expectedRevision`. A mismatch means **no write and no removal**. Remember the coarse case: two different broken files share one revision, so a broken-to-broken change is not caught here.
|
|
421
|
+
8. **Owner write** (`write_failed`): if the target already holds exactly this content the request is a no-op — nothing is written, `changed` is `false`, and no event is emitted; identical content is never re-serialized, so its bytes and mtime stay untouched, and a clear of an already-absent layer is the same no-op. Otherwise the owner's validated atomic writer performs the change (`writeProfilesFileSync`, `writeFallbacksFile`, `writeProfilePinSync`, or `clearProfilePinSync` — the writers go through a `0600` sibling temp file and a rename; the clear unlinks only a file that exists). If that writer throws, the answer is `write_failed` with a fixed message, no path, no OS code, no event, and the store left exactly as the owner's cleanup found it.
|
|
422
|
+
9. **Report**: the store is re-read and the response reports the result.
|
|
423
|
+
|
|
424
|
+
Steps 7–8 run in one synchronous block, with no `await` between the check and the rename or unlink. Pi dispatches Desktop prompts concurrently, but only an `await` can interleave another request, so **within this process** two `set_config` calls cannot both pass the check with the same `expectedRevision` — the second sees the first's revision and answers `revision_conflict`. This is not a cross-process transaction: there is no lock and no OS-level compare-and-swap, so another `pi` process (or `/gentle:profiles`, or the installer) can still write between the check and the rename. `expectedRevision` narrows that window; it does not remove it.
|
|
425
|
+
|
|
426
|
+
#### Success
|
|
427
|
+
|
|
428
|
+
```json
|
|
429
|
+
{
|
|
430
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
431
|
+
"kind": "response",
|
|
432
|
+
"requestId": "desktop-48",
|
|
433
|
+
"ok": true,
|
|
434
|
+
"data": {
|
|
435
|
+
"store": "profiles",
|
|
436
|
+
"scope": "global",
|
|
437
|
+
"readOnly": false,
|
|
438
|
+
"status": "ok",
|
|
439
|
+
"revision": "sha256:1c8065f530f01fb3c8e1dc33a2001b63",
|
|
440
|
+
"value": {
|
|
441
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
442
|
+
"version": 1,
|
|
443
|
+
"active": "team",
|
|
444
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
445
|
+
},
|
|
446
|
+
"layers": [{ "source": "global", "status": "ok" }],
|
|
447
|
+
"writeTargets": [{ "target": "global", "status": "ok", "writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78" }],
|
|
448
|
+
"writeTarget": "global",
|
|
449
|
+
"writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78",
|
|
450
|
+
"changed": true
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
```
|
|
454
|
+
|
|
455
|
+
The payload is the same `get_config` projection of the store **after** the write — `store`, `scope`, `readOnly`, `status`, `revision`, `value`, `layers`, `writeTargets` — plus two fields:
|
|
456
|
+
|
|
457
|
+
| Field | Meaning |
|
|
458
|
+
| --- | --- |
|
|
459
|
+
| `writeTarget` | The target this request named: `global`, `local`, or `repo`. |
|
|
460
|
+
| `writeRevision` | That target's resulting revision, to use as `expectedRevision` on the next write. |
|
|
461
|
+
| `changed` | `true` only if this request actually changed the target's content. A no-op answers `false` with the unchanged state and no event. |
|
|
462
|
+
|
|
463
|
+
Every value is re-read from the owner after the attempt, never an echo of `data`, so a normalizing write reports what the store really holds.
|
|
464
|
+
|
|
465
|
+
#### Failures
|
|
466
|
+
|
|
467
|
+
```json
|
|
468
|
+
{
|
|
469
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
470
|
+
"kind": "response",
|
|
471
|
+
"requestId": "desktop-49",
|
|
472
|
+
"ok": false,
|
|
473
|
+
"error": { "code": "revision_conflict", "message": "Config changed since expectedRevision was read" }
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
A rejected write leaves every byte, mtime, and file in place: no store is created, repaired, truncated, or reformatted. Invalid `data` cannot create a file, and a `revision_conflict` cannot modify one. An owner write that throws (the store path is a directory, a permission failure, a read-only filesystem) answers `write_failed`, whose message is fixed and never carries a path or an OS error; its temp file is removed and the store is left as the owner found it.
|
|
478
|
+
|
|
479
|
+
### `get_permission_mode`
|
|
480
|
+
|
|
481
|
+
Reads the live permission owner. Params must be an empty object. A read has no effect on stored preferences: it never writes the default store, never changes a permission mode this session already established, and never emits an event.
|
|
482
|
+
|
|
483
|
+
The owner initializes a session lazily and this read is one of the entry points that does it. The first permission call in a session (a read or a set) resolves the session identity and pins this session's live mode to the trusted default in effect at that moment; that is why a read can be the call that materializes the session's mode. Later default changes therefore affect new sessions, not the one already initialized.
|
|
484
|
+
|
|
485
|
+
```json
|
|
486
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-43", "method": "get_permission_mode", "params": {} }
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
```json
|
|
490
|
+
{
|
|
491
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
492
|
+
"kind": "response",
|
|
493
|
+
"requestId": "desktop-43",
|
|
494
|
+
"ok": true,
|
|
495
|
+
"data": { "mode": "normal", "default_mode": "normal" }
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
`mode` is the session mode in effect now; `default_mode` is the trusted default a new primary session would start from. Both are one of `normal`, `auto`, `yolo`, `super-yolo`.
|
|
500
|
+
|
|
501
|
+
### `set_permission_mode`
|
|
502
|
+
|
|
503
|
+
Applies a session mode immediately through the existing permission owner (`YoloSessionController`). No restart, no reload, and no separate store: this is the same controller that answers `/gentle:mode` and `/gentle:yolo`.
|
|
504
|
+
|
|
505
|
+
```json
|
|
506
|
+
{
|
|
507
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
508
|
+
"requestId": "desktop-44",
|
|
509
|
+
"method": "set_permission_mode",
|
|
510
|
+
"params": { "mode": "auto", "persist": true }
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
| Param | Required | Type | Meaning |
|
|
515
|
+
| --- | --- | --- | --- |
|
|
516
|
+
| `mode` | yes | `normal` \| `auto` \| `yolo` \| `super-yolo` | Session mode to apply now. |
|
|
517
|
+
| `persist` | no | boolean, default `false` | Also save `mode` as the trusted default for new primary sessions. |
|
|
518
|
+
|
|
519
|
+
Only these two params are accepted. Any other key, a non-string `mode`, a non-boolean `persist`, or an unknown mode string is rejected as `invalid_request` with no state change and no event.
|
|
520
|
+
|
|
521
|
+
```json
|
|
522
|
+
{
|
|
523
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
524
|
+
"kind": "response",
|
|
525
|
+
"requestId": "desktop-44",
|
|
526
|
+
"ok": true,
|
|
527
|
+
"data": { "mode": "auto", "default_mode": "auto", "persisted": true, "changed": true }
|
|
528
|
+
}
|
|
529
|
+
```
|
|
530
|
+
|
|
531
|
+
`mode` and `default_mode` are re-read from the owner after the attempt, so they are the actual resulting state, not an echo of the request. `persisted` reports whether this request actually saved the default. `changed` reports whether the session mode or the default differs from the state read before the call; a rejected or unchanged request returns `changed: false` and emits no event.
|
|
532
|
+
|
|
533
|
+
Persistence is delegated to the owner's validated writer, which keeps the file private (`0600`), writes atomically, and refuses to repair a malformed or unreadable preference. A failed save does not roll back the live session change:
|
|
534
|
+
|
|
535
|
+
```json
|
|
536
|
+
{
|
|
537
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
538
|
+
"kind": "response",
|
|
539
|
+
"requestId": "desktop-45",
|
|
540
|
+
"ok": true,
|
|
541
|
+
"data": {
|
|
542
|
+
"mode": "auto",
|
|
543
|
+
"default_mode": "normal",
|
|
544
|
+
"persisted": false,
|
|
545
|
+
"changed": true,
|
|
546
|
+
"persist_error": { "code": "default_unchanged", "message": "Default permission mode unchanged" }
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
```
|
|
550
|
+
|
|
551
|
+
### `get_subscription_usage`
|
|
552
|
+
|
|
553
|
+
Reads the subscription usage windows the existing usage owner has already recorded, projected into a safe wire shape. Params are optional: an empty object reads the whole current scope, and `{ "provider": "nan" }` reads exactly one provider.
|
|
554
|
+
|
|
555
|
+
```json
|
|
556
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-50", "method": "get_subscription_usage", "params": {} }
|
|
557
|
+
```
|
|
558
|
+
|
|
559
|
+
```json
|
|
560
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-51", "method": "get_subscription_usage", "params": { "provider": "openai-codex" } }
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
| Param | Required | Type | Meaning |
|
|
564
|
+
| --- | --- | --- | --- |
|
|
565
|
+
| `provider` | no | string | Narrow the answer to one provider. Unknown names answer `unavailable`, never an error. |
|
|
566
|
+
|
|
567
|
+
Only the `provider` key is accepted; any other key, a non-string `provider`, or an empty string is `invalid_request`. A read has no side effect: it never fetches, never writes, and never emits an event.
|
|
568
|
+
|
|
569
|
+
Success:
|
|
570
|
+
|
|
571
|
+
```json
|
|
572
|
+
{
|
|
573
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
574
|
+
"kind": "response",
|
|
575
|
+
"requestId": "desktop-51",
|
|
576
|
+
"ok": true,
|
|
577
|
+
"data": {
|
|
578
|
+
"providers": [
|
|
579
|
+
{
|
|
580
|
+
"provider": "openai-codex",
|
|
581
|
+
"status": "ok",
|
|
582
|
+
"fetchedAt": 1788600000000,
|
|
583
|
+
"plan": "pro",
|
|
584
|
+
"limits": [
|
|
585
|
+
{
|
|
586
|
+
"name": "codex",
|
|
587
|
+
"limitReached": false,
|
|
588
|
+
"windows": [
|
|
589
|
+
{ "label": "week", "usedPercent": 40, "windowSeconds": 604800, "resetAt": 1788777491000 }
|
|
590
|
+
]
|
|
591
|
+
}
|
|
592
|
+
]
|
|
593
|
+
}
|
|
594
|
+
]
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
```
|
|
598
|
+
|
|
599
|
+
Each entry carries only the safe fields of the owner's recorded snapshot:
|
|
600
|
+
|
|
601
|
+
| Field | Meaning |
|
|
602
|
+
| --- | --- |
|
|
603
|
+
| `provider` | The provider identifier. |
|
|
604
|
+
| `status` | One of `ok`, `pending`, `stale`, `failed`, `unavailable` — see below. |
|
|
605
|
+
| `fetchedAt` | When the snapshot was recorded, present when there is a snapshot. |
|
|
606
|
+
| `plan` | The plan name the owner already recorded, present only when public; never enriched from auth or account state. |
|
|
607
|
+
| `limits` | Safe windows: `name`, `limitReached`, and per-window `label`, `usedPercent`, `windowSeconds`, `resetAt`, plus NaN's raw `used`/`budget` allowance numbers when the provider reports them. |
|
|
608
|
+
|
|
609
|
+
`status` is derived only from facts the owner already holds:
|
|
610
|
+
|
|
611
|
+
- `ok` — a snapshot is recorded and fresh.
|
|
612
|
+
- `stale` — a snapshot is recorded but older than the 5-minute refresh window (refreshable providers only).
|
|
613
|
+
- `pending` — no snapshot yet, the provider is supported, and its latest refresh did not fail.
|
|
614
|
+
- `failed` — no snapshot and the latest refresh settled empty.
|
|
615
|
+
- `unavailable` — the provider is not supported (no built-in fetcher and no registered usage source).
|
|
616
|
+
|
|
617
|
+
A header-only provider (Anthropic) is `pending` until its first response, and its snapshots never age into `stale` because they arrive with responses rather than through a fetch cycle. A retained snapshot keeps `ok`/`stale` even after a failed refresh; its `fetchedAt` is the age signal. No account id, URL, access token, key material, raw provider error, or auth-resolution detail ever crosses the wire.
|
|
618
|
+
|
|
619
|
+
### `refresh_subscription_usage`
|
|
620
|
+
|
|
621
|
+
Delegates a forced refresh to the existing `refreshUsage` closure, with exactly the same API-key and auth logic the panel uses. It never resolves credentials, reads `auth.json`, or implements a second fetcher.
|
|
622
|
+
|
|
623
|
+
```json
|
|
624
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-52", "method": "refresh_subscription_usage", "params": { "provider": "openai-codex" } }
|
|
625
|
+
```
|
|
626
|
+
|
|
627
|
+
Params are the same optional `provider` filter as `get_subscription_usage`. The response reports the post-refresh statuses in the same `providers` shape. A provider with no fetch endpoint (Anthropic — its windows arrive with provider responses) is a truthful typed no-op: it answers `refresh: "unsupported"` with its current `pending`/`ok` status and performs no fetch and emits no event. No Claude usage endpoint is invented.
|
|
628
|
+
|
|
629
|
+
A refreshable provider that is **outside the current session scope** is also a truthful no-op: the owner resolves the scope before delegating, so it never attempts the fetch, keeps the current snapshot and status, and answers `refresh: "out_of_scope"` — an explicit signal instead of an ambiguous `pending`.
|
|
630
|
+
|
|
631
|
+
```json
|
|
632
|
+
{
|
|
633
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
634
|
+
"kind": "response",
|
|
635
|
+
"requestId": "desktop-54",
|
|
636
|
+
"ok": true,
|
|
637
|
+
"data": {
|
|
638
|
+
"providers": [
|
|
639
|
+
{ "provider": "openai-codex", "status": "pending", "refresh": "out_of_scope" }
|
|
640
|
+
]
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
```
|
|
644
|
+
|
|
645
|
+
`refresh` appears only on a refresh answer and is one of `unsupported` (supported provider with no fetch endpoint) or `out_of_scope` (refreshable provider the current scope does not target). Either is a no-op: no fetch, no event, and the snapshot and status are left exactly as they were.
|
|
646
|
+
|
|
647
|
+
```json
|
|
648
|
+
{
|
|
649
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
650
|
+
"kind": "response",
|
|
651
|
+
"requestId": "desktop-53",
|
|
652
|
+
"ok": true,
|
|
653
|
+
"data": {
|
|
654
|
+
"providers": [
|
|
655
|
+
{ "provider": "anthropic", "status": "pending", "refresh": "unsupported" }
|
|
656
|
+
]
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
```
|
|
660
|
+
|
|
661
|
+
When a refresh actually changes a snapshot, the response is followed by exactly one `rate_limit` event carrying every changed snapshot (`source: "refresh"`). A no-op, unsupported, throttled, or failed refresh changes nothing and emits no event. The response line always precedes the event line.
|
|
662
|
+
|
|
663
|
+
### `get_design_canvas`
|
|
664
|
+
|
|
665
|
+
Reads the live design canvas state the existing design owner already owns (the single `DesignCanvas` from `createDesignCanvas`, plus `listDesigns`). Params are optional: an empty object omits the tokenized URL, and `{ "includeUrl": true }` explicitly requests it.
|
|
666
|
+
|
|
667
|
+
```json
|
|
668
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-55", "method": "get_design_canvas", "params": {} }
|
|
669
|
+
```
|
|
670
|
+
|
|
671
|
+
```json
|
|
672
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-56", "method": "get_design_canvas", "params": { "includeUrl": true } }
|
|
673
|
+
```
|
|
674
|
+
|
|
675
|
+
| Param | Required | Type | Meaning |
|
|
676
|
+
| --- | --- | --- | --- |
|
|
677
|
+
| `includeUrl` | no | boolean | Include the tokenized canvas URL. Only honored for an interactive RPC host (the trust gate below); omitted by default. |
|
|
678
|
+
|
|
679
|
+
Only the `includeUrl` key is accepted; any other key, or a non-boolean `includeUrl`, is `invalid_request`. A read has no side effect: it never starts a canvas server, never opens a browser, and never emits an event.
|
|
680
|
+
|
|
681
|
+
Success:
|
|
682
|
+
|
|
683
|
+
```json
|
|
684
|
+
{
|
|
685
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
686
|
+
"kind": "response",
|
|
687
|
+
"requestId": "desktop-56",
|
|
688
|
+
"ok": true,
|
|
689
|
+
"data": {
|
|
690
|
+
"running": true,
|
|
691
|
+
"slug": "login",
|
|
692
|
+
"connectedClients": 1,
|
|
693
|
+
"designs": [
|
|
694
|
+
{ "slug": "login", "title": "Login screen", "mtime": 1788600000000 },
|
|
695
|
+
{ "slug": "pricing", "title": "Pricing page", "mtime": 1788500000000 }
|
|
696
|
+
],
|
|
697
|
+
"url": "http://127.0.0.1:4100/<token>/d/login/"
|
|
698
|
+
}
|
|
699
|
+
}
|
|
700
|
+
```
|
|
701
|
+
|
|
702
|
+
| Field | Meaning |
|
|
703
|
+
| --- | --- |
|
|
704
|
+
| `running` | Whether the session's canvas server is actually running, as the owner reports it. |
|
|
705
|
+
| `slug` | The slug the canvas last showed, or `null` for the system-only root. `null` is not "stopped": `running` answers that. |
|
|
706
|
+
| `connectedClients` | How many canvas pages the running server has connected (live-reload streams). `0` when stopped. |
|
|
707
|
+
| `designs` | The designs under `<cwd>/design` the owner's `listDesigns` reports (`slug`, `title`, `mtime`), most recent first. Empty when none exist. |
|
|
708
|
+
| `url` | Present only after `includeUrl: true` **and** the interactive-host trust check. The tokenized canvas URL is a capability; it is never a default field and never a bare token. |
|
|
709
|
+
|
|
710
|
+
When the design owner is absent (the extension that owns the canvas is not loaded), the answer is `design_unavailable` — never a fabricated `running: false`:
|
|
711
|
+
|
|
712
|
+
```json
|
|
713
|
+
{
|
|
714
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
715
|
+
"kind": "response",
|
|
716
|
+
"requestId": "desktop-57",
|
|
717
|
+
"ok": false,
|
|
718
|
+
"error": { "code": "design_unavailable", "message": "Design canvas owner unavailable for this session" }
|
|
719
|
+
}
|
|
720
|
+
```
|
|
721
|
+
|
|
722
|
+
A request with `includeUrl: true` from a host that is not an interactive RPC host simply gets the same state **without** `url`; the capability is omitted, not rejected. There is no `open`/`stop` method on this channel — those stay the `gentle_design` tool's actions, and this slice only observes their results.
|
|
723
|
+
|
|
724
|
+
### `list_jobs`
|
|
725
|
+
|
|
726
|
+
Reads the live background jobs the existing jobs owner already owns (the single parent-session `JobRegistry`), projected into the safe wire shape. Params must be an empty object.
|
|
727
|
+
|
|
728
|
+
```json
|
|
729
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-58", "method": "list_jobs", "params": {} }
|
|
730
|
+
```
|
|
731
|
+
|
|
732
|
+
Only an empty params object is accepted; any other key is rejected as `invalid_request`. A read has no side effect: it never starts, stops, or polls a job, and never emits an event.
|
|
733
|
+
|
|
734
|
+
Success:
|
|
735
|
+
|
|
736
|
+
```json
|
|
737
|
+
{
|
|
738
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
739
|
+
"kind": "response",
|
|
740
|
+
"requestId": "desktop-58",
|
|
741
|
+
"ok": true,
|
|
742
|
+
"data": {
|
|
743
|
+
"jobs": [
|
|
744
|
+
{ "id": "job-1", "label": "CI for PR 42", "status": "running", "startedAt": 1788600000000 },
|
|
745
|
+
{ "id": "job-2", "label": "Deploy staging", "status": "exited", "startedAt": 1788599000000, "endedAt": 1788599500000, "exitCode": 0 }
|
|
746
|
+
]
|
|
747
|
+
}
|
|
748
|
+
}
|
|
749
|
+
```
|
|
750
|
+
|
|
751
|
+
Each entry carries only the whitelisted fields of the owner's `JobRecord`:
|
|
752
|
+
|
|
753
|
+
| Field | Meaning |
|
|
754
|
+
| --- | --- |
|
|
755
|
+
| `id` | The owner's opaque job identifier. |
|
|
756
|
+
| `label` | The label the agent gave the job. A job started without one shows a fixed `Background job` (or `Background monitor` for a monitor): no part of its command, program name, arguments or paths crosses the wire, because a command can hide a secret in more shell forms than a parser could safely strip. |
|
|
757
|
+
| `status` | One of `running`, `exited`, `stopped`, or `failed`. |
|
|
758
|
+
| `startedAt` | When the job started, in milliseconds. |
|
|
759
|
+
| `endedAt` | When a non-running job ended, present only after it ends. |
|
|
760
|
+
| `exitCode` | The job's own exit code, present only when the owner recorded one (`null` for an exit without a code). |
|
|
761
|
+
|
|
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.
|
|
763
|
+
|
|
764
|
+
### `cancel_job`
|
|
765
|
+
|
|
766
|
+
Stops one running background job through the same owner stop path as `job_stop`: the monitor controller's `cancel` (dropping its timers and pending lines) followed by the registry's `stop` (aborting the process tree). Params are exactly `{ id }`.
|
|
767
|
+
|
|
768
|
+
```json
|
|
769
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-59", "method": "cancel_job", "params": { "id": "job-1" } }
|
|
770
|
+
```
|
|
771
|
+
|
|
772
|
+
| Param | Required | Type | Meaning |
|
|
773
|
+
| --- | --- | --- | --- |
|
|
774
|
+
| `id` | yes | non-empty string | The job to stop, as reported by `list_jobs`. |
|
|
775
|
+
|
|
776
|
+
Only the `id` key is accepted; any other key, a non-string or empty `id`, or a request shaped like `job_stop`'s `job_id` is `invalid_request`. The id is resolved against the active owner session, exactly like `job_stop`'s ownership check: an unknown id or a job owned by another session is a typed `not_found`, never a stop of someone else's job.
|
|
777
|
+
|
|
778
|
+
```json
|
|
779
|
+
{
|
|
780
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
781
|
+
"kind": "response",
|
|
782
|
+
"requestId": "desktop-59",
|
|
783
|
+
"ok": true,
|
|
784
|
+
"data": {
|
|
785
|
+
"job": { "id": "job-1", "label": "CI for PR 42", "status": "stopped", "startedAt": 1788600000000, "endedAt": 1788601000000 }
|
|
786
|
+
}
|
|
787
|
+
}
|
|
788
|
+
```
|
|
789
|
+
|
|
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.
|
|
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
|
+
|
|
832
|
+
### `list_subagents`
|
|
833
|
+
|
|
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.
|
|
835
|
+
|
|
836
|
+
```json
|
|
837
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-60", "method": "list_subagents", "params": {} }
|
|
838
|
+
```
|
|
839
|
+
|
|
840
|
+
Only an empty params object is accepted; any other key is rejected as `invalid_request`. A read has no side effect: it never starts, stops, or spawns a subagent, and never emits an event.
|
|
841
|
+
|
|
842
|
+
Success:
|
|
843
|
+
|
|
844
|
+
```json
|
|
845
|
+
{
|
|
846
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
847
|
+
"kind": "response",
|
|
848
|
+
"requestId": "desktop-60",
|
|
849
|
+
"ok": true,
|
|
850
|
+
"data": {
|
|
851
|
+
"agents": [
|
|
852
|
+
{
|
|
853
|
+
"id": "m3a1-worker",
|
|
854
|
+
"agent": "worker",
|
|
855
|
+
"status": "completed",
|
|
856
|
+
"model": "anthropic/claude-sonnet-4",
|
|
857
|
+
"modelSource": "binding",
|
|
858
|
+
"fallbackFrom": "anthropic/claude-opus-4",
|
|
859
|
+
"thinking": "high",
|
|
860
|
+
"lastStep": "answered",
|
|
861
|
+
"usage": { "total": 15234, "cost": 0.0421, "input": 12000, "output": 3234, "cache": 5000, "reasoning": 4000 }
|
|
862
|
+
}
|
|
863
|
+
]
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
```
|
|
867
|
+
|
|
868
|
+
Each entry carries only the whitelisted fields of the owner's `TaskRecord`:
|
|
869
|
+
|
|
870
|
+
| Field | Meaning |
|
|
871
|
+
| --- | --- |
|
|
872
|
+
| `id` | The owner's opaque task identifier. |
|
|
873
|
+
| `agent` | The helper's agent name. |
|
|
874
|
+
| `status` | One of `queued`, `running`, `waiting`, `completed`, `failed`, `cancelled`, or `timed_out`. |
|
|
875
|
+
| `model` | The routed model the helper launched with (or moved to). |
|
|
876
|
+
| `modelSource` | The launch-layer token that supplied `model` (`binding`, `frozen:*`, `pin:*`, `declaration`, `profile`, `definition`, or `default`), present only when the launch recorded one. |
|
|
877
|
+
| `fallbackFrom` | The model the run moved away from, present only after a fallback switch. |
|
|
878
|
+
| `thinking` | The thinking level the helper ran at, present only when one was resolved. |
|
|
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. |
|
|
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. |
|
|
881
|
+
|
|
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.
|
|
883
|
+
|
|
884
|
+
### `cancel_subagent`
|
|
885
|
+
|
|
886
|
+
Stops one subagent through the same owner stop path the agents panel uses: `runner.cancel`. Params are exactly `{ id }`.
|
|
887
|
+
|
|
888
|
+
```json
|
|
889
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-61", "method": "cancel_subagent", "params": { "id": "m3a1-worker" } }
|
|
890
|
+
```
|
|
891
|
+
|
|
892
|
+
| Param | Required | Type | Meaning |
|
|
893
|
+
| --- | --- | --- | --- |
|
|
894
|
+
| `id` | yes | non-empty string | The subagent to cancel, as reported by `list_subagents`. |
|
|
895
|
+
|
|
896
|
+
Only the `id` key is accepted; any other key, a non-string or empty `id`, or a request shaped like `subagent_status`'s `task_id` is `invalid_request`. The id is resolved against the active owner session: an unknown id or a subagent owned by another session is a typed `not_found`, never a cancel of someone else's task. No cancellation is done by asking the model — it is always the owner's own `runner.cancel` path.
|
|
897
|
+
|
|
898
|
+
```json
|
|
899
|
+
{
|
|
900
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
901
|
+
"kind": "response",
|
|
902
|
+
"requestId": "desktop-61",
|
|
903
|
+
"ok": true,
|
|
904
|
+
"data": {
|
|
905
|
+
"agent": { "id": "m3a1-worker", "agent": "worker", "status": "cancelled", "model": "anthropic/claude-sonnet-4", "lastStep": "cancelled", "usage": { "total": 15234, "cost": 0.0421 } }
|
|
906
|
+
}
|
|
907
|
+
}
|
|
908
|
+
```
|
|
909
|
+
|
|
910
|
+
The response is the **actual post-action state**, re-read from the owner — never an echo of the request. The owner honors `runner.cancel`'s boolean result and the store's actual synchronous transition:
|
|
911
|
+
|
|
912
|
+
- A **queued** task is finished synchronously: `runner.cancel` returns `true` and the store transitions to `cancelled`, so the response reports `cancelled` and is followed by one `agents_update` event.
|
|
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.
|
|
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.
|
|
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
|
+
|
|
1014
|
+
### `apply_profile`
|
|
1015
|
+
|
|
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.
|
|
1017
|
+
|
|
1018
|
+
```json
|
|
1019
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-62", "method": "apply_profile", "params": { "profile": "team", "mode": "default" } }
|
|
1020
|
+
```
|
|
1021
|
+
|
|
1022
|
+
| Param | Required | Type | Meaning |
|
|
1023
|
+
| --- | --- | --- | --- |
|
|
1024
|
+
| `profile` | yes | string, 1–128 characters | A saved profile name in `profiles.json`. |
|
|
1025
|
+
| `mode` | yes | `"default"` or `"session"` | `default` makes the profile the global default; `session` binds it to this RPC session only. |
|
|
1026
|
+
| `confirmation` | no | string, 1–128 characters | The `token` from a previous `confirmation_required` answer for the same `profile` and `mode`. |
|
|
1027
|
+
|
|
1028
|
+
Any other key or a malformed value is `invalid_request`. A name that is not a saved profile is `unknown_profile`, and no routing, settings, agents, or pins are written. Like the screen on first open, a missing `profiles.json` is first seeded with a `current` profile from the routing in effect; that is the only write an `apply_profile` can make before its checks.
|
|
1029
|
+
|
|
1030
|
+
When the screen would ask before writing (`Apply profile "<name>"?`, `Apply empty profile?`, `Apply orchestrator-only profile?`), the answer is that same dialog, and nothing has been written:
|
|
1031
|
+
|
|
1032
|
+
```json
|
|
1033
|
+
{
|
|
1034
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1035
|
+
"kind": "response",
|
|
1036
|
+
"requestId": "desktop-62",
|
|
1037
|
+
"ok": true,
|
|
1038
|
+
"data": {
|
|
1039
|
+
"profile": "team",
|
|
1040
|
+
"mode": "default",
|
|
1041
|
+
"status": "confirmation_required",
|
|
1042
|
+
"confirmation": {
|
|
1043
|
+
"title": "Apply profile \"team\"?",
|
|
1044
|
+
"message": "Profile \"team\" has agent routing entries. Applying it will replace global routing in … with this profile's routes: worker: openai/alpha (added). Continue?",
|
|
1045
|
+
"token": "3f1c…"
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
```
|
|
1050
|
+
|
|
1051
|
+
Desktop must show `title` and `message` to the human. Only when the human approves does it resend the request with `confirmation` set to `token`. Declining means not resending; nothing was written.
|
|
1052
|
+
|
|
1053
|
+
- **The token is bound to what was shown.** It hashes the mode, the profile name, the exact title and message, and the exact saved profile content the apply uses. If the diff, the current routing, or the saved profile changed since it was shown, the old token no longer matches, and the request answers `confirmation_required` again with the new text and a new token. Editing the profile asks again even when the dialog lists no routes (for example the empty, orchestrator-only, or unreadable-routing dialogs).
|
|
1054
|
+
- **The token is not authentication.** Whoever can write Pi's RPC stdin can read the token and resend it. Getting a human to confirm is Desktop's job; the token only guarantees that the apply runs against the text that was shown.
|
|
1055
|
+
- **Not every apply asks.** A pinned repository applies repo-scoped (it re-pins this clone and writes no global routing or orchestrator) and never asks. A profile that already matches the current global routing and orchestrator never asks: as on the screen, it still claims the profile and re-materializes the same routing, reports `applied`, and its `notes` start with the "already matches" line. `session` never asks.
|
|
1056
|
+
|
|
1057
|
+
Otherwise the answer is the outcome, with the screen's notices as `notes` (`level` is `info`, `warning`, or `error`):
|
|
1058
|
+
|
|
1059
|
+
```json
|
|
1060
|
+
{
|
|
1061
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1062
|
+
"kind": "response",
|
|
1063
|
+
"requestId": "desktop-63",
|
|
1064
|
+
"ok": true,
|
|
1065
|
+
"data": {
|
|
1066
|
+
"profile": "team",
|
|
1067
|
+
"mode": "default",
|
|
1068
|
+
"status": "applied",
|
|
1069
|
+
"notes": [{ "level": "info", "text": "el Gentleman applied profile \"team\" — 1 agent updated. …" }]
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
```
|
|
1073
|
+
|
|
1074
|
+
`applied` is followed by one `profile_applied` event. The status follows the screen's last notice: `applied` when it ended with an `info` notice, `not_applied` when it ended with a warning or with no notice; `notes` lists every notice in order, including a first-run seeding notice. For `not_applied` they say why, and when a write failed after the profile was claimed, the screen's rollback has already restored what it could. `not_applied` emits no event.
|
|
1075
|
+
|
|
1076
|
+
`session` binds the profile to the RPC session through the same session-profile path as the screen's Enter: it writes no global routing, no pins, no materialized stores, and does not change the active marker in `profiles.json`.
|
|
1077
|
+
|
|
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.
|
|
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
|
+
|
|
1381
|
+
## Responses
|
|
1382
|
+
|
|
1383
|
+
Success:
|
|
1384
|
+
|
|
1385
|
+
```json
|
|
1386
|
+
{
|
|
1387
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1388
|
+
"kind": "response",
|
|
1389
|
+
"requestId": "desktop-42",
|
|
1390
|
+
"ok": true,
|
|
1391
|
+
"data": {}
|
|
1392
|
+
}
|
|
1393
|
+
```
|
|
1394
|
+
|
|
1395
|
+
Failure:
|
|
1396
|
+
|
|
1397
|
+
```json
|
|
1398
|
+
{
|
|
1399
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1400
|
+
"kind": "response",
|
|
1401
|
+
"requestId": "desktop-42",
|
|
1402
|
+
"ok": false,
|
|
1403
|
+
"error": {
|
|
1404
|
+
"code": "unsupported_method",
|
|
1405
|
+
"message": "Unsupported Desktop RPC method"
|
|
1406
|
+
}
|
|
1407
|
+
}
|
|
1408
|
+
```
|
|
1409
|
+
|
|
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.
|
|
1411
|
+
|
|
1412
|
+
| Code | Meaning |
|
|
1413
|
+
| --- | --- |
|
|
1414
|
+
| `invalid_request` | Malformed envelope, unsupported params (including a physical path, `set_config` without `data`, or an `apply_profile` mode other than `default`/`session`), or an unknown permission mode. State unchanged. |
|
|
1415
|
+
| `unknown_store` | A store identifier this slice does not implement. Nothing was read or written. |
|
|
1416
|
+
| `read_only` | `set_config` named `models`, `subagents`, or `managed_assets`. Rejected before the payload was inspected; nothing was written. |
|
|
1417
|
+
| `invalid_data` | `set_config` data the owner would reject or would silently drop. Nothing was written, and no file was created. |
|
|
1418
|
+
| `revision_conflict` | `expectedRevision` was missing, unusable, or no longer current. Nothing was written. |
|
|
1419
|
+
| `write_failed` | The owner's atomic write threw. State is whatever the owner left; the message stays generic. |
|
|
1420
|
+
| `unsupported_method` | Method not in `capabilities`. |
|
|
1421
|
+
| `permission_unavailable` | The permission owner did not answer for this session (extension not loaded, or the session changed). State unchanged. |
|
|
1422
|
+
| `permission_denied` | The owner refused the change (for example a non-interactive or replaced session). State unchanged. |
|
|
1423
|
+
| `config_unavailable` | No Desktop command has bound a session context, that context has no working directory, or a pin write was requested outside a resolvable Git worktree. |
|
|
1424
|
+
| `usage_unavailable` | The usage owner did not answer for this session (extension not loaded, or the session changed). State unchanged. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
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. |
|
|
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). |
|
|
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. |
|
|
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. |
|
|
1438
|
+
| `internal_error` | Unexpected failure; message stays generic. |
|
|
1439
|
+
|
|
1440
|
+
## Events
|
|
1441
|
+
|
|
1442
|
+
Domain events use the same widget channel:
|
|
1443
|
+
|
|
1444
|
+
```json
|
|
1445
|
+
{
|
|
1446
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1447
|
+
"kind": "event",
|
|
1448
|
+
"seq": 1,
|
|
1449
|
+
"event": "example_event",
|
|
1450
|
+
"data": {}
|
|
1451
|
+
}
|
|
1452
|
+
```
|
|
1453
|
+
|
|
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.
|
|
1455
|
+
|
|
1456
|
+
### `permission_mode_changed`
|
|
1457
|
+
|
|
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:
|
|
1464
|
+
|
|
1465
|
+
```json
|
|
1466
|
+
{
|
|
1467
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1468
|
+
"kind": "event",
|
|
1469
|
+
"seq": 1,
|
|
1470
|
+
"event": "permission_mode_changed",
|
|
1471
|
+
"data": {
|
|
1472
|
+
"mode": "auto",
|
|
1473
|
+
"previous_mode": "normal",
|
|
1474
|
+
"default_mode": "auto",
|
|
1475
|
+
"persisted": true,
|
|
1476
|
+
"source": "desktop"
|
|
1477
|
+
}
|
|
1478
|
+
}
|
|
1479
|
+
```
|
|
1480
|
+
|
|
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.
|
|
1510
|
+
|
|
1511
|
+
### `config_changed`
|
|
1512
|
+
|
|
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:
|
|
1519
|
+
|
|
1520
|
+
```json
|
|
1521
|
+
{
|
|
1522
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1523
|
+
"kind": "event",
|
|
1524
|
+
"seq": 1,
|
|
1525
|
+
"event": "config_changed",
|
|
1526
|
+
"data": {
|
|
1527
|
+
"store": "profiles",
|
|
1528
|
+
"scope": "global",
|
|
1529
|
+
"writeTarget": "global",
|
|
1530
|
+
"revision": "sha256:1c8065f530f01fb3c8e1dc33a2001b63",
|
|
1531
|
+
"writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78",
|
|
1532
|
+
"source": "desktop"
|
|
1533
|
+
}
|
|
1534
|
+
}
|
|
1535
|
+
```
|
|
1536
|
+
|
|
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.
|
|
1572
|
+
|
|
1573
|
+
### `rate_limit`
|
|
1574
|
+
|
|
1575
|
+
Carries structured subscription-usage snapshots to subscribed Desktop consumers. It is emitted in two ways:
|
|
1576
|
+
|
|
1577
|
+
- **`source: "response"`** — asynchronously, whenever the existing usage owner records a snapshot from provider response headers (`after_provider_response`). Claude's 5h/7d windows arrive here, already parsed by the owner — the Desktop consumer never parses header text.
|
|
1578
|
+
- **`source: "refresh"`** — after a `refresh_subscription_usage` that actually changed a snapshot's content. It follows the refresh response line and is omitted for a no-op (unsupported, out-of-scope, throttled, or failed) refresh.
|
|
1579
|
+
|
|
1580
|
+
```json
|
|
1581
|
+
{
|
|
1582
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1583
|
+
"kind": "event",
|
|
1584
|
+
"seq": 3,
|
|
1585
|
+
"event": "rate_limit",
|
|
1586
|
+
"data": {
|
|
1587
|
+
"source": "response",
|
|
1588
|
+
"snapshots": [
|
|
1589
|
+
{
|
|
1590
|
+
"provider": "anthropic",
|
|
1591
|
+
"status": "ok",
|
|
1592
|
+
"fetchedAt": 1788600000000,
|
|
1593
|
+
"limits": [
|
|
1594
|
+
{
|
|
1595
|
+
"name": "claude",
|
|
1596
|
+
"limitReached": false,
|
|
1597
|
+
"windows": [
|
|
1598
|
+
{ "label": "5h", "usedPercent": 25, "windowSeconds": 18000, "resetAt": null },
|
|
1599
|
+
{ "label": "week", "usedPercent": 90, "windowSeconds": 604800, "resetAt": null }
|
|
1600
|
+
]
|
|
1601
|
+
}
|
|
1602
|
+
]
|
|
1603
|
+
}
|
|
1604
|
+
]
|
|
1605
|
+
}
|
|
1606
|
+
}
|
|
1607
|
+
```
|
|
1608
|
+
|
|
1609
|
+
Each snapshot entry is the same safe projection as `get_subscription_usage` (`provider`, `status`, `fetchedAt`, `plan` when public, `limits`), so a client that missed a response can reconcile from the event alone. `seq` advances exactly once per delivered event, through the same router sequencer as the other events.
|
|
1610
|
+
|
|
1611
|
+
### `design_canvas`
|
|
1612
|
+
|
|
1613
|
+
Carries the sanitized post-transition state of the session's design canvas whenever the existing design owner actually opens, refreshes, or stops it. It is emitted for **all** canvas transitions, whether they were initiated by the agent (`gentle_design` tool, `/gentle:design`) or anything else — the bridge subscribes to the owner eagerly, so agent-driven canvas work reaches a connected Desktop app even before any `get_design_canvas` request. There is no parsing of `Design canvas:` text anywhere: the owner emits the structured transition directly, and no event is emitted for a no-op or failed action (a refused slug, a browser that could not open, a server that could not start, or a `stop` with nothing running).
|
|
1614
|
+
|
|
1615
|
+
```json
|
|
1616
|
+
{
|
|
1617
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1618
|
+
"kind": "event",
|
|
1619
|
+
"seq": 2,
|
|
1620
|
+
"event": "design_canvas",
|
|
1621
|
+
"data": {
|
|
1622
|
+
"transition": "open",
|
|
1623
|
+
"running": true,
|
|
1624
|
+
"slug": "login",
|
|
1625
|
+
"connectedClients": 0,
|
|
1626
|
+
"url": "http://127.0.0.1:4100/<token>/d/login/"
|
|
1627
|
+
}
|
|
1628
|
+
}
|
|
1629
|
+
```
|
|
1630
|
+
|
|
1631
|
+
| Field | Meaning |
|
|
1632
|
+
| --- | --- |
|
|
1633
|
+
| `transition` | One of `open` (a canvas was shown, browser tab opened), `refresh` (an already-connected page was told to reload), or `stop` (a running server was closed). |
|
|
1634
|
+
| `running`, `slug`, `connectedClients` | The sanitized post-transition state, exactly as `get_design_canvas` reports it. A `stop` transition carries `running: false`, `slug: null`, `connectedClients: 0`. |
|
|
1635
|
+
| `url` | Present only for a trusted interactive Desktop client (the same trust gate as `get_design_canvas` `includeUrl`). Sanitized by default — the URL and its embedded token are never a default event field and never a bare token. A `stop` transition has no URL. |
|
|
1636
|
+
|
|
1637
|
+
### `jobs_update`
|
|
1638
|
+
|
|
1639
|
+
Carries the active session's projected background-job list whenever the existing jobs owner's registry actually changes — a job starting (`bash_background`/`monitor`), settling (exit or failure), being stopped (`job_stop` or a Desktop `cancel_job`), or a monitor stopping itself on its timeout or flood limit. It is emitted for **all** such changes, not only Desktop-initiated ones, so a connected app can live-update its job list.
|
|
1640
|
+
|
|
1641
|
+
```json
|
|
1642
|
+
{
|
|
1643
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1644
|
+
"kind": "event",
|
|
1645
|
+
"seq": 2,
|
|
1646
|
+
"event": "jobs_update",
|
|
1647
|
+
"data": {
|
|
1648
|
+
"jobs": [
|
|
1649
|
+
{ "id": "job-1", "label": "CI for PR 42", "status": "stopped", "startedAt": 1788600000000, "endedAt": 1788601000000 }
|
|
1650
|
+
]
|
|
1651
|
+
}
|
|
1652
|
+
}
|
|
1653
|
+
```
|
|
1654
|
+
|
|
1655
|
+
`jobs` is the same whitelisted, bounded projection as `list_jobs` (`id`, `label`, `status`, `startedAt`, `endedAt?`, `exitCode?`), so a client that missed a response can reconcile from the event alone. The event is filtered to the active owner session; a foreign-session change emits nothing to this bridge. A no-op or failed cancellation emits nothing: an already-terminal `cancel_job` (or `job_stop` on a job that already ended) changes nothing, so no event follows. When a changed `cancel_job` triggers the event, its response line always precedes the event line through the same router sequencer.
|
|
1656
|
+
|
|
1657
|
+
### `agents_update`
|
|
1658
|
+
|
|
1659
|
+
Carries the active session's projected subagent list whenever the existing agents owner's `TaskStore` actually transitions — a subagent queued, started, waiting on a question, settled (completed/failed/cancelled/timed out), or having its final usage recorded at completion. It is emitted for **all** such transitions, not only Desktop-initiated ones, so a connected app can live-update its helper list.
|
|
1660
|
+
|
|
1661
|
+
```json
|
|
1662
|
+
{
|
|
1663
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1664
|
+
"kind": "event",
|
|
1665
|
+
"seq": 2,
|
|
1666
|
+
"event": "agents_update",
|
|
1667
|
+
"data": {
|
|
1668
|
+
"agents": [
|
|
1669
|
+
{ "id": "m3a1-worker", "agent": "worker", "status": "cancelled", "model": "anthropic/claude-sonnet-4", "lastStep": "completed", "usage": { "total": 15234, "cost": 0.0421 } }
|
|
1670
|
+
]
|
|
1671
|
+
}
|
|
1672
|
+
}
|
|
1673
|
+
```
|
|
1674
|
+
|
|
1675
|
+
`agents` is the same whitelisted, bounded projection as `list_subagents` (`id`, `agent`, `status`, `model`, `modelSource?`, `fallbackFrom?`, `thinking?`, `lastStep`, `usage`), so a client that missed a response can reconcile from the event alone. The event is filtered to the active owner session; a foreign-session transition emits nothing to this bridge. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, matching the activity publisher. A no-op or failed cancellation emits nothing: an already-terminal `cancel_subagent` changes nothing, so no event follows. When a changed `cancel_subagent` triggers the event, its response line always precedes the event line through the same router sequencer.
|
|
1676
|
+
|
|
1677
|
+
### `profile_applied`
|
|
1678
|
+
|
|
1679
|
+
Follows an `apply_profile` answer whose `status` is `applied`, after the response line.
|
|
1680
|
+
|
|
1681
|
+
```json
|
|
1682
|
+
{
|
|
1683
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1684
|
+
"kind": "event",
|
|
1685
|
+
"seq": 3,
|
|
1686
|
+
"event": "profile_applied",
|
|
1687
|
+
"data": { "profile": "team", "mode": "default", "source": "desktop" }
|
|
1688
|
+
}
|
|
1689
|
+
```
|
|
1690
|
+
|
|
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.
|
|
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
|
+
|
|
1728
|
+
## Configuration limits
|
|
1729
|
+
|
|
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`).
|
|
1731
|
+
- **Bounded write surface.** `set_config` exists only for `profiles`, `profile_fallbacks`, and `pins`, and only as a whole-store replacement, one explicitly selected pin layer, or the explicit clear of one pin layer (`profile: null`). There is no generic physical-file target, no patch operation, no setter for `models`, `subagents`, or `managed_assets`, no way to clear both layers in one request, and no profile application or materialization: a profile write stores the definition, it does not apply it, and nothing else is rewritten as a side effect.
|
|
1732
|
+
- **Read-only rationale.** `models` and `subagents` are derived: the owners write them when a profile is applied or a route is materialized, so a Desktop write would fight that writer and leave the runtime and the store disagreeing. `managed_assets` is the installer's ownership manifest with hashes it verifies on install, so a client write would silently disable ownership checks. Only the stores whose owners accept validated writes report `readOnly: false`, and that flag describes the store's owner capability, which now matches this slice's write surface.
|
|
1733
|
+
- **No-op means no write.** Sending the content a store already holds, or clearing a pin layer that has no file, is answered with `changed: false`, no rewrite, no mtime churn, no removal, and no event, so a client can safely reconcile by re-sending what it read.
|
|
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.
|
|
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.
|
|
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.
|
|
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.
|
|
1739
|
+
|
|
1740
|
+
## Permission limits
|
|
1741
|
+
|
|
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.
|
|
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.
|
|
1744
|
+
- Permission control is never an agent-callable tool; only `/gentle:desktop` over the interactive RPC channel reaches it.
|
|
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.
|
|
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.
|
|
1747
|
+
|
|
1748
|
+
### Trust boundary
|
|
1749
|
+
|
|
1750
|
+
`GENTLE_SHELL_INTERACTIVE_HOST=1` is the only gate, and it is a process marker, not a human confirmation. Any actor able to write this Pi process's RPC stdin — or otherwise drive `/gentle:desktop` in the marker-set process — can request permission elevation, including `super-yolo`, and can make it the saved default with `persist: true`. Two consequences follow:
|
|
1751
|
+
|
|
1752
|
+
- `hasUI` in RPC mode means the Desktop app's UI surface exists; it is not proof that a person approved anything. This contract adds no confirmation dialog, so approval belongs to the Desktop client and its user.
|
|
1753
|
+
- The same write access already implies full control of an interactive agent session, so this is not a privilege escalation beyond stdin access. It is still a capability: treat the Desktop client's stdin channel as trusted input, and never let untrusted content (task text, issues, files, agent output) synthesize `/gentle:desktop` permission requests.
|
|
1754
|
+
|
|
1755
|
+
## Usage limits
|
|
1756
|
+
|
|
1757
|
+
- **One owner, no second fetcher or store.** `get_subscription_usage` and `refresh_subscription_usage` reach the existing usage owner (`UsageStore` / `UsageSourceRegistry` / `refreshUsage` / `after_provider_response` closures) through a defensive, versioned owner-service adapter — the usage analogue of the YOLO host-ui seam. There is no second fetcher, no second auth resolver, no `auth.json` access, and no cached copy.
|
|
1758
|
+
- **Same refresh semantics as the panel.** `refresh_subscription_usage` delegates to the existing `refreshUsage` with the same API-key and auth logic, the same 5-minute throttle (forced here), the same bounded fetch window, and the same per-provider generation guard. The scope is resolved **before** delegation: a refreshable provider outside the current session scope answers `refresh: "out_of_scope"` and never reaches the fetcher. Anthropic has no usage endpoint: a refresh for it is a truthful `refresh: "unsupported"` no-op, never fabricated data.
|
|
1759
|
+
- **Claude data arrives after provider responses.** Anthropic's 5h/7d windows are header-driven: they appear in a `rate_limit` event (`source: "response"`) only after a provider response, never from a fetch. Before the first response, Anthropic reads `pending`.
|
|
1760
|
+
- **Safe projection only.** The wire carries provider id, status, `fetchedAt`, the public plan name, and the window percentages/durations/resets (plus NaN's raw allowance numbers). No account id, URL, access token, key material, raw provider error, or auth-resolution detail is ever returned or logged.
|
|
1761
|
+
- **Session-scoped, disposed on replacement.** The owner adapter is discovered per session and disposed on session replacement or shutdown; a late refresh or header recording for a replaced session is dropped, and the router's own publisher guard drops any superseded response. A refresh response always precedes its `rate_limit` event, and a no-op or failed refresh emits no event.
|
|
1762
|
+
- **No agent tool.** The usage surface is reachable only through `/gentle:desktop` over the interactive RPC channel, exactly like the permission and config slices.
|
|
1763
|
+
|
|
1764
|
+
## Design limits
|
|
1765
|
+
|
|
1766
|
+
- **One owner, no second canvas.** `get_design_canvas` and the `design_canvas` event reach the existing design owner — the single `DesignCanvas` returned by `createDesignCanvas`, plus `listDesigns` — through a defensive, versioned owner-service adapter, the design analogue of the usage and YOLO seams. There is no second server, port, canvas store, browser opener, or watcher.
|
|
1767
|
+
- **Read + observe only.** This slice has exactly one method, `get_design_canvas`, and one event, `design_canvas`. It does not implement `open` or `stop`: those remain the `gentle_design` tool's actions (`/gentle:design open|stop`), and this slice only reports the transitions those actions actually cause.
|
|
1768
|
+
- **Tokenized URL is a capability.** The canvas URL contains the per-server token. It is omitted by default, is included on a read only for an explicit `{ "includeUrl": true }` **after** the interactive-host trust check, and is included in an event only for a trusted interactive Desktop client. The raw token is never a separate field and never appears in an error or log: a throwing owner answers `design_unavailable` with a fixed message.
|
|
1769
|
+
- **No-op and failure mean no event.** A refused slug, a browser that could not open, a server that could not start, or a `stop` with nothing running emits nothing. Only actual `open`/`refresh`/`stop` transitions emit.
|
|
1770
|
+
- **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a canvas opened or stopped by the agent (or by any other path through the owner) still arrives as a `design_canvas` event. Session replacement or shutdown disconnects the observer and drops late outcomes, and the router's own publisher guard drops superseded events.
|
|
1771
|
+
- **Truthful absence.** When the owning extension is not loaded, `get_design_canvas` answers `design_unavailable` rather than inventing `running: false`. `slug: null` means the system-only root, not a stopped canvas — `running` answers that.
|
|
1772
|
+
|
|
1773
|
+
## Jobs limits
|
|
1774
|
+
|
|
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.
|
|
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.
|
|
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`.
|
|
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`.
|
|
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.
|
|
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`.
|
|
1785
|
+
|
|
1786
|
+
## Subagents limits
|
|
1787
|
+
|
|
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.
|
|
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.
|
|
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.
|
|
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`.
|
|
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.
|
|
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.
|
|
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`.
|
|
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.
|
|
1800
|
+
|
|
1801
|
+
## Profiles limits
|
|
1802
|
+
|
|
1803
|
+
- **One owner, no second apply.** `apply_profile` reaches the `/gentle:profiles` owner in `extensions/gentle-ai.ts` through a defensive, versioned owner-service adapter, like the usage and design seams. The owner runs the screen's own **Use in this session** and **Make default** actions with a UI that records notices and answers confirmations only with a matching token. It never opens a dialog in Pi.
|
|
1804
|
+
- **Apply only.** This slice has one method and one event. Creating, editing, or deleting profiles stays `set_config` on the `profiles` store; pins stay `set_config` on `pins`.
|
|
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.
|
|
1806
|
+
- **Truthful absence.** When the owning extension is not loaded, `apply_profile` answers `profiles_unavailable` rather than inventing an outcome.
|
|
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
|
+
|
|
1867
|
+
## Verification
|
|
1868
|
+
|
|
1869
|
+
```sh
|
|
1870
|
+
node --experimental-strip-types --test \
|
|
1871
|
+
tests/desktop-rpc.test.ts \
|
|
1872
|
+
tests/desktop-rpc-permissions.test.ts \
|
|
1873
|
+
tests/desktop-rpc-config.test.ts \
|
|
1874
|
+
tests/desktop-rpc-config-watch.test.ts \
|
|
1875
|
+
tests/desktop-rpc-usage.test.ts \
|
|
1876
|
+
tests/desktop-rpc-design.test.ts \
|
|
1877
|
+
tests/desktop-rpc-jobs.test.ts \
|
|
1878
|
+
tests/desktop-rpc-agents.test.ts \
|
|
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 \
|
|
1887
|
+
tests/maintainer/desktop-rpc.maintest.ts
|
|
1888
|
+
```
|
|
1889
|
+
|
|
1890
|
+
The permission tests register the real `registerYoloSessionPolicy` owner with an isolated temporary config home and a stub identity resolver; they never read or write the user's own permission store.
|
|
1891
|
+
|
|
1892
|
+
The design tests use only injected fake canvas/server/browser factories and a fake owner service: they cover stopped/running/open/refresh/stop state, slug and connected-client counts, default URL omission, explicit `includeUrl` inclusion only after trust, untrusted omission, malformed adapters and params, owner absence (`design_unavailable`, never a fabricated `running: false`), failed and no-op actions emitting nothing, external (agent-driven) transition events, late-reset disposal and stale-outcome drops, and raw-error/token redaction. One test runs the real `gentleDesign` owner seam in-process to prove the stopped canvas state and the design list arrive from the single owner adapter.
|
|
1893
|
+
|
|
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.
|
|
1895
|
+
|
|
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.
|
|
1901
|
+
|
|
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.
|
|
1903
|
+
|
|
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.
|
|
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
|
+
|
|
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.
|
|
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
|
+
|
|
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:
|
|
1919
|
+
|
|
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;
|
|
1921
|
+
2. config reads — the same isolated runtime reads pre-seeded `profiles.json` and project `models.json` through `get_config`, checks the bounded `get_snapshot` projection, and proves no event is emitted and no store is created or rewritten;
|
|
1922
|
+
3. config write — the same isolated runtime reads the `profiles` write target, sends a `set_config` with that `expectedRevision`, observes the response plus one ordered `config_changed`, reads the store back with a moved revision, asserts the on-disk bytes are exactly the owner's serialization, and proves no other store was created and `get_messages` stayed empty;
|
|
1923
|
+
4. live owner — the real `extensions/gentle-ai.ts` owner extension is loaded alongside this extension, and the probe reads the mode, sets `auto` with `persist: false`, observes the response plus one `permission_mode_changed` event, and reads `auto` again in the same process without a restart, while `get_messages` stays empty and no default file is written. Nothing in the probe reimplements the owner;
|
|
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;
|
|
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;
|
|
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;
|
|
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.
|
|
1930
|
+
|
|
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.
|