Skip to content

Commit c31d684

Browse files
committed
chore: revert dinocode-specific additions to t3code internals
Reverts the code portions of b765b58 (Desktop Notification mirror for critical toasts). That commit was the wrong direction for this fork: it added a dinocode-specific field (`criticalToastDesktopNotifications`) to t3code's ClientSettings schema, modified t3code's toast helper, and added a row to t3code's settings panel. None of that is a soil/kanban feature, so it should not live in t3code internals. Also adds `docs/dinocode-packages.md` as the authoritative package- architecture doc for this fork: - Cardinal rule: Dinocode additions live in standalone packages (`packages/soil`, `packages/dinocode-*`); `apps/*` only wire them at minimal integration points. - Package map: soil (shipping), dinocode-contracts (planned), dinocode-server (planned), dinocode-board (planned), dinocode-cli (planned), dinocode-agent-tools (planned). - Integration-point rules: single call site, `dinocode-integration:` comment annotation, no new types in `@t3tools/contracts`, no new SQLite migrations in t3code's chain (reserve a dinocode id range or ship a separate DB file), no Dinocode fields in t3code Client/Server Settings. - Refactor plan: three new beans file the extraction of existing coupled code (`b73bfd2c` server orchestration, `69a3ae23` kanban UI) into packages. - Two guard beans (integration-point comments + CI diff guard). DINOCODE.md core principles adds principle pingdotgg#5 ("Standalone packages on top of t3code") pointing at this doc. Re-opens dinocode-a768 with a direction note. Adds dinocode-fm1h (contracts extract), dinocode-k7pm (server extract), dinocode-up4r (board extract), dinocode-mzjt (integration comments), dinocode-yr6l (CI diff guard). Made-with: Cursor
1 parent 69a0ed9 commit c31d684

13 files changed

Lines changed: 210 additions & 154 deletions

‎.beans/dinocode-a768--toast-desktop-notification-api-mirror-for-critical.md‎

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
# dinocode-a768
33
title: "Toast: desktop Notification API mirror for critical toasts"
4-
status: completed
4+
status: todo
55
type: feature
66
priority: low
77
created_at: 2026-04-23T03:08:06Z
8-
updated_at: 2026-04-23T03:17:19Z
8+
updated_at: 2026-04-23T03:37:44Z
99
---
1010

1111
Follow-up to dinocode-5kre audit: when the app is not focused, mirror critical (error/warning) toasts to the system Notification API. Opt-in setting. Should wrap toastManager in apps/web/src/components/ui/toast.tsx and call new Notification(...) when document.hasFocus() is false and the toast type is error/warning.
@@ -30,3 +30,15 @@ Follow-up to dinocode-5kre audit: when the app is not focused, mirror critical (
3030
- `bun lint`: 0 errors (15 pre-existing warnings)
3131
- `bun typecheck`: ok (all 11 packages)
3232
- `bun run test`: 883 passed / 4 skipped across 97 test files
33+
34+
## 2026-04-23 — reverted, re-scoped
35+
36+
The initial implementation landed as commit `b765b58e`, which modified t3code's `ClientSettings` schema (`packages/contracts/src/settings.ts`), t3code's toast helper (`apps/web/src/components/ui/toastHelpers.ts`), and t3code's settings panel (`apps/web/src/components/settings/SettingsPanels.tsx`). That direction was wrong: this is a generic UX feature unrelated to soil/kanban, and it adds dinocode-specific fields to t3code's contract layer.
37+
38+
Reverted in commit following (see below). Re-implementation must come from a Dinocode-owned package without mutating t3code's ClientSettings. Options on the table:
39+
40+
1. **Upstream it to t3code** — this is a sensible t3code feature; contribute it back instead of forking.
41+
2. **Dinocode plugin package (`packages/dinocode-toast-extensions`)** — a small plugin that wraps t3code's toast manager and adds the notification behavior, with its own client-side setting stored in localStorage (not in t3code's ClientSettings).
42+
3. **Drop it** — low priority; not required for v0.1.
43+
44+
Leaning toward option 1 or 3. Do not re-implement without deciding.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# dinocode-fm1h
3+
title: Extract task contracts into packages/dinocode-contracts
4+
status: todo
5+
type: task
6+
priority: high
7+
created_at: 2026-04-23T03:39:22Z
8+
updated_at: 2026-04-23T03:39:22Z
9+
---
10+
11+
Move Dinocode-specific RPC methods and task schemas out of packages/contracts (t3code's contract layer) and into a new packages/dinocode-contracts package. Target sources: the ~320 lines of task schemas added to packages/contracts/src/orchestration.ts in commit b73bfd2c, plus task-related entries in packages/contracts/src/{rpc,ipc,baseSchemas}.ts. Keep t3code's contracts untouched; consumers import from @dinocode/contracts. See docs/dinocode-packages.md.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# dinocode-k7pm
3+
title: Extract server task orchestration into packages/dinocode-server
4+
status: todo
5+
type: task
6+
priority: high
7+
created_at: 2026-04-23T03:39:22Z
8+
updated_at: 2026-04-23T03:39:22Z
9+
---
10+
11+
Move task-specific orchestration code out of apps/server/src/orchestration/_ and apps/server/src/persistence/_ into a new packages/dinocode-server package that exposes Effect layers apps/server mounts at startup. Target sources: task additions to apps/server/src/orchestration/{commandInvariants,decider,projector,runtimeLayer}.ts and Layers/{OrchestrationEngine,ProjectionPipeline,ProjectionSnapshotQuery}.ts; apps/server/src/persistence/{Services,Layers}/ProjectionTasks.ts; apps/server/src/persistence/Migrations/026_ProjectionTasks.ts; task RPC methods in apps/server/src/ws.ts. Dinocode SQLite tables should live in a separate database file or under a migration id range reserved for dinocode. Keep apps/server's file-set changes down to a single-line layer mount. See docs/dinocode-packages.md.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# dinocode-mzjt
3+
title: Integration-point annotations across apps/*
4+
status: todo
5+
type: task
6+
priority: normal
7+
created_at: 2026-04-23T03:39:22Z
8+
updated_at: 2026-04-23T03:39:22Z
9+
---
10+
11+
For every t3code-internal file that wires a Dinocode package in, add a single 'dinocode-integration: <package> <feature>' comment on the integration line so rg 'dinocode-integration' surfaces the complete coupling surface. Enforce in CI with a small script that fails if a file under apps/_ imports from @dinocode/_ without such a comment within 3 lines. See docs/dinocode-packages.md.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# dinocode-up4r
3+
title: Extract Kanban UI into packages/dinocode-board
4+
status: todo
5+
type: task
6+
priority: high
7+
created_at: 2026-04-23T03:39:22Z
8+
updated_at: 2026-04-23T03:39:22Z
9+
---
10+
11+
Move the Kanban board UI out of apps/web and into a new packages/dinocode-board package. Target sources: apps/web/src/components/board/\*, apps/web/src/routes/\_chat.board.$environmentId.$projectId.tsx, apps/web/src/rpc/boardState.ts, and the modifications to apps/web/src/components/ChatView.browser.tsx and apps/web/src/components/KeybindingsToast.browser.tsx. apps/web should re-import via a thin route-adapter module; no dinocode logic lives in apps/web/src/components directly. See docs/dinocode-packages.md.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
---
2+
# dinocode-yr6l
3+
title: "CI guard: flag new @dinocode/* additions to t3code internals"
4+
status: todo
5+
type: task
6+
priority: normal
7+
created_at: 2026-04-23T03:39:22Z
8+
updated_at: 2026-04-23T03:39:22Z
9+
---
10+
11+
Add a CI step that parses 'git diff upstream/main..HEAD --stat' and fails if > N lines of change land in apps/_ or packages/contracts/_ for a commit that does not also carry a label or commit-trailer 'Integration: <package>'. Threshold default: 20 lines. Goal: make t3code-internal churn visible at review time. See docs/dinocode-packages.md.

‎DINOCODE.md‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ The result: a single interface where you can decompose work into tasks, manage t
2222
2. **Parallel by default**: Tasks are independent. Multiple agents can reference different tasks simultaneously without blocking each other.
2323
3. **Minimal chrome**: The UI gets out of the way. Keyboard-driven, low latency, no modal fatigue.
2424
4. **Agent-native**: The system is designed for agents to read and write tasks, not just humans.
25+
5. **Standalone packages on top of t3code**: This repo is a fork of [`pingdotgg/t3code`](https://github.com/pingdotgg/t3code). Every Dinocode feature lives in a standalone package (`packages/soil`, `packages/dinocode-*`) and plugs into `apps/web`, `apps/server`, and `apps/desktop` at minimal integration points. We do not rewrite t3code internals. See [`docs/dinocode-packages.md`](docs/dinocode-packages.md) for the package map and coupling rules.
2526

2627
### Canonical Data Model
2728

‎apps/desktop/src/clientPersistence.test.ts‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ function makeSecretStorage(available: boolean): DesktopSecretStorage {
5151
const clientSettings: ClientSettings = {
5252
confirmThreadArchive: true,
5353
confirmThreadDelete: false,
54-
criticalToastDesktopNotifications: false,
5554
diffWordWrap: true,
5655
favorites: [],
5756
sidebarProjectGroupingMode: "repository_path",

‎apps/web/src/components/settings/SettingsPanels.tsx‎

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -498,10 +498,6 @@ export function useSettingsRestore(onRestored?: () => void) {
498498
...(settings.confirmThreadDelete !== DEFAULT_UNIFIED_SETTINGS.confirmThreadDelete
499499
? ["Delete confirmation"]
500500
: []),
501-
...(settings.criticalToastDesktopNotifications !==
502-
DEFAULT_UNIFIED_SETTINGS.criticalToastDesktopNotifications
503-
? ["Critical toast notifications"]
504-
: []),
505501
...(isGitWritingModelDirty ? ["Git writing model"] : []),
506502
...(areProviderSettingsDirty ? ["Providers"] : []),
507503
],
@@ -510,7 +506,6 @@ export function useSettingsRestore(onRestored?: () => void) {
510506
isGitWritingModelDirty,
511507
settings.confirmThreadArchive,
512508
settings.confirmThreadDelete,
513-
settings.criticalToastDesktopNotifications,
514509
settings.addProjectBaseDirectory,
515510
settings.repositoryIdentityPreferredRemoteName,
516511
settings.defaultThreadEnvMode,
@@ -1130,34 +1125,6 @@ export function GeneralSettingsPanel() {
11301125
}
11311126
/>
11321127

1133-
<SettingsRow
1134-
title="Desktop notifications for critical toasts"
1135-
description="When Dinocode isn't focused, mirror error and warning toasts to the system Notification Center. Requires browser/OS permission."
1136-
resetAction={
1137-
settings.criticalToastDesktopNotifications !==
1138-
DEFAULT_UNIFIED_SETTINGS.criticalToastDesktopNotifications ? (
1139-
<SettingResetButton
1140-
label="critical toast notifications"
1141-
onClick={() =>
1142-
updateSettings({
1143-
criticalToastDesktopNotifications:
1144-
DEFAULT_UNIFIED_SETTINGS.criticalToastDesktopNotifications,
1145-
})
1146-
}
1147-
/>
1148-
) : null
1149-
}
1150-
control={
1151-
<Switch
1152-
checked={settings.criticalToastDesktopNotifications}
1153-
onCheckedChange={(checked) =>
1154-
updateSettings({ criticalToastDesktopNotifications: Boolean(checked) })
1155-
}
1156-
aria-label="Mirror critical toasts to system notifications"
1157-
/>
1158-
}
1159-
/>
1160-
11611128
<SettingsRow
11621129
title="Text generation model"
11631130
description="Configure the model used for generated commit messages, PR titles, and similar Git text."

‎apps/web/src/components/ui/toastHelpers.ts‎

Lines changed: 1 addition & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import type { ToastManagerAddOptions } from "@base-ui/react/toast";
44
import type { ComponentPropsWithoutRef, ReactNode } from "react";
55

6-
import { getClientSettings } from "~/hooks/useSettings";
76
import type { ThreadToastData } from "./toast";
87

98
export type StackedThreadToastOptions = {
@@ -16,14 +15,6 @@ export type StackedThreadToastOptions = {
1615
/** Merged into `data`; `actionLayout` is always forced to `"stacked-end"` by the helper. */
1716
actionVariant?: ThreadToastData["actionVariant"];
1817
data?: Omit<ThreadToastData, "actionLayout">;
19-
/**
20-
* When true (default: auto), the helper also mirrors the toast to the system
21-
* Notification API if the app is not focused, the toast type is error or
22-
* warning, and the `criticalToastDesktopNotifications` client setting is on.
23-
* Pass `false` to suppress mirroring for a specific toast (e.g. the toast is
24-
* already acknowledged through another surface).
25-
*/
26-
mirrorToSystemNotification?: boolean;
2718
};
2819

2920
/**
@@ -32,17 +23,7 @@ export type StackedThreadToastOptions = {
3223
export function stackedThreadToast(
3324
options: StackedThreadToastOptions,
3425
): ToastManagerAddOptions<ThreadToastData> {
35-
const {
36-
type,
37-
title,
38-
description,
39-
timeout,
40-
priority,
41-
actionProps,
42-
actionVariant,
43-
data,
44-
mirrorToSystemNotification,
45-
} = options;
26+
const { type, title, description, timeout, priority, actionProps, actionVariant, data } = options;
4627

4728
// Helper-owned `actionLayout` must win over any caller-provided `data`, so spread
4829
// the caller's data first and apply `actionLayout: "stacked-end"` last.
@@ -73,94 +54,5 @@ export function stackedThreadToast(
7354
payload.actionProps = actionProps;
7455
}
7556

76-
if (mirrorToSystemNotification !== false) {
77-
// Fire-and-forget: any failure (permission denied, unsupported platform,
78-
// non-critical toast, app focused, setting off) short-circuits inside the
79-
// mirror so the toast itself always renders normally.
80-
void maybeMirrorToSystemNotification({ type, title, description });
81-
}
82-
8357
return payload;
8458
}
85-
86-
// ── System Notification mirror ───────────────────────────────────────
87-
88-
let permissionRequestInFlight: Promise<NotificationPermission> | null = null;
89-
90-
/**
91-
* Return the current notification permission, requesting it lazily on the
92-
* first opt-in invocation. Subsequent calls reuse the cached permission and
93-
* never re-prompt (browsers deny repeated `requestPermission` calls anyway).
94-
*/
95-
async function ensureNotificationPermission(): Promise<NotificationPermission> {
96-
if (typeof Notification === "undefined") return "denied";
97-
if (Notification.permission !== "default") return Notification.permission;
98-
if (permissionRequestInFlight) return permissionRequestInFlight;
99-
try {
100-
permissionRequestInFlight = Notification.requestPermission();
101-
return await permissionRequestInFlight;
102-
} catch {
103-
return "denied";
104-
} finally {
105-
permissionRequestInFlight = null;
106-
}
107-
}
108-
109-
function flattenReactNodeForNotification(node: ReactNode): string {
110-
if (node == null || typeof node === "boolean") return "";
111-
if (typeof node === "string") return node;
112-
if (typeof node === "number") return String(node);
113-
if (Array.isArray(node)) {
114-
return node.map(flattenReactNodeForNotification).filter(Boolean).join(" ");
115-
}
116-
// Best effort for React elements: try reading `children` off the props.
117-
const asRecord = node as unknown as { props?: { children?: ReactNode } };
118-
if (asRecord && typeof asRecord === "object" && "props" in asRecord) {
119-
const props = asRecord.props;
120-
if (props && "children" in props) {
121-
return flattenReactNodeForNotification(props.children);
122-
}
123-
}
124-
return "";
125-
}
126-
127-
async function maybeMirrorToSystemNotification(options: {
128-
type: StackedThreadToastOptions["type"];
129-
title: ReactNode;
130-
description?: ReactNode;
131-
}): Promise<void> {
132-
// Only error/warning are considered critical enough to warrant an OS-level
133-
// notification; success/info/loading stay in-app.
134-
if (options.type !== "error" && options.type !== "warning") return;
135-
136-
// Guard against non-browser runtimes (SSR, jsdom without Notification, tests).
137-
if (typeof window === "undefined") return;
138-
if (typeof Notification === "undefined") return;
139-
if (typeof document === "undefined") return;
140-
141-
// Opt-in setting must be on.
142-
const settings = getClientSettings();
143-
if (!settings.criticalToastDesktopNotifications) return;
144-
145-
// Only fire when the app is not focused; otherwise the in-app toast is enough.
146-
if (document.hasFocus()) return;
147-
148-
const permission = await ensureNotificationPermission();
149-
if (permission !== "granted") return;
150-
151-
const title = flattenReactNodeForNotification(options.title) || "Dinocode";
152-
const body = flattenReactNodeForNotification(options.description);
153-
154-
try {
155-
// Warnings shouldn't steal focus; errors can be more insistent.
156-
const notificationOptions: NotificationOptions = {
157-
tag: `dinocode-${options.type}`,
158-
requireInteraction: options.type === "error",
159-
silent: options.type === "warning",
160-
};
161-
if (body) notificationOptions.body = body;
162-
new Notification(title, notificationOptions);
163-
} catch (error) {
164-
console.warn("[toast] Failed to mirror to system notification", error);
165-
}
166-
}

0 commit comments

Comments
 (0)