gentle-pi 4.7.0 → 4.8.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 +55 -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 +6 -6
- 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 +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -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 +392 -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 +213 -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 +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -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 +746 -15
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +24 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +4 -4
- package/assets/orchestrator-full-delegation-card.md +4 -5
- package/assets/orchestrator-full-delegation.md +8 -8
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +18 -22
- package/bin/gentle-shell.mjs +128 -9
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +18 -2
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell.md +39 -16
- 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 +76 -24
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +11 -1
- package/extensions/ask-user-question.ts +2 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +234 -33
- package/extensions/gentle-ai.ts +576 -135
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +105 -52
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/skill-registry.ts +248 -223
- 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 +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +91 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -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 +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -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/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- 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 +79 -4
- 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/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- 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 +2 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/native-review-cli.mjs +79 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +4 -0
- package/scripts/build-runtime-modules.mjs +1 -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 +40 -19
- 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/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 +10 -2
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-question.test.ts +2 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/bounded-stop-contract.test.ts +9 -1
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- 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/delegate-for-reason-contract.test.ts +30 -8
- 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 +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -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 +90 -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 +180 -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-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -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 +20 -29
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/full-delegation-closure.test.ts +29 -0
- package/tests/gentle-agents.test.ts +329 -4
- 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 +121 -6
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +118 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +19 -5
- 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 +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -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 +11 -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 +11 -3
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +30 -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 +11 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -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 +11 -10
- 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-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/provider-defect-handoff.test.ts +9 -2
- 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 +1 -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 +26 -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/session-profile-extension.test.ts +2 -2
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +929 -306
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +42 -11
- 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/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +87 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +54 -11
- 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/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.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,1253 @@
|
|
|
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", "apply_profile", "list_subagents", "cancel_subagent"],
|
|
66
|
+
"events": ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update"]
|
|
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 and cancel, the profile apply, the subagents list and cancel, and the `config_changed`, `permission_mode_changed`, `rate_limit`, `design_canvas`, `jobs_update`, `profile_applied`, and `agents_update` 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 and cancel 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 and cancel methods and its one transition event, not the agent dispatch tools, which stay agent tools. 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), and [Subagents limits](#subagents-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
|
+
### `get_config`
|
|
100
|
+
|
|
101
|
+
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.
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
106
|
+
"requestId": "desktop-46",
|
|
107
|
+
"method": "get_config",
|
|
108
|
+
"params": { "store": "profiles" }
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
| Param | Required | Type | Meaning |
|
|
113
|
+
| --- | --- | --- | --- |
|
|
114
|
+
| `store` | yes | one of the six store identifiers below | The store to read. |
|
|
115
|
+
|
|
116
|
+
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.
|
|
117
|
+
|
|
118
|
+
| `store` | Owner reader | `scope` | `readOnly` | Content |
|
|
119
|
+
| --- | --- | --- | --- | --- |
|
|
120
|
+
| `profiles` | `readProfilesFileResult` over `<configHome>/profiles.json` | `global` | `false` | Normalized `AgentProfilesFile`: `kind`, `version`, optional `active`, `profiles`, optional `workflow`. Writable — see [`set_config`](#set_config). |
|
|
121
|
+
| `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. |
|
|
122
|
+
| `profile_fallbacks` | `readFallbacksFile` over `<configHome>/profile-fallbacks.json` | `global` | `false` | Normalized `FallbacksFile`: per-profile, per-agent ordered chains. Writable — see [`set_config`](#set_config). |
|
|
123
|
+
| `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. |
|
|
124
|
+
| `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). |
|
|
125
|
+
| `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. |
|
|
126
|
+
|
|
127
|
+
Success:
|
|
128
|
+
|
|
129
|
+
```json
|
|
130
|
+
{
|
|
131
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
132
|
+
"kind": "response",
|
|
133
|
+
"requestId": "desktop-46",
|
|
134
|
+
"ok": true,
|
|
135
|
+
"data": {
|
|
136
|
+
"store": "profiles",
|
|
137
|
+
"scope": "global",
|
|
138
|
+
"readOnly": false,
|
|
139
|
+
"status": "ok",
|
|
140
|
+
"revision": "sha256:1f0c8c0f5bd34a1e27f4ba6d0f9c2f5b",
|
|
141
|
+
"value": {
|
|
142
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
143
|
+
"version": 1,
|
|
144
|
+
"active": "team",
|
|
145
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
146
|
+
},
|
|
147
|
+
"layers": [{ "source": "global", "status": "ok" }],
|
|
148
|
+
"writeTargets": [{ "target": "global", "status": "ok", "writeRevision": "sha256:8f2a…" }]
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
| Field | Meaning |
|
|
154
|
+
| --- | --- |
|
|
155
|
+
| `store` | The store identifier that was read. |
|
|
156
|
+
| `scope` | Which owner layers this store is assembled from: `global`, `global+project`, or `local+repo`. |
|
|
157
|
+
| `readOnly` | `false` for the three authoritative stores (`profiles`, `profile_fallbacks`, `pins`); `true` for the three derived or installer-owned stores (`models`, `subagents`, `managed_assets`). |
|
|
158
|
+
| `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). |
|
|
159
|
+
| `revision` | Opaque read-time digest of the canonical normalized content. See [Revision limits](#revision-limits). |
|
|
160
|
+
| `value` | Normalized owner content, present when the store produced one. Absent when a layer is missing or invalid. |
|
|
161
|
+
| `layers` | Per-layer status, `global` then `project`, or `local` then `repo`. Each entry is `ok`, `missing`, or `invalid` for the file that layer owns. |
|
|
162
|
+
| `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). |
|
|
163
|
+
|
|
164
|
+
#### Layer semantics
|
|
165
|
+
|
|
166
|
+
`status` answers for the store; `layers` answers for each file it is assembled from. For a merged store the two are different questions:
|
|
167
|
+
|
|
168
|
+
- `profiles`, `profile_fallbacks`, and `managed_assets` have one layer, so `status` is that layer's status.
|
|
169
|
+
- `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.
|
|
170
|
+
- `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.
|
|
171
|
+
- `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.
|
|
172
|
+
|
|
173
|
+
A malformed project `subagents.json` next to a valid global file therefore still returns content:
|
|
174
|
+
|
|
175
|
+
```json
|
|
176
|
+
{
|
|
177
|
+
"store": "subagents",
|
|
178
|
+
"scope": "global+project",
|
|
179
|
+
"readOnly": true,
|
|
180
|
+
"status": "ok",
|
|
181
|
+
"revision": "sha256:77be0c3c1f7e4b0d9a2d6a6c5d1f8e34",
|
|
182
|
+
"value": { "defaultMode": "task", "modelProfiles": { "explore": { "model": { "provider": "anthropic", "id": "claude-sonnet-4" } } } },
|
|
183
|
+
"layers": [
|
|
184
|
+
{ "source": "global", "status": "ok" },
|
|
185
|
+
{ "source": "project", "status": "invalid" }
|
|
186
|
+
]
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
Missing and malformed stores are reported, never repaired:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
195
|
+
"kind": "response",
|
|
196
|
+
"requestId": "desktop-47",
|
|
197
|
+
"ok": true,
|
|
198
|
+
"data": {
|
|
199
|
+
"store": "models",
|
|
200
|
+
"scope": "global+project",
|
|
201
|
+
"readOnly": true,
|
|
202
|
+
"status": "invalid",
|
|
203
|
+
"revision": "sha256:5a61d4d3f5ab4f7f2f2f2cbb8ac7e2b1",
|
|
204
|
+
"layers": [
|
|
205
|
+
{ "source": "global", "status": "invalid" },
|
|
206
|
+
{ "source": "project", "status": "ok" }
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
`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:
|
|
213
|
+
|
|
214
|
+
```json
|
|
215
|
+
{
|
|
216
|
+
"store": "pins",
|
|
217
|
+
"scope": "local+repo",
|
|
218
|
+
"readOnly": false,
|
|
219
|
+
"status": "ok",
|
|
220
|
+
"revision": "sha256:0d19c0b7f0a94c29d5c33a0b1c9e6d21",
|
|
221
|
+
"value": {
|
|
222
|
+
"resolved": true,
|
|
223
|
+
"winner": { "source": "repo", "profile": "team" },
|
|
224
|
+
"invalid": [],
|
|
225
|
+
"stale": [{ "source": "local", "profile": "retired" }]
|
|
226
|
+
},
|
|
227
|
+
"layers": [
|
|
228
|
+
{ "source": "local", "status": "ok" },
|
|
229
|
+
{ "source": "repo", "status": "ok" }
|
|
230
|
+
]
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
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.
|
|
235
|
+
|
|
236
|
+
`pins.status` has exactly three meanings:
|
|
237
|
+
|
|
238
|
+
- `ok` — a layer named a profile the global profiles store still defines; `value.winner` says which layer and profile.
|
|
239
|
+
- `missing` — neither pin file exists, so there is nothing to resolve.
|
|
240
|
+
- `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.
|
|
241
|
+
|
|
242
|
+
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.
|
|
243
|
+
|
|
244
|
+
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.
|
|
245
|
+
|
|
246
|
+
#### Write targets
|
|
247
|
+
|
|
248
|
+
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:
|
|
249
|
+
|
|
250
|
+
| `store` | `target` values | File |
|
|
251
|
+
| --- | --- | --- |
|
|
252
|
+
| `profiles` | `global` | `<configHome>/profiles.json` |
|
|
253
|
+
| `profile_fallbacks` | `global` | `<configHome>/profile-fallbacks.json` |
|
|
254
|
+
| `pins` | `local`, `repo` | `<git-common-dir>/gentle-ai/profile-pin.json`, `<worktree-root>/.pi/gentle-ai/profile.json` |
|
|
255
|
+
|
|
256
|
+
`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:
|
|
257
|
+
|
|
258
|
+
- a target that is missing and a different target state can never collide, because `status` differs;
|
|
259
|
+
- 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".
|
|
260
|
+
|
|
261
|
+
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.
|
|
262
|
+
|
|
263
|
+
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.
|
|
264
|
+
|
|
265
|
+
### Revision limits
|
|
266
|
+
|
|
267
|
+
`revision` is a `sha256` digest over canonical JSON (sorted keys, `undefined` members dropped) of `{store, status, value}` for that read. It is stable across equivalent reads: reformatting a file, reordering its keys, or touching its mtime does not move it, while any change to normalized content does. The same caveat as `writeRevision` applies: a read that produced no content (`missing`, `invalid`) digests only `{store, status}`, so two different broken files for one store share a read revision. It is deliberately not a transaction token:
|
|
268
|
+
|
|
269
|
+
- it is computed **at read time**, after the owner normalized the content, not from file bytes and not from an owner-maintained counter;
|
|
270
|
+
- there is no watcher, no subscription, and no cross-process lock, so two processes can each see a different revision at the same wall-clock moment and neither is told when the other writes;
|
|
271
|
+
- a multi-layer store (`models`, `subagents`, `pins`) can change between the individual layer reads that make up one projection; that projection is still a truthful report of the layers that were read;
|
|
272
|
+
- it orders nothing, so it must never be compared between sessions or used as a precondition for a write. `expectedRevision` is the only precondition this contract accepts, and it is compared against `writeTargets[].writeRevision` — never against `revision`.
|
|
273
|
+
|
|
274
|
+
### `set_config`
|
|
275
|
+
|
|
276
|
+
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.
|
|
277
|
+
|
|
278
|
+
```json
|
|
279
|
+
{
|
|
280
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
281
|
+
"requestId": "desktop-48",
|
|
282
|
+
"method": "set_config",
|
|
283
|
+
"params": {
|
|
284
|
+
"store": "profiles",
|
|
285
|
+
"data": {
|
|
286
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
287
|
+
"version": 1,
|
|
288
|
+
"active": "team",
|
|
289
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
290
|
+
},
|
|
291
|
+
"expectedRevision": "sha256:8f2a0c5e2d7b4319a6f80e1c93b4d271"
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
| Param | Required | Type | Meaning |
|
|
297
|
+
| --- | --- | --- | --- |
|
|
298
|
+
| `store` | yes | `profiles` \| `profile_fallbacks` \| `pins` | The one store to write. |
|
|
299
|
+
| `data` | yes | store-specific object (below) | The **complete** new content of that store, not a patch. |
|
|
300
|
+
| `expectedRevision` | yes | string | `writeTargets[].writeRevision` of the target as the client last read it. |
|
|
301
|
+
|
|
302
|
+
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.
|
|
303
|
+
|
|
304
|
+
#### `data` for `profiles`
|
|
305
|
+
|
|
306
|
+
The complete `AgentProfilesFile`, exactly as the owner serializes it:
|
|
307
|
+
|
|
308
|
+
```json
|
|
309
|
+
{
|
|
310
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
311
|
+
"version": 1,
|
|
312
|
+
"active": "team",
|
|
313
|
+
"profiles": {
|
|
314
|
+
"team": {
|
|
315
|
+
"explore": { "model": "anthropic/claude-sonnet-4" },
|
|
316
|
+
"orchestrator": { "model": "openai/gpt-5" }
|
|
317
|
+
}
|
|
318
|
+
},
|
|
319
|
+
"workflow": { "team": { "orchestratorMode": "full-delegation" } }
|
|
320
|
+
}
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
| Field | Required | Meaning |
|
|
324
|
+
| --- | --- | --- |
|
|
325
|
+
| `kind` | yes | Exactly `gentle-pi.agent_model_profiles`. |
|
|
326
|
+
| `version` | yes | Exactly `1`. |
|
|
327
|
+
| `active` | no | Name of the globally active profile. Omitting it clears the marker. |
|
|
328
|
+
| `profiles` | yes | Profile name → routing map (agent name → `{model?, thinking?, tier?}`). Agent keys and model ids must satisfy the owner's safe-key policy. |
|
|
329
|
+
| `workflow` | no | Profile name → `{orchestratorMode: "organic" \| "full-delegation"}`. Non-default modes only; an all-organic map is not persisted. |
|
|
330
|
+
|
|
331
|
+
#### `data` for `profile_fallbacks`
|
|
332
|
+
|
|
333
|
+
The complete `FallbacksFile`, exactly as the owner normalizes it:
|
|
334
|
+
|
|
335
|
+
```json
|
|
336
|
+
{
|
|
337
|
+
"kind": "gentle-pi.profile_model_fallbacks",
|
|
338
|
+
"version": 1,
|
|
339
|
+
"profiles": {
|
|
340
|
+
"team": {
|
|
341
|
+
"*": [{ "model": "openai/gpt-shared" }],
|
|
342
|
+
"worker": [{ "model": "openai/gpt-fallback", "thinking": "low" }]
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
`*` 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.
|
|
349
|
+
|
|
350
|
+
#### `data` for `pins`
|
|
351
|
+
|
|
352
|
+
One selected layer and what it should hold — a profile to pin, or `null` to clear it:
|
|
353
|
+
|
|
354
|
+
```json
|
|
355
|
+
{ "source": "local", "profile": "team" }
|
|
356
|
+
```
|
|
357
|
+
|
|
358
|
+
```json
|
|
359
|
+
{ "source": "repo", "profile": null }
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
| Field | Required | Meaning |
|
|
363
|
+
| --- | --- | --- |
|
|
364
|
+
| `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. |
|
|
365
|
+
| `profile` | yes | Name of a profile the `profiles` store currently defines, **or `null` to remove this layer's pin file**. |
|
|
366
|
+
|
|
367
|
+
`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.
|
|
368
|
+
|
|
369
|
+
`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.
|
|
370
|
+
|
|
371
|
+
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.
|
|
372
|
+
|
|
373
|
+
#### Validation and revision guard
|
|
374
|
+
|
|
375
|
+
The checks below run in this order, and the first one that fails answers the request. Nothing is read or written after a rejection.
|
|
376
|
+
|
|
377
|
+
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.
|
|
378
|
+
2. **Store identity** (`unknown_store`): the string must be one of the six store identifiers.
|
|
379
|
+
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.
|
|
380
|
+
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.
|
|
381
|
+
5. **Session roots** (`config_unavailable`): the bound session must have a working directory.
|
|
382
|
+
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`.
|
|
383
|
+
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.
|
|
384
|
+
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.
|
|
385
|
+
9. **Report**: the store is re-read and the response reports the result.
|
|
386
|
+
|
|
387
|
+
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.
|
|
388
|
+
|
|
389
|
+
#### Success
|
|
390
|
+
|
|
391
|
+
```json
|
|
392
|
+
{
|
|
393
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
394
|
+
"kind": "response",
|
|
395
|
+
"requestId": "desktop-48",
|
|
396
|
+
"ok": true,
|
|
397
|
+
"data": {
|
|
398
|
+
"store": "profiles",
|
|
399
|
+
"scope": "global",
|
|
400
|
+
"readOnly": false,
|
|
401
|
+
"status": "ok",
|
|
402
|
+
"revision": "sha256:1c8065f530f01fb3c8e1dc33a2001b63",
|
|
403
|
+
"value": {
|
|
404
|
+
"kind": "gentle-pi.agent_model_profiles",
|
|
405
|
+
"version": 1,
|
|
406
|
+
"active": "team",
|
|
407
|
+
"profiles": { "team": { "explore": { "model": "anthropic/claude-sonnet-4" } } }
|
|
408
|
+
},
|
|
409
|
+
"layers": [{ "source": "global", "status": "ok" }],
|
|
410
|
+
"writeTargets": [{ "target": "global", "status": "ok", "writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78" }],
|
|
411
|
+
"writeTarget": "global",
|
|
412
|
+
"writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78",
|
|
413
|
+
"changed": true
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
```
|
|
417
|
+
|
|
418
|
+
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:
|
|
419
|
+
|
|
420
|
+
| Field | Meaning |
|
|
421
|
+
| --- | --- |
|
|
422
|
+
| `writeTarget` | The target this request named: `global`, `local`, or `repo`. |
|
|
423
|
+
| `writeRevision` | That target's resulting revision, to use as `expectedRevision` on the next write. |
|
|
424
|
+
| `changed` | `true` only if this request actually changed the target's content. A no-op answers `false` with the unchanged state and no event. |
|
|
425
|
+
|
|
426
|
+
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.
|
|
427
|
+
|
|
428
|
+
#### Failures
|
|
429
|
+
|
|
430
|
+
```json
|
|
431
|
+
{
|
|
432
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
433
|
+
"kind": "response",
|
|
434
|
+
"requestId": "desktop-49",
|
|
435
|
+
"ok": false,
|
|
436
|
+
"error": { "code": "revision_conflict", "message": "Config changed since expectedRevision was read" }
|
|
437
|
+
}
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
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.
|
|
441
|
+
|
|
442
|
+
### `get_permission_mode`
|
|
443
|
+
|
|
444
|
+
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.
|
|
445
|
+
|
|
446
|
+
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.
|
|
447
|
+
|
|
448
|
+
```json
|
|
449
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-43", "method": "get_permission_mode", "params": {} }
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
```json
|
|
453
|
+
{
|
|
454
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
455
|
+
"kind": "response",
|
|
456
|
+
"requestId": "desktop-43",
|
|
457
|
+
"ok": true,
|
|
458
|
+
"data": { "mode": "normal", "default_mode": "normal" }
|
|
459
|
+
}
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
`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`.
|
|
463
|
+
|
|
464
|
+
### `set_permission_mode`
|
|
465
|
+
|
|
466
|
+
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`.
|
|
467
|
+
|
|
468
|
+
```json
|
|
469
|
+
{
|
|
470
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
471
|
+
"requestId": "desktop-44",
|
|
472
|
+
"method": "set_permission_mode",
|
|
473
|
+
"params": { "mode": "auto", "persist": true }
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
| Param | Required | Type | Meaning |
|
|
478
|
+
| --- | --- | --- | --- |
|
|
479
|
+
| `mode` | yes | `normal` \| `auto` \| `yolo` \| `super-yolo` | Session mode to apply now. |
|
|
480
|
+
| `persist` | no | boolean, default `false` | Also save `mode` as the trusted default for new primary sessions. |
|
|
481
|
+
|
|
482
|
+
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.
|
|
483
|
+
|
|
484
|
+
```json
|
|
485
|
+
{
|
|
486
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
487
|
+
"kind": "response",
|
|
488
|
+
"requestId": "desktop-44",
|
|
489
|
+
"ok": true,
|
|
490
|
+
"data": { "mode": "auto", "default_mode": "auto", "persisted": true, "changed": true }
|
|
491
|
+
}
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
`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.
|
|
495
|
+
|
|
496
|
+
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:
|
|
497
|
+
|
|
498
|
+
```json
|
|
499
|
+
{
|
|
500
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
501
|
+
"kind": "response",
|
|
502
|
+
"requestId": "desktop-45",
|
|
503
|
+
"ok": true,
|
|
504
|
+
"data": {
|
|
505
|
+
"mode": "auto",
|
|
506
|
+
"default_mode": "normal",
|
|
507
|
+
"persisted": false,
|
|
508
|
+
"changed": true,
|
|
509
|
+
"persist_error": { "code": "default_unchanged", "message": "Default permission mode unchanged" }
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
```
|
|
513
|
+
|
|
514
|
+
### `get_subscription_usage`
|
|
515
|
+
|
|
516
|
+
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.
|
|
517
|
+
|
|
518
|
+
```json
|
|
519
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-50", "method": "get_subscription_usage", "params": {} }
|
|
520
|
+
```
|
|
521
|
+
|
|
522
|
+
```json
|
|
523
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-51", "method": "get_subscription_usage", "params": { "provider": "openai-codex" } }
|
|
524
|
+
```
|
|
525
|
+
|
|
526
|
+
| Param | Required | Type | Meaning |
|
|
527
|
+
| --- | --- | --- | --- |
|
|
528
|
+
| `provider` | no | string | Narrow the answer to one provider. Unknown names answer `unavailable`, never an error. |
|
|
529
|
+
|
|
530
|
+
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.
|
|
531
|
+
|
|
532
|
+
Success:
|
|
533
|
+
|
|
534
|
+
```json
|
|
535
|
+
{
|
|
536
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
537
|
+
"kind": "response",
|
|
538
|
+
"requestId": "desktop-51",
|
|
539
|
+
"ok": true,
|
|
540
|
+
"data": {
|
|
541
|
+
"providers": [
|
|
542
|
+
{
|
|
543
|
+
"provider": "openai-codex",
|
|
544
|
+
"status": "ok",
|
|
545
|
+
"fetchedAt": 1788600000000,
|
|
546
|
+
"plan": "pro",
|
|
547
|
+
"limits": [
|
|
548
|
+
{
|
|
549
|
+
"name": "codex",
|
|
550
|
+
"limitReached": false,
|
|
551
|
+
"windows": [
|
|
552
|
+
{ "label": "week", "usedPercent": 40, "windowSeconds": 604800, "resetAt": 1788777491000 }
|
|
553
|
+
]
|
|
554
|
+
}
|
|
555
|
+
]
|
|
556
|
+
}
|
|
557
|
+
]
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
```
|
|
561
|
+
|
|
562
|
+
Each entry carries only the safe fields of the owner's recorded snapshot:
|
|
563
|
+
|
|
564
|
+
| Field | Meaning |
|
|
565
|
+
| --- | --- |
|
|
566
|
+
| `provider` | The provider identifier. |
|
|
567
|
+
| `status` | One of `ok`, `pending`, `stale`, `failed`, `unavailable` — see below. |
|
|
568
|
+
| `fetchedAt` | When the snapshot was recorded, present when there is a snapshot. |
|
|
569
|
+
| `plan` | The plan name the owner already recorded, present only when public; never enriched from auth or account state. |
|
|
570
|
+
| `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. |
|
|
571
|
+
|
|
572
|
+
`status` is derived only from facts the owner already holds:
|
|
573
|
+
|
|
574
|
+
- `ok` — a snapshot is recorded and fresh.
|
|
575
|
+
- `stale` — a snapshot is recorded but older than the 5-minute refresh window (refreshable providers only).
|
|
576
|
+
- `pending` — no snapshot yet, the provider is supported, and its latest refresh did not fail.
|
|
577
|
+
- `failed` — no snapshot and the latest refresh settled empty.
|
|
578
|
+
- `unavailable` — the provider is not supported (no built-in fetcher and no registered usage source).
|
|
579
|
+
|
|
580
|
+
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.
|
|
581
|
+
|
|
582
|
+
### `refresh_subscription_usage`
|
|
583
|
+
|
|
584
|
+
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.
|
|
585
|
+
|
|
586
|
+
```json
|
|
587
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-52", "method": "refresh_subscription_usage", "params": { "provider": "openai-codex" } }
|
|
588
|
+
```
|
|
589
|
+
|
|
590
|
+
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.
|
|
591
|
+
|
|
592
|
+
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`.
|
|
593
|
+
|
|
594
|
+
```json
|
|
595
|
+
{
|
|
596
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
597
|
+
"kind": "response",
|
|
598
|
+
"requestId": "desktop-54",
|
|
599
|
+
"ok": true,
|
|
600
|
+
"data": {
|
|
601
|
+
"providers": [
|
|
602
|
+
{ "provider": "openai-codex", "status": "pending", "refresh": "out_of_scope" }
|
|
603
|
+
]
|
|
604
|
+
}
|
|
605
|
+
}
|
|
606
|
+
```
|
|
607
|
+
|
|
608
|
+
`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.
|
|
609
|
+
|
|
610
|
+
```json
|
|
611
|
+
{
|
|
612
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
613
|
+
"kind": "response",
|
|
614
|
+
"requestId": "desktop-53",
|
|
615
|
+
"ok": true,
|
|
616
|
+
"data": {
|
|
617
|
+
"providers": [
|
|
618
|
+
{ "provider": "anthropic", "status": "pending", "refresh": "unsupported" }
|
|
619
|
+
]
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
```
|
|
623
|
+
|
|
624
|
+
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.
|
|
625
|
+
|
|
626
|
+
### `get_design_canvas`
|
|
627
|
+
|
|
628
|
+
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.
|
|
629
|
+
|
|
630
|
+
```json
|
|
631
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-55", "method": "get_design_canvas", "params": {} }
|
|
632
|
+
```
|
|
633
|
+
|
|
634
|
+
```json
|
|
635
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-56", "method": "get_design_canvas", "params": { "includeUrl": true } }
|
|
636
|
+
```
|
|
637
|
+
|
|
638
|
+
| Param | Required | Type | Meaning |
|
|
639
|
+
| --- | --- | --- | --- |
|
|
640
|
+
| `includeUrl` | no | boolean | Include the tokenized canvas URL. Only honored for an interactive RPC host (the trust gate below); omitted by default. |
|
|
641
|
+
|
|
642
|
+
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.
|
|
643
|
+
|
|
644
|
+
Success:
|
|
645
|
+
|
|
646
|
+
```json
|
|
647
|
+
{
|
|
648
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
649
|
+
"kind": "response",
|
|
650
|
+
"requestId": "desktop-56",
|
|
651
|
+
"ok": true,
|
|
652
|
+
"data": {
|
|
653
|
+
"running": true,
|
|
654
|
+
"slug": "login",
|
|
655
|
+
"connectedClients": 1,
|
|
656
|
+
"designs": [
|
|
657
|
+
{ "slug": "login", "title": "Login screen", "mtime": 1788600000000 },
|
|
658
|
+
{ "slug": "pricing", "title": "Pricing page", "mtime": 1788500000000 }
|
|
659
|
+
],
|
|
660
|
+
"url": "http://127.0.0.1:4100/<token>/d/login/"
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
```
|
|
664
|
+
|
|
665
|
+
| Field | Meaning |
|
|
666
|
+
| --- | --- |
|
|
667
|
+
| `running` | Whether the session's canvas server is actually running, as the owner reports it. |
|
|
668
|
+
| `slug` | The slug the canvas last showed, or `null` for the system-only root. `null` is not "stopped": `running` answers that. |
|
|
669
|
+
| `connectedClients` | How many canvas pages the running server has connected (live-reload streams). `0` when stopped. |
|
|
670
|
+
| `designs` | The designs under `<cwd>/design` the owner's `listDesigns` reports (`slug`, `title`, `mtime`), most recent first. Empty when none exist. |
|
|
671
|
+
| `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. |
|
|
672
|
+
|
|
673
|
+
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`:
|
|
674
|
+
|
|
675
|
+
```json
|
|
676
|
+
{
|
|
677
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
678
|
+
"kind": "response",
|
|
679
|
+
"requestId": "desktop-57",
|
|
680
|
+
"ok": false,
|
|
681
|
+
"error": { "code": "design_unavailable", "message": "Design canvas owner unavailable for this session" }
|
|
682
|
+
}
|
|
683
|
+
```
|
|
684
|
+
|
|
685
|
+
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.
|
|
686
|
+
|
|
687
|
+
### `list_jobs`
|
|
688
|
+
|
|
689
|
+
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.
|
|
690
|
+
|
|
691
|
+
```json
|
|
692
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-58", "method": "list_jobs", "params": {} }
|
|
693
|
+
```
|
|
694
|
+
|
|
695
|
+
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.
|
|
696
|
+
|
|
697
|
+
Success:
|
|
698
|
+
|
|
699
|
+
```json
|
|
700
|
+
{
|
|
701
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
702
|
+
"kind": "response",
|
|
703
|
+
"requestId": "desktop-58",
|
|
704
|
+
"ok": true,
|
|
705
|
+
"data": {
|
|
706
|
+
"jobs": [
|
|
707
|
+
{ "id": "job-1", "label": "CI for PR 42", "status": "running", "startedAt": 1788600000000 },
|
|
708
|
+
{ "id": "job-2", "label": "Deploy staging", "status": "exited", "startedAt": 1788599000000, "endedAt": 1788599500000, "exitCode": 0 }
|
|
709
|
+
]
|
|
710
|
+
}
|
|
711
|
+
}
|
|
712
|
+
```
|
|
713
|
+
|
|
714
|
+
Each entry carries only the whitelisted fields of the owner's `JobRecord`:
|
|
715
|
+
|
|
716
|
+
| Field | Meaning |
|
|
717
|
+
| --- | --- |
|
|
718
|
+
| `id` | The owner's opaque job identifier. |
|
|
719
|
+
| `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. |
|
|
720
|
+
| `status` | One of `running`, `exited`, `stopped`, or `failed`. |
|
|
721
|
+
| `startedAt` | When the job started, in milliseconds. |
|
|
722
|
+
| `endedAt` | When a non-running job ended, present only after it ends. |
|
|
723
|
+
| `exitCode` | The job's own exit code, present only when the owner recorded one (`null` for an exit without a code). |
|
|
724
|
+
|
|
725
|
+
No command text, working directory, output path or tail, environment, owner session id, monitor counters, or error string ever crosses the wire. The list is bounded: running jobs first (newest start first), then recently-finished jobs (newest end first) within a 60-second linger, capped at 50 entries, so the answer can never grow with the process lifetime. When the jobs owner is absent (the owning extension is not loaded), the answer is `jobs_unavailable` — never a fabricated empty list.
|
|
726
|
+
|
|
727
|
+
### `cancel_job`
|
|
728
|
+
|
|
729
|
+
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 }`.
|
|
730
|
+
|
|
731
|
+
```json
|
|
732
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-59", "method": "cancel_job", "params": { "id": "job-1" } }
|
|
733
|
+
```
|
|
734
|
+
|
|
735
|
+
| Param | Required | Type | Meaning |
|
|
736
|
+
| --- | --- | --- | --- |
|
|
737
|
+
| `id` | yes | non-empty string | The job to stop, as reported by `list_jobs`. |
|
|
738
|
+
|
|
739
|
+
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.
|
|
740
|
+
|
|
741
|
+
```json
|
|
742
|
+
{
|
|
743
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
744
|
+
"kind": "response",
|
|
745
|
+
"requestId": "desktop-59",
|
|
746
|
+
"ok": true,
|
|
747
|
+
"data": {
|
|
748
|
+
"job": { "id": "job-1", "label": "CI for PR 42", "status": "stopped", "startedAt": 1788600000000, "endedAt": 1788601000000 }
|
|
749
|
+
}
|
|
750
|
+
}
|
|
751
|
+
```
|
|
752
|
+
|
|
753
|
+
The response is the **actual post-action state**, re-read from the owner — never an echo of the request. A job that was already terminal (an `exited`, `stopped`, or `failed` job) answers that terminal state with `status` unchanged and no `changed` marker, and emits no event; there is no race-driven error for a job that finished just before the cancel. The response line always precedes its `jobs_update` event.
|
|
754
|
+
|
|
755
|
+
### `list_subagents`
|
|
756
|
+
|
|
757
|
+
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.
|
|
758
|
+
|
|
759
|
+
```json
|
|
760
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-60", "method": "list_subagents", "params": {} }
|
|
761
|
+
```
|
|
762
|
+
|
|
763
|
+
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.
|
|
764
|
+
|
|
765
|
+
Success:
|
|
766
|
+
|
|
767
|
+
```json
|
|
768
|
+
{
|
|
769
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
770
|
+
"kind": "response",
|
|
771
|
+
"requestId": "desktop-60",
|
|
772
|
+
"ok": true,
|
|
773
|
+
"data": {
|
|
774
|
+
"agents": [
|
|
775
|
+
{
|
|
776
|
+
"id": "m3a1-worker",
|
|
777
|
+
"agent": "worker",
|
|
778
|
+
"status": "completed",
|
|
779
|
+
"model": "anthropic/claude-sonnet-4",
|
|
780
|
+
"modelSource": "binding",
|
|
781
|
+
"fallbackFrom": "anthropic/claude-opus-4",
|
|
782
|
+
"thinking": "high",
|
|
783
|
+
"lastStep": "answered",
|
|
784
|
+
"usage": { "total": 15234, "cost": 0.0421, "input": 12000, "output": 3234, "cache": 5000, "reasoning": 4000 }
|
|
785
|
+
}
|
|
786
|
+
]
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
```
|
|
790
|
+
|
|
791
|
+
Each entry carries only the whitelisted fields of the owner's `TaskRecord`:
|
|
792
|
+
|
|
793
|
+
| Field | Meaning |
|
|
794
|
+
| --- | --- |
|
|
795
|
+
| `id` | The owner's opaque task identifier. |
|
|
796
|
+
| `agent` | The helper's agent name. |
|
|
797
|
+
| `status` | One of `queued`, `running`, `waiting`, `completed`, `failed`, `cancelled`, or `timed_out`. |
|
|
798
|
+
| `model` | The routed model the helper launched with (or moved to). |
|
|
799
|
+
| `modelSource` | The launch-layer token that supplied `model` (`binding`, `frozen:*`, `pin:*`, `declaration`, `profile`, `definition`, or `default`), present only when the launch recorded one. |
|
|
800
|
+
| `fallbackFrom` | The model the run moved away from, present only after a fallback switch. |
|
|
801
|
+
| `thinking` | The thinking level the helper ran at, present only when one was resolved. |
|
|
802
|
+
| `lastStep` | A closed phase label derived from the task status, never the raw owner step text: `queued`, `waiting`, `running`, a fixed safe active step (`starting`, `writing`, `cleaning up`, `generating tool arguments`, `question dismissed`, `answered`, `interrupted`), or the generic terminal reason (`completed`, `failed`, `cancelled`, `timed_out`). Raw `TaskRecord.lastStep` text can carry an error message, a stderr tail, or a provider body, so it is mapped into this closed vocabulary and never forwarded. |
|
|
803
|
+
| `usage` | The helper's accumulated usage: `total` tokens, `cost`, and — once the run settled — the final-assistant `input`, `output`, `cache` (read + write), and `reasoning` token breakdown. The breakdown fields are absent for an in-flight task whose breakdown is not recorded yet, and for a restored finished task whose run never recorded one. |
|
|
804
|
+
|
|
805
|
+
No prompt text, tool arguments or output, working directory, session path, result, error text, or full session internals ever cross the wire. The list is bounded: active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries, so the answer can never grow with the process lifetime. When the agents owner is absent (the owning extension is not loaded), the answer is `agents_unavailable` — never a fabricated empty list.
|
|
806
|
+
|
|
807
|
+
### `cancel_subagent`
|
|
808
|
+
|
|
809
|
+
Stops one subagent through the same owner stop path the agents panel uses: `runner.cancel`. Params are exactly `{ id }`.
|
|
810
|
+
|
|
811
|
+
```json
|
|
812
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-61", "method": "cancel_subagent", "params": { "id": "m3a1-worker" } }
|
|
813
|
+
```
|
|
814
|
+
|
|
815
|
+
| Param | Required | Type | Meaning |
|
|
816
|
+
| --- | --- | --- | --- |
|
|
817
|
+
| `id` | yes | non-empty string | The subagent to cancel, as reported by `list_subagents`. |
|
|
818
|
+
|
|
819
|
+
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.
|
|
820
|
+
|
|
821
|
+
```json
|
|
822
|
+
{
|
|
823
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
824
|
+
"kind": "response",
|
|
825
|
+
"requestId": "desktop-61",
|
|
826
|
+
"ok": true,
|
|
827
|
+
"data": {
|
|
828
|
+
"agent": { "id": "m3a1-worker", "agent": "worker", "status": "cancelled", "model": "anthropic/claude-sonnet-4", "lastStep": "cancelled", "usage": { "total": 15234, "cost": 0.0421 } }
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
```
|
|
832
|
+
|
|
833
|
+
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:
|
|
834
|
+
|
|
835
|
+
- 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.
|
|
836
|
+
- A **running** task is cancelled asynchronously: `runner.cancel` returns `true` but the store has not transitioned yet, so the response reports the still-`running` state and emits **no immediate event**. The real transition (the child exit to `cancelled`) arrives later through the normal `agents_update` path. A repeated in-flight cancel is likewise `changed: false` with no event.
|
|
837
|
+
- An already-terminal task returns its terminal state with no event; there is no race-driven error for a task that finished just before the cancel. An unknown or foreign id is a typed `not_found`. The response line always precedes any `agents_update` event.
|
|
838
|
+
|
|
839
|
+
### `apply_profile`
|
|
840
|
+
|
|
841
|
+
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.
|
|
842
|
+
|
|
843
|
+
```json
|
|
844
|
+
{ "schema": "gentle-shell.desktop-rpc/v1", "requestId": "desktop-62", "method": "apply_profile", "params": { "profile": "team", "mode": "default" } }
|
|
845
|
+
```
|
|
846
|
+
|
|
847
|
+
| Param | Required | Type | Meaning |
|
|
848
|
+
| --- | --- | --- | --- |
|
|
849
|
+
| `profile` | yes | string, 1–128 characters | A saved profile name in `profiles.json`. |
|
|
850
|
+
| `mode` | yes | `"default"` or `"session"` | `default` makes the profile the global default; `session` binds it to this RPC session only. |
|
|
851
|
+
| `confirmation` | no | string, 1–128 characters | The `token` from a previous `confirmation_required` answer for the same `profile` and `mode`. |
|
|
852
|
+
|
|
853
|
+
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.
|
|
854
|
+
|
|
855
|
+
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:
|
|
856
|
+
|
|
857
|
+
```json
|
|
858
|
+
{
|
|
859
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
860
|
+
"kind": "response",
|
|
861
|
+
"requestId": "desktop-62",
|
|
862
|
+
"ok": true,
|
|
863
|
+
"data": {
|
|
864
|
+
"profile": "team",
|
|
865
|
+
"mode": "default",
|
|
866
|
+
"status": "confirmation_required",
|
|
867
|
+
"confirmation": {
|
|
868
|
+
"title": "Apply profile \"team\"?",
|
|
869
|
+
"message": "Profile \"team\" has agent routing entries. Applying it will replace global routing in … with this profile's routes: worker: openai/alpha (added). Continue?",
|
|
870
|
+
"token": "3f1c…"
|
|
871
|
+
}
|
|
872
|
+
}
|
|
873
|
+
}
|
|
874
|
+
```
|
|
875
|
+
|
|
876
|
+
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.
|
|
877
|
+
|
|
878
|
+
- **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).
|
|
879
|
+
- **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.
|
|
880
|
+
- **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.
|
|
881
|
+
|
|
882
|
+
Otherwise the answer is the outcome, with the screen's notices as `notes` (`level` is `info`, `warning`, or `error`):
|
|
883
|
+
|
|
884
|
+
```json
|
|
885
|
+
{
|
|
886
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
887
|
+
"kind": "response",
|
|
888
|
+
"requestId": "desktop-63",
|
|
889
|
+
"ok": true,
|
|
890
|
+
"data": {
|
|
891
|
+
"profile": "team",
|
|
892
|
+
"mode": "default",
|
|
893
|
+
"status": "applied",
|
|
894
|
+
"notes": [{ "level": "info", "text": "el Gentleman applied profile \"team\" — 1 agent updated. …" }]
|
|
895
|
+
}
|
|
896
|
+
}
|
|
897
|
+
```
|
|
898
|
+
|
|
899
|
+
`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.
|
|
900
|
+
|
|
901
|
+
`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`.
|
|
902
|
+
|
|
903
|
+
Only one apply runs at a time in a Pi process, across sessions. A request that arrives while another apply is running answers `profile_apply_busy` and changes nothing. While an apply runs, `set_config` for `profiles`, `profile_fallbacks`, and `pins` also answers `profile_apply_busy` and writes nothing: the apply rewrites the profiles store (and restores it on failure) from the snapshot it read, so an edit accepted mid-apply would otherwise be lost. Retry after the apply answers. The `/gentle:profiles` screen's Use in this session and Make default (including the save they make first) take the same gate, so they never run alongside a Desktop apply and a Desktop apply answers `profile_apply_busy` while one of them runs.
|
|
904
|
+
|
|
905
|
+
## Responses
|
|
906
|
+
|
|
907
|
+
Success:
|
|
908
|
+
|
|
909
|
+
```json
|
|
910
|
+
{
|
|
911
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
912
|
+
"kind": "response",
|
|
913
|
+
"requestId": "desktop-42",
|
|
914
|
+
"ok": true,
|
|
915
|
+
"data": {}
|
|
916
|
+
}
|
|
917
|
+
```
|
|
918
|
+
|
|
919
|
+
Failure:
|
|
920
|
+
|
|
921
|
+
```json
|
|
922
|
+
{
|
|
923
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
924
|
+
"kind": "response",
|
|
925
|
+
"requestId": "desktop-42",
|
|
926
|
+
"ok": false,
|
|
927
|
+
"error": {
|
|
928
|
+
"code": "unsupported_method",
|
|
929
|
+
"message": "Unsupported Desktop RPC method"
|
|
930
|
+
}
|
|
931
|
+
}
|
|
932
|
+
```
|
|
933
|
+
|
|
934
|
+
Current error codes are `invalid_request`, `unknown_store`, `read_only`, `invalid_data`, `revision_conflict`, `write_failed`, `unsupported_method`, `permission_unavailable`, `permission_denied`, `config_unavailable`, `usage_unavailable`, `design_unavailable`, `jobs_unavailable`, `agents_unavailable`, `profiles_unavailable`, `unknown_profile`, `profile_apply_busy`, `not_found`, and `internal_error`. A request that cannot supply a valid correlation ID uses `requestId: null`. State/provider failures use the generic `internal_error` message rather than exposing raw paths, credentials, or provider errors. Transport failures from `setWidget` are never retried as a second response.
|
|
935
|
+
|
|
936
|
+
| Code | Meaning |
|
|
937
|
+
| --- | --- |
|
|
938
|
+
| `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. |
|
|
939
|
+
| `unknown_store` | A store identifier this slice does not implement. Nothing was read or written. |
|
|
940
|
+
| `read_only` | `set_config` named `models`, `subagents`, or `managed_assets`. Rejected before the payload was inspected; nothing was written. |
|
|
941
|
+
| `invalid_data` | `set_config` data the owner would reject or would silently drop. Nothing was written, and no file was created. |
|
|
942
|
+
| `revision_conflict` | `expectedRevision` was missing, unusable, or no longer current. Nothing was written. |
|
|
943
|
+
| `write_failed` | The owner's atomic write threw. State is whatever the owner left; the message stays generic. |
|
|
944
|
+
| `unsupported_method` | Method not in `capabilities`. |
|
|
945
|
+
| `permission_unavailable` | The permission owner did not answer for this session (extension not loaded, or the session changed). State unchanged. |
|
|
946
|
+
| `permission_denied` | The owner refused the change (for example a non-interactive or replaced session). State unchanged. |
|
|
947
|
+
| `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. |
|
|
948
|
+
| `usage_unavailable` | The usage owner did not answer for this session (extension not loaded, or the session changed). State unchanged. |
|
|
949
|
+
| `design_unavailable` | The design canvas owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
950
|
+
| `jobs_unavailable` | The background-jobs owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
951
|
+
| `agents_unavailable` | The subagents owner did not answer for this session (the owning extension is not loaded, or the session changed). State unchanged. |
|
|
952
|
+
| `profiles_unavailable` | The profiles owner did not answer for this session (the owning extension is not loaded, the session changed, or no Desktop command bound a session context). Nothing was written. |
|
|
953
|
+
| `unknown_profile` | `apply_profile` named a profile that is not saved in `profiles.json`. No routing, settings, agents, or pins were written (a missing `profiles.json` may have been seeded). |
|
|
954
|
+
| `profile_apply_busy` | An `apply_profile` is still running; returned to a second `apply_profile` and to `set_config` for `profiles`, `profile_fallbacks`, or `pins`. Nothing was written by this request. |
|
|
955
|
+
| `not_found` | `cancel_job` named a job id, or `cancel_subagent` named a subagent id, that does not exist or belongs to another session. Nothing was stopped. |
|
|
956
|
+
| `internal_error` | Unexpected failure; message stays generic. |
|
|
957
|
+
|
|
958
|
+
## Events
|
|
959
|
+
|
|
960
|
+
Domain events use the same widget channel:
|
|
961
|
+
|
|
962
|
+
```json
|
|
963
|
+
{
|
|
964
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
965
|
+
"kind": "event",
|
|
966
|
+
"seq": 1,
|
|
967
|
+
"event": "example_event",
|
|
968
|
+
"data": {}
|
|
969
|
+
}
|
|
970
|
+
```
|
|
971
|
+
|
|
972
|
+
The event name above is illustrative; `capabilities` is authoritative for implemented events. `seq` starts at 1 after successful delivery in each newly started session and resets on session shutdown or reload. After shutdown the channel does not answer further commands. Clients should fetch `get_snapshot` after connecting and whenever they detect a sequence gap. Responses do not increment the event sequence.
|
|
973
|
+
|
|
974
|
+
### `permission_mode_changed`
|
|
975
|
+
|
|
976
|
+
Emitted at most once per successful `set_permission_mode`, always after its response line, and never for rejected, unavailable, or no-op requests:
|
|
977
|
+
|
|
978
|
+
```json
|
|
979
|
+
{
|
|
980
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
981
|
+
"kind": "event",
|
|
982
|
+
"seq": 1,
|
|
983
|
+
"event": "permission_mode_changed",
|
|
984
|
+
"data": {
|
|
985
|
+
"mode": "auto",
|
|
986
|
+
"previous_mode": "normal",
|
|
987
|
+
"default_mode": "auto",
|
|
988
|
+
"persisted": true,
|
|
989
|
+
"source": "desktop"
|
|
990
|
+
}
|
|
991
|
+
}
|
|
992
|
+
```
|
|
993
|
+
|
|
994
|
+
`source` is `desktop` because this slice only publishes events for changes it made itself; `persisted` reports whether that request saved the default. Mode changes made elsewhere in the session (for example a `/gentle:mode` prompt) are visible through `get_permission_mode` but do not emit this event. Two owner-side changes are also silent: the owner revoking YOLO when the workspace or interactive host changes, and the first permission call of a session pinning its mode to the saved default. Re-read with `get_permission_mode` after reconnecting or switching sessions. 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.
|
|
995
|
+
|
|
996
|
+
### `config_changed`
|
|
997
|
+
|
|
998
|
+
Emitted 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:
|
|
999
|
+
|
|
1000
|
+
```json
|
|
1001
|
+
{
|
|
1002
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1003
|
+
"kind": "event",
|
|
1004
|
+
"seq": 1,
|
|
1005
|
+
"event": "config_changed",
|
|
1006
|
+
"data": {
|
|
1007
|
+
"store": "profiles",
|
|
1008
|
+
"scope": "global",
|
|
1009
|
+
"writeTarget": "global",
|
|
1010
|
+
"revision": "sha256:1c8065f530f01fb3c8e1dc33a2001b63",
|
|
1011
|
+
"writeRevision": "sha256:c4b0afed3b2375ee0fb10e45a9545c78",
|
|
1012
|
+
"source": "desktop"
|
|
1013
|
+
}
|
|
1014
|
+
}
|
|
1015
|
+
```
|
|
1016
|
+
|
|
1017
|
+
`store`, `scope`, `revision`, and `writeRevision` are the resulting values, identical to the response that precedes the event, so a client that missed the response can reconcile from the event alone. `source` is `desktop` because this slice only publishes events for changes it made itself; a change made by `/gentle:profiles`, by the installer, or by another `pi` process becomes visible on the next read and emits nothing.
|
|
1018
|
+
|
|
1019
|
+
### `rate_limit`
|
|
1020
|
+
|
|
1021
|
+
Carries structured subscription-usage snapshots to subscribed Desktop consumers. It is emitted in two ways:
|
|
1022
|
+
|
|
1023
|
+
- **`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.
|
|
1024
|
+
- **`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.
|
|
1025
|
+
|
|
1026
|
+
```json
|
|
1027
|
+
{
|
|
1028
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1029
|
+
"kind": "event",
|
|
1030
|
+
"seq": 3,
|
|
1031
|
+
"event": "rate_limit",
|
|
1032
|
+
"data": {
|
|
1033
|
+
"source": "response",
|
|
1034
|
+
"snapshots": [
|
|
1035
|
+
{
|
|
1036
|
+
"provider": "anthropic",
|
|
1037
|
+
"status": "ok",
|
|
1038
|
+
"fetchedAt": 1788600000000,
|
|
1039
|
+
"limits": [
|
|
1040
|
+
{
|
|
1041
|
+
"name": "claude",
|
|
1042
|
+
"limitReached": false,
|
|
1043
|
+
"windows": [
|
|
1044
|
+
{ "label": "5h", "usedPercent": 25, "windowSeconds": 18000, "resetAt": null },
|
|
1045
|
+
{ "label": "week", "usedPercent": 90, "windowSeconds": 604800, "resetAt": null }
|
|
1046
|
+
]
|
|
1047
|
+
}
|
|
1048
|
+
]
|
|
1049
|
+
}
|
|
1050
|
+
]
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
```
|
|
1054
|
+
|
|
1055
|
+
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.
|
|
1056
|
+
|
|
1057
|
+
### `design_canvas`
|
|
1058
|
+
|
|
1059
|
+
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).
|
|
1060
|
+
|
|
1061
|
+
```json
|
|
1062
|
+
{
|
|
1063
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1064
|
+
"kind": "event",
|
|
1065
|
+
"seq": 2,
|
|
1066
|
+
"event": "design_canvas",
|
|
1067
|
+
"data": {
|
|
1068
|
+
"transition": "open",
|
|
1069
|
+
"running": true,
|
|
1070
|
+
"slug": "login",
|
|
1071
|
+
"connectedClients": 0,
|
|
1072
|
+
"url": "http://127.0.0.1:4100/<token>/d/login/"
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
```
|
|
1076
|
+
|
|
1077
|
+
| Field | Meaning |
|
|
1078
|
+
| --- | --- |
|
|
1079
|
+
| `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). |
|
|
1080
|
+
| `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`. |
|
|
1081
|
+
| `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. |
|
|
1082
|
+
|
|
1083
|
+
### `jobs_update`
|
|
1084
|
+
|
|
1085
|
+
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.
|
|
1086
|
+
|
|
1087
|
+
```json
|
|
1088
|
+
{
|
|
1089
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1090
|
+
"kind": "event",
|
|
1091
|
+
"seq": 2,
|
|
1092
|
+
"event": "jobs_update",
|
|
1093
|
+
"data": {
|
|
1094
|
+
"jobs": [
|
|
1095
|
+
{ "id": "job-1", "label": "CI for PR 42", "status": "stopped", "startedAt": 1788600000000, "endedAt": 1788601000000 }
|
|
1096
|
+
]
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
```
|
|
1100
|
+
|
|
1101
|
+
`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.
|
|
1102
|
+
|
|
1103
|
+
### `agents_update`
|
|
1104
|
+
|
|
1105
|
+
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.
|
|
1106
|
+
|
|
1107
|
+
```json
|
|
1108
|
+
{
|
|
1109
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1110
|
+
"kind": "event",
|
|
1111
|
+
"seq": 2,
|
|
1112
|
+
"event": "agents_update",
|
|
1113
|
+
"data": {
|
|
1114
|
+
"agents": [
|
|
1115
|
+
{ "id": "m3a1-worker", "agent": "worker", "status": "cancelled", "model": "anthropic/claude-sonnet-4", "lastStep": "completed", "usage": { "total": 15234, "cost": 0.0421 } }
|
|
1116
|
+
]
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
```
|
|
1120
|
+
|
|
1121
|
+
`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.
|
|
1122
|
+
|
|
1123
|
+
### `profile_applied`
|
|
1124
|
+
|
|
1125
|
+
Follows an `apply_profile` answer whose `status` is `applied`, after the response line.
|
|
1126
|
+
|
|
1127
|
+
```json
|
|
1128
|
+
{
|
|
1129
|
+
"schema": "gentle-shell.desktop-rpc/v1",
|
|
1130
|
+
"kind": "event",
|
|
1131
|
+
"seq": 3,
|
|
1132
|
+
"event": "profile_applied",
|
|
1133
|
+
"data": { "profile": "team", "mode": "default", "source": "desktop" }
|
|
1134
|
+
}
|
|
1135
|
+
```
|
|
1136
|
+
|
|
1137
|
+
`source` is always `desktop`: an apply from the `/gentle:profiles` screen emits nothing on this channel. `confirmation_required`, `not_applied`, and every error emit nothing. Clients that show profile state should re-read `get_config` for `profiles` after this event.
|
|
1138
|
+
|
|
1139
|
+
## Configuration limits
|
|
1140
|
+
|
|
1141
|
+
- **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`).
|
|
1142
|
+
- **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.
|
|
1143
|
+
- **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.
|
|
1144
|
+
- **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.
|
|
1145
|
+
- **Per-process guard, not a transaction.** The `expectedRevision` check and the owner's atomic rename happen in one synchronous step, so concurrent Desktop requests in one process cannot both commit from the same revision. Across processes there is no lock: another `pi` process, `/gentle:profiles`, or the installer can write between the check and the rename, and this contract cannot detect that. Treat `expectedRevision` as conflict detection, not as mutual exclusion.
|
|
1146
|
+
- **No paths, no secrets.** Physical paths are rejected as request input and never appear in a response, an event, or an error message. Content is limited to what these stores hold: profile names, routing entries, fallback chains, pin names, layer statuses, and asset ownership keys and hashes. `managed_assets` is additionally filtered to ownership-shaped entries — a relative asset path below the agent home plus a 64-hex sha256 digest — so an absolute path, a traversal segment, or an arbitrary string in the manifest is omitted rather than echoed. No credential, token, auth file, provider error, or conversation content is read or returned.
|
|
1147
|
+
- **Truthful normalization.** Content is what the owner's normalizer produced. Entries an owner drops (an unsafe agent key, an unknown thinking level, a stale `active` marker) are absent from `value`; if everything was dropped, the store reads `ok` with an empty map rather than being reported as `invalid`. A file the owner cannot parse at all reads `invalid`. A **write** may not rely on that leniency: data the normalizer would drop is rejected as `invalid_data`, so a Desktop write can never delete content it does not understand.
|
|
1148
|
+
- **No watcher.** Nothing is pushed except this slice's own `config_changed`. A change made by another `pi` process, by `/gentle:profiles`, or by the installer becomes visible on the next read and produces no event.
|
|
1149
|
+
- **This slice does not implement** permission changes beyond the existing slice, subscription usage beyond the read/refresh contract below, subagents beyond the list/cancel contract below, music, profile application, store materialization, or any Gentle Desktop client change.
|
|
1150
|
+
|
|
1151
|
+
## Permission limits
|
|
1152
|
+
|
|
1153
|
+
- The methods delegate to the Gentle AI extension's permission owner in the same Pi process. When that extension is not loaded, both methods answer `permission_unavailable` instead of guessing state.
|
|
1154
|
+
- Session changes require the owner's interactive-host admission: the TUI, or an RPC process with `GENTLE_SHELL_INTERACTIVE_HOST=1`. Headless RPC children and subagent children stay closed exactly as before.
|
|
1155
|
+
- Permission control is never an agent-callable tool; only `/gentle:desktop` over the interactive RPC channel reaches it.
|
|
1156
|
+
- This slice adds no filesystem watcher and no second store. 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` and `cancel_job` contract in [Jobs limits](#jobs-limits); subagents are limited to the `list_subagents` and `cancel_subagent` contract in [Subagents limits](#subagents-limits); music and any Desktop client change are not implemented.
|
|
1157
|
+
- Requests are not queued. Pi's own RPC loop dispatches prompts concurrently, so overlapping `set_permission_mode` calls reach the owner in whatever order their own reads finish, and one can apply right after the other. What stays guaranteed: every request gets exactly one correlated response, responses never cross, and each response and its optional event are published as an adjacent pair with a monotonic `seq`. Send permission requests one at a time and correlate with `requestId`; the maintainer probe does exactly that.
|
|
1158
|
+
|
|
1159
|
+
### Trust boundary
|
|
1160
|
+
|
|
1161
|
+
`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:
|
|
1162
|
+
|
|
1163
|
+
- `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.
|
|
1164
|
+
- 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.
|
|
1165
|
+
|
|
1166
|
+
## Usage limits
|
|
1167
|
+
|
|
1168
|
+
- **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.
|
|
1169
|
+
- **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.
|
|
1170
|
+
- **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`.
|
|
1171
|
+
- **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.
|
|
1172
|
+
- **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.
|
|
1173
|
+
- **No agent tool.** The usage surface is reachable only through `/gentle:desktop` over the interactive RPC channel, exactly like the permission and config slices.
|
|
1174
|
+
|
|
1175
|
+
## Design limits
|
|
1176
|
+
|
|
1177
|
+
- **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.
|
|
1178
|
+
- **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.
|
|
1179
|
+
- **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.
|
|
1180
|
+
- **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.
|
|
1181
|
+
- **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.
|
|
1182
|
+
- **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.
|
|
1183
|
+
|
|
1184
|
+
## Jobs limits
|
|
1185
|
+
|
|
1186
|
+
- **One owner, no second registry or process manager.** `list_jobs`, `cancel_job`, and the `jobs_update` event reach the existing jobs owner — the single parent-session `JobRegistry` plus the parent `MonitorController` — through a defensive, versioned owner-service adapter, the jobs analogue of the usage and design seams. There is no second registry, no second process manager, no subagent cancellation, and no cached copy.
|
|
1187
|
+
- **List + cancel only.** This slice has exactly two methods, `list_jobs` and `cancel_job`, and one event, `jobs_update`. It does not start jobs: `bash_background` and `monitor` stay agent tools, and there is no run/start method on this channel. `cancel_job` is `job_stop`'s exact stop path — the monitor controller's `cancel` (dropping timers and pending lines) followed by the registry's `stop` (aborting the process tree) — not a second stop implementation.
|
|
1188
|
+
- **Safe projection only.** The wire carries exactly `id`, `label`, `status`, `startedAt`, `endedAt?`, and `exitCode?`. No command text, working directory, output path or tail, environment, owner session id, monitor counters, or error string is ever returned or logged. A foreign field on an owner entry is dropped by the projection, never echoed.
|
|
1189
|
+
- **Bounded list.** `list_jobs` returns running jobs first (newest start first), then recently-finished jobs (newest end first) within a 60-second linger, capped at 50 entries. Finished jobs older than the linger drop out, so the answer can never grow with the process lifetime. That expiry is time-based and emits no `jobs_update`; a client that shows finished jobs should age them out with the same 60-second linger or re-read `list_jobs`.
|
|
1190
|
+
- **No-op and failure mean no event.** A `cancel_job` on an already-terminal job answers that terminal state with no event, and a `cancel_job` on an unknown or foreign id answers `not_found` with no event. A `job_stop` that finds the job already terminal likewise changes nothing and emits nothing. Only an actual registry change (start, settle, or a running→stopped transition) emits `jobs_update`.
|
|
1191
|
+
- **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a job started or stopped by the agent (or any other path through the owner) still arrives as a `jobs_update` event. Every actual registry change funnels through the owner's single `refreshJobStatus` path, including a monitor's self-timeout/flood stop, so no stop path can bypass the notification. The bridge dedupes byte-identical projected lists, so a stop that also flushes pending lines still emits exactly once. Session replacement or shutdown disconnects the observer and drops late outcomes, and the router's own publisher guard drops superseded events. A changed `cancel_job`'s response always precedes its event.
|
|
1192
|
+
- **Truthful absence.** When the owning extension is not loaded, `list_jobs` and `cancel_job` answer `jobs_unavailable` rather than inventing an empty list or a fake stop. A job that exists but belongs to another session is indistinguishable from an unknown id at this boundary: both answer `not_found`.
|
|
1193
|
+
|
|
1194
|
+
## Subagents limits
|
|
1195
|
+
|
|
1196
|
+
- **One owner, no second store or runner.** `list_subagents`, `cancel_subagent`, and the `agents_update` event reach the existing agents owner — the single parent-session `TaskStore` plus the parent `AgentRunner` — through a defensive, versioned owner-service adapter, the agents analogue of the jobs seam. There is no second store, no second runner, no subagent spawning, and no cached copy.
|
|
1197
|
+
- **List + cancel only.** This slice has exactly two methods, `list_subagents` and `cancel_subagent`, 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.
|
|
1198
|
+
- **Safe projection only.** The wire 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, tool arguments or output, working directory, session path, result, error text, or full session internals is ever returned or logged. A foreign field on an owner entry is dropped by the projection, never echoed.
|
|
1199
|
+
- **Bounded list.** `list_subagents` returns active tasks first (recency order), then recently-finished tasks (newest end first), capped at 50 entries. The store already evicts finished tasks beyond its own retention, so the answer can never grow with the process lifetime.
|
|
1200
|
+
- **No-op and failure mean no event.** A `cancel_subagent` on an already-terminal task answers that terminal state with no event, and a `cancel_subagent` on an unknown or foreign id answers `not_found` with no event. A running task's cancel is requested but asynchronous: the response reports the still-`running` state and emits no immediate byte-identical event; only the real store transition (the child exit to `cancelled`) emits through the normal `agents_update` path. Only an actual TaskStore transition (add, status change, or the completion-time usage recording) emits `agents_update`.
|
|
1201
|
+
- **Usage persists across restore.** The completion-time usage breakdown is written to the task's history record, so a restored finished task keeps its final breakdown. A task whose run never recorded a breakdown (no final-assistant observation) has no breakdown fields after restore.
|
|
1202
|
+
- **Agent work reaches the app.** The bridge subscribes to the owner eagerly at session start, so a subagent started or settled by the agent (or any other path through the owner) still arrives as an `agents_update` event. Bursts of transitions are coalesced into one event per window and byte-identical projected lists are deduped, so a settle that records usage right after its status change still emits exactly once. Session replacement or shutdown disconnects the observer, cancels the pending coalesced flush, and drops late outcomes, and the router's own publisher guard drops superseded events. A changed `cancel_subagent`'s response always precedes its event.
|
|
1203
|
+
- **Truthful absence.** When the owning extension is not loaded, `list_subagents` and `cancel_subagent` answer `agents_unavailable` rather than inventing an empty list or a fake stop. A task that exists but belongs to another session is indistinguishable from an unknown id at this boundary: both answer `not_found`.
|
|
1204
|
+
- **Unproven live-child boundary.** The deterministic tests drive the real owner with a real `TaskStore` and a real `AgentRunner` over a fake child (never a real process), and the maintainer probe lists the owner-loaded empty list without starting a child. This slice does not yet prove a live `cancel_subagent` of a running child over the installed runtime end to end; the in-process real-owner test exercises the real `runner.cancel` path and its eventual `agents_update`, but a real OS child is out of scope.
|
|
1205
|
+
|
|
1206
|
+
## Profiles limits
|
|
1207
|
+
|
|
1208
|
+
- **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.
|
|
1209
|
+
- **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`.
|
|
1210
|
+
- **Confirmation is Desktop's job.** The token binds an apply to the title and message that were shown and to the exact saved profile; it is not a proof that a person saw them.
|
|
1211
|
+
- **Truthful absence.** When the owning extension is not loaded, `apply_profile` answers `profiles_unavailable` rather than inventing an outcome.
|
|
1212
|
+
|
|
1213
|
+
## Verification
|
|
1214
|
+
|
|
1215
|
+
```sh
|
|
1216
|
+
node --experimental-strip-types --test \
|
|
1217
|
+
tests/desktop-rpc.test.ts \
|
|
1218
|
+
tests/desktop-rpc-permissions.test.ts \
|
|
1219
|
+
tests/desktop-rpc-config.test.ts \
|
|
1220
|
+
tests/desktop-rpc-usage.test.ts \
|
|
1221
|
+
tests/desktop-rpc-design.test.ts \
|
|
1222
|
+
tests/desktop-rpc-jobs.test.ts \
|
|
1223
|
+
tests/desktop-rpc-agents.test.ts \
|
|
1224
|
+
tests/desktop-rpc-profiles.test.ts \
|
|
1225
|
+
tests/maintainer/desktop-rpc.maintest.ts
|
|
1226
|
+
```
|
|
1227
|
+
|
|
1228
|
+
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.
|
|
1229
|
+
|
|
1230
|
+
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.
|
|
1231
|
+
|
|
1232
|
+
The usage tests use a fake owner service and a fake fetch/modelRegistry only: they cover the five statuses, the safe projection and plan-only-when-public rule, provider filters, unknown-provider `unavailable`, invalid params, refresh delegation with the provider filter forwarded, the response-before-event order over the router, the Anthropic typed `unsupported` no-op, the out-of-scope `out_of_scope` no-op (including the real owner never reaching the fetcher), content-based change detection (a same-millisecond payload change emits once, byte-equivalent data stays a no-op), late-discovery disposal after a reset, no duplicate event on no-op/failed refresh, raw-error and secret redaction, header-driven `rate_limit` events, stale-session disconnects, and the versioned adapter discovery. One test runs the real `gentleShell` owner seam to prove Claude's 5h/7d windows arrive as structured snapshots from response headers, never header text.
|
|
1233
|
+
|
|
1234
|
+
The jobs tests use the existing background-job fake (the same fake shell operations and monitor controller as the background-jobs tests) and a fake owner service only: they cover the whitelisted projection and field redaction, the bounded running + recent-finished selection, list/cancel param shapes, the active-session filter, owner absence (`jobs_unavailable`, never a fabricated empty list), the `job_stop` stop path (monitor cancel + registry stop), already-terminal idempotency with no event, unknown and foreign-session `not_found`, invalid params rejected before discovery, agent-driven `jobs_update` events with foreign-session filtering, the response-before-event order over the router, session reset disconnecting observers and dropping late outcomes, late-discovery disposal, and the versioned adapter discovery. They also drive the real `job_stop` tool to prove the change descriptor distinguishes a running→stopped stop from a no-op stop.
|
|
1235
|
+
|
|
1236
|
+
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 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`, and the persisted usage breakdown surviving `saveTask`/`loadStoredTask` restore.
|
|
1237
|
+
|
|
1238
|
+
The profiles tests use a fake owner service only: they cover param validation, owner absence (`profiles_unavailable`), the result shapes, the `profile_applied` event only after `applied`, and that the token changes with the mode, name, title, message, and profile content. The owner itself is covered in `tests/gentle-ai.test.ts`, which drives the real screen actions in a temporary config home: a default apply asks the screen's diff and writes nothing without its token, a wrong or stale token asks again and writes nothing, an unknown profile writes nothing, a session apply binds without writing shared state, and only one apply runs at a time.
|
|
1239
|
+
|
|
1240
|
+
The config tests build six stores in a temporary root and inject the worktree identity, so no real user config, agent home, or repository pin is read. On the read side they cover every store, current path precedence, missing and malformed layers, revision stability and change, the read-only split, rejected stores/params/paths, the bounded snapshot projection, and a byte-and-mtime comparison proving a read never mutates a store. On the write side they cover a valid write for each writable store and both pin layers, clearing either pin layer and observing the winner fall back, clearing an already-missing layer as a no-op, clearing and replacing an unreadable layer, creating a missing store, a stale or missing `expectedRevision` (including on a clear), the documented rejection order (envelope, then store identity, then mutability, then revision, then payload), data the owner would drop, malformed pin clear shapes, extra and physical-path keys, every read-only store, a forced owner write failure (the store path is a directory) answering `write_failed` with no path, OS code, or event and an unchanged tree, the no-op path with untouched bytes and mtime, the resulting disk bytes, revision movement and its invalid-state coarseness, the response-then-event order over the real transport, and that a stopped session neither answers nor writes. They also re-check that the config dispatcher still falls through to the permission bridge.
|
|
1241
|
+
|
|
1242
|
+
The maintainer probes run the installed Pi runtime with isolated HOME, agent home, config home, session, and temporary directories and no provider or network. They cover:
|
|
1243
|
+
|
|
1244
|
+
1. transport only — this extension alone proves slash-command dispatch, correlation, and that capabilities advertise the permission, config, usage, design, jobs, and subagents domains;
|
|
1245
|
+
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;
|
|
1246
|
+
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;
|
|
1247
|
+
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;
|
|
1248
|
+
5. usage owner — the real `extensions/gentle-shell.ts` usage owner is loaded alongside this extension, and the probe reads `get_subscription_usage` for `anthropic` and `openai-codex` and observes truthful offline `pending` answers with no event and no live provider fetch. It never calls `refresh_subscription_usage` against a live provider;
|
|
1249
|
+
6. design owner — the real `extensions/gentle-design.ts` design owner is loaded alongside this extension, and the probe reads `get_design_canvas` (with and without `includeUrl`) and observes the truthful owner-loaded stopped state (`running: false`, `slug: null`, `connectedClients: 0`, `designs: []`) with no event and no tokenized URL. It never starts a canvas server or opens a browser;
|
|
1250
|
+
7. jobs owner — the real `extensions/gentle-agents.ts` jobs owner is loaded alongside this extension, and the probe reads `list_jobs` and observes the truthful owner-loaded empty list (`jobs: []`) with no event and no command or output path on the wire. It never starts a job;
|
|
1251
|
+
8. subagents owner — the real `extensions/gentle-agents.ts` subagents owner is loaded alongside this extension, and the probe reads `list_subagents` and observes the truthful owner-loaded empty list (`agents: []`) with no event and no prompt text, session path, or working directory on the wire. It never starts a child.
|
|
1252
|
+
|
|
1253
|
+
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.
|