enhance pi configuration and skills

This commit is contained in:
Rasyidan Akbar F. 2026-07-18 00:35:18 +07:00
commit ab0a86a707
18 changed files with 2000 additions and 159 deletions

View file

@ -0,0 +1,62 @@
/**
* In-memory per-session runtime state.
*
* This data is intentionally ephemeral. Persisted remote compaction artifacts
* live in Pi session entries; this module only caches the currently active
* continuation and reconstructed replay state for the running process.
*/
import type {
RemoteCompactionSessionState,
ResponsesReasoningConfig,
ResponsesTextConfig,
} from "./remote-compaction.ts";
export type ResponsesRequestShapeState = {
updatedAt: number;
reasoning?: ResponsesReasoningConfig;
text?: ResponsesTextConfig;
};
const remoteCompactionBySessionId = new Map<string, RemoteCompactionSessionState>();
const requestShapeBySessionId = new Map<string, ResponsesRequestShapeState>();
export function getRemoteCompactionState(
sessionId: string,
): RemoteCompactionSessionState | undefined {
return remoteCompactionBySessionId.get(sessionId);
}
export function setRemoteCompactionState(
sessionId: string,
state: RemoteCompactionSessionState,
): void {
remoteCompactionBySessionId.set(sessionId, state);
}
export function clearRemoteCompactionState(sessionId: string | undefined): void {
if (!sessionId) return;
remoteCompactionBySessionId.delete(sessionId);
}
export function getResponsesRequestShapeState(
sessionId: string,
): ResponsesRequestShapeState | undefined {
return requestShapeBySessionId.get(sessionId);
}
export function setResponsesRequestShapeState(
sessionId: string,
state: ResponsesRequestShapeState,
): void {
requestShapeBySessionId.set(sessionId, state);
}
export function clearResponsesRequestShapeState(sessionId: string | undefined): void {
if (!sessionId) return;
requestShapeBySessionId.delete(sessionId);
}
export function clearAllRuntimeState(): void {
remoteCompactionBySessionId.clear();
requestShapeBySessionId.clear();
}