CloudWatch shared-dashboard auth

Signs in to a shared CloudWatch dashboard (M: UsrPwSingle) and exchanges the session for temporary AWS credentials, entirely client-side — no AWS SDK, no proxy.

InitiateAuth(USER_SRP_AUTH)RespondToAuthChallenge(PASSWORD_VERIFIER)GetIdGetCredentialsForIdentity. SRP-6a is implemented here with native BigInt + WebCrypto, because USER_PASSWORD_AUTH is not enabled on the CloudWatch sharing app client.

edit
srp = Object {N: 5809605995369958062791915965639201402176612226902900533702900882779736177890990861472094774477339581147373410185646378328043729800750470098210924487866935059164371588168047540943981644516632755067501626434556398193186628990071248660819361205119793693985433297036118232914410171876807536457391277857011849897410207519105333355801121109356897459426271845471397952675959440793493071628394122780510124618488232602464649876850458861245784240929258426287699705312584509625419513463605155428017165714465363094021609290561084025893662561222573202082865797821865270991145082200656978177192827024538990239969175546190770645685893438011714430426409338676314743571154537142031573004276428701433036381801705308659830751190352946025482059931306571004727362479688415574702596946457770284148435989129632853918392117997472632693078113129886487399347796982772784615865232621289656944284216824611318709764535152507354116344703769998514148343807n, g: 2n, enc: TextEncoder, subtle: SubtleCrypto, hexToBytes: ƒ(h), bytesToHex: ƒ(b), cat: ƒ(…), b64ToBytes: ƒ(s), bytesToB64: ƒ(b), padHex: ƒ(v), sha256: async ƒ(bytes), hashHex: async ƒ(bytes), hexHash: async ƒ(hex), hmac: async ƒ(keyBytes, msgBytes), modPow: ƒ(base, exp, mod), cognitoTimestamp: ƒ(d)}
edit
cognitoCall = async ƒ(url, target, body)
edit
parseShareLink = ƒ(link)
edit
srpLogin = async ƒ(cfg, username, password)
edit
refreshLogin = async ƒ(cfg, refreshToken)
edit
exchangeForAwsCredentials = async ƒ(cfg, idToken)
edit
FILE_KEY = "cw-share-auth/v1/9f3c1a7e5b2d48c6a0e7f41b8d3629ae"
edit
tokenStore = Object {save: async ƒ(cfg, username, refreshToken), load: async ƒ(cfg), clear: ƒ(cfg), keyFor: ƒ(cfg)}
edit
defaultShareLink = "https://cloudwatch.amazonaws.com/dashboard.html?dashboard=Optimize&context=eyJSIjoidXMtZWFzdC0xIiwiRCI6ImN3LWRiLTUzMzMxMDQzNjkxNSIsIlUiOiJ1cy1lYXN0LTFfUkVzb0t0d3pJIiwiQyI6IjNqcTB0czdoYjB0YTE4cTZzYzRmcm52bXU5IiwiSSI6InVzLWVhc3QtMTo4YTE1NDQyNS02NjNhLTQ3MGYtOWZhYy1mNGRlMWQ0ODBmN2MiLCJPIjoiYXJuOmF3czppYW06OjUzMzMxMDQzNjkxNTpyb2xlL3NlcnZpY2Utcm9sZS9DV0RCU2hhcmluZy1SZWFkT25seUFjY2Vzcy1ZTUdGR1pOUyIsIk0iOiJVc3JQd1NpbmdsZSJ9"
edit
edit
Sign in to run the API probe.
edit
Not connected
Setup guide
  1. Install Bun if needed, then:
    bun install -g @lopecode/channel
    claude mcp add lopecode bunx @lopecode/channel
  2. Start Claude Code:
    claude --dangerously-load-development-channels server:lopecode
  3. Ask Claude for a pairing token, then paste it above
edit
File Sync

  
Directory: — (not set)
Modules: 46 syncable
Notebook\u2192Files: Waiting for directory...
Files\u2192Notebook: Waiting for directory...
edit

Watched Variables

Live values of variables being observed by Claude Code.

edit
VariableModuleValueUpdated
hash
currentModules
history
edit

Claude Code Pairing

Bridges a lopecode notebook to Claude Code via WebSocket.

Claude Code CLI  ←MCP→  Channel Server  ←WS→  This Module (browser)

Cell groups (in dependency order):

  1. UIcc_chat (main interface), cc_watch_table (variable inspector)
  2. Statecc_config, cc_notebook_id, cc_activity, cc_status, cc_messages, cc_watches, cc_module, voiceEnabled
  3. Module lookupcc_find_module resolves module names via runtime.mains
  4. Serializationcc_serialize_value (safe value→string for transport)
  5. Variable watchercc_watchers observes variables, debounces & sends updates
  6. Command handlerscc_handle_* (one per MCP tool)
  7. Command dispatchcc_command_handlers routes action→handler
  8. WebSocketcc_ws manages connect/pair/auto-reconnect and message dispatch
  9. Side effectscc_change_forwarder streams cell edits, cc_voice optional speech I/O
  10. ImportscurrentModules, exportToHTML, compile, history, runtime-sdk helpers
edit

State cells

Reactive Inputs.input() cells holding connection state. These are the shared mutable atoms that UI and WebSocket cells read/write.

edit
cc_config = Object {port: 8787, host: "127.0.0.1"}
edit
cc_notebook_id = "file:///Users/tom.larkworthy/dev/lopecode-dev/lopebooks/notebooks/@tomlarkworthy_aws-dashboard.html#view=R100(S55(@tomlarkworthy/cw-share-auth),S45(@tomlarkworthy/claude-code-pairing))"
edit
cc_activity = EventTarget {value: Array(0)}
edit
cc_status = EventTarget {value: "disconnected"}
edit
cc_messages = EventTarget {value: Array(0)}
edit

Module lookup & serialization

cc_find_module resolves a module name (e.g. "@tomlarkworthy/exporter-3") to a runtime Module object by polling viewof currentModules.value at call time (not reactively). cc_serialize_value safely converts any runtime value to a truncated string for transport.

edit
cc_find_module = ƒ(runtime, moduleName)
edit
cc_serialize_value = ƒ(value, maxLen)
edit

Variable watcher

Subscribes to Observable variables via observe(), debounces updates (1s), and forwards changes to Claude Code over the WebSocket. Also maintains the cc_watches table UI.

edit
cc_watchers = Object {watchVariable: ƒ(runtime, name, moduleName), unwatchVariable: ƒ(name, moduleName), unwatchAll: ƒ(), setSend: ƒ(fn)}
edit

Command handlers

One handler per MCP tool. Each receives a cmd object and the Observable runtime, returns {ok, result} or {ok:false, error}. Handlers: get-variable, define-variable, define-cell, delete-variable, list-variables, list-cells, run-tests, create-module, delete-module, eval, fork, watch, unwatch.

edit
cc_handle_get_variable = ƒ(cmd, runtime)
edit
cc_handle_define_variable = ƒ(cmd, runtime)
edit
cc_handle_define_cell = ƒ(cmd, runtime)
edit
cc_handle_delete_variable = ƒ(cmd, runtime)
edit
cc_handle_list_variables = ƒ(cmd, runtime)
edit
cc_handle_list_cells = ƒ(cmd, runtime)
edit
cc_handle_run_tests = ƒ(cmd, runtime)
edit
cc_handle_create_module = ƒ(cmd, runtime)
edit
cc_handle_delete_module = ƒ(cmd, runtime)
edit
cc_handle_eval = ƒ(cmd, runtime)
edit
cc_handle_fork = ƒ(cmd, runtimeArg)
edit
cc_handle_watch = ƒ(cmd, runtime)
edit
cc_handle_unwatch = ƒ(cmd, runtime)
edit

Command dispatch & WebSocket

cc_command_handlers maps action strings to handler functions. cc_ws manages the WebSocket lifecycle: connect, pair with token, dispatch incoming messages (commands, replies, tool-activity), and auto-reconnect from the URL hash cc= param or sessionStorage.

edit
viewof mcpTools = EventTarget {value: Map(0)}
edit
RuntimeError: fileSyncTools is not defined
edit
cc_handle_call_tool = async ƒ(cmd)
edit
cc_command_handlers = ƒ(cmd)
edit
cc_ws = Object {connect: ƒ(token), paired: false, ws: null}
edit

Side effects

cc_change_forwarder polls the local-change-history and streams new cell edits to Claude Code. cc_voice provides optional speech recognition input and TTS output for hands-free pairing.

edit
cc_change_forwarder = "change forwarder active"
edit
cc_voice = "voice: disabled"
edit
viewof cc_watches = EventTarget {value: Array(3)}
edit
viewof cc_module = EventTarget {tag: Symbol()}
edit
🎙️
edit
cc_handle_delete_cell = ƒ(cmd, runtime)
edit
cc_handle_update_cell = ƒ(cmd, runtime)
edit
cc_handle_export_module = ƒ(cmd, runtime)
edit
edit
edit
edit
edit
edit
edit
edit