Fix publication blockers for v0.1.0 release candidate#1
Conversation
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Expand HookEventName to 30 events with Setup and MessageDisplay - Add Setup/MessageDisplay input/output types and Zod schemas - Update SessionStart input/output parity (optional model, session_title, initialUserMessage, sessionTitle, watchPaths, reloadSkills) - Expand Notification and StopFailure enums - Add common effort/terminalSequence fields and duration_ms on PostToolUse/PostToolUseFailure - Widen PostToolUseOutput.updatedMCPToolOutput to unknown and add updatedToolOutput - Normalize optional SessionStart.model in lifecycle handler - Update schema completeness test count to 30
…d schema exports Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…for new hook surface Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ionStart, updatedToolOutput, and command args
… fields, and builder methods Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…pdate implementation context
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…tils Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ments Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…comments Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
…ler words - Expand API-contract JSDoc for toError, isRecord, isProtectedFile, validateRequiredFields, validateFilePath, and sanitizeCommand - Remove remaining banned filler words (incremental, automatically, supports, TODO comments) from source comments - Mark final verification wave approved in comment-consistency plan - All quality gates pass: pnpm run check, pnpm run test:run (1201 tests), pnpm run build
There was a problem hiding this comment.
Your free trial has ended. If you'd like to continue receiving code reviews, you can add a payment method here.
…ler words - Expand API-contract JSDoc for toError, isRecord, isProtectedFile, validateRequiredFields, validateFilePath, and sanitizeCommand - Remove remaining banned filler words (incremental, automatically, supports, TODO comments) from source comments - Mark final verification wave approved in comment-consistency plan - All quality gates pass: pnpm run check, pnpm run test:run (1201 tests), pnpm run build
…aw records Claude Code adds fields and content shapes to known line types (user, assistant, file-history-snapshot, ...) faster than the strict typed schema tracks them. Previously such lines were dropped entirely, even from the raw-records API. Now they degrade to raw records: typed consumers still see them counted under invalidShapeLineCount, raw consumers keep the payload. Claude-Session: https://claude.ai/code/session_01Wc7WEWccXvtDmzTswwoTjS
Claude Code now writes usage objects containing nested structures (cache_creation, server_tool_use, iterations) and strings (service_tier, inference_geo, speed). The number-only record schema rejected every such assistant line, dropping them from typed decomposition entirely. Claude-Session: https://claude.ai/code/session_01Wc7WEWccXvtDmzTswwoTjS
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
…helpers Consumers tailing many projects concurrently previously had to mutate the process-global CLAUDE_TAIL_MARKER_ROOTS env var per call (serializing all tails). The new TailOptions.allowedMarkerRoots validates a custom markerDir per call and takes precedence over the env var; unset keeps the env-var fallback so the claude-session-tail CLI is unchanged. Also promotes getMarkerPath/readMarker/writeMarker to the public ./processing barrel so consumers that pre-seed markers share the kit's marker file format. Claude-Session: https://claude.ai/code/session_01AivNdHPafG44kZEPsyfqCZ
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
Too many files changed for review. ( Bypass the limit by tagging |
Summary
This PR resolves the remaining pre-publication blockers for
@libar-dev/agent-harness-kitv0.1.0 release candidate. It fixes stale documentation links and wording, normalizes npm package metadata, moves build-time tooling out of production dependencies, hardens image-content-block handling with a shared helper and regression tests, and replaces the fragile upstream-doc mirror workflow with direct markdown sync fromcode.claude.com.It also removes the ephemeral planning context file that was added during the API parity pass; planning artifacts should not be committed to the public repo.
Detailed Changes
Documentation Fixes
docs/README.md.[0.1.0]release notes with### Added(image content block support) and additional### Changedentries (bin paths, repository URL,publishConfig.access).[1.0.0]release link pointing to the oldclaude-code-hooksrepo.Package Metadata Normalization
tsxfromdependenciestodevDependencies(it is only used for local script execution; published CLIs use#!/usr/bin/env nodeshebangs).pnpm-lock.yamlimporter metadata to match thetsxmove."sideEffects": falsefor improved tree-shaking by consumers.binpaths without./,repository.urlwithgit+prefix.Image Content Block Hardening
imagePlaceholderlogic intosrc/processing/image-placeholder.ts.isRecordfromsrc/utils/index.jsand explicitly rejects arrays, returning the generic[Image]placeholder.src/processing/denoiser.tsandsrc/processing/block-decomposition.tsto import the shared helper.null, or primitives for bothdenoiseSessionandextractBlockspaths.media_typemetadata is used in placeholders.Upstream Docs Sync Automation
scripts/sync-upstream-docs.mjsandpnpm run docs:sync-upstreamto fetch canonical markdown directly fromhttps://code.claude.com/docs/en/*.md.docs/upstream/README.mdto document the new source of truth and the refresh command..mdendpoints.headless.mdduplicated CLI content andhooks-reference.mdcontained mixed page sections).Code Cleanup + Slop Removal
.omo/work-tracking directory anddocs/internal/prometheus-implementation-context.md.## Public Repository Hygieneguardrail toAGENTS.mdso future agents know ephemeral planning artifacts must not be merged.Setup/MessageDisplayand the expanded output builder methods.Why This Is Needed
CONTRIBUTING.mdpointed to a non-existent file.sideEffects: false: Consumers cannot safely tree-shake the package without this explicit marker.tsxin production dependencies: Adds unnecessary install weight and implies runtime dependency on a TypeScript executor that is not used by published artifacts.denoiser.tsaccepted arrays;block-decomposition.tsrejected them). The shared helper normalizes behavior and adds regression coverage for malformed image sources.docs/upstream/, which made API-gap assessment noisy and easy to get wrong..omo/directory were useful during implementation but must not be shipped in a public release.Comment Consistency Cleanup
After the initial cleanup pass, a plan was created to fix the inconsistent comment state it left behind. This branch now includes the final wave of that cleanup.
What changed
src/utils/index.tsfor exported helpers:toError— normalize an unknown value to anError.isRecord— type guard for non-null object records.isProtectedFile— pattern-based protection check, with a security note that it is not a filesystem access-control boundary.validateRequiredFields— required-field presence check, now with@returns void.validateFilePath— path-traversal guard, now with@returns void.sanitizeCommand— shell-metacharacter stripping, with an explicit note that it is not a full shell-injection sanitizer.src/processing/tail.ts— "incremental" → "appended-block"; "automatically advanced" → "advances".src/processing/types.ts— "incremental ingestion" → "ingestion of growing session files".src/processing/discovery.ts— "supports filtering" → "filters".src/lifecycle/stop-handler.ts— "TODO comments" → "TODO markers".src/pre-tool-use/eslint-disable-blocker.ts— removed two "automatically" filler instances.Verification
src/andtests/returns only documented opt-outs:src/cli/export-sessions.ts:219— runtime CLI message string"incremental export".src/processing/ordering.ts:7— false-positive substring"re-exported from".tests/tail.test.ts:1074,1390— executableit()description strings containing"incremental".Testing Performed
pnpm run type-check— passes cleanly.pnpm run lint— passes.pnpm run lint:ci— passes.pnpm run test:run— 1201 tests passing, 0 failures.pnpm run build— produces correctdist/structure.npm publish --dry-run --access public— passes.npm pack— produces clean tarball with required docs,dist/, andpackage.json; nosrc/,.DS_Store, or.omo/leaks.pnpm run docs:sync-upstream— refreshes all mirrored upstream docs from canonical.mdendpoints.pnpm run docs:sync-upstream -- settings— targeted sync works for a single mirrored page.pnpm run test:run -- tests/docs-round-trip.test.ts— passes with the refreshed mirrors.Verification Checklist
CONTRIBUTING.mdarchitecture link points to existingdocs/README.mdCHANGELOG.md[0.1.0]section has expandedAdded/Changedrelease notesCHANGELOG.mdno longer contains stale old-repo release linkSECURITY.mduses grammatically correct "release candidate" wordingpackage.jsoncontains"sideEffects": falsetsxmoved todevDependencies; lockfile regeneratedpnpm install --frozen-lockfilesucceedsimage-placeholder.tshelper exists and is used by both processing callersnpm publish --dry-runpassesnpm packcontents verified cleanpnpm run docs:sync-upstreamrefreshes upstream mirrors fromcode.claude.commarkdown endpointsdocs/upstream/headless.mdis no longer a duplicate of CLI reference contentdocs/upstream/hooks-reference.mdis a clean hooks-reference mirror againtests/docs-round-trip.test.tsnow uses content-based skip classification instead of brittle block indices.omo/,docs/internal/prometheus-implementation-context.md)AGENTS.mdincludes Public Repository Hygiene guardrailsrc/utils/index.tsBreaking Changes
None. All changes are additive, metadata normalization, automation, or internal refactoring.
Claude Code Hook API Parity
This branch also closes the gap between the library and the current upstream Claude Code hook API surface (source of truth:
docs/upstream/hooks-reference.md).Added hook events
Setup— modeled as a full hook event withSetupInput/SetupOutput, Zod schemas, type guards, validators,HookOutputBuilder.setupContext(), and a reference lifecycle handler (src/lifecycle/setup.ts).MessageDisplay— modeled withMessageDisplayInput/MessageDisplayOutput, UUID-aware schemas, type guards, validators,HookOutputBuilder.messageDisplayContent(), and a reference lifecycle handler (src/lifecycle/message-display.ts).Expanded existing events
SessionStart:modelis now optional; addedsession_title.hookSpecificOutputnow supportsadditionalContext,initialUserMessage,sessionTitle,watchPaths, andreloadSkills.Notification: enum widened to all 6 upstream notification types.StopFailure: enum widened to all 10 upstream stop-failure reasons.PostToolUse/PostToolUseFailure: added optionalduration_msto both inputs.PostToolUseoutput: addedupdatedToolOutputand widenedupdatedMCPToolOutputtounknown.effortonBaseHookInput,terminalSequenceonBaseHookOutput.CommandHookHandler: added optionalargs?: string[]for the exec-form command surface.Reference handlers and tooling
pnpm run hook:test:setupandpnpm run hook:test:message-displayscripts.SetupandMessageDisplayhandlers.src/lifecycle/session-start.tsto tolerate a missingmodelandsrc/lifecycle/notification-handler.tsto classify new notification types.Docs and metadata
createSetupInputandcreateMessageDisplayInputintests/test-utils.ts.Verification
pnpm run test:run— 1201 tests passing, 0 failures.pnpm run check— type-check + lint pass.pnpm run hook:test:setup— exits 0.pnpm run hook:test:message-display— exits 0.CLAUDE_PROJECT_DIR=/Users/darkomijic/dev-projects/claude-code-hooks pnpm run hook:test:session— exits 0..passthrough(), no newany,package.jsonversion unchanged,docs/upstream/untouched, no public exports removed.v0.2.0 endpoint discovery and silent hook forwarding
This PR now also provides the generic runtime seam used by Cockpit to replace brittle direct HTTP hook configuration.
What changed
Additional validation
Review feedback follow-up (2026-07-12)
The post-implementation review findings are now addressed in commit
c3ee44817c555b748358f940fae8246fb3f6d3f5.Additional hardening
cwdwithrealpath()before project-root filtering, while retaining the lexical fallback for missing or synthetic paths. This preserves silent forwarding when Claude Code and Cockpit reach the same project through different symlink paths.hook-forwarder.mjs, rather than executing the TypeScript source throughtsx.0, empty stdout, and empty stderr.Final validation
pnpm test:run— 30 files, 1,260 tests passing, 0 failures, type errors enabledpnpm type-check— passespnpm lint/ uncached ESLint — passespnpm build— produces the 511.5 KiB standalone forwarder bundledist/standalone/hook-forwarder.mjscontains the canonical-cwd logicThe consumer pin is now
c3ee44817c555b748358f940fae8246fb3f6d3f5.Complete-session transcript tailing (Wave 1B)
This section records the session-level processing API added at branch head
a7500f5b21bd415bcdbbf39f93293367533fb858.Why this was needed
Existing raw-tail APIs accept one JSONL path. Claude Code stores subagent activity under
<session-id>/subagents/*.jsonl, leaving every consumer to rediscover that layout, coordinate offsets, and merge sources. A privacy-safe Cockpit audit found 55,050 subagent records—about 52% of its corpus—outside the current main-file ingestion path.Public API
Exported from
@libar-dev/agent-harness-kit/processing:tailRawTranscriptSessionRecords(mainJsonlPath, options)watchRawTranscriptSessionRecords(mainJsonlPath, options)commitRawTranscriptSessionCheckpoint(mainJsonlPath, checkpoint, options)getRawTranscriptSessionMarkerPath(mainJsonlPath, markerDir, allowedMarkerRoots)Results contain merged records, per-source diagnostics/rotation state, aggregate parse counts, and a serializable checkpoint. Existing single-file functions, markers,
readRawSessionFiles, exports, and safe-redaction defaults remain compatible.Ordering and provenance guarantees
sourceKind,sourceId, byte ranges, payloads, and stable record IDs.Durable checkpoint and concurrency guarantees
Manual mode provides a persist-then-commit workflow: tail with
checkpointMode: "manual", durably upsert by stable ID, then commit the returned checkpoint.Checkpoints are bound to a SHA-256 digest of the resolved main path and an exact marker revision. Per-source generations allow shorter-file rotation while rejecting same-generation backward offsets. The checkpoint source set is authoritative at its revision, allowing disappeared subagents to be removed safely.
Automatic and manual writers share a cross-process mutation boundary: atomic lock-directory acquisition; token/PID/time ownership; marker re-read and progression validation inside the lock; UUID temporary files and atomic rename; owner-token verification; bounded retry; and dead-process stale-lock recovery. Automatic stale losers may replay but cannot regress or skip offsets. Manual stale siblings reject.
Snapshot, migration, and containment hardening
statrange, so concurrent appends cannot create invalid checkpoints; later/partial bytes remain for the next pass.Adversarial review history
Independent review reproduced and corrected: records moved to the session end; cross-project checkpoint reuse; rotation/source-removal deadlocks;
stat/read races; TOCTOU revision races allowing sibling success and marker regression; temporary-file collisions; and stale-owner traversal escaping the marker root or making locks unrecoverable.Final stress review ran 100 in-process sibling races, a real sibling-process race, concurrent automatic writers, and 40 malformed-owner reclaimer races. Exactly one checkpoint won each contested revision, with no displacement or offset regression. Final disposition: GO, no findings.
Validation
git diff --check— passed.Consumer migration and limitation
The smallest migration changes the existing call to
tailRawTranscriptSessionRecords(mainJsonlPath, options); the returned.recordsshape remains consumable. Durable consumers should use manual checkpoint mode and commit only after stable-ID upserts succeed.Replacement detection remains size-based: a replacement preserving or increasing file size between observations cannot be distinguished reliably. Locking assumes a local filesystem with atomic
mkdir/renameand a shared local PID namespace.