agentprov 0.1.1__py3-none-any.whl
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.
- agentprov/__init__.py +14 -0
- agentprov/__main__.py +8 -0
- agentprov/adapters/__init__.py +36 -0
- agentprov/adapters/account_paths.py +105 -0
- agentprov/adapters/adprov/__init__.py +9 -0
- agentprov/adapters/adprov/artefacts.toml +431 -0
- agentprov/adapters/adprov/dialect.py +160 -0
- agentprov/adapters/adprov/mapper.py +1171 -0
- agentprov/adapters/adprov/profiles/adprov-v1.profile.toml +114 -0
- agentprov/adapters/adprov/profiles/archive/adprov-v1.profile.v1.toml +100 -0
- agentprov/adapters/adprov/rules/adprov.rules.toml +566 -0
- agentprov/adapters/adprov/rules/archive/adprov.rules.v1.toml +461 -0
- agentprov/adapters/agentdojo/__init__.py +12 -0
- agentprov/adapters/agentdojo/artefacts.toml +1356 -0
- agentprov/adapters/agentdojo/capture_mapper.py +2710 -0
- agentprov/adapters/agentdojo/capture_reader.py +375 -0
- agentprov/adapters/agentdojo/census.py +230 -0
- agentprov/adapters/agentdojo/citation.py +40 -0
- agentprov/adapters/agentdojo/dialect.py +154 -0
- agentprov/adapters/agentdojo/drift_mapper.py +917 -0
- agentprov/adapters/agentdojo/ext.schema.json +87 -0
- agentprov/adapters/agentdojo/family.schema.json +296 -0
- agentprov/adapters/agentdojo/history_table.py +159 -0
- agentprov/adapters/agentdojo/hooks/__init__.py +10 -0
- agentprov/adapters/agentdojo/hooks/agentdyn.py +169 -0
- agentprov/adapters/agentdojo/hooks/autodojo.py +296 -0
- agentprov/adapters/agentdojo/hooks/defence_denial.py +125 -0
- agentprov/adapters/agentdojo/hooks/detector_abort.py +78 -0
- agentprov/adapters/agentdojo/hooks/drift.py +101 -0
- agentprov/adapters/agentdojo/hooks/mandate.py +108 -0
- agentprov/adapters/agentdojo/hooks/melon.py +104 -0
- agentprov/adapters/agentdojo/hooks/rope.py +394 -0
- agentprov/adapters/agentdojo/hooks/seagent.py +84 -0
- agentprov/adapters/agentdojo/identity.py +141 -0
- agentprov/adapters/agentdojo/layout.py +122 -0
- agentprov/adapters/agentdojo/mapper.py +1849 -0
- agentprov/adapters/agentdojo/messages_wire.py +399 -0
- agentprov/adapters/agentdojo/profile.py +388 -0
- agentprov/adapters/agentdojo/profiles/agentdojo-live.profile.toml +225 -0
- agentprov/adapters/agentdojo/profiles/agentdojo-upstream.profile.toml +324 -0
- agentprov/adapters/agentdojo/profiles/agentdyn-live.profile.toml +199 -0
- agentprov/adapters/agentdojo/profiles/agentdyn.profile.toml +318 -0
- agentprov/adapters/agentdojo/profiles/aiauthz-agentdojo.profile.toml +178 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdojo-live.profile.v1.toml +187 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdojo-live.profile.v2.toml +200 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdojo-upstream.profile.v1.toml +309 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdyn.profile.v1.toml +246 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdyn.profile.v2.toml +298 -0
- agentprov/adapters/agentdojo/profiles/archive/agentdyn.profile.v3.toml +316 -0
- agentprov/adapters/agentdojo/profiles/archive/autodojo-live.profile.v1.toml +197 -0
- agentprov/adapters/agentdojo/profiles/archive/autodojo-live.profile.v2.toml +201 -0
- agentprov/adapters/agentdojo/profiles/archive/environmentoptim-agentdojo.profile.v1.toml +176 -0
- agentprov/adapters/agentdojo/profiles/archive/geryon-agentdojo.profile.v1.toml +163 -0
- agentprov/adapters/agentdojo/profiles/archive/interbolt-agentdojo.profile.v1.toml +174 -0
- agentprov/adapters/agentdojo/profiles/archive/kongminos-agentdojo.profile.v1.toml +160 -0
- agentprov/adapters/agentdojo/profiles/archive/mandate-agentdojo-eval.profile.v1.toml +177 -0
- agentprov/adapters/agentdojo/profiles/archive/melon-agentdojo.profile.v1.toml +205 -0
- agentprov/adapters/agentdojo/profiles/archive/memo-ozdincer-agentdojo.profile.v1.toml +226 -0
- agentprov/adapters/agentdojo/profiles/archive/rope.profile.v1.toml +233 -0
- agentprov/adapters/agentdojo/profiles/archive/seagent-agentdojo.profile.v1.toml +166 -0
- agentprov/adapters/agentdojo/profiles/archive/survey-runs.profile.v1.toml +205 -0
- agentprov/adapters/agentdojo/profiles/archive/survey-runs.profile.v2.toml +208 -0
- agentprov/adapters/agentdojo/profiles/archive/tacit-agentdojo.profile.v1.toml +164 -0
- agentprov/adapters/agentdojo/profiles/authority-caps-agentdojo.profile.toml +191 -0
- agentprov/adapters/agentdojo/profiles/autodojo-live.profile.toml +211 -0
- agentprov/adapters/agentdojo/profiles/autodojo-via-rope.profile.toml +70 -0
- agentprov/adapters/agentdojo/profiles/bookkeeper-agentdojo.profile.toml +173 -0
- agentprov/adapters/agentdojo/profiles/ceferisbarov-agentdojo.profile.toml +215 -0
- agentprov/adapters/agentdojo/profiles/craibench-agentdojo.profile.toml +149 -0
- agentprov/adapters/agentdojo/profiles/dca-agentdojo.profile.toml +217 -0
- agentprov/adapters/agentdojo/profiles/drift.profile.toml +190 -0
- agentprov/adapters/agentdojo/profiles/drift1-agentdojo.profile.toml +157 -0
- agentprov/adapters/agentdojo/profiles/environmentoptim-agentdojo.profile.toml +184 -0
- agentprov/adapters/agentdojo/profiles/gate-agentdojo.profile.toml +192 -0
- agentprov/adapters/agentdojo/profiles/geryon-agentdojo.profile.toml +166 -0
- agentprov/adapters/agentdojo/profiles/glitch-agentdojo.profile.toml +169 -0
- agentprov/adapters/agentdojo/profiles/hilarytorn-trajectory-poisoning.profile.toml +152 -0
- agentprov/adapters/agentdojo/profiles/interbolt-agentdojo.profile.toml +188 -0
- agentprov/adapters/agentdojo/profiles/ipi-defenses-agentdojo.profile.toml +198 -0
- agentprov/adapters/agentdojo/profiles/kavach-agentdojo.profile.toml +199 -0
- agentprov/adapters/agentdojo/profiles/kongminos-agentdojo.profile.toml +173 -0
- agentprov/adapters/agentdojo/profiles/linyxus-agentdojo.profile.toml +173 -0
- agentprov/adapters/agentdojo/profiles/llm-lock-agentdojo.profile.toml +197 -0
- agentprov/adapters/agentdojo/profiles/mandate-agentdojo-eval.profile.toml +185 -0
- agentprov/adapters/agentdojo/profiles/melon-agentdojo.profile.toml +226 -0
- agentprov/adapters/agentdojo/profiles/memo-ozdincer-agentdojo.profile.toml +228 -0
- agentprov/adapters/agentdojo/profiles/menelaus29-ipi-multidomain.profile.toml +181 -0
- agentprov/adapters/agentdojo/profiles/mohameduk-agentdojo.profile.toml +210 -0
- agentprov/adapters/agentdojo/profiles/rope.profile.toml +239 -0
- agentprov/adapters/agentdojo/profiles/seagent-agentdojo.profile.toml +180 -0
- agentprov/adapters/agentdojo/profiles/sentry-agentdojo.profile.toml +164 -0
- agentprov/adapters/agentdojo/profiles/shreeyavarma-llm-safety.profile.toml +196 -0
- agentprov/adapters/agentdojo/profiles/survey-runs.profile.toml +227 -0
- agentprov/adapters/agentdojo/profiles/tacit-agentdojo.profile.toml +177 -0
- agentprov/adapters/agentdojo/profiles/yockcheng-prompt-injection-harness.profile.toml +158 -0
- agentprov/adapters/agentdojo/quirks.py +404 -0
- agentprov/adapters/agentdojo/redact.py +250 -0
- agentprov/adapters/agentdojo/results_mapper.py +905 -0
- agentprov/adapters/agentdojo/results_reader.py +161 -0
- agentprov/adapters/agentdojo/rules/agentdojo.rules.toml +1937 -0
- agentprov/adapters/agentdojo/rules/agentdyn.rules.toml +289 -0
- agentprov/adapters/agentdojo/rules/anthropic_messages.rules.toml +82 -0
- agentprov/adapters/agentdojo/rules/archive/agentdojo.rules.v1.toml +1394 -0
- agentprov/adapters/agentdojo/rules/archive/agentdyn.rules.v1.toml +129 -0
- agentprov/adapters/agentdojo/rules/archive/rescont.rules.v1.toml +548 -0
- agentprov/adapters/agentdojo/rules/archive/rope.rules.v1.toml +167 -0
- agentprov/adapters/agentdojo/rules/autodojo.rules.toml +35 -0
- agentprov/adapters/agentdojo/rules/defence.rules.toml +78 -0
- agentprov/adapters/agentdojo/rules/drift.rules.toml +453 -0
- agentprov/adapters/agentdojo/rules/mandate.rules.toml +69 -0
- agentprov/adapters/agentdojo/rules/rescont.rules.toml +551 -0
- agentprov/adapters/agentdojo/rules/rope.rules.toml +210 -0
- agentprov/adapters/agentdojo/rules/survey.rules.toml +49 -0
- agentprov/adapters/agentdojo/semantics/__init__.py +22 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-1/labels.toml +117 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-1/profile.toml +58 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-1/suite_tools.toml +130 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-2/labels.toml +119 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-2/profile.toml +77 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-2/reviewed_tables.toml +255 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-2/suite_tools.toml +130 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-3/labels.toml +119 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-3/profile.toml +78 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-3/reviewed_tables.toml +949 -0
- agentprov/adapters/agentdojo/semantics/agentdojo.suites-3/suite_tools.toml +130 -0
- agentprov/adapters/agentdojo/semantics/markers.py +303 -0
- agentprov/adapters/agentdojo/semantics/scoring.py +115 -0
- agentprov/adapters/agentdojo/semantics/suites.py +744 -0
- agentprov/adapters/agentdojo/tables/agentdojo-history.table.toml +407 -0
- agentprov/adapters/agentdojo/tables/agentdyn_history_pipeline_dirs.toml +21 -0
- agentprov/adapters/agentdojo/tables/agentdyn_pipeline_dirs.toml +707 -0
- agentprov/adapters/agentdojo/tables/aiauthz_run_dirs.toml +118 -0
- agentprov/adapters/agentdojo/tables/authority_caps_pipeline_dirs.toml +174 -0
- agentprov/adapters/agentdojo/tables/autodojo_cache_variant0.json +799 -0
- agentprov/adapters/agentdojo/tables/bookkeeper_pipeline_dirs.toml +79 -0
- agentprov/adapters/agentdojo/tables/dca_run_dirs.toml +207 -0
- agentprov/adapters/agentdojo/tables/drift1_model_dirs.toml +24 -0
- agentprov/adapters/agentdojo/tables/environmentoptim_run_dirs.toml +962 -0
- agentprov/adapters/agentdojo/tables/gate_pipeline_dirs.toml +99 -0
- agentprov/adapters/agentdojo/tables/geryon_log_sets.toml +285 -0
- agentprov/adapters/agentdojo/tables/interbolt_pipeline_dirs.toml +33 -0
- agentprov/adapters/agentdojo/tables/ipi_defenses_run_dirs.toml +144 -0
- agentprov/adapters/agentdojo/tables/kavach_run_dirs.toml +97 -0
- agentprov/adapters/agentdojo/tables/kongminos_pipeline_dirs.toml +15 -0
- agentprov/adapters/agentdojo/tables/linyxus_pipeline_dirs.toml +81 -0
- agentprov/adapters/agentdojo/tables/llmlock_defence_arms.toml +56 -0
- agentprov/adapters/agentdojo/tables/memo_ozdincer_containers.toml +149 -0
- agentprov/adapters/agentdojo/tables/menelaus29_experiment_dirs.toml +166 -0
- agentprov/adapters/agentdojo/tables/seagent_run_dirs.toml +290 -0
- agentprov/adapters/agentdojo/tables/sentry_pipeline_dirs.toml +24 -0
- agentprov/adapters/agentdojo/tables/shreeyavarma_pipeline_dirs.toml +14 -0
- agentprov/adapters/agentdojo/tables/tacit_model_dirs.toml +25 -0
- agentprov/adapters/agentops/__init__.py +31 -0
- agentprov/adapters/agentops/artefacts.toml +308 -0
- agentprov/adapters/agentops/dialect.py +234 -0
- agentprov/adapters/agentops/ext.schema.json +61 -0
- agentprov/adapters/agentops/family.schema.json +67 -0
- agentprov/adapters/agentops/join.py +68 -0
- agentprov/adapters/agentops/mapper.py +849 -0
- agentprov/adapters/agentops/pairing.py +47 -0
- agentprov/adapters/agentops/profiles/agentops-bench-pilot.profile.toml +208 -0
- agentprov/adapters/agentops/profiles/archive/agentops-bench-pilot.profile.v1.toml +181 -0
- agentprov/adapters/agentops/redact.py +257 -0
- agentprov/adapters/agentops/rules/agentops.rules.toml +726 -0
- agentprov/adapters/agentops/rules/archive/agentops.rules.v1.toml +710 -0
- agentprov/adapters/agentops/semantics/__init__.py +21 -0
- agentprov/adapters/agentops/semantics/agentops.tools-1/profile.toml +37 -0
- agentprov/adapters/agentops/semantics/agentops.tools-1/tools.toml +82 -0
- agentprov/adapters/agentops/semantics/agentops.tools-2/profile.toml +38 -0
- agentprov/adapters/agentops/semantics/agentops.tools-2/tools.toml +82 -0
- agentprov/adapters/agentops/semantics/tools.py +310 -0
- agentprov/adapters/agentops/tables/task_files.toml +615 -0
- agentprov/adapters/autogen/__init__.py +34 -0
- agentprov/adapters/autogen/artefacts.toml +175 -0
- agentprov/adapters/autogen/citation.py +41 -0
- agentprov/adapters/autogen/dialect.py +299 -0
- agentprov/adapters/autogen/events.py +139 -0
- agentprov/adapters/autogen/family.schema.json +82 -0
- agentprov/adapters/autogen/mapper.py +1229 -0
- agentprov/adapters/autogen/profiles/archive/autogen-guard-placement.profile.v1.toml +121 -0
- agentprov/adapters/autogen/profiles/autogen-guard-placement.profile.toml +137 -0
- agentprov/adapters/autogen/rules/autogen.rules.toml +819 -0
- agentprov/adapters/autogen/semantics/__init__.py +21 -0
- agentprov/adapters/autogen/semantics/autogen.tools-1/profile.toml +32 -0
- agentprov/adapters/autogen/semantics/autogen.tools-1/tools.toml +401 -0
- agentprov/adapters/autogen/semantics/tools.py +343 -0
- agentprov/adapters/code_verification.py +191 -0
- agentprov/adapters/credleak/__init__.py +36 -0
- agentprov/adapters/credleak/artefacts.toml +146 -0
- agentprov/adapters/credleak/dialect.py +199 -0
- agentprov/adapters/credleak/ext.schema.json +47 -0
- agentprov/adapters/credleak/family.schema.json +49 -0
- agentprov/adapters/credleak/mapper.py +618 -0
- agentprov/adapters/credleak/profiles/archive/credleak-p15b.profile.v1.toml +139 -0
- agentprov/adapters/credleak/profiles/credleak-p15b.profile.toml +201 -0
- agentprov/adapters/credleak/rates.toml +14 -0
- agentprov/adapters/credleak/redact.py +200 -0
- agentprov/adapters/credleak/rules/archive/credleak.rules.v1.toml +444 -0
- agentprov/adapters/credleak/rules/credleak.rules.toml +461 -0
- agentprov/adapters/credleak/semantics/__init__.py +155 -0
- agentprov/adapters/credleak/semantics/credleak.tools-1/tables.toml +82 -0
- agentprov/adapters/credleak/semantics/credleak.tools-2/tables.toml +85 -0
- agentprov/adapters/dtap/__init__.py +32 -0
- agentprov/adapters/dtap/artefacts.toml +545 -0
- agentprov/adapters/dtap/dialect.py +360 -0
- agentprov/adapters/dtap/ext.schema.json +98 -0
- agentprov/adapters/dtap/family.schema.json +72 -0
- agentprov/adapters/dtap/join.py +203 -0
- agentprov/adapters/dtap/mapper.py +1383 -0
- agentprov/adapters/dtap/matcher.py +109 -0
- agentprov/adapters/dtap/pairing.py +174 -0
- agentprov/adapters/dtap/profiles/archive/dtap-bench.profile.v1.toml +153 -0
- agentprov/adapters/dtap/profiles/archive/dtap-bench.profile.v2.toml +212 -0
- agentprov/adapters/dtap/profiles/dtap-bench.profile.toml +217 -0
- agentprov/adapters/dtap/rates.toml +42 -0
- agentprov/adapters/dtap/redact.py +253 -0
- agentprov/adapters/dtap/rules/archive/dtap.rules.v1.toml +1146 -0
- agentprov/adapters/dtap/rules/archive/dtap.rules.v2.toml +1163 -0
- agentprov/adapters/dtap/rules/dtap.rules.toml +1178 -0
- agentprov/adapters/dtap/semantics/__init__.py +21 -0
- agentprov/adapters/dtap/semantics/dtap.tools-1/builtins.toml +132 -0
- agentprov/adapters/dtap/semantics/dtap.tools-1/domains.toml +58 -0
- agentprov/adapters/dtap/semantics/dtap.tools-1/labels.toml +4314 -0
- agentprov/adapters/dtap/semantics/dtap.tools-1/profile.toml +37 -0
- agentprov/adapters/dtap/semantics/dtap.tools-1/servers.toml +191 -0
- agentprov/adapters/dtap/semantics/dtap.tools-2/builtins.toml +132 -0
- agentprov/adapters/dtap/semantics/dtap.tools-2/domains.toml +58 -0
- agentprov/adapters/dtap/semantics/dtap.tools-2/labels.toml +4314 -0
- agentprov/adapters/dtap/semantics/dtap.tools-2/profile.toml +38 -0
- agentprov/adapters/dtap/semantics/dtap.tools-2/servers.toml +191 -0
- agentprov/adapters/dtap/semantics/dtap.tools-3/builtins.toml +132 -0
- agentprov/adapters/dtap/semantics/dtap.tools-3/domains.toml +58 -0
- agentprov/adapters/dtap/semantics/dtap.tools-3/labels.toml +4314 -0
- agentprov/adapters/dtap/semantics/dtap.tools-3/profile.toml +40 -0
- agentprov/adapters/dtap/semantics/dtap.tools-3/servers.toml +191 -0
- agentprov/adapters/dtap/semantics/tools.py +622 -0
- agentprov/adapters/environment_load.py +35 -0
- agentprov/adapters/foobench/__init__.py +22 -0
- agentprov/adapters/foobench/artefacts.toml +59 -0
- agentprov/adapters/foobench/dialect.py +146 -0
- agentprov/adapters/foobench/ext.schema.json +51 -0
- agentprov/adapters/foobench/family.schema.json +52 -0
- agentprov/adapters/foobench/mapper.py +1089 -0
- agentprov/adapters/foobench/profiles/foobench.profile.toml +93 -0
- agentprov/adapters/foobench/rules/foobench.rules.toml +246 -0
- agentprov/adapters/foobench/semantics/__init__.py +170 -0
- agentprov/adapters/foobench/semantics/foobench.toy-1/tables.toml +87 -0
- agentprov/adapters/geminicli/__init__.py +29 -0
- agentprov/adapters/geminicli/artefacts.toml +295 -0
- agentprov/adapters/geminicli/dialect.py +249 -0
- agentprov/adapters/geminicli/ext.schema.json +60 -0
- agentprov/adapters/geminicli/family.schema.json +40 -0
- agentprov/adapters/geminicli/mapper.py +880 -0
- agentprov/adapters/geminicli/profiles/archive/code-agent-misalignment-geminicli.profile.v1.toml +165 -0
- agentprov/adapters/geminicli/profiles/code-agent-misalignment-geminicli.profile.toml +186 -0
- agentprov/adapters/geminicli/rules/geminicli.rules.toml +612 -0
- agentprov/adapters/geminicli/semantics/__init__.py +21 -0
- agentprov/adapters/geminicli/semantics/geminicli.tools-1/profile.toml +31 -0
- agentprov/adapters/geminicli/semantics/geminicli.tools-1/tools.toml +77 -0
- agentprov/adapters/geminicli/semantics/tools.py +212 -0
- agentprov/adapters/inspect/__init__.py +10 -0
- agentprov/adapters/inspect/artefacts.toml +366 -0
- agentprov/adapters/inspect/dialect.py +298 -0
- agentprov/adapters/inspect/ext.schema.json +80 -0
- agentprov/adapters/inspect/family.schema.json +89 -0
- agentprov/adapters/inspect/mapper.py +2132 -0
- agentprov/adapters/inspect/profiles/agentharm-live.profile.toml +123 -0
- agentprov/adapters/inspect/profiles/archive/controlarena-persistent.profile.v2.toml +316 -0
- agentprov/adapters/inspect/profiles/archive/controlarena-persistent.profile.v3.toml +287 -0
- agentprov/adapters/inspect/profiles/archive/fragfuse-agentharm.profile.v1.toml +138 -0
- agentprov/adapters/inspect/profiles/archive/kexin-xu-01-agentharm.profile.v1.toml +125 -0
- agentprov/adapters/inspect/profiles/archive/survey-agentharm.profile.v1.toml +119 -0
- agentprov/adapters/inspect/profiles/archive/whistlebench.profile.v1.toml +111 -0
- agentprov/adapters/inspect/profiles/atia-benchmark.profile.toml +89 -0
- agentprov/adapters/inspect/profiles/controlarena-persistent.profile.toml +306 -0
- agentprov/adapters/inspect/profiles/fragfuse-agentharm.profile.toml +165 -0
- agentprov/adapters/inspect/profiles/kexin-xu-01-agentharm.profile.toml +155 -0
- agentprov/adapters/inspect/profiles/survey-agentharm.profile.toml +137 -0
- agentprov/adapters/inspect/profiles/whistlebench.profile.toml +152 -0
- agentprov/adapters/inspect/redact.py +271 -0
- agentprov/adapters/inspect/rules/archive/inspect.rules.v1.toml +397 -0
- agentprov/adapters/inspect/rules/inspect.rules.toml +770 -0
- agentprov/adapters/inspect/semantics/__init__.py +150 -0
- agentprov/adapters/inspect/semantics/atia.py +92 -0
- agentprov/adapters/inspect/semantics/inspect.agentharm-1/tables.toml +48 -0
- agentprov/adapters/inspect/semantics/inspect.agentharm-2/tables.toml +50 -0
- agentprov/adapters/inspect/semantics/inspect.atia-1/tables.toml +23 -0
- agentprov/adapters/inspect/semantics/inspect.whistlebench-1/tables.toml +25 -0
- agentprov/adapters/inspect/semantics/inspect.whistlebench-2/tables.toml +214 -0
- agentprov/adapters/inspect/semantics/whistlebench.py +170 -0
- agentprov/adapters/mcphunt/__init__.py +30 -0
- agentprov/adapters/mcphunt/artefacts.toml +137 -0
- agentprov/adapters/mcphunt/dialect.py +188 -0
- agentprov/adapters/mcphunt/ext.schema.json +37 -0
- agentprov/adapters/mcphunt/family.schema.json +29 -0
- agentprov/adapters/mcphunt/mapper.py +881 -0
- agentprov/adapters/mcphunt/profiles/archive/mcphunt.profile.v1.toml +336 -0
- agentprov/adapters/mcphunt/profiles/archive/mcphunt.profile.v2.toml +337 -0
- agentprov/adapters/mcphunt/profiles/mcphunt.profile.toml +341 -0
- agentprov/adapters/mcphunt/rules/archive/mcphunt.rules.v1.toml +571 -0
- agentprov/adapters/mcphunt/rules/mcphunt.rules.toml +598 -0
- agentprov/adapters/mcphunt/semantics/__init__.py +21 -0
- agentprov/adapters/mcphunt/semantics/mcphunt.tools-1/profile.toml +23 -0
- agentprov/adapters/mcphunt/semantics/mcphunt.tools-1/tools.toml +76 -0
- agentprov/adapters/mcphunt/semantics/mcphunt.tools-2/profile.toml +24 -0
- agentprov/adapters/mcphunt/semantics/mcphunt.tools-2/tools.toml +76 -0
- agentprov/adapters/mcphunt/semantics/tools.py +210 -0
- agentprov/adapters/openhands/__init__.py +35 -0
- agentprov/adapters/openhands/artefacts.toml +207 -0
- agentprov/adapters/openhands/citation.py +45 -0
- agentprov/adapters/openhands/dialect.py +251 -0
- agentprov/adapters/openhands/ext.schema.json +55 -0
- agentprov/adapters/openhands/family.schema.json +67 -0
- agentprov/adapters/openhands/mapper.py +1337 -0
- agentprov/adapters/openhands/profiles/archive/openagentsafety.profile.v1.toml +110 -0
- agentprov/adapters/openhands/profiles/openagentsafety.profile.toml +134 -0
- agentprov/adapters/openhands/profiles/redcode-exec-openhands.profile.toml +198 -0
- agentprov/adapters/openhands/redact.py +193 -0
- agentprov/adapters/openhands/rules/archive/openhands.rules.v1.toml +877 -0
- agentprov/adapters/openhands/rules/openhands.rules.toml +919 -0
- agentprov/adapters/openhands/semantics/__init__.py +21 -0
- agentprov/adapters/openhands/semantics/openhands.tools-1/profile.toml +32 -0
- agentprov/adapters/openhands/semantics/openhands.tools-1/tools.toml +67 -0
- agentprov/adapters/openhands/semantics/openhands.tools-2/profile.toml +33 -0
- agentprov/adapters/openhands/semantics/openhands.tools-2/tools.toml +67 -0
- agentprov/adapters/openhands/semantics/tools.py +273 -0
- agentprov/adapters/profiles.py +278 -0
- agentprov/adapters/projection.py +159 -0
- agentprov/adapters/protocols.py +93 -0
- agentprov/adapters/qwencode/__init__.py +30 -0
- agentprov/adapters/qwencode/artefacts.toml +211 -0
- agentprov/adapters/qwencode/dialect.py +398 -0
- agentprov/adapters/qwencode/ext.schema.json +62 -0
- agentprov/adapters/qwencode/family.schema.json +105 -0
- agentprov/adapters/qwencode/mapper.py +875 -0
- agentprov/adapters/qwencode/profiles/archive/redcode-exec-qwencode.profile.v1.toml +127 -0
- agentprov/adapters/qwencode/profiles/redcode-exec-qwencode.profile.toml +142 -0
- agentprov/adapters/qwencode/rules/archive/qwencode.rules.v1.toml +562 -0
- agentprov/adapters/qwencode/rules/qwencode.rules.toml +564 -0
- agentprov/adapters/qwencode/semantics/__init__.py +21 -0
- agentprov/adapters/qwencode/semantics/qwencode.tools-1/profile.toml +35 -0
- agentprov/adapters/qwencode/semantics/qwencode.tools-1/tools.toml +69 -0
- agentprov/adapters/qwencode/semantics/qwencode.tools-2/profile.toml +39 -0
- agentprov/adapters/qwencode/semantics/qwencode.tools-2/tools.toml +69 -0
- agentprov/adapters/qwencode/semantics/tools.py +246 -0
- agentprov/adapters/registry/__init__.py +2241 -0
- agentprov/adapters/registry/claims.py +535 -0
- agentprov/adapters/registry/render.py +100 -0
- agentprov/adapters/runner/__init__.py +1101 -0
- agentprov/adapters/runner/importer.py +3277 -0
- agentprov/adapters/runner/live.py +133 -0
- agentprov/adapters/runner/provjob.py +114 -0
- agentprov/adapters/runner/session.py +349 -0
- agentprov/adapters/semantics_profiles.py +96 -0
- agentprov/adapters/surrogates.py +130 -0
- agentprov/adapters/types.py +139 -0
- agentprov/adapters/wirelog/__init__.py +33 -0
- agentprov/adapters/wirelog/artefacts.toml +168 -0
- agentprov/adapters/wirelog/dialect.py +195 -0
- agentprov/adapters/wirelog/ext.schema.json +53 -0
- agentprov/adapters/wirelog/family.schema.json +64 -0
- agentprov/adapters/wirelog/mapper.py +1079 -0
- agentprov/adapters/wirelog/profiles/what-surrounds.profile.toml +149 -0
- agentprov/adapters/wirelog/rules/wirelog.rules.toml +785 -0
- agentprov/adapters/wirelog/semantics/__init__.py +21 -0
- agentprov/adapters/wirelog/semantics/tools.py +324 -0
- agentprov/adapters/wirelog/semantics/wirelog.tools-1/documents.toml +31 -0
- agentprov/adapters/wirelog/semantics/wirelog.tools-1/profile.toml +33 -0
- agentprov/adapters/wirelog/semantics/wirelog.tools-1/tools.toml +24 -0
- agentprov/adapters/wirelog/wire.py +281 -0
- agentprov/aer/__init__.py +42 -0
- agentprov/aer/_structure.py +1144 -0
- agentprov/aer/accounting.py +405 -0
- agentprov/aer/canon.py +347 -0
- agentprov/aer/evidence.py +145 -0
- agentprov/aer/ids.py +187 -0
- agentprov/aer/locators.py +282 -0
- agentprov/aer/reader.py +222 -0
- agentprov/aer/rules/aer.rules.toml +196 -0
- agentprov/aer/rules.py +408 -0
- agentprov/aer/types.py +430 -0
- agentprov/aer/validate.py +1240 -0
- agentprov/aer/writer.py +162 -0
- agentprov/api.py +363 -0
- agentprov/artefacts/__init__.py +64 -0
- agentprov/artefacts/catalogue.py +540 -0
- agentprov/artefacts/detectors.py +473 -0
- agentprov/artefacts/scan.py +250 -0
- agentprov/cli/__init__.py +0 -0
- agentprov/cli/assist.py +527 -0
- agentprov/cli/backends.py +431 -0
- agentprov/cli/batch.py +350 -0
- agentprov/cli/checks.py +535 -0
- agentprov/cli/common.py +799 -0
- agentprov/cli/control.py +221 -0
- agentprov/cli/deposit.py +181 -0
- agentprov/cli/derive.py +422 -0
- agentprov/cli/devrun.py +227 -0
- agentprov/cli/estimate.py +324 -0
- agentprov/cli/feedback.py +996 -0
- agentprov/cli/fetch.py +393 -0
- agentprov/cli/gitinfo.py +99 -0
- agentprov/cli/import_.py +997 -0
- agentprov/cli/info.py +363 -0
- agentprov/cli/inspect.py +725 -0
- agentprov/cli/jobs.py +379 -0
- agentprov/cli/keys.py +137 -0
- agentprov/cli/live/__init__.py +15 -0
- agentprov/cli/live/assistant.py +295 -0
- agentprov/cli/live/autodojo_cache.py +301 -0
- agentprov/cli/live/campaign.py +630 -0
- agentprov/cli/live/defences.py +392 -0
- agentprov/cli/live/egress.py +532 -0
- agentprov/cli/live/envs.py +908 -0
- agentprov/cli/live/inspect_catalogue.py +145 -0
- agentprov/cli/live/localmodels.py +1091 -0
- agentprov/cli/live/policy.py +305 -0
- agentprov/cli/live/providermodels.py +356 -0
- agentprov/cli/live/quality.py +263 -0
- agentprov/cli/live/sandbox.py +205 -0
- agentprov/cli/live/staging.py +306 -0
- agentprov/cli/live/tune.py +267 -0
- agentprov/cli/live/worker.py +318 -0
- agentprov/cli/main.py +346 -0
- agentprov/cli/migrate.py +235 -0
- agentprov/cli/models.py +405 -0
- agentprov/cli/package.py +326 -0
- agentprov/cli/prices.py +223 -0
- agentprov/cli/purge.py +209 -0
- agentprov/cli/render.py +334 -0
- agentprov/cli/run.py +3071 -0
- agentprov/cli/settings_cmd.py +86 -0
- agentprov/cli/stats.py +200 -0
- agentprov/cli/verify.py +279 -0
- agentprov/corpus/__init__.py +42 -0
- agentprov/corpus/archive.py +296 -0
- agentprov/corpus/authority.py +303 -0
- agentprov/corpus/buildstep.py +205 -0
- agentprov/corpus/conformance.py +32 -0
- agentprov/corpus/datasheet.py +616 -0
- agentprov/corpus/dedup.py +28 -0
- agentprov/corpus/derive.py +2290 -0
- agentprov/corpus/facets.py +554 -0
- agentprov/corpus/index.py +765 -0
- agentprov/corpus/integrity.py +396 -0
- agentprov/corpus/layout.py +568 -0
- agentprov/corpus/licences.py +35 -0
- agentprov/corpus/manifest.py +1594 -0
- agentprov/corpus/package.py +1522 -0
- agentprov/corpus/personas.py +344 -0
- agentprov/corpus/purge.py +522 -0
- agentprov/corpus/rawtree.py +556 -0
- agentprov/corpus/reader.py +482 -0
- agentprov/corpus/register.py +352 -0
- agentprov/corpus/rowvalues.py +36 -0
- agentprov/corpus/rules/corpus.rules.toml +95 -0
- agentprov/corpus/runstate.py +61 -0
- agentprov/corpus/scratch.py +43 -0
- agentprov/corpus/selection.py +59 -0
- agentprov/corpus/shapes.py +340 -0
- agentprov/corpus/spec.py +483 -0
- agentprov/corpus/stages.py +48 -0
- agentprov/corpus/validation.py +560 -0
- agentprov/corpus/validation_job.py +73 -0
- agentprov/corpus/verify.py +1488 -0
- agentprov/corpus/withheld.py +563 -0
- agentprov/corpus/withhold.py +1161 -0
- agentprov/corpus/withhold_scan.py +502 -0
- agentprov/corpus/writer.py +503 -0
- agentprov/corpus/zip_local.py +183 -0
- agentprov/devrun/__init__.py +8 -0
- agentprov/devrun/plan.py +235 -0
- agentprov/docs/user-guide/01-install.md +157 -0
- agentprov/docs/user-guide/02-concepts.md +244 -0
- agentprov/docs/user-guide/03-sources-and-import.md +326 -0
- agentprov/docs/user-guide/04-derive-recompute-validate-verify.md +301 -0
- agentprov/docs/user-guide/05-package-and-deposit.md +484 -0
- agentprov/docs/user-guide/06-stats-and-render.md +166 -0
- agentprov/docs/user-guide/07-live-runs.md +952 -0
- agentprov/docs/user-guide/08-desktop-app.md +605 -0
- agentprov/docs/user-guide/09-safety.md +158 -0
- agentprov/docs/user-guide/10-troubleshooting.md +285 -0
- agentprov/docs/user-guide/11-cli-reference.md +4367 -0
- agentprov/docs/user-guide/12-glossary.md +128 -0
- agentprov/docs/user-guide/13-namespace.md +138 -0
- agentprov/docs/user-guide/14-corpora.md +226 -0
- agentprov/docs/user-guide/15-corpus-artefacts.md +937 -0
- agentprov/docs/user-guide/README.md +65 -0
- agentprov/drain.py +40 -0
- agentprov/envinfo.py +124 -0
- agentprov/errors.py +256 -0
- agentprov/estimate/__init__.py +19 -0
- agentprov/estimate/cost.py +366 -0
- agentprov/estimate/data/estimate_priors.json +511 -0
- agentprov/estimate/data/prices.json +396 -0
- agentprov/estimate/data/stand-in-script.json +1 -0
- agentprov/estimate/plan.py +126 -0
- agentprov/estimate/prices.py +465 -0
- agentprov/estimate/priors.py +125 -0
- agentprov/estimate/usage.py +337 -0
- agentprov/formats.py +160 -0
- agentprov/host.py +928 -0
- agentprov/ingest/__init__.py +81 -0
- agentprov/ingest/archives.py +958 -0
- agentprov/ingest/jsonspan.py +179 -0
- agentprov/ingest/jsonstream.py +465 -0
- agentprov/ingest/limits.py +179 -0
- agentprov/ingest/loaders.py +396 -0
- agentprov/ingest/names.py +113 -0
- agentprov/ingest/parts.py +128 -0
- agentprov/ingest/paths.py +534 -0
- agentprov/ingest/profile_limits.py +60 -0
- agentprov/ingest/quote.py +175 -0
- agentprov/ingest/sse.py +99 -0
- agentprov/ingest/streams.py +313 -0
- agentprov/ingest/yamlsafe.py +110 -0
- agentprov/io/__init__.py +1 -0
- agentprov/io/atomic.py +424 -0
- agentprov/io/canonical.py +124 -0
- agentprov/io/jsonschema_subset.py +195 -0
- agentprov/io/locks.py +249 -0
- agentprov/io/remove.py +89 -0
- agentprov/io/replace_retry.py +44 -0
- agentprov/io/worker_testjobs.py +280 -0
- agentprov/io/workers.py +2096 -0
- agentprov/jobs/__init__.py +10 -0
- agentprov/jobs/batch.py +317 -0
- agentprov/jobs/follow.py +379 -0
- agentprov/jobs/manager.py +493 -0
- agentprov/jobs/record.py +285 -0
- agentprov/jobs/supervisor.py +92 -0
- agentprov/jobs/tiers.py +78 -0
- agentprov/keys/__init__.py +154 -0
- agentprov/keys/helper.py +159 -0
- agentprov/migration/__init__.py +11 -0
- agentprov/migration/c6.py +437 -0
- agentprov/migration/gate_c3.py +131 -0
- agentprov/migration/gate_d.py +579 -0
- agentprov/migration/gate_d_worker.py +524 -0
- agentprov/migration/gates.py +1089 -0
- agentprov/migration/lock.py +320 -0
- agentprov/migration/pipeline.py +578 -0
- agentprov/migration/reconcile.py +284 -0
- agentprov/migration/semdiff.py +914 -0
- agentprov/migration/xd.py +229 -0
- agentprov/presets/presets.toml +89 -0
- agentprov/presets.py +1017 -0
- agentprov/progress.py +112 -0
- agentprov/prov/__init__.py +27 -0
- agentprov/prov/_ir.py +94 -0
- agentprov/prov/catalogue/agentprov-prov-0.1.toml +510 -0
- agentprov/prov/catalogue/archive/agentprov-prov-0.1.v1.toml +476 -0
- agentprov/prov/catalogue/archive/agentprov-prov-0.1.v2.toml +485 -0
- agentprov/prov/compat/__init__.py +5 -0
- agentprov/prov/compat/adprov_v2_3/PORT_MANIFEST.json +332 -0
- agentprov/prov/compat/adprov_v2_3/__init__.py +71 -0
- agentprov/prov/compat/adprov_v2_3/adprov.ttl +158 -0
- agentprov/prov/compat/adprov_v2_3/build_prov.py +524 -0
- agentprov/prov/compat/adprov_v2_3/conformance.py +607 -0
- agentprov/prov/compat/adprov_v2_3/labeling.py +175 -0
- agentprov/prov/compat/adprov_v2_3/prov_emit.py +253 -0
- agentprov/prov/compat/adprov_v2_3/serialise.py +25 -0
- agentprov/prov/compat/adprov_v2_3/validate.py +453 -0
- agentprov/prov/compat/adprov_v2_3/yaml_shim.py +24 -0
- agentprov/prov/compat/semdiff-map.toml +815 -0
- agentprov/prov/diff.py +115 -0
- agentprov/prov/engine.py +1054 -0
- agentprov/prov/evidence.py +113 -0
- agentprov/prov/iri.py +115 -0
- agentprov/prov/rules/__init__.py +1 -0
- agentprov/prov/rules/assess.py +624 -0
- agentprov/prov/rules/edges.py +587 -0
- agentprov/prov/rules/nodes.py +585 -0
- agentprov/prov/rules/top.py +247 -0
- agentprov/prov/serialise/__init__.py +1 -0
- agentprov/prov/serialise/nquads.py +48 -0
- agentprov/prov/serialise/provjson.py +24 -0
- agentprov/prov/serialise/time.py +40 -0
- agentprov/prov/serialise/trig.py +187 -0
- agentprov/prov/specs.py +169 -0
- agentprov/prov/vocab.py +107 -0
- agentprov/raw/__init__.py +61 -0
- agentprov/raw/carve.py +211 -0
- agentprov/raw/fetch.py +1622 -0
- agentprov/raw/history.py +368 -0
- agentprov/raw/members.py +1280 -0
- agentprov/raw/origins.py +484 -0
- agentprov/raw/references.py +211 -0
- agentprov/raw/store.py +595 -0
- agentprov/raw/testjobs.py +35 -0
- agentprov/release/__init__.py +54 -0
- agentprov/release/builder.py +892 -0
- agentprov/release/index.py +767 -0
- agentprov/release/metadata.py +556 -0
- agentprov/release/verify.py +478 -0
- agentprov/render/__init__.py +37 -0
- agentprov/render/dot.py +254 -0
- agentprov/render/errors.py +73 -0
- agentprov/render/graph.py +314 -0
- agentprov/render/output.py +73 -0
- agentprov/render/source.py +129 -0
- agentprov/render/style.py +333 -0
- agentprov/schemas/aer-0.1.schema.json +4272 -0
- agentprov/schemas/aer-0.2.schema.json +4339 -0
- agentprov/schemas/capture-0.1.schema.json +1830 -0
- agentprov/schemas/corpus-0.1.schema.json +4750 -0
- agentprov/schemas/corpus-0.2.schema.json +5566 -0
- agentprov/schemas/withheld-0.1.schema.json +342 -0
- agentprov/schemas/withheld-0.2.schema.json +343 -0
- agentprov/schemas/withheld-0.3.schema.json +344 -0
- agentprov/schemas/withheld-0.4.schema.json +345 -0
- agentprov/schemas/withheld-0.5.schema.json +346 -0
- agentprov/sem/__init__.py +1 -0
- agentprov/sem/engine.py +136 -0
- agentprov/sem/profiles.py +59 -0
- agentprov/sem/reader.py +113 -0
- agentprov/sem/types.py +238 -0
- agentprov/sem/validate.py +717 -0
- agentprov/settings.py +374 -0
- agentprov/stage_definitions.py +142 -0
- agentprov/stage_scopes.py +320 -0
- agentprov/stats/__init__.py +129 -0
- agentprov/stats/datasheet.py +75 -0
- agentprov/stats/exclusions.py +136 -0
- agentprov/stats/field_groups.toml +278 -0
- agentprov/stats/fieldgroups.py +460 -0
- agentprov/stats/output.py +166 -0
- agentprov/stats/source.py +268 -0
- agentprov/stats/tables.py +566 -0
- agentprov/testing/__init__.py +18 -0
- agentprov/testing/fixture_caps.py +161 -0
- agentprov/testing/fs_guard.py +140 -0
- agentprov/testing/golden.py +630 -0
- agentprov/testing/local_server.py +145 -0
- agentprov/testing/projections.py +12 -0
- agentprov/testing/sem_v23.py +153 -0
- agentprov/validate/__init__.py +28 -0
- agentprov/validate/_provdoc.py +264 -0
- agentprov/validate/cache.py +449 -0
- agentprov/validate/constraints.py +399 -0
- agentprov/validate/linkage.py +727 -0
- agentprov/validate/profiles.py +745 -0
- agentprov/validate/prov.py +100 -0
- agentprov/validate/prov_structure.py +474 -0
- agentprov/validate/roundtrip.py +416 -0
- agentprov/validate/tiers.py +171 -0
- agentprov/versions.py +41 -0
- agentprov/views/__init__.py +11 -0
- agentprov/views/transcript_v1.py +680 -0
- agentprov/views/transcript_v1_fields.toml +313 -0
- agentprov/vocab/apv-0.2.ttl +2792 -0
- agentprov/vocab/apv-adprov-map-0.1.ttl +106 -0
- agentprov/worker.py +123 -0
- agentprov-0.1.1.dist-info/METADATA +99 -0
- agentprov-0.1.1.dist-info/RECORD +659 -0
- agentprov-0.1.1.dist-info/WHEEL +4 -0
- agentprov-0.1.1.dist-info/entry_points.txt +3 -0
- agentprov-0.1.1.dist-info/licenses/LICENSE +21 -0
- agentprov-0.1.1.dist-info/licenses/THIRD_PARTY_NOTICES.md +81 -0
agentprov/cli/control.py
ADDED
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"""``--control-file``: a cross-platform drain or stop request for a running command (D-394; design.md §4.6).
|
|
2
|
+
|
|
3
|
+
A job manager (the GUI) cannot stop a job gracefully on Windows (``TerminateProcess`` is not graceful) and must not tie
|
|
4
|
+
the job to itself with a pipe. So it writes ``{"format":"agentprov-control/0.1","request":"drain"|"stop","issued":
|
|
5
|
+
"<RFC 3339>","nonce":"<16 hex>"}`` atomically to the file named by ``--control-file``, and the CLI polls it.
|
|
6
|
+
|
|
7
|
+
* **Polling.** A daemon thread ``stat``s the file at most once per ``poll_s`` (1 s): a few microseconds per poll. Only a
|
|
8
|
+
changed file (size, mtime or inode) is read, at most 4 KiB, with the strict loader. A request already in the file
|
|
9
|
+
when the command starts belongs to an earlier invocation (a drain is resumed by re-running the same argv) and is
|
|
10
|
+
ignored, as is a nonce seen before, unless it was issued at or after this process started: a job manager may write
|
|
11
|
+
a stop or drain while the command's interpreter is still starting, and that request is this run's.
|
|
12
|
+
* **``stop``** behaves like the first SIGTERM on every OS: the watcher simulates that signal in the main thread
|
|
13
|
+
(``_thread.interrupt_main``), so the command takes the clean interrupt path (seal or roll back, release the lock,
|
|
14
|
+
exit 130, N.1.10(2)).
|
|
15
|
+
* **``drain``** asks the command to finish its in-flight units, flush and exit with outcome ``drained`` (exit 0). A
|
|
16
|
+
command honours it by calling :func:`drain_supported` once and :func:`draining` at its unit boundaries. A command that
|
|
17
|
+
does not (today: all of them; ``import`` until its importer piece lands) degrades the drain to a stop, and says so.
|
|
18
|
+
* **Acknowledgement.** Every request seen is echoed as a ``control`` progress event ``{request, nonce, accepted,
|
|
19
|
+
effect}``. An invalid or unknown request is logged and acknowledged as not accepted; it never stops anything.
|
|
20
|
+
|
|
21
|
+
Nothing here reaches a corpus, a summary's bytes or a stage digest.
|
|
22
|
+
"""
|
|
23
|
+
|
|
24
|
+
from __future__ import annotations
|
|
25
|
+
|
|
26
|
+
import _thread
|
|
27
|
+
import logging
|
|
28
|
+
import os
|
|
29
|
+
import re
|
|
30
|
+
import signal
|
|
31
|
+
import threading
|
|
32
|
+
from collections.abc import Callable
|
|
33
|
+
from dataclasses import dataclass
|
|
34
|
+
from pathlib import Path
|
|
35
|
+
from typing import Final
|
|
36
|
+
|
|
37
|
+
from agentprov import drain as _drain_state
|
|
38
|
+
from agentprov.progress import NULL_PROGRESS, Progress, ProgressEvent
|
|
39
|
+
|
|
40
|
+
__all__ = [
|
|
41
|
+
"CONTROL_FORMAT",
|
|
42
|
+
"REQUESTS",
|
|
43
|
+
"ControlRequest",
|
|
44
|
+
"ControlWatcher",
|
|
45
|
+
"drain_supported",
|
|
46
|
+
"draining",
|
|
47
|
+
"reset",
|
|
48
|
+
]
|
|
49
|
+
|
|
50
|
+
CONTROL_FORMAT: Final = "agentprov-control/0.1"
|
|
51
|
+
REQUESTS: Final = ("drain", "stop")
|
|
52
|
+
POLL_S: Final = 1.0
|
|
53
|
+
_MAX_BYTES: Final = 4096
|
|
54
|
+
_NONCE = re.compile(r"[0-9a-f]{16}")
|
|
55
|
+
_LOG = logging.getLogger(__name__)
|
|
56
|
+
|
|
57
|
+
#: The drain state lives in the core (:mod:`agentprov.drain`), so library code can check it without importing the CLI.
|
|
58
|
+
drain_supported = _drain_state.drain_supported
|
|
59
|
+
draining = _drain_state.draining
|
|
60
|
+
reset = _drain_state.reset
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
@dataclass(frozen=True)
|
|
64
|
+
class ControlRequest:
|
|
65
|
+
request: str
|
|
66
|
+
nonce: str
|
|
67
|
+
issued: str
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
def parse_request(data: bytes) -> ControlRequest | str:
|
|
71
|
+
"""The request in ``data``, or the reason it is refused (never echoing the file's text)."""
|
|
72
|
+
from agentprov.errors import IngestError
|
|
73
|
+
from agentprov.ingest.loaders import strict_json_loads
|
|
74
|
+
|
|
75
|
+
if len(data) > _MAX_BYTES:
|
|
76
|
+
return "larger than 4 KiB"
|
|
77
|
+
try:
|
|
78
|
+
doc = strict_json_loads(data.strip())
|
|
79
|
+
except IngestError as exc:
|
|
80
|
+
return f"not strict JSON ({exc.code})"
|
|
81
|
+
if not isinstance(doc, dict) or doc.get("format") != CONTROL_FORMAT:
|
|
82
|
+
return f"not an {CONTROL_FORMAT} object"
|
|
83
|
+
request, nonce, issued = doc.get("request"), doc.get("nonce"), doc.get("issued")
|
|
84
|
+
if not isinstance(nonce, str) or _NONCE.fullmatch(nonce) is None:
|
|
85
|
+
return "the nonce is not 16 lower-case hex digits"
|
|
86
|
+
if not isinstance(issued, str) or not 0 < len(issued) <= 40:
|
|
87
|
+
return "issued is not a timestamp"
|
|
88
|
+
if request not in REQUESTS:
|
|
89
|
+
return "unknown request"
|
|
90
|
+
return ControlRequest(str(request), nonce, issued)
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
class ControlWatcher:
|
|
94
|
+
"""Polls one ``--control-file`` in a daemon thread; see the module docstring. ``interrupt`` stands in for the
|
|
95
|
+
simulated SIGTERM (tests)."""
|
|
96
|
+
|
|
97
|
+
def __init__(self, path: str | os.PathLike[str], *, command: str, progress: Progress = NULL_PROGRESS,
|
|
98
|
+
poll_s: float = POLL_S, interrupt: Callable[[], None] | None = None) -> None:
|
|
99
|
+
self.path = Path(path)
|
|
100
|
+
self.command = command
|
|
101
|
+
self._progress = progress
|
|
102
|
+
self._poll_s = poll_s
|
|
103
|
+
self._interrupt = interrupt or _interrupt_main
|
|
104
|
+
self._stop = threading.Event()
|
|
105
|
+
self._thread: threading.Thread | None = None
|
|
106
|
+
self._identity: tuple[int, int, int] | None = None
|
|
107
|
+
self._seen: set[str] = set()
|
|
108
|
+
#: What the last accepted request did (``stop``, ``drain``, or ``stop (drain not supported ...)``).
|
|
109
|
+
self.effect: str | None = None
|
|
110
|
+
self.accepted: ControlRequest | None = None
|
|
111
|
+
|
|
112
|
+
def _stat(self) -> tuple[int, int, int] | None:
|
|
113
|
+
try:
|
|
114
|
+
st = os.stat(self.path)
|
|
115
|
+
except OSError:
|
|
116
|
+
return None
|
|
117
|
+
return (st.st_size, st.st_mtime_ns, st.st_ino)
|
|
118
|
+
|
|
119
|
+
def _read(self) -> bytes | None:
|
|
120
|
+
try:
|
|
121
|
+
with open(self.path, "rb") as handle:
|
|
122
|
+
return handle.read(_MAX_BYTES + 1)
|
|
123
|
+
except OSError:
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
def start(self) -> None:
|
|
127
|
+
reset()
|
|
128
|
+
self._identity = self._stat()
|
|
129
|
+
if self._identity is not None: # a request left by an earlier invocation is never acted on again
|
|
130
|
+
data = self._read()
|
|
131
|
+
found = parse_request(data) if data is not None else None
|
|
132
|
+
if isinstance(found, ControlRequest):
|
|
133
|
+
if _issued_since_start(found.issued):
|
|
134
|
+
self._identity = None # this run's request, written before the watcher started: the first poll acts
|
|
135
|
+
else:
|
|
136
|
+
self._seen.add(found.nonce)
|
|
137
|
+
self._thread = threading.Thread(target=self._run, name="agentprov-control", daemon=True)
|
|
138
|
+
self._thread.start()
|
|
139
|
+
|
|
140
|
+
def close(self) -> None:
|
|
141
|
+
self._stop.set()
|
|
142
|
+
if self._thread is not None:
|
|
143
|
+
self._thread.join(timeout=2.0)
|
|
144
|
+
|
|
145
|
+
def _run(self) -> None:
|
|
146
|
+
while not self._stop.wait(self._poll_s):
|
|
147
|
+
try:
|
|
148
|
+
self.poll()
|
|
149
|
+
except Exception: # noqa: BLE001 - a broken control file never breaks the command
|
|
150
|
+
_LOG.warning("control file: poll failed", exc_info=True)
|
|
151
|
+
|
|
152
|
+
def poll(self) -> None:
|
|
153
|
+
"""One poll: act on a new request (called by the thread; tests call it directly)."""
|
|
154
|
+
identity = self._stat()
|
|
155
|
+
if identity is None or identity == self._identity:
|
|
156
|
+
return
|
|
157
|
+
self._identity = identity
|
|
158
|
+
data = self._read()
|
|
159
|
+
if data is None:
|
|
160
|
+
return
|
|
161
|
+
found = parse_request(data)
|
|
162
|
+
if isinstance(found, str):
|
|
163
|
+
_LOG.warning("control file: request ignored: %s", found)
|
|
164
|
+
self._ack("?", "?", accepted=False, effect=f"ignored: {found}")
|
|
165
|
+
return
|
|
166
|
+
if found.nonce in self._seen:
|
|
167
|
+
return
|
|
168
|
+
self._seen.add(found.nonce)
|
|
169
|
+
if self.accepted is not None and self.accepted.request == "stop":
|
|
170
|
+
self._ack(found.request, found.nonce, accepted=False, effect="ignored: a stop is already under way")
|
|
171
|
+
return
|
|
172
|
+
if found.request == "drain" and _drain_state.is_supported():
|
|
173
|
+
self.accepted, self.effect = found, "drain"
|
|
174
|
+
_drain_state.request()
|
|
175
|
+
self._ack(found.request, found.nonce, accepted=True, effect="drain")
|
|
176
|
+
return
|
|
177
|
+
effect = "stop" if found.request == "stop" else f"stop (drain is not supported by {self.command} yet)"
|
|
178
|
+
self.accepted, self.effect = found, effect
|
|
179
|
+
self._ack(found.request, found.nonce, accepted=True, effect=effect)
|
|
180
|
+
self._interrupt()
|
|
181
|
+
|
|
182
|
+
def _ack(self, request: str, nonce: str, *, accepted: bool, effect: str) -> None:
|
|
183
|
+
self._progress.emit(ProgressEvent("control", fields={"request": request, "nonce": nonce, "accepted": accepted,
|
|
184
|
+
"effect": effect}))
|
|
185
|
+
|
|
186
|
+
def notice(self) -> str | None:
|
|
187
|
+
"""The summary notice for an accepted request (the nonce, never the file's other text)."""
|
|
188
|
+
if self.accepted is None:
|
|
189
|
+
return None
|
|
190
|
+
return f"control file: {self.accepted.request} (nonce {self.accepted.nonce}): {self.effect}"
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
def _process_start() -> float:
|
|
194
|
+
"""This process's start time (epoch seconds), or now when it cannot be read (the watcher's start is a later
|
|
195
|
+
bound)."""
|
|
196
|
+
import time
|
|
197
|
+
|
|
198
|
+
from agentprov.jobs.record import process_start_time
|
|
199
|
+
|
|
200
|
+
started = process_start_time(os.getpid())
|
|
201
|
+
return time.time() if started is None else started
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
def _issued_since_start(issued: str) -> bool:
|
|
205
|
+
"""Whether a request's ``issued`` time (RFC 3339; whole seconds as the job manager writes it) is not earlier than
|
|
206
|
+
this process's start; an unreadable time is earlier."""
|
|
207
|
+
import math
|
|
208
|
+
from datetime import datetime
|
|
209
|
+
|
|
210
|
+
try:
|
|
211
|
+
when = datetime.fromisoformat(issued)
|
|
212
|
+
except ValueError:
|
|
213
|
+
return False
|
|
214
|
+
if when.tzinfo is None:
|
|
215
|
+
return False
|
|
216
|
+
return when.timestamp() >= math.floor(_process_start())
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
def _interrupt_main() -> None:
|
|
220
|
+
"""The first SIGTERM, simulated in the main thread (Windows included): the clean interrupt path."""
|
|
221
|
+
_thread.interrupt_main(getattr(signal, "SIGTERM", signal.SIGINT))
|
agentprov/cli/deposit.py
ADDED
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"""``agentprov package --deposit``: build a deposit draft from sealed corpora (MN N.2.11 deposit mode; HL H.10; D-42).
|
|
2
|
+
|
|
3
|
+
``package --deposit OUT --corpus DIR [--corpus DIR ...] --metadata release.toml --release-date YYYY-MM-DD
|
|
4
|
+
[--max-archive-bytes N] [--allow-mixed-licence-classes] [--dry-run]``. The command gathers what the offline builder
|
|
5
|
+
cannot (``release/`` runs no subprocess): the producer's git commit and cleanliness, the claims text lint of
|
|
6
|
+
:mod:`agentprov.adapters.registry.claims` (M.5.2(1)), the ``verify --level chain`` pre-archive check (H.10.1(3); U4,
|
|
7
|
+
:func:`verify_chain`) and the H.1.5(5) guard (the draft holds corpora, so it is outside
|
|
8
|
+
every git work tree unless git-ignored). Each corpus's release scan is read from ``<corpus>.release-scan.json`` beside it
|
|
9
|
+
(``tools/release_scan.py``, G.9.4). ``package`` is release mode for the interpreter guard (G.3.8).
|
|
10
|
+
|
|
11
|
+
Exit codes (N.1.3): 0 the draft was written; 1 a corpus failed verification or a generated text failed the lint; 2 usage
|
|
12
|
+
(including a malformed ``release.toml``); 3 below CPython 3.14.8; 4 a refusal (unsealed, advisory, ``test_only``,
|
|
13
|
+
``withhold``, missing or untriaged scan, mixed licence classes without the flag); 5 a corpus with ``views/``. The
|
|
14
|
+
command ends with "nothing has been uploaded or published" (D9).
|
|
15
|
+
|
|
16
|
+
The index mode (H.10.7; D-941 L-5, D-947): ``package --index OUT --part RECEIPT [--part RECEIPT ...] --corpus DIR
|
|
17
|
+
[--corpus DIR ...] --metadata release.toml --release-date YYYY-MM-DD [--dry-run]`` builds the index-only umbrella deposit
|
|
18
|
+
of a collection with :func:`agentprov.release.index.build_index`: each ``--part`` is a part record's draft receipt
|
|
19
|
+
(``complete``, with a reserved DOI), whose deposit directory lies beside it, and the ``--corpus`` directories are exactly
|
|
20
|
+
the sealed corpora those parts hold. Exit codes: 0 written; 1 a corpus check or the lint failed; 2 usage; 3 below CPython
|
|
21
|
+
3.14.8; 4 a refusal (a receipt not complete or without a DOI, a part changed since its upload, a corpus in no part or in
|
|
22
|
+
two, a digest or licence class that differs from the part's).
|
|
23
|
+
"""
|
|
24
|
+
|
|
25
|
+
from __future__ import annotations
|
|
26
|
+
|
|
27
|
+
import platform
|
|
28
|
+
import re
|
|
29
|
+
from datetime import date
|
|
30
|
+
from pathlib import Path
|
|
31
|
+
from typing import Any
|
|
32
|
+
|
|
33
|
+
from agentprov.cli.common import CliUsageError, CommandResult, Context, safe_text
|
|
34
|
+
|
|
35
|
+
__all__ = ["run_deposit", "run_index", "verify_chain"]
|
|
36
|
+
|
|
37
|
+
NOT_PUBLISHED = "Nothing has been uploaded or published."
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
def _release_date(text: str | None) -> date:
|
|
41
|
+
if text is None:
|
|
42
|
+
raise CliUsageError("agentprov package --deposit: --release-date YYYY-MM-DD is required (archive timestamps, H.10.4)")
|
|
43
|
+
try:
|
|
44
|
+
if re.fullmatch(r"[0-9]{4}-[0-9]{2}-[0-9]{2}", text) is None:
|
|
45
|
+
raise ValueError(text)
|
|
46
|
+
release_date = date.fromisoformat(text)
|
|
47
|
+
except ValueError:
|
|
48
|
+
raise CliUsageError("agentprov package: --release-date is YYYY-MM-DD") from None
|
|
49
|
+
# ZIP member timestamps end at 2107 (the low end is clamped to 1980 by the builder); refuse before any verification
|
|
50
|
+
if release_date.year > 2107:
|
|
51
|
+
raise CliUsageError("agentprov package --deposit: --release-date is at most 2107-12-31 (ZIP timestamps, H.10.4)")
|
|
52
|
+
return release_date
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
def _lint(location: str, text: str) -> list[tuple[str, str, str]]:
|
|
56
|
+
from agentprov.adapters.registry.claims import lint_text
|
|
57
|
+
|
|
58
|
+
return [(v.nc_id, v.location, v.detail) for v in lint_text(location, text)]
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def verify_chain(root: Path) -> Any:
|
|
62
|
+
"""The pre-archive verifier injected into the builder (``build_deposit(verify=...)``; H.10.1(3)): ``verify --level
|
|
63
|
+
chain`` in release mode (an unverified or tombstoned finding fails too)."""
|
|
64
|
+
from agentprov.corpus.verify import verify_corpus
|
|
65
|
+
from agentprov.release.builder import CorpusVerification
|
|
66
|
+
|
|
67
|
+
report = verify_corpus(root, level="chain")
|
|
68
|
+
detail = ", ".join(f"{code}: {n}" for code, n in report.codes().items())
|
|
69
|
+
return CorpusVerification("chain", report.passed(release=True), detail)
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def run_deposit(ctx: Context) -> CommandResult:
|
|
73
|
+
from agentprov.cli.package import _is_ignored, git_facts
|
|
74
|
+
from agentprov.corpus.layout import assert_outside_git_work_tree
|
|
75
|
+
from agentprov.release.builder import DEFAULT_MAX_ARCHIVE_BYTES, DepositProducer, build_deposit
|
|
76
|
+
from agentprov.release.metadata import parse_release_toml
|
|
77
|
+
from agentprov.versions import __version__
|
|
78
|
+
|
|
79
|
+
args = ctx.args
|
|
80
|
+
if args.deposit is None:
|
|
81
|
+
raise CliUsageError("agentprov package: --metadata, --max-archive-bytes and --allow-mixed-licence-classes belong to "
|
|
82
|
+
"the deposit mode (--deposit OUT)")
|
|
83
|
+
if args.metadata is None:
|
|
84
|
+
raise CliUsageError("agentprov package --deposit: --metadata release.toml is required (H.10.2)")
|
|
85
|
+
if args.licence_file or args.spec is not None or args.corpus_version is not None:
|
|
86
|
+
raise CliUsageError("agentprov package --deposit: --corpus-version, --spec and --licence-file belong to the seal "
|
|
87
|
+
"mode; the deposit mode takes sealed corpora")
|
|
88
|
+
release_date = _release_date(args.release_date)
|
|
89
|
+
try:
|
|
90
|
+
metadata = parse_release_toml(Path(args.metadata).read_bytes())
|
|
91
|
+
except OSError:
|
|
92
|
+
raise CliUsageError("agentprov package --deposit: the --metadata file cannot be read") from None
|
|
93
|
+
corpora = [Path(p) for p in args.corpus]
|
|
94
|
+
out = Path(args.deposit)
|
|
95
|
+
assert_outside_git_work_tree(out, is_ignored=_is_ignored) # read-only, so a dry run is refused too (CC-20)
|
|
96
|
+
commit, clean = git_facts()
|
|
97
|
+
producer = DepositProducer(agentprov_version=__version__, git_commit=commit, git_tree_clean=clean,
|
|
98
|
+
python=platform.python_version())
|
|
99
|
+
report = build_deposit(
|
|
100
|
+
corpora, metadata, out, release_date=release_date, producer=producer,
|
|
101
|
+
max_archive_bytes=DEFAULT_MAX_ARCHIVE_BYTES if args.max_archive_bytes is None else int(args.max_archive_bytes),
|
|
102
|
+
allow_mixed_licence_classes=bool(args.allow_mixed_licence_classes), lint=_lint, verify=verify_chain,
|
|
103
|
+
dry_run=bool(args.dry_run),
|
|
104
|
+
) # fmt: skip
|
|
105
|
+
result = CommandResult(dry_run=bool(args.dry_run), counters=report.counters)
|
|
106
|
+
result.notices.extend(report.notices)
|
|
107
|
+
if not clean or commit is None:
|
|
108
|
+
result.notices.append("the AgentPROV checkout is not a clean known commit; the deposit records that (producer)")
|
|
109
|
+
verb = "would write" if report.dry_run else "wrote"
|
|
110
|
+
result.output(f"deposit draft: {verb} {report.counters['archives']} archive(s) for {len(report.corpora)} corpus "
|
|
111
|
+
f"version(s) to {safe_text(str(out), 200)}")
|
|
112
|
+
for entry in report.corpora:
|
|
113
|
+
cls: dict[str, Any] = entry["licence_class"]
|
|
114
|
+
result.output(f"{entry['corpus_id']} {entry['corpus_version']}: root digest {entry['root_digest']}; licence class "
|
|
115
|
+
f"{cls['spdx']}" + (f" + {len(cls['restrictions'])} restriction(s)" if cls["restrictions"] else ""))
|
|
116
|
+
if report.mixed_licence_classes:
|
|
117
|
+
result.output("licence classes are mixed (--allow-mixed-licence-classes); recorded in deposit-metadata.json and the "
|
|
118
|
+
"datasheet copies")
|
|
119
|
+
result.output(NOT_PUBLISHED)
|
|
120
|
+
return result
|
|
121
|
+
|
|
122
|
+
|
|
123
|
+
def _index_release_date(text: str | None) -> date:
|
|
124
|
+
if text is None:
|
|
125
|
+
raise CliUsageError("agentprov package --index: --release-date YYYY-MM-DD is required (the publication date)")
|
|
126
|
+
try:
|
|
127
|
+
if re.fullmatch(r"[0-9]{4}-[0-9]{2}-[0-9]{2}", text) is None:
|
|
128
|
+
raise ValueError(text)
|
|
129
|
+
return date.fromisoformat(text)
|
|
130
|
+
except ValueError:
|
|
131
|
+
raise CliUsageError("agentprov package: --release-date is YYYY-MM-DD") from None
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def run_index(ctx: Context) -> CommandResult:
|
|
135
|
+
from agentprov.cli.package import _is_ignored, git_facts
|
|
136
|
+
from agentprov.corpus.layout import assert_outside_git_work_tree
|
|
137
|
+
from agentprov.release.builder import DepositProducer
|
|
138
|
+
from agentprov.release.index import build_index
|
|
139
|
+
from agentprov.release.metadata import LicenceClass, parse_release_toml
|
|
140
|
+
from agentprov.versions import __version__
|
|
141
|
+
|
|
142
|
+
args = ctx.args
|
|
143
|
+
if args.index is None:
|
|
144
|
+
raise CliUsageError("agentprov package: --part belongs to the index mode (--index OUT)")
|
|
145
|
+
if args.deposit is not None:
|
|
146
|
+
raise CliUsageError("agentprov package: --deposit and --index are different modes; give one")
|
|
147
|
+
if args.max_archive_bytes is not None or args.allow_mixed_licence_classes:
|
|
148
|
+
raise CliUsageError("agentprov package --index: an index has no archives and one licence class; "
|
|
149
|
+
"--max-archive-bytes and --allow-mixed-licence-classes belong to the deposit mode")
|
|
150
|
+
if args.licence_file or args.spec is not None or args.corpus_version is not None:
|
|
151
|
+
raise CliUsageError("agentprov package --index: --corpus-version, --spec and --licence-file belong to the seal "
|
|
152
|
+
"mode; the index mode takes sealed corpora")
|
|
153
|
+
if not args.part:
|
|
154
|
+
raise CliUsageError("agentprov package --index: at least one --part RECEIPT is required")
|
|
155
|
+
if args.metadata is None:
|
|
156
|
+
raise CliUsageError("agentprov package --index: --metadata release.toml is required (H.10.2)")
|
|
157
|
+
release_date = _index_release_date(args.release_date)
|
|
158
|
+
try:
|
|
159
|
+
metadata = parse_release_toml(Path(args.metadata).read_bytes())
|
|
160
|
+
except OSError:
|
|
161
|
+
raise CliUsageError("agentprov package --index: the --metadata file cannot be read") from None
|
|
162
|
+
out = Path(args.index)
|
|
163
|
+
assert_outside_git_work_tree(out, is_ignored=_is_ignored) # it holds datasheet copies; as the deposit mode (CC-20)
|
|
164
|
+
commit, clean = git_facts()
|
|
165
|
+
producer = DepositProducer(agentprov_version=__version__, git_commit=commit, git_tree_clean=clean,
|
|
166
|
+
python=platform.python_version())
|
|
167
|
+
report = build_index([Path(p) for p in args.part], [Path(p) for p in args.corpus], metadata, out,
|
|
168
|
+
release_date=release_date, producer=producer, lint=_lint, dry_run=bool(args.dry_run))
|
|
169
|
+
result = CommandResult(dry_run=bool(args.dry_run), counters=report.counters)
|
|
170
|
+
result.notices.extend(report.notices)
|
|
171
|
+
if not clean or commit is None:
|
|
172
|
+
result.notices.append("the AgentPROV checkout is not a clean known commit; the index records that (producer)")
|
|
173
|
+
verb = "would write" if report.dry_run else "wrote"
|
|
174
|
+
result.output(f"index deposit: {verb} {report.counters['documents']} file(s) for {len(report.parts)} part record(s) "
|
|
175
|
+
f"and {report.counters['corpora']} corpus version(s) on {report.target} to {safe_text(str(out), 200)}")
|
|
176
|
+
for part in report.parts:
|
|
177
|
+
cls = LicenceClass(part["licence_class"]["spdx"], tuple(part["licence_class"]["restrictions"]))
|
|
178
|
+
result.output(f"{safe_text(part['record'], 120)}: reserved DOI {part['reserved_doi']}; licence class "
|
|
179
|
+
f"{cls.label()}; corpora " + ", ".join(c["corpus_id"] for c in part["corpora"]))
|
|
180
|
+
result.output(NOT_PUBLISHED)
|
|
181
|
+
return result
|