Files
vectorize-io__hindsight/hindsight-all-npm
Nicolò Boschi d7d137fa1e fix(daemon): drop the idle timeout that could kill an in-flight request (#3930)
* fix(daemon): drop the idle timeout that could kill an in-flight request

The daemon's idle checker measured idleness as "time since the last request
*started*" (IdleTimeoutMiddleware stamped last_activity on entry, never on
completion), so a retain, reflect or consolidation that outlived the configured
timeout was SIGTERM'd mid-flight — the client saw a connection error and the
work was lost. Raising the timeout only lowered the odds; 0 (the default
everywhere but the legacy cursor hook package) was the only safe value.

Rather than teach the middleware to count in-flight requests, remove the
feature: a shared local daemon that quietly exits under a long operation is not
worth the resource reclamation it buys. The daemon now runs until it is
stopped.

- Delete IdleTimeoutMiddleware, the idle-checker thread and DEFAULT_IDLE_TIMEOUT.
- Keep `--idle-timeout` parseable — hindsight-embed and every coding-agent
  integration still pass it — but ignore it, printing a note when it is
  non-zero. The integration packages therefore need no change and no release.
- Drop it from the current docs, the SDK/integration READMEs and the generated
  docs skill. The coding-agents README keeps the row marked deprecated because
  docs-freshness.test.ts requires every readable RawConfig field to be
  documented; versioned docs, blog posts and changelogs are left as history.

Closes #3903

Claude-Session: https://claude.ai/code/session_012gXUp1i7YrWmLJVUYki53g

* review: drop the now-dead logger and refresh the comments the removal invalidated

- daemon.py: the module logger only served the deleted idle checker.
- coding-agents daemon.ts / runtime.ts / runtime.test.ts and openclaw: comments,
  a debug line and the plugin-schema description still described an auto-exit
  that can no longer happen. The config fields stay (inert) as agreed.

Claude-Session: https://claude.ai/code/session_012gXUp1i7YrWmLJVUYki53g
2026-08-31 15:59:31 +02:00
..
2026-08-25 12:19:47 +02:00

@vectorize-io/hindsight-all

Node.js equivalent of the Python hindsight-all package — programmatic lifecycle manager for a local Hindsight daemon. Use this when you want to embed Hindsight in a Node application without hand-rolling subprocess management.

This package deliberately does not ship an HTTP client. Once the daemon is running, talk to it with @vectorize-io/hindsight-client against server.getBaseUrl(). The two packages compose — one owns the daemon process, the other owns the HTTP API surface.

Requirements

  • Node.js >= 22 — uses global fetch and AbortSignal.timeout.
  • uv / uvx on PATH — used to download and run the underlying hindsight-embed daemon on first use. Install via https://docs.astral.sh/uv/.

Install

npm install @vectorize-io/hindsight-all @vectorize-io/hindsight-client

Example

import { HindsightServer, consoleLogger } from "@vectorize-io/hindsight-all";
import { HindsightClient } from "@vectorize-io/hindsight-client";

const server = new HindsightServer({
  profile: "my-app",
  port: 9077,
  env: {
    HINDSIGHT_API_LLM_PROVIDER: "anthropic",
    HINDSIGHT_API_LLM_API_KEY: process.env.ANTHROPIC_API_KEY,
    HINDSIGHT_API_LLM_MODEL: "claude-sonnet-4-20250514",
  },
  logger: consoleLogger,
});

await server.start();

const client = new HindsightClient({ baseUrl: server.getBaseUrl() });

await client.retain("user-123", "User prefers dark mode and concise answers.", {
  documentId: "pref-2026-04-01",
});

const recall = await client.recall("user-123", "what are the user preferences?");
console.log(recall.results);

await server.stop();

For a remote Hindsight API, skip HindsightServer entirely and just point HindsightClient at the remote URL.

Open config — forward-compatible with new daemon flags

HindsightServerOptions is designed so every new environment variable or CLI flag in the underlying Hindsight daemon can be used without waiting for a wrapper release:

  • env accepts an arbitrary Record<string, string>. Every entry is exported into the daemon process and written into the profile config via --env KEY=VALUE.
  • extraProfileCreateArgs / extraDaemonStartArgs append raw args to the respective commands.

Development against a local checkout

If you're hacking on the Python hindsight-embed package in the same monorepo, point the server at the local path — it'll use uv run --directory <path> instead of uvx:

new HindsightServer({
  embedPackagePath: "/path/to/hindsight-embed",
  // ...
});

API surface

  • HindsightServer — daemon lifecycle (start, stop, checkHealth, getBaseUrl, getProfile).
  • Logger interface plus silentLogger (default) and consoleLogger helpers.
  • getEmbedCommand(opts) — low-level helper that returns the [cmd, ...args] tuple used to invoke the underlying Python CLI.

For memory operations (retain, recall, reflect, bank management, stats) use @vectorize-io/hindsight-client.

License

MIT