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/launch/agent-launch.toml
CHANGED
|
@@ -141,22 +141,27 @@ severity_map = { blocker = "blocker", high = "high", medium = "medium", low = "l
|
|
|
141
141
|
# The model family this host speaks for. A review binding names a provider, and
|
|
142
142
|
# the reverse map must be unique so it resolves to exactly one validatable seat.
|
|
143
143
|
provider = "openai"
|
|
144
|
-
models = ["gpt-6-astra", "gpt-
|
|
144
|
+
models = ["gpt-6-astra", "gpt-6.1-sol", "gpt-6-luna"]
|
|
145
145
|
|
|
146
146
|
[hosts.codex.tiers.frontier]
|
|
147
147
|
model = "gpt-6-astra"
|
|
148
148
|
effort = "max"
|
|
149
149
|
|
|
150
150
|
[hosts.codex.tiers.helm]
|
|
151
|
-
model = "gpt-
|
|
151
|
+
model = "gpt-6.1-sol"
|
|
152
152
|
effort = "xhigh"
|
|
153
153
|
|
|
154
|
+
# Same model as HELM, one effort step down. The catalogue retired `terra` without a
|
|
155
|
+
# same-role successor, so the tiers can no longer be three distinct models; effort is
|
|
156
|
+
# what separates this seat from HELM, and a seat sharing HELM's model buys no
|
|
157
|
+
# cross-model perspective — a review dispatched here is a lower-effort echo, not a
|
|
158
|
+
# second reader.
|
|
154
159
|
[hosts.codex.tiers.workhorse]
|
|
155
|
-
model = "gpt-
|
|
156
|
-
effort = "
|
|
160
|
+
model = "gpt-6.1-sol"
|
|
161
|
+
effort = "high"
|
|
157
162
|
|
|
158
163
|
[hosts.codex.tiers.sweep]
|
|
159
|
-
model = "gpt-
|
|
164
|
+
model = "gpt-6-luna"
|
|
160
165
|
effort = "max"
|
|
161
166
|
|
|
162
167
|
[hosts.codex.agent_templates]
|
|
@@ -164,41 +169,66 @@ frontier = "${CODEX_HOME}/agents/frontier.toml"
|
|
|
164
169
|
workhorse = "${CODEX_HOME}/agents/workhorse.toml"
|
|
165
170
|
sweep = "${CODEX_HOME}/agents/sweep.toml"
|
|
166
171
|
|
|
167
|
-
#
|
|
172
|
+
# Every model this profile names, and what the surfaces naming it need to know.
|
|
173
|
+
#
|
|
174
|
+
# `display` is the name the human-readable guides write. The guides' Environment Binding tables
|
|
168
175
|
# restate these bindings in prose that also carries policy the profile does not hold ("main Ultra
|
|
169
176
|
# requires explicit selection"), so those tables are not generatable — but the MODEL IDENTITY in
|
|
170
177
|
# them is this file's, and until this map existed the parity gate compared each table to display
|
|
171
178
|
# names written inside the gate. That made the gate a third author of the binding. With the map
|
|
172
179
|
# here, the gate compares two real surfaces and holds no copy of its own.
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
"
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
180
|
+
#
|
|
181
|
+
# `superseded_by` is OPTIONAL and means: the host's own model catalogue has moved past this model,
|
|
182
|
+
# and the binding is being KEPT anyway, deliberately, for now. It is not a deprecation marker and
|
|
183
|
+
# it changes no dispatch — `gates/check-model-currency.py` accepts it at publish time in place of
|
|
184
|
+
# a rebind, and git carries the date the decision was made. Naming a successor that is ITSELF
|
|
185
|
+
# superseded does not satisfy the guard, so one acknowledgement cannot cover two generations.
|
|
186
|
+
# Rebinding is the other legal answer; the acknowledgement exists so that "not yet" is a recorded
|
|
187
|
+
# decision rather than a warning nobody read.
|
|
188
|
+
#
|
|
189
|
+
# Every id named anywhere in this file must have a row here, and every row must be named
|
|
190
|
+
# somewhere — both directions are gated, so this table cannot quietly outlive its bindings.
|
|
191
|
+
[models]
|
|
192
|
+
"claude-fable-5-2" = { display = "Claude Fable 5.2" }
|
|
193
|
+
"claude-opus-5-5" = { display = "Claude Opus 5.5" }
|
|
194
|
+
"claude-sonnet-5-5" = { display = "Claude Sonnet 5.5" }
|
|
195
|
+
"claude-haiku-5-5" = { display = "Claude Haiku 5.5" }
|
|
196
|
+
"gpt-6-astra" = { display = "GPT-6 Astra" }
|
|
197
|
+
"gpt-6.1-sol" = { display = "GPT-6.1 Sol" }
|
|
198
|
+
"gpt-6-luna" = { display = "GPT-6 Luna" }
|
|
183
199
|
|
|
184
200
|
[hosts.claude]
|
|
185
201
|
provider = "anthropic"
|
|
186
|
-
models = ["claude-fable-5
|
|
202
|
+
models = ["claude-fable-5-2", "claude-opus-5-5", "claude-sonnet-5-5", "claude-haiku-5-5"]
|
|
187
203
|
|
|
204
|
+
# Rebound from Fable 5.1 on 2026-11-11, and Fable 5.1 is RETIRED rather than kept beside
|
|
205
|
+
# it: `models` is the selectable catalogue, and a listed model no tier binds would be a
|
|
206
|
+
# site the currency check reports superseded forever, answerable only by a `superseded_by`
|
|
207
|
+
# acknowledgement nobody has a reason to make. The codex host lists exactly its distinct
|
|
208
|
+
# tier-bound models for the same reason.
|
|
188
209
|
[hosts.claude.tiers.frontier]
|
|
189
|
-
model = "claude-fable-5-
|
|
210
|
+
model = "claude-fable-5-2"
|
|
190
211
|
effort = "max"
|
|
191
212
|
|
|
213
|
+
# One step below the seats the 5.x generation used. The vendor's Opus 5.5 guidance
|
|
214
|
+
# states the model thinks MORE per turn at a given level than Opus 5 did, defaults to
|
|
215
|
+
# `medium`, and asks that `xhigh`/`max` be reserved for work with a measured gain — so
|
|
216
|
+
# carrying the old `xhigh` forward would have bought longer turns rather than more depth.
|
|
192
217
|
[hosts.claude.tiers.helm]
|
|
193
|
-
model = "claude-opus-5"
|
|
194
|
-
effort = "
|
|
218
|
+
model = "claude-opus-5-5"
|
|
219
|
+
effort = "high"
|
|
195
220
|
|
|
196
221
|
[hosts.claude.tiers.workhorse]
|
|
197
|
-
model = "claude-sonnet-5"
|
|
198
|
-
effort = "
|
|
222
|
+
model = "claude-sonnet-5-5"
|
|
223
|
+
effort = "high"
|
|
199
224
|
|
|
225
|
+
# Haiku 4.5 had no effort vocabulary at all, so this row carried no `effort` key and the
|
|
226
|
+
# launcher special-cased the model. Haiku 5.5 takes low..max, so the seat is stated
|
|
227
|
+
# rather than defaulted — a sweep that silently followed the vendor default would change
|
|
228
|
+
# cost and depth whenever that default moved.
|
|
200
229
|
[hosts.claude.tiers.sweep]
|
|
201
|
-
model = "claude-haiku-
|
|
230
|
+
model = "claude-haiku-5-5"
|
|
231
|
+
effort = "medium"
|
|
202
232
|
|
|
203
233
|
[presets.balanced]
|
|
204
234
|
label = "Balanced"
|
|
@@ -250,9 +280,9 @@ claude_permission_mode = "standard"
|
|
|
250
280
|
[presets.session-distill]
|
|
251
281
|
# Author-only: the workflow edits the agent-bios instructions and needs a checkout, so
|
|
252
282
|
# its mission names repo paths a packaged user does not have. Declaring it lets
|
|
253
|
-
# gates/check-package.sh judge the mission text
|
|
254
|
-
#
|
|
255
|
-
#
|
|
283
|
+
# gates/check-package.sh judge the mission text, and the launcher reads it too: a tree
|
|
284
|
+
# with no `gates/` directory is not a checkout, and the menu, the mode branch and
|
|
285
|
+
# `build_plan` each refuse the preset by name there (`preset_withheld`, WP-22a).
|
|
256
286
|
audience = "author"
|
|
257
287
|
label = "Session distill"
|
|
258
288
|
description = "Dedicated session-distill run: mine recent sessions, verify, place, and apply per the session-distill workflow. Requires an agent-bios checkout."
|
|
@@ -285,7 +315,7 @@ tier = "frontier"
|
|
|
285
315
|
|
|
286
316
|
[presets.deep-review.review.hosts.claude.methods."codex-exec"]
|
|
287
317
|
provider = "openai"
|
|
288
|
-
model = "gpt-
|
|
318
|
+
model = "gpt-6.1-sol"
|
|
289
319
|
effort = "ultra"
|
|
290
320
|
|
|
291
321
|
[presets.deep-review.review.hosts.codex.base]
|
|
@@ -310,7 +340,7 @@ tier = "frontier"
|
|
|
310
340
|
|
|
311
341
|
[presets.session-distill.review.hosts.claude.methods."codex-exec"]
|
|
312
342
|
provider = "openai"
|
|
313
|
-
model = "gpt-
|
|
343
|
+
model = "gpt-6.1-sol"
|
|
314
344
|
effort = "ultra"
|
|
315
345
|
|
|
316
346
|
[presets.session-distill.review.hosts.codex.base]
|
|
@@ -322,6 +352,11 @@ provider = "anthropic"
|
|
|
322
352
|
tier = "frontier"
|
|
323
353
|
|
|
324
354
|
# Nudge baseline lives in ~/.local/share/agent-bios/session-distill-state.json,
|
|
325
|
-
# written by session-distill/update-state.py at window close.
|
|
355
|
+
# written by session-distill/update-state.py at window close. A state file that records
|
|
356
|
+
# transcript_files_total nudges when cadence_days have passed since its window end or the
|
|
357
|
+
# transcript files grew by transcript_growth; one without it nudges after nudge_after new
|
|
358
|
+
# history lines.
|
|
326
359
|
[session_distill]
|
|
327
360
|
nudge_after = 250
|
|
361
|
+
cadence_days = 14
|
|
362
|
+
transcript_growth = 250
|
package/launch/agent-launch.zsh
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
# Alias expansion is OFF while this file is parsed and restored to what it was at the
|
|
2
2
|
# end: zsh expands aliases at parse time, inside function bodies too, so an alias named
|
|
3
3
|
# `builtin`, `command`, or `claude` that exists when this file is sourced would be baked
|
|
4
|
-
# into the functions below and the real binary never reached.
|
|
4
|
+
# into the functions below and the real binary never reached. A command substitution is
|
|
5
|
+
# the exception: its text is parsed again each time it runs, under the aliases then in
|
|
6
|
+
# force, so a builtin inside `$(...)` is written `\builtin`, which no alias can replace.
|
|
5
7
|
[[ -o aliases ]] && _agent_launch_aliases_were=1 || _agent_launch_aliases_were=0
|
|
6
8
|
setopt no_aliases
|
|
7
9
|
|
|
@@ -17,22 +19,111 @@ _agent_launch_direct() {
|
|
|
17
19
|
# provide is handed to whatever the user's function does. `builtin` cannot be shadowed,
|
|
18
20
|
# so the resolution is the one the comment above already promised.
|
|
19
21
|
if [[ "$host" == "claude" && -z "${_agent_launch_private_connection:-}" ]]; then
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
22
|
+
# The permission default goes in front of a prompt or an option, never in front of a
|
|
23
|
+
# subcommand: some subcommands are dispatched only from the first argument, so with a
|
|
24
|
+
# flag in front `claude attach <id>` is a new session whose prompt is "attach <id>",
|
|
25
|
+
# and which ones is the installed version's to say. The subcommands are what that
|
|
26
|
+
# version's `claude --help` lists (_agent_launch_claude_subcommands); a first argument
|
|
27
|
+
# that starts with `-` is no subcommand and needs no probe. When the list cannot be
|
|
28
|
+
# read, the flag stays off.
|
|
29
|
+
if [[ $# -eq 0 || "$1" == -* ]]; then
|
|
30
|
+
builtin command claude --dangerously-skip-permissions "$@"
|
|
31
|
+
elif _agent_launch_claude_subcommands && ! _agent_launch_claude_lists "$1"; then
|
|
32
|
+
builtin command claude --dangerously-skip-permissions "$@"
|
|
33
|
+
else
|
|
34
|
+
builtin command claude "$@"
|
|
35
|
+
fi
|
|
31
36
|
else
|
|
32
37
|
builtin command "$host" "$@"
|
|
33
38
|
fi
|
|
34
39
|
}
|
|
35
40
|
|
|
41
|
+
# The subcommand spellings (`stop|kill` is two) the installed `claude --help` lists under
|
|
42
|
+
# `Commands:`, in `_agent_launch_claude_verbs`. Read once per installed binary: the key is the
|
|
43
|
+
# binary's resolved path, modification time and size, held in this shell and in
|
|
44
|
+
# ~/.local/share/agent-bios/claude-subcommands (the state dir the shadow log below uses, never
|
|
45
|
+
# created here), so an update, which installs a new versioned path or rewrites the file, is
|
|
46
|
+
# probed again. Returns nonzero when no list can be read, and a failed probe is not cached.
|
|
47
|
+
#
|
|
48
|
+
# The help is run by the lister, launch/claude_subcommands.py: in a process group of its own, for
|
|
49
|
+
# at most 5 s, and answered for only when it exited 0 and listed a subcommand; on any other outcome
|
|
50
|
+
# it says why in one line on stderr. The lister is found where the private shell connection's
|
|
51
|
+
# header names it, else beside this file (the compatibility install deploys the two together, as
|
|
52
|
+
# the checkout holds them). The python3 that runs it is the one on PATH; on macOS /usr/bin/python3
|
|
53
|
+
# without the Command Line Tools would open their installer on every call, so it is not run then.
|
|
54
|
+
# When zsh/stat does not load or cannot read the binary, or there is no python3 or lister, the flag
|
|
55
|
+
# stays off and one line names the check (_agent_launch_claude_unread). A claude missing from PATH
|
|
56
|
+
# is not reported: the call that follows fails by itself, and a line about the flag would only
|
|
57
|
+
# stand in front of that error. The builtins are called as builtins, past any function of the
|
|
58
|
+
# user's that shares their name.
|
|
59
|
+
typeset -ga _agent_launch_claude_verbs
|
|
60
|
+
typeset -g _agent_launch_claude_verbs_key=""
|
|
61
|
+
typeset -g _agent_launch_claude_lister="${_agent_launch_claude_lister:-${${(%):-%x}:a:h}/claude_subcommands.py}"
|
|
62
|
+
_agent_launch_claude_unread() {
|
|
63
|
+
builtin print -ru2 -- "agent-bios: $1, so the subcommands claude lists cannot be read; claude starts" \
|
|
64
|
+
"without --dangerously-skip-permissions"
|
|
65
|
+
return 1
|
|
66
|
+
}
|
|
67
|
+
_agent_launch_claude_subcommands() {
|
|
68
|
+
setopt localoptions noksharrays no_err_return no_err_exit
|
|
69
|
+
local bin real key py listed why cache="$HOME/.local/share/agent-bios/claude-subcommands"
|
|
70
|
+
local -a words cached
|
|
71
|
+
local -A meta
|
|
72
|
+
bin="$(\builtin whence -p claude)" || return 1
|
|
73
|
+
[[ -n "$bin" ]] || return 1
|
|
74
|
+
real="${bin:A}"
|
|
75
|
+
if ! builtin zmodload -F zsh/stat b:zstat 2>/dev/null; then
|
|
76
|
+
_agent_launch_claude_unread "zsh's zsh/stat module did not load"
|
|
77
|
+
return 1
|
|
78
|
+
fi
|
|
79
|
+
if ! { builtin zstat -H meta -- "$real" } 2>/dev/null; then
|
|
80
|
+
_agent_launch_claude_unread "zstat could not read $real"
|
|
81
|
+
return 1
|
|
82
|
+
fi
|
|
83
|
+
key="${real}"$'\t'"${meta[mtime]}"$'\t'"${meta[size]}"
|
|
84
|
+
[[ "$key" == "$_agent_launch_claude_verbs_key" ]] && return 0
|
|
85
|
+
if [[ -f "$cache" && ! -L "$cache" ]]; then
|
|
86
|
+
cached=("${(@f)$(<"$cache")}")
|
|
87
|
+
if [[ "${cached[1]-}" == "$key" && ${#cached} -gt 1 ]]; then
|
|
88
|
+
_agent_launch_claude_verbs=("${(@)cached[2,-1]}")
|
|
89
|
+
_agent_launch_claude_verbs_key="$key"
|
|
90
|
+
return 0
|
|
91
|
+
fi
|
|
92
|
+
fi
|
|
93
|
+
py="$(\builtin whence -p python3)" || py=""
|
|
94
|
+
if [[ -n "$py" && "$OSTYPE" == darwin* && "${py:A}" == /usr/bin/python3 ]] \
|
|
95
|
+
&& ! builtin command xcode-select -p >/dev/null 2>&1; then
|
|
96
|
+
why="python3 is the Command Line Tools stub, which are not installed"
|
|
97
|
+
elif [[ -z "$py" ]]; then
|
|
98
|
+
why="no python3 is on PATH"
|
|
99
|
+
elif [[ ! -f "$_agent_launch_claude_lister" ]]; then
|
|
100
|
+
why="the subcommand lister is missing at $_agent_launch_claude_lister"
|
|
101
|
+
fi
|
|
102
|
+
if [[ -n "$why" ]]; then
|
|
103
|
+
_agent_launch_claude_unread "$why"
|
|
104
|
+
return 1
|
|
105
|
+
fi
|
|
106
|
+
listed="$("$py" -I "$_agent_launch_claude_lister" "$bin" </dev/null)" || return 1
|
|
107
|
+
words=("${(@f)listed}")
|
|
108
|
+
(( ${#words} )) || return 1
|
|
109
|
+
_agent_launch_claude_verbs=("${words[@]}")
|
|
110
|
+
_agent_launch_claude_verbs_key="$key"
|
|
111
|
+
if [[ -d "${cache:h}" && ( ! -e "$cache" || ( -f "$cache" && ! -L "$cache" ) ) ]]; then
|
|
112
|
+
builtin print -rl -- "$key" "${words[@]}" >| "$cache.$$" 2>/dev/null \
|
|
113
|
+
&& builtin command mv -f -- "$cache.$$" "$cache" 2>/dev/null \
|
|
114
|
+
|| builtin command rm -f -- "$cache.$$" 2>/dev/null
|
|
115
|
+
fi
|
|
116
|
+
return 0
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# Whether $1 is a spelling `_agent_launch_claude_verbs` holds. A function of its own so the
|
|
120
|
+
# subscript is read under zsh's array options, not the user's: with KSH_ARRAYS set, `(Ie)` answers
|
|
121
|
+
# 0 for the first element, the same answer as "absent".
|
|
122
|
+
_agent_launch_claude_lists() {
|
|
123
|
+
setopt localoptions noksharrays no_err_return no_err_exit
|
|
124
|
+
(( ${_agent_launch_claude_verbs[(Ie)$1]} ))
|
|
125
|
+
}
|
|
126
|
+
|
|
36
127
|
_agent_launch_dispatch() {
|
|
37
128
|
local host="$1"
|
|
38
129
|
shift
|
|
@@ -108,7 +199,7 @@ _agent_launch_note_shadow() {
|
|
|
108
199
|
prog="${TERM_PROGRAM:-unknown}"
|
|
109
200
|
prog="${prog//[[:cntrl:]]/ }"
|
|
110
201
|
# `builtin command`: a shell function named `date` must not write this field.
|
|
111
|
-
stamp="$(builtin command date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null)"
|
|
202
|
+
stamp="$(\builtin command date -u +%Y-%m-%dT%H:%M:%SZ 2>/dev/null)"
|
|
112
203
|
stamp="${stamp//[[:cntrl:]]/ }"
|
|
113
204
|
# `builtin printf`: a shell function named printf could report success and write nothing.
|
|
114
205
|
if builtin printf '%s\t%s\t%s\t%s\n' "${stamp:-<unknown>}" "$host" "$prog" \
|
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"""The subcommands the installed `claude --help` lists, for the zsh wrapper (launch/agent-launch.zsh).
|
|
2
|
+
|
|
3
|
+
python3 -I claude_subcommands.py CLAUDE
|
|
4
|
+
|
|
5
|
+
Runs `CLAUDE --help` in a process group of its own and waits at most LIMIT_S seconds. Prints each
|
|
6
|
+
spelling the help lists under `Commands:` (`stop|kill` is two), one per line, and exits 0 only when the
|
|
7
|
+
help exited 0 and listed at least one; otherwise it exits 1 with one line on stderr saying why, and the
|
|
8
|
+
wrapper leaves the permission flag off. LIMIT_S is not a measurement: it is meant to sit well above a
|
|
9
|
+
first `--help` from a slow disk.
|
|
10
|
+
|
|
11
|
+
However the wait ends - the help ending, the limit passing, or SIGINT, SIGTERM or SIGHUP reaching the
|
|
12
|
+
lister - the help's whole group is ended before the help is reaped: SIGKILL when the help had ended by
|
|
13
|
+
itself, which reaches whatever it left in the group, and otherwise SIGTERM, half a second, then SIGKILL.
|
|
14
|
+
Until the help is reaped its number, which is the group's, cannot belong to another process, so the
|
|
15
|
+
help's end is watched without reaping it: kqueue where the platform has it, since the Pythons macOS
|
|
16
|
+
ships lack os.waitid, and waitid elsewhere. Those three signals are only noted, so a second one cannot
|
|
17
|
+
cut the cleanup short; afterwards the lister says so in one line and ends by the signal it received.
|
|
18
|
+
A descendant that made a session of its own has left the group and is beyond this reach: when it
|
|
19
|
+
still holds the help's output after the group has been ended, the output is closed on this side half
|
|
20
|
+
a second later, and the one line that says the help did not end within the limit says so too.
|
|
21
|
+
|
|
22
|
+
The same lifecycle is wrappers/codex_protocol.py's Owned. This file cannot load it: it runs alone under
|
|
23
|
+
-I, and the compatibility install deploys it to a directory of its own. Standard library only, and
|
|
24
|
+
Python 3.9 syntax: the wrapper runs whichever python3 is on the user's PATH.
|
|
25
|
+
"""
|
|
26
|
+
import os
|
|
27
|
+
import re
|
|
28
|
+
import select
|
|
29
|
+
import signal
|
|
30
|
+
import subprocess
|
|
31
|
+
import sys
|
|
32
|
+
import time
|
|
33
|
+
|
|
34
|
+
LIMIT_S = 5
|
|
35
|
+
GRACE_S = 0.5
|
|
36
|
+
DRAIN_S = 0.5
|
|
37
|
+
TICK_S = 0.05
|
|
38
|
+
CANCELS = (signal.SIGINT, signal.SIGTERM, signal.SIGHUP)
|
|
39
|
+
LISTED = re.compile(r"^ ([a-z][a-z0-9-]*(?:\|[a-z][a-z0-9-]*)*)(?: |$)")
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
def spellings(text):
|
|
43
|
+
"""The spellings under the help's `Commands:` heading, up to the next unindented line."""
|
|
44
|
+
words, inside = [], False
|
|
45
|
+
for line in text.splitlines():
|
|
46
|
+
if line.startswith("Commands:"):
|
|
47
|
+
inside = True
|
|
48
|
+
elif inside:
|
|
49
|
+
listed = LISTED.match(line)
|
|
50
|
+
if listed:
|
|
51
|
+
words.extend(listed.group(1).split("|"))
|
|
52
|
+
elif line and not line.startswith(" "):
|
|
53
|
+
break
|
|
54
|
+
return words
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class Owned:
|
|
58
|
+
"""The help, started in a session of its own, ended with its process group (see the module text)."""
|
|
59
|
+
|
|
60
|
+
def __init__(self, proc):
|
|
61
|
+
self.proc, self._ended, self._watch = proc, False, None
|
|
62
|
+
if hasattr(select, "kqueue"):
|
|
63
|
+
self._watch = select.kqueue()
|
|
64
|
+
try:
|
|
65
|
+
self._watch.control([select.kevent(proc.pid, select.KQ_FILTER_PROC,
|
|
66
|
+
select.KQ_EV_ADD | select.KQ_EV_ONESHOT, select.KQ_NOTE_EXIT)], 0, 0)
|
|
67
|
+
except ProcessLookupError: # it ended before the watch began: an unreaped child cannot be watched
|
|
68
|
+
self._ended = True
|
|
69
|
+
|
|
70
|
+
def ended(self, wait_s=0.0):
|
|
71
|
+
"""Whether the help has ended, waiting at most `wait_s`. It is never reaped here."""
|
|
72
|
+
if self._ended or self.proc.returncode is not None:
|
|
73
|
+
return True
|
|
74
|
+
if self._watch is not None:
|
|
75
|
+
self._ended = bool(self._watch.control(None, 1, max(wait_s, 0)))
|
|
76
|
+
return self._ended
|
|
77
|
+
deadline = time.monotonic() + wait_s
|
|
78
|
+
while os.waitid(os.P_PID, self.proc.pid, os.WEXITED | os.WNOHANG | os.WNOWAIT) is None:
|
|
79
|
+
if time.monotonic() >= deadline:
|
|
80
|
+
return False
|
|
81
|
+
time.sleep(TICK_S)
|
|
82
|
+
self._ended = True
|
|
83
|
+
return True
|
|
84
|
+
|
|
85
|
+
def end(self, grace_s):
|
|
86
|
+
"""End the help's group, then reap the help. Nothing is signalled once the help is reaped."""
|
|
87
|
+
if self.proc.returncode is not None:
|
|
88
|
+
return
|
|
89
|
+
try:
|
|
90
|
+
if not self.ended():
|
|
91
|
+
# ESRCH, or EPERM on macOS when the unreaped help is all the group holds: nothing to signal
|
|
92
|
+
try:
|
|
93
|
+
os.killpg(self.proc.pid, signal.SIGTERM)
|
|
94
|
+
self.ended(grace_s)
|
|
95
|
+
except (ProcessLookupError, PermissionError):
|
|
96
|
+
pass
|
|
97
|
+
finally:
|
|
98
|
+
try:
|
|
99
|
+
os.killpg(self.proc.pid, signal.SIGKILL)
|
|
100
|
+
except (ProcessLookupError, PermissionError):
|
|
101
|
+
pass
|
|
102
|
+
self.proc.wait()
|
|
103
|
+
if self._watch is not None:
|
|
104
|
+
self._watch.close()
|
|
105
|
+
|
|
106
|
+
def collect(self, limit_s, grace_s, drain_s, stopped):
|
|
107
|
+
"""(output, timed_out, held): the help's output, read until it has closed and the help has
|
|
108
|
+
ended, for at most `limit_s` or until `stopped()` answers true; then its group is ended and
|
|
109
|
+
the output read for at most `drain_s` more and closed. `held` is true when it was still open
|
|
110
|
+
then. A help's output closing is not its end, and a help that ended while something it started
|
|
111
|
+
still holds its output has not finished either."""
|
|
112
|
+
fd, read, open_ = self.proc.stdout.fileno(), [], [True]
|
|
113
|
+
|
|
114
|
+
def take(wait_s):
|
|
115
|
+
# a wait computed from a deadline that passed meanwhile is a poll, never a refusal
|
|
116
|
+
if select.select([fd], [], [], max(wait_s, 0))[0]:
|
|
117
|
+
chunk = os.read(fd, 65536)
|
|
118
|
+
if chunk:
|
|
119
|
+
read.append(chunk)
|
|
120
|
+
else:
|
|
121
|
+
open_[0] = False
|
|
122
|
+
deadline, timed_out = time.monotonic() + limit_s, False
|
|
123
|
+
try:
|
|
124
|
+
while not stopped() and (open_[0] or not self.ended()):
|
|
125
|
+
left = deadline - time.monotonic()
|
|
126
|
+
if left <= 0:
|
|
127
|
+
timed_out = True
|
|
128
|
+
break
|
|
129
|
+
if open_[0]:
|
|
130
|
+
take(min(left, TICK_S))
|
|
131
|
+
else:
|
|
132
|
+
self.ended(min(left, TICK_S))
|
|
133
|
+
finally:
|
|
134
|
+
self.end(grace_s)
|
|
135
|
+
deadline = time.monotonic() + drain_s
|
|
136
|
+
while open_[0] and time.monotonic() < deadline:
|
|
137
|
+
take(min(deadline - time.monotonic(), TICK_S))
|
|
138
|
+
self.proc.stdout.close()
|
|
139
|
+
return b"".join(read), timed_out, open_[0]
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
def main(argv):
|
|
143
|
+
if len(argv) != 2:
|
|
144
|
+
sys.stderr.write("usage: claude_subcommands.py CLAUDE\n")
|
|
145
|
+
return 2
|
|
146
|
+
received = []
|
|
147
|
+
for signo in CANCELS:
|
|
148
|
+
signal.signal(signo, lambda signo, _frame: received.append(signo))
|
|
149
|
+
try:
|
|
150
|
+
proc = subprocess.Popen([argv[1], "--help"], stdin=subprocess.DEVNULL, stdout=subprocess.PIPE,
|
|
151
|
+
stderr=subprocess.DEVNULL, start_new_session=True)
|
|
152
|
+
except OSError as exc:
|
|
153
|
+
return fail(f"`claude --help` did not start ({exc.__class__.__name__})")
|
|
154
|
+
out, timed_out, held = Owned(proc).collect(LIMIT_S, GRACE_S, DRAIN_S, lambda: bool(received))
|
|
155
|
+
if received:
|
|
156
|
+
fail(f"`claude --help` was interrupted by {signal.Signals(received[0]).name}")
|
|
157
|
+
sys.stderr.flush()
|
|
158
|
+
signal.signal(received[0], signal.SIG_DFL)
|
|
159
|
+
os.kill(os.getpid(), received[0])
|
|
160
|
+
return 1
|
|
161
|
+
if timed_out:
|
|
162
|
+
return fail(f"`claude --help` did not end within {LIMIT_S} s"
|
|
163
|
+
+ (", and a process that left its process group still held its output" if held else ""))
|
|
164
|
+
if proc.returncode != 0:
|
|
165
|
+
return fail(f"`claude --help` exited {proc.returncode}")
|
|
166
|
+
words = spellings(out.decode("utf-8", "replace"))
|
|
167
|
+
if not words:
|
|
168
|
+
return fail("`claude --help` listed no subcommands")
|
|
169
|
+
sys.stdout.write("".join(word + "\n" for word in words))
|
|
170
|
+
return 0
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def fail(why):
|
|
174
|
+
sys.stderr.write(f"agent-bios: {why}; claude starts without --dangerously-skip-permissions\n")
|
|
175
|
+
return 1
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
if __name__ == "__main__":
|
|
179
|
+
sys.exit(main(sys.argv))
|
package/launch/provision-venv.sh
CHANGED
|
@@ -19,7 +19,7 @@ case "${1:-}" in
|
|
|
19
19
|
esac
|
|
20
20
|
|
|
21
21
|
runtime_python_ready() {
|
|
22
|
-
"$1" -c 'import sys; sys.exit("agent-bios requires Python 3.
|
|
22
|
+
"$1" -c 'import sys; sys.exit("agent-bios requires Python 3.12+; select it with AGENT_LAUNCH_PYTHON and use a new AGENT_LAUNCH_VENV path for an incompatible existing environment" if sys.version_info < (3, 12) else 0)'
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
pinned_ready() {
|
|
@@ -89,8 +89,14 @@ class ShellIntegration:
|
|
|
89
89
|
body = self._read(source)
|
|
90
90
|
if body is None:
|
|
91
91
|
raise ShellIntegrationError(f"shell connection source missing: {source}")
|
|
92
|
+
# The wrapper's subcommand lister stays in the package this connection was made from. Only values
|
|
93
|
+
# every process derives alike go here: a script that is no longer these bytes, and has lost its
|
|
94
|
+
# receipt, is not recognised as ours (the python that made it differs between the installer and
|
|
95
|
+
# the launcher, so it is not one of them).
|
|
92
96
|
return SCRIPT_HEADER + (
|
|
93
|
-
f"typeset -g _agent_launch_private_connection={shlex.quote(str(self.script))}\n"
|
|
97
|
+
f"typeset -g _agent_launch_private_connection={shlex.quote(str(self.script))}\n"
|
|
98
|
+
f"typeset -g _agent_launch_claude_lister="
|
|
99
|
+
f"{shlex.quote(str(self.source / 'launch' / 'claude_subcommands.py'))}\n").encode() + body
|
|
94
100
|
|
|
95
101
|
def has_connection(self):
|
|
96
102
|
"""Discover interrupted opt-ins without inspecting an ordinary user's rc.
|
|
@@ -639,17 +639,40 @@ def print_upload_summary(s):
|
|
|
639
639
|
f"pending={s['pending']}{tail}")
|
|
640
640
|
|
|
641
641
|
|
|
642
|
+
def drain_under_lock(destination, drain):
|
|
643
|
+
"""Run `drain` holding the host's upload lock, so two captures never drain one queue at once. The
|
|
644
|
+
wait is bounded (host_platform.lock_within): past it the drain is not run and the lock is named;
|
|
645
|
+
the learning is already captured, and the next drain sends it."""
|
|
646
|
+
if str(REPO / "compose") not in sys.path:
|
|
647
|
+
sys.path.insert(0, str(REPO / "compose"))
|
|
648
|
+
from host_platform import LockWaitExpired, lock_within
|
|
649
|
+
lock = destination / 'upload.lock'
|
|
650
|
+
fd = os.open(lock, os.O_CREAT | os.O_RDWR | os.O_NOFOLLOW, 0o600)
|
|
651
|
+
with os.fdopen(fd, 'a') as handle:
|
|
652
|
+
try:
|
|
653
|
+
lock_within(handle, f"the learning upload lock ({lock})")
|
|
654
|
+
except LockWaitExpired as exc:
|
|
655
|
+
print(f" upload -> NOT RUN: {exc}; the record is captured and stays queued for the next "
|
|
656
|
+
f"learn!", file=sys.stderr)
|
|
657
|
+
return None
|
|
658
|
+
return drain()
|
|
659
|
+
|
|
660
|
+
|
|
642
661
|
def _self_test():
|
|
643
662
|
"""Socket-free verification of the drain: status classification, watermark
|
|
644
663
|
advance, transient-stop (no storm), permanent-drop, no-token skip, poison
|
|
645
664
|
line, plus capture-time redaction wiring. Injects post_fn/now; exits
|
|
646
665
|
non-zero on any failure."""
|
|
666
|
+
import atexit
|
|
647
667
|
import tempfile
|
|
648
668
|
|
|
649
669
|
# One scratch tree for the whole run, removed at the end: every mkdtemp here
|
|
650
670
|
# used to survive the process, and the gate that calls this ran on every
|
|
651
|
-
# commit — 10k directories before anyone counted.
|
|
671
|
+
# commit — 10k directories before anyone counted. Removed again when the
|
|
672
|
+
# process ends, however it ends: a run that raises never reaches the last
|
|
673
|
+
# line, and the seam-coverage gate runs this suite on mutated copies.
|
|
652
674
|
scratch = pathlib.Path(tempfile.mkdtemp(prefix="learn-selftest-"))
|
|
675
|
+
atexit.register(shutil.rmtree, scratch, True)
|
|
653
676
|
made = {"n": 0}
|
|
654
677
|
|
|
655
678
|
def scratch_dir(tag):
|
|
@@ -1135,6 +1158,37 @@ def _self_test():
|
|
|
1135
1158
|
checks.append(("post limit is a hard cap",
|
|
1136
1159
|
capped["n"] == 1 and s["uploaded"] == 1 and s["reason"] == "limit"))
|
|
1137
1160
|
|
|
1161
|
+
# 18) a drain behind an upload lock held past the bound is not run, and the lock is named — the
|
|
1162
|
+
# writer used to wait on it with no deadline. The bounds are scaled; the holder is a child
|
|
1163
|
+
# that lets go after 8 s, so a drain that waits without a bound runs late and fails here.
|
|
1164
|
+
import contextlib
|
|
1165
|
+
import io
|
|
1166
|
+
import subprocess
|
|
1167
|
+
if str(REPO / "compose") not in sys.path:
|
|
1168
|
+
sys.path.insert(0, str(REPO / "compose"))
|
|
1169
|
+
import host_platform
|
|
1170
|
+
held_dir = scratch_dir("held-upload")
|
|
1171
|
+
holder = subprocess.Popen([sys.executable, "-c", "import fcntl, sys, time; f = open(sys.argv[1], 'a'); "
|
|
1172
|
+
"fcntl.flock(f, fcntl.LOCK_EX); print('held', flush=True); time.sleep(8)",
|
|
1173
|
+
str(held_dir / "upload.lock")], stdout=subprocess.PIPE, text=True)
|
|
1174
|
+
saved = (host_platform.LOCK_WAIT_S, host_platform.LOCK_NOTICE_S)
|
|
1175
|
+
drained = {"n": 0}
|
|
1176
|
+
said = io.StringIO()
|
|
1177
|
+
try:
|
|
1178
|
+
holder.stdout.readline()
|
|
1179
|
+
host_platform.LOCK_WAIT_S, host_platform.LOCK_NOTICE_S = 0.6, 0.2
|
|
1180
|
+
with contextlib.redirect_stderr(said):
|
|
1181
|
+
outcome = drain_under_lock(held_dir, lambda: drained.update(n=1) or {"status": "ok"})
|
|
1182
|
+
finally:
|
|
1183
|
+
host_platform.LOCK_WAIT_S, host_platform.LOCK_NOTICE_S = saved
|
|
1184
|
+
holder.kill()
|
|
1185
|
+
holder.wait()
|
|
1186
|
+
holder.stdout.close()
|
|
1187
|
+
checks.append(("a drain behind a held upload lock is not run and names the lock",
|
|
1188
|
+
outcome is None and drained["n"] == 0
|
|
1189
|
+
and f"the learning upload lock ({held_dir / 'upload.lock'}) is still held after 0.6 s" in said.getvalue()
|
|
1190
|
+
and "waiting for the learning upload lock" in said.getvalue()))
|
|
1191
|
+
|
|
1138
1192
|
shutil.rmtree(scratch, ignore_errors=True)
|
|
1139
1193
|
failed = [name for name, ok in checks if not ok]
|
|
1140
1194
|
if failed:
|
|
@@ -1195,14 +1249,11 @@ def main():
|
|
|
1195
1249
|
result = store.capture_learning(host, record)
|
|
1196
1250
|
print(f"collect-learning: OK host={host} learning_id={result['learning_id']} · private source; future activated sessions")
|
|
1197
1251
|
if not args.no_upload:
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
print_upload_summary(drain_uploads(
|
|
1204
|
-
home, jsonl_path=destination / 'events.jsonl',
|
|
1205
|
-
state_path=destination / 'upload-state.json'))
|
|
1252
|
+
summary = drain_under_lock(destination, lambda: drain_uploads(
|
|
1253
|
+
home, jsonl_path=destination / 'events.jsonl',
|
|
1254
|
+
state_path=destination / 'upload-state.json'))
|
|
1255
|
+
if summary is not None:
|
|
1256
|
+
print_upload_summary(summary)
|
|
1206
1257
|
return
|
|
1207
1258
|
bullet = prose_bullet(record)
|
|
1208
1259
|
jsonl = append_record(home, record, dry)
|