@onlooker-community/ecosystem 0.43.3 → 0.43.5
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/.claude-plugin/plugin.json +1 -1
- package/.release-please-manifest.json +17 -17
- package/AGENTS.md +5 -0
- package/CHANGELOG.md +15 -0
- package/CLAUDE.md +5 -0
- package/docs/architecture.md +3 -1
- package/docs/lesson-promotion-pipeline.md +9 -1
- package/package.json +1 -1
- package/plugins/archivist/.claude-plugin/plugin.json +1 -1
- package/plugins/archivist/CHANGELOG.md +7 -0
- package/plugins/archivist/scripts/lib/archivist-config.sh +6 -2
- package/plugins/assayer/.claude-plugin/plugin.json +1 -1
- package/plugins/assayer/CHANGELOG.md +7 -0
- package/plugins/assayer/scripts/lib/assayer-config.sh +6 -2
- package/plugins/bursar/.claude-plugin/plugin.json +1 -1
- package/plugins/bursar/CHANGELOG.md +7 -0
- package/plugins/bursar/scripts/lib/bursar-config.sh +6 -2
- package/plugins/cartographer/.claude-plugin/plugin.json +1 -1
- package/plugins/cartographer/CHANGELOG.md +7 -0
- package/plugins/cartographer/scripts/lib/cartographer-config.sh +6 -2
- package/plugins/compass/.claude-plugin/plugin.json +1 -1
- package/plugins/compass/CHANGELOG.md +7 -0
- package/plugins/compass/scripts/lib/compass-config.sh +6 -2
- package/plugins/counsel/.claude-plugin/plugin.json +1 -1
- package/plugins/counsel/CHANGELOG.md +7 -0
- package/plugins/counsel/scripts/lib/counsel-config.sh +6 -2
- package/plugins/curator/.claude-plugin/plugin.json +1 -1
- package/plugins/curator/CHANGELOG.md +7 -0
- package/plugins/curator/scripts/lib/curator-config.sh +6 -2
- package/plugins/echo/.claude-plugin/plugin.json +1 -1
- package/plugins/echo/CHANGELOG.md +7 -0
- package/plugins/echo/scripts/lib/echo-config.sh +6 -2
- package/plugins/governor/.claude-plugin/plugin.json +1 -1
- package/plugins/governor/CHANGELOG.md +7 -0
- package/plugins/governor/scripts/lib/governor-config.sh +6 -2
- package/plugins/historian/.claude-plugin/plugin.json +1 -1
- package/plugins/historian/CHANGELOG.md +7 -0
- package/plugins/historian/scripts/lib/historian-config.sh +6 -2
- package/plugins/inspector/.claude-plugin/plugin.json +1 -1
- package/plugins/inspector/CHANGELOG.md +7 -0
- package/plugins/inspector/scripts/lib/inspector-config.sh +6 -2
- package/plugins/librarian/.claude-plugin/plugin.json +1 -1
- package/plugins/librarian/CHANGELOG.md +8 -0
- package/plugins/librarian/scripts/lib/librarian-config.sh +6 -2
- package/plugins/librarian/scripts/lib/librarian-lesson-promote.sh +22 -2
- package/plugins/librarian/scripts/lib/librarian-lesson-storage.sh +19 -1
- package/plugins/lineage/.claude-plugin/plugin.json +1 -1
- package/plugins/lineage/CHANGELOG.md +7 -0
- package/plugins/lineage/scripts/lib/lineage-config.sh +6 -2
- package/plugins/scribe/.claude-plugin/plugin.json +1 -1
- package/plugins/scribe/CHANGELOG.md +7 -0
- package/plugins/scribe/scripts/lib/scribe-config.sh +6 -2
- package/plugins/tribunal/.claude-plugin/plugin.json +1 -1
- package/plugins/tribunal/CHANGELOG.md +7 -0
- package/plugins/tribunal/scripts/lib/tribunal-config.sh +6 -2
- package/plugins/warden/.claude-plugin/plugin.json +1 -1
- package/plugins/warden/CHANGELOG.md +7 -0
- package/plugins/warden/scripts/lib/warden-config.sh +6 -2
- package/scripts/hooks/prompt-rule-injector.sh +10 -2
- package/scripts/lib/config-loader.sh +15 -2
- package/scripts/lib/prompt-rules.sh +43 -12
- package/test/bats/config-lib-self-locating.bats +124 -0
- package/test/bats/librarian-lesson-promote.bats +89 -3
- package/test/bats/prompt-rules.bats +61 -24
- package/test/bus-coverage.json +2 -2
|
@@ -295,9 +295,13 @@ write_project_rules() {
|
|
|
295
295
|
[ "$path" = "$expected" ]
|
|
296
296
|
}
|
|
297
297
|
|
|
298
|
+
# The canonical prompt_rule.matched payload. Both extra fields are required by
|
|
299
|
+
# the schema, so every positive matched-event test has to carry them.
|
|
300
|
+
MATCHED_PAYLOAD='{"rule_id":"rule-1","match_type":"regex","trigger_source":"prompt"}'
|
|
301
|
+
|
|
298
302
|
@test "emit: appends a JSON event line with type, session, payload, and plugin" {
|
|
299
303
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
300
|
-
run prompt_rules_emit "sess-emit" "prompt_rule.matched"
|
|
304
|
+
run prompt_rules_emit "sess-emit" "prompt_rule.matched" "$MATCHED_PAYLOAD"
|
|
301
305
|
[ "$status" -eq 0 ]
|
|
302
306
|
|
|
303
307
|
local line
|
|
@@ -309,59 +313,92 @@ write_project_rules() {
|
|
|
309
313
|
[ "$(echo "$line" | jq -r '.plugin')" = "onlooker" ]
|
|
310
314
|
}
|
|
311
315
|
|
|
312
|
-
@test "emit:
|
|
316
|
+
@test "emit: writes a full canonical envelope, not a hand-built subset" {
|
|
313
317
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
314
|
-
|
|
318
|
+
prompt_rules_emit "sess-envelope" "prompt_rule.matched" "$MATCHED_PAYLOAD"
|
|
315
319
|
|
|
316
320
|
local line
|
|
317
321
|
line=$(tail -1 "$ONLOOKER_EVENTS_LOG")
|
|
318
|
-
|
|
322
|
+
# The five fields the old jq-built envelope omitted. Each is required by
|
|
323
|
+
# event.v1.json, so their absence is what made those lines unvalidatable.
|
|
324
|
+
[ "$(echo "$line" | jq -r 'has("id")')" = "true" ]
|
|
325
|
+
[ "$(echo "$line" | jq -r 'has("schema_version")')" = "true" ]
|
|
326
|
+
[ "$(echo "$line" | jq -r 'has("runtime")')" = "true" ]
|
|
327
|
+
[ "$(echo "$line" | jq -r 'has("machine_id")')" = "true" ]
|
|
328
|
+
[ "$(echo "$line" | jq -r 'has("sequence")')" = "true" ]
|
|
329
|
+
[ "$(echo "$line" | jq -r '.sequence | type')" = "number" ]
|
|
319
330
|
}
|
|
320
331
|
|
|
321
|
-
@test "emit:
|
|
332
|
+
@test "emit: honors ONLOOKER_PLUGIN_NAME for the plugin field" {
|
|
322
333
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
323
|
-
|
|
324
|
-
[ "$status" -eq 0 ]
|
|
334
|
+
ONLOOKER_PLUGIN_NAME="prompt-rules" prompt_rules_emit "sess-plugin" "prompt_rule.applied" '{"rule_id":"r9"}'
|
|
325
335
|
|
|
326
336
|
local line
|
|
327
337
|
line=$(tail -1 "$ONLOOKER_EVENTS_LOG")
|
|
328
|
-
[ "$(echo "$line" | jq -
|
|
338
|
+
[ "$(echo "$line" | jq -r '.plugin')" = "prompt-rules" ]
|
|
329
339
|
}
|
|
330
340
|
|
|
331
341
|
@test "emit: defaults session id to 'unknown' when none is given" {
|
|
332
342
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
333
|
-
prompt_rules_emit "" "prompt_rule.matched"
|
|
343
|
+
prompt_rules_emit "" "prompt_rule.matched" "$MATCHED_PAYLOAD"
|
|
334
344
|
|
|
335
345
|
local line
|
|
336
346
|
line=$(tail -1 "$ONLOOKER_EVENTS_LOG")
|
|
337
347
|
[ "$(echo "$line" | jq -r '.session_id')" = "unknown" ]
|
|
338
348
|
}
|
|
339
349
|
|
|
340
|
-
|
|
350
|
+
# The old hand-built envelope added `turn` from ONLOOKER_TURN_NUMBER. event.v1.json
|
|
351
|
+
# is additionalProperties:false and has no `turn`, so that field was one of the
|
|
352
|
+
# reasons those lines could never validate. The canonical emitter carries a turn
|
|
353
|
+
# as `turn_number` inside the payload, and neither prompt_rule payload schema
|
|
354
|
+
# declares that property, so the turn has nowhere valid to live on these events.
|
|
355
|
+
@test "emit: does not add a turn field the envelope schema forbids" {
|
|
341
356
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
342
|
-
ONLOOKER_TURN_NUMBER=7 prompt_rules_emit "sess-turn" "prompt_rule.matched"
|
|
357
|
+
ONLOOKER_TURN_NUMBER=7 prompt_rules_emit "sess-turn" "prompt_rule.matched" "$MATCHED_PAYLOAD"
|
|
343
358
|
|
|
344
359
|
local line
|
|
345
360
|
line=$(tail -1 "$ONLOOKER_EVENTS_LOG")
|
|
346
|
-
[ "$(echo "$line" | jq -r '
|
|
347
|
-
[ "$(echo "$line" | jq -r '.
|
|
361
|
+
[ "$(echo "$line" | jq -r 'has("turn")')" = "false" ]
|
|
362
|
+
[ "$(echo "$line" | jq -r '.payload | has("turn_number")')" = "false" ]
|
|
348
363
|
}
|
|
349
364
|
|
|
350
|
-
@test "emit:
|
|
365
|
+
@test "emit: returns 1 and writes nothing when event_type is empty" {
|
|
351
366
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
367
|
+
run prompt_rules_emit "sess-empty" ""
|
|
368
|
+
[ "$status" -eq 1 ]
|
|
369
|
+
[ ! -s "$ONLOOKER_EVENTS_LOG" ]
|
|
370
|
+
}
|
|
355
371
|
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
372
|
+
# Fail-closed is the whole point of routing through the emitter: an event that
|
|
373
|
+
# cannot be made valid must not reach the bus at all. Before this change the
|
|
374
|
+
# same call wrote a line regardless.
|
|
375
|
+
@test "emit: rejects a matched payload missing the schema's required fields" {
|
|
376
|
+
: >"$ONLOOKER_EVENTS_LOG"
|
|
377
|
+
expect_emission_rejected prompt_rules_emit "sess-bad" "prompt_rule.matched" '{"rule_id":"only-id"}'
|
|
378
|
+
[ "$status" -ne 0 ]
|
|
379
|
+
[ ! -s "$ONLOOKER_EVENTS_LOG" ]
|
|
360
380
|
}
|
|
361
381
|
|
|
362
|
-
@test "emit:
|
|
382
|
+
@test "emit: rejects an empty payload for an event type that requires fields" {
|
|
363
383
|
: >"$ONLOOKER_EVENTS_LOG"
|
|
364
|
-
|
|
365
|
-
[ "$status" -
|
|
384
|
+
expect_emission_rejected prompt_rules_emit "sess-nopayload" "prompt_rule.matched"
|
|
385
|
+
[ "$status" -ne 0 ]
|
|
386
|
+
[ ! -s "$ONLOOKER_EVENTS_LOG" ]
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
@test "emit: rejects an unknown event type" {
|
|
390
|
+
: >"$ONLOOKER_EVENTS_LOG"
|
|
391
|
+
expect_emission_rejected prompt_rules_emit "sess-unknown" "prompt_rule.invented" '{}'
|
|
392
|
+
[ "$status" -ne 0 ]
|
|
366
393
|
[ ! -s "$ONLOOKER_EVENTS_LOG" ]
|
|
367
394
|
}
|
|
395
|
+
|
|
396
|
+
@test "emit: accepts prompt_rule.applied with the fields the injector sends" {
|
|
397
|
+
: >"$ONLOOKER_EVENTS_LOG"
|
|
398
|
+
run prompt_rules_emit "sess-applied" "prompt_rule.applied" '{"rule_id":"r9","guidance_chars":42}'
|
|
399
|
+
[ "$status" -eq 0 ]
|
|
400
|
+
|
|
401
|
+
local line
|
|
402
|
+
line=$(tail -1 "$ONLOOKER_EVENTS_LOG")
|
|
403
|
+
[ "$(echo "$line" | jq -r '.payload.guidance_chars')" = "42" ]
|
|
404
|
+
}
|
package/test/bus-coverage.json
CHANGED
|
@@ -55,6 +55,8 @@
|
|
|
55
55
|
"lineage.query.answered",
|
|
56
56
|
"memory.recalled",
|
|
57
57
|
"onlooker.artifact.ready",
|
|
58
|
+
"prompt_rule.applied",
|
|
59
|
+
"prompt_rule.matched",
|
|
58
60
|
"session.compact",
|
|
59
61
|
"session.end",
|
|
60
62
|
"session.prompt",
|
|
@@ -113,8 +115,6 @@
|
|
|
113
115
|
"onlooker.session.summary": "emitted by the agent, not this repo",
|
|
114
116
|
"oracle.calibration.complete": "plugin lives in another repo",
|
|
115
117
|
"oracle.calibration.requested": "plugin lives in another repo",
|
|
116
|
-
"prompt_rule.applied": "prompt_rules_emit in scripts/lib/prompt-rules.sh writes straight to $ONLOOKER_EVENTS_LOG via jq, bypassing onlooker-event.mjs, so it never reaches the schema-validating emitter this harness observes even though test/bats/prompt-rules.bats exercises it",
|
|
117
|
-
"prompt_rule.matched": "prompt_rules_emit in scripts/lib/prompt-rules.sh writes straight to $ONLOOKER_EVENTS_LOG via jq, bypassing onlooker-event.mjs, so it never reaches the schema-validating emitter this harness observes even though test/bats/prompt-rules.bats exercises it",
|
|
118
118
|
"relay.handoff.captured": "plugin lives in another repo",
|
|
119
119
|
"relay.handoff.injected": "plugin lives in another repo",
|
|
120
120
|
"scribe.capture.complete": "no scribe_emit_event call for this type exists anywhere in plugins/scribe; only scribe.distill.complete and onlooker.artifact.ready are wired up",
|