gentle-pi 4.7.0 → 4.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +55 -44
- package/assets/agents/gentle-ai-explore.md +3 -3
- package/assets/agents/gentle-ai-verify.md +20 -6
- package/assets/agents/gentle-ai-worker.md +6 -6
- package/assets/agents/jd-judge-a.md +1 -3
- package/assets/agents/jd-judge-b.md +1 -3
- package/assets/agents/review-readability.md +1 -5
- package/assets/agents/review-reliability.md +1 -5
- package/assets/agents/review-resilience.md +1 -5
- package/assets/agents/review-risk.md +1 -5
- package/assets/design-canvas/canvas-api.js +45 -0
- package/assets/design-canvas/canvas-boards.js +456 -0
- package/assets/design-canvas/canvas-boot.js +217 -0
- package/assets/design-canvas/canvas-checks.js +491 -0
- package/assets/design-canvas/canvas-comments.js +315 -0
- package/assets/design-canvas/canvas-compare.js +159 -0
- package/assets/design-canvas/canvas-events.js +75 -0
- package/assets/design-canvas/canvas-export.js +393 -0
- package/assets/design-canvas/canvas-focus.js +203 -0
- package/assets/design-canvas/canvas-handoffs.js +150 -0
- package/assets/design-canvas/canvas-i18n-es.js +392 -0
- package/assets/design-canvas/canvas-i18n.js +108 -0
- package/assets/design-canvas/canvas-layout.js +526 -0
- package/assets/design-canvas/canvas-menu.js +213 -0
- package/assets/design-canvas/canvas-messages.js +86 -0
- package/assets/design-canvas/canvas-minimap.js +163 -0
- package/assets/design-canvas/canvas-parts.js +401 -0
- package/assets/design-canvas/canvas-popover.js +234 -0
- package/assets/design-canvas/canvas-rail.js +348 -0
- package/assets/design-canvas/canvas-sizes.js +524 -0
- package/assets/design-canvas/canvas-store.js +164 -0
- package/assets/design-canvas/canvas-tokens.js +674 -0
- package/assets/design-canvas/canvas-ui.js +24 -0
- package/assets/design-canvas/canvas-view.js +184 -0
- package/assets/design-canvas/canvas.css +746 -15
- package/assets/design-canvas/canvas.js +2 -1506
- package/assets/design-canvas/index.html +117 -36
- package/assets/design-canvas/inspector.js +546 -16
- package/assets/install-wizard/wizard.js +5 -1
- package/assets/migrations/agent-body-history.json +24 -0
- package/assets/orchestrator-delegation-reference.md +8 -14
- package/assets/orchestrator-delegation.md +4 -4
- package/assets/orchestrator-full-delegation-card.md +4 -5
- package/assets/orchestrator-full-delegation.md +8 -8
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +1 -1
- package/assets/orchestrator-quota-recovery.md +5 -0
- package/assets/orchestrator-skills.md +13 -12
- package/assets/orchestrator-tracking.md +10 -14
- package/assets/orchestrator-verification.md +10 -8
- package/assets/orchestrator-writer.md +4 -4
- package/assets/orchestrator.md +18 -22
- package/bin/gentle-shell.mjs +128 -9
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +8 -9
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/orchestration/pi.md +1 -0
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/routing/pi.md +6 -6
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/brand/sponsor-banner.svg +60 -0
- package/docs/bundled-install.md +14 -6
- package/docs/delegated-verification.md +18 -2
- package/docs/desktop-rpc.md +1253 -0
- package/docs/gentle-agents-activity.md +26 -0
- package/docs/gentle-shell.md +39 -16
- package/docs/install-wizard.md +30 -21
- package/docs/odd-preparation-continuity.md +24 -0
- package/docs/permission-modes.md +9 -1
- package/docs/prompt-budget.md +12 -0
- package/docs/rdd-odd-friction-triage-2026-11-07.md +57 -0
- package/docs/readme-reference.md +76 -24
- package/docs/review-coordinator.md +29 -9
- package/docs/review-delivery-preflight.md +22 -0
- package/docs/work-continuity.md +11 -1
- package/extensions/ask-user-question.ts +2 -2
- package/extensions/child-context.ts +21 -7
- package/extensions/gentle-agents.ts +234 -33
- package/extensions/gentle-ai.ts +576 -135
- package/extensions/gentle-design.ts +69 -3
- package/extensions/gentle-desktop-rpc.ts +143 -0
- package/extensions/gentle-guide.ts +3 -0
- package/extensions/gentle-shell.ts +105 -52
- package/extensions/gentle-todo.ts +48 -25
- package/extensions/skill-registry.ts +248 -223
- package/lib/agent-assets.ts +30 -6
- package/lib/agent-tool-overlay.ts +117 -0
- package/lib/agents-config.ts +47 -6
- package/lib/agents-message-delivery.ts +17 -0
- package/lib/agents-messaging.ts +8 -2
- package/lib/agents-protocol.ts +15 -0
- package/lib/agents-report-cap.ts +115 -0
- package/lib/agents-runner.ts +91 -6
- package/lib/agents-session-transport.ts +17 -1
- package/lib/background-jobs-tools.ts +9 -4
- package/lib/bounded-writer-admission.ts +184 -31
- package/lib/child-context-files.ts +21 -6
- package/lib/codemode-renderer.ts +1 -0
- package/lib/delivery-conflict-markers.ts +349 -0
- package/lib/design-canvas-assets.ts +36 -0
- package/lib/design-canvas-server.ts +241 -23
- package/lib/design-comments.ts +94 -4
- package/lib/design-handoffs.ts +2 -1
- package/lib/design-layout.ts +125 -0
- package/lib/design-parts.ts +281 -0
- package/lib/design-system-tokens.ts +111 -0
- package/lib/desktop-agents-service.ts +294 -0
- package/lib/desktop-design-service.ts +233 -0
- package/lib/desktop-jobs-service.ts +263 -0
- package/lib/desktop-rpc-agents.ts +294 -0
- package/lib/desktop-rpc-config.ts +731 -0
- package/lib/desktop-rpc-design.ts +138 -0
- package/lib/desktop-rpc-jobs.ts +181 -0
- package/lib/desktop-rpc-permissions.ts +177 -0
- package/lib/desktop-rpc-profiles.ts +196 -0
- package/lib/desktop-rpc-usage.ts +229 -0
- package/lib/desktop-rpc.ts +225 -0
- package/lib/desktop-usage-service.ts +310 -0
- package/lib/destructive-command-guard.ts +188 -13
- package/lib/gentle-ai-renderer.ts +13 -1
- package/lib/gentle-design.ts +201 -14
- package/lib/gentle-shell-bundled.ts +100 -9
- package/lib/hidden-tools.ts +35 -0
- package/lib/inprocess-reviewer.ts +96 -12
- package/lib/model-fallback-policy.ts +9 -0
- package/lib/model-routing-authority.ts +9 -0
- package/lib/nan-provider.ts +42 -28
- package/lib/native-review-cli.ts +79 -4
- package/lib/orchestrator-discovery.ts +39 -2
- package/lib/reply-language-anchor.ts +27 -2
- package/lib/request-context-placement.ts +53 -0
- package/lib/review-candidate-view.ts +11 -1
- package/lib/review-continuation-registry.ts +17 -0
- package/lib/review-coordinator.ts +252 -8
- package/lib/review-delivery-preflight.ts +85 -0
- package/lib/review-host-relay.ts +5 -1
- package/lib/review-integration-v2.ts +56 -3
- package/lib/reviewer-stream.ts +87 -0
- package/lib/shell-prompt.ts +16 -3
- package/lib/shell-usage.ts +10 -0
- package/lib/vim-editor-adapter.ts +9 -2
- package/lib/writer-batch-admission.ts +55 -0
- package/lib/yolo-session-policy.ts +6 -1
- package/package.json +2 -2
- package/prompts/skill-creation.md +1 -10
- package/runtime/design-canvas-assets.mjs +37 -0
- package/runtime/gentle-shell-bundled.mjs +100 -9
- package/runtime/native-review-cli.mjs +79 -4
- package/runtime/review-integration-v2.mjs +56 -3
- package/scripts/bootstrap.cmd +2 -2
- package/scripts/bootstrap.sh +41 -4
- package/scripts/build-full-delegation-card.mjs +4 -0
- package/scripts/build-runtime-modules.mjs +1 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/gentle-ai-proxy.mjs +1 -1
- package/scripts/installer-downloads.mjs +34 -8
- package/scripts/installer-preflight.mjs +28 -17
- package/scripts/installer-probes.mjs +25 -5
- package/scripts/installer-server.mjs +38 -9
- package/scripts/installer-windows.mjs +2 -2
- package/scripts/pi-update.mjs +166 -27
- package/scripts/prepare-verifier.mjs +107 -0
- package/scripts/update-agent-body-history.mjs +55 -8
- package/scripts/verify-package-files.mjs +40 -19
- package/skills/branch-pr/SKILL.md +16 -16
- package/skills/comment-writer/SKILL.md +1 -1
- package/skills/design/SKILL.md +6 -6
- package/skills/gentle-ai/SKILL.md +5 -5
- package/skills/judgment-day/SKILL.md +2 -2
- package/skills/judgment-day/references/prompts-and-formats.md +1 -1
- package/skills/rdd-defect-workflow/SKILL.md +6 -6
- package/skills/skill-improver/SKILL.md +2 -2
- package/skills/skill-registry/SKILL.md +11 -13
- package/skills/tui-design/SKILL.md +1 -1
- package/skills/work-unit-commits/SKILL.md +5 -5
- package/tests/agent-prompt-diet-contract.test.ts +101 -0
- package/tests/agent-tool-overlay-acceptance.test.ts +158 -0
- package/tests/agent-tool-overlay.test.ts +89 -0
- package/tests/agents-config.test.ts +10 -1
- package/tests/agents-message-delivery.test.ts +36 -0
- package/tests/agents-queries.test.ts +144 -4
- package/tests/agents-report-cap.test.ts +126 -0
- package/tests/agents-runner.test.ts +37 -1
- package/tests/agents-session-transport.test.ts +34 -0
- package/tests/always-on-prompt-verdicts-contract.test.ts +188 -0
- package/tests/append-system-prompt-route.test.ts +10 -2
- package/tests/approved-text-leftovers-contract.test.ts +136 -0
- package/tests/artifact-language.test.ts +1 -1
- package/tests/ask-user-question.test.ts +2 -1
- package/tests/audit-leftovers-contract.test.ts +51 -0
- package/tests/bounded-stop-contract.test.ts +9 -1
- package/tests/branch-pr-skill.test.ts +10 -1
- package/tests/bundled-install.test.ts +1 -1
- package/tests/child-context-files.test.ts +64 -8
- package/tests/child-skills-catalog.test.ts +56 -0
- package/tests/codemode-rendering.test.ts +4 -1
- package/tests/delegate-for-reason-contract.test.ts +30 -8
- package/tests/delivery-conflict-markers.test.ts +348 -0
- package/tests/design-canvas-all-sizes.test.ts +631 -0
- package/tests/design-canvas-allowlist.test.ts +32 -0
- package/tests/design-canvas-assets.test.ts +11 -878
- package/tests/design-canvas-boards.test.ts +77 -0
- package/tests/design-canvas-checks.test.ts +655 -0
- package/tests/design-canvas-compare.test.ts +79 -0
- package/tests/design-canvas-events.test.ts +59 -0
- package/tests/design-canvas-export.test.ts +1168 -0
- package/tests/design-canvas-focus.test.ts +113 -0
- package/tests/design-canvas-handoffs.test.ts +59 -0
- package/tests/design-canvas-i18n-review.test.ts +513 -0
- package/tests/design-canvas-i18n-views.test.ts +259 -0
- package/tests/design-canvas-i18n.test.ts +526 -0
- package/tests/design-canvas-inspector.test.ts +937 -0
- package/tests/design-canvas-layout.test.ts +1222 -0
- package/tests/design-canvas-minimap.test.ts +413 -0
- package/tests/design-canvas-modules.test.ts +90 -0
- package/tests/design-canvas-parts.test.ts +721 -0
- package/tests/design-canvas-rail.test.ts +799 -0
- package/tests/design-canvas-server.test.ts +855 -17
- package/tests/design-canvas-sizes.test.ts +548 -0
- package/tests/design-canvas-store.test.ts +180 -0
- package/tests/design-canvas-tokens.test.ts +965 -0
- package/tests/design-canvas-view.test.ts +299 -0
- package/tests/design-comments.test.ts +201 -1
- package/tests/design-handoffs.test.ts +20 -0
- package/tests/design-layout.test.ts +100 -0
- package/tests/design-parts.test.ts +260 -0
- package/tests/design-system-tokens.test.ts +215 -0
- package/tests/desktop-rpc-agents.test.ts +893 -0
- package/tests/desktop-rpc-config.test.ts +1452 -0
- package/tests/desktop-rpc-design.test.ts +662 -0
- package/tests/desktop-rpc-jobs.test.ts +796 -0
- package/tests/desktop-rpc-permissions.test.ts +311 -0
- package/tests/desktop-rpc-profiles.test.ts +140 -0
- package/tests/desktop-rpc-safety.test.ts +119 -0
- package/tests/desktop-rpc-usage.test.ts +697 -0
- package/tests/desktop-rpc.test.ts +252 -0
- package/tests/devbinary/pi-host-relay.devtest.ts +149 -80
- package/tests/devbinary/review-session-consent.devtest.ts +84 -0
- package/tests/engram-safety.test.ts +111 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.captured.json +92 -0
- package/tests/fixtures/devbinary/status-v9-escalated-non-blocking.provenance.md +3 -0
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +20 -29
- package/tests/fixtures/refusal-identity.probe.mjs +139 -0
- package/tests/full-delegation-closure.test.ts +29 -0
- package/tests/gentle-agents.test.ts +329 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-child-guards.test.ts +1 -0
- package/tests/gentle-ai-installer.test.ts +52 -51
- package/tests/gentle-ai-renderer.test.ts +36 -2
- package/tests/gentle-ai.test.ts +121 -6
- package/tests/gentle-design.test.ts +365 -1
- package/tests/gentle-shell-bundled.test.ts +91 -5
- package/tests/gentle-shell-launcher.test.ts +1 -1
- package/tests/gentle-shell.test.ts +118 -87
- package/tests/gentle-todo.test.ts +32 -9
- package/tests/hidden-tools.test.ts +188 -0
- package/tests/independent-recovery-delivery.test.ts +19 -5
- package/tests/inprocess-reviewer.test.ts +73 -0
- package/tests/install-wizard.test.ts +27 -1
- package/tests/installer-downloads.test.ts +30 -1
- package/tests/installer-posix-bootstrap.test.ts +114 -13
- package/tests/installer-preflight.test.ts +49 -1
- package/tests/installer-probes.test.ts +146 -0
- package/tests/installer-server.test.ts +203 -4
- package/tests/installer-windows-bootstrap.test.ts +19 -1
- package/tests/judgment-day-severity-admission.test.ts +46 -0
- package/tests/lazy-module-contradictions-contract.test.ts +158 -0
- package/tests/maintainer/desktop-rpc.maintest.ts +632 -0
- package/tests/maintainer/pi-update-source.maintest.ts +48 -18
- package/tests/model-fallback-policy.test.ts +26 -7
- package/tests/nan-provider-runtime.test.ts +17 -3
- package/tests/nan-provider.test.ts +111 -56
- package/tests/native-review-capability-contract.test.ts +11 -1
- package/tests/native-review-cli-nonblocking-findings.test.ts +165 -0
- package/tests/native-review-parity.test.ts +24 -5
- package/tests/native-review-refusal-identity.test.ts +25 -0
- package/tests/no-self-pause-contract.test.ts +11 -3
- package/tests/odd-integration.test.ts +11 -3
- package/tests/odd-routing-contract.test.ts +80 -28
- package/tests/orchestrator-budget.test.ts +30 -5
- package/tests/orchestrator-consultation-sdk.test.ts +32 -6
- package/tests/orchestrator-delegation-mode.test.ts +2 -1
- package/tests/orchestrator-discovery.test.ts +28 -0
- package/tests/orchestrator-prompt-budget.test.ts +11 -2
- package/tests/orchestrator-prompt-diet-contract.test.ts +221 -0
- package/tests/orchestrator-rdd-ownership.test.ts +2 -1
- package/tests/orchestrator-work-search.test.ts +4 -2
- package/tests/package-files.test.ts +25 -1
- package/tests/package-manifest.test.ts +11 -10
- package/tests/parallel-reason-contract.test.ts +6 -3
- package/tests/permission-allowlist.test.ts +200 -30
- package/tests/persona-neutral-voseo.test.ts +4 -4
- package/tests/persona-reply-language.test.ts +1 -1
- package/tests/persona-single-channel.test.ts +13 -5
- package/tests/pi-update-launcher.test.ts +17 -7
- package/tests/pi-update-source.test.ts +113 -6
- package/tests/pi-update.test.ts +294 -19
- package/tests/pnpm-workspace-policy.test.ts +47 -0
- package/tests/primary-context-files.test.ts +233 -0
- package/tests/primary-context-three-files.test.ts +174 -0
- package/tests/provider-defect-handoff.test.ts +9 -2
- package/tests/rdd-aware-verification-contract.test.ts +1 -1
- package/tests/rdd-status-line.test.ts +94 -1
- package/tests/reply-language-anchor-placement.test.ts +184 -0
- package/tests/reply-language-anchor.test.ts +17 -1
- package/tests/request-context-append-only.test.ts +218 -0
- package/tests/request-context-placement.test.ts +148 -0
- package/tests/review-agent-end-preflight.test.ts +79 -1
- package/tests/review-candidate-view.test.ts +65 -0
- package/tests/review-continuation-registry.test.ts +31 -0
- package/tests/review-contract-prompt.test.ts +1 -1
- package/tests/review-controller.test.ts +2 -1
- package/tests/review-coordinator-correction-gate.test.ts +105 -0
- package/tests/review-coordinator-findings.test.ts +206 -0
- package/tests/review-coordinator-nonblocking-scope.test.ts +169 -0
- package/tests/review-coordinator.test.ts +271 -4
- package/tests/review-delivery-preflight.test.ts +462 -0
- package/tests/review-due-compaction.test.ts +31 -0
- package/tests/review-due-public-boundary.test.ts +26 -0
- package/tests/review-integration-nonblocking-findings.test.ts +108 -0
- package/tests/review-json-arguments.test.ts +41 -2
- package/tests/review-ledger-contract.test.ts +19 -40
- package/tests/review-loadout-rdd-off-sdk.test.ts +30 -1
- package/tests/review-one-call-findings.test.ts +131 -0
- package/tests/review-one-call-followups.test.ts +308 -0
- package/tests/review-one-call-reviewer-requests.test.ts +207 -0
- package/tests/review-one-call.test.ts +452 -0
- package/tests/review-relay-transport-agent.test.ts +28 -1
- package/tests/review-reviewer-evidence.test.ts +41 -1
- package/tests/review-risk-assessment.test.ts +52 -5
- package/tests/review-run-statement-guidance-independent.test.ts +54 -0
- package/tests/review-session-standing-permission-controller.test.ts +32 -2
- package/tests/review-tool-prose-budget.test.ts +1 -0
- package/tests/reviewer-stream.test.ts +149 -0
- package/tests/session-profile-extension.test.ts +2 -2
- package/tests/shell-prompt.test.ts +17 -0
- package/tests/shell-usage.test.ts +59 -10
- package/tests/skill-contradictions-contract.test.ts +122 -0
- package/tests/skill-registry-watcher.test.ts +216 -2
- package/tests/skill-registry.test.ts +929 -306
- package/tests/support/design-canvas-dom.ts +369 -0
- package/tests/support/review-coordinator-runtime.ts +212 -17
- package/tests/task-size-routing-contract.test.ts +42 -11
- package/tests/test-strength-contract.test.ts +2 -1
- package/tests/todo-request-append-only.test.ts +214 -0
- package/tests/tool-batching-contract.test.ts +3 -1
- package/tests/update-agent-body-history.test.ts +138 -0
- package/tests/verification-tiers-contract.test.ts +229 -0
- package/tests/verifier-preparation.test.ts +229 -0
- package/tests/verify-agent-contract.test.ts +20 -2
- package/tests/verify-first-launch-contract.test.ts +87 -11
- package/tests/vim-editor-adapter.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +54 -11
- package/tests/writer-admission-messages.test.ts +232 -0
- package/tests/writer-batch-admission.test.ts +66 -0
- package/tests/writer-edit-surface-scope.test.ts +52 -20
- package/tests/writer-feature-document-admission.test.ts +184 -0
- package/tests/yolo-mode.test.ts +39 -0
- package/skills/_shared/review-ledger-contract.md +0 -106
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.4.0 → v1.5.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -7,7 +7,7 @@ import { join } from "node:path";
|
|
|
7
7
|
import test, { after, afterEach, type TestContext } from "node:test";
|
|
8
8
|
import { initTheme, type ExtensionAPI, type ExtensionContext, type SlashCommandInfo, type SourceInfo } from "@earendil-works/pi-coding-agent";
|
|
9
9
|
import { CURSOR_MARKER, matchesKey, stripTerminalSequences as stripAnsi, TuiAltScreen, TuiMainScreen, VStack, visibleWidth, type Terminal, type TUI, type TuiMouseEvent } from "@earendil-works/pi-tui";
|
|
10
|
-
import installGentleShell, { backgroundChangeRefreshesSettled, buildShellBarModel, createActiveProfileReader, changesShortcut, devBinaryCard, extractQueuedText, fetchCodexUsage, fetchNanUsage, loadFileDiff, shellGitRunner, openInExternalEditor, usageShortcut, GentlePromptEditor } from "../extensions/gentle-shell.ts";
|
|
10
|
+
import installGentleShell, { backgroundChangeRefreshesSettled, buildShellBarModel, createFooterStatusMemo, createActiveProfileReader, changesShortcut, devBinaryCard, extractQueuedText, fetchCodexUsage, fetchNanUsage, loadFileDiff, shellGitRunner, openInExternalEditor, usageShortcut, GentlePromptEditor } from "../extensions/gentle-shell.ts";
|
|
11
11
|
import { CODEX_USAGE_URL, NAN_QUOTA_URL, USAGE_SOURCE_EVENT, USAGE_SOURCE_SCHEMA } from "../lib/shell-usage.ts";
|
|
12
12
|
import { bindSessionProfile, clearSessionProfileBinding, resetSessionProfileBindingsForTesting } from "../lib/session-profile-binding.ts";
|
|
13
13
|
import { createVimEditorAdapter, isAuditedPiEditorVersion } from "../lib/vim-editor-adapter.ts";
|
|
@@ -21,7 +21,7 @@ import { CHANGE_STATUS, DIFF_MAX_BYTES, DIFF_MAX_LINES, DIFF_TOO_LARGE } from ".
|
|
|
21
21
|
import { sidebarPart, sidebarState, type SidebarRail } from "../lib/shell-sidebar.ts";
|
|
22
22
|
import { installSidebar } from "../lib/shell-sidebar-layout.ts";
|
|
23
23
|
import { renderTodoCard } from "../lib/shell-todo.ts";
|
|
24
|
-
import type
|
|
24
|
+
import { renderShellBar, type ShellBarTheme } from "../lib/shell-bar.ts";
|
|
25
25
|
import { createGentleAiExtension } from "../extensions/gentle-ai.ts";
|
|
26
26
|
import { decodeReviewStatusV3 } from "../lib/review-integration-v2.ts";
|
|
27
27
|
import { REVIEW_SIDEBAR_EVENT } from "../lib/review-sidebar-state.ts";
|
|
@@ -301,61 +301,62 @@ test("buildShellBarModel shortens the home directory and hides effort for non-re
|
|
|
301
301
|
assert.equal(built.branch, null);
|
|
302
302
|
});
|
|
303
303
|
|
|
304
|
-
test("
|
|
304
|
+
test("NaN and non-NaN shell bars show selected effort and refresh the memo on changes", () => {
|
|
305
305
|
const { pi } = fakePi();
|
|
306
306
|
const { ctx } = fakeContext();
|
|
307
307
|
const model = ctx.model as unknown as { id: string; provider: string };
|
|
308
|
-
|
|
309
|
-
|
|
308
|
+
let effort: "medium" | "xhigh" | "off" = "medium";
|
|
309
|
+
pi.getThinkingLevel = () => effort;
|
|
310
310
|
const footerData = {
|
|
311
311
|
getGitBranch: () => null,
|
|
312
312
|
getExtensionStatuses: () => new Map(),
|
|
313
313
|
getAvailableProviderCount: () => 1,
|
|
314
314
|
onBranchChange: () => () => {},
|
|
315
315
|
};
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
316
|
+
const memo = createFooterStatusMemo({
|
|
317
|
+
pi, ctx, footerData, usage: () => undefined, profile: () => undefined,
|
|
318
|
+
jobs: () => undefined, review: () => undefined,
|
|
319
|
+
tracker: () => ({ model: { files: [], added: 0, deleted: 0, digest: "empty" } as never, unbornRoots: [] }),
|
|
320
|
+
visualSettings: () => undefined, cardStyle: () => undefined,
|
|
321
|
+
});
|
|
322
|
+
for (const [provider, id] of [
|
|
323
|
+
["nan", "deepseek-v4-flash"], ["nan", "qwen3.8-flash"], ["nan", "mimo-v2.6-flash"],
|
|
324
|
+
["nan", "glm5.3"], ["openai", "deepseek-v4-flash"],
|
|
325
|
+
]) {
|
|
326
|
+
model.provider = provider;
|
|
327
|
+
model.id = id;
|
|
328
|
+
effort = "medium";
|
|
329
|
+
assert.equal(memo.model().effort, "medium");
|
|
330
|
+
assert.ok(renderShellBar(memo.model(), plainTheme, 120).join("\n").includes(`${id} · medium`));
|
|
331
|
+
const before = memo.key();
|
|
332
|
+
effort = "xhigh";
|
|
333
|
+
assert.notEqual(memo.key(), before, `${provider}/${id} must invalidate on effort change`);
|
|
334
|
+
assert.equal(memo.model().effort, "xhigh");
|
|
335
|
+
assert.ok(renderShellBar(memo.model(), plainTheme, 120).join("\n").includes(`${id} · xhigh`));
|
|
336
|
+
effort = "off";
|
|
337
|
+
assert.equal(memo.model().effort, "off");
|
|
338
|
+
}
|
|
320
339
|
});
|
|
321
340
|
|
|
322
|
-
test("
|
|
341
|
+
test("NaN startup, model selection and effort changes never announce an automatic depth", async () => {
|
|
323
342
|
const { pi, handlers } = fakePi();
|
|
324
|
-
gentleShell(pi, {});
|
|
343
|
+
gentleShell(pi, { GENTLE_PI_SHELL_CHANGES_WATCH_MS: "off" }, { fetch: async () => { assert.fail("unexpected network"); } });
|
|
325
344
|
const { ctx, ui } = fakeContext();
|
|
326
|
-
const adaptive = { id: "qwen3.8-flash", provider: "nan", name: "Qwen 3.8 Flash", reasoning: true };
|
|
327
|
-
const budget = { id: "glm5.3", provider: "nan", name: "GLM 5.3", reasoning: true };
|
|
328
|
-
(ctx as unknown as { model: unknown }).model = adaptive;
|
|
329
345
|
const emit = async (event: string, payload: unknown) => {
|
|
330
346
|
for (const handler of handlers.get(event) ?? []) await handler(payload, ctx);
|
|
331
347
|
};
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
}
|
|
344
|
-
|
|
345
|
-
test("a session that starts on a self-managing NaN model announces it once", async () => {
|
|
346
|
-
const { pi, handlers } = fakePi();
|
|
347
|
-
gentleShell(pi, {});
|
|
348
|
-
const { ctx, ui } = fakeContext();
|
|
349
|
-
const adaptive = { id: "mimo-v2.6-flash", provider: "nan", name: "MiMo V2.6 Flash", reasoning: true };
|
|
350
|
-
(ctx as unknown as { model: unknown }).model = adaptive;
|
|
351
|
-
for (const handler of handlers.get("session_start") ?? []) await handler({}, ctx);
|
|
352
|
-
assert.deepEqual(ui.notices.filter((notice) => notice.includes("automatically")), [
|
|
353
|
-
"MiMo V2.6 Flash chooses its reasoning depth automatically; the selected thinking level is accepted but does not change it.",
|
|
354
|
-
]);
|
|
355
|
-
// A session that starts on a model which honors the level stays silent.
|
|
356
|
-
(ctx as unknown as { model: unknown }).model = { id: "gemma4", provider: "nan", name: "Gemma 4", reasoning: true };
|
|
357
|
-
for (const handler of handlers.get("session_start") ?? []) await handler({}, ctx);
|
|
358
|
-
assert.equal(ui.notices.filter((notice) => notice.includes("automatically")).length, 1);
|
|
348
|
+
try {
|
|
349
|
+
for (const id of ["deepseek-v4-flash", "qwen3.8-flash", "mimo-v2.6-flash"]) {
|
|
350
|
+
const model = { id, provider: "nan", name: id, reasoning: true };
|
|
351
|
+
(ctx as unknown as { model: unknown }).model = model;
|
|
352
|
+
await emit("session_start", {});
|
|
353
|
+
await emit("model_select", { type: "model_select", model, source: "set" });
|
|
354
|
+
await emit("thinking_level_select", { type: "thinking_level_select", level: "high", previousLevel: "medium" });
|
|
355
|
+
}
|
|
356
|
+
assert.deepEqual(ui.notices.filter((notice) => /automatically|does not change/i.test(notice)), []);
|
|
357
|
+
} finally {
|
|
358
|
+
await emit("session_shutdown", {});
|
|
359
|
+
}
|
|
359
360
|
});
|
|
360
361
|
|
|
361
362
|
test("gentleShell installs the footer on session_start when a UI exists", () => {
|
|
@@ -971,6 +972,30 @@ const fakeTui = { terminal: { rows: 40, columns: 120 }, requestRender() {} };
|
|
|
971
972
|
const editorTheme = { borderColor: (text: string) => text, selectList: {} };
|
|
972
973
|
const fakeKeybindings = { matches: () => false };
|
|
973
974
|
|
|
975
|
+
// Time-based cadence (fixes the render-count drift that froze or strobed the
|
|
976
|
+
// working wave): repaints inside one pulse window must paint one identical
|
|
977
|
+
// frame, and elapsed windows must advance the wave without any streaming
|
|
978
|
+
// frame arriving.
|
|
979
|
+
test("the working wave keeps time-based cadence across silent repaints", () => {
|
|
980
|
+
const roleFg = (role: string, text: string) => `<${role}>${text}</${role}>`;
|
|
981
|
+
let now = 0;
|
|
982
|
+
const editor = new GentlePromptEditor(fakeTui as never, editorTheme as never, fakeKeybindings as never, {
|
|
983
|
+
fg: roleFg, bold: (text: string) => text, requestRender() {}, pending: () => false, now: () => now,
|
|
984
|
+
doubleEscCancelEnabled: () => false, dispatchQueuedText() {}, tuiVersion: () => INSTALLED_PI,
|
|
985
|
+
});
|
|
986
|
+
try {
|
|
987
|
+
editor.setWorking(true);
|
|
988
|
+
now = 400;
|
|
989
|
+
const first = editor.render(80).join("\n");
|
|
990
|
+
const second = editor.render(80).join("\n");
|
|
991
|
+
assert.equal(second, first, "repaints within one pulse window paint one identical frame");
|
|
992
|
+
now = 480;
|
|
993
|
+
assert.notEqual(editor.render(80).join("\n"), first, "the next window advances the wave");
|
|
994
|
+
} finally {
|
|
995
|
+
editor.dispose();
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
|
|
974
999
|
test("panel control owns its rendered mouse cells across top rows and Vim modes", () => {
|
|
975
1000
|
for (const vim of [false, true]) {
|
|
976
1001
|
const tui = fakeTui;
|
|
@@ -3176,7 +3201,7 @@ test("vim selector exposes enable, disable and status; status and cancellation d
|
|
|
3176
3201
|
} finally { editor.dispose(); }
|
|
3177
3202
|
});
|
|
3178
3203
|
|
|
3179
|
-
test("animations command reports without writing and switches the live
|
|
3204
|
+
test("animations command reports without writing and switches the live animation timer", async (t) => {
|
|
3180
3205
|
const configHome = scopedDoubleEscCancelConfigHome(t);
|
|
3181
3206
|
const delays: number[] = [];
|
|
3182
3207
|
let active = 0;
|
|
@@ -3194,9 +3219,9 @@ test("animations command reports without writing and switches the live watchdog"
|
|
|
3194
3219
|
assert.match(ui.notices.at(-1)!, /animations: quality/);
|
|
3195
3220
|
assert.equal(existsSync(join(configHome, "animations.json")), false);
|
|
3196
3221
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3197
|
-
assert.deepEqual(delays, [2000,
|
|
3222
|
+
assert.deepEqual(delays, [2000, 80]);
|
|
3198
3223
|
await command.handler("performance", ctx);
|
|
3199
|
-
assert.deepEqual(delays, [2000,
|
|
3224
|
+
assert.deepEqual(delays, [2000, 80, 1000]);
|
|
3200
3225
|
assert.equal(active, 2);
|
|
3201
3226
|
await command.handler("potato", ctx);
|
|
3202
3227
|
assert.equal(active, 1);
|
|
@@ -3205,7 +3230,7 @@ test("animations command reports without writing and switches the live watchdog"
|
|
|
3205
3230
|
await command.handler("invalid", ctx);
|
|
3206
3231
|
assert.equal(JSON.parse(readFileSync(join(configHome, "animations.json"), "utf8")).policy, "potato");
|
|
3207
3232
|
await command.handler("quality", ctx);
|
|
3208
|
-
assert.deepEqual(delays, [2000,
|
|
3233
|
+
assert.deepEqual(delays, [2000, 80, 1000, 80]);
|
|
3209
3234
|
for (const handler of handlers.get("agent_settled") ?? []) handler({}, ctx);
|
|
3210
3235
|
assert.equal(active, 1);
|
|
3211
3236
|
editor.dispose();
|
|
@@ -3294,7 +3319,7 @@ test("animations with no argument opens a selectable menu and applies the chosen
|
|
|
3294
3319
|
assert.equal(existsSync(join(dismissHome, "animations.json")), false);
|
|
3295
3320
|
});
|
|
3296
3321
|
|
|
3297
|
-
test("prompt installs the
|
|
3322
|
+
test("prompt installs the working pulse timer unref'd and releases it at settlement", async (t) => {
|
|
3298
3323
|
const configHome = scopedDoubleEscCancelConfigHome(t);
|
|
3299
3324
|
writeFileSync(join(configHome, "animations.json"), '{"schema":"gentle-pi.animations/v1","policy":"quality"}');
|
|
3300
3325
|
const delays: number[] = [];
|
|
@@ -3312,7 +3337,7 @@ test("prompt installs the silence watchdog unref'd and releases it at settlement
|
|
|
3312
3337
|
const editor = installedPrompt(ctx, ui, handlers);
|
|
3313
3338
|
assert.equal(active, 1);
|
|
3314
3339
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3315
|
-
assert.deepEqual(delays, [2000,
|
|
3340
|
+
assert.deepEqual(delays, [2000, 80]);
|
|
3316
3341
|
assert.equal(unrefs, 2);
|
|
3317
3342
|
for (const handler of handlers.get("agent_settled") ?? []) handler({}, ctx);
|
|
3318
3343
|
assert.equal(active, 1);
|
|
@@ -3321,9 +3346,11 @@ test("prompt installs the silence watchdog unref'd and releases it at settlement
|
|
|
3321
3346
|
assert.equal(active, 0);
|
|
3322
3347
|
});
|
|
3323
3348
|
|
|
3324
|
-
//
|
|
3325
|
-
//
|
|
3326
|
-
//
|
|
3349
|
+
// Time-based working animation: the phase derives from elapsed working time
|
|
3350
|
+
// (workingTick), not render count — a burst of repaints inside one pulse
|
|
3351
|
+
// window paints one identical frame (#2643), and silent phases advance
|
|
3352
|
+
// through the policy's pulse timer (quality 80ms, performance 1000ms;
|
|
3353
|
+
// potato installs no timer and never animates).
|
|
3327
3354
|
interface RecordedInterval { tick: () => void; delay: number; stopped: boolean }
|
|
3328
3355
|
|
|
3329
3356
|
function recordIntervals(t: TestContext): RecordedInterval[] {
|
|
@@ -3341,7 +3368,7 @@ function petalGlyphOf(editor: GentlePromptEditor): string {
|
|
|
3341
3368
|
return stripAnsi(editor.render(60)[0]).match(/[✿❀❁✾]/)?.[0] ?? "";
|
|
3342
3369
|
}
|
|
3343
3370
|
|
|
3344
|
-
test("streaming
|
|
3371
|
+
test("streaming render bursts paint one identical working frame while the quality pulse keeps flowing", (t) => {
|
|
3345
3372
|
const configHome = scopedDoubleEscCancelConfigHome(t);
|
|
3346
3373
|
writeFileSync(join(configHome, "animations.json"), '{"schema":"gentle-pi.animations/v1","policy":"quality"}');
|
|
3347
3374
|
const intervals = recordIntervals(t);
|
|
@@ -3351,18 +3378,18 @@ test("streaming frames advance the working petal and the quality watchdog stays
|
|
|
3351
3378
|
const { ctx, ui } = fakeContext();
|
|
3352
3379
|
const editor = installedPrompt(ctx, ui, handlers);
|
|
3353
3380
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3354
|
-
const
|
|
3355
|
-
assert.ok(
|
|
3381
|
+
const pulse = intervals.find((entry) => entry.delay === 80);
|
|
3382
|
+
assert.ok(pulse, "working installs the 80ms quality pulse timer");
|
|
3356
3383
|
const glyphs = [0, 1, 2, 3].map(() => petalGlyphOf(editor));
|
|
3357
|
-
assert.
|
|
3384
|
+
assert.equal(new Set(glyphs).size, 1, `a render burst inside one window must paint one identical frame, got ${glyphs.join("")}`);
|
|
3358
3385
|
const before = renders.mock.callCount();
|
|
3359
|
-
|
|
3360
|
-
assert.equal(renders.mock.callCount(), before, "
|
|
3386
|
+
pulse!.tick();
|
|
3387
|
+
assert.equal(renders.mock.callCount(), before + 1, "the pulse drives repaints at its cadence regardless of render traffic");
|
|
3361
3388
|
editor.dispose();
|
|
3362
|
-
assert.equal(
|
|
3389
|
+
assert.equal(pulse!.stopped, true);
|
|
3363
3390
|
});
|
|
3364
3391
|
|
|
3365
|
-
test("silent working phases repaint
|
|
3392
|
+
test("silent working phases repaint through the 80ms pulse window", (t) => {
|
|
3366
3393
|
const configHome = scopedDoubleEscCancelConfigHome(t);
|
|
3367
3394
|
writeFileSync(join(configHome, "animations.json"), '{"schema":"gentle-pi.animations/v1","policy":"quality"}');
|
|
3368
3395
|
const intervals = recordIntervals(t);
|
|
@@ -3373,20 +3400,19 @@ test("silent working phases repaint only through the 1000ms watchdog window", (t
|
|
|
3373
3400
|
const { ctx, ui } = fakeContext();
|
|
3374
3401
|
const editor = installedPrompt(ctx, ui, handlers);
|
|
3375
3402
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3376
|
-
const
|
|
3377
|
-
assert.ok(
|
|
3403
|
+
const pulse = intervals.find((entry) => entry.delay === 80);
|
|
3404
|
+
assert.ok(pulse, "working installs the 80ms quality pulse timer");
|
|
3378
3405
|
const baseline = petalGlyphOf(editor);
|
|
3379
3406
|
const before = renders.mock.callCount();
|
|
3380
|
-
|
|
3381
|
-
assert.equal(renders.mock.callCount(), before, "
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
assert.
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
watchdog!.tick();
|
|
3388
|
-
assert.equal(renders.mock.callCount(), afterForced, "the watchdog's own repaint counts as render traffic for the next window");
|
|
3407
|
+
pulse!.tick();
|
|
3408
|
+
assert.equal(renders.mock.callCount(), before + 1, "the pulse forces repaints while working, even in silence");
|
|
3409
|
+
assert.equal(petalGlyphOf(editor), baseline, "inside one window the frame is stable");
|
|
3410
|
+
clock += 80;
|
|
3411
|
+
assert.notEqual(petalGlyphOf(editor), baseline, "each elapsed window advances the frame one step");
|
|
3412
|
+
const stepped = petalGlyphOf(editor);
|
|
3413
|
+
assert.equal(petalGlyphOf(editor), stepped, "the phase never drifts with render count");
|
|
3389
3414
|
editor.dispose();
|
|
3415
|
+
assert.equal(pulse!.stopped, true);
|
|
3390
3416
|
});
|
|
3391
3417
|
|
|
3392
3418
|
test("potato installs no working watchdog and the petal never advances", (t) => {
|
|
@@ -3404,7 +3430,7 @@ test("potato installs no working watchdog and the petal never advances", (t) =>
|
|
|
3404
3430
|
editor.dispose();
|
|
3405
3431
|
});
|
|
3406
3432
|
|
|
3407
|
-
test("the working
|
|
3433
|
+
test("the working animation timer is cleared on settlement and on dispose", (t) => {
|
|
3408
3434
|
const configHome = scopedDoubleEscCancelConfigHome(t);
|
|
3409
3435
|
writeFileSync(join(configHome, "animations.json"), '{"schema":"gentle-pi.animations/v1","policy":"quality"}');
|
|
3410
3436
|
const intervals = recordIntervals(t);
|
|
@@ -3413,15 +3439,15 @@ test("the working watchdog is cleared on settlement and on dispose", (t) => {
|
|
|
3413
3439
|
const { ctx, ui } = fakeContext();
|
|
3414
3440
|
const editor = installedPrompt(ctx, ui, handlers);
|
|
3415
3441
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3416
|
-
const
|
|
3417
|
-
assert.ok(
|
|
3442
|
+
const pulse = intervals.filter((entry) => entry.delay === 80).at(-1);
|
|
3443
|
+
assert.ok(pulse && !pulse.stopped, "working keeps the pulse timer armed");
|
|
3418
3444
|
for (const handler of handlers.get("agent_settled") ?? []) handler({}, ctx);
|
|
3419
|
-
assert.equal(
|
|
3445
|
+
assert.equal(pulse!.stopped, true, "settlement must clear the pulse timer");
|
|
3420
3446
|
for (const handler of handlers.get("agent_start") ?? []) handler({}, ctx);
|
|
3421
|
-
const
|
|
3422
|
-
assert.ok(
|
|
3447
|
+
const rearmPulse = intervals.filter((entry) => entry.delay === 80).at(-1);
|
|
3448
|
+
assert.ok(rearmPulse && rearmPulse !== pulse && !rearmPulse.stopped, "the next turn re-arms a fresh pulse timer");
|
|
3423
3449
|
editor.dispose();
|
|
3424
|
-
assert.equal(
|
|
3450
|
+
assert.equal(rearmPulse!.stopped, true, "dispose must clear the pulse timer");
|
|
3425
3451
|
});
|
|
3426
3452
|
|
|
3427
3453
|
// ---------------------------------------------------------------------------
|
|
@@ -5436,7 +5462,11 @@ test("registered canonical root governs real Git discovery, status and diff desp
|
|
|
5436
5462
|
// Pi exec has no env option and inherits routing. Model that boundary with
|
|
5437
5463
|
// a child-only env, without changing this test process's environment.
|
|
5438
5464
|
h.pi.exec = ((command: string, args: string[], options: { timeout?: number } = {}) => new Promise((resolve) => {
|
|
5439
|
-
execFile(command, args, { env: poisoned, encoding: "utf8", timeout: options.timeout, maxBuffer: Infinity }, (error, stdout, stderr) =>
|
|
5465
|
+
execFile(command, args, { env: poisoned, encoding: "utf8", timeout: options.timeout, maxBuffer: Infinity }, (error, stdout, stderr) => {
|
|
5466
|
+
// Pi 1.5's ExecResult adds `truncated`; an unbounded maxBuffer never truncates. A named object keeps Pi 1.4's narrower type from rejecting it.
|
|
5467
|
+
const result = { stdout, stderr, code: error ? typeof error.code === "number" ? error.code : 1 : 0, killed: Boolean(error?.killed), truncated: false };
|
|
5468
|
+
resolve(result);
|
|
5469
|
+
});
|
|
5440
5470
|
})) as ExtensionAPI["exec"];
|
|
5441
5471
|
const { ctx, ui, overlayReady } = fakeContext();
|
|
5442
5472
|
(ctx as unknown as { cwd: string }).cwd = selected;
|
|
@@ -5883,14 +5913,15 @@ test("gentleShell fetches NaN quota on session start and shows it in the bar", a
|
|
|
5883
5913
|
const { fetchFn, calls } = fakeFetch(NAN_QUOTA_PAYLOAD);
|
|
5884
5914
|
gentleShell(pi, { GENTLE_PI_SHELL_CHANGES_WATCH_MS: "off" }, { fetch: fetchFn, now: () => 1_788_600_000_000 });
|
|
5885
5915
|
const { ctx, ui } = fakeContext({ token: "sk-nan-secret" });
|
|
5886
|
-
(ctx as unknown as { model:
|
|
5916
|
+
Object.assign((ctx as unknown as { model: object }).model, { provider: "nan", id: "glm5.3" });
|
|
5887
5917
|
await fire(handlers, "session_start", ctx);
|
|
5888
5918
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
5889
5919
|
assert.equal(calls.length, 1);
|
|
5890
5920
|
assert.equal(calls[0].url, "https://cloud-api.nan.builders/api/usage/quota");
|
|
5891
|
-
// The
|
|
5892
|
-
//
|
|
5893
|
-
assert.match(renderFooter(ui), /\$0\.000 sub ⟡
|
|
5921
|
+
// The session model's own quota names the meter; NaN never shows an account
|
|
5922
|
+
// total, which would read as a credit balance it is not.
|
|
5923
|
+
assert.match(renderFooter(ui), /\$0\.000 sub ⟡ glm5\.3 ▰+▱+ 27%/);
|
|
5924
|
+
assert.doesNotMatch(renderFooter(ui), /nan total/);
|
|
5894
5925
|
|
|
5895
5926
|
await fire(handlers, "agent_end", ctx);
|
|
5896
5927
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
@@ -5909,17 +5940,17 @@ test("a failed NaN refresh keeps the last valid snapshot", async () => {
|
|
|
5909
5940
|
let now = 1_788_600_000_000;
|
|
5910
5941
|
gentleShell(pi, { GENTLE_PI_SHELL_CHANGES_WATCH_MS: "off" }, { fetch: fetchFn, now: () => now });
|
|
5911
5942
|
const { ctx, ui } = fakeContext({ token: "sk-nan-secret" });
|
|
5912
|
-
(ctx as unknown as { model:
|
|
5943
|
+
Object.assign((ctx as unknown as { model: object }).model, { provider: "nan", id: "glm5.3" });
|
|
5913
5944
|
await fire(handlers, "session_start", ctx);
|
|
5914
5945
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
5915
|
-
assert.match(renderFooter(ui), /
|
|
5946
|
+
assert.match(renderFooter(ui), /glm5\.3 ▰+▱+/);
|
|
5916
5947
|
|
|
5917
5948
|
fail = true;
|
|
5918
5949
|
now += 6 * 60_000;
|
|
5919
5950
|
await fire(handlers, "agent_end", ctx);
|
|
5920
5951
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
5921
5952
|
assert.equal(calls.length, 2, "the refresh window elapsed, so the retry was attempted");
|
|
5922
|
-
assert.match(renderFooter(ui), /
|
|
5953
|
+
assert.match(renderFooter(ui), /glm5\.3 ▰+▱+/, "a failed refresh cannot erase the last valid snapshot");
|
|
5923
5954
|
});
|
|
5924
5955
|
|
|
5925
5956
|
test("gentleShell fetches Codex usage on session start and shows it in the bar", async () => {
|
|
@@ -6114,10 +6145,10 @@ test("a registered source resolving usage for another provider is rejected witho
|
|
|
6114
6145
|
const { fetchFn } = fakeFetch(NAN_QUOTA_PAYLOAD);
|
|
6115
6146
|
gentleShell(pi, { GENTLE_PI_SHELL_CHANGES_WATCH_MS: "off" }, { fetch: fetchFn, now: () => 1_788_600_000_000 });
|
|
6116
6147
|
const { ctx, ui } = fakeContext({ token: "sk-nan-secret" });
|
|
6117
|
-
(ctx as unknown as { model:
|
|
6148
|
+
Object.assign((ctx as unknown as { model: object }).model, { provider: "nan", id: "glm5.3" });
|
|
6118
6149
|
await fire(handlers, "session_start", ctx);
|
|
6119
6150
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
6120
|
-
assert.match(renderFooter(ui), /
|
|
6151
|
+
assert.match(renderFooter(ui), /glm5\.3 ▰+▱+/, "the real nan snapshot recorded first");
|
|
6121
6152
|
|
|
6122
6153
|
(ctx as unknown as { model: { provider: string } }).model.provider = "acme-cloud";
|
|
6123
6154
|
pi.events.emit(USAGE_SOURCE_EVENT, {
|
|
@@ -6129,7 +6160,7 @@ test("a registered source resolving usage for another provider is rejected witho
|
|
|
6129
6160
|
assert.doesNotMatch(renderFooter(ui), /acme-cloud/, "a resolution naming another provider must not surface as the active one");
|
|
6130
6161
|
|
|
6131
6162
|
(ctx as unknown as { model: { provider: string } }).model.provider = "nan";
|
|
6132
|
-
assert.match(renderFooter(ui), /
|
|
6163
|
+
assert.match(renderFooter(ui), /glm5\.3 ▰+▱+/, "the real nan snapshot must survive a mismatched acme-cloud resolution untouched");
|
|
6133
6164
|
});
|
|
6134
6165
|
|
|
6135
6166
|
test("gentleShell leaves a generic failure note when a registered source resolves a malformed usage", async () => {
|
|
@@ -350,11 +350,11 @@ function toolTurn(toolName = "read") {
|
|
|
350
350
|
return { message: { role: "assistant", content: [{ type: "toolCall", id: "call", name: toolName, arguments: {} }] }, toolResults: [] };
|
|
351
351
|
}
|
|
352
352
|
|
|
353
|
-
type ContextMessage = { role: string; content: unknown; customType?: string; display?: boolean; timestamp?: number };
|
|
353
|
+
type ContextMessage = { role: string; content: unknown; customType?: string; display?: boolean; details?: unknown; timestamp?: number };
|
|
354
354
|
|
|
355
355
|
async function contextMessages(fire: ReturnType<typeof fakePi>["fire"], ctx: ExtensionContext): Promise<ContextMessage[] | undefined> {
|
|
356
356
|
const messages = [{ role: "user", content: "Keep working", timestamp: 1 }];
|
|
357
|
-
const result = await fire("
|
|
357
|
+
const result = await fire("context_with_system", ctx, { messages }) as { messages: ContextMessage[] } | undefined;
|
|
358
358
|
assert.deepEqual(messages, [{ role: "user", content: "Keep working", timestamp: 1 }], "request-local injection must not mutate the input transcript");
|
|
359
359
|
if (result === undefined) return undefined;
|
|
360
360
|
assert.deepEqual(result.messages[0], { role: "user", content: "Keep working", timestamp: 1 }, "the transcript stays first; todo messages trail it");
|
|
@@ -393,7 +393,8 @@ test("runtime reminder arrives after four tool-use turns, only once, without cha
|
|
|
393
393
|
assert.equal(messages.length, 3, "transcript, current list, then the reminder");
|
|
394
394
|
assert.equal(messages[1]!.customType, "gentle-todo-state");
|
|
395
395
|
const reminder = messages[2]!;
|
|
396
|
-
|
|
396
|
+
// P1b: the reminder records the message it followed, so its saved copy keeps this place in later requests.
|
|
397
|
+
assert.deepEqual(reminder, { role: "custom", customType: "gentle-todo-reminder", content: REMINDER, display: false, details: { after: `custom|gentle-todo-state|${messages[1]!.timestamp}`, at: reminder.timestamp }, timestamp: reminder.timestamp });
|
|
397
398
|
const converted = convertToLlm(messages as Parameters<typeof convertToLlm>[0]);
|
|
398
399
|
assert.deepEqual(converted[2], { role: "user", content: [{ type: "text", text: REMINDER }], timestamp: reminder.timestamp }, "Pi forwards the reminder as provider-compatible text");
|
|
399
400
|
await workTurns(fire, ctx, 4);
|
|
@@ -495,6 +496,26 @@ function promptEvent(): { systemPrompt: string; systemPromptOptions: { appendSys
|
|
|
495
496
|
return { systemPrompt: "base", systemPromptOptions: { appendSystemPrompt: "" } };
|
|
496
497
|
}
|
|
497
498
|
|
|
499
|
+
test("custom-triggered runs preserve todo freshness while retaining the prompt rules (#2336)", async () => {
|
|
500
|
+
const { pi, tools, fire } = fakePi();
|
|
501
|
+
gentleTodo(pi, {});
|
|
502
|
+
const { ctx, widget } = fakeContext();
|
|
503
|
+
await fire("session_start", ctx);
|
|
504
|
+
await tools.get("todo")!.execute("write", { action: "write", tasks: [{ title: "Verify the fix" }] }, undefined, undefined, ctx);
|
|
505
|
+
await fire("tool_execution_end", ctx, { toolName: "todo" });
|
|
506
|
+
const original = widget();
|
|
507
|
+
for (let index = 0; index < 3; index++) {
|
|
508
|
+
const event = { ...promptEvent(), messageType: "custom", message: { role: "custom", customType: "worker-complete", content: "Finished", display: false, timestamp: index } };
|
|
509
|
+
await fire("before_agent_start", ctx, event);
|
|
510
|
+
assert.deepEqual(widget(), original, "a background wake must not age the todo card");
|
|
511
|
+
assert.match(event.systemPromptOptions.appendSystemPrompt, /^## Todo list/, "custom runs still receive todo rules");
|
|
512
|
+
}
|
|
513
|
+
await fire("before_agent_start", ctx, { ...promptEvent(), messageType: "user", prompt: "Continue" });
|
|
514
|
+
assert.doesNotMatch(widget()!.join("\n"), /stale/);
|
|
515
|
+
await fire("before_agent_start", ctx, { ...promptEvent(), messageType: "user", prompt: "Continue" });
|
|
516
|
+
assert.match(widget()!.join("\n"), /stale · 2 turns/, "user turns still age the card");
|
|
517
|
+
});
|
|
518
|
+
|
|
498
519
|
test("the system prompt carries only a byte-stable todo block; the current list travels as a request-local message (#1662)", async () => {
|
|
499
520
|
const { pi, tools, fire } = fakePi();
|
|
500
521
|
gentleTodo(pi, {});
|
|
@@ -566,9 +587,10 @@ function liveSession() {
|
|
|
566
587
|
const queued: ContextMessage[] = [];
|
|
567
588
|
const pi = {
|
|
568
589
|
...base.pi,
|
|
569
|
-
sendMessage(message: { customType: string; content: string; display: boolean }, options: { triggerTurn?: boolean }) {
|
|
590
|
+
sendMessage(message: { customType: string; content: string; display: boolean; details?: unknown }, options: { triggerTurn?: boolean }) {
|
|
570
591
|
assert.equal(options.triggerTurn, false, "todo state must never start a turn");
|
|
571
|
-
|
|
592
|
+
// Pi keeps `details` and stamps the saved copy itself (agent-session sendCustomMessage).
|
|
593
|
+
queued.push({ role: "custom", customType: message.customType, content: message.content, display: message.display, ...(message.details === undefined ? {} : { details: message.details }), timestamp: 0 });
|
|
572
594
|
},
|
|
573
595
|
} as unknown as ExtensionAPI;
|
|
574
596
|
gentleTodo(pi, {});
|
|
@@ -577,7 +599,7 @@ function liveSession() {
|
|
|
577
599
|
const requests: ContextMessage[][] = [];
|
|
578
600
|
let call = 0;
|
|
579
601
|
const request = async () => {
|
|
580
|
-
const result = await base.fire("
|
|
602
|
+
const result = await base.fire("context_with_system", ctx, { messages: [...transcript] }) as { messages: ContextMessage[] } | undefined;
|
|
581
603
|
const messages = result?.messages ?? [...transcript];
|
|
582
604
|
requests.push(messages);
|
|
583
605
|
return messages;
|
|
@@ -644,7 +666,8 @@ test("an open list missing from the transcript (compaction, branch switch) is pe
|
|
|
644
666
|
await live.request();
|
|
645
667
|
for (const messages of live.requests.slice(healedFrom)) assert.match(String(live.visibleState(messages)), /\[pending\] Fix the bug/);
|
|
646
668
|
assert.equal(live.transcript.filter((message) => message.customType === "gentle-todo-state").length, 1, "the missing state is persisted exactly once");
|
|
647
|
-
|
|
669
|
+
// P1b: the request that re-sends the snapshot is extended too (it used to be skipped: its copy was saved later).
|
|
670
|
+
live.assertAppendOnly(healedFrom);
|
|
648
671
|
});
|
|
649
672
|
|
|
650
673
|
test("consecutive context requests with an unchanged Todo list preserve prefix stability (#2195)", async () => {
|
|
@@ -656,7 +679,7 @@ test("consecutive context requests with an unchanged Todo list preserve prefix s
|
|
|
656
679
|
|
|
657
680
|
// Request 1: first model request
|
|
658
681
|
const userMsg = { role: "user", content: "Work on it", timestamp: 100 };
|
|
659
|
-
const req1 = await fire("
|
|
682
|
+
const req1 = await fire("context_with_system", ctx, { messages: [userMsg] }) as { messages: Array<{ role: string; customType?: string }> };
|
|
660
683
|
assert.ok(req1, "req1 must return context messages");
|
|
661
684
|
assert.ok(req1.messages.some((m) => (m as { customType?: string }).customType === "gentle-todo-state"), "req1 must include gentle-todo-state");
|
|
662
685
|
|
|
@@ -667,7 +690,7 @@ test("consecutive context requests with an unchanged Todo list preserve prefix s
|
|
|
667
690
|
// Request 2: next model request with unchanged todo list.
|
|
668
691
|
// The input messages to context include the transcript with the already-delivered state message
|
|
669
692
|
const inputReq2 = [...req1.messages, assistantMsg, toolResultMsg];
|
|
670
|
-
const req2 = await fire("
|
|
693
|
+
const req2 = await fire("context_with_system", ctx, { messages: inputReq2 }) as { messages: Array<{ role: string; customType?: string }> } | undefined;
|
|
671
694
|
|
|
672
695
|
// req2 must not append a redundant trailing gentle-todo-state that would invalidate prefix caching
|
|
673
696
|
const effectiveReq2 = req2?.messages ?? inputReq2;
|