agent-bios 0.19.3 → 0.20.0
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/DEPENDENCIES.md +62 -20
- package/INSTALL.md +1 -1
- package/README.md +16 -21
- package/claude/agents/frontier.md +1 -1
- package/claude/agents/sweep.md +2 -1
- package/claude/agents/workhorse.md +2 -2
- package/claude/guides/claude-prompting.md +494 -167
- package/claude/guides/cli-multi-model-workflow.md +8 -7
- package/claude/guides/gpt-prompting.md +241 -111
- package/claude/guides/session-distill-workflow.md +93 -43
- package/claude/guides/tooling-gotchas.md +3 -1
- package/codex/agents/reviewer.toml +2 -2
- package/codex/agents/sweep.toml +1 -1
- package/codex/agents/workhorse.toml +2 -2
- package/codex/guides/claude-prompting.md +494 -167
- package/codex/guides/cli-multi-model-workflow.md +8 -7
- package/codex/guides/gpt-prompting.md +241 -111
- package/codex/guides/session-distill-workflow.md +93 -43
- package/codex/guides/tooling-gotchas.md +3 -1
- package/compose/assemble.py +4 -1
- package/compose/canary.sh +8 -6
- package/compose/host_platform.py +158 -15
- package/compose/instructions-state.py +183 -41
- package/compose/instructions_app.py +2 -2
- package/compose/instructions_install.py +222 -27
- package/compose/instructions_session.py +250 -75
- package/compose/instructions_setup.py +6 -6
- package/compose/instructions_setup_cli.py +2 -36
- package/compose/instructions_setup_i18n.py +3 -3
- package/compose/instructions_store.py +160 -3
- package/compose/instructions_transaction.py +29 -5
- package/compose/instructions_ui_runtime.py +2 -2
- package/compose/setup/START.md +1 -1
- package/docs/advanced-launch.md +4 -0
- package/docs/releases/0.19.4.md +99 -0
- package/docs/releases/0.20.0.md +102 -0
- package/docs/setup.md +4 -4
- package/install.sh +54 -20
- package/launch/agent-launch.py +171 -22
- package/launch/agent-launch.toml +64 -29
- package/launch/agent-launch.zsh +104 -13
- package/launch/claude_subcommands.py +179 -0
- package/launch/provision-venv.sh +1 -1
- package/launch/shell_integration.py +7 -1
- package/learn/collect-learning.py +60 -9
- package/learn/migrate-learnings.py +70 -4
- package/learn/redact.py +2 -1
- package/package.json +37 -4
- package/provenance.json +1 -1
- package/session-cost.py +141 -18
- package/session-distill/coverage.json +6 -0
- package/session-distill/distill.py +2575 -0
- package/session-distill/grammar/__init__.py +0 -0
- package/session-distill/grammar/owner_lines.py +874 -0
- package/session-distill/originators.json +9 -0
- package/session-distill/packets/cross_review.md +31 -0
- package/session-distill/packets/form.md +86 -0
- package/session-distill/packets/judge.md +81 -0
- package/session-distill/packets/placement_contract.md +90 -0
- package/session-distill/packets/propose.md +124 -0
- package/session-distill/packets/read.md +57 -0
- package/session-distill/packets/reconsider.md +53 -0
- package/session-distill/packets/s7b.md +65 -0
- package/session-distill/packets/s9b.md +39 -0
- package/session-distill/packets/stitch.md +35 -0
- package/session-distill/packets/sweep.md +33 -0
- package/session-distill/runlib/__init__.py +0 -0
- package/session-distill/runlib/bound.py +1102 -0
- package/session-distill/runlib/breaker.py +467 -0
- package/session-distill/runlib/census.py +2347 -0
- package/session-distill/runlib/claims.py +420 -0
- package/session-distill/runlib/controls.py +902 -0
- package/session-distill/runlib/coverage.py +881 -0
- package/session-distill/runlib/declare.py +888 -0
- package/session-distill/runlib/delivery_evidence.py +1145 -0
- package/session-distill/runlib/derive.py +812 -0
- package/session-distill/runlib/destinations.py +3072 -0
- package/session-distill/runlib/dispatch.py +7939 -0
- package/session-distill/runlib/drift.py +1077 -0
- package/session-distill/runlib/entry.py +401 -0
- package/session-distill/runlib/evidence.py +890 -0
- package/session-distill/runlib/exposure.py +1162 -0
- package/session-distill/runlib/gate.py +2727 -0
- package/session-distill/runlib/gitread.py +79 -0
- package/session-distill/runlib/inventory.py +19624 -0
- package/session-distill/runlib/journal.py +1919 -0
- package/session-distill/runlib/ledger.py +3210 -0
- package/session-distill/runlib/ledger_compat.py +101 -0
- package/session-distill/runlib/ledger_migration.py +190 -0
- package/session-distill/runlib/lifecycle_intake.py +693 -0
- package/session-distill/runlib/lineage.py +454 -0
- package/session-distill/runlib/measures.py +249 -0
- package/session-distill/runlib/monitor.py +1180 -0
- package/session-distill/runlib/operations.py +522 -0
- package/session-distill/runlib/packet.py +838 -0
- package/session-distill/runlib/placement.py +1769 -0
- package/session-distill/runlib/projection.py +4090 -0
- package/session-distill/runlib/ranking.py +740 -0
- package/session-distill/runlib/receipts.py +200 -0
- package/session-distill/runlib/records.py +1965 -0
- package/session-distill/runlib/search.py +249 -0
- package/session-distill/runlib/sequencing.py +829 -0
- package/session-distill/runlib/sources.py +641 -0
- package/session-distill/runlib/stage_adjudicate.py +845 -0
- package/session-distill/runlib/stage_apply.py +1378 -0
- package/session-distill/runlib/stage_approvals.py +758 -0
- package/session-distill/runlib/stage_close.py +1220 -0
- package/session-distill/runlib/stage_confirm.py +929 -0
- package/session-distill/runlib/stage_delivery.py +3080 -0
- package/session-distill/runlib/stage_form.py +2576 -0
- package/session-distill/runlib/stage_judge.py +4248 -0
- package/session-distill/runlib/stage_propose.py +3307 -0
- package/session-distill/runlib/stage_read.py +5179 -0
- package/session-distill/runlib/stage_render.py +2739 -0
- package/session-distill/runlib/stage_retrieve.py +924 -0
- package/session-distill/runlib/stage_review_korean.py +1002 -0
- package/session-distill/runlib/stage_review_proposals.py +1292 -0
- package/session-distill/runlib/stagelock.py +412 -0
- package/session-distill/runlib/stop.py +1061 -0
- package/session-distill/runlib/targets.py +809 -0
- package/session-distill/runlib/usage.py +280 -0
- package/session-distill/runlib/validate.py +319 -0
- package/session-distill/runlib/views.py +4327 -0
- package/session-distill/schemas/adjudication.schema.json +35 -0
- package/session-distill/schemas/approval.schema.json +35 -0
- package/session-distill/schemas/census.schema.json +128 -0
- package/session-distill/schemas/checks.schema.json +207 -0
- package/session-distill/schemas/claim.schema.json +16 -0
- package/session-distill/schemas/confirmation.schema.json +24 -0
- package/session-distill/schemas/coverage.schema.json +66 -0
- package/session-distill/schemas/cross_review.schema.json +24 -0
- package/session-distill/schemas/event.schema.json +20 -0
- package/session-distill/schemas/evidence.schema.json +20 -0
- package/session-distill/schemas/expected_observation.schema.json +18 -0
- package/session-distill/schemas/form.schema.json +103 -0
- package/session-distill/schemas/intake.schema.json +71 -0
- package/session-distill/schemas/inventory.schema.json +872 -0
- package/session-distill/schemas/judge.schema.json +77 -0
- package/session-distill/schemas/ledger.schema.json +313 -0
- package/session-distill/schemas/observation.schema.json +16 -0
- package/session-distill/schemas/propose.schema.json +555 -0
- package/session-distill/schemas/read.schema.json +76 -0
- package/session-distill/schemas/reconsider.schema.json +122 -0
- package/session-distill/schemas/run.schema.json +150 -0
- package/session-distill/schemas/s7b.schema.json +200 -0
- package/session-distill/schemas/s9b.schema.json +28 -0
- package/session-distill/schemas/stitch.schema.json +25 -0
- package/session-distill/schemas/sweep.schema.json +25 -0
- package/session-distill/seats.json +149 -0
- package/session-distill/tables/allowed_pairs.json +257 -0
- package/session-distill/tables/controls.json +30 -0
- package/session-distill/tables/delivery_evidence.json +36 -0
- package/session-distill/tables/delivery_evidence_fixtures.json +731 -0
- package/session-distill/tables/destinations.json +684 -0
- package/session-distill/tables/drift_layers.json +68 -0
- package/session-distill/tables/exposure_rules.json +192 -0
- package/session-distill/tables/placement_rules.json +148 -0
- package/session-distill/tables/propose_fixtures.json +154 -0
- package/session-distill/tables/ranking.json +194 -0
- package/session-distill/tables/redundancy.json +10 -0
- package/session-distill/tables/structural_rules.json +44 -0
- package/session-distill/tables/transition_fixtures.json +398 -0
- package/session-distill/tables/transitions.json +69 -0
- package/session-distill/tables/unit_outcome.json +67 -0
- package/session-distill/tables/unit_outcome_fixtures.json +2364 -0
- package/wrappers/claude-run.sh +481 -33
- package/wrappers/claude_hermetic_evidence.py +1423 -0
- package/wrappers/codex-helm.sh +44 -13
- package/wrappers/codex-run.sh +183 -20
- package/wrappers/codex_frame_filter.py +1199 -0
- package/wrappers/codex_protocol.py +737 -0
- package/wrappers/jsonl_lines.py +65 -0
package/install.sh
CHANGED
|
@@ -104,8 +104,8 @@ check_prereqs() {
|
|
|
104
104
|
command -v git >/dev/null 2>&1 || { log "missing prerequisite: git"; ok=1; }
|
|
105
105
|
command -v python3 >/dev/null 2>&1 || { log "missing prerequisite: python3"; ok=1; }
|
|
106
106
|
if command -v python3 >/dev/null 2>&1; then
|
|
107
|
-
python3 -c 'import sys; sys.exit(0 if sys.version_info>=(3,
|
|
108
|
-
|| { log "python3 >= 3.
|
|
107
|
+
python3 -c 'import sys; sys.exit(0 if sys.version_info>=(3,12) else 1)' 2>/dev/null \
|
|
108
|
+
|| { log "python3 >= 3.12 required (tomllib)"; ok=1; }
|
|
109
109
|
fi
|
|
110
110
|
command -v zsh >/dev/null 2>&1 || log "note: zsh not found; the shell hook targets zsh"
|
|
111
111
|
command -v codex >/dev/null 2>&1 || log "note: codex CLI not found; Codex-side steps will be skipped"
|
|
@@ -629,11 +629,15 @@ install_capability() {
|
|
|
629
629
|
|
|
630
630
|
handle_capabilities() {
|
|
631
631
|
local requested="$1" name command line
|
|
632
|
+
# One requested name per line, split on commas and spaces as the loop below splits them,
|
|
633
|
+
# so `grep -qx` reads a here-string rather than a pipe (see the claude-run check in verify).
|
|
634
|
+
local nl=$'\n' requested_lines
|
|
635
|
+
requested_lines="${requested//[, ]/$nl}"
|
|
632
636
|
# Fail on a typo rather than silently installing nothing.
|
|
633
637
|
local known; known=$(capability_table | cut -f1)
|
|
634
638
|
local want
|
|
635
639
|
for want in ${requested//,/ }; do
|
|
636
|
-
|
|
640
|
+
grep -qx "$want" <<<"$known" || {
|
|
637
641
|
log "unknown --with capability: $want (known: $(printf '%s' "$known" | tr '\n' ' '))"; return 1; }
|
|
638
642
|
done
|
|
639
643
|
while IFS=$'\t' read -r name command line; do
|
|
@@ -644,7 +648,7 @@ handle_capabilities() {
|
|
|
644
648
|
# the rename `--with ultracode` names the claude-backed reviewer — which needs no
|
|
645
649
|
# install — while the tool the user probably meant stays missing and is only hinted
|
|
646
650
|
# at further down. The request silently no-opped and install still exited 0.
|
|
647
|
-
if [ -z "$line" ] &&
|
|
651
|
+
if [ -z "$line" ] && grep -qx "$name" <<<"$requested_lines"; then
|
|
648
652
|
log "note: $name needs no install (it is the host CLI); nothing was installed for it"
|
|
649
653
|
local installable
|
|
650
654
|
installable=$(capability_table | awk -F'\t' -v me="$name" '$1 != me && $3 != "" { print $1 }' | tr '\n' ' ')
|
|
@@ -652,7 +656,7 @@ handle_capabilities() {
|
|
|
652
656
|
fi
|
|
653
657
|
continue
|
|
654
658
|
fi
|
|
655
|
-
if
|
|
659
|
+
if grep -qx "$name" <<<"$requested_lines"; then
|
|
656
660
|
[ -n "$line" ] && install_capability "$name" "$line" \
|
|
657
661
|
|| log "note: $name has no configured install line"
|
|
658
662
|
elif [ -n "$line" ] && [ -t 0 ] && [ "$DRY_RUN" != 1 ]; then
|
|
@@ -814,14 +818,27 @@ cmd_install() {
|
|
|
814
818
|
done
|
|
815
819
|
codex_config_additions merge || exit 1
|
|
816
820
|
deploy_file "$REPO/wrappers/codex-run.sh" "$CODEX_DIR/bin/codex-run" "+x"
|
|
821
|
+
# codex-run resolves its capture helper beside itself, so the helper lands in the same bin.
|
|
822
|
+
deploy_file "$REPO/wrappers/codex_frame_filter.py" "$CODEX_DIR/bin/codex_frame_filter.py"
|
|
823
|
+
# ...and the helper resolves the app-server client and its protocol check beside itself.
|
|
824
|
+
deploy_file "$REPO/wrappers/codex_protocol.py" "$CODEX_DIR/bin/codex_protocol.py"
|
|
817
825
|
deploy_file "$REPO/wrappers/codex-helm.sh" "$CODEX_DIR/bin/codex-helm" "+x"
|
|
818
826
|
# The claude-side adapter lands under CLAUDE_DIR for the same reason its codex twin
|
|
819
827
|
# lands under CODEX_DIR: each is that host's, and a single shared bin would make the
|
|
820
828
|
# two families' review routes indistinguishable from their install paths.
|
|
821
829
|
deploy_file "$REPO/wrappers/claude-run.sh" "$CLAUDE_DIR/bin/claude-run" "+x"
|
|
830
|
+
# Its hermetic profile resolves this helper beside itself and nowhere else.
|
|
831
|
+
deploy_file "$REPO/wrappers/claude_hermetic_evidence.py" "$CLAUDE_DIR/bin/claude_hermetic_evidence.py"
|
|
832
|
+
# ...and that helper resolves the one JSONL splitter beside itself and nowhere else.
|
|
833
|
+
deploy_file "$REPO/wrappers/jsonl_lines.py" "$CLAUDE_DIR/bin/jsonl_lines.py"
|
|
822
834
|
migrate_user_presets || exit 1 # must precede the deploy below, which overwrites profiles.toml
|
|
823
835
|
deploy_file "$REPO/launch/agent-launch.toml" "$LAUNCH_DIR/profiles.toml"
|
|
824
836
|
deploy_file "$REPO/launch/agent-launch.zsh" "$LAUNCH_DIR/shell.zsh"
|
|
837
|
+
# The wrapper runs the subcommand lister it finds beside itself.
|
|
838
|
+
deploy_file "$REPO/launch/claude_subcommands.py" "$LAUNCH_DIR/claude_subcommands.py"
|
|
839
|
+
# The launcher below lands alone in BIN_DIR, so the lock helper it loads by path (the shared
|
|
840
|
+
# bounded wait) lands beside its config, where it looks when no package is beside itself.
|
|
841
|
+
deploy_file "$REPO/compose/host_platform.py" "$LAUNCH_DIR/host_platform.py"
|
|
825
842
|
# UI text catalogs: deploy-managed siblings of the config, one per language.
|
|
826
843
|
# The launcher resolves them from the config path, so the deployed home is
|
|
827
844
|
# $LAUNCH_DIR/i18n exactly as the checkout's is launch/i18n.
|
|
@@ -897,7 +914,7 @@ cmd_install() {
|
|
|
897
914
|
info "[dry-run] project instructions-status"
|
|
898
915
|
else
|
|
899
916
|
local projection_log
|
|
900
|
-
projection_log="$(mktemp
|
|
917
|
+
projection_log="$(mktemp "${TMPDIR:-/tmp}/instructions-projection.XXXXXX")"
|
|
901
918
|
if python3 "$REPO/compose/instructions-state.py" project --repo "$REPO" >"$projection_log" 2>&1; then
|
|
902
919
|
info "instructions-status projected"
|
|
903
920
|
rm -f "$projection_log"
|
|
@@ -1054,6 +1071,8 @@ cmd_verify() {
|
|
|
1054
1071
|
verify_match "$REPO/launch/agent-launch.py" "$BIN_DIR/agent-launch" || fail=1
|
|
1055
1072
|
verify_match "$REPO/launch/agent-launch.toml" "$LAUNCH_DIR/profiles.toml" || fail=1
|
|
1056
1073
|
verify_match "$REPO/launch/agent-launch.zsh" "$LAUNCH_DIR/shell.zsh" || fail=1
|
|
1074
|
+
verify_match "$REPO/launch/claude_subcommands.py" "$LAUNCH_DIR/claude_subcommands.py" || fail=1
|
|
1075
|
+
verify_match "$REPO/compose/host_platform.py" "$LAUNCH_DIR/host_platform.py" || fail=1
|
|
1057
1076
|
# Evidence, never a verdict: a shadow that was repaired is the mechanism working.
|
|
1058
1077
|
shell_shadow_summary
|
|
1059
1078
|
# Not `whence -v`: a function redefined at preexec carries no "from FILE" annotation,
|
|
@@ -1110,6 +1129,10 @@ PY
|
|
|
1110
1129
|
# adapter would satisfy it by never running — a deploy target whose only check skips
|
|
1111
1130
|
# itself when the deploy failed is not checked at all.
|
|
1112
1131
|
verify_present "$CLAUDE_DIR/bin/claude-run" || fail=1
|
|
1132
|
+
verify_present "$CLAUDE_DIR/bin/claude_hermetic_evidence.py" || fail=1
|
|
1133
|
+
verify_present "$CLAUDE_DIR/bin/jsonl_lines.py" || fail=1
|
|
1134
|
+
verify_present "$CODEX_DIR/bin/codex_frame_filter.py" || fail=1
|
|
1135
|
+
verify_present "$CODEX_DIR/bin/codex_protocol.py" || fail=1
|
|
1113
1136
|
# Then WHICH version landed, because this file is on the panel's dispatch path now and
|
|
1114
1137
|
# an older copy would dispatch reviews that quietly emit nothing. The earlier check
|
|
1115
1138
|
# here asserted that an unpinned dispatch is refused; that guard was deliberately
|
|
@@ -1117,12 +1140,16 @@ PY
|
|
|
1117
1140
|
# "the review did not run" — so asserting it would now fail against correct behaviour.
|
|
1118
1141
|
# `--help` is the only probe that reaches no network: an unpinned run warns and then
|
|
1119
1142
|
# dispatches for real.
|
|
1143
|
+
# The help is captured before it is matched. Piped straight into `grep -q`, the match ends
|
|
1144
|
+
# grep early, claude-run takes SIGPIPE writing the rest of its help, and under pipefail
|
|
1145
|
+
# that exit reads as "no match" (gates/check-package.sh fails on the piped shape).
|
|
1120
1146
|
if [ -x "$CLAUDE_DIR/bin/claude-run" ]; then
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1147
|
+
local run_help
|
|
1148
|
+
run_help="$("$CLAUDE_DIR/bin/claude-run" --help 2>/dev/null)" || true
|
|
1149
|
+
case "$run_help" in
|
|
1150
|
+
*REVIEW_RECEIPT_DIR*) info "claude-run is receipt-aware" ;;
|
|
1151
|
+
*) log "claude-run predates the receipt contract — reviews through it emit nothing"; fail=1 ;;
|
|
1152
|
+
esac
|
|
1126
1153
|
fi
|
|
1127
1154
|
local vpy="${AGENT_LAUNCH_VENV:-$HOME/.local/share/agent-launch/venv}/bin/python"
|
|
1128
1155
|
if [ -x "$vpy" ] && "$vpy" -c 'import textual' 2>/dev/null; then
|
|
@@ -1159,7 +1186,7 @@ PY
|
|
|
1159
1186
|
# and the install-scenario harness each learned this after a failure cost an eleven-
|
|
1160
1187
|
# minute re-run that came back green; verify is where a USER meets it, with no clone to
|
|
1161
1188
|
# re-run from.
|
|
1162
|
-
parity_log="$(mktemp
|
|
1189
|
+
parity_log="$(mktemp "${TMPDIR:-/tmp}/verify-parity.XXXXXX")"
|
|
1163
1190
|
if "$REPO/gates/check-parity.sh" >"$parity_log" 2>&1; then
|
|
1164
1191
|
info "repo mirror parity OK"; rm -f "$parity_log"
|
|
1165
1192
|
else
|
|
@@ -1248,8 +1275,9 @@ cmd_uninstall() {
|
|
|
1248
1275
|
# BACKUP_DIR is set only on the manifest path above.
|
|
1249
1276
|
local p
|
|
1250
1277
|
for p in "$CODEX_DIR/bin/codex-run" "$CODEX_DIR/bin/codex-helm" \
|
|
1251
|
-
"$CLAUDE_DIR/bin/claude-run" \
|
|
1252
|
-
"$LAUNCH_DIR/profiles.toml" "$LAUNCH_DIR/shell.zsh" "$
|
|
1278
|
+
"$CLAUDE_DIR/bin/claude-run" "$CLAUDE_DIR/bin/claude_hermetic_evidence.py" "$CLAUDE_DIR/bin/jsonl_lines.py" \
|
|
1279
|
+
"$LAUNCH_DIR/profiles.toml" "$LAUNCH_DIR/shell.zsh" "$LAUNCH_DIR/claude_subcommands.py" \
|
|
1280
|
+
"$BIN_DIR/agent-launch"; do
|
|
1253
1281
|
[ -f "$p" ] && { run rm -f "$p"; [ "$DRY_RUN" = 1 ] || info "removed $p"; }
|
|
1254
1282
|
done
|
|
1255
1283
|
# Skills: only the names the shipped tree carries, mirrored under each host's skills
|
|
@@ -1479,7 +1507,7 @@ cmd_onboard() {
|
|
|
1479
1507
|
# onboarding prints a completed summary over a status file that never learned the
|
|
1480
1508
|
# selection was applied. That is the state this whole change exists to remove, so it
|
|
1481
1509
|
# cannot be the one still guarded by `|| true`.
|
|
1482
|
-
record_log="$(mktemp
|
|
1510
|
+
record_log="$(mktemp "${TMPDIR:-/tmp}/instructions-record-apply.XXXXXX")"
|
|
1483
1511
|
if ! python3 "$REPO/compose/instructions-state.py" record-apply \
|
|
1484
1512
|
--requested "$sel" --outcome applied >"$record_log" 2>&1; then
|
|
1485
1513
|
log "ONBOARDING INCOMPLETE: the instructions applied, but recording that outcome failed —"
|
|
@@ -1646,7 +1674,7 @@ cmd_status() {
|
|
|
1646
1674
|
zsh_found="$(zsh_hook_locations)"
|
|
1647
1675
|
if [ -z "$zsh_found" ]; then
|
|
1648
1676
|
info "zsh hook absent"
|
|
1649
|
-
elif
|
|
1677
|
+
elif grep -qxF "$ZSHRC" <<<"$zsh_found"; then
|
|
1650
1678
|
info "zsh hook present $(printf '%s' "$zsh_found" | tr '\n' ' ')"
|
|
1651
1679
|
else
|
|
1652
1680
|
# Present and working, but somewhere this installer will neither update nor remove.
|
|
@@ -1702,6 +1730,12 @@ refresh_update_cache() {
|
|
|
1702
1730
|
[ -n "$name" ] || return 1
|
|
1703
1731
|
now="$(date +%s)"
|
|
1704
1732
|
latest=""
|
|
1733
|
+
# npm runs on node, which cannot start in a working directory deleted under the
|
|
1734
|
+
# shell. The lookup does not depend on the directory, so a vanished one is left for
|
|
1735
|
+
# $HOME rather than reported as an unreachable registry that was never asked.
|
|
1736
|
+
if ! pwd -P >/dev/null 2>&1; then
|
|
1737
|
+
cd "$HOME" 2>/dev/null || cd /
|
|
1738
|
+
fi
|
|
1705
1739
|
if command -v npm >/dev/null 2>&1; then
|
|
1706
1740
|
# `|| latest=""` is not defensive noise: this file runs under `set -euo pipefail`,
|
|
1707
1741
|
# so an npm that exits non-zero (offline, firewalled, private registry down) makes
|
|
@@ -1852,8 +1886,8 @@ if [ "$CMD" = "import" ]; then
|
|
|
1852
1886
|
exec python3 "$REPO/compose/instructions_import.py" --repo "$REPO" "$@" <&3
|
|
1853
1887
|
fi
|
|
1854
1888
|
if [ "$CMD" = "setup" ]; then
|
|
1855
|
-
if ! command -v python3 >/dev/null 2>&1 || ! python3 -c 'import sys; sys.exit(sys.version_info < (3,
|
|
1856
|
-
log "Python 3.
|
|
1889
|
+
if ! command -v python3 >/dev/null 2>&1 || ! python3 -c 'import sys; sys.exit(sys.version_info < (3, 12))' </dev/null; then
|
|
1890
|
+
log "Python 3.12 or newer is required for conversation setup."
|
|
1857
1891
|
log "Install Python with your operating system package manager, then rerun this command."
|
|
1858
1892
|
exit 1
|
|
1859
1893
|
fi
|
|
@@ -1862,8 +1896,8 @@ fi
|
|
|
1862
1896
|
if [ "${AGENT_BIOS_LEGACY_INSTALL:-0}" != 1 ]; then
|
|
1863
1897
|
case "$CMD" in
|
|
1864
1898
|
install|onboard|verify|status|uninstall|migrate|reset)
|
|
1865
|
-
if ! command -v python3 >/dev/null 2>&1 || ! python3 -c 'import sys; sys.exit(sys.version_info < (3,
|
|
1866
|
-
log "Python 3.
|
|
1899
|
+
if ! command -v python3 >/dev/null 2>&1 || ! python3 -c 'import sys; sys.exit(sys.version_info < (3, 12))' </dev/null; then
|
|
1900
|
+
log "Python 3.12 or newer is required for the installer and dependency chooser."
|
|
1867
1901
|
log "Install Python with your operating system package manager, then rerun this command."
|
|
1868
1902
|
exit 1
|
|
1869
1903
|
fi
|
package/launch/agent-launch.py
CHANGED
|
@@ -25,9 +25,6 @@ from typing import Any, Callable, NoReturn
|
|
|
25
25
|
|
|
26
26
|
if os.name == "nt":
|
|
27
27
|
sys.path.insert(0, str(pathlib.Path(__file__).resolve().parents[1] / "compose"))
|
|
28
|
-
from host_platform import file_locks as fcntl
|
|
29
|
-
else:
|
|
30
|
-
import fcntl
|
|
31
28
|
|
|
32
29
|
|
|
33
30
|
TIER_ORDER = ("frontier", "helm", "workhorse", "sweep")
|
|
@@ -51,6 +48,21 @@ HOST_EFFORTS = {
|
|
|
51
48
|
"claude": {"low", "medium", "high", "xhigh", "max"},
|
|
52
49
|
}
|
|
53
50
|
|
|
51
|
+
# Efforts a CONCRETE model rejects although its host accepts them. A property of the
|
|
52
|
+
# model rather than of the host, so it cannot live in HOST_EFFORTS — and it is a dict
|
|
53
|
+
# rather than two inline comparisons because the inline form was written for
|
|
54
|
+
# `gpt-5.6-luna` alone and silently stopped covering anything when the sweep tier moved
|
|
55
|
+
# to `gpt-6-luna`, which rejects `ultra` just the same. Every entry must name a model the
|
|
56
|
+
# profile can actually select; a rebind that drops a model takes its row with it.
|
|
57
|
+
MODEL_EFFORT_EXCEPTIONS: dict[tuple[str, str], tuple[str, ...]] = {
|
|
58
|
+
("codex", "gpt-5.6-luna"): ("ultra",),
|
|
59
|
+
("codex", "gpt-6-luna"): ("ultra",),
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def model_rejects_effort(host: str, model: str, effort: str) -> bool:
|
|
64
|
+
return effort in MODEL_EFFORT_EXCEPTIONS.get((host, model), ())
|
|
65
|
+
|
|
54
66
|
# These read the catalog, so they are built per render rather than at import:
|
|
55
67
|
# a module-level dict would freeze whatever English existed before
|
|
56
68
|
# load_catalogs() installed the selected language. Every key is a single-line
|
|
@@ -4093,6 +4105,42 @@ class BackRequested(RuntimeError):
|
|
|
4093
4105
|
pass
|
|
4094
4106
|
|
|
4095
4107
|
|
|
4108
|
+
_LOCK_PLATFORMS: dict[pathlib.Path, Any] = {}
|
|
4109
|
+
|
|
4110
|
+
|
|
4111
|
+
def lock_platform(config_path: pathlib.Path):
|
|
4112
|
+
"""compose/host_platform.py, which owns the shared bounded lock wait (D-20261102-49b466), loaded by
|
|
4113
|
+
path under a private name: from the package this launcher runs in, or, for the compatibility
|
|
4114
|
+
install's standalone copy in ~/.local/bin, from the copy deployed beside the launcher's config.
|
|
4115
|
+
With neither, the launcher refuses naming both rather than waiting on a lock without a bound."""
|
|
4116
|
+
import importlib.util
|
|
4117
|
+
|
|
4118
|
+
candidates = (pathlib.Path(__file__).resolve().parents[1] / "compose" / "host_platform.py",
|
|
4119
|
+
config_path.with_name("host_platform.py"))
|
|
4120
|
+
for path in candidates:
|
|
4121
|
+
if path in _LOCK_PLATFORMS:
|
|
4122
|
+
return _LOCK_PLATFORMS[path]
|
|
4123
|
+
if path.is_file():
|
|
4124
|
+
spec = importlib.util.spec_from_file_location(
|
|
4125
|
+
"agent_launch_host_platform_" + hashlib.sha256(str(path).encode()).hexdigest()[:12], path)
|
|
4126
|
+
module = importlib.util.module_from_spec(spec)
|
|
4127
|
+
spec.loader.exec_module(module)
|
|
4128
|
+
_LOCK_PLATFORMS[path] = module
|
|
4129
|
+
return module
|
|
4130
|
+
raise LaunchError("the launcher's lock helper is missing (looked for "
|
|
4131
|
+
+ " and ".join(str(path) for path in candidates) + "); reinstall agent-bios")
|
|
4132
|
+
|
|
4133
|
+
|
|
4134
|
+
def lock_within(handle, name: str, config_path: pathlib.Path) -> None:
|
|
4135
|
+
"""Hold `handle`'s exclusive lock, waiting at most the shared bound; past it, a LaunchError names
|
|
4136
|
+
the lock. The launcher's writers used to wait on their locks with no deadline."""
|
|
4137
|
+
platform = lock_platform(config_path)
|
|
4138
|
+
try:
|
|
4139
|
+
platform.lock_within(handle, name)
|
|
4140
|
+
except platform.LockWaitExpired as exc:
|
|
4141
|
+
raise LaunchError(str(exc)) from exc
|
|
4142
|
+
|
|
4143
|
+
|
|
4096
4144
|
def resolve_command(value: str) -> str:
|
|
4097
4145
|
# Guarded here rather than at each call site because the callers disagree about what a
|
|
4098
4146
|
# failure means: `resolve_backend` reports it and stops, while `host_dispatch_command`
|
|
@@ -4574,8 +4622,8 @@ def validate_effort(host: str, model: str, effort: Any, context: str) -> str | N
|
|
|
4574
4622
|
return None
|
|
4575
4623
|
if not isinstance(effort, str) or effort not in HOST_EFFORTS[host]:
|
|
4576
4624
|
raise LaunchError(f"unsupported effort for {context}: {effort!r}")
|
|
4577
|
-
if host
|
|
4578
|
-
raise LaunchError(f"unsupported effort for {context}:
|
|
4625
|
+
if model_rejects_effort(host, model, effort):
|
|
4626
|
+
raise LaunchError(f"unsupported effort for {context}: {model}/{effort}")
|
|
4579
4627
|
return effort
|
|
4580
4628
|
|
|
4581
4629
|
|
|
@@ -5712,6 +5760,12 @@ def build_plan(config: dict[str, Any], host: str, preset_name: str) -> dict[str,
|
|
|
5712
5760
|
raise LaunchError(f"invalid preset or host binding: {host}/{preset_name}") from exc
|
|
5713
5761
|
if not isinstance(preset, dict) or not isinstance(tiers, dict):
|
|
5714
5762
|
raise LaunchError(f"invalid preset or host binding: {host}/{preset_name}")
|
|
5763
|
+
# The same verdict wherever a preset is named — a flag, a saved mode, a resume. The menu
|
|
5764
|
+
# withholds it; this is what makes the withholding a rule rather than a screen.
|
|
5765
|
+
if preset_withheld(preset):
|
|
5766
|
+
raise LaunchError(
|
|
5767
|
+
f"PRESET_AUTHOR_ONLY {preset_name}: the preset edits the agent-bios instructions "
|
|
5768
|
+
f"themselves and names paths only a checkout has; this tree is a packaged install")
|
|
5715
5769
|
validate_host_tiers(host, tiers)
|
|
5716
5770
|
all_overrides = preset.get("tier_overrides", {})
|
|
5717
5771
|
if not isinstance(all_overrides, dict):
|
|
@@ -6629,7 +6683,12 @@ def register_reviewer_wizard(
|
|
|
6629
6683
|
lock_path, os.O_CREAT | os.O_WRONLY | getattr(os, "O_NOFOLLOW", 0), 0o600
|
|
6630
6684
|
)
|
|
6631
6685
|
with os.fdopen(lock_fd, "w") as lock_handle:
|
|
6632
|
-
|
|
6686
|
+
try:
|
|
6687
|
+
lock_within(lock_handle, f"the launcher methods lock ({lock_path})", config_path)
|
|
6688
|
+
except LaunchError as exc:
|
|
6689
|
+
_instructions_info(ui, t("wizard.title"), [str(exc)],
|
|
6690
|
+
back_hint=t("instructions.back.hint"))
|
|
6691
|
+
return False
|
|
6633
6692
|
# Existence is part of the snapshot: a file created (or removed)
|
|
6634
6693
|
# since the trial must read as a race even when its bytes happen
|
|
6635
6694
|
# to equal the header the wizard would have invented.
|
|
@@ -7016,9 +7075,9 @@ def effort_options(host: str, model: str) -> list[MenuOption]:
|
|
|
7016
7075
|
for effort in EFFORT_ORDER:
|
|
7017
7076
|
enabled = effort in HOST_EFFORTS[host]
|
|
7018
7077
|
reason = t("effort.unsupported.host").format(host=host) if not enabled else ""
|
|
7019
|
-
if enabled and host
|
|
7078
|
+
if enabled and model_rejects_effort(host, model, effort):
|
|
7020
7079
|
enabled = False
|
|
7021
|
-
reason = t("effort.unsupported.model").format(model=
|
|
7080
|
+
reason = t("effort.unsupported.model").format(model=model)
|
|
7022
7081
|
options.append(
|
|
7023
7082
|
MenuOption(effort, effort, descriptions[effort], enabled, reason)
|
|
7024
7083
|
)
|
|
@@ -7677,7 +7736,7 @@ def save_preset(
|
|
|
7677
7736
|
lock_path = target.with_name(target.name + ".lock")
|
|
7678
7737
|
lock_fd = os.open(lock_path, os.O_CREAT | os.O_WRONLY | getattr(os, "O_NOFOLLOW", 0), 0o600)
|
|
7679
7738
|
with os.fdopen(lock_fd, "w") as lock_handle:
|
|
7680
|
-
|
|
7739
|
+
lock_within(lock_handle, f"the launcher presets lock ({lock_path})", config_path)
|
|
7681
7740
|
try:
|
|
7682
7741
|
kept = remove_preset_block(
|
|
7683
7742
|
target.read_text(encoding="utf-8"), name
|
|
@@ -8229,6 +8288,29 @@ def customize(
|
|
|
8229
8288
|
|
|
8230
8289
|
|
|
8231
8290
|
DISTILL_PRESET = "session-distill"
|
|
8291
|
+
# An author-only preset instructs its agent to edit THIS repository's instructions, so its mission
|
|
8292
|
+
# names paths that exist only in a checkout. Offering it on a packaged install offers a route whose
|
|
8293
|
+
# first step fails, which is why `compose/assemble.py` already withholds an author-only GUIDE from a
|
|
8294
|
+
# packaged user; until now the preset's own `audience = "author"` was read by the payload gate and
|
|
8295
|
+
# by nothing else, so the route stayed open.
|
|
8296
|
+
#
|
|
8297
|
+
# The marker is `gates/`, which `gates/check-package.sh` forbids the payload from carrying in both
|
|
8298
|
+
# directions. Its presence therefore IS "this tree is a checkout", and no second declaration exists
|
|
8299
|
+
# to drift from it.
|
|
8300
|
+
AUTHOR_TREE_MARKER = "gates"
|
|
8301
|
+
|
|
8302
|
+
|
|
8303
|
+
def author_tree(root: Any = None) -> bool:
|
|
8304
|
+
"""Whether the tree this launcher runs from is an agent-bios checkout."""
|
|
8305
|
+
base = pathlib.Path(root) if root is not None else pathlib.Path(__file__).resolve().parent.parent
|
|
8306
|
+
return (base / AUTHOR_TREE_MARKER).is_dir()
|
|
8307
|
+
|
|
8308
|
+
|
|
8309
|
+
def preset_withheld(preset: dict[str, Any], root: Any = None) -> bool:
|
|
8310
|
+
"""Whether this preset must not be offered or launched from the tree we run in."""
|
|
8311
|
+
return isinstance(preset, dict) and preset.get("audience") == "author" and not author_tree(root)
|
|
8312
|
+
|
|
8313
|
+
|
|
8232
8314
|
INSTRUCTIONS_STATUS_PATH = pathlib.Path(
|
|
8233
8315
|
_instructions_environment(
|
|
8234
8316
|
"AGENT_BIOS_INSTRUCTIONS_STATUS", "AGENT_BIOS_CORPUS_STATUS",
|
|
@@ -9354,6 +9436,10 @@ def pick_mode_and_preset(
|
|
|
9354
9436
|
t("instructions.private.description") if private_instructions_enabled() else t("instructions.description"),
|
|
9355
9437
|
)
|
|
9356
9438
|
)
|
|
9439
|
+
if preset_withheld(presets.get(DISTILL_PRESET, {})):
|
|
9440
|
+
# Withheld, not greyed out: a route whose first instruction names a path the
|
|
9441
|
+
# reader does not have is worse than an absent route (WP-22a).
|
|
9442
|
+
mode_options = [o for o in mode_options if o.value != DISTILL_MODE]
|
|
9357
9443
|
if private_instructions_enabled():
|
|
9358
9444
|
mode_options.append(MenuOption(UNDERSTAND_OPTION, t("understand.title"), t("understand.description")))
|
|
9359
9445
|
mode_options.append(MenuOption(SHELL_CONNECTION_OPTION, t("shell.title"), t("shell.description")))
|
|
@@ -9431,6 +9517,13 @@ def pick_mode_and_preset(
|
|
|
9431
9517
|
mode = None
|
|
9432
9518
|
continue
|
|
9433
9519
|
if mode == DISTILL_MODE:
|
|
9520
|
+
# Reached by a resume, a flag or a stale saved mode rather than the menu: the same
|
|
9521
|
+
# verdict, by name, instead of a hub whose first instruction cannot be followed.
|
|
9522
|
+
if preset_withheld(presets.get(DISTILL_PRESET, {})):
|
|
9523
|
+
raise LaunchError(
|
|
9524
|
+
f"PRESET_AUTHOR_ONLY {DISTILL_PRESET}: this preset edits the agent-bios "
|
|
9525
|
+
f"instructions themselves and needs a checkout; a packaged install has none, "
|
|
9526
|
+
f"so it is not offered here")
|
|
9434
9527
|
if distill_hub(config, ui) != "start":
|
|
9435
9528
|
mode = None
|
|
9436
9529
|
continue
|
|
@@ -10696,26 +10789,79 @@ def _line_count(path: pathlib.Path) -> int:
|
|
|
10696
10789
|
return 0
|
|
10697
10790
|
|
|
10698
10791
|
|
|
10699
|
-
def
|
|
10700
|
-
"""
|
|
10792
|
+
def _transcript_file_count(home: pathlib.Path) -> int:
|
|
10793
|
+
"""Transcript files under the two hosts' roots: a directory listing, no parsing.
|
|
10701
10794
|
|
|
10702
|
-
|
|
10703
|
-
|
|
10704
|
-
|
|
10705
|
-
"""
|
|
10795
|
+
Claude keeps one file per session directly inside each project directory; Codex keeps
|
|
10796
|
+
rollouts, plain or compressed in place, anywhere below `sessions/` and `archived_sessions/`.
|
|
10797
|
+
The window-close writer (session-distill/update-state.py) counts them the same way, and its
|
|
10798
|
+
self-test holds the two counts to one answer."""
|
|
10799
|
+
total = 0
|
|
10800
|
+
try:
|
|
10801
|
+
with os.scandir(home / ".claude" / "projects") as projects:
|
|
10802
|
+
for project in projects:
|
|
10803
|
+
if project.is_dir(follow_symlinks=False):
|
|
10804
|
+
with os.scandir(project.path) as files:
|
|
10805
|
+
total += sum(1 for f in files if f.name.endswith(".jsonl") and f.is_file(follow_symlinks=False))
|
|
10806
|
+
except OSError:
|
|
10807
|
+
pass
|
|
10808
|
+
pending = [home / ".codex" / "sessions", home / ".codex" / "archived_sessions"]
|
|
10809
|
+
while pending:
|
|
10810
|
+
try:
|
|
10811
|
+
with os.scandir(pending.pop()) as entries:
|
|
10812
|
+
for entry in entries:
|
|
10813
|
+
if entry.is_dir(follow_symlinks=False):
|
|
10814
|
+
pending.append(pathlib.Path(entry.path))
|
|
10815
|
+
elif entry.name.endswith((".jsonl", ".jsonl.zst")) and entry.is_file(follow_symlinks=False):
|
|
10816
|
+
total += 1
|
|
10817
|
+
except OSError:
|
|
10818
|
+
continue
|
|
10819
|
+
return total
|
|
10820
|
+
|
|
10821
|
+
|
|
10822
|
+
def _nudge_setting(settings: Any, key: str, default: int) -> int:
|
|
10823
|
+
"""A positive integer setting of `[session_distill]`, or `default`.
|
|
10824
|
+
|
|
10825
|
+
A hand-edited "250" made the comparison a TypeError before the launcher drew anything — a
|
|
10826
|
+
nudge is a hint, so an unusable value falls back to the default rather than taking the
|
|
10827
|
+
launch down with it. `bool` is excluded because `True` is an int that means nothing here."""
|
|
10828
|
+
value = settings.get(key, default) if isinstance(settings, dict) else default
|
|
10829
|
+
return default if isinstance(value, bool) or not isinstance(value, int) or value < 1 else value
|
|
10830
|
+
|
|
10831
|
+
|
|
10832
|
+
def session_distill_nudge(config: dict[str, Any]) -> str | None:
|
|
10833
|
+
"""Nudge when a mining window is due.
|
|
10834
|
+
|
|
10835
|
+
The baseline is written by session-distill/update-state.py at window close. A state file that
|
|
10836
|
+
carries `transcript_files_total` nudges when `cadence_days` have passed since its `window_end`
|
|
10837
|
+
or the transcript files under the hosts' roots grew by `transcript_growth`; one without it
|
|
10838
|
+
keeps the original rule, provider history line counts as a cheap proxy for new sessions. No
|
|
10839
|
+
state file means no nudge. The launcher reads this file and the hosts' directories, nothing
|
|
10840
|
+
in a checkout."""
|
|
10706
10841
|
try:
|
|
10707
10842
|
state = json.loads(SESSION_DISTILL_STATE.read_text(encoding="utf-8"))
|
|
10708
10843
|
baseline = int(state["history_lines_total"])
|
|
10709
10844
|
except (OSError, ValueError, KeyError, TypeError):
|
|
10710
10845
|
return None
|
|
10711
10846
|
settings = config.get("session_distill", {})
|
|
10712
|
-
|
|
10713
|
-
|
|
10714
|
-
|
|
10715
|
-
|
|
10716
|
-
|
|
10717
|
-
|
|
10718
|
-
|
|
10847
|
+
files_then = state.get("transcript_files_total")
|
|
10848
|
+
if isinstance(files_then, int) and not isinstance(files_then, bool):
|
|
10849
|
+
cadence = _nudge_setting(settings, "cadence_days", 14)
|
|
10850
|
+
growth = _nudge_setting(settings, "transcript_growth", 250)
|
|
10851
|
+
reasons = []
|
|
10852
|
+
try:
|
|
10853
|
+
days = (datetime.date.today() - datetime.date.fromisoformat(state["window_end"])).days
|
|
10854
|
+
except (KeyError, TypeError, ValueError):
|
|
10855
|
+
days = None
|
|
10856
|
+
if days is not None and days >= cadence:
|
|
10857
|
+
reasons.append(f"{days} days since {state['window_end']} (cadence {cadence})")
|
|
10858
|
+
grown = _transcript_file_count(pathlib.Path.home()) - files_then
|
|
10859
|
+
if grown >= growth:
|
|
10860
|
+
reasons.append(f"~{grown} new transcript files since {state.get('window_end', '?')} (threshold {growth})")
|
|
10861
|
+
if not reasons:
|
|
10862
|
+
return None
|
|
10863
|
+
return "session-distill due: " + "; ".join(reasons) + " — launch the Session distill preset to run the next mining window"
|
|
10864
|
+
threshold = _nudge_setting(settings, "nudge_after", 250)
|
|
10719
10865
|
current = _line_count(pathlib.Path.home() / ".claude/history.jsonl") + _line_count(
|
|
10720
10866
|
pathlib.Path.home() / ".codex/history.jsonl"
|
|
10721
10867
|
)
|
|
@@ -11146,6 +11292,7 @@ def main(argv: list[str], *, bundled_ui: bool = False) -> int:
|
|
|
11146
11292
|
raise LaunchError("an instruction-pinned resume requires a private installation")
|
|
11147
11293
|
store = instructions_store()
|
|
11148
11294
|
import instructions_session
|
|
11295
|
+
instructions_session.raise_on_termination()
|
|
11149
11296
|
return instructions_session.launch(command, [], store.state_root, args.host, {},
|
|
11150
11297
|
resume_id=args.resume_session)
|
|
11151
11298
|
nudge = session_distill_nudge(config)
|
|
@@ -11288,6 +11435,7 @@ def main(argv: list[str], *, bundled_ui: bool = False) -> int:
|
|
|
11288
11435
|
projected += [understand_initial_prompt("<pinned-understand-session-prompt>")]
|
|
11289
11436
|
if snapshot is not None and args.dry_run:
|
|
11290
11437
|
import instructions_session
|
|
11438
|
+
instructions_session.raise_on_termination()
|
|
11291
11439
|
projected = instructions_session.compose_argv(
|
|
11292
11440
|
command,
|
|
11293
11441
|
projected,
|
|
@@ -11344,6 +11492,7 @@ def main(argv: list[str], *, bundled_ui: bool = False) -> int:
|
|
|
11344
11492
|
summary_stream.flush()
|
|
11345
11493
|
if snapshot is not None:
|
|
11346
11494
|
import instructions_session
|
|
11495
|
+
instructions_session.raise_on_termination()
|
|
11347
11496
|
return instructions_session.launch(command, projected, store.state_root, args.host,
|
|
11348
11497
|
snapshot, env=env,
|
|
11349
11498
|
include_global_instructions=plan["include_global_instructions"])
|