qwen-code/.gitattributes
Heyang Wang 7f7bce3174
feat: chat transcript mr2a html export (#10076)
* feat(transcript): add cross-host document export pipeline

Establish a shared transcript model and document-mode projection so Web
Shell, VS Code, and HTML export can consume the same stable conversation
semantics without changing interactive rendering.

- Preserve daemon and ACP segment identity across replay and normalization
- Add export-safe previews and a versioned transcript document builder
- Add document-mode Web Shell rendering with bounded Mermaid processing
- Lock direct-daemon and ACP behavior with contract fixtures
- Cover render and export equivalence in integration tests

* feat(transcript): wire real VS Code and HTML export consumers

Move transcript prevalidation onto real product paths while preserving
the legacy VS Code timeline as the default fallback.

- Add version-bound document HTML with strict CSP and schema checks
- Add opt-in ACP projection with stable source identity
- Reuse product export code across hosts and the integration runner
- Remove test-only production probes and consolidate shared validation

Note: Browser, host-action, VSIX, and packaging gates remain pending.

* build(deps): sync transcript workspace dependencies

Keep the npm lockfile aligned with the VS Code and HTML export package
manifests added by the transcript consumer migration.

- Lock the VS Code Web Shell workspace dependency
- Lock Web Templates SDK, Web Shell, and React build dependencies

* fix(transcript): harden export and identity paths

Resolve review findings across document export and the VS Code ACP
timeline while preserving default interactive and readonly semantics.

- Preserve stable text and non-text identity across live and replay
- Harden export projection, budgets, URL handling, CSP, and nonces
- Make document rendering complete, inert, and browser-validated
- Keep VS Code transcript scope, theme, copy, and flags reactive
- Restore fixture, schema, hash, and compatibility contract locks

Note: The overall gate remains failed pending VSIX, host-action, and
packaged-artifact evidence.

* fix(transcript): harden identity and document export

Close the latest review findings across transcript identity, VS Code
rehydration, and the HTML export security boundary.

- Terminate discrete ACP segments and bind automatic turn provenance
- Reset VS Code transcript scopes across replay and reconnect lifecycles
- Align Markdown sanitization and envelope budgets with document rendering
- Run browser gates with Chromium and complete third-party notices

* fix(transcript): simplify adapters and preserve segment boundaries

Reduce the shared transcript review surface while keeping the VS Code and
HTML Export consumers and their security gates intact.

- Merge VS Code feature state into the ACP transcript hook
- Collect source identity once and strip it at the compatibility boundary
- Remove test-only export adapters, gate reports, and duplicate helpers
- Keep shell output separated when stable producer segments change
- Mark third-party notices as generated review content

* fix(transcript): address cross-host review regressions

* fix(transcript): harden export sanitization and user identity

Close the latest review findings around document resource safety and
recorded-user replay consistency.

- Redact local home paths structurally without corrupting remote URLs
- Sanitize nested Markdown images inside otherwise safe links
- Advance merged segment provenance without duplicating separators
- Keep recorded-user stable IDs anchored to durable record identity

* fix(web-shell): restore agent-only group predicate

* refactor(transcript): split HTML export from VS Code migration

Keep MR2A focused on the document export pipeline while preserving the legacy VS Code timeline.

- Retain VS Code /export html as a real document consumer
- Move live transcript adapters, identity wiring, and feature flag to MR2B
- Remove the direct Web Shell dependency and restore baseline notices
- Keep candidate identity evidence in integration-only helpers
- Document the MR1, MR2A, and MR2B delivery boundaries

* fix(web-shell): keep compact agent summaries separate

Preserve synthetic compact summary rows when parallel-agent grouping runs
after compact tool-group aggregation.

- Exclude summary rows from foreground agent-only grouping
- Exclude summary rows from background agent-only grouping

* fix(core): remove duplicate telemetry test mock

* refactor(sdk): share todo preview render fallback

* fix(web-shell): align document subtools with main

* fix(transcript): address HTML export review findings

* fix(transcript): address export review findings

* fix(transcript): close export boundary bypasses

Harden the document export boundary after the latest review found
mixed-path and Markdown parser/scanner gaps.

- Normalize dot segments and mixed separators before home redaction
- Align Markdown preflight with fences, HTML comments, and delimiters
- Remove the internal review report from the tracked repository

* fix(transcript): close export review findings

Close three Critical review findings in the document export and safe
transcript projection paths.

- Share percent-token decoding between home-path redaction and checks
- Reject parser/scanner divergence before Markdown parsing can stall
- Preserve todo entries carried by the document-safe projection
- Add regression witnesses for each reported failure mode

* fix(export): restore document parity and harden projections

Restore HTML export parity without weakening the sealed document
boundary.

- Reject recursively encoded and split home-path structures
- Keep synthesized todo identities unique from authored values
- Restore safe metadata, theme, and document-wide expansion controls

* fix(export): close home-path redaction entrances and restore safe-projection signals

- safePath: detect home segments at any depth (nested /usr/home, /export/home, UNC shares map to [home])
- redactor/validator: use a precise URL pattern (authority+path only) so URL-adjacent and URL-query home paths are no longer absorbed into the remote-URL span; allow quoted username segments
- exporter: dynamic-import the export API in main() with an ERR_MODULE_NOT_FOUND guard and a clear build-precondition message
- safe projection: propagate executionMode from block.background so foreground subagent launches stay separate and keep intervening thinking

* fix(export): close residual home-path leaks

Harden the sealed document boundary against path spellings that could
survive the existing surgical redaction pass.

- Detect residual home components independently after redaction
- Handle spaced usernames and URL-adjacent local paths
- Exempt validated raster thumbnails from visible-text scanning

* fix(export): handle Markdown fences across containers

Prevent document export from aborting or dropping valid code when
fenced Markdown uses non-LF endings or blockquote containers.

- Demote rich fences with CRLF and CR opening lines
- Track CommonMark blockquote ownership with bounded linear scanning
- Cover quoted, nested, HTML-container, and line-ending regressions

* fix(export): unify home-path grammar and keep cancelled safe results

Round 8 review found the export home-path boundary still open at two
entrances, and the document safe projection silently destroying a
cancelled sub-agent's terminal result.

- Derive the residual home-path detector from the redaction grammar
  instead of hand-modelling it, and redact bare plus line-initial
  relative home roots so ordinary text is no longer discarded wholesale
- Consume each remote URL as one token: verified remote paths pass
  through byte-identical, while a token whose ownership stays ambiguous
  after a delimiter or a malformed authority degrades as a whole
- Return typed omission signals from home redaction so encoded-content
  and URL degradation always set truncated/complete with a diagnostic,
  instead of inferring state from a marker string a transcript can forge
- Preserve a string terminal result when stamping the cancelled
  background-agent marker, and project that cancellation to failed plus
  wasCancelled only on the explicit safe projection path

Note: interactive and readonly callers keep the existing raw and status
compatibility, so a cancelled background agent still reconciles to
completed there.

* fix(export): strip URL credentials from exported command previews

`user_shell.command` and the `command` tool preview went into the document
through `budget.plainText`, which only applies home-path redaction and the byte
budget. A reachable `curl https://user:password@example.test/file?token=secret`
therefore carried both the URL userinfo and the secret query into the exported
JSON and the shareable HTML, against the contract that credentials never enter
the document.

Reuses the projector's own `normalizeNavigableUrl` — the same helper the typed
`web_fetch.url` and repository paths already go through, which clears
`username`, `password`, `search` and `hash` — rather than reaching for the
SDK's `sanitizeUrlsInText`, which is module-private in `daemon/ui/render.ts`
and would have needed a new public export. A command is free text that embeds a
URL rather than being one, so the new helper rewrites each embedded match and
reports `url_sanitized` / `url_rejected` through the existing diagnostics
counter.

Runs before `budget.plainText`: a URL truncated first may no longer match the
pattern, and the truncation boundary should be measured on the text that
actually ships.

Scope is http(s), matching `normalizeNavigableUrl`. A credential in a
non-navigable scheme (`ssh user:pw@host`) or a bare flag (`-pSECRET`) is not
covered; that needs argument-aware redaction, which this projector does not
attempt. The limit is stated on the helper so the contract is not read as
stronger than the code.

* test(web-shell): keep the render-mode provider across session-switch rerenders

Two of main's session-guard tests failed on this branch:
`ignores a stale polling response from the previous session` and
`ignores a workflow action that settles after switching sessions`, both with a
spy that must not fire being called once.

The component was not at fault. Its diff against main is only `documentMode`
guards, and `documentMode` is false throughout these tests, so the interactive
paths are main's unchanged. The cause is the shape of the React tree: this
branch's mount helper renders
`I18nProvider > TranscriptRenderModeProvider > TasksStatusMessage`, while those
tests simulate a session switch by calling `root.render` again with
`I18nProvider > TasksStatusMessage`. The element type at that position changes,
so React unmounts the subtree and mounts a fresh component instead of updating
it — which resets `expectedSessionIdRef` and re-runs the polling effect, and
the guard those tests exist to pin never gets the chance to suppress anything.

Wrapping the three bare `root.render` calls keeps the tree shape stable across
the rerender, with the same `interactive` value the helper defaults to, so the
component updates in place as the tests intend.

ToolGroup.test.tsx has the same bare-render shape in places but its tests pass —
those sites are fresh mounts, where a remount is not observable — so they are
left alone rather than churned.

* fix(web-shell): declare documentMode in the two workflow callback deps

`lint:ci` runs eslint with `--max-warnings 0`, so the two
`react-hooks/exhaustive-deps` warnings failed the job outright:

  TasksStatusMessage.tsx
    610:5  React Hook useCallback has a missing dependency: 'documentMode'
    655:5  React Hook useCallback has a missing dependency: 'documentMode'

`handleWorkflowAction` and `handleWorkflowHistoryDelete` gained a
`if (documentMode || busy) return;` guard during the merge, but their dependency
arrays sat outside the conflict regions and so kept main's list. Adding the
dependency is also the correct fix rather than a lint appeasement: both
callbacks close over `documentMode` now, and a stale closure would let a
document render run an action it must not.

Swept the file afterwards for any other hook whose body reads `documentMode`
without declaring it; these two were the only ones.

* fix(export): validate URL boundaries and raster signatures

Close verified document admission gaps without changing live transcript
semantics or discarding legitimate remote path examples.

- Reject missing and encoded home-path authorities before URL repair
- Check raster MIME signatures in the producer and envelope validator
- Remove redundant separator repetition and pin bounded regressions
- Preserve normal remote URLs and record undecidable decoding as loss

Note: Signatures check format headers, not full image or secret safety.

* ci: record e2e.yml growth in the workflow size baseline

e2e.yml is now 30022 bytes: 3610 bytes of drift already merged into
main within the 4096-byte allowance, plus this PR's transcript
document browser gate (the dedicated gate step, the
chat-transcript-document exclusions, and the nested Playwright CLI
install). Bump the ratchet in this PR as the gate requests, so the
growth stays a reviewed line.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* test(web-shell): scope workflow history visual assertion

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

---------

Co-authored-by: heyang.why <heyang.why@alibaba-inc.com>
Co-authored-by: 易良 <1204183885@qq.com>
Co-authored-by: jinjing.zzj <jinjing.zzj@alibaba-inc.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: yiliang114 <effortyiliang@gmail.com>
2026-09-04 14:36:35 +00:00

28 lines
852 B
Text

# Set the default behavior for all files to automatically handle line endings.
# This will ensure that all text files are normalized to use LF (line feed)
# line endings in the repository, which helps prevent cross-platform issues.
* text=auto eol=lf
# Explicitly declare files that must have LF line endings for proper execution
# on Unix-like systems.
*.sh eol=lf
*.bash eol=lf
Makefile eol=lf
packages/vscode-ide-companion/NOTICES.txt linguist-generated=true
# Windows cmd.exe expects batch installers to be checked out with CRLF.
scripts/installation/install-qwen-standalone.bat text eol=crlf
# Explicitly declare binary file types to prevent Git from attempting to
# normalize their line endings.
*.png binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ico binary
*.pdf binary
*.woff binary
*.woff2 binary
*.eot binary
*.ttf binary
*.otf binary