Files
notify/internal/zaprpc/zaprpc.go
zeekay 44dce0d165 feat: bootstrap notifyd service layer on hanzoai/base + hanzoai/tasks
Replaces the chi-based notifyd scaffold with the canonical
hanzoai/auto-style layout: hanzoai/base as the HTTP + SQLite + auth
substrate (via the platform plugin for IAM JWT validation and
X-Org-Id injection), hanzoai/tasks for durable async sends, and a
per-tenant Notifier resolver that pulls provider credentials from
KMS through platform.KMSClient.

Library at the module root stays untouched — all 33 provider impls
(plivo, twilio, ses, sendgrid, mail, whatsapp, discord, slack, …)
keep their existing public API. The service wraps them.

cmd/notifyd
  - base.New + platform.MustRegister
  - schema.MustRegister (6 collections: tenants, providers,
    templates, events, messages, meter)
  - tasks worker registered when TASKS_ADDR is set; sync path
    runs the same Deliver activity directly when not

internal/
  - boot/      thin platform.KMSClient wiring (env-driven)
  - schema/    6 base collections
  - routes/    /v1/notify/{send,messages,providers,templates,events,metering,health}
               + convenience /send/{sms,email,voice,whatsapp}
  - tenant/    KMS-backed resolver builds library Notifier per send
  - template/  draft → pending → approved → published → archived
  - event/     catalog routing (fills missing channel / template)
  - metering/  per-send ledger writer + aggregate query
  - tasks/     NotifySendWorkflow + Deliver activity (idempotent on
               replay; reloads message row before resending)
  - zaprpc/    procedure name constants (server impl follow-up)

pkg/
  - client/    public HTTP SDK (Send / Message / Providers / Templates)
  - types/     wire shapes shared by routes and client

cucloud: fmt.Errorf(msg) → errors.New(msg) for the go 1.26 vet pass
that landed with this dependency bump. Behaviour unchanged.

Boot smoke-tested locally:
  - SQLite migrations apply cleanly
  - /v1/notify/health returns {"service":"notify","status":"ok"}
  - missing X-Org-Id returns 401 on every authenticated route
  - send with stub tenant returns the expected base validation error
2026-06-01 16:06:27 -07:00

25 lines
1.1 KiB
Go

// Package zaprpc is a stub for the native ZAP RPC surface that mirrors
// the HTTP /v1/notify/* routes.
//
// In the launch slice we ship HTTP only. ZAP procedures (notify.Send,
// notify.Message, notify.Providers, …) land once the corresponding
// hanzoai/zap server-side helpers stabilize in hanzoai/base or as a
// separate hanzoai/zap-server module. This file pins the package
// identifier so the structure compiles and consumers can import the
// Procedure constants today.
package zaprpc
// Procedure names follow the dot-prefixed convention used elsewhere in
// the Hanzo stack (kms.Get, tasks.ExecuteWorkflow, …). One opcode per
// HTTP verb-path; the routes/* package is the authoritative
// implementation, and ZAP procedures dispatch to the same handlers.
const (
ProcedureSend = "notify.Send"
ProcedureMessage = "notify.Message"
ProcedureMessages = "notify.Messages"
ProcedureProviders = "notify.Providers"
ProcedureTemplates = "notify.Templates"
ProcedureEvents = "notify.Events"
ProcedureMetering = "notify.Metering"
)