10 Commits

Author SHA1 Message Date
ba8c0701f8 Refactor server config: single --config flag replaces --secrets/--mail-perms
- New server/config.mjs loads config.json, resolves secrets path relative
  to config dir, returns users/smtp/mail_perms_path/bind/port
- server/secrets.mjs removed (logic absorbed into config.mjs)
- smtp moves from secrets.json to config.json
- secrets.json now contains only users (pure credentials)
- config.example.json added as reference template
- .gitignore/.npmignore updated to cover config.json and mail-perms.json
- README updated with new setup and flags

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 23:16:30 +00:00
64df986a5f Thread exec and mailer_send through ctx instead of importing directly
- actions.mjs no longer imports exec from helpers; uses ctx.exec instead
- index.mjs builds ctx via make_ctx(), which injects dry-run stubs for
  exec and mailer_send when --dry-run is active
- Handlers now run fully (including permission checks) in dry-run mode;
  only the actual side effects are stubbed out

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 22:58:00 +00:00
9668bae220 Add --dry-run flag to server
When active, action invocations are logged (action name, caller, params)
but no handler is executed. Applies to both auto-accept and approved queue
entries. Startup message confirms the mode is active.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 22:41:09 +00:00
b1ccbfef41 Implement email support with per-user permission model (closes #2)
New modules:
- server/mailer.mjs: nodemailer transport wrapper
- server/mail_perms.mjs: runtime permission store, persisted to disk

New actions:
- send-email: checks (caller, to, topic) permission before sending
- set-mail-permission: grant/revoke permissions, gated by canApprove
- get-mail-permissions: list current permissions

Handler signature extended to handler(params, ctx) where ctx carries
caller, users, mail_perm_store and mailer_send. Existing handlers
ignore ctx so the change is backwards-compatible.

SMTP config lives in secrets.json under optional 'smtp' key.
Mail permissions path via --mail-perms or CONDUIT_MAIL_PERMS.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 22:34:26 +00:00
5fb9d3ce07 Suppress GET /queue logs unless --verbose
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 21:36:59 +00:00
f2d32a3faa Add request logging, simplify queue output, bump to v1.0.0
Each request logs timestamp, method, path and user. Queue entries log
a single line on enqueue and on resolve. Drop the verbose approve/deny
curl instructions from queue output.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 21:34:35 +00:00
0d1e25019e Change default bind address to 127.0.0.1
Safer default — network exposure requires explicit --bind or CONDUIT_BIND.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 21:18:38 +00:00
fa4a7a99f8 Add --bind argument to server
Defaults to 0.0.0.0, can also be set via CONDUIT_BIND env var.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 21:18:11 +00:00
67c1c3f9a4 Add HMAC auth, user permissions, snake_case rename
Each request is signed with HMAC-SHA256 over timestamp+body using a
per-user secret loaded from a --secrets file (never env vars or git).
Users have a canApprove list controlling who may approve queued actions.
Queue entries track submitted_by for permission checks on approve/deny.

Also renames all identifiers to snake_case throughout the codebase.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 20:18:41 +00:00
f02e2a746d Rename .js to .mjs, extract helpers module
Move resolvePath and exec out of index.mjs into server/helpers.mjs so
actions can import them directly rather than receiving them as arguments.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 20:06:29 +00:00