flowstate-epic-flowstate-community-epicdm-flowstate-shell-server
Package-local agent skill for @epicdm/flowstate-shell-server.
Tags
Publisher
Versions
1 version published — latest: 1.0.7
- 1.0.7publishedInvalid Date
Skill
flowstate-shell-server Package Skill
Package: @epicdm/flowstate-shell-server
Repository: epic-flowstate-community
Path: packages/flowstate-shell-server
Version: 1.0.7
Use this published Dojo skill as the package-level entrypoint. For detailed workflows, use the package-local skills listed below.
Primary Package Workflow
Shell Server Auth And CLI
Status: Active
Purpose: Start and operate the shell server with the current auth model.
Scope: packages/flowstate-shell-server/src/cli.ts, src/WebSocketServer.ts, and src/verify-jwt.ts
Trigger: A task involves shell server startup, health checks, CLI flags, JWT public keys, or authentication failures.
Input: Port, optional RSA public key path, and desired runtime mode.
Output: Running server or correct auth diagnosis.
CLI Startup
flowstate-shell-server --port=3001 --jwt-public-key=/path/to/public.pem
Supported parser forms:
--port=3001--port 3001--jwt-public-key=/path/to/public.pem--jwt-public-key /path/to/public.pem
The CLI also accepts --auth-token, but current WebSocket message authentication is implemented through jwtPublicKeyPath, not token comparison.
In container deployments, docker/agent-entrypoint.sh passes --jwt-public-key when JWT_PUBLIC_KEY_PATH exists and treats --auth-token as obsolete.
Programmatic Startup
import { ShellWebSocketServer } from '@epicdm/flowstate-shell-server'
const server = new ShellWebSocketServer({
port: 3001,
jwtPublicKeyPath: '/etc/flowstate/shell-jwt-public.pem',
})
await server.start()
Health Check
curl http://localhost:3001/health
Expected shape:
{
"status": "ok",
"uptime": 0,
"sessions": 0,
"clients": 0,
"port": 3001,
"version": "0.1.0"
}
Auth Model
When jwtPublicKeyPath is configured:
- Server loads the RSA public key PEM and stores it base64-encoded.
- Client must send
{ "type": "auth", "token": "<RS256 JWT>" }. - Server verifies JWT format,
alg: RS256, signature, andexp. - On success, server sends
{ "type": "auth_response", "success": true }. - On failure, server sends failure response and closes the socket.
- If no auth arrives within 10 seconds, server closes with auth timeout.
When no public key is configured, auth is disabled for dev mode and clients are pre-authenticated.
Gateway Versus Direct Auth
Some deployed clients may append a query-string token for gateway validation. That is not the same as direct ShellWebSocketServer auth. If a client connects directly to this package with jwtPublicKeyPath configured, it must still send the auth message after the WebSocket opens.
Verification
yarn workspace @epicdm/flowstate-shell-server test -- tests/WebSocketServer.test.ts tests/verify-jwt.test.ts
yarn workspace @epicdm/flowstate-shell-server typecheck
Run yarn workspace @epicdm/flowstate-shell-server build after CLI changes because bin points to dist/cli.js.
Package Skill Inventory
Skill Inventory: @epicdm/flowstate-shell-server
Review date: 2026-06-30
Skill Map
| Skill | Type | Use When |
|---|---|---|
flowstate-shell-server | Orchestrator | Selecting the shell-server package and composing server, session, protocol, and client package work. |
flowstate-shell-server-websocket-protocol | Workflow/reference | Implementing or debugging client/server WebSocket message flows. |
flowstate-shell-server-session-manager | Workflow | Creating, reconnecting, resizing, renaming, updating, disconnecting, or closing persistent sessions. |
flowstate-shell-server-tmux-adapter | Reference/troubleshooting | Working with tmux-backed session creation, input, resize, capture, attach, and cleanup. |
flowstate-shell-server-session-store | Reference | Persisting, updating, reconciling, or querying session metadata in SQLite. |
flowstate-shell-server-auth-and-cli | Workflow | Starting the server, configuring JWT auth, checking health, or using the CLI. |
flowstate-shell-server-maintenance | Maintenance | Updating docs, tests, Dojo artifacts, exports, or package wiring. |
Feature Coverage
| Feature Matrix Item | Covered By |
|---|---|
ShellWebSocketServer | flowstate-shell-server-websocket-protocol, flowstate-shell-server-auth-and-cli |
TerminalSessionManager | flowstate-shell-server-session-manager |
TmuxAdapter | flowstate-shell-server-tmux-adapter |
SessionStore | flowstate-shell-server-session-store |
verifyJwt, loadPublicKeyFromFile, _resetKeyCache | flowstate-shell-server-auth-and-cli |
createLogger, getLogFilePath | flowstate-shell-server-maintenance, flowstate-shell-server-auth-and-cli |
| Protocol and session types | flowstate-shell-server-websocket-protocol, flowstate-shell-server-session-manager |
Composition Notes
- Use
flowstate-shell-coreskills for React terminal components and adapter contracts. - Use
flowstate-shellskills for browser/Electron/WebSocket client adapters. - Use this package for the server runtime, tmux persistence, and protocol source of truth.
Review Gate
Package Skill Review: @epicdm/flowstate-shell-server
Review date: 2026-06-30 Verdict: pass
Quality Gate
- Source-backed package purpose: pass.
- Public entry points documented: pass.
- Composable skill map: pass.
- Stale README/generator drift called out: pass.
- Dojo publish readiness: deferred until generated artifacts are rebuilt from reviewed skills.
Evidence Checked
package.jsonREADME.mdsrc/index.tssrc/types.tssrc/WebSocketServer.tssrc/TerminalSessionManager.tssrc/TmuxAdapter.tssrc/SessionStore.tssrc/cli.tssrc/verify-jwt.tstests/protocol.test.tstests/WebSocketServer.test.tstests/TerminalSessionManager.test.tstests/TmuxAdapter.test.ts.flowstate/feature-matrix/inventory.md.flowstate/dojo/agent-skillset.md
Verification Results
yarn workspace @epicdm/flowstate-shell-server test
yarn workspace @epicdm/flowstate-shell-server typecheck
yarn workspace @epicdm/flowstate-shell-server build
yarn workspace @epicdm/flowstate-shell-server lint
yarn nx build @epicdm/flowstate-shell-server
Results:
- ASCII/frontmatter check passed.
tmux -Vpassed:tmux 3.6a.test --runInBandpassed: 6 suites, 74 tests. The run emitted an existingMaxListenersExceededWarningfrom repeated server lifecycle tests.typecheckpassed.lintpassed with 30 existing warnings acrossWebSocketServer.ts,cli.ts, andtypes.ts.buildpassed with the existing package export-order warning becausetypescomes afterimportandrequire.nx buildpassed with the same export-order warning and existing Nx Cloud 401/unconnected workspace notice.
Dojo Status
Deferred. Existing generated Dojo artifacts should be rebuilt from these reviewed local skills before publication because current Dojo files list exports, include stale authToken examples, and have ID/publisher drift.
Usage
Start with this skill to understand the package purpose, then use the package-local focused skills for specific workflows. Keep this Dojo version aligned with packages/flowstate-shell-server/package.json. Do not treat generated feature lists as lessons; use workflow evidence from CODE-REVIEW.md, SKILL-INVENTORY.md, and REVIEW.md.
Install
Run this in your project to install via CLI:
fscloud dojo skill install flowstate-epic-flowstate-community-epicdm-flowstate-shell-server --target <target> --out ./skillsReplace <target> with your agent target identifier. See the CLI docs for details.