@a9n-shoji/rvw 0.7.0 → 0.8.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.mjs CHANGED
@@ -18762,7 +18762,7 @@ function parseWalkthroughUri(uri) {
18762
18762
  }
18763
18763
 
18764
18764
  // src/shared/constants.ts
18765
- var APP_VERSION = "0.7.0";
18765
+ var APP_VERSION = "0.8.0";
18766
18766
  var PROTOCOL_VERSION = 5;
18767
18767
  var VIEWER_ID_HEADER = "x-rvw-viewer-id";
18768
18768
  var VIEWER_OPEN_LEASE_HEADER = "x-rvw-viewer-open-lease";
@@ -18782,6 +18782,8 @@ var DEFAULT_PULL_REQUEST_LIST_LIMIT = 50;
18782
18782
  var MAX_PULL_REQUEST_LIST_LIMIT = 100;
18783
18783
  var DEFAULT_COMMENT_LIST_LIMIT = 50;
18784
18784
  var MAX_COMMENT_LIST_LIMIT = 100;
18785
+ var DEFAULT_WALKTHROUGH_LIST_LIMIT = 50;
18786
+ var MAX_WALKTHROUGH_LIST_LIMIT = 100;
18785
18787
  var DEFAULT_COMMENT_WATCH_LIMIT = 100;
18786
18788
  var MAX_COMMENT_WATCH_LIMIT = 100;
18787
18789
  var DEFAULT_COMMENT_WATCH_INTERVAL_SECONDS = 10;
@@ -19039,6 +19041,7 @@ function mapPullRequest(row) {
19039
19041
  githubUpdatedAt: stringValue(row, "github_updated_at"),
19040
19042
  githubState: nullableGitHubPullRequestState(row, "github_state"),
19041
19043
  githubIsDraft: nullableBoolean(row, "github_is_draft"),
19044
+ githubApprovalCount: nullableNumber(row, "github_approval_count"),
19042
19045
  fetchedAt: stringValue(row, "fetched_at"),
19043
19046
  createdAt: stringValue(row, "created_at"),
19044
19047
  updatedAt: stringValue(row, "updated_at")
@@ -19604,7 +19607,8 @@ var RvwDatabase = class {
19604
19607
  github_created_at,
19605
19608
  github_updated_at,
19606
19609
  github_state,
19607
- github_is_draft
19610
+ github_is_draft,
19611
+ github_approval_count
19608
19612
  FROM pull_requests
19609
19613
  WHERE ? = 0 OR github_state IS NULL OR github_state = 'OPEN'
19610
19614
  ORDER BY github_updated_at DESC, id DESC
@@ -19638,6 +19642,7 @@ var RvwDatabase = class {
19638
19642
  pr.github_updated_at,
19639
19643
  pr.github_state,
19640
19644
  pr.github_is_draft,
19645
+ pr.github_approval_count,
19641
19646
  COALESCE(comment_counts.unresolved_count, 0) AS unresolved_comment_count,
19642
19647
  COALESCE(comment_counts.resolved_count, 0) AS resolved_comment_count,
19643
19648
  COALESCE(walkthrough_counts.walkthrough_count, 0) AS walkthrough_count,
@@ -19663,6 +19668,7 @@ var RvwDatabase = class {
19663
19668
  githubUpdatedAt: stringValue(row, "github_updated_at"),
19664
19669
  githubState: nullableGitHubPullRequestState(row, "github_state"),
19665
19670
  githubIsDraft: nullableBoolean(row, "github_is_draft"),
19671
+ githubApprovalCount: nullableNumber(row, "github_approval_count"),
19666
19672
  unresolvedCommentCount: numberValue(row, "unresolved_comment_count"),
19667
19673
  resolvedCommentCount: numberValue(row, "resolved_comment_count"),
19668
19674
  walkthroughCount: numberValue(row, "walkthrough_count"),
@@ -19675,7 +19681,7 @@ var RvwDatabase = class {
19675
19681
  if (updates.length === 0) return;
19676
19682
  this.immediateTransaction(() => {
19677
19683
  const statement = this.database.prepare(
19678
- "UPDATE pull_requests SET github_state = ?, github_is_draft = ? WHERE id = ?"
19684
+ "UPDATE pull_requests SET github_state = ?, github_is_draft = ?, github_approval_count = ? WHERE id = ?"
19679
19685
  );
19680
19686
  let changed = false;
19681
19687
  for (const update of updates) {
@@ -19687,10 +19693,15 @@ var RvwDatabase = class {
19687
19693
  { status: 404 }
19688
19694
  );
19689
19695
  }
19690
- if (current.githubState === update.state && current.githubIsDraft === update.isDraft) {
19696
+ if (current.githubState === update.state && current.githubIsDraft === update.isDraft && current.githubApprovalCount === update.approvalCount) {
19691
19697
  continue;
19692
19698
  }
19693
- const result = statement.run(update.state, update.isDraft ? 1 : 0, update.pullRequestId);
19699
+ const result = statement.run(
19700
+ update.state,
19701
+ update.isDraft ? 1 : 0,
19702
+ update.approvalCount,
19703
+ update.pullRequestId
19704
+ );
19694
19705
  if (Number(result.changes) !== 1) {
19695
19706
  throw new RvwError(
19696
19707
  "PR_NOT_FOUND",
@@ -19726,7 +19737,7 @@ var RvwDatabase = class {
19726
19737
  const existing = this.findPullRequestByIdentity(github.owner, github.repository, github.number);
19727
19738
  const id = existing?.id ?? randomUUID();
19728
19739
  const contentChanged = !existing || existing.latestTitle !== github.title || existing.latestBody !== github.body;
19729
- const semanticChanged = !existing || existing.url !== github.url || existing.latestAuthorLogin !== github.authorLogin || existing.latestHeadRepositoryOwner !== github.headRepositoryOwner || existing.latestHeadRepositoryName !== github.headRepositoryName || existing.localRepositoryPath !== repository.localRepositoryPath || existing.gitCommonDir !== repository.gitCommonDir || contentChanged || existing.latestBaseRefName !== github.baseRefName || existing.latestHeadRefName !== github.headRefName || existing.latestBaseOid !== github.baseOid || existing.latestComparisonBaseOid !== comparisonBaseOid || existing.latestHeadOid !== github.headOid || existing.githubCreatedAt !== github.createdAt || existing.githubUpdatedAt !== github.updatedAt || existing.githubState !== github.state || existing.githubIsDraft !== github.isDraft;
19740
+ const semanticChanged = !existing || existing.url !== github.url || existing.latestAuthorLogin !== github.authorLogin || existing.latestHeadRepositoryOwner !== github.headRepositoryOwner || existing.latestHeadRepositoryName !== github.headRepositoryName || existing.localRepositoryPath !== repository.localRepositoryPath || existing.gitCommonDir !== repository.gitCommonDir || contentChanged || existing.latestBaseRefName !== github.baseRefName || existing.latestHeadRefName !== github.headRefName || existing.latestBaseOid !== github.baseOid || existing.latestComparisonBaseOid !== comparisonBaseOid || existing.latestHeadOid !== github.headOid || existing.githubCreatedAt !== github.createdAt || existing.githubUpdatedAt !== github.updatedAt || existing.githubState !== github.state || existing.githubIsDraft !== github.isDraft || existing.githubApprovalCount !== github.approvalCount;
19730
19741
  this.database.prepare(
19731
19742
  `INSERT INTO pull_requests(
19732
19743
  id, host, owner, repository, number, github_url,
@@ -19734,9 +19745,9 @@ var RvwDatabase = class {
19734
19745
  latest_author_login, latest_head_repository_owner, latest_head_repository_name,
19735
19746
  latest_title, latest_body, latest_base_ref_name, latest_head_ref_name,
19736
19747
  latest_base_oid, latest_head_oid, github_created_at, github_updated_at,
19737
- github_state, github_is_draft, fetched_at,
19748
+ github_state, github_is_draft, github_approval_count, fetched_at,
19738
19749
  created_at, updated_at, latest_comparison_base_oid
19739
- ) VALUES (?, 'github.com', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
19750
+ ) VALUES (?, 'github.com', ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
19740
19751
  ON CONFLICT(host, owner, repository, number) DO UPDATE SET
19741
19752
  github_url = excluded.github_url,
19742
19753
  local_repository_path = excluded.local_repository_path,
@@ -19755,6 +19766,7 @@ var RvwDatabase = class {
19755
19766
  github_updated_at = excluded.github_updated_at,
19756
19767
  github_state = excluded.github_state,
19757
19768
  github_is_draft = excluded.github_is_draft,
19769
+ github_approval_count = excluded.github_approval_count,
19758
19770
  fetched_at = excluded.fetched_at,
19759
19771
  updated_at = excluded.updated_at`
19760
19772
  ).run(
@@ -19778,6 +19790,7 @@ var RvwDatabase = class {
19778
19790
  github.updatedAt,
19779
19791
  github.state,
19780
19792
  github.isDraft ? 1 : 0,
19793
+ github.approvalCount,
19781
19794
  now,
19782
19795
  existing?.createdAt ?? now,
19783
19796
  semanticChanged ? now : existing.updatedAt,
@@ -20160,7 +20173,8 @@ var RvwDatabase = class {
20160
20173
  authorLabel: nullableString(row, "author_label"),
20161
20174
  diagramBindings: stringRecordValue(row, "diagram_bindings_json"),
20162
20175
  references: this.listCodeReferences("walkthrough", id),
20163
- createdAt: stringValue(row, "created_at")
20176
+ createdAt: stringValue(row, "created_at"),
20177
+ updatedAt: stringValue(row, "updated_at")
20164
20178
  };
20165
20179
  }
20166
20180
  getWalkthrough(id) {
@@ -20186,6 +20200,27 @@ var RvwDatabase = class {
20186
20200
  createdAt: stringValue(row, "created_at")
20187
20201
  }));
20188
20202
  }
20203
+ listWalkthroughPage(pullRequestId, limit, offset) {
20204
+ const totalRow = this.database.prepare("SELECT COUNT(*) AS total FROM walkthroughs WHERE pull_request_id = ?").get(pullRequestId);
20205
+ const walkthroughs = this.database.prepare(
20206
+ `SELECT id, source_oid, title, author_label, created_at
20207
+ FROM walkthroughs
20208
+ WHERE pull_request_id = ?
20209
+ ORDER BY created_at DESC, id DESC
20210
+ LIMIT ? OFFSET ?`
20211
+ ).all(pullRequestId, limit, offset).map((row) => {
20212
+ const id = stringValue(row, "id");
20213
+ return {
20214
+ id,
20215
+ ref: formatWalkthroughUri(id),
20216
+ sourceOid: stringValue(row, "source_oid"),
20217
+ title: stringValue(row, "title"),
20218
+ authorLabel: nullableString(row, "author_label"),
20219
+ createdAt: stringValue(row, "created_at")
20220
+ };
20221
+ });
20222
+ return { walkthroughs, total: numberValue(totalRow, "total") };
20223
+ }
20189
20224
  createWalkthrough(input) {
20190
20225
  const id = randomUUID();
20191
20226
  const now = (/* @__PURE__ */ new Date()).toISOString();
@@ -20193,8 +20228,8 @@ var RvwDatabase = class {
20193
20228
  this.database.prepare(
20194
20229
  `INSERT INTO walkthroughs(
20195
20230
  id, pull_request_id, source_oid, title, body, author_label,
20196
- diagram_bindings_json, created_at
20197
- ) VALUES (?, ?, ?, ?, ?, ?, ?, ?)`
20231
+ diagram_bindings_json, created_at, updated_at
20232
+ ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`
20198
20233
  ).run(
20199
20234
  id,
20200
20235
  input.pullRequestId,
@@ -20203,6 +20238,7 @@ var RvwDatabase = class {
20203
20238
  input.body,
20204
20239
  input.authorLabel ?? null,
20205
20240
  JSON.stringify(input.diagramBindings),
20241
+ now,
20206
20242
  now
20207
20243
  );
20208
20244
  this.insertCodeReferences("walkthrough", id, input.references);
@@ -20215,10 +20251,12 @@ var RvwDatabase = class {
20215
20251
  return walkthrough;
20216
20252
  }
20217
20253
  updateWalkthrough(id, input) {
20254
+ const now = (/* @__PURE__ */ new Date()).toISOString();
20218
20255
  this.immediateTransaction(() => {
20219
20256
  const result = this.database.prepare(
20220
20257
  `UPDATE walkthroughs
20221
- SET source_oid = ?, title = ?, body = ?, author_label = ?, diagram_bindings_json = ?
20258
+ SET source_oid = ?, title = ?, body = ?, author_label = ?, diagram_bindings_json = ?,
20259
+ updated_at = ?
20222
20260
  WHERE id = ?`
20223
20261
  ).run(
20224
20262
  input.sourceOid,
@@ -20226,6 +20264,7 @@ var RvwDatabase = class {
20226
20264
  input.body,
20227
20265
  input.authorLabel ?? null,
20228
20266
  JSON.stringify(input.diagramBindings),
20267
+ now,
20229
20268
  id
20230
20269
  );
20231
20270
  if (Number(result.changes) === 0) {
@@ -21468,12 +21507,17 @@ var ghPullRequestSchema = external_exports.object({
21468
21507
  baseRefOid: external_exports.string().regex(GIT_OBJECT_ID_PATTERN),
21469
21508
  headRefName: external_exports.string().min(1),
21470
21509
  headRefOid: external_exports.string().regex(GIT_OBJECT_ID_PATTERN),
21471
- createdAt: external_exports.string()
21510
+ createdAt: external_exports.string(),
21511
+ latestReviews: external_exports.array(external_exports.object({ state: external_exports.string() }))
21472
21512
  });
21473
21513
  var ghPullRequestStatusSchema = external_exports.object({
21474
21514
  state: external_exports.enum(["OPEN", "CLOSED", "MERGED"]),
21475
- isDraft: external_exports.boolean()
21515
+ isDraft: external_exports.boolean(),
21516
+ latestReviews: external_exports.array(external_exports.object({ state: external_exports.string() }))
21476
21517
  });
21518
+ function approvalCount(latestReviews) {
21519
+ return latestReviews.filter((review) => review.state === "APPROVED").length;
21520
+ }
21477
21521
  function parsePullRequestUrl(url2) {
21478
21522
  const match2 = /^https:\/\/github\.com\/([^/]+)\/([^/]+)\/pull\/(\d+)(?:\/.*)?$/.exec(url2);
21479
21523
  if (!match2?.[1] || !match2[2] || !match2[3]) {
@@ -21508,7 +21552,7 @@ var GitHubClient = class {
21508
21552
  try {
21509
21553
  const result = await this.processRunner(
21510
21554
  "gh",
21511
- ["pr", "view", reference, "--json", "state,isDraft"],
21555
+ ["pr", "view", reference, "--json", "state,isDraft,latestReviews"],
21512
21556
  { timeoutMs: 6e4 }
21513
21557
  );
21514
21558
  output = result.stdout.toString("utf8").trimEnd();
@@ -21536,7 +21580,11 @@ var GitHubClient = class {
21536
21580
  details: parsed.error.flatten()
21537
21581
  });
21538
21582
  }
21539
- return parsed.data;
21583
+ return {
21584
+ state: parsed.data.state,
21585
+ isDraft: parsed.data.isDraft,
21586
+ approvalCount: approvalCount(parsed.data.latestReviews)
21587
+ };
21540
21588
  }
21541
21589
  async getPullRequestStatuses(references) {
21542
21590
  if (references.length === 0) return [];
@@ -21591,7 +21639,8 @@ var GitHubClient = class {
21591
21639
  "headRefName",
21592
21640
  "headRefOid",
21593
21641
  "headRepository",
21594
- "headRepositoryOwner"
21642
+ "headRepositoryOwner",
21643
+ "latestReviews"
21595
21644
  ].join(",");
21596
21645
  const args = ["pr", "view"];
21597
21646
  if (reference !== void 0 && reference.length > 0) args.push(reference);
@@ -21640,7 +21689,8 @@ var GitHubClient = class {
21640
21689
  createdAt: parsed.data.createdAt,
21641
21690
  updatedAt: parsed.data.updatedAt,
21642
21691
  state: parsed.data.state,
21643
- isDraft: parsed.data.isDraft
21692
+ isDraft: parsed.data.isDraft,
21693
+ approvalCount: approvalCount(parsed.data.latestReviews)
21644
21694
  };
21645
21695
  }
21646
21696
  async getAttachment(absoluteUrl) {
@@ -43043,6 +43093,35 @@ var RvwService = class {
43043
43093
  }
43044
43094
  };
43045
43095
  }
43096
+ listWalkthroughsByReference(reference, page = {}) {
43097
+ const limit = page.limit ?? DEFAULT_WALKTHROUGH_LIST_LIMIT;
43098
+ const offset = page.offset ?? 0;
43099
+ if (!Number.isInteger(limit) || limit < 1 || limit > MAX_WALKTHROUGH_LIST_LIMIT) {
43100
+ throw new RvwError(
43101
+ "INVALID_INPUT",
43102
+ `walkthrough list\u306Elimit\u306F1\u301C${MAX_WALKTHROUGH_LIST_LIMIT}\u306E\u6574\u6570\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002`
43103
+ );
43104
+ }
43105
+ if (!Number.isInteger(offset) || offset < 0) {
43106
+ throw new RvwError("INVALID_INPUT", "walkthrough list\u306Eoffset\u306F0\u4EE5\u4E0A\u306E\u6574\u6570\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002");
43107
+ }
43108
+ const pullRequest = this.resolveStoredPullRequest(reference);
43109
+ const result = this.database.listWalkthroughPage(pullRequest.id, limit, offset);
43110
+ const nextOffset = offset + result.walkthroughs.length;
43111
+ const hasMore = nextOffset < result.total;
43112
+ return {
43113
+ pullRequest,
43114
+ walkthroughs: result.walkthroughs,
43115
+ page: {
43116
+ offset,
43117
+ limit,
43118
+ returned: result.walkthroughs.length,
43119
+ total: result.total,
43120
+ hasMore,
43121
+ nextOffset: hasMore ? nextOffset : null
43122
+ }
43123
+ };
43124
+ }
43046
43125
  listCommentPostEvents(cursor, limit = DEFAULT_COMMENT_WATCH_LIMIT) {
43047
43126
  if (!Number.isInteger(limit) || limit < 1 || limit > MAX_COMMENT_WATCH_LIMIT) {
43048
43127
  throw new RvwError(
@@ -45337,15 +45416,15 @@ var SkillInstaller = class {
45337
45416
  // src/server/start-server.ts
45338
45417
  import { randomUUID as randomUUID4 } from "node:crypto";
45339
45418
 
45340
- // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.1/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
45419
+ // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.7/node_modules/@hono/node-server/dist/constants-BLSFu_RU.mjs
45341
45420
  var X_ALREADY_SENT = "x-hono-already-sent";
45342
45421
 
45343
- // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.1/node_modules/@hono/node-server/dist/index.mjs
45422
+ // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.7/node_modules/@hono/node-server/dist/index.mjs
45344
45423
  import { STATUS_CODES, createServer } from "node:http";
45345
45424
  import { Http2ServerRequest, constants as constants2 } from "node:http2";
45346
45425
  import { Readable } from "node:stream";
45347
45426
 
45348
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/helper/websocket/index.js
45427
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/helper/websocket/index.js
45349
45428
  var defineWebSocketHelper = (handler) => {
45350
45429
  return ((...args) => {
45351
45430
  if (typeof args[0] === "function") {
@@ -45371,7 +45450,7 @@ var defineWebSocketHelper = (handler) => {
45371
45450
  });
45372
45451
  };
45373
45452
 
45374
- // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.1/node_modules/@hono/node-server/dist/index.mjs
45453
+ // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.7/node_modules/@hono/node-server/dist/index.mjs
45375
45454
  var RequestError = class extends Error {
45376
45455
  constructor(message, options) {
45377
45456
  super(message, options);
@@ -46518,7 +46597,7 @@ var serve = (options, listeningListener) => {
46518
46597
  import { existsSync as existsSync4, readFileSync as readFileSync3 } from "node:fs";
46519
46598
  import path8 from "node:path";
46520
46599
 
46521
- // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.1/node_modules/@hono/node-server/dist/utils/stream.mjs
46600
+ // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.7/node_modules/@hono/node-server/dist/utils/stream.mjs
46522
46601
  import { Readable as Readable2 } from "node:stream";
46523
46602
  import { versions } from "node:process";
46524
46603
  var pr54206Applied = () => {
@@ -46580,7 +46659,7 @@ var createStreamBody = (stream, useNativeReadableToWeb = useReadableToWeb) => {
46580
46659
  });
46581
46660
  };
46582
46661
 
46583
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/mime.js
46662
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/mime.js
46584
46663
  var getMimeType = (filename, mimes = baseMimes) => {
46585
46664
  const regexp = /\.([a-zA-Z0-9]+?)$/;
46586
46665
  const match2 = filename.match(regexp);
@@ -46649,7 +46728,7 @@ var _baseMimes = {
46649
46728
  };
46650
46729
  var baseMimes = _baseMimes;
46651
46730
 
46652
- // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.1/node_modules/@hono/node-server/dist/serve-static.mjs
46731
+ // node_modules/.pnpm/@hono+node-server@2.1.0_hono@4.13.7/node_modules/@hono/node-server/dist/serve-static.mjs
46653
46732
  import { createReadStream, existsSync as existsSync3, statSync as statSync2 } from "node:fs";
46654
46733
  import { join } from "node:path";
46655
46734
  var COMPRESSIBLE_CONTENT_TYPE_REGEX = /^\s*(?:text\/[^;\s]+|application\/(?:javascript|json|xml|xml-dtd|ecmascript|dart|postscript|rtf|tar|toml|vnd\.dart|vnd\.ms-fontobject|vnd\.ms-opentype|wasm|x-httpd-php|x-javascript|x-ns-proxy-autoconfig|x-sh|x-tar|x-virtualbox-hdd|x-virtualbox-ova|x-virtualbox-ovf|x-virtualbox-vbox|x-virtualbox-vdi|x-virtualbox-vhd|x-virtualbox-vmdk|x-www-form-urlencoded)|font\/(?:otf|ttf)|image\/(?:bmp|vnd\.adobe\.photoshop|vnd\.microsoft\.icon|vnd\.ms-dds|x-icon|x-ms-bmp)|message\/rfc822|model\/gltf-binary|x-shader\/x-fragment|x-shader\/x-vertex|[^;\s]+?\+(?:json|text|xml|yaml))(?:[;\s]|$)/i;
@@ -46795,7 +46874,7 @@ var serveStatic = (options = { root: "" }) => {
46795
46874
  };
46796
46875
  };
46797
46876
 
46798
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/compose.js
46877
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/compose.js
46799
46878
  var compose = (middleware, onError, onNotFound) => {
46800
46879
  return (context, next2) => {
46801
46880
  let index2 = -1;
@@ -46839,10 +46918,10 @@ var compose = (middleware, onError, onNotFound) => {
46839
46918
  };
46840
46919
  };
46841
46920
 
46842
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/request/constants.js
46921
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/request/constants.js
46843
46922
  var GET_MATCH_RESULT = /* @__PURE__ */ Symbol();
46844
46923
 
46845
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/buffer.js
46924
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/buffer.js
46846
46925
  var bufferToFormData = (arrayBuffer, contentType2) => {
46847
46926
  const response = new Response(arrayBuffer, {
46848
46927
  headers: {
@@ -46853,7 +46932,9 @@ var bufferToFormData = (arrayBuffer, contentType2) => {
46853
46932
  return response.formData();
46854
46933
  };
46855
46934
 
46856
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/body.js
46935
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/body.js
46936
+ var MAX_NESTING_DEPTH = 32;
46937
+ var MAX_NESTED_OBJECTS = 1e4;
46857
46938
  var isRawRequest = (request) => "headers" in request;
46858
46939
  var parseBody = async (request, options = /* @__PURE__ */ Object.create(null)) => {
46859
46940
  const { all: all4 = false, dot = false } = options;
@@ -46886,6 +46967,7 @@ async function parseFormData(request, options) {
46886
46967
  }
46887
46968
  function convertFormDataToBodyData(formData, options) {
46888
46969
  const form = /* @__PURE__ */ Object.create(null);
46970
+ const nestingState = { count: 0 };
46889
46971
  formData.forEach((value, key2) => {
46890
46972
  const shouldParseAllValues = options.all || key2.endsWith("[]");
46891
46973
  if (!shouldParseAllValues) {
@@ -46898,7 +46980,7 @@ function convertFormDataToBodyData(formData, options) {
46898
46980
  Object.entries(form).forEach(([key2, value]) => {
46899
46981
  const shouldParseDotValues = key2.includes(".");
46900
46982
  if (shouldParseDotValues) {
46901
- handleParsingNestedValues(form, key2, value);
46983
+ handleParsingNestedValues(form, key2, value, nestingState);
46902
46984
  delete form[key2];
46903
46985
  }
46904
46986
  });
@@ -46921,25 +47003,34 @@ var handleParsingAllValues = (form, key2, value) => {
46921
47003
  }
46922
47004
  }
46923
47005
  };
46924
- var handleParsingNestedValues = (form, key2, value) => {
47006
+ var handleParsingNestedValues = (form, key2, value, state) => {
46925
47007
  if (/(?:^|\.)__proto__\./.test(key2)) {
46926
47008
  return;
46927
47009
  }
46928
47010
  let nestedForm = form;
46929
- const keys2 = key2.split(".");
47011
+ const keys2 = key2.split(".", MAX_NESTING_DEPTH + 2);
47012
+ if (keys2.length > MAX_NESTING_DEPTH + 1) {
47013
+ throwNestingLimitExceeded();
47014
+ }
46930
47015
  keys2.forEach((key22, index2) => {
46931
47016
  if (index2 === keys2.length - 1) {
46932
47017
  nestedForm[key22] = value;
46933
47018
  } else {
46934
47019
  if (!nestedForm[key22] || typeof nestedForm[key22] !== "object" || Array.isArray(nestedForm[key22]) || nestedForm[key22] instanceof File) {
47020
+ if (state.count++ >= MAX_NESTED_OBJECTS) {
47021
+ throwNestingLimitExceeded();
47022
+ }
46935
47023
  nestedForm[key22] = /* @__PURE__ */ Object.create(null);
46936
47024
  }
46937
47025
  nestedForm = nestedForm[key22];
46938
47026
  }
46939
47027
  });
46940
47028
  };
47029
+ var throwNestingLimitExceeded = () => {
47030
+ throw new Error("Nesting limit exceeded");
47031
+ };
46941
47032
 
46942
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/url.js
47033
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/url.js
46943
47034
  var splitPath = (path11) => {
46944
47035
  const paths = path11.split("/");
46945
47036
  if (paths[0] === "") {
@@ -47045,13 +47136,13 @@ var checkOptionalParameter = (path11) => {
47045
47136
  if (segment !== "" && !/\:/.test(segment)) {
47046
47137
  basePath += "/" + segment;
47047
47138
  } else if (/\:/.test(segment)) {
47048
- if (/\?/.test(segment)) {
47139
+ if (segment.charCodeAt(segment.length - 1) === 63) {
47049
47140
  if (results.length === 0 && basePath === "") {
47050
47141
  results.push("/");
47051
47142
  } else {
47052
47143
  results.push(basePath);
47053
47144
  }
47054
- const optionalSegment = segment.replace("?", "");
47145
+ const optionalSegment = segment.slice(0, -1);
47055
47146
  basePath += "/" + optionalSegment;
47056
47147
  results.push(basePath);
47057
47148
  } else {
@@ -47069,6 +47160,10 @@ var _decodeURI = (value) => {
47069
47160
  return tryDecodeURIComponent(value);
47070
47161
  };
47071
47162
  var _getQueryParam = (url2, key2, multiple) => {
47163
+ const hashIndex = url2.indexOf("#", 8);
47164
+ if (hashIndex !== -1) {
47165
+ url2 = url2.slice(0, hashIndex);
47166
+ }
47072
47167
  let encoded;
47073
47168
  if (!multiple && key2 && key2.indexOf("%") === -1 && key2.indexOf("+") === -1) {
47074
47169
  let keyIndex2 = url2.indexOf("?", 8);
@@ -47141,7 +47236,7 @@ var getQueryParams = (url2, key2) => {
47141
47236
  };
47142
47237
  var decodeURIComponent_ = decodeURIComponent;
47143
47238
 
47144
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/request.js
47239
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/request.js
47145
47240
  var HonoRequest = class {
47146
47241
  /**
47147
47242
  * `.raw` can get the raw Request object.
@@ -47185,13 +47280,13 @@ var HonoRequest = class {
47185
47280
  return key2 ? this.#getDecodedParam(key2) : this.#getAllDecodedParams();
47186
47281
  }
47187
47282
  #getDecodedParam(key2) {
47188
- const paramKey = this.#matchResult[0][this.routeIndex][1][key2];
47283
+ const paramKey = this.#matchResult[0][this.routeIndex]?.[1][key2];
47189
47284
  const param = this.#getParamValue(paramKey);
47190
47285
  return param && tryDecodeURIComponent(param);
47191
47286
  }
47192
47287
  #getAllDecodedParams() {
47193
47288
  const decoded = {};
47194
- const keys2 = Object.keys(this.#matchResult[0][this.routeIndex][1]);
47289
+ const keys2 = Object.keys(this.#matchResult[0][this.routeIndex]?.[1] ?? {});
47195
47290
  for (const key2 of keys2) {
47196
47291
  const value = this.#getParamValue(this.#matchResult[0][this.routeIndex][1][key2]);
47197
47292
  if (value !== void 0) {
@@ -47422,7 +47517,7 @@ var HonoRequest = class {
47422
47517
  }
47423
47518
  };
47424
47519
 
47425
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/html.js
47520
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/html.js
47426
47521
  var HtmlEscapedCallbackPhase = {
47427
47522
  Stringify: 1,
47428
47523
  BeforeStream: 2,
@@ -47464,7 +47559,7 @@ var resolveCallback = async (str, phase, preserveCallbacks, context, buffer) =>
47464
47559
  }
47465
47560
  };
47466
47561
 
47467
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/context.js
47562
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/context.js
47468
47563
  var TEXT_PLAIN = "text/plain; charset=UTF-8";
47469
47564
  var setDefaultContentType = (contentType2, headers) => {
47470
47565
  return {
@@ -47666,6 +47761,10 @@ var Context = class {
47666
47761
  * c.header('X-Message', 'Hello!')
47667
47762
  * c.header('Content-Type', 'text/plain')
47668
47763
  *
47764
+ * // Append multiple headers using the append option (e.g. Vary)
47765
+ * c.header('Vary', 'Accept-Encoding', { append: true })
47766
+ * c.header('Vary', 'User-Agent', { append: true })
47767
+ *
47669
47768
  * return c.body('Thank you for coming')
47670
47769
  * })
47671
47770
  * ```
@@ -47886,7 +47985,7 @@ var Context = class {
47886
47985
  };
47887
47986
  };
47888
47987
 
47889
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router.js
47988
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router.js
47890
47989
  var METHOD_NAME_ALL = "ALL";
47891
47990
  var METHOD_NAME_ALL_LOWERCASE = "all";
47892
47991
  var METHODS = ["get", "post", "put", "delete", "options", "patch", "query"];
@@ -47894,10 +47993,10 @@ var MESSAGE_MATCHER_IS_ALREADY_BUILT = "Can not add a route since the matcher is
47894
47993
  var UnsupportedPathError = class extends Error {
47895
47994
  };
47896
47995
 
47897
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/utils/constants.js
47996
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/utils/constants.js
47898
47997
  var COMPOSED_HANDLER = "__COMPOSED_HANDLER";
47899
47998
 
47900
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/hono-base.js
47999
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/hono-base.js
47901
48000
  var notFoundHandler = (c) => {
47902
48001
  return c.text("404 Not Found", 404);
47903
48002
  };
@@ -47934,13 +48033,14 @@ var Hono = class _Hono {
47934
48033
  const allMethods = [...METHODS, METHOD_NAME_ALL_LOWERCASE];
47935
48034
  allMethods.forEach((method) => {
47936
48035
  this[method] = (args1, ...args) => {
48036
+ const methodName = method.toUpperCase();
47937
48037
  if (typeof args1 === "string") {
47938
48038
  this.#path = args1;
47939
48039
  } else {
47940
- this.#addRoute(method, this.#path, args1);
48040
+ this.#addRoute(methodName, this.#path, args1);
47941
48041
  }
47942
48042
  args.forEach((handler) => {
47943
- this.#addRoute(method, this.#path, handler);
48043
+ this.#addRoute(methodName, this.#path, handler);
47944
48044
  });
47945
48045
  return this;
47946
48046
  };
@@ -47949,9 +48049,10 @@ var Hono = class _Hono {
47949
48049
  for (const p2 of [path11].flat()) {
47950
48050
  this.#path = p2;
47951
48051
  for (const m of [method].flat()) {
47952
- handlers.map((handler) => {
47953
- this.#addRoute(m.toUpperCase(), this.#path, handler);
47954
- });
48052
+ const methodName = m.toUpperCase();
48053
+ for (const handler of handlers) {
48054
+ this.#addRoute(methodName, this.#path, handler);
48055
+ }
47955
48056
  }
47956
48057
  }
47957
48058
  return this;
@@ -48152,7 +48253,6 @@ var Hono = class _Hono {
48152
48253
  return this;
48153
48254
  }
48154
48255
  #addRoute(method, path11, handler, baseRoutePath) {
48155
- method = method.toUpperCase();
48156
48256
  path11 = mergePath(this._basePath, path11);
48157
48257
  const r = {
48158
48258
  basePath: baseRoutePath !== void 0 ? mergePath(this._basePath, baseRoutePath) : this._basePath,
@@ -48274,7 +48374,10 @@ var Hono = class _Hono {
48274
48374
  };
48275
48375
  };
48276
48376
 
48277
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/reg-exp-router/matcher.js
48377
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/utils.js
48378
+ var createNullObject = () => /* @__PURE__ */ Object.create(null);
48379
+
48380
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/matcher.js
48278
48381
  var emptyParam = [];
48279
48382
  function match(method, path11) {
48280
48383
  const matchers = this.buildAllMatchers();
@@ -48295,7 +48398,7 @@ function match(method, path11) {
48295
48398
  return match2(method, path11);
48296
48399
  }
48297
48400
 
48298
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/reg-exp-router/node.js
48401
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/node.js
48299
48402
  var LABEL_REG_EXP_STR = "[^/]+";
48300
48403
  var ONLY_WILDCARD_REG_EXP_STR = ".*";
48301
48404
  var TAIL_WILDCARD_REG_EXP_STR = "(?:|/.*)";
@@ -48324,7 +48427,7 @@ var Node = class _Node {
48324
48427
  // handler index of a dynamic path, or -1 for a static path terminal
48325
48428
  #index;
48326
48429
  #varIndex;
48327
- #children = /* @__PURE__ */ Object.create(null);
48430
+ #children = createNullObject();
48328
48431
  insert(tokens, index2, paramMap, context, isStatic) {
48329
48432
  let node2 = this;
48330
48433
  for (let i = 0, len = tokens.length; i < len; i++) {
@@ -48402,13 +48505,13 @@ var Node = class _Node {
48402
48505
  }
48403
48506
  };
48404
48507
 
48405
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/reg-exp-router/trie.js
48508
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/trie.js
48406
48509
  var Trie = class {
48407
48510
  #context = { varIndex: 0 };
48408
48511
  #root = new Node();
48409
48512
  #index = 0;
48410
48513
  // dynamic path -> [handler index, param assoc]; static paths are not registered
48411
- paths = /* @__PURE__ */ Object.create(null);
48514
+ paths = createNullObject();
48412
48515
  insert(path11, isStatic) {
48413
48516
  if (isStatic) {
48414
48517
  this.#root.insert(path11.split(""), 0, [], this.#context, true);
@@ -48466,23 +48569,17 @@ var Trie = class {
48466
48569
  }
48467
48570
  };
48468
48571
 
48469
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/reg-exp-router/router.js
48470
- var wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
48572
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/reg-exp-router/router.js
48573
+ var wildcardRegExpCache = createNullObject();
48471
48574
  function buildWildcardRegExp(path11) {
48472
48575
  return wildcardRegExpCache[path11] ??= new RegExp(
48473
- path11 === "*" ? "" : `^${path11.replace(
48474
- /\/\*$|([.\\+*[^\]$()])/g,
48475
- (_, metaChar) => metaChar ? `\\${metaChar}` : "(?:|/.*)"
48576
+ `^${path11.replace(
48577
+ /\/:[^/{}]+(?:\{\[\^\/]\+})?(?=[/{]|$)|\/?\*$|([.\\+*[^\]$()?{}|])/g,
48578
+ (match2, metaChar) => metaChar ? `\\${metaChar}` : match2 === "/*" ? TAIL_WILDCARD_REG_EXP_STR : match2 === "*" ? ONLY_WILDCARD_REG_EXP_STR : `/:${LABEL_REG_EXP_STR}`
48476
48579
  )}$`
48477
48580
  );
48478
48581
  }
48479
- function clearWildcardRegExpCache() {
48480
- wildcardRegExpCache = /* @__PURE__ */ Object.create(null);
48481
- }
48482
48582
  function findMiddleware(middleware, path11) {
48483
- if (!middleware) {
48484
- return void 0;
48485
- }
48486
48583
  for (const k of Object.keys(middleware).sort((a, b) => b.length - a.length)) {
48487
48584
  if (buildWildcardRegExp(k).test(path11)) {
48488
48585
  return [...middleware[k]];
@@ -48496,8 +48593,8 @@ var RegExpRouter = class {
48496
48593
  #routes;
48497
48594
  #tries;
48498
48595
  constructor() {
48499
- this.#middleware = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
48500
- this.#routes = { [METHOD_NAME_ALL]: /* @__PURE__ */ Object.create(null) };
48596
+ this.#middleware = { [METHOD_NAME_ALL]: createNullObject() };
48597
+ this.#routes = { [METHOD_NAME_ALL]: createNullObject() };
48501
48598
  this.#tries = { [METHOD_NAME_ALL]: new Trie() };
48502
48599
  }
48503
48600
  #insertPath(method, path11) {
@@ -48510,121 +48607,90 @@ var RegExpRouter = class {
48510
48607
  add(method, path11, handler) {
48511
48608
  const middleware = this.#middleware;
48512
48609
  const routes = this.#routes;
48513
- if (!middleware || !routes) {
48610
+ if (!middleware) {
48514
48611
  throw new Error(MESSAGE_MATCHER_IS_ALREADY_BUILT);
48515
48612
  }
48516
48613
  if (!middleware[method]) {
48517
48614
  this.#tries[method] = new Trie();
48518
- [middleware, routes].forEach((handlerMap) => {
48519
- handlerMap[method] = /* @__PURE__ */ Object.create(null);
48520
- Object.keys(handlerMap[METHOD_NAME_ALL]).forEach((p2) => {
48615
+ for (const handlerMap of [middleware, routes]) {
48616
+ handlerMap[method] = createNullObject();
48617
+ for (const p2 in handlerMap[METHOD_NAME_ALL]) {
48521
48618
  handlerMap[method][p2] = [...handlerMap[METHOD_NAME_ALL][p2]];
48522
48619
  this.#insertPath(method, p2);
48523
- });
48524
- });
48620
+ }
48621
+ }
48525
48622
  }
48526
48623
  if (path11 === "/*") {
48527
48624
  path11 = "*";
48528
48625
  }
48529
- const paramCount = (path11.match(/\/:/g) || []).length;
48626
+ const methods = method === METHOD_NAME_ALL ? Object.keys(middleware) : [method];
48530
48627
  if (/\*$/.test(path11)) {
48531
48628
  const re2 = buildWildcardRegExp(path11);
48532
- Object.keys(middleware).forEach((m) => {
48533
- if ((method === METHOD_NAME_ALL || method === m) && !middleware[m][path11]) {
48629
+ for (const m of methods) {
48630
+ if (!middleware[m][path11]) {
48534
48631
  this.#insertPath(m, path11);
48535
48632
  middleware[m][path11] = findMiddleware(middleware[m], path11) || findMiddleware(middleware[METHOD_NAME_ALL], path11) || [];
48536
48633
  }
48537
- });
48538
- Object.keys(middleware).forEach((m) => {
48539
- if (method === METHOD_NAME_ALL || method === m) {
48540
- Object.keys(middleware[m]).forEach((p2) => {
48541
- re2.test(p2) && middleware[m][p2].push([handler, paramCount]);
48542
- });
48543
- }
48544
- });
48545
- Object.keys(routes).forEach((m) => {
48546
- if (method === METHOD_NAME_ALL || method === m) {
48547
- Object.keys(routes[m]).forEach(
48548
- (p2) => re2.test(p2) && routes[m][p2].push([handler, paramCount])
48549
- );
48634
+ }
48635
+ for (const handlerMap of [middleware, routes]) {
48636
+ for (const m of methods) {
48637
+ for (const p2 in handlerMap[m]) {
48638
+ re2.test(p2) && handlerMap[m][p2].push([handler, path11]);
48639
+ }
48550
48640
  }
48551
- });
48641
+ }
48552
48642
  return;
48553
48643
  }
48554
48644
  const paths = checkOptionalParameter(path11) || [path11];
48555
- for (let i = 0, len = paths.length; i < len; i++) {
48556
- const path22 = paths[i];
48557
- Object.keys(routes).forEach((m) => {
48558
- if (method === METHOD_NAME_ALL || method === m) {
48559
- if (!routes[m][path22]) {
48560
- this.#insertPath(m, path22);
48561
- routes[m][path22] = [
48562
- ...findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || []
48563
- ];
48564
- }
48565
- routes[m][path22].push([handler, paramCount - len + i + 1]);
48645
+ for (const path22 of paths) {
48646
+ for (const m of methods) {
48647
+ if (!routes[m][path22]) {
48648
+ this.#insertPath(m, path22);
48649
+ routes[m][path22] = findMiddleware(middleware[m], path22) || findMiddleware(middleware[METHOD_NAME_ALL], path22) || [];
48566
48650
  }
48567
- });
48651
+ routes[m][path22].push([handler, path22]);
48652
+ }
48568
48653
  }
48569
48654
  }
48570
48655
  match = match;
48571
48656
  buildAllMatchers() {
48572
- const matchers = /* @__PURE__ */ Object.create(null);
48573
- Object.keys(this.#routes).concat(Object.keys(this.#middleware)).forEach((method) => {
48574
- matchers[method] ||= this.#buildMatcher(method);
48575
- });
48657
+ const matchers = createNullObject();
48658
+ for (const method of Object.keys(this.#routes)) {
48659
+ matchers[method] = this.#buildMatcher(method);
48660
+ }
48576
48661
  this.#middleware = this.#routes = this.#tries = void 0;
48577
- clearWildcardRegExpCache();
48662
+ wildcardRegExpCache = createNullObject();
48578
48663
  return matchers;
48579
48664
  }
48580
48665
  #buildMatcher(method) {
48581
48666
  const middleware = this.#middleware[method];
48582
48667
  const routes = this.#routes[method];
48583
48668
  const trie = this.#tries[method];
48584
- const staticMap = /* @__PURE__ */ Object.create(null);
48669
+ const staticMap = createNullObject();
48585
48670
  const handlerData = [];
48586
- [middleware, routes].forEach((r) => {
48671
+ const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
48672
+ for (const r of [middleware, routes]) {
48587
48673
  for (const path11 in r) {
48588
48674
  const handlers = r[path11];
48589
48675
  const pathData = trie.paths[path11];
48590
48676
  if (!pathData) {
48591
- staticMap[path11] = [handlers.map(([h2]) => [h2, /* @__PURE__ */ Object.create(null)]), emptyParam];
48677
+ staticMap[path11] = [handlers.map(([h2]) => [h2, createNullObject()]), emptyParam];
48592
48678
  continue;
48593
48679
  }
48594
- const paramAssoc = pathData[1];
48595
- handlerData[pathData[0]] = handlers.map(([h2, paramCount]) => {
48596
- const paramIndexMap = /* @__PURE__ */ Object.create(null);
48597
- paramCount -= 1;
48598
- for (; paramCount >= 0; paramCount--) {
48599
- const [key2, value] = paramAssoc[paramCount];
48600
- paramIndexMap[key2] = value;
48601
- }
48602
- return [h2, paramIndexMap];
48603
- });
48680
+ handlerData[pathData[0]] = handlers.map(([h2, handlerPath]) => [
48681
+ h2,
48682
+ trie.paths[handlerPath][1].reduceRight((map2, [key2], i) => {
48683
+ map2[key2] = paramReplacementMap[pathData[1][i][1]];
48684
+ return map2;
48685
+ }, createNullObject())
48686
+ ]);
48604
48687
  }
48605
- });
48606
- const [regexp, indexReplacementMap, paramReplacementMap] = trie.buildRegExp();
48607
- for (let i = 0, len = handlerData.length; i < len; i++) {
48608
- for (let j = 0, len2 = handlerData[i].length; j < len2; j++) {
48609
- const map2 = handlerData[i][j]?.[1];
48610
- if (!map2) {
48611
- continue;
48612
- }
48613
- const keys2 = Object.keys(map2);
48614
- for (let k = 0, len3 = keys2.length; k < len3; k++) {
48615
- map2[keys2[k]] = paramReplacementMap[map2[keys2[k]]];
48616
- }
48617
- }
48618
- }
48619
- const handlerMap = [];
48620
- for (const i in indexReplacementMap) {
48621
- handlerMap[i] = handlerData[indexReplacementMap[i]];
48622
48688
  }
48623
- return [regexp, handlerMap, staticMap];
48689
+ return [regexp, indexReplacementMap.map((i) => handlerData[i]), staticMap];
48624
48690
  }
48625
48691
  };
48626
48692
 
48627
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/smart-router/router.js
48693
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/smart-router/router.js
48628
48694
  var SmartRouter = class {
48629
48695
  name = "SmartRouter";
48630
48696
  #routers = [];
@@ -48679,78 +48745,53 @@ var SmartRouter = class {
48679
48745
  }
48680
48746
  };
48681
48747
 
48682
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/trie-router/node.js
48683
- var emptyParams = /* @__PURE__ */ Object.create(null);
48684
- var hasChildren = (children2) => {
48685
- for (const _ in children2) {
48686
- return true;
48687
- }
48688
- return false;
48689
- };
48748
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/trie-router/node.js
48749
+ var emptyParams = createNullObject();
48750
+ var order2 = 0;
48690
48751
  var Node2 = class _Node2 {
48691
- #methods;
48692
- #children;
48693
- #patterns;
48694
- #order = 0;
48752
+ #methods = [];
48753
+ #children = createNullObject();
48754
+ #patterns = [];
48755
+ #pattern;
48695
48756
  #params = emptyParams;
48696
- constructor(method, handler, children2) {
48697
- this.#children = children2 || /* @__PURE__ */ Object.create(null);
48698
- this.#methods = [];
48699
- if (method && handler) {
48700
- const m = /* @__PURE__ */ Object.create(null);
48701
- m[method] = { handler, possibleKeys: [], score: 0 };
48702
- this.#methods = [m];
48703
- }
48704
- this.#patterns = [];
48705
- }
48706
48757
  insert(method, path11, handler) {
48707
- this.#order = ++this.#order;
48708
48758
  let curNode = this;
48709
48759
  const parts = splitRoutingPath(path11);
48710
- const possibleKeys = [];
48711
- for (let i = 0, len = parts.length; i < len; i++) {
48712
- const p2 = parts[i];
48713
- const nextP = parts[i + 1];
48714
- const pattern = getPattern(p2, nextP);
48715
- const key2 = Array.isArray(pattern) ? pattern[0] : p2;
48716
- if (key2 in curNode.#children) {
48717
- curNode = curNode.#children[key2];
48718
- if (pattern) {
48719
- possibleKeys.push(pattern[1]);
48720
- }
48721
- continue;
48760
+ const possibleKeys = /* @__PURE__ */ new Set();
48761
+ let i = 0;
48762
+ for (const p2 of parts) {
48763
+ const nextP = parts[++i];
48764
+ const pattern = getPattern(p2, nextP) || (nextP === void 0 && p2 && p2.indexOf("*") === p2.length - 1 ? p2 : null);
48765
+ const isParam = Array.isArray(pattern);
48766
+ const key2 = isParam ? pattern[0] : pattern || p2;
48767
+ const child = curNode.#children[key2] ||= new _Node2();
48768
+ if (pattern && !child.#pattern) {
48769
+ child.#pattern = pattern;
48770
+ curNode.#patterns.push(child);
48722
48771
  }
48723
- curNode.#children[key2] = new _Node2();
48724
- if (pattern) {
48725
- curNode.#patterns.push(pattern);
48726
- possibleKeys.push(pattern[1]);
48772
+ curNode = child;
48773
+ if (isParam) {
48774
+ possibleKeys.add(pattern[1]);
48727
48775
  }
48728
- curNode = curNode.#children[key2];
48729
48776
  }
48730
48777
  curNode.#methods.push({
48731
48778
  [method]: {
48732
48779
  handler,
48733
- possibleKeys: possibleKeys.filter((v, i, a) => a.indexOf(v) === i),
48734
- score: this.#order
48780
+ possibleKeys: [...possibleKeys],
48781
+ score: ++order2
48735
48782
  }
48736
48783
  });
48737
- return curNode;
48738
48784
  }
48739
48785
  #pushHandlerSets(handlerSets, node2, method, nodeParams, params) {
48740
48786
  for (let i = 0, len = node2.#methods.length; i < len; i++) {
48741
48787
  const m = node2.#methods[i];
48742
48788
  const handlerSet = m[method] || m[METHOD_NAME_ALL];
48743
- const processedSet = {};
48744
- if (handlerSet !== void 0) {
48745
- handlerSet.params = /* @__PURE__ */ Object.create(null);
48789
+ if (handlerSet) {
48790
+ handlerSet.params = createNullObject();
48746
48791
  handlerSets.push(handlerSet);
48747
- if (nodeParams !== emptyParams || params && params !== emptyParams) {
48748
- for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
48749
- const key2 = handlerSet.possibleKeys[i2];
48750
- const processed = processedSet[handlerSet.score];
48751
- handlerSet.params[key2] = params?.[key2] && !processed ? params[key2] : nodeParams[key2] ?? params?.[key2];
48752
- processedSet[handlerSet.score] = true;
48753
- }
48792
+ for (let i2 = 0, len2 = handlerSet.possibleKeys.length; i2 < len2; i2++) {
48793
+ const key2 = handlerSet.possibleKeys[i2];
48794
+ handlerSet.params[key2] = params?.[key2] && !i2 ? params[key2] : nodeParams[key2] ?? params?.[key2];
48754
48795
  }
48755
48796
  }
48756
48797
  }
@@ -48782,33 +48823,33 @@ var Node2 = class _Node2 {
48782
48823
  tempNodes.push(nextNode);
48783
48824
  }
48784
48825
  }
48785
- for (let k = 0, len3 = node2.#patterns.length; k < len3; k++) {
48786
- const pattern = node2.#patterns[k];
48826
+ for (const child of node2.#patterns) {
48827
+ const pattern = child.#pattern;
48787
48828
  const params = node2.#params === emptyParams ? {} : { ...node2.#params };
48788
- if (pattern === "*") {
48789
- const astNode = node2.#children["*"];
48790
- if (astNode) {
48791
- this.#pushHandlerSets(handlerSets, astNode, method, node2.#params);
48792
- astNode.#params = params;
48793
- tempNodes.push(astNode);
48829
+ if (typeof pattern === "string") {
48830
+ if (pattern === "*" || part.startsWith(pattern.slice(0, -1))) {
48831
+ this.#pushHandlerSets(handlerSets, child, method, node2.#params);
48832
+ if (pattern === "*") {
48833
+ child.#params = params;
48834
+ tempNodes.push(child);
48835
+ }
48794
48836
  }
48795
48837
  continue;
48796
48838
  }
48797
- const [key2, name, matcher] = pattern;
48798
- if (!part && !(matcher instanceof RegExp)) {
48839
+ const [, name, matcher] = pattern;
48840
+ if (!part && matcher === true) {
48799
48841
  continue;
48800
48842
  }
48801
- const child = node2.#children[key2];
48802
- if (matcher instanceof RegExp) {
48803
- if (partOffsets === null) {
48804
- partOffsets = new Array(len);
48843
+ if (matcher !== true) {
48844
+ if (!partOffsets) {
48845
+ partOffsets = [];
48805
48846
  let offset = path11[0] === "/" ? 1 : 0;
48806
48847
  for (let p2 = 0; p2 < len; p2++) {
48807
48848
  partOffsets[p2] = offset;
48808
48849
  offset += parts[p2].length + 1;
48809
48850
  }
48810
48851
  }
48811
- const restPathString = path11.substring(partOffsets[i]);
48852
+ const restPathString = path11.slice(partOffsets[i]);
48812
48853
  const m = matcher.exec(restPathString);
48813
48854
  if (m) {
48814
48855
  params[name] = m[0];
@@ -48822,11 +48863,12 @@ var Node2 = class _Node2 {
48822
48863
  params
48823
48864
  );
48824
48865
  }
48825
- if (hasChildren(child.#children)) {
48866
+ for (const _ in child.#children) {
48826
48867
  child.#params = params;
48827
48868
  const componentCount = m[0].match(/\//g)?.length ?? 0;
48828
48869
  const targetCurNodes = curNodesQueue[componentCount] ||= [];
48829
48870
  targetCurNodes.push(child);
48871
+ break;
48830
48872
  }
48831
48873
  continue;
48832
48874
  }
@@ -48854,7 +48896,7 @@ var Node2 = class _Node2 {
48854
48896
  const shifted = curNodesQueue.shift();
48855
48897
  curNodes = shifted ? tempNodes.concat(shifted) : tempNodes;
48856
48898
  }
48857
- if (handlerSets.length > 1) {
48899
+ if (handlerSets[1]) {
48858
48900
  handlerSets.sort((a, b) => {
48859
48901
  return a.score - b.score;
48860
48902
  });
@@ -48863,29 +48905,21 @@ var Node2 = class _Node2 {
48863
48905
  }
48864
48906
  };
48865
48907
 
48866
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/router/trie-router/router.js
48908
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/router/trie-router/router.js
48867
48909
  var TrieRouter = class {
48868
48910
  name = "TrieRouter";
48869
- #node;
48870
- constructor() {
48871
- this.#node = new Node2();
48872
- }
48911
+ #node = new Node2();
48873
48912
  add(method, path11, handler) {
48874
- const results = checkOptionalParameter(path11);
48875
- if (results) {
48876
- for (let i = 0, len = results.length; i < len; i++) {
48877
- this.#node.insert(method, results[i], handler);
48878
- }
48879
- return;
48913
+ for (const result of checkOptionalParameter(path11) || [path11]) {
48914
+ this.#node.insert(method, result, handler);
48880
48915
  }
48881
- this.#node.insert(method, path11, handler);
48882
48916
  }
48883
48917
  match(method, path11) {
48884
48918
  return this.#node.search(method, path11);
48885
48919
  }
48886
48920
  };
48887
48921
 
48888
- // node_modules/.pnpm/hono@4.13.1/node_modules/hono/dist/hono.js
48922
+ // node_modules/.pnpm/hono@4.13.7/node_modules/hono/dist/hono.js
48889
48923
  var Hono2 = class extends Hono {
48890
48924
  /**
48891
48925
  * Creates an instance of the Hono class.
@@ -49318,6 +49352,11 @@ var agentCommandInputSchemas = {
49318
49352
  limit: external_exports.number().int().min(1).max(MAX_COMMENT_LIST_LIMIT).default(DEFAULT_COMMENT_LIST_LIMIT),
49319
49353
  offset: external_exports.number().int().min(0).default(0)
49320
49354
  }).strict(),
49355
+ "walkthrough.list": external_exports.object({
49356
+ reference: nonEmptyString,
49357
+ limit: external_exports.number().int().min(1).max(MAX_WALKTHROUGH_LIST_LIMIT).default(DEFAULT_WALKTHROUGH_LIST_LIMIT),
49358
+ offset: external_exports.number().int().min(0).default(0)
49359
+ }).strict(),
49321
49360
  "comment.watch": external_exports.object({
49322
49361
  cursor: external_exports.string().min(1).max(512).optional(),
49323
49362
  limit: external_exports.number().int().min(1).max(MAX_COMMENT_WATCH_LIMIT)
@@ -50378,6 +50417,13 @@ async function dispatchAgentSocketRequest(service, rawRequest) {
50378
50417
  offset: input.offset
50379
50418
  });
50380
50419
  }
50420
+ case "walkthrough.list": {
50421
+ const input = parseOperationInput("walkthrough.list", request.input);
50422
+ return service.listWalkthroughsByReference(input.reference, {
50423
+ limit: input.limit,
50424
+ offset: input.offset
50425
+ });
50426
+ }
50381
50427
  case "comment.watch": {
50382
50428
  const input = parseOperationInput("comment.watch", request.input);
50383
50429
  return service.listCommentPostEvents(input.cursor, input.limit);
@@ -51151,6 +51197,10 @@ var commentListOptionsSchema = external_exports.object({
51151
51197
  limit: external_exports.coerce.number().int().min(1).max(MAX_COMMENT_LIST_LIMIT).default(DEFAULT_COMMENT_LIST_LIMIT),
51152
51198
  offset: external_exports.coerce.number().int().min(0).default(0)
51153
51199
  });
51200
+ var walkthroughListOptionsSchema = external_exports.object({
51201
+ limit: external_exports.coerce.number().int().min(1).max(MAX_WALKTHROUGH_LIST_LIMIT).default(DEFAULT_WALKTHROUGH_LIST_LIMIT),
51202
+ offset: external_exports.coerce.number().int().min(0).default(0)
51203
+ });
51154
51204
  var commentWatchOptionsSchema = external_exports.object({
51155
51205
  after: external_exports.string().min(1).max(512).optional(),
51156
51206
  interval: external_exports.coerce.number().int().min(1).max(MAX_COMMENT_WATCH_INTERVAL_SECONDS).default(DEFAULT_COMMENT_WATCH_INTERVAL_SECONDS),
@@ -51285,7 +51335,8 @@ var walkthroughOutputSchema = external_exports.object({
51285
51335
  authorLabel: external_exports.string().nullable(),
51286
51336
  diagramBindings: external_exports.record(external_exports.string(), external_exports.string()),
51287
51337
  references: external_exports.array(codeReferenceOutputSchema),
51288
- createdAt: external_exports.string()
51338
+ createdAt: external_exports.string(),
51339
+ updatedAt: external_exports.string()
51289
51340
  }).strict();
51290
51341
  var sourceExcerptOutputSchema = external_exports.object({
51291
51342
  startLine: external_exports.number().int(),
@@ -51359,6 +51410,30 @@ var commentListOutputSchema = external_exports.object({
51359
51410
  }).strict()
51360
51411
  )
51361
51412
  }).strict();
51413
+ var walkthroughListOutputSchema = external_exports.object({
51414
+ ok: external_exports.literal(true),
51415
+ pullRequest: commentPullRequestOutputSchema,
51416
+ walkthroughs: external_exports.array(
51417
+ external_exports.object({
51418
+ id: external_exports.uuid(),
51419
+ ref: external_exports.string().regex(
51420
+ /^rvw:\/\/walkthrough\/[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i
51421
+ ),
51422
+ title: external_exports.string(),
51423
+ sourceOid: external_exports.string().regex(/^[0-9a-f]{40,64}$/i),
51424
+ authorLabel: external_exports.string().nullable(),
51425
+ createdAt: external_exports.string()
51426
+ }).strict()
51427
+ ),
51428
+ page: external_exports.object({
51429
+ offset: external_exports.number().int().min(0),
51430
+ limit: external_exports.number().int().min(1).max(MAX_WALKTHROUGH_LIST_LIMIT),
51431
+ returned: external_exports.number().int().min(0),
51432
+ total: external_exports.number().int().min(0),
51433
+ hasMore: external_exports.boolean(),
51434
+ nextOffset: external_exports.number().int().min(0).nullable()
51435
+ }).strict()
51436
+ }).strict();
51362
51437
 
51363
51438
  // src/cli/comment-protocol.ts
51364
51439
  function truncateUtf82(value, maxBytes) {
@@ -51497,6 +51572,16 @@ function formatCommentListOutput(result, state) {
51497
51572
  });
51498
51573
  }
51499
51574
 
51575
+ // src/cli/walkthrough-protocol.ts
51576
+ function formatWalkthroughListOutput(result) {
51577
+ return walkthroughListOutputSchema.parse({
51578
+ ok: true,
51579
+ pullRequest: formatPullRequest(result.pullRequest),
51580
+ walkthroughs: result.walkthroughs,
51581
+ page: result.page
51582
+ });
51583
+ }
51584
+
51500
51585
  // src/cli/main.ts
51501
51586
  var MAX_STDIN_BYTES = MAX_CLI_STDIN_BYTES;
51502
51587
  var OPEN_WORKER_READY_TIMEOUT_MS = 12e4;
@@ -52129,6 +52214,7 @@ function createProgram(runtimeFactory = defaultRuntimeFactory) {
52129
52214
  "structure.publish",
52130
52215
  "structure.update",
52131
52216
  "structure.delete",
52217
+ "walkthrough.list",
52132
52218
  "walkthrough.read",
52133
52219
  "walkthrough.publish",
52134
52220
  "walkthrough.update",
@@ -52360,6 +52446,22 @@ function createProgram(runtimeFactory = defaultRuntimeFactory) {
52360
52446
  );
52361
52447
  writeJson({ ok: true, walkthrough: published });
52362
52448
  });
52449
+ walkthrough.command("list").argument("<pull-request>", "\u767B\u9332\u6E08\u307FPR URL\u307E\u305F\u306F\u756A\u53F7").option(
52450
+ "--limit <limit>",
52451
+ `1\u30DA\u30FC\u30B8\u306E\u6700\u5927\u4EF6\u6570\uFF08\u65E2\u5B9A: ${DEFAULT_WALKTHROUGH_LIST_LIMIT}\uFF09`,
52452
+ String(DEFAULT_WALKTHROUGH_LIST_LIMIT)
52453
+ ).option("--offset <offset>", "\u53D6\u5F97\u958B\u59CB\u4F4D\u7F6E\uFF08\u65E2\u5B9A: 0\uFF09", "0").requiredOption("--json", "JSON\u3067\u51FA\u529B").description("Pull Request\u306EWalkthrough\u4E00\u89A7\u3068stable URI\u3092\u53D6\u5F97").action(async (reference, rawOptions) => {
52454
+ const options = walkthroughListOptionsSchema.parse(rawOptions);
52455
+ const result = await callService(
52456
+ "walkthrough.list",
52457
+ { reference, limit: options.limit, offset: options.offset },
52458
+ () => getRuntime().service.listWalkthroughsByReference(reference, {
52459
+ limit: options.limit,
52460
+ offset: options.offset
52461
+ })
52462
+ );
52463
+ writeJson(formatWalkthroughListOutput(result));
52464
+ });
52363
52465
  walkthrough.command("get").argument("<walkthrough-uri>").requiredOption("--json", "JSON\u3067\u51FA\u529B").description("walkthrough\u306E\u73FE\u5728\u5185\u5BB9\u3092\u53D6\u5F97").action(async (uri) => {
52364
52466
  const result = await callService(
52365
52467
  "walkthrough.get",