@apilift/cli 1.9.2 → 1.10.0-dev.1794876578.8eff172eb6497088efda4a276f9b2871d8777852

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.
@@ -9349,8 +9349,8 @@ var capitalizeFirstCharacter, error33;
9349
9349
  var init_lt = __esm({
9350
9350
  "../../node_modules/.pnpm/zod@4.6.5/node_modules/zod/v4/locales/lt.js"() {
9351
9351
  init_util();
9352
- capitalizeFirstCharacter = (text6) => {
9353
- return text6.charAt(0).toUpperCase() + text6.slice(1);
9352
+ capitalizeFirstCharacter = (text7) => {
9353
+ return text7.charAt(0).toUpperCase() + text7.slice(1);
9354
9354
  };
9355
9355
  error33 = () => {
9356
9356
  const Sizable = {
@@ -20819,6 +20819,7 @@ var init_errors3 = __esm({
20819
20819
  "publication-budget": "limit",
20820
20820
  "publication-throttled": "limit",
20821
20821
  "session-limit": "limit",
20822
+ "feedback-throttled": "limit",
20822
20823
  "client-upgrade-required": "upgrade",
20823
20824
  "backend-unavailable": "unavailable",
20824
20825
  "storage-unavailable": "unavailable",
@@ -25150,7 +25151,7 @@ var require_core = __commonJS({
25150
25151
  errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
25151
25152
  if (!errors || errors.length === 0)
25152
25153
  return "No errors";
25153
- return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text6, msg) => text6 + separator + msg);
25154
+ return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text7, msg) => text7 + separator + msg);
25154
25155
  }
25155
25156
  $dataMetaSchema(metaSchema, keywordsJsonPointers) {
25156
25157
  const rules = this.RULES.all;
@@ -29273,6 +29274,71 @@ var init_definitions = __esm({
29273
29274
  }
29274
29275
  });
29275
29276
 
29277
+ // ../../packages/core/dist/api/feedback.js
29278
+ function feedbackTextBytes(text7) {
29279
+ return new TextEncoder().encode(text7).length;
29280
+ }
29281
+ function isFeedbackText(text7) {
29282
+ return !Array.from(text7).some((c) => {
29283
+ const code = c.charCodeAt(0);
29284
+ return code === 127 || code < 32 && ![9, 10, 13].includes(code);
29285
+ });
29286
+ }
29287
+ var text, safeLabel, feedbackMetadataSchema, feedbackAttachmentSchema, feedbackReportSchema, feedbackStatusSchema;
29288
+ var init_feedback = __esm({
29289
+ "../../packages/core/dist/api/feedback.js"() {
29290
+ "use strict";
29291
+ init_zod();
29292
+ text = external_exports.string().trim().min(1).max(2e3);
29293
+ safeLabel = external_exports.string().min(1).max(120).regex(/^[A-Za-z0-9._-]+$/u);
29294
+ feedbackMetadataSchema = external_exports.strictObject({
29295
+ cliVersion: safeLabel,
29296
+ platform: safeLabel,
29297
+ agent: external_exports.enum(["codex", "claude", "other"]),
29298
+ occurredAt: external_exports.iso.datetime({ offset: true }),
29299
+ invocation: external_exports.strictObject({
29300
+ id: external_exports.uuid(),
29301
+ command: safeLabel,
29302
+ exitCode: external_exports.number().int().min(0).max(255),
29303
+ startedAt: external_exports.iso.datetime({ offset: true }),
29304
+ finishedAt: external_exports.iso.datetime({ offset: true }),
29305
+ diagnostic: safeLabel.optional(),
29306
+ executionId: external_exports.uuid().optional(),
29307
+ discoveryId: external_exports.uuid().optional()
29308
+ }).optional()
29309
+ });
29310
+ feedbackAttachmentSchema = external_exports.strictObject({
29311
+ name: external_exports.string().min(1).max(120).regex(/^[A-Za-z0-9][A-Za-z0-9._-]*$/u),
29312
+ text: external_exports.string().refine(isFeedbackText, "Expected plain UTF-8 text").refine((v2) => feedbackTextBytes(v2) <= 65536, "Attachment exceeds 64 KiB")
29313
+ });
29314
+ feedbackReportSchema = external_exports.strictObject({
29315
+ id: external_exports.uuid(),
29316
+ kind: external_exports.enum(["apilift", "action"]),
29317
+ blocked: text,
29318
+ repro: text,
29319
+ expected: text,
29320
+ actual: text,
29321
+ comment: text.optional(),
29322
+ app: external_exports.string().min(1).max(120).regex(/^[a-z0-9][a-z0-9-]*$/u).optional(),
29323
+ action: external_exports.string().max(120).regex(/^[a-z][a-z0-9-]*\.[a-z][a-z0-9-]*$/u).optional(),
29324
+ executionId: external_exports.uuid().optional(),
29325
+ incorrectResult: external_exports.literal(true).optional(),
29326
+ metadata: feedbackMetadataSchema,
29327
+ attachments: external_exports.array(feedbackAttachmentSchema).max(5)
29328
+ }).superRefine((v2, ctx) => {
29329
+ if (v2.kind === "action" ? !v2.app || !v2.action : v2.app !== void 0 || v2.action !== void 0 || v2.executionId !== void 0 || v2.incorrectResult !== void 0)
29330
+ ctx.addIssue({ code: "custom", message: "Action reports require app and action; general reports have no action target" });
29331
+ if (v2.incorrectResult && !v2.executionId)
29332
+ ctx.addIssue({ code: "custom", message: "Incorrect-result feedback requires an owned execution" });
29333
+ if (v2.attachments.reduce((n, a) => n + feedbackTextBytes(a.text), 0) > 262144)
29334
+ ctx.addIssue({ code: "custom", message: "Attachments exceed 256 KiB combined" });
29335
+ if (new Set(v2.attachments.map((a) => a.name)).size !== v2.attachments.length)
29336
+ ctx.addIssue({ code: "custom", message: "Attachment names must be distinct" });
29337
+ });
29338
+ feedbackStatusSchema = external_exports.enum(["new", "triaged", "resolved", "duplicate", "dismissed"]);
29339
+ }
29340
+ });
29341
+
29276
29342
  // ../../packages/core/dist/api/contracts.js
29277
29343
  function apiContract(method, path2, auth, params, query, body, response, errors = []) {
29278
29344
  const common = ["invalid-request", "client-upgrade-required", "backend-unavailable"];
@@ -29289,6 +29355,7 @@ var init_contracts = __esm({
29289
29355
  init_zod();
29290
29356
  init_definitions();
29291
29357
  init_errors3();
29358
+ init_feedback();
29292
29359
  str = external_exports.string().min(1);
29293
29360
  uuid3 = external_exports.uuid();
29294
29361
  iso = external_exports.iso.datetime({ offset: true });
@@ -29339,6 +29406,7 @@ var init_contracts = __esm({
29339
29406
  resourceBatchSchema = external_exports.strictObject({ mode: external_exports.literal("complete-replacement").optional(), resources: external_exports.array(resourcePublicationSchema).min(1).max(128) }).refine((value) => new Set(value.resources.map((r) => `${r.kind}:${r.name}`)).size === value.resources.length, "Select each resource once").refine((value) => new Set(value.resources.map((r) => r.requestId)).size === value.resources.length, "Use distinct resource request ids");
29340
29407
  page = (item) => external_exports.strictObject({ items: external_exports.array(item), nextCursor: str.nullable().optional() });
29341
29408
  apiContracts = {
29409
+ submitFeedback: apiContract("POST", "/api/v1/feedback", "installation", noParams, noQuery, feedbackReportSchema, external_exports.strictObject({ id: uuid3, status: external_exports.enum(["accepted", "duplicate"]) }), ["feedback-throttled", "request-replay-mismatch", "execution-not-found", "app-not-found"]),
29342
29410
  executionFeedback: apiContract("POST", "/api/v1/executions/{executionId}/feedback", "installation", external_exports.strictObject({ executionId: uuid3 }), noQuery, executionFeedbackSchema, external_exports.strictObject({ status: external_exports.enum(["accepted", "duplicate"]) }), ["execution-not-found"]),
29343
29411
  publishResources: apiContract("PUT", "/api/v1/apps/{app}/resources", "installation", external_exports.strictObject({ app: str }), noQuery, resourceBatchSchema, external_exports.strictObject({ results: external_exports.array(external_exports.union([
29344
29412
  external_exports.strictObject({ kind: resourceKindSchema, name: str, status: external_exports.enum(["published", "unchanged"]), publication: resourcePublicationResultSchema, currentVersion: external_exports.number().int().positive().nullable().optional() }),
@@ -29424,6 +29492,7 @@ var init_api2 = __esm({
29424
29492
  init_errors3();
29425
29493
  init_contracts();
29426
29494
  init_client();
29495
+ init_feedback();
29427
29496
  }
29428
29497
  });
29429
29498
 
@@ -30178,14 +30247,14 @@ var init_BytePairEncodingCore = __esm({
30178
30247
  clearMergeCache() {
30179
30248
  this.mergeCache?.clear();
30180
30249
  }
30181
- *encodeNativeGenerator(text6, allowedSpecial) {
30250
+ *encodeNativeGenerator(text7, allowedSpecial) {
30182
30251
  let startIndex = 0;
30183
30252
  let lastTokenLength = 0;
30184
30253
  while (true) {
30185
- const nextSpecialMatch = this.findNextSpecialToken(text6, allowedSpecial, startIndex);
30254
+ const nextSpecialMatch = this.findNextSpecialToken(text7, allowedSpecial, startIndex);
30186
30255
  const nextSpecialStartIndex = nextSpecialMatch?.[0];
30187
- const endIndex = nextSpecialStartIndex ?? text6.length;
30188
- const textBeforeSpecial = startIndex === 0 && endIndex === text6.length ? text6 : text6.slice(startIndex, endIndex);
30256
+ const endIndex = nextSpecialStartIndex ?? text7.length;
30257
+ const textBeforeSpecial = startIndex === 0 && endIndex === text7.length ? text7 : text7.slice(startIndex, endIndex);
30189
30258
  for (const [match2] of textBeforeSpecial.matchAll(this.tokenSplitRegex)) {
30190
30259
  const token = this.getBpeRankFromString(match2);
30191
30260
  if (token !== void 0) {
@@ -30208,14 +30277,14 @@ var init_BytePairEncodingCore = __esm({
30208
30277
  }
30209
30278
  return lastTokenLength;
30210
30279
  }
30211
- encodeNative(text6, allowedSpecial) {
30280
+ encodeNative(text7, allowedSpecial) {
30212
30281
  let startIndex = 0;
30213
30282
  const tokensArray = [];
30214
30283
  while (true) {
30215
- const nextSpecialMatch = this.findNextSpecialToken(text6, allowedSpecial, startIndex);
30284
+ const nextSpecialMatch = this.findNextSpecialToken(text7, allowedSpecial, startIndex);
30216
30285
  const nextSpecialStartIndex = nextSpecialMatch?.[0];
30217
- const endIndex = nextSpecialStartIndex ?? text6.length;
30218
- const textBeforeSpecial = startIndex === 0 && endIndex === text6.length ? text6 : text6.slice(startIndex, endIndex);
30286
+ const endIndex = nextSpecialStartIndex ?? text7.length;
30287
+ const textBeforeSpecial = startIndex === 0 && endIndex === text7.length ? text7 : text7.slice(startIndex, endIndex);
30219
30288
  for (const [match2] of textBeforeSpecial.matchAll(this.tokenSplitRegex)) {
30220
30289
  const token = this.getBpeRankFromString(match2);
30221
30290
  if (token !== void 0) {
@@ -30235,14 +30304,14 @@ var init_BytePairEncodingCore = __esm({
30235
30304
  }
30236
30305
  return tokensArray;
30237
30306
  }
30238
- countNative(text6, allowedSpecial) {
30307
+ countNative(text7, allowedSpecial) {
30239
30308
  let startIndex = 0;
30240
30309
  let tokensCount = 0;
30241
30310
  while (true) {
30242
- const nextSpecialMatch = this.findNextSpecialToken(text6, allowedSpecial, startIndex);
30311
+ const nextSpecialMatch = this.findNextSpecialToken(text7, allowedSpecial, startIndex);
30243
30312
  const nextSpecialStartIndex = nextSpecialMatch?.[0];
30244
- const endIndex = nextSpecialStartIndex ?? text6.length;
30245
- const textBeforeSpecial = startIndex === 0 && endIndex === text6.length ? text6 : text6.slice(startIndex, endIndex);
30313
+ const endIndex = nextSpecialStartIndex ?? text7.length;
30314
+ const textBeforeSpecial = startIndex === 0 && endIndex === text7.length ? text7 : text7.slice(startIndex, endIndex);
30246
30315
  for (const [match2] of textBeforeSpecial.matchAll(this.tokenSplitRegex)) {
30247
30316
  if (this.getBpeRankFromString(match2) !== void 0) {
30248
30317
  tokensCount++;
@@ -30332,11 +30401,11 @@ var init_BytePairEncodingCore = __esm({
30332
30401
  }
30333
30402
  return -1;
30334
30403
  }
30335
- findNextSpecialToken(text6, allowedSpecial, startIndex) {
30404
+ findNextSpecialToken(text7, allowedSpecial, startIndex) {
30336
30405
  let searchIndex = startIndex;
30337
30406
  while (true) {
30338
30407
  this.specialTokenPatternRegex.lastIndex = searchIndex;
30339
- const nextSpecialMatch = this.specialTokenPatternRegex.exec(text6);
30408
+ const nextSpecialMatch = this.specialTokenPatternRegex.exec(text7);
30340
30409
  if (!nextSpecialMatch) return;
30341
30410
  const specialToken = nextSpecialMatch[0];
30342
30411
  if (allowedSpecial?.has(specialToken)) return [nextSpecialMatch.index + searchIndex, specialToken];
@@ -31033,7 +31102,7 @@ var init_GptEncoding = __esm({
31033
31102
  const harmonyChannel = this.specialTokensEncoder.get(HarmonyChannel);
31034
31103
  const harmonyConstrain = this.specialTokensEncoder.get(HarmonyConstrain);
31035
31104
  if (harmonyStart === void 0 || harmonyMessage === void 0 || harmonyEnd === void 0 || harmonyReturn === void 0 || harmonyCall === void 0 || harmonyChannel === void 0 || harmonyConstrain === void 0) throw new Error("Harmony chat format requires dedicated special tokens.");
31036
- const encodeHeaderText = (text6) => text6.length > 0 ? this.encode(text6) : [];
31105
+ const encodeHeaderText = (text7) => text7.length > 0 ? this.encode(text7) : [];
31037
31106
  const resolveTerminatorToken = (terminator) => {
31038
31107
  switch (terminator) {
31039
31108
  case "<|return|>":
@@ -31212,12 +31281,12 @@ var init_GptEncoding = __esm({
31212
31281
  for (const tokens of tokenGenerator) count += tokens.length;
31213
31282
  return count;
31214
31283
  }
31215
- countStringTokens(text6) {
31216
- if (!text6) return 0;
31217
- return this.bytePairEncodingCoreProcessor.countNative(text6);
31284
+ countStringTokens(text7) {
31285
+ if (!text7) return 0;
31286
+ return this.bytePairEncodingCoreProcessor.countNative(text7);
31218
31287
  }
31219
31288
  countChatCompletionTokensInternal(request2) {
31220
- return computeChatCompletionTokenCount(request2, (text6) => this.countStringTokens(text6));
31289
+ return computeChatCompletionTokenCount(request2, (text7) => this.countStringTokens(text7));
31221
31290
  }
31222
31291
  setMergeCacheSize(size) {
31223
31292
  this.bytePairEncodingCoreProcessor.setMergeCacheSize(size);
@@ -164526,7 +164595,7 @@ Compared to other leading proprietary and open-weights models Command A delivers
164526
164595
  });
164527
164596
 
164528
164597
  // ../../packages/core/dist/pricing/catalog.js
164529
- var amount, tier, prices, text, regex, match, date5, time3, constraint, provider;
164598
+ var amount, tier, prices, text2, regex, match, date5, time3, constraint, provider;
164530
164599
  var init_catalog = __esm({
164531
164600
  "../../packages/core/dist/pricing/catalog.js"() {
164532
164601
  "use strict";
@@ -164535,8 +164604,8 @@ var init_catalog = __esm({
164535
164604
  amount = external_exports.number().finite().nonnegative();
164536
164605
  tier = external_exports.object({ base: amount, tiers: external_exports.array(external_exports.object({ start: external_exports.number().int().nonnegative(), price: amount })) }).refine((value) => value.tiers.every((row, index2) => index2 === 0 || row.start > value.tiers[index2 - 1].start));
164537
164606
  prices = external_exports.record(external_exports.string(), external_exports.union([amount, tier]));
164538
- text = external_exports.string().min(1).max(1e3);
164539
- regex = text.refine((value) => {
164607
+ text2 = external_exports.string().min(1).max(1e3);
164608
+ regex = text2.refine((value) => {
164540
164609
  try {
164541
164610
  new RegExp(value);
164542
164611
  return true;
@@ -164545,10 +164614,10 @@ var init_catalog = __esm({
164545
164614
  }
164546
164615
  });
164547
164616
  match = external_exports.lazy(() => external_exports.union([
164548
- external_exports.object({ equals: text }),
164549
- external_exports.object({ starts_with: text }),
164550
- external_exports.object({ ends_with: text }),
164551
- external_exports.object({ contains: text }),
164617
+ external_exports.object({ equals: text2 }),
164618
+ external_exports.object({ starts_with: text2 }),
164619
+ external_exports.object({ ends_with: text2 }),
164620
+ external_exports.object({ contains: text2 }),
164552
164621
  external_exports.object({ regex }),
164553
164622
  external_exports.object({ and: external_exports.array(match).min(1) }),
164554
164623
  external_exports.object({ or: external_exports.array(match).min(1) })
@@ -164561,9 +164630,9 @@ var init_catalog = __esm({
164561
164630
  ]);
164562
164631
  provider = external_exports.object({
164563
164632
  id: external_exports.enum(["openai", "anthropic"]),
164564
- name: text,
164633
+ name: text2,
164565
164634
  api_pattern: regex,
164566
- models: external_exports.array(external_exports.object({ id: text, match, prices: external_exports.union([prices, external_exports.array(external_exports.object({ constraint: constraint.optional(), prices })).min(1)]) })).min(1)
164635
+ models: external_exports.array(external_exports.object({ id: text2, match, prices: external_exports.union([prices, external_exports.array(external_exports.object({ constraint: constraint.optional(), prices })).min(1)]) })).min(1)
164567
164636
  });
164568
164637
  }
164569
164638
  });
@@ -164616,9 +164685,9 @@ var init_pricing = __esm({
164616
164685
  });
164617
164686
 
164618
164687
  // src/usage/receipts.ts
164619
- function receiptIds(text6) {
164688
+ function receiptIds(text7) {
164620
164689
  const ids = /* @__PURE__ */ new Set();
164621
- for (const match2 of text6.matchAll(RECEIPT)) {
164690
+ for (const match2 of text7.matchAll(RECEIPT)) {
164622
164691
  if (match2[1]) {
164623
164692
  ids.add(match2[1].toLowerCase());
164624
164693
  continue;
@@ -164655,7 +164724,7 @@ function readable(v2) {
164655
164724
  }
164656
164725
  if (Array.isArray(v2)) return v2.map((b2) => {
164657
164726
  const item = obj(b2);
164658
- return text2(item.text) || (item.type === "image" || item.type === "image_url" ? "[media omitted]" : "");
164727
+ return text3(item.text) || (item.type === "image" || item.type === "image_url" ? "[media omitted]" : "");
164659
164728
  }).filter(Boolean).join("\n");
164660
164729
  return JSON.stringify(v2 ?? "");
164661
164730
  }
@@ -164664,9 +164733,9 @@ function literalShellWords(command) {
164664
164733
  let shell = null;
164665
164734
  try {
164666
164735
  const args = obj(JSON.parse(command));
164667
- source = text2(args.cmd) || text2(args.command) || command;
164668
- if (/(?:^|[\\/])(?:powershell|pwsh|cmd)(?:\.exe)?$/iu.test(text2(args.shell))) shell = "windows";
164669
- else if (/(?:^|[\\/])(?:bash|zsh|sh)(?:\.exe)?$/iu.test(text2(args.shell))) shell = "posix";
164736
+ source = text3(args.cmd) || text3(args.command) || command;
164737
+ if (/(?:^|[\\/])(?:powershell|pwsh|cmd)(?:\.exe)?$/iu.test(text3(args.shell))) shell = "windows";
164738
+ else if (/(?:^|[\\/])(?:bash|zsh|sh)(?:\.exe)?$/iu.test(text3(args.shell))) shell = "posix";
164670
164739
  } catch {
164671
164740
  }
164672
164741
  source = source.replace(/\s+2>&1\s*$/u, "");
@@ -164741,7 +164810,7 @@ function category(name, command) {
164741
164810
  let source = command;
164742
164811
  try {
164743
164812
  const args = obj(JSON.parse(command));
164744
- source = text2(args.cmd) || text2(args.command) || command;
164813
+ source = text3(args.cmd) || text3(args.command) || command;
164745
164814
  } catch {
164746
164815
  }
164747
164816
  const outputOnly = source.replace(/\s*\|\s*(?:head|tail)\s+(?:-n\s+)?\d+\s*$/u, "");
@@ -164818,8 +164887,8 @@ function documentationArguments(name, args, kind) {
164818
164887
  let command = args, file3 = "";
164819
164888
  try {
164820
164889
  const parameters = obj(JSON.parse(args));
164821
- command = text2(parameters.cmd ?? parameters.command);
164822
- if (/^(?:read|read_file)$/iu.test(name)) file3 = text2(parameters.file_path ?? parameters.path);
164890
+ command = text3(parameters.cmd ?? parameters.command);
164891
+ if (/^(?:read|read_file)$/iu.test(name)) file3 = text3(parameters.file_path ?? parameters.path);
164823
164892
  } catch {
164824
164893
  }
164825
164894
  const local = /^cat\s+(?:"([^"]+)"|'([^']+)'|([^\s"';&|]+))$/u.exec(command);
@@ -164835,7 +164904,7 @@ function browserControl(name, args) {
164835
164904
  if (/(?:^|__|[.])(?:getState|completion_summary|list_tools|list_tabs|status|wait|sleep)$/iu.test(name)) return true;
164836
164905
  try {
164837
164906
  const parameters = obj(JSON.parse(args));
164838
- return Object.hasOwn(parameters, "completion_summary") || /^\s*(?:await\s+)?(?:cua\.getState|cua\.rewriteDocumentation)\(\s*\)\s*;?\s*$/u.test(text2(parameters.code));
164907
+ return Object.hasOwn(parameters, "completion_summary") || /^\s*(?:await\s+)?(?:cua\.getState|cua\.rewriteDocumentation)\(\s*\)\s*;?\s*$/u.test(text3(parameters.code));
164839
164908
  } catch {
164840
164909
  return false;
164841
164910
  }
@@ -164887,7 +164956,7 @@ function transcriptPaths(agent2, nativeId, env, limit = 64) {
164887
164956
  }
164888
164957
  });
164889
164958
  }
164890
- var MAX_LINE, CHUNK, num, version2, text2, obj, timestamp, receipts, digest2, documentPath, TranscriptParser, TranscriptRead;
164959
+ var MAX_LINE, CHUNK, num, version2, text3, obj, timestamp, receipts, digest2, documentPath, TranscriptParser, TranscriptRead;
164891
164960
  var init_transcript = __esm({
164892
164961
  "src/usage/transcript.ts"() {
164893
164962
  "use strict";
@@ -164897,10 +164966,10 @@ var init_transcript = __esm({
164897
164966
  CHUNK = 64 * 1024;
164898
164967
  num = (v2) => typeof v2 === "number" && Number.isFinite(v2) && v2 >= 0 ? v2 : null;
164899
164968
  version2 = (v2) => typeof v2 === "string" && /^[0-9][A-Za-z0-9.+_-]{0,79}$/u.test(v2) ? v2 : "unknown";
164900
- text2 = (v2) => typeof v2 === "string" ? v2 : "";
164969
+ text3 = (v2) => typeof v2 === "string" ? v2 : "";
164901
164970
  obj = (v2) => v2 && typeof v2 === "object" && !Array.isArray(v2) ? v2 : {};
164902
164971
  timestamp = (v2) => {
164903
- const n = Date.parse(text2(v2));
164972
+ const n = Date.parse(text3(v2));
164904
164973
  return Number.isFinite(n) ? n : null;
164905
164974
  };
164906
164975
  receipts = receiptIds;
@@ -165033,25 +165102,25 @@ var init_transcript = __esm({
165033
165102
  else this.gap(this.lastAt, "Malformed native record");
165034
165103
  return;
165035
165104
  }
165036
- const payload = obj(row.payload), message = obj(row.message), kind = text2(row.type), at = timestamp(row.timestamp);
165105
+ const payload = obj(row.payload), message = obj(row.message), kind = text3(row.type), at = timestamp(row.timestamp);
165037
165106
  this.lastAt = at ?? this.lastAt;
165038
165107
  if (kind === "session_meta") {
165039
165108
  this.facts.sourceVersion = version2(payload.cli_version);
165040
165109
  this.facts.runtime = "codex";
165041
- this.facts.sessionId = text2(payload.id || payload.session_id) || null;
165110
+ this.facts.sessionId = text3(payload.id || payload.session_id) || null;
165042
165111
  this.thread = this.facts.sessionId;
165043
- this.provider = text2(payload.model_provider) || null;
165112
+ this.provider = text3(payload.model_provider) || null;
165044
165113
  return;
165045
165114
  }
165046
- if (text2(row.sessionId)) {
165115
+ if (text3(row.sessionId)) {
165047
165116
  this.facts.runtime = "claude";
165048
- const identity2 = text2(row.sessionId) + (row.agentId ? `:agent:${text2(row.agentId)}` : "");
165117
+ const identity2 = text3(row.sessionId) + (row.agentId ? `:agent:${text3(row.agentId)}` : "");
165049
165118
  this.facts.sessionId ||= identity2;
165050
165119
  if (identity2 !== this.facts.sessionId) return;
165051
165120
  this.thread = identity2;
165052
165121
  }
165053
165122
  if (kind === "event_msg" && payload.type === "task_started") {
165054
- const id2 = text2(payload.turn_id);
165123
+ const id2 = text3(payload.turn_id);
165055
165124
  if (id2) {
165056
165125
  this.currentTask = id2;
165057
165126
  this.task(id2, at);
@@ -165059,8 +165128,8 @@ var init_transcript = __esm({
165059
165128
  }
165060
165129
  return;
165061
165130
  }
165062
- if (kind === "event_msg" && ["task_complete", "task_completed", "turn_aborted", "task_failed"].includes(text2(payload.type))) {
165063
- const id2 = text2(payload.turn_id);
165131
+ if (kind === "event_msg" && ["task_complete", "task_completed", "turn_aborted", "task_failed"].includes(text3(payload.type))) {
165132
+ const id2 = text3(payload.turn_id);
165064
165133
  if (id2) {
165065
165134
  const task = this.task(id2, null);
165066
165135
  task.finishedAt = at;
@@ -165069,12 +165138,12 @@ var init_transcript = __esm({
165069
165138
  this.currentTask = null;
165070
165139
  return;
165071
165140
  }
165072
- if (kind === "turn_context" && text2(payload.turn_id)) {
165073
- this.currentTask = text2(payload.turn_id);
165141
+ if (kind === "turn_context" && text3(payload.turn_id)) {
165142
+ this.currentTask = text3(payload.turn_id);
165074
165143
  this.task(this.currentTask, null);
165075
165144
  }
165076
165145
  if (kind === "turn_context") {
165077
- this.model = text2(payload.model) || this.model;
165146
+ this.model = text3(payload.model) || this.model;
165078
165147
  if (this.current && !this.current.final) this.current.model = this.model;
165079
165148
  return;
165080
165149
  }
@@ -165083,9 +165152,9 @@ var init_transcript = __esm({
165083
165152
  return;
165084
165153
  }
165085
165154
  if (kind === "token_usage_record") {
165086
- const id2 = text2(payload.response_id);
165155
+ const id2 = text3(payload.response_id);
165087
165156
  if (id2 && this.usageIds.has(id2)) return;
165088
- const owner = text2(payload.thread_id) || this.thread;
165157
+ const owner = text3(payload.thread_id) || this.thread;
165089
165158
  if (this.facts.sessionId && owner && owner !== this.facts.sessionId) return;
165090
165159
  const req = this.current && (!this.current.final || !this.current.id) ? this.current : this.request(at);
165091
165160
  req.id = id2 || null;
@@ -165103,35 +165172,35 @@ var init_transcript = __esm({
165103
165172
  }
165104
165173
  if (kind === "event_msg" && payload.type === "user_message") {
165105
165174
  this.current = null;
165106
- this.record(`user:${this.facts.sourceLines}`, "message", "user", at, text2(payload.message), null);
165175
+ this.record(`user:${this.facts.sourceLines}`, "message", "user", at, text3(payload.message), null);
165107
165176
  return;
165108
165177
  }
165109
165178
  if (kind === "response_item") {
165110
165179
  this.facts.runtime = "codex";
165111
- const type = text2(payload.type), id2 = text2(payload.call_id), name = text2(payload.name);
165180
+ const type = text3(payload.type), id2 = text3(payload.call_id), name = text3(payload.name);
165112
165181
  if (type === "function_call" || type === "custom_tool_call") {
165113
- this.call(id2, name, text2(payload.arguments ?? payload.input), at, this.request(at));
165182
+ this.call(id2, name, text3(payload.arguments ?? payload.input), at, this.request(at));
165114
165183
  } else if (type === "function_call_output" || type === "custom_tool_call_output") {
165115
165184
  this.result(id2, readable(payload.output), at);
165116
165185
  } else if (type === "message") {
165117
- const role = text2(payload.role), value = readable(payload.content), mid = text2(payload.id) || `message:${this.facts.sourceLines}`;
165186
+ const role = text3(payload.role), value = readable(payload.content), mid = text3(payload.id) || `message:${this.facts.sourceLines}`;
165118
165187
  if (role === "user" && this.facts.records.some((r) => r.kind === "message" && r.name === "user" && r.startedAt === at)) return;
165119
165188
  this.record(mid, "message", role, at, value, role === "assistant" ? this.request(at) : null, role === "assistant");
165120
165189
  } else if (type === "reasoning") {
165121
165190
  const value = readable(payload.summary);
165122
- this.record(text2(payload.id) || `summary:${this.facts.sourceLines}`, "summary", "reasoning summary", at, value, this.records.has(text2(payload.id)) ? this.current : this.request(at), true);
165191
+ this.record(text3(payload.id) || `summary:${this.facts.sourceLines}`, "summary", "reasoning summary", at, value, this.records.has(text3(payload.id)) ? this.current : this.request(at), true);
165123
165192
  }
165124
165193
  return;
165125
165194
  }
165126
165195
  if (kind === "event_msg" && payload.type === "item_completed") {
165127
- const item = obj(payload.item), type = text2(item.type), id2 = text2(item.id), owner = text2(payload.thread_id);
165196
+ const item = obj(payload.item), type = text3(item.type), id2 = text3(item.id), owner = text3(payload.thread_id);
165128
165197
  if (this.facts.sessionId && owner && owner !== this.facts.sessionId) return;
165129
165198
  if (type === "CommandExecution") {
165130
165199
  const dedup = `${id2}:${num(payload.completed_at_ms) ?? at}`;
165131
165200
  if (this.seen.has(dedup)) return;
165132
165201
  this.seen.add(dedup);
165133
- const command = Array.isArray(item.command) ? item.command.map(text2) : [];
165134
- const args = command.some((arg) => /^-[a-z]*c$/u.test(arg)) ? command.at(-1) : command.length ? command.join(" ") : text2(item.command);
165202
+ const command = Array.isArray(item.command) ? item.command.map(text3) : [];
165203
+ const args = command.some((arg) => /^-[a-z]*c$/u.test(arg)) ? command.at(-1) : command.length ? command.join(" ") : text3(item.command);
165135
165204
  const start = num(payload.started_at_ms) ?? at, stop = num(payload.completed_at_ms) ?? at;
165136
165205
  const parents2 = [...this.tools.values()].filter((t) => !t.structured && t.name === "exec" && (t.calledAt ?? Infinity) <= (start ?? -Infinity) && (t.returnedAt === null || start !== null && start <= t.returnedAt));
165137
165206
  const parent2 = parents2.length === 1 ? parents2[0] : null;
@@ -165139,13 +165208,13 @@ var init_transcript = __esm({
165139
165208
  const tool = this.call(id2, "exec_command", args, start, req, true, parent2?.id ?? null);
165140
165209
  if (tool) {
165141
165210
  tool.exitCode = typeof item.exit_code === "number" ? item.exit_code : null;
165142
- this.result(id2, text2(item.aggregated_output) || text2(item.stdout) + text2(item.stderr), stop, true);
165211
+ this.result(id2, text3(item.aggregated_output) || text3(item.stdout) + text3(item.stderr), stop, true);
165143
165212
  }
165144
165213
  } else if (type === "McpToolCall") {
165145
165214
  const tool = this.tools.get(id2);
165146
165215
  if (tool) {
165147
165216
  tool.calledAt = num(payload.started_at_ms) ?? tool.calledAt;
165148
- const nativeName = `mcp__${text2(item.server)}__${text2(item.tool)}`;
165217
+ const nativeName = `mcp__${text3(item.server)}__${text3(item.tool)}`;
165149
165218
  const args = typeof item.arguments === "string" ? item.arguments : JSON.stringify(item.arguments ?? {});
165150
165219
  const nativeCategory = category(nativeName, args);
165151
165220
  if (nativeCategory === "browser") {
@@ -165184,20 +165253,20 @@ var init_transcript = __esm({
165184
165253
  claude(row, message, kind, at) {
165185
165254
  this.facts.runtime = "claude";
165186
165255
  const content = Array.isArray(message.content) ? message.content : typeof message.content === "string" ? [{ type: "text", text: message.content }] : [];
165187
- const mid = text2(message.id || row.uuid), key = text2(row.uuid);
165256
+ const mid = text3(message.id || row.uuid), key = text3(row.uuid);
165188
165257
  if (key && this.seen.has(key)) return;
165189
165258
  if (key) this.seen.add(key);
165190
165259
  const toolResult = kind === "user" && content.some((part) => obj(part).type === "tool_result");
165191
165260
  this.facts.sourceVersion = version2(row.version);
165192
165261
  if (kind === "user" && !toolResult && row.isMeta !== true) {
165193
- const id2 = text2(row.promptId) || key;
165262
+ const id2 = text3(row.promptId) || key;
165194
165263
  this.currentTask = id2 || null;
165195
165264
  if (id2) {
165196
165265
  this.task(id2, at);
165197
165266
  if (key) this.messageTasks.set(key, id2);
165198
165267
  }
165199
165268
  } else {
165200
- this.currentTask = this.messageTasks.get(text2(row.parentUuid)) ?? null;
165269
+ this.currentTask = this.messageTasks.get(text3(row.parentUuid)) ?? null;
165201
165270
  if (this.currentTask && key) this.messageTasks.set(key, this.currentTask);
165202
165271
  }
165203
165272
  if (kind === "user" && !toolResult) {
@@ -165208,8 +165277,8 @@ var init_transcript = __esm({
165208
165277
  let req = this.current;
165209
165278
  if (kind === "assistant") {
165210
165279
  req = mid ? this.usageIds.get(mid) ?? this.request(at, Boolean(this.current?.id && this.current.id !== mid)) : this.request(at);
165211
- this.model = text2(message.model) || this.model;
165212
- this.provider = text2(row.provider) || "anthropic";
165280
+ this.model = text3(message.model) || this.model;
165281
+ this.provider = text3(row.provider) || "anthropic";
165213
165282
  req.id = mid || null;
165214
165283
  req.model = this.model;
165215
165284
  req.provider = this.provider;
@@ -165218,9 +165287,9 @@ var init_transcript = __esm({
165218
165287
  }
165219
165288
  for (let index2 = 0; index2 < content.length; index2++) {
165220
165289
  const block = obj(content[index2]);
165221
- if (block.type === "tool_use") this.call(text2(block.id), text2(block.name), JSON.stringify(block.input ?? {}), at, req ?? this.request(at));
165222
- else if (block.type === "tool_result") this.result(text2(block.tool_use_id), readable(block.content), at);
165223
- else if (block.type === "text") this.record(`${mid || this.facts.sourceLines}:text:${index2}`, "message", kind, at, text2(block.text), req, kind === "assistant");
165290
+ if (block.type === "tool_use") this.call(text3(block.id), text3(block.name), JSON.stringify(block.input ?? {}), at, req ?? this.request(at));
165291
+ else if (block.type === "tool_result") this.result(text3(block.tool_use_id), readable(block.content), at);
165292
+ else if (block.type === "text") this.record(`${mid || this.facts.sourceLines}:text:${index2}`, "message", kind, at, text3(block.text), req, kind === "assistant");
165224
165293
  }
165225
165294
  if (kind === "assistant" && req) this.usage(req, obj(message.usage), at);
165226
165295
  }
@@ -165765,7 +165834,7 @@ var init_request_url = __esm({
165765
165834
  function validateNativeFrameLength(byteLength, direction) {
165766
165835
  return Number.isInteger(byteLength) && byteLength >= 0 && byteLength <= (direction === "request" ? 512 * 1024 : 1024 * 1024);
165767
165836
  }
165768
- var nativeProtocol, nativeOperationSchema, id, text3, url2, hash3, json2, empty2, scope, lease, scoped, base, request, requirement, credential, effect, candidate, bodyArtifact, inputChunk, preparedBinding, filePart, multipart, filePreparation, captureEntry, nativeRequestSchemas, requestUnion, nativeRequestSchema, identity, nativeHelloResultSchema, nativeScopesResultSchema, nativeCredentialStatusResultSchema, nativeJobSchema, claimResult, captureAck, blobAck, frozenWindow, nativeResultSchemas, nativeErrorSchema, nativeReplySchema, nativeAvailableSchema, nativeMessageSchema;
165837
+ var nativeProtocol, nativeOperationSchema, id, text4, url2, hash3, json2, empty2, scope, lease, scoped, base, request, requirement, credential, effect, candidate, bodyArtifact, inputChunk, preparedBinding, filePart, multipart, filePreparation, captureEntry, nativeRequestSchemas, requestUnion, nativeRequestSchema, identity, nativeHelloResultSchema, nativeScopesResultSchema, nativeCredentialStatusResultSchema, nativeJobSchema, claimResult, captureAck, blobAck, frozenWindow, nativeResultSchemas, nativeErrorSchema, nativeReplySchema, nativeAvailableSchema, nativeMessageSchema;
165769
165838
  var init_native = __esm({
165770
165839
  "../../packages/protocol/dist/native.js"() {
165771
165840
  "use strict";
@@ -165773,7 +165842,7 @@ var init_native = __esm({
165773
165842
  nativeProtocol = "apilift.native/v1";
165774
165843
  nativeOperationSchema = external_exports.enum(["hello", "scopes", "candidates", "claim", "heartbeat", "permit", "window.open", "window.close", "capture.append", "blob.chunk", "jobs.poll", "jobs.body", "jobs.input", "jobs.deliver", "credentials.put", "credentials.status", "credentials.delete", "credentials.rename"]);
165775
165844
  id = external_exports.string().min(1).max(160);
165776
- text3 = external_exports.string().min(1);
165845
+ text4 = external_exports.string().min(1);
165777
165846
  url2 = external_exports.url().refine((value) => /^https?:\/\//.test(value), "Expected an http(s) URL");
165778
165847
  hash3 = external_exports.string().regex(/^[0-9a-f]{64}$/);
165779
165848
  json2 = external_exports.json();
@@ -165783,27 +165852,27 @@ var init_native = __esm({
165783
165852
  scoped = { scope };
165784
165853
  base = { protocol: external_exports.literal(nativeProtocol), id };
165785
165854
  request = (operation2, payload, hasScope = false) => external_exports.strictObject({ ...base, ...hasScope ? scoped : {}, operation: external_exports.literal(operation2), payload });
165786
- requirement = external_exports.strictObject({ name: text3, header: text3, prefix: external_exports.string().max(80).optional() });
165787
- credential = { workspaceId: external_exports.uuid(), appId: external_exports.uuid(), appTitle: text3, transportName: text3, requirements: external_exports.array(requirement).max(16), draftId: external_exports.uuid().optional() };
165855
+ requirement = external_exports.strictObject({ name: text4, header: text4, prefix: external_exports.string().max(80).optional() });
165856
+ credential = { workspaceId: external_exports.uuid(), appId: external_exports.uuid(), appTitle: text4, transportName: text4, requirements: external_exports.array(requirement).max(16), draftId: external_exports.uuid().optional() };
165788
165857
  effect = external_exports.enum(["read", "create", "update", "delete"]);
165789
165858
  candidate = external_exports.strictObject({ selector: id, tabId: external_exports.number().int().positive(), active: external_exports.boolean(), title: external_exports.string().max(160) });
165790
165859
  bodyArtifact = external_exports.strictObject({ sha256: hash3, bytes: external_exports.number().int().nonnegative(), encoding: external_exports.literal("utf-8") });
165791
165860
  inputChunk = external_exports.strictObject({ offset: external_exports.number().int().nonnegative(), dataBase64: external_exports.string().max(240400), complete: external_exports.boolean() });
165792
165861
  preparedBinding = external_exports.strictObject({ $prepared: external_exports.string().max(2e3) });
165793
165862
  filePart = external_exports.strictObject({ sha256: hash3, bytes: external_exports.number().int().min(0).max(16 * 1024 * 1024), name: external_exports.string().min(1).max(180), contentType: external_exports.string().min(1).max(100) });
165794
- multipart = external_exports.array(external_exports.union([external_exports.strictObject({ name: text3, value: external_exports.union([external_exports.string().max(65536), external_exports.number(), external_exports.boolean(), preparedBinding]) }), external_exports.strictObject({ name: text3, file: filePart })])).min(1).max(64);
165863
+ multipart = external_exports.array(external_exports.union([external_exports.strictObject({ name: text4, value: external_exports.union([external_exports.string().max(65536), external_exports.number(), external_exports.boolean(), preparedBinding]) }), external_exports.strictObject({ name: text4, file: filePart })])).min(1).max(64);
165795
165864
  filePreparation = external_exports.strictObject({ resultPaths: external_exports.array(external_exports.string().max(512)).min(1).max(8).optional(), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), response: external_exports.strictObject({ path: external_exports.string().optional(), fields: external_exports.record(external_exports.string(), external_exports.string()).optional() }), urlFrom: external_exports.string().optional(), query: external_exports.record(external_exports.string(), preparedBinding).optional(), headerBindings: external_exports.record(external_exports.string(), preparedBinding).optional() });
165796
165865
  captureEntry = external_exports.strictObject({
165797
165866
  captureId: id,
165798
165867
  transactionId: id,
165799
165868
  ts: external_exports.number(),
165800
- label: text3,
165801
- captureOperation: external_exports.strictObject({ entity: text3, operation: text3, effect }).nullable().optional(),
165869
+ label: text4,
165870
+ captureOperation: external_exports.strictObject({ entity: text4, operation: text4, effect }).nullable().optional(),
165802
165871
  captureInputs: json2.optional(),
165803
- capturePhase: text3.optional(),
165872
+ capturePhase: text4.optional(),
165804
165873
  page: external_exports.string().optional(),
165805
- kind: text3,
165806
- method: text3,
165874
+ kind: text4,
165875
+ method: text4,
165807
165876
  url: external_exports.string(),
165808
165877
  reqHeaders: external_exports.record(external_exports.string(), external_exports.string()),
165809
165878
  reqBody: external_exports.string().nullable().optional(),
@@ -165825,24 +165894,24 @@ var init_native = __esm({
165825
165894
  target: external_exports.strictObject({ tabId: external_exports.number().int().positive(), sessionId: external_exports.string().nullable(), targetId: external_exports.string().nullable(), targetType: external_exports.string().nullable(), frameId: external_exports.string().nullable(), isTopFrame: external_exports.boolean(), loaderId: external_exports.string().nullable(), documentURL: external_exports.string(), redirectHop: external_exports.number().int().nonnegative().optional() })
165826
165895
  });
165827
165896
  nativeRequestSchemas = {
165828
- hello: request("hello", external_exports.strictObject({ extensionId: text3, extensionVersion: text3, buildFingerprint: text3.optional(), capabilities: external_exports.array(text3) })),
165897
+ hello: request("hello", external_exports.strictObject({ extensionId: text4, extensionVersion: text4, buildFingerprint: text4.optional(), capabilities: external_exports.array(text4) })),
165829
165898
  scopes: request("scopes", empty2),
165830
165899
  candidates: request("candidates", external_exports.strictObject({ clientId: id, origin: url2, candidates: external_exports.array(candidate).max(32), claimError: external_exports.string().min(1).max(400).optional() }), true),
165831
- claim: request("claim", external_exports.strictObject({ ...lease, clientId: id, extensionId: text3, extensionVersion: text3, capabilities: external_exports.array(text3), tabId: external_exports.number().int().positive(), tabSelector: id, url: url2, origin: url2 }), true),
165832
- heartbeat: request("heartbeat", external_exports.strictObject({ ...lease, clientId: id, extensionVersion: text3, capabilities: external_exports.array(text3), tabId: external_exports.number().int().positive().optional(), tabSelector: id.optional(), url: url2.optional(), origin: url2.optional(), walDepth: external_exports.number().int().nonnegative().optional(), attached: external_exports.boolean().optional(), detached: external_exports.boolean().optional(), gap: external_exports.string().optional(), lost: external_exports.boolean().optional() }), true),
165833
- permit: request("permit", external_exports.strictObject({ ...lease, label: text3.optional(), entity: text3.optional(), operation: text3.optional(), effect: effect.optional(), inputs: json2.optional(), phase: text3.optional() }), true),
165834
- "window.open": request("window.open", external_exports.strictObject({ ...lease, windowId: id, windowPermit: text3, label: text3, transactionId: id, captureOperation: external_exports.strictObject({ entity: text3, operation: text3, effect }).nullable().optional(), captureInputs: json2.optional(), capturePhase: text3.optional(), settleMs: external_exports.number().int().nonnegative().optional(), sequenceBefore: external_exports.number().int().nonnegative().optional() }), true),
165900
+ claim: request("claim", external_exports.strictObject({ ...lease, clientId: id, extensionId: text4, extensionVersion: text4, capabilities: external_exports.array(text4), tabId: external_exports.number().int().positive(), tabSelector: id, url: url2, origin: url2 }), true),
165901
+ heartbeat: request("heartbeat", external_exports.strictObject({ ...lease, clientId: id, extensionVersion: text4, capabilities: external_exports.array(text4), tabId: external_exports.number().int().positive().optional(), tabSelector: id.optional(), url: url2.optional(), origin: url2.optional(), walDepth: external_exports.number().int().nonnegative().optional(), attached: external_exports.boolean().optional(), detached: external_exports.boolean().optional(), gap: external_exports.string().optional(), lost: external_exports.boolean().optional() }), true),
165902
+ permit: request("permit", external_exports.strictObject({ ...lease, label: text4.optional(), entity: text4.optional(), operation: text4.optional(), effect: effect.optional(), inputs: json2.optional(), phase: text4.optional() }), true),
165903
+ "window.open": request("window.open", external_exports.strictObject({ ...lease, windowId: id, windowPermit: text4, label: text4, transactionId: id, captureOperation: external_exports.strictObject({ entity: text4, operation: text4, effect }).nullable().optional(), captureInputs: json2.optional(), capturePhase: text4.optional(), settleMs: external_exports.number().int().nonnegative().optional(), sequenceBefore: external_exports.number().int().nonnegative().optional() }), true),
165835
165904
  "window.close": request("window.close", external_exports.strictObject({ ...lease, windowId: id, transactionId: id, finalSequence: external_exports.number().int().nonnegative(), stoppedAt: external_exports.number().nonnegative().optional(), captured: external_exports.number().int().nonnegative().optional(), outcome: external_exports.strictObject({ executionState: external_exports.enum(["not-dispatched", "dispatched", "unknown"]).optional(), error: external_exports.string().optional() }).optional() }), true),
165836
165905
  "capture.append": request("capture.append", external_exports.strictObject({ ...lease, seq: external_exports.number().int().nonnegative(), entries: external_exports.array(captureEntry).max(32) }), true),
165837
165906
  "blob.chunk": request("blob.chunk", external_exports.strictObject({ ...lease, recording: id.optional(), jobId: id.optional(), sha256: hash3, bytes: external_exports.number().int().nonnegative(), offset: external_exports.number().int().nonnegative(), dataBase64: external_exports.string(), chunkSha256: hash3 }), true),
165838
- "jobs.poll": request("jobs.poll", external_exports.strictObject({ ...lease, waitMs: external_exports.number().int().min(0).max(25e3), capabilities: external_exports.array(text3) }), true),
165907
+ "jobs.poll": request("jobs.poll", external_exports.strictObject({ ...lease, waitMs: external_exports.number().int().min(0).max(25e3), capabilities: external_exports.array(text4) }), true),
165839
165908
  "jobs.body": request("jobs.body", external_exports.strictObject({ ...lease, jobId: id, sha256: hash3, bytes: external_exports.number().int().nonnegative() }), true),
165840
165909
  "jobs.input": request("jobs.input", external_exports.strictObject({ ...lease, jobId: id, sha256: hash3, offset: external_exports.number().int().nonnegative() }), true),
165841
165910
  "jobs.deliver": request("jobs.deliver", external_exports.strictObject({ ...lease, jobId: id, result: json2 }), true),
165842
- "credentials.put": request("credentials.put", external_exports.strictObject({ ...credential, name: text3, fields: external_exports.record(external_exports.string(), text3), sessionId: external_exports.string().min(1).max(256).regex(/^(?:codex|claude):\S+$/u).optional() })),
165911
+ "credentials.put": request("credentials.put", external_exports.strictObject({ ...credential, name: text4, fields: external_exports.record(external_exports.string(), text4), sessionId: external_exports.string().min(1).max(256).regex(/^(?:codex|claude):\S+$/u).optional() })),
165843
165912
  "credentials.status": request("credentials.status", external_exports.strictObject(credential)),
165844
165913
  "credentials.delete": request("credentials.delete", external_exports.strictObject({ ...credential, credentialId: external_exports.uuid() })),
165845
- "credentials.rename": request("credentials.rename", external_exports.strictObject({ ...credential, credentialId: external_exports.uuid(), name: text3 }))
165914
+ "credentials.rename": request("credentials.rename", external_exports.strictObject({ ...credential, credentialId: external_exports.uuid(), name: text4 }))
165846
165915
  };
165847
165916
  requestUnion = external_exports.discriminatedUnion("operation", [nativeRequestSchemas.hello, nativeRequestSchemas.scopes, nativeRequestSchemas.candidates, nativeRequestSchemas.claim, nativeRequestSchemas.heartbeat, nativeRequestSchemas.permit, nativeRequestSchemas["window.open"], nativeRequestSchemas["window.close"], nativeRequestSchemas["capture.append"], nativeRequestSchemas["blob.chunk"], nativeRequestSchemas["jobs.poll"], nativeRequestSchemas["jobs.body"], nativeRequestSchemas["jobs.input"], nativeRequestSchemas["jobs.deliver"], nativeRequestSchemas["credentials.put"], nativeRequestSchemas["credentials.status"], nativeRequestSchemas["credentials.delete"], nativeRequestSchemas["credentials.rename"]]);
165848
165917
  nativeRequestSchema = requestUnion.superRefine((message, context) => {
@@ -165854,15 +165923,15 @@ var init_native = __esm({
165854
165923
  context.addIssue({ code: "custom", path: ["payload", "dataBase64"], message: "Blob chunk must be valid base64 of at most 176 KiB" });
165855
165924
  }
165856
165925
  });
165857
- identity = external_exports.strictObject({ accountId: external_exports.uuid(), workspaceId: external_exports.uuid(), installationId: external_exports.uuid(), enabled: external_exports.boolean(), internal: external_exports.boolean(), environment: external_exports.enum(["production", "test", "disabled"]), projectKey: external_exports.string(), host: external_exports.string(), expiresAt: text3 });
165858
- nativeHelloResultSchema = external_exports.strictObject({ hostVersion: text3, hostBuildFingerprint: text3, minimumHostVersion: text3.optional(), minimumExtensionVersion: text3, availableExtensionVersion: text3, capabilities: external_exports.array(text3), hostRestartRequired: external_exports.boolean(), identity: identity.optional() });
165859
- nativeScopesResultSchema = external_exports.strictObject({ scopes: external_exports.array(external_exports.strictObject({ kind: external_exports.enum(["inspect", "execute", "capture"]), id, pageOrigin: url2, leaseId: id.optional(), tabSelector: id.optional(), startUrl: url2.optional(), bindingMode: external_exports.enum(["exact-existing-url", "installation-prefix"]).optional(), expiresAt: text3.optional(), window: json2.optional(), ackThrough: external_exports.number().int().nonnegative().optional(), activatedAt: external_exports.number().optional() })), identity: identity.optional() });
165860
- nativeCredentialStatusResultSchema = external_exports.strictObject({ status: external_exports.enum(["configured", "missing"]), credentials: external_exports.array(external_exports.strictObject({ id: external_exports.uuid(), name: text3, fields: external_exports.array(text3) })) });
165926
+ identity = external_exports.strictObject({ accountId: external_exports.uuid(), workspaceId: external_exports.uuid(), installationId: external_exports.uuid(), enabled: external_exports.boolean(), internal: external_exports.boolean(), environment: external_exports.enum(["production", "test", "disabled"]), projectKey: external_exports.string(), host: external_exports.string(), expiresAt: text4 });
165927
+ nativeHelloResultSchema = external_exports.strictObject({ hostVersion: text4, hostBuildFingerprint: text4, minimumHostVersion: text4.optional(), minimumExtensionVersion: text4, availableExtensionVersion: text4, capabilities: external_exports.array(text4), hostRestartRequired: external_exports.boolean(), identity: identity.optional() });
165928
+ nativeScopesResultSchema = external_exports.strictObject({ scopes: external_exports.array(external_exports.strictObject({ kind: external_exports.enum(["inspect", "execute", "capture"]), id, pageOrigin: url2, leaseId: id.optional(), tabSelector: id.optional(), startUrl: url2.optional(), bindingMode: external_exports.enum(["exact-existing-url", "installation-prefix"]).optional(), expiresAt: text4.optional(), window: json2.optional(), ackThrough: external_exports.number().int().nonnegative().optional(), activatedAt: external_exports.number().optional() })), identity: identity.optional() });
165929
+ nativeCredentialStatusResultSchema = external_exports.strictObject({ status: external_exports.enum(["configured", "missing"]), credentials: external_exports.array(external_exports.strictObject({ id: external_exports.uuid(), name: text4, fields: external_exports.array(text4) })) });
165861
165930
  nativeJobSchema = external_exports.discriminatedUnion("kind", [
165862
- external_exports.strictObject({ id, kind: external_exports.literal("replay"), effect, method: external_exports.enum(["GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH", "DELETE"]), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), body: json2.optional(), multipart: multipart.optional(), anonymous: external_exports.boolean().optional(), fileResponse: external_exports.boolean().optional(), filePreparation: filePreparation.optional(), pageOrigin: url2, allowedRequestOrigin: url2, timeoutMs: external_exports.number().int().positive(), manualRedirects: external_exports.boolean().optional(), contextBaseUrl: url2.optional(), frame: external_exports.strictObject({ selector: text3, baseUrl: url2 }).optional(), credentialHeaderNames: external_exports.array(text3).optional(), authRecipeDefinition: json2.optional(), authRecipeId: text3.optional(), authRecipeHash: hash3.optional(), authRefresh: external_exports.boolean().optional(), semanticProvenance: external_exports.array(json2).optional() }),
165863
- external_exports.strictObject({ id, kind: external_exports.literal("begin"), label: text3, entity: text3.optional(), operation: text3.optional(), effect: effect.optional(), inputs: json2.optional(), phase: text3.optional(), settleMs: external_exports.number().int().nonnegative().optional() }),
165931
+ external_exports.strictObject({ id, kind: external_exports.literal("replay"), effect, method: external_exports.enum(["GET", "HEAD", "OPTIONS", "POST", "PUT", "PATCH", "DELETE"]), url: url2, headers: external_exports.record(external_exports.string(), external_exports.string()), body: json2.optional(), multipart: multipart.optional(), anonymous: external_exports.boolean().optional(), fileResponse: external_exports.boolean().optional(), filePreparation: filePreparation.optional(), pageOrigin: url2, allowedRequestOrigin: url2, timeoutMs: external_exports.number().int().positive(), manualRedirects: external_exports.boolean().optional(), contextBaseUrl: url2.optional(), frame: external_exports.strictObject({ selector: text4, baseUrl: url2 }).optional(), credentialHeaderNames: external_exports.array(text4).optional(), authRecipeDefinition: json2.optional(), authRecipeId: text4.optional(), authRecipeHash: hash3.optional(), authRefresh: external_exports.boolean().optional(), semanticProvenance: external_exports.array(json2).optional() }),
165932
+ external_exports.strictObject({ id, kind: external_exports.literal("begin"), label: text4, entity: text4.optional(), operation: text4.optional(), effect: effect.optional(), inputs: json2.optional(), phase: text4.optional(), settleMs: external_exports.number().int().nonnegative().optional() }),
165864
165933
  external_exports.strictObject({ id, kind: external_exports.literal("stop"), windowId: id.optional() }),
165865
- external_exports.strictObject({ id, kind: external_exports.literal("auth-probe"), captureId: id, field: text3.optional(), scope: json2.optional() })
165934
+ external_exports.strictObject({ id, kind: external_exports.literal("auth-probe"), captureId: id, field: text4.optional(), scope: json2.optional() })
165866
165935
  ]);
165867
165936
  claimResult = external_exports.strictObject({ ackThrough: external_exports.number().int().nonnegative().optional(), captureBatchMax: external_exports.number().int().min(1).max(32).optional() });
165868
165937
  captureAck = external_exports.strictObject({ ackThrough: external_exports.number().int().nonnegative(), discardCaptures: external_exports.array(id).optional(), discardRecording: id.optional(), freezeRequired: id.optional() });
@@ -165874,7 +165943,7 @@ var init_native = __esm({
165874
165943
  candidates: empty2,
165875
165944
  claim: claimResult,
165876
165945
  heartbeat: claimResult,
165877
- permit: external_exports.strictObject({ windowPermit: text3, label: text3.optional(), captureInputs: json2.optional(), capturePhase: text3.optional() }),
165946
+ permit: external_exports.strictObject({ windowPermit: text4, label: text4.optional(), captureInputs: json2.optional(), capturePhase: text4.optional() }),
165878
165947
  "window.open": empty2,
165879
165948
  "window.close": frozenWindow,
165880
165949
  "capture.append": captureAck,
@@ -165888,7 +165957,7 @@ var init_native = __esm({
165888
165957
  "credentials.delete": nativeCredentialStatusResultSchema,
165889
165958
  "credentials.rename": nativeCredentialStatusResultSchema
165890
165959
  };
165891
- nativeErrorSchema = external_exports.strictObject({ code: text3, message: text3, exitCode: external_exports.number().int().optional(), next: external_exports.string().optional(), executionState: external_exports.enum(["not-dispatched", "dispatched", "unknown"]).optional() });
165960
+ nativeErrorSchema = external_exports.strictObject({ code: text4, message: text4, exitCode: external_exports.number().int().optional(), next: external_exports.string().optional(), executionState: external_exports.enum(["not-dispatched", "dispatched", "unknown"]).optional() });
165892
165961
  nativeReplySchema = external_exports.discriminatedUnion("ok", [
165893
165962
  external_exports.strictObject({ protocol: external_exports.literal(nativeProtocol), id, ok: external_exports.literal(true), result: external_exports.union([nativeHelloResultSchema, nativeScopesResultSchema, nativeCredentialStatusResultSchema, nativeJobSchema, nativeResultSchemas.permit, nativeResultSchemas["capture.append"], claimResult, blobAck, frozenWindow, bodyArtifact, inputChunk, empty2]) }),
165894
165963
  external_exports.strictObject({ protocol: external_exports.literal(nativeProtocol), id, ok: external_exports.literal(false), error: nativeErrorSchema })
@@ -166420,11 +166489,11 @@ var init_esm2 = __esm({
166420
166489
  this.lastNode = null;
166421
166490
  }
166422
166491
  oncdatastart() {
166423
- const text6 = new Text2("");
166424
- const node2 = new CDATA2([text6]);
166492
+ const text7 = new Text2("");
166493
+ const node2 = new CDATA2([text7]);
166425
166494
  this.addNode(node2);
166426
- text6.parent = node2;
166427
- this.lastNode = text6;
166495
+ text7.parent = node2;
166496
+ this.lastNode = text7;
166428
166497
  }
166429
166498
  oncdataend() {
166430
166499
  this.lastNode = null;
@@ -167903,7 +167972,7 @@ __export(static_exports, {
167903
167972
  merge: () => merge2,
167904
167973
  parseHTML: () => parseHTML,
167905
167974
  root: () => root,
167906
- text: () => text4,
167975
+ text: () => text5,
167907
167976
  xml: () => xml
167908
167977
  });
167909
167978
  function render2(that, dom, options) {
@@ -167926,7 +167995,7 @@ function xml(dom) {
167926
167995
  const options = { ...this._options, xmlMode: true };
167927
167996
  return render2(this, dom, options);
167928
167997
  }
167929
- function text4(elements) {
167998
+ function text5(elements) {
167930
167999
  const elems = elements !== null && elements !== void 0 ? elements : this ? this.root() : [];
167931
168000
  let ret = "";
167932
168001
  for (let i = 0; i < elems.length; i++) {
@@ -169738,7 +169807,7 @@ function getAttr(elem, name, xmlMode) {
169738
169807
  return !xmlMode && rboolean.test(name) ? name : elem.attribs[name];
169739
169808
  }
169740
169809
  if (elem.name === "option" && name === "value") {
169741
- return text4(elem.children);
169810
+ return text5(elem.children);
169742
169811
  }
169743
169812
  if (elem.name === "input" && (elem.attribs["type"] === "radio" || elem.attribs["type"] === "checkbox") && name === "value") {
169744
169813
  return "on";
@@ -169967,7 +170036,7 @@ function val(value) {
169967
170036
  }
169968
170037
  return this;
169969
170038
  }
169970
- return this.attr("multiple") ? option.toArray().map((el) => text4(el.children)) : option.attr("value");
170039
+ return this.attr("multiple") ? option.toArray().map((el) => text5(el.children)) : option.attr("value");
169971
170040
  }
169972
170041
  case "input":
169973
170042
  case "option": {
@@ -170895,13 +170964,13 @@ var init_filters = __esm({
170895
170964
  init_esm7();
170896
170965
  import_boolbase3 = __toESM(require_boolbase(), 1);
170897
170966
  filters = {
170898
- contains(next2, text6, { adapter }) {
170967
+ contains(next2, text7, { adapter }) {
170899
170968
  return function contains2(elem) {
170900
- return next2(elem) && adapter.getText(elem).includes(text6);
170969
+ return next2(elem) && adapter.getText(elem).includes(text7);
170901
170970
  };
170902
170971
  },
170903
- icontains(next2, text6, { adapter }) {
170904
- const itext = text6.toLowerCase();
170972
+ icontains(next2, text7, { adapter }) {
170973
+ const itext = text7.toLowerCase();
170905
170974
  return function icontains(elem) {
170906
170975
  return next2(elem) && adapter.getText(elem).toLowerCase().includes(itext);
170907
170976
  };
@@ -172156,7 +172225,7 @@ __export(manipulation_exports, {
172156
172225
  prependTo: () => prependTo,
172157
172226
  remove: () => remove,
172158
172227
  replaceWith: () => replaceWith,
172159
- text: () => text5,
172228
+ text: () => text6,
172160
172229
  toString: () => toString,
172161
172230
  unwrap: () => unwrap,
172162
172231
  wrap: () => wrap,
@@ -172436,12 +172505,12 @@ function html2(str2) {
172436
172505
  function toString() {
172437
172506
  return this._render(this);
172438
172507
  }
172439
- function text5(str2) {
172508
+ function text6(str2) {
172440
172509
  if (str2 === void 0) {
172441
- return text4(this);
172510
+ return text5(this);
172442
172511
  }
172443
172512
  if (typeof str2 === "function") {
172444
- return domEach(this, (el, i) => this._make(el).text(str2.call(el, i, text4([el]))));
172513
+ return domEach(this, (el, i) => this._make(el).text(str2.call(el, i, text5([el]))));
172445
172514
  }
172446
172515
  return domEach(this, (el) => {
172447
172516
  if (!hasChildren(el))
@@ -173304,6 +173373,41 @@ var init_execution_reports = __esm({
173304
173373
  }
173305
173374
  });
173306
173375
 
173376
+ // src/feedback-store.ts
173377
+ function feedbackOwner(state) {
173378
+ const i = state.installation();
173379
+ return i ? JSON.stringify([i.id, i.accountId, i.workspaceId]) : null;
173380
+ }
173381
+ async function deliverFeedback(state, api2, id2) {
173382
+ const installation = state.installation();
173383
+ if (!installation || !api2.authenticatedWith(installation.token)) return false;
173384
+ const owner = JSON.stringify([installation.id, installation.accountId, installation.workspaceId]);
173385
+ const row = state.db.prepare("SELECT body,delivered,attempts FROM feedback_outbox WHERE id=? AND owner=? AND registry=?").get(id2, owner, api2.cacheNamespace);
173386
+ if (!owner || !row) return false;
173387
+ if (row.delivered) return true;
173388
+ try {
173389
+ const body = feedbackReportSchema.parse(JSON.parse(row.body));
173390
+ const result = await api2.call("submitFeedback", { body });
173391
+ if (result.id !== id2 || !["accepted", "duplicate"].includes(result.status)) return false;
173392
+ state.db.prepare("UPDATE feedback_outbox SET delivered=1 WHERE id=? AND owner=?").run(id2, owner);
173393
+ return true;
173394
+ } catch {
173395
+ state.db.prepare("UPDATE feedback_outbox SET attempts=attempts+1,next_attempt_at=? WHERE id=? AND owner=?").run(Date.now() + Math.min(36e5, 6e4 * 2 ** Math.min(row.attempts, 6)), id2, owner);
173396
+ return false;
173397
+ }
173398
+ }
173399
+ async function flushFeedback(state, api2) {
173400
+ if (!state.db.prepare("SELECT 1 FROM sqlite_master WHERE name='feedback_outbox'").get()) return;
173401
+ const row = state.db.prepare("SELECT id FROM feedback_outbox WHERE owner=? AND registry=? AND delivered=0 AND next_attempt_at<=? AND created_at>? ORDER BY created_at LIMIT 1").get(feedbackOwner(state), api2.cacheNamespace, Date.now(), Date.now() - 90 * 864e5);
173402
+ if (row) await deliverFeedback(state, api2, row.id);
173403
+ }
173404
+ var init_feedback_store = __esm({
173405
+ "src/feedback-store.ts"() {
173406
+ "use strict";
173407
+ init_api2();
173408
+ }
173409
+ });
173410
+
173307
173411
  // src/api.ts
173308
173412
  function retryDelay(response, attempt) {
173309
173413
  const value = response.headers.get("retry-after");
@@ -173355,7 +173459,7 @@ function createCliApi(baseUrl, fetcher = fetch, token, sessionId, observe) {
173355
173459
  }
173356
173460
  }
173357
173461
  };
173358
- return Object.assign(createApiClient(baseUrl, transport), { cacheNamespace: baseUrl });
173462
+ return Object.assign(createApiClient(baseUrl, transport), { cacheNamespace: baseUrl, authenticatedWith: (candidate2) => candidate2 === token });
173359
173463
  }
173360
173464
  var retryStatuses, ApiDeliveryUncertainError, ApiReadUnavailableError;
173361
173465
  var init_api3 = __esm({
@@ -173599,6 +173703,8 @@ async function collectOnce(dataRoot2, env, fetcher = fetch) {
173599
173703
  if (!stillLinked(state, installation)) return;
173600
173704
  await flushExecutionReports(api2, state);
173601
173705
  if (!stillLinked(state, installation)) return;
173706
+ await flushFeedback(state, api2);
173707
+ if (!stillLinked(state, installation)) return;
173602
173708
  ledger.clearForAccountChange(installation.accountId);
173603
173709
  countPending(ledger);
173604
173710
  const scan = new TranscriptScan(ledger);
@@ -173627,6 +173733,7 @@ var init_collector = __esm({
173627
173733
  init_batch_publication();
173628
173734
  init_analytics2();
173629
173735
  init_execution_reports();
173736
+ init_feedback_store();
173630
173737
  init_api2();
173631
173738
  init_api3();
173632
173739
  init_state();