gentle-pi 4.9.0 → 5.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/assets/agents/gentle-ai-explore.md +3 -6
- package/assets/agents/gentle-ai-verify.md +2 -2
- package/assets/agents/gentle-ai-worker.md +9 -9
- package/assets/agents/jd-fix-agent.md +2 -2
- package/assets/agents/jd-judge-a.md +0 -1
- package/assets/agents/jd-judge-b.md +0 -1
- package/assets/migrations/agent-body-history.json +9 -0
- package/assets/orchestrator-delegation.md +1 -1
- package/assets/orchestrator-full-delegation.md +1 -1
- package/assets/orchestrator-maintenance.md +11 -0
- package/assets/orchestrator-quota-recovery.md +1 -1
- package/assets/orchestrator-skills.md +10 -0
- package/assets/orchestrator-tracking.md +2 -2
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator.md +2 -2
- package/bin/gentle-shell.mjs +69 -17
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +11 -10
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/manifest.json +5 -5
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/orchestration/pi.md +5 -3
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/routing/pi.md +2 -2
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/lens.schema.json +3 -3
- package/contracts/review-provider-contract-mirror/v1.7.0/bundle/vectors/lens.json +1 -0
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/generated/provider-roles.baseline.json +3 -3
- package/docs/bundled-install.md +2 -2
- package/docs/delegated-verification.md +10 -6
- package/docs/desktop-feed.md +15 -6
- package/docs/desktop-rpc.md +298 -30
- package/docs/gentle-shell-desktop.md +10 -3
- package/docs/gentle-shell.md +25 -19
- package/docs/install-wizard.md +7 -5
- package/docs/native-authority-architecture.md +3 -3
- package/docs/odd-preparation-continuity.md +2 -2
- package/docs/permission-modes.md +10 -2
- package/docs/readme-reference.md +53 -24
- package/docs/review-coordinator.md +4 -2
- package/docs/session-profile-format.md +33 -7
- package/docs/sound-notifications.md +1 -1
- package/docs/work-continuity.md +7 -7
- package/docs/yolo-mode.md +1 -1
- package/extensions/ask-user-choice.ts +2 -2
- package/extensions/ask-user-question.ts +1 -1
- package/extensions/child-context.ts +2 -11
- package/extensions/gentle-agents.ts +86 -30
- package/extensions/gentle-ai.ts +918 -632
- package/extensions/gentle-desktop-feed.ts +13 -3
- package/extensions/gentle-desktop-rpc.ts +51 -2
- package/extensions/gentle-fast.ts +9 -2
- package/extensions/gentle-music.ts +2 -0
- package/extensions/gentle-notifications.ts +12 -4
- package/extensions/gentle-shell.ts +157 -62
- package/extensions/gentle-star-prompt.ts +3 -0
- package/extensions/gentle-tps.ts +7 -0
- package/extensions/history/index.ts +1 -1
- package/extensions/quiet-tools.ts +13 -22
- package/extensions/skill-registry.ts +9 -1
- package/extensions/startup-banner.ts +8 -13
- package/herdr/mods/gentle-agents/snapshot.js +30 -23
- package/herdr/mods/gentle-chat/feed.js +6 -0
- package/herdr/mods/gentle-chat/main.js +76 -16
- package/herdr/mods/gentle-chat/session.js +13 -5
- package/herdr/mods/gentle-chat/snapshot.js +30 -23
- package/herdr/mods/gentle-chat/ui.js +7 -1
- package/herdr/mods/gentle-inspector/main.js +2 -0
- package/herdr/mods/gentle-inspector/snapshot.js +30 -23
- package/herdr/mods/gentle-palette/main.js +1 -1
- package/herdr/mods/gentle-palette/snapshot.js +30 -23
- package/herdr/mods/gentle-pane/snapshot.js +30 -23
- package/herdr/mods/gentle-sidebar/snapshot.js +30 -23
- package/herdr/mods/gentle-spaces/snapshot.js +30 -23
- package/herdr/mods/gentle-status/snapshot.js +30 -23
- package/herdr/mods/gentle-tabs/main.js +3 -2
- package/herdr/mods/gentle-tabs/new-tab.js +9 -0
- package/herdr/mods/gentle-tabs/snapshot.js +30 -23
- package/herdr/mods/gentle-tokens/snapshot.js +30 -23
- package/lib/agent-profiles.ts +50 -10
- package/lib/agents-config.ts +69 -5
- package/lib/agents-runner.ts +34 -1
- package/lib/auto-permission-runtime.ts +2 -1
- package/lib/background-jobs-tools.ts +24 -16
- package/lib/banner-config.ts +69 -0
- package/lib/child-session.ts +6 -0
- package/lib/claude-bridge-config.ts +41 -0
- package/lib/codex-turn-continuation.ts +40 -0
- package/lib/compaction-threshold.ts +46 -0
- package/lib/context-threshold.ts +5 -5
- package/lib/desktop-agent-definitions-service.ts +93 -0
- package/lib/desktop-auth-service.ts +102 -0
- package/lib/desktop-background-subagents-service.ts +155 -0
- package/lib/desktop-command-rpc.ts +71 -0
- package/lib/desktop-feed-sources.ts +44 -1
- package/lib/desktop-feed.ts +41 -29
- package/lib/desktop-rpc-agent-definitions.ts +119 -0
- package/lib/desktop-rpc-agents.ts +44 -3
- package/lib/desktop-rpc-auth.ts +103 -0
- package/lib/desktop-rpc-background-subagents.ts +126 -0
- package/lib/desktop-rpc-changes.ts +13 -4
- package/lib/desktop-rpc-config.ts +287 -13
- package/lib/desktop-rpc-profile-binding.ts +212 -0
- package/lib/desktop-rpc-profiles.ts +2 -0
- package/lib/desktop-rpc-stats.ts +16 -4
- package/lib/desktop-rpc-status.ts +103 -0
- package/lib/desktop-status-service.ts +86 -0
- package/lib/destructive-command-guard.ts +9 -185
- package/lib/exploration-budget.ts +3 -7
- package/lib/gentle-design.ts +23 -4
- package/lib/gentle-shell-desktop.ts +85 -0
- package/lib/gentle-shell-launcher.ts +120 -8
- package/lib/mcp-config.ts +214 -0
- package/lib/native-choice-list.ts +1 -1
- package/lib/native-fullscreen-interaction.ts +3 -0
- package/lib/native-pointer-region.ts +1 -1
- package/lib/native-review-cli.ts +213 -397
- package/lib/odd-phase-inference.ts +1 -1
- package/lib/orchestrator-mode-policy.ts +25 -12
- package/lib/path-consent-fence.ts +113 -0
- package/lib/persona-config.ts +77 -0
- package/lib/pi-settings.ts +157 -0
- package/lib/questionnaire/questionnaire-view.ts +1 -1
- package/lib/review-continuation-registry.ts +9 -26
- package/lib/review-coordinator.ts +13 -2
- package/lib/review-host-relay.ts +2 -35
- package/lib/review-integration-v2.ts +129 -180
- package/lib/review-object-store.ts +0 -57
- package/lib/review-repository.ts +0 -44
- package/lib/review-risk-assessment.ts +11 -36
- package/lib/review-start-context.ts +2 -1
- package/lib/review-transaction.ts +6 -6
- package/lib/sensitive-paths.ts +45 -0
- package/lib/session-profile-binding.ts +29 -0
- package/lib/session-profile-freeze.ts +11 -4
- package/lib/session-worktree-registry.ts +11 -5
- package/lib/shell-bar.ts +41 -18
- package/lib/shell-card.ts +27 -1
- package/lib/shell-changes-view.ts +6 -2
- package/lib/shell-changes.ts +94 -37
- package/lib/shell-git-worker.ts +158 -0
- package/lib/shell-idle-changes.ts +88 -0
- package/lib/shell-untracked-cache.ts +142 -0
- package/lib/shell-untracked-lines.ts +178 -0
- package/lib/stats-collector.ts +24 -0
- package/lib/tower-open.ts +8 -1
- package/lib/tps-policy.ts +85 -0
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/voice-artifacts.ts +8 -1
- package/lib/voice-install.ts +7 -3
- package/lib/yolo-session-policy.ts +2 -2
- package/package.json +1 -1
- package/runtime/gentle-shell-desktop.mjs +85 -0
- package/runtime/gentle-shell-launcher.mjs +120 -8
- package/runtime/native-review-cli.mjs +206 -390
- package/runtime/review-integration-v2.mjs +129 -180
- package/runtime/review-risk-assessment.mjs +11 -36
- package/runtime/sensitive-paths.mjs +46 -0
- package/runtime/tower-open.mjs +8 -1
- package/scripts/build-runtime-modules.mjs +2 -0
- package/scripts/gentle-ai-installer.mjs +13 -14
- package/scripts/installer-preflight.mjs +1 -1
- package/scripts/main-channel.mjs +47 -11
- package/scripts/pi-update.mjs +10 -4
- package/scripts/prepare-verifier.mjs +14 -4
- package/scripts/verify-package-files.mjs +45 -13
- package/skills/judgment-day/SKILL.md +1 -1
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/provider-defect-report/SKILL.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +2 -2
- package/skills/skill-creator/SKILL.md +4 -4
- package/skills/skill-improver/SKILL.md +4 -4
- package/skills/skill-registry/SKILL.md +2 -2
- package/tests/agent-profiles-workflow.test.ts +102 -0
- package/tests/agent-risk-escalation.test.ts +15 -0
- package/tests/agents-config.test.ts +22 -2
- package/tests/agents-protocol.test.ts +1 -1
- package/tests/agents-runner.test.ts +94 -2
- package/tests/append-system-prompt-route.test.ts +16 -11
- package/tests/ask-user-choice.test.ts +19 -0
- package/tests/ask-user-question.test.ts +23 -4
- package/tests/auto-permission-runtime.test.ts +4 -4
- package/tests/bounded-stop-contract.test.ts +50 -62
- package/tests/built-web-guard.test.ts +32 -0
- package/tests/child-context-files.test.ts +6 -6
- package/tests/child-ui-extensions.test.ts +125 -0
- package/tests/child-web-package.test.ts +1 -1
- package/tests/codex-turn-continuation.test.ts +183 -0
- package/tests/committed-range-untracked-exclusion.test.ts +18 -0
- package/tests/controlled-engineering-editor.test.ts +192 -0
- package/tests/controlled-engineering-launch.test.ts +136 -0
- package/tests/controlled-engineering.test.ts +244 -0
- package/tests/delegate-for-reason-contract.test.ts +1 -1
- package/tests/delivery-b-rendered-surfaces.test.ts +1 -1
- package/tests/delivery-conflict-markers.test.ts +2 -3
- package/tests/desktop-feed-tool-summaries.test.ts +1 -1
- package/tests/desktop-feed-transcript.test.ts +17 -0
- package/tests/desktop-feed.test.ts +141 -7
- package/tests/desktop-liveness.test.ts +125 -0
- package/tests/desktop-persona.test.ts +17 -0
- package/tests/desktop-rpc-agent-definitions.test.ts +219 -0
- package/tests/desktop-rpc-agents.test.ts +113 -3
- package/tests/desktop-rpc-auth.test.ts +278 -0
- package/tests/desktop-rpc-background-subagents.test.ts +186 -0
- package/tests/desktop-rpc-changes.test.ts +81 -4
- package/tests/desktop-rpc-config-mcp-fidelity.test.ts +106 -0
- package/tests/desktop-rpc-config-readonly-stores.test.ts +458 -0
- package/tests/desktop-rpc-config-settings.test.ts +234 -0
- package/tests/desktop-rpc-config.test.ts +17 -3
- package/tests/desktop-rpc-design.test.ts +30 -1
- package/tests/desktop-rpc-jobs.test.ts +9 -1
- package/tests/desktop-rpc-permissions.test.ts +9 -1
- package/tests/desktop-rpc-profile-binding.test.ts +195 -0
- package/tests/desktop-rpc-review.test.ts +1 -1
- package/tests/desktop-rpc-session-snapshot-commands.test.ts +50 -0
- package/tests/desktop-rpc-session.test.ts +2 -2
- package/tests/desktop-rpc-stats.test.ts +42 -11
- package/tests/desktop-rpc-status.test.ts +195 -0
- package/tests/desktop-rpc-updates.test.ts +1 -1
- package/tests/desktop-rpc-usage.test.ts +9 -1
- package/tests/desktop-rpc.test.ts +2 -2
- package/tests/desktop-session-switch.test.ts +237 -0
- package/tests/desktop-target-session.test.ts +104 -0
- package/tests/destructive-command-guard.test.ts +187 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +73 -9
- package/tests/exploration-budget.test.ts +2 -26
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +15 -11
- package/tests/full-delegation-closure.test.ts +19 -9
- package/tests/generic-agent-tools.test.ts +3 -3
- package/tests/gentle-agents.test.ts +215 -10
- package/tests/gentle-ai-binary.test.ts +3 -3
- package/tests/gentle-ai-exploration-budget.test.ts +3 -2
- package/tests/gentle-ai-installer.test.ts +60 -59
- package/tests/gentle-ai.test.ts +30 -59
- package/tests/gentle-chat-read-failure.test.ts +74 -0
- package/tests/gentle-chat-session-read.test.ts +127 -0
- package/tests/gentle-design.test.ts +39 -0
- package/tests/gentle-notifications.test.ts +43 -5
- package/tests/gentle-shell-desktop.test.ts +108 -0
- package/tests/gentle-shell-launcher-auto-provision.test.ts +152 -0
- package/tests/gentle-shell-launcher-machine-output.test.ts +356 -0
- package/tests/gentle-shell-launcher-tower.test.ts +7 -1
- package/tests/gentle-shell.test.ts +163 -15
- package/tests/gentle-tps.test.ts +57 -0
- package/tests/independent-recovery-delivery.test.ts +15 -13
- package/tests/installer-preflight.test.ts +3 -2
- package/tests/installer-server.test.ts +3 -2
- package/tests/installer-windows-bootstrap.test.ts +6 -0
- package/tests/job-turn-end-texts.test.ts +57 -0
- package/tests/judgment-day-dispatch-diagnostics.test.ts +87 -0
- package/tests/lazy-module-contradictions-contract.test.ts +2 -3
- package/tests/main-channel-upgrade.test.ts +14 -7
- package/tests/main-channel.test.ts +78 -23
- package/tests/maintainer/desktop-rpc.maintest.ts +4 -4
- package/tests/native-fullscreen-interaction.test.ts +37 -1
- package/tests/native-review-capability-contract.test.ts +13 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +9 -84
- package/tests/native-review-cli.test.ts +199 -21
- package/tests/native-review-consent.test.ts +20 -3
- package/tests/native-review-start-escalation-real-binary.test.ts +42 -0
- package/tests/no-self-pause-contract.test.ts +8 -7
- package/tests/odd-phase-inference.test.ts +2 -2
- package/tests/odd-routing-canonical-ratchet.test.ts +1 -1
- package/tests/odd-routing-contract.test.ts +2 -2
- package/tests/orchestrator-budget.test.ts +7 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +5 -5
- package/tests/orchestrator-skills-inline-contract.test.ts +26 -0
- package/tests/package-manifest.test.ts +11 -16
- package/tests/packaged-agent-codemode.test.ts +79 -0
- package/tests/path-consent-fence.test.ts +326 -0
- package/tests/persona-config.test.ts +42 -0
- package/tests/pi-update-launcher.test.ts +1 -1
- package/tests/pi-update-source.test.ts +48 -2
- package/tests/primary-session-prompt.test.ts +9 -7
- package/tests/profile-fast-tier.test.ts +79 -4
- package/tests/progress-rule-contract.test.ts +54 -0
- package/tests/rdd-delivery-warning.test.ts +109 -0
- package/tests/review-actor-tool-deny.test.ts +1 -2
- package/tests/review-agent-end-preflight.test.ts +3 -1
- package/tests/review-assess-escalation-forwarding.test.ts +99 -0
- package/tests/review-authority-recovery-docs.test.ts +9 -12
- package/tests/review-continuation-registry.test.ts +24 -25
- package/tests/review-controller-native-recovery.test.ts +165 -178
- package/tests/review-controller-native-routing.test.ts +352 -27
- package/tests/review-coordinator-correction-gate.test.ts +5 -9
- package/tests/review-coordinator-runtime.test.ts +3 -2
- package/tests/review-coordinator.test.ts +14 -0
- package/tests/review-due-compaction.test.ts +1 -1
- package/tests/review-failure-facts.test.ts +2 -2
- package/tests/review-host-relay-restart-parity.test.ts +2 -52
- package/tests/review-host-relay-routing.test.ts +59 -298
- package/tests/review-host-relay.test.ts +0 -46
- package/tests/review-integration-nonblocking-findings.test.ts +3 -6
- package/tests/review-integration-v2-forward.test.ts +114 -234
- package/tests/review-integration-v2.test.ts +85 -39
- package/tests/review-json-arguments.test.ts +30 -9
- package/tests/review-legacy-check.test.ts +38 -0
- package/tests/review-object-store.test.ts +2 -57
- package/tests/review-one-call-findings.test.ts +1 -0
- package/tests/review-one-call.test.ts +56 -0
- package/tests/review-risk-assessment.test.ts +14 -43
- package/tests/review-run-escalate-forwarding.test.ts +59 -0
- package/tests/review-sidebar-state.test.ts +2 -1
- package/tests/review-untracked-inventory-replay.test.ts +181 -0
- package/tests/runtime-harness.mjs +30 -4
- package/tests/sensitive-path-tools.test.ts +210 -5
- package/tests/session-profile-binding-observers.test.ts +47 -0
- package/tests/session-profile-extension.test.ts +109 -11
- package/tests/session-profile-freeze.test.ts +49 -2
- package/tests/session-profile-v1-compat.test.ts +11 -3
- package/tests/session-worktree-registry.test.ts +23 -0
- package/tests/shell-bar.test.ts +21 -3
- package/tests/shell-changes-idle-start.test.ts +510 -0
- package/tests/shell-changes-untracked-bound.test.ts +230 -0
- package/tests/shell-changes-view.test.ts +8 -2
- package/tests/shell-changes.test.ts +134 -0
- package/tests/shell-git-runner-stall.test.ts +74 -0
- package/tests/shell-git-worker-fallback.test.ts +140 -0
- package/tests/shell-git-worker-lifetime.test.ts +91 -0
- package/tests/shell-render-cache-runtime.test.ts +256 -3
- package/tests/shell-sidebar-layout.test.ts +1 -1
- package/tests/shell-sidebar-scroll-benchmark.test.ts +14 -5
- package/tests/shell-untracked-cache.test.ts +213 -0
- package/tests/short-check-routing-contract.test.ts +11 -7
- package/tests/skill-references.test.ts +39 -0
- package/tests/skill-registry.test.ts +4 -4
- package/tests/startup-banner.test.ts +2 -1
- package/tests/status-timing-diagnostics.test.ts +2 -1
- package/tests/support/capabilities-v26.ts +22 -0
- package/tests/support/chat-ui.ts +39 -0
- package/tests/support/review-coordinator-runtime.ts +11 -2
- package/tests/support/status-v9.ts +8 -0
- package/tests/t7-recovery-preservation.test.ts +68 -0
- package/tests/tower-open.test.ts +24 -0
- package/tests/tower-pack.test.ts +48 -0
- package/tests/tps-policy.test.ts +96 -0
- package/tests/turn-end-rule-contract.test.ts +155 -0
- package/tests/turn-end-scope.test.ts +39 -0
- package/tests/verification-proportionality.test.ts +1 -1
- package/tests/verification-scoped-stop-contract.test.ts +1 -1
- package/tests/verification-tiers-contract.test.ts +4 -3
- package/tests/verifier-admission.test.ts +1 -1
- package/tests/verifier-preparation.test.ts +94 -1
- package/tests/verifier-settle-reminder.test.ts +1 -1
- package/tests/verify-first-launch-contract.test.ts +19 -7
- package/tests/vim-editor-adapter.test.ts +12 -2
- package/tests/voice-install.test.ts +97 -11
- package/tests/windows-hidden-processes.test.ts +11 -44
- package/tests/work-continuity-contract.test.ts +48 -55
- package/tests/yolo-session-policy.test.ts +2 -0
- package/web/tower/dist/assets/BatchableSprite-BJ_TQxjN.js +217 -0
- package/web/tower/dist/assets/BufferResource-DeJpHuO6.js +139 -0
- package/web/tower/dist/assets/CanvasPool-cwc03T_x.js +23 -0
- package/web/tower/dist/assets/CanvasRenderer-DO84oP5R.js +1 -0
- package/web/tower/dist/assets/Filter-BKhT9lO8.js +1 -0
- package/web/tower/dist/assets/GlUniformGroupSystem-DluI7cqd.js +130 -0
- package/web/tower/dist/assets/GpuUboSystem-CM4Dys0F.js +17 -0
- package/web/tower/dist/assets/Graphics-3OyUtCzC.js +1 -0
- package/web/tower/dist/assets/RenderTargetSystem-X-9GAQ1C.js +184 -0
- package/web/tower/dist/assets/WebGLRenderer-I0fqIX1w.js +20 -0
- package/web/tower/dist/assets/WebGPURenderer-BRWSXotK.js +79 -0
- package/web/tower/dist/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/web/tower/dist/assets/abnfDiagram-VCTEODGH-C4iBBhTL.js +1 -0
- package/web/tower/dist/assets/architectureDiagram-5GKGNRK7-Ih-qvfTu.js +36 -0
- package/web/tower/dist/assets/blockDiagram-I7D4REHJ-I9z_u3wb.js +129 -0
- package/web/tower/dist/assets/browserAll-gmBFNIA4.js +14 -0
- package/web/tower/dist/assets/c4Diagram-7LVT6UL2-DOyk2rEJ.js +38 -0
- package/web/tower/dist/assets/canvasUtils-DTaMcbkN.js +1 -0
- package/web/tower/dist/assets/channel-wuxBkGGz.js +1 -0
- package/web/tower/dist/assets/chunk-2Q5K7J3B-BaJ-OrJ_.js +1 -0
- package/web/tower/dist/assets/chunk-5VM5RSS4-wICrhvyw.js +15 -0
- package/web/tower/dist/assets/chunk-F27PBJKO-DUQ_JqvZ.js +1 -0
- package/web/tower/dist/assets/chunk-IMKFNOWR-DKfgQrGM.js +231 -0
- package/web/tower/dist/assets/chunk-JWPE2WC7-1k1LW87d.js +1 -0
- package/web/tower/dist/assets/chunk-POPQ4Y6H-Df8cN2w9.js +1 -0
- package/web/tower/dist/assets/chunk-SVP7TREG-CxU5LDj8.js +88 -0
- package/web/tower/dist/assets/chunk-TICWLB2K-CEuHEBi0.js +206 -0
- package/web/tower/dist/assets/chunk-XXDRQBXY-CbSAjj9l.js +1 -0
- package/web/tower/dist/assets/classDiagram-ZZMXUADV-DbRmVQRX.js +1 -0
- package/web/tower/dist/assets/classDiagram-v2-VYDZK3BY-DbRmVQRX.js +1 -0
- package/web/tower/dist/assets/cose-bilkent-JH36ORCC-8xZLSHER.js +1 -0
- package/web/tower/dist/assets/cynefin-OW5HDTMX-Cw4XG9Zj.js +166 -0
- package/web/tower/dist/assets/cynefinDiagram-5FMLGOSQ-CcQdokUv.js +62 -0
- package/web/tower/dist/assets/cytoscape.esm-BHa1VTXv.js +321 -0
- package/web/tower/dist/assets/d3-scale-4DPf7zan.js +1 -0
- package/web/tower/dist/assets/dagre-GXQ25YYZ-D-Xv7L9X.js +4 -0
- package/web/tower/dist/assets/diagram-S7CK7UJ4-Bqy2eT2c.js +30 -0
- package/web/tower/dist/assets/diagram-UQ7AKVKN-B2wK2GHj.js +41 -0
- package/web/tower/dist/assets/diagram-VSXAHHWV-CIZqh7BH.js +3 -0
- package/web/tower/dist/assets/diagram-VX7I27RA-BGX4HBj2.js +24 -0
- package/web/tower/dist/assets/diagram-Z3DM3KII-DYpsfaJW.js +24 -0
- package/web/tower/dist/assets/ebnfDiagram-PWID7BFC-BNnwCZNv.js +1 -0
- package/web/tower/dist/assets/erDiagram-RLTQ6QDP-_MN9W-1E.js +99 -0
- package/web/tower/dist/assets/flowDiagram-HODETNUW-D_ndx1UC.js +168 -0
- package/web/tower/dist/assets/ganttDiagram-EL5Y4UJY-C8chdEiZ.js +292 -0
- package/web/tower/dist/assets/getPo2TextureFromSource-CqJsdi0J.js +1 -0
- package/web/tower/dist/assets/getTexelRangeRects-DN3N5aFp.js +57 -0
- package/web/tower/dist/assets/getTextureBatchBindGroup-RNSiAVH3.js +1 -0
- package/web/tower/dist/assets/gitGraphDiagram-WWUBYQGX-B5ijv7LI.js +106 -0
- package/web/tower/dist/assets/index-B1Ho-Igs.css +1 -0
- package/web/tower/dist/assets/index-CfNjH1Wr.js +45 -0
- package/web/tower/dist/assets/infoDiagram-27XIBGKW-AYbp5ElT.js +2 -0
- package/web/tower/dist/assets/ishikawaDiagram-5VMMS53U-DnmwARuR.js +70 -0
- package/web/tower/dist/assets/journeyDiagram-3NMN7TZE-CK737kko.js +139 -0
- package/web/tower/dist/assets/kanban-definition-UXKFOSKX-0AhM3axC.js +89 -0
- package/web/tower/dist/assets/katex-HP8lGamR.js +257 -0
- package/web/tower/dist/assets/layout-wOIeK9c_.js +1 -0
- package/web/tower/dist/assets/mermaid.core-CGYyw6G7.js +310 -0
- package/web/tower/dist/assets/mindmap-definition-YA3MSWOX-CkZ_JOdx.js +96 -0
- package/web/tower/dist/assets/pegDiagram-XKGWAZYB-CHAPspih.js +1 -0
- package/web/tower/dist/assets/pieDiagram-E7YTZNPT-LwCcZl5o.js +39 -0
- package/web/tower/dist/assets/preload-helper-PPVm8Dsz.js +1 -0
- package/web/tower/dist/assets/quadrantDiagram-AXDQQJYC-Cm4uijV2.js +7 -0
- package/web/tower/dist/assets/railroadDiagram-O6MQD6OU-BPQHZ2b5.js +1 -0
- package/web/tower/dist/assets/requirementDiagram-BXWQKSXE-JLtSUDfS.js +84 -0
- package/web/tower/dist/assets/sankeyDiagram-P5KCCOFB-DJsYv9ii.js +40 -0
- package/web/tower/dist/assets/sequenceDiagram-WJ2MYXX4-Ca8T8sT0.js +162 -0
- package/web/tower/dist/assets/sizeCapture-INFHLROL-Ch4i2dS-.js +1 -0
- package/web/tower/dist/assets/stateDiagram-D77RDMKH-DDSkncYm.js +1 -0
- package/web/tower/dist/assets/stateDiagram-v2-MP3YSRHH-BkO_9mIH.js +1 -0
- package/web/tower/dist/assets/swimlanes-42K2YHIH-Bns5iI3y.js +1 -0
- package/web/tower/dist/assets/swimlanesDiagram-VR7AAH4N--LEBb1ti.js +8 -0
- package/web/tower/dist/assets/timeline-definition-24CTP7MA-QJDuVTb3.js +120 -0
- package/web/tower/dist/assets/vennDiagram-4TSXK5OY-pBNxKxOV.js +34 -0
- package/web/tower/dist/assets/wardleyDiagram-VM6X3IG4-1PEarjN1.js +78 -0
- package/web/tower/dist/assets/webworkerAll-D_Np003p.js +83 -0
- package/web/tower/dist/assets/xychartDiagram-S5SC5T6Z-CLwsvOg7.js +7 -0
- package/web/tower/dist/index.html +41 -0
- package/contracts/review-provider-contract-mirror/v1.6.0/bundle/vectors/lens.json +0 -1
- package/docs/review-delivery-preflight.md +0 -22
- package/extensions/codegraph-tools.ts +0 -437
- package/lib/native-review-authority-quarantine.ts +0 -2
- package/lib/review-delivery-preflight.ts +0 -85
- package/lib/review-legacy-detector.ts +0 -81
- package/tests/child-codegraph-bootstrap.test.ts +0 -74
- package/tests/codegraph-tools.test.ts +0 -554
- package/tests/fixtures/devbinary/capabilities-v2.1.derived.json +0 -331
- package/tests/fixtures/refusal-identity.probe.mjs +0 -139
- package/tests/native-review-authority-quarantine.test.ts +0 -10
- package/tests/native-review-refusal-identity.test.ts +0 -25
- package/tests/review-delivery-preflight.test.ts +0 -462
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.6.0 → v1.7.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
-
import { existsSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { existsSync, mkdirSync, mkdtempSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { tmpdir } from "node:os";
|
|
4
4
|
import { dirname, join } from "node:path";
|
|
5
5
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
@@ -18,7 +18,7 @@ import {
|
|
|
18
18
|
type DesktopFeedTimers,
|
|
19
19
|
} from "../lib/desktop-feed.ts";
|
|
20
20
|
import { createDesktopFeedStore, desktopFeedFile } from "../lib/desktop-feed-store.ts";
|
|
21
|
-
import { createUntrackedLineCounter } from "../lib/desktop-feed-sources.ts";
|
|
21
|
+
import { createParentOf, createUntrackedLineCounter, parseProcessTable, processAncestors, psParentOf } from "../lib/desktop-feed-sources.ts";
|
|
22
22
|
import { SESSION_WORKTREE_ENTRY } from "../lib/session-worktree-registry.ts";
|
|
23
23
|
import { changesModel, type ChangedFile } from "../lib/shell-changes.ts";
|
|
24
24
|
import { DESKTOP_JOBS_SERVICE_CHANNEL, DESKTOP_JOBS_SERVICE_SCHEMA, type DesktopJobEntry } from "../lib/desktop-rpc-jobs.ts";
|
|
@@ -151,6 +151,7 @@ function feedHarness(t: test.TestContext, options: Partial<DesktopFeedOptions> =
|
|
|
151
151
|
git: () => async () => ({ stdout: "", code: 128 }),
|
|
152
152
|
parentOf: async () => undefined,
|
|
153
153
|
profile: () => ({ name: "work (session)", tier: "fast" }),
|
|
154
|
+
persona: () => undefined,
|
|
154
155
|
realpath: (path) => `/private${path}`,
|
|
155
156
|
sweep: () => {},
|
|
156
157
|
store: (dir, sessionId) => {
|
|
@@ -235,6 +236,46 @@ test("S2: unknown sources stay null instead of guessed values", () => {
|
|
|
235
236
|
assert.equal(buildDesktopFeedSnapshot(fixtureInput({ activity: { working: true, blocked: 2, blockedLabel: "Choice awaiting input", streaming: false, phase: undefined } })).activity.state, "blocked");
|
|
236
237
|
});
|
|
237
238
|
|
|
239
|
+
test("should publish the persona the input carries", () => {
|
|
240
|
+
assert.equal(buildDesktopFeedSnapshot(fixtureInput({ persona: "neutral" })).persona, "neutral");
|
|
241
|
+
assert.equal(buildDesktopFeedSnapshot(fixtureInput({ persona: "gentleman" })).persona, "gentleman");
|
|
242
|
+
assert.equal(buildDesktopFeedSnapshot(fixtureInput()).persona, null);
|
|
243
|
+
});
|
|
244
|
+
|
|
245
|
+
test("should publish the persona the extension resolves for the session cwd", async (t) => {
|
|
246
|
+
const seen: string[] = [];
|
|
247
|
+
const h = feedHarness(t, { persona: (cwd) => { seen.push(cwd); return "neutral"; } });
|
|
248
|
+
await h.start();
|
|
249
|
+
assert.equal(h.read().persona, "neutral");
|
|
250
|
+
assert.ok(seen.includes("/w"));
|
|
251
|
+
});
|
|
252
|
+
|
|
253
|
+
test("should publish the persona resolved from the project file, then the global one, with the default resolver", async (t) => {
|
|
254
|
+
const root = mkdtempSync(join(tmpdir(), "desktop-feed-persona-"));
|
|
255
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
256
|
+
const configHome = join(root, "config");
|
|
257
|
+
const project = join(root, "project");
|
|
258
|
+
mkdirSync(configHome, { recursive: true });
|
|
259
|
+
mkdirSync(join(project, ".pi", "gentle-ai"), { recursive: true });
|
|
260
|
+
writeFileSync(join(configHome, "persona.json"), JSON.stringify({ mode: "neutral" }));
|
|
261
|
+
const env = { ...GENTLE_ENV, GENTLE_PI_CONFIG_HOME: configHome };
|
|
262
|
+
|
|
263
|
+
const fromGlobal = feedHarness(t, { persona: undefined }, env);
|
|
264
|
+
await fromGlobal.start(fakeCtx({ cwd: project }));
|
|
265
|
+
assert.equal(fromGlobal.read().persona, "neutral");
|
|
266
|
+
|
|
267
|
+
writeFileSync(join(project, ".pi", "gentle-ai", "persona.json"), JSON.stringify({ mode: "gentleman" }));
|
|
268
|
+
const fromProject = feedHarness(t, { persona: undefined }, env);
|
|
269
|
+
await fromProject.start(fakeCtx({ cwd: project }));
|
|
270
|
+
assert.equal(fromProject.read().persona, "gentleman");
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
test("should keep the persona null when resolving it throws", async (t) => {
|
|
274
|
+
const h = feedHarness(t, { persona: () => { throw new Error("unreadable"); } });
|
|
275
|
+
await h.start();
|
|
276
|
+
assert.equal(h.read().persona, null);
|
|
277
|
+
});
|
|
278
|
+
|
|
238
279
|
test("S3: the snapshot names its agent dir as an absolute path, bundled, Pi extension or custom home", () => {
|
|
239
280
|
for (const dir of ["/Users/me/.gentle-shell/agent", "/Users/me/.pi/agent", "/srv/custom-home"]) {
|
|
240
281
|
assert.equal(buildDesktopFeedSnapshot(fixtureInput({ identity: { ...fixtureInput().identity, agentDir: dir } })).identity.agentDir, dir);
|
|
@@ -243,6 +284,47 @@ test("S3: the snapshot names its agent dir as an absolute path, bundled, Pi exte
|
|
|
243
284
|
assert.equal(relative, join(process.cwd(), "rel", "agent"));
|
|
244
285
|
});
|
|
245
286
|
|
|
287
|
+
// ---- Process ancestry (how a Herdr terminal finds its session) ----
|
|
288
|
+
|
|
289
|
+
// agent 33128 <- launch.mjs 44120 <- terminal shell 44712 <- 30320 <- 38628 (no parent).
|
|
290
|
+
const WINDOWS_TABLE = "33128,44120\r\n44120,44712\r\n44712,30320\r\n30320,38628\r\n38628,0\r\n";
|
|
291
|
+
|
|
292
|
+
test("should parse the pid,ppid lines of a Windows process table and ignore other output", () => {
|
|
293
|
+
const table = parseProcessTable(`${WINDOWS_TABLE}warning: something\r\n\r\nabc,def\r\n`);
|
|
294
|
+
assert.equal(table.size, 5);
|
|
295
|
+
assert.equal(table.get(33128), 44120);
|
|
296
|
+
assert.equal(table.get(38628), 0);
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
test("should walk the Windows process table up to the terminal shell with one read per walk", async () => {
|
|
300
|
+
let reads = 0;
|
|
301
|
+
const read = async () => { reads += 1; return WINDOWS_TABLE; };
|
|
302
|
+
assert.deepEqual(await processAncestors(44120, 8, createParentOf("win32", read)), [44712, 30320, 38628]);
|
|
303
|
+
assert.equal(reads, 1);
|
|
304
|
+
assert.deepEqual(await processAncestors(44120, 8, createParentOf("win32", read)), [44712, 30320, 38628]);
|
|
305
|
+
assert.equal(reads, 2, "a new walk reads the table again");
|
|
306
|
+
});
|
|
307
|
+
|
|
308
|
+
test("should publish no ancestors when the Windows process table cannot be read", async () => {
|
|
309
|
+
assert.deepEqual(await processAncestors(44120, 8, createParentOf("win32", async () => undefined)), []);
|
|
310
|
+
assert.deepEqual(await processAncestors(44120, 8, createParentOf("win32", async () => { throw new Error("no powershell"); })), []);
|
|
311
|
+
assert.deepEqual(await processAncestors(44120, 8, createParentOf("win32", () => { throw new Error("spawn failed"); })), []);
|
|
312
|
+
});
|
|
313
|
+
|
|
314
|
+
test("should stop at a Windows parent that is not a real process", async () => {
|
|
315
|
+
assert.deepEqual(await processAncestors(10, 8, createParentOf("win32", async () => "10,20\r\n20,1\r\n")), [20]);
|
|
316
|
+
assert.deepEqual(await processAncestors(20, 8, createParentOf("win32", async () => "20,0\r\n")), []);
|
|
317
|
+
assert.deepEqual(await processAncestors(99, 8, createParentOf("win32", async () => WINDOWS_TABLE)), []);
|
|
318
|
+
});
|
|
319
|
+
|
|
320
|
+
test("should keep asking ps per hop outside Windows and never read a process table", async () => {
|
|
321
|
+
let reads = 0;
|
|
322
|
+
const parentOf = createParentOf("linux", async () => { reads += 1; return WINDOWS_TABLE; });
|
|
323
|
+
assert.equal(parentOf, psParentOf);
|
|
324
|
+
await processAncestors(process.ppid, 8, parentOf);
|
|
325
|
+
assert.equal(reads, 0);
|
|
326
|
+
});
|
|
327
|
+
|
|
246
328
|
// ---- Bounds ----
|
|
247
329
|
|
|
248
330
|
test("S2: arrays and long strings are capped", () => {
|
|
@@ -482,10 +564,10 @@ test("S9: the snapshot lists the session's slash commands: pi's built-ins first,
|
|
|
482
564
|
const items = snapshot.commands.items;
|
|
483
565
|
assert.deepEqual(items.slice(0, DESKTOP_FEED_BUILTIN_COMMANDS.length).map((item) => item.source), DESKTOP_FEED_BUILTIN_COMMANDS.map(() => "builtin"));
|
|
484
566
|
assert.deepEqual(items.slice(DESKTOP_FEED_BUILTIN_COMMANDS.length), [
|
|
485
|
-
{ name: "gentle:status", description: "Show the Gentle status", args: null, terminal: true, source: "extension" },
|
|
486
|
-
{ name: "review", description: `${"x".repeat(DESKTOP_FEED_LIMITS.commandText - 1)}…`, args: null, terminal: false, source: "prompt" },
|
|
487
|
-
{ name: "skill:odd", description: null, args: null, terminal: false, source: "skill" },
|
|
488
|
-
{ name: "badname", description: "control characters", args: null, terminal: true, source: "extension" },
|
|
567
|
+
{ name: "gentle:status", description: "Show the Gentle status", args: null, terminal: true, rpc: true, source: "extension" },
|
|
568
|
+
{ name: "review", description: `${"x".repeat(DESKTOP_FEED_LIMITS.commandText - 1)}…`, args: null, terminal: false, rpc: true, source: "prompt" },
|
|
569
|
+
{ name: "skill:odd", description: null, args: null, terminal: false, rpc: true, source: "skill" },
|
|
570
|
+
{ name: "badname", description: "control characters", args: null, terminal: true, rpc: false, source: "extension" },
|
|
489
571
|
], "the desktop RPC channel and nameless entries are left out; prompts and skills answer in the chat");
|
|
490
572
|
assert.equal(snapshot.commands.truncated, false);
|
|
491
573
|
const many = buildDesktopFeedSnapshot(fixtureInput({ commands: Array.from({ length: 400 }, (_, i) => ({ name: `c${i}`, description: "d", source: "extension" as const })) }));
|
|
@@ -493,6 +575,58 @@ test("S9: the snapshot lists the session's slash commands: pi's built-ins first,
|
|
|
493
575
|
assert.equal(many.commands.truncated, true);
|
|
494
576
|
});
|
|
495
577
|
|
|
578
|
+
test("S4: `terminal` keeps its Herdr meaning for every command after `rpc` is added", () => {
|
|
579
|
+
// Herdr (gentle-chat, gentle-palette) types every command into the TUI and reads `terminal`
|
|
580
|
+
// to decide whether to show the Terminal afterwards: these values must not move.
|
|
581
|
+
const builtinTerminal: Record<string, boolean> = {
|
|
582
|
+
new: false, resume: true, fork: true, clone: false, tree: true, compact: true, name: false, export: true,
|
|
583
|
+
session: true, copy: false, model: true, thinking: true, "scoped-models": true, settings: true, hotkeys: true,
|
|
584
|
+
reload: true, import: true, share: true, changelog: true, trust: true, login: true, logout: true, bug: true,
|
|
585
|
+
};
|
|
586
|
+
const snapshot = buildDesktopFeedSnapshot(fixtureInput({
|
|
587
|
+
commands: [
|
|
588
|
+
{ name: "gentle:status", description: "declared", source: "extension" },
|
|
589
|
+
{ name: "gentle:panel", description: "TUI sheet", source: "extension" },
|
|
590
|
+
{ name: "third-party:thing", description: "undeclared", source: "extension" },
|
|
591
|
+
{ name: "review", description: "template", source: "prompt" },
|
|
592
|
+
{ name: "skill:odd", description: "skill", source: "skill" },
|
|
593
|
+
],
|
|
594
|
+
}));
|
|
595
|
+
const terminal = Object.fromEntries(snapshot.commands.items.map((item) => [item.name, item.terminal]));
|
|
596
|
+
assert.deepEqual(terminal, { ...builtinTerminal, "gentle:status": true, "gentle:panel": true, "third-party:thing": true, review: false, "skill:odd": false });
|
|
597
|
+
});
|
|
598
|
+
|
|
599
|
+
test("S4: `rpc` is true only for declared commands; undeclared extension commands stay false", () => {
|
|
600
|
+
const snapshot = buildDesktopFeedSnapshot(fixtureInput({
|
|
601
|
+
commands: [
|
|
602
|
+
{ name: "gentle:status", description: "notify only", source: "extension" },
|
|
603
|
+
{ name: "gentle:persona", description: "select + notify", source: "extension" },
|
|
604
|
+
{ name: "gentle:panel", description: "ui.custom sheet", source: "extension" },
|
|
605
|
+
{ name: "gentle:customize", description: "refuses outside the TUI", source: "extension" },
|
|
606
|
+
{ name: "gentle:guide", description: "TUI only", source: "extension" },
|
|
607
|
+
{ name: "third-party:thing", description: "undeclared", source: "extension" },
|
|
608
|
+
{ name: "gentle:status:2", description: "a renamed duplicate is not the declared command", source: "extension" },
|
|
609
|
+
{ name: "review", description: "template", source: "prompt" },
|
|
610
|
+
{ name: "skill:odd", description: "skill", source: "skill" },
|
|
611
|
+
],
|
|
612
|
+
}));
|
|
613
|
+
const rpc = Object.fromEntries(snapshot.commands.items.filter((item) => item.source !== "builtin").map((item) => [item.name, item.rpc]));
|
|
614
|
+
assert.deepEqual(rpc, {
|
|
615
|
+
"gentle:status": true, "gentle:persona": true,
|
|
616
|
+
"gentle:panel": false, "gentle:customize": false, "gentle:guide": false, "third-party:thing": false, "gentle:status:2": false,
|
|
617
|
+
review: true, "skill:odd": true,
|
|
618
|
+
});
|
|
619
|
+
for (const item of snapshot.commands.items) assert.equal(typeof item.rpc, "boolean", item.name);
|
|
620
|
+
});
|
|
621
|
+
|
|
622
|
+
test("S4: built-ins carry `rpc` only where Pi's RPC protocol has a matching command", () => {
|
|
623
|
+
const rpc = Object.fromEntries(DESKTOP_FEED_BUILTIN_COMMANDS.map((command) => [command.name, command.rpc]));
|
|
624
|
+
assert.deepEqual(Object.entries(rpc).filter(([, value]) => value).map(([name]) => name).sort(),
|
|
625
|
+
["clone", "compact", "copy", "export", "fork", "model", "name", "new", "session", "thinking"]);
|
|
626
|
+
const items = buildDesktopFeedSnapshot(fixtureInput()).commands.items;
|
|
627
|
+
assert.deepEqual(items, DESKTOP_FEED_BUILTIN_COMMANDS.map((command) => ({ ...command, source: "builtin" })));
|
|
628
|
+
});
|
|
629
|
+
|
|
496
630
|
test("S9: session operations are listed with the screen they open", () => {
|
|
497
631
|
const byName = new Map(DESKTOP_FEED_BUILTIN_COMMANDS.map((command) => [command.name, command]));
|
|
498
632
|
for (const name of ["new", "resume", "fork", "clone", "compact", "name", "export", "tree", "session"]) assert.ok(byName.has(name), name);
|
|
@@ -518,7 +652,7 @@ test("S9: the extension publishes pi's command registry and keeps working withou
|
|
|
518
652
|
];
|
|
519
653
|
await h.start();
|
|
520
654
|
const extension = h.read().commands.items.filter((item) => item.source !== "builtin");
|
|
521
|
-
assert.deepEqual(extension, [{ name: "gentle:changes", description: "Open the changes panel", args: null, terminal: true, source: "extension" }]);
|
|
655
|
+
assert.deepEqual(extension, [{ name: "gentle:changes", description: "Open the changes panel", args: null, terminal: true, rpc: false, source: "extension" }]);
|
|
522
656
|
assert.ok(!readFileSync(h.file, "utf8").includes("/secret/ext.ts"), "source paths never reach the snapshot");
|
|
523
657
|
const bare = feedHarness(t);
|
|
524
658
|
await bare.start();
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { copyFileSync, mkdirSync, mkdtempSync, readdirSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { after, test } from "node:test";
|
|
6
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
7
|
+
|
|
8
|
+
// Which session snapshots are live (herdr/mods/*/snapshot.js liveFeeds): the desktop asks `ps`
|
|
9
|
+
// whether each publisher pid still runs, and `tasklist` where `ps` cannot start (native Windows).
|
|
10
|
+
// Every gentle-* mod carries its own byte-identical copy, so each copy is loaded and checked, with
|
|
11
|
+
// a fake `herdr` host module whose `exec` answers per case.
|
|
12
|
+
|
|
13
|
+
const MODS = fileURLToPath(new URL("../herdr/mods/", import.meta.url));
|
|
14
|
+
const copies = readdirSync(MODS).filter((m) => readdirSync(join(MODS, m)).includes("snapshot.js")).sort();
|
|
15
|
+
|
|
16
|
+
type ExecResult = { code: number; stdout: string; stderr: string };
|
|
17
|
+
type ExecCall = { command: string; args: string[]; options: unknown };
|
|
18
|
+
const host = globalThis as unknown as { __herdrExec: (call: ExecCall) => ExecResult };
|
|
19
|
+
|
|
20
|
+
const scratch = mkdtempSync(join(tmpdir(), "gentle-liveness-"));
|
|
21
|
+
after(() => rmSync(scratch, { recursive: true, force: true }));
|
|
22
|
+
writeFileSync(join(scratch, "package.json"), JSON.stringify({ type: "module" }));
|
|
23
|
+
mkdirSync(join(scratch, "node_modules", "herdr"), { recursive: true });
|
|
24
|
+
writeFileSync(join(scratch, "node_modules", "herdr", "package.json"), JSON.stringify({ name: "herdr", type: "module", exports: "./index.js" }));
|
|
25
|
+
writeFileSync(
|
|
26
|
+
join(scratch, "node_modules", "herdr", "index.js"),
|
|
27
|
+
`export const exec = async (command, args, options) => globalThis.__herdrExec({ command, args, options });
|
|
28
|
+
export const focused = () => null;
|
|
29
|
+
export const agents = () => [];
|
|
30
|
+
export const terminals = () => [];
|
|
31
|
+
export const panes = () => [];
|
|
32
|
+
export const shared = () => null;
|
|
33
|
+
export const setShared = () => {};
|
|
34
|
+
export const home = () => "/home/test";
|
|
35
|
+
export const layout = () => null;
|
|
36
|
+
export const watchFolder = () => {};
|
|
37
|
+
export const run = () => {};
|
|
38
|
+
`,
|
|
39
|
+
);
|
|
40
|
+
|
|
41
|
+
type Feed = { identity: { pid: number; sessionId: string } };
|
|
42
|
+
type Snapshot = { liveFeeds: (feeds: Feed[]) => Promise<Feed[]>; parseTasklistPids: (stdout: string) => Set<number> };
|
|
43
|
+
|
|
44
|
+
// A fresh module per load: liveFeeds keeps the verdicts of the last 5 s at module level.
|
|
45
|
+
let loads = 0;
|
|
46
|
+
const load = async (mod: string, answer: (call: ExecCall) => ExecResult) => {
|
|
47
|
+
mkdirSync(join(scratch, mod), { recursive: true });
|
|
48
|
+
copyFileSync(join(MODS, mod, "snapshot.js"), join(scratch, mod, "snapshot.js"));
|
|
49
|
+
const calls: ExecCall[] = [];
|
|
50
|
+
host.__herdrExec = (call) => {
|
|
51
|
+
calls.push(call);
|
|
52
|
+
return answer(call);
|
|
53
|
+
};
|
|
54
|
+
const snapshot: Snapshot = await import(`${pathToFileURL(join(scratch, mod, "snapshot.js")).href}?load=${++loads}`);
|
|
55
|
+
return { snapshot, calls };
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
const feed = (pid: number): Feed => ({ identity: { pid, sessionId: `s${pid}` } });
|
|
59
|
+
const pids = (feeds: Feed[]) => feeds.map((f) => f.identity.pid);
|
|
60
|
+
const missing = (command: string) => {
|
|
61
|
+
throw new Error(`spawn ${command} ENOENT`);
|
|
62
|
+
};
|
|
63
|
+
// `tasklist /NH /FO CSV` as Windows prints it: one quoted row per process, CRLF line ends.
|
|
64
|
+
const tasklist = (...running: number[]): ExecResult => ({
|
|
65
|
+
code: 0,
|
|
66
|
+
stdout: [`"System Idle Process","0","Services","0","8 K"`, ...running.map((p) => `"app${p}.exe","${p}","Console","1","10,000 K"`)].join("\r\n") + "\r\n",
|
|
67
|
+
stderr: "",
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test("liveness: the copies under test are every gentle-* mod's snapshot.js", () => {
|
|
71
|
+
assert.equal(copies.length, 10);
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
for (const mod of copies) {
|
|
75
|
+
test(`${mod}: an MSYS/Git ps that rejects -o decides nothing, so the session stays listed (#3387)`, async () => {
|
|
76
|
+
const msys: ExecResult = { code: 1, stdout: "", stderr: "ps: unknown option -- o\nTry `ps --help' for more information.\n" };
|
|
77
|
+
const { snapshot, calls } = await load(mod, ({ command }) => (command === "ps" ? msys : missing(command)));
|
|
78
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(14156)])), [14156]);
|
|
79
|
+
// Nothing was recorded: the next refresh asks again instead of reusing a verdict.
|
|
80
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(14156)])), [14156]);
|
|
81
|
+
assert.deepEqual(calls.map((c) => c.command), ["ps", "tasklist", "ps", "tasklist"]);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
test(`${mod}: with an MSYS/Git ps on a Windows PATH, tasklist decides and a closed session is dropped (#3387)`, async () => {
|
|
85
|
+
const msys: ExecResult = { code: 1, stdout: "", stderr: "ps: unknown option -- o\n" };
|
|
86
|
+
const { snapshot } = await load(mod, ({ command }) => (command === "ps" ? msys : tasklist(200)));
|
|
87
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(100), feed(200)])), [200]);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
test(`${mod}: a POSIX ps that exits 1 because one pid is gone still drops that session`, async () => {
|
|
91
|
+
const { snapshot, calls } = await load(mod, ({ command }) => (command === "ps" ? { code: 1, stdout: " 200\n", stderr: "" } : missing(command)));
|
|
92
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(100), feed(200)])), [200]);
|
|
93
|
+
assert.deepEqual(calls.map((c) => [c.command, c.args]), [["ps", ["-o", "pid=", "-p", "100,200"]]]);
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test(`${mod}: where ps cannot start, tasklist lists the running pids and a closed session is dropped (#3352, #3390)`, async () => {
|
|
97
|
+
const { snapshot, calls } = await load(mod, ({ command }) => (command === "tasklist" ? tasklist(200) : missing(command)));
|
|
98
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(100), feed(200)])), [200]);
|
|
99
|
+
assert.deepEqual(calls.map((c) => [c.command, c.args, c.options]), [
|
|
100
|
+
["ps", ["-o", "pid=", "-p", "100,200"], { timeout: 3000 }],
|
|
101
|
+
["tasklist", ["/NH", "/FO", "CSV"], { timeout: 3000 }],
|
|
102
|
+
]);
|
|
103
|
+
// The verdict is kept for 5 s, as with ps: no second listing.
|
|
104
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(100), feed(200)])), [200]);
|
|
105
|
+
assert.equal(calls.length, 2);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
test(`${mod}: when neither ps nor tasklist answers, every session stays listed`, async () => {
|
|
109
|
+
const failures: Array<[string, (command: string) => ExecResult]> = [
|
|
110
|
+
["tasklist cannot start", missing],
|
|
111
|
+
["tasklist fails", () => ({ code: 1, stdout: "", stderr: "ERROR: access denied\r\n" })],
|
|
112
|
+
];
|
|
113
|
+
for (const [name, tasklistAnswer] of failures) {
|
|
114
|
+
const { snapshot, calls } = await load(mod, ({ command }) => (command === "tasklist" ? tasklistAnswer(command) : missing(command)));
|
|
115
|
+
assert.deepEqual(pids(await snapshot.liveFeeds([feed(100), feed(200)])), [100, 200], name);
|
|
116
|
+
assert.deepEqual(calls.map((c) => c.command), ["ps", "tasklist"], name);
|
|
117
|
+
}
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
test(`${mod}: parseTasklistPids reads the pids out of tasklist CSV output`, async () => {
|
|
121
|
+
const { snapshot } = await load(mod, ({ command }) => missing(command));
|
|
122
|
+
assert.deepEqual([...snapshot.parseTasklistPids(tasklist(4, 4321).stdout)].sort((a, b) => a - b), [0, 4, 4321]);
|
|
123
|
+
assert.equal(snapshot.parseTasklistPids("").size, 0);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import { loadChatUi } from "./support/chat-ui.ts";
|
|
4
|
+
|
|
5
|
+
test("should show the persona mode the feed carries as a capitalized name in the Chat header", async (t) => {
|
|
6
|
+
const ui = await loadChatUi(t);
|
|
7
|
+
assert.equal(ui.personaLabel("gentleman"), "Gentleman");
|
|
8
|
+
assert.equal(ui.personaLabel("neutral"), "Neutral");
|
|
9
|
+
assert.equal(ui.personaLabel({ name: "neutral" }), "Neutral");
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
test("should leave the Chat header persona empty when the feed carries none", async (t) => {
|
|
13
|
+
const ui = await loadChatUi(t);
|
|
14
|
+
assert.equal(ui.personaLabel(null), null);
|
|
15
|
+
assert.equal(ui.personaLabel(undefined), null);
|
|
16
|
+
assert.equal(ui.personaLabel(""), null);
|
|
17
|
+
});
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import { test } from "node:test";
|
|
6
|
+
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
7
|
+
import desktopRpc from "../extensions/gentle-desktop-rpc.ts";
|
|
8
|
+
import { DESKTOP_RPC_SCHEMA } from "../lib/desktop-rpc.ts";
|
|
9
|
+
import {
|
|
10
|
+
AGENT_DEFINITIONS_UNAVAILABLE,
|
|
11
|
+
DESKTOP_AGENT_DEFINITIONS_EVENTS,
|
|
12
|
+
DESKTOP_AGENT_DEFINITIONS_LIMITS,
|
|
13
|
+
DESKTOP_AGENT_DEFINITIONS_METHODS,
|
|
14
|
+
INVALID_AGENT_DEFINITIONS_PARAMS,
|
|
15
|
+
projectAgentDefinitions,
|
|
16
|
+
} from "../lib/desktop-rpc-agent-definitions.ts";
|
|
17
|
+
import type { AgentDefinitionsLocationFactory } from "../lib/desktop-agent-definitions-service.ts";
|
|
18
|
+
import type { AgentDefinition } from "../lib/agents-config.ts";
|
|
19
|
+
import { INTERACTIVE_HOST_ENV } from "../lib/rpc-host.ts";
|
|
20
|
+
|
|
21
|
+
// list_agent_definitions: a read over the existing agent discovery
|
|
22
|
+
// (`discoverAgents`, `loadAgentsConfig`) and Pi's orchestrator settings
|
|
23
|
+
// (`readOrchestratorSettings`). The transport tests run the real owners
|
|
24
|
+
// against temporary agent homes and project directories.
|
|
25
|
+
|
|
26
|
+
interface Fixture {
|
|
27
|
+
root: string;
|
|
28
|
+
agentHome: string;
|
|
29
|
+
cwd: string;
|
|
30
|
+
configHome: string;
|
|
31
|
+
settingsPath: string;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
function fixture(t: test.TestContext): Fixture {
|
|
35
|
+
const root = mkdtempSync(join(tmpdir(), "desktop-agent-defs-"));
|
|
36
|
+
t.after(() => rmSync(root, { recursive: true, force: true }));
|
|
37
|
+
const agentHome = join(root, "agent-home");
|
|
38
|
+
const cwd = join(root, "project");
|
|
39
|
+
const configHome = join(root, "config-home");
|
|
40
|
+
for (const dir of [join(agentHome, "agents"), join(agentHome, "subagents"), join(cwd, ".pi", "agents"), configHome]) mkdirSync(dir, { recursive: true });
|
|
41
|
+
return { root, agentHome, cwd, configHome, settingsPath: join(agentHome, "settings.json") };
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function interactiveHost(t: test.TestContext): void {
|
|
45
|
+
const previous = process.env[INTERACTIVE_HOST_ENV];
|
|
46
|
+
process.env[INTERACTIVE_HOST_ENV] = "1";
|
|
47
|
+
t.after(() => {
|
|
48
|
+
if (previous === undefined) delete process.env[INTERACTIVE_HOST_ENV];
|
|
49
|
+
else process.env[INTERACTIVE_HOST_ENV] = previous;
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/** The real Desktop transport on one fake pi, with the definitions read from the fixture. */
|
|
54
|
+
function harness(t: test.TestContext, location: AgentDefinitionsLocationFactory) {
|
|
55
|
+
interactiveHost(t);
|
|
56
|
+
const commands = new Map<string, { handler: (args: string, ctx: any) => Promise<void> }>();
|
|
57
|
+
const handlers = new Map<string, Array<(event: unknown, ctx: any) => unknown>>();
|
|
58
|
+
const pi = {
|
|
59
|
+
registerCommand(name: string, command: any) { commands.set(name, command); },
|
|
60
|
+
registerShortcut() {},
|
|
61
|
+
on(name: string, handler: any) { handlers.set(name, [...(handlers.get(name) ?? []), handler]); },
|
|
62
|
+
events: { on() { return () => {}; }, emit() {} },
|
|
63
|
+
} as unknown as ExtensionAPI;
|
|
64
|
+
desktopRpc(pi, { agentDefinitionsLocation: location });
|
|
65
|
+
const widgets: string[] = [];
|
|
66
|
+
const ctx = {
|
|
67
|
+
mode: "rpc",
|
|
68
|
+
cwd: "/unused",
|
|
69
|
+
sessionManager: { getCwd: () => "/unused", getSessionId: () => "session-a", getEntries: () => [] },
|
|
70
|
+
ui: { setWidget(_key: string, lines: string[]) { widgets.push(...lines); } },
|
|
71
|
+
};
|
|
72
|
+
for (const handler of handlers.get("session_start") ?? []) handler({}, ctx);
|
|
73
|
+
return {
|
|
74
|
+
widgets,
|
|
75
|
+
invoke(requestId: string, params: Record<string, unknown>, method = "list_agent_definitions") {
|
|
76
|
+
return commands.get("gentle:desktop")!.handler(JSON.stringify({ schema: DESKTOP_RPC_SCHEMA, requestId, method, params }), ctx);
|
|
77
|
+
},
|
|
78
|
+
last() { return JSON.parse(widgets.at(-1)!); },
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const locate = (f: Fixture): AgentDefinitionsLocationFactory => () => ({
|
|
83
|
+
roots: { cwd: f.cwd, home: f.root, agentHome: f.agentHome, configHome: f.configHome },
|
|
84
|
+
orchestratorSettingsPath: f.settingsPath,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// ---- Capabilities ----
|
|
88
|
+
|
|
89
|
+
test("the Desktop transport advertises list_agent_definitions once and no new event", async (t) => {
|
|
90
|
+
assert.deepEqual([...DESKTOP_AGENT_DEFINITIONS_METHODS], ["list_agent_definitions"]);
|
|
91
|
+
assert.deepEqual([...DESKTOP_AGENT_DEFINITIONS_EVENTS], []);
|
|
92
|
+
const app = harness(t, locate(fixture(t)));
|
|
93
|
+
await app.invoke("cap-1", {}, "capabilities");
|
|
94
|
+
const response = app.last();
|
|
95
|
+
assert.equal(response.data.methods.filter((method: string) => method === "list_agent_definitions").length, 1);
|
|
96
|
+
assert.ok(response.data.methods.includes("get_update_status"), "the previous methods stay advertised");
|
|
97
|
+
assert.deepEqual(response.data.events, ["config_changed", "permission_mode_changed", "rate_limit", "design_canvas", "jobs_update", "profile_applied", "agents_update", "review_mode_changed", "profile_binding_changed"]);
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// ---- The read ----
|
|
101
|
+
|
|
102
|
+
test("list_agent_definitions answers the discovered agents, subagent defaults, and the default orchestrator, without paths or prompts", async (t) => {
|
|
103
|
+
const f = fixture(t);
|
|
104
|
+
writeFileSync(join(f.agentHome, "agents", "explore.md"), "---\nname: explore\ndescription: Global explorer.\nmodel: openai-codex/gpt-5.6-terra\nthinking: high\ntools: read, grep\n---\nSECRET PROMPT BODY");
|
|
105
|
+
writeFileSync(join(f.agentHome, "agents", "worker.md"), "---\nname: worker\ndescription: Global worker.\n---\nglobal worker body");
|
|
106
|
+
writeFileSync(join(f.cwd, ".pi", "agents", "worker.md"), "---\nname: worker\ndescription: Project worker.\nsubagent_mode: background\n---\nproject worker body");
|
|
107
|
+
writeFileSync(join(f.agentHome, "agents", "broken.md"), "---\nname: broken\nthinking: extreme\n---\nbody");
|
|
108
|
+
writeFileSync(join(f.agentHome, "subagents.json"), JSON.stringify({ default_model: "anthropic/claude-luna", default_mode: "background" }));
|
|
109
|
+
writeFileSync(f.settingsPath, JSON.stringify({ defaultProvider: "openai-codex", defaultModel: "gpt-5.6-terra", defaultThinkingLevel: "medium", theme: "dark" }));
|
|
110
|
+
const app = harness(t, locate(f));
|
|
111
|
+
await app.invoke("defs-1", {});
|
|
112
|
+
const response = app.last();
|
|
113
|
+
assert.equal(response.ok, true);
|
|
114
|
+
assert.deepEqual(response.data, {
|
|
115
|
+
agents: [
|
|
116
|
+
{ name: "explore", description: "Global explorer.", scope: "global", source: "user", model: "openai-codex/gpt-5.6-terra", thinking: "high", mode: null, tools: ["read", "grep"], toolsTruncated: false },
|
|
117
|
+
{ name: "worker", description: "Project worker.", scope: "project", source: "project", model: null, thinking: null, mode: "background", tools: [], toolsTruncated: false },
|
|
118
|
+
],
|
|
119
|
+
truncated: false,
|
|
120
|
+
problems: { invalid: 1, notices: 0 },
|
|
121
|
+
subagentDefaults: { model: "anthropic/claude-luna", thinking: null, mode: "background" },
|
|
122
|
+
defaultOrchestrator: { status: "set", model: "openai-codex/gpt-5.6-terra", thinking: "medium" },
|
|
123
|
+
});
|
|
124
|
+
const raw = app.widgets.at(-1)!;
|
|
125
|
+
assert.equal(raw.includes(f.root.replaceAll("\\", "\\\\")), false, "no path crosses");
|
|
126
|
+
assert.equal(raw.includes("SECRET PROMPT BODY"), false, "no prompt body crosses");
|
|
127
|
+
assert.equal(raw.includes("extreme"), false, "no problem text crosses");
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
test("list_agent_definitions covers the /gentle:profiles roots: built-in package agents, ~/.agents, and <cwd>/.agents, each with its source", async (t) => {
|
|
131
|
+
const f = fixture(t);
|
|
132
|
+
const builtinDir = join(f.root, "package", "agents");
|
|
133
|
+
for (const dir of [builtinDir, join(f.root, ".agents"), join(f.cwd, ".agents")]) mkdirSync(dir, { recursive: true });
|
|
134
|
+
writeFileSync(join(builtinDir, "jd-judge-a.md"), "---\nname: jd-judge-a\ndescription: Built-in judge A.\n---\nbody");
|
|
135
|
+
writeFileSync(join(builtinDir, "planner.md"), "---\nname: planner\ndescription: Built-in planner.\n---\nbody");
|
|
136
|
+
writeFileSync(join(f.root, ".agents", "planner.md"), "---\nname: planner\ndescription: User planner.\n---\nbody");
|
|
137
|
+
writeFileSync(join(f.root, ".agents", "helper.md"), "---\nname: helper\ndescription: User helper.\n---\nbody");
|
|
138
|
+
writeFileSync(join(f.cwd, ".agents", "helper.md"), "---\nname: helper\ndescription: Project helper.\n---\nbody");
|
|
139
|
+
writeFileSync(join(f.cwd, ".agents", "local.md"), "---\nname: local\ndescription: Project local.\n---\nbody");
|
|
140
|
+
const app = harness(t, () => ({ ...locate(f)({} as never), builtinDirs: [builtinDir] }));
|
|
141
|
+
await app.invoke("roots-1", {});
|
|
142
|
+
const agents = app.last().data.agents.map((agent: { name: string; description: string; scope: string; source: string }) => ({ name: agent.name, description: agent.description, scope: agent.scope, source: agent.source }));
|
|
143
|
+
assert.deepEqual(agents, [
|
|
144
|
+
{ name: "helper", description: "Project helper.", scope: "project", source: "project" },
|
|
145
|
+
{ name: "jd-judge-a", description: "Built-in judge A.", scope: "global", source: "builtin" },
|
|
146
|
+
{ name: "local", description: "Project local.", scope: "project", source: "project" },
|
|
147
|
+
{ name: "planner", description: "User planner.", scope: "global", source: "user" },
|
|
148
|
+
]);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
test("the default orchestrator reports missing, unset, and invalid settings by status only", async (t) => {
|
|
152
|
+
const f = fixture(t);
|
|
153
|
+
const app = harness(t, locate(f));
|
|
154
|
+
await app.invoke("orch-missing", {});
|
|
155
|
+
assert.deepEqual(app.last().data.defaultOrchestrator, { status: "missing", model: null, thinking: null });
|
|
156
|
+
writeFileSync(f.settingsPath, JSON.stringify({ theme: "dark" }));
|
|
157
|
+
await app.invoke("orch-unset", {});
|
|
158
|
+
assert.deepEqual(app.last().data.defaultOrchestrator, { status: "unset", model: null, thinking: null });
|
|
159
|
+
writeFileSync(f.settingsPath, "{ not json");
|
|
160
|
+
await app.invoke("orch-invalid", {});
|
|
161
|
+
assert.deepEqual(app.last().data.defaultOrchestrator, { status: "invalid", model: null, thinking: null });
|
|
162
|
+
assert.equal(app.widgets.at(-1)!.includes("settings.json"), false, "the parser reason never crosses");
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
test("an empty install answers no agents and the built-in subagent defaults", async (t) => {
|
|
166
|
+
const app = harness(t, locate(fixture(t)));
|
|
167
|
+
await app.invoke("empty-1", {});
|
|
168
|
+
const data = app.last().data;
|
|
169
|
+
assert.deepEqual(data.agents, []);
|
|
170
|
+
assert.equal(data.truncated, false);
|
|
171
|
+
assert.deepEqual(data.problems, { invalid: 0, notices: 0 });
|
|
172
|
+
assert.deepEqual(data.subagentDefaults, { model: null, thinking: null, mode: "task" });
|
|
173
|
+
});
|
|
174
|
+
|
|
175
|
+
// ---- Errors ----
|
|
176
|
+
|
|
177
|
+
test("list_agent_definitions rejects any param as invalid_request", async (t) => {
|
|
178
|
+
let located = 0;
|
|
179
|
+
const f = fixture(t);
|
|
180
|
+
const app = harness(t, () => { located += 1; return locate(f)(undefined as never); });
|
|
181
|
+
await app.invoke("bad-1", { scope: "project" });
|
|
182
|
+
assert.deepEqual(app.last(), { schema: DESKTOP_RPC_SCHEMA, kind: "response", requestId: "bad-1", ok: false, error: INVALID_AGENT_DEFINITIONS_PARAMS });
|
|
183
|
+
assert.equal(located, 0, "a malformed request never reads");
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
test("a failing read answers agent_definitions_unavailable without its message", async (t) => {
|
|
187
|
+
const app = harness(t, () => { throw new Error("EACCES: C:\\Users\\secret\\.pi\\agent\\agents"); });
|
|
188
|
+
await app.invoke("fail-1", {});
|
|
189
|
+
assert.deepEqual(app.last(), { schema: DESKTOP_RPC_SCHEMA, kind: "response", requestId: "fail-1", ok: false, error: AGENT_DEFINITIONS_UNAVAILABLE });
|
|
190
|
+
assert.equal(app.widgets.at(-1)!.includes("secret"), false);
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
// ---- Bounds ----
|
|
194
|
+
|
|
195
|
+
test("the projection bounds the agent list and each agent's tools", () => {
|
|
196
|
+
const agent = (index: number): AgentDefinition => ({
|
|
197
|
+
name: `agent-${String(index).padStart(3, "0")}`,
|
|
198
|
+
description: "d",
|
|
199
|
+
filePath: `/home/x/.pi/agent/agents/agent-${index}.md`,
|
|
200
|
+
scope: "global",
|
|
201
|
+
instructions: "body",
|
|
202
|
+
model: undefined,
|
|
203
|
+
thinking: undefined,
|
|
204
|
+
mode: undefined,
|
|
205
|
+
tools: Array.from({ length: DESKTOP_AGENT_DEFINITIONS_LIMITS.tools + 1 }, (_, tool) => `tool-${tool}`),
|
|
206
|
+
});
|
|
207
|
+
const result = projectAgentDefinitions({
|
|
208
|
+
agents: Array.from({ length: DESKTOP_AGENT_DEFINITIONS_LIMITS.agents + 1 }, (_, index) => agent(index)),
|
|
209
|
+
errors: [],
|
|
210
|
+
notices: [],
|
|
211
|
+
defaults: { model: undefined, thinking: undefined, mode: "task" },
|
|
212
|
+
orchestrator: { status: "missing" },
|
|
213
|
+
});
|
|
214
|
+
assert.equal(result.agents.length, DESKTOP_AGENT_DEFINITIONS_LIMITS.agents);
|
|
215
|
+
assert.equal(result.truncated, true);
|
|
216
|
+
assert.equal(result.agents[0]!.tools.length, DESKTOP_AGENT_DEFINITIONS_LIMITS.tools);
|
|
217
|
+
assert.equal(result.agents[0]!.toolsTruncated, true);
|
|
218
|
+
assert.equal(JSON.stringify(result).includes("/home/x"), false);
|
|
219
|
+
});
|