@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.
- package/dist/cachekeep/index.d.ts +1 -1
- package/dist/cachekeep/manager.d.ts +50 -4
- package/dist/cachekeep/manager.js +241 -33
- package/dist/claustrum/availability.d.ts +7 -1
- package/dist/claustrum/availability.js +9 -1
- package/dist/claustrum/custody.d.ts +11 -2
- package/dist/claustrum/custody.js +89 -31
- package/dist/claustrum/enrollment.d.ts +4 -0
- package/dist/claustrum/enrollment.js +33 -2
- package/dist/claustrum/host.js +11 -7
- package/dist/claustrum/index.d.ts +1 -1
- package/dist/claustrum/index.js +1 -1
- package/dist/fs/lock-record.d.ts +19 -0
- package/dist/fs/lock-record.js +55 -0
- package/dist/fs/refresh-file-lock.js +148 -92
- package/dist/fs/with-lock.js +19 -13
- package/dist/quota-sidebar/index.d.ts +2 -36
- package/dist/quota-sidebar/index.jsx +28 -344
- package/dist/routing-accessor/cache-policy.d.ts +3 -0
- package/dist/routing-accessor/cache-policy.js +11 -0
- package/dist/routing-accessor/index.d.ts +48 -5
- package/dist/routing-accessor/index.js +136 -5
- package/dist/setup/enroll.js +2 -1
- package/dist/setup/types.d.ts +1 -0
- package/dist/tui-build/build-tui.js +26 -23
- package/package.json +7 -2
- package/src/quota-sidebar/index.tsx +49 -607
package/dist/setup/types.d.ts
CHANGED
|
@@ -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
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
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.
|
|
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",
|