Outputs

Outputs describe the desired output format / structure (e.g. "JSON", "Markdown bullet list") that prompts can reference. Outputs are non-versioned. Like tones, they have no dedicated visibility endpoint - pass isPublic through update().

Methods

list

client.outputs.list(params?: ListParams): Promise<Page<OutputSummary>>

List public outputs
const page = await client.outputs.list({ scope: "public", pageSize: 12 });
return {
  total: page.total,
  items: page.items.map((o) => ({ id: o.id, label: o.label, tags: o.tags })),
};

listAll

client.outputs.listAll(params?: ListParams): AsyncIterable<OutputSummary>

Iterate the public outputs feed
const labels = [];
for await (const output of client.outputs.listAll({ scope: "public", pageSize: 12 })) {
  labels.push(output.label);
  if (labels.length >= 12) break;
}
return labels;

get

client.outputs.get(id: string): Promise<Output>

Fetch a public output detail
const page = await client.outputs.list({ scope: "public", pageSize: 6 });
const first = page.items[0];
if (!first) return { empty: true };
const output = await client.outputs.get(first.id);
return {
  id: output.id,
  label: output.label,
  tags: output.tags,
  isPublic: output.isPublic,
  isOwner: output.isOwner,
};

create

client.outputs.create(input: OutputCreateInput): Promise<OutputCreateResponse>

⚠️ Writes to your account. Cleans up after itself.
Create then delete
const created = await client.outputs.create({
  label: `docs-demo-output-${Date.now()}`,
  isPublic: false,
  tags: ["demo"],
});
await client.outputs.delete(created.id);
return created;

update

client.outputs.update(id: string, input: OutputUpdateInput): Promise<void>

Updates label, tags, or visibility. No versioning.

⚠️ Writes to your account. Cleans up after itself.
Create, update, clean up
const created = await client.outputs.create({ label: `docs-demo-${Date.now()}`, isPublic: false });
await client.outputs.update(created.id, {
  label: `docs-demo-updated-${Date.now()}`,
  tags: ["updated"],
  isPublic: true,
});
const detail = await client.outputs.get(created.id);
await client.outputs.delete(created.id);
return { label: detail.label, tags: detail.tags, isPublic: detail.isPublic };

delete

client.outputs.delete(id: string): Promise<void>

⚠️ Writes to your account. Cleans up after itself.
Create then delete
const created = await client.outputs.create({ label: `docs-demo-${Date.now()}` });
await client.outputs.delete(created.id);
try {
  await client.outputs.get(created.id);
  return { deleted: false };
} catch (err) {
  if (err instanceof PromptyNotFoundError) return { deleted: true };
  throw err;
}

vote

client.outputs.vote(id: string, value: 1 | -1): Promise<void>

⚠️ Writes to your account. Cleans up after itself.
Vote on your own output
const created = await client.outputs.create({ label: `docs-demo-vote-${Date.now()}` });
await client.outputs.vote(created.id, 1);
const detail = await client.outputs.get(created.id);
await client.outputs.delete(created.id);
return { upvotes: detail.upvotes, userVote: detail.userVote };

unvote

client.outputs.unvote(id: string): Promise<void>

⚠️ Writes to your account. Cleans up after itself.
Vote, unvote, clean up
const created = await client.outputs.create({ label: `docs-demo-unvote-${Date.now()}` });
await client.outputs.vote(created.id, 1);
await client.outputs.unvote(created.id);
const detail = await client.outputs.get(created.id);
await client.outputs.delete(created.id);
return { upvotes: detail.upvotes, userVote: detail.userVote };

toggleFavorite

client.outputs.toggleFavorite(id: string): Promise<{ favorited: boolean }>

⚠️ Writes to your account. Cleans up after itself.
Toggle on, off, clean up
const created = await client.outputs.create({ label: `docs-demo-fav-${Date.now()}` });
const a = await client.outputs.toggleFavorite(created.id);
const b = await client.outputs.toggleFavorite(created.id);
await client.outputs.delete(created.id);
return { firstToggle: a.favorited, secondToggle: b.favorited };