@jkwd/inbase 0.1.10 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,6 @@
1
- import { Suspense } from 'react'
1
+ import { Suspense, useRef } from 'react'
2
2
  import { Billboard, Edges, Html, Text } from '@react-three/drei'
3
+ import { useFrame, useThree } from '@react-three/fiber'
3
4
  import { CHANGE_HIGHLIGHT, CONFIG, dimColor, fileColor, FILE_SELECTION, MAP_SELECTION, type ChangeKind } from '../theme'
4
5
  import { NameInput } from '../ui/NameInput'
5
6
  import { MapSelectBorder } from './MapSelectBorder'
@@ -40,6 +41,50 @@ function fileLabel(name: string, changeKind: ChangeKind | null, added: boolean)
40
41
  return name
41
42
  }
42
43
 
44
+ function changeMark(changeKind: ChangeKind | null, added: boolean) {
45
+ if (changeKind === 'remove') return 'D'
46
+ if (changeKind === 'add' || added) return 'A'
47
+ if (changeKind === 'edit') return 'U'
48
+ return null
49
+ }
50
+
51
+ function MapChangeMark({
52
+ mark,
53
+ width,
54
+ depth,
55
+ height,
56
+ }: {
57
+ mark: string
58
+ width: number
59
+ depth: number
60
+ height: number
61
+ }) {
62
+ const camera = useThree((state) => state.camera)
63
+ const markRef = useRef<HTMLDivElement>(null)
64
+
65
+ useFrame(() => {
66
+ const el = markRef.current
67
+ if (!el) return
68
+ const zoom = 'zoom' in camera ? Number(camera.zoom) : 1
69
+ const px = Math.min(width, depth) * 0.78 * zoom
70
+ el.style.fontSize = `${Math.max(px, 1)}px`
71
+ })
72
+
73
+ return (
74
+ <Html
75
+ position={[0, height / 2 + 0.12, 0]}
76
+ center
77
+ occlude={false}
78
+ zIndexRange={[120, 100]}
79
+ style={{ pointerEvents: 'none' }}
80
+ >
81
+ <div ref={markRef} className="map-change-mark">
82
+ {mark}
83
+ </div>
84
+ </Html>
85
+ )
86
+ }
87
+
43
88
  export function FileBlock({
44
89
  file,
45
90
  placed,
@@ -63,9 +108,11 @@ export function FileBlock({
63
108
  changeKind && highlightMapChange && !selected
64
109
  ? CHANGE_HIGHLIGHT[changeKind]
65
110
  : null
66
- const color = added || file.userCreated ? '#7ec8e8' : fileColor(file.language)
111
+ const isAdded = added || Boolean(file.userCreated)
112
+ const color = isAdded ? '#7ec8e8' : fileColor(file.language)
67
113
  const muted = dimColor(color, 0.32)
68
- const label = fileLabel(file.name, changeKind, added || Boolean(file.userCreated))
114
+ const label = fileLabel(file.name, changeKind, isAdded)
115
+ const mark = changeMark(changeKind, isAdded)
69
116
  const labelColor = aimed
70
117
  ? '#9ad8ff'
71
118
  : highlight
@@ -105,7 +152,7 @@ export function FileBlock({
105
152
  ? FILE_SELECTION.emissive
106
153
  : related
107
154
  ? '#1f4a44'
108
- : added || file.userCreated
155
+ : isAdded
109
156
  ? '#2a5064'
110
157
  : dimmed
111
158
  ? muted
@@ -120,7 +167,7 @@ export function FileBlock({
120
167
  ? 0.55
121
168
  : related
122
169
  ? 0.18
123
- : added || file.userCreated
170
+ : isAdded
124
171
  ? 0.22
125
172
  : dimmed
126
173
  ? 0.08
@@ -148,6 +195,9 @@ export function FileBlock({
148
195
  userData={{ fileId: file.id }}
149
196
  />
150
197
  )}
198
+ {mapMode && !naming && mark && (
199
+ <MapChangeMark mark={mark} width={width} depth={depth} height={height} />
200
+ )}
151
201
  {naming && onCommitName && onCancelName && (
152
202
  <Html
153
203
  position={[0, height / 2 + 0.42, 0]}
@@ -114,6 +114,7 @@ export type UserContext = {
114
114
  z: number
115
115
  }
116
116
  followLook?: boolean
117
+ showBranchChanges?: boolean
117
118
  userCreatedBlocks?: UserCreatedBlock[]
118
119
  userCreatedIslands?: UserCreatedIsland[]
119
120
  }
@@ -160,6 +161,40 @@ export function canStopSession(intent: {
160
161
  return Boolean(intent.sessionId) && intent.status !== 'idle'
161
162
  }
162
163
 
164
+ export function llmIsMakingChanges(intent: {
165
+ working: boolean
166
+ preview: boolean
167
+ status: AgentIntentStatus
168
+ }) {
169
+ return (
170
+ intent.working ||
171
+ intent.preview ||
172
+ intent.status === 'preparing' ||
173
+ intent.status === 'working' ||
174
+ intent.status === 'replanning' ||
175
+ intent.status === 'pending' ||
176
+ intent.status === 'extend' ||
177
+ intent.status === 'extended'
178
+ )
179
+ }
180
+
181
+ export type BranchChanges = {
182
+ available: boolean
183
+ branch: string | null
184
+ base: string | null
185
+ files: string[]
186
+ creates: string[]
187
+ deletes: string[]
188
+ createFolders: string[]
189
+ createLines: Record<string, number>
190
+ imports: PatchImport[]
191
+ addedFunctions: PatchSymbolAddition[]
192
+ addedVariables: PatchSymbolAddition[]
193
+ addedImports: PatchImportAddition[]
194
+ changedFunctions: PatchSymbolAddition[]
195
+ changedVariables: PatchSymbolAddition[]
196
+ }
197
+
163
198
  export type PlanStep = {
164
199
  index: number
165
200
  title: string
@@ -227,6 +262,7 @@ export type AgentIntent = {
227
262
  updatedAt: string | null
228
263
  showMap: boolean
229
264
  status: AgentIntentStatus
265
+ name: string | null
230
266
  feature: string | null
231
267
  steps: PlanStep[]
232
268
  step: number | null
@@ -254,6 +290,14 @@ export type AgentIntent = {
254
290
  working: boolean
255
291
  stalledWait: boolean
256
292
  llmIdle?: boolean
293
+ awaitingAttach?: boolean
294
+ listening?: boolean
295
+ lastAck?: {
296
+ kind: string
297
+ detail: string
298
+ at: string | null
299
+ } | null
300
+ initialInstruction?: string | null
257
301
  creationMode: boolean
258
302
  canEnterBlueprint: boolean
259
303
  blueprintSessionId: string | null