MCPcopy Create free account
hub / github.com/pingdotgg/t3code / toOpenCodeFileParts

Function toOpenCodeFileParts

apps/server/src/provider/opencodeRuntime.ts:193–214  ·  view source on GitHub ↗
(input: {
  readonly attachments: ReadonlyArray<ChatAttachment> | undefined;
  readonly resolveAttachmentPath: (attachment: ChatAttachment) => string | null;
})

Source from the content-addressed store, hash-verified

191}
192
193export 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
216export function buildOpenCodePermissionRules(runtimeMode: RuntimeMode): PermissionRuleset {
217 if (runtimeMode === "full-access") {

Callers 1

makeOpenCodeAdapterFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected