Add session-memory module: Spring AI 2.1 Session API (event log, turn-aware windows, compaction with summarizer, SessionAdvisors, JDBC on PostgreSQL 16) with 14 transcripts and the 2.0 ChatMemory deprecation warnings from javac. Spring Boot 4.1.1, Spring AI 2.1.0, Java 25.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6jDW7zqoKDMTRrCyq
This commit is contained in:
Claude
2026-11-22 18:39:32 +05:30
parent 0006167c24
commit 7612fca082
39 changed files with 1149 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Compiles src/broken/LegacyChatMemory.java (the 2.0 ChatMemory setup) against Spring AI 2.1.0 with
# -Xlint:deprecation and keeps the compiler's own words in output/12-chatmemory-deprecations.txt.
set -euo pipefail
cd "$(dirname "$0")/.."
mvn -q -B dependency:build-classpath -Dmdep.outputFile=target/cp.txt >/dev/null 2>&1
mkdir -p target/legacy output
{
echo "# javac -Xlint:deprecation on the Spring AI 2.0 ChatMemory setup, compiled against Spring AI 2.1.0"
echo
echo '$ javac -Xlint:deprecation -cp <2.1.0 classpath> src/broken/LegacyChatMemory.java'
javac -Xlint:deprecation -d target/legacy -cp "$(cat target/cp.txt)" src/broken/LegacyChatMemory.java 2>&1 \
| grep -v '^Picked up' | sed 's#^src/broken/##' | sed 's/\.\.\. [0-9a-f]*$//'
} > output/12-chatmemory-deprecations.txt
cat output/12-chatmemory-deprecations.txt
+10
View File
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
# Regenerates every file under output/. The test suite writes 01-11, 13 and 14 through the Transcript
# helper; 12 comes from scripts/capture-deprecations.sh. Tests that need PostgreSQL are SKIPPED (not
# failed) when nothing listens on 127.0.0.1:5440 -- run scripts/services-up.sh first for 10 and 11.
set -euo pipefail
cd "$(dirname "$0")/.."
rm -rf target output
mvn -q -B test
scripts/capture-deprecations.sh >/dev/null
ls output
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Starts PostgreSQL 16 on 127.0.0.1:5440 (apt: postgresql-16, runs as the postgres user, database chatdb, role chat/chat).
# If you already have PostgreSQL, skip this and set SM_PG_URL to your JDBC URL.
set -euo pipefail
PGDATA="${PGDATA:-/tmp/pgchat/data}"; PGPORT="${PGPORT:-5440}"; SOCKDIR="$(dirname "$PGDATA")"
BIN="$(ls -d /usr/lib/postgresql/*/bin 2>/dev/null | sort -V | tail -1)"
as_pg() { if [ "$(id -u)" = 0 ]; then su postgres -c "$*"; else bash -c "$*"; fi; }
mkdir -p "$SOCKDIR"; [ "$(id -u)" = 0 ] && chown postgres "$SOCKDIR"
[ -d "$PGDATA/base" ] || as_pg "'$BIN/initdb' -D '$PGDATA' -A trust >'$SOCKDIR/initdb.log' 2>&1"
as_pg "'$BIN/pg_ctl' -D '$PGDATA' status" >/dev/null 2>&1 || \
as_pg "'$BIN/pg_ctl' -D '$PGDATA' -o \"-p $PGPORT -c listen_addresses=127.0.0.1 -c unix_socket_directories=$SOCKDIR\" -l '$SOCKDIR/pg.log' -w start"
PSQL="$BIN/psql -h $SOCKDIR -p $PGPORT -U postgres -v ON_ERROR_STOP=1 -q"
as_pg "$PSQL -d postgres -tc \"select 1 from pg_roles where rolname='chat'\"" | grep -q 1 || as_pg "$PSQL -d postgres -c \"create role chat login superuser password 'chat'\""
as_pg "$PSQL -d postgres -tc \"select 1 from pg_database where datname='chatdb'\"" | grep -q 1 || as_pg "$PSQL -d postgres -c 'create database chatdb owner chat'"
echo "postgres 127.0.0.1:$PGPORT (chatdb / chat / chat)"