@nextclaw/kernel 0.1.1 → 0.1.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 CHANGED
@@ -1,3 +1,4 @@
1
+ import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateSnapshot, f as UpdateStatus, i as UpdateManifestReader, l as UpdatePreferences, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateProgress } from "./update-manifest.types-BAJqcsP5.js";
1
2
  import { NcpMessage } from "@nextclaw/ncp";
2
3
 
3
4
  //#region src/types/entity-ids.types.d.ts
@@ -283,4 +284,4 @@ declare class NextclawKernel<TGatewayInput = unknown, TUiInput = unknown, TStart
283
284
  readonly run: (input: NextclawKernelRunInput) => NextclawKernelRun;
284
285
  }
285
286
  //#endregion
286
- export { AgentId, AgentManager, AgentRecord, AutomationId, AutomationManager, AutomationRecord, AutomationTrigger, ChannelDirection, ChannelId, ChannelManager, ChannelRecord, ContextBuilder, ContextRecord, LlmProviderId, LlmProviderManager, LlmProviderRecord, NextclawKernel, NextclawKernelRun, NextclawKernelRunInput, NextclawKernelRunMetadata, SessionId, SessionManager, SessionMessage, SessionRecord, SkillId, SkillManager, SkillRecord, TaskId, TaskManager, TaskRecord, TaskStatus, ToolId, ToolManager, ToolRecord };
287
+ export { AgentId, AgentManager, AgentRecord, AutomationId, AutomationManager, AutomationRecord, AutomationTrigger, ChannelDirection, ChannelId, ChannelManager, ChannelRecord, ContextBuilder, ContextRecord, InstallationKind, LlmProviderId, LlmProviderManager, LlmProviderRecord, NextclawKernel, NextclawKernelRun, NextclawKernelRunInput, NextclawKernelRunMetadata, SessionId, SessionManager, SessionMessage, SessionRecord, SkillId, SkillManager, SkillRecord, TaskId, TaskManager, TaskRecord, TaskStatus, ToolId, ToolManager, ToolRecord, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
package/dist/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ import { n as getUnsignedUpdateManifest, r as serializeUnsignedUpdateManifest, t as UpdateManifestReader } from "./update-manifest.types-C0qPrjGQ.js";
1
2
  //#region src/managers/agent.manager.ts
2
3
  var AgentManager = class {
3
4
  listAgents = () => {
@@ -248,4 +249,4 @@ var NextclawKernel = class {
248
249
  };
249
250
  };
250
251
  //#endregion
251
- export { AgentManager, AutomationManager, ChannelManager, ContextBuilder, LlmProviderManager, NextclawKernel, SessionManager, SkillManager, TaskManager, ToolManager };
252
+ export { AgentManager, AutomationManager, ChannelManager, ContextBuilder, LlmProviderManager, NextclawKernel, SessionManager, SkillManager, TaskManager, ToolManager, UpdateManifestReader, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
@@ -0,0 +1,2 @@
1
+ import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateSnapshot, f as UpdateStatus, i as UpdateManifestReader, l as UpdatePreferences, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateProgress } from "../update-manifest.types-BAJqcsP5.js";
2
+ export { InstallationKind, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdatePreferences, UpdateProgress, UpdateSnapshot, UpdateStatus, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
@@ -0,0 +1,2 @@
1
+ import { n as getUnsignedUpdateManifest, r as serializeUnsignedUpdateManifest, t as UpdateManifestReader } from "../update-manifest.types-C0qPrjGQ.js";
2
+ export { UpdateManifestReader, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
@@ -0,0 +1,59 @@
1
+ //#region src/types/update.types.d.ts
2
+ type UpdateStatus = "idle" | "checking" | "update-available" | "downloading" | "downloaded" | "applying" | "restart-required" | "up-to-date" | "blocked" | "failed";
3
+ type InstallationKind = "desktop-bundle" | "npm-runtime-bundle" | "npm-global" | "unknown";
4
+ type UpdateBlockReason = "host-too-old" | "unsupported-installation" | "signature-verification-unavailable";
5
+ type UpdateProgress = {
6
+ downloadedBytes: number;
7
+ totalBytes: number | null;
8
+ percent: number | null;
9
+ };
10
+ type UpdatePreferences = {
11
+ automaticChecks: boolean;
12
+ autoDownload: boolean;
13
+ };
14
+ type UpdateSnapshot = {
15
+ status: UpdateStatus;
16
+ installationKind: InstallationKind;
17
+ channel: "stable" | "beta";
18
+ hostVersion: string | null;
19
+ currentVersion: string | null;
20
+ availableVersion: string | null;
21
+ downloadedVersion: string | null;
22
+ minimumHostVersion: string | null;
23
+ releaseNotesUrl: string | null;
24
+ lastCheckedAt: string | null;
25
+ progress: UpdateProgress | null;
26
+ canAutoDownload: boolean;
27
+ canApplyInApp: boolean;
28
+ requiresRestart: boolean;
29
+ blockReason: UpdateBlockReason | null;
30
+ recoveryCommand: string | null;
31
+ errorMessage: string | null;
32
+ preferences: UpdatePreferences;
33
+ };
34
+ //#endregion
35
+ //#region src/types/update-manifest.types.d.ts
36
+ type UpdateHostKind = "desktop-bundle" | "npm-runtime-bundle";
37
+ type UnsignedUpdateManifest = {
38
+ channel: string;
39
+ platform: string;
40
+ arch: string;
41
+ hostKind?: UpdateHostKind;
42
+ latestVersion: string;
43
+ minimumLauncherVersion: string;
44
+ bundleUrl: string;
45
+ bundleSha256: string;
46
+ bundleSignature: string;
47
+ releaseNotesUrl: string | null;
48
+ };
49
+ type UpdateManifest = UnsignedUpdateManifest & {
50
+ manifestSignature: string;
51
+ };
52
+ declare function getUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): UnsignedUpdateManifest;
53
+ declare function serializeUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): string;
54
+ declare class UpdateManifestReader {
55
+ parse: (input: unknown, context?: string) => UpdateManifest;
56
+ private readHostKind;
57
+ }
58
+ //#endregion
59
+ export { getUnsignedUpdateManifest as a, UpdateBlockReason as c, UpdateSnapshot as d, UpdateStatus as f, UpdateManifestReader as i, UpdatePreferences as l, UpdateHostKind as n, serializeUnsignedUpdateManifest as o, UpdateManifest as r, InstallationKind as s, UnsignedUpdateManifest as t, UpdateProgress as u };
@@ -0,0 +1,50 @@
1
+ //#region src/types/update-manifest.types.ts
2
+ function readRequiredString(record, key, context) {
3
+ const value = record[key];
4
+ if (typeof value !== "string" || !value.trim()) throw new Error(`${context} missing required string field: ${key}`);
5
+ return value.trim();
6
+ }
7
+ function getUnsignedUpdateManifest(manifest) {
8
+ return {
9
+ channel: manifest.channel,
10
+ platform: manifest.platform,
11
+ arch: manifest.arch,
12
+ hostKind: manifest.hostKind,
13
+ latestVersion: manifest.latestVersion,
14
+ minimumLauncherVersion: manifest.minimumLauncherVersion,
15
+ bundleUrl: manifest.bundleUrl,
16
+ bundleSha256: manifest.bundleSha256,
17
+ bundleSignature: manifest.bundleSignature,
18
+ releaseNotesUrl: manifest.releaseNotesUrl
19
+ };
20
+ }
21
+ function serializeUnsignedUpdateManifest(manifest) {
22
+ return JSON.stringify(getUnsignedUpdateManifest(manifest));
23
+ }
24
+ var UpdateManifestReader = class {
25
+ parse = (input, context = "update manifest") => {
26
+ if (!input || typeof input !== "object" || Array.isArray(input)) throw new Error(`${context} must be an object`);
27
+ const record = input;
28
+ const hostKind = typeof record.hostKind === "string" && record.hostKind.trim() ? this.readHostKind(record.hostKind.trim(), context) : void 0;
29
+ const releaseNotesUrl = typeof record.releaseNotesUrl === "string" && record.releaseNotesUrl.trim() ? record.releaseNotesUrl.trim() : null;
30
+ return {
31
+ channel: readRequiredString(record, "channel", context),
32
+ platform: readRequiredString(record, "platform", context),
33
+ arch: readRequiredString(record, "arch", context),
34
+ hostKind,
35
+ latestVersion: readRequiredString(record, "latestVersion", context),
36
+ minimumLauncherVersion: readRequiredString(record, "minimumLauncherVersion", context),
37
+ bundleUrl: readRequiredString(record, "bundleUrl", context),
38
+ bundleSha256: readRequiredString(record, "bundleSha256", context).toLowerCase(),
39
+ bundleSignature: readRequiredString(record, "bundleSignature", context),
40
+ releaseNotesUrl,
41
+ manifestSignature: readRequiredString(record, "manifestSignature", context)
42
+ };
43
+ };
44
+ readHostKind = (value, context) => {
45
+ if (value === "desktop-bundle" || value === "npm-runtime-bundle") return value;
46
+ throw new Error(`${context} has unsupported hostKind: ${value}`);
47
+ };
48
+ };
49
+ //#endregion
50
+ export { getUnsignedUpdateManifest as n, serializeUnsignedUpdateManifest as r, UpdateManifestReader as t };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nextclaw/kernel",
3
- "version": "0.1.1",
3
+ "version": "0.1.2-beta.0",
4
4
  "private": false,
5
5
  "description": "NextClaw product kernel skeleton for agents, tasks, sessions, context, tools, skills, providers, automation, and channels.",
6
6
  "type": "module",
@@ -9,6 +9,11 @@
9
9
  "development": "./src/index.ts",
10
10
  "types": "./dist/index.d.ts",
11
11
  "default": "./dist/index.js"
12
+ },
13
+ "./update-contract": {
14
+ "development": "./src/types/update-contract.types.ts",
15
+ "types": "./dist/types/update-contract.types.d.ts",
16
+ "default": "./dist/types/update-contract.types.js"
12
17
  }
13
18
  },
14
19
  "files": [
@@ -23,7 +28,7 @@
23
28
  "typescript": "^5.6.3"
24
29
  },
25
30
  "scripts": {
26
- "build": "tsdown src/index.ts --dts --clean --target es2022 --no-fixedExtension",
31
+ "build": "tsdown src/index.ts src/types/update-contract.types.ts --dts --clean --target es2022 --no-fixedExtension",
27
32
  "lint": "eslint .",
28
33
  "tsc": "tsc -p tsconfig.json"
29
34
  }