@agentskit/doc-bridge 0.1.0-alpha.1 → 0.1.0-alpha.3

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.
Files changed (62) hide show
  1. package/CHANGELOG.md +28 -0
  2. package/README.md +1 -1
  3. package/dist/cli/program.js +416 -148
  4. package/dist/cli/program.js.map +1 -1
  5. package/dist/config/index.d.ts +1 -1
  6. package/dist/config/index.js +6 -3
  7. package/dist/config/index.js.map +1 -1
  8. package/dist/{index-CD_zmKXf.d.ts → index-CPUJbTbg.d.ts} +19 -10
  9. package/dist/index.d.ts +25 -6
  10. package/dist/index.js +398 -132
  11. package/dist/index.js.map +1 -1
  12. package/docs/DOGFOOD-ROUND2.md +142 -0
  13. package/docs/DOGFOOD.md +92 -0
  14. package/package.json +32 -14
  15. package/scripts/prepare.mjs +44 -0
  16. package/src/cli/program.ts +947 -0
  17. package/src/config/defaults.ts +63 -0
  18. package/src/config/define-config.ts +6 -0
  19. package/src/config/index.ts +15 -0
  20. package/src/config/load-config.ts +138 -0
  21. package/src/config/schema.ts +294 -0
  22. package/src/federation/llms.ts +154 -0
  23. package/src/gates/run-gates.ts +274 -0
  24. package/src/index-builder/build-handoffs.ts +232 -0
  25. package/src/index-builder/build-index.ts +137 -0
  26. package/src/index-builder/capabilities.ts +37 -0
  27. package/src/index-builder/content-hash.ts +19 -0
  28. package/src/index-builder/human-adapters/core.ts +100 -0
  29. package/src/index-builder/human-adapters/docusaurus.ts +113 -0
  30. package/src/index-builder/human-adapters/fumadocs.ts +70 -0
  31. package/src/index-builder/human-adapters/index.ts +52 -0
  32. package/src/index-builder/human-adapters/plain-markdown.ts +10 -0
  33. package/src/index-builder/llms-txt.ts +19 -0
  34. package/src/index-builder/plugins/human-markdown.ts +7 -0
  35. package/src/index-builder/plugins/pnpm-monorepo.ts +72 -0
  36. package/src/index-builder/scan-corpus.ts +185 -0
  37. package/src/index.ts +120 -0
  38. package/src/intelligence/adapter.ts +90 -0
  39. package/src/intelligence/chat.ts +148 -0
  40. package/src/intelligence/peers.ts +59 -0
  41. package/src/intelligence/rag.ts +98 -0
  42. package/src/lib/glob-expand.ts +33 -0
  43. package/src/lib/markdown.ts +117 -0
  44. package/src/lib/package-manager.ts +104 -0
  45. package/src/lib/paths.ts +6 -0
  46. package/src/lib/walk.ts +45 -0
  47. package/src/mcp/server.ts +276 -0
  48. package/src/memory/ingest.ts +51 -0
  49. package/src/memory/pipeline.ts +119 -0
  50. package/src/query/load-index.ts +25 -0
  51. package/src/query/query.ts +142 -0
  52. package/src/query/search.ts +126 -0
  53. package/src/retriever/doc-bridge-retriever.ts +62 -0
  54. package/src/schemas/agent-handoff.ts +82 -0
  55. package/src/schemas/doc-bridge-index.ts +108 -0
  56. package/src/schemas/json-schemas.ts +157 -0
  57. package/src/schemas/memory-candidate.ts +37 -0
  58. package/src/shims/agentskit-peers.d.ts +80 -0
  59. package/src/validate.ts +67 -0
  60. package/src/version.ts +1 -0
  61. package/tsconfig.json +21 -0
  62. package/tsup.config.ts +15 -0
@@ -0,0 +1,142 @@
1
+ # Dogfood round 2 — published `@agentskit/doc-bridge@0.1.0-alpha.2`
2
+
3
+ **Date:** 2026-07-09
4
+ **Install:** npm registry tag `alpha` → `0.1.0-alpha.2`
5
+ **Consumers:** agentskit · agentskit-os · agents-playbook · agentskit-registry
6
+
7
+ ## Scoreboard
8
+
9
+ | Repo | Install | Version | Knowledge | Handoffs | Gate | Sample handoff quality |
10
+ |------|---------|---------|-----------|----------|------|------------------------|
11
+ | **agentskit** | `pnpm add -Dw @0.1.0-alpha.2` ✅ | 0.1.0-alpha.2 | 25 | 24 | ✅ freshness + 23 humanDoc | Excellent: pnpm filter checks + humanDoc `/docs/reference/packages/core` |
12
+ | **agentskit-os** | pnpm store conflict; used **`npx`** ✅ | 0.1.0-alpha.2 | 170 | 92 | ✅ freshness + 9 humanDoc | Good act path; weak human bridge (9/92) |
13
+ | **agents-playbook** | `pnpm add -D` ✅ | 0.1.0-alpha.2 | 127 | 81 | ✅ freshness + okf-type | Pattern ownership + `check:okf-type` ✅ |
14
+ | **agentskit-registry** | needs `--legacy-peer-deps` ⚠️ | 0.1.0-alpha.2 | 36 | 36 | ✅ freshness | Full agent ownership + humanDoc ✅ |
15
+
16
+ ### npm dist-tags (observed)
17
+
18
+ | Tag | Version |
19
+ |-----|---------|
20
+ | `latest` | `0.1.0-alpha.1` |
21
+ | `alpha` | `0.1.0-alpha.2` |
22
+
23
+ **Recommendation:** keep prereleases only on `alpha` until stable; document `npm i -D @agentskit/doc-bridge@alpha`.
24
+
25
+ ---
26
+
27
+ ## What works well (validated)
28
+
29
+ 1. **Published binary works** — `ak-docs 0.1.0-alpha.2` from registry / npx.
30
+ 2. **Monorepo handoffs** — `editRoots` + `pnpm --filter @agentskit/<pkg> test|lint` on agentskit and AKOS.
31
+ 3. **Playbook preset** — gates green without crushing large OKF corpus.
32
+ 4. **Registry ownership** — all 36 agents resolve; checks use `npm run validate`.
33
+ 5. **Fumadocs humanDoc** on agentskit points at **reference** docs, not nested for-agents.
34
+ 6. **Pattern checks** — playbook patterns emit `pnpm run check:okf-type`.
35
+
36
+ ---
37
+
38
+ ## Issues found (prioritized)
39
+
40
+ ### P0 — correctness / ranking (agents will take wrong action)
41
+
42
+ | ID | Issue | Evidence | Suggested fix |
43
+ |----|--------|----------|----------------|
44
+ | **R2-1** | **Search/ask ranking ignores exact package id** | `search core --agent` bestMatch = **angular** (score 8) tied with **core** (score 8) because summary contains `@agentskit/core` | Boost exact `id` / path segment matches; prefer ownership id === term before body mentions |
45
+ | **R2-2** | **`ask` suggests wrong handoff** | “where do I change the **core** package?” → best match **angular**, next `query ownership angular` | Same ranking fix; optional: prefer ownership over knowledge for “package/module” language |
46
+ | **R2-3** | **Purpose/notes truncated mid-sentence** | core notes: `"Stable TypeScript contracts (Adapter, Tool, Memory, Retriever, Skill,"` | Raise firstParagraph budget; strip trailing incomplete commas; prefer frontmatter `purpose` full line |
47
+
48
+ ### P1 — install / peer DX
49
+
50
+ | ID | Issue | Evidence | Suggested fix |
51
+ |----|--------|----------|----------------|
52
+ | **R2-4** | **Optional peers still break npm install** | registry: `ERESOLVE` with optional peers vs `@agentskit/adapters@0.12.x` | Peer ranges more permissive (`>=0.12` / `>=1.0`); document `--legacy-peer-deps`; ensure optional peers never hard-fail Layer 0 |
53
+ | **R2-5** | **Peer `@agentskit/core@^1.10.0` vs monorepo 1.9.0** | pnpm warning on agentskit install | Align peer to `^1.9.0 \|\| ^1.10.0` or `>=1.9.0 <2` for dogfood until monorepo bumps |
54
+ | **R2-6** | **`latest` still points at alpha.1** | `npm view` latest=alpha.1, alpha=alpha.2 | Publish hygiene: don’t put prereleases on `latest`, or retag after publish |
55
+ | **R2-7** | **AKOS cannot `pnpm add` (store v10 vs v11)** | `ERR_PNPM_UNEXPECTED_STORE` | Docs: use npx / align store; not a doc-bridge bug but dogfood friction |
56
+
57
+ ### P2 — search / retrieval quality
58
+
59
+ | ID | Issue | Evidence | Suggested fix |
60
+ |----|--------|----------|----------------|
61
+ | **R2-8** | **Search miss on common English** | agentskit `search documentation` → **0 matches** | Index more body text / titles; lower threshold; BM25 over full file not only description |
62
+ | **R2-9** | **Playbook `search handoff` → 0** | term may only appear deep in body | Same as R2-8; chunk full markdown into search corpus |
63
+ | **R2-10** | **Federation hard-fail noise** | `retrieve` → `Failed to fetch https://registry.agentskit.io/llms.txt: 404` | Soft-fail federation sources; warn once; don’t fail command |
64
+ | **R2-11** | **Text search UX** | tab-separated dense lines | Columnar/TTY formatting (`type id path summary`) |
65
+
66
+ ### P3 — bridge coverage & product polish
67
+
68
+ | ID | Issue | Evidence | Suggested fix |
69
+ |----|--------|----------|----------------|
70
+ | **R2-12** | **AKOS humanDoc still sparse** | 9/92 handoffs with humanDoc | Map for-agents frontmatter `humanDoc`; product Fumadocs catalog; optional plain-markdown `docs/errors` etc. |
71
+ | **R2-13** | **Duplicate knowledge+ownership rows in search** | same path appears as ownership + knowledge | Deduplicate by path; show ownership preferred |
72
+ | **R2-14** | **Default checks for patterns without okf script** | N/A playbook ok | Fine; document convention |
73
+ | **R2-15** | **MCP not re-smoked this round** | — | Keep in CI smoke; optional round 3 |
74
+
75
+ ---
76
+
77
+ ## Sample outputs (good)
78
+
79
+ ### agentskit — `query package core --agent`
80
+
81
+ ```json
82
+ {
83
+ "startHere": "apps/docs-next/content/docs/for-agents/core.mdx",
84
+ "editRoots": ["packages/core"],
85
+ "checks": [
86
+ "pnpm --filter @agentskit/core test",
87
+ "pnpm --filter @agentskit/core lint"
88
+ ],
89
+ "humanDoc": "/docs/reference/packages/core"
90
+ }
91
+ ```
92
+
93
+ ### playbook — pattern handoff
94
+
95
+ ```json
96
+ {
97
+ "startHere": "content/docs/pillars/ai-collaboration/open-knowledge-format-pattern.md",
98
+ "checks": ["pnpm run check:okf-type"],
99
+ "humanDoc": "/docs/pillars/ai-collaboration/open-knowledge-format-pattern"
100
+ }
101
+ ```
102
+
103
+ ### registry — `docs-chat`
104
+
105
+ ```json
106
+ {
107
+ "startHere": "registry/docs-chat/README.md",
108
+ "editRoots": ["registry/docs-chat"],
109
+ "checks": ["npm run validate", "npm test"],
110
+ "humanDoc": "/agents/docs-chat"
111
+ }
112
+ ```
113
+
114
+ ---
115
+
116
+ ## Recommended next alpha (0.1.0-alpha.3) scope
117
+
118
+ 1. **Ranking:** exact id / basename boost; package-intent heuristics for `ask`
119
+ 2. **Search corpus:** full-text over body (not only description); dedupe paths
120
+ 3. **Descriptions:** full purpose from frontmatter or first complete paragraph
121
+ 4. **Peers:** widen optional peer ranges; Layer 0 install never requires AgentsKit packages
122
+ 5. **Federation:** soft-fail missing `llms.txt` sources
123
+ 6. **Publish:** keep `latest` free of broken prereleases; doc install as `@alpha`
124
+
125
+ ---
126
+
127
+ ## Consumer follow-ups (not doc-bridge code)
128
+
129
+ | Repo | Action |
130
+ |------|--------|
131
+ | agentskit | Bump `@agentskit/core` to 1.10+ or live with peer warning |
132
+ | agentskit-os | Align pnpm store / commit lock with published dep; add CI `docs:bridge:gate` |
133
+ | agents-playbook | Optional CI workflow for gate |
134
+ | agentskit-registry | Publish `public/llms.txt` at site root (404 today); use `--legacy-peer-deps` until peer ranges loosen |
135
+ | all | After alpha.3: switch dep to `@agentskit/doc-bridge@alpha` only |
136
+
137
+ ---
138
+
139
+ ## Conclusion
140
+
141
+ **Round 2 proves Layer 0 is useful on real monorepos and OKF/registry corpora with the published package.**
142
+ The biggest remaining gap for “agents do the right thing” is **discovery ranking (R2-1/R2-2)** and **search body coverage (R2-8/R2-9)** — not indexing or handoff structure.
@@ -0,0 +1,92 @@
1
+ # Ecosystem dogfood — `@agentskit/doc-bridge`
2
+
3
+ Validated **2026-07-09** against four consumers.
4
+
5
+ - First pass: `0.1.0-alpha.1` (local `file:`)
6
+ - Second pass after polish: **`0.1.0-alpha.2`** (`v0.1.0-alpha.2`)
7
+
8
+ ## Standard integration (all repos)
9
+
10
+ | Artifact | Purpose |
11
+ |----------|---------|
12
+ | `doc-bridge.config.json` | Layer 0 config (schemaVersion 1) |
13
+ | `docs:bridge:index` | `ak-docs index` |
14
+ | `docs:bridge:gate` | `ak-docs gate run` |
15
+ | `docs:bridge:query` | `ak-docs query` |
16
+ | `.doc-bridge/` | Generated index (gitignored) |
17
+ | `devDependency` | `@agentskit/doc-bridge` (`file:` or `0.1.0-alpha.1` / `@alpha` when npm resolves) |
18
+
19
+ ### MCP (optional, same in each repo)
20
+
21
+ ```json
22
+ {
23
+ "mcpServers": {
24
+ "ak-docs": {
25
+ "command": "ak-docs",
26
+ "args": ["mcp"]
27
+ }
28
+ }
29
+ }
30
+ ```
31
+
32
+ ## Results
33
+
34
+ | Repo | Knowledge | Handoffs | Gate | Sample handoff |
35
+ |------|-----------|----------|------|----------------|
36
+ | **agentskit** | 25 | 24 | ✅ freshness + 24 humanDoc | `core` → `packages/core` + for-agents MDX |
37
+ | **agentskit-os** | 170 | 82 | ✅ freshness + 2 humanDoc | `os-core` → for-agents package doc |
38
+ | **agents-playbook** | 127 | 81 patterns | ✅ freshness + okf-type | `open-knowledge-format-pattern` |
39
+ | **agentskit-registry** | 36 | 36 | ✅ freshness | `docs-chat` → `registry/docs-chat` |
40
+
41
+ ## Findings / improvements for doc-bridge
42
+
43
+ ### P0 product feedback
44
+ 1. **Default checks are npm-centric** (`npm test` / `npm run lint`) even in pnpm monorepos. Prefer detecting `packageManager` or `pnpm --filter <id> test`.
45
+ 2. **Git install lacks `dist/`** — `github:…#tag` installs source only; need `prepare`/`prepack` that builds, or document npm-only install.
46
+ 3. **`docs-style` gate is too strict** for playbook OKF (expects purpose/owner-source on every page). Make playbook profile softer or map to existing `check:okf-type`.
47
+ 4. **HumanDoc join rate low on AKOS** (2/82) — product Fumadocs tree is thin vs package atlas; support multi-human corpora (product + `docs/adr`) and/or ownership `humanDoc` from for-agents frontmatter.
48
+
49
+ ### P1 DX
50
+ 5. **Nested agent corpus inside human tree** (agentskit for-agents under `content/docs`) double-counts unless human meta exclude — works but humanDoc points at `/docs/for-agents/core` which is correct for that site.
51
+ 6. **Playbook is pattern-owned, not package-owned** — ownership generation from filenames works; first-class `routing.plugin: pattern-files` would help.
52
+ 7. **Registry human plain-markdown** + URL prefix `/agents/:id` works; committed `public/llms.txt` must stay owner of site discovery (`llmsTxt.enabled: false`).
53
+ 8. **AKOS pnpm store mismatch** can block `pnpm add` — dogfood via absolute `ak-docs` still validates; install needs store alignment.
54
+
55
+ ### P2 ecosystem
56
+ 9. Ship **npm package** publicly (`@agentskit/doc-bridge@alpha`) so consumers drop `file:`.
57
+ 10. Wire `docs:bridge:gate` into each CI (`check:quality-gates` / registry verify / new playbook workflow).
58
+ 11. Federation: registry `llms.txt` still 404 online — dogfood configs already list it; fix registry publish of Self-Describe artifact.
59
+
60
+ ## Per-repo config notes
61
+
62
+ ### agentskit
63
+ - Agent: `apps/docs-next/content/docs/for-agents`
64
+ - Human: Fumadocs same docs tree
65
+ - Routing: `pnpm-monorepo` `packages/*`
66
+ - Best fit: clean monorepo + for-agents coverage already exists
67
+
68
+ ### agentskit-os
69
+ - Agent: `docs/for-agents` (canonical)
70
+ - Human: product Fumadocs only (`apps/web/content/docs`) — dual human later
71
+ - `llmsTxt.enabled: false` (keep `gen-self-describe`)
72
+ - Dual-run with `docs:internal` — do not delete internal generators yet
73
+
74
+ ### agents-playbook
75
+ - Agent = human = `content/docs` (OKF)
76
+ - Ownership: generated per pattern file under pillars
77
+ - Gates: `index-freshness` + `okf-type` only (not docs-style)
78
+
79
+ ### agentskit-registry
80
+ - Agent root: `registry/**/README.md`
81
+ - Ownership: one entry per agent id
82
+ - npm package (not pnpm workspace)
83
+ - `llmsTxt.enabled: false`
84
+
85
+ ## Commands used to validate
86
+
87
+ ```bash
88
+ ak-docs index
89
+ ak-docs gate run
90
+ ak-docs query package <id> --agent
91
+ ak-docs list packages --text
92
+ ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentskit/doc-bridge",
3
- "version": "0.1.0-alpha.1",
3
+ "version": "0.1.0-alpha.3",
4
4
  "description": "Human↔agent documentation bridge — deterministic handoffs, doc-site links, memory→docs, optional AgentsKit RAG/chat.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -21,6 +21,7 @@
21
21
  "files": [
22
22
  "dist",
23
23
  "bin",
24
+ "scripts/prepare.mjs",
24
25
  "docs",
25
26
  "examples",
26
27
  "README.md",
@@ -28,7 +29,10 @@
28
29
  "SECURITY.md",
29
30
  "CODE_OF_CONDUCT.md",
30
31
  "CHANGELOG.md",
31
- "LICENSE"
32
+ "LICENSE",
33
+ "tsup.config.ts",
34
+ "tsconfig.json",
35
+ "src"
32
36
  ],
33
37
  "scripts": {
34
38
  "build": "tsup",
@@ -42,7 +46,9 @@
42
46
  "changeset": "changeset",
43
47
  "version-packages": "changeset version",
44
48
  "release": "pnpm build && pnpm test && changeset publish",
45
- "prepublishOnly": "pnpm build && pnpm test"
49
+ "prepublishOnly": "pnpm build && pnpm test",
50
+ "prepare": "node scripts/prepare.mjs",
51
+ "prepack": "pnpm build"
46
52
  },
47
53
  "keywords": [
48
54
  "agentskit",
@@ -69,20 +75,32 @@
69
75
  "zod": "^3.24.2"
70
76
  },
71
77
  "peerDependencies": {
72
- "@agentskit/adapters": "^0.13.0",
73
- "@agentskit/core": "^1.10.0",
74
- "@agentskit/ink": "^0.9.0",
75
- "@agentskit/memory": "^0.10.0",
76
- "@agentskit/rag": "^0.4.0",
78
+ "@agentskit/adapters": ">=0.12.0 <1",
79
+ "@agentskit/core": ">=1.0.0 <2",
80
+ "@agentskit/ink": ">=0.8.0 <1",
81
+ "@agentskit/memory": ">=0.9.0 <1",
82
+ "@agentskit/rag": ">=0.3.0 <1",
77
83
  "react": ">=18.0.0"
78
84
  },
79
85
  "peerDependenciesMeta": {
80
- "@agentskit/adapters": { "optional": true },
81
- "@agentskit/core": { "optional": true },
82
- "@agentskit/ink": { "optional": true },
83
- "@agentskit/memory": { "optional": true },
84
- "@agentskit/rag": { "optional": true },
85
- "react": { "optional": true }
86
+ "@agentskit/adapters": {
87
+ "optional": true
88
+ },
89
+ "@agentskit/core": {
90
+ "optional": true
91
+ },
92
+ "@agentskit/ink": {
93
+ "optional": true
94
+ },
95
+ "@agentskit/memory": {
96
+ "optional": true
97
+ },
98
+ "@agentskit/rag": {
99
+ "optional": true
100
+ },
101
+ "react": {
102
+ "optional": true
103
+ }
86
104
  },
87
105
  "devDependencies": {
88
106
  "@changesets/cli": "^2.31.0",
@@ -0,0 +1,44 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * Ensure dist/ exists for git installs and local clones.
4
+ * Published npm tarballs already include dist/ — this is a no-op then.
5
+ */
6
+ import { existsSync } from 'node:fs'
7
+ import { spawnSync } from 'node:child_process'
8
+ import { dirname, join } from 'node:path'
9
+ import { fileURLToPath } from 'node:url'
10
+
11
+ const root = join(dirname(fileURLToPath(import.meta.url)), '..')
12
+ const marker = join(root, 'dist', 'cli', 'program.js')
13
+
14
+ if (existsSync(marker)) {
15
+ process.exit(0)
16
+ }
17
+
18
+ const attempts = [
19
+ ['pnpm', ['exec', 'tsup']],
20
+ ['npx', ['--yes', 'tsup@8.5.1']],
21
+ ['npm', ['exec', '--', 'tsup']],
22
+ ]
23
+
24
+ let ok = false
25
+ for (const [cmd, args] of attempts) {
26
+ const result = spawnSync(cmd, args, {
27
+ cwd: root,
28
+ stdio: 'inherit',
29
+ env: process.env,
30
+ shell: process.platform === 'win32',
31
+ })
32
+ if (result.status === 0 && existsSync(marker)) {
33
+ ok = true
34
+ break
35
+ }
36
+ }
37
+
38
+ if (!ok) {
39
+ process.stderr.write(
40
+ '[@agentskit/doc-bridge] prepare: could not build dist/. Run: pnpm build (or npm run build)\n',
41
+ )
42
+ // Don't fail install of dependents hard when used as file: link with prebuilt dist elsewhere
43
+ process.exit(0)
44
+ }