brainclaw 1.23.0 → 1.25.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/dist/brainclaw-vscode.vsix +0 -0
- package/dist/cli/register-cloud.js +121 -13
- package/dist/cli/register-code-map.js +9 -2
- package/dist/commands/cloud.js +534 -39
- package/dist/commands/code-map.js +119 -2
- package/dist/commands/mcp-catalog.js +46 -0
- package/dist/commands/mcp.js +54 -2
- package/dist/core/code-map/backend.js +158 -1
- package/dist/core/code-map/export.js +212 -0
- package/dist/core/code-map/freshness.js +3 -2
- package/dist/core/code-map/impact.js +377 -0
- package/dist/core/code-map/indexes.js +27 -3
- package/dist/core/code-map/lang/typescript/config.js +271 -0
- package/dist/core/code-map/lang/typescript/index.js +20 -4
- package/dist/core/code-map/query.js +76 -13
- package/dist/core/code-map/refresh.js +0 -0
- package/dist/core/code-map/resolve.js +1 -0
- package/dist/core/code-map/types.js +15 -0
- package/dist/core/federation-emit.js +283 -0
- package/dist/core/federation-grant-transport.js +196 -0
- package/dist/core/federation-grant.js +223 -0
- package/dist/core/federation-keyring.js +39 -0
- package/dist/core/federation-opaque-ids.js +111 -0
- package/dist/core/federation-outbox-v2.js +36 -2
- package/dist/core/federation-pairing.js +87 -12
- package/dist/core/federation-pull.js +523 -0
- package/dist/core/federation-push.js +287 -0
- package/dist/core/federation-rotation.js +124 -0
- package/dist/core/federation-state.js +81 -6
- package/dist/core/protocol-tool-policy.js +3 -0
- package/dist/core/worktree.js +89 -2
- package/dist/facts.js +14 -11
- package/dist/facts.json +13 -10
- package/docs/cli.md +8 -0
- package/docs/code-map.md +24 -1
- package/docs/design/federation-onboarding-usecases.md +254 -0
- package/docs/design/pairing-v3-brief.md +80 -0
- package/docs/integrations/mcp.md +5 -2
- package/docs/mcp-schema-changelog.md +11 -1
- package/package.json +1 -1
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
# Idéation — repenser l'appairage de la fédération v2 (dec#158)
|
|
2
|
+
|
|
3
|
+
**Direction opérateur (2026-08-09) :** un compte cloud doit gérer le solo-dev **et** l'équipe
|
|
4
|
+
sans deux modèles distincts. L'admin du compte invite des utilisateurs **humains** par leur
|
|
5
|
+
email ; chaque humain appaire ensuite **ses propres** agents.
|
|
6
|
+
|
|
7
|
+
## État mesuré aujourd'hui — vérifié sur le code, ne pas re-supposer
|
|
8
|
+
|
|
9
|
+
- `handleAddProjectMember` (`src/handlers/projects.ts`) cherche l'utilisateur **par email**
|
|
10
|
+
mais exige qu'il **existe déjà** : sinon `404 No user found with email`. Aucun flux
|
|
11
|
+
d'invitation — la personne doit s'inscrire d'abord, puis être ajoutée.
|
|
12
|
+
- **Aucun envoi d'email** dans tout le backend.
|
|
13
|
+
- `enrollments` porte `invited_by_user_id` (qui a invité) mais **aucun lien** vers l'humain
|
|
14
|
+
**propriétaire** de l'appareil.
|
|
15
|
+
- L'invitation d'agent est créée par quiconque détient `enrollments.invite` sur le projet.
|
|
16
|
+
- Cycle actuel d'un appareil : invite → claim → PoP → attestation X25519 → approbation
|
|
17
|
+
humaine → active.
|
|
18
|
+
- Le scellement se fait sous une **clé d'epoch de projet**
|
|
19
|
+
(`buildEnvelope(keyEpoch)`, `epochPublicKey(cloudProjectId, epoch)`), **pas par appareil**.
|
|
20
|
+
Chaque appareil détient un **jeu** d'epochs (`heldEpochs`, `storeEpochPrivateKey`).
|
|
21
|
+
- **Rien ne projette encore** : `buildEnvelope` a zéro appelant hors sa définition, l'outbox
|
|
22
|
+
v2 n'est jamais alimentée, 0 enveloppe reçue côté cloud.
|
|
23
|
+
|
|
24
|
+
## Les trois conséquences à traiter, pas à redécouvrir
|
|
25
|
+
|
|
26
|
+
1. **Qui approuve un agent doit changer.** L'approbation repose sur la comparaison hors
|
|
27
|
+
bande de deux empreintes entre l'écran web et le terminal de l'appareil. Un admin ne peut
|
|
28
|
+
pas vérifier le terminal d'un tiers : lui faire approuver l'agent d'autrui transforme la
|
|
29
|
+
vérification en clic de confiance et rouvre l'attaque de l'homme du milieu que la
|
|
30
|
+
cérémonie ferme (dec#8).
|
|
31
|
+
2. **Un nouveau membre ne lit que les epochs qu'on lui remet.** Il ne peut rien lire du passé
|
|
32
|
+
tant qu'un membre existant ne lui transmet pas les epochs antérieurs, ou ne rescelle pas.
|
|
33
|
+
3. **Chargement de l'historique et invitation d'équipe sont le même problème** : qui remet
|
|
34
|
+
quelles clés d'epoch à qui, et quand. Les traiter séparément produirait deux mécanismes de
|
|
35
|
+
transfert de clés — donc deux endroits où une clé peut aller où elle ne devrait pas.
|
|
36
|
+
|
|
37
|
+
## Ce qui est attendu
|
|
38
|
+
|
|
39
|
+
Proposez une conception, en la défendant sur les points **durs** plutôt que sur la partie
|
|
40
|
+
facile — le formulaire d'invitation par email est trivial et n'intéresse pas.
|
|
41
|
+
|
|
42
|
+
**(a) Modèle d'entités.** Où vivent les humains, où vivent les appareils, quel lien entre les
|
|
43
|
+
deux. Un `owner_user_id` sur `enrollments` suffit-il ?
|
|
44
|
+
|
|
45
|
+
**(b) Qui approuve quoi**, et comment le solo-dev ne subit **pas** la cérémonie d'équipe. Le
|
|
46
|
+
solo doit rester un cas dégénéré du même modèle, pas une branche parallèle.
|
|
47
|
+
|
|
48
|
+
**(c) La remise des clés d'epoch — le cœur du sujet.** Qui la fait, quand, sous quelle
|
|
49
|
+
autorité, avec quelle preuve ? Un membre existant doit-il être **en ligne** pour qu'un
|
|
50
|
+
nouveau membre rejoigne ? Que se passe-t-il si le seul détenteur d'un epoch quitte l'équipe
|
|
51
|
+
ou perd sa machine ? Une clé d'epoch remise **ne se reprend pas** — comme la révocation ne
|
|
52
|
+
retire pas ce qui a déjà été déchiffré.
|
|
53
|
+
|
|
54
|
+
**(d) L'horizon d'un nouveau membre** : tout l'historique, rien, ou borné ? Argumentez le
|
|
55
|
+
défaut, et dites ce qui devient **impossible à corriger après coup**.
|
|
56
|
+
|
|
57
|
+
**(e) La rotation d'epoch sur changement d'appartenance.** Au départ d'un membre, faut-il
|
|
58
|
+
tourner ? Quel est le coût réel, et que protège-t-on exactement sachant que le partant garde
|
|
59
|
+
ce qu'il détient déjà ?
|
|
60
|
+
|
|
61
|
+
**(f) Ce qui casse si le cloud est hostile.** Il orchestre l'appairage, donc il choisit qui
|
|
62
|
+
voit quelle empreinte et quand. Où sa malveillance reste-t-elle **indétectable** ?
|
|
63
|
+
|
|
64
|
+
## Contraintes dures
|
|
65
|
+
|
|
66
|
+
- **dec#154** — le cloud est projection + relais, le local est source de vérité ; chemins
|
|
67
|
+
locaux, hôtes, sessions, clés et secrets **ne sortent jamais**.
|
|
68
|
+
- **dec#155** — le relais cloud n'a ni session, ni cwd, ni contexte ambiant : seulement un id
|
|
69
|
+
d'entité et un `base_rev`.
|
|
70
|
+
- **dec#8** — aucune clé collée à la main, aucune variable d'environnement ; l'humain compare
|
|
71
|
+
des empreintes.
|
|
72
|
+
- Zéro dépendance runtime au-delà de `commander`/`yaml`/`zod` côté core.
|
|
73
|
+
|
|
74
|
+
## Méthode attendue
|
|
75
|
+
|
|
76
|
+
Ne convergez pas trop vite. **Nommez les alternatives que vous écartez** et pourquoi. Si une
|
|
77
|
+
partie du sujet demande un arbitrage **produit** plutôt qu'une réponse technique, dites-le
|
|
78
|
+
explicitement au lieu de trancher à la place de l'opérateur. **Signalez toute prémisse de ce
|
|
79
|
+
brief que le code contredit** — plusieurs affirmations ci-dessus ont été mesurées, mais la
|
|
80
|
+
mesure peut avoir manqué un chemin.
|
package/docs/integrations/mcp.md
CHANGED
|
@@ -25,7 +25,7 @@ The default dynamic workflow is:
|
|
|
25
25
|
1. `bclaw_work` to start the session and load the relevant context in one call (returns compact payload by default — pass `compact: false` for the full context result)
|
|
26
26
|
2. `bclaw_context({ kind: "execution" })` early when the agent needs local tooling signals or package update visibility
|
|
27
27
|
3. `bclaw_context({ kind: "memory" })`, `bclaw_context({ kind: "board" })`, or `bclaw_context({ kind: "delta" })` when the target path changes or full memory is needed beyond the compact summary
|
|
28
|
-
4. `bclaw_code_brief({ target })` / `bclaw_code_find({ query })` before editing unfamiliar code — get a ranked reading list (with related decisions/traps) and locate symbols from the Code Map instead of grepping blind. A `missing_index` badge means run `bclaw_code_refresh` first. See [code map](../code-map.md)
|
|
28
|
+
4. `bclaw_code_brief({ target })` / `bclaw_code_find({ query })` before editing unfamiliar code — get a ranked reading list (with related decisions/traps) and locate symbols from the Code Map instead of grepping blind. Use `bclaw_code_impact({ target, depth: 2 })` when you need an explainable local blast radius; its `tests_for` separates resolved imports from low-confidence filename suggestions. Use `bclaw_code_export({ target, direction, depth, maxNodes, maxEdges })` when you need a compact bounded subgraph; every returned edge keeps `kind`, `source`, and `confidence`, and `format: 'mermaid'` is projected from that same JSON model. A `missing_index` badge means run `bclaw_code_refresh` first. See [code map](../code-map.md)
|
|
29
29
|
5. `bclaw_find` / `bclaw_get` / `bclaw_create` / `bclaw_update` / `bclaw_remove` / `bclaw_transition` for entity reads and writes
|
|
30
30
|
6. `bclaw_coordinate`, `bclaw_dispatch`, or `bclaw_loop` for assign, consult, review, reroute, summarize, dispatch, or multi-turn loop flows
|
|
31
31
|
7. `bclaw_read_inbox` when resuming delegated work
|
|
@@ -47,7 +47,7 @@ Every tool has one of three tiers in its `annotations.tier` field:
|
|
|
47
47
|
- **standard** — Day-to-day coordination tools: plans, claims, messaging, sequences, dispatch, review, memory. Returned by default alongside facades.
|
|
48
48
|
- **advanced** — Specialized governance, audit, registry, and power tools.
|
|
49
49
|
|
|
50
|
-
By default, `tools/list` returns **facade + standard** tools (
|
|
50
|
+
By default, `tools/list` returns **facade + standard** tools (49 tools). To get all tools including advanced, pass `{ "catalog": "all" }`, `{ "include": "all" }`, or `{ "advanced": true }`. To filter by a single tier, pass `{ "tier": "facade" }`, `{ "tier": "standard" }`, or `{ "tier": "advanced" }`.
|
|
51
51
|
|
|
52
52
|
Published tools remain callable regardless of catalog filtering — the tier only affects discovery via `tools/list`.
|
|
53
53
|
|
|
@@ -111,6 +111,9 @@ Each tool also has an `annotations.category` field: `session`, `context`, `memor
|
|
|
111
111
|
| `bclaw_code_status` | discovery | Code Map freshness badge + index stats (store presence, files/nodes/edges) |
|
|
112
112
|
| `bclaw_code_find` | discovery | Search the Code Map symbol index by name (function/class/component/hook/type) |
|
|
113
113
|
| `bclaw_code_brief` | discovery | Ranked reading list + related decisions/traps before editing a symbol or path |
|
|
114
|
+
| `bclaw_code_impact` | discovery | Explainable local blast radius from resolved imports: definition, direct dependents, opt-in bounded transitives, tests, and count-based risk |
|
|
115
|
+
| `bclaw_code_export` | discovery | Compact bounded local nodes/edges around one symbol or file; preserves edge kind/source/confidence, with optional Mermaid projection |
|
|
116
|
+
| `bclaw_code_outline` | discovery | Source-ordered symbols of one indexed file (span, exported, confidence) — no reparse |
|
|
114
117
|
| `bclaw_code_refresh` | discovery | Rebuild the Code Map index (`scope: changed \| all`) |
|
|
115
118
|
|
|
116
119
|
See [code map](../code-map.md) for the full Code Map reference (CLI, freshness model, supported languages).
|
|
@@ -408,7 +408,17 @@ will still succeed. A follow-up PR will strip the dead handler code.
|
|
|
408
408
|
changelog records the published MCP surface fingerprint. When a tool
|
|
409
409
|
name, tier, category, or input schema changes, the test fails until
|
|
410
410
|
this section is updated.
|
|
411
|
-
- MCP public surface fingerprint: `sha256:
|
|
411
|
+
- MCP public surface fingerprint: `sha256:b8dbb80bae8f6e36`
|
|
412
|
+
(updated 2026-08-10 for pln#665: `bclaw_code_export` — additive Tier-B read tool for a required, bounded local Code Map subgraph. Its target, direction, depth, node/edge caps, confidence threshold, and optional Mermaid projection are explicit; JSON retains each relation's kind/source/confidence and never defaults to a whole-graph export.)
|
|
413
|
+
Previous: `sha256:9ed35ed6cc49ea9a`
|
|
414
|
+
(updated 2026-08-10 for pln#661: `bclaw_code_impact` — additive Tier-B read tool
|
|
415
|
+
for local, resolved-import impact analysis. It exposes definition, direct causes,
|
|
416
|
+
optional bounded transitives, tests, and a count-based risk score; its required
|
|
417
|
+
`target` plus optional `depth` and `limit` input surface are explicitly bounded.)
|
|
418
|
+
Previous: `sha256:2a9f7d4cd72609df`
|
|
419
|
+
(updated 2026-08-10 for pln#660: `bclaw_code_outline` — new Tier-B read tool,
|
|
420
|
+
source-ordered symbols of one indexed file from the existing shard; no reparse,
|
|
421
|
+
no mutation, bounded output. Purely additive.)
|
|
412
422
|
(updated 2026-07-25 for pln#632: `bclaw_loop` gains the `bind` intent — an
|
|
413
423
|
implementation loop dispatches its linked sequence and advances bind→execute — plus
|
|
414
424
|
its typed inputSchema properties `dry_run`, `lanes`, `auto_execute`, `model`, and
|