Skip to content

feat(zcode-plugin-langfuse): add Langfuse observability plugin - #11

Open
erlinerd wants to merge 8 commits into
zai-org:mainfrom
erlinerd:feat/langfuse-observability
Open

feat(zcode-plugin-langfuse): add Langfuse observability plugin#11
erlinerd wants to merge 8 commits into
zai-org:mainfrom
erlinerd:feat/langfuse-observability

Conversation

@erlinerd

@erlinerd erlinerd commented Sep 12, 2026

Copy link
Copy Markdown

Summary

Adds zcode-plugin-langfuse, a community ZCode Hook plugin that sends one
fail-open Langfuse trace named ZCode Turn per completed turn.

  • Tool calls are recorded as spans and the assistant response as a generation.
  • The plugin publishes only on Stop and reads only fields delivered by ZCode
    Hook stdin.
  • It never reads transcript files or collects hidden chain-of-thought.
  • Missing credentials, malformed input, local state errors, and Langfuse errors
    do not block ZCode.
  • Prompt, tool-input, and tool-output capture are independently switchable and
    size-bounded.

Update: unified rename (this push)

All identifiers are now unified as zcode-plugin-langfuse to match the renamed
source repository:

  • Plugin directory: plugins/zcode-plugin-langfuse
  • Plugin and marketplace entry name: zcode-plugin-langfuse
  • Version at that update: 0.2.0 (the plugin id change was breaking for
    previously installed copies). Current version: 0.2.1.
  • Source repository renamed: https://github.com/erlinerd/zcode-plugin-langfuse
  • Re-validated after the rename: python3 scripts/validate.py reports
    OK: 20 plugin(s) validated; the 95-test suite passes with 8 expected
    skips; git diff --check is clean.

Marketplace registration

  • Plugin directory: plugins/zcode-plugin-langfuse
  • Plugin version: 0.2.1
  • Category: developer-tools
  • Root marketplace entry and .zcode-plugin/plugin.json names, descriptions,
    localized descriptions, and versions are aligned.
  • The Hook runs a self-contained esbuild bundle at dist/hooks/entry.mjs,
    generated and verified by the plugin repository's unified distribution build
    (npm run package:plugin); the bundle carries a plain-text
    Generated by npm run build provenance marker.

Review fixes

  • Process environment now overrides persisted plugin options, and persisted
    options are selected only for the exact ZCODE_PLUGIN_ID.
  • Langfuse endpoints are HTTPS-only; plaintext HTTP is rejected.
  • Every captured value, including truncation markers, stays within
    max_capture_chars.
  • README files document six process hooks, current-user permissions, config
    reads, local state writes, HTTPS network access, command-execution boundaries,
    and transcript/privacy boundaries.
  • THIRD_PARTY_NOTICES.md identifies langfuse 3.38.20,
    langfuse-core 3.38.20, and mustache 4.2.0, all MIT-licensed, with
    provenance links.

Provenance and side effects

  • Source repository: https://github.com/erlinerd/zcode-plugin-langfuse
    • The bundle inlines the official langfuse JavaScript SDK, so the catalog
      copy needs no runtime npm install; it talks to the same Langfuse HTTPS
      ingestion API through Node's built-in fetch.
  • Network access: HTTPS requests to the configured Langfuse endpoint, only for
    telemetry publishing.
  • Local writes: bounded per-session state under ZCODE_PLUGIN_DATA when
    available, or the ZCode plugin data fallback; state is cleaned up after a
    completed Stop.
  • Each of the six hooks runs node with the current user's permissions. The
    plugin does not spawn a shell or execute user commands.
  • License: MIT. No credentials, private prompts, transcripts, or Hook payloads
    are included.

Verification

From the repository root:

python3 scripts/validate.py
python3 scripts/build_dist.py
git diff --check
python3 -m unittest discover -s tests -p 'test_*.py'

Results after the review-fix commit:

  • 20 plugins validated.
  • Distribution built for zcode-plugin-langfuse@0.2.1.
  • 95 tests passed, 8 expected skips.
  • All six source Hook modules pass node --check.
  • The source Hook synthetic session returned {} and left zero state files
    after Stop, including a fail-open network-error smoke test.
  • A real ZCode session using the community plugin completed successfully: the
    Langfuse API returned HTTP 200, the resulting ZCode Turn contained one
    assistant generation and 18 tool spans, and the local state was cleaned up.
    The test did not expose credentials, prompts, tool payloads, or transcripts.
    (Runtime smoke evidence was gathered on the pre-rename code; the rename
    changes identifiers only and was re-validated as described above.)

Update: catalog-ready bundle layout (2026-09-13)

This PR now ships the complete plugin directory exactly as generated by the
source repository's unified distribution build (npm run package:plugin):

  • plugins/zcode-plugin-langfuse/ mirrors
    artifacts/plugin-layout/plugins/zcode-plugin-langfuse/ byte-for-byte
    (verified with diff -r), replacing the earlier hand-copied readable-JS
    snapshot. The entry point is the self-contained dist/hooks/entry.mjs
    bundle declared by hooks/hooks.json.
  • Generated bundles are now intentionally part of this PR: the upstream
    catalog already ships a sealed build artifact for mimosa 1.0.3
    (payload/, ~6.2 MB) and the official scripts/validate.py accepts it.
    The bundle marker traces it back to the tagged source release v0.2.1 in
    https://github.com/erlinerd/zcode-plugin-langfuse. The earlier
    "generated bundles ... are not committed" statement above is withdrawn; it
    described the previous source-snapshot layout.
  • Syncs are produced by scripts/sync-catalog.mjs in the source repository,
    which validates the layout, mirrors the plugin directory, and updates the
    marketplace entry; repeated runs are verified no-ops.
  • Verification on this head: python3 scripts/validate.py reports
    OK: 20 plugin(s) validated; git diff --check is clean; the layout and
    the fork directory compare byte-identical. No credentials, prompts,
    transcripts, or Hook payloads are included.

Align with the source repository rename (erlinerd/zcode-plugin-langfuse):
- plugins/langfuse-observability -> plugins/zcode-plugin-langfuse
- plugin name, marketplace entry, and in-code identifiers
- version 0.1.1 -> 0.2.0 (plugin id change is breaking for installed copies)
@erlinerd erlinerd changed the title feat(langfuse-observability): add Langfuse observability plugin feat(zcode-plugin-langfuse): add Langfuse observability plugin Sep 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant