senses should use TypeScript source + esbuild bundle, not raw .js #224

Closed
opened 2026-04-28 07:19:49 +00:00 by xiaoju · 0 comments
Owner

Problem

All senses currently ship raw .js compute files (senses/<name>/index.js). This is inconsistent with workflows which use TypeScript source + esbuild bundle to dist/.

The sense-generator workflow coder role also produces .js because it follows existing sense patterns.

Goal

Align senses with the workflow convention:

  • Source: src/index.ts (TypeScript)
  • Build: esbuild bundle → index.js (what daemon loads)
  • Schema: src/schema.ts → stays .ts (loaded via experimental strip-types)

Tasks

1. Migrate existing senses to TypeScript

For each sense (linux-system-health, hermes-gateway-health, hermes-session-message-stats, worker-process-metrics):

  • Move index.jssrc/index.ts (add types)
  • Move schema.tssrc/schema.ts
  • Keep migrations/ at root
  • Add package.json with esbuild build script (same pattern as workflows)
  • Add tsconfig.json
  • Build → output index.js at sense root (what daemon expects)

2. Update sense-generator coder prompt

Update workflows/sense-generator/roles/coder/prompt.ts to instruct the coder to:

  • Write TypeScript source in src/
  • Include package.json with esbuild build script
  • Run pnpm build after creating files
  • Ensure index.js at root is the bundled output, not hand-written JS

3. Verify daemon loads bundled output

Daemon already loads senses/<name>/index.js — just verify the esbuild bundle works with the existing loader.

Non-goals

  • Changing daemon sense-worker loading logic (it already loads .js, that stays)
  • Changing migration file format
## Problem All senses currently ship raw `.js` compute files (`senses/<name>/index.js`). This is inconsistent with workflows which use TypeScript source + esbuild bundle to `dist/`. The `sense-generator` workflow coder role also produces `.js` because it follows existing sense patterns. ## Goal Align senses with the workflow convention: - **Source**: `src/index.ts` (TypeScript) - **Build**: esbuild bundle → `index.js` (what daemon loads) - **Schema**: `src/schema.ts` → stays `.ts` (loaded via experimental strip-types) ## Tasks ### 1. Migrate existing senses to TypeScript For each sense (`linux-system-health`, `hermes-gateway-health`, `hermes-session-message-stats`, `worker-process-metrics`): - Move `index.js` → `src/index.ts` (add types) - Move `schema.ts` → `src/schema.ts` - Keep `migrations/` at root - Add `package.json` with esbuild build script (same pattern as workflows) - Add `tsconfig.json` - Build → output `index.js` at sense root (what daemon expects) ### 2. Update sense-generator coder prompt Update `workflows/sense-generator/roles/coder/prompt.ts` to instruct the coder to: - Write TypeScript source in `src/` - Include `package.json` with esbuild build script - Run `pnpm build` after creating files - Ensure `index.js` at root is the bundled output, not hand-written JS ### 3. Verify daemon loads bundled output Daemon already loads `senses/<name>/index.js` — just verify the esbuild bundle works with the existing loader. ## Non-goals - Changing daemon sense-worker loading logic (it already loads `.js`, that stays) - Changing migration file format
This repo is archived. You cannot comment on issues.
No Label
1 Participants
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: uncaged/nerve#224