CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 14s
CI & Build / integration (push) Successful in 53s
CI & Build / TypeScript typecheck (push) Successful in 54s
CI & Build / Python tests (push) Failing after 1m18s
CI & Build / Build & push image (push) Skipped
status is durable and nothing clears it, so in_progress cannot also mean "someone is on this now". The claim is that second meaning, stored as who and when so it dies on read rather than needing to be cleared. - notes.claimed_by / claimed_at / claim_touched_at / claim_session (0110). - The server stamps it on the write that is the work: reaching in_progress (update or create, via apply_status_transition) and a work log on an open task. done/cancelled/todo release it. Live while touched within CLAIM_LEASE (2h); dead on read past it, with no sweep. - The plugin's PostToolUse hook on update_task/add_task_log binds the harness's session_id (GET /api/plugin/claim-session). It binds only to a live claim the caller holds; it cannot create one. - to_dict carries `claim`. Plugin version minted. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
47 lines
1.9 KiB
Bash
Executable File
47 lines
1.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Scribe — say WHICH session holds a task's claim (milestone 381 step 2).
|
|
#
|
|
# The server stamps a claim on the write that is the work — a task reaching
|
|
# `in_progress`, a work log on an open task — so every MCP client gets a claim
|
|
# that dies on its own once its lease runs out. What the server cannot know is
|
|
# which SESSION made the write: an MCP caller is a user and nothing more.
|
|
#
|
|
# The harness knows. This PostToolUse hook watches `update_task` and
|
|
# `add_task_log` and reports the event's `session_id` against the task the
|
|
# call named, so the claim can say "this session" rather than "someone,
|
|
# recently". Same evidence class as scribe_record_opened.sh: a tool call
|
|
# happened and the harness reported it; nothing here asks the model anything.
|
|
#
|
|
# It cannot CREATE a claim. The server binds the session only to a live claim
|
|
# the caller already holds, so a call that closed the task, or one on a task
|
|
# someone else is working, binds nothing.
|
|
#
|
|
# EXIT 0 AND SILENT, ALWAYS. This decorates a record; a PostToolUse hook that
|
|
# spoke would put a line after every task write, and a failure here must never
|
|
# turn a successful tool call into a hook error.
|
|
set -uo pipefail
|
|
|
|
# shellcheck source=plugin/hooks/scribe_defs.sh
|
|
. "$(dirname "${BASH_SOURCE[0]}")/scribe_defs.sh"
|
|
|
|
command -v curl >/dev/null 2>&1 || exit 0
|
|
scribe_config || exit 0
|
|
|
|
event=$(cat 2>/dev/null || true)
|
|
[ -n "$event" ] || exit 0
|
|
|
|
event_flat=$(printf '%s' "$event" | scribe_json_flat)
|
|
session_id=$(scribe_json_pick "$event_flat" '.session_id')
|
|
[ -n "$session_id" ] || exit 0
|
|
|
|
task_id=$(scribe_json_pick "$event_flat" '.tool_input.task_id')
|
|
task_id=$(printf '%s' "$task_id" | tr -cd '0-9')
|
|
[ -n "$task_id" ] || exit 0
|
|
|
|
sid_enc=$(printf '%s' "$session_id" | scribe_urlenc) || exit 0
|
|
curl -fsS --max-time 4 \
|
|
-H "Authorization: Bearer ${token}" \
|
|
"${url%/}/api/plugin/claim-session?task_id=${task_id}&session_id=${sid_enc}" \
|
|
>/dev/null 2>&1 || true
|
|
exit 0
|