@kaydash9999/banker-plugins 0.18.0 → 0.19.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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/CHANGELOG.md +103 -0
- package/README.md +18 -7
- package/bin/lib/telemetry-config.mjs +25 -0
- package/codex/manifest.json +1 -0
- package/codex/transform-matrix.md +1 -0
- package/hooks/graceful-pause.mjs +4 -2
- package/hooks/obsidize-hook.mjs +61 -32
- package/hooks/progress-plan.mjs +14 -8
- package/hooks/progress.mjs +187 -48
- package/hooks/register.mjs +15 -7
- package/hooks/telemetry-count-skill.mjs +4 -6
- package/hooks/telemetry-count.mjs +4 -6
- package/hooks/update-checkin.mjs +46 -43
- package/hooks/update-fetch.mjs +8 -7
- package/package.json +1 -1
- package/skills/anti-drm/SKILL.md +46 -15
- package/skills/anti-drm/scripts/anti-drm.mjs +213 -61
- package/skills/anti-drm/scripts/instruction-toggle.mjs +280 -44
- package/skills/lineage/SKILL.md +4 -1
- package/skills/lineage/lineage.py +196 -73
- package/skills/omc-patch/SKILL.md +37 -11
- package/skills/omc-patch/scripts/omc-patch.mjs +635 -103
- package/skills/theme-selection/SKILL.md +165 -0
- package/skills/theme-selection/assets/LICENSE +21 -0
- package/skills/theme-selection/assets/NOTICE.md +30 -0
- package/skills/theme-selection/assets/palettes.json +81 -0
- package/skills/theme-selection/references/contrast.md +138 -0
- package/skills/theme-selection/references/integrate.md +161 -0
- package/skills/theme-selection/scripts/themes.mjs +1067 -0
- package/skills/tone-compact/SKILL.md +14 -5
- package/skills/tone-compact/scripts/instruction-toggle.mjs +280 -44
- package/skills/tone-compact/scripts/tone-compact.mjs +4 -4
- package/skills/update-banker/SKILL.md +1 -1
package/hooks/progress.mjs
CHANGED
|
@@ -7,23 +7,29 @@
|
|
|
7
7
|
* step for the work at hand. Under each step are the tool calls made while it was the step in
|
|
8
8
|
* progress (a subagent's or a background agent's included), one level deep. A press on a step or
|
|
9
9
|
* a call shows a short description under the list; a press on a step's arrow folds or unfolds its
|
|
10
|
-
* calls.
|
|
10
|
+
* calls. Of two calls on the task list that overlap, the one begun later stands, and a list or a
|
|
11
|
+
* read begun before a change keeps what changed after it began; the engine's own order of
|
|
12
|
+
* overlapping calls is not something this module can see.
|
|
11
13
|
*
|
|
12
|
-
* Claude 5 models get no task list tool in Claude Code 2.1.296
|
|
13
|
-
*
|
|
14
|
-
*
|
|
14
|
+
* Claude 5 models get no task list tool in Claude Code 2.1.296 and 2.1.300 unless
|
|
15
|
+
* CLAUDE_CODE_ENABLE_TODO_TOOLS is set; older models and a background job get one. (Seen in a
|
|
16
|
+
* live 2.1.300 session with Haiku 5.5: with the variable TaskCreate, TaskUpdate, TaskList and
|
|
17
|
+
* TaskGet came and the pane showed their list; without it, none.) Opening the pane offers the
|
|
18
|
+
* model one of its own (`mcp__banker__todo`, TodoWrite's shape) where it has none, and the list it
|
|
19
|
+
* sends is the steps.
|
|
15
20
|
* Above them the pane shows the plan file the session touched last (progress-plan.mjs reads it):
|
|
16
21
|
* the whole plan as a tree that folds like a toggle list, its sections folded at first.
|
|
17
22
|
* A prompt's harness tags leave its title, and a background task's notice (or a teammate's message)
|
|
18
23
|
* goes on with the last prompt's step instead of becoming one: the step runs again while it does,
|
|
19
24
|
* and keeps its own end and time.
|
|
20
25
|
*
|
|
21
|
-
* `/progress` and `/progress show` toggle the pane, `on` and `off` set it.
|
|
22
|
-
* registered `immediate`, so it answers while a turn runs
|
|
23
|
-
* this file: commands/progress.md and
|
|
26
|
+
* `/progress` and `/progress show` toggle the pane, `on` and `off` set it. From Claude Code 2.1.289
|
|
27
|
+
* on the command is registered `immediate`, so it answers while a turn runs; an older engine gets it
|
|
28
|
+
* as a plain command. An engine without mods never loads this file: commands/progress.md and
|
|
29
|
+
* hooks/progress-fallback.mjs answer there instead.
|
|
24
30
|
*/
|
|
25
31
|
|
|
26
|
-
import { cells, clip, fit,
|
|
32
|
+
import { cells, clip, fit, parsePlan, pick, planKind, readPrompt } from './progress-plan.mjs';
|
|
27
33
|
|
|
28
34
|
const COMMAND = 'progress';
|
|
29
35
|
const PANE = 'banker-progress';
|
|
@@ -91,6 +97,8 @@ const NOTICE = {
|
|
|
91
97
|
completed: '백그라운드 작업 끝남', failed: '백그라운드 작업 실패', stopped: '백그라운드 작업 중지됨',
|
|
92
98
|
killed: '백그라운드 작업 중지됨', message: '팀원 메시지',
|
|
93
99
|
};
|
|
100
|
+
// How a notice's turn ended other than with an answer, as the row under its step says it.
|
|
101
|
+
const NOTICE_END = { aborted: '알림 처리 중단됨', refusal: '알림 처리 거절됨', error: '알림 처리 오류로 끝남' };
|
|
94
102
|
// How a prompt's turn ended (turn.complete's reason), as its step's state.
|
|
95
103
|
const ENDED = { answer: 'done', aborted: 'stopped', refusal: 'refused', error: 'failed' };
|
|
96
104
|
// Why a hook failed (the kind of the engine's HookFailure), for a failure that brings no message.
|
|
@@ -108,12 +116,17 @@ const tally = () => ({ calls: [], count: 0, failed: 0 });
|
|
|
108
116
|
// The calls made while the task list has no task in progress.
|
|
109
117
|
const looseStep = () => ({ key: 'loose', title: '작업 목록 밖의 작업', ...tally() });
|
|
110
118
|
|
|
111
|
-
// `rev` counts the task changes (TaskCreate, TaskUpdate) taken in,
|
|
119
|
+
// `rev` counts the task changes (TaskCreate, TaskUpdate) taken in, and `order` the calls begun: a TaskList or
|
|
120
|
+
// TaskGet begun before a change keeps what changed after it began, and of two calls that overlap the one begun later
|
|
121
|
+
// stands. `marks` holds, per task id, the orders that decide it (markOf). `listAt` is the order of the TaskList the
|
|
122
|
+
// list last came from.
|
|
112
123
|
// `plan` is the plan last read from `planPath`, `planShut` whether the whole plan is folded and
|
|
113
124
|
// `planOpen` the ids of its nodes unfolded. `touch` counts the calls that touched a plan file and
|
|
114
|
-
// `taken` is the touch the plan came from, to tell a read that a newer one overtook.
|
|
125
|
+
// `taken` is the touch the plan came from, to tell a read that a newer one overtook. `followed` is the step in
|
|
126
|
+
// progress the pane last asked to bring into view.
|
|
115
127
|
export const freshState = () => ({ turns: [], tasks: new Map(), todos: null, loose: looseStep(), open: new Set(), selected: null, seq: 0, rev: 0,
|
|
116
|
-
plan: null, planPath: null, planShut: false, planOpen: new Set(), touch: 0, taken: 0
|
|
128
|
+
order: 0, marks: new Map(), listAt: 0, plan: null, planPath: null, planShut: false, planOpen: new Set(), touch: 0, taken: 0,
|
|
129
|
+
followed: null });
|
|
117
130
|
|
|
118
131
|
const tail = (path) => String(path).split(/[\\/]/).filter(Boolean).slice(-2).join('/');
|
|
119
132
|
const seconds = (ms) => {
|
|
@@ -179,7 +192,10 @@ function dropFinished(s) {
|
|
|
179
192
|
s.loose = looseStep();
|
|
180
193
|
}
|
|
181
194
|
|
|
195
|
+
// A main turn's start. A subagent's, a fork's or a teammate's run (it carries an agentId; Claude Code 2.1.300
|
|
196
|
+
// raises turn.start for them too) makes no step: its calls go under the step in progress.
|
|
182
197
|
export function startTurn(s, e, now) {
|
|
198
|
+
if (e.agentId) return;
|
|
183
199
|
const said = readPrompt(e.text);
|
|
184
200
|
if (said.kind === 'notice') return noticeTurn(s, e, said, now);
|
|
185
201
|
dropFinished(s);
|
|
@@ -187,13 +203,16 @@ export function startTurn(s, e, now) {
|
|
|
187
203
|
}
|
|
188
204
|
|
|
189
205
|
// A main turn's end; a subagent's (it carries an agentId) ends no step, and a notice's leaves its
|
|
190
|
-
// step's own end as it was. A turn
|
|
191
|
-
// the
|
|
206
|
+
// step's own end as it was. A notice's turn that did not end with an answer (stopped, refused, an
|
|
207
|
+
// error) adds a row saying so under the step. A turn the module never saw start (it loaded mid-turn)
|
|
208
|
+
// ends the step for the work at hand.
|
|
192
209
|
export function endTurn(s, e, now) {
|
|
193
210
|
if (e.agentId) return;
|
|
194
211
|
const host = s.turns.find((x) => x.notices.has(e.turnId));
|
|
195
212
|
if (host) {
|
|
196
213
|
host.notices.delete(e.turnId);
|
|
214
|
+
const how = pick(NOTICE_END, e.reason);
|
|
215
|
+
if (how) note(s, host, how, false, now);
|
|
197
216
|
return;
|
|
198
217
|
}
|
|
199
218
|
const t = s.turns.find((x) => x.id === e.turnId) ?? s.turns.find((x) => x.id === AT_HAND && x.status === 'running');
|
|
@@ -275,17 +294,48 @@ function putTask(s, t, now) {
|
|
|
275
294
|
while (s.tasks.size > MAX_STEPS) s.tasks.delete(overflow([...s.tasks.values()]).id);
|
|
276
295
|
}
|
|
277
296
|
|
|
278
|
-
|
|
297
|
+
// The marks of a task id, made on first use. They live in the state, not on the task, so a task deleted, or not
|
|
298
|
+
// created yet, keeps them: `changedRev` the change count after its last TaskCreate or TaskUpdate (a delete
|
|
299
|
+
// included), `statusAt` and `status` the order and the status of the last status update begun, `seenAt` the order
|
|
300
|
+
// of the last read taken in.
|
|
301
|
+
function markOf(s, id) {
|
|
302
|
+
if (!s.marks.has(id)) s.marks.set(id, {});
|
|
303
|
+
return s.marks.get(id);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
// Whether a list or a read begun at (since, order) is older than what the pane holds of a task: a list begun after it
|
|
307
|
+
// was taken in (a list names the whole list, so this holds for a task it left out that the pane never held, too), the
|
|
308
|
+
// task changed after it began (a delete too), or a later-begun read already brought it.
|
|
309
|
+
function stale(s, id, since, order) {
|
|
310
|
+
if (order < s.listAt) return true;
|
|
311
|
+
const m = s.marks.get(id);
|
|
312
|
+
return Boolean(m) && ((m.changedRev ?? 0) > since || order < (m.seenAt ?? 0));
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
// An update begun after the create may end first (the ids are predictable): its status stands, and a delete wins.
|
|
316
|
+
function createTask(s, e, r, now, { order }) {
|
|
279
317
|
const id = r?.result?.task?.id;
|
|
280
318
|
if (id === undefined) return;
|
|
281
|
-
|
|
319
|
+
const m = s.marks.get(String(id));
|
|
320
|
+
const status = m && order < (m.statusAt ?? 0) ? m.status : 'pending';
|
|
321
|
+
if (status === 'deleted') return;
|
|
322
|
+
putTask(s, { id: String(id), subject: e.subject, description: e.description, activeForm: e.activeForm, status }, now);
|
|
282
323
|
}
|
|
283
324
|
|
|
284
|
-
//
|
|
285
|
-
|
|
286
|
-
|
|
325
|
+
// The status a TaskUpdate left: the change it answers with, else the one it asked for.
|
|
326
|
+
const updatedStatus = (e, r) => r?.result?.statusChange?.to ?? e.status;
|
|
327
|
+
|
|
328
|
+
// A task this module never saw (a list from before it loaded, or one another session shares) joins the list while
|
|
329
|
+
// it is not done. Of two status updates to one task, the one begun later stands; an update without a status (an
|
|
330
|
+
// owner, a description) brings its words only.
|
|
331
|
+
function updateTask(s, e, r, now, { order }) {
|
|
287
332
|
const id = String(e.taskId);
|
|
288
|
-
const status = r
|
|
333
|
+
const status = updatedStatus(e, r);
|
|
334
|
+
if (status !== undefined) {
|
|
335
|
+
const m = markOf(s, id);
|
|
336
|
+
if (order < (m.statusAt ?? 0)) return;
|
|
337
|
+
Object.assign(m, { statusAt: order, status });
|
|
338
|
+
}
|
|
289
339
|
if (status === 'deleted') {
|
|
290
340
|
s.tasks.delete(id);
|
|
291
341
|
return;
|
|
@@ -294,28 +344,61 @@ function updateTask(s, e, r, now) {
|
|
|
294
344
|
putTask(s, { id, subject: e.subject, description: e.description, activeForm: e.activeForm, status }, now);
|
|
295
345
|
}
|
|
296
346
|
|
|
297
|
-
//
|
|
298
|
-
//
|
|
299
|
-
|
|
347
|
+
// The status a list or a read begun at order shows for a task: a status update begun after it stands, also for a
|
|
348
|
+
// task the pane did not hold then.
|
|
349
|
+
const readStatus = (s, id, order, status) => {
|
|
350
|
+
const m = s.marks.get(id);
|
|
351
|
+
return m && order < (m.statusAt ?? 0) ? m.status : status;
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
// One task a TaskList names: as the pane holds it where it changed since the list began or a later-begun read
|
|
355
|
+
// brought it, else as listed.
|
|
356
|
+
function takeListed(s, before, t, { over, since, order, now }) {
|
|
357
|
+
const id = String(t.id);
|
|
358
|
+
const held = before.get(id);
|
|
359
|
+
if (held) s.tasks.set(id, held);
|
|
360
|
+
if (stale(s, id, since, order)) return;
|
|
361
|
+
const status = readStatus(s, id, order, t.status);
|
|
362
|
+
if (status === 'deleted') return;
|
|
363
|
+
if (held || !over) putTask(s, { id, subject: t.subject, status }, now);
|
|
364
|
+
markOf(s, id).seenAt = order;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
// TaskList names the whole list, in its order: a task it leaves out is gone, unless it changed after the list
|
|
368
|
+
// began. A list whose every task is completed is over, and only brings up to date the tasks still on the pane. A
|
|
369
|
+
// list begun before one already taken in changes nothing.
|
|
370
|
+
function listTasks(s, _e, r, now, { since, order }) {
|
|
300
371
|
const listed = r?.result?.tasks;
|
|
301
|
-
if (
|
|
372
|
+
if (!Array.isArray(listed) || order < s.listAt) return;
|
|
373
|
+
s.listAt = order;
|
|
302
374
|
const over = listed.every((t) => t.status === 'completed');
|
|
303
375
|
const before = s.tasks;
|
|
376
|
+
const named = new Set(listed.map((t) => String(t.id)));
|
|
304
377
|
s.tasks = new Map();
|
|
305
|
-
for (const t of listed) {
|
|
306
|
-
|
|
307
|
-
if (
|
|
308
|
-
if (
|
|
378
|
+
for (const t of listed) takeListed(s, before, t, { over, since, order, now });
|
|
379
|
+
for (const [id, held] of before) {
|
|
380
|
+
if (named.has(id)) continue;
|
|
381
|
+
if (stale(s, id, since, order)) s.tasks.set(id, held);
|
|
382
|
+
else markOf(s, id).seenAt = order;
|
|
309
383
|
}
|
|
310
384
|
}
|
|
311
385
|
|
|
312
|
-
// TaskGet reads one task: one it cannot find is gone, and a completed one off the pane stays off.
|
|
313
|
-
|
|
314
|
-
|
|
386
|
+
// TaskGet reads one task: one it cannot find, or finds deleted, is gone, and a completed one off the pane stays off. A
|
|
387
|
+
// read older than what the pane holds of the task changes nothing. A read taken in makes an earlier-begun read of the
|
|
388
|
+
// task stale, one that leaves the task off the pane too.
|
|
389
|
+
function getTask(s, e, r, now, { since, order }) {
|
|
390
|
+
if (stale(s, String(e.taskId), since, order)) return;
|
|
315
391
|
const t = r?.result?.task;
|
|
316
|
-
if (t === null)
|
|
317
|
-
|
|
318
|
-
|
|
392
|
+
if (t === null) {
|
|
393
|
+
s.tasks.delete(String(e.taskId));
|
|
394
|
+
markOf(s, String(e.taskId)).seenAt = order;
|
|
395
|
+
}
|
|
396
|
+
if (!t) return;
|
|
397
|
+
const id = String(t.id);
|
|
398
|
+
const status = readStatus(s, id, order, t.status);
|
|
399
|
+
if (status === 'deleted') s.tasks.delete(id);
|
|
400
|
+
else if (status !== 'completed' || s.tasks.has(id)) putTask(s, { id, subject: t.subject, description: t.description, status }, now);
|
|
401
|
+
markOf(s, id).seenAt = order;
|
|
319
402
|
}
|
|
320
403
|
|
|
321
404
|
const TASK_NOTES = {
|
|
@@ -329,15 +412,22 @@ const TASK_NOTES = {
|
|
|
329
412
|
// A refused or failed call changes nothing: the task list stays as Claude Code holds it. A TaskUpdate
|
|
330
413
|
// that changed nothing (an id it cannot find, a TaskCompleted hook that blocks) answers
|
|
331
414
|
// `success: false` without isError.
|
|
332
|
-
// TaskList and TaskGet run beside other calls
|
|
333
|
-
// the
|
|
415
|
+
// TaskList and TaskGet run beside other calls (`since` is the count of changes when one began, `order` its place
|
|
416
|
+
// among the calls begun): what changed after it began, or what a later-begun call already brought, stays.
|
|
334
417
|
const refused = (r) => Boolean(r?.deny || r?.isError || r?.result?.success === false);
|
|
335
418
|
const CHANGES = new Set(['TaskCreate', 'TaskUpdate']);
|
|
419
|
+
// The task a TaskCreate or TaskUpdate changed, or undefined where the answer names none.
|
|
420
|
+
const changedId = (e, r) => (e.tool === 'TaskCreate' ? r?.result?.task?.id : e.taskId);
|
|
336
421
|
|
|
337
|
-
export function noteTaskTool(s, e, r, now, since) {
|
|
422
|
+
export function noteTaskTool(s, e, r, now, since = s.rev, order = ++s.order) {
|
|
338
423
|
if (refused(r)) return;
|
|
339
|
-
TASK_NOTES[e.tool]?.(s, e, r, now, since
|
|
340
|
-
if (CHANGES.has(e.tool))
|
|
424
|
+
TASK_NOTES[e.tool]?.(s, e, r, now, { since, order });
|
|
425
|
+
if (!CHANGES.has(e.tool)) return;
|
|
426
|
+
s.rev += 1;
|
|
427
|
+
// Only a change the pane took in marks the task: one it holds after the change, or a delete. An update of a task the
|
|
428
|
+
// pane does not hold leaves the lists alone (its status still counts, through readStatus).
|
|
429
|
+
const id = changedId(e, r);
|
|
430
|
+
if (id !== undefined && (s.tasks.has(String(id)) || updatedStatus(e, r) === 'deleted')) markOf(s, String(id)).changedRev = s.rev;
|
|
341
431
|
}
|
|
342
432
|
|
|
343
433
|
// The list a to-do call sent, each item's words cleaned, or what is wrong with it.
|
|
@@ -369,12 +459,13 @@ export function answerTodo(s, e, now, paneOpen = true) {
|
|
|
369
459
|
|
|
370
460
|
// The plan file a call touched, with the touch's count, when it is one and the call went through:
|
|
371
461
|
// a write by anyone, a read by the session itself (an agent reviewing a plan does not make it the plan).
|
|
372
|
-
// `own` is a write by the session itself.
|
|
462
|
+
// `own` is a write by the session itself; `weak` a review round or open questions beside a plan.
|
|
373
463
|
export function planTouched(s, e, call) {
|
|
374
464
|
const path = e.file_path ?? e.notebook_path;
|
|
375
|
-
|
|
465
|
+
const kind = planKind(path);
|
|
466
|
+
if (!call?.ok || !PLAN_TOUCH.has(e.tool) || !kind || (e.tool === 'Read' && e.agentId)) return null;
|
|
376
467
|
s.touch += 1;
|
|
377
|
-
return { path, touch: s.touch, own: !e.agentId && e.tool !== 'Read' };
|
|
468
|
+
return { path, touch: s.touch, own: !e.agentId && e.tool !== 'Read', weak: kind === 'weak' };
|
|
378
469
|
}
|
|
379
470
|
|
|
380
471
|
function parsed(path, text) {
|
|
@@ -393,10 +484,17 @@ function current(s, path, { touch, since }) {
|
|
|
393
484
|
return path === s.planPath && s.taken <= since;
|
|
394
485
|
}
|
|
395
486
|
|
|
396
|
-
//
|
|
397
|
-
//
|
|
398
|
-
|
|
399
|
-
|
|
487
|
+
// A file with no steps does not push out a plan that has some, unless the session wrote it itself; a weak plan holds no
|
|
488
|
+
// such place, since any plan replaces it.
|
|
489
|
+
const stepless = (s, path, plan, read) => path !== s.planPath && !plan.total && Boolean(s.plan?.total) && !read.own && planKind(s.planPath) !== 'weak';
|
|
490
|
+
|
|
491
|
+
// Whether what was read stays off the pane: no plan; a review round or open questions while the pane shows another
|
|
492
|
+
// plan; or a file with no steps in place of a plan that has some, unless the session wrote it itself (an agent's
|
|
493
|
+
// review written beside a plan, or a note the session only read, does not push the plan away; a plan the session
|
|
494
|
+
// writes is the plan, steps or not).
|
|
495
|
+
const keepsOff = (s, path, plan, read) => !plan
|
|
496
|
+
|| (path !== s.planPath && Boolean(s.plan) && read.weak === true)
|
|
497
|
+
|| stepless(s, path, plan, read);
|
|
400
498
|
|
|
401
499
|
// The ids in a tree, to keep the unfolded ones that are still there when a plan is read again.
|
|
402
500
|
function treeIds(nodes, out = new Set()) {
|
|
@@ -415,7 +513,7 @@ export function takePlan(s, path, text, read = {}) {
|
|
|
415
513
|
const plan = parsed(path, text);
|
|
416
514
|
if (keepsOff(s, path, plan, read)) return;
|
|
417
515
|
const moving = path !== s.planPath;
|
|
418
|
-
if (read.touch !== undefined) s.taken = read.touch;
|
|
516
|
+
if (read.touch !== undefined && !read.weak) s.taken = read.touch; // a weak plan does not make an older touch late
|
|
419
517
|
if (moving && s.selected === 'plan') s.selected = null;
|
|
420
518
|
const ids = treeIds(plan.tree);
|
|
421
519
|
s.planOpen = moving ? new Set() : new Set([...s.planOpen].filter((id) => ids.has(id)));
|
|
@@ -442,6 +540,9 @@ export function steps(s) {
|
|
|
442
540
|
return s.loose.calls.length ? [...items, { ...s.loose, status: looseStatus(s, items) }] : items;
|
|
443
541
|
}
|
|
444
542
|
|
|
543
|
+
// The key of the step in progress (a task or a to-do item in progress, or the prompt that runs), or null.
|
|
544
|
+
const runningKey = (s) => [...steps(s)].reverse().find((t) => ['in_progress', 'running'].includes(statusOf(t)))?.key ?? null;
|
|
545
|
+
|
|
445
546
|
function callCount(step) {
|
|
446
547
|
return `도구 호출 ${step.count}회${step.failed ? `(실패 ${step.failed}회)` : ''}`;
|
|
447
548
|
}
|
|
@@ -655,6 +756,7 @@ export async function runProgress($, args) {
|
|
|
655
756
|
if (pane) await $.ui.close({ id: PANE });
|
|
656
757
|
return {};
|
|
657
758
|
}
|
|
759
|
+
ref.s.followed = null; // before the open: the engine may draw the pane before the open answers
|
|
658
760
|
await showPane($, pane);
|
|
659
761
|
await offerTodo($);
|
|
660
762
|
return {};
|
|
@@ -676,6 +778,7 @@ export const SPEC = { name: COMMAND, description: '진행 상황 패널을 켜
|
|
|
676
778
|
async function watchCall($, e, next) {
|
|
677
779
|
const s = ref.s;
|
|
678
780
|
const since = s.rev;
|
|
781
|
+
const order = ++s.order;
|
|
679
782
|
const call = startCall(s, e, Date.now());
|
|
680
783
|
let r = { isError: true };
|
|
681
784
|
try {
|
|
@@ -683,9 +786,9 @@ async function watchCall($, e, next) {
|
|
|
683
786
|
return r;
|
|
684
787
|
} finally {
|
|
685
788
|
endCall(call, r, Date.now());
|
|
686
|
-
if (TASK_TOOLS.has(e.tool)) noteTaskTool(s, e, r, Date.now(), since);
|
|
789
|
+
if (TASK_TOOLS.has(e.tool)) noteTaskTool(s, e, r, Date.now(), since, order);
|
|
687
790
|
const touched = planTouched(s, e, call);
|
|
688
|
-
if (touched) takePlan(s, touched.path, await readText($, touched.path), { touch: touched.touch, own: touched.own });
|
|
791
|
+
if (touched) takePlan(s, touched.path, await readText($, touched.path), { touch: touched.touch, own: touched.own, weak: touched.weak });
|
|
689
792
|
$.ui.invalidate('ui.render');
|
|
690
793
|
}
|
|
691
794
|
}
|
|
@@ -708,6 +811,41 @@ async function readText($, path) {
|
|
|
708
811
|
// The session's progress, one per loaded module.
|
|
709
812
|
const ref = { s: freshState() };
|
|
710
813
|
|
|
814
|
+
// How long a move waits, and how many times it asks. The row a change brings is drawn after the invalidate that came
|
|
815
|
+
// with it; a move asked before that is refused ("no element of its own is drawn under that key" in 2.1.300).
|
|
816
|
+
const FOLLOW_WAIT_MS = 100;
|
|
817
|
+
const FOLLOW_TRIES = 4;
|
|
818
|
+
|
|
819
|
+
// Brings the step in progress into the pane's window as the pane draws, when that step changed (a task started, a
|
|
820
|
+
// new prompt) or the pane was opened again: in a long list it can sit below the window. Only a drawn pane asks, so a
|
|
821
|
+
// closed one or a tab behind another asks nothing. `nearest` moves nothing while its row shows, and the person's own
|
|
822
|
+
// scrolling stands until the next change. An engine without the move changes nothing.
|
|
823
|
+
function follow($) {
|
|
824
|
+
const key = runningKey(ref.s);
|
|
825
|
+
if (!key || key === ref.s.followed) return;
|
|
826
|
+
ref.s.followed = key;
|
|
827
|
+
followSoon($, key, FOLLOW_TRIES);
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
// Asks for the move after a wait, and again while the row is not drawn yet. A later change of the step in progress,
|
|
831
|
+
// or any other refusal (no surface, the person moved the window meanwhile), ends it.
|
|
832
|
+
function followSoon($, key, tries) {
|
|
833
|
+
try {
|
|
834
|
+
$.clock.after(FOLLOW_WAIT_MS, async () => {
|
|
835
|
+
if (ref.s.followed !== key) return;
|
|
836
|
+
let answer;
|
|
837
|
+
try {
|
|
838
|
+
answer = await $.ui.scroll({ to: { key: `row-${key}` }, in: PANE, block: 'nearest' });
|
|
839
|
+
} catch {
|
|
840
|
+
return; /* an engine without $.ui.scroll */
|
|
841
|
+
}
|
|
842
|
+
if (tries > 1 && /\bdrawn\b/.test(answer?.deny ?? '')) followSoon($, key, tries - 1);
|
|
843
|
+
});
|
|
844
|
+
} catch {
|
|
845
|
+
/* an engine without $.clock */
|
|
846
|
+
}
|
|
847
|
+
}
|
|
848
|
+
|
|
711
849
|
// The command and the events only this feature hooks. register.mjs hooks the events every banker
|
|
712
850
|
// feature shares (the engine takes one hook per event from the module) and calls the functions
|
|
713
851
|
// below for them. The fallback's name is hooked too: where mods run, `/banker:progress` toggles
|
|
@@ -735,6 +873,7 @@ export function registerProgress(on) {
|
|
|
735
873
|
on('ui.render', { component: 'Pane' }, async ($, e, next) => {
|
|
736
874
|
if (e.requestId !== PANE) return next(e);
|
|
737
875
|
const redraw = () => $.ui.invalidate('ui.render');
|
|
876
|
+
follow($);
|
|
738
877
|
const cols = Number.isFinite(e.props?.bodyColumns) ? e.props.bodyColumns : Infinity;
|
|
739
878
|
const act = {
|
|
740
879
|
cols,
|
package/hooks/register.mjs
CHANGED
|
@@ -5,9 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* The engine reads the module's source before it runs it: each `on("<event>", hook)` names its
|
|
7
7
|
* event as a string literal, an event without a matcher is hooked once in the whole module (its
|
|
8
|
-
* imported files included), and `$` goes only to functions declared in the file that holds it
|
|
9
|
-
*
|
|
10
|
-
*
|
|
8
|
+
* imported files included), and `$` goes only to functions declared in the file that holds it
|
|
9
|
+
* (2.1.300 also takes a function imported from the module's own files; an older engine refuses
|
|
10
|
+
* the whole module, so this file keeps to the older rule, and a test holds it). So each feature
|
|
11
|
+
* (graceful-pause.mjs, progress.mjs) hooks the events only it needs, and this file hooks the
|
|
12
|
+
* four they share: it calls the features' plain functions for them and makes the
|
|
11
13
|
* engine calls itself, the module's command registrations among them. The engine shows a
|
|
12
14
|
* `$.ui.log` line under the plugin's name, so the lines here do not repeat it.
|
|
13
15
|
*/
|
|
@@ -37,13 +39,18 @@ async function registerOne($, spec) {
|
|
|
37
39
|
}
|
|
38
40
|
}
|
|
39
41
|
|
|
40
|
-
//
|
|
41
|
-
|
|
42
|
+
// A command spec without `immediate`, for an engine where answering at once was not seen to work.
|
|
43
|
+
const withoutImmediate = ({ immediate: _immediate, ...spec }) => spec;
|
|
44
|
+
|
|
45
|
+
// /graceful-pause from 2.1.289 on (an older engine gets one line saying why). /progress wherever mods run, as a
|
|
46
|
+
// command that answers at once (immediate) only from 2.1.289 on, where that was seen to work; below it, or with no
|
|
47
|
+
// version, it answers when the turn ends. A name the engine refuses is logged and the other still registers.
|
|
42
48
|
async function registerCommands($) {
|
|
43
49
|
const version = await engineVersion($);
|
|
44
|
-
|
|
50
|
+
const recent = atLeast(version, MIN_ENGINE);
|
|
51
|
+
if (recent) await registerOne($, PAUSE_SPEC);
|
|
45
52
|
else $.ui.log(`/${PAUSE} 는 Claude Code ${MIN_ENGINE.join('.')} 이상에서만 켭니다 (이 엔진: ${version || '버전 미상'})`);
|
|
46
|
-
await registerOne($, PROGRESS_SPEC);
|
|
53
|
+
await registerOne($, recent ? PROGRESS_SPEC : withoutImmediate(PROGRESS_SPEC));
|
|
47
54
|
}
|
|
48
55
|
|
|
49
56
|
// /progress's plan file, read again at a turn's start and end: a ralph PRD or a plan's checkboxes
|
|
@@ -90,6 +97,7 @@ export const register = (on) => {
|
|
|
90
97
|
on('session.end', async ($, e, next) => {
|
|
91
98
|
pauseReset();
|
|
92
99
|
progressReset();
|
|
100
|
+
$.ui.invalidate('ui.render'); // the pane shows at once what /clear emptied
|
|
93
101
|
return next(e);
|
|
94
102
|
});
|
|
95
103
|
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { appendFileSync, mkdirSync, readFileSync } from 'node:fs';
|
|
24
24
|
|
|
25
|
-
import { configDir, countingActive, recordUsedSkill, USAGE_LOG_PATH, LOG_MAX_LINES } from '../bin/lib/telemetry-config.mjs';
|
|
26
|
-
|
|
27
|
-
// banker:<name> 전체 일치 - 이름 문자열 자체를 검증한다(TAB/개행 등 이질 문자가 섞여
|
|
28
|
-
// usage-log 의 `name\thour` 형식을 깨는 것을 막는다). i 플래그는 매칭만 관대하게(실제 이름은 소문자).
|
|
29
|
-
const NAME_RE = /^banker:[a-z0-9_-]+$/i;
|
|
25
|
+
import { configDir, countingActive, recordUsedSkill, USAGE_LOG_PATH, LOG_MAX_LINES, SKILL_NAME_RE } from '../bin/lib/telemetry-config.mjs';
|
|
30
26
|
|
|
31
27
|
function readStdin() {
|
|
32
28
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
@@ -39,11 +35,13 @@ function readStdin() {
|
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
// PostToolUse(Skill) payload 에서 모델이 자동 호출한 banker:<name> 스킬 이름을 추출한다.
|
|
38
|
+
// 이름은 telemetry-config 의 SKILL_NAME_RE 전체 일치로 검증한다(TAB, 개행 같은 글자가 usage-log 의
|
|
39
|
+
// `name\thour` 형식을 깨지 않게).
|
|
42
40
|
// 주 소스는 tool_input.skill, 없거나 미매치면 보조로 tool_response.commandName 을 시도한다.
|
|
43
41
|
function extractName(payload) {
|
|
44
42
|
const candidates = [payload?.tool_input?.skill, payload?.tool_response?.commandName];
|
|
45
43
|
for (const c of candidates) {
|
|
46
|
-
if (typeof c === 'string' &&
|
|
44
|
+
if (typeof c === 'string' && SKILL_NAME_RE.test(c)) return c;
|
|
47
45
|
}
|
|
48
46
|
return null;
|
|
49
47
|
}
|
|
@@ -22,11 +22,7 @@
|
|
|
22
22
|
*/
|
|
23
23
|
import { appendFileSync, mkdirSync, readFileSync } from 'node:fs';
|
|
24
24
|
|
|
25
|
-
import { configDir, countingActive, recordUsedSkill, USAGE_LOG_PATH, LOG_MAX_LINES } from '../bin/lib/telemetry-config.mjs';
|
|
26
|
-
|
|
27
|
-
// banker:<name> 전체 일치 - 이름 문자열 자체를 검증한다(TAB/개행 등 이질 문자가 섞여
|
|
28
|
-
// usage-log 의 `name\thour` 형식을 깨는 것을 막는다). i 플래그는 매칭만 관대하게(실제 이름은 소문자).
|
|
29
|
-
const NAME_RE = /^banker:[a-z0-9_-]+$/i;
|
|
25
|
+
import { configDir, countingActive, recordUsedSkill, USAGE_LOG_PATH, LOG_MAX_LINES, SKILL_NAME_RE } from '../bin/lib/telemetry-config.mjs';
|
|
30
26
|
|
|
31
27
|
function readStdin() {
|
|
32
28
|
return new Promise((resolvePromise, rejectPromise) => {
|
|
@@ -39,11 +35,13 @@ function readStdin() {
|
|
|
39
35
|
}
|
|
40
36
|
|
|
41
37
|
// UserPromptExpansion payload 에서 사용자가 직접 호출한 banker:<name> 이름을 추출한다.
|
|
38
|
+
// 이름은 telemetry-config 의 SKILL_NAME_RE 전체 일치로 검증한다(TAB, 개행 같은 글자가 usage-log 의
|
|
39
|
+
// `name\thour` 형식을 깨지 않게).
|
|
42
40
|
// command_source 가 'plugin' 이고 command_name 이 banker:<name> 형식일 때만 반환, 그 외 null.
|
|
43
41
|
function extractName(payload) {
|
|
44
42
|
if (payload?.command_source !== 'plugin') return null;
|
|
45
43
|
const name = payload?.command_name;
|
|
46
|
-
return (typeof name === 'string' &&
|
|
44
|
+
return (typeof name === 'string' && SKILL_NAME_RE.test(name)) ? name : null;
|
|
47
45
|
}
|
|
48
46
|
|
|
49
47
|
// 파일의 개행 개수 = 줄 수(각 append 가 끝에 개행을 붙이므로). 없거나 읽기 실패면 0.
|