@hassangameryt/freeflow 0.7.3 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/plugins/marketplace.json +2 -2
- package/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +2 -2
- package/.codex-plugin/plugin.json +3 -3
- package/.cursor-plugin/plugin.json +1 -1
- package/NOTICE +14 -0
- package/README.md +101 -159
- package/capabilities/cognitive-routing/SKILL.md +47 -210
- package/capabilities/cognitive-routing/references/coordinator.md +163 -0
- package/capabilities/cognitive-routing/references/worker.md +38 -0
- package/capabilities/compaction/SKILL.md +49 -0
- package/capabilities/compaction/references/summary-format.md +250 -0
- package/capabilities/messaging/SKILL.md +49 -0
- package/capabilities/task-memory/SKILL.md +87 -0
- package/command-surface.json +8 -52
- package/gemini-extension.json +1 -1
- package/hooks/claude/hooks.json +13 -3
- package/hooks/codex/hooks.json +2 -1
- package/hooks/shared/runtime-context.mjs +73 -83
- package/licenses/Apache-2.0.txt +55 -0
- package/package.json +42 -12
- package/pi-extension/README.md +41 -0
- package/pi-extension/dist/ask-user/ask.js +108 -0
- package/pi-extension/dist/ask-user/form.js +250 -0
- package/pi-extension/dist/ask-user/questions.js +66 -0
- package/pi-extension/dist/ask-user/tool.js +124 -0
- package/pi-extension/dist/cognitive-routing/assembler.js +417 -0
- package/pi-extension/dist/cognitive-routing/bootstrap.js +90 -0
- package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/config.js +8 -6
- package/pi-extension/dist/cognitive-routing/economics.js +45 -0
- package/pi-extension/dist/cognitive-routing/event-schema.js +388 -0
- package/pi-extension/dist/{session-sources/events.js → cognitive-routing/event-store.js} +107 -41
- package/pi-extension/dist/cognitive-routing/gate.js +256 -0
- package/pi-extension/dist/cognitive-routing/handlers.js +901 -0
- package/pi-extension/dist/cognitive-routing/handoffs.js +350 -0
- package/pi-extension/dist/cognitive-routing/model-control.js +476 -0
- package/pi-extension/dist/cognitive-routing/projection.js +520 -0
- package/pi-extension/dist/cognitive-routing/provenance.js +83 -0
- package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/render.js +15 -15
- package/pi-extension/dist/cognitive-routing/runtime.js +398 -0
- package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/schemas.js +47 -11
- package/pi-extension/dist/cognitive-routing/session.js +223 -0
- package/pi-extension/dist/{session-sources → cognitive-routing}/sources.js +126 -87
- package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/state.js +55 -386
- package/pi-extension/dist/cognitive-routing/status.js +81 -0
- package/pi-extension/dist/cognitive-routing/tools.js +74 -0
- package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/types.js +14 -11
- package/pi-extension/dist/compaction/carry.js +205 -0
- package/pi-extension/dist/compaction/config.js +24 -0
- package/pi-extension/dist/compaction/controller.js +494 -0
- package/pi-extension/dist/compaction/harness.js +93 -0
- package/pi-extension/dist/compaction/results.js +159 -0
- package/pi-extension/dist/compaction/thresholds.js +35 -0
- package/pi-extension/dist/compaction/tool.js +57 -0
- package/pi-extension/dist/host/branch.js +13 -0
- package/pi-extension/dist/host/canonical.js +12 -0
- package/pi-extension/dist/host/catalog.js +62 -0
- package/pi-extension/dist/host/config-validation.js +233 -0
- package/pi-extension/dist/host/config.js +361 -0
- package/pi-extension/dist/host/inbound.js +142 -0
- package/pi-extension/dist/host/projection-tags.js +60 -0
- package/pi-extension/dist/host/prompts.js +93 -0
- package/pi-extension/dist/{session-sources → host}/read-only-session.js +117 -1
- package/pi-extension/dist/{runtime → host}/request-history.js +125 -39
- package/pi-extension/dist/host/rows.js +25 -0
- package/pi-extension/dist/host/runtime-state.js +204 -0
- package/pi-extension/dist/host/section-keeper.js +85 -0
- package/pi-extension/dist/host/settings/freeflow-command.js +2323 -0
- package/pi-extension/dist/{settings/settings-tui.js → host/settings/settings-view.js} +205 -73
- package/pi-extension/dist/host/staging.js +28 -0
- package/pi-extension/dist/host/status.js +115 -0
- package/pi-extension/dist/index.js +1004 -188
- package/pi-extension/dist/messaging/config.js +27 -0
- package/pi-extension/dist/messaging/messaging.js +398 -0
- package/pi-extension/dist/messaging/registry.js +57 -0
- package/pi-extension/dist/messaging/render.js +90 -0
- package/pi-extension/dist/messaging/tools.js +109 -0
- package/pi-extension/dist/messaging/transport.js +101 -0
- package/pi-extension/dist/provider-support/cache/anchor.js +21 -0
- package/pi-extension/dist/provider-support/cache/anthropic.js +102 -0
- package/pi-extension/dist/provider-support/cache/health.js +73 -0
- package/pi-extension/dist/provider-support/cache/index.js +58 -0
- package/pi-extension/dist/provider-support/cache/keepalive.js +222 -0
- package/pi-extension/dist/provider-support/cache/monitor.js +17 -0
- package/pi-extension/dist/provider-support/cache/openai-responses.js +48 -0
- package/pi-extension/dist/provider-support/effort.js +13 -0
- package/pi-extension/dist/provider-support/index.js +44 -3
- package/pi-extension/dist/provider-support/{astra → openai}/adapter.js +46 -29
- package/pi-extension/dist/provider-support/{astra → openai}/history.js +10 -8
- package/pi-extension/dist/provider-support/{astra → openai}/index.js +8 -4
- package/pi-extension/dist/provider-support/{astra → openai}/session-state.js +29 -38
- package/pi-extension/dist/provider-support/routes.js +17 -0
- package/pi-extension/dist/task-memory/config.js +49 -0
- package/pi-extension/dist/task-memory/registry.js +119 -0
- package/pi-extension/dist/task-memory/render.js +107 -0
- package/pi-extension/dist/task-memory/runtime.js +994 -0
- package/pi-extension/dist/task-memory/tool.js +233 -0
- package/pi-extension/dist/tool-execution/apply-patch/grammar.js +23 -0
- package/pi-extension/dist/tool-execution/apply-patch/match.js +38 -0
- package/pi-extension/dist/tool-execution/apply-patch/parser.js +177 -0
- package/pi-extension/dist/tool-execution/apply-patch/plan.js +201 -0
- package/pi-extension/dist/tool-execution/apply-patch/tool.js +84 -0
- package/pi-extension/dist/tool-execution/background.js +430 -0
- package/pi-extension/dist/tool-execution/bash-guard.js +23 -0
- package/pi-extension/dist/tool-execution/config.js +33 -0
- package/pi-extension/dist/tool-execution/edit-messages.js +120 -0
- package/pi-extension/dist/tool-execution/file-state.js +138 -0
- package/pi-extension/dist/tool-execution/file-tracking.js +163 -0
- package/pi-extension/dist/tool-execution/guidance-notices.js +124 -0
- package/pi-extension/dist/tool-execution/prompt.js +54 -0
- package/pi-extension/dist/tool-execution/skill-reads.js +143 -0
- package/pi-extension/dist/tool-execution/tools.js +16 -0
- package/pi-extension/freeflow/README.md +9 -0
- package/runtime/prompts/cognitive-routing.md +4 -4
- package/runtime/prompts/core.md +29 -72
- package/runtime/prompts/interaction-contract.md +18 -8
- package/runtime/prompts/tool-execution.md +25 -0
- package/runtime/prompts/working-method.md +25 -0
- package/skills/deliver-work/SKILL.md +76 -0
- package/skills/deliver-work/references/branch-closeout.md +134 -0
- package/skills/deliver-work/references/commit.md +83 -0
- package/skills/deliver-work/references/launch.md +94 -0
- package/skills/deliver-work/references/release.md +85 -0
- package/skills/deliver-work/scripts/commit-state.mjs +139 -0
- package/skills/deliver-work/scripts/delivery-state.mjs +107 -0
- package/skills/deliver-work/scripts/lib/git-state.mjs +178 -0
- package/skills/deliver-work/scripts/push-route.mjs +122 -0
- package/skills/deliver-work/scripts/release-preflight.mjs +177 -0
- package/skills/discuss-work/SKILL.md +148 -0
- package/skills/{discuss → discuss-work}/references/discussion-continuity.md +13 -50
- package/skills/discuss-work/references/learning-action.md +36 -0
- package/skills/discuss-work/scripts/choices.mjs +101 -0
- package/skills/discuss-work/scripts/lib/choices.mjs +159 -0
- package/skills/evaluate-behavior/SKILL.md +107 -0
- package/skills/evaluate-behavior/references/authoring.md +381 -0
- package/skills/evaluate-behavior/references/coding-tasks.md +145 -0
- package/skills/evaluate-behavior/references/conversations-pipelines-judges.md +177 -0
- package/skills/evaluate-behavior/references/design-and-measurement.md +273 -0
- package/skills/evaluate-behavior/references/running-and-evidence.md +245 -0
- package/skills/evaluate-behavior/scripts/claude-guard.mjs +76 -0
- package/skills/evaluate-behavior/scripts/guard-rules.mjs +309 -0
- package/skills/evaluate-behavior/scripts/lib/agreement.mjs +90 -0
- package/skills/evaluate-behavior/scripts/lib/arms.mjs +55 -0
- package/skills/evaluate-behavior/scripts/lib/budget.mjs +87 -0
- package/skills/evaluate-behavior/scripts/lib/build-source.mjs +287 -0
- package/skills/evaluate-behavior/scripts/lib/clear.mjs +74 -0
- package/skills/evaluate-behavior/scripts/lib/container.mjs +395 -0
- package/skills/evaluate-behavior/scripts/lib/decision.mjs +418 -0
- package/skills/evaluate-behavior/scripts/lib/definitions.mjs +1072 -0
- package/skills/evaluate-behavior/scripts/lib/freeflow.mjs +103 -0
- package/skills/evaluate-behavior/scripts/lib/grade-command.mjs +591 -0
- package/skills/evaluate-behavior/scripts/lib/grade-comparison.mjs +90 -0
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-interaction.mjs +19 -18
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-support.mjs +32 -5
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/grade-workspace.mjs +28 -12
- package/skills/evaluate-behavior/scripts/lib/grade.mjs +101 -0
- package/skills/evaluate-behavior/scripts/lib/hooks.mjs +98 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/confinement.mjs +196 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/constraints.mjs +111 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/index.mjs +48 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/isolation.mjs +74 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/launch.mjs +123 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/model-call.mjs +73 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/recorder.mjs +178 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/session.mjs +494 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/claude-code/skills.mjs +81 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/index.mjs +31 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/names.mjs +3 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/confinement.mjs +173 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/host.mjs +148 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/index.mjs +70 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/isolation.mjs +81 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/model-call.mjs +79 -0
- package/skills/evaluate-behavior/scripts/lib/hosts/pi/process.mjs +241 -0
- package/skills/{evaluate-skill/scripts/lib → evaluate-behavior/scripts/lib/hosts/pi}/rpc.mjs +144 -26
- package/skills/evaluate-behavior/scripts/lib/identity.mjs +82 -0
- package/skills/evaluate-behavior/scripts/lib/judge.mjs +688 -0
- package/skills/evaluate-behavior/scripts/lib/metrics.mjs +332 -0
- package/skills/evaluate-behavior/scripts/lib/model-call.mjs +17 -0
- package/skills/evaluate-behavior/scripts/lib/participants.mjs +616 -0
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/process.mjs +22 -0
- package/skills/evaluate-behavior/scripts/lib/queue.mjs +54 -0
- package/skills/evaluate-behavior/scripts/lib/reference.mjs +343 -0
- package/skills/evaluate-behavior/scripts/lib/reuse.mjs +277 -0
- package/skills/evaluate-behavior/scripts/lib/review.mjs +933 -0
- package/skills/evaluate-behavior/scripts/lib/runner.mjs +732 -0
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/sandbox.mjs +121 -14
- package/skills/evaluate-behavior/scripts/lib/scan-shell.mjs +457 -0
- package/skills/evaluate-behavior/scripts/lib/scan.mjs +479 -0
- package/skills/evaluate-behavior/scripts/lib/seal.mjs +91 -0
- package/skills/evaluate-behavior/scripts/lib/shell.mjs +560 -0
- package/skills/evaluate-behavior/scripts/lib/source-override.mjs +64 -0
- package/skills/evaluate-behavior/scripts/lib/subject-file.mjs +88 -0
- package/skills/{evaluate-skill/scripts/lib/pi.mjs → evaluate-behavior/scripts/lib/subject.mjs} +239 -262
- package/skills/evaluate-behavior/scripts/lib/task-copy.mjs +124 -0
- package/skills/evaluate-behavior/scripts/lib/trials.mjs +524 -0
- package/skills/evaluate-behavior/scripts/lib/validity.mjs +68 -0
- package/skills/evaluate-behavior/scripts/lib/view-html.mjs +454 -0
- package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/view.mjs +218 -11
- package/skills/evaluate-behavior/scripts/pi-command-tool.mjs +159 -0
- package/skills/evaluate-behavior/scripts/pi-container-route.mjs +23 -0
- package/skills/evaluate-behavior/scripts/pi-guard.mjs +77 -0
- package/skills/evaluate-behavior/scripts/pi-login-refresh.mjs +31 -0
- package/skills/evaluate-behavior/scripts/skill-eval.mjs +586 -0
- package/skills/execute-work/SKILL.md +96 -72
- package/skills/execute-work/references/code-practices.md +27 -49
- package/skills/execute-work/references/design.md +271 -0
- package/skills/execute-work/references/diagnose.md +117 -0
- package/skills/execute-work/references/migration.md +108 -0
- package/skills/execute-work/references/simplify.md +65 -0
- package/skills/execute-work/scripts/self-review.mjs +422 -0
- package/skills/execute-work/scripts/touch-map.mjs +290 -0
- package/skills/review-work/SKILL.md +94 -64
- package/skills/review-work/references/adjudication.md +94 -0
- package/skills/review-work/references/artifact.md +198 -0
- package/skills/review-work/references/evals-and-judges.md +66 -0
- package/skills/review-work/references/work.md +177 -0
- package/skills/review-work/scripts/check-brief.mjs +128 -0
- package/skills/review-work/scripts/review-packet.mjs +233 -0
- package/skills/setup-freeflow/SKILL.md +69 -16
- package/skills/track-work/SKILL.md +135 -151
- package/skills/track-work/references/handoff.md +190 -0
- package/skills/track-work/references/projects.md +51 -0
- package/skills/track-work/references/working-record-format.md +201 -344
- package/skills/track-work/scripts/lib/document.mjs +79 -19
- package/skills/track-work/scripts/lib/format.mjs +18 -1
- package/skills/track-work/scripts/lib/recover.mjs +254 -0
- package/skills/track-work/scripts/lib/registry.mjs +656 -0
- package/skills/track-work/scripts/lib/search.mjs +40 -0
- package/skills/track-work/scripts/lib/store.mjs +53 -21
- package/skills/track-work/scripts/lib/transitions.mjs +79 -4
- package/skills/track-work/scripts/lib/views.mjs +50 -1
- package/skills/track-work/scripts/working-record.mjs +263 -22
- package/skills/verify-work/SKILL.md +64 -47
- package/skills/verify-work/references/feature-map.md +120 -0
- package/skills/verify-work/references/runtime-evidence.md +203 -0
- package/skills/verify-work/references/test-design.md +27 -6
- package/skills/verify-work/scripts/test-changes.mjs +246 -0
- package/skills/write-docs/SKILL.md +171 -0
- package/skills/write-docs/references/documentation-shapes.md +184 -0
- package/skills/write-docs/references/spec-and-plan-shapes.md +308 -0
- package/skills/write-docs/scripts/artifact-check.mjs +148 -0
- package/skills/write-docs/scripts/docs-check.mjs +229 -0
- package/skills/write-docs/scripts/plan-lint.mjs +123 -0
- package/skills/write-skill/SKILL.md +165 -165
- package/skills/write-skill/references/activation-and-wording.md +143 -0
- package/skills/write-skill/references/placement-and-dependencies.md +154 -0
- package/skills/write-skill/scripts/lib/compare.mjs +701 -0
- package/skills/write-skill/scripts/lib/similarity.mjs +56 -0
- package/skills/write-skill/scripts/lib/skill-author.mjs +197 -3
- package/skills/write-skill/scripts/skill-author.mjs +67 -8
- package/capabilities/context-virtualization/SKILL.md +0 -103
- package/capabilities/conversation-history/SKILL.md +0 -53
- package/hooks/tests/check-host-adapters.test.mjs +0 -82
- package/hooks/tests/check-runtime-context-hook.sh +0 -212
- package/pi-extension/dist/cognitive-routing-v2/projection.js +0 -330
- package/pi-extension/dist/cognitive-routing-v2/runtime.js +0 -2181
- package/pi-extension/dist/cognitive-routing-v2/tools.js +0 -60
- package/pi-extension/dist/context-virtualization/commands.js +0 -89
- package/pi-extension/dist/context-virtualization/projector.js +0 -42
- package/pi-extension/dist/context-virtualization/runtime.js +0 -378
- package/pi-extension/dist/context-virtualization/state.js +0 -57
- package/pi-extension/dist/context-virtualization/types.js +0 -10
- package/pi-extension/dist/conversation-history/passages.js +0 -66
- package/pi-extension/dist/conversation-history/ranking.js +0 -105
- package/pi-extension/dist/conversation-history/runtime.js +0 -226
- package/pi-extension/dist/conversation-history/search.js +0 -56
- package/pi-extension/dist/conversation-history/types.js +0 -1
- package/pi-extension/dist/freeflow-context/resolver.js +0 -120
- package/pi-extension/dist/freeflow-context/runtime.js +0 -80
- package/pi-extension/dist/freeflow-context/source-projector.js +0 -95
- package/pi-extension/dist/freeflow-context/tool.js +0 -314
- package/pi-extension/dist/freeflow-context/types.js +0 -12
- package/pi-extension/dist/freeflow-context/visibility.js +0 -28
- package/pi-extension/dist/integrations/mcp-config.js +0 -29
- package/pi-extension/dist/runtime/runtime-context.js +0 -754
- package/pi-extension/dist/runtime/runtime-identity.js +0 -5
- package/pi-extension/dist/session-sources/provenance.js +0 -32
- package/pi-extension/dist/settings/settings-ui.js +0 -1360
- package/pi-extension/dist/ui/text-component.js +0 -57
- package/pi-extension/src/cognitive-routing-v2/budget.ts +0 -42
- package/pi-extension/src/cognitive-routing-v2/config.ts +0 -173
- package/pi-extension/src/cognitive-routing-v2/projection.ts +0 -375
- package/pi-extension/src/cognitive-routing-v2/render.ts +0 -277
- package/pi-extension/src/cognitive-routing-v2/runtime.ts +0 -2241
- package/pi-extension/src/cognitive-routing-v2/schemas.ts +0 -180
- package/pi-extension/src/cognitive-routing-v2/state.ts +0 -839
- package/pi-extension/src/cognitive-routing-v2/tools.ts +0 -62
- package/pi-extension/src/cognitive-routing-v2/types.ts +0 -254
- package/pi-extension/src/context-virtualization/commands.ts +0 -111
- package/pi-extension/src/context-virtualization/projector.ts +0 -62
- package/pi-extension/src/context-virtualization/runtime.ts +0 -428
- package/pi-extension/src/context-virtualization/state.ts +0 -79
- package/pi-extension/src/context-virtualization/types.ts +0 -92
- package/pi-extension/src/conversation-history/passages.ts +0 -81
- package/pi-extension/src/conversation-history/ranking.ts +0 -155
- package/pi-extension/src/conversation-history/runtime.ts +0 -250
- package/pi-extension/src/conversation-history/search.ts +0 -79
- package/pi-extension/src/conversation-history/types.ts +0 -31
- package/pi-extension/src/freeflow-context/resolver.ts +0 -139
- package/pi-extension/src/freeflow-context/runtime.ts +0 -100
- package/pi-extension/src/freeflow-context/source-projector.ts +0 -106
- package/pi-extension/src/freeflow-context/tool.ts +0 -366
- package/pi-extension/src/freeflow-context/types.ts +0 -70
- package/pi-extension/src/freeflow-context/visibility.ts +0 -53
- package/pi-extension/src/index.ts +0 -390
- package/pi-extension/src/integrations/mcp-config.ts +0 -32
- package/pi-extension/src/provider-support/astra/adapter.ts +0 -108
- package/pi-extension/src/provider-support/astra/history.ts +0 -145
- package/pi-extension/src/provider-support/astra/index.ts +0 -12
- package/pi-extension/src/provider-support/astra/session-state.ts +0 -113
- package/pi-extension/src/provider-support/index.ts +0 -5
- package/pi-extension/src/runtime/request-history.ts +0 -243
- package/pi-extension/src/runtime/runtime-context.ts +0 -860
- package/pi-extension/src/runtime/runtime-identity.ts +0 -8
- package/pi-extension/src/session-sources/events.ts +0 -230
- package/pi-extension/src/session-sources/provenance.ts +0 -39
- package/pi-extension/src/session-sources/read-only-session.ts +0 -170
- package/pi-extension/src/session-sources/sources.ts +0 -334
- package/pi-extension/src/settings/settings-tui.ts +0 -501
- package/pi-extension/src/settings/settings-ui.ts +0 -1652
- package/pi-extension/src/ui/text-component.ts +0 -66
- package/pi-extension/tests/cache-reuse/history.test.js +0 -117
- package/pi-extension/tests/cache-reuse/native.test.js +0 -91
- package/pi-extension/tests/cache-reuse/settings.test.js +0 -211
- package/pi-extension/tests/cognitive-routing-v2/communication.test.js +0 -577
- package/pi-extension/tests/cognitive-routing-v2/compaction-input.test.js +0 -183
- package/pi-extension/tests/cognitive-routing-v2/delegation.test.js +0 -557
- package/pi-extension/tests/cognitive-routing-v2/native.test.js +0 -474
- package/pi-extension/tests/cognitive-routing-v2/performance.test.js +0 -87
- package/pi-extension/tests/cognitive-routing-v2/persistence.test.js +0 -300
- package/pi-extension/tests/cognitive-routing-v2/projection.test.js +0 -241
- package/pi-extension/tests/cognitive-routing-v2/recovery.test.js +0 -1034
- package/pi-extension/tests/cognitive-routing-v2/render.test.js +0 -244
- package/pi-extension/tests/cognitive-routing-v2/runtime.test.js +0 -423
- package/pi-extension/tests/cognitive-routing-v2/stabilization.test.js +0 -521
- package/pi-extension/tests/cognitive-routing-v2/state.test.js +0 -586
- package/pi-extension/tests/context-virtualization/extension.test.js +0 -775
- package/pi-extension/tests/context-virtualization/projector.test.js +0 -110
- package/pi-extension/tests/context-virtualization/runtime.test.js +0 -230
- package/pi-extension/tests/conversation-history/runtime.test.js +0 -98
- package/pi-extension/tests/conversation-history/search.test.js +0 -97
- package/pi-extension/tests/fixtures/pi-host.js +0 -4
- package/pi-extension/tests/fixtures/routing-native.js +0 -191
- package/pi-extension/tests/integration/mode-free-core.test.js +0 -220
- package/pi-extension/tests/integration/pi-extension.test.js +0 -1447
- package/pi-extension/tests/integration/prompt-architecture.test.js +0 -447
- package/pi-extension/tests/integration/unaffected-regressions.test.js +0 -478
- package/pi-extension/tests/provider-support/astra-boundaries.test.js +0 -75
- package/pi-extension/tests/provider-support/astra.test.js +0 -306
- package/pi-extension/tests/provider-support/cli.test.js +0 -92
- package/pi-extension/tests/provider-support/native.test.js +0 -183
- package/pi-extension/tests/settings/settings-tui.test.js +0 -243
- package/pi-extension/tsconfig.json +0 -16
- package/plugin.json +0 -33
- package/runtime/prompts/context-virtualization.md +0 -3
- package/runtime/prompts/conversation-history.md +0 -3
- package/skills/action-selection/SKILL.md +0 -100
- package/skills/action-selection/references/trajectory-stalls.md +0 -71
- package/skills/bypass/SKILL.md +0 -153
- package/skills/commit-work/SKILL.md +0 -145
- package/skills/commit-work/references/git-state-edges.md +0 -94
- package/skills/commit-work/references/simple-push.md +0 -92
- package/skills/commit-work/references/staging-decisions.md +0 -106
- package/skills/decision-gate/SKILL.md +0 -106
- package/skills/design-for-depth/SKILL.md +0 -117
- package/skills/design-for-depth/references/design-pressure-signals.md +0 -182
- package/skills/design-for-depth/references/implementation-decisions.md +0 -76
- package/skills/design-for-depth/references/interface-design-loop.md +0 -136
- package/skills/design-for-depth/references/module-and-dependency-design.md +0 -147
- package/skills/design-for-depth/references/software-design-philosophy.md +0 -202
- package/skills/design-for-depth/references/state-and-failure-boundaries.md +0 -136
- package/skills/diagnose-failure/SKILL.md +0 -125
- package/skills/diagnose-failure/references/diagnostic-loop-catalog.md +0 -48
- package/skills/diagnose-failure/references/flaky-and-performance-diagnosis.md +0 -51
- package/skills/discuss/SKILL.md +0 -116
- package/skills/evaluate-skill/SKILL.md +0 -219
- package/skills/evaluate-skill/references/evaluation-definition-schema.md +0 -385
- package/skills/evaluate-skill/references/evaluation-design.md +0 -112
- package/skills/evaluate-skill/references/execution-and-evidence.md +0 -90
- package/skills/evaluate-skill/references/review-and-revision.md +0 -92
- package/skills/evaluate-skill/scripts/lib/definitions.mjs +0 -407
- package/skills/evaluate-skill/scripts/lib/grade-comparison.mjs +0 -60
- package/skills/evaluate-skill/scripts/lib/grade.mjs +0 -64
- package/skills/evaluate-skill/scripts/lib/runner.mjs +0 -368
- package/skills/evaluate-skill/scripts/pi-guard.mjs +0 -164
- package/skills/evaluate-skill/scripts/skill-eval.mjs +0 -102
- package/skills/execute-work/references/execute-work-edges.md +0 -68
- package/skills/finish-branch/SKILL.md +0 -117
- package/skills/finish-branch/references/integration-options.md +0 -80
- package/skills/handoff/SKILL.md +0 -82
- package/skills/handoff/references/handoff-templates.md +0 -150
- package/skills/launch-work/SKILL.md +0 -116
- package/skills/launch-work/references/launch-readiness.md +0 -85
- package/skills/migration-work/SKILL.md +0 -115
- package/skills/migration-work/references/migration-lifecycle.md +0 -82
- package/skills/release-work/SKILL.md +0 -118
- package/skills/release-work/references/release-evidence.md +0 -78
- package/skills/review-artifact/SKILL.md +0 -142
- package/skills/review-artifact/references/adjudicate-artifact-review.md +0 -101
- package/skills/review-artifact/references/independent-artifact-reviewer-contract.md +0 -159
- package/skills/review-work/references/adjudicate-work-review.md +0 -97
- package/skills/review-work/references/independent-work-reviewer-contract.md +0 -139
- package/skills/review-work/references/security-risk-lens.md +0 -69
- package/skills/setup-freeflow/references/activation-contract.md +0 -109
- package/skills/setup-freeflow/references/host-setup.md +0 -67
- package/skills/simplify-code/SKILL.md +0 -85
- package/skills/simplify-code/references/simplification-patterns.md +0 -70
- package/skills/verify-work/references/browser-runtime-evidence.md +0 -55
- package/skills/verify-work/references/integration-evidence.md +0 -47
- package/skills/verify-work/references/performance-evidence.md +0 -57
- package/skills/workflow/SKILL.md +0 -127
- package/skills/workflow/references/domain-skill-composition.md +0 -43
- package/skills/write-plan/SKILL.md +0 -92
- package/skills/write-plan/references/plan-shapes.md +0 -156
- package/skills/write-skill/references/activation-boundaries.md +0 -104
- package/skills/write-skill/references/agent-first-instructions.md +0 -121
- package/skills/write-skill/references/progressive-disclosure.md +0 -127
- package/skills/write-skill/references/skill-dependency-graphs.md +0 -190
- package/skills/write-spec/SKILL.md +0 -92
- package/skills/write-spec/references/artifact-standards.md +0 -86
- package/skills/write-spec/references/decision-records.md +0 -78
- package/skills/write-spec/references/spec-shapes.md +0 -143
- /package/pi-extension/dist/{cognitive-routing-v2 → cognitive-routing}/budget.js +0 -0
- /package/skills/{evaluate-skill → evaluate-behavior}/scripts/lib/evidence.mjs +0 -0
- /package/skills/{evaluate-skill → evaluate-behavior}/scripts/pi-observer.mjs +0 -0
|
@@ -2,6 +2,16 @@ import fs from "node:fs";
|
|
|
2
2
|
import path from "node:path";
|
|
3
3
|
import process from "node:process";
|
|
4
4
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
5
|
+
// The validator Pi uses, so a config is valid or invalid on every host alike.
|
|
6
|
+
import {
|
|
7
|
+
resolveReviewSettings,
|
|
8
|
+
reviewStateLine,
|
|
9
|
+
selectedRuntimePrompts,
|
|
10
|
+
skillsOff,
|
|
11
|
+
skillsStateLine,
|
|
12
|
+
validateLocalConfig,
|
|
13
|
+
validateRepositoryConfig,
|
|
14
|
+
} from "../../pi-extension/dist/host/config-validation.js";
|
|
5
15
|
|
|
6
16
|
const SCRIPT_DIR = path.dirname(fileURLToPath(import.meta.url));
|
|
7
17
|
export const PLUGIN_ROOT = path.resolve(SCRIPT_DIR, "../..");
|
|
@@ -62,64 +72,6 @@ function readConfigLayer(filePath, validate) {
|
|
|
62
72
|
}
|
|
63
73
|
}
|
|
64
74
|
|
|
65
|
-
function isRecord(value) {
|
|
66
|
-
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function validateCoreConfigFields(value) {
|
|
70
|
-
if (Object.hasOwn(value, "enabled") && typeof value.enabled !== "boolean") {
|
|
71
|
-
return "enabled must be a boolean";
|
|
72
|
-
}
|
|
73
|
-
if (Object.hasOwn(value, "contextVirtualization") && typeof value.contextVirtualization !== "boolean") {
|
|
74
|
-
return "contextVirtualization must be a boolean";
|
|
75
|
-
}
|
|
76
|
-
if (Object.hasOwn(value, "conversationHistory") && typeof value.conversationHistory !== "boolean") {
|
|
77
|
-
return "conversationHistory must be a boolean";
|
|
78
|
-
}
|
|
79
|
-
return null;
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
function isValidSetupConfig(value) {
|
|
83
|
-
if (!isRecord(value)) return "repository config must be a JSON object";
|
|
84
|
-
|
|
85
|
-
const allowedKeys = new Set([
|
|
86
|
-
"enabled",
|
|
87
|
-
"contextVirtualization",
|
|
88
|
-
"conversationHistory",
|
|
89
|
-
"outputRouter",
|
|
90
|
-
"observedRouting",
|
|
91
|
-
"scriptTransform",
|
|
92
|
-
"cognitiveRouting",
|
|
93
|
-
]);
|
|
94
|
-
if (!Object.keys(value).every((key) => allowedKeys.has(key))) {
|
|
95
|
-
return "repository config contains unsupported top-level keys";
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
const coreError = validateCoreConfigFields(value);
|
|
99
|
-
if (coreError) return coreError;
|
|
100
|
-
|
|
101
|
-
for (const key of ["outputRouter", "observedRouting", "scriptTransform"]) {
|
|
102
|
-
if (Object.hasOwn(value, key) && !isRecord(value[key])) return `${key} must be an object`;
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
function isValidLocalConfig(value) {
|
|
108
|
-
if (!isRecord(value)) return "local config must be a JSON object";
|
|
109
|
-
|
|
110
|
-
const allowedKeys = new Set([
|
|
111
|
-
"enabled",
|
|
112
|
-
"processing",
|
|
113
|
-
"cognitiveRouting",
|
|
114
|
-
"contextVirtualization",
|
|
115
|
-
"conversationHistory",
|
|
116
|
-
]);
|
|
117
|
-
if (!Object.keys(value).every((key) => allowedKeys.has(key))) {
|
|
118
|
-
return "local config contains unsupported top-level keys";
|
|
119
|
-
}
|
|
120
|
-
return validateCoreConfigFields(value);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
75
|
function resolveLayeredValue(repository, local, key, fallback) {
|
|
124
76
|
if (Object.hasOwn(local, key)) return local[key];
|
|
125
77
|
if (Object.hasOwn(repository, key)) return repository[key];
|
|
@@ -127,16 +79,12 @@ function resolveLayeredValue(repository, local, key, fallback) {
|
|
|
127
79
|
}
|
|
128
80
|
|
|
129
81
|
function resolveCoreConfig(repository, local) {
|
|
130
|
-
return {
|
|
131
|
-
enabled: resolveLayeredValue(repository, local, "enabled", true),
|
|
132
|
-
contextVirtualization: resolveLayeredValue(repository, local, "contextVirtualization", false),
|
|
133
|
-
conversationHistory: resolveLayeredValue(repository, local, "conversationHistory", false),
|
|
134
|
-
};
|
|
82
|
+
return { enabled: resolveLayeredValue(repository, local, "enabled", true) };
|
|
135
83
|
}
|
|
136
84
|
|
|
137
85
|
export function readConfig(root) {
|
|
138
|
-
const repository = readConfigLayer(path.join(root, ".freeflow", "config.json"),
|
|
139
|
-
const local = readConfigLayer(path.join(root, ".freeflow", "local.json"),
|
|
86
|
+
const repository = readConfigLayer(path.join(root, ".freeflow", "config.json"), validateRepositoryConfig);
|
|
87
|
+
const local = readConfigLayer(path.join(root, ".freeflow", "local.json"), validateLocalConfig);
|
|
140
88
|
const localValid = !local.exists || local.valid;
|
|
141
89
|
const configured = repository.valid && localValid;
|
|
142
90
|
const core = resolveCoreConfig(repository.valid ? repository.parsed : {}, local.valid ? local.parsed : {});
|
|
@@ -150,33 +98,67 @@ export function readConfig(root) {
|
|
|
150
98
|
localExists: local.exists,
|
|
151
99
|
localValid,
|
|
152
100
|
error: repository.valid ? local.error : repository.error,
|
|
101
|
+
errorPath: repository.valid ? ".freeflow/local.json" : ".freeflow/config.json",
|
|
153
102
|
enabled,
|
|
154
|
-
|
|
155
|
-
|
|
103
|
+
prompts: selectedRuntimePrompts(repository.parsed, local.parsed),
|
|
104
|
+
review: resolveReviewSettings(repository.parsed, local.parsed),
|
|
105
|
+
skillsOff: skillsOff(repository.parsed, local.parsed),
|
|
156
106
|
};
|
|
157
107
|
}
|
|
158
108
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
109
|
+
const PROMPT_FILES = {
|
|
110
|
+
core: "core.md",
|
|
111
|
+
interactionContract: "interaction-contract.md",
|
|
112
|
+
workingMethod: "working-method.md",
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
/**
|
|
116
|
+
* The selected prompts in Pi's order, or only `part` when a host delivers each prompt through its own hook. A selected
|
|
117
|
+
* core or Interaction Contract must exist; the Working Method is optional, as on Pi.
|
|
118
|
+
*/
|
|
119
|
+
function loadRuntimeContext(selection, part) {
|
|
120
|
+
const prompts = [];
|
|
121
|
+
for (const [key, file] of Object.entries(PROMPT_FILES)) {
|
|
122
|
+
if (!selection[key] || (part && key !== part)) continue;
|
|
123
|
+
const text = readText(path.join(PLUGIN_ROOT, "runtime", "prompts", file));
|
|
124
|
+
if (!text && key !== "workingMethod") throw new Error("Freeflow core runtime prompt files are missing.");
|
|
125
|
+
if (text) prompts.push(text);
|
|
165
126
|
}
|
|
166
|
-
|
|
167
|
-
return { corePrompt, interactionContract };
|
|
127
|
+
return prompts;
|
|
168
128
|
}
|
|
169
129
|
|
|
170
|
-
|
|
171
|
-
|
|
130
|
+
// The review and skills lines are Pi's, and as on Pi only a choice the user made adds them. This host loads plugin
|
|
131
|
+
// skills itself, so the skills line is how an off skill reaches the agent here.
|
|
132
|
+
function runtimeStateContext(config) {
|
|
133
|
+
const lines = [reviewStateLine(config.review), skillsStateLine(config.skillsOff)].filter(Boolean);
|
|
134
|
+
return ["# Freeflow Runtime State", "", "Freeflow: active", ...lines].join("\n");
|
|
172
135
|
}
|
|
173
136
|
|
|
174
|
-
|
|
137
|
+
/**
|
|
138
|
+
* The session-start context for the repository at `root`: every selected prompt, or one `part` of it (`core`,
|
|
139
|
+
* `interactionContract`, `workingMethod`). Claude Code caps each hook's context at 10,000 characters, so it runs one
|
|
140
|
+
* hook per part. A configuration error and the Runtime State, which the core prompt refers to, travel with the core.
|
|
141
|
+
*/
|
|
142
|
+
export function renderRuntimeContext(root, part = undefined) {
|
|
143
|
+
if (part !== undefined && !Object.hasOwn(PROMPT_FILES, part)) return "";
|
|
175
144
|
const config = readConfig(root);
|
|
176
|
-
if (!config.valid
|
|
145
|
+
if (!config.valid) {
|
|
146
|
+
// A missing repository config means Freeflow is not set up here: stay silent. An existing invalid file is reported,
|
|
147
|
+
// as Pi's status does, so Freeflow is not silently missing.
|
|
148
|
+
if (!config.error || (part && part !== "core")) return "";
|
|
149
|
+
return [
|
|
150
|
+
"# Freeflow Configuration Error",
|
|
151
|
+
"",
|
|
152
|
+
`Freeflow is inactive because ${config.errorPath} is invalid: ${config.error}`,
|
|
153
|
+
`Fix ${config.errorPath} or use the setup-freeflow skill, then start a new session.`,
|
|
154
|
+
].join("\n");
|
|
155
|
+
}
|
|
156
|
+
if (!config.enabled) return "";
|
|
177
157
|
|
|
178
|
-
|
|
179
|
-
|
|
158
|
+
// The user chooses the prompts on hosts other than Pi; with none selected there is nothing to deliver.
|
|
159
|
+
const prompts = loadRuntimeContext(config.prompts, part);
|
|
160
|
+
if (config.prompts.core && (!part || part === "core")) prompts.push(runtimeStateContext(config));
|
|
161
|
+
return prompts.join("\n\n");
|
|
180
162
|
}
|
|
181
163
|
|
|
182
164
|
export function emitHookOutput(output) {
|
|
@@ -190,7 +172,8 @@ export function runSessionStartAdapter({ eventNames, getWorkspaceCwd, formatOutp
|
|
|
190
172
|
if (!eventNames.includes(eventName)) return;
|
|
191
173
|
|
|
192
174
|
const root = findWorkspaceRoot(getWorkspaceCwd(input));
|
|
193
|
-
|
|
175
|
+
// An optional third argument names the one prompt this hook delivers.
|
|
176
|
+
const additionalContext = renderRuntimeContext(root, process.argv[3]);
|
|
194
177
|
if (additionalContext.trim()) {
|
|
195
178
|
emitHookOutput(formatOutput({ eventName, input, additionalContext }));
|
|
196
179
|
}
|
|
@@ -206,5 +189,12 @@ export function runSafely(run) {
|
|
|
206
189
|
}
|
|
207
190
|
|
|
208
191
|
export function isMainModule(metaUrl) {
|
|
209
|
-
|
|
192
|
+
if (!process.argv[1]) return false;
|
|
193
|
+
// Compare real paths: Node resolves symlinks in import.meta.url but not in argv, and a host may run the plugin from a
|
|
194
|
+
// symlinked directory (macOS /var is /private/var).
|
|
195
|
+
try {
|
|
196
|
+
return fs.realpathSync(process.argv[1]) === fs.realpathSync(fileURLToPath(metaUrl));
|
|
197
|
+
} catch {
|
|
198
|
+
return pathToFileURL(path.resolve(process.argv[1])).href === metaUrl;
|
|
199
|
+
}
|
|
210
200
|
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
|
|
5
|
+
http://www.apache.org/licenses/
|
|
6
|
+
|
|
7
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
8
|
+
|
|
9
|
+
1. Definitions.
|
|
10
|
+
|
|
11
|
+
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
|
|
16
|
+
|
|
17
|
+
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
|
|
18
|
+
|
|
19
|
+
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
|
|
20
|
+
|
|
21
|
+
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
|
|
22
|
+
|
|
23
|
+
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
|
|
24
|
+
|
|
25
|
+
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
|
|
26
|
+
|
|
27
|
+
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
|
|
28
|
+
|
|
29
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
|
|
30
|
+
|
|
31
|
+
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
|
|
32
|
+
|
|
33
|
+
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
|
|
34
|
+
|
|
35
|
+
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
|
|
36
|
+
|
|
37
|
+
You must give any other recipients of the Work or Derivative Works a copy of this License; and
|
|
38
|
+
|
|
39
|
+
You must cause any modified files to carry prominent notices stating that You changed the files; and
|
|
40
|
+
|
|
41
|
+
You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
|
|
42
|
+
|
|
43
|
+
If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License. You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
|
|
44
|
+
|
|
45
|
+
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
|
|
46
|
+
|
|
47
|
+
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
|
|
48
|
+
|
|
49
|
+
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
|
|
50
|
+
|
|
51
|
+
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
|
|
52
|
+
|
|
53
|
+
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
|
|
54
|
+
|
|
55
|
+
END OF TERMS AND CONDITIONS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hassangameryt/freeflow",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Feedback-based control system for coding agents.",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
@@ -22,28 +22,46 @@
|
|
|
22
22
|
"build:pi-extension": "node -e \"require('node:fs').rmSync('pi-extension/dist', { recursive: true, force: true })\" && tsc -p pi-extension/tsconfig.json && npm run format:pi-extension-dist",
|
|
23
23
|
"build": "npm run build:pi-extension",
|
|
24
24
|
"typecheck": "tsc -p pi-extension/tsconfig.json --noEmit",
|
|
25
|
-
"
|
|
25
|
+
"lint": "eslint pi-extension/src",
|
|
26
|
+
"check": "npm run typecheck && npm run lint && npm run check:source && npm run check:host-manifests && npm run check:changelog && npm run check:release-workflow && npm run check:docs && npm run check:dev-docs && npm run format:check && npm run check:release-version && npm run check:commands && npm run check:activation && npm run check:runtime && npm run check:package && npm run check:eval-coverage && npm run check:eval-definitions && npm run check:coverage-matrix && npm run check:skill-routing && npm run check:incident-fixtures",
|
|
26
27
|
"check:source": "node scripts/validation/check-source-files.mjs",
|
|
27
28
|
"check:host-manifests": "node scripts/validation/check-host-manifests.mjs",
|
|
28
29
|
"check:changelog": "node scripts/validation/check-changelog.mjs --structure",
|
|
29
30
|
"check:release-workflow": "node scripts/validation/check-release-workflow.mjs",
|
|
30
31
|
"check:docs": "node scripts/validation/check-docs.mjs",
|
|
32
|
+
"check:dev-docs": "node skills/write-docs/scripts/docs-check.mjs --strict dev-docs",
|
|
31
33
|
"check:release-version": "node scripts/validation/check-release-version.mjs",
|
|
32
34
|
"check:commands": "scripts/validation/audit-command-surface.sh",
|
|
33
35
|
"check:activation": "scripts/validation/check-activation-contract.sh",
|
|
34
36
|
"check:runtime": "hooks/tests/check-runtime-context-hook.sh",
|
|
35
37
|
"check:package": "node scripts/validation/check-package.mjs",
|
|
38
|
+
"check:eval-coverage": "node scripts/validation/check-eval-coverage.mjs --strict",
|
|
39
|
+
"check:eval-definitions": "node scripts/validation/check-eval-definitions.mjs",
|
|
40
|
+
"check:coverage-matrix": "node .skill-eval/scripts/verify-coverage-matrix.mjs",
|
|
41
|
+
"check:skill-routing": "node scripts/validation/check-skill-routing-doc.mjs",
|
|
42
|
+
"check:incident-fixtures": "node .skill-eval/workflow/scripts/verify-incident-fixtures.mjs",
|
|
36
43
|
"check:release-metadata": "scripts/validation/validate-release-metadata.sh --mode prepublish",
|
|
44
|
+
"perf:request": "node scripts/perf/request-overhead.mjs",
|
|
45
|
+
"eval:gate": "node .skill-eval/scripts/gate.mjs",
|
|
46
|
+
"test": "npm run test:pi-extension && npm run test:host-manifests && npm run test:skill-author && npm run test:skill-eval && npm run test:track-work && npm run test:discuss-work && npm run test:execute-work && npm run test:deliver-work && npm run test:review-work && npm run test:verify-work && npm run test:write-docs && npm run test:freeflow-snapshot && npm run test:release-utils && npm run test:release-workflow && npm run test:changelog && npm run test:docs && npm run test:eval-coverage && npm run test:guards",
|
|
37
47
|
"test:pi-extension": "npm run build && node --test $(find pi-extension/tests -name '*.test.js' | sort)",
|
|
38
48
|
"test:host-manifests": "node --test scripts/validation/check-host-manifests.test.mjs hooks/tests/check-host-adapters.test.mjs",
|
|
39
49
|
"test:skill-author": "node --test $(find .skill-eval/write-skill/tests -name '*.test.mjs' | sort)",
|
|
40
|
-
"test:skill-eval": "node --test $(find .skill-eval/evaluate-
|
|
50
|
+
"test:skill-eval": "node --test $(find .skill-eval/evaluate-behavior/tests -name '*.test.mjs' | sort)",
|
|
41
51
|
"test:track-work": "node --test .skill-eval/track-work/tests/*.test.mjs",
|
|
52
|
+
"test:discuss-work": "node --test .skill-eval/discuss-work/tests/*.test.mjs",
|
|
53
|
+
"test:execute-work": "node --test .skill-eval/execute-work/tests/*.test.mjs",
|
|
54
|
+
"test:deliver-work": "node --test .skill-eval/deliver-work/tests/*.test.mjs",
|
|
55
|
+
"test:review-work": "node --test .skill-eval/review-work/tests/*.test.mjs",
|
|
56
|
+
"test:verify-work": "node --test .skill-eval/verify-work/tests/*.test.mjs",
|
|
57
|
+
"test:write-docs": "node --test .skill-eval/write-docs/tests/*.test.mjs",
|
|
42
58
|
"test:freeflow-snapshot": "node --test scripts/freeflow-snapshot.test.mjs",
|
|
43
59
|
"test:release-utils": "node --test scripts/release-utils.test.mjs",
|
|
44
60
|
"test:changelog": "node --test scripts/validation/check-changelog.test.mjs",
|
|
45
61
|
"test:release-workflow": "node --test scripts/validation/check-release-workflow.test.mjs",
|
|
46
62
|
"test:docs": "node --test scripts/validation/check-docs.test.mjs",
|
|
63
|
+
"test:eval-coverage": "node --test scripts/validation/check-eval-coverage.test.mjs",
|
|
64
|
+
"test:guards": "node --test scripts/validation/guards.test.mjs",
|
|
47
65
|
"release:prepare": "node scripts/release.mjs",
|
|
48
66
|
"release:notes": "node scripts/release-notes.mjs",
|
|
49
67
|
"snapshot:refresh": "node scripts/freeflow-snapshot.mjs"
|
|
@@ -79,7 +97,6 @@
|
|
|
79
97
|
"image": "https://raw.githubusercontent.com/hassan-mohiddin/freeflow/main/assets/freeflow-plugin-icon-transparent.png"
|
|
80
98
|
},
|
|
81
99
|
"files": [
|
|
82
|
-
"plugin.json",
|
|
83
100
|
"gemini-extension.json",
|
|
84
101
|
".agents/**",
|
|
85
102
|
".claude-plugin/**",
|
|
@@ -87,24 +104,37 @@
|
|
|
87
104
|
".cursor-plugin/**",
|
|
88
105
|
"com.github.copilot/**",
|
|
89
106
|
"LICENSE",
|
|
107
|
+
"NOTICE",
|
|
108
|
+
"licenses/**",
|
|
90
109
|
"README.md",
|
|
91
110
|
"assets/**",
|
|
92
111
|
"capabilities/**",
|
|
93
112
|
"runtime/**",
|
|
94
113
|
"command-surface.json",
|
|
95
|
-
"hooks/**",
|
|
96
|
-
"
|
|
114
|
+
"hooks/adapters/**",
|
|
115
|
+
"hooks/claude/hooks.json",
|
|
116
|
+
"hooks/codex/hooks.json",
|
|
117
|
+
"hooks/cursor/hooks.json",
|
|
118
|
+
"hooks/freeflow-runtime-context.mjs",
|
|
119
|
+
"hooks/hooks.json",
|
|
120
|
+
"hooks/shared/runtime-context.mjs",
|
|
121
|
+
"pi-extension/freeflow/**",
|
|
122
|
+
"pi-extension/dist/**",
|
|
97
123
|
"skills/**"
|
|
98
124
|
],
|
|
99
125
|
"peerDependencies": {
|
|
100
|
-
"@earendil-works/pi-coding-agent": "
|
|
101
|
-
"@earendil-works/pi-tui": "
|
|
126
|
+
"@earendil-works/pi-coding-agent": ">=0.99.1",
|
|
127
|
+
"@earendil-works/pi-tui": ">=0.99.1"
|
|
102
128
|
},
|
|
103
129
|
"devDependencies": {
|
|
104
|
-
"@earendil-works/pi-coding-agent": "
|
|
105
|
-
"@earendil-works/pi-tui": "
|
|
130
|
+
"@earendil-works/pi-coding-agent": "1.4.0",
|
|
131
|
+
"@earendil-works/pi-tui": "1.4.0",
|
|
132
|
+
"@eslint/js": "10.0.1",
|
|
106
133
|
"@types/node": "^22.15.30",
|
|
134
|
+
"eslint": "10.12.0",
|
|
107
135
|
"prettier": "3.9.5",
|
|
108
|
-
"typescript": "^5.8.3"
|
|
109
|
-
|
|
136
|
+
"typescript": "^5.8.3",
|
|
137
|
+
"typescript-eslint": "8.71.1"
|
|
138
|
+
},
|
|
139
|
+
"dependencies": {}
|
|
110
140
|
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Freeflow Pi Extension
|
|
2
|
+
|
|
3
|
+
The Pi integration of Freeflow. Pi loads it as an extension and it adds Freeflow's runtime context, Cognitive Routing, Tool Execution, provider prompt-cache support, the `/freeflow` command, and Freeflow's skill commands.
|
|
4
|
+
|
|
5
|
+
Supported hosts: Pi `>=0.99.1` (developed and tested against the version pinned in the root `package.json`). The other hosts Freeflow supports load skills and hooks only; this directory is Pi-specific.
|
|
6
|
+
|
|
7
|
+
## Layout
|
|
8
|
+
|
|
9
|
+
| Path | What it is |
|
|
10
|
+
|---|---|
|
|
11
|
+
| [`src/`](src/README.md) | TypeScript source. Edit here. |
|
|
12
|
+
| `dist/` | Compiled JavaScript built from `src/`. Committed and shipped in the npm package; never edit by hand. |
|
|
13
|
+
| [`freeflow/`](freeflow/README.md) | The entry point Pi loads (`package.json` → `pi.extensions`). Re-exports `dist/index.js`. |
|
|
14
|
+
| [`tests/`](tests/README.md) | Node test suites, run against `dist/`. |
|
|
15
|
+
| `tsconfig.json` | Compiles `src/` into `dist/`. |
|
|
16
|
+
|
|
17
|
+
## Build and test
|
|
18
|
+
|
|
19
|
+
Run from the repository root:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm run build # src/ → dist/, then formats dist/
|
|
23
|
+
npm run typecheck # type errors only, no output
|
|
24
|
+
npm run test:pi-extension # builds, then runs every tests/**/*.test.js
|
|
25
|
+
npm run check # the full deterministic gate used in CI
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Commit `dist/` together with the `src/` change that produced it. Pi development uses a committed snapshot of the repository, not this working tree (see `AGENTS.md`, "Development Snapshot Boundary").
|
|
29
|
+
|
|
30
|
+
## Rules that apply everywhere here
|
|
31
|
+
|
|
32
|
+
- **Performance.** Keep per-request and per-turn work small and independent of session length; keep `tests/integration/request-path-budget.test.js` passing. See [Performance](../dev-docs/guides/performance.md).
|
|
33
|
+
- **Prompt cache.** Never change content a provider already cached, keep the Freeflow system section and tool definitions fixed, and append new content at the end. Every request-assembly change needs a test in which a later request starts with the earlier one. See [Prompt cache rules](../dev-docs/guides/prompt-cache.md).
|
|
34
|
+
- **Host source.** Work from a pinned upstream Pi checkout, not installed or cached docs (`AGENTS.md`, "External Host Source Provenance").
|
|
35
|
+
- **Pi imports.** Pi provides `@earendil-works/pi-coding-agent` and `@earendil-works/pi-tui` to extensions at runtime. They are peer dependencies, never bundled.
|
|
36
|
+
|
|
37
|
+
## Further reading
|
|
38
|
+
|
|
39
|
+
- [Pi integration](../plugin-docs/integrations/pi.md)
|
|
40
|
+
- [Architecture](../dev-docs/README.md) and [Prompt architecture](../dev-docs/subsystems/prompt-assembly.md)
|
|
41
|
+
- [Cognitive Routing](../plugin-docs/capabilities/cognitive-routing.md) and [Tool Execution](../plugin-docs/capabilities/tool-execution.md)
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { QuestionForm } from "./form.js";
|
|
2
|
+
/*
|
|
3
|
+
* Putting questions to the user in whatever UI the session has:
|
|
4
|
+
* - the terminal: one QuestionForm (descriptions, own answer, notes, multi-select);
|
|
5
|
+
* - RPC clients: one `select` per question (option and description on one line) and an `input` for the user's own
|
|
6
|
+
* answer; multi-select repeats `select` until the user picks Done;
|
|
7
|
+
* - no UI (print, JSON): unavailable, so the caller asks in its reply.
|
|
8
|
+
* Closing any dialog without answering dismisses the whole question.
|
|
9
|
+
*/
|
|
10
|
+
const OWN = "Type my own answer";
|
|
11
|
+
const DONE = "Done";
|
|
12
|
+
export async function askUser(ctx, questions, signal, form = {}) {
|
|
13
|
+
if (!ctx?.hasUI || !ctx.ui) return { status: "unavailable", reason: "No one can answer a dialog in this session." };
|
|
14
|
+
if (ctx.mode === "tui" && typeof ctx.ui.custom === "function") {
|
|
15
|
+
if (signal?.aborted) return { status: "dismissed" };
|
|
16
|
+
let timer;
|
|
17
|
+
let onAbort;
|
|
18
|
+
const outcome = await ctx.ui.custom((tui, theme, _keybindings, done) => {
|
|
19
|
+
const view = new QuestionForm(questions, theme, done, () => tui?.requestRender?.(), form);
|
|
20
|
+
// Pi's custom dialog takes no signal: an aborted call (the user pressed Escape on the turn) closes it here.
|
|
21
|
+
if (signal) {
|
|
22
|
+
onAbort = () => done({ status: "dismissed" });
|
|
23
|
+
signal.addEventListener("abort", onAbort, { once: true });
|
|
24
|
+
}
|
|
25
|
+
// A dialog with a deadline counts down and closes itself unanswered when it passes.
|
|
26
|
+
if (form.deadline !== undefined)
|
|
27
|
+
timer = setInterval(() => {
|
|
28
|
+
if (Date.now() >= form.deadline) done({ status: "dismissed" });
|
|
29
|
+
else {
|
|
30
|
+
view.invalidate();
|
|
31
|
+
tui?.requestRender?.();
|
|
32
|
+
}
|
|
33
|
+
}, 1000);
|
|
34
|
+
return view;
|
|
35
|
+
});
|
|
36
|
+
if (timer) clearInterval(timer);
|
|
37
|
+
if (onAbort) signal?.removeEventListener("abort", onAbort);
|
|
38
|
+
return outcome ?? { status: "dismissed" };
|
|
39
|
+
}
|
|
40
|
+
const answers = [];
|
|
41
|
+
for (const question of questions) {
|
|
42
|
+
const answer = await askOne(ctx, question, signal);
|
|
43
|
+
if (!answer) return { status: "dismissed" };
|
|
44
|
+
answers.push(answer);
|
|
45
|
+
}
|
|
46
|
+
return { status: "answered", answers };
|
|
47
|
+
}
|
|
48
|
+
async function askOne(ctx, question, signal) {
|
|
49
|
+
const title = `${question.header} · ${question.question}`;
|
|
50
|
+
const labels = question.options.map((option) =>
|
|
51
|
+
option.description ? `${option.label} — ${option.description}` : option.label,
|
|
52
|
+
);
|
|
53
|
+
const base = { header: question.header, question: question.question };
|
|
54
|
+
const own = async () => {
|
|
55
|
+
const text = (await ctx.ui.input(title, "Your answer", signal ? { signal } : undefined))?.trim();
|
|
56
|
+
return text ? { ...base, selected: [], text } : undefined;
|
|
57
|
+
};
|
|
58
|
+
if (!question.multiSelect) {
|
|
59
|
+
const choice = await ctx.ui.select(title, [...labels, OWN], signal ? { signal } : undefined);
|
|
60
|
+
if (choice === undefined) return undefined;
|
|
61
|
+
if (choice === OWN) return own();
|
|
62
|
+
return { ...base, selected: [question.options[labels.indexOf(choice)].label] };
|
|
63
|
+
}
|
|
64
|
+
const picked = new Set();
|
|
65
|
+
for (;;) {
|
|
66
|
+
const shown = labels.map((label, at) => `${picked.has(at) ? "[x]" : "[ ]"} ${label}`);
|
|
67
|
+
const choice = await ctx.ui.select(
|
|
68
|
+
`${title} (choose one or more, then ${DONE})`,
|
|
69
|
+
[...shown, OWN, ...(picked.size ? [DONE] : [])],
|
|
70
|
+
signal ? { signal } : undefined,
|
|
71
|
+
);
|
|
72
|
+
if (choice === undefined) return undefined;
|
|
73
|
+
if (choice === OWN) return own();
|
|
74
|
+
if (choice === DONE)
|
|
75
|
+
return { ...base, selected: [...picked].sort((a, b) => a - b).map((at) => question.options[at].label) };
|
|
76
|
+
const at = shown.indexOf(choice);
|
|
77
|
+
if (picked.has(at)) picked.delete(at);
|
|
78
|
+
else picked.add(at);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* A yes-or-no question in the same dialog as ask_user, for Freeflow's own confirmations (task memory's proposals).
|
|
83
|
+
* Outside the terminal it is Pi's confirm, unchanged; without a UI it is false.
|
|
84
|
+
*/
|
|
85
|
+
export async function confirmWithUser(ctx, title, message, options = {}) {
|
|
86
|
+
if (!ctx?.hasUI || !ctx.ui) return false;
|
|
87
|
+
if (ctx.mode !== "tui" || typeof ctx.ui.custom !== "function")
|
|
88
|
+
return Boolean(
|
|
89
|
+
await ctx.ui.confirm(
|
|
90
|
+
title,
|
|
91
|
+
message,
|
|
92
|
+
...(options.timeoutMs !== undefined ? [{ timeout: options.timeoutMs }] : []),
|
|
93
|
+
),
|
|
94
|
+
);
|
|
95
|
+
const header = title.replace(/\?$/, "").slice(0, 40);
|
|
96
|
+
const yes = options.yes ?? "Yes";
|
|
97
|
+
const outcome = await askUser(
|
|
98
|
+
ctx,
|
|
99
|
+
[{ question: message, header, options: [{ label: yes }, { label: options.no ?? "No" }] }],
|
|
100
|
+
undefined,
|
|
101
|
+
{
|
|
102
|
+
ownAnswer: false,
|
|
103
|
+
notes: false,
|
|
104
|
+
...(options.timeoutMs !== undefined ? { deadline: Date.now() + options.timeoutMs } : {}),
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
return outcome.status === "answered" && outcome.answers[0]?.selected[0] === yes;
|
|
108
|
+
}
|