MCPcopy Create free account
hub / github.com/Noumena-Network/code / stateToSnapshotMessage

Function stateToSnapshotMessage

src/utils/commitAttribution.ts:813–835  ·  view source on GitHub ↗
(
  state: AttributionState,
  messageId: UUID,
)

Source from the content-addressed store, hash-verified

811 * Convert attribution state to snapshot message for persistence.
812 */
813export function stateToSnapshotMessage(
814 state: AttributionState,
815 messageId: UUID,
816): AttributionSnapshotMessage {
817 const fileStates: Record<string, FileAttributionState> = {}
818
819 for (const [path, fileState] of state.fileStates) {
820 fileStates[path] = fileState
821 }
822
823 return {
824 type: 'attribution-snapshot',
825 messageId,
826 surface: state.surface,
827 fileStates,
828 promptCount: state.promptCount,
829 promptCountAtLastCommit: state.promptCountAtLastCommit,
830 permissionPromptCount: state.permissionPromptCount,
831 permissionPromptCountAtLastCommit: state.permissionPromptCountAtLastCommit,
832 escapeCount: state.escapeCount,
833 escapeCountAtLastCommit: state.escapeCountAtLastCommit,
834 }
835}
836
837/**
838 * Restore attribution state from snapshot messages.

Callers 1

incrementPromptCountFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected