@jkwd/inbase 0.1.21 → 0.1.23

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.
Files changed (58) hide show
  1. package/README.md +13 -7
  2. package/apps/explorer/package.json +1 -0
  3. package/apps/explorer/scripts/explain-store.d.ts +135 -0
  4. package/apps/explorer/scripts/explain-store.mjs +666 -0
  5. package/apps/explorer/scripts/patch-lib.mjs +4 -0
  6. package/apps/explorer/scripts/scan-target.mjs +22 -5
  7. package/apps/explorer/scripts/session-store.d.ts +86 -11
  8. package/apps/explorer/scripts/session-store.mjs +371 -58
  9. package/apps/explorer/scripts/target-config.d.ts +38 -3
  10. package/apps/explorer/scripts/target-config.mjs +147 -3
  11. package/apps/explorer/src/App.tsx +1073 -158
  12. package/apps/explorer/src/agentIntent.ts +61 -7
  13. package/apps/explorer/src/codebase.ts +1 -1
  14. package/apps/explorer/src/devTargets.ts +66 -0
  15. package/apps/explorer/src/explain.ts +312 -0
  16. package/apps/explorer/src/index.css +874 -222
  17. package/apps/explorer/src/layout.ts +55 -0
  18. package/apps/explorer/src/scene/DistantFileBlocks.tsx +4 -2
  19. package/apps/explorer/src/scene/FileBlock.tsx +95 -72
  20. package/apps/explorer/src/scene/FolderArea.tsx +55 -32
  21. package/apps/explorer/src/scene/MapView.tsx +506 -33
  22. package/apps/explorer/src/scene/RelationLines.tsx +7 -0
  23. package/apps/explorer/src/scene/World.tsx +146 -32
  24. package/apps/explorer/src/speech.ts +228 -0
  25. package/apps/explorer/src/theme.ts +29 -0
  26. package/apps/explorer/src/types.ts +98 -8
  27. package/apps/explorer/src/ui/CanvasErrorBoundary.tsx +1 -1
  28. package/apps/explorer/src/ui/ExplainAskCard.tsx +142 -0
  29. package/apps/explorer/src/ui/ExplainHud.tsx +524 -0
  30. package/apps/explorer/src/ui/ExplainInfoPanel.tsx +135 -0
  31. package/apps/explorer/src/ui/ExplainPointer.tsx +73 -0
  32. package/apps/explorer/src/ui/EyeIcon.tsx +38 -1
  33. package/apps/explorer/src/ui/HUD.tsx +1067 -795
  34. package/apps/explorer/src/ui/NameInput.tsx +114 -5
  35. package/apps/explorer/src/userContext.ts +0 -11
  36. package/apps/explorer/src/userCreated.ts +54 -1
  37. package/apps/explorer/vite.config.ts +173 -26
  38. package/bin/inbase.mjs +11 -2
  39. package/bin/project.mjs +6 -4
  40. package/bin/session.mjs +287 -38
  41. package/package.json +4 -1
  42. package/skill/commands/amber.md +23 -0
  43. package/skill/commands/blue.md +13 -0
  44. package/skill/commands/coral.md +23 -0
  45. package/skill/commands/explain.md +77 -0
  46. package/skill/commands/green.md +23 -0
  47. package/skill/commands/inbase.md +7 -5
  48. package/skill/commands/lime.md +23 -0
  49. package/skill/commands/orange.md +23 -0
  50. package/skill/commands/purple.md +23 -0
  51. package/skill/commands/red.md +23 -0
  52. package/skill/commands/skipinbase.md +1 -1
  53. package/skill/commands/violet.md +23 -0
  54. package/skill/commands/yellow.md +23 -0
  55. package/skill/inbase/SKILL.md +124 -76
  56. package/apps/explorer/src/scene/BlockPlacer.tsx +0 -78
  57. package/apps/explorer/src/scene/IslandPlacer.tsx +0 -31
  58. package/apps/explorer/src/scene/SelectionThumbnail.tsx +0 -1069
@@ -49,7 +49,23 @@ function resolvesThroughIgnored(absolutePath, root) {
49
49
  }
50
50
  }
51
51
 
52
- function walk(dir, root, ignoreSets, acc = []) {
52
+ function isInside(filePath, root) {
53
+ const file = path.resolve(filePath)
54
+ const base = path.resolve(root)
55
+ return file === base || file.startsWith(base + path.sep)
56
+ }
57
+
58
+ function dataDirToSkip(root, dest) {
59
+ if (!dest) return null
60
+ const dataRoot = path.dirname(path.resolve(dest))
61
+ const target = path.resolve(root)
62
+ if (dataRoot === target) return null
63
+ const relative = path.relative(target, dataRoot)
64
+ if (!relative || relative.startsWith('..') || path.isAbsolute(relative)) return null
65
+ return dataRoot
66
+ }
67
+
68
+ function walk(dir, root, ignoreSets, skipRoot = null, acc = []) {
53
69
  const localRules = readGitignoreRules(dir)
54
70
  const nextSets = localRules.length
55
71
  ? [...ignoreSets, { base: dir, rules: localRules }]
@@ -62,6 +78,7 @@ function walk(dir, root, ignoreSets, acc = []) {
62
78
  }
63
79
  for (const entry of entries) {
64
80
  const absolutePath = path.join(dir, entry.name)
81
+ if (skipRoot && isInside(absolutePath, skipRoot)) continue
65
82
  const relative = toPosix(path.relative(root, absolutePath))
66
83
  if (
67
84
  shouldIgnoreRelativePath(relative) ||
@@ -79,7 +96,7 @@ function walk(dir, root, ignoreSets, acc = []) {
79
96
  }
80
97
  }
81
98
  if (stat.isDirectory()) {
82
- walk(absolutePath, root, nextSets, acc)
99
+ walk(absolutePath, root, nextSets, skipRoot, acc)
83
100
  continue
84
101
  }
85
102
  if (!stat.isFile()) continue
@@ -89,8 +106,8 @@ function walk(dir, root, ignoreSets, acc = []) {
89
106
  return acc
90
107
  }
91
108
 
92
- function listSourceAbsolutes(root) {
93
- return walk(root, root, collectGitignoreSets(root))
109
+ function listSourceAbsolutes(root, skipRoot = null) {
110
+ return walk(root, root, collectGitignoreSets(root), skipRoot)
94
111
  }
95
112
 
96
113
  function languageOf(filePath) {
@@ -192,7 +209,7 @@ export function scanTarget({
192
209
  )
193
210
  }
194
211
 
195
- const absoluteFiles = listSourceAbsolutes(root)
212
+ const absoluteFiles = listSourceAbsolutes(root, dataDirToSkip(root, dest))
196
213
  const folders = new Map()
197
214
  ensureFolder(folders, '.', name)
198
215
 
@@ -51,9 +51,11 @@ export type DiffManifest = {
51
51
  | 'finished'
52
52
  | 'stopped'
53
53
  awaitingAttach?: boolean
54
+ color?: string
54
55
  currentStep: number
55
56
  activeDiffId: string | null
56
57
  pendingInstruction: string | null
58
+ pendingExplain?: boolean
57
59
  initialInstruction?: string | null
58
60
  contextFiles?: SessionContextFile[]
59
61
  workStartedAt: string | null
@@ -61,6 +63,8 @@ export type DiffManifest = {
61
63
  createdAt: string
62
64
  updatedAt: string
63
65
  diffs: DiffEntry[]
66
+ blueprintRevision?: number
67
+ localBlueprintRevision?: number
64
68
  }
65
69
 
66
70
  export function assertSessionId(value: unknown): string
@@ -103,6 +107,11 @@ export function discardInactiveDiffSessions(
103
107
  targetRoot?: string | null,
104
108
  waiterIds?: Iterable<string>,
105
109
  ): string[]
110
+ export function recycleDisconnectedSessions(
111
+ dataDir: string,
112
+ targetRoot?: string | null,
113
+ waiterIds?: Iterable<string>,
114
+ ): string[]
106
115
  export function recoverOpenDiffSessions(
107
116
  dataDir: string,
108
117
  targetRoot?: string | null,
@@ -136,11 +145,13 @@ export function setupSession(
136
145
  sessionId?: string
137
146
  name?: string
138
147
  feature?: string
148
+ focus?: boolean
139
149
  },
140
150
  ): DiffManifest
141
151
  export function attachSession(
142
152
  dataDir: string,
143
153
  sessionId?: string | null,
154
+ options?: { color?: string | null },
144
155
  ): DiffManifest
145
156
  export function setInitialInstruction(
146
157
  dataDir: string,
@@ -150,6 +161,32 @@ export function setInitialInstruction(
150
161
  export const MAX_CONTEXT_FILES: number
151
162
  export const MAX_CONTEXT_FILE_BYTES: number
152
163
  export const MAX_CONTEXT_TOTAL_BYTES: number
164
+ export const SESSION_SLOT_COUNT: number
165
+ export const SESSION_COLORS: Array<{ id: string; name: string; hex: string }>
166
+ export const SESSION_COLOR_ALIASES: Record<string, string>
167
+ export const GLOBAL_BLUEPRINT_COLOR: { id: 'global'; name: 'Global'; hex: string }
168
+ export function resolveSessionColor(
169
+ colorId: string | null | undefined,
170
+ ): { id: string; name: string; hex: string } | null
171
+ export function parseSessionColorQuery(
172
+ value: string | null | undefined,
173
+ ): { id: string; name: string; hex: string } | null
174
+ export function colorUnknownMessage(query?: string | null): string
175
+ export function colorBusyMessage(colorName: string): string
176
+ export function colorMissingMessage(colorName: string): string
177
+ export function isGlobalBlueprintColor(colorId: string | null | undefined): boolean
178
+ export function findSessionIdByColor(
179
+ dataDir: string,
180
+ colorId: string | null | undefined,
181
+ ): string | null
182
+ export const CHAT_LIMIT_MESSAGE: string
183
+ export const NOT_RUNNING_MESSAGE: string
184
+ export function enableSessionPool(dataDir: string, count?: number): void
185
+ export function sessionPoolSize(dataDir: string): number
186
+ export function ensureSessionPool(
187
+ dataDir: string,
188
+ options?: { count?: number; focus?: boolean },
189
+ ): DiffManifest[]
153
190
  export function listContextFiles(
154
191
  dataDir: string,
155
192
  sessionId: string,
@@ -189,6 +226,18 @@ export type SessionBlueprint = {
189
226
  }
190
227
  export function emptyBlueprint(): SessionBlueprint
191
228
  export function readBlueprint(dataDir: string, sessionId?: string): SessionBlueprint
229
+ export function readLocalBlueprint(dataDir: string, sessionId?: string | null): SessionBlueprint
230
+ export function readBlueprintByColor(
231
+ dataDir: string,
232
+ colorId?: string | null,
233
+ ): SessionBlueprint
234
+ export type LocalBlueprint = SessionBlueprint & {
235
+ color: string
236
+ colorName: string
237
+ colorHex: string
238
+ sessionId: string
239
+ }
240
+ export function listLocalBlueprints(dataDir: string): LocalBlueprint[]
192
241
  export function writeBlueprint(
193
242
  dataDir: string,
194
243
  blueprint: SessionBlueprint,
@@ -198,17 +247,36 @@ export function writeBlueprint(
198
247
  sessionId: string,
199
248
  blueprint: SessionBlueprint,
200
249
  ): SessionBlueprint
201
- export function setBlueprintHidden(dataDir: string, hidden: boolean): SessionBlueprint
202
- export function clearBlueprint(dataDir: string): SessionBlueprint
250
+ export function writeLocalBlueprint(
251
+ dataDir: string,
252
+ sessionId: string,
253
+ blueprint: Partial<SessionBlueprint>,
254
+ ): SessionBlueprint
255
+ export function writeBlueprintByColor(
256
+ dataDir: string,
257
+ colorId: string | null | undefined,
258
+ blueprint: Partial<SessionBlueprint>,
259
+ ): SessionBlueprint
260
+ export function setBlueprintHidden(
261
+ dataDir: string,
262
+ hidden: boolean,
263
+ colorId?: string | null,
264
+ ): SessionBlueprint
265
+ export function clearBlueprint(
266
+ dataDir: string,
267
+ colorId?: string | null,
268
+ ): SessionBlueprint
203
269
  export function cleanupBlueprint(
204
270
  dataDir: string,
205
271
  knownFileIds?: string[],
206
272
  knownFolderPaths?: string[],
273
+ colorId?: string | null,
207
274
  ): SessionBlueprint
208
275
  export function markBlueprintSeen(
209
276
  dataDir: string,
210
277
  sessionId: string,
211
278
  revision: number,
279
+ localRevision?: number,
212
280
  ): DiffManifest | null
213
281
  export function answerBlueprint(
214
282
  dataDir: string,
@@ -219,6 +287,7 @@ export function updateBlueprint(
219
287
  dataDir: string,
220
288
  sessionId?: string | null,
221
289
  input?: {
290
+ color?: string | null
222
291
  userCreatedBlocks?: unknown[]
223
292
  userCreatedIslands?: unknown[]
224
293
  addedFunctions?: unknown[]
@@ -231,15 +300,7 @@ export function updateBlueprint(
231
300
  export function sendBlueprint(
232
301
  dataDir: string,
233
302
  sessionId: string,
234
- input?: {
235
- userCreatedBlocks?: unknown[]
236
- userCreatedIslands?: unknown[]
237
- addedFunctions?: unknown[]
238
- addedVariables?: unknown[]
239
- addedImports?: unknown[]
240
- notes?: unknown[]
241
- pointers?: unknown[]
242
- },
303
+ input?: unknown,
243
304
  ): DiffManifest
244
305
  export function maybeStartVisualizerHandshake(
245
306
  dataDir: string,
@@ -341,6 +402,20 @@ export function requestReplan(
341
402
  instruction: string,
342
403
  targetRoot?: string | null,
343
404
  ): DiffManifest
405
+ export function notifySessionExplain(
406
+ dataDir: string,
407
+ sessionId: string,
408
+ detail?: string,
409
+ ): DiffManifest | null
410
+ export function requestExplainProposal(
411
+ dataDir: string,
412
+ sessionId: string,
413
+ diffId?: string | null,
414
+ ): DiffManifest
415
+ export function consumeExplainRequest(
416
+ dataDir: string,
417
+ sessionId: string,
418
+ ): DiffManifest | null
344
419
  export function stopSession(
345
420
  dataDir: string,
346
421
  sessionId: string,