Pysolate implementation source-owner map
当前导航对象:
agent-python-runtimetarget94fab78cb3f44d14f86d293287269b704b11d383,treea4291f77e59d680f5ef1bd21e39b323afd5c5ecf。1–12 节保留旧基线的核心 owner 导航;13–14 节记录随后新增的 Prepared Family 与 source-bound pass architecture。
读图规则
- 路径均相对 target repository;symbol 比行号稳定,目录/包名是第一导航键。
owner指拥有该状态、authority、资源关闭或 evidence 投影责任的源码 seam;不等于调用者。- 文档列是 reader-facing explained 文档:先读对应单文档,再回到 target symbol;不要把相邻 research seam 自动串接。
生命周期 source owners
1. 入口与 run admission
- Source owner:
cmd/apyrun/main.go(main,execute,runIdentity,capabilityPlan,BrokerFactory);cmd/apyrun/config.go(operatorConfig.resolve)。 - Key symbols:
runtime/request.go: DecodeRunRequest;runtime/config.go: RunConfig, DefaultRunConfig, RunConfig.Validate;runtime/outcome.go: AdmitRunRequirements, NewUnsupportedOutcome。 - 职责: Host 配置、bounded JSON、compatibility/requirements 与 deterministic admission;request 不携带 capability、credential、mount 或 budget。
- Reader → explained:
01-execution-core.md(入口/顺序/失败矩阵);需要 authority 关系再读02-authority-spine.md。
2. Guest construction
- Source owner:
runtime/engine/wazero/engine.go的Factory.New,newEngine,runWithPrepares,AnalyzeSemantic,PrepareSemanticRuntime;runtime/engine/runner.go的Runner/Properties。 - Key symbols:
takePrepared、Engine.Run/RunStream seam、projectHostEvidence;guest/include/agent_runtime_v1.h;guest/src/runtime.c的runtime_init,runtime_validate_source,runtime_prepare,execute。 - 职责: fresh module、WASI/import 安装、ABI framing、source validation、trusted prepare 与 close;prepared slot 不是 served Guest pool。
- Reader → explained:
01-execution-core.md;streamed Guest 细节转03-streaming-and-source-binding.md,COW 转08c-private-cow-and-prepared-runtime.md。
3. Capability / authority
- Source owner:
runtime/capability/registry.go(Spec,Registry.Register,Registry.Seal,Plan/Present);grant.go(Grant,NewGrant)。 - Key symbols:
runtime/capability/broker.go: NewBroker, Call/CallStreaming, Finalize;runtime/approval/controller.go: Authorize, BeginDispatch, Complete, AbortApproved。 - Bridge symbols: Wazero
instantiateCapabilityHost,hostCall;nativeruntime/capabilityrpc/registry.go: Open, Check, Dispatch。 - 职责: Host 封存
Spec + Grant → Plan,Broker 是唯一 admission/handler dispatch seam;presentation、approval、RPC 都不能铸造第二套 authority。 - Reader → explained:
02-authority-spine.md。
4. Semantic / streaming
- Source owner:
runtime/semantic/analyzer.go(Analyze,AnalyzeVerified);contract.go/legality.go(Analysis,QualifiedCall,CanPreissue*)。 - Key symbols:
runtime/semantic/prefix_execution.go: GenerateVerifiedSourceWithPreDispatch, ExecuteGeneratedSourceObserved;streaming_predispatch.go: StreamingPrefixAdmission, StreamingSemanticPreDispatch, SealFinalSource。 - Streaming symbols:
runtime/streaming/source.go: SourceStream, SourceSeal, BindObservation;runtime/streaming/observation.go;guest/bootstrap/agent_runtime/__init__.py: _StreamingSession。 - 职责: exact Guest facts → Host qualification → one-shot staged physical work → final-source gate → unchanged dynamic claim;candidate/AST 不是 authority。
- Reader → explained:
03-streaming-and-source-binding.md(三条 source lane);04-semantic-predispatch.md(qualification/claim ledger)。
5. Receipts / effect truth
- Source owner:
runtime/receipt/receipt.go(NewAuthorized,BindSource,ValidIdentity);runtime/capability/transcript.go(TransportEvidence,TranscriptEntry)。 - Key symbols:
runtime/response.go的DecodeAndValidateRunResponse、receipt/workspace validation;runtime/observe/observe.go: Session.Append, Incomplete。 - Terminal owners: Wazero
observationLifecycle.start/capabilityPlan/capabilityCalls/complete/fail;cmd/apyrun/workspace_binding.go: prepareDisposition, stageExport, publish, discard。 - 职责: Host 生成/投影 receipt、plan、call metrics、workspace disposition;这些是 bounded identity/evidence,不是 provider 或外部世界真值,也不是 rollback。
- Reader → explained:
01-execution-core.md(response/observation);02-authority-spine.md(receipt/effect);workspace 收尾读08a-workspace-lineage.md。
6. Workspace
- Source owner:
runtime/workspace/manager.go(Manager,Create,Acquire,Lease,NewTemporary);fs.go/capture.go负责 rooted FS 与 bounded capture。 - Lineage symbols:
branch_root.go: ForkBranch, Seal, SelectRoot, BindImportedRoot;attempt.go: ForkAttempt, Publish, Discard。 - Direct callers:
cmd/apyrun/workspace_binding.go的 mount/initial-final snapshot/stage-publish;runtime/streaming/run.go的 success-publish/failure-discard;runtime/subagent/orchestrator.go的 branch selection。 - 职责: Host-owned Ref/Lease、普通文件 copy、immutable Root lineage 与 private Attempt;
Publish不等于Seal,workspace copy 不等于 filesystem COW。 - Reader → explained:
08a-workspace-lineage.md。
7. Workflow / suspension
- Source owner:
runtime/workflow/evaluator.go: Graph.Validate, State.Validate, Start, Resume, evaluate, refreshObservations。 - Suspension owners: approval 仍由
runtime/approval/controller.go+runtime/capability/broker.go管;cold I/O 由runtime/engine/wazero/cold_io.go、cold_io_linux.go(wait,resume,finish) 管。 - 职责: workflow 到 Wait 后销毁 Guest,以显式 State + fresh Guest resume;approval/cold 是受限同一调用/slot 等待;普通 cancel/timeout 没有通用 resume token。
- Reader → explained:
08b-suspension-and-resume.md。
8. Prepared-data
- Source owner:
runtime/prepareddataset/decision.go: Decide, PreparationDecision.Claim;contract.go的HostPreparedDataDeclaration/NewPreparedDataContract。 - Object owners:
research/prepareddataset/staged.go: NewStagedObject, IssueRead, VerifySource, Decode, Seal, ClaimBoundMaterialization, Orphan, Cancel, Reject。 - Claim owners:
research/prepareddataset/claim_guard.go: NewPreparedDataClaimGuard, ClaimPreparedRegion;runtime/preparedregion/table.go的Claim/Close;cmd/prepared-data-authority-probe与cmd/prepared-data-claim-probe是 fixed probe seams。 - 职责: declaration/Plan/context/facts join → bounded typed staging → exact final occurrence/object-bound one-shot claim;当前是 fixed NumPy copy bridge,不是 generic object ABI/cache。
- Reader → explained:
06-prepared-data.md;机制分类和与 COW/cache 的边界读05-reuse-taxonomy.md。
9. Wazero COW
- Source owner:
runtime/engine/wazero/cow_memory_linux.go(newCOWImageWithMaximum,mapPrivate,restoreBaselineBeforeServe);非 Linux 是cow_runtime_stub.go。 - Runtime owners:
cow_runtime_linux.go(newCOWPreparedRuntimeWithTrustedSource,prepare,derive,sealCOWPreparedRuntime);engine.go的ensurePreparedWithResultAndTrustedSource,acquireCOWRuntime,closeCOWRuntime。 - 职责: sealed memfd +
MAP_PRIVATE的线性内存 baseline、active lease 和 fresh consumer;不保存 Python frame/heap/WASI/Broker state,页级共享也不等于全链路 zero-copy。 - Reader → explained:
08c-private-cow-and-prepared-runtime.md;reuse owner 对照读05-reuse-taxonomy.md。
10. Native backend
- Source owner:
runtime/engine/native/backend.go: ExecuteWithEvidence, validateConfig, reconcileRunsc;oci.go: writeOCIBundle;rootfs.go: VerifyOCIImageConfig, RootFSIdentity。 - Capability bridge:
runtime/capabilityrpc/registry.go/http.go;native/python/_agent_runtime_host.py与runner.py;runtime/verification/native.go: VerifyNative, VerifyNativeAttempt。 - 职责: image/rootfs preflight → OCI/runsc → invocation-bound Unix HTTP Broker → response/evidence → delete/cgroup/unmount/workspace cleanup;native evidence 是独立 aggregate seam。
- Reader → explained:
07-backends-package-profiles-and-placement.md(backend/placement);01-execution-core.md或02-authority-spine.md(native boundary/RPC authority)。
11. Placement / package profiles
- Source owner:
runtime/placement/placement.go: Analyze, makeDecision, Orchestrator.Execute;runtime/profile.go: NewExecutionProfile, BindVerifiedArtifact, EvaluateRunCompatibility。 - Artifact/profile owners:
runtime/artifact.go、runtime/execution_contract.go;guest/build/package_profile.py(validate_registry,resolve_profile,source_lock_projection);guest/build/verify-artifact.py/write-manifest.py。 - 职责: Host 以 state/import/requirements/profile/shard 做保守选择;当前 router 实际消费 plain/base,attrs-770 与 numpy-core 的 build/verifier support 不等于 generic multi-shard placement。
- Promotion boundary: 只有 Host-authored
UnsupportedRunError且 workspace/effect 均not_started才允许 native child;普通 Guest error 不 replay。 - Reader → explained:
07-backends-package-profiles-and-placement.md。
12. Evidence commands / docs
- Runtime evidence owners:
runtime/observe(bounded Host events,无 storage/policy);runtime/verification(identity/cleanup validator);runtime/playback(bundle identity/transport seam)。 - Reader-facing commands:
cmd/pysolate-acceptance(live/playback acceptance report);cmd/composable-acceptance-report(corpus/report revalidation);cmd/pysolate-research(inspect/compare/branch/store/lab projection)。 - Research-only owners:
research/*campaign/report packages、cmd/*probe、cmd/*campaign;它们生产 bounded report/projection,不改变 Runtime authority,也不是默认 production call chain。 - Reader → explained: 先读
01-execution-core.md的 evidence boundary,再按主题读02-authority-spine.md、06-prepared-data.md、07-backends-package-profiles-and-placement.md;不要把 historical JSON/report 当 target fresh run。
13. Prepared Family
- Input/image owners:
runtime/engine/wazero/prepared_input.go(PreparedNumpyInput,NewPreparedNumpyInput);prepared_family.go(PreparedFamily,PrepareNumpyFamily)。 - Member owners:
prepared_family_runner.go(NewRunner,PreparedFamily.Close,preparedFamilyRunner.Run,PreparedMemberRecord);prepared_lifecycle.go;prepared_family_subagent.go(PreparedFamilyRunnerFactory)。 - Guest transfer:
prepared_guest_transfer.go;guest/src/runtime.c: runtime_prepare_numpy_ndarray;guest/bootstrap/agent_runtime/__init__.py: _prepare_numpy_ndarray。 - 职责: 一个 immutable bounded NumPy input,有限个 fresh single-use member;private-copy 逐 Guest prepare,Linux private-COW 可共享 sealed image/page lineage。Invocation/workspace/terminal record 逐 member 私有,需要 capability 时再使用自己的 Plan/Broker。Family 不 schedule、retry、select 或 publish。
- Reader → explained:
09-prepared-family.md;substrate 对照08c-private-cow-and-prepared-runtime.md。
14. Source-bound pass architecture
- Registration/outcome owners:
runtime/passregistration/registration.go;runtime/passpipeline/pipeline.go。 - Existing adapters:
runtime/semantic/pass_outcome.go提供 semantic terminal-state projection adapter 和单测,但当前没有 production caller;prepared pure-region 有 static adapter/registration,保留既有 execution-patch owner,并无 equivalent outcome projection adapter。 - Static plugin/patch owners:
runtime/passplugin/registry.go;runtime/sourcepatch/sourcepatch.go;runtime/engine/wazero/engine.go: RunSourcePatchDerived;semantic_session.go: TransformSourcePass;guest/bootstrap/agent_runtime/source_pass.py。 - 职责: pass identity、stage、consumer、binding、开关,以及可复用的 bounded body-free outcome contract;pipeline 不执行 transform/Agent Python,不接管 Broker/workspace,也不决定 post-effect fallback。Scalar registry 当前不自动向 pipeline 写 whole-program record。
- Current passes:
semantic_pre_dispatch、prepared_pure_region、pure_scalar_cse、pure_scalar_fold。两个 scalar pass 是 closed bool/int64 whole-program rewrite;不是 generic optimizer。 - Reader → explained:
10-source-bound-pass-pipeline.md。
独立 seam:不要串成一条 production call chain
runtime/streaming.SourceStream是可测试的 S1 Host protocol;target 中未见它直接驱动Engine.RunStream。实际 streamed preparation 是另一条Engine.RunStream+ Guest_StreamingSessionseam。- semantic analyzer Guest、Host staged pre-dispatch 与 final fresh Guest 是三段相邻生命周期;不是 analyzer-to-final 的 same-Guest continuation。
runtime/workflow的 State resume、approval suspension、cold-I/O continuation 语义不同;不能合并成通用 checkpoint/restore。runtime/prepareddatasetcontract/decision 与research/prepareddatasetobject/claim probe 是窄 research lane;不等于runtime/engine/wazeroCOW,也不等于runtime/agentfunctionwhole-Run cache/single-flight。- Prepared Family 是显式 multi-consumer owner,但仍不等于
runtime/prepareddataset的 predictednumpy.loadoccurrence/object-claim lane;二者输入来源、logical claim 和 lifecycle 不同。 passpipeline统一 registration/outcome vocabulary,不把 semantic overlay、prepared region 与 pure source patch 合并成一条 transform/execution lifecycle。runtime/workspace的 filesystem lineage 与runtime/capability/workspace.go的内存 typed-tool workspace 是两个 package seam;前者不证明后者,反之亦然。- Wazero 与 native 各有执行、receipt/evidence、cleanup owner;native RPC completed-response replay 不是 Guest/Run replay,WASM/native 也没有字节级 response 等价证明。
- package profile registry/lock、artifact verifier、runtime profile 与 placement consumer 是四个接入点;存在 profile 不代表 router 已接通该 shard。
cmd/*acceptance、cmd/*research、research/*campaign只消费或投影 evidence;它们不能反向成为 authority issuer。本文未运行 campaign。