@onlooker-community/ecosystem 0.32.1 → 0.32.2

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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ecosystem",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "Observability substrate for Claude Code. Provides the shared $ONLOOKER_DIR storage root (default $HOME/.onlooker), canonical schema-validated event emission, session and tool tracking hooks, and prompt rules. Required by all other Onlooker plugins.",
5
5
  "author": {
6
6
  "name": "Onlooker Community",
@@ -1,10 +1,10 @@
1
1
  {
2
- ".": "0.32.1",
2
+ ".": "0.32.2",
3
3
  "plugins/archivist": "0.3.1",
4
4
  "plugins/tribunal": "1.1.1",
5
5
  "plugins/echo": "0.3.1",
6
6
  "plugins/cartographer": "0.3.1",
7
- "plugins/governor": "0.3.1",
7
+ "plugins/governor": "0.3.2",
8
8
  "plugins/compass": "0.4.1",
9
9
  "plugins/scribe": "0.4.1",
10
10
  "plugins/counsel": "0.5.1",
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.32.2](https://github.com/onlooker-community/ecosystem/compare/ecosystem-v0.32.1...ecosystem-v0.32.2) (2026-08-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * librarian + bursar + governor improvements ([#119](https://github.com/onlooker-community/ecosystem/issues/119)) ([d7cdab5](https://github.com/onlooker-community/ecosystem/commit/d7cdab528ea5181ea35da68fbc5ad2e5b064abea))
9
+
3
10
  ## [0.32.1](https://github.com/onlooker-community/ecosystem/compare/ecosystem-v0.32.0...ecosystem-v0.32.1) (2026-08-02)
4
11
 
5
12
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onlooker-community/ecosystem",
3
- "version": "0.32.1",
3
+ "version": "0.32.2",
4
4
  "description": "Agents, skills, hooks, commands, rules, and MCP configurations that power [Onlooker](https://onlooker.dev)",
5
5
  "author": {
6
6
  "name": "Onlooker Community",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "governor",
3
- "version": "0.3.1",
3
+ "version": "0.3.2",
4
4
  "description": "Resource governance and budget enforcement for the Onlooker ecosystem. Tracks per-session token and cost spend, gates Task spawns before they exceed a configurable budget ceiling, and emits governor.* events for audit. Named for the steam-engine governor — a device that regulates output. Builds on the Onlooker ecosystem plugin.",
5
5
  "author": {
6
6
  "name": "Onlooker Community",
@@ -1,5 +1,12 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.3.2](https://github.com/onlooker-community/ecosystem/compare/governor-v0.3.1...governor-v0.3.2) (2026-08-02)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * librarian + bursar + governor improvements ([#119](https://github.com/onlooker-community/ecosystem/issues/119)) ([d7cdab5](https://github.com/onlooker-community/ecosystem/commit/d7cdab528ea5181ea35da68fbc5ad2e5b064abea))
9
+
3
10
  ## [0.3.1](https://github.com/onlooker-community/ecosystem/compare/governor-v0.3.0...governor-v0.3.1) (2026-08-01)
4
11
 
5
12
 
@@ -83,19 +83,21 @@ ESTIMATED_COST=$(governor_estimate_cost "$ESTIMATED_TOKENS")
83
83
  ESTIMATION_METHOD=$(governor_estimate_method)
84
84
 
85
85
  # Build the completion ledger record.
86
- # estimated_tokens is negated to cancel the reservation written by PreToolUse.
87
- # actual_tokens (when present) complete the two-phase accounting so the running
88
- # total converges to real spend: N_est + (-N_est) + N_act = N_act.
86
+ # Keep positive estimated_tokens (do not negate) so session totals reflect
87
+ # projected spend. Reservations are recorded with record_type: "reservation";
88
+ # completions are recorded with record_type: "completion". Ledger totals sum
89
+ # only completion records, so each spawn contributes its estimate once.
90
+ # actual_tokens (when present) will eventually replace estimates when API
91
+ # usage metrics become available.
89
92
  AGENT_TYPE="${TOOL_NAME:-Task}"
90
93
  TS=$(date -u +"%Y-%m-%dT%H:%M:%SZ" 2>/dev/null) || TS="1970-01-01T00:00:00Z"
91
- NEG_ESTIMATED=$(( -ESTIMATED_TOKENS ))
92
94
 
93
95
  RECORD=$(jq -n \
94
96
  --arg ts "$TS" \
95
97
  --arg sid "$SESSION_ID" \
96
98
  --arg aid "${CLAUDE_SESSION_ID:-unknown}" \
97
99
  --arg at "$AGENT_TYPE" \
98
- --argjson est "$NEG_ESTIMATED" \
100
+ --argjson est "$ESTIMATED_TOKENS" \
99
101
  --argjson cost "$ESTIMATED_COST" \
100
102
  --argjson dur "$DURATION_MS" \
101
103
  '{
@@ -105,7 +107,8 @@ RECORD=$(jq -n \
105
107
  agent_type: $at,
106
108
  estimated_tokens: $est,
107
109
  cost_usd_estimated: $cost,
108
- duration_ms: $dur
110
+ duration_ms: $dur,
111
+ record_type: "completion"
109
112
  }' 2>/dev/null) || RECORD="{}"
110
113
 
111
114
  # Compute actual total once; used for both the ledger record and the event payload.
@@ -126,12 +126,10 @@ _governor_ledger_poison() {
126
126
 
127
127
  # Running total of tokens for a session.
128
128
  #
129
- # Uses the two-phase model: each record contributes
130
- # .estimated_tokens + (.actual_tokens // 0)
131
- #
132
- # In-flight reservations: estimated_tokens > 0, no actual_tokens → counts N_est
133
- # Completed Task records: estimated_tokens = -N_est, actual_tokens = N_act → counts N_act
134
- # Net: in-flight estimates + completed actuals.
129
+ # Sums all ledger records:
130
+ # - reservation records (in-flight projected spend)
131
+ # - completion records (which may cancel reservations and add actual_tokens)
132
+ # - legacy records with no record_type
135
133
  #
136
134
  # Usage: tokens=$(governor_ledger_total_tokens "$session_id")
137
135
  governor_ledger_total_tokens() {
@@ -145,7 +143,7 @@ governor_ledger_total_tokens() {
145
143
  "$ledger_path" 2>/dev/null || printf '0'
146
144
  }
147
145
 
148
- # Running total of cost for a session (same two-phase logic as tokens).
146
+ # Running total of cost for a session (same logic as tokens: all records).
149
147
  # Usage: cost=$(governor_ledger_total_cost "$session_id")
150
148
  governor_ledger_total_cost() {
151
149
  local session_id="${1:-}"
@@ -158,7 +156,7 @@ governor_ledger_total_cost() {
158
156
  "$ledger_path" 2>/dev/null || printf '0'
159
157
  }
160
158
 
161
- # Count completed Task calls (excludes reservation records).
159
+ # Count Task calls, excluding reservation records.
162
160
  # Usage: calls=$(governor_ledger_call_count "$session_id")
163
161
  governor_ledger_call_count() {
164
162
  local session_id="${1:-}"