claude-dev-env 8.118.1 → 8.119.1
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/bin/git_hooks_installer.mjs +26 -2
- package/bin/git_hooks_installer.test.mjs +36 -0
- package/bin/install-transaction.mjs +3 -1
- package/bin/install.mjs +12 -8
- package/bin/install.test.mjs +89 -0
- package/bin/install.transaction.test.mjs +34 -0
- package/bin/merge_profile_settings.mjs +3 -2
- package/bin/merge_profile_settings.test.mjs +25 -1
- package/bin/profile-stop-gate.mjs +2 -1
- package/bin/profile-stop-gate.test.mjs +26 -1
- package/bin/write-file-atomically.mjs +148 -0
- package/bin/write-file-atomically.test.mjs +263 -0
- package/docs/agents-guidance/asks.md +1 -1
- package/docs/rule-guides/session-title.md +18 -2
- package/hooks/features/conduct-gates.md +2 -2
- package/hooks/hooks_constants/session_title_constants.py +13 -0
- package/hooks/session/test_tracking_nudge.py +212 -4
- package/hooks/session/tracking_nudge.py +86 -7
- package/package.json +1 -1
|
@@ -14,12 +14,22 @@ on the first ask after each compaction::
|
|
|
14
14
|
-> task list note + no title note
|
|
15
15
|
"Sign the APKs", a later ask -> nothing, or the title note
|
|
16
16
|
"did the export fail?" -> nothing
|
|
17
|
-
"<task-notification>...</task-notification>"
|
|
17
|
+
"<task-notification>...</task-notification>", title shows a red flag
|
|
18
|
+
-> wake note
|
|
19
|
+
"<task-notification>...</task-notification>", any other title
|
|
18
20
|
-> nothing
|
|
19
21
|
|
|
22
|
+
A turn that an event starts carries no message from the user. The hook counts a
|
|
23
|
+
prompt as an event when it is one ``<task-notification>`` envelope, such as a
|
|
24
|
+
finished delegate, a pull request wake, or a turn review notice, or one queued
|
|
25
|
+
``<agent-message>`` hand-back, followed by nothing but reminder blocks. While
|
|
26
|
+
the title shows the red flag, the wake note asks the agent to set the status
|
|
27
|
+
that fits now if the event cleared what the user had to do. It shows on each
|
|
28
|
+
such prompt. Any other prompt gets no wake note.
|
|
29
|
+
|
|
20
30
|
The note never blocks. The Stop gate ``open_tasks_stop_gate.py`` holds the turn
|
|
21
31
|
once only when the agent skipped the task list. No hook holds a turn for the
|
|
22
|
-
title.
|
|
32
|
+
title. All three title notes need the title tool in the transcript, and the no title
|
|
23
33
|
note shows at most once in a session, compactions included.
|
|
24
34
|
"""
|
|
25
35
|
|
|
@@ -48,14 +58,19 @@ from hooks_constants.open_tasks_stop_gate_constants import (
|
|
|
48
58
|
)
|
|
49
59
|
from hooks_constants.pre_tool_use_stdin import read_hook_input_dictionary_from_stdin
|
|
50
60
|
from hooks_constants.session_title_constants import (
|
|
61
|
+
ALL_NO_WAKE_SENDER_NAMES,
|
|
51
62
|
ALL_STALE_AT_START_STATUSES,
|
|
52
63
|
NO_TITLE_NUDGE_ONCE_MARKER_NAME,
|
|
53
64
|
NO_TITLE_NUDGE_TEMPLATE,
|
|
65
|
+
RED_FLAG_STATUS,
|
|
54
66
|
TITLE_NUDGE_TEMPLATE,
|
|
55
67
|
TITLE_TOOL_DISPLAY_SEPARATOR,
|
|
68
|
+
WAKE_EVENT_ENVELOPE_PATTERN,
|
|
69
|
+
WAKE_FLAG_NUDGE_TEMPLATE,
|
|
70
|
+
WAKE_SENDER_GROUP_NAME,
|
|
56
71
|
)
|
|
57
72
|
from once_per_session import claim_first_showing, claim_only_showing
|
|
58
|
-
from open_task_asks import is_ask
|
|
73
|
+
from open_task_asks import is_ask, prompt_without_reminders
|
|
59
74
|
from session_title_transcript import (
|
|
60
75
|
available_title_tools,
|
|
61
76
|
read_transcript_entries,
|
|
@@ -96,19 +111,83 @@ def title_nudge(
|
|
|
96
111
|
return TITLE_NUDGE_TEMPLATE.format(title=title, tool_name=tool_name)
|
|
97
112
|
|
|
98
113
|
|
|
114
|
+
def is_event_wake(prompt_text: str) -> bool:
|
|
115
|
+
"""Return True when a harness event sent the whole prompt, with no words from the user.
|
|
116
|
+
|
|
117
|
+
::
|
|
118
|
+
|
|
119
|
+
"<task-notification>...</task-notification>" -> True
|
|
120
|
+
'<agent-message from="a1">...</agent-message>' -> True
|
|
121
|
+
"<task-notification>...</task-notification><system-reminder>...</system-reminder>"
|
|
122
|
+
-> True
|
|
123
|
+
"<task-notification>...</task-notification> Why did it fail?" -> False
|
|
124
|
+
'<agent-message from=" Human">...</agent-message>', from="" -> False
|
|
125
|
+
"<task-notification>It quotes </task-notification>.</task-notification>"
|
|
126
|
+
-> False
|
|
127
|
+
'<task-notification id="a1">...', "<TASK-NOTIFICATION>..." -> False
|
|
128
|
+
"", "<system-reminder>...</system-reminder>", '<wake ...>...' -> False
|
|
129
|
+
|
|
130
|
+
The prompt must open, after white space, with one envelope. Its opening tag
|
|
131
|
+
is a bare lower case ``<task-notification>``, or ``<agent-message>`` with
|
|
132
|
+
``from`` as its only attribute. The sender must not be empty or ``human``.
|
|
133
|
+
The sender check ignores letter case and the white space around the name.
|
|
134
|
+
Only reminder blocks and white space may follow the envelope.
|
|
135
|
+
|
|
136
|
+
The first closing tag ends the envelope. A body that quotes its own closing
|
|
137
|
+
tag reads as an envelope with typed text after it, so it is no wake.
|
|
138
|
+
"""
|
|
139
|
+
text = prompt_text.lstrip()
|
|
140
|
+
envelope = WAKE_EVENT_ENVELOPE_PATTERN.match(text)
|
|
141
|
+
if envelope is None:
|
|
142
|
+
return False
|
|
143
|
+
sender = envelope.group(WAKE_SENDER_GROUP_NAME)
|
|
144
|
+
if sender is not None and sender.strip().casefold() in ALL_NO_WAKE_SENDER_NAMES:
|
|
145
|
+
return False
|
|
146
|
+
return not prompt_without_reminders(text[envelope.end() :])
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
def wake_flag_nudge(prompt_text: str, all_entries: list[dict[str, object]]) -> str | None:
|
|
150
|
+
"""Return the wake note when an event starts the turn while the title shows the red flag.
|
|
151
|
+
|
|
152
|
+
::
|
|
153
|
+
|
|
154
|
+
"<task-notification>...", title shows "\U0001f6a9 Merge approval" -> note naming it
|
|
155
|
+
"<task-notification>...", shows "✅ Gate" or "⏳ Export" -> None
|
|
156
|
+
"Export the APKs", title shows "\U0001f6a9 Merge approval" -> None
|
|
157
|
+
no title tool in the transcript -> None
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
prompt_text: The ``prompt`` field of the UserPromptSubmit payload.
|
|
161
|
+
all_entries: The transcript entries, oldest first.
|
|
162
|
+
|
|
163
|
+
Returns:
|
|
164
|
+
The note text, or None.
|
|
165
|
+
"""
|
|
166
|
+
if not is_event_wake(prompt_text):
|
|
167
|
+
return None
|
|
168
|
+
all_title_tools = available_title_tools(all_entries)
|
|
169
|
+
title = shown_title(all_entries)
|
|
170
|
+
if not all_title_tools or title is None or title_status(title) != RED_FLAG_STATUS:
|
|
171
|
+
return None
|
|
172
|
+
tool_name = TITLE_TOOL_DISPLAY_SEPARATOR.join(all_title_tools)
|
|
173
|
+
return WAKE_FLAG_NUDGE_TEMPLATE.format(title=title, tool_name=tool_name)
|
|
174
|
+
|
|
175
|
+
|
|
99
176
|
def ask_tracking_context(
|
|
100
177
|
prompt_text: str,
|
|
101
178
|
all_entries: list[dict[str, object]],
|
|
102
179
|
all_hook_fields: Mapping[str, object],
|
|
103
180
|
) -> str | None:
|
|
104
|
-
"""Return the note for a prompt that asks for work,
|
|
181
|
+
"""Return the note for a prompt that asks for work, the wake note for an event, else None.
|
|
105
182
|
|
|
106
183
|
The task list note shows on the session's first ask and on the first ask
|
|
107
|
-
after each compaction. The title note shows on every ask while the title is
|
|
108
|
-
and the no title note on the first ask in the session that finds no
|
|
184
|
+
after each compaction. The title note shows on every ask while the title is
|
|
185
|
+
stale, and the no title note on the first ask in the session that finds no
|
|
186
|
+
title. A prompt that asks for no work gets only the wake note, and only when
|
|
187
|
+
``wake_flag_nudge`` builds one.
|
|
109
188
|
"""
|
|
110
189
|
if not is_ask(prompt_text):
|
|
111
|
-
return
|
|
190
|
+
return wake_flag_nudge(prompt_text, all_entries)
|
|
112
191
|
tracker_note = (
|
|
113
192
|
TASK_LIST_NUDGE
|
|
114
193
|
if claim_first_showing(TASK_LIST_NUDGE_ONCE_MARKER_NAME, all_hook_fields)
|