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/bind-eval.test.ts

View on GitHub
import { describe, expect, test } from "bun:test"
import { fleetFromSdk, RelayBindError, threadPortFromTools, type EvalThreadTools } from "./index.ts"

function tools(answers: {
  readonly list?: unknown
  readonly read?: unknown
  readonly send?: unknown
}): EvalThreadTools & {
  readonly calls: unknown[]
} {
  const calls: unknown[] = []
  const reply = (value: unknown) => ({ text: typeof value === "string" ? value : JSON.stringify(value) })
  return {
    calls,
    thread_list: async (args) => {
      calls.push(["list", args])
      return reply(answers.list)
    },
    thread_read: async (args) => {
      calls.push(["read", args])
      return reply(answers.read)
    },
    thread_send: async (args) => {
      calls.push(["send", args])
      return reply(answers.send)
    },
  }
}

describe("threadPortFromTools", () => {
  test("#given a list answer #when listed #then rows keep thread, name and machine and the call passes options through", async () => {
    // given
    const fake = tools({
      list: { kind: "ok", threads: [{ thread: "t-1", name: "one", machine: "device-b", link: "x" }], scope: "all" },
    })

    // when
    const answer = await threadPortFromTools(fake).list({ all_scope: true })

    // then
    expect(answer.kind === "ok" ? answer.threads : []).toEqual([{ thread: "t-1", name: "one", machine: "device-b" }])
    expect(fake.calls).toEqual([["list", { all_scope: true }]])
  })

  test("#given a tool error #when sent #then the port answers that error unchanged", async () => {
    // given
    const error = { code: "not_found", message: "no thread", next_action: "call thread_list" }

    // when
    const answer = await threadPortFromTools(tools({ send: { kind: "error", error } })).send("t-x", "hi", {
      all_scope: true,
    })

    // then
    expect(answer).toEqual({ kind: "error", error })
  })

  test("#given text that is not JSON #when read #then the answer is unreadable_result, not a throw", async () => {
    // when
    const answer = await threadPortFromTools(tools({ read: "not json" })).read("t-1")

    // then
    expect(answer.kind === "error" ? answer.error.code : undefined).toBe("unreadable_result")
  })
})

describe("fleetFromSdk", () => {
  test("#given a module without a bunshin client #when bound #then it throws RelayBindError sdk_shape", () => {
    // when
    const bind = () => fleetFromSdk({ bunshin: { listMachines: "nope" } })

    // then
    expect(bind).toThrow(RelayBindError)
  })

  test("#given a module with a bunshin client #when bound #then that client is the fleet", () => {
    // given
    const bunshin = { listMachines: async () => [], fanout: async function* () {} }

    // when
    const fleet = fleetFromSdk({ bunshin })

    // then
    expect(fleet).toBe(bunshin as unknown as typeof fleet)
  })
})
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