@agentwhy/cli 0.0.0-dev
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/LICENSE +202 -0
- package/NOTICE +2 -0
- package/README.md +181 -0
- package/THIRD_PARTY_NOTICES.md +31 -0
- package/dist/adapter/claude-code/contract/assumptions.js +208 -0
- package/dist/adapter/claude-code/contract/denials.js +15 -0
- package/dist/adapter/claude-code/contract/entry-points.js +15 -0
- package/dist/adapter/claude-code/contract/fields.js +73 -0
- package/dist/adapter/claude-code/contract/hooks.js +96 -0
- package/dist/adapter/claude-code/contract/identifiers.js +15 -0
- package/dist/adapter/claude-code/contract/layout.js +29 -0
- package/dist/adapter/claude-code/contract/line-types.js +26 -0
- package/dist/adapter/claude-code/contract/projects.js +23 -0
- package/dist/adapter/claude-code/contract/recognition.js +14 -0
- package/dist/adapter/claude-code/contract/session-title.js +20 -0
- package/dist/adapter/claude-code/contract/settings.js +27 -0
- package/dist/adapter/claude-code/contract/task-notifications.js +33 -0
- package/dist/adapter/claude-code/contract/tools.js +37 -0
- package/dist/adapter/claude-code/contract/version.js +51 -0
- package/dist/adapter/claude-code/discovery/claude-code-project-catalogue.js +129 -0
- package/dist/adapter/claude-code/discovery/claude-code-recognition.js +46 -0
- package/dist/adapter/claude-code/discovery/claude-code-session-catalogue.js +100 -0
- package/dist/adapter/claude-code/discovery/claude-code-session-discovery.js +61 -0
- package/dist/adapter/claude-code/discovery/claude-code-session-titles.js +28 -0
- package/dist/adapter/claude-code/discovery/discovered-session.js +1 -0
- package/dist/adapter/claude-code/discovery/session-entries.js +41 -0
- package/dist/adapter/claude-code/discovery/transcript-tail.js +81 -0
- package/dist/adapter/claude-code/events/claude-code-session-source.js +197 -0
- package/dist/adapter/claude-code/events/delegation-index.js +15 -0
- package/dist/adapter/claude-code/events/transcript-scan.js +179 -0
- package/dist/adapter/claude-code/hooks/hook-output.js +42 -0
- package/dist/adapter/claude-code/hooks/pre-tool-use-input.js +23 -0
- package/dist/adapter/claude-code/hooks/stop-input.js +25 -0
- package/dist/adapter/claude-code/hooks/subagent-stop-input.js +26 -0
- package/dist/adapter/claude-code/policy/deny-rules.js +46 -0
- package/dist/adapter/claude-code/probe/claude-code-probe.js +86 -0
- package/dist/adapter/claude-code/probe/collectors/agent-tool-input-key-collector.js +24 -0
- package/dist/adapter/claude-code/probe/collectors/denial-kind-collector.js +20 -0
- package/dist/adapter/claude-code/probe/collectors/denied-call-collector.js +11 -0
- package/dist/adapter/claude-code/probe/collectors/identifier-collector.js +19 -0
- package/dist/adapter/claude-code/probe/collectors/line-collector.js +1 -0
- package/dist/adapter/claude-code/probe/collectors/line-type-collector.js +29 -0
- package/dist/adapter/claude-code/probe/collectors/sidechain-collector.js +20 -0
- package/dist/adapter/claude-code/probe/collectors/task-notification-collector.js +51 -0
- package/dist/adapter/claude-code/probe/collectors/tool-result-reference-collector.js +31 -0
- package/dist/adapter/claude-code/probe/collectors/tool-use-collector.js +24 -0
- package/dist/adapter/claude-code/probe/collectors/tool-version-collector.js +14 -0
- package/dist/adapter/claude-code/probe/collectors/top-level-key-collector.js +14 -0
- package/dist/adapter/claude-code/probe/collectors/unknown-line-type-key-collector.js +24 -0
- package/dist/adapter/claude-code/probe/collectors/working-directory-collector.js +28 -0
- package/dist/adapter/claude-code/probe/doctor-report.js +1 -0
- package/dist/adapter/claude-code/probe/meta-tally.js +42 -0
- package/dist/adapter/claude-code/probe/session-probe.js +1 -0
- package/dist/adapter/claude-code/probe/session-tally.js +41 -0
- package/dist/adapter/claude-code/probe/transcript-line.js +30 -0
- package/dist/adapter/claude-code/probe/transcript-tally.js +74 -0
- package/dist/adapter/claude-code/settings/deny-entries.js +65 -0
- package/dist/adapter/claude-code/settings/hook-entries.js +303 -0
- package/dist/adapter/codex/contract/actions.js +69 -0
- package/dist/adapter/codex/contract/assumptions.js +55 -0
- package/dist/adapter/codex/contract/capabilities.js +24 -0
- package/dist/adapter/codex/contract/delegations.js +30 -0
- package/dist/adapter/codex/contract/deliveries.js +25 -0
- package/dist/adapter/codex/contract/envelope.js +33 -0
- package/dist/adapter/codex/contract/hook-refusals.js +14 -0
- package/dist/adapter/codex/contract/hooks.js +46 -0
- package/dist/adapter/codex/contract/messages.js +47 -0
- package/dist/adapter/codex/contract/permissions.js +27 -0
- package/dist/adapter/codex/contract/reviews.js +13 -0
- package/dist/adapter/codex/contract/session.js +31 -0
- package/dist/adapter/codex/contract/turns.js +23 -0
- package/dist/adapter/codex/contract/version.js +15 -0
- package/dist/adapter/codex/discovery/codex-conversations.js +44 -0
- package/dist/adapter/codex/discovery/codex-project-catalogue.js +49 -0
- package/dist/adapter/codex/discovery/codex-recognition.js +20 -0
- package/dist/adapter/codex/discovery/codex-session-catalogue.js +28 -0
- package/dist/adapter/codex/discovery/codex-session-discovery.js +115 -0
- package/dist/adapter/codex/discovery/codex-session-index.js +21 -0
- package/dist/adapter/codex/discovery/codex-session-titles.js +135 -0
- package/dist/adapter/codex/discovery/session-header.js +86 -0
- package/dist/adapter/codex/discovery/session-owners.js +11 -0
- package/dist/adapter/codex/discovery/session-roots.js +49 -0
- package/dist/adapter/codex/events/action-items.js +138 -0
- package/dist/adapter/codex/events/capability-records.js +26 -0
- package/dist/adapter/codex/events/codex-session-source.js +121 -0
- package/dist/adapter/codex/events/hook-refusals.js +27 -0
- package/dist/adapter/codex/events/rollout-scan.js +614 -0
- package/dist/adapter/codex/events/turn-permissions.js +60 -0
- package/dist/adapter/codex/hooks/pre-tool-use-input.js +24 -0
- package/dist/adapter/codex/hooks/stop-refusals.js +57 -0
- package/dist/adapter/codex/probe/codex-doctor-report.js +1 -0
- package/dist/adapter/codex/probe/codex-probe.js +268 -0
- package/dist/adapter/codex/settings/codex-hooks.js +83 -0
- package/dist/cli/cli-command.js +1 -0
- package/dist/cli/command-router.js +42 -0
- package/dist/cli/commands/check-cli-command.js +128 -0
- package/dist/cli/commands/codex-stop-cli-command.js +27 -0
- package/dist/cli/commands/doctor-arguments.js +32 -0
- package/dist/cli/commands/doctor-cli-command.js +31 -0
- package/dist/cli/commands/doctor-usage.js +14 -0
- package/dist/cli/commands/init-cli-command.js +123 -0
- package/dist/cli/commands/menu-cli-command.js +58 -0
- package/dist/cli/commands/notify-cli-command.js +158 -0
- package/dist/cli/commands/refuse-cli-command.js +79 -0
- package/dist/cli/commands/report-arguments.js +62 -0
- package/dist/cli/commands/report-cli-command.js +36 -0
- package/dist/cli/commands/report-usage.js +41 -0
- package/dist/cli/commands/sessions-cli-command.js +184 -0
- package/dist/cli/commands/start-cli-command.js +83 -0
- package/dist/cli/commands/watch-cli-command.js +142 -0
- package/dist/cli/exit-codes.js +13 -0
- package/dist/cli/project-switches.js +46 -0
- package/dist/cli.js +80 -0
- package/dist/composition-root.js +411 -0
- package/dist/core/access/command-line.js +454 -0
- package/dist/core/access/listing.js +58 -0
- package/dist/core/access/path-shape.js +59 -0
- package/dist/core/access/path-tokens.js +37 -0
- package/dist/core/access/protected-access.js +310 -0
- package/dist/core/access/protected-values.js +102 -0
- package/dist/core/access/recorded-effect.js +67 -0
- package/dist/core/access/returns.js +173 -0
- package/dist/core/access/search-output.js +34 -0
- package/dist/core/access/search-reach.js +268 -0
- package/dist/core/access/uses.js +143 -0
- package/dist/core/access/words-before.js +52 -0
- package/dist/core/agent.js +1 -0
- package/dist/core/capability.js +11 -0
- package/dist/core/combined-project-catalogue.js +36 -0
- package/dist/core/combined-session-catalogue.js +25 -0
- package/dist/core/completeness.js +10 -0
- package/dist/core/context.js +1 -0
- package/dist/core/correlation/correlate.js +329 -0
- package/dist/core/delegation.js +1 -0
- package/dist/core/detector/prompt-signals.js +78 -0
- package/dist/core/entry-point.js +1 -0
- package/dist/core/event.js +1 -0
- package/dist/core/evidence.js +9 -0
- package/dist/core/late-message.js +32 -0
- package/dist/core/message.js +1 -0
- package/dist/core/nearest-project.js +28 -0
- package/dist/core/policy/default-policy.js +32 -0
- package/dist/core/policy/glob.js +56 -0
- package/dist/core/policy/parse-policy.js +70 -0
- package/dist/core/policy/policy.js +20 -0
- package/dist/core/policy/resolve-policy.js +16 -0
- package/dist/core/project-catalogue.js +1 -0
- package/dist/core/project-root.js +133 -0
- package/dist/core/provider-titles.js +10 -0
- package/dist/core/redaction/entropy.js +46 -0
- package/dist/core/redaction/redacted.js +4 -0
- package/dist/core/redaction/redactor.js +339 -0
- package/dist/core/redaction/secret-patterns.js +22 -0
- package/dist/core/redaction/value-shapes.js +81 -0
- package/dist/core/redaction/value-trace.js +110 -0
- package/dist/core/review.js +1 -0
- package/dist/core/session-catalogue.js +19 -0
- package/dist/core/session-filter.js +42 -0
- package/dist/core/session-format.js +27 -0
- package/dist/core/session-model.js +1 -0
- package/dist/core/session-reader.js +22 -0
- package/dist/core/session-records.js +1 -0
- package/dist/core/session-source.js +1 -0
- package/dist/core/session-titles.js +21 -0
- package/dist/core/turn.js +1 -0
- package/dist/doctor/codex-doctor.js +14 -0
- package/dist/doctor/doctor-use-case.js +1 -0
- package/dist/doctor/format-selecting-doctor.js +28 -0
- package/dist/doctor/render/attention/attention-rule.js +1 -0
- package/dist/doctor/render/attention/doctor-attention-rules.js +28 -0
- package/dist/doctor/render/attention/rules/damaged-meta-files-rule.js +8 -0
- package/dist/doctor/render/attention/rules/damaged-transcripts-rule.js +9 -0
- package/dist/doctor/render/attention/rules/incomplete-subagent-pairs-rule.js +6 -0
- package/dist/doctor/render/attention/rules/missing-main-transcript-rule.js +5 -0
- package/dist/doctor/render/attention/rules/missing-spilled-results-rule.js +6 -0
- package/dist/doctor/render/attention/rules/multiple-working-directories-rule.js +15 -0
- package/dist/doctor/render/attention/rules/unknown-denial-kinds-rule.js +5 -0
- package/dist/doctor/render/attention/rules/unknown-line-types-rule.js +6 -0
- package/dist/doctor/render/attention/rules/unrecognised-entries-rule.js +6 -0
- package/dist/doctor/render/attention/rules/unusable-directories-rule.js +12 -0
- package/dist/doctor/render/attention/transcript-scopes.js +6 -0
- package/dist/doctor/render/codex-text-doctor-renderer.js +97 -0
- package/dist/doctor/render/doctor-renderers.js +1 -0
- package/dist/doctor/render/json-doctor-renderer.js +7 -0
- package/dist/doctor/render/output-format.js +1 -0
- package/dist/doctor/render/text-doctor-renderer.js +124 -0
- package/dist/doctor/session-doctor.js +16 -0
- package/dist/infrastructure/clack-asker.js +24 -0
- package/dist/infrastructure/clack-chooser.js +40 -0
- package/dist/infrastructure/clack-multi-chooser.js +31 -0
- package/dist/infrastructure/file-alert-store.js +120 -0
- package/dist/infrastructure/file-checked-store.js +55 -0
- package/dist/infrastructure/file-mark-store.js +67 -0
- package/dist/infrastructure/file-onboarding-store.js +93 -0
- package/dist/infrastructure/folder-window.js +26 -0
- package/dist/infrastructure/node-agentwhy-invocation.js +99 -0
- package/dist/infrastructure/node-browser.js +40 -0
- package/dist/infrastructure/node-file-system.js +111 -0
- package/dist/infrastructure/node-local-server.js +115 -0
- package/dist/infrastructure/node-text-input.js +26 -0
- package/dist/infrastructure/os-notifier.js +21 -0
- package/dist/infrastructure/osascript-folder-chooser.js +53 -0
- package/dist/infrastructure/powershell-folder-chooser.js +78 -0
- package/dist/infrastructure/real-directory.js +18 -0
- package/dist/infrastructure/stream-printer.js +11 -0
- package/dist/infrastructure/terminal-banner.js +19 -0
- package/dist/ports/agentwhy-invocation.js +1 -0
- package/dist/ports/alert-store.js +1 -0
- package/dist/ports/asker.js +1 -0
- package/dist/ports/browser.js +1 -0
- package/dist/ports/checked-store.js +1 -0
- package/dist/ports/chooser.js +1 -0
- package/dist/ports/directory-reader.js +1 -0
- package/dist/ports/file-access-error.js +11 -0
- package/dist/ports/file-reader.js +1 -0
- package/dist/ports/file-tail-reader.js +1 -0
- package/dist/ports/file-writer.js +1 -0
- package/dist/ports/folder-chooser.js +1 -0
- package/dist/ports/local-server.js +1 -0
- package/dist/ports/mark-store.js +10 -0
- package/dist/ports/multi-chooser.js +1 -0
- package/dist/ports/notifier.js +1 -0
- package/dist/ports/onboarding-store.js +1 -0
- package/dist/ports/printer.js +1 -0
- package/dist/ports/text-input.js +1 -0
- package/dist/refuse/command-reach.js +135 -0
- package/dist/refuse/command-refusal.js +88 -0
- package/dist/refuse/render/codex-stop-words.js +21 -0
- package/dist/refuse/render/refusal-words.js +34 -0
- package/dist/report/build-report.js +1037 -0
- package/dist/report/check/actions-digest.js +73 -0
- package/dist/report/check/check-lines.js +83 -0
- package/dist/report/check/mark-request.js +90 -0
- package/dist/report/check/marks.js +84 -0
- package/dist/report/check/render/text-digest-renderer.js +332 -0
- package/dist/report/check/session-actions.js +90 -0
- package/dist/report/check/session-check.js +91 -0
- package/dist/report/choose-policy.js +61 -0
- package/dist/report/flow-reads.js +18 -0
- package/dist/report/private-files/tell-lists.js +84 -0
- package/dist/report/project-rules.js +33 -0
- package/dist/report/render/home-relative.js +18 -0
- package/dist/report/render/html-head.js +26 -0
- package/dist/report/render/html-report-components.js +48 -0
- package/dist/report/render/html-report-styles.js +500 -0
- package/dist/report/render/html-sidebar.js +42 -0
- package/dist/report/render/path-tail.js +14 -0
- package/dist/report/render/report-copy.js +1177 -0
- package/dist/report/render/report-page/advanced-view.js +167 -0
- package/dist/report/render/report-page/file-story.js +114 -0
- package/dist/report/render/report-page/files-view.js +381 -0
- package/dist/report/render/report-page/files.js +77 -0
- package/dist/report/render/report-page/fix-wizard-script.js +269 -0
- package/dist/report/render/report-page/fix-wizard.js +310 -0
- package/dist/report/render/report-page/helpers-view.js +383 -0
- package/dist/report/render/report-page/helpers.js +51 -0
- package/dist/report/render/report-page/item-names.js +63 -0
- package/dist/report/render/report-page/protect-patterns.js +13 -0
- package/dist/report/render/report-page/providers.js +208 -0
- package/dist/report/render/report-page/record-view.js +367 -0
- package/dist/report/render/report-page/report-page-renderer.js +129 -0
- package/dist/report/render/report-page/report-views.js +31 -0
- package/dist/report/render/report-page/story-window.js +356 -0
- package/dist/report/render/report-page/times.js +25 -0
- package/dist/report/render/report-page/to-do-view.js +299 -0
- package/dist/report/render/report-page/to-do.js +152 -0
- package/dist/report/render/report-page.js +1 -0
- package/dist/report/render/session-view.js +250 -0
- package/dist/report/render/text-report-renderer.js +981 -0
- package/dist/report/render/ui/add-file-popup.js +122 -0
- package/dist/report/render/ui/app-sidebar.js +78 -0
- package/dist/report/render/ui/ask-panel.js +80 -0
- package/dist/report/render/ui/avatar.js +19 -0
- package/dist/report/render/ui/backdrop.js +29 -0
- package/dist/report/render/ui/brand-mark.js +4 -0
- package/dist/report/render/ui/button.js +67 -0
- package/dist/report/render/ui/callout.js +20 -0
- package/dist/report/render/ui/chat-example.js +17 -0
- package/dist/report/render/ui/checklist.js +50 -0
- package/dist/report/render/ui/confirm-dialog.js +34 -0
- package/dist/report/render/ui/data-table.js +49 -0
- package/dist/report/render/ui/drawer.js +25 -0
- package/dist/report/render/ui/file-chip.js +37 -0
- package/dist/report/render/ui/fold-line.js +22 -0
- package/dist/report/render/ui/guide-card.js +25 -0
- package/dist/report/render/ui/hero.js +37 -0
- package/dist/report/render/ui/labelled-select.js +10 -0
- package/dist/report/render/ui/live-script.js +222 -0
- package/dist/report/render/ui/local-date.js +58 -0
- package/dist/report/render/ui/mode-icon.js +6 -0
- package/dist/report/render/ui/page-shell.js +101 -0
- package/dist/report/render/ui/pill-tabs.js +47 -0
- package/dist/report/render/ui/popup.js +77 -0
- package/dist/report/render/ui/progress.js +35 -0
- package/dist/report/render/ui/project-list.js +284 -0
- package/dist/report/render/ui/scope-choice.js +19 -0
- package/dist/report/render/ui/stats.js +21 -0
- package/dist/report/render/ui/status-icon.js +30 -0
- package/dist/report/render/ui/status-look.js +21 -0
- package/dist/report/render/ui/switch.js +11 -0
- package/dist/report/render/ui/tag.js +19 -0
- package/dist/report/render/ui/task-list.js +56 -0
- package/dist/report/render/ui/tokens.js +46 -0
- package/dist/report/render/ui/update-notice.js +146 -0
- package/dist/report/render/ui/words/app-words.js +163 -0
- package/dist/report/render/ui/words/conversations-words.js +457 -0
- package/dist/report/render/ui/words/month-words.js +59 -0
- package/dist/report/render/ui/words/onboarding-words.js +446 -0
- package/dist/report/render/ui/words/projects-words.js +217 -0
- package/dist/report/render/ui/words/report-words.js +2099 -0
- package/dist/report/render/ui/words/settings-words.js +611 -0
- package/dist/report/render/ui/words/to-fix-words.js +287 -0
- package/dist/report/report-model.js +2 -0
- package/dist/report/report-use-case.js +1 -0
- package/dist/report/rule-names.js +20 -0
- package/dist/report/session-report.js +163 -0
- package/dist/report/start/app-nav.js +37 -0
- package/dist/report/start/conversations/calendar-view.js +104 -0
- package/dist/report/start/conversations/conversation-columns.js +187 -0
- package/dist/report/start/conversations/conversations-renderer.js +54 -0
- package/dist/report/start/conversations/empty-week.js +120 -0
- package/dist/report/start/conversations/files-window.js +166 -0
- package/dist/report/start/conversations/period-section.js +280 -0
- package/dist/report/start/conversations/periods-script.js +440 -0
- package/dist/report/start/conversations/periods.js +110 -0
- package/dist/report/start/conversations/week-view.js +30 -0
- package/dist/report/start/conversations/weeks.js +17 -0
- package/dist/report/start/month/month-renderer.js +50 -0
- package/dist/report/start/month/month-view.js +135 -0
- package/dist/report/start/month/months.js +17 -0
- package/dist/report/start/onboarding/done.js +171 -0
- package/dist/report/start/onboarding/finish-onboarding.js +93 -0
- package/dist/report/start/onboarding/intro.js +100 -0
- package/dist/report/start/onboarding/onboarding-changes.js +40 -0
- package/dist/report/start/onboarding/onboarding-renderer.js +195 -0
- package/dist/report/start/onboarding/onboarding-script.js +400 -0
- package/dist/report/start/onboarding/onboarding-view.js +98 -0
- package/dist/report/start/onboarding/project-step.js +210 -0
- package/dist/report/start/onboarding/steps.js +239 -0
- package/dist/report/start/onboarding/welcome.js +66 -0
- package/dist/report/start/page-notice.js +10 -0
- package/dist/report/start/projects/index-projects.js +43 -0
- package/dist/report/start/projects/moved-page.js +82 -0
- package/dist/report/start/projects/project-switch.js +138 -0
- package/dist/report/start/projects/projects-window.js +67 -0
- package/dist/report/start/projects/temporary-space.js +18 -0
- package/dist/report/start/render/air-datepicker-vendor.js +27 -0
- package/dist/report/start/render/session-status.js +41 -0
- package/dist/report/start/render/start-words.js +84 -0
- package/dist/report/start/repository.js +28 -0
- package/dist/report/start/serve/index-handler.js +372 -0
- package/dist/report/start/serve/onboarding-request.js +50 -0
- package/dist/report/start/serve/settings-request.js +1 -0
- package/dist/report/start/serve/settings-setup.js +193 -0
- package/dist/report/start/session-index.js +1 -0
- package/dist/report/start/session-start.js +974 -0
- package/dist/report/start/settings/alerts-tab.js +104 -0
- package/dist/report/start/settings/files-tab.js +169 -0
- package/dist/report/start/settings/general-tab.js +71 -0
- package/dist/report/start/settings/settings-renderer.js +254 -0
- package/dist/report/start/settings/settings-script.js +161 -0
- package/dist/report/start/settings/settings-view.js +240 -0
- package/dist/report/start/settings/settings-windows.js +334 -0
- package/dist/report/start/settings-files.js +43 -0
- package/dist/report/start/to-fix/done-list.js +45 -0
- package/dist/report/start/to-fix/file-window.js +110 -0
- package/dist/report/start/to-fix/to-fix-list.js +70 -0
- package/dist/report/start/to-fix/to-fix-renderer.js +237 -0
- package/dist/report/start/to-fix/to-fix-script.js +94 -0
- package/dist/report/start/to-fix/to-fix-view.js +124 -0
- package/dist/report/watch/agent-alert.js +72 -0
- package/dist/report/watch/notice-choices.js +35 -0
- package/dist/report/watch/notice-settings.js +65 -0
- package/dist/report/watch/preferences.js +100 -0
- package/dist/report/watch/render/instruction-words.js +54 -0
- package/dist/report/watch/render/notice-words.js +182 -0
- package/dist/report/watch/subagent-watch.js +345 -0
- package/dist/report/watch/watch-notice.js +1 -0
- package/dist/setup/behind.js +18 -0
- package/dist/setup/codex-mirror.js +171 -0
- package/dist/setup/not-a-project.js +19 -0
- package/dist/setup/project-setup.js +644 -0
- package/dist/setup/protected-patterns.js +30 -0
- package/dist/shared/colour.js +23 -0
- package/dist/shared/compare.js +4 -0
- package/dist/shared/content-version.js +13 -0
- package/dist/shared/counter.js +11 -0
- package/dist/shared/file-stamp.js +4 -0
- package/dist/shared/json.js +13 -0
- package/dist/shared/label.js +13 -0
- package/dist/shared/package-name.js +6 -0
- package/dist/shared/plain-invocation.js +44 -0
- package/dist/shared/plain-version.js +21 -0
- package/dist/shared/printable.js +25 -0
- package/dist/shared/renderer.js +1 -0
- package/dist/shared/sentence.js +20 -0
- package/dist/shared/terminal-logo.js +41 -0
- package/dist/shared/text-table.js +15 -0
- package/dist/shared/wrap.js +29 -0
- package/package.json +70 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Counter } from '../../../../shared/counter.js';
|
|
2
|
+
import { toLabel } from '../../../../shared/label.js';
|
|
3
|
+
import { AGENT_TOOL, FIELDS } from '../../contract/fields.js';
|
|
4
|
+
import { toolUseBlocks } from '../transcript-line.js';
|
|
5
|
+
export class ToolUseCollector {
|
|
6
|
+
#tools = new Counter();
|
|
7
|
+
#agentToolUses = 0;
|
|
8
|
+
collect({ json }) {
|
|
9
|
+
if (json === undefined)
|
|
10
|
+
return;
|
|
11
|
+
for (const block of toolUseBlocks(json)) {
|
|
12
|
+
const name = block[FIELDS.toolName];
|
|
13
|
+
this.#tools.add(toLabel(name));
|
|
14
|
+
if (name === AGENT_TOOL.name)
|
|
15
|
+
this.#agentToolUses += 1;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
tools() {
|
|
19
|
+
return this.#tools.toCounts();
|
|
20
|
+
}
|
|
21
|
+
agentToolUses() {
|
|
22
|
+
return this.#agentToolUses;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Counter } from '../../../../shared/counter.js';
|
|
2
|
+
import { toLabel } from '../../../../shared/label.js';
|
|
3
|
+
import { FIELDS } from '../../contract/fields.js';
|
|
4
|
+
export class ToolVersionCollector {
|
|
5
|
+
#versions = new Counter();
|
|
6
|
+
collect({ json }) {
|
|
7
|
+
const version = json?.[FIELDS.toolVersion];
|
|
8
|
+
if (version !== undefined)
|
|
9
|
+
this.#versions.add(toLabel(version));
|
|
10
|
+
}
|
|
11
|
+
counts() {
|
|
12
|
+
return this.#versions.toCounts();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Counter } from '../../../../shared/counter.js';
|
|
2
|
+
import { toLabel } from '../../../../shared/label.js';
|
|
3
|
+
export class TopLevelKeyCollector {
|
|
4
|
+
#keys = new Counter();
|
|
5
|
+
collect({ json }) {
|
|
6
|
+
if (json === undefined)
|
|
7
|
+
return;
|
|
8
|
+
for (const key of Object.keys(json))
|
|
9
|
+
this.#keys.add(toLabel(key));
|
|
10
|
+
}
|
|
11
|
+
counts() {
|
|
12
|
+
return this.#keys.toCounts();
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { byString } from '../../../../shared/compare.js';
|
|
2
|
+
import { Counter } from '../../../../shared/counter.js';
|
|
3
|
+
import { toLabel } from '../../../../shared/label.js';
|
|
4
|
+
import { FIELDS } from '../../contract/fields.js';
|
|
5
|
+
import { classifyLineType } from '../../contract/line-types.js';
|
|
6
|
+
/** Top-level keys per unknown line type, so a new type is classified from what it carries instead of guessed. */
|
|
7
|
+
export class UnknownLineTypeKeyCollector {
|
|
8
|
+
#keysByType = new Map();
|
|
9
|
+
collect({ json }) {
|
|
10
|
+
if (json === undefined)
|
|
11
|
+
return;
|
|
12
|
+
const type = json[FIELDS.lineType];
|
|
13
|
+
if (classifyLineType(type) !== 'unknown')
|
|
14
|
+
return;
|
|
15
|
+
const label = toLabel(type);
|
|
16
|
+
const keys = this.#keysByType.get(label) ?? new Counter();
|
|
17
|
+
this.#keysByType.set(label, keys);
|
|
18
|
+
for (const key of Object.keys(json))
|
|
19
|
+
keys.add(toLabel(key));
|
|
20
|
+
}
|
|
21
|
+
keysByType() {
|
|
22
|
+
return Object.fromEntries([...this.#keysByType.entries()].sort(([a], [b]) => byString(a, b)).map(([type, keys]) => [type, keys.toCounts()]));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { FIELDS } from '../../contract/fields.js';
|
|
2
|
+
/**
|
|
3
|
+
* How many different working directories a session's lines carry - the number, never the directories. A `cwd` is
|
|
4
|
+
* a path from someone's machine, so it is content, and `doctor` reports counts and key names only (lesson L009).
|
|
5
|
+
* How many lines carry the field at all is already in `topLevelKeys`; this measures what that cannot.
|
|
6
|
+
*
|
|
7
|
+
* One value is the ordinary case, and it is the project root a report can make paths relative to. More than one
|
|
8
|
+
* means no single root describes the session, which is a variant nothing has measured yet - so it is reported
|
|
9
|
+
* rather than resolved by picking one.
|
|
10
|
+
*/
|
|
11
|
+
export class WorkingDirectoryCollector {
|
|
12
|
+
#values = new Set();
|
|
13
|
+
#invalid = 0;
|
|
14
|
+
collect({ json }) {
|
|
15
|
+
if (json === undefined)
|
|
16
|
+
return;
|
|
17
|
+
const value = json[FIELDS.workingDirectory];
|
|
18
|
+
if (value === undefined)
|
|
19
|
+
return;
|
|
20
|
+
if (typeof value === 'string')
|
|
21
|
+
this.#values.add(value);
|
|
22
|
+
else
|
|
23
|
+
this.#invalid += 1;
|
|
24
|
+
}
|
|
25
|
+
stats() {
|
|
26
|
+
return { distinct: this.#values.size, invalid: this.#invalid };
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { Counter } from '../../../shared/counter.js';
|
|
2
|
+
import { parseJsonObject } from '../../../shared/json.js';
|
|
3
|
+
import { toLabel } from '../../../shared/label.js';
|
|
4
|
+
import { META_FIELD } from '../contract/fields.js';
|
|
5
|
+
/** Statistics over the meta.json files of a session's subagents. */
|
|
6
|
+
export class MetaTally {
|
|
7
|
+
#files = 0;
|
|
8
|
+
#unreadableFiles = 0;
|
|
9
|
+
#unparsableFiles = 0;
|
|
10
|
+
#keys = new Counter();
|
|
11
|
+
#agentType = new Counter();
|
|
12
|
+
#spawnDepth = new Counter();
|
|
13
|
+
#requestShape = new Counter();
|
|
14
|
+
recordUnreadableFile() {
|
|
15
|
+
this.#files += 1;
|
|
16
|
+
this.#unreadableFiles += 1;
|
|
17
|
+
}
|
|
18
|
+
recordFile(text) {
|
|
19
|
+
this.#files += 1;
|
|
20
|
+
const meta = parseJsonObject(text);
|
|
21
|
+
if (meta === undefined) {
|
|
22
|
+
this.#unparsableFiles += 1;
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
for (const key of Object.keys(meta))
|
|
26
|
+
this.#keys.add(toLabel(key));
|
|
27
|
+
this.#agentType.add(toLabel(meta[META_FIELD.agentType]));
|
|
28
|
+
this.#spawnDepth.add(toLabel(meta[META_FIELD.spawnDepth]));
|
|
29
|
+
this.#requestShape.add(toLabel(meta[META_FIELD.requestShape]));
|
|
30
|
+
}
|
|
31
|
+
toStats() {
|
|
32
|
+
return {
|
|
33
|
+
files: this.#files,
|
|
34
|
+
unreadableFiles: this.#unreadableFiles,
|
|
35
|
+
unparsableFiles: this.#unparsableFiles,
|
|
36
|
+
keys: this.#keys.toCounts(),
|
|
37
|
+
agentType: this.#agentType.toCounts(),
|
|
38
|
+
spawnDepth: this.#spawnDepth.toCounts(),
|
|
39
|
+
requestShape: this.#requestShape.toCounts(),
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { AgentToolInputKeyCollector } from './collectors/agent-tool-input-key-collector.js';
|
|
2
|
+
import { DenialKindCollector } from './collectors/denial-kind-collector.js';
|
|
3
|
+
import { TaskNotificationCollector } from './collectors/task-notification-collector.js';
|
|
4
|
+
import { ToolResultReferenceCollector } from './collectors/tool-result-reference-collector.js';
|
|
5
|
+
import { ToolVersionCollector } from './collectors/tool-version-collector.js';
|
|
6
|
+
import { WorkingDirectoryCollector } from './collectors/working-directory-collector.js';
|
|
7
|
+
/** Measurements that span the whole session: every transcript, main and subagents alike, feeds the same collectors. */
|
|
8
|
+
export class SessionTally {
|
|
9
|
+
#toolVersions = new ToolVersionCollector();
|
|
10
|
+
#agentToolInputKeys = new AgentToolInputKeyCollector();
|
|
11
|
+
#denialKinds = new DenialKindCollector();
|
|
12
|
+
#toolResultReferences = new ToolResultReferenceCollector();
|
|
13
|
+
#workingDirectories = new WorkingDirectoryCollector();
|
|
14
|
+
#taskNotifications = new TaskNotificationCollector();
|
|
15
|
+
collectors = [
|
|
16
|
+
this.#toolVersions,
|
|
17
|
+
this.#agentToolInputKeys,
|
|
18
|
+
this.#denialKinds,
|
|
19
|
+
this.#toolResultReferences,
|
|
20
|
+
this.#workingDirectories,
|
|
21
|
+
this.#taskNotifications,
|
|
22
|
+
];
|
|
23
|
+
toolVersions() {
|
|
24
|
+
return this.#toolVersions.counts();
|
|
25
|
+
}
|
|
26
|
+
workingDirectories() {
|
|
27
|
+
return this.#workingDirectories.stats();
|
|
28
|
+
}
|
|
29
|
+
agentToolInputKeys() {
|
|
30
|
+
return this.#agentToolInputKeys.counts();
|
|
31
|
+
}
|
|
32
|
+
denials() {
|
|
33
|
+
return this.#denialKinds.stats();
|
|
34
|
+
}
|
|
35
|
+
taskNotifications() {
|
|
36
|
+
return this.#taskNotifications.stats();
|
|
37
|
+
}
|
|
38
|
+
toolResultReferences(availableFiles) {
|
|
39
|
+
return this.#toolResultReferences.stats(availableFiles);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { isJsonObject } from '../../../shared/json.js';
|
|
2
|
+
import { FIELDS, TEXT_BLOCK_TYPE, TOOL_RESULT_BLOCK_TYPE, TOOL_USE_BLOCK_TYPE } from '../contract/fields.js';
|
|
3
|
+
export function contentBlocks(line) {
|
|
4
|
+
const message = line[FIELDS.message];
|
|
5
|
+
const content = isJsonObject(message) ? message[FIELDS.messageContent] : undefined;
|
|
6
|
+
return Array.isArray(content) ? content.filter(isJsonObject) : [];
|
|
7
|
+
}
|
|
8
|
+
export function toolUseBlocks(line) {
|
|
9
|
+
return contentBlocks(line).filter((block) => block[FIELDS.blockType] === TOOL_USE_BLOCK_TYPE);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* The words on a line that holds no tool result - its content as a string, or the text of its text blocks - where a
|
|
13
|
+
* report delivered late is written. Undefined for a line carrying a result, or no words.
|
|
14
|
+
*/
|
|
15
|
+
export function wordsWithoutResult(line) {
|
|
16
|
+
const message = line[FIELDS.message];
|
|
17
|
+
const content = isJsonObject(message) ? message[FIELDS.messageContent] : undefined;
|
|
18
|
+
if (typeof content === 'string')
|
|
19
|
+
return content;
|
|
20
|
+
if (!Array.isArray(content))
|
|
21
|
+
return undefined;
|
|
22
|
+
const blocks = content.filter(isJsonObject);
|
|
23
|
+
if (blocks.some((block) => block[FIELDS.blockType] === TOOL_RESULT_BLOCK_TYPE))
|
|
24
|
+
return undefined;
|
|
25
|
+
const words = blocks
|
|
26
|
+
.filter((block) => block[FIELDS.blockType] === TEXT_BLOCK_TYPE)
|
|
27
|
+
.map((block) => block[FIELDS.blockText])
|
|
28
|
+
.filter((text) => typeof text === 'string');
|
|
29
|
+
return words.length === 0 ? undefined : words.join('\n');
|
|
30
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { parseJsonObject } from '../../../shared/json.js';
|
|
2
|
+
import { DeniedCallCollector } from './collectors/denied-call-collector.js';
|
|
3
|
+
import { IdentifierCollector } from './collectors/identifier-collector.js';
|
|
4
|
+
import { LineTypeCollector } from './collectors/line-type-collector.js';
|
|
5
|
+
import { SidechainCollector } from './collectors/sidechain-collector.js';
|
|
6
|
+
import { ToolUseCollector } from './collectors/tool-use-collector.js';
|
|
7
|
+
import { TopLevelKeyCollector } from './collectors/top-level-key-collector.js';
|
|
8
|
+
import { UnknownLineTypeKeyCollector } from './collectors/unknown-line-type-key-collector.js';
|
|
9
|
+
/**
|
|
10
|
+
* Statistics for one group of transcripts (main session or subagents). Composed of collectors: its own, which
|
|
11
|
+
* measure this group, and the session's, which measure across groups.
|
|
12
|
+
*/
|
|
13
|
+
export class TranscriptTally {
|
|
14
|
+
#files = 0;
|
|
15
|
+
#unreadableFiles = 0;
|
|
16
|
+
#lines = 0;
|
|
17
|
+
#unparsableLines = 0;
|
|
18
|
+
#identifiers = new IdentifierCollector();
|
|
19
|
+
#topLevelKeys = new TopLevelKeyCollector();
|
|
20
|
+
#lineTypes = new LineTypeCollector();
|
|
21
|
+
#unknownLineTypeKeys = new UnknownLineTypeKeyCollector();
|
|
22
|
+
#sidechain = new SidechainCollector();
|
|
23
|
+
#toolUses = new ToolUseCollector();
|
|
24
|
+
#deniedCalls = new DeniedCallCollector();
|
|
25
|
+
#collectors;
|
|
26
|
+
constructor(sessionCollectors) {
|
|
27
|
+
this.#collectors = [
|
|
28
|
+
this.#identifiers,
|
|
29
|
+
this.#topLevelKeys,
|
|
30
|
+
this.#lineTypes,
|
|
31
|
+
this.#unknownLineTypeKeys,
|
|
32
|
+
this.#sidechain,
|
|
33
|
+
this.#toolUses,
|
|
34
|
+
this.#deniedCalls,
|
|
35
|
+
...sessionCollectors,
|
|
36
|
+
];
|
|
37
|
+
}
|
|
38
|
+
recordFile() {
|
|
39
|
+
this.#files += 1;
|
|
40
|
+
}
|
|
41
|
+
recordUnreadableFile() {
|
|
42
|
+
this.#unreadableFiles += 1;
|
|
43
|
+
}
|
|
44
|
+
recordLine(raw) {
|
|
45
|
+
if (raw.trim() === '')
|
|
46
|
+
return;
|
|
47
|
+
this.#lines += 1;
|
|
48
|
+
const json = parseJsonObject(raw);
|
|
49
|
+
if (json === undefined)
|
|
50
|
+
this.#unparsableLines += 1;
|
|
51
|
+
const line = { raw, json };
|
|
52
|
+
for (const collector of this.#collectors)
|
|
53
|
+
collector.collect(line);
|
|
54
|
+
}
|
|
55
|
+
toStats() {
|
|
56
|
+
return {
|
|
57
|
+
files: this.#files,
|
|
58
|
+
unreadableFiles: this.#unreadableFiles,
|
|
59
|
+
lines: this.#lines,
|
|
60
|
+
unparsableLines: this.#unparsableLines,
|
|
61
|
+
lineTypes: this.#lineTypes.lineTypes(),
|
|
62
|
+
unknownLineTypes: this.#lineTypes.unknownLineTypes(),
|
|
63
|
+
unknownLineTypeKeys: this.#unknownLineTypeKeys.keysByType(),
|
|
64
|
+
topLevelKeys: this.#topLevelKeys.counts(),
|
|
65
|
+
sidechain: this.#sidechain.stats(),
|
|
66
|
+
systemSubtypes: this.#lineTypes.systemSubtypes(),
|
|
67
|
+
tools: this.#toolUses.tools(),
|
|
68
|
+
agentToolUses: this.#toolUses.agentToolUses(),
|
|
69
|
+
deniedCalls: this.#deniedCalls.deniedCalls(),
|
|
70
|
+
uniqueToolUseIds: this.#identifiers.uniqueToolUseIds(),
|
|
71
|
+
uniqueUuids: this.#identifiers.uniqueUuids(),
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { fileRulePathOf } from '../policy/deny-rules.js';
|
|
2
|
+
import { isJsonObject } from '../../../shared/json.js';
|
|
3
|
+
import { PERMISSIONS } from '../contract/settings.js';
|
|
4
|
+
/**
|
|
5
|
+
* The tools a path is denied for. `Read` and `Edit` are what a deny rule can name about a file and what this project
|
|
6
|
+
* already reads back as a policy; `Bash(...)` is a command pattern, not a path, and `init` writes none (test A7).
|
|
7
|
+
*/
|
|
8
|
+
const TOOLS = ['Read', 'Edit'];
|
|
9
|
+
/** The deny entries a pattern becomes, in the order they are written. */
|
|
10
|
+
export function denyEntriesFor(pattern) {
|
|
11
|
+
return TOOLS.map((tool) => `${tool}(${pattern})`);
|
|
12
|
+
}
|
|
13
|
+
/** Every deny entry a settings object holds, in the order written; empty when it holds no deny list. */
|
|
14
|
+
export function denyEntriesIn(settings) {
|
|
15
|
+
const permissions = settings[PERMISSIONS.permissions];
|
|
16
|
+
const deny = isJsonObject(permissions) ? permissions[PERMISSIONS.deny] : undefined;
|
|
17
|
+
return Array.isArray(deny) ? deny.filter((entry) => typeof entry === 'string') : [];
|
|
18
|
+
}
|
|
19
|
+
/** Of those, the ones that name a file - what a hook reads as a policy, and what R4d copies. */
|
|
20
|
+
export function fileRulesIn(settings) {
|
|
21
|
+
return denyEntriesIn(settings).filter((entry) => fileRulePathOf(entry) !== undefined);
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The settings with these deny entries added, in order, skipping any that is already there
|
|
25
|
+
* (`specs/2026-09-16-worth-running-every-day.md` R4c). Every other key, and every rule someone else wrote, stays as it
|
|
26
|
+
* was: `init` adds, and never edits or removes a rule of its own accord.
|
|
27
|
+
*/
|
|
28
|
+
export function withDenyEntries(settings, entries) {
|
|
29
|
+
const held = new Set(denyEntriesIn(settings));
|
|
30
|
+
// Deduplicated against what is there and within what is being added: a rule written twice reads as two rules.
|
|
31
|
+
const added = [...new Set(entries)].filter((entry) => !held.has(entry));
|
|
32
|
+
if (added.length === 0)
|
|
33
|
+
return settings;
|
|
34
|
+
const permissions = isJsonObject(settings[PERMISSIONS.permissions]) ? { ...settings[PERMISSIONS.permissions] } : {};
|
|
35
|
+
return {
|
|
36
|
+
...settings,
|
|
37
|
+
[PERMISSIONS.permissions]: { ...permissions, [PERMISSIONS.deny]: [...denyEntriesIn(settings), ...added] },
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* The settings without these deny entries (`specs/2026-09-16-worth-running-every-day.md` R26): an empty deny list is
|
|
42
|
+
* dropped, and `permissions` left with nothing in it is dropped too, so undoing leaves the file as it was found.
|
|
43
|
+
*/
|
|
44
|
+
export function withoutDenyEntries(settings, entries) {
|
|
45
|
+
const taking = new Set(entries);
|
|
46
|
+
const held = denyEntriesIn(settings);
|
|
47
|
+
const kept = held.filter((entry) => !taking.has(entry));
|
|
48
|
+
if (kept.length === held.length)
|
|
49
|
+
return { settings, removed: 0 };
|
|
50
|
+
const permissions = isJsonObject(settings[PERMISSIONS.permissions]) ? { ...settings[PERMISSIONS.permissions] } : {};
|
|
51
|
+
if (kept.length > 0) {
|
|
52
|
+
return { settings: { ...settings, [PERMISSIONS.permissions]: { ...permissions, [PERMISSIONS.deny]: kept } }, removed: held.length - kept.length };
|
|
53
|
+
}
|
|
54
|
+
const { [PERMISSIONS.deny]: _dropped, ...rest } = permissions;
|
|
55
|
+
const { [PERMISSIONS.permissions]: _also, ...outside } = settings;
|
|
56
|
+
return {
|
|
57
|
+
settings: Object.keys(rest).length === 0 ? outside : { ...outside, [PERMISSIONS.permissions]: rest },
|
|
58
|
+
removed: held.length,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/** Whether a pattern is already denied for every tool `init` would write it for. */
|
|
62
|
+
export function isDenied(settings, pattern) {
|
|
63
|
+
const held = new Set(denyEntriesIn(settings));
|
|
64
|
+
return denyEntriesFor(pattern).every((entry) => held.has(entry));
|
|
65
|
+
}
|