refactor(daemon): move session helper fns to sessionState.ts - #126
Merged
Conversation
This was referenced Jul 17, 2026
Contributor
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
This was referenced Jul 17, 2026
rgao-coreweave
marked this pull request as ready for review
July 17, 2026 18:14
rgao-coreweave
force-pushed
the
109-04-typed-hooks
branch
from
July 17, 2026 20:18
d0cac31 to
fc49f9b
Compare
rgao-coreweave
force-pushed
the
109-05-session-helpers
branch
from
July 17, 2026 20:18
f87b584 to
3d6ce49
Compare
rgao-coreweave
force-pushed
the
109-04-typed-hooks
branch
from
July 17, 2026 20:34
fc49f9b to
5a228b8
Compare
rgao-coreweave
force-pushed
the
109-05-session-helpers
branch
from
July 17, 2026 20:34
3d6ce49 to
3587734
Compare
Cast the socket JSON once against the SDK's HookInput and dispatch on the
discriminant, so handlers take typed inputs instead of re-casting every
field (~40 payload[...] as X casts deleted). Fields the SDK types as
required drop their invented fallbacks ('unknown'/'teammate'/'?'); the two
payloads that carry more than the SDK declares (PreCompact summary/counts,
reconstruction source/model) keep documented raw-record reads.
Behavior notes: PostToolUseFailure now trusts the typed `error` field
(drops the undocumented tool_response fallback), and InstructionsLoaded
drops its missing-file_path branch (the type requires it; a bad path still
lands in the unreadable-file catch).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Verbatim move of the session-scoped pure helpers (hashPrompt, computeSubagentTranscriptPath, extractUserMessageContent, lastAssistantTextEndsWith, readSubagentFirstLineWithRetry) out of daemon.ts. No behavior change; shrinks daemon.ts ahead of the SDK migration so its diff stays on the pipeline. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
) Verbatim move of SessionState, the tracker types (PendingToolCall, SubagentTracker, TeamMember, LoadedInstruction), SubagentTracking, newSessionState, and resolvePermissionIfPending. Also dedupes the sha256-hex idiom into utils.sha256Hex now that it has two consumers (hashPrompt + the config fingerprint). No behavior change. Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
rgao-coreweave
force-pushed
the
109-05-session-helpers
branch
from
July 17, 2026 20:39
3587734 to
2d19b88
Compare
rgao-coreweave
force-pushed
the
109-04-typed-hooks
branch
from
July 17, 2026 20:39
5a228b8 to
00f9c62
Compare
Contributor
Author
Merge activity |
rgao-coreweave
changed the base branch from
109-04-typed-hooks
to
graphite-base/126
July 17, 2026 20:46
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Verbatim move of the session-scoped code out of daemon.ts. No behavior change.
hashPrompt,computeSubagentTranscriptPath,extractUserMessageContent,lastAssistantTextEndsWith,readSubagentFirstLineWithRetry).SessionState, the tracker types,SubagentTracking,newSessionState,resolvePermissionIfPending, and theutils.sha256Hexdedup.Together these make #128's daemon diff stay on the pipeline swap, and its sessionState.ts diff read as a type swap rather than a new file.
Test plan:
npm run check🤖 Generated with Claude Code