Commit Graph
8 Commits
Author SHA1 Message Date
gabby dff4849947 simplex: honest forwarding — verify sends, disambiguate contacts, read persistent unread
The SimpleX forwarding path could report a failed send as success and could
route to the wrong peer:

- contact_entry dropped the daemon's unique localDisplayName, so two peers
  sharing a profile name ("pepper" / "pepper_1") were indistinguishable; the
  agent's SemIf choice then picked the stale one.
- The bridge's POST /send enqueued the message fire-and-forget and returned
  ok:true; the daemon later marked it sndError (auth), yet the agent reported
  "sent" and assessed success.
- next_message read only the live buffer, missing messages that arrived before
  the bridge started.

Fixes:
- simplex_ws: contact_entry exposes local_name + connected/auth_errors;
  parse_chat_item surfaces the agentError; parse_send_response normalizes a
  /_send reply; add correlated send()/request_send().
- bridges/simplex: resolve disambiguates by id -> local_name/display_name and
  prefers the healthiest peer; send() confirms the real terminal status
  (sndSent/sndRcvd ok, sndError with reason) instead of a false ok; /unread
  carries cached connection health; catalog documents the new fields/status.
- bridges/inbox: carry local_name/connected/auth_errors through the cache.
- seeds/simplex/next_message: fall back to /unread + /history and prefer the
  healthy conversation.
- tests: updated shapes + new coverage for resolution and send verification.
2026-10-07 09:47:26 +00:00
gabby e9a7fc73ee scheduler/gateway: carry skill identity structurally, not in action_log
Skill bodies prefixed their own `category.name` into `ActionResult.action_log`,
which duplicated the runner's deterministic summary prefix and leaked the name
into the text the gateways speak. Identity is not data for the output string.

- bodies (seeds, canned replies, housekeeping meta skills) write only the real
  result; the runner already owns the `category.name:` summary prefix
- `run_queue`/`submit_request`/`answer` now return a structured `SchedulerReply`
  (status, text, run_id, skill_ref, result); the gateway reads `skill_ref` and
  `result` from it instead of regex-parsing them back out of the summary
- drop the gateway's `_SKILL_REF`/`_LEADING_RUN_ID` parsing helpers
- fix a latent double-prefix when a failed run had an empty action_log
- CODEGEN.md: generated bodies must not prefix the skill name
2026-10-07 00:30:37 +00:00
gabby e81e6c3a6b seeds: make calendar.create_event the authoritative example
CODEGEN.md now points to seeds/calendar/create_event/ as the worked example,
and the other seeds mirror it: next_event and next_message gain the
configured-default contract var plus create_event's tau -> default ->
weak-winner candidate resolution, and the shared docstring/banner/_now style.
connect_link gets the style alignment only; create_event itself is unchanged.
2026-10-03 18:07:16 +00:00
gabby 567c280ee2 Remove the predict phase; contract-driven resolution
Skills now have a single `act(ctx, request)` body phase. The free-string
`Prediction.text` handoff, the `Prediction` type, and the predict phase are
gone.

- Resolution is pipeline-owned: the tiered config merge (global -> category ->
  skill) fills contract vars; the authoring-time SemIf search now searches the
  whole cascade; unresolved vars pause pre-act (`pre_act`, renamed from
  `pre_predict`) and are asked of the human one at a time.
- The data contract is a module-level `CONTRACT` constant in the body, parsed by
  `parse_contract`; `contract.json` is a derived mirror. The separate
  `generate_data_contract` codegen call is removed.
- Candidate selection stays in the body: a set of candidates (bridge endpoint,
  direct API, hard-coded list) gets a SemIf query, and the decisions ride back on
  `ActionResult.decisions` to be logged with the run outcome (phase `act`).
- `assess:outcome`/`assess:requeue` state carries the resolved inputs (secrets
  redacted by name) so the decision sees the full query -> resolution -> action
  path.
- Authoring validation enforces: compiles + `act`; `INTEGRATION` flat and valid;
  `CONTRACT` flat str->str; every CONTRACT key actually read from `ctx.config`.
- Test-regen ladder narrowed to code/test (the contract rides in the code).

SKILL.md/TESTGEN.md rewritten; seeds (calendar.next_event, simplex.next_message,
simplex.connect_link) rewritten to act-only + CONTRACT; docs updated.

BREAKING: persisted bodies in data/skills/ must be regenerated.
2026-10-01 10:21:31 +00:00
Denton Social 6e197596c8 remove explicit mentions of forwarding bridge to ensure that implementation prescriptions come from single source of truth 2026-09-29 00:05:23 -05:00
Denton Social 98ec4ee5e2 codegen: move bridge specifics into the catalog
Bridge specifics (service, base-URL config var, auth header/token var,
config-var docs, endpoints with error shapes) now live in BridgeInfo and
render through describe_bridges(), which is injected into body, retry,
regen, elicitation, and testgen prompts. SKILL.md/TESTGEN.md carry only
the generic pattern.

- regen prompt regains the catalog (was a dangling reference)
- elicitation integration hint rides body/retry/regen as an advisory
- top-level simplex_bridge_token config var; bootstrap syncs it
- simplex seeds read the token and send X-Semif-Token when set
2026-09-28 23:30:44 -05:00
Denton Social ddc5cb66c8 bridges: standalone third-party API bridges; isolate the command gateway
Split messaging UX (invite links, read, send) out of the command gateway into a
new `semif_agent.bridges` layer. Each bridge is its own process (`cli bridge`)
against its own service daemon/profile; the SimpleX bridge owns a second
simplex-chat daemon and buffers every inbound DM, so a message sent to the
connect-link address shows up in `simplex.next_message`.

- new: bridges/{base,inbox,registry,simplex}.py + neutral semif_agent/simplex_ws.py
- gateway: delete bridge.py; drop address/observer/pull-mode from the command path
- codegen: inject the bridge catalog (describe_bridges) into body + elicitation prompts
- seeds: repoint simplex.next_message/connect_link to top-level `simplex_bridge_url`
- config/bootstrap: new top-level `bridges` block + `simplex_bridge_url`; render
  semif-simplex-forward + semif-bridge units; gateway config loses bridge/inbox
- docs: AGENTS.md gateway isolation is non-negotiable
2026-09-28 15:24:44 -05:00
Denton Social 08d6bb23e2 gateway: serve a local messaging bridge so skills can send/read SimpleX
The gateway now exposes a localhost stdlib HTTP API (bridge.py) that
buffers authorized inbound DMs and forwards outbound sends, so a skill
body never opens a WebSocket to the simplex-chat daemon. Endpoints:
GET /health, /contacts, /inbox (peek), /inbox/next (pop oldest unread),
POST /send (resolve id/display name onto the adapter's outbound queue).
GatewayService gains an observer hook and inbox.dispatch (pull-only mode).

Expose the capability to codegen (SKILL.md, BODY_DIRECTIVES, elicitation,
TESTGEN.md) and add the simplex.next_message seed (SemIf recipient
resolution) with its hermetic loopback test. Config: messaging_bridge_url
plus gateway.simplex.{inbox,bridge}; bootstrap keeps them in sync.
2026-09-26 21:39:39 -05:00