MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / createUserMessage

Function createUserMessage

source code/utils/messages.ts:462–525  ·  view source on GitHub ↗
({
  content,
  isMeta,
  isVisibleInTranscriptOnly,
  isVirtual,
  isCompactSummary,
  summarizeMetadata,
  toolUseResult,
  mcpMeta,
  uuid,
  timestamp,
  imagePasteIds,
  sourceToolAssistantUUID,
  permissionMode,
  origin,
}: {
  content: string | ContentBlockParam[]
  isMeta?: true
  isVisibleInTranscriptOnly?: true
  isVirtual?: true
  isCompactSummary?: true
  toolUseResult?: unknown // Matches tool's `Output` type
  /** MCP protocol metadata to pass through to SDK consumers (never sent to model) */
  mcpMeta?: {
    _meta?: Record<string, unknown>
    structuredContent?: Record<string, unknown>
  }
  uuid?: UUID | string
  timestamp?: string
  imagePasteIds?: number[]
  // For tool_result messages: the UUID of the assistant message containing the matching tool_use
  sourceToolAssistantUUID?: UUID
  // Permission mode when message was sent (for rewind restoration)
  permissionMode?: PermissionMode
  summarizeMetadata?: {
    messagesSummarized: number
    userContext?: string
    direction?: PartialCompactDirection
  }
  // Provenance of this message. undefined = human (keyboard).
  origin?: MessageOrigin
})

Source from the content-addressed store, hash-verified

460}
461
462export function createUserMessage({
463 content,
464 isMeta,
465 isVisibleInTranscriptOnly,
466 isVirtual,
467 isCompactSummary,
468 summarizeMetadata,
469 toolUseResult,
470 mcpMeta,
471 uuid,
472 timestamp,
473 imagePasteIds,
474 sourceToolAssistantUUID,
475 permissionMode,
476 origin,
477}: {
478 content: string | ContentBlockParam[]
479 isMeta?: true
480 isVisibleInTranscriptOnly?: true
481 isVirtual?: true
482 isCompactSummary?: true
483 toolUseResult?: unknown // Matches tool's `Output` type
484 /** MCP protocol metadata to pass through to SDK consumers (never sent to model) */
485 mcpMeta?: {
486 _meta?: Record<string, unknown>
487 structuredContent?: Record<string, unknown>
488 }
489 uuid?: UUID | string
490 timestamp?: string
491 imagePasteIds?: number[]
492 // For tool_result messages: the UUID of the assistant message containing the matching tool_use
493 sourceToolAssistantUUID?: UUID
494 // Permission mode when message was sent (for rewind restoration)
495 permissionMode?: PermissionMode
496 summarizeMetadata?: {
497 messagesSummarized: number
498 userContext?: string
499 direction?: PartialCompactDirection
500 }
501 // Provenance of this message. undefined = human (keyboard).
502 origin?: MessageOrigin
503}): UserMessage {
504 const m: UserMessage = {
505 type: 'user',
506 message: {
507 role: 'user',
508 content: content || NO_CONTENT_MESSAGE, // Make sure we don't send empty messages
509 },
510 isMeta,
511 isVisibleInTranscriptOnly,
512 isVirtual,
513 isCompactSummary,
514 summarizeMetadata,
515 uuid: (uuid as UUID | undefined) || randomUUID(),
516 timestamp: timestamp ?? new Date().toISOString(),
517 toolUseResult,
518 mcpMeta,
519 imagePasteIds,

Callers 15

queryLoopFunction · 0.85
runFunction · 0.85
executeRemoteSkillFunction · 0.85
callInnerFunction · 0.85
callFunction · 0.85
resumeAgentBackgroundFunction · 0.85
runAgentFunction · 0.85
callFunction · 0.85
buildForkedMessagesFunction · 0.85
MessageSelectorFunction · 0.85
autoNameSessionFromPlanFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected