gentle-pi 4.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/assets/agents/gentle-ai-explore.md +1 -1
- package/assets/agents/gentle-ai-verify.md +1 -1
- package/assets/agents/gentle-ai-worker.md +10 -9
- package/assets/design-canvas/canvas-boards.js +22 -2
- package/assets/design-canvas/canvas-boot.js +3 -1
- package/assets/design-canvas/canvas-i18n-es.js +5 -0
- package/assets/design-canvas/canvas-menu.js +13 -7
- package/assets/design-canvas/canvas-messages.js +1 -1
- package/assets/design-canvas/canvas-rail.js +5 -2
- package/assets/design-canvas/canvas-store.js +3 -0
- package/assets/design-canvas/canvas-theme.js +69 -0
- package/assets/design-canvas/canvas.css +27 -2
- package/assets/design-canvas/index.html +3 -0
- package/assets/design-canvas/inspector.js +28 -5
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/migrations/agent-body-history.json +6 -0
- package/assets/orchestrator-delegation.md +1 -5
- package/assets/orchestrator-full-delegation-card.md +9 -13
- package/assets/orchestrator-full-delegation.md +2 -2
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-tracking.md +6 -6
- package/assets/orchestrator-verification.md +4 -4
- package/assets/orchestrator-writer.md +12 -12
- package/assets/orchestrator.md +2 -2
- package/bin/gentle-shell.mjs +77 -1
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +1 -1
- package/docs/delegated-verification.md +6 -4
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +703 -25
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +65 -3
- package/docs/images/desktop/chat.png +0 -0
- package/docs/images/desktop/palette.png +0 -0
- package/docs/images/desktop/todo.png +0 -0
- package/docs/install-wizard.md +1 -1
- package/docs/odd-preparation-continuity.md +1 -1
- package/docs/readme-reference.md +44 -15
- package/docs/work-continuity.md +10 -7
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +47 -8
- package/extensions/gentle-agents.ts +206 -37
- package/extensions/gentle-ai.ts +234 -24
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +145 -12
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +69 -7
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +13 -3
- package/herdr/RECIPE.md +157 -0
- package/herdr/keys.json +14 -0
- package/herdr/layouts/gentle-shell.json +202 -0
- package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-agents/main.js +190 -0
- package/herdr/mods/gentle-agents/mod.json +1 -0
- package/herdr/mods/gentle-agents/snapshot.js +469 -0
- package/herdr/mods/gentle-agents/tokens.js +273 -0
- package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
- package/herdr/mods/gentle-chat/actions.js +180 -0
- package/herdr/mods/gentle-chat/feed.js +321 -0
- package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
- package/herdr/mods/gentle-chat/icons/check.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
- package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
- package/herdr/mods/gentle-chat/icons/down.svg +1 -0
- package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
- package/herdr/mods/gentle-chat/icons/send.svg +1 -0
- package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
- package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
- package/herdr/mods/gentle-chat/icons/term.svg +1 -0
- package/herdr/mods/gentle-chat/icons/user.svg +1 -0
- package/herdr/mods/gentle-chat/icons/x.svg +1 -0
- package/herdr/mods/gentle-chat/main.js +968 -0
- package/herdr/mods/gentle-chat/mod.json +1 -0
- package/herdr/mods/gentle-chat/session.js +212 -0
- package/herdr/mods/gentle-chat/snapshot.js +469 -0
- package/herdr/mods/gentle-chat/tokens.js +137 -0
- package/herdr/mods/gentle-chat/ui.js +883 -0
- package/herdr/mods/gentle-confirm/main.js +60 -0
- package/herdr/mods/gentle-confirm/mod.json +1 -0
- package/herdr/mods/gentle-inspector/actions.js +180 -0
- package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
- package/herdr/mods/gentle-inspector/main.js +500 -0
- package/herdr/mods/gentle-inspector/mod.json +1 -0
- package/herdr/mods/gentle-inspector/snapshot.js +469 -0
- package/herdr/mods/gentle-inspector/tokens.js +273 -0
- package/herdr/mods/gentle-palette/actions.js +180 -0
- package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
- package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
- package/herdr/mods/gentle-palette/icons/check.svg +1 -0
- package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
- package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
- package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
- package/herdr/mods/gentle-palette/icons/review.svg +1 -0
- package/herdr/mods/gentle-palette/icons/search.svg +1 -0
- package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
- package/herdr/mods/gentle-palette/icons/term.svg +1 -0
- package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
- package/herdr/mods/gentle-palette/main.js +333 -0
- package/herdr/mods/gentle-palette/mod.json +1 -0
- package/herdr/mods/gentle-palette/snapshot.js +469 -0
- package/herdr/mods/gentle-palette/tokens.js +273 -0
- package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
- package/herdr/mods/gentle-pane/icons/close.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
- package/herdr/mods/gentle-pane/icons/term.svg +1 -0
- package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
- package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
- package/herdr/mods/gentle-pane/main.js +91 -0
- package/herdr/mods/gentle-pane/mod.json +1 -0
- package/herdr/mods/gentle-pane/snapshot.js +469 -0
- package/herdr/mods/gentle-pane/tokens.js +273 -0
- package/herdr/mods/gentle-sidebar/actions.js +180 -0
- package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
- package/herdr/mods/gentle-sidebar/main.js +171 -0
- package/herdr/mods/gentle-sidebar/mod.json +1 -0
- package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
- package/herdr/mods/gentle-sidebar/tokens.js +273 -0
- package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
- package/herdr/mods/gentle-spaces/machines.js +31 -0
- package/herdr/mods/gentle-spaces/main.js +299 -0
- package/herdr/mods/gentle-spaces/mod.json +1 -0
- package/herdr/mods/gentle-spaces/snapshot.js +469 -0
- package/herdr/mods/gentle-spaces/tokens.js +273 -0
- package/herdr/mods/gentle-status/actions.js +180 -0
- package/herdr/mods/gentle-status/main.js +192 -0
- package/herdr/mods/gentle-status/mod.json +1 -0
- package/herdr/mods/gentle-status/snapshot.js +469 -0
- package/herdr/mods/gentle-status/tokens.js +273 -0
- package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
- package/herdr/mods/gentle-tabs/main.js +171 -0
- package/herdr/mods/gentle-tabs/mod.json +1 -0
- package/herdr/mods/gentle-tabs/snapshot.js +469 -0
- package/herdr/mods/gentle-tabs/tokens.js +273 -0
- package/herdr/mods/gentle-tokens/main.js +20 -0
- package/herdr/mods/gentle-tokens/mod.json +1 -0
- package/herdr/mods/gentle-tokens/snapshot.js +469 -0
- package/herdr/mods/gentle-tokens/tokens.js +273 -0
- package/herdr/preview.png +0 -0
- package/herdr/themes/gentle-shell-dark.json +33 -0
- package/herdr/themes/gentle-shell-light.json +34 -0
- package/lib/agents-protocol.ts +2 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +1 -0
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +1 -1
- package/lib/change-diff.ts +104 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/design-canvas-assets.ts +2 -0
- package/lib/desktop-agents-service.ts +31 -10
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-feed-actions.ts +804 -0
- package/lib/desktop-feed-answers.ts +129 -0
- package/lib/desktop-feed-sources.ts +184 -0
- package/lib/desktop-feed-stats.ts +98 -0
- package/lib/desktop-feed-store.ts +124 -0
- package/lib/desktop-feed.ts +788 -0
- package/lib/desktop-jobs-service.ts +34 -7
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +112 -3
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +162 -8
- package/lib/desktop-rpc-jobs.ts +118 -9
- package/lib/desktop-rpc-permissions.ts +154 -3
- package/lib/desktop-rpc-review.ts +180 -0
- package/lib/desktop-rpc-session.ts +203 -0
- package/lib/desktop-rpc-sessions.ts +250 -0
- package/lib/desktop-rpc-stats.ts +187 -0
- package/lib/desktop-rpc-updates.ts +143 -0
- package/lib/desktop-rpc.ts +116 -5
- package/lib/desktop-session-service.ts +223 -0
- package/lib/desktop-sessions-service.ts +249 -0
- package/lib/desktop-stats-service.ts +142 -0
- package/lib/desktop-updates-service.ts +268 -0
- package/lib/gentle-shell-desktop.ts +1370 -0
- package/lib/gentle-shell-launcher.ts +45 -3
- package/lib/herdr-desktop-events.ts +40 -0
- package/lib/herdr-desktop-status.ts +229 -0
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/native-review-cli.ts +7 -0
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/stats-collector.ts +56 -27
- package/lib/tower-actions.ts +100 -0
- package/lib/tower-hub.ts +73 -0
- package/lib/tower-launch.ts +111 -0
- package/lib/tower-open.ts +99 -0
- package/lib/tower-presence.ts +70 -0
- package/lib/tower-server.ts +234 -0
- package/lib/tower-snapshot.ts +298 -0
- package/lib/update-status.ts +238 -0
- package/lib/verifier-settle-reminder.ts +1 -1
- package/package.json +13 -4
- package/runtime/design-canvas-assets.mjs +2 -0
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +7 -0
- package/runtime/tower-actions.mjs +101 -0
- package/runtime/tower-hub.mjs +74 -0
- package/runtime/tower-launch.mjs +112 -0
- package/runtime/tower-open.mjs +100 -0
- package/runtime/tower-presence.mjs +71 -0
- package/runtime/tower-server.mjs +234 -0
- package/runtime/tower-snapshot.mjs +299 -0
- package/scripts/build-full-delegation-card.mjs +1 -21
- package/scripts/build-runtime-modules.mjs +9 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/verify-package-files.mjs +35 -15
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +3 -3
- package/tests/agent-prompt-diet-contract.test.ts +2 -2
- package/tests/append-system-prompt-route.test.ts +16 -5
- package/tests/ask-user-choice.test.ts +78 -21
- package/tests/ask-user-question.test.ts +59 -5
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +139 -26
- package/tests/change-diff.test.ts +75 -0
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- package/tests/design-canvas-i18n.test.ts +24 -22
- package/tests/design-canvas-inspector.test.ts +67 -0
- package/tests/design-canvas-modules.test.ts +3 -2
- package/tests/design-canvas-rail.test.ts +10 -10
- package/tests/design-canvas-store.test.ts +9 -0
- package/tests/design-canvas-theme.test.ts +198 -0
- package/tests/design-canvas-tokens.test.ts +1 -1
- package/tests/desktop-feed-actions-guards.test.ts +595 -0
- package/tests/desktop-feed-actions.test.ts +761 -0
- package/tests/desktop-feed-live-work.test.ts +209 -0
- package/tests/desktop-feed-performance.test.ts +369 -0
- package/tests/desktop-feed-plan-profiles.test.ts +509 -0
- package/tests/desktop-feed-send-prompt.test.ts +303 -0
- package/tests/desktop-feed-tool-summaries.test.ts +69 -0
- package/tests/desktop-feed.test.ts +615 -0
- package/tests/desktop-rpc-agents.test.ts +428 -2
- package/tests/desktop-rpc-changes.test.ts +608 -0
- package/tests/desktop-rpc-config-watch.test.ts +1159 -0
- package/tests/desktop-rpc-config.test.ts +11 -1
- package/tests/desktop-rpc-design.test.ts +11 -1
- package/tests/desktop-rpc-jobs.test.ts +402 -5
- package/tests/desktop-rpc-permissions.test.ts +11 -1
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-session.test.ts +642 -0
- package/tests/desktop-rpc-sessions.test.ts +647 -0
- package/tests/desktop-rpc-stats.test.ts +431 -0
- package/tests/desktop-rpc-updates.test.ts +525 -0
- package/tests/desktop-rpc-usage.test.ts +11 -1
- package/tests/desktop-rpc.test.ts +43 -2
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +20 -1
- package/tests/gentle-agents.test.ts +519 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-installer.test.ts +52 -52
- package/tests/gentle-ai.test.ts +75 -16
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-desktop-bin.test.ts +125 -0
- package/tests/gentle-shell-desktop.test.ts +927 -0
- package/tests/gentle-shell-launcher-tower.test.ts +104 -0
- package/tests/gentle-shell.test.ts +3 -0
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/independent-recovery-delivery.test.ts +16 -4
- package/tests/installer-server.test.ts +2 -2
- package/tests/lazy-module-contradictions-contract.test.ts +27 -4
- package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
- package/tests/native-review-capability-contract.test.ts +9 -1
- package/tests/no-self-pause-contract.test.ts +23 -13
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +19 -3
- package/tests/orchestrator-budget.test.ts +3 -1
- package/tests/orchestrator-prompt-budget.test.ts +2 -1
- package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
- package/tests/package-manifest.test.ts +10 -10
- package/tests/pi-routing-measured-values.test.ts +24 -0
- package/tests/primary-session-prompt.test.ts +25 -0
- package/tests/profile-fast-tier.test.ts +66 -1
- package/tests/provider-defect-handoff.test.ts +118 -100
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-due-public-boundary.test.ts +2 -1
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +310 -16
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +5 -3
- package/tests/skill-registry.test.ts +54 -0
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +17 -0
- package/tests/task-size-routing-contract.test.ts +7 -3
- package/tests/tower-actions.test.ts +247 -0
- package/tests/tower-artifacts.test.ts +114 -0
- package/tests/tower-open.test.ts +97 -0
- package/tests/tower-presence.test.ts +175 -0
- package/tests/tower-server.test.ts +122 -0
- package/tests/tower-snapshot.test.ts +236 -0
- package/tests/tower-web-echo.test.ts +125 -0
- package/tests/tower-web-hover.test.ts +251 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +5 -5
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-first-launch-contract.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +83 -17
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
package/extensions/gentle-ai.ts
CHANGED
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
} from "node:fs/promises";
|
|
64
64
|
import { homedir } from "node:os";
|
|
65
65
|
import { PROVIDER_REVIEW_ROLES, discoverAgents, loadAgentsConfig, unmatchedProfileKeys } from "../lib/agents-config.ts";
|
|
66
|
-
import { dirname, isAbsolute, join, relative, resolve, sep } from "node:path";
|
|
66
|
+
import { dirname, isAbsolute, join, posix, relative, resolve, sep } from "node:path";
|
|
67
67
|
import { fileURLToPath } from "node:url";
|
|
68
68
|
import type {
|
|
69
69
|
ExtensionAPI,
|
|
@@ -152,7 +152,7 @@ import { createSessionProfileIntegration, hasPendingSessionProfileSelection, rea
|
|
|
152
152
|
import { publishSessionProfileOutcome, readSessionProfileAuthority, requireSessionProfileAuthority } from "../lib/session-profile-authority.ts";
|
|
153
153
|
import { isSessionProfileFamilyEntry, type SessionProfileStartupState } from "../lib/session-profile-persistence.ts";
|
|
154
154
|
import type { SessionProfileAppendOutcome } from "../lib/session-profile-append-controller.ts";
|
|
155
|
-
import { freezeSessionProfileAtOwnStart, profileFollowEnabled, readSessionProfileOwnStartup, resolveSessionProfile, sessionProfileLabel, sessionProfileModelProfiles, sessionProfileRoutingAt, setFrozenDefaultOrchestrator } from "../lib/session-profile-freeze.ts";
|
|
155
|
+
import { freezeSessionProfileAtOwnStart, profileFollowEnabled, readFrozenDefaultOrchestrator, readSessionProfileOwnStartup, resolveSessionProfile, sessionProfileLabel, sessionProfileModelProfiles, sessionProfileRoutingAt, setFrozenDefaultOrchestrator } from "../lib/session-profile-freeze.ts";
|
|
156
156
|
import {
|
|
157
157
|
applyOrchestratorSettings,
|
|
158
158
|
readOrchestratorSettings,
|
|
@@ -172,6 +172,13 @@ import {
|
|
|
172
172
|
type DesktopProfileNote,
|
|
173
173
|
type DesktopProfilesService,
|
|
174
174
|
} from "../lib/desktop-rpc-profiles.ts";
|
|
175
|
+
import {
|
|
176
|
+
DESKTOP_REVIEW_SERVICE_CHANNEL,
|
|
177
|
+
DESKTOP_REVIEW_SERVICE_SCHEMA,
|
|
178
|
+
type DesktopReviewOwnerRead,
|
|
179
|
+
type DesktopReviewOwnerWrite,
|
|
180
|
+
type DesktopReviewService,
|
|
181
|
+
} from "../lib/desktop-rpc-review.ts";
|
|
175
182
|
import {
|
|
176
183
|
REVIEW_HOST_RELAY_FAILURE,
|
|
177
184
|
REVIEW_HOST_RELAY_PI_TIMEOUT_ENV,
|
|
@@ -1683,6 +1690,10 @@ function resolveSessionDelegationMode(
|
|
|
1683
1690
|
|
|
1684
1691
|
const TEST_FIRST_PRINCIPLE = "- For behavior changes with applicable runnable deterministic tests and a clear expected outcome, use test-first by default: observe RED, GREEN, then refactor with focused checks. Write one RED test per requested rule. For every existing command or option the change touches, add one test proving its previous behavior still holds; add no other cases. An existing behavior counts as touched when it shares the code you changed (options, parsers, helpers, validation). Only when your diff changes shared code (options, parsers, helpers) that an existing command the request did not name also uses, run one differential check before finishing, as a single script: for each such command, run it with the new or changed input (for example a new option passed to a sibling subcommand) against the previous code (a copy of the base commit in a `mktemp -d` scratch directory, never committed as a test; committed tests never read git history or a fixed commit) and against your change, and compare stdout, stderr, and exit code; any difference nobody asked for is a regression to fix and pin with a test. Test presence alone does not establish applicability; no chat or TUI toggle activates it. For passive documentation, non-testable changes, an unavailable runner, or no meaningful RED, explain why and run proportionate ordinary functional or structural verification. Never invent lifecycle evidence or skip checks. Follow orchestrator-delegation.md for ODD forwarding and evidence.";
|
|
1685
1692
|
const FULL_DELEGATION_TEST_FIRST_PRINCIPLE = "- Writers apply test-first (RED, GREEN, PRESERVE with its differential check) from their own contract; forward it in every writer handoff and require their observed RED/GREEN evidence or stated exception. Never invent lifecycle evidence or skip checks.";
|
|
1693
|
+
// orchestrator-owns-correction-exhaustion S2: after a worker exhausts its limit the parent decides the next step
|
|
1694
|
+
// from the diagnosed cause; only organic mode may fix it inline, full delegation launches a new bounded writer.
|
|
1695
|
+
const EXHAUSTION_ROUTE = "fix inline if small and understood, or relaunch with changed scope, hypothesis or handoff plus new evidence";
|
|
1696
|
+
const FULL_DELEGATION_EXHAUSTION_ROUTE = "never edit: launch a new bounded writer with the diagnosis, new evidence and changed scope or hypothesis";
|
|
1686
1697
|
|
|
1687
1698
|
function buildGentlePrompt(
|
|
1688
1699
|
persona: PersonaMode,
|
|
@@ -1699,6 +1710,7 @@ function buildGentlePrompt(
|
|
|
1699
1710
|
// cost-speed-painpoints S5: writers apply the test-first procedure from their own
|
|
1700
1711
|
// contract; a full delegation parent only forwards it and checks the evidence.
|
|
1701
1712
|
const testFirstPrinciple = delegationMode === DEFAULT_ORCHESTRATOR_MODE ? TEST_FIRST_PRINCIPLE : FULL_DELEGATION_TEST_FIRST_PRINCIPLE;
|
|
1713
|
+
const exhaustionRoute = delegationMode === DEFAULT_ORCHESTRATOR_MODE ? EXHAUSTION_ROUTE : FULL_DELEGATION_EXHAUSTION_ROUTE;
|
|
1702
1714
|
return `## el Gentleman Identity and Harness
|
|
1703
1715
|
|
|
1704
1716
|
Current persona mode: ${persona}
|
|
@@ -1716,21 +1728,19 @@ ${personaPrompt}
|
|
|
1716
1728
|
|
|
1717
1729
|
## Authorized work continuity
|
|
1718
1730
|
|
|
1719
|
-
An authorized outcome includes its necessary in-scope implementation, documentation and verification steps. Continue those steps without asking the human to approve each transition. Never end a turn merely announcing an immediately executable authorized next step; execute it instead. A progress update is not a request for permission.
|
|
1731
|
+
An authorized outcome includes its necessary in-scope implementation, documentation and verification steps. Continue those steps without asking the human to approve each transition. Never end a turn merely announcing an immediately executable authorized next step; execute it instead. A progress update is not a request for permission. An explicit user stop applies only to the work it names.
|
|
1720
1732
|
|
|
1721
1733
|
Interpret short replies such as "yes", "go ahead", or "eso mismo" against the immediately preceding proposal. When the human unambiguously accepts a concrete implementation action they already understand, execute that action within its agreed scope without asking again. Confirming a preference alone does not authorize implementation; genuinely unclear change intent still requires one focused question. Contextual approval never substitutes for provider-owned consent, exact-token authorization, or separate publishing and destructive-action permission.
|
|
1722
1734
|
|
|
1723
|
-
Resolving an incident or subdecision does not complete or cancel the original authorized objective; resume safe, necessary in-scope steps automatically, using judgment for proportionate recovery and respecting explicit user dispositions.
|
|
1724
|
-
|
|
1725
|
-
Stop for an unresolved consequential scope/product decision, required explicit consent, a denied action, or the human's explicit stop. Unavailable required proof blocks completion and delivery; it does not alone prohibit specifically authorized in-scope implementation where actual native authority and other limits permit it. Do not infer permission for publishing, destructive actions, unrelated scope or native consent from this continuity rule. Report a concrete blocker and the exact decision needed rather than requesting a generic "continue".
|
|
1735
|
+
Resolving an incident or subdecision does not complete or cancel the original authorized objective; resume safe, necessary in-scope steps automatically, using judgment for proportionate recovery and respecting explicit user dispositions. Do not infer permission for publishing, destructive actions, unrelated scope or native consent from this continuity rule.
|
|
1726
1736
|
|
|
1727
|
-
|
|
1737
|
+
Honor explicit one-run, no-retry, or diagnostic-only limits. Correct a failing check only within the existing correction budget; never reset budgets, add retry allowances, weaken checks, or override final outcomes.
|
|
1728
1738
|
|
|
1729
|
-
An exhausted worker-local correction limit ends that
|
|
1739
|
+
An exhausted worker-local correction limit ends that worker's cycle, not the unit; within native authority you own the next step, unasked. Partial worker execution is not by itself exhausted proof or a terminal native review outcome. Name the loop's cause from the evidence; act on it: ${exhaustionRoute}; never repeat an attempt or swap executors to dodge limits. Same cause again or no new hypothesis: block the unit; continue independent work. Before any worker continuation, confirm no child is active or has an uncertain status. The Close stop ends the cycle; later explicit requests stay subject to native authority. Quota recovery: \`orchestrator-quota-recovery.md\`. A new session does not reset any limit.
|
|
1730
1740
|
|
|
1731
1741
|
For worker-prohibited maintenance or rollback, worker prohibitions remain unchanged. The parent only may perform the operation when the human explicitly authorized the operation itself, exact scope, ownership, and preservation are established, and available permitted tools can perform it; fresh runtime/native consent and guards remain binding. A broad feature authorization is not destructive authority; never substitute another worker or tool to bypass a denial. For an upgrade require a validated backup, artifact and migration validation where applicable, and a recovery path. For rollback preserve unrelated edits even in the same file, remove only proven task-created helpers, and never blanket restore, reset, or clean. Stop when ambiguous ownership or denial stops the operation, or any prerequisite is missing. This route is guidance, not authorization.
|
|
1732
1742
|
|
|
1733
|
-
For background work, launch the bounded action and end the turn when no independent in-scope work remains. Retain its identity and resume the already-authorized continuation automatically on its completion event; do not ask the human to say "continue"
|
|
1743
|
+
For background work, launch the bounded action and end the turn when no independent in-scope work remains. Retain its identity and resume the already-authorized continuation automatically on its completion event; do not ask the human to say "continue" or poll.
|
|
1734
1744
|
|
|
1735
1745
|
Default workflow: Organic Driven Development (MANDATORY)
|
|
1736
1746
|
Organic Driven Development (ODD) is the predefined workflow of this orchestrator. Every request enters it, without the user asking for a workflow, a plan, or task tracking. Never describe this workflow only when asked about it: run it. Run these steps in this order on every request:
|
|
@@ -2250,9 +2260,109 @@ function normalizePolicyPath(value: string): string {
|
|
|
2250
2260
|
return value.trim().replace(/^~(?=[/\\]|$)/, homedir()).replace(/\\/g, "/").toLowerCase();
|
|
2251
2261
|
}
|
|
2252
2262
|
|
|
2253
|
-
|
|
2263
|
+
// Gentle Shell Desktop (odd/tasks/herdr-desktop.md T7): the inbox, outbox and
|
|
2264
|
+
// snapshots under `<agentDir>/desktop/` are the human's channel into a live
|
|
2265
|
+
// session; the agent never writes an action there. Only the real folders are
|
|
2266
|
+
// guarded, never a project folder that happens to be named `agent/desktop`:
|
|
2267
|
+
// `<home>/desktop` for the resolved Gentle Pi agent home (the one the desktop
|
|
2268
|
+
// feed writes under) and the two standard homes, compared as normalized
|
|
2269
|
+
// absolute paths. `~`, `$HOME` and `${HOME}` expand, `.` and `..` resolve
|
|
2270
|
+
// lexically, and a relative path resolves against the tool call's cwd (a
|
|
2271
|
+
// relative path with no cwd never matches), so a project folder that is named
|
|
2272
|
+
// `agent/desktop` stays outside the guard while `../../.gentle-shell/...` from
|
|
2273
|
+
// the project does not. Case folds like the patterns.
|
|
2274
|
+
//
|
|
2275
|
+
// On Windows the bash tool is Git for Windows (MSYS) bash, where `/c/Users/x`
|
|
2276
|
+
// and `/cygdrive/c/Users/x` are the same folder as `C:\Users\x`, and Win32
|
|
2277
|
+
// accepts `//?/C:/...`. On win32 only, those spellings read as the drive path
|
|
2278
|
+
// before the compare (separators normalized, case folded). Shell variables
|
|
2279
|
+
// such as `$USERPROFILE` are not expanded: that indirection stays the
|
|
2280
|
+
// documented fail-open limit of a word-level guard.
|
|
2281
|
+
interface PolicyPathHost {
|
|
2282
|
+
platform: NodeJS.Platform;
|
|
2283
|
+
home: string;
|
|
2284
|
+
}
|
|
2285
|
+
|
|
2286
|
+
function currentPolicyPathHost(): PolicyPathHost {
|
|
2287
|
+
return { platform: process.platform, home: homedir() };
|
|
2288
|
+
}
|
|
2289
|
+
|
|
2290
|
+
function windowsDrivePath(path: string): string {
|
|
2291
|
+
const msys = /^(?:\/cygdrive)?\/([a-zA-Z])(\/.*)?$/.exec(path);
|
|
2292
|
+
if (msys !== null) return `${msys[1]}:${msys[2] ?? "/"}`;
|
|
2293
|
+
const device = /^\/\/[?.]\/([a-zA-Z]:(?:\/.*)?)$/.exec(path);
|
|
2294
|
+
return device === null ? path : device[1].length === 2 ? `${device[1]}/` : device[1];
|
|
2295
|
+
}
|
|
2296
|
+
|
|
2297
|
+
function normalizeAbsolutePolicyPath(value: string, cwd?: string, host: PolicyPathHost = currentPolicyPathHost()): string | undefined {
|
|
2298
|
+
let expanded = value.trim()
|
|
2299
|
+
.replace(/^(?:~|\$HOME|\$\{HOME\})(?=[/\\]|$)/, host.home.replace(/\\/g, "/"))
|
|
2300
|
+
.replace(/\\/g, "/");
|
|
2301
|
+
if (expanded.length === 0) return undefined;
|
|
2302
|
+
if (host.platform === "win32") expanded = windowsDrivePath(expanded);
|
|
2303
|
+
if (!/^(?:\/|[a-zA-Z]:\/)/.test(expanded)) {
|
|
2304
|
+
const base = cwd === undefined ? undefined : normalizeAbsolutePolicyPath(cwd, undefined, host);
|
|
2305
|
+
return base === undefined ? undefined : posix.join(base, expanded).replace(/(.)\/+$/, "$1").toLowerCase();
|
|
2306
|
+
}
|
|
2307
|
+
return posix.normalize(expanded).replace(/(.)\/+$/, "$1").toLowerCase();
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function desktopActionRootsFor(homes: readonly string[], host: PolicyPathHost): string[] {
|
|
2311
|
+
const roots = new Set<string>();
|
|
2312
|
+
for (const home of homes) {
|
|
2313
|
+
const normalized = normalizeAbsolutePolicyPath(home, undefined, host);
|
|
2314
|
+
if (normalized !== undefined) roots.add(posix.join(normalized, "desktop"));
|
|
2315
|
+
}
|
|
2316
|
+
return [...roots];
|
|
2317
|
+
}
|
|
2318
|
+
|
|
2319
|
+
function desktopActionRoots(env: NodeJS.ProcessEnv): string[] {
|
|
2320
|
+
const homes = [
|
|
2321
|
+
resolveGentlePiAgentHome(env),
|
|
2322
|
+
resolveGentlePiAgentHome(process.env),
|
|
2323
|
+
join(homedir(), ".gentle-shell", "agent"),
|
|
2324
|
+
join(homedir(), ".pi", "agent"),
|
|
2325
|
+
];
|
|
2326
|
+
const spellings: string[] = [];
|
|
2327
|
+
for (const home of homes) {
|
|
2328
|
+
spellings.push(home);
|
|
2329
|
+
try { spellings.push(realpathSync(home)); } catch { /* A missing home has only its own spelling. */ }
|
|
2330
|
+
}
|
|
2331
|
+
return desktopActionRootsFor(spellings, currentPolicyPathHost());
|
|
2332
|
+
}
|
|
2333
|
+
|
|
2334
|
+
function isUnderDesktopRoot(value: string, roots: readonly string[], cwd: string | undefined, host: PolicyPathHost): boolean {
|
|
2335
|
+
const normalized = normalizeAbsolutePolicyPath(value, cwd, host);
|
|
2336
|
+
if (normalized === undefined) return false;
|
|
2337
|
+
return roots.some((root) => normalized === root || normalized.startsWith(`${root}/`));
|
|
2338
|
+
}
|
|
2339
|
+
|
|
2340
|
+
/** Pure seam of the desktop-folder guard: `homes` are agent homes, `home` the user home that `~`/`$HOME` expand to. */
|
|
2341
|
+
export function isDesktopActionPathOn(value: string, options: PolicyPathHost & { homes: readonly string[]; cwd?: string }): boolean {
|
|
2342
|
+
const host = { platform: options.platform, home: options.home };
|
|
2343
|
+
return isUnderDesktopRoot(value, desktopActionRootsFor(options.homes, host), options.cwd, host);
|
|
2344
|
+
}
|
|
2345
|
+
|
|
2346
|
+
function isDesktopActionPath(value: string, env: NodeJS.ProcessEnv, cwd?: string): boolean {
|
|
2347
|
+
return isUnderDesktopRoot(value, desktopActionRoots(env), cwd, currentPolicyPathHost());
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
function isSensitivePath(value: string, env: NodeJS.ProcessEnv = process.env, cwd?: string): boolean {
|
|
2254
2351
|
const normalized = normalizePolicyPath(value);
|
|
2255
|
-
return SENSITIVE_PATH_PATTERNS.some((pattern) => pattern.test(normalized));
|
|
2352
|
+
return SENSITIVE_PATH_PATTERNS.some((pattern) => pattern.test(normalized)) || isDesktopActionPath(value, env, cwd);
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
// A shell word can carry a path after `=`: `--target-directory=$HOME/...` or
|
|
2356
|
+
// `VAR=~/...` (quotes are already stripped by shellCommandWords). Only the
|
|
2357
|
+
// desktop guard reads these values; the pattern list keeps its word-level reach.
|
|
2358
|
+
function isSensitiveCommandWord(word: string, env: NodeJS.ProcessEnv, cwd?: string): boolean {
|
|
2359
|
+
if (isSensitivePath(word, env, cwd)) return true;
|
|
2360
|
+
let index = word.indexOf("=");
|
|
2361
|
+
while (index >= 0) {
|
|
2362
|
+
if (isDesktopActionPath(word.slice(index + 1), env, cwd)) return true;
|
|
2363
|
+
index = word.indexOf("=", index + 1);
|
|
2364
|
+
}
|
|
2365
|
+
return false;
|
|
2256
2366
|
}
|
|
2257
2367
|
|
|
2258
2368
|
function isSensitiveRequestContextPath(path: string): boolean {
|
|
@@ -2370,8 +2480,8 @@ function shellCommandWords(command: string): string[] {
|
|
|
2370
2480
|
return words;
|
|
2371
2481
|
}
|
|
2372
2482
|
|
|
2373
|
-
function findSensitiveCommandPath(command: string): string | undefined {
|
|
2374
|
-
return shellCommandWords(command).find(
|
|
2483
|
+
function findSensitiveCommandPath(command: string, env: NodeJS.ProcessEnv = process.env, cwd?: string): string | undefined {
|
|
2484
|
+
return shellCommandWords(command).find((word) => isSensitiveCommandWord(word, env, cwd));
|
|
2375
2485
|
}
|
|
2376
2486
|
|
|
2377
2487
|
function sensitivePathBlock(sensitivePath: string): ToolCallEventResult {
|
|
@@ -2384,15 +2494,17 @@ function sensitivePathBlock(sensitivePath: string): ToolCallEventResult {
|
|
|
2384
2494
|
function evaluateSensitivePathTool(
|
|
2385
2495
|
toolName: string,
|
|
2386
2496
|
input: unknown,
|
|
2497
|
+
env: NodeJS.ProcessEnv = process.env,
|
|
2498
|
+
cwd?: string,
|
|
2387
2499
|
): ToolCallEventResult | undefined {
|
|
2388
2500
|
const sensitivePath = PATH_GUARDED_TOOL_NAMES.has(toolName)
|
|
2389
|
-
? collectPathInputs(input).find(isSensitivePath)
|
|
2501
|
+
? collectPathInputs(input).find((path) => isSensitivePath(path, env, cwd))
|
|
2390
2502
|
: undefined;
|
|
2391
2503
|
if (sensitivePath !== undefined) return sensitivePathBlock(sensitivePath);
|
|
2392
2504
|
if (!SHELL_COMMAND_TOOLS.has(toolName)) return undefined;
|
|
2393
2505
|
const command = readStringPath(input, ["command"]);
|
|
2394
2506
|
if (command === undefined) return undefined;
|
|
2395
|
-
const commandPath = findSensitiveCommandPath(command);
|
|
2507
|
+
const commandPath = findSensitiveCommandPath(command, env, cwd);
|
|
2396
2508
|
return commandPath === undefined ? undefined : sensitivePathBlock(commandPath);
|
|
2397
2509
|
}
|
|
2398
2510
|
|
|
@@ -3258,13 +3370,16 @@ function readReviewerRouting(cwd: string, sessionId: string | undefined, session
|
|
|
3258
3370
|
: resolution.kind === "inherited" && resolution.profile !== undefined ? "frozen session profile"
|
|
3259
3371
|
: resolution.kind === "follow" ? "followed session profile"
|
|
3260
3372
|
: "repository profile pin";
|
|
3261
|
-
//
|
|
3262
|
-
// startup
|
|
3263
|
-
//
|
|
3264
|
-
//
|
|
3373
|
+
// Provider review roles inherit the explicit binding's orchestrator, the
|
|
3374
|
+
// startup record's, or the in-memory frozen profile's, before Pi's persisted
|
|
3375
|
+
// default. Pins and global routing never supply this fallback; a session
|
|
3376
|
+
// frozen without a profile has no orchestrator to carry to a foreign target.
|
|
3265
3377
|
if (resolution.kind !== "explicit") delete config.orchestrator;
|
|
3266
|
-
const
|
|
3267
|
-
|
|
3378
|
+
const orchestrator = resolution.kind === "inherited"
|
|
3379
|
+
? readSessionProfileBinding(sessionId)?.modelProfiles.orchestrator
|
|
3380
|
+
?? (resolution.profile === undefined ? undefined : readFrozenDefaultOrchestrator(sessionId))
|
|
3381
|
+
: undefined;
|
|
3382
|
+
if (orchestrator !== undefined) config.orchestrator = { ...orchestrator };
|
|
3268
3383
|
return { config, source };
|
|
3269
3384
|
}
|
|
3270
3385
|
|
|
@@ -9663,8 +9778,8 @@ function reviewHostRelayFailureReport(error: ReviewHostRelayError): Record<strin
|
|
|
9663
9778
|
// gentle-pi#2271: review-refuter and review-validator are provider review
|
|
9664
9779
|
// roles, not installable agents, so nothing seeds their entries and profiles
|
|
9665
9780
|
// never carry them. For those two keys only, a snapshot with no model falls
|
|
9666
|
-
// back to Pi's persisted default model
|
|
9667
|
-
//
|
|
9781
|
+
// back to the session profile's orchestrator, then Pi's persisted default model
|
|
9782
|
+
// and effort. Lens keys keep the fail-closed rule.
|
|
9668
9783
|
//
|
|
9669
9784
|
// gentle-shell#2163: a caller that knows where the snapshot came from passes
|
|
9670
9785
|
// it, so the relay's refusal names the routing source and whether the entry
|
|
@@ -12786,10 +12901,40 @@ function createGentleAiExtensionForTesting(
|
|
|
12786
12901
|
sessionProfiles.start(ctx.sessionManager, (type, data) => pi.appendEntry(type, data), event);
|
|
12787
12902
|
// gentle-shell#2742: only a session's own start tells this process its
|
|
12788
12903
|
// startup state; anything else leaves it unknown.
|
|
12904
|
+
let startupProfile: SessionProfileStartupState | undefined;
|
|
12789
12905
|
try {
|
|
12790
|
-
if (profileSessionId && isSessionOwnStart(event, ctx.sessionManager))
|
|
12906
|
+
if (profileSessionId && isSessionOwnStart(event, ctx.sessionManager)) {
|
|
12791
12907
|
freezeSessionProfileAtOwnStart({ sessionId: profileSessionId, cwd: ctx.sessionManager.getCwd(), configHome: gentleAiConfigHome() });
|
|
12908
|
+
startupProfile = readSessionProfileOwnStartup(profileSessionId);
|
|
12909
|
+
}
|
|
12792
12910
|
} catch { /* The startup state stays unknown. */ }
|
|
12911
|
+
// A3: only this session's own start applies its frozen full definition.
|
|
12912
|
+
// The workflow mode remains live; launches still receive role routing only.
|
|
12913
|
+
if (startupProfile && startupProfile !== "none" && permissionEnvironment.GENTLE_PI_AGENTS_CHILD !== "1" && !profileFollowEnabled(permissionEnvironment)) {
|
|
12914
|
+
const orchestrator = readProfileOrchestrator(startupProfile.modelProfiles);
|
|
12915
|
+
const current = () => startupEpoch === reminderEpoch && sessionProfiles.isCurrent(ctx.sessionManager);
|
|
12916
|
+
// The switch is best-effort and contained: a reload or session
|
|
12917
|
+
// replacement racing the awaited switch must neither abort the rest
|
|
12918
|
+
// of session_start (Pi's runner throws on any access to a stale ctx)
|
|
12919
|
+
// nor leave the outcome unreported. Checked before and after the await.
|
|
12920
|
+
try {
|
|
12921
|
+
if (!current()) return;
|
|
12922
|
+
const note = orchestrator?.model
|
|
12923
|
+
? await switchLiveOrchestrator(ctx, pi, orchestrator, current)
|
|
12924
|
+
|| "\nThe profile's orchestrator model is invalid; this session keeps its current model."
|
|
12925
|
+
: `\nprofile "${startupProfile.name}" has no orchestrator model; this session keeps its current model.`;
|
|
12926
|
+
if (!current()) return;
|
|
12927
|
+
// A headless session (pi -p) has no notify surface: the startup note
|
|
12928
|
+
// falls back to stderr, the same channel Pi's own startup notifications
|
|
12929
|
+
// use headlessly, so a failed switch is observable instead of silent.
|
|
12930
|
+
const startedWith = `el Gentleman started with profile "${startupProfile.name}".${note}`;
|
|
12931
|
+
if (ctx.hasUI) ctx.ui.notify(startedWith, "info");
|
|
12932
|
+
else console.error(startedWith);
|
|
12933
|
+
} catch {
|
|
12934
|
+
// The startup switch stays best-effort: a staled context or a
|
|
12935
|
+
// reporting failure never aborts the remaining startup work.
|
|
12936
|
+
}
|
|
12937
|
+
}
|
|
12793
12938
|
readSessionProfileAuthority(ctx.sessionManager);
|
|
12794
12939
|
if (ctx.hasUI) notifySessionProfileProblem(ctx);
|
|
12795
12940
|
auto.reset();
|
|
@@ -13185,6 +13330,8 @@ function createGentleAiExtensionForTesting(
|
|
|
13185
13330
|
const sensitivePathDenied = evaluateSensitivePathTool(
|
|
13186
13331
|
event.toolName,
|
|
13187
13332
|
event.input,
|
|
13333
|
+
permissionEnvironment,
|
|
13334
|
+
typeof ctx.cwd === "string" && ctx.cwd.length > 0 ? ctx.cwd : undefined,
|
|
13188
13335
|
);
|
|
13189
13336
|
if (sensitivePathDenied) return sensitivePathDenied;
|
|
13190
13337
|
const surfaceDenied = evaluateExecutionSurfaceTool(event.toolName, event.input);
|
|
@@ -13633,6 +13780,69 @@ function createGentleAiExtensionForTesting(
|
|
|
13633
13780
|
},
|
|
13634
13781
|
});
|
|
13635
13782
|
|
|
13783
|
+
// Desktop's get_review_mode/set_review_mode (#3324) reach this same switch
|
|
13784
|
+
// through a versioned, adapter-shaped seam: every read and write goes
|
|
13785
|
+
// through executeReviewMode and the native adapter, exactly like
|
|
13786
|
+
// /gentle:review-mode. The Desktop bridge owns the confirmation step; this
|
|
13787
|
+
// owner only reads (bounded, fail closed) and writes then re-reads. Raw
|
|
13788
|
+
// native errors never leave: they are classified as unavailable (gentle-ai
|
|
13789
|
+
// missing or the command unsupported), unknown, or failed. Subagent
|
|
13790
|
+
// children never answer, and hosts without an event bus skip the seam.
|
|
13791
|
+
const DESKTOP_REVIEW_WRITE_TIMEOUT_MS = 10_000;
|
|
13792
|
+
const reviewModeUnavailable = (error: unknown): boolean => {
|
|
13793
|
+
const code = asNativeReviewCliError(error)?.code;
|
|
13794
|
+
return code === NATIVE_REVIEW_ERROR_CODE.UNAVAILABLE || code === NATIVE_REVIEW_ERROR_CODE.VERSION_INCOMPATIBLE ||
|
|
13795
|
+
code === NATIVE_REVIEW_ERROR_CODE.PACKAGE_BINARY_MISSING || code === NATIVE_REVIEW_ERROR_CODE.UNSUPPORTED_TRANSITION_OPERATION;
|
|
13796
|
+
};
|
|
13797
|
+
const boundedReviewMode = async (request: NativeReviewModeRequest, ctx: ExtensionContext, timeoutMs: number) => {
|
|
13798
|
+
const signal = AbortSignal.timeout(timeoutMs);
|
|
13799
|
+
return await Promise.race([executeReviewMode({ ...request, signal }, ctx), rddAbortRejection(signal)]);
|
|
13800
|
+
};
|
|
13801
|
+
if (typeof pi.events?.on === "function") pi.events.on(DESKTOP_REVIEW_SERVICE_CHANNEL, (payload: unknown) => {
|
|
13802
|
+
if (!payload || typeof payload !== "object") return;
|
|
13803
|
+
const request = payload as Partial<{ context: ExtensionContext; respond(service: DesktopReviewService): void }>;
|
|
13804
|
+
if (typeof request.respond !== "function" || !request.context) return;
|
|
13805
|
+
if (permissionEnvironment.GENTLE_PI_AGENTS_CHILD === "1") return;
|
|
13806
|
+
const ctx = request.context;
|
|
13807
|
+
let disposed = false;
|
|
13808
|
+
const read = async (): Promise<DesktopReviewOwnerRead> => {
|
|
13809
|
+
if (disposed || nativeReviewCli?.reviewMode === undefined) return { kind: "unavailable" };
|
|
13810
|
+
try {
|
|
13811
|
+
const result = await boundedReviewMode({ cwd: ctx.cwd, operation: NATIVE_REVIEW_MODE_OPERATION.STATUS }, ctx, resolveRddStatusTimeoutMs(permissionEnvironment));
|
|
13812
|
+
if (result.operation !== NATIVE_REVIEW_MODE_OPERATION.STATUS || !isValidRddModeStatus(result.status)) return { kind: "unknown" };
|
|
13813
|
+
const { global, cloneLocal, effective, source, revision } = result.status;
|
|
13814
|
+
return { kind: "status", status: { global, cloneLocal, effective, source, ...(revision === undefined ? {} : { revision }) } };
|
|
13815
|
+
} catch (error) {
|
|
13816
|
+
return reviewModeUnavailable(error) ? { kind: "unavailable" } : { kind: "unknown" };
|
|
13817
|
+
}
|
|
13818
|
+
};
|
|
13819
|
+
try {
|
|
13820
|
+
request.respond({
|
|
13821
|
+
schema: DESKTOP_REVIEW_SERVICE_SCHEMA,
|
|
13822
|
+
read,
|
|
13823
|
+
async write({ enabled, scope }): Promise<DesktopReviewOwnerWrite> {
|
|
13824
|
+
if (disposed || nativeReviewCli?.reviewMode === undefined) return { kind: "unavailable" };
|
|
13825
|
+
const operation = enabled ? NATIVE_REVIEW_MODE_OPERATION.ENABLE : NATIVE_REVIEW_MODE_OPERATION.DISABLE;
|
|
13826
|
+
try {
|
|
13827
|
+
const result = await boundedReviewMode({ cwd: ctx.cwd, operation, scope }, ctx, DESKTOP_REVIEW_WRITE_TIMEOUT_MS);
|
|
13828
|
+
if (result.operation !== operation) return { kind: "failed" };
|
|
13829
|
+
} catch (error) {
|
|
13830
|
+
// A write that could not start changed nothing; any other failure
|
|
13831
|
+
// has an unknown outcome and is never retried.
|
|
13832
|
+
return reviewModeUnavailable(error) ? { kind: "unavailable" } : { kind: "failed" };
|
|
13833
|
+
}
|
|
13834
|
+
// Report the owner's state re-read after the write, not the write's echo.
|
|
13835
|
+
return await read();
|
|
13836
|
+
},
|
|
13837
|
+
dispose: () => {
|
|
13838
|
+
disposed = true;
|
|
13839
|
+
},
|
|
13840
|
+
});
|
|
13841
|
+
} catch {
|
|
13842
|
+
/* obsolete trusted context: discovery expires closed */
|
|
13843
|
+
}
|
|
13844
|
+
});
|
|
13845
|
+
|
|
13636
13846
|
// gentle-pi#677: gentle-ai owns telemetry end to end (status, the opt-out
|
|
13637
13847
|
// switches, and rate limiting); this command only runs the corresponding
|
|
13638
13848
|
// `gentle-ai telemetry <op> --json` in the foreground and relays its
|