mirror of
https://github.com/himanshudongre/smriti.git
synced 2026-08-28 05:14:59 +00:00
Fix pre-existing frontend TypeScript build errors
Type the commit metadata blob — new Note and CommitMetadata interfaces
in types/index.ts — so commit.metadata.notes resolves to Note[] instead
of unknown. This fixes the three CommitDetailPage errors where .length,
.map, and the JSX child type all failed against an unknown/{}-typed
notes field.
Normalize the structured-task list to strings at the rows() call in
ChatWorkspacePage so the string-list renderer receives string[] rather
than (string | StructuredTask)[].
No behavior change. npm run build (tsc -b + vite build) and tsc --noEmit
are now clean.
This commit is contained in:
parent
704f28570c
commit
83e7aa15cb
3 changed files with 20 additions and 3 deletions
|
|
@ -25,6 +25,7 @@ import {
|
|||
reviewCheckpoint,
|
||||
} from '../api/client';
|
||||
import type { Artifact, ChatSession, Commit, CompareResponse, CheckpointReviewResponse, HeadState, TurnEvent, Repo, ProviderStatus } from '../types';
|
||||
import { normalizeTask } from '../types';
|
||||
import {
|
||||
Check,
|
||||
Copy,
|
||||
|
|
@ -626,7 +627,7 @@ function CheckpointDetailPanel({
|
|||
)}
|
||||
{rows(commit.decisions ?? [], 'Decisions')}
|
||||
{rows(commit.assumptions ?? [], 'Assumptions')}
|
||||
{rows(commit.tasks ?? [], 'Tasks')}
|
||||
{rows((commit.tasks ?? []).map(t => normalizeTask(t).text), 'Tasks')}
|
||||
{rows(commit.open_questions ?? [], 'Open Questions')}
|
||||
{rows(commit.entities ?? [], 'Entities')}
|
||||
|
||||
|
|
|
|||
|
|
@ -267,7 +267,7 @@ export function CommitDetailPage() {
|
|||
{commit.metadata?.notes && commit.metadata.notes.length > 0 && (
|
||||
<FieldBlock label="Notes">
|
||||
<div className="space-y-2">
|
||||
{commit.metadata.notes.map((n: any, i: number) => (
|
||||
{commit.metadata.notes.map((n, i) => (
|
||||
<div key={n.id || i} className="text-sm">
|
||||
<div className="flex items-center gap-2 mb-0.5">
|
||||
{n.kind && n.kind !== 'note' && (
|
||||
|
|
|
|||
|
|
@ -98,6 +98,22 @@ export interface Artifact {
|
|||
content: string;
|
||||
}
|
||||
|
||||
/** An additive founder/agent annotation on a checkpoint. */
|
||||
export interface Note {
|
||||
id: string;
|
||||
author: string;
|
||||
text: string;
|
||||
kind: string;
|
||||
created_at: string;
|
||||
}
|
||||
|
||||
/** Commit metadata blob. `notes` are additive annotations; the open index
|
||||
* signature preserves room for other backend-written keys (e.g. session_id). */
|
||||
export interface CommitMetadata {
|
||||
notes?: Note[];
|
||||
[key: string]: unknown;
|
||||
}
|
||||
|
||||
export interface Commit {
|
||||
id: string;
|
||||
repo_id: string;
|
||||
|
|
@ -117,7 +133,7 @@ export interface Commit {
|
|||
artifacts: Artifact[];
|
||||
context_blob: Record<string, unknown>;
|
||||
raw_source_text: string | null;
|
||||
metadata: Record<string, unknown>;
|
||||
metadata: CommitMetadata;
|
||||
created_at: string;
|
||||
}
|
||||
/** Delta between a commit and its parent, used for the diff view on CommitDetailPage */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue