MCPcopy Create free account
hub / github.com/anomalyco/opencode / patch

Function patch

packages/opencode/src/session/session.ts:736–749  ·  view source on GitHub ↗
(sessionID: SessionID, info: Patch)

Source from the content-addressed store, hash-verified

734 })
735
736 const patch = (sessionID: SessionID, info: Patch) =>
737 Effect.gen(function* () {
738 const current = yield* get(sessionID)
739 const next = {
740 ...current,
741 ...info,
742 time: info.time ? { ...current.time, ...info.time } : current.time,
743 share: info.share === null ? undefined : info.share ? { ...current.share, ...info.share } : current.share,
744 summary: info.summary === null ? undefined : (info.summary ?? current.summary),
745 revert: info.revert === null ? undefined : (info.revert ?? current.revert),
746 permission: info.permission === null ? undefined : (info.permission ?? current.permission),
747 } as Info
748 yield* events.publish(SessionV1.Event.Updated, { sessionID, info: next })
749 })
750
751 const touch = Effect.fn("Session.touch")(function* (sessionID: SessionID) {
752 yield* patch(sessionID, { time: { updated: Date.now() } }).pipe(Effect.orDie)

Callers 1

session.tsFile · 0.70

Calls 2

getFunction · 0.70
publishMethod · 0.45

Tested by

no test coverage detected