psyclaw 0.31.2 → 0.31.4

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.
Files changed (38) hide show
  1. package/dist/apps/panel/index.html +15 -10
  2. package/dist/src/adapters/pi/extension.js +20 -1
  3. package/dist/src/adapters/pi/extension.js.map +1 -1
  4. package/dist/src/analysis/decision-points.d.ts +10 -0
  5. package/dist/src/analysis/decision-points.js +88 -0
  6. package/dist/src/analysis/decision-points.js.map +1 -0
  7. package/dist/src/analysis/method-rules.js +3 -2
  8. package/dist/src/analysis/method-rules.js.map +1 -1
  9. package/dist/src/analysis/runtime-tools.js +3 -1
  10. package/dist/src/analysis/runtime-tools.js.map +1 -1
  11. package/dist/src/analysis/shell-timeout.d.ts +18 -0
  12. package/dist/src/analysis/shell-timeout.js +58 -0
  13. package/dist/src/analysis/shell-timeout.js.map +1 -1
  14. package/dist/src/cli.js +29 -0
  15. package/dist/src/cli.js.map +1 -1
  16. package/dist/src/observability/config.d.ts +1 -0
  17. package/dist/src/observability/config.js +3 -1
  18. package/dist/src/observability/config.js.map +1 -1
  19. package/dist/src/observability/langfuse.d.ts +15 -4
  20. package/dist/src/observability/langfuse.js +38 -10
  21. package/dist/src/observability/langfuse.js.map +1 -1
  22. package/dist/src/observability/node-sdks.js +29 -4
  23. package/dist/src/observability/node-sdks.js.map +1 -1
  24. package/dist/src/observability/public-keys.d.ts +10 -0
  25. package/dist/src/observability/public-keys.js +10 -0
  26. package/dist/src/observability/public-keys.js.map +1 -1
  27. package/dist/src/project/jsonl.js +10 -4
  28. package/dist/src/project/jsonl.js.map +1 -1
  29. package/dist/src/project/workspace.js +16 -0
  30. package/dist/src/project/workspace.js.map +1 -1
  31. package/dist/src/session/modes.js +8 -3
  32. package/dist/src/session/modes.js.map +1 -1
  33. package/dist/src/updates/whats-new.d.ts +8 -0
  34. package/dist/src/updates/whats-new.js +43 -0
  35. package/dist/src/updates/whats-new.js.map +1 -0
  36. package/package.json +2 -2
  37. package/skills/core/analysis-plan/SKILL.md +5 -0
  38. package/skills/core/method-interactions/SKILL.md +2 -1
@@ -2800,16 +2800,21 @@ function capabilityActionButtons(item, busy) {
2800
2800
  }
2801
2801
 
2802
2802
  async function toggleCapability(kind, id, enabled) {
2803
- await json("/api/recommendation-state", {
2804
- method: "POST",
2805
- headers: { "content-type": "application/json" },
2806
- body: JSON.stringify({
2807
- kind: kind === "core" ? "core-skill" : kind === "skill" ? "skills" : kind === "local" ? "local-skill" : kind,
2808
- id,
2809
- enabled
2810
- })
2811
- });
2812
- await loadEcosystem();
2803
+ try {
2804
+ await json("/api/recommendation-state", {
2805
+ method: "POST",
2806
+ headers: { "content-type": "application/json" },
2807
+ body: JSON.stringify({
2808
+ kind: kind === "core" ? "core-skill" : kind === "skill" ? "skills" : kind === "local" ? "local-skill" : kind,
2809
+ id,
2810
+ enabled
2811
+ })
2812
+ });
2813
+ await loadEcosystem();
2814
+ } catch (error) {
2815
+ console.error("toggleCapability failed:", error);
2816
+ alert(`操作失败:${error.message || "panel request failed"}`);
2817
+ }
2813
2818
  }
2814
2819
 
2815
2820
  async function installCapability(kind, id) {
@@ -1,8 +1,10 @@
1
1
  import { DefaultPackageManager, getAgentDir, SettingsManager } from "@earendil-works/pi-coding-agent";
2
2
  import { isInstructionResult, isObservationEvidence, maskToolObservationsStable, observationSettledLimit } from "./observation-mask.js";
3
3
  import { outputLogFooter, persistToolOutput } from "../../analysis/output-log.js";
4
- import { applyShellTimeout, isShellTimeout, SHELL_TIMEOUT_HINT } from "../../analysis/shell-timeout.js";
4
+ import { applyShellTimeout, isShellTimeout, SHELL_TIMEOUT_HINT, ShellClock } from "../../analysis/shell-timeout.js";
5
5
  import { registerAnalysisRuntimeTools } from "../../analysis/runtime-tools.js";
6
+ import { PSYCLAW_VERSION } from "../../branding.js";
7
+ import { takeWhatsNew } from "../../updates/whats-new.js";
6
8
  import { formatDataAccess, loadDataAccess, redactScriptOnlyOutput, scriptOnlyBlock, setDataAccess } from "../../safety/data-access.js";
7
9
  import { Type } from "typebox";
8
10
  import { appendApproval, approvalInputDigest, assertResearchDecision, bootstrapProject, ensureProjectBinding, hasCanonicalWorkspace, resolveResearchDecision, runInstitutionalFulltext, runLiteratureReview, runExpertReview, runAnalysisDelegation, runWritingReview, runMetaAnalysis, createStageRunner, exportAcademicDocument, recordCitationUse, runParallelPeerReview } from "../../index.js";
@@ -1344,6 +1346,14 @@ export default function psyclawExtension(pi) {
1344
1346
  }
1345
1347
  catch { /* discovery must not block the session */ }
1346
1348
  }
1349
+ if (ctx.hasUI) {
1350
+ try {
1351
+ const notice = await takeWhatsNew(PSYCLAW_VERSION, join(getAgentDir(), "psyclaw-whats-new.json"));
1352
+ if (notice)
1353
+ ctx.ui.notify(notice, "info");
1354
+ }
1355
+ catch { /* the notice must not block the session */ }
1356
+ }
1347
1357
  if (isContinuouslyWorkEnabled() && ctx.hasUI) {
1348
1358
  ctx.ui.setStatus("cw", "continuously-work");
1349
1359
  ctx.ui.notify(continuouslyWorkWarningText(), "error");
@@ -1590,6 +1600,7 @@ export default function psyclawExtension(pi) {
1590
1600
  return { messages };
1591
1601
  });
1592
1602
  let dataAccessWarningShown = false;
1603
+ const shellClock = new ShellClock();
1593
1604
  if (!legacyTestApi && typeof pi.on === "function")
1594
1605
  pi.on("tool_call", async (event, ctx) => {
1595
1606
  // Host-teardown hard block runs even without /init — project approvals do not cover this.
@@ -1603,6 +1614,7 @@ export default function psyclawExtension(pi) {
1603
1614
  }
1604
1615
  }
1605
1616
  applyShellTimeout(event.toolName, event.input);
1617
+ shellClock.start(event.toolName, event.toolCallId, commandText);
1606
1618
  try {
1607
1619
  const access = await loadDataAccess(ctx.cwd);
1608
1620
  if (access.warning && !dataAccessWarningShown) {
@@ -1670,6 +1682,13 @@ export default function psyclawExtension(pi) {
1670
1682
  content[timedOutIndex] = { ...timedOut, text: `${timedOut.text}\n${SHELL_TIMEOUT_HINT}` };
1671
1683
  changed = true;
1672
1684
  }
1685
+ const timing = shellClock.finish(event.toolCallId);
1686
+ const lastText = content.map((part) => part.type).lastIndexOf("text");
1687
+ const last = content[lastText];
1688
+ if (timing && last?.type === "text") {
1689
+ content[lastText] = { ...last, text: `${last.text}\n${timing}` };
1690
+ changed = true;
1691
+ }
1673
1692
  if (!isObservationEvidence(event.toolName) && !isInstructionResult(event.toolName)) {
1674
1693
  const body = content.filter((part) => part.type === "text").map((part) => part.text).join("\n");
1675
1694
  const saved = await persistToolOutput(ctx.cwd, event.toolCallId, body, observationSettledLimit());