Stage attachment bytes and list or retrieve project-scoped file metadata.

FilesClient

Project-scoped staging for file content referenced by later tool calls.

get

Retrieves metadata for a staged file without returning its bytes.

ts
get(fileId: `file_${string}`): Promise<StagedFileMetadata>
ParameterTypeRequiredDescription
fileIdfile_$&#123;string&#125;YesProject-scoped staged file identifier.

Returns: Promise<StagedFileMetadata>

Throws

  • EyeballError when the file is unavailable or the executor request fails.

list

Lists unexpired project staged-file metadata in newest-first order.

ts
list(options?: ListFilesOptions): Promise<StagedFilePage>
ParameterTypeRequiredDescription
optionsListFilesOptionsNoOpaque continuation cursor and a page size from 1 through 100; the executor defaults to 100.

Returns: Promise<StagedFilePage>

Throws

  • EyeballError when options are invalid, the key lacks project authority, or the executor request fails.

Example

ts
import { Eyeball } from "@eyeball/sdk";

const eyeball = new Eyeball({
  apiKey: process.env.EYEBALL_API_KEY!,
  baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});

const first = await eyeball.files.list({ limit: 50 });
for (const file of first.files) console.log(file.name, file.expiresAt);
if (first.nextCursor !== undefined) {
  const next = await eyeball.files.list({
    cursor: first.nextCursor,
    limit: 50,
  });
  console.log(next.files.length);
}

upload

Stages UTF-8 text or exact bytes and returns the attachment reference accepted by tools.

ts
upload(options: UploadFileOptions): Promise<StagedFileReference>
ParameterTypeRequiredDescription
optionsUploadFileOptionsYesFile name, optional media type, and content to stage.

Returns: Promise<StagedFileReference>

Throws

  • EyeballError when the upload is rejected or the executor cannot be reached.

Example

ts
import { Eyeball } from "@eyeball/sdk";

const eyeball = new Eyeball({
  apiKey: process.env.EYEBALL_API_KEY!,
  baseUrl: process.env.EYEBALL_EXECUTOR_URL!,
});

const invoiceBytes = new Uint8Array();

const attachment = await eyeball.files.upload({
  name: "invoice.pdf",
  mimeType: "application/pdf",
  content: invoiceBytes,
});

Types

ListFilesOptions

Cursor and page-size controls for project staged-file listing.

ts
export interface ListFilesOptions {
  cursor?: string;
  limit?: number;
}
PropertyTypeRequiredReadonlyDescription
cursorstringNoNo
limitnumberNoNo

UploadFileOptions

Name, media type, and exact content staged by files.upload.

ts
export interface UploadFileOptions {
  name: string;
  mimeType?: string;
  /** Strings are staged as UTF-8; byte arrays (including Node Buffers) are preserved. */
  content: Uint8Array | string;
}
PropertyTypeRequiredReadonlyDescription
contentstring | Uint8Array<ArrayBufferLike>YesNoStrings are staged as UTF-8; byte arrays (including Node Buffers) are preserved.
mimeTypestringNoNo
namestringYesNo

FileId

ts
export type FileId = `file_${string}`;

StagedFileMetadata

Public metadata returned by the project-scoped staged-file API.

ts
export interface StagedFileMetadata {
  fileId: FileId;
  name: string;
  mimeType: string;
  size: number;
  expiresAt: string;
}
PropertyTypeRequiredReadonlyDescription
expiresAtstringYesNo
fileIdfile_$&#123;string&#125;YesNo
mimeTypestringYesNo
namestringYesNo
sizenumberYesNo

StagedFilePage

One cursor page of unexpired project-scoped staged-file metadata.

ts
export interface StagedFilePage {
  files: readonly StagedFileMetadata[];
  nextCursor?: string;
}
PropertyTypeRequiredReadonlyDescription
filesreadonly StagedFileMetadata[]YesNo
nextCursorstringNoNo

StagedFileReference

Preferred canonical reference to bytes staged through the files API.

ts
export interface StagedFileReference {
  fileId: FileId;
  /** Optional consumer-visible name overriding the staged metadata. */
  name?: string;
  /** Optional MIME type overriding the staged metadata. */
  mimeType?: string;
}
PropertyTypeRequiredReadonlyDescription
fileIdfile_$&#123;string&#125;YesNo
mimeTypestringNoNoOptional MIME type overriding the staged metadata.
namestringNoNoOptional consumer-visible name overriding the staged metadata.