psyclaw 0.29.10 → 0.29.12

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 (50) hide show
  1. package/README.md +4 -4
  2. package/dist/apps/panel/index.html +643 -273
  3. package/dist/src/adapters/pi/extension.js +40 -1
  4. package/dist/src/adapters/pi/extension.js.map +1 -1
  5. package/dist/src/adapters/pi/rpc.js +1 -1
  6. package/dist/src/adapters/pi/rpc.js.map +1 -1
  7. package/dist/src/ars/mode-editor.d.ts +1 -5
  8. package/dist/src/ars/mode-editor.js +1 -9
  9. package/dist/src/ars/mode-editor.js.map +1 -1
  10. package/dist/src/branding.d.ts +4 -3
  11. package/dist/src/branding.js +8 -5
  12. package/dist/src/branding.js.map +1 -1
  13. package/dist/src/chat.d.ts +9 -0
  14. package/dist/src/chat.js +26 -3
  15. package/dist/src/chat.js.map +1 -1
  16. package/dist/src/cli-args.d.ts +1 -0
  17. package/dist/src/cli-args.js +1 -0
  18. package/dist/src/cli-args.js.map +1 -1
  19. package/dist/src/cli.js +12 -7
  20. package/dist/src/cli.js.map +1 -1
  21. package/dist/src/index.d.ts +2 -0
  22. package/dist/src/index.js +2 -0
  23. package/dist/src/index.js.map +1 -1
  24. package/dist/src/literature/knowledge-map.d.ts +4 -0
  25. package/dist/src/literature/knowledge-map.js +4 -0
  26. package/dist/src/literature/knowledge-map.js.map +1 -1
  27. package/dist/src/network-routing.js +6 -3
  28. package/dist/src/network-routing.js.map +1 -1
  29. package/dist/src/panel/server.js +1 -106
  30. package/dist/src/panel/server.js.map +1 -1
  31. package/dist/src/project/bootstrap.js +0 -2
  32. package/dist/src/project/bootstrap.js.map +1 -1
  33. package/dist/src/research/choice.d.ts +16 -0
  34. package/dist/src/research/choice.js +25 -0
  35. package/dist/src/research/choice.js.map +1 -0
  36. package/dist/src/session/continuously-work.d.ts +16 -0
  37. package/dist/src/session/continuously-work.js +44 -0
  38. package/dist/src/session/continuously-work.js.map +1 -0
  39. package/dist/src/session/help.js +39 -22
  40. package/dist/src/session/help.js.map +1 -1
  41. package/dist/src/style/cli-ui.js +1 -0
  42. package/dist/src/style/cli-ui.js.map +1 -1
  43. package/dist/src/verify/checklist.d.ts +2 -0
  44. package/dist/src/verify/checklist.js +36 -9
  45. package/dist/src/verify/checklist.js.map +1 -1
  46. package/dist/src/wake-options/runtime.d.ts +1 -0
  47. package/dist/src/wake-options/runtime.js +11 -1
  48. package/dist/src/wake-options/runtime.js.map +1 -1
  49. package/package.json +1 -1
  50. package/scripts/psyclaw.mjs +6 -2
@@ -18,8 +18,9 @@ import { fileURLToPath, pathToFileURL } from "node:url";
18
18
  import { coreSkillNames, enabledRecommendedSkillPaths, normalizeRecommendedSkillId, readRecommendationState, readRecommendedCatalog, recommendedSkillTarget, saveRecommendationState, validateModelInstalledRecommendedSkill, } from "../../skills/recommended.js";
19
19
  import { SkillManagerComponent } from "../../tui/skill-manager.js";
20
20
  import { WakeOptionsComponent } from "../../tui/wake-options.js";
21
- import { applyWakeVerifySync, buildWakePrompt, formatWakeResult, labelsFor, waitForPanelWakeAnswer, } from "../../wake-options/runtime.js";
21
+ import { applyWakeVerifySync, buildWakePrompt, createWakeVerifyChecklist, formatWakeResult, labelsFor, waitForPanelWakeAnswer, } from "../../wake-options/runtime.js";
22
22
  import { panelHub } from "../../panel/hub.js";
23
+ import { appendChoiceRecord } from "../../research/choice.js";
23
24
  import { enabledLocalSkillPaths, enabledLocalPromptPaths, readUserSkillState, scanLocalSkills, setLocalSkillEnabled, setLocalSkillsEnabled, skillNamesInPaths, installLocalSkill, userSkillId, } from "../../skills/user-skills.js";
24
25
  import { RuntimeMcpRegistry, setUserMcpConfigEnabled, } from "../../integrations/mcp-runtime.js";
25
26
  import { SecretInputComponent, ProviderPickerComponent, } from "../../tui/provider-picker.js";
@@ -31,6 +32,7 @@ import { formatAnalysisPlanTakeover, resolveStatsIntent, } from "../../analysis/
31
32
  import { arsRoot } from "../../ars/pi-panel-executor.js";
32
33
  import { ArsModeEditor, isArsModeEditorText } from "../../ars/mode-editor.js";
33
34
  import { MODE_STATUS, nextSessionMode, parseSessionMode, sessionModePrompt, } from "../../session/modes.js";
35
+ import { continuouslyWorkWarningText, isContinuouslyWorkEnabled, } from "../../session/continuously-work.js";
34
36
  import { formatVerifyChecklist, isNaturalPlanConfirm, loadVerifyChecklist, markVerifyItem, skipUnverifiedItems } from "../../verify/checklist.js";
35
37
  import { formatSessionHelp, formatSessionHelpBrief } from "../../session/help.js";
36
38
  import { openResearchWorkbench } from "../../panel/workbench.js";
@@ -1109,6 +1111,10 @@ export default function psyclawExtension(pi) {
1109
1111
  if (!legacyTestApi && typeof pi.on === "function")
1110
1112
  pi.on("session_start", (_event, ctx) => {
1111
1113
  arsUiContext = ctx;
1114
+ if (isContinuouslyWorkEnabled() && ctx.hasUI) {
1115
+ ctx.ui.setStatus("cw", "continuously-work");
1116
+ ctx.ui.notify(continuouslyWorkWarningText(), "error");
1117
+ }
1112
1118
  if (!ctx.hasUI || typeof ctx.ui.setEditorComponent !== "function")
1113
1119
  return;
1114
1120
  ctx.ui.setEditorComponent((tui, theme, keybindings) => {
@@ -2324,6 +2330,36 @@ export default function psyclawExtension(pi) {
2324
2330
  }
2325
2331
  },
2326
2332
  });
2333
+ pi.registerTool({
2334
+ name: "psyclaw_record_choice",
2335
+ label: "记录选择",
2336
+ description: "记录研究者对选项的回应。结构化唤醒选项或直接文本回应都必须记录;直接回应需保留原文并填写解析后的选项。",
2337
+ parameters: Type.Object({
2338
+ prompt: Type.String({ minLength: 1, description: "当时向研究者提出的问题或选择提示" }),
2339
+ originalResponse: Type.String({ minLength: 1, description: "研究者的原始回应,不能改写或省略" }),
2340
+ selectedIds: Type.Array(Type.String(), { description: "解析后的选项 ID;无法明确解析时为空" }),
2341
+ selectedLabels: Type.Array(Type.String(), { description: "解析后的选项名称" }),
2342
+ source: Type.Union([Type.Literal("tool"), Type.Literal("free-text")]),
2343
+ context: Type.Optional(Type.String({ description: "选择发生时的研究或任务上下文" })),
2344
+ }),
2345
+ executionMode: "sequential",
2346
+ async execute(_toolCallId, params, _signal, _onUpdate, ctx) {
2347
+ try {
2348
+ const record = await appendChoiceRecord(ctx.cwd, {
2349
+ prompt: params.prompt,
2350
+ originalResponse: params.originalResponse,
2351
+ selectedIds: params.selectedIds,
2352
+ selectedLabels: params.selectedLabels,
2353
+ source: params.source,
2354
+ ...(params.context === undefined ? {} : { context: params.context }),
2355
+ });
2356
+ return { content: [{ type: "text", text: JSON.stringify(record, null, 2) }], details: record };
2357
+ }
2358
+ catch (error) {
2359
+ return { content: [{ type: "text", text: `选择记录失败:${error instanceof Error ? error.message : String(error)}` }], details: { status: "failed" }, isError: true };
2360
+ }
2361
+ },
2362
+ });
2327
2363
  pi.registerTool({
2328
2364
  name: "psyclaw_wake_options",
2329
2365
  label: "唤醒选项",
@@ -2363,6 +2399,9 @@ export default function psyclawExtension(pi) {
2363
2399
  ...(params.syncVerify === undefined ? {} : { syncVerify: params.syncVerify }),
2364
2400
  ...(params.timeoutMs === undefined ? {} : { timeoutMs: params.timeoutMs }),
2365
2401
  });
2402
+ if (wakePrompt.mode === "checklist") {
2403
+ await createWakeVerifyChecklist(ctx.cwd, wakePrompt);
2404
+ }
2366
2405
  const timeoutMs = Math.max(5_000, new Date(wakePrompt.expiresAt).getTime() - Date.now());
2367
2406
  const panelClients = panelHub.subscriberCount();
2368
2407
  if (ctx.hasUI) {