Commit graph

8 commits

Author SHA1 Message Date
5dce057ce7 Add /provisionDect + create DECT network in /finalizeStore
Some checks are pending
CI / verify (push) Waiting to run
New /provisionDect slash command manages DECT basestations and handsets
for a store via a single card: multi-select checkbox list doubles as
the display, MACs render as AA:BB:CC:DD:EE:FF, Add/Remove sit
side-by-side per section, and every removal goes through an explicit
confirm card. Handsets always auto-pair (no bind-to-basestation input)
so they roam.

/finalizeStore now idempotently creates the "Store XXXX" DECT network
(DBS-210) with the per-store default access code, so new stores are
DECT-ready the moment finalize completes. Location-scoped lookup
(findDectNetworkInLocation) handles both the finalize idempotency
check and the /provisionDect fallback for freshly-created empty
networks. Non-critical: a store can still go live if the DECT step
fails, and /provisionDect keeps a recovery "create network" prompt
for legacy stores.

Pure-logic helpers (generateDectAccessCode, MAC normalize/format/
display, dectNetworkName) are unit-tested via node:test.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-07 07:29:21 -04:00
b5610acc8e Retire /buildStore, rename /migrateStore -> /finalizeStore, harden flows
Some checks are pending
CI / verify (push) Waiting to run
- Delete /buildStore command + flow (dead since phone numbers now have
  to be purchased before provisioning); drop the only cascading dead
  helper (updateLocationRouteGroup) that was only called by that flow
- Rename /migrateStore -> /finalizeStore. "Migrate" was a leftover from
  the legacy-system era; the command finishes what stage started
- Rename buildStoreInfoCard -> storeConfirmationCard (misleading name
  since all flows share it); rename btnBuildStore/btnBadInfo ->
  btnConfirm/btnCancel to match
- Fix the double-write of storeInfo.extension: siw.js sets a 5XXXX
  default and both command handlers were overriding it (stage to 8XXXX,
  finalize back to 5XXXX). Drop both overrides; single source of truth
- Add /finalizeStore preflight that runs findWebexLocation in parallel
  with findWebexUser; if the location doesn't exist, bail before showing
  the confirmation card with an actionable "Run /stageStore first" line
- Add post-run next-step summaries: stage points at
  /finalizeStore <n>, finalize confirms the location is live
- Update README (commands, mermaid) and deviceCustomizations header

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:33:51 -04:00
7a9f5c96f8 Rename files: storeInfoCard/migrateStore -> storeConfirmationCard/finalizeStore
Some checks are pending
CI / verify (push) Waiting to run
Pure git-mv rename step. Preserves file history so subsequent content
edits show up as modifications rather than delete+add. Follow-up commit
carries the actual content changes.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:22:21 -04:00
6de5392e90 Add node:test suite and Gitea Actions CI
Some checks are pending
CI / verify (push) Waiting to run
- 30-test suite (node --test, no framework) covering the exact functions
  that have regressed in previous rounds:
    * parseStoreArg / parseStoreNumber / storeEmail (helpers)
    * greetingForBrand (brand fallback)
    * formatE911Address / formatSuite (google response reducer)
    * parseNextLink (RFC-5988 pagination — now exported)
    * runStep success / non-critical / critical / no-bot paths
- test/setup.js stubs required env vars so any src/ module can be
  imported cleanly; loaded via --import once per test process
- npm run test wired up; directory form works on Node 20 + 22
- .gitea/workflows/ci.yml runs lint + format:check + test on push/PR
  to main, on Node 22 to match the runtime image
- Exclude test/ and .gitea/ from the Docker build context
- Exclude docker/ from bot Prettier scope (remote-agent is its own
  sub-project with its own tooling)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 16:07:02 -04:00
461caa8086 Consistency + cleanup pass
- Route Twilio Lookup v2 through the on-prem remote agent so all
  third-party calls (SIW, Google, Twilio) share the same network path
  and future IP allow-lists / corp proxies don't break it silently
- Delete unused GOOGLE_APPLICATION_CREDENTIALS / serviceAccountKeyPath
  wiring in config.js, .env.example, and README (never read by any code)
- Extract 150 lines of STORE_DEVICE_CUSTOMIZATIONS out of
  src/webex/devices.js into src/webex/deviceCustomizations.js so device
  config diffs are self-contained and devices.js stays focused on API
- runStep learns a {critical: true} option that re-throws on failure
  instead of the legacy always-swallow behavior; mark
  enableLocationForCalling critical in buildStore + stageStore so a
  failure there aborts the flow cleanly rather than cascading into
  dozens of downstream 404s

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 15:56:01 -04:00
8b32975eaf Harden agent bridge + command inputs
- Agent hello handshake: agent (v1.2.0) sends {type, version, capabilities}
  on connect; bot logs "Agent hello: v1.2.0 (capabilities: insecure, hello)"
  and exposes getAgentInfo(). Backward-compatible with older agents.
- proxyRequest tracks method + url per request; all error paths (agent
  errors, timeouts, disconnect rejects, send failures) now include
  "(for METHOD URL)" so the failing endpoint is unambiguous
- Add requireAgent(bot) preflight; buildStore/stageStore/migrateStore
  reject up front when the agent is disconnected instead of failing
  mid-flow after partial Webex mutations
- Add parseStoreNumber (^\d{1,5}$) and wire into store-number commands
  with proper usage messages; add loose email-shape check to /userInfo
- Fix pre-existing catch(_e) lint warning in remoteAgent.js (bare catch)

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 15:48:54 -04:00
a05dbb2733 Route Google API calls through remote agent with insecure TLS
- validateAddress and getTimeZone now use proxyRequest instead of native
  fetch so the request originates from the on-prem IP, satisfying the
  API_KEY_IP_ADDRESS_BLOCKED restriction on the Google key
- Both calls carry insecure:true because the agent's network path runs
  SSL-inspecting proxies that substitute an internal-CA chain (throws
  SELF_SIGNED_CERT_IN_CHAIN otherwise); scoped per-request, consistent
  with SIW
- Fix latent bug in getTimeZone: use GET (per Google docs) instead of POST
- Rename README section to "Remote agent (SIW + Google)" and document
  the SSL-inspection nuance

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 15:06:58 -04:00
93b060bc8b Modernize bot to Node.js 22 with modular architecture and remote SIW agent
- Refactor monolithic index.js (2646 lines) into src/{webex,integrations,
  cards,flows,commands,services} modules; replace node-fetch/form-data
  with native fetch/FormData; move all secrets to .env via dotenv
- Add dockerized remote SIW agent (docker/remote-agent/) with cross-arch
  buildx packaging (arm64 Mac -> linux/amd64), idempotent install.sh
  deploy bundle, and docker-free ZIP inspector for arch verification
- Bot hosts a WebSocket server; agent proxies SIW requests with a
  per-request insecure:true flag, replacing the process-wide
  NODE_TLS_REJECT_UNAUTHORIZED bypass
- Add ESLint flat config + Prettier, rewrite Dockerfile as non-root
  multi-stage node:22-alpine build, README covering setup / deploy /
  remote agent workflow
- Fix parseStoreArg to read trigger.prompt correctly (was indexing past
  the framework's post-match slice); register /help as regex (string
  matcher only compares the first token); switch catch-all to /.+/
  (previous /.*/gim was stateful due to the g flag); remove
  /fixDisplayNames command and its flow/card

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-07-06 14:48:51 -04:00