Skip to content

Comments

feat: integrate OpenViking native flow and setup auto-bootstrap#132

Open
mczabca-boop wants to merge 3 commits intoTinyAGI:mainfrom
mczabca-boop:feat/openviking-session-native
Open

feat: integrate OpenViking native flow and setup auto-bootstrap#132
mczabca-boop wants to merge 3 commits intoTinyAGI:mainfrom
mczabca-boop:feat/openviking-session-native

Conversation

@mczabca-boop
Copy link
Collaborator

@mczabca-boop mczabca-boop commented Feb 22, 2026

Summary

This PR upgrades TinyClaw’s OpenViking integration from legacy markdown-first retrieval to OpenViking’s native architecture (Session + Search + Memory), while preserving a safe compatibility fallback path.

What changed

  • Native Session write path (primary)

    • Added persistent mapping for (channel, senderId, agentId) -> openviking_session_id.
    • External user turns now write to OpenViking via:
      • POST /api/v1/sessions
      • POST /api/v1/sessions/{id}/messages (role=user|assistant)
      • POST /api/v1/sessions/{id}/commit on reset/session-end.
    • Added explicit commit timeout control (TINYCLAW_OPENVIKING_COMMIT_TIMEOUT_MS, default 15000ms).
  • Native Search prefetch path (primary)

    • Prefetch now primarily uses POST /api/v1/search/search (optionally with session_id).
    • Consumes typed results (memory/resource/skill) and injects concise structured context.
    • Legacy find-uris + read + markdown turn parsing retained as fallback only.
  • Fallback and rollback safety

    • Kept legacy markdown sync/retrieval path behind compatibility logic.
    • Fallback reasons are explicitly logged for traceability.
    • Existing queue/channel architecture remains unchanged.
  • Stability and observability

    • Added clearer logs for:
      • native session resolve/write/commit success or failure
      • retrieval source and hit distribution by type
      • fallback reasons
    • Added/kept feature flags for controlled rollout:
      • TINYCLAW_OPENVIKING_SESSION_NATIVE
      • TINYCLAW_OPENVIKING_SEARCH_NATIVE
      • TINYCLAW_OPENVIKING_PREFETCH
      • TINYCLAW_OPENVIKING_AUTOSYNC
      • timeout and prefetch size controls.
  • Setup/start UX integration

    • tinyclaw setup now supports optional OpenViking enablement.
    • If enabled, setup bootstraps OpenViking config and writes required values to ~/.openviking/ov.conf.
    • tinyclaw start can auto-start OpenViking server and export required runtime env vars for seamless use.
    • Setup currently uses the OpenAI-tested path only for OpenViking bootstrap.

Files touched

  • src/queue-processor.ts
  • src/lib/openviking-prefetch.ts
  • src/lib/openviking-session-map.ts (new)
  • src/tools/openviking-tool.ts
  • lib/templates/agent-tools/openviking/openviking-tool.js
  • lib/setup-wizard.sh
  • lib/common.sh
  • lib/daemon.sh
  • README.md

Validation performed

  • npm run build:main
  • npm run test:prefetch-parser
  • Native smoke flow validated:
    • session-create -> session-message(user/assistant) -> session-commit -> search
  • Queue log verification:
    • native prefetch source and typed distribution (memory/resource/skill)
    • native session write success logs
    • commit success/timeout behavior and fallback visibility

Notes / known constraints

  • Legacy markdown path is intentionally retained for compatibility and fast rollback.
  • Commit may still fail under transient backend slowness; timeout is now independently tunable and defaults to 15s.
  • OpenViking setup bootstrap is currently OpenAI-only by design (tested path).

@mczabca-boop mczabca-boop requested a review from jlia0 February 23, 2026 05:17
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