Skip to content

feat: add Nori Sessions broker proxy transport (0.2.0)#3

Merged
theahura merged 1 commit into
mainfrom
proxy-transport
Jun 12, 2026
Merged

feat: add Nori Sessions broker proxy transport (0.2.0)#3
theahura merged 1 commit into
mainfrom
proxy-transport

Conversation

@nori-sessions

@nori-sessions nori-sessions Bot commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Adds a transport seam (src/transport.ts): direct mode (SLACK_BOT_TOKEN via @slack/web-api) and proxy mode (NORI_SLACK_PROXY_URL + NORI_SLACK_CONTEXT_TOKEN, POSTing {method, args} to the Nori Sessions broker's /method endpoint). Proxy wins when both are configured, matching the sessions bash wrapper it replaces.
  • All CLI features now work identically in both modes: --json-input, --paginate (now a single transport-generic cursor loop), --dry-run (reports the selected transport), kebab→snake conversion, type coercion, and error suggestions. Broker errors are normalized into the standard error envelope, including extracting Slack platform codes from broker messages.
  • Removes the accidental self-dependency (nori-slack-cli@^0.1.0) from package.json. Bumps to 0.2.0.

Why

Nori Sessions currently ships a separate hand-rolled 74-line proxy client next to this CLI, selected by a branching bash wrapper. The two implementations diverged: in proxy mode (the managed-session default) --json-input fails outright, kebab-case flags are silently sent unconverted, and there is no coercion/pagination/discovery. This PR makes the real CLI speak the proxy wire protocol so the sessions repo can delete the duplicate (companion PR in nori-sessions).

Test plan

  • 13 new blackbox subprocess tests in test/proxy-mode.test.ts against a real local HTTP fake broker (wire format, precedence, trailing-slash URLs, --json-input pass-through, coercion, error mapping incl. 401, cursor pagination, dry-run transport reporting, no-credentials envelope) — written red-first
  • Test helpers are hermetic: Slack credential env vars are stripped so suites pass identically on dev machines and inside Nori sessions (which export the proxy vars)
  • Full suite green: 69 tests across 9 files, tsc --noEmit clean
  • After merge: publish nori-slack-cli@0.2.0 to npm (@amol), then land the companion sessions PR that deletes the hand-rolled client and bumps base.lock.json

The CLI now supports two transports behind one interface: direct mode
(SLACK_BOT_TOKEN via @slack/web-api) and proxy mode (NORI_SLACK_PROXY_URL +
NORI_SLACK_CONTEXT_TOKEN, POSTing {method, args} to the session broker).
Proxy mode wins when both are configured, matching the sessions wrapper it
replaces. All CLI features — --json-input, --paginate, --dry-run,
kebab→snake conversion, type coercion, error suggestions — now behave
identically in both modes, which lets the sessions repo delete its
hand-rolled proxy client.

Pagination is a single transport-generic cursor loop, broker errors are
normalized into the standard error envelope (including extracting Slack
platform codes), --dry-run reports the selected transport, and the
accidental self-dependency is removed from package.json. Version 0.2.0.
🤖 Generated with [Nori](https://noriagentic.com)

Co-Authored-By: Nori <contact@tilework.tech>
@theahura theahura merged commit 4b2c3a2 into main Jun 12, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant