stitchkit 0.118.1 → 0.120.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (180) hide show
  1. package/CHANGELOG.md +92 -0
  2. package/README.md +10 -7
  3. package/dist/browser/http.d.ts.map +1 -1
  4. package/dist/contract/client-types.d.ts +6 -3
  5. package/dist/contract/client-types.d.ts.map +1 -1
  6. package/dist/contract/define-validation.d.ts.map +1 -1
  7. package/dist/contract/define.d.ts +18 -12
  8. package/dist/contract/define.d.ts.map +1 -1
  9. package/dist/contract/endpoint-capabilities.d.ts +28 -0
  10. package/dist/contract/endpoint-capabilities.d.ts.map +1 -0
  11. package/dist/contract/factory.d.ts +49 -19
  12. package/dist/contract/factory.d.ts.map +1 -1
  13. package/dist/contract/tool-view.d.ts +1 -1
  14. package/dist/contract/tool-view.d.ts.map +1 -1
  15. package/dist/contract/transports.d.ts +5 -0
  16. package/dist/contract/transports.d.ts.map +1 -0
  17. package/dist/entrypoints/agent-runtime/coding-tools.js +9 -8
  18. package/dist/entrypoints/agent-runtime/harness.js +9 -8
  19. package/dist/entrypoints/agent-runtime/realtime.js +3 -3
  20. package/dist/entrypoints/agent-runtime/sandbox.js +10 -9
  21. package/dist/entrypoints/agent-runtime/sqlite/bun.js +12 -11
  22. package/dist/entrypoints/agent-runtime/sqlite/node.js +12 -11
  23. package/dist/entrypoints/agent-runtime/testing.js +12 -11
  24. package/dist/entrypoints/agent-runtime.js +22 -19
  25. package/dist/entrypoints/application/diagnostic-journal.js +3 -3
  26. package/dist/entrypoints/application/directory-inbox.js +4 -4
  27. package/dist/entrypoints/application/opentelemetry.js +1 -1
  28. package/dist/entrypoints/application.js +10 -10
  29. package/dist/entrypoints/cli/publish.js +4 -4
  30. package/dist/entrypoints/cli.js +13 -12
  31. package/dist/entrypoints/contract.d.ts +1 -1
  32. package/dist/entrypoints/contract.d.ts.map +1 -1
  33. package/dist/entrypoints/contract.js +6 -4
  34. package/dist/entrypoints/files.js +3 -3
  35. package/dist/entrypoints/geo/contract.d.ts +7 -0
  36. package/dist/entrypoints/geo/contract.d.ts.map +1 -0
  37. package/dist/entrypoints/geo/contract.js +6 -0
  38. package/dist/entrypoints/geo.js +60 -23
  39. package/dist/entrypoints/http.js +3 -3
  40. package/dist/entrypoints/index.js +9 -7
  41. package/dist/entrypoints/live.js +1 -1
  42. package/dist/entrypoints/node.js +7 -6
  43. package/dist/entrypoints/primitives.js +1 -1
  44. package/dist/entrypoints/process/owner-loss.js +1 -1
  45. package/dist/entrypoints/process.js +3 -3
  46. package/dist/entrypoints/react.js +1 -1
  47. package/dist/entrypoints/remote.js +4 -3
  48. package/dist/entrypoints/server.js +16 -15
  49. package/dist/entrypoints/telegram/screens.js +5 -5
  50. package/dist/entrypoints/telegram.js +7 -7
  51. package/dist/entrypoints/testing.js +7 -6
  52. package/dist/entrypoints/tools/agent.d.ts +9 -0
  53. package/dist/entrypoints/tools/agent.d.ts.map +1 -0
  54. package/dist/entrypoints/tools/agent.js +16 -0
  55. package/dist/entrypoints/tools/connections.js +7 -6
  56. package/dist/entrypoints/tools/contract.js +1 -1
  57. package/dist/entrypoints/tools/invoker.js +5 -4
  58. package/dist/entrypoints/tools/mcp.js +110 -9
  59. package/dist/entrypoints/tools/toolkit.d.ts +9 -0
  60. package/dist/entrypoints/tools/toolkit.d.ts.map +1 -0
  61. package/dist/entrypoints/tools/toolkit.js +40 -0
  62. package/dist/entrypoints/tools.d.ts +0 -10
  63. package/dist/entrypoints/tools.d.ts.map +1 -1
  64. package/dist/entrypoints/tools.js +38 -80
  65. package/dist/entrypoints/tracking/contract.js +5 -3
  66. package/dist/entrypoints/tracking/performance.js +3 -3
  67. package/dist/entrypoints/tracking.d.ts +1 -1
  68. package/dist/entrypoints/tracking.d.ts.map +1 -1
  69. package/dist/entrypoints/tracking.js +63 -83
  70. package/dist/entrypoints/xlsx.js +1 -1
  71. package/dist/geo/index.d.ts +2 -1
  72. package/dist/geo/index.d.ts.map +1 -1
  73. package/dist/geo/record.d.ts +8 -0
  74. package/dist/geo/record.d.ts.map +1 -0
  75. package/dist/geo/resolver.d.ts +1 -3
  76. package/dist/geo/resolver.d.ts.map +1 -1
  77. package/dist/geo/schema.d.ts +44 -0
  78. package/dist/geo/schema.d.ts.map +1 -0
  79. package/dist/geo/types.d.ts +2 -13
  80. package/dist/geo/types.d.ts.map +1 -1
  81. package/dist/{index-n5sv4z0w.js → index-0qyrcjfs.js} +16 -18
  82. package/dist/index-1psbyyhj.js +21 -0
  83. package/dist/{index-tsngj2b5.js → index-2fc1k9k2.js} +206 -206
  84. package/dist/index-3prvb42w.js +30 -0
  85. package/dist/{index-073nw9qr.js → index-3yb5kft5.js} +524 -522
  86. package/dist/{index-d9hq291n.js → index-4jpykzvw.js} +70 -81
  87. package/dist/index-568w258r.js +76 -0
  88. package/dist/index-69t14s4a.js +39 -0
  89. package/dist/{index-dky0dcmf.js → index-72r9k0av.js} +6 -2
  90. package/dist/{index-6p3frkv5.js → index-7zwtbak8.js} +9 -50
  91. package/dist/{index-90p34rts.js → index-8ryydawp.js} +7 -5
  92. package/dist/{index-vv1sch8a.js → index-8vzh5wpv.js} +13 -8
  93. package/dist/{index-75ns2ybj.js → index-8xyf8h2k.js} +1 -1
  94. package/dist/{index-xx1j310k.js → index-8yxgcyt6.js} +171 -169
  95. package/dist/{index-p6apg0jg.js → index-9frf01t9.js} +16 -9
  96. package/dist/{index-q0th8q0z.js → index-9mjrnqxs.js} +1 -3
  97. package/dist/{index-6f49krb5.js → index-aa50qwv4.js} +1 -1
  98. package/dist/{index-ega3yz4c.js → index-aqwg2dm5.js} +1 -1
  99. package/dist/{index-p0rf7sq9.js → index-bgcwxhxh.js} +225 -223
  100. package/dist/index-bph35vpy.js +77 -0
  101. package/dist/{index-tdpmfks8.js → index-bz479f0x.js} +1 -1
  102. package/dist/index-d3xdyjt6.js +38 -0
  103. package/dist/{index-q968hy6y.js → index-e452syyh.js} +1 -1
  104. package/dist/{index-86nbfysb.js → index-ff39f9dr.js} +3 -3
  105. package/dist/index-h1j71dr1.js +48 -0
  106. package/dist/{index-mgb7r8b8.js → index-jswst0h3.js} +1 -1
  107. package/dist/{index-095ya5hm.js → index-knmnj11j.js} +22 -191
  108. package/dist/{index-vwhrnp67.js → index-kz9734jc.js} +3 -3
  109. package/dist/{index-txg1npmg.js → index-mtwh9hyp.js} +1 -1
  110. package/dist/{index-dr3t5n1v.js → index-nn9qvkww.js} +46 -46
  111. package/dist/{index-ghtpfz4z.js → index-nyyam9ce.js} +2 -2
  112. package/dist/{index-qezhmp51.js → index-nz06qw5a.js} +3 -1
  113. package/dist/{index-1bx1xv1k.js → index-pfvde2fz.js} +5 -2
  114. package/dist/{index-w7jq3fz9.js → index-pq2m7t46.js} +1142 -1212
  115. package/dist/{index-yk4g8805.js → index-pq7rkwkk.js} +1 -30
  116. package/dist/{index-s80awwsw.js → index-qch1vcaa.js} +3 -1
  117. package/dist/{index-hdjmdwsj.js → index-qctbzmg9.js} +521 -511
  118. package/dist/{index-n8z3rvzw.js → index-qevqn3d3.js} +3 -5
  119. package/dist/{index-nqxrm176.js → index-r3db01kh.js} +1 -1
  120. package/dist/{index-v6vb5qx8.js → index-s3yxw6kt.js} +1 -1
  121. package/dist/{index-cqmqyjax.js → index-sa99p98w.js} +1 -1
  122. package/dist/index-sb9dr3tq.js +14 -0
  123. package/dist/{index-0gxvns6s.js → index-sba3e6m4.js} +1 -0
  124. package/dist/{index-f24bdt13.js → index-v1swr26p.js} +3 -1
  125. package/dist/{index-rhzkndr5.js → index-x4p3kw1p.js} +533 -530
  126. package/dist/{index-cycp3r3e.js → index-yb9n4pgj.js} +2 -2
  127. package/dist/{index-htxh46ej.js → index-ycqhyars.js} +2 -2
  128. package/dist/{index-9bwcthxw.js → index-yj6saztf.js} +31 -13
  129. package/dist/{index-f6m4c545.js → index-zrdcmg6j.js} +4 -6
  130. package/dist/{index-tvtacc9a.js → index-zyc64nbh.js} +1 -34
  131. package/dist/process/bun-child.d.ts +3 -2
  132. package/dist/process/bun-child.d.ts.map +1 -1
  133. package/dist/server/contract-method.d.ts.map +1 -1
  134. package/dist/tools/internal/surface-projector.d.ts.map +1 -1
  135. package/dist/tools/operations/async-operation-canonical-types.d.ts +1 -1
  136. package/dist/tracking/attribution.d.ts +21 -25
  137. package/dist/tracking/attribution.d.ts.map +1 -1
  138. package/dist/tracking/client-visit.d.ts +5 -7
  139. package/dist/tracking/client-visit.d.ts.map +1 -1
  140. package/dist/tracking/client.d.ts +2 -2
  141. package/dist/tracking/client.d.ts.map +1 -1
  142. package/dist/tracking/contract.d.ts +1 -1
  143. package/dist/tracking/host.d.ts +0 -1
  144. package/dist/tracking/host.d.ts.map +1 -1
  145. package/dist/tracking/privacy.d.ts +6 -0
  146. package/dist/tracking/privacy.d.ts.map +1 -1
  147. package/dist/tracking/schemas.d.ts +2 -2
  148. package/dist/tracking/schemas.d.ts.map +1 -1
  149. package/llms/agent-runtime-harness.txt +4 -3
  150. package/llms/agent-runtime-sandbox.txt +1 -1
  151. package/llms/agent-runtime.2.txt +3 -2
  152. package/llms/agent-runtime.3.txt +4 -46
  153. package/llms/agent-runtime.4.txt +113 -0
  154. package/llms/agent-runtime.txt +11 -13
  155. package/llms/cli.txt +1 -1
  156. package/llms/contract.txt +46 -24
  157. package/llms/geo-contract.txt +23 -0
  158. package/llms/geo.txt +40 -4
  159. package/llms/stitchkit.txt +16 -9
  160. package/llms/testing.txt +4 -6
  161. package/llms/tools-agent.txt +24 -0
  162. package/llms/tools-mcp.txt +71 -6
  163. package/llms/tools-toolkit.txt +23 -0
  164. package/llms/tools.2.txt +8 -5
  165. package/llms/tools.3.txt +9 -78
  166. package/llms/tools.txt +8 -8
  167. package/llms/tracking-contract.txt +1 -1
  168. package/llms/tracking.txt +27 -5
  169. package/llms/{upgrading-0.105.0-0.118.0.txt → upgrading-0.106.0-0.120.0.txt} +152 -410
  170. package/llms/upgrading-0.37.0-0.53.0.txt +969 -0
  171. package/llms/{upgrading-0.44.0-0.62.0.txt → upgrading-0.55.0-0.68.0.txt} +509 -528
  172. package/llms/{upgrading-0.63.0-0.83.0.txt → upgrading-0.69.0-0.95.0.txt} +506 -509
  173. package/llms/{upgrading-0.84.0-0.104.0.txt → upgrading-0.96.0-0.105.0.txt} +410 -506
  174. package/llms/upgrading.txt +5 -5
  175. package/llms-full.txt +475 -154
  176. package/llms.txt +17 -14
  177. package/package.json +32 -20
  178. package/llms/upgrading-0.37.0-0.44.0.txt +0 -444
  179. package/dist/{index-arjmb6de.js → index-1jwsfkfz.js} +0 -0
  180. package/dist/{index-qndsr7f0.js → index-5efrpfmj.js} +3 -3
@@ -1,8 +1,9 @@
1
1
  import {
2
- sendUnloadBeacon2,
3
2
  redactTrackingText2,
4
- redactTrackingValue2
5
- } from "../index-vv1sch8a.js";
3
+ maskTrackingParameters,
4
+ redactTrackingValue2,
5
+ sendUnloadBeacon2
6
+ } from "../index-8vzh5wpv.js";
6
7
  import {
7
8
  ApiError2
8
9
  } from "../index-kfjkb396.js";
@@ -27,49 +28,55 @@ function isStoredTouch(value) {
27
28
  if (!isRecord(value) || !Number.isFinite(value.capturedAt))
28
29
  return false;
29
30
  const { data } = value;
30
- return isRecord(data) && isUtm(data.utm) && isOptionalText(data.referrer) && isOptionalText(data.landingPage);
31
+ return isRecord(data) && isUtm(data.utm) && (data.clickId === undefined || typeof data.clickId === "string" && data.clickId.length > 0 && data.clickId.length <= MAX_UTM_LENGTH) && isOptionalText(data.referrer) && isOptionalText(data.landingPage);
31
32
  }
32
33
  function isStoredAttribution(value) {
33
- return isRecord(value) && isStoredTouch(value.firstTouch) && isStoredTouch(value.currentTouch);
34
+ return isRecord(value) && value.version === 1 && isStoredTouch(value.firstTouch);
34
35
  }
35
- function normalize(value) {
36
+ function campaignValue(value) {
36
37
  if (!value)
37
38
  return;
38
- return value.toLowerCase().trim().slice(0, 200) || undefined;
39
+ return redactTrackingText2(value).slice(0, MAX_UTM_LENGTH);
39
40
  }
40
41
  function parseUtmFromSearch(search) {
41
42
  const params = new URLSearchParams(search);
42
- const source = normalize(params.get("utm_source"));
43
- if (!source)
44
- return null;
45
- return {
43
+ const source = campaignValue(params.get("utm_source"));
44
+ const utm = {
46
45
  source,
47
- medium: normalize(params.get("utm_medium")),
48
- campaign: normalize(params.get("utm_campaign")),
49
- content: normalize(params.get("utm_content")),
50
- term: normalize(params.get("utm_term"))
46
+ medium: campaignValue(params.get("utm_medium")),
47
+ campaign: campaignValue(params.get("utm_campaign")),
48
+ content: campaignValue(params.get("utm_content")),
49
+ term: campaignValue(params.get("utm_term"))
51
50
  };
51
+ return Object.values(utm).some((value) => value !== undefined) ? utm : null;
52
52
  }
53
- function parseReferrer(referrer, currentHostname, referrerMap = []) {
54
- if (!referrer)
55
- return null;
56
- try {
57
- const hostname = new URL(referrer).hostname.toLowerCase();
58
- if (hostname === currentHostname.toLowerCase())
59
- return null;
60
- const match = referrerMap.find((rule) => rule.pattern.test(hostname));
61
- return match ? { source: match.source, medium: match.medium } : { source: hostname, medium: "referral" };
62
- } catch {
63
- return null;
53
+ function assertClickIdParams(names) {
54
+ for (const name of names) {
55
+ if (typeof name !== "string" || name.length === 0 || name.length > MAX_UTM_LENGTH) {
56
+ throw new TypeError("clickIdParams names must contain 1–200 characters");
57
+ }
64
58
  }
65
59
  }
60
+ function trackedReferrer(referrer, clickIdParams) {
61
+ return maskTrackingParameters(redactTrackingText2(referrer), new Set(clickIdParams));
62
+ }
63
+ function clickIdFromSearch(search, names) {
64
+ const params = new URLSearchParams(search);
65
+ return names.find((name) => params.getAll(name).some((value) => value.length > 0));
66
+ }
67
+ function isFresh(capturedAt, now, ttlMs) {
68
+ const age = now - capturedAt;
69
+ return age >= 0 && age <= ttlMs;
70
+ }
66
71
  function readStored(storage, key, now, ttlMs) {
72
+ if (!storage)
73
+ return null;
67
74
  try {
68
75
  const raw = storage.getItem(key);
69
76
  if (!raw)
70
77
  return null;
71
78
  const parsed = JSON.parse(raw);
72
- if (!isStoredAttribution(parsed) || now - parsed.firstTouch.capturedAt > ttlMs) {
79
+ if (!isStoredAttribution(parsed) || !isFresh(parsed.firstTouch.capturedAt, now, ttlMs)) {
73
80
  storage.removeItem(key);
74
81
  return null;
75
82
  }
@@ -79,6 +86,8 @@ function readStored(storage, key, now, ttlMs) {
79
86
  }
80
87
  }
81
88
  function writeStored(storage, key, value) {
89
+ if (!storage)
90
+ return;
82
91
  try {
83
92
  storage.setItem(key, JSON.stringify(value));
84
93
  } catch {}
@@ -87,47 +96,27 @@ function resolveAttribution({
87
96
  search,
88
97
  referrer,
89
98
  pathname,
90
- hostname,
91
99
  storage,
92
- referrerMap = [],
100
+ clickIdParams = [],
93
101
  storageKey = "tracking.attribution",
94
102
  ttlMs = 90 * 24 * 60 * 60 * 1000,
95
103
  now = Date.now()
96
104
  }) {
105
+ assertClickIdParams(clickIdParams);
97
106
  const stored = readStored(storage, storageKey, now, ttlMs);
98
- const urlUtm = parseUtmFromSearch(search);
99
- if (urlUtm) {
100
- const currentTouch = {
101
- utm: urlUtm,
102
- referrer: referrer || undefined,
103
- landingPage: pathname
104
- };
105
- const persisted = {
106
- firstTouch: {
107
- data: stored?.firstTouch.data ?? currentTouch,
108
- capturedAt: stored?.firstTouch.capturedAt ?? now
109
- },
110
- currentTouch: { data: currentTouch, capturedAt: now }
111
- };
112
- writeStored(storage, storageKey, persisted);
113
- return {
114
- firstTouch: persisted.firstTouch.data,
115
- currentTouch: persisted.currentTouch.data
116
- };
117
- }
118
- if (stored)
119
- return { firstTouch: stored.firstTouch.data, currentTouch: stored.currentTouch.data };
120
- const fromReferrer = parseReferrer(referrer, hostname, referrerMap);
121
- const firstTouch = {
122
- utm: fromReferrer ? { source: fromReferrer.source, medium: fromReferrer.medium } : undefined,
123
- referrer: referrer || undefined,
124
- landingPage: pathname
107
+ const currentTouch = {
108
+ utm: parseUtmFromSearch(search) ?? undefined,
109
+ clickId: clickIdFromSearch(search, clickIdParams),
110
+ referrer: referrer ? trackedReferrer(referrer, clickIdParams) : undefined,
111
+ landingPage: redactTrackingText2(pathname)
125
112
  };
113
+ if (stored)
114
+ return { firstTouch: stored.firstTouch.data, currentTouch };
126
115
  writeStored(storage, storageKey, {
127
- firstTouch: { data: firstTouch, capturedAt: now },
128
- currentTouch: { data: firstTouch, capturedAt: now }
116
+ version: 1,
117
+ firstTouch: { data: currentTouch, capturedAt: now }
129
118
  });
130
- return { firstTouch, currentTouch: firstTouch };
119
+ return { firstTouch: currentTouch, currentTouch };
131
120
  }
132
121
  // src/tracking/clicks.ts
133
122
  function label(target) {
@@ -359,9 +348,10 @@ function bootstrapTrackingVisit(deps, renew) {
359
348
  browserStreamId: visit.browserStreamId,
360
349
  previousVisitId: visit.visitId ?? undefined,
361
350
  origin: page.origin,
362
- landingPath: redactTrackingText2(page.pathname),
363
- referrer: page.referrer ? redactTrackingText2(page.referrer) : undefined,
364
- utm: touch?.currentTouch.utm?.source ? redactedUtm(touch.currentTouch.utm) : undefined,
351
+ landingPath: touch.currentTouch.landingPage,
352
+ referrer: touch.currentTouch.referrer,
353
+ utm: touch.currentTouch.utm,
354
+ clickId: touch.currentTouch.clickId,
365
355
  displayMode: page.displayMode,
366
356
  screenWidth: page.screenWidth,
367
357
  screenHeight: page.screenHeight,
@@ -431,22 +421,18 @@ function createVisitSequences(outbox, visit, options, fail) {
431
421
  } : undefined
432
422
  });
433
423
  }
434
- function redactedUtm(utm) {
435
- return Object.fromEntries(Object.entries(utm).map(([field, value]) => [field, redactTrackingText2(value)]));
436
- }
437
- function pageAttribution(host, storage, referrerMap, search, pathname) {
424
+ function pageAttribution(host, clickIdParams, search, pathname) {
438
425
  const page = host.page();
439
426
  return resolveAttribution({
440
427
  search,
441
428
  pathname,
442
- referrer: redactTrackingText2(page.referrer),
443
- hostname: page.hostname,
444
- storage,
445
- referrerMap,
429
+ referrer: page.referrer,
430
+ storage: host.storage,
431
+ clickIdParams,
446
432
  now: host.wallClock()
447
433
  });
448
434
  }
449
- function pageViewDraft(host, type, pathname, previous) {
435
+ function pageViewDraft(host, type, pathname, previous, clickIdParams) {
450
436
  const page = host.page();
451
437
  return {
452
438
  type,
@@ -455,7 +441,7 @@ function pageViewDraft(host, type, pathname, previous) {
455
441
  title: page.title,
456
442
  screenWidth: page.viewportWidth,
457
443
  screenHeight: page.viewportHeight,
458
- referrer: previous || !page.referrer ? undefined : redactTrackingText2(page.referrer)
444
+ referrer: previous || !page.referrer ? undefined : trackedReferrer(page.referrer, clickIdParams ?? [])
459
445
  },
460
446
  clientTimestamp: host.wallClock()
461
447
  };
@@ -567,9 +553,6 @@ function chunk(items, size) {
567
553
  function unloadBeacon(unloadUrl) {
568
554
  return (request) => unloadUrl === undefined ? false : sendUnloadBeacon2(unloadUrl, JSON.stringify(request));
569
555
  }
570
- function currentUtmOf(attribution) {
571
- return attribution?.currentTouch.utm?.source ? redactedUtm(attribution.currentTouch.utm) : undefined;
572
- }
573
556
  function trackingTimings(config) {
574
557
  if (typeof config.buildId !== "string" || config.buildId.length === 0) {
575
558
  throw new Error('[stitchkit] tracking client requires a buildId — a git SHA or "dev"');
@@ -584,6 +567,7 @@ function trackingTimings(config) {
584
567
  function createTrackingClient(config) {
585
568
  const { host, builtin, outbox } = config;
586
569
  const { heartbeatMs, renewAfterHiddenMs, pendingLimit, batchSize } = trackingTimings(config);
570
+ assertClickIdParams(config.clickIdParams ?? []);
587
571
  const fail = config.onFailure ?? (() => {
588
572
  return;
589
573
  });
@@ -604,13 +588,11 @@ function createTrackingClient(config) {
604
588
  const scroll = createScrollMilestones(config.scrollMilestones);
605
589
  const sequences = createVisitSequences(outbox, visit, config.sequence, fail);
606
590
  const captureAttribution = (search, pathname) => {
607
- if (!host.storage)
608
- return null;
609
- attribution = pageAttribution(host, host.storage, config.referrerMap, search, pathname);
591
+ attribution = pageAttribution(host, config.clickIdParams, search, pathname);
610
592
  return attribution;
611
593
  };
612
594
  const bootstrapVisit = (renew = false) => bootstrapTrackingVisit({ visit, config, host, outbox, sequences, captureAttribution, fail }, renew);
613
- const deliver = (events) => deliverTrackedEvents(config, { buildId: config.buildId, events, utm: currentUtmOf(attribution) }, fail);
595
+ const deliver = (events) => deliverTrackedEvents(config, { buildId: config.buildId, events }, fail);
614
596
  const flushOutbox = createOutboxFlusher({
615
597
  outbox,
616
598
  isAvailable: () => visit.outboxAvailable,
@@ -672,7 +654,7 @@ function createTrackingClient(config) {
672
654
  send([draft]);
673
655
  return;
674
656
  }
675
- unload({ buildId: config.buildId, events: [event], utm: currentUtmOf(attribution) });
657
+ unload({ buildId: config.buildId, events: [event] });
676
658
  if (outbox && visit.outboxAvailable)
677
659
  outbox.enqueue(event).catch((error) => fail("unload event persistence", error));
678
660
  };
@@ -695,7 +677,7 @@ function createTrackingClient(config) {
695
677
  currentPage = pathname;
696
678
  meter.checkpoint();
697
679
  scroll.reset();
698
- send([pageViewDraft(host, builtin.pageView, pathname, previous)]);
680
+ send([pageViewDraft(host, builtin.pageView, pathname, previous, config.clickIdParams)]);
699
681
  };
700
682
  const start = () => {
701
683
  const generation = ++running;
@@ -754,7 +736,6 @@ function browserTrackingHost() {
754
736
  pathname: window.location.pathname,
755
737
  search: window.location.search,
756
738
  origin: window.location.origin,
757
- hostname: window.location.hostname,
758
739
  title: document.title,
759
740
  referrer: document.referrer,
760
741
  viewportWidth: window.innerWidth,
@@ -1032,7 +1013,6 @@ export {
1032
1013
  deliverTrackingBatch,
1033
1014
  indexedDbOutboxStorage,
1034
1015
  memoryOutboxStorage,
1035
- parseReferrer,
1036
1016
  parseUtmFromSearch,
1037
1017
  redactTrackingText2 as redactTrackingText,
1038
1018
  redactTrackingValue2 as redactTrackingValue,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DecimalInputSchema2,
3
3
  moneyToDecimal2
4
- } from "../index-qezhmp51.js";
4
+ } from "../index-nz06qw5a.js";
5
5
 
6
6
  // src/xlsx/cells.ts
7
7
  import { z } from "zod";
@@ -1,4 +1,5 @@
1
1
  export { createMaxMindGeoIpLoader } from './maxmind.js';
2
- export { createGeoIpResolver, mapGeoIpRecord } from './resolver.js';
2
+ export { mapGeoIpRecord } from './record.js';
3
+ export { createGeoIpResolver } from './resolver.js';
3
4
  export type { GeoAttribution, GeoIpReader, GeoIpReaderLoader, GeoIpResolver, GeoIpResolverOptions, GeoIpSnapshot, MaxMindGeoIpLoaderOptions, MaxMindGeoIpPaths, } from './types.js';
4
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjE,YAAY,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/geo/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,WAAW,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACjD,YAAY,EACV,cAAc,EACd,WAAW,EACX,iBAAiB,EACjB,aAAa,EACb,oBAAoB,EACpB,aAAa,EACb,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,SAAS,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type GeoAttribution } from './schema.js';
2
+ /**
3
+ * Map a City + ASN record to the complete sparse snapshot without exposing
4
+ * optional-peer types. Each field is validated by the schema on its own, so a
5
+ * malformed value drops that field and keeps the rest.
6
+ */
7
+ export declare function mapGeoIpRecord(value: unknown): GeoAttribution | null;
8
+ //# sourceMappingURL=record.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"record.d.ts","sourceRoot":"","sources":["../../src/geo/record.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,cAAc,EAAuC,MAAM,UAAU,CAAC;AAkCpF;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAsDpE"}
@@ -1,6 +1,4 @@
1
- import type { GeoAttribution, GeoIpResolver, GeoIpResolverOptions } from './types.js';
2
- /** Map the common MaxMind record shape without exposing peer types. */
3
- export declare function mapGeoIpRecord(value: unknown): GeoAttribution | null;
1
+ import type { GeoIpResolver, GeoIpResolverOptions } from './types.js';
4
2
  /**
5
3
  * Create a server-only GeoIP managed resource with atomic generation swaps.
6
4
  * Initial absence is non-fatal; reload failure preserves the last good reader.
@@ -1 +1 @@
1
- {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/geo/resolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,cAAc,EAEd,aAAa,EACb,oBAAoB,EAErB,MAAM,SAAS,CAAC;AAwBjB,uEAAuE;AACvE,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,cAAc,GAAG,IAAI,CAyBpE;AAID;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACpC,aAAa,CAyHf"}
1
+ {"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../../src/geo/resolver.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAe,aAAa,EAAE,oBAAoB,EAAiB,MAAM,SAAS,CAAC;AAc/F;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EACxC,OAAO,EAAE,oBAAoB,CAAC,MAAM,CAAC,GACpC,aAAa,CAyHf"}
@@ -0,0 +1,44 @@
1
+ import { z } from 'zod';
2
+ /** A label as the GeoIP database spells it; an empty string is no label. */
3
+ export declare const GeoTextSchema: z.ZodString;
4
+ /** GeoNames IDs and the accuracy radius: whole, nonnegative and exact. */
5
+ export declare const GeoNonnegativeIntegerSchema: z.ZodNumber;
6
+ /** One place's names by locale code, every language the database carries. */
7
+ export declare const GeoLocalizedNamesSchema: z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>;
8
+ /**
9
+ * Where an IP address is, as a GeoLite2 / GeoIP2 City and ASN record says it.
10
+ * Every field is optional: a record states what it knows. The located country
11
+ * and the country the address block is registered to are separate facts.
12
+ */
13
+ export declare const GeoAttributionSchema: z.ZodReadonly<z.ZodObject<{
14
+ continentCode: z.ZodOptional<z.ZodString>;
15
+ continentName: z.ZodOptional<z.ZodString>;
16
+ continentGeonameId: z.ZodOptional<z.ZodNumber>;
17
+ countryCode: z.ZodOptional<z.ZodString>;
18
+ countryName: z.ZodOptional<z.ZodString>;
19
+ countryGeonameId: z.ZodOptional<z.ZodNumber>;
20
+ registeredCountryCode: z.ZodOptional<z.ZodString>;
21
+ registeredCountryName: z.ZodOptional<z.ZodString>;
22
+ registeredCountryGeonameId: z.ZodOptional<z.ZodNumber>;
23
+ regionCode: z.ZodOptional<z.ZodString>;
24
+ regionName: z.ZodOptional<z.ZodString>;
25
+ regionGeonameId: z.ZodOptional<z.ZodNumber>;
26
+ city: z.ZodOptional<z.ZodString>;
27
+ cityGeonameId: z.ZodOptional<z.ZodNumber>;
28
+ postalCode: z.ZodOptional<z.ZodString>;
29
+ latitude: z.ZodOptional<z.ZodNumber>;
30
+ longitude: z.ZodOptional<z.ZodNumber>;
31
+ timezone: z.ZodOptional<z.ZodString>;
32
+ accuracyRadiusKm: z.ZodOptional<z.ZodNumber>;
33
+ autonomousSystemNumber: z.ZodOptional<z.ZodNumber>;
34
+ autonomousSystemOrganization: z.ZodOptional<z.ZodString>;
35
+ localizedNames: z.ZodOptional<z.ZodReadonly<z.ZodObject<{
36
+ continent: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
37
+ country: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
38
+ registeredCountry: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
39
+ region: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
40
+ city: z.ZodOptional<z.ZodReadonly<z.ZodRecord<z.ZodString, z.ZodString>>>;
41
+ }, z.core.$strict>>>;
42
+ }, z.core.$strict>>;
43
+ export type GeoAttribution = z.infer<typeof GeoAttributionSchema>;
44
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/geo/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,4EAA4E;AAC5E,eAAO,MAAM,aAAa,aAAoB,CAAC;AAC/C,0EAA0E;AAC1E,eAAO,MAAM,2BAA2B,aAAiC,CAAC;AAC1E,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,sDAAoD,CAAC;AAYzF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mBAyBpB,CAAC;AACd,MAAM,MAAM,cAAc,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC"}
@@ -1,17 +1,6 @@
1
1
  import type { ManagedResource, ManagedResourceContext } from '../application/resource.js';
2
- export interface GeoAttribution {
3
- readonly countryCode?: string;
4
- readonly countryName?: string;
5
- readonly regionCode?: string;
6
- readonly regionName?: string;
7
- readonly city?: string;
8
- readonly postalCode?: string;
9
- readonly latitude?: number;
10
- readonly longitude?: number;
11
- readonly timezone?: string;
12
- readonly autonomousSystemNumber?: number;
13
- readonly autonomousSystemOrganization?: string;
14
- }
2
+ import type { GeoAttribution } from './schema.js';
3
+ export type { GeoAttribution } from './schema.js';
15
4
  export interface MaxMindGeoIpPaths {
16
5
  readonly city: string;
17
6
  readonly asn?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","s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ommandError2
3
- } from "./index-f6m4c545.js";
3
+ } from "./index-zrdcmg6j.js";
4
4
  import {
5
5
  CommandStopped,
6
6
  startNativeCommand
7
- } from "./index-dr3t5n1v.js";
7
+ } from "./index-nn9qvkww.js";
8
8
  import {
9
9
  scanContainedFiles
10
- } from "./index-6f49krb5.js";
10
+ } from "./index-aa50qwv4.js";
11
11
  import {
12
12
  writeContainedFile
13
- } from "./index-q968hy6y.js";
13
+ } from "./index-e452syyh.js";
14
14
  import {
15
15
  listContainedDirectory,
16
16
  missingContainedDirectories,
@@ -24,10 +24,10 @@ import {
24
24
  containedEntryMetadata,
25
25
  openContainedParentFile,
26
26
  readContainedUtf8Handle
27
- } from "./index-arjmb6de.js";
27
+ } from "./index-1jwsfkfz.js";
28
28
  import {
29
29
  defineRuntimeTool2
30
- } from "./index-ega3yz4c.js";
30
+ } from "./index-aqwg2dm5.js";
31
31
  import {
32
32
  errnoOf
33
33
  } from "./index-jj9228tt.js";
@@ -252,18 +252,6 @@ async function recordAgentSandboxProbe2(input) {
252
252
  return grade;
253
253
  }
254
254
 
255
- // src/agent-runtime/coding-tools.ts
256
- import path4 from "node:path";
257
- import { z as z5 } from "zod";
258
-
259
- // src/agent-runtime/coding-tool-files.ts
260
- import { createHash } from "node:crypto";
261
- import { realpath as realpath2 } from "node:fs/promises";
262
-
263
- // src/agent-runtime/coding-tool-paths.ts
264
- import { lstat, realpath } from "node:fs/promises";
265
- import path from "node:path";
266
-
267
255
  // src/agent-runtime/coding-tool-refusals.ts
268
256
  function codingRefusal(code, message, options = {}) {
269
257
  throw new AppError2(code, {
@@ -359,7 +347,17 @@ function refuseUnknownSpillReference(reference) {
359
347
  });
360
348
  }
361
349
 
350
+ // src/agent-runtime/coding-tools.ts
351
+ import path4 from "node:path";
352
+ import { z as z5 } from "zod";
353
+
354
+ // src/agent-runtime/coding-tool-files.ts
355
+ import { createHash } from "node:crypto";
356
+ import { realpath as realpath2 } from "node:fs/promises";
357
+
362
358
  // src/agent-runtime/coding-tool-paths.ts
359
+ import { lstat, realpath } from "node:fs/promises";
360
+ import path from "node:path";
363
361
  function within(root, target) {
364
362
  const relative = path.relative(root, target);
365
363
  return relative === "" || !relative.startsWith(`..${path.sep}`) && relative !== ".." && !path.isAbsolute(relative);
@@ -0,0 +1,21 @@
1
+ // src/tools/agent-tool-error.ts
2
+ var AGENT_TOOL_ERROR_BRAND = Symbol.for("stitchkit.AgentToolError");
3
+
4
+ class AgentToolError2 extends Error {
5
+ output;
6
+ constructor(output, cause) {
7
+ let message = "Tool execution failed";
8
+ try {
9
+ message = JSON.stringify(output);
10
+ } catch {}
11
+ super(message, cause === undefined ? undefined : { cause });
12
+ this.name = "AgentToolError";
13
+ this.output = output;
14
+ Object.defineProperty(this, AGENT_TOOL_ERROR_BRAND, { value: true });
15
+ }
16
+ }
17
+ function isAgentToolError2(value) {
18
+ return typeof value === "object" && value !== null && AGENT_TOOL_ERROR_BRAND in value;
19
+ }
20
+
21
+ export { AgentToolError2, isAgentToolError2 };