@flyingrobots/graft 0.8.0 → 0.9.0
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 +62 -0
- package/GUIDE.md +8 -3
- package/README.md +126 -100
- package/dist/adapters/fake-echo-kernel-transport.d.ts +33 -0
- package/dist/adapters/fake-echo-kernel-transport.d.ts.map +1 -0
- package/dist/adapters/fake-echo-kernel-transport.js +208 -0
- package/dist/adapters/fake-echo-kernel-transport.js.map +1 -0
- package/dist/cli/structural-blame-render.d.ts.map +1 -1
- package/dist/cli/structural-blame-render.js +4 -1
- package/dist/cli/structural-blame-render.js.map +1 -1
- package/dist/contracts/capabilities.d.ts +2 -2
- package/dist/contracts/capabilities.d.ts.map +1 -1
- package/dist/contracts/capabilities.js +14 -0
- package/dist/contracts/capabilities.js.map +1 -1
- package/dist/contracts/output-schema-cli.d.ts +3 -0
- package/dist/contracts/output-schema-cli.d.ts.map +1 -1
- package/dist/contracts/output-schema-fragments.d.ts +162 -0
- package/dist/contracts/output-schema-fragments.d.ts.map +1 -1
- package/dist/contracts/output-schema-fragments.js +27 -0
- package/dist/contracts/output-schema-fragments.js.map +1 -1
- package/dist/contracts/output-schema-mcp.d.ts +84 -0
- package/dist/contracts/output-schema-mcp.d.ts.map +1 -1
- package/dist/contracts/output-schema-mcp.js +6 -1
- package/dist/contracts/output-schema-mcp.js.map +1 -1
- package/dist/contracts/output-schema-meta.d.ts +1 -1
- package/dist/contracts/output-schema-meta.d.ts.map +1 -1
- package/dist/contracts/output-schemas.d.ts.map +1 -1
- package/dist/contracts/output-schemas.js +32 -0
- package/dist/contracts/output-schemas.js.map +1 -1
- package/dist/echo/canonical-cbor.d.ts +10 -0
- package/dist/echo/canonical-cbor.d.ts.map +1 -0
- package/dist/echo/canonical-cbor.js +213 -0
- package/dist/echo/canonical-cbor.js.map +1 -0
- package/dist/echo/codec-runtime.d.ts +72 -0
- package/dist/echo/codec-runtime.d.ts.map +1 -0
- package/dist/echo/codec-runtime.js +259 -0
- package/dist/echo/codec-runtime.js.map +1 -0
- package/dist/echo/structural-history-client.d.ts +68 -0
- package/dist/echo/structural-history-client.d.ts.map +1 -0
- package/dist/echo/structural-history-client.js +149 -0
- package/dist/echo/structural-history-client.js.map +1 -0
- package/dist/echo/structural-history-envelope-codec.d.ts +46 -0
- package/dist/echo/structural-history-envelope-codec.d.ts.map +1 -0
- package/dist/echo/structural-history-envelope-codec.js +121 -0
- package/dist/echo/structural-history-envelope-codec.js.map +1 -0
- package/dist/echo/structural-reading-adapter.d.ts +13 -0
- package/dist/echo/structural-reading-adapter.d.ts.map +1 -0
- package/dist/echo/structural-reading-adapter.js +120 -0
- package/dist/echo/structural-reading-adapter.js.map +1 -0
- package/dist/generated/graft-structural-history.codec.generated.d.ts +135 -0
- package/dist/generated/graft-structural-history.codec.generated.d.ts.map +1 -0
- package/dist/generated/graft-structural-history.codec.generated.js +545 -0
- package/dist/generated/graft-structural-history.codec.generated.js.map +1 -0
- package/dist/generated/graft-structural-history.d.ts +331 -0
- package/dist/generated/graft-structural-history.d.ts.map +1 -0
- package/dist/generated/graft-structural-history.js +47 -0
- package/dist/generated/graft-structural-history.js.map +1 -0
- package/dist/mcp/burden.d.ts.map +1 -1
- package/dist/mcp/burden.js +2 -0
- package/dist/mcp/burden.js.map +1 -1
- package/dist/mcp/context.d.ts +5 -1
- package/dist/mcp/context.d.ts.map +1 -1
- package/dist/mcp/context.js +11 -1
- package/dist/mcp/context.js.map +1 -1
- package/dist/mcp/repo-tool-worker-context.d.ts.map +1 -1
- package/dist/mcp/repo-tool-worker-context.js +19 -0
- package/dist/mcp/repo-tool-worker-context.js.map +1 -1
- package/dist/mcp/server-context.d.ts.map +1 -1
- package/dist/mcp/server-context.js +17 -0
- package/dist/mcp/server-context.js.map +1 -1
- package/dist/mcp/server-tool-access.d.ts.map +1 -1
- package/dist/mcp/server-tool-access.js +4 -0
- package/dist/mcp/server-tool-access.js.map +1 -1
- package/dist/mcp/tool-registry.d.ts.map +1 -1
- package/dist/mcp/tool-registry.js +5 -1
- package/dist/mcp/tool-registry.js.map +1 -1
- package/dist/mcp/tools/dead-symbols.d.ts.map +1 -1
- package/dist/mcp/tools/dead-symbols.js +2 -3
- package/dist/mcp/tools/dead-symbols.js.map +1 -1
- package/dist/mcp/tools/structural-blame.d.ts.map +1 -1
- package/dist/mcp/tools/structural-blame.js +3 -0
- package/dist/mcp/tools/structural-blame.js.map +1 -1
- package/dist/mcp/tools/structural-review.d.ts.map +1 -1
- package/dist/mcp/tools/structural-review.js +9 -22
- package/dist/mcp/tools/structural-review.js.map +1 -1
- package/dist/mcp/tools/workspace-list-opened.d.ts +3 -0
- package/dist/mcp/tools/workspace-list-opened.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-list-opened.js +10 -0
- package/dist/mcp/tools/workspace-list-opened.js.map +1 -0
- package/dist/mcp/tools/workspace-open.d.ts +3 -0
- package/dist/mcp/tools/workspace-open.d.ts.map +1 -0
- package/dist/mcp/tools/workspace-open.js +34 -0
- package/dist/mcp/tools/workspace-open.js.map +1 -0
- package/dist/mcp/workspace-router-model.d.ts +27 -0
- package/dist/mcp/workspace-router-model.d.ts.map +1 -1
- package/dist/mcp/workspace-router-model.js.map +1 -1
- package/dist/mcp/workspace-router.d.ts +9 -2
- package/dist/mcp/workspace-router.d.ts.map +1 -1
- package/dist/mcp/workspace-router.js +145 -1
- package/dist/mcp/workspace-router.js.map +1 -1
- package/dist/ports/echo-kernel-transport.d.ts +12 -0
- package/dist/ports/echo-kernel-transport.d.ts.map +1 -0
- package/dist/ports/echo-kernel-transport.js +13 -0
- package/dist/ports/echo-kernel-transport.js.map +1 -0
- package/dist/ports/structural-reading.d.ts +100 -0
- package/dist/ports/structural-reading.d.ts.map +1 -0
- package/dist/ports/structural-reading.js +41 -0
- package/dist/ports/structural-reading.js.map +1 -0
- package/dist/warp/structural-reading-adapter.d.ts +28 -0
- package/dist/warp/structural-reading-adapter.d.ts.map +1 -0
- package/dist/warp/structural-reading-adapter.js +94 -0
- package/dist/warp/structural-reading-adapter.js.map +1 -0
- package/docs/CLI.md +4 -4
- package/docs/MCP.md +10 -5
- package/docs/SETUP.md +12 -6
- package/package.json +9 -3
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,68 @@ and this project adheres to [Semantic Versioning](https://semver.org/).
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [0.9.0] - 2026-06-10
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **Fake Echo-shaped TypeScript witness**: Graft proves its Echo-facing seam
|
|
15
|
+
before any real Echo runtime exists. The canonical schema gains its first
|
|
16
|
+
Intent (`recordGitWarpImportBatch`), Wesley 0.0.5 emits LE-binary var
|
|
17
|
+
codecs (`src/generated/graft-structural-history.codec.generated.ts`), and
|
|
18
|
+
a new app-safe stack — `EchoKernelTransport` byte seam, EINT v1 +
|
|
19
|
+
canonical-CBOR envelope codec, typed structural-history client, and an
|
|
20
|
+
Echo-backed `StructuralReadingPort` adapter mapping Echo's
|
|
21
|
+
`ContractObstructionKind` taxonomy into Graft freshness/residual posture —
|
|
22
|
+
is exercised end to end by a deterministic fake transport. The fake
|
|
23
|
+
mirrors Echo's wire-level authority enforcement (`FORBIDDEN_CONTROL_INTENT`
|
|
24
|
+
for the reserved control op id), and guard tests keep the Echo adapter out
|
|
25
|
+
of production contexts. No public surface changes.
|
|
26
|
+
- **Structural-history Echo package descriptor**: Graft now carries a
|
|
27
|
+
deterministic descriptor for the structural-history package it expects Echo
|
|
28
|
+
to host later, with repo-root-relative schema and generated-artifact
|
|
29
|
+
identities, descriptor-only Echo posture, and a local drift check wired into
|
|
30
|
+
`pnpm schema:structural-history:check`.
|
|
31
|
+
- **Structural history schema authority**: Graft now carries a canonical
|
|
32
|
+
`schemas/graft-structural-history.graphql` schema with Wesley-generated
|
|
33
|
+
TypeScript contracts and a deterministic artifact drift check, establishing
|
|
34
|
+
the schema-first Echo migration boundary without changing Echo or Wesley.
|
|
35
|
+
- **Structural source span invariants**: The canonical structural-history schema
|
|
36
|
+
now rejects source spans whose end offsets or present end lines precede their
|
|
37
|
+
starts.
|
|
38
|
+
- **Opened workspace paths**: MCP sessions can now call `workspace_open` to
|
|
39
|
+
open another git worktree path, activate it by default, and inspect opened
|
|
40
|
+
paths through `workspace_list_opened` without adding per-tool `cwd` routing.
|
|
41
|
+
- **Symbol history locations**: `graft_blame` and `graft symbol history`
|
|
42
|
+
now carry per-version path and available line-range facts from WARP symbol
|
|
43
|
+
timelines without adding a second `code_show` history response shape.
|
|
44
|
+
|
|
45
|
+
### Changed
|
|
46
|
+
|
|
47
|
+
- **Structural history generation gate**: `pnpm schema:structural-history:check`
|
|
48
|
+
now requires a configured Wesley CLI, verifies the pinned CLI version and L1
|
|
49
|
+
registry hash, regenerates the TypeScript artifact from GraphQL, and
|
|
50
|
+
byte-compares it with the committed generated file. CI and release workflows
|
|
51
|
+
install Wesley from a pinned release commit before running the check, and
|
|
52
|
+
`pnpm release:check` includes the same gate.
|
|
53
|
+
- **Structural reading boundary**: `graft_review` impact counts and
|
|
54
|
+
`graft_dead_symbols` now read through a Graft-owned
|
|
55
|
+
`StructuralReadingPort` with explicit `echo-native`,
|
|
56
|
+
`git-warp-imported`, and `fallback-translated` evidence labels, preserving
|
|
57
|
+
existing public response shapes while preventing current git-warp readings
|
|
58
|
+
from masquerading as Echo-native witnesshood.
|
|
59
|
+
|
|
60
|
+
### Fixed
|
|
61
|
+
|
|
62
|
+
- **Structural reading residual posture**: Reference-count readings now
|
|
63
|
+
report a partial residual posture when committed import-scan fallback
|
|
64
|
+
evidence is unavailable after a zero-count WARP graph reading.
|
|
65
|
+
|
|
66
|
+
### Security
|
|
67
|
+
|
|
68
|
+
- **Dependency audit posture**: Patched audited transitive dependencies through
|
|
69
|
+
pnpm overrides for `brace-expansion` and `qs`, preserving a clean release
|
|
70
|
+
security gate.
|
|
71
|
+
|
|
10
72
|
## [0.8.0] - 2026-05-13
|
|
11
73
|
|
|
12
74
|
### Added
|
package/GUIDE.md
CHANGED
|
@@ -18,7 +18,7 @@ Manually enforce policies or inspect structural history from your terminal.
|
|
|
18
18
|
### 3. Shared Daemon Mode
|
|
19
19
|
Run the central execution authority for multi-repo work and persistent monitors.
|
|
20
20
|
- **Run**: `npx @flyingrobots/graft daemon`
|
|
21
|
-
- **Read**: [docs/SETUP.md](./docs/SETUP.md) (Daemon bootstrap and `
|
|
21
|
+
- **Read**: [docs/SETUP.md](./docs/SETUP.md) (Daemon bootstrap and `workspace_open`)
|
|
22
22
|
- **Read**: [Architecture](./ARCHITECTURE.md) (Daemon section)
|
|
23
23
|
|
|
24
24
|
## Big Picture: System Orchestration
|
|
@@ -33,9 +33,9 @@ Graft is a tiered governor. It manages the context burden across three layers:
|
|
|
33
33
|
|
|
34
34
|
- [ ] **I am setting up a new project**: Start with `README.md` Quick Start.
|
|
35
35
|
- [ ] **I am configuring Claude Code**: Use `npx graft init --write-claude-hooks`.
|
|
36
|
-
- [ ] **I am using daemon mode in a generic MCP client**: Read [docs/SETUP.md](./docs/SETUP.md) and expect
|
|
36
|
+
- [ ] **I am using daemon mode in a generic MCP client**: Read [docs/SETUP.md](./docs/SETUP.md) and expect `workspace_open` as the normal agent-facing path.
|
|
37
37
|
- [ ] **I am debugging a structural diff**: Use `npx graft struct diff --json`.
|
|
38
|
-
- [ ] **I am contributing to Graft**: Read `METHOD.md
|
|
38
|
+
- [ ] **I am contributing to Graft**: Read `CONTRIBUTING.md`, `METHOD.md`, and [docs/github-issues-mirroring.md](./docs/github-issues-mirroring.md).
|
|
39
39
|
|
|
40
40
|
## Rule of Thumb
|
|
41
41
|
|
|
@@ -49,5 +49,10 @@ If you need to know "what's true right now," use [docs/BEARING.md](./docs/BEARIN
|
|
|
49
49
|
|
|
50
50
|
If you are just starting, use the [README.md](./README.md) and the setup instructions in [docs/SETUP.md](./docs/SETUP.md).
|
|
51
51
|
|
|
52
|
+
If you are reporting a bug or feature idea as a newcomer, use
|
|
53
|
+
[GitHub Issues](https://github.com/flyingrobots/graft/issues). Issues are
|
|
54
|
+
the public discovery surface; execution details stay in Method backlog and
|
|
55
|
+
design packets.
|
|
56
|
+
|
|
52
57
|
---
|
|
53
58
|
**The goal is inevitably. Every feature is defined by its tests.**
|
package/README.md
CHANGED
|
@@ -2,117 +2,133 @@
|
|
|
2
2
|
|
|
3
3
|
A context governor for coding agents. Graft enforces read policy so agents consume the smallest structurally correct view of a codebase instead of dumping raw files into their context window.
|
|
4
4
|
|
|
5
|
-
Graft is designed for the operator who demands precision and the architect who needs a stable foundation for agentic work. It scales from simple policy-aware reads to high-fidelity causal provenance tracking across multi-session worktrees. Parser-backed structural views currently cover JavaScript, TypeScript, Rust, GraphQL, Python, Go, JSON, TOML, YAML, and Markdown.
|
|
6
|
-
|
|
7
5
|
[](https://www.npmjs.com/package/@flyingrobots/graft)
|
|
8
6
|
|
|
9
7
|

|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
Unlike simple file-scraping tools, Graft treats the repository as a layered worldline of code structure and causal activity.
|
|
14
|
-
|
|
15
|
-
- **Policy-Enforced Reads**: Automatically degrades large files to structural outlines and jump tables. Refuses binaries, secrets, and lockfiles with machine-readable reasons.
|
|
16
|
-
- **Machine-Readable Contracts**: Responses carry versioned `_schema` metadata and decision receipts so agents can reason about outcomes without scraping prose.
|
|
17
|
-
- **Structural Memory**: Uses WARP (Structural Worldline Memory) to track AST evolution across Git commits. Query what changed structurally without reading a single byte of source code.
|
|
18
|
-
- **Causal Provenance**: Tracks the *why* behind structural changes by logging read, stage, and transition activity into strand-scoped causal workspaces.
|
|
19
|
-
- **Industrial-Grade Daemon**: A same-user local runtime that manages multi-repo authorization, background indexing, and shared-machine worker pools.
|
|
9
|
+
---
|
|
20
10
|
|
|
21
|
-
##
|
|
11
|
+
## TL;DR — Up and Running in 30 Seconds
|
|
22
12
|
|
|
23
|
-
Graft
|
|
13
|
+
**What it is**: Graft sits between your AI coding agent and the filesystem. Instead of dumping entire files into the context window, it returns the minimum structurally correct view — full content for small files, AST-derived outlines for large ones, hard refusals for secrets and binaries. Every response carries a receipt so agents know exactly how much context they've consumed.
|
|
24
14
|
|
|
25
|
-
|
|
26
|
-
- **CLI** for operator and debugging workflows
|
|
27
|
-
- **MCP** for agent transport integration
|
|
15
|
+
**Why you want it**: Agents that read files naively fill their context window with lockfiles, minified output, and 2,000-line modules they only needed 10 lines of. Graft fixes that automatically.
|
|
28
16
|
|
|
29
|
-
### 1. Bootstrap a Repo
|
|
30
|
-
Scaffold `.graftignore`, setup git hooks, and seed agent instructions.
|
|
31
17
|
```bash
|
|
18
|
+
# Install and bootstrap your repo
|
|
32
19
|
npx @flyingrobots/graft init --write-claude-hooks --write-codex-mcp
|
|
33
|
-
```
|
|
34
20
|
|
|
35
|
-
|
|
36
|
-
This is the simplest per-repo path for most clients. The current
|
|
37
|
-
checkout is the authority, and there is no separate workspace binding
|
|
38
|
-
step.
|
|
39
|
-
```bash
|
|
21
|
+
# Start serving (MCP over stdio — point your agent at this)
|
|
40
22
|
npx @flyingrobots/graft serve
|
|
23
|
+
|
|
24
|
+
# Or try a governed read from the CLI right now
|
|
25
|
+
npx @flyingrobots/graft read safe src/app.ts
|
|
41
26
|
```
|
|
42
27
|
|
|
43
|
-
|
|
44
|
-
|
|
28
|
+
That's it. `init` scaffolds `.graftignore` and writes the MCP config your agent needs. `serve` starts listening on stdio. Your agent calls `safe_read` instead of reading files directly, and Graft handles the rest.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## The Problem
|
|
33
|
+
|
|
34
|
+
AI coding agents read files the same way a first-year developer does: grab the whole thing, every time. A 2,000-line module goes straight into the context window. So does the lockfile. So does the compiled output. So does the `.env`.
|
|
35
|
+
|
|
36
|
+
Context windows are finite. Once they fill up, the agent starts forgetting what it already read. Performance degrades. Hallucinations increase. You burn tokens on noise.
|
|
37
|
+
|
|
38
|
+
Graft sits between the agent and the filesystem and enforces a simple rule: **return the minimum structurally correct view**.
|
|
39
|
+
|
|
40
|
+
- Small file? Full content.
|
|
41
|
+
- Large file? A structural outline — function names, signatures, line ranges. The agent can drill in with a range read if it needs a specific function body.
|
|
42
|
+
- Binary, secret, or lockfile? Hard refusal with a machine-readable reason code and a suggested alternative.
|
|
43
|
+
|
|
44
|
+
Every response carries a receipt: bytes consumed, bytes avoided, session depth, policy decision. Agents can self-regulate. Operators can audit.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Why Graft?
|
|
49
|
+
|
|
50
|
+
- **Parser-backed outlines.** Outlines come from Tree-Sitter ASTs, not heuristic line-scanning. Function signatures, class hierarchies, and jump tables are structurally accurate across JavaScript, TypeScript, Rust, Python, Go, GraphQL, JSON, TOML, YAML, Markdown, and more.
|
|
51
|
+
|
|
52
|
+
- **Machine-readable contracts.** Every response carries versioned `_schema` metadata and a decision receipt. Agents reason about outcomes without scraping prose. Receipts accumulate cumulative session stats so agents know when they're burning budget.
|
|
53
|
+
|
|
54
|
+
- **Structural memory across Git history.** WARP (Structural Worldline Memory) indexes AST outlines per commit into a Git-backed graph. Query what changed structurally — which symbols were added, removed, or renamed — without reading a single byte of source. No checkout required.
|
|
55
|
+
|
|
56
|
+
- **Session governance.** The `GovernorTracker` watches for anti-patterns: runaway tool loops, late-session large reads, edit/bash thrash. Tripwire signals surface in receipts so agents and operators can act before context is exhausted.
|
|
57
|
+
|
|
58
|
+
- **Industrial-grade daemon.** A same-user local runtime manages multi-repo authorization, background indexing, and shared worker pools. WARP graphs stay warm in memory across sessions. Multi-repo work happens without file conflicts.
|
|
59
|
+
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
## Four Official Surfaces
|
|
63
|
+
|
|
64
|
+
Graft exposes the same core capabilities through four integration points. Choose based on your deployment context.
|
|
65
|
+
|
|
66
|
+
### 1. CLI — Operator and Debugging Workflows
|
|
67
|
+
|
|
45
68
|
```bash
|
|
46
69
|
npx @flyingrobots/graft read safe src/app.ts
|
|
47
|
-
npx @flyingrobots/graft review --base HEAD~1
|
|
48
|
-
npx @flyingrobots/graft review cooldown --pr 48
|
|
49
70
|
npx @flyingrobots/graft struct since HEAD~3
|
|
50
71
|
npx @flyingrobots/graft struct dead-symbols --limit 20
|
|
51
72
|
npx @flyingrobots/graft symbol history createUser --path src/users.ts
|
|
73
|
+
npx @flyingrobots/graft review --base HEAD~1
|
|
74
|
+
npx @flyingrobots/graft review cooldown --pr 48
|
|
52
75
|
```
|
|
53
76
|
|
|
54
|
-
|
|
55
|
-
Embed Graft in-process when you want direct access without MCP transport
|
|
56
|
-
or CLI process orchestration.
|
|
57
|
-
```ts
|
|
58
|
-
import { createRepoLocalGraft, callGraftTool } from "@flyingrobots/graft";
|
|
77
|
+
Stateless. Print and exit. Good for scripting, spot-checking policy decisions, and inspecting structural history.
|
|
59
78
|
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
### 2. MCP Stdio — Repo-Local Agent Sessions
|
|
80
|
+
|
|
81
|
+
The simplest path for single-repo agent work. The current checkout is the authority. No workspace binding required.
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npx @flyingrobots/graft serve
|
|
62
85
|
```
|
|
63
86
|
|
|
64
|
-
|
|
65
|
-
|
|
87
|
+
Point your MCP client at this process. Graft speaks JSON-RPC over stdin/stdout. The same binary auto-detects non-TTY stdio and enters serve mode automatically — so `npx @flyingrobots/graft` with no arguments works as an MCP server when piped.
|
|
88
|
+
|
|
89
|
+
### 3. MCP Daemon — Multi-Repo and Multi-Session
|
|
90
|
+
|
|
91
|
+
A persistent same-user runtime for long-running or multi-repo agent work. WARP graphs stay warm between sessions.
|
|
66
92
|
|
|
67
|
-
|
|
68
|
-
|
|
93
|
+
```bash
|
|
94
|
+
npx @flyingrobots/graft daemon
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
Daemon sessions start unbound. The normal agent flow:
|
|
98
|
+
|
|
99
|
+
1. `workspace_open` with the target repo's `cwd`
|
|
100
|
+
2. Optionally `workspace_list_opened` to inspect active workspaces
|
|
101
|
+
3. Use repository-scoped tools: `safe_read`, `file_outline`, `graft_diff`, etc.
|
|
102
|
+
|
|
103
|
+
See [docs/SETUP.md](./docs/SETUP.md) for client-specific bootstrap and daemon control-plane configuration.
|
|
104
|
+
|
|
105
|
+
### 4. Library API — In-Process Integration
|
|
106
|
+
|
|
107
|
+
Embed Graft directly when you want structural reads or syntax data without spawning a subprocess or going through MCP transport.
|
|
108
|
+
|
|
109
|
+
**Governed repo reads** (same policy enforcement as MCP, no receipts):
|
|
69
110
|
```ts
|
|
70
111
|
import { createRepoWorkspace } from "@flyingrobots/graft";
|
|
71
112
|
|
|
72
113
|
const workspace = await createRepoWorkspace({ cwd: process.cwd() });
|
|
73
|
-
const
|
|
74
|
-
|
|
75
|
-
const outline = await workspace.fileOutline({ path: "src/app.ts" });
|
|
114
|
+
const result = await workspace.safeRead({ path: "src/app.ts" });
|
|
115
|
+
// result.projection: "content" | "outline" | "refused"
|
|
76
116
|
```
|
|
77
117
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
118
|
+
**In-process tool calls with receipts** (full MCP behavior, no subprocess):
|
|
119
|
+
```ts
|
|
120
|
+
import { createRepoLocalGraft, callGraftTool } from "@flyingrobots/graft";
|
|
121
|
+
|
|
122
|
+
const graft = createRepoLocalGraft({ cwd: process.cwd() });
|
|
123
|
+
const outline = await callGraftTool(graft, "file_outline", { path: "src/app.ts" });
|
|
124
|
+
```
|
|
81
125
|
|
|
82
|
-
|
|
126
|
+
**Editor-native syntax highlighting** (Tree-Sitter WASM, no I/O, viewport-aware):
|
|
83
127
|
```ts
|
|
84
|
-
import {
|
|
85
|
-
createProjectionBundle,
|
|
86
|
-
createStructuredBuffer,
|
|
87
|
-
ensureParserReady,
|
|
88
|
-
} from "@flyingrobots/graft";
|
|
128
|
+
import { createProjectionBundle, ensureParserReady } from "@flyingrobots/graft";
|
|
89
129
|
|
|
90
130
|
await ensureParserReady();
|
|
91
131
|
|
|
92
|
-
const buffer = createStructuredBuffer("src/app.tsx", liveEditorText, {
|
|
93
|
-
basis: { kind: "editor_head", headId: "head-42", tick: 17 },
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
try {
|
|
97
|
-
const spans = buffer.syntaxSpans({
|
|
98
|
-
viewport: {
|
|
99
|
-
start: { row: 0, column: 0 },
|
|
100
|
-
end: { row: 80, column: 0 },
|
|
101
|
-
},
|
|
102
|
-
});
|
|
103
|
-
const context = buffer.nodeAt({ row: 24, column: 12 });
|
|
104
|
-
const rename = buffer.renamePreview({
|
|
105
|
-
position: { row: 24, column: 12 },
|
|
106
|
-
nextName: "nextValue",
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
// Every warm result now carries the basis it was derived from.
|
|
110
|
-
console.log(spans.basis, context.kind, rename.edits.length);
|
|
111
|
-
} finally {
|
|
112
|
-
buffer.dispose();
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// createProjectionBundle owns the temporary StructuredBuffer lifecycle.
|
|
116
132
|
const bundle = createProjectionBundle("src/app.tsx", liveEditorText, {
|
|
117
133
|
basis: { kind: "editor_head", headId: "head-42", tick: 17 },
|
|
118
134
|
viewport: {
|
|
@@ -120,41 +136,51 @@ const bundle = createProjectionBundle("src/app.tsx", liveEditorText, {
|
|
|
120
136
|
end: { row: 80, column: 0 },
|
|
121
137
|
},
|
|
122
138
|
});
|
|
123
|
-
|
|
124
|
-
console.log(bundle.parseStatus.status);
|
|
139
|
+
// bundle.syntax.spans — highlight ranges for the visible viewport only
|
|
125
140
|
```
|
|
126
141
|
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
142
|
+
`createProjectionBundle` owns the WASM buffer lifecycle internally. Use `createStructuredBuffer` directly if you need to hold a buffer across multiple operations and manage `dispose()` yourself.
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Quick Start
|
|
147
|
+
|
|
130
148
|
```bash
|
|
131
|
-
|
|
149
|
+
# 1. Bootstrap the repo: scaffold .graftignore, seed agent instructions
|
|
150
|
+
npx @flyingrobots/graft init --write-claude-hooks --write-codex-mcp
|
|
151
|
+
|
|
152
|
+
# 2. Start serving (repo-local stdio MCP)
|
|
153
|
+
npx @flyingrobots/graft serve
|
|
132
154
|
```
|
|
133
155
|
|
|
134
|
-
|
|
135
|
-
daemon instead of repo-local stdio, the first repo-scoped flow is:
|
|
156
|
+
## Contributing with public visibility
|
|
136
157
|
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
158
|
+
For bugs, capability requests, and ideas, start at
|
|
159
|
+
[GitHub Issues](https://github.com/flyingrobots/graft/issues).
|
|
160
|
+
That queue is the public view for priorities and discussion. Internal execution and design rigor still lives in
|
|
161
|
+
`docs/method/backlog/` and `docs/design/` so details remain deterministic for contributors.
|
|
140
162
|
|
|
141
|
-
|
|
142
|
-
daemon control-plane posture.
|
|
163
|
+
---
|
|
143
164
|
|
|
144
165
|
## Documentation
|
|
145
166
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
167
|
+
| Document | What it covers |
|
|
168
|
+
|----------|---------------|
|
|
169
|
+
| [Technical Teardown](./docs/TECHNICAL_TEARDOWN.md) | Zero-to-hero deep dive: entry points, golden paths, data schemas, policy engine, WARP, session governance, trade-offs |
|
|
170
|
+
| [Guide](./GUIDE.md) | Orientation, the fast path, and agent bootstrap |
|
|
171
|
+
| [Setup Guide](./docs/SETUP.md) | Client-specific MCP setup, daemon posture, and workspace binding |
|
|
172
|
+
| [Advanced Guide](./ADVANCED_GUIDE.md) | Pipeline internals, worldlines, and daemon mechanics |
|
|
173
|
+
| [Architecture](./ARCHITECTURE.md) | Authoritative structural reference: Ports, Adapters, WARP |
|
|
174
|
+
| [Public API Contract](./docs/public-api.md) | Semver-public root import surface and stability policy |
|
|
175
|
+
| [Three-Surface Capability Matrix](./docs/three-surface-capability-matrix.md) | API / CLI / MCP feature baseline and peer posture |
|
|
176
|
+
| [Repo Topology](./docs/repo-topology.md) | Where API, CLI, MCP, and core live in the source tree |
|
|
177
|
+
| [Security Model](./docs/strategy/security-model.md) | Same-user daemon trust boundaries, authz, and observability |
|
|
178
|
+
| [Causal Provenance](./docs/strategy/causal-provenance.md) | Transport sessions, causal workspaces, strands, and handoff truth |
|
|
179
|
+
| [North Star](./NORTHSTAR.md) | Long-term stack position and Continuum-shaped direction |
|
|
180
|
+
| [Vision](./docs/VISION.md) | Core tenets and the provenance-aware mission |
|
|
181
|
+
| [Method](./METHOD.md) | Repo work doctrine and the cycle loop |
|
|
182
|
+
| [Issue visibility and backlog mapping](./docs/github-issues-mirroring.md) | Public issue triage plus internal backlog synchronization |
|
|
158
183
|
|
|
159
184
|
---
|
|
185
|
+
|
|
160
186
|
Built with precision by [FLYING ROBOTS](https://github.com/flyingrobots)
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type EchoKernelTransport } from "../ports/echo-kernel-transport.js";
|
|
2
|
+
export interface FakeDeadSymbolFixture {
|
|
3
|
+
readonly name: string;
|
|
4
|
+
readonly kind: string;
|
|
5
|
+
readonly filePath: string;
|
|
6
|
+
readonly exported: boolean;
|
|
7
|
+
readonly removedInCommit: string;
|
|
8
|
+
}
|
|
9
|
+
export interface FakeSymbolReferenceFixture {
|
|
10
|
+
readonly symbol: string;
|
|
11
|
+
readonly filePath: string;
|
|
12
|
+
readonly referenceCount: number;
|
|
13
|
+
readonly referencingFiles: readonly string[];
|
|
14
|
+
}
|
|
15
|
+
export interface FakeQueryObstructionFixture {
|
|
16
|
+
readonly code: string;
|
|
17
|
+
readonly message: string;
|
|
18
|
+
readonly recovery?: string;
|
|
19
|
+
}
|
|
20
|
+
export interface FakeEchoFixture {
|
|
21
|
+
readonly basisId?: string;
|
|
22
|
+
readonly deadSymbols?: readonly FakeDeadSymbolFixture[];
|
|
23
|
+
readonly symbolReferences?: readonly FakeSymbolReferenceFixture[];
|
|
24
|
+
readonly rejectImportBatchIds?: readonly string[];
|
|
25
|
+
readonly admissionObstructedBatchIds?: readonly string[];
|
|
26
|
+
readonly queryObstruction?: FakeQueryObstructionFixture;
|
|
27
|
+
readonly retainedEvidencePosture?: "retained" | "missing" | "obstructed";
|
|
28
|
+
}
|
|
29
|
+
export interface CreateFakeEchoKernelTransportOptions {
|
|
30
|
+
readonly fixture?: FakeEchoFixture;
|
|
31
|
+
}
|
|
32
|
+
export declare function createFakeEchoKernelTransport(options?: CreateFakeEchoKernelTransportOptions): EchoKernelTransport;
|
|
33
|
+
//# sourceMappingURL=fake-echo-kernel-transport.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-echo-kernel-transport.d.ts","sourceRoot":"","sources":["../../src/adapters/fake-echo-kernel-transport.ts"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,mBAAmB,EACzB,MAAM,mCAAmC,CAAC;AA0B3C,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,eAAe,EAAE,MAAM,CAAC;CAClC;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,gBAAgB,EAAE,SAAS,MAAM,EAAE,CAAC;CAC9C;AAED,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,SAAS,qBAAqB,EAAE,CAAC;IACxD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,SAAS,0BAA0B,EAAE,CAAC;IAClE,QAAQ,CAAC,oBAAoB,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClD,QAAQ,CAAC,2BAA2B,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IACzD,QAAQ,CAAC,gBAAgB,CAAC,EAAE,2BAA2B,CAAC;IACxD,QAAQ,CAAC,uBAAuB,CAAC,EAAE,UAAU,GAAG,SAAS,GAAG,YAAY,CAAC;CAC1E;AAED,MAAM,WAAW,oCAAoC;IACnD,QAAQ,CAAC,OAAO,CAAC,EAAE,eAAe,CAAC;CACpC;AAkDD,wBAAgB,6BAA6B,CAC3C,OAAO,GAAE,oCAAyC,GACjD,mBAAmB,CA6JrB"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// ---------------------------------------------------------------------------
|
|
2
|
+
// Deterministic fake Echo kernel transport for tests and local development.
|
|
3
|
+
//
|
|
4
|
+
// Implements the app-safe byte seam only. Mirrors Echo's wire-level
|
|
5
|
+
// authority enforcement: the reserved control op id fails with ABI error 19
|
|
6
|
+
// FORBIDDEN_CONTROL_INTENT [echo crates/echo-wasm-abi/src/kernel_port.rs#320
|
|
7
|
+
// @2048da5c]. No durability claim: everything lives in process memory.
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
import { createHash } from "node:crypto";
|
|
10
|
+
import { CONTROL_INTENT_V1_OP_ID, } from "../ports/echo-kernel-transport.js";
|
|
11
|
+
import { ABI_ERROR_CODES, DEFAULT_STRUCTURAL_HISTORY_BASIS_ID, EchoEnvelopeCodecError, STRUCTURAL_HISTORY_OBSERVE_OPERATIONS, decodeStructuralHistoryObserveRequest, encodeStructuralHistoryErrorResponse, encodeStructuralHistoryOkResponse, unpackStructuralHistoryIntentV1, } from "../echo/structural-history-envelope-codec.js";
|
|
12
|
+
import { OP_RECORD_GIT_WARP_IMPORT_BATCH, decodeRecordGitWarpImportBatchVars, encodeRecordGitWarpImportBatchVars, } from "../generated/graft-structural-history.codec.generated.js";
|
|
13
|
+
import { CodecError } from "../echo/codec-runtime.js";
|
|
14
|
+
const FATAL_OR_EMPTY_OBSTRUCTIONS = new Set([
|
|
15
|
+
"MISSING_RETENTION",
|
|
16
|
+
"UNSUPPORTED_OPERATION",
|
|
17
|
+
"UNSUPPORTED_QUERY",
|
|
18
|
+
"RUNTIME_FAULT",
|
|
19
|
+
]);
|
|
20
|
+
function bytesEqual(a, b) {
|
|
21
|
+
if (a.byteLength !== b.byteLength) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
for (let i = 0; i < a.byteLength; i += 1) {
|
|
25
|
+
if (a[i] !== b[i]) {
|
|
26
|
+
return false;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return true;
|
|
30
|
+
}
|
|
31
|
+
function submissionIdFor(envelope) {
|
|
32
|
+
return createHash("sha256").update(envelope).digest("hex");
|
|
33
|
+
}
|
|
34
|
+
function readingsFromFixture(fixture) {
|
|
35
|
+
const records = [];
|
|
36
|
+
const deadSymbols = fixture.deadSymbols ?? [];
|
|
37
|
+
records.push({
|
|
38
|
+
readingId: "reading-dead-symbols-0001",
|
|
39
|
+
readingKind: "DEAD_SYMBOLS",
|
|
40
|
+
payloadJson: {
|
|
41
|
+
symbols: deadSymbols.map((symbol) => ({ ...symbol })),
|
|
42
|
+
total: deadSymbols.length,
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
(fixture.symbolReferences ?? []).forEach((reference, index) => {
|
|
46
|
+
records.push({
|
|
47
|
+
readingId: `reading-symbol-reference-${String(index + 1).padStart(4, "0")}`,
|
|
48
|
+
readingKind: "SYMBOL_REFERENCE_COUNT",
|
|
49
|
+
payloadJson: {
|
|
50
|
+
symbol: reference.symbol,
|
|
51
|
+
filePath: reference.filePath,
|
|
52
|
+
referenceCount: reference.referenceCount,
|
|
53
|
+
referencingFiles: [...reference.referencingFiles],
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
});
|
|
57
|
+
return records;
|
|
58
|
+
}
|
|
59
|
+
export function createFakeEchoKernelTransport(options = {}) {
|
|
60
|
+
const fixture = options.fixture ?? {};
|
|
61
|
+
const basisId = fixture.basisId ?? DEFAULT_STRUCTURAL_HISTORY_BASIS_ID;
|
|
62
|
+
const outcomes = new Map();
|
|
63
|
+
function handleIntent(intentBytes) {
|
|
64
|
+
let envelope;
|
|
65
|
+
try {
|
|
66
|
+
envelope = unpackStructuralHistoryIntentV1(intentBytes);
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
69
|
+
if (error instanceof EchoEnvelopeCodecError) {
|
|
70
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.INVALID_INTENT, error.message);
|
|
71
|
+
}
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
if (envelope.opId === CONTROL_INTENT_V1_OP_ID) {
|
|
75
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.FORBIDDEN_CONTROL_INTENT, "application dispatch rejected scheduler control intent");
|
|
76
|
+
}
|
|
77
|
+
if (envelope.opId !== OP_RECORD_GIT_WARP_IMPORT_BATCH) {
|
|
78
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.NOT_SUPPORTED, `no installed operation for op id ${String(envelope.opId)}`);
|
|
79
|
+
}
|
|
80
|
+
let vars;
|
|
81
|
+
try {
|
|
82
|
+
vars = decodeRecordGitWarpImportBatchVars(envelope.vars);
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (error instanceof CodecError) {
|
|
86
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.CODEC_ERROR, error.message);
|
|
87
|
+
}
|
|
88
|
+
throw error;
|
|
89
|
+
}
|
|
90
|
+
// The generated decoder does not reject trailing bytes (Wesley emitter
|
|
91
|
+
// gap, filed upstream); canonical re-encode equality is the backstop.
|
|
92
|
+
if (!bytesEqual(encodeRecordGitWarpImportBatchVars(vars), envelope.vars)) {
|
|
93
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.CODEC_ERROR, "intent vars carry trailing or non-canonical bytes");
|
|
94
|
+
}
|
|
95
|
+
const submissionId = submissionIdFor(intentBytes);
|
|
96
|
+
const receipt = {
|
|
97
|
+
submissionId,
|
|
98
|
+
operationName: "recordGitWarpImportBatch",
|
|
99
|
+
importBatchId: vars.input.importBatchId,
|
|
100
|
+
};
|
|
101
|
+
const batchId = vars.input.importBatchId;
|
|
102
|
+
let outcome;
|
|
103
|
+
if ((fixture.admissionObstructedBatchIds ?? []).includes(batchId)) {
|
|
104
|
+
outcome = {
|
|
105
|
+
kind: "obstructed",
|
|
106
|
+
obstruction: {
|
|
107
|
+
code: "ADMISSION_OBSTRUCTION",
|
|
108
|
+
message: `import batch ${batchId} was not admitted`,
|
|
109
|
+
},
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
else if ((fixture.rejectImportBatchIds ?? []).includes(batchId)) {
|
|
113
|
+
outcome = {
|
|
114
|
+
kind: "rejected",
|
|
115
|
+
reason: `import batch ${batchId} rejected by fixture policy`,
|
|
116
|
+
receipt,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
else {
|
|
120
|
+
outcome = { kind: "applied", receipt };
|
|
121
|
+
}
|
|
122
|
+
outcomes.set(submissionId, outcome);
|
|
123
|
+
return encodeStructuralHistoryOkResponse({ submissionId });
|
|
124
|
+
}
|
|
125
|
+
function handleObserve(requestBytes) {
|
|
126
|
+
let request;
|
|
127
|
+
try {
|
|
128
|
+
request = decodeStructuralHistoryObserveRequest(requestBytes);
|
|
129
|
+
}
|
|
130
|
+
catch (error) {
|
|
131
|
+
if (error instanceof EchoEnvelopeCodecError) {
|
|
132
|
+
return encodeStructuralHistoryErrorResponse(ABI_ERROR_CODES.CODEC_ERROR, error.message);
|
|
133
|
+
}
|
|
134
|
+
throw error;
|
|
135
|
+
}
|
|
136
|
+
const vars = (request.vars ?? {});
|
|
137
|
+
if (request.operationName === STRUCTURAL_HISTORY_OBSERVE_OPERATIONS.intentOutcome) {
|
|
138
|
+
const submissionId = typeof vars["submissionId"] === "string" ? vars["submissionId"] : "";
|
|
139
|
+
const outcome = outcomes.get(submissionId) ?? { kind: "unknown" };
|
|
140
|
+
return encodeStructuralHistoryOkResponse({ outcome });
|
|
141
|
+
}
|
|
142
|
+
if (request.operationName === STRUCTURAL_HISTORY_OBSERVE_OPERATIONS.retainedEvidencePosture) {
|
|
143
|
+
return encodeStructuralHistoryOkResponse({
|
|
144
|
+
posture: fixture.retainedEvidencePosture ?? "retained",
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
if (request.operationName === STRUCTURAL_HISTORY_OBSERVE_OPERATIONS.structuralReadings) {
|
|
148
|
+
const requestedBasis = typeof vars["basisId"] === "string" ? vars["basisId"] : basisId;
|
|
149
|
+
if (requestedBasis !== basisId) {
|
|
150
|
+
return encodeStructuralHistoryOkResponse({
|
|
151
|
+
readings: [],
|
|
152
|
+
obstruction: {
|
|
153
|
+
code: "MISSING_RETENTION",
|
|
154
|
+
message: `basis ${requestedBasis} is not retained by this kernel`,
|
|
155
|
+
},
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
const readingKind = typeof vars["readingKind"] === "string" ? vars["readingKind"] : null;
|
|
159
|
+
const obstruction = fixture.queryObstruction;
|
|
160
|
+
const suppressReadings = obstruction !== undefined && FATAL_OR_EMPTY_OBSTRUCTIONS.has(obstruction.code);
|
|
161
|
+
const readings = suppressReadings
|
|
162
|
+
? []
|
|
163
|
+
: readingsFromFixture(fixture)
|
|
164
|
+
.filter((record) => readingKind === null || record.readingKind === readingKind)
|
|
165
|
+
.map((record) => ({
|
|
166
|
+
readingId: record.readingId,
|
|
167
|
+
readingKind: record.readingKind,
|
|
168
|
+
basisId,
|
|
169
|
+
payloadJson: record.payloadJson,
|
|
170
|
+
evidence: {
|
|
171
|
+
family: "graft-structural-history",
|
|
172
|
+
readingId: record.readingId,
|
|
173
|
+
basis: { basisId },
|
|
174
|
+
},
|
|
175
|
+
}));
|
|
176
|
+
const fields = { readings };
|
|
177
|
+
if (obstruction !== undefined) {
|
|
178
|
+
fields["obstruction"] = {
|
|
179
|
+
code: obstruction.code,
|
|
180
|
+
message: obstruction.message,
|
|
181
|
+
...(obstruction.recovery !== undefined ? { recovery: obstruction.recovery } : {}),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
return encodeStructuralHistoryOkResponse(fields);
|
|
185
|
+
}
|
|
186
|
+
return encodeStructuralHistoryOkResponse({
|
|
187
|
+
obstruction: {
|
|
188
|
+
code: "UNSUPPORTED_QUERY",
|
|
189
|
+
message: `no installed observer supports ${request.operationName}`,
|
|
190
|
+
},
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
return {
|
|
194
|
+
kernelInfo() {
|
|
195
|
+
return {
|
|
196
|
+
module: "fake-echo-structural-history",
|
|
197
|
+
codecId: "graft-structural-history-le-v0",
|
|
198
|
+
};
|
|
199
|
+
},
|
|
200
|
+
submitIntentBytes(intentBytes) {
|
|
201
|
+
return handleIntent(intentBytes);
|
|
202
|
+
},
|
|
203
|
+
observeBytes(requestBytes) {
|
|
204
|
+
return handleObserve(requestBytes);
|
|
205
|
+
},
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=fake-echo-kernel-transport.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fake-echo-kernel-transport.js","sourceRoot":"","sources":["../../src/adapters/fake-echo-kernel-transport.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,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