@cortexkit/opencode-antigravity-auth 3.0.32 → 3.0.34
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/cli.js +117 -36
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +8 -8
- package/dist/index.js +117 -36
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +9 -9
- package/dist/server.js +125 -39
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.d.ts +6 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +47 -3
- package/dist/src/common-auth-embedded/routing-accessor/index.js +2 -1
- package/dist/src/common-auth-embedded/source-output.json +15 -15
- package/dist/src/ga/server/index.d.ts +1 -1
- package/dist/src/ga/server/index.d.ts.map +1 -1
- package/dist/src/ga/server/index.js +10 -3
- package/dist/src/ga/server/index.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/tui-build-map.json +1 -1
- package/dist/tui-ga-build-map.json +1 -1
- package/dist/types/src/common-auth-embedded/fs/refresh-file-lock.d.ts +6 -0
- package/dist/types/src/ga/server/index.d.ts +1 -1
- package/dist/types/src/ga/server/index.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/common-auth-embedded/fs/refresh-file-lock.d.ts +6 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +47 -3
- package/src/common-auth-embedded/routing-accessor/index.js +2 -1
- package/src/common-auth-embedded/source-output.json +15 -15
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
type LeaseCreationTestHooks = {
|
|
2
|
+
beforeWrite?: (path: string) => void | Promise<void>;
|
|
3
|
+
beforeLink?: (tempPath: string, lockPath: string) => void | Promise<void>;
|
|
4
|
+
};
|
|
5
|
+
/** Test-only creation faults; not re-exported from the public fs entry point. */
|
|
6
|
+
export declare function setLeaseCreationTestHooksForTest(hooks?: LeaseCreationTestHooks): void;
|
|
1
7
|
export declare function isLostMarkerRaceError(error: unknown): boolean;
|
|
2
8
|
/** Test-only fault injection between marker mkdir and owner.json write. */
|
|
3
9
|
export interface EvictionMarkerTestHooks {
|
|
@@ -1,8 +1,50 @@
|
|
|
1
1
|
import { randomUUID } from 'node:crypto';
|
|
2
|
-
import { lstat, mkdir, open, readFile, rename, rm, stat, } from 'node:fs/promises';
|
|
2
|
+
import { link, lstat, mkdir, open, readFile, rename, rm, stat, } from 'node:fs/promises';
|
|
3
3
|
import { dirname, join } from 'node:path';
|
|
4
4
|
import { createPrivateBytes, createPrivateDirectoryExclusive, ensurePrivateDirectory, isWindowsSharingViolation, PrivateFileError, privateOperation, readPrivateText, verifyPrivate, windowsPrivateFiles, writePrivateAtomic, } from './private-files.js';
|
|
5
5
|
import { LockOwnershipError, lockPathFor } from './with-lock.js';
|
|
6
|
+
let leaseCreationTestHooks;
|
|
7
|
+
/** Test-only creation faults; not re-exported from the public fs entry point. */
|
|
8
|
+
export function setLeaseCreationTestHooksForTest(hooks) {
|
|
9
|
+
leaseCreationTestHooks = hooks;
|
|
10
|
+
}
|
|
11
|
+
async function createExclusiveText(path, text) {
|
|
12
|
+
// Publish only a complete owner record. A crash before link leaves at most
|
|
13
|
+
// an orphaned staging file, never an ownerless lease at the lock path.
|
|
14
|
+
const tempPath = `${path}.${randomUUID()}.tmp`;
|
|
15
|
+
let handle;
|
|
16
|
+
try {
|
|
17
|
+
handle = await open(tempPath, 'wx', 0o600);
|
|
18
|
+
try {
|
|
19
|
+
if (leaseCreationTestHooks?.beforeWrite)
|
|
20
|
+
await leaseCreationTestHooks.beforeWrite(tempPath);
|
|
21
|
+
await handle.writeFile(text, 'utf8');
|
|
22
|
+
}
|
|
23
|
+
finally {
|
|
24
|
+
await handle.close();
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
if (leaseCreationTestHooks?.beforeLink)
|
|
28
|
+
await leaseCreationTestHooks.beforeLink(tempPath, path);
|
|
29
|
+
await link(tempPath, path);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
const code = error.code;
|
|
33
|
+
if (code !== 'EPERM' &&
|
|
34
|
+
code !== 'ENOTSUP' &&
|
|
35
|
+
code !== 'EOPNOTSUPP' &&
|
|
36
|
+
code !== 'EXDEV')
|
|
37
|
+
throw error;
|
|
38
|
+
// Filesystems without hard links still use exclusive create then write.
|
|
39
|
+
// A crash can leave an incomplete lease there, but locking stays available.
|
|
40
|
+
await writeExclusiveText(path, text);
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
finally {
|
|
44
|
+
if (handle)
|
|
45
|
+
await rm(tempPath, { force: true }).catch(() => { });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
6
48
|
/**
|
|
7
49
|
* Create a new owner-only file and write `text` into it, failing with EEXIST if
|
|
8
50
|
* the file already exists. Writing through the handle rather than path-based
|
|
@@ -11,7 +53,7 @@ import { LockOwnershipError, lockPathFor } from './with-lock.js';
|
|
|
11
53
|
* that redundant ftruncate stalls for hundreds of milliseconds, inside every
|
|
12
54
|
* lock acquisition.
|
|
13
55
|
*/
|
|
14
|
-
async function
|
|
56
|
+
async function writeExclusiveText(path, text) {
|
|
15
57
|
const handle = await open(path, 'wx', 0o600);
|
|
16
58
|
let createdStat;
|
|
17
59
|
try {
|
|
@@ -21,6 +63,8 @@ async function createExclusiveText(path, text) {
|
|
|
21
63
|
createdStat = undefined;
|
|
22
64
|
}
|
|
23
65
|
try {
|
|
66
|
+
if (leaseCreationTestHooks?.beforeWrite)
|
|
67
|
+
await leaseCreationTestHooks.beforeWrite(path);
|
|
24
68
|
await handle.writeFile(text, 'utf8');
|
|
25
69
|
}
|
|
26
70
|
catch (error) {
|
|
@@ -491,7 +535,7 @@ export async function acquireRefreshFileLockWithClock(options) {
|
|
|
491
535
|
if (windowsPrivateFiles)
|
|
492
536
|
await createPrivateBytes(evictOwnerPath, bytes);
|
|
493
537
|
else
|
|
494
|
-
await
|
|
538
|
+
await writeExclusiveText(evictOwnerPath, bytes);
|
|
495
539
|
}
|
|
496
540
|
catch (error) {
|
|
497
541
|
// A competing contender can rename our just-created marker directory
|
|
@@ -38,7 +38,8 @@ export function turnNotes(sessionId) {
|
|
|
38
38
|
if (typeof afterToolUseId !== 'string' ||
|
|
39
39
|
afterToolUseId.length === 0 ||
|
|
40
40
|
typeof text !== 'string' ||
|
|
41
|
-
|
|
41
|
+
// A whitespace-only note says nothing and a provider may refuse it.
|
|
42
|
+
text.trim().length === 0 ||
|
|
42
43
|
encoder.encode(text).byteLength > 16_384)
|
|
43
44
|
continue;
|
|
44
45
|
notes.push({ afterToolUseId, text });
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"schema": 1,
|
|
3
3
|
"package": "@cortexkit/common-auth",
|
|
4
|
-
"version": "0.39.
|
|
4
|
+
"version": "0.39.1",
|
|
5
5
|
"artifactStatus": "published",
|
|
6
6
|
"publicRoots": {
|
|
7
7
|
"./rpc": {
|
|
@@ -69,15 +69,15 @@
|
|
|
69
69
|
"import": "./src/quota-sidebar/index.tsx"
|
|
70
70
|
}
|
|
71
71
|
},
|
|
72
|
-
"input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.39.
|
|
73
|
-
"tarballSha256": "
|
|
74
|
-
"sri": "sha512-
|
|
72
|
+
"input": "tools/common-auth-build/inputs/cortexkit-common-auth-0.39.1.tgz",
|
|
73
|
+
"tarballSha256": "7d4eae5c55f007b6ca1838d0e85552685cc0dac0080594d108da63f69d1c9577",
|
|
74
|
+
"sri": "sha512-Oap+vs4zKFLdFA8iUgvS3X1iOI/xZaXQyhYoDSlUBsjsCutcZZ0M0bXY9C0a16fBFgmmcReXb3Pn3+P9Bebjng==",
|
|
75
75
|
"canonicalFiles": 216,
|
|
76
|
-
"canonicalBytes":
|
|
76
|
+
"canonicalBytes": 1355096,
|
|
77
77
|
"generator": {
|
|
78
78
|
"path": "packages/opencode/scripts/embed-common-auth.ts",
|
|
79
79
|
"version": 4,
|
|
80
|
-
"sha256": "
|
|
80
|
+
"sha256": "c6a4180f5d873855ea5abaeeeaea39e2beba2309da75dfb20c4cc3d485eda38f"
|
|
81
81
|
},
|
|
82
82
|
"files": [
|
|
83
83
|
{
|
|
@@ -643,17 +643,17 @@
|
|
|
643
643
|
{
|
|
644
644
|
"source": "package/dist/fs/refresh-file-lock.d.ts",
|
|
645
645
|
"output": "fs/refresh-file-lock.d.ts",
|
|
646
|
-
"bytes":
|
|
647
|
-
"sourceSha256": "
|
|
648
|
-
"outputSha256": "
|
|
646
|
+
"bytes": 3402,
|
|
647
|
+
"sourceSha256": "fefff72fcbbcedd80d96cea0f15d7a367220af76ea8c4dfea3f81f83b9931ab1",
|
|
648
|
+
"outputSha256": "fefff72fcbbcedd80d96cea0f15d7a367220af76ea8c4dfea3f81f83b9931ab1",
|
|
649
649
|
"transform": "verbatim"
|
|
650
650
|
},
|
|
651
651
|
{
|
|
652
652
|
"source": "package/dist/fs/refresh-file-lock.js",
|
|
653
653
|
"output": "fs/refresh-file-lock.js",
|
|
654
|
-
"bytes":
|
|
655
|
-
"sourceSha256": "
|
|
656
|
-
"outputSha256": "
|
|
654
|
+
"bytes": 43780,
|
|
655
|
+
"sourceSha256": "fa0200d4f4a759a8d4380aa2535cf07d98898650cc919031b0742d241662d96f",
|
|
656
|
+
"outputSha256": "fa0200d4f4a759a8d4380aa2535cf07d98898650cc919031b0742d241662d96f",
|
|
657
657
|
"transform": "verbatim"
|
|
658
658
|
},
|
|
659
659
|
{
|
|
@@ -1803,9 +1803,9 @@
|
|
|
1803
1803
|
{
|
|
1804
1804
|
"source": "package/dist/routing-accessor/index.js",
|
|
1805
1805
|
"output": "routing-accessor/index.js",
|
|
1806
|
-
"bytes":
|
|
1807
|
-
"sourceSha256": "
|
|
1808
|
-
"outputSha256": "
|
|
1806
|
+
"bytes": 8290,
|
|
1807
|
+
"sourceSha256": "ea80ae669e1f65555e88e5c56383d6e1a5ee813de532ffade61011bb4eeea16d",
|
|
1808
|
+
"outputSha256": "ea80ae669e1f65555e88e5c56383d6e1a5ee813de532ffade61011bb4eeea16d",
|
|
1809
1809
|
"transform": "verbatim"
|
|
1810
1810
|
}
|
|
1811
1811
|
],
|