mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-07-31 19:16:29 +00:00
feat(gateway): generate shared TypeScript contracts
Define gateway payloads as Python TypedDict contracts and generate the shared TypeScript surface through ts-type during shared, TUI, and desktop workflows.
This commit is contained in:
parent
75afaf46da
commit
2cdfe35429
12 changed files with 166 additions and 49 deletions
|
|
@ -11,6 +11,7 @@
|
|||
"node": "^20.19.0 || >=22.12.0"
|
||||
},
|
||||
"scripts": {
|
||||
"predev": "npm run generate:gateway-types --prefix ../shared",
|
||||
"clean": "npm run clean:e2e && npm run clean:renderer && npm run clean:electron",
|
||||
"clean:e2e":"tsc --build tsconfig.e2e.json --clean",
|
||||
"clean:renderer":"tsc --build tsconfig.json --clean ",
|
||||
|
|
@ -23,7 +24,7 @@
|
|||
"profile:main": "tsc --build tsconfig.electron.json && wait-on http://127.0.0.1:5174 && node scripts/bundle-electron-main.mjs --dev && cross-env XCURSOR_SIZE=24 HERMES_DESKTOP_DEV_SERVER=http://127.0.0.1:5174 electron --inspect=9229 .",
|
||||
"profile:main:cpu": "tsc --build tsconfig.electron.json && wait-on http://127.0.0.1:5174 && node scripts/bundle-electron-main.mjs --dev && cross-env XCURSOR_SIZE=24 NODE_OPTIONS=--cpu-prof HERMES_DESKTOP_DEV_SERVER=http://127.0.0.1:5174 electron .",
|
||||
"start": "npm run build && electron .",
|
||||
"prebuild": "npm run clean",
|
||||
"prebuild": "npm run generate:gateway-types --prefix ../shared && npm run clean",
|
||||
"build": "node scripts/assert-root-install.mjs && node scripts/write-build-stamp.mjs && vite build && node scripts/bundle-electron-main.mjs && node scripts/stage-native-deps.mjs",
|
||||
"postbuild": "node scripts/assert-dist-built.mjs",
|
||||
"prebuilder": "node scripts/patch-electron-builder-mac-binary.mjs",
|
||||
|
|
@ -45,7 +46,7 @@
|
|||
"test:desktop:nsis": "node scripts/test-desktop.mjs nsis",
|
||||
"test:desktop:existing": "node scripts/test-desktop.mjs existing",
|
||||
"test:desktop:fresh": "node scripts/test-desktop.mjs fresh",
|
||||
"typecheck": "tsc -p . --noEmit && tsc -p tsconfig.electron.json --noEmit && tsc -p tsconfig.e2e.json --noEmit",
|
||||
"typecheck": "npm run generate:gateway-types --prefix ../shared && tsc -p . --noEmit && tsc -p tsconfig.electron.json --noEmit && tsc -p tsconfig.e2e.json --noEmit",
|
||||
"lint": "eslint src/ electron/",
|
||||
"lint:fix": "eslint src/ electron/ --fix",
|
||||
"fmt": "prettier --write 'src/**/*.{ts,tsx}' 'electron/**/*.ts' 'vite.config.ts'",
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
import type { GatewaySessionRuntimeInfo } from '@hermes/shared/gateway-contracts'
|
||||
|
||||
export interface ConfigFieldSchema {
|
||||
category?: string
|
||||
description?: string
|
||||
|
|
@ -470,27 +472,7 @@ export interface SessionResumeResponse {
|
|||
status?: string
|
||||
}
|
||||
|
||||
export interface SessionRuntimeInfo {
|
||||
approval_mode?: 'manual' | 'off' | 'smart'
|
||||
branch?: string
|
||||
config_warning?: string
|
||||
credential_warning?: string
|
||||
cwd?: string
|
||||
desktop_contract?: number
|
||||
fast?: boolean
|
||||
install_warning?: string
|
||||
model?: string
|
||||
personality?: string
|
||||
provider?: string
|
||||
reasoning_effort?: string
|
||||
running?: boolean
|
||||
service_tier?: string
|
||||
skills?: Record<string, string[]> | string[]
|
||||
tools?: Record<string, string[]>
|
||||
usage?: Partial<UsageStats>
|
||||
version?: string
|
||||
yolo?: boolean
|
||||
}
|
||||
export type SessionRuntimeInfo = GatewaySessionRuntimeInfo
|
||||
|
||||
export interface UsageStats {
|
||||
calls: number
|
||||
|
|
|
|||
|
|
@ -8,14 +8,16 @@
|
|||
"./billing": "./src/billing-types.ts",
|
||||
"./billing-policy": "./src/billing-policy.ts",
|
||||
"./charge-settlement": "./src/charge-settlement.ts",
|
||||
"./gateway-contracts": "./src/generated/gateway.ts",
|
||||
"./skin": "./src/skin.ts"
|
||||
},
|
||||
"types": "./src/index.ts",
|
||||
"scripts": {
|
||||
"generate:gateway-types": "uv run --locked --extra dev python ../../scripts/generate_gateway_types.py",
|
||||
"lint": "eslint src/",
|
||||
"lint:fix": "eslint src/ --fix",
|
||||
"fix": "npm run lint:fix",
|
||||
"typecheck": "tsc -p . --noEmit",
|
||||
"typecheck": "npm run generate:gateway-types && tsc -p . --noEmit",
|
||||
"check": "npm run typecheck"
|
||||
},
|
||||
"devDependencies": {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue