gentle-pi 4.8.0 → 4.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -0
- package/assets/agents/gentle-ai-explore.md +1 -1
- package/assets/agents/gentle-ai-verify.md +1 -1
- package/assets/agents/gentle-ai-worker.md +10 -9
- package/assets/design-canvas/canvas-boards.js +22 -2
- package/assets/design-canvas/canvas-boot.js +3 -1
- package/assets/design-canvas/canvas-i18n-es.js +5 -0
- package/assets/design-canvas/canvas-menu.js +13 -7
- package/assets/design-canvas/canvas-messages.js +1 -1
- package/assets/design-canvas/canvas-rail.js +5 -2
- package/assets/design-canvas/canvas-store.js +3 -0
- package/assets/design-canvas/canvas-theme.js +69 -0
- package/assets/design-canvas/canvas.css +27 -2
- package/assets/design-canvas/index.html +3 -0
- package/assets/design-canvas/inspector.js +28 -5
- package/assets/design-canvas/theme-early.js +10 -0
- package/assets/migrations/agent-body-history.json +6 -0
- package/assets/orchestrator-delegation.md +1 -5
- package/assets/orchestrator-full-delegation-card.md +9 -13
- package/assets/orchestrator-full-delegation.md +2 -2
- package/assets/orchestrator-memory.md +2 -2
- package/assets/orchestrator-prompts.md +3 -31
- package/assets/orchestrator-tracking.md +6 -6
- package/assets/orchestrator-verification.md +4 -4
- package/assets/orchestrator-writer.md +12 -12
- package/assets/orchestrator.md +2 -2
- package/bin/gentle-shell.mjs +77 -1
- package/contracts/review-provider-contract-mirror/provider-contract.lock.json +7 -7
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/manifest.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/orchestration/pi.md +1 -1
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/routing/pi.md +10 -10
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-capabilities.baseline.json +3 -3
- package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/generated/provider-roles.baseline.json +1 -1
- package/docs/assets/features/gentle-tower.png +0 -0
- package/docs/auto-permission-answers.md +1 -1
- package/docs/bundled-install.md +1 -1
- package/docs/delegated-verification.md +6 -4
- package/docs/desktop-feed.md +303 -0
- package/docs/desktop-rpc.md +703 -25
- package/docs/fast-mode.md +2 -2
- package/docs/gentle-shell-desktop.md +465 -0
- package/docs/gentle-shell.md +65 -3
- package/docs/images/desktop/chat.png +0 -0
- package/docs/images/desktop/palette.png +0 -0
- package/docs/images/desktop/todo.png +0 -0
- package/docs/install-wizard.md +1 -1
- package/docs/odd-preparation-continuity.md +1 -1
- package/docs/readme-reference.md +44 -15
- package/docs/work-continuity.md +10 -7
- package/extensions/ask-user-choice.ts +36 -18
- package/extensions/ask-user-question.ts +47 -8
- package/extensions/gentle-agents.ts +206 -37
- package/extensions/gentle-ai.ts +234 -24
- package/extensions/gentle-desktop-feed.ts +778 -0
- package/extensions/gentle-desktop-rpc.ts +145 -12
- package/extensions/gentle-herdr-desktop-status.ts +275 -0
- package/extensions/gentle-shell.ts +69 -7
- package/extensions/gentle-stats.ts +30 -1
- package/extensions/gentle-tower.ts +305 -0
- package/extensions/skill-registry.ts +13 -3
- package/herdr/RECIPE.md +157 -0
- package/herdr/keys.json +14 -0
- package/herdr/layouts/gentle-shell.json +202 -0
- package/herdr/mods/gentle-agents/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-agents/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-agents/main.js +190 -0
- package/herdr/mods/gentle-agents/mod.json +1 -0
- package/herdr/mods/gentle-agents/snapshot.js +469 -0
- package/herdr/mods/gentle-agents/tokens.js +273 -0
- package/herdr/mods/gentle-chat/MINIMAL.md +69 -0
- package/herdr/mods/gentle-chat/actions.js +180 -0
- package/herdr/mods/gentle-chat/feed.js +321 -0
- package/herdr/mods/gentle-chat/icons/branch.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chat.svg +1 -0
- package/herdr/mods/gentle-chat/icons/check.svg +1 -0
- package/herdr/mods/gentle-chat/icons/chev.svg +1 -0
- package/herdr/mods/gentle-chat/icons/clip.svg +1 -0
- package/herdr/mods/gentle-chat/icons/down.svg +1 -0
- package/herdr/mods/gentle-chat/icons/folder.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-chat/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-chat/icons/mark.svg +1 -0
- package/herdr/mods/gentle-chat/icons/send.svg +1 -0
- package/herdr/mods/gentle-chat/icons/shield.svg +1 -0
- package/herdr/mods/gentle-chat/icons/stop.svg +1 -0
- package/herdr/mods/gentle-chat/icons/term.svg +1 -0
- package/herdr/mods/gentle-chat/icons/user.svg +1 -0
- package/herdr/mods/gentle-chat/icons/x.svg +1 -0
- package/herdr/mods/gentle-chat/main.js +968 -0
- package/herdr/mods/gentle-chat/mod.json +1 -0
- package/herdr/mods/gentle-chat/session.js +212 -0
- package/herdr/mods/gentle-chat/snapshot.js +469 -0
- package/herdr/mods/gentle-chat/tokens.js +137 -0
- package/herdr/mods/gentle-chat/ui.js +883 -0
- package/herdr/mods/gentle-confirm/main.js +60 -0
- package/herdr/mods/gentle-confirm/mod.json +1 -0
- package/herdr/mods/gentle-inspector/actions.js +180 -0
- package/herdr/mods/gentle-inspector/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/bot.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/check.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/db.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/diff.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/plug.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/review.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stats.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/stop.svg +1 -0
- package/herdr/mods/gentle-inspector/icons/todo.svg +1 -0
- package/herdr/mods/gentle-inspector/main.js +500 -0
- package/herdr/mods/gentle-inspector/mod.json +1 -0
- package/herdr/mods/gentle-inspector/snapshot.js +469 -0
- package/herdr/mods/gentle-inspector/tokens.js +273 -0
- package/herdr/mods/gentle-palette/actions.js +180 -0
- package/herdr/mods/gentle-palette/icons/bolt.svg +1 -0
- package/herdr/mods/gentle-palette/icons/bot.svg +1 -0
- package/herdr/mods/gentle-palette/icons/chat.svg +1 -0
- package/herdr/mods/gentle-palette/icons/check.svg +1 -0
- package/herdr/mods/gentle-palette/icons/cmd.svg +1 -0
- package/herdr/mods/gentle-palette/icons/diff.svg +1 -0
- package/herdr/mods/gentle-palette/icons/jobs.svg +1 -0
- package/herdr/mods/gentle-palette/icons/plus.svg +1 -0
- package/herdr/mods/gentle-palette/icons/review.svg +1 -0
- package/herdr/mods/gentle-palette/icons/search.svg +1 -0
- package/herdr/mods/gentle-palette/icons/shield.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stats.svg +1 -0
- package/herdr/mods/gentle-palette/icons/stop.svg +1 -0
- package/herdr/mods/gentle-palette/icons/term.svg +1 -0
- package/herdr/mods/gentle-palette/icons/todo.svg +1 -0
- package/herdr/mods/gentle-palette/main.js +333 -0
- package/herdr/mods/gentle-palette/mod.json +1 -0
- package/herdr/mods/gentle-palette/snapshot.js +469 -0
- package/herdr/mods/gentle-palette/tokens.js +273 -0
- package/herdr/mods/gentle-pane/icons/chat.svg +1 -0
- package/herdr/mods/gentle-pane/icons/close.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-pane/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-down.svg +1 -0
- package/herdr/mods/gentle-pane/icons/split-right.svg +1 -0
- package/herdr/mods/gentle-pane/icons/term.svg +1 -0
- package/herdr/mods/gentle-pane/icons/unzoom.svg +1 -0
- package/herdr/mods/gentle-pane/icons/zoom.svg +1 -0
- package/herdr/mods/gentle-pane/main.js +91 -0
- package/herdr/mods/gentle-pane/mod.json +1 -0
- package/herdr/mods/gentle-pane/snapshot.js +469 -0
- package/herdr/mods/gentle-pane/tokens.js +273 -0
- package/herdr/mods/gentle-sidebar/actions.js +180 -0
- package/herdr/mods/gentle-sidebar/icons/gear.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/mark.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/refresh.svg +1 -0
- package/herdr/mods/gentle-sidebar/icons/server-plus.svg +1 -0
- package/herdr/mods/gentle-sidebar/main.js +171 -0
- package/herdr/mods/gentle-sidebar/mod.json +1 -0
- package/herdr/mods/gentle-sidebar/snapshot.js +469 -0
- package/herdr/mods/gentle-sidebar/tokens.js +273 -0
- package/herdr/mods/gentle-spaces/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/monitor.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/plus.svg +1 -0
- package/herdr/mods/gentle-spaces/icons/server.svg +1 -0
- package/herdr/mods/gentle-spaces/machines.js +31 -0
- package/herdr/mods/gentle-spaces/main.js +299 -0
- package/herdr/mods/gentle-spaces/mod.json +1 -0
- package/herdr/mods/gentle-spaces/snapshot.js +469 -0
- package/herdr/mods/gentle-spaces/tokens.js +273 -0
- package/herdr/mods/gentle-status/actions.js +180 -0
- package/herdr/mods/gentle-status/main.js +192 -0
- package/herdr/mods/gentle-status/mod.json +1 -0
- package/herdr/mods/gentle-status/snapshot.js +469 -0
- package/herdr/mods/gentle-status/tokens.js +273 -0
- package/herdr/mods/gentle-tabs/icons/close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-herdr.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-remote.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/kind-tui.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/plus.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-close.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-max.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-min.svg +1 -0
- package/herdr/mods/gentle-tabs/icons/win-restore.svg +1 -0
- package/herdr/mods/gentle-tabs/main.js +171 -0
- package/herdr/mods/gentle-tabs/mod.json +1 -0
- package/herdr/mods/gentle-tabs/snapshot.js +469 -0
- package/herdr/mods/gentle-tabs/tokens.js +273 -0
- package/herdr/mods/gentle-tokens/main.js +20 -0
- package/herdr/mods/gentle-tokens/mod.json +1 -0
- package/herdr/mods/gentle-tokens/snapshot.js +469 -0
- package/herdr/mods/gentle-tokens/tokens.js +273 -0
- package/herdr/preview.png +0 -0
- package/herdr/themes/gentle-shell-dark.json +33 -0
- package/herdr/themes/gentle-shell-light.json +34 -0
- package/lib/agents-protocol.ts +2 -0
- package/lib/agents-rpc-publisher.ts +39 -12
- package/lib/agents-runner.ts +1 -0
- package/lib/auto-permission-answers.ts +2 -1
- package/lib/background-jobs.ts +22 -2
- package/lib/bounded-writer-admission.ts +1 -1
- package/lib/change-diff.ts +104 -0
- package/lib/commit-slice-signal.ts +1 -1
- package/lib/design-canvas-assets.ts +2 -0
- package/lib/desktop-agents-service.ts +31 -10
- package/lib/desktop-changes-service.ts +171 -0
- package/lib/desktop-feed-actions.ts +804 -0
- package/lib/desktop-feed-answers.ts +129 -0
- package/lib/desktop-feed-sources.ts +184 -0
- package/lib/desktop-feed-stats.ts +98 -0
- package/lib/desktop-feed-store.ts +124 -0
- package/lib/desktop-feed.ts +788 -0
- package/lib/desktop-jobs-service.ts +34 -7
- package/lib/desktop-review-service.ts +187 -0
- package/lib/desktop-rpc-agents.ts +112 -3
- package/lib/desktop-rpc-changes.ts +223 -0
- package/lib/desktop-rpc-config-watch.ts +285 -0
- package/lib/desktop-rpc-config.ts +162 -8
- package/lib/desktop-rpc-jobs.ts +118 -9
- package/lib/desktop-rpc-permissions.ts +154 -3
- package/lib/desktop-rpc-review.ts +180 -0
- package/lib/desktop-rpc-session.ts +203 -0
- package/lib/desktop-rpc-sessions.ts +250 -0
- package/lib/desktop-rpc-stats.ts +187 -0
- package/lib/desktop-rpc-updates.ts +143 -0
- package/lib/desktop-rpc.ts +116 -5
- package/lib/desktop-session-service.ts +223 -0
- package/lib/desktop-sessions-service.ts +249 -0
- package/lib/desktop-stats-service.ts +142 -0
- package/lib/desktop-updates-service.ts +268 -0
- package/lib/gentle-shell-desktop.ts +1370 -0
- package/lib/gentle-shell-launcher.ts +45 -3
- package/lib/herdr-desktop-events.ts +40 -0
- package/lib/herdr-desktop-status.ts +229 -0
- package/lib/jobs-sidebar-state.ts +5 -0
- package/lib/native-review-cli.ts +7 -0
- package/lib/openai-fast-tier.ts +1 -0
- package/lib/session-profile-freeze.ts +13 -5
- package/lib/stats-collector.ts +56 -27
- package/lib/tower-actions.ts +100 -0
- package/lib/tower-hub.ts +73 -0
- package/lib/tower-launch.ts +111 -0
- package/lib/tower-open.ts +99 -0
- package/lib/tower-presence.ts +70 -0
- package/lib/tower-server.ts +234 -0
- package/lib/tower-snapshot.ts +298 -0
- package/lib/update-status.ts +238 -0
- package/lib/verifier-settle-reminder.ts +1 -1
- package/package.json +13 -4
- package/runtime/design-canvas-assets.mjs +2 -0
- package/runtime/gentle-shell-desktop.mjs +1371 -0
- package/runtime/gentle-shell-launcher.mjs +44 -2
- package/runtime/native-review-cli.mjs +7 -0
- package/runtime/tower-actions.mjs +101 -0
- package/runtime/tower-hub.mjs +74 -0
- package/runtime/tower-launch.mjs +112 -0
- package/runtime/tower-open.mjs +100 -0
- package/runtime/tower-presence.mjs +71 -0
- package/runtime/tower-server.mjs +234 -0
- package/runtime/tower-snapshot.mjs +299 -0
- package/scripts/build-full-delegation-card.mjs +1 -21
- package/scripts/build-runtime-modules.mjs +9 -0
- package/scripts/gentle-ai-installer.mjs +10 -10
- package/scripts/verify-package-files.mjs +35 -15
- package/skills/provider-defect-report/SKILL.md +61 -0
- package/skills/rdd-defect-workflow/SKILL.md +3 -3
- package/tests/agent-prompt-diet-contract.test.ts +2 -2
- package/tests/append-system-prompt-route.test.ts +16 -5
- package/tests/ask-user-choice.test.ts +78 -21
- package/tests/ask-user-question.test.ts +59 -5
- package/tests/auto-permission-answers.test.ts +12 -1
- package/tests/background-jobs.test.ts +12 -0
- package/tests/bounded-stop-contract.test.ts +139 -26
- package/tests/change-diff.test.ts +75 -0
- package/tests/commit-slice-signal.test.ts +3 -2
- package/tests/decision-routing-contract.test.ts +390 -0
- package/tests/delegated-key-learnings-contract.test.ts +21 -28
- package/tests/delivery-b-rendered-surfaces.test.ts +32 -0
- package/tests/design-canvas-i18n.test.ts +24 -22
- package/tests/design-canvas-inspector.test.ts +67 -0
- package/tests/design-canvas-modules.test.ts +3 -2
- package/tests/design-canvas-rail.test.ts +10 -10
- package/tests/design-canvas-store.test.ts +9 -0
- package/tests/design-canvas-theme.test.ts +198 -0
- package/tests/design-canvas-tokens.test.ts +1 -1
- package/tests/desktop-feed-actions-guards.test.ts +595 -0
- package/tests/desktop-feed-actions.test.ts +761 -0
- package/tests/desktop-feed-live-work.test.ts +209 -0
- package/tests/desktop-feed-performance.test.ts +369 -0
- package/tests/desktop-feed-plan-profiles.test.ts +509 -0
- package/tests/desktop-feed-send-prompt.test.ts +303 -0
- package/tests/desktop-feed-tool-summaries.test.ts +69 -0
- package/tests/desktop-feed.test.ts +615 -0
- package/tests/desktop-rpc-agents.test.ts +428 -2
- package/tests/desktop-rpc-changes.test.ts +608 -0
- package/tests/desktop-rpc-config-watch.test.ts +1159 -0
- package/tests/desktop-rpc-config.test.ts +11 -1
- package/tests/desktop-rpc-design.test.ts +11 -1
- package/tests/desktop-rpc-jobs.test.ts +402 -5
- package/tests/desktop-rpc-permissions.test.ts +11 -1
- package/tests/desktop-rpc-review.test.ts +678 -0
- package/tests/desktop-rpc-session.test.ts +642 -0
- package/tests/desktop-rpc-sessions.test.ts +647 -0
- package/tests/desktop-rpc-stats.test.ts +431 -0
- package/tests/desktop-rpc-updates.test.ts +525 -0
- package/tests/desktop-rpc-usage.test.ts +11 -1
- package/tests/desktop-rpc.test.ts +43 -2
- package/tests/fixtures/primary-session-prompt/gentleman.golden.md +11 -13
- package/tests/fixtures/session-profile-v1/replay.ts +4 -1
- package/tests/full-delegation-closure.test.ts +20 -1
- package/tests/gentle-agents.test.ts +519 -4
- package/tests/gentle-ai-binary.test.ts +1 -1
- package/tests/gentle-ai-installer.test.ts +52 -52
- package/tests/gentle-ai.test.ts +75 -16
- package/tests/gentle-fast.test.ts +15 -0
- package/tests/gentle-herdr-desktop-status.test.ts +595 -0
- package/tests/gentle-shell-desktop-bin.test.ts +125 -0
- package/tests/gentle-shell-desktop.test.ts +927 -0
- package/tests/gentle-shell-launcher-tower.test.ts +104 -0
- package/tests/gentle-shell.test.ts +3 -0
- package/tests/gentle-tower.test.ts +578 -0
- package/tests/herdr-desktop-status.test.ts +285 -0
- package/tests/independent-recovery-delivery.test.ts +16 -4
- package/tests/installer-server.test.ts +2 -2
- package/tests/lazy-module-contradictions-contract.test.ts +27 -4
- package/tests/maintainer/desktop-rpc.maintest.ts +279 -4
- package/tests/native-review-capability-contract.test.ts +9 -1
- package/tests/no-self-pause-contract.test.ts +23 -13
- package/tests/odd-routing-canonical-ratchet.test.ts +10 -0
- package/tests/odd-routing-contract.test.ts +19 -3
- package/tests/orchestrator-budget.test.ts +3 -1
- package/tests/orchestrator-prompt-budget.test.ts +2 -1
- package/tests/orchestrator-prompt-diet-contract.test.ts +31 -3
- package/tests/package-manifest.test.ts +10 -10
- package/tests/pi-routing-measured-values.test.ts +24 -0
- package/tests/primary-session-prompt.test.ts +25 -0
- package/tests/profile-fast-tier.test.ts +66 -1
- package/tests/provider-defect-handoff.test.ts +118 -100
- package/tests/review-contract-prompt.test.ts +2 -1
- package/tests/review-due-public-boundary.test.ts +2 -1
- package/tests/sensitive-path-tools.test.ts +138 -4
- package/tests/session-profile-extension.test.ts +310 -16
- package/tests/session-profile-freeze.test.ts +26 -0
- package/tests/session-profile-v1-compat.test.ts +20 -0
- package/tests/skill-collision-prefixes.test.ts +1 -0
- package/tests/skill-contradictions-contract.test.ts +5 -3
- package/tests/skill-registry.test.ts +54 -0
- package/tests/stats-collector.test.ts +109 -2
- package/tests/support/design-canvas-dom.ts +17 -0
- package/tests/task-size-routing-contract.test.ts +7 -3
- package/tests/tower-actions.test.ts +247 -0
- package/tests/tower-artifacts.test.ts +114 -0
- package/tests/tower-open.test.ts +97 -0
- package/tests/tower-presence.test.ts +175 -0
- package/tests/tower-server.test.ts +122 -0
- package/tests/tower-snapshot.test.ts +236 -0
- package/tests/tower-web-echo.test.ts +125 -0
- package/tests/tower-web-hover.test.ts +251 -0
- package/tests/verification-scoped-stop-contract.test.ts +32 -0
- package/tests/verification-tiers-contract.test.ts +5 -5
- package/tests/verifier-settle-reminder.test.ts +2 -2
- package/tests/verify-first-launch-contract.test.ts +2 -2
- package/tests/work-continuity-contract.test.ts +83 -17
- package/tests/writer-rejection-next-step.test.ts +55 -0
- package/tests/writer-surface-authority-contract.test.ts +158 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/README.md +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/lens.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/refuter.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/schemas/targeted-validator.schema.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/lens.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/refuter.json +0 -0
- /package/contracts/review-provider-contract-mirror/{v1.5.0 → v1.6.0}/bundle/vectors/targeted-validator.json +0 -0
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
import {
|
|
4
|
+
DESKTOP_ACTION_KINDS,
|
|
5
|
+
DESKTOP_ACTION_LIMITS,
|
|
6
|
+
DESKTOP_ACTION_SCHEMA,
|
|
7
|
+
parseDesktopAction,
|
|
8
|
+
questionShape,
|
|
9
|
+
runDesktopAction,
|
|
10
|
+
type DesktopActionOwners,
|
|
11
|
+
} from "../lib/desktop-feed-actions.ts";
|
|
12
|
+
import {
|
|
13
|
+
askAnswerHandle,
|
|
14
|
+
isAskAnswerHandle,
|
|
15
|
+
publishChoiceAnswerHandle,
|
|
16
|
+
publishQuestionnaireAnswerHandle,
|
|
17
|
+
} from "../lib/desktop-feed-answers.ts";
|
|
18
|
+
import type { DesktopRpcOutcome } from "../lib/desktop-rpc.ts";
|
|
19
|
+
|
|
20
|
+
// T11 (odd/tasks/herdr-desktop.md, S10): a session that runs outside Herdr app
|
|
21
|
+
// takes the desktop's prompts and answers through its own inbox, with the same
|
|
22
|
+
// authority as its terminal: text goes in as if typed in its editor; slash
|
|
23
|
+
// commands that are TUI code (pi built-ins, extension commands) and `!` shell
|
|
24
|
+
// lines stay in that session's terminal; nothing is sent while a question is
|
|
25
|
+
// open; and an ask tool question is answered through the tool's own handle.
|
|
26
|
+
|
|
27
|
+
const NOW = Date.UTC(2026, 10, 15, 12, 0, 0);
|
|
28
|
+
const envelope = (kind: string, args: Record<string, unknown>) =>
|
|
29
|
+
JSON.stringify({ schema: DESKTOP_ACTION_SCHEMA, id: "p-1", sessionId: "s", kind, args, createdAt: new Date(NOW).toISOString() });
|
|
30
|
+
const code = (kind: string, args: Record<string, unknown>) => {
|
|
31
|
+
const r = parseDesktopAction(envelope(kind, args), "s", NOW);
|
|
32
|
+
return "error" in r ? r.error.code : "ok";
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
interface Calls { sent: Array<{ text: string; expand: boolean }>; answered: Array<{ toolCallId: string; option?: number; text?: string }>; owners: string[] }
|
|
36
|
+
|
|
37
|
+
function owners(over: Partial<DesktopActionOwners> = {}, state: { open?: boolean; working?: boolean; handle?: boolean } = {}): { owners: DesktopActionOwners; calls: Calls } {
|
|
38
|
+
const calls: Calls = { sent: [], answered: [], owners: [] };
|
|
39
|
+
const owner = (name: string) => async (value: string): Promise<DesktopRpcOutcome> => { calls.owners.push(`${name}:${value}`); return { ok: true, data: {} }; };
|
|
40
|
+
const commands: Record<string, "extension" | "prompt" | "skill"> = { "gentle:mode": "extension", "gentle:agents": "extension", review: "prompt", "skill:go-testing": "skill" };
|
|
41
|
+
return {
|
|
42
|
+
calls,
|
|
43
|
+
owners: {
|
|
44
|
+
setPermissionMode: owner("mode"), cancelJob: owner("job"), cancelSubagent: owner("agent"),
|
|
45
|
+
question: () => questionShape("ask_user_choice", "call-1", { question: "Which?", options: [{ label: "A", value: "a" }, { label: "B", value: "b" }], allowCustomResponse: true }),
|
|
46
|
+
working: () => state.working === true, abortTurn: () => { calls.owners.push("abort"); }, permissionMode: () => "normal", busyAt: () => false,
|
|
47
|
+
questionOpen: () => state.open === true,
|
|
48
|
+
commandSource: (name) => commands[name],
|
|
49
|
+
sendPrompt: (text, expand) => { calls.sent.push({ text, expand }); return { queued: state.working === true }; },
|
|
50
|
+
answerQuestion: (toolCallId, answer) => { if (!state.handle) return false; calls.answered.push({ toolCallId, ...answer }); return true; },
|
|
51
|
+
...over,
|
|
52
|
+
},
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
const run = (o: DesktopActionOwners, kind: string, args: Record<string, unknown>) =>
|
|
57
|
+
runDesktopAction({ id: "p-1", sessionId: "s", kind: kind as never, args, createdAt: NOW }, o);
|
|
58
|
+
|
|
59
|
+
// ---- send_prompt: the file ----
|
|
60
|
+
|
|
61
|
+
test("S10: send_prompt is a known kind with one bounded text argument", () => {
|
|
62
|
+
assert.ok((DESKTOP_ACTION_KINDS as readonly string[]).includes("send_prompt"));
|
|
63
|
+
assert.equal(DESKTOP_ACTION_LIMITS.prompt, 4000);
|
|
64
|
+
assert.equal(code("send_prompt", { text: "hola" }), "ok");
|
|
65
|
+
assert.equal(code("send_prompt", { text: "line one\nline two\ttabbed" }), "ok", "new lines and tabs are typed text");
|
|
66
|
+
assert.equal(code("send_prompt", { text: "x".repeat(4000) }), "ok");
|
|
67
|
+
assert.equal(code("send_prompt", { text: "x".repeat(4001) }), "invalid_action");
|
|
68
|
+
assert.equal(code("send_prompt", { text: "" }), "invalid_action");
|
|
69
|
+
assert.equal(code("send_prompt", { text: " \n " }), "invalid_action", "nothing to send");
|
|
70
|
+
assert.equal(code("send_prompt", { text: "bell\u0007" }), "invalid_action");
|
|
71
|
+
assert.equal(code("send_prompt", { text: "esc\u001b[2J" }), "invalid_action", "no terminal escapes");
|
|
72
|
+
assert.equal(code("send_prompt", { text: 42 }), "invalid_action");
|
|
73
|
+
assert.equal(code("send_prompt", { text: "hola", deliverAs: "followUp" }), "invalid_action", "no other args");
|
|
74
|
+
assert.equal(code("send_prompt", {}), "invalid_action");
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
test("S10: answer_question takes via \"session\" and nothing else for via", () => {
|
|
78
|
+
assert.equal(code("answer_question", { toolCallId: "c", option: 0, via: "session" }), "ok");
|
|
79
|
+
assert.equal(code("answer_question", { toolCallId: "c", text: "mine", via: "session" }), "ok");
|
|
80
|
+
assert.equal(code("answer_question", { toolCallId: "c", option: 0, via: "keys" }), "invalid_action");
|
|
81
|
+
assert.equal(code("answer_question", { toolCallId: "c", option: 0 }), "ok", "the key path stays as it was");
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
// ---- send_prompt: what runs ----
|
|
85
|
+
|
|
86
|
+
test("S10: plain text is delivered once, as typed, and says whether it was queued", async () => {
|
|
87
|
+
const idle = owners();
|
|
88
|
+
assert.deepEqual(await run(idle.owners, "send_prompt", { text: " explain this file \n" }), { ok: true, data: { queued: false } });
|
|
89
|
+
assert.deepEqual(idle.calls.sent, [{ text: "explain this file", expand: false }], "trimmed, like the TUI editor's submit");
|
|
90
|
+
const busy = owners({}, { working: true });
|
|
91
|
+
assert.deepEqual(await run(busy.owners, "send_prompt", { text: "also check the tests" }), { ok: true, data: { queued: true } });
|
|
92
|
+
assert.deepEqual(busy.calls.sent, [{ text: "also check the tests", expand: false }]);
|
|
93
|
+
assert.deepEqual([...idle.calls.owners, ...busy.calls.owners], [], "no other owner is reached");
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
test("S10: nothing is sent while a question, prompt or consent is open", async () => {
|
|
97
|
+
const o = owners({}, { open: true });
|
|
98
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "yes" }), { ok: false, error: { code: "question_open", message: "Answer the open question first." } });
|
|
99
|
+
assert.deepEqual(o.calls.sent, []);
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
test("S10: pi built-ins, extension commands and ! lines stay in that session's terminal", async () => {
|
|
103
|
+
const o = owners();
|
|
104
|
+
const terminal = { ok: false, error: { code: "terminal_command", message: "Open that session's terminal to run /commands." } };
|
|
105
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/new" }), terminal);
|
|
106
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/model claude-opus-5-5" }), terminal);
|
|
107
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/quit" }), terminal);
|
|
108
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/gentle:mode super-yolo" }), terminal, "an extension command is TUI code with its own authority");
|
|
109
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/gentle:agents" }), terminal);
|
|
110
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "!rm -rf build" }), { ok: false, error: { code: "terminal_command", message: "Open that session's terminal to run ! shell commands." } });
|
|
111
|
+
assert.deepEqual(o.calls.sent, []);
|
|
112
|
+
assert.deepEqual(o.calls.owners, [], "no permission owner is reached");
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test("S10: prompt templates and skills expand as in the editor; an unknown /word is plain text", async () => {
|
|
116
|
+
const o = owners();
|
|
117
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/review the parser" }), { ok: true, data: { queued: false } });
|
|
118
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/skill:go-testing add a table test" }), { ok: true, data: { queued: false } });
|
|
119
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "/tmp/build.log shows an error" }), { ok: true, data: { queued: false } });
|
|
120
|
+
assert.deepEqual(o.calls.sent, [
|
|
121
|
+
{ text: "/review the parser", expand: true },
|
|
122
|
+
{ text: "/skill:go-testing add a table test", expand: true },
|
|
123
|
+
{ text: "/tmp/build.log shows an error", expand: false },
|
|
124
|
+
]);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
test("S10: a session without a prompt owner refuses send_prompt", async () => {
|
|
128
|
+
const o = owners({ sendPrompt: undefined });
|
|
129
|
+
assert.deepEqual(await run(o.owners, "send_prompt", { text: "hola" }), { ok: false, error: { code: "unsupported", message: "This session takes no prompts from the desktop. Update Gentle Shell and restart it." } });
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// ---- answer_question via the session ----
|
|
133
|
+
|
|
134
|
+
test("S10: answer_question via session answers the open question through its tool, once", async () => {
|
|
135
|
+
const o = owners({}, { handle: true });
|
|
136
|
+
assert.deepEqual(await run(o.owners, "answer_question", { toolCallId: "call-1", option: 1, via: "session" }), { ok: true, data: { toolCallId: "call-1", answered: true } });
|
|
137
|
+
assert.deepEqual(await run(o.owners, "answer_question", { toolCallId: "call-1", text: "my own", via: "session" }), { ok: true, data: { toolCallId: "call-1", answered: true } });
|
|
138
|
+
assert.deepEqual(o.calls.answered, [{ toolCallId: "call-1", option: 1 }, { toolCallId: "call-1", text: "my own" }]);
|
|
139
|
+
assert.equal((await run(o.owners, "answer_question", { toolCallId: "call-2", option: 0, via: "session" })).ok, false, "another question");
|
|
140
|
+
assert.deepEqual(await run(o.owners, "answer_question", { toolCallId: "call-1", option: 2, via: "session" }), { ok: false, error: { code: "invalid_action", message: "No such option" } });
|
|
141
|
+
assert.equal(o.calls.answered.length, 2);
|
|
142
|
+
});
|
|
143
|
+
|
|
144
|
+
test("S10: without the tool's handle, or for a terminal-only question, the answer stays in that terminal", async () => {
|
|
145
|
+
const none = owners({}, { handle: false });
|
|
146
|
+
assert.deepEqual(await run(none.owners, "answer_question", { toolCallId: "call-1", option: 0, via: "session" }), { ok: false, error: { code: "answer_in_terminal", message: "Answer this question in that session's terminal." } });
|
|
147
|
+
const relayed = owners({ question: () => questionShape("ask_user_choice", "call-1", { question: "Consent?", options: [{ label: "Yes", value: "granted" }, { label: "No", value: "declined" }] }) }, { handle: true });
|
|
148
|
+
assert.deepEqual(await run(relayed.owners, "answer_question", { toolCallId: "call-1", option: 0, via: "session" }), { ok: false, error: { code: "answer_in_terminal", message: "Answer this question in the Terminal view" } });
|
|
149
|
+
assert.deepEqual(relayed.calls.answered, [], "a relayed consent is never answered from the desktop");
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
// ---- The ask tools' answer handle ----
|
|
153
|
+
|
|
154
|
+
test("S10: ask_user_choice registers a handle that picks an option or a typed answer, once", () => {
|
|
155
|
+
const finished: unknown[] = [];
|
|
156
|
+
const params = { question: "Which?", options: [{ label: "A", description: "", value: "tok-a" }, { label: "B", description: "", value: "tok-b" }], allowCustomResponse: true };
|
|
157
|
+
let done = false;
|
|
158
|
+
assert.equal(askAnswerHandle("lib-call-1"), undefined);
|
|
159
|
+
publishChoiceAnswerHandle("lib-call-1", params, (result) => { finished.push(result); done = true; }, () => done);
|
|
160
|
+
const handle = askAnswerHandle("lib-call-1");
|
|
161
|
+
assert.ok(isAskAnswerHandle(handle));
|
|
162
|
+
assert.equal(handle.toolCallId, "lib-call-1");
|
|
163
|
+
assert.equal(handle.answer({ option: 2 }), false, "no such option");
|
|
164
|
+
assert.equal(handle.answer({ option: 1 }), true);
|
|
165
|
+
assert.deepEqual(finished, [{ value: "tok-b", label: "B", index: 2 }], "the same shape a click in the list gives");
|
|
166
|
+
assert.equal(handle.answer({ option: 0 }), false, "a finished list takes no second answer");
|
|
167
|
+
assert.equal(finished.length, 1);
|
|
168
|
+
assert.equal(askAnswerHandle("lib-call-1"), undefined, "a finished list is no longer listed");
|
|
169
|
+
});
|
|
170
|
+
|
|
171
|
+
test("S10: the choice handle takes text only where the list offers Other…", () => {
|
|
172
|
+
const finished: unknown[] = [];
|
|
173
|
+
const closed = { question: "Which?", options: [{ label: "A", description: "", value: "a" }, { label: "B", description: "", value: "b" }] };
|
|
174
|
+
publishChoiceAnswerHandle("lib-call-2", closed, (result) => finished.push(result), () => false);
|
|
175
|
+
assert.equal(askAnswerHandle("lib-call-2")!.answer({ text: "mine" }), false);
|
|
176
|
+
publishChoiceAnswerHandle("lib-call-3", { ...closed, allowCustomResponse: true }, (result) => finished.push(result), () => false);
|
|
177
|
+
const other = askAnswerHandle("lib-call-3")!;
|
|
178
|
+
assert.equal(other.answer({ text: " " }), false, "an empty response is refused, as in its editor");
|
|
179
|
+
assert.equal(other.answer({ text: "mine" }), true);
|
|
180
|
+
assert.deepEqual(finished, [{ customResponse: "mine" }]);
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
test("S10: ask_user_question publishes a handle only a single single-select question can use", () => {
|
|
184
|
+
const completed: unknown[] = [];
|
|
185
|
+
let done = false;
|
|
186
|
+
const one = [{ question: "Pick", header: "H", options: [{ label: "X", description: "" }, { label: "Y", description: "", preview: "p" }] }];
|
|
187
|
+
publishQuestionnaireAnswerHandle("lib-q-1", one, (result) => { completed.push(result); done = true; }, () => done);
|
|
188
|
+
const handle = askAnswerHandle("lib-q-1")!;
|
|
189
|
+
assert.equal(handle.answer({ option: 1 }), true);
|
|
190
|
+
assert.deepEqual(completed, [{ cancelled: false, answers: [{ questionIndex: 0, question: "Pick", kind: "option", answer: "Y", preview: "p" }] }]);
|
|
191
|
+
assert.equal(handle.answer({ option: 0 }), false);
|
|
192
|
+
const t: unknown[] = [];
|
|
193
|
+
publishQuestionnaireAnswerHandle("lib-q-2", one, (result) => t.push(result), () => false);
|
|
194
|
+
assert.equal(askAnswerHandle("lib-q-2")!.answer({ text: "neither" }), true);
|
|
195
|
+
assert.deepEqual(t, [{ cancelled: false, answers: [{ questionIndex: 0, question: "Pick", kind: "custom", answer: "neither" }] }]);
|
|
196
|
+
const m: unknown[] = [];
|
|
197
|
+
publishQuestionnaireAnswerHandle("lib-q-3", [...one, ...one], (result) => m.push(result), () => false);
|
|
198
|
+
assert.equal(askAnswerHandle("lib-q-3")!.answer({ option: 0 }), false);
|
|
199
|
+
publishQuestionnaireAnswerHandle("lib-q-4", [{ ...one[0]!, multiSelect: true }], (result) => m.push(result), () => false);
|
|
200
|
+
assert.equal(askAnswerHandle("lib-q-4")!.answer({ option: 0 }), false);
|
|
201
|
+
assert.deepEqual(m, []);
|
|
202
|
+
});
|
|
203
|
+
|
|
204
|
+
test("S10: the answer handles never answer with a consent token (granted/declined)", () => {
|
|
205
|
+
const finished: unknown[] = [];
|
|
206
|
+
const consent = { question: "Allow?", options: [{ label: "Yes", description: "", value: "granted" }, { label: "No", description: "", value: " Declined " }, { label: "Later", description: "", value: "later" }], allowCustomResponse: true };
|
|
207
|
+
publishChoiceAnswerHandle("lib-tok-1", consent, (result) => finished.push(result), () => false);
|
|
208
|
+
const choice = askAnswerHandle("lib-tok-1")!;
|
|
209
|
+
assert.equal(choice.answer({ option: 0 }), false);
|
|
210
|
+
assert.equal(choice.answer({ option: 1 }), false);
|
|
211
|
+
assert.equal(choice.answer({ text: " GRANTED " }), false);
|
|
212
|
+
assert.equal(choice.answer({ text: "declined" }), false);
|
|
213
|
+
const questions = [{ question: "Allow?", options: [{ label: "granted", description: "" }, { label: "Declined", description: "" }, { label: "ok", description: "" }] }];
|
|
214
|
+
publishQuestionnaireAnswerHandle("lib-tok-2", questions, (result) => finished.push(result), () => false);
|
|
215
|
+
const questionnaire = askAnswerHandle("lib-tok-2")!;
|
|
216
|
+
assert.equal(questionnaire.answer({ option: 0 }), false);
|
|
217
|
+
assert.equal(questionnaire.answer({ option: 1 }), false);
|
|
218
|
+
assert.equal(questionnaire.answer({ text: "granted" }), false);
|
|
219
|
+
assert.deepEqual(finished, []);
|
|
220
|
+
assert.equal(choice.answer({ option: 2 }), true, "other options still answer");
|
|
221
|
+
assert.equal(questionnaire.answer({ option: 2 }), true);
|
|
222
|
+
assert.equal(finished.length, 2);
|
|
223
|
+
});
|
|
224
|
+
|
|
225
|
+
test("S10: send_prompt takes CRLF line ends as LF; a lone CR stays invalid", async () => {
|
|
226
|
+
const parsed = parseDesktopAction(envelope("send_prompt", { text: "one\r\ntwo\r\n" }), "s", NOW);
|
|
227
|
+
assert.ok("action" in parsed);
|
|
228
|
+
assert.equal(parsed.action.args.text, "one\ntwo\n");
|
|
229
|
+
assert.equal(code("send_prompt", { text: "x".repeat(3999) + "\r\n" }), "ok", "the bound counts the typed text");
|
|
230
|
+
assert.equal(code("send_prompt", { text: "one\rtwo" }), "invalid_action");
|
|
231
|
+
});
|
|
232
|
+
|
|
233
|
+
test("S10: an owner that holds the prompt for after compaction says so; a second one is refused", async () => {
|
|
234
|
+
const held = owners({ sendPrompt: (text) => (text === "first" ? { queued: true, after: "compaction" } : { compacting: true }) });
|
|
235
|
+
assert.deepEqual(await run(held.owners, "send_prompt", { text: "first" }), { ok: true, data: { queued: true, after: "compaction" } });
|
|
236
|
+
assert.deepEqual(await run(held.owners, "send_prompt", { text: "second" }), { ok: false, error: { code: "session_compacting", message: "Pi is compacting this session and already holds one prompt for after it; send this one when compaction ends." } });
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test("S10: isAskAnswerHandle accepts only the handle shape", () => {
|
|
240
|
+
assert.equal(isAskAnswerHandle({ toolCallId: "c", answer: () => true }), true);
|
|
241
|
+
assert.equal(isAskAnswerHandle({ toolCallId: "", answer: () => true }), false);
|
|
242
|
+
assert.equal(isAskAnswerHandle({ toolCallId: "c" }), false);
|
|
243
|
+
assert.equal(isAskAnswerHandle(null), false);
|
|
244
|
+
});
|
|
245
|
+
|
|
246
|
+
// ---- The real ask tools publish it while their TUI list is open ----
|
|
247
|
+
|
|
248
|
+
function toolHarness(register: (pi: any) => void) {
|
|
249
|
+
let tool: any;
|
|
250
|
+
const events: string[] = [];
|
|
251
|
+
const pi = {
|
|
252
|
+
registerTool(definition: any) { tool = definition; },
|
|
253
|
+
on() {},
|
|
254
|
+
events: { emit(name: string) { events.push(name); }, on() { return () => {}; } },
|
|
255
|
+
getActiveTools: () => [],
|
|
256
|
+
setActiveTools() {},
|
|
257
|
+
};
|
|
258
|
+
register(pi);
|
|
259
|
+
// The TUI's ctx.ui.custom: builds the component with a done() that resolves the call.
|
|
260
|
+
const ctx = {
|
|
261
|
+
mode: "tui", hasUI: true, cwd: "/w",
|
|
262
|
+
sessionManager: { getBranch: () => [], getSessionId: () => "s", getEntries: () => [] },
|
|
263
|
+
ui: {
|
|
264
|
+
custom: (factory: any) => new Promise((resolve) => {
|
|
265
|
+
const tui = { requestRender() {}, terminal: { rows: 30 } };
|
|
266
|
+
const theme = { fg: (_c: string, t: string) => t, bg: (_c: string, t: string) => t, bold: (t: string) => t };
|
|
267
|
+
factory(tui, theme, undefined, resolve);
|
|
268
|
+
}),
|
|
269
|
+
},
|
|
270
|
+
};
|
|
271
|
+
return { events, run: (id: string, params: unknown) => tool.execute(id, params, undefined, undefined, ctx) };
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
test("S10: the ask_user_choice list publishes its handle and the handle's answer is the tool's result", async () => {
|
|
275
|
+
const { default: askUserChoice } = await import("../extensions/ask-user-choice.ts");
|
|
276
|
+
const h = toolHarness(askUserChoice);
|
|
277
|
+
const params = { question: "Which?", options: [{ label: "A", description: "a", value: "tok-a" }, { label: "B", description: "b", value: "tok-b" }] };
|
|
278
|
+
const result = h.run("tool-call-7", params);
|
|
279
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
280
|
+
const handle = askAnswerHandle("tool-call-7")!;
|
|
281
|
+
assert.ok(handle, "the open list registered its handle");
|
|
282
|
+
assert.equal(handle.answer({ option: 1 }), true);
|
|
283
|
+
const done = await result as { content: Array<{ text: string }>; details: { selection?: unknown } };
|
|
284
|
+
assert.deepEqual(done.details.selection, { value: "tok-b", label: "B", index: 2 });
|
|
285
|
+
assert.equal(done.content[0]!.text, "User selected: 2. B (value: tok-b)");
|
|
286
|
+
assert.equal(handle.answer({ option: 0 }), false, "answered once");
|
|
287
|
+
assert.deepEqual(h.events, ["gentle-pi:ask-user-choice:blocked", "gentle-pi:ask-user-choice:blocked"], "the tool's bus traffic is unchanged");
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
test("S10: the ask_user_question view publishes its handle and the handle's answer is the tool's result", async () => {
|
|
291
|
+
const { default: askUserQuestion } = await import("../extensions/ask-user-question.ts");
|
|
292
|
+
const h = toolHarness(askUserQuestion);
|
|
293
|
+
const params = { questions: [{ question: "Pick one?", header: "Pick", options: [{ label: "X", description: "x" }, { label: "Y", description: "y" }] }] };
|
|
294
|
+
const result = h.run("tool-q-7", params);
|
|
295
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
296
|
+
const handle = askAnswerHandle("tool-q-7")!;
|
|
297
|
+
assert.ok(handle, "the open view registered its handle");
|
|
298
|
+
assert.equal(handle.answer({ option: 0 }), true);
|
|
299
|
+
const done = await result as { details: { answers?: unknown } };
|
|
300
|
+
assert.deepEqual(done.details.answers, [{ questionIndex: 0, question: "Pick one?", kind: "option", answer: "X" }]);
|
|
301
|
+
assert.equal(handle.answer({ option: 1 }), false, "answered once");
|
|
302
|
+
assert.deepEqual(h.events, ["gentle-pi:ask-user-question:blocked", "gentle-pi:ask-user-question:blocked"], "the tool's bus traffic is unchanged");
|
|
303
|
+
});
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import assert from "node:assert/strict";
|
|
2
|
+
import { test } from "node:test";
|
|
3
|
+
// The chat mod's pure session reader (no host imports): what each tool's collapsed row says.
|
|
4
|
+
import { createFeed, ingest, summarize } from "../herdr/mods/gentle-chat/feed.js";
|
|
5
|
+
|
|
6
|
+
// S15 (odd/tasks/herdr-desktop.md, xabilarra's report): the minimal view gives every tool a
|
|
7
|
+
// readable one-line summary beside its name, never the raw JSON of its arguments. The expanded
|
|
8
|
+
// view keeps the whole arguments (the call keeps `args`).
|
|
9
|
+
|
|
10
|
+
const call = (name: string, args: unknown) => {
|
|
11
|
+
const feed = createFeed();
|
|
12
|
+
ingest(feed, JSON.stringify({ type: "message", id: "m1", message: { role: "assistant", content: [{ type: "toolCall", id: "c1", name, arguments: args }] } }));
|
|
13
|
+
const block = (feed.items[0] as { blocks: Array<{ call: { name: string; args: unknown; summary: string } }> }).blocks[0]!;
|
|
14
|
+
return block.call;
|
|
15
|
+
};
|
|
16
|
+
const noJson = (text: string) => assert.ok(!/[{[]"/.test(text) && !text.includes("\":"), `no raw JSON in ${JSON.stringify(text)}`);
|
|
17
|
+
|
|
18
|
+
test("S15: todo says its action and its tasks, never the JSON of its list", () => {
|
|
19
|
+
const write = call("todo", { action: "write", tasks: [{ title: "Spec", status: "done" }, { title: "Build", status: "in_progress" }, { title: "Ship", status: "pending" }] });
|
|
20
|
+
assert.equal(write.summary, "write · 3 tasks, 1 in progress");
|
|
21
|
+
assert.deepEqual(write.args, { action: "write", tasks: [{ title: "Spec", status: "done" }, { title: "Build", status: "in_progress" }, { title: "Ship", status: "pending" }] }, "the expanded view keeps every argument");
|
|
22
|
+
assert.equal(summarize("todo", { action: "write", tasks: [{ title: "One", status: "pending" }] }), "write · 1 task");
|
|
23
|
+
assert.equal(summarize("todo", { action: "update", id: 2, status: "done" }), "update #2 → done");
|
|
24
|
+
assert.equal(summarize("todo", { action: "add", title: "Write the docs" }), "add · Write the docs");
|
|
25
|
+
assert.equal(summarize("todo", { action: "list" }), "list");
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("S15: questions show their question text", () => {
|
|
29
|
+
assert.equal(call("ask_user_choice", { question: "Which layout?\nPick one.", options: [{ label: "A" }, { label: "B" }] }).summary, "Which layout?");
|
|
30
|
+
assert.equal(summarize("ask_user_question", { questions: [{ question: "Name?", header: "N" }, { question: "Colour?" }] }), "Name? (+1 more)");
|
|
31
|
+
assert.equal(summarize("ask_user_question", { questions: [{ question: "Only one?" }] }), "Only one?");
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
test("S15: subagents, jobs, web, memory, codemode and review tools say what they do", () => {
|
|
35
|
+
assert.equal(summarize("subagent_run", { agent: "gentle-writer", label: "S15 publisher", task: "Implement…" }), "gentle-writer · S15 publisher");
|
|
36
|
+
assert.equal(summarize("subagent_run", { agent: "gentle-writer", task: "Fix the bug\nthen test" }), "gentle-writer · Fix the bug");
|
|
37
|
+
assert.equal(summarize("bash_background", { command: "npm test", label: "unit tests" }), "unit tests");
|
|
38
|
+
assert.equal(summarize("monitor", { command: "gh run watch 1", label: "CI", timeout_seconds: 60 }), "CI");
|
|
39
|
+
assert.equal(summarize("bash_background", { command: "npm test" }), "npm test");
|
|
40
|
+
assert.equal(summarize("job_stop", { job_id: "j7" }), "j7");
|
|
41
|
+
assert.equal(summarize("web_search", { query: "herdr 0.1.16 changelog" }), "herdr 0.1.16 changelog");
|
|
42
|
+
assert.equal(summarize("web_search", { queries: ["first query", "second"] }), "first query (+1 more)");
|
|
43
|
+
assert.equal(summarize("fetch_content", { url: "https://herdr.dev/gallery/" }), "https://herdr.dev/gallery/");
|
|
44
|
+
assert.equal(summarize("fetch_content", { urls: ["https://a.dev", "https://b.dev"] }), "https://a.dev (+1 more)");
|
|
45
|
+
assert.equal(summarize("mem_save", { title: "Fixed the feed", content: "**What**: …", type: "bugfix" }), "Fixed the feed");
|
|
46
|
+
assert.equal(summarize("mem_search", { query: "desktop feed", limit: 5 }), "desktop feed");
|
|
47
|
+
assert.equal(summarize("mem_get_observation", { id: 42 }), "#42");
|
|
48
|
+
assert.equal(summarize("codemode", { code: "\n// read the graph\nconst r = await codegraph.search({ q: 'x' });\nreturn r;" }), "const r = await codegraph.search({ q: 'x' });");
|
|
49
|
+
assert.equal(summarize("gentle_review", { operation: "assess" }), "assess");
|
|
50
|
+
assert.equal(summarize("gentle_review_run", { operation: "start", input: "{\"mode\":\"ordinary\"}" }), "start");
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
test("S15: the existing summaries stay as they were", () => {
|
|
54
|
+
assert.equal(summarize("bash", { command: "cd /w && npm test\nnext" }), "cd /w && npm test");
|
|
55
|
+
assert.equal(summarize("read", { path: "/w/NOTAS.md" }), "/w/NOTAS.md");
|
|
56
|
+
assert.equal(summarize("grep", { pattern: "TODO", path: "/w" }), "/w");
|
|
57
|
+
assert.equal(summarize("edit", { path: "/w/a.ts", edits: [{ oldText: "a", newText: "b" }] }), "/w/a.ts");
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
test("S15: an unknown tool shows its first string value on one line, never JSON", () => {
|
|
61
|
+
const nested = summarize("custom_tool", { options: { deep: [{ name: "first\nvalue" }] }, n: 3 });
|
|
62
|
+
assert.equal(nested, "first");
|
|
63
|
+
noJson(nested);
|
|
64
|
+
assert.equal(summarize("custom_tool", { count: 3, flag: true }), "");
|
|
65
|
+
assert.equal(summarize("custom_tool", {}), "");
|
|
66
|
+
assert.equal(summarize("custom_tool", "plain text\nmore"), "plain text");
|
|
67
|
+
for (const [name, args] of [["todo", { action: "write", tasks: [] }], ["ask_user_choice", { options: [{ label: "A" }] }], ["mystery", { a: { b: [1, 2] } }]] as const) noJson(summarize(name, args));
|
|
68
|
+
assert.ok(summarize("custom_tool", { text: "x".repeat(400) }).length <= 140, "one bounded line");
|
|
69
|
+
});
|