@cortexkit/opencode-antigravity-auth 3.0.38 → 3.0.40
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 +1 -1
- package/dist/cli.js +865 -357
- package/dist/cli.js.map +4 -4
- package/dist/cli.meta.json +136 -39
- package/dist/index.js +1509 -657
- package/dist/index.js.map +4 -4
- package/dist/index.meta.json +188 -49
- package/dist/server.js +1662 -803
- package/dist/server.js.map +4 -4
- package/dist/server.meta.json +1 -1
- package/dist/src/common-auth-embedded/claustrum/availability.d.ts +7 -1
- package/dist/src/common-auth-embedded/claustrum/availability.js +9 -1
- package/dist/src/common-auth-embedded/claustrum/custody.d.ts +11 -2
- package/dist/src/common-auth-embedded/claustrum/custody.js +89 -31
- package/dist/src/common-auth-embedded/claustrum/enrollment.d.ts +29 -4
- package/dist/src/common-auth-embedded/claustrum/enrollment.js +110 -2
- package/dist/src/common-auth-embedded/claustrum/host.js +11 -7
- package/dist/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/claustrum/index.js +1 -1
- package/dist/src/common-auth-embedded/fs/lock-record.js +55 -0
- package/dist/src/common-auth-embedded/fs/refresh-file-lock.js +148 -92
- package/dist/src/common-auth-embedded/fs/with-lock.js +19 -13
- package/dist/src/common-auth-embedded/quota-sidebar/index.d.ts +2 -36
- package/dist/src/common-auth-embedded/quota-sidebar/index.tsx +49 -607
- package/dist/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +3 -0
- package/dist/src/common-auth-embedded/routing-accessor/cache-policy.js +11 -0
- package/dist/src/common-auth-embedded/routing-accessor/index.d.ts +48 -5
- package/dist/src/common-auth-embedded/routing-accessor/index.js +136 -5
- package/dist/src/common-auth-embedded/setup/command-error.d.ts +1 -1
- package/dist/src/common-auth-embedded/setup/command-error.js +3 -2
- package/dist/src/common-auth-embedded/setup/command.js +18 -5
- package/dist/src/common-auth-embedded/setup/enroll.d.ts +2 -2
- package/dist/src/common-auth-embedded/setup/enroll.js +14 -3
- package/dist/src/common-auth-embedded/setup/enrollment-access.js +77 -0
- package/dist/src/common-auth-embedded/setup/index.d.ts +1 -1
- package/dist/src/common-auth-embedded/setup/types.d.ts +13 -1
- package/dist/src/common-auth-embedded/source-output.json +95 -79
- package/dist/src/ga/tui/host-ga.d.ts +20 -3
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +102 -25
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.d.ts.map +1 -1
- package/dist/src/plugin/__fixtures__/release-model-ids.js +1 -0
- package/dist/src/plugin/__fixtures__/release-model-ids.js.map +1 -1
- package/dist/src/plugin/__fixtures__/verified-store.js +2 -2
- package/dist/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +6 -0
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/logger.d.ts +3 -1
- package/dist/src/plugin/logger.d.ts.map +1 -1
- package/dist/src/plugin/logger.js +15 -7
- package/dist/src/plugin/logger.js.map +1 -1
- package/dist/src/plugin/request.d.ts.map +1 -1
- package/dist/src/plugin/request.js +3 -1
- package/dist/src/plugin/request.js.map +1 -1
- package/dist/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/src/plugin/shared/request-services.js +34 -9
- package/dist/src/plugin/shared/request-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-billing.d.ts +30 -0
- package/dist/src/plugin/shared/vault-billing.d.ts.map +1 -0
- package/dist/src/plugin/shared/vault-billing.js +196 -0
- package/dist/src/plugin/shared/vault-billing.js.map +1 -0
- package/dist/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/src/plugin/vault-custody.js +3 -0
- package/dist/src/plugin/vault-custody.js.map +1 -1
- package/dist/src/setup.d.ts.map +1 -1
- package/dist/src/setup.js +14 -0
- package/dist/src/setup.js.map +1 -1
- package/dist/tui-build-map.json +19 -5
- package/dist/tui-ga-build-map.json +23 -9
- package/dist/types/src/common-auth-embedded/claustrum/availability.d.ts +7 -1
- package/dist/types/src/common-auth-embedded/claustrum/custody.d.ts +11 -2
- package/dist/types/src/common-auth-embedded/claustrum/enrollment.d.ts +29 -4
- package/dist/types/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +3 -0
- package/dist/types/src/common-auth-embedded/routing-accessor/index.d.ts +48 -5
- package/dist/types/src/common-auth-embedded/setup/command-error.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/setup/enroll.d.ts +2 -2
- package/dist/types/src/common-auth-embedded/setup/index.d.ts +1 -1
- package/dist/types/src/common-auth-embedded/setup/types.d.ts +13 -1
- package/dist/types/src/plugin/ga-location-services.d.ts +1 -0
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/logger.d.ts +3 -1
- package/dist/types/src/plugin/logger.d.ts.map +1 -1
- package/dist/types/src/plugin/request.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/request-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-billing.d.ts +30 -0
- package/dist/types/src/plugin/shared/vault-billing.d.ts.map +1 -0
- package/dist/types/src/plugin/vault-custody.d.ts.map +1 -1
- package/dist/types/src/setup.d.ts.map +1 -1
- package/package.json +4 -3
- package/src/common-auth-embedded/claustrum/availability.d.ts +7 -1
- package/src/common-auth-embedded/claustrum/availability.js +9 -1
- package/src/common-auth-embedded/claustrum/custody.d.ts +11 -2
- package/src/common-auth-embedded/claustrum/custody.js +89 -31
- package/src/common-auth-embedded/claustrum/enrollment.d.ts +29 -4
- package/src/common-auth-embedded/claustrum/enrollment.js +110 -2
- package/src/common-auth-embedded/claustrum/host.js +11 -7
- package/src/common-auth-embedded/claustrum/index.d.ts +1 -1
- package/src/common-auth-embedded/claustrum/index.js +1 -1
- package/src/common-auth-embedded/fs/lock-record.js +55 -0
- package/src/common-auth-embedded/fs/refresh-file-lock.js +148 -92
- package/src/common-auth-embedded/fs/with-lock.js +19 -13
- package/src/common-auth-embedded/quota-sidebar/index.d.ts +2 -36
- package/src/common-auth-embedded/quota-sidebar/index.tsx +49 -607
- package/src/common-auth-embedded/routing-accessor/cache-policy.d.ts +3 -0
- package/src/common-auth-embedded/routing-accessor/cache-policy.js +11 -0
- package/src/common-auth-embedded/routing-accessor/index.d.ts +48 -5
- package/src/common-auth-embedded/routing-accessor/index.js +136 -5
- package/src/common-auth-embedded/setup/command-error.d.ts +1 -1
- package/src/common-auth-embedded/setup/command-error.js +3 -2
- package/src/common-auth-embedded/setup/command.js +18 -5
- package/src/common-auth-embedded/setup/enroll.d.ts +2 -2
- package/src/common-auth-embedded/setup/enroll.js +14 -3
- package/src/common-auth-embedded/setup/enrollment-access.js +77 -0
- package/src/common-auth-embedded/setup/index.d.ts +1 -1
- package/src/common-auth-embedded/setup/types.d.ts +13 -1
- package/src/common-auth-embedded/source-output.json +95 -79
- package/src/tui-compiled/common-auth-embedded/quota-sidebar/index.js +36 -674
- package/src/tui-compiled/shared/a75d0d866c227b3f-index.js +678 -0
- package/src/tui-ga-compiled/host-ga.js +86 -26
- package/src/tui-ga-compiled/shared/a75d0d866c227b3f-index.js +678 -0
- package/src/tui-ga-compiled/shared/e4ec36f367492969-index.js +36 -674
- package/src/tui-ga-raw/host-ga.tsx +122 -25
- package/src/tui-ga-raw/shared/a75d0d866c227b3f-index.tsx +681 -0
- package/src/tui-ga-raw/shared/e4ec36f367492969-index.tsx +49 -607
- package/src/tui-raw/common-auth-embedded/quota-sidebar/index.tsx +49 -607
- package/src/tui-raw/shared/a75d0d866c227b3f-index.tsx +681 -0
|
@@ -80,11 +80,12 @@ export const GA_TUI_ID = 'cortexkit.antigravity-auth' as const
|
|
|
80
80
|
export const GA_RPC_ID = 'antigravity-auth' as const
|
|
81
81
|
export const GA_RPC_VERSION = 1 as const
|
|
82
82
|
|
|
83
|
-
/** How often the TUI pulls state and notifications
|
|
83
|
+
/** How often the TUI pulls state and notifications for the visible route. */
|
|
84
84
|
export const GA_SIDEBAR_PULL_MS = 1_000
|
|
85
85
|
|
|
86
86
|
/** Pulls in one tick while the server reports more notifications waiting. */
|
|
87
87
|
const MAX_PULLS_PER_TICK = 4
|
|
88
|
+
const MAX_SESSION_LOCATIONS = 32
|
|
88
89
|
|
|
89
90
|
// ── Host surface (structural subset of the GA TUI context) ─────────────────
|
|
90
91
|
|
|
@@ -134,6 +135,11 @@ export interface GaTuiContext {
|
|
|
134
135
|
readonly storage?: GaStorage
|
|
135
136
|
readonly location: GaLocationRef | undefined
|
|
136
137
|
readonly client: {
|
|
138
|
+
readonly session: {
|
|
139
|
+
get(input: { readonly sessionID: string }): Promise<{
|
|
140
|
+
readonly location: GaLocationRef
|
|
141
|
+
}>
|
|
142
|
+
}
|
|
137
143
|
readonly rpc: {
|
|
138
144
|
call(input: GaRpcCallInput): Promise<unknown>
|
|
139
145
|
}
|
|
@@ -914,6 +920,37 @@ export function createGaLocationClient(options: {
|
|
|
914
920
|
}
|
|
915
921
|
}
|
|
916
922
|
|
|
923
|
+
/** Keep the home client, but retain at most one other visible location. */
|
|
924
|
+
export function createGaLocationClients(options: {
|
|
925
|
+
readonly call: (input: GaRpcCallInput) => Promise<unknown>
|
|
926
|
+
readonly location: GaLocationRef | undefined
|
|
927
|
+
readonly logger?: GaLogger
|
|
928
|
+
}) {
|
|
929
|
+
const home = createGaLocationClient(options)
|
|
930
|
+
let shown = home
|
|
931
|
+
let shownKey = ''
|
|
932
|
+
const key = (location: GaLocationRef | undefined) =>
|
|
933
|
+
JSON.stringify([location?.directory, location?.workspaceID])
|
|
934
|
+
return {
|
|
935
|
+
current: () => shown,
|
|
936
|
+
select(location: GaLocationRef | undefined): GaLocationClient {
|
|
937
|
+
const nextKey = key(location)
|
|
938
|
+
if (shown !== home && nextKey === shownKey) return shown
|
|
939
|
+
if (shown !== home) shown.dispose()
|
|
940
|
+
shown =
|
|
941
|
+
nextKey === key(options.location)
|
|
942
|
+
? home
|
|
943
|
+
: createGaLocationClient({ ...options, location })
|
|
944
|
+
shownKey = nextKey
|
|
945
|
+
return shown
|
|
946
|
+
},
|
|
947
|
+
dispose() {
|
|
948
|
+
shown.dispose()
|
|
949
|
+
home.dispose()
|
|
950
|
+
},
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
917
954
|
// ── Menu over the native state ──────────────────────────────────────────────
|
|
918
955
|
|
|
919
956
|
const ACCOUNT_ITEM_PREFIX = 'account:'
|
|
@@ -1597,13 +1634,18 @@ export function setupGaTui(
|
|
|
1597
1634
|
): () => Promise<void> {
|
|
1598
1635
|
const logger = options.logger
|
|
1599
1636
|
const now = options.now ?? Date.now
|
|
1600
|
-
const
|
|
1637
|
+
const clients = createGaLocationClients({
|
|
1601
1638
|
call: (input) => context.client.rpc.call(input),
|
|
1602
1639
|
location: context.location,
|
|
1603
1640
|
...(logger ? { logger } : {}),
|
|
1604
1641
|
})
|
|
1605
|
-
|
|
1606
|
-
const
|
|
1642
|
+
let cleaned = false
|
|
1643
|
+
const active = () => !cleaned
|
|
1644
|
+
const isCurrent = (client: GaLocationClient, scope: GaScope) =>
|
|
1645
|
+
active() &&
|
|
1646
|
+
!client.disposed() &&
|
|
1647
|
+
clients.current() === client &&
|
|
1648
|
+
scopeKey(currentScope(context.ui.router.current())) === scopeKey(scope)
|
|
1607
1649
|
const [view, setView] = createSignal<SidebarView | undefined>(undefined)
|
|
1608
1650
|
const collapse = createGaCollapse(context.storage, logger)
|
|
1609
1651
|
|
|
@@ -1640,19 +1682,26 @@ export function setupGaTui(
|
|
|
1640
1682
|
* Pulls fresh state for `scope`. Any
|
|
1641
1683
|
* notifications the pull carries are handled like a poll tick's.
|
|
1642
1684
|
*/
|
|
1643
|
-
const refresh = async (
|
|
1685
|
+
const refresh = async (
|
|
1686
|
+
client: GaLocationClient,
|
|
1687
|
+
scope: GaScope,
|
|
1688
|
+
): Promise<void> => {
|
|
1644
1689
|
await pollGaOnce({
|
|
1645
1690
|
client,
|
|
1646
1691
|
scope: () => scope,
|
|
1647
1692
|
onSnapshot: (snapshot) => {
|
|
1648
|
-
showSnapshot(snapshot)
|
|
1693
|
+
if (isCurrent(client, scope)) showSnapshot(snapshot)
|
|
1694
|
+
},
|
|
1695
|
+
onNotification: (notification) => {
|
|
1696
|
+
if (isCurrent(client, scope))
|
|
1697
|
+
onNotification(client, notification, scope)
|
|
1649
1698
|
},
|
|
1650
|
-
onNotification,
|
|
1651
1699
|
...(logger ? { logger } : {}),
|
|
1652
1700
|
})
|
|
1653
1701
|
}
|
|
1654
1702
|
|
|
1655
1703
|
const applyRequest = async (
|
|
1704
|
+
client: GaLocationClient,
|
|
1656
1705
|
scope: GaScope,
|
|
1657
1706
|
request: MenuApplyRequest,
|
|
1658
1707
|
shown: GaMenuPresentation,
|
|
@@ -1664,6 +1713,8 @@ export function setupGaTui(
|
|
|
1664
1713
|
code,
|
|
1665
1714
|
menu: shown.source,
|
|
1666
1715
|
})
|
|
1716
|
+
if (!isCurrent(client, scope))
|
|
1717
|
+
return refused('That session is no longer shown.', 'stale-session')
|
|
1667
1718
|
let body: GaApplyBody
|
|
1668
1719
|
try {
|
|
1669
1720
|
body = { request: shown.request(request) }
|
|
@@ -1680,12 +1731,14 @@ export function setupGaTui(
|
|
|
1680
1731
|
return refused(error.message, error.reason)
|
|
1681
1732
|
throw error
|
|
1682
1733
|
}
|
|
1683
|
-
await refresh(scope)
|
|
1734
|
+
if (isCurrent(client, scope)) await refresh(client, scope)
|
|
1684
1735
|
return result
|
|
1685
1736
|
}
|
|
1686
1737
|
|
|
1687
1738
|
let pendingLogin: { scope: string; finish(ok: boolean): void } | undefined
|
|
1688
1739
|
const applyChoice = async (
|
|
1740
|
+
client: GaLocationClient,
|
|
1741
|
+
ui: MenuUi,
|
|
1689
1742
|
scope: GaScope,
|
|
1690
1743
|
request: MenuApplyRequest,
|
|
1691
1744
|
shown: GaMenuPresentation,
|
|
@@ -1695,7 +1748,7 @@ export function setupGaTui(
|
|
|
1695
1748
|
request.actionId !== 'add' ||
|
|
1696
1749
|
request.itemId !== undefined
|
|
1697
1750
|
)
|
|
1698
|
-
return applyRequest(scope, request, shown)
|
|
1751
|
+
return applyRequest(client, scope, request, shown)
|
|
1699
1752
|
const completed = Promise.withResolvers<boolean>()
|
|
1700
1753
|
const pending = { scope: scopeKey(scope), finish: completed.resolve }
|
|
1701
1754
|
pendingLogin = pending
|
|
@@ -1704,14 +1757,19 @@ export function setupGaTui(
|
|
|
1704
1757
|
ui,
|
|
1705
1758
|
request,
|
|
1706
1759
|
completed: completed.promise,
|
|
1707
|
-
apply: (next) => applyRequest(scope, next, shown),
|
|
1760
|
+
apply: (next) => applyRequest(client, scope, next, shown),
|
|
1708
1761
|
})
|
|
1709
1762
|
} finally {
|
|
1710
1763
|
if (pendingLogin === pending) pendingLogin = undefined
|
|
1711
1764
|
}
|
|
1712
1765
|
}
|
|
1713
1766
|
|
|
1714
|
-
function onNotification(
|
|
1767
|
+
function onNotification(
|
|
1768
|
+
client: GaLocationClient,
|
|
1769
|
+
notification: GaNotification,
|
|
1770
|
+
scope: GaScope,
|
|
1771
|
+
) {
|
|
1772
|
+
const ui = createGaMenuUi(context, () => isCurrent(client, scope))
|
|
1715
1773
|
const payload = notification.payload
|
|
1716
1774
|
if ('notify' in payload) {
|
|
1717
1775
|
if (
|
|
@@ -1734,7 +1792,7 @@ export function setupGaTui(
|
|
|
1734
1792
|
{
|
|
1735
1793
|
ui,
|
|
1736
1794
|
apply: async (request) => {
|
|
1737
|
-
const result = await applyChoice(scope, request, shown)
|
|
1795
|
+
const result = await applyChoice(client, ui, scope, request, shown)
|
|
1738
1796
|
shown = presentGaMenu(
|
|
1739
1797
|
latest.get(scopeKey(scope)) ?? snapshot,
|
|
1740
1798
|
now(),
|
|
@@ -1759,37 +1817,76 @@ export function setupGaTui(
|
|
|
1759
1817
|
}
|
|
1760
1818
|
|
|
1761
1819
|
let inFlight = false
|
|
1820
|
+
let shownScope = ''
|
|
1821
|
+
// Session locations are immutable; keep only the most recently viewed sessions.
|
|
1822
|
+
const sessionLocations = new Map<string, GaLocationRef>()
|
|
1823
|
+
const sessionLocation = async (sessionID: string): Promise<GaLocationRef> => {
|
|
1824
|
+
const location =
|
|
1825
|
+
sessionLocations.get(sessionID) ??
|
|
1826
|
+
(await context.client.session.get({ sessionID })).location
|
|
1827
|
+
if (active()) {
|
|
1828
|
+
sessionLocations.delete(sessionID)
|
|
1829
|
+
sessionLocations.set(sessionID, location)
|
|
1830
|
+
if (sessionLocations.size > MAX_SESSION_LOCATIONS) {
|
|
1831
|
+
const oldest = sessionLocations.keys().next().value
|
|
1832
|
+
if (oldest !== undefined) sessionLocations.delete(oldest)
|
|
1833
|
+
}
|
|
1834
|
+
}
|
|
1835
|
+
return location
|
|
1836
|
+
}
|
|
1762
1837
|
const tick = () => {
|
|
1763
1838
|
if (inFlight || !active()) return
|
|
1764
1839
|
inFlight = true
|
|
1765
|
-
void
|
|
1766
|
-
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1840
|
+
void (async () => {
|
|
1841
|
+
const scope = currentScope(context.ui.router.current())
|
|
1842
|
+
const nextScope = scopeKey(scope)
|
|
1843
|
+
if (shownScope !== nextScope) {
|
|
1844
|
+
latest.clear()
|
|
1845
|
+
setView(undefined)
|
|
1846
|
+
pendingLogin?.finish(false)
|
|
1847
|
+
shownScope = nextScope
|
|
1848
|
+
}
|
|
1849
|
+
// Session lookup is global; RPC queues remain local to its returned location.
|
|
1850
|
+
const location =
|
|
1851
|
+
scope.kind === 'session'
|
|
1852
|
+
? await sessionLocation(scope.sessionID)
|
|
1853
|
+
: context.location
|
|
1854
|
+
if (
|
|
1855
|
+
!active() ||
|
|
1856
|
+
nextScope !== scopeKey(currentScope(context.ui.router.current()))
|
|
1857
|
+
)
|
|
1858
|
+
return
|
|
1859
|
+
await refresh(clients.select(location), scope)
|
|
1860
|
+
})()
|
|
1861
|
+
.catch((error: unknown) => {
|
|
1862
|
+
if (!active()) return
|
|
1863
|
+
clients.select(context.location)
|
|
1864
|
+
logger?.warn('ga-session-location-failed', {
|
|
1865
|
+
error: error instanceof Error ? error.name : typeof error,
|
|
1866
|
+
})
|
|
1867
|
+
})
|
|
1868
|
+
.finally(() => {
|
|
1869
|
+
inFlight = false
|
|
1870
|
+
})
|
|
1774
1871
|
}
|
|
1775
1872
|
const stop = (options.schedule ?? defaultSchedule)(tick, GA_SIDEBAR_PULL_MS)
|
|
1776
1873
|
tick()
|
|
1777
1874
|
|
|
1778
|
-
let cleaned = false
|
|
1779
1875
|
return async () => {
|
|
1780
1876
|
if (cleaned) return
|
|
1781
1877
|
cleaned = true
|
|
1782
1878
|
pendingLogin?.finish(false)
|
|
1783
1879
|
stop()
|
|
1784
|
-
|
|
1880
|
+
clients.dispose()
|
|
1881
|
+
sessionLocations.clear()
|
|
1785
1882
|
releaseSlot()
|
|
1786
1883
|
}
|
|
1787
1884
|
}
|
|
1788
1885
|
|
|
1789
1886
|
/**
|
|
1790
1887
|
* The GA TUI plugin definition (`{ id, setup }`, the 2.0.22 TUI plugin
|
|
1791
|
-
* shape). Importing this module starts nothing; `setup`
|
|
1792
|
-
*
|
|
1888
|
+
* shape). Importing this module starts nothing; `setup` follows the current
|
|
1889
|
+
* session's location and returns the cleanup that stops everything it
|
|
1793
1890
|
* started. The host calls `setup(context)`; the package's `./tui` entry
|
|
1794
1891
|
* passes the plugin version as the second argument. This module's graph
|
|
1795
1892
|
* may use no Node built-in (the build refuses one), so it cannot read
|