attention-manifest-protocol 0.4.0 → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +250 -226
- package/CHANGELOG.zh-CN.md +63 -39
- package/README.md +22 -1
- package/README.zh-CN.md +22 -1
- package/docs/probes/calibration-imported.json +141 -141
- package/docs/probes/eval-recorded-replay.json +597 -597
- package/docs/probes/eval-replay.json +124 -124
- package/docs/probes/eval-summary.json +42 -42
- package/docs/probes/runtime-eval.json +4230 -4230
- package/lib/attention/attention.d.ts +153 -0
- package/lib/attention/attention.js +209 -0
- package/lib/attention/budget.d.ts +31 -0
- package/lib/attention/budget.js +55 -0
- package/lib/attention/cognition.d.ts +230 -0
- package/lib/attention/cognition.js +245 -0
- package/lib/attention/index.d.ts +8 -0
- package/lib/attention/index.js +7 -0
- package/lib/attention/interrupts.d.ts +97 -0
- package/lib/attention/interrupts.js +151 -0
- package/lib/attention/resource.d.ts +167 -0
- package/lib/attention/resource.js +148 -0
- package/lib/attention/social.d.ts +74 -0
- package/lib/attention/social.js +153 -0
- package/lib/attention/socialTypes.d.ts +102 -0
- package/lib/attention/socialTypes.js +1 -0
- package/lib/authz/authz.d.ts +75 -0
- package/lib/authz/authz.js +176 -0
- package/lib/authz/index.d.ts +1 -0
- package/lib/authz/index.js +1 -0
- package/lib/bayes/calibration.d.ts +67 -0
- package/lib/bayes/calibration.js +114 -0
- package/lib/bayes/calibrationRegistry.d.ts +39 -0
- package/lib/bayes/calibrationRegistry.js +61 -0
- package/lib/bayes/calibrationSelection.d.ts +40 -0
- package/lib/bayes/calibrationSelection.js +89 -0
- package/lib/bayes/engine.d.ts +163 -0
- package/lib/bayes/engine.js +354 -0
- package/lib/bayes/index.d.ts +6 -0
- package/lib/bayes/index.js +6 -0
- package/lib/bayes/reliability.d.ts +27 -0
- package/lib/bayes/reliability.js +38 -0
- package/lib/bayes/scopedPriors.d.ts +34 -0
- package/lib/bayes/scopedPriors.js +70 -0
- package/lib/boundary/frame.d.ts +63 -0
- package/lib/boundary/frame.js +239 -0
- package/lib/boundary/ids.d.ts +8 -0
- package/lib/boundary/ids.js +12 -0
- package/lib/boundary/index.d.ts +12 -0
- package/lib/boundary/index.js +8 -0
- package/lib/boundary/refTable.d.ts +49 -0
- package/lib/boundary/refTable.js +92 -0
- package/lib/boundary/toolCall.d.ts +33 -0
- package/lib/boundary/toolCall.js +173 -0
- package/lib/concept/concept.d.ts +67 -0
- package/lib/concept/concept.js +1 -0
- package/lib/concept/conceptBudget.d.ts +56 -0
- package/lib/concept/conceptBudget.js +281 -0
- package/lib/concept/conceptBudgetTypes.d.ts +74 -0
- package/lib/concept/conceptBudgetTypes.js +1 -0
- package/lib/concept/index.d.ts +3 -0
- package/lib/concept/index.js +3 -0
- package/lib/concurrency/idempotency.d.ts +16 -0
- package/lib/concurrency/idempotency.js +21 -0
- package/lib/concurrency/index.d.ts +5 -0
- package/lib/concurrency/index.js +5 -0
- package/lib/concurrency/mutex.d.ts +13 -0
- package/lib/concurrency/mutex.js +26 -0
- package/lib/concurrency/namedLocks.d.ts +7 -0
- package/lib/concurrency/namedLocks.js +31 -0
- package/lib/concurrency/retry.d.ts +23 -0
- package/lib/concurrency/retry.js +38 -0
- package/lib/concurrency/worker.d.ts +42 -0
- package/lib/concurrency/worker.js +67 -0
- package/lib/context/agentContext.d.ts +58 -0
- package/lib/context/agentContext.js +197 -0
- package/lib/context/ast.d.ts +98 -0
- package/lib/context/ast.js +414 -0
- package/lib/context/contentStore.d.ts +16 -0
- package/lib/context/contentStore.js +61 -0
- package/lib/context/context.d.ts +15 -0
- package/lib/context/context.js +39 -0
- package/lib/context/contextIndex.d.ts +40 -0
- package/lib/context/contextIndex.js +64 -0
- package/lib/context/document.d.ts +102 -0
- package/lib/context/document.js +22 -0
- package/lib/context/fileStorePath.d.ts +1 -0
- package/lib/context/fileStorePath.js +13 -0
- package/lib/context/index.d.ts +22 -0
- package/lib/context/index.js +11 -0
- package/lib/context/lifecycle.d.ts +91 -0
- package/lib/context/lifecycle.js +163 -0
- package/lib/context/projections.d.ts +20 -0
- package/lib/context/projections.js +127 -0
- package/lib/context/workspace.d.ts +111 -0
- package/lib/context/workspace.js +318 -0
- package/lib/context/workspaceProtocol.d.ts +30 -0
- package/lib/context/workspaceProtocol.js +49 -0
- package/lib/context/workspaceService.d.ts +63 -0
- package/lib/context/workspaceService.js +352 -0
- package/lib/cooperation/board.d.ts +47 -0
- package/lib/cooperation/board.js +66 -0
- package/lib/cooperation/collaboration.d.ts +55 -0
- package/lib/cooperation/collaboration.js +1 -0
- package/lib/cooperation/index.d.ts +6 -0
- package/lib/cooperation/index.js +6 -0
- package/lib/cooperation/merge.d.ts +69 -0
- package/lib/cooperation/merge.js +109 -0
- package/lib/cooperation/metrics.d.ts +39 -0
- package/lib/cooperation/metrics.js +17 -0
- package/lib/cooperation/session.d.ts +75 -0
- package/lib/cooperation/session.js +74 -0
- package/lib/cooperation/unified.d.ts +38 -0
- package/lib/cooperation/unified.js +40 -0
- package/lib/database/adapter/adapters.d.ts +24 -0
- package/lib/database/adapter/adapters.js +31 -0
- package/lib/database/adapter/index.d.ts +4 -0
- package/lib/database/adapter/index.js +4 -0
- package/lib/database/adapter/runtimeSink.d.ts +20 -0
- package/lib/database/adapter/runtimeSink.js +50 -0
- package/lib/database/adapter/sessionStore.d.ts +11 -0
- package/lib/database/adapter/sessionStore.js +23 -0
- package/lib/database/adapter/turnStore.d.ts +10 -0
- package/lib/database/adapter/turnStore.js +15 -0
- package/lib/database/entity/agent.d.ts +133 -0
- package/lib/database/entity/agent.js +61 -0
- package/lib/database/entity/entity.d.ts +715 -0
- package/lib/database/entity/entity.js +372 -0
- package/lib/database/entity/handle.d.ts +31 -0
- package/lib/database/entity/handle.js +53 -0
- package/lib/database/entity/index.d.ts +32 -0
- package/lib/database/entity/index.js +22 -0
- package/lib/database/entity/message.d.ts +27 -0
- package/lib/database/entity/message.js +52 -0
- package/lib/database/entity/meta.d.ts +11 -0
- package/lib/database/entity/meta.js +1 -0
- package/lib/database/entity/object.d.ts +23 -0
- package/lib/database/entity/object.js +24 -0
- package/lib/database/entity/outbox.d.ts +9 -0
- package/lib/database/entity/outbox.js +5 -0
- package/lib/database/entity/process.d.ts +30 -0
- package/lib/database/entity/process.js +40 -0
- package/lib/database/entity/registry.d.ts +81 -0
- package/lib/database/entity/registry.js +91 -0
- package/lib/database/entity/runtimeApproval.d.ts +23 -0
- package/lib/database/entity/runtimeApproval.js +5 -0
- package/lib/database/entity/runtimeSession.d.ts +7 -0
- package/lib/database/entity/runtimeSession.js +5 -0
- package/lib/database/entity/runtimeTurn.d.ts +9 -0
- package/lib/database/entity/runtimeTurn.js +5 -0
- package/lib/database/entity/thread.d.ts +35 -0
- package/lib/database/entity/thread.js +55 -0
- package/lib/database/entity/window.d.ts +39 -0
- package/lib/database/entity/window.js +56 -0
- package/lib/database/entity/worker.d.ts +42 -0
- package/lib/database/entity/worker.js +58 -0
- package/lib/database/index.d.ts +6 -0
- package/lib/database/index.js +6 -0
- package/lib/database/repository/addressSpaceRepository.d.ts +18 -0
- package/lib/database/repository/addressSpaceRepository.js +40 -0
- package/lib/database/repository/agentRepository.d.ts +41 -0
- package/lib/database/repository/agentRepository.js +398 -0
- package/lib/database/repository/base.d.ts +31 -0
- package/lib/database/repository/base.js +23 -0
- package/lib/database/repository/executionRepository.d.ts +64 -0
- package/lib/database/repository/executionRepository.js +379 -0
- package/lib/database/repository/handleRepository.d.ts +35 -0
- package/lib/database/repository/handleRepository.js +57 -0
- package/lib/database/repository/index.d.ts +20 -0
- package/lib/database/repository/index.js +17 -0
- package/lib/database/repository/messageRepository.d.ts +33 -0
- package/lib/database/repository/messageRepository.js +45 -0
- package/lib/database/repository/objectRepository.d.ts +43 -0
- package/lib/database/repository/objectRepository.js +60 -0
- package/lib/database/repository/outboxRepository.d.ts +15 -0
- package/lib/database/repository/outboxRepository.js +51 -0
- package/lib/database/repository/processRepository.d.ts +31 -0
- package/lib/database/repository/processRepository.js +48 -0
- package/lib/database/repository/registryRepository.d.ts +72 -0
- package/lib/database/repository/registryRepository.js +95 -0
- package/lib/database/repository/repository.d.ts +322 -0
- package/lib/database/repository/repository.js +332 -0
- package/lib/database/repository/runtimeApprovalRepository.d.ts +14 -0
- package/lib/database/repository/runtimeApprovalRepository.js +35 -0
- package/lib/database/repository/runtimeSessionRepository.d.ts +9 -0
- package/lib/database/repository/runtimeSessionRepository.js +21 -0
- package/lib/database/repository/runtimeTurnRepository.d.ts +10 -0
- package/lib/database/repository/runtimeTurnRepository.js +32 -0
- package/lib/database/repository/socialRepository.d.ts +22 -0
- package/lib/database/repository/socialRepository.js +155 -0
- package/lib/database/repository/threadRepository.d.ts +29 -0
- package/lib/database/repository/threadRepository.js +48 -0
- package/lib/database/repository/windowRepository.d.ts +46 -0
- package/lib/database/repository/windowRepository.js +68 -0
- package/lib/database/repository/workerRepository.d.ts +38 -0
- package/lib/database/repository/workerRepository.js +61 -0
- package/lib/database/service/database.d.ts +55 -0
- package/lib/database/service/database.js +77 -0
- package/lib/database/service/handleService.d.ts +20 -0
- package/lib/database/service/handleService.js +34 -0
- package/lib/database/service/index.d.ts +16 -0
- package/lib/database/service/index.js +11 -0
- package/lib/database/service/messageService.d.ts +26 -0
- package/lib/database/service/messageService.js +40 -0
- package/lib/database/service/objectService.d.ts +32 -0
- package/lib/database/service/objectService.js +31 -0
- package/lib/database/service/processService.d.ts +22 -0
- package/lib/database/service/processService.js +45 -0
- package/lib/database/service/registryServices.d.ts +43 -0
- package/lib/database/service/registryServices.js +60 -0
- package/lib/database/service/service.d.ts +131 -0
- package/lib/database/service/service.js +153 -0
- package/lib/database/service/stepService.d.ts +23 -0
- package/lib/database/service/stepService.js +35 -0
- package/lib/database/service/threadService.d.ts +23 -0
- package/lib/database/service/threadService.js +48 -0
- package/lib/database/service/windowService.d.ts +15 -0
- package/lib/database/service/windowService.js +22 -0
- package/lib/database/service/workerService.d.ts +28 -0
- package/lib/database/service/workerService.js +34 -0
- package/lib/database/sql/index.d.ts +3 -0
- package/lib/database/sql/index.js +2 -0
- package/lib/database/sql/schema.d.ts +5 -0
- package/lib/database/sql/schema.js +416 -0
- package/lib/database/sql/sql.d.ts +290 -0
- package/lib/database/sql/sql.js +430 -0
- package/lib/database/store/database.d.ts +75 -0
- package/lib/database/store/database.js +143 -0
- package/lib/database/store/index.d.ts +3 -0
- package/lib/database/store/index.js +2 -0
- package/lib/database/store/store.d.ts +145 -0
- package/lib/database/store/store.js +192 -0
- package/lib/delegate/index.d.ts +2 -0
- package/lib/delegate/index.js +2 -0
- package/lib/delegate/team.d.ts +92 -0
- package/lib/delegate/team.js +200 -0
- package/lib/delegate/teamTypes.d.ts +43 -0
- package/lib/delegate/teamTypes.js +1 -0
- package/lib/diagnosis/checklist.d.ts +16 -0
- package/lib/diagnosis/checklist.js +61 -0
- package/lib/diagnosis/context.d.ts +19 -0
- package/lib/diagnosis/context.js +79 -0
- package/lib/diagnosis/frame.d.ts +34 -0
- package/lib/diagnosis/frame.js +230 -0
- package/lib/diagnosis/index.d.ts +5 -0
- package/lib/diagnosis/index.js +5 -0
- package/lib/diagnosis/router.d.ts +22 -0
- package/lib/diagnosis/router.js +47 -0
- package/lib/diagnosis/types.d.ts +78 -0
- package/lib/diagnosis/types.js +2 -0
- package/lib/error/agentError.d.ts +9 -0
- package/lib/error/agentError.js +13 -0
- package/lib/error/ampError.d.ts +14 -0
- package/lib/error/ampError.js +19 -0
- package/lib/error/authzError.d.ts +10 -0
- package/lib/error/authzError.js +11 -0
- package/lib/error/boundaryRejection.d.ts +16 -0
- package/lib/error/boundaryRejection.js +14 -0
- package/lib/error/index.d.ts +7 -0
- package/lib/error/index.js +7 -0
- package/lib/error/kernelError.d.ts +11 -0
- package/lib/error/kernelError.js +12 -0
- package/lib/error/mailboxError.d.ts +5 -0
- package/lib/error/mailboxError.js +6 -0
- package/lib/error/windowError.d.ts +8 -0
- package/lib/error/windowError.js +9 -0
- package/lib/evaluation/agreement.d.ts +22 -0
- package/lib/evaluation/agreement.js +82 -0
- package/lib/evaluation/index.d.ts +2 -0
- package/lib/evaluation/index.js +2 -0
- package/lib/evaluation/labels.d.ts +56 -0
- package/lib/evaluation/labels.js +206 -0
- package/lib/evidence/evidenceGraph.d.ts +37 -0
- package/lib/evidence/evidenceGraph.js +165 -0
- package/lib/evidence/index.d.ts +4 -0
- package/lib/evidence/index.js +2 -0
- package/lib/evidence/revalidation.d.ts +70 -0
- package/lib/evidence/revalidation.js +146 -0
- package/lib/execution/exec.d.ts +151 -0
- package/lib/execution/exec.js +282 -0
- package/lib/execution/handles.d.ts +25 -0
- package/lib/execution/handles.js +45 -0
- package/lib/execution/index.d.ts +3 -0
- package/lib/execution/index.js +3 -0
- package/lib/execution/pin.d.ts +60 -0
- package/lib/execution/pin.js +103 -0
- package/lib/frame/frame.d.ts +61 -0
- package/lib/frame/frame.js +1 -0
- package/lib/frame/index.d.ts +1 -0
- package/lib/frame/index.js +1 -0
- package/lib/goal/goal.d.ts +19 -0
- package/lib/goal/goal.js +21 -0
- package/lib/goal/index.d.ts +2 -0
- package/lib/goal/index.js +1 -0
- package/lib/goal/plan.d.ts +125 -0
- package/lib/goal/plan.js +60 -0
- package/lib/governance/attentionManifest.d.ts +279 -0
- package/lib/governance/attentionManifest.js +467 -0
- package/lib/governance/audit.d.ts +123 -0
- package/lib/governance/audit.js +263 -0
- package/lib/governance/budget.d.ts +219 -0
- package/lib/governance/budget.js +424 -0
- package/lib/governance/context.d.ts +159 -0
- package/lib/governance/context.js +229 -0
- package/lib/governance/control.d.ts +65 -0
- package/lib/governance/control.js +89 -0
- package/lib/governance/cooperation.d.ts +163 -0
- package/lib/governance/cooperation.js +350 -0
- package/lib/governance/credential.d.ts +117 -0
- package/lib/governance/credential.js +229 -0
- package/lib/governance/httpServer.d.ts +18 -0
- package/lib/governance/httpServer.js +74 -0
- package/lib/governance/index.d.ts +32 -0
- package/lib/governance/index.js +32 -0
- package/lib/governance/legal.d.ts +222 -0
- package/lib/governance/legal.js +371 -0
- package/lib/governance/matrix.d.ts +170 -0
- package/lib/governance/matrix.js +365 -0
- package/lib/governance/perspectives.d.ts +98 -0
- package/lib/governance/perspectives.js +340 -0
- package/lib/governance/signing.d.ts +131 -0
- package/lib/governance/signing.js +241 -0
- package/lib/governance/store.d.ts +33 -0
- package/lib/governance/store.js +89 -0
- package/lib/governance/switching.d.ts +183 -0
- package/lib/governance/switching.js +257 -0
- package/lib/governance/toolPolicy.d.ts +37 -0
- package/lib/governance/toolPolicy.js +42 -0
- package/lib/governance/transport.d.ts +76 -0
- package/lib/governance/transport.js +124 -0
- package/lib/governance/types.d.ts +218 -0
- package/lib/governance/types.js +72 -0
- package/lib/governance/workflow.d.ts +174 -0
- package/lib/governance/workflow.js +612 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +11 -0
- package/lib/interaction/index.d.ts +1 -0
- package/lib/interaction/index.js +1 -0
- package/lib/interaction/interaction.d.ts +83 -0
- package/lib/interaction/interaction.js +256 -0
- package/lib/ipc/index.d.ts +4 -0
- package/lib/ipc/index.js +3 -0
- package/lib/ipc/mailbox.d.ts +37 -0
- package/lib/ipc/mailbox.js +77 -0
- package/lib/ipc/memorySocialStore.d.ts +14 -0
- package/lib/ipc/memorySocialStore.js +83 -0
- package/lib/ipc/social.d.ts +80 -0
- package/lib/ipc/social.js +1 -0
- package/lib/kernel/index.d.ts +2 -0
- package/lib/kernel/index.js +1 -0
- package/lib/kernel/scheduler.d.ts +195 -0
- package/lib/kernel/scheduler.js +334 -0
- package/lib/ledger/checkpoint.d.ts +116 -0
- package/lib/ledger/checkpoint.js +223 -0
- package/lib/ledger/index.d.ts +4 -0
- package/lib/ledger/index.js +4 -0
- package/lib/ledger/ledger.d.ts +21 -0
- package/lib/ledger/ledger.js +23 -0
- package/lib/ledger/persistence.d.ts +46 -0
- package/lib/ledger/persistence.js +106 -0
- package/lib/ledger/share.d.ts +29 -0
- package/lib/ledger/share.js +39 -0
- package/lib/lock/index.d.ts +2 -0
- package/lib/lock/index.js +1 -0
- package/lib/lock/lease.d.ts +23 -0
- package/lib/lock/lease.js +42 -0
- package/lib/manifest/agentCard.d.ts +35 -0
- package/lib/manifest/agentCard.js +38 -0
- package/lib/manifest/cardSign.d.ts +25 -0
- package/lib/manifest/cardSign.js +70 -0
- package/lib/manifest/federation.d.ts +64 -0
- package/lib/manifest/federation.js +187 -0
- package/lib/manifest/federationTypes.d.ts +51 -0
- package/lib/manifest/federationTypes.js +1 -0
- package/lib/manifest/index.d.ts +8 -0
- package/lib/manifest/index.js +8 -0
- package/lib/manifest/keys.d.ts +221 -0
- package/lib/manifest/keys.js +484 -0
- package/lib/manifest/manifest.d.ts +102 -0
- package/lib/manifest/manifest.js +1 -0
- package/lib/manifest/sign.d.ts +38 -0
- package/lib/manifest/sign.js +90 -0
- package/lib/manifest/trust.d.ts +54 -0
- package/lib/manifest/trust.js +87 -0
- package/lib/mission/index.d.ts +2 -0
- package/lib/mission/index.js +1 -0
- package/lib/mission/missionQueue.d.ts +19 -0
- package/lib/mission/missionQueue.js +62 -0
- package/lib/module/index.d.ts +9 -0
- package/lib/module/index.js +9 -0
- package/lib/module/llm/deepseek.d.ts +43 -0
- package/lib/module/llm/deepseek.js +162 -0
- package/lib/module/llm/llm.d.ts +64 -0
- package/lib/module/llm/llm.js +16 -0
- package/lib/module/mcp/client.d.ts +32 -0
- package/lib/module/mcp/client.js +84 -0
- package/lib/module/mcp/http.d.ts +32 -0
- package/lib/module/mcp/http.js +83 -0
- package/lib/module/mcp/protocol.d.ts +62 -0
- package/lib/module/mcp/protocol.js +20 -0
- package/lib/module/mcp/server.d.ts +22 -0
- package/lib/module/mcp/server.js +138 -0
- package/lib/module/mcp/transport.d.ts +19 -0
- package/lib/module/mcp/transport.js +16 -0
- package/lib/module/mcp/workspaceServer.d.ts +20 -0
- package/lib/module/mcp/workspaceServer.js +90 -0
- package/lib/module/sandbox/sandbox.d.ts +24 -0
- package/lib/module/sandbox/sandbox.js +5 -0
- package/lib/module/tool/mcpExecutor.d.ts +18 -0
- package/lib/module/tool/mcpExecutor.js +41 -0
- package/lib/module/tool/policy.d.ts +30 -0
- package/lib/module/tool/policy.js +23 -0
- package/lib/module/tool/redact.d.ts +9 -0
- package/lib/module/tool/redact.js +19 -0
- package/lib/module/tool/tool.d.ts +26 -0
- package/lib/module/tool/tool.js +24 -0
- package/lib/module/tool/workspaceExecutor.d.ts +12 -0
- package/lib/module/tool/workspaceExecutor.js +25 -0
- package/lib/policy/guard.d.ts +115 -0
- package/lib/policy/guard.js +154 -0
- package/lib/policy/index.d.ts +2 -0
- package/lib/policy/index.js +2 -0
- package/lib/policy/policy.d.ts +249 -0
- package/lib/policy/policy.js +364 -0
- package/lib/process/agent.d.ts +295 -0
- package/lib/process/agent.js +1 -0
- package/lib/process/agentService.d.ts +87 -0
- package/lib/process/agentService.js +128 -0
- package/lib/process/agentStore.d.ts +35 -0
- package/lib/process/agentStore.js +328 -0
- package/lib/process/executionStore.d.ts +79 -0
- package/lib/process/executionStore.js +71 -0
- package/lib/process/index.d.ts +5 -0
- package/lib/process/index.js +5 -0
- package/lib/process/process.d.ts +120 -0
- package/lib/process/process.js +111 -0
- package/lib/process/transitions.d.ts +11 -0
- package/lib/process/transitions.js +8 -0
- package/lib/progress/index.d.ts +2 -0
- package/lib/progress/index.js +1 -0
- package/lib/progress/progress.d.ts +26 -0
- package/lib/progress/progress.js +42 -0
- package/lib/protocol/a2a.d.ts +51 -0
- package/lib/protocol/a2a.js +79 -0
- package/lib/protocol/channel.d.ts +25 -0
- package/lib/protocol/channel.js +27 -0
- package/lib/protocol/envelope.d.ts +180 -0
- package/lib/protocol/envelope.js +495 -0
- package/lib/protocol/httpChannel.d.ts +33 -0
- package/lib/protocol/httpChannel.js +59 -0
- package/lib/protocol/index.d.ts +6 -0
- package/lib/protocol/index.js +6 -0
- package/lib/protocol/protocol.d.ts +120 -0
- package/lib/protocol/protocol.js +1 -0
- package/lib/protocol/wire.d.ts +12 -0
- package/lib/protocol/wire.js +55 -0
- package/lib/receipt/index.d.ts +1 -0
- package/lib/receipt/index.js +1 -0
- package/lib/receipt/receipt.d.ts +43 -0
- package/lib/receipt/receipt.js +1 -0
- package/lib/registry/content.d.ts +10 -0
- package/lib/registry/content.js +58 -0
- package/lib/registry/index.d.ts +4 -0
- package/lib/registry/index.js +2 -0
- package/lib/registry/registry.d.ts +109 -0
- package/lib/registry/registry.js +299 -0
- package/lib/runtime/action.d.ts +46 -0
- package/lib/runtime/action.js +39 -0
- package/lib/runtime/behavior.d.ts +110 -0
- package/lib/runtime/behavior.js +179 -0
- package/lib/runtime/behaviorTuning.d.ts +59 -0
- package/lib/runtime/behaviorTuning.js +95 -0
- package/lib/runtime/cognitiveRuntime.d.ts +189 -0
- package/lib/runtime/cognitiveRuntime.js +490 -0
- package/lib/runtime/escalation.d.ts +22 -0
- package/lib/runtime/escalation.js +15 -0
- package/lib/runtime/governedTask.d.ts +57 -0
- package/lib/runtime/governedTask.js +150 -0
- package/lib/runtime/index.d.ts +15 -0
- package/lib/runtime/index.js +15 -0
- package/lib/runtime/kernelRuntime.d.ts +33 -0
- package/lib/runtime/kernelRuntime.js +105 -0
- package/lib/runtime/operation.d.ts +30 -0
- package/lib/runtime/operation.js +1 -0
- package/lib/runtime/replay.d.ts +24 -0
- package/lib/runtime/replay.js +38 -0
- package/lib/runtime/routing.d.ts +12 -0
- package/lib/runtime/routing.js +44 -0
- package/lib/runtime/safety.d.ts +15 -0
- package/lib/runtime/safety.js +28 -0
- package/lib/runtime/session.d.ts +147 -0
- package/lib/runtime/session.js +214 -0
- package/lib/runtime/sessionStore.d.ts +24 -0
- package/lib/runtime/sessionStore.js +20 -0
- package/lib/runtime/telemetry.d.ts +24 -0
- package/lib/runtime/telemetry.js +33 -0
- package/lib/runtime/turnStore.d.ts +16 -0
- package/lib/runtime/turnStore.js +15 -0
- package/lib/scenario/index.d.ts +1 -0
- package/lib/scenario/index.js +1 -0
- package/lib/scenario/scenario.d.ts +52 -0
- package/lib/scenario/scenario.js +210 -0
- package/lib/semantic/canonical.d.ts +6 -0
- package/lib/semantic/canonical.js +22 -0
- package/lib/semantic/index.d.ts +2 -0
- package/lib/semantic/index.js +2 -0
- package/lib/semantic/sha256.d.ts +1 -0
- package/lib/semantic/sha256.js +66 -0
- package/lib/storage/appendLog.d.ts +145 -0
- package/lib/storage/appendLog.js +299 -0
- package/lib/storage/fileAppendSink.d.ts +7 -0
- package/lib/storage/fileAppendSink.js +34 -0
- package/lib/storage/index.d.ts +2 -0
- package/lib/storage/index.js +2 -0
- package/lib/store/bindCache.d.ts +9 -0
- package/lib/store/bindCache.js +18 -0
- package/lib/store/cache.d.ts +48 -0
- package/lib/store/cache.js +162 -0
- package/lib/store/context.d.ts +10 -0
- package/lib/store/context.js +27 -0
- package/lib/store/handleStore.d.ts +9 -0
- package/lib/store/handleStore.js +25 -0
- package/lib/store/index.d.ts +9 -0
- package/lib/store/index.js +8 -0
- package/lib/store/messageStore.d.ts +9 -0
- package/lib/store/messageStore.js +25 -0
- package/lib/store/objectStore.d.ts +9 -0
- package/lib/store/objectStore.js +25 -0
- package/lib/store/processStore.d.ts +9 -0
- package/lib/store/processStore.js +25 -0
- package/lib/store/threadStore.d.ts +9 -0
- package/lib/store/threadStore.js +25 -0
- package/lib/store/windowStore.d.ts +9 -0
- package/lib/store/windowStore.js +25 -0
- package/lib/structure/abstractSyntaxTree.d.ts +181 -0
- package/lib/structure/abstractSyntaxTree.js +400 -0
- package/lib/structure/avlTree.d.ts +125 -0
- package/lib/structure/avlTree.js +369 -0
- package/lib/structure/binarySearchTree.d.ts +125 -0
- package/lib/structure/binarySearchTree.js +306 -0
- package/lib/structure/binaryTree.d.ts +174 -0
- package/lib/structure/binaryTree.js +495 -0
- package/lib/structure/bloomFilter.d.ts +126 -0
- package/lib/structure/bloomFilter.js +177 -0
- package/lib/structure/compare.d.ts +55 -0
- package/lib/structure/compare.js +96 -0
- package/lib/structure/cuckooFilter.d.ts +149 -0
- package/lib/structure/cuckooFilter.js +267 -0
- package/lib/structure/deque.d.ts +117 -0
- package/lib/structure/deque.js +205 -0
- package/lib/structure/filterKey.d.ts +19 -0
- package/lib/structure/filterKey.js +28 -0
- package/lib/structure/hash.d.ts +129 -0
- package/lib/structure/hash.js +241 -0
- package/lib/structure/heap.d.ts +152 -0
- package/lib/structure/heap.js +227 -0
- package/lib/structure/index.d.ts +20 -0
- package/lib/structure/index.js +20 -0
- package/lib/structure/iterator.d.ts +6 -0
- package/lib/structure/iterator.js +16 -0
- package/lib/structure/lru.d.ts +235 -0
- package/lib/structure/lru.js +524 -0
- package/lib/structure/ordered.d.ts +89 -0
- package/lib/structure/ordered.js +336 -0
- package/lib/structure/priority.d.ts +499 -0
- package/lib/structure/priority.js +756 -0
- package/lib/structure/queue.d.ts +90 -0
- package/lib/structure/queue.js +154 -0
- package/lib/structure/redBlackTree.d.ts +142 -0
- package/lib/structure/redBlackTree.js +644 -0
- package/lib/structure/segmentTree.d.ts +129 -0
- package/lib/structure/segmentTree.js +205 -0
- package/lib/structure/stack.d.ts +77 -0
- package/lib/structure/stack.js +107 -0
- package/lib/structure/unordered.d.ts +99 -0
- package/lib/structure/unordered.js +341 -0
- package/lib/thread/index.d.ts +2 -0
- package/lib/thread/index.js +2 -0
- package/lib/thread/thread.d.ts +107 -0
- package/lib/thread/thread.js +81 -0
- package/lib/thread/transitions.d.ts +8 -0
- package/lib/thread/transitions.js +9 -0
- package/lib/types/common.d.ts +80 -0
- package/lib/types/common.js +5 -0
- package/lib/types/index.d.ts +23 -0
- package/lib/types/index.js +1 -0
- package/lib/warrant/epistemic.d.ts +141 -0
- package/lib/warrant/epistemic.js +1 -0
- package/lib/warrant/index.d.ts +3 -0
- package/lib/warrant/index.js +3 -0
- package/lib/warrant/inquiry.d.ts +69 -0
- package/lib/warrant/inquiry.js +119 -0
- package/lib/warrant/warrant.d.ts +46 -0
- package/lib/warrant/warrant.js +153 -0
- package/lib/window/compaction.d.ts +57 -0
- package/lib/window/compaction.js +334 -0
- package/lib/window/compactionTypes.d.ts +113 -0
- package/lib/window/compactionTypes.js +1 -0
- package/lib/window/index.d.ts +7 -0
- package/lib/window/index.js +3 -0
- package/lib/window/page.d.ts +16 -0
- package/lib/window/page.js +2 -0
- package/lib/window/window.d.ts +68 -0
- package/lib/window/window.js +194 -0
- package/package.json +22 -1
- package/src/authz/index.ts +1 -0
- package/src/concept/index.ts +3 -0
- package/src/concurrency/index.ts +5 -0
- package/src/cooperation/index.ts +6 -0
- package/src/delegate/index.ts +2 -0
- package/src/error/index.ts +7 -0
- package/src/evaluation/index.ts +2 -0
- package/src/execution/index.ts +3 -0
- package/src/frame/index.ts +1 -0
- package/src/index.ts +11 -0
- package/src/ledger/index.ts +4 -0
- package/src/manifest/index.ts +8 -0
- package/src/policy/index.ts +2 -0
- package/src/protocol/index.ts +6 -0
- package/src/receipt/index.ts +1 -0
- package/src/semantic/index.ts +2 -0
- package/src/storage/index.ts +2 -0
- package/src/structure/index.ts +20 -0
- package/src/thread/index.ts +2 -0
- package/src/warrant/index.ts +3 -0
- package/src/window/index.ts +7 -4
- package/tools/rewrite-declaration-extensions.ts +98 -0
- package/tsconfig.build.json +14 -0
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { WindowError } from "../error/windowError.js";
|
|
2
|
+
import { LRUUnorderedMap } from "../structure/lru.js";
|
|
3
|
+
import { UnorderedMap } from "../structure/unordered.js";
|
|
4
|
+
import { pageIdFor, pageKey } from "./page.js";
|
|
5
|
+
export class ContextWindow {
|
|
6
|
+
capacityTokens;
|
|
7
|
+
maxPages;
|
|
8
|
+
resident;
|
|
9
|
+
table;
|
|
10
|
+
now;
|
|
11
|
+
objects;
|
|
12
|
+
used = 0;
|
|
13
|
+
hits = 0;
|
|
14
|
+
faults = 0;
|
|
15
|
+
evictions = 0;
|
|
16
|
+
constructor(options) {
|
|
17
|
+
if (!Number.isSafeInteger(options.capacityTokens) || options.capacityTokens <= 0) {
|
|
18
|
+
throw new RangeError("capacityTokens must be a positive safe integer");
|
|
19
|
+
}
|
|
20
|
+
this.capacityTokens = options.capacityTokens;
|
|
21
|
+
this.maxPages = options.maxPages ?? 128;
|
|
22
|
+
this.resident = new LRUUnorderedMap(this.maxPages);
|
|
23
|
+
this.table = new UnorderedMap();
|
|
24
|
+
this.now = options.now ?? (() => Date.now());
|
|
25
|
+
if (options.objects !== (void 0)) {
|
|
26
|
+
this.objects = options.objects;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
has(kind, id) {
|
|
30
|
+
return this.table.has(pageKey(kind, id));
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Load a page into the resident set, evicting unpinned pages if needed.
|
|
34
|
+
*/
|
|
35
|
+
fault(kind, id, tokens, content) {
|
|
36
|
+
if (!Number.isSafeInteger(tokens) || tokens <= 0) {
|
|
37
|
+
throw new RangeError("tokens must be a positive safe integer");
|
|
38
|
+
}
|
|
39
|
+
const key = pageKey(kind, id);
|
|
40
|
+
const existingId = this.table.get(key);
|
|
41
|
+
if (existingId !== (void 0)) {
|
|
42
|
+
const existing = this.resident.get(existingId);
|
|
43
|
+
if (existing !== (void 0)) {
|
|
44
|
+
this.hits += 1;
|
|
45
|
+
return existing;
|
|
46
|
+
}
|
|
47
|
+
this.table.delete(key);
|
|
48
|
+
}
|
|
49
|
+
if (tokens > this.capacityTokens) {
|
|
50
|
+
throw new WindowError("window_full", [`${key} needs ${tokens} tokens, window holds ${this.capacityTokens}`]);
|
|
51
|
+
}
|
|
52
|
+
this.evictUntil(tokens);
|
|
53
|
+
const page = {
|
|
54
|
+
id: pageIdFor(kind, id),
|
|
55
|
+
objectKind: kind,
|
|
56
|
+
objectId: id,
|
|
57
|
+
tokens,
|
|
58
|
+
pinned: 0,
|
|
59
|
+
lastUsed: this.now(),
|
|
60
|
+
};
|
|
61
|
+
const loaded = content ?? this.load(kind, id);
|
|
62
|
+
if (loaded !== (void 0)) {
|
|
63
|
+
page.content = loaded;
|
|
64
|
+
}
|
|
65
|
+
this.resident.set(page.id, page);
|
|
66
|
+
this.table.set(key, page.id);
|
|
67
|
+
this.used += tokens;
|
|
68
|
+
this.faults += 1;
|
|
69
|
+
return page;
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Pin a page so eviction cannot remove it; returns the new pin count.
|
|
73
|
+
*/
|
|
74
|
+
pin(kind, id) {
|
|
75
|
+
const page = this.pageOf(kind, id);
|
|
76
|
+
if (page === (void 0)) {
|
|
77
|
+
throw new WindowError("unknown_page", [pageKey(kind, id)]);
|
|
78
|
+
}
|
|
79
|
+
page.pinned += 1;
|
|
80
|
+
return page.pinned;
|
|
81
|
+
}
|
|
82
|
+
unpin(kind, id) {
|
|
83
|
+
const page = this.pageOf(kind, id);
|
|
84
|
+
if (page === (void 0)) {
|
|
85
|
+
throw new WindowError("unknown_page", [pageKey(kind, id)]);
|
|
86
|
+
}
|
|
87
|
+
page.pinned = Math.max(0, page.pinned - 1);
|
|
88
|
+
return page.pinned;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Remove a page regardless of pin count (explicit release, not eviction).
|
|
92
|
+
*/
|
|
93
|
+
release(kind, id) {
|
|
94
|
+
const key = pageKey(kind, id);
|
|
95
|
+
const pageId = this.table.get(key);
|
|
96
|
+
if (pageId === (void 0)) {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
const page = this.resident.get(pageId);
|
|
100
|
+
if (page !== (void 0)) {
|
|
101
|
+
this.used -= page.tokens;
|
|
102
|
+
}
|
|
103
|
+
this.resident.delete(pageId);
|
|
104
|
+
this.table.delete(key);
|
|
105
|
+
return true;
|
|
106
|
+
}
|
|
107
|
+
pageOf(kind, id) {
|
|
108
|
+
const pageId = this.table.get(pageKey(kind, id));
|
|
109
|
+
return pageId === (void 0) ? undefined : this.resident.get(pageId);
|
|
110
|
+
}
|
|
111
|
+
entries() {
|
|
112
|
+
return [...this.resident.values()];
|
|
113
|
+
}
|
|
114
|
+
snapshot() {
|
|
115
|
+
return this.entries().map((page) => ({
|
|
116
|
+
pageId: page.id,
|
|
117
|
+
objectKind: page.objectKind,
|
|
118
|
+
objectId: page.objectId,
|
|
119
|
+
tokens: page.tokens,
|
|
120
|
+
pinned: page.pinned > 0,
|
|
121
|
+
lastUsed: page.lastUsed,
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
restore(pages) {
|
|
125
|
+
this.resident.clear();
|
|
126
|
+
this.table.clear();
|
|
127
|
+
this.used = 0;
|
|
128
|
+
for (const page of pages) {
|
|
129
|
+
const restored = {
|
|
130
|
+
id: page.pageId,
|
|
131
|
+
objectKind: page.objectKind,
|
|
132
|
+
objectId: page.objectId,
|
|
133
|
+
tokens: page.tokens,
|
|
134
|
+
pinned: page.pinned ? 1 : 0,
|
|
135
|
+
lastUsed: page.lastUsed,
|
|
136
|
+
};
|
|
137
|
+
this.resident.set(restored.id, restored);
|
|
138
|
+
this.table.set(pageKey(page.objectKind, page.objectId), restored.id);
|
|
139
|
+
this.used += restored.tokens;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
get usedTokens() {
|
|
143
|
+
return this.used;
|
|
144
|
+
}
|
|
145
|
+
stats() {
|
|
146
|
+
return {
|
|
147
|
+
hits: this.hits,
|
|
148
|
+
faults: this.faults,
|
|
149
|
+
evictions: this.evictions,
|
|
150
|
+
usedTokens: this.used,
|
|
151
|
+
capacityTokens: this.capacityTokens,
|
|
152
|
+
pages: this.resident.size,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
evictUntil(incoming) {
|
|
156
|
+
while (this.used + incoming > this.capacityTokens || this.resident.size >= this.maxPages) {
|
|
157
|
+
const victim = this.leastRecentUnpinned();
|
|
158
|
+
if (victim === (void 0)) {
|
|
159
|
+
throw new WindowError("window_full", [`no unpinned page can make room for ${incoming} tokens`]);
|
|
160
|
+
}
|
|
161
|
+
this.used -= victim.tokens;
|
|
162
|
+
this.resident.delete(victim.id);
|
|
163
|
+
this.table.delete(pageKey(victim.objectKind, victim.objectId));
|
|
164
|
+
this.evictions += 1;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
leastRecentUnpinned() {
|
|
168
|
+
let victim;
|
|
169
|
+
for (const page of this.resident.values()) {
|
|
170
|
+
if (page.pinned > 0) {
|
|
171
|
+
continue;
|
|
172
|
+
}
|
|
173
|
+
if (victim === (void 0) || page.lastUsed < victim.lastUsed) {
|
|
174
|
+
victim = page;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
return victim;
|
|
178
|
+
}
|
|
179
|
+
load(kind, id) {
|
|
180
|
+
if (this.objects === (void 0)) {
|
|
181
|
+
return undefined;
|
|
182
|
+
}
|
|
183
|
+
const row = this.objects.find(kind, id);
|
|
184
|
+
if (row === (void 0)) {
|
|
185
|
+
return undefined;
|
|
186
|
+
}
|
|
187
|
+
try {
|
|
188
|
+
return JSON.parse(row.body);
|
|
189
|
+
}
|
|
190
|
+
catch {
|
|
191
|
+
return row.body;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "attention-manifest-protocol",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A metacognitive protocol for agent attention and warrant: signed manifests, attention frames with explicit exclusions, receipts, T0-T4 evidence tiers, MCP execution, federation, persistence, agent governance (manifests, credentials, budgets, workflows) and multi-agent delegation.",
|
|
6
6
|
"keywords": [
|
|
@@ -17,13 +17,34 @@
|
|
|
17
17
|
"license": "Apache-2.0",
|
|
18
18
|
"author": "Eloy Kim",
|
|
19
19
|
"type": "module",
|
|
20
|
+
"main": "./lib/index.js",
|
|
21
|
+
"types": "./lib/index.d.ts",
|
|
22
|
+
"exports": {
|
|
23
|
+
".": {
|
|
24
|
+
"types": "./lib/index.d.ts",
|
|
25
|
+
"default": "./lib/index.js"
|
|
26
|
+
},
|
|
27
|
+
"./package.json": "./package.json",
|
|
28
|
+
"./schemas/*": "./docs/schemas/*",
|
|
29
|
+
"./*.js": {
|
|
30
|
+
"types": "./lib/*.d.ts",
|
|
31
|
+
"default": "./lib/*.js"
|
|
32
|
+
},
|
|
33
|
+
"./*": {
|
|
34
|
+
"types": "./lib/*/index.d.ts",
|
|
35
|
+
"default": "./lib/*/index.js"
|
|
36
|
+
}
|
|
37
|
+
},
|
|
20
38
|
"engines": {
|
|
21
39
|
"node": ">=24"
|
|
22
40
|
},
|
|
23
41
|
"scripts": {
|
|
24
42
|
"dev": "vite",
|
|
25
43
|
"build": "tsc && vite build",
|
|
44
|
+
"build:lib": "tsc -p tsconfig.build.json && node tools/rewrite-declaration-extensions.ts",
|
|
45
|
+
"prebuild:lib": "node -e \"require('node:fs').rmSync('lib', { recursive: true, force: true })\"",
|
|
26
46
|
"preview": "vite preview",
|
|
47
|
+
"prepublishOnly": "npm run build:lib",
|
|
27
48
|
"verify": "node tools/validate.ts && node tools/conformance.ts && node tools/runtime-check.ts && node tools/exec-check.ts && node tools/policy-check.ts && node tools/checkpoint-check.ts && node tools/envelope-check.ts && node tools/keys-check.ts && node tools/pin-check.ts && node tools/guard-check.ts && node tools/interrupts-check.ts && node tools/conformance-runtime.ts && node tools/linear-structure-check.ts && node tools/tree-structure-check.ts && node tools/segment-ast-check.ts && node tools/structure-compare-check.ts && node tools/filter-check.ts && node tools/lru-check.ts && node tools/priority-check.ts && node tools/boundary-check.ts && node tools/concurrency-check.ts && node tools/authz-check.ts && node tools/platform-check.ts && node tools/evidence-revalidation-check.ts && node tools/ipc-check.ts && node tools/registry-check.ts && node tools/agent-check.ts && node tools/agent-store-check.ts && node tools/attention-resource-check.ts && node tools/scenario-check.ts && node tools/interaction-check.ts && node tools/bayes-check.ts && node tools/calibration-check.ts && node tools/calibration-registry-check.ts && node tools/reliability-check.ts && node tools/scoped-priors-check.ts && node tools/scoped-priors-pooling.ts && node tools/calibration-sim.ts && node tools/agreement-check.ts && node tools/label-audit.ts && node tools/annotation-status.ts && node tools/annotation-server-check.ts && node tools/calibrate-imported.ts && node tools/labels-workflow-check.ts && node tools/behavior-tuning-check.ts && node tools/diagnosis-check.ts && node tools/context-ast-check.ts && node tools/context-index-check.ts && node tools/context-storage-check.ts && node tools/context-graph-check.ts && node tools/context-projection-check.ts && node tools/context-lifecycle-check.ts && node tools/context-scope-check.ts && node tools/workspace-context-check.ts && node tools/workspace-agent-check.ts && node tools/document-context-check.ts && node tools/tex-context-check.ts && node tools/diagnosis-router-check.ts && node tools/cognitive-runtime-check.ts && node tools/deepseek-llm-check.ts && node tools/kernel-async-check.ts && node tools/kernel-runtime-check.ts && node tools/approval-access-check.ts && node tools/mcp-executor-check.ts && node tools/outbox-check.ts && node tools/session-store-check.ts && node tools/turn-store-check.ts && node tools/runtime-eval.ts && node tools/telemetry-check.ts && node tools/eval-replay.ts && node tools/eval-recorded-replay.ts && node tools/eval-summary.ts && node tools/arch-check.ts && node tools/inquiry-check.ts && node tools/sign-check.ts && node tools/social-check.ts && node tools/federation-check.ts && node tools/persistence-check.ts && node tools/team-check.ts && node tools/merge-check.ts && node tools/authority-check.ts && node tools/board-check.ts && node tools/unified-check.ts && node tools/compaction-check.ts && node tools/concept-check.ts && node tools/share-check.ts && node tools/metrics-check.ts && node tools/session-check.ts && node tools/wire-check.ts && node tools/channel-check.ts && node tools/http-channel-check.ts && node tools/retry-check.ts && node tools/a2a-check.ts && node tools/agent-card-check.ts && node tools/a2a-flow-check.ts && node tools/card-sign-check.ts && node tools/card-trust-check.ts && node tools/bundle-trust-check.ts && node tools/trust-flow-check.ts && node tools/scenario-incident.ts && node tools/cognition-check.ts && node tools/governance-check.ts && node tools/governed-task-check.ts && node tools/cooperation-check.ts && node tools/audit-check.ts && node tools/signing-check.ts && node tools/tool-gate-check.ts && node tools/cooperation-http-check.ts && node tools/governance-store-check.ts && node node_modules/typescript/bin/tsc --noEmit && node node_modules/typescript/bin/tsc -p tsconfig.tools.json",
|
|
28
49
|
"typecheck": "tsc --noEmit",
|
|
29
50
|
"typecheck:tools": "tsc -p tsconfig.tools.json",
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./authz.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./frame.ts";
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Root entry: the documented protocol surfaces. Other modules are available as
|
|
3
|
+
* subpaths, for example `attention-manifest-protocol/governance`.
|
|
4
|
+
*/
|
|
5
|
+
export * from "./attention/index.ts";
|
|
6
|
+
export * from "./context/index.ts";
|
|
7
|
+
export * from "./frame/index.ts";
|
|
8
|
+
export * from "./ledger/index.ts";
|
|
9
|
+
export * from "./manifest/index.ts";
|
|
10
|
+
export * from "./receipt/index.ts";
|
|
11
|
+
export * from "./warrant/index.ts";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./receipt.ts";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export * from "./abstractSyntaxTree.ts";
|
|
2
|
+
export * from "./avlTree.ts";
|
|
3
|
+
export * from "./binarySearchTree.ts";
|
|
4
|
+
export * from "./binaryTree.ts";
|
|
5
|
+
export * from "./bloomFilter.ts";
|
|
6
|
+
export * from "./compare.ts";
|
|
7
|
+
export * from "./cuckooFilter.ts";
|
|
8
|
+
export * from "./deque.ts";
|
|
9
|
+
export * from "./filterKey.ts";
|
|
10
|
+
export * from "./hash.ts";
|
|
11
|
+
export * from "./heap.ts";
|
|
12
|
+
export * from "./iterator.ts";
|
|
13
|
+
export * from "./lru.ts";
|
|
14
|
+
export * from "./ordered.ts";
|
|
15
|
+
export * from "./priority.ts";
|
|
16
|
+
export * from "./queue.ts";
|
|
17
|
+
export * from "./redBlackTree.ts";
|
|
18
|
+
export * from "./segmentTree.ts";
|
|
19
|
+
export * from "./stack.ts";
|
|
20
|
+
export * from "./unordered.ts";
|
package/src/window/index.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
export { ContextWindow } from "./window.ts";
|
|
2
|
-
export type { ContextWindowOptions, WindowStats } from "./window.ts";
|
|
3
|
-
export type { Page } from "./page.ts";
|
|
4
|
-
export { pageIdFor, pageKey } from "./page.ts";
|
|
1
|
+
export { ContextWindow } from "./window.ts";
|
|
2
|
+
export type { ContextWindowOptions, WindowStats } from "./window.ts";
|
|
3
|
+
export type { Page } from "./page.ts";
|
|
4
|
+
export { pageIdFor, pageKey } from "./page.ts";
|
|
5
|
+
export { CompactionRefused, compactLedger, planPrune, verifyCompaction } from "./compaction.ts";
|
|
6
|
+
export type { Compaction, CompactionOptions, PruneResult } from "./compaction.ts";
|
|
7
|
+
export type { Checkpoint, LedgerKind, PruneDecision, PrunePlan, PrunePolicy, PruneReason } from "./compactionTypes.ts";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Rewrite TypeScript extensions in emitted declarations to JavaScript ones.
|
|
4
|
+
*
|
|
5
|
+
* `tsc` rewrites relative `.ts` specifiers when it emits `.js`, but leaves them
|
|
6
|
+
* untouched in `.d.ts`. A published declaration importing `./frame.ts` would
|
|
7
|
+
* therefore point at a file that only exists as `./frame.js`, so consumers
|
|
8
|
+
* would fail to resolve the types.
|
|
9
|
+
*/
|
|
10
|
+
import { existsSync } from "node:fs";
|
|
11
|
+
import type { Dirent } from "node:fs";
|
|
12
|
+
import { readdir, readFile, writeFile } from "node:fs/promises";
|
|
13
|
+
import path from "node:path";
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Declaration root produced by `tsconfig.build.json`.
|
|
17
|
+
*/
|
|
18
|
+
const Root: string = path.resolve(import.meta.dirname, "..", "lib");
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Relative specifier ending in a TypeScript extension, quoted either way.
|
|
22
|
+
*/
|
|
23
|
+
const Specifier: RegExp = /(["'])(\.{1,2}\/[^"']*?)\.(ts|tsx|mts|cts)\1/g;
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Emitted JavaScript extension for each TypeScript extension.
|
|
27
|
+
*/
|
|
28
|
+
const Emitted: Record<string, string> = { ts: ".js", tsx: ".jsx", mts: ".mjs", cts: ".cjs" };
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* Declaration files discovered under {@link Root}.
|
|
32
|
+
*/
|
|
33
|
+
const Declarations: string[] = [];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Collect `.d.ts` files under one directory tree.
|
|
37
|
+
*
|
|
38
|
+
* @param directory Absolute directory to walk.
|
|
39
|
+
*/
|
|
40
|
+
const collect: (directory: string) => Promise<void> = async (directory: string): Promise<void> => {
|
|
41
|
+
const entries: Dirent[] = await readdir(directory, { withFileTypes: true });
|
|
42
|
+
for (let index: number = 0; index < entries.length; index += 1) {
|
|
43
|
+
const entry: Dirent = entries[index];
|
|
44
|
+
const full: string = path.join(directory, entry.name);
|
|
45
|
+
if (entry.isDirectory()) {
|
|
46
|
+
await collect(full);
|
|
47
|
+
} else if (entry.name.endsWith(".d.ts")) {
|
|
48
|
+
Declarations.push(full);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Replace TypeScript specifier extensions inside one declaration file.
|
|
55
|
+
*
|
|
56
|
+
* @param file Absolute path to a declaration file.
|
|
57
|
+
* @returns Whether the file changed.
|
|
58
|
+
*/
|
|
59
|
+
const rewrite: (file: string) => Promise<boolean> = async (file: string): Promise<boolean> => {
|
|
60
|
+
const before: string = await readFile(file, "utf8");
|
|
61
|
+
const after: string = before.replace(
|
|
62
|
+
Specifier,
|
|
63
|
+
(match: string, quote: string, base: string, extension: string): string => `${quote}${base}${Emitted[extension]}${quote}`,
|
|
64
|
+
);
|
|
65
|
+
if (after === before) {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
await writeFile(file, after, "utf8");
|
|
69
|
+
return true;
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
if (!existsSync(Root)) {
|
|
73
|
+
throw new Error(`missing declaration output: ${Root} (run tsc -p tsconfig.build.json first)`);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
await collect(Root);
|
|
77
|
+
|
|
78
|
+
let Rewrites: number = 0;
|
|
79
|
+
for (let index: number = 0; index < Declarations.length; index += 1) {
|
|
80
|
+
if (await rewrite(Declarations[index])) {
|
|
81
|
+
Rewrites += 1;
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
const Leftovers: string[] = [];
|
|
86
|
+
for (let index: number = 0; index < Declarations.length; index += 1) {
|
|
87
|
+
const file: string = Declarations[index];
|
|
88
|
+
if (Specifier.test(await readFile(file, "utf8"))) {
|
|
89
|
+
Leftovers.push(file);
|
|
90
|
+
}
|
|
91
|
+
Specifier.lastIndex = 0;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (Leftovers.length > 0) {
|
|
95
|
+
throw new Error(`declarations still reference TypeScript extensions: ${Leftovers.join(", ")}`);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
console.log(`rewrote ${Rewrites} of ${Declarations.length} declaration files under ${path.relative(process.cwd(), Root)}`);
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"extends": "./tsconfig.json",
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
"noEmit": false,
|
|
5
|
+
"declaration": true,
|
|
6
|
+
"declarationMap": false,
|
|
7
|
+
"sourceMap": false,
|
|
8
|
+
"outDir": "lib",
|
|
9
|
+
"rootDir": "src",
|
|
10
|
+
"rewriteRelativeImportExtensions": true
|
|
11
|
+
},
|
|
12
|
+
"include": ["src"],
|
|
13
|
+
"exclude": ["src/main.ts", "src/counter.ts", "src/style.css"]
|
|
14
|
+
}
|