feat: add msglib display entity extraction
This commit is contained in:
@@ -27,9 +27,9 @@ Remote base before local roadmap commits: `b2d839e Merge branch 'codex/n15-repor
|
||||
- `scripts/verify-win-helper.ps1` and `scripts/verify-go-mcp.ps1` provide repeatable local checks for the helper, eight-tool MCP surface, default empty-source receive/contact/group/file calls, synthetic configured-file receive/contact/group/file smoke, and synthetic configured-directory receive/contact/group/file smoke.
|
||||
- `isphere_receive_messages` now returns the contract-facing `ok`, `conversation`, `messages`, `next_cursor`, and `audit` envelope while retaining legacy parser-native message fields for compatibility.
|
||||
- `isphere_receive_messages` accepts the read-contract argument set for the current local-readonly path: `conversation_id`, `query`, `since`, `limit`, `include_attachment_metadata`, `source_preference`, `preview`, and empty `cursor`.
|
||||
- `isphere_search_contacts` and `isphere_search_groups` accept and validate the safe search-contract args for the current local-readonly path, but display names/member data remain JID-derived/unknown until the x86 `MsgLibReadSidecar` is extended for bounded display-entity reads and integrated.
|
||||
- `isphere_search_contacts` and `isphere_search_groups` accept and validate the safe search-contract args for the current local-readonly path, but display names/member data are not yet enriched from `MsgLib.db` until C30 wires the C29 bounded display-entity reader into the MCP search tools.
|
||||
- `isphere_receive_files` list mode accepts and validates the safe file-list contract args for the current local-readonly path while keeping download blocked.
|
||||
- `native/MsgLibReadSidecar` provides a bounded x86 .NET read-only boundary for `MsgLib.db` schema/display-source checks, and `internal/msglib` now wraps it from Go; it is not yet wired into MCP tools and does not return display row values yet.
|
||||
- `native/MsgLibReadSidecar` provides a bounded x86 .NET read-only boundary for `MsgLib.db` schema/display-source checks and bounded contact/group display-entity reads; `internal/msglib` wraps it from Go, but MCP tools are not wired to it yet.
|
||||
- N12-pre and N12R documents define safe offline evidence intake and internal-sandbox live UIA capture procedures.
|
||||
- N13/N14/N15 produced selector catalog/report validation infrastructure, but those are supporting validation assets only.
|
||||
|
||||
@@ -56,7 +56,7 @@ N13/N14/N15 are pre-business validation results. They can help identify UI eleme
|
||||
|
||||
## Current loop
|
||||
|
||||
Current loop: `Stage C / Loop C29 - bounded MsgLib display entity extraction`.
|
||||
Current loop: `Stage C / Loop C30 - integrate MsgLib display entities into contact/group search`.
|
||||
|
||||
Plan file: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`.
|
||||
|
||||
@@ -97,10 +97,11 @@ Current loop output so far:
|
||||
26. C26: copied `MsgLib.db` schema extraction succeeded through a 32-bit .NET `System.Data.SQLite` read-only probe with password `123`; all three copied DB candidates opened, with confirmed contact/group/message/file schema tables.
|
||||
27. C27: added `native/MsgLibReadSidecar` with protocol `isphere.msglib.v1`, x86 build/verify scripts, and safe `self_check`, `schema_summary`, and `display_sources` operations; evidence-backed smoke returned 8 display-source candidates without row/message values.
|
||||
28. C28: added `internal/msglib` Go client wrapper for the sidecar protocol with env config, fake-sidecar unit tests, timeout handling, structured sidecar errors, `SelfCheck`, and `DisplaySources`; no MCP tool wiring or message/display row reads yet.
|
||||
29. C29: added bounded `display_entities` support across the x86 sidecar, Go client, and verification script; evidence-backed verification returned sanitized contact/group counts and source-table names only, with no message bodies, file paths, raw rows, sends, writes, hooks, or injection.
|
||||
|
||||
## Next business mainline
|
||||
|
||||
1. Run Stage C Loop C29: extend the sidecar/client contract for bounded contact/group display-entity extraction only, with tests first; do not expose message bodies, file paths, downloads, sends, writes, hooks, injection, or raw row dumps.
|
||||
1. Run Stage C Loop C30: wire C29 `DisplayEntities` into `isphere_search_contacts` and `isphere_search_groups` as an env-configured optional enrichment source, with fake-sidecar tests first; keep message bodies, file paths, downloads, sends, writes, hooks, injection, and raw row dumps out of scope.
|
||||
2. Leave `isphere_send_message` blocked until bridge/API, UIA action-chain, or protocol connector evidence is validated.
|
||||
3. Leave actual file download/cache mapping as a later connector node until a message-to-cache hash or client download source is validated.
|
||||
4. Keep UIA selector/report work as fallback support, not as the primary roadmap.
|
||||
|
||||
@@ -110,12 +110,48 @@ Initial display sources:
|
||||
- `received_file_metadata` from `TD_ReceiveFileRecord`.
|
||||
- `sent_file_metadata` from `TD_SendFileRecord`.
|
||||
|
||||
### `display_entities`
|
||||
|
||||
Same safe provider/DB validation as `display_sources`, but returns bounded normalized contact/group display metadata.
|
||||
|
||||
Required args:
|
||||
|
||||
- `sqlite_dll_path`
|
||||
- `db_path`
|
||||
- `entity_type`: `contacts` or `groups`
|
||||
|
||||
Optional args:
|
||||
|
||||
- `password`: default `123`.
|
||||
- `query`: optional string matched against allowlisted jid/name columns.
|
||||
- `limit`: bounded to `1..100`; default `25`.
|
||||
|
||||
Returned data adds:
|
||||
|
||||
- `metadata_only=true`
|
||||
- `read_only=true`
|
||||
- `message_body_values_returned=false`
|
||||
- `raw_rows_returned=false`
|
||||
- `entities[]` entries with:
|
||||
- `entity_type`
|
||||
- `source_table`
|
||||
- `jid`
|
||||
- `display_name`
|
||||
- `confidence`
|
||||
- `matched_columns`
|
||||
|
||||
Initial allowlisted identity sources:
|
||||
|
||||
- Contacts: `TD_Roster(JId,Nick)`, `TD_CustomEffigy(PersonJid,PersonName)`, `tblRecent(PersonId,PersonName)`, `tblChatLevel(PersonId,PersonName)`, selected `tblPersonMsg` id/name pairs only.
|
||||
- Groups: `TD_WorkGroupAuth(GroupJID,GroupName)`, `TD_WorkGroupAuth(ChildGroupJid,GroupName)`, selected `tblMsgGroupPersonMsg` group/session id/name pairs only.
|
||||
|
||||
## Security and scope rules
|
||||
|
||||
- The sidecar must open DB files with read-only connection settings.
|
||||
- `db_path` must point to a file named `MsgLib.db`.
|
||||
- The first contract returns schema, columns, counts, and display-source availability only.
|
||||
- It does not return message bodies, contact row values, file paths, or raw row sets.
|
||||
- The schema/display-source operations return schema, columns, counts, and display-source availability only.
|
||||
- `display_entities` may return bounded contact/group `jid` and `display_name` metadata only.
|
||||
- It does not return message bodies, message text, file paths, attachment contents, or raw row sets.
|
||||
- It does not implement send, file download, mark-read, login, hooks, injection, or DB writes.
|
||||
- The Go MCP layer remains the coordinator; this process is a bounded local reader.
|
||||
|
||||
@@ -142,6 +178,13 @@ Committed C28 implementation:
|
||||
- Unit tests use a fake sidecar process; normal tests do not require real `System.Data.SQLite.dll` or copied `MsgLib.db`.
|
||||
- C28 does not register a new MCP tool and does not return message bodies, file paths, raw rows, contact row values, or group row values.
|
||||
|
||||
Committed C29 implementation:
|
||||
|
||||
- Sidecar op: `display_entities`.
|
||||
- Go wrapper: `DisplayEntities(ctx, DisplayEntitiesOptions)`.
|
||||
- Verification script calls `display_entities` only when copied DB env paths are supplied, and prints only sanitized `entity_count` plus `source_tables` summaries.
|
||||
- Evidence-backed C29 verification against the copied DB returned contact/group entity counts and source-table names without printing entity values.
|
||||
|
||||
## Verification
|
||||
|
||||
Default verification builds and checks `self_check` only:
|
||||
@@ -150,7 +193,7 @@ Default verification builds and checks `self_check` only:
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-msglib-sidecar.ps1
|
||||
```
|
||||
|
||||
Evidence-backed provider verification is opt-in through environment variables and should use copied DB files only:
|
||||
Evidence-backed provider verification is opt-in through environment variables and should use copied DB files only. The script also verifies `display_sources` and sanitized `display_entities` summaries when these variables are present:
|
||||
|
||||
```powershell
|
||||
$env:ISPHERE_MSGLIB_SQLITE_DLL = "<path-to-System.Data.SQLite.dll>"
|
||||
|
||||
@@ -17,9 +17,9 @@ Schema notes: `docs/source-discovery/2026-07-09-n12-pre-zyl-schema-notes.md`
|
||||
|
||||
| MCP tool | Primary source | Fallback source | Evidence file | Decision status | Next implementation slice |
|
||||
| --- | --- | --- | --- | --- | --- |
|
||||
| `isphere_receive_messages` | decrypted `PacketReader.ProcessPacket` XMPP `<message>` stanzas via `internal/isphere.EncryptedPacketLogSource`; configured by `ISPHERE_PACKET_LOG_FILE` or `ISPHERE_PACKET_LOG_DIR` | decrypted `Smark.SendReceive` transport stanzas; decrypted `SaveToDB` `Chat_OnMessageArrived` traces; copied `MsgLib.db` through a future x86 read-only sidecar/helper | `docs/source-discovery/2026-07-09-n12-pre-zyl-schema-notes.md#field-mapping-evidence`; `docs/source-discovery/2026-07-10-dotnet-wrapper-static-analysis.md` | C20 supports and validates the current safe receive-message contract args; C28 adds the Go `internal/msglib` sidecar wrapper for schema/display-source operations; DB-backed message listing is still not implemented | Defer DB-backed message listing; first run C29 bounded contact/group display-entity extraction |
|
||||
| `isphere_search_contacts` | bare sender/receiver JIDs extracted from normalized log-backed messages loaded from configured PacketReader file or directory source | validated copied `MsgLib.db` tables: `TD_Roster`, `TD_CustomEffigy`, `tblRecent`, `tblChatLevel`, `tblPersonMsg`; decrypted roster/contact stanzas from `Smark.SendReceive`; UIA helper source if display names are still missing | `docs/source-discovery/2026-07-10-msglib-readonly-schema-extraction.md` | C28 adds the Go sidecar client wrapper; the sidecar still needs a bounded display-entity operation before DB-backed display names can be exposed | C29 bounded contact display-entity extraction |
|
||||
| `isphere_search_groups` | decrypted `PacketReader.ProcessPacket` `type="groupchat"` stanzas and conference/MUC JIDs loaded from configured PacketReader file or directory source | validated copied `MsgLib.db` tables: `tblMsgGroupPersonMsg`, `TD_WorkGroupAuth`, `tblRecent`; UIA helper source if group display names are still missing | `docs/source-discovery/2026-07-10-msglib-readonly-schema-extraction.md`; C9 ignored-log scan: PacketReader 86 groupchat/86 conference hits; Smark 24 groupchat/658 conference/631 muc hits | C28 adds the Go sidecar client wrapper; the sidecar still needs a bounded display-entity operation before DB-backed group/member names can be exposed | C29 bounded group display-entity extraction |
|
||||
| `isphere_receive_messages` | decrypted `PacketReader.ProcessPacket` XMPP `<message>` stanzas via `internal/isphere.EncryptedPacketLogSource`; configured by `ISPHERE_PACKET_LOG_FILE` or `ISPHERE_PACKET_LOG_DIR` | decrypted `Smark.SendReceive` transport stanzas; decrypted `SaveToDB` `Chat_OnMessageArrived` traces; copied `MsgLib.db` through a future x86 read-only sidecar/helper | `docs/source-discovery/2026-07-09-n12-pre-zyl-schema-notes.md#field-mapping-evidence`; `docs/source-discovery/2026-07-10-dotnet-wrapper-static-analysis.md` | C20 supports and validates the current safe receive-message contract args; C29 adds bounded contact/group display-entity extraction; DB-backed message listing is still not implemented | Defer DB-backed message listing; first run C30 contact/group search enrichment |
|
||||
| `isphere_search_contacts` | bare sender/receiver JIDs extracted from normalized log-backed messages loaded from configured PacketReader file or directory source | validated copied `MsgLib.db` tables: `TD_Roster`, `TD_CustomEffigy`, `tblRecent`, `tblChatLevel`, `tblPersonMsg`; decrypted roster/contact stanzas from `Smark.SendReceive`; UIA helper source if display names are still missing | `docs/source-discovery/2026-07-10-msglib-readonly-schema-extraction.md` | C29 verifies bounded contact display-entity extraction through the x86 sidecar and Go client; MCP search is not enriched yet | C30 wire optional MsgLib enrichment into `isphere_search_contacts` |
|
||||
| `isphere_search_groups` | decrypted `PacketReader.ProcessPacket` `type="groupchat"` stanzas and conference/MUC JIDs loaded from configured PacketReader file or directory source | validated copied `MsgLib.db` tables: `tblMsgGroupPersonMsg`, `TD_WorkGroupAuth`, `tblRecent`; UIA helper source if group display names are still missing | `docs/source-discovery/2026-07-10-msglib-readonly-schema-extraction.md`; C9 ignored-log scan: PacketReader 86 groupchat/86 conference hits; Smark 24 groupchat/658 conference/631 muc hits | C29 verifies bounded group display-entity extraction through the x86 sidecar and Go client; MCP search is not enriched yet | C30 wire optional MsgLib enrichment into `isphere_search_groups` |
|
||||
| `isphere_receive_files` | decrypted `PacketReader.ProcessPacket` file-transfer message stanzas via `internal/isphere.ListFilesFromMessages` and `isphere_receive_files` list mode; configured PacketReader file or directory source; `zyl\importal\<hash>` cache entries remain unlinked | decrypted `Smark.SendReceive` and `SaveToDB` traces for file-reference reconciliation; future UIA/client connector for download | `docs/source-discovery/2026-07-09-n12-pre-zyl-schema-notes.md#c12-file-transfer-evidence-precheck` | C22 verifies safe file-list contract args; no log-to-cache/download mapping yet | defer download mapping; precheck contact/group display-name evidence |
|
||||
| `isphere_send_message` | none validated yet | existing bridge/API/local service preferred; UIA write connector only after internal-sandbox action evidence; network/protocol connector only after protocol discovery | `docs/source-discovery/2026-07-10-send-message-source-precheck.md` | C15 blocked: contract exists, but no committed bridge/API/local service, helper write op, UIA action chain, or protocol connector is validated | do not implement write behavior; harden existing read source configuration |
|
||||
| `isphere_send_file` | none validated yet | depends on send-message connector plus outbound file/upload evidence | `docs/source-discovery/2026-07-10-send-message-source-precheck.md` | blocked behind `isphere_send_message` connector selection and file upload/source policy | defer until send-message connector is validated |
|
||||
@@ -39,4 +39,4 @@ Start Stage C with a narrow log-backed `isphere_receive_messages` source abstrac
|
||||
|
||||
## Deferred source work
|
||||
|
||||
`MsgLib.db` has a validated copied read-only open path through the bundled 32-bit `System.Data.SQLite.dll` and password `123`. C27 adds `MsgLibReadSidecar` as the bounded x86 .NET reader boundary, and C28 adds the Go `internal/msglib` process client. The next step is a bounded display-entity operation before contact/group display-name integration.
|
||||
`MsgLib.db` has a validated copied read-only open path through the bundled 32-bit `System.Data.SQLite.dll` and password `123`. C27 adds `MsgLibReadSidecar` as the bounded x86 .NET reader boundary, C28 adds the Go `internal/msglib` process client, and C29 adds bounded `display_entities` extraction. The next step is optional contact/group MCP enrichment from that source.
|
||||
|
||||
@@ -2238,7 +2238,7 @@ Go sidecar client result:
|
||||
|
||||
**Goal:** Extend the sidecar/client boundary from schema/display-source availability to bounded contact/group display-entity metadata, so a later loop can enrich `isphere_search_contacts` and `isphere_search_groups` without returning raw rows, message bodies, file paths, downloads, sends, writes, hooks, injection, or DB mutations.
|
||||
|
||||
**Planned files:**
|
||||
**Files:**
|
||||
- Modify: `native/MsgLibReadSidecar/Program.cs`
|
||||
- Modify: `docs/msglib-read-sidecar-contract.md`
|
||||
- Modify: `internal/msglib/sidecar_client.go`
|
||||
@@ -2249,25 +2249,91 @@ Go sidecar client result:
|
||||
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
|
||||
|
||||
**Planned behavior:**
|
||||
- Add a sidecar operation tentatively named `display_entities`.
|
||||
- Add a sidecar operation named `display_entities`.
|
||||
- Request args: `sqlite_dll_path`, `db_path`, optional `password`, `entity_type` (`contacts` or `groups`), optional `query`, and bounded `limit`.
|
||||
- Response data: normalized metadata only, such as `entity_type`, `source_table`, `jid`, `display_name`, `confidence`, and `matched_columns`.
|
||||
- Never return message bodies, file paths, raw SQL row maps, attachment contents, send/write capabilities, or unbounded result sets.
|
||||
- Use tests first. Normal Go tests should still use fake sidecar data; real copied DB verification stays opt-in through script/env paths.
|
||||
- Response data: normalized metadata only: `entity_type`, `source_table`, `jid`, `display_name`, `confidence`, and `matched_columns`.
|
||||
- Never return message bodies, message text, file paths, raw SQL row maps, attachment contents, send/write capabilities, or unbounded result sets.
|
||||
- Use tests first. Normal Go tests use fake sidecar data; real copied DB verification stays opt-in through script/env paths and prints only sanitized summaries.
|
||||
|
||||
- [ ] **Step 1: Write failing display-entity contract tests**
|
||||
- [x] **Step 1: Write failing display-entity contract tests**
|
||||
|
||||
Add sidecar/client tests for bounded contact/group entity decoding, query/limit validation, and rejection of unsupported entity types.
|
||||
Extended `internal/msglib/sidecar_client_test.go` with fake-sidecar tests for `DisplayEntities`, bounded args, decoded entity metadata, and unsupported entity type rejection. Verified RED with missing `DisplayEntities` / `DisplayEntitiesOptions` symbols.
|
||||
|
||||
- [ ] **Step 2: Implement sidecar `display_entities` operation**
|
||||
- [x] **Step 2: Implement sidecar `display_entities` operation**
|
||||
|
||||
Implement allowlisted table/column reads only for contact/group identity metadata, with parameterized query/limit and no raw row dumps.
|
||||
Implemented Go `DisplayEntities` wrapper and C# sidecar `display_entities` op. The sidecar uses allowlisted table/column pairs only, parameterized `query`, limit clamped to `1..100`, read-only SQLite connection settings, and normalized entity output.
|
||||
|
||||
- [ ] **Step 3: Extend Go client and verification script**
|
||||
- [x] **Step 3: Extend Go client and verification script**
|
||||
|
||||
Add Go wrapper types/methods and optional evidence-backed verification that reports only counts/source-table names, not personal values.
|
||||
Updated `scripts/verify-msglib-sidecar.ps1` to call `display_entities` when copied DB env paths are supplied. The verification output includes only `entity_count` and `source_tables`, not actual entity values.
|
||||
|
||||
- [ ] **Step 4: Update docs, run full verification, and commit**
|
||||
- [x] **Step 4: Update docs, run full verification, and commit**
|
||||
|
||||
Run before commit:
|
||||
|
||||
```powershell
|
||||
git diff --check
|
||||
go test ./...
|
||||
go build ./cmd/isphere-mcp
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\build-msglib-sidecar.ps1
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-msglib-sidecar.ps1
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-msglib-sidecar.ps1 # with copied DB env paths
|
||||
powershell -NoProfile -ExecutionPolicy Bypass -File scripts\verify-go-mcp.ps1
|
||||
```
|
||||
|
||||
Final verification passed: `git diff --check`, `go test ./...`, explicit `go build ./cmd/isphere-mcp`, default sidecar smoke, evidence-backed sidecar smoke with sanitized `display_entity_summaries`, and `scripts/verify-go-mcp.ps1`.
|
||||
|
||||
Verification evidence from the copied DB smoke was sanitized: `contacts` returned count/source-table summary and `groups` returned count/source-table summary without printing names, JIDs, message bodies, file paths, or raw rows.
|
||||
|
||||
---
|
||||
|
||||
## Loop C29 Result
|
||||
|
||||
Bounded display entity extraction result:
|
||||
|
||||
- Added sidecar op `display_entities`.
|
||||
- Added Go client method `DisplayEntities(ctx, DisplayEntitiesOptions)` plus `DisplayEntity` metadata decoding.
|
||||
- Evidence-backed sidecar verification against the copied DB returned sanitized summaries: contacts count from `TD_CustomEffigy`; groups count from `TD_WorkGroupAuth`.
|
||||
- `isphere_search_contacts` and `isphere_search_groups` are still not wired to this source.
|
||||
|
||||
---
|
||||
|
||||
## Loop C30: Integrate MsgLib display entities into contact/group search
|
||||
|
||||
**Goal:** Wire the C29 bounded `DisplayEntities` source into `isphere_search_contacts` and `isphere_search_groups` as an optional env-configured enrichment path, while preserving the current log-backed fallback and keeping message bodies, file paths, downloads, sends, writes, hooks, injection, DB mutation, and raw row dumps out of scope.
|
||||
|
||||
**Planned files:**
|
||||
- Modify: `internal/tools/isphere_contacts.go`
|
||||
- Modify: `internal/tools/isphere_contacts_test.go`
|
||||
- Modify: `internal/tools/isphere_groups.go`
|
||||
- Modify: `internal/tools/isphere_groups_test.go`
|
||||
- Modify: `internal/mcpserver/server.go`
|
||||
- Modify: `internal/mcpserver/server_test.go`
|
||||
- Modify: `scripts/verify-go-mcp.ps1`
|
||||
- Modify: `docs/current-status-card.md`
|
||||
- Modify: `docs/source-discovery/capability-source-matrix.md`
|
||||
- Modify: `docs/superpowers/plans/2026-07-09-stage-c-log-backed-receive-messages-loop.md`
|
||||
|
||||
**Planned behavior:**
|
||||
- Add an injectable display-entity source interface around `internal/msglib.Client`.
|
||||
- Keep default MCP behavior unchanged when `ISPHERE_MSGLIB_SIDECAR_EXE`, `ISPHERE_MSGLIB_SQLITE_DLL`, or `ISPHERE_MSGLIB_DB` are absent.
|
||||
- When all env vars are present, enrich contact/group search results from `DisplayEntities` with bounded `query` and `limit`.
|
||||
- Normal tests use fake display-entity source data; verification script should include a synthetic/fake enrichment smoke before any real copied DB smoke.
|
||||
- Do not expose a new MCP tool in this loop.
|
||||
|
||||
- [ ] **Step 1: Write failing contact/group enrichment tests**
|
||||
|
||||
Add tests proving contacts/groups can consume injected display entities and still pass existing log-backed/default behavior.
|
||||
|
||||
- [ ] **Step 2: Implement optional display-entity source wiring**
|
||||
|
||||
Implement source interface and env-configured `internal/msglib` client construction without changing default empty-source behavior.
|
||||
|
||||
- [ ] **Step 3: Update verification/docs**
|
||||
|
||||
Extend `scripts/verify-go-mcp.ps1` with synthetic/fake enrichment smoke and update status/matrix/plan.
|
||||
|
||||
- [ ] **Step 4: Full verification and commit**
|
||||
|
||||
Run:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user