@nanonets/graft 0.24.0 → 0.25.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/README.md +26 -21
- package/dist/ask/ask.d.ts +8 -0
- package/dist/ask/ask.d.ts.map +1 -1
- package/dist/ask/ask.js +33 -12
- package/dist/ask/ask.js.map +1 -1
- package/dist/blast/render.js +1 -1
- package/dist/blast/render.js.map +1 -1
- package/dist/brand.js +1 -1
- package/dist/brand.js.map +1 -1
- package/dist/check/learning-edits.d.ts +18 -3
- package/dist/check/learning-edits.d.ts.map +1 -1
- package/dist/check/learning-edits.js +54 -10
- package/dist/check/learning-edits.js.map +1 -1
- package/dist/check/local-check.d.ts +7 -3
- package/dist/check/local-check.d.ts.map +1 -1
- package/dist/check/local-check.js +55 -11
- package/dist/check/local-check.js.map +1 -1
- package/dist/check/types.d.ts +11 -2
- package/dist/check/types.d.ts.map +1 -1
- package/dist/claude/format.d.ts +11 -7
- package/dist/claude/format.d.ts.map +1 -1
- package/dist/claude/format.js +50 -28
- package/dist/claude/format.js.map +1 -1
- package/dist/claude/hook-io.d.ts +44 -0
- package/dist/claude/hook-io.d.ts.map +1 -0
- package/dist/claude/hook-io.js +144 -0
- package/dist/claude/hook-io.js.map +1 -0
- package/dist/claude/hook-layers.d.ts +4 -2
- package/dist/claude/hook-layers.d.ts.map +1 -1
- package/dist/claude/hook-layers.js +21 -4
- package/dist/claude/hook-layers.js.map +1 -1
- package/dist/claude/hooks.d.ts +9 -32
- package/dist/claude/hooks.d.ts.map +1 -1
- package/dist/claude/hooks.js +154 -350
- package/dist/claude/hooks.js.map +1 -1
- package/dist/claude/init.d.ts.map +1 -1
- package/dist/claude/init.js +56 -18
- package/dist/claude/init.js.map +1 -1
- package/dist/claude/note-signals.d.ts +6 -0
- package/dist/claude/note-signals.d.ts.map +1 -1
- package/dist/claude/note-signals.js +14 -3
- package/dist/claude/note-signals.js.map +1 -1
- package/dist/claude/post-bash.d.ts +26 -0
- package/dist/claude/post-bash.d.ts.map +1 -0
- package/dist/claude/post-bash.js +191 -0
- package/dist/claude/post-bash.js.map +1 -0
- package/dist/claude/pre-bash-skills.d.ts +21 -0
- package/dist/claude/pre-bash-skills.d.ts.map +1 -0
- package/dist/claude/pre-bash-skills.js +253 -0
- package/dist/claude/pre-bash-skills.js.map +1 -0
- package/dist/claude/pre-bash.d.ts +50 -0
- package/dist/claude/pre-bash.d.ts.map +1 -0
- package/dist/claude/pre-bash.js +245 -0
- package/dist/claude/pre-bash.js.map +1 -0
- package/dist/claude/prompt-consent.d.ts +19 -0
- package/dist/claude/prompt-consent.d.ts.map +1 -0
- package/dist/claude/prompt-consent.js +14 -0
- package/dist/claude/prompt-consent.js.map +1 -0
- package/dist/claude/prompt-hook.d.ts +76 -0
- package/dist/claude/prompt-hook.d.ts.map +1 -0
- package/dist/claude/prompt-hook.js +303 -0
- package/dist/claude/prompt-hook.js.map +1 -0
- package/dist/claude/prompt-skills.d.ts +19 -0
- package/dist/claude/prompt-skills.d.ts.map +1 -0
- package/dist/claude/prompt-skills.js +305 -0
- package/dist/claude/prompt-skills.js.map +1 -0
- package/dist/claude/session-metrics.js +4 -4
- package/dist/claude/session-metrics.js.map +1 -1
- package/dist/claude/settings-merge.d.ts +10 -0
- package/dist/claude/settings-merge.d.ts.map +1 -1
- package/dist/claude/settings-merge.js +46 -17
- package/dist/claude/settings-merge.js.map +1 -1
- package/dist/claude/shim-template.d.ts.map +1 -1
- package/dist/claude/shim-template.js +86 -28
- package/dist/claude/shim-template.js.map +1 -1
- package/dist/claude/skill-template.d.ts +2 -0
- package/dist/claude/skill-template.d.ts.map +1 -1
- package/dist/claude/skill-template.js +53 -34
- package/dist/claude/skill-template.js.map +1 -1
- package/dist/claude/skill-use.d.ts +16 -0
- package/dist/claude/skill-use.d.ts.map +1 -0
- package/dist/claude/skill-use.js +78 -0
- package/dist/claude/skill-use.js.map +1 -0
- package/dist/claude/skills-hook-util.d.ts +25 -0
- package/dist/claude/skills-hook-util.d.ts.map +1 -0
- package/dist/claude/skills-hook-util.js +71 -0
- package/dist/claude/skills-hook-util.js.map +1 -0
- package/dist/claude/skills-wiring.d.ts +26 -0
- package/dist/claude/skills-wiring.d.ts.map +1 -0
- package/dist/claude/skills-wiring.js +110 -0
- package/dist/claude/skills-wiring.js.map +1 -0
- package/dist/claude/start-init.d.ts +13 -0
- package/dist/claude/start-init.d.ts.map +1 -0
- package/dist/claude/start-init.js +75 -0
- package/dist/claude/start-init.js.map +1 -0
- package/dist/claude/start-skills.d.ts +31 -0
- package/dist/claude/start-skills.d.ts.map +1 -0
- package/dist/claude/start-skills.js +274 -0
- package/dist/claude/start-skills.js.map +1 -0
- package/dist/claude/state.d.ts +19 -7
- package/dist/claude/state.d.ts.map +1 -1
- package/dist/claude/state.js +59 -4
- package/dist/claude/state.js.map +1 -1
- package/dist/claude/stop-skills.d.ts +23 -0
- package/dist/claude/stop-skills.d.ts.map +1 -0
- package/dist/claude/stop-skills.js +233 -0
- package/dist/claude/stop-skills.js.map +1 -0
- package/dist/claude/stop.d.ts +23 -0
- package/dist/claude/stop.d.ts.map +1 -0
- package/dist/claude/stop.js +219 -0
- package/dist/claude/stop.js.map +1 -0
- package/dist/claude/tally.d.ts +29 -41
- package/dist/claude/tally.d.ts.map +1 -1
- package/dist/claude/tally.js +111 -165
- package/dist/claude/tally.js.map +1 -1
- package/dist/claude/walls-hook.d.ts +52 -0
- package/dist/claude/walls-hook.d.ts.map +1 -0
- package/dist/claude/walls-hook.js +279 -0
- package/dist/claude/walls-hook.js.map +1 -0
- package/dist/cli-epilogue.d.ts.map +1 -1
- package/dist/cli-epilogue.js +24 -14
- package/dist/cli-epilogue.js.map +1 -1
- package/dist/cli-meta.js +3 -3
- package/dist/cli-meta.js.map +1 -1
- package/dist/cli-picker.d.ts +24 -0
- package/dist/cli-picker.d.ts.map +1 -1
- package/dist/cli-picker.js +44 -11
- package/dist/cli-picker.js.map +1 -1
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +475 -390
- package/dist/cli.js.map +1 -1
- package/dist/cloud/head-learnings.d.ts +13 -0
- package/dist/cloud/head-learnings.d.ts.map +1 -0
- package/dist/cloud/head-learnings.js +84 -0
- package/dist/cloud/head-learnings.js.map +1 -0
- package/dist/cloud/lookup-activity.d.ts +18 -0
- package/dist/cloud/lookup-activity.d.ts.map +1 -0
- package/dist/cloud/lookup-activity.js +56 -0
- package/dist/cloud/lookup-activity.js.map +1 -0
- package/dist/cloud/nudge.d.ts +15 -7
- package/dist/cloud/nudge.d.ts.map +1 -1
- package/dist/cloud/nudge.js +45 -33
- package/dist/cloud/nudge.js.map +1 -1
- package/dist/cloud/onboarding.d.ts +273 -0
- package/dist/cloud/onboarding.d.ts.map +1 -0
- package/dist/cloud/onboarding.js +612 -0
- package/dist/cloud/onboarding.js.map +1 -0
- package/dist/cloud/other-repos.d.ts +39 -0
- package/dist/cloud/other-repos.d.ts.map +1 -0
- package/dist/cloud/other-repos.js +137 -0
- package/dist/cloud/other-repos.js.map +1 -0
- package/dist/cloud/pair.d.ts +86 -0
- package/dist/cloud/pair.d.ts.map +1 -0
- package/dist/cloud/pair.js +270 -0
- package/dist/cloud/pair.js.map +1 -0
- package/dist/cloud/workspace-sync.d.ts +75 -11
- package/dist/cloud/workspace-sync.d.ts.map +1 -1
- package/dist/cloud/workspace-sync.js +409 -53
- package/dist/cloud/workspace-sync.js.map +1 -1
- package/dist/cloud/workspace.d.ts +95 -10
- package/dist/cloud/workspace.d.ts.map +1 -1
- package/dist/cloud/workspace.js +112 -9
- package/dist/cloud/workspace.js.map +1 -1
- package/dist/graph/native.d.ts +2 -0
- package/dist/graph/native.d.ts.map +1 -1
- package/dist/graph/native.js +29 -4
- package/dist/graph/native.js.map +1 -1
- package/dist/hosts/claude-global.d.ts +14 -0
- package/dist/hosts/claude-global.d.ts.map +1 -1
- package/dist/hosts/claude-global.js +39 -4
- package/dist/hosts/claude-global.js.map +1 -1
- package/dist/hosts/codex-hooks.d.ts +6 -0
- package/dist/hosts/codex-hooks.d.ts.map +1 -1
- package/dist/hosts/codex-hooks.js +89 -16
- package/dist/hosts/codex-hooks.js.map +1 -1
- package/dist/hosts/codex-trust.d.ts +28 -0
- package/dist/hosts/codex-trust.d.ts.map +1 -0
- package/dist/hosts/codex-trust.js +280 -0
- package/dist/hosts/codex-trust.js.map +1 -0
- package/dist/hosts/cursor-hooks.d.ts.map +1 -1
- package/dist/hosts/cursor-hooks.js +3 -1
- package/dist/hosts/cursor-hooks.js.map +1 -1
- package/dist/init/candidates.d.ts +60 -0
- package/dist/init/candidates.d.ts.map +1 -0
- package/dist/init/candidates.js +202 -0
- package/dist/init/candidates.js.map +1 -0
- package/dist/init/claude-call.d.ts +51 -0
- package/dist/init/claude-call.d.ts.map +1 -0
- package/dist/init/claude-call.js +199 -0
- package/dist/init/claude-call.js.map +1 -0
- package/dist/init/discover-worker.d.ts +18 -0
- package/dist/init/discover-worker.d.ts.map +1 -0
- package/dist/init/discover-worker.js +111 -0
- package/dist/init/discover-worker.js.map +1 -0
- package/dist/init/handover.d.ts +16 -0
- package/dist/init/handover.d.ts.map +1 -0
- package/dist/init/handover.js +92 -0
- package/dist/init/handover.js.map +1 -0
- package/dist/init/howtos.d.ts +20 -0
- package/dist/init/howtos.d.ts.map +1 -0
- package/dist/init/howtos.js +90 -0
- package/dist/init/howtos.js.map +1 -0
- package/dist/init/init-record.d.ts +134 -0
- package/dist/init/init-record.d.ts.map +1 -0
- package/dist/init/init-record.js +339 -0
- package/dist/init/init-record.js.map +1 -0
- package/dist/init/install-paths.d.ts +6 -0
- package/dist/init/install-paths.d.ts.map +1 -0
- package/dist/init/install-paths.js +87 -0
- package/dist/init/install-paths.js.map +1 -0
- package/dist/init/install-record.d.ts +21 -0
- package/dist/init/install-record.d.ts.map +1 -0
- package/dist/init/install-record.js +144 -0
- package/dist/init/install-record.js.map +1 -0
- package/dist/init/keep-answer.d.ts +43 -0
- package/dist/init/keep-answer.d.ts.map +1 -0
- package/dist/init/keep-answer.js +118 -0
- package/dist/init/keep-answer.js.map +1 -0
- package/dist/init/keep-gate.d.ts +30 -0
- package/dist/init/keep-gate.d.ts.map +1 -0
- package/dist/init/keep-gate.js +178 -0
- package/dist/init/keep-gate.js.map +1 -0
- package/dist/init/keep-list.d.ts +67 -0
- package/dist/init/keep-list.d.ts.map +1 -0
- package/dist/init/keep-list.js +232 -0
- package/dist/init/keep-list.js.map +1 -0
- package/dist/init/keep.d.ts +52 -0
- package/dist/init/keep.d.ts.map +1 -0
- package/dist/init/keep.js +393 -0
- package/dist/init/keep.js.map +1 -0
- package/dist/init/look-back-mine.d.ts +37 -0
- package/dist/init/look-back-mine.d.ts.map +1 -0
- package/dist/init/look-back-mine.js +215 -0
- package/dist/init/look-back-mine.js.map +1 -0
- package/dist/init/look-back.d.ts +81 -0
- package/dist/init/look-back.d.ts.map +1 -0
- package/dist/init/look-back.js +170 -0
- package/dist/init/look-back.js.map +1 -0
- package/dist/init/miners.d.ts +46 -0
- package/dist/init/miners.d.ts.map +1 -0
- package/dist/init/miners.js +141 -0
- package/dist/init/miners.js.map +1 -0
- package/dist/init/name-call.d.ts +37 -0
- package/dist/init/name-call.d.ts.map +1 -0
- package/dist/init/name-call.js +151 -0
- package/dist/init/name-call.js.map +1 -0
- package/dist/init/plain-file.d.ts +11 -0
- package/dist/init/plain-file.d.ts.map +1 -0
- package/dist/init/plain-file.js +83 -0
- package/dist/init/plain-file.js.map +1 -0
- package/dist/init/prefs.d.ts +70 -0
- package/dist/init/prefs.d.ts.map +1 -0
- package/dist/init/prefs.js +282 -0
- package/dist/init/prefs.js.map +1 -0
- package/dist/init/relay.d.ts +15 -0
- package/dist/init/relay.d.ts.map +1 -0
- package/dist/init/relay.js +15 -0
- package/dist/init/relay.js.map +1 -0
- package/dist/init/replay-runs.d.ts +121 -0
- package/dist/init/replay-runs.d.ts.map +1 -0
- package/dist/init/replay-runs.js +457 -0
- package/dist/init/replay-runs.js.map +1 -0
- package/dist/init/replay-tamper.d.ts +18 -0
- package/dist/init/replay-tamper.d.ts.map +1 -0
- package/dist/init/replay-tamper.js +87 -0
- package/dist/init/replay-tamper.js.map +1 -0
- package/dist/init/review-screen.d.ts +74 -0
- package/dist/init/review-screen.d.ts.map +1 -0
- package/dist/init/review-screen.js +258 -0
- package/dist/init/review-screen.js.map +1 -0
- package/dist/init/review-tty.d.ts +29 -0
- package/dist/init/review-tty.d.ts.map +1 -0
- package/dist/init/review-tty.js +218 -0
- package/dist/init/review-tty.js.map +1 -0
- package/dist/init/review.d.ts +12 -0
- package/dist/init/review.d.ts.map +1 -0
- package/dist/init/review.js +12 -0
- package/dist/init/review.js.map +1 -0
- package/dist/init/run.d.ts +87 -0
- package/dist/init/run.d.ts.map +1 -0
- package/dist/init/run.js +347 -0
- package/dist/init/run.js.map +1 -0
- package/dist/init/sessions.d.ts +63 -0
- package/dist/init/sessions.d.ts.map +1 -0
- package/dist/init/sessions.js +377 -0
- package/dist/init/sessions.js.map +1 -0
- package/dist/init/transcript.d.ts +81 -0
- package/dist/init/transcript.d.ts.map +1 -0
- package/dist/init/transcript.js +216 -0
- package/dist/init/transcript.js.map +1 -0
- package/dist/init/types.d.ts +139 -0
- package/dist/init/types.d.ts.map +1 -0
- package/dist/init/types.js +2 -0
- package/dist/init/types.js.map +1 -0
- package/dist/mcp/brains.d.ts +72 -0
- package/dist/mcp/brains.d.ts.map +1 -0
- package/dist/mcp/brains.js +220 -0
- package/dist/mcp/brains.js.map +1 -0
- package/dist/mcp/server.d.ts +3 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +40 -5
- package/dist/mcp/server.js.map +1 -1
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +7 -2
- package/dist/mcp/tools.js.map +1 -1
- package/dist/notes/cold-start.d.ts +5 -184
- package/dist/notes/cold-start.d.ts.map +1 -1
- package/dist/notes/cold-start.js +5 -575
- package/dist/notes/cold-start.js.map +1 -1
- package/dist/notes/edit-overlap.d.ts.map +1 -1
- package/dist/notes/edit-overlap.js +4 -1
- package/dist/notes/edit-overlap.js.map +1 -1
- package/dist/notes/every-repo.d.ts +18 -0
- package/dist/notes/every-repo.d.ts.map +1 -0
- package/dist/notes/every-repo.js +86 -0
- package/dist/notes/every-repo.js.map +1 -0
- package/dist/notes/guardrails.d.ts +8 -0
- package/dist/notes/guardrails.d.ts.map +1 -0
- package/dist/notes/guardrails.js +38 -0
- package/dist/notes/guardrails.js.map +1 -0
- package/dist/notes/lesson-index.d.ts +13 -0
- package/dist/notes/lesson-index.d.ts.map +1 -0
- package/dist/notes/lesson-index.js +135 -0
- package/dist/notes/lesson-index.js.map +1 -0
- package/dist/notes/linked-learnings.d.ts +8 -0
- package/dist/notes/linked-learnings.d.ts.map +1 -0
- package/dist/notes/linked-learnings.js +113 -0
- package/dist/notes/linked-learnings.js.map +1 -0
- package/dist/notes/notes.d.ts +8 -4
- package/dist/notes/notes.d.ts.map +1 -1
- package/dist/notes/notes.js +9 -7
- package/dist/notes/notes.js.map +1 -1
- package/dist/notes/pr-reviews.d.ts +4 -0
- package/dist/notes/pr-reviews.d.ts.map +1 -1
- package/dist/notes/pr-reviews.js +6 -5
- package/dist/notes/pr-reviews.js.map +1 -1
- package/dist/notes/replace.d.ts +14 -0
- package/dist/notes/replace.d.ts.map +1 -0
- package/dist/notes/replace.js +38 -0
- package/dist/notes/replace.js.map +1 -0
- package/dist/notes/repo-notes-dir.d.ts +2 -0
- package/dist/notes/repo-notes-dir.d.ts.map +1 -0
- package/dist/notes/repo-notes-dir.js +16 -0
- package/dist/notes/repo-notes-dir.js.map +1 -0
- package/dist/notes/repo-trail.d.ts +1 -1
- package/dist/notes/repo-trail.d.ts.map +1 -1
- package/dist/notes/repo-trail.js +24 -4
- package/dist/notes/repo-trail.js.map +1 -1
- package/dist/search/grep.d.ts.map +1 -1
- package/dist/search/grep.js +4 -2
- package/dist/search/grep.js.map +1 -1
- package/dist/search/user-regexp.d.ts +26 -0
- package/dist/search/user-regexp.d.ts.map +1 -0
- package/dist/search/user-regexp.js +150 -0
- package/dist/search/user-regexp.js.map +1 -0
- package/dist/skills/anchors-cli.d.ts +38 -0
- package/dist/skills/anchors-cli.d.ts.map +1 -0
- package/dist/skills/anchors-cli.js +279 -0
- package/dist/skills/anchors-cli.js.map +1 -0
- package/dist/skills/anchors-git.d.ts +29 -0
- package/dist/skills/anchors-git.d.ts.map +1 -0
- package/dist/skills/anchors-git.js +241 -0
- package/dist/skills/anchors-git.js.map +1 -0
- package/dist/skills/anchors-wide.d.ts +25 -0
- package/dist/skills/anchors-wide.d.ts.map +1 -0
- package/dist/skills/anchors-wide.js +481 -0
- package/dist/skills/anchors-wide.js.map +1 -0
- package/dist/skills/anchors.d.ts +32 -0
- package/dist/skills/anchors.d.ts.map +1 -0
- package/dist/skills/anchors.js +485 -0
- package/dist/skills/anchors.js.map +1 -0
- package/dist/skills/check-result.d.ts +26 -0
- package/dist/skills/check-result.d.ts.map +1 -0
- package/dist/skills/check-result.js +46 -0
- package/dist/skills/check-result.js.map +1 -0
- package/dist/skills/cli-skills-1b.d.ts +17 -0
- package/dist/skills/cli-skills-1b.d.ts.map +1 -0
- package/dist/skills/cli-skills-1b.js +166 -0
- package/dist/skills/cli-skills-1b.js.map +1 -0
- package/dist/skills/cli-skills-2.d.ts +35 -0
- package/dist/skills/cli-skills-2.d.ts.map +1 -0
- package/dist/skills/cli-skills-2.js +129 -0
- package/dist/skills/cli-skills-2.js.map +1 -0
- package/dist/skills/cli-skills-report-1b.d.ts +49 -0
- package/dist/skills/cli-skills-report-1b.d.ts.map +1 -0
- package/dist/skills/cli-skills-report-1b.js +191 -0
- package/dist/skills/cli-skills-report-1b.js.map +1 -0
- package/dist/skills/cli-skills-report.d.ts +86 -0
- package/dist/skills/cli-skills-report.d.ts.map +1 -0
- package/dist/skills/cli-skills-report.js +121 -0
- package/dist/skills/cli-skills-report.js.map +1 -0
- package/dist/skills/cli-skills.d.ts +30 -0
- package/dist/skills/cli-skills.d.ts.map +1 -0
- package/dist/skills/cli-skills.js +379 -0
- package/dist/skills/cli-skills.js.map +1 -0
- package/dist/skills/codex-sandbox.d.ts +6 -0
- package/dist/skills/codex-sandbox.d.ts.map +1 -0
- package/dist/skills/codex-sandbox.js +55 -0
- package/dist/skills/codex-sandbox.js.map +1 -0
- package/dist/skills/compile-split.d.ts +57 -0
- package/dist/skills/compile-split.d.ts.map +1 -0
- package/dist/skills/compile-split.js +550 -0
- package/dist/skills/compile-split.js.map +1 -0
- package/dist/skills/compile-version.d.ts +37 -0
- package/dist/skills/compile-version.d.ts.map +1 -0
- package/dist/skills/compile-version.js +56 -0
- package/dist/skills/compile-version.js.map +1 -0
- package/dist/skills/compile-waits.d.ts +12 -0
- package/dist/skills/compile-waits.d.ts.map +1 -0
- package/dist/skills/compile-waits.js +52 -0
- package/dist/skills/compile-waits.js.map +1 -0
- package/dist/skills/compile-words.d.ts +85 -0
- package/dist/skills/compile-words.d.ts.map +1 -0
- package/dist/skills/compile-words.js +445 -0
- package/dist/skills/compile-words.js.map +1 -0
- package/dist/skills/compile.d.ts +42 -0
- package/dist/skills/compile.d.ts.map +1 -0
- package/dist/skills/compile.js +505 -0
- package/dist/skills/compile.js.map +1 -0
- package/dist/skills/credit-facts.d.ts +8 -0
- package/dist/skills/credit-facts.d.ts.map +1 -0
- package/dist/skills/credit-facts.js +32 -0
- package/dist/skills/credit-facts.js.map +1 -0
- package/dist/skills/credit.d.ts +86 -0
- package/dist/skills/credit.d.ts.map +1 -0
- package/dist/skills/credit.js +259 -0
- package/dist/skills/credit.js.map +1 -0
- package/dist/skills/directive-words.d.ts +11 -0
- package/dist/skills/directive-words.d.ts.map +1 -0
- package/dist/skills/directive-words.js +33 -0
- package/dist/skills/directive-words.js.map +1 -0
- package/dist/skills/fidelity.d.ts +42 -0
- package/dist/skills/fidelity.d.ts.map +1 -0
- package/dist/skills/fidelity.js +138 -0
- package/dist/skills/fidelity.js.map +1 -0
- package/dist/skills/fold-gated.d.ts +3 -0
- package/dist/skills/fold-gated.d.ts.map +1 -0
- package/dist/skills/fold-gated.js +78 -0
- package/dist/skills/fold-gated.js.map +1 -0
- package/dist/skills/fold.d.ts +87 -0
- package/dist/skills/fold.d.ts.map +1 -0
- package/dist/skills/fold.js +348 -0
- package/dist/skills/fold.js.map +1 -0
- package/dist/skills/follow-learnings.d.ts +128 -0
- package/dist/skills/follow-learnings.d.ts.map +1 -0
- package/dist/skills/follow-learnings.js +278 -0
- package/dist/skills/follow-learnings.js.map +1 -0
- package/dist/skills/forget-notice.d.ts +44 -0
- package/dist/skills/forget-notice.d.ts.map +1 -0
- package/dist/skills/forget-notice.js +131 -0
- package/dist/skills/forget-notice.js.map +1 -0
- package/dist/skills/front-version.d.ts +12 -0
- package/dist/skills/front-version.d.ts.map +1 -0
- package/dist/skills/front-version.js +87 -0
- package/dist/skills/front-version.js.map +1 -0
- package/dist/skills/host-facts.d.ts +51 -0
- package/dist/skills/host-facts.d.ts.map +1 -0
- package/dist/skills/host-facts.js +134 -0
- package/dist/skills/host-facts.js.map +1 -0
- package/dist/skills/learning-steps.d.ts +43 -0
- package/dist/skills/learning-steps.d.ts.map +1 -0
- package/dist/skills/learning-steps.js +294 -0
- package/dist/skills/learning-steps.js.map +1 -0
- package/dist/skills/ledger.d.ts +43 -0
- package/dist/skills/ledger.d.ts.map +1 -0
- package/dist/skills/ledger.js +336 -0
- package/dist/skills/ledger.js.map +1 -0
- package/dist/skills/lesson-gate.d.ts +25 -0
- package/dist/skills/lesson-gate.d.ts.map +1 -0
- package/dist/skills/lesson-gate.js +316 -0
- package/dist/skills/lesson-gate.js.map +1 -0
- package/dist/skills/lessons.d.ts +60 -0
- package/dist/skills/lessons.d.ts.map +1 -0
- package/dist/skills/lessons.js +396 -0
- package/dist/skills/lessons.js.map +1 -0
- package/dist/skills/offer-answers.d.ts +20 -0
- package/dist/skills/offer-answers.d.ts.map +1 -0
- package/dist/skills/offer-answers.js +51 -0
- package/dist/skills/offer-answers.js.map +1 -0
- package/dist/skills/offer-drift.d.ts +35 -0
- package/dist/skills/offer-drift.d.ts.map +1 -0
- package/dist/skills/offer-drift.js +98 -0
- package/dist/skills/offer-drift.js.map +1 -0
- package/dist/skills/offer-lesson.d.ts +31 -0
- package/dist/skills/offer-lesson.d.ts.map +1 -0
- package/dist/skills/offer-lesson.js +123 -0
- package/dist/skills/offer-lesson.js.map +1 -0
- package/dist/skills/offer-lines.d.ts +40 -0
- package/dist/skills/offer-lines.d.ts.map +1 -0
- package/dist/skills/offer-lines.js +80 -0
- package/dist/skills/offer-lines.js.map +1 -0
- package/dist/skills/offer-moment.d.ts +102 -0
- package/dist/skills/offer-moment.d.ts.map +1 -0
- package/dist/skills/offer-moment.js +260 -0
- package/dist/skills/offer-moment.js.map +1 -0
- package/dist/skills/offer-repair.d.ts +36 -0
- package/dist/skills/offer-repair.d.ts.map +1 -0
- package/dist/skills/offer-repair.js +212 -0
- package/dist/skills/offer-repair.js.map +1 -0
- package/dist/skills/offer-retire.d.ts +53 -0
- package/dist/skills/offer-retire.d.ts.map +1 -0
- package/dist/skills/offer-retire.js +149 -0
- package/dist/skills/offer-retire.js.map +1 -0
- package/dist/skills/offer-update.d.ts +54 -0
- package/dist/skills/offer-update.d.ts.map +1 -0
- package/dist/skills/offer-update.js +115 -0
- package/dist/skills/offer-update.js.map +1 -0
- package/dist/skills/offer-words-1b.d.ts +32 -0
- package/dist/skills/offer-words-1b.d.ts.map +1 -0
- package/dist/skills/offer-words-1b.js +80 -0
- package/dist/skills/offer-words-1b.js.map +1 -0
- package/dist/skills/offer-words-2.d.ts +123 -0
- package/dist/skills/offer-words-2.d.ts.map +1 -0
- package/dist/skills/offer-words-2.js +194 -0
- package/dist/skills/offer-words-2.js.map +1 -0
- package/dist/skills/offer-words.d.ts +65 -0
- package/dist/skills/offer-words.d.ts.map +1 -0
- package/dist/skills/offer-words.js +205 -0
- package/dist/skills/offer-words.js.map +1 -0
- package/dist/skills/offers.d.ts +66 -0
- package/dist/skills/offers.d.ts.map +1 -0
- package/dist/skills/offers.js +284 -0
- package/dist/skills/offers.js.map +1 -0
- package/dist/skills/own-folder.d.ts +9 -0
- package/dist/skills/own-folder.d.ts.map +1 -0
- package/dist/skills/own-folder.js +36 -0
- package/dist/skills/own-folder.js.map +1 -0
- package/dist/skills/person.d.ts +34 -0
- package/dist/skills/person.d.ts.map +1 -0
- package/dist/skills/person.js +102 -0
- package/dist/skills/person.js.map +1 -0
- package/dist/skills/probe-clean.d.ts +9 -0
- package/dist/skills/probe-clean.d.ts.map +1 -0
- package/dist/skills/probe-clean.js +48 -0
- package/dist/skills/probe-clean.js.map +1 -0
- package/dist/skills/probes.d.ts +26 -0
- package/dist/skills/probes.d.ts.map +1 -0
- package/dist/skills/probes.js +225 -0
- package/dist/skills/probes.js.map +1 -0
- package/dist/skills/recall.d.ts +119 -0
- package/dist/skills/recall.d.ts.map +1 -0
- package/dist/skills/recall.js +370 -0
- package/dist/skills/recall.js.map +1 -0
- package/dist/skills/receipts.d.ts +44 -0
- package/dist/skills/receipts.d.ts.map +1 -0
- package/dist/skills/receipts.js +223 -0
- package/dist/skills/receipts.js.map +1 -0
- package/dist/skills/run-checkout.d.ts +4 -0
- package/dist/skills/run-checkout.d.ts.map +1 -0
- package/dist/skills/run-checkout.js +37 -0
- package/dist/skills/run-checkout.js.map +1 -0
- package/dist/skills/runblock.d.ts +47 -0
- package/dist/skills/runblock.d.ts.map +1 -0
- package/dist/skills/runblock.js +227 -0
- package/dist/skills/runblock.js.map +1 -0
- package/dist/skills/save-gate.d.ts +64 -0
- package/dist/skills/save-gate.d.ts.map +1 -0
- package/dist/skills/save-gate.js +354 -0
- package/dist/skills/save-gate.js.map +1 -0
- package/dist/skills/save-parse.d.ts +42 -0
- package/dist/skills/save-parse.d.ts.map +1 -0
- package/dist/skills/save-parse.js +172 -0
- package/dist/skills/save-parse.js.map +1 -0
- package/dist/skills/save-store.d.ts +12 -0
- package/dist/skills/save-store.d.ts.map +1 -0
- package/dist/skills/save-store.js +22 -0
- package/dist/skills/save-store.js.map +1 -0
- package/dist/skills/save-verify.d.ts +59 -0
- package/dist/skills/save-verify.d.ts.map +1 -0
- package/dist/skills/save-verify.js +390 -0
- package/dist/skills/save-verify.js.map +1 -0
- package/dist/skills/settings.d.ts +48 -0
- package/dist/skills/settings.d.ts.map +1 -0
- package/dist/skills/settings.js +155 -0
- package/dist/skills/settings.js.map +1 -0
- package/dist/skills/skill-diff.d.ts +40 -0
- package/dist/skills/skill-diff.d.ts.map +1 -0
- package/dist/skills/skill-diff.js +191 -0
- package/dist/skills/skill-diff.js.map +1 -0
- package/dist/skills/skill-file.d.ts +24 -0
- package/dist/skills/skill-file.d.ts.map +1 -0
- package/dist/skills/skill-file.js +97 -0
- package/dist/skills/skill-file.js.map +1 -0
- package/dist/skills/skill-rebuild.d.ts +27 -0
- package/dist/skills/skill-rebuild.d.ts.map +1 -0
- package/dist/skills/skill-rebuild.js +85 -0
- package/dist/skills/skill-rebuild.js.map +1 -0
- package/dist/skills/skillmd.d.ts +17 -0
- package/dist/skills/skillmd.d.ts.map +1 -0
- package/dist/skills/skillmd.js +219 -0
- package/dist/skills/skillmd.js.map +1 -0
- package/dist/skills/skills.d.ts +28 -8
- package/dist/skills/skills.d.ts.map +1 -1
- package/dist/skills/skills.js +106 -53
- package/dist/skills/skills.js.map +1 -1
- package/dist/skills/staleness.d.ts +27 -0
- package/dist/skills/staleness.d.ts.map +1 -0
- package/dist/skills/staleness.js +178 -0
- package/dist/skills/staleness.js.map +1 -0
- package/dist/skills/state.d.ts +36 -0
- package/dist/skills/state.d.ts.map +1 -0
- package/dist/skills/state.js +259 -0
- package/dist/skills/state.js.map +1 -0
- package/dist/skills/store-fs.d.ts +77 -0
- package/dist/skills/store-fs.d.ts.map +1 -0
- package/dist/skills/store-fs.js +194 -0
- package/dist/skills/store-fs.js.map +1 -0
- package/dist/skills/store-held.d.ts +44 -0
- package/dist/skills/store-held.d.ts.map +1 -0
- package/dist/skills/store-held.js +147 -0
- package/dist/skills/store-held.js.map +1 -0
- package/dist/skills/store.d.ts +73 -0
- package/dist/skills/store.d.ts.map +1 -0
- package/dist/skills/store.js +279 -0
- package/dist/skills/store.js.map +1 -0
- package/dist/skills/types.d.ts +8 -0
- package/dist/skills/types.d.ts.map +1 -1
- package/dist/skills/update-gate.d.ts +36 -0
- package/dist/skills/update-gate.d.ts.map +1 -0
- package/dist/skills/update-gate.js +357 -0
- package/dist/skills/update-gate.js.map +1 -0
- package/dist/skills/update-plan.d.ts +40 -0
- package/dist/skills/update-plan.d.ts.map +1 -0
- package/dist/skills/update-plan.js +196 -0
- package/dist/skills/update-plan.js.map +1 -0
- package/dist/skills/validate.d.ts +11 -0
- package/dist/skills/validate.d.ts.map +1 -0
- package/dist/skills/validate.js +112 -0
- package/dist/skills/validate.js.map +1 -0
- package/dist/skills/value-line.d.ts +94 -0
- package/dist/skills/value-line.d.ts.map +1 -0
- package/dist/skills/value-line.js +355 -0
- package/dist/skills/value-line.js.map +1 -0
- package/dist/skills/versions-fs.d.ts +45 -0
- package/dist/skills/versions-fs.d.ts.map +1 -0
- package/dist/skills/versions-fs.js +234 -0
- package/dist/skills/versions-fs.js.map +1 -0
- package/dist/skills/versions.d.ts +56 -0
- package/dist/skills/versions.d.ts.map +1 -0
- package/dist/skills/versions.js +351 -0
- package/dist/skills/versions.js.map +1 -0
- package/dist/telemetry/contract.d.ts +15 -1
- package/dist/telemetry/contract.d.ts.map +1 -1
- package/dist/telemetry/contract.js +80 -11
- package/dist/telemetry/contract.js.map +1 -1
- package/dist/telemetry/gate.js +4 -4
- package/dist/telemetry/gate.js.map +1 -1
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.d.ts.map +1 -1
- package/dist/telemetry/index.js +1 -1
- package/dist/telemetry/index.js.map +1 -1
- package/dist/telemetry/notice.js +5 -5
- package/dist/telemetry/notice.js.map +1 -1
- package/dist/telemetry/queue.d.ts.map +1 -1
- package/dist/telemetry/queue.js +7 -7
- package/dist/telemetry/queue.js.map +1 -1
- package/dist/telemetry/track.d.ts.map +1 -1
- package/dist/telemetry/track.js +4 -3
- package/dist/telemetry/track.js.map +1 -1
- package/dist/trace/checks.d.ts +63 -0
- package/dist/trace/checks.d.ts.map +1 -0
- package/dist/trace/checks.js +495 -0
- package/dist/trace/checks.js.map +1 -0
- package/dist/trace/claude.d.ts +124 -0
- package/dist/trace/claude.d.ts.map +1 -0
- package/dist/trace/claude.js +303 -0
- package/dist/trace/claude.js.map +1 -0
- package/dist/trace/codex-exec.d.ts +22 -0
- package/dist/trace/codex-exec.d.ts.map +1 -0
- package/dist/trace/codex-exec.js +129 -0
- package/dist/trace/codex-exec.js.map +1 -0
- package/dist/trace/codex-meta.d.ts +23 -0
- package/dist/trace/codex-meta.d.ts.map +1 -0
- package/dist/trace/codex-meta.js +112 -0
- package/dist/trace/codex-meta.js.map +1 -0
- package/dist/trace/codex.d.ts +33 -0
- package/dist/trace/codex.d.ts.map +1 -0
- package/dist/trace/codex.js +485 -0
- package/dist/trace/codex.js.map +1 -0
- package/dist/trace/cursor.d.ts +16 -0
- package/dist/trace/cursor.d.ts.map +1 -0
- package/dist/trace/cursor.js +133 -0
- package/dist/trace/cursor.js.map +1 -0
- package/dist/trace/dialect.d.ts +43 -0
- package/dist/trace/dialect.d.ts.map +1 -0
- package/dist/trace/dialect.js +95 -0
- package/dist/trace/dialect.js.map +1 -0
- package/dist/trace/epochs.d.ts +10 -0
- package/dist/trace/epochs.d.ts.map +1 -0
- package/dist/trace/epochs.js +16 -0
- package/dist/trace/epochs.js.map +1 -0
- package/dist/trace/failure.d.ts +15 -0
- package/dist/trace/failure.d.ts.map +1 -0
- package/dist/trace/failure.js +69 -0
- package/dist/trace/failure.js.map +1 -0
- package/dist/trace/gate-file.d.ts +71 -0
- package/dist/trace/gate-file.d.ts.map +1 -0
- package/dist/trace/gate-file.js +329 -0
- package/dist/trace/gate-file.js.map +1 -0
- package/dist/trace/guard-fast.d.ts +22 -0
- package/dist/trace/guard-fast.d.ts.map +1 -0
- package/dist/trace/guard-fast.js +213 -0
- package/dist/trace/guard-fast.js.map +1 -0
- package/dist/trace/housekeeping.d.ts +5 -0
- package/dist/trace/housekeeping.d.ts.map +1 -0
- package/dist/trace/housekeeping.js +93 -0
- package/dist/trace/housekeeping.js.map +1 -0
- package/dist/trace/jobs.d.ts +52 -0
- package/dist/trace/jobs.d.ts.map +1 -0
- package/dist/trace/jobs.js +182 -0
- package/dist/trace/jobs.js.map +1 -0
- package/dist/trace/known-repo.d.ts +3 -0
- package/dist/trace/known-repo.d.ts.map +1 -0
- package/dist/trace/known-repo.js +55 -0
- package/dist/trace/known-repo.js.map +1 -0
- package/dist/trace/pool.d.ts +40 -0
- package/dist/trace/pool.d.ts.map +1 -0
- package/dist/trace/pool.js +154 -0
- package/dist/trace/pool.js.map +1 -0
- package/dist/trace/repairs.d.ts +27 -0
- package/dist/trace/repairs.d.ts.map +1 -0
- package/dist/trace/repairs.js +303 -0
- package/dist/trace/repairs.js.map +1 -0
- package/dist/trace/run-calls.d.ts +82 -0
- package/dist/trace/run-calls.d.ts.map +1 -0
- package/dist/trace/run-calls.js +331 -0
- package/dist/trace/run-calls.js.map +1 -0
- package/dist/trace/run-join.d.ts +20 -0
- package/dist/trace/run-join.d.ts.map +1 -0
- package/dist/trace/run-join.js +99 -0
- package/dist/trace/run-join.js.map +1 -0
- package/dist/trace/run-sheets.d.ts +26 -0
- package/dist/trace/run-sheets.d.ts.map +1 -0
- package/dist/trace/run-sheets.js +145 -0
- package/dist/trace/run-sheets.js.map +1 -0
- package/dist/trace/run-turns.d.ts +24 -0
- package/dist/trace/run-turns.d.ts.map +1 -0
- package/dist/trace/run-turns.js +67 -0
- package/dist/trace/run-turns.js.map +1 -0
- package/dist/trace/run-verdict.d.ts +24 -0
- package/dist/trace/run-verdict.d.ts.map +1 -0
- package/dist/trace/run-verdict.js +176 -0
- package/dist/trace/run-verdict.js.map +1 -0
- package/dist/trace/runs.d.ts +54 -0
- package/dist/trace/runs.d.ts.map +1 -0
- package/dist/trace/runs.js +501 -0
- package/dist/trace/runs.js.map +1 -0
- package/dist/trace/skill-session.d.ts +64 -0
- package/dist/trace/skill-session.d.ts.map +1 -0
- package/dist/trace/skill-session.js +232 -0
- package/dist/trace/skill-session.js.map +1 -0
- package/dist/trace/tamper.d.ts +12 -0
- package/dist/trace/tamper.d.ts.map +1 -0
- package/dist/trace/tamper.js +405 -0
- package/dist/trace/tamper.js.map +1 -0
- package/dist/trace/typed.d.ts +30 -0
- package/dist/trace/typed.d.ts.map +1 -0
- package/dist/trace/typed.js +132 -0
- package/dist/trace/typed.js.map +1 -0
- package/dist/trace/wall-state.d.ts +86 -0
- package/dist/trace/wall-state.d.ts.map +1 -0
- package/dist/trace/wall-state.js +279 -0
- package/dist/trace/wall-state.js.map +1 -0
- package/dist/trace/walls.d.ts +40 -0
- package/dist/trace/walls.d.ts.map +1 -0
- package/dist/trace/walls.js +318 -0
- package/dist/trace/walls.js.map +1 -0
- package/dist/upkeep-run.d.ts.map +1 -1
- package/dist/upkeep-run.js +2 -23
- package/dist/upkeep-run.js.map +1 -1
- package/dist/upkeep.d.ts.map +1 -1
- package/dist/upkeep.js +2 -3
- package/dist/upkeep.js.map +1 -1
- package/dist/util/private-fs.d.ts +6 -0
- package/dist/util/private-fs.d.ts.map +1 -1
- package/dist/util/private-fs.js +9 -1
- package/dist/util/private-fs.js.map +1 -1
- package/dist/util/state.d.ts.map +1 -1
- package/dist/util/state.js +17 -3
- package/dist/util/state.js.map +1 -1
- package/dist/vendor/tree-sitter-swift/LICENSE +21 -0
- package/dist/vendor/tree-sitter-swift/node-types.json +30694 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/darwin-arm64/tree-sitter-swift.node +0 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/darwin-x64/tree-sitter-swift.node +0 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/linux-arm64/tree-sitter-swift.node +0 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/linux-x64/tree-sitter-swift.node +0 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/win32-arm64/tree-sitter-swift.node +0 -0
- package/dist/vendor/tree-sitter-swift/prebuilds/win32-x64/tree-sitter-swift.node +0 -0
- package/package.json +6 -3
- package/scripts/stamp-telemetry-key.mjs +8 -5
- package/scripts/vendor-grammars.mjs +35 -0
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a Claude Code transcript: whose words each line holds.
|
|
3
|
+
*
|
|
4
|
+
* Only what the person typed can teach Trail anything. A transcript's `user`
|
|
5
|
+
* lines also carry text the agent read: compaction summaries (the model's
|
|
6
|
+
* own retelling, which can repeat what a tool returned), task notices from
|
|
7
|
+
* background work, slash-command wrappers, other sessions' hand-backs,
|
|
8
|
+
* subagent lines, tool results. About a third of what a naive `type: user`
|
|
9
|
+
* test calls a prompt is one of these. The flags Claude Code writes
|
|
10
|
+
* (`origin.kind`, `isMeta`, `isCompactSummary`, `isSidechain`) and the
|
|
11
|
+
* wrappers it puts around harness text decide; a line from a build too old to
|
|
12
|
+
* stamp `origin` is judged by its wrappers alone. `promptSource` does not
|
|
13
|
+
* decide: the desktop app and the IDE extension mark typed prompts `sdk`.
|
|
14
|
+
* A row from `claude -p` or an SDK (`entrypoint: sdk…`) is a script's prompt,
|
|
15
|
+
* never the person's, except in a lab home with the lab switch on (D26, D99),
|
|
16
|
+
* where the lab's headless runs stand in for a person.
|
|
17
|
+
*
|
|
18
|
+
* IDE context (`<ide_opened_file>`, `<ide_selection>`) and reminders ride in
|
|
19
|
+
* the same message as a real prompt, so they are stripped and the prompt is
|
|
20
|
+
* kept. A pasted block becomes a marker: the person sent it, but didn't write
|
|
21
|
+
* it.
|
|
22
|
+
*
|
|
23
|
+
* This is the one filter every learning path uses: cold start, the trace
|
|
24
|
+
* stream, provenance.
|
|
25
|
+
*
|
|
26
|
+
* `readNewEvents` turns what a transcript gained since the last read into one
|
|
27
|
+
* stream: typed words, injected text, tool calls, their results (failed or
|
|
28
|
+
* not), assistant text and compactions. Built in memory, never stored.
|
|
29
|
+
*/
|
|
30
|
+
import { type Memo, type ReadOptions } from "./cursor.js";
|
|
31
|
+
/**
|
|
32
|
+
* `offset` is the byte offset of the line the event came from (the save gate
|
|
33
|
+
* re-reads that line). A call carries the folder (`cwd`) and branch
|
|
34
|
+
* (`gitBranch`) the host recorded on its line; a result carries the host's own
|
|
35
|
+
* error flag (`isError`) apart from `ok`, which also reads failure text.
|
|
36
|
+
* `uuid` is the line's entry id: a transcript that repeats a block of its
|
|
37
|
+
* history repeats the ids, so the fold can tell old lines from new (D56d).
|
|
38
|
+
*/
|
|
39
|
+
export type TraceEvent = {
|
|
40
|
+
kind: "typed";
|
|
41
|
+
text: string;
|
|
42
|
+
at: string;
|
|
43
|
+
offset?: number;
|
|
44
|
+
uuid?: string;
|
|
45
|
+
} | {
|
|
46
|
+
kind: "injected";
|
|
47
|
+
text: string;
|
|
48
|
+
at: string;
|
|
49
|
+
offset?: number;
|
|
50
|
+
uuid?: string;
|
|
51
|
+
} | {
|
|
52
|
+
kind: "tool_call";
|
|
53
|
+
id: string;
|
|
54
|
+
name: string;
|
|
55
|
+
input: unknown;
|
|
56
|
+
at: string;
|
|
57
|
+
offset?: number;
|
|
58
|
+
uuid?: string;
|
|
59
|
+
cwd?: string;
|
|
60
|
+
branch?: string;
|
|
61
|
+
} | {
|
|
62
|
+
kind: "tool_result";
|
|
63
|
+
id: string;
|
|
64
|
+
ok: boolean;
|
|
65
|
+
text: string;
|
|
66
|
+
at: string;
|
|
67
|
+
offset?: number;
|
|
68
|
+
uuid?: string;
|
|
69
|
+
isError?: boolean;
|
|
70
|
+
} | {
|
|
71
|
+
kind: "compaction";
|
|
72
|
+
at: string;
|
|
73
|
+
offset?: number;
|
|
74
|
+
uuid?: string;
|
|
75
|
+
} | {
|
|
76
|
+
kind: "assistant";
|
|
77
|
+
text: string;
|
|
78
|
+
at: string;
|
|
79
|
+
offset?: number;
|
|
80
|
+
uuid?: string;
|
|
81
|
+
};
|
|
82
|
+
/** What stands for a pasted block in the person's words. */
|
|
83
|
+
export declare const PASTE_MARK = "[pasted text]";
|
|
84
|
+
/** The text parts of a message's content, joined; images, tool parts and the rest left out. */
|
|
85
|
+
export declare function textOf(content: unknown): string;
|
|
86
|
+
/**
|
|
87
|
+
* The person's own words in one message's raw text: wrappers stripped,
|
|
88
|
+
* pastes marked, and "" when what's left is harness text or nothing typed.
|
|
89
|
+
*/
|
|
90
|
+
export declare function ownText(raw: string): string;
|
|
91
|
+
/**
|
|
92
|
+
* What the person typed in this transcript line, IDE tags and reminders stripped; "" when it isn't theirs.
|
|
93
|
+
* `env` decides only whether an sdk row can be typed (a lab home with the switch, D99).
|
|
94
|
+
*/
|
|
95
|
+
export declare function typedText(entry: unknown, env?: NodeJS.ProcessEnv): string;
|
|
96
|
+
/** Whether this transcript line is something the person typed. */
|
|
97
|
+
export declare function isTypedByPerson(entry: unknown, env?: NodeJS.ProcessEnv): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* The events one parsed transcript line holds: the reader `readNewEvents` uses, for a caller that walks a file
|
|
100
|
+
* itself (init's replay over a byte range, b5). `memo` carries the open tool calls from line to line: start it
|
|
101
|
+
* as `{}` and pass the same object for every line of one read. Never throws on a line that isn't an entry.
|
|
102
|
+
*/
|
|
103
|
+
export declare function lineEvents(entry: unknown, memo: Memo, offset?: number, env?: NodeJS.ProcessEnv): TraceEvent[];
|
|
104
|
+
export interface EventReadOptions extends ReadOptions {
|
|
105
|
+
/**
|
|
106
|
+
* Each line read, parsed, before its events: for a reader that needs what
|
|
107
|
+
* the events leave out (a reply's uuid, a response's usage). `memo` is the
|
|
108
|
+
* one saved with the cursor and started over with it; keep the caller's
|
|
109
|
+
* state under one key of its own. A throw is the caller's to avoid: it
|
|
110
|
+
* ends the read without saving the cursor.
|
|
111
|
+
*/
|
|
112
|
+
onEntry?: (entry: Record<string, unknown>, memo: Memo) => void;
|
|
113
|
+
/** Whose env decides whether an sdk row is typed (`typedText`); default `process.env`. */
|
|
114
|
+
env?: NodeJS.ProcessEnv;
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The events a Claude Code transcript gained since the last call with the
|
|
118
|
+
* same `cursorPath`. The first call with no cursor reads at most the last
|
|
119
|
+
* 8 MB (`opts.firstReadBytes`; `Infinity` for the whole file). Never throws: a
|
|
120
|
+
* transcript that can't be read gives no events, and a cursor that can't be
|
|
121
|
+
* saved still returns what was read.
|
|
122
|
+
*/
|
|
123
|
+
export declare function readNewEvents(transcriptPath: string, cursorPath: string, opts?: EventReadOptions): TraceEvent[];
|
|
124
|
+
//# sourceMappingURL=claude.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/trace/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAgB,KAAK,IAAI,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAIxE;;;;;;;GAOG;AACH,MAAM,MAAM,UAAU,GAClB;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC3E;IAAE,IAAI,EAAE,UAAU,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,GAC9E;IAAE,IAAI,EAAE,WAAW,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,OAAO,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,IAAI,CAAC,EAA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AC,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,UAAU,EAAE,CAK1H;AAED,MAAM,WAAW,gBAAiB,SAAQ,WAAW;IACnD;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,IAAI,KAAK,IAAI,CAAC;IAC/D,0FAA0F;IAC1F,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,cAAc,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,IAAI,GAAE,gBAAqB,GAAG,UAAU,EAAE,CAyBnH"}
|
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reading a Claude Code transcript: whose words each line holds.
|
|
3
|
+
*
|
|
4
|
+
* Only what the person typed can teach Trail anything. A transcript's `user`
|
|
5
|
+
* lines also carry text the agent read: compaction summaries (the model's
|
|
6
|
+
* own retelling, which can repeat what a tool returned), task notices from
|
|
7
|
+
* background work, slash-command wrappers, other sessions' hand-backs,
|
|
8
|
+
* subagent lines, tool results. About a third of what a naive `type: user`
|
|
9
|
+
* test calls a prompt is one of these. The flags Claude Code writes
|
|
10
|
+
* (`origin.kind`, `isMeta`, `isCompactSummary`, `isSidechain`) and the
|
|
11
|
+
* wrappers it puts around harness text decide; a line from a build too old to
|
|
12
|
+
* stamp `origin` is judged by its wrappers alone. `promptSource` does not
|
|
13
|
+
* decide: the desktop app and the IDE extension mark typed prompts `sdk`.
|
|
14
|
+
* A row from `claude -p` or an SDK (`entrypoint: sdk…`) is a script's prompt,
|
|
15
|
+
* never the person's, except in a lab home with the lab switch on (D26, D99),
|
|
16
|
+
* where the lab's headless runs stand in for a person.
|
|
17
|
+
*
|
|
18
|
+
* IDE context (`<ide_opened_file>`, `<ide_selection>`) and reminders ride in
|
|
19
|
+
* the same message as a real prompt, so they are stripped and the prompt is
|
|
20
|
+
* kept. A pasted block becomes a marker: the person sent it, but didn't write
|
|
21
|
+
* it.
|
|
22
|
+
*
|
|
23
|
+
* This is the one filter every learning path uses: cold start, the trace
|
|
24
|
+
* stream, provenance.
|
|
25
|
+
*
|
|
26
|
+
* `readNewEvents` turns what a transcript gained since the last read into one
|
|
27
|
+
* stream: typed words, injected text, tool calls, their results (failed or
|
|
28
|
+
* not), assistant text and compactions. Built in memory, never stored.
|
|
29
|
+
*/
|
|
30
|
+
import { readAppended } from "./cursor.js";
|
|
31
|
+
import { failedText } from "./failure.js";
|
|
32
|
+
import { labInteractive } from "../skills/host-facts.js";
|
|
33
|
+
/** What stands for a pasted block in the person's words. */
|
|
34
|
+
export const PASTE_MARK = "[pasted text]";
|
|
35
|
+
/** Context the harness or IDE wraps around a real prompt: stripped, the prompt kept. */
|
|
36
|
+
const WRAPPED = /<(ide_[a-z_]+|system-reminder|user-prompt-submit-hook)\b[^>]*>[\s\S]*?<\/\1>/g;
|
|
37
|
+
/** Claude Code writes `<pasted_content id="1">…</pasted_content id="1">`; a cut-off one runs to the end. */
|
|
38
|
+
const PASTED = /<pasted_content\b[^>]*>[\s\S]*?(?:<\/pasted_content[^>]*>|$)/g;
|
|
39
|
+
/**
|
|
40
|
+
* Harness text that stands where a prompt would: a leading tag
|
|
41
|
+
* (`<task-notification>`, `<command-name>`, `<local-command-stdout>`,
|
|
42
|
+
* `<bash-input>`, `<agent-message>`, …), an interruption, a resumed
|
|
43
|
+
* session's preamble, a hand-back from another session.
|
|
44
|
+
*/
|
|
45
|
+
const NOT_TYPED = [
|
|
46
|
+
/^<[a-z][a-z0-9_-]*(?:\s[^>]*)?>/,
|
|
47
|
+
/^Caveat:/,
|
|
48
|
+
/^Another Claude session sent a message/,
|
|
49
|
+
/^\[Request interrupted/,
|
|
50
|
+
/^This session is being continued/,
|
|
51
|
+
];
|
|
52
|
+
/** The text parts of a message's content, joined; images, tool parts and the rest left out. */
|
|
53
|
+
export function textOf(content) {
|
|
54
|
+
if (typeof content === "string")
|
|
55
|
+
return content;
|
|
56
|
+
if (!Array.isArray(content))
|
|
57
|
+
return "";
|
|
58
|
+
const out = [];
|
|
59
|
+
for (const p of content) {
|
|
60
|
+
if (p && typeof p === "object" && p.type === "text" && typeof p.text === "string") {
|
|
61
|
+
out.push(p.text);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return out.join("\n");
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* The person's own words in one message's raw text: wrappers stripped,
|
|
68
|
+
* pastes marked, and "" when what's left is harness text or nothing typed.
|
|
69
|
+
*/
|
|
70
|
+
export function ownText(raw) {
|
|
71
|
+
const t = raw.replace(WRAPPED, "").replace(PASTED, PASTE_MARK).trim();
|
|
72
|
+
if (!t || NOT_TYPED.some((re) => re.test(t)))
|
|
73
|
+
return "";
|
|
74
|
+
if (!t.split(PASTE_MARK).join("").trim())
|
|
75
|
+
return "";
|
|
76
|
+
return t;
|
|
77
|
+
}
|
|
78
|
+
/** The raw text of a line that could be the person's, or null when its flags say it isn't. */
|
|
79
|
+
function candidateText(entry, env) {
|
|
80
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
81
|
+
return null;
|
|
82
|
+
const e = entry;
|
|
83
|
+
if (e.isMeta || e.isSidechain || e.isCompactSummary || e.isVisibleInTranscriptOnly)
|
|
84
|
+
return null;
|
|
85
|
+
// `claude -p` and the SDKs: a script's prompt, written once and replayed. Only a lab home with the switch (D99) reads it.
|
|
86
|
+
if (typeof e.entrypoint === "string" && e.entrypoint.startsWith("sdk") && !labInteractive(env))
|
|
87
|
+
return null;
|
|
88
|
+
const human = (o) => o === undefined || o === null || (typeof o === "object" && o.kind === "human");
|
|
89
|
+
if (e.type === "user") {
|
|
90
|
+
if (!human(e.origin))
|
|
91
|
+
return null;
|
|
92
|
+
const content = e.message?.content;
|
|
93
|
+
if (Array.isArray(content) && content.some((p) => p && typeof p === "object" && p.type === "tool_result"))
|
|
94
|
+
return null;
|
|
95
|
+
return textOf(content);
|
|
96
|
+
}
|
|
97
|
+
// A message typed while the agent was busy is queued and lands as an attachment.
|
|
98
|
+
if (e.type === "attachment") {
|
|
99
|
+
const a = e.attachment;
|
|
100
|
+
if (!a || a.type !== "queued_command" || a.commandMode !== "prompt" || a.isMeta || !human(a.origin))
|
|
101
|
+
return null;
|
|
102
|
+
return textOf(a.prompt);
|
|
103
|
+
}
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* What the person typed in this transcript line, IDE tags and reminders stripped; "" when it isn't theirs.
|
|
108
|
+
* `env` decides only whether an sdk row can be typed (a lab home with the switch, D99).
|
|
109
|
+
*/
|
|
110
|
+
export function typedText(entry, env = process.env) {
|
|
111
|
+
try {
|
|
112
|
+
const raw = candidateText(entry, env);
|
|
113
|
+
return raw === null ? "" : ownText(raw);
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
return "";
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
/** Whether this transcript line is something the person typed. */
|
|
120
|
+
export function isTypedByPerson(entry, env = process.env) {
|
|
121
|
+
return typedText(entry, env) !== "";
|
|
122
|
+
}
|
|
123
|
+
/* -------------------------------------------------------------------------- */
|
|
124
|
+
/* The event stream */
|
|
125
|
+
/* -------------------------------------------------------------------------- */
|
|
126
|
+
/** Tools whose results are command output, so their text can say they failed. */
|
|
127
|
+
const SHELL_TOOLS = new Set(["Bash", "PowerShell"]);
|
|
128
|
+
/** Open tool calls carried between reads, so a late result still knows its tool. */
|
|
129
|
+
const MAX_PENDING = 500;
|
|
130
|
+
/** Text kept per event: the head, and the tail where outcomes print. */
|
|
131
|
+
const MAX_TEXT = 40_000;
|
|
132
|
+
const KEEP_HEAD = 8_000;
|
|
133
|
+
function clip(t) {
|
|
134
|
+
return t.length > MAX_TEXT ? `${t.slice(0, KEEP_HEAD)}\n…\n${t.slice(-(MAX_TEXT - KEEP_HEAD))}` : t;
|
|
135
|
+
}
|
|
136
|
+
/** The wrapped and pasted blocks taken out of a typed message: text the agent saw, not the person's words. */
|
|
137
|
+
function strippedBlocks(raw) {
|
|
138
|
+
return [...raw.matchAll(WRAPPED), ...raw.matchAll(PASTED)].map((m) => m[0]).join("\n").trim();
|
|
139
|
+
}
|
|
140
|
+
function pendingOf(memo) {
|
|
141
|
+
const p = memo.pending;
|
|
142
|
+
if (p && typeof p === "object" && !Array.isArray(p))
|
|
143
|
+
return p;
|
|
144
|
+
return (memo.pending = {});
|
|
145
|
+
}
|
|
146
|
+
function hookText(content) {
|
|
147
|
+
if (typeof content === "string")
|
|
148
|
+
return content;
|
|
149
|
+
return Array.isArray(content) ? content.filter((c) => typeof c === "string").join("\n") : "";
|
|
150
|
+
}
|
|
151
|
+
/** The events one transcript line holds, appended to `out`. `offset`: where the line starts in the file. */
|
|
152
|
+
function eventsOf(e, memo, out, offset, env) {
|
|
153
|
+
const at = typeof e.timestamp === "string" ? e.timestamp : "";
|
|
154
|
+
// Subagent lines are another context's work; their hand-back arrives as a result or a notice.
|
|
155
|
+
if (e.isSidechain)
|
|
156
|
+
return;
|
|
157
|
+
const where = { ...(offset === undefined ? {} : { offset }), ...(typeof e.uuid === "string" && e.uuid ? { uuid: e.uuid } : {}) };
|
|
158
|
+
const push = (ev) => {
|
|
159
|
+
if (ev.kind !== "injected")
|
|
160
|
+
memo.boundary = false;
|
|
161
|
+
out.push({ ...ev, ...where });
|
|
162
|
+
};
|
|
163
|
+
const injected = (text) => {
|
|
164
|
+
const t = text.trim();
|
|
165
|
+
if (t)
|
|
166
|
+
out.push({ kind: "injected", text: clip(t), at, ...where });
|
|
167
|
+
};
|
|
168
|
+
const cwd = typeof e.cwd === "string" && e.cwd ? { cwd: e.cwd } : {};
|
|
169
|
+
const branch = typeof e.gitBranch === "string" && e.gitBranch ? { branch: e.gitBranch } : {};
|
|
170
|
+
if (e.type === "system") {
|
|
171
|
+
if (e.subtype === "compact_boundary") {
|
|
172
|
+
push({ kind: "compaction", at });
|
|
173
|
+
memo.boundary = true;
|
|
174
|
+
}
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
if (e.type === "assistant") {
|
|
178
|
+
if (e.isApiErrorMessage)
|
|
179
|
+
return;
|
|
180
|
+
const content = e.message?.content;
|
|
181
|
+
if (typeof content === "string") {
|
|
182
|
+
if (content.trim())
|
|
183
|
+
push({ kind: "assistant", text: clip(content), at });
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
if (!Array.isArray(content))
|
|
187
|
+
return;
|
|
188
|
+
const pending = pendingOf(memo);
|
|
189
|
+
for (const part of content) {
|
|
190
|
+
if (!part || typeof part !== "object")
|
|
191
|
+
continue;
|
|
192
|
+
if (part.type === "text" && typeof part.text === "string" && part.text.trim())
|
|
193
|
+
push({ kind: "assistant", text: clip(part.text), at });
|
|
194
|
+
if (part.type === "tool_use") {
|
|
195
|
+
const id = String(part.id ?? "");
|
|
196
|
+
const name = String(part.name ?? "");
|
|
197
|
+
pending[id] = name;
|
|
198
|
+
push({ kind: "tool_call", id, name, input: part.input ?? null, at, ...cwd, ...branch });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const ids = Object.keys(pending);
|
|
202
|
+
for (const id of ids.slice(0, Math.max(0, ids.length - MAX_PENDING)))
|
|
203
|
+
delete pending[id];
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (e.type === "user") {
|
|
207
|
+
const content = e.message?.content;
|
|
208
|
+
if (e.isCompactSummary) {
|
|
209
|
+
// Older builds write the summary with no boundary line before it.
|
|
210
|
+
if (!memo.boundary)
|
|
211
|
+
push({ kind: "compaction", at });
|
|
212
|
+
memo.boundary = false;
|
|
213
|
+
injected(textOf(content));
|
|
214
|
+
return;
|
|
215
|
+
}
|
|
216
|
+
if (Array.isArray(content) && content.some((p) => p && typeof p === "object" && p.type === "tool_result")) {
|
|
217
|
+
const pending = pendingOf(memo);
|
|
218
|
+
for (const part of content) {
|
|
219
|
+
if (!part || typeof part !== "object" || part.type !== "tool_result")
|
|
220
|
+
continue;
|
|
221
|
+
const id = String(part.tool_use_id ?? "");
|
|
222
|
+
const name = pending[id];
|
|
223
|
+
delete pending[id];
|
|
224
|
+
const text = typeof part.content === "string" ? part.content : textOf(part.content);
|
|
225
|
+
// A call never seen (read before this window) is judged as a command.
|
|
226
|
+
const isError = part.is_error === true;
|
|
227
|
+
const ok = !(isError || ((name === undefined || SHELL_TOOLS.has(name)) && failedText(text)));
|
|
228
|
+
push({ kind: "tool_result", id, ok, text: clip(text), at, isError });
|
|
229
|
+
}
|
|
230
|
+
return;
|
|
231
|
+
}
|
|
232
|
+
const typed = typedText(e, env);
|
|
233
|
+
if (typed) {
|
|
234
|
+
push({ kind: "typed", text: typed, at });
|
|
235
|
+
injected(strippedBlocks(textOf(content)));
|
|
236
|
+
return;
|
|
237
|
+
}
|
|
238
|
+
injected(textOf(content));
|
|
239
|
+
return;
|
|
240
|
+
}
|
|
241
|
+
if (e.type === "attachment") {
|
|
242
|
+
const a = e.attachment;
|
|
243
|
+
if (!a || typeof a !== "object")
|
|
244
|
+
return;
|
|
245
|
+
if (a.type === "queued_command") {
|
|
246
|
+
const typed = typedText(e, env);
|
|
247
|
+
if (typed) {
|
|
248
|
+
push({ kind: "typed", text: typed, at });
|
|
249
|
+
injected(strippedBlocks(textOf(a.prompt)));
|
|
250
|
+
}
|
|
251
|
+
else
|
|
252
|
+
injected(textOf(a.prompt));
|
|
253
|
+
}
|
|
254
|
+
else if (a.type === "hook_additional_context") {
|
|
255
|
+
injected(hookText(a.content));
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* The events one parsed transcript line holds: the reader `readNewEvents` uses, for a caller that walks a file
|
|
261
|
+
* itself (init's replay over a byte range, b5). `memo` carries the open tool calls from line to line: start it
|
|
262
|
+
* as `{}` and pass the same object for every line of one read. Never throws on a line that isn't an entry.
|
|
263
|
+
*/
|
|
264
|
+
export function lineEvents(entry, memo, offset, env = process.env) {
|
|
265
|
+
const out = [];
|
|
266
|
+
if (!entry || typeof entry !== "object" || Array.isArray(entry))
|
|
267
|
+
return out;
|
|
268
|
+
eventsOf(entry, memo, out, offset, env);
|
|
269
|
+
return out;
|
|
270
|
+
}
|
|
271
|
+
/**
|
|
272
|
+
* The events a Claude Code transcript gained since the last call with the
|
|
273
|
+
* same `cursorPath`. The first call with no cursor reads at most the last
|
|
274
|
+
* 8 MB (`opts.firstReadBytes`; `Infinity` for the whole file). Never throws: a
|
|
275
|
+
* transcript that can't be read gives no events, and a cursor that can't be
|
|
276
|
+
* saved still returns what was read.
|
|
277
|
+
*/
|
|
278
|
+
export function readNewEvents(transcriptPath, cursorPath, opts = {}) {
|
|
279
|
+
const out = [];
|
|
280
|
+
const onEntry = opts.onEntry;
|
|
281
|
+
const env = opts.env ?? process.env;
|
|
282
|
+
try {
|
|
283
|
+
readAppended(transcriptPath, cursorPath, (line, memo, offset) => {
|
|
284
|
+
let e;
|
|
285
|
+
try {
|
|
286
|
+
e = JSON.parse(line);
|
|
287
|
+
}
|
|
288
|
+
catch {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
if (!e || typeof e !== "object" || Array.isArray(e))
|
|
292
|
+
return;
|
|
293
|
+
if (onEntry)
|
|
294
|
+
onEntry(e, memo);
|
|
295
|
+
eventsOf(e, memo, out, offset, env);
|
|
296
|
+
}, opts);
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
/* fail open */
|
|
300
|
+
}
|
|
301
|
+
return out;
|
|
302
|
+
}
|
|
303
|
+
//# sourceMappingURL=claude.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"claude.js","sourceRoot":"","sources":["../../src/trace/claude.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,OAAO,EAAE,YAAY,EAA+B,MAAM,aAAa,CAAC;AACxE,OAAO,EAAE,UAAU,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}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/** The text of a `function_call_output.output`: a string, or the text of an array of content parts. */
|
|
2
|
+
export declare function outputText(out: unknown): string;
|
|
3
|
+
/** 4.15: the exit an output's header names, `{ running }` for a command still running, null when it names none. */
|
|
4
|
+
export declare function codexExitOf(output: string): {
|
|
5
|
+
code: number;
|
|
6
|
+
} | {
|
|
7
|
+
running: number;
|
|
8
|
+
} | null;
|
|
9
|
+
/** The output without its header: what the command printed. */
|
|
10
|
+
export declare function outputBody(output: string): string;
|
|
11
|
+
/** One word as a shell would need it written. */
|
|
12
|
+
export declare function shellQuote(w: string): string;
|
|
13
|
+
/** The command an argument vector runs: `bash -lc X` and `sh -c X` read as X; any other vector joined with quoting. */
|
|
14
|
+
export declare function argvCommand(argv: unknown): string | null;
|
|
15
|
+
/** The files an apply_patch body names, in order, each once. */
|
|
16
|
+
export declare function patchFiles(patch: unknown): string[];
|
|
17
|
+
/**
|
|
18
|
+
* The files a shell command patches when it runs apply_patch (`apply_patch <<'EOF'`, `["apply_patch", patch]`, after
|
|
19
|
+
* a `cd`), absolute against the folder it runs in when that is known. [] for any other command (review).
|
|
20
|
+
*/
|
|
21
|
+
export declare function shellPatchFiles(cmd: string, cwd: string | undefined): string[];
|
|
22
|
+
//# sourceMappingURL=codex-exec.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-exec.d.ts","sourceRoot":"","sources":["../../src/trace/codex-exec.ts"],"names":[],"mappings":"AAkBA,uGAAuG;AACvG,wBAAgB,UAAU,CAAC,GAAG,EAAE,OAAO,GAAG,MAAM,CAW/C;AA2BD,mHAAmH;AACnH,wBAAgB,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,CASzF;AAED,+DAA+D;AAC/D,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAKjD;AAKD,iDAAiD;AACjD,wBAAgB,UAAU,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAG5C;AAED,uHAAuH;AACvH,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,GAAG,IAAI,CAKxD;AAID,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,MAAM,EAAE,CASnD;AAMD;;;GAGG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,EAAE,CAK9E"}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The text-level facts of a Codex tool call (design 4.15): which exit an
|
|
3
|
+
* output's header names, the output's body without that header, the shell
|
|
4
|
+
* line an argument vector stands for, and the files an apply_patch touches.
|
|
5
|
+
* Codex keeps a command's exit only as text in the model-facing output
|
|
6
|
+
* (`Process exited with code N`, or the older `Exit code: N`, or JSON
|
|
7
|
+
* `metadata.exit_code`), so these readers look only at the header, never at
|
|
8
|
+
* the body, where a command's own output could print the same words.
|
|
9
|
+
* Pure: no disk, no clock.
|
|
10
|
+
*/
|
|
11
|
+
import { isAbsolute, resolve } from 'node:path';
|
|
12
|
+
/** Where the header ends: unified exec and the older shell both put `Output:` on a line of its own. */
|
|
13
|
+
const OUTPUT_LINE = /^Output:\s*$/m;
|
|
14
|
+
const EXITED = /^Process exited with code (-?\d+)\s*$/m;
|
|
15
|
+
const RUNNING = /^Process running with session ID (\d+)\s*$/m;
|
|
16
|
+
const EXIT_CODE = /^Exit code: (-?\d+)\s*$/m;
|
|
17
|
+
/** The text of a `function_call_output.output`: a string, or the text of an array of content parts. */
|
|
18
|
+
export function outputText(out) {
|
|
19
|
+
if (typeof out === 'string')
|
|
20
|
+
return out;
|
|
21
|
+
if (Array.isArray(out)) {
|
|
22
|
+
return out.flatMap((p) => (p && typeof p === 'object' && typeof p.text === 'string' ? [p.text] : [])).join('\n');
|
|
23
|
+
}
|
|
24
|
+
if (out && typeof out === 'object') {
|
|
25
|
+
const o = out;
|
|
26
|
+
if (typeof o.content === 'string')
|
|
27
|
+
return o.content;
|
|
28
|
+
if (o.content !== undefined)
|
|
29
|
+
return outputText(o.content);
|
|
30
|
+
}
|
|
31
|
+
return '';
|
|
32
|
+
}
|
|
33
|
+
function jsonOutput(text) {
|
|
34
|
+
const t = text.trimStart();
|
|
35
|
+
if (!t.startsWith('{'))
|
|
36
|
+
return null;
|
|
37
|
+
try {
|
|
38
|
+
const v = JSON.parse(t);
|
|
39
|
+
if (!v || typeof v !== 'object' || Array.isArray(v))
|
|
40
|
+
return null;
|
|
41
|
+
const code = typeof v.metadata?.exit_code === 'number' && Number.isInteger(v.metadata.exit_code) ? v.metadata.exit_code : null;
|
|
42
|
+
if (code === null && typeof v.output !== 'string')
|
|
43
|
+
return null;
|
|
44
|
+
return { output: typeof v.output === 'string' ? v.output : '', code };
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* The header part of an output text: before its `Output:` line. Every exec output Codex writes has that line; a text
|
|
52
|
+
* without one has no header at all, so a command that prints `Process exited with code 0` can't name its own exit
|
|
53
|
+
* (review: its first lines were read as a header).
|
|
54
|
+
*/
|
|
55
|
+
function headerOf(text) {
|
|
56
|
+
const m = OUTPUT_LINE.exec(text);
|
|
57
|
+
if (m)
|
|
58
|
+
return { head: text.slice(0, m.index), body: text.slice(m.index + m[0].length).replace(/^\r?\n/, '') };
|
|
59
|
+
return { head: '', body: text };
|
|
60
|
+
}
|
|
61
|
+
/** 4.15: the exit an output's header names, `{ running }` for a command still running, null when it names none. */
|
|
62
|
+
export function codexExitOf(output) {
|
|
63
|
+
if (typeof output !== 'string' || !output)
|
|
64
|
+
return null;
|
|
65
|
+
const j = jsonOutput(output);
|
|
66
|
+
if (j)
|
|
67
|
+
return j.code === null ? null : { code: j.code };
|
|
68
|
+
const { head } = headerOf(output);
|
|
69
|
+
const run = RUNNING.exec(head);
|
|
70
|
+
if (run)
|
|
71
|
+
return { running: Number(run[1]) };
|
|
72
|
+
const m = EXITED.exec(head) ?? EXIT_CODE.exec(head);
|
|
73
|
+
return m ? { code: Number(m[1]) } : null;
|
|
74
|
+
}
|
|
75
|
+
/** The output without its header: what the command printed. */
|
|
76
|
+
export function outputBody(output) {
|
|
77
|
+
const j = jsonOutput(output);
|
|
78
|
+
if (j)
|
|
79
|
+
return j.output;
|
|
80
|
+
const { head, body } = headerOf(output);
|
|
81
|
+
return EXITED.test(head) || EXIT_CODE.test(head) || RUNNING.test(head) ? body : output;
|
|
82
|
+
}
|
|
83
|
+
const SHELLS = /^(?:\/(?:usr\/)?(?:local\/)?bin\/)?(?:bash|zsh|sh|dash|ksh|fish)$/;
|
|
84
|
+
const SAFE_WORD = /^[A-Za-z0-9_@%+=:,./-]+$/;
|
|
85
|
+
/** One word as a shell would need it written. */
|
|
86
|
+
export function shellQuote(w) {
|
|
87
|
+
if (w !== '' && SAFE_WORD.test(w))
|
|
88
|
+
return w;
|
|
89
|
+
return `'${w.replace(/'/g, `'\\''`)}'`;
|
|
90
|
+
}
|
|
91
|
+
/** The command an argument vector runs: `bash -lc X` and `sh -c X` read as X; any other vector joined with quoting. */
|
|
92
|
+
export function argvCommand(argv) {
|
|
93
|
+
if (!Array.isArray(argv) || !argv.length || !argv.every((w) => typeof w === 'string'))
|
|
94
|
+
return null;
|
|
95
|
+
const w = argv;
|
|
96
|
+
if (w.length === 3 && SHELLS.test(w[0]) && /^-l?c$|^-cl$/.test(w[1]))
|
|
97
|
+
return w[2];
|
|
98
|
+
return w.map(shellQuote).join(' ');
|
|
99
|
+
}
|
|
100
|
+
const PATCH_FILE = /^\*\*\* (?:Add|Update|Delete) File: (.+)$|^\*\*\* Move to: (.+)$/gm;
|
|
101
|
+
/** The files an apply_patch body names, in order, each once. */
|
|
102
|
+
export function patchFiles(patch) {
|
|
103
|
+
if (typeof patch !== 'string')
|
|
104
|
+
return [];
|
|
105
|
+
const out = [];
|
|
106
|
+
for (const m of patch.matchAll(PATCH_FILE)) {
|
|
107
|
+
const f = (m[1] ?? m[2] ?? '').trim();
|
|
108
|
+
if (f && !out.includes(f))
|
|
109
|
+
out.push(f);
|
|
110
|
+
if (out.length >= 50)
|
|
111
|
+
break;
|
|
112
|
+
}
|
|
113
|
+
return out;
|
|
114
|
+
}
|
|
115
|
+
/** apply_patch run as a command: Codex applies the patch itself (its shell handler reads these forms). */
|
|
116
|
+
const SHELL_PATCH = /(?:^|[\s;&|(])(?:apply_patch|applypatch)(?![\w-])/;
|
|
117
|
+
const PATCH_BEGIN = /(?:^|['"])\*\*\* Begin Patch\s*$/m;
|
|
118
|
+
/**
|
|
119
|
+
* The files a shell command patches when it runs apply_patch (`apply_patch <<'EOF'`, `["apply_patch", patch]`, after
|
|
120
|
+
* a `cd`), absolute against the folder it runs in when that is known. [] for any other command (review).
|
|
121
|
+
*/
|
|
122
|
+
export function shellPatchFiles(cmd, cwd) {
|
|
123
|
+
if (!SHELL_PATCH.test(cmd) || !PATCH_BEGIN.test(cmd))
|
|
124
|
+
return [];
|
|
125
|
+
const cd = /^\s*cd\s+('[^']*'|"[^"]*"|[^\s;&|]+)\s*&&/.exec(cmd)?.[1]?.replace(/^(['"])(.*)\1$/, '$2');
|
|
126
|
+
const base = cd ? (isAbsolute(cd) ? cd : cwd ? resolve(cwd, cd) : undefined) : cwd;
|
|
127
|
+
return patchFiles(cmd).map((f) => (base && !isAbsolute(f) ? resolve(base, f) : f));
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=codex-exec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-exec.js","sourceRoot":"","sources":["../../src/trace/codex-exec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,WAAW,C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eJS.ProcessEnv): string;
|
|
4
|
+
/** The rollout's first line, read with one positioned read of at most 64 KB; null when it isn't a session_meta line. */
|
|
5
|
+
export declare function codexMeta(rolloutPath: string): CodexMeta | null;
|
|
6
|
+
/**
|
|
7
|
+
* D133, fail closed: a rollout whose session_meta names `forked_from_id` starts with a copy of another session's
|
|
8
|
+
* lines, and Codex lines carry no id that tells the copy from this session's own. A copied typed line whose words the
|
|
9
|
+
* person types again would count, and the copied calls with it (review). So a fork is read as nothing, like an import.
|
|
10
|
+
*/
|
|
11
|
+
export declare function isForkedRollout(rolloutPath: string): boolean;
|
|
12
|
+
/** P39: the rollout is one `external_agent_session_imports.json` lists (by its session id): another host's session. */
|
|
13
|
+
export declare function isImportedRollout(path: string, env?: NodeJS.ProcessEnv): boolean;
|
|
14
|
+
/**
|
|
15
|
+
* 4.16, D82's first half for Codex: the receipt names this session's own rollout where Codex keeps it: a regular
|
|
16
|
+
* file (not a link), under `codexHome(env)/sessions/` through realpath, named `rollout-*-<session>.jsonl`, whose
|
|
17
|
+
* `session_meta.id` is the session (HC6).
|
|
18
|
+
*/
|
|
19
|
+
export declare function codexTranscriptOk(r: {
|
|
20
|
+
transcriptPath: string;
|
|
21
|
+
session: string;
|
|
22
|
+
}, env?: NodeJS.ProcessEnv): boolean;
|
|
23
|
+
//# sourceMappingURL=codex-meta.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codex-meta.d.ts","sourceRoot":"","sources":["../../src/trace/codex-meta.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAG5C,qCAAqC;AACrC,wBAAgB,SAAS,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAEtE;AA6BD,wHAAwH;AACxH,wBAAgB,SAAS,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAc/D;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAG5D;AAKD,uHAAuH;AACvH,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAY7F;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE;IAAE,cAAc,EAAE,MAAM,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,EAAE,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAY/H"}
|