(structured: unknown)
| 149 | }; |
| 150 | |
| 151 | const readApproval = (structured: unknown): { readonly executionId: string; readonly url: URL } => { |
| 152 | const record = readStructuredRecord(structured); |
| 153 | expect(record.status).toBe("user_approval_required"); |
| 154 | expect(record).not.toHaveProperty("interaction"); |
| 155 | expect(typeof record.executionId).toBe("string"); |
| 156 | expect(typeof record.approvalUrl).toBe("string"); |
| 157 | expect(record.resumePrompt).toBe( |
| 158 | "Return text to the user telling them to approve the action at this approvalUrl. Only after you have prompted the user, call the `resume` tool with this executionId; `resume` will wait for the user's browser decision.", |
| 159 | ); |
| 160 | const { executionId, approvalUrl } = record as { |
| 161 | readonly executionId: string; |
| 162 | readonly approvalUrl: string; |
| 163 | }; |
| 164 | return { |
| 165 | executionId, |
| 166 | url: new URL(approvalUrl), |
| 167 | }; |
| 168 | }; |
| 169 | |
| 170 | const readResultArray = (structured: unknown): ReadonlyArray<unknown> => { |
| 171 | const record = readStructuredRecord(structured); |
no test coverage detected