wendkeep 0.69.0 → 0.71.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +43 -0
- package/README.en.md +5 -3
- package/README.md +5 -3
- package/docs/en/commands/changes-and-verification.md +4 -0
- package/docs/en/commands/costs-and-observability.md +11 -2
- package/docs/en/commands/observer.md +130 -0
- package/docs/pt-BR/commands/changes-and-verification.md +4 -0
- package/docs/pt-BR/commands/costs-and-observability.md +12 -2
- package/docs/pt-BR/commands/observer.md +131 -0
- package/hooks/harness-doctor.mjs +21 -7
- package/hooks/observer-publish.mjs +21 -0
- package/hooks/pricing.json +10 -1
- package/hooks/token-usage.mjs +13 -0
- package/package.json +4 -3
- package/packages/cli/src/index.mjs +8 -1
- package/packages/integrations/src/host-hooks.mjs +4 -0
- package/src/observer-memory-publish.mjs +334 -0
- package/src/observer-memory.mjs +308 -0
- package/src/observer-publish.mjs +134 -0
- package/src/observer-server.mjs +333 -0
- package/src/observer-snapshot.mjs +153 -0
- package/src/observer-store.mjs +155 -0
- package/src/observer.mjs +146 -0
- package/src/taxonomy.mjs +2 -0
- package/web/observer/app.mjs +611 -0
- package/web/observer/favicon.svg +5 -0
- package/web/observer/index.html +125 -0
- package/web/observer/styles.css +229 -0
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,49 @@ All notable changes to **wendkeep** are documented here. Format based on
|
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/); this project follows
|
|
5
5
|
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
6
|
|
|
7
|
+
## [0.71.1] — 2026-08-17
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- **Observer memory authority.** O container local agora recebe a cópia integral das sessões,
|
|
12
|
+
decisões, bugs, aprendizados, specs, changes, CORE, DIGEST, SHARED_MEMORY e estado do brain.
|
|
13
|
+
A API oferece árvore, leitura completa, busca por corpo, sincronização, modos
|
|
14
|
+
`mirror`/`container-read`/`container-authority` e exportação read-only.
|
|
15
|
+
- **Workspace de memória no navegador.** O painel local navega por projeto, sessões, memória,
|
|
16
|
+
changes, sincronização e leitor Markdown completo, sem formulário ou token no loopback.
|
|
17
|
+
- **Importação do WendKeep.** `observer memory import` registra a carga inicial e informa paridade
|
|
18
|
+
por arquivo e hash; o volume Docker permanece preservado em rebuild e reinício.
|
|
19
|
+
|
|
20
|
+
### Fixed
|
|
21
|
+
|
|
22
|
+
- **Observer local abre diretamente.** O dashboard não exige mais token, formulário ou
|
|
23
|
+
`Authorization` para consultar a projeção no loopback; o compose também inicia sem variável de
|
|
24
|
+
token obrigatória.
|
|
25
|
+
|
|
26
|
+
## [0.71.0] — 2026-08-17
|
|
27
|
+
|
|
28
|
+
### Added
|
|
29
|
+
|
|
30
|
+
- **Painel web local do Observer.** O servidor agora entrega uma interface read-only no navegador
|
|
31
|
+
para consultar projetos, saúde, sessões, changes e snapshots sanitizados da última captura. A interface é empacotada no
|
|
32
|
+
npm e na imagem Docker, exige o token local para consultar `/v1`, mantém o token somente no
|
|
33
|
+
`sessionStorage` da aba e
|
|
34
|
+
não amplia o contrato de dados sanitizados.
|
|
35
|
+
|
|
36
|
+
## [0.70.0] — 2026-08-17
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- **Observer local multi-projeto.** O WendKeep agora expõe snapshots sanitizados, ingestão HTTP
|
|
41
|
+
loopback, índice append-only reconstruível, CLI `observer`, outbox fail-open nos hooks e um
|
|
42
|
+
compose Docker que persiste somente a projeção; os vaults locais continuam sendo a autoridade.
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
|
|
46
|
+
- **Modelos research preview agora são distinguidos de modelos desconhecidos.** O Spark é
|
|
47
|
+
reconhecido sem preço inventado, o `doctor` mantém o custo não estimado e a cobertura de
|
|
48
|
+
preços passa a ser validada por sensor crítico.
|
|
49
|
+
|
|
7
50
|
## [0.69.0] — 2026-08-16
|
|
8
51
|
|
|
9
52
|
### Added
|
package/README.en.md
CHANGED
|
@@ -78,16 +78,17 @@ npx wendkeep import # backfill past Claude + Codex sess
|
|
|
78
78
|
|
|
79
79
|
## The problem: the context dies when the window closes
|
|
80
80
|
|
|
81
|
-
Decisions, dead ends, the reason you chose X over Y — gone next session. The pieces to fix that exist but are scattered (qmd‑sessions, memsearch, Nexus, hand‑written hooks). wendkeep ships
|
|
81
|
+
Decisions, dead ends, the reason you chose X over Y — gone next session. The pieces to fix that exist but are scattered (qmd‑sessions, memsearch, Nexus, hand‑written hooks). wendkeep ships local capture plus an optional Docker Observer that keeps complete memory browsable without depending on Obsidian.
|
|
82
82
|
|
|
83
83
|
| | |
|
|
84
84
|
|---|---|
|
|
85
85
|
| **Capture** — every turn, on disk | `SessionStart` / `Stop` hooks write each session to a dated Markdown note: prompts, iterations, files touched, wikilinks. |
|
|
86
86
|
| **Derive** — decisions, bugs, learnings | Pulled from the transcript into their own notes, backlinked to the session. Your history becomes navigable, not archival. |
|
|
87
87
|
| **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY`, with explicit budgets, are injected on `startup`, `/clear`, and `/compact`; `DIGEST` remains a deep-recall index and legacy fallback. |
|
|
88
|
-
| **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault. |
|
|
88
|
+
| **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault; research previews without a final rate remain unestimated. |
|
|
89
89
|
| **Multi‑agent** — one vault, both agents | `init` wires the session hooks into `.claude/settings.json` *and* `.codex/hooks.json`, and every note is tagged with the agent that wrote it: Claude Code is detected from its environment, anything else is recorded as Codex. One shared graph, whichever agent you are in. |
|
|
90
90
|
| **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. An optional MCP server (`@bitbonsai/mcpvault`) lets the agent read/write the vault. |
|
|
91
|
+
| **Local Observer** — many projects, one view | `wendkeep observer` keeps snapshots plus a complete copy of sessions, decisions, bugs, learnings, specs, and changes in the Docker volume; the read-only dashboard opens directly at `http://127.0.0.1:8787/`, local mode has no token, and unavailable hooks use an outbox without blocking the session. |
|
|
91
92
|
|
|
92
93
|
## Requirements
|
|
93
94
|
|
|
@@ -110,7 +111,7 @@ npx wendkeep init
|
|
|
110
111
|
|
|
111
112
|
1. Create the vault folder taxonomy and a templated `README.md` (default vault: `<project>/.<project-name>-vault`, e.g. `.MyApp-vault`; override with `--vault`).
|
|
112
113
|
2. Write a provider-neutral **`.wendkeep.json`** binding at the project root and a matching `.brain/PROJECT.json` marker in the vault, then merge the session hooks into **`.claude/settings.json`**. The binding is provider-neutral by design: any agent resolves the same vault from its session `cwd`, with no machine-global environment variable. Older registrations already in `.claude/settings.json` are adopted automatically.
|
|
113
|
-
3. Wire the Codex hooks in **`.codex/hooks.json`** —
|
|
114
|
+
3. Wire the Codex hooks in **`.codex/hooks.json`** — ten compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `change-context` on `UserPromptSubmit`, `session-stop` + `observer-publish` + `change-nag` on `Stop`, `subagent-stop` on `SubagentStop`, and `change-guard` on `PreToolUse` for `Bash`, `exec_command`, `apply_patch`, and mutable MCP tools, always in the `npx wendkeep hook <name>` form. `observer-publish` only publishes a sanitized, fail-open projection; it does not replace the local lifecycle. The guard accepts object, raw-string, and argv Codex payloads; before a mutation it compares the session with the project, Git root, remote, branch, and worktree, denying missing or divergent targets. The other four stay out because Codex offers no equivalent payload, tool, or event: `change-warn` (no reliable `tool_input.file_path`), `plan-capture` (no `ExitPlanMode`), `decision-capture` (`AskUserQuestion` is Claude-only), and `task-log` (`TaskCompleted` is not in Codex's event enum). Codex scope blocks use `permissionDecision: "deny"`; `ask` is never emitted in `PreToolUse`. The merge remains non-destructive, preserves third-party hooks, and migrates legacy `timeout` to `timeoutSec`. **Codex enumerates every hook as untrusted and runs none until you approve the “Hooks need review” prompt at startup — `init` cannot pre-approve them**.
|
|
114
115
|
4. Add the **`wendkeep-vault`** MCP server to `.mcp.json` so the agent can read/write the vault. Skip with `--no-mcp` — e.g. when the agent already has a vault MCP. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
|
|
115
116
|
5. Offer to pin **companion** plugins/MCP (multi-choice; **none** pre-checked — wendkeep is a neutral harness and presumes no third-party plugin). Each is wired the most agent-agnostic way it supports:
|
|
116
117
|
- **`context-mode`** — context optimizer + FTS5 memory, wired as a Claude Code plugin. It ships its own MCP server, so wendkeep deliberately adds no `.mcp.json` entry (registering both cold-started two servers at once). On non-Claude agents, add the MCP by hand: `npx -y context-mode`.
|
|
@@ -235,6 +236,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
235
236
|
| **Notes and knowledge** | BUG/APR/ADR, repairs, renumbering, lessons, and dashboard | [Notes and knowledge](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/notes-and-knowledge.md) |
|
|
236
237
|
| **Costs and observability** | safe dry-run, tri-state, aggregation, trends, and historical rebuild | [Costs and observability](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/costs-and-observability.md) |
|
|
237
238
|
| **Maintenance and diagnostics** | doctor, frontier/manifest freshness, drift, version, and help | [Maintenance and diagnostics](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/maintenance-and-diagnostics.md) |
|
|
239
|
+
| **Local Observer** | `observer serve`, registration, snapshots, outbox, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) |
|
|
238
240
|
|
|
239
241
|
Operations that deserve step-by-step guidance: [verify and exits 0/1/2](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/verify.md),
|
|
240
242
|
[legacy-memory migration](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory-migration.md), and
|
package/README.md
CHANGED
|
@@ -78,16 +78,17 @@ npx wendkeep import # backfill past Claude + Codex sess
|
|
|
78
78
|
|
|
79
79
|
## The problem: the context dies when the window closes
|
|
80
80
|
|
|
81
|
-
Decisions, dead ends, the reason you chose X over Y — gone next session. The pieces to fix that exist but are scattered (qmd‑sessions, memsearch, Nexus, hand‑written hooks). wendkeep ships
|
|
81
|
+
Decisions, dead ends, the reason you chose X over Y — gone next session. The pieces to fix that exist but are scattered (qmd‑sessions, memsearch, Nexus, hand‑written hooks). wendkeep ships local capture plus an optional Docker Observer that keeps complete memory browsable without depending on Obsidian.
|
|
82
82
|
|
|
83
83
|
| | |
|
|
84
84
|
|---|---|
|
|
85
85
|
| **Capture** — every turn, on disk | `SessionStart` / `Stop` hooks write each session to a dated Markdown note: prompts, iterations, files touched, wikilinks. |
|
|
86
86
|
| **Derive** — decisions, bugs, learnings | Pulled from the transcript into their own notes, backlinked to the session. Your history becomes navigable, not archival. |
|
|
87
87
|
| **Recall** — injected back | Canonical `CORE` + operational `SHARED_MEMORY`, with explicit budgets, are injected on `startup`, `/clear`, and `/compact`; `DIGEST` remains a deep-recall index and legacy fallback. |
|
|
88
|
-
| **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault. |
|
|
88
|
+
| **Cost** — what it all cost | Per‑model, cache‑aware token pricing per session — plus `cost --trend` with a run‑rate projection across the whole vault; research previews without a final rate remain unestimated. |
|
|
89
89
|
| **Multi‑agent** — one vault, both agents | `init` wires the session hooks into `.claude/settings.json` *and* `.codex/hooks.json`, and every note is tagged with the agent that wrote it: Claude Code is detected from its environment, anything else is recorded as Codex. One shared graph, whichever agent you are in. |
|
|
90
90
|
| **Local‑first** — no cloud, no account | Everything is plain Markdown on your disk. An optional MCP server (`@bitbonsai/mcpvault`) lets the agent read/write the vault. |
|
|
91
|
+
| **Local Observer** — many projects, one view | `wendkeep observer` keeps snapshots plus a complete copy of sessions, decisions, bugs, learnings, specs, and changes in the Docker volume; the read-only dashboard opens directly at `http://127.0.0.1:8787/`, local mode has no token, and unavailable hooks use an outbox without blocking the session. |
|
|
91
92
|
|
|
92
93
|
## Requirements
|
|
93
94
|
|
|
@@ -110,7 +111,7 @@ npx wendkeep init
|
|
|
110
111
|
|
|
111
112
|
1. Create the vault folder taxonomy and a templated `README.md` (default vault: `<project>/.<project-name>-vault`, e.g. `.MyApp-vault`; override with `--vault`).
|
|
112
113
|
2. Write a provider-neutral **`.wendkeep.json`** binding at the project root and a matching `.brain/PROJECT.json` marker in the vault, then merge the session hooks into **`.claude/settings.json`**. The binding is provider-neutral by design: any agent resolves the same vault from its session `cwd`, with no machine-global environment variable. Older registrations already in `.claude/settings.json` are adopted automatically.
|
|
113
|
-
3. Wire the Codex hooks in **`.codex/hooks.json`** —
|
|
114
|
+
3. Wire the Codex hooks in **`.codex/hooks.json`** — ten compatible entries: `brain-inject` + `session-start` + `observer-publish` on `SessionStart`, `session-ensure` + `change-context` on `UserPromptSubmit`, `session-stop` + `observer-publish` + `change-nag` on `Stop`, `subagent-stop` on `SubagentStop`, and `change-guard` on `PreToolUse` for `Bash`, `exec_command`, `apply_patch`, and mutable MCP tools, always in the `npx wendkeep hook <name>` form. `observer-publish` only publishes a sanitized, fail-open projection; it does not replace the local lifecycle. The guard accepts object, raw-string, and argv Codex payloads; before a mutation it compares the session with the project, Git root, remote, branch, and worktree, denying missing or divergent targets. The other four stay out because Codex offers no equivalent payload, tool, or event: `change-warn` (no reliable `tool_input.file_path`), `plan-capture` (no `ExitPlanMode`), `decision-capture` (`AskUserQuestion` is Claude-only), and `task-log` (`TaskCompleted` is not in Codex's event enum). Codex scope blocks use `permissionDecision: "deny"`; `ask` is never emitted in `PreToolUse`. The merge remains non-destructive, preserves third-party hooks, and migrates legacy `timeout` to `timeoutSec`. **Codex enumerates every hook as untrusted and runs none until you approve the “Hooks need review” prompt at startup — `init` cannot pre-approve them**.
|
|
114
115
|
4. Add the **`wendkeep-vault`** MCP server to `.mcp.json` so the agent can read/write the vault. Skip with `--no-mcp` — e.g. when the agent already has a vault MCP. (`--no-mcp` skips *only wendkeep's own* MCP; companion MCPs still follow `--companions`.)
|
|
115
116
|
5. Offer to pin **companion** plugins/MCP (multi-choice; **none** pre-checked — wendkeep is a neutral harness and presumes no third-party plugin). Each is wired the most agent-agnostic way it supports:
|
|
116
117
|
- **`context-mode`** — context optimizer + FTS5 memory, wired as a Claude Code plugin. It ships its own MCP server, so wendkeep deliberately adds no `.mcp.json` entry (registering both cold-started two servers at once). On non-Claude agents, add the MCP by hand: `npx -y context-mode`.
|
|
@@ -235,6 +236,7 @@ The README is the map; the guides provide syntax, options, exit codes, examples,
|
|
|
235
236
|
| **Notes and knowledge** | BUG/APR/ADR, repairs, renumbering, lessons, and dashboard | [Notes and knowledge](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/notes-and-knowledge.md) |
|
|
236
237
|
| **Costs and observability** | safe dry-run, tri-state, aggregation, trends, and historical rebuild | [Costs and observability](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/costs-and-observability.md) |
|
|
237
238
|
| **Maintenance and diagnostics** | doctor, frontier/manifest freshness, drift, version, and help | [Maintenance and diagnostics](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/maintenance-and-diagnostics.md) |
|
|
239
|
+
| **Local Observer** | `observer serve`, registration, snapshots, outbox, and multi-project index | [Local Observer](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/observer.md) |
|
|
238
240
|
|
|
239
241
|
Operations that deserve step-by-step guidance: [verify and exits 0/1/2](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/verify.md),
|
|
240
242
|
[legacy-memory migration](https://github.com/rogersialves/wendkeep/blob/main/docs/en/commands/memory-migration.md), and
|
|
@@ -77,6 +77,10 @@ tool runs, it compares the session, project, Git root, remote, branch, and workt
|
|
|
77
77
|
recorded in `SESSION_REGISTRY.json`. Missing, ambiguous, concurrent, or cross-project targets are
|
|
78
78
|
blocked before the tool.
|
|
79
79
|
|
|
80
|
+
The [local Observer](observer.md) is a read-only observability projection: the vault and change
|
|
81
|
+
remain local authorities. Observer queries do not complete, archive, repair, or promote state in a
|
|
82
|
+
vault.
|
|
83
|
+
|
|
80
84
|
Codex blocks with `permissionDecision: "deny"`; `ask` is not a valid `PreToolUse` decision.
|
|
81
85
|
`commit`, `push`, `pull`, `merge`, `publish`, and destructive operations remain separate capabilities,
|
|
82
86
|
including when one command contains multiple actions. Switching projects requires a new explicit
|
|
@@ -19,7 +19,8 @@ projects whose registries are mixed.
|
|
|
19
19
|
|
|
20
20
|
## Prerequisites
|
|
21
21
|
|
|
22
|
-
A consistent registry,
|
|
22
|
+
A consistent registry, a price table for models with published rates, and transcript access for
|
|
23
|
+
rebuilt sessions. A research preview without a final rate must remain explicitly unestimated.
|
|
23
24
|
|
|
24
25
|
## Syntax
|
|
25
26
|
|
|
@@ -64,9 +65,17 @@ returns `complete`, `none`, or `degraded`, plus a frontier, manifest, and saniti
|
|
|
64
65
|
Run and review the dry-run before repeating the same command with `--apply`; a semantically
|
|
65
66
|
identical second apply preserves the note, checkpoint, report, and mtime.
|
|
66
67
|
|
|
68
|
+
## Models without a final rate
|
|
69
|
+
|
|
70
|
+
`doctor` separates a model that is truly missing from the table from a known
|
|
71
|
+
`research-preview` model. The former remains actionable and asks for an update to
|
|
72
|
+
`hooks/pricing.json`; the latter is reported as **final rate not published** and **cost not
|
|
73
|
+
estimated**. Do not copy another model's price into the gap.
|
|
74
|
+
|
|
67
75
|
## Common errors and diagnosis
|
|
68
76
|
|
|
69
|
-
-
|
|
77
|
+
- Unknown model without a price: update the table before accepting totals.
|
|
78
|
+
- Research preview without a final rate: keep the cost unestimated; do not invent a rate.
|
|
70
79
|
- Wrong-provider costs: validate the session identity chain.
|
|
71
80
|
- Missing transcript: do not estimate silently; keep the gap visible.
|
|
72
81
|
- Duplicated parent/subagent/fork totals: verify registry relationships and deduplication.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
# Local Observer
|
|
2
|
+
|
|
3
|
+
**English** · [Português](../../pt-BR/commands/observer.md)
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
The Observer consolidates observability for multiple WendKeep projects in a local service and
|
|
8
|
+
stores a complete copy of the memory published by hooks in the Docker volume. The content can be
|
|
9
|
+
browsed and searched in the container without depending on Obsidian for queries.
|
|
10
|
+
|
|
11
|
+
## When to use
|
|
12
|
+
|
|
13
|
+
Use it to query changes, sessions, decisions, bugs, learnings, specs, brain documents, and health
|
|
14
|
+
across projects through one local memory. During the transition, the vault is preserved as a
|
|
15
|
+
recovery copy; the Observer is authoritative for queries made through its container.
|
|
16
|
+
|
|
17
|
+
## When not to use
|
|
18
|
+
|
|
19
|
+
Do not use the Observer to edit, complete, or archive changes, curate memory, store transcripts,
|
|
20
|
+
or expose the service to the network. Edits still go through local WendKeep hooks.
|
|
21
|
+
|
|
22
|
+
## Prerequisites
|
|
23
|
+
|
|
24
|
+
Initialize projects with WendKeep and explicitly register each project before starting the HTTP
|
|
25
|
+
server. The default local mode has no token to configure.
|
|
26
|
+
|
|
27
|
+
## Syntax
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx wendkeep observer status --data-dir <directory> --json
|
|
31
|
+
npx wendkeep observer register --project <project> --vault <vault> --data-dir <directory>
|
|
32
|
+
npx wendkeep observer publish --project <project> --vault <vault> --data-dir <directory>
|
|
33
|
+
npx wendkeep observer memory import --project <project> --vault <vault> --url http://127.0.0.1:8787 --json
|
|
34
|
+
npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <directory>
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Options and exit codes
|
|
38
|
+
|
|
39
|
+
- `--data-dir` selects the local event and index directory; the default is
|
|
40
|
+
`WENDKEEP_OBSERVER_DATA_DIR` or `~/.wendkeep-observer`.
|
|
41
|
+
- `--project` and `--vault` identify a project for `register`, `publish`, and `memory import`.
|
|
42
|
+
- `--host` accepts only `127.0.0.1`, `localhost`, or `::1`; other hosts are rejected before
|
|
43
|
+
listening.
|
|
44
|
+
- `/v1` is open in the default local mode; keep `--host 127.0.0.1` and do not publish the port on
|
|
45
|
+
a network address.
|
|
46
|
+
- Exit `0` means success; exit `1` means configuration or operation failure; the publisher hook
|
|
47
|
+
also returns `0` when the Observer is unavailable.
|
|
48
|
+
|
|
49
|
+
## Examples
|
|
50
|
+
|
|
51
|
+
```powershell
|
|
52
|
+
npx wendkeep observer register --project C:\GitHub\WendKeep --vault C:\GitHub\WendKeep\.WendKeep-vault --data-dir C:\WendKeepObserver
|
|
53
|
+
npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir C:\WendKeepObserver
|
|
54
|
+
$env:WENDKEEP_OBSERVER_URL = 'http://127.0.0.1:8787'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For local Docker:
|
|
58
|
+
|
|
59
|
+
```powershell
|
|
60
|
+
docker compose -f docker/wendkeep-observer/compose.yaml up -d --build
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Local web dashboard
|
|
64
|
+
|
|
65
|
+
With the server running, open [http://127.0.0.1:8787/](http://127.0.0.1:8787/) in a browser. The
|
|
66
|
+
dashboard is served by the same process and opens directly, without a form or token. Keep the port
|
|
67
|
+
bound to the computer loopback; do not expose this address on a network interface.
|
|
68
|
+
|
|
69
|
+
The dashboard shows the multi-project list, version, health, latest session, active change, change
|
|
70
|
+
count, and last capture time. Opening a project exposes Overview, Sessions, Memory, Changes, and
|
|
71
|
+
Sync screens. Each list opens the complete Markdown document in a read-only reader, with local
|
|
72
|
+
filtering, body search, and a source toggle. Loading, empty, unavailable-server, conflict, and
|
|
73
|
+
stale-data states are visible, with manual refresh and an automatic 15-second refresh.
|
|
74
|
+
|
|
75
|
+
If the browser shows the shell but the list fails, check the service health at
|
|
76
|
+
`http://127.0.0.1:8787/healthz` and confirm that the container is running.
|
|
77
|
+
|
|
78
|
+
## Expected result
|
|
79
|
+
|
|
80
|
+
`register` stores `project_id`, name, version, and registration time. `publish` reads the local
|
|
81
|
+
vault, produces the snapshot, and also sends idempotent events containing the complete content of
|
|
82
|
+
sessions, decisions, bugs, learnings, specs, changes, CORE, DIGEST, SHARED_MEMORY, and brain
|
|
83
|
+
state. The container stores Markdown under `/data/memory` plus `MEMORY_EVENTS.jsonl` and
|
|
84
|
+
`MEMORY_INDEX.json` in the `observer-data` volume; it does not mount `C:\GitHub` or any
|
|
85
|
+
`.WendKeep-vault`. `memory import` performs the initial load and returns file/hash parity.
|
|
86
|
+
|
|
87
|
+
`init` projects `observer-publish` into `SessionStart` and `Stop` after the primary hooks. Without
|
|
88
|
+
`WENDKEEP_OBSERVER_URL`, the hook is a no-op. When the server is stopped, it writes snapshots to
|
|
89
|
+
`.brain/observer-outbox/` and complete memory to `.brain/observer-memory-outbox/` without blocking
|
|
90
|
+
the session; a later run retries both event types.
|
|
91
|
+
|
|
92
|
+
## Common errors and diagnosis
|
|
93
|
+
|
|
94
|
+
- `project_not_registered`: run `observer register` before publishing.
|
|
95
|
+
- `host loopback`: replace `0.0.0.0` or a LAN address with `127.0.0.1`.
|
|
96
|
+
- Pending outbox: the service was unavailable; preserve `.brain/observer-outbox/` and rerun the
|
|
97
|
+
publisher. Do not delete events manually.
|
|
98
|
+
- If memory is incomplete, check the Sync screen, preserve the outbox, and run
|
|
99
|
+
`observer memory import` to rebuild the copy from the vault.
|
|
100
|
+
|
|
101
|
+
## Next steps
|
|
102
|
+
|
|
103
|
+
Read the `local-observer` change for the `OBS-1` through `OBS-8` contract. Do not remove the Docker
|
|
104
|
+
volume with `docker compose down -v` during normal operation because it deletes the local
|
|
105
|
+
projection.
|
|
106
|
+
|
|
107
|
+
## Data authority
|
|
108
|
+
|
|
109
|
+
The container is canonical for Observer queries and stores the complete published content. The
|
|
110
|
+
vault remains preserved locally during migration as a transition and recovery copy; Observer
|
|
111
|
+
screens do not complete, archive, repair, or promote state.
|
|
112
|
+
|
|
113
|
+
## Minimal API
|
|
114
|
+
|
|
115
|
+
- `GET /healthz` — availability without project data.
|
|
116
|
+
- `GET /v1/projects` — projects with an accepted snapshot.
|
|
117
|
+
- `GET /v1/projects/:project_id` — the latest project snapshot.
|
|
118
|
+
- `GET /v1/projects/:project_id/changes` — change summary from the snapshot.
|
|
119
|
+
- `PUT /v1/projects/:project_id` — explicit local registration.
|
|
120
|
+
- `POST /v1/projects/:project_id/snapshot` — idempotent local ingestion.
|
|
121
|
+
- `GET /v1/projects/:project_id/memory/tree` — document tree and metadata.
|
|
122
|
+
- `GET /v1/projects/:project_id/memory/document?path=...` — complete Markdown content.
|
|
123
|
+
- `GET /v1/projects/:project_id/memory/search?q=...` — path and body search.
|
|
124
|
+
- `GET /v1/projects/:project_id/sync` — mode, counts, conflicts, and latest event.
|
|
125
|
+
- `PUT /v1/projects/:project_id/sync` — explicitly changes the local mode.
|
|
126
|
+
- `GET /v1/projects/:project_id/memory/export` — read-only export with complete content.
|
|
127
|
+
- `POST /v1/projects/:project_id/memory/events` — idempotent batch ingestion.
|
|
128
|
+
|
|
129
|
+
The `/v1` routes reject oversized bodies and validate project, path, revision, hash, and
|
|
130
|
+
isolation before writing content to the volume.
|
|
@@ -77,6 +77,10 @@ uma ferramenta de escrita suportada, ele compara sessão, projeto, raiz Git, rem
|
|
|
77
77
|
worktree com a lease registrada no `SESSION_REGISTRY.json`. Um alvo ausente, ambíguo, concorrente ou
|
|
78
78
|
fora do projeto é bloqueado antes da ferramenta.
|
|
79
79
|
|
|
80
|
+
O [Observer local](observer.md) é uma projeção read-only da observabilidade: o vault e a change
|
|
81
|
+
continuam autoridades locais. Consultas do Observer não concluem, arquivam, reparam ou promovem
|
|
82
|
+
estado no vault.
|
|
83
|
+
|
|
80
84
|
No Codex o bloqueio usa `permissionDecision: "deny"`; `ask` não é uma decisão válida de
|
|
81
85
|
`PreToolUse`. `commit`, `push`, `pull`, `merge`, `publish` e operações destrutivas continuam
|
|
82
86
|
capacidades separadas, inclusive quando um comando contém mais de uma ação. A troca de projeto
|
|
@@ -19,7 +19,9 @@ projetos com registries misturados.
|
|
|
19
19
|
|
|
20
20
|
## Pré-requisitos
|
|
21
21
|
|
|
22
|
-
Registry consistente, tabela de preços
|
|
22
|
+
Registry consistente, tabela de preços para os modelos com tarifa publicada e acesso aos transcripts
|
|
23
|
+
das sessões reconstruídas. Um research preview sem tarifa final deve permanecer explicitamente
|
|
24
|
+
como custo não estimado.
|
|
23
25
|
|
|
24
26
|
## Sintaxe
|
|
25
27
|
|
|
@@ -64,9 +66,17 @@ tri-state devolve `complete`, `none` ou `degraded`, mais frontier, manifest e di
|
|
|
64
66
|
sanitizados. Rode e revise o dry-run antes de repetir o mesmo comando com `--apply`; uma segunda
|
|
65
67
|
aplicação semanticamente idêntica preserva nota, checkpoint, relatório e mtime.
|
|
66
68
|
|
|
69
|
+
## Modelos sem tarifa final
|
|
70
|
+
|
|
71
|
+
O `doctor` separa um modelo realmente ausente da tabela de um modelo conhecido em
|
|
72
|
+
`research-preview`. O primeiro continua acionável e pede atualização de
|
|
73
|
+
`hooks/pricing.json`; o segundo aparece como **tarifa final não publicada** e **custo não
|
|
74
|
+
estimado**. Não copie o preço de outro modelo para preencher essa lacuna.
|
|
75
|
+
|
|
67
76
|
## Erros comuns e diagnóstico
|
|
68
77
|
|
|
69
|
-
- Modelo sem preço: atualize a tabela antes de aceitar o total.
|
|
78
|
+
- Modelo desconhecido sem preço: atualize a tabela antes de aceitar o total.
|
|
79
|
+
- Research preview sem tarifa final: mantenha o custo não estimado; não invente uma tarifa.
|
|
70
80
|
- Custos de provider errado: valide a cadeia de identidade da sessão.
|
|
71
81
|
- Transcript ausente: não estime silenciosamente; mantenha a lacuna visível.
|
|
72
82
|
- Total duplicado por subagent/fork: confirme relação pai/subagent e deduplicação do registry.
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Observer local
|
|
2
|
+
|
|
3
|
+
**PT-BR** · [English](../../en/commands/observer.md)
|
|
4
|
+
|
|
5
|
+
## Objetivo
|
|
6
|
+
|
|
7
|
+
O Observer consolida a observabilidade de vários projetos WendKeep em um serviço local e grava no
|
|
8
|
+
volume Docker uma cópia integral da memória publicada pelos hooks. O conteúdo fica disponível
|
|
9
|
+
para navegação e busca no próprio container, sem depender do Obsidian para consulta.
|
|
10
|
+
|
|
11
|
+
## Quando usar
|
|
12
|
+
|
|
13
|
+
Use para consultar changes, sessões, decisões, bugs, aprendizados, specs, documentos do brain e
|
|
14
|
+
saúde de vários projetos em uma única memória local. Durante a transição, o vault continua sendo
|
|
15
|
+
preservado como cópia de origem para recuperação; o Observer é a autoridade de consulta do seu
|
|
16
|
+
container.
|
|
17
|
+
|
|
18
|
+
## Quando não usar
|
|
19
|
+
|
|
20
|
+
Não use o Observer para editar, concluir ou arquivar changes, curar memória, armazenar transcripts
|
|
21
|
+
ou expor o serviço na rede. As edições continuam passando pelos hooks e pelo WendKeep local.
|
|
22
|
+
|
|
23
|
+
## Pré-requisitos
|
|
24
|
+
|
|
25
|
+
Tenha os projetos inicializados com WendKeep e registre explicitamente cada projeto antes de
|
|
26
|
+
iniciar o servidor HTTP. No modo local padrão não há token para configurar.
|
|
27
|
+
|
|
28
|
+
## Sintaxe
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
npx wendkeep observer status --data-dir <diretório> --json
|
|
32
|
+
npx wendkeep observer register --project <projeto> --vault <vault> --data-dir <diretório>
|
|
33
|
+
npx wendkeep observer publish --project <projeto> --vault <vault> --data-dir <diretório>
|
|
34
|
+
npx wendkeep observer memory import --project <projeto> --vault <vault> --url http://127.0.0.1:8787 --json
|
|
35
|
+
npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir <diretório>
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
## Opções e códigos de saída
|
|
39
|
+
|
|
40
|
+
- `--data-dir` escolhe o diretório local de eventos e índice; o padrão é
|
|
41
|
+
`WENDKEEP_OBSERVER_DATA_DIR` ou `~/.wendkeep-observer`.
|
|
42
|
+
- `--project` e `--vault` identificam o projeto nos comandos `register`, `publish` e `memory import`.
|
|
43
|
+
- `--host` aceita somente `127.0.0.1`, `localhost` ou `::1`; outros hosts são recusados antes do
|
|
44
|
+
listen.
|
|
45
|
+
- as rotas `/v1` ficam abertas no modo local padrão; mantenha `--host 127.0.0.1` e não publique a
|
|
46
|
+
porta em um endereço de rede.
|
|
47
|
+
- Exit `0` indica sucesso; exit `1` indica falha de configuração ou operação; o hook publisher
|
|
48
|
+
também retorna `0` quando o Observer está indisponível.
|
|
49
|
+
|
|
50
|
+
## Exemplos
|
|
51
|
+
|
|
52
|
+
```powershell
|
|
53
|
+
npx wendkeep observer register --project C:\GitHub\WendKeep --vault C:\GitHub\WendKeep\.WendKeep-vault --data-dir C:\WendKeepObserver
|
|
54
|
+
npx wendkeep observer serve --host 127.0.0.1 --port 8787 --data-dir C:\WendKeepObserver
|
|
55
|
+
$env:WENDKEEP_OBSERVER_URL = 'http://127.0.0.1:8787'
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Para Docker local:
|
|
59
|
+
|
|
60
|
+
```powershell
|
|
61
|
+
docker compose -f docker/wendkeep-observer/compose.yaml up -d --build
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Painel web local
|
|
65
|
+
|
|
66
|
+
Com o servidor em execução, abra [http://127.0.0.1:8787/](http://127.0.0.1:8787/) no navegador.
|
|
67
|
+
O painel é servido pelo mesmo processo e abre diretamente, sem formulário ou token. A porta fica
|
|
68
|
+
presa ao loopback do computador; não coloque o endereço em uma interface de rede.
|
|
69
|
+
|
|
70
|
+
O painel mostra a lista multi-projeto, versão, saúde, sessão mais recente, change ativa, contagem
|
|
71
|
+
de changes e data da última captura. Ao abrir um projeto, o workspace oferece as telas Overview,
|
|
72
|
+
Sessões, Memória, Changes e Sincronização. Cada lista abre o documento Markdown completo em um
|
|
73
|
+
leitor read-only, com filtro local, busca no corpo e alternância para a fonte. Os estados de
|
|
74
|
+
carregamento, vazio, servidor indisponível, conflito e dados desatualizados ficam visíveis, e a
|
|
75
|
+
atualização pode ser manual ou automática a cada 15 segundos.
|
|
76
|
+
|
|
77
|
+
Se o navegador mostrar a tela mas a lista falhar, confirme a saúde em
|
|
78
|
+
`http://127.0.0.1:8787/healthz` e verifique se o container está em execução.
|
|
79
|
+
|
|
80
|
+
## Resultado esperado
|
|
81
|
+
|
|
82
|
+
`register` grava `project_id`, nome, versão e data de registro. `publish` lê o vault local,
|
|
83
|
+
produz o snapshot e também envia eventos idempotentes com o conteúdo integral das sessões,
|
|
84
|
+
decisões, bugs, aprendizados, specs, changes, CORE, DIGEST, SHARED_MEMORY e estado do brain. O
|
|
85
|
+
container grava os Markdown em `/data/memory` e mantém `MEMORY_EVENTS.jsonl` e
|
|
86
|
+
`MEMORY_INDEX.json` no volume `observer-data`; não monta `C:\GitHub` nem qualquer
|
|
87
|
+
`.WendKeep-vault`. `memory import` faz a carga inicial e retorna a paridade por arquivo e hash.
|
|
88
|
+
|
|
89
|
+
O `init` projeta `observer-publish` para `SessionStart` e `Stop` depois dos hooks principais. Sem
|
|
90
|
+
`WENDKEEP_OBSERVER_URL`, o hook é no-op. Com o servidor parado, ele grava os snapshots em
|
|
91
|
+
`.brain/observer-outbox/` e a memória integral em `.brain/observer-memory-outbox/`, sem bloquear a
|
|
92
|
+
sessão; uma execução posterior tenta reenviar os dois tipos de evento.
|
|
93
|
+
|
|
94
|
+
## Erros comuns e diagnóstico
|
|
95
|
+
|
|
96
|
+
- `project_not_registered`: rode `observer register` antes de publicar.
|
|
97
|
+
- `host loopback`: troque `0.0.0.0` ou endereço LAN por `127.0.0.1`.
|
|
98
|
+
- Outbox pendente: o serviço estava indisponível; preserve `.brain/observer-outbox/` e repita o
|
|
99
|
+
publisher. Não apague eventos manualmente.
|
|
100
|
+
- Se a memória ficar incompleta, verifique a tela Sincronização, preserve o outbox e rode
|
|
101
|
+
`observer memory import` para reconstruir a cópia a partir do vault.
|
|
102
|
+
|
|
103
|
+
## Próximos passos
|
|
104
|
+
|
|
105
|
+
Leia a change `local-observer` para o contrato `OBS-1` a `OBS-8`. O volume Docker não deve ser
|
|
106
|
+
removido com `docker compose down -v` durante a operação normal, pois isso apaga a projeção local.
|
|
107
|
+
|
|
108
|
+
## Autoridade dos dados
|
|
109
|
+
|
|
110
|
+
O container é a memória canônica para consultas do Observer e guarda o conteúdo integral
|
|
111
|
+
publicado. O vault continua preservado localmente durante a migração como cópia de transição e
|
|
112
|
+
fonte de recuperação; as telas do Observer não concluem, arquivam, reparam ou promovem estado.
|
|
113
|
+
|
|
114
|
+
## API mínima
|
|
115
|
+
|
|
116
|
+
- `GET /healthz` — disponibilidade sem dados de projeto.
|
|
117
|
+
- `GET /v1/projects` — projetos com snapshot aceito.
|
|
118
|
+
- `GET /v1/projects/:project_id` — último snapshot do projeto.
|
|
119
|
+
- `GET /v1/projects/:project_id/changes` — resumo das changes do snapshot.
|
|
120
|
+
- `PUT /v1/projects/:project_id` — registro explícito local.
|
|
121
|
+
- `POST /v1/projects/:project_id/snapshot` — ingestão local idempotente.
|
|
122
|
+
- `GET /v1/projects/:project_id/memory/tree` — árvore e metadados dos documentos.
|
|
123
|
+
- `GET /v1/projects/:project_id/memory/document?path=...` — conteúdo Markdown integral.
|
|
124
|
+
- `GET /v1/projects/:project_id/memory/search?q=...` — busca no caminho e no corpo.
|
|
125
|
+
- `GET /v1/projects/:project_id/sync` — modo, contagem, conflitos e último evento.
|
|
126
|
+
- `PUT /v1/projects/:project_id/sync` — altera explicitamente o modo local.
|
|
127
|
+
- `GET /v1/projects/:project_id/memory/export` — exportação read-only com conteúdo completo.
|
|
128
|
+
- `POST /v1/projects/:project_id/memory/events` — ingestão idempotente em lote.
|
|
129
|
+
|
|
130
|
+
As rotas `/v1` rejeitam corpo acima do limite e validam projeto, caminho, revisão, hash e
|
|
131
|
+
isolamento antes de gravar o conteúdo no volume.
|
package/hooks/harness-doctor.mjs
CHANGED
|
@@ -212,9 +212,11 @@ export function checkStackedFrontmatter(vaultBase) {
|
|
|
212
212
|
}
|
|
213
213
|
|
|
214
214
|
// Um modelo fora de `pricing.json` faz `priceForModel` devolver null e a parcela dele do custo
|
|
215
|
-
// virar zero — sem erro, sem aviso.
|
|
216
|
-
//
|
|
217
|
-
//
|
|
215
|
+
// virar zero — sem erro, sem aviso. Modelos conhecidos sem tarifa final (por exemplo, um
|
|
216
|
+
// research preview) ficam na tabela com status explícito e são reportados separadamente: isso
|
|
217
|
+
// evita tanto o silêncio quanto a sugestão de inventar um preço. A checagem é sobre o vault, não
|
|
218
|
+
// sobre o caminho de cálculo: o cálculo roda em hook a cada turno, onde avisar viraria ruído e
|
|
219
|
+
// lançar derrubaria a captura da sessão.
|
|
218
220
|
//
|
|
219
221
|
// Cada modelo citado na nota é consultado direto em `priceForModel` — NÃO se infere pelo
|
|
220
222
|
// sintoma "custo zerado". Numa sessão multi-modelo (`modelo: "claude-opus-4.8 + claude-opus-5"`)
|
|
@@ -222,6 +224,7 @@ export function checkStackedFrontmatter(vaultBase) {
|
|
|
222
224
|
// motivou esta change, a nota fecha com $415 e a fatia do Opus 5 é a única zerada.
|
|
223
225
|
export function checkUnpricedModels(vaultBase) {
|
|
224
226
|
const counts = new Map();
|
|
227
|
+
const researchPreview = new Map();
|
|
225
228
|
|
|
226
229
|
const modelsOf = (frontmatter) => {
|
|
227
230
|
// `modelos:` é a lista canônica; `modelo:` é o rótulo agregado (junta com " + ").
|
|
@@ -247,23 +250,34 @@ export function checkUnpricedModels(vaultBase) {
|
|
|
247
250
|
for (const raw of modelsOf(fm[1])) {
|
|
248
251
|
const model = raw.trim().replace(/^["']|["']$/g, '');
|
|
249
252
|
if (!model || model === 'unknown') continue;
|
|
250
|
-
|
|
251
|
-
|
|
253
|
+
const price = priceForModel(model);
|
|
254
|
+
if (price?.pricingStatus === 'research-preview') {
|
|
255
|
+
researchPreview.set(model, (researchPreview.get(model) || 0) + 1);
|
|
256
|
+
} else if (!price) {
|
|
257
|
+
counts.set(model, (counts.get(model) || 0) + 1);
|
|
258
|
+
}
|
|
252
259
|
}
|
|
253
260
|
}
|
|
254
261
|
};
|
|
255
262
|
|
|
256
263
|
walk(join(vaultBase, '02-Sessões'));
|
|
257
|
-
return {
|
|
264
|
+
return {
|
|
265
|
+
models: [...counts].map(([model, notes]) => ({ model, notes })),
|
|
266
|
+
researchPreview: [...researchPreview].map(([model, notes]) => ({ model, notes })),
|
|
267
|
+
};
|
|
258
268
|
}
|
|
259
269
|
|
|
260
270
|
export function renderUnpricedModelLines(unpriced) {
|
|
271
|
+
const preview = unpriced.researchPreview || [];
|
|
261
272
|
const lines = [`[preços] ${unpriced.models.length} modelo(s) sem preço na tabela`];
|
|
262
273
|
for (const { model, notes } of unpriced.models) {
|
|
263
274
|
lines.push(` ✗ ${model} (${notes} nota(s) com custo zerado)`);
|
|
264
275
|
}
|
|
265
276
|
if (unpriced.models.length) lines.push(' → adicione o modelo em hooks/pricing.json');
|
|
266
|
-
else lines.push(' tabela de preços completa ✓');
|
|
277
|
+
else if (!preview.length) lines.push(' tabela de preços completa ✓');
|
|
278
|
+
for (const { model, notes } of preview) {
|
|
279
|
+
lines.push(` ! ${model} (${notes} nota(s)): research preview sem tarifa final; custo não estimado`);
|
|
280
|
+
}
|
|
267
281
|
return lines;
|
|
268
282
|
}
|
|
269
283
|
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { pathToFileURL } from 'node:url';
|
|
3
|
+
import { debugLog, readHookInput, resolveVault } from './obsidian-common.mjs';
|
|
4
|
+
import { publishObserverSnapshot } from '../src/observer-publish.mjs';
|
|
5
|
+
|
|
6
|
+
async function main() {
|
|
7
|
+
const input = readHookInput();
|
|
8
|
+
const resolved = resolveVault(input);
|
|
9
|
+
const result = await publishObserverSnapshot({
|
|
10
|
+
vaultBase: resolved.base,
|
|
11
|
+
projectRoot: resolved.projectRoot,
|
|
12
|
+
});
|
|
13
|
+
if (!result.ok && result.error) debugLog('Observer publish fail-open:', result.error);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
|
17
|
+
main().catch((error) => {
|
|
18
|
+
debugLog('Observer hook falhou de forma fail-open:', error);
|
|
19
|
+
process.exitCode = 0;
|
|
20
|
+
});
|
|
21
|
+
}
|
package/hooks/pricing.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"_nota": "Preços API por milhão de tokens. cachedInput = cache read. Cache write aplica multiplicador no código: 5m = 1.25x input, 1h = 2x input. Editar aqui quando o provedor mudar preços (sem mexer no .mjs). Se o arquivo sumir ou ficar inválido, o hook usa a tabela embutida em token-usage.mjs.",
|
|
3
|
-
"_fonte": "OpenAI https://openai.com/index/gpt-5-6/ e https://help.openai.com/en/articles/
|
|
3
|
+
"_fonte": "OpenAI https://openai.com/index/gpt-5-6/, https://openai.com/index/introducing-gpt-5-3-codex-spark/ e https://help.openai.com/en/articles/20001106-codex-rate-card; Anthropic https://www.anthropic.com/pricing — conferido 2026-08-16",
|
|
4
4
|
"models": {
|
|
5
5
|
"gpt-5.6-sol": { "label": "GPT-5.6 Sol API", "provider": "openai", "input": 5, "cachedInput": 0.5, "output": 30 },
|
|
6
6
|
"gpt-5.6-terra": { "label": "GPT-5.6 Terra API", "provider": "openai", "input": 2.5, "cachedInput": 0.25, "output": 15 },
|
|
@@ -12,6 +12,15 @@
|
|
|
12
12
|
"cachedInput": 0.5,
|
|
13
13
|
"output": 30
|
|
14
14
|
},
|
|
15
|
+
"gpt-5.3-codex-spark": {
|
|
16
|
+
"label": "GPT-5.3-Codex-Spark (research preview)",
|
|
17
|
+
"provider": "openai",
|
|
18
|
+
"pricingStatus": "research-preview",
|
|
19
|
+
"pricingNote": "Tarifa final não publicada; custo não estimado.",
|
|
20
|
+
"input": null,
|
|
21
|
+
"cachedInput": null,
|
|
22
|
+
"output": null
|
|
23
|
+
},
|
|
15
24
|
"claude-opus-4.7": {
|
|
16
25
|
"label": "Claude Opus 4.7 API",
|
|
17
26
|
"provider": "anthropic",
|
package/hooks/token-usage.mjs
CHANGED
|
@@ -30,6 +30,15 @@ const DEFAULT_PRICE_REFERENCE = {
|
|
|
30
30
|
'gpt-5.6-sol': { label: 'GPT-5.6 Sol API', provider: 'openai', input: 5, cachedInput: 0.5, output: 30 },
|
|
31
31
|
'gpt-5.6-terra': { label: 'GPT-5.6 Terra API', provider: 'openai', input: 2.5, cachedInput: 0.25, output: 15 },
|
|
32
32
|
'gpt-5.6-luna': { label: 'GPT-5.6 Luna API', provider: 'openai', input: 1, cachedInput: 0.1, output: 6 },
|
|
33
|
+
'gpt-5.3-codex-spark': {
|
|
34
|
+
label: 'GPT-5.3-Codex-Spark (research preview)',
|
|
35
|
+
provider: 'openai',
|
|
36
|
+
pricingStatus: 'research-preview',
|
|
37
|
+
pricingNote: 'Tarifa final não publicada; custo não estimado.',
|
|
38
|
+
input: null,
|
|
39
|
+
cachedInput: null,
|
|
40
|
+
output: null,
|
|
41
|
+
},
|
|
33
42
|
'gpt-5.5': {
|
|
34
43
|
label: 'GPT-5.5 API',
|
|
35
44
|
provider: 'openai',
|
|
@@ -122,6 +131,10 @@ const MODEL_ALIASES = {
|
|
|
122
131
|
'gpt-5.3-codex': 'gpt-5.5',
|
|
123
132
|
'gpt-5.3': 'gpt-5.5',
|
|
124
133
|
'openai/gpt-5.4': 'gpt-5.5',
|
|
134
|
+
'gpt-5.3-codex-spark': 'gpt-5.3-codex-spark',
|
|
135
|
+
'gpt-5-3-codex-spark': 'gpt-5.3-codex-spark',
|
|
136
|
+
'openai/gpt-5.3-codex-spark': 'gpt-5.3-codex-spark',
|
|
137
|
+
'openai/gpt-5-3-codex-spark': 'gpt-5.3-codex-spark',
|
|
125
138
|
'claude-opus-4.7': 'claude-opus-4.7',
|
|
126
139
|
'claude-opus-4-7': 'claude-opus-4.7',
|
|
127
140
|
'anthropic/claude-opus-4.7': 'claude-opus-4.7',
|