fix desktop types esm resolution and document the startup crash fix

This commit is contained in:
dirtydishes 2026-05-20 18:28:18 -04:00
parent a8d183f38e
commit 1543f419e6
9 changed files with 166 additions and 15 deletions

View file

@ -16,6 +16,7 @@
{"_type":"issue","id":"islandflow-ayo","title":"Drop stale backlog events from live fanout","description":"Follow-up to live freshness rollout: /ws/live was still fanning out stale backlog events for freshness-gated channels, which kept tape panes in Live feed behind despite active synthetic ingest. Gate fanout and cache ingest by freshness for options/nbbo/equities/flow.","status":"closed","priority":1,"issue_type":"bug","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T21:26:39Z","created_by":"dirtydishes","updated_at":"2026-04-28T21:26:44Z","started_at":"2026-04-28T21:26:44Z","closed_at":"2026-04-28T21:26:44Z","close_reason":"Completed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-ayo","title":"Drop stale backlog events from live fanout","description":"Follow-up to live freshness rollout: /ws/live was still fanning out stale backlog events for freshness-gated channels, which kept tape panes in Live feed behind despite active synthetic ingest. Gate fanout and cache ingest by freshness for options/nbbo/equities/flow.","status":"closed","priority":1,"issue_type":"bug","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T21:26:39Z","created_by":"dirtydishes","updated_at":"2026-04-28T21:26:44Z","started_at":"2026-04-28T21:26:44Z","closed_at":"2026-04-28T21:26:44Z","close_reason":"Completed","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-0v6","title":"Fix tape freshness, NBBO coverage, pause controls, and filter popup","description":"Implement the tape fixes requested for synthetic options notional sizing, strict live freshness, live-mode pause/resume behavior, stronger NBBO snapshot coverage, and moving flow filters behind a popup. Includes server-side live cache changes, web terminal state/UI changes, and tests for synthetic pricing, live snapshot freshness/NBBO retention, and live pause/filter interactions.","status":"closed","priority":1,"issue_type":"task","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T21:02:52Z","created_by":"dirtydishes","updated_at":"2026-04-28T21:13:38Z","started_at":"2026-04-28T21:02:57Z","closed_at":"2026-04-28T21:13:38Z","close_reason":"Completed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-0v6","title":"Fix tape freshness, NBBO coverage, pause controls, and filter popup","description":"Implement the tape fixes requested for synthetic options notional sizing, strict live freshness, live-mode pause/resume behavior, stronger NBBO snapshot coverage, and moving flow filters behind a popup. Includes server-side live cache changes, web terminal state/UI changes, and tests for synthetic pricing, live snapshot freshness/NBBO retention, and live pause/filter interactions.","status":"closed","priority":1,"issue_type":"task","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T21:02:52Z","created_by":"dirtydishes","updated_at":"2026-04-28T21:13:38Z","started_at":"2026-04-28T21:02:57Z","closed_at":"2026-04-28T21:13:38Z","close_reason":"Completed","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-e4r","title":"Implement smart-money flow filtering and synthetic firehose modes","description":"Implement the approved multi-surface plan for named synthetic market profiles, options raw-vs-signal filtering, live/API filter contracts, Tape page client-side flow filters, firehose-readiness improvements, tests, and README updates.","status":"closed","priority":1,"issue_type":"feature","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T20:10:49Z","created_by":"dirtydishes","updated_at":"2026-04-28T20:29:29Z","started_at":"2026-04-28T20:10:53Z","closed_at":"2026-04-28T20:29:29Z","close_reason":"Implemented synthetic market profiles, options signal-path filtering, signal-aware API/replay contracts, Tape page filters, tests, and README updates. Follow-up tracked in islandflow-biq.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-e4r","title":"Implement smart-money flow filtering and synthetic firehose modes","description":"Implement the approved multi-surface plan for named synthetic market profiles, options raw-vs-signal filtering, live/API filter contracts, Tape page client-side flow filters, firehose-readiness improvements, tests, and README updates.","status":"closed","priority":1,"issue_type":"feature","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-04-28T20:10:49Z","created_by":"dirtydishes","updated_at":"2026-04-28T20:29:29Z","started_at":"2026-04-28T20:10:53Z","closed_at":"2026-04-28T20:29:29Z","close_reason":"Implemented synthetic market profiles, options signal-path filtering, signal-aware API/replay contracts, Tape page filters, tests, and README updates. Follow-up tracked in islandflow-biq.","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-64s","title":"Fix desktop startup failure from @islandflow/types ESM imports","description":"Electron desktop startup fails with ERR_MODULE_NOT_FOUND because @islandflow/types exports TypeScript source and internal relative imports lacked .ts extensions under Node/Electron ESM resolution. Update type package internal imports and desktop tsconfig so desktop build and runtime can resolve modules consistently.","status":"closed","priority":2,"issue_type":"bug","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-05-20T22:26:45Z","created_by":"dirtydishes","updated_at":"2026-05-20T22:28:05Z","started_at":"2026-05-20T22:26:50Z","closed_at":"2026-05-20T22:28:05Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-6tn","title":"Add Codex desktop login and usage bridge","description":"Implement a desktop-only Codex integration for the Islandflow Electron app using the official codex app-server with managed ChatGPT login, native IPC, settings UI, usage tracking, and clean web degradation.","status":"closed","priority":2,"issue_type":"feature","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-05-20T14:01:36Z","created_by":"dirtydishes","updated_at":"2026-05-20T14:40:49Z","started_at":"2026-05-20T14:01:48Z","closed_at":"2026-05-20T14:40:49Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-6tn","title":"Add Codex desktop login and usage bridge","description":"Implement a desktop-only Codex integration for the Islandflow Electron app using the official codex app-server with managed ChatGPT login, native IPC, settings UI, usage tracking, and clean web degradation.","status":"closed","priority":2,"issue_type":"feature","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-05-20T14:01:36Z","created_by":"dirtydishes","updated_at":"2026-05-20T14:40:49Z","started_at":"2026-05-20T14:01:48Z","closed_at":"2026-05-20T14:40:49Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-laq","title":"fix native alpaca news deploy and auth","description":"Why this issue exists and what needs to be done:\\n\\nNative Islandflow rollout is incomplete because services/ingest-news is not healthy on the VPS. The checked-in native user units and helper scripts do not fully include ingest-news, and the current service uses bearer-style auth that returns 401 against Alpaca news endpoints.\\n\\nThis task should verify the current Alpaca news auth requirements against official docs, update the repo code and native deployment assets as needed, install and enable the missing VPS unit, verify news events flow end-to-end, and document the work.","status":"closed","priority":2,"issue_type":"bug","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-05-19T23:47:07Z","created_by":"dirtydishes","updated_at":"2026-05-20T00:05:20Z","started_at":"2026-05-19T23:47:12Z","closed_at":"2026-05-20T00:05:20Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-laq","title":"fix native alpaca news deploy and auth","description":"Why this issue exists and what needs to be done:\\n\\nNative Islandflow rollout is incomplete because services/ingest-news is not healthy on the VPS. The checked-in native user units and helper scripts do not fully include ingest-news, and the current service uses bearer-style auth that returns 401 against Alpaca news endpoints.\\n\\nThis task should verify the current Alpaca news auth requirements against official docs, update the repo code and native deployment assets as needed, install and enable the missing VPS unit, verify news events flow end-to-end, and document the work.","status":"closed","priority":2,"issue_type":"bug","assignee":"dirtydishes","owner":"dishes@dpdrm.com","created_at":"2026-05-19T23:47:07Z","created_by":"dirtydishes","updated_at":"2026-05-20T00:05:20Z","started_at":"2026-05-19T23:47:12Z","closed_at":"2026-05-20T00:05:20Z","close_reason":"Closed","dependency_count":0,"dependent_count":0,"comment_count":0}
{"_type":"issue","id":"islandflow-fmg","title":"Fix native deploy SSH path and verification cwd assumptions","description":"Native deploys over SSH assumed bun was already on PATH and that remote verification would run from the repository root. On the live VPS, non-login SSH shells omitted /home/delta/.bun/bin and remote native verification could not find deployment/native/check-native-infra.sh because it ran from the home directory. Update the deploy helper to prepend /Users/kell/.bun/bin when present and cd into the repo before native verification checks run.","status":"closed","priority":2,"issue_type":"bug","owner":"dishes@dpdrm.com","created_at":"2026-05-19T23:38:32Z","created_by":"dirtydishes","updated_at":"2026-05-19T23:40:33Z","closed_at":"2026-05-19T23:40:33Z","close_reason":"Updated native SSH deploy flow to prepend Bun's home install path when present and run native verification from the repo root before health scripts.","dependency_count":0,"dependent_count":0,"comment_count":0} {"_type":"issue","id":"islandflow-fmg","title":"Fix native deploy SSH path and verification cwd assumptions","description":"Native deploys over SSH assumed bun was already on PATH and that remote verification would run from the repository root. On the live VPS, non-login SSH shells omitted /home/delta/.bun/bin and remote native verification could not find deployment/native/check-native-infra.sh because it ran from the home directory. Update the deploy helper to prepend /Users/kell/.bun/bin when present and cd into the repo before native verification checks run.","status":"closed","priority":2,"issue_type":"bug","owner":"dishes@dpdrm.com","created_at":"2026-05-19T23:38:32Z","created_by":"dirtydishes","updated_at":"2026-05-19T23:40:33Z","closed_at":"2026-05-19T23:40:33Z","close_reason":"Updated native SSH deploy flow to prepend Bun's home install path when present and run native verification from the repo root before health scripts.","dependency_count":0,"dependent_count":0,"comment_count":0}

View file

@ -9,6 +9,8 @@
"rootDir": "src", "rootDir": "src",
"outDir": "dist", "outDir": "dist",
"noEmit": false, "noEmit": false,
"allowImportingTsExtensions": true,
"rewriteRelativeImportExtensions": true,
"sourceMap": true, "sourceMap": true,
"declaration": false "declaration": false
}, },

View file

@ -0,0 +1,148 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Turn Doc - Fix desktop types ESM imports</title>
<style>
:root {
color-scheme: light;
--bg: #f7f8fc;
--panel: #ffffff;
--ink: #1c2333;
--muted: #5b6781;
--accent: #2556d8;
--line: #dbe2f1;
}
* { box-sizing: border-box; }
body {
margin: 0;
font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
background: radial-gradient(circle at top left, #eef2ff 0%, var(--bg) 45%);
color: var(--ink);
line-height: 1.55;
}
main {
max-width: 920px;
margin: 32px auto;
padding: 0 20px 48px;
}
article {
background: var(--panel);
border: 1px solid var(--line);
border-radius: 14px;
padding: 28px;
box-shadow: 0 14px 36px rgba(28, 35, 51, 0.08);
}
h1 { margin: 0 0 8px; font-size: 1.6rem; }
.meta { color: var(--muted); margin-bottom: 18px; }
h2 {
margin-top: 26px;
margin-bottom: 10px;
font-size: 1.15rem;
color: #172952;
border-bottom: 1px solid var(--line);
padding-bottom: 6px;
}
p, li { margin: 0 0 10px; }
ul { margin: 0; padding-left: 20px; }
code {
font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
background: #edf2ff;
padding: 1px 5px;
border-radius: 6px;
font-size: 0.92em;
}
pre {
margin: 10px 0 14px;
padding: 14px;
border-radius: 10px;
border: 1px solid #d6def3;
background: #0f1525;
color: #d9e2ff;
overflow-x: auto;
font-family: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
font-size: 0.85rem;
line-height: 1.45;
}
.callout {
border-left: 4px solid var(--accent);
padding: 10px 12px;
border-radius: 8px;
background: #eef3ff;
color: #22335f;
margin: 10px 0;
}
a { color: #1747be; }
</style>
</head>
<body>
<main>
<article>
<h1>Desktop ESM Import Resolution Fix</h1>
<p class="meta">Created: 2026-05-20 18:30 EDT · Branch: <code>lavender/codex-login-management-electron</code></p>
<h2>Summary</h2>
<p>Fixed a desktop startup crash where Electron failed to load <code>@islandflow/types</code> with <code>ERR_MODULE_NOT_FOUND</code> for <code>packages/types/src/events</code>. The types package now uses explicit <code>.ts</code> relative imports, and desktop TypeScript build settings were updated to permit and rewrite those imports during emit.</p>
<h2>Changes Made</h2>
<ul>
<li>Updated all internal re-exports/imports in <code>packages/types/src</code> that pointed to sibling modules without file extensions to use explicit <code>.ts</code> extensions.</li>
<li>Updated desktop TS compiler options in <code>apps/desktop/tsconfig.json</code>:
<code>allowImportingTsExtensions: true</code> and <code>rewriteRelativeImportExtensions: true</code>.</li>
<li>Created and tracked the bug in Beads as <code>islandflow-64s</code>.</li>
</ul>
<h2>Context</h2>
<p>The desktop app launches via Electron (Node ESM behavior), while much of this monorepo is typically run through Bun. Bun accepts extensionless TypeScript relative imports that Node ESM does not. Since <code>@islandflow/types</code> exports source TS (<code>./src/index.ts</code>), Electron loaded those sources directly and failed on extensionless sibling imports.</p>
<h2>Important Implementation Details</h2>
<ul>
<li>The fix stays within current package structure; no new build pipeline was introduced for <code>@islandflow/types</code>.</li>
<li>By enabling <code>rewriteRelativeImportExtensions</code>, desktop emit remains compatible even while accepting <code>.ts</code> specifiers during type-checking.</li>
<li>This avoids adding runtime Node flags and keeps behavior explicit in source and compiler config.</li>
</ul>
<h2>Relevant Diff Snippets</h2>
<p>Unified patch snippets below are diffs.com-compatible patch text format.</p>
<pre><code>diff --git a/packages/types/src/index.ts b/packages/types/src/index.ts
-export * from "./events";
+export * from "./events.ts";
-export * from "./live";
+export * from "./live.ts";
...
diff --git a/apps/desktop/tsconfig.json b/apps/desktop/tsconfig.json
"noEmit": false,
+"allowImportingTsExtensions": true,
+"rewriteRelativeImportExtensions": true,
"sourceMap": true,</code></pre>
<h2>Expected Impact for End-Users</h2>
<p>Desktop developers can run <code>bun run dev:desktop</code> without the startup crash. This unblocks local desktop testing and feature work without requiring manual runtime flags or ad hoc environment tweaks.</p>
<h2>Validation</h2>
<ul>
<li>Ran <code>bun --cwd=apps/desktop run build</code> successfully.</li>
<li>Ran <code>node -e "import('./packages/types/src/index.ts')"</code> to confirm direct source import resolution works after the import updates.</li>
<li>Ran <code>bun run dev:desktop</code> and confirmed Electron launched successfully past the previous module-resolution failure (manually interrupted afterward).</li>
</ul>
<h2>Issues, Limitations, and Mitigations</h2>
<ul>
<li>This fix assumes Node/Electron TypeScript type-stripping support remains available for direct TS source loading.</li>
<li>The plugin catalog 403 warnings observed during launch are unrelated to this module-resolution fix and remain unchanged.</li>
</ul>
<h2>Follow-up Work</h2>
<ul>
<li>Evaluate whether <code>@islandflow/types</code> should eventually ship a dedicated built JS output for stricter runtime portability beyond Bun/Electron workflows.</li>
<li>Add a lightweight desktop smoke check in CI for startup-path regressions around workspace package resolution.</li>
</ul>
<p class="callout">Beads issue: <code>islandflow-64s</code>.</p>
</article>
</main>
</body>
</html>

View file

@ -5,8 +5,8 @@ import {
FlowPacketSchema, FlowPacketSchema,
OptionPrintSchema, OptionPrintSchema,
SmartMoneyEventSchema SmartMoneyEventSchema
} from "./events"; } from "./events.ts";
import { OptionFlowFiltersSchema } from "./options-flow"; import { OptionFlowFiltersSchema } from "./options-flow.ts";
export const IslandflowAiReasoningEffortSchema = z.enum([ export const IslandflowAiReasoningEffortSchema = z.enum([
"none", "none",

View file

@ -1,5 +1,5 @@
import { z } from "zod"; import { z } from "zod";
import { OptionNbboSideSchema, OptionTypeSchema, OptionsSignalModeSchema } from "./options-flow"; import { OptionNbboSideSchema, OptionTypeSchema, OptionsSignalModeSchema } from "./options-flow.ts";
export const EventMetaSchema = z.object({ export const EventMetaSchema = z.object({
source_ts: z.number().int().nonnegative(), source_ts: z.number().int().nonnegative(),

View file

@ -1,6 +1,6 @@
export * from "./events"; export * from "./events.ts";
export * from "./live"; export * from "./live.ts";
export * from "./options-flow"; export * from "./options-flow.ts";
export * from "./sp500"; export * from "./sp500.ts";
export * from "./synthetic-market"; export * from "./synthetic-market.ts";
export * from "./desktop-ai"; export * from "./desktop-ai.ts";

View file

@ -12,11 +12,11 @@ import {
OptionNBBOSchema, OptionNBBOSchema,
OptionPrintSchema, OptionPrintSchema,
SmartMoneyEventSchema SmartMoneyEventSchema
} from "./events"; } from "./events.ts";
import { import {
OptionFlowFiltersSchema, OptionFlowFiltersSchema,
optionFlowFilterKey optionFlowFilterKey
} from "./options-flow"; } from "./options-flow.ts";
export const CursorSchema = z.object({ export const CursorSchema = z.object({
ts: z.number().int().nonnegative(), ts: z.number().int().nonnegative(),

View file

@ -1,5 +1,5 @@
import { z } from "zod"; import { z } from "zod";
import type { FlowPacket, OptionNBBO, OptionPrint } from "./events"; import type { FlowPacket, OptionNBBO, OptionPrint } from "./events.ts";
export const SyntheticMarketModeSchema = z.enum(["realistic", "active", "firehose"]); export const SyntheticMarketModeSchema = z.enum(["realistic", "active", "firehose"]);
export type SyntheticMarketMode = z.infer<typeof SyntheticMarketModeSchema>; export type SyntheticMarketMode = z.infer<typeof SyntheticMarketModeSchema>;

View file

@ -1,7 +1,7 @@
import { z } from "zod"; import { z } from "zod";
import type { SmartMoneyProfileId } from "./events"; import type { SmartMoneyProfileId } from "./events.ts";
import type { SyntheticMarketMode } from "./options-flow"; import type { SyntheticMarketMode } from "./options-flow.ts";
import { SP500_SYMBOLS } from "./sp500"; import { SP500_SYMBOLS } from "./sp500.ts";
const SYNTHETIC_PROFILE_WEIGHT_VALUES = [0.6, 1.0, 1.6] as const; const SYNTHETIC_PROFILE_WEIGHT_VALUES = [0.6, 1.0, 1.6] as const;
const SYNTHETIC_COVERAGE_WINDOW_VALUES = [10, 20, 30] as const; const SYNTHETIC_COVERAGE_WINDOW_VALUES = [10, 20, 30] as const;