attention-manifest-protocol 0.4.0 → 0.4.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.
Files changed (626) hide show
  1. package/CHANGELOG.md +240 -226
  2. package/CHANGELOG.zh-CN.md +53 -39
  3. package/README.md +19 -0
  4. package/README.zh-CN.md +19 -0
  5. package/docs/probes/calibration-imported.json +141 -141
  6. package/docs/probes/eval-recorded-replay.json +597 -597
  7. package/docs/probes/eval-replay.json +124 -124
  8. package/docs/probes/eval-summary.json +42 -42
  9. package/docs/probes/runtime-eval.json +4230 -4230
  10. package/lib/attention/attention.d.ts +153 -0
  11. package/lib/attention/attention.js +209 -0
  12. package/lib/attention/budget.d.ts +31 -0
  13. package/lib/attention/budget.js +55 -0
  14. package/lib/attention/cognition.d.ts +230 -0
  15. package/lib/attention/cognition.js +245 -0
  16. package/lib/attention/index.d.ts +8 -0
  17. package/lib/attention/index.js +7 -0
  18. package/lib/attention/interrupts.d.ts +97 -0
  19. package/lib/attention/interrupts.js +151 -0
  20. package/lib/attention/resource.d.ts +167 -0
  21. package/lib/attention/resource.js +148 -0
  22. package/lib/attention/social.d.ts +74 -0
  23. package/lib/attention/social.js +153 -0
  24. package/lib/attention/socialTypes.d.ts +102 -0
  25. package/lib/attention/socialTypes.js +1 -0
  26. package/lib/authz/authz.d.ts +75 -0
  27. package/lib/authz/authz.js +176 -0
  28. package/lib/authz/index.d.ts +1 -0
  29. package/lib/authz/index.js +1 -0
  30. package/lib/bayes/calibration.d.ts +67 -0
  31. package/lib/bayes/calibration.js +114 -0
  32. package/lib/bayes/calibrationRegistry.d.ts +39 -0
  33. package/lib/bayes/calibrationRegistry.js +61 -0
  34. package/lib/bayes/calibrationSelection.d.ts +40 -0
  35. package/lib/bayes/calibrationSelection.js +89 -0
  36. package/lib/bayes/engine.d.ts +163 -0
  37. package/lib/bayes/engine.js +354 -0
  38. package/lib/bayes/index.d.ts +6 -0
  39. package/lib/bayes/index.js +6 -0
  40. package/lib/bayes/reliability.d.ts +27 -0
  41. package/lib/bayes/reliability.js +38 -0
  42. package/lib/bayes/scopedPriors.d.ts +34 -0
  43. package/lib/bayes/scopedPriors.js +70 -0
  44. package/lib/boundary/frame.d.ts +63 -0
  45. package/lib/boundary/frame.js +239 -0
  46. package/lib/boundary/ids.d.ts +8 -0
  47. package/lib/boundary/ids.js +12 -0
  48. package/lib/boundary/index.d.ts +12 -0
  49. package/lib/boundary/index.js +8 -0
  50. package/lib/boundary/refTable.d.ts +49 -0
  51. package/lib/boundary/refTable.js +92 -0
  52. package/lib/boundary/toolCall.d.ts +33 -0
  53. package/lib/boundary/toolCall.js +173 -0
  54. package/lib/concept/concept.d.ts +67 -0
  55. package/lib/concept/concept.js +1 -0
  56. package/lib/concept/conceptBudget.d.ts +56 -0
  57. package/lib/concept/conceptBudget.js +281 -0
  58. package/lib/concept/conceptBudgetTypes.d.ts +74 -0
  59. package/lib/concept/conceptBudgetTypes.js +1 -0
  60. package/lib/concept/index.d.ts +3 -0
  61. package/lib/concept/index.js +3 -0
  62. package/lib/concurrency/idempotency.d.ts +16 -0
  63. package/lib/concurrency/idempotency.js +21 -0
  64. package/lib/concurrency/index.d.ts +5 -0
  65. package/lib/concurrency/index.js +5 -0
  66. package/lib/concurrency/mutex.d.ts +13 -0
  67. package/lib/concurrency/mutex.js +26 -0
  68. package/lib/concurrency/namedLocks.d.ts +7 -0
  69. package/lib/concurrency/namedLocks.js +31 -0
  70. package/lib/concurrency/retry.d.ts +23 -0
  71. package/lib/concurrency/retry.js +38 -0
  72. package/lib/concurrency/worker.d.ts +42 -0
  73. package/lib/concurrency/worker.js +67 -0
  74. package/lib/context/agentContext.d.ts +58 -0
  75. package/lib/context/agentContext.js +197 -0
  76. package/lib/context/ast.d.ts +98 -0
  77. package/lib/context/ast.js +414 -0
  78. package/lib/context/contentStore.d.ts +16 -0
  79. package/lib/context/contentStore.js +61 -0
  80. package/lib/context/context.d.ts +15 -0
  81. package/lib/context/context.js +39 -0
  82. package/lib/context/contextIndex.d.ts +40 -0
  83. package/lib/context/contextIndex.js +64 -0
  84. package/lib/context/document.d.ts +102 -0
  85. package/lib/context/document.js +22 -0
  86. package/lib/context/fileStorePath.d.ts +1 -0
  87. package/lib/context/fileStorePath.js +13 -0
  88. package/lib/context/index.d.ts +22 -0
  89. package/lib/context/index.js +11 -0
  90. package/lib/context/lifecycle.d.ts +91 -0
  91. package/lib/context/lifecycle.js +163 -0
  92. package/lib/context/projections.d.ts +20 -0
  93. package/lib/context/projections.js +127 -0
  94. package/lib/context/workspace.d.ts +111 -0
  95. package/lib/context/workspace.js +318 -0
  96. package/lib/context/workspaceProtocol.d.ts +30 -0
  97. package/lib/context/workspaceProtocol.js +49 -0
  98. package/lib/context/workspaceService.d.ts +63 -0
  99. package/lib/context/workspaceService.js +352 -0
  100. package/lib/cooperation/board.d.ts +47 -0
  101. package/lib/cooperation/board.js +66 -0
  102. package/lib/cooperation/collaboration.d.ts +55 -0
  103. package/lib/cooperation/collaboration.js +1 -0
  104. package/lib/cooperation/index.d.ts +6 -0
  105. package/lib/cooperation/index.js +6 -0
  106. package/lib/cooperation/merge.d.ts +69 -0
  107. package/lib/cooperation/merge.js +109 -0
  108. package/lib/cooperation/metrics.d.ts +39 -0
  109. package/lib/cooperation/metrics.js +17 -0
  110. package/lib/cooperation/session.d.ts +75 -0
  111. package/lib/cooperation/session.js +74 -0
  112. package/lib/cooperation/unified.d.ts +38 -0
  113. package/lib/cooperation/unified.js +40 -0
  114. package/lib/database/adapter/adapters.d.ts +24 -0
  115. package/lib/database/adapter/adapters.js +31 -0
  116. package/lib/database/adapter/index.d.ts +4 -0
  117. package/lib/database/adapter/index.js +4 -0
  118. package/lib/database/adapter/runtimeSink.d.ts +20 -0
  119. package/lib/database/adapter/runtimeSink.js +50 -0
  120. package/lib/database/adapter/sessionStore.d.ts +11 -0
  121. package/lib/database/adapter/sessionStore.js +23 -0
  122. package/lib/database/adapter/turnStore.d.ts +10 -0
  123. package/lib/database/adapter/turnStore.js +15 -0
  124. package/lib/database/entity/agent.d.ts +133 -0
  125. package/lib/database/entity/agent.js +61 -0
  126. package/lib/database/entity/entity.d.ts +715 -0
  127. package/lib/database/entity/entity.js +372 -0
  128. package/lib/database/entity/handle.d.ts +31 -0
  129. package/lib/database/entity/handle.js +53 -0
  130. package/lib/database/entity/index.d.ts +32 -0
  131. package/lib/database/entity/index.js +22 -0
  132. package/lib/database/entity/message.d.ts +27 -0
  133. package/lib/database/entity/message.js +52 -0
  134. package/lib/database/entity/meta.d.ts +11 -0
  135. package/lib/database/entity/meta.js +1 -0
  136. package/lib/database/entity/object.d.ts +23 -0
  137. package/lib/database/entity/object.js +24 -0
  138. package/lib/database/entity/outbox.d.ts +9 -0
  139. package/lib/database/entity/outbox.js +5 -0
  140. package/lib/database/entity/process.d.ts +30 -0
  141. package/lib/database/entity/process.js +40 -0
  142. package/lib/database/entity/registry.d.ts +81 -0
  143. package/lib/database/entity/registry.js +91 -0
  144. package/lib/database/entity/runtimeApproval.d.ts +23 -0
  145. package/lib/database/entity/runtimeApproval.js +5 -0
  146. package/lib/database/entity/runtimeSession.d.ts +7 -0
  147. package/lib/database/entity/runtimeSession.js +5 -0
  148. package/lib/database/entity/runtimeTurn.d.ts +9 -0
  149. package/lib/database/entity/runtimeTurn.js +5 -0
  150. package/lib/database/entity/thread.d.ts +35 -0
  151. package/lib/database/entity/thread.js +55 -0
  152. package/lib/database/entity/window.d.ts +39 -0
  153. package/lib/database/entity/window.js +56 -0
  154. package/lib/database/entity/worker.d.ts +42 -0
  155. package/lib/database/entity/worker.js +58 -0
  156. package/lib/database/index.d.ts +6 -0
  157. package/lib/database/index.js +6 -0
  158. package/lib/database/repository/addressSpaceRepository.d.ts +18 -0
  159. package/lib/database/repository/addressSpaceRepository.js +40 -0
  160. package/lib/database/repository/agentRepository.d.ts +41 -0
  161. package/lib/database/repository/agentRepository.js +398 -0
  162. package/lib/database/repository/base.d.ts +31 -0
  163. package/lib/database/repository/base.js +23 -0
  164. package/lib/database/repository/executionRepository.d.ts +64 -0
  165. package/lib/database/repository/executionRepository.js +379 -0
  166. package/lib/database/repository/handleRepository.d.ts +35 -0
  167. package/lib/database/repository/handleRepository.js +57 -0
  168. package/lib/database/repository/index.d.ts +20 -0
  169. package/lib/database/repository/index.js +17 -0
  170. package/lib/database/repository/messageRepository.d.ts +33 -0
  171. package/lib/database/repository/messageRepository.js +45 -0
  172. package/lib/database/repository/objectRepository.d.ts +43 -0
  173. package/lib/database/repository/objectRepository.js +60 -0
  174. package/lib/database/repository/outboxRepository.d.ts +15 -0
  175. package/lib/database/repository/outboxRepository.js +51 -0
  176. package/lib/database/repository/processRepository.d.ts +31 -0
  177. package/lib/database/repository/processRepository.js +48 -0
  178. package/lib/database/repository/registryRepository.d.ts +72 -0
  179. package/lib/database/repository/registryRepository.js +95 -0
  180. package/lib/database/repository/repository.d.ts +322 -0
  181. package/lib/database/repository/repository.js +332 -0
  182. package/lib/database/repository/runtimeApprovalRepository.d.ts +14 -0
  183. package/lib/database/repository/runtimeApprovalRepository.js +35 -0
  184. package/lib/database/repository/runtimeSessionRepository.d.ts +9 -0
  185. package/lib/database/repository/runtimeSessionRepository.js +21 -0
  186. package/lib/database/repository/runtimeTurnRepository.d.ts +10 -0
  187. package/lib/database/repository/runtimeTurnRepository.js +32 -0
  188. package/lib/database/repository/socialRepository.d.ts +22 -0
  189. package/lib/database/repository/socialRepository.js +155 -0
  190. package/lib/database/repository/threadRepository.d.ts +29 -0
  191. package/lib/database/repository/threadRepository.js +48 -0
  192. package/lib/database/repository/windowRepository.d.ts +46 -0
  193. package/lib/database/repository/windowRepository.js +68 -0
  194. package/lib/database/repository/workerRepository.d.ts +38 -0
  195. package/lib/database/repository/workerRepository.js +61 -0
  196. package/lib/database/service/database.d.ts +55 -0
  197. package/lib/database/service/database.js +77 -0
  198. package/lib/database/service/handleService.d.ts +20 -0
  199. package/lib/database/service/handleService.js +34 -0
  200. package/lib/database/service/index.d.ts +16 -0
  201. package/lib/database/service/index.js +11 -0
  202. package/lib/database/service/messageService.d.ts +26 -0
  203. package/lib/database/service/messageService.js +40 -0
  204. package/lib/database/service/objectService.d.ts +32 -0
  205. package/lib/database/service/objectService.js +31 -0
  206. package/lib/database/service/processService.d.ts +22 -0
  207. package/lib/database/service/processService.js +45 -0
  208. package/lib/database/service/registryServices.d.ts +43 -0
  209. package/lib/database/service/registryServices.js +60 -0
  210. package/lib/database/service/service.d.ts +131 -0
  211. package/lib/database/service/service.js +153 -0
  212. package/lib/database/service/stepService.d.ts +23 -0
  213. package/lib/database/service/stepService.js +35 -0
  214. package/lib/database/service/threadService.d.ts +23 -0
  215. package/lib/database/service/threadService.js +48 -0
  216. package/lib/database/service/windowService.d.ts +15 -0
  217. package/lib/database/service/windowService.js +22 -0
  218. package/lib/database/service/workerService.d.ts +28 -0
  219. package/lib/database/service/workerService.js +34 -0
  220. package/lib/database/sql/index.d.ts +3 -0
  221. package/lib/database/sql/index.js +2 -0
  222. package/lib/database/sql/schema.d.ts +5 -0
  223. package/lib/database/sql/schema.js +416 -0
  224. package/lib/database/sql/sql.d.ts +290 -0
  225. package/lib/database/sql/sql.js +430 -0
  226. package/lib/database/store/database.d.ts +75 -0
  227. package/lib/database/store/database.js +143 -0
  228. package/lib/database/store/index.d.ts +3 -0
  229. package/lib/database/store/index.js +2 -0
  230. package/lib/database/store/store.d.ts +145 -0
  231. package/lib/database/store/store.js +192 -0
  232. package/lib/delegate/index.d.ts +2 -0
  233. package/lib/delegate/index.js +2 -0
  234. package/lib/delegate/team.d.ts +92 -0
  235. package/lib/delegate/team.js +200 -0
  236. package/lib/delegate/teamTypes.d.ts +43 -0
  237. package/lib/delegate/teamTypes.js +1 -0
  238. package/lib/diagnosis/checklist.d.ts +16 -0
  239. package/lib/diagnosis/checklist.js +61 -0
  240. package/lib/diagnosis/context.d.ts +19 -0
  241. package/lib/diagnosis/context.js +79 -0
  242. package/lib/diagnosis/frame.d.ts +34 -0
  243. package/lib/diagnosis/frame.js +230 -0
  244. package/lib/diagnosis/index.d.ts +5 -0
  245. package/lib/diagnosis/index.js +5 -0
  246. package/lib/diagnosis/router.d.ts +22 -0
  247. package/lib/diagnosis/router.js +47 -0
  248. package/lib/diagnosis/types.d.ts +78 -0
  249. package/lib/diagnosis/types.js +2 -0
  250. package/lib/error/agentError.d.ts +9 -0
  251. package/lib/error/agentError.js +13 -0
  252. package/lib/error/ampError.d.ts +14 -0
  253. package/lib/error/ampError.js +19 -0
  254. package/lib/error/authzError.d.ts +10 -0
  255. package/lib/error/authzError.js +11 -0
  256. package/lib/error/boundaryRejection.d.ts +16 -0
  257. package/lib/error/boundaryRejection.js +14 -0
  258. package/lib/error/index.d.ts +7 -0
  259. package/lib/error/index.js +7 -0
  260. package/lib/error/kernelError.d.ts +11 -0
  261. package/lib/error/kernelError.js +12 -0
  262. package/lib/error/mailboxError.d.ts +5 -0
  263. package/lib/error/mailboxError.js +6 -0
  264. package/lib/error/windowError.d.ts +8 -0
  265. package/lib/error/windowError.js +9 -0
  266. package/lib/evaluation/agreement.d.ts +22 -0
  267. package/lib/evaluation/agreement.js +82 -0
  268. package/lib/evaluation/index.d.ts +2 -0
  269. package/lib/evaluation/index.js +2 -0
  270. package/lib/evaluation/labels.d.ts +56 -0
  271. package/lib/evaluation/labels.js +206 -0
  272. package/lib/evidence/evidenceGraph.d.ts +37 -0
  273. package/lib/evidence/evidenceGraph.js +165 -0
  274. package/lib/evidence/index.d.ts +4 -0
  275. package/lib/evidence/index.js +2 -0
  276. package/lib/evidence/revalidation.d.ts +70 -0
  277. package/lib/evidence/revalidation.js +146 -0
  278. package/lib/execution/exec.d.ts +151 -0
  279. package/lib/execution/exec.js +282 -0
  280. package/lib/execution/handles.d.ts +25 -0
  281. package/lib/execution/handles.js +45 -0
  282. package/lib/execution/index.d.ts +3 -0
  283. package/lib/execution/index.js +3 -0
  284. package/lib/execution/pin.d.ts +60 -0
  285. package/lib/execution/pin.js +103 -0
  286. package/lib/frame/frame.d.ts +61 -0
  287. package/lib/frame/frame.js +1 -0
  288. package/lib/frame/index.d.ts +1 -0
  289. package/lib/frame/index.js +1 -0
  290. package/lib/goal/goal.d.ts +19 -0
  291. package/lib/goal/goal.js +21 -0
  292. package/lib/goal/index.d.ts +2 -0
  293. package/lib/goal/index.js +1 -0
  294. package/lib/goal/plan.d.ts +125 -0
  295. package/lib/goal/plan.js +60 -0
  296. package/lib/governance/attentionManifest.d.ts +279 -0
  297. package/lib/governance/attentionManifest.js +467 -0
  298. package/lib/governance/audit.d.ts +123 -0
  299. package/lib/governance/audit.js +263 -0
  300. package/lib/governance/budget.d.ts +219 -0
  301. package/lib/governance/budget.js +424 -0
  302. package/lib/governance/context.d.ts +159 -0
  303. package/lib/governance/context.js +229 -0
  304. package/lib/governance/control.d.ts +65 -0
  305. package/lib/governance/control.js +89 -0
  306. package/lib/governance/cooperation.d.ts +163 -0
  307. package/lib/governance/cooperation.js +350 -0
  308. package/lib/governance/credential.d.ts +117 -0
  309. package/lib/governance/credential.js +229 -0
  310. package/lib/governance/httpServer.d.ts +18 -0
  311. package/lib/governance/httpServer.js +74 -0
  312. package/lib/governance/index.d.ts +32 -0
  313. package/lib/governance/index.js +32 -0
  314. package/lib/governance/legal.d.ts +222 -0
  315. package/lib/governance/legal.js +371 -0
  316. package/lib/governance/matrix.d.ts +170 -0
  317. package/lib/governance/matrix.js +365 -0
  318. package/lib/governance/perspectives.d.ts +98 -0
  319. package/lib/governance/perspectives.js +340 -0
  320. package/lib/governance/signing.d.ts +131 -0
  321. package/lib/governance/signing.js +241 -0
  322. package/lib/governance/store.d.ts +33 -0
  323. package/lib/governance/store.js +89 -0
  324. package/lib/governance/switching.d.ts +183 -0
  325. package/lib/governance/switching.js +257 -0
  326. package/lib/governance/toolPolicy.d.ts +37 -0
  327. package/lib/governance/toolPolicy.js +42 -0
  328. package/lib/governance/transport.d.ts +76 -0
  329. package/lib/governance/transport.js +124 -0
  330. package/lib/governance/types.d.ts +218 -0
  331. package/lib/governance/types.js +72 -0
  332. package/lib/governance/workflow.d.ts +174 -0
  333. package/lib/governance/workflow.js +612 -0
  334. package/lib/index.d.ts +11 -0
  335. package/lib/index.js +11 -0
  336. package/lib/interaction/index.d.ts +1 -0
  337. package/lib/interaction/index.js +1 -0
  338. package/lib/interaction/interaction.d.ts +83 -0
  339. package/lib/interaction/interaction.js +256 -0
  340. package/lib/ipc/index.d.ts +4 -0
  341. package/lib/ipc/index.js +3 -0
  342. package/lib/ipc/mailbox.d.ts +37 -0
  343. package/lib/ipc/mailbox.js +77 -0
  344. package/lib/ipc/memorySocialStore.d.ts +14 -0
  345. package/lib/ipc/memorySocialStore.js +83 -0
  346. package/lib/ipc/social.d.ts +80 -0
  347. package/lib/ipc/social.js +1 -0
  348. package/lib/kernel/index.d.ts +2 -0
  349. package/lib/kernel/index.js +1 -0
  350. package/lib/kernel/scheduler.d.ts +195 -0
  351. package/lib/kernel/scheduler.js +334 -0
  352. package/lib/ledger/checkpoint.d.ts +116 -0
  353. package/lib/ledger/checkpoint.js +223 -0
  354. package/lib/ledger/index.d.ts +4 -0
  355. package/lib/ledger/index.js +4 -0
  356. package/lib/ledger/ledger.d.ts +21 -0
  357. package/lib/ledger/ledger.js +23 -0
  358. package/lib/ledger/persistence.d.ts +46 -0
  359. package/lib/ledger/persistence.js +106 -0
  360. package/lib/ledger/share.d.ts +29 -0
  361. package/lib/ledger/share.js +39 -0
  362. package/lib/lock/index.d.ts +2 -0
  363. package/lib/lock/index.js +1 -0
  364. package/lib/lock/lease.d.ts +23 -0
  365. package/lib/lock/lease.js +42 -0
  366. package/lib/manifest/agentCard.d.ts +35 -0
  367. package/lib/manifest/agentCard.js +38 -0
  368. package/lib/manifest/cardSign.d.ts +25 -0
  369. package/lib/manifest/cardSign.js +70 -0
  370. package/lib/manifest/federation.d.ts +64 -0
  371. package/lib/manifest/federation.js +187 -0
  372. package/lib/manifest/federationTypes.d.ts +51 -0
  373. package/lib/manifest/federationTypes.js +1 -0
  374. package/lib/manifest/index.d.ts +8 -0
  375. package/lib/manifest/index.js +8 -0
  376. package/lib/manifest/keys.d.ts +221 -0
  377. package/lib/manifest/keys.js +484 -0
  378. package/lib/manifest/manifest.d.ts +102 -0
  379. package/lib/manifest/manifest.js +1 -0
  380. package/lib/manifest/sign.d.ts +38 -0
  381. package/lib/manifest/sign.js +90 -0
  382. package/lib/manifest/trust.d.ts +54 -0
  383. package/lib/manifest/trust.js +87 -0
  384. package/lib/mission/index.d.ts +2 -0
  385. package/lib/mission/index.js +1 -0
  386. package/lib/mission/missionQueue.d.ts +19 -0
  387. package/lib/mission/missionQueue.js +62 -0
  388. package/lib/module/index.d.ts +9 -0
  389. package/lib/module/index.js +9 -0
  390. package/lib/module/llm/deepseek.d.ts +43 -0
  391. package/lib/module/llm/deepseek.js +162 -0
  392. package/lib/module/llm/llm.d.ts +64 -0
  393. package/lib/module/llm/llm.js +16 -0
  394. package/lib/module/mcp/client.d.ts +32 -0
  395. package/lib/module/mcp/client.js +84 -0
  396. package/lib/module/mcp/http.d.ts +32 -0
  397. package/lib/module/mcp/http.js +83 -0
  398. package/lib/module/mcp/protocol.d.ts +62 -0
  399. package/lib/module/mcp/protocol.js +20 -0
  400. package/lib/module/mcp/server.d.ts +22 -0
  401. package/lib/module/mcp/server.js +138 -0
  402. package/lib/module/mcp/transport.d.ts +19 -0
  403. package/lib/module/mcp/transport.js +16 -0
  404. package/lib/module/mcp/workspaceServer.d.ts +20 -0
  405. package/lib/module/mcp/workspaceServer.js +90 -0
  406. package/lib/module/sandbox/sandbox.d.ts +24 -0
  407. package/lib/module/sandbox/sandbox.js +5 -0
  408. package/lib/module/tool/mcpExecutor.d.ts +18 -0
  409. package/lib/module/tool/mcpExecutor.js +41 -0
  410. package/lib/module/tool/policy.d.ts +30 -0
  411. package/lib/module/tool/policy.js +23 -0
  412. package/lib/module/tool/redact.d.ts +9 -0
  413. package/lib/module/tool/redact.js +19 -0
  414. package/lib/module/tool/tool.d.ts +26 -0
  415. package/lib/module/tool/tool.js +24 -0
  416. package/lib/module/tool/workspaceExecutor.d.ts +12 -0
  417. package/lib/module/tool/workspaceExecutor.js +25 -0
  418. package/lib/policy/guard.d.ts +115 -0
  419. package/lib/policy/guard.js +154 -0
  420. package/lib/policy/index.d.ts +2 -0
  421. package/lib/policy/index.js +2 -0
  422. package/lib/policy/policy.d.ts +249 -0
  423. package/lib/policy/policy.js +364 -0
  424. package/lib/process/agent.d.ts +295 -0
  425. package/lib/process/agent.js +1 -0
  426. package/lib/process/agentService.d.ts +87 -0
  427. package/lib/process/agentService.js +128 -0
  428. package/lib/process/agentStore.d.ts +35 -0
  429. package/lib/process/agentStore.js +328 -0
  430. package/lib/process/executionStore.d.ts +79 -0
  431. package/lib/process/executionStore.js +71 -0
  432. package/lib/process/index.d.ts +5 -0
  433. package/lib/process/index.js +5 -0
  434. package/lib/process/process.d.ts +120 -0
  435. package/lib/process/process.js +111 -0
  436. package/lib/process/transitions.d.ts +11 -0
  437. package/lib/process/transitions.js +8 -0
  438. package/lib/progress/index.d.ts +2 -0
  439. package/lib/progress/index.js +1 -0
  440. package/lib/progress/progress.d.ts +26 -0
  441. package/lib/progress/progress.js +42 -0
  442. package/lib/protocol/a2a.d.ts +51 -0
  443. package/lib/protocol/a2a.js +79 -0
  444. package/lib/protocol/channel.d.ts +25 -0
  445. package/lib/protocol/channel.js +27 -0
  446. package/lib/protocol/envelope.d.ts +180 -0
  447. package/lib/protocol/envelope.js +495 -0
  448. package/lib/protocol/httpChannel.d.ts +33 -0
  449. package/lib/protocol/httpChannel.js +59 -0
  450. package/lib/protocol/index.d.ts +6 -0
  451. package/lib/protocol/index.js +6 -0
  452. package/lib/protocol/protocol.d.ts +120 -0
  453. package/lib/protocol/protocol.js +1 -0
  454. package/lib/protocol/wire.d.ts +12 -0
  455. package/lib/protocol/wire.js +55 -0
  456. package/lib/receipt/index.d.ts +1 -0
  457. package/lib/receipt/index.js +1 -0
  458. package/lib/receipt/receipt.d.ts +43 -0
  459. package/lib/receipt/receipt.js +1 -0
  460. package/lib/registry/content.d.ts +10 -0
  461. package/lib/registry/content.js +58 -0
  462. package/lib/registry/index.d.ts +4 -0
  463. package/lib/registry/index.js +2 -0
  464. package/lib/registry/registry.d.ts +109 -0
  465. package/lib/registry/registry.js +299 -0
  466. package/lib/runtime/action.d.ts +46 -0
  467. package/lib/runtime/action.js +39 -0
  468. package/lib/runtime/behavior.d.ts +110 -0
  469. package/lib/runtime/behavior.js +179 -0
  470. package/lib/runtime/behaviorTuning.d.ts +59 -0
  471. package/lib/runtime/behaviorTuning.js +95 -0
  472. package/lib/runtime/cognitiveRuntime.d.ts +189 -0
  473. package/lib/runtime/cognitiveRuntime.js +490 -0
  474. package/lib/runtime/escalation.d.ts +22 -0
  475. package/lib/runtime/escalation.js +15 -0
  476. package/lib/runtime/governedTask.d.ts +57 -0
  477. package/lib/runtime/governedTask.js +150 -0
  478. package/lib/runtime/index.d.ts +15 -0
  479. package/lib/runtime/index.js +15 -0
  480. package/lib/runtime/kernelRuntime.d.ts +33 -0
  481. package/lib/runtime/kernelRuntime.js +105 -0
  482. package/lib/runtime/operation.d.ts +30 -0
  483. package/lib/runtime/operation.js +1 -0
  484. package/lib/runtime/replay.d.ts +24 -0
  485. package/lib/runtime/replay.js +38 -0
  486. package/lib/runtime/routing.d.ts +12 -0
  487. package/lib/runtime/routing.js +44 -0
  488. package/lib/runtime/safety.d.ts +15 -0
  489. package/lib/runtime/safety.js +28 -0
  490. package/lib/runtime/session.d.ts +147 -0
  491. package/lib/runtime/session.js +214 -0
  492. package/lib/runtime/sessionStore.d.ts +24 -0
  493. package/lib/runtime/sessionStore.js +20 -0
  494. package/lib/runtime/telemetry.d.ts +24 -0
  495. package/lib/runtime/telemetry.js +33 -0
  496. package/lib/runtime/turnStore.d.ts +16 -0
  497. package/lib/runtime/turnStore.js +15 -0
  498. package/lib/scenario/index.d.ts +1 -0
  499. package/lib/scenario/index.js +1 -0
  500. package/lib/scenario/scenario.d.ts +52 -0
  501. package/lib/scenario/scenario.js +210 -0
  502. package/lib/semantic/canonical.d.ts +6 -0
  503. package/lib/semantic/canonical.js +22 -0
  504. package/lib/semantic/index.d.ts +2 -0
  505. package/lib/semantic/index.js +2 -0
  506. package/lib/semantic/sha256.d.ts +1 -0
  507. package/lib/semantic/sha256.js +66 -0
  508. package/lib/storage/appendLog.d.ts +145 -0
  509. package/lib/storage/appendLog.js +299 -0
  510. package/lib/storage/fileAppendSink.d.ts +7 -0
  511. package/lib/storage/fileAppendSink.js +34 -0
  512. package/lib/storage/index.d.ts +2 -0
  513. package/lib/storage/index.js +2 -0
  514. package/lib/store/bindCache.d.ts +9 -0
  515. package/lib/store/bindCache.js +18 -0
  516. package/lib/store/cache.d.ts +48 -0
  517. package/lib/store/cache.js +162 -0
  518. package/lib/store/context.d.ts +10 -0
  519. package/lib/store/context.js +27 -0
  520. package/lib/store/handleStore.d.ts +9 -0
  521. package/lib/store/handleStore.js +25 -0
  522. package/lib/store/index.d.ts +9 -0
  523. package/lib/store/index.js +8 -0
  524. package/lib/store/messageStore.d.ts +9 -0
  525. package/lib/store/messageStore.js +25 -0
  526. package/lib/store/objectStore.d.ts +9 -0
  527. package/lib/store/objectStore.js +25 -0
  528. package/lib/store/processStore.d.ts +9 -0
  529. package/lib/store/processStore.js +25 -0
  530. package/lib/store/threadStore.d.ts +9 -0
  531. package/lib/store/threadStore.js +25 -0
  532. package/lib/store/windowStore.d.ts +9 -0
  533. package/lib/store/windowStore.js +25 -0
  534. package/lib/structure/abstractSyntaxTree.d.ts +181 -0
  535. package/lib/structure/abstractSyntaxTree.js +400 -0
  536. package/lib/structure/avlTree.d.ts +125 -0
  537. package/lib/structure/avlTree.js +369 -0
  538. package/lib/structure/binarySearchTree.d.ts +125 -0
  539. package/lib/structure/binarySearchTree.js +306 -0
  540. package/lib/structure/binaryTree.d.ts +174 -0
  541. package/lib/structure/binaryTree.js +495 -0
  542. package/lib/structure/bloomFilter.d.ts +126 -0
  543. package/lib/structure/bloomFilter.js +177 -0
  544. package/lib/structure/compare.d.ts +55 -0
  545. package/lib/structure/compare.js +96 -0
  546. package/lib/structure/cuckooFilter.d.ts +149 -0
  547. package/lib/structure/cuckooFilter.js +267 -0
  548. package/lib/structure/deque.d.ts +117 -0
  549. package/lib/structure/deque.js +205 -0
  550. package/lib/structure/filterKey.d.ts +19 -0
  551. package/lib/structure/filterKey.js +28 -0
  552. package/lib/structure/hash.d.ts +129 -0
  553. package/lib/structure/hash.js +241 -0
  554. package/lib/structure/heap.d.ts +152 -0
  555. package/lib/structure/heap.js +227 -0
  556. package/lib/structure/index.d.ts +20 -0
  557. package/lib/structure/index.js +20 -0
  558. package/lib/structure/iterator.d.ts +6 -0
  559. package/lib/structure/iterator.js +16 -0
  560. package/lib/structure/lru.d.ts +235 -0
  561. package/lib/structure/lru.js +524 -0
  562. package/lib/structure/ordered.d.ts +89 -0
  563. package/lib/structure/ordered.js +336 -0
  564. package/lib/structure/priority.d.ts +499 -0
  565. package/lib/structure/priority.js +756 -0
  566. package/lib/structure/queue.d.ts +90 -0
  567. package/lib/structure/queue.js +154 -0
  568. package/lib/structure/redBlackTree.d.ts +142 -0
  569. package/lib/structure/redBlackTree.js +644 -0
  570. package/lib/structure/segmentTree.d.ts +129 -0
  571. package/lib/structure/segmentTree.js +205 -0
  572. package/lib/structure/stack.d.ts +77 -0
  573. package/lib/structure/stack.js +107 -0
  574. package/lib/structure/unordered.d.ts +99 -0
  575. package/lib/structure/unordered.js +341 -0
  576. package/lib/thread/index.d.ts +2 -0
  577. package/lib/thread/index.js +2 -0
  578. package/lib/thread/thread.d.ts +107 -0
  579. package/lib/thread/thread.js +81 -0
  580. package/lib/thread/transitions.d.ts +8 -0
  581. package/lib/thread/transitions.js +9 -0
  582. package/lib/types/common.d.ts +80 -0
  583. package/lib/types/common.js +5 -0
  584. package/lib/types/index.d.ts +23 -0
  585. package/lib/types/index.js +1 -0
  586. package/lib/warrant/epistemic.d.ts +141 -0
  587. package/lib/warrant/epistemic.js +1 -0
  588. package/lib/warrant/index.d.ts +3 -0
  589. package/lib/warrant/index.js +3 -0
  590. package/lib/warrant/inquiry.d.ts +69 -0
  591. package/lib/warrant/inquiry.js +119 -0
  592. package/lib/warrant/warrant.d.ts +46 -0
  593. package/lib/warrant/warrant.js +153 -0
  594. package/lib/window/compaction.d.ts +57 -0
  595. package/lib/window/compaction.js +334 -0
  596. package/lib/window/compactionTypes.d.ts +113 -0
  597. package/lib/window/compactionTypes.js +1 -0
  598. package/lib/window/index.d.ts +4 -0
  599. package/lib/window/index.js +2 -0
  600. package/lib/window/page.d.ts +16 -0
  601. package/lib/window/page.js +2 -0
  602. package/lib/window/window.d.ts +68 -0
  603. package/lib/window/window.js +194 -0
  604. package/package.json +22 -1
  605. package/src/authz/index.ts +1 -0
  606. package/src/concept/index.ts +3 -0
  607. package/src/concurrency/index.ts +5 -0
  608. package/src/cooperation/index.ts +6 -0
  609. package/src/delegate/index.ts +2 -0
  610. package/src/error/index.ts +7 -0
  611. package/src/evaluation/index.ts +2 -0
  612. package/src/execution/index.ts +3 -0
  613. package/src/frame/index.ts +1 -0
  614. package/src/index.ts +11 -0
  615. package/src/ledger/index.ts +4 -0
  616. package/src/manifest/index.ts +8 -0
  617. package/src/policy/index.ts +2 -0
  618. package/src/protocol/index.ts +6 -0
  619. package/src/receipt/index.ts +1 -0
  620. package/src/semantic/index.ts +2 -0
  621. package/src/storage/index.ts +2 -0
  622. package/src/structure/index.ts +20 -0
  623. package/src/thread/index.ts +2 -0
  624. package/src/warrant/index.ts +3 -0
  625. package/tools/rewrite-declaration-extensions.ts +98 -0
  626. package/tsconfig.build.json +14 -0
package/CHANGELOG.md CHANGED
@@ -1,15 +1,29 @@
1
- # Changelog
2
-
3
- All notable changes to this project are documented in this file.
4
-
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
6
- project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
-
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this
6
+ project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
8
  ## [Unreleased]
9
-
10
- ### Changed
11
-
12
- - Consolidated project guidance into the English and Chinese READMEs; evaluation summaries now remain JSON-only.
9
+
10
+ ### Changed
11
+
12
+ - Consolidated project guidance into the English and Chinese READMEs; evaluation summaries now remain JSON-only.
13
+
14
+ ## [0.4.1] - 2026-10-29
15
+
16
+ Published library build: the package now exposes importable ESM with types.
17
+
18
+ ### Added
19
+
20
+ - `npm run build:lib` emits ESM and declaration files to `lib/`; `prepublishOnly` rebuilds them before every publish.
21
+ - `exports` maps the root entry (`lib/index.js`), per-module subpaths, deep module files and `schemas/*`; `main`, `types` and the `types` conditions cover both `nodenext` and bundler resolution.
22
+ - Module barrels for the remaining `src/` directories, so every module imports through a single path.
23
+
24
+ ### Fixed
25
+
26
+ - Declarations now carry JavaScript specifier extensions. `tsc` rewrites relative `.ts` imports only for `.js` output, so `tools/rewrite-declaration-extensions.ts` rewrites the `.d.ts` files and fails the build if a TypeScript extension survives.
13
27
 
14
28
  ## [0.4.0] - 2026-10-29
15
29
 
@@ -52,218 +66,218 @@ Governance v0.3: Ed25519 signing, durable audit, authenticated transport and a p
52
66
 
53
67
  Governance v0.2: auditable, transportable and measurable, with a green verification chain.
54
68
 
55
- ### Added
56
-
57
- - The attention-governance layer (`src/governance/`). It implements the nine constructs of the
58
- Attention Manifest Protocol description: the scenario × mode matrix (all tables from
59
- 9.1–9.8), the perspective registry, signed attention manifests, the three-layer context,
60
- triple-signed switch credentials, the Bayesian control layer, the legal behaviour layer
61
- (freeze, downgrade, breaker), the three-ledger budget and the seven-phase approval
62
- workflow. It reconciles the description's T1/T2/T3 strictness order with AMP's existing
63
- T0–T4 strength order (`F1→T3`, `F2→T2`, `F3→T1`) and keeps explicit bridges from the eight
64
- legacy scenarios to the five canonical ones and from `inspire` to `diverge`.
65
- - `docs/governance.md`, `governance.schema.json` (manifest and credential) and two validatable
66
- examples (`attention-manifest.json`, `switch-credential.json`).
67
- - `tools/governance-check.ts` (19 assertions) and `tools/governed-task-check.ts` (5
68
- assertions), both wired into `npm run verify`.
69
- - `src/runtime/governedTask.ts`: manifest verification, credential validation, legal audit,
70
- ledger charge, board receipt and control decision wrapped around `CognitiveRuntime`.
71
- Refusal paths return before the model call. A live `deepseek-chat` governed turn has been
72
- run end to end.
73
- - Agent budget ledgers and `reallocate()`: budgets now support `scope: "agent"`; a sub-agent's
74
- quota is transferred from its parent with the total conserved. Negative/NaN/Infinity amounts
75
- are rejected, reserve charges require finance approval, and a draw above 50% also needs the board.
76
- - Perspective-switch orchestration (`src/governance/switching.ts`): peer switch, downgrade,
77
- mode switch, scenario re-derivation and the escalation plan. A scenario switch calls
78
- `rederiveAttentionManifest()`, increments the version and records the parent digest.
79
- - Multi-agent cooperation (`src/governance/cooperation.ts`): structured messages (manifest
80
- summary, refs, credential, receipt), receiver-side credential verification, an independent
81
- supervisory audit path, and communication pruning by reliability × information value.
82
- - Multi-agent transport seam (`src/governance/transport.ts`): `LoopbackTransport`,
83
- `HttpCooperationTransport` and `createCooperationHandler()`. The receiver always re-runs the
84
- digest/manifest/credential/receipt checks; malformed envelopes are 400, policy rejections 422
85
- and success 200. `cooperation-check` is now 13 checks.
86
- - Governance audit chain (`src/governance/audit.ts`): manifests, credentials, receipts, charges,
87
- legal orders, workflow transitions, switches and runtime turns can be appended to a hash-linked
88
- append-only log; `verify()` detects edits, reordering and truncation, and `open({ sink })`
89
- verifies the whole chain on reopen. `GovernedTask` accepts an `audit` and appends a
90
- `runtime.turn` record after settlement.
91
- - `tools/audit-check.ts` (2 checks) covers cross-object records, reopen, tampering and corruption;
92
- wired into `npm run verify`.
93
- - `tools/cooperation-check.ts` (13 checks) wired into `npm run verify`; `governance-check` is
94
- now 21 checks, including regressions for forged signatures, negative amounts, freeze
95
- revocation, the archive gate, control NaN, unknown effects and private-context leakage.
96
- - `tools/live-governance-eval.ts` (`npm run governance-live`) with DeepSeek quality, token and
97
- boundary evaluation. Quality uses a deterministic rubric plus a strict judge; tokens record
98
- input/output/cache/cost, ledger charge and cap; boundaries cover crisis escalation, expired
99
- manifest, stale credential, legal freeze, budget exhaustion, prompt-injection leakage and
100
- multi-agent scope/size limits. The report lands in `docs/probes/governance-live.json`; the
101
- key is read from the environment only. First run: 6/6 rubric, judge 4.83/5, matched token
102
- delta +3.8%, boundaries 9/9.
103
- - `GovernedTask` now maps the manifest's scenario and modes into the runtime's
104
- scenario/interaction budgets, injects the manifest summary, evidence floor and forbidden
105
- behaviours as a `systemNote`, charges the manifest's `perspective`/`agent` ledger, and checks
106
- for a frozen ledger before generation.
107
- - Construction boundary (`src/boundary/`). `frameFrom()` validates the id grammar, reference
108
- closure, the 9-slot ceiling, the exclusion cap (default 50, overflow returned as `deferred`)
109
- and budget consistency before a frame exists; `parseToolCall()` validates arguments against a
110
- JSON Schema subset and returns a digest of exactly what was accepted; `RefTable` gives `tool`
111
- and `capability` one namespace and resolves `self`. 19 assertions run as
112
- `npm run boundary-check` and inside `npm run verify`.
113
- - `ExecProfile` parses call arguments through `parseToolCall()` before policy evaluation and
114
- dispatch. A rejected argument set records a blocked receipt and never reaches a server;
115
- approvals bind to the parsed digest.
116
- - Context economy. `planPrune()` builds an explicit view of a verified ledger: superseded
117
- claims, closed hypotheses and resolved non-blocking unknowns leave it, every omission
118
- carries a `reason` and a `revisit_if`, and citations are closed over so that nothing
119
- dangles. `supersedes` is deliberately not treated as a dependency.
120
- - `compactLedger()` replaces a cold prefix with a checkpoint that commits to the digest of
121
- the removed entries. `verifyCompaction()` re-derives that commitment and checks that the
122
- tail continues the same chain. Compaction refuses to bury an entry the retained tail still
123
- cites, and raises `CompactionRefused` with the pinned references.
124
- - `compaction.schema.json` covering checkpoints and prune plans, two worked examples
125
- (`checkpoint.json`, `prune-plan.json`), and `docs/compaction.md` with invariants P-1 to P-7.
126
- - `tools/compaction-check.ts` with 15 assertions, wired into `npm run verify`.
127
- - Concept economy. `pruneConcept()` bounds one concept's content: duplicate examples collapse
128
- to the more typical one, examples beyond `maxExamples` go from the least typical end, and
129
- the floor (`minExamples`) keeps the concept grounded. Relations are de-duplicated, dangling
130
- targets are dropped when a resolver is supplied, and the extension is de-duplicated. The
131
- definition, intension, counterexamples and `grounded_in` are never trimmed, and a view never
132
- bumps `version`.
133
- - `compactConceptHistory()` keeps the head plus `keepVersions` and commits the rest into a
134
- `concept-checkpoint`. It refuses a broken version lineage or a window that covers every
135
- version. Invariants C-1 to C-4 are documented in `docs/compaction.md` §6.
136
- - `concept-compaction.schema.json`, two worked examples, and `tools/concept-check.ts`
137
- (14 assertions) wired into `npm run verify`.
138
- - `src/structure/priority.ts`: a stable `PriorityQueue` over a comparison heap, an
139
- `IndexedPriorityQueue` that re-prioritises and deletes by key in O(log n), a `BucketQueue`
140
- for integer priorities with one FIFO bucket per priority, and `TopK` for bounded
141
- selection. `tools/priority-check.ts` runs 27 cases, including randomised differential
142
- checks against stable-sort models, as `npm run priority-check` and inside `npm run verify`.
143
-
144
- ### Changed
145
-
146
- - Counts moved with the new layer: schemas 14 → 16, validated example objects 33 → 37,
147
- verification entries 29 → 31, TypeScript scripts under `tools/` 38 → 40.
148
- - All 38 scripts under `tools/` migrated from JavaScript to TypeScript. They run directly
149
- under Node's type stripping and are covered by `tsconfig.tools.json`; no `.mjs` file
150
- remains.
151
- - `npm run verify` now runs both type checks — `tsc --noEmit` for `src/` and
152
- `tsc -p tsconfig.tools.json` for `tools/` — so a type error in the tests fails the suite.
153
- - Test fixtures declare the protocol types they build (`Claim`, `EvidenceItem`,
154
- `Hypothesis`, `Candidate`, `MergeClaim`, `TeamManifest`, `AttentionRequest` and an
155
- unsigned `Manifest`) instead of widening string literals.
156
- - HTTP suites use the shared `listen()` and `portOf()` helpers rather than untyped calls
157
- to `server.address()`.
158
- - Documentation, the script paths in `package.json` and the README were updated for the
159
- rename.
160
- - Licence changed from `UNLICENSED` to Apache-2.0. A verbatim copy of the licence is at the
161
- repository root, `package.json` and `package-lock.json` declare `Apache-2.0`, and both
162
- READMEs state the grant and the conditions a redistribution has to meet.
163
- - Attribution: a `NOTICE` file records the copyright holder (Eloy Kim, 2026) and must be
164
- kept by redistributions, `package.json` names the author, and both READMEs link the
165
- licence and the notices.
166
-
167
- ### Fixed
168
-
169
- - The audit gate was unsatisfiable: `audit.behavior` and `audit.budget` had no approving
170
- department. Legal now owns `audit.behavior` and finance owns `audit.budget`, so the audit
171
- phase can advance to escalation or archive.
172
- - `src/bayes/calibration.ts` left unused `item` parameters in the `filter` callbacks of the
173
- cross-validation split, which made `tsc --noEmit` fail; the parameters were renamed with no
174
- behavioural change.
175
- - `package.json` had a corrupted UTF-8 fragment in `description` (`T0閳ユ彑4`), now `T0-T4`; the
176
- `demo` script pointed at the long-deleted `src/cycle/demo.ts` and was removed, with the
177
- README pointing at the runnable governance checks instead.
178
- - `a2a-check` compared the digest of a runtime `Delegation` with the digest of the same
179
- object passed where a `DelegationDoc` was expected, so both sides hashed the camelCase
180
- object and the assertion could never fail. It now converts with `toDelegationDoc()` and
181
- compares the digest of the document with the digest of the document.
182
- - `persistence-check` spread a hash-chain payload typed `unknown`; the payload is now
183
- narrowed explicitly at the test boundary.
184
- - `sign-check` imported a type in the middle of a multi-line import statement after the
185
- automated rewrite; the import order is now correct.
186
-
187
- ## [0.1.0] - 2026-10-24
188
-
189
- First public reference implementation.
190
-
191
- ### Added
192
-
193
- #### Protocol and types
194
-
195
- - 14 JSON Schemas under `docs/schemas/`, with TypeScript types in one-to-one
196
- correspondence.
197
- - A message envelope and seven speech acts: `attend`, `plan`, `act`, `ask`, `note`,
198
- `reflect` and `read`.
199
- - Twelve invariants: W-1 to W-5 (warrant), A-1 to A-5 (attention), M-1 (manifest) and
200
- X-1 (log).
201
-
202
- #### Attention
203
-
204
- - A salience contract with a monotonicity rule, plus focus and ignore sets.
205
- - An immutable frame chain; `Frame.ignored` records exclusions with `reason` and
206
- `revisit_if`.
207
- - Impasse classification, and interrupt classes with attention debt.
208
- - Hard budget enforcement at the dispatcher: allocation may degrade to handles,
209
- pagination or refusal, but never truncates silently.
210
- - Handle-based overflow, so that large results stay addressable.
211
-
212
- #### Warrant
213
-
214
- - T0–T4 epistemic tiers, confidence derivation and tier validation.
215
- - Minimal revision with a `supersedes` chain.
216
- - Explicit unknowns and stopping rules, with preregistration and reproduction checks.
217
-
218
- #### Execution
219
-
220
- - An MCP 2026-07-28 client: stateless `_meta`, `server/discover`, `ttlMs` and `cacheScope`,
221
- HTTP binding headers, and a fallback to the legacy `initialize` handshake.
222
- - A budget dispatcher as the single metering point, with approval gating and TTL caching.
223
-
224
- #### Federation and trust
225
-
226
- - `ManifestBundle` and `Attestation`, digest pinning, revocation, and import that fails
227
- closed.
228
- - Agent Card discovery and JWS/EdDSA card signatures.
229
- - Bundle keys, endorsement and scope policy; an A2A `message/send` binding that surfaces
230
- JSON-RPC errors.
231
-
232
- #### Collaboration
233
-
234
- - Delegation with tier decay, ten invariants, lease fencing and depth limits.
235
- - A task board, result merging with contested-value handling, and authority adjudication.
236
- - A unified ledger, metrics (duplicate-task rate, alignment-token share, cost per success
237
- and contested rate) and an end-to-end session.
238
-
239
- #### Persistence and sharing
240
-
241
- - An append-only hash chain over events, frames, receipts, claims, hypotheses, unknowns,
242
- goals and plans.
243
- - Snapshot verification by count, tip, hash and chain order; restore refuses a broken
244
- snapshot.
245
- - Three sharing granularities.
246
-
247
- #### Documentation and tooling
248
-
249
- - `docs/architecture.md`: the normative specification.
250
- - `docs/rationale.md`: twelve ADRs, each with its evidence, its cost and the options that
251
- were rejected.
252
- - Multi-agent, trust-chain and federation documents, and nine research briefs.
253
- - 29 verification entries (166 counted assertions), 4 example generators and 5 endpoint
254
- probes, plus 33 example objects validated against the schemas.
255
-
256
- ### Security
257
-
258
- - Budgets are enforced at one point, in response to the class of failure represented by
259
- CVE-2026-114386, where nested tool calls bypassed a per-run quota.
260
- - External content cannot raise its own salience; promotion requires a trusted signal.
261
- - Delegation, federation import and channel operations fail closed, each recording a
262
- reason.
263
-
264
- ### Known limitations
265
-
266
- - Sandbox isolation, multi-tenancy and interactive OAuth authorisation are not implemented.
267
- - Cross-domain tests run locally; interoperability with external agents has not been
268
- demonstrated.
269
- - The specification and the research briefs are written in Simplified Chinese.
69
+ ### Added
70
+
71
+ - The attention-governance layer (`src/governance/`). It implements the nine constructs of the
72
+ Attention Manifest Protocol description: the scenario × mode matrix (all tables from
73
+ 9.1–9.8), the perspective registry, signed attention manifests, the three-layer context,
74
+ triple-signed switch credentials, the Bayesian control layer, the legal behaviour layer
75
+ (freeze, downgrade, breaker), the three-ledger budget and the seven-phase approval
76
+ workflow. It reconciles the description's T1/T2/T3 strictness order with AMP's existing
77
+ T0–T4 strength order (`F1→T3`, `F2→T2`, `F3→T1`) and keeps explicit bridges from the eight
78
+ legacy scenarios to the five canonical ones and from `inspire` to `diverge`.
79
+ - `docs/governance.md`, `governance.schema.json` (manifest and credential) and two validatable
80
+ examples (`attention-manifest.json`, `switch-credential.json`).
81
+ - `tools/governance-check.ts` (19 assertions) and `tools/governed-task-check.ts` (5
82
+ assertions), both wired into `npm run verify`.
83
+ - `src/runtime/governedTask.ts`: manifest verification, credential validation, legal audit,
84
+ ledger charge, board receipt and control decision wrapped around `CognitiveRuntime`.
85
+ Refusal paths return before the model call. A live `deepseek-chat` governed turn has been
86
+ run end to end.
87
+ - Agent budget ledgers and `reallocate()`: budgets now support `scope: "agent"`; a sub-agent's
88
+ quota is transferred from its parent with the total conserved. Negative/NaN/Infinity amounts
89
+ are rejected, reserve charges require finance approval, and a draw above 50% also needs the board.
90
+ - Perspective-switch orchestration (`src/governance/switching.ts`): peer switch, downgrade,
91
+ mode switch, scenario re-derivation and the escalation plan. A scenario switch calls
92
+ `rederiveAttentionManifest()`, increments the version and records the parent digest.
93
+ - Multi-agent cooperation (`src/governance/cooperation.ts`): structured messages (manifest
94
+ summary, refs, credential, receipt), receiver-side credential verification, an independent
95
+ supervisory audit path, and communication pruning by reliability × information value.
96
+ - Multi-agent transport seam (`src/governance/transport.ts`): `LoopbackTransport`,
97
+ `HttpCooperationTransport` and `createCooperationHandler()`. The receiver always re-runs the
98
+ digest/manifest/credential/receipt checks; malformed envelopes are 400, policy rejections 422
99
+ and success 200. `cooperation-check` is now 13 checks.
100
+ - Governance audit chain (`src/governance/audit.ts`): manifests, credentials, receipts, charges,
101
+ legal orders, workflow transitions, switches and runtime turns can be appended to a hash-linked
102
+ append-only log; `verify()` detects edits, reordering and truncation, and `open({ sink })`
103
+ verifies the whole chain on reopen. `GovernedTask` accepts an `audit` and appends a
104
+ `runtime.turn` record after settlement.
105
+ - `tools/audit-check.ts` (2 checks) covers cross-object records, reopen, tampering and corruption;
106
+ wired into `npm run verify`.
107
+ - `tools/cooperation-check.ts` (13 checks) wired into `npm run verify`; `governance-check` is
108
+ now 21 checks, including regressions for forged signatures, negative amounts, freeze
109
+ revocation, the archive gate, control NaN, unknown effects and private-context leakage.
110
+ - `tools/live-governance-eval.ts` (`npm run governance-live`) with DeepSeek quality, token and
111
+ boundary evaluation. Quality uses a deterministic rubric plus a strict judge; tokens record
112
+ input/output/cache/cost, ledger charge and cap; boundaries cover crisis escalation, expired
113
+ manifest, stale credential, legal freeze, budget exhaustion, prompt-injection leakage and
114
+ multi-agent scope/size limits. The report lands in `docs/probes/governance-live.json`; the
115
+ key is read from the environment only. First run: 6/6 rubric, judge 4.83/5, matched token
116
+ delta +3.8%, boundaries 9/9.
117
+ - `GovernedTask` now maps the manifest's scenario and modes into the runtime's
118
+ scenario/interaction budgets, injects the manifest summary, evidence floor and forbidden
119
+ behaviours as a `systemNote`, charges the manifest's `perspective`/`agent` ledger, and checks
120
+ for a frozen ledger before generation.
121
+ - Construction boundary (`src/boundary/`). `frameFrom()` validates the id grammar, reference
122
+ closure, the 9-slot ceiling, the exclusion cap (default 50, overflow returned as `deferred`)
123
+ and budget consistency before a frame exists; `parseToolCall()` validates arguments against a
124
+ JSON Schema subset and returns a digest of exactly what was accepted; `RefTable` gives `tool`
125
+ and `capability` one namespace and resolves `self`. 19 assertions run as
126
+ `npm run boundary-check` and inside `npm run verify`.
127
+ - `ExecProfile` parses call arguments through `parseToolCall()` before policy evaluation and
128
+ dispatch. A rejected argument set records a blocked receipt and never reaches a server;
129
+ approvals bind to the parsed digest.
130
+ - Context economy. `planPrune()` builds an explicit view of a verified ledger: superseded
131
+ claims, closed hypotheses and resolved non-blocking unknowns leave it, every omission
132
+ carries a `reason` and a `revisit_if`, and citations are closed over so that nothing
133
+ dangles. `supersedes` is deliberately not treated as a dependency.
134
+ - `compactLedger()` replaces a cold prefix with a checkpoint that commits to the digest of
135
+ the removed entries. `verifyCompaction()` re-derives that commitment and checks that the
136
+ tail continues the same chain. Compaction refuses to bury an entry the retained tail still
137
+ cites, and raises `CompactionRefused` with the pinned references.
138
+ - `compaction.schema.json` covering checkpoints and prune plans, two worked examples
139
+ (`checkpoint.json`, `prune-plan.json`), and `docs/compaction.md` with invariants P-1 to P-7.
140
+ - `tools/compaction-check.ts` with 15 assertions, wired into `npm run verify`.
141
+ - Concept economy. `pruneConcept()` bounds one concept's content: duplicate examples collapse
142
+ to the more typical one, examples beyond `maxExamples` go from the least typical end, and
143
+ the floor (`minExamples`) keeps the concept grounded. Relations are de-duplicated, dangling
144
+ targets are dropped when a resolver is supplied, and the extension is de-duplicated. The
145
+ definition, intension, counterexamples and `grounded_in` are never trimmed, and a view never
146
+ bumps `version`.
147
+ - `compactConceptHistory()` keeps the head plus `keepVersions` and commits the rest into a
148
+ `concept-checkpoint`. It refuses a broken version lineage or a window that covers every
149
+ version. Invariants C-1 to C-4 are documented in `docs/compaction.md` §6.
150
+ - `concept-compaction.schema.json`, two worked examples, and `tools/concept-check.ts`
151
+ (14 assertions) wired into `npm run verify`.
152
+ - `src/structure/priority.ts`: a stable `PriorityQueue` over a comparison heap, an
153
+ `IndexedPriorityQueue` that re-prioritises and deletes by key in O(log n), a `BucketQueue`
154
+ for integer priorities with one FIFO bucket per priority, and `TopK` for bounded
155
+ selection. `tools/priority-check.ts` runs 27 cases, including randomised differential
156
+ checks against stable-sort models, as `npm run priority-check` and inside `npm run verify`.
157
+
158
+ ### Changed
159
+
160
+ - Counts moved with the new layer: schemas 14 → 16, validated example objects 33 → 37,
161
+ verification entries 29 → 31, TypeScript scripts under `tools/` 38 → 40.
162
+ - All 38 scripts under `tools/` migrated from JavaScript to TypeScript. They run directly
163
+ under Node's type stripping and are covered by `tsconfig.tools.json`; no `.mjs` file
164
+ remains.
165
+ - `npm run verify` now runs both type checks — `tsc --noEmit` for `src/` and
166
+ `tsc -p tsconfig.tools.json` for `tools/` — so a type error in the tests fails the suite.
167
+ - Test fixtures declare the protocol types they build (`Claim`, `EvidenceItem`,
168
+ `Hypothesis`, `Candidate`, `MergeClaim`, `TeamManifest`, `AttentionRequest` and an
169
+ unsigned `Manifest`) instead of widening string literals.
170
+ - HTTP suites use the shared `listen()` and `portOf()` helpers rather than untyped calls
171
+ to `server.address()`.
172
+ - Documentation, the script paths in `package.json` and the README were updated for the
173
+ rename.
174
+ - Licence changed from `UNLICENSED` to Apache-2.0. A verbatim copy of the licence is at the
175
+ repository root, `package.json` and `package-lock.json` declare `Apache-2.0`, and both
176
+ READMEs state the grant and the conditions a redistribution has to meet.
177
+ - Attribution: a `NOTICE` file records the copyright holder (Eloy Kim, 2026) and must be
178
+ kept by redistributions, `package.json` names the author, and both READMEs link the
179
+ licence and the notices.
180
+
181
+ ### Fixed
182
+
183
+ - The audit gate was unsatisfiable: `audit.behavior` and `audit.budget` had no approving
184
+ department. Legal now owns `audit.behavior` and finance owns `audit.budget`, so the audit
185
+ phase can advance to escalation or archive.
186
+ - `src/bayes/calibration.ts` left unused `item` parameters in the `filter` callbacks of the
187
+ cross-validation split, which made `tsc --noEmit` fail; the parameters were renamed with no
188
+ behavioural change.
189
+ - `package.json` had a corrupted UTF-8 fragment in `description` (`T0閳ユ彑4`), now `T0-T4`; the
190
+ `demo` script pointed at the long-deleted `src/cycle/demo.ts` and was removed, with the
191
+ README pointing at the runnable governance checks instead.
192
+ - `a2a-check` compared the digest of a runtime `Delegation` with the digest of the same
193
+ object passed where a `DelegationDoc` was expected, so both sides hashed the camelCase
194
+ object and the assertion could never fail. It now converts with `toDelegationDoc()` and
195
+ compares the digest of the document with the digest of the document.
196
+ - `persistence-check` spread a hash-chain payload typed `unknown`; the payload is now
197
+ narrowed explicitly at the test boundary.
198
+ - `sign-check` imported a type in the middle of a multi-line import statement after the
199
+ automated rewrite; the import order is now correct.
200
+
201
+ ## [0.1.0] - 2026-10-24
202
+
203
+ First public reference implementation.
204
+
205
+ ### Added
206
+
207
+ #### Protocol and types
208
+
209
+ - 14 JSON Schemas under `docs/schemas/`, with TypeScript types in one-to-one
210
+ correspondence.
211
+ - A message envelope and seven speech acts: `attend`, `plan`, `act`, `ask`, `note`,
212
+ `reflect` and `read`.
213
+ - Twelve invariants: W-1 to W-5 (warrant), A-1 to A-5 (attention), M-1 (manifest) and
214
+ X-1 (log).
215
+
216
+ #### Attention
217
+
218
+ - A salience contract with a monotonicity rule, plus focus and ignore sets.
219
+ - An immutable frame chain; `Frame.ignored` records exclusions with `reason` and
220
+ `revisit_if`.
221
+ - Impasse classification, and interrupt classes with attention debt.
222
+ - Hard budget enforcement at the dispatcher: allocation may degrade to handles,
223
+ pagination or refusal, but never truncates silently.
224
+ - Handle-based overflow, so that large results stay addressable.
225
+
226
+ #### Warrant
227
+
228
+ - T0–T4 epistemic tiers, confidence derivation and tier validation.
229
+ - Minimal revision with a `supersedes` chain.
230
+ - Explicit unknowns and stopping rules, with preregistration and reproduction checks.
231
+
232
+ #### Execution
233
+
234
+ - An MCP 2026-07-28 client: stateless `_meta`, `server/discover`, `ttlMs` and `cacheScope`,
235
+ HTTP binding headers, and a fallback to the legacy `initialize` handshake.
236
+ - A budget dispatcher as the single metering point, with approval gating and TTL caching.
237
+
238
+ #### Federation and trust
239
+
240
+ - `ManifestBundle` and `Attestation`, digest pinning, revocation, and import that fails
241
+ closed.
242
+ - Agent Card discovery and JWS/EdDSA card signatures.
243
+ - Bundle keys, endorsement and scope policy; an A2A `message/send` binding that surfaces
244
+ JSON-RPC errors.
245
+
246
+ #### Collaboration
247
+
248
+ - Delegation with tier decay, ten invariants, lease fencing and depth limits.
249
+ - A task board, result merging with contested-value handling, and authority adjudication.
250
+ - A unified ledger, metrics (duplicate-task rate, alignment-token share, cost per success
251
+ and contested rate) and an end-to-end session.
252
+
253
+ #### Persistence and sharing
254
+
255
+ - An append-only hash chain over events, frames, receipts, claims, hypotheses, unknowns,
256
+ goals and plans.
257
+ - Snapshot verification by count, tip, hash and chain order; restore refuses a broken
258
+ snapshot.
259
+ - Three sharing granularities.
260
+
261
+ #### Documentation and tooling
262
+
263
+ - `docs/architecture.md`: the normative specification.
264
+ - `docs/rationale.md`: twelve ADRs, each with its evidence, its cost and the options that
265
+ were rejected.
266
+ - Multi-agent, trust-chain and federation documents, and nine research briefs.
267
+ - 29 verification entries (166 counted assertions), 4 example generators and 5 endpoint
268
+ probes, plus 33 example objects validated against the schemas.
269
+
270
+ ### Security
271
+
272
+ - Budgets are enforced at one point, in response to the class of failure represented by
273
+ CVE-2026-114386, where nested tool calls bypassed a per-run quota.
274
+ - External content cannot raise its own salience; promotion requires a trusted signal.
275
+ - Delegation, federation import and channel operations fail closed, each recording a
276
+ reason.
277
+
278
+ ### Known limitations
279
+
280
+ - Sandbox isolation, multi-tenancy and interactive OAuth authorisation are not implemented.
281
+ - Cross-domain tests run locally; interoperability with external agents has not been
282
+ demonstrated.
283
+ - The specification and the research briefs are written in Simplified Chinese.
@@ -5,49 +5,63 @@
5
5
  格式遵循 [Keep a Changelog](https://keepachangelog.com/zh-CN/1.1.0/),版本号遵循
6
6
  [语义化版本](https://semver.org/lang/zh-CN/)。
7
7
 
8
- ## [未发布]
8
+ ## [未发布]
9
9
 
10
10
  ### 变更
11
11
 
12
12
  - 将项目说明收敛到中英文 README;评测汇总只保留 JSON 格式。
13
-
14
- ## [0.4.0] - 2026-10-29
15
-
16
- 治理层 v0.4:持久化、轮换与真实 HTTP 互操作。
17
-
18
- ### 新增
19
-
20
- - 真实 HTTP 服务端(`src/governance/httpServer.ts`):localhost、方法/路径/体积限制,
21
- 配合 `HttpCooperationTransport` 端到端认证;`cooperation-http-check` 3 项。
22
- - 密钥轮换(`GovernanceKeyring.rotate/revokeKid/prune`):重叠窗口内旧签名继续有效,
23
- 旧 kid 可单独吊销;`signing-check` 增至 5 项。
24
- - 审计检查点(`checkpoint/verifyCheckpoint/entriesAfter`):留存分段可独立校验;
25
- `audit-check` 增至 4 项。
26
- - 治理对象持久化(`src/governance/store.ts`):清单/凭据/回执写入 JSONL 事件日志,
27
- 重开恢复最新状态;`governance-store-check` 1 项。
28
- - DeepSeek 配对样本扩到 20 组:质量 rubric 20/20、judge 4.85/5、配对 token 增量 +6.9%、
29
- 成本约 $0.007547、边界 20/20。
30
-
31
- ## [0.3.0] - 2026-10-28
32
-
33
- 治理层 v0.3:Ed25519 签署、持久审计、认证传输与工具前门控。
34
-
35
- ### 新增
36
-
37
- - Ed25519 签署适配层(`src/governance/signing.ts`):`GovernanceSignatureBundle` 绑定
38
- signer/subject/id/version/digest,`GovernanceKeyring` 支持吊销;`signing-check` 4 项覆盖
39
- 防移植、缺签、重复签与吊销。
40
- - 审计持久化:`src/storage/fileAppendSink.ts` 提供 JSONL 文件 sink;`audit-check` 新增
41
- 跨进程重开与磁盘篡改拒绝(共 3 项)。
42
- - HTTP 传输认证:Ed25519 签名、时间窗与 nonce 重放防护;`cooperation-check` 增至 14 项。
43
- - 工具前置门控(`src/governance/toolPolicy.ts`):`GovernedToolPolicy` 在工具执行前检查
44
- 高风险审批、冻结/熔断与证据下限;`tool-gate-check` 4 项。
45
- - DeepSeek 评测扩到 20 个质量用例与 20 个边界用例:rubric 20/20、judge 4.85/5、
46
- 配对 token 增量 +6.2%、成本约 $0.004095;报告见 `docs/probes/governance-live.json`。
47
- \n## [0.2.0] - 2026-10-28
48
-
49
- 治理层 v0.2:可审计、可传输、可度量,校验链全绿。
50
-
13
+
14
+ ## [0.4.1] - 2026-10-29
15
+
16
+ 发布库构建:包现在提供可直接导入的 ESM 与类型声明。
17
+
18
+ ### 新增
19
+
20
+ - `npm run build:lib` 将 ESM 与声明文件输出到 `lib/`;`prepublishOnly` 会在每次发布前重新构建。
21
+ - `exports` 映射包根入口(`lib/index.js`)、各模块子路径、深层模块文件与 `schemas/*`;`main`、`types` 与 `types` 条件同时覆盖 `nodenext` 与 bundler 解析。
22
+ - 为 `src/` 下其余目录补齐模块 barrel,使每个模块都有唯一导入路径。
23
+
24
+ ### 修复
25
+
26
+ - 声明文件改用 JavaScript 扩展名。`tsc` 只会为 `.js` 输出重写相对 `.ts` 导入,因此由 `tools/rewrite-declaration-extensions.ts` 重写 `.d.ts`,若仍残留 TypeScript 扩展名则构建失败。
27
+
28
+ ## [0.4.0] - 2026-10-29
29
+
30
+ 治理层 v0.4:持久化、轮换与真实 HTTP 互操作。
31
+
32
+ ### 新增
33
+
34
+ - 真实 HTTP 服务端(`src/governance/httpServer.ts`):localhost、方法/路径/体积限制,
35
+ 配合 `HttpCooperationTransport` 端到端认证;`cooperation-http-check` 3 项。
36
+ - 密钥轮换(`GovernanceKeyring.rotate/revokeKid/prune`):重叠窗口内旧签名继续有效,
37
+ 旧 kid 可单独吊销;`signing-check` 增至 5 项。
38
+ - 审计检查点(`checkpoint/verifyCheckpoint/entriesAfter`):留存分段可独立校验;
39
+ `audit-check` 增至 4 项。
40
+ - 治理对象持久化(`src/governance/store.ts`):清单/凭据/回执写入 JSONL 事件日志,
41
+ 重开恢复最新状态;`governance-store-check` 1 项。
42
+ - DeepSeek 配对样本扩到 20 组:质量 rubric 20/20、judge 4.85/5、配对 token 增量 +6.9%、
43
+ 成本约 $0.007547、边界 20/20。
44
+
45
+ ## [0.3.0] - 2026-10-28
46
+
47
+ 治理层 v0.3:Ed25519 签署、持久审计、认证传输与工具前门控。
48
+
49
+ ### 新增
50
+
51
+ - Ed25519 签署适配层(`src/governance/signing.ts`):`GovernanceSignatureBundle` 绑定
52
+ signer/subject/id/version/digest,`GovernanceKeyring` 支持吊销;`signing-check` 4 项覆盖
53
+ 防移植、缺签、重复签与吊销。
54
+ - 审计持久化:`src/storage/fileAppendSink.ts` 提供 JSONL 文件 sink;`audit-check` 新增
55
+ 跨进程重开与磁盘篡改拒绝(共 3 项)。
56
+ - HTTP 传输认证:Ed25519 签名、时间窗与 nonce 重放防护;`cooperation-check` 增至 14 项。
57
+ - 工具前置门控(`src/governance/toolPolicy.ts`):`GovernedToolPolicy` 在工具执行前检查
58
+ 高风险审批、冻结/熔断与证据下限;`tool-gate-check` 4 项。
59
+ - DeepSeek 评测扩到 20 个质量用例与 20 个边界用例:rubric 20/20、judge 4.85/5、
60
+ 配对 token 增量 +6.2%、成本约 $0.004095;报告见 `docs/probes/governance-live.json`。
61
+ \n## [0.2.0] - 2026-10-28
62
+
63
+ 治理层 v0.2:可审计、可传输、可度量,校验链全绿。
64
+
51
65
  ### 新增
52
66
 
53
67
  - 注意力治理层(`src/governance/`)。按「Attention Manifest Protocol 完整说明」实现九个构件:
package/README.md CHANGED
@@ -43,6 +43,25 @@ npm run verify
43
43
  npm run scenario
44
44
  ```
45
45
 
46
+ ## Library usage
47
+
48
+ `npm install attention-manifest-protocol` ships the compiled ESM build in `lib/` with its declarations, alongside the source, JSON Schemas and executable checks. Node.js 24 or later is required. The root entry exposes the documented protocol surfaces; every module is also reachable as a subpath.
49
+
50
+ ```js
51
+ import { generateSigningKey, signManifest, verifyManifest } from "attention-manifest-protocol";
52
+ import { Ledger } from "attention-manifest-protocol/ledger";
53
+ import { sha256Hex } from "attention-manifest-protocol/semantic/sha256.js";
54
+ ```
55
+
56
+ | Specifier | Resolves to |
57
+ | --- | --- |
58
+ | `attention-manifest-protocol` | `lib/index.js`: attention, context, frame, ledger, manifest, receipt and warrant |
59
+ | `attention-manifest-protocol/<module>` | `lib/<module>/index.js` for every module under `src/` |
60
+ | `attention-manifest-protocol/<module>/<file>.js` | one compiled module |
61
+ | `attention-manifest-protocol/schemas/<name>.json` | the JSON Schema from `docs/schemas/` |
62
+
63
+ `npm run build:lib` rebuilds `lib/` and `prepublishOnly` runs it before publishing. The build compiles only the library; the Vite demo entry (`src/main.ts`) is not part of it.
64
+
46
65
  Focused checks: `npm run workspace-agent-check`, `workspace-context-check`, `document-context-check`, `tex-context-check`, `governance-check`, `typecheck` and `typecheck:tools`. `verify` runs the full chain and both type checks. Evaluation inputs/reports remain in [docs/eval](docs/eval/) and [docs/probes](docs/probes/) as JSON; fixture and recorded-probe results are not independent human studies or production-quality evidence.
47
66
 
48
67
  ## Agent tools
package/README.zh-CN.md CHANGED
@@ -43,6 +43,25 @@ npm run verify
43
43
  npm run scenario
44
44
  ```
45
45
 
46
+ ## 作为库使用
47
+
48
+ `npm install attention-manifest-protocol` 会安装 `lib/` 中的编译产物及其声明文件,同时附带源码、JSON Schema 与可执行检查。运行时要求 Node.js 24 及以上。包根入口提供文档中的协议核心接口,其余模块均可按子路径导入。
49
+
50
+ ```js
51
+ import { generateSigningKey, signManifest, verifyManifest } from "attention-manifest-protocol";
52
+ import { Ledger } from "attention-manifest-protocol/ledger";
53
+ import { sha256Hex } from "attention-manifest-protocol/semantic/sha256.js";
54
+ ```
55
+
56
+ | 说明符 | 解析结果 |
57
+ | --- | --- |
58
+ | `attention-manifest-protocol` | `lib/index.js`:attention、context、frame、ledger、manifest、receipt、warrant |
59
+ | `attention-manifest-protocol/<module>` | `src/` 下每个模块对应 `lib/<module>/index.js` |
60
+ | `attention-manifest-protocol/<module>/<file>.js` | 单个编译后的模块 |
61
+ | `attention-manifest-protocol/schemas/<name>.json` | `docs/schemas/` 中的 JSON Schema |
62
+
63
+ `npm run build:lib` 重新构建 `lib/`,发布前由 `prepublishOnly` 自动执行。该构建只编译库代码,Vite 演示入口(`src/main.ts`)不在其中。
64
+
46
65
  专项检查为 `npm run workspace-agent-check`、`workspace-context-check`、`document-context-check`、`tex-context-check`、`governance-check`、`typecheck` 与 `typecheck:tools`。`verify` 执行完整验证链和两份类型检查。评测输入/结果以 JSON 保存在 [docs/eval](docs/eval/) 与 [docs/probes](docs/probes/),夹具与录制探针不等同于独立的人类研究或生产质量证明。
47
66
 
48
67
  ## Agent 工具