pantheon-opencode 1.6.3-beta.11 → 1.6.3-beta.12
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 +15 -6
- package/package.json +1 -1
- package/plugin.json +1 -1
- package/pyproject.toml +1 -1
- package/src/pantheon/jev-decision-tool.ts +60 -11
- package/src/pantheon/jev-decisions.ts +68 -5
- package/src/pantheon/jev-quality-score.ts +1 -1
- package/src/pantheon/jev-rank-verify.ts +22 -7
- package/src/pantheon/local-decision-router.ts +10 -0
- package/src/pantheon/pantheon-decision-catalog.ts +1 -1
- package/src/plugins/tui/dist/tui-v2.js +125 -22
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/whats-new-highlights.ts +59 -5
- package/src/plugins/tui/src/whats-new-open.ts +41 -1
- package/src/plugins/tui/src/whats-new.tsx +61 -8
package/CHANGELOG.md
CHANGED
|
@@ -10,14 +10,23 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
10
10
|
<!-- Add new changes here. Running `node scripts/versioning.mjs apply` will
|
|
11
11
|
move this section to a versioned entry and reset the template below. -->
|
|
12
12
|
|
|
13
|
-
## [v1.6.3-beta.
|
|
13
|
+
## [v1.6.3-beta.12] - 2026-11-05
|
|
14
14
|
|
|
15
15
|
## 🆕 What's New
|
|
16
|
-
-
|
|
17
|
-
- The
|
|
18
|
-
-
|
|
19
|
-
-
|
|
20
|
-
-
|
|
16
|
+
- Delegation answers are domain-aware again: agent descriptions ride with every choice — live probe 5/5 exact (FastAPI→hermes, WCAG→aphrodite, Alembic→demeter, security→themis, poem→none).
|
|
17
|
+
- The input envelope is enforced on EVERY path now: presets, review, rank and verify all refuse missing/unknown keys with the exact cause.
|
|
18
|
+
- Rank accepts up to 20 candidates (typesafe_rank contract) and names the accepted range on refusal.
|
|
19
|
+
- Skills results report where the candidates came from (`candidateSource`), ending silent prefilter misses.
|
|
20
|
+
- The local router respects open gates: review/approval required → abstain (`GATE_OPEN`), never route around.
|
|
21
|
+
|
|
22
|
+
## [v1.6.3-beta.11] - 2026-11-05
|
|
23
|
+
|
|
24
|
+
### 🆕 What's New
|
|
25
|
+
- Measured MCP usage policy across the roster — governance ladder byte-identical in all 13 specialists.
|
|
26
|
+
- Skill-discovery pipeline with the trust cascade: Anthropic catalog → skills.sh → GitHub; Jev ranks, you install.
|
|
27
|
+
- Dead-route holds release (ledger schema v4) — the fix for budgets frozen by removed routes.
|
|
28
|
+
- Roster reform: nyx re-scoped to chaos & adversarial, talos aligned to hotfix, domain docs per agent.
|
|
29
|
+
- Jev validated end to end in the field: N4 dead, verify field-verified, sandbox 28/28.
|
|
21
30
|
|
|
22
31
|
### Added
|
|
23
32
|
|
package/package.json
CHANGED
package/plugin.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon",
|
|
3
3
|
"publisher": "ils15",
|
|
4
|
-
"version": "1.6.3-beta.
|
|
4
|
+
"version": "1.6.3-beta.12",
|
|
5
5
|
"displayName": "Pantheon",
|
|
6
6
|
"description": "Conductor-Delegate orchestration platform with 14 specialized agents, 20 skills, and OpenCode support.",
|
|
7
7
|
"agents": "./src/agents",
|
package/pyproject.toml
CHANGED
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.backends._legacy:_Backend"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "pantheon"
|
|
7
|
-
version = "1.6.3-beta.
|
|
7
|
+
version = "1.6.3-beta.12"
|
|
8
8
|
description = "Multi-agent orchestration framework"
|
|
9
9
|
requires-python = ">=3.11"
|
|
10
10
|
# Python sources under src/mcp/ import fastmcp/pydantic at runtime, but those
|
|
@@ -24,8 +24,11 @@
|
|
|
24
24
|
*/
|
|
25
25
|
import { readUserDecisionRouterConfig } from '../../scripts/install/decision-router-config.mjs'
|
|
26
26
|
import {
|
|
27
|
+
checkJevEnvelope,
|
|
27
28
|
consumeJevDecisionResult,
|
|
28
29
|
isJevDecisionPreset,
|
|
30
|
+
JEV_EXPLICIT_ENVELOPE_KEYS,
|
|
31
|
+
JEV_PRESET_ENVELOPE_KEYS,
|
|
29
32
|
type JevDecisionPreparation,
|
|
30
33
|
type JevHostSkill,
|
|
31
34
|
type NativeJevRouteFailure,
|
|
@@ -41,12 +44,15 @@ import {
|
|
|
41
44
|
J4_QUALITY_SCORE_POINT,
|
|
42
45
|
type QualityScoreEvaluation,
|
|
43
46
|
qualityVerdict,
|
|
47
|
+
REVIEW_ENVELOPE_KEYS,
|
|
44
48
|
} from './jev-quality-score.ts'
|
|
45
49
|
import {
|
|
46
50
|
buildJevRankRequest,
|
|
47
51
|
buildJevVerifyRequest,
|
|
48
52
|
consumeJevRankResult,
|
|
49
53
|
consumeJevVerifyResult,
|
|
54
|
+
RANK_ENVELOPE_KEYS,
|
|
55
|
+
VERIFY_ENVELOPE_KEYS,
|
|
50
56
|
} from './jev-rank-verify.ts'
|
|
51
57
|
import { mapGateFailureToSkipReason } from './jev-risk-gate.ts'
|
|
52
58
|
import {
|
|
@@ -152,8 +158,12 @@ interface JevToolContext {
|
|
|
152
158
|
agent?: unknown
|
|
153
159
|
}
|
|
154
160
|
|
|
155
|
-
function refusal(reasonCode: JevDecisionRunFailure): string {
|
|
156
|
-
return JSON.stringify(
|
|
161
|
+
function refusal(reasonCode: JevDecisionRunFailure, detail?: string): string {
|
|
162
|
+
return JSON.stringify(
|
|
163
|
+
detail === undefined
|
|
164
|
+
? { advisory: false, effect: 'none', reasonCode }
|
|
165
|
+
: { advisory: false, effect: 'none', reasonCode, detail },
|
|
166
|
+
)
|
|
157
167
|
}
|
|
158
168
|
|
|
159
169
|
function isNonBlankString(value: unknown): value is string {
|
|
@@ -453,12 +463,46 @@ export async function runJevDecision(
|
|
|
453
463
|
if (caller !== 'zeus' && requested.mode !== undefined) {
|
|
454
464
|
return refusal('CALLER_NOT_ALLOWED')
|
|
455
465
|
}
|
|
466
|
+
// The ONE envelope gate every path passes through before its builder:
|
|
467
|
+
// schemaVersion required, unknown keys rejected — explicit questions,
|
|
468
|
+
// presets, review, rank and verify alike (beta.10 claimed this contract;
|
|
469
|
+
// beta.12 applies it uniformly). Builders keep their semantic checks.
|
|
470
|
+
const envelopeKeys =
|
|
471
|
+
requested.mode === undefined
|
|
472
|
+
? JEV_EXPLICIT_ENVELOPE_KEYS
|
|
473
|
+
: requested.mode === 'review'
|
|
474
|
+
? REVIEW_ENVELOPE_KEYS
|
|
475
|
+
: requested.mode === 'rank'
|
|
476
|
+
? RANK_ENVELOPE_KEYS
|
|
477
|
+
: requested.mode === 'verify'
|
|
478
|
+
? VERIFY_ENVELOPE_KEYS
|
|
479
|
+
: isJevDecisionPreset(requested.mode)
|
|
480
|
+
? JEV_PRESET_ENVELOPE_KEYS
|
|
481
|
+
: undefined
|
|
482
|
+
if (envelopeKeys !== undefined) {
|
|
483
|
+
const envelope = checkJevEnvelope(input, envelopeKeys)
|
|
484
|
+
if (!envelope.ok) {
|
|
485
|
+
const reasonCode: JevDecisionRunFailure =
|
|
486
|
+
requested.mode === undefined
|
|
487
|
+
? 'QUESTIONS_INVALID'
|
|
488
|
+
: requested.mode === 'review'
|
|
489
|
+
? 'REVIEW_INPUT_INVALID'
|
|
490
|
+
: requested.mode === 'rank'
|
|
491
|
+
? 'RANK_INPUT_INVALID'
|
|
492
|
+
: requested.mode === 'verify'
|
|
493
|
+
? 'VERIFY_INPUT_INVALID'
|
|
494
|
+
: 'PRESET_INVALID'
|
|
495
|
+
return refusal(reasonCode, envelope.detail)
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
|
|
456
499
|
// Review mode (J4): the bounded request is built before any gate work, and
|
|
457
500
|
// an invalid review input is a tool-surface refusal — same class as the
|
|
458
501
|
// caller check, never a gate failure. The v3.1 rank and verify modes follow
|
|
459
502
|
// the same prebuilt-request pattern (no gate work for a malformed input);
|
|
460
503
|
// neither has a telemetry point — they are tool modes, not shadow gates.
|
|
461
504
|
let prebuilt: Omit<NativeDecisionRequest, 'model'> | undefined
|
|
505
|
+
let candidateSource: JevDecisionPreparation['candidateSource'] | undefined
|
|
462
506
|
if (requested.mode === 'review') {
|
|
463
507
|
const prepared = buildJevReviewRequest(input ?? {})
|
|
464
508
|
if (!prepared.ok) {
|
|
@@ -476,7 +520,7 @@ export async function runJevDecision(
|
|
|
476
520
|
prebuilt = prepared.request
|
|
477
521
|
} else if (requested.mode === 'rank') {
|
|
478
522
|
const prepared = buildJevRankRequest(input ?? {})
|
|
479
|
-
if (!prepared.ok) return refusal(prepared.reasonCode)
|
|
523
|
+
if (!prepared.ok) return refusal(prepared.reasonCode, prepared.detail)
|
|
480
524
|
prebuilt = prepared.request
|
|
481
525
|
} else if (requested.mode === 'verify') {
|
|
482
526
|
const prepared = buildJevVerifyRequest(input ?? {})
|
|
@@ -501,12 +545,16 @@ export async function runJevDecision(
|
|
|
501
545
|
: requested.mode === undefined
|
|
502
546
|
? prepareJevDecisionRequest(route, input ?? {})
|
|
503
547
|
: isJevDecisionPreset(requested.mode)
|
|
504
|
-
?
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
548
|
+
? (async () => {
|
|
549
|
+
const prepared = prepareJevPresetRequest(
|
|
550
|
+
route,
|
|
551
|
+
requested.mode,
|
|
552
|
+
input ?? {},
|
|
553
|
+
requested.mode === 'skills' ? await readHostSkills(runtime) : undefined,
|
|
554
|
+
)
|
|
555
|
+
if (prepared.ok) candidateSource = prepared.candidateSource
|
|
556
|
+
return prepared
|
|
557
|
+
})()
|
|
510
558
|
: { ok: false as const, reasonCode: 'PRESET_INVALID' as const },
|
|
511
559
|
})
|
|
512
560
|
if (!result.ok) {
|
|
@@ -639,6 +687,7 @@ export async function runJevDecision(
|
|
|
639
687
|
billing: result.call.selection.route.billing,
|
|
640
688
|
},
|
|
641
689
|
...(requested.mode === undefined ? {} : { preset: requested.mode }),
|
|
690
|
+
...(candidateSource === undefined ? {} : { candidateSource }),
|
|
642
691
|
answers: advice.answers,
|
|
643
692
|
missing: advice.missing,
|
|
644
693
|
usage: { costUsd: advice.costUsd, tokens: advice.tokens },
|
|
@@ -654,7 +703,7 @@ const TOOL_DESCRIPTION =
|
|
|
654
703
|
'host), `mode: "delegation"` to pick ' +
|
|
655
704
|
'a specialist, `mode: "review"` to score a finished delegated result against named criteria ' +
|
|
656
705
|
'(advisory quality score + needs-review flag; the result content itself is never sent — ' +
|
|
657
|
-
'shape metrics and criteria only), `mode: "rank"` to pick the best of 2-
|
|
706
|
+
'shape metrics and criteria only), `mode: "rank"` to pick the best of 2-20 named candidates ' +
|
|
658
707
|
'(returns the winner and its fit score; no full ordering), `mode: "verify"` to check 1-4 ' +
|
|
659
708
|
'named claims (PASS/FAIL per claim; any refusal, timeout or malformed answer is BLOCK, ' +
|
|
660
709
|
'fail-closed), or pass explicit typed `questions` (choice, score, ' +
|
|
@@ -784,7 +833,7 @@ const JEV_INPUT_SCHEMA: Record<string, unknown> = {
|
|
|
784
833
|
candidates: {
|
|
785
834
|
type: 'array',
|
|
786
835
|
minItems: 2,
|
|
787
|
-
maxItems:
|
|
836
|
+
maxItems: 20,
|
|
788
837
|
items: RANK_CANDIDATE_SCHEMA,
|
|
789
838
|
},
|
|
790
839
|
claims: {
|
|
@@ -224,14 +224,59 @@ export type JevDecisionPreparationDetail =
|
|
|
224
224
|
| 'SCHEMA_VERSION_INVALID'
|
|
225
225
|
| 'UNKNOWN_INPUT_KEYS'
|
|
226
226
|
|
|
227
|
+
export type JevSkillCandidateSource = 'prefilter' | 'full-catalog' | 'host-skills'
|
|
228
|
+
|
|
227
229
|
export type JevDecisionPreparation =
|
|
228
|
-
| {
|
|
230
|
+
| {
|
|
231
|
+
readonly ok: true
|
|
232
|
+
readonly request: NativeDecisionRequest
|
|
233
|
+
/** Skills mode only: which path produced the candidate pool. */
|
|
234
|
+
readonly candidateSource?: JevSkillCandidateSource
|
|
235
|
+
}
|
|
229
236
|
| {
|
|
230
237
|
readonly ok: false
|
|
231
238
|
readonly reasonCode: JevDecisionPreparationFailure
|
|
232
239
|
readonly detail?: JevDecisionPreparationDetail
|
|
233
240
|
}
|
|
234
241
|
|
|
242
|
+
/**
|
|
243
|
+
* The ONE envelope check every tool path passes through before its builder:
|
|
244
|
+
* `schemaVersion` is required (and must be 1) and unknown keys are rejected —
|
|
245
|
+
* the declared contract, now enforced uniformly (beta.10 claimed it; beta.12
|
|
246
|
+
* applies it to presets, review, rank and verify too).
|
|
247
|
+
*/
|
|
248
|
+
export type JevEnvelopeCheck = { ok: true } | { ok: false; detail: JevDecisionPreparationDetail }
|
|
249
|
+
|
|
250
|
+
export function checkJevEnvelope(
|
|
251
|
+
input: unknown,
|
|
252
|
+
allowedKeys: ReadonlySet<string>,
|
|
253
|
+
): JevEnvelopeCheck {
|
|
254
|
+
if (
|
|
255
|
+
input === null ||
|
|
256
|
+
typeof input !== 'object' ||
|
|
257
|
+
Array.isArray(input) ||
|
|
258
|
+
(input as Record<string, unknown>).schemaVersion !== 1
|
|
259
|
+
) {
|
|
260
|
+
return { ok: false, detail: 'SCHEMA_VERSION_INVALID' }
|
|
261
|
+
}
|
|
262
|
+
const unknown = Object.keys(input as Record<string, unknown>).filter(
|
|
263
|
+
(key) => !allowedKeys.has(key),
|
|
264
|
+
)
|
|
265
|
+
if (unknown.length > 0) return { ok: false, detail: 'UNKNOWN_INPUT_KEYS' }
|
|
266
|
+
return { ok: true }
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
export const JEV_EXPLICIT_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
270
|
+
'schemaVersion',
|
|
271
|
+
'state',
|
|
272
|
+
'questions',
|
|
273
|
+
])
|
|
274
|
+
export const JEV_PRESET_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
275
|
+
'schemaVersion',
|
|
276
|
+
'mode',
|
|
277
|
+
'state',
|
|
278
|
+
])
|
|
279
|
+
|
|
235
280
|
function isBoundedNonBlankString(value: unknown, max: number): value is string {
|
|
236
281
|
return typeof value === 'string' && value.trim().length > 0 && value.length <= max
|
|
237
282
|
}
|
|
@@ -420,12 +465,21 @@ export function isJevDecisionPreset(value: unknown): value is JevDecisionPreset
|
|
|
420
465
|
}
|
|
421
466
|
|
|
422
467
|
/** Every canonical specialist except the orchestrator itself. */
|
|
423
|
-
const SPECIALIST_CHOICES: ReadonlyArray<{ value: string }> = Object.freeze(
|
|
468
|
+
const SPECIALIST_CHOICES: ReadonlyArray<{ value: string; description?: string }> = Object.freeze(
|
|
424
469
|
PANTHEON_AGENT_CATALOG.filter((agent) => agent.id !== 'zeus').map((agent) => ({
|
|
425
470
|
value: agent.id,
|
|
471
|
+
description: boundedCatalogDescription(agent.description),
|
|
426
472
|
})),
|
|
427
473
|
)
|
|
428
474
|
|
|
475
|
+
/** Catalog descriptions are short; truncate defensively at the documented bound. */
|
|
476
|
+
function boundedCatalogDescription(value: unknown): string | undefined {
|
|
477
|
+
if (typeof value !== 'string' || value.trim() === '') return undefined
|
|
478
|
+
return value.length > JEV_DECISION_MAX_DESCRIPTION_LENGTH
|
|
479
|
+
? `${value.slice(0, JEV_DECISION_MAX_DESCRIPTION_LENGTH - 1)}…`
|
|
480
|
+
: value
|
|
481
|
+
}
|
|
482
|
+
|
|
429
483
|
const SKILL_DESCRIPTIONS = new Map(
|
|
430
484
|
PANTHEON_SKILL_CATALOG.map((entry) => [entry.id, entry.description]),
|
|
431
485
|
)
|
|
@@ -521,7 +575,10 @@ export function prepareJevPresetRequest(
|
|
|
521
575
|
instructions:
|
|
522
576
|
'Choose one listed specialist only when the described task clearly needs it; ' +
|
|
523
577
|
'otherwise choose none. This is advisory only; nothing is dispatched.',
|
|
524
|
-
choices: [
|
|
578
|
+
choices: [
|
|
579
|
+
...SPECIALIST_CHOICES,
|
|
580
|
+
{ value: 'none', description: 'No specialist fits the described task.' },
|
|
581
|
+
],
|
|
525
582
|
},
|
|
526
583
|
],
|
|
527
584
|
} satisfies NativeDecisionRequest
|
|
@@ -529,6 +586,9 @@ export function prepareJevPresetRequest(
|
|
|
529
586
|
}
|
|
530
587
|
|
|
531
588
|
const shortlist = selectPantheonSkills(state).skillIds
|
|
589
|
+
const hostHasSkills = Array.isArray(hostSkills) && hostSkills.length > 0
|
|
590
|
+
const candidateSource: JevSkillCandidateSource =
|
|
591
|
+
shortlist.length > 0 ? 'prefilter' : hostHasSkills ? 'host-skills' : 'full-catalog'
|
|
532
592
|
const pool = shortlist.length > 0 ? shortlist : CATALOG_SKILL_IDS
|
|
533
593
|
const descriptions = new Map(PANTHEON_SKILL_CATALOG.map((entry) => [entry.id, entry.description]))
|
|
534
594
|
const request = {
|
|
@@ -541,11 +601,14 @@ export function prepareJevPresetRequest(
|
|
|
541
601
|
instructions:
|
|
542
602
|
'Choose the skills worth stacking for the described task, or none when none apply. ' +
|
|
543
603
|
'This is advisory only; nothing is loaded or executed by this decision.',
|
|
544
|
-
choices: [
|
|
604
|
+
choices: [
|
|
605
|
+
...mergeHostSkills(pool, hostSkills, descriptions),
|
|
606
|
+
{ value: 'none', description: 'No skill stack fits the described task.' },
|
|
607
|
+
],
|
|
545
608
|
},
|
|
546
609
|
],
|
|
547
610
|
} satisfies NativeDecisionRequest
|
|
548
|
-
return { ok: true, request: Object.freeze(request) }
|
|
611
|
+
return { ok: true, request: Object.freeze(request), candidateSource }
|
|
549
612
|
}
|
|
550
613
|
// ─── Response consumption ───────────────────────────────────────────────
|
|
551
614
|
|
|
@@ -356,7 +356,7 @@ export function encodeQualityScoreReason(input: {
|
|
|
356
356
|
* ANY other key — `state`, `questions`, or a smuggled content field — refuses
|
|
357
357
|
* the preparation, so no content slot exists even at the input boundary.
|
|
358
358
|
*/
|
|
359
|
-
const REVIEW_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
359
|
+
export const REVIEW_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
360
360
|
'schemaVersion',
|
|
361
361
|
'mode',
|
|
362
362
|
'delegateId',
|
|
@@ -54,8 +54,8 @@ import { NATIVE_DECISION_MAX_PROMPT_LENGTH } from './v2-native-decisions.ts'
|
|
|
54
54
|
|
|
55
55
|
/** A ranking needs at least two candidates to choose between. */
|
|
56
56
|
export const RANK_MIN_CANDIDATES = 2
|
|
57
|
-
/**
|
|
58
|
-
export const RANK_MAX_CANDIDATES =
|
|
57
|
+
/** Mirrors the typesafe_rank reference contract (1-20 accepted upstream). */
|
|
58
|
+
export const RANK_MAX_CANDIDATES = 20
|
|
59
59
|
|
|
60
60
|
/** Question name of the rank's choice question. */
|
|
61
61
|
export const RANK_WINNER_QUESTION_NAME = 'winner'
|
|
@@ -164,7 +164,7 @@ function isRecord(value: unknown): value is Record<string, unknown> {
|
|
|
164
164
|
|
|
165
165
|
// ─── Rank: request building ──────────────────────────────────────────────
|
|
166
166
|
|
|
167
|
-
const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
167
|
+
export const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
168
168
|
'schemaVersion',
|
|
169
169
|
'mode',
|
|
170
170
|
'state',
|
|
@@ -173,13 +173,24 @@ const RANK_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
|
173
173
|
|
|
174
174
|
export type JevRankBuildFailure = 'RANK_INPUT_INVALID' | 'CANDIDATE_INVALID' | 'STATE_INVALID'
|
|
175
175
|
|
|
176
|
+
/** Per-cause token attached to a rank build refusal (e.g. the accepted count range). */
|
|
177
|
+
export type JevRankBuildDetail = 'RANK_CANDIDATE_COUNT_RANGE'
|
|
178
|
+
|
|
176
179
|
export type JevRankBuild =
|
|
177
180
|
| { readonly ok: true; readonly request: Omit<NativeDecisionRequest, 'model'> }
|
|
178
|
-
| {
|
|
181
|
+
| {
|
|
182
|
+
readonly ok: false
|
|
183
|
+
readonly reasonCode: JevRankBuildFailure
|
|
184
|
+
readonly detail?: JevRankBuildDetail
|
|
185
|
+
}
|
|
179
186
|
|
|
180
187
|
export type JevRankPreparation =
|
|
181
188
|
| { readonly ok: true; readonly request: NativeDecisionRequest }
|
|
182
|
-
| {
|
|
189
|
+
| {
|
|
190
|
+
readonly ok: false
|
|
191
|
+
readonly reasonCode: JevRankBuildFailure
|
|
192
|
+
readonly detail?: JevRankBuildDetail
|
|
193
|
+
}
|
|
183
194
|
|
|
184
195
|
/**
|
|
185
196
|
* Validate the rank tool input and build the model-less request. The state is
|
|
@@ -205,7 +216,7 @@ export function buildJevRankRequest(input: unknown): JevRankBuild {
|
|
|
205
216
|
if (rawCandidates === undefined) return { ok: false, reasonCode: 'RANK_INPUT_INVALID' }
|
|
206
217
|
if (!Array.isArray(rawCandidates)) return { ok: false, reasonCode: 'CANDIDATE_INVALID' }
|
|
207
218
|
if (rawCandidates.length < RANK_MIN_CANDIDATES || rawCandidates.length > RANK_MAX_CANDIDATES) {
|
|
208
|
-
return { ok: false, reasonCode: 'CANDIDATE_INVALID' }
|
|
219
|
+
return { ok: false, reasonCode: 'CANDIDATE_INVALID', detail: 'RANK_CANDIDATE_COUNT_RANGE' }
|
|
209
220
|
}
|
|
210
221
|
const seen = new Set<string>()
|
|
211
222
|
const choices: Array<{ value: string; description?: string }> = []
|
|
@@ -274,7 +285,11 @@ export function prepareJevRankRequest(
|
|
|
274
285
|
|
|
275
286
|
// ─── Verify: request building ────────────────────────────────────────────
|
|
276
287
|
|
|
277
|
-
const VERIFY_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
288
|
+
export const VERIFY_ENVELOPE_KEYS: ReadonlySet<string> = new Set([
|
|
289
|
+
'schemaVersion',
|
|
290
|
+
'mode',
|
|
291
|
+
'claims',
|
|
292
|
+
])
|
|
278
293
|
|
|
279
294
|
export type JevVerifyBuildFailure = 'VERIFY_INPUT_INVALID' | 'CLAIM_INVALID'
|
|
280
295
|
|
|
@@ -32,6 +32,7 @@ export interface LocalDecisionInput {
|
|
|
32
32
|
|
|
33
33
|
export type LocalDecisionRouteReasonCode =
|
|
34
34
|
| 'DISABLED'
|
|
35
|
+
| 'GATE_OPEN'
|
|
35
36
|
| 'INVALID_INPUT'
|
|
36
37
|
| 'NO_DOMAIN'
|
|
37
38
|
| 'AMBIGUOUS_DOMAIN'
|
|
@@ -192,6 +193,15 @@ function evaluateEnabledInput(input: unknown): LocalDecisionRecommendation {
|
|
|
192
193
|
}
|
|
193
194
|
}
|
|
194
195
|
|
|
196
|
+
// D1 (field report beta.11→12): gateStatus must influence the output. An
|
|
197
|
+
// open review/approval gate abstains — the advisory never routes around a
|
|
198
|
+
// gate; resolving the gate is the caller's move, then this router answers.
|
|
199
|
+
if (gateStatus === 'review_required' || gateStatus === 'human_approval_required') {
|
|
200
|
+
return {
|
|
201
|
+
...createAbstention('GATE_OPEN', complexity.reasonCode, gateStatus),
|
|
202
|
+
complexity,
|
|
203
|
+
}
|
|
204
|
+
}
|
|
195
205
|
return {
|
|
196
206
|
schemaVersion: 1,
|
|
197
207
|
policyVersion: LOCAL_DECISION_ROUTER_POLICY_VERSION,
|
|
@@ -53,7 +53,7 @@ export const PANTHEON_AGENT_CATALOG: readonly DecisionCatalogEntry[] = Object.fr
|
|
|
53
53
|
{ id: 'themis', description: 'Quality and security review gate.' },
|
|
54
54
|
{ id: 'prometheus', description: 'Infrastructure, Docker, CI, and model providers.' },
|
|
55
55
|
{ id: 'hephaestus', description: 'AI pipelines: LangChain, RAG, vector stores.' },
|
|
56
|
-
{ id: 'nyx', description: '
|
|
56
|
+
{ id: 'nyx', description: 'Chaos and adversarial testing: fuzzing, hostile inputs, boundaries.' },
|
|
57
57
|
{ id: 'gaia', description: 'Remote sensing and geospatial analysis.' },
|
|
58
58
|
{ id: 'iris', description: 'GitHub branches, pull requests, issues, releases.' },
|
|
59
59
|
{ id: 'mnemosyne', description: 'Memory bank and ADR authoring on request.' },
|
|
@@ -234,14 +234,50 @@ function stripHeading(text) {
|
|
|
234
234
|
return text.replace(/^#{1,6}[ \t]+/, "").trim();
|
|
235
235
|
}
|
|
236
236
|
/**
|
|
237
|
-
* Extract the
|
|
238
|
-
*
|
|
237
|
+
* Extract the curated summary block (`### 🆕 What's New` or `## 🆕 What's New`)
|
|
238
|
+
* from a section body: its bullets only, each truncated to
|
|
239
|
+
* WHATS_NEW_ITEM_MAX_CHARS, capped to WHATS_NEW_SUMMARY_MAX_ITEMS. Null when
|
|
240
|
+
* the section carries no summary block (the full-section fallback applies).
|
|
241
|
+
*/
|
|
242
|
+
function extractWhatsNewSummary(body) {
|
|
243
|
+
const lines = body.split("\n");
|
|
244
|
+
const start = lines.findIndex((line) => /^#{2,3}[ \t]+.*What'?s New/i.test(line.trim()));
|
|
245
|
+
if (start === -1) return null;
|
|
246
|
+
const items = [];
|
|
247
|
+
for (const rawLine of lines.slice(start + 1)) {
|
|
248
|
+
const line = rawLine.trim();
|
|
249
|
+
if (line === "" || line.startsWith("<!--")) continue;
|
|
250
|
+
if (/^#{1,6}[ \t]/.test(line)) break;
|
|
251
|
+
if (!/^[-*][ \t]/.test(line)) continue;
|
|
252
|
+
if (items.length >= 6) break;
|
|
253
|
+
const content = stripMarkdown(line.replace(/^[-*][ \t]+/, ""));
|
|
254
|
+
if (content === "") continue;
|
|
255
|
+
items.push(content.length > 140 ? `${content.slice(0, 139)}…` : content);
|
|
256
|
+
}
|
|
257
|
+
return items.length > 0 ? items : null;
|
|
258
|
+
}
|
|
259
|
+
/**
|
|
260
|
+
* Extract the release highlights for `version`. When the section carries a
|
|
261
|
+
* curated `🆕 What's New` summary block, THE WINDOW SHOWS ONLY THAT (the
|
|
262
|
+
* full Added/Changed/Fixed walls are for the CHANGELOG readers, not the
|
|
263
|
+
* dialog); otherwise it falls back to the H3-group extraction bounded to
|
|
239
264
|
* WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a
|
|
240
265
|
* blank changelog all return EMPTY_HIGHLIGHTS (no window).
|
|
241
266
|
*/
|
|
242
267
|
function extractHighlights(changelogText, version) {
|
|
243
268
|
const { found, body } = extractSection(changelogText ?? "", version ?? "");
|
|
244
269
|
if (!found || !body) return { ...EMPTY_HIGHLIGHTS };
|
|
270
|
+
const summary = extractWhatsNewSummary(body);
|
|
271
|
+
if (summary !== null) return {
|
|
272
|
+
version: String(version).trim().replace(/^v/i, ""),
|
|
273
|
+
found: true,
|
|
274
|
+
groups: [{
|
|
275
|
+
heading: null,
|
|
276
|
+
items: summary
|
|
277
|
+
}],
|
|
278
|
+
totalItems: summary.length,
|
|
279
|
+
truncated: false
|
|
280
|
+
};
|
|
245
281
|
const groups = [];
|
|
246
282
|
let totalItems = 0;
|
|
247
283
|
let truncated = false;
|
|
@@ -267,13 +303,14 @@ function extractHighlights(changelogText, version) {
|
|
|
267
303
|
if (!isBullet && !continuation) continue;
|
|
268
304
|
const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \t]+/, "") : line);
|
|
269
305
|
if (content === "") continue;
|
|
306
|
+
const bounded = content.length > 140 ? `${content.slice(0, 139)}…` : content;
|
|
270
307
|
const group = groups.at(-1);
|
|
271
308
|
if (group === void 0) groups.push({
|
|
272
309
|
heading: null,
|
|
273
|
-
items: [
|
|
310
|
+
items: [bounded]
|
|
274
311
|
});
|
|
275
|
-
else if (isBullet || group.items.length === 0) group.items.push(
|
|
276
|
-
else group.items[group.items.length - 1] = `${group.items.at(-1)} ${
|
|
312
|
+
else if (isBullet || group.items.length === 0) group.items.push(bounded);
|
|
313
|
+
else group.items[group.items.length - 1] = `${group.items.at(-1)} ${bounded}`.trim();
|
|
277
314
|
if (isBullet) totalItems += 1;
|
|
278
315
|
}
|
|
279
316
|
const kept = groups.filter((group) => group.items.length > 0);
|
|
@@ -479,6 +516,30 @@ async function defaultWhatsNewStatePath(env = process.env, home = homedir()) {
|
|
|
479
516
|
*/
|
|
480
517
|
/** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */
|
|
481
518
|
const WHATS_NEW_CLOSE_HINT = "esc/q fechar";
|
|
519
|
+
/** Hint variant when the highlights span more than one page. */
|
|
520
|
+
const WHATS_NEW_PAGES_HINT = "esc/q fechar · n próxima · p volta";
|
|
521
|
+
/** Hard-wrap one display line into rows of at most `width` columns (>= 10). */
|
|
522
|
+
function wrapWhatsNewLine(line, width) {
|
|
523
|
+
const bounded = Number.isInteger(width) && width > 10 ? width : 76;
|
|
524
|
+
const text = String(line);
|
|
525
|
+
if (text.length <= bounded) return [text];
|
|
526
|
+
const rows = [];
|
|
527
|
+
let rest = text;
|
|
528
|
+
while (rest.length > bounded) {
|
|
529
|
+
rows.push(rest.slice(0, bounded));
|
|
530
|
+
rest = rest.slice(bounded);
|
|
531
|
+
}
|
|
532
|
+
if (rest.length > 0) rows.push(rest);
|
|
533
|
+
return rows;
|
|
534
|
+
}
|
|
535
|
+
/** Slice display lines into fixed-size pages (>= 1 page, empty-safe). */
|
|
536
|
+
function paginateWhatsNewLines(lines, pageSize = 14) {
|
|
537
|
+
const size = Number.isInteger(pageSize) && pageSize > 0 ? pageSize : 14;
|
|
538
|
+
if (lines.length === 0) return [[]];
|
|
539
|
+
const pages = [];
|
|
540
|
+
for (let i = 0; i < lines.length; i += size) pages.push(lines.slice(i, i + size));
|
|
541
|
+
return pages;
|
|
542
|
+
}
|
|
482
543
|
/**
|
|
483
544
|
* Open the one-time window when the version changed and highlights exist.
|
|
484
545
|
* Returns true when the window was shown; the caller's `onClose` callback
|
|
@@ -490,11 +551,13 @@ async function openWhatsNew(input) {
|
|
|
490
551
|
if (!await shouldShowWhatsNew(version, statePath)) return false;
|
|
491
552
|
const lines = whatsNewLines(changelogText ? extractHighlights(changelogText, version) : { ...EMPTY_HIGHLIGHTS });
|
|
492
553
|
if (lines.length === 0) return false;
|
|
554
|
+
const pages = paginateWhatsNewLines(lines);
|
|
493
555
|
const data = {
|
|
494
556
|
version,
|
|
495
557
|
title: whatsNewTitle(version),
|
|
496
558
|
lines,
|
|
497
|
-
|
|
559
|
+
pages,
|
|
560
|
+
hint: pages.length > 1 ? WHATS_NEW_PAGES_HINT : WHATS_NEW_CLOSE_HINT
|
|
498
561
|
};
|
|
499
562
|
show(() => data, () => {
|
|
500
563
|
markSeenWhatsNew(version, statePath);
|
|
@@ -512,8 +575,13 @@ async function openWhatsNew(input) {
|
|
|
512
575
|
* awaited — startup must never block). The decision lives in
|
|
513
576
|
* whats-new-open.ts; this file is only the host glue + view:
|
|
514
577
|
* `context.ui.dialog.show` plus a keymap layer gated on the open signal so
|
|
515
|
-
* `escape`/`q` dismiss while (and only while) the
|
|
516
|
-
* gated-layer pattern as the dispatch panel.
|
|
578
|
+
* `escape`/`q` dismiss and `n`/`p` flip pages while (and only while) the
|
|
579
|
+
* window is up — the same gated-layer pattern as the dispatch panel.
|
|
580
|
+
*
|
|
581
|
+
* The window shows the curated 🆕 What's New summary (whats-new-highlights
|
|
582
|
+
* prefers it), hard-wrapped to the window width and sliced into fixed-size
|
|
583
|
+
* pages — a big changelog can never overflow the terminal; the footer points
|
|
584
|
+
* at the complete CHANGELOG.md.
|
|
517
585
|
*
|
|
518
586
|
* Deliberately V2-only: the two dist entries are self-contained (the V1
|
|
519
587
|
* sidebar mirrors the preset resolver rather than importing it) because any
|
|
@@ -528,8 +596,14 @@ async function openWhatsNew(input) {
|
|
|
528
596
|
* CHANGELOG.md, unreadable state, a host API that throws — the window simply
|
|
529
597
|
* does not show (fail-open, like the rest of the plugin).
|
|
530
598
|
*/
|
|
531
|
-
/** Window body: title, rule,
|
|
599
|
+
/** Window body: title, rule, the current page (wrapped), footer hint. */
|
|
532
600
|
function WhatsNewContent(props) {
|
|
601
|
+
const rows = () => {
|
|
602
|
+
const current = props.data.pages[Math.min(props.page(), props.pageCount() - 1)] ?? [];
|
|
603
|
+
const wrapped = [];
|
|
604
|
+
for (const line of current) wrapped.push(...wrapWhatsNewLine(line, 76));
|
|
605
|
+
return wrapped;
|
|
606
|
+
};
|
|
533
607
|
return (() => {
|
|
534
608
|
var _el$ = createElement("box"), _el$2 = createElement("text"), _el$3 = createElement("text"), _el$5 = createElement("box"), _el$6 = createElement("text");
|
|
535
609
|
insertNode(_el$, _el$2);
|
|
@@ -545,7 +619,7 @@ function WhatsNewContent(props) {
|
|
|
545
619
|
insertNode(_el$3, createTextNode(`──────────────────────────────────────`));
|
|
546
620
|
insert(_el$, createComponent(For, {
|
|
547
621
|
get each() {
|
|
548
|
-
return
|
|
622
|
+
return rows();
|
|
549
623
|
},
|
|
550
624
|
children: (line) => (() => {
|
|
551
625
|
var _el$7 = createElement("text");
|
|
@@ -555,7 +629,11 @@ function WhatsNewContent(props) {
|
|
|
555
629
|
})()
|
|
556
630
|
}), _el$5);
|
|
557
631
|
setProp(_el$5, "height", 1);
|
|
558
|
-
insert(_el$6, () =>
|
|
632
|
+
insert(_el$6, (() => {
|
|
633
|
+
var _c$ = memo(() => props.pageCount() > 1);
|
|
634
|
+
return () => _c$() ? `${props.page() + 1}/${props.pageCount()} · ` : "";
|
|
635
|
+
})(), null);
|
|
636
|
+
insert(_el$6, () => props.data.hint, null);
|
|
559
637
|
effect((_p$) => {
|
|
560
638
|
var _v$ = props.fg, _v$2 = props.muted, _v$3 = props.muted;
|
|
561
639
|
_v$ !== _p$.e && (_p$.e = setProp(_el$2, "fg", _v$, _p$.e));
|
|
@@ -581,20 +659,43 @@ async function maybeShowWhatsNewV2(context) {
|
|
|
581
659
|
const statePath = await defaultWhatsNewStatePath();
|
|
582
660
|
const changelogText = await readChangelogForBundle(import.meta.url);
|
|
583
661
|
const [open, setOpen] = createSignal(false);
|
|
662
|
+
const [page, setPage] = createSignal(0);
|
|
663
|
+
let viewData;
|
|
664
|
+
const pageCount = () => Math.max(1, Math.ceil(viewData?.pages.length ?? 1));
|
|
584
665
|
let dismiss = () => {};
|
|
585
666
|
try {
|
|
586
667
|
context.keymap.layer(() => ({
|
|
587
668
|
mode: "global",
|
|
588
669
|
enabled: () => open(),
|
|
589
|
-
commands: [
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
670
|
+
commands: [
|
|
671
|
+
{
|
|
672
|
+
id: "pantheon.whats-new.close",
|
|
673
|
+
title: "Fechar o que há de novo",
|
|
674
|
+
bind: "escape,q",
|
|
675
|
+
run: () => {
|
|
676
|
+
if (!open()) return false;
|
|
677
|
+
dismiss();
|
|
678
|
+
}
|
|
679
|
+
},
|
|
680
|
+
{
|
|
681
|
+
id: "pantheon.whats-new.next",
|
|
682
|
+
title: "Próxima página",
|
|
683
|
+
bind: "n,right",
|
|
684
|
+
run: () => {
|
|
685
|
+
if (!open()) return false;
|
|
686
|
+
setPage((current) => Math.min(current + 1, pageCount() - 1));
|
|
687
|
+
}
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
id: "pantheon.whats-new.prev",
|
|
691
|
+
title: "Página anterior",
|
|
692
|
+
bind: "p,left",
|
|
693
|
+
run: () => {
|
|
694
|
+
if (!open()) return false;
|
|
695
|
+
setPage((current) => Math.max(current - 1, 0));
|
|
696
|
+
}
|
|
596
697
|
}
|
|
597
|
-
|
|
698
|
+
]
|
|
598
699
|
}));
|
|
599
700
|
} catch {}
|
|
600
701
|
await openWhatsNew({
|
|
@@ -612,13 +713,15 @@ async function maybeShowWhatsNewV2(context) {
|
|
|
612
713
|
} catch {}
|
|
613
714
|
close();
|
|
614
715
|
};
|
|
716
|
+
viewData = render();
|
|
717
|
+
setPage(0);
|
|
615
718
|
setOpen(true);
|
|
616
719
|
try {
|
|
617
720
|
const theme = context.theme?.text ?? {};
|
|
618
721
|
context.ui.dialog.show(() => createComponent(WhatsNewContent, {
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
722
|
+
data: viewData,
|
|
723
|
+
page,
|
|
724
|
+
pageCount,
|
|
622
725
|
get fg() {
|
|
623
726
|
return theme.base;
|
|
624
727
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tui-v2.js","names":["numberOrNull"],"sources":["../src/context-gauge.ts","../src/model-usage-limits.ts","../src/sidebar-width.ts","../src/whats-new-highlights.ts","../src/whats-new-state.ts","../src/whats-new-open.ts"],"sourcesContent":["/** Shared, data-only formatting and visual helpers for compact context gauges. */\n\nexport type ContextProgressTone = 'info' | 'success' | 'warning' | 'error'\n\nexport const CONTEXT_BAR_CELLS = 12\nexport const CONTEXT_BAR_FILLED_CELL = '\\u25B0'\nexport const CONTEXT_BAR_EMPTY_CELL = '\\u25B1'\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\nexport function contextUsageTone(percent: number): ContextProgressTone {\n if (percent > 90) return 'error'\n if (percent > 50) return 'warning'\n if (percent > 25) return 'success'\n return 'info'\n}\n\nexport function formatTokenCount(tokens: number | null | undefined): string | null {\n const value = numberOrNull(tokens)\n if (value === null || value < 0) return null\n return Math.round(value).toLocaleString('en-US')\n}\n\nexport function formatContextWindow(limit: number | null | undefined): string | null {\n const value = numberOrNull(limit)\n if (value === null || value <= 0) return null\n if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`\n if (value >= 1_000) return `${Math.floor(value / 1_000)}K`\n return `${Math.floor(value)}`\n}\n\nexport function contextBarFilled(percent: number, cells = CONTEXT_BAR_CELLS): number {\n const total = Math.max(1, Math.floor(cells))\n const filled = Math.round((percent / 100) * total)\n if (!Number.isFinite(filled)) return 0\n return Math.min(total, Math.max(0, filled))\n}\n\nexport function contextBar(\n percent: number | null | undefined,\n cells = CONTEXT_BAR_CELLS,\n): { filled: string; empty: string } | null {\n const value = numberOrNull(percent)\n if (value === null) return null\n const total = Math.max(1, Math.floor(cells))\n const filled = contextBarFilled(value, total)\n return {\n filled: CONTEXT_BAR_FILLED_CELL.repeat(filled),\n empty: CONTEXT_BAR_EMPTY_CELL.repeat(total - filled),\n }\n}\n\nexport function formatSpent(cost: number | null | undefined): string | null {\n const value = numberOrNull(cost)\n if (value === null || value < 0) return null\n return `$${value.toFixed(2)}`\n}\n","/** Shared bounds for cached recent model-usage aggregation. */\nexport const MODEL_USAGE_VISIBLE_CEILING = 3\nexport const MODEL_USAGE_MESSAGE_LIMIT = 400\nexport const MODEL_USAGE_SESSION_LIMIT = 8\n","/** Conservative content budget; the host sidebar slot does not report its runtime width. */\nexport const SIDEBAR_CONTENT_WIDTH = 34\n\nexport const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\n/** A grapheme the host draws two cells wide: emoji presentation, an extended\n * pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`\n * does) and a regional-indicator pair (a flag). */\nconst EMOJI_GLYPH = /\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{Regional_Indicator}/u\n/** VS16 asks for emoji presentation; without it `1` is one cell, with it the\n * keycap sequence is drawn as one two-cell glyph. */\nconst EMOJI_PRESENTATION_SELECTOR = '\\uFE0F'\n/** Unicode default-ignorable code points carry no width of their own. */\nconst IGNORABLE_GLYPH = /^\\p{Default_Ignorable_Code_Point}$/u\n/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width\n * (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).\n * Generated from the host's own measurement (`string-width` over every code\n * point, emoji excluded), so this table can be regenerated verbatim when the\n * host upgrades its Unicode data instead of being hand-edited. */\nconst CELL_WIDE_RANGES: readonly (readonly [number, number])[] = [\n [0x1100, 0x115e],\n [0x2329, 0x232a],\n [0x2630, 0x2637],\n [0x268a, 0x268f],\n [0x2e80, 0x2e99],\n [0x2e9b, 0x2ef3],\n [0x2f00, 0x2fd5],\n [0x2ff0, 0x302f],\n [0x3031, 0x303c],\n [0x303e, 0x303e],\n [0x3041, 0x3096],\n [0x3099, 0x30ff],\n [0x3105, 0x312f],\n [0x3131, 0x3163],\n [0x3165, 0x318e],\n [0x3190, 0x31e5],\n [0x31ef, 0x321e],\n [0x3220, 0x3247],\n [0x3250, 0x3296],\n [0x3298, 0x3298],\n [0x329a, 0xa48c],\n [0xa490, 0xa4c6],\n [0xa960, 0xa97c],\n [0xac00, 0xd7a3],\n [0xf900, 0xfaff],\n [0xfe10, 0xfe19],\n [0xfe30, 0xfe52],\n [0xfe54, 0xfe66],\n [0xfe68, 0xfe6b],\n [0xff01, 0xff60],\n [0xffe0, 0xffe6],\n [0x16fe0, 0x16fe4],\n [0x16ff0, 0x16ff6],\n [0x17000, 0x18cda],\n [0x18cff, 0x18d20],\n [0x18d80, 0x18df2],\n [0x18e00, 0x19191],\n [0x191a0, 0x191d2],\n [0x1aff0, 0x1aff3],\n [0x1aff5, 0x1affb],\n [0x1affd, 0x1affe],\n [0x1b000, 0x1b128],\n [0x1b132, 0x1b132],\n [0x1b150, 0x1b152],\n [0x1b155, 0x1b155],\n [0x1b164, 0x1b168],\n [0x1b170, 0x1b2fb],\n [0x1d300, 0x1d356],\n [0x1d360, 0x1d376],\n [0x1f200, 0x1f200],\n [0x1f210, 0x1f219],\n [0x1f21b, 0x1f22e],\n [0x1f230, 0x1f231],\n [0x1f23b, 0x1f23b],\n [0x1f240, 0x1f248],\n [0x1f260, 0x1f265],\n [0x20000, 0x2fffd],\n [0x30000, 0x3fffd],\n]\n\n/** One code point the terminal draws no cell for: control characters, the\n * zero-width joiners/marks, combining marks and variation selectors. */\nfunction isZeroWidthCodePoint(code: number, glyph: string): boolean {\n if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) return true\n if (code >= 0x200b && code <= 0x200f) return true\n if (code === 0xfeff) return true\n if (code >= 0x300 && code <= 0x36f) return true\n if (code >= 0x1ab0 && code <= 0x1aff) return true\n if (code >= 0x1dc0 && code <= 0x1dff) return true\n if (code >= 0x20d0 && code <= 0x20ff) return true\n if (code >= 0xfe00 && code <= 0xfe0f) return true\n if (code >= 0xfe20 && code <= 0xfe2f) return true\n if (code >= 0xe0100 && code <= 0xe01ef) return true\n if (code >= 0xd800 && code <= 0xdfff) return true // a lone surrogate\n return IGNORABLE_GLYPH.test(glyph)\n}\n\nfunction isWideCodePoint(code: number): boolean {\n for (const [low, high] of CELL_WIDE_RANGES) {\n if (code < low) return false\n if (code <= high) return true\n }\n return false\n}\n\n/** Cells one grapheme occupies. */\nfunction graphemeWidth(segment: string): number {\n if (EMOJI_GLYPH.test(segment)) return 2\n // A lone VS16 carries no width; after a base it asks for emoji presentation.\n if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2\n let width = 0\n for (const glyph of segment) {\n const code = glyph.codePointAt(0) ?? 0\n if (isZeroWidthCodePoint(code, glyph)) continue\n width += isWideCodePoint(code) ? 2 : 1\n }\n return width\n}\n\n/** Terminal cells `value` occupies — the unit every column in this plugin is\n * measured in. Mirrors the host (that is how `@opentui/core` sizes a text\n * run): emoji count as two cells, East Asian Wide/Fullwidth as two, East\n * Asian Ambiguous as one, combining marks and variation selectors as none.\n * Pure. */\nexport function cellWidth(value: string): number {\n let width = 0\n for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment)\n return width\n}\n","/**\n * whats-new-highlights.ts — release highlights for the one-time \"What's new\"\n * window, extracted from the CHANGELOG.md shipped with the plugin copy.\n *\n * The section-finding logic is an inline replica of scripts/changelog-extract.mjs\n * `extractSection` (pinned by a parity test in tests/tui-whats-new.test.mjs):\n * the copied plugin ships only dist/ + package.json (+ CHANGELOG.md, copied by\n * both installers), so it cannot reach scripts/ at runtime — the same reason\n * the preset resolver is mirrored in index.tsx/index-v2.tsx rather than\n * imported. The script's CLI main is NOT replicated; the plugin only needs the\n * pure extraction.\n *\n * Everything is reduced to bounded plain text: no markdown syntax artifacts,\n * at most WHATS_NEW_MAX_ITEMS bullets. Missing CHANGELOG.md, an unknown\n * version or an empty section all resolve to an empty highlight set — the\n * window simply does not show (fail-open, like the rest of the plugin).\n */\nimport { readFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/** Hard cap on bullets shown in the window (the remainder is counted). */\nexport const WHATS_NEW_MAX_ITEMS = 12\n\n/** Prefix of the \"+N more\" line appended when the bullet budget is exceeded. */\nexport const WHATS_NEW_MORE_PREFIX = '… +'\n\n/** H3 subsection headings are kept as plain-text group labels. */\nexport interface WhatsNewGroup {\n heading: string | null\n items: string[]\n}\n\nexport interface WhatsNewHighlights {\n /** Normalized version the highlights belong to (null when not found). */\n version: string | null\n found: boolean\n groups: WhatsNewGroup[]\n /** Total bullets in the section, before the WHATS_NEW_MAX_ITEMS cut. */\n totalItems: number\n /** True when totalItems exceeded WHATS_NEW_MAX_ITEMS. */\n truncated: boolean\n}\n\nexport const EMPTY_HIGHLIGHTS: WhatsNewHighlights = {\n version: null,\n found: false,\n groups: [],\n totalItems: 0,\n truncated: false,\n}\n\n/** Escape regex metacharacters so a version like 1.0.0 matches literally. */\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Extract the body of a version section from changelog text — inline replica\n * of scripts/changelog-extract.mjs `extractSection` (see that file for the\n * full contract: `## [<version>] - YYYY-MM-DD`, leading `v` and the date\n * optional, `## [Unreleased]` never matched).\n */\nexport function extractSection(\n changelogText: string,\n version: string,\n): { found: boolean; body: string | null } {\n const normalized = String(version).trim().replace(/^v/i, '')\n if (!normalized || /^unreleased$/i.test(normalized)) return { found: false, body: null }\n\n const escaped = escapeRegExp(normalized)\n // Single-line heading: `## [v?1.2.1]` optionally followed by ` - YYYY-MM-DD`.\n // [ \\t] (not \\s) keeps the match from crossing newlines; the lookahead\n // requires end-of-line or whitespace so `[1.0.0-beta]` can never match `1.0.0`.\n const headingRe = new RegExp(\n `^##[ \\\\t]+\\\\[v?${escaped}\\\\](?:[ \\\\t]*-[ \\\\t]*\\\\d{4}-\\\\d{2}-\\\\d{2})?(?=[ \\\\t]|$)`,\n 'm',\n )\n const match = headingRe.exec(changelogText)\n if (!match) return { found: false, body: null }\n\n // Advance past the heading line (match.index may point mid-line).\n const newline = changelogText.indexOf('\\n', match.index)\n const start = newline === -1 ? changelogText.length : newline + 1\n\n // Body ends at the next `## [` heading or end of text.\n const nextHeading = /^##[ \\t]+\\[/m.exec(changelogText.slice(start))\n const end = nextHeading ? start + nextHeading.index : changelogText.length\n\n return { found: true, body: changelogText.slice(start, end).trim() }\n}\n\n/**\n * Reduce one markdown line to plain text: links keep their label, emphasis\n * and inline-code markers are dropped, HTML comment fragments are removed,\n * and whitespace collapses. Deliberately simple — the input is our own\n * CHANGELOG (lint-capped at 200 chars per bullet), not hostile input.\n */\nexport function stripMarkdown(text: string): string {\n return text\n .replace(/<!--[\\s\\S]*?-->/g, ' ')\n .replace(/\\[([^\\]]+)\\]\\([^)]*\\)/g, '$1')\n .replace(/(\\*\\*|__)/g, '')\n .replace(/`/g, '')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/** Strip the leading H3 marker (`### Added` → `Added`). */\nfunction stripHeading(text: string): string {\n return text.replace(/^#{1,6}[ \\t]+/, '').trim()\n}\n\n/**\n * Extract the release highlights for `version`: H3 subsection headings as\n * group labels and their bullets as sanitized plain text, bounded to\n * WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a\n * blank changelog all return EMPTY_HIGHLIGHTS (no window).\n */\nexport function extractHighlights(changelogText: string, version: string): WhatsNewHighlights {\n const { found, body } = extractSection(changelogText ?? '', version ?? '')\n if (!found || !body) return { ...EMPTY_HIGHLIGHTS }\n\n const groups: WhatsNewGroup[] = []\n let totalItems = 0\n let truncated = false\n\n for (const rawLine of body.split('\\n')) {\n const line = rawLine.trim()\n if (line === '' || line.startsWith('<!--')) continue\n\n if (/^#{1,6}[ \\t]/.test(line)) {\n const heading = stripMarkdown(stripHeading(line))\n if (heading === '') continue\n if (groups.at(-1)?.items.length === 0) groups.pop() // empty group boundary\n groups.push({ heading, items: [] })\n continue\n }\n\n if (totalItems >= WHATS_NEW_MAX_ITEMS) {\n // Keep scanning only to count the remainder for the \"+N more\" line.\n if (/^[-*][ \\t]/.test(line)) totalItems += 1\n continue\n }\n\n const isBullet = /^[-*][ \\t]/.test(line)\n const continuation = (groups.at(-1)?.items.length ?? 0) > 0\n if (!isBullet && !continuation) continue // prose between groups — not a highlight\n\n const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \\t]+/, '') : line)\n if (content === '') continue\n const group = groups.at(-1)\n if (group === undefined) {\n groups.push({ heading: null, items: [content] })\n } else if (isBullet || group.items.length === 0) {\n group.items.push(content)\n } else {\n group.items[group.items.length - 1] = `${group.items.at(-1)} ${content}`.trim()\n }\n if (isBullet) totalItems += 1\n }\n\n const kept = groups.filter((group) => group.items.length > 0)\n truncated = totalItems > WHATS_NEW_MAX_ITEMS\n return {\n version: found ? String(version).trim().replace(/^v/i, '') : null,\n found,\n groups: kept,\n totalItems,\n truncated,\n }\n}\n\n/** Window title — mirrors the sidebar's `Pantheon v<version>` convention. */\nexport function whatsNewTitle(version: string): string {\n return `O que há de novo — Pantheon v${String(version).trim().replace(/^v/i, '')}`\n}\n\n/** Flat display lines for the window: group headings, `• ` bullets, `+N more`. */\nexport function whatsNewLines(highlights: WhatsNewHighlights): string[] {\n const lines: string[] = []\n for (const group of highlights.groups) {\n if (group.heading !== null) lines.push(group.heading)\n for (const item of group.items) lines.push(`• ${item}`)\n }\n if (highlights.truncated) {\n const hidden = Math.max(0, highlights.totalItems - WHATS_NEW_MAX_ITEMS)\n if (hidden > 0) lines.push(`${WHATS_NEW_MORE_PREFIX}${hidden} mais`)\n }\n return lines\n}\n\n/**\n * Candidate CHANGELOG.md locations for a bundle, first readable wins:\n * 1. the plugin copy root (`<configDir>/plugins/pantheon-tui/CHANGELOG.md`,\n * shipped by both installers next to package.json);\n * 2. the package root (dev checkout; also an npm-package install when the\n * bundle runs from `<pkg>/src/plugins/tui/dist/`).\n */\nexport function changelogCandidates(bundlePath: string): string[] {\n const dist = dirname(bundlePath)\n const copyRoot = dirname(dist)\n // The second leg targets the package root: src/plugins/tui → plugins → src\n // → package root (dev checkout / npm-package install). On an installed copy\n // the same three levels land on the XDG base, where no CHANGELOG lives —\n // harmless, the copy-root candidate is the one the installers ship.\n const packageRoot = dirname(dirname(dirname(copyRoot)))\n return [join(copyRoot, 'CHANGELOG.md'), join(packageRoot, 'CHANGELOG.md')]\n}\n\n/** Read the first existing candidate; null when none is readable (no window). */\nexport async function readChangelogForBundle(bundleUrl: string): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n for (const candidate of changelogCandidates(bundlePath)) {\n try {\n return await readFile(candidate, 'utf8')\n } catch {}\n }\n return null\n } catch {\n return null\n }\n}\n\n/** Build-time embedded version (tsdown `define` in tsdown.config.ts). */\ndeclare const __PANTHEON_VERSION__: string | undefined\n\n/** The ambient build-time version, or null outside a tsdown build. */\nexport function embeddedVersion(): string | null {\n return typeof __PANTHEON_VERSION__ !== 'undefined' && __PANTHEON_VERSION__\n ? __PANTHEON_VERSION__\n : null\n}\n\n/**\n * Resolve the running Pantheon version for the what's-new window: the plugin\n * copy's own package.json first (the copy root two levels above the bundle,\n * then the package root four levels above — the same legs as the V1 sidebar's\n * detectVersion try 0a/0b), falling back to the tsdown build embed. Null when\n * nothing resolves → no window (fail-open).\n */\nexport async function resolveRunningVersion(\n bundleUrl: string,\n embedded: string | null = embeddedVersion(),\n): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n const dist = dirname(bundlePath)\n for (const root of [dirname(dist), dirname(dirname(dirname(dist)))]) {\n try {\n const raw = await readFile(join(root, 'package.json'), 'utf8')\n const parsed = JSON.parse(raw) as { version?: unknown }\n if (typeof parsed.version === 'string' && parsed.version.trim() !== '') {\n return parsed.version\n }\n } catch {}\n }\n } catch {\n /* fall through to the embed */\n }\n return embedded\n}\n","/**\n * whats-new-state.ts — last-seen version for the one-time \"What's new\" window.\n *\n * The TUI shows a dismissable release-highlights dialog once per Pantheon\n * version. Whether a version was already seen is persisted next to the other\n * opencode-level Pantheon state: `<configDir>/.pantheon/whats-new.json`, the\n * same directory that already holds `install-state.json` (scripts/install/\n * state.mjs) and the active-preset file the sidebar reads. There is no\n * established persistent TUI KV store (the host `api.kv` is per-process), so\n * the plugin owns one small JSON file with the atomic-write discipline used\n * across the repo (unique tmp + rename, mirrors scripts/install/verify.mjs).\n *\n * Fail-open everywhere: a missing or corrupt file reads as \"never seen\" (the\n * window may show), a failed write is silent (the window may show again) —\n * neither can ever block TUI startup.\n */\nimport { mkdir, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises'\nimport { homedir } from 'node:os'\nimport { dirname, join } from 'node:path'\n\n/** State file name, kept next to `install-state.json` in `<configDir>/.pantheon/`. */\nexport const WHATS_NEW_STATE_FILENAME = 'whats-new.json'\n\n/** Shape of the persisted file — the plugin owns this file outright. */\nexport interface WhatsNewStateFile {\n seenVersion: string | null\n updatedAt: string\n}\n\ntype Env = Record<string, string | undefined>\n\n/** Parse a state file body; null when unreadable as the expected shape. */\nexport function parseWhatsNewState(raw: string): WhatsNewStateFile | null {\n try {\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null\n const record = parsed as Record<string, unknown>\n const seen = record.seenVersion\n if (typeof seen !== 'string' && seen !== null) return null\n return { seenVersion: seen, updatedAt: String(record.updatedAt ?? '') }\n } catch {\n return null\n }\n}\n\n/** Read the persisted state; null when missing or corrupt (never throws). */\nexport async function readWhatsNewState(statePath: string): Promise<WhatsNewStateFile | null> {\n try {\n return parseWhatsNewState(await readFile(statePath, 'utf8'))\n } catch {\n return null\n }\n}\n\n/**\n * Whether the one-time window should show for `version`: any version change\n * since the last dismissal (including downgrades). A falsy version — the\n * resolver failed — never shows.\n */\nexport async function shouldShowWhatsNew(\n version: string | null | undefined,\n statePath: string,\n): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const state = await readWhatsNewState(statePath)\n return state?.seenVersion !== version\n}\n\n/**\n * Persist `version` as seen (atomic tmp + rename, 0o600). Never throws: a\n * failed write leaves the state untouched and the window may show again —\n * the same fail-open contract as the rest of the plugin.\n */\nexport async function markSeenWhatsNew(version: string, statePath: string): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const previous = await readWhatsNewState(statePath)\n const next: WhatsNewStateFile = {\n seenVersion: version,\n updatedAt: new Date().toISOString(),\n }\n const tmpPath = `${statePath}.tmp-${process.pid}`\n try {\n await mkdir(dirname(statePath), { recursive: true })\n await writeFile(tmpPath, `${JSON.stringify({ ...previous, ...next }, null, 2)}\\n`, {\n encoding: 'utf8',\n mode: 0o600,\n })\n await rename(tmpPath, statePath)\n return true\n } catch {\n try {\n await unlink(tmpPath)\n } catch {\n /* nothing to clean up */\n }\n return false\n }\n}\n\n/** `stat`-based existence probe (async I/O discipline). */\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Default state path: `<configDir>/.pantheon/whats-new.json`, resolving the\n * OpenCode config directory exactly like src/pantheon/tui-version-check.ts\n * (`$XDG_CONFIG_HOME/opencode` → `~/.opencode`), defaulting to the XDG\n * location `init` creates when neither exists yet.\n */\nexport async function defaultWhatsNewStatePath(\n env: Env = process.env,\n home: string = homedir(),\n): Promise<string> {\n const xdgConfig = env.XDG_CONFIG_HOME || join(home, '.config')\n const primary = join(xdgConfig, 'opencode')\n if (await pathExists(primary)) return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n const legacy = join(home, '.opencode')\n if (await pathExists(legacy)) return join(legacy, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n}\n","/**\n * whats-new-open.ts — the show-once decision for the \"What's new\" window.\n *\n * Plain data in, plain data out: the entrypoints (index.tsx / index-v2.tsx)\n * resolve the running version and the shipped CHANGELOG.md, then hand this\n * module a `show` callback that renders the view data through the host's\n * dialog API. Keeping the decision JSX-free makes the whole one-time flow\n * testable offline (node strips the types natively) — the Solid glue lives in\n * whats-new.tsx.\n *\n * Contract (pinned by tests/tui-whats-new.test.mjs):\n * - shows at most once per version: dismissal marks the version seen;\n * - nothing to show (no version, missing CHANGELOG, empty section) → no\n * window AND no pin — the next start may still show it;\n * - never throws on its own inputs; I/O failures inside the state module\n * are fail-open there.\n */\nimport {\n EMPTY_HIGHLIGHTS,\n extractHighlights,\n type WhatsNewHighlights,\n whatsNewLines,\n whatsNewTitle,\n} from './whats-new-highlights.ts'\nimport { markSeenWhatsNew, shouldShowWhatsNew } from './whats-new-state.ts'\n\n/** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */\nexport const WHATS_NEW_CLOSE_HINT = 'esc/q fechar'\n\n/** Everything the window needs to render — no host types, no JSX. */\nexport interface WhatsNewViewData {\n version: string\n title: string\n lines: string[]\n hint: string\n}\n\nexport type WhatsNewShowFn = (render: () => WhatsNewViewData, onClose: () => void) => void\n\nexport interface WhatsNewOpenInput {\n /** Running Pantheon version (null when unresolvable → no window). */\n version: string | null\n /** Path of the seen-version state file (see whats-new-state.ts). */\n statePath: string\n /** Shipped CHANGELOG.md content, or null when unreadable. */\n changelogText: string | null\n /** Host dialog opener; `onClose` fires on host dismissal (ESC / chrome). */\n show: WhatsNewShowFn\n}\n\n/**\n * Open the one-time window when the version changed and highlights exist.\n * Returns true when the window was shown; the caller's `onClose` callback\n * (both host-initiated and local close binds) must funnel into marking seen.\n */\nexport async function openWhatsNew(input: WhatsNewOpenInput): Promise<boolean> {\n const { version, statePath, changelogText, show } = input\n if (typeof version !== 'string' || version.trim() === '') return false\n if (!(await shouldShowWhatsNew(version, statePath))) return false\n\n const highlights: WhatsNewHighlights = changelogText\n ? extractHighlights(changelogText, version)\n : { ...EMPTY_HIGHLIGHTS }\n const lines = whatsNewLines(highlights)\n if (lines.length === 0) return false\n\n const data: WhatsNewViewData = {\n version,\n title: whatsNewTitle(version),\n lines,\n hint: WHATS_NEW_CLOSE_HINT,\n }\n show(\n () => data,\n () => {\n void markSeenWhatsNew(version, statePath)\n },\n )\n return true\n}\n"],"mappings":";;;;;;;;;AAIA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,yBAAyB;AAEtC,SAASA,eAAa,OAA+B;CACnD,OAAO,OAAO,UAAU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,WAAW,OAAO,GAAG,OAAO,KAAK,SAAS,aAAa,wBAAwB;CAEzF,MAAM,SAAS,KAAK,MAAM,WAAW;CACrC,IAAI,MAAM,WAAW,MAAM,GAAG,OAAO,KAAK,QAAQ,aAAa,wBAAwB;CAEvF,OAAO,KAAK,SAAS,aAAa,wBAAwB;AAC5D;;;;;;;;;;;;;;;;;;;;;ACpGA,MAAa,uBAAuB;;;;;;AA4BpC,eAAsB,aAAa,OAA4C;CAC7E,MAAM,EAAE,SAAS,WAAW,eAAe,SAAS;CACpD,IAAI,OAAO,YAAY,YAAY,QAAQ,KAAK,MAAM,IAAI,OAAO;CACjE,IAAI,CAAE,MAAM,mBAAmB,SAAS,SAAS,GAAI,OAAO;CAK5D,MAAM,QAAQ,cAHyB,gBACnC,kBAAkB,eAAe,OAAO,IACxC,EAAE,GAAG,iBAAiB,CACY;CACtC,IAAI,MAAM,WAAW,GAAG,OAAO;CAE/B,MAAM,OAAyB;EAC7B;EACA,OAAO,cAAc,OAAO;EAC5B;EACA,MAAM;CACR;CACA,WACQ,YACA;EACJ,iBAAsB,SAAS,SAAS;CAC1C,CACF;CACA,OAAO;AACT"}
|
|
1
|
+
{"version":3,"file":"tui-v2.js","names":["numberOrNull"],"sources":["../src/context-gauge.ts","../src/model-usage-limits.ts","../src/sidebar-width.ts","../src/whats-new-highlights.ts","../src/whats-new-state.ts","../src/whats-new-open.ts"],"sourcesContent":["/** Shared, data-only formatting and visual helpers for compact context gauges. */\n\nexport type ContextProgressTone = 'info' | 'success' | 'warning' | 'error'\n\nexport const CONTEXT_BAR_CELLS = 12\nexport const CONTEXT_BAR_FILLED_CELL = '\\u25B0'\nexport const CONTEXT_BAR_EMPTY_CELL = '\\u25B1'\n\nfunction numberOrNull(value: unknown): number | null {\n return typeof value === 'number' && Number.isFinite(value) ? value : null\n}\n\nexport function contextUsageTone(percent: number): ContextProgressTone {\n if (percent > 90) return 'error'\n if (percent > 50) return 'warning'\n if (percent > 25) return 'success'\n return 'info'\n}\n\nexport function formatTokenCount(tokens: number | null | undefined): string | null {\n const value = numberOrNull(tokens)\n if (value === null || value < 0) return null\n return Math.round(value).toLocaleString('en-US')\n}\n\nexport function formatContextWindow(limit: number | null | undefined): string | null {\n const value = numberOrNull(limit)\n if (value === null || value <= 0) return null\n if (value >= 1_000_000) return `${(value / 1_000_000).toFixed(1)}M`\n if (value >= 1_000) return `${Math.floor(value / 1_000)}K`\n return `${Math.floor(value)}`\n}\n\nexport function contextBarFilled(percent: number, cells = CONTEXT_BAR_CELLS): number {\n const total = Math.max(1, Math.floor(cells))\n const filled = Math.round((percent / 100) * total)\n if (!Number.isFinite(filled)) return 0\n return Math.min(total, Math.max(0, filled))\n}\n\nexport function contextBar(\n percent: number | null | undefined,\n cells = CONTEXT_BAR_CELLS,\n): { filled: string; empty: string } | null {\n const value = numberOrNull(percent)\n if (value === null) return null\n const total = Math.max(1, Math.floor(cells))\n const filled = contextBarFilled(value, total)\n return {\n filled: CONTEXT_BAR_FILLED_CELL.repeat(filled),\n empty: CONTEXT_BAR_EMPTY_CELL.repeat(total - filled),\n }\n}\n\nexport function formatSpent(cost: number | null | undefined): string | null {\n const value = numberOrNull(cost)\n if (value === null || value < 0) return null\n return `$${value.toFixed(2)}`\n}\n","/** Shared bounds for cached recent model-usage aggregation. */\nexport const MODEL_USAGE_VISIBLE_CEILING = 3\nexport const MODEL_USAGE_MESSAGE_LIMIT = 400\nexport const MODEL_USAGE_SESSION_LIMIT = 8\n","/** Conservative content budget; the host sidebar slot does not report its runtime width. */\nexport const SIDEBAR_CONTENT_WIDTH = 34\n\nexport const GRAPHEMES = new Intl.Segmenter(undefined, { granularity: 'grapheme' })\n\n/** A grapheme the host draws two cells wide: emoji presentation, an extended\n * pictograph (a bare `❤` counts too, exactly as the host's `emoji-regex`\n * does) and a regional-indicator pair (a flag). */\nconst EMOJI_GLYPH = /\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{Regional_Indicator}/u\n/** VS16 asks for emoji presentation; without it `1` is one cell, with it the\n * keycap sequence is drawn as one two-cell glyph. */\nconst EMOJI_PRESENTATION_SELECTOR = '\\uFE0F'\n/** Unicode default-ignorable code points carry no width of their own. */\nconst IGNORABLE_GLYPH = /^\\p{Default_Ignorable_Code_Point}$/u\n/** East Asian Wide/Fullwidth ranges — two cells, never the ambiguous width\n * (the host measures ambiguous as narrow, so `▸`/`✓`/`—` stay one cell).\n * Generated from the host's own measurement (`string-width` over every code\n * point, emoji excluded), so this table can be regenerated verbatim when the\n * host upgrades its Unicode data instead of being hand-edited. */\nconst CELL_WIDE_RANGES: readonly (readonly [number, number])[] = [\n [0x1100, 0x115e],\n [0x2329, 0x232a],\n [0x2630, 0x2637],\n [0x268a, 0x268f],\n [0x2e80, 0x2e99],\n [0x2e9b, 0x2ef3],\n [0x2f00, 0x2fd5],\n [0x2ff0, 0x302f],\n [0x3031, 0x303c],\n [0x303e, 0x303e],\n [0x3041, 0x3096],\n [0x3099, 0x30ff],\n [0x3105, 0x312f],\n [0x3131, 0x3163],\n [0x3165, 0x318e],\n [0x3190, 0x31e5],\n [0x31ef, 0x321e],\n [0x3220, 0x3247],\n [0x3250, 0x3296],\n [0x3298, 0x3298],\n [0x329a, 0xa48c],\n [0xa490, 0xa4c6],\n [0xa960, 0xa97c],\n [0xac00, 0xd7a3],\n [0xf900, 0xfaff],\n [0xfe10, 0xfe19],\n [0xfe30, 0xfe52],\n [0xfe54, 0xfe66],\n [0xfe68, 0xfe6b],\n [0xff01, 0xff60],\n [0xffe0, 0xffe6],\n [0x16fe0, 0x16fe4],\n [0x16ff0, 0x16ff6],\n [0x17000, 0x18cda],\n [0x18cff, 0x18d20],\n [0x18d80, 0x18df2],\n [0x18e00, 0x19191],\n [0x191a0, 0x191d2],\n [0x1aff0, 0x1aff3],\n [0x1aff5, 0x1affb],\n [0x1affd, 0x1affe],\n [0x1b000, 0x1b128],\n [0x1b132, 0x1b132],\n [0x1b150, 0x1b152],\n [0x1b155, 0x1b155],\n [0x1b164, 0x1b168],\n [0x1b170, 0x1b2fb],\n [0x1d300, 0x1d356],\n [0x1d360, 0x1d376],\n [0x1f200, 0x1f200],\n [0x1f210, 0x1f219],\n [0x1f21b, 0x1f22e],\n [0x1f230, 0x1f231],\n [0x1f23b, 0x1f23b],\n [0x1f240, 0x1f248],\n [0x1f260, 0x1f265],\n [0x20000, 0x2fffd],\n [0x30000, 0x3fffd],\n]\n\n/** One code point the terminal draws no cell for: control characters, the\n * zero-width joiners/marks, combining marks and variation selectors. */\nfunction isZeroWidthCodePoint(code: number, glyph: string): boolean {\n if (code <= 0x1f || (code >= 0x7f && code <= 0x9f)) return true\n if (code >= 0x200b && code <= 0x200f) return true\n if (code === 0xfeff) return true\n if (code >= 0x300 && code <= 0x36f) return true\n if (code >= 0x1ab0 && code <= 0x1aff) return true\n if (code >= 0x1dc0 && code <= 0x1dff) return true\n if (code >= 0x20d0 && code <= 0x20ff) return true\n if (code >= 0xfe00 && code <= 0xfe0f) return true\n if (code >= 0xfe20 && code <= 0xfe2f) return true\n if (code >= 0xe0100 && code <= 0xe01ef) return true\n if (code >= 0xd800 && code <= 0xdfff) return true // a lone surrogate\n return IGNORABLE_GLYPH.test(glyph)\n}\n\nfunction isWideCodePoint(code: number): boolean {\n for (const [low, high] of CELL_WIDE_RANGES) {\n if (code < low) return false\n if (code <= high) return true\n }\n return false\n}\n\n/** Cells one grapheme occupies. */\nfunction graphemeWidth(segment: string): number {\n if (EMOJI_GLYPH.test(segment)) return 2\n // A lone VS16 carries no width; after a base it asks for emoji presentation.\n if (segment.length > 1 && segment.includes(EMOJI_PRESENTATION_SELECTOR)) return 2\n let width = 0\n for (const glyph of segment) {\n const code = glyph.codePointAt(0) ?? 0\n if (isZeroWidthCodePoint(code, glyph)) continue\n width += isWideCodePoint(code) ? 2 : 1\n }\n return width\n}\n\n/** Terminal cells `value` occupies — the unit every column in this plugin is\n * measured in. Mirrors the host (that is how `@opentui/core` sizes a text\n * run): emoji count as two cells, East Asian Wide/Fullwidth as two, East\n * Asian Ambiguous as one, combining marks and variation selectors as none.\n * Pure. */\nexport function cellWidth(value: string): number {\n let width = 0\n for (const { segment } of GRAPHEMES.segment(value)) width += graphemeWidth(segment)\n return width\n}\n","/**\n * whats-new-highlights.ts — release highlights for the one-time \"What's new\"\n * window, extracted from the CHANGELOG.md shipped with the plugin copy.\n *\n * The section-finding logic is an inline replica of scripts/changelog-extract.mjs\n * `extractSection` (pinned by a parity test in tests/tui-whats-new.test.mjs):\n * the copied plugin ships only dist/ + package.json (+ CHANGELOG.md, copied by\n * both installers), so it cannot reach scripts/ at runtime — the same reason\n * the preset resolver is mirrored in index.tsx/index-v2.tsx rather than\n * imported. The script's CLI main is NOT replicated; the plugin only needs the\n * pure extraction.\n *\n * Everything is reduced to bounded plain text: no markdown syntax artifacts,\n * at most WHATS_NEW_MAX_ITEMS bullets. Missing CHANGELOG.md, an unknown\n * version or an empty section all resolve to an empty highlight set — the\n * window simply does not show (fail-open, like the rest of the plugin).\n */\nimport { readFile } from 'node:fs/promises'\nimport { dirname, join } from 'node:path'\nimport { fileURLToPath } from 'node:url'\n\n/** Hard cap on bullets shown in the window (the remainder is counted). */\nexport const WHATS_NEW_MAX_ITEMS = 12\n\n/**\n * Cap for the curated `🆕 What's New` summary block — the window shows the\n * summary, never the full Added/Changed/Fixed walls.\n */\nexport const WHATS_NEW_SUMMARY_MAX_ITEMS = 6\n\n/** Bullets longer than this are truncated with an ellipsis (one-line rule). */\nexport const WHATS_NEW_ITEM_MAX_CHARS = 140\n\n/** Prefix of the \"+N more\" line appended when the bullet budget is exceeded. */\nexport const WHATS_NEW_MORE_PREFIX = '… +'\n\n/** H3 subsection headings are kept as plain-text group labels. */\nexport interface WhatsNewGroup {\n heading: string | null\n items: string[]\n}\n\nexport interface WhatsNewHighlights {\n /** Normalized version the highlights belong to (null when not found). */\n version: string | null\n found: boolean\n groups: WhatsNewGroup[]\n /** Total bullets in the section, before the WHATS_NEW_MAX_ITEMS cut. */\n totalItems: number\n /** True when totalItems exceeded WHATS_NEW_MAX_ITEMS. */\n truncated: boolean\n}\n\nexport const EMPTY_HIGHLIGHTS: WhatsNewHighlights = {\n version: null,\n found: false,\n groups: [],\n totalItems: 0,\n truncated: false,\n}\n\n/** Escape regex metacharacters so a version like 1.0.0 matches literally. */\nfunction escapeRegExp(text: string): string {\n return text.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * Extract the body of a version section from changelog text — inline replica\n * of scripts/changelog-extract.mjs `extractSection` (see that file for the\n * full contract: `## [<version>] - YYYY-MM-DD`, leading `v` and the date\n * optional, `## [Unreleased]` never matched).\n */\nexport function extractSection(\n changelogText: string,\n version: string,\n): { found: boolean; body: string | null } {\n const normalized = String(version).trim().replace(/^v/i, '')\n if (!normalized || /^unreleased$/i.test(normalized)) return { found: false, body: null }\n\n const escaped = escapeRegExp(normalized)\n // Single-line heading: `## [v?1.2.1]` optionally followed by ` - YYYY-MM-DD`.\n // [ \\t] (not \\s) keeps the match from crossing newlines; the lookahead\n // requires end-of-line or whitespace so `[1.0.0-beta]` can never match `1.0.0`.\n const headingRe = new RegExp(\n `^##[ \\\\t]+\\\\[v?${escaped}\\\\](?:[ \\\\t]*-[ \\\\t]*\\\\d{4}-\\\\d{2}-\\\\d{2})?(?=[ \\\\t]|$)`,\n 'm',\n )\n const match = headingRe.exec(changelogText)\n if (!match) return { found: false, body: null }\n\n // Advance past the heading line (match.index may point mid-line).\n const newline = changelogText.indexOf('\\n', match.index)\n const start = newline === -1 ? changelogText.length : newline + 1\n\n // Body ends at the next `## [` heading or end of text.\n const nextHeading = /^##[ \\t]+\\[/m.exec(changelogText.slice(start))\n const end = nextHeading ? start + nextHeading.index : changelogText.length\n\n return { found: true, body: changelogText.slice(start, end).trim() }\n}\n\n/**\n * Reduce one markdown line to plain text: links keep their label, emphasis\n * and inline-code markers are dropped, HTML comment fragments are removed,\n * and whitespace collapses. Deliberately simple — the input is our own\n * CHANGELOG (lint-capped at 200 chars per bullet), not hostile input.\n */\nexport function stripMarkdown(text: string): string {\n return text\n .replace(/<!--[\\s\\S]*?-->/g, ' ')\n .replace(/\\[([^\\]]+)\\]\\([^)]*\\)/g, '$1')\n .replace(/(\\*\\*|__)/g, '')\n .replace(/`/g, '')\n .replace(/\\s+/g, ' ')\n .trim()\n}\n\n/** Strip the leading H3 marker (`### Added` → `Added`). */\nfunction stripHeading(text: string): string {\n return text.replace(/^#{1,6}[ \\t]+/, '').trim()\n}\n\n/**\n * Extract the curated summary block (`### 🆕 What's New` or `## 🆕 What's New`)\n * from a section body: its bullets only, each truncated to\n * WHATS_NEW_ITEM_MAX_CHARS, capped to WHATS_NEW_SUMMARY_MAX_ITEMS. Null when\n * the section carries no summary block (the full-section fallback applies).\n */\nexport function extractWhatsNewSummary(body: string): string[] | null {\n const lines = body.split('\\n')\n const start = lines.findIndex((line) => /^#{2,3}[ \\t]+.*What'?s New/i.test(line.trim()))\n if (start === -1) return null\n const items: string[] = []\n for (const rawLine of lines.slice(start + 1)) {\n const line = rawLine.trim()\n if (line === '' || line.startsWith('<!--')) continue\n if (/^#{1,6}[ \\t]/.test(line)) break // next subsection — summary ended\n if (!/^[-*][ \\t]/.test(line)) continue\n if (items.length >= WHATS_NEW_SUMMARY_MAX_ITEMS) break\n const content = stripMarkdown(line.replace(/^[-*][ \\t]+/, ''))\n if (content === '') continue\n items.push(\n content.length > WHATS_NEW_ITEM_MAX_CHARS\n ? `${content.slice(0, WHATS_NEW_ITEM_MAX_CHARS - 1)}…`\n : content,\n )\n }\n return items.length > 0 ? items : null\n}\n\n/**\n * Extract the release highlights for `version`. When the section carries a\n * curated `🆕 What's New` summary block, THE WINDOW SHOWS ONLY THAT (the\n * full Added/Changed/Fixed walls are for the CHANGELOG readers, not the\n * dialog); otherwise it falls back to the H3-group extraction bounded to\n * WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a\n * blank changelog all return EMPTY_HIGHLIGHTS (no window).\n */\nexport function extractHighlights(changelogText: string, version: string): WhatsNewHighlights {\n const { found, body } = extractSection(changelogText ?? '', version ?? '')\n if (!found || !body) return { ...EMPTY_HIGHLIGHTS }\n\n const summary = extractWhatsNewSummary(body)\n if (summary !== null) {\n return {\n version: String(version).trim().replace(/^v/i, ''),\n found: true,\n groups: [{ heading: null, items: summary }],\n totalItems: summary.length,\n truncated: false,\n }\n }\n\n const groups: WhatsNewGroup[] = []\n let totalItems = 0\n let truncated = false\n\n for (const rawLine of body.split('\\n')) {\n const line = rawLine.trim()\n if (line === '' || line.startsWith('<!--')) continue\n\n if (/^#{1,6}[ \\t]/.test(line)) {\n const heading = stripMarkdown(stripHeading(line))\n if (heading === '') continue\n if (groups.at(-1)?.items.length === 0) groups.pop() // empty group boundary\n groups.push({ heading, items: [] })\n continue\n }\n\n if (totalItems >= WHATS_NEW_MAX_ITEMS) {\n // Keep scanning only to count the remainder for the \"+N more\" line.\n if (/^[-*][ \\t]/.test(line)) totalItems += 1\n continue\n }\n\n const isBullet = /^[-*][ \\t]/.test(line)\n const continuation = (groups.at(-1)?.items.length ?? 0) > 0\n if (!isBullet && !continuation) continue // prose between groups — not a highlight\n\n const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \\t]+/, '') : line)\n if (content === '') continue\n const bounded =\n content.length > WHATS_NEW_ITEM_MAX_CHARS\n ? `${content.slice(0, WHATS_NEW_ITEM_MAX_CHARS - 1)}…`\n : content\n const group = groups.at(-1)\n if (group === undefined) {\n groups.push({ heading: null, items: [bounded] })\n } else if (isBullet || group.items.length === 0) {\n group.items.push(bounded)\n } else {\n group.items[group.items.length - 1] = `${group.items.at(-1)} ${bounded}`.trim()\n }\n if (isBullet) totalItems += 1\n }\n\n const kept = groups.filter((group) => group.items.length > 0)\n truncated = totalItems > WHATS_NEW_MAX_ITEMS\n return {\n version: found ? String(version).trim().replace(/^v/i, '') : null,\n found,\n groups: kept,\n totalItems,\n truncated,\n }\n}\n\n/** Window title — mirrors the sidebar's `Pantheon v<version>` convention. */\nexport function whatsNewTitle(version: string): string {\n return `O que há de novo — Pantheon v${String(version).trim().replace(/^v/i, '')}`\n}\n\n/** Flat display lines for the window: group headings, `• ` bullets, `+N more`. */\nexport function whatsNewLines(highlights: WhatsNewHighlights): string[] {\n const lines: string[] = []\n for (const group of highlights.groups) {\n if (group.heading !== null) lines.push(group.heading)\n for (const item of group.items) lines.push(`• ${item}`)\n }\n if (highlights.truncated) {\n const hidden = Math.max(0, highlights.totalItems - WHATS_NEW_MAX_ITEMS)\n if (hidden > 0) lines.push(`${WHATS_NEW_MORE_PREFIX}${hidden} mais`)\n }\n return lines\n}\n\n/**\n * Candidate CHANGELOG.md locations for a bundle, first readable wins:\n * 1. the plugin copy root (`<configDir>/plugins/pantheon-tui/CHANGELOG.md`,\n * shipped by both installers next to package.json);\n * 2. the package root (dev checkout; also an npm-package install when the\n * bundle runs from `<pkg>/src/plugins/tui/dist/`).\n */\nexport function changelogCandidates(bundlePath: string): string[] {\n const dist = dirname(bundlePath)\n const copyRoot = dirname(dist)\n // The second leg targets the package root: src/plugins/tui → plugins → src\n // → package root (dev checkout / npm-package install). On an installed copy\n // the same three levels land on the XDG base, where no CHANGELOG lives —\n // harmless, the copy-root candidate is the one the installers ship.\n const packageRoot = dirname(dirname(dirname(copyRoot)))\n return [join(copyRoot, 'CHANGELOG.md'), join(packageRoot, 'CHANGELOG.md')]\n}\n\n/** Read the first existing candidate; null when none is readable (no window). */\nexport async function readChangelogForBundle(bundleUrl: string): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n for (const candidate of changelogCandidates(bundlePath)) {\n try {\n return await readFile(candidate, 'utf8')\n } catch {}\n }\n return null\n } catch {\n return null\n }\n}\n\n/** Build-time embedded version (tsdown `define` in tsdown.config.ts). */\ndeclare const __PANTHEON_VERSION__: string | undefined\n\n/** The ambient build-time version, or null outside a tsdown build. */\nexport function embeddedVersion(): string | null {\n return typeof __PANTHEON_VERSION__ !== 'undefined' && __PANTHEON_VERSION__\n ? __PANTHEON_VERSION__\n : null\n}\n\n/**\n * Resolve the running Pantheon version for the what's-new window: the plugin\n * copy's own package.json first (the copy root two levels above the bundle,\n * then the package root four levels above — the same legs as the V1 sidebar's\n * detectVersion try 0a/0b), falling back to the tsdown build embed. Null when\n * nothing resolves → no window (fail-open).\n */\nexport async function resolveRunningVersion(\n bundleUrl: string,\n embedded: string | null = embeddedVersion(),\n): Promise<string | null> {\n try {\n const bundlePath = fileURLToPath(bundleUrl)\n const dist = dirname(bundlePath)\n for (const root of [dirname(dist), dirname(dirname(dirname(dist)))]) {\n try {\n const raw = await readFile(join(root, 'package.json'), 'utf8')\n const parsed = JSON.parse(raw) as { version?: unknown }\n if (typeof parsed.version === 'string' && parsed.version.trim() !== '') {\n return parsed.version\n }\n } catch {}\n }\n } catch {\n /* fall through to the embed */\n }\n return embedded\n}\n","/**\n * whats-new-state.ts — last-seen version for the one-time \"What's new\" window.\n *\n * The TUI shows a dismissable release-highlights dialog once per Pantheon\n * version. Whether a version was already seen is persisted next to the other\n * opencode-level Pantheon state: `<configDir>/.pantheon/whats-new.json`, the\n * same directory that already holds `install-state.json` (scripts/install/\n * state.mjs) and the active-preset file the sidebar reads. There is no\n * established persistent TUI KV store (the host `api.kv` is per-process), so\n * the plugin owns one small JSON file with the atomic-write discipline used\n * across the repo (unique tmp + rename, mirrors scripts/install/verify.mjs).\n *\n * Fail-open everywhere: a missing or corrupt file reads as \"never seen\" (the\n * window may show), a failed write is silent (the window may show again) —\n * neither can ever block TUI startup.\n */\nimport { mkdir, readFile, rename, stat, unlink, writeFile } from 'node:fs/promises'\nimport { homedir } from 'node:os'\nimport { dirname, join } from 'node:path'\n\n/** State file name, kept next to `install-state.json` in `<configDir>/.pantheon/`. */\nexport const WHATS_NEW_STATE_FILENAME = 'whats-new.json'\n\n/** Shape of the persisted file — the plugin owns this file outright. */\nexport interface WhatsNewStateFile {\n seenVersion: string | null\n updatedAt: string\n}\n\ntype Env = Record<string, string | undefined>\n\n/** Parse a state file body; null when unreadable as the expected shape. */\nexport function parseWhatsNewState(raw: string): WhatsNewStateFile | null {\n try {\n const parsed: unknown = JSON.parse(raw)\n if (typeof parsed !== 'object' || parsed === null || Array.isArray(parsed)) return null\n const record = parsed as Record<string, unknown>\n const seen = record.seenVersion\n if (typeof seen !== 'string' && seen !== null) return null\n return { seenVersion: seen, updatedAt: String(record.updatedAt ?? '') }\n } catch {\n return null\n }\n}\n\n/** Read the persisted state; null when missing or corrupt (never throws). */\nexport async function readWhatsNewState(statePath: string): Promise<WhatsNewStateFile | null> {\n try {\n return parseWhatsNewState(await readFile(statePath, 'utf8'))\n } catch {\n return null\n }\n}\n\n/**\n * Whether the one-time window should show for `version`: any version change\n * since the last dismissal (including downgrades). A falsy version — the\n * resolver failed — never shows.\n */\nexport async function shouldShowWhatsNew(\n version: string | null | undefined,\n statePath: string,\n): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const state = await readWhatsNewState(statePath)\n return state?.seenVersion !== version\n}\n\n/**\n * Persist `version` as seen (atomic tmp + rename, 0o600). Never throws: a\n * failed write leaves the state untouched and the window may show again —\n * the same fail-open contract as the rest of the plugin.\n */\nexport async function markSeenWhatsNew(version: string, statePath: string): Promise<boolean> {\n if (typeof version !== 'string' || version.trim() === '') return false\n const previous = await readWhatsNewState(statePath)\n const next: WhatsNewStateFile = {\n seenVersion: version,\n updatedAt: new Date().toISOString(),\n }\n const tmpPath = `${statePath}.tmp-${process.pid}`\n try {\n await mkdir(dirname(statePath), { recursive: true })\n await writeFile(tmpPath, `${JSON.stringify({ ...previous, ...next }, null, 2)}\\n`, {\n encoding: 'utf8',\n mode: 0o600,\n })\n await rename(tmpPath, statePath)\n return true\n } catch {\n try {\n await unlink(tmpPath)\n } catch {\n /* nothing to clean up */\n }\n return false\n }\n}\n\n/** `stat`-based existence probe (async I/O discipline). */\nasync function pathExists(path: string): Promise<boolean> {\n try {\n await stat(path)\n return true\n } catch {\n return false\n }\n}\n\n/**\n * Default state path: `<configDir>/.pantheon/whats-new.json`, resolving the\n * OpenCode config directory exactly like src/pantheon/tui-version-check.ts\n * (`$XDG_CONFIG_HOME/opencode` → `~/.opencode`), defaulting to the XDG\n * location `init` creates when neither exists yet.\n */\nexport async function defaultWhatsNewStatePath(\n env: Env = process.env,\n home: string = homedir(),\n): Promise<string> {\n const xdgConfig = env.XDG_CONFIG_HOME || join(home, '.config')\n const primary = join(xdgConfig, 'opencode')\n if (await pathExists(primary)) return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n const legacy = join(home, '.opencode')\n if (await pathExists(legacy)) return join(legacy, '.pantheon', WHATS_NEW_STATE_FILENAME)\n\n return join(primary, '.pantheon', WHATS_NEW_STATE_FILENAME)\n}\n","/**\n * whats-new-open.ts — the show-once decision for the \"What's new\" window.\n *\n * Plain data in, plain data out: the entrypoints (index.tsx / index-v2.tsx)\n * resolve the running version and the shipped CHANGELOG.md, then hand this\n * module a `show` callback that renders the view data through the host's\n * dialog API. Keeping the decision JSX-free makes the whole one-time flow\n * testable offline (node strips the types natively) — the Solid glue lives in\n * whats-new.tsx.\n *\n * Contract (pinned by tests/tui-whats-new.test.mjs):\n * - shows at most once per version: dismissal marks the version seen;\n * - nothing to show (no version, missing CHANGELOG, empty section) → no\n * window AND no pin — the next start may still show it;\n * - never throws on its own inputs; I/O failures inside the state module\n * are fail-open there.\n */\nimport {\n EMPTY_HIGHLIGHTS,\n extractHighlights,\n type WhatsNewHighlights,\n whatsNewLines,\n whatsNewTitle,\n} from './whats-new-highlights.ts'\nimport { markSeenWhatsNew, shouldShowWhatsNew } from './whats-new-state.ts'\n\n/** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */\nexport const WHATS_NEW_CLOSE_HINT = 'esc/q fechar'\n\n/** Hint variant when the highlights span more than one page. */\nexport const WHATS_NEW_PAGES_HINT = 'esc/q fechar · n próxima · p volta'\n\n/** The CHANGELOG pointer shown under the highlights (the window summarizes; the file is complete). */\nexport const WHATS_NEW_MORE_HINT = 'CHANGELOG completo: CHANGELOG.md no pacote'\n\n/** Rows per page — bounded so no changelog can overflow the terminal. */\nexport const WHATS_NEW_PAGE_SIZE = 14\n\n/** Hard-wrap one display line into rows of at most `width` columns (>= 10). */\nexport function wrapWhatsNewLine(line: string, width: number): string[] {\n const bounded = Number.isInteger(width) && width > 10 ? width : 76\n const text = String(line)\n if (text.length <= bounded) return [text]\n const rows: string[] = []\n let rest = text\n while (rest.length > bounded) {\n rows.push(rest.slice(0, bounded))\n rest = rest.slice(bounded)\n }\n if (rest.length > 0) rows.push(rest)\n return rows\n}\n\n/** Slice display lines into fixed-size pages (>= 1 page, empty-safe). */\nexport function paginateWhatsNewLines(\n lines: string[],\n pageSize: number = WHATS_NEW_PAGE_SIZE,\n): string[][] {\n const size = Number.isInteger(pageSize) && pageSize > 0 ? pageSize : WHATS_NEW_PAGE_SIZE\n if (lines.length === 0) return [[]]\n const pages: string[][] = []\n for (let i = 0; i < lines.length; i += size) pages.push(lines.slice(i, i + size))\n return pages\n}\n\n/** Everything the window needs to render — no host types, no JSX. */\nexport interface WhatsNewViewData {\n version: string\n title: string\n lines: string[]\n /** Fixed-size pages of `lines` (single page when the highlights are short). */\n pages: string[][]\n hint: string\n}\n\nexport type WhatsNewShowFn = (render: () => WhatsNewViewData, onClose: () => void) => void\n\nexport interface WhatsNewOpenInput {\n /** Running Pantheon version (null when unresolvable → no window). */\n version: string | null\n /** Path of the seen-version state file (see whats-new-state.ts). */\n statePath: string\n /** Shipped CHANGELOG.md content, or null when unreadable. */\n changelogText: string | null\n /** Host dialog opener; `onClose` fires on host dismissal (ESC / chrome). */\n show: WhatsNewShowFn\n}\n\n/**\n * Open the one-time window when the version changed and highlights exist.\n * Returns true when the window was shown; the caller's `onClose` callback\n * (both host-initiated and local close binds) must funnel into marking seen.\n */\nexport async function openWhatsNew(input: WhatsNewOpenInput): Promise<boolean> {\n const { version, statePath, changelogText, show } = input\n if (typeof version !== 'string' || version.trim() === '') return false\n if (!(await shouldShowWhatsNew(version, statePath))) return false\n\n const highlights: WhatsNewHighlights = changelogText\n ? extractHighlights(changelogText, version)\n : { ...EMPTY_HIGHLIGHTS }\n const lines = whatsNewLines(highlights)\n if (lines.length === 0) return false\n\n const pages = paginateWhatsNewLines(lines)\n const data: WhatsNewViewData = {\n version,\n title: whatsNewTitle(version),\n lines,\n pages,\n hint: pages.length > 1 ? WHATS_NEW_PAGES_HINT : WHATS_NEW_CLOSE_HINT,\n }\n show(\n () => data,\n () => {\n void markSeenWhatsNew(version, statePath)\n },\n )\n return true\n}\n"],"mappings":";;;;;;;;;AAIA,MAAa,oBAAoB;AACjC,MAAa,0BAA0B;AACvC,MAAa,yBAAyB;AAEtC,SAASA,eAAa,OAA+B;CACnD,OAAO,OAAO,UAAU,YAAY,OAAO,SAAS,KAAK,IAAI,QAAQ;AACvE;AAEA,SAAgB,iBAAiB,SAAsC;CACrE,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,IAAI,UAAU,IAAI,OAAO;CACzB,OAAO;AACT;AAEA,SAAgB,iBAAiB,QAAkD;CACjF,MAAM,QAAQA,eAAa,MAAM;CACjC,IAAI,UAAU,QAAQ,QAAQ,GAAG,OAAO;CACxC,OAAO,KAAK,MAAM,KAAK,CAAC,CAAC,eAAe,OAAO;AACjD;AAEA,SAAgB,oBAAoB,OAAiD;CACnF,MAAM,QAAQA,eAAa,KAAK;CAChC,IAAI,UAAU,QAAQ,SAAS,GAAG,OAAO;CACzC,IAAI,SAAS,KAAW,OAAO,IAAI,QAAQ,IAAA,CAAW,QAAQ,CAAC,EAAE;CACjE,IAAI,SAAS,KAAO,OAAO,GAAG,KAAK,MAAM,QAAQ,GAAK,EAAE;CACxD,OAAO,GAAG,KAAK,MAAM,KAAK;AAC5B;AAEA,SAAgB,iBAAiB,SAAiB,QAAA,IAAmC;CACnF,MAAM,QAAQ,KAAK,IAAI,GAAG,KAAK,MAAM,KAAK,CAAC;CAC3C,MAAM,SAAS,KAAK,MAAO,UAAU,MAAO,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MAAM,EAAE,SAAS,WAAW,eAAe,SAAS;CACpD,IAAI,OAAO,YAAY,YAAY,QAAQ,KAAK,MAAM,IAAI,OAAO;CACjE,IAAI,CAAE,MAAM,mBAAmB,SAAS,SAAS,GAAI,OAAO;CAK5D,MAAM,QAAQ,cAHyB,gBACnC,kBAAkB,eAAe,OAAO,IACxC,EAAE,GAAG,iBAAiB,CACY;CACtC,IAAI,MAAM,WAAW,GAAG,OAAO;CAE/B,MAAM,QAAQ,sBAAsB,KAAK;CACzC,MAAM,OAAyB;EAC7B;EACA,OAAO,cAAc,OAAO;EAC5B;EACA;EACA,MAAM,MAAM,SAAS,IAAI,uBAAuB;CAClD;CACA,WACQ,YACA;EACJ,iBAAsB,SAAS,SAAS;CAC1C,CACF;CACA,OAAO;AACT"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
|
-
"version": "1.6.3-beta.
|
|
3
|
+
"version": "1.6.3-beta.12",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "pantheon-tui",
|
|
9
|
-
"version": "1.6.3-beta.
|
|
9
|
+
"version": "1.6.3-beta.12",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"dependencies": {
|
|
12
12
|
"@opencode-ai/plugin": "1.18.33",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pantheon-tui",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "1.6.3-beta.
|
|
4
|
+
"version": "1.6.3-beta.12",
|
|
5
5
|
"description": "Pantheon TUI plugin — V1 rich sidebar and usage gauges; native V2 status, session and delegation sidebar",
|
|
6
6
|
"license": "MIT",
|
|
7
7
|
"engines": {
|
|
@@ -22,6 +22,15 @@ import { fileURLToPath } from 'node:url'
|
|
|
22
22
|
/** Hard cap on bullets shown in the window (the remainder is counted). */
|
|
23
23
|
export const WHATS_NEW_MAX_ITEMS = 12
|
|
24
24
|
|
|
25
|
+
/**
|
|
26
|
+
* Cap for the curated `🆕 What's New` summary block — the window shows the
|
|
27
|
+
* summary, never the full Added/Changed/Fixed walls.
|
|
28
|
+
*/
|
|
29
|
+
export const WHATS_NEW_SUMMARY_MAX_ITEMS = 6
|
|
30
|
+
|
|
31
|
+
/** Bullets longer than this are truncated with an ellipsis (one-line rule). */
|
|
32
|
+
export const WHATS_NEW_ITEM_MAX_CHARS = 140
|
|
33
|
+
|
|
25
34
|
/** Prefix of the "+N more" line appended when the bullet budget is exceeded. */
|
|
26
35
|
export const WHATS_NEW_MORE_PREFIX = '… +'
|
|
27
36
|
|
|
@@ -112,8 +121,38 @@ function stripHeading(text: string): string {
|
|
|
112
121
|
}
|
|
113
122
|
|
|
114
123
|
/**
|
|
115
|
-
* Extract the
|
|
116
|
-
*
|
|
124
|
+
* Extract the curated summary block (`### 🆕 What's New` or `## 🆕 What's New`)
|
|
125
|
+
* from a section body: its bullets only, each truncated to
|
|
126
|
+
* WHATS_NEW_ITEM_MAX_CHARS, capped to WHATS_NEW_SUMMARY_MAX_ITEMS. Null when
|
|
127
|
+
* the section carries no summary block (the full-section fallback applies).
|
|
128
|
+
*/
|
|
129
|
+
export function extractWhatsNewSummary(body: string): string[] | null {
|
|
130
|
+
const lines = body.split('\n')
|
|
131
|
+
const start = lines.findIndex((line) => /^#{2,3}[ \t]+.*What'?s New/i.test(line.trim()))
|
|
132
|
+
if (start === -1) return null
|
|
133
|
+
const items: string[] = []
|
|
134
|
+
for (const rawLine of lines.slice(start + 1)) {
|
|
135
|
+
const line = rawLine.trim()
|
|
136
|
+
if (line === '' || line.startsWith('<!--')) continue
|
|
137
|
+
if (/^#{1,6}[ \t]/.test(line)) break // next subsection — summary ended
|
|
138
|
+
if (!/^[-*][ \t]/.test(line)) continue
|
|
139
|
+
if (items.length >= WHATS_NEW_SUMMARY_MAX_ITEMS) break
|
|
140
|
+
const content = stripMarkdown(line.replace(/^[-*][ \t]+/, ''))
|
|
141
|
+
if (content === '') continue
|
|
142
|
+
items.push(
|
|
143
|
+
content.length > WHATS_NEW_ITEM_MAX_CHARS
|
|
144
|
+
? `${content.slice(0, WHATS_NEW_ITEM_MAX_CHARS - 1)}…`
|
|
145
|
+
: content,
|
|
146
|
+
)
|
|
147
|
+
}
|
|
148
|
+
return items.length > 0 ? items : null
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Extract the release highlights for `version`. When the section carries a
|
|
153
|
+
* curated `🆕 What's New` summary block, THE WINDOW SHOWS ONLY THAT (the
|
|
154
|
+
* full Added/Changed/Fixed walls are for the CHANGELOG readers, not the
|
|
155
|
+
* dialog); otherwise it falls back to the H3-group extraction bounded to
|
|
117
156
|
* WHATS_NEW_MAX_ITEMS bullets. A missing section, a bullet-less section or a
|
|
118
157
|
* blank changelog all return EMPTY_HIGHLIGHTS (no window).
|
|
119
158
|
*/
|
|
@@ -121,6 +160,17 @@ export function extractHighlights(changelogText: string, version: string): Whats
|
|
|
121
160
|
const { found, body } = extractSection(changelogText ?? '', version ?? '')
|
|
122
161
|
if (!found || !body) return { ...EMPTY_HIGHLIGHTS }
|
|
123
162
|
|
|
163
|
+
const summary = extractWhatsNewSummary(body)
|
|
164
|
+
if (summary !== null) {
|
|
165
|
+
return {
|
|
166
|
+
version: String(version).trim().replace(/^v/i, ''),
|
|
167
|
+
found: true,
|
|
168
|
+
groups: [{ heading: null, items: summary }],
|
|
169
|
+
totalItems: summary.length,
|
|
170
|
+
truncated: false,
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
124
174
|
const groups: WhatsNewGroup[] = []
|
|
125
175
|
let totalItems = 0
|
|
126
176
|
let truncated = false
|
|
@@ -149,13 +199,17 @@ export function extractHighlights(changelogText: string, version: string): Whats
|
|
|
149
199
|
|
|
150
200
|
const content = stripMarkdown(isBullet ? line.replace(/^[-*][ \t]+/, '') : line)
|
|
151
201
|
if (content === '') continue
|
|
202
|
+
const bounded =
|
|
203
|
+
content.length > WHATS_NEW_ITEM_MAX_CHARS
|
|
204
|
+
? `${content.slice(0, WHATS_NEW_ITEM_MAX_CHARS - 1)}…`
|
|
205
|
+
: content
|
|
152
206
|
const group = groups.at(-1)
|
|
153
207
|
if (group === undefined) {
|
|
154
|
-
groups.push({ heading: null, items: [
|
|
208
|
+
groups.push({ heading: null, items: [bounded] })
|
|
155
209
|
} else if (isBullet || group.items.length === 0) {
|
|
156
|
-
group.items.push(
|
|
210
|
+
group.items.push(bounded)
|
|
157
211
|
} else {
|
|
158
|
-
group.items[group.items.length - 1] = `${group.items.at(-1)} ${
|
|
212
|
+
group.items[group.items.length - 1] = `${group.items.at(-1)} ${bounded}`.trim()
|
|
159
213
|
}
|
|
160
214
|
if (isBullet) totalItems += 1
|
|
161
215
|
}
|
|
@@ -27,11 +27,49 @@ import { markSeenWhatsNew, shouldShowWhatsNew } from './whats-new-state.ts'
|
|
|
27
27
|
/** Muted footer hint teaching the dismiss bind (Portuguese, like the sidebar). */
|
|
28
28
|
export const WHATS_NEW_CLOSE_HINT = 'esc/q fechar'
|
|
29
29
|
|
|
30
|
+
/** Hint variant when the highlights span more than one page. */
|
|
31
|
+
export const WHATS_NEW_PAGES_HINT = 'esc/q fechar · n próxima · p volta'
|
|
32
|
+
|
|
33
|
+
/** The CHANGELOG pointer shown under the highlights (the window summarizes; the file is complete). */
|
|
34
|
+
export const WHATS_NEW_MORE_HINT = 'CHANGELOG completo: CHANGELOG.md no pacote'
|
|
35
|
+
|
|
36
|
+
/** Rows per page — bounded so no changelog can overflow the terminal. */
|
|
37
|
+
export const WHATS_NEW_PAGE_SIZE = 14
|
|
38
|
+
|
|
39
|
+
/** Hard-wrap one display line into rows of at most `width` columns (>= 10). */
|
|
40
|
+
export function wrapWhatsNewLine(line: string, width: number): string[] {
|
|
41
|
+
const bounded = Number.isInteger(width) && width > 10 ? width : 76
|
|
42
|
+
const text = String(line)
|
|
43
|
+
if (text.length <= bounded) return [text]
|
|
44
|
+
const rows: string[] = []
|
|
45
|
+
let rest = text
|
|
46
|
+
while (rest.length > bounded) {
|
|
47
|
+
rows.push(rest.slice(0, bounded))
|
|
48
|
+
rest = rest.slice(bounded)
|
|
49
|
+
}
|
|
50
|
+
if (rest.length > 0) rows.push(rest)
|
|
51
|
+
return rows
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
/** Slice display lines into fixed-size pages (>= 1 page, empty-safe). */
|
|
55
|
+
export function paginateWhatsNewLines(
|
|
56
|
+
lines: string[],
|
|
57
|
+
pageSize: number = WHATS_NEW_PAGE_SIZE,
|
|
58
|
+
): string[][] {
|
|
59
|
+
const size = Number.isInteger(pageSize) && pageSize > 0 ? pageSize : WHATS_NEW_PAGE_SIZE
|
|
60
|
+
if (lines.length === 0) return [[]]
|
|
61
|
+
const pages: string[][] = []
|
|
62
|
+
for (let i = 0; i < lines.length; i += size) pages.push(lines.slice(i, i + size))
|
|
63
|
+
return pages
|
|
64
|
+
}
|
|
65
|
+
|
|
30
66
|
/** Everything the window needs to render — no host types, no JSX. */
|
|
31
67
|
export interface WhatsNewViewData {
|
|
32
68
|
version: string
|
|
33
69
|
title: string
|
|
34
70
|
lines: string[]
|
|
71
|
+
/** Fixed-size pages of `lines` (single page when the highlights are short). */
|
|
72
|
+
pages: string[][]
|
|
35
73
|
hint: string
|
|
36
74
|
}
|
|
37
75
|
|
|
@@ -64,11 +102,13 @@ export async function openWhatsNew(input: WhatsNewOpenInput): Promise<boolean> {
|
|
|
64
102
|
const lines = whatsNewLines(highlights)
|
|
65
103
|
if (lines.length === 0) return false
|
|
66
104
|
|
|
105
|
+
const pages = paginateWhatsNewLines(lines)
|
|
67
106
|
const data: WhatsNewViewData = {
|
|
68
107
|
version,
|
|
69
108
|
title: whatsNewTitle(version),
|
|
70
109
|
lines,
|
|
71
|
-
|
|
110
|
+
pages,
|
|
111
|
+
hint: pages.length > 1 ? WHATS_NEW_PAGES_HINT : WHATS_NEW_CLOSE_HINT,
|
|
72
112
|
}
|
|
73
113
|
show(
|
|
74
114
|
() => data,
|
|
@@ -10,8 +10,13 @@
|
|
|
10
10
|
* awaited — startup must never block). The decision lives in
|
|
11
11
|
* whats-new-open.ts; this file is only the host glue + view:
|
|
12
12
|
* `context.ui.dialog.show` plus a keymap layer gated on the open signal so
|
|
13
|
-
* `escape`/`q` dismiss while (and only while) the
|
|
14
|
-
* gated-layer pattern as the dispatch panel.
|
|
13
|
+
* `escape`/`q` dismiss and `n`/`p` flip pages while (and only while) the
|
|
14
|
+
* window is up — the same gated-layer pattern as the dispatch panel.
|
|
15
|
+
*
|
|
16
|
+
* The window shows the curated 🆕 What's New summary (whats-new-highlights
|
|
17
|
+
* prefers it), hard-wrapped to the window width and sliced into fixed-size
|
|
18
|
+
* pages — a big changelog can never overflow the terminal; the footer points
|
|
19
|
+
* at the complete CHANGELOG.md.
|
|
15
20
|
*
|
|
16
21
|
* Deliberately V2-only: the two dist entries are self-contained (the V1
|
|
17
22
|
* sidebar mirrors the preset resolver rather than importing it) because any
|
|
@@ -29,22 +34,37 @@
|
|
|
29
34
|
import type { Context } from '@opencode/plugin/tui/context'
|
|
30
35
|
import { createSignal, For } from 'solid-js'
|
|
31
36
|
import { readChangelogForBundle, resolveRunningVersion } from './whats-new-highlights.ts'
|
|
32
|
-
import { openWhatsNew, type WhatsNewViewData } from './whats-new-open.ts'
|
|
37
|
+
import { openWhatsNew, type WhatsNewViewData, wrapWhatsNewLine } from './whats-new-open.ts'
|
|
33
38
|
import { defaultWhatsNewStatePath } from './whats-new-state.ts'
|
|
34
39
|
|
|
35
|
-
/** Window body: title, rule,
|
|
36
|
-
export function WhatsNewContent(props: {
|
|
40
|
+
/** Window body: title, rule, the current page (wrapped), footer hint. */
|
|
41
|
+
export function WhatsNewContent(props: {
|
|
42
|
+
data: WhatsNewViewData
|
|
43
|
+
page: () => number
|
|
44
|
+
pageCount: () => number
|
|
45
|
+
fg?: any
|
|
46
|
+
muted?: any
|
|
47
|
+
}) {
|
|
48
|
+
const rows = () => {
|
|
49
|
+
const current = props.data.pages[Math.min(props.page(), props.pageCount() - 1)] ?? []
|
|
50
|
+
const wrapped: string[] = []
|
|
51
|
+
for (const line of current) wrapped.push(...wrapWhatsNewLine(line, 76))
|
|
52
|
+
return wrapped
|
|
53
|
+
}
|
|
37
54
|
return (
|
|
38
55
|
<box flexDirection="column" paddingLeft={1} paddingRight={1} paddingTop={1}>
|
|
39
56
|
<text attributes={1} fg={props.fg}>
|
|
40
57
|
{props.data.title}
|
|
41
58
|
</text>
|
|
42
59
|
<text fg={props.muted}>{'─'.repeat(38)}</text>
|
|
43
|
-
<For each={
|
|
60
|
+
<For each={rows()}>
|
|
44
61
|
{(line: string) => <text fg={line.startsWith('• ') ? props.fg : props.muted}>{line}</text>}
|
|
45
62
|
</For>
|
|
46
63
|
<box height={1} />
|
|
47
|
-
<text fg={props.muted}>
|
|
64
|
+
<text fg={props.muted}>
|
|
65
|
+
{props.pageCount() > 1 ? `${props.page() + 1}/${props.pageCount()} · ` : ''}
|
|
66
|
+
{props.data.hint}
|
|
67
|
+
</text>
|
|
48
68
|
</box>
|
|
49
69
|
)
|
|
50
70
|
}
|
|
@@ -61,6 +81,9 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
|
|
|
61
81
|
const changelogText = await readChangelogForBundle(import.meta.url)
|
|
62
82
|
|
|
63
83
|
const [open, setOpen] = createSignal(false)
|
|
84
|
+
const [page, setPage] = createSignal(0)
|
|
85
|
+
let viewData: WhatsNewViewData | undefined
|
|
86
|
+
const pageCount = () => Math.max(1, Math.ceil(viewData?.pages.length ?? 1))
|
|
64
87
|
let dismiss: () => void = () => {}
|
|
65
88
|
try {
|
|
66
89
|
// Gated layer: inert (all keys fall through) while the window is closed.
|
|
@@ -78,6 +101,26 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
|
|
|
78
101
|
return undefined
|
|
79
102
|
},
|
|
80
103
|
},
|
|
104
|
+
{
|
|
105
|
+
id: 'pantheon.whats-new.next',
|
|
106
|
+
title: 'Próxima página',
|
|
107
|
+
bind: 'n,right',
|
|
108
|
+
run: () => {
|
|
109
|
+
if (!open()) return false
|
|
110
|
+
setPage((current) => Math.min(current + 1, pageCount() - 1))
|
|
111
|
+
return undefined
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
id: 'pantheon.whats-new.prev',
|
|
116
|
+
title: 'Página anterior',
|
|
117
|
+
bind: 'p,left',
|
|
118
|
+
run: () => {
|
|
119
|
+
if (!open()) return false
|
|
120
|
+
setPage((current) => Math.max(current - 1, 0))
|
|
121
|
+
return undefined
|
|
122
|
+
},
|
|
123
|
+
},
|
|
81
124
|
],
|
|
82
125
|
}))
|
|
83
126
|
} catch {
|
|
@@ -101,11 +144,21 @@ export async function maybeShowWhatsNewV2(context: Context): Promise<void> {
|
|
|
101
144
|
}
|
|
102
145
|
close()
|
|
103
146
|
}
|
|
147
|
+
viewData = render()
|
|
148
|
+
setPage(0)
|
|
104
149
|
setOpen(true)
|
|
105
150
|
try {
|
|
106
151
|
const theme = context.theme?.text ?? {}
|
|
107
152
|
context.ui.dialog.show(
|
|
108
|
-
() =>
|
|
153
|
+
() => (
|
|
154
|
+
<WhatsNewContent
|
|
155
|
+
data={viewData as WhatsNewViewData}
|
|
156
|
+
page={page}
|
|
157
|
+
pageCount={pageCount}
|
|
158
|
+
fg={theme.base}
|
|
159
|
+
muted={theme.muted}
|
|
160
|
+
/>
|
|
161
|
+
),
|
|
109
162
|
close,
|
|
110
163
|
)
|
|
111
164
|
} catch {
|