MCPcopy Create free account
hub / github.com/codeaashu/claude-code / writeInternalEvent

Method writeInternalEvent

src/cli/transports/ccrClient.ts:793–814  ·  view source on GitHub ↗

* Write an internal worker event via POST /sessions/{id}/worker/internal-events. * These events are NOT visible to frontend clients — they store worker-internal * state (transcript messages, compaction markers) needed for session resume.

(
    eventType: string,
    payload: Record<string, unknown>,
    {
      isCompaction = false,
      agentId,
    }: {
      isCompaction?: boolean
      agentId?: string
    } = {},
  )

Source from the content-addressed store, hash-verified

791 * state (transcript messages, compaction markers) needed for session resume.
792 */
793 async writeInternalEvent(
794 eventType: string,
795 payload: Record<string, unknown>,
796 {
797 isCompaction = false,
798 agentId,
799 }: {
800 isCompaction?: boolean
801 agentId?: string
802 } = {},
803 ): Promise<void> {
804 const event: WorkerEvent = {
805 payload: {
806 type: eventType,
807 ...payload,
808 uuid: typeof payload.uuid === 'string' ? payload.uuid : randomUUID(),
809 } as EventPayload,
810 ...(isCompaction && { is_compaction: true }),
811 ...(agentId && { agent_id: agentId }),
812 }
813 await this.internalEventUploader.enqueue(event)
814 }
815
816 /**
817 * Flush pending internal events. Call between turns and on shutdown

Callers 1

constructorMethod · 0.80

Calls 1

enqueueMethod · 0.45

Tested by

no test coverage detected