@nextclaw/kernel 0.19.1 → 0.19.2-beta.0
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.d.ts +87 -53
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +401 -40
- package/dist/index.js.map +1 -1
- package/dist/tools/user-question.tools.d.ts +1 -1
- package/dist/{user-question.manager-BSpxlV5l.d.ts → user-question.manager-38KBgZCg.d.ts} +2 -1
- package/dist/{user-question.manager-BSpxlV5l.d.ts.map → user-question.manager-38KBgZCg.d.ts.map} +1 -1
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -19,7 +19,7 @@ import { accessSync, appendFileSync, chmodSync, constants, createReadStream, exi
|
|
|
19
19
|
import { APP_NAME, AgentRouteResolver, BUILTIN_MAIN_AGENT_ID, CLEAR_THINKING_TOKENS, CONTEXT_COMPACTION_METADATA_KEY, ConfigSchema, ContextWindowBudgetService, CronService, CronTool, DEFAULT_PANELS_DIR, DEFAULT_PROJECT_SKILLS_DIR_NAME, DEFAULT_SERVICE_APPS_DIR, DEFAULT_SESSION_SEARCH_LIMIT, DEFAULT_WORKSPACE_REPOSITORY_IDENTITY_RESOLVER, DIAGNOSTIC_CORRELATION_METADATA_KEY, DiagnosticRuntime, EditFileTool, ExecTool, ExtensionChannelAdapter, GatewayTool, LLMProvider, ListDirTool, LiteLLMProvider, LocalExecutionClaimService, MAX_SESSION_SEARCH_LIMIT, MemoryGetTool, MemorySearchTool, MemoryStore, MessageBus, MessageTool, ProviderModelDiscoveryService, ProviderRegistry, RUNTIME_INSTANCE_DESKTOP_DATA_DIRECTORY_ENV, RUNTIME_INSTANCE_DESKTOP_DATA_DIRECTORY_ENV as RUNTIME_INSTANCE_DESKTOP_DATA_DIRECTORY_ENV$1, RUNTIME_INSTANCE_DESKTOP_LOGS_DIRECTORY_ENV, RUNTIME_INSTANCE_DESKTOP_LOGS_DIRECTORY_ENV as RUNTIME_INSTANCE_DESKTOP_LOGS_DIRECTORY_ENV$1, RUNTIME_INSTANCE_DISTRIBUTION_ENV, RUNTIME_INSTANCE_DISTRIBUTION_ENV as RUNTIME_INSTANCE_DISTRIBUTION_ENV$1, RUNTIME_INSTANCE_INSTALLATION_KIND_ENV, RUNTIME_INSTANCE_INSTALLATION_KIND_ENV as RUNTIME_INSTANCE_INSTALLATION_KIND_ENV$1, RUNTIME_INSTANCE_PORTABLE_DATA_ROOT_ENV, RUNTIME_INSTANCE_PORTABLE_DATA_ROOT_ENV as RUNTIME_INSTANCE_PORTABLE_DATA_ROOT_ENV$1, ReadFileTool, SILENT_REPLY_TOKEN, SessionProjectContextResolver, SessionSearchService, SkillsLoader, THINKING_LEVELS, ViewImageTool, WebFetchTool, WebSearchTool, WriteFileTool, buildConfigSchema, buildLocalizedTextMap, buildReloadPlan, buildSessionRequestToolResult, buildToolCatalogEntries, createAgentProfile, createAssistantStreamDeltaControlMessage, createAssistantStreamResetControlMessage, createCompletedSessionRequest, createFailedSessionRequest, createRunningSessionRequest, createRuntimeChildEnv, createTypingStopControlMessage, diffConfigPaths, ensureDir, estimateInputTokens, evaluateSilentReply, expandHome, findEffectiveAgentProfile, getConfigPath, getDataDir, getDataPath, getLogsPath, getSessionsPath, getWorkspacePath, getWorkspacePathFromConfig, isNextclawControlMessage, loadConfig, mergeExtensionConfigView, modelSupportsVision, normalizeAgentProfileId, normalizeInlineSecretRefs, normalizeModelThinkingCapability, normalizeProviderModelConfig, normalizeToolParams, parseAgentScopedSessionKey, parseSkillFrontmatter, parseSkillFrontmatter as parseSkillFrontmatter$1, parseThinkingLevel, readCompressedContextCompactionCheckpoint, readOptionalString, readParentSessionId, readSessionProjectRoot, redactConfigObject, removeAgentProfile, resolveConfigSecrets, resolveDefaultAgentProfileId, resolveEffectiveAgentProfiles, resolveNextclawSelfManageGuidePaths, resolveProviderRuntime, resolveRuntimeCommandLaunch, resolveSecretRef, resolveSessionProjectContext, resolveSessionWorkspacePath, resolveThinkingLevel, safeFilename, sanitizeOutboundAssistantContent, saveConfig, stripSkillFrontmatter, stripSkillFrontmatter as stripSkillFrontmatter$1, summarizeSessionRequestTask, toExtensionConfigView, updateAgentProfile } from "@nextclaw/core";
|
|
20
20
|
import { NCP_AI_EXECUTION_METADATA_KEY, NCP_INTERNAL_VISIBILITY_METADATA_KEY, NCP_RUN_TRIGGER_METADATA_KEY, NcpEventType, OBSERVATION_EVENT_EXTENSION_TYPE, createUnavailableNcpAiExecutionMetadata, isHiddenNcpMessage, parseNcpRunTriggerInput, readNcpAiExecutionMetadata, sanitizeAssistantReplyTags } from "@nextclaw/ncp";
|
|
21
21
|
import { DefaultNcpAgentConversationStateManager, insertMessageByTimeline, mergeToolExecutionTiming } from "@nextclaw/ncp-toolkit";
|
|
22
|
-
import { access, appendFile, chmod, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
22
|
+
import { access, appendFile, chmod, copyFile, mkdir, mkdtemp, open, readFile, readdir, realpath, rename, rm, stat, unlink, writeFile } from "node:fs/promises";
|
|
23
23
|
import { AppGrantService, AppHomeService, AppInstallationService, AppInstanceInventoryService, AppInstanceStorageService, AppManifestService, AppPlatformTargetService, AppRegistryService, AppServiceLaunchService, FileLockService, isAppComponentManifestBundle } from "@nextclaw/app-runtime";
|
|
24
24
|
import { execFileSync, spawn } from "node:child_process";
|
|
25
25
|
import { fileURLToPath } from "node:url";
|
|
@@ -27,6 +27,7 @@ import { BUILTIN_PROVIDER_PLUGINS } from "@nextclaw/runtime";
|
|
|
27
27
|
import { McpRegistryService, McpServerLifecycleManager, normalizeMcpServerName } from "@nextclaw/mcp";
|
|
28
28
|
import { McpNcpToolRegistryAdapter } from "@nextclaw/ncp-mcp";
|
|
29
29
|
import { createInterface } from "node:readline";
|
|
30
|
+
import { isDeepStrictEqual } from "node:util";
|
|
30
31
|
import { HttpRuntimeConfigResolver, HttpRuntimeNcpAgentRuntime } from "@nextclaw/nextclaw-ncp-runtime-http-client";
|
|
31
32
|
import { StdioRuntimeConfigResolver, StdioRuntimeNcpAgentRuntime, probeStdioRuntime } from "@nextclaw/nextclaw-ncp-runtime-stdio-client";
|
|
32
33
|
import { DefaultNcpAgentRuntime } from "@nextclaw/ncp-agent-runtime-next";
|
|
@@ -17735,6 +17736,24 @@ var SessionActivityPreviewEventService = class {
|
|
|
17735
17736
|
}
|
|
17736
17737
|
};
|
|
17737
17738
|
};
|
|
17739
|
+
function isSessionJournalDelta(event) {
|
|
17740
|
+
return event.type === NcpEventType.MessageTextDelta || event.type === NcpEventType.MessageReasoningDelta || event.type === NcpEventType.MessageToolCallArgsDelta;
|
|
17741
|
+
}
|
|
17742
|
+
function canCoalesceSessionJournalDeltas(left, right) {
|
|
17743
|
+
if (!isSessionJournalDelta(left) || !isSessionJournalDelta(right) || left.type !== right.type) return false;
|
|
17744
|
+
const { delta: _leftDelta, ...leftPayload } = left.payload;
|
|
17745
|
+
const { delta: _rightDelta, ...rightPayload } = right.payload;
|
|
17746
|
+
return JSON.stringify(leftPayload) === JSON.stringify(rightPayload);
|
|
17747
|
+
}
|
|
17748
|
+
function coalesceSessionJournalDeltas(left, right) {
|
|
17749
|
+
return {
|
|
17750
|
+
...left,
|
|
17751
|
+
payload: {
|
|
17752
|
+
...left.payload,
|
|
17753
|
+
delta: left.payload.delta + right.payload.delta
|
|
17754
|
+
}
|
|
17755
|
+
};
|
|
17756
|
+
}
|
|
17738
17757
|
//#endregion
|
|
17739
17758
|
//#region src/services/session-event-ingestion.service.ts
|
|
17740
17759
|
const SESSION_METADATA_PATCH_RUN_METADATA_KIND = "session_metadata_patch";
|
|
@@ -17753,6 +17772,7 @@ var SessionEventIngestionService = class {
|
|
|
17753
17772
|
activityPreview;
|
|
17754
17773
|
chains = /* @__PURE__ */ new Map();
|
|
17755
17774
|
failedWrites = /* @__PURE__ */ new Map();
|
|
17775
|
+
pendingDeltas = /* @__PURE__ */ new Map();
|
|
17756
17776
|
cleanup = null;
|
|
17757
17777
|
constructor(options) {
|
|
17758
17778
|
this.options = options;
|
|
@@ -17789,26 +17809,77 @@ var SessionEventIngestionService = class {
|
|
|
17789
17809
|
ingestEvent = async (event) => {
|
|
17790
17810
|
const sessionId = readEventSessionId(event);
|
|
17791
17811
|
if (!sessionId || !isDurableSessionEvent(event)) return;
|
|
17792
|
-
|
|
17793
|
-
|
|
17794
|
-
this.
|
|
17795
|
-
|
|
17796
|
-
|
|
17812
|
+
this.throwIfFailed(sessionId);
|
|
17813
|
+
if (isSessionJournalDelta(event)) {
|
|
17814
|
+
const pending = this.pendingDeltas.get(sessionId);
|
|
17815
|
+
if (pending && canCoalesceSessionJournalDeltas(pending.event, event)) {
|
|
17816
|
+
const merged = coalesceSessionJournalDeltas(pending.event, event);
|
|
17817
|
+
if (Buffer.byteLength(merged.payload.delta, "utf8") <= 16384) {
|
|
17818
|
+
pending.event = merged;
|
|
17819
|
+
if (Buffer.byteLength(merged.payload.delta, "utf8") < 16384) return;
|
|
17820
|
+
await this.flushPendingDelta(sessionId);
|
|
17821
|
+
return;
|
|
17822
|
+
}
|
|
17823
|
+
}
|
|
17824
|
+
this.flushPendingDelta(sessionId);
|
|
17825
|
+
if (Buffer.byteLength(event.payload.delta, "utf8") >= 16384) {
|
|
17826
|
+
await this.enqueue(sessionId, event);
|
|
17827
|
+
return;
|
|
17828
|
+
}
|
|
17829
|
+
const timer = setTimeout(() => {
|
|
17830
|
+
this.flushPendingDelta(sessionId).catch((error) => this.options.onError(sessionId, error));
|
|
17831
|
+
}, 100);
|
|
17832
|
+
timer.unref?.();
|
|
17833
|
+
this.pendingDeltas.set(sessionId, {
|
|
17834
|
+
event: structuredClone(event),
|
|
17835
|
+
timer
|
|
17836
|
+
});
|
|
17837
|
+
return;
|
|
17838
|
+
}
|
|
17839
|
+
this.flushPendingDelta(sessionId);
|
|
17840
|
+
await this.enqueue(sessionId, event);
|
|
17797
17841
|
};
|
|
17798
17842
|
flushSession = async (sessionId) => {
|
|
17843
|
+
this.flushPendingDelta(sessionId);
|
|
17799
17844
|
await this.chains.get(sessionId);
|
|
17845
|
+
this.throwIfFailed(sessionId);
|
|
17800
17846
|
};
|
|
17801
17847
|
flush = async () => {
|
|
17848
|
+
for (const sessionId of this.pendingDeltas.keys()) this.flushPendingDelta(sessionId);
|
|
17802
17849
|
await Promise.all([...this.chains.values()]);
|
|
17803
17850
|
if (this.failedWrites.size > 0) throw new Error("Cannot prepare a restart after a session journal write failed.");
|
|
17804
17851
|
};
|
|
17805
17852
|
dispose = () => {
|
|
17806
17853
|
this.cleanup?.();
|
|
17807
17854
|
this.cleanup = null;
|
|
17855
|
+
for (const pending of this.pendingDeltas.values()) clearTimeout(pending.timer);
|
|
17856
|
+
this.pendingDeltas.clear();
|
|
17808
17857
|
this.chains.clear();
|
|
17809
17858
|
this.failedWrites.clear();
|
|
17810
17859
|
this.activityPreview.clear();
|
|
17811
17860
|
};
|
|
17861
|
+
flushPendingDelta = (sessionId) => {
|
|
17862
|
+
const pending = this.pendingDeltas.get(sessionId);
|
|
17863
|
+
if (!pending) return Promise.resolve();
|
|
17864
|
+
clearTimeout(pending.timer);
|
|
17865
|
+
this.pendingDeltas.delete(sessionId);
|
|
17866
|
+
const next = this.enqueue(sessionId, pending.event);
|
|
17867
|
+
next.catch((error) => this.options.onError(sessionId, error));
|
|
17868
|
+
return next;
|
|
17869
|
+
};
|
|
17870
|
+
enqueue = (sessionId, event) => {
|
|
17871
|
+
const next = (this.chains.get(sessionId) ?? Promise.resolve()).then(() => {
|
|
17872
|
+
this.throwIfFailed(sessionId);
|
|
17873
|
+
return this.handleDurableEvent(sessionId, event);
|
|
17874
|
+
});
|
|
17875
|
+
this.chains.set(sessionId, next.catch((error) => {
|
|
17876
|
+
this.failedWrites.set(sessionId, error);
|
|
17877
|
+
}));
|
|
17878
|
+
return next;
|
|
17879
|
+
};
|
|
17880
|
+
throwIfFailed = (sessionId) => {
|
|
17881
|
+
if (this.failedWrites.has(sessionId)) throw new Error(`Session journal write failed for ${sessionId}; refusing further writes until recovery.`, { cause: this.failedWrites.get(sessionId) });
|
|
17882
|
+
};
|
|
17812
17883
|
handleDurableEvent = async (sessionId, event) => {
|
|
17813
17884
|
const preview = this.activityPreview.projectEvent(event, (/* @__PURE__ */ new Date()).toISOString());
|
|
17814
17885
|
const metadataPatch = readRuntimeSessionMetadataPatch(event);
|
|
@@ -17999,6 +18070,10 @@ var SessionManager = class {
|
|
|
17999
18070
|
this.titles?.dispose();
|
|
18000
18071
|
this.sessionEvents.dispose();
|
|
18001
18072
|
};
|
|
18073
|
+
close = async () => {
|
|
18074
|
+
await this.sessionEvents.flush();
|
|
18075
|
+
this.dispose();
|
|
18076
|
+
};
|
|
18002
18077
|
publishSessionEvent = async (params) => await this.sessionEvents.publish(params);
|
|
18003
18078
|
flushSessionEvents = async () => await this.sessionEvents.flush();
|
|
18004
18079
|
createSession = async (params) => {
|
|
@@ -21849,6 +21924,37 @@ function parseUnfinishedRun(value) {
|
|
|
21849
21924
|
}
|
|
21850
21925
|
}
|
|
21851
21926
|
//#endregion
|
|
21927
|
+
//#region src/utils/ncp-agent-session-catalog-row.utils.ts
|
|
21928
|
+
function summaryToRow(summary, deletedAt = null) {
|
|
21929
|
+
const updatedAt = summary.updatedAt || summary.createdAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
21930
|
+
return {
|
|
21931
|
+
session_id: summary.sessionId,
|
|
21932
|
+
peer_id: summary.peerId ?? null,
|
|
21933
|
+
agent_id: summary.agentId ?? null,
|
|
21934
|
+
created_at: summary.createdAt ?? updatedAt,
|
|
21935
|
+
updated_at: updatedAt,
|
|
21936
|
+
last_message_at: summary.lastMessageAt ?? null,
|
|
21937
|
+
message_count: Math.max(0, summary.messageCount ?? 0),
|
|
21938
|
+
status: summary.status || "idle",
|
|
21939
|
+
metadata_json: JSON.stringify(summary.metadata ?? {}),
|
|
21940
|
+
deleted_at: deletedAt
|
|
21941
|
+
};
|
|
21942
|
+
}
|
|
21943
|
+
function rowToSummary(row) {
|
|
21944
|
+
const metadata = JSON.parse(row.metadata_json);
|
|
21945
|
+
return {
|
|
21946
|
+
sessionId: row.session_id,
|
|
21947
|
+
...row.peer_id ? { peerId: row.peer_id } : {},
|
|
21948
|
+
...row.agent_id ? { agentId: row.agent_id } : {},
|
|
21949
|
+
messageCount: row.message_count,
|
|
21950
|
+
...row.created_at ? { createdAt: row.created_at } : {},
|
|
21951
|
+
updatedAt: row.updated_at,
|
|
21952
|
+
...row.last_message_at ? { lastMessageAt: row.last_message_at } : {},
|
|
21953
|
+
status: row.status,
|
|
21954
|
+
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
21955
|
+
};
|
|
21956
|
+
}
|
|
21957
|
+
//#endregion
|
|
21852
21958
|
//#region src/stores/ncp-agent-session-summary-index.store.ts
|
|
21853
21959
|
const SQLITE_DATABASE_FILE = ".ncp-agent-session-catalog.sqlite";
|
|
21854
21960
|
const CATALOG_SCHEMA_VERSION = 2;
|
|
@@ -21879,36 +21985,8 @@ function buildCatalogFilter(query) {
|
|
|
21879
21985
|
function readEventMessage(event) {
|
|
21880
21986
|
if (event.type === NcpEventType.MessageSent || event.type === NcpEventType.MessageCompleted || event.type === "session.snapshot.message") return event.payload.message;
|
|
21881
21987
|
}
|
|
21882
|
-
function summaryToRow(summary, deletedAt = null) {
|
|
21883
|
-
const updatedAt = summary.updatedAt || summary.createdAt || (/* @__PURE__ */ new Date()).toISOString();
|
|
21884
|
-
return {
|
|
21885
|
-
session_id: summary.sessionId,
|
|
21886
|
-
peer_id: summary.peerId ?? null,
|
|
21887
|
-
agent_id: summary.agentId ?? null,
|
|
21888
|
-
created_at: summary.createdAt ?? updatedAt,
|
|
21889
|
-
updated_at: updatedAt,
|
|
21890
|
-
last_message_at: summary.lastMessageAt ?? null,
|
|
21891
|
-
message_count: Math.max(0, summary.messageCount ?? 0),
|
|
21892
|
-
status: summary.status || "idle",
|
|
21893
|
-
metadata_json: JSON.stringify(summary.metadata ?? {}),
|
|
21894
|
-
deleted_at: deletedAt
|
|
21895
|
-
};
|
|
21896
|
-
}
|
|
21897
|
-
function rowToSummary(row) {
|
|
21898
|
-
const metadata = JSON.parse(row.metadata_json);
|
|
21899
|
-
return {
|
|
21900
|
-
sessionId: row.session_id,
|
|
21901
|
-
...row.peer_id ? { peerId: row.peer_id } : {},
|
|
21902
|
-
...row.agent_id ? { agentId: row.agent_id } : {},
|
|
21903
|
-
messageCount: row.message_count,
|
|
21904
|
-
...row.created_at ? { createdAt: row.created_at } : {},
|
|
21905
|
-
updatedAt: row.updated_at,
|
|
21906
|
-
...row.last_message_at ? { lastMessageAt: row.last_message_at } : {},
|
|
21907
|
-
status: row.status,
|
|
21908
|
-
...Object.keys(metadata).length > 0 ? { metadata } : {}
|
|
21909
|
-
};
|
|
21910
|
-
}
|
|
21911
21988
|
var NcpAgentSessionSummaryIndexStore = class {
|
|
21989
|
+
lastSummaryWriteAt = /* @__PURE__ */ new Map();
|
|
21912
21990
|
database = null;
|
|
21913
21991
|
readyPromise = null;
|
|
21914
21992
|
runRecovery = new NcpAgentRunRecoveryIndexStore(() => this.db(), () => this.ensureReady());
|
|
@@ -21952,9 +22030,11 @@ var NcpAgentSessionSummaryIndexStore = class {
|
|
|
21952
22030
|
this.writeSummary(summaryToRow(summary), true);
|
|
21953
22031
|
};
|
|
21954
22032
|
upsertForEvent = async (params) => {
|
|
22033
|
+
const sessionId = normalizeNcpSessionId(params.sessionId);
|
|
22034
|
+
const now = Date.now();
|
|
22035
|
+
if (isSessionJournalDelta(params.event) && now - (this.lastSummaryWriteAt.get(sessionId) ?? 0) < 1e3) return;
|
|
21955
22036
|
await this.ensureReady();
|
|
21956
|
-
const {
|
|
21957
|
-
const sessionId = normalizeNcpSessionId(rawSessionId);
|
|
22037
|
+
const { event, updatedAt } = params;
|
|
21958
22038
|
const currentRow = this.db().prepare("SELECT * FROM sessions WHERE session_id = ? LIMIT 1").get(sessionId);
|
|
21959
22039
|
const { deleted_at: _deletedAt, ...upsertParams } = summaryToRow({
|
|
21960
22040
|
...upsertNcpAgentSessionSummaryEvent({
|
|
@@ -21986,6 +22066,7 @@ var NcpAgentSessionSummaryIndexStore = class {
|
|
|
21986
22066
|
message_count = sessions.message_count + excluded.message_count,
|
|
21987
22067
|
status = excluded.status
|
|
21988
22068
|
WHERE sessions.deleted_at IS NULL`).run(upsertParams);
|
|
22069
|
+
this.lastSummaryWriteAt.set(sessionId, now);
|
|
21989
22070
|
};
|
|
21990
22071
|
listRunRecoveryCheckpoints = this.runRecovery.list;
|
|
21991
22072
|
writeRunRecoveryCheckpoint = this.runRecovery.write;
|
|
@@ -21993,6 +22074,7 @@ var NcpAgentSessionSummaryIndexStore = class {
|
|
|
21993
22074
|
remove = async (sessionId) => {
|
|
21994
22075
|
await this.ensureReady();
|
|
21995
22076
|
const normalizedSessionId = normalizeNcpSessionId(sessionId);
|
|
22077
|
+
this.lastSummaryWriteAt.delete(normalizedSessionId);
|
|
21996
22078
|
const deletedAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
21997
22079
|
runSqliteTransaction(this.db(), () => {
|
|
21998
22080
|
if (this.db().prepare("SELECT session_id FROM sessions WHERE session_id = ? LIMIT 1").get(normalizedSessionId)) {
|
|
@@ -22006,6 +22088,7 @@ var NcpAgentSessionSummaryIndexStore = class {
|
|
|
22006
22088
|
}, "IMMEDIATE");
|
|
22007
22089
|
};
|
|
22008
22090
|
close = () => {
|
|
22091
|
+
this.lastSummaryWriteAt.clear();
|
|
22009
22092
|
this.database?.close();
|
|
22010
22093
|
this.database = null;
|
|
22011
22094
|
this.readyPromise = null;
|
|
@@ -22170,6 +22253,279 @@ var NcpAgentSessionSummaryReadStore = class {
|
|
|
22170
22253
|
};
|
|
22171
22254
|
};
|
|
22172
22255
|
//#endregion
|
|
22256
|
+
//#region src/stores/session-journal-maintenance.store.ts
|
|
22257
|
+
const CATALOG_FILE = ".ncp-agent-session-catalog.sqlite";
|
|
22258
|
+
function paths(journalDir, sessionId) {
|
|
22259
|
+
const basename = safeNcpSessionFilename(sessionId.replace(/:/g, "_"));
|
|
22260
|
+
const source = join(journalDir, `${basename}.jsonl`);
|
|
22261
|
+
return {
|
|
22262
|
+
source,
|
|
22263
|
+
backup: `${source}.backup`,
|
|
22264
|
+
pending: `${source}.pending`,
|
|
22265
|
+
marker: `${source}.maintenance`,
|
|
22266
|
+
markerDraft: `${source}.maintenance.tmp`,
|
|
22267
|
+
projection: join(journalDir, ".message-projections", basename)
|
|
22268
|
+
};
|
|
22269
|
+
}
|
|
22270
|
+
async function syncDirectory(path) {
|
|
22271
|
+
const handle = await open(path, "r");
|
|
22272
|
+
try {
|
|
22273
|
+
await handle.sync();
|
|
22274
|
+
} finally {
|
|
22275
|
+
await handle.close();
|
|
22276
|
+
}
|
|
22277
|
+
}
|
|
22278
|
+
async function syncFile(path) {
|
|
22279
|
+
const handle = await open(path, "r");
|
|
22280
|
+
try {
|
|
22281
|
+
await handle.sync();
|
|
22282
|
+
} finally {
|
|
22283
|
+
await handle.close();
|
|
22284
|
+
}
|
|
22285
|
+
}
|
|
22286
|
+
async function hashFile(path) {
|
|
22287
|
+
const hash = createHash("sha256");
|
|
22288
|
+
for await (const chunk of createReadStream(path)) hash.update(chunk);
|
|
22289
|
+
return hash.digest("hex");
|
|
22290
|
+
}
|
|
22291
|
+
async function assertSourceUnchanged(source, expected) {
|
|
22292
|
+
const current = await stat(source);
|
|
22293
|
+
if (current.size !== expected.size || current.mtimeMs !== expected.mtimeMs || current.ino !== expected.ino) throw new Error("Journal changed during compaction; refusing activation.");
|
|
22294
|
+
}
|
|
22295
|
+
/** Refuse to append after a partial write: another JSONL entry would hide the torn tail. */
|
|
22296
|
+
async function assertSessionJournalTailComplete(source) {
|
|
22297
|
+
let handle;
|
|
22298
|
+
try {
|
|
22299
|
+
handle = await open(source, "r");
|
|
22300
|
+
} catch (error) {
|
|
22301
|
+
if (error.code === "ENOENT") return;
|
|
22302
|
+
throw error;
|
|
22303
|
+
}
|
|
22304
|
+
try {
|
|
22305
|
+
const size = (await handle.stat()).size;
|
|
22306
|
+
if (size === 0) return;
|
|
22307
|
+
const suffix = Buffer.alloc(1);
|
|
22308
|
+
await handle.read(suffix, 0, 1, size - 1);
|
|
22309
|
+
if (suffix[0] !== 10) throw new Error("Journal has an incomplete tail line; refusing further writes.");
|
|
22310
|
+
} finally {
|
|
22311
|
+
await handle.close();
|
|
22312
|
+
}
|
|
22313
|
+
}
|
|
22314
|
+
async function invalidateDerivedState(journalDir, sessionId, projection) {
|
|
22315
|
+
await rm(projection, {
|
|
22316
|
+
recursive: true,
|
|
22317
|
+
force: true
|
|
22318
|
+
});
|
|
22319
|
+
const catalogPath = join(journalDir, CATALOG_FILE);
|
|
22320
|
+
try {
|
|
22321
|
+
await stat(catalogPath);
|
|
22322
|
+
} catch (error) {
|
|
22323
|
+
if (error.code === "ENOENT") return;
|
|
22324
|
+
throw error;
|
|
22325
|
+
}
|
|
22326
|
+
const database = await openSqliteDatabase(catalogPath);
|
|
22327
|
+
try {
|
|
22328
|
+
database.exec("PRAGMA busy_timeout = 10000; PRAGMA synchronous = FULL; PRAGMA foreign_keys = ON;");
|
|
22329
|
+
runSqliteTransaction(database, () => {
|
|
22330
|
+
database.prepare("DELETE FROM run_recovery WHERE session_id = ?").run(sessionId);
|
|
22331
|
+
database.prepare("DELETE FROM sessions WHERE session_id = ? AND deleted_at IS NULL").run(sessionId);
|
|
22332
|
+
}, "IMMEDIATE");
|
|
22333
|
+
} finally {
|
|
22334
|
+
database.close();
|
|
22335
|
+
}
|
|
22336
|
+
await syncDirectory(journalDir);
|
|
22337
|
+
}
|
|
22338
|
+
/** Runs before the catalog opens. An interrupted switch always rolls back to the untouched backup. */
|
|
22339
|
+
async function recoverSessionJournalMaintenance(journalDir) {
|
|
22340
|
+
let names;
|
|
22341
|
+
try {
|
|
22342
|
+
names = await readdir(journalDir);
|
|
22343
|
+
} catch (error) {
|
|
22344
|
+
if (error.code === "ENOENT") return;
|
|
22345
|
+
throw error;
|
|
22346
|
+
}
|
|
22347
|
+
for (const name of names.filter((item) => item.endsWith(".jsonl.maintenance"))) {
|
|
22348
|
+
const sessionId = normalizeNcpSessionId(JSON.parse(await readFile(join(journalDir, name), "utf8")).sessionId ?? "");
|
|
22349
|
+
if (!sessionId || `${safeNcpSessionFilename(sessionId.replace(/:/g, "_"))}.jsonl.maintenance` !== name) throw new Error(`Invalid journal maintenance marker: ${name}`);
|
|
22350
|
+
const source = join(journalDir, name.slice(0, -12));
|
|
22351
|
+
const backup = `${source}.backup`;
|
|
22352
|
+
const restore = `${source}.restore`;
|
|
22353
|
+
await copyFile(backup, restore);
|
|
22354
|
+
await syncFile(restore);
|
|
22355
|
+
await rename(restore, source);
|
|
22356
|
+
await invalidateDerivedState(journalDir, sessionId, join(journalDir, ".message-projections", name.slice(0, -18)));
|
|
22357
|
+
await rm(`${source}.pending`, { force: true });
|
|
22358
|
+
await rm(join(journalDir, name));
|
|
22359
|
+
await syncDirectory(journalDir);
|
|
22360
|
+
}
|
|
22361
|
+
}
|
|
22362
|
+
async function validateColdReplay(journalDir, sessionId, source, candidate) {
|
|
22363
|
+
const loader = new SessionJournalLoaderStore(new NcpAgentSessionMetadataStore(journalDir), { readAllSnapshot: async () => null });
|
|
22364
|
+
const original = await loader.load(sessionId, source);
|
|
22365
|
+
const compacted = await loader.load(sessionId, candidate);
|
|
22366
|
+
if (!original || !compacted || !isDeepStrictEqual(original.record.messages, compacted.record.messages)) throw new Error("Session journal compaction changed cold-replayed messages.");
|
|
22367
|
+
}
|
|
22368
|
+
async function writeCoalescedJournal(source, pending) {
|
|
22369
|
+
const output = await open(pending, "wx");
|
|
22370
|
+
let inputLines = 0;
|
|
22371
|
+
let outputLines = 0;
|
|
22372
|
+
let nextSeq = 1;
|
|
22373
|
+
let pendingEntry = null;
|
|
22374
|
+
const flush = async () => {
|
|
22375
|
+
if (!pendingEntry) return;
|
|
22376
|
+
if (pendingEntry._type === "event") pendingEntry.seq = nextSeq++;
|
|
22377
|
+
await output.writeFile(`${JSON.stringify(pendingEntry)}\n`);
|
|
22378
|
+
outputLines++;
|
|
22379
|
+
pendingEntry = null;
|
|
22380
|
+
};
|
|
22381
|
+
try {
|
|
22382
|
+
const lines = createInterface({
|
|
22383
|
+
input: createReadStream(source),
|
|
22384
|
+
crlfDelay: Infinity
|
|
22385
|
+
});
|
|
22386
|
+
for await (const line of lines) {
|
|
22387
|
+
if (!line) throw new Error("Journal contains a blank line; compaction requires a valid complete source.");
|
|
22388
|
+
inputLines++;
|
|
22389
|
+
const entry = JSON.parse(line);
|
|
22390
|
+
if (!entry || typeof entry !== "object" || !["event", "metadata"].includes(entry._type)) throw new Error(`Invalid journal entry at line ${inputLines}.`);
|
|
22391
|
+
if (entry.version !== void 0 && entry.version !== 1) throw new Error(`Unsupported journal entry version at line ${inputLines}.`);
|
|
22392
|
+
if (entry._type === "event") {
|
|
22393
|
+
if (!Number.isSafeInteger(entry.seq) || entry.seq < 1 || !entry.event?.type || !("payload" in entry.event)) throw new Error(`Invalid journal sequence or event at line ${inputLines}.`);
|
|
22394
|
+
}
|
|
22395
|
+
if (pendingEntry?._type === "event" && entry._type === "event" && pendingEntry.event && entry.event && canCoalesceSessionJournalDeltas(pendingEntry.event, entry.event) && isSessionJournalDelta(pendingEntry.event) && isSessionJournalDelta(entry.event)) {
|
|
22396
|
+
const merged = coalesceSessionJournalDeltas(pendingEntry.event, entry.event);
|
|
22397
|
+
if (Buffer.byteLength(merged.payload.delta, "utf8") <= 16384) {
|
|
22398
|
+
pendingEntry.event = merged;
|
|
22399
|
+
continue;
|
|
22400
|
+
}
|
|
22401
|
+
}
|
|
22402
|
+
await flush();
|
|
22403
|
+
pendingEntry = entry;
|
|
22404
|
+
}
|
|
22405
|
+
await flush();
|
|
22406
|
+
await output.sync();
|
|
22407
|
+
} finally {
|
|
22408
|
+
await output.close();
|
|
22409
|
+
}
|
|
22410
|
+
return {
|
|
22411
|
+
inputLines,
|
|
22412
|
+
outputLines
|
|
22413
|
+
};
|
|
22414
|
+
}
|
|
22415
|
+
async function writeMaintenanceMarker(journalDir, target, sessionId) {
|
|
22416
|
+
const marker = await open(target.markerDraft, "wx");
|
|
22417
|
+
try {
|
|
22418
|
+
await marker.writeFile(`${JSON.stringify({ sessionId })}\n`);
|
|
22419
|
+
await marker.sync();
|
|
22420
|
+
} finally {
|
|
22421
|
+
await marker.close();
|
|
22422
|
+
}
|
|
22423
|
+
await rename(target.markerDraft, target.marker);
|
|
22424
|
+
await syncDirectory(journalDir);
|
|
22425
|
+
}
|
|
22426
|
+
async function activateCompactedJournal(journalDir, sessionId, target, sourceStat) {
|
|
22427
|
+
let renamed = false;
|
|
22428
|
+
try {
|
|
22429
|
+
await copyFile(target.source, target.backup, constants.COPYFILE_EXCL);
|
|
22430
|
+
await syncFile(target.backup);
|
|
22431
|
+
await assertSourceUnchanged(target.source, sourceStat);
|
|
22432
|
+
await writeMaintenanceMarker(journalDir, target, sessionId);
|
|
22433
|
+
await assertSourceUnchanged(target.source, sourceStat);
|
|
22434
|
+
await rename(target.pending, target.source);
|
|
22435
|
+
renamed = true;
|
|
22436
|
+
await syncDirectory(journalDir);
|
|
22437
|
+
await invalidateDerivedState(journalDir, sessionId, target.projection);
|
|
22438
|
+
await rm(target.marker);
|
|
22439
|
+
await syncDirectory(journalDir);
|
|
22440
|
+
} catch (error) {
|
|
22441
|
+
if (renamed) await recoverSessionJournalMaintenance(journalDir);
|
|
22442
|
+
else {
|
|
22443
|
+
await rm(target.markerDraft, { force: true });
|
|
22444
|
+
await rm(target.marker, { force: true });
|
|
22445
|
+
await rm(target.backup, { force: true });
|
|
22446
|
+
}
|
|
22447
|
+
throw error;
|
|
22448
|
+
}
|
|
22449
|
+
}
|
|
22450
|
+
/** Restores the original v1 journal after a successful offline compaction. All writers must be stopped. */
|
|
22451
|
+
async function restoreSessionJournalBackup(input) {
|
|
22452
|
+
const sessionId = normalizeNcpSessionId(input.sessionId);
|
|
22453
|
+
if (!sessionId || input.writersStopped !== true) throw new Error("Stop all writers and explicitly acknowledge it before restoring a journal backup.");
|
|
22454
|
+
const target = paths(input.journalDir, sessionId);
|
|
22455
|
+
await stat(target.backup);
|
|
22456
|
+
for (const candidate of [
|
|
22457
|
+
target.pending,
|
|
22458
|
+
target.marker,
|
|
22459
|
+
target.markerDraft
|
|
22460
|
+
]) try {
|
|
22461
|
+
await stat(candidate);
|
|
22462
|
+
throw new Error(`Unresolved journal maintenance file: ${candidate}`);
|
|
22463
|
+
} catch (error) {
|
|
22464
|
+
if (error.code !== "ENOENT") throw error;
|
|
22465
|
+
}
|
|
22466
|
+
const sourceStat = await stat(target.source);
|
|
22467
|
+
let recoveryStarted = false;
|
|
22468
|
+
try {
|
|
22469
|
+
await writeCoalescedJournal(target.backup, target.pending);
|
|
22470
|
+
const expected = await stat(target.pending);
|
|
22471
|
+
if (sourceStat.size !== expected.size || await hashFile(target.source) !== await hashFile(target.pending)) throw new Error("Journal changed since compaction; refusing restore to protect later events.");
|
|
22472
|
+
await assertSourceUnchanged(target.source, sourceStat);
|
|
22473
|
+
await writeMaintenanceMarker(input.journalDir, target, sessionId);
|
|
22474
|
+
await assertSourceUnchanged(target.source, sourceStat);
|
|
22475
|
+
recoveryStarted = true;
|
|
22476
|
+
await recoverSessionJournalMaintenance(input.journalDir);
|
|
22477
|
+
} catch (error) {
|
|
22478
|
+
await rm(target.markerDraft, { force: true });
|
|
22479
|
+
if (!recoveryStarted) await rm(target.marker, { force: true });
|
|
22480
|
+
throw error;
|
|
22481
|
+
} finally {
|
|
22482
|
+
await rm(target.pending, { force: true });
|
|
22483
|
+
}
|
|
22484
|
+
return {
|
|
22485
|
+
sessionId,
|
|
22486
|
+
restored: true
|
|
22487
|
+
};
|
|
22488
|
+
}
|
|
22489
|
+
/** Explicit offline operation. The caller must stop every writer for this HOME before apply. */
|
|
22490
|
+
async function compactSessionJournal(input) {
|
|
22491
|
+
const sessionId = normalizeNcpSessionId(input.sessionId);
|
|
22492
|
+
if (!sessionId) throw new Error("A session ID is required.");
|
|
22493
|
+
if (input.apply && input.writersStopped !== true) throw new Error("Stop all writers and explicitly acknowledge it before applying compaction.");
|
|
22494
|
+
const target = paths(input.journalDir, sessionId);
|
|
22495
|
+
for (const candidate of [
|
|
22496
|
+
target.backup,
|
|
22497
|
+
target.pending,
|
|
22498
|
+
target.marker,
|
|
22499
|
+
target.markerDraft
|
|
22500
|
+
]) try {
|
|
22501
|
+
await stat(candidate);
|
|
22502
|
+
throw new Error(`Unresolved journal maintenance file: ${candidate}`);
|
|
22503
|
+
} catch (error) {
|
|
22504
|
+
if (error.code !== "ENOENT") throw error;
|
|
22505
|
+
}
|
|
22506
|
+
const before = await stat(target.source);
|
|
22507
|
+
await assertSessionJournalTailComplete(target.source);
|
|
22508
|
+
try {
|
|
22509
|
+
const { inputLines, outputLines } = await writeCoalescedJournal(target.source, target.pending);
|
|
22510
|
+
await validateColdReplay(input.journalDir, sessionId, target.source, target.pending);
|
|
22511
|
+
await assertSourceUnchanged(target.source, before);
|
|
22512
|
+
const outputBytes = (await stat(target.pending)).size;
|
|
22513
|
+
const result = {
|
|
22514
|
+
sessionId,
|
|
22515
|
+
applied: input.apply,
|
|
22516
|
+
inputBytes: before.size,
|
|
22517
|
+
outputBytes,
|
|
22518
|
+
inputLines,
|
|
22519
|
+
outputLines
|
|
22520
|
+
};
|
|
22521
|
+
if (!input.apply) return result;
|
|
22522
|
+
await activateCompactedJournal(input.journalDir, sessionId, target, before);
|
|
22523
|
+
return result;
|
|
22524
|
+
} finally {
|
|
22525
|
+
await rm(target.pending, { force: true });
|
|
22526
|
+
}
|
|
22527
|
+
}
|
|
22528
|
+
//#endregion
|
|
22173
22529
|
//#region src/stores/ncp-agent-session-journal.store.ts
|
|
22174
22530
|
var NcpAgentSessionJournalStore = class {
|
|
22175
22531
|
sessions = /* @__PURE__ */ new Map();
|
|
@@ -22212,7 +22568,10 @@ var NcpAgentSessionJournalStore = class {
|
|
|
22212
22568
|
});
|
|
22213
22569
|
this.unfinishedRunStore = new NcpAgentUnfinishedRunStore(journalDir, this.summaryIndexStore.listRunRecoveryCheckpoints, this.summaryIndexStore.writeRunRecoveryCheckpoint);
|
|
22214
22570
|
}
|
|
22215
|
-
initialize = async () =>
|
|
22571
|
+
initialize = async () => {
|
|
22572
|
+
await recoverSessionJournalMaintenance(this.journalDir);
|
|
22573
|
+
await this.summaryIndexStore.initialize();
|
|
22574
|
+
};
|
|
22216
22575
|
close = () => this.summaryIndexStore.close();
|
|
22217
22576
|
appendSessionEvent = async (params) => {
|
|
22218
22577
|
const sessionId = normalizeNcpSessionId(params.sessionId);
|
|
@@ -22453,6 +22812,7 @@ var NcpAgentSessionJournalStore = class {
|
|
|
22453
22812
|
return loaded;
|
|
22454
22813
|
};
|
|
22455
22814
|
appendJournalEntry = async (path, entry) => {
|
|
22815
|
+
await assertSessionJournalTailComplete(path);
|
|
22456
22816
|
await appendFile(path, `${serializeNcpAgentSessionJournalEntry(entry)}\n`, "utf-8");
|
|
22457
22817
|
};
|
|
22458
22818
|
ensureJournalDir = async () => {
|
|
@@ -28429,7 +28789,7 @@ var NextclawKernel = class {
|
|
|
28429
28789
|
this.contextProviderManager.dispose();
|
|
28430
28790
|
await this.agentRuntimeManager.dispose();
|
|
28431
28791
|
this.sessionRunManager.dispose();
|
|
28432
|
-
this.sessionManager.
|
|
28792
|
+
await this.sessionManager.close();
|
|
28433
28793
|
await this.mcpManager.dispose();
|
|
28434
28794
|
await this.serviceAppManager.dispose();
|
|
28435
28795
|
await this.sessionSearch.dispose();
|
|
@@ -29264,6 +29624,7 @@ var NextclawHarness = class {
|
|
|
29264
29624
|
onEvent: input.onEvent
|
|
29265
29625
|
})).result();
|
|
29266
29626
|
};
|
|
29627
|
+
listSessionMessages = async (sessionId) => await this.requireKernel().sessionManager.listSessionMessages(sessionId);
|
|
29267
29628
|
listUserQuestions = async (sessionId) => await this.requireKernel().userQuestions.list(sessionId);
|
|
29268
29629
|
answerUserQuestion = async (input) => {
|
|
29269
29630
|
const kernel = this.requireKernel();
|
|
@@ -29604,6 +29965,6 @@ function resolveLegacyEventType(message) {
|
|
|
29604
29965
|
return `message.${role || "other"}`;
|
|
29605
29966
|
}
|
|
29606
29967
|
//#endregion
|
|
29607
|
-
export { AUTOMATIC_UPDATE_CHECK_INTERVAL_MS, AccessManager, AgentManager, AgentRunClient, AppDataError, AppDataManager, AppPackageError, AppPackageManager, AutomationManager, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_CONTINUATION_TEXT, CONTEXT_COMPACTION_PART_START, CONTEXT_COMPACTION_PROJECTION_KIND, CONTEXT_COMPACTION_PROJECTION_METADATA_KEY, CONTEXT_COMPACTION_SYSTEM_PREAMBLE, CONTEXT_COMPACTION_TIMELINE_KIND, CapabilityGrantLegacyMigrationService, CapabilityGrantManager, CapabilityGrantStore, ChannelManager, CommandRegistry, ConfigManager, ContextCompactionJournalRecoveryService, ContextCompactionPreflightService, Contribution, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_SERVICE_ACTION_RISK, DESKTOP_HOST_ACCESS, DESKTOP_HOST_PROTOCOL_VERSION, DesktopHostCapabilityManager, DesktopNodeReplService, DesktopSessionStateService, EventBus, ExtensionManager, FeatureControlsService, GatewayInboundProcessor, InboxDeliveryError, InboxDeliveryManager, Ingress, LlmProviderManager, LlmUsageManager, LlmUsageStore, MAX_INBOX_DELIVERY_CONTENT_LENGTH, McpManager, McpServiceAppRuntimeService, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NcpAgentSessionJournalStore, NextclawHarness, NextclawHarnessError, NextclawKernel, ObservationManager, PANEL_APP_AGENT_CAPABILITIES, PORTABLE_RUNTIME_ACCEPTANCE_CONTRACT, PORTABLE_RUNTIME_ACCEPTANCE_CONTRACT_FINGERPRINT, PORTABLE_RUNTIME_ACCEPTANCE_LOCALES, PORTABLE_RUNTIME_ACCEPTANCE_PLATFORMS, PORTABLE_RUNTIME_ACCEPTANCE_PRESENTATION, PORTABLE_RUNTIME_ACCEPTANCE_REFERENCE_APP_ID, PROJECT_TEMPLATE_IDS, PROJECT_WORK_ATTENTION_VALUES, PROJECT_WORK_STATE_CATEGORIES, PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS, PanelAppAssetTokenService, PanelAppError, PanelAppManager, PlannedRestartRecoveryManager, PortableRuntimeAcceptanceIdentityService, PortableRuntimeAcceptanceManager, PreferenceError, PreferenceManager, ProjectError, ProjectManager, ProjectMaterialService, ProjectWorkError, ProjectWorkManager, ProviderManagerNcpLLMApi, ProviderModelCatalogManager, RUNTIME_INSTANCE_DESKTOP_DATA_DIRECTORY_ENV, RUNTIME_INSTANCE_DESKTOP_LOGS_DIRECTORY_ENV, RUNTIME_INSTANCE_DISTRIBUTION_ENV, RUNTIME_INSTANCE_INSTALLATION_KIND_ENV, RUNTIME_INSTANCE_PORTABLE_DATA_ROOT_ENV, SERVICE_APP_MANIFEST_FILE_NAME, ServiceAppAiCapabilityService, ServiceAppError, ServiceAppJobJournalService, ServiceAppManager, ServiceAppResidentEventInboxService, ServiceAppRuntimeService, SessionContextCompactionError, SessionContextCompactionManager, SessionManager, SessionMessageCursorError, SessionRequestManager, SessionSettingsError, SkillManager, SystemObjectReferenceError, SystemObjectReferenceManager, USER_QUESTION_EXTENSION_TYPE, UnavailableDesktopHost, UpdateManifestReader, UserQuestionError, UserQuestionManager, VerificationRecordService, assertObservationJsonValue, assertObservationPredicate, buildAgentRunSendPayload, buildContextCompactionModelProjection, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildNextclawNcpRunContext, buildObservationEventModelMessage, buildServiceActionId, buildSessionRequestCompletionMessage, capabilityGrantCovers, createAgentRuntimeSessionRequestDispatcher, createAgentRuntimeSessionRequestSourceNotifier, createAssetTools, createCapabilityDeclarationFingerprint, createContextCompactionMessageId, createContextWindowSignature, createCronJobSystemObjectProvider, createDesktopHostError, createInboxDeliverySystemObjectProvider, createLlmUsageRecord, createPanelAppAgentGrantRequest, createPanelAppClientGrantRequest, createServiceActionGrantRequest, createServiceAppAgentSlotGrantRequest, createServiceAppModelSlotGrantRequest, createTypedKey, describeAgentRuntimeSessionTypes, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, dispatchPromptOverNcpResult, evaluateObservationEventAdmission, evaluatePortableRuntimeAcceptance, evaluatePortableRuntimeAcceptanceArtifact, eventKeys, getAutomaticUpdateCheckDelay, getCapabilityGrantKey, getServiceActionName, getServiceAppManifestPath, getUiContentParamsBootstrapScript, getUnsignedUpdateManifest, hasLlmUsageTelemetry, ingressKeys, injectUiContentParamsBootstrap, isAppDataError, isAppPackageError, isContextCompactionProjectionMessage, isContextCompactionTimelineMessage, isContextWindowSnapshot, isInboxDeliveryError, isPanelAppAgentCapability, isPanelAppError, isPreferenceError, isProjectError, isProjectWorkError, isReplyCapableChannel, isServiceAppError, isSessionContextCompactionError, isSessionMessageCursorError, isSessionSettingsError, isSystemObjectReferenceError, listExtensionChannelIds, listServiceAppManifestActions, matchesCapabilityGrantFilter, matchesObservationPredicate, mergeServiceAppRuntimeActions, normalizeAgentRuntimeSessionTypeIcon, normalizeCapabilityGrantRequest, normalizeLlmUsageModel, normalizeOptionalString, normalizePortableRuntimeEnvironment, parseObservationDuration, parsePortableRuntimeAcceptanceEvidenceArtifact, parseServiceAppManifest, parseSkillFrontmatter, presentPortableRuntimeAcceptanceDefinition, readContextCompactionCheckpoint, readContextWindowEventSessionId, readJsonPointer, readLatestContextCompactionCheckpoint, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, readServiceActionTargetId, readServiceAppManifest, readServiceAppSlotTarget, resolveAgentRuntimeEntries, resolveAutomaticUpdateCheckIntervalMs, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolvePortableRuntimeAcceptanceLocale, resolveRuntimeInstanceSnapshot, resolveSessionChannelContext, runGatewayInboundLoop, runNextclawTask, sanitizeLlmUsage, serializeUnsignedUpdateManifest, shouldRefreshContextWindowDuringStream, shouldRefreshContextWindowImmediately, startPromptOverNcpExecution, stripSkillFrontmatter, syncSessionThinkingPreference, toBoundedJson, toNcpMessages, waitForAgentRuntimeSessionReply };
|
|
29968
|
+
export { AUTOMATIC_UPDATE_CHECK_INTERVAL_MS, AccessManager, AgentManager, AgentRunClient, AppDataError, AppDataManager, AppPackageError, AppPackageManager, AutomationManager, BuiltinNarpRuntimeProviderService, CONTEXT_COMPACTION_CONTINUATION_TEXT, CONTEXT_COMPACTION_PART_START, CONTEXT_COMPACTION_PROJECTION_KIND, CONTEXT_COMPACTION_PROJECTION_METADATA_KEY, CONTEXT_COMPACTION_SYSTEM_PREAMBLE, CONTEXT_COMPACTION_TIMELINE_KIND, CapabilityGrantLegacyMigrationService, CapabilityGrantManager, CapabilityGrantStore, ChannelManager, CommandRegistry, ConfigManager, ContextCompactionJournalRecoveryService, ContextCompactionPreflightService, Contribution, DEFAULT_AGENT_RUNTIME_ENTRY_ID, DEFAULT_SERVICE_ACTION_RISK, DESKTOP_HOST_ACCESS, DESKTOP_HOST_PROTOCOL_VERSION, DesktopHostCapabilityManager, DesktopNodeReplService, DesktopSessionStateService, EventBus, ExtensionManager, FeatureControlsService, GatewayInboundProcessor, InboxDeliveryError, InboxDeliveryManager, Ingress, LlmProviderManager, LlmUsageManager, LlmUsageStore, MAX_INBOX_DELIVERY_CONTENT_LENGTH, McpManager, McpServiceAppRuntimeService, NARP_HTTP_RUNTIME_KIND, NARP_STDIO_RUNTIME_KIND, NEXTCLAW_TIMELINE_KIND_METADATA_KEY, NcpAgentSessionJournalStore, NextclawHarness, NextclawHarnessError, NextclawKernel, ObservationManager, PANEL_APP_AGENT_CAPABILITIES, PORTABLE_RUNTIME_ACCEPTANCE_CONTRACT, PORTABLE_RUNTIME_ACCEPTANCE_CONTRACT_FINGERPRINT, PORTABLE_RUNTIME_ACCEPTANCE_LOCALES, PORTABLE_RUNTIME_ACCEPTANCE_PLATFORMS, PORTABLE_RUNTIME_ACCEPTANCE_PRESENTATION, PORTABLE_RUNTIME_ACCEPTANCE_REFERENCE_APP_ID, PROJECT_TEMPLATE_IDS, PROJECT_WORK_ATTENTION_VALUES, PROJECT_WORK_STATE_CATEGORIES, PROVIDER_MODEL_CATALOG_REFRESH_INTERVAL_MS, PanelAppAssetTokenService, PanelAppError, PanelAppManager, PlannedRestartRecoveryManager, PortableRuntimeAcceptanceIdentityService, PortableRuntimeAcceptanceManager, PreferenceError, PreferenceManager, ProjectError, ProjectManager, ProjectMaterialService, ProjectWorkError, ProjectWorkManager, ProviderManagerNcpLLMApi, ProviderModelCatalogManager, RUNTIME_INSTANCE_DESKTOP_DATA_DIRECTORY_ENV, RUNTIME_INSTANCE_DESKTOP_LOGS_DIRECTORY_ENV, RUNTIME_INSTANCE_DISTRIBUTION_ENV, RUNTIME_INSTANCE_INSTALLATION_KIND_ENV, RUNTIME_INSTANCE_PORTABLE_DATA_ROOT_ENV, SERVICE_APP_MANIFEST_FILE_NAME, ServiceAppAiCapabilityService, ServiceAppError, ServiceAppJobJournalService, ServiceAppManager, ServiceAppResidentEventInboxService, ServiceAppRuntimeService, SessionContextCompactionError, SessionContextCompactionManager, SessionManager, SessionMessageCursorError, SessionRequestManager, SessionSettingsError, SkillManager, SystemObjectReferenceError, SystemObjectReferenceManager, USER_QUESTION_EXTENSION_TYPE, UnavailableDesktopHost, UpdateManifestReader, UserQuestionError, UserQuestionManager, VerificationRecordService, assertObservationJsonValue, assertObservationPredicate, assertSessionJournalTailComplete, buildAgentRunSendPayload, buildContextCompactionModelProjection, buildContextCompactionTimelineNcpMessage, buildLlmUsageSummary, buildLocalizedTextMap, buildNextclawNcpRunContext, buildObservationEventModelMessage, buildServiceActionId, buildSessionRequestCompletionMessage, capabilityGrantCovers, compactSessionJournal, createAgentRuntimeSessionRequestDispatcher, createAgentRuntimeSessionRequestSourceNotifier, createAssetTools, createCapabilityDeclarationFingerprint, createContextCompactionMessageId, createContextWindowSignature, createCronJobSystemObjectProvider, createDesktopHostError, createInboxDeliverySystemObjectProvider, createLlmUsageRecord, createPanelAppAgentGrantRequest, createPanelAppClientGrantRequest, createServiceActionGrantRequest, createServiceAppAgentSlotGrantRequest, createServiceAppModelSlotGrantRequest, createTypedKey, describeAgentRuntimeSessionTypes, dispatchAgentRuntimeSessionRequest, dispatchChannelReplyRoute, dispatchPromptOverNcp, dispatchPromptOverNcpResult, evaluateObservationEventAdmission, evaluatePortableRuntimeAcceptance, evaluatePortableRuntimeAcceptanceArtifact, eventKeys, getAutomaticUpdateCheckDelay, getCapabilityGrantKey, getServiceActionName, getServiceAppManifestPath, getUiContentParamsBootstrapScript, getUnsignedUpdateManifest, hasLlmUsageTelemetry, ingressKeys, injectUiContentParamsBootstrap, isAppDataError, isAppPackageError, isContextCompactionProjectionMessage, isContextCompactionTimelineMessage, isContextWindowSnapshot, isInboxDeliveryError, isPanelAppAgentCapability, isPanelAppError, isPreferenceError, isProjectError, isProjectWorkError, isReplyCapableChannel, isServiceAppError, isSessionContextCompactionError, isSessionMessageCursorError, isSessionSettingsError, isSystemObjectReferenceError, listExtensionChannelIds, listServiceAppManifestActions, matchesCapabilityGrantFilter, matchesObservationPredicate, mergeServiceAppRuntimeActions, normalizeAgentRuntimeSessionTypeIcon, normalizeCapabilityGrantRequest, normalizeLlmUsageModel, normalizeOptionalString, normalizePortableRuntimeEnvironment, parseObservationDuration, parsePortableRuntimeAcceptanceEvidenceArtifact, parseServiceAppManifest, parseSkillFrontmatter, presentPortableRuntimeAcceptanceDefinition, readContextCompactionCheckpoint, readContextWindowEventSessionId, readJsonPointer, readLatestContextCompactionCheckpoint, readLearningLoopRuntimeConfig, readMetadataModel, readMetadataThinking, readServiceActionTargetId, readServiceAppManifest, readServiceAppSlotTarget, recoverSessionJournalMaintenance, resolveAgentRuntimeEntries, resolveAutomaticUpdateCheckIntervalMs, resolveChannelReplyRoute, resolveEffectiveModel, resolveLegacyEventType, resolvePortableRuntimeAcceptanceLocale, resolveRuntimeInstanceSnapshot, resolveSessionChannelContext, restoreSessionJournalBackup, runGatewayInboundLoop, runNextclawTask, sanitizeLlmUsage, serializeUnsignedUpdateManifest, shouldRefreshContextWindowDuringStream, shouldRefreshContextWindowImmediately, startPromptOverNcpExecution, stripSkillFrontmatter, syncSessionThinkingPreference, toBoundedJson, toNcpMessages, waitForAgentRuntimeSessionReply };
|
|
29608
29969
|
|
|
29609
29970
|
//# sourceMappingURL=index.js.map
|