@cortexkit/opencode-antigravity-auth 3.0.14 → 3.0.16
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 +257 -57
- package/dist/cli.js.map +3 -3
- package/dist/cli.meta.json +11 -11
- package/dist/index.js +468 -90
- package/dist/index.js.map +3 -3
- package/dist/index.meta.json +14 -14
- package/dist/server.js +499 -95
- package/dist/server.js.map +3 -3
- package/dist/server.meta.json +1 -1
- package/dist/src/ga/tui/host-ga.d.ts +55 -2
- package/dist/src/ga/tui/host-ga.d.ts.map +1 -1
- package/dist/src/ga/tui/host-ga.js +73 -43
- package/dist/src/ga/tui/host-ga.js.map +1 -1
- package/dist/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/src/plugin/ga-location-services.js +49 -5
- package/dist/src/plugin/ga-location-services.js.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.d.ts +33 -13
- package/dist/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/src/plugin/shared/vault-request-credentials.js +97 -44
- package/dist/src/plugin/shared/vault-request-credentials.js.map +1 -1
- package/dist/src/plugin/storage.d.ts +17 -0
- package/dist/src/plugin/storage.d.ts.map +1 -1
- package/dist/src/plugin/storage.js +44 -10
- package/dist/src/plugin/storage.js.map +1 -1
- package/dist/src/runtime-paths.d.ts +2 -1
- package/dist/src/runtime-paths.d.ts.map +1 -1
- package/dist/src/runtime-paths.js +5 -5
- package/dist/src/runtime-paths.js.map +1 -1
- package/dist/src/tui/quota-layout.d.ts +1 -1
- package/dist/src/tui/quota-layout.js +1 -1
- package/dist/src/tui/sidebar-frame.d.ts +109 -0
- package/dist/src/tui/sidebar-frame.d.ts.map +1 -0
- package/dist/src/tui/sidebar-frame.js +244 -0
- package/dist/src/tui/sidebar-frame.js.map +1 -0
- package/dist/src/tui.d.ts.map +1 -1
- package/dist/src/tui.js +11 -251
- package/dist/src/tui.js.map +1 -1
- package/dist/tui-build-map.json +120 -92
- package/dist/tui-ga-build-map.json +22 -8
- package/dist/types/src/plugin/ga-location-services.d.ts.map +1 -1
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts +33 -13
- package/dist/types/src/plugin/shared/vault-request-credentials.d.ts.map +1 -1
- package/dist/types/src/plugin/storage.d.ts +17 -0
- package/dist/types/src/plugin/storage.d.ts.map +1 -1
- package/dist/types/src/runtime-paths.d.ts +2 -1
- package/dist/types/src/runtime-paths.d.ts.map +1 -1
- package/package.json +2 -2
- package/src/tui/entry.mjs +19 -1
- package/src/tui-compiled/sidebar-projection.js +119 -0
- package/src/tui-compiled/tui/quota-layout.js +1 -1
- package/src/tui-compiled/tui/sidebar-frame.js +657 -0
- package/src/tui-compiled/tui.js +25 -606
- package/src/tui-ga-compiled/host-ga.js +116 -124
- package/src/tui-ga-compiled/shared/ced204104a639c9c-sidebar-frame.js +657 -0
- package/src/tui-ga-compiled/shared/dd4c9e1a907f8ef0-quota-layout.js +1 -1
- package/src/tui-ga-raw/host-ga.tsx +157 -95
- package/src/tui-ga-raw/shared/ced204104a639c9c-sidebar-frame.tsx +603 -0
- package/src/tui-ga-raw/shared/dd4c9e1a907f8ef0-quota-layout.tsx +1 -1
- package/src/tui-raw/sidebar-projection.js +119 -0
- package/src/tui-raw/tui/quota-layout.tsx +1 -1
- package/src/tui-raw/tui/sidebar-frame.tsx +603 -0
- package/src/tui-raw/tui.tsx +25 -523
- package/src/tui.tsx +25 -523
|
@@ -41,9 +41,8 @@
|
|
|
41
41
|
* server code, and nothing writes to the terminal or forces a theme.
|
|
42
42
|
*/
|
|
43
43
|
|
|
44
|
-
import { createSignal,
|
|
44
|
+
import { createSignal, type JSX } from "solid-js"
|
|
45
45
|
import {
|
|
46
|
-
type ProjectedSidebar,
|
|
47
46
|
type ProjectionAccount,
|
|
48
47
|
type ProjectionRoute,
|
|
49
48
|
type ProjectionStatus,
|
|
@@ -66,12 +65,12 @@ import {
|
|
|
66
65
|
type MenuUi,
|
|
67
66
|
} from "./shared/07365a7d2ccade4c-host-api.js"
|
|
68
67
|
import {
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
type
|
|
73
|
-
|
|
74
|
-
|
|
68
|
+
DEFAULT_FRAME_SETTINGS,
|
|
69
|
+
type FrameColor,
|
|
70
|
+
type FrameRoute,
|
|
71
|
+
type FrameTheme,
|
|
72
|
+
SidebarFrame,
|
|
73
|
+
} from "./shared/ced204104a639c9c-sidebar-frame.tsx"
|
|
75
74
|
|
|
76
75
|
export const GA_TUI_ID = 'cortexkit.antigravity-auth' as const
|
|
77
76
|
export const GA_RPC_ID = 'antigravity-auth' as const
|
|
@@ -113,8 +112,22 @@ export interface GaSlotClaim {
|
|
|
113
112
|
readonly render: (input: { readonly sessionID: string }) => JSX.Element
|
|
114
113
|
}
|
|
115
114
|
|
|
115
|
+
/**
|
|
116
|
+
* The host's durable plugin storage, as far as the sidebar uses it: one
|
|
117
|
+
* JSON store and the function that changes it.
|
|
118
|
+
*/
|
|
119
|
+
export interface GaStorage {
|
|
120
|
+
store<Value extends object>(
|
|
121
|
+
key: string,
|
|
122
|
+
options: { readonly initial: Value },
|
|
123
|
+
): readonly [Value, (mutation: (draft: Value) => void) => Promise<void>]
|
|
124
|
+
}
|
|
125
|
+
|
|
116
126
|
/** The parts of the GA TUI `Context` this adapter uses. */
|
|
117
127
|
export interface GaTuiContext {
|
|
128
|
+
/** The host's resolved theme; read on every render, so a switch shows. */
|
|
129
|
+
readonly theme?: GaTheme
|
|
130
|
+
readonly storage?: GaStorage
|
|
118
131
|
readonly location: GaLocationRef | undefined
|
|
119
132
|
readonly client: {
|
|
120
133
|
readonly rpc: {
|
|
@@ -1484,105 +1497,141 @@ export async function pollGaOnce(options: GaPollerOptions): Promise<void> {
|
|
|
1484
1497
|
|
|
1485
1498
|
interface SidebarView {
|
|
1486
1499
|
readonly scope: GaScope
|
|
1487
|
-
/** The snapshot's accounts; the
|
|
1488
|
-
readonly accounts: readonly
|
|
1489
|
-
readonly
|
|
1490
|
-
|
|
1500
|
+
/** The snapshot's accounts; the frame reads their state and stored windows. */
|
|
1501
|
+
readonly accounts: readonly GaAccount[]
|
|
1502
|
+
readonly route: ProjectionRoute | null
|
|
1503
|
+
readonly quotaBackoffUntil: number | null
|
|
1504
|
+
/** The clock reading the snapshot was taken at; the quota rows use it too. */
|
|
1491
1505
|
readonly readAt: number
|
|
1492
1506
|
}
|
|
1493
1507
|
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1508
|
+
type HostColor = { readonly base?: FrameColor; readonly muted?: FrameColor }
|
|
1509
|
+
|
|
1510
|
+
/**
|
|
1511
|
+
* The OpenCode 2 host theme tokens the sidebar reads (the host's resolved
|
|
1512
|
+
* theme, as far as this sidebar uses it). Any of them may be missing.
|
|
1513
|
+
*/
|
|
1514
|
+
export interface GaTheme {
|
|
1515
|
+
readonly text?: HostColor & {
|
|
1516
|
+
readonly action?: { readonly primary?: HostColor }
|
|
1517
|
+
readonly feedback?: {
|
|
1518
|
+
readonly success?: HostColor
|
|
1519
|
+
readonly warning?: HostColor
|
|
1520
|
+
readonly error?: HostColor
|
|
1521
|
+
}
|
|
1522
|
+
}
|
|
1523
|
+
readonly background?: HostColor & { readonly raised?: HostColor }
|
|
1524
|
+
readonly border?: HostColor
|
|
1525
|
+
}
|
|
1526
|
+
|
|
1527
|
+
/**
|
|
1528
|
+
* Maps the OpenCode 2 semantic theme tokens onto the frame's OpenCode 1
|
|
1529
|
+
* names. A missing token falls back to a sibling token; with none at all
|
|
1530
|
+
* the color stays `undefined`, so the host's default color shows and no
|
|
1531
|
+
* color is ever fixed here.
|
|
1532
|
+
*/
|
|
1533
|
+
export function sidebarThemeFromHost(theme: GaTheme | undefined): FrameTheme {
|
|
1534
|
+
const text =
|
|
1535
|
+
theme?.text?.base ??
|
|
1536
|
+
theme?.text?.muted ??
|
|
1537
|
+
theme?.text?.action?.primary?.base
|
|
1538
|
+
const accent = theme?.text?.action?.primary?.base ?? text
|
|
1539
|
+
const feedback = theme?.text?.feedback
|
|
1540
|
+
return {
|
|
1541
|
+
text,
|
|
1542
|
+
textMuted: theme?.text?.muted ?? text,
|
|
1543
|
+
accent,
|
|
1544
|
+
background: theme?.background?.base ?? theme?.background?.raised?.base,
|
|
1545
|
+
borderActive: theme?.border?.base ?? accent,
|
|
1546
|
+
success: feedback?.success?.base ?? feedback?.success?.muted,
|
|
1547
|
+
warning: feedback?.warning?.base ?? feedback?.warning?.muted,
|
|
1548
|
+
error: feedback?.error?.base ?? feedback?.error?.muted,
|
|
1549
|
+
}
|
|
1500
1550
|
}
|
|
1501
1551
|
|
|
1502
1552
|
function GaSidebar(props: {
|
|
1503
1553
|
readonly view: () => SidebarView | undefined
|
|
1504
1554
|
readonly sessionID: string
|
|
1555
|
+
readonly theme: () => GaTheme | undefined
|
|
1556
|
+
readonly version: string
|
|
1557
|
+
readonly collapsed: () => boolean
|
|
1558
|
+
readonly toggleCollapsed: () => void
|
|
1505
1559
|
}): JSX.Element {
|
|
1506
|
-
// The route
|
|
1560
|
+
// The route belongs to one session; show it only in that session's
|
|
1507
1561
|
// sidebar, never another session's.
|
|
1508
|
-
const route = () => {
|
|
1562
|
+
const route = (): FrameRoute | null => {
|
|
1509
1563
|
const view = props.view()
|
|
1510
1564
|
if (view === undefined || view.scope.kind !== 'session') return null
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
return `Route ${fitRouteParts('Route', value.split(' · '), contentWidth())}`
|
|
1519
|
-
}
|
|
1520
|
-
// The quota rows are sized to the sidebar's width so none of them wraps.
|
|
1521
|
-
// Layout reports the width during a render pass, so the signal is updated
|
|
1522
|
-
// afterwards rather than rebuilding rows mid-pass.
|
|
1523
|
-
const [contentWidth, setContentWidth] = createSignal(ASSUMED_CONTENT_WIDTH)
|
|
1524
|
-
let titleRow: { width: number } | undefined
|
|
1525
|
-
const measureContentWidth = (): void => {
|
|
1526
|
-
const width = titleRow?.width
|
|
1527
|
-
if (typeof width !== 'number' || width <= 0) return
|
|
1528
|
-
queueMicrotask(() => {
|
|
1529
|
-
if (width !== contentWidth()) setContentWidth(width)
|
|
1530
|
-
})
|
|
1565
|
+
if (view.scope.sessionID !== props.sessionID || view.route === null)
|
|
1566
|
+
return null
|
|
1567
|
+
return {
|
|
1568
|
+
...(view.route.strategy ? { strategy: view.route.strategy } : {}),
|
|
1569
|
+
family: view.route.modelFamily,
|
|
1570
|
+
style: view.route.headerStyle,
|
|
1571
|
+
}
|
|
1531
1572
|
}
|
|
1532
1573
|
return (
|
|
1533
|
-
<
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
</box>
|
|
1546
|
-
<Show when={props.view()} fallback={<text>connecting…</text>}>
|
|
1547
|
-
{(view) => (
|
|
1548
|
-
<>
|
|
1549
|
-
<For each={view().projected.accounts}>
|
|
1550
|
-
{(account, index) => (
|
|
1551
|
-
<Show when={view().accounts[index()]}>
|
|
1552
|
-
{(source) => (
|
|
1553
|
-
<QuotaAccountBlock
|
|
1554
|
-
palette={HOST_COLORS}
|
|
1555
|
-
appearance={DEFAULT_QUOTA_APPEARANCE}
|
|
1556
|
-
account={source()}
|
|
1557
|
-
status={account.status}
|
|
1558
|
-
statusTone={account.statusTone}
|
|
1559
|
-
now={() => view().readAt}
|
|
1560
|
-
width={contentWidth}
|
|
1561
|
-
marginTop={index() === 0 ? 0 : 1}
|
|
1562
|
-
>
|
|
1563
|
-
<text>{` ${account.health}`}</text>
|
|
1564
|
-
</QuotaAccountBlock>
|
|
1565
|
-
)}
|
|
1566
|
-
</Show>
|
|
1567
|
-
)}
|
|
1568
|
-
</For>
|
|
1569
|
-
<Show when={routeLine()}>
|
|
1570
|
-
{(line) => <text wrapMode='none'>{line()}</text>}
|
|
1571
|
-
</Show>
|
|
1572
|
-
<For each={view().projected.notices}>
|
|
1573
|
-
{(notice) => <text>{notice}</text>}
|
|
1574
|
-
</For>
|
|
1575
|
-
</>
|
|
1576
|
-
)}
|
|
1577
|
-
</Show>
|
|
1578
|
-
</box>
|
|
1574
|
+
<SidebarFrame
|
|
1575
|
+
theme={() => sidebarThemeFromHost(props.theme())}
|
|
1576
|
+
settings={() => DEFAULT_FRAME_SETTINGS}
|
|
1577
|
+
version={props.version}
|
|
1578
|
+
collapsed={props.collapsed}
|
|
1579
|
+
onToggleCollapsed={props.toggleCollapsed}
|
|
1580
|
+
accounts={() => props.view()?.accounts ?? []}
|
|
1581
|
+
route={route}
|
|
1582
|
+
quotaBackoffUntil={() => props.view()?.quotaBackoffUntil ?? undefined}
|
|
1583
|
+
lastError={() => undefined}
|
|
1584
|
+
now={() => props.view()?.readAt ?? 0}
|
|
1585
|
+
/>
|
|
1579
1586
|
)
|
|
1580
1587
|
}
|
|
1581
1588
|
|
|
1589
|
+
/** Where the collapse choice is kept in the host's plugin storage. */
|
|
1590
|
+
export const GA_SIDEBAR_STORE_KEY = 'antigravity-auth.sidebar'
|
|
1591
|
+
|
|
1592
|
+
/**
|
|
1593
|
+
* The collapse state: the host's durable plugin storage when it has one, so
|
|
1594
|
+
* the choice survives a reload; for this TUI session otherwise.
|
|
1595
|
+
*/
|
|
1596
|
+
function createGaCollapse(
|
|
1597
|
+
storage: GaStorage | undefined,
|
|
1598
|
+
logger: GaLogger | undefined,
|
|
1599
|
+
): { collapsed: () => boolean; toggle: () => void } {
|
|
1600
|
+
const saved = storage?.store(GA_SIDEBAR_STORE_KEY, {
|
|
1601
|
+
initial: { collapsed: false },
|
|
1602
|
+
})
|
|
1603
|
+
// A click updates the sidebar at once: the local choice wins while its
|
|
1604
|
+
// save is pending, and once storage holds it the stored value decides
|
|
1605
|
+
// again. Without storage the local choice lasts for the session.
|
|
1606
|
+
const [chosen, setChosen] = createSignal<boolean | undefined>(undefined)
|
|
1607
|
+
const collapsed = () => chosen() ?? saved?.[0].collapsed === true
|
|
1608
|
+
const toggle = () => {
|
|
1609
|
+
const next = !collapsed()
|
|
1610
|
+
setChosen(next)
|
|
1611
|
+
if (!saved) return
|
|
1612
|
+
saved[1]((draft) => {
|
|
1613
|
+
draft.collapsed = next
|
|
1614
|
+
}).then(
|
|
1615
|
+
() => {
|
|
1616
|
+
if (chosen() === next && saved[0].collapsed === next)
|
|
1617
|
+
setChosen(undefined)
|
|
1618
|
+
},
|
|
1619
|
+
(error: unknown) => {
|
|
1620
|
+
logger?.warn('sidebar-collapse-not-saved', {
|
|
1621
|
+
error: error instanceof Error ? error.name : typeof error,
|
|
1622
|
+
})
|
|
1623
|
+
},
|
|
1624
|
+
)
|
|
1625
|
+
}
|
|
1626
|
+
return { collapsed, toggle }
|
|
1627
|
+
}
|
|
1628
|
+
|
|
1582
1629
|
// ── Plugin setup ────────────────────────────────────────────────────────────
|
|
1583
1630
|
|
|
1584
1631
|
export interface GaSetupOptions {
|
|
1585
1632
|
readonly logger?: GaLogger
|
|
1633
|
+
/** The plugin version shown in the sidebar header; empty or absent hides it. */
|
|
1634
|
+
readonly version?: string
|
|
1586
1635
|
readonly now?: () => number
|
|
1587
1636
|
/** Replaces the interval timer (tests). Returns a function that stops it. */
|
|
1588
1637
|
readonly schedule?: (tick: () => void, intervalMs: number) => () => void
|
|
@@ -1613,10 +1662,20 @@ export function setupGaTui(
|
|
|
1613
1662
|
const active = () => !client.disposed()
|
|
1614
1663
|
const ui = createGaMenuUi(context, active)
|
|
1615
1664
|
const [view, setView] = createSignal<SidebarView | undefined>(undefined)
|
|
1665
|
+
const collapse = createGaCollapse(context.storage, logger)
|
|
1616
1666
|
|
|
1617
1667
|
const releaseSlot = context.ui.slot({
|
|
1618
1668
|
append: 'sidebar.content',
|
|
1619
|
-
render: (input) =>
|
|
1669
|
+
render: (input) => (
|
|
1670
|
+
<GaSidebar
|
|
1671
|
+
view={view}
|
|
1672
|
+
sessionID={input.sessionID}
|
|
1673
|
+
theme={() => context.theme}
|
|
1674
|
+
version={options.version ?? ''}
|
|
1675
|
+
collapsed={collapse.collapsed}
|
|
1676
|
+
toggleCollapsed={collapse.toggle}
|
|
1677
|
+
/>
|
|
1678
|
+
),
|
|
1620
1679
|
})
|
|
1621
1680
|
|
|
1622
1681
|
// The latest snapshot per scope; the drawer's menu is built from it.
|
|
@@ -1628,12 +1687,8 @@ export function setupGaTui(
|
|
|
1628
1687
|
setView({
|
|
1629
1688
|
scope: snapshot.scope,
|
|
1630
1689
|
accounts: snapshot.accounts,
|
|
1631
|
-
|
|
1632
|
-
|
|
1633
|
-
route: snapshot.route,
|
|
1634
|
-
status: snapshot.status,
|
|
1635
|
-
now: readAt,
|
|
1636
|
-
}),
|
|
1690
|
+
route: snapshot.route,
|
|
1691
|
+
quotaBackoffUntil: snapshot.status.quotaBackoffUntil,
|
|
1637
1692
|
readAt,
|
|
1638
1693
|
})
|
|
1639
1694
|
}
|
|
@@ -1751,11 +1806,18 @@ export function setupGaTui(
|
|
|
1751
1806
|
* The GA TUI plugin definition (`{ id, setup }`, the 2.0.22 TUI plugin
|
|
1752
1807
|
* shape). Importing this module starts nothing; `setup` binds to the
|
|
1753
1808
|
* context's location and returns the cleanup that stops everything it
|
|
1754
|
-
* started.
|
|
1809
|
+
* started. The host calls `setup(context)`; the package's `./tui` entry
|
|
1810
|
+
* passes the plugin version as the second argument. This module's graph
|
|
1811
|
+
* may use no Node built-in (the build refuses one), so it cannot read
|
|
1812
|
+
* `package.json` itself.
|
|
1755
1813
|
*/
|
|
1756
1814
|
const gaTuiPlugin = {
|
|
1757
1815
|
id: GA_TUI_ID,
|
|
1758
|
-
setup: (
|
|
1816
|
+
setup: (
|
|
1817
|
+
context: GaTuiContext,
|
|
1818
|
+
options: { readonly version?: string } = {},
|
|
1819
|
+
): (() => Promise<void>) =>
|
|
1820
|
+
setupGaTui(context, options.version ? { version: options.version } : {}),
|
|
1759
1821
|
}
|
|
1760
1822
|
|
|
1761
1823
|
export default gaTuiPlugin
|