@aragon-agent/cli 0.6.72 → 0.6.73
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/CHANGELOG.md +29 -0
- package/README.md +20 -0
- package/dist/account/session.d.ts +47 -0
- package/dist/account/session.js +46 -0
- package/dist/app/App.js +213 -14
- package/dist/commands/account-command.d.ts +16 -6
- package/dist/commands/account-command.js +31 -2
- package/dist/commands/builtins.js +4 -0
- package/dist/commands/catalog.js +8 -0
- package/package.json +3 -3
package/CHANGELOG.md
CHANGED
|
@@ -44,6 +44,14 @@ were written.
|
|
|
44
44
|
|
|
45
45
|
### Fixed
|
|
46
46
|
|
|
47
|
+
- **`Ctrl+Y` can no longer approve a tool, delete a prompt page or sign the waiver.**
|
|
48
|
+
Ink reports every C0 byte `0x01`-`0x1a` as its letter plus `key.ctrl`, so `Ctrl+Y` reaches a handler as
|
|
49
|
+
`input === 'y'` with `ctrl` set - and three handlers read a bare `y`: the tool-approval dialog
|
|
50
|
+
(`y approve`), the prompt library's delete page and the red-team disclaimer (`y` = sign). One keystroke on
|
|
51
|
+
a chord nobody associates with consent could therefore approve a mutating tool. All three now require an
|
|
52
|
+
unmodified `y` (`!key.ctrl && !key.meta`, with `Esc` explicitly exempt because a lone `Esc` arrives with
|
|
53
|
+
`meta` set as well), and `Ctrl+X` - measured free across the whole package - is the account panel's key
|
|
54
|
+
instead of the `Y` the first draft picked.
|
|
47
55
|
- **Changing the round budget on the desktop no longer answers with a refusal.** At `auto`, `Ctrl+Up`
|
|
48
56
|
(and the chip's `+`) left the value alone and printed an edge judgement, so the one gesture a user
|
|
49
57
|
tries - "give me my own number" - looked broken. `auto` now has a real number neighbour in BOTH
|
|
@@ -135,6 +143,27 @@ were written.
|
|
|
135
143
|
|
|
136
144
|
### Added
|
|
137
145
|
|
|
146
|
+
- **The TUI says who you are signed in as, and `Ctrl+X` opens an account panel.**
|
|
147
|
+
After `/login`, the header carries `● <username>` immediately left of `^G more` - green while the
|
|
148
|
+
credential is usable, amber inside the last three days, hollow red `○` once it has expired, and `*` / `o`
|
|
149
|
+
on a terminal without Unicode, so the shape carries the state where the colour cannot. Nothing is drawn
|
|
150
|
+
while signed out, and that frame is byte-identical to the one before this change: a user who never signed
|
|
151
|
+
in loses no cell. The block caps the name at 12 cells and drops itself entirely on a terminal too narrow to
|
|
152
|
+
pay for it, so `provider:model` and `^G more` survive (at 80 columns the 7 cells come out of the task
|
|
153
|
+
summary: 19 → 12 cells, the model name keeps all 36).
|
|
154
|
+
`Ctrl+X` / `Alt+X` / `/account` open a panel that shows the username, email, user id, scopes, the token
|
|
155
|
+
prefix (`(prefix only)` - the panel's input type has no field for the plaintext), the issued and expiry
|
|
156
|
+
dates, the credential path and the server, and offers `Enter` (sign in or renew, through the same device
|
|
157
|
+
flow as `/login`), `x` (sign out - twice: the first press arms, `Esc` or any other key disarms) and `r`
|
|
158
|
+
(re-read the file after a sign-in done in another terminal). The panel opens while signed out too and says
|
|
159
|
+
what Enter would do. The identity is propped into the TUI (`tui` may not read the CLI's credential), the
|
|
160
|
+
snapshot is re-read on exactly five low-frequency events (mount, a finished sign-in, a sign-out, `r`, and a
|
|
161
|
+
one-minute look for another terminal), and every frame after that derives the state from `expiresAt` with a
|
|
162
|
+
pure function - so a credential that runs out mid-session changes colour without a restart and without a
|
|
163
|
+
synchronous read per streamed token. `Ctrl+G` lists the new key (and `/help` with it), and the `/account`
|
|
164
|
+
row is byte-identical in the registry, the command catalog and the guide. `Ctrl+Y` was the first choice and
|
|
165
|
+
is deliberately unused: on a terminal it arrives as a plain `y`, which three surfaces in this app treat as
|
|
166
|
+
a decision (see the `Ctrl+Y` fix below).
|
|
138
167
|
- **Agent memory writes are autonomous by default: one approval for a bulk change, a journal and undo for
|
|
139
168
|
everything else.** `memory.agentWrites` now defaults to `auto`, so a small change is applied on the
|
|
140
169
|
model's own hand instead of waiting behind a preview card. Three things make that safe rather than
|
package/README.md
CHANGED
|
@@ -997,6 +997,7 @@ completes, `Up` / `Down` moves the selection, `Esc` closes it.
|
|
|
997
997
|
| `Ctrl+N` | The same toggle, over a channel no Windows console can swallow. Use it if `Shift+Tab` does nothing. Written `Ctrl+N` everywhere, never `^N` - `^N` is the header's line-offset chip |
|
|
998
998
|
| `Ctrl+P` | **Quick prompt library**: the manager - create, edit, delete, favourite and reorder your own prompts. See [Quick prompt library](#quick-prompt-library) |
|
|
999
999
|
| `Ctrl+M` / `Alt+M` | **Memory manager**: save, edit, search and mount the notes AragonAgent remembers across sessions. `Ctrl+M` is the same byte as `Enter` on a terminal without keyboard enhancement (Windows Terminal, kitty, iTerm2 and WezTerm have it), where it still submits the draft exactly as before - use `Alt+M` or `/memory` there. `t` in the manager opens the activity page (what changed recently, one line each) and `u` on a row undoes that batch after a `y` - the same `/memory activity` / `/memory undo`. See [Memory](#memory) |
|
|
1000
|
+
| `Ctrl+X` / `Alt+X` | **Account panel**: who you are signed in as, the credential's expiry, and the three things you can do about it - `Enter` signs in or renews, `x` signs out (twice: the first press only arms it), `r` re-reads the file after a sign-in done in another terminal. `Alt+X` works where the terminal swallows `Ctrl+X`; `/account` always works. While you are signed in, the header shows the same identity as `● ada` immediately left of `^G more` (green = usable, amber = three days or fewer left, hollow red `○` = expired), and signed out it shows nothing at all. See [Signed-in identity and the account panel](#signed-in-identity-and-the-account-panel). `Ctrl+Y` is deliberately NOT this key: on a terminal `Ctrl+Y` arrives as a plain `y`, and three surfaces in this app read a plain `y` |
|
|
1000
1001
|
| `Ctrl+B` | **Agents board**: the details of a running dispatch. Left column lists every child (not just the five the roster fits), the right-hand sections show the selected child's state, turns, tools, tokens, files, mail, supervisor actions, retries, compaction, its current activity, its final answer or error, and the last 24 events. `Up` / `Down` change the child, `PgUp` / `PgDn` and the wheel page, `Esc` closes. The board survives the end of the dispatch - it freezes the last live snapshot and marks it `dispatch ended` - and opens after the fact from the session's own team card, where everything except the live-only sections (current activity, mail count, timeline) is still readable. Pressing `Ctrl+B` again, or `/agents`, opens and closes it |
|
|
1001
1002
|
| `Ctrl+I` | **Build the project index** (bundled `project-indexer` skill). Asks for confirmation, then writes `.claude-index/` and matching `CLAUDE.md` / `AGENTS.md`, including rules for results in `runs/` and temporary-file checks. On terminals without keyboard enhancement `Ctrl+I` is the Tab byte and completes input instead |
|
|
1002
1003
|
| `Ctrl+K` | **Agent kits**: pick a model preset — main / subagent / fast profile in one choice — for **this session only**. Nothing is written to the config file. `Current setup` (the first row) releases the preset and returns to the file's bindings. See [Agent kits](#agent-kits) |
|
|
@@ -1110,6 +1111,25 @@ is what it used to do. Inline mode is unaffected either way.
|
|
|
1110
1111
|
| `aragon config set taskSummary.enabled false` | 关掉摘要与那次模型调用 |
|
|
1111
1112
|
| `aragon config set taskSummary.fallback false` | 失败时显示空,而不是用户原话前缀 |
|
|
1112
1113
|
|
|
1114
|
+
## Signed-in identity and the account panel
|
|
1115
|
+
|
|
1116
|
+
一旦你用 `/login` 通过 OAuth 登录,头部就会常驻你的身份:`^G more` 左边出现一个绿点
|
|
1117
|
+
加用户名(`● ada ^G more`),多长都不挤掉 `provider:model` —— 名字超过 12 格会被
|
|
1118
|
+
省略号截断,终端太窄时整块先让位。没登录就**一格都不占**,帧与没这个功能时逐字节相同。
|
|
1119
|
+
|
|
1120
|
+
- **三个状态,形状先于颜色**:可用是实心 `●`(绿)、剩 3 天以内变琥珀、过期变空心
|
|
1121
|
+
`○`(红)。`colorLevel: 0` 或纯 ASCII 终端上是 `*` / `o`,形状本身就是信号。
|
|
1122
|
+
运行中到期不需要重启:每一帧都用 `expiresAt` 重算一次,不读盘。
|
|
1123
|
+
- **`Ctrl+X` / `Alt+X` / `/account` 三路打开面板**。面板上半是事实(用户名、邮箱、用户
|
|
1124
|
+
id、scopes、token 前缀、签发与到期时间、凭证文件路径、服务器),下半是动作:`Enter`
|
|
1125
|
+
登录/续期(走设备码流程,和 `/login` 同一个面板)、`x` 登出、`r` 重读凭证、`Esc`
|
|
1126
|
+
关闭。登出要按两次:第一下只是把确认「上膛」,再按别的键就撤销。
|
|
1127
|
+
- **邮件只出现在面板里,不上头部**:头部在每一张截图、每一次共享屏幕里,够用就好。
|
|
1128
|
+
- **永远不显示明文 token**:结构上就拿不到,只有 `aragon_pat_ab12cd34... (prefix only)`。
|
|
1129
|
+
- **未登录也能打开**,并且会说清 `Enter` 能做什么 —— 一个按了没反应的面板等于坏功能。
|
|
1130
|
+
- 凭证文件是 `<ARAGON_HOME>/account.json`;另一个终端里 `/login` 或 `/logout` 之后,
|
|
1131
|
+
这里一分钟内会跟上,`r` 是立刻跟上。
|
|
1132
|
+
|
|
1113
1133
|
## Quick prompt library
|
|
1114
1134
|
|
|
1115
1135
|
`↑` history remembers what you said. It does not remember what you say *every*
|
|
@@ -38,6 +38,35 @@ export interface AccountStatus {
|
|
|
38
38
|
} | null;
|
|
39
39
|
readonly tokenPrefix: string | null;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Everything the header's identity row and the account panel need, read ONCE per
|
|
43
|
+
* event (tui-account-identity-and-panel D-5 / section 6.4).
|
|
44
|
+
*
|
|
45
|
+
* WHY A SECOND READER RATHER THAN A WIDER `AccountStatus`: `readAccountStatus` is
|
|
46
|
+
* consumed by `/login`, by `/logout` and by their tests, and widening its shape would
|
|
47
|
+
* be a change to a contract nobody asked to change. This one is additive, and it is
|
|
48
|
+
* deliberately NOT a credential: there is no `token` field, so a surface that receives
|
|
49
|
+
* a snapshot cannot print the secret.
|
|
50
|
+
*
|
|
51
|
+
* `expiresAt` IS THE ONLY MOVING PART. The panel derives `state` and `daysLeft` on
|
|
52
|
+
* every frame from `classifyExpiry(expiresAt, now)` - a pure function - because the
|
|
53
|
+
* clock changes without the file changing (E-3). Re-reading the file per frame would
|
|
54
|
+
* be a synchronous read on every streamed token.
|
|
55
|
+
*/
|
|
56
|
+
export interface AccountSnapshot {
|
|
57
|
+
readonly username: string;
|
|
58
|
+
readonly email: string | null;
|
|
59
|
+
readonly userId: string;
|
|
60
|
+
readonly scopes: readonly string[];
|
|
61
|
+
readonly tokenPrefix: string;
|
|
62
|
+
readonly baseUrl: string;
|
|
63
|
+
/** Epoch milliseconds. */
|
|
64
|
+
readonly issuedAt: number;
|
|
65
|
+
/** Epoch milliseconds. */
|
|
66
|
+
readonly expiresAt: number;
|
|
67
|
+
/** Absolute path of `<home>/account.json`, for the panel's `file` row. */
|
|
68
|
+
readonly accountPath: string;
|
|
69
|
+
}
|
|
41
70
|
export interface ExpiryClassification {
|
|
42
71
|
readonly state: AccountState;
|
|
43
72
|
readonly daysLeft: number;
|
|
@@ -60,3 +89,21 @@ export declare function classifyExpiry(expiresAt: number, now: number): ExpiryCl
|
|
|
60
89
|
* invalidation story the moment `clearAccount()` exists.
|
|
61
90
|
*/
|
|
62
91
|
export declare function readAccountStatus(now?: number): AccountStatus;
|
|
92
|
+
/**
|
|
93
|
+
* The credential's FULL public profile, or `null` while signed out.
|
|
94
|
+
*
|
|
95
|
+
* SAME NO-THROW CONTRACT AS `readAccount`: an unreadable file is `null`, which every
|
|
96
|
+
* caller renders as "not signed in". This is the ONE read the App performs, at mount
|
|
97
|
+
* and after each of the four events that can change the answer (`/login` succeeding,
|
|
98
|
+
* `/logout`, the panel's `r`, and the once-a-minute look for another terminal).
|
|
99
|
+
*/
|
|
100
|
+
export declare function readAccountSnapshot(): AccountSnapshot | null;
|
|
101
|
+
/**
|
|
102
|
+
* The `AccountStatus` view of a snapshot, for the copy that already takes one
|
|
103
|
+
* (`describeExpiry`, `startupAccountNotice`).
|
|
104
|
+
*
|
|
105
|
+
* A PURE FUNCTION, which is the point: the App can hold the snapshot in state and
|
|
106
|
+
* recompute the classification on every frame without touching the disk, and the
|
|
107
|
+
* startup notice still speaks the account layer's own sentences.
|
|
108
|
+
*/
|
|
109
|
+
export declare function statusFromSnapshot(snapshot: AccountSnapshot | null, now?: number): AccountStatus;
|
package/dist/account/session.js
CHANGED
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
* means "calendar days of use left, a partial day counts as one" - which is the
|
|
20
20
|
* number a user reads as "expires in 3 days".
|
|
21
21
|
*/
|
|
22
|
+
import { getAccountPath } from '../config/app-paths.js';
|
|
22
23
|
import { readAccount } from './store.js';
|
|
23
24
|
/** Warn when the credential has this many days (or fewer) left (spec section 1). */
|
|
24
25
|
export const EXPIRY_WARN_DAYS = 3;
|
|
@@ -61,3 +62,48 @@ export function readAccountStatus(now = Date.now()) {
|
|
|
61
62
|
tokenPrefix: account.tokenPrefix,
|
|
62
63
|
};
|
|
63
64
|
}
|
|
65
|
+
/**
|
|
66
|
+
* The credential's FULL public profile, or `null` while signed out.
|
|
67
|
+
*
|
|
68
|
+
* SAME NO-THROW CONTRACT AS `readAccount`: an unreadable file is `null`, which every
|
|
69
|
+
* caller renders as "not signed in". This is the ONE read the App performs, at mount
|
|
70
|
+
* and after each of the four events that can change the answer (`/login` succeeding,
|
|
71
|
+
* `/logout`, the panel's `r`, and the once-a-minute look for another terminal).
|
|
72
|
+
*/
|
|
73
|
+
export function readAccountSnapshot() {
|
|
74
|
+
const account = readAccount();
|
|
75
|
+
if (account === null)
|
|
76
|
+
return null;
|
|
77
|
+
return {
|
|
78
|
+
username: account.user.username,
|
|
79
|
+
email: account.user.email ?? null,
|
|
80
|
+
userId: account.user.id,
|
|
81
|
+
scopes: account.scopes,
|
|
82
|
+
tokenPrefix: account.tokenPrefix,
|
|
83
|
+
baseUrl: account.baseUrl,
|
|
84
|
+
issuedAt: account.issuedAt,
|
|
85
|
+
expiresAt: account.expiresAt,
|
|
86
|
+
accountPath: getAccountPath(),
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* The `AccountStatus` view of a snapshot, for the copy that already takes one
|
|
91
|
+
* (`describeExpiry`, `startupAccountNotice`).
|
|
92
|
+
*
|
|
93
|
+
* A PURE FUNCTION, which is the point: the App can hold the snapshot in state and
|
|
94
|
+
* recompute the classification on every frame without touching the disk, and the
|
|
95
|
+
* startup notice still speaks the account layer's own sentences.
|
|
96
|
+
*/
|
|
97
|
+
export function statusFromSnapshot(snapshot, now = Date.now()) {
|
|
98
|
+
if (snapshot === null) {
|
|
99
|
+
return { state: 'signed-out', daysLeft: 0, expiresAt: null, user: null, tokenPrefix: null };
|
|
100
|
+
}
|
|
101
|
+
const { state, daysLeft } = classifyExpiry(snapshot.expiresAt, now);
|
|
102
|
+
return {
|
|
103
|
+
state,
|
|
104
|
+
daysLeft,
|
|
105
|
+
expiresAt: snapshot.expiresAt,
|
|
106
|
+
user: { username: snapshot.username },
|
|
107
|
+
tokenPrefix: snapshot.tokenPrefix,
|
|
108
|
+
};
|
|
109
|
+
}
|
package/dist/app/App.js
CHANGED
|
@@ -43,6 +43,7 @@ import { boardDataFromRun, boardDataFromSnapshot, } from '@aragon-agent/tui/ui/l
|
|
|
43
43
|
import { isGovernancePosture, nextPosture, splitPosture, } from '@aragon-agent/tui/model/governance/posture';
|
|
44
44
|
import { GOVERN_INTRO_NOTICE, PLAN_APPROVED_TOAST, PLAN_GOVERN_INTRO_NOTICE, posturePendingToast, postureAppliedToast, stageRunningToast, } from '../governance/copy.js';
|
|
45
45
|
import { TodoPanel } from '@aragon-agent/tui/ui/TodoPanel';
|
|
46
|
+
import { liveSpinner } from '@aragon-agent/tui/ui/ActivityLine';
|
|
46
47
|
import { BottomStatusRow } from '@aragon-agent/tui/ui/BottomStatusRow';
|
|
47
48
|
// Only the updater's pure visibility predicate enters the status detail plan.
|
|
48
49
|
import { shouldRenderUpdateLine } from '@aragon-agent/tui/model/update/types';
|
|
@@ -73,6 +74,10 @@ import { RedTeamDisclaimerOverlay } from '@aragon-agent/tui/ui/overlays/RedTeamD
|
|
|
73
74
|
// overlay because it is the same kind of surface - one Ink component the App drives from
|
|
74
75
|
// `state.overlay`.
|
|
75
76
|
import { LoginOverlay } from '@aragon-agent/tui/ui/overlays/LoginOverlay';
|
|
77
|
+
// THE ACCOUNT PANEL (`Ctrl+X` / `Alt+X` / `/account`, tui-account-identity-and-panel A5). Pure
|
|
78
|
+
// presentation, like the sign-in panel beside it: the credential is read HERE and handed down,
|
|
79
|
+
// because `tui` may not import `cli` (L1) and `<home>/account.json` is CLI territory.
|
|
80
|
+
import { AccountPanel } from '@aragon-agent/tui/ui/overlays/AccountPanel';
|
|
76
81
|
import { teamStatusFromView } from '@aragon-agent/tui/model/team/team-mode';
|
|
77
82
|
import { FORCED_NUDGE_GRACE_MS } from '@aragon-agent/tui/model/team/limits';
|
|
78
83
|
import { TeamWakeDriver } from '../host/team-wake-driver.js';
|
|
@@ -95,7 +100,7 @@ import { publishSessionView } from './session-bridge.js';
|
|
|
95
100
|
// the promise that drives it. `setAccountCommandPort` is how the two commands reach the App -
|
|
96
101
|
// `CommandContext` has no account field and `commands/registry.ts` is outside this work package.
|
|
97
102
|
import { setAccountCommandPort, startupAccountNotice, } from '../commands/account-command.js';
|
|
98
|
-
import { readAccountStatus } from '../account/session.js';
|
|
103
|
+
import { readAccountSnapshot, readAccountStatus, statusFromSnapshot, } from '../account/session.js';
|
|
99
104
|
import { clearAccount } from '../account/store.js';
|
|
100
105
|
import { formatIsoDate } from '../account/format.js';
|
|
101
106
|
import { startLogin } from '../account/login-flow.js';
|
|
@@ -265,6 +270,43 @@ function firstUserText(entries) {
|
|
|
265
270
|
* shape of refusal as `tooSmall` - and the header keeps naming `Esc close`.
|
|
266
271
|
*/
|
|
267
272
|
const DECISION_OVERLAYS = new Set(['confirm', 'question', 'plan']);
|
|
273
|
+
/**
|
|
274
|
+
* How often the account watcher looks for a credential written by ANOTHER terminal
|
|
275
|
+
* (tui-account-identity-and-panel section 6.4 (5)).
|
|
276
|
+
*
|
|
277
|
+
* A MINUTE, NOT A FRAME. The thing that changes the dot on its own - the clock - is
|
|
278
|
+
* handled per frame by `classifyExpiry` (E-3), so this timer exists only for the FILE:
|
|
279
|
+
* `/login` or `/logout` typed in another window. 60s is the shortest interval that is
|
|
280
|
+
* invisible in a profile and still feels immediate to a person who just signed in
|
|
281
|
+
* somewhere else.
|
|
282
|
+
*/
|
|
283
|
+
const ACCOUNT_WATCH_MS = 60_000;
|
|
284
|
+
/**
|
|
285
|
+
* Whether two snapshots say the same thing, so the watcher can leave `state` alone.
|
|
286
|
+
*
|
|
287
|
+
* WITHOUT THIS the timer would repaint a streaming transcript 60 times an hour for
|
|
288
|
+
* nothing: a fresh object identity is a re-render of the whole App.
|
|
289
|
+
*/
|
|
290
|
+
function sameAccountSnapshot(a, b) {
|
|
291
|
+
if (a === null || b === null)
|
|
292
|
+
return a === b;
|
|
293
|
+
return a.username === b.username
|
|
294
|
+
&& a.email === b.email
|
|
295
|
+
&& a.userId === b.userId
|
|
296
|
+
&& a.tokenPrefix === b.tokenPrefix
|
|
297
|
+
&& a.baseUrl === b.baseUrl
|
|
298
|
+
&& a.issuedAt === b.issuedAt
|
|
299
|
+
&& a.expiresAt === b.expiresAt
|
|
300
|
+
&& a.accountPath === b.accountPath
|
|
301
|
+
&& a.scopes.join(',') === b.scopes.join(',');
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* `AccountState` minus `signed-out`: the identity row only exists while a credential
|
|
305
|
+
* does, so anything that is not `valid` or `expiring` draws as `expired`.
|
|
306
|
+
*/
|
|
307
|
+
function headerAccountState(state) {
|
|
308
|
+
return state === 'valid' || state === 'expiring' ? state : 'expired';
|
|
309
|
+
}
|
|
268
310
|
/** The panel before anything has been asked of the server (`/login` and every retry start here). */
|
|
269
311
|
const INITIAL_LOGIN_VIEW = {
|
|
270
312
|
phase: 'prompt',
|
|
@@ -1728,6 +1770,33 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1728
1770
|
const loginAbort = useRef(null);
|
|
1729
1771
|
/** The startup-notice latch: spec 6.6 asks for ONE prompt per launch, not one per render. */
|
|
1730
1772
|
const accountNoticeShown = useRef(false);
|
|
1773
|
+
/**
|
|
1774
|
+
* THE IDENTITY SNAPSHOT (tui-account-identity-and-panel D-1 / D-5).
|
|
1775
|
+
*
|
|
1776
|
+
* THIS IS THE STATE THE DATA CHAIN WAS MISSING. Before it, `App` read the credential
|
|
1777
|
+
* once at mount, turned the answer into a notice and threw the answer away, so no
|
|
1778
|
+
* render path could ever know who was signed in. The header row and the account panel
|
|
1779
|
+
* now read this one value.
|
|
1780
|
+
*
|
|
1781
|
+
* ITS SHAPE IS NOT `AccountStatus`: the panel needs `email` / `userId` / `scopes` /
|
|
1782
|
+
* `issuedAt`, and `readAccountStatus` is consumed by `/login` and its tests, so widening
|
|
1783
|
+
* that contract was not an option (D-5).
|
|
1784
|
+
*
|
|
1785
|
+
* `null` MEANS SIGNED OUT - and it means the frame spends not one extra cell.
|
|
1786
|
+
*/
|
|
1787
|
+
const [accountSnapshot, setAccountSnapshot] = useState(null);
|
|
1788
|
+
/** The panel's one-line answer to the last action (a refused sign-out, a fresh file). */
|
|
1789
|
+
const [accountNotice, setAccountNotice] = useState(null);
|
|
1790
|
+
/**
|
|
1791
|
+
* Re-read the credential. THE ONLY PLACE THAT TOUCHES THE DISK ON THIS SURFACE, and it
|
|
1792
|
+
* runs on five low-frequency events: mount, a finished sign-in, a sign-out, the panel's
|
|
1793
|
+
* `r`, and the once-a-minute watcher. Every frame after that is pure arithmetic.
|
|
1794
|
+
*/
|
|
1795
|
+
const refreshAccountSnapshot = () => {
|
|
1796
|
+
const next = readAccountSnapshot();
|
|
1797
|
+
setAccountSnapshot(next);
|
|
1798
|
+
return next;
|
|
1799
|
+
};
|
|
1731
1800
|
/** `/login` and the panel's `prompt` phase: show the panel, ask the server nothing yet. */
|
|
1732
1801
|
const openLoginPanel = () => {
|
|
1733
1802
|
// A FLOW ALREADY IN FLIGHT IS NOT RESET. `/login` typed while the device poll is waiting
|
|
@@ -1738,6 +1807,17 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1738
1807
|
setLoginView(INITIAL_LOGIN_VIEW);
|
|
1739
1808
|
dispatch({ type: 'setOverlay', overlay: 'login' });
|
|
1740
1809
|
};
|
|
1810
|
+
/**
|
|
1811
|
+
* The account panel, from every route that opens it (`Ctrl+X`, `Alt+X`, `/account`).
|
|
1812
|
+
*
|
|
1813
|
+
* ONE FUNCTION FOR THE THREE so they cannot disagree about the stale notice: opening
|
|
1814
|
+
* the panel always starts from a clean slate, exactly like the drawer starts from a
|
|
1815
|
+
* clean cursor.
|
|
1816
|
+
*/
|
|
1817
|
+
const openAccountPanel = () => {
|
|
1818
|
+
setAccountNotice(null);
|
|
1819
|
+
dispatch({ type: 'setOverlay', overlay: 'account' });
|
|
1820
|
+
};
|
|
1741
1821
|
/**
|
|
1742
1822
|
* Apply a finished flow: the success toast plus the durable transcript notice, or the
|
|
1743
1823
|
* `error` phase carrying the account layer's own sentence.
|
|
@@ -1761,6 +1841,11 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1761
1841
|
toast('success', `Signed in as ${username}.`);
|
|
1762
1842
|
notify('info', `${username} signed in. The credential expires on ${formatIsoDate(expiresAt)}; ` +
|
|
1763
1843
|
'run /login any time to renew it.');
|
|
1844
|
+
// THE IDENTITY ROW LANDS IN THIS FRAME (E-8). The success phase above is a toast that
|
|
1845
|
+
// expires and a panel the user can close; a RE-READ rather than `outcome.account` is
|
|
1846
|
+
// what makes "the header shows who I am" a statement about the disk rather than about
|
|
1847
|
+
// what the network answered - and it is the same entry point the other four events use.
|
|
1848
|
+
refreshAccountSnapshot();
|
|
1764
1849
|
};
|
|
1765
1850
|
/**
|
|
1766
1851
|
* Run one device-flow login, DETACHED from the composer (the panel's Enter, and every retry).
|
|
@@ -1833,15 +1918,43 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1833
1918
|
* (headless, a sub-agent, a host double) leaves the commands on their honest "not available"
|
|
1834
1919
|
* branch.
|
|
1835
1920
|
*/
|
|
1921
|
+
/**
|
|
1922
|
+
* Delete the credential and re-read it - the ONE sign-out path, shared by `/logout` and
|
|
1923
|
+
* by the panel's `x`.
|
|
1924
|
+
*
|
|
1925
|
+
* NEVER OPTIMISTIC (review 9.7): `clearAccount` answers `false` when the filesystem
|
|
1926
|
+
* refused, and a header that dropped the name anyway would be describing a live 20-day
|
|
1927
|
+
* bearer token as gone. The re-read is what makes the row honest in both answers.
|
|
1928
|
+
*/
|
|
1929
|
+
const signOutAccount = () => {
|
|
1930
|
+
const hadCredential = readAccountStatus().state !== 'signed-out';
|
|
1931
|
+
const ok = clearAccount();
|
|
1932
|
+
refreshAccountSnapshot();
|
|
1933
|
+
return { ok, hadCredential };
|
|
1934
|
+
};
|
|
1935
|
+
/**
|
|
1936
|
+
* The panel's `x` (its SECOND press; the first only arms). The panel says what happened
|
|
1937
|
+
* on its own last row, because a toast would scroll away and `/logout`'s transcript
|
|
1938
|
+
* notice belongs to the command, not to a key.
|
|
1939
|
+
*/
|
|
1940
|
+
const handleAccountSignOut = () => {
|
|
1941
|
+
const result = signOutAccount();
|
|
1942
|
+
if (!result.ok) {
|
|
1943
|
+
setAccountNotice(`Sign-out failed: ${getAccountPath()} is still there. `
|
|
1944
|
+
+ 'Delete it by hand or fix its permissions.');
|
|
1945
|
+
return;
|
|
1946
|
+
}
|
|
1947
|
+
setAccountNotice(result.hadCredential
|
|
1948
|
+
? 'Signed out. The credential file is deleted.'
|
|
1949
|
+
: 'Not signed in - there was no credential to delete.');
|
|
1950
|
+
};
|
|
1836
1951
|
const installAccountPort = () => {
|
|
1837
1952
|
setAccountCommandPort({
|
|
1838
1953
|
status: () => readAccountStatus(),
|
|
1839
1954
|
accountPath: getAccountPath,
|
|
1840
1955
|
openLogin: openLoginPanel,
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
return { ok: clearAccount(), hadCredential };
|
|
1844
|
-
},
|
|
1956
|
+
openAccount: openAccountPanel,
|
|
1957
|
+
signOut: () => signOutAccount(),
|
|
1845
1958
|
});
|
|
1846
1959
|
return {};
|
|
1847
1960
|
};
|
|
@@ -1853,12 +1966,29 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
1853
1966
|
if (accountNoticeShown.current)
|
|
1854
1967
|
return;
|
|
1855
1968
|
accountNoticeShown.current = true;
|
|
1856
|
-
|
|
1969
|
+
// ONE READ, TWO USES (section 6.4 (1)): the snapshot feeds the identity row and the
|
|
1970
|
+
// panel, and the SAME snapshot's status feeds the one startup sentence. Reading twice
|
|
1971
|
+
// would be two chances to disagree about who is signed in and how long it lasts.
|
|
1972
|
+
const snapshot = refreshAccountSnapshot();
|
|
1973
|
+
const text = startupAccountNotice(statusFromSnapshot(snapshot));
|
|
1857
1974
|
if (text !== null)
|
|
1858
1975
|
notify('info', text);
|
|
1859
1976
|
// Mount-only by design: `/login` and `/logout` report for themselves.
|
|
1860
1977
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
1861
1978
|
}, []);
|
|
1979
|
+
// THE ONLY POLL, AND IT IS ONE READ A MINUTE (review 9.2). The clock is not polled: the
|
|
1980
|
+
// dot is re-derived per frame from `expiresAt`, so a credential that runs out mid-session
|
|
1981
|
+
// changes without a timer. What a timer is needed for is the FILE - `/login` or `/logout`
|
|
1982
|
+
// in another terminal - and that only repaints when the answer actually changed.
|
|
1983
|
+
useEffect(() => {
|
|
1984
|
+
const id = setInterval(() => {
|
|
1985
|
+
if (!mounted.current)
|
|
1986
|
+
return;
|
|
1987
|
+
const next = readAccountSnapshot();
|
|
1988
|
+
setAccountSnapshot((prev) => (sameAccountSnapshot(prev, next) ? prev : next));
|
|
1989
|
+
}, ACCOUNT_WATCH_MS);
|
|
1990
|
+
return () => clearInterval(id);
|
|
1991
|
+
}, []);
|
|
1862
1992
|
// A poll nobody can see must not outlive the tree that could show it. This is the ONLY
|
|
1863
1993
|
// abort: `Esc` deliberately leaves the flow running (C6).
|
|
1864
1994
|
useEffect(() => () => loginAbort.current?.abort(), []);
|
|
@@ -3321,6 +3451,36 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3321
3451
|
void executeSlashInput('/branch');
|
|
3322
3452
|
return;
|
|
3323
3453
|
}
|
|
3454
|
+
// Ctrl+X / Alt+X: THE ACCOUNT PANEL (tui-account-identity-and-panel A4).
|
|
3455
|
+
//
|
|
3456
|
+
// X AND NOT Y, AND THAT IS A CORRECTNESS DECISION RATHER THAN A MNEMONIC ONE. Ink
|
|
3457
|
+
// delivers Ctrl+Y as `input === 'y'` together with `key.ctrl === true`, and three
|
|
3458
|
+
// handlers in this repo act on a bare `y` - the approval dialog approves a MUTATING
|
|
3459
|
+
// tool, the prompt library deletes a page, the waiver signs itself - so `y` would pull
|
|
3460
|
+
// all three triggers on one keystroke. `gene.key` can also be configured to `ctrl+y`,
|
|
3461
|
+
// which takes the Alt twin out as well. `\x18` and `ESC x` are unbound repo-wide, and
|
|
3462
|
+
// the only two bare-`x` consumers are already ctrl/meta guarded.
|
|
3463
|
+
//
|
|
3464
|
+
// THE GUARD ORDER IS Ctrl+G'S EXACTLY: a second press closes the panel, a decision
|
|
3465
|
+
// overlay keeps the keyboard (it holds an unresolved promise to the agent, and the
|
|
3466
|
+
// Escape branch is the only path that settles one), and `tooSmall` is inert INSIDE
|
|
3467
|
+
// this branch - so "the key did nothing" stays distinguishable from "it never arrived".
|
|
3468
|
+
const isCtrlX = (key.ctrl && (input === 'x' || input === 'X')) || input === '\x18';
|
|
3469
|
+
const isAltX = (key.meta && !key.ctrl && (input === 'x' || input === 'X'))
|
|
3470
|
+
|| input === '\x1bx';
|
|
3471
|
+
if (isCtrlX || isAltX) {
|
|
3472
|
+
if (tooSmall)
|
|
3473
|
+
return;
|
|
3474
|
+
const openNow = stateRef.current.overlay;
|
|
3475
|
+
if (DECISION_OVERLAYS.has(openNow))
|
|
3476
|
+
return;
|
|
3477
|
+
if (openNow === 'account') {
|
|
3478
|
+
dispatch({ type: 'setOverlay', overlay: null });
|
|
3479
|
+
return;
|
|
3480
|
+
}
|
|
3481
|
+
openAccountPanel();
|
|
3482
|
+
return;
|
|
3483
|
+
}
|
|
3324
3484
|
if (tooSmall)
|
|
3325
3485
|
return;
|
|
3326
3486
|
// R-P1-7: the overlay branch MUST come before the transcript scroll branch
|
|
@@ -3346,7 +3506,11 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3346
3506
|
// The memory manager pages through `overlayScroll` too (agent-memory V-4).
|
|
3347
3507
|
|| overlay === 'memory'
|
|
3348
3508
|
// And so does the gene manager (gene-bank 12.2).
|
|
3349
|
-
|| overlay === 'gene'
|
|
3509
|
+
|| overlay === 'gene'
|
|
3510
|
+
// The account panel is a fixed list, so it has nothing to page - but PgDn in it must
|
|
3511
|
+
// not fall through to the transcript BEHIND it, which is the hole the governance
|
|
3512
|
+
// board had before it was named here.
|
|
3513
|
+
|| overlay === 'account';
|
|
3350
3514
|
if (key.pageUp) {
|
|
3351
3515
|
if (controlled)
|
|
3352
3516
|
setOverlayScroll((n) => Math.max(0, n - overlayPage));
|
|
@@ -3535,6 +3699,11 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3535
3699
|
// THE GENE MANAGER OWNS ITS Esc for the same reason: the editor's first Esc only arms the discard.
|
|
3536
3700
|
if (overlay === 'gene' && genePort)
|
|
3537
3701
|
return;
|
|
3702
|
+
// THE ACCOUNT PANEL OWNS ITS Esc, for the same shape of reason: the first Esc after `x`
|
|
3703
|
+
// has to CANCEL THE ARM, and a branch here that also closed the overlay would make the
|
|
3704
|
+
// sign-out confirmation impossible to cancel. `AccountPanel` decides; `App` steps aside.
|
|
3705
|
+
if (overlay === 'account')
|
|
3706
|
+
return;
|
|
3538
3707
|
// THE WAIVER'S `Esc` (4.3). App owns the key for the plan overlays and for this one, so
|
|
3539
3708
|
// declining and draining the queue happen in ONE place - the overlay registers no Escape
|
|
3540
3709
|
// handler of its own, and a second one would decline twice.
|
|
@@ -3746,6 +3915,8 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3746
3915
|
// 200 ms elapsed ticker already causes the render that re-reads this; an IDLE
|
|
3747
3916
|
// `/compact` has no ticker at all, which is what `compactionClock` is for.
|
|
3748
3917
|
const compactionLive = state.compactionEntryId !== undefined;
|
|
3918
|
+
const compacting = compactionLive || !!state.compaction?.inFlight;
|
|
3919
|
+
const footerActive = state.runPhase !== 'idle' || compacting;
|
|
3749
3920
|
if (running && runStartedAt.current === 0)
|
|
3750
3921
|
runStartedAt.current = Date.now();
|
|
3751
3922
|
if (!running && runStartedAt.current !== 0)
|
|
@@ -3879,15 +4050,37 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
3879
4050
|
// mode already agreed; this makes the agreement a construction instead of a
|
|
3880
4051
|
// coincidence.
|
|
3881
4052
|
const headerCols = Math.max(1, frameBudget.composerCols);
|
|
4053
|
+
// ONE SNAPSHOT, TWO SURFACES (section 6.4): the header row and the panel read the same
|
|
4054
|
+
// state, and the only per-frame work is `classifyExpiry` on a timestamp - no file is
|
|
4055
|
+
// touched while tokens stream.
|
|
4056
|
+
const accountStatusNow = statusFromSnapshot(accountSnapshot, Date.now());
|
|
4057
|
+
// `signed-out` NEVER REACHES THE IDENTITY ROW: the row is what a non-null snapshot MEANS,
|
|
4058
|
+
// and drawing a hollow mark for "signed out" is exactly the cell E-2 refuses to spend.
|
|
4059
|
+
const headerAccount = accountSnapshot === null ? null : {
|
|
4060
|
+
username: accountSnapshot.username,
|
|
4061
|
+
state: headerAccountState(accountStatusNow.state),
|
|
4062
|
+
marks: { on: glyphs.keyOn, off: glyphs.keyOff },
|
|
4063
|
+
};
|
|
4064
|
+
// The panel's shape, without the token: `AccountPanelIdentity` has no field for one.
|
|
4065
|
+
const accountIdentity = accountSnapshot === null ? null : {
|
|
4066
|
+
username: accountSnapshot.username,
|
|
4067
|
+
email: accountSnapshot.email,
|
|
4068
|
+
userId: accountSnapshot.userId,
|
|
4069
|
+
scopes: accountSnapshot.scopes,
|
|
4070
|
+
tokenPrefix: accountSnapshot.tokenPrefix,
|
|
4071
|
+
baseUrl: accountSnapshot.baseUrl,
|
|
4072
|
+
issuedAt: accountSnapshot.issuedAt,
|
|
4073
|
+
expiresAt: accountSnapshot.expiresAt,
|
|
4074
|
+
};
|
|
3882
4075
|
const header = (_jsx(Header, { columns: headerCols,
|
|
3883
4076
|
// THE WORD MARK LIVES ON THE TAB NOW (S2b): the row draws the diamond alone,
|
|
3884
4077
|
// which is also what puts it at cell 0 over the composer's left border.
|
|
3885
|
-
brand: "glyph",
|
|
4078
|
+
brand: "glyph", activityGlyph: native && footerActive ? liveSpinner(reducedMotion, caps) : null,
|
|
3886
4079
|
// DERIVED IN EXACTLY ONE PLACE (0-3 (d)): both overlay slots render
|
|
3887
4080
|
// `overlayNode`, and both read this same three-state value from here.
|
|
3888
4081
|
panel: overlay === null ? 'none' : overlay === 'shortcuts' ? 'shortcuts' : 'other', scrolledLines: scrolledLines, taskSummary: state.taskSummary === null
|
|
3889
4082
|
? null
|
|
3890
|
-
: { text: state.taskSummary.text, tone: state.taskSummary.tone }, summaryEnabled: cfg.taskSummary?.enabled !== false, cwd: controller.getCwd(), provider: cfg.provider, model: cfg.model, hasKey: hasKey, variant: pickHeaderVariant(cols), theme: theme, caps: caps }));
|
|
4083
|
+
: { text: state.taskSummary.text, tone: state.taskSummary.tone }, summaryEnabled: cfg.taskSummary?.enabled !== false, cwd: controller.getCwd(), provider: cfg.provider, model: cfg.model, hasKey: hasKey, variant: pickHeaderVariant(cols), account: headerAccount, theme: theme, caps: caps }));
|
|
3891
4084
|
// The header and the opener are SLOTS OF THE SHELL, not printed bytes (D3/D4): at
|
|
3892
4085
|
// `H = rows - 1` a printed row is pushed off the screen by the very next frame, so
|
|
3893
4086
|
// `printBanner()` was a way of making the banner invisible. Neither is passed here.
|
|
@@ -4033,7 +4226,14 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
4033
4226
|
// THE WAIVER (red-team-security-mode 4.3). Rendered from the reducer's overlay field like
|
|
4034
4227
|
// every other surface, so it cannot be open at the same time as a decision dialog - the
|
|
4035
4228
|
// requests that would have replaced it are queued in `queuedDecisions` instead (D-21).
|
|
4036
|
-
_jsx(RedTeamDisclaimerOverlay, { isActive: !tooSmall, cols: viewCols, maxRows: overlayMaxRows, theme: theme, caps: caps, onAccept: acceptRedTeamWaiver, onDecline: declineRedTeamWaiver })) : overlay === '
|
|
4229
|
+
_jsx(RedTeamDisclaimerOverlay, { isActive: !tooSmall, cols: viewCols, maxRows: overlayMaxRows, theme: theme, caps: caps, onAccept: acceptRedTeamWaiver, onDecline: declineRedTeamWaiver })) : overlay === 'account' ? (
|
|
4230
|
+
// THE BRANCH AND THE `Overlay` MEMBER SHIP TOGETHER (R-11), like `login` below: a
|
|
4231
|
+
// missing branch is not a type error, it is a SILENT BLANK FRAME behind a keyboard
|
|
4232
|
+
// that `active={overlay === null}` has already disabled.
|
|
4233
|
+
//
|
|
4234
|
+
// `onSignIn` is the EXISTING `openLoginPanel`, so the device flow is not re-implemented
|
|
4235
|
+
// here: the code still has to be shown, and `login` is the surface that shows it.
|
|
4236
|
+
_jsx(AccountPanel, { isActive: !tooSmall, cols: viewCols, maxRows: overlayMaxRows, theme: theme, caps: caps, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, identity: accountIdentity, state: accountStatusNow.state, daysLeft: accountStatusNow.daysLeft, accountPath: accountSnapshot === null ? getAccountPath() : accountSnapshot.accountPath, notice: accountNotice, onSignIn: openLoginPanel, onSignOut: handleAccountSignOut, onRefresh: () => { setAccountNotice(null); refreshAccountSnapshot(); }, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'login' ? (
|
|
4037
4237
|
// THE SIGN-IN PANEL (C6). THE BRANCH AND THE `Overlay` MEMBER SHIP TOGETHER (R-11), like
|
|
4038
4238
|
// `agents` and `governance` above: a missing branch is not a type error, it is a SILENT
|
|
4039
4239
|
// BLANK FRAME behind a keyboard that `active={overlay === null}` has already disabled.
|
|
@@ -4044,8 +4244,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
4044
4244
|
_jsx(LoginOverlay, { isActive: !tooSmall, phase: loginView.phase, link: loginView.link, code: loginView.code, elapsedSec: loginView.elapsedSec, ...(loginView.account === null ? {} : { account: loginView.account }), ...(loginView.message === '' ? {} : { message: loginView.message }), maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onStart: () => { void startLoginFlow(); }, onClose: () => dispatch({ type: 'setOverlay', overlay: null }) })) : overlay === 'confirm' && confirmState ? (_jsx(ConfirmDialog, { isActive: !tooSmall, state: confirmState, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onClose: closeConfirm })) : overlay === 'question' && humanRequest?.kind === 'questions' ? (_jsx(QuestionOverlay, { isActive: !tooSmall, questions: humanRequest.questions, maxRows: overlayMaxRows, cols: viewCols, theme: theme, caps: caps, onSubmit: (answers) => resolveHuman({ kind: 'answers', answers, cancelled: false }), ...interviewProps })) : overlay === 'plan' && humanRequest?.kind === 'plan' ? (_jsx(PlanReviewOverlay, { isActive: !tooSmall, plan: humanRequest.plan, maxRows: overlayMaxRows, cols: viewCols, scrollOffset: overlayScroll, onScrollClamp: setOverlayScroll, theme: theme, caps: caps, onVerdict: handlePlanVerdict })) : null;
|
|
4045
4245
|
const density = cfg.density;
|
|
4046
4246
|
const transcriptWindow = cfg.transcriptWindow ?? DEFAULT_TRANSCRIPT_WINDOW;
|
|
4047
|
-
|
|
4048
|
-
const viewReducedMotion = reducedMotion || running || state.runPhase === 'starting' || compactionLive;
|
|
4247
|
+
const viewReducedMotion = reducedMotion || running || footerActive;
|
|
4049
4248
|
// Assigned during render so `/perf` reads the CURRENT frame (see `perfRef`).
|
|
4050
4249
|
// `mountedEntries` is the same number `render-budget.test.tsx` asserts (AC-9).
|
|
4051
4250
|
perfRef.current = {
|
|
@@ -4154,7 +4353,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
4154
4353
|
waitingForConfirmation: !!humanRequest || !!confirmState,
|
|
4155
4354
|
stopping: interruptGesture.current.phase === 'stopping',
|
|
4156
4355
|
interruptPhase: interruptGesture.current.phase,
|
|
4157
|
-
compacting
|
|
4356
|
+
compacting,
|
|
4158
4357
|
mode: state.posture, pendingMode: state.pendingPosture,
|
|
4159
4358
|
servicesActive: { live: liveServices }, ecoRung: governor.rung,
|
|
4160
4359
|
// THE STATUS-DETAIL ROW COUNTS LIKE THE ROSTER AND THE CHIP (A-1): this was the
|
|
@@ -4225,7 +4424,7 @@ export function App({ controller, version, initialOverlay, initialPrompt, confir
|
|
|
4225
4424
|
const rail = fullscreenRailVisible && state.todos ? (_jsx(TodoPanel, { snapshot: state.todos, width: railWidth, rows: railRows, running: running, reducedMotion: viewReducedMotion, theme: theme, caps: caps })) : null;
|
|
4226
4425
|
const viewport = (_jsxs(ScrollViewport, { active: overlay === null && !tooSmall, overlay: overlayNode, footer: _jsxs(_Fragment, { children: [team, _jsx(QueuePanel, { layout: queueLayout, theme: theme })] }), rail: rail, scrollbar: terminal?.scrollbar, resetKey: scrollResetKey, intent: scrollIntent, pinToBottomNonce: pinToBottomNonce, onScrolledLinesChange: setScrolledLines, onViewportShiftChange: onViewportShiftChange, onGeometryChange: onGeometryChange, geometryKey: `${rows}:${cols}:${viewportBudget}:${frameBudget.composerSlotRows}:${frameBudget.statusRows}:${contentCols}:${overlay}:${tooSmall}`, tailRowsRef: tailSink, hold: selectionHold, resumeMs: cfg.scrollResumeMs, showScrollIndicator: true, cols: contentCols, theme: theme, caps: caps, children: [opener, _jsx(TranscriptList, { entries: transcriptEntries, expandedToolIds: state.expandedToolIds, thinkingVisible: state.thinkingVisible, reducedMotion: viewReducedMotion, voice: voice, density: density, nowSec: nowSec, theme: theme, caps: caps, windowSize: transcriptWindow, cols: contentCols, heights: heights, mountedSink: mountedCount, tailSink: tailSink })] }));
|
|
4227
4426
|
const detailsNode = _jsx(BottomStatusRow, { plan: details, columns: viewCols, theme: theme });
|
|
4228
|
-
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), ...(geneChip && geneChip.show ? { gene: geneChip } : {}), ...(redTeam.view.available && redTeam.view.armed
|
|
4427
|
+
const statusNode = (_jsx(StatusBar, { columns: viewCols, speedKnown: speedKnown, ...feedbackProjection, interruptPhase: interruptGesture.current.phase, pendingSteering: state.pendingSteering, runPhase: state.runPhase, activeTool: state.activeTool, ...(wait ? { wait } : {}), runOutcome: state.runOutcome, reducedMotion: native || reducedMotion, ...(sessionId ? { sessionId } : {}), developerMode: state.developerMode, ...(kitChip ? { kit: kitChip } : {}), ...(memoryChip ? { memory: memoryChip } : {}), ...(geneChip && geneChip.show ? { gene: geneChip } : {}), ...(redTeam.view.available && redTeam.view.armed
|
|
4229
4428
|
? { redteam: { armed: redTeam.view.armed, paused: redTeam.view.paused } }
|
|
4230
4429
|
: {}), waitingForConfirmation: !!humanRequest || !!confirmState, stopping: interruptGesture.current.phase === 'stopping', interruptHint: interruptGesture.current.phase === 'stopping'
|
|
4231
4430
|
? 'Esc force-stop' : 'Esc x2 interrupt', model: cfg.model, provider: cfg.provider, usageTotal: state.usageTotal,
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/login` and `/
|
|
2
|
+
* `/login`, `/logout` (C5) and `/account` (tui-account-identity-and-panel A7): the slash commands
|
|
3
|
+
* over the CLI's account layer.
|
|
3
4
|
*
|
|
4
5
|
* WHAT LIVES HERE AND WHY. The command body lives in its own module for the reason
|
|
5
6
|
* `agents-command.ts`, `kit-command.ts` and `queue-command.ts` record: `builtins.ts` is past the
|
|
@@ -25,6 +26,13 @@ import type { AccountStatus } from '../account/session.js';
|
|
|
25
26
|
export declare const LOGIN_DESCRIPTION = "Sign in with your aragonagent.com account (20 days); no args shows status";
|
|
26
27
|
/** C5, verbatim. */
|
|
27
28
|
export declare const LOGOUT_DESCRIPTION = "Sign out and delete the local account credential";
|
|
29
|
+
/**
|
|
30
|
+
* `/account` (tui-account-identity-and-panel A7). THE SAME BYTES live in
|
|
31
|
+
* `commands/catalog.ts` and in `docs/guide-doc/src/content/data/slash-commands.mjs`, and the
|
|
32
|
+
* guide's gate compares them character for character - a reworded copy is a red build, which
|
|
33
|
+
* is the only thing that keeps three surfaces honest.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ACCOUNT_DESCRIPTION = "Open the account panel: who is signed in, the token expiry, sign in or sign out";
|
|
28
36
|
/** What `/logout` did. `ok: false` means the credential file is still there. */
|
|
29
37
|
export interface AccountSignOutResult {
|
|
30
38
|
readonly ok: boolean;
|
|
@@ -32,11 +40,11 @@ export interface AccountSignOutResult {
|
|
|
32
40
|
readonly hadCredential: boolean;
|
|
33
41
|
}
|
|
34
42
|
/**
|
|
35
|
-
* The App's side of the feature: read the credential, open the
|
|
43
|
+
* The App's side of the feature: read the credential, open the two panels, delete the credential.
|
|
36
44
|
*
|
|
37
|
-
*
|
|
38
|
-
*
|
|
39
|
-
*
|
|
45
|
+
* ONE METHOD PER USER INTENTION, because the command has to report each one truthfully: `status`
|
|
46
|
+
* is a read, `openLogin` starts a device flow the App owns (so `/login` returns before the person
|
|
47
|
+
* has touched their phone), `openAccount` opens the read-and-manage panel, and `signOut` must be
|
|
40
48
|
* able to answer "nothing to delete" as well as "still there, the filesystem refused".
|
|
41
49
|
*/
|
|
42
50
|
export interface AccountCommandPort {
|
|
@@ -46,6 +54,8 @@ export interface AccountCommandPort {
|
|
|
46
54
|
accountPath(): string;
|
|
47
55
|
/** Open the four-phase panel and run `startLogin` in the background (C6). */
|
|
48
56
|
openLogin(): void;
|
|
57
|
+
/** Open the account panel - the same overlay `Ctrl+X` / `Alt+X` opens. */
|
|
58
|
+
openAccount(): void;
|
|
49
59
|
signOut(): AccountSignOutResult;
|
|
50
60
|
}
|
|
51
61
|
/**
|
|
@@ -82,5 +92,5 @@ export declare function accountStatusLines(status: AccountStatus, accountPath: s
|
|
|
82
92
|
* (a ref guard there) and lets this be asserted without mounting a terminal.
|
|
83
93
|
*/
|
|
84
94
|
export declare function startupAccountNotice(status: AccountStatus): string | null;
|
|
85
|
-
/** Register
|
|
95
|
+
/** Register all three commands. Unconditional, so they can always explain a missing port. */
|
|
86
96
|
export declare function registerAccountCommands(registry: CommandRegistry): void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* `/login` and `/
|
|
2
|
+
* `/login`, `/logout` (C5) and `/account` (tui-account-identity-and-panel A7): the slash commands
|
|
3
|
+
* over the CLI's account layer.
|
|
3
4
|
*
|
|
4
5
|
* WHAT LIVES HERE AND WHY. The command body lives in its own module for the reason
|
|
5
6
|
* `agents-command.ts`, `kit-command.ts` and `queue-command.ts` record: `builtins.ts` is past the
|
|
@@ -24,6 +25,13 @@ import { describeExpiry, describeStartupNotice, formatIsoDate } from '../account
|
|
|
24
25
|
export const LOGIN_DESCRIPTION = 'Sign in with your aragonagent.com account (20 days); no args shows status';
|
|
25
26
|
/** C5, verbatim. */
|
|
26
27
|
export const LOGOUT_DESCRIPTION = 'Sign out and delete the local account credential';
|
|
28
|
+
/**
|
|
29
|
+
* `/account` (tui-account-identity-and-panel A7). THE SAME BYTES live in
|
|
30
|
+
* `commands/catalog.ts` and in `docs/guide-doc/src/content/data/slash-commands.mjs`, and the
|
|
31
|
+
* guide's gate compares them character for character - a reworded copy is a red build, which
|
|
32
|
+
* is the only thing that keeps three surfaces honest.
|
|
33
|
+
*/
|
|
34
|
+
export const ACCOUNT_DESCRIPTION = 'Open the account panel: who is signed in, the token expiry, sign in or sign out';
|
|
27
35
|
/**
|
|
28
36
|
* Said when the build has no account port. NAMING WHAT DID NOT HAPPEN IS THE POINT: a user who
|
|
29
37
|
* reads "sign-in is not available" must not wonder whether a request went out or a file was
|
|
@@ -150,7 +158,23 @@ function runLogout(ctx) {
|
|
|
150
158
|
ctx.notify('info', `Signed out. Deleted ${port.accountPath()}.`);
|
|
151
159
|
ctx.toast('success', 'Signed out.');
|
|
152
160
|
}
|
|
153
|
-
/**
|
|
161
|
+
/**
|
|
162
|
+
* `/account` (tui-account-identity-and-panel A7).
|
|
163
|
+
*
|
|
164
|
+
* THE THIRD ROUTE TO THE PANEL, and the only one that survives a terminal which swallows both
|
|
165
|
+
* `Ctrl+X` and `Alt+X` - the same reason `/memory` and `/gene` exist beside their keys. It
|
|
166
|
+
* prints the ONE sentence `describeExpiry` owns and then opens the panel: the panel is where
|
|
167
|
+
* the facts and the two actions live, and printing every field twice would give the same
|
|
168
|
+
* numbers two places to be wrong.
|
|
169
|
+
*/
|
|
170
|
+
function runAccount(ctx) {
|
|
171
|
+
const port = resolvePort(ctx);
|
|
172
|
+
if (port === null)
|
|
173
|
+
return;
|
|
174
|
+
ctx.notify('info', describeExpiry(port.status()));
|
|
175
|
+
port.openAccount();
|
|
176
|
+
}
|
|
177
|
+
/** Register all three commands. Unconditional, so they can always explain a missing port. */
|
|
154
178
|
export function registerAccountCommands(registry) {
|
|
155
179
|
registry.register({
|
|
156
180
|
name: 'login',
|
|
@@ -162,4 +186,9 @@ export function registerAccountCommands(registry) {
|
|
|
162
186
|
description: LOGOUT_DESCRIPTION,
|
|
163
187
|
run: runLogout,
|
|
164
188
|
});
|
|
189
|
+
registry.register({
|
|
190
|
+
name: 'account',
|
|
191
|
+
description: ACCOUNT_DESCRIPTION,
|
|
192
|
+
run: runAccount,
|
|
193
|
+
});
|
|
165
194
|
}
|
|
@@ -1388,6 +1388,10 @@ export const BUILTIN_COMMAND_NAMES = ['queue', 'prompts', 'agents', 'subagent',
|
|
|
1388
1388
|
// `commands/account-command.ts`, so the `flatMap` below never sees them, and this array is the
|
|
1389
1389
|
// documentation/tests surface for every built-in name (C5 requires both, verbatim).
|
|
1390
1390
|
'login', 'logout',
|
|
1391
|
+
// `account` joins them for the same reason (tui-account-identity-and-panel A7): its body lives
|
|
1392
|
+
// in `commands/account-command.ts`, so this array is the only documentation surface that sees
|
|
1393
|
+
// it, and `command-catalog.test.ts` compares the catalog against the live registry.
|
|
1394
|
+
'account',
|
|
1391
1395
|
...COMMANDS.flatMap((c) => [
|
|
1392
1396
|
c.name,
|
|
1393
1397
|
...(c.aliases ?? []),
|
package/dist/commands/catalog.js
CHANGED
|
@@ -75,4 +75,12 @@ export const BUILTIN_COMMAND_CATALOG = [
|
|
|
75
75
|
aliases: [],
|
|
76
76
|
description: 'Sign out and delete the local account credential',
|
|
77
77
|
},
|
|
78
|
+
// `/account` (tui-account-identity-and-panel A7): the third route to the panel, for the
|
|
79
|
+
// terminals where Ctrl+X and Alt+X both get swallowed. Retyped here for the reason the two
|
|
80
|
+
// rows above record - `command-catalog.test.ts` is what keeps these bytes equal.
|
|
81
|
+
{
|
|
82
|
+
name: 'account',
|
|
83
|
+
aliases: [],
|
|
84
|
+
description: 'Open the account panel: who is signed in, the token expiry, sign in or sign out',
|
|
85
|
+
},
|
|
78
86
|
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aragon-agent/cli",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.73",
|
|
4
4
|
"description": "AragonAgent CLI — a Claude-Code / Codex-style interactive terminal UI (TUI) on top of the @aragon-agent/core engine. Installable and runnable via npm / npx.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "AragonAgent contributors",
|
|
@@ -58,8 +58,8 @@
|
|
|
58
58
|
"prepublishOnly": "npm run build"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@aragon-agent/core": "^0.2.
|
|
62
|
-
"@aragon-agent/tui": "0.0.
|
|
61
|
+
"@aragon-agent/core": "^0.2.85",
|
|
62
|
+
"@aragon-agent/tui": "0.0.26",
|
|
63
63
|
"commander": "^12.1.0",
|
|
64
64
|
"dotenv": "^16.6.1",
|
|
65
65
|
"env-paths": "^3.0.0",
|