@volter-ai-dev/supercode-ui 0.1.63 → 0.1.64

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.
package/README.md CHANGED
@@ -263,6 +263,9 @@ opaque-key callback and retains the reversible locator map. Its `isWritable` cap
263
263
  is fail-closed: unread badges remain neutral until the host proves a real send or terminal-control
264
264
  path. Runtime activity remains independent, so a read-only channel can still truthfully show that
265
265
  its external agent is working or needs input.
266
+ `matchesSessionRef`, `projectAttachedSession`, and `formatWorkspacePath` complete that trusted-host
267
+ adapter so products do not need local copies of active-session matching, fallback header identity,
268
+ or home-relative path formatting.
266
269
 
267
270
  ## Modularity contract
268
271
 
package/controller.d.ts CHANGED
@@ -72,6 +72,23 @@ export interface SessionInventoryProjectionOptions {
72
72
  isWritable?(descriptor: SessionDescriptor): boolean;
73
73
  }
74
74
 
75
+ export interface ActiveSessionRef {
76
+ harness: string;
77
+ sessionId: string | null;
78
+ }
79
+
80
+ export function formatWorkspacePath(cwd: string | null | undefined, home?: string): string;
81
+ export function matchesSessionRef(
82
+ descriptor: SessionDescriptor,
83
+ active: ActiveSessionRef | null | undefined,
84
+ ): boolean;
85
+ export function projectAttachedSession(
86
+ active: ActiveSessionRef | null | undefined,
87
+ rows: readonly SessionRowModel[],
88
+ fallbackWorkspace: string,
89
+ home?: string,
90
+ ): AttachedSessionModel | null;
91
+
75
92
  export function sessionConversationUpdatedAt(descriptor: SessionDescriptor): number | null;
76
93
  export function sessionDescriptorRuntimeStatus(
77
94
  descriptor: SessionDescriptor,
package/controller.mjs CHANGED
@@ -29,12 +29,42 @@ function workspaceName(cwd) {
29
29
  return cwd.replaceAll('\\', '/').split('/').filter(Boolean).at(-1) ?? cwd;
30
30
  }
31
31
 
32
- function shortWorkspacePath(cwd, home) {
32
+ export function formatWorkspacePath(cwd, home) {
33
33
  if (typeof cwd !== 'string' || !cwd) return '';
34
34
  const root = typeof home === 'string' && home.endsWith('/') ? home.slice(0, -1) : home;
35
35
  return root && (cwd === root || cwd.startsWith(`${root}/`)) ? `~${cwd.slice(root.length)}` : cwd;
36
36
  }
37
37
 
38
+ export function matchesSessionRef(descriptor, active) {
39
+ return Boolean(
40
+ active?.sessionId !== null &&
41
+ active?.sessionId !== undefined &&
42
+ descriptor?.locator?.harness === active.harness &&
43
+ descriptor?.locator?.session_id === active.sessionId,
44
+ );
45
+ }
46
+
47
+ export function projectAttachedSession(active, rows, fallbackWorkspace, home) {
48
+ if (!active?.harness) return null;
49
+ const row = rows.find((candidate) => candidate.active);
50
+ if (row) {
51
+ return {
52
+ key: row.key,
53
+ harness: row.harness,
54
+ name: row.name,
55
+ cwd: row.cwd,
56
+ title: row.title,
57
+ };
58
+ }
59
+ return {
60
+ key: '',
61
+ harness: active.harness,
62
+ name: workspaceName(fallbackWorkspace) || 'no workspace',
63
+ cwd: formatWorkspacePath(fallbackWorkspace, home),
64
+ title: workspaceName(fallbackWorkspace) || 'Untitled chat',
65
+ };
66
+ }
67
+
38
68
  function compactTopic(value) {
39
69
  const text = typeof value === 'string' ? value.replace(/\s+/g, ' ').trim() : '';
40
70
  if (text.length <= 72) return text;
@@ -115,7 +145,7 @@ export function projectSessionInventory(descriptors, options) {
115
145
  key,
116
146
  harness: descriptor.locator.harness,
117
147
  name: workspaceName(descriptor.cwd) || 'no workspace',
118
- cwd: shortWorkspacePath(descriptor.cwd, options.home),
148
+ cwd: formatWorkspacePath(descriptor.cwd, options.home),
119
149
  title: descriptorTitle(descriptor),
120
150
  preview: preview?.text ?? '',
121
151
  age: relativeAge(preview?.updatedAt ?? updatedAt, now),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volter-ai-dev/supercode-ui",
3
- "version": "0.1.63",
3
+ "version": "0.1.64",
4
4
  "type": "module",
5
5
  "description": "Composable default UI kit for Supercode-powered coding-agent experiences",
6
6
  "exports": {