@nextclaw/kernel 0.19.0 → 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.
Files changed (62) hide show
  1. package/dist/agent-model-input-budget.utils-tw9zs9WM.js +26 -0
  2. package/dist/agent-model-input-budget.utils-tw9zs9WM.js.map +1 -0
  3. package/dist/agent-run-context-compaction.manager-BV6tB0wL.d.ts +28 -0
  4. package/dist/agent-run-context-compaction.manager-BV6tB0wL.d.ts.map +1 -0
  5. package/dist/agent-run-model-input-builder.service-C3ydUx3d.js +320 -0
  6. package/dist/agent-run-model-input-builder.service-C3ydUx3d.js.map +1 -0
  7. package/dist/agent-run.types-CNVBBJnd.d.ts +71 -0
  8. package/dist/agent-run.types-CNVBBJnd.d.ts.map +1 -0
  9. package/dist/context-compaction-preflight.service-ClJEGWKS.d.ts +97 -0
  10. package/dist/context-compaction-preflight.service-ClJEGWKS.d.ts.map +1 -0
  11. package/dist/context-compaction-preflight.service-K0tE34Oz.js +689 -0
  12. package/dist/context-compaction-preflight.service-K0tE34Oz.js.map +1 -0
  13. package/dist/context-compaction.utils-Csf80mdq.d.ts +42 -0
  14. package/dist/context-compaction.utils-Csf80mdq.d.ts.map +1 -0
  15. package/dist/features/context-compaction/services/context-compaction-preflight.service.d.ts +2 -0
  16. package/dist/features/context-compaction/services/context-compaction-preflight.service.js +2 -0
  17. package/dist/features/context-compaction/utils/context-compaction.utils.d.ts +2 -0
  18. package/dist/features/context-compaction/utils/context-compaction.utils.js +202 -0
  19. package/dist/features/context-compaction/utils/context-compaction.utils.js.map +1 -0
  20. package/dist/index.d.ts +136 -1247
  21. package/dist/index.d.ts.map +1 -1
  22. package/dist/index.js +770 -1837
  23. package/dist/index.js.map +1 -1
  24. package/dist/managers/agent-run-context-compaction.manager.d.ts +2 -0
  25. package/dist/managers/agent-run-context-compaction.manager.js +68 -0
  26. package/dist/managers/agent-run-context-compaction.manager.js.map +1 -0
  27. package/dist/request-context-tail.manager-DXC4rdAP.d.ts +22 -0
  28. package/dist/request-context-tail.manager-DXC4rdAP.d.ts.map +1 -0
  29. package/dist/services/agent-run-model-input-builder.service.d.ts +58 -0
  30. package/dist/services/agent-run-model-input-builder.service.d.ts.map +1 -0
  31. package/dist/services/agent-run-model-input-builder.service.js +2 -0
  32. package/dist/tool-schema.tools-CtZEKWeY.js +75 -0
  33. package/dist/tool-schema.tools-CtZEKWeY.js.map +1 -0
  34. package/dist/tools/show-content.tools.d.ts +10 -0
  35. package/dist/tools/show-content.tools.d.ts.map +1 -0
  36. package/dist/tools/show-content.tools.js +294 -0
  37. package/dist/tools/show-content.tools.js.map +1 -0
  38. package/dist/tools/tool-schema.tools.d.ts +29 -0
  39. package/dist/tools/tool-schema.tools.d.ts.map +1 -0
  40. package/dist/tools/tool-schema.tools.js +2 -0
  41. package/dist/tools/user-question.tools.d.ts +63 -0
  42. package/dist/tools/user-question.tools.d.ts.map +1 -0
  43. package/dist/tools/user-question.tools.js +77 -0
  44. package/dist/tools/user-question.tools.js.map +1 -0
  45. package/dist/types/update-contract.types.d.ts +1 -1
  46. package/dist/types/update-contract.types.js +1 -1
  47. package/dist/{update-manifest.types-CQpbURTE.d.ts → update-manifest.types-Dl4B87Pa.d.ts} +1 -1
  48. package/dist/{update-manifest.types-CQpbURTE.d.ts.map → update-manifest.types-Dl4B87Pa.d.ts.map} +1 -1
  49. package/dist/{update-manifest.types-C0qPrjGQ.js → update-manifest.types-eSil_QH0.js} +1 -1
  50. package/dist/{update-manifest.types-C0qPrjGQ.js.map → update-manifest.types-eSil_QH0.js.map} +1 -1
  51. package/dist/user-question.manager-38KBgZCg.d.ts +1038 -0
  52. package/dist/user-question.manager-38KBgZCg.d.ts.map +1 -0
  53. package/dist/user-question.utils-DWVtPv4S.d.ts +27 -0
  54. package/dist/user-question.utils-DWVtPv4S.d.ts.map +1 -0
  55. package/dist/utils/agent-onboarding-context.utils.d.ts +6 -0
  56. package/dist/utils/agent-onboarding-context.utils.d.ts.map +1 -0
  57. package/dist/utils/agent-onboarding-context.utils.js +39 -0
  58. package/dist/utils/agent-onboarding-context.utils.js.map +1 -0
  59. package/dist/utils/user-question.utils.d.ts +2 -0
  60. package/dist/utils/user-question.utils.js +105 -0
  61. package/dist/utils/user-question.utils.js.map +1 -0
  62. package/package.json +61 -16
@@ -0,0 +1,63 @@
1
+ import { n as UserQuestionManager } from "../user-question.manager-38KBgZCg.js";
2
+ import { n as UserQuestionPrompt } from "../user-question.utils-DWVtPv4S.js";
3
+ import { NcpTool } from "@nextclaw/ncp";
4
+
5
+ //#region src/tools/user-question.tools.d.ts
6
+ declare class RequestUserInputAsyncTool implements NcpTool {
7
+ private readonly questions;
8
+ private readonly sessionId;
9
+ readonly name = "request_user_input_async";
10
+ readonly description = "Ask the user one to three self-contained questions without pausing this run. Prefer short suggested options when there are clear choices; the user can always enter a custom answer. With suggested options, normally choose one sensible default and set recommendedOption to its exact label; omit it only when recommending a choice would mislead the user. Never append '(recommended)' to an option label. Add optionDescriptions only where a brief explanation helps the user understand a choice or tradeoff. Use a separate question for each decision. The call returns after the questions are saved; continue independent work while waiting. An answer arrives later as user input in this session. Do not treat accepted as an answer or approval.";
11
+ readonly parameters: {
12
+ type: string;
13
+ properties: {
14
+ questions: {
15
+ type: string;
16
+ minItems: number;
17
+ maxItems: number;
18
+ items: {
19
+ type: string;
20
+ properties: {
21
+ title: {
22
+ type: string;
23
+ description: string;
24
+ };
25
+ options: {
26
+ type: string;
27
+ items: {
28
+ type: string;
29
+ };
30
+ description: string;
31
+ };
32
+ recommendedOption: {
33
+ type: string;
34
+ description: string;
35
+ };
36
+ optionDescriptions: {
37
+ type: string;
38
+ additionalProperties: {
39
+ type: string;
40
+ };
41
+ description: string;
42
+ };
43
+ };
44
+ required: string[];
45
+ };
46
+ };
47
+ };
48
+ required: string[];
49
+ };
50
+ constructor(questions: Pick<UserQuestionManager, "ask">, sessionId: string);
51
+ execute: (args: unknown) => Promise<{
52
+ accepted: true;
53
+ questionIds: string[];
54
+ }>;
55
+ }
56
+ /** Host-neutral form of the same question tool for runtimes without Node schema compilation. */
57
+ declare function createPortableRequestUserInputAsyncTool(ask: (prompts: readonly UserQuestionPrompt[]) => Promise<{
58
+ accepted: true;
59
+ questionIds: string[];
60
+ }>): NcpTool;
61
+ //#endregion
62
+ export { RequestUserInputAsyncTool, createPortableRequestUserInputAsyncTool };
63
+ //# sourceMappingURL=user-question.tools.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-question.tools.d.ts","names":[],"sources":["../../src/tools/user-question.tools.ts"],"mappings":";;;;;cAIa,yBAAA,YAAqC,OAAA;EAAA,iBAiCnB,SAAA;EAAA,iBAA8D,SAAA;EAAA,SAhClF,IAAA;EAAA,SACA,WAAA;EAAA,SACA,UAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cA8BoB,SAAA,EAAW,IAAA,CAAK,mBAAA,UAA8C,SAAA;EAE3F,OAAA,GAAiB,IAAA,cAAgB,OAAA;IAAU,QAAA;IAAgB,WAAA;EAAA;AAAA;;iBA0B7C,uCAAA,CACd,GAAA,GAAM,OAAA,WAAkB,kBAAA,OAAyB,OAAA;EAAU,QAAA;EAAgB,WAAA;AAAA,KAC1E,OAAA"}
@@ -0,0 +1,77 @@
1
+ import { normalizeToolParams } from "@nextclaw/core/tool-base";
2
+ //#region src/tools/user-question.tools.ts
3
+ var RequestUserInputAsyncTool = class {
4
+ name = "request_user_input_async";
5
+ description = "Ask the user one to three self-contained questions without pausing this run. Prefer short suggested options when there are clear choices; the user can always enter a custom answer. With suggested options, normally choose one sensible default and set recommendedOption to its exact label; omit it only when recommending a choice would mislead the user. Never append '(recommended)' to an option label. Add optionDescriptions only where a brief explanation helps the user understand a choice or tradeoff. Use a separate question for each decision. The call returns after the questions are saved; continue independent work while waiting. An answer arrives later as user input in this session. Do not treat accepted as an answer or approval.";
6
+ parameters = {
7
+ type: "object",
8
+ properties: { questions: {
9
+ type: "array",
10
+ minItems: 1,
11
+ maxItems: 3,
12
+ items: {
13
+ type: "object",
14
+ properties: {
15
+ title: {
16
+ type: "string",
17
+ description: "A concise, self-contained question for the user."
18
+ },
19
+ options: {
20
+ type: "array",
21
+ items: { type: "string" },
22
+ description: "Optional suggested answers. The user may also write a custom answer."
23
+ },
24
+ recommendedOption: {
25
+ type: "string",
26
+ description: "Recommended default; must exactly match one option label. Usually provide this when options are present."
27
+ },
28
+ optionDescriptions: {
29
+ type: "object",
30
+ additionalProperties: { type: "string" },
31
+ description: "Optional brief explanations keyed by exact option labels. Include only choices that need explanation."
32
+ }
33
+ },
34
+ required: ["title"]
35
+ }
36
+ } },
37
+ required: ["questions"]
38
+ };
39
+ constructor(questions, sessionId) {
40
+ this.questions = questions;
41
+ this.sessionId = sessionId;
42
+ }
43
+ execute = async (args) => {
44
+ const params = normalizeToolParams(args);
45
+ if (!Array.isArray(params.questions)) throw new Error("questions must be an array.");
46
+ const prompts = params.questions.map((value) => {
47
+ if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error("Each question must be an object.");
48
+ const prompt = value;
49
+ if (typeof prompt.title !== "string") throw new Error("Question title must be a string.");
50
+ if (prompt.options !== void 0 && (!Array.isArray(prompt.options) || !prompt.options.every((option) => typeof option === "string"))) throw new Error("Question options must be strings.");
51
+ if (prompt.recommendedOption !== void 0 && typeof prompt.recommendedOption !== "string") throw new Error("Recommended option must be a string.");
52
+ if (prompt.optionDescriptions !== void 0 && (!prompt.optionDescriptions || typeof prompt.optionDescriptions !== "object" || Array.isArray(prompt.optionDescriptions) || Object.values(prompt.optionDescriptions).some((description) => typeof description !== "string"))) throw new Error("Option descriptions must map option labels to strings.");
53
+ return {
54
+ title: prompt.title,
55
+ ...prompt.options ? { options: prompt.options } : {},
56
+ ...prompt.recommendedOption !== void 0 ? { recommendedOption: prompt.recommendedOption } : {},
57
+ ...prompt.optionDescriptions !== void 0 ? { optionDescriptions: prompt.optionDescriptions } : {}
58
+ };
59
+ });
60
+ return await this.questions.ask(this.sessionId, prompts);
61
+ };
62
+ };
63
+ /** Host-neutral form of the same question tool for runtimes without Node schema compilation. */
64
+ function createPortableRequestUserInputAsyncTool(ask) {
65
+ const native = new RequestUserInputAsyncTool({ ask: async (_sessionId, prompts) => ask(prompts) }, "");
66
+ return {
67
+ name: native.name,
68
+ description: native.description,
69
+ modelParameters: native.parameters,
70
+ validateArgs: (value) => value && typeof value === "object" && !Array.isArray(value) && Array.isArray(value.questions) ? [] : ["questions must be an array"],
71
+ execute: native.execute
72
+ };
73
+ }
74
+ //#endregion
75
+ export { RequestUserInputAsyncTool, createPortableRequestUserInputAsyncTool };
76
+
77
+ //# sourceMappingURL=user-question.tools.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-question.tools.js","names":[],"sources":["../../src/tools/user-question.tools.ts"],"sourcesContent":["import { normalizeToolParams } from \"@nextclaw/core/tool-base\";\nimport type { NcpTool } from \"@nextclaw/ncp\";\nimport type { UserQuestionManager, UserQuestionPrompt } from \"@kernel/managers/user-question.manager.js\";\n\nexport class RequestUserInputAsyncTool implements NcpTool {\n readonly name = \"request_user_input_async\";\n readonly description = \"Ask the user one to three self-contained questions without pausing this run. Prefer short suggested options when there are clear choices; the user can always enter a custom answer. With suggested options, normally choose one sensible default and set recommendedOption to its exact label; omit it only when recommending a choice would mislead the user. Never append '(recommended)' to an option label. Add optionDescriptions only where a brief explanation helps the user understand a choice or tradeoff. Use a separate question for each decision. The call returns after the questions are saved; continue independent work while waiting. An answer arrives later as user input in this session. Do not treat accepted as an answer or approval.\";\n readonly parameters = {\n type: \"object\",\n properties: {\n questions: {\n type: \"array\",\n minItems: 1,\n maxItems: 3,\n items: {\n type: \"object\",\n properties: {\n title: { type: \"string\", description: \"A concise, self-contained question for the user.\" },\n options: {\n type: \"array\",\n items: { type: \"string\" },\n description: \"Optional suggested answers. The user may also write a custom answer.\",\n },\n recommendedOption: { type: \"string\", description: \"Recommended default; must exactly match one option label. Usually provide this when options are present.\" },\n optionDescriptions: {\n type: \"object\",\n additionalProperties: { type: \"string\" },\n description: \"Optional brief explanations keyed by exact option labels. Include only choices that need explanation.\",\n },\n },\n required: [\"title\"],\n },\n },\n },\n required: [\"questions\"],\n };\n\n constructor(private readonly questions: Pick<UserQuestionManager, \"ask\">, private readonly sessionId: string) {}\n\n execute = async (args: unknown): Promise<{ accepted: true; questionIds: string[] }> => {\n const params = normalizeToolParams(args);\n if (!Array.isArray(params.questions)) throw new Error(\"questions must be an array.\");\n const prompts: UserQuestionPrompt[] = params.questions.map((value) => {\n if (!value || typeof value !== \"object\" || Array.isArray(value)) throw new Error(\"Each question must be an object.\");\n const prompt = value as Record<string, unknown>;\n if (typeof prompt.title !== \"string\") throw new Error(\"Question title must be a string.\");\n if (prompt.options !== undefined && (!Array.isArray(prompt.options) || !prompt.options.every((option) => typeof option === \"string\"))) {\n throw new Error(\"Question options must be strings.\");\n }\n if (prompt.recommendedOption !== undefined && typeof prompt.recommendedOption !== \"string\") {\n throw new Error(\"Recommended option must be a string.\");\n }\n if (prompt.optionDescriptions !== undefined && (!prompt.optionDescriptions || typeof prompt.optionDescriptions !== \"object\" ||\n Array.isArray(prompt.optionDescriptions) || Object.values(prompt.optionDescriptions).some((description) => typeof description !== \"string\"))) {\n throw new Error(\"Option descriptions must map option labels to strings.\");\n }\n return { title: prompt.title, ...(prompt.options ? { options: prompt.options as string[] } : {}),\n ...(prompt.recommendedOption !== undefined ? { recommendedOption: prompt.recommendedOption } : {}),\n ...(prompt.optionDescriptions !== undefined ? { optionDescriptions: prompt.optionDescriptions as Record<string, string> } : {}) };\n });\n return await this.questions.ask(this.sessionId, prompts);\n };\n}\n\n/** Host-neutral form of the same question tool for runtimes without Node schema compilation. */\nexport function createPortableRequestUserInputAsyncTool(\n ask: (prompts: readonly UserQuestionPrompt[]) => Promise<{ accepted: true; questionIds: string[] }>,\n): NcpTool {\n const native = new RequestUserInputAsyncTool({ ask: async (_sessionId, prompts) => ask(prompts) }, \"\");\n return {\n name: native.name, description: native.description, modelParameters: native.parameters,\n validateArgs: (value) => value && typeof value === \"object\" && !Array.isArray(value) &&\n Array.isArray((value as { questions?: unknown }).questions) ? [] : [\"questions must be an array\"],\n execute: native.execute,\n };\n}\n"],"mappings":";;AAIA,IAAa,4BAAb,MAA0D;CACxD,OAAgB;CAChB,cAAuB;CACvB,aAAsB;EACpB,MAAM;EACN,YAAY,EACV,WAAW;GACT,MAAM;GACN,UAAU;GACV,UAAU;GACV,OAAO;IACL,MAAM;IACN,YAAY;KACV,OAAO;MAAE,MAAM;MAAU,aAAa;MAAoD;KAC1F,SAAS;MACP,MAAM;MACN,OAAO,EAAE,MAAM,UAAU;MACzB,aAAa;MACd;KACD,mBAAmB;MAAE,MAAM;MAAU,aAAa;MAA4G;KAC9J,oBAAoB;MAClB,MAAM;MACN,sBAAsB,EAAE,MAAM,UAAU;MACxC,aAAa;MACd;KACF;IACD,UAAU,CAAC,QAAQ;IACpB;GACF,EACF;EACD,UAAU,CAAC,YAAY;EACxB;CAED,YAAY,WAA8D,WAAoC;AAAjF,OAAA,YAAA;AAA8D,OAAA,YAAA;;CAE3F,UAAU,OAAO,SAAsE;EACrF,MAAM,SAAS,oBAAoB,KAAK;AACxC,MAAI,CAAC,MAAM,QAAQ,OAAO,UAAU,CAAE,OAAM,IAAI,MAAM,8BAA8B;EACpF,MAAM,UAAgC,OAAO,UAAU,KAAK,UAAU;AACpE,OAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAAE,OAAM,IAAI,MAAM,mCAAmC;GACpH,MAAM,SAAS;AACf,OAAI,OAAO,OAAO,UAAU,SAAU,OAAM,IAAI,MAAM,mCAAmC;AACzF,OAAI,OAAO,YAAY,KAAA,MAAc,CAAC,MAAM,QAAQ,OAAO,QAAQ,IAAI,CAAC,OAAO,QAAQ,OAAO,WAAW,OAAO,WAAW,SAAS,EAClI,OAAM,IAAI,MAAM,oCAAoC;AAEtD,OAAI,OAAO,sBAAsB,KAAA,KAAa,OAAO,OAAO,sBAAsB,SAChF,OAAM,IAAI,MAAM,uCAAuC;AAEzD,OAAI,OAAO,uBAAuB,KAAA,MAAc,CAAC,OAAO,sBAAsB,OAAO,OAAO,uBAAuB,YACjH,MAAM,QAAQ,OAAO,mBAAmB,IAAI,OAAO,OAAO,OAAO,mBAAmB,CAAC,MAAM,gBAAgB,OAAO,gBAAgB,SAAS,EAC3I,OAAM,IAAI,MAAM,yDAAyD;AAE3E,UAAO;IAAE,OAAO,OAAO;IAAO,GAAI,OAAO,UAAU,EAAE,SAAS,OAAO,SAAqB,GAAG,EAAE;IAC7F,GAAI,OAAO,sBAAsB,KAAA,IAAY,EAAE,mBAAmB,OAAO,mBAAmB,GAAG,EAAE;IACjG,GAAI,OAAO,uBAAuB,KAAA,IAAY,EAAE,oBAAoB,OAAO,oBAA8C,GAAG,EAAE;IAAG;IACnI;AACF,SAAO,MAAM,KAAK,UAAU,IAAI,KAAK,WAAW,QAAQ;;;;AAK5D,SAAgB,wCACd,KACS;CACT,MAAM,SAAS,IAAI,0BAA0B,EAAE,KAAK,OAAO,YAAY,YAAY,IAAI,QAAQ,EAAE,EAAE,GAAG;AACtG,QAAO;EACL,MAAM,OAAO;EAAM,aAAa,OAAO;EAAa,iBAAiB,OAAO;EAC5E,eAAe,UAAU,SAAS,OAAO,UAAU,YAAY,CAAC,MAAM,QAAQ,MAAM,IAClF,MAAM,QAAS,MAAkC,UAAU,GAAG,EAAE,GAAG,CAAC,6BAA6B;EACnG,SAAS,OAAO;EACjB"}
@@ -1,2 +1,2 @@
1
- import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateStatus, i as UpdateManifestReader, l as UpdateProgress, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateSnapshot } from "../update-manifest.types-CQpbURTE.js";
1
+ import { a as getUnsignedUpdateManifest, c as UpdateBlockReason, d as UpdateStatus, i as UpdateManifestReader, l as UpdateProgress, n as UpdateHostKind, o as serializeUnsignedUpdateManifest, r as UpdateManifest, s as InstallationKind, t as UnsignedUpdateManifest, u as UpdateSnapshot } from "../update-manifest.types-Dl4B87Pa.js";
2
2
  export { InstallationKind, UnsignedUpdateManifest, UpdateBlockReason, UpdateHostKind, UpdateManifest, UpdateManifestReader, UpdateProgress, UpdateSnapshot, UpdateStatus, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
@@ -1,2 +1,2 @@
1
- import { n as getUnsignedUpdateManifest, r as serializeUnsignedUpdateManifest, t as UpdateManifestReader } from "../update-manifest.types-C0qPrjGQ.js";
1
+ import { n as getUnsignedUpdateManifest, r as serializeUnsignedUpdateManifest, t as UpdateManifestReader } from "../update-manifest.types-eSil_QH0.js";
2
2
  export { UpdateManifestReader, getUnsignedUpdateManifest, serializeUnsignedUpdateManifest };
@@ -25,4 +25,4 @@ declare class UpdateManifestReader {
25
25
  }
26
26
  //#endregion
27
27
  export { getUnsignedUpdateManifest as a, UpdateBlockReason as c, UpdateStatus as d, UpdateManifestReader as i, UpdateProgress as l, UpdateHostKind as n, serializeUnsignedUpdateManifest as o, UpdateManifest as r, InstallationKind as s, UnsignedUpdateManifest as t, UpdateSnapshot as u };
28
- //# sourceMappingURL=update-manifest.types-CQpbURTE.d.ts.map
28
+ //# sourceMappingURL=update-manifest.types-Dl4B87Pa.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-manifest.types-CQpbURTE.d.ts","names":[],"sources":["../src/types/update-manifest.types.ts"],"mappings":";;;KAAY,cAAA;AAAA,KAEA,sBAAA;EACV,OAAA;EACA,QAAA;EACA,IAAA;EACA,QAAA,GAAW,cAAA;EACX,aAAA;EACA,sBAAA;EACA,SAAA;EACA,YAAA;EACA,eAAA;EACA,eAAA;AAAA;AAAA,KAGU,cAAA,GAAiB,sBAAA;EAC3B,iBAAA;AAAA;AAAA,iBAWc,yBAAA,CAA0B,QAAA,EAAU,cAAA,GAAiB,sBAAA,GAAyB,sBAAA;AAAA,iBAe9E,+BAAA,CAAgC,QAAA,EAAU,cAAA,GAAiB,sBAAA;AAAA,cAI9D,oBAAA;EACX,KAAA,GAAS,KAAA,WAAgB,OAAA,cAA8B,cAAA;EAAA,QA0B/C,YAAA;AAAA"}
1
+ {"version":3,"file":"update-manifest.types-Dl4B87Pa.d.ts","names":[],"sources":["../src/types/update-manifest.types.ts"],"mappings":";;;KAAY,cAAA;AAAA,KAEA,sBAAA;EACV,OAAA;EACA,QAAA;EACA,IAAA;EACA,QAAA,GAAW,cAAA;EACX,aAAA;EACA,sBAAA;EACA,SAAA;EACA,YAAA;EACA,eAAA;EACA,eAAA;AAAA;AAAA,KAGU,cAAA,GAAiB,sBAAA;EAC3B,iBAAA;AAAA;AAAA,iBAWc,yBAAA,CAA0B,QAAA,EAAU,cAAA,GAAiB,sBAAA,GAAyB,sBAAA;AAAA,iBAe9E,+BAAA,CAAgC,QAAA,EAAU,cAAA,GAAiB,sBAAA;AAAA,cAI9D,oBAAA;EACX,KAAA,GAAS,KAAA,WAAgB,OAAA,cAA8B,cAAA;EAAA,QA0B/C,YAAA;AAAA"}
@@ -49,4 +49,4 @@ var UpdateManifestReader = class {
49
49
  //#endregion
50
50
  export { getUnsignedUpdateManifest as n, serializeUnsignedUpdateManifest as r, UpdateManifestReader as t };
51
51
 
52
- //# sourceMappingURL=update-manifest.types-C0qPrjGQ.js.map
52
+ //# sourceMappingURL=update-manifest.types-eSil_QH0.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update-manifest.types-C0qPrjGQ.js","names":[],"sources":["../src/types/update-manifest.types.ts"],"sourcesContent":["export type UpdateHostKind = \"desktop-bundle\" | \"npm-runtime-bundle\";\n\nexport type UnsignedUpdateManifest = {\n channel: string;\n platform: string;\n arch: string;\n hostKind?: UpdateHostKind;\n latestVersion: string;\n minimumLauncherVersion: string;\n bundleUrl: string;\n bundleSha256: string;\n bundleSignature: string;\n releaseNotesUrl: string | null;\n};\n\nexport type UpdateManifest = UnsignedUpdateManifest & {\n manifestSignature: string;\n};\n\nfunction readRequiredString(record: Record<string, unknown>, key: string, context: string): string {\n const value = record[key];\n if (typeof value !== \"string\" || !value.trim()) {\n throw new Error(`${context} missing required string field: ${key}`);\n }\n return value.trim();\n}\n\nexport function getUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): UnsignedUpdateManifest {\n return {\n channel: manifest.channel,\n platform: manifest.platform,\n arch: manifest.arch,\n hostKind: manifest.hostKind,\n latestVersion: manifest.latestVersion,\n minimumLauncherVersion: manifest.minimumLauncherVersion,\n bundleUrl: manifest.bundleUrl,\n bundleSha256: manifest.bundleSha256,\n bundleSignature: manifest.bundleSignature,\n releaseNotesUrl: manifest.releaseNotesUrl\n };\n}\n\nexport function serializeUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): string {\n return JSON.stringify(getUnsignedUpdateManifest(manifest));\n}\n\nexport class UpdateManifestReader {\n parse = (input: unknown, context = \"update manifest\"): UpdateManifest => {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(`${context} must be an object`);\n }\n const record = input as Record<string, unknown>;\n const hostKind = typeof record.hostKind === \"string\" && record.hostKind.trim()\n ? this.readHostKind(record.hostKind.trim(), context)\n : undefined;\n const releaseNotesUrl =\n typeof record.releaseNotesUrl === \"string\" && record.releaseNotesUrl.trim() ? record.releaseNotesUrl.trim() : null;\n\n return {\n channel: readRequiredString(record, \"channel\", context),\n platform: readRequiredString(record, \"platform\", context),\n arch: readRequiredString(record, \"arch\", context),\n hostKind,\n latestVersion: readRequiredString(record, \"latestVersion\", context),\n minimumLauncherVersion: readRequiredString(record, \"minimumLauncherVersion\", context),\n bundleUrl: readRequiredString(record, \"bundleUrl\", context),\n bundleSha256: readRequiredString(record, \"bundleSha256\", context).toLowerCase(),\n bundleSignature: readRequiredString(record, \"bundleSignature\", context),\n releaseNotesUrl,\n manifestSignature: readRequiredString(record, \"manifestSignature\", context)\n };\n };\n\n private readHostKind = (value: string, context: string): UpdateHostKind => {\n if (value === \"desktop-bundle\" || value === \"npm-runtime-bundle\") {\n return value;\n }\n throw new Error(`${context} has unsupported hostKind: ${value}`);\n };\n}\n"],"mappings":";AAmBA,SAAS,mBAAmB,QAAiC,KAAa,SAAyB;CACjG,MAAM,QAAQ,OAAO;AACrB,KAAI,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,CAC5C,OAAM,IAAI,MAAM,GAAG,QAAQ,kCAAkC,MAAM;AAErE,QAAO,MAAM,MAAM;;AAGrB,SAAgB,0BAA0B,UAA2E;AACnH,QAAO;EACL,SAAS,SAAS;EAClB,UAAU,SAAS;EACnB,MAAM,SAAS;EACf,UAAU,SAAS;EACnB,eAAe,SAAS;EACxB,wBAAwB,SAAS;EACjC,WAAW,SAAS;EACpB,cAAc,SAAS;EACvB,iBAAiB,SAAS;EAC1B,iBAAiB,SAAS;EAC3B;;AAGH,SAAgB,gCAAgC,UAA2D;AACzG,QAAO,KAAK,UAAU,0BAA0B,SAAS,CAAC;;AAG5D,IAAa,uBAAb,MAAkC;CAChC,SAAS,OAAgB,UAAU,sBAAsC;AACvE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAC7D,OAAM,IAAI,MAAM,GAAG,QAAQ,oBAAoB;EAEjD,MAAM,SAAS;EACf,MAAM,WAAW,OAAO,OAAO,aAAa,YAAY,OAAO,SAAS,MAAM,GAC1E,KAAK,aAAa,OAAO,SAAS,MAAM,EAAE,QAAQ,GAClD,KAAA;EACJ,MAAM,kBACJ,OAAO,OAAO,oBAAoB,YAAY,OAAO,gBAAgB,MAAM,GAAG,OAAO,gBAAgB,MAAM,GAAG;AAEhH,SAAO;GACL,SAAS,mBAAmB,QAAQ,WAAW,QAAQ;GACvD,UAAU,mBAAmB,QAAQ,YAAY,QAAQ;GACzD,MAAM,mBAAmB,QAAQ,QAAQ,QAAQ;GACjD;GACA,eAAe,mBAAmB,QAAQ,iBAAiB,QAAQ;GACnE,wBAAwB,mBAAmB,QAAQ,0BAA0B,QAAQ;GACrF,WAAW,mBAAmB,QAAQ,aAAa,QAAQ;GAC3D,cAAc,mBAAmB,QAAQ,gBAAgB,QAAQ,CAAC,aAAa;GAC/E,iBAAiB,mBAAmB,QAAQ,mBAAmB,QAAQ;GACvE;GACA,mBAAmB,mBAAmB,QAAQ,qBAAqB,QAAQ;GAC5E;;CAGH,gBAAwB,OAAe,YAAoC;AACzE,MAAI,UAAU,oBAAoB,UAAU,qBAC1C,QAAO;AAET,QAAM,IAAI,MAAM,GAAG,QAAQ,6BAA6B,QAAQ"}
1
+ {"version":3,"file":"update-manifest.types-eSil_QH0.js","names":[],"sources":["../src/types/update-manifest.types.ts"],"sourcesContent":["export type UpdateHostKind = \"desktop-bundle\" | \"npm-runtime-bundle\";\n\nexport type UnsignedUpdateManifest = {\n channel: string;\n platform: string;\n arch: string;\n hostKind?: UpdateHostKind;\n latestVersion: string;\n minimumLauncherVersion: string;\n bundleUrl: string;\n bundleSha256: string;\n bundleSignature: string;\n releaseNotesUrl: string | null;\n};\n\nexport type UpdateManifest = UnsignedUpdateManifest & {\n manifestSignature: string;\n};\n\nfunction readRequiredString(record: Record<string, unknown>, key: string, context: string): string {\n const value = record[key];\n if (typeof value !== \"string\" || !value.trim()) {\n throw new Error(`${context} missing required string field: ${key}`);\n }\n return value.trim();\n}\n\nexport function getUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): UnsignedUpdateManifest {\n return {\n channel: manifest.channel,\n platform: manifest.platform,\n arch: manifest.arch,\n hostKind: manifest.hostKind,\n latestVersion: manifest.latestVersion,\n minimumLauncherVersion: manifest.minimumLauncherVersion,\n bundleUrl: manifest.bundleUrl,\n bundleSha256: manifest.bundleSha256,\n bundleSignature: manifest.bundleSignature,\n releaseNotesUrl: manifest.releaseNotesUrl\n };\n}\n\nexport function serializeUnsignedUpdateManifest(manifest: UpdateManifest | UnsignedUpdateManifest): string {\n return JSON.stringify(getUnsignedUpdateManifest(manifest));\n}\n\nexport class UpdateManifestReader {\n parse = (input: unknown, context = \"update manifest\"): UpdateManifest => {\n if (!input || typeof input !== \"object\" || Array.isArray(input)) {\n throw new Error(`${context} must be an object`);\n }\n const record = input as Record<string, unknown>;\n const hostKind = typeof record.hostKind === \"string\" && record.hostKind.trim()\n ? this.readHostKind(record.hostKind.trim(), context)\n : undefined;\n const releaseNotesUrl =\n typeof record.releaseNotesUrl === \"string\" && record.releaseNotesUrl.trim() ? record.releaseNotesUrl.trim() : null;\n\n return {\n channel: readRequiredString(record, \"channel\", context),\n platform: readRequiredString(record, \"platform\", context),\n arch: readRequiredString(record, \"arch\", context),\n hostKind,\n latestVersion: readRequiredString(record, \"latestVersion\", context),\n minimumLauncherVersion: readRequiredString(record, \"minimumLauncherVersion\", context),\n bundleUrl: readRequiredString(record, \"bundleUrl\", context),\n bundleSha256: readRequiredString(record, \"bundleSha256\", context).toLowerCase(),\n bundleSignature: readRequiredString(record, \"bundleSignature\", context),\n releaseNotesUrl,\n manifestSignature: readRequiredString(record, \"manifestSignature\", context)\n };\n };\n\n private readHostKind = (value: string, context: string): UpdateHostKind => {\n if (value === \"desktop-bundle\" || value === \"npm-runtime-bundle\") {\n return value;\n }\n throw new Error(`${context} has unsupported hostKind: ${value}`);\n };\n}\n"],"mappings":";AAmBA,SAAS,mBAAmB,QAAiC,KAAa,SAAyB;CACjG,MAAM,QAAQ,OAAO;AACrB,KAAI,OAAO,UAAU,YAAY,CAAC,MAAM,MAAM,CAC5C,OAAM,IAAI,MAAM,GAAG,QAAQ,kCAAkC,MAAM;AAErE,QAAO,MAAM,MAAM;;AAGrB,SAAgB,0BAA0B,UAA2E;AACnH,QAAO;EACL,SAAS,SAAS;EAClB,UAAU,SAAS;EACnB,MAAM,SAAS;EACf,UAAU,SAAS;EACnB,eAAe,SAAS;EACxB,wBAAwB,SAAS;EACjC,WAAW,SAAS;EACpB,cAAc,SAAS;EACvB,iBAAiB,SAAS;EAC1B,iBAAiB,SAAS;EAC3B;;AAGH,SAAgB,gCAAgC,UAA2D;AACzG,QAAO,KAAK,UAAU,0BAA0B,SAAS,CAAC;;AAG5D,IAAa,uBAAb,MAAkC;CAChC,SAAS,OAAgB,UAAU,sBAAsC;AACvE,MAAI,CAAC,SAAS,OAAO,UAAU,YAAY,MAAM,QAAQ,MAAM,CAC7D,OAAM,IAAI,MAAM,GAAG,QAAQ,oBAAoB;EAEjD,MAAM,SAAS;EACf,MAAM,WAAW,OAAO,OAAO,aAAa,YAAY,OAAO,SAAS,MAAM,GAC1E,KAAK,aAAa,OAAO,SAAS,MAAM,EAAE,QAAQ,GAClD,KAAA;EACJ,MAAM,kBACJ,OAAO,OAAO,oBAAoB,YAAY,OAAO,gBAAgB,MAAM,GAAG,OAAO,gBAAgB,MAAM,GAAG;AAEhH,SAAO;GACL,SAAS,mBAAmB,QAAQ,WAAW,QAAQ;GACvD,UAAU,mBAAmB,QAAQ,YAAY,QAAQ;GACzD,MAAM,mBAAmB,QAAQ,QAAQ,QAAQ;GACjD;GACA,eAAe,mBAAmB,QAAQ,iBAAiB,QAAQ;GACnE,wBAAwB,mBAAmB,QAAQ,0BAA0B,QAAQ;GACrF,WAAW,mBAAmB,QAAQ,aAAa,QAAQ;GAC3D,cAAc,mBAAmB,QAAQ,gBAAgB,QAAQ,CAAC,aAAa;GAC/E,iBAAiB,mBAAmB,QAAQ,mBAAmB,QAAQ;GACvE;GACA,mBAAmB,mBAAmB,QAAQ,qBAAqB,QAAQ;GAC5E;;CAGH,gBAAwB,OAAe,YAAoC;AACzE,MAAI,UAAU,oBAAoB,UAAU,qBAC1C,QAAO;AAET,QAAM,IAAI,MAAM,GAAG,QAAQ,6BAA6B,QAAQ"}