@nextclaw/kernel 0.19.4 → 0.19.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { a as restoreSessionJournalBackup, c as NcpAgentSessionMetadataStore, i as recoverSessionJournalTornTail, l as openSqliteDatabase, n as compactSessionJournal, r as recoverSessionJournalMaintenance, s as SessionJournalLoaderStore, t as assertSessionJournalTailComplete, u as runSqliteTransaction } from "./session-journal-maintenance.store-DrZMlaxf.js";
1
+ import { a as restoreSessionJournalBackup, c as syncSessionJournalFile, d as openSqliteDatabase, f as runSqliteTransaction, i as recoverSessionJournalTornTail, l as SessionJournalLoaderStore, n as compactSessionJournal, r as recoverSessionJournalMaintenance, s as syncSessionJournalDirectory, t as assertSessionJournalTailComplete, u as NcpAgentSessionMetadataStore } from "./session-journal-maintenance.store-CImhMMBv.js";
2
2
  import { $ as SessionEventProjectionStore, A as ContextProviderRunContextService, B as normalizeOptionalString, C as ToolProviderRunContextService, D as readProjectId, E as createAgentToolRunTriggerInput, F as CurrentSessionContextProvider, G as syncSessionThinkingPreference, H as readMetadataThinking, I as AgentBootstrapContextProvider, J as describeAgentRuntimeSessionTypes, K as appendCurrentTimeContextTail, L as renderAgentBootstrapContext, M as ExecutionPolicyContextProvider, N as renderAgentSafetyContext, O as readProjectRoot, P as renderSystemExecutionPolicy, Q as SessionMessageSqlProjectionStore, R as truncateContextText, S as AgentManager, T as attachSourceToolCall, U as resolveEffectiveModel, V as readMetadataModel, W as resolveSessionChannelContext, X as resolveAgentRuntimeEntries, Y as normalizeAgentRuntimeSessionTypeIcon, Z as SessionMessagePreparationStore, _ as createQuestionMessage, _t as CommandRegistry, a as dispatchAgentRuntimeSessionRequest, at as applyNcpAgentRunLifecycleEvent, b as SessionManager, c as Contribution, ct as assertObservationPredicate, d as dispatchPromptOverNcpResult, dt as matchesObservationPredicate, et as sessionJsonChunks, f as startPromptOverNcpExecution, ft as parseObservationDuration, g as USER_QUESTION_EXTENSION_TYPE, gt as AgentRunClient, h as UserQuestionManager, ht as DEFAULT_AGENT_RUNTIME_ENTRY_ID, i as createAgentRuntimeSessionRequestSourceNotifier, it as isSessionSettingsError, j as WorkspaceMemoryContextProvider, k as buildRunMetadata, l as NextclawHarnessError, lt as buildObservationEventModelMessage, m as UserQuestionError, mt as toBoundedJson, n as buildSessionRequestCompletionMessage, nt as SessionSettingsError, o as waitForAgentRuntimeSessionReply, ot as isNcpAgentRunLifecycleEvent, p as buildAgentRunSendPayload, pt as readJsonPointer, q as serializeModelInputTail, r as createAgentRuntimeSessionRequestDispatcher, rt as isSessionMessageCursorError, s as SessionRequestManager, st as assertObservationJsonValue, t as NextclawHarness, tt as SessionMessageCursorError, u as dispatchPromptOverNcp, ut as evaluateObservationEventAdmission, v as createQuestionResolutionMessage, w as createShowContentTools, x as createWorkspaceByteTools, y as projectUserQuestions, z as buildNextclawNcpRunContext } from "./nextclaw-harness.manager-mJToWeCB.js";
3
3
  import { A as CONTEXT_COMPACTION_RECOVERY_PREAMBLE, B as isContextWindowSnapshot, D as CONTEXT_COMPACTION_PART_START, E as CONTEXT_COMPACTION_CONTINUATION_TEXT, F as buildContextCompactionTimelineNcpMessage, G as shouldRefreshContextWindowDuringStream, H as readContextRecoveryState, I as createContextCompactionMessageId, K as shouldRefreshContextWindowImmediately, L as createContextWindowSignature, M as CONTEXT_COMPACTION_TIMELINE_KIND, N as NEXTCLAW_TIMELINE_KIND_METADATA_KEY, O as CONTEXT_COMPACTION_PROJECTION_KIND, P as buildContextCompactionModelProjection, Q as ContextCompactionJournalRecoveryService, R as isContextCompactionProjectionMessage, T as ContextCompactionPreflightService, U as readContextWindowEventSessionId, V as readContextCompactionCheckpoint, W as readLatestContextCompactionCheckpoint, Z as composeAgentToolCatalog, c as isRecord$13, d as safeNcpSessionFilename, f as toIsoString, j as CONTEXT_COMPACTION_SYSTEM_PREAMBLE, k as CONTEXT_COMPACTION_PROJECTION_METADATA_KEY, m as SessionEventReplayer, n as NCP_AGENT_SESSION_SNAPSHOT_MESSAGE_EVENT_TYPE, p as upsertNcpAgentSessionSummaryEvent, s as createNcpAgentSessionSummary, t as NCP_AGENT_SESSION_JOURNAL_INDEX_FILE, tt as STRUCTURED_RESULT_TOOL_NAME, u as normalizeNcpSessionId, z as isContextCompactionTimelineMessage } from "./ncp-agent-session-journal.utils-B7a_PKCq.js";
4
4
  import { i as isSessionJournalDelta, n as canCoalesceSessionJournalDeltas, r as coalesceSessionJournalDeltas } from "./session-journal-delta-coalescer.utils-CI-N-Zpj.js";
@@ -15883,7 +15883,7 @@ var NcpAgentSessionMessageProjectionPersistenceStore = class extends SessionMess
15883
15883
  prepare = async (sessionId, signal, onProgress) => {
15884
15884
  const { stat } = await import("node:fs/promises");
15885
15885
  const { scanBoundedSessionJournal } = await import("./session-journal-stream.utils-CupSA3YS.js");
15886
- const { recoverSessionJournalTornTail } = await import("./session-journal-maintenance.store-DrZMlaxf.js").then((n) => n.o);
15886
+ const { recoverSessionJournalTornTail } = await import("./session-journal-maintenance.store-CImhMMBv.js").then((n) => n.o);
15887
15887
  await recoverSessionJournalTornTail(this.journalPath(sessionId), signal);
15888
15888
  const journalBytes = (await stat(this.journalPath(sessionId))).size;
15889
15889
  const journalIdentity = await this.journalIdentity(sessionId);
@@ -16869,12 +16869,7 @@ var NcpAgentSessionJournalStore = class {
16869
16869
  } finally {
16870
16870
  await intent.close();
16871
16871
  }
16872
- const preparedDirectory = await open(this.journalDir, "r");
16873
- try {
16874
- await preparedDirectory.sync();
16875
- } finally {
16876
- await preparedDirectory.close();
16877
- }
16872
+ await syncSessionJournalDirectory(this.journalDir);
16878
16873
  await rename(staged, path);
16879
16874
  activated = true;
16880
16875
  const nextSeq = nextRecord.messages.length + 1;
@@ -16888,26 +16883,16 @@ var NcpAgentSessionJournalStore = class {
16888
16883
  });
16889
16884
  await this.metadataStore.write(nextRecord);
16890
16885
  await this.summaryIndexStore.upsert(createNcpAgentSessionSummary(nextRecord));
16891
- const directory = await open(this.journalDir, "r");
16892
- try {
16893
- await directory.sync();
16894
- await rm(marker);
16895
- await directory.sync();
16896
- } finally {
16897
- await directory.close();
16898
- }
16886
+ await syncSessionJournalDirectory(this.journalDir);
16887
+ await rm(marker);
16888
+ await syncSessionJournalDirectory(this.journalDir);
16899
16889
  await rm(backup, { force: true });
16900
16890
  } catch (error) {
16901
16891
  await output.close().catch(() => void 0);
16902
16892
  if (activated) {
16903
16893
  if (previousStat) {
16904
16894
  await copyFile(backup, staged);
16905
- const restored = await open(staged, "r");
16906
- try {
16907
- await restored.sync();
16908
- } finally {
16909
- await restored.close();
16910
- }
16895
+ await syncSessionJournalFile(staged);
16911
16896
  await rename(staged, path);
16912
16897
  } else await rm(path, { force: true });
16913
16898
  await this.messageProjectionStore.delete(sessionId);
@@ -16924,12 +16909,7 @@ var NcpAgentSessionJournalStore = class {
16924
16909
  }
16925
16910
  this.nextSeqBySession.delete(sessionId);
16926
16911
  await rm(marker, { force: true });
16927
- const directory = await open(this.journalDir, "r");
16928
- try {
16929
- await directory.sync();
16930
- } finally {
16931
- await directory.close();
16932
- }
16912
+ await syncSessionJournalDirectory(this.journalDir);
16933
16913
  throw error;
16934
16914
  } finally {
16935
16915
  await rm(staged, { force: true });