(input: {
readonly attachments: ReadonlyArray<ChatAttachment> | undefined;
readonly resolveAttachmentPath: (attachment: ChatAttachment) => string | null;
})
| 191 | } |
| 192 | |
| 193 | export function toOpenCodeFileParts(input: { |
| 194 | readonly attachments: ReadonlyArray<ChatAttachment> | undefined; |
| 195 | readonly resolveAttachmentPath: (attachment: ChatAttachment) => string | null; |
| 196 | }): Array<FilePartInput> { |
| 197 | const parts: Array<FilePartInput> = []; |
| 198 | |
| 199 | for (const attachment of input.attachments ?? []) { |
| 200 | const attachmentPath = input.resolveAttachmentPath(attachment); |
| 201 | if (!attachmentPath) { |
| 202 | continue; |
| 203 | } |
| 204 | |
| 205 | parts.push({ |
| 206 | type: "file", |
| 207 | mime: attachment.mimeType, |
| 208 | filename: attachment.name, |
| 209 | url: NodeURL.pathToFileURL(attachmentPath).href, |
| 210 | }); |
| 211 | } |
| 212 | |
| 213 | return parts; |
| 214 | } |
| 215 | |
| 216 | export function buildOpenCodePermissionRules(runtimeMode: RuntimeMode): PermissionRuleset { |
| 217 | if (runtimeMode === "full-access") { |
no outgoing calls
no test coverage detected