30 Commits

Author SHA1 Message Date
Vijay Janapa Reddi
037c28d63e fix(socratiq): rename clear_chats_temp.js to clear_chats.js
Update the (commented) import in src_shadow/js/index.js to the new path.
2026-05-02 09:57:45 -04:00
Vijay Janapa Reddi
a8acabda61 fix(socratiq): loop strip in vite dev injector
Single-pass replace can leave overlapping matches re-formed (e.g.
<scrip<script ...></script>t...></script>). Iterate until stable so
the dev-server injector never serves a half-stripped script tag.

Input is the package's own on-disk HTML, so this is defense-in-depth
rather than a live exploit, but it clears the CodeQL alert.

Closes CodeQL #108.
2026-05-01 17:23:49 -04:00
Vijay Janapa Reddi
09976342d2 fix(socratiq): bump uuid to ^14.0.0 (GHSA, buffer bounds in v3/v5/v6)
Transitive via mermaid@11.14.0 — only consumer in this package — uses
uuid v4 (random IDs for diagrams), unaffected by the buffer-bounds bug
in v3/v5/v6, but Dependabot still flags any uuid <14.0.0. Pinned via
overrides so future mermaid bumps stay on the patched line.

Closes Dependabot #88.
2026-05-01 17:23:27 -04:00
dependabot[bot]
39f033cc33 build(deps): bump solid-js from 1.9.3 to 1.9.12 in /socratiq
Bumps [solid-js](https://github.com/solidjs/solid) from 1.9.3 to 1.9.12.
- [Release notes](https://github.com/solidjs/solid/releases)
- [Changelog](https://github.com/solidjs/solid/blob/main/CHANGELOG.md)
- [Commits](https://github.com/solidjs/solid/commits)

---
updated-dependencies:
- dependency-name: solid-js
  dependency-version: 1.9.12
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-26 08:21:04 -04:00
dependabot[bot]
eff5e8ec2b build(deps): bump markdown-it from 14.1.0 to 14.1.1 in /socratiq
Bumps [markdown-it](https://github.com/markdown-it/markdown-it) from 14.1.0 to 14.1.1.
- [Changelog](https://github.com/markdown-it/markdown-it/blob/master/CHANGELOG.md)
- [Commits](https://github.com/markdown-it/markdown-it/compare/14.1.0...14.1.1)

---
updated-dependencies:
- dependency-name: markdown-it
  dependency-version: 14.1.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-26 08:19:55 -04:00
Vijay Janapa Reddi
64c99415c1 fix(socratiq): bump vite-plugin-singlefile to ^2.3.0 to satisfy vite 8 peer dep
vite-plugin-singlefile@2.0.2 declares a peer dependency on
vite ^5.4.11 || ^6.0.0, but socratiq/ pins vite ^8.0.10. npm refused
to resolve the dep tree, so 'npm ci' failed in the SocratiQ Bundle
Drift workflow on every PR that touched socratiq/package-lock.json
— including dependabot bumps for unrelated transitive packages
(see #1538 markdown-it, #1539 solid-js).

vite-plugin-singlefile@2.3.0+ supports vite 5/6/7/8, so a one-line
bump unblocks 'npm ci', which lets the bundle drift check actually
run again.

Also commits the regenerated production bundle and stylesheet to
satisfy the drift check itself.
2026-04-26 07:57:18 -04:00
Vijay Janapa Reddi
56476b5d3f chore: clean up socratiq markdown formatting
Apply repository whitespace and final-newline formatting to Socratiq shadow documentation.
2026-04-25 12:35:31 -04:00
Vijay Janapa Reddi
320531eaec Merge remote-tracking branch 'origin/dev' into dev 2026-04-25 10:38:00 -04:00
Vijay Janapa Reddi
b4f1ed4d5e Merge pull request #1535 from harvard-edge/dependabot/npm_and_yarn/socratiq/multi-1a3f9df82b
build(deps): bump jspdf and jspdf-autotable in /socratiq
2026-04-25 08:52:43 -04:00
Vijay Janapa Reddi
400f0e3027 docs: clarify MLSysBook ecosystem paths
Align public README and site messaging around the curriculum components, adoption paths, and current early-release status so newcomers can move from reading to building, deployment, practice, and teaching.
2026-04-25 08:48:38 -04:00
dependabot[bot]
34503c7f07 build(deps-dev): bump rollup from 4.29.1 to 4.60.2 in /socratiq
Bumps [rollup](https://github.com/rollup/rollup) from 4.29.1 to 4.60.2.
- [Release notes](https://github.com/rollup/rollup/releases)
- [Changelog](https://github.com/rollup/rollup/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rollup/rollup/compare/v4.29.1...v4.60.2)

---
updated-dependencies:
- dependency-name: rollup
  dependency-version: 4.60.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-25 12:08:00 +00:00
dependabot[bot]
007fd45409 build(deps): bump jspdf and jspdf-autotable in /socratiq
Bumps [jspdf](https://github.com/parallax/jsPDF) and [jspdf-autotable](https://github.com/simonbengtsson/jsPDF-AutoTable). These dependencies needed to be updated together.

Updates `jspdf` from 2.5.2 to 4.2.1
- [Release notes](https://github.com/parallax/jsPDF/releases)
- [Changelog](https://github.com/parallax/jsPDF/blob/master/RELEASE.md)
- [Commits](https://github.com/parallax/jsPDF/compare/v2.5.2...v4.2.1)

Updates `jspdf-autotable` from 3.8.4 to 5.0.7
- [Release notes](https://github.com/simonbengtsson/jsPDF-AutoTable/releases)
- [Commits](https://github.com/simonbengtsson/jsPDF-AutoTable/compare/v3.8.4...v5.0.7)

---
updated-dependencies:
- dependency-name: jspdf
  dependency-version: 4.2.1
  dependency-type: direct:production
- dependency-name: jspdf-autotable
  dependency-version: 5.0.7
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-25 12:07:50 +00:00
Vijay Janapa Reddi
ded983b0cf Merge pull request #1534 from harvard-edge/dependabot/npm_and_yarn/socratiq/picomatch-2.3.2
build(deps-dev): bump picomatch from 2.3.1 to 2.3.2 in /socratiq
2026-04-25 08:06:21 -04:00
dependabot[bot]
bc8dcd4831 build(deps-dev): bump vite from 5.4.20 to 8.0.10 in /socratiq
Bumps [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) from 5.4.20 to 8.0.10.
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.10/packages/vite)

---
updated-dependencies:
- dependency-name: vite
  dependency-version: 8.0.10
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-25 11:47:25 +00:00
dependabot[bot]
a7090b2c6d build(deps-dev): bump picomatch from 2.3.1 to 2.3.2 in /socratiq
Bumps [picomatch](https://github.com/micromatch/picomatch) from 2.3.1 to 2.3.2.
- [Release notes](https://github.com/micromatch/picomatch/releases)
- [Changelog](https://github.com/micromatch/picomatch/blob/master/CHANGELOG.md)
- [Commits](https://github.com/micromatch/picomatch/compare/2.3.1...2.3.2)

---
updated-dependencies:
- dependency-name: picomatch
  dependency-version: 2.3.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-25 11:47:14 +00:00
Vijay Janapa Reddi
50ad24a405 Merge pull request #1519 from harvard-edge/dependabot/npm_and_yarn/socratiq/multi-5c6596e7bd
build(deps): bump lodash-es and mermaid in /socratiq
2026-04-25 07:45:49 -04:00
dependabot[bot]
0fd17dd6e3 build(deps): bump seroval from 1.1.1 to 1.5.2 in /socratiq
Bumps [seroval](https://github.com/lxsmnsyc/seroval) from 1.1.1 to 1.5.2.
- [Release notes](https://github.com/lxsmnsyc/seroval/releases)
- [Commits](https://github.com/lxsmnsyc/seroval/commits)

---
updated-dependencies:
- dependency-name: seroval
  dependency-version: 1.5.2
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-25 00:34:28 +00:00
dependabot[bot]
c6378b3566 build(deps): bump lodash-es and mermaid in /socratiq
Bumps [lodash-es](https://github.com/lodash/lodash) to 4.18.1 and updates ancestor dependency [mermaid](https://github.com/mermaid-js/mermaid). These dependencies need to be updated together.


Updates `lodash-es` from 4.17.21 to 4.18.1
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.21...4.18.1)

Updates `mermaid` from 11.11.0 to 11.14.0
- [Release notes](https://github.com/mermaid-js/mermaid/releases)
- [Commits](https://github.com/mermaid-js/mermaid/compare/mermaid@11.11.0...mermaid@11.14.0)

---
updated-dependencies:
- dependency-name: lodash-es
  dependency-version: 4.18.1
  dependency-type: indirect
- dependency-name: mermaid
  dependency-version: 11.14.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2026-04-24 20:02:45 +00:00
Vijay Janapa Reddi
569bfeb1fe fix(socratiq): sync lock file with package.json and rebuild bundle
The new bundle-drift CI guard caught a real inconsistency left over
from #1394: package.json declares "dompurify": "^3.4.0" (added as
part of the security-fix commits), but package-lock.json still
pinned dompurify@2.5.8. As a result:

- npm ci refused to install from the lock (exit code EUSAGE), which
  broke both the drift guard and anyone running `npm ci` locally.
- The committed bundle.js was built against the old dompurify, so
  the rendered book was silently serving the 2.5.x code instead of
  the 3.4.x the package.json declared.

This commit runs `npm install` (lock: 2.5.8 -> 3.4.1) and `npm run
build:vite` to regenerate the bundle from sources that actually
match the declared dependency set. Vite reports 2976 modules
transformed, bundle size 6.6 MB unchanged.

The drift guard should now pass on this branch, validating that the
guard works end-to-end on its introduction PR.
2026-04-24 13:50:24 -04:00
Vijay Janapa Reddi
858011aaac chore(socratiq): rename package to @mlsysbook/socratiq
The package had been carrying the legacy name "injectchat" inherited
from an earlier prototype. Rename to the scoped name matching the
rest of the mlsysbook ecosystem, add a real description, and mark the
package private so it cannot be accidentally published to npm.

No behavioural change — the package is consumed only via the prebuilt
bundle at book/quarto/tools/scripts/socratiQ/bundle.js; nothing in
the repository imports it by name.
2026-04-24 13:42:42 -04:00
Vijay Janapa Reddi
11d32a0321 chore(socratiq): remove dead plugins from vite prod config
The file-watcher and auto-refresh plugins in vite.config.prod.mjs were
no-ops in production:

- file-watcher called fs.watch() inside buildStart() with the comment
  "The build will be triggered automatically by Vite's dev server" —
  but there is no dev server in a production build. It only emitted
  logs and held an active fs watcher handle.
- auto-refresh registered a vite:beforeUpdate hook inside
  configureServer(server) — configureServer is dev-only and is
  silently ignored by Vite during production builds.

Dev-time HMR is already handled by Vite's built-in mechanism plus the
server.watch polling configured in vite.config.dev.mjs; these prod
plugins added no behaviour.

Also drops the now-unused 'watch' and 'unlinkSync' imports from 'fs'.
2026-04-24 13:42:26 -04:00
Vijay Janapa Reddi
af45de439a chore(socratiq): remove orphan files and unused build configs
- Delete Finder-duplicate artifacts: "webpack.config copy 2.js",
  "testQuiz copy.html".
- Delete pre-rewrite orphan
  create_quiz_button_grp_original_with_good_reinialization.js.js
  (double .js.js extension, zero importers).
- Delete legacy webpack.config.js: not referenced by any npm script or
  tooling; the widget has fully migrated to Vite's single-file bundle.
- Delete vite.config.coop.mjs and vite.dev.config.mjs: not referenced
  by package.json scripts; COOP/COEP headers are already applied by
  the active dev and prod configs.

No functional change; all referenced sources and configs are untouched.
2026-04-24 13:42:14 -04:00
kai4avaya
362cf8787e fix: restore copy_download.js accidentally deleted in cleanup commit
bbe85444 deleted both 'copy_download copy.js' (orphan) and
'copy_download.js' (live import). index.js line 122 imports
initializeAllMessageButtons from this file — restore it.
2026-04-21 19:42:53 -04:00
kai4avaya
c2c47875a9 fix: address auto-reviewer CodeQL and code-quality warnings
- showQuizStats.js: add escapeHtml() and sanitize fileName/reason/details
  before injecting into verificationModal.innerHTML (XSS: DOM text reinterpreted as HTML)
- injectQuizBtn.js: replace quizTitle string interpolation in innerHTML with
  DOM construction (textContent) to prevent XSS (DOM text reinterpreted as HTML)
- highlight_menu.js: fix 'classList.contains === "hidden"' type error —
  was comparing function reference to string; now correctly called as
  classList.contains("hidden") (comparison between inconvertible types)
- index.html + indexHtml.js: rename malformed space-containing id attributes
  'Show answers' -> 'show-answers' and 'Show chain of thought' -> 'show-chain-of-thought'
- settings.js: update three matching string keys to kebab-case to stay in sync
  with renamed HTML ids (coordinated rename, no functionality change)
- demo_reference_rendering.html: add safeParseReferences() fallback wrapper,
  replace direct parseReferences() call which was undefined in this context
- test_reference_renderer.js: remove parseReferences import (not exported),
  rewrite testReferenceParsing() to use processReferences() with HTML output assertions
2026-04-21 19:40:51 -04:00
kai4avaya
bbe85444e8 clean: remove orphan editor swap files and duplicate copies 2026-04-21 19:32:09 -04:00
kai4avaya
10327653ad feat: redesign meditation pulse toggle button with label and icon 2026-04-21 19:32:00 -04:00
kai4avaya
b19b9306ee fix: address CodeQL security alerts and code quality warnings
- XSS: validate URL (same-origin, http/https only) before window.location.href
  in streamdown_markdown.js and reference_renderer.js
- XSS: replace tooltip.innerHTML with DOM construction in streamdown_markdown.js
- XSS: sanitize mermaid SVG with DOMPurify in renderMermaid() and at call site
- XSS: sanitize customContainerHtml, mathDiv, and preview.innerHTML with DOMPurify
- XSS: replace button.innerHTML with textContent for question buttons
- XSS: add escapeHtml() for mermaid error messages interpolated into innerHTML
- Add DOMPurify ^3.4.0 to dependencies
- Remove duplicate diagramId assignments in highlight.js and markdown.js
- Remove unused percentLineIndex variable in markdown.js and streamdown_markdown.js
- Remove useless targetElement assignment in streamdown_markdown.js
- chart.js: replace /auto import with tree-shaken named imports in spaced-repetition-stats.js
- Add _comments to package.json documenting bundle size analysis per dependency
2026-04-21 19:32:00 -04:00
kai4avaya
80c5f62708 feat: fix SocratiQ re-entry bug and add initialization loader 2026-04-21 19:32:00 -04:00
kai4avaya
c7fcc9d995 feat: sync SocratiQ source changes and remove legacy bundle 2026-04-21 19:32:00 -04:00
kai4avaya
81909553c3 feat: add socratiq directory (excluding node_modules and dist) 2026-04-21 18:39:28 -04:00