@ruverd/julius 0.0.0-stage → 0.24.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/CHANGELOG.md +31 -0
- package/CREDITS.md +25 -0
- package/LICENSE +21 -0
- package/PROVENANCE.md +9 -0
- package/README.md +225 -2
- package/dist/ai/crux.d.ts +60 -0
- package/dist/ai/crux.d.ts.map +1 -0
- package/dist/ai/crux.js +141 -0
- package/dist/ai/crux.js.map +1 -0
- package/dist/ai/failure.d.ts +60 -0
- package/dist/ai/failure.d.ts.map +1 -0
- package/dist/ai/failure.js +86 -0
- package/dist/ai/failure.js.map +1 -0
- package/dist/ai/llm/anthropic.d.ts +37 -0
- package/dist/ai/llm/anthropic.d.ts.map +1 -0
- package/dist/ai/llm/anthropic.js +144 -0
- package/dist/ai/llm/anthropic.js.map +1 -0
- package/dist/ai/llm/factory.d.ts +28 -0
- package/dist/ai/llm/factory.d.ts.map +1 -0
- package/dist/ai/llm/factory.js +36 -0
- package/dist/ai/llm/factory.js.map +1 -0
- package/dist/ai/llm/litellm.d.ts +34 -0
- package/dist/ai/llm/litellm.d.ts.map +1 -0
- package/dist/ai/llm/litellm.js +45 -0
- package/dist/ai/llm/litellm.js.map +1 -0
- package/dist/ai/llm/openai.d.ts +44 -0
- package/dist/ai/llm/openai.d.ts.map +1 -0
- package/dist/ai/llm/openai.js +239 -0
- package/dist/ai/llm/openai.js.map +1 -0
- package/dist/ai/llm/orcarouter.d.ts +34 -0
- package/dist/ai/llm/orcarouter.d.ts.map +1 -0
- package/dist/ai/llm/orcarouter.js +45 -0
- package/dist/ai/llm/orcarouter.js.map +1 -0
- package/dist/ai/llm/recover-tool.d.ts +19 -0
- package/dist/ai/llm/recover-tool.d.ts.map +1 -0
- package/dist/ai/llm/recover-tool.js +109 -0
- package/dist/ai/llm/recover-tool.js.map +1 -0
- package/dist/ai/llm/types.d.ts +122 -0
- package/dist/ai/llm/types.d.ts.map +1 -0
- package/dist/ai/llm/types.js +33 -0
- package/dist/ai/llm/types.js.map +1 -0
- package/dist/ai/providers.d.ts +59 -0
- package/dist/ai/providers.d.ts.map +1 -0
- package/dist/ai/providers.js +54 -0
- package/dist/ai/providers.js.map +1 -0
- package/dist/ai/summarize.d.ts +25 -0
- package/dist/ai/summarize.d.ts.map +1 -0
- package/dist/ai/summarize.js +34 -0
- package/dist/ai/summarize.js.map +1 -0
- package/dist/ai/synthesize.d.ts +40 -0
- package/dist/ai/synthesize.d.ts.map +1 -0
- package/dist/ai/synthesize.js +131 -0
- package/dist/ai/synthesize.js.map +1 -0
- package/dist/app/checkout.d.ts +46 -0
- package/dist/app/checkout.d.ts.map +1 -0
- package/dist/app/checkout.js +223 -0
- package/dist/app/checkout.js.map +1 -0
- package/dist/app/events.d.ts +44 -0
- package/dist/app/events.d.ts.map +1 -0
- package/dist/app/events.js +64 -0
- package/dist/app/events.js.map +1 -0
- package/dist/app/identity.d.ts +54 -0
- package/dist/app/identity.d.ts.map +1 -0
- package/dist/app/identity.js +96 -0
- package/dist/app/identity.js.map +1 -0
- package/dist/app/main.d.ts +2 -0
- package/dist/app/main.d.ts.map +1 -0
- package/dist/app/main.js +62 -0
- package/dist/app/main.js.map +1 -0
- package/dist/app/pages.d.ts +56 -0
- package/dist/app/pages.d.ts.map +1 -0
- package/dist/app/pages.js +193 -0
- package/dist/app/pages.js.map +1 -0
- package/dist/app/queue.d.ts +40 -0
- package/dist/app/queue.d.ts.map +1 -0
- package/dist/app/queue.js +68 -0
- package/dist/app/queue.js.map +1 -0
- package/dist/app/review-process.d.ts +66 -0
- package/dist/app/review-process.d.ts.map +1 -0
- package/dist/app/review-process.js +200 -0
- package/dist/app/review-process.js.map +1 -0
- package/dist/app/review-worker.d.ts +2 -0
- package/dist/app/review-worker.d.ts.map +1 -0
- package/dist/app/review-worker.js +108 -0
- package/dist/app/review-worker.js.map +1 -0
- package/dist/app/review.d.ts +23 -0
- package/dist/app/review.d.ts.map +1 -0
- package/dist/app/review.js +142 -0
- package/dist/app/review.js.map +1 -0
- package/dist/app/server.d.ts +49 -0
- package/dist/app/server.d.ts.map +1 -0
- package/dist/app/server.js +123 -0
- package/dist/app/server.js.map +1 -0
- package/dist/ask/ask.d.ts +195 -0
- package/dist/ask/ask.d.ts.map +1 -0
- package/dist/ask/ask.js +1252 -0
- package/dist/ask/ask.js.map +1 -0
- package/dist/ask/file-rank.d.ts +72 -0
- package/dist/ask/file-rank.d.ts.map +1 -0
- package/dist/ask/file-rank.js +160 -0
- package/dist/ask/file-rank.js.map +1 -0
- package/dist/ask/file-selection.d.ts +22 -0
- package/dist/ask/file-selection.d.ts.map +1 -0
- package/dist/ask/file-selection.js +66 -0
- package/dist/ask/file-selection.js.map +1 -0
- package/dist/ask/fuse.d.ts +195 -0
- package/dist/ask/fuse.d.ts.map +1 -0
- package/dist/ask/fuse.js +344 -0
- package/dist/ask/fuse.js.map +1 -0
- package/dist/ask/graphrank.d.ts +61 -0
- package/dist/ask/graphrank.d.ts.map +1 -0
- package/dist/ask/graphrank.js +130 -0
- package/dist/ask/graphrank.js.map +1 -0
- package/dist/ask/index-file.d.ts +44 -0
- package/dist/ask/index-file.d.ts.map +1 -0
- package/dist/ask/index-file.js +128 -0
- package/dist/ask/index-file.js.map +1 -0
- package/dist/bin/julius.d.ts +3 -0
- package/dist/bin/julius.d.ts.map +1 -0
- package/dist/bin/julius.js +4 -0
- package/dist/bin/julius.js.map +1 -0
- package/dist/blast/blast-cli.d.ts +35 -0
- package/dist/blast/blast-cli.d.ts.map +1 -0
- package/dist/blast/blast-cli.js +155 -0
- package/dist/blast/blast-cli.js.map +1 -0
- package/dist/blast/blast.d.ts +128 -0
- package/dist/blast/blast.d.ts.map +1 -0
- package/dist/blast/blast.js +383 -0
- package/dist/blast/blast.js.map +1 -0
- package/dist/blast/diff.d.ts +53 -0
- package/dist/blast/diff.d.ts.map +1 -0
- package/dist/blast/diff.js +193 -0
- package/dist/blast/diff.js.map +1 -0
- package/dist/blast/evidence.d.ts +51 -0
- package/dist/blast/evidence.d.ts.map +1 -0
- package/dist/blast/evidence.js +162 -0
- package/dist/blast/evidence.js.map +1 -0
- package/dist/blast/modules.d.ts +33 -0
- package/dist/blast/modules.d.ts.map +1 -0
- package/dist/blast/modules.js +83 -0
- package/dist/blast/modules.js.map +1 -0
- package/dist/blast/name.d.ts +74 -0
- package/dist/blast/name.d.ts.map +1 -0
- package/dist/blast/name.js +269 -0
- package/dist/blast/name.js.map +1 -0
- package/dist/blast/owners.d.ts +85 -0
- package/dist/blast/owners.d.ts.map +1 -0
- package/dist/blast/owners.js +272 -0
- package/dist/blast/owners.js.map +1 -0
- package/dist/blast/render.d.ts +46 -0
- package/dist/blast/render.d.ts.map +1 -0
- package/dist/blast/render.js +422 -0
- package/dist/blast/render.js.map +1 -0
- package/dist/blast/viz.d.ts +37 -0
- package/dist/blast/viz.d.ts.map +1 -0
- package/dist/blast/viz.js +180 -0
- package/dist/blast/viz.js.map +1 -0
- package/dist/brand.d.ts +13 -0
- package/dist/brand.d.ts.map +1 -0
- package/dist/brand.js +43 -0
- package/dist/brand.js.map +1 -0
- package/dist/check/learning-edits.d.ts +9 -0
- package/dist/check/learning-edits.d.ts.map +1 -0
- package/dist/check/learning-edits.js +62 -0
- package/dist/check/learning-edits.js.map +1 -0
- package/dist/check/local-check.d.ts +104 -0
- package/dist/check/local-check.d.ts.map +1 -0
- package/dist/check/local-check.js +830 -0
- package/dist/check/local-check.js.map +1 -0
- package/dist/check/types.d.ts +31 -0
- package/dist/check/types.d.ts.map +1 -0
- package/dist/check/types.js +2 -0
- package/dist/check/types.js.map +1 -0
- package/dist/claude/build-progress.d.ts +29 -0
- package/dist/claude/build-progress.d.ts.map +1 -0
- package/dist/claude/build-progress.js +76 -0
- package/dist/claude/build-progress.js.map +1 -0
- package/dist/claude/format.d.ts +131 -0
- package/dist/claude/format.d.ts.map +1 -0
- package/dist/claude/format.js +328 -0
- package/dist/claude/format.js.map +1 -0
- package/dist/claude/hook-layers.d.ts +8 -0
- package/dist/claude/hook-layers.d.ts.map +1 -0
- package/dist/claude/hook-layers.js +74 -0
- package/dist/claude/hook-layers.js.map +1 -0
- package/dist/claude/hooks.d.ts +101 -0
- package/dist/claude/hooks.d.ts.map +1 -0
- package/dist/claude/hooks.js +849 -0
- package/dist/claude/hooks.js.map +1 -0
- package/dist/claude/init.d.ts +70 -0
- package/dist/claude/init.d.ts.map +1 -0
- package/dist/claude/init.js +207 -0
- package/dist/claude/init.js.map +1 -0
- package/dist/claude/note-signals.d.ts +28 -0
- package/dist/claude/note-signals.d.ts.map +1 -0
- package/dist/claude/note-signals.js +325 -0
- package/dist/claude/note-signals.js.map +1 -0
- package/dist/claude/paths.d.ts +9 -0
- package/dist/claude/paths.d.ts.map +1 -0
- package/dist/claude/paths.js +22 -0
- package/dist/claude/paths.js.map +1 -0
- package/dist/claude/session-metrics.d.ts +73 -0
- package/dist/claude/session-metrics.d.ts.map +1 -0
- package/dist/claude/session-metrics.js +209 -0
- package/dist/claude/session-metrics.js.map +1 -0
- package/dist/claude/settings-merge.d.ts +66 -0
- package/dist/claude/settings-merge.d.ts.map +1 -0
- package/dist/claude/settings-merge.js +249 -0
- package/dist/claude/settings-merge.js.map +1 -0
- package/dist/claude/shim-template.d.ts +18 -0
- package/dist/claude/shim-template.d.ts.map +1 -0
- package/dist/claude/shim-template.js +226 -0
- package/dist/claude/shim-template.js.map +1 -0
- package/dist/claude/skill-template.d.ts +12 -0
- package/dist/claude/skill-template.d.ts.map +1 -0
- package/dist/claude/skill-template.js +294 -0
- package/dist/claude/skill-template.js.map +1 -0
- package/dist/claude/state.d.ts +73 -0
- package/dist/claude/state.d.ts.map +1 -0
- package/dist/claude/state.js +33 -0
- package/dist/claude/state.js.map +1 -0
- package/dist/claude/stats.d.ts +5 -0
- package/dist/claude/stats.d.ts.map +1 -0
- package/dist/claude/stats.js +24 -0
- package/dist/claude/stats.js.map +1 -0
- package/dist/claude/statusline.d.ts +14 -0
- package/dist/claude/statusline.d.ts.map +1 -0
- package/dist/claude/statusline.js +45 -0
- package/dist/claude/statusline.js.map +1 -0
- package/dist/claude/sync-run.d.ts +3 -0
- package/dist/claude/sync-run.d.ts.map +1 -0
- package/dist/claude/sync-run.js +46 -0
- package/dist/claude/sync-run.js.map +1 -0
- package/dist/claude/tally.d.ts +50 -0
- package/dist/claude/tally.d.ts.map +1 -0
- package/dist/claude/tally.js +211 -0
- package/dist/claude/tally.js.map +1 -0
- package/dist/cli-epilogue.d.ts +12 -0
- package/dist/cli-epilogue.d.ts.map +1 -0
- package/dist/cli-epilogue.js +55 -0
- package/dist/cli-epilogue.js.map +1 -0
- package/dist/cli-meta.d.ts +45 -0
- package/dist/cli-meta.d.ts.map +1 -0
- package/dist/cli-meta.js +145 -0
- package/dist/cli-meta.js.map +1 -0
- package/dist/cli-picker.d.ts +129 -0
- package/dist/cli-picker.d.ts.map +1 -0
- package/dist/cli-picker.js +432 -0
- package/dist/cli-picker.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +2213 -0
- package/dist/cli.js.map +1 -0
- package/dist/cloud/diff.d.ts +20 -0
- package/dist/cloud/diff.d.ts.map +1 -0
- package/dist/cloud/diff.js +59 -0
- package/dist/cloud/diff.js.map +1 -0
- package/dist/cloud/nudge.d.ts +66 -0
- package/dist/cloud/nudge.d.ts.map +1 -0
- package/dist/cloud/nudge.js +268 -0
- package/dist/cloud/nudge.js.map +1 -0
- package/dist/cloud/workspace-sync.d.ts +58 -0
- package/dist/cloud/workspace-sync.d.ts.map +1 -0
- package/dist/cloud/workspace-sync.js +268 -0
- package/dist/cloud/workspace-sync.js.map +1 -0
- package/dist/cloud/workspace.d.ts +159 -0
- package/dist/cloud/workspace.d.ts.map +1 -0
- package/dist/cloud/workspace.js +134 -0
- package/dist/cloud/workspace.js.map +1 -0
- package/dist/context/build.d.ts +52 -0
- package/dist/context/build.d.ts.map +1 -0
- package/dist/context/build.js +362 -0
- package/dist/context/build.js.map +1 -0
- package/dist/context/check.d.ts +42 -0
- package/dist/context/check.d.ts.map +1 -0
- package/dist/context/check.js +162 -0
- package/dist/context/check.js.map +1 -0
- package/dist/context/map-dir.d.ts +4 -0
- package/dist/context/map-dir.d.ts.map +1 -0
- package/dist/context/map-dir.js +6 -0
- package/dist/context/map-dir.js.map +1 -0
- package/dist/context/node-file.d.ts +109 -0
- package/dist/context/node-file.d.ts.map +1 -0
- package/dist/context/node-file.js +362 -0
- package/dist/context/node-file.js.map +1 -0
- package/dist/context/price.d.ts +49 -0
- package/dist/context/price.d.ts.map +1 -0
- package/dist/context/price.js +83 -0
- package/dist/context/price.js.map +1 -0
- package/dist/context/savings.d.ts +26 -0
- package/dist/context/savings.d.ts.map +1 -0
- package/dist/context/savings.js +59 -0
- package/dist/context/savings.js.map +1 -0
- package/dist/economy/cli.d.ts +3 -0
- package/dist/economy/cli.d.ts.map +1 -0
- package/dist/economy/cli.js +52 -0
- package/dist/economy/cli.js.map +1 -0
- package/dist/economy/delivery.d.ts +49 -0
- package/dist/economy/delivery.d.ts.map +1 -0
- package/dist/economy/delivery.js +176 -0
- package/dist/economy/delivery.js.map +1 -0
- package/dist/economy/index.d.ts +67 -0
- package/dist/economy/index.d.ts.map +1 -0
- package/dist/economy/index.js +519 -0
- package/dist/economy/index.js.map +1 -0
- package/dist/engine.d.ts +83 -0
- package/dist/engine.d.ts.map +1 -0
- package/dist/engine.js +122 -0
- package/dist/engine.js.map +1 -0
- package/dist/evaluation/index.d.ts +41 -0
- package/dist/evaluation/index.d.ts.map +1 -0
- package/dist/evaluation/index.js +61 -0
- package/dist/evaluation/index.js.map +1 -0
- package/dist/graph/bindings.d.ts +64 -0
- package/dist/graph/bindings.d.ts.map +1 -0
- package/dist/graph/bindings.js +713 -0
- package/dist/graph/bindings.js.map +1 -0
- package/dist/graph/build.d.ts +88 -0
- package/dist/graph/build.d.ts.map +1 -0
- package/dist/graph/build.js +375 -0
- package/dist/graph/build.js.map +1 -0
- package/dist/graph/cards.d.ts +46 -0
- package/dist/graph/cards.d.ts.map +1 -0
- package/dist/graph/cards.js +280 -0
- package/dist/graph/cards.js.map +1 -0
- package/dist/graph/check.d.ts +25 -0
- package/dist/graph/check.d.ts.map +1 -0
- package/dist/graph/check.js +192 -0
- package/dist/graph/check.js.map +1 -0
- package/dist/graph/container.d.ts +63 -0
- package/dist/graph/container.d.ts.map +1 -0
- package/dist/graph/container.js +190 -0
- package/dist/graph/container.js.map +1 -0
- package/dist/graph/enrich.d.ts +62 -0
- package/dist/graph/enrich.d.ts.map +1 -0
- package/dist/graph/enrich.js +253 -0
- package/dist/graph/enrich.js.map +1 -0
- package/dist/graph/extract-cache.d.ts +101 -0
- package/dist/graph/extract-cache.d.ts.map +1 -0
- package/dist/graph/extract-cache.js +199 -0
- package/dist/graph/extract-cache.js.map +1 -0
- package/dist/graph/extract.d.ts +85 -0
- package/dist/graph/extract.d.ts.map +1 -0
- package/dist/graph/extract.js +2376 -0
- package/dist/graph/extract.js.map +1 -0
- package/dist/graph/fingerprint.d.ts +76 -0
- package/dist/graph/fingerprint.d.ts.map +1 -0
- package/dist/graph/fingerprint.js +160 -0
- package/dist/graph/fingerprint.js.map +1 -0
- package/dist/graph/generic.d.ts +74 -0
- package/dist/graph/generic.d.ts.map +1 -0
- package/dist/graph/generic.js +580 -0
- package/dist/graph/generic.js.map +1 -0
- package/dist/graph/invariants.d.ts +33 -0
- package/dist/graph/invariants.d.ts.map +1 -0
- package/dist/graph/invariants.js +52 -0
- package/dist/graph/invariants.js.map +1 -0
- package/dist/graph/load.d.ts +29 -0
- package/dist/graph/load.d.ts.map +1 -0
- package/dist/graph/load.js +97 -0
- package/dist/graph/load.js.map +1 -0
- package/dist/graph/lsp/client.d.ts +43 -0
- package/dist/graph/lsp/client.d.ts.map +1 -0
- package/dist/graph/lsp/client.js +179 -0
- package/dist/graph/lsp/client.js.map +1 -0
- package/dist/graph/lsp/enrich.d.ts +11 -0
- package/dist/graph/lsp/enrich.d.ts.map +1 -0
- package/dist/graph/lsp/enrich.js +155 -0
- package/dist/graph/lsp/enrich.js.map +1 -0
- package/dist/graph/lsp/registry.d.ts +15 -0
- package/dist/graph/lsp/registry.d.ts.map +1 -0
- package/dist/graph/lsp/registry.js +46 -0
- package/dist/graph/lsp/registry.js.map +1 -0
- package/dist/graph/map.d.ts +107 -0
- package/dist/graph/map.d.ts.map +1 -0
- package/dist/graph/map.js +239 -0
- package/dist/graph/map.js.map +1 -0
- package/dist/graph/native.d.ts +38 -0
- package/dist/graph/native.d.ts.map +1 -0
- package/dist/graph/native.js +169 -0
- package/dist/graph/native.js.map +1 -0
- package/dist/graph/queries/c.scm +13 -0
- package/dist/graph/queries/c_sharp.scm +19 -0
- package/dist/graph/queries/clojure.scm +58 -0
- package/dist/graph/queries/cpp.scm +23 -0
- package/dist/graph/queries/dart.scm +42 -0
- package/dist/graph/queries/elixir.scm +54 -0
- package/dist/graph/queries/java.scm +20 -0
- package/dist/graph/queries/kotlin.scm +43 -0
- package/dist/graph/queries/lua.scm +36 -0
- package/dist/graph/queries/nix.scm +32 -0
- package/dist/graph/queries/php.scm +40 -0
- package/dist/graph/queries/ruby.scm +65 -0
- package/dist/graph/queries/rust.scm +41 -0
- package/dist/graph/queries/scala.scm +66 -0
- package/dist/graph/queries/solidity.scm +43 -0
- package/dist/graph/queries/swift.scm +51 -0
- package/dist/graph/refresh.d.ts +49 -0
- package/dist/graph/refresh.d.ts.map +1 -0
- package/dist/graph/refresh.js +255 -0
- package/dist/graph/refresh.js.map +1 -0
- package/dist/graph/relations.d.ts +14 -0
- package/dist/graph/relations.d.ts.map +1 -0
- package/dist/graph/relations.js +8 -0
- package/dist/graph/relations.js.map +1 -0
- package/dist/graph/resolve.d.ts +17 -0
- package/dist/graph/resolve.d.ts.map +1 -0
- package/dist/graph/resolve.js +654 -0
- package/dist/graph/resolve.js.map +1 -0
- package/dist/graph/root.d.ts +11 -0
- package/dist/graph/root.d.ts.map +1 -0
- package/dist/graph/root.js +40 -0
- package/dist/graph/root.js.map +1 -0
- package/dist/graph/scopes.d.ts +42 -0
- package/dist/graph/scopes.d.ts.map +1 -0
- package/dist/graph/scopes.js +342 -0
- package/dist/graph/scopes.js.map +1 -0
- package/dist/graph/seed.d.ts +38 -0
- package/dist/graph/seed.d.ts.map +1 -0
- package/dist/graph/seed.js +226 -0
- package/dist/graph/seed.js.map +1 -0
- package/dist/graph/source-files.d.ts +40 -0
- package/dist/graph/source-files.d.ts.map +1 -0
- package/dist/graph/source-files.js +85 -0
- package/dist/graph/source-files.js.map +1 -0
- package/dist/graph/traverse-cli.d.ts +55 -0
- package/dist/graph/traverse-cli.d.ts.map +1 -0
- package/dist/graph/traverse-cli.js +189 -0
- package/dist/graph/traverse-cli.js.map +1 -0
- package/dist/graph/traverse.d.ts +112 -0
- package/dist/graph/traverse.d.ts.map +1 -0
- package/dist/graph/traverse.js +192 -0
- package/dist/graph/traverse.js.map +1 -0
- package/dist/graph/types.d.ts +78 -0
- package/dist/graph/types.d.ts.map +1 -0
- package/dist/graph/types.js +14 -0
- package/dist/graph/types.js.map +1 -0
- package/dist/graph/workspace-cli.d.ts +48 -0
- package/dist/graph/workspace-cli.d.ts.map +1 -0
- package/dist/graph/workspace-cli.js +102 -0
- package/dist/graph/workspace-cli.js.map +1 -0
- package/dist/graph/workspace.d.ts +135 -0
- package/dist/graph/workspace.d.ts.map +1 -0
- package/dist/graph/workspace.js +598 -0
- package/dist/graph/workspace.js.map +1 -0
- package/dist/graph/write.d.ts +13 -0
- package/dist/graph/write.d.ts.map +1 -0
- package/dist/graph/write.js +86 -0
- package/dist/graph/write.js.map +1 -0
- package/dist/hosts/antigravity.d.ts +8 -0
- package/dist/hosts/antigravity.d.ts.map +1 -0
- package/dist/hosts/antigravity.js +42 -0
- package/dist/hosts/antigravity.js.map +1 -0
- package/dist/hosts/claude-global.d.ts +36 -0
- package/dist/hosts/claude-global.d.ts.map +1 -0
- package/dist/hosts/claude-global.js +153 -0
- package/dist/hosts/claude-global.js.map +1 -0
- package/dist/hosts/codex-hooks.d.ts +11 -0
- package/dist/hosts/codex-hooks.d.ts.map +1 -0
- package/dist/hosts/codex-hooks.js +80 -0
- package/dist/hosts/codex-hooks.js.map +1 -0
- package/dist/hosts/config-write.d.ts +36 -0
- package/dist/hosts/config-write.d.ts.map +1 -0
- package/dist/hosts/config-write.js +64 -0
- package/dist/hosts/config-write.js.map +1 -0
- package/dist/hosts/cursor-hooks.d.ts +21 -0
- package/dist/hosts/cursor-hooks.d.ts.map +1 -0
- package/dist/hosts/cursor-hooks.js +103 -0
- package/dist/hosts/cursor-hooks.js.map +1 -0
- package/dist/hosts/init.d.ts +26 -0
- package/dist/hosts/init.d.ts.map +1 -0
- package/dist/hosts/init.js +82 -0
- package/dist/hosts/init.js.map +1 -0
- package/dist/hosts/install.d.ts +12 -0
- package/dist/hosts/install.d.ts.map +1 -0
- package/dist/hosts/install.js +347 -0
- package/dist/hosts/install.js.map +1 -0
- package/dist/hosts/instructions.d.ts +7 -0
- package/dist/hosts/instructions.d.ts.map +1 -0
- package/dist/hosts/instructions.js +71 -0
- package/dist/hosts/instructions.js.map +1 -0
- package/dist/hosts/investigation-instructions.d.ts +2 -0
- package/dist/hosts/investigation-instructions.d.ts.map +1 -0
- package/dist/hosts/investigation-instructions.js +2 -0
- package/dist/hosts/investigation-instructions.js.map +1 -0
- package/dist/hosts/mcp-config.d.ts +59 -0
- package/dist/hosts/mcp-config.d.ts.map +1 -0
- package/dist/hosts/mcp-config.js +229 -0
- package/dist/hosts/mcp-config.js.map +1 -0
- package/dist/hosts/plan.d.ts +32 -0
- package/dist/hosts/plan.d.ts.map +1 -0
- package/dist/hosts/plan.js +77 -0
- package/dist/hosts/plan.js.map +1 -0
- package/dist/hosts/registry.d.ts +35 -0
- package/dist/hosts/registry.d.ts.map +1 -0
- package/dist/hosts/registry.js +157 -0
- package/dist/hosts/registry.js.map +1 -0
- package/dist/hosts/retract.d.ts +47 -0
- package/dist/hosts/retract.d.ts.map +1 -0
- package/dist/hosts/retract.js +541 -0
- package/dist/hosts/retract.js.map +1 -0
- package/dist/hosts/sections.d.ts +46 -0
- package/dist/hosts/sections.d.ts.map +1 -0
- package/dist/hosts/sections.js +126 -0
- package/dist/hosts/sections.js.map +1 -0
- package/dist/index.d.ts +43 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/ingest/fs.d.ts +79 -0
- package/dist/ingest/fs.d.ts.map +1 -0
- package/dist/ingest/fs.js +307 -0
- package/dist/ingest/fs.js.map +1 -0
- package/dist/init-guard.d.ts +11 -0
- package/dist/init-guard.d.ts.map +1 -0
- package/dist/init-guard.js +21 -0
- package/dist/init-guard.js.map +1 -0
- package/dist/investigation/index.d.ts +57 -0
- package/dist/investigation/index.d.ts.map +1 -0
- package/dist/investigation/index.js +315 -0
- package/dist/investigation/index.js.map +1 -0
- package/dist/mcp/compact.d.ts +9 -0
- package/dist/mcp/compact.d.ts.map +1 -0
- package/dist/mcp/compact.js +133 -0
- package/dist/mcp/compact.js.map +1 -0
- package/dist/mcp/instructions.d.ts +5 -0
- package/dist/mcp/instructions.d.ts.map +1 -0
- package/dist/mcp/instructions.js +57 -0
- package/dist/mcp/instructions.js.map +1 -0
- package/dist/mcp/server.d.ts +7 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +128 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/tool-names.d.ts +20 -0
- package/dist/mcp/tool-names.d.ts.map +1 -0
- package/dist/mcp/tool-names.js +36 -0
- package/dist/mcp/tool-names.js.map +1 -0
- package/dist/mcp/tools.d.ts +22 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +300 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/notes/ask-notes.d.ts +8 -0
- package/dist/notes/ask-notes.d.ts.map +1 -0
- package/dist/notes/ask-notes.js +19 -0
- package/dist/notes/ask-notes.js.map +1 -0
- package/dist/notes/branches.d.ts +102 -0
- package/dist/notes/branches.d.ts.map +1 -0
- package/dist/notes/branches.js +304 -0
- package/dist/notes/branches.js.map +1 -0
- package/dist/notes/cold-start.d.ts +177 -0
- package/dist/notes/cold-start.d.ts.map +1 -0
- package/dist/notes/cold-start.js +537 -0
- package/dist/notes/cold-start.js.map +1 -0
- package/dist/notes/edit-overlap.d.ts +62 -0
- package/dist/notes/edit-overlap.d.ts.map +1 -0
- package/dist/notes/edit-overlap.js +202 -0
- package/dist/notes/edit-overlap.js.map +1 -0
- package/dist/notes/git-facts.d.ts +21 -0
- package/dist/notes/git-facts.d.ts.map +1 -0
- package/dist/notes/git-facts.js +121 -0
- package/dist/notes/git-facts.js.map +1 -0
- package/dist/notes/home.d.ts +87 -0
- package/dist/notes/home.d.ts.map +1 -0
- package/dist/notes/home.js +430 -0
- package/dist/notes/home.js.map +1 -0
- package/dist/notes/learning-fields.d.ts +102 -0
- package/dist/notes/learning-fields.d.ts.map +1 -0
- package/dist/notes/learning-fields.js +217 -0
- package/dist/notes/learning-fields.js.map +1 -0
- package/dist/notes/note-gate.d.ts +42 -0
- package/dist/notes/note-gate.d.ts.map +1 -0
- package/dist/notes/note-gate.js +181 -0
- package/dist/notes/note-gate.js.map +1 -0
- package/dist/notes/notes.d.ts +214 -0
- package/dist/notes/notes.d.ts.map +1 -0
- package/dist/notes/notes.js +591 -0
- package/dist/notes/notes.js.map +1 -0
- package/dist/notes/pr-reviews.d.ts +108 -0
- package/dist/notes/pr-reviews.d.ts.map +1 -0
- package/dist/notes/pr-reviews.js +325 -0
- package/dist/notes/pr-reviews.js.map +1 -0
- package/dist/notes/repo-julius.d.ts +18 -0
- package/dist/notes/repo-julius.d.ts.map +1 -0
- package/dist/notes/repo-julius.js +111 -0
- package/dist/notes/repo-julius.js.map +1 -0
- package/dist/notes/session-cost.d.ts +35 -0
- package/dist/notes/session-cost.d.ts.map +1 -0
- package/dist/notes/session-cost.js +276 -0
- package/dist/notes/session-cost.js.map +1 -0
- package/dist/search/grep-cli.d.ts +35 -0
- package/dist/search/grep-cli.d.ts.map +1 -0
- package/dist/search/grep-cli.js +115 -0
- package/dist/search/grep-cli.js.map +1 -0
- package/dist/search/grep.d.ts +60 -0
- package/dist/search/grep.d.ts.map +1 -0
- package/dist/search/grep.js +176 -0
- package/dist/search/grep.js.map +1 -0
- package/dist/search/ignored-code.d.ts +9 -0
- package/dist/search/ignored-code.d.ts.map +1 -0
- package/dist/search/ignored-code.js +73 -0
- package/dist/search/ignored-code.js.map +1 -0
- package/dist/skills/skills.d.ts +118 -0
- package/dist/skills/skills.d.ts.map +1 -0
- package/dist/skills/skills.js +370 -0
- package/dist/skills/skills.js.map +1 -0
- package/dist/telemetry/contract.d.ts +103 -0
- package/dist/telemetry/contract.d.ts.map +1 -0
- package/dist/telemetry/contract.js +270 -0
- package/dist/telemetry/contract.js.map +1 -0
- package/dist/telemetry/flush.d.ts +21 -0
- package/dist/telemetry/flush.d.ts.map +1 -0
- package/dist/telemetry/flush.js +85 -0
- package/dist/telemetry/flush.js.map +1 -0
- package/dist/telemetry/gate.d.ts +30 -0
- package/dist/telemetry/gate.d.ts.map +1 -0
- package/dist/telemetry/gate.js +81 -0
- package/dist/telemetry/gate.js.map +1 -0
- package/dist/telemetry/identity.d.ts +40 -0
- package/dist/telemetry/identity.d.ts.map +1 -0
- package/dist/telemetry/identity.js +80 -0
- package/dist/telemetry/identity.js.map +1 -0
- package/dist/telemetry/index.d.ts +18 -0
- package/dist/telemetry/index.d.ts.map +1 -0
- package/dist/telemetry/index.js +16 -0
- package/dist/telemetry/index.js.map +1 -0
- package/dist/telemetry/key.d.ts +4 -0
- package/dist/telemetry/key.d.ts.map +1 -0
- package/dist/telemetry/key.js +4 -0
- package/dist/telemetry/key.js.map +1 -0
- package/dist/telemetry/notice.d.ts +19 -0
- package/dist/telemetry/notice.d.ts.map +1 -0
- package/dist/telemetry/notice.js +93 -0
- package/dist/telemetry/notice.js.map +1 -0
- package/dist/telemetry/queue.d.ts +35 -0
- package/dist/telemetry/queue.d.ts.map +1 -0
- package/dist/telemetry/queue.js +162 -0
- package/dist/telemetry/queue.js.map +1 -0
- package/dist/telemetry/send.d.ts +19 -0
- package/dist/telemetry/send.d.ts.map +1 -0
- package/dist/telemetry/send.js +84 -0
- package/dist/telemetry/send.js.map +1 -0
- package/dist/telemetry/sessions.d.ts +25 -0
- package/dist/telemetry/sessions.d.ts.map +1 -0
- package/dist/telemetry/sessions.js +104 -0
- package/dist/telemetry/sessions.js.map +1 -0
- package/dist/telemetry/track.d.ts +62 -0
- package/dist/telemetry/track.d.ts.map +1 -0
- package/dist/telemetry/track.js +142 -0
- package/dist/telemetry/track.js.map +1 -0
- package/dist/upkeep-run.d.ts +15 -0
- package/dist/upkeep-run.d.ts.map +1 -0
- package/dist/upkeep-run.js +71 -0
- package/dist/upkeep-run.js.map +1 -0
- package/dist/upkeep.d.ts +125 -0
- package/dist/upkeep.d.ts.map +1 -0
- package/dist/upkeep.js +255 -0
- package/dist/upkeep.js.map +1 -0
- package/dist/util/browser.d.ts +3 -0
- package/dist/util/browser.d.ts.map +1 -0
- package/dist/util/browser.js +14 -0
- package/dist/util/browser.js.map +1 -0
- package/dist/util/front-matter.d.ts +19 -0
- package/dist/util/front-matter.d.ts.map +1 -0
- package/dist/util/front-matter.js +21 -0
- package/dist/util/front-matter.js.map +1 -0
- package/dist/util/id.d.ts +7 -0
- package/dist/util/id.d.ts.map +1 -0
- package/dist/util/id.js +14 -0
- package/dist/util/id.js.map +1 -0
- package/dist/util/paths.d.ts +29 -0
- package/dist/util/paths.d.ts.map +1 -0
- package/dist/util/paths.js +71 -0
- package/dist/util/paths.js.map +1 -0
- package/dist/util/source.d.ts +4 -0
- package/dist/util/source.d.ts.map +1 -0
- package/dist/util/source.js +12 -0
- package/dist/util/source.js.map +1 -0
- package/dist/util/spinner.d.ts +15 -0
- package/dist/util/spinner.d.ts.map +1 -0
- package/dist/util/spinner.js +52 -0
- package/dist/util/spinner.js.map +1 -0
- package/dist/util/state.d.ts +100 -0
- package/dist/util/state.d.ts.map +1 -0
- package/dist/util/state.js +186 -0
- package/dist/util/state.js.map +1 -0
- package/dist/viewer/app.js +2 -0
- package/dist/viewer/index.html +49 -0
- package/dist/viewer/style.css +154 -0
- package/dist/viz/assemble.d.ts +83 -0
- package/dist/viz/assemble.d.ts.map +1 -0
- package/dist/viz/assemble.js +101 -0
- package/dist/viz/assemble.js.map +1 -0
- package/dist/viz/export.d.ts +39 -0
- package/dist/viz/export.d.ts.map +1 -0
- package/dist/viz/export.js +98 -0
- package/dist/viz/export.js.map +1 -0
- package/dist/viz/serve.d.ts +12 -0
- package/dist/viz/serve.d.ts.map +1 -0
- package/dist/viz/serve.js +129 -0
- package/dist/viz/serve.js.map +1 -0
- package/docs/assets/context-benchmark.svg +31 -0
- package/docs/assets/julius-hero.png +0 -0
- package/docs/upstream-changelog.md +785 -0
- package/package.json +138 -4
|
@@ -0,0 +1,270 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The telemetry contract: the complete, machine-enforced list of what julius may
|
|
3
|
+
* send. `TELEMETRY.md` is the same list in prose, and the two are kept in
|
|
4
|
+
* lockstep — an event or property that is not in this file cannot be sent, and
|
|
5
|
+
* one that is not in `TELEMETRY.md` must not be added here.
|
|
6
|
+
*
|
|
7
|
+
* Why an allowlist rather than a review rule: every telemetry incident in the
|
|
8
|
+
* tools we studied came from a call site quietly adding a property nobody
|
|
9
|
+
* audited. `track()` (track.ts) drops unknown events and unknown keys instead of
|
|
10
|
+
* trusting its callers, so a future `track('query', { path })` sends `query`
|
|
11
|
+
* with no `path` rather than leaking one. The blast radius of a careless call
|
|
12
|
+
* site is "we lose a metric", never "we received someone's source tree".
|
|
13
|
+
*
|
|
14
|
+
* The other half of that guarantee is the value side: every number crosses as a
|
|
15
|
+
* BUCKET and every string as a member of a fixed union. A raw file count plus a
|
|
16
|
+
* language set starts to fingerprint a specific repo; `"100-500"` does not. A
|
|
17
|
+
* raw error message is a path, a symbol, and sometimes a snippet of code; an
|
|
18
|
+
* enum member is not.
|
|
19
|
+
*
|
|
20
|
+
* This module is pure — no I/O, no config, no clock. It is the file a reviewer
|
|
21
|
+
* (or a suspicious user, since the repo is public) reads to verify the claim.
|
|
22
|
+
*/
|
|
23
|
+
/* -------------------------------------------------------------------------- */
|
|
24
|
+
/* the event → allowed-property-keys map */
|
|
25
|
+
/* -------------------------------------------------------------------------- */
|
|
26
|
+
/**
|
|
27
|
+
* The contract itself. Common properties (see {@link COMMON_KEYS}) are stamped
|
|
28
|
+
* centrally by `track()` and are deliberately not repeated per event.
|
|
29
|
+
*/
|
|
30
|
+
export const EVENTS = {
|
|
31
|
+
/** Once per machine per version, from the npm postinstall hook. The real
|
|
32
|
+
* denominator: a machine that installs julius and never runs a command emits
|
|
33
|
+
* this event and no other, so it is the only place the "installed, never
|
|
34
|
+
* used" leak is visible at all. Version-scoped rather than once-ever so an
|
|
35
|
+
* upgrade counts; distinct install ids still give unique machines.
|
|
36
|
+
* `global` separates `npm i -g julius` from a project dependency, which is
|
|
37
|
+
* roughly the difference between a person and a lockfile. */
|
|
38
|
+
install: new Set(['global']),
|
|
39
|
+
/** Once per machine, the first time a command actually runs. Paired with
|
|
40
|
+
* `install`, the gap between the two is the top of the funnel. */
|
|
41
|
+
first_run: new Set(),
|
|
42
|
+
/** `julius init` completed. Tells us which agents people actually wire, and
|
|
43
|
+
* how many decline telemetry at the picker. */
|
|
44
|
+
init_completed: new Set(['agents', 'consent']),
|
|
45
|
+
/** A build finished. The activation event — an install that never reaches one
|
|
46
|
+
* of these is the funnel leak we most want to see. */
|
|
47
|
+
build_completed: new Set(['files_bucket', 'langs', 'mode', 'duration_bucket', 'incremental']),
|
|
48
|
+
/** A build threw. `stage`/`code` are enums; the message never travels. */
|
|
49
|
+
build_failed: new Set(['stage', 'code']),
|
|
50
|
+
/** One query, from any surface. The DAU backbone and the dead-command detector. */
|
|
51
|
+
query: new Set(['command', 'surface', 'hit', 'notes']),
|
|
52
|
+
/** A julius command handing the agent a sign-in link to pass on. Queued the
|
|
53
|
+
* moment the link is printed, so a sign-in somebody walked away from is still
|
|
54
|
+
* counted — the settle below never fires for those. */
|
|
55
|
+
brain_signup_opened: new Set(['mode', 'command', 'wording']),
|
|
56
|
+
/** That handoff reaching an end. `outcome` is a closed set, so the reason a
|
|
57
|
+
* signup failed travels as a category and never as the error's own words. */
|
|
58
|
+
brain_signup_settled: new Set(['outcome', 'mode', 'duration_bucket']),
|
|
59
|
+
/** `julius note` saved a session note (into `~/.julius/`). Whether it carries
|
|
60
|
+
* a cost, and how many files it is about, as a bucket. The title, the text
|
|
61
|
+
* and the paths never travel. The supply side of the notes loop; the
|
|
62
|
+
* `notes` property on `query` is the demand side. */
|
|
63
|
+
note_saved: new Set(['has_cost', 'touches_bucket', 'scope']),
|
|
64
|
+
/** `ask` showed learnings from earlier sessions: whether any was a
|
|
65
|
+
* teammate's, and what they took to work out less reading them, as a
|
|
66
|
+
* bucket. The reuse half of the learnings loop; `note_saved` is supply. */
|
|
67
|
+
learning_reused: new Set(['teammate', 'saved_tokens_bucket']),
|
|
68
|
+
/** Once a day per repo, from the session-start hook, for a repo julius runs
|
|
69
|
+
* in: whether `.julius/` is committed there, how many learnings it holds,
|
|
70
|
+
* as a bucket, and whether this machine shares it with a workspace. With
|
|
71
|
+
* `repo_id` and the install id this counts devs and repos touched, and
|
|
72
|
+
* repos with Julius committed. Paths and names never travel. */
|
|
73
|
+
repo_seen: new Set(['julius_committed', 'learnings_bucket', 'workspace']),
|
|
74
|
+
/** At session start, when the learnings committed on HEAD went up since the
|
|
75
|
+
* last session in that clone: how many came in and how many there are, as
|
|
76
|
+
* buckets, and whether it's the clone's first look. Committed learnings
|
|
77
|
+
* are julius's activation. Paths and titles never travel. */
|
|
78
|
+
learnings_committed: new Set(['added_bucket', 'total_bucket', 'first_look']),
|
|
79
|
+
/** `julius init` read the repo's past Claude sessions, or the review comments
|
|
80
|
+
* on its merged PRs (`source`), for learnings: how it went, how many
|
|
81
|
+
* sessions or reviewed PRs there were, findings Claude offered and julius
|
|
82
|
+
* saved, as buckets, how long it took, and the model. The messages, the
|
|
83
|
+
* comments and the findings never travel. */
|
|
84
|
+
cold_start: new Set(['source', 'outcome', 'sessions_bucket', 'reviews_bucket', 'offered_bucket', 'picked_bucket', 'duration_bucket', 'model']),
|
|
85
|
+
/** `julius learn` saved a correction as a takeaway on a skill (into
|
|
86
|
+
* `~/.julius/`). `new_skill` says whether it started a skill. The text never
|
|
87
|
+
* travels. */
|
|
88
|
+
takeaway_saved: new Set(['new_skill']),
|
|
89
|
+
/** `julius skills fold` wrote waiting takeaways into a skill's SKILL.md;
|
|
90
|
+
* how many, as a bucket. Whether corrections become the skill. */
|
|
91
|
+
skills_folded: new Set(['takeaways_bucket']),
|
|
92
|
+
/** One closed agent session, summarised. `julius_reads` vs `source_reads` is
|
|
93
|
+
* the single number that says whether an agent prefers julius to grep; the two
|
|
94
|
+
* `*_turns` buckets are the follow-up question — of the turns that used julius,
|
|
95
|
+
* how many told the user what it saved. Both are counts of turns, never text. */
|
|
96
|
+
session_summary: new Set([
|
|
97
|
+
'julius_reads_bucket', 'source_reads_bucket', 'saved_tokens_bucket',
|
|
98
|
+
'julius_turns_bucket', 'reported_turns_bucket',
|
|
99
|
+
]),
|
|
100
|
+
};
|
|
101
|
+
/** Stamped on every event by `track()`; not listed per event above. */
|
|
102
|
+
export const COMMON_KEYS = [
|
|
103
|
+
'app_version',
|
|
104
|
+
'os',
|
|
105
|
+
'arch',
|
|
106
|
+
'node_major',
|
|
107
|
+
'ci',
|
|
108
|
+
'agent_host',
|
|
109
|
+
'cli_name',
|
|
110
|
+
'repo_id',
|
|
111
|
+
];
|
|
112
|
+
/**
|
|
113
|
+
* The commands worth counting. A command absent here is simply not reported —
|
|
114
|
+
* `track()` drops the event rather than sending a free-form string, which is
|
|
115
|
+
* what keeps a future `julius <something-user-named>` from becoming a data leak.
|
|
116
|
+
*/
|
|
117
|
+
export const TRACKED_COMMANDS = [
|
|
118
|
+
'ask', 'grep', 'callers', 'skeleton', 'map', 'check', 'blast', 'viz',
|
|
119
|
+
];
|
|
120
|
+
export function isTrackedCommand(name) {
|
|
121
|
+
return TRACKED_COMMANDS.includes(name);
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* How a sign-in handoff ended.
|
|
125
|
+
*
|
|
126
|
+
* Five categories and nothing else, because the alternative — the error string
|
|
127
|
+
* the CLI already prints — carries a repo slug and a URL. `timed_out` and
|
|
128
|
+
* `no_tty` are deliberately apart: one is a person who opened the browser and
|
|
129
|
+
* did not finish, the other is a machine that was never able to open one, and
|
|
130
|
+
* treating them alike would read as a product problem where there is only a
|
|
131
|
+
* remote shell. `stopped` is Ctrl-C while waiting: a person changing their
|
|
132
|
+
* mind, not a browser that never came back.
|
|
133
|
+
*/
|
|
134
|
+
export const BRAIN_SIGNUP_OUTCOMES = ['linked', 'timed_out', 'no_tty', 'bad_callback', 'stopped'];
|
|
135
|
+
/** Where a failing build died. Coarse on purpose: enough to route a bug, not
|
|
136
|
+
* enough to describe anyone's repo. */
|
|
137
|
+
export const BUILD_STAGES = ['walk', 'extract', 'graph', 'summarize', 'synthesize', 'write'];
|
|
138
|
+
/**
|
|
139
|
+
* The failure taxonomy. Anything unrecognised becomes `E_UNKNOWN` — the point of
|
|
140
|
+
* a closed set is that an unclassified error contributes a count and nothing
|
|
141
|
+
* else, so no message text can ride along inside a "code".
|
|
142
|
+
*/
|
|
143
|
+
export const ERROR_CODES = [
|
|
144
|
+
'E_UNKNOWN', 'E_PARSE', 'E_TIMEOUT', 'E_LLM', 'E_AUTH', 'E_RATE_LIMIT',
|
|
145
|
+
'E_NETWORK', 'E_DISK', 'E_PERMISSION', 'E_OOM', 'E_LOCK',
|
|
146
|
+
];
|
|
147
|
+
/**
|
|
148
|
+
* Map a thrown value to a code without letting its text through. Only fixed
|
|
149
|
+
* substrings are matched, and only a member of {@link ERROR_CODES} is returned —
|
|
150
|
+
* the error's own message is never the return value, not even in part.
|
|
151
|
+
*/
|
|
152
|
+
export function errorCode(err) {
|
|
153
|
+
const code = err?.code;
|
|
154
|
+
if (typeof code === 'string') {
|
|
155
|
+
if (code === 'ENOSPC' || code === 'EDQUOT')
|
|
156
|
+
return 'E_DISK';
|
|
157
|
+
if (code === 'EACCES' || code === 'EPERM')
|
|
158
|
+
return 'E_PERMISSION';
|
|
159
|
+
if (code === 'ENOMEM')
|
|
160
|
+
return 'E_OOM';
|
|
161
|
+
if (code === 'ETIMEDOUT' || code === 'ESOCKETTIMEDOUT')
|
|
162
|
+
return 'E_TIMEOUT';
|
|
163
|
+
if (code === 'ENOTFOUND' || code === 'ECONNREFUSED' || code === 'ECONNRESET')
|
|
164
|
+
return 'E_NETWORK';
|
|
165
|
+
}
|
|
166
|
+
const status = err?.status;
|
|
167
|
+
if (typeof status === 'number') {
|
|
168
|
+
if (status === 401 || status === 403)
|
|
169
|
+
return 'E_AUTH';
|
|
170
|
+
if (status === 429)
|
|
171
|
+
return 'E_RATE_LIMIT';
|
|
172
|
+
if (status >= 500)
|
|
173
|
+
return 'E_LLM';
|
|
174
|
+
}
|
|
175
|
+
const msg = err instanceof Error ? err.message.toLowerCase() : '';
|
|
176
|
+
if (msg.includes('timeout') || msg.includes('timed out'))
|
|
177
|
+
return 'E_TIMEOUT';
|
|
178
|
+
if (msg.includes('parse') || msg.includes('syntax'))
|
|
179
|
+
return 'E_PARSE';
|
|
180
|
+
if (msg.includes('lock'))
|
|
181
|
+
return 'E_LOCK';
|
|
182
|
+
return 'E_UNKNOWN';
|
|
183
|
+
}
|
|
184
|
+
/* -------------------------------------------------------------------------- */
|
|
185
|
+
/* buckets — every number crosses the wire as a label */
|
|
186
|
+
/* -------------------------------------------------------------------------- */
|
|
187
|
+
/** Repo scale. Exact counts fingerprint a repo; these five labels answer the
|
|
188
|
+
* only question we have ("toy, service, or monorepo?"). */
|
|
189
|
+
export function filesBucket(n) {
|
|
190
|
+
if (n <= 0)
|
|
191
|
+
return '0';
|
|
192
|
+
if (n < 50)
|
|
193
|
+
return '1-49';
|
|
194
|
+
if (n < 200)
|
|
195
|
+
return '50-199';
|
|
196
|
+
if (n < 1000)
|
|
197
|
+
return '200-999';
|
|
198
|
+
if (n < 5000)
|
|
199
|
+
return '1000-4999';
|
|
200
|
+
return '5000+';
|
|
201
|
+
}
|
|
202
|
+
/** Wall-clock for a build. Coarse enough that it says "fast/slow", not "this
|
|
203
|
+
* exact machine on this exact tree". */
|
|
204
|
+
export function durationBucket(ms) {
|
|
205
|
+
const s = ms / 1000;
|
|
206
|
+
if (s < 1)
|
|
207
|
+
return '<1s';
|
|
208
|
+
if (s < 5)
|
|
209
|
+
return '1-5s';
|
|
210
|
+
if (s < 30)
|
|
211
|
+
return '5-30s';
|
|
212
|
+
if (s < 120)
|
|
213
|
+
return '30s-2m';
|
|
214
|
+
if (s < 600)
|
|
215
|
+
return '2-10m';
|
|
216
|
+
return '10m+';
|
|
217
|
+
}
|
|
218
|
+
/** Generic small-count bucket, for the per-session read counters. */
|
|
219
|
+
export function countBucket(n) {
|
|
220
|
+
if (n <= 0)
|
|
221
|
+
return '0';
|
|
222
|
+
if (n < 5)
|
|
223
|
+
return '1-4';
|
|
224
|
+
if (n < 20)
|
|
225
|
+
return '5-19';
|
|
226
|
+
if (n < 50)
|
|
227
|
+
return '20-49';
|
|
228
|
+
if (n < 200)
|
|
229
|
+
return '50-199';
|
|
230
|
+
return '200+';
|
|
231
|
+
}
|
|
232
|
+
/** Estimated tokens saved in one session — the README's central claim, in the
|
|
233
|
+
* only resolution we need to defend it. */
|
|
234
|
+
export function savedTokensBucket(n) {
|
|
235
|
+
if (n <= 0)
|
|
236
|
+
return '0';
|
|
237
|
+
if (n < 1000)
|
|
238
|
+
return '<1k';
|
|
239
|
+
if (n < 5000)
|
|
240
|
+
return '1-5k';
|
|
241
|
+
if (n < 20000)
|
|
242
|
+
return '5-20k';
|
|
243
|
+
if (n < 100000)
|
|
244
|
+
return '20-100k';
|
|
245
|
+
return '100k+';
|
|
246
|
+
}
|
|
247
|
+
/**
|
|
248
|
+
* Languages, normalised, filtered to a safe shape, and capped.
|
|
249
|
+
*
|
|
250
|
+
* Sorted so `["go","ts"]` and `["ts","go"]` aggregate as one value, deduped, and
|
|
251
|
+
* cut to eight — a repo with a very long tail of languages is itself a
|
|
252
|
+
* distinguishing fact, and the tail answers no question we have.
|
|
253
|
+
*
|
|
254
|
+
* The character filter is the part that matters. This is the only property in
|
|
255
|
+
* the contract that is not drawn from a closed set defined in this file: the
|
|
256
|
+
* values come from the parser registry, several modules away, via
|
|
257
|
+
* `languageLabelOf() ?? container.name ?? generic.name ?? "unknown"`. That is
|
|
258
|
+
* safe today, but it means the no-free-text guarantee would rest on a promise
|
|
259
|
+
* made elsewhere — and a future generic extractor naming itself after the
|
|
260
|
+
* extension it matched would quietly turn this into a channel for file
|
|
261
|
+
* metadata. Anything outside `[a-z0-9+#._-]`, or longer than 24 characters, is
|
|
262
|
+
* therefore dropped here rather than trusted.
|
|
263
|
+
*/
|
|
264
|
+
export function langsValue(langs) {
|
|
265
|
+
const clean = langs
|
|
266
|
+
.map((l) => l.toLowerCase().trim())
|
|
267
|
+
.filter((l) => l.length > 0 && l.length <= 24 && /^[a-z0-9+#._-]+$/.test(l));
|
|
268
|
+
return [...new Set(clean)].sort().slice(0, 8).join(',');
|
|
269
|
+
}
|
|
270
|
+
//# sourceMappingURL=contract.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contract.js","sourceRoot":"","sources":["../../src/telemetry/contract.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,gFAAgF;AAChF,gFAAgF;AAChF,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,CAAC,MAAM,MAAM,GAAwC;IACzD;;;;;;kEAM8D;IAC9D,OAAO,EAAE,IAAI,GAAG,CAAS,CAAC,QAAQ,CAAC,CAAC;IACpC;uEACmE;IACnE,SAAS,EAAE,IAAI,GAAG,EAAU;IAC5B;oDACgD;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U,iBAAiB,CAAC,CAAS;IACzC,IAAI,CAAC,IAAI,CAAC;QAAE,OAAO,GAAG,CAAC;IACvB,IAAI,CAAC,GAAG,IAAI;QAAE,OAAO,KAAK,CAAC;IAC3B,IAAI,CAAC,GAAG,IAAI;QAAE,OAAO,MAAM,CAAC;IAC5B,IAAI,CAAC,GAAG,KAAK;QAAE,OAAO,OAAO,CAAC;IAC9B,IAAI,CAAC,GAAG,MAAM;QAAE,OAAO,SAAS,CAAC;IACjC,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,UAAU,CAAC,KAAwB;IACjD,MAAM,KAAK,GAAG,KAAK;SAChB,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,CAAC;SAClC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,EAAE,IAAI,kBAAkB,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/E,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC1D,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type SendResult } from './send.js';
|
|
2
|
+
/** Matches `UPDATE_TTL_MS`: a day is the natural period for both. */
|
|
3
|
+
export declare const FLUSH_TTL_MS: number;
|
|
4
|
+
export declare function needsFlush(flushedAt: number | undefined, now?: number): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* Spawn the flush if the queue has something in it and a day has passed. Returns
|
|
7
|
+
* whether a child was started, for tests. Never waits, never throws.
|
|
8
|
+
*/
|
|
9
|
+
export declare function maybeFlushInBackground(home?: string, now?: number): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Whether a failed send is worth keeping the batch for.
|
|
12
|
+
*
|
|
13
|
+
* A 5xx or a transport failure is ours to retry — a week offline should not be
|
|
14
|
+
* a week of lost events. A 4xx is not: a bad key or a malformed batch will fail
|
|
15
|
+
* identically forever, and retrying it would pin the queue at its cap until it
|
|
16
|
+
* starts dropping the events that WOULD have sent.
|
|
17
|
+
*/
|
|
18
|
+
export declare function shouldRequeue(res: SendResult): boolean;
|
|
19
|
+
/** The `julius _telemetry-flush` body, running in the detached child. */
|
|
20
|
+
export declare function runFlush(home?: string): Promise<void>;
|
|
21
|
+
//# sourceMappingURL=flush.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush.d.ts","sourceRoot":"","sources":["../../src/telemetry/flush.ts"],"names":[],"mappings":"AAkBA,OAAO,EAAa,KAAK,UAAU,EAAE,MAAM,WAAW,CAAC;AAGvD,qEAAqE;AACrE,eAAO,MAAM,YAAY,QAAsB,CAAC;AAMhD,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,GAAG,SAAS,EAAE,GAAG,SAAa,GAAG,OAAO,CAEnF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,SAAa,GAAG,OAAO,CAgB/E;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,UAAU,GAAG,OAAO,CAGtD;AAED,yEAAyE;AACzE,wBAAsB,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAO3D"}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Getting the queue off the machine without any command ever waiting for it.
|
|
3
|
+
*
|
|
4
|
+
* Deliberately the same shape as `maybeRefreshInBackground` in `upkeep.ts`,
|
|
5
|
+
* which has been doing this for the npm registry check since 0.7: check a
|
|
6
|
+
* timestamp, write the timestamp BEFORE spawning so a child that dies cannot
|
|
7
|
+
* make every subsequent command spawn another one, then `spawn` detached and
|
|
8
|
+
* `unref`. The parent returns immediately and never learns the outcome.
|
|
9
|
+
*
|
|
10
|
+
* Once a day, not once a command. Events are cheap to hold and the questions we
|
|
11
|
+
* are asking ("how many repos activated this week") do not get better answers
|
|
12
|
+
* from lower latency.
|
|
13
|
+
*/
|
|
14
|
+
import { spawn } from 'node:child_process';
|
|
15
|
+
import { statSync } from 'node:fs';
|
|
16
|
+
import { juliusCliPath } from '../claude/paths.js';
|
|
17
|
+
import { drain, queuePath, requeue } from './queue.js';
|
|
18
|
+
import { patchState, readState } from './identity.js';
|
|
19
|
+
import { sendBatch } from './send.js';
|
|
20
|
+
import { telemetryOn } from './gate.js';
|
|
21
|
+
/** Matches `UPDATE_TTL_MS`: a day is the natural period for both. */
|
|
22
|
+
export const FLUSH_TTL_MS = 24 * 60 * 60 * 1000;
|
|
23
|
+
function queueHasEvents(home) {
|
|
24
|
+
try {
|
|
25
|
+
return statSync(queuePath(home)).size > 0;
|
|
26
|
+
}
|
|
27
|
+
catch {
|
|
28
|
+
return false;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function needsFlush(flushedAt, now = Date.now()) {
|
|
32
|
+
return typeof flushedAt !== 'number' || now - flushedAt >= FLUSH_TTL_MS;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Spawn the flush if the queue has something in it and a day has passed. Returns
|
|
36
|
+
* whether a child was started, for tests. Never waits, never throws.
|
|
37
|
+
*/
|
|
38
|
+
export function maybeFlushInBackground(home, now = Date.now()) {
|
|
39
|
+
try {
|
|
40
|
+
if (!telemetryOn(home))
|
|
41
|
+
return false;
|
|
42
|
+
if (!queueHasEvents(home))
|
|
43
|
+
return false;
|
|
44
|
+
if (!needsFlush(readState(home)?.flushedAt, now))
|
|
45
|
+
return false;
|
|
46
|
+
patchState({ flushedAt: now }, home); // before the spawn, so a dying child costs one attempt
|
|
47
|
+
const child = spawn(process.execPath, [juliusCliPath(), '_telemetry-flush'], {
|
|
48
|
+
detached: true,
|
|
49
|
+
stdio: 'ignore',
|
|
50
|
+
windowsHide: true,
|
|
51
|
+
});
|
|
52
|
+
child.unref();
|
|
53
|
+
return true;
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
return false; // no spawn available (sandbox, ENOMEM) — try again tomorrow
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Whether a failed send is worth keeping the batch for.
|
|
61
|
+
*
|
|
62
|
+
* A 5xx or a transport failure is ours to retry — a week offline should not be
|
|
63
|
+
* a week of lost events. A 4xx is not: a bad key or a malformed batch will fail
|
|
64
|
+
* identically forever, and retrying it would pin the queue at its cap until it
|
|
65
|
+
* starts dropping the events that WOULD have sent.
|
|
66
|
+
*/
|
|
67
|
+
export function shouldRequeue(res) {
|
|
68
|
+
if (res.ok)
|
|
69
|
+
return false;
|
|
70
|
+
return res.status === undefined || res.status >= 500;
|
|
71
|
+
}
|
|
72
|
+
/** The `julius _telemetry-flush` body, running in the detached child. */
|
|
73
|
+
export async function runFlush(home) {
|
|
74
|
+
try {
|
|
75
|
+
if (!telemetryOn(home))
|
|
76
|
+
return;
|
|
77
|
+
const events = drain(home);
|
|
78
|
+
if (events.length === 0)
|
|
79
|
+
return;
|
|
80
|
+
if (shouldRequeue(await sendBatch(events)))
|
|
81
|
+
requeue(events, home);
|
|
82
|
+
}
|
|
83
|
+
catch { /* a failed flush is a non-event by design */ }
|
|
84
|
+
}
|
|
85
|
+
//# sourceMappingURL=flush.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flush.js","sourceRoot":"","sources":["../../src/telemetry/flush.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MA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CAAC,aAAa,EAAE,EAAE,kBAAkB,CAAC,EAAE;YAC3E,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,QAAQ;YACf,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;QACd,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC,CAAC,4DAA4D;IAC5E,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,aAAa,CAAC,GAAe;IAC3C,IAAI,GAAG,CAAC,EAAE;QAAE,OAAO,KAAK,CAAC;IACzB,OAAO,GAAG,CAAC,MAAM,KAAK,SAAS,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC;AACvD,CAAC;AAED,yEAAyE;AACzE,MAAM,CAAC,KAAK,UAAU,QAAQ,CAAC,IAAa;IAC1C,IAAI,CAAC;QACH,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC;YAAE,OAAO;QAC/B,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;QAC3B,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;YAAE,OAAO;QAChC,IAAI,aAAa,CAAC,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;YAAE,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IACpE,CAAC;IAAC,MAAM,CAAC,CAAC,6CAA6C,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export type OffReason = 'no-key' | 'do-not-track' | 'ci' | 'disabled';
|
|
2
|
+
/** The `DO_NOT_TRACK` convention: set and not `0`/empty means "off". */
|
|
3
|
+
export declare function doNotTrack(env?: NodeJS.ProcessEnv): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Every variable {@link inCi} reads, named once.
|
|
6
|
+
*
|
|
7
|
+
* Exported because a test that needs telemetry actually ON has to clear all of
|
|
8
|
+
* them, and clearing a hand-copied subset is how this list silently drifts: the
|
|
9
|
+
* `cursor-session-end` test cleared `CI` alone, so it passed on a laptop and failed
|
|
10
|
+
* on GitHub Actions — where `GITHUB_ACTIONS` is set — for every run until someone
|
|
11
|
+
* read the log. One list, both callers.
|
|
12
|
+
*/
|
|
13
|
+
export declare const CI_ENV_VARS: readonly ['CI', 'GITHUB_ACTIONS', 'GITLAB_CI', 'BUILDKITE', 'CIRCLECI', 'TEAMCITY_VERSION', 'JENKINS_URL', 'TF_BUILD', 'BUILD_NUMBER'];
|
|
14
|
+
/**
|
|
15
|
+
* CI detection. `CI` covers essentially every provider; the rest are the ones
|
|
16
|
+
* that historically did not set it. Deliberately generous — a false positive
|
|
17
|
+
* costs one uncounted user, a false negative pollutes the dataset.
|
|
18
|
+
*
|
|
19
|
+
* `CI` is the one read with a value test: `CI=false` is a real thing a user sets
|
|
20
|
+
* to mean "not CI", while the provider-specific vars are presence-only — none of
|
|
21
|
+
* them is ever deliberately set to a falsy string.
|
|
22
|
+
*/
|
|
23
|
+
export declare function inCi(env?: NodeJS.ProcessEnv): boolean;
|
|
24
|
+
/** Null when telemetry may run, otherwise the first gate that closed. */
|
|
25
|
+
export declare function offReason(home?: string, env?: NodeJS.ProcessEnv): OffReason | null;
|
|
26
|
+
export declare function telemetryOn(home?: string, env?: NodeJS.ProcessEnv): boolean;
|
|
27
|
+
/** One line for `julius telemetry status`, naming the gate that is closed so a
|
|
28
|
+
* user who thinks they disabled it can see which switch actually took. */
|
|
29
|
+
export declare function explainOff(reason: OffReason): string;
|
|
30
|
+
//# sourceMappingURL=gate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../src/telemetry/gate.ts"],"names":[],"mappings":"AAwBA,MAAM,MAAM,SAAS,GAAG,QAAQ,GAAG,cAAc,GAAG,IAAI,GAAG,UAAU,CAAC;AAEtE,wEAAwE;AACxE,wBAAgB,UAAU,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAGxE;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,WAAW,YACtB,IAAI,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,UAAU,EAC5D,kBAAkB,EAAE,aAAa,EAAE,UAAU,EAAE,cAAc,CACrD,CAAC;AAEX;;;;;;;;GAQG;AACH,wBAAgB,IAAI,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAGlE;AAED,yEAAyE;AACzE,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,SAAS,GAAG,IAAI,CAM/F;AAED,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAExF;AAED;2EAC2E;AAC3E,wBAAgB,UAAU,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAOpD"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The single "may we send?" predicate, checked before every append and again
|
|
3
|
+
* before every send.
|
|
4
|
+
*
|
|
5
|
+
* Four independent gates, in the order a user would expect them to win:
|
|
6
|
+
*
|
|
7
|
+
* 1. A key at all — dev builds and forks have none (see key.ts), so the whole
|
|
8
|
+
* subsystem is inert for anyone who did not install a published julius.
|
|
9
|
+
* 2. `DO_NOT_TRACK` — the cross-tool convention (consoledonottrack.com).
|
|
10
|
+
* Honoured unconditionally: it outranks our own setting, because a user who
|
|
11
|
+
* set it machine-wide has already answered the question for every tool.
|
|
12
|
+
* 3. CI — a build server is not a user. Counting it would inflate every number
|
|
13
|
+
* we care about and tell us nothing about a person.
|
|
14
|
+
* 4. The user's own choice, from the `julius init` picker or
|
|
15
|
+
* `julius telemetry disable`. Only available after explicitly configuring a key and host.
|
|
16
|
+
*
|
|
17
|
+
* Re-checked at every append rather than cached at boot, so `julius telemetry
|
|
18
|
+
* disable` in one terminal takes effect in a long-lived MCP server in another
|
|
19
|
+
* without a restart.
|
|
20
|
+
*/
|
|
21
|
+
import { posthogKey, posthogHost } from './key.js';
|
|
22
|
+
import { readState } from './identity.js';
|
|
23
|
+
import { cmd } from '../brand.js';
|
|
24
|
+
/** The `DO_NOT_TRACK` convention: set and not `0`/empty means "off". */
|
|
25
|
+
export function doNotTrack(env = process.env) {
|
|
26
|
+
const v = env.DO_NOT_TRACK;
|
|
27
|
+
return v !== undefined && v !== '' && v !== '0';
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Every variable {@link inCi} reads, named once.
|
|
31
|
+
*
|
|
32
|
+
* Exported because a test that needs telemetry actually ON has to clear all of
|
|
33
|
+
* them, and clearing a hand-copied subset is how this list silently drifts: the
|
|
34
|
+
* `cursor-session-end` test cleared `CI` alone, so it passed on a laptop and failed
|
|
35
|
+
* on GitHub Actions — where `GITHUB_ACTIONS` is set — for every run until someone
|
|
36
|
+
* read the log. One list, both callers.
|
|
37
|
+
*/
|
|
38
|
+
export const CI_ENV_VARS = [
|
|
39
|
+
'CI', 'GITHUB_ACTIONS', 'GITLAB_CI', 'BUILDKITE', 'CIRCLECI',
|
|
40
|
+
'TEAMCITY_VERSION', 'JENKINS_URL', 'TF_BUILD', 'BUILD_NUMBER',
|
|
41
|
+
];
|
|
42
|
+
/**
|
|
43
|
+
* CI detection. `CI` covers essentially every provider; the rest are the ones
|
|
44
|
+
* that historically did not set it. Deliberately generous — a false positive
|
|
45
|
+
* costs one uncounted user, a false negative pollutes the dataset.
|
|
46
|
+
*
|
|
47
|
+
* `CI` is the one read with a value test: `CI=false` is a real thing a user sets
|
|
48
|
+
* to mean "not CI", while the provider-specific vars are presence-only — none of
|
|
49
|
+
* them is ever deliberately set to a falsy string.
|
|
50
|
+
*/
|
|
51
|
+
export function inCi(env = process.env) {
|
|
52
|
+
if (env.CI !== undefined && env.CI !== '' && env.CI !== '0' && env.CI !== 'false')
|
|
53
|
+
return true;
|
|
54
|
+
return CI_ENV_VARS.some((name) => name !== 'CI' && Boolean(env[name]));
|
|
55
|
+
}
|
|
56
|
+
/** Null when telemetry may run, otherwise the first gate that closed. */
|
|
57
|
+
export function offReason(home, env = process.env) {
|
|
58
|
+
if (!posthogKey() || !posthogHost())
|
|
59
|
+
return 'no-key';
|
|
60
|
+
if (doNotTrack(env))
|
|
61
|
+
return 'do-not-track';
|
|
62
|
+
if (inCi(env))
|
|
63
|
+
return 'ci';
|
|
64
|
+
if (readState(home)?.enabled === false)
|
|
65
|
+
return 'disabled';
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
export function telemetryOn(home, env = process.env) {
|
|
69
|
+
return offReason(home, env) === null;
|
|
70
|
+
}
|
|
71
|
+
/** One line for `julius telemetry status`, naming the gate that is closed so a
|
|
72
|
+
* user who thinks they disabled it can see which switch actually took. */
|
|
73
|
+
export function explainOff(reason) {
|
|
74
|
+
switch (reason) {
|
|
75
|
+
case 'no-key': return 'off — this build has no telemetry key (a fork, or a local `npm run build`); nothing can be sent';
|
|
76
|
+
case 'do-not-track': return 'off — DO_NOT_TRACK is set in this environment';
|
|
77
|
+
case 'ci': return 'off — this looks like CI';
|
|
78
|
+
case 'disabled': return `off — you disabled it (\`${cmd('julius telemetry enable')}\` to turn it back on)`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=gate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/telemetry/gate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AAIlC,wEAAwE;AACxE,MAAM,UAAU,UAAU,CAAC,GAAG,GAAsB,OAAO,CAAC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C7E,OAAO,SAAS,CAAC,IAAI,EAAE,GAAG,CAAC,KAAK,IAAI,CAAC;AACvC,CAAC;AAED;2EAC2E;AAC3E,MAAM,UAAU,UAAU,CAAC,MAAiB;IAC1C,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,QAAQ,EAAS,OAAO,iGAAiG,CAAC;QAC/H,KAAK,cAAc,EAAG,OAAO,+CAA+C,CAAC;QAC7E,KAAK,IAAI,EAAa,OAAO,0BAA0B,CAAC;QACxD,KAAK,UAAU,EAAO,OAAO,4BAA4B,GAAG,CAAC,yBAAyB,CAAC,wBAAwB,CAAC;IAClH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Machine-global telemetry state. Shares `~/.julius/` with `update-check.json`. */
|
|
2
|
+
export interface TelemetryState {
|
|
3
|
+
installId: string;
|
|
4
|
+
/** The user's choice. Absent means "never chosen" → the default (on) applies. */
|
|
5
|
+
enabled?: boolean;
|
|
6
|
+
/** ISO stamp of the one-time first-run notice, so it prints exactly once. */
|
|
7
|
+
noticeShownAt?: string;
|
|
8
|
+
/** ISO stamp of the `first_run` event. Its own field rather than "did this
|
|
9
|
+
* call mint the install id", because the postinstall hook now mints the id
|
|
10
|
+
* before any command runs — see `trackFirstRunIfNew`. */
|
|
11
|
+
firstRunAt?: string;
|
|
12
|
+
/** The version the `install` event was last sent for, so an upgrade counts as
|
|
13
|
+
* an install and a repeated `npm install` of the same version does not. */
|
|
14
|
+
installedVersion?: string;
|
|
15
|
+
/** Epoch ms of the last flush ATTEMPT, mirroring `UpdateCache.checkedAt`. */
|
|
16
|
+
flushedAt?: number;
|
|
17
|
+
}
|
|
18
|
+
export declare function statePath(home?: string): string;
|
|
19
|
+
export declare function readState(home?: string): TelemetryState | null;
|
|
20
|
+
/** Read-modify-write. Not atomic across processes; a lost update costs at most a
|
|
21
|
+
* duplicated notice or an extra flush attempt, never corruption. */
|
|
22
|
+
export declare function patchState(patch: Partial<TelemetryState>, home?: string): TelemetryState;
|
|
23
|
+
export interface Install {
|
|
24
|
+
id: string;
|
|
25
|
+
/** True when this call minted the id, i.e. this is the machine's first run. */
|
|
26
|
+
firstRun: boolean;
|
|
27
|
+
}
|
|
28
|
+
/** The install id, minted on first call. */
|
|
29
|
+
export declare function installId(home?: string): Install;
|
|
30
|
+
/**
|
|
31
|
+
* The repo id, in `julius/.cache/` rather than `.julius/config.json`.
|
|
32
|
+
*
|
|
33
|
+
* `.julius/config.json` would have been the tidier home, but writing it runs
|
|
34
|
+
* `ensureBuildConfigIgnored`, which appends to the repo's `.gitignore`. Minting
|
|
35
|
+
* an id during a read-only `julius ask` must not modify a file the user has
|
|
36
|
+
* committed. `julius/.cache/` is already derived, already git-ignored, and
|
|
37
|
+
* already where every other per-repo sidecar lives.
|
|
38
|
+
*/
|
|
39
|
+
export declare function repoId(repo: string): string;
|
|
40
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/telemetry/identity.ts"],"names":[],"mappings":"AA0BA,oFAAoF;AACpF,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,iFAAiF;IACjF,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,6EAA6E;IAC7E,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;8DAE0D;IAC1D,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;gFAC4E;IAC5E,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,wBAAgB,SAAS,CAAC,IAAI,GAAE,MAAkB,GAAG,MAAM,CAE1D;AAED,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,GAAG,IAAI,CAE9D;AAED;qEACqE;AACrE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,cAAc,CAIxF;AAED,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,+EAA+E;IAC/E,QAAQ,EAAE,OAAO,CAAC;CACnB;AAED,4CAA4C;AAC5C,wBAAgB,SAAS,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAahD;AAED;;;;;;;;GAQG;AACH,wBAAgB,MAAM,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAO3C"}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The two identifiers, and why neither of them identifies anyone.
|
|
3
|
+
*
|
|
4
|
+
* • install id — one per machine, in `~/.julius/telemetry.json`, beside the
|
|
5
|
+
* update-check cache that already lives there. Lets us count people rather
|
|
6
|
+
* than events, so a dev running forty queries is one user and not forty.
|
|
7
|
+
* • repo id — one per checkout, in `julius/.cache/`. Activation and retention
|
|
8
|
+
* for julius are per-repo facts ("did this repo ever get past build?"), and
|
|
9
|
+
* the install id alone cannot express them.
|
|
10
|
+
*
|
|
11
|
+
* Both are `randomUUID()`. Not a machine id, not a hash of the git remote, not
|
|
12
|
+
* derived from anything real — a coin flip, written down. A hash would at least
|
|
13
|
+
* be guessable by us (we could hash a public repo URL and look for it); a random
|
|
14
|
+
* UUID cannot be reversed or confirmed even in principle. Deleting `~/.julius/`
|
|
15
|
+
* or `julius/` deletes them, and the user simply looks like someone new.
|
|
16
|
+
*
|
|
17
|
+
* Every function here is fail-soft: an unwritable home is a very common state
|
|
18
|
+
* (a locked-down CI image, a read-only container) and it must cost the caller
|
|
19
|
+
* nothing. A failed persist yields an ephemeral id for this process — still
|
|
20
|
+
* anonymous, just not stable — and never a throw.
|
|
21
|
+
*/
|
|
22
|
+
import { homedir } from 'node:os';
|
|
23
|
+
import { join } from 'node:path';
|
|
24
|
+
import { randomUUID } from 'node:crypto';
|
|
25
|
+
import { cacheDir, readJson, writeJsonAtomic } from '../util/state.js';
|
|
26
|
+
export function statePath(home = homedir()) {
|
|
27
|
+
return join(home, '.julius', 'telemetry.json');
|
|
28
|
+
}
|
|
29
|
+
export function readState(home) {
|
|
30
|
+
return readJson(statePath(home));
|
|
31
|
+
}
|
|
32
|
+
/** Read-modify-write. Not atomic across processes; a lost update costs at most a
|
|
33
|
+
* duplicated notice or an extra flush attempt, never corruption. */
|
|
34
|
+
export function patchState(patch, home) {
|
|
35
|
+
const next = { ...(readState(home) ?? { installId: randomUUID() }), ...patch };
|
|
36
|
+
try {
|
|
37
|
+
writeJsonAtomic(statePath(home), next);
|
|
38
|
+
}
|
|
39
|
+
catch { /* unwritable home — in-memory only */ }
|
|
40
|
+
return next;
|
|
41
|
+
}
|
|
42
|
+
/** The install id, minted on first call. */
|
|
43
|
+
export function installId(home) {
|
|
44
|
+
const existing = readState(home);
|
|
45
|
+
if (existing?.installId)
|
|
46
|
+
return { id: existing.installId, firstRun: false };
|
|
47
|
+
const id = randomUUID();
|
|
48
|
+
try {
|
|
49
|
+
writeJsonAtomic(statePath(home), { ...(existing ?? {}), installId: id });
|
|
50
|
+
return { id, firstRun: true };
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
// Unwritable home: use the id for this process rather than failing closed.
|
|
54
|
+
// Reported as firstRun:false so a machine that can never persist doesn't
|
|
55
|
+
// send a first_run event on every single command.
|
|
56
|
+
return { id, firstRun: false };
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* The repo id, in `julius/.cache/` rather than `.julius/config.json`.
|
|
61
|
+
*
|
|
62
|
+
* `.julius/config.json` would have been the tidier home, but writing it runs
|
|
63
|
+
* `ensureBuildConfigIgnored`, which appends to the repo's `.gitignore`. Minting
|
|
64
|
+
* an id during a read-only `julius ask` must not modify a file the user has
|
|
65
|
+
* committed. `julius/.cache/` is already derived, already git-ignored, and
|
|
66
|
+
* already where every other per-repo sidecar lives.
|
|
67
|
+
*/
|
|
68
|
+
export function repoId(repo) {
|
|
69
|
+
const path = join(cacheDir(repo), 'telemetry-repo-id.json');
|
|
70
|
+
const existing = readJson(path);
|
|
71
|
+
if (existing?.repoId)
|
|
72
|
+
return existing.repoId;
|
|
73
|
+
const id = randomUUID();
|
|
74
|
+
try {
|
|
75
|
+
writeJsonAtomic(path, { repoId: id });
|
|
76
|
+
}
|
|
77
|
+
catch { /* unwritable — ephemeral */ }
|
|
78
|
+
return id;
|
|
79
|
+
}
|
|
80
|
+
//# sourceMappingURL=identity.js.map
|