@hassangameryt/freeflow 0.3.0 → 0.5.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/.claude-plugin/marketplace.json +4 -4
- package/.claude-plugin/plugin.json +6 -2
- package/.codex-plugin/plugin.json +9 -9
- package/README.md +190 -127
- package/assets/feedback-loop.png +0 -0
- package/assets/freeflow_workflow_map.png +0 -0
- package/assets/workflow.png +0 -0
- package/{skills → capabilities}/output-router/SKILL.md +21 -17
- package/{skills → capabilities}/output-router/references/safety-policy.md +1 -1
- package/capabilities/output-router/references/setup.md +110 -0
- package/command-surface.json +62 -7
- package/hooks/freeflow-runtime-context.mjs +572 -154
- package/hooks/hooks.json +26 -1
- package/hooks/tests/check-runtime-context-hook.sh +375 -0
- package/package.json +24 -24
- package/pi-extension/dist/index.js +264 -80
- package/pi-extension/dist/integrations/mcp-config.js +29 -0
- package/pi-extension/dist/output-router/host-producer-identification.js +232 -0
- package/pi-extension/dist/output-router/native-safety-net.js +216 -0
- package/pi-extension/dist/output-router/observed-tool-routing.js +122 -0
- package/pi-extension/dist/output-router/renderers.js +1023 -0
- package/pi-extension/dist/output-router/router-tools.js +554 -0
- package/pi-extension/dist/output-router/schemas.js +383 -0
- package/pi-extension/dist/output-router/status.js +744 -0
- package/pi-extension/dist/output-router/utils.js +502 -0
- package/pi-extension/dist/runtime/runtime-context.js +798 -0
- package/pi-extension/dist/settings/settings-tui.js +314 -0
- package/pi-extension/dist/settings/settings-ui.js +1487 -0
- package/pi-extension/freeflow/index.js +1 -0
- package/pi-extension/src/index.ts +230 -56
- package/pi-extension/src/{host-producer-identification.ts → output-router/host-producer-identification.ts} +37 -7
- package/pi-extension/src/{native-safety-net.ts → output-router/native-safety-net.ts} +8 -12
- package/pi-extension/src/{observed-tool-routing.ts → output-router/observed-tool-routing.ts} +19 -11
- package/pi-extension/src/{renderers.ts → output-router/renderers.ts} +246 -55
- package/pi-extension/src/{router-tools.ts → output-router/router-tools.ts} +130 -29
- package/pi-extension/src/{schemas.ts → output-router/schemas.ts} +171 -43
- package/pi-extension/src/output-router/status.ts +791 -0
- package/pi-extension/src/{utils.ts → output-router/utils.ts} +80 -18
- package/pi-extension/src/runtime/runtime-context.ts +895 -0
- package/pi-extension/src/settings/settings-tui.ts +408 -0
- package/pi-extension/src/settings/settings-ui.ts +1730 -0
- package/pi-extension/tests/integration/pi-extension.test.js +4020 -0
- package/pi-extension/tests/output-router/observed-producers.test.js +132 -0
- package/pi-extension/tests/output-router/search.test.js +722 -0
- package/pi-extension/tests/settings/settings-tui.test.js +243 -0
- package/router/dist/benchmarks/benchmark-harness.d.ts +16 -13
- package/router/dist/benchmarks/benchmark-harness.js +62 -62
- package/router/dist/benchmarks/benchmarks.d.ts +80 -73
- package/router/dist/benchmarks/benchmarks.js +860 -761
- package/router/dist/benchmarks/codex-qa-benchmarks.d.ts +71 -67
- package/router/dist/benchmarks/codex-qa-benchmarks.js +429 -390
- package/router/dist/benchmarks/command-benchmarks.d.ts +107 -92
- package/router/dist/benchmarks/command-benchmarks.js +616 -571
- package/router/dist/benchmarks/context-mode-normalized-benchmarks.d.ts +64 -56
- package/router/dist/benchmarks/context-mode-normalized-benchmarks.js +679 -613
- package/router/dist/benchmarks/context-mode-real-deep-benchmark.d.ts +103 -95
- package/router/dist/benchmarks/context-mode-real-deep-benchmark.js +1188 -1103
- package/router/dist/benchmarks/context-saving-baseline.d.ts +47 -41
- package/router/dist/benchmarks/context-saving-baseline.js +405 -374
- package/router/dist/benchmarks/index-benchmarks.d.ts +74 -69
- package/router/dist/benchmarks/index-benchmarks.js +761 -661
- package/router/dist/benchmarks/storage-policy-benchmarks.d.ts +80 -69
- package/router/dist/benchmarks/storage-policy-benchmarks.js +549 -469
- package/router/dist/benchmarks/vault-index-benchmarks.d.ts +43 -34
- package/router/dist/benchmarks/vault-index-benchmarks.js +294 -229
- package/router/dist/config/config.d.ts +62 -55
- package/router/dist/config/config.js +552 -373
- package/router/dist/config/router-contract.d.ts +2 -2
- package/router/dist/config/router-contract.js +38 -38
- package/router/dist/config/schema.d.ts +19 -10
- package/router/dist/config/schema.js +586 -538
- package/router/dist/config/types.d.ts +413 -361
- package/router/dist/config/types.js +19 -8
- package/router/dist/evidence/bounded-evidence.d.ts +26 -26
- package/router/dist/evidence/bounded-evidence.js +265 -252
- package/router/dist/evidence/evidence-range-selector.d.ts +16 -14
- package/router/dist/evidence/evidence-range-selector.js +192 -191
- package/router/dist/evidence/evidence-search.d.ts +18 -16
- package/router/dist/evidence/evidence-search.js +401 -377
- package/router/dist/evidence/evidence.d.ts +17 -17
- package/router/dist/evidence/evidence.js +163 -159
- package/router/dist/evidence/failure-contracts.d.ts +25 -15
- package/router/dist/evidence/failure-contracts.js +132 -126
- package/router/dist/evidence/line-ranges.d.ts +17 -15
- package/router/dist/evidence/line-ranges.js +18 -18
- package/router/dist/experiments/local-index.d.ts +47 -41
- package/router/dist/experiments/local-index.js +477 -458
- package/router/dist/local/local-traversal.d.ts +18 -0
- package/router/dist/local/local-traversal.js +334 -0
- package/router/dist/processing/engine.d.ts +94 -70
- package/router/dist/processing/engine.js +462 -364
- package/router/dist/processing/reducers.d.ts +208 -194
- package/router/dist/processing/reducers.js +1434 -1256
- package/router/dist/processing/renderers.d.ts +24 -18
- package/router/dist/processing/renderers.js +161 -152
- package/router/dist/processing/scripts.d.ts +80 -67
- package/router/dist/processing/scripts.js +343 -290
- package/router/dist/repo/repo-traversal.d.ts +9 -9
- package/router/dist/repo/repo-traversal.js +205 -202
- package/router/dist/routing/observed-reducers.d.ts +25 -19
- package/router/dist/routing/observed-reducers.js +559 -545
- package/router/dist/routing/observed-routing.d.ts +23 -14
- package/router/dist/routing/observed-routing.js +319 -318
- package/router/dist/routing/parsers.d.ts +10 -10
- package/router/dist/routing/parsers.js +454 -406
- package/router/dist/routing/run-filters.d.ts +45 -41
- package/router/dist/routing/run-filters.js +215 -207
- package/router/dist/routing/run-reducers.d.ts +45 -26
- package/router/dist/routing/run-reducers.js +102 -90
- package/router/dist/sandbox/adapter-roots.d.ts +34 -26
- package/router/dist/sandbox/adapter-roots.js +43 -41
- package/router/dist/sandbox/eryx-python-adapter.d.ts +9 -5
- package/router/dist/sandbox/eryx-python-adapter.js +659 -588
- package/router/dist/sandbox/jq-wasm-adapter.d.ts +3 -3
- package/router/dist/sandbox/jq-wasm-adapter.js +319 -311
- package/router/dist/sandbox/quickjs-wasi-adapter.d.ts +9 -5
- package/router/dist/sandbox/quickjs-wasi-adapter.js +336 -333
- package/router/dist/sandbox/script-sandbox.d.ts +105 -84
- package/router/dist/sandbox/script-sandbox.js +294 -260
- package/router/dist/setup/script-transform-adapters.d.ts +23 -19
- package/router/dist/setup/script-transform-adapters.js +223 -204
- package/router/dist/tools/batch.d.ts +27 -16
- package/router/dist/tools/batch.js +493 -416
- package/router/dist/tools/run.d.ts +47 -35
- package/router/dist/tools/run.js +1172 -1087
- package/router/dist/tools/search.d.ts +53 -31
- package/router/dist/tools/search.js +1224 -1065
- package/router/dist/transform/engine.d.ts +121 -96
- package/router/dist/transform/engine.js +1853 -1736
- package/router/dist/vault/vault-index.d.ts +97 -78
- package/router/dist/vault/vault-index.js +347 -342
- package/router/dist/vault/vault.d.ts +109 -74
- package/router/dist/vault/vault.js +528 -533
- package/runtime/interaction-contract.md +16 -0
- package/skills/bypass/SKILL.md +52 -38
- package/skills/commit-work/SKILL.md +54 -46
- package/skills/commit-work/references/staging-decisions.md +46 -24
- package/skills/decision-gate/SKILL.md +48 -0
- package/skills/design-for-depth/SKILL.md +75 -59
- package/skills/design-for-depth/references/design-pressure-signals.md +56 -7
- package/skills/design-for-depth/references/interface-design-loop.md +156 -0
- package/skills/design-for-depth/references/software-design-philosophy.md +32 -3
- package/skills/diagnose-failure/SKILL.md +65 -60
- package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +36 -0
- package/skills/diagnose-failure/references/flaky-and-performance.md +30 -18
- package/skills/discuss/SKILL.md +121 -0
- package/skills/discuss/references/checkpoints.md +66 -0
- package/skills/evaluate-skill/SKILL.md +62 -53
- package/skills/evaluate-skill/references/definition-schema.md +345 -0
- package/skills/evaluate-skill/references/evaluation-design.md +86 -0
- package/skills/evaluate-skill/references/execution-and-evidence.md +85 -0
- package/skills/evaluate-skill/references/review-and-revision.md +51 -0
- package/skills/evaluate-skill/scripts/lib/definitions.mjs +296 -0
- package/skills/evaluate-skill/scripts/lib/evidence.mjs +46 -0
- package/skills/evaluate-skill/scripts/lib/grade-comparison.mjs +60 -0
- package/skills/evaluate-skill/scripts/lib/grade-interaction.mjs +148 -0
- package/skills/evaluate-skill/scripts/lib/grade-support.mjs +126 -0
- package/skills/evaluate-skill/scripts/lib/grade-workspace.mjs +192 -0
- package/skills/evaluate-skill/scripts/lib/grade.mjs +56 -0
- package/skills/evaluate-skill/scripts/lib/pi.mjs +489 -0
- package/skills/evaluate-skill/scripts/lib/process.mjs +79 -0
- package/skills/evaluate-skill/scripts/lib/rpc.mjs +444 -0
- package/skills/evaluate-skill/scripts/lib/runner.mjs +346 -0
- package/skills/evaluate-skill/scripts/lib/sandbox.mjs +409 -0
- package/skills/evaluate-skill/scripts/lib/view.mjs +337 -0
- package/skills/evaluate-skill/scripts/pi-guard.mjs +164 -0
- package/skills/evaluate-skill/scripts/skill-eval.mjs +101 -0
- package/skills/execute-work/SKILL.md +99 -0
- package/skills/execute-work/references/code-practices.md +78 -0
- package/skills/execute-work/references/execution-loop.md +77 -0
- package/skills/finish-branch/SKILL.md +117 -0
- package/skills/finish-branch/references/integration-options.md +80 -0
- package/skills/handoff/SKILL.md +65 -39
- package/skills/handoff/references/templates.md +104 -27
- package/skills/launch-work/SKILL.md +116 -0
- package/skills/launch-work/references/launch-readiness.md +85 -0
- package/skills/migration-work/SKILL.md +115 -0
- package/skills/migration-work/references/migration-lifecycle.md +82 -0
- package/skills/mode-contract/SKILL.md +72 -52
- package/skills/release-work/SKILL.md +118 -0
- package/skills/release-work/references/release-evidence.md +78 -0
- package/skills/review-artifact/SKILL.md +77 -69
- package/skills/review-artifact/references/reviewer-prompt.md +133 -42
- package/skills/review-work/SKILL.md +82 -57
- package/skills/review-work/references/reviewer-prompt.md +97 -60
- package/skills/review-work/references/security-risk-lens.md +67 -0
- package/skills/setup-freeflow/SKILL.md +54 -68
- package/skills/setup-freeflow/references/activation-contract.md +84 -69
- package/skills/setup-freeflow/references/host-setup.md +50 -17
- package/skills/simplify-code/SKILL.md +80 -0
- package/skills/simplify-code/references/simplification-patterns.md +70 -0
- package/skills/tdd/SKILL.md +96 -0
- package/skills/tdd/references/test-design.md +96 -0
- package/skills/track-work/SKILL.md +84 -0
- package/skills/track-work/references/working-record-schema.md +378 -0
- package/skills/verify-work/SKILL.md +59 -38
- package/skills/verify-work/references/browser-runtime-evidence.md +55 -0
- package/skills/verify-work/references/integration-evidence.md +51 -0
- package/skills/verify-work/references/performance-evidence.md +57 -0
- package/skills/workflow/SKILL.md +53 -59
- package/skills/workflow/references/domain-skill-composition.md +57 -0
- package/skills/workflow/references/workflow-loop.md +92 -0
- package/skills/write-plan/SKILL.md +85 -58
- package/skills/write-plan/references/plan-shapes.md +132 -46
- package/skills/write-skill/SKILL.md +82 -51
- package/skills/write-skill/references/activation-boundaries.md +62 -0
- package/skills/write-skill/references/agent-first-instructions.md +87 -0
- package/skills/write-skill/references/progressive-disclosure.md +63 -0
- package/skills/write-skill/scripts/lib/skill-author.mjs +653 -0
- package/skills/write-skill/scripts/skill-author.mjs +104 -0
- package/skills/write-spec/SKILL.md +65 -54
- package/skills/write-spec/references/artifact-standards.md +60 -41
- package/skills/write-spec/references/decision-records.md +77 -0
- package/skills/write-spec/references/spec-shapes.md +119 -60
- package/evals/README.md +0 -32
- package/evals/fixtures/copy-conventions.md +0 -31
- package/evals/fixtures/output-router/README.md +0 -12
- package/evals/fixtures/output-router/failed-command-output.txt +0 -9
- package/evals/fixtures/output-router/large-router-manual.md +0 -63
- package/evals/fixtures/output-router/native-large-output.txt +0 -40
- package/evals/fixtures/output-router/noisy-test-output.txt +0 -30
- package/evals/fixtures/output-router/verification-output.txt +0 -8
- package/evals/fixtures/tiny-artifact-review-app/README.md +0 -5
- package/evals/fixtures/tiny-artifact-review-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-artifact-review-app/docs/specs/billing-webhook-api-draft.md +0 -21
- package/evals/fixtures/tiny-artifact-review-app/docs/specs/failed-payment-grace-period.md +0 -24
- package/evals/fixtures/tiny-artifact-review-app/docs/specs/immediate-downgrade.md +0 -17
- package/evals/fixtures/tiny-artifact-review-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-commit-ambiguous-app/.freeflow-eval-setup.sh +0 -15
- package/evals/fixtures/tiny-commit-ambiguous-app/README.md +0 -3
- package/evals/fixtures/tiny-commit-ambiguous-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-commit-ambiguous-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-commit-ambiguous-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-commit-app/.freeflow-eval-setup.sh +0 -14
- package/evals/fixtures/tiny-commit-app/README.md +0 -3
- package/evals/fixtures/tiny-commit-app/docs/specs/settings-title.md +0 -5
- package/evals/fixtures/tiny-commit-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-commit-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-commit-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-commit-everything-app/.freeflow-eval-setup.sh +0 -15
- package/evals/fixtures/tiny-commit-everything-app/README.md +0 -3
- package/evals/fixtures/tiny-commit-everything-app/docs/specs/settings-title.md +0 -5
- package/evals/fixtures/tiny-commit-everything-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-commit-everything-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-commit-everything-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-commit-staged-app/.freeflow-eval-setup.sh +0 -15
- package/evals/fixtures/tiny-commit-staged-app/README.md +0 -3
- package/evals/fixtures/tiny-commit-staged-app/docs/specs/settings-title.md +0 -5
- package/evals/fixtures/tiny-commit-staged-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-commit-staged-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-commit-staged-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-commit-staged-mixed-app/.freeflow-eval-setup.sh +0 -15
- package/evals/fixtures/tiny-commit-staged-mixed-app/README.md +0 -3
- package/evals/fixtures/tiny-commit-staged-mixed-app/docs/billing-policy.md +0 -3
- package/evals/fixtures/tiny-commit-staged-mixed-app/docs/release-notes.md +0 -3
- package/evals/fixtures/tiny-commit-staged-mixed-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-dashboard-stale-app/README.md +0 -11
- package/evals/fixtures/tiny-dashboard-stale-app/src/api-client.ts +0 -13
- package/evals/fixtures/tiny-dashboard-stale-app/src/dashboard-data.ts +0 -19
- package/evals/fixtures/tiny-dashboard-stale-app/tests/dashboard-data.test.md +0 -9
- package/evals/fixtures/tiny-decision-destination-app/README.md +0 -6
- package/evals/fixtures/tiny-decision-destination-app/src/risk.ts +0 -8
- package/evals/fixtures/tiny-decision-destination-app/tests/risk.test.md +0 -4
- package/evals/fixtures/tiny-design-depth-app/README.md +0 -15
- package/evals/fixtures/tiny-design-depth-app/src/routes.ts +0 -25
- package/evals/fixtures/tiny-design-depth-app/src/sendEmail.ts +0 -3
- package/evals/fixtures/tiny-design-depth-app/src/sendSms.ts +0 -3
- package/evals/fixtures/tiny-design-depth-app/src/telemetry.ts +0 -3
- package/evals/fixtures/tiny-design-depth-app/tests/routes.test.md +0 -12
- package/evals/fixtures/tiny-eval-method-app/README.md +0 -8
- package/evals/fixtures/tiny-eval-method-app/evals/reports/review-pr-eval-result.md +0 -5
- package/evals/fixtures/tiny-eval-method-app/evals/reports/triage-question-failure.md +0 -17
- package/evals/fixtures/tiny-eval-method-app/evals/runs/review-pr-with-skill-output.diff +0 -11
- package/evals/fixtures/tiny-eval-method-app/evals/runs/review-pr-with-skill-output.md +0 -3
- package/evals/fixtures/tiny-eval-method-app/skills/review-pr/SKILL.md +0 -10
- package/evals/fixtures/tiny-eval-method-app/skills/triage-question/SKILL.md +0 -10
- package/evals/fixtures/tiny-execute-plan-app/README.md +0 -5
- package/evals/fixtures/tiny-execute-plan-app/checks/settings-and-billing-check.sh +0 -5
- package/evals/fixtures/tiny-execute-plan-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-execute-plan-app/docs/plans/immediate-downgrade-plan.md +0 -11
- package/evals/fixtures/tiny-execute-plan-app/docs/plans/settings-title-plan.md +0 -12
- package/evals/fixtures/tiny-execute-plan-app/docs/plans/settings-title-with-bad-check.md +0 -15
- package/evals/fixtures/tiny-execute-plan-app/docs/plans/unverified-billing-plan.md +0 -9
- package/evals/fixtures/tiny-execute-plan-app/docs/specs/failed-payment-grace-period.md +0 -9
- package/evals/fixtures/tiny-execute-plan-app/docs/specs/settings-title.md +0 -9
- package/evals/fixtures/tiny-execute-plan-app/src/billing.ts +0 -7
- package/evals/fixtures/tiny-execute-plan-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-execute-plan-app/tests/billing.test.md +0 -7
- package/evals/fixtures/tiny-execute-plan-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-execute-review-loop-app/README.md +0 -5
- package/evals/fixtures/tiny-execute-review-loop-app/docs/billing-policy.md +0 -9
- package/evals/fixtures/tiny-execute-review-loop-app/docs/plans/settings-title-plan.md +0 -12
- package/evals/fixtures/tiny-execute-review-loop-app/docs/review/previous-agent-summary.md +0 -15
- package/evals/fixtures/tiny-execute-review-loop-app/docs/review/review-pass-1-non-pass.md +0 -11
- package/evals/fixtures/tiny-execute-review-loop-app/docs/specs/settings-title.md +0 -9
- package/evals/fixtures/tiny-execute-review-loop-app/src/billing.ts +0 -7
- package/evals/fixtures/tiny-execute-review-loop-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-execute-review-loop-app/tests/billing.test.md +0 -7
- package/evals/fixtures/tiny-execute-review-loop-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-flaky-session-app/README.md +0 -10
- package/evals/fixtures/tiny-flaky-session-app/src/session-timeout.ts +0 -13
- package/evals/fixtures/tiny-flaky-session-app/tests/session-timeout.test.md +0 -8
- package/evals/fixtures/tiny-handoff-app/README.md +0 -5
- package/evals/fixtures/tiny-handoff-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-handoff-app/docs/handoffs/old-agent-handoff.md +0 -8
- package/evals/fixtures/tiny-handoff-app/docs/plans/billing-retry-plan.md +0 -11
- package/evals/fixtures/tiny-handoff-app/src/billing.ts +0 -7
- package/evals/fixtures/tiny-handoff-report-app/README.md +0 -3
- package/evals/fixtures/tiny-handoff-report-app/evals/runs/handoff-3/hof-003/with-skill-output.diff +0 -1
- package/evals/fixtures/tiny-handoff-report-app/evals/runs/handoff-3/hof-003/with-skill-output.md +0 -1
- package/evals/fixtures/tiny-handoff-report-app/evals/scores/hof-003-score.txt +0 -4
- package/evals/fixtures/tiny-plan-app/README.md +0 -5
- package/evals/fixtures/tiny-plan-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-plan-app/docs/specs/failed-payment-grace-period.md +0 -25
- package/evals/fixtures/tiny-plan-app/src/billing.ts +0 -17
- package/evals/fixtures/tiny-plan-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-plan-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-plan-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-plan-strict-api-app/README.md +0 -3
- package/evals/fixtures/tiny-plan-strict-api-app/docs/billing-policy.md +0 -5
- package/evals/fixtures/tiny-plan-strict-api-app/docs/specs/billing-webhook-api.md +0 -25
- package/evals/fixtures/tiny-plan-strict-api-app/src/billing.ts +0 -5
- package/evals/fixtures/tiny-plan-strict-api-app/src/webhooks.ts +0 -3
- package/evals/fixtures/tiny-plan-strict-api-app/tests/billing-webhook.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-invalid-config-app/.freeflow/config.json +0 -3
- package/evals/fixtures/tiny-post-setup-invalid-config-app/AGENTS.md +0 -15
- package/evals/fixtures/tiny-post-setup-invalid-config-app/README.md +0 -16
- package/evals/fixtures/tiny-post-setup-invalid-config-app/docs/auth-review.md +0 -15
- package/evals/fixtures/tiny-post-setup-invalid-config-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-post-setup-invalid-config-app/docs/copy-conventions.md +0 -15
- package/evals/fixtures/tiny-post-setup-invalid-config-app/src/auth-middleware.ts +0 -12
- package/evals/fixtures/tiny-post-setup-invalid-config-app/src/billing.ts +0 -20
- package/evals/fixtures/tiny-post-setup-invalid-config-app/src/login-copy.ts +0 -1
- package/evals/fixtures/tiny-post-setup-invalid-config-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-post-setup-invalid-config-app/tests/auth-middleware.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-invalid-config-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-invalid-config-app/tests/copy.test.md +0 -7
- package/evals/fixtures/tiny-post-setup-missing-config-app/AGENTS.md +0 -15
- package/evals/fixtures/tiny-post-setup-missing-config-app/README.md +0 -16
- package/evals/fixtures/tiny-post-setup-missing-config-app/docs/auth-review.md +0 -15
- package/evals/fixtures/tiny-post-setup-missing-config-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-post-setup-missing-config-app/docs/copy-conventions.md +0 -15
- package/evals/fixtures/tiny-post-setup-missing-config-app/src/auth-middleware.ts +0 -12
- package/evals/fixtures/tiny-post-setup-missing-config-app/src/billing.ts +0 -20
- package/evals/fixtures/tiny-post-setup-missing-config-app/src/login-copy.ts +0 -1
- package/evals/fixtures/tiny-post-setup-missing-config-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-post-setup-missing-config-app/tests/auth-middleware.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-missing-config-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-missing-config-app/tests/copy.test.md +0 -7
- package/evals/fixtures/tiny-post-setup-source-conflict-app/.freeflow/config.json +0 -3
- package/evals/fixtures/tiny-post-setup-source-conflict-app/AGENTS.md +0 -15
- package/evals/fixtures/tiny-post-setup-source-conflict-app/README.md +0 -16
- package/evals/fixtures/tiny-post-setup-source-conflict-app/docs/auth-review.md +0 -15
- package/evals/fixtures/tiny-post-setup-source-conflict-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-post-setup-source-conflict-app/docs/copy-conventions.md +0 -15
- package/evals/fixtures/tiny-post-setup-source-conflict-app/src/auth-middleware.ts +0 -12
- package/evals/fixtures/tiny-post-setup-source-conflict-app/src/billing.ts +0 -20
- package/evals/fixtures/tiny-post-setup-source-conflict-app/src/login-copy.ts +0 -1
- package/evals/fixtures/tiny-post-setup-source-conflict-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-post-setup-source-conflict-app/tests/auth-middleware.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-source-conflict-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-post-setup-source-conflict-app/tests/copy.test.md +0 -7
- package/evals/fixtures/tiny-report-performance-app/README.md +0 -11
- package/evals/fixtures/tiny-report-performance-app/docs/performance.md +0 -10
- package/evals/fixtures/tiny-report-performance-app/src/report-summary.ts +0 -29
- package/evals/fixtures/tiny-report-performance-app/tests/report-performance.test.md +0 -8
- package/evals/fixtures/tiny-review-request-app/README.md +0 -3
- package/evals/fixtures/tiny-review-request-app/docs/billing-policy.md +0 -5
- package/evals/fixtures/tiny-review-request-app/docs/plans/billing-webhook-api.md +0 -19
- package/evals/fixtures/tiny-review-request-app/docs/review/previous-agent-summary.md +0 -20
- package/evals/fixtures/tiny-review-request-app/docs/specs/billing-webhook-api.md +0 -25
- package/evals/fixtures/tiny-review-request-app/src/billing.ts +0 -11
- package/evals/fixtures/tiny-review-request-app/src/webhooks.ts +0 -19
- package/evals/fixtures/tiny-review-request-app/tests/billing-webhook.test.md +0 -8
- package/evals/fixtures/tiny-review-work-app/README.md +0 -5
- package/evals/fixtures/tiny-review-work-app/docs/billing-policy.md +0 -9
- package/evals/fixtures/tiny-review-work-app/docs/plans/settings-title-plan.md +0 -12
- package/evals/fixtures/tiny-review-work-app/docs/review/previous-agent-summary.md +0 -15
- package/evals/fixtures/tiny-review-work-app/docs/specs/settings-title.md +0 -9
- package/evals/fixtures/tiny-review-work-app/src/billing.ts +0 -7
- package/evals/fixtures/tiny-review-work-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-review-work-app/tests/billing.test.md +0 -7
- package/evals/fixtures/tiny-review-work-app/tests/settings.test.md +0 -5
- package/evals/fixtures/tiny-saas-app/README.md +0 -16
- package/evals/fixtures/tiny-saas-app/docs/auth-review.md +0 -15
- package/evals/fixtures/tiny-saas-app/docs/billing-policy.md +0 -10
- package/evals/fixtures/tiny-saas-app/docs/copy-conventions.md +0 -15
- package/evals/fixtures/tiny-saas-app/docs/specs/settings-title.md +0 -13
- package/evals/fixtures/tiny-saas-app/src/auth-middleware.ts +0 -12
- package/evals/fixtures/tiny-saas-app/src/billing.ts +0 -20
- package/evals/fixtures/tiny-saas-app/src/login-copy.ts +0 -1
- package/evals/fixtures/tiny-saas-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-saas-app/tests/auth-middleware.test.md +0 -8
- package/evals/fixtures/tiny-saas-app/tests/billing.test.md +0 -8
- package/evals/fixtures/tiny-saas-app/tests/copy.test.md +0 -7
- package/evals/fixtures/tiny-setup-agents-app/AGENTS.md +0 -6
- package/evals/fixtures/tiny-setup-both-app/AGENTS.md +0 -5
- package/evals/fixtures/tiny-setup-both-app/CLAUDE.md +0 -5
- package/evals/fixtures/tiny-setup-claude-app/CLAUDE.md +0 -6
- package/evals/fixtures/tiny-setup-codex-rules-app/.codex/rules/shell.rules +0 -5
- package/evals/fixtures/tiny-setup-codex-rules-app/AGENTS.md +0 -6
- package/evals/fixtures/tiny-setup-conflict-app/AGENTS.md +0 -6
- package/evals/fixtures/tiny-setup-existing-block-app/AGENTS.md +0 -14
- package/evals/fixtures/tiny-setup-four-rules-app/CLAUDE.md +0 -6
- package/evals/fixtures/tiny-skill-dev-app/README.md +0 -10
- package/evals/fixtures/tiny-skill-dev-app/evals/prompts/review-pr-001.txt +0 -8
- package/evals/fixtures/tiny-skill-dev-app/evals/reports/review-pr-failure.md +0 -17
- package/evals/fixtures/tiny-skill-dev-app/skills/review-pr/SKILL.md +0 -13
- package/evals/fixtures/tiny-team-app/README.md +0 -5
- package/evals/fixtures/tiny-team-app/docs/product.md +0 -6
- package/evals/fixtures/tiny-team-app/src/teams.ts +0 -9
- package/evals/fixtures/tiny-team-app/src/users.ts +0 -5
- package/evals/fixtures/tiny-team-app/tests/teams.test.md +0 -7
- package/evals/fixtures/tiny-verify-app/README.md +0 -5
- package/evals/fixtures/tiny-verify-app/src/settings-nav.ts +0 -1
- package/evals/fixtures/tiny-verify-app/src/settings-page.ts +0 -1
- package/evals/fixtures/tiny-verify-app/tests/settings.test.md +0 -7
- package/evals/prompts/aon-001.txt +0 -2
- package/evals/prompts/byp-001.txt +0 -2
- package/evals/prompts/byp-002.txt +0 -2
- package/evals/prompts/cap-001.txt +0 -3
- package/evals/prompts/cap-002.txt +0 -3
- package/evals/prompts/cmd-001.txt +0 -3
- package/evals/prompts/cmd-002.txt +0 -3
- package/evals/prompts/cmd-003.txt +0 -6
- package/evals/prompts/cmd-004.txt +0 -5
- package/evals/prompts/cmd-005.txt +0 -5
- package/evals/prompts/cmd-006.txt +0 -5
- package/evals/prompts/cmd-007.txt +0 -5
- package/evals/prompts/cmd-008.txt +0 -5
- package/evals/prompts/cmd-009.txt +0 -8
- package/evals/prompts/cmd-010.txt +0 -5
- package/evals/prompts/cmd-011.txt +0 -5
- package/evals/prompts/cmd-012.txt +0 -5
- package/evals/prompts/cmd-013.txt +0 -5
- package/evals/prompts/cmd-014.txt +0 -7
- package/evals/prompts/cmd-015.txt +0 -7
- package/evals/prompts/cmd-016.txt +0 -5
- package/evals/prompts/cmt-001.txt +0 -1
- package/evals/prompts/cmt-002.txt +0 -1
- package/evals/prompts/cmt-003.txt +0 -1
- package/evals/prompts/cmt-004.txt +0 -1
- package/evals/prompts/cmt-005.txt +0 -1
- package/evals/prompts/dfd-001.txt +0 -3
- package/evals/prompts/dia-001.txt +0 -3
- package/evals/prompts/dia-002.txt +0 -3
- package/evals/prompts/dia-003.txt +0 -3
- package/evals/prompts/dis-001.txt +0 -5
- package/evals/prompts/dis-002.txt +0 -5
- package/evals/prompts/esk-001.txt +0 -5
- package/evals/prompts/esk-002.txt +0 -5
- package/evals/prompts/esk-003.txt +0 -5
- package/evals/prompts/grc-001.txt +0 -3
- package/evals/prompts/hof-001.txt +0 -3
- package/evals/prompts/hof-002.txt +0 -1
- package/evals/prompts/hof-003.txt +0 -1
- package/evals/prompts/hof-004.txt +0 -1
- package/evals/prompts/hof-005.txt +0 -1
- package/evals/prompts/ivg-001.txt +0 -1
- package/evals/prompts/ivg-002.txt +0 -11
- package/evals/prompts/ivg-003.txt +0 -1
- package/evals/prompts/ivg-004.txt +0 -1
- package/evals/prompts/mode-001.txt +0 -3
- package/evals/prompts/mode-002.txt +0 -1
- package/evals/prompts/mode-003.txt +0 -3
- package/evals/prompts/mode-004.txt +0 -3
- package/evals/prompts/mode-005.txt +0 -3
- package/evals/prompts/mode-006.txt +0 -3
- package/evals/prompts/mode-007.txt +0 -3
- package/evals/prompts/otr-001.txt +0 -3
- package/evals/prompts/otr-002.txt +0 -3
- package/evals/prompts/rar-001.txt +0 -5
- package/evals/prompts/rar-002.txt +0 -3
- package/evals/prompts/rar-003.txt +0 -6
- package/evals/prompts/rar-004.txt +0 -15
- package/evals/prompts/rar-005.txt +0 -10
- package/evals/prompts/rbr-001.txt +0 -3
- package/evals/prompts/rbr-002.txt +0 -3
- package/evals/prompts/rbr-003.txt +0 -7
- package/evals/prompts/rev-001.txt +0 -3
- package/evals/prompts/rev-002.txt +0 -5
- package/evals/prompts/rev-003.txt +0 -6
- package/evals/prompts/rev-004.txt +0 -1
- package/evals/prompts/rev-005.txt +0 -15
- package/evals/prompts/rev-006.txt +0 -5
- package/evals/prompts/stp-001.txt +0 -1
- package/evals/prompts/stp-002.txt +0 -1
- package/evals/prompts/stp-003.txt +0 -1
- package/evals/prompts/stp-004.txt +0 -1
- package/evals/prompts/stp-005.txt +0 -1
- package/evals/prompts/stp-006.txt +0 -1
- package/evals/prompts/stp-007.txt +0 -1
- package/evals/prompts/stp-008.txt +0 -1
- package/evals/prompts/stp-009.txt +0 -1
- package/evals/prompts/stp-010.txt +0 -1
- package/evals/prompts/stp-011.txt +0 -1
- package/evals/prompts/vfy-003.txt +0 -1
- package/evals/prompts/wpl-001.txt +0 -3
- package/evals/prompts/wpl-002.txt +0 -5
- package/evals/prompts/wpl-003.txt +0 -3
- package/evals/prompts/wpl-004.txt +0 -5
- package/evals/prompts/wpl-005.txt +0 -1
- package/evals/prompts/wrc-001.txt +0 -10
- package/evals/prompts/wrc-002.txt +0 -3
- package/evals/prompts/wsk-001.txt +0 -6
- package/evals/prompts/wsp-001.txt +0 -5
- package/evals/prompts/wsp-002.txt +0 -15
- package/evals/prompts/wsp-003.txt +0 -3
- package/evals/prompts/wsp-004.txt +0 -15
- package/evals/prompts/wsp-005.txt +0 -5
- package/evals/prompts/wsp-006.txt +0 -12
- package/evals/prompts/wsp-007.txt +0 -9
- package/evals/prompts/wsp-008.txt +0 -13
- package/evals/prompts/xpl-001.txt +0 -1
- package/evals/prompts/xpl-002.txt +0 -3
- package/evals/prompts/xpl-003.txt +0 -3
- package/evals/prompts/xpl-004.txt +0 -3
- package/evals/prompts/xpl-005.txt +0 -5
- package/evals/prompts/xpl-006.txt +0 -3
- package/evals/registries/adversarial-evals.json +0 -39
- package/evals/registries/fixture-evals.json +0 -2513
- package/evals/registries/handoff-evals.json +0 -74
- package/evals/registries/legacy-evals.json +0 -147
- package/evals/registries/skill-evidence.json +0 -193
- package/evals/registries/verify-work-evals.json +0 -46
- package/evals/reports/acceptance/v0.1-acceptance-report.md +0 -130
- package/evals/reports/by-command-surface/command-surface-1-report.md +0 -45
- package/evals/reports/by-command-surface/command-surface-10-report.md +0 -76
- package/evals/reports/by-command-surface/command-surface-11-report.md +0 -77
- package/evals/reports/by-command-surface/command-surface-12-report.md +0 -91
- package/evals/reports/by-command-surface/command-surface-13-report.md +0 -64
- package/evals/reports/by-command-surface/command-surface-14-report.md +0 -66
- package/evals/reports/by-command-surface/command-surface-15-report.md +0 -124
- package/evals/reports/by-command-surface/command-surface-16-report.md +0 -39
- package/evals/reports/by-command-surface/command-surface-2-report.md +0 -80
- package/evals/reports/by-command-surface/command-surface-3-report.md +0 -86
- package/evals/reports/by-command-surface/command-surface-4-report.md +0 -76
- package/evals/reports/by-command-surface/command-surface-5-report.md +0 -80
- package/evals/reports/by-command-surface/command-surface-6-report.md +0 -74
- package/evals/reports/by-command-surface/command-surface-7-report.md +0 -84
- package/evals/reports/by-command-surface/command-surface-8-report.md +0 -79
- package/evals/reports/by-command-surface/command-surface-9-report.md +0 -79
- package/evals/reports/by-command-surface/command-surface-matrix.md +0 -91
- package/evals/reports/by-skill/bypass-1-report.md +0 -124
- package/evals/reports/by-skill/capture-decisions-1-report.md +0 -99
- package/evals/reports/by-skill/capture-decisions-2-report.md +0 -102
- package/evals/reports/by-skill/commit-work-1-report.md +0 -165
- package/evals/reports/by-skill/commit-work-2-report.md +0 -109
- package/evals/reports/by-skill/design-for-depth-1-report.md +0 -95
- package/evals/reports/by-skill/diagnose-failure-1-report.md +0 -91
- package/evals/reports/by-skill/diagnose-failure-2-report.md +0 -94
- package/evals/reports/by-skill/discover-1-report.md +0 -118
- package/evals/reports/by-skill/evaluate-skill-2-report.md +0 -71
- package/evals/reports/by-skill/execute-plan-1-report.md +0 -103
- package/evals/reports/by-skill/execute-plan-2-report.md +0 -112
- package/evals/reports/by-skill/execute-plan-3-report.md +0 -87
- package/evals/reports/by-skill/grill-context-1-report.md +0 -103
- package/evals/reports/by-skill/handoff-1-report.md +0 -123
- package/evals/reports/by-skill/handoff-2-report.md +0 -105
- package/evals/reports/by-skill/handoff-3-report.md +0 -100
- package/evals/reports/by-skill/handoff-7-report.md +0 -77
- package/evals/reports/by-skill/interview-gate-1-report.md +0 -63
- package/evals/reports/by-skill/interview-gate-2-report.md +0 -105
- package/evals/reports/by-skill/mode-contract-1-report.md +0 -74
- package/evals/reports/by-skill/mode-contract-2-report.md +0 -87
- package/evals/reports/by-skill/mode-contract-3-report.md +0 -65
- package/evals/reports/by-skill/mode-contract-4-report.md +0 -71
- package/evals/reports/by-skill/mode-contract-5-report.md +0 -70
- package/evals/reports/by-skill/output-router-1-report.md +0 -76
- package/evals/reports/by-skill/output-router-2-report.md +0 -65
- package/evals/reports/by-skill/research-1-report.md +0 -144
- package/evals/reports/by-skill/research-brief-1-report.md +0 -94
- package/evals/reports/by-skill/research-brief-2-report.md +0 -75
- package/evals/reports/by-skill/review-artifact-1-report.md +0 -91
- package/evals/reports/by-skill/review-artifact-2-report.md +0 -79
- package/evals/reports/by-skill/review-artifact-3-report.md +0 -120
- package/evals/reports/by-skill/review-artifact-4-report.md +0 -89
- package/evals/reports/by-skill/review-artifact-5-report.md +0 -66
- package/evals/reports/by-skill/review-work-1-report.md +0 -85
- package/evals/reports/by-skill/review-work-2-report.md +0 -87
- package/evals/reports/by-skill/review-work-3-report.md +0 -104
- package/evals/reports/by-skill/review-work-4-report.md +0 -108
- package/evals/reports/by-skill/review-work-5-report.md +0 -73
- package/evals/reports/by-skill/review-work-6-report.md +0 -66
- package/evals/reports/by-skill/setup-freeflow-1-report.md +0 -199
- package/evals/reports/by-skill/setup-freeflow-2-report.md +0 -105
- package/evals/reports/by-skill/setup-freeflow-3-report.md +0 -105
- package/evals/reports/by-skill/setup-freeflow-4-report.md +0 -88
- package/evals/reports/by-skill/setup-freeflow-5-report.md +0 -115
- package/evals/reports/by-skill/skill-authoring-1-report.md +0 -81
- package/evals/reports/by-skill/verify-work-1-report.md +0 -111
- package/evals/reports/by-skill/verify-work-2-report.md +0 -120
- package/evals/reports/by-skill/workflow-1-report.md +0 -65
- package/evals/reports/by-skill/write-plan-1-report.md +0 -123
- package/evals/reports/by-skill/write-plan-2-report.md +0 -98
- package/evals/reports/by-skill/write-plan-3-report.md +0 -110
- package/evals/reports/by-skill/write-spec-1-report.md +0 -88
- package/evals/reports/by-skill/write-spec-2-report.md +0 -89
- package/evals/reports/by-skill/write-spec-3-report.md +0 -90
- package/evals/reports/by-skill/write-spec-4-report.md +0 -167
- package/evals/reports/harness/claude-harness-1-report.md +0 -103
- package/evals/reports/harness/eval-harness-1-report.md +0 -91
- package/evals/reports/iterations/iteration-1-report.md +0 -71
- package/evals/reports/iterations/iteration-2-report.md +0 -78
- package/evals/reports/iterations/iteration-3-report.md +0 -118
- package/evals/reports/iterations/iteration-4-report.md +0 -131
- package/evals/reports/iterations/iteration-5-report.md +0 -149
- package/evals/reports/iterations/iteration-6-report.md +0 -136
- package/evals/reports/runtime/always-on-runtime-1-report.md +0 -107
- package/evals/reports/runtime/context-mode-normalized-benchmark-1-report.md +0 -52
- package/evals/reports/runtime/context-mode-real-deep-baseline-1-report.md +0 -410
- package/evals/reports/runtime/context-mode-real-deep-final-slice-11-report.md +0 -203
- package/evals/reports/runtime/context-mode-real-deep-final-slice-11-review.md +0 -51
- package/evals/reports/runtime/context-saving-native-tools-baseline-1-report.md +0 -99
- package/evals/reports/runtime/eryx-python-compatibility-reprobe-1-report.md +0 -166
- package/evals/reports/runtime/eryx-python-proof-spike-1-report.md +0 -96
- package/evals/reports/runtime/eryx-python-proof-spike-2-report.md +0 -151
- package/evals/reports/runtime/eryx-python-script-derive-execution-1-report.md +0 -233
- package/evals/reports/runtime/jq-script-derive-execution-1-report.md +0 -215
- package/evals/reports/runtime/jq-wasm-proof-spike-1-report.md +0 -67
- package/evals/reports/runtime/output-router-benchmark-1-report.md +0 -81
- package/evals/reports/runtime/output-router-capture-derive-provider-eval-1-report.md +0 -35
- package/evals/reports/runtime/output-router-codex-large-index-sqlite-adhoc-report.md +0 -150
- package/evals/reports/runtime/output-router-codex-qa-benchmark-1-report.md +0 -46
- package/evals/reports/runtime/output-router-command-benchmark-1-report.md +0 -62
- package/evals/reports/runtime/output-router-index-benchmark-1-report.md +0 -64
- package/evals/reports/runtime/output-router-regression-1-report.md +0 -81
- package/evals/reports/runtime/output-router-transform-eval-1-report.md +0 -28
- package/evals/reports/runtime/pi-observed-routing-eval-1-report.md +0 -44
- package/evals/reports/runtime/quickjs-script-derive-execution-1-report.md +0 -159
- package/evals/reports/runtime/quickjs-wasi-proof-spike-1-report.md +0 -55
- package/evals/reports/runtime/render-format-row-protocol-1-report.md +0 -58
- package/evals/reports/runtime/script-sandbox-adapter-selection-review-1-report.md +0 -84
- package/evals/reports/runtime/script-sandbox-probe-resource-hardening-1-report.md +0 -51
- package/evals/reports/runtime/storage-policy-benchmark-1-report.md +0 -176
- package/evals/reports/runtime/vault-index-storage-spike-1-report.md +0 -39
- package/evals/reports/runtime/workflow-context-hook-1-report.md +0 -82
- package/evals/runbooks/adversarial-eval-runbook.md +0 -28
- package/evals/runbooks/fixture-eval-runbook.md +0 -137
- package/evals/runbooks/handoff-eval-runbook.md +0 -22
- package/evals/runbooks/verify-work-eval-runbook.md +0 -27
- package/evals/scripts/audit-command-surface.sh +0 -160
- package/evals/scripts/check-activation-contract.sh +0 -121
- package/evals/scripts/check-runtime-context-hook.sh +0 -183
- package/evals/scripts/grade-fixture-eval.sh +0 -446
- package/evals/scripts/run-claude-fixture-eval.sh +0 -26
- package/evals/scripts/run-codex-fixture-eval.sh +0 -26
- package/evals/scripts/run-eryx-python-proof-spike.js +0 -559
- package/evals/scripts/run-fixture-eval-by-id.sh +0 -23
- package/evals/scripts/run-fixture-eval.sh +0 -464
- package/evals/scripts/run-jq-wasm-proof-spike.js +0 -299
- package/evals/scripts/run-output-router-transform-eval.js +0 -115
- package/evals/scripts/run-pi-observed-routing-eval.js +0 -478
- package/evals/scripts/run-quickjs-wasi-proof-spike.js +0 -339
- package/evals/scripts/skill-evidence.sh +0 -316
- package/evals/scripts/validate-release-metadata.sh +0 -486
- package/evals/suites/v0.1-acceptance-suite.md +0 -131
- package/pi-extension/dist/host-producer-identification.js +0 -186
- package/pi-extension/dist/mcp-config.js +0 -30
- package/pi-extension/dist/native-safety-net.js +0 -209
- package/pi-extension/dist/observed-tool-routing.js +0 -114
- package/pi-extension/dist/renderers.js +0 -835
- package/pi-extension/dist/router-tools.js +0 -438
- package/pi-extension/dist/runtime-context.js +0 -288
- package/pi-extension/dist/schemas.js +0 -254
- package/pi-extension/dist/status.js +0 -449
- package/pi-extension/dist/utils.js +0 -467
- package/pi-extension/src/runtime-context.ts +0 -347
- package/pi-extension/src/status.ts +0 -505
- package/plugin-docs/README.md +0 -40
- package/plugin-docs/adr/0001-three-modes.md +0 -27
- package/plugin-docs/adr/0002-evals-before-hooks.md +0 -17
- package/plugin-docs/adr/0003-release-boundary.md +0 -21
- package/plugin-docs/adr/0004-discover-replaces-shallow-discovery-skills.md +0 -26
- package/plugin-docs/adr/README.md +0 -10
- package/plugin-docs/architecture.md +0 -89
- package/plugin-docs/output-router.md +0 -396
- package/plugin-docs/release-evidence.md +0 -77
- package/plugin-docs/skills.md +0 -44
- package/plugin-docs/workflow.md +0 -57
- package/skills/diagnose-failure/references/feedback-loop-catalog.md +0 -25
- package/skills/discover/ARTIFACT-DESTINATIONS.md +0 -58
- package/skills/discover/CHECKPOINTS.md +0 -74
- package/skills/discover/SKILL.md +0 -173
- package/skills/evaluate-skill/references/eval-patterns.md +0 -41
- package/skills/evaluate-skill/references/grading-priority.md +0 -33
- package/skills/execute-plan/SKILL.md +0 -133
- package/skills/execute-plan/references/execution-map.md +0 -122
- package/skills/interview-gate/SKILL.md +0 -90
- package/skills/setup-freeflow/references/output-router-setup.md +0 -102
- package/skills/workflow/references/workflow-map.md +0 -104
- /package/pi-extension/src/{mcp-config.ts → integrations/mcp-config.ts} +0 -0
|
@@ -0,0 +1,1023 @@
|
|
|
1
|
+
import {
|
|
2
|
+
extractTextContent,
|
|
3
|
+
formatStatus,
|
|
4
|
+
oneLine,
|
|
5
|
+
shortenMiddle,
|
|
6
|
+
splitLines,
|
|
7
|
+
statusIcon,
|
|
8
|
+
textComponent,
|
|
9
|
+
themeBold,
|
|
10
|
+
themeFg,
|
|
11
|
+
truncateText,
|
|
12
|
+
} from "./utils.js";
|
|
13
|
+
export function commandLabel(command) {
|
|
14
|
+
if (Array.isArray(command)) {
|
|
15
|
+
return truncateText(command.join(" "), 120);
|
|
16
|
+
}
|
|
17
|
+
return truncateText(command ?? "...", 120);
|
|
18
|
+
}
|
|
19
|
+
function runProducerLabel(args) {
|
|
20
|
+
if (args?.script?.language) {
|
|
21
|
+
const label = args.script.label ? ` ${args.script.label}` : "";
|
|
22
|
+
return `script:${args.script.language}${label}`;
|
|
23
|
+
}
|
|
24
|
+
return `$ ${commandLabel(args?.command)}`;
|
|
25
|
+
}
|
|
26
|
+
function retrieveSourceLabel(source) {
|
|
27
|
+
if (!source || source.kind === "repo") {
|
|
28
|
+
return `repo ${shortenMiddle(source?.path ?? ".", 80)}`;
|
|
29
|
+
}
|
|
30
|
+
if (source.kind === "local") {
|
|
31
|
+
const path = source.path ? `:${source.path}` : "";
|
|
32
|
+
return `local ${shortenMiddle(source.root ?? ".", 60)}${shortenMiddle(path, 50)}`;
|
|
33
|
+
}
|
|
34
|
+
if (source.kind === "vault") {
|
|
35
|
+
const stream = source.stream ? `:${source.stream}` : "";
|
|
36
|
+
return `vault ${shortenMiddle(source.outputId ?? "...", 48)}${stream}`;
|
|
37
|
+
}
|
|
38
|
+
return oneLine(source.kind ?? "source");
|
|
39
|
+
}
|
|
40
|
+
function evidenceLabel(evidence) {
|
|
41
|
+
if (!evidence) {
|
|
42
|
+
return "no evidence";
|
|
43
|
+
}
|
|
44
|
+
const source = evidence.source;
|
|
45
|
+
const path =
|
|
46
|
+
evidence.path ??
|
|
47
|
+
(source?.kind === "repo"
|
|
48
|
+
? source.path
|
|
49
|
+
: source?.kind === "local"
|
|
50
|
+
? source.path
|
|
51
|
+
: source?.kind === "vault"
|
|
52
|
+
? source.outputId
|
|
53
|
+
: "evidence");
|
|
54
|
+
const lines = evidence.lines ? `:${evidence.lines}` : "";
|
|
55
|
+
return `${shortenMiddle(path, 90)}${lines}`;
|
|
56
|
+
}
|
|
57
|
+
function excerptLines(theme, excerpt, indent = " ", maxLines = 8) {
|
|
58
|
+
const lines = splitLines(String(excerpt ?? ""));
|
|
59
|
+
const shown = lines
|
|
60
|
+
.slice(0, maxLines)
|
|
61
|
+
.map((line) => `${indent}${themeFg(theme, "toolOutput", truncateText(line, 140))}`);
|
|
62
|
+
const omitted = lines.length - shown.length;
|
|
63
|
+
if (omitted > 0) {
|
|
64
|
+
shown.push(`${indent}${themeFg(theme, "dim", `… ${omitted} more line(s)`)}`);
|
|
65
|
+
}
|
|
66
|
+
return shown;
|
|
67
|
+
}
|
|
68
|
+
function routeSummaryLine(theme, result) {
|
|
69
|
+
const route = result?.routing?.status ?? "unknown";
|
|
70
|
+
const preserve = result?.preserve ? ` • preserve: ${result.preserve}` : "";
|
|
71
|
+
return `${themeFg(theme, "muted", "routing:")} ${formatStatus(theme, route)}${themeFg(theme, "dim", preserve)}`;
|
|
72
|
+
}
|
|
73
|
+
function evidenceSourceSummary(source) {
|
|
74
|
+
if (!source || typeof source !== "object") {
|
|
75
|
+
return "unknown";
|
|
76
|
+
}
|
|
77
|
+
if (source.kind === "repo") {
|
|
78
|
+
return `repo ${source.path ?? "."}`;
|
|
79
|
+
}
|
|
80
|
+
if (source.kind === "local") {
|
|
81
|
+
const path = source.path ? `:${source.path}` : "";
|
|
82
|
+
return `local ${source.root ?? "."}${path}`;
|
|
83
|
+
}
|
|
84
|
+
if (source.kind === "vault") {
|
|
85
|
+
const stream = source.stream ? `:${source.stream}` : "";
|
|
86
|
+
return `vault ${source.outputId ?? "..."}${stream}`;
|
|
87
|
+
}
|
|
88
|
+
return oneLine(source.kind ?? "source");
|
|
89
|
+
}
|
|
90
|
+
function runFilterLabel(filters) {
|
|
91
|
+
if (!filters || typeof filters !== "object") {
|
|
92
|
+
return "";
|
|
93
|
+
}
|
|
94
|
+
const parts = [`stream=${filters.stream ?? "selected"}`];
|
|
95
|
+
if (Array.isArray(filters.include) && filters.include.length > 0) {
|
|
96
|
+
parts.push(`include=${filters.include.join("|")}`);
|
|
97
|
+
}
|
|
98
|
+
if (Array.isArray(filters.exclude) && filters.exclude.length > 0) {
|
|
99
|
+
parts.push(`exclude=${filters.exclude.join("|")}`);
|
|
100
|
+
}
|
|
101
|
+
if (filters.flags) {
|
|
102
|
+
parts.push(`flags=${filters.flags}`);
|
|
103
|
+
}
|
|
104
|
+
for (const key of ["head", "tail", "maxLines", "maxBytes"]) {
|
|
105
|
+
if (filters[key] !== undefined) {
|
|
106
|
+
parts.push(`${key}=${filters[key]}`);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
if (filters.selectedLines !== undefined && filters.sourceLines !== undefined) {
|
|
110
|
+
parts.push(`selected=${filters.selectedLines}/${filters.sourceLines}`);
|
|
111
|
+
}
|
|
112
|
+
if (filters.fallbackPreservedFailureEvidence) {
|
|
113
|
+
parts.push("fallback=failure-evidence");
|
|
114
|
+
}
|
|
115
|
+
return parts.join(" ");
|
|
116
|
+
}
|
|
117
|
+
function runScriptProducerLabel(scriptProducer) {
|
|
118
|
+
if (!scriptProducer || typeof scriptProducer !== "object") {
|
|
119
|
+
return "";
|
|
120
|
+
}
|
|
121
|
+
const parts = [
|
|
122
|
+
`${scriptProducer.language ?? "script"}:${scriptProducer.status ?? "unknown"}`,
|
|
123
|
+
`policy=${scriptProducer.policy ?? "sandboxed"}`,
|
|
124
|
+
];
|
|
125
|
+
if (scriptProducer.label) {
|
|
126
|
+
parts.push(`label=${scriptProducer.label}`);
|
|
127
|
+
}
|
|
128
|
+
if (scriptProducer.adapterId) {
|
|
129
|
+
parts.push(`adapter=${scriptProducer.adapterId}`);
|
|
130
|
+
}
|
|
131
|
+
if (scriptProducer.codeSha256) {
|
|
132
|
+
parts.push(`code=${scriptProducer.codeSha256}`);
|
|
133
|
+
}
|
|
134
|
+
if (scriptProducer.stdoutBytes !== undefined || scriptProducer.stderrBytes !== undefined) {
|
|
135
|
+
parts.push(`bytes=${scriptProducer.stdoutBytes ?? 0}/${scriptProducer.stderrBytes ?? 0}`);
|
|
136
|
+
}
|
|
137
|
+
if (scriptProducer.failure?.kind) {
|
|
138
|
+
parts.push(`failure=${scriptProducer.failure.kind}`);
|
|
139
|
+
}
|
|
140
|
+
return parts.join(" ");
|
|
141
|
+
}
|
|
142
|
+
function runScriptFilterLabel(scriptFilter) {
|
|
143
|
+
if (!scriptFilter || typeof scriptFilter !== "object") {
|
|
144
|
+
return "";
|
|
145
|
+
}
|
|
146
|
+
const parts = [`${scriptFilter.language ?? "script"}:${scriptFilter.status ?? "unknown"}`];
|
|
147
|
+
if (scriptFilter.label) {
|
|
148
|
+
parts.push(`label=${scriptFilter.label}`);
|
|
149
|
+
}
|
|
150
|
+
if (scriptFilter.outputId) {
|
|
151
|
+
parts.push(`transformed=${scriptFilter.outputId}`);
|
|
152
|
+
}
|
|
153
|
+
if (scriptFilter.failure?.kind) {
|
|
154
|
+
parts.push(`failure=${scriptFilter.failure.kind}`);
|
|
155
|
+
}
|
|
156
|
+
return parts.join(" ");
|
|
157
|
+
}
|
|
158
|
+
function appendStorageSection(lines, theme, routed, outputId, title = "Storage") {
|
|
159
|
+
const persistence = routed?.persistence;
|
|
160
|
+
const recoveryOutputId = persistence?.recoveryOutputId ?? persistence?.outputId ?? routed?.recovery?.outputId;
|
|
161
|
+
const hasStorage = routed?.decisionId || outputId || routed?.recordId || persistence?.status || recoveryOutputId;
|
|
162
|
+
if (!hasStorage) {
|
|
163
|
+
return;
|
|
164
|
+
}
|
|
165
|
+
lines.push("", themeFg(theme, "toolTitle", title));
|
|
166
|
+
if (routed?.decisionId) {
|
|
167
|
+
lines.push(` ${themeFg(theme, "muted", "decisionId:")} ${themeFg(theme, "accent", routed.decisionId)}`);
|
|
168
|
+
}
|
|
169
|
+
if (outputId) {
|
|
170
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", outputId)}`);
|
|
171
|
+
}
|
|
172
|
+
if (routed?.recordId) {
|
|
173
|
+
lines.push(` ${themeFg(theme, "muted", "recordId:")} ${themeFg(theme, "accent", routed.recordId)}`);
|
|
174
|
+
}
|
|
175
|
+
if (persistence?.status) {
|
|
176
|
+
lines.push(
|
|
177
|
+
` ${themeFg(theme, "muted", "persistence:")} ${persistence.status} / ${persistence.recoverability ?? "unknown"}`,
|
|
178
|
+
);
|
|
179
|
+
}
|
|
180
|
+
if (recoveryOutputId && recoveryOutputId !== outputId) {
|
|
181
|
+
lines.push(` ${themeFg(theme, "muted", "recoveryOutputId:")} ${themeFg(theme, "accent", recoveryOutputId)}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
function exactRetrieveHintFromEvidence(packet) {
|
|
185
|
+
if (!packet?.lines) {
|
|
186
|
+
return "";
|
|
187
|
+
}
|
|
188
|
+
const source = packet.source;
|
|
189
|
+
if (source?.kind === "vault" && source.outputId) {
|
|
190
|
+
return `action=retrieve source.kind=vault lineRange=${packet.lines} stream=${source.stream ?? "raw"} outputId=${source.outputId}`;
|
|
191
|
+
}
|
|
192
|
+
if (source?.kind === "local") {
|
|
193
|
+
const path = packet.path ?? source.path;
|
|
194
|
+
return path ? `action=retrieve source.kind=local lineRange=${packet.lines} root=${source.root} path=${path}` : "";
|
|
195
|
+
}
|
|
196
|
+
const path = packet.path ?? (source?.kind === "repo" ? source.path : undefined);
|
|
197
|
+
if (path && source?.kind !== "vault") {
|
|
198
|
+
return `action=retrieve source.kind=repo lineRange=${packet.lines} path=${path}`;
|
|
199
|
+
}
|
|
200
|
+
return "";
|
|
201
|
+
}
|
|
202
|
+
function firstExactRetrieveHintFromEvidence(evidence) {
|
|
203
|
+
if (!Array.isArray(evidence)) {
|
|
204
|
+
return "";
|
|
205
|
+
}
|
|
206
|
+
for (const packet of evidence) {
|
|
207
|
+
const hint = exactRetrieveHintFromEvidence(packet);
|
|
208
|
+
if (hint) {
|
|
209
|
+
return hint;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return "";
|
|
213
|
+
}
|
|
214
|
+
function exactRetrieveHintFromImportantLines(outputId, importantLines) {
|
|
215
|
+
if (!outputId || !Array.isArray(importantLines)) {
|
|
216
|
+
return "";
|
|
217
|
+
}
|
|
218
|
+
const firstSpan = importantLines.find((line) => line?.lines);
|
|
219
|
+
if (!firstSpan) {
|
|
220
|
+
return "";
|
|
221
|
+
}
|
|
222
|
+
return `action=retrieve source.kind=vault lineRange=${firstSpan.lines} stream=${firstSpan.stream ?? "combined"} outputId=${outputId}`;
|
|
223
|
+
}
|
|
224
|
+
function recoveryStartingPoint(outputId) {
|
|
225
|
+
return outputId
|
|
226
|
+
? `freeflow_search source.kind=vault outputId=${outputId} (choose stream + lineRange, or query/expand)`
|
|
227
|
+
: "";
|
|
228
|
+
}
|
|
229
|
+
function routerResultFromToolResult(result) {
|
|
230
|
+
return result?.details?.result;
|
|
231
|
+
}
|
|
232
|
+
function fallbackResultText(result) {
|
|
233
|
+
const text = extractTextContent(result?.content);
|
|
234
|
+
return text ? truncateText(text, 200) : "No Freeflow result details available.";
|
|
235
|
+
}
|
|
236
|
+
export function renderFreeflowSearchCall(args, theme) {
|
|
237
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_search"));
|
|
238
|
+
const action = themeFg(theme, "muted", args?.action ?? "query");
|
|
239
|
+
const source = themeFg(theme, "accent", retrieveSourceLabel(args?.source));
|
|
240
|
+
const query = args?.query ? ` ${themeFg(theme, "dim", `\"${truncateText(args.query, 70)}\"`)}` : "";
|
|
241
|
+
return textComponent(`${title} ${action} ${source}${query}`);
|
|
242
|
+
}
|
|
243
|
+
export function renderFreeflowRetrieveCall(args, theme) {
|
|
244
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_search"));
|
|
245
|
+
const action = themeFg(theme, "muted", args?.action ?? "query");
|
|
246
|
+
const source = themeFg(theme, "accent", retrieveSourceLabel(args?.source));
|
|
247
|
+
const query = args?.query ? ` ${themeFg(theme, "dim", `\"${truncateText(args.query, 70)}\"`)}` : "";
|
|
248
|
+
return textComponent(`${title} ${action} ${source}${query}`);
|
|
249
|
+
}
|
|
250
|
+
export function renderFreeflowRunCall(args, theme) {
|
|
251
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_run"));
|
|
252
|
+
const command = themeFg(theme, "accent", runProducerLabel(args));
|
|
253
|
+
const extras = [];
|
|
254
|
+
if (args?.preserve) {
|
|
255
|
+
extras.push(`preserve=${args.preserve}`);
|
|
256
|
+
}
|
|
257
|
+
if (args?.timeoutMs !== undefined) {
|
|
258
|
+
extras.push(`timeout=${args.timeoutMs}ms`);
|
|
259
|
+
}
|
|
260
|
+
if (args?.script?.language) {
|
|
261
|
+
extras.push(`producer=${args.script.language}`);
|
|
262
|
+
}
|
|
263
|
+
if (args?.scriptFilter?.language) {
|
|
264
|
+
extras.push(`scriptFilter=${args.scriptFilter.language}`);
|
|
265
|
+
}
|
|
266
|
+
const suffix = extras.length > 0 ? ` ${themeFg(theme, "dim", `(${extras.join(", ")})`)}` : "";
|
|
267
|
+
return textComponent(`${title} ${command}${suffix}`);
|
|
268
|
+
}
|
|
269
|
+
function transformOperationLabel(operation) {
|
|
270
|
+
if (!operation || typeof operation !== "object") {
|
|
271
|
+
return "operation";
|
|
272
|
+
}
|
|
273
|
+
return String(operation.kind ?? "operation");
|
|
274
|
+
}
|
|
275
|
+
export function renderFreeflowTransformCall(args, theme) {
|
|
276
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_search action=transform"));
|
|
277
|
+
const operation = themeFg(theme, "accent", transformOperationLabel(args?.operation));
|
|
278
|
+
const source = themeFg(theme, "muted", retrieveSourceLabel(args?.source));
|
|
279
|
+
const preserve = args?.preserve ? ` ${themeFg(theme, "dim", `(preserve=${args.preserve})`)}` : "";
|
|
280
|
+
return textComponent(`${title} ${operation} ${source}${preserve}`);
|
|
281
|
+
}
|
|
282
|
+
export function renderFreeflowBatchCall(args, theme) {
|
|
283
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_batch"));
|
|
284
|
+
const steps = Array.isArray(args?.steps) ? args.steps : [];
|
|
285
|
+
const kinds = steps
|
|
286
|
+
.slice(0, 4)
|
|
287
|
+
.map((step) => step?.kind ?? "step")
|
|
288
|
+
.join(", ");
|
|
289
|
+
const more = steps.length > 4 ? ` +${steps.length - 4}` : "";
|
|
290
|
+
const concurrency = args?.concurrency ? ` ${themeFg(theme, "dim", `(concurrency=${args.concurrency})`)}` : "";
|
|
291
|
+
return textComponent(
|
|
292
|
+
`${title} ${themeFg(theme, "accent", `${steps.length} step(s)`)} ${themeFg(theme, "muted", kinds + more)}${concurrency}`,
|
|
293
|
+
);
|
|
294
|
+
}
|
|
295
|
+
export function renderFreeflowBatchResult(result, { expanded } = {}, theme) {
|
|
296
|
+
const routed = routerResultFromToolResult(result);
|
|
297
|
+
if (!routed) {
|
|
298
|
+
return textComponent(fallbackResultText(result));
|
|
299
|
+
}
|
|
300
|
+
const failed = routed.failedCount ?? 0;
|
|
301
|
+
const icon = failed > 0 || routed.toolStatus === "error" ? "✗" : statusIcon(routed.toolStatus);
|
|
302
|
+
const steps = Array.isArray(routed.steps) ? routed.steps : [];
|
|
303
|
+
const lines = [
|
|
304
|
+
`${themeFg(theme, failed > 0 ? "warning" : "success", icon)} ${themeFg(theme, "toolTitle", "freeflow_batch")} ${themeFg(theme, "muted", `${routed.okCount ?? 0}/${routed.stepCount ?? steps.length} ok`)} • ${routeSummaryLine(theme, routed)}`,
|
|
305
|
+
];
|
|
306
|
+
if (routed.summary) {
|
|
307
|
+
lines.push(themeFg(theme, "muted", truncateText(routed.summary, 160)));
|
|
308
|
+
}
|
|
309
|
+
const queryAnswers = Array.isArray(routed.queries) ? routed.queries : [];
|
|
310
|
+
if (queryAnswers.length > 0) {
|
|
311
|
+
lines.push(
|
|
312
|
+
themeFg(
|
|
313
|
+
theme,
|
|
314
|
+
"dim",
|
|
315
|
+
`${queryAnswers.filter((answer) => answer?.status === "answered").length}/${queryAnswers.length} query answer(s) from child evidence handles`,
|
|
316
|
+
),
|
|
317
|
+
);
|
|
318
|
+
for (const answer of queryAnswers.slice(0, 3)) {
|
|
319
|
+
lines.push(themeFg(theme, "muted", truncateText(answer?.summary ?? answer?.query ?? "query", 180)));
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
lines.push(
|
|
323
|
+
themeFg(
|
|
324
|
+
theme,
|
|
325
|
+
"dim",
|
|
326
|
+
`concurrency=${routed.concurrency ?? "?"} • child outputs suppressed; full child results in details.result.steps`,
|
|
327
|
+
),
|
|
328
|
+
);
|
|
329
|
+
if (!expanded) {
|
|
330
|
+
lines.push(themeFg(theme, "dim", "ctrl+o to expand child step statuses and recovery pointers"));
|
|
331
|
+
return textComponent(lines.join("\n"));
|
|
332
|
+
}
|
|
333
|
+
if (queryAnswers.length > 0) {
|
|
334
|
+
lines.push("", themeFg(theme, "toolTitle", "Query answers"));
|
|
335
|
+
queryAnswers.forEach((answer, index) => {
|
|
336
|
+
lines.push(
|
|
337
|
+
` ${themeFg(theme, answer?.status === "answered" ? "accent" : "warning", `#${index + 1} ${answer?.status ?? "unknown"}`)} ${truncateText(answer?.query ?? "query", 120)}`,
|
|
338
|
+
);
|
|
339
|
+
if (answer?.summary) {
|
|
340
|
+
lines.push(` ${truncateText(answer.summary, 220)}`);
|
|
341
|
+
}
|
|
342
|
+
const matches = Array.isArray(answer?.matches) ? answer.matches : [];
|
|
343
|
+
matches.slice(0, 3).forEach((match) => {
|
|
344
|
+
lines.push(
|
|
345
|
+
` ${themeFg(theme, "muted", `${match.stepId ?? "step"}:`)} ${truncateText(match.excerpt ?? "", 180)}`,
|
|
346
|
+
);
|
|
347
|
+
});
|
|
348
|
+
});
|
|
349
|
+
}
|
|
350
|
+
lines.push("", themeFg(theme, "toolTitle", "Steps"));
|
|
351
|
+
if (steps.length === 0) {
|
|
352
|
+
lines.push(` ${themeFg(theme, "dim", "No steps returned.")}`);
|
|
353
|
+
} else {
|
|
354
|
+
steps.forEach((step) => {
|
|
355
|
+
const child = step.result;
|
|
356
|
+
const outputId = child?.outputId ?? child?.recovery?.outputId;
|
|
357
|
+
const status = step.status ?? child?.toolStatus ?? "unknown";
|
|
358
|
+
const pieces = [`${step.kind}`, `status=${status}`, `${step.durationMs ?? 0}ms`];
|
|
359
|
+
if (child?.routing?.status) {
|
|
360
|
+
pieces.push(`routing=${child.routing.status}`);
|
|
361
|
+
}
|
|
362
|
+
if (child?.execution?.status) {
|
|
363
|
+
pieces.push(`execution=${child.execution.status}`);
|
|
364
|
+
}
|
|
365
|
+
if (outputId) {
|
|
366
|
+
pieces.push(`outputId=${outputId}`);
|
|
367
|
+
}
|
|
368
|
+
if (Array.isArray(child?.evidence)) {
|
|
369
|
+
pieces.push(`evidence=${child.evidence.length}`);
|
|
370
|
+
}
|
|
371
|
+
if (Array.isArray(child?.importantLines)) {
|
|
372
|
+
pieces.push(`spans=${child.importantLines.length}`);
|
|
373
|
+
}
|
|
374
|
+
lines.push(
|
|
375
|
+
` ${themeFg(theme, status === "failed" ? "warning" : "accent", `#${step.index + 1} ${step.id}`)} ${themeFg(theme, "muted", pieces.join(" • "))}`,
|
|
376
|
+
);
|
|
377
|
+
const message = step.error ?? child?.failure?.message ?? child?.summary ?? child?.routing?.reason;
|
|
378
|
+
if (message) {
|
|
379
|
+
lines.push(` ${truncateText(message, 180)}`);
|
|
380
|
+
}
|
|
381
|
+
if (outputId) {
|
|
382
|
+
lines.push(` ${themeFg(theme, "muted", "recovery starting point:")} ${recoveryStartingPoint(outputId)}`);
|
|
383
|
+
}
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
lines.push("", themeFg(theme, "toolTitle", "Batch recovery"));
|
|
387
|
+
if (routed.recovery?.how) {
|
|
388
|
+
lines.push(` ${truncateText(routed.recovery.how, 220)}`);
|
|
389
|
+
}
|
|
390
|
+
lines.push(
|
|
391
|
+
` ${themeFg(theme, "dim", "Use details.result.steps for complete child routed results; model-visible output intentionally omits child excerpts.")}`,
|
|
392
|
+
);
|
|
393
|
+
return textComponent(lines.join("\n"));
|
|
394
|
+
}
|
|
395
|
+
export function renderFreeflowStatusCall(args, theme) {
|
|
396
|
+
const title = themeFg(theme, "toolTitle", themeBold(theme, "freeflow_status"));
|
|
397
|
+
const action = themeFg(theme, "accent", args?.action ?? "status");
|
|
398
|
+
return textComponent(`${title} ${action}`);
|
|
399
|
+
}
|
|
400
|
+
export function renderFreeflowStatusResult(result, { expanded } = {}, theme) {
|
|
401
|
+
const report = routerResultFromToolResult(result);
|
|
402
|
+
if (!report) {
|
|
403
|
+
return textComponent(fallbackResultText(result));
|
|
404
|
+
}
|
|
405
|
+
const warnings = Array.isArray(report.configWarnings) ? report.configWarnings : [];
|
|
406
|
+
const localWarnings = Array.isArray(report.localConfigWarnings) ? report.localConfigWarnings : [];
|
|
407
|
+
const allWarnings = [...warnings, ...localWarnings];
|
|
408
|
+
const recommendations = Array.isArray(report.migration?.recommendations) ? report.migration.recommendations : [];
|
|
409
|
+
const core = report.effectiveConfig ?? {};
|
|
410
|
+
const sources = report.configuration?.sources ?? core.sources ?? {};
|
|
411
|
+
const router = core.outputRouter ?? {};
|
|
412
|
+
const observedRouting = report.observedRouting ?? core.observedRouting ?? {};
|
|
413
|
+
const unsafeProcessing = report.processing?.unsafeUnsandboxed?.enabled === true;
|
|
414
|
+
const modeActive = report.mode?.active === true;
|
|
415
|
+
const resolvedMode = report.mode?.resolvedMode ?? report.mode?.effectiveMode ?? "workflow";
|
|
416
|
+
const displayedMode = modeActive ? resolvedMode : `dormant (${resolvedMode})`;
|
|
417
|
+
const icon = statusIcon(report.toolStatus);
|
|
418
|
+
const lines = [
|
|
419
|
+
`${themeFg(theme, "success", icon)} ${themeFg(theme, "toolTitle", "freeflow_status")} ${themeFg(theme, "muted", report.action ?? "status")} • freeflow ${formatStatus(theme, core.enabled ? "ok" : "off")} • mode ${themeFg(theme, modeActive ? "accent" : "dim", displayedMode)} • router ${formatStatus(theme, router.enabled === false ? "off" : "ok")}`,
|
|
420
|
+
`${themeFg(theme, "muted", "vault:")} ${themeFg(theme, "accent", shortenMiddle(report.vault?.root ?? "unknown", 80))} ${themeFg(theme, "dim", report.vault?.writability?.status ?? "unknown")}`,
|
|
421
|
+
`${themeFg(theme, "muted", "routing:")} observed=${observedRouting.enabled ? "on" : "off"} • processing=${unsafeProcessing ? "unsafe/unsandboxed" : "safe-default"} • warnings=${allWarnings.length} • migrations=${recommendations.length}`,
|
|
422
|
+
];
|
|
423
|
+
if (!expanded) {
|
|
424
|
+
lines.push(
|
|
425
|
+
themeFg(
|
|
426
|
+
theme,
|
|
427
|
+
"dim",
|
|
428
|
+
"ctrl+o to expand configuration sources, effective state, routing, warnings, and migrations",
|
|
429
|
+
),
|
|
430
|
+
);
|
|
431
|
+
return textComponent(lines.join("\n"));
|
|
432
|
+
}
|
|
433
|
+
const repository = report.configuration?.repository ?? {};
|
|
434
|
+
const personal = report.configuration?.personal ?? {};
|
|
435
|
+
lines.push("", themeFg(theme, "toolTitle", "Configuration"));
|
|
436
|
+
lines.push(
|
|
437
|
+
` ${themeFg(theme, "muted", "repository:")} ${repository.exists ? (repository.valid ? "valid" : themeFg(theme, "warning", "invalid")) : "missing"} ${themeFg(theme, "dim", shortenMiddle(repository.path ?? report.configPath ?? ".freeflow/config.json", 90))}`,
|
|
438
|
+
);
|
|
439
|
+
lines.push(
|
|
440
|
+
` ${themeFg(theme, "muted", "personal:")} ${personal.exists ? (personal.valid ? "valid" : themeFg(theme, "warning", "invalid")) : "not set"} ${themeFg(theme, "dim", shortenMiddle(personal.path ?? report.localConfigPath ?? ".freeflow/local.json", 90))}`,
|
|
441
|
+
);
|
|
442
|
+
lines.push(
|
|
443
|
+
` ${themeFg(theme, "muted", "enabled:")} ${String(Boolean(core.enabled))} ${themeFg(theme, "dim", `(${sources.enabled ?? "builtin"})`)}`,
|
|
444
|
+
);
|
|
445
|
+
lines.push(
|
|
446
|
+
` ${themeFg(theme, "muted", "interactionContract:")} ${String(Boolean(core.interactionContract?.enabled))} ${themeFg(theme, "dim", `(${sources.interactionContract ?? "builtin"})`)}`,
|
|
447
|
+
);
|
|
448
|
+
lines.push(
|
|
449
|
+
` ${themeFg(theme, "muted", "skills:")} ${String(Boolean(core.skills?.enabled))} ${themeFg(theme, "dim", `(${sources.skillsEnabled ?? "builtin"})`)}`,
|
|
450
|
+
);
|
|
451
|
+
lines.push("", themeFg(theme, "toolTitle", "Mode"));
|
|
452
|
+
lines.push(` ${themeFg(theme, "muted", "active:")} ${String(modeActive)}`);
|
|
453
|
+
lines.push(` ${themeFg(theme, "muted", "effective:")} ${report.mode?.effectiveMode ?? "none"}`);
|
|
454
|
+
lines.push(` ${themeFg(theme, "muted", "resolved:")} ${resolvedMode}`);
|
|
455
|
+
lines.push(
|
|
456
|
+
` ${themeFg(theme, "muted", "repository default:")} ${report.mode?.repositoryDefaultMode ?? "workflow"} ${themeFg(theme, "dim", `(${report.mode?.repositoryDefaultModeSource ?? "builtin"})`)}`,
|
|
457
|
+
);
|
|
458
|
+
lines.push(
|
|
459
|
+
` ${themeFg(theme, "muted", "personal default override:")} ${report.mode?.personalDefaultMode ?? "none"}`,
|
|
460
|
+
);
|
|
461
|
+
lines.push(
|
|
462
|
+
` ${themeFg(theme, "muted", "configured default:")} ${report.mode?.defaultMode ?? "workflow"} ${themeFg(theme, "dim", `(${report.mode?.defaultModeSource ?? sources.defaultMode ?? "builtin"})`)}`,
|
|
463
|
+
);
|
|
464
|
+
lines.push(
|
|
465
|
+
` ${themeFg(theme, "muted", "session override:")} ${report.mode?.sessionMode ?? report.mode?.currentMode ?? "none"}`,
|
|
466
|
+
);
|
|
467
|
+
lines.push("", themeFg(theme, "toolTitle", "Router"));
|
|
468
|
+
lines.push(` ${themeFg(theme, "muted", "enabled:")} ${String(router.enabled !== false)}`);
|
|
469
|
+
lines.push(` ${themeFg(theme, "muted", "profile:")} ${router.profile ?? "standard"}`);
|
|
470
|
+
lines.push(` ${themeFg(theme, "muted", "postToolRouting:")} ${router.postToolRouting ?? "off"}`);
|
|
471
|
+
lines.push(` ${themeFg(theme, "muted", "storagePolicy:")} ${router.storagePolicy ?? "hybrid-dedupe"}`);
|
|
472
|
+
if (router.thresholds) {
|
|
473
|
+
lines.push(` ${themeFg(theme, "muted", "thresholds:")} ${JSON.stringify(router.thresholds)}`);
|
|
474
|
+
}
|
|
475
|
+
const vaultIndex = report.vaultIndex;
|
|
476
|
+
if (vaultIndex) {
|
|
477
|
+
lines.push("", themeFg(theme, "toolTitle", "Vault index"));
|
|
478
|
+
lines.push(` ${themeFg(theme, "muted", "engine:")} ${vaultIndex.engine ?? "local-json-sidecar"}`);
|
|
479
|
+
lines.push(
|
|
480
|
+
` ${themeFg(theme, "muted", "available:")} ${String(Boolean(vaultIndex.available))} degraded=${String(Boolean(vaultIndex.degraded))} stale=${String(Boolean(vaultIndex.stale))} rebuildRecommended=${String(Boolean(vaultIndex.rebuildRecommended))}`,
|
|
481
|
+
);
|
|
482
|
+
lines.push(
|
|
483
|
+
` ${themeFg(theme, "muted", "entries:")} ${vaultIndex.entryCount ?? 0} text=${vaultIndex.textEntryCount ?? 0} metadata=${vaultIndex.metadataOnlyEntryCount ?? 0}`,
|
|
484
|
+
);
|
|
485
|
+
if (vaultIndex.lastError) {
|
|
486
|
+
lines.push(` ${themeFg(theme, "warning", `lastError: ${truncateText(vaultIndex.lastError, 160)}`)}`);
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
const scriptTransform = report.scriptTransform;
|
|
490
|
+
if (scriptTransform) {
|
|
491
|
+
lines.push("", themeFg(theme, "toolTitle", "Script transform"));
|
|
492
|
+
lines.push(` ${themeFg(theme, "muted", "enabled:")} ${String(Boolean(scriptTransform.enabled))}`);
|
|
493
|
+
lines.push(` ${themeFg(theme, "muted", "adapter:")} ${scriptTransform.adapterStatus ?? "unavailable"}`);
|
|
494
|
+
lines.push(
|
|
495
|
+
` ${themeFg(theme, "muted", "languages:")} ${(scriptTransform.configuredLanguages ?? []).join(", ") || "none"}`,
|
|
496
|
+
);
|
|
497
|
+
lines.push(` ${themeFg(theme, "muted", "network:")} ${scriptTransform.network ?? "off"}`);
|
|
498
|
+
lines.push(
|
|
499
|
+
` ${themeFg(theme, "muted", "rawScriptPersistence:")} ${scriptTransform.rawScriptPersistence ?? "disabled"}`,
|
|
500
|
+
);
|
|
501
|
+
if (scriptTransform.adapterHome) {
|
|
502
|
+
lines.push(` ${themeFg(theme, "muted", "adapterHome:")} ${shortenMiddle(scriptTransform.adapterHome, 90)}`);
|
|
503
|
+
}
|
|
504
|
+
if (scriptTransform.setupCommand && scriptTransform.adapterStatus !== "available") {
|
|
505
|
+
lines.push(` ${themeFg(theme, "muted", "setup:")} ${truncateText(scriptTransform.setupCommand, 140)}`);
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
const processing = report.processing?.unsafeUnsandboxed;
|
|
509
|
+
if (processing) {
|
|
510
|
+
lines.push("", themeFg(theme, "toolTitle", "Processing"));
|
|
511
|
+
lines.push(
|
|
512
|
+
` ${themeFg(theme, "muted", "unsafeUnsandboxed:")} ${processing.enabled ? themeFg(theme, "warning", "enabled unsafe/unsandboxed") : "disabled"}`,
|
|
513
|
+
);
|
|
514
|
+
lines.push(` ${themeFg(theme, "muted", "source:")} ${processing.source ?? ".freeflow/local.json"}`);
|
|
515
|
+
const notes = Array.isArray(processing.notes) ? processing.notes : [];
|
|
516
|
+
notes
|
|
517
|
+
.slice(0, 2)
|
|
518
|
+
.forEach((note) =>
|
|
519
|
+
lines.push(` ${themeFg(theme, processing.enabled ? "warning" : "dim", truncateText(note, 180))}`),
|
|
520
|
+
);
|
|
521
|
+
}
|
|
522
|
+
lines.push("", themeFg(theme, "toolTitle", "Observed routing"));
|
|
523
|
+
lines.push(` ${themeFg(theme, "muted", "enabled:")} ${String(Boolean(observedRouting.enabled))}`);
|
|
524
|
+
lines.push(` ${themeFg(theme, "muted", "onRoutingFailure:")} ${observedRouting.onRoutingFailure ?? "fail-open"}`);
|
|
525
|
+
lines.push(
|
|
526
|
+
` ${themeFg(theme, "muted", "host:")} ${observedRouting.host?.name ?? "pi"} outputReplacement=${observedRouting.host?.outputReplacement ?? "available"}`,
|
|
527
|
+
);
|
|
528
|
+
lines.push(` ${themeFg(theme, "muted", "mcp servers:")} ${observedRouting.mcp?.configuredServerCount ?? 0}`);
|
|
529
|
+
if (observedRouting.web || observedRouting.fetch || observedRouting.codeSearch) {
|
|
530
|
+
lines.push(
|
|
531
|
+
` ${themeFg(theme, "muted", "web/fetch/codeSearch:")} web=${observedRouting.web?.enabled ? "on" : "off"} fetch=${observedRouting.fetch?.enabled ? "on" : "off"} codeSearch=${observedRouting.codeSearch?.enabled ? "on" : "off"}`,
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
if (allWarnings.length > 0) {
|
|
535
|
+
lines.push("", themeFg(theme, "toolTitle", "Warnings"));
|
|
536
|
+
allWarnings
|
|
537
|
+
.slice(0, 8)
|
|
538
|
+
.forEach((warning) => lines.push(` ${themeFg(theme, "warning", truncateText(warning, 180))}`));
|
|
539
|
+
}
|
|
540
|
+
if (recommendations.length > 0) {
|
|
541
|
+
lines.push("", themeFg(theme, "toolTitle", "Migration recommendations"));
|
|
542
|
+
recommendations
|
|
543
|
+
.slice(0, 8)
|
|
544
|
+
.forEach((item) =>
|
|
545
|
+
lines.push(
|
|
546
|
+
` ${themeFg(theme, "accent", item.path)} ${themeFg(theme, "muted", item.action)} — ${truncateText(item.message, 160)}`,
|
|
547
|
+
),
|
|
548
|
+
);
|
|
549
|
+
lines.push(
|
|
550
|
+
` ${themeFg(theme, "dim", "No config was rewritten; confirmation is required before applying recommendations.")}`,
|
|
551
|
+
);
|
|
552
|
+
}
|
|
553
|
+
return textComponent(lines.join("\n"));
|
|
554
|
+
}
|
|
555
|
+
export function renderFreeflowSearchResult(result, options = {}, theme) {
|
|
556
|
+
const routed = routerResultFromToolResult(result);
|
|
557
|
+
if (routed?.implementation === "processing-engine-skeleton-v1") {
|
|
558
|
+
return renderFreeflowProcessingResult(result, options, theme);
|
|
559
|
+
}
|
|
560
|
+
if (routed?.routing?.route === "transform") {
|
|
561
|
+
return renderFreeflowTransformResult(result, options, theme, "freeflow_search");
|
|
562
|
+
}
|
|
563
|
+
return renderFreeflowRetrieveResult(result, options, theme, "freeflow_search");
|
|
564
|
+
}
|
|
565
|
+
function renderFreeflowProcessingResult(result, { expanded } = {}, theme) {
|
|
566
|
+
const routed = routerResultFromToolResult(result);
|
|
567
|
+
if (!routed) {
|
|
568
|
+
return textComponent(fallbackResultText(result));
|
|
569
|
+
}
|
|
570
|
+
const icon = routed.status === "ok" ? "✓" : routed.status === "blocked" ? "✗" : "!";
|
|
571
|
+
const unsafe = routed.script && "policy" in routed.script && routed.script.policy === "unsafe-unsandboxed";
|
|
572
|
+
const lines = [
|
|
573
|
+
`${themeFg(theme, unsafe ? "warning" : routed.status === "ok" ? "success" : "warning", icon)} ${themeFg(theme, "toolTitle", "freeflow_search")} ${themeFg(theme, "muted", "transform")} • ${formatStatus(theme, routed.status ?? "unknown")}${unsafe ? themeFg(theme, "warning", " • unsafe/unsandboxed") : ""}`,
|
|
574
|
+
];
|
|
575
|
+
const visibleLines = splitLines(String(routed.visibleText ?? ""));
|
|
576
|
+
visibleLines
|
|
577
|
+
.slice(0, expanded ? 20 : 4)
|
|
578
|
+
.forEach((line) =>
|
|
579
|
+
lines.push(
|
|
580
|
+
themeFg(
|
|
581
|
+
theme,
|
|
582
|
+
unsafe && line.includes("unsafe/unsandboxed") ? "warning" : "toolOutput",
|
|
583
|
+
truncateText(line, 160),
|
|
584
|
+
),
|
|
585
|
+
),
|
|
586
|
+
);
|
|
587
|
+
if (visibleLines.length > (expanded ? 20 : 4)) {
|
|
588
|
+
lines.push(themeFg(theme, "dim", `… ${visibleLines.length - (expanded ? 20 : 4)} more line(s)`));
|
|
589
|
+
}
|
|
590
|
+
if (!expanded) {
|
|
591
|
+
lines.push(themeFg(theme, "dim", "ctrl+o to expand transform details and recovery"));
|
|
592
|
+
return textComponent(lines.join("\n"));
|
|
593
|
+
}
|
|
594
|
+
lines.push("", themeFg(theme, "toolTitle", "Source"));
|
|
595
|
+
lines.push(` ${themeFg(theme, "accent", routed.source?.displayPath ?? "source")}`);
|
|
596
|
+
if (routed.stats) {
|
|
597
|
+
lines.push(` ${themeFg(theme, "muted", "stats:")} ${routed.stats.bytes} bytes • ${routed.stats.lines} lines`);
|
|
598
|
+
}
|
|
599
|
+
if (routed.reducer?.status) {
|
|
600
|
+
lines.push("", themeFg(theme, "toolTitle", "Reducer"));
|
|
601
|
+
lines.push(` ${routed.reducer.status}${routed.reducer.selected?.name ? ` ${routed.reducer.selected.name}` : ""}`);
|
|
602
|
+
}
|
|
603
|
+
if (routed.script?.status) {
|
|
604
|
+
lines.push("", themeFg(theme, "toolTitle", "Script"));
|
|
605
|
+
lines.push(` ${themeFg(theme, "muted", "status:")} ${routed.script.status}`);
|
|
606
|
+
if (routed.script.policy) lines.push(` ${themeFg(theme, "muted", "policy:")} ${routed.script.policy}`);
|
|
607
|
+
if (routed.script.unsafeUnsandboxed) lines.push(` ${themeFg(theme, "warning", "unsafe/unsandboxed local-yolo")}`);
|
|
608
|
+
}
|
|
609
|
+
if (routed.recovery?.how) {
|
|
610
|
+
lines.push("", themeFg(theme, "toolTitle", "Recovery"));
|
|
611
|
+
lines.push(` ${truncateText(routed.recovery.how, 180)}`);
|
|
612
|
+
if (routed.recovery.outputId)
|
|
613
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", routed.recovery.outputId)}`);
|
|
614
|
+
}
|
|
615
|
+
return textComponent(lines.join("\n"));
|
|
616
|
+
}
|
|
617
|
+
export function renderFreeflowRetrieveResult(result, { expanded } = {}, theme, toolTitle = "freeflow_search") {
|
|
618
|
+
const routed = routerResultFromToolResult(result);
|
|
619
|
+
if (!routed) {
|
|
620
|
+
return textComponent(fallbackResultText(result));
|
|
621
|
+
}
|
|
622
|
+
const evidence = Array.isArray(routed.evidence) ? routed.evidence : [];
|
|
623
|
+
const firstEvidence = evidence[0];
|
|
624
|
+
const icon = statusIcon(routed.toolStatus);
|
|
625
|
+
const lines = [
|
|
626
|
+
`${themeFg(theme, "success", icon)} ${themeFg(theme, "toolTitle", toolTitle)} ${themeFg(theme, "muted", `${evidence.length} evidence packet(s)`)} • ${routeSummaryLine(theme, routed)}`,
|
|
627
|
+
];
|
|
628
|
+
if (firstEvidence) {
|
|
629
|
+
lines.push(
|
|
630
|
+
`${themeFg(theme, "accent", evidenceLabel(firstEvidence))}${firstEvidence.expandable ? themeFg(theme, "dim", " • expandable") : ""}`,
|
|
631
|
+
);
|
|
632
|
+
} else {
|
|
633
|
+
lines.push(
|
|
634
|
+
themeFg(theme, "warning", truncateText(routed.routing?.reason ?? "No matching evidence returned.", 140)),
|
|
635
|
+
);
|
|
636
|
+
}
|
|
637
|
+
if (!expanded) {
|
|
638
|
+
lines.push(themeFg(theme, "dim", "ctrl+o to expand evidence and recovery details"));
|
|
639
|
+
return textComponent(lines.join("\n"));
|
|
640
|
+
}
|
|
641
|
+
lines.push("", themeFg(theme, "toolTitle", "Source"));
|
|
642
|
+
lines.push(` ${themeFg(theme, "accent", retrieveSourceLabel(routed.source))}`);
|
|
643
|
+
if (routed.preserve) {
|
|
644
|
+
lines.push(` ${themeFg(theme, "muted", "preserve:")} ${routed.preserve}`);
|
|
645
|
+
}
|
|
646
|
+
appendStorageSection(lines, theme, routed, routed.outputId || routed.recovery?.outputId);
|
|
647
|
+
lines.push("", themeFg(theme, "toolTitle", "Routing"));
|
|
648
|
+
lines.push(` ${themeFg(theme, "muted", "toolStatus:")} ${formatStatus(theme, routed.toolStatus)}`);
|
|
649
|
+
lines.push(` ${themeFg(theme, "muted", "routing.status:")} ${formatStatus(theme, routed.routing?.status)}`);
|
|
650
|
+
lines.push(` ${themeFg(theme, "muted", "route:")} ${routed.routing?.route ?? "retrieve"}`);
|
|
651
|
+
if (routed.routing?.reason) {
|
|
652
|
+
lines.push(` ${themeFg(theme, "muted", "reason:")} ${truncateText(routed.routing.reason, 160)}`);
|
|
653
|
+
}
|
|
654
|
+
lines.push("", themeFg(theme, "toolTitle", "Evidence"));
|
|
655
|
+
if (evidence.length === 0) {
|
|
656
|
+
lines.push(` ${themeFg(theme, "dim", "No evidence packets returned.")}`);
|
|
657
|
+
} else {
|
|
658
|
+
evidence.forEach((packet, index) => {
|
|
659
|
+
lines.push(
|
|
660
|
+
` ${themeFg(theme, "accent", `#${index + 1} ${evidenceLabel(packet)}`)} ${themeFg(theme, "dim", `window=${packet.window}`)}`,
|
|
661
|
+
);
|
|
662
|
+
if (packet.id) {
|
|
663
|
+
lines.push(` ${themeFg(theme, "muted", "evidenceId:")} ${themeFg(theme, "accent", packet.id)}`);
|
|
664
|
+
}
|
|
665
|
+
if (packet.source) {
|
|
666
|
+
lines.push(` ${themeFg(theme, "muted", "source:")} ${evidenceSourceSummary(packet.source)}`);
|
|
667
|
+
}
|
|
668
|
+
if (packet.expandable !== undefined) {
|
|
669
|
+
lines.push(` ${themeFg(theme, "muted", "expandable:")} ${String(Boolean(packet.expandable))}`);
|
|
670
|
+
}
|
|
671
|
+
const exactHint = exactRetrieveHintFromEvidence(packet);
|
|
672
|
+
if (exactHint) {
|
|
673
|
+
lines.push(` ${themeFg(theme, "muted", "exact search:")} ${exactHint}`);
|
|
674
|
+
}
|
|
675
|
+
if (packet.why) {
|
|
676
|
+
lines.push(` ${themeFg(theme, "muted", "why:")} ${truncateText(packet.why, 160)}`);
|
|
677
|
+
}
|
|
678
|
+
lines.push(...excerptLines(theme, packet.excerpt, " ", 8));
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
if (routed.recovery?.how) {
|
|
682
|
+
lines.push("", themeFg(theme, "toolTitle", "Recovery"));
|
|
683
|
+
lines.push(` ${truncateText(routed.recovery.how, 180)}`);
|
|
684
|
+
if (routed.recovery.outputId) {
|
|
685
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", routed.recovery.outputId)}`);
|
|
686
|
+
}
|
|
687
|
+
const exactHint = firstExactRetrieveHintFromEvidence(evidence);
|
|
688
|
+
if (exactHint) {
|
|
689
|
+
lines.push(` ${themeFg(theme, "muted", "exact search:")} ${exactHint}`);
|
|
690
|
+
} else if (routed.recovery.outputId) {
|
|
691
|
+
lines.push(
|
|
692
|
+
` ${themeFg(theme, "muted", "recovery starting point:")} ${recoveryStartingPoint(routed.recovery.outputId)}`,
|
|
693
|
+
);
|
|
694
|
+
}
|
|
695
|
+
if (routed.recovery.evidenceId) {
|
|
696
|
+
lines.push(` ${themeFg(theme, "muted", "evidenceId:")} ${themeFg(theme, "accent", routed.recovery.evidenceId)}`);
|
|
697
|
+
lines.push(
|
|
698
|
+
` ${themeFg(theme, "muted", "expand hint:")} freeflow_search action=expand evidenceId=${routed.recovery.evidenceId}`,
|
|
699
|
+
);
|
|
700
|
+
}
|
|
701
|
+
}
|
|
702
|
+
return textComponent(lines.join("\n"));
|
|
703
|
+
}
|
|
704
|
+
export function renderFreeflowRunResult(result, { expanded } = {}, theme, context = {}) {
|
|
705
|
+
const routed = routerResultFromToolResult(result);
|
|
706
|
+
if (!routed) {
|
|
707
|
+
return textComponent(fallbackResultText(result));
|
|
708
|
+
}
|
|
709
|
+
const executionStatus = routed.execution?.status ?? routed.toolStatus;
|
|
710
|
+
const outputId = routed.outputId;
|
|
711
|
+
const exactRecoveryOutputId = routed.persistence?.recoverability === "exact" ? outputId : routed.recovery?.outputId;
|
|
712
|
+
const icon = statusIcon(executionStatus);
|
|
713
|
+
const importantLines = Array.isArray(routed.importantLines) ? routed.importantLines : [];
|
|
714
|
+
const lines = [
|
|
715
|
+
`${themeFg(theme, executionStatus === "failed" ? "error" : "success", icon)} ${themeFg(theme, "toolTitle", "freeflow_run")} ${themeFg(theme, "muted", "execution:")} ${formatStatus(theme, executionStatus)} • ${routeSummaryLine(theme, routed)}`,
|
|
716
|
+
];
|
|
717
|
+
const statusParts = [];
|
|
718
|
+
if (routed.execution?.exitCode !== undefined && routed.execution?.exitCode !== null) {
|
|
719
|
+
statusParts.push(`exit ${routed.execution.exitCode}`);
|
|
720
|
+
}
|
|
721
|
+
if (routed.execution?.durationMs !== undefined) {
|
|
722
|
+
statusParts.push(`${routed.execution.durationMs}ms`);
|
|
723
|
+
}
|
|
724
|
+
if (outputId) {
|
|
725
|
+
statusParts.push(
|
|
726
|
+
`${routed.persistence?.recoverability === "metadata_only" ? "metadataId" : "outputId"} ${outputId}`,
|
|
727
|
+
);
|
|
728
|
+
}
|
|
729
|
+
if (exactRecoveryOutputId && exactRecoveryOutputId !== outputId) {
|
|
730
|
+
statusParts.push(`exact ${exactRecoveryOutputId}`);
|
|
731
|
+
}
|
|
732
|
+
if (routed.scriptFilter?.outputId) {
|
|
733
|
+
statusParts.push(`transformed ${routed.scriptFilter.outputId}`);
|
|
734
|
+
}
|
|
735
|
+
if (routed.reducer?.outputId) {
|
|
736
|
+
statusParts.push(`reduced ${routed.reducer.outputId}`);
|
|
737
|
+
}
|
|
738
|
+
if (routed.parser?.name) {
|
|
739
|
+
statusParts.push(`parser ${routed.parser.name} ${Number(routed.parser.confidence ?? 0).toFixed(2)}`);
|
|
740
|
+
}
|
|
741
|
+
if (statusParts.length > 0) {
|
|
742
|
+
lines.push(themeFg(theme, "accent", statusParts.join(" • ")));
|
|
743
|
+
}
|
|
744
|
+
if (routed.summary) {
|
|
745
|
+
lines.push(themeFg(theme, "muted", truncateText(routed.summary, 140)));
|
|
746
|
+
}
|
|
747
|
+
lines.push(
|
|
748
|
+
themeFg(
|
|
749
|
+
theme,
|
|
750
|
+
"dim",
|
|
751
|
+
`${importantLines.length} important span(s) • ${exactRecoveryOutputId ? (routed.scriptFilter?.outputId ? "raw and script output recoverable from vault" : routed.reducer?.outputId ? "raw and reducer output recoverable from vault" : "raw output recoverable from vault") : "metadata-only record; exact raw output not vaulted"}`,
|
|
752
|
+
),
|
|
753
|
+
);
|
|
754
|
+
if (!expanded) {
|
|
755
|
+
lines.push(themeFg(theme, "dim", "ctrl+o to expand status, evidence, and vault recovery"));
|
|
756
|
+
return textComponent(lines.join("\n"));
|
|
757
|
+
}
|
|
758
|
+
lines.push("", themeFg(theme, "toolTitle", context.args?.script ? "Producer script" : "Command"));
|
|
759
|
+
lines.push(` ${themeFg(theme, "accent", runProducerLabel(context.args))}`);
|
|
760
|
+
lines.push("", themeFg(theme, "toolTitle", "Status"));
|
|
761
|
+
lines.push(` ${themeFg(theme, "muted", "toolStatus:")} ${formatStatus(theme, routed.toolStatus)}`);
|
|
762
|
+
lines.push(` ${themeFg(theme, "muted", "execution.status:")} ${formatStatus(theme, routed.execution?.status)}`);
|
|
763
|
+
lines.push(` ${themeFg(theme, "muted", "routing.status:")} ${formatStatus(theme, routed.routing?.status)}`);
|
|
764
|
+
if (routed.execution?.exitCode !== undefined) {
|
|
765
|
+
lines.push(` ${themeFg(theme, "muted", "exitCode:")} ${routed.execution.exitCode}`);
|
|
766
|
+
}
|
|
767
|
+
if (routed.execution?.durationMs !== undefined) {
|
|
768
|
+
lines.push(` ${themeFg(theme, "muted", "durationMs:")} ${routed.execution.durationMs}`);
|
|
769
|
+
}
|
|
770
|
+
appendStorageSection(lines, theme, routed, outputId);
|
|
771
|
+
if (routed.routing?.reason || routed.summary) {
|
|
772
|
+
lines.push("", themeFg(theme, "toolTitle", "Routing"));
|
|
773
|
+
if (routed.summary) {
|
|
774
|
+
lines.push(` ${themeFg(theme, "muted", "summary:")} ${truncateText(routed.summary, 160)}`);
|
|
775
|
+
}
|
|
776
|
+
if (routed.routing?.reason) {
|
|
777
|
+
lines.push(` ${themeFg(theme, "muted", "reason:")} ${truncateText(routed.routing.reason, 180)}`);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
if (routed.filters) {
|
|
781
|
+
lines.push("", themeFg(theme, "toolTitle", "Filters"));
|
|
782
|
+
lines.push(` ${truncateText(runFilterLabel(routed.filters), 220)}`);
|
|
783
|
+
}
|
|
784
|
+
if (routed.scriptProducer) {
|
|
785
|
+
lines.push("", themeFg(theme, "toolTitle", "Script producer"));
|
|
786
|
+
lines.push(` ${truncateText(runScriptProducerLabel(routed.scriptProducer), 220)}`);
|
|
787
|
+
if (routed.scriptProducer.operation) {
|
|
788
|
+
lines.push(
|
|
789
|
+
` ${themeFg(theme, "muted", "operation:")} ${truncateText(JSON.stringify(routed.scriptProducer.operation), 180)}`,
|
|
790
|
+
);
|
|
791
|
+
}
|
|
792
|
+
if (routed.scriptProducer.failure?.message) {
|
|
793
|
+
lines.push(` ${themeFg(theme, "warning", truncateText(routed.scriptProducer.failure.message, 180))}`);
|
|
794
|
+
}
|
|
795
|
+
}
|
|
796
|
+
if (routed.reducer) {
|
|
797
|
+
lines.push("", themeFg(theme, "toolTitle", "Reducer"));
|
|
798
|
+
lines.push(
|
|
799
|
+
` ${routed.reducer.name}@${routed.reducer.version} confidence=${Number(routed.reducer.confidence ?? 0).toFixed(2)} status=${routed.reducer.status}`,
|
|
800
|
+
);
|
|
801
|
+
if (routed.reducer.rawOutputId) {
|
|
802
|
+
lines.push(
|
|
803
|
+
` ${themeFg(theme, "muted", "rawOutputId:")} ${themeFg(theme, "accent", routed.reducer.rawOutputId)}`,
|
|
804
|
+
);
|
|
805
|
+
}
|
|
806
|
+
if (routed.reducer.outputId) {
|
|
807
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", routed.reducer.outputId)}`);
|
|
808
|
+
}
|
|
809
|
+
if (Array.isArray(routed.reducer.facts) && routed.reducer.facts.length > 0) {
|
|
810
|
+
lines.push(` ${themeFg(theme, "muted", "facts:")} ${truncateText(JSON.stringify(routed.reducer.facts), 220)}`);
|
|
811
|
+
}
|
|
812
|
+
}
|
|
813
|
+
if (routed.scriptFilter) {
|
|
814
|
+
lines.push("", themeFg(theme, "toolTitle", "Script filter"));
|
|
815
|
+
lines.push(` ${truncateText(runScriptFilterLabel(routed.scriptFilter), 220)}`);
|
|
816
|
+
if (routed.scriptFilter.rawOutputId) {
|
|
817
|
+
lines.push(
|
|
818
|
+
` ${themeFg(theme, "muted", "rawOutputId:")} ${themeFg(theme, "accent", routed.scriptFilter.rawOutputId)}`,
|
|
819
|
+
);
|
|
820
|
+
}
|
|
821
|
+
if (Array.isArray(routed.scriptFilter.sourceAliases)) {
|
|
822
|
+
lines.push(` ${themeFg(theme, "muted", "sources:")} ${routed.scriptFilter.sourceAliases.join(", ")}`);
|
|
823
|
+
}
|
|
824
|
+
if (routed.scriptFilter.operation) {
|
|
825
|
+
lines.push(
|
|
826
|
+
` ${themeFg(theme, "muted", "operation:")} ${truncateText(JSON.stringify(routed.scriptFilter.operation), 180)}`,
|
|
827
|
+
);
|
|
828
|
+
}
|
|
829
|
+
if (routed.scriptFilter.failure?.message) {
|
|
830
|
+
lines.push(` ${themeFg(theme, "warning", truncateText(routed.scriptFilter.failure.message, 180))}`);
|
|
831
|
+
}
|
|
832
|
+
}
|
|
833
|
+
if (routed.parser?.name) {
|
|
834
|
+
lines.push("", themeFg(theme, "toolTitle", "Parser"));
|
|
835
|
+
lines.push(` ${themeFg(theme, "muted", "name:")} ${routed.parser.name}`);
|
|
836
|
+
lines.push(` ${themeFg(theme, "muted", "confidence:")} ${Number(routed.parser.confidence ?? 0).toFixed(2)}`);
|
|
837
|
+
lines.push(` ${themeFg(theme, "muted", "fidelity:")} ${routed.parser.fidelity ?? "exact"}`);
|
|
838
|
+
lines.push(` ${themeFg(theme, "muted", "compressed:")} ${String(Boolean(routed.parser.compressed))}`);
|
|
839
|
+
if (routed.parser.counts && Object.keys(routed.parser.counts).length > 0) {
|
|
840
|
+
lines.push(` ${themeFg(theme, "muted", "counts:")} ${truncateText(JSON.stringify(routed.parser.counts), 160)}`);
|
|
841
|
+
}
|
|
842
|
+
if (Array.isArray(routed.parser.references) && routed.parser.references.length > 0) {
|
|
843
|
+
const refs = routed.parser.references
|
|
844
|
+
.slice(0, 3)
|
|
845
|
+
.map(
|
|
846
|
+
(ref) =>
|
|
847
|
+
`${ref.path}${ref.line ? `:${ref.line}${ref.column ? `:${ref.column}` : ""}` : ""}${ref.code ? ` ${ref.code}` : ""}`,
|
|
848
|
+
);
|
|
849
|
+
lines.push(` ${themeFg(theme, "muted", "references:")} ${truncateText(refs.join(", "), 180)}`);
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
lines.push("", themeFg(theme, "toolTitle", "Evidence"));
|
|
853
|
+
if (importantLines.length === 0) {
|
|
854
|
+
lines.push(` ${themeFg(theme, "dim", "No important lines selected.")}`);
|
|
855
|
+
} else {
|
|
856
|
+
importantLines.forEach((line, index) => {
|
|
857
|
+
lines.push(` ${themeFg(theme, "accent", `#${index + 1} ${line.stream} lines ${line.lines}`)}`);
|
|
858
|
+
lines.push(...excerptLines(theme, line.excerpt, " ", 8));
|
|
859
|
+
});
|
|
860
|
+
}
|
|
861
|
+
if (routed.recovery?.how || outputId) {
|
|
862
|
+
lines.push("", themeFg(theme, "toolTitle", "Vault recovery"));
|
|
863
|
+
if (outputId) {
|
|
864
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", outputId)}`);
|
|
865
|
+
}
|
|
866
|
+
if (routed.recovery?.how) {
|
|
867
|
+
lines.push(` ${truncateText(routed.recovery.how, 180)}`);
|
|
868
|
+
}
|
|
869
|
+
const evidenceOutputId = routed.scriptFilter?.outputId ?? routed.reducer?.outputId ?? exactRecoveryOutputId;
|
|
870
|
+
const exactHint = exactRetrieveHintFromImportantLines(evidenceOutputId, importantLines);
|
|
871
|
+
if (exactHint) {
|
|
872
|
+
const hint =
|
|
873
|
+
routed.scriptFilter?.outputId || routed.reducer?.outputId
|
|
874
|
+
? exactHint.replace(/stream=(stdout|stderr|combined)/, "stream=raw")
|
|
875
|
+
: exactHint;
|
|
876
|
+
lines.push(` ${themeFg(theme, "muted", "exact search:")} ${hint}`);
|
|
877
|
+
if ((routed.scriptFilter?.outputId || routed.reducer?.outputId) && outputId) {
|
|
878
|
+
lines.push(` ${themeFg(theme, "muted", "raw command starting point:")} ${recoveryStartingPoint(outputId)}`);
|
|
879
|
+
}
|
|
880
|
+
} else if (exactRecoveryOutputId) {
|
|
881
|
+
lines.push(
|
|
882
|
+
` ${themeFg(theme, "muted", "recovery starting point:")} ${recoveryStartingPoint(exactRecoveryOutputId)}`,
|
|
883
|
+
);
|
|
884
|
+
}
|
|
885
|
+
lines.push(` ${themeFg(theme, "dim", "Full structured result remains available in details.result.")}`);
|
|
886
|
+
}
|
|
887
|
+
return textComponent(lines.join("\n"));
|
|
888
|
+
}
|
|
889
|
+
export function renderFreeflowTransformResult(
|
|
890
|
+
result,
|
|
891
|
+
{ expanded } = {},
|
|
892
|
+
theme,
|
|
893
|
+
toolTitle = "freeflow_search action=transform",
|
|
894
|
+
) {
|
|
895
|
+
const routed = routerResultFromToolResult(result);
|
|
896
|
+
if (!routed) {
|
|
897
|
+
return textComponent(fallbackResultText(result));
|
|
898
|
+
}
|
|
899
|
+
const outputId = routed.outputId || routed.recovery?.outputId;
|
|
900
|
+
const operation = transformOperationLabel(routed.operation ?? { kind: routed.producer?.name });
|
|
901
|
+
const failed = routed.failure || routed.toolStatus === "error" || routed.routing?.status === "failed";
|
|
902
|
+
const icon = failed ? "✗" : statusIcon(routed.toolStatus);
|
|
903
|
+
const evidence = Array.isArray(routed.evidence) ? routed.evidence : [];
|
|
904
|
+
const sourceLabel = retrieveSourceLabel(routed.source);
|
|
905
|
+
const lines = [
|
|
906
|
+
`${themeFg(theme, failed ? "error" : "success", icon)} ${themeFg(theme, "toolTitle", toolTitle)} ${themeFg(theme, "accent", operation)} • ${routeSummaryLine(theme, routed)}`,
|
|
907
|
+
];
|
|
908
|
+
const statusParts = [];
|
|
909
|
+
if (outputId) {
|
|
910
|
+
statusParts.push(`outputId ${outputId}`);
|
|
911
|
+
}
|
|
912
|
+
if (routed.recordId) {
|
|
913
|
+
statusParts.push(`recordId ${routed.recordId}`);
|
|
914
|
+
}
|
|
915
|
+
if (routed.persistence?.status) {
|
|
916
|
+
statusParts.push(`persistence ${routed.persistence.status}/${routed.persistence.recoverability}`);
|
|
917
|
+
}
|
|
918
|
+
if (routed.source?.outputId) {
|
|
919
|
+
statusParts.push(`source ${routed.source.outputId}${routed.source.stream ? `:${routed.source.stream}` : ""}`);
|
|
920
|
+
}
|
|
921
|
+
if (statusParts.length > 0) {
|
|
922
|
+
lines.push(themeFg(theme, "accent", statusParts.join(" • ")));
|
|
923
|
+
}
|
|
924
|
+
if (routed.failure?.message) {
|
|
925
|
+
lines.push(themeFg(theme, "warning", `${routed.failure.kind}: ${truncateText(routed.failure.message, 140)}`));
|
|
926
|
+
} else if (routed.summary) {
|
|
927
|
+
lines.push(themeFg(theme, "muted", truncateText(routed.summary, 140)));
|
|
928
|
+
}
|
|
929
|
+
lines.push(
|
|
930
|
+
themeFg(
|
|
931
|
+
theme,
|
|
932
|
+
"dim",
|
|
933
|
+
`${evidence.length} evidence packet(s)${outputId ? " • transformed output recoverable from vault" : ""}`,
|
|
934
|
+
),
|
|
935
|
+
);
|
|
936
|
+
if (!expanded) {
|
|
937
|
+
lines.push(themeFg(theme, "dim", "ctrl+o to expand source, operation, lineage, evidence, and recovery details"));
|
|
938
|
+
return textComponent(lines.join("\n"));
|
|
939
|
+
}
|
|
940
|
+
lines.push("", themeFg(theme, "toolTitle", "Status"));
|
|
941
|
+
lines.push(` ${themeFg(theme, "muted", "toolStatus:")} ${formatStatus(theme, routed.toolStatus)}`);
|
|
942
|
+
if (routed.transformExecution?.status) {
|
|
943
|
+
lines.push(
|
|
944
|
+
` ${themeFg(theme, "muted", "transformExecution.status:")} ${formatStatus(theme, routed.transformExecution.status)}`,
|
|
945
|
+
);
|
|
946
|
+
}
|
|
947
|
+
lines.push(` ${themeFg(theme, "muted", "routing.status:")} ${formatStatus(theme, routed.routing?.status)}`);
|
|
948
|
+
if (routed.persistence?.status) {
|
|
949
|
+
lines.push(
|
|
950
|
+
` ${themeFg(theme, "muted", "persistence:")} ${routed.persistence.status} / ${routed.persistence.recoverability}`,
|
|
951
|
+
);
|
|
952
|
+
}
|
|
953
|
+
if (routed.routing?.reason) {
|
|
954
|
+
lines.push(` ${themeFg(theme, "muted", "reason:")} ${truncateText(routed.routing.reason, 180)}`);
|
|
955
|
+
}
|
|
956
|
+
appendStorageSection(lines, theme, routed, outputId);
|
|
957
|
+
lines.push("", themeFg(theme, "toolTitle", "Source"));
|
|
958
|
+
lines.push(` ${themeFg(theme, "accent", sourceLabel)}`);
|
|
959
|
+
lines.push("", themeFg(theme, "toolTitle", "Operation"));
|
|
960
|
+
if (routed.operation) {
|
|
961
|
+
lines.push(` ${truncateText(JSON.stringify(routed.operation), 220)}`);
|
|
962
|
+
} else {
|
|
963
|
+
lines.push(` ${themeFg(theme, "dim", operation)}`);
|
|
964
|
+
}
|
|
965
|
+
if (routed.lineage) {
|
|
966
|
+
lines.push("", themeFg(theme, "toolTitle", "Lineage"));
|
|
967
|
+
if (Array.isArray(routed.lineage.sourceOutputIds)) {
|
|
968
|
+
lines.push(` ${themeFg(theme, "muted", "sourceOutputIds:")} ${routed.lineage.sourceOutputIds.join(", ")}`);
|
|
969
|
+
}
|
|
970
|
+
if (Array.isArray(routed.lineage.sourceRecordIds)) {
|
|
971
|
+
lines.push(` ${themeFg(theme, "muted", "sourceRecordIds:")} ${routed.lineage.sourceRecordIds.join(", ")}`);
|
|
972
|
+
}
|
|
973
|
+
if (routed.lineage.operation) {
|
|
974
|
+
lines.push(` ${themeFg(theme, "muted", "operation:")} ${routed.lineage.operation}`);
|
|
975
|
+
}
|
|
976
|
+
if (routed.lineage.operationHash) {
|
|
977
|
+
lines.push(` ${themeFg(theme, "muted", "operationHash:")} ${shortenMiddle(routed.lineage.operationHash, 80)}`);
|
|
978
|
+
}
|
|
979
|
+
}
|
|
980
|
+
lines.push("", themeFg(theme, "toolTitle", "Evidence"));
|
|
981
|
+
if (evidence.length === 0) {
|
|
982
|
+
lines.push(` ${themeFg(theme, "dim", "No evidence packets returned.")}`);
|
|
983
|
+
} else {
|
|
984
|
+
evidence.forEach((packet, index) => {
|
|
985
|
+
lines.push(
|
|
986
|
+
` ${themeFg(theme, "accent", `#${index + 1} ${evidenceLabel(packet)}`)} ${themeFg(theme, "dim", `window=${packet.window}`)}`,
|
|
987
|
+
);
|
|
988
|
+
if (packet.id) {
|
|
989
|
+
lines.push(` ${themeFg(theme, "muted", "evidenceId:")} ${themeFg(theme, "accent", packet.id)}`);
|
|
990
|
+
}
|
|
991
|
+
if (packet.source) {
|
|
992
|
+
lines.push(` ${themeFg(theme, "muted", "source:")} ${evidenceSourceSummary(packet.source)}`);
|
|
993
|
+
}
|
|
994
|
+
if (packet.expandable !== undefined) {
|
|
995
|
+
lines.push(` ${themeFg(theme, "muted", "expandable:")} ${String(Boolean(packet.expandable))}`);
|
|
996
|
+
}
|
|
997
|
+
const exactHint = exactRetrieveHintFromEvidence(packet);
|
|
998
|
+
if (exactHint) {
|
|
999
|
+
lines.push(` ${themeFg(theme, "muted", "exact search:")} ${exactHint}`);
|
|
1000
|
+
}
|
|
1001
|
+
if (packet.why) {
|
|
1002
|
+
lines.push(` ${themeFg(theme, "muted", "why:")} ${truncateText(packet.why, 160)}`);
|
|
1003
|
+
}
|
|
1004
|
+
lines.push(...excerptLines(theme, packet.excerpt, " ", 8));
|
|
1005
|
+
});
|
|
1006
|
+
}
|
|
1007
|
+
if (routed.recovery?.how || outputId) {
|
|
1008
|
+
lines.push("", themeFg(theme, "toolTitle", "Recovery"));
|
|
1009
|
+
if (outputId) {
|
|
1010
|
+
lines.push(` ${themeFg(theme, "muted", "outputId:")} ${themeFg(theme, "accent", outputId)}`);
|
|
1011
|
+
}
|
|
1012
|
+
if (routed.recovery?.how) {
|
|
1013
|
+
lines.push(` ${truncateText(routed.recovery.how, 180)}`);
|
|
1014
|
+
}
|
|
1015
|
+
const exactHint = firstExactRetrieveHintFromEvidence(evidence);
|
|
1016
|
+
if (exactHint) {
|
|
1017
|
+
lines.push(` ${themeFg(theme, "muted", "exact search:")} ${exactHint}`);
|
|
1018
|
+
} else if (outputId) {
|
|
1019
|
+
lines.push(` ${themeFg(theme, "muted", "recovery starting point:")} ${recoveryStartingPoint(outputId)}`);
|
|
1020
|
+
}
|
|
1021
|
+
}
|
|
1022
|
+
return textComponent(lines.join("\n"));
|
|
1023
|
+
}
|