psyclaw 0.25.2 → 0.26.0

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 (271) hide show
  1. package/README.md +111 -60
  2. package/{apps → dist/apps}/panel/index.html +50 -28
  3. package/dist/src/adapters/pi/extension.d.ts +19 -0
  4. package/dist/src/adapters/pi/extension.js +735 -0
  5. package/dist/src/adapters/pi/extension.js.map +1 -0
  6. package/dist/src/adapters/pi/model.d.ts +72 -0
  7. package/dist/src/adapters/pi/model.js +152 -0
  8. package/dist/src/adapters/pi/model.js.map +1 -0
  9. package/dist/src/adapters/pi/resources.d.ts +23 -0
  10. package/dist/src/adapters/pi/resources.js +54 -0
  11. package/dist/src/adapters/pi/resources.js.map +1 -0
  12. package/dist/src/adapters/pi/rpc.d.ts +58 -0
  13. package/dist/src/adapters/pi/rpc.js +253 -0
  14. package/dist/src/adapters/pi/rpc.js.map +1 -0
  15. package/dist/src/adapters/pi/session.d.ts +30 -0
  16. package/dist/src/adapters/pi/session.js +64 -0
  17. package/dist/src/adapters/pi/session.js.map +1 -0
  18. package/dist/src/agents/catalog.d.ts +30 -0
  19. package/dist/src/agents/catalog.js +118 -0
  20. package/dist/src/agents/catalog.js.map +1 -0
  21. package/dist/src/agents/discover.d.ts +28 -0
  22. package/dist/src/agents/discover.js +127 -0
  23. package/dist/src/agents/discover.js.map +1 -0
  24. package/dist/src/agents/import.d.ts +67 -0
  25. package/dist/src/agents/import.js +789 -0
  26. package/dist/src/agents/import.js.map +1 -0
  27. package/dist/src/analysis/hooks.d.ts +81 -0
  28. package/dist/src/analysis/hooks.js +139 -0
  29. package/dist/src/analysis/hooks.js.map +1 -0
  30. package/dist/src/analysis/pre-registration.d.ts +18 -0
  31. package/dist/src/analysis/pre-registration.js +86 -0
  32. package/dist/src/analysis/pre-registration.js.map +1 -0
  33. package/dist/src/branding.d.ts +44 -0
  34. package/dist/src/branding.js +128 -0
  35. package/dist/src/branding.js.map +1 -0
  36. package/dist/src/chat.d.ts +16 -0
  37. package/dist/src/chat.js +95 -0
  38. package/dist/src/chat.js.map +1 -0
  39. package/dist/src/cli.d.ts +2 -0
  40. package/dist/src/cli.js +316 -0
  41. package/dist/src/cli.js.map +1 -0
  42. package/dist/src/core/citations.d.ts +44 -0
  43. package/dist/src/core/citations.js +48 -0
  44. package/dist/src/core/citations.js.map +1 -0
  45. package/dist/src/core/contracts.d.ts +119 -0
  46. package/dist/src/core/contracts.js +2 -0
  47. package/dist/src/core/contracts.js.map +1 -0
  48. package/dist/src/core/docx.d.ts +11 -0
  49. package/dist/src/core/docx.js +46 -0
  50. package/dist/src/core/docx.js.map +1 -0
  51. package/dist/src/core/doi.d.ts +41 -0
  52. package/dist/src/core/doi.js +82 -0
  53. package/dist/src/core/doi.js.map +1 -0
  54. package/dist/src/core/evidence-policy.d.ts +24 -0
  55. package/dist/src/core/evidence-policy.js +308 -0
  56. package/dist/src/core/evidence-policy.js.map +1 -0
  57. package/dist/src/core/filekind.d.ts +15 -0
  58. package/dist/src/core/filekind.js +82 -0
  59. package/dist/src/core/filekind.js.map +1 -0
  60. package/dist/src/core/hash.d.ts +2 -0
  61. package/dist/src/core/hash.js +17 -0
  62. package/dist/src/core/hash.js.map +1 -0
  63. package/dist/src/core/pricing.d.ts +38 -0
  64. package/dist/src/core/pricing.js +110 -0
  65. package/dist/src/core/pricing.js.map +1 -0
  66. package/dist/src/core/redact.d.ts +12 -0
  67. package/dist/src/core/redact.js +48 -0
  68. package/dist/src/core/redact.js.map +1 -0
  69. package/dist/src/core/references.d.ts +55 -0
  70. package/dist/src/core/references.js +102 -0
  71. package/dist/src/core/references.js.map +1 -0
  72. package/dist/src/core/schemas.d.ts +162 -0
  73. package/dist/src/core/schemas.js +160 -0
  74. package/dist/src/core/schemas.js.map +1 -0
  75. package/dist/src/extension.d.ts +1 -0
  76. package/dist/src/extension.js +2 -0
  77. package/dist/src/extension.js.map +1 -0
  78. package/dist/src/index.d.ts +72 -0
  79. package/dist/src/index.js +73 -0
  80. package/dist/src/index.js.map +1 -0
  81. package/dist/src/install/installer.d.ts +147 -0
  82. package/dist/src/install/installer.js +721 -0
  83. package/dist/src/install/installer.js.map +1 -0
  84. package/dist/src/integrations/contracts.d.ts +35 -0
  85. package/dist/src/integrations/contracts.js +27 -0
  86. package/dist/src/integrations/contracts.js.map +1 -0
  87. package/dist/src/integrations/mcp.d.ts +155 -0
  88. package/dist/src/integrations/mcp.js +826 -0
  89. package/dist/src/integrations/mcp.js.map +1 -0
  90. package/dist/src/knowledge-map/contracts.d.ts +20 -0
  91. package/dist/src/knowledge-map/contracts.js +2 -0
  92. package/dist/src/knowledge-map/contracts.js.map +1 -0
  93. package/dist/src/knowledge-map/index.d.ts +4 -0
  94. package/dist/src/knowledge-map/index.js +39 -0
  95. package/dist/src/knowledge-map/index.js.map +1 -0
  96. package/dist/src/literature/contracts.d.ts +106 -0
  97. package/dist/src/literature/contracts.js +2 -0
  98. package/dist/src/literature/contracts.js.map +1 -0
  99. package/dist/src/literature/fulltext.d.ts +7 -0
  100. package/dist/src/literature/fulltext.js +24 -0
  101. package/dist/src/literature/fulltext.js.map +1 -0
  102. package/dist/src/literature/knowledge-map.d.ts +2 -0
  103. package/dist/src/literature/knowledge-map.js +20 -0
  104. package/dist/src/literature/knowledge-map.js.map +1 -0
  105. package/dist/src/literature/ledger.d.ts +3 -0
  106. package/dist/src/literature/ledger.js +17 -0
  107. package/dist/src/literature/ledger.js.map +1 -0
  108. package/dist/src/literature/metadata.d.ts +6 -0
  109. package/dist/src/literature/metadata.js +32 -0
  110. package/dist/src/literature/metadata.js.map +1 -0
  111. package/dist/src/memory/store.d.ts +22 -0
  112. package/dist/src/memory/store.js +73 -0
  113. package/dist/src/memory/store.js.map +1 -0
  114. package/dist/src/orchestration/contracts.d.ts +61 -0
  115. package/dist/src/orchestration/contracts.js +2 -0
  116. package/dist/src/orchestration/contracts.js.map +1 -0
  117. package/dist/src/orchestration/pi-executor.d.ts +28 -0
  118. package/dist/src/orchestration/pi-executor.js +169 -0
  119. package/dist/src/orchestration/pi-executor.js.map +1 -0
  120. package/dist/src/orchestration/runner.d.ts +196 -0
  121. package/dist/src/orchestration/runner.js +991 -0
  122. package/dist/src/orchestration/runner.js.map +1 -0
  123. package/dist/src/orchestration/scheduler.d.ts +8 -0
  124. package/dist/src/orchestration/scheduler.js +335 -0
  125. package/dist/src/orchestration/scheduler.js.map +1 -0
  126. package/dist/src/panel/events.d.ts +20 -0
  127. package/dist/src/panel/events.js +93 -0
  128. package/dist/src/panel/events.js.map +1 -0
  129. package/dist/src/panel/extension.d.ts +8 -0
  130. package/dist/src/panel/extension.js +115 -0
  131. package/dist/src/panel/extension.js.map +1 -0
  132. package/dist/src/panel/literature-map.d.ts +26 -0
  133. package/dist/src/panel/literature-map.js +34 -0
  134. package/dist/src/panel/literature-map.js.map +1 -0
  135. package/dist/src/panel/projection.d.ts +51 -0
  136. package/dist/src/panel/projection.js +288 -0
  137. package/dist/src/panel/projection.js.map +1 -0
  138. package/dist/src/panel/server.d.ts +46 -0
  139. package/dist/src/panel/server.js +1610 -0
  140. package/dist/src/panel/server.js.map +1 -0
  141. package/dist/src/panel/usage.d.ts +53 -0
  142. package/dist/src/panel/usage.js +150 -0
  143. package/dist/src/panel/usage.js.map +1 -0
  144. package/dist/src/project/bootstrap.d.ts +10 -0
  145. package/dist/src/project/bootstrap.js +83 -0
  146. package/dist/src/project/bootstrap.js.map +1 -0
  147. package/dist/src/project/hitl.d.ts +12 -0
  148. package/dist/src/project/hitl.js +43 -0
  149. package/dist/src/project/hitl.js.map +1 -0
  150. package/dist/src/project/jsonl.d.ts +16 -0
  151. package/dist/src/project/jsonl.js +93 -0
  152. package/dist/src/project/jsonl.js.map +1 -0
  153. package/dist/src/project/manuscript.d.ts +21 -0
  154. package/dist/src/project/manuscript.js +74 -0
  155. package/dist/src/project/manuscript.js.map +1 -0
  156. package/dist/src/project/paths.d.ts +38 -0
  157. package/dist/src/project/paths.js +166 -0
  158. package/dist/src/project/paths.js.map +1 -0
  159. package/dist/src/project/versions.d.ts +10 -0
  160. package/dist/src/project/versions.js +14 -0
  161. package/dist/src/project/versions.js.map +1 -0
  162. package/dist/src/psyclaw-theme.d.ts +88 -0
  163. package/dist/src/psyclaw-theme.js +89 -0
  164. package/dist/src/psyclaw-theme.js.map +1 -0
  165. package/dist/src/research/brief.d.ts +11 -0
  166. package/dist/src/research/brief.js +81 -0
  167. package/dist/src/research/brief.js.map +1 -0
  168. package/dist/src/research/ledger.d.ts +12 -0
  169. package/dist/src/research/ledger.js +43 -0
  170. package/dist/src/research/ledger.js.map +1 -0
  171. package/dist/src/run.d.ts +20 -0
  172. package/dist/src/run.js +34 -0
  173. package/dist/src/run.js.map +1 -0
  174. package/dist/src/setup.d.ts +54 -0
  175. package/dist/src/setup.js +221 -0
  176. package/dist/src/setup.js.map +1 -0
  177. package/dist/src/skills/contracts.d.ts +105 -0
  178. package/dist/src/skills/contracts.js +3 -0
  179. package/dist/src/skills/contracts.js.map +1 -0
  180. package/dist/src/skills/preflight.d.ts +10 -0
  181. package/dist/src/skills/preflight.js +39 -0
  182. package/dist/src/skills/preflight.js.map +1 -0
  183. package/dist/src/skills/registry.d.ts +28 -0
  184. package/dist/src/skills/registry.js +540 -0
  185. package/dist/src/skills/registry.js.map +1 -0
  186. package/dist/src/style/artifact.d.ts +6 -0
  187. package/dist/src/style/artifact.js +61 -0
  188. package/dist/src/style/artifact.js.map +1 -0
  189. package/dist/src/style/cli-ui.d.ts +41 -0
  190. package/dist/src/style/cli-ui.js +119 -0
  191. package/dist/src/style/cli-ui.js.map +1 -0
  192. package/dist/src/style/contracts.d.ts +34 -0
  193. package/dist/src/style/contracts.js +2 -0
  194. package/dist/src/style/contracts.js.map +1 -0
  195. package/dist/src/style/registry.d.ts +16 -0
  196. package/dist/src/style/registry.js +50 -0
  197. package/dist/src/style/registry.js.map +1 -0
  198. package/dist/src/trust/manifest.d.ts +42 -0
  199. package/dist/src/trust/manifest.js +53 -0
  200. package/dist/src/trust/manifest.js.map +1 -0
  201. package/dist/src/trust/sbom.d.ts +54 -0
  202. package/dist/src/trust/sbom.js +77 -0
  203. package/dist/src/trust/sbom.js.map +1 -0
  204. package/dist/src/tui/app.d.ts +3 -0
  205. package/dist/src/tui/app.js +103 -0
  206. package/dist/src/tui/app.js.map +1 -0
  207. package/dist/src/tui/model.d.ts +13 -0
  208. package/dist/src/tui/model.js +25 -0
  209. package/dist/src/tui/model.js.map +1 -0
  210. package/dist/src/updates/check.d.ts +43 -0
  211. package/dist/src/updates/check.js +68 -0
  212. package/dist/src/updates/check.js.map +1 -0
  213. package/dist/src/updates/manifest.d.ts +19 -0
  214. package/dist/src/updates/manifest.js +58 -0
  215. package/dist/src/updates/manifest.js.map +1 -0
  216. package/dist/src/updates/registry.d.ts +21 -0
  217. package/dist/src/updates/registry.js +82 -0
  218. package/dist/src/updates/registry.js.map +1 -0
  219. package/dist/src/updates/skills.d.ts +15 -0
  220. package/dist/src/updates/skills.js +39 -0
  221. package/dist/src/updates/skills.js.map +1 -0
  222. package/dist/src/updates/status.d.ts +7 -0
  223. package/dist/src/updates/status.js +37 -0
  224. package/dist/src/updates/status.js.map +1 -0
  225. package/dist/src/updates/update.d.ts +43 -0
  226. package/dist/src/updates/update.js +128 -0
  227. package/dist/src/updates/update.js.map +1 -0
  228. package/dist/src/wizard.d.ts +7 -0
  229. package/dist/src/wizard.js +90 -0
  230. package/dist/src/wizard.js.map +1 -0
  231. package/dist/src/workflows/analysis-delegation.d.ts +3 -0
  232. package/dist/src/workflows/analysis-delegation.js +96 -0
  233. package/dist/src/workflows/analysis-delegation.js.map +1 -0
  234. package/dist/src/workflows/expert-review-runner.d.ts +29 -0
  235. package/dist/src/workflows/expert-review-runner.js +35 -0
  236. package/dist/src/workflows/expert-review-runner.js.map +1 -0
  237. package/dist/src/workflows/expert-review.d.ts +140 -0
  238. package/dist/src/workflows/expert-review.js +111 -0
  239. package/dist/src/workflows/expert-review.js.map +1 -0
  240. package/dist/src/workflows/institutional-fulltext.d.ts +16 -0
  241. package/dist/src/workflows/institutional-fulltext.js +110 -0
  242. package/dist/src/workflows/institutional-fulltext.js.map +1 -0
  243. package/dist/src/workflows/literature-review.d.ts +3 -0
  244. package/dist/src/workflows/literature-review.js +76 -0
  245. package/dist/src/workflows/literature-review.js.map +1 -0
  246. package/dist/src/workflows/meta-analysis.d.ts +38 -0
  247. package/dist/src/workflows/meta-analysis.js +185 -0
  248. package/dist/src/workflows/meta-analysis.js.map +1 -0
  249. package/dist/src/workflows/publish.d.ts +51 -0
  250. package/dist/src/workflows/publish.js +153 -0
  251. package/dist/src/workflows/publish.js.map +1 -0
  252. package/dist/src/workflows/spec.d.ts +51 -0
  253. package/dist/src/workflows/spec.js +157 -0
  254. package/dist/src/workflows/spec.js.map +1 -0
  255. package/dist/src/workflows/style-contract.d.ts +24 -0
  256. package/dist/src/workflows/style-contract.js +23 -0
  257. package/dist/src/workflows/style-contract.js.map +1 -0
  258. package/dist/src/workflows/writing-review.d.ts +15 -0
  259. package/dist/src/workflows/writing-review.js +82 -0
  260. package/dist/src/workflows/writing-review.js.map +1 -0
  261. package/package.json +20 -8
  262. package/scripts/rebrand-pi.mjs +3 -3
  263. package/scripts/__pycache__/build_dist.cpython-314.pyc +0 -0
  264. package/scripts/__pycache__/build_whitepaper_docx.cpython-314.pyc +0 -0
  265. package/scripts/build_preprint_docx.py +0 -729
  266. package/scripts/build_preprint_figures.py +0 -238
  267. package/scripts/build_three_line_table_fixture.py +0 -56
  268. package/scripts/build_whitepaper_docx.py +0 -768
  269. package/scripts/check-branding.mjs +0 -159
  270. package/scripts/copy-panel.mjs +0 -11
  271. package/scripts/verify_docx.py +0 -41
@@ -0,0 +1,48 @@
1
+ /**
2
+ * Deterministic secret redaction for log and projection surfaces.
3
+ *
4
+ * psyclaw never treats raw material or credentials as content to log. As
5
+ * defense-in-depth, any free-form text that reaches an event log is scrubbed
6
+ * of high-signal credential shapes before it is persisted. This is a
7
+ * heuristic, not an OS boundary: callers must still avoid putting secrets in
8
+ * log payloads in the first place.
9
+ */
10
+ // Sources are kept separate from the RegExp objects so every invocation builds
11
+ // a fresh matcher and never shares the mutable `lastIndex` of a global regex.
12
+ const SECRET_KINDS = [
13
+ {
14
+ name: "private-key",
15
+ source: "-----BEGIN (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----" +
16
+ "[\\s\\S]*?-----END (?:RSA |EC |DSA |OPENSSH |PGP )?PRIVATE KEY-----",
17
+ flags: "g",
18
+ },
19
+ { name: "aws-access-key", source: "\\bAKIA[0-9A-Z]{16}\\b", flags: "g" },
20
+ { name: "google-api-key", source: "\\bAIza[0-9A-Za-z_-]{35}\\b", flags: "g" },
21
+ { name: "openai-api-key", source: "\\bsk-[A-Za-z0-9_-]{20,}\\b", flags: "g" },
22
+ { name: "github-token", source: "\\b(?:ghp|gho|ghu|ghs|ghr)_[A-Za-z0-9]{20,}\\b", flags: "g" },
23
+ { name: "slack-token", source: "\\bxox[baprs]-[A-Za-z0-9-]{10,}\\b", flags: "g" },
24
+ { name: "bearer-token", source: "\\bBearer\\s+[A-Za-z0-9._~+/-]{16,}\\b", flags: "gi" },
25
+ {
26
+ name: "credential-assignment",
27
+ source: "\\b(?:password|passwd|pwd|secret|token|api[_-]?key|access[_-]?key|client[_-]?secret)\\b" +
28
+ "\\s*[:=]\\s*[\"']?[^\\s\"',;{}]+[\"']?",
29
+ flags: "gi",
30
+ },
31
+ ];
32
+ export function redactSecrets(input) {
33
+ let output = input;
34
+ for (const kind of SECRET_KINDS) {
35
+ output = output.replace(new RegExp(kind.source, kind.flags), `[REDACTED:${kind.name}]`);
36
+ }
37
+ return output;
38
+ }
39
+ /** Return the distinct secret kinds detected in a string. */
40
+ export function findSecrets(input) {
41
+ const found = [];
42
+ for (const kind of SECRET_KINDS) {
43
+ if (new RegExp(kind.source, kind.flags).test(input))
44
+ found.push(kind.name);
45
+ }
46
+ return found;
47
+ }
48
+ //# sourceMappingURL=redact.js.map
@@ -0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6DAA6D;AAC7D,MAAM,UAAU,WAAW,CAAC,KAAa;IACvC,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,KAAK,MAAM,IAAI,IAAI,YAAY,EAAE,CAAC;QAChC,IAAI,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC7E,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,55 @@
1
+ import type { DoiVerification } from "./doi.js";
2
+ /**
3
+ * Project reference archive (.psyclaw/references.jsonl, append-only, idempotent
4
+ * by DOI). Every in-text citation in the manuscript should be checked against
5
+ * this archive — that is both the query source for citing and the
6
+ * verification ledger for the citation-audit skill (docs/文档规范.md §7).
7
+ */
8
+ export interface ReferenceRecord {
9
+ schemaVersion: "psyclaw/reference/v1";
10
+ doi: string;
11
+ title: string;
12
+ authors: string[];
13
+ year?: number;
14
+ venue?: string;
15
+ verified: boolean;
16
+ verification: DoiVerification;
17
+ oaPdfUrl?: string;
18
+ downloadedPath?: string;
19
+ addedAt: string;
20
+ }
21
+ export interface CitationHit {
22
+ surname: string;
23
+ years: number[];
24
+ matched: ReferenceRecord[];
25
+ }
26
+ export declare function referencesPath(root: string): Promise<string>;
27
+ export declare function listReferences(root: string): Promise<ReferenceRecord[]>;
28
+ /** Idempotent by DOI: re-verifying or re-adding the same DOI returns the existing record. */
29
+ export declare function upsertReference(root: string, record: ReferenceRecord): Promise<{
30
+ record: ReferenceRecord;
31
+ appended: boolean;
32
+ }>;
33
+ export declare function referenceFromVerification(verification: DoiVerification): ReferenceRecord | null;
34
+ /**
35
+ * Extract in-text citation items like `(Kessler et al., 2005; Wanberg et al.,
36
+ * 2010)` into {surname, years} entries. Surname = first family name of the
37
+ * first author of each item; Chinese-style `(作者,2005)` groups are included
38
+ * via the same `(...)` capture.
39
+ */
40
+ export declare function extractCitations(text: string): Array<{
41
+ surname: string;
42
+ years: number[];
43
+ }>;
44
+ /**
45
+ * Check every in-text citation against the archive. A citation is matched when
46
+ * a reference's first author surname matches and at least one cited year is
47
+ * present in the reference record (or the reference has no year).
48
+ */
49
+ export declare function checkCitations(text: string, references: readonly ReferenceRecord[]): {
50
+ citations: Array<CitationHit & {
51
+ missing: boolean;
52
+ }>;
53
+ matched: number;
54
+ unmatched: number;
55
+ };
@@ -0,0 +1,102 @@
1
+ import { readJsonl, appendJsonlIfMissing } from "../project/jsonl.js";
2
+ import { assertSafeProjectPath } from "../project/paths.js";
3
+ export async function referencesPath(root) {
4
+ return assertSafeProjectPath(root, ".psyclaw/references.jsonl");
5
+ }
6
+ export async function listReferences(root) {
7
+ return readJsonl(await referencesPath(root));
8
+ }
9
+ /** Idempotent by DOI: re-verifying or re-adding the same DOI returns the existing record. */
10
+ export async function upsertReference(root, record) {
11
+ const result = await appendJsonlIfMissing(await referencesPath(root), record, (item) => item.doi);
12
+ return { record, appended: result.appended };
13
+ }
14
+ export function referenceFromVerification(verification) {
15
+ if (verification.status === "error")
16
+ return null;
17
+ const crossref = verification.crossref;
18
+ const title = crossref?.title ?? verification.openalex?.title;
19
+ if (!title)
20
+ return null;
21
+ return {
22
+ schemaVersion: "psyclaw/reference/v1",
23
+ doi: verification.doi,
24
+ title,
25
+ authors: crossref?.authors ?? [],
26
+ ...(crossref?.year === undefined ? {} : { year: crossref.year }),
27
+ ...(crossref?.container === undefined ? {} : { venue: crossref.container }),
28
+ verified: verification.status === "verified",
29
+ verification,
30
+ addedAt: new Date().toISOString(),
31
+ };
32
+ }
33
+ const CITATION_GROUP = /[((]([^()()]*\d{4}[a-z]?[^()()]*)[))]/g;
34
+ // English "Kessler et al., 2005" / "Wanberg et al., 2010" / "A & B, 2005"
35
+ // and Chinese "张三,2020" / "张三 等,2020" items inside a group.
36
+ const CITATION_ITEM = /([\u4E00-\u9FFF]{2,4}(?:\s*等)?|[A-Z][A-Za-z\u00C0-\u024F'\-]+(?:\s+et al\.?)?(?:\s*&\s*[A-Z][A-Za-z\u00C0-\u024F'\-]+)?)\s*[,,]\s*(\d{4}[a-z]?)/g;
37
+ /**
38
+ * Extract in-text citation items like `(Kessler et al., 2005; Wanberg et al.,
39
+ * 2010)` into {surname, years} entries. Surname = first family name of the
40
+ * first author of each item; Chinese-style `(作者,2005)` groups are included
41
+ * via the same `(...)` capture.
42
+ */
43
+ export function extractCitations(text) {
44
+ const found = [];
45
+ const groups = [];
46
+ for (const match of text.matchAll(CITATION_GROUP)) {
47
+ const group = match[1] ?? "";
48
+ groups.push(...group.split(";"));
49
+ }
50
+ for (const raw of groups) {
51
+ const items = [];
52
+ for (const item of raw.matchAll(CITATION_ITEM)) {
53
+ const surname = (item[1] ?? "")
54
+ .replace(/\s+et al\.?$/i, "")
55
+ .replace(/\s+等$/, "")
56
+ .replace(/\s*&\s*[A-Za-z\u00C0-\u024F'\-]+$/i, "")
57
+ .trim()
58
+ .split(/\s+/)[0] ?? "";
59
+ const year = Number((item[2] ?? "").replace(/[a-z]$/i, ""));
60
+ if (!surname || !Number.isFinite(year))
61
+ continue;
62
+ const existing = items.find((entry) => entry.surname.toLowerCase() === surname.toLowerCase());
63
+ if (existing)
64
+ existing.years.push(year);
65
+ else
66
+ items.push({ surname, years: [year] });
67
+ }
68
+ found.push(...items);
69
+ }
70
+ // merge across groups
71
+ const merged = [];
72
+ for (const entry of found) {
73
+ const existing = merged.find((item) => item.surname.toLowerCase() === entry.surname.toLowerCase());
74
+ if (existing)
75
+ existing.years.push(...entry.years);
76
+ else
77
+ merged.push({ surname: entry.surname, years: [...entry.years] });
78
+ }
79
+ return merged.map((entry) => ({ surname: entry.surname, years: [...new Set(entry.years)].sort((a, b) => a - b) }));
80
+ }
81
+ /**
82
+ * Check every in-text citation against the archive. A citation is matched when
83
+ * a reference's first author surname matches and at least one cited year is
84
+ * present in the reference record (or the reference has no year).
85
+ */
86
+ export function checkCitations(text, references) {
87
+ const citations = extractCitations(text).map((hit) => {
88
+ const matched = references.filter((ref) => {
89
+ const surname = ref.authors[0]?.split(/\s+/).at(-1) ?? "";
90
+ if (!surname || surname.toLowerCase() !== hit.surname.toLowerCase())
91
+ return false;
92
+ return ref.year === undefined || hit.years.some((year) => year === ref.year);
93
+ });
94
+ return { ...hit, matched, missing: matched.length === 0 };
95
+ });
96
+ return {
97
+ citations,
98
+ matched: citations.filter((item) => !item.missing).length,
99
+ unmatched: citations.filter((item) => item.missing).length,
100
+ };
101
+ }
102
+ //# sourceMappingURL=references.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"references.js","sourceRoot":"","sources":["../../../src/core/references.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AACtE,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AA8B5D,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,OAAO,qBAAqB,CAAC,IAAI,EAAE,2BAA2B,CAAC,CAAC;AAClE,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,IAAY;IAC/C,OAAO,SAAS,CAAkB,MAAM,cAAc,CAAC,IAAI,CAAC,CAAC,CAAC;AAChE,CAAC;AAED,6FAA6F;AAC7F,MAAM,CAAC,KAAK,UAAU,eAAe,CAAC,IAAY,EAAE,MAAuB;IACzE,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,MAAM,cAAc,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAClG,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,yBAAyB,CAAC,YAA6B;IACrE,IAAI,YAAY,CAAC,MAAM,KAAK,OAAO;QAAE,OAAO,IAAI,CAAC;IACjD,MA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G,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,GAAG,CAAC,IAAI,CAAC,CAAC;QAC/E,CAAC,CAAC,CAAC;QACH,OAAO,EAAE,GAAG,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IAC5D,CAAC,CAAC,CAAC;IACH,OAAO;QACL,SAAS;QACT,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;QACzD,SAAS,EAAE,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,MAAM;KAC3D,CAAC;AACJ,CAAC"}
@@ -0,0 +1,162 @@
1
+ import { Type, type Static, type TSchema } from "typebox";
2
+ import type { Claim, ClaimEvidenceLink, Evidence, Handoff, ResearchProject, ToolReceipt } from "./contracts.js";
3
+ export declare const ResearchProjectSchema: Type.TObject<{
4
+ id: Type.TString;
5
+ root: Type.TString;
6
+ paradigm: Type.TUnion<[Type.TLiteral<"survey-observational">, Type.TLiteral<"qualitative-thematic">, Type.TLiteral<"experimental">, Type.TLiteral<"quasi-experimental">, Type.TLiteral<"longitudinal-panel">, Type.TLiteral<"meta-analysis">, Type.TLiteral<"ethnographic">, Type.TLiteral<"historical-documentary">, Type.TLiteral<"policy-legal">, Type.TLiteral<"mixed-methods">]>;
7
+ goal: Type.TString;
8
+ policyVersion: Type.TString;
9
+ createdAt: Type.TString;
10
+ }>;
11
+ export declare const EvidenceSchema: Type.TObject<{
12
+ id: Type.TString;
13
+ source: Type.TObject<{
14
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"user">, Type.TLiteral<"mcp">]>;
15
+ locator: Type.TString;
16
+ title: Type.TOptional<Type.TString>;
17
+ }>;
18
+ level: Type.TUnion<[Type.TLiteral<"metadata">, Type.TLiteral<"abstract">, Type.TLiteral<"snippet">, Type.TLiteral<"fulltext">, Type.TLiteral<"user">]>;
19
+ quote: Type.TOptional<Type.TString>;
20
+ retrievedAt: Type.TString;
21
+ sha256: Type.TOptional<Type.TString>;
22
+ accessStatus: Type.TUnion<[Type.TLiteral<"verified">, Type.TLiteral<"partial">, Type.TLiteral<"unavailable">]>;
23
+ locators: Type.TArray<Type.TObject<{
24
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"page">, Type.TLiteral<"section">, Type.TLiteral<"offset">, Type.TLiteral<"row">]>;
25
+ value: Type.TString;
26
+ }>>;
27
+ }>;
28
+ export declare const ClaimSchema: Type.TObject<{
29
+ recordType: Type.TOptional<Type.TLiteral<"claim">>;
30
+ id: Type.TString;
31
+ text: Type.TString;
32
+ kind: Type.TUnion<[Type.TLiteral<"existence">, Type.TLiteral<"definition">, Type.TLiteral<"method">, Type.TLiteral<"result">, Type.TLiteral<"interpretation">]>;
33
+ evidenceIds: Type.TArray<Type.TString>;
34
+ status: Type.TUnion<[Type.TLiteral<"supported">, Type.TLiteral<"uncertain">, Type.TLiteral<"unsupported">]>;
35
+ uncertainty: Type.TOptional<Type.TString>;
36
+ }>;
37
+ export declare const ClaimEvidenceLinkSchema: Type.TObject<{
38
+ recordType: Type.TOptional<Type.TLiteral<"claim-evidence-link">>;
39
+ claimId: Type.TString;
40
+ evidenceId: Type.TString;
41
+ relation: Type.TUnion<[Type.TLiteral<"supports">, Type.TLiteral<"contradicts">, Type.TLiteral<"context">]>;
42
+ locator: Type.TOptional<Type.TObject<{
43
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"page">, Type.TLiteral<"section">, Type.TLiteral<"offset">, Type.TLiteral<"row">]>;
44
+ value: Type.TString;
45
+ }>>;
46
+ rationale: Type.TString;
47
+ }>;
48
+ export declare const ToolReceiptSchema: Type.TObject<{
49
+ schemaVersion: Type.TLiteral<"psyclaw/tool-receipt/v1">;
50
+ runId: Type.TString;
51
+ taskId: Type.TString;
52
+ tool: Type.TString;
53
+ effect: Type.TUnion<[Type.TLiteral<"read">, Type.TLiteral<"write">, Type.TLiteral<"network">, Type.TLiteral<"destructive">]>;
54
+ approval: Type.TUnion<[Type.TLiteral<"not-needed">, Type.TLiteral<"approved">, Type.TLiteral<"denied">]>;
55
+ idempotencyKey: Type.TOptional<Type.TString>;
56
+ ok: Type.TBoolean;
57
+ reasonCode: Type.TOptional<Type.TString>;
58
+ resultHash: Type.TOptional<Type.TString>;
59
+ startedAt: Type.TString;
60
+ finishedAt: Type.TString;
61
+ }>;
62
+ export declare const HandoffSchema: Type.TObject<{
63
+ schemaVersion: Type.TLiteral<"psyclaw/handoff/v1">;
64
+ projectId: Type.TString;
65
+ runId: Type.TString;
66
+ goal: Type.TString;
67
+ completed: Type.TArray<Type.TString>;
68
+ verified: Type.TArray<Type.TString>;
69
+ blocked: Type.TArray<Type.TString>;
70
+ nextSteps: Type.TArray<Type.TString>;
71
+ verificationCommands: Type.TArray<Type.TString>;
72
+ generatedAt: Type.TString;
73
+ }>;
74
+ export type ResearchProjectShape = Static<typeof ResearchProjectSchema>;
75
+ export type EvidenceShape = Static<typeof EvidenceSchema>;
76
+ export type ClaimShape = Static<typeof ClaimSchema>;
77
+ export type ToolReceiptShape = Static<typeof ToolReceiptSchema>;
78
+ export type HandoffShape = Static<typeof HandoffSchema>;
79
+ export interface SchemaValidator<T extends TSchema> {
80
+ check(value: unknown): boolean;
81
+ errors(value: unknown): string[];
82
+ }
83
+ export declare const validators: {
84
+ researchProject: SchemaValidator<Type.TObject<{
85
+ id: Type.TString;
86
+ root: Type.TString;
87
+ paradigm: Type.TUnion<[Type.TLiteral<"survey-observational">, Type.TLiteral<"qualitative-thematic">, Type.TLiteral<"experimental">, Type.TLiteral<"quasi-experimental">, Type.TLiteral<"longitudinal-panel">, Type.TLiteral<"meta-analysis">, Type.TLiteral<"ethnographic">, Type.TLiteral<"historical-documentary">, Type.TLiteral<"policy-legal">, Type.TLiteral<"mixed-methods">]>;
88
+ goal: Type.TString;
89
+ policyVersion: Type.TString;
90
+ createdAt: Type.TString;
91
+ }>>;
92
+ evidence: SchemaValidator<Type.TObject<{
93
+ id: Type.TString;
94
+ source: Type.TObject<{
95
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"user">, Type.TLiteral<"mcp">]>;
96
+ locator: Type.TString;
97
+ title: Type.TOptional<Type.TString>;
98
+ }>;
99
+ level: Type.TUnion<[Type.TLiteral<"metadata">, Type.TLiteral<"abstract">, Type.TLiteral<"snippet">, Type.TLiteral<"fulltext">, Type.TLiteral<"user">]>;
100
+ quote: Type.TOptional<Type.TString>;
101
+ retrievedAt: Type.TString;
102
+ sha256: Type.TOptional<Type.TString>;
103
+ accessStatus: Type.TUnion<[Type.TLiteral<"verified">, Type.TLiteral<"partial">, Type.TLiteral<"unavailable">]>;
104
+ locators: Type.TArray<Type.TObject<{
105
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"page">, Type.TLiteral<"section">, Type.TLiteral<"offset">, Type.TLiteral<"row">]>;
106
+ value: Type.TString;
107
+ }>>;
108
+ }>>;
109
+ claim: SchemaValidator<Type.TObject<{
110
+ recordType: Type.TOptional<Type.TLiteral<"claim">>;
111
+ id: Type.TString;
112
+ text: Type.TString;
113
+ kind: Type.TUnion<[Type.TLiteral<"existence">, Type.TLiteral<"definition">, Type.TLiteral<"method">, Type.TLiteral<"result">, Type.TLiteral<"interpretation">]>;
114
+ evidenceIds: Type.TArray<Type.TString>;
115
+ status: Type.TUnion<[Type.TLiteral<"supported">, Type.TLiteral<"uncertain">, Type.TLiteral<"unsupported">]>;
116
+ uncertainty: Type.TOptional<Type.TString>;
117
+ }>>;
118
+ claimEvidenceLink: SchemaValidator<Type.TObject<{
119
+ recordType: Type.TOptional<Type.TLiteral<"claim-evidence-link">>;
120
+ claimId: Type.TString;
121
+ evidenceId: Type.TString;
122
+ relation: Type.TUnion<[Type.TLiteral<"supports">, Type.TLiteral<"contradicts">, Type.TLiteral<"context">]>;
123
+ locator: Type.TOptional<Type.TObject<{
124
+ kind: Type.TUnion<[Type.TLiteral<"doi">, Type.TLiteral<"url">, Type.TLiteral<"file">, Type.TLiteral<"page">, Type.TLiteral<"section">, Type.TLiteral<"offset">, Type.TLiteral<"row">]>;
125
+ value: Type.TString;
126
+ }>>;
127
+ rationale: Type.TString;
128
+ }>>;
129
+ toolReceipt: SchemaValidator<Type.TObject<{
130
+ schemaVersion: Type.TLiteral<"psyclaw/tool-receipt/v1">;
131
+ runId: Type.TString;
132
+ taskId: Type.TString;
133
+ tool: Type.TString;
134
+ effect: Type.TUnion<[Type.TLiteral<"read">, Type.TLiteral<"write">, Type.TLiteral<"network">, Type.TLiteral<"destructive">]>;
135
+ approval: Type.TUnion<[Type.TLiteral<"not-needed">, Type.TLiteral<"approved">, Type.TLiteral<"denied">]>;
136
+ idempotencyKey: Type.TOptional<Type.TString>;
137
+ ok: Type.TBoolean;
138
+ reasonCode: Type.TOptional<Type.TString>;
139
+ resultHash: Type.TOptional<Type.TString>;
140
+ startedAt: Type.TString;
141
+ finishedAt: Type.TString;
142
+ }>>;
143
+ handoff: SchemaValidator<Type.TObject<{
144
+ schemaVersion: Type.TLiteral<"psyclaw/handoff/v1">;
145
+ projectId: Type.TString;
146
+ runId: Type.TString;
147
+ goal: Type.TString;
148
+ completed: Type.TArray<Type.TString>;
149
+ verified: Type.TArray<Type.TString>;
150
+ blocked: Type.TArray<Type.TString>;
151
+ nextSteps: Type.TArray<Type.TString>;
152
+ verificationCommands: Type.TArray<Type.TString>;
153
+ generatedAt: Type.TString;
154
+ }>>;
155
+ };
156
+ export declare function assertSchema<T>(value: unknown, schemaName: keyof typeof validators): asserts value is T;
157
+ export declare function asProject(value: unknown): ResearchProject;
158
+ export declare function asEvidence(value: unknown): Evidence;
159
+ export declare function asClaim(value: unknown): Claim;
160
+ export declare function asClaimEvidenceLink(value: unknown): ClaimEvidenceLink;
161
+ export declare function asToolReceipt(value: unknown): ToolReceipt;
162
+ export declare function asHandoff(value: unknown): Handoff;
@@ -0,0 +1,160 @@
1
+ import { Type } from "typebox";
2
+ import { Compile } from "typebox/compile";
3
+ const OptionalString = Type.Optional(Type.String({ minLength: 1 }));
4
+ const OptionalReasonCode = Type.Optional(Type.String({
5
+ pattern: "^[a-z0-9][a-z0-9._-]{0,63}$",
6
+ }));
7
+ const LocatorSchema = Type.Object({
8
+ kind: Type.Union([
9
+ Type.Literal("doi"),
10
+ Type.Literal("url"),
11
+ Type.Literal("file"),
12
+ Type.Literal("page"),
13
+ Type.Literal("section"),
14
+ Type.Literal("offset"),
15
+ Type.Literal("row"),
16
+ ]),
17
+ value: Type.String({ minLength: 1 }),
18
+ });
19
+ export const ResearchProjectSchema = Type.Object({
20
+ id: Type.String({ minLength: 1 }),
21
+ root: Type.String({ minLength: 1 }),
22
+ paradigm: Type.Union([
23
+ Type.Literal("survey-observational"),
24
+ Type.Literal("qualitative-thematic"),
25
+ Type.Literal("experimental"),
26
+ Type.Literal("quasi-experimental"),
27
+ Type.Literal("longitudinal-panel"),
28
+ Type.Literal("meta-analysis"),
29
+ Type.Literal("ethnographic"),
30
+ Type.Literal("historical-documentary"),
31
+ Type.Literal("policy-legal"),
32
+ Type.Literal("mixed-methods"),
33
+ ]),
34
+ goal: Type.String({ minLength: 1 }),
35
+ policyVersion: Type.String({ minLength: 1 }),
36
+ createdAt: Type.String({ minLength: 1 }),
37
+ }, { additionalProperties: false });
38
+ export const EvidenceSchema = Type.Object({
39
+ id: Type.String({ minLength: 1 }),
40
+ source: Type.Object({
41
+ kind: Type.Union([
42
+ Type.Literal("doi"),
43
+ Type.Literal("url"),
44
+ Type.Literal("file"),
45
+ Type.Literal("user"),
46
+ Type.Literal("mcp"),
47
+ ]),
48
+ locator: Type.String({ minLength: 1 }),
49
+ title: OptionalString,
50
+ }, { additionalProperties: false }),
51
+ level: Type.Union([
52
+ Type.Literal("metadata"),
53
+ Type.Literal("abstract"),
54
+ Type.Literal("snippet"),
55
+ Type.Literal("fulltext"),
56
+ Type.Literal("user"),
57
+ ]),
58
+ quote: OptionalString,
59
+ retrievedAt: Type.String({ minLength: 1 }),
60
+ sha256: Type.Optional(Type.String({ pattern: "^[a-f0-9]{64}$" })),
61
+ accessStatus: Type.Union([Type.Literal("verified"), Type.Literal("partial"), Type.Literal("unavailable")]),
62
+ locators: Type.Array(LocatorSchema),
63
+ }, { additionalProperties: false });
64
+ export const ClaimSchema = Type.Object({
65
+ recordType: Type.Optional(Type.Literal("claim")),
66
+ id: Type.String({ minLength: 1 }),
67
+ text: Type.String({ minLength: 1 }),
68
+ kind: Type.Union([
69
+ Type.Literal("existence"),
70
+ Type.Literal("definition"),
71
+ Type.Literal("method"),
72
+ Type.Literal("result"),
73
+ Type.Literal("interpretation"),
74
+ ]),
75
+ evidenceIds: Type.Array(Type.String({ minLength: 1 })),
76
+ status: Type.Union([Type.Literal("supported"), Type.Literal("uncertain"), Type.Literal("unsupported")]),
77
+ uncertainty: OptionalString,
78
+ }, { additionalProperties: false });
79
+ export const ClaimEvidenceLinkSchema = Type.Object({
80
+ recordType: Type.Optional(Type.Literal("claim-evidence-link")),
81
+ claimId: Type.String({ minLength: 1 }),
82
+ evidenceId: Type.String({ minLength: 1 }),
83
+ relation: Type.Union([Type.Literal("supports"), Type.Literal("contradicts"), Type.Literal("context")]),
84
+ locator: Type.Optional(LocatorSchema),
85
+ rationale: Type.String({ minLength: 1 }),
86
+ }, { additionalProperties: false });
87
+ export const ToolReceiptSchema = Type.Object({
88
+ schemaVersion: Type.Literal("psyclaw/tool-receipt/v1"),
89
+ runId: Type.String({ minLength: 1 }),
90
+ taskId: Type.String({ minLength: 1 }),
91
+ tool: Type.String({ minLength: 1 }),
92
+ effect: Type.Union([Type.Literal("read"), Type.Literal("write"), Type.Literal("network"), Type.Literal("destructive")]),
93
+ approval: Type.Union([Type.Literal("not-needed"), Type.Literal("approved"), Type.Literal("denied")]),
94
+ idempotencyKey: OptionalString,
95
+ ok: Type.Boolean(),
96
+ reasonCode: OptionalReasonCode,
97
+ resultHash: OptionalString,
98
+ startedAt: Type.String({ minLength: 1 }),
99
+ finishedAt: Type.String({ minLength: 1 }),
100
+ }, { additionalProperties: false });
101
+ export const HandoffSchema = Type.Object({
102
+ schemaVersion: Type.Literal("psyclaw/handoff/v1"),
103
+ projectId: Type.String({ minLength: 1 }),
104
+ runId: Type.String({ minLength: 1 }),
105
+ goal: Type.String({ minLength: 1 }),
106
+ completed: Type.Array(Type.String()),
107
+ verified: Type.Array(Type.String()),
108
+ blocked: Type.Array(Type.String()),
109
+ nextSteps: Type.Array(Type.String()),
110
+ verificationCommands: Type.Array(Type.String()),
111
+ generatedAt: Type.String({ minLength: 1 }),
112
+ }, { additionalProperties: false });
113
+ function validator(schema) {
114
+ const compiled = Compile(schema);
115
+ return {
116
+ check: (value) => compiled.Check(value),
117
+ errors: (value) => [...compiled.Errors(value)].map((error) => {
118
+ const path = "path" in error && typeof error.path === "string" ? error.path : "/";
119
+ return `${path}: ${error.message}`;
120
+ }),
121
+ };
122
+ }
123
+ export const validators = {
124
+ researchProject: validator(ResearchProjectSchema),
125
+ evidence: validator(EvidenceSchema),
126
+ claim: validator(ClaimSchema),
127
+ claimEvidenceLink: validator(ClaimEvidenceLinkSchema),
128
+ toolReceipt: validator(ToolReceiptSchema),
129
+ handoff: validator(HandoffSchema),
130
+ };
131
+ export function assertSchema(value, schemaName) {
132
+ const result = validators[schemaName];
133
+ if (!result.check(value))
134
+ throw new Error(`${schemaName} schema invalid: ${result.errors(value).join("; ")}`);
135
+ }
136
+ export function asProject(value) {
137
+ assertSchema(value, "researchProject");
138
+ return value;
139
+ }
140
+ export function asEvidence(value) {
141
+ assertSchema(value, "evidence");
142
+ return value;
143
+ }
144
+ export function asClaim(value) {
145
+ assertSchema(value, "claim");
146
+ return value;
147
+ }
148
+ export function asClaimEvidenceLink(value) {
149
+ assertSchema(value, "claimEvidenceLink");
150
+ return value;
151
+ }
152
+ export function asToolReceipt(value) {
153
+ assertSchema(value, "toolReceipt");
154
+ return value;
155
+ }
156
+ export function asHandoff(value) {
157
+ assertSchema(value, "handoff");
158
+ return value;
159
+ }
160
+ //# sourceMappingURL=schemas.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schemas.js","sourceRoot":"","sources":["../../../src/core/schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAA6B,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG1C,MAAM,cAAc,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AACpE,MAAM,kBAAkB,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC;IACnD,OAAO,EAAE,6BAA6B;CACvC,CAAC,CAAC,CAAC;AACJ,MAAM,aAAa,GAAG,IAAI,CAAC,MAAM,CAAC;IAChC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC;QACf,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACnB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;QACpB,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC;QACvB,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC;QACtB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;KACpB,CAAC;IACF,KAAK,EAAE,IAAI,CAAC,MAAM,CAAC,EAAE,SAAS,EAAE,CAAC,EAAE,CAAC;CACrC,CAAC,CA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;AAED,MAAM,UAAU,OAAO,CAAC,KAAc;IACpC,YAAY,CAAQ,KAAK,EAAE,OAAO,CAAC,CAAC;IACpC,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,mBAAmB,CAAC,KAAc;IAChD,YAAY,CAAoB,KAAK,EAAE,mBAAmB,CAAC,CAAC;IAC5D,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAc;IAC1C,YAAY,CAAc,KAAK,EAAE,aAAa,CAAC,CAAC;IAChD,OAAO,KAAK,CAAC;AACf,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,KAAc;IACtC,YAAY,CAAU,KAAK,EAAE,SAAS,CAAC,CAAC;IACxC,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1 @@
1
+ export { default } from "./adapters/pi/extension.js";
@@ -0,0 +1,2 @@
1
+ export { default } from "./adapters/pi/extension.js";
2
+ //# sourceMappingURL=extension.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extension.js","sourceRoot":"","sources":["../../src/extension.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,4BAA4B,CAAC"}
@@ -0,0 +1,72 @@
1
+ export * from "./agents/catalog.js";
2
+ export * from "./agents/discover.js";
3
+ export * from "./agents/import.js";
4
+ export * from "./branding.js";
5
+ export * from "./psyclaw-theme.js";
6
+ export * from "./chat.js";
7
+ export * from "./run.js";
8
+ export * from "./setup.js";
9
+ export * from "./core/contracts.js";
10
+ export * from "./core/docx.js";
11
+ export * from "./core/evidence-policy.js";
12
+ export * from "./core/filekind.js";
13
+ export * from "./core/hash.js";
14
+ export * from "./core/redact.js";
15
+ export * from "./core/schemas.js";
16
+ export * from "./project/bootstrap.js";
17
+ export * from "./project/jsonl.js";
18
+ export * from "./project/paths.js";
19
+ export * from "./project/versions.js";
20
+ export * from "./project/hitl.js";
21
+ export * from "./integrations/contracts.js";
22
+ export * from "./orchestration/contracts.js";
23
+ export * from "./research/ledger.js";
24
+ export * from "./research/brief.js";
25
+ export * from "./memory/store.js";
26
+ export * from "./orchestration/scheduler.js";
27
+ export * from "./orchestration/runner.js";
28
+ export * from "./integrations/mcp.js";
29
+ export * from "./install/installer.js";
30
+ export * from "./panel/events.js";
31
+ export * from "./panel/projection.js";
32
+ export * from "./panel/server.js";
33
+ export * from "./skills/contracts.js";
34
+ export * from "./skills/preflight.js";
35
+ export * from "./skills/registry.js";
36
+ export * from "./trust/manifest.js";
37
+ export * from "./trust/sbom.js";
38
+ export * from "./workflows/spec.js";
39
+ export * from "./workflows/literature-review.js";
40
+ export * from "./workflows/analysis-delegation.js";
41
+ export * from "./workflows/meta-analysis.js";
42
+ export * from "./workflows/publish.js";
43
+ export * from "./core/citations.js";
44
+ export * from "./workflows/writing-review.js";
45
+ export * from "./workflows/institutional-fulltext.js";
46
+ export * from "./workflows/expert-review.js";
47
+ export * from "./workflows/expert-review-runner.js";
48
+ export * from "./workflows/style-contract.js";
49
+ export * from "./style/contracts.js";
50
+ export * from "./style/registry.js";
51
+ export * from "./style/artifact.js";
52
+ export * from "./literature/contracts.js";
53
+ export * from "./literature/fulltext.js";
54
+ export * from "./literature/ledger.js";
55
+ export * from "./literature/knowledge-map.js";
56
+ export * from "./literature/metadata.js";
57
+ export { buildKnowledgeMap } from "./knowledge-map/index.js";
58
+ export * from "./analysis/hooks.js";
59
+ export * from "./analysis/pre-registration.js";
60
+ export * from "./updates/registry.js";
61
+ export * from "./updates/status.js";
62
+ export * from "./updates/skills.js";
63
+ export * from "./updates/manifest.js";
64
+ export * from "./updates/check.js";
65
+ export * from "./updates/update.js";
66
+ export * from "./adapters/pi/model.js";
67
+ export * from "./branding.js";
68
+ export * from "./adapters/pi/resources.js";
69
+ export * from "./adapters/pi/session.js";
70
+ export * from "./adapters/pi/rpc.js";
71
+ export * from "./orchestration/pi-executor.js";
72
+ export { default as psyclawPanelExtension } from "./panel/extension.js";