nextclaw 0.13.40 → 0.14.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/cli/index.js +213 -109
- package/package.json +10 -10
- package/ui-dist/assets/{ChannelsList-D75wfbDS.js → ChannelsList-VSRZzxx2.js} +6 -6
- package/ui-dist/assets/{ChatPage-gWZ3rDTy.js → ChatPage-CX0ZKE5i.js} +1 -1
- package/ui-dist/assets/{DocBrowser-CebTdor0.js → DocBrowser-C65Hbvnb.js} +1 -1
- package/ui-dist/assets/{LogoBadge-gdbraoaZ.js → LogoBadge-4qtguXEJ.js} +1 -1
- package/ui-dist/assets/{MarketplacePage-C-zz0lBT.js → MarketplacePage-DPCYptfD.js} +1 -1
- package/ui-dist/assets/{McpMarketplacePage-tfpLh6Zz.js → McpMarketplacePage-CHLkD8yX.js} +1 -1
- package/ui-dist/assets/{ModelConfig-j74dn-5k.js → ModelConfig-CjsGdmZa.js} +1 -1
- package/ui-dist/assets/{ProvidersList-BGI9EgVV.js → ProvidersList-aXp_mo4J.js} +1 -1
- package/ui-dist/assets/{RemoteAccessPage-CusGQmZE.js → RemoteAccessPage-rOZCnH1x.js} +1 -1
- package/ui-dist/assets/{RuntimeConfig-pmhW8ifz.js → RuntimeConfig-CmJh6g0R.js} +1 -1
- package/ui-dist/assets/{SearchConfig-rrD2_F5u.js → SearchConfig-C_hUuzR4.js} +1 -1
- package/ui-dist/assets/{SecretsConfig-D7onb-hv.js → SecretsConfig-Bu_zIRlQ.js} +1 -1
- package/ui-dist/assets/{SessionsConfig-m-6RSeja.js → SessionsConfig-DA_nqkM_.js} +1 -1
- package/ui-dist/assets/{chat-message-BO-s2mvl.js → chat-message-BOdA4h43.js} +1 -1
- package/ui-dist/assets/index-DS7D1-KS.js +8 -0
- package/ui-dist/assets/{label-CDSYExvV.js → label-BYZ62ajO.js} +1 -1
- package/ui-dist/assets/{page-layout-BMCVAnQM.js → page-layout-UC-h92sU.js} +1 -1
- package/ui-dist/assets/{popover-DfywyUDH.js → popover-DASCEr3G.js} +1 -1
- package/ui-dist/assets/{security-config-BU-K2EOM.js → security-config-Cvujq4fH.js} +1 -1
- package/ui-dist/assets/{skeleton-Cg9CRkOt.js → skeleton-DlYEKkkj.js} +1 -1
- package/ui-dist/assets/{status-dot-2vau2Xtc.js → status-dot-C1AvPwDD.js} +1 -1
- package/ui-dist/assets/{switch-CJRPF2V6.js → switch-D3wVuCSh.js} +1 -1
- package/ui-dist/assets/{tabs-custom-B-2uSCfW.js → tabs-custom-CbgS7tu0.js} +1 -1
- package/ui-dist/assets/{useConfirmDialog-CfOpdypA.js → useConfirmDialog-BYbFEIbQ.js} +1 -1
- package/ui-dist/index.html +1 -1
- package/ui-dist/assets/index-BsL1YIJ1.js +0 -8
package/dist/cli/index.js
CHANGED
|
@@ -5475,7 +5475,8 @@ var resolveCliSubcommandEntry = (params) => {
|
|
|
5475
5475
|
|
|
5476
5476
|
// src/cli/commands/ncp/create-ui-ncp-agent.ts
|
|
5477
5477
|
import {
|
|
5478
|
-
DisposableStore
|
|
5478
|
+
DisposableStore,
|
|
5479
|
+
resolveProviderRuntime
|
|
5479
5480
|
} from "@nextclaw/core";
|
|
5480
5481
|
import { McpRegistryService as McpRegistryService2, McpServerLifecycleManager } from "@nextclaw/mcp";
|
|
5481
5482
|
import { DefaultNcpAgentRuntime } from "@nextclaw/ncp-agent-runtime";
|
|
@@ -5485,7 +5486,10 @@ import {
|
|
|
5485
5486
|
readAssistantReasoningNormalizationModeFromMetadata,
|
|
5486
5487
|
writeAssistantReasoningNormalizationModeToMetadata
|
|
5487
5488
|
} from "@nextclaw/ncp";
|
|
5488
|
-
import {
|
|
5489
|
+
import {
|
|
5490
|
+
createAgentClientFromServer,
|
|
5491
|
+
DefaultNcpAgentBackend
|
|
5492
|
+
} from "@nextclaw/ncp-toolkit";
|
|
5489
5493
|
|
|
5490
5494
|
// src/cli/commands/ncp/nextclaw-ncp-context-builder.ts
|
|
5491
5495
|
import {
|
|
@@ -6657,9 +6661,58 @@ var UiNcpRuntimeRegistry = class {
|
|
|
6657
6661
|
};
|
|
6658
6662
|
|
|
6659
6663
|
// src/cli/commands/ncp/create-ui-ncp-agent.ts
|
|
6664
|
+
var CODEX_RUNTIME_KIND = "codex";
|
|
6665
|
+
var CODEX_DIRECT_RUNTIME_BACKEND = "codex-sdk";
|
|
6666
|
+
var CODEX_NATIVE_RUNTIME_BACKEND = "native-openai-compatible";
|
|
6660
6667
|
function isRecord5(value) {
|
|
6661
6668
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
6662
6669
|
}
|
|
6670
|
+
function readOptionalString(value) {
|
|
6671
|
+
if (typeof value !== "string") {
|
|
6672
|
+
return null;
|
|
6673
|
+
}
|
|
6674
|
+
const normalized = value.trim();
|
|
6675
|
+
return normalized.length > 0 ? normalized : null;
|
|
6676
|
+
}
|
|
6677
|
+
function resolveCodexRequestedModel(params) {
|
|
6678
|
+
return readOptionalString(params.sessionMetadata.preferred_model) ?? readOptionalString(params.sessionMetadata.model) ?? params.config.agents.defaults.model;
|
|
6679
|
+
}
|
|
6680
|
+
function isCodexDirectModelFamily(model) {
|
|
6681
|
+
const normalized = model.trim().toLowerCase();
|
|
6682
|
+
return normalized.startsWith("gpt-") || normalized.startsWith("chatgpt-") || normalized.startsWith("codex-") || normalized.startsWith("o1") || normalized.startsWith("o3") || normalized.startsWith("o4");
|
|
6683
|
+
}
|
|
6684
|
+
function shouldRouteCodexSessionToNativeRuntime(params) {
|
|
6685
|
+
const requestedModel = resolveCodexRequestedModel(params);
|
|
6686
|
+
try {
|
|
6687
|
+
const resolvedProviderRuntime = resolveProviderRuntime(params.config, requestedModel);
|
|
6688
|
+
if (resolvedProviderRuntime.providerName === "openai") {
|
|
6689
|
+
return false;
|
|
6690
|
+
}
|
|
6691
|
+
return !isCodexDirectModelFamily(resolvedProviderRuntime.providerLocalModel);
|
|
6692
|
+
} catch {
|
|
6693
|
+
return false;
|
|
6694
|
+
}
|
|
6695
|
+
}
|
|
6696
|
+
function decorateCodexRuntimeFactoryParams(runtimeParams, backend) {
|
|
6697
|
+
const nextSessionMetadata = {
|
|
6698
|
+
...runtimeParams.sessionMetadata,
|
|
6699
|
+
session_type: CODEX_RUNTIME_KIND,
|
|
6700
|
+
codex_runtime_backend: backend
|
|
6701
|
+
};
|
|
6702
|
+
const setSessionMetadata = (nextMetadata) => {
|
|
6703
|
+
runtimeParams.setSessionMetadata({
|
|
6704
|
+
...nextMetadata,
|
|
6705
|
+
session_type: CODEX_RUNTIME_KIND,
|
|
6706
|
+
codex_runtime_backend: backend
|
|
6707
|
+
});
|
|
6708
|
+
};
|
|
6709
|
+
setSessionMetadata(nextSessionMetadata);
|
|
6710
|
+
return {
|
|
6711
|
+
...runtimeParams,
|
|
6712
|
+
sessionMetadata: nextSessionMetadata,
|
|
6713
|
+
setSessionMetadata
|
|
6714
|
+
};
|
|
6715
|
+
}
|
|
6663
6716
|
function resolveNativeReasoningNormalizationMode(params) {
|
|
6664
6717
|
const runtimeEntry = params.config.ui.ncp.runtimes.native;
|
|
6665
6718
|
const runtimeMetadata = isRecord5(runtimeEntry) ? runtimeEntry : {};
|
|
@@ -6674,10 +6727,8 @@ function buildPluginRuntimeSnapshotKey(extensionRegistry) {
|
|
|
6674
6727
|
registration.source
|
|
6675
6728
|
].join(":")).join("|");
|
|
6676
6729
|
}
|
|
6677
|
-
async function
|
|
6678
|
-
|
|
6679
|
-
const runtimeRegistry = new UiNcpRuntimeRegistry();
|
|
6680
|
-
let currentMcpConfig = params.getConfig();
|
|
6730
|
+
async function createMcpRuntimeSupport(getConfig) {
|
|
6731
|
+
let currentMcpConfig = getConfig();
|
|
6681
6732
|
const mcpLifecycleManager = new McpServerLifecycleManager({
|
|
6682
6733
|
getConfig: () => currentMcpConfig
|
|
6683
6734
|
});
|
|
@@ -6691,49 +6742,84 @@ async function createUiNcpAgent(params) {
|
|
|
6691
6742
|
console.warn(`[mcp] Failed to warm ${result.name}: ${result.error}`);
|
|
6692
6743
|
}
|
|
6693
6744
|
}
|
|
6694
|
-
|
|
6695
|
-
|
|
6696
|
-
|
|
6697
|
-
|
|
6698
|
-
|
|
6699
|
-
const
|
|
6700
|
-
|
|
6701
|
-
|
|
6745
|
+
return {
|
|
6746
|
+
toolRegistryAdapter: new McpNcpToolRegistryAdapter(mcpRegistryService),
|
|
6747
|
+
applyMcpConfig: async (config2) => {
|
|
6748
|
+
const previousConfig = currentMcpConfig;
|
|
6749
|
+
currentMcpConfig = config2;
|
|
6750
|
+
const reconcileResult = await mcpRegistryService.reconcileConfig({
|
|
6751
|
+
prevConfig: previousConfig,
|
|
6752
|
+
nextConfig: config2
|
|
6702
6753
|
});
|
|
6703
|
-
|
|
6704
|
-
|
|
6705
|
-
|
|
6706
|
-
|
|
6707
|
-
reasoningNormalizationMode
|
|
6708
|
-
)
|
|
6709
|
-
);
|
|
6754
|
+
for (const warmResult of reconcileResult.warmed) {
|
|
6755
|
+
if (!warmResult.ok) {
|
|
6756
|
+
console.warn(`[mcp] Failed to warm ${warmResult.name}: ${warmResult.error}`);
|
|
6757
|
+
}
|
|
6710
6758
|
}
|
|
6711
|
-
|
|
6712
|
-
|
|
6713
|
-
|
|
6759
|
+
}
|
|
6760
|
+
};
|
|
6761
|
+
}
|
|
6762
|
+
function createNativeRuntimeFactory(params, mcpToolRegistryAdapter) {
|
|
6763
|
+
return ({
|
|
6764
|
+
stateManager,
|
|
6765
|
+
sessionMetadata,
|
|
6766
|
+
setSessionMetadata
|
|
6767
|
+
}) => {
|
|
6768
|
+
const reasoningNormalizationMode = resolveNativeReasoningNormalizationMode({
|
|
6769
|
+
config: params.getConfig(),
|
|
6770
|
+
sessionMetadata
|
|
6771
|
+
});
|
|
6772
|
+
if (reasoningNormalizationMode !== "off" && readAssistantReasoningNormalizationModeFromMetadata(sessionMetadata) !== reasoningNormalizationMode) {
|
|
6773
|
+
setSessionMetadata(
|
|
6774
|
+
writeAssistantReasoningNormalizationModeToMetadata(
|
|
6775
|
+
sessionMetadata,
|
|
6776
|
+
reasoningNormalizationMode
|
|
6777
|
+
)
|
|
6778
|
+
);
|
|
6779
|
+
}
|
|
6780
|
+
const toolRegistry = new NextclawNcpToolRegistry({
|
|
6781
|
+
bus: params.bus,
|
|
6782
|
+
providerManager: params.providerManager,
|
|
6783
|
+
sessionManager: params.sessionManager,
|
|
6784
|
+
cronService: params.cronService,
|
|
6785
|
+
gatewayController: params.gatewayController,
|
|
6786
|
+
getConfig: params.getConfig,
|
|
6787
|
+
getExtensionRegistry: params.getExtensionRegistry,
|
|
6788
|
+
getAdditionalTools: (context) => mcpToolRegistryAdapter.listToolsForRun({
|
|
6789
|
+
agentId: context.agentId
|
|
6790
|
+
})
|
|
6791
|
+
});
|
|
6792
|
+
return new DefaultNcpAgentRuntime({
|
|
6793
|
+
contextBuilder: new NextclawNcpContextBuilder({
|
|
6714
6794
|
sessionManager: params.sessionManager,
|
|
6715
|
-
cronService: params.cronService,
|
|
6716
|
-
gatewayController: params.gatewayController,
|
|
6717
|
-
getConfig: params.getConfig,
|
|
6718
|
-
getExtensionRegistry: params.getExtensionRegistry,
|
|
6719
|
-
getAdditionalTools: (context) => mcpToolRegistryAdapter.listToolsForRun({
|
|
6720
|
-
agentId: context.agentId
|
|
6721
|
-
})
|
|
6722
|
-
});
|
|
6723
|
-
return new DefaultNcpAgentRuntime({
|
|
6724
|
-
contextBuilder: new NextclawNcpContextBuilder({
|
|
6725
|
-
sessionManager: params.sessionManager,
|
|
6726
|
-
toolRegistry,
|
|
6727
|
-
getConfig: params.getConfig,
|
|
6728
|
-
resolveMessageToolHints: params.resolveMessageToolHints
|
|
6729
|
-
}),
|
|
6730
|
-
llmApi: new ProviderManagerNcpLLMApi(params.providerManager),
|
|
6731
6795
|
toolRegistry,
|
|
6732
|
-
|
|
6733
|
-
|
|
6734
|
-
})
|
|
6735
|
-
|
|
6736
|
-
|
|
6796
|
+
getConfig: params.getConfig,
|
|
6797
|
+
resolveMessageToolHints: params.resolveMessageToolHints
|
|
6798
|
+
}),
|
|
6799
|
+
llmApi: new ProviderManagerNcpLLMApi(params.providerManager),
|
|
6800
|
+
toolRegistry,
|
|
6801
|
+
stateManager,
|
|
6802
|
+
reasoningNormalizationMode
|
|
6803
|
+
});
|
|
6804
|
+
};
|
|
6805
|
+
}
|
|
6806
|
+
function createCodexAwareRuntimeFactory(params) {
|
|
6807
|
+
return (runtimeParams) => {
|
|
6808
|
+
const backend = shouldRouteCodexSessionToNativeRuntime({
|
|
6809
|
+
config: params.getConfig(),
|
|
6810
|
+
sessionMetadata: runtimeParams.sessionMetadata
|
|
6811
|
+
}) ? CODEX_NATIVE_RUNTIME_BACKEND : CODEX_DIRECT_RUNTIME_BACKEND;
|
|
6812
|
+
const decoratedRuntimeParams = decorateCodexRuntimeFactoryParams(
|
|
6813
|
+
runtimeParams,
|
|
6814
|
+
backend
|
|
6815
|
+
);
|
|
6816
|
+
return backend === CODEX_NATIVE_RUNTIME_BACKEND ? params.createNativeRuntime(decoratedRuntimeParams) : params.registration.createRuntime(decoratedRuntimeParams);
|
|
6817
|
+
};
|
|
6818
|
+
}
|
|
6819
|
+
function resolveRegisteredRuntimeFactory(params) {
|
|
6820
|
+
return params.registration.kind === CODEX_RUNTIME_KIND ? createCodexAwareRuntimeFactory(params) : params.registration.createRuntime;
|
|
6821
|
+
}
|
|
6822
|
+
function createPluginRuntimeRegistrationController(params) {
|
|
6737
6823
|
const pluginRuntimeScopes = /* @__PURE__ */ new Map();
|
|
6738
6824
|
let pluginRuntimeSnapshotKey = "";
|
|
6739
6825
|
let activeExtensionRegistry;
|
|
@@ -6749,60 +6835,78 @@ async function createUiNcpAgent(params) {
|
|
|
6749
6835
|
pluginRuntimeScopes.clear();
|
|
6750
6836
|
for (const registration of extensionRegistry?.ncpAgentRuntimes ?? []) {
|
|
6751
6837
|
const pluginId = registration.pluginId.trim() || registration.kind;
|
|
6752
|
-
|
|
6753
|
-
|
|
6754
|
-
|
|
6755
|
-
pluginRuntimeScopes.set(pluginId, scope);
|
|
6756
|
-
}
|
|
6757
|
-
scope.add(runtimeRegistry.register({
|
|
6838
|
+
const scope = pluginRuntimeScopes.get(pluginId) ?? new DisposableStore();
|
|
6839
|
+
pluginRuntimeScopes.set(pluginId, scope);
|
|
6840
|
+
scope.add(params.runtimeRegistry.register({
|
|
6758
6841
|
kind: registration.kind,
|
|
6759
6842
|
label: registration.label,
|
|
6760
|
-
createRuntime:
|
|
6843
|
+
createRuntime: resolveRegisteredRuntimeFactory({
|
|
6844
|
+
getConfig: params.getConfig,
|
|
6845
|
+
createNativeRuntime: params.createNativeRuntime,
|
|
6846
|
+
registration
|
|
6847
|
+
}),
|
|
6761
6848
|
describeSessionType: registration.describeSessionType
|
|
6762
6849
|
}));
|
|
6763
6850
|
}
|
|
6764
6851
|
};
|
|
6765
6852
|
const resolveActiveExtensionRegistry = () => activeExtensionRegistry ?? params.getExtensionRegistry?.();
|
|
6766
|
-
|
|
6767
|
-
|
|
6853
|
+
return {
|
|
6854
|
+
refreshPluginRuntimeRegistrations: () => {
|
|
6855
|
+
syncPluginRuntimeRegistrations(resolveActiveExtensionRegistry());
|
|
6856
|
+
},
|
|
6857
|
+
applyExtensionRegistry: (extensionRegistry) => {
|
|
6858
|
+
activeExtensionRegistry = extensionRegistry;
|
|
6859
|
+
syncPluginRuntimeRegistrations(extensionRegistry);
|
|
6860
|
+
}
|
|
6861
|
+
};
|
|
6862
|
+
}
|
|
6863
|
+
function createUiNcpAgentHandle(params) {
|
|
6864
|
+
return {
|
|
6865
|
+
basePath: "/api/ncp/agent",
|
|
6866
|
+
agentClientEndpoint: createAgentClientFromServer(params.backend),
|
|
6867
|
+
streamProvider: params.backend,
|
|
6868
|
+
sessionApi: params.backend,
|
|
6869
|
+
listSessionTypes: () => {
|
|
6870
|
+
params.refreshPluginRuntimeRegistrations();
|
|
6871
|
+
return params.runtimeRegistry.listSessionTypes();
|
|
6872
|
+
},
|
|
6873
|
+
applyExtensionRegistry: params.applyExtensionRegistry,
|
|
6874
|
+
applyMcpConfig: params.applyMcpConfig
|
|
6768
6875
|
};
|
|
6769
|
-
|
|
6876
|
+
}
|
|
6877
|
+
async function createUiNcpAgent(params) {
|
|
6878
|
+
const sessionStore = new NextclawAgentSessionStore(params.sessionManager);
|
|
6879
|
+
const runtimeRegistry = new UiNcpRuntimeRegistry();
|
|
6880
|
+
const { toolRegistryAdapter, applyMcpConfig } = await createMcpRuntimeSupport(params.getConfig);
|
|
6881
|
+
const createNativeRuntime = createNativeRuntimeFactory(params, toolRegistryAdapter);
|
|
6882
|
+
runtimeRegistry.register({
|
|
6883
|
+
kind: "native",
|
|
6884
|
+
label: "Native",
|
|
6885
|
+
createRuntime: createNativeRuntime
|
|
6886
|
+
});
|
|
6887
|
+
const pluginRuntimeRegistrationController = createPluginRuntimeRegistrationController({
|
|
6888
|
+
runtimeRegistry,
|
|
6889
|
+
getConfig: params.getConfig,
|
|
6890
|
+
getExtensionRegistry: params.getExtensionRegistry,
|
|
6891
|
+
createNativeRuntime
|
|
6892
|
+
});
|
|
6893
|
+
pluginRuntimeRegistrationController.refreshPluginRuntimeRegistrations();
|
|
6770
6894
|
const backend = new DefaultNcpAgentBackend({
|
|
6771
6895
|
endpointId: "nextclaw-ui-agent",
|
|
6772
6896
|
sessionStore,
|
|
6773
6897
|
createRuntime: (runtimeParams) => {
|
|
6774
|
-
refreshPluginRuntimeRegistrations();
|
|
6898
|
+
pluginRuntimeRegistrationController.refreshPluginRuntimeRegistrations();
|
|
6775
6899
|
return runtimeRegistry.createRuntime(runtimeParams);
|
|
6776
6900
|
}
|
|
6777
6901
|
});
|
|
6778
6902
|
await backend.start();
|
|
6779
|
-
return {
|
|
6780
|
-
|
|
6781
|
-
|
|
6782
|
-
|
|
6783
|
-
|
|
6784
|
-
|
|
6785
|
-
|
|
6786
|
-
return runtimeRegistry.listSessionTypes();
|
|
6787
|
-
},
|
|
6788
|
-
applyExtensionRegistry: (extensionRegistry) => {
|
|
6789
|
-
activeExtensionRegistry = extensionRegistry;
|
|
6790
|
-
syncPluginRuntimeRegistrations(extensionRegistry);
|
|
6791
|
-
},
|
|
6792
|
-
applyMcpConfig: async (config2) => {
|
|
6793
|
-
const previousConfig = currentMcpConfig;
|
|
6794
|
-
currentMcpConfig = config2;
|
|
6795
|
-
const reconcileResult = await mcpRegistryService.reconcileConfig({
|
|
6796
|
-
prevConfig: previousConfig,
|
|
6797
|
-
nextConfig: config2
|
|
6798
|
-
});
|
|
6799
|
-
for (const warmResult of reconcileResult.warmed) {
|
|
6800
|
-
if (!warmResult.ok) {
|
|
6801
|
-
console.warn(`[mcp] Failed to warm ${warmResult.name}: ${warmResult.error}`);
|
|
6802
|
-
}
|
|
6803
|
-
}
|
|
6804
|
-
}
|
|
6805
|
-
};
|
|
6903
|
+
return createUiNcpAgentHandle({
|
|
6904
|
+
backend,
|
|
6905
|
+
runtimeRegistry,
|
|
6906
|
+
refreshPluginRuntimeRegistrations: pluginRuntimeRegistrationController.refreshPluginRuntimeRegistrations,
|
|
6907
|
+
applyExtensionRegistry: pluginRuntimeRegistrationController.applyExtensionRegistry,
|
|
6908
|
+
applyMcpConfig
|
|
6909
|
+
});
|
|
6806
6910
|
}
|
|
6807
6911
|
|
|
6808
6912
|
// src/cli/commands/service-remote-runtime.ts
|
|
@@ -7214,7 +7318,7 @@ function createRunId() {
|
|
|
7214
7318
|
function isRecord6(value) {
|
|
7215
7319
|
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
7216
7320
|
}
|
|
7217
|
-
function
|
|
7321
|
+
function readOptionalString2(value) {
|
|
7218
7322
|
if (typeof value !== "string") {
|
|
7219
7323
|
return void 0;
|
|
7220
7324
|
}
|
|
@@ -7304,7 +7408,7 @@ var UiChatRunCoordinator = class {
|
|
|
7304
7408
|
return run ? this.toRunView(run) : null;
|
|
7305
7409
|
}
|
|
7306
7410
|
listRuns(params = {}) {
|
|
7307
|
-
const sessionKey =
|
|
7411
|
+
const sessionKey = readOptionalString2(params.sessionKey);
|
|
7308
7412
|
const stateFilter = Array.isArray(params.states) && params.states.length > 0 ? new Set(params.states) : null;
|
|
7309
7413
|
const limit = Number.isFinite(params.limit) ? Math.max(0, Math.trunc(params.limit)) : 0;
|
|
7310
7414
|
const records = Array.from(this.runs.values()).filter((run) => {
|
|
@@ -7341,7 +7445,7 @@ var UiChatRunCoordinator = class {
|
|
|
7341
7445
|
}
|
|
7342
7446
|
}
|
|
7343
7447
|
async stopRun(params) {
|
|
7344
|
-
const runId =
|
|
7448
|
+
const runId = readOptionalString2(params.runId) ?? "";
|
|
7345
7449
|
if (!runId) {
|
|
7346
7450
|
return {
|
|
7347
7451
|
stopped: false,
|
|
@@ -7354,11 +7458,11 @@ var UiChatRunCoordinator = class {
|
|
|
7354
7458
|
return {
|
|
7355
7459
|
stopped: false,
|
|
7356
7460
|
runId,
|
|
7357
|
-
...
|
|
7461
|
+
...readOptionalString2(params.sessionKey) ? { sessionKey: readOptionalString2(params.sessionKey) } : {},
|
|
7358
7462
|
reason: "run not found or already completed"
|
|
7359
7463
|
};
|
|
7360
7464
|
}
|
|
7361
|
-
const requestedSessionKey =
|
|
7465
|
+
const requestedSessionKey = readOptionalString2(params.sessionKey);
|
|
7362
7466
|
if (requestedSessionKey && requestedSessionKey !== run.sessionKey) {
|
|
7363
7467
|
return {
|
|
7364
7468
|
stopped: false,
|
|
@@ -7395,17 +7499,17 @@ var UiChatRunCoordinator = class {
|
|
|
7395
7499
|
};
|
|
7396
7500
|
}
|
|
7397
7501
|
resolveRequest(input) {
|
|
7398
|
-
const message =
|
|
7399
|
-
const sessionKey =
|
|
7400
|
-
const explicitAgentId =
|
|
7502
|
+
const message = readOptionalString2(input.message) ?? "";
|
|
7503
|
+
const sessionKey = readOptionalString2(input.sessionKey) ?? `ui:${Date.now().toString(36)}:${Math.random().toString(36).slice(2, 8)}`;
|
|
7504
|
+
const explicitAgentId = readOptionalString2(input.agentId);
|
|
7401
7505
|
const parsedAgentId = parseAgentScopedSessionKey3(sessionKey)?.agentId;
|
|
7402
|
-
const agentId = explicitAgentId ??
|
|
7403
|
-
const model =
|
|
7506
|
+
const agentId = explicitAgentId ?? readOptionalString2(parsedAgentId);
|
|
7507
|
+
const model = readOptionalString2(input.model);
|
|
7404
7508
|
const metadata = isRecord6(input.metadata) ? { ...input.metadata } : {};
|
|
7405
7509
|
if (model) {
|
|
7406
7510
|
metadata.model = model;
|
|
7407
7511
|
}
|
|
7408
|
-
const runId =
|
|
7512
|
+
const runId = readOptionalString2(input.runId) ?? createRunId();
|
|
7409
7513
|
return {
|
|
7410
7514
|
runId,
|
|
7411
7515
|
message,
|
|
@@ -7413,16 +7517,16 @@ var UiChatRunCoordinator = class {
|
|
|
7413
7517
|
...agentId ? { agentId } : {},
|
|
7414
7518
|
...model ? { model } : {},
|
|
7415
7519
|
metadata,
|
|
7416
|
-
channel:
|
|
7417
|
-
chatId:
|
|
7520
|
+
channel: readOptionalString2(input.channel) ?? "ui",
|
|
7521
|
+
chatId: readOptionalString2(input.chatId) ?? "web-ui"
|
|
7418
7522
|
};
|
|
7419
7523
|
}
|
|
7420
7524
|
readRequestedSessionType(metadata) {
|
|
7421
|
-
const value =
|
|
7525
|
+
const value = readOptionalString2(metadata.session_type) ?? readOptionalString2(metadata.sessionType);
|
|
7422
7526
|
return value ? value.toLowerCase() : void 0;
|
|
7423
7527
|
}
|
|
7424
7528
|
readStoredSessionType(metadata) {
|
|
7425
|
-
const value =
|
|
7529
|
+
const value = readOptionalString2(metadata[SESSION_TYPE_METADATA_KEY]);
|
|
7426
7530
|
return value ? value.toLowerCase() : DEFAULT_SESSION_TYPE;
|
|
7427
7531
|
}
|
|
7428
7532
|
countUserMessages(session) {
|
|
@@ -7545,7 +7649,7 @@ var UiChatRunCoordinator = class {
|
|
|
7545
7649
|
});
|
|
7546
7650
|
run.reply = partialReply;
|
|
7547
7651
|
this.transitionState(run, "aborted", {
|
|
7548
|
-
error: abortController?.signal.reason instanceof Error ? abortController.signal.reason.message :
|
|
7652
|
+
error: abortController?.signal.reason instanceof Error ? abortController.signal.reason.message : readOptionalString2(abortController?.signal.reason)
|
|
7549
7653
|
});
|
|
7550
7654
|
return;
|
|
7551
7655
|
}
|
|
@@ -7760,8 +7864,8 @@ var UiChatRunCoordinator = class {
|
|
|
7760
7864
|
const path2 = join5(RUNS_DIR, entry.name);
|
|
7761
7865
|
try {
|
|
7762
7866
|
const parsed = JSON.parse(readFileSync8(path2, "utf-8"));
|
|
7763
|
-
const runId =
|
|
7764
|
-
const sessionKey =
|
|
7867
|
+
const runId = readOptionalString2(parsed.runId);
|
|
7868
|
+
const sessionKey = readOptionalString2(parsed.sessionKey);
|
|
7765
7869
|
if (!runId || !sessionKey) {
|
|
7766
7870
|
continue;
|
|
7767
7871
|
}
|
|
@@ -7770,15 +7874,15 @@ var UiChatRunCoordinator = class {
|
|
|
7770
7874
|
const run = {
|
|
7771
7875
|
runId,
|
|
7772
7876
|
sessionKey,
|
|
7773
|
-
...
|
|
7774
|
-
...
|
|
7877
|
+
...readOptionalString2(parsed.agentId) ? { agentId: readOptionalString2(parsed.agentId) } : {},
|
|
7878
|
+
...readOptionalString2(parsed.model) ? { model: readOptionalString2(parsed.model) } : {},
|
|
7775
7879
|
state,
|
|
7776
|
-
requestedAt:
|
|
7777
|
-
...
|
|
7778
|
-
...
|
|
7880
|
+
requestedAt: readOptionalString2(parsed.requestedAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
|
7881
|
+
...readOptionalString2(parsed.startedAt) ? { startedAt: readOptionalString2(parsed.startedAt) } : {},
|
|
7882
|
+
...readOptionalString2(parsed.completedAt) ? { completedAt: readOptionalString2(parsed.completedAt) } : {},
|
|
7779
7883
|
stopSupported: Boolean(parsed.stopSupported),
|
|
7780
|
-
...
|
|
7781
|
-
...
|
|
7884
|
+
...readOptionalString2(parsed.stopReason) ? { stopReason: readOptionalString2(parsed.stopReason) } : {},
|
|
7885
|
+
...readOptionalString2(parsed.error) ? { error: readOptionalString2(parsed.error) } : {},
|
|
7782
7886
|
...typeof parsed.reply === "string" ? { reply: parsed.reply } : {},
|
|
7783
7887
|
events,
|
|
7784
7888
|
waiters: /* @__PURE__ */ new Set(),
|
|
@@ -7804,7 +7908,7 @@ var UiChatRunCoordinator = class {
|
|
|
7804
7908
|
return "failed";
|
|
7805
7909
|
}
|
|
7806
7910
|
getRunRecord(runId) {
|
|
7807
|
-
const normalized =
|
|
7911
|
+
const normalized = readOptionalString2(runId);
|
|
7808
7912
|
if (!normalized) {
|
|
7809
7913
|
return null;
|
|
7810
7914
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nextclaw",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.0",
|
|
4
4
|
"description": "Lightweight personal AI assistant with CLI, multi-provider routing, and channel integrations.",
|
|
5
5
|
"private": false,
|
|
6
6
|
"type": "module",
|
|
@@ -39,16 +39,16 @@
|
|
|
39
39
|
"chokidar": "^3.6.0",
|
|
40
40
|
"commander": "^12.1.0",
|
|
41
41
|
"yaml": "^2.8.1",
|
|
42
|
-
"@nextclaw/
|
|
42
|
+
"@nextclaw/core": "0.10.0",
|
|
43
|
+
"@nextclaw/mcp": "0.1.33",
|
|
44
|
+
"@nextclaw/ncp": "0.3.2",
|
|
43
45
|
"@nextclaw/ncp-agent-runtime": "0.2.2",
|
|
44
|
-
"@nextclaw/
|
|
45
|
-
"@nextclaw/ncp-mcp": "0.1.31",
|
|
46
|
+
"@nextclaw/ncp-mcp": "0.1.32",
|
|
46
47
|
"@nextclaw/ncp-toolkit": "0.4.2",
|
|
47
|
-
"@nextclaw/
|
|
48
|
-
"@nextclaw/
|
|
49
|
-
"@nextclaw/openclaw-compat": "0.3.
|
|
50
|
-
"@nextclaw/remote": "0.1.
|
|
51
|
-
"@nextclaw/server": "0.10.36"
|
|
48
|
+
"@nextclaw/runtime": "0.2.13",
|
|
49
|
+
"@nextclaw/server": "0.10.37",
|
|
50
|
+
"@nextclaw/openclaw-compat": "0.3.19",
|
|
51
|
+
"@nextclaw/remote": "0.1.31"
|
|
52
52
|
},
|
|
53
53
|
"devDependencies": {
|
|
54
54
|
"@types/node": "^20.17.6",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"tsx": "^4.19.2",
|
|
58
58
|
"typescript": "^5.6.3",
|
|
59
59
|
"vitest": "^2.1.2",
|
|
60
|
-
"@nextclaw/ui": "0.
|
|
60
|
+
"@nextclaw/ui": "0.10.0"
|
|
61
61
|
},
|
|
62
62
|
"scripts": {
|
|
63
63
|
"dev": "tsx watch --tsconfig tsconfig.json src/cli/index.ts",
|