Compare commits
No commits in common. "799cc1f2e0a2b93e036c848fd4a7ed31ecb9c9b8" and "bab4e987c34ddcb8dab2570249ae695eeac9f6cd" have entirely different histories.
799cc1f2e0
...
bab4e987c3
5 changed files with 9 additions and 68 deletions
2
Makefile
2
Makefile
|
|
@ -1,5 +1,5 @@
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
# Knowledge Genome - Makefile v. 1.11.0
|
# Knowledge Genome - Makefile v. 1.10.0
|
||||||
# Orchestrates the setup and management of the knowledge base.
|
# Orchestrates the setup and management of the knowledge base.
|
||||||
# =============================================================================
|
# =============================================================================
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -79,44 +79,6 @@ case "$cmd" in
|
||||||
# MECHANICAL step: validate manifest -> index/log/scoped-lint/commit/PR -> 1 JSON line
|
# MECHANICAL step: validate manifest -> index/log/scoped-lint/commit/PR -> 1 JSON line
|
||||||
exec "${HOME}/.pi/agent/skills/ingest/scripts/run-ingest.sh" "${genome}"
|
exec "${HOME}/.pi/agent/skills/ingest/scripts/run-ingest.sh" "${genome}"
|
||||||
;;
|
;;
|
||||||
"pi ingest-rework "*)
|
|
||||||
# args: <genome> <raw_path> <feedback_base64> (3 token).
|
|
||||||
# Feedback in base64 nell'argv: il nodo SSH di n8n non passa stdin, e cosi' i metacaratteri
|
|
||||||
# della review (apici, newline, $(...)) sono neutralizzati.
|
|
||||||
args="${cmd#pi ingest-rework }"
|
|
||||||
genome="${args%% *}"; tmp="${args#* }"
|
|
||||||
raw_path="${tmp%% *}"; fb_b64="${tmp#* }"
|
|
||||||
if [ "$genome" = "$args" ] || [ "$raw_path" = "$tmp" ] || [ -z "$fb_b64" ]; then
|
|
||||||
echo '{"status":"error","reason":"usage: pi ingest-rework <genome> <raw_path> <feedback_b64>"}'; exit 1
|
|
||||||
fi
|
|
||||||
case "$genome" in ""|*[!a-z0-9-]*) echo '{"status":"error","reason":"invalid genome"}'; exit 1;; esac
|
|
||||||
case "$raw_path" in raw/*) : ;; *) echo '{"status":"error","reason":"raw_path must be under raw/"}'; exit 1;; esac
|
|
||||||
case "$raw_path" in *..*|*//*) echo '{"status":"error","reason":"raw_path traversal"}'; exit 1;; esac
|
|
||||||
case "$raw_path" in *[!A-Za-z0-9._/-]*) echo '{"status":"error","reason":"raw_path illegal chars"}'; exit 1;; esac
|
|
||||||
case "$fb_b64" in *[!A-Za-z0-9+/=]*) echo '{"status":"error","reason":"feedback not base64"}'; exit 1;; esac
|
|
||||||
|
|
||||||
logger -t n8n-pi-wrap "ok: pi ingest-rework ${genome} ${raw_path}"
|
|
||||||
feedback="$(printf '%s' "$fb_b64" | base64 -d 2>/dev/null || true)"
|
|
||||||
|
|
||||||
# lock per-genoma: serializza con gli ingest normali
|
|
||||||
exec 9>"/run/lock/kg-ingest-${genome}.lock" 2>/dev/null || exec 9>"/tmp/kg-ingest-${genome}.lock"
|
|
||||||
if ! flock -n 9; then
|
|
||||||
echo '{"status":"busy","reason":"another ingest is running for this genome","genome":"'"$genome"'"}'; exit 0
|
|
||||||
fi
|
|
||||||
set -a; . "${HOME}/.config/knowledge-genome.env"; set +a
|
|
||||||
cd "${GENOMES_ROOT}/${genome}" || { echo '{"status":"error","reason":"unknown genome"}'; exit 1; }
|
|
||||||
[ -f "$raw_path" ] || { echo '{"status":"error","reason":"raw file not found"}'; exit 1; }
|
|
||||||
: "${KG_LIB_DIR:=${HOME}/knowledge-genome-orchestrator/lib}"
|
|
||||||
source "${KG_LIB_DIR}/clean-start.sh" 2>/dev/null \
|
|
||||||
|| { echo '{"status":"error","reason":"clean-start.sh not found"}'; exit 1; }
|
|
||||||
clean_start || { echo '{"status":"error","reason":"clean-start failed"}'; exit 1; }
|
|
||||||
log="$(mktemp -t pi-rework.XXXXXX.log)"
|
|
||||||
INGEST_FEEDBACK="$feedback" \
|
|
||||||
"${HOME}/.pi/agent/skills/ingest/scripts/ingest-semantic.py" "${genome}" "${raw_path}" \
|
|
||||||
>"$log" 2>&1 \
|
|
||||||
|| { echo "{\"status\":\"error\",\"stage\":\"semantic\",\"reason\":\"rework failed\",\"log\":\"${log}\"}"; exit 1; }
|
|
||||||
exec "${HOME}/.pi/agent/skills/ingest/scripts/run-ingest.sh" "${genome}"
|
|
||||||
;;
|
|
||||||
"pi changed-raw "*)
|
"pi changed-raw "*)
|
||||||
# List raw/ files changed between two commits, one per line (the webhook payload
|
# List raw/ files changed between two commits, one per line (the webhook payload
|
||||||
# does NOT include file lists, so vm101's checkout computes the diff itself).
|
# does NOT include file lists, so vm101's checkout computes the diff itself).
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,6 @@ TIMEOUT = int(os.environ.get("INGEST_TIMEOUT", "600"))
|
||||||
# Unset = omit the flag entirely (correct for plain instruct models such as qwen2.5).
|
# Unset = omit the flag entirely (correct for plain instruct models such as qwen2.5).
|
||||||
THINK = os.environ.get("INGEST_THINK")
|
THINK = os.environ.get("INGEST_THINK")
|
||||||
TODAY = datetime.date.today().isoformat()
|
TODAY = datetime.date.today().isoformat()
|
||||||
FEEDBACK = os.environ.get("INGEST_FEEDBACK", "").strip()
|
|
||||||
|
|
||||||
|
|
||||||
def die(stage, reason):
|
def die(stage, reason):
|
||||||
|
|
@ -218,19 +217,13 @@ def call_model(max_retries=2, base_delay=2.0):
|
||||||
existing_conc = ", ".join(sorted(existing_concepts)) or "(none yet)"
|
existing_conc = ", ".join(sorted(existing_concepts)) or "(none yet)"
|
||||||
prompt = SYSTEM_PROMPT.format(existing_entities=existing_ents, existing_concepts=existing_conc)
|
prompt = SYSTEM_PROMPT.format(existing_entities=existing_ents, existing_concepts=existing_conc)
|
||||||
|
|
||||||
user_content = (
|
|
||||||
("REVISION REQUESTED BY THE MAINTAINER (address this explicitly):\n"
|
|
||||||
+ FEEDBACK + "\n\n") if FEEDBACK else ""
|
|
||||||
) + (
|
|
||||||
"Source path: " + raw_rel + "\n\n--- SOURCE START ---\n"
|
|
||||||
+ source_text + "\n--- SOURCE END ---\n\nReturn the JSON now."
|
|
||||||
)
|
|
||||||
|
|
||||||
payload = {
|
payload = {
|
||||||
"model": MODEL,
|
"model": MODEL,
|
||||||
"messages": [
|
"messages": [
|
||||||
{"role": "system", "content": prompt},
|
{"role": "system", "content": prompt},
|
||||||
{"role": "user", "content": user_content },
|
{"role": "user", "content":
|
||||||
|
"Source path: " + raw_rel + "\n\n--- SOURCE START ---\n"
|
||||||
|
+ source_text + "\n--- SOURCE END ---\n\nReturn the JSON now."},
|
||||||
],
|
],
|
||||||
"format": SCHEMA,
|
"format": SCHEMA,
|
||||||
"stream": False,
|
"stream": False,
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,6 @@ body="$(mktemp)"
|
||||||
trap 'rm -f "$body"' EXIT # auto-clean on any exit (success, fail(), or crash)
|
trap 'rm -f "$body"' EXIT # auto-clean on any exit (success, fail(), or crash)
|
||||||
|
|
||||||
{
|
{
|
||||||
echo "<!-- kg:raw=${raw_source} -->" # marker for the rejection loop (invisible in the render)
|
|
||||||
echo "## Summary"
|
echo "## Summary"
|
||||||
echo "$pr_summary"
|
echo "$pr_summary"
|
||||||
echo ""
|
echo ""
|
||||||
|
|
|
||||||
|
|
@ -2,19 +2,6 @@
|
||||||
|
|
||||||
<!-- One sentence: goal of this session and source processed. -->
|
<!-- One sentence: goal of this session and source processed. -->
|
||||||
|
|
||||||
<!--
|
|
||||||
REVIEW GUIDELINES (write the guideline as the FIRST word of your review):
|
|
||||||
REWORK: <what to fix> -> same branch, guided retry
|
|
||||||
RESTART: <why restart> -> close PR, start over from scratch
|
|
||||||
SPLIT: <how to split> -> close PR, reopen as separate branches
|
|
||||||
REJECT: <why not> -> close PR, no retry
|
|
||||||
MERGE -> approve and merge
|
|
||||||
Rules: one concern per directive; be specific to lines/pages; name the principle
|
|
||||||
that was violated; describe the DESIRED STATE; avoid saying “do better.”
|
|
||||||
-->
|
|
||||||
|
|
||||||
Translated with DeepL.com (free version)
|
|
||||||
|
|
||||||
## Pages Created
|
## Pages Created
|
||||||
|
|
||||||
| Path | Type | Maturity |
|
| Path | Type | Maturity |
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue