feat: enhance after-pack script to copy OpenClaw runtime dependencies
- Added a new script `bundle-openclaw.mjs` to bundle OpenClaw runtime dependencies. - Updated `after-pack.cjs` to copy bundled OpenClaw runtime and its node_modules. - Improved cleanup of unnecessary development files in node_modules. - Adjusted paths for resources in the packaging process. style: update loading indicator styles in ChatHistoryPanel - Changed the border radius and padding for the loading indicator in ChatHistoryPanel. fix: improve ProvidersSection to handle provider account syncing - Added logic to sync model configuration to provider accounts. - Introduced error handling and loading states during the sync process. - Enhanced vendor resolution and account management logic. fix: fallback session handling in chat store - Implemented fallback session logic in loadSessions to ensure a valid session is always available on error.
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
import {
|
||||
ensureOpenClawRuntimeLayout,
|
||||
getOpenClawPackageStatus,
|
||||
getOpenClawRuntimePaths,
|
||||
type OpenClawRuntimePaths,
|
||||
} from '@electron/utils/paths';
|
||||
@@ -16,6 +17,10 @@ export interface OpenClawProcessOwnerStatus {
|
||||
state: OpenClawProcessOwnerState;
|
||||
prepared: boolean;
|
||||
runtimePaths: OpenClawRuntimePaths;
|
||||
packageExists: boolean;
|
||||
entryExists: boolean;
|
||||
nodeModulesPath: string;
|
||||
nodeModulesExists: boolean;
|
||||
lastError?: string;
|
||||
}
|
||||
|
||||
@@ -52,6 +57,14 @@ function mergeRuntimePaths(
|
||||
export class OpenClawProcessOwner implements OpenClawProcessOwnerLike {
|
||||
private status: OpenClawProcessOwnerStatus;
|
||||
|
||||
private syncPackageStatus(): void {
|
||||
const packageStatus = getOpenClawPackageStatus(this.status.runtimePaths);
|
||||
this.status.packageExists = packageStatus.packageExists;
|
||||
this.status.entryExists = packageStatus.entryExists;
|
||||
this.status.nodeModulesPath = packageStatus.nodeModulesDir;
|
||||
this.status.nodeModulesExists = packageStatus.nodeModulesExists;
|
||||
}
|
||||
|
||||
constructor(options?: OpenClawProcessOwnerOptions) {
|
||||
const runtimePaths = mergeRuntimePaths(
|
||||
getOpenClawRuntimePaths(),
|
||||
@@ -62,7 +75,13 @@ export class OpenClawProcessOwner implements OpenClawProcessOwnerLike {
|
||||
state: 'idle',
|
||||
prepared: false,
|
||||
runtimePaths,
|
||||
packageExists: false,
|
||||
entryExists: false,
|
||||
nodeModulesPath: '',
|
||||
nodeModulesExists: false,
|
||||
};
|
||||
|
||||
this.syncPackageStatus();
|
||||
}
|
||||
|
||||
async prepare(): Promise<void> {
|
||||
@@ -73,6 +92,10 @@ export class OpenClawProcessOwner implements OpenClawProcessOwnerLike {
|
||||
this.status.state = 'preparing';
|
||||
ensureOpenClawRuntimeLayout(this.status.runtimePaths);
|
||||
this.status.prepared = true;
|
||||
this.syncPackageStatus();
|
||||
this.status.lastError = this.status.entryExists
|
||||
? undefined
|
||||
: `OpenClaw entry not found at ${this.status.runtimePaths.entryPath}`;
|
||||
this.status.state = 'idle';
|
||||
}
|
||||
|
||||
@@ -82,6 +105,13 @@ export class OpenClawProcessOwner implements OpenClawProcessOwnerLike {
|
||||
}
|
||||
|
||||
await this.prepare();
|
||||
this.syncPackageStatus();
|
||||
if (!this.status.entryExists) {
|
||||
this.status.state = 'failed';
|
||||
throw new Error(this.status.lastError || `OpenClaw entry not found at ${this.status.runtimePaths.entryPath}`);
|
||||
}
|
||||
|
||||
this.status.lastError = undefined;
|
||||
this.status.state = 'running';
|
||||
}
|
||||
|
||||
@@ -100,6 +130,8 @@ export class OpenClawProcessOwner implements OpenClawProcessOwnerLike {
|
||||
}
|
||||
|
||||
getStatus(): OpenClawProcessOwnerStatus {
|
||||
this.syncPackageStatus();
|
||||
|
||||
return {
|
||||
...this.status,
|
||||
runtimePaths: { ...this.status.runtimePaths },
|
||||
|
||||
Reference in New Issue
Block a user