@entelligentsia/forgecli 1.0.2 → 1.0.10
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/CHANGELOG.md +67 -0
- package/README.md +2 -1
- package/dist/CHANGELOG-forge-plugin.md +124 -0
- package/dist/CHANGELOG-pi.md +94 -0
- package/dist/extensions/forgecli/audience-gate.js +1 -1
- package/dist/extensions/forgecli/audience-gate.js.map +1 -1
- package/dist/extensions/forgecli/fix-bug.d.ts +1 -2
- package/dist/extensions/forgecli/fix-bug.js +678 -609
- package/dist/extensions/forgecli/fix-bug.js.map +1 -1
- package/dist/extensions/forgecli/forge-artifact-tool.js +42 -7
- package/dist/extensions/forgecli/forge-artifact-tool.js.map +1 -1
- package/dist/extensions/forgecli/forge-subagent.d.ts +17 -0
- package/dist/extensions/forgecli/forge-subagent.js +31 -12
- package/dist/extensions/forgecli/forge-subagent.js.map +1 -1
- package/dist/extensions/forgecli/forge-tools.d.ts +6 -0
- package/dist/extensions/forgecli/forge-tools.js +71 -8
- package/dist/extensions/forgecli/forge-tools.js.map +1 -1
- package/dist/extensions/forgecli/run-task.js +461 -391
- package/dist/extensions/forgecli/run-task.js.map +1 -1
- package/dist/extensions/forgecli/session-registry.d.ts +12 -0
- package/dist/extensions/forgecli/session-registry.js +23 -0
- package/dist/extensions/forgecli/session-registry.js.map +1 -1
- package/dist/extensions/forgecli/subagent/caller-context.d.ts +35 -11
- package/dist/extensions/forgecli/subagent/caller-context.js +49 -21
- package/dist/extensions/forgecli/subagent/caller-context.js.map +1 -1
- package/dist/extensions/forgecli/subagent/orchestrator-transcript.d.ts +66 -0
- package/dist/extensions/forgecli/subagent/orchestrator-transcript.js +66 -0
- package/dist/extensions/forgecli/subagent/orchestrator-transcript.js.map +1 -0
- package/dist/extensions/forgecli/subagent/phase-guard.d.ts +34 -0
- package/dist/extensions/forgecli/subagent/phase-guard.js +149 -0
- package/dist/extensions/forgecli/subagent/phase-guard.js.map +1 -0
- package/dist/extensions/forgecli/subagent/phase-summary-map.d.ts +2 -0
- package/dist/extensions/forgecli/subagent/phase-summary-map.js +39 -0
- package/dist/extensions/forgecli/subagent/phase-summary-map.js.map +1 -0
- package/dist/extensions/forgecli/thread-switcher.js +2 -2
- package/dist/extensions/forgecli/thread-switcher.js.map +1 -1
- package/dist/extensions/forgecli/viewport-events.d.ts +4 -0
- package/dist/extensions/forgecli/viewport-events.js +18 -1
- package/dist/extensions/forgecli/viewport-events.js.map +1 -1
- package/dist/extensions/forgecli/viewport-renderer.d.ts +12 -2
- package/dist/extensions/forgecli/viewport-renderer.js +8 -6
- package/dist/extensions/forgecli/viewport-renderer.js.map +1 -1
- package/dist/forge-payload/.base-pack/workflows/_fragments/store-cli-verbs.md +18 -3
- package/dist/forge-payload/.base-pack/workflows/architect_approve.md +4 -5
- package/dist/forge-payload/.base-pack/workflows/collator_agent.md +1 -1
- package/dist/forge-payload/.base-pack/workflows/commit_task.md +2 -3
- package/dist/forge-payload/.base-pack/workflows/fix_bug.md +10 -28
- package/dist/forge-payload/.base-pack/workflows/implement_plan.md +3 -2
- package/dist/forge-payload/.base-pack/workflows/orchestrate_task.md +41 -47
- package/dist/forge-payload/.base-pack/workflows/triage.md +190 -0
- package/dist/forge-payload/.base-pack/workflows/validate_task.md +2 -3
- package/dist/forge-payload/.claude-plugin/plugin.json +1 -1
- package/dist/forge-payload/.schemas/_defs/locator.schema.json +13 -0
- package/dist/forge-payload/.schemas/bug.schema.json +1 -0
- package/dist/forge-payload/.schemas/enum-catalog.json +2 -2
- package/dist/forge-payload/.schemas/migrations.json +72 -0
- package/dist/forge-payload/.schemas/sprint.schema.json +1 -0
- package/dist/forge-payload/.schemas/task.schema.json +1 -0
- package/dist/forge-payload/integrity.json +3 -3
- package/dist/forge-payload/meta/fragments/tool-discipline.md +21 -2
- package/dist/forge-payload/meta/workflows/_fragments/store-cli-verbs.md +18 -3
- package/dist/forge-payload/meta/workflows/meta-approve.md +4 -5
- package/dist/forge-payload/meta/workflows/meta-bug-triage.md +210 -0
- package/dist/forge-payload/meta/workflows/meta-collate.md +1 -1
- package/dist/forge-payload/meta/workflows/meta-commit.md +2 -3
- package/dist/forge-payload/meta/workflows/meta-fix-bug.md +10 -28
- package/dist/forge-payload/meta/workflows/meta-implement.md +3 -2
- package/dist/forge-payload/meta/workflows/meta-orchestrate.md +41 -47
- package/dist/forge-payload/meta/workflows/meta-validate.md +2 -3
- package/dist/forge-payload/schemas/_defs/locator.schema.json +13 -0
- package/dist/forge-payload/schemas/bug.schema.json +1 -0
- package/dist/forge-payload/schemas/enum-catalog.json +2 -2
- package/dist/forge-payload/schemas/sprint.schema.json +1 -0
- package/dist/forge-payload/schemas/structure-manifest.json +22 -2
- package/dist/forge-payload/schemas/task.schema.json +1 -0
- package/dist/forge-payload/tools/artifact-store.cjs +242 -0
- package/dist/forge-payload/tools/artifact.cjs +69 -100
- package/dist/forge-payload/tools/lib/artifact-kinds.cjs +95 -0
- package/dist/forge-payload/tools/lib/store-nlp.cjs +6 -0
- package/dist/forge-payload/tools/lib/store-query-exec.cjs +39 -5
- package/dist/forge-payload/tools/lib/suggest.cjs +2 -1
- package/dist/forge-payload/tools/preflight-gate.cjs +55 -5
- package/dist/forge-payload/tools/store-cli.cjs +50 -15
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts +5 -2
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js +81 -18
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/agent-harness.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/branch-summarization.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js +19 -24
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts +1 -0
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js +14 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/session.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts +22 -8
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-agent-core/package.json +3 -3
- package/node_modules/@earendil-works/pi-ai/README.md +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts +374 -122
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js +424 -232
- package/node_modules/@earendil-works/pi-ai/dist/models.generated.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js +38 -2
- package/node_modules/@earendil-works/pi-ai/dist/providers/amazon-bedrock.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js +21 -12
- package/node_modules/@earendil-works/pi-ai/dist/providers/anthropic.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js +6 -10
- package/node_modules/@earendil-works/pi-ai/dist/providers/azure-openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google-vertex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.js +5 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/google.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js +3 -4
- package/node_modules/@earendil-works/pi-ai/dist/providers/images/openrouter.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js +2 -3
- package/node_modules/@earendil-works/pi-ai/dist/providers/mistral.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js +159 -78
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-codex-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js +16 -11
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-completions.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js +4 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses-shared.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js +6 -10
- package/node_modules/@earendil-works/pi-ai/dist/providers/openai-responses.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/providers/simple-options.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/stream.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/stream.js +14 -2
- package/node_modules/@earendil-works/pi-ai/dist/stream.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts +14 -4
- package/node_modules/@earendil-works/pi-ai/dist/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.d.ts +6 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js +34 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/abort-signals.js.map +1 -0
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts +9 -7
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js +8 -7
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/device-code.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/github-copilot.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts +10 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js +179 -79
- package/node_modules/@earendil-works/pi-ai/dist/utils/oauth/openai-codex.js.map +1 -1
- package/node_modules/@earendil-works/pi-ai/package.json +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/CHANGELOG.md +94 -0
- package/node_modules/@earendil-works/pi-coding-agent/README.md +9 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js +27 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/cli/args.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js +15 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/config.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session-services.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts +5 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js +28 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js +18 -24
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/compaction/compaction.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js +8 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts +7 -5
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/extensions/types.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js +65 -13
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-registry.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/model-resolver.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.d.ts +9 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.js +134 -11
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js +10 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/sdk.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.d.ts +6 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js +75 -28
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/session-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js +14 -9
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js +0 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/system-prompt.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js +7 -10
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/edit.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/find.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/grep.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js +5 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/ls.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js +6 -7
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/read.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts +5 -2
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js +17 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/render-utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js +5 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/core/tools/write.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.js +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js +69 -16
- package/node_modules/@earendil-works/pi-coding-agent/dist/main.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.js +118 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/migrations.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts +1 -3
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js +2 -4
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/login-dialog.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/components/user-message.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js +59 -6
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js +10 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/interactive/theme/theme.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js +3 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-mode.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/modes/rpc/rpc-types.js.map +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/deprecation.d.ts +4 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/deprecation.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/deprecation.js +13 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/deprecation.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/json.d.ts +3 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/json.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/json.js +7 -0
- package/node_modules/@earendil-works/pi-coding-agent/dist/utils/json.js.map +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/custom-provider.md +13 -10
- package/node_modules/@earendil-works/pi-coding-agent/docs/development.md +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/extensions.md +12 -6
- package/node_modules/@earendil-works/pi-coding-agent/docs/models.md +25 -12
- package/node_modules/@earendil-works/pi-coding-agent/docs/providers.md +13 -5
- package/node_modules/@earendil-works/pi-coding-agent/docs/quickstart.md +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/rpc.md +2 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/sdk.md +6 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/session-format.md +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/docs/sessions.md +8 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/settings.md +7 -3
- package/node_modules/@earendil-works/pi-coding-agent/docs/terminal-setup.md +2 -0
- package/node_modules/@earendil-works/pi-coding-agent/docs/tui.md +2 -2
- package/node_modules/@earendil-works/pi-coding-agent/docs/usage.md +9 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/README.md +1 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/index.ts +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/index.ts +54 -3
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/git-merge-and-resolve.ts +115 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/input-transform-streaming.ts +39 -0
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/sandbox/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/examples/extensions/with-deps/package.json +1 -1
- package/node_modules/@earendil-works/pi-coding-agent/npm-shrinkwrap.json +443 -61
- package/node_modules/@earendil-works/pi-coding-agent/package.json +6 -6
- package/node_modules/@earendil-works/pi-tui/README.md +2 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js +24 -83
- package/node_modules/@earendil-works/pi-tui/dist/components/editor.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js +7 -55
- package/node_modules/@earendil-works/pi-tui/dist/components/input.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts +7 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js +12 -2
- package/node_modules/@earendil-works/pi-tui/dist/components/markdown.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/index.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js +34 -7
- package/node_modules/@earendil-works/pi-tui/dist/terminal-image.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts +33 -10
- package/node_modules/@earendil-works/pi-tui/dist/terminal.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js +172 -37
- package/node_modules/@earendil-works/pi-tui/dist/terminal.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts +6 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.d.ts.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/utils.js +27 -15
- package/node_modules/@earendil-works/pi-tui/dist/utils.js.map +1 -1
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts +25 -0
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.d.ts.map +1 -0
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js +96 -0
- package/node_modules/@earendil-works/pi-tui/dist/word-navigation.js.map +1 -0
- package/node_modules/@earendil-works/pi-tui/package.json +2 -2
- package/node_modules/@entelligentsia/forge-compress/LICENSE +21 -0
- package/node_modules/@entelligentsia/forge-compress/README.md +85 -0
- package/node_modules/@entelligentsia/forge-compress/dist/compressor.d.ts +6 -0
- package/node_modules/@entelligentsia/forge-compress/dist/compressor.js +137 -0
- package/node_modules/@entelligentsia/forge-compress/dist/entropy.d.ts +3 -0
- package/node_modules/@entelligentsia/forge-compress/dist/entropy.js +99 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/entity.d.ts +8 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/entity.js +149 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/index.d.ts +7 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/index.js +4 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/markdown.d.ts +5 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/markdown.js +92 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/query.d.ts +7 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/query.js +60 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/validate.d.ts +1 -0
- package/node_modules/@entelligentsia/forge-compress/dist/forge/validate.js +82 -0
- package/node_modules/@entelligentsia/forge-compress/dist/index.d.ts +6 -0
- package/node_modules/@entelligentsia/forge-compress/dist/index.js +5 -0
- package/node_modules/@entelligentsia/forge-compress/dist/progressive.d.ts +1 -0
- package/node_modules/@entelligentsia/forge-compress/dist/progressive.js +108 -0
- package/node_modules/@entelligentsia/forge-compress/dist/strip.d.ts +4 -0
- package/node_modules/@entelligentsia/forge-compress/dist/strip.js +55 -0
- package/node_modules/@entelligentsia/forge-compress/dist/tokens.d.ts +2 -0
- package/node_modules/@entelligentsia/forge-compress/dist/tokens.js +17 -0
- package/node_modules/@entelligentsia/forge-compress/package.json +45 -0
- package/node_modules/@entelligentsia/forge-compress/src/__tests__/compress.test.ts +409 -0
- package/node_modules/@entelligentsia/forge-compress/src/compressor.ts +147 -0
- package/node_modules/@entelligentsia/forge-compress/src/entropy.ts +105 -0
- package/node_modules/@entelligentsia/forge-compress/src/forge/entity.ts +184 -0
- package/node_modules/@entelligentsia/forge-compress/src/forge/index.ts +10 -0
- package/node_modules/@entelligentsia/forge-compress/src/forge/markdown.ts +122 -0
- package/node_modules/@entelligentsia/forge-compress/src/forge/query.ts +105 -0
- package/node_modules/@entelligentsia/forge-compress/src/forge/validate.ts +86 -0
- package/node_modules/@entelligentsia/forge-compress/src/index.ts +22 -0
- package/node_modules/@entelligentsia/forge-compress/src/progressive.ts +123 -0
- package/node_modules/@entelligentsia/forge-compress/src/strip.ts +58 -0
- package/node_modules/@entelligentsia/forge-compress/src/tokens.ts +19 -0
- package/node_modules/@mariozechner/clipboard/Cargo.toml +3 -3
- package/node_modules/@mariozechner/clipboard/index.d.ts +34 -20
- package/node_modules/@mariozechner/clipboard/index.js +546 -257
- package/node_modules/@mariozechner/clipboard/package.json +5 -6
- package/node_modules/@mariozechner/clipboard/package.json.prepack-backup +14 -14
- package/node_modules/@mariozechner/clipboard/src/lib.rs +4 -9
- package/node_modules/@mariozechner/clipboard-linux-x64-gnu/clipboard.linux-x64-gnu.node +0 -0
- package/node_modules/@mariozechner/clipboard-linux-x64-gnu/package.json +2 -2
- package/package.json +11 -16
- package/dist/forge-payload/.base-pack/commands/quiz-agent.md +0 -6
- package/dist/forge-payload/.base-pack/commands/retrospective.md +0 -6
- package/dist/forge-payload/.base-pack/commands/sprint-intake.md +0 -6
- package/dist/forge-payload/.base-pack/commands/sprint-plan.md +0 -6
- package/dist/forge-payload/commands/calibrate.md +0 -10
- package/dist/forge-payload/commands/materialize.md +0 -119
- package/dist/forge-payload/commands/migrate.md +0 -12
- package/dist/forge-payload/commands/quiz-agent.md +0 -6
- package/dist/forge-payload/commands/regenerate.md +0 -6
- package/dist/forge-payload/commands/store-query.md +0 -6
- package/dist/forge-payload/commands/store-repair.md +0 -6
- package/dist/forge-payload/commands/update-tools.md +0 -10
- package/dist/forge-payload/meta/templates/meta-retrospective.md +0 -28
- package/dist/forge-payload/tools/prompts/sprint-plan-prompt.md +0 -70
- package/dist/forge-payload/tools/schemas/task-list.schema.json +0 -53
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts +0 -4
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js +0 -3
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/execution-env.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts +0 -20
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js +0 -92
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/jsonl.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts +0 -18
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js +0 -42
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/memory.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts +0 -10
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js +0 -31
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/repo/shared.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts +0 -30
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js +0 -170
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/jsonl.js.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts +0 -26
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.d.ts.map +0 -1
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js +0 -90
- package/node_modules/@earendil-works/pi-agent-core/dist/harness/session/storage/memory.js.map +0 -1
- package/node_modules/@mariozechner/clipboard-linux-x64-musl/README.md +0 -3
- package/node_modules/@mariozechner/clipboard-linux-x64-musl/clipboard.linux-x64-musl.node +0 -0
- package/node_modules/@mariozechner/clipboard-linux-x64-musl/package.json +0 -25
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { countTokens } from "./tokens.js";
|
|
2
|
+
import { stripAnsi, stripTimestampsAndHashes, normalizeWhitespace, isBoilerplate, } from "./strip.js";
|
|
3
|
+
export function lightweightCleanup(content) {
|
|
4
|
+
const lines = content.split("\n");
|
|
5
|
+
const total = lines.length;
|
|
6
|
+
const result = [];
|
|
7
|
+
let blankCount = 0;
|
|
8
|
+
let braceRun = [];
|
|
9
|
+
const flushBraceRun = () => {
|
|
10
|
+
if (total <= 200 || braceRun.length <= 5) {
|
|
11
|
+
result.push(...braceRun);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
result.push(braceRun[0], braceRun[1]);
|
|
15
|
+
result.push(`[${braceRun.length - 2} brace-only lines collapsed]`);
|
|
16
|
+
}
|
|
17
|
+
braceRun = [];
|
|
18
|
+
};
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
const trimmed = line.trim();
|
|
21
|
+
if (!trimmed) {
|
|
22
|
+
flushBraceRun();
|
|
23
|
+
blankCount++;
|
|
24
|
+
if (blankCount <= 1)
|
|
25
|
+
result.push("");
|
|
26
|
+
continue;
|
|
27
|
+
}
|
|
28
|
+
blankCount = 0;
|
|
29
|
+
if (/^[}\]);]+$/.test(trimmed)) {
|
|
30
|
+
braceRun.push(trimmed);
|
|
31
|
+
continue;
|
|
32
|
+
}
|
|
33
|
+
flushBraceRun();
|
|
34
|
+
result.push(line);
|
|
35
|
+
}
|
|
36
|
+
flushBraceRun();
|
|
37
|
+
return result.join("\n");
|
|
38
|
+
}
|
|
39
|
+
export function verbatimCompact(text) {
|
|
40
|
+
const lines = [];
|
|
41
|
+
let blankCount = 0;
|
|
42
|
+
let prevLine = null;
|
|
43
|
+
let repeatCount = 0;
|
|
44
|
+
const flushRepeats = () => {
|
|
45
|
+
if (repeatCount > 1 && prevLine !== null) {
|
|
46
|
+
const lastIdx = lines.length - 1;
|
|
47
|
+
if (lastIdx >= 0) {
|
|
48
|
+
lines[lastIdx] = `[${repeatCount}x] ${prevLine}`;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
repeatCount = 0;
|
|
52
|
+
prevLine = null;
|
|
53
|
+
};
|
|
54
|
+
for (const line of text.split("\n")) {
|
|
55
|
+
const trimmed = line.trim();
|
|
56
|
+
if (!trimmed) {
|
|
57
|
+
blankCount++;
|
|
58
|
+
if (blankCount <= 1) {
|
|
59
|
+
flushRepeats();
|
|
60
|
+
lines.push("");
|
|
61
|
+
}
|
|
62
|
+
continue;
|
|
63
|
+
}
|
|
64
|
+
blankCount = 0;
|
|
65
|
+
if (isBoilerplate(trimmed))
|
|
66
|
+
continue;
|
|
67
|
+
const normalized = normalizeWhitespace(trimmed);
|
|
68
|
+
const stripped = stripTimestampsAndHashes(normalized);
|
|
69
|
+
if (prevLine !== null && prevLine === stripped) {
|
|
70
|
+
repeatCount++;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
flushRepeats();
|
|
74
|
+
prevLine = stripped;
|
|
75
|
+
repeatCount = 1;
|
|
76
|
+
lines.push(stripped);
|
|
77
|
+
}
|
|
78
|
+
flushRepeats();
|
|
79
|
+
return lines.join("\n");
|
|
80
|
+
}
|
|
81
|
+
export function aggressiveCompress(content, ext) {
|
|
82
|
+
const result = [];
|
|
83
|
+
const isPython = ext === "py";
|
|
84
|
+
const isHtml = ext === "html" || ext === "htm" || ext === "xml" || ext === "svg";
|
|
85
|
+
const isSql = ext === "sql";
|
|
86
|
+
const isShell = ext === "sh" || ext === "bash" || ext === "zsh" || ext === "fish";
|
|
87
|
+
let inBlockComment = false;
|
|
88
|
+
for (const line of content.split("\n")) {
|
|
89
|
+
const trimmed = line.trim();
|
|
90
|
+
if (!trimmed)
|
|
91
|
+
continue;
|
|
92
|
+
if (inBlockComment) {
|
|
93
|
+
if (trimmed.includes("*/") || (isHtml && trimmed.includes("-->"))) {
|
|
94
|
+
inBlockComment = false;
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
if (trimmed.startsWith("/*") || (isHtml && trimmed.startsWith("<!--"))) {
|
|
99
|
+
if (!(trimmed.includes("*/") || trimmed.includes("-->"))) {
|
|
100
|
+
inBlockComment = true;
|
|
101
|
+
}
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if (trimmed.startsWith("//") && !trimmed.startsWith("///"))
|
|
105
|
+
continue;
|
|
106
|
+
if (trimmed.startsWith("*") || trimmed.startsWith("*/"))
|
|
107
|
+
continue;
|
|
108
|
+
if (isPython && trimmed.startsWith("#"))
|
|
109
|
+
continue;
|
|
110
|
+
if (isSql && trimmed.startsWith("--"))
|
|
111
|
+
continue;
|
|
112
|
+
if (isShell && trimmed.startsWith("#") && !trimmed.startsWith("#!"))
|
|
113
|
+
continue;
|
|
114
|
+
if (/^[}\]);]+$/.test(trimmed)) {
|
|
115
|
+
const last = result[result.length - 1];
|
|
116
|
+
if (last && /^[}\]);]+$/.test(last.trim())) {
|
|
117
|
+
result[result.length - 1] = last + trimmed;
|
|
118
|
+
continue;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
result.push(trimmed);
|
|
122
|
+
}
|
|
123
|
+
return result.join("\n");
|
|
124
|
+
}
|
|
125
|
+
export function safeguardRatio(original, compressed) {
|
|
126
|
+
const origTokens = countTokens(original);
|
|
127
|
+
const compTokens = countTokens(compressed);
|
|
128
|
+
if (origTokens === 0)
|
|
129
|
+
return compressed;
|
|
130
|
+
if (compTokens > origTokens)
|
|
131
|
+
return original;
|
|
132
|
+
const ratio = compTokens / origTokens;
|
|
133
|
+
if (ratio < 0.05 && origTokens < 2000)
|
|
134
|
+
return original;
|
|
135
|
+
return compressed;
|
|
136
|
+
}
|
|
137
|
+
export { stripAnsi };
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { countTokens } from "./tokens.js";
|
|
2
|
+
export function shannonEntropy(text) {
|
|
3
|
+
if (!text)
|
|
4
|
+
return 0;
|
|
5
|
+
const freq = new Map();
|
|
6
|
+
for (const ch of text) {
|
|
7
|
+
freq.set(ch, (freq.get(ch) ?? 0) + 1);
|
|
8
|
+
}
|
|
9
|
+
const len = text.length;
|
|
10
|
+
let entropy = 0;
|
|
11
|
+
for (const count of freq.values()) {
|
|
12
|
+
const p = count / len;
|
|
13
|
+
if (p > 0)
|
|
14
|
+
entropy -= p * Math.log2(p);
|
|
15
|
+
}
|
|
16
|
+
return entropy;
|
|
17
|
+
}
|
|
18
|
+
export function normalizedTokenEntropy(text) {
|
|
19
|
+
if (!text || text.trim().length === 0)
|
|
20
|
+
return 0;
|
|
21
|
+
const words = text.trim().split(/\s+/);
|
|
22
|
+
if (words.length <= 1) {
|
|
23
|
+
const charEntropy = shannonEntropy(text.trim());
|
|
24
|
+
return Math.min(1, charEntropy / 4.5);
|
|
25
|
+
}
|
|
26
|
+
const freq = new Map();
|
|
27
|
+
for (const w of words) {
|
|
28
|
+
freq.set(w, (freq.get(w) ?? 0) + 1);
|
|
29
|
+
}
|
|
30
|
+
const n = words.length;
|
|
31
|
+
const uniqueRatio = freq.size / n;
|
|
32
|
+
let entropy = 0;
|
|
33
|
+
for (const count of freq.values()) {
|
|
34
|
+
const p = count / n;
|
|
35
|
+
if (p > 0)
|
|
36
|
+
entropy -= p * Math.log2(p);
|
|
37
|
+
}
|
|
38
|
+
const maxEntropy = Math.log2(n);
|
|
39
|
+
const normalized = maxEntropy > 0 ? entropy / maxEntropy : 0;
|
|
40
|
+
return Math.min(1, normalized * 0.7 + uniqueRatio * 0.3);
|
|
41
|
+
}
|
|
42
|
+
function renderIb(lines, scores, threshold) {
|
|
43
|
+
const out = [];
|
|
44
|
+
let omitRun = 0;
|
|
45
|
+
for (let i = 0; i < lines.length; i++) {
|
|
46
|
+
if (scores[i] >= threshold) {
|
|
47
|
+
if (omitRun > 0) {
|
|
48
|
+
out.push(`// ... ${omitRun} low-info lines omitted`);
|
|
49
|
+
omitRun = 0;
|
|
50
|
+
}
|
|
51
|
+
out.push(lines[i]);
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
omitRun++;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (omitRun > 0) {
|
|
58
|
+
out.push(`// ... ${omitRun} low-info lines omitted`);
|
|
59
|
+
}
|
|
60
|
+
return out.join("\n");
|
|
61
|
+
}
|
|
62
|
+
export function compressIb(text, targetRatio) {
|
|
63
|
+
if (!text)
|
|
64
|
+
return "";
|
|
65
|
+
const inputTokens = countTokens(text);
|
|
66
|
+
if (inputTokens === 0)
|
|
67
|
+
return text;
|
|
68
|
+
const ratio = Math.max(0.02, Math.min(1.0, targetRatio));
|
|
69
|
+
const lines = text.split("\n");
|
|
70
|
+
const scores = lines.map((ln) => normalizedTokenEntropy(ln));
|
|
71
|
+
let lo = 0;
|
|
72
|
+
let hi = 1;
|
|
73
|
+
let best = renderIb(lines, scores, 0);
|
|
74
|
+
let bestDiff = Infinity;
|
|
75
|
+
const consider = (thr) => {
|
|
76
|
+
const cand = renderIb(lines, scores, thr);
|
|
77
|
+
const r = countTokens(cand) / inputTokens;
|
|
78
|
+
const diff = Math.abs(r - ratio);
|
|
79
|
+
if (diff < bestDiff) {
|
|
80
|
+
bestDiff = diff;
|
|
81
|
+
best = cand;
|
|
82
|
+
}
|
|
83
|
+
return r;
|
|
84
|
+
};
|
|
85
|
+
for (let i = 0; i < 26; i++) {
|
|
86
|
+
const mid = (lo + hi) / 2;
|
|
87
|
+
const r = consider(mid);
|
|
88
|
+
if (r > ratio) {
|
|
89
|
+
lo = mid;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
hi = mid;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
for (const thr of [0, 1, lo, hi, (lo + hi) / 2]) {
|
|
96
|
+
consider(thr);
|
|
97
|
+
}
|
|
98
|
+
return best;
|
|
99
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface CompressEntityOptions {
|
|
2
|
+
keepSummaries?: boolean | "latest" | "all";
|
|
3
|
+
maxKeyChanges?: number;
|
|
4
|
+
flatFormat?: boolean;
|
|
5
|
+
maxTokens?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function compressEntity(input: string, opts?: CompressEntityOptions): string;
|
|
8
|
+
export declare function compressEntityList(input: string, opts?: CompressEntityOptions): string;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
import { countTokens } from "../tokens.js";
|
|
2
|
+
const PHASE_ORDER = [
|
|
3
|
+
"plan",
|
|
4
|
+
"triage",
|
|
5
|
+
"review_plan",
|
|
6
|
+
"implementation",
|
|
7
|
+
"code_review",
|
|
8
|
+
"validation",
|
|
9
|
+
"approve",
|
|
10
|
+
];
|
|
11
|
+
export function compressEntity(input, opts) {
|
|
12
|
+
let entity;
|
|
13
|
+
try {
|
|
14
|
+
entity = JSON.parse(input);
|
|
15
|
+
}
|
|
16
|
+
catch {
|
|
17
|
+
return input;
|
|
18
|
+
}
|
|
19
|
+
const keepSummaries = opts?.keepSummaries ?? "latest";
|
|
20
|
+
const maxKeyChanges = opts?.maxKeyChanges ?? 3;
|
|
21
|
+
const result = {};
|
|
22
|
+
const idKey = findIdKey(entity);
|
|
23
|
+
if (idKey)
|
|
24
|
+
result[idKey] = entity[idKey];
|
|
25
|
+
if (entity.title)
|
|
26
|
+
result.title = entity.title;
|
|
27
|
+
if (entity.status)
|
|
28
|
+
result.status = entity.status;
|
|
29
|
+
if (entity.sprintId)
|
|
30
|
+
result.sprintId = entity.sprintId;
|
|
31
|
+
if (entity.feature_id)
|
|
32
|
+
result.feature_id = entity.feature_id;
|
|
33
|
+
if (entity.severity)
|
|
34
|
+
result.severity = entity.severity;
|
|
35
|
+
if (entity.estimate)
|
|
36
|
+
result.estimate = entity.estimate;
|
|
37
|
+
if (entity.executionMode)
|
|
38
|
+
result.executionMode = entity.executionMode;
|
|
39
|
+
if (entity.pipeline)
|
|
40
|
+
result.pipeline = entity.pipeline;
|
|
41
|
+
if (Array.isArray(entity.taskIds)) {
|
|
42
|
+
result.taskIds = entity.taskIds;
|
|
43
|
+
result.taskCount = entity.taskIds.length;
|
|
44
|
+
}
|
|
45
|
+
if (Array.isArray(entity.dependencies) && entity.dependencies.length > 0) {
|
|
46
|
+
result.dependencies = entity.dependencies;
|
|
47
|
+
}
|
|
48
|
+
const summaries = entity.summaries;
|
|
49
|
+
if (summaries && typeof summaries === "object") {
|
|
50
|
+
if (keepSummaries === "all") {
|
|
51
|
+
result.summaries = compressSummaries(summaries, maxKeyChanges);
|
|
52
|
+
}
|
|
53
|
+
else if (keepSummaries === "latest") {
|
|
54
|
+
const latest = findLatestPhase(summaries);
|
|
55
|
+
if (latest) {
|
|
56
|
+
result.latestPhase = latest.phase;
|
|
57
|
+
result.latestSummary = compressOneSummary(latest.summary, maxKeyChanges);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
if (opts?.flatFormat) {
|
|
62
|
+
return formatFlat(result);
|
|
63
|
+
}
|
|
64
|
+
let output = JSON.stringify(result, null, 2);
|
|
65
|
+
if (opts?.maxTokens && countTokens(output) > opts.maxTokens) {
|
|
66
|
+
output = JSON.stringify(result);
|
|
67
|
+
}
|
|
68
|
+
return output;
|
|
69
|
+
}
|
|
70
|
+
export function compressEntityList(input, opts) {
|
|
71
|
+
let entities;
|
|
72
|
+
try {
|
|
73
|
+
entities = JSON.parse(input);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return input;
|
|
77
|
+
}
|
|
78
|
+
if (!Array.isArray(entities))
|
|
79
|
+
return input;
|
|
80
|
+
const compressed = entities.map((e) => JSON.parse(compressEntity(JSON.stringify(e), { ...opts, flatFormat: false })));
|
|
81
|
+
let output = JSON.stringify(compressed, null, 2);
|
|
82
|
+
if (opts?.maxTokens && countTokens(output) > opts.maxTokens) {
|
|
83
|
+
output = JSON.stringify(compressed);
|
|
84
|
+
}
|
|
85
|
+
return output;
|
|
86
|
+
}
|
|
87
|
+
function findIdKey(entity) {
|
|
88
|
+
for (const key of ["taskId", "sprintId", "bugId", "featureId", "id"]) {
|
|
89
|
+
if (entity[key])
|
|
90
|
+
return key;
|
|
91
|
+
}
|
|
92
|
+
return undefined;
|
|
93
|
+
}
|
|
94
|
+
function compressSummaries(summaries, maxKeyChanges) {
|
|
95
|
+
const result = {};
|
|
96
|
+
for (const phase of PHASE_ORDER) {
|
|
97
|
+
if (summaries[phase]) {
|
|
98
|
+
result[phase] = compressOneSummary(summaries[phase], maxKeyChanges);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
return result;
|
|
102
|
+
}
|
|
103
|
+
function compressOneSummary(summary, maxKeyChanges) {
|
|
104
|
+
const result = {};
|
|
105
|
+
if (summary.objective)
|
|
106
|
+
result.objective = summary.objective;
|
|
107
|
+
if (summary.verdict)
|
|
108
|
+
result.verdict = summary.verdict;
|
|
109
|
+
if (summary.key_changes && summary.key_changes.length > 0) {
|
|
110
|
+
const shown = summary.key_changes.slice(0, maxKeyChanges);
|
|
111
|
+
const extra = summary.key_changes.length - maxKeyChanges;
|
|
112
|
+
result.key_changes = extra > 0 ? [...shown, `+${extra} more`] : shown;
|
|
113
|
+
}
|
|
114
|
+
if (summary.route)
|
|
115
|
+
result.route = summary.route;
|
|
116
|
+
return result;
|
|
117
|
+
}
|
|
118
|
+
function findLatestPhase(summaries) {
|
|
119
|
+
for (let i = PHASE_ORDER.length - 1; i >= 0; i--) {
|
|
120
|
+
const phase = PHASE_ORDER[i];
|
|
121
|
+
if (summaries[phase]) {
|
|
122
|
+
return { phase, summary: summaries[phase] };
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
return null;
|
|
126
|
+
}
|
|
127
|
+
function formatFlat(obj, prefix = "") {
|
|
128
|
+
const lines = [];
|
|
129
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
130
|
+
const fullKey = prefix ? `${prefix}.${key}` : key;
|
|
131
|
+
if (value === null || value === undefined)
|
|
132
|
+
continue;
|
|
133
|
+
if (Array.isArray(value)) {
|
|
134
|
+
if (value.length <= 5 && value.every((v) => typeof v === "string")) {
|
|
135
|
+
lines.push(`${fullKey}: ${value.join(", ")}`);
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
lines.push(`${fullKey}: [${value.length} items]`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
else if (typeof value === "object") {
|
|
142
|
+
lines.push(formatFlat(value, fullKey));
|
|
143
|
+
}
|
|
144
|
+
else {
|
|
145
|
+
lines.push(`${fullKey}: ${value}`);
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return lines.filter(Boolean).join("\n");
|
|
149
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { compressStoreQuery } from "./query.js";
|
|
2
|
+
export type { CompressQueryOptions } from "./query.js";
|
|
3
|
+
export { compressEntity, compressEntityList } from "./entity.js";
|
|
4
|
+
export type { CompressEntityOptions } from "./entity.js";
|
|
5
|
+
export { compressMarkdown } from "./markdown.js";
|
|
6
|
+
export type { CompressMarkdownOptions } from "./markdown.js";
|
|
7
|
+
export { compressValidateStore } from "./validate.js";
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { countTokens, truncateToTokenBudget } from "../tokens.js";
|
|
2
|
+
export function compressMarkdown(input, opts) {
|
|
3
|
+
if (!input.trim())
|
|
4
|
+
return "";
|
|
5
|
+
const mode = opts?.mode ?? "map";
|
|
6
|
+
const maxTokens = opts?.maxTokens ?? Infinity;
|
|
7
|
+
switch (mode) {
|
|
8
|
+
case "headings":
|
|
9
|
+
return compressHeadings(input, maxTokens);
|
|
10
|
+
case "truncate":
|
|
11
|
+
return truncateToTokenBudget(input, maxTokens);
|
|
12
|
+
case "map":
|
|
13
|
+
default:
|
|
14
|
+
return compressMap(input, maxTokens);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
function compressMap(input, maxTokens) {
|
|
18
|
+
const lines = input.split("\n");
|
|
19
|
+
const picked = [];
|
|
20
|
+
let inFrontmatter = false;
|
|
21
|
+
let frontmatterDone = false;
|
|
22
|
+
for (let i = 0; i < lines.length; i++) {
|
|
23
|
+
const line = lines[i];
|
|
24
|
+
const trimmed = line.trim();
|
|
25
|
+
if (i === 0 && trimmed === "---") {
|
|
26
|
+
inFrontmatter = true;
|
|
27
|
+
continue;
|
|
28
|
+
}
|
|
29
|
+
if (inFrontmatter) {
|
|
30
|
+
if (trimmed === "---") {
|
|
31
|
+
inFrontmatter = false;
|
|
32
|
+
frontmatterDone = true;
|
|
33
|
+
}
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
if (trimmed.startsWith("#")) {
|
|
37
|
+
picked.push(line);
|
|
38
|
+
continue;
|
|
39
|
+
}
|
|
40
|
+
if (trimmed.startsWith("- **") ||
|
|
41
|
+
trimmed.startsWith("* **") ||
|
|
42
|
+
trimmed.startsWith("| ") ||
|
|
43
|
+
trimmed.startsWith("```")) {
|
|
44
|
+
picked.push(line);
|
|
45
|
+
continue;
|
|
46
|
+
}
|
|
47
|
+
if (trimmed.startsWith("- [ ]") ||
|
|
48
|
+
trimmed.startsWith("- [x]") ||
|
|
49
|
+
trimmed.startsWith("- [X]")) {
|
|
50
|
+
picked.push(line);
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
if (i === 0 || (frontmatterDone && picked.length === 0)) {
|
|
54
|
+
picked.push(line);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
if (picked.length === 0) {
|
|
58
|
+
return truncateToTokenBudget(input, maxTokens);
|
|
59
|
+
}
|
|
60
|
+
const totalLines = lines.length;
|
|
61
|
+
const keptLines = picked.length;
|
|
62
|
+
const omitted = totalLines - keptLines;
|
|
63
|
+
let result = picked.join("\n");
|
|
64
|
+
if (omitted > 0) {
|
|
65
|
+
result += `\n\n[${omitted} body lines omitted — ${totalLines} total]`;
|
|
66
|
+
}
|
|
67
|
+
if (countTokens(result) > maxTokens) {
|
|
68
|
+
result = truncateToTokenBudget(result, maxTokens);
|
|
69
|
+
}
|
|
70
|
+
return result;
|
|
71
|
+
}
|
|
72
|
+
function compressHeadings(input, maxTokens) {
|
|
73
|
+
const lines = input.split("\n");
|
|
74
|
+
const headings = [];
|
|
75
|
+
let depth = 0;
|
|
76
|
+
for (const line of lines) {
|
|
77
|
+
const match = line.match(/^(#{1,6})\s+(.+)/);
|
|
78
|
+
if (match) {
|
|
79
|
+
const level = match[1].length;
|
|
80
|
+
const indent = " ".repeat(level - 1);
|
|
81
|
+
headings.push(`${indent}${match[2]}`);
|
|
82
|
+
depth = Math.max(depth, level);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (headings.length === 0) {
|
|
86
|
+
return truncateToTokenBudget(input, maxTokens);
|
|
87
|
+
}
|
|
88
|
+
const result = `${headings.length} sections (depth ${depth}):\n${headings.join("\n")}`;
|
|
89
|
+
return countTokens(result) > maxTokens
|
|
90
|
+
? truncateToTokenBudget(result, maxTokens)
|
|
91
|
+
: result;
|
|
92
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { countTokens } from "../tokens.js";
|
|
2
|
+
export function compressStoreQuery(input, opts) {
|
|
3
|
+
let envelope;
|
|
4
|
+
try {
|
|
5
|
+
envelope = JSON.parse(input);
|
|
6
|
+
}
|
|
7
|
+
catch {
|
|
8
|
+
return input;
|
|
9
|
+
}
|
|
10
|
+
if (!envelope.results || !Array.isArray(envelope.results))
|
|
11
|
+
return input;
|
|
12
|
+
const keepExcerpts = opts?.keepExcerpts ?? false;
|
|
13
|
+
const maxExcerptLines = opts?.maxExcerptLines ?? 5;
|
|
14
|
+
const maxResults = opts?.maxResults ?? envelope.results.length;
|
|
15
|
+
const results = envelope.results.slice(0, maxResults).map((r) => {
|
|
16
|
+
const entry = {
|
|
17
|
+
id: r.id,
|
|
18
|
+
title: r.title,
|
|
19
|
+
status: r.status,
|
|
20
|
+
type: r.type,
|
|
21
|
+
};
|
|
22
|
+
if (r.relationships && Object.keys(r.relationships).length > 0) {
|
|
23
|
+
const rels = {};
|
|
24
|
+
for (const [k, v] of Object.entries(r.relationships)) {
|
|
25
|
+
if (v !== null && v !== undefined)
|
|
26
|
+
rels[k] = v;
|
|
27
|
+
}
|
|
28
|
+
if (Object.keys(rels).length > 0)
|
|
29
|
+
entry.relationships = rels;
|
|
30
|
+
}
|
|
31
|
+
if (keepExcerpts && r.excerpt) {
|
|
32
|
+
const lines = r.excerpt.split("\n");
|
|
33
|
+
entry.excerpt =
|
|
34
|
+
lines.length > maxExcerptLines
|
|
35
|
+
? lines.slice(0, maxExcerptLines).join("\n") +
|
|
36
|
+
`\n... (${lines.length - maxExcerptLines} more lines)`
|
|
37
|
+
: r.excerpt;
|
|
38
|
+
}
|
|
39
|
+
return entry;
|
|
40
|
+
});
|
|
41
|
+
const compact = { results };
|
|
42
|
+
if (envelope.query)
|
|
43
|
+
compact.query = envelope.query;
|
|
44
|
+
if (envelope.path)
|
|
45
|
+
compact.path = envelope.path;
|
|
46
|
+
if (typeof envelope.count === "number")
|
|
47
|
+
compact.count = envelope.count;
|
|
48
|
+
if (typeof envelope.totalMatched === "number")
|
|
49
|
+
compact.totalMatched = envelope.totalMatched;
|
|
50
|
+
if (typeof envelope.returned === "number")
|
|
51
|
+
compact.returned = envelope.returned;
|
|
52
|
+
if (envelope.results.length > maxResults) {
|
|
53
|
+
compact.truncated = envelope.results.length - maxResults;
|
|
54
|
+
}
|
|
55
|
+
let output = JSON.stringify(compact, null, 2);
|
|
56
|
+
if (opts?.maxTokens && countTokens(output) > opts.maxTokens) {
|
|
57
|
+
output = JSON.stringify(compact);
|
|
58
|
+
}
|
|
59
|
+
return output;
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compressValidateStore(input: string): string;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export function compressValidateStore(input) {
|
|
2
|
+
let report;
|
|
3
|
+
try {
|
|
4
|
+
report = JSON.parse(input);
|
|
5
|
+
}
|
|
6
|
+
catch {
|
|
7
|
+
return compressPlainValidation(input);
|
|
8
|
+
}
|
|
9
|
+
const errors = (report.errors ?? []);
|
|
10
|
+
const warnings = (report.warnings ?? []);
|
|
11
|
+
const fixes = (report.fixes ?? []);
|
|
12
|
+
const summary = report.summary;
|
|
13
|
+
const parts = [];
|
|
14
|
+
if (summary) {
|
|
15
|
+
const counts = Object.entries(summary)
|
|
16
|
+
.filter(([, v]) => v > 0)
|
|
17
|
+
.map(([k, v]) => `${v} ${k}`)
|
|
18
|
+
.join(", ");
|
|
19
|
+
if (counts)
|
|
20
|
+
parts.push(counts);
|
|
21
|
+
}
|
|
22
|
+
if (errors.length > 0) {
|
|
23
|
+
const grouped = groupBy(errors, "category");
|
|
24
|
+
for (const [cat, items] of Object.entries(grouped)) {
|
|
25
|
+
parts.push(`ERR ${cat} (${items.length}):`);
|
|
26
|
+
for (const item of items.slice(0, 5)) {
|
|
27
|
+
parts.push(` ${item.id}: ${item.message}`);
|
|
28
|
+
}
|
|
29
|
+
if (items.length > 5)
|
|
30
|
+
parts.push(` ... +${items.length - 5} more`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
if (warnings.length > 0) {
|
|
34
|
+
const grouped = groupBy(warnings, "category");
|
|
35
|
+
for (const [cat, items] of Object.entries(grouped)) {
|
|
36
|
+
parts.push(`WARN ${cat} (${items.length}):`);
|
|
37
|
+
for (const item of items.slice(0, 3)) {
|
|
38
|
+
parts.push(` ${item.id}: ${item.message}`);
|
|
39
|
+
}
|
|
40
|
+
if (items.length > 3)
|
|
41
|
+
parts.push(` ... +${items.length - 3} more`);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
if (fixes.length > 0) {
|
|
45
|
+
const applied = fixes.filter((f) => f.applied).length;
|
|
46
|
+
parts.push(`${fixes.length} fixes (${applied} applied)`);
|
|
47
|
+
}
|
|
48
|
+
if (parts.length === 0)
|
|
49
|
+
return "ok (store valid)";
|
|
50
|
+
return parts.join("\n");
|
|
51
|
+
}
|
|
52
|
+
function compressPlainValidation(input) {
|
|
53
|
+
const lines = input.split("\n").filter((l) => l.trim());
|
|
54
|
+
if (lines.length <= 10)
|
|
55
|
+
return input;
|
|
56
|
+
const errors = lines.filter((l) => l.includes("ERROR"));
|
|
57
|
+
const warns = lines.filter((l) => l.includes("WARN"));
|
|
58
|
+
const fixed = lines.filter((l) => l.includes("FIXED"));
|
|
59
|
+
const parts = [];
|
|
60
|
+
if (errors.length > 0) {
|
|
61
|
+
parts.push(`${errors.length} errors:`);
|
|
62
|
+
for (const e of errors.slice(0, 5))
|
|
63
|
+
parts.push(` ${e.trim()}`);
|
|
64
|
+
if (errors.length > 5)
|
|
65
|
+
parts.push(` ... +${errors.length - 5} more`);
|
|
66
|
+
}
|
|
67
|
+
if (warns.length > 0)
|
|
68
|
+
parts.push(`${warns.length} warnings`);
|
|
69
|
+
if (fixed.length > 0)
|
|
70
|
+
parts.push(`${fixed.length} fixed`);
|
|
71
|
+
return parts.length > 0 ? parts.join("\n") : input;
|
|
72
|
+
}
|
|
73
|
+
function groupBy(items, key) {
|
|
74
|
+
const result = {};
|
|
75
|
+
for (const item of items) {
|
|
76
|
+
const k = String(item[key] ?? "unknown");
|
|
77
|
+
if (!result[k])
|
|
78
|
+
result[k] = [];
|
|
79
|
+
result[k].push(item);
|
|
80
|
+
}
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { compressStoreQuery, compressEntity, compressEntityList, compressMarkdown, compressValidateStore, } from "./forge/index.js";
|
|
2
|
+
export type { CompressQueryOptions, CompressEntityOptions, CompressMarkdownOptions, } from "./forge/index.js";
|
|
3
|
+
export { countTokens, truncateToTokenBudget } from "./tokens.js";
|
|
4
|
+
export { compressIb } from "./entropy.js";
|
|
5
|
+
export { compressProgressive } from "./progressive.js";
|
|
6
|
+
export { lightweightCleanup, verbatimCompact, stripAnsi, } from "./compressor.js";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { compressStoreQuery, compressEntity, compressEntityList, compressMarkdown, compressValidateStore, } from "./forge/index.js";
|
|
2
|
+
export { countTokens, truncateToTokenBudget } from "./tokens.js";
|
|
3
|
+
export { compressIb } from "./entropy.js";
|
|
4
|
+
export { compressProgressive } from "./progressive.js";
|
|
5
|
+
export { lightweightCleanup, verbatimCompact, stripAnsi, } from "./compressor.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function compressProgressive(segments: string[], budgetTokens: number): string[];
|