gentle-pi 4.7.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +115 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +14 -13
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +476 -0
- package/assets/design-canvas/canvas-boot.js +219 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +397 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +219 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +351 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +167 -0
- package/assets/design-canvas/canvas-theme.js +69 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +773 -17
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +120 -36
- package/assets/design-canvas/inspector.js +574 -21
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +30 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +5 -9
- package/assets/orchestrator-full-delegation-card.md +11 -16
- package/assets/orchestrator-full-delegation.md +9 -9
- package/assets/orchestrator-memory.md +4 -4
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +13 -17
- package/assets/orchestrator-verification.md +12 -10
- package/assets/orchestrator-writer.md +13 -13
- package/assets/orchestrator.md +20 -24
- package/bin/gentle-shell.mjs +205 -10
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/orchestration/pi.md +2 -1
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/routing/pi.md +16 -16
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +23 -5
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +1931 -0
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +102 -17
- package/docs/images/desktop/chat.png +0 -0
- package/docs/images/desktop/palette.png +0 -0
- package/docs/images/desktop/todo.png +0 -0
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +113 -32
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +19 -6
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +48 -9
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +436 -66
- package/extensions/gentle-ai.ts +809 -158
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +276 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +174 -59
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +260 -225
- package/herdr/RECIPE.md +157 -0
- package/herdr/keys.json +14 -0
- package/herdr/layouts/gentle-shell.json +202 -0
- package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-agents/main.js +190 -0
- package/herdr/mods/gentle-agents/mod.json +1 -0
- package/herdr/mods/gentle-agents/snapshot.js +469 -0
- package/herdr/mods/gentle-agents/tokens.js +273 -0
- package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
- package/herdr/mods/gentle-chat/actions.js +180 -0
- package/herdr/mods/gentle-chat/feed.js +321 -0
- package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
- package/herdr/mods/gentle-chat/icons/check.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
- package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
- package/herdr/mods/gentle-chat/icons/down.svg +1 -0
- package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
- package/herdr/mods/gentle-chat/icons/send.svg +1 -0
- package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
- package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
- package/herdr/mods/gentle-chat/icons/term.svg +1 -0
- package/herdr/mods/gentle-chat/icons/user.svg +1 -0
- package/herdr/mods/gentle-chat/icons/x.svg +1 -0
- package/herdr/mods/gentle-chat/main.js +968 -0
- package/herdr/mods/gentle-chat/mod.json +1 -0
- package/herdr/mods/gentle-chat/session.js +212 -0
- package/herdr/mods/gentle-chat/snapshot.js +469 -0
- package/herdr/mods/gentle-chat/tokens.js +137 -0
- package/herdr/mods/gentle-chat/ui.js +883 -0
- package/herdr/mods/gentle-confirm/main.js +60 -0
- package/herdr/mods/gentle-confirm/mod.json +1 -0
- package/herdr/mods/gentle-inspector/actions.js +180 -0
- package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
- package/herdr/mods/gentle-inspector/main.js +500 -0
- package/herdr/mods/gentle-inspector/mod.json +1 -0
- package/herdr/mods/gentle-inspector/snapshot.js +469 -0
- package/herdr/mods/gentle-inspector/tokens.js +273 -0
- package/herdr/mods/gentle-palette/actions.js +180 -0
- package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
- package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
- package/herdr/mods/gentle-palette/icons/check.svg +1 -0
- package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
- package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
- package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
- package/herdr/mods/gentle-palette/icons/review.svg +1 -0
- package/herdr/mods/gentle-palette/icons/search.svg +1 -0
- package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
- package/herdr/mods/gentle-palette/icons/term.svg +1 -0
- package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
- package/herdr/mods/gentle-palette/main.js +333 -0
- package/herdr/mods/gentle-palette/mod.json +1 -0
- package/herdr/mods/gentle-palette/snapshot.js +469 -0
- package/herdr/mods/gentle-palette/tokens.js +273 -0
- package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
- package/herdr/mods/gentle-pane/icons/close.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
- package/herdr/mods/gentle-pane/icons/term.svg +1 -0
- package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
- package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
- package/herdr/mods/gentle-pane/main.js +91 -0
- package/herdr/mods/gentle-pane/mod.json +1 -0
- package/herdr/mods/gentle-pane/snapshot.js +469 -0
- package/herdr/mods/gentle-pane/tokens.js +273 -0
- package/herdr/mods/gentle-sidebar/actions.js +180 -0
- package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
- package/herdr/mods/gentle-sidebar/main.js +171 -0
- package/herdr/mods/gentle-sidebar/mod.json +1 -0
- package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
- package/herdr/mods/gentle-sidebar/tokens.js +273 -0
- package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
- package/herdr/mods/gentle-spaces/machines.js +31 -0
- package/herdr/mods/gentle-spaces/main.js +299 -0
- package/herdr/mods/gentle-spaces/mod.json +1 -0
- package/herdr/mods/gentle-spaces/snapshot.js +469 -0
- package/herdr/mods/gentle-spaces/tokens.js +273 -0
- package/herdr/mods/gentle-status/actions.js +180 -0
- package/herdr/mods/gentle-status/main.js +192 -0
- package/herdr/mods/gentle-status/mod.json +1 -0
- package/herdr/mods/gentle-status/snapshot.js +469 -0
- package/herdr/mods/gentle-status/tokens.js +273 -0
- package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
- package/herdr/mods/gentle-tabs/main.js +171 -0
- package/herdr/mods/gentle-tabs/mod.json +1 -0
- package/herdr/mods/gentle-tabs/snapshot.js +469 -0
- package/herdr/mods/gentle-tabs/tokens.js +273 -0
- package/herdr/mods/gentle-tokens/main.js +20 -0
- package/herdr/mods/gentle-tokens/mod.json +1 -0
- package/herdr/mods/gentle-tokens/snapshot.js +469 -0
- package/herdr/mods/gentle-tokens/tokens.js +273 -0
- package/herdr/preview.png +0 -0
- package/herdr/themes/gentle-shell-dark.json +33 -0
- package/herdr/themes/gentle-shell-light.json +34 -0
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +17 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +92 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/change-diff.ts +104 -0
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +38 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +315 -0
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-feed-actions.ts +804 -0
- package/lib/desktop-feed-answers.ts +129 -0
- package/lib/desktop-feed-sources.ts +184 -0
- package/lib/desktop-feed-stats.ts +98 -0
- package/lib/desktop-feed-store.ts +124 -0
- package/lib/desktop-feed.ts +788 -0
- package/lib/desktop-jobs-service.ts +290 -0
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +403 -0
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +885 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +290 -0
- package/lib/desktop-rpc-permissions.ts +328 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-review.ts +180 -0
- package/lib/desktop-rpc-session.ts +203 -0
- package/lib/desktop-rpc-sessions.ts +250 -0
- package/lib/desktop-rpc-stats.ts +187 -0
- package/lib/desktop-rpc-updates.ts +143 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +336 -0
- package/lib/desktop-session-service.ts +223 -0
- package/lib/desktop-sessions-service.ts +249 -0
- package/lib/desktop-stats-service.ts +142 -0
- package/lib/desktop-updates-service.ts +268 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- package/lib/gentle-shell-desktop.ts +1370 -0
- package/lib/gentle-shell-launcher.ts +45 -3
- package/lib/herdr-desktop-events.ts +40 -0
- package/lib/herdr-desktop-status.ts +229 -0
- package/lib/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +86 -4
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/stats-collector.ts +56 -27
- package/lib/tower-actions.ts +100 -0
- package/lib/tower-hub.ts +73 -0
- package/lib/tower-launch.ts +111 -0
- package/lib/tower-open.ts +99 -0
- package/lib/tower-presence.ts +70 -0
- package/lib/tower-server.ts +234 -0
- package/lib/tower-snapshot.ts +298 -0
- package/lib/update-status.ts +238 -0
- package/lib/verifier-settle-reminder.ts +1 -1
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +14 -5
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +39 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +86 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/runtime/tower-actions.mjs +101 -0
- package/runtime/tower-hub.mjs +74 -0
- package/runtime/tower-launch.mjs +112 -0
- package/runtime/tower-open.mjs +100 -0
- package/runtime/tower-presence.mjs +71 -0
- package/runtime/tower-server.mjs +234 -0
- package/runtime/tower-snapshot.mjs +299 -0
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +5 -21
- package/scripts/build-runtime-modules.mjs +10 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +61 -20
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +26 -7
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-choice.test.ts +78 -21
- package/tests/ask-user-question.test.ts +61 -6
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +148 -27
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/change-diff.test.ts +75 -0
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -878
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +528 -0
- package/tests/design-canvas-inspector.test.ts +1004 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +91 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +189 -0
- package/tests/design-canvas-theme.test.ts +198 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-feed-actions-guards.test.ts +595 -0
- package/tests/desktop-feed-actions.test.ts +761 -0
- package/tests/desktop-feed-live-work.test.ts +209 -0
- package/tests/desktop-feed-performance.test.ts +369 -0
- package/tests/desktop-feed-plan-profiles.test.ts +509 -0
- package/tests/desktop-feed-send-prompt.test.ts +303 -0
- package/tests/desktop-feed-tool-summaries.test.ts +69 -0
- package/tests/desktop-feed.test.ts +615 -0
- package/tests/desktop-rpc-agents.test.ts +1319 -0
- package/tests/desktop-rpc-changes.test.ts +608 -0
- package/tests/desktop-rpc-config-watch.test.ts +1159 -0
- package/tests/desktop-rpc-config.test.ts +1462 -0
- package/tests/desktop-rpc-design.test.ts +672 -0
- package/tests/desktop-rpc-jobs.test.ts +1193 -0
- package/tests/desktop-rpc-permissions.test.ts +321 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-session.test.ts +642 -0
- package/tests/desktop-rpc-sessions.test.ts +647 -0
- package/tests/desktop-rpc-stats.test.ts +431 -0
- package/tests/desktop-rpc-updates.test.ts +525 -0
- package/tests/desktop-rpc-usage.test.ts +707 -0
- package/tests/desktop-rpc.test.ts +293 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +30 -41
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +48 -0
- package/tests/gentle-agents.test.ts +848 -8
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +195 -21
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-desktop-bin.test.ts +125 -0
- package/tests/gentle-shell-desktop.test.ts +927 -0
- package/tests/gentle-shell-launcher-tower.test.ts +104 -0
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +121 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +35 -9
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +181 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +907 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +19 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +33 -15
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +99 -31
- package/tests/orchestrator-budget.test.ts +32 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +12 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +249 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +15 -14
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-routing-measured-values.test.ts +24 -0
- package/tests/pi-update-launcher.test.ts +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/primary-session-prompt.test.ts +25 -0
- package/tests/profile-fast-tier.test.ts +66 -1
- package/tests/provider-defect-handoff.test.ts +124 -99
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-controller.test.ts +2 -1
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator.test.ts +271 -4
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +27 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +312 -18
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +124 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +983 -306
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +386 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +49 -14
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/tower-actions.test.ts +247 -0
- package/tests/tower-artifacts.test.ts +114 -0
- package/tests/tower-open.test.ts +97 -0
- package/tests/tower-presence.test.ts +175 -0
- package/tests/tower-server.test.ts +122 -0
- package/tests/tower-snapshot.test.ts +236 -0
- package/tests/tower-web-echo.test.ts +125 -0
- package/tests/tower-web-hover.test.ts +251 -0
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +88 -12
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +136 -27
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +184 -0
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- package/tests/yolo-mode.test.ts +39 -0
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -39,7 +39,13 @@ const FIXTURE_PATH = join(import.meta.dirname, "fixtures", "orchestrator.pre-die
|
|
|
39
39
|
// Issue #2935 (user decision 2026-11-06): 9,250 -> 9,350 B so the confinement clause keeps its full wording
|
|
40
40
|
// (registered same-clone worktrees, never-blanket grants) while adding the resolved-skill-read exception; the
|
|
41
41
|
// controlled 128-char assets root needs the headroom for platform-independent rendering.
|
|
42
|
-
|
|
42
|
+
// cost-speed-painpoints S5 (T4): the duplicate `## Identity Contract` pointer left the core (the Language Boundary
|
|
43
|
+
// intro carries the same pointer); measured 9,347 -> 9,197 B at the 128-char root: 9,350 -> 9,197 B.
|
|
44
|
+
// cost-speed-painpoints S15 P5a: verdicts C7, C9, C12, X1, X3 and C8 (L41); measured 9,197 -> 9,189 B at the 128-char root.
|
|
45
|
+
// cost-speed P14 (PD-81): the Evidence-budget lookup number matches the runtime notice; measured 9,189 -> 9,177 B.
|
|
46
|
+
// fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory
|
|
47
|
+
// (read/write, deleting only what the session or its tools created); approved up to 9,352 B, measured 9,177 -> 9,347 B at the 128-char root.
|
|
48
|
+
const BUDGET_BYTES = 9347;
|
|
43
49
|
const MIN_CONTROLLED_LONG_ASSETS_ROOT_CHARS = 93;
|
|
44
50
|
|
|
45
51
|
const LAZY_ASSET_NAMES = [
|
|
@@ -132,7 +138,7 @@ function measureOrchestratorPromptBytes(assetsDir: string): number {
|
|
|
132
138
|
// measuring a shorter render again.
|
|
133
139
|
const RDD_WORST_CASE_LINE = "Receipt-driven development: unknown (native status unavailable)";
|
|
134
140
|
|
|
135
|
-
test("getOrchestratorPrompt return value stays within the canonical 9,
|
|
141
|
+
test("getOrchestratorPrompt return value stays within the canonical 9,197 B budget at a short assets root", () => {
|
|
136
142
|
const rendered = __testing.renderOrchestratorPrompt(representativeProductionAssetsDir);
|
|
137
143
|
assert.ok(
|
|
138
144
|
rendered.includes(RDD_WORST_CASE_LINE),
|
|
@@ -203,7 +209,7 @@ const TARGET_FILE: Record<Target, string> = {
|
|
|
203
209
|
// (frozen byte-identical copy of assets/orchestrator.md at 23,047 B / 312 lines).
|
|
204
210
|
const DISPOSITION_MAP: DispositionRange[] = [
|
|
205
211
|
{ lines: [1, 4], target: "replaced", label: "Header + bind: retired phase qualification" },
|
|
206
|
-
{ lines: [5, 8], target: "
|
|
212
|
+
{ lines: [5, 8], target: "replaced", label: "Identity Contract pointer: dropped as a duplicate of the Language Boundary intro pointer (cost-speed-painpoints S5)" },
|
|
207
213
|
{ lines: [9, 13], target: "core", label: "Core Role" },
|
|
208
214
|
{ lines: [15, 15], target: "core", label: "Language Boundary heading" },
|
|
209
215
|
{ lines: [17, 17], target: "core", label: "Language Boundary LB1 pointer" },
|
|
@@ -277,7 +283,9 @@ const DISPOSITION_MAP: DispositionRange[] = [
|
|
|
277
283
|
{ lines: [232, 232], target: "core", label: "Skill Registry Protocol heading" },
|
|
278
284
|
{ lines: [234, 253], target: "replaced", label: "Skill resolution retained without phase roles" },
|
|
279
285
|
{ lines: [255, 255], target: "core", label: "Intent-Driven Skill Discovery heading" },
|
|
280
|
-
{ lines: [257,
|
|
286
|
+
{ lines: [257, 260], target: "skills", label: "Intent-Driven Skill Discovery introduction" },
|
|
287
|
+
{ lines: [261, 264], target: "replaced", label: "Disk-first discovery replaced by the S7 effective session view" },
|
|
288
|
+
{ lines: [265, 276], target: "skills", label: "Intent-Driven Skill Discovery fallback and intent hints" },
|
|
281
289
|
{ lines: [278, 283], target: "core", label: "Safety" },
|
|
282
290
|
{ lines: [285, 312], target: "obsolete", label: "Superseded pre-transaction review contract" },
|
|
283
291
|
];
|
|
@@ -336,6 +344,8 @@ for (const range of DISPOSITION_MAP) {
|
|
|
336
344
|
const trimmed = raw.trim();
|
|
337
345
|
const expected =
|
|
338
346
|
// Preserve the synthesis rule while reserving core bytes for the RDD scope condition.
|
|
347
|
+
// cost-speed-painpoints S15 P5a (verdict C7): organic is inline by default; delegation only by a Mechanism trigger.
|
|
348
|
+
ln === 11 ? "You are a COORDINATOR who executes understood work inline. Maintain one thin conversation thread, delegate only when a Mechanism trigger fires, and synthesize results for the user." :
|
|
339
349
|
ln === 13 ? "Default to concise synthesis: decision, outcome, next action. Expand on request or when detail is needed." :
|
|
340
350
|
ln === 36 ? "- Substantial authorized work: use ODD; track feature progress automatically." :
|
|
341
351
|
trimmed;
|
|
@@ -362,6 +372,22 @@ for (const range of DISPOSITION_MAP) {
|
|
|
362
372
|
);
|
|
363
373
|
}
|
|
364
374
|
|
|
375
|
+
test("lazy skill discovery selects and delegates from the effective view with a disclosed disk-only fallback", () => {
|
|
376
|
+
const skills = readRealAsset("orchestrator-skills.md");
|
|
377
|
+
for (const required of [
|
|
378
|
+
"Match task context and target files against the effective view's `Trigger / description` column.",
|
|
379
|
+
"Pass only matching exact `Path` values to subagents under `## Skills to load before work`.",
|
|
380
|
+
"Tell subagents to read those exact `SKILL.md` files before reading, writing, reviewing, testing, or creating artifacts.",
|
|
381
|
+
"The effective view is `<available_skills>` plus the on-disk rows of the `Effective session skills` system-prompt block",
|
|
382
|
+
"Consult `<available_skills>` and the `Effective session skills` block, when present, before acting or delegating.",
|
|
383
|
+
"Read the matching exact `SKILL.md` path when acting; pass it to the subagent when delegating.",
|
|
384
|
+
"If the view is unavailable, disclose the limitation; `.atl/skill-registry.md` is a disk-only fallback, not a complete Pi view.",
|
|
385
|
+
"If an expected workflow is absent, search configured skill roots only as a fallback. Prefer the most specific project skill over a global skill with the same intent.",
|
|
386
|
+
"If no matching skill exists, continue with the smallest safe fallback and say which expected skill was unavailable.",
|
|
387
|
+
]) assert.ok(skills.includes(required), `missing skill-discovery rule: ${required}`);
|
|
388
|
+
assert.doesNotMatch(skills, /1\. Read `\.atl\/skill-registry\.md` when present\./);
|
|
389
|
+
});
|
|
390
|
+
|
|
365
391
|
// ---------------------------------------------------------------------------
|
|
366
392
|
// 2.4 — Core-alone load-bearing tokens (JD-007) — assert on the raw core
|
|
367
393
|
// string alone, no lazy union.
|
|
@@ -394,7 +420,8 @@ test("lazy coordination detail retains subject guidance without inflating the co
|
|
|
394
420
|
|
|
395
421
|
test("core-alone: dynamic Gentle AI ownership replaces package lifecycle instructions", () => {
|
|
396
422
|
const core = readRealAsset("orchestrator.md");
|
|
397
|
-
|
|
423
|
+
// cost-speed-painpoints S15 P5a (verdict X1): the contract is injected only while RDD is not off.
|
|
424
|
+
assert.match(core, /While RDD is not off, this package injects the mirrored provider-bundle review execution contract;/);
|
|
398
425
|
assert.match(core, /Absent that mirrored contract, this package invents no lifecycle instructions/);
|
|
399
426
|
assert.doesNotMatch(core, /start -> finalize -> validate/i);
|
|
400
427
|
assert.doesNotMatch(core, /receipt validation/i);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
|
+
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
3
|
import { execFileSync } from "node:child_process";
|
|
3
4
|
import { chmodSync, existsSync, lstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
5
|
import { createHash } from "node:crypto";
|
|
@@ -52,7 +53,7 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
52
53
|
const ai = await import("@earendil-works/pi-ai");
|
|
53
54
|
const { default: gentleAgents } = await import("../extensions/gentle-agents.ts");
|
|
54
55
|
const { default: gentleShell } = await import("../extensions/gentle-shell.ts");
|
|
55
|
-
const { resolveSessionWorktreeWithGit } = await import("../lib/session-worktree-registry.ts");
|
|
56
|
+
const { resolveSessionWorktreeWithGit, SESSION_WORKTREE_CHANGED } = await import("../lib/session-worktree-registry.ts");
|
|
56
57
|
const { ORCHESTRATOR_STATE_ENTRY } = await import("../lib/orchestrator-state.ts");
|
|
57
58
|
assert.equal(sdk.getAgentDir(), profile);
|
|
58
59
|
const gitEnv = { PATH: process.env.PATH, HOME: root, GIT_CONFIG_NOSYSTEM: "1", GIT_CONFIG_GLOBAL: join(root, "gitconfig") };
|
|
@@ -71,16 +72,18 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
71
72
|
const roots = Array.from({ length: 10 }, (_, i) => join(root, `wt${i}`));
|
|
72
73
|
for (const cwd of roots) git(clone, "worktree", "add", "--detach", cwd, "HEAD");
|
|
73
74
|
const gitProbes = new Map<string, number>();
|
|
74
|
-
const
|
|
75
|
+
const metadataQuery = new AsyncLocalStorage<string>();
|
|
76
|
+
const gitProbeOrigins: Array<{ cwd: string; caller?: string; operation: string; origin: string[] }> = [];
|
|
75
77
|
const runGit = new Proxy(execFileSync, { apply(target, _this, [command, args, options]) {
|
|
76
78
|
assert.equal(command, "git");
|
|
77
79
|
assert.ok(String(args[args.indexOf("-C") + 1]).startsWith(root + "/"));
|
|
78
80
|
const cwd = String(args[args.indexOf("-C") + 1]);
|
|
79
|
-
|
|
81
|
+
const caller = metadataQuery.getStore();
|
|
82
|
+
gitProbeOrigins.push({ cwd, caller, operation: String(args.at(-1)), origin: (new Error().stack ?? "").split("\n").flatMap(line => {
|
|
80
83
|
const name = line.match(/\bat (?:async )?([A-Za-z_][\w.$]*)\s*\(/)?.[1];
|
|
81
84
|
return name ? [name] : [];
|
|
82
85
|
}).slice(0, 8) });
|
|
83
|
-
gitProbes.set(
|
|
86
|
+
if (caller !== undefined) gitProbes.set(caller, (gitProbes.get(caller) ?? 0) + 1);
|
|
84
87
|
return Reflect.apply(target, undefined, [command, args, { ...options, env: gitEnv }]);
|
|
85
88
|
} });
|
|
86
89
|
const resolver = (path: string, cwd: string) => resolveSessionWorktreeWithGit(path, cwd, runGit);
|
|
@@ -124,13 +127,24 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
124
127
|
let ctx: ExtensionContext | undefined;
|
|
125
128
|
const shutdown: Array<() => Promise<void>> = [];
|
|
126
129
|
const errors: string[] = [];
|
|
130
|
+
let publishScopeChange = () => {};
|
|
127
131
|
const loader = new sdk.DefaultResourceLoader({ cwd, agentDir: profile, settingsManager: settings,
|
|
128
132
|
noExtensions: true, noSkills: true, noPromptTemplates: true, noThemes: true, noContextFiles: true,
|
|
129
133
|
systemPrompt: "PRIVATE_PARENT_INSTRUCTIONS_SENTINEL. Local acceptance fixture. Only execute the requested tools.", appendSystemPrompt: [],
|
|
130
134
|
extensionFactories: [pi => {
|
|
135
|
+
publishScopeChange = () => pi.events.emit(SESSION_WORKTREE_CHANGED, { sessionId: manager.getSessionId() });
|
|
131
136
|
// Capture ONLY public shutdown registrations for cleanup. Business
|
|
132
137
|
// tools/events receive actual SDK contexts, never fabricated contexts.
|
|
133
138
|
const captured = new Proxy(pi, { get(target, key) {
|
|
139
|
+
// Attribute async query work, not unrelated event-time publications
|
|
140
|
+
// that happen to run between SDK tool start/end notifications.
|
|
141
|
+
if (key === "registerTool") {
|
|
142
|
+
const register: ExtensionAPI["registerTool"] = definition => {
|
|
143
|
+
if (!["orchestrator_consult", "orchestrator_list"].includes(definition.name)) return target.registerTool(definition);
|
|
144
|
+
return target.registerTool({ ...definition, execute: (...args) => metadataQuery.run(cwd, () => definition.execute(...args)) });
|
|
145
|
+
};
|
|
146
|
+
return register;
|
|
147
|
+
}
|
|
134
148
|
if (key !== "on") return Reflect.get(target, key);
|
|
135
149
|
const on: ExtensionAPI["on"] = (event, handler) => {
|
|
136
150
|
if (event === "session_shutdown") shutdown.push(async () => { assert.ok(ctx); await handler({ type: "session_shutdown" }, ctx); });
|
|
@@ -227,7 +241,7 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
227
241
|
await session.bindExtensions({ mode: simulatedUI ? "rpc" : "json", uiContext: simulatedUI ? ui : undefined,
|
|
228
242
|
onError: error => { errors.push(error.error); } });
|
|
229
243
|
assert.ok(ctx); assert.equal(ctx.mode, simulatedUI ? "rpc" : "json"); assert.equal(ctx.hasUI, simulatedUI);
|
|
230
|
-
async function tool(name: string, args: ToolCall["arguments"] = {}) {
|
|
244
|
+
async function tool(name: string, args: ToolCall["arguments"] = {}, interleavePublication = false) {
|
|
231
245
|
request = { name, arguments: args };
|
|
232
246
|
let result: { content: Array<{ type: string; text?: string }>; details?: any } | undefined;
|
|
233
247
|
const before = calls;
|
|
@@ -238,11 +252,12 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
238
252
|
if (event.type === "tool_execution_start" && event.toolName === name) {
|
|
239
253
|
toolProbes = gitProbes.get(cwd) ?? 0;
|
|
240
254
|
toolProbeStart = gitProbeOrigins.length;
|
|
255
|
+
if (interleavePublication) queueMicrotask(publishScopeChange);
|
|
241
256
|
}
|
|
242
257
|
if (event.type === "tool_execution_end" && event.toolName === name) {
|
|
243
258
|
result = event.result; failed = event.isError;
|
|
244
259
|
if (name === "orchestrator_consult" || name === "orchestrator_list") {
|
|
245
|
-
const added = gitProbeOrigins.slice(toolProbeStart).filter(probe => probe.
|
|
260
|
+
const added = gitProbeOrigins.slice(toolProbeStart).filter(probe => probe.caller === cwd).slice(0, 2)
|
|
246
261
|
.map(({ operation, origin }) => ({ operation, origin }));
|
|
247
262
|
assert.equal(gitProbes.get(cwd) ?? 0, toolProbes, `metadata query adds no caller Git probes; origins=${JSON.stringify(added)}`);
|
|
248
263
|
}
|
|
@@ -339,8 +354,19 @@ test("public SDK publishes, consults, pages, withdraws and replaces isolated own
|
|
|
339
354
|
assert.doesNotMatch(JSON.stringify(receipt), /PRIVATE_OWNER_HISTORY_SENTINEL|endpoint|consent|activation/);
|
|
340
355
|
return receipt;
|
|
341
356
|
};
|
|
357
|
+
// Negative control: a Git lookup started by an async query is counted,
|
|
358
|
+
// including after an await. The real metadata operations must add none.
|
|
359
|
+
const beforeControl = gitProbes.get(roots[1]) ?? 0;
|
|
360
|
+
await metadataQuery.run(roots[1], async () => {
|
|
361
|
+
await new Promise<void>(resolve => setImmediate(resolve));
|
|
362
|
+
resolver(roots[1], roots[1]);
|
|
363
|
+
});
|
|
364
|
+
assert.equal(gitProbes.get(roots[1]), beforeControl + 2, "query-origin Git probes must remain detectable");
|
|
342
365
|
const first = await consult();
|
|
343
366
|
assert.equal(first.status, "available");
|
|
367
|
+
// A discrete publication can race an unrelated query in the real SDK.
|
|
368
|
+
const coincident = await caller.tool("orchestrator_consult", { recipient_session_id: sid }, true);
|
|
369
|
+
assert.equal(coincident.details.gentleAgents.receipt.status, "available");
|
|
344
370
|
// Hold A's actual SDK main lane busy. B must read the published snapshot
|
|
345
371
|
// before releasing A, without messaging or a helper/receiver model call.
|
|
346
372
|
const busy = owner.deferMain();
|
|
@@ -16,7 +16,8 @@ import test, { after } from "node:test";
|
|
|
16
16
|
const REPO_ROOT = join(import.meta.dirname, "..");
|
|
17
17
|
const REAL_ASSETS_DIR = join(REPO_ROOT, "assets");
|
|
18
18
|
const VARIANT_FILE = "orchestrator-full-delegation.md";
|
|
19
|
-
|
|
19
|
+
// cost-speed-painpoints S15 P5a (verdict C7): the anchor changes together with DELEGATION_MODE_REGION_START.
|
|
20
|
+
const ORGANIC_START = "You are a COORDINATOR who executes understood work inline.";
|
|
20
21
|
const ORGANIC_END = "{{GENTLE_PI_BACKGROUND_POLICY}}";
|
|
21
22
|
|
|
22
23
|
const { __testing } = await import("../extensions/gentle-ai.ts");
|
|
@@ -268,3 +268,31 @@ test("duplicate display names do not become routing identities", (t) => {
|
|
|
268
268
|
assert.deepEqual(candidates.map(c => c.workspace), ["/repo0", "/repo1"]);
|
|
269
269
|
} finally { publishers.forEach(publisher => publisher.dispose()); }
|
|
270
270
|
});
|
|
271
|
+
|
|
272
|
+
test("busy directories paginate so peers beyond the first 128 entries keep their label and curated state (#3185)", (t) => {
|
|
273
|
+
const profile = fixture(t);
|
|
274
|
+
// 130 live peers produce 390 presence files (header + activity + discovery each),
|
|
275
|
+
// far beyond the 128-entry first page. Before #3185 every peer beyond that page
|
|
276
|
+
// resolved to a bare unknown because discovery only ever read the first page.
|
|
277
|
+
const peers = Array.from({ length: 130 }, (_, i) => ({ ...peer, sessionId: `peer-${i}` }));
|
|
278
|
+
const publishers = peers.map((p, i) => PresencePublisher.start({ profile, sessionId: p.sessionId, label: `Peer ${i}`, activity: [] }));
|
|
279
|
+
try {
|
|
280
|
+
for (let i = 0; i < peers.length; i++) {
|
|
281
|
+
publishers[i].updateDiscovery(peers[i], { workspace: `/repo-${i}`, tasks: [], state: {
|
|
282
|
+
schema: 2, sessionId: peers[i].sessionId, cwd: "/repo", recordedAt: 1, source: "owner-curated",
|
|
283
|
+
ownerReply: false, authority: "none", state: { objective: "Ship review", work: { area: "Auth" } },
|
|
284
|
+
} });
|
|
285
|
+
}
|
|
286
|
+
assert.equal(listPresence(profile).overflow, true, "fixture must exceed the 128-entry first page");
|
|
287
|
+
const candidates = discoverOrchestrators(profile, peers);
|
|
288
|
+
assert.equal(candidates.length, peers.length);
|
|
289
|
+
for (const [i, candidate] of candidates.entries()) {
|
|
290
|
+
assert.equal(candidate.label, `Peer ${i}`, `peer-${i} label must survive pagination`);
|
|
291
|
+
assert.equal(candidate.workspace, `/repo-${i}`, `peer-${i} workspace must survive pagination`);
|
|
292
|
+
}
|
|
293
|
+
const stateOnly = discoverOrchestrators(profile, peers, Date.now(), { stateOnly: true });
|
|
294
|
+
for (const [i, candidate] of stateOnly.entries()) {
|
|
295
|
+
assert.equal(candidate.statePublished, true, `peer-${i} curated state must survive pagination`);
|
|
296
|
+
}
|
|
297
|
+
} finally { publishers.forEach(publisher => publisher.dispose()); }
|
|
298
|
+
});
|
|
@@ -54,7 +54,15 @@ test("rendered orchestrator core and selected declarations fit the byte budget",
|
|
|
54
54
|
t.diagnostic(`rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
|
|
55
55
|
// Issue #2935 (user decision): 16,600 -> 16,700 B with the canonical core budget raise to 9,350 B,
|
|
56
56
|
// so the resolved-skill-read exception keeps the full confinement wording.
|
|
57
|
-
|
|
57
|
+
// cost-speed-painpoints S5 (T4): subagent_run states what admission rejects and the core dropped its duplicate
|
|
58
|
+
// Identity Contract pointer; measured 16,674 -> 16,694 B: 16,700 -> 16,694 B.
|
|
59
|
+
// cost-speed-painpoints S15 P7 (S7): the classified-work sentence of orchestrator_session_id became conditional; 16,694 -> 16,691 B.
|
|
60
|
+
// cost-speed-painpoints S15 P5a: always-on verdicts C7, C9, C12, X1, X3 and C8; 16,691 -> 16,683 B.
|
|
61
|
+
// cost-speed P14 (PD-81): the core's Evidence-budget lookup number matches the runtime; 16,683 -> 16,671 B.
|
|
62
|
+
// #3188: orchestrator_session_id state also accepts a JSON string (same validation), +18 B structural anyOf
|
|
63
|
+
// variant with no added description text; 16,671 -> 16,689 B.
|
|
64
|
+
// fix/temp-dir-exemption (user decision 2026-11-16): the confinement clause exempts the OS temp directory; approved up to 16,864 B, measured 16,689 -> 16,859 B.
|
|
65
|
+
assert.ok(total <= 16859, `rendered core ${prompt} B + declarations ${declarationBytes} B = ${total} B`);
|
|
58
66
|
});
|
|
59
67
|
|
|
60
68
|
// Pi 1.4 does not export its pure system assembler from the package root.
|
|
@@ -121,7 +129,9 @@ test("fixed harness is independent of ambient background policy", () => {
|
|
|
121
129
|
});
|
|
122
130
|
|
|
123
131
|
const schemaDigests: Record<string, string> = {
|
|
124
|
-
|
|
132
|
+
// #3188: intentional structural change — state also accepts a JSON string
|
|
133
|
+
// (parsed and validated with the same rules as the object form).
|
|
134
|
+
orchestrator_session_id: "fdd8a6164daeab8625e2569345af0a8fe35a3407c9911823bca44333160e9c9d",
|
|
125
135
|
orchestrator_list: "fe50d306a023bfaf20fddeb8696a3e62b84534b02efb6d699f9991b129a709fa",
|
|
126
136
|
subagent_run: "02e15acc80fde692b0e7ceab434c248b733f33783b176606119969952cd16036",
|
|
127
137
|
};
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { mkdtempSync, readFileSync, rmSync } from "node:fs";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import test, { after, before } from "node:test";
|
|
6
|
+
import gentleAgents from "../extensions/gentle-agents.ts";
|
|
7
|
+
import { __testing, createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
8
|
+
|
|
9
|
+
// ---------------------------------------------------------------------------
|
|
10
|
+
// cost-speed-painpoints S5 (T4): orchestrator prompt diet.
|
|
11
|
+
//
|
|
12
|
+
// The always-on primary prompt is paid on every parent turn, and in full
|
|
13
|
+
// delegation the parent carries it for most of the session's cost. These
|
|
14
|
+
// contracts pin the five changes through the rendered primary prompt for both
|
|
15
|
+
// workflow modes and both personas, plus the lazy assets and tool declarations
|
|
16
|
+
// they touch, and the lowered byte budgets that keep the diet from regrowing.
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
|
|
19
|
+
const REPO_ROOT = join(import.meta.dirname, "..");
|
|
20
|
+
const ASSETS = join(REPO_ROOT, "assets");
|
|
21
|
+
const MODES = ["organic", "full-delegation"] as const;
|
|
22
|
+
const PERSONAS = ["gentleman", "neutral"] as const;
|
|
23
|
+
const ACTIVE_TOOLS = ["read", "bash", "edit", "write", "subagent_run"] as const;
|
|
24
|
+
|
|
25
|
+
let scratch: string;
|
|
26
|
+
const previousConfigHome = process.env.GENTLE_PI_CONFIG_HOME;
|
|
27
|
+
before(() => {
|
|
28
|
+
scratch = mkdtempSync(join(tmpdir(), "t4-diet-"));
|
|
29
|
+
process.env.GENTLE_PI_CONFIG_HOME = join(scratch, "config");
|
|
30
|
+
});
|
|
31
|
+
after(() => {
|
|
32
|
+
if (previousConfigHome === undefined) delete process.env.GENTLE_PI_CONFIG_HOME;
|
|
33
|
+
else process.env.GENTLE_PI_CONFIG_HOME = previousConfigHome;
|
|
34
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
function render(persona: (typeof PERSONAS)[number], mode: (typeof MODES)[number]): string {
|
|
38
|
+
return __testing.buildGentlePrompt(persona, join(scratch, "project"), ACTIVE_TOOLS, undefined, undefined, mode).replaceAll(ASSETS, "/a");
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function read(name: string): string {
|
|
42
|
+
return readFileSync(join(ASSETS, name), "utf8");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
type Declaration = { name: string; description: string; promptSnippet?: string; promptGuidelines?: string[] };
|
|
46
|
+
function registeredTools(): Map<string, Declaration> {
|
|
47
|
+
const tools = new Map<string, Declaration>();
|
|
48
|
+
const pi = {
|
|
49
|
+
on() {}, registerCommand() {}, registerShortcut() {}, registerMessageRenderer() {}, registerEntryRenderer() {},
|
|
50
|
+
events: { on() {}, emit() {} },
|
|
51
|
+
registerTool(tool: Declaration) { tools.set(tool.name, tool); },
|
|
52
|
+
};
|
|
53
|
+
gentleAgents(pi as never, { GENTLE_PI_CONFIG_HOME: scratch }, { home: scratch, agentHome: scratch });
|
|
54
|
+
createGentleAiExtension({ nativeReviewCli: null })(pi as never);
|
|
55
|
+
return tools;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// --- Change 1: the Language Boundary reaches both modes -------------------
|
|
59
|
+
|
|
60
|
+
const ARTIFACTS_IN_ENGLISH = "(code, code comments, UI copy, identifiers, commit messages, filenames, PR descriptions, tests, fixtures, delegated outputs, and repository-facing documentation) default to English, regardless of the user's conversation language or active persona. Override only when the user explicitly requests another language for that artifact, or when extending a project whose existing convention is non-English.";
|
|
61
|
+
const PUBLIC_COMMENTS = "Public/contextual comments and replies are different from technical artifacts.";
|
|
62
|
+
|
|
63
|
+
test("S5 change 1: the full delegation primary carries the Language Boundary (technical artifacts default to English)", () => {
|
|
64
|
+
for (const persona of PERSONAS) {
|
|
65
|
+
const prompt = render(persona, "full-delegation");
|
|
66
|
+
assert.match(prompt, /^## Language Boundary$/m, `[${persona}] full delegation lost the Language Boundary heading`);
|
|
67
|
+
assert.ok(prompt.includes(`Generated technical artifacts — whether by the parent or by subagents — ${ARTIFACTS_IN_ENGLISH}`), `[${persona}] full delegation lost the English-artifacts rule`);
|
|
68
|
+
assert.ok(prompt.includes(PUBLIC_COMMENTS), `[${persona}] full delegation lost the public-comment language rule`);
|
|
69
|
+
assert.ok(prompt.includes("Subagent-facing English delegation and quote/UI exceptions: `orchestrator-full-delegation-card.md`."), `[${persona}] the pointer must name the card that carries those exceptions`);
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
test("S5 change 1 (preserve): organic keeps the Language Boundary byte for byte", () => {
|
|
74
|
+
const raw = read("orchestrator.md");
|
|
75
|
+
const section = raw.slice(raw.indexOf("## Language Boundary"), raw.indexOf("\n## ", raw.indexOf("## Language Boundary") + 1));
|
|
76
|
+
assert.ok(section.includes(`Generated technical artifacts — whether by the parent inline or by subagents — ${ARTIFACTS_IN_ENGLISH}`));
|
|
77
|
+
for (const persona of PERSONAS) assert.ok(render(persona, "organic").includes(section.trim()), `[${persona}] organic must render the asset's Language Boundary verbatim`);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
// --- Change 2: writer-only test-first detail leaves the full delegation parent --
|
|
81
|
+
|
|
82
|
+
const ORGANIC_TEST_FIRST_OPENING = "- For behavior changes with applicable runnable deterministic tests and a clear expected outcome, use test-first by default";
|
|
83
|
+
const FULL_DELEGATION_TEST_FIRST = "- 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.";
|
|
84
|
+
|
|
85
|
+
test("S5 change 2: the full delegation parent carries one short test-first forwarding rule, not the writer procedure", () => {
|
|
86
|
+
for (const persona of PERSONAS) {
|
|
87
|
+
const prompt = render(persona, "full-delegation");
|
|
88
|
+
assert.ok(prompt.includes(FULL_DELEGATION_TEST_FIRST), `[${persona}] full delegation must forward test-first to writers and require their evidence`);
|
|
89
|
+
assert.ok(!prompt.includes(ORGANIC_TEST_FIRST_OPENING), `[${persona}] full delegation must not carry the writer-applied test-first bullet`);
|
|
90
|
+
assert.ok(!prompt.includes("Write one RED test per requested rule."), `[${persona}] writer procedure leaked into the full delegation parent`);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test("S5 change 2 (preserve): organic keeps the full test-first bullet, and the worker still carries the procedure", () => {
|
|
95
|
+
for (const persona of PERSONAS) {
|
|
96
|
+
const bullet = render(persona, "organic").split("\n").find((line) => line.startsWith(ORGANIC_TEST_FIRST_OPENING));
|
|
97
|
+
assert.ok(bullet, `[${persona}] organic lost the test-first bullet`);
|
|
98
|
+
for (const clause of ["Write one RED test per requested rule.", "run one differential check before finishing", "Never invent lifecycle evidence or skip checks.", "Follow orchestrator-delegation.md for ODD forwarding and evidence."]) {
|
|
99
|
+
assert.ok(bullet.includes(clause), `[${persona}] organic test-first bullet lost: ${clause}`);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
const worker = read("agents/gentle-ai-worker.md");
|
|
103
|
+
for (const clause of ["RED", "GREEN", "PRESERVE", "run one differential check before finishing", "no meaningful RED"]) assert.ok(worker.includes(clause), `worker lost ${clause}`);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
// --- Change 3: the Engram mirror is written at task transitions ------------
|
|
107
|
+
|
|
108
|
+
const MIRROR_CADENCE = "Refresh the Engram mirror once per task transition (a task starts, finishes, is blocked, reopened, or dropped) or material plan change, and at close; `## Log` entries and evidence added between those points go to the file only and reach the mirror at the next one.";
|
|
109
|
+
|
|
110
|
+
test("S5 change 3: the mirror cadence is per task transition, with log entries reaching it at the next transition", () => {
|
|
111
|
+
const memory = read("orchestrator-memory.md");
|
|
112
|
+
assert.ok(memory.includes(MIRROR_CADENCE), "orchestrator-memory.md must state the per-transition mirror cadence");
|
|
113
|
+
// The file stays the source and the PR #3083 wording stays: no custom reconciliation gates.
|
|
114
|
+
assert.ok(memory.includes("The file is the source: a mirror that differs from the file just written is refreshed from the file, never a blocker."));
|
|
115
|
+
assert.ok(memory.includes("never author comparison or reconciliation scripts or gates for them"));
|
|
116
|
+
assert.ok(memory.includes("On resume, use `mem_context`"), "resume guarantees must stay");
|
|
117
|
+
assert.doesNotMatch(read("orchestrator-tracking.md"), /mirror[^.]*(?:after every (?:edit|log entry|write)|on every (?:edit|log entry|write))/i, "tracking must not contradict the cadence");
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
// --- Change 4: admission requirements are stated where the launch is composed --
|
|
121
|
+
|
|
122
|
+
const ADMISSION = "Admission rejects writers without repository-relative `## Allowed edit surfaces`; below the context backstop, organic writers without `Spec: odd/tasks/<existing>.md, T<n>` (2+ disjoint writers alone in one message pass) and `gentle-ai-verify` without that or `Risk: item N`.";
|
|
123
|
+
|
|
124
|
+
test("S5 change 4: the subagent_run description names what admission rejects", () => {
|
|
125
|
+
const run = registeredTools().get("subagent_run");
|
|
126
|
+
assert.ok(run, "subagent_run must be registered");
|
|
127
|
+
assert.ok(run.description.startsWith("Delegate a task to a named subagent."), "the original description stays first");
|
|
128
|
+
assert.ok(run.description.includes(ADMISSION), "the admission sentence must be stated exactly");
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// --- Change 5: literal duplicates leave the always-on prompt ----------------
|
|
132
|
+
|
|
133
|
+
test("S5 change 5: the persistent-memory rule is stated once (Identity), not again in Harness principles", () => {
|
|
134
|
+
for (const mode of MODES) for (const persona of PERSONAS) {
|
|
135
|
+
const prompt = render(persona, mode);
|
|
136
|
+
assert.equal(prompt.split("never invent persistent memory").length - 1, 1, `[${mode}/${persona}] Identity memory rule must stay once`);
|
|
137
|
+
assert.ok(!prompt.includes("Never claim persistent memory is available because of this package."), `[${mode}/${persona}] harness duplicate must go`);
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
test("S5 change 5: the neutral persona states its Spanish register once (persona bullets), with no second Language line", () => {
|
|
142
|
+
for (const mode of MODES) {
|
|
143
|
+
const prompt = render("neutral", mode);
|
|
144
|
+
assert.ok(!prompt.includes("Language: neutral/professional Spanish when the user writes Spanish."), `[${mode}] neutral duplicate Language line must go`);
|
|
145
|
+
assert.ok(prompt.includes("- When the user writes Spanish, use neutral/professional Spanish. Do NOT use voseo or any regional conjugations"), `[${mode}] neutral register rule must stay`);
|
|
146
|
+
assert.ok(prompt.includes("- Do not use slang or regional expressions."), `[${mode}] regional-expressions rule must stay`);
|
|
147
|
+
// P14 (PD-57): the gentleman persona also states its register once, in its persona bullet.
|
|
148
|
+
const gentleman = render("gentleman", mode);
|
|
149
|
+
assert.ok(!gentleman.includes("Language: natural Rioplatense Spanish with voseo when the user writes Spanish."), `[${mode}] gentleman duplicate Language line must go`);
|
|
150
|
+
assert.ok(gentleman.includes("- When the user writes Spanish, answer in natural Rioplatense Spanish with voseo."), `[${mode}] gentleman register rule must stay`);
|
|
151
|
+
}
|
|
152
|
+
});
|
|
153
|
+
|
|
154
|
+
test("S5 change 5: gentle_odd_phase does not restate the Phase reporting cadence, but keeps its own rules", () => {
|
|
155
|
+
const phase = registeredTools().get("gentle_odd_phase");
|
|
156
|
+
assert.ok(phase, "gentle_odd_phase must be registered");
|
|
157
|
+
const prose = [phase.promptSnippet ?? "", ...(phase.promptGuidelines ?? [])].join("\n");
|
|
158
|
+
assert.ok(!/never per tool call|never poll or report per tool call/.test(prose), "the cadence lives once, in the always-on Phase reporting line");
|
|
159
|
+
assert.ok(prose.includes("Pass phase exactly as its schema enum"), "schema rule must stay");
|
|
160
|
+
assert.ok(prose.includes("Never call this from a subagent or background/child task"), "child rule must stay: children do not receive Phase reporting");
|
|
161
|
+
for (const mode of MODES) {
|
|
162
|
+
assert.ok(render("gentleman", mode).includes("call it from the primary session only when its ODD phase actually changes, never per tool call or on a fixed cadence"), `[${mode}] Phase reporting keeps the cadence`);
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
|
|
166
|
+
// --- harness-continuity S3: the authorized-work boundary is mode- and RDD-stable ---
|
|
167
|
+
|
|
168
|
+
const CANONICAL_CLOSE = [
|
|
169
|
+
"Authorized work continues: runnable in-scope steps run, a pending child is a wait event whose completion resumes the turn without asking the human",
|
|
170
|
+
"A tracked task ends the turn pending only while it waits on already-launched work, for the affected work a denial, missing consent, the user's explicit stop, or an exhausted limit applies to, or for a genuine human decision still outstanding",
|
|
171
|
+
"only a real human decision, the user's explicit stop, a denial, missing consent, or an exhausted limit stops the work it applies to, never independent authorized work",
|
|
172
|
+
"Missing, partial, unavailable, or declined proof forbids claiming completion of the affected work, never an independently authorized next step",
|
|
173
|
+
"while a required authorized check the existing budget still allows keeps running",
|
|
174
|
+
"Never turn a report into a blind self-reprompt loop.",
|
|
175
|
+
] as const;
|
|
176
|
+
|
|
177
|
+
test("S3: organic and full delegation keep the authorized-work boundary under RDD on and off", () => {
|
|
178
|
+
const statuses = [
|
|
179
|
+
"Receipt-driven development: on (decided by global)",
|
|
180
|
+
"Receipt-driven development: off (decided by global)",
|
|
181
|
+
];
|
|
182
|
+
for (const status of statuses) for (const mode of MODES) {
|
|
183
|
+
const prompt = __testing.buildGentlePrompt("gentleman", join(scratch, "project"), ACTIVE_TOOLS, status, undefined, mode).replaceAll(ASSETS, "/a");
|
|
184
|
+
for (const clause of CANONICAL_CLOSE) assert.ok(prompt.includes(clause), `[${status}/${mode}] canonical Close is missing: ${clause}`);
|
|
185
|
+
assert.ok(prompt.includes("An explicit user stop applies only to the work it names."), `[${status}/${mode}] explicit-stop coverage`);
|
|
186
|
+
assert.ok(!prompt.includes("Needs your decision"), `[${status}/${mode}] no generic terminal phrase`);
|
|
187
|
+
assert.ok(!prompt.includes("never more verification"), `[${status}/${mode}] no broad verification stop`);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
// --- Net bytes: both modes shrink, and the pins follow ----------------------
|
|
192
|
+
|
|
193
|
+
// Measured at /a (normalized assets root), ACTIVE_TOOLS, default RDD line. Base c09189269 rendered
|
|
194
|
+
// organic 25,482/25,778 B and full delegation 23,309/23,605 B (gentleman/neutral); the diet pins the new sizes.
|
|
195
|
+
// cost-speed-painpoints S15 P5a: the verifier-setup paragraph moved to orchestrator-verification.md and the
|
|
196
|
+
// always-on verdicts landed; measured organic 24,256/24,428 B and full delegation 22,161/22,333 B (default RDD line).
|
|
197
|
+
// Verifier B1: the full-delegation Verify mechanism routes a verifier setup failure to that module (+92 B).
|
|
198
|
+
// cost-speed P14: the duplicate gentleman Language line (-80 B, PD-57) and the core's evidence-budget number aligned
|
|
199
|
+
// to the runtime (-12 B in both modes, PD-81); measured organic 24,164/24,416 B and full delegation 22,131/22,383 B.
|
|
200
|
+
const PRIMARY_PROMPT_BUDGETS: Record<(typeof MODES)[number], Record<(typeof PERSONAS)[number], number>> = {
|
|
201
|
+
// fix/temp-dir-exemption (user decision 2026-11-16, approved up to +175 B): the confinement clause exempts the OS temp
|
|
202
|
+
// directory in every mode and persona; measured organic 24,164/24,416 -> 24,251/24,503 B and full delegation
|
|
203
|
+
// 22,128/22,380 -> 22,210/22,462 B.
|
|
204
|
+
organic: { gentleman: 24_251, neutral: 24_503 },
|
|
205
|
+
// cost-speed P6 (X9): launch form, continue-one-worker rule and the tracking pointer, paid by the motivation
|
|
206
|
+
// sentence and a duplicate of step 6's verbatim-request rule (22,253/22,425 -> 22,223/22,395 B).
|
|
207
|
+
// cost-speed P6b: the launch sentence names the same assistant message, the `codemode` route and the sequential
|
|
208
|
+
// tools (+126 B), paid by tightening five sentences of the same asset (22,131/22,383 -> 22,128/22,380 B).
|
|
209
|
+
"full-delegation": { gentleman: 22_210, neutral: 22_462 },
|
|
210
|
+
};
|
|
211
|
+
|
|
212
|
+
test("S5: the rendered primary prompt fits the lowered per-mode budgets", (t) => {
|
|
213
|
+
for (const mode of MODES) for (const persona of PERSONAS) {
|
|
214
|
+
const bytes = Buffer.byteLength(render(persona, mode), "utf8");
|
|
215
|
+
t.diagnostic(`${mode}/${persona}: ${bytes} B (budget ${PRIMARY_PROMPT_BUDGETS[mode][persona]} B)`);
|
|
216
|
+
assert.ok(bytes <= PRIMARY_PROMPT_BUDGETS[mode][persona], `${mode}/${persona} primary prompt is ${bytes} B, over ${PRIMARY_PROMPT_BUDGETS[mode][persona]} B`);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
// --- Verifier follow-up A1: the differential-check pointer is true in both modes --
|
|
221
|
+
|
|
222
|
+
test("S5 A1: the card and its source forward the differential check without naming the harness policy", () => {
|
|
223
|
+
for (const name of ["orchestrator-delegation.md", "orchestrator-full-delegation-card.md"]) {
|
|
224
|
+
const text = read(name);
|
|
225
|
+
assert.ok(!text.includes("the harness test-first policy's differential check"), `${name} must not point at a harness bullet full delegation no longer carries`);
|
|
226
|
+
const line = text.split("\n").find((candidate) => candidate.startsWith("**Differential check (PRESERVE):**"));
|
|
227
|
+
assert.ok(line?.includes("forward the test-first differential check to writers"), `${name} must still forward the differential check to writers`);
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
// --- Change 4 behavior: the admission sentence matches the admission code ---
|
|
232
|
+
|
|
233
|
+
test("S5 change 4: admission behaves as the subagent_run sentence states", async () => {
|
|
234
|
+
const { rejectUndocumentedWriterLaunch } = await import("../lib/bounded-writer-admission.ts");
|
|
235
|
+
const { rejectUnriskedVerifierLaunch } = await import("../lib/verifier-admission.ts");
|
|
236
|
+
const root = mkdtempSync(join(scratch, "admission-"));
|
|
237
|
+
const belowBackstop = { tokens: 1_000, contextWindow: 1_000_000 };
|
|
238
|
+
const env = {};
|
|
239
|
+
const writer = { agent: "gentle-ai-worker", task: "Change one file.\n\n## Allowed edit surfaces\nsrc/a.ts" };
|
|
240
|
+
assert.ok(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic" })?.block, "organic writer without Spec: is rejected below the backstop");
|
|
241
|
+
assert.equal(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "full-delegation" }), undefined, "full delegation never rejects a writer for a missing Spec:");
|
|
242
|
+
const sibling = { agent: "gentle-ai-worker", task: "Change another file.\n\n## Allowed edit surfaces\nsrc/b.ts" };
|
|
243
|
+
const batch = [writer, sibling].map(input => ({ name: "subagent_run", arguments: input }));
|
|
244
|
+
assert.equal(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic", sameMessageCalls: batch }), undefined, "2+ disjoint writers alone in one message pass");
|
|
245
|
+
assert.ok(rejectUndocumentedWriterLaunch(writer, { root, contextUsage: belowBackstop, env, orchestratorMode: "organic", sameMessageCalls: [...batch, { name: "read", arguments: { path: "a" } }] })?.block, "not with another call beside them");
|
|
246
|
+
const verifier = { agent: "gentle-ai-verify", task: "Verify the change." };
|
|
247
|
+
assert.ok(rejectUnriskedVerifierLaunch(verifier, { root, contextUsage: belowBackstop, env })?.block, "verifier without Risk: item N or Spec: is rejected (admission takes no mode, so full delegation too)");
|
|
248
|
+
assert.equal(rejectUnriskedVerifierLaunch({ ...verifier, task: "Verify the change.\nRisk: item 3 (shared parser)" }, { root, contextUsage: belowBackstop, env }), undefined, "a declared Risk: item 3 is admitted");
|
|
249
|
+
});
|
|
@@ -6,8 +6,9 @@ import { readDelegationDetail } from "./support/orchestrator-modules.ts";
|
|
|
6
6
|
|
|
7
7
|
const ROOT = join(import.meta.dirname, "..");
|
|
8
8
|
const ASSETS = join(ROOT, "assets");
|
|
9
|
+
// cost-speed-painpoints S15 P5a (verdict X1): the contract is injected only while RDD is not off.
|
|
9
10
|
const BOUNDARY =
|
|
10
|
-
"
|
|
11
|
+
"While RDD is not off, this package injects the mirrored provider-bundle review execution contract; Gentle AI writes nothing into this prompt. Absent that mirrored contract, this package invents no lifecycle instructions.";
|
|
11
12
|
|
|
12
13
|
function read(relativePath: string): string {
|
|
13
14
|
return readFileSync(join(ROOT, relativePath), "utf8");
|
|
@@ -174,8 +174,10 @@ test("64 unique-peer cap is deterministic; whole-row byte omissions account for
|
|
|
174
174
|
const ambiguous = searchPublishedWork(profile, [...peers, { ...peers[65], endpoint: "/duplicate" }], relatedFilter);
|
|
175
175
|
assert.equal(ambiguous.source?.status, "unavailable");
|
|
176
176
|
assert.equal(ambiguous.matches.length, 0);
|
|
177
|
-
// Directory entries, not admitted headers, bound the presence scan
|
|
178
|
-
|
|
177
|
+
// Directory entries, not admitted headers, bound the presence scan: only the
|
|
178
|
+
// TOTAL 4096-entry budget fails closed now — a busy directory past the first
|
|
179
|
+
// 128-entry page no longer blinds peers (#3185).
|
|
180
|
+
for (let i = 0; i < 4096; i++) writeFileSync(join(profile, "gentle-agents", "presence", `overflow-${i}`), "");
|
|
179
181
|
assert.equal(searchPublishedWork(profile, peers).coverage.unknownContext, 64);
|
|
180
182
|
const rejected = searchPublishedWork(profile, peers, relatedFilter);
|
|
181
183
|
assert.equal(rejected.source?.reason, "source-context-unavailable");
|
|
@@ -1,13 +1,27 @@
|
|
|
1
1
|
import assert from "node:assert/strict";
|
|
2
2
|
import test from "node:test";
|
|
3
|
+
import { spawnSync } from "node:child_process";
|
|
3
4
|
import { fileURLToPath } from "node:url";
|
|
4
|
-
import {
|
|
5
|
+
import { DESIGN_CANVAS_ASSETS } from "../lib/design-canvas-assets.ts";
|
|
6
|
+
import { designCanvasAssetPaths, missingRequiredPaths, requiredPaths } from "../scripts/verify-package-files.mjs";
|
|
5
7
|
|
|
6
8
|
// The voice worker is spawned by path and never imported, so only the package
|
|
7
9
|
// check keeps it in the published tarball next to the modules that launch it.
|
|
8
10
|
|
|
9
11
|
const root = fileURLToPath(new URL("..", import.meta.url));
|
|
10
12
|
|
|
13
|
+
// prepack and prepublishOnly run the check with plain `node`, and Node 23.0-23.5
|
|
14
|
+
// (inside engines >=22.19.0) cannot load TypeScript without a flag.
|
|
15
|
+
test("the package check runs on a Node without TypeScript type stripping", async () => {
|
|
16
|
+
const result = spawnSync(process.execPath, ["--no-experimental-strip-types", "scripts/verify-package-files.mjs"], { cwd: root, encoding: "utf8" });
|
|
17
|
+
assert.equal(result.stderr, "");
|
|
18
|
+
assert.equal(result.status, 0);
|
|
19
|
+
assert.match(result.stdout, /^gentle-pi package resource check passed/);
|
|
20
|
+
const runtime = await import("../runtime/design-canvas-assets.mjs");
|
|
21
|
+
assert.deepEqual(runtime.DESIGN_CANVAS_ASSETS, DESIGN_CANVAS_ASSETS, "the generated module lists the same assets");
|
|
22
|
+
assert.ok(requiredPaths.includes("runtime/design-canvas-assets.mjs"));
|
|
23
|
+
});
|
|
24
|
+
|
|
11
25
|
test("the package check requires the voice command, its modules and the worker script", () => {
|
|
12
26
|
const voice = ["extensions/gentle-voice.ts", "lib/voice-command.ts", "lib/voice-session.ts", "lib/voice-ui.ts", "scripts/voice-worker.cjs", "docs/voice.md"];
|
|
13
27
|
for (const path of voice) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
@@ -17,9 +31,11 @@ test("the package check requires the voice command, its modules and the worker s
|
|
|
17
31
|
// The canvas server reads its page and scripts from assets/ by path, never by import.
|
|
18
32
|
const designCanvas = [
|
|
19
33
|
"lib/design-canvas-server.ts",
|
|
34
|
+
"lib/design-canvas-assets.ts",
|
|
20
35
|
"lib/design-open-browser.ts",
|
|
21
36
|
"lib/design-comments.ts",
|
|
22
37
|
"lib/design-handoffs.ts",
|
|
38
|
+
"lib/design-system-tokens.ts",
|
|
23
39
|
"assets/design-canvas/index.html",
|
|
24
40
|
"assets/design-canvas/canvas.js",
|
|
25
41
|
"assets/design-canvas/canvas.css",
|
|
@@ -32,3 +48,11 @@ test("the package check requires the design command, its helpers and its skill",
|
|
|
32
48
|
for (const path of design) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
33
49
|
assert.deepEqual(missingRequiredPaths(root, design), []);
|
|
34
50
|
});
|
|
51
|
+
|
|
52
|
+
// The server's asset allowlist is the package's list of canvas files (S2).
|
|
53
|
+
test("the package check requires every canvas asset the server serves", () => {
|
|
54
|
+
const assets = Object.keys(DESIGN_CANVAS_ASSETS).map((name) => `assets/design-canvas/${name}`);
|
|
55
|
+
assert.deepEqual([...designCanvasAssetPaths], assets);
|
|
56
|
+
for (const path of assets) assert.ok(requiredPaths.includes(path), `${path} is required`);
|
|
57
|
+
assert.deepEqual(missingRequiredPaths(root, assets), []);
|
|
58
|
+
});
|