feat: register isphere contact search tool

This commit is contained in:
zhaoyilun
2026-07-09 23:36:10 +08:00
parent 2621d34336
commit 2832e286e7
9 changed files with 266 additions and 26 deletions

View File

@@ -990,7 +990,7 @@ Implemented and verified in this loop:
- Output shape: `ok`, `contacts`, `next_cursor`, `audit` minimal fields aligned with `docs/mcp-core-tools-contract.md`.
- Default empty source returns `ok: true`, `contacts: []`.
- [ ] **Step 1: Write failing tool test**
- [x] **Step 1: Write failing tool test**
Create `internal/tools/isphere_contacts_test.go` and run:
@@ -1000,15 +1000,15 @@ go test ./internal/tools -run TestISphereSearchContactsToolReturnsJIDContacts -v
Expected initial failure: contact tool registration does not exist.
- [ ] **Step 2: Implement contact tool registration**
- [x] **Step 2: Implement contact tool registration**
Register `isphere_search_contacts` with source injection for tests. Use C7 source behavior and return a contract-shaped map with minimal audit metadata.
- [ ] **Step 3: Wire server and verification**
- [x] **Step 3: Wire server and verification**
Register contact search in `mcpserver.NewServerWithReceiveSource` or an equivalent shared source path. Update server tool-count tests and `scripts/verify-go-mcp.ps1` to expect six tools and call `isphere_search_contacts` against both default empty source and synthetic configured fixture.
- [ ] **Step 4: Run full verification and commit**
- [x] **Step 4: Run full verification and commit**
Run:
@@ -1023,6 +1023,54 @@ Expected: all exit 0. Remove any generated root `isphere-mcp.exe` after build. C
---
## Loop C8 Result
Implemented and verified in this loop:
- `internal/tools.RegisterISphereContactTools(server, source)` registers `isphere_search_contacts` over the same receive-message source used by `isphere_receive_messages`.
- `internal/mcpserver.NewServerWithReceiveSource` now exposes six tools: four WinHelper tools, `isphere_receive_messages`, and `isphere_search_contacts`.
- `scripts/verify-go-mcp.ps1` now expects six tools, allows `search` as a legitimate read capability term, and verifies both default empty contact results and configured synthetic contact extraction.
- `isphere_search_contacts` currently returns JID-derived `local_readonly` contacts with minimal audit metadata; richer names remain deferred until roster/db/uia evidence is validated.
- Verification completed for C8 with affected package tests and `powershell -NoProfile -ExecutionPolicy Bypass -File scripts/verify-go-mcp.ps1`; full verification is run again before commit.
---
## Loop C9: Group source evidence precheck
**Goal:** Before implementing `isphere_search_groups`, verify whether the current decrypted log evidence contains group/groupchat identifiers that can support a real source decision instead of guessing.
**Planned files:**
- Modify: `docs/source-discovery/capability-source-matrix.md`
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
- Optionally create a small ignored metadata summary under `runs/` if needed; do not commit raw evidence.
**Planned behavior:**
- Inspect existing ignored N12-pre decrypted metadata or selected decrypted log samples under `runs/` for groupchat stanzas, room/group JIDs, or group display-name clues.
- If evidence exists, write a C10 implementation loop for group candidate extraction.
- If evidence does not exist, mark `isphere_search_groups` blocked on additional roster/group evidence and choose the next read slice (`isphere_receive_files` or contact enrichment) instead.
- [ ] **Step 1: Inspect current source evidence for group identifiers**
Use existing ignored metadata/log summaries under `runs/` and committed schema notes. Do not commit raw logs.
- [ ] **Step 2: Update matrix and next loop**
Record whether group extraction can proceed from current evidence. Rewrite C10 accordingly.
- [ ] **Step 3: Verify docs-only change and commit**
Run:
```powershell
git diff --check
go test ./...
powershell -NoProfile -ExecutionPolicy Bypass -File scripts/verify-go-mcp.ps1
```
Expected: all exit 0. Commit exact C9 paths only.
---
## Self-Review
- Spec coverage: the plan follows the user's cyclic requirement: plan first, implement one loop at a time, update the next loop after each result, and ask only on blockers.