(workspaceId: string, agentType: AgentType, prompt: string, variant: string = 'DEFAULT', providerId?: string)
| 121 | } |
| 122 | |
| 123 | function isHighSurrogate(codeUnit: number): boolean { |
| 124 | return codeUnit >= 0xd800 && codeUnit <= 0xdbff; |
| 125 | } |
| 126 | |
| 127 | function isLowSurrogate(codeUnit: number): boolean { |
| 128 | return codeUnit >= 0xdc00 && codeUnit <= 0xdfff; |
| 129 | } |
| 130 | |
| 131 | function eventKey(sessionId: string, runtimeInstanceId: string, launchClaimNumber: number): string { |
| 132 | return `${sessionId}:${runtimeInstanceId}:${launchClaimNumber}`; |
| 133 | } |
| 134 | |
| 135 | function hashForLog(value: string): string { |
| 136 | return createHash('sha256').update(value).digest('hex').slice(0, 12); |
| 137 | } |
| 138 | |
| 139 | function summarizeTextForLog(value: string): { length: number; sha256: string } { |
| 140 | return { |
| 141 | length: Buffer.byteLength(value, 'utf8'), |
| 142 | sha256: hashForLog(value), |
| 143 | }; |
| 144 | } |
| 145 | |
| 146 | /** |
| 147 | * 判断一个 session:patch 是否代表 agent 侧真实进展。 |
no test coverage detected