skip to content
$worker

fp

v0.2.15

Lodash-style value transforms (fp::get/pick/take/…) and fp::pipe — worker-side pipelines that move big values function→function without routing them through the model.

iiiverified
453 installs0 in 7d0 today
install
$iii trigger compose::add worker=fp@0.2.15
binarylicense: Apache-2.0fpfunctionallodashpipelinetransform
  • macOS: arm64
  • Linux: arm64 · armv7 · x64
  • Windows: arm64 · x64

exact versions are immutable; binary and bundle artifacts are digest-pinned.

functions

28

fp::compact

function

Remove null elements from an array (lodash _.compact, null-only: 0, false and "" are KEPT). Pairs with fp::map, whose sporadic misses become null.

request
  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::condition

function

Trigger-binding guard: compare a JSON pointer inside the fired event and answer { decision: "allow" | "skip", reason }; config is { path?, op, to?, negate? } with the fp::when ops. A pointer that resolves to nothing SKIPS rather than erroring.

request
  • condition_configany of
    any of (2)
    variant 1
    • negateboolean

      Invert the verdict — the only way to fire when the path is ABSENT (a path that never resolves then fires on every event).

    • opall ofrequired

      Comparison to run.

      … expand 1 nested
      all of (1)
      variant 1
      valuestringenum: ==, !=, >, >=, <, <=,
    • pathstring

      JSON pointer into the event; defaults to the whole event.

    • tounknown

      Right-hand side for the comparison ops; rejected for exists/not_empty.

    variant 2
    valuenull
  • eventunknownrequired
response
one of (2)
variant 1
  • decisionstringrequiredenum: allow
  • reasonstringrequired
variant 2
  • decisionstringrequiredenum: skip
  • reasonstringrequired

fp::countBy

function

Count array elements per plucked key (lodash _.countBy) into { "<key>": <count> }; path "" counts by the element itself. Same key rules as fp::groupBy.

request
  • pathstringrequired

    JSON pointer plucked from each element as the bucket key (`""` = the element itself).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::drop

function

Skip the first n elements of an array or the first n characters of a string (lodash _.drop).

request
  • ninteger· uint32requiredmin 0

    How many array elements / string characters to skip.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::filter

function

Keep array elements whose properties equal a partial object (lodash _.filter with a matches iteratee). `matches` is a partial OBJECT, never a bare string/number; only object elements can match.

request
  • matchesobjectrequired

    Partial object an element's top-level properties must equal.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::flatten

function

Flatten an array one level (lodash _.flatten).

request
  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::get

function

Extract the single value at a JSON pointer (lodash _.get). A miss names the keys that were available.

request
  • pathstringrequired

    JSON pointer selecting the value to return (e.g. `/content`).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::getOr

function

Extract the value at a JSON pointer, or `default` when the path misses (lodash fp.getOr). A stored null is a hit, not a miss.

request
  • defaultunknownrequired

    Returned when the path matches nothing (a stored null is a hit).

  • pathstringrequired

    JSON pointer selecting the value to return (e.g. `/content`).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::groupBy

function

Bucket array elements by a plucked key (lodash _.groupBy) into { "<key>": [element, ...] }; path "" groups by the element itself. Keys must be a string, number, or boolean; null or container keys error.

request
  • pathstringrequired

    JSON pointer plucked from each element as the bucket key (`""` = the element itself).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::inject-guidance

function

Internal pre_generate hook: appends fp::pipe usage guidance to the agent system prompt. Bound to harness::hook::pre-generate at worker startup; not called directly.

request
  • generateobject
    • system_promptstring

      The system prompt assembled so far (base + any prior hook's mutation).

response
  • mutationsobjectrequired

    The harness applies `system_prompt` only when the key is present (`HookRunner::run_pre_generate` — `if m.system_prompt.is_some()`), so `None` serializes to an empty object: the safe no-op that preserves the harness's assembled prompt.

    • system_promptstring

      Full replacement system prompt (base + appended guidance). The harness overwrites, it does not merge.

fp::join

function

Join array elements into one string (lodash _.join); separator defaults to ",".

request
  • separatorstring

    Separator between elements (default `","`).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::map

function

Pluck the value at a JSON pointer from each array element (lodash _.map with a property iteratee). Sporadic misses become null (fp::compact drops them); a path matching NO element errors.

request
  • pathstringrequired

    JSON pointer plucked from each element (e.g. `/id`); sporadic misses become null, a path matching no element errors.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::max

function

Find the largest number in an array (lodash _.max/_.maxBy); `path` plucks from each element first. Returns the NUMBER, not the element. An empty array errors.

request
  • pathstring

    JSON pointer plucked from each element before reducing (the lodash `…By` form).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::mean

function

Average an array of numbers (lodash _.mean/_.meanBy); `path` plucks from each element first. Deviates from lodash: an EMPTY array errors instead of yielding NaN.

request
  • pathstring

    JSON pointer plucked from each element before reducing (the lodash `…By` form).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::min

function

Find the smallest number in an array (lodash _.min/_.minBy); `path` plucks from each element first. Returns the NUMBER, not the element. An empty array errors.

request
  • pathstring

    JSON pointer plucked from each element before reducing (the lodash `…By` form).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::nth

function

Return array element n (negative counts from the end, lodash _.nth). Out of bounds errors naming the length.

request
  • ninteger· int64required

    Index to pluck; negative counts from the end (`-1` = last element).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::omit

function

Drop top-level keys from an object (lodash _.omit).

request
  • pathsstring[]required

    Top-level keys to drop; missing keys are ignored.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::on-config-change

function

Internal: reload fp settings from the authoritative configuration on change.

request
  • idstring

    Configuration id that changed.

response
  • okbooleanrequired

fp::pick

function

Subset an object by top-level keys (lodash _.pick); missing keys are omitted.

request
  • pathsstring[]required

    Top-level keys to keep; missing keys are silently omitted.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::pipe

function

Run a worker-side pipeline: each step triggers a function and its result lands in the next step's payload at `into` (default "/value"); fp::* steps thread the bare value and a failing fp::when stops the pipe. The FIRST step gets no threaded value. Returns per-step sizes and a preview, not the value.

request
  • preview_charsinteger· uint32min 0

    Preview length of the final threaded value in the receipt (capped at 8000).

  • throughobject[]required

    Steps run in order; step N+1 receives step N's threaded value.

    • functionstringrequired

      Function id to trigger.

    • intostring

      JSON pointer in this step's payload where the previous value lands (default `/value`); object keys only, no array indexing.

    • payloadunknown

      Base payload for the call.

response
  • short_circuitedbooleanrequired

    True when a `fp::when` guard failed and stopped the pipe: the receipts end at the guard and NO later step ran. Absent (false) on a full run.

  • stepsobject[]required
    • charsinteger· uintrequiredmin 0

      Size of the value threaded OUT of this step (chars of its string or serialized form).

    • functionstringrequired
    • notestring

      Set when the threaded value REPLACED a non-null literal already in this step's payload at the `into` pointer — almost always an omitted `into` on a write step clobbering the value it meant to write.

  • value_previewstring

fp::reverse

function

Reverse an array (lodash _.reverse, immutable like lodash/fp).

request
  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::size

function

Count a collection (lodash _.size): array length, string chars, or object key count. Non-collections error instead of returning 0.

request
  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::sortBy

function

Sort array elements ascending by the value at a JSON pointer (lodash _.sortBy, stable); path "" sorts the elements themselves. Keys must all be numbers, strings, or booleans. Pair with fp::reverse for descending.

request
  • pathstringrequired

    JSON pointer plucked from each element as the sort key (e.g. `/score`).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::split

function

Split a string into an array of strings (lodash _.split).

request
  • separatorstringrequired

    Non-empty separator to split on (e.g. `"\n"`).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::sum

function

Total an array of numbers (lodash _.sum/_.sumBy); `path` plucks the addend from each element first. An empty array totals 0; a non-numeric element errors rather than being skipped.

request
  • pathstring

    JSON pointer plucked from each element before reducing (the lodash `…By` form).

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::take

function

Keep the first n elements of an array or the first n characters of a string (lodash _.take).

request
  • ninteger· uint32requiredmin 0

    How many array elements / string characters to keep.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::uniq

function

Deduplicate an array, keeping first occurrences (lodash _.uniq).

request
  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • valueunknownrequired

fp::when

function

Guard: test the value at a JSON pointer (`path` defaults to the whole value; a pointer miss FAILS, never errors) and return { passed, value }. As a fp::pipe step a passing guard threads the ORIGINAL value onward and a failing one STOPS the pipe (`short_circuited: true`).

request
  • opall ofrequired

    Comparison to run.

    all of (1)
    variant 1
    valuestringenum: ==, !=, >, >=, <, <=,
  • pathstring

    JSON pointer selecting what to test (default: the whole value).

  • tounknown

    Right-hand side for the comparison ops; rejected for exists / not_empty.

  • valueunknownrequired

    Input value (a pipe lands the previous step's value here).

response
  • passedbooleanrequired
  • valueunknownrequired

    The ORIGINAL input value, untouched — guards test, they never reshape.

triggers

0
no triggers registered