iii-observe
БесплатноБез исполняемых скриптовНе проверенUse when one iii function should run when another runs (iii.observe), when binding functions to HTTP routes, cron schedules, queue topics, state or database…
от iii-hq★ 18 978 звёзд на GitHubОб этом скилле
Observe
iii.observe(a, b): when a runs, b runs.
iii.observe("orders::create", "alerts::big-order");
Every function is observable. By default, each successful call of orders::create runs
alerts::big-order with the Observed payload of that call (its input, output, and caller; the call's metadata only when capture names it). Events are
function calls too: an HTTP request is a call of http::on-request, a row change a call of
database::on-row-changed. Observing one of them is how a
function runs on that event.
| Part | Fields | Notes |
|---|---|---|
source (left side) |
"fn::id", or { function_id, namespace?, args?, filters?, capture? } |
args are for the function's worker (a route, a table, a topic), validated against its args_format. filters are for iii: they select which calls reach the target. capture: which parts of the call the payload carries (input, output, error, caller, metadata), and with them which calls run the target: input/output fire on success, error on error, caller/metadata only add fields (a non-empty capture must name one of input, output, error: INVALID_ARGS otherwise). Default ['input', 'output', 'caller'] (success only; metadata is opt-in). on and deliver are deprecated: the engine translates them with a warning (see Code written for 0.25). Ids, status, and timing are always there; capture: [] fires on success and moves no payloads |
target (right side) |
a registered function id (or { function_id, namespace }) |
No inline handler. The observer stays pending until the target is registered |
options |
id?, max_fires?, expires_in_ms?, max_in_flight?, metadata? |
id defaults to a UUID kept across replays. metadata is the sidecar of every activation |
The source namespace resolves like call(): the worker's namespace, except engine::* and
configuration::*, which resolve in default.
Observe a function
Register the target, then observe. This alerts on failed charges of 500 or more (error without
input or output fires on failures only; the filter still reads the input):
import { registerWorker, type Observed } from "iii-sdk";
const iii = registerWorker(process.env.III_URL ?? "ws://localhost:49134");
iii.registerFunction("alerts::payment-failed", async (event: Observed<{ amount: number }>) => {
console.log(event.function_id, event.error?.code, event.caller?.worker_name);
return null;
});
const failures = iii.observe(
{
function_id: "payments::charge",
filters: { "input.amount": { $gte: 500 } },
capture: ["error", "caller"],
},
"alerts::payment-failed",
{ max_in_flight: 4 },
);
await failures.ready(); // rejects with ObserveRejection (error.code) on error or disposed
// later: await failures.dispose()
iii.register_function("alerts::payment-failed", lambda event: print(event["error"]["code"]))
failures = iii.observe(
{"function_id": "payments::charge",
"filters": {"input.amount": {"$gte": 500}}, "capture": ["error", "caller"]},
"alerts::payment-failed",
{"max_in_flight": 4},
)
failures.ready() # blocks; in async code: await failures.ready_async()
use iii_sdk::{Capture, Error, ObserverOptions, Observed, RegisterFunction, Source};
use serde_json::{json, Value};
iii.register_function(
"alerts::payment-failed",
RegisterFunction::new(|event: Observed<Value>| {
println!("{} failed: {:?}", event.function_id, event.error);
Ok::<_, Error>(())
}),
);
let failures = iii.observe_with(
Source::function("payments::charge")
.filters(json!({ "input.amount": { "$gte": 500 } }))
.capture([Capture::Error, Capture::Caller]),
"alerts::payment-failed",
ObserverOptions::default().max_in_flight(4),
);
failures.ready().await?;
client.RegisterFunction("alerts::payment-failed", func(ctx context.Context, data json.RawMessage) (any, error) {
var ev iii.Observed
if err := json.Unmarshal(data, &ev); err != nil {
return nil, err
}
log.Printf("%s failed: %s", ev.FunctionID, ev.Error.Code)
return nil, nil
})
failures, err := client.Observe(iii.Source{
FunctionID: "payments::charge",
Filters: iii.Filters{"input.amount": iii.Op{"$gte": 500}},
Capture: []iii.Capture{iii.CaptureError, iii.CaptureCaller},
}, "alerts::payment-failed", iii.ObserverOptions{MaxInFlight: 4})
if err == nil {
err = failures.Ready(ctx) // *iii.ObserveRejectionError carries the code
}
// shorthand for a bare function id: client.ObserveFunction("orders::create", "alerts::big-order")
The browser SDK (iii-browser-sdk) has the same observe API as Node.
Run a function on an event
Each capability worker hosts a source function. Add the worker once
(iii call compose::add worker=http), then observe its function with the args it documents:
| Source function | Worker | args | What the target receives |
| --- | -
Установить iii-observe в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
FAQ
Что делает скилл iii-observe?
Use when one iii function should run when another runs (iii.observe), when binding functions to HTTP routes, cron schedules, queue topics, state or database changes, or engine events through their source functions (http::on-request, cron::on-tick, queue::on-message, state::on-changed, database::on-row-changed), when writing filters, or when writing an event source with onObserverAdded, onObserverRemoved, onObservationMatch, and onObservationDeliver across TypeScript, browser, Python, Rust, and Go.
Как установить скилл iii-observe?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл iii-observe запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic