dsh-plugin-lookatstudy 0.20.0 → 0.20.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.d.mts CHANGED
@@ -32,7 +32,7 @@ declare const Config: z<Config>;
32
32
  declare const name = "lookatstudy-plugin";
33
33
  declare const inject: string[];
34
34
  /**
35
- * Register the activation-gated study surface: the 25 `study_*` tools (kept
35
+ * Register the activation-gated study surface: the 31 `study_*` tools (kept
36
36
  * unregistered while dormant), the tutor persona (stable core + soul), the
37
37
  * dynamic learner-snapshot context, and the `/study` command — every prompt
38
38
  * text renders empty while inactive, and empty sections are dropped at
package/lib/index.mjs CHANGED
@@ -2626,11 +2626,13 @@ function sendJson(res, status, value) {
2626
2626
  /**
2627
2627
  * Read one JSON body, answering 400 on malformed or oversized input so the
2628
2628
  * handler never throws into the HTTP layer.
2629
+ * @param maxBytes - per-route body ceiling; defaults to the tight 64 kB every
2630
+ * small-json route wants (issue #4: only the attachment intake lifts it).
2629
2631
  * @returns the parsed value, or undefined when the response is already sent.
2630
2632
  */
2631
- async function readJsonBodySafe(req, res) {
2633
+ async function readJsonBodySafe(req, res, maxBytes = 65536) {
2632
2634
  try {
2633
- return await readJsonBody(req);
2635
+ return await readJsonBody(req, maxBytes);
2634
2636
  } catch (error) {
2635
2637
  sendJson(res, 400, {
2636
2638
  ok: false,
@@ -2639,13 +2641,13 @@ async function readJsonBodySafe(req, res) {
2639
2641
  return;
2640
2642
  }
2641
2643
  }
2642
- /** Read one JSON request body with a hard 64 kB cap; malformed bodies reject. */
2643
- function readJsonBody(req) {
2644
+ /** Read one JSON request body with a hard cap (64 kB unless the route lifts it); malformed bodies reject. */
2645
+ function readJsonBody(req, maxBytes = 65536) {
2644
2646
  return new Promise((resolve, reject) => {
2645
2647
  const chunks = [];
2646
2648
  req.on("data", (chunk) => {
2647
2649
  chunks.push(chunk);
2648
- if (chunks.reduce((n, c) => n + c.length, 0) > 65536) {
2650
+ if (chunks.reduce((n, c) => n + c.length, 0) > maxBytes) {
2649
2651
  reject(/* @__PURE__ */ new Error("request body too large"));
2650
2652
  return;
2651
2653
  }
@@ -3140,7 +3142,7 @@ function registerDashboard(webServer, deps) {
3140
3142
  return;
3141
3143
  }
3142
3144
  if (req.method === "POST" && pathname === "/lookatstudy/api/attachment") {
3143
- const body = await readJsonBodySafe(req, res);
3145
+ const body = await readJsonBodySafe(req, res, 29360128);
3144
3146
  if (body === void 0) return;
3145
3147
  const name = typeof body.name === "string" ? body.name.trim() : "";
3146
3148
  const data = typeof body.dataBase64 === "string" ? body.dataBase64 : "";
@@ -8843,7 +8845,7 @@ function createStudySurface(registry, store) {
8843
8845
  const name = "lookatstudy-plugin";
8844
8846
  const inject = ["tools", "systemPrompt"];
8845
8847
  /**
8846
- * Register the activation-gated study surface: the 25 `study_*` tools (kept
8848
+ * Register the activation-gated study surface: the 31 `study_*` tools (kept
8847
8849
  * unregistered while dormant), the tutor persona (stable core + soul), the
8848
8850
  * dynamic learner-snapshot context, and the `/study` command — every prompt
8849
8851
  * text renders empty while inactive, and empty sections are dropped at
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-plugin-lookatstudy",
3
- "version": "0.20.0",
3
+ "version": "0.20.1",
4
4
  "packageManager": "pnpm@11.7.0",
5
5
  "description": "Turn any markdown, local folder, or GitHub learning repo into a guided course inside DeepSeek Harness: gated skill-tree progression, BKT mastery tracking, SM-2 spaced repetition.",
6
6
  "type": "module",