pantheon-opencode 1.6.3-beta.6 → 1.7.0-beta.1
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/AGENTS.global.md +1 -1
- package/AGENTS.md +1 -1
- package/CHANGELOG.md +201 -0
- package/README.md +16 -2
- package/README.pt-BR.md +1 -1
- package/bin/pantheon-init.mjs +46 -28
- package/package.json +2 -2
- package/plugin.json +2 -2
- package/pyproject.toml +1 -1
- package/scripts/decision-router-budget.mjs +102 -2
- package/scripts/decision-router-v2-budget.mjs +2 -2
- package/scripts/decision-router.mjs +82 -25
- package/scripts/doctor.mjs +4 -1
- package/scripts/install/cli-ui.mjs +2 -1
- package/scripts/install/decision-router-config.mjs +12 -4
- package/scripts/install/interactive.mjs +45 -28
- package/scripts/install/opencode.mjs +151 -30
- package/scripts/jev-live-probe.mjs +212 -0
- package/scripts/skill-search.mjs +273 -0
- package/skills-lock.json +3 -1
- package/src/agents/aphrodite.md +34 -1
- package/src/agents/apollo.md +227 -0
- package/src/agents/athena.md +26 -0
- package/src/agents/demeter.md +33 -0
- package/src/agents/gaia.md +24 -0
- package/src/agents/hephaestus.md +24 -0
- package/src/agents/hermes.md +33 -0
- package/src/agents/iris.md +24 -0
- package/src/agents/mnemosyne.md +25 -3
- package/src/agents/nyx.md +50 -22
- package/src/agents/prometheus.md +242 -1
- package/src/agents/talos.md +24 -0
- package/src/agents/themis.md +24 -0
- package/src/agents/zeus.md +81 -6
- package/src/pantheon/j1-approvals.ts +123 -0
- package/src/pantheon/jev-decision-tool.ts +293 -35
- package/src/pantheon/jev-decisions.ts +95 -12
- package/src/pantheon/jev-escalation.ts +1 -1
- package/src/pantheon/jev-quality-score.ts +45 -10
- package/src/pantheon/jev-rank-verify.ts +665 -0
- package/src/pantheon/jev-risk-gate.ts +82 -12
- package/src/pantheon/local-decision-budget.ts +169 -2
- package/src/pantheon/local-decision-prompt.ts +2 -0
- package/src/pantheon/local-decision-router.ts +16 -0
- package/src/pantheon/local-decision-turn.ts +110 -4
- package/src/pantheon/local-decision-usage-evidence.internal.ts +2 -2
- package/src/pantheon/pantheon-decision-catalog.ts +9 -2
- package/src/pantheon/v2-decision-budget.ts +4 -2
- package/src/pantheon/v2-tools.ts +42 -0
- package/src/plugin-v2.ts +85 -5
- package/src/plugins/tui/dist/server-v2.d.ts +14 -6
- package/src/plugins/tui/dist/server-v2.d.ts.map +1 -1
- package/src/plugins/tui/dist/server-v2.js +16 -9
- package/src/plugins/tui/dist/server-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui-v2.js +128 -25
- package/src/plugins/tui/dist/tui-v2.js.map +1 -1
- package/src/plugins/tui/dist/tui.js +1 -1
- package/src/plugins/tui/package-lock.json +2 -2
- package/src/plugins/tui/package.json +1 -1
- package/src/plugins/tui/src/server-v2.ts +14 -7
- 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/src/routing.yml +2 -0
- package/src/skills/README.md +1 -1
- package/src/skills/agent-forge/SKILL.md +76 -0
- package/src/skills/auto-continue/SKILL.md +12 -163
- package/src/skills/auto-continue/references/auto-continue-details.md +175 -0
- package/src/skills/prompt-refinery/SKILL.md +60 -0
package/src/pantheon/v2-tools.ts
CHANGED
|
@@ -447,6 +447,47 @@ export interface V2ToolShadowOptions {
|
|
|
447
447
|
* per-call definition with no construction-time I/O. A fresh descriptor array
|
|
448
448
|
* prevents callers from mutating another registration's definitions.
|
|
449
449
|
*/
|
|
450
|
+
/** JSON Schema for `todowrite` — the TUI todo panel's feed (full replace). */
|
|
451
|
+
const TODOWRITE_INPUT = {
|
|
452
|
+
type: 'object',
|
|
453
|
+
additionalProperties: false,
|
|
454
|
+
required: ['todos'],
|
|
455
|
+
properties: {
|
|
456
|
+
todos: {
|
|
457
|
+
type: 'array',
|
|
458
|
+
minItems: 1,
|
|
459
|
+
maxItems: 50,
|
|
460
|
+
items: {
|
|
461
|
+
type: 'object',
|
|
462
|
+
additionalProperties: false,
|
|
463
|
+
required: ['content', 'status'],
|
|
464
|
+
properties: {
|
|
465
|
+
content: { type: 'string', minLength: 1, maxLength: 500 },
|
|
466
|
+
status: { type: 'string', enum: ['pending', 'in_progress', 'completed', 'cancelled'] },
|
|
467
|
+
},
|
|
468
|
+
},
|
|
469
|
+
},
|
|
470
|
+
},
|
|
471
|
+
} as const
|
|
472
|
+
|
|
473
|
+
/** A V2 pass-through `todowrite`: the host stores the tool part in the
|
|
474
|
+
* transcript, and the TUI todo panel renders the newest completed write. The
|
|
475
|
+
* tool itself is stateless — the transcript IS the store. */
|
|
476
|
+
const todowriteTool: V2ToolDef = {
|
|
477
|
+
name: 'todowrite',
|
|
478
|
+
description:
|
|
479
|
+
'Write the session task checklist (full replace). The TUI todo panel renders the ' +
|
|
480
|
+
'newest list; mark each item in_progress/completed as soon as its state changes.',
|
|
481
|
+
input: TODOWRITE_INPUT,
|
|
482
|
+
output: {},
|
|
483
|
+
execute: async (input) => {
|
|
484
|
+
const todos = Array.isArray((input as Record<string, unknown>).todos)
|
|
485
|
+
? (input as Record<string, unknown>).todos
|
|
486
|
+
: []
|
|
487
|
+
return { ok: true, todos, output: JSON.stringify({ todos }) }
|
|
488
|
+
},
|
|
489
|
+
}
|
|
490
|
+
|
|
450
491
|
export function createV2ToolDefinitions(
|
|
451
492
|
visionRuntime?: V2VisionRuntime,
|
|
452
493
|
shadow: V2ToolShadowOptions = {},
|
|
@@ -497,6 +538,7 @@ export function createV2ToolDefinitions(
|
|
|
497
538
|
...(shadow.complexitySink === undefined ? {} : { sink: shadow.complexitySink }),
|
|
498
539
|
}),
|
|
499
540
|
)
|
|
541
|
+
definitions.push(todowriteTool)
|
|
500
542
|
if (visionRuntime) definitions.push(createV2VisionTool(visionRuntime))
|
|
501
543
|
if (jevRuntime) definitions.push(createV2JevDecisionDefinition(jevRuntime))
|
|
502
544
|
return definitions
|
package/src/plugin-v2.ts
CHANGED
|
@@ -116,6 +116,13 @@ import {
|
|
|
116
116
|
import { GOAL_LOOP_DEFAULTS, GoalStore } from './pantheon/goal-loop.ts'
|
|
117
117
|
import { createGuardPathResolver } from './pantheon/guard-path.ts'
|
|
118
118
|
import { createJTelemetryMirror } from './pantheon/j-telemetry-file.ts'
|
|
119
|
+
import {
|
|
120
|
+
approvalInputHash,
|
|
121
|
+
hasApproval,
|
|
122
|
+
isAffirmativeAnswer,
|
|
123
|
+
j1ApprovalMarker,
|
|
124
|
+
mintApproval,
|
|
125
|
+
} from './pantheon/j1-approvals.ts'
|
|
119
126
|
import type { V2JevDecisionRuntime } from './pantheon/jev-decision-tool.ts'
|
|
120
127
|
import { specialistCallerAllowlist } from './pantheon/jev-decision-tool.ts'
|
|
121
128
|
import {
|
|
@@ -126,7 +133,9 @@ import {
|
|
|
126
133
|
import {
|
|
127
134
|
createJ1RiskGateObserver,
|
|
128
135
|
isRiskGateTarget,
|
|
129
|
-
|
|
136
|
+
type J1Verdict,
|
|
137
|
+
j1EnforceThresholdFromEnv,
|
|
138
|
+
j1ModeFromEnv,
|
|
130
139
|
} from './pantheon/jev-risk-gate.ts'
|
|
131
140
|
import { DECISION_EGRESS_ACTION } from './pantheon/local-decision-egress-gate.ts'
|
|
132
141
|
import { applyDecisionRouterToPrompt } from './pantheon/local-decision-prompt.ts'
|
|
@@ -1984,14 +1993,17 @@ async function registerV2ToolHooks(
|
|
|
1984
1993
|
// ledger reservation, permission kill-switch) and records shadow records
|
|
1985
1994
|
// only — it is fired WITHOUT await inside the before-handler (fire-and-
|
|
1986
1995
|
// observe), self-bounds at 2s with an AbortController, and never retries.
|
|
1987
|
-
|
|
1988
|
-
|
|
1996
|
+
const j1Mode = j1ModeFromEnv()
|
|
1997
|
+
let j1Observer: ((event: unknown) => Promise<J1Verdict | undefined>) | undefined
|
|
1998
|
+
if (jevRuntime !== undefined && j1Mode !== 'off') {
|
|
1989
1999
|
const j1Sink = createTelemetrySink()
|
|
1990
2000
|
j1TelemetrySink = j1Sink
|
|
1991
2001
|
j1Observer = createJ1RiskGateObserver({
|
|
1992
2002
|
runtime: jevRuntime,
|
|
2003
|
+
mode: j1Mode,
|
|
2004
|
+
threshold: j1EnforceThresholdFromEnv(),
|
|
1993
2005
|
sink: (record) => {
|
|
1994
|
-
j1Sink.emit({ ...record, mode: 'shadow' })
|
|
2006
|
+
j1Sink.emit({ ...record, mode: j1Mode === 'enforce' ? 'enforce' : 'shadow' })
|
|
1995
2007
|
},
|
|
1996
2008
|
})
|
|
1997
2009
|
}
|
|
@@ -2148,7 +2160,46 @@ async function registerV2ToolHooks(
|
|
|
2148
2160
|
// the flag is off — the only cost of the flag-on check below is the
|
|
2149
2161
|
// truthiness read.
|
|
2150
2162
|
if (j1Observer !== undefined && isRiskGateTarget((event as { tool?: unknown }).tool)) {
|
|
2151
|
-
|
|
2163
|
+
// Ladder semantics: shadow/warn stay fire-and-observe (latency
|
|
2164
|
+
// unchanged); ENFORCE awaits (bounded 2s) and DENIES via throw —
|
|
2165
|
+
// the host surfaces the thrown message in the session, which is the
|
|
2166
|
+
// block's visible form. Unavailability never denies (fail-open by
|
|
2167
|
+
// design: a dead budget must not brick every shell call).
|
|
2168
|
+
if (j1Mode === 'enforce') {
|
|
2169
|
+
// The approval path (field beta.21: "exigir uma aprovação explícita
|
|
2170
|
+
// para execução" — a deny must be askable, not destructive): an
|
|
2171
|
+
// approved retry of the EXACT call (session + input hash, TTL
|
|
2172
|
+
// bounded) passes without re-asking.
|
|
2173
|
+
const enforceEvent = event as { tool?: unknown; input?: unknown; sessionID?: unknown }
|
|
2174
|
+
const sessionID =
|
|
2175
|
+
typeof enforceEvent.sessionID === 'string' ? enforceEvent.sessionID : ''
|
|
2176
|
+
const inputHash = approvalInputHash(enforceEvent.input)
|
|
2177
|
+
if (sessionID !== '' && hasApproval(sessionID, inputHash)) {
|
|
2178
|
+
// Approved by the user: execute — and still observe (the
|
|
2179
|
+
// approved execution is exactly the record the baseline wants).
|
|
2180
|
+
void j1Observer(event)
|
|
2181
|
+
return
|
|
2182
|
+
}
|
|
2183
|
+
const verdict = (await j1Observer(event)) as J1Verdict | undefined
|
|
2184
|
+
if (verdict?.block === true) {
|
|
2185
|
+
// The block is an APPROVAL REQUEST (not an error to route
|
|
2186
|
+
// around): ask the user through the `question` tool with the
|
|
2187
|
+
// marker below; an affirmative answer mints a hash-pinned,
|
|
2188
|
+
// TTL-bounded approval and the retry passes. Never echo the
|
|
2189
|
+
// tool input here — the arguments may carry the very secret
|
|
2190
|
+
// the risk score flagged; the agent owns its own rendering.
|
|
2191
|
+
throw new Error(
|
|
2192
|
+
`[J1 enforce] risco ${verdict.riskScore?.toFixed(2)} >= threshold ` +
|
|
2193
|
+
`— APROVAÇÃO EXPLÍCITA NECESSÁRIA: use a tool question com o nome ` +
|
|
2194
|
+
`"${j1ApprovalMarker(inputHash)}" perguntando ao USUÁRIO se aprova esta exata chamada ` +
|
|
2195
|
+
'(apresente a ferramenta e o que ela faria, sem executá-la nem contorná-la). ' +
|
|
2196
|
+
'Se ele aprovar, reintente a MESMA chamada — ela passará. Se ele recusar, siga sem o ' +
|
|
2197
|
+
'passo arriscado ou entregue a execução manual a ele.',
|
|
2198
|
+
)
|
|
2199
|
+
}
|
|
2200
|
+
} else {
|
|
2201
|
+
void j1Observer(event)
|
|
2202
|
+
}
|
|
2152
2203
|
}
|
|
2153
2204
|
// J3 turn-complexity shadow classification. Same fire-and-observe
|
|
2154
2205
|
// discipline as J1: the dispatch's latency is unchanged, the observer
|
|
@@ -2192,6 +2243,35 @@ async function registerV2ToolHooks(
|
|
|
2192
2243
|
try {
|
|
2193
2244
|
subagentOrigins.forget(event)
|
|
2194
2245
|
boundedReadOrigins?.forget(event)
|
|
2246
|
+
// J1 approval minter: the user's affirmative answer to a
|
|
2247
|
+
// `j1-approval-<hash12>` question mints the hash-pinned, TTL-bounded
|
|
2248
|
+
// approval the enforce gate checks. Only the OBSERVED host result can
|
|
2249
|
+
// mint — the agent cannot fabricate an answer.
|
|
2250
|
+
if (j1Mode === 'enforce') {
|
|
2251
|
+
try {
|
|
2252
|
+
const after = (event ?? {}) as {
|
|
2253
|
+
tool?: unknown
|
|
2254
|
+
sessionID?: unknown
|
|
2255
|
+
output?: unknown
|
|
2256
|
+
input?: unknown
|
|
2257
|
+
}
|
|
2258
|
+
if (after.tool === 'question') {
|
|
2259
|
+
const sessionID = typeof after.sessionID === 'string' ? after.sessionID : ''
|
|
2260
|
+
const serialized = JSON.stringify(after.output ?? {}) ?? ''
|
|
2261
|
+
const markerMatch = serialized.match(/j1-approval-([0-9a-f]{12})/)
|
|
2262
|
+
const markerHash = markerMatch?.[1]
|
|
2263
|
+
if (sessionID !== '' && markerHash !== undefined) {
|
|
2264
|
+
const name = `j1-approval-${markerHash}`
|
|
2265
|
+
if (isAffirmativeAnswer(name, serialized)) {
|
|
2266
|
+
mintApproval(sessionID, markerHash)
|
|
2267
|
+
}
|
|
2268
|
+
}
|
|
2269
|
+
}
|
|
2270
|
+
} catch {
|
|
2271
|
+
// The minter is best-effort; a parse failure just means no
|
|
2272
|
+
// approval (fail-closed).
|
|
2273
|
+
}
|
|
2274
|
+
}
|
|
2195
2275
|
await v2ExecuteAfter(event)
|
|
2196
2276
|
// Formatter + delegation audit STOP (#266). Awaited for the same
|
|
2197
2277
|
// reason V1 awaits it: the log record should exist before the tool
|
|
@@ -11,12 +11,20 @@
|
|
|
11
11
|
* channel — the initial JSX mounts but effects/refresh/events stay dead (the
|
|
12
12
|
* "mudo panel" symptom; same contract as the V1 `server.ts` stub).
|
|
13
13
|
*
|
|
14
|
-
* This stub satisfies the loader contract.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* This stub satisfies the loader contract. Field report (beta.13): host 2.2.5
|
|
15
|
+
* validates the default export as a DEFINITION OBJECT — "Plugin must export a
|
|
16
|
+
* default definition with an id and an effect or setup function
|
|
17
|
+
* (SchemaError(Expected object at ["default"]))" — the bare `server()`
|
|
18
|
+
* function form failed that schema on every boot (~3.4k load failures in the
|
|
19
|
+
* host log). The native quota RPC that used to live here was removed in 1.6.2
|
|
20
|
+
* — provider quota/usage visibility is now the community plugin's job
|
|
21
|
+
* (`@slkiser/opencode-quota`, docs/tui-v2-quota-providers.md) — and
|
|
22
|
+
* pantheon-tui has no other background server work of its own.
|
|
19
23
|
*/
|
|
20
|
-
|
|
24
|
+
declare const _default: {
|
|
25
|
+
id: string;
|
|
26
|
+
setup(): {};
|
|
27
|
+
};
|
|
21
28
|
//#endregion
|
|
29
|
+
export { _default as default };
|
|
22
30
|
//# sourceMappingURL=server-v2.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-v2.d.ts","names":[],"sources":["../src/server-v2.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-v2.d.ts","names":[],"sources":["../src/server-v2.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;cAAA;EAuBE;EACA"}
|
|
@@ -11,16 +11,23 @@
|
|
|
11
11
|
* channel — the initial JSX mounts but effects/refresh/events stay dead (the
|
|
12
12
|
* "mudo panel" symptom; same contract as the V1 `server.ts` stub).
|
|
13
13
|
*
|
|
14
|
-
* This stub satisfies the loader contract.
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* This stub satisfies the loader contract. Field report (beta.13): host 2.2.5
|
|
15
|
+
* validates the default export as a DEFINITION OBJECT — "Plugin must export a
|
|
16
|
+
* default definition with an id and an effect or setup function
|
|
17
|
+
* (SchemaError(Expected object at ["default"]))" — the bare `server()`
|
|
18
|
+
* function form failed that schema on every boot (~3.4k load failures in the
|
|
19
|
+
* host log). The native quota RPC that used to live here was removed in 1.6.2
|
|
20
|
+
* — provider quota/usage visibility is now the community plugin's job
|
|
21
|
+
* (`@slkiser/opencode-quota`, docs/tui-v2-quota-providers.md) — and
|
|
22
|
+
* pantheon-tui has no other background server work of its own.
|
|
19
23
|
*/
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
24
|
+
var server_v2_default = {
|
|
25
|
+
id: "pantheon.tui.server",
|
|
26
|
+
setup() {
|
|
27
|
+
return {};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
23
30
|
//#endregion
|
|
24
|
-
export {
|
|
31
|
+
export { server_v2_default as default };
|
|
25
32
|
|
|
26
33
|
//# sourceMappingURL=server-v2.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-v2.js","names":[],"sources":["../src/server-v2.ts"],"sourcesContent":["/**\n * No-op server stub for the OpenCode V2 plugin loader.\n *\n * The OpenCode plugin host requires every plugin (TUI included) to expose a\n * `server()` entry via `exports[\"./server\"]` (or package.json `main`) — for the\n * V2 copy this root `index-v2.ts` re-export resolves to this compiled entry —\n * and it loads that server half only from a `config.plugins` entry (see\n * `scripts/install/opencode.mjs`). When the entry is missing the host fails to\n * attach the plugin's server half and the TUI runtime never wires the reactive\n * channel — the initial JSX mounts but effects/refresh/events stay dead (the\n * \"mudo panel\" symptom; same contract as the V1 `server.ts` stub).\n *\n * This stub satisfies the loader contract. The native quota RPC that used to
|
|
1
|
+
{"version":3,"file":"server-v2.js","names":[],"sources":["../src/server-v2.ts"],"sourcesContent":["/**\n * No-op server stub for the OpenCode V2 plugin loader.\n *\n * The OpenCode plugin host requires every plugin (TUI included) to expose a\n * `server()` entry via `exports[\"./server\"]` (or package.json `main`) — for the\n * V2 copy this root `index-v2.ts` re-export resolves to this compiled entry —\n * and it loads that server half only from a `config.plugins` entry (see\n * `scripts/install/opencode.mjs`). When the entry is missing the host fails to\n * attach the plugin's server half and the TUI runtime never wires the reactive\n * channel — the initial JSX mounts but effects/refresh/events stay dead (the\n * \"mudo panel\" symptom; same contract as the V1 `server.ts` stub).\n *\n * This stub satisfies the loader contract. Field report (beta.13): host 2.2.5\n * validates the default export as a DEFINITION OBJECT — \"Plugin must export a\n * default definition with an id and an effect or setup function\n * (SchemaError(Expected object at [\"default\"]))\" — the bare `server()`\n * function form failed that schema on every boot (~3.4k load failures in the\n * host log). The native quota RPC that used to live here was removed in 1.6.2\n * — provider quota/usage visibility is now the community plugin's job\n * (`@slkiser/opencode-quota`, docs/tui-v2-quota-providers.md) — and\n * pantheon-tui has no other background server work of its own.\n */\nexport default {\n id: 'pantheon.tui.server',\n setup() {\n return {}\n },\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAsBA,IAAA,oBAAe;CACb,IAAI;CACJ,QAAQ;EACN,OAAO,CAAC;CACV;AACF"}
|
|
@@ -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);
|
|
@@ -330,7 +367,7 @@ async function readChangelogForBundle(bundleUrl) {
|
|
|
330
367
|
}
|
|
331
368
|
/** The ambient build-time version, or null outside a tsdown build. */
|
|
332
369
|
function embeddedVersion() {
|
|
333
|
-
return "1.6.3-beta.
|
|
370
|
+
return "1.6.3-beta.28";
|
|
334
371
|
}
|
|
335
372
|
/**
|
|
336
373
|
* Resolve the running Pantheon version for the what's-new window: the plugin
|
|
@@ -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
|
},
|
|
@@ -3649,7 +3752,7 @@ function Sidebar(props) {
|
|
|
3649
3752
|
setProp(_el$12, "width", "100%");
|
|
3650
3753
|
setProp(_el$12, "padding", 1);
|
|
3651
3754
|
setProp(_el$13, "attributes", 1);
|
|
3652
|
-
insert(_el$13, `Pantheon v1.6.3-beta.
|
|
3755
|
+
insert(_el$13, `Pantheon v1.6.3-beta.28`);
|
|
3653
3756
|
insert(_el$14, () => presetHeaderLine(model.preset().name ?? "", model.provider()));
|
|
3654
3757
|
insert(_el$12, createComponent(Show, {
|
|
3655
3758
|
get when() {
|
|
@@ -4370,7 +4473,7 @@ function HomeStatus(props) {
|
|
|
4370
4473
|
const muted = () => props.context.theme?.text?.muted ?? props.context.theme?.text?.base;
|
|
4371
4474
|
return (() => {
|
|
4372
4475
|
var _el$72 = createElement("text");
|
|
4373
|
-
insert(_el$72, () => `Pantheon v1.6.3-beta.
|
|
4476
|
+
insert(_el$72, () => `Pantheon v1.6.3-beta.28${preset().name ? ` ▸ ${preset().name}` : ""}`);
|
|
4374
4477
|
effect((_$p) => setProp(_el$72, "fg", muted(), _$p));
|
|
4375
4478
|
return _el$72;
|
|
4376
4479
|
})();
|