-
-
Notifications
You must be signed in to change notification settings - Fork 2
feat: support Cursor SDK model params in proof #178
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
c286dc0
e7a6635
a5edf80
eef6d77
b14e91b
b4ab445
e397c90
51f4b27
62bafce
22eb835
37c4d3d
3289fe3
1b45c7e
f3c051d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,15 @@ | |
|
|
||
| import { writeFile, mkdir } from 'node:fs/promises'; | ||
| import { dirname } from 'node:path'; | ||
| import type { Complexity, DAG, TaskKind } from './dag.js'; | ||
| import { | ||
| formatModelSelection, | ||
| normalizeModelSelection, | ||
| type Complexity, | ||
| type DAG, | ||
| type ModelSelection, | ||
| type ModelSpec, | ||
| type TaskKind, | ||
| } from './dag.js'; | ||
|
|
||
| export type TaskStatus = | ||
| | 'PENDING' | ||
|
|
@@ -27,6 +35,7 @@ export interface TaskState { | |
| subtask_prompt: string; | ||
| status: TaskStatus; | ||
| model: string; | ||
| modelSelection?: ModelSelection; | ||
| /** `'task'` (default), `'pause'`, or `'oracle'`. Undefined is normalized to `'task'`. */ | ||
| kind?: TaskKind; | ||
| /** | ||
|
|
@@ -91,25 +100,34 @@ export interface RunState { | |
|
|
||
| export function initialRunState( | ||
| dag: DAG, | ||
| modelFor: (c: Complexity) => string | ||
| modelFor: (c: Complexity) => ModelSpec | ||
| ): RunState { | ||
| return { | ||
| title: dag.title, | ||
| startedAt: Date.now(), | ||
| tasks: dag.tasks.map((t) => ({ | ||
| id: t.id, | ||
| depends_on: t.depends_on, | ||
| complexity: t.complexity, | ||
| subtask_prompt: t.subtask_prompt, | ||
| status: 'PENDING', | ||
| model: modelFor(t.complexity), | ||
| // Normalize undefined kind → 'task' so downstream consumers (canvas | ||
| // template, runner dispatcher) never have to ?? again. | ||
| kind: t.kind ?? 'task', | ||
| // Surface oracle-only fields so the canvas can render the gate's | ||
| // command / expectation without reading the streamed result body. | ||
| ...(t.kind === 'oracle' ? { command: t.command, expect: t.expect } : {}), | ||
| })), | ||
| tasks: dag.tasks.map((t) => { | ||
| const modelSelection = normalizeModelSelection( | ||
| modelFor(t.complexity), | ||
| `model for task ${t.id}` | ||
| ); | ||
| return { | ||
| id: t.id, | ||
| depends_on: t.depends_on, | ||
| complexity: t.complexity, | ||
| subtask_prompt: t.subtask_prompt, | ||
| status: 'PENDING', | ||
| model: formatModelSelection(modelSelection), | ||
| modelSelection, | ||
| // Normalize undefined kind → 'task' so downstream consumers (canvas | ||
| // template, runner dispatcher) never have to ?? again. | ||
| kind: t.kind ?? 'task', | ||
| // Surface oracle-only fields so the canvas can render the gate's | ||
| // command / expectation without reading the streamed result body. | ||
| ...(t.kind === 'oracle' | ||
| ? { command: t.command, expect: t.expect } | ||
| : {}), | ||
| }; | ||
| }), | ||
| }; | ||
| } | ||
|
|
||
|
|
@@ -215,13 +233,25 @@ type TaskStatus = | |
| type Complexity = 'HIGH' | 'MED' | 'LOW'; | ||
| type TaskKind = 'task' | 'pause' | 'oracle'; | ||
|
|
||
| // Keep in sync with ModelParameterValue / ModelSelection in dag.ts. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Canvas template types still duplicated — silent drift risk (prior finding, still open). The A field added to the public One pragmatic option: add a prose list of the fields being mirrored to the comment so a code reviewer has a checklist: // Keep in sync with ModelParameterValue / ModelSelection in dag.ts.
// Fields mirrored: ModelParameterValue.{id, value}; ModelSelection.{id, params?}.
// If either type gains a field, update both this template copy and the canvas render below.A stronger option (if the template compilation step is ever added) is to import and |
||
| interface ModelParameterValue { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The Minimal fix: add a structural assertion outside the template string: type _AssertModelSelectionInSync =
import('./dag.js').ModelSelection extends ModelSelection ? true : never;This turns any structural divergence into a compile error that the package's own There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Canvas template types still manually duplicated — compile-time sync enforcement missing.
A snapshot/integration test that exercises |
||
| id: string; | ||
| value: string; | ||
| } | ||
|
|
||
| interface ModelSelection { | ||
|
cursor[bot] marked this conversation as resolved.
|
||
| id: string; | ||
| params?: ModelParameterValue[]; | ||
| } | ||
|
|
||
| interface TaskState { | ||
| id: string; | ||
| depends_on: string[]; | ||
| complexity: Complexity; | ||
| subtask_prompt: string; | ||
| status: TaskStatus; | ||
| model: string; | ||
| modelSelection?: ModelSelection; | ||
| kind?: TaskKind; | ||
| command?: string; | ||
| expect?: string; | ||
|
|
@@ -684,6 +714,12 @@ function TaskList({ | |
| : ''} | ||
| {(t.iteration ?? 0) > 0 ? ' · iteration ' + t.iteration : ''} | ||
| </Text> | ||
| {t.modelSelection?.params && t.modelSelection.params.length > 0 ? ( | ||
| <Text size="small" tone="tertiary" style={{ paddingLeft: 12 }}> | ||
| {'Params: ' + | ||
| t.modelSelection.params.map((p) => p.id + '=' + p.value).join(', ')} | ||
| </Text> | ||
| ) : null} | ||
| {effectiveKind(t) === 'pause' && t.checkpointPath ? ( | ||
| <Stack gap={4}> | ||
| <Text size="small" weight="semibold"> | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.