@cortexkit/common-auth 0.1.0 → 0.1.2
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
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# common-auth
|
|
2
2
|
|
|
3
|
-
Shared libraries for the CortexKit auth plugins for OpenCode and Pi: openai-auth, anthropic-auth and antigravity-auth.
|
|
3
|
+
Shared libraries for the CortexKit auth plugins for OpenCode and Pi: openai-auth, anthropic-auth and antigravity-auth. Published on npm as `@cortexkit/common-auth`; each plugin bundles it at build time, so users never install it directly.
|
|
4
4
|
|
|
5
5
|
`research/` holds the spike reports that inform the design:
|
|
6
6
|
|
package/dist/fs/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export type { AtomicWriteOptions } from './atomic-write.js';
|
|
2
2
|
export { writeJsonAtomic } from './atomic-write.js';
|
|
3
3
|
export { WRITER_LOCK_CONSTANTS } from './lock-constants.js';
|
|
4
|
+
export { acquireRefreshFileLock, isLostMarkerRaceError, } from './refresh-file-lock.js';
|
|
4
5
|
export type { LockOptions } from './with-lock.js';
|
|
5
6
|
export { LockContentionError, LockOwnershipError, lockPathFor, withLock, } from './with-lock.js';
|
package/dist/fs/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { writeJsonAtomic } from './atomic-write.js';
|
|
2
2
|
export { WRITER_LOCK_CONSTANTS } from './lock-constants.js';
|
|
3
|
+
// The try-once lock underneath withLock, for callers that hold a lock across
|
|
4
|
+
// several steps or poll instead of waiting (for example a refresh lease).
|
|
5
|
+
export { acquireRefreshFileLock, isLostMarkerRaceError, } from './refresh-file-lock.js';
|
|
3
6
|
export { LockContentionError, LockOwnershipError, lockPathFor, withLock, } from './with-lock.js';
|
|
@@ -9,6 +9,12 @@ export interface SidebarFileOptions<T> {
|
|
|
9
9
|
defaultValue: T;
|
|
10
10
|
normalize: (parsed: unknown) => T;
|
|
11
11
|
timeoutMs?: number;
|
|
12
|
+
/**
|
|
13
|
+
* Create the parent directory private and tighten it to 0o700 before each
|
|
14
|
+
* write. Defaults to true. Pass false for a directory the user chose (an
|
|
15
|
+
* override path), whose permissions are theirs to set.
|
|
16
|
+
*/
|
|
17
|
+
secureDir?: boolean;
|
|
12
18
|
logger?: {
|
|
13
19
|
warn: (message: string, payload?: unknown) => void;
|
|
14
20
|
debug: (message: string, payload?: unknown) => void;
|
|
@@ -41,12 +41,16 @@ export function createSidebarFile(options) {
|
|
|
41
41
|
};
|
|
42
42
|
const persist = async (merge, hooks) => {
|
|
43
43
|
const parent = dirname(path);
|
|
44
|
-
|
|
45
|
-
await
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
});
|
|
44
|
+
const secureDir = options.secureDir ?? true;
|
|
45
|
+
await mkdir(parent, {
|
|
46
|
+
recursive: true,
|
|
47
|
+
mode: secureDir ? 0o700 : undefined,
|
|
49
48
|
});
|
|
49
|
+
if (secureDir) {
|
|
50
|
+
await chmod(parent, 0o700).catch((error) => {
|
|
51
|
+
options.logger?.warn('sidebar directory permission remediation failed', { error: error instanceof Error ? error.message : String(error) });
|
|
52
|
+
});
|
|
53
|
+
}
|
|
50
54
|
await withLock(path, {
|
|
51
55
|
...WRITER_LOCK_CONSTANTS.sidebar,
|
|
52
56
|
timeoutMs: options.timeoutMs ?? WRITER_LOCK_CONSTANTS.sidebar.timeoutMs,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cortexkit/common-auth",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Shared plumbing for the CortexKit auth plugins: loopback RPC, file locks and atomic writes, logger, sidebar state file, TUI preferences and TUI build.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|