XLLM_SESSION_FEATURE_XLLM_SESSION常量
xllm_session 及其直接依赖。
#define XLLM_SESSION_FEATURE_XLLM_SESSION
pShouldCompact类型
契约注释见公共头文件。
extern "C" { #endif typedef struct xllm_session xllm_session; typedef struct xllm_compaction xllm_compaction; #define XLLM_SESSION_ENTRY_PINNED 0x00000001u #define XLLM_SESSION_ENTRY_SYNTHETIC 0x00000002u #define XLLM_SESSION_DEFAULT_CONTEXT_WINDOW_TOKENS 204800ull #define XLLM_SESSION_DEFAULT_MAX_OUTPUT_TOKENS 131072u #define XLLM_COMPACTION_SECTION_OBJECTIVE(1u << 0) #define XLLM_COMPACTION_SECTION_CONSTRAINTS (1u << 1) #define XLLM_COMPACTION_SECTION_ARCHITECTURE (1u << 2) #define XLLM_COMPACTION_SECTION_COMPLETED (1u << 3) #define XLLM_COMPACTION_SECTION_REPOSITORY_STATE (1u << 4) #define XLLM_COMPACTION_SECTION_VERIFICATION (1u << 5) #define XLLM_COMPACTION_SECTION_OPEN_ISSUES (1u << 6) #define XLLM_COMPACTION_SECTION_NEXT_ACTIONS (1u << 7) #define XLLM_COMPACTION_SECTION_ALL 0x000000ffu #define XLLM_COMPACTION_SECTION_GOAL (1u << 8) #define XLLM_COMPACTION_SECTION_PREFERENCES (1u << 9) #define XLLM_COMPACTION_SECTION_PROGRESS (1u << 10) #define XLLM_COMPACTION_SECTION_KEY_DECISIONS (1u << 11) #define XLLM_COMPACTION_SECTION_NEXT_STEPS (1u << 12) #define XLLM_COMPACTION_SECTION_CRITICAL_CONTEXT (1u << 13) #define XLLM_COMPACTION_SECTION_PI_ALL 0x00003f00u typedef struct xllm_session_config { uint64_t uContextWindowTokens; uint32_t uMaxOutputTokens; uint32_t uOutputReserveTokens; uint32_t uSafetyReserveTokens; uint32_t uRecentTurnsToKeep; uint32_t uToolPruneBytes; uint32_t uSummaryMaxTokens; uint32_t uSummaryMinTokens; uint32_t uCompactionRequiredSections; double fPruneTrigger; double fCompactTrigger; uint32_t uKeepRecentTokens; uint32_t uSummaryMaxBytes; uint32_t uUserMessageCapBytes; uint32_t uToolResultCapBytes; uint32_t uToolResultTotalCapBytes; uint64_t uJournalMaxBytes; const char* sSummaryStyle; const char* sSnapshotPath; } xllm_session_config; typedef enum xllm_session_pressure { XLLM_SESSION_PRESSURE_NONE = 0, XLLM_SESSION_PRESSURE_PRUNE, XLLM_SESSION_PRESSURE_COMPACT, XLLM_SESSION_PRESSURE_OVERFLOW } xllm_session_pressure; typedef struct xllm_session_stats { uint64_t uContextWindowTokens; uint64_t uInputBudgetTokens; uint64_t uOutputReserveTokens; uint64_t uRawActiveTokens; uint64_t uRenderedActiveTokens; uint64_t uPruneThresholdTokens; uint64_t uCompactThresholdTokens; uint64_t uCompactedThroughSequence; uint64_t uCurrentTurn; uint64_t uEntryCount; uint64_t uCompactionCount; uint64_t uJournalSequence; uint32_t uNextMaxOutputTokens; uint32_t uPendingToolCalls; bool bJournalEnabled; xllm_session_pressure ePressure; uint64_t uFillExact; uint64_t uIncrementMax; uint64_t uCachedInputTokens; uint64_t uSummaryTokensExact; uint32_t uSummaryGeneration; uint32_t uAutoCompactStreak; bool bFillExactValid; } xllm_session_stats; typedef struct xllm_compaction_quality { uint32_t uRequiredSections; uint32_t uPresentSections; uint32_t uMissingSections; uint32_t uMinimumSummaryTokens; uint32_t uMaximumSummaryTokens; uint64_t uSourceTokens; uint64_t uSummaryTokens; bool bAccepted; size_t uSummaryBytes; size_t uMaximumSummaryBytes; } xllm_compaction_quality; typedef struct xllm_pending_tool_call { uint64_t uTurn; const char* sId; const char* sName; const char* sArgumentsJson; } xllm_pending_tool_call; typedef struct xllm_session_tail { uint64_t uTurn; xllm_role eRole; bool bHasMessage; } xllm_session_tail; typedef struct xllm_session_summary { const char* sText; uint64_t uThroughSequence; uint32_t uGeneration; uint64_t uPromptTokensAtBirth; uint64_t uOutputTokensAtBirth; } xllm_session_summary; typedef struct xllm_file_ledger { const char* const* psReadFiles; size_t iReadFileCount; const char* const* psModifiedFiles; size_t iModifiedFileCount; } xllm_file_ledger; XRT_API bool xllmSessionNoteFileRead(xllm_session* pSession, const char* sPath); XRT_API bool xllmSessionNoteFileModified(xllm_session* pSession, const char* sPath); XRT_API bool xllmSessionGetFileLedger(const xllm_session* pSession, xllm_file_ledger* pLedger); typedef enum xllm_compact_decision { XLLM_COMPACT_NO = 0, XLLM_COMPACT_YES } xllm_compact_decision; typedef struct xllm_compaction_plan { uint64_t uThroughSequence; uint64_t uPrefixThroughSequence; uint32_t uReserved[3]; } xllm_compaction_plan; struct xllm_session_stats; typedef struct xllm_compaction_ops { xllm_compact_decision (*pShouldCompact)(xllm_session*, const xllm_session_stats* pStats, void* pUserData); bool (*pPlan)(xllm_session*, uint64_t uPrevThrough, xllm_compaction_plan* pPlan, void* pUserData); bool (*pSerialize)(xllm_session*, uint64_t uFrom, uint64_t uTo, char** psText, void* pUserData); bool (*pBuildPrompt)(xllm_session*, const char* sPrevSummary, const char* sCandidates, char** psPrompt, void* pUserData); bool (*pSummarize)(xllm_session*, const char* sPrompt, char** psSummary, xllm_usage* pUsageOut, void* pUserData); bool (*pEvaluate)(xllm_session*, const char* sSummary, xllm_compaction_quality* pQuality, void* pUserData); void (*pOnCommitted)(xllm_session*, const xllm_session_summary*, void* pUserData); void* pUserData; uint32_t uReserved[4]; } xllm_compaction_ops; XRT_API const xllm_compaction_ops* xllmSessionDefaultCompactionOps(void); XRT_API bool xllmSessionSetCompactionOps(xllm_session*, const xllm_compaction_ops* pOps ); typedef enum xllm_render_action { XLLM_RENDER_KEEP = 0, XLLM_RENDER_MODIFIED, XLLM_RENDER_SKIP } xllm_render_action; typedef enum xllm_session_event_type { XLLM_SESSION_EVENT_TURN_BEGIN = 1, XLLM_SESSION_EVENT_TURN_END, XLLM_SESSION_EVENT_ENTRY_ADDED, XLLM_SESSION_EVENT_FILL_UPDATED, XLLM_SESSION_EVENT_PRESSURE_CHANGED, XLLM_SESSION_EVENT_COMPACT_PREPARE, XLLM_SESSION_EVENT_COMPACT_PLAN, XLLM_SESSION_EVENT_COMPACT_PROMPT, XLLM_SESSION_EVENT_COMPACT_SUMMARY, XLLM_SESSION_EVENT_COMPACT_EVALUATE, XLLM_SESSION_EVENT_COMPACT_COMMIT, XLLM_SESSION_EVENT_COMPACT_ABORT, XLLM_SESSION_EVENT_LADDER_TRUNCATE, XLLM_SESSION_EVENT_JOURNAL_RECORD, XLLM_SESSION_EVENT_CHECKPOINT_SAVED, XLLM_SESSION_EVENT_SESSION_RECOVERED, XLLM_SESSION_EVENT_SESSION_FORKED } xllm_session_event_type; typedef struct xllm_session_event { xllm_session_event_type eType; uint64_t uTurn; uint64_t uSeqFrom; uint64_t uSeqTo; const xllm_session_stats* pStats; const char* sText; } xllm_session_event; typedef struct xllm_session_hooks { xllm_render_action (*pRenderMessage)(xllm_session*, uint64_t uSequence, uint64_t uTurn, uint32_t uEntryFlags, xllm_message* pWork, void* pUserData); bool (*pRenderSummary)(xllm_session*, const xllm_session_summary*, xllm_message* pWork, void* pUserData); bool (*pRenderComplete)(xllm_session*, xllm_request* pRequest, void* pUserData); void (*pOnEvent)(xllm_session*, const xllm_session_event* pEvent, void* pUserData); void* pUserData; uint32_t uReserved[4]; } xllm_session_hooks; XRT_API bool xllmSessionSetHooks(xllm_session*, const xllm_session_hooks* pHooks ); XRT_API void xllmSessionConfigInit(xllm_session_config*); XRT_API uint64_t xllmSessionComputeSafetyReserve(uint64_t uContextWindowTokens); XRT_API uint32_t xllmSessionComputeOutputReserve(uint64_t uContextWindowTokens, uint32_t uMaxOutputTokens); XRT_API uint64_t xllmEstimateTextTokens(const char* sText); XRT_API uint64_t xllmEstimateMessageTokens(const xllm_message* pMessage); XRT_API xllm_session* xllmSessionCreate(const xllm_session_config* pConfig, xllm_error* pError); XRT_API xllm_session* xllmSessionFork(const xllm_session* pSession, xllm_error* pError); XRT_API void xllmSessionDestroy(xllm_session* pSession); XRT_API bool xllmSessionGetConfig(const xllm_session* pSession, xllm_session_config* pConfig); XRT_API uint64_t xllmSessionBeginTurn(xllm_session* pSession); XRT_API uint64_t xllmSessionCurrentTurn(const xllm_session* pSession); XRT_API bool xllmSessionAddMessage(xllm_session* pSession, uint64_t uTurn, const xllm_message* pMessage, uint32_t uFlags); XRT_API bool xllmSessionAddText(xllm_session* pSession, uint64_t uTurn, xllm_role eRole, const char* sContent, uint32_t uFlags); XRT_API bool xllmSessionSetSystemPrompt(xllm_session* pSession, const char* sText, xllm_error* pError); XRT_API bool xllmSessionAddAssistantResponse(xllm_session* pSession, uint64_t uTurn, const xllm_response* pResponse); XRT_API bool xllmSessionAddToolResult(xllm_session* pSession, uint64_t uTurn, const char* sToolCallId, const char* sContent); XRT_API bool xllmSessionAddToolResultWithImage(xllm_session* pSession, uint64_t uTurn, const char* sToolCallId, const char* sContent, const unsigned char* pImageBytes, size_t iImageSize, const char* sImageMime); XRT_API bool xllmSessionAddReference(xllm_session* pSession, uint64_t uTurn, const char* sSource, const char* sContent); XRT_API bool xllmSessionRecordUsage(xllm_session* pSession, const xllm_usage* pUsage); XRT_API bool xllmSessionGetTail(const xllm_session* pSession, xllm_session_tail* pTail); XRT_API size_t xllmSessionPendingToolCallCount(const xllm_session* pSession); XRT_API bool xllmSessionPendingToolCallAt(const xllm_session* pSession, size_t iIndex, xllm_pending_tool_call* pCall); XRT_API bool xllmSessionGetStats(const xllm_session* pSession, xllm_session_stats* pStats); XRT_API bool xllmSessionBuildRequest(const xllm_session* pSession, xllm_request* pRequest, xllm_error* pError); XRT_API bool xllmSessionBuildRequestView(const xllm_session* pSession, xllm_request* pRequest, xllm_error* pError); XRT_API bool xllmSessionGetSummary(const xllm_session* pSession, xllm_session_summary* pSummary); XRT_API xllm_compaction* xllmSessionPrepareCompaction(xllm_session* pSession, bool bForce, xllm_error* pError); XRT_API const char* xllmCompactionPrompt(const xllm_compaction* pCompaction); XRT_API uint64_t xllmCompactionThroughSequence(const xllm_compaction* pCompaction); XRT_API uint64_t xllmCompactionEstimatedTokens(const xllm_compaction* pCompaction); XRT_API bool xllmCompactionSetUsage(xllm_compaction* pCompaction, const xllm_usage* pUsage); XRT_API bool xllmCompactionEvaluateSummary(const xllm_compaction* pCompaction, const char* sSummary, xllm_compaction_quality* pQuality, xllm_error* pError); XRT_API bool xllmSessionCommitCompaction(xllm_session* pSession, xllm_compaction* pCompaction, const char* sSummary, xllm_error* pError); XRT_API void xllmCompactionDestroy(xllm_compaction* pCompaction); XRT_API bool xllmSessionMaybeCompact(xllm_session* pSession, bool* pbCompact, xllm_error* pError); XRT_API bool xllmSessionOverflowLadder(xllm_session* pSession, xllm_error* pError); XRT_API bool xllmSessionSave(const xllm_session* pSession, const char* sPath, xllm_error* pError); XRT_API xllm_session* xllmSessionLoad(const char* sPath, xllm_error* pError); XRT_API bool xllmSessionEnableJournal(xllm_session* pSession, const char* sJournalPath, xllm_error* pError); XRT_API void xllmSessionDisableJournal(xllm_session* pSession); XRT_API const char* xllmSessionJournalPath(const xllm_session* pSession); XRT_API bool xllmSessionCheckpoint(xllm_session* pSession, const char* sSnapshotPath, xllm_error* pError); XRT_API xllm_session* xllmSessionRecover(const char* sSnapshotPath, const char* sJournalPath, const xllm_session_config* pConfigIfNew, xllm_error* pError); XRT_API xllm_session* xllmSessionCreateBound(const xllm_session_config* pConfig, xllm_client* pClient , xllm_error* pError); XRT_API xllm_result xllmSessionSend(xllm_session* pSession, const char* sUserText, const xllm_stream_callbacks* pCallbacks , xllm_response** ppResponse, xllm_error* pError); XRT_API xllm_result xllmSessionComplete(xllm_session* pSession, const xllm_stream_callbacks* pCallbacks , xllm_response** ppResponse, xllm_error* pError); typedef xllm_result (*xllm_test_call_proc)(void* pUserData, const xllm_request* pRequest, const xllm_stream_callbacks* pCallbacks, xllm_response** ppResponse, xllm_error* pError); XRT_API xllm_session* xllmSessionCreateForTest(const xllm_session_config* pConfig, xllm_test_call_proc pCall, void* pUserData, xllm_error* pError); XRT_API bool xllmSessionBindClient(xllm_session* pSession, xllm_client* pClient ); XRT_API bool xllmSessionSetTestCall(xllm_session* pSession, xllm_test_call_proc pCall, void* pUserData); XRT_API bool xllmSessionForwardDriver(xllm_session* pDst, const xllm_session* pSrc); typedef struct xllm_run_policy { uint32_t uMaxRounds; const char* sModel; xcancel* pCancel; int64_t iTimeout; bool (*pOnRound)(xllm_session* pSession, uint32_t uRound, const xllm_response* pResponse, size_t iPendingToolCalls, void* pUserData); void* pUserData; uint32_t uReserved[4]; } xllm_run_policy; typedef struct xllm_run_summary { uint32_t uRounds; uint32_t uToolCalls; bool bStoppedByPolicy; char* sFinalText; xllm_usage tLastUsage; uint32_t uReserved[4]; } xllm_run_summary; XRT_API void xllmRunPolicyInit(xllm_run_policy* pPolicy); XRT_API void xllmRunSummaryUnit(xllm_run_summary* pSummary); XRT_API xllm_result xllmSessionRunWithTools(xllm_session* pSession, const char* sPrompt, const xllm_executor* pExecutor, const xllm_stream_callbacks* pCallbacks, const xllm_run_policy* pPolicy , xllm_run_summary* pSummary , xllm_error* pError)
XLLM_SESSION_PRESSURE_NONE常量
契约注释见公共头文件。
XLLM_SESSION_PRESSURE_NONE
XLLM_SESSION_PRESSURE_PRUNE常量
契约注释见公共头文件。
XLLM_SESSION_PRESSURE_PRUNE
XLLM_SESSION_PRESSURE_COMPACT常量
契约注释见公共头文件。
XLLM_SESSION_PRESSURE_COMPACT
XLLM_SESSION_PRESSURE_OVERFLOW常量
契约注释见公共头文件。
XLLM_SESSION_PRESSURE_OVERFLOW
XLLM_COMPACT_NO常量
契约注释见公共头文件。
XLLM_COMPACT_NO
XLLM_COMPACT_YES常量
契约注释见公共头文件。
XLLM_COMPACT_YES
XLLM_RENDER_KEEP常量
契约注释见公共头文件。
XLLM_RENDER_KEEP
XLLM_RENDER_MODIFIED常量
契约注释见公共头文件。
XLLM_RENDER_MODIFIED
XLLM_RENDER_SKIP常量
契约注释见公共头文件。
XLLM_RENDER_SKIP
XLLM_SESSION_EVENT_TURN_BEGIN常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_TURN_BEGIN
XLLM_SESSION_EVENT_TURN_END常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_TURN_END
XLLM_SESSION_EVENT_ENTRY_ADDED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_ENTRY_ADDED
XLLM_SESSION_EVENT_FILL_UPDATED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_FILL_UPDATED
XLLM_SESSION_EVENT_PRESSURE_CHANGED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_PRESSURE_CHANGED
XLLM_SESSION_EVENT_COMPACT_PREPARE常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_PREPARE
XLLM_SESSION_EVENT_COMPACT_PLAN常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_PLAN
XLLM_SESSION_EVENT_COMPACT_PROMPT常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_PROMPT
XLLM_SESSION_EVENT_COMPACT_SUMMARY常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_SUMMARY
XLLM_SESSION_EVENT_COMPACT_EVALUATE常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_EVALUATE
XLLM_SESSION_EVENT_COMPACT_COMMIT常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_COMMIT
XLLM_SESSION_EVENT_COMPACT_ABORT常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_COMPACT_ABORT
XLLM_SESSION_EVENT_LADDER_TRUNCATE常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_LADDER_TRUNCATE
XLLM_SESSION_EVENT_JOURNAL_RECORD常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_JOURNAL_RECORD
XLLM_SESSION_EVENT_CHECKPOINT_SAVED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_CHECKPOINT_SAVED
XLLM_SESSION_EVENT_SESSION_RECOVERED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_SESSION_RECOVERED
XLLM_SESSION_EVENT_SESSION_FORKED常量
契约注释见公共头文件。
XLLM_SESSION_EVENT_SESSION_FORKED
xllm_session_config类型
Window and budget knobs (context window, output cap, safety reserve).
typedef struct xllm_session_config { ... } xllm_session_config;
xllm_session_pressure类型
Budget pressure state (none / prune / compact / overflow).
typedef enum xllm_session_pressure { ... } xllm_session_pressure;
xllm_session_stats类型
Budget accounting: raw vs billed tokens and compaction counters.
typedef struct xllm_session_stats { ... } xllm_session_stats;
xllm_compaction_quality类型
Section coverage of a candidate summary.
typedef struct xllm_compaction_quality { ... } xllm_compaction_quality;
xllm_session_tail类型
Tail snapshot: turn, role, and last-message presence.
typedef struct xllm_session_tail { ... } xllm_session_tail;
xllm_session_summary类型
Rolling summary object (Pi CompactionEntry with exact meta-call usage).
typedef struct xllm_session_summary { ... } xllm_session_summary;
xllm_file_ledger类型
Borrowed file lists (read and modified) for replay and audits.
typedef struct xllm_file_ledger { ... } xllm_file_ledger;
xllm_compact_decision类型
Compaction operator verdict (yes or no).
typedef enum xllm_compact_decision { ... } xllm_compact_decision;
xllm_compaction_plan类型
Compaction plan: the sequence span and split-turn prefix.
typedef struct xllm_compaction_plan { ... } xllm_compaction_plan;
xllm_compaction_ops类型
Compaction operator vtable (decide, plan, prompt, evaluate).
typedef struct xllm_compaction_ops { ... } xllm_compaction_ops;
xllm_render_action类型
Host render verdict per message (keep / modified / skip).
typedef enum xllm_render_action { ... } xllm_render_action;
xllm_session_event_type类型
Session event types (turn begin and end, entries, compaction).
typedef enum xllm_session_event_type { ... } xllm_session_event_type;
xllm_session_event类型
One session event with its sequence range.
typedef struct xllm_session_event { ... } xllm_session_event;
xllm_session_hooks类型
Host hooks: render filter and event sink.
typedef struct xllm_session_hooks { ... } xllm_session_hooks;
xllm_run_policy类型
Run guard policy (round cap, model override).
typedef struct xllm_run_policy { ... } xllm_run_policy;
xllm_run_summary类型
Run outcome: rounds, tool calls, stop reason, final text.
typedef struct xllm_run_summary { ... } xllm_run_summary;
xllmSessionNoteFileRead函数
Record a file read into the session ledger (tool visibility tracking).
XRT_API bool xllmSessionNoteFileRead(xllm_session* pSession, const char* sPath)
xllmSessionNoteFileModified函数
Record a file modification into the session ledger.
XRT_API bool xllmSessionNoteFileModified(xllm_session* pSession, const char* sPath)
xllmSessionGetFileLedger函数
Copy out the file ledger (read/modified state per path).
XRT_API bool xllmSessionGetFileLedger(const xllm_session* pSession, xllm_file_ledger* pLedger)
xllmSessionDefaultCompactionOps函数
Return the default compaction operator table (read-only borrow).
XRT_API const xllm_compaction_ops* xllmSessionDefaultCompactionOps()
xllmSessionSetCompactionOps函数
Install custom compaction operators (NULL restores the defaults).
XRT_API bool xllmSessionSetCompactionOps(xllm_session*, const xllm_compaction_ops* pOps)
xllmSessionSetHooks函数
Install session hooks (NULL removes them).
XRT_API bool xllmSessionSetHooks(xllm_session*, const xllm_session_hooks* pHooks)
xllmSessionConfigInit函数
Zero a session config with usable defaults (window, budgets, compaction).
XRT_API void xllmSessionConfigInit(xllm_session_config*)
xllmSessionComputeSafetyReserve函数
Recommended safety-reserve tokens for a context window (overflow margin).
XRT_API uint64_t xllmSessionComputeSafetyReserve(uint64_t uContextWindowTokens)
xllmSessionComputeOutputReserve函数
Recommended output-reserve tokens from window and max output.
XRT_API uint32_t xllmSessionComputeOutputReserve(uint64_t uContextWindowTokens, uint32_t uMaxOutputTokens)
xllmEstimateTextTokens函数
Rough text token estimate; no model call.
XRT_API uint64_t xllmEstimateTextTokens(const char* sText)
xllmEstimateMessageTokens函数
Rough message token estimate (same measure as xllm).
XRT_API uint64_t xllmEstimateMessageTokens(const xllm_message* pMessage)
xllmSessionCreate函数
Create a session from a config; NULL with pError on failure.
XRT_API xllm_session* xllmSessionCreate(const xllm_session_config* pConfig, xllm_error* pError)
xllmSessionFork函数
Deep-copy a session, including history and budget snapshots.
XRT_API xllm_session* xllmSessionFork(const xllm_session* pSession, xllm_error* pError)
xllmSessionDestroy函数
Destroy the session and release everything it owns.
XRT_API void xllmSessionDestroy(xllm_session* pSession)
xllmSessionGetConfig函数
Copy out the session's effective configuration.
XRT_API bool xllmSessionGetConfig(const xllm_session* pSession, xllm_session_config* pConfig)
xllmSessionBeginTurn函数
Begin a new turn and return its number.
XRT_API uint64_t xllmSessionBeginTurn(xllm_session* pSession)
xllmSessionCurrentTurn函数
Current turn number (0 before the first turn).
XRT_API uint64_t xllmSessionCurrentTurn(const xllm_session* pSession)
xllmSessionAddMessage函数
Append a full message to a turn; flags control billing and history.
XRT_API bool xllmSessionAddMessage(xllm_session* pSession, uint64_t uTurn, const xllm_message* pMessage, uint32_t uFlags)
xllmSessionAddText函数
Convenience: append a plain text message to a turn.
XRT_API bool xllmSessionAddText(xllm_session* pSession, uint64_t uTurn, xllm_role eRole, const char* sContent, uint32_t uFlags)
xllmSessionSetSystemPrompt函数
Idempotent pinned identity: appends a PINNED system entry when none exists
XRT_API bool xllmSessionSetSystemPrompt(xllm_session* pSession, const char* sText, xllm_error* pError)
xllmSessionAddAssistantResponse函数
Fold a model response (with tool calls) into the turn ledger.
XRT_API bool xllmSessionAddAssistantResponse(xllm_session* pSession, uint64_t uTurn, const xllm_response* pResponse)
xllmSessionAddReference函数
Append retrieved reference material (search results, notes, fetched docs)
XRT_API bool xllmSessionAddReference(xllm_session* pSession, uint64_t uTurn, const char* sSource, const char* sContent)
xllmSessionRecordUsage函数
Exact-feedback channel: records server usage and refreshes governance.
XRT_API bool xllmSessionRecordUsage(xllm_session* pSession, const xllm_usage* pUsage)
xllmSessionGetTail函数
Copy a tail snapshot (last message, turn, pending state).
XRT_API bool xllmSessionGetTail(const xllm_session* pSession, xllm_session_tail* pTail)
xllmSessionGetStats函数
Copy session statistics (tokens, turns, compactions).
XRT_API bool xllmSessionGetStats(const xllm_session* pSession, xllm_session_stats* pStats)
xllmSessionBuildRequest函数
Assemble a request from the session (budgets, window, tools, system prompt).
XRT_API bool xllmSessionBuildRequest(const xllm_session* pSession, xllm_request* pRequest, xllm_error* pError)
xllmSessionBuildRequestView函数
Borrowed-view variant (改造 A): plain ledger entries enter the request as
XRT_API bool xllmSessionBuildRequestView(const xllm_session* pSession, xllm_request* pRequest, xllm_error* pError)
xllmSessionGetSummary函数
Copy the session summary (turns, budget usage, compaction state).
XRT_API bool xllmSessionGetSummary(const xllm_session* pSession, xllm_session_summary* pSummary)
xllmSessionPrepareCompaction函数
A compaction object is a transaction: prepare selects a safe prefix and
XRT_API xllm_compaction* xllmSessionPrepareCompaction(xllm_session* pSession, bool bForce, xllm_error* pError)
xllmCompactionPrompt函数
The prompt that triggered this compaction (verifiable replay).
XRT_API const char* xllmCompactionPrompt(const xllm_compaction* pCompaction)
xllmCompactionThroughSequence函数
Sequence number the compaction covers through.
XRT_API uint64_t xllmCompactionThroughSequence(const xllm_compaction* pCompaction)
xllmCompactionEstimatedTokens函数
Estimated tokens of the compacted span.
XRT_API uint64_t xllmCompactionEstimatedTokens(const xllm_compaction* pCompaction)
xllmCompactionSetUsage函数
Record the meta-call usage before committing (exact summary accounting).
XRT_API bool xllmCompactionSetUsage(xllm_compaction* pCompaction, const xllm_usage* pUsage)
xllmCompactionEvaluateSummary函数
Grade a summary (length, coverage) for compaction operators.
XRT_API bool xllmCompactionEvaluateSummary(const xllm_compaction* pCompaction, const char* sSummary, xllm_compaction_quality* pQuality, xllm_error* pError)
xllmSessionCommitCompaction函数
Commit a compaction: replace the span with the summary and record it.
XRT_API bool xllmSessionCommitCompaction(xllm_session* pSession, xllm_compaction* pCompaction, const char* sSummary, xllm_error* pError)
xllmCompactionDestroy函数
Free a compaction object.
XRT_API void xllmCompactionDestroy(xllm_compaction* pCompaction)
xllmSessionMaybeCompact函数
Threshold auto-compaction consult: runs the full ops pipeline (meta call via
XRT_API bool xllmSessionMaybeCompact(xllm_session* pSession, bool* pbCompact, xllm_error* pError)
xllmSessionOverflowLadder函数
Overflow ladder: L1 full compaction via the current ops, then L2 structural
XRT_API bool xllmSessionOverflowLadder(xllm_session* pSession, xllm_error* pError)
xllmSessionSave函数
Serialize the session to a JSONL archive (atomic write).
XRT_API bool xllmSessionSave(const xllm_session* pSession, const char* sPath, xllm_error* pError)
xllmSessionLoad函数
Restore a session from a JSONL archive.
XRT_API xllm_session* xllmSessionLoad(const char* sPath, xllm_error* pError)
xllmSessionEnableJournal函数
Journaling is single-writer. Enable it only on a new/recovered session.
XRT_API bool xllmSessionEnableJournal(xllm_session* pSession, const char* sJournalPath, xllm_error* pError)
xllmSessionDisableJournal函数
Disable the automatic journal (debugging aid).
XRT_API void xllmSessionDisableJournal(xllm_session* pSession)
xllmSessionJournalPath函数
Journal path, or NULL when disabled.
XRT_API const char* xllmSessionJournalPath(const xllm_session* pSession)
xllmSessionCheckpoint函数
Write a standalone snapshot without interrupting the session.
XRT_API bool xllmSessionCheckpoint(xllm_session* pSession, const char* sSnapshotPath, xllm_error* pError)
xllmSessionRecover函数
Both paths are required and must be non-empty; a snapshot FILE that does
XRT_API xllm_session* xllmSessionRecover(const char* sSnapshotPath, const char* sJournalPath, const xllm_session_config* pConfigIfNew, xllm_error* pError)
xllmSessionCreateBound函数
Create a session bound to a real client (borrowed; must outlive the session).
XRT_API xllm_session* xllmSessionCreateBound(const xllm_session_config* pConfig, xllm_client* pClient, xllm_error* pError)
xllmSessionSend函数
Full convenience turn: begin turn, add user text (cap-checked), render,
XRT_API xllm_result xllmSessionSend(xllm_session* pSession, const char* sUserText, const xllm_stream_callbacks* pCallbacks, xllm_response** ppResponse, xllm_error* pError)
xllmSessionComplete函数
Render and call only; nothing is appended to the ledger.
XRT_API xllm_result xllmSessionComplete(xllm_session* pSession, const xllm_stream_callbacks* pCallbacks, xllm_response** ppResponse, xllm_error* pError)
xllmSessionCreateForTest函数
Create a session over an injectable call function (offline, deterministic).
XRT_API xllm_session* xllmSessionCreateForTest(const xllm_session_config* pConfig, xllm_test_call_proc pCall, void* pUserData, xllm_error* pError)
xllmSessionBindClient函数
Bind (or rebind) a client on an existing session: the durable-run path is
XRT_API bool xllmSessionBindClient(xllm_session* pSession, xllm_client* pClient)
xllmSessionSetTestCall函数
Attach, replace, or remove (NULL) the test seam on an existing session.
XRT_API bool xllmSessionSetTestCall(xllm_session* pSession, xllm_test_call_proc pCall, void* pUserData)
xllmSessionForwardDriver函数
Forward the source session's model driver (client or test seam) onto an
XRT_API bool xllmSessionForwardDriver(xllm_session* pDst, const xllm_session* pSrc)
xllmRunPolicyInit函数
Zero a run policy (sentinel defaults for unbounded loops).
XRT_API void xllmRunPolicyInit(xllm_run_policy* pPolicy)
xllmRunSummaryUnit函数
Free the contents of a run summary.
XRT_API void xllmRunSummaryUnit(xllm_run_summary* pSummary)