@cortexkit/common-auth 0.41.1 → 0.43.0

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.
@@ -50,6 +50,7 @@ export interface SetupPlugin {
50
50
  connectionFile: string;
51
51
  hosts: Record<SetupHost, {
52
52
  name: string;
53
+ displayName?: string;
53
54
  paths: Parameters<typeof hostEnrollmentPaths>[0];
54
55
  }>;
55
56
  };
@@ -48,29 +48,28 @@ export async function buildTui(entryFile, variant, destinationDir, options = {})
48
48
  const entry = resolve(entryFile);
49
49
  const destination = resolve(destinationDir);
50
50
  const roots = new Map();
51
- for (const item of options.inline ?? ['@cortexkit/common-auth']) {
52
- if (typeof item !== 'string')
53
- roots.set(item.name, resolve(item.root));
54
- else {
55
- let directory = dirname(entry);
56
- for (;;) {
57
- const manifest = join(directory, 'package.json');
58
- if (existsSync(manifest) &&
59
- JSON.parse(await readFile(manifest, 'utf8')).name === item) {
60
- roots.set(item, realpathSync(directory));
61
- break;
62
- }
63
- const installed = join(directory, 'node_modules', item);
64
- if (existsSync(join(installed, 'package.json'))) {
65
- roots.set(item, realpathSync(installed));
66
- break;
67
- }
68
- const parent = dirname(directory);
69
- if (parent === directory)
70
- throw new Error(`Cannot locate package root for ${item} from ${entry}`);
71
- directory = parent;
51
+ const packageRoot = async (name, from) => {
52
+ let directory = dirname(from);
53
+ for (;;) {
54
+ const manifest = join(directory, 'package.json');
55
+ if (existsSync(manifest) &&
56
+ JSON.parse(await readFile(manifest, 'utf8')).name === name) {
57
+ return realpathSync(directory);
58
+ }
59
+ const installed = join(directory, 'node_modules', name);
60
+ if (existsSync(join(installed, 'package.json'))) {
61
+ return realpathSync(installed);
72
62
  }
63
+ const parent = dirname(directory);
64
+ if (parent === directory)
65
+ throw new Error(`Cannot locate package root for ${name} from ${from}`);
66
+ directory = parent;
73
67
  }
68
+ };
69
+ for (const item of options.inline ?? ['@cortexkit/common-auth']) {
70
+ roots.set(typeof item === 'string' ? item : item.name, typeof item === 'string'
71
+ ? await packageRoot(item, entry)
72
+ : resolve(item.root));
74
73
  }
75
74
  const resolveExport = async (specifier, root, name) => {
76
75
  const manifest = JSON.parse(await readFile(join(root, 'package.json'), 'utf8'));
@@ -123,14 +122,14 @@ export async function buildTui(entryFile, variant, destinationDir, options = {})
123
122
  // relative paths, and distinct prefixes for the two kinds. The guard in
124
123
  // `visit` turns the remaining risk, two keys sharing a truncated hash, into
125
124
  // an error instead of one copy silently overwriting another.
126
- const namingRoots = [...roots]
125
+ const namingRoots = () => [...roots]
127
126
  .map(([name, root]) => ({
128
127
  name,
129
128
  root: existsSync(root) ? realpathSync(root) : root,
130
129
  }))
131
130
  .sort((a, b) => b.root.length - a.root.length);
132
131
  const sharedKey = (source) => {
133
- for (const { name, root } of namingRoots) {
132
+ for (const { name, root } of namingRoots()) {
134
133
  const path = relative(root, source);
135
134
  if (path && !path.startsWith(`..${sep}`) && !isAbsolute(path))
136
135
  return `package:${name}/${portable(path)}`;
@@ -174,6 +173,10 @@ export async function buildTui(entryFile, variant, destinationDir, options = {})
174
173
  const replacements = [];
175
174
  for (const reference of references) {
176
175
  let specifier = reference.specifier;
176
+ // The frame ships TSX: leaving it external skips the host's Solid transform.
177
+ // Resolve only when reached so non-sidebar builds need no optional UI peer.
178
+ if (specifier === '@cortexkit/opencode-sidebar' && !roots.has(specifier))
179
+ roots.set(specifier, await packageRoot(specifier, source));
177
180
  const inline = [...roots].find(([name]) => specifier === name || specifier.startsWith(`${name}/`));
178
181
  if (inline)
179
182
  specifier = relativeImport(name, await visit(await resolveExport(specifier, inline[1], inline[0]), true));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cortexkit/common-auth",
3
- "version": "0.41.1",
3
+ "version": "0.43.0",
4
4
  "description": "Shared code for the CortexKit auth plugins: account pool, quota and routing, commands and auth menu, OpenCode 2 hooks, Claustrum custody, and plumbing (loopback RPC, file locks, logger, sidebar state, TUI preferences and build).",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -111,7 +111,7 @@
111
111
  },
112
112
  "files": [
113
113
  "dist/",
114
- "src/quota-sidebar/",
114
+ "src/quota-sidebar/index.tsx",
115
115
  "src/quota/format.ts",
116
116
  "src/quota/map.ts",
117
117
  "src/quota/projection.ts"
@@ -137,6 +137,7 @@
137
137
  },
138
138
  "peerDependencies": {
139
139
  "@cortexkit/claustrum-client": ">=0.6.2",
140
+ "@cortexkit/opencode-sidebar": "~0.1.0",
140
141
  "@cortexkit/subc-client": "^0.16.0 || ^0.22.0 || ^0.24.0",
141
142
  "@opencode/plugin": ">=2.0.21",
142
143
  "@opentui/core": ">=0.4.5",
@@ -144,6 +145,9 @@
144
145
  "solid-js": ">=1.9.12 <2"
145
146
  },
146
147
  "peerDependenciesMeta": {
148
+ "@cortexkit/opencode-sidebar": {
149
+ "optional": true
150
+ },
147
151
  "@opentui/core": {
148
152
  "optional": true
149
153
  },
@@ -166,6 +170,7 @@
166
170
  "devDependencies": {
167
171
  "@biomejs/biome": "2.5.14",
168
172
  "@cortexkit/claustrum-client": "^0.16.0",
173
+ "@cortexkit/opencode-sidebar": "0.1.0",
169
174
  "@cortexkit/subc-client": "0.24.0",
170
175
  "@earendil-works/pi-coding-agent": "1.0.4",
171
176
  "@opencode/plugin": "2.0.21",