A third-party Node frontend had to compile ui-tui's private source to talk to the gateway: gatewayClient.ts, canonicalGateway.ts, gatewayTypes.ts and the slash, history and provider helpers beside them. hermes-tern bundles 36 such imports through a `.hermes-src` alias. The renderer-free client now lives in apps/shared: - src/node/gateway-client.ts: transport, ticketed dial, runtime.describe, the session.create contract, reconnect and bounded owner recovery, typed request/events (Node-only). - src/gateway-canonical.ts, src/gateway-types.ts, src/gateway-text.ts: the hermes-gateway-v1 request/result translation, the typed results (SessionInfo and SlashCategory with them) and the client's English text, keyed by Ink's catalog keys. - src/slash-input.ts, slash-score.ts, provider-names.ts, interpolation.ts, circular-buffer.ts and src/node/prompt-history.ts: helpers with no Ink or React import, moved as they were. Everything Ink-specific became a constructor option that Ink's own GatewayClient (ui-tui/src/gatewayClient.ts) passes exactly as before: `connect` (its gateway_bootstrap.py helper), the terminal-failure predicate, HERMES_TUI_GATEWAY_URL / _SIDECAR_URL, the startup and RPC timeouts, the launch tool-progress pin, the crash-log breadcrumbs, its i18n `t`, and undici as the WebSocket when the runtime has none. The launcher's env parsing stays in Ink (launchOptions.ts). Node-only modules sit in src/node, which the web app's typecheck excludes; the package typechecks src and src/node with separate configs, and boundary.test.ts fails if its program ever includes another workspace's file. apps/shared now runs its tests in `check`.
52 lines
1.8 KiB
JSON
52 lines
1.8 KiB
JSON
{
|
|
"name": "@hermes/shared",
|
|
"private": true,
|
|
"version": "0.0.0",
|
|
"type": "module",
|
|
"exports": {
|
|
".": "./src/index.ts",
|
|
"./ansi": "./src/ansi.ts",
|
|
"./billing": "./src/billing-types.ts",
|
|
"./billing-policy": "./src/billing-policy.ts",
|
|
"./charge-settlement": "./src/charge-settlement.ts",
|
|
"./circular-buffer": "./src/circular-buffer.ts",
|
|
"./color": "./src/color.ts",
|
|
"./format": "./src/format.ts",
|
|
"./fuzzy": "./src/fuzzy.ts",
|
|
"./gateway-canonical": "./src/gateway-canonical.ts",
|
|
"./gateway-client": "./src/node/gateway-client.ts",
|
|
"./gateway-events": "./src/gateway-events.ts",
|
|
"./gateway-text": "./src/gateway-text.ts",
|
|
"./gateway-types": "./src/gateway-types.ts",
|
|
"./i18n": "./src/i18n.ts",
|
|
"./interpolation": "./src/interpolation.ts",
|
|
"./json-rpc-channel": "./src/json-rpc-channel.ts",
|
|
"./model-search-text": "./src/model-search-text.ts",
|
|
"./plan-usage": "./src/plan-usage.ts",
|
|
"./prompt-history": "./src/node/prompt-history.ts",
|
|
"./provider-names": "./src/provider-names.ts",
|
|
"./reasoning-effort": "./src/reasoning-effort.ts",
|
|
"./reconnect-backoff": "./src/reconnect-backoff.ts",
|
|
"./skin": "./src/skin.ts",
|
|
"./slash": "./src/slash.ts",
|
|
"./slash-input": "./src/slash-input.ts",
|
|
"./slash-score": "./src/slash-score.ts",
|
|
"./theme-presets": "./src/theme-presets.ts",
|
|
"./usage-tick": "./src/usage-tick.ts"
|
|
},
|
|
"types": "./src/index.ts",
|
|
"scripts": {
|
|
"lint": "eslint src/",
|
|
"lint:fix": "eslint src/ --fix",
|
|
"fix": "pnpm run lint:fix",
|
|
"typecheck": "tsc -p . --noEmit && tsc -p tsconfig.node.json --noEmit",
|
|
"check": "pnpm run typecheck && pnpm run test && pnpm run lint",
|
|
"test": "vitest run"
|
|
},
|
|
"devDependencies": {
|
|
"@types/node": "22.20.5",
|
|
"typescript": "6.0.3",
|
|
"vitest": "4.1.12"
|
|
}
|
|
}
|