Skip to content

code-yeongyu/oh-my-openagent / packages/omo-senpi/skills/omo-relay

omo-relay

Verified

Works on the account's other devices through omo's built-in relay from a js eval cell: run a command or a long job on another machine, read, write, edit or search its files, copy a directory tree to or from it, and run one operation on every machine, on chosen machines or on several threads at once with one outcome per target. Use when the user names another device, machine, host or computer of the account, asks for something on every machine or on all or several threads at once, or wants a fan-out or a remote command or file.

scripts/sdk/threads.ts

View on GitHub
import { batchOf, portErrorOf, settleEach, type BatchOptions, type BatchResult, type Settled } from "./outcome.ts"
import type {
  PortAnswer,
  PortOk,
  ThreadListOptions,
  ThreadPort,
  ThreadReadOptions,
  ThreadReadValue,
  ThreadRow,
  ThreadSendOptions,
  ThreadSendValue,
} from "./ports.ts"

export type ThreadOp<Target, Value> = (target: Target) => Promise<PortAnswer<Value>>

async function settleOne<Target, Value>(
  target: Target,
  op: ThreadOp<Target, Value>,
): Promise<Settled<Target, PortOk<Value>>> {
  try {
    const answer = await op(target)
    if (answer.kind === "error") return { kind: "rejected", target, error: answer.error }
    return { kind: "fulfilled", target, value: answer }
  } catch (thrown) {
    // A throwing callback is that target's failure; the other targets keep running and still settle.
    return { kind: "rejected", target, error: portErrorOf(thrown) }
  }
}

/** Runs `op` on each named thread (a `thread` value, alias or unique name); one outcome per name, in input order. */
export async function onThreads<Value>(
  targets: readonly string[],
  op: ThreadOp<string, Value>,
  options?: BatchOptions,
): Promise<BatchResult<string, PortOk<Value>>> {
  return batchOf(await settleEach(targets, (target) => settleOne(target, op), options?.concurrency))
}

/**
 * Lists the threads once, then runs `op` on every row. Rejects only when the list itself fails, because then
 * there is no target to report against and nothing ran.
 */
export async function onEveryThread<Value>(
  threads: ThreadPort,
  op: ThreadOp<ThreadRow, Value>,
  options?: BatchOptions & { readonly list?: ThreadListOptions },
): Promise<BatchResult<ThreadRow, PortOk<Value>>> {
  const listed = await threads.list(options?.list)
  if (listed.kind === "error") throw new ThreadListError(listed.error)
  return batchOf(await settleEach(listed.threads, (row) => settleOne(row, op), options?.concurrency))
}

export function sendToThreads(
  threads: ThreadPort,
  targets: readonly string[],
  message: string,
  options?: BatchOptions & ThreadSendOptions,
): Promise<BatchResult<string, PortOk<ThreadSendValue>>> {
  const sendOptions: ThreadSendOptions = {
    ...(options?.delivery === undefined ? {} : { delivery: options.delivery }),
    ...(options?.all_scope === undefined ? {} : { all_scope: options.all_scope }),
  }
  return onThreads(targets, (thread) => threads.send(thread, message, sendOptions), options)
}

export function readThreads(
  threads: ThreadPort,
  targets: readonly string[],
  options?: BatchOptions & ThreadReadOptions,
): Promise<BatchResult<string, PortOk<ThreadReadValue>>> {
  const readOptions: ThreadReadOptions = {
    ...(options?.wait_ms === undefined ? {} : { wait_ms: options.wait_ms }),
    ...(options?.max_bytes === undefined ? {} : { max_bytes: options.max_bytes }),
    ...(options?.all_scope === undefined ? {} : { all_scope: options.all_scope }),
  }
  return onThreads(targets, (thread) => threads.read(thread, readOptions), options)
}

export class ThreadListError extends Error {
  readonly code: string
  readonly next_action: string

  constructor(error: { readonly code: string; readonly message: string; readonly next_action: string }) {
    super(error.message)
    this.name = "ThreadListError"
    this.code = error.code
    this.next_action = error.next_action
  }
}
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 198kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall