attention-manifest-protocol 0.4.2 → 0.4.3
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 +341 -293
- package/CHANGELOG.zh-CN.md +41 -8
- package/README.md +250 -171
- package/README.zh-CN.md +251 -171
- package/lib/assignment/assign.d.ts +102 -0
- package/lib/assignment/assign.js +556 -0
- package/lib/assignment/binding.d.ts +103 -0
- package/lib/assignment/binding.js +575 -0
- package/lib/assignment/errors.d.ts +14 -0
- package/lib/assignment/errors.js +16 -0
- package/lib/assignment/guards.d.ts +18 -0
- package/lib/assignment/guards.js +28 -0
- package/lib/assignment/index.d.ts +10 -0
- package/lib/assignment/index.js +10 -0
- package/lib/assignment/types.d.ts +169 -0
- package/lib/assignment/types.js +1 -0
- package/lib/attention/budget.d.ts +1 -1
- package/lib/attention/budget.js +31 -9
- package/lib/bayes/engine.js +2 -1
- package/lib/bayes/reliability.js +25 -10
- package/lib/boundary/frame.d.ts +10 -4
- package/lib/boundary/frame.js +346 -109
- package/lib/boundary/kinds.d.ts +11 -0
- package/lib/boundary/kinds.js +33 -0
- package/lib/boundary/refTable.d.ts +19 -9
- package/lib/boundary/refTable.js +128 -30
- package/lib/boundary/toolCall.d.ts +22 -10
- package/lib/boundary/toolCall.js +798 -97
- package/lib/concept/conceptBudget.js +10 -1
- package/lib/concurrency/idempotency.d.ts +4 -3
- package/lib/concurrency/idempotency.js +57 -13
- package/lib/concurrency/retry.js +18 -3
- package/lib/context/agentContext.d.ts +13 -0
- package/lib/context/agentContext.js +14 -1
- package/lib/context/ast.d.ts +4 -1
- package/lib/context/ast.js +13 -3
- package/lib/context/contentStore.js +22 -9
- package/lib/context/contextBuilder.d.ts +457 -0
- package/lib/context/contextBuilder.js +1395 -0
- package/lib/context/contextPackage.d.ts +214 -0
- package/lib/context/contextPackage.js +191 -0
- package/lib/context/index.d.ts +14 -3
- package/lib/context/index.js +9 -1
- package/lib/context/relevance.d.ts +171 -0
- package/lib/context/relevance.js +250 -0
- package/lib/context/workspaceDiff.d.ts +105 -0
- package/lib/context/workspaceDiff.js +238 -0
- package/lib/context/workspaceService.d.ts +236 -1
- package/lib/context/workspaceService.js +1501 -73
- package/lib/cooperation/collaboration.d.ts +9 -0
- package/lib/cooperation/session.d.ts +4 -4
- package/lib/cooperation/session.js +3 -3
- package/lib/database/adapter/filesystemStore.d.ts +145 -0
- package/lib/database/adapter/filesystemStore.js +321 -0
- package/lib/database/adapter/index.d.ts +2 -0
- package/lib/database/adapter/index.js +2 -0
- package/lib/database/adapter/workspaceSessionStore.d.ts +118 -0
- package/lib/database/adapter/workspaceSessionStore.js +120 -0
- package/lib/database/entity/fileGraph.d.ts +53 -0
- package/lib/database/entity/fileGraph.js +15 -0
- package/lib/database/entity/fileTree.d.ts +76 -0
- package/lib/database/entity/fileTree.js +39 -0
- package/lib/database/entity/hook.d.ts +29 -0
- package/lib/database/entity/hook.js +18 -0
- package/lib/database/entity/index.d.ts +4 -0
- package/lib/database/entity/index.js +4 -0
- package/lib/database/entity/workspaceSession.d.ts +53 -0
- package/lib/database/entity/workspaceSession.js +28 -0
- package/lib/database/repository/fileAnnotationRepository.d.ts +75 -0
- package/lib/database/repository/fileAnnotationRepository.js +109 -0
- package/lib/database/repository/fileGraphRepository.d.ts +188 -0
- package/lib/database/repository/fileGraphRepository.js +648 -0
- package/lib/database/repository/fileNodeRepository.d.ts +116 -0
- package/lib/database/repository/fileNodeRepository.js +263 -0
- package/lib/database/repository/fileOutlineRepository.d.ts +40 -0
- package/lib/database/repository/fileOutlineRepository.js +104 -0
- package/lib/database/repository/fileWriteRepository.d.ts +41 -0
- package/lib/database/repository/fileWriteRepository.js +93 -0
- package/lib/database/repository/hookRepository.d.ts +67 -0
- package/lib/database/repository/hookRepository.js +150 -0
- package/lib/database/repository/index.d.ts +7 -0
- package/lib/database/repository/index.js +7 -0
- package/lib/database/repository/workspaceSessionRepository.d.ts +134 -0
- package/lib/database/repository/workspaceSessionRepository.js +327 -0
- package/lib/database/service/database.d.ts +14 -0
- package/lib/database/service/database.js +21 -0
- package/lib/database/sql/schema.js +187 -0
- package/lib/database/store/database.js +6 -1
- package/lib/delegate/team.d.ts +5 -0
- package/lib/delegate/team.js +83 -20
- package/lib/discover/classify.d.ts +20 -0
- package/lib/discover/classify.js +85 -0
- package/lib/discover/host.d.ts +20 -0
- package/lib/discover/host.js +89 -0
- package/lib/discover/index.d.ts +11 -0
- package/lib/discover/index.js +11 -0
- package/lib/discover/kinds.d.ts +14 -0
- package/lib/discover/kinds.js +23 -0
- package/lib/discover/tree.d.ts +7 -0
- package/lib/discover/tree.js +432 -0
- package/lib/discover/types.d.ts +115 -0
- package/lib/discover/types.js +1 -0
- package/lib/error/boundaryRejection.d.ts +1 -1
- package/lib/evaluation/agreement.js +2 -2
- package/lib/execution/handles.js +6 -0
- package/lib/execution/pin.js +2 -2
- package/lib/file/cfb.d.ts +56 -0
- package/lib/file/cfb.js +396 -0
- package/lib/file/dependency.d.ts +151 -0
- package/lib/file/dependency.js +568 -0
- package/lib/file/directory.d.ts +34 -0
- package/lib/file/directory.js +141 -0
- package/lib/file/errors.d.ts +20 -0
- package/lib/file/errors.js +18 -0
- package/lib/file/exportGraph.d.ts +31 -0
- package/lib/file/exportGraph.js +554 -0
- package/lib/file/file.d.ts +40 -0
- package/lib/file/file.js +339 -0
- package/lib/file/importGraph.d.ts +121 -0
- package/lib/file/importGraph.js +1022 -0
- package/lib/file/index.d.ts +45 -0
- package/lib/file/index.js +30 -0
- package/lib/file/metadata.d.ts +66 -0
- package/lib/file/metadata.js +470 -0
- package/lib/file/path.d.ts +60 -0
- package/lib/file/path.js +259 -0
- package/lib/file/read.d.ts +168 -0
- package/lib/file/read.js +541 -0
- package/lib/file/runtime.d.ts +95 -0
- package/lib/file/runtime.js +150 -0
- package/lib/file/service.d.ts +227 -0
- package/lib/file/service.js +663 -0
- package/lib/file/syntaxTree.d.ts +7 -0
- package/lib/file/syntaxTree.js +38 -0
- package/lib/file/time.d.ts +38 -0
- package/lib/file/time.js +44 -0
- package/lib/file/tree.d.ts +53 -0
- package/lib/file/tree.js +417 -0
- package/lib/file/types.d.ts +371 -0
- package/lib/file/types.js +1 -0
- package/lib/file/write.d.ts +159 -0
- package/lib/file/write.js +1028 -0
- package/lib/file/zip.d.ts +35 -0
- package/lib/file/zip.js +349 -0
- package/lib/fingerprint/algorithm.d.ts +97 -0
- package/lib/fingerprint/algorithm.js +271 -0
- package/lib/fingerprint/bytes.d.ts +18 -0
- package/lib/fingerprint/bytes.js +31 -0
- package/lib/fingerprint/error.d.ts +73 -0
- package/lib/fingerprint/error.js +86 -0
- package/lib/fingerprint/file.d.ts +71 -0
- package/lib/fingerprint/file.js +254 -0
- package/lib/fingerprint/index.d.ts +37 -0
- package/lib/fingerprint/index.js +12 -0
- package/lib/fingerprint/json.d.ts +41 -0
- package/lib/fingerprint/json.js +94 -0
- package/lib/fingerprint/number.d.ts +32 -0
- package/lib/fingerprint/number.js +95 -0
- package/lib/fingerprint/policy.d.ts +54 -0
- package/lib/fingerprint/policy.js +50 -0
- package/lib/fingerprint/preimage.d.ts +84 -0
- package/lib/fingerprint/preimage.js +133 -0
- package/lib/fingerprint/raw.d.ts +26 -0
- package/lib/fingerprint/raw.js +45 -0
- package/lib/fingerprint/ref.d.ts +39 -0
- package/lib/fingerprint/ref.js +178 -0
- package/lib/fingerprint/text.d.ts +42 -0
- package/lib/fingerprint/text.js +155 -0
- package/lib/fingerprint/tree.d.ts +56 -0
- package/lib/fingerprint/tree.js +288 -0
- package/lib/fingerprint/verify.d.ts +20 -0
- package/lib/fingerprint/verify.js +99 -0
- package/lib/global/filesystem.d.ts +43 -0
- package/lib/global/filesystem.js +75 -0
- package/lib/global/index.d.ts +8 -0
- package/lib/global/index.js +8 -0
- package/lib/global/service.d.ts +51 -0
- package/lib/global/service.js +98 -0
- package/lib/governance/transport.js +18 -6
- package/lib/hook/ast.d.ts +29 -0
- package/lib/hook/ast.js +22 -0
- package/lib/hook/code.d.ts +55 -0
- package/lib/hook/code.js +47 -0
- package/lib/hook/dependency.d.ts +45 -0
- package/lib/hook/dependency.js +28 -0
- package/lib/hook/diff.d.ts +114 -0
- package/lib/hook/diff.js +327 -0
- package/lib/hook/exportation.d.ts +31 -0
- package/lib/hook/exportation.js +24 -0
- package/lib/hook/file.d.ts +44 -0
- package/lib/hook/file.js +154 -0
- package/lib/hook/importation.d.ts +33 -0
- package/lib/hook/importation.js +22 -0
- package/lib/hook/index.d.ts +30 -0
- package/lib/hook/index.js +23 -0
- package/lib/hook/outline.d.ts +35 -0
- package/lib/hook/outline.js +27 -0
- package/lib/hook/project.d.ts +65 -0
- package/lib/hook/project.js +217 -0
- package/lib/hook/types.d.ts +114 -0
- package/lib/hook/types.js +407 -0
- package/lib/index.d.ts +9 -0
- package/lib/index.js +9 -0
- package/lib/lock/lease.js +28 -3
- package/lib/manifest/cardSign.d.ts +1 -1
- package/lib/manifest/cardSign.js +37 -7
- package/lib/manifest/federation.js +13 -6
- package/lib/manifest/trust.d.ts +2 -0
- package/lib/manifest/trust.js +27 -6
- package/lib/module/index.d.ts +4 -0
- package/lib/module/index.js +4 -0
- package/lib/module/mcp/client.js +21 -2
- package/lib/module/mcp/filesystemServer.d.ts +24 -0
- package/lib/module/mcp/filesystemServer.js +102 -0
- package/lib/module/mcp/http.js +32 -19
- package/lib/module/mcp/workspaceServer.js +20 -3
- package/lib/module/tool/filesystemExecutor.d.ts +18 -0
- package/lib/module/tool/filesystemExecutor.js +49 -0
- package/lib/module/tool/globalExecutor.d.ts +17 -0
- package/lib/module/tool/globalExecutor.js +39 -0
- package/lib/module/tool/globalFilesystemExecutor.d.ts +18 -0
- package/lib/module/tool/globalFilesystemExecutor.js +49 -0
- package/lib/module/tool/workspaceExecutor.d.ts +9 -0
- package/lib/module/tool/workspaceExecutor.js +16 -3
- package/lib/naming/aliases.d.ts +48 -0
- package/lib/naming/aliases.js +79 -0
- package/lib/naming/catalog.d.ts +117 -0
- package/lib/naming/catalog.js +108 -0
- package/lib/naming/grammar.d.ts +67 -0
- package/lib/naming/grammar.js +212 -0
- package/lib/naming/ids.d.ts +157 -0
- package/lib/naming/ids.js +119 -0
- package/lib/naming/index.d.ts +13 -0
- package/lib/naming/index.js +13 -0
- package/lib/outline/index.d.ts +9 -0
- package/lib/outline/index.js +8 -0
- package/lib/outline/office.d.ts +160 -0
- package/lib/outline/office.js +2375 -0
- package/lib/outline/officeBridge.d.ts +32 -0
- package/lib/outline/officeBridge.js +27 -0
- package/lib/outline/outline.d.ts +159 -0
- package/lib/outline/outline.js +837 -0
- package/lib/outline/outlineIndex.d.ts +97 -0
- package/lib/outline/outlineIndex.js +325 -0
- package/lib/outline/outlineKeywords.d.ts +59 -0
- package/lib/outline/outlineKeywords.js +143 -0
- package/lib/outline/outlineStrategies.d.ts +414 -0
- package/lib/outline/outlineStrategies.js +8324 -0
- package/lib/outline/reactOutline.d.ts +37 -0
- package/lib/outline/reactOutline.js +1070 -0
- package/lib/outline/shellOutline.d.ts +65 -0
- package/lib/outline/shellOutline.js +873 -0
- package/lib/outline/sqlOutline.d.ts +170 -0
- package/lib/outline/sqlOutline.js +1536 -0
- package/lib/outline/strategy.d.ts +46 -0
- package/lib/outline/strategy.js +1 -0
- package/lib/outline/types.d.ts +95 -0
- package/lib/outline/types.js +1 -0
- package/lib/outline/visualBasicOutline.d.ts +27 -0
- package/lib/outline/visualBasicOutline.js +750 -0
- package/lib/protocol/filesystem.d.ts +55 -0
- package/lib/protocol/filesystem.js +105 -0
- package/lib/protocol/global.d.ts +42 -0
- package/lib/protocol/global.js +63 -0
- package/lib/protocol/globalFilesystem.d.ts +40 -0
- package/lib/protocol/globalFilesystem.js +59 -0
- package/lib/protocol/index.d.ts +4 -0
- package/lib/protocol/index.js +4 -0
- package/lib/protocol/protocol.d.ts +4 -0
- package/lib/protocol/wire.js +5 -2
- package/lib/protocol/workspace.d.ts +305 -0
- package/lib/protocol/workspace.js +258 -0
- package/lib/receipt/receipt.d.ts +8 -0
- package/lib/registry/content.js +9 -3
- package/lib/runtime/kernelRuntime.js +9 -1
- package/lib/scenario/scenario.js +5 -4
- package/lib/semantic/canonical.d.ts +61 -0
- package/lib/semantic/canonical.js +135 -8
- package/lib/semantic/jsonValue.d.ts +31 -0
- package/lib/semantic/jsonValue.js +122 -0
- package/lib/semantic/sha256.js +3 -0
- package/lib/semantic/time.d.ts +14 -0
- package/lib/semantic/time.js +56 -0
- package/lib/session/context.d.ts +76 -0
- package/lib/session/context.js +419 -0
- package/lib/session/errors.d.ts +24 -0
- package/lib/session/errors.js +22 -0
- package/lib/session/identity.d.ts +24 -0
- package/lib/session/identity.js +56 -0
- package/lib/session/index.d.ts +14 -0
- package/lib/session/index.js +12 -0
- package/lib/session/registry.d.ts +130 -0
- package/lib/session/registry.js +908 -0
- package/lib/session/types.d.ts +227 -0
- package/lib/session/types.js +14 -0
- package/lib/structure/index.d.ts +1 -0
- package/lib/structure/index.js +1 -0
- package/lib/structure/trie.d.ts +88 -0
- package/lib/structure/trie.js +183 -0
- package/lib/syntax/byteIndex.d.ts +44 -0
- package/lib/syntax/byteIndex.js +148 -0
- package/lib/syntax/charset.d.ts +88 -0
- package/lib/syntax/charset.js +276 -0
- package/lib/syntax/index.d.ts +6 -0
- package/lib/syntax/index.js +5 -0
- package/lib/syntax/syntaxRegistry.d.ts +150 -0
- package/lib/syntax/syntaxRegistry.js +314 -0
- package/lib/syntax/syntaxTree.d.ts +106 -0
- package/lib/syntax/syntaxTree.js +668 -0
- package/lib/syntax/types.d.ts +15 -0
- package/lib/syntax/types.js +1 -0
- package/lib/types/common.d.ts +1 -1
- package/package.json +72 -193
- package/.editorconfig +0 -12
- package/.prettierignore +0 -17
- package/MCP-Token/347/250/216/344/270/216/344/270/213/344/270/200/344/273/243/345/267/245/345/205/267/345/215/217/350/256/256.html +0 -1763
- package/docs/annotation-campaign-A.csv +0 -54
- package/docs/annotation-campaign-B.csv +0 -54
- package/docs/annotation-campaign.csv +0 -54
- package/docs/eval/annotations-A.jsonl +0 -16
- package/docs/eval/annotations.json +0 -122
- package/docs/eval/recorded-labels.json +0 -12
- package/docs/eval/replay-cases.json +0 -14
- package/docs/eval/replay-labels-b.json +0 -14
- package/docs/examples/attention-request.json +0 -16
- package/docs/examples/checkpoint.json +0 -15
- package/docs/examples/claim.json +0 -66
- package/docs/examples/collaboration.json +0 -66
- package/docs/examples/concept-checkpoint.json +0 -15
- package/docs/examples/concept-prune-plan.json +0 -45
- package/docs/examples/federation.json +0 -126
- package/docs/examples/frame-chain.json +0 -77
- package/docs/examples/ledger-snapshot.json +0 -108
- package/docs/examples/manifest.json +0 -77
- package/docs/examples/message.json +0 -19
- package/docs/examples/other-model.json +0 -45
- package/docs/examples/plan.json +0 -50
- package/docs/examples/prune-plan.json +0 -48
- package/docs/examples/receipt.json +0 -22
- package/docs/examples/runtime-run.json +0 -573
- package/docs/examples/team.json +0 -66
- package/docs/examples/verb-note.json +0 -11
- package/docs/probes/bayes-scores.json +0 -1452
- package/docs/probes/calibration-imported.json +0 -141
- package/docs/probes/context-ast-deepseek.json +0 -1577
- package/docs/probes/deepseek-probe.json +0 -917
- package/docs/probes/eval-recorded-replay.json +0 -597
- package/docs/probes/eval-replay.json +0 -124
- package/docs/probes/eval-summary.json +0 -42
- package/docs/probes/runtime-eval.json +0 -4230
- package/docs/schemas/collaboration.schema.json +0 -73
- package/docs/schemas/common.schema.json +0 -125
- package/docs/schemas/compaction.schema.json +0 -121
- package/docs/schemas/concept-compaction.schema.json +0 -73
- package/docs/schemas/concept.schema.json +0 -97
- package/docs/schemas/epistemic.schema.json +0 -178
- package/docs/schemas/federation.schema.json +0 -66
- package/docs/schemas/frame.schema.json +0 -86
- package/docs/schemas/ledger-snapshot.schema.json +0 -30
- package/docs/schemas/manifest.schema.json +0 -169
- package/docs/schemas/message.schema.json +0 -41
- package/docs/schemas/plan.schema.json +0 -189
- package/docs/schemas/receipt.schema.json +0 -45
- package/docs/schemas/social.schema.json +0 -153
- package/docs/schemas/team.schema.json +0 -56
- package/docs/schemas/verb.schema.json +0 -120
- package/eslint.config.mts +0 -96
- package/index.html +0 -13
- package/lib/context/workspaceProtocol.d.ts +0 -30
- package/lib/context/workspaceProtocol.js +0 -49
- package/prettier.config.mts +0 -37
- package/public/favicon.svg +0 -1
- package/public/icons.svg +0 -24
- package/src/attention/attention.ts +0 -347
- package/src/attention/budget.ts +0 -72
- package/src/attention/cognition.ts +0 -519
- package/src/attention/index.ts +0 -8
- package/src/attention/interrupts.ts +0 -228
- package/src/attention/resource.ts +0 -316
- package/src/attention/social.ts +0 -217
- package/src/attention/socialTypes.ts +0 -115
- package/src/authz/authz.ts +0 -305
- package/src/authz/index.ts +0 -1
- package/src/bayes/calibration.ts +0 -204
- package/src/bayes/calibrationRegistry.ts +0 -111
- package/src/bayes/calibrationSelection.ts +0 -154
- package/src/bayes/engine.ts +0 -532
- package/src/bayes/index.ts +0 -6
- package/src/bayes/reliability.ts +0 -62
- package/src/bayes/scopedPriors.ts +0 -88
- package/src/boundary/frame.ts +0 -322
- package/src/boundary/ids.ts +0 -14
- package/src/boundary/index.ts +0 -12
- package/src/boundary/refTable.ts +0 -125
- package/src/boundary/toolCall.ts +0 -212
- package/src/concept/concept.ts +0 -75
- package/src/concept/conceptBudget.ts +0 -346
- package/src/concept/conceptBudgetTypes.ts +0 -79
- package/src/concept/index.ts +0 -3
- package/src/concurrency/idempotency.ts +0 -41
- package/src/concurrency/index.ts +0 -5
- package/src/concurrency/mutex.ts +0 -26
- package/src/concurrency/namedLocks.ts +0 -35
- package/src/concurrency/retry.ts +0 -50
- package/src/concurrency/worker.ts +0 -128
- package/src/context/agentContext.ts +0 -308
- package/src/context/ast.ts +0 -499
- package/src/context/contentStore.ts +0 -75
- package/src/context/context.ts +0 -65
- package/src/context/contextIndex.ts +0 -85
- package/src/context/document.ts +0 -137
- package/src/context/fileStorePath.ts +0 -14
- package/src/context/index.ts +0 -43
- package/src/context/lifecycle.ts +0 -221
- package/src/context/projections.ts +0 -151
- package/src/context/workspace.ts +0 -422
- package/src/context/workspaceProtocol.ts +0 -112
- package/src/context/workspaceService.ts +0 -423
- package/src/cooperation/board.ts +0 -104
- package/src/cooperation/collaboration.ts +0 -60
- package/src/cooperation/index.ts +0 -6
- package/src/cooperation/merge.ts +0 -190
- package/src/cooperation/metrics.ts +0 -57
- package/src/cooperation/session.ts +0 -131
- package/src/cooperation/unified.ts +0 -56
- package/src/counter.ts +0 -9
- package/src/database/adapter/adapters.ts +0 -35
- package/src/database/adapter/index.ts +0 -4
- package/src/database/adapter/runtimeSink.ts +0 -74
- package/src/database/adapter/sessionStore.ts +0 -32
- package/src/database/adapter/turnStore.ts +0 -23
- package/src/database/entity/agent.ts +0 -199
- package/src/database/entity/entity.ts +0 -1046
- package/src/database/entity/handle.ts +0 -79
- package/src/database/entity/index.ts +0 -32
- package/src/database/entity/message.ts +0 -74
- package/src/database/entity/meta.ts +0 -11
- package/src/database/entity/object.ts +0 -42
- package/src/database/entity/outbox.ts +0 -15
- package/src/database/entity/process.ts +0 -65
- package/src/database/entity/registry.ts +0 -155
- package/src/database/entity/runtimeApproval.ts +0 -30
- package/src/database/entity/runtimeSession.ts +0 -13
- package/src/database/entity/runtimeTurn.ts +0 -15
- package/src/database/entity/thread.ts +0 -85
- package/src/database/entity/window.ts +0 -85
- package/src/database/entity/worker.ts +0 -90
- package/src/database/index.ts +0 -6
- package/src/database/repository/addressSpaceRepository.ts +0 -72
- package/src/database/repository/agentRepository.ts +0 -460
- package/src/database/repository/base.ts +0 -41
- package/src/database/repository/executionRepository.ts +0 -477
- package/src/database/repository/handleRepository.ts +0 -64
- package/src/database/repository/index.ts +0 -20
- package/src/database/repository/messageRepository.ts +0 -52
- package/src/database/repository/objectRepository.ts +0 -69
- package/src/database/repository/outboxRepository.ts +0 -63
- package/src/database/repository/processRepository.ts +0 -58
- package/src/database/repository/registryRepository.ts +0 -119
- package/src/database/repository/repository.ts +0 -491
- package/src/database/repository/runtimeApprovalRepository.ts +0 -44
- package/src/database/repository/runtimeSessionRepository.ts +0 -27
- package/src/database/repository/runtimeTurnRepository.ts +0 -39
- package/src/database/repository/socialRepository.ts +0 -185
- package/src/database/repository/threadRepository.ts +0 -57
- package/src/database/repository/windowRepository.ts +0 -88
- package/src/database/repository/workerRepository.ts +0 -69
- package/src/database/service/database.ts +0 -90
- package/src/database/service/handleService.ts +0 -48
- package/src/database/service/index.ts +0 -16
- package/src/database/service/messageService.ts +0 -61
- package/src/database/service/objectService.ts +0 -59
- package/src/database/service/processService.ts +0 -61
- package/src/database/service/registryServices.ts +0 -88
- package/src/database/service/service.ts +0 -183
- package/src/database/service/stepService.ts +0 -53
- package/src/database/service/threadService.ts +0 -65
- package/src/database/service/windowService.ts +0 -30
- package/src/database/service/workerService.ts +0 -57
- package/src/database/sql/index.ts +0 -3
- package/src/database/sql/schema.ts +0 -418
- package/src/database/sql/sql.ts +0 -543
- package/src/database/store/database.ts +0 -210
- package/src/database/store/index.ts +0 -3
- package/src/database/store/store.ts +0 -266
- package/src/delegate/index.ts +0 -2
- package/src/delegate/team.ts +0 -268
- package/src/delegate/teamTypes.ts +0 -47
- package/src/diagnosis/checklist.ts +0 -74
- package/src/diagnosis/context.ts +0 -93
- package/src/diagnosis/frame.ts +0 -256
- package/src/diagnosis/index.ts +0 -5
- package/src/diagnosis/router.ts +0 -72
- package/src/diagnosis/types.ts +0 -89
- package/src/error/agentError.ts +0 -16
- package/src/error/ampError.ts +0 -20
- package/src/error/authzError.ts +0 -14
- package/src/error/boundaryRejection.ts +0 -20
- package/src/error/index.ts +0 -7
- package/src/error/kernelError.ts +0 -27
- package/src/error/mailboxError.ts +0 -9
- package/src/error/windowError.ts +0 -12
- package/src/evaluation/agreement.ts +0 -96
- package/src/evaluation/index.ts +0 -2
- package/src/evaluation/labels.ts +0 -241
- package/src/evidence/evidenceGraph.ts +0 -205
- package/src/evidence/index.ts +0 -4
- package/src/evidence/revalidation.ts +0 -191
- package/src/execution/exec.ts +0 -408
- package/src/execution/handles.ts +0 -65
- package/src/execution/index.ts +0 -3
- package/src/execution/pin.ts +0 -154
- package/src/frame/frame.ts +0 -70
- package/src/frame/index.ts +0 -1
- package/src/goal/goal.ts +0 -43
- package/src/goal/index.ts +0 -2
- package/src/goal/plan.ts +0 -196
- package/src/governance/attentionManifest.ts +0 -802
- package/src/governance/audit.ts +0 -362
- package/src/governance/budget.ts +0 -628
- package/src/governance/context.ts +0 -356
- package/src/governance/control.ts +0 -159
- package/src/governance/cooperation.ts +0 -479
- package/src/governance/credential.ts +0 -359
- package/src/governance/httpServer.ts +0 -99
- package/src/governance/index.ts +0 -32
- package/src/governance/legal.ts +0 -574
- package/src/governance/matrix.ts +0 -460
- package/src/governance/perspectives.ts +0 -406
- package/src/governance/signing.ts +0 -407
- package/src/governance/store.ts +0 -125
- package/src/governance/switching.ts +0 -459
- package/src/governance/toolPolicy.ts +0 -80
- package/src/governance/transport.ts +0 -204
- package/src/governance/types.ts +0 -380
- package/src/governance/workflow.ts +0 -743
- package/src/index.ts +0 -11
- package/src/interaction/index.ts +0 -1
- package/src/interaction/interaction.ts +0 -391
- package/src/ipc/index.ts +0 -4
- package/src/ipc/mailbox.ts +0 -132
- package/src/ipc/memorySocialStore.ts +0 -93
- package/src/ipc/social.ts +0 -93
- package/src/kernel/index.ts +0 -14
- package/src/kernel/scheduler.ts +0 -498
- package/src/ledger/checkpoint.ts +0 -304
- package/src/ledger/index.ts +0 -4
- package/src/ledger/ledger.ts +0 -31
- package/src/ledger/persistence.ts +0 -159
- package/src/ledger/share.ts +0 -80
- package/src/lock/index.ts +0 -2
- package/src/lock/lease.ts +0 -74
- package/src/main.ts +0 -199
- package/src/manifest/agentCard.ts +0 -72
- package/src/manifest/cardSign.ts +0 -87
- package/src/manifest/federation.ts +0 -237
- package/src/manifest/federationTypes.ts +0 -55
- package/src/manifest/index.ts +0 -8
- package/src/manifest/keys.ts +0 -643
- package/src/manifest/manifest.ts +0 -114
- package/src/manifest/sign.ts +0 -134
- package/src/manifest/trust.ts +0 -146
- package/src/mission/index.ts +0 -2
- package/src/mission/missionQueue.ts +0 -75
- package/src/module/index.ts +0 -9
- package/src/module/llm/deepseek.ts +0 -214
- package/src/module/llm/llm.ts +0 -84
- package/src/module/mcp/client.ts +0 -110
- package/src/module/mcp/http.ts +0 -102
- package/src/module/mcp/protocol.ts +0 -77
- package/src/module/mcp/server.ts +0 -148
- package/src/module/mcp/transport.ts +0 -30
- package/src/module/mcp/workspaceServer.ts +0 -111
- package/src/module/sandbox/sandbox.ts +0 -29
- package/src/module/tool/mcpExecutor.ts +0 -54
- package/src/module/tool/policy.ts +0 -52
- package/src/module/tool/redact.ts +0 -29
- package/src/module/tool/tool.ts +0 -53
- package/src/module/tool/workspaceExecutor.ts +0 -35
- package/src/policy/guard.ts +0 -240
- package/src/policy/index.ts +0 -2
- package/src/policy/policy.ts +0 -561
- package/src/process/agent.ts +0 -341
- package/src/process/agentService.ts +0 -236
- package/src/process/agentStore.ts +0 -378
- package/src/process/executionStore.ts +0 -151
- package/src/process/index.ts +0 -5
- package/src/process/process.ts +0 -240
- package/src/process/transitions.ts +0 -19
- package/src/progress/index.ts +0 -2
- package/src/progress/progress.ts +0 -85
- package/src/protocol/a2a.ts +0 -120
- package/src/protocol/channel.ts +0 -44
- package/src/protocol/envelope.ts +0 -655
- package/src/protocol/httpChannel.ts +0 -87
- package/src/protocol/index.ts +0 -6
- package/src/protocol/protocol.ts +0 -138
- package/src/protocol/wire.ts +0 -60
- package/src/receipt/index.ts +0 -1
- package/src/receipt/receipt.ts +0 -47
- package/src/registry/content.ts +0 -69
- package/src/registry/index.ts +0 -23
- package/src/registry/registry.ts +0 -599
- package/src/runtime/action.ts +0 -87
- package/src/runtime/behavior.ts +0 -330
- package/src/runtime/behaviorTuning.ts +0 -163
- package/src/runtime/cognitiveRuntime.ts +0 -703
- package/src/runtime/escalation.ts +0 -35
- package/src/runtime/governedTask.ts +0 -233
- package/src/runtime/index.ts +0 -15
- package/src/runtime/kernelRuntime.ts +0 -144
- package/src/runtime/operation.ts +0 -35
- package/src/runtime/replay.ts +0 -71
- package/src/runtime/routing.ts +0 -58
- package/src/runtime/safety.ts +0 -48
- package/src/runtime/session.ts +0 -341
- package/src/runtime/sessionStore.ts +0 -43
- package/src/runtime/telemetry.ts +0 -55
- package/src/runtime/turnStore.ts +0 -30
- package/src/scenario/index.ts +0 -1
- package/src/scenario/scenario.ts +0 -299
- package/src/semantic/canonical.ts +0 -24
- package/src/semantic/index.ts +0 -2
- package/src/semantic/sha256.ts +0 -82
- package/src/storage/appendLog.ts +0 -372
- package/src/storage/fileAppendSink.ts +0 -40
- package/src/storage/index.ts +0 -2
- package/src/store/bindCache.ts +0 -22
- package/src/store/cache.ts +0 -191
- package/src/store/context.ts +0 -31
- package/src/store/handleStore.ts +0 -31
- package/src/store/index.ts +0 -9
- package/src/store/messageStore.ts +0 -31
- package/src/store/objectStore.ts +0 -31
- package/src/store/processStore.ts +0 -31
- package/src/store/threadStore.ts +0 -31
- package/src/store/windowStore.ts +0 -31
- package/src/structure/abstractSyntaxTree.ts +0 -493
- package/src/structure/avlTree.ts +0 -408
- package/src/structure/binarySearchTree.ts +0 -352
- package/src/structure/binaryTree.ts +0 -525
- package/src/structure/bloomFilter.ts +0 -231
- package/src/structure/compare.ts +0 -110
- package/src/structure/cuckooFilter.ts +0 -337
- package/src/structure/deque.ts +0 -223
- package/src/structure/filterKey.ts +0 -36
- package/src/structure/hash.ts +0 -279
- package/src/structure/heap.ts +0 -268
- package/src/structure/index.ts +0 -20
- package/src/structure/iterator.ts +0 -22
- package/src/structure/lru.ts +0 -619
- package/src/structure/ordered.ts +0 -399
- package/src/structure/priority.ts +0 -915
- package/src/structure/queue.ts +0 -168
- package/src/structure/redBlackTree.ts +0 -680
- package/src/structure/segmentTree.ts +0 -248
- package/src/structure/stack.ts +0 -118
- package/src/structure/unordered.ts +0 -407
- package/src/style.css +0 -278
- package/src/thread/index.ts +0 -2
- package/src/thread/thread.ts +0 -176
- package/src/thread/transitions.ts +0 -17
- package/src/types/common.ts +0 -119
- package/src/types/index.ts +0 -23
- package/src/warrant/epistemic.ts +0 -154
- package/src/warrant/index.ts +0 -3
- package/src/warrant/inquiry.ts +0 -166
- package/src/warrant/warrant.ts +0 -179
- package/src/window/compaction.ts +0 -403
- package/src/window/compactionTypes.ts +0 -119
- package/src/window/index.ts +0 -7
- package/src/window/page.ts +0 -18
- package/src/window/window.ts +0 -244
- package/tools/_helpers.ts +0 -34
- package/tools/a2a-check.ts +0 -110
- package/tools/a2a-flow-check.ts +0 -78
- package/tools/agent-card-check.ts +0 -76
- package/tools/agent-check.ts +0 -236
- package/tools/agent-store-check.ts +0 -153
- package/tools/agreement-check.ts +0 -27
- package/tools/annotation-server-check.ts +0 -48
- package/tools/annotation-server.ts +0 -230
- package/tools/annotation-status.ts +0 -65
- package/tools/approval-access-check.ts +0 -66
- package/tools/arch-check.ts +0 -72
- package/tools/attention-core-check.ts +0 -48
- package/tools/attention-resource-check.ts +0 -169
- package/tools/audit-check.ts +0 -207
- package/tools/authority-check.ts +0 -124
- package/tools/authz-check.ts +0 -138
- package/tools/bayes-check.ts +0 -162
- package/tools/bayes-probe.ts +0 -154
- package/tools/behavior-tuning-check.ts +0 -53
- package/tools/board-check.ts +0 -87
- package/tools/boundary-check.ts +0 -199
- package/tools/bundle-trust-check.ts +0 -96
- package/tools/calibrate-imported.ts +0 -108
- package/tools/calibration-check.ts +0 -44
- package/tools/calibration-registry-check.ts +0 -40
- package/tools/calibration-sim.ts +0 -40
- package/tools/card-sign-check.ts +0 -71
- package/tools/card-trust-check.ts +0 -78
- package/tools/channel-check.ts +0 -86
- package/tools/checkpoint-check.ts +0 -620
- package/tools/cleanup-style-configs.ts +0 -29
- package/tools/cognition-check.ts +0 -648
- package/tools/cognitive-runtime-check.ts +0 -609
- package/tools/collaboration-demo.ts +0 -78
- package/tools/compaction-check.ts +0 -266
- package/tools/concept-check.ts +0 -260
- package/tools/concurrency-check.ts +0 -242
- package/tools/conformance-runtime.ts +0 -389
- package/tools/conformance.ts +0 -651
- package/tools/context-ast-check.ts +0 -90
- package/tools/context-ast-deepseek.ts +0 -242
- package/tools/context-graph-bench.ts +0 -50
- package/tools/context-graph-check.ts +0 -229
- package/tools/context-index-check.ts +0 -48
- package/tools/context-lifecycle-check.ts +0 -69
- package/tools/context-projection-check.ts +0 -73
- package/tools/context-scope-check.ts +0 -134
- package/tools/context-storage-check.ts +0 -113
- package/tools/cooperation-check.ts +0 -517
- package/tools/cooperation-http-check.ts +0 -125
- package/tools/deepseek-llm-check.ts +0 -147
- package/tools/deepseek-probe.ts +0 -494
- package/tools/diagnosis-check.ts +0 -109
- package/tools/diagnosis-router-check.ts +0 -50
- package/tools/document-context-check.ts +0 -237
- package/tools/envelope-check.ts +0 -659
- package/tools/eslint-rules/index.ts +0 -26
- package/tools/eslint-rules/rules/jsdoc-comment-format.ts +0 -105
- package/tools/eslint-rules/rules/no-function-keyword.ts +0 -60
- package/tools/eslint-rules/rules/no-multiline-parameters.ts +0 -71
- package/tools/eslint-rules/rules/no-multiline-type-parameters.ts +0 -57
- package/tools/eslint-rules/rules/no-undefined-comparison.ts +0 -115
- package/tools/eslint-rules/rules/prefer-template-for-string-conversion.ts +0 -97
- package/tools/eslint-rules/rules/require-typeof-parentheses.ts +0 -49
- package/tools/eslint-rules/rules/require-variable-type.ts +0 -36
- package/tools/eslint-rules/rules/variable-naming.ts +0 -175
- package/tools/eval-recorded-replay.ts +0 -215
- package/tools/eval-replay.ts +0 -139
- package/tools/eval-summary.ts +0 -136
- package/tools/evidence-revalidation-check.ts +0 -235
- package/tools/exec-check.ts +0 -217
- package/tools/federation-check.ts +0 -166
- package/tools/federation-demo.ts +0 -45
- package/tools/filter-check.ts +0 -243
- package/tools/governance-check.ts +0 -680
- package/tools/governance-store-check.ts +0 -131
- package/tools/governed-task-check.ts +0 -227
- package/tools/guard-check.ts +0 -122
- package/tools/http-channel-check.ts +0 -125
- package/tools/import-campaign.ts +0 -28
- package/tools/inquiry-check.ts +0 -126
- package/tools/interaction-check.ts +0 -171
- package/tools/interrupts-check.ts +0 -173
- package/tools/ipc-check.ts +0 -170
- package/tools/kernel-async-check.ts +0 -136
- package/tools/kernel-check.ts +0 -369
- package/tools/kernel-runtime-check.ts +0 -276
- package/tools/keys-check.ts +0 -559
- package/tools/label-audit.ts +0 -70
- package/tools/labels-workflow-check.ts +0 -49
- package/tools/linear-structure-check.ts +0 -524
- package/tools/live-exec.ts +0 -62
- package/tools/live-governance-eval.ts +0 -813
- package/tools/live-legacy.ts +0 -50
- package/tools/lru-check.ts +0 -182
- package/tools/make-annotation-campaign.ts +0 -57
- package/tools/mcp-executor-check.ts +0 -33
- package/tools/merge-annotations.ts +0 -32
- package/tools/merge-check.ts +0 -98
- package/tools/metrics-check.ts +0 -84
- package/tools/net-probe.ts +0 -107
- package/tools/oauth-probe.ts +0 -117
- package/tools/outbox-check.ts +0 -50
- package/tools/persistence-check.ts +0 -144
- package/tools/pin-check.ts +0 -116
- package/tools/platform-check.ts +0 -281
- package/tools/policy-check.ts +0 -514
- package/tools/prettier-plugin/index.mts +0 -84
- package/tools/priority-check.ts +0 -627
- package/tools/probe-context7.ts +0 -63
- package/tools/registry-check.ts +0 -252
- package/tools/reliability-check.ts +0 -25
- package/tools/retry-check.ts +0 -85
- package/tools/rewrite-declaration-extensions.ts +0 -98
- package/tools/runtime-check.ts +0 -165
- package/tools/runtime-deepseek-check.ts +0 -85
- package/tools/runtime-eval.ts +0 -358
- package/tools/scenario-check.ts +0 -161
- package/tools/scenario-incident.ts +0 -162
- package/tools/scoped-priors-check.ts +0 -35
- package/tools/scoped-priors-pooling.ts +0 -34
- package/tools/segment-ast-check.ts +0 -649
- package/tools/session-check.ts +0 -196
- package/tools/session-store-check.ts +0 -73
- package/tools/share-check.ts +0 -88
- package/tools/sign-check.ts +0 -95
- package/tools/signing-check.ts +0 -275
- package/tools/snapshot-demo.ts +0 -65
- package/tools/social-check.ts +0 -146
- package/tools/structure-compare-check.ts +0 -95
- package/tools/support/documentScanner.ts +0 -577
- package/tools/support/texScanner.ts +0 -631
- package/tools/support/workspaceScanner.ts +0 -476
- package/tools/team-check.ts +0 -163
- package/tools/team-demo.ts +0 -36
- package/tools/telemetry-check.ts +0 -44
- package/tools/tex-context-check.ts +0 -263
- package/tools/tool-gate-check.ts +0 -98
- package/tools/tree-structure-check.ts +0 -786
- package/tools/trust-flow-check.ts +0 -158
- package/tools/turn-store-check.ts +0 -57
- package/tools/unified-check.ts +0 -83
- package/tools/validate.ts +0 -309
- package/tools/wire-check.ts +0 -96
- package/tools/workspace-agent-check.ts +0 -486
- package/tools/workspace-agent-demo.ts +0 -62
- package/tools/workspace-agent-server.ts +0 -101
- package/tools/workspace-context-check.ts +0 -331
- package/tools/workspace-context.ts +0 -131
- package/tsconfig.build.json +0 -14
- package/tsconfig.json +0 -24
- package/tsconfig.tools.json +0 -31
- package/viz/context-ast.json +0 -1577
package/README.zh-CN.md
CHANGED
|
@@ -1,171 +1,251 @@
|
|
|
1
|
-
# Attention Manifest Protocol(AMP)
|
|
2
|
-
|
|
3
|
-
[English](README.md) · **简体中文** · [更新日志](CHANGELOG.zh-CN.md)
|
|
4
|
-
|
|
5
|
-
AMP 是供 agent 使用的元认知协议:声明知识和义务,分配有限注意力,获取证据,记录成本与结果。当前参考实现为 `0.4.2`,要求 **Node.js 24 或以上**,使用 Apache-2.0 许可证。
|
|
6
|
-
|
|
7
|
-
## 架构
|
|
8
|
-
|
|
9
|
-
| 构件 | 职责 |
|
|
10
|
-
| --- | --- |
|
|
11
|
-
| Warrant Ledger(凭据账本) | 主张、证据、假设、未知、概念与计划:为什么相信一个结论? |
|
|
12
|
-
| Attention Ledger(注意力账本) | 帧、预算、回执与打断:注意力花在了哪里? |
|
|
13
|
-
| Manifest | 可持久化、可签名的身份、能力、承诺与限制声明 |
|
|
14
|
-
|
|
|
15
|
-
|
|
|
16
|
-
|
|
|
17
|
-
|
|
|
18
|
-
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
| `
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
npm run
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
1
|
+
# Attention Manifest Protocol(AMP)
|
|
2
|
+
|
|
3
|
+
[English](README.md) · **简体中文** · [更新日志](CHANGELOG.zh-CN.md)
|
|
4
|
+
|
|
5
|
+
AMP 是供 agent 使用的元认知协议:声明知识和义务,分配有限注意力,获取证据,记录成本与结果。当前参考实现为 `0.4.2`,要求 **Node.js 24 或以上**,使用 Apache-2.0 许可证。
|
|
6
|
+
|
|
7
|
+
## 架构
|
|
8
|
+
|
|
9
|
+
| 构件 | 职责 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| Warrant Ledger(凭据账本) | 主张、证据、假设、未知、概念与计划:为什么相信一个结论? |
|
|
12
|
+
| Attention Ledger(注意力账本) | 帧、预算、回执与打断:注意力花在了哪里? |
|
|
13
|
+
| Manifest | 可持久化、可签名的身份、能力、承诺与限制声明 |
|
|
14
|
+
| Assignment | 把职责、权限、预算与交互契约绑定到 agent |
|
|
15
|
+
| Attention | 选择候选并记录选择理由 |
|
|
16
|
+
| Frame | 固化本轮引用、预算和显式排除项 `ignored` |
|
|
17
|
+
| Context | 将分配物化为摘要、关系与受限的详情读取 |
|
|
18
|
+
| Session | 无状态 bearer 令牌绑定的身份、根目录、权限、TTL 与上下文隔离 |
|
|
19
|
+
| Filesystem | File/Directory 树、分页读写、大纲、导入/导出/依赖图与 Office 解析 |
|
|
20
|
+
| Hook | 面向 agent 的组合 hooks:`useRead`/`useWrite`/`useDiff`/`useParse`/`useOutline` 等,只读 hook 不产生编辑 |
|
|
21
|
+
| Receipt | 记录实际成本和结果,支持审计与校准 |
|
|
22
|
+
| Compaction(压缩与剪枝) | 按明确理由剪掉冷数据或已失效对象,再用检查点替换已验证的前缀 |
|
|
23
|
+
| Fingerprint(指纹) | 定义摘要覆盖哪些内容;算法与规范化策略随摘要一起携带 |
|
|
24
|
+
| Naming(命名) | 协议、服务与工具身份的统一文法,带解析器与 catalog 摘要 |
|
|
25
|
+
|
|
26
|
+
```text
|
|
27
|
+
Attention 选择 → Frame 固化 → Context 物化 → Receipt 结算 → Ledger
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Context 使用结构树和类型化关系图。项目依赖、导入、调用与引用属于可含环的描述性关系;`depends` 单独表示先决条件。关系不会自动扩大 Frame。摘要保留来源和修订,原文按内容寻址哈希校验。结构和来源本身不证明事实正确。
|
|
31
|
+
|
|
32
|
+
## 已实现的能力
|
|
33
|
+
|
|
34
|
+
- T0–T4 证据等级、置信度限制、修订、可证伪条件、预注册与显式弃权。
|
|
35
|
+
- 预算内注意力、排除项、打断、租约、委派以及合并与仲裁。
|
|
36
|
+
- 职责与交互分配:带 RACI、权限/预算/窗口衰减、接受、证据验收与级联撤销的职责绑定;带协议角色、模式混合、节奏、升级与交接的交互契约。
|
|
37
|
+
- 签名清单与凭据、治理工作流、工具门控、带认证的本地/HTTP 通信、审计链和持久化适配器。
|
|
38
|
+
- MCP 执行、参数 Schema 校验、摘要固定与旧式握手回退,以及 A2A 发现与消息绑定。
|
|
39
|
+
- 项目树、项目依赖图、TS/JS 的部分静态导入/调用/引用图,以及知识库词法检索。
|
|
40
|
+
- Agent 工作区:`File`/`Directory` 树(指纹、字符集、bigint 行数/字节数、时间、描述/摘要/用途);分页读、CAS 原子写、按策略提取的大纲(代码/项目/文章/Office);import/export/dependency 图(Tarjan SCC、拓扑序、有界闭包);Session 身份与上下文隔离;`src/hook` 组合层;SQLite 实体与仓储。
|
|
41
|
+
- 宿主发现:以一棵结构树返回获准项目、内部模块(service/tool/controller/route/repository/model/config/test/...)、文件名、有界内容匹配,以及宿主注册的插件、服务与工具。项目节点带描述、用途与简介。
|
|
42
|
+
- Markdown、TXT、DOCX、XLSX、PPTX、TeX/LaTeX/BibTeX 的结构提取、原生定位与摘要/详情分层。
|
|
43
|
+
- `amp_protocol_workspace` v1 服务、8 个 agent 工具、本地运行时接入与 MCP stdio 服务端。
|
|
44
|
+
- 带显式策略的指纹:值使用 RFC 8785 规范化 JSON,文件按字节哈希,目录树使用域分隔的 Merkle 根,`verify` 比较算法、`kind` 与策略,而不是只比对裸十六进制字符串。未配对代理项与 `-0` 被拒绝,而不是被静默改写。
|
|
45
|
+
- 协议、服务与工具身份(`amp_protocol_*` / `amp_service_*` / `amp_tool_*`)共用一张命名表,带文法、解析器与签名的 catalog 摘要,使分派、固定与审计共用同一套拼写。
|
|
46
|
+
- 两层压缩与剪枝。`planPrune()` 为每次丢弃给出理由和回看条件;`compactLedger()` 用检查点替换已验证的冷前缀,`verifyCompaction()` 重新推导该承诺,且不会埋掉保留尾部仍然引用的条目。`pruneConcept()` 与 `compactConceptHistory()` 对概念内容和版本历史执行同样的约束。
|
|
47
|
+
|
|
48
|
+
离线解析器位于 `tools/support/`;运行时通过端口接入数据,不依赖数据库,持久化适配器与运行时核心分离。具体契约见 [Schema](docs/schemas/)、[协议示例](docs/examples/) 与 [可执行检查](tools/)。
|
|
49
|
+
|
|
50
|
+
### 职责与交互
|
|
51
|
+
|
|
52
|
+
`responsibility-assignment` 把职责、RACI、权限、预算、窗口与证据绑定到 assignee;`interaction-binding` 固定一次会话的参与方、协议角色、模式混合、节奏、升级与交接状态。两者分别由 `assignment-check` 与 `interaction-binding-check` 检查,契约位于 [docs/schemas](docs/schemas/)。`AssignmentLedger` 的 `onRevoke` 钩子可调用 `BindingLedger.revokeForAssignment()`,把职责撤销级联到交互绑定。
|
|
53
|
+
|
|
54
|
+
### 发现
|
|
55
|
+
|
|
56
|
+
`amp_tool_workspace_discover` 以一棵结构树返回获准项目。文件节点带模块分类(`service`、`tool`、`controller`、`route`、`repository`、`model`、`config`、`test`、`middleware`、`component`、`util`)、扩展名与有界内容匹配。宿主通过 `HostCatalog` 登记项目的描述、用途、简介,以及插件、服务和工具;项目元数据附在项目节点上,未登记的项目回退到 workspace 摘要。发现是只读的,不会扩大 `projectIds`;内容匹配只是发现证据,不能替代 Frame 分配后的详情读取。
|
|
57
|
+
|
|
58
|
+
## 快速开始
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
npm ci
|
|
62
|
+
npm run build
|
|
63
|
+
npm run verify
|
|
64
|
+
npm run scenario
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## 作为库使用
|
|
68
|
+
|
|
69
|
+
`npm install attention-manifest-protocol` 会安装 `lib/` 中的编译产物及其声明文件,同时附带源码、JSON Schema 与可执行检查。运行时要求 Node.js 24 及以上。包根入口提供文档中的协议核心接口,其余模块均可按子路径导入。
|
|
70
|
+
|
|
71
|
+
```js
|
|
72
|
+
import { generateSigningKey, signManifest, verifyManifest } from "attention-manifest-protocol";
|
|
73
|
+
import { Ledger } from "attention-manifest-protocol/ledger";
|
|
74
|
+
import { sha256Hex } from "attention-manifest-protocol/semantic/sha256.js";
|
|
75
|
+
import { fingerprintText, fingerprintTree, verify } from "attention-manifest-protocol/fingerprint";
|
|
76
|
+
import { ToolIds, parseId } from "attention-manifest-protocol/naming";
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
| 说明符 | 解析结果 |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `attention-manifest-protocol` | `lib/index.js`:attention、assignment、context、discover、frame、ledger、manifest、receipt、warrant |
|
|
82
|
+
| `attention-manifest-protocol/<module>` | `src/` 下每个模块对应 `lib/<module>/index.js` |
|
|
83
|
+
| `attention-manifest-protocol/<module>/<file>.js` | 单个编译后的模块 |
|
|
84
|
+
| `attention-manifest-protocol/schemas/<name>.json` | `docs/schemas/` 中的 JSON Schema |
|
|
85
|
+
|
|
86
|
+
`npm run build:lib` 重新构建 `lib/`,发布前由 `prepublishOnly` 自动执行。该构建只编译库代码,Vite 演示入口(`src/main.ts`)不在其中。
|
|
87
|
+
|
|
88
|
+
专项检查为 `npm run workspace-agent-check`、`workspace-project-check`、`workspace-diff-check`、`workspace-reactive-diff-check` 与 `workspace-*-boundary-check` 系列、`workspace-context-check`、`document-context-check`、`tex-context-check`、`governance-check`、`assignment-check`、`interaction-binding-check`、`discover-check`、`discover-agent-check`、`typecheck` 与 `typecheck:tools`。`verify` 执行完整验证链和两份类型检查。评测输入/结果以 JSON 保存在 [docs/eval](docs/eval/) 与 [docs/probes](docs/probes/),夹具与录制探针不等同于独立的人类研究或生产质量证明。
|
|
89
|
+
|
|
90
|
+
## Agent 工具
|
|
91
|
+
|
|
92
|
+
`amp_protocol_workspace` v1 的响应包含 `protocol`、`version`、`revision`、`ok`,以及 `data` 或 `error`。两种适配器共用输入 Schema;响应外层由[协议类型](src/protocol/workspace.ts)定义。除能力发现外,每个业务工具都必须提供当前 `revision`。工具名来自 [`src/naming/`](src/naming/) 中冻结的命名表;0.5 之前的 `amp_workspace_*` 拼写仍作为输入别名接受,并出现在能力响应的 `deprecatedAliases` 之下。每个 workspace 工具还以 `amp_tool_global_<leaf>` 镜像到宿主全部授权项目。
|
|
93
|
+
|
|
94
|
+
| 工具 | 用途 |
|
|
95
|
+
| --- | --- |
|
|
96
|
+
| `amp_tool_workspace_capabilities` | 发现获准项目、已登记 Frame、工具及额度 |
|
|
97
|
+
| `amp_tool_workspace_tree` | 分页读取项目根或结构子项,保留原生来源定位 |
|
|
98
|
+
| `amp_tool_workspace_query` | 使用词法 AND 与有界关系遍历返回候选 ID |
|
|
99
|
+
| `amp_tool_workspace_relations` | 分页查询依赖、调用、引用等关系与来源 |
|
|
100
|
+
| `amp_tool_workspace_discover` | 以一棵结构树返回获准项目、模块、文件名、有界内容匹配与宿主组件 |
|
|
101
|
+
| `amp_tool_workspace_materialize` | 将宿主已登记的 Frame 物化为预算内 Context |
|
|
102
|
+
| `amp_tool_workspace_read` | 按字符偏移、1-based 行或 UTF-8 字节分页读取 CAS 校验的详情;附带 `importation`/`exportation`,即该文件导入的相对文件与被哪些相对文件导入 |
|
|
103
|
+
| `amp_tool_workspace_write` | 按整个节点、行范围或 UTF-8 字节范围替换项目内容;宿主授权、CAS 与 dry-run;返回同样的 `importation`/`exportation` |
|
|
104
|
+
| `amp_tool_workspace_project` | 依据 manifest/lockfile 判定项目 brand,并交给宿主执行一条 `build`/`compile`/`run`/`test` 命令 |
|
|
105
|
+
| `amp_tool_workspace_outline` | 级联大纲:项目 → 目录 → 文件 → symbol/knowledge,带 1-based 范围与有界深度 |
|
|
106
|
+
| `amp_tool_workspace_dependency` | 项目级依赖与被依赖,附声明来源与提取方式 |
|
|
107
|
+
| `amp_tool_workspace_reactive_read` | 以 Proxy 返回树结构,属性递归懒加载并缓存 |
|
|
108
|
+
| `amp_tool_workspace_reactive_write` | 修改节点属性(`summary`/`label`/`tags`)并刷新受影响的缓存;`content` 走受控写入路径 |
|
|
109
|
+
| `amp_tool_workspace_diff_read` | 可比较的项目树,携带内容修订号与字节/行统计 |
|
|
110
|
+
| `amp_tool_workspace_diff_write` | 全文件、1-based 行拼接或 UTF-8 字节拼接写入,并返回行级 diff 与 hunks |
|
|
111
|
+
| `amp_tool_workspace_release` | 释放读取句柄,不退款,也不重新开放 Frame |
|
|
112
|
+
|
|
113
|
+
`read` 与 `write` 都要求目标已被显式分配并物化;祖先节点与发现片段不构成授权。`importation` 列出目标文件导入的相对文件(裸包名进入 `external`,其 `externalTotal`/`externalTruncated` 让 `maxFileLinks` 截断可见),`exportation` 列出导入它的相对文件,因此一次编辑不必再查一次关系。写入某个文件后,从其快照抽取的 symbol/knowledge 页会返回 `stale_detail`,直到宿主刷新快照,避免用旧字节配新修订号。`write` 自身不触碰文件系统:宿主在 `WorkspaceServiceOptions.writer` 提供写端口;未提供时会话以 `write_unavailable` 失败,而 `dryRun` 仍可预演编辑。
|
|
114
|
+
|
|
115
|
+
`project` 的判定是离线的(只看 manifest/lockfile 文件名);执行动作只会把 brand 表中的一条命令交给 `WorkspaceServiceOptions.runner`,agent 无法自带命令文本。`reactive_read`/`reactive_write` 增加每服务的注解覆盖层与子节点索引缓存:写入会递增 `cacheVersion` 并报告所有失效的祖先。`diff_read` 暴露每个文件的内容修订号,两个快照无需正文即可比较;`diff_write` 支持全文件、行、字节三种拼接并返回 hunks,复用写端口、CAS 与 dry-run。
|
|
116
|
+
|
|
117
|
+
### 文件系统工具
|
|
118
|
+
|
|
119
|
+
`amp_tool_filesystem_*` 绑定一个已认证 Session;令牌不出现在工具参数里。除 `write` 外全部只读。
|
|
120
|
+
|
|
121
|
+
| 工具 | 用途 |
|
|
122
|
+
| --- | --- |
|
|
123
|
+
| `amp_tool_filesystem_session` | 当前身份、根、权限、剩余 TTL 与配额 |
|
|
124
|
+
| `amp_tool_filesystem_file` | 返回一个 File/Directory 节点;`depth`/`offset`/`limit` 控制子树与分页 |
|
|
125
|
+
| `amp_tool_filesystem_directory` | 平铺列出一级子节点 |
|
|
126
|
+
| `amp_tool_filesystem_read` | 按 1-based 行号读取文本页;返回指纹、字符集与下一页行号 |
|
|
127
|
+
| `amp_tool_filesystem_write` | 原子写入;create/overwrite/upsert/append、CAS、dry-run |
|
|
128
|
+
| `amp_tool_filesystem_outline` | 结构化大纲;支持 `query`/`startLine`/`endLine` 过滤 |
|
|
129
|
+
| `amp_tool_filesystem_import` | 出边/入边/两向导入关系 |
|
|
130
|
+
| `amp_tool_filesystem_export` | 导出符号、签名与 re-export 边 |
|
|
131
|
+
| `amp_tool_filesystem_dependency` | 环、拓扑序、依赖/被依赖闭包 |
|
|
132
|
+
| `amp_tool_filesystem_ast` | 无损语法树:每个非空白 token、声明/块/标签层级、UTF-8 字节与行范围;只读,不执行 |
|
|
133
|
+
|
|
134
|
+
全局变体为 `amp_tool_globalfs_*`,由 [src/global/filesystem.ts](src/global/filesystem.ts) 做命名适配;它不扩大任何根或权限。
|
|
135
|
+
大纲节点带 `isFile`/`isDirectory`/`file?`/`directory?`/`path`(如 `add.py#add`)与 `range`(UTF-8 字节 + 1-based 行,bigint;JSON 中为十进制字符串)。策略覆盖代码、Vue、项目清单、Markdown/TeX/纯文本、CSS/SCSS/Sass、HTML、XML/OPML 与 Office;Office 文件由 `office.ts` 解析 DOCX/XLSX/PPTX,DOC/XLS/PPT/PUB/ACCDB 为 CFB best-effort。
|
|
136
|
+
|
|
137
|
+
### Hooks
|
|
138
|
+
|
|
139
|
+
`src/hook` 把同一组只读能力包装成带状态与订阅的组合函数;只有 `useWrite` 会落盘:
|
|
140
|
+
|
|
141
|
+
```ts
|
|
142
|
+
import { useRead, useWrite, useDiff } from "attention-manifest-protocol/hook";
|
|
143
|
+
|
|
144
|
+
const read = useRead(session);
|
|
145
|
+
await read.run({ path: "src/main.ts", maxLines: 80, includeLineNumbers: true });
|
|
146
|
+
const write = useWrite(session);
|
|
147
|
+
await write.run({ path: "src/new.ts", content: "export const value = 1;\n", mode: "create" });
|
|
148
|
+
const diff = useDiff(session);
|
|
149
|
+
await diff.run({ path: "src/new.ts", before: "" });
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
`useParse` 在各模块中返回该模块的解析结果(`useOutlineParse`、`useImportationParse`、`useExportationParse`、`useDependencyParse`、`useCodeParse`、`useProjectParse`、`useAstParse`);`useCode`/`useProject` 是组合模型,`useAst` 返回无损只读语法树。缓存命中前会校验 session revision;hook 运行可写入 `hook_runs`。
|
|
153
|
+
|
|
154
|
+
### MCP stdio 接入
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
npm run workspace-agent-demo
|
|
158
|
+
npm run workspace-agent -- --config .cache/workspace-agent.local
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
真实 MCP 客户端应直接启动 Node,避免包管理器提示混入协议 stdout。将以下绝对路径替换为实际项目目录:
|
|
162
|
+
|
|
163
|
+
```json
|
|
164
|
+
{
|
|
165
|
+
"mcpServers": {
|
|
166
|
+
"amp-workspace": {
|
|
167
|
+
"command": "node",
|
|
168
|
+
"args": [
|
|
169
|
+
"R:/project/attention-manifest-protocol/tools/workspaceAgentServer.ts",
|
|
170
|
+
"--config",
|
|
171
|
+
"R:/project/attention-manifest-protocol/.cache/workspace-agent.local"
|
|
172
|
+
]
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
可信宿主配置包含 `version: 1`、`agentId`、显式 `projectIds`、`WorkspaceSnapshot`、CAS 引用到文本的 `contents` 映射、`frames`、可选的更低 `limits`,以及可选的 `discovery.projects` / `discovery.components` 项目描述与组件登记。启动时校验内容哈希。演示生成器使用示例输入;真实宿主将获准文件清单交给 [documentScanner.ts](tools/support/documentScanner.ts) 中的 `scanStructuredWorkspace`。
|
|
179
|
+
|
|
180
|
+
stdio 适配器只在启动时读取配置;新快照或新 Frame 需要宿主更新配置并启动新实例。协议采用逐行 JSON-RPC,单条输入上限 1 MiB、配置上限 64 MiB,通知不会执行工具。支持 `2025-11-25` / `2025-06-18` 的 `initialize`,以及项目已有 `2026-07-28` 的无状态发现和逐请求元数据 profile;其他版本未宣称经过测试。
|
|
181
|
+
|
|
182
|
+
### 本地运行时接入
|
|
183
|
+
|
|
184
|
+
```ts
|
|
185
|
+
import { WorkspaceAgentService } from "./src/context/index.ts";
|
|
186
|
+
import { ToolRegistry, registerWorkspaceTools, WorkspaceToolExecutor } from "./src/module/index.ts";
|
|
187
|
+
|
|
188
|
+
const workspace = new WorkspaceAgentService({
|
|
189
|
+
agentId: frame.agent,
|
|
190
|
+
projectIds: ["project:packages/app"],
|
|
191
|
+
snapshot,
|
|
192
|
+
store,
|
|
193
|
+
});
|
|
194
|
+
workspace.registerFrame(frame, snapshot.revision);
|
|
195
|
+
const tools = new ToolRegistry();
|
|
196
|
+
registerWorkspaceTools(tools, workspace);
|
|
197
|
+
const toolExecutor = new WorkspaceToolExecutor(workspace, existingExecutor);
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
Frame、快照、ContentStore 与后备执行器由宿主提供;将 `tools` / `toolExecutor` 传入 `CognitiveRuntime`。登记、撤销和实际 Receipt 结算属于宿主接口,不暴露给模型。
|
|
201
|
+
|
|
202
|
+
### 范围、生命周期与额度
|
|
203
|
+
|
|
204
|
+
发现与查询返回元数据和候选,不授予新权限。宿主固定项目范围并登记所选 Frame。只有 active 且实际进入视图的目标可读取 detail;祖先摘要不授予整份文件的原文访问。工作区 ID 属于扩展局部键,不是全局 Ledger 身份;完整 Frame 校验、签名与策略检查仍由宿主负责。
|
|
205
|
+
|
|
206
|
+
相同参数重复物化复用同一 Context,不重复扣摘要成本,更改参数会被拒绝。释放或撤销后句柄失效,待结算记录保留。宿主通过 `pendingSettlements()` 和 `settle(contextId, receipt)` 对账并获取已归档的 ContextSnapshot。服务为内存状态,审计和重启恢复数据需由宿主持久化。
|
|
207
|
+
|
|
208
|
+
默认上限:128 个 Frame、32 个活跃读取 Context、8000 个摘要估算 token、每页 8000 个 UTF-16 单元、每个成功响应 131072 个单元、1000 次业务调用。查询深度最多 10,候选/分页最多 100 项;宿主可降低额度。摘要与成功详情页共用 Frame 的剩余估算 token,重复读取计费、释放不退款。发现、JSON 包装和模型后续消费成本不在该估算中,真实用量由 Receipt 记录。
|
|
209
|
+
|
|
210
|
+
详情偏移以 UTF-16 单元计数,`nextOffset: null` 表示结束;结构化 JSON 详情须合并完整分页后再解析。CAS 在分页前读取和校验完整内容,因此响应上限不代表底层 I/O 上限。运行时保留完整工具 JSON,`maxToolResultChars` 默认 1048576、最低可设为 128;超限返回 `tool_result_too_large`,日志保留 4000 字符预览。
|
|
211
|
+
|
|
212
|
+
服务错误码:`invalid_arguments`、`unknown_tool`、`revision_mismatch`、`not_available`、`frame_unavailable`、`budget_exhausted`、`capacity_exceeded`、`response_too_large`、`integrity_failure`、`internal_error`。超大响应显式失败,不截断结构化内容。
|
|
213
|
+
|
|
214
|
+
## 仓库结构
|
|
215
|
+
|
|
216
|
+
| 路径 | 内容 |
|
|
217
|
+
| --- | --- |
|
|
218
|
+
| [src/semantic](src/semantic/) | 无策略的基础原语:严格 SHA-256、规范化 JSON 与 I-JSON 谓词 |
|
|
219
|
+
| [src/fingerprint](src/fingerprint/) | 算法、预映像封装、策略、引用、校验、文件与 Merkle 树 |
|
|
220
|
+
| [src/naming](src/naming/) | 冻结的 ID 表、ID 文法、兼容别名与 catalog 摘要 |
|
|
221
|
+
| [src/context](src/context/) | Context 生命周期、树/图投影、CAS、工作区事实、上下文装配与 agent 服务 |
|
|
222
|
+
| [src/session](src/session/) | 身份、令牌、TTL、上下文隔离、fork/revoke/rotate |
|
|
223
|
+
| [src/file](src/file/) | File/Directory 树、元数据、分页读、原子写、会话运行时/服务、模块图与 ZIP/CFB 容器 |
|
|
224
|
+
| [src/syntax](src/syntax/) | 字符集检测/编解码、字节/行索引、语法注册表与无损只读语法树 |
|
|
225
|
+
| [src/outline](src/outline/) | 代码/文档大纲、范围与标签索引、关键字/策略注册表、React/Shell/SQL/Visual Basic 策略与 Office 解析 |
|
|
226
|
+
| [src/hook](src/hook/) | 面向 agent 的组合 hooks 与运行记录 |
|
|
227
|
+
| [src/protocol](src/protocol/) | 线上契约:信封、A2A、通道与 `amp_protocol_workspace` 接口 |
|
|
228
|
+
| [src/module](src/module/) | 模型/工具端口、MCP 适配器与执行策略 |
|
|
229
|
+
| [src/runtime](src/runtime/) | agent 回合、工具循环与治理接入 |
|
|
230
|
+
| [src/governance](src/governance/) | 清单、凭据、预算、工作流、签名与审计 |
|
|
231
|
+
| [src/structure](src/structure/) | 映射、树、队列、优先级索引、过滤器、AST 与 LRU |
|
|
232
|
+
| [src](src/) | 其他注意力、证据、账本、策略、内核与持久化领域 |
|
|
233
|
+
| [tools](tools/) | TypeScript 检查、离线扫描器、演示与探针 |
|
|
234
|
+
| [docs/schemas](docs/schemas/) / [docs/examples](docs/examples/) | 机器可读契约与协议示例 |
|
|
235
|
+
| [docs/eval](docs/eval/) / [docs/probes](docs/probes/) | 评测输入与 JSON 报告 |
|
|
236
|
+
|
|
237
|
+
## 代码风格
|
|
238
|
+
|
|
239
|
+
ESLint 检查语义和风格约束,Prettier 处理排版。命令为 `npm run lint`、`lint:fix`、`format:check`、`format`、`style-check`。配置位于 [eslint.config.mts](eslint.config.mts) 与 [prettier.config.mts](prettier.config.mts),本地规则和 printer 位于 `tools/`。
|
|
240
|
+
|
|
241
|
+
变量显式标注类型;使用箭头函数、分号、4 空格缩进、双引号和模板字符串;参数/类型参数保持单行,控制语句使用大括号,采用 `typeof(value)` 和 `=== (void 0)`。局部变量、形参与函数值使用 lowerCamelCase,模块顶层数据使用 PascalCase;源码文件名使用小写字母开头的 lowerCamelCase(如 `workspaceService.ts`、`fileGraph.ts`),不使用短横线;SQL 标识符沿用既有 snake_case。注释采用多行 JSDoc,工具指令除外。历史文件仍有 lint/format 迁移债务,功能验证通过不代表全仓风格检查通过。
|
|
242
|
+
|
|
243
|
+
## 边界与研究依据
|
|
244
|
+
|
|
245
|
+
静态依赖抽取不完整,缺失边不证明独立;Markdown/TeX 扫描器不实现全部宏或语义。摘要、关系图与长上下文应通过多跳、跨文档和变化信息任务评测。一手资料包括 [LaRA](https://proceedings.mlr.press/v267/li25dv.html)、[GraphRAG-Bench](https://arxiv.org/abs/2506.05690)、[Tree-sitter](https://tree-sitter.github.io/tree-sitter/) 与 [RFC 6920](https://www.rfc-editor.org/rfc/rfc6920.html),这些资料不直接证明 AMP 自身的有效性。
|
|
246
|
+
|
|
247
|
+
沙箱隔离、多租户、交互式 OAuth、生产部署与真实外部 agent 互通仍未完成。人类研究属于设计启发,不能推导模型具有相同机制或容量常数。来源证明完整性,不证明事实为真或拥有行动权限。
|
|
248
|
+
|
|
249
|
+
## 许可证与历史
|
|
250
|
+
|
|
251
|
+
[Apache License 2.0](LICENSE),版权所有者为 Eloy Kim,2026。再分发时保留 [NOTICE](NOTICE)、许可证与署名声明。历史见 [CHANGELOG.zh-CN.md](CHANGELOG.zh-CN.md) 与 [CHANGELOG.md](CHANGELOG.md)。
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Responsibility assignment ledger.
|
|
3
|
+
*
|
|
4
|
+
* One object answers "who is accountable for which duty, under what authority,
|
|
5
|
+
* budget and window, and what evidence discharges it". The ledger owns the
|
|
6
|
+
* lifecycle; `docs/schemas/responsibility.schema.json` owns the wire shape.
|
|
7
|
+
*
|
|
8
|
+
* Invariants deliberately mirror `src/delegate/team.ts`:
|
|
9
|
+
* authority, budget, window and depth only shrink; an assignment cannot become
|
|
10
|
+
* active without acceptance; the same duty cannot have two active owners; and
|
|
11
|
+
* conflicting duties cannot be held by one assignee over overlapping windows.
|
|
12
|
+
*/
|
|
13
|
+
import type { Budget, Digest, Id, Ref, Signature, Timestamp } from "../types/common.js";
|
|
14
|
+
import type { AssignmentAcceptance, AssignmentEvent, AssignmentEvidence, AssignmentWindow, Duty, Raci, ResponsibilityAssignment } from "./types.js";
|
|
15
|
+
export interface AssignmentLedgerOptions {
|
|
16
|
+
now: () => Timestamp;
|
|
17
|
+
/**
|
|
18
|
+
* Called once per revoked assignment, including cascaded children. Hosts
|
|
19
|
+
* use it to revoke interaction bindings and leases that cite the assignment.
|
|
20
|
+
*/
|
|
21
|
+
onRevoke?: (assignment: ResponsibilityAssignment) => void;
|
|
22
|
+
}
|
|
23
|
+
export interface AssignmentPolicy {
|
|
24
|
+
authority?: string[];
|
|
25
|
+
budget?: Budget;
|
|
26
|
+
window?: AssignmentWindow;
|
|
27
|
+
maxDepth?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Duty ids that require the assigner and assignee to be different parties
|
|
30
|
+
* and the accountable party not to be the assigner.
|
|
31
|
+
*/
|
|
32
|
+
independentDuties?: Id[];
|
|
33
|
+
}
|
|
34
|
+
export interface CreateAssignmentInput {
|
|
35
|
+
id: Id;
|
|
36
|
+
assigner: Id;
|
|
37
|
+
assignee: Id;
|
|
38
|
+
role?: string;
|
|
39
|
+
duties: Duty[];
|
|
40
|
+
raci?: Raci;
|
|
41
|
+
authority: string[];
|
|
42
|
+
budget: Budget;
|
|
43
|
+
window: AssignmentWindow;
|
|
44
|
+
parent?: Id;
|
|
45
|
+
acceptance?: AssignmentAcceptance;
|
|
46
|
+
evidence?: AssignmentEvidence;
|
|
47
|
+
out_of_scope?: string[];
|
|
48
|
+
delegable?: boolean;
|
|
49
|
+
depth?: number;
|
|
50
|
+
why: string;
|
|
51
|
+
created?: Timestamp;
|
|
52
|
+
signatures?: Signature[];
|
|
53
|
+
}
|
|
54
|
+
export interface DutyConflictRecord {
|
|
55
|
+
left: Id;
|
|
56
|
+
right: Id;
|
|
57
|
+
duty: Id;
|
|
58
|
+
other: Id;
|
|
59
|
+
assignee: Id;
|
|
60
|
+
}
|
|
61
|
+
export declare class AssignmentLedger {
|
|
62
|
+
private readonly assignments;
|
|
63
|
+
private readonly eventLog;
|
|
64
|
+
private readonly now;
|
|
65
|
+
private readonly onRevoke?;
|
|
66
|
+
constructor(options: AssignmentLedgerOptions);
|
|
67
|
+
create(input: CreateAssignmentInput, policy?: AssignmentPolicy): ResponsibilityAssignment;
|
|
68
|
+
accept(id: Id, by: Id, at: Timestamp, digest?: Digest): ResponsibilityAssignment;
|
|
69
|
+
decline(id: Id, by: Id, at: Timestamp, reason: string): ResponsibilityAssignment;
|
|
70
|
+
activate(id: Id, at: Timestamp): ResponsibilityAssignment;
|
|
71
|
+
block(id: Id, by: Id, at: Timestamp, reason: string): ResponsibilityAssignment;
|
|
72
|
+
resume(id: Id, by: Id, at: Timestamp): ResponsibilityAssignment;
|
|
73
|
+
discharge(id: Id, by: Id, at: Timestamp, produced: readonly Ref[]): ResponsibilityAssignment;
|
|
74
|
+
breach(id: Id, by: Id, at: Timestamp, reason: string): ResponsibilityAssignment;
|
|
75
|
+
revoke(id: Id, by: Id, at: Timestamp, reason: string): ResponsibilityAssignment;
|
|
76
|
+
expire(id: Id, at: Timestamp): ResponsibilityAssignment;
|
|
77
|
+
/**
|
|
78
|
+
* Expire every non-terminal assignment whose window has elapsed. Returns
|
|
79
|
+
* snapshots so a host can emit one audit record per expiry.
|
|
80
|
+
*/
|
|
81
|
+
sweep(at: Timestamp): ResponsibilityAssignment[];
|
|
82
|
+
get(id: Id): ResponsibilityAssignment;
|
|
83
|
+
find(id: Id): ResponsibilityAssignment | undefined;
|
|
84
|
+
list(): ResponsibilityAssignment[];
|
|
85
|
+
children(id: Id): ResponsibilityAssignment[];
|
|
86
|
+
events(): AssignmentEvent[];
|
|
87
|
+
coverage(dutyIds: readonly Id[]): {
|
|
88
|
+
assigned: Id[];
|
|
89
|
+
unassigned: Id[];
|
|
90
|
+
};
|
|
91
|
+
conflicts(): DutyConflictRecord[];
|
|
92
|
+
assertNoConflicts(): void;
|
|
93
|
+
/**
|
|
94
|
+
* A duty has one accountable owner. An accepted assignment already reserves
|
|
95
|
+
* the duty, so a second one is rejected before activation.
|
|
96
|
+
*/
|
|
97
|
+
private assertSingleAccountable;
|
|
98
|
+
private assertNoDutyConflict;
|
|
99
|
+
private require;
|
|
100
|
+
private requireStatus;
|
|
101
|
+
private record;
|
|
102
|
+
}
|