@humain/humain-code 0.8.4 → 0.8.7
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 +31 -0
- package/dist/bundle/agent-monitor.js +1 -1
- package/dist/bundle/chunks/{anthropic-messages-42CGJCSR.js → anthropic-messages-QMSJV4J5.js} +3 -3
- package/dist/bundle/chunks/{ask-VH7GNX75.js → ask-VVSJA5VG.js} +2 -2
- package/dist/bundle/chunks/{azure-openai-responses-DOKKMBUN.js → azure-openai-responses-P57ZD6XP.js} +3 -3
- package/dist/bundle/chunks/chunk-2QVKRSKH.js +4 -0
- package/dist/bundle/chunks/{chunk-OTVHRZ67.js → chunk-3BZUQ54Z.js} +1 -1
- package/dist/bundle/chunks/{chunk-XGOJCV6Z.js → chunk-4K6ISLTX.js} +1 -1
- package/dist/bundle/chunks/{chunk-BNZZJ4LO.js → chunk-4QVJYVS5.js} +1 -1
- package/dist/bundle/chunks/{chunk-MXF3KYLZ.js → chunk-4UXFF4IH.js} +1 -1
- package/dist/bundle/chunks/{chunk-J5YFXMTM.js → chunk-6PJEPQBW.js} +2 -2
- package/dist/bundle/chunks/{chunk-4SL6URR3.js → chunk-7X7QN6MX.js} +5 -3
- package/dist/bundle/chunks/{chunk-XGSJX23G.js → chunk-A7AH3VMJ.js} +69 -66
- package/dist/bundle/chunks/{chunk-H35P7ROY.js → chunk-B345VDHB.js} +9 -7
- package/dist/bundle/chunks/{chunk-A5ZMBTTM.js → chunk-B57IK7TV.js} +2 -2
- package/dist/bundle/chunks/{chunk-KJ3QRSSY.js → chunk-BVBEJBVY.js} +1 -1
- package/dist/bundle/chunks/{chunk-AER66CNP.js → chunk-BXDTDGHH.js} +1 -1
- package/dist/bundle/chunks/chunk-CDLUE6BJ.js +4 -0
- package/dist/bundle/chunks/{chunk-FLWO3H5J.js → chunk-DBC6XUKA.js} +1 -1
- package/dist/bundle/chunks/{chunk-HWXQCJDP.js → chunk-EB2ZJYOO.js} +295 -254
- package/dist/bundle/chunks/{chunk-4BNDLR6C.js → chunk-EK4QE622.js} +147 -37
- package/dist/bundle/chunks/{chunk-K5EFEIFP.js → chunk-H6CKS7HC.js} +1 -1
- package/dist/bundle/chunks/{chunk-UTRUALFN.js → chunk-HV25WMNO.js} +1 -1
- package/dist/bundle/chunks/{chunk-73YX5XGR.js → chunk-IP7R6BIN.js} +1079 -657
- package/dist/bundle/chunks/{chunk-HRNYDRL7.js → chunk-J5R2BQJS.js} +1 -1
- package/dist/bundle/chunks/{chunk-5C5K4EVJ.js → chunk-JNSFJADB.js} +1 -1
- package/dist/bundle/chunks/{chunk-CG43CMFH.js → chunk-KBIPIIKE.js} +1 -1
- package/dist/bundle/chunks/{chunk-CIAXW64K.js → chunk-MS3SLC2V.js} +10 -10
- package/dist/bundle/chunks/{chunk-WCKS2DPT.js → chunk-NO6T6CDO.js} +1 -1
- package/dist/bundle/chunks/{chunk-EVDQRT3I.js → chunk-NSSJ6OJK.js} +141 -225
- package/dist/bundle/chunks/{chunk-MZYHSWHX.js → chunk-OR3ORXP3.js} +2 -2
- package/dist/bundle/chunks/{chunk-MLOUZAVZ.js → chunk-PU7SKUJ6.js} +2 -2
- package/dist/bundle/chunks/{chunk-QZXLTW7V.js → chunk-RRGJHRKF.js} +1 -1
- package/dist/bundle/chunks/{chunk-625QJSFJ.js → chunk-SDPK3KZ3.js} +1 -1
- package/dist/bundle/chunks/{chunk-ZFFDBTG3.js → chunk-SPLJOIKL.js} +1 -1
- package/dist/bundle/chunks/{chunk-O44A4E4K.js → chunk-TNKPCYIM.js} +1 -1
- package/dist/bundle/chunks/{chunk-5KUCY54O.js → chunk-UY5TOBH2.js} +1 -1
- package/dist/bundle/chunks/{chunk-ARTF7ZMQ.js → chunk-VFPA5KPR.js} +1 -1
- package/dist/bundle/chunks/chunk-VP27C46J.js +23 -0
- package/dist/bundle/chunks/{chunk-B3FT6L6S.js → chunk-XZJT5U3V.js} +1 -1
- package/dist/bundle/chunks/{chunk-UOSJTMCL.js → chunk-YCGPXBJP.js} +1 -1
- package/dist/bundle/chunks/{chunk-52642TYH.js → chunk-YRSNKHEF.js} +389 -783
- package/dist/bundle/chunks/{chunk-MQYR4Q6X.js → chunk-YSRWNEZW.js} +1 -1
- package/dist/bundle/chunks/{chunk-SOE25WIS.js → chunk-ZAO4KC6J.js} +1054 -1069
- package/dist/bundle/chunks/{chunk-V2HTCZRF.js → chunk-ZXOTVZUX.js} +1 -1
- package/dist/bundle/chunks/{chunk-T5WECB2D.js → chunk-ZZNGVD5Q.js} +1 -1
- package/dist/bundle/chunks/{cloudflare-workers-ai-system-one-ZAZW4M4B.js → cloudflare-workers-ai-system-one-4BO66KHO.js} +1 -1
- package/dist/bundle/chunks/{compat-7UJJAO4E.js → compat-EOHVO2W3.js} +4 -4
- package/dist/bundle/chunks/{curator-server-MW645JI3.js → curator-server-72V7LMHQ.js} +1 -1
- package/dist/bundle/chunks/{dist-7PCCEUQF.js → dist-FW7ELRQH.js} +1 -1
- package/dist/bundle/chunks/{dist-I53JI67E.js → dist-YEVRRTWL.js} +8 -8
- package/dist/bundle/chunks/{dist-VXQT3DQY.js → dist-ZRUKAVTU.js} +3 -3
- package/dist/bundle/chunks/{doctor-KJVAYG3F.js → doctor-HJKC434Y.js} +29 -28
- package/dist/bundle/chunks/{easter-egg-3d-Z24JLXD4.js → easter-egg-3d-M37PJBL5.js} +1 -1
- package/dist/bundle/chunks/entry-M5TRX7N4.js +2 -0
- package/dist/bundle/chunks/{execute-C4BZQRPQ.js → execute-MIXK3CFW.js} +2 -2
- package/dist/bundle/chunks/{extract-XVQCIS7D.js → extract-WB6Y6ISY.js} +2 -2
- package/dist/bundle/chunks/{flow-implementer-GE2ARQKR.js → flow-implementer-ZNK5KVOG.js} +5 -5
- package/dist/bundle/chunks/github-copilot.js +1 -1
- package/dist/bundle/chunks/{google-generative-ai-P2P45MYP.js → google-generative-ai-B2BT7X4W.js} +3 -3
- package/dist/bundle/chunks/{google-vertex-SHY4IS5F.js → google-vertex-PCFDFRHY.js} +3 -3
- package/dist/bundle/chunks/{host-YESS2VAB.js → host-RF6R6GLZ.js} +1 -1
- package/dist/bundle/chunks/{inprocess-MGMVI6HN.js → inprocess-6MLIANGV.js} +6 -6
- package/dist/bundle/chunks/interactive-mode-QKREO5BH.js +6 -0
- package/dist/bundle/chunks/{llama-cpp-classify-RSRH4KV2.js → llama-cpp-classify-DMJSUUAD.js} +1 -1
- package/dist/bundle/chunks/{mistral-conversations-YTMJKHHI.js → mistral-conversations-OXWTIYWX.js} +2 -2
- package/dist/bundle/chunks/{openai-codex-responses-NUCJOJSZ.js → openai-codex-responses-YGXOZKWL.js} +3 -3
- package/dist/bundle/chunks/{openai-completions-E5NRJUHA.js → openai-completions-WDVOHMN6.js} +4 -4
- package/dist/bundle/chunks/{openai-decisions-342J5ZYG.js → openai-decisions-45LGQAD5.js} +1 -1
- package/dist/bundle/chunks/{openai-responses-BN5Z4HFI.js → openai-responses-OZDPUN4M.js} +3 -3
- package/dist/bundle/chunks/{openrouter-images-7RNG3JVF.js → openrouter-images-2IKRVRTZ.js} +2 -2
- package/dist/bundle/chunks/{pi-messages-2L7FV5OK.js → pi-messages-VZOJLMWW.js} +2 -2
- package/dist/bundle/chunks/{questionnaire-session-XEVAK7JS.js → questionnaire-session-RSZE5I3P.js} +2 -2
- package/dist/bundle/chunks/{session-picker-666KJIVM.js → session-picker-EUPZJEFF.js} +2 -2
- package/dist/bundle/chunks/{startup-ui-INEVSNGK.js → startup-ui-RTSTUGUC.js} +2 -2
- package/dist/bundle/chunks/{typesafe-system-one-UJUNSZG4.js → typesafe-system-one-IVWD24CQ.js} +1 -1
- package/dist/bundle/chunks/{virtual-modules-UXSSFNV5.js → virtual-modules-LS3DOCYU.js} +8 -8
- package/dist/bundle/cli-runtime.js +5 -5
- package/dist/bundle/flow/package.json +1 -1
- package/dist/bundle/index.js +11 -11
- package/dist/bundle/rpc-entry.js +5 -5
- package/dist/coordination/adapter/delivery.d.ts +6 -0
- package/dist/coordination/adapter/delivery.d.ts.map +1 -1
- package/dist/coordination/adapter/delivery.js +39 -4
- package/dist/coordination/adapter/delivery.js.map +1 -1
- package/dist/coordination/adapter/index.d.ts +2 -0
- package/dist/coordination/adapter/index.d.ts.map +1 -1
- package/dist/coordination/adapter/index.js +26 -0
- package/dist/coordination/adapter/index.js.map +1 -1
- package/dist/coordination/adapter/tool.js +3 -3
- package/dist/coordination/adapter/tool.js.map +1 -1
- package/dist/core/bug-report.d.ts +24 -1
- package/dist/core/bug-report.d.ts.map +1 -1
- package/dist/core/bug-report.js +216 -19
- package/dist/core/bug-report.js.map +1 -1
- package/dist/core/extensions/containment.d.ts +26 -0
- package/dist/core/extensions/containment.d.ts.map +1 -0
- package/dist/core/extensions/containment.js +66 -0
- package/dist/core/extensions/containment.js.map +1 -0
- package/dist/core/extensions/loader.d.ts.map +1 -1
- package/dist/core/extensions/loader.js +65 -7
- package/dist/core/extensions/loader.js.map +1 -1
- package/dist/core/extensions/runner.d.ts +2 -1
- package/dist/core/extensions/runner.d.ts.map +1 -1
- package/dist/core/extensions/runner.js +55 -10
- package/dist/core/extensions/runner.js.map +1 -1
- package/dist/core/extensions/types.d.ts +5 -2
- package/dist/core/extensions/types.d.ts.map +1 -1
- package/dist/core/extensions/types.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +4 -1
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/footer-data-provider.d.ts +2 -0
- package/dist/core/footer-data-provider.d.ts.map +1 -1
- package/dist/core/footer-data-provider.js +4 -0
- package/dist/core/footer-data-provider.js.map +1 -1
- package/dist/core/keybindings.d.ts +16 -0
- package/dist/core/keybindings.d.ts.map +1 -1
- package/dist/core/keybindings.js +2 -0
- package/dist/core/keybindings.js.map +1 -1
- package/dist/core/settings-defaults.d.ts +5 -0
- package/dist/core/settings-defaults.d.ts.map +1 -1
- package/dist/core/settings-defaults.js +2 -0
- package/dist/core/settings-defaults.js.map +1 -1
- package/dist/core/settings-manager.d.ts +10 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +31 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/settings-schema.d.ts +5 -0
- package/dist/core/settings-schema.d.ts.map +1 -1
- package/dist/core/settings-schema.js +8 -0
- package/dist/core/settings-schema.js.map +1 -1
- package/dist/core/slash-commands.d.ts.map +1 -1
- package/dist/core/slash-commands.js +1 -0
- package/dist/core/slash-commands.js.map +1 -1
- package/dist/forge-build-token.d.ts +3 -0
- package/dist/forge-build-token.d.ts.map +1 -0
- package/dist/forge-build-token.js +17 -0
- package/dist/forge-build-token.js.map +1 -0
- package/dist/humain/checklist/vendor/commands.d.ts +7 -0
- package/dist/humain/checklist/vendor/commands.d.ts.map +1 -1
- package/dist/humain/checklist/vendor/commands.js +85 -21
- package/dist/humain/checklist/vendor/commands.js.map +1 -1
- package/dist/humain/checklist/vendor/index.d.ts.map +1 -1
- package/dist/humain/checklist/vendor/index.js +4 -3
- package/dist/humain/checklist/vendor/index.js.map +1 -1
- package/dist/humain/flow-loader.d.ts.map +1 -1
- package/dist/humain/flow-loader.js +31 -5
- package/dist/humain/flow-loader.js.map +1 -1
- package/dist/humain/hcode/build-token.d.ts +35 -0
- package/dist/humain/hcode/build-token.d.ts.map +1 -0
- package/dist/humain/hcode/build-token.js +406 -0
- package/dist/humain/hcode/build-token.js.map +1 -0
- package/dist/humain/hcode/contracts.d.ts +3 -1
- package/dist/humain/hcode/contracts.d.ts.map +1 -1
- package/dist/humain/hcode/contracts.js +7 -4
- package/dist/humain/hcode/contracts.js.map +1 -1
- package/dist/humain/hcode/notices.d.ts +5 -0
- package/dist/humain/hcode/notices.d.ts.map +1 -1
- package/dist/humain/hcode/notices.js +5 -0
- package/dist/humain/hcode/notices.js.map +1 -1
- package/dist/humain/hcode/provider.d.ts.map +1 -1
- package/dist/humain/hcode/provider.js +1 -1
- package/dist/humain/hcode/provider.js.map +1 -1
- package/dist/humain/hcode/run-credential.d.ts +3 -1
- package/dist/humain/hcode/run-credential.d.ts.map +1 -1
- package/dist/humain/hcode/run-credential.js +123 -19
- package/dist/humain/hcode/run-credential.js.map +1 -1
- package/dist/humain/hcode/sandbox.d.ts.map +1 -1
- package/dist/humain/hcode/sandbox.js +10 -4
- package/dist/humain/hcode/sandbox.js.map +1 -1
- package/dist/humain/web-access/vendor/index.d.ts.map +1 -1
- package/dist/humain/web-access/vendor/index.js +11 -1
- package/dist/humain/web-access/vendor/index.js.map +1 -1
- package/dist/modes/interactive/bug-report.d.ts.map +1 -1
- package/dist/modes/interactive/bug-report.js +48 -12
- package/dist/modes/interactive/bug-report.js.map +1 -1
- package/dist/modes/interactive/chat-viewport.d.ts +4 -0
- package/dist/modes/interactive/chat-viewport.d.ts.map +1 -1
- package/dist/modes/interactive/chat-viewport.js +29 -5
- package/dist/modes/interactive/chat-viewport.js.map +1 -1
- package/dist/modes/interactive/components/footer.d.ts +2 -0
- package/dist/modes/interactive/components/footer.d.ts.map +1 -1
- package/dist/modes/interactive/components/footer.js +29 -12
- package/dist/modes/interactive/components/footer.js.map +1 -1
- package/dist/modes/interactive/components/settings-selector.d.ts +6 -0
- package/dist/modes/interactive/components/settings-selector.d.ts.map +1 -1
- package/dist/modes/interactive/components/settings-selector.js +20 -0
- package/dist/modes/interactive/components/settings-selector.js.map +1 -1
- package/dist/modes/interactive/components/status-line.js +2 -2
- package/dist/modes/interactive/components/status-line.js.map +1 -1
- package/dist/modes/interactive/components/tool-execution.d.ts +18 -1
- package/dist/modes/interactive/components/tool-execution.d.ts.map +1 -1
- package/dist/modes/interactive/components/tool-execution.js +91 -3
- package/dist/modes/interactive/components/tool-execution.js.map +1 -1
- package/dist/modes/interactive/components/tool-group.d.ts +22 -0
- package/dist/modes/interactive/components/tool-group.d.ts.map +1 -0
- package/dist/modes/interactive/components/tool-group.js +117 -0
- package/dist/modes/interactive/components/tool-group.js.map +1 -0
- package/dist/modes/interactive/interactive-mode.d.ts +15 -3
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +183 -52
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/modes/interactive/sidebar/git-work.d.ts +18 -0
- package/dist/modes/interactive/sidebar/git-work.d.ts.map +1 -0
- package/dist/modes/interactive/sidebar/git-work.js +56 -0
- package/dist/modes/interactive/sidebar/git-work.js.map +1 -0
- package/dist/modes/interactive/sidebar/sidebar-component.d.ts +13 -0
- package/dist/modes/interactive/sidebar/sidebar-component.d.ts.map +1 -0
- package/dist/modes/interactive/sidebar/sidebar-component.js +61 -0
- package/dist/modes/interactive/sidebar/sidebar-component.js.map +1 -0
- package/dist/modes/interactive/sidebar/sidebar-model.d.ts +69 -0
- package/dist/modes/interactive/sidebar/sidebar-model.d.ts.map +1 -0
- package/dist/modes/interactive/sidebar/sidebar-model.js +217 -0
- package/dist/modes/interactive/sidebar/sidebar-model.js.map +1 -0
- package/dist/modes/interactive/tool-grouping.d.ts +11 -0
- package/dist/modes/interactive/tool-grouping.d.ts.map +1 -0
- package/dist/modes/interactive/tool-grouping.js +32 -0
- package/dist/modes/interactive/tool-grouping.js.map +1 -0
- package/docs/coordination.md +7 -3
- package/docs/environment-variables.md +14 -0
- package/docs/extensions.md +2 -0
- package/docs/flow.md +2 -0
- package/docs/forge-run-bootstrap.md +77 -42
- package/docs/humain-code.md +1 -1
- package/docs/keybindings.md +2 -0
- package/docs/providers.md +14 -0
- package/docs/settings.md +16 -1
- package/docs/slash-commands.md +3 -0
- package/examples/sdk/12-full-control.ts +1 -1
- package/npm-shrinkwrap.json +7 -6
- package/package.json +3 -2
- package/schemas/keybindings.schema.json +8 -0
- package/schemas/settings.schema.json +29 -0
- package/src/humain/caveman/UPSTREAM.md +15 -3
- package/src/humain/caveman/upstream.json +2 -2
- package/src/humain/web-access/UPSTREAM.md +8 -0
- package/dist/bundle/chunks/chunk-HWFAAGYK.js +0 -23
- package/dist/bundle/chunks/chunk-RP6MWUAP.js +0 -4
- package/dist/bundle/chunks/entry-3EL6GOWK.js +0 -2
- package/dist/bundle/chunks/interactive-mode-HHWOE4FD.js +0 -5
- /package/dist/bundle/chunks/{chunk-T7F2TEIS.js → chunk-3IX4NEXK.js} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bug-report.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/bug-report.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"bug-report.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/bug-report.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,wBAAwB,CAAC;AAC9E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AAiBhE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAOpE,UAAU,gBAAgB;IACzB,OAAO,EAAE,YAAY,CAAC;IACtB,EAAE,EAAE,GAAG,CAAC;IACR,eAAe,EAAE,SAAS,CAAC;IAC3B,MAAM,EAAE,eAAe,CAAC;IACxB,WAAW,EAAE,kBAAkB,CAAC;IAChC,UAAU,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,SAAS,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACrC;AAgBD,iFAAiF;AACjF,wBAAsB,SAAS,CAAC,OAAO,EAAE,gBAAgB,EAAE,WAAW,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAwF9F"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
-
import { BUG_REPORT_CUSTOM_ENTRY_TYPE, bugReportArchiveFileName, collectBugReportDiagnostics, collectBugReportMetadata, createBugReportConversation,
|
|
2
|
+
import { BUG_REPORT_CUSTOM_ENTRY_TYPE, bugReportArchiveFileName, collectBugReportDiagnostics, collectBugReportMetadata, createBugReportConversation, createBugReportExportRedactor, projectBugReportFields, writeBugReportArchive, writeMinimalBugReportArchive, } from "../../core/bug-report.js";
|
|
3
3
|
import { clearCrashLog, readCrashLog } from "../../core/crash-log.js";
|
|
4
4
|
import { BorderedLoader } from "./components/bordered-loader.js";
|
|
5
5
|
import { ExtensionEditorComponent } from "./components/extension-editor.js";
|
|
@@ -9,7 +9,7 @@ const DISCLAIMER = "Create a local bug report with account and installation deta
|
|
|
9
9
|
const TRANSCRIPT_NOTE = "Conversation content can include prompts, code, tool calls, file contents, and command output. Secrets are excluded. Review the archive before sending it.";
|
|
10
10
|
/** Run the `/bug` flow: consent, optional summary, then export a zip archive. */
|
|
11
11
|
export async function reportBug(context, initialHint) {
|
|
12
|
-
const redactor =
|
|
12
|
+
const redactor = createBugReportExportRedactor();
|
|
13
13
|
const manager = context.session.sessionManager;
|
|
14
14
|
const sessionId = manager.getSessionId();
|
|
15
15
|
const runtime = context.session.modelRuntime;
|
|
@@ -22,18 +22,20 @@ export async function reportBug(context, initialHint) {
|
|
|
22
22
|
try {
|
|
23
23
|
// Register already-available local masking inputs before computing the reviewed conversation bytes.
|
|
24
24
|
const extensions = context.session.resourceLoader.getExtensions();
|
|
25
|
-
|
|
25
|
+
projectBugReportFields({
|
|
26
26
|
model,
|
|
27
27
|
extensions: extensions.extensions,
|
|
28
28
|
extensionErrors: extensions.errors,
|
|
29
29
|
global: context.session.settingsManager.getGlobalSettings(),
|
|
30
30
|
project: context.session.settingsManager.getProjectSettings(),
|
|
31
31
|
crashes: readCrashLog(),
|
|
32
|
-
}, "available");
|
|
32
|
+
}, redactor, "available");
|
|
33
33
|
options = await promptForOptions(context, redactor, initialHint);
|
|
34
34
|
}
|
|
35
35
|
catch {
|
|
36
|
-
|
|
36
|
+
// A collector can fail before handing its inputs to the redactor; their secret coverage is unknown.
|
|
37
|
+
redactor.disable();
|
|
38
|
+
await exportMinimalReport(context, current, redactor);
|
|
37
39
|
return;
|
|
38
40
|
}
|
|
39
41
|
if (!current()) {
|
|
@@ -64,7 +66,7 @@ export async function reportBug(context, initialHint) {
|
|
|
64
66
|
if (loader.signal.aborted)
|
|
65
67
|
context.showStatus("Bug report cancelled");
|
|
66
68
|
else
|
|
67
|
-
context
|
|
69
|
+
await exportConfirmedMinimalReport(context, current, redactor);
|
|
68
70
|
return;
|
|
69
71
|
}
|
|
70
72
|
restoreEditor(context, loader);
|
|
@@ -78,15 +80,45 @@ export async function reportBug(context, initialHint) {
|
|
|
78
80
|
if (!current())
|
|
79
81
|
throw new Error("Session changed");
|
|
80
82
|
bundle = await buildBundle(context.session, options, summary, redactor);
|
|
83
|
+
if (options.conversation.omittedFields && (options.includeSession || summary !== undefined))
|
|
84
|
+
bundle.metadata.omissions.push("Over-budget conversation fields were omitted after secret discovery.");
|
|
81
85
|
if (!current())
|
|
82
86
|
throw new Error("Session changed");
|
|
83
87
|
}
|
|
84
88
|
catch {
|
|
85
|
-
|
|
89
|
+
redactor.disable();
|
|
90
|
+
await exportMinimalReport(context, current, redactor);
|
|
86
91
|
return;
|
|
87
92
|
}
|
|
88
93
|
await exportZip(context, bundle, redactor, current);
|
|
89
94
|
}
|
|
95
|
+
async function exportMinimalReport(context, current, redactor) {
|
|
96
|
+
if (!current()) {
|
|
97
|
+
context.showStatus("Bug report cancelled: session changed");
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const confirmation = await choose(context, "Export a minimal bug report?", ["Export as Zip", "Cancel"], "Some fields were omitted. Safely redacted crash details are included when secret discovery completed; otherwise only CLI/platform details and crash dates/kinds are included. Configuration, descriptions, conversation and summary are excluded. Nothing is automatically emailed or uploaded.");
|
|
101
|
+
if (!current() || confirmation !== "Export as Zip") {
|
|
102
|
+
context.showStatus("Bug report cancelled");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
await exportConfirmedMinimalReport(context, current, redactor);
|
|
106
|
+
}
|
|
107
|
+
/** Existing export consent also covers this strictly smaller, closed projection. */
|
|
108
|
+
async function exportConfirmedMinimalReport(context, current, redactor) {
|
|
109
|
+
if (!current()) {
|
|
110
|
+
context.showStatus("Bug report cancelled: session changed");
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const { id, archivePath } = await writeMinimalBugReportArchive(readCrashLog(), process.cwd(), redactor);
|
|
115
|
+
// Retain the original crash log: the minimal archive deliberately excludes its full evidence.
|
|
116
|
+
context.showStatus(`Bug report exported to: ${archivePath}\nReport ID: ${id}\nSome fields were omitted. Review the archive before manually emailing it to akarim@humain.com. Nothing was automatically emailed or uploaded.`);
|
|
117
|
+
}
|
|
118
|
+
catch {
|
|
119
|
+
context.showError("Failed to write minimal bug report. No report was exported.");
|
|
120
|
+
}
|
|
121
|
+
}
|
|
90
122
|
async function promptForOptions(context, redactor, initialHint) {
|
|
91
123
|
const hint = await input(context, "Report a bug", `${DISCLAIMER}\n\nWhat went wrong? (optional)`, initialHint === undefined ? undefined : redactor.redactText(initialHint).text);
|
|
92
124
|
if (hint === null)
|
|
@@ -147,18 +179,19 @@ async function buildBundle(session, options, summary, redactor) {
|
|
|
147
179
|
}
|
|
148
180
|
async function exportZip(context, bundle, redactor, current) {
|
|
149
181
|
const archivePath = path.join(process.cwd(), bugReportArchiveFileName(bundle.metadata.id));
|
|
182
|
+
let omittedFields;
|
|
150
183
|
try {
|
|
151
|
-
await writeBugReportArchive(bundle, archivePath, redactor);
|
|
184
|
+
({ omittedFields } = await writeBugReportArchive(bundle, archivePath, redactor));
|
|
152
185
|
}
|
|
153
186
|
catch {
|
|
154
|
-
context
|
|
187
|
+
await exportConfirmedMinimalReport(context, current, redactor);
|
|
155
188
|
return;
|
|
156
189
|
}
|
|
157
190
|
if (current())
|
|
158
|
-
recordInSession(context.session, bundle, archivePath);
|
|
191
|
+
recordInSession(context.session, bundle, archivePath, omittedFields);
|
|
159
192
|
context.showStatus(`Bug report exported to: ${archivePath}\nReport ID: ${bundle.metadata.id}\nReview the archive before manually emailing it to akarim@humain.com. Nothing was automatically emailed or uploaded.`);
|
|
160
193
|
}
|
|
161
|
-
function recordInSession(session, bundle, archivePath) {
|
|
194
|
+
function recordInSession(session, bundle, archivePath, omittedFields) {
|
|
162
195
|
session.sessionManager.appendCustomEntry(BUG_REPORT_CUSTOM_ENTRY_TYPE, {
|
|
163
196
|
id: bundle.metadata.id,
|
|
164
197
|
createdAt: bundle.metadata.createdAt,
|
|
@@ -168,7 +201,10 @@ function recordInSession(session, bundle, archivePath) {
|
|
|
168
201
|
delivery: "zip",
|
|
169
202
|
path: archivePath,
|
|
170
203
|
});
|
|
171
|
-
if (
|
|
204
|
+
if (!omittedFields &&
|
|
205
|
+
bundle.diagnostics.crashes.length > 0 &&
|
|
206
|
+
bundle.diagnostics.omissions.length === 0 &&
|
|
207
|
+
bundle.metadata.omissions.length === 0)
|
|
172
208
|
clearCrashLog();
|
|
173
209
|
}
|
|
174
210
|
function input(context, title, description, initialValue) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bug-report.js","sourceRoot":"","sources":["../../../src/modes/interactive/bug-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACN,4BAA4B,EAI5B,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC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,0BAA0B,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,EAAE;YAClF,GAAG,EAAE,OAAO,CAAC,EAAE;YACf,WAAW;SACX,CAAC,CAAC;QACH,WAAW,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACjC,CAAC,CAAC,CAAC;AACJ,CAAC;AAED,SAAS,UAAU,CAAC,OAAyB,EAAE,OAAe;IAC7D,MAAM,MAAM,GAAG,IAAI,cAAc,CAAC,OAAO,CAAC,EAAE,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC9D,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC;IAC7B,OAAO,MAAM,CAAC;AACf,CAAC;AAED,SAAS,WAAW,CAAC,OAAyB,EAAE,SAAkB;IACjE,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAChC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,SAAS,CAAC,CAAC;IAC/B,OAAO,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AAC5B,CAAC;AAED,SAAS,aAAa,CAAC,OAAyB,EAAE,SAAkB;IACnE,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC;IACtB,OAAO,CAAC,eAAe,CAAC,KAAK,EAAE,CAAC;IAChC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import * as path from \"node:path\";\nimport type { Container, EditorComponent, TUI } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\nimport {\n\tBUG_REPORT_CUSTOM_ENTRY_TYPE,\n\ttype BugReportBundle,\n\ttype BugReportConversation,\n\ttype BugReportSessionEntryData,\n\tbugReportArchiveFileName,\n\tcollectBugReportDiagnostics,\n\tcollectBugReportMetadata,\n\tcreateBugReportConversation,\n\tcreateBugReportRedactor,\n\twriteBugReportArchive,\n} from \"../../core/bug-report.ts\";\nimport { clearCrashLog, readCrashLog } from \"../../core/crash-log.ts\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport type { TraceRedactor } from \"../../core/trace/redaction.ts\";\nimport { BorderedLoader } from \"./components/bordered-loader.ts\";\nimport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nimport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\ninterface BugReportContext {\n\tsession: AgentSession;\n\tui: TUI;\n\teditorContainer: Container;\n\teditor: EditorComponent;\n\tkeybindings: KeybindingsManager;\n\tshowStatus: (message: string) => void;\n\tshowError: (message: string) => void;\n}\n\ninterface BugReportOptions {\n\thint?: string;\n\tincludeSession: boolean;\n\tincludeSummary: boolean;\n\tconversation: BugReportConversation;\n}\n\ntype Overlay = Container & { dispose?: () => void };\n\nconst DISCLAIMER =\n\t\"Create a local bug report with account and installation details and diagnostics. Secrets are excluded. You'll choose whether to attach the conversation. Nothing is automatically emailed or uploaded.\";\nconst TRANSCRIPT_NOTE =\n\t\"Conversation content can include prompts, code, tool calls, file contents, and command output. Secrets are excluded. Review the archive before sending it.\";\n\n/** Run the `/bug` flow: consent, optional summary, then export a zip archive. */\nexport async function reportBug(context: BugReportContext, initialHint?: string): Promise<void> {\n\tconst redactor = createBugReportRedactor();\n\tconst manager = context.session.sessionManager;\n\tconst sessionId = manager.getSessionId();\n\tconst runtime = context.session.modelRuntime;\n\tconst model = context.session.model;\n\tconst current = () =>\n\t\tcontext.session.sessionManager === manager &&\n\t\tmanager.getSessionId() === sessionId &&\n\t\tcontext.session.modelRuntime === runtime &&\n\t\tcontext.session.model === model;\n\tlet options: BugReportOptions | undefined;\n\ttry {\n\t\t// Register already-available local masking inputs before computing the reviewed conversation bytes.\n\t\tconst extensions = context.session.resourceLoader.getExtensions();\n\t\tredactor.redactJson(\n\t\t\t{\n\t\t\t\tmodel,\n\t\t\t\textensions: extensions.extensions,\n\t\t\t\textensionErrors: extensions.errors,\n\t\t\t\tglobal: context.session.settingsManager.getGlobalSettings(),\n\t\t\t\tproject: context.session.settingsManager.getProjectSettings(),\n\t\t\t\tcrashes: readCrashLog(),\n\t\t\t},\n\t\t\t\"available\",\n\t\t);\n\t\toptions = await promptForOptions(context, redactor, initialHint);\n\t} catch {\n\t\tcontext.showError(\"Could not safely project the bug report. No report was exported.\");\n\t\treturn;\n\t}\n\tif (!current()) {\n\t\tcontext.showStatus(\"Bug report cancelled: session changed\");\n\t\treturn;\n\t}\n\tif (!options) {\n\t\tcontext.showStatus(\"Bug report cancelled\");\n\t\treturn;\n\t}\n\tlet summary: string | undefined;\n\tif (options.includeSummary) {\n\t\tconst loader = showLoader(\n\t\t\tcontext,\n\t\t\t`Writing summary with ${context.session.model?.name ?? \"the current model\"}...`,\n\t\t);\n\t\ttry {\n\t\t\t// Fail before inference if any later collection changed the projection the user reviewed.\n\t\t\tconst summaryInput = { messages: options.conversation.messages, hint: options.hint };\n\t\t\tconst reviewed = redactor.redactJson(summaryInput, \"summary\").value;\n\t\t\tif (JSON.stringify(reviewed) !== JSON.stringify(summaryInput))\n\t\t\t\tthrow new Error(\"Summary input redaction changed after review.\");\n\t\t\tsummary = redactor.redactText(\n\t\t\t\tawait context.session.summarizeForBugReport({\n\t\t\t\t\thint: options.hint,\n\t\t\t\t\tsignal: loader.signal,\n\t\t\t\t\tconversation: options.conversation,\n\t\t\t\t}),\n\t\t\t).text;\n\t\t} catch {\n\t\t\trestoreEditor(context, loader);\n\t\t\tif (loader.signal.aborted) context.showStatus(\"Bug report cancelled\");\n\t\t\telse context.showError(\"Failed to safely write bug report summary. No report was exported.\");\n\t\t\treturn;\n\t\t}\n\t\trestoreEditor(context, loader);\n\t\tif (loader.signal.aborted) {\n\t\t\tcontext.showStatus(\"Bug report cancelled\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\tlet bundle: BugReportBundle;\n\ttry {\n\t\tif (!current()) throw new Error(\"Session changed\");\n\t\tbundle = await buildBundle(context.session, options, summary, redactor);\n\t\tif (!current()) throw new Error(\"Session changed\");\n\t} catch {\n\t\tcontext.showError(\"Failed to safely build bug report. No report was exported.\");\n\t\treturn;\n\t}\n\n\tawait exportZip(context, bundle, redactor, current);\n}\n\nasync function promptForOptions(\n\tcontext: BugReportContext,\n\tredactor: TraceRedactor,\n\tinitialHint: string | undefined,\n): Promise<BugReportOptions | undefined> {\n\tconst hint = await input(\n\t\tcontext,\n\t\t\"Report a bug\",\n\t\t`${DISCLAIMER}\\n\\nWhat went wrong? (optional)`,\n\t\tinitialHint === undefined ? undefined : redactor.redactText(initialHint).text,\n\t);\n\tif (hint === null) return undefined;\n\t// Register hint credentials before transcript echoes; sanitize again after transcript discovery.\n\tredactor.redactText(hint.trim());\n\tconst conversation = createBugReportConversation(context.session.sessionManager, redactor);\n\tconst description = redactor.redactText(hint.trim()).text;\n\tconst transcript = await choose(\n\t\tcontext,\n\t\t`Attach the current conversation (${conversation.bytes} bytes)?`,\n\t\t[\"Attach conversation\", \"Don't attach\"],\n\t\tTRANSCRIPT_NOTE,\n\t);\n\tif (!transcript) return undefined;\n\tconst includeSession = transcript === \"Attach conversation\";\n\tlet includeSummary = false;\n\t{\n\t\tconst model = context.session.model;\n\t\tconst summary = await choose(\n\t\t\tcontext,\n\t\t\t\"Generate a summary with the selected model?\",\n\t\t\t[\"Yes, generate a summary\", \"No\"],\n\t\t\t`Generate a summary with the selected model? This sends the secret-redacted conversation to your inference provider and may use your allowance or provider tokens. Selected provider: ${model?.provider ?? \"none\"}.`,\n\t\t);\n\t\tif (!summary) return undefined;\n\t\tincludeSummary = summary !== \"No\";\n\t}\n\tconst confirmation = await choose(\n\t\tcontext,\n\t\t\"Bug report\",\n\t\t[\"Export as Zip\", \"Cancel\"],\n\t\t`Description: ${description || \"none\"}\\nTranscript: ${includeSession ? \"included\" : \"not included\"}\\nSummary: ${includeSummary ? `written by ${context.session.model?.name ?? \"the current model\"}` : \"none\"}\\n\\nThe zip archive will be written to the current directory. Review the archive before manually emailing it to akarim@humain.com.`,\n\t);\n\tif (confirmation !== \"Export as Zip\") return undefined;\n\treturn {\n\t\thint: description || undefined,\n\t\tincludeSession,\n\t\tincludeSummary,\n\t\tconversation,\n\t};\n}\n\nasync function buildBundle(\n\tsession: AgentSession,\n\toptions: BugReportOptions,\n\tsummary: string | undefined,\n\tredactor: TraceRedactor,\n): Promise<BugReportBundle> {\n\tconst support = await session.modelRuntime.getHcodeSupportSnapshot(AbortSignal.timeout(1000));\n\tconst extensions = session.resourceLoader.getExtensions();\n\treturn {\n\t\tmetadata: collectBugReportMetadata({\n\t\t\tredactor,\n\t\t\tsupport,\n\t\t\thint: options.hint,\n\t\t\tsessionId: session.sessionId,\n\t\t\tcwd: session.sessionManager.getCwd(),\n\t\t\tincludeSession: options.includeSession,\n\t\t\tincludeSummary: summary !== undefined,\n\t\t\tmessageCount: options.includeSession ? options.conversation.messages.length : 0,\n\t\t\tmodel: session.model,\n\t\t\tmodelRuntime: session.modelRuntime,\n\t\t\tthinkingLevel: session.thinkingLevel,\n\t\t\textensions: extensions.extensions,\n\t\t\textensionErrors: extensions.errors,\n\t\t\tglobalSettings: session.settingsManager.getGlobalSettings(),\n\t\t\tprojectSettings: session.settingsManager.getProjectSettings(),\n\t\t}),\n\t\tdiagnostics: collectBugReportDiagnostics(\n\t\t\toptions.includeSession\n\t\t\t\t? { kind: \"conversation\", session: session.sessionManager, crashes: readCrashLog() }\n\t\t\t\t: { kind: \"standalone\", crashes: readCrashLog() },\n\t\t\tredactor,\n\t\t),\n\t\tsummary,\n\t\tsessionJsonl: options.includeSession ? options.conversation.sessionJsonl : undefined,\n\t};\n}\n\nasync function exportZip(\n\tcontext: BugReportContext,\n\tbundle: BugReportBundle,\n\tredactor: TraceRedactor,\n\tcurrent: () => boolean,\n): Promise<void> {\n\tconst archivePath = path.join(process.cwd(), bugReportArchiveFileName(bundle.metadata.id));\n\ttry {\n\t\tawait writeBugReportArchive(bundle, archivePath, redactor);\n\t} catch {\n\t\tcontext.showError(\"Failed to safely write bug report. No report was exported.\");\n\t\treturn;\n\t}\n\tif (current()) recordInSession(context.session, bundle, archivePath);\n\tcontext.showStatus(\n\t\t`Bug report exported to: ${archivePath}\\nReport ID: ${bundle.metadata.id}\\nReview the archive before manually emailing it to akarim@humain.com. Nothing was automatically emailed or uploaded.`,\n\t);\n}\n\nfunction recordInSession(session: AgentSession, bundle: BugReportBundle, archivePath: string): void {\n\tsession.sessionManager.appendCustomEntry(BUG_REPORT_CUSTOM_ENTRY_TYPE, {\n\t\tid: bundle.metadata.id,\n\t\tcreatedAt: bundle.metadata.createdAt,\n\t\thint: bundle.metadata.hint,\n\t\tsessionIncluded: bundle.metadata.session.included,\n\t\tsummaryIncluded: bundle.metadata.session.summaryIncluded,\n\t\tdelivery: \"zip\",\n\t\tpath: archivePath,\n\t} satisfies BugReportSessionEntryData);\n\tif (bundle.diagnostics.crashes.length > 0) clearCrashLog();\n}\n\nfunction input(\n\tcontext: BugReportContext,\n\ttitle: string,\n\tdescription: string,\n\tinitialValue?: string,\n): Promise<string | null> {\n\treturn new Promise((resolve) => {\n\t\tlet component: ExtensionEditorComponent;\n\t\tconst finish = (value: string | null) => {\n\t\t\trestoreEditor(context, component);\n\t\t\tresolve(value);\n\t\t};\n\t\tcomponent = new ExtensionEditorComponent(\n\t\t\tcontext.ui,\n\t\t\tcontext.keybindings,\n\t\t\ttitle,\n\t\t\tinitialValue,\n\t\t\t(value) => finish(value),\n\t\t\t() => finish(null),\n\t\t\t{ description },\n\t\t\tcontext.session.settingsManager.getExternalEditorCommand(),\n\t\t);\n\t\tshowOverlay(context, component);\n\t});\n}\n\nfunction choose(\n\tcontext: BugReportContext,\n\ttitle: string,\n\toptions: string[],\n\tdescription?: string,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tlet component: ExtensionSelectorComponent;\n\t\tconst finish = (value?: string) => {\n\t\t\trestoreEditor(context, component);\n\t\t\tresolve(value);\n\t\t};\n\t\tcomponent = new ExtensionSelectorComponent(title, options, finish, () => finish(), {\n\t\t\ttui: context.ui,\n\t\t\tdescription,\n\t\t});\n\t\tshowOverlay(context, component);\n\t});\n}\n\nfunction showLoader(context: BugReportContext, message: string): BorderedLoader {\n\tconst loader = new BorderedLoader(context.ui, theme, message);\n\tshowOverlay(context, loader);\n\treturn loader;\n}\n\nfunction showOverlay(context: BugReportContext, component: Overlay): void {\n\tcontext.editorContainer.clear();\n\tcontext.editorContainer.addChild(component);\n\tcontext.ui.setFocus(component);\n\tcontext.ui.requestRender();\n}\n\nfunction restoreEditor(context: BugReportContext, component: Overlay): void {\n\tcomponent.dispose?.();\n\tcontext.editorContainer.clear();\n\tcontext.editorContainer.addChild(context.editor);\n\tcontext.ui.setFocus(context.editor);\n\tcontext.ui.requestRender();\n}\n"]}
|
|
1
|
+
{"version":3,"file":"bug-report.js","sourceRoot":"","sources":["../../../src/modes/interactive/bug-report.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAGlC,OAAO,EACN,4BAA4B,EAK5B,wBAAwB,EACxB,2BAA2B,EAC3B,wBAAwB,EACxB,2BAA2B,EAC3B,6BAA6B,EAC7B,sBAAsB,EACtB,qBAAqB,EACrB,4BAA4B,GAC5B,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGtE,OAAO,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,EAAE,wBAAwB,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,0BAA0B,EAAE,MAAM,oCAAoC,CAAC;AAChF,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,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C;IAChC,OAAO,CAAC,eAAe,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACjD,OAAO,CAAC,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,CAAC,EAAE,CAAC,aAAa,EAAE,CAAC;AAC5B,CAAC","sourcesContent":["import * as path from \"node:path\";\nimport type { Container, EditorComponent, TUI } from \"@earendil-works/pi-tui\";\nimport type { AgentSession } from \"../../core/agent-session.ts\";\nimport {\n\tBUG_REPORT_CUSTOM_ENTRY_TYPE,\n\ttype BugReportBundle,\n\ttype BugReportConversation,\n\ttype BugReportExportRedactor,\n\ttype BugReportSessionEntryData,\n\tbugReportArchiveFileName,\n\tcollectBugReportDiagnostics,\n\tcollectBugReportMetadata,\n\tcreateBugReportConversation,\n\tcreateBugReportExportRedactor,\n\tprojectBugReportFields,\n\twriteBugReportArchive,\n\twriteMinimalBugReportArchive,\n} from \"../../core/bug-report.ts\";\nimport { clearCrashLog, readCrashLog } from \"../../core/crash-log.ts\";\nimport type { KeybindingsManager } from \"../../core/keybindings.ts\";\nimport type { TraceRedactor } from \"../../core/trace/redaction.ts\";\nimport { BorderedLoader } from \"./components/bordered-loader.ts\";\nimport { ExtensionEditorComponent } from \"./components/extension-editor.ts\";\nimport { ExtensionSelectorComponent } from \"./components/extension-selector.ts\";\nimport { theme } from \"./theme/theme.ts\";\n\ninterface BugReportContext {\n\tsession: AgentSession;\n\tui: TUI;\n\teditorContainer: Container;\n\teditor: EditorComponent;\n\tkeybindings: KeybindingsManager;\n\tshowStatus: (message: string) => void;\n\tshowError: (message: string) => void;\n}\n\ninterface BugReportOptions {\n\thint?: string;\n\tincludeSession: boolean;\n\tincludeSummary: boolean;\n\tconversation: BugReportConversation;\n}\n\ntype Overlay = Container & { dispose?: () => void };\n\nconst DISCLAIMER =\n\t\"Create a local bug report with account and installation details and diagnostics. Secrets are excluded. You'll choose whether to attach the conversation. Nothing is automatically emailed or uploaded.\";\nconst TRANSCRIPT_NOTE =\n\t\"Conversation content can include prompts, code, tool calls, file contents, and command output. Secrets are excluded. Review the archive before sending it.\";\n\n/** Run the `/bug` flow: consent, optional summary, then export a zip archive. */\nexport async function reportBug(context: BugReportContext, initialHint?: string): Promise<void> {\n\tconst redactor = createBugReportExportRedactor();\n\tconst manager = context.session.sessionManager;\n\tconst sessionId = manager.getSessionId();\n\tconst runtime = context.session.modelRuntime;\n\tconst model = context.session.model;\n\tconst current = () =>\n\t\tcontext.session.sessionManager === manager &&\n\t\tmanager.getSessionId() === sessionId &&\n\t\tcontext.session.modelRuntime === runtime &&\n\t\tcontext.session.model === model;\n\tlet options: BugReportOptions | undefined;\n\ttry {\n\t\t// Register already-available local masking inputs before computing the reviewed conversation bytes.\n\t\tconst extensions = context.session.resourceLoader.getExtensions();\n\t\tprojectBugReportFields(\n\t\t\t{\n\t\t\t\tmodel,\n\t\t\t\textensions: extensions.extensions,\n\t\t\t\textensionErrors: extensions.errors,\n\t\t\t\tglobal: context.session.settingsManager.getGlobalSettings(),\n\t\t\t\tproject: context.session.settingsManager.getProjectSettings(),\n\t\t\t\tcrashes: readCrashLog(),\n\t\t\t},\n\t\t\tredactor,\n\t\t\t\"available\",\n\t\t);\n\t\toptions = await promptForOptions(context, redactor, initialHint);\n\t} catch {\n\t\t// A collector can fail before handing its inputs to the redactor; their secret coverage is unknown.\n\t\tredactor.disable();\n\t\tawait exportMinimalReport(context, current, redactor);\n\t\treturn;\n\t}\n\tif (!current()) {\n\t\tcontext.showStatus(\"Bug report cancelled: session changed\");\n\t\treturn;\n\t}\n\tif (!options) {\n\t\tcontext.showStatus(\"Bug report cancelled\");\n\t\treturn;\n\t}\n\tlet summary: string | undefined;\n\tif (options.includeSummary) {\n\t\tconst loader = showLoader(\n\t\t\tcontext,\n\t\t\t`Writing summary with ${context.session.model?.name ?? \"the current model\"}...`,\n\t\t);\n\t\ttry {\n\t\t\t// Fail before inference if any later collection changed the projection the user reviewed.\n\t\t\tconst summaryInput = { messages: options.conversation.messages, hint: options.hint };\n\t\t\tconst reviewed = redactor.redactJson(summaryInput, \"summary\").value;\n\t\t\tif (JSON.stringify(reviewed) !== JSON.stringify(summaryInput))\n\t\t\t\tthrow new Error(\"Summary input redaction changed after review.\");\n\t\t\tsummary = redactor.redactText(\n\t\t\t\tawait context.session.summarizeForBugReport({\n\t\t\t\t\thint: options.hint,\n\t\t\t\t\tsignal: loader.signal,\n\t\t\t\t\tconversation: options.conversation,\n\t\t\t\t}),\n\t\t\t).text;\n\t\t} catch {\n\t\t\trestoreEditor(context, loader);\n\t\t\tif (loader.signal.aborted) context.showStatus(\"Bug report cancelled\");\n\t\t\telse await exportConfirmedMinimalReport(context, current, redactor);\n\t\t\treturn;\n\t\t}\n\t\trestoreEditor(context, loader);\n\t\tif (loader.signal.aborted) {\n\t\t\tcontext.showStatus(\"Bug report cancelled\");\n\t\t\treturn;\n\t\t}\n\t}\n\n\tlet bundle: BugReportBundle;\n\ttry {\n\t\tif (!current()) throw new Error(\"Session changed\");\n\t\tbundle = await buildBundle(context.session, options, summary, redactor);\n\t\tif (options.conversation.omittedFields && (options.includeSession || summary !== undefined))\n\t\t\tbundle.metadata.omissions.push(\"Over-budget conversation fields were omitted after secret discovery.\");\n\t\tif (!current()) throw new Error(\"Session changed\");\n\t} catch {\n\t\tredactor.disable();\n\t\tawait exportMinimalReport(context, current, redactor);\n\t\treturn;\n\t}\n\n\tawait exportZip(context, bundle, redactor, current);\n}\n\nasync function exportMinimalReport(\n\tcontext: BugReportContext,\n\tcurrent: () => boolean,\n\tredactor: BugReportExportRedactor,\n): Promise<void> {\n\tif (!current()) {\n\t\tcontext.showStatus(\"Bug report cancelled: session changed\");\n\t\treturn;\n\t}\n\tconst confirmation = await choose(\n\t\tcontext,\n\t\t\"Export a minimal bug report?\",\n\t\t[\"Export as Zip\", \"Cancel\"],\n\t\t\"Some fields were omitted. Safely redacted crash details are included when secret discovery completed; otherwise only CLI/platform details and crash dates/kinds are included. Configuration, descriptions, conversation and summary are excluded. Nothing is automatically emailed or uploaded.\",\n\t);\n\tif (!current() || confirmation !== \"Export as Zip\") {\n\t\tcontext.showStatus(\"Bug report cancelled\");\n\t\treturn;\n\t}\n\tawait exportConfirmedMinimalReport(context, current, redactor);\n}\n\n/** Existing export consent also covers this strictly smaller, closed projection. */\nasync function exportConfirmedMinimalReport(\n\tcontext: BugReportContext,\n\tcurrent: () => boolean,\n\tredactor: BugReportExportRedactor,\n): Promise<void> {\n\tif (!current()) {\n\t\tcontext.showStatus(\"Bug report cancelled: session changed\");\n\t\treturn;\n\t}\n\ttry {\n\t\tconst { id, archivePath } = await writeMinimalBugReportArchive(readCrashLog(), process.cwd(), redactor);\n\t\t// Retain the original crash log: the minimal archive deliberately excludes its full evidence.\n\t\tcontext.showStatus(\n\t\t\t`Bug report exported to: ${archivePath}\\nReport ID: ${id}\\nSome fields were omitted. Review the archive before manually emailing it to akarim@humain.com. Nothing was automatically emailed or uploaded.`,\n\t\t);\n\t} catch {\n\t\tcontext.showError(\"Failed to write minimal bug report. No report was exported.\");\n\t}\n}\n\nasync function promptForOptions(\n\tcontext: BugReportContext,\n\tredactor: TraceRedactor,\n\tinitialHint: string | undefined,\n): Promise<BugReportOptions | undefined> {\n\tconst hint = await input(\n\t\tcontext,\n\t\t\"Report a bug\",\n\t\t`${DISCLAIMER}\\n\\nWhat went wrong? (optional)`,\n\t\tinitialHint === undefined ? undefined : redactor.redactText(initialHint).text,\n\t);\n\tif (hint === null) return undefined;\n\t// Register hint credentials before transcript echoes; sanitize again after transcript discovery.\n\tredactor.redactText(hint.trim());\n\tconst conversation = createBugReportConversation(context.session.sessionManager, redactor);\n\tconst description = redactor.redactText(hint.trim()).text;\n\tconst transcript = await choose(\n\t\tcontext,\n\t\t`Attach the current conversation (${conversation.bytes} bytes)?`,\n\t\t[\"Attach conversation\", \"Don't attach\"],\n\t\tTRANSCRIPT_NOTE,\n\t);\n\tif (!transcript) return undefined;\n\tconst includeSession = transcript === \"Attach conversation\";\n\tlet includeSummary = false;\n\t{\n\t\tconst model = context.session.model;\n\t\tconst summary = await choose(\n\t\t\tcontext,\n\t\t\t\"Generate a summary with the selected model?\",\n\t\t\t[\"Yes, generate a summary\", \"No\"],\n\t\t\t`Generate a summary with the selected model? This sends the secret-redacted conversation to your inference provider and may use your allowance or provider tokens. Selected provider: ${model?.provider ?? \"none\"}.`,\n\t\t);\n\t\tif (!summary) return undefined;\n\t\tincludeSummary = summary !== \"No\";\n\t}\n\tconst confirmation = await choose(\n\t\tcontext,\n\t\t\"Bug report\",\n\t\t[\"Export as Zip\", \"Cancel\"],\n\t\t`Description: ${description || \"none\"}\\nTranscript: ${includeSession ? \"included\" : \"not included\"}\\nSummary: ${includeSummary ? `written by ${context.session.model?.name ?? \"the current model\"}` : \"none\"}\\n\\nThe zip archive will be written to the current directory. Review the archive before manually emailing it to akarim@humain.com.`,\n\t);\n\tif (confirmation !== \"Export as Zip\") return undefined;\n\treturn {\n\t\thint: description || undefined,\n\t\tincludeSession,\n\t\tincludeSummary,\n\t\tconversation,\n\t};\n}\n\nasync function buildBundle(\n\tsession: AgentSession,\n\toptions: BugReportOptions,\n\tsummary: string | undefined,\n\tredactor: TraceRedactor,\n): Promise<BugReportBundle> {\n\tconst support = await session.modelRuntime.getHcodeSupportSnapshot(AbortSignal.timeout(1000));\n\tconst extensions = session.resourceLoader.getExtensions();\n\treturn {\n\t\tmetadata: collectBugReportMetadata({\n\t\t\tredactor,\n\t\t\tsupport,\n\t\t\thint: options.hint,\n\t\t\tsessionId: session.sessionId,\n\t\t\tcwd: session.sessionManager.getCwd(),\n\t\t\tincludeSession: options.includeSession,\n\t\t\tincludeSummary: summary !== undefined,\n\t\t\tmessageCount: options.includeSession ? options.conversation.messages.length : 0,\n\t\t\tmodel: session.model,\n\t\t\tmodelRuntime: session.modelRuntime,\n\t\t\tthinkingLevel: session.thinkingLevel,\n\t\t\textensions: extensions.extensions,\n\t\t\textensionErrors: extensions.errors,\n\t\t\tglobalSettings: session.settingsManager.getGlobalSettings(),\n\t\t\tprojectSettings: session.settingsManager.getProjectSettings(),\n\t\t}),\n\t\tdiagnostics: collectBugReportDiagnostics(\n\t\t\toptions.includeSession\n\t\t\t\t? { kind: \"conversation\", session: session.sessionManager, crashes: readCrashLog() }\n\t\t\t\t: { kind: \"standalone\", crashes: readCrashLog() },\n\t\t\tredactor,\n\t\t),\n\t\tsummary,\n\t\tsessionJsonl: options.includeSession ? options.conversation.sessionJsonl : undefined,\n\t};\n}\n\nasync function exportZip(\n\tcontext: BugReportContext,\n\tbundle: BugReportBundle,\n\tredactor: BugReportExportRedactor,\n\tcurrent: () => boolean,\n): Promise<void> {\n\tconst archivePath = path.join(process.cwd(), bugReportArchiveFileName(bundle.metadata.id));\n\tlet omittedFields: boolean;\n\ttry {\n\t\t({ omittedFields } = await writeBugReportArchive(bundle, archivePath, redactor));\n\t} catch {\n\t\tawait exportConfirmedMinimalReport(context, current, redactor);\n\t\treturn;\n\t}\n\tif (current()) recordInSession(context.session, bundle, archivePath, omittedFields);\n\tcontext.showStatus(\n\t\t`Bug report exported to: ${archivePath}\\nReport ID: ${bundle.metadata.id}\\nReview the archive before manually emailing it to akarim@humain.com. Nothing was automatically emailed or uploaded.`,\n\t);\n}\n\nfunction recordInSession(\n\tsession: AgentSession,\n\tbundle: BugReportBundle,\n\tarchivePath: string,\n\tomittedFields: boolean,\n): void {\n\tsession.sessionManager.appendCustomEntry(BUG_REPORT_CUSTOM_ENTRY_TYPE, {\n\t\tid: bundle.metadata.id,\n\t\tcreatedAt: bundle.metadata.createdAt,\n\t\thint: bundle.metadata.hint,\n\t\tsessionIncluded: bundle.metadata.session.included,\n\t\tsummaryIncluded: bundle.metadata.session.summaryIncluded,\n\t\tdelivery: \"zip\",\n\t\tpath: archivePath,\n\t} satisfies BugReportSessionEntryData);\n\tif (\n\t\t!omittedFields &&\n\t\tbundle.diagnostics.crashes.length > 0 &&\n\t\tbundle.diagnostics.omissions.length === 0 &&\n\t\tbundle.metadata.omissions.length === 0\n\t)\n\t\tclearCrashLog();\n}\n\nfunction input(\n\tcontext: BugReportContext,\n\ttitle: string,\n\tdescription: string,\n\tinitialValue?: string,\n): Promise<string | null> {\n\treturn new Promise((resolve) => {\n\t\tlet component: ExtensionEditorComponent;\n\t\tconst finish = (value: string | null) => {\n\t\t\trestoreEditor(context, component);\n\t\t\tresolve(value);\n\t\t};\n\t\tcomponent = new ExtensionEditorComponent(\n\t\t\tcontext.ui,\n\t\t\tcontext.keybindings,\n\t\t\ttitle,\n\t\t\tinitialValue,\n\t\t\t(value) => finish(value),\n\t\t\t() => finish(null),\n\t\t\t{ description },\n\t\t\tcontext.session.settingsManager.getExternalEditorCommand(),\n\t\t);\n\t\tshowOverlay(context, component);\n\t});\n}\n\nfunction choose(\n\tcontext: BugReportContext,\n\ttitle: string,\n\toptions: string[],\n\tdescription?: string,\n): Promise<string | undefined> {\n\treturn new Promise((resolve) => {\n\t\tlet component: ExtensionSelectorComponent;\n\t\tconst finish = (value?: string) => {\n\t\t\trestoreEditor(context, component);\n\t\t\tresolve(value);\n\t\t};\n\t\tcomponent = new ExtensionSelectorComponent(title, options, finish, () => finish(), {\n\t\t\ttui: context.ui,\n\t\t\tdescription,\n\t\t});\n\t\tshowOverlay(context, component);\n\t});\n}\n\nfunction showLoader(context: BugReportContext, message: string): BorderedLoader {\n\tconst loader = new BorderedLoader(context.ui, theme, message);\n\tshowOverlay(context, loader);\n\treturn loader;\n}\n\nfunction showOverlay(context: BugReportContext, component: Overlay): void {\n\tcontext.editorContainer.clear();\n\tcontext.editorContainer.addChild(component);\n\tcontext.ui.setFocus(component);\n\tcontext.ui.requestRender();\n}\n\nfunction restoreEditor(context: BugReportContext, component: Overlay): void {\n\tcomponent.dispose?.();\n\tcontext.editorContainer.clear();\n\tcontext.editorContainer.addChild(context.editor);\n\tcontext.ui.setFocus(context.editor);\n\tcontext.ui.requestRender();\n}\n"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { type Component, ScrollView, type ScrollViewScrollbar } from "@earendil-works/pi-tui";
|
|
2
2
|
export interface ChatViewportOptions {
|
|
3
|
+
readonly sidebar?: Component;
|
|
4
|
+
readonly sidebarWidth?: number;
|
|
3
5
|
readonly document: Component;
|
|
4
6
|
readonly pendingMessages: Component;
|
|
5
7
|
readonly status: Component;
|
|
@@ -14,6 +16,8 @@ export interface ChatViewportOptions {
|
|
|
14
16
|
export interface ChatViewport {
|
|
15
17
|
readonly root: Component;
|
|
16
18
|
readonly transcript: ScrollView;
|
|
19
|
+
setSidebarVisible(visible: boolean): void;
|
|
20
|
+
setSidebar(sidebar: Component | undefined, width?: number, visible?: (width: number) => boolean): void;
|
|
17
21
|
}
|
|
18
22
|
/** Shared fullscreen transcript and fixed input-dock layout. */
|
|
19
23
|
export declare function createChatViewport(options: ChatViewportOptions): ChatViewport;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-viewport.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/chat-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,
|
|
1
|
+
{"version":3,"file":"chat-viewport.d.ts","sourceRoot":"","sources":["../../../src/modes/interactive/chat-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAU,UAAU,EAAE,KAAK,mBAAmB,EAAU,MAAM,wBAAwB,CAAC;AAE9G,MAAM,WAAW,mBAAmB;IACnC,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;IAC7B,QAAQ,CAAC,eAAe,EAAE,SAAS,CAAC;IACpC,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,YAAY,CAAC,EAAE,SAAS,CAAC;IAClC,QAAQ,CAAC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IACzC,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;IACxD,QAAQ,CAAC,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACxD;AAED,MAAM,WAAW,YAAY;IAC5B,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;IAChC,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IAC1C,UAAU,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,OAAO,GAAG,IAAI,CAAC;CACvG;AAED,gEAAgE;AAChE,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,mBAAmB,GAAG,YAAY,CAgD7E"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ScrollView, VStack } from "@earendil-works/pi-tui";
|
|
1
|
+
import { HStack, ScrollView, VStack } from "@earendil-works/pi-tui";
|
|
2
2
|
/** Shared fullscreen transcript and fixed input-dock layout. */
|
|
3
3
|
export function createChatViewport(options) {
|
|
4
4
|
const transcript = new ScrollView(options.document, {
|
|
@@ -17,12 +17,36 @@ export function createChatViewport(options) {
|
|
|
17
17
|
...(options.widgetsBelow === undefined ? [] : [{ component: options.widgetsBelow, shrink: 1, minSize: 0 }]),
|
|
18
18
|
{ component: options.footer, shrink: 1, minSize: 0 },
|
|
19
19
|
]);
|
|
20
|
+
const transcriptAndDock = new VStack([
|
|
21
|
+
{ component: transcript, basis: 0, grow: 1, shrink: 1, minSize: 1 },
|
|
22
|
+
{ component: dock, basis: "auto", grow: 0, shrink: 1, minSize: 1 },
|
|
23
|
+
]);
|
|
24
|
+
let sidebarVisible = true;
|
|
25
|
+
let root = transcriptAndDock;
|
|
26
|
+
const setSidebar = (sidebar, width = 32, visible = (width) => width >= 100) => {
|
|
27
|
+
root =
|
|
28
|
+
sidebar === undefined
|
|
29
|
+
? transcriptAndDock
|
|
30
|
+
: new HStack([
|
|
31
|
+
{ component: transcriptAndDock, basis: 0, grow: 1, minSize: 1 },
|
|
32
|
+
{
|
|
33
|
+
component: sidebar,
|
|
34
|
+
basis: width,
|
|
35
|
+
shrink: 0,
|
|
36
|
+
visible: (viewport) => sidebarVisible && visible(viewport.width),
|
|
37
|
+
},
|
|
38
|
+
]);
|
|
39
|
+
};
|
|
40
|
+
setSidebar(options.sidebar, options.sidebarWidth);
|
|
20
41
|
return {
|
|
21
42
|
transcript,
|
|
22
|
-
root
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
43
|
+
get root() {
|
|
44
|
+
return root;
|
|
45
|
+
},
|
|
46
|
+
setSidebar,
|
|
47
|
+
setSidebarVisible(visible) {
|
|
48
|
+
sidebarVisible = visible;
|
|
49
|
+
},
|
|
26
50
|
};
|
|
27
51
|
}
|
|
28
52
|
//# sourceMappingURL=chat-viewport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-viewport.js","sourceRoot":"","sources":["../../../src/modes/interactive/chat-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,UAAU,EAA4B,MAAM,EAAE,MAAM,wBAAwB,CAAC;
|
|
1
|
+
{"version":3,"file":"chat-viewport.js","sourceRoot":"","sources":["../../../src/modes/interactive/chat-viewport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,MAAM,EAAE,UAAU,EAA4B,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAwB9G,gEAAgE;AAChE,MAAM,UAAU,kBAAkB,CAAC,OAA4B;IAC9D,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,OA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,GAAG,OAAO,CAAC;QAC1B,CAAC;KACD,CAAC;AACH,CAAC","sourcesContent":["import { type Component, HStack, ScrollView, type ScrollViewScrollbar, VStack } from \"@earendil-works/pi-tui\";\n\nexport interface ChatViewportOptions {\n\treadonly sidebar?: Component;\n\treadonly sidebarWidth?: number;\n\treadonly document: Component;\n\treadonly pendingMessages: Component;\n\treadonly status: Component;\n\treadonly editor: Component;\n\treadonly footer: Component;\n\treadonly widgetsAbove?: Component;\n\treadonly widgetsBelow?: Component;\n\treadonly scrollbar?: ScrollViewScrollbar;\n\treadonly scrollbarTrackStyle?: (text: string) => string;\n\treadonly scrollbarThumbStyle?: (text: string) => string;\n}\n\nexport interface ChatViewport {\n\treadonly root: Component;\n\treadonly transcript: ScrollView;\n\tsetSidebarVisible(visible: boolean): void;\n\tsetSidebar(sidebar: Component | undefined, width?: number, visible?: (width: number) => boolean): void;\n}\n\n/** Shared fullscreen transcript and fixed input-dock layout. */\nexport function createChatViewport(options: ChatViewportOptions): ChatViewport {\n\tconst transcript = new ScrollView(options.document, {\n\t\tfollow: \"end\",\n\t\tprimary: true,\n\t\toverscroll: \"chain\",\n\t\tscrollbar: options.scrollbar ?? \"auto\",\n\t\t...(options.scrollbarTrackStyle === undefined ? {} : { scrollbarTrackStyle: options.scrollbarTrackStyle }),\n\t\t...(options.scrollbarThumbStyle === undefined ? {} : { scrollbarThumbStyle: options.scrollbarThumbStyle }),\n\t});\n\tconst dock = new VStack([\n\t\t{ component: options.pendingMessages, shrink: 1, minSize: 0 },\n\t\t...(options.widgetsAbove === undefined ? [] : [{ component: options.widgetsAbove, shrink: 1, minSize: 0 }]),\n\t\t{ component: options.status, shrink: 0, minSize: 0 },\n\t\t{ component: options.editor, shrink: 1, minSize: 3 },\n\t\t...(options.widgetsBelow === undefined ? [] : [{ component: options.widgetsBelow, shrink: 1, minSize: 0 }]),\n\t\t{ component: options.footer, shrink: 1, minSize: 0 },\n\t]);\n\tconst transcriptAndDock = new VStack([\n\t\t{ component: transcript, basis: 0, grow: 1, shrink: 1, minSize: 1 },\n\t\t{ component: dock, basis: \"auto\", grow: 0, shrink: 1, minSize: 1 },\n\t]);\n\tlet sidebarVisible = true;\n\tlet root: Component = transcriptAndDock;\n\tconst setSidebar = (sidebar: Component | undefined, width = 32, visible = (width: number) => width >= 100) => {\n\t\troot =\n\t\t\tsidebar === undefined\n\t\t\t\t? transcriptAndDock\n\t\t\t\t: new HStack([\n\t\t\t\t\t\t{ component: transcriptAndDock, basis: 0, grow: 1, minSize: 1 },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcomponent: sidebar,\n\t\t\t\t\t\t\tbasis: width,\n\t\t\t\t\t\t\tshrink: 0,\n\t\t\t\t\t\t\tvisible: (viewport) => sidebarVisible && visible(viewport.width),\n\t\t\t\t\t\t},\n\t\t\t\t\t]);\n\t};\n\tsetSidebar(options.sidebar, options.sidebarWidth);\n\treturn {\n\t\ttranscript,\n\t\tget root() {\n\t\t\treturn root;\n\t\t},\n\t\tsetSidebar,\n\t\tsetSidebarVisible(visible) {\n\t\t\tsidebarVisible = visible;\n\t\t},\n\t};\n}\n"]}
|
|
@@ -14,6 +14,8 @@ export declare function formatCwdForFooter(cwd: string, home: string | undefined
|
|
|
14
14
|
export declare class FooterComponent implements Component {
|
|
15
15
|
/** Interactive mode moves built-in information above the editor, keeping extension statuses here. */
|
|
16
16
|
extensionStatusesOnly: boolean;
|
|
17
|
+
/** True only while the fullscreen sidebar column is actually mounted. */
|
|
18
|
+
sidebarVisible: boolean;
|
|
17
19
|
tasksProvider?: StatusTasksProvider;
|
|
18
20
|
private lastEventAt?;
|
|
19
21
|
private activitySessionId;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"footer.d.ts","sourceRoot":"","sources":["../../../../src/modes/interactive/components/footer.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,SAAS,EAAmD,MAAM,wBAAwB,CAAC;AACzG,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,g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AEtE,YAAY,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,0BAA0B,EAAE,aAAa,CAAC,EAAE,MAAM,IAAI,EAMpG;IAED,UAAU,CAAC,OAAO,EAAE,YAAY,GAAG,IAAI,CAItC;IAED,YAAY,IAAI,IAAI,CAEnB;IAED,0BAA0B,IAAI,IAAI,CAajC;IAED,kBAAkB,CAAC,MAAM,EAAE,MAAM,IAAI,GAAG,IAAI,CAM3C;IAED;;;;;OAKG;IACH,UAAU,IAAI,IAAI,CAAG;IAErB;;;OAGG;IACH,OAAO,IAAI,IAAI,CAId;IAED;;;;OAIG;IACH,OAAO,CAAC,eAAe;IAuDvB;;;OAGG;IACH,OAAO,CAAC,YAAY;IAqEpB,sGAAsG;IACtG,YAAY,CACX,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,OAAO,EACb,SAAS,SAAI,EACb,aAAa,SAAI,EACjB,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,EACtC,aAAa,GAAE,UAAU,GAAG,aAA0B,GACpD,MAAM,CA2DR;IAED,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAyBrC;IAED,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAY9B;IAED,qDAAqD;IACrD,OAAO,CAAC,WAAW;IAkEnB,OAAO,CAAC,UAAU;CA2BlB"}
|
|
@@ -48,6 +48,7 @@ export function formatCwdForFooter(cwd, home) {
|
|
|
48
48
|
/** The inputs compared by value: all but the extension statuses. */
|
|
49
49
|
const FOOTER_VALUE_INPUTS = [
|
|
50
50
|
"width",
|
|
51
|
+
"sidebarVisible",
|
|
51
52
|
"theme",
|
|
52
53
|
"identity",
|
|
53
54
|
"effort",
|
|
@@ -94,6 +95,8 @@ function sameFooterInputs(a, b) {
|
|
|
94
95
|
export class FooterComponent {
|
|
95
96
|
/** Interactive mode moves built-in information above the editor, keeping extension statuses here. */
|
|
96
97
|
extensionStatusesOnly = false;
|
|
98
|
+
/** True only while the fullscreen sidebar column is actually mounted. */
|
|
99
|
+
sidebarVisible = false;
|
|
97
100
|
tasksProvider;
|
|
98
101
|
lastEventAt;
|
|
99
102
|
activitySessionId;
|
|
@@ -226,7 +229,7 @@ export class FooterComponent {
|
|
|
226
229
|
const { usageTotals, latestCacheHitRate, tokensPerSecond, contextUsage } = this.getSessionStats();
|
|
227
230
|
const routed = this.session.routedModel;
|
|
228
231
|
const pwd = basename(this.session.sessionManager.getCwd()) || sep;
|
|
229
|
-
const branch = this.footerData.getGitBranch();
|
|
232
|
+
const branch = this.sidebarVisible ? null : this.footerData.getGitBranch();
|
|
230
233
|
const sessionName = this.session.sessionManager.getSessionName();
|
|
231
234
|
const effectiveModel = routed?.model ?? state.model;
|
|
232
235
|
const thinkingLevel = routed?.thinkingLevel ?? state.thinkingLevel ?? "off";
|
|
@@ -237,6 +240,7 @@ export class FooterComponent {
|
|
|
237
240
|
const statuses = this.footerData.getExtensionStatuses();
|
|
238
241
|
return {
|
|
239
242
|
width,
|
|
243
|
+
sidebarVisible: this.sidebarVisible,
|
|
240
244
|
theme: getThemeInstance(),
|
|
241
245
|
identity: [pwd, branch, sessionName]
|
|
242
246
|
.filter(Boolean)
|
|
@@ -288,14 +292,16 @@ export class FooterComponent {
|
|
|
288
292
|
renderStatus(width, state, busy, startedAt = 0, _lastDuration = 0, effortColor, statePriority = "balanced") {
|
|
289
293
|
busy = busy || this.session.isStreaming || this.session.isCompacting || this.session.isRetrying;
|
|
290
294
|
const inputs = this.renderInputs(width);
|
|
291
|
-
const tasks = this.tasksProvider?.getChecklistStatusSegment()?.text ?? "";
|
|
295
|
+
const tasks = inputs.sidebarVisible ? "" : (this.tasksProvider?.getChecklistStatusSegment()?.text ?? "");
|
|
292
296
|
const mcp = getMcpStatus(this.session.sessionManager);
|
|
293
297
|
const percent = inputs.contextPercent;
|
|
294
298
|
const contextColor = (percent ?? 0) > 90 ? "error" : (percent ?? 0) > 70 ? "warning" : "text";
|
|
295
299
|
const contextPercent = `Context ${percent === undefined ? "?" : `${percent.toFixed(1)}%`}`;
|
|
296
300
|
const model = theme.fg("text", inputs.routedModelId ?? inputs.modelName);
|
|
297
301
|
const fullContext = `${contextPercent} of ${formatTokens(inputs.contextWindow)}`;
|
|
298
|
-
const context =
|
|
302
|
+
const context = inputs.sidebarVisible
|
|
303
|
+
? ""
|
|
304
|
+
: theme.fg(contextColor, visibleWidth([state, model, fullContext].join(" › ")) <= width ? fullContext : contextPercent);
|
|
299
305
|
const timing = theme.fg("dim", busy ? `${Math.max(0, Math.floor((performance.now() - startedAt) / 1000))}s` : `last event ${inputs.age}`);
|
|
300
306
|
const essentialWidth = visibleWidth([state, model, context].join(" › "));
|
|
301
307
|
const timingWidth = essentialWidth + 5 + visibleWidth(timing) <= width ? visibleWidth(timing) : 0;
|
|
@@ -305,7 +311,9 @@ export class FooterComponent {
|
|
|
305
311
|
theme.getThinkingBorderColor(this.session.routedModel?.thinkingLevel ?? this.session.thinkingLevel))(inputs.effort),
|
|
306
312
|
theme.fg("dim", inputs.identity),
|
|
307
313
|
tasks,
|
|
308
|
-
|
|
314
|
+
inputs.sidebarVisible
|
|
315
|
+
? ""
|
|
316
|
+
: theme.fg("dim", `TPS ${inputs.tokensPerSecond?.toFixed(1) ?? "—"} › Hit ${inputs.latestCacheHitRate === undefined ? "—" : `${inputs.latestCacheHitRate.toFixed(1)}%`}`),
|
|
309
317
|
mcp ? theme.fg("dim", `MCP ${mcp.connected}/${mcp.total}`) : "",
|
|
310
318
|
busy ? theme.fg("dim", `${keyText("app.interrupt")} to interrupt`) : "",
|
|
311
319
|
], leftWidth, statePriority);
|
|
@@ -323,14 +331,22 @@ export class FooterComponent {
|
|
|
323
331
|
renderDetails(width) {
|
|
324
332
|
const inputs = this.renderInputs(width);
|
|
325
333
|
const fields = [
|
|
326
|
-
|
|
334
|
+
...(inputs.sidebarVisible
|
|
335
|
+
? []
|
|
336
|
+
: [
|
|
337
|
+
`${inputs.usageIncomplete ? "≥" : ""}$${inputs.cost.toFixed(3)}${inputs.usingSubscription ? " (sub)" : ""}${inputs.usageIncomplete ? " (usage incomplete)" : ""}`,
|
|
338
|
+
]),
|
|
327
339
|
`Account ${inputs.accountLabel ?? "—"}`,
|
|
328
340
|
`Provider ${this.session.state.model?.provider ?? "—"}`,
|
|
329
341
|
`In ${formatTokens(inputs.input)}`,
|
|
330
342
|
`Out ${formatTokens(inputs.output)}`,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
343
|
+
...(inputs.sidebarVisible
|
|
344
|
+
? []
|
|
345
|
+
: [
|
|
346
|
+
`Cache read ${formatTokens(inputs.cacheRead)}`,
|
|
347
|
+
`Cache write ${formatTokens(inputs.cacheWrite)}`,
|
|
348
|
+
`Context ${inputs.contextPercent === undefined ? "?" : `${inputs.contextPercent.toFixed(1)}%`} of ${formatTokens(inputs.contextWindow)}`,
|
|
349
|
+
]),
|
|
334
350
|
`Model ${inputs.modelName}`,
|
|
335
351
|
];
|
|
336
352
|
if (inputs.routedModelId && inputs.routedModelId !== inputs.modelName)
|
|
@@ -384,11 +400,11 @@ export class FooterComponent {
|
|
|
384
400
|
const contextColor = (contextPercent ?? 0) > 90 ? "error" : (contextPercent ?? 0) > 70 ? "warning" : "text";
|
|
385
401
|
const { usingSubscription } = inputs;
|
|
386
402
|
// Build stats line
|
|
387
|
-
const statsParts = [theme.fg(contextColor, context)];
|
|
388
|
-
if (inputs.usageIncomplete) {
|
|
403
|
+
const statsParts = inputs.sidebarVisible ? [] : [theme.fg(contextColor, context)];
|
|
404
|
+
if (!inputs.sidebarVisible && inputs.usageIncomplete) {
|
|
389
405
|
statsParts.push(theme.fg("muted", `${inputs.cost > 0 ? `≥$${inputs.cost.toFixed(3)}` : "Cost unknown"}${usingSubscription ? " (sub)" : ""} (usage incomplete)`));
|
|
390
406
|
}
|
|
391
|
-
else if (inputs.cost || usingSubscription) {
|
|
407
|
+
else if (!inputs.sidebarVisible && (inputs.cost || usingSubscription)) {
|
|
392
408
|
statsParts.push(theme.fg("muted", `$${inputs.cost.toFixed(3)}${usingSubscription ? " (sub)" : ""}`));
|
|
393
409
|
}
|
|
394
410
|
statsParts.push(theme.fg("dim", `In ${formatTokens(inputs.input)}`), theme.fg("dim", `Out ${formatTokens(inputs.output)}`));
|
|
@@ -399,7 +415,8 @@ export class FooterComponent {
|
|
|
399
415
|
if (inputs.cacheWrite)
|
|
400
416
|
cacheParts.push(theme.fg("dim", `Cache write ${formatTokens(inputs.cacheWrite)}`));
|
|
401
417
|
cacheParts.push(theme.fg("dim", `Hit ${inputs.latestCacheHitRate === undefined ? "—" : `${inputs.latestCacheHitRate.toFixed(1)}%`}`));
|
|
402
|
-
|
|
418
|
+
if (!inputs.sidebarVisible)
|
|
419
|
+
lines.push(...this.renderBand(cacheParts, theme.fg("dim", "/settings"), width));
|
|
403
420
|
// Add extension statuses on a single line, sorted by key alphabetically
|
|
404
421
|
if (inputs.extensionStatuses.length) {
|
|
405
422
|
// Truncate to terminal width with dim ellipsis for consistency with footer style
|