nextclaw 0.51.0 → 0.52.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.
@@ -5,7 +5,7 @@ import { NextclawDistributionService } from "@nextclaw/service";
5
5
  const distribution = createNextclawDistribution(import.meta.url);
6
6
  repairPackagedPortableRunnerPermissions(distribution);
7
7
  NextclawDistributionService.configureRuntime(distribution);
8
- const { nextclawCliProgram } = await import("../../nextclaw-cli-app-DAWWp2hy.js");
8
+ const { nextclawCliProgram } = await import("../../nextclaw-cli-app-Br9GLB2U.js");
9
9
  await nextclawCliProgram.parseAsync(process.argv);
10
10
  //#endregion
11
11
  export {};
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from "node:crypto";
2
- //#region src/cli/app/services/feedback/feedback-maintenance-client.service.ts
2
+ //#region src/cli/app/services/feedback/feedback-workflow-client.service.ts
3
3
  function selectFeedback(queue, now = Date.now(), limit = 10) {
4
4
  const pending = queue.filter((r) => r.status === "received" && !r.runId);
5
5
  const sorted = pending.slice().sort((a, b) => a.priority - b.priority || Number(b.kind !== "unknown") - Number(a.kind !== "unknown") || Number(b.identity === "verified") - Number(a.identity === "verified") || a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));
@@ -8,18 +8,18 @@ function selectFeedback(queue, now = Date.now(), limit = 10) {
8
8
  if (aged && !selected.includes(aged) && selected.length && selected.at(-1).priority > 0) selected[selected.length - 1] = aged;
9
9
  return selected;
10
10
  }
11
- var FeedbackMaintenanceClient = class {
11
+ var FeedbackWorkflowClient = class {
12
12
  endpoint;
13
13
  token;
14
14
  constructor({ endpoint, token }) {
15
15
  const url = new URL(endpoint);
16
16
  if (url.protocol !== "https:" && !(url.protocol === "http:" && ["localhost", "127.0.0.1"].includes(url.hostname)) || url.username || url.password || url.pathname !== "/" || url.search || url.hash) throw new Error("Invalid feedback origin.");
17
- if (!token || token.length < 32) throw new Error("SUPPORT_MAINTAINER_TOKEN must be configured.");
17
+ if (!token || token.length < 32) throw new Error("DISCUSSION_PARTICIPANT_TOKEN must be configured.");
18
18
  this.endpoint = url.origin;
19
19
  this.token = token;
20
20
  }
21
21
  request = async (path, body) => {
22
- const response = await fetch(this.endpoint + "/api/support/maintenance" + path, {
22
+ const response = await fetch(this.endpoint + "/api/support/workflow" + path, {
23
23
  method: body === void 0 ? "GET" : "POST",
24
24
  redirect: "error",
25
25
  signal: AbortSignal.timeout(15e3),
@@ -30,7 +30,7 @@ var FeedbackMaintenanceClient = class {
30
30
  body: body === void 0 ? void 0 : JSON.stringify(body)
31
31
  });
32
32
  const result = await response.json();
33
- if (!response.ok || !result.ok) throw new Error(result.error?.message ?? "Maintenance request failed.");
33
+ if (!response.ok || !result.ok) throw new Error(result.error?.message ?? "Feedback workflow request failed.");
34
34
  return result.data;
35
35
  };
36
36
  list = async () => {
@@ -51,9 +51,7 @@ var FeedbackMaintenanceClient = class {
51
51
  };
52
52
  };
53
53
  get = async (id) => {
54
- const report = (await this.list()).items.find((r) => r.id === id);
55
- if (!report) throw new Error("Feedback not found.");
56
- return report;
54
+ return this.request("/" + encodeURIComponent(id));
57
55
  };
58
56
  scan = async () => {
59
57
  const page = await this.list();
@@ -80,6 +78,6 @@ var FeedbackMaintenanceClient = class {
80
78
  };
81
79
  };
82
80
  //#endregion
83
- export { selectFeedback as n, FeedbackMaintenanceClient as t };
81
+ export { selectFeedback as n, FeedbackWorkflowClient as t };
84
82
 
85
- //# sourceMappingURL=feedback-maintenance-client.service-DIMfY_yr.js.map
83
+ //# sourceMappingURL=feedback-workflow-client.service-Cxx6V7TI.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feedback-workflow-client.service-Cxx6V7TI.js","names":[],"sources":["../src/cli/app/services/feedback/feedback-workflow-client.service.ts"],"sourcesContent":["import { randomUUID } from \"node:crypto\";\nimport type { SupportAuthority, SupportWorkflowOperation, SupportPage, SupportReport } from \"@nextclaw/shared\";\n\nexport function selectFeedback(queue: SupportReport[], now = Date.now(), limit = 10): SupportReport[] {\n const pending = queue.filter((r) => r.status === \"received\" && !r.runId);\n const sorted = pending.slice().sort((a, b) => a.priority - b.priority || Number(b.kind !== \"unknown\") - Number(a.kind !== \"unknown\") ||\n Number(b.identity === \"verified\") - Number(a.identity === \"verified\") || a.createdAt.localeCompare(b.createdAt) || a.id.localeCompare(b.id));\n const aged = pending.filter((r) => r.priority > 0 && r.kind !== \"unknown\" && now - Date.parse(r.createdAt) >= 48 * 3600000)\n .sort((a, b) => a.createdAt.localeCompare(b.createdAt))[0];\n const selected = sorted.slice(0, limit);\n if (aged && !selected.includes(aged) && selected.length && selected.at(-1)!.priority > 0) selected[selected.length - 1] = aged;\n return selected;\n}\ntype WorkflowPage = SupportPage & { paused: boolean; maxAuthority: SupportAuthority };\nexport class FeedbackWorkflowClient {\n readonly endpoint: string;\n private readonly token: string;\n constructor({ endpoint, token }: { endpoint: string; token: string | undefined }) {\n const url = new URL(endpoint);\n if ((url.protocol !== \"https:\" && !(url.protocol === \"http:\" && [\"localhost\", \"127.0.0.1\"].includes(url.hostname))) || url.username || url.password || url.pathname !== \"/\" || url.search || url.hash) throw new Error(\"Invalid feedback origin.\");\n if (!token || token.length < 32) throw new Error(\"DISCUSSION_PARTICIPANT_TOKEN must be configured.\");\n this.endpoint = url.origin; this.token = token;\n }\n request = async <T = WorkflowPage>(path: string, body?: unknown): Promise<T> => {\n const response = await fetch(this.endpoint + \"/api/support/workflow\" + path, {\n method: body === undefined ? \"GET\" : \"POST\", redirect: \"error\", signal: AbortSignal.timeout(15000),\n headers: { Authorization: \"Bearer \" + this.token, \"Content-Type\": \"application/json\" }, body: body === undefined ? undefined : JSON.stringify(body)\n });\n const result = await response.json() as { ok: boolean; data: T; error?: { message: string } };\n if (!response.ok || !result.ok) throw new Error(result.error?.message ?? \"Feedback workflow request failed.\");\n return result.data;\n };\n list = async (): Promise<WorkflowPage> => {\n const reports = new Map<string, SupportReport>(); let cursor = \"\", paused = false, maxAuthority: SupportAuthority = \"analyze\";\n do {\n const page = await this.request(\"?cursor=\" + encodeURIComponent(cursor));\n paused ||= page.paused; maxAuthority = page.maxAuthority;\n for (const report of page.items) reports.set(report.id, report);\n cursor = page.nextCursor ?? \"\";\n } while (cursor);\n return { items: [...reports.values()], paused, maxAuthority, nextCursor: null };\n };\n get = async (id: string): Promise<SupportReport> => {\n return this.request<SupportReport>(\"/\" + encodeURIComponent(id));\n };\n scan = async () => {\n const page = await this.list();\n return { paused: page.paused, maxAuthority: page.maxAuthority,\n candidates: page.paused ? [] : selectFeedback(page.items.filter((r) => !r.approval)),\n approved: page.paused ? [] : selectFeedback(page.items.filter((r) => r.approval?.inputVersion === r.inputVersion)),\n unfinished: page.items.filter((r) => [\"working\", \"ready\"].includes(r.status)) };\n };\n act = async (report: Pick<SupportReport, \"id\" | \"revision\" | \"runId\">, action: Omit<SupportWorkflowOperation, \"operationId\" | \"revision\" | \"runId\"> & { operationId?: string }): Promise<SupportReport> => {\n const operationId = action.operationId ?? randomUUID();\n try {\n return await this.request<SupportReport>(\"/\" + encodeURIComponent(report.id), { ...action, operationId, revision: report.revision, runId: report.runId });\n } catch (error) { throw new Error(`Operation ${operationId}: ${error instanceof Error ? error.message : \"request failed\"}`); }\n };\n}\n"],"mappings":";;AAGA,SAAgB,eAAe,OAAwB,MAAM,KAAK,KAAK,EAAE,QAAQ,IAAqB;CACpG,MAAM,UAAU,MAAM,QAAQ,MAAM,EAAE,WAAW,cAAc,CAAC,EAAE,MAAM;CACxE,MAAM,SAAS,QAAQ,OAAO,CAAC,MAAM,GAAG,MAAM,EAAE,WAAW,EAAE,YAAY,OAAO,EAAE,SAAS,UAAU,GAAG,OAAO,EAAE,SAAS,UAAU,IAClI,OAAO,EAAE,aAAa,WAAW,GAAG,OAAO,EAAE,aAAa,WAAW,IAAI,EAAE,UAAU,cAAc,EAAE,UAAU,IAAI,EAAE,GAAG,cAAc,EAAE,GAAG,CAAC;CAC9I,MAAM,OAAO,QAAQ,QAAQ,MAAM,EAAE,WAAW,KA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
+ import { SupportAuthority, SupportPage, SupportReport, SupportWorkflowOperation } from "@nextclaw/shared";
2
2
  export * from "@nextclaw/core";
3
3
 
4
- //#region src/cli/app/services/feedback/feedback-maintenance-client.service.d.ts
4
+ //#region src/cli/app/services/feedback/feedback-workflow-client.service.d.ts
5
5
  declare function selectFeedback(queue: SupportReport[], now?: number, limit?: number): SupportReport[];
6
- type MaintenancePage = SupportPage & {
6
+ type WorkflowPage = SupportPage & {
7
7
  paused: boolean;
8
8
  maxAuthority: SupportAuthority;
9
9
  };
10
- declare class FeedbackMaintenanceClient {
10
+ declare class FeedbackWorkflowClient {
11
11
  readonly endpoint: string;
12
12
  private readonly token;
13
13
  constructor({
@@ -17,8 +17,8 @@ declare class FeedbackMaintenanceClient {
17
17
  endpoint: string;
18
18
  token: string | undefined;
19
19
  });
20
- request: <T = MaintenancePage>(path: string, body?: unknown) => Promise<T>;
21
- list: () => Promise<MaintenancePage>;
20
+ request: <T = WorkflowPage>(path: string, body?: unknown) => Promise<T>;
21
+ list: () => Promise<WorkflowPage>;
22
22
  get: (id: string) => Promise<SupportReport>;
23
23
  scan: () => Promise<{
24
24
  paused: boolean;
@@ -27,10 +27,10 @@ declare class FeedbackMaintenanceClient {
27
27
  approved: SupportReport[];
28
28
  unfinished: SupportReport[];
29
29
  }>;
30
- act: (report: Pick<SupportReport, "id" | "revision" | "runId">, action: Omit<SupportMaintenance, "operationId" | "revision" | "runId"> & {
30
+ act: (report: Pick<SupportReport, "id" | "revision" | "runId">, action: Omit<SupportWorkflowOperation, "operationId" | "revision" | "runId"> & {
31
31
  operationId?: string;
32
32
  }) => Promise<SupportReport>;
33
33
  }
34
34
  //#endregion
35
- export { FeedbackMaintenanceClient, selectFeedback };
35
+ export { FeedbackWorkflowClient, selectFeedback };
36
36
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","names":[],"sources":["../src/cli/app/services/feedback/feedback-maintenance-client.service.ts"],"mappings":";;;;iBAGg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CAAK,wBAAA;IAAoE,WAAA;EAAA,MAAyB,OAAA,CAAQ,aAAA;AAAA"}
package/dist/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { n as selectFeedback, t as FeedbackMaintenanceClient } from "./feedback-maintenance-client.service-DIMfY_yr.js";
1
+ import { n as selectFeedback, t as FeedbackWorkflowClient } from "./feedback-workflow-client.service-Cxx6V7TI.js";
2
2
  export * from "@nextclaw/core";
3
- export { FeedbackMaintenanceClient, selectFeedback };
3
+ export { FeedbackWorkflowClient, selectFeedback };