code-yeongyu/oh-my-openagent / packages/omo-senpi/skills/omo-relay
omo-relay
VerifiedWorks 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.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 2.6 KB |
| references/errors.md | markdown | 1.4 KB |
| references/machines.md | markdown | 3.1 KB |
| references/parallel.md | markdown | 3.1 KB |
| scripts/sdk/bind-eval.test.ts | script | 2.7 KB |
| scripts/sdk/bind-eval.ts | script | 5.7 KB |
| scripts/sdk/conformance.test.ts | script | 654 B |
| scripts/sdk/index.ts | script | 454 B |
| scripts/sdk/machines.test.ts | script | 5.4 KB |
| scripts/sdk/machines.ts | script | 5.2 KB |
| scripts/sdk/outcome.ts | script | 3.3 KB |
| scripts/sdk/ports.ts | script | 2.9 KB |
| scripts/sdk/threads.test.ts | script | 4.1 KB |
| scripts/sdk/threads.ts | script | 3.3 KB |
| scripts/sdk/tsconfig.json | config | 522 B |
| scripts/sdk/write-nothing.test.ts | script | 2.9 KB |
scripts/sdk/machines.ts
View on GitHubimport { batchOf, portErrorOf, type BatchResult, type Settled } from "./outcome.ts"
import type { FleetPort, MachineRef, PortError, WaveContext, WaveOptions, WaveOutcome } from "./ports.ts"
export type MachineOp<Machine, Value> = (machine: Machine, context: WaveContext) => Promise<Value>
/** How a machine is named in an outcome: the row's identity, never the live proxy. */
export type MachineLabel = Pick<MachineRef, "id" | "alias" | "state">
type Resolution<Machine> =
{ readonly kind: "machine"; readonly machine: Machine } | { readonly kind: "rejected"; readonly error: PortError }
// The fleet client's contract is one outcome per dispatched machine; a slot left empty would otherwise
// vanish from the batch, so it is reported instead of dropped.
const NO_OUTCOME: PortError = {
code: "no_outcome",
message: "the fleet client settled no outcome for this machine",
next_action: "report it; check the machine with listMachines() before running the operation again",
}
function labelOf(machine: MachineRef): MachineLabel {
return { id: machine.id, alias: machine.alias, state: machine.state }
}
function settledOf<Target, Value>(target: Target, outcome: WaveOutcome<unknown, Value>): Settled<Target, Value> {
switch (outcome.kind) {
case "fulfilled":
return { kind: "fulfilled", target, value: outcome.value }
case "rejected":
return { kind: "rejected", target, error: portErrorOf(outcome.error) }
case "skipped":
return { kind: "skipped", target, reason: outcome.reason ?? "duplicate" }
}
}
function resolve<Machine extends MachineRef>(rows: readonly Machine[], idOrAlias: string): Resolution<Machine> {
const matches = rows.filter((row) => row.id === idOrAlias || row.alias === idOrAlias)
const [machine] = matches
if (machine === undefined) {
return {
kind: "rejected",
error: {
code: "not_found",
message: `no machine of this account has the id or alias ${idOrAlias}`,
next_action: "use an id or alias from listMachines()",
},
}
}
if (matches.length > 1) {
return {
kind: "rejected",
error: {
code: "ambiguous",
message: `${matches.length} machines share the alias ${idOrAlias}`,
next_action: "address the machine by its id from listMachines()",
},
}
}
return { kind: "machine", machine }
}
/** Runs `op` on every machine of the account in one wave; offline and unsupported machines come back skipped. */
export async function onEveryMachine<Machine extends MachineRef, Value>(
fleet: FleetPort<Machine>,
op: MachineOp<Machine, Value>,
options?: WaveOptions,
): Promise<BatchResult<MachineLabel, Value>> {
const outcomes: { readonly index: number; readonly settled: Settled<MachineLabel, Value> }[] = []
for await (const outcome of fleet.fanout("all", async (machine, context) => op(machine, context), options)) {
outcomes.push({ index: outcome.index, settled: settledOf(labelOf(outcome.machine), outcome) })
}
return batchOf(outcomes.sort((left, right) => left.index - right.index).map(({ settled }) => settled))
}
/**
* Runs `op` on the named machines (ids or aliases) in one wave and answers one outcome per name, in input
* order. A name that matches no machine, or more than one, is rejected without running anything for it.
*/
export async function onMachines<Machine extends MachineRef, Value>(
fleet: FleetPort<Machine>,
targets: readonly string[],
op: MachineOp<Machine, Value>,
options?: WaveOptions,
): Promise<BatchResult<string, Value>> {
const slots = new Array<Settled<string, Value> | undefined>(targets.length).fill(undefined)
const dispatched: { readonly slot: number; readonly machine: Machine }[] = []
try {
const rows = await fleet.listMachines()
targets.forEach((target, slot) => {
const resolution = resolve(rows, target)
if (resolution.kind === "rejected") slots[slot] = { kind: "rejected", target, error: resolution.error }
else dispatched.push({ slot, machine: resolution.machine })
})
if (dispatched.length > 0) {
const wave = fleet.fanout(
dispatched.map(({ machine }) => machine),
async (machine, context) => op(machine, context),
options,
)
for await (const outcome of wave) {
const entry = dispatched[outcome.index]
if (entry !== undefined) slots[entry.slot] = settledOf(targets[entry.slot] ?? entry.machine.id, outcome)
}
}
} catch (thrown) {
// The directory read or the wave itself failed: every target still unsettled carries that one cause.
const error = portErrorOf(thrown)
targets.forEach((target, slot) => {
if (slots[slot] === undefined) slots[slot] = { kind: "rejected", target, error }
})
}
return batchOf(targets.map((target, slot) => slots[slot] ?? { kind: "rejected", target, error: NO_OUTCOME }))
}
/** `onMachines` for one machine: one outcome, never a throw. */
export async function onMachine<Machine extends MachineRef, Value>(
fleet: FleetPort<Machine>,
idOrAlias: string,
op: MachineOp<Machine, Value>,
options?: WaveOptions,
): Promise<Settled<string, Value>> {
const { outcomes } = await onMachines(fleet, [idOrAlias], op, options)
return outcomes[0] ?? { kind: "rejected", target: idOrAlias, error: NO_OUTCOME }
}
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| 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: 198k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 194k | Updated | Claude CodeCodex | Verified | Install |
| 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: 194k | Updated | Claude CodeCodex | Verified | Install |