Skip to content

Commit e11eeea

Browse files
AVADSA25Mikarina13claude
authored
Automatic triggers: a readable title instead of the raw pattern (#447)
The 'CODEC is watching' menu titled each trigger with its raw rule, for example clipboard~https?://[^\s<>'"]+. The trigger list now sends a label (the skill and when it starts: "Clipboard url fetch: when you copy matching text") and the page shows it as the title, with the rule on the detail line. Pages restamped for the new codec-shell.js. Co-authored-by: Mickael Farina <farina.mickael@gmail.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 1547862 commit e11eeea

10 files changed

Lines changed: 36 additions & 9 deletions

‎codec_chat.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@
431431
</style>
432432
</head>
433433
<body>
434-
<script src="/static/codec-shell.js?v=611c650d" data-page="chat" data-title="Chat" data-status data-model-slot></script>
434+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="chat" data-title="Chat" data-status data-model-slot></script>
435435
<div class="app cs-main" id="appContainer">
436436
<div class="messages" id="messages" role="log" aria-live="polite" aria-label="Conversation"></div>
437437

‎codec_cortex.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@
182182
</style>
183183
</head>
184184
<body>
185-
<script src="/static/codec-shell.js?v=611c650d" data-page="cortex" data-title="Cortex"></script>
185+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="cortex" data-title="Cortex"></script>
186186
<div class="cs-main cortex-main">
187187
<div id="stats"></div>
188188
<div id="viewSwitch">

‎codec_dashboard.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@
666666
</style>
667667
</head>
668668
<body>
669-
<script src="/static/codec-shell.js?v=611c650d" data-page="home" data-title="Today" data-status></script>
669+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="home" data-title="Today" data-status></script>
670670

671671
<!-- ── Connect your AI (first run) ─────────────────────────────────────────
672672
Shown until CODEC has a VERIFIED brain. A fresh paid install had no way

‎codec_tasks.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
</style>
226226
</head>
227227
<body>
228-
<script src="/static/codec-shell.js?v=611c650d" data-page="tasks" data-title="Tasks" data-status></script>
228+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="tasks" data-title="Tasks" data-status></script>
229229
<div class="cs-main cs-scroll">
230230
<div class="container">
231231
<div class="tabs" role="tablist" aria-label="Tasks sections">

‎codec_vibe.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
</style>
179179
</head>
180180
<body>
181-
<script src="/static/codec-shell.js?v=611c650d" data-page="vibe" data-title="Vibe" data-status></script>
181+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="vibe" data-title="Vibe" data-status></script>
182182
<div class="ov" id="ov" onclick="cS()"></div>
183183
<div class="sd" id="sd" role="dialog" aria-modal="true" aria-label="Projects" data-dialog="sh">
184184
<div style="padding:14px 16px;border-bottom:1px solid var(--bd);display:flex;align-items:center;justify-content:space-between"><h2 style="font-family:var(--mn);font-size:var(--fs-13);color:var(--ac)">PROJECTS</h2><button type="button" onclick="cS()" aria-label="Close projects" data-dialog-close style="background:0;border:0;color:var(--tx2);cursor:pointer;display:flex;padding:0"><svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></button></div>

‎codec_voice.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@
264264
</style>
265265
</head>
266266
<body id="body">
267-
<script src="/static/codec-shell.js?v=611c650d" data-page="voice" data-title="Voice" data-status></script>
267+
<script src="/static/codec-shell.js?v=95fbf3b8" data-page="voice" data-title="Voice" data-status></script>
268268
<div class="call-container cs-main">
269269

270270
<!-- The orb: its size follows the level. Press and hold it to talk. -->

‎docs/known-issues.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ waits on a model call (not traced yet). Pages are unreachable until then. Fix:
427427
find that call and run it after startup, in the background, with a short timeout. Found in the Mac merge pass. Revisit:
428428
the next item that touches dashboard startup.
429429

430-
## Automatic triggers show their raw pattern as the title (2026-10-07)
430+
## Automatic triggers show their raw pattern as the title (2026-10-07) — FIXED (a sentence per type; the rule moved to the detail line)
431431

432432
The 'CODEC is watching' menu's Automatic triggers list (P3.7) titles each trigger
433433
with `codec_triggers`' summary, which is the raw match rule, for example

‎routes/triggers.py‎

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,21 @@
3232
router = APIRouter(prefix="/api/triggers", tags=["triggers"])
3333

3434

35+
# A readable title for the pages; the raw rule stays in "summary".
36+
_TYPE_SENTENCE = {
37+
"window_title_match": "when a window title matches",
38+
"clipboard_pattern": "when you copy matching text",
39+
"file_change": "when matching files change",
40+
"time": "on a schedule",
41+
"compound": "when several conditions match",
42+
}
43+
44+
45+
def _plain_label(trig) -> str:
46+
name = str(trig.skill_name).replace("_", " ").strip()
47+
return f"{name[:1].upper() + name[1:]}: {_TYPE_SENTENCE.get(trig.type, 'when its rule matches')}"
48+
49+
3550
def _trigger_summary(trig) -> dict:
3651
"""Render a Trigger to a JSON-safe dict for the API."""
3752
from codec_triggers import _resolve_mute, cooldown_remaining, is_killed
@@ -41,6 +56,7 @@ def _trigger_summary(trig) -> dict:
4156
"skill_name": trig.skill_name,
4257
"type": trig.type,
4358
"summary": trig.short_summary(),
59+
"label": _plain_label(trig),
4460
"cooldown_seconds": trig.cooldown_seconds,
4561
"cooldown_remaining": cooldown_remaining(trig.key, trig.cooldown_seconds),
4662
"require_confirmation": trig.require_confirmation,

‎static/codec-shell.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,9 +1471,9 @@
14711471
list.innerHTML = (d.global_enabled === false ? '<p class="cs-ib-meta">All triggers are off on this Mac (TRIGGERS_ENABLED).</p>' : '') +
14721472
ts.map(function (t) {
14731473
var state = t.killed ? 'Turned off' : (t.muted ? 'Muted' : 'Active');
1474-
return '<div class="cs-ib cs-trig-row"><div class="cs-ib-head"><span class="cs-ib-title">' + esc(t.summary || t.skill_name) +
1474+
return '<div class="cs-ib cs-trig-row"><div class="cs-ib-head"><span class="cs-ib-title">' + esc(t.label || t.summary || t.skill_name) +
14751475
'</span><span class="cs-ib-when">' + esc(state) + '</span></div>' +
1476-
'<p class="cs-ib-meta">' + esc(t.skill_name) + ' · ' + esc(String(t.type || '').replace(/_/g, ' ')) + '</p>' +
1476+
'<p class="cs-ib-meta">' + esc(t.skill_name) + (t.summary ? ' · rule: ' + esc(t.summary) : '') + '</p>' +
14771477
'<div class="cs-ib-acts">' +
14781478
'<button type="button" class="cs-dbtn" data-t="mute" data-key="' + esc(t.trigger_key) + '" data-on="' + (t.muted ? 1 : 0) + '">' + (t.muted ? 'Unmute' : 'Mute') + '</button>' +
14791479
'<button type="button" class="cs-dbtn" data-t="kill" data-key="' + esc(t.trigger_key) + '" data-on="' + (t.killed ? 1 : 0) + '">' + (t.killed ? 'Turn on' : 'Turn off') + '</button>' +

‎tests/test_watching.py‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,14 @@ def test_the_eye_shows_and_pauses_under_jsdom():
235235
assert d["items"][3:] == ["What CODEC sees now", "Automatic triggers", "Observer settings"]
236236
assert d["paused"] == ['{"minutes":15}']
237237
assert d["after"][0] is True and re.match(r"Watching paused until \d", d["after"][1])
238+
239+
240+
def test_triggers_get_a_readable_title(obs):
241+
trig = SimpleNamespace(key="k2", skill_name="clipboard_url_fetch", type="clipboard_pattern",
242+
short_summary=lambda: "clipboard~https?://[^\\s]+", cooldown_seconds=60,
243+
require_confirmation=True, destructive=False)
244+
d = obs.rt._trigger_summary(trig)
245+
assert d["label"] == "Clipboard url fetch: when you copy matching text", "a sentence, not the raw pattern"
246+
assert d["summary"].startswith("clipboard~"), "the raw rule is still sent, for the detail line"
247+
shell = (REPO / "static" / "codec-shell.js").read_text(encoding="utf-8")
248+
assert "esc(t.label || t.summary || t.skill_name)" in shell and "' · rule: ' + esc(t.summary)" in shell

0 commit comments

Comments
 (0)