arcy.js 0.1.2 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -352,6 +352,19 @@ var init_contract = __esm({
352
352
  }
353
353
  });
354
354
 
355
+ // src/picker/message.ts
356
+ var DESIGN_MODE_PROTOCOL, DESIGN_MODE_READY, DESIGN_MODE_PICK, DESIGN_MODE_EXIT, DESIGN_MODE_SCREENSHOT, SCREENSHOT_RENDER_BUDGET_MS;
357
+ var init_message = __esm({
358
+ "src/picker/message.ts"() {
359
+ DESIGN_MODE_PROTOCOL = 2;
360
+ DESIGN_MODE_READY = "arcy:design-mode:ready";
361
+ DESIGN_MODE_PICK = "arcy:design-mode:pick";
362
+ DESIGN_MODE_EXIT = "arcy:design-mode:exit";
363
+ DESIGN_MODE_SCREENSHOT = "arcy:design-mode:screenshot";
364
+ SCREENSHOT_RENDER_BUDGET_MS = 8e3;
365
+ }
366
+ });
367
+
355
368
  // src/shell/host.ts
356
369
  function isMounted(id = HOST_ID) {
357
370
  const shell = shells.get(id);
@@ -1593,7 +1606,7 @@ var init_transcript = __esm({
1593
1606
  .${MSG_CLASS}[data-role="system"] {
1594
1607
  align-self: flex-start;
1595
1608
  background: var(--_arcy-assistant-bg, #f2f4f7);
1596
- color: var(--_arcy-main-text, #101828);
1609
+ color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
1597
1610
  }
1598
1611
 
1599
1612
  /* \u2500\u2500 Rendered markdown inside an answer (D1023, ADR 0129; D1034) \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500 */
@@ -1648,7 +1661,7 @@ var init_transcript = __esm({
1648
1661
  font-size: 0.9em;
1649
1662
  padding: 1px 4px;
1650
1663
  border-radius: 4px;
1651
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 8%, transparent);
1664
+ background: color-mix(in srgb, currentColor 12%, transparent);
1652
1665
  white-space: pre-wrap;
1653
1666
  overflow-wrap: break-word;
1654
1667
  }
@@ -1657,8 +1670,8 @@ var init_transcript = __esm({
1657
1670
  margin: 0 0 8px;
1658
1671
  padding: 10px 12px;
1659
1672
  border-radius: 8px;
1660
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 6%, transparent);
1661
- border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 10%, transparent);
1673
+ background: color-mix(in srgb, currentColor 10%, transparent);
1674
+ border: 1px solid color-mix(in srgb, currentColor 16%, transparent);
1662
1675
  overflow-x: auto;
1663
1676
  white-space: pre;
1664
1677
  }
@@ -1841,13 +1854,14 @@ var init_transcript = __esm({
1841
1854
  padding: 12px;
1842
1855
  border-radius: 12px;
1843
1856
  background: var(--_arcy-assistant-bg, #f2f4f7);
1857
+ color: var(--_arcy-assistant-text, var(--_arcy-main-text, #101828));
1844
1858
  }
1845
1859
 
1846
1860
  .${PENDING_CLASS} span {
1847
1861
  width: 6px;
1848
1862
  height: 6px;
1849
1863
  border-radius: 999px;
1850
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 45%, transparent);
1864
+ background: color-mix(in srgb, currentColor 55%, transparent);
1851
1865
  animation: arcy-chat-typing 1.2s ease-in-out infinite;
1852
1866
  }
1853
1867
 
@@ -4419,7 +4433,7 @@ function mount(context) {
4419
4433
  historyDrawer.close();
4420
4434
  },
4421
4435
  onSelect: (conversationId) => {
4422
- if ((context.getConversationId?.() ?? "") === conversationId) {
4436
+ if ((context.getConversationId?.() ?? "") === conversationId && !transcript.isEmpty()) {
4423
4437
  historyDrawer.close();
4424
4438
  return;
4425
4439
  }
@@ -4643,11 +4657,13 @@ function mount(context) {
4643
4657
  renderWelcome();
4644
4658
  };
4645
4659
  let catalogRequested = false;
4660
+ let catalogAudience = null;
4646
4661
  const requestFlowCatalog = () => {
4647
4662
  if (catalogRequested) return true;
4648
4663
  const sessionToken = context.getSessionToken?.();
4649
4664
  if (!sessionToken) return false;
4650
4665
  catalogRequested = true;
4666
+ catalogAudience = widget()?.audience || null;
4651
4667
  void fetchFlowCatalog({
4652
4668
  apiBase: context.apiBase,
4653
4669
  sessionToken,
@@ -4718,6 +4734,11 @@ function mount(context) {
4718
4734
  fillCard.reposition();
4719
4735
  },
4720
4736
  refreshChrome() {
4737
+ const audience = widget()?.audience || null;
4738
+ if (catalogRequested && audience !== null && catalogAudience !== null && audience !== catalogAudience && transcript.isEmpty()) {
4739
+ catalogRequested = false;
4740
+ starterFlowsPending = true;
4741
+ }
4721
4742
  if (!requestFlowCatalog() && starterFlowsPending) {
4722
4743
  settleStarterFlows([]);
4723
4744
  }
@@ -5070,25 +5091,45 @@ var init_chat = __esm({
5070
5091
  min-height: 34px;
5071
5092
  }
5072
5093
 
5094
+ /* Painted in the operator's brand, not in neutral grey (D1478). These pills
5095
+ are the first thing a visitor is invited to touch, and a grey outline on a
5096
+ welcome screen reads as chrome rather than as an offer. Tinted rather than
5097
+ filled, the same brand-on-brand-wash pair the transcript already uses for a
5098
+ pressed rating: up to five of these sit in one row, and five solid brand
5099
+ buttons would fight both each other and the send button below them. The
5100
+ brand colour therefore lands on the border, on the wash behind the label,
5101
+ and on the label itself, all derived from the one token the operator set. */
5073
5102
  .${STARTER_CLASS} {
5074
5103
  appearance: none;
5075
5104
  text-align: left;
5076
5105
  font: inherit;
5077
5106
  font-size: 12.5px;
5107
+ font-weight: 500;
5078
5108
  cursor: pointer;
5079
5109
  padding: 7px 13px;
5080
5110
  border-radius: 999px;
5081
- border: 1px solid color-mix(in srgb, var(--_arcy-main-text, #101828) 14%, transparent);
5082
- background: transparent;
5083
- color: inherit;
5111
+ border: 1px solid color-mix(in srgb, var(--_arcy-brand-bg, #101828) 28%, transparent);
5112
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 8%, transparent);
5113
+ color: var(--_arcy-brand-bg, #101828);
5084
5114
  max-width: 100%;
5085
5115
  transition: background 120ms ease, border-color 120ms ease;
5086
5116
  -webkit-tap-highlight-color: transparent;
5087
5117
  }
5088
5118
 
5089
5119
  .${STARTER_CLASS}:hover {
5090
- background: color-mix(in srgb, var(--_arcy-main-text, #101828) 9%, transparent);
5091
- border-color: color-mix(in srgb, var(--_arcy-main-text, #101828) 30%, transparent);
5120
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 16%, transparent);
5121
+ border-color: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 48%, transparent);
5122
+ }
5123
+
5124
+ .${STARTER_CLASS}:active {
5125
+ background: color-mix(in srgb, var(--_arcy-brand-bg, #101828) 24%, transparent);
5126
+ }
5127
+
5128
+ /* Brand rather than "currentColor", so the ring stays the same colour on a
5129
+ pill whose label the host page has managed to restyle. */
5130
+ .${STARTER_CLASS}:focus-visible {
5131
+ outline: 2px solid var(--_arcy-brand-bg, #101828);
5132
+ outline-offset: 2px;
5092
5133
  }
5093
5134
 
5094
5135
  @media (prefers-reduced-motion: reduce) {
@@ -8722,6 +8763,7 @@ var init_screenshot = __esm({
8722
8763
  "src/picker/screenshot.ts"() {
8723
8764
  init_dist();
8724
8765
  init_host();
8766
+ init_message();
8725
8767
  CROP_MARGIN_RATIO = 0.25;
8726
8768
  CROP_MARGIN_MAX_PX = 160;
8727
8769
  CROP_MARGIN_MIN_PX = 28;
@@ -8730,7 +8772,7 @@ var init_screenshot = __esm({
8730
8772
  OUTPUT_MAX_DPR = 2;
8731
8773
  OUTPUT_MAX_PIXELS = 26e5;
8732
8774
  DATA_URL_SOFT_MAX = 36e5;
8733
- RENDER_TIMEOUT_MS = 8e3;
8775
+ RENDER_TIMEOUT_MS = SCREENSHOT_RENDER_BUDGET_MS;
8734
8776
  PII_PATTERNS2 = [
8735
8777
  /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,
8736
8778
  /\b\d{3}-\d{2}-\d{4}\b/g,
@@ -9168,13 +9210,7 @@ function normalizeRoute(href, base) {
9168
9210
 
9169
9211
  // src/picker/activate.ts
9170
9212
  init_warn();
9171
-
9172
- // src/picker/message.ts
9173
- var DESIGN_MODE_PROTOCOL = 2;
9174
- var DESIGN_MODE_READY = "arcy:design-mode:ready";
9175
- var DESIGN_MODE_PICK = "arcy:design-mode:pick";
9176
- var DESIGN_MODE_EXIT = "arcy:design-mode:exit";
9177
- var DESIGN_MODE_SCREENSHOT = "arcy:design-mode:screenshot";
9213
+ init_message();
9178
9214
 
9179
9215
  // src/picker/notice.ts
9180
9216
  init_host();
@@ -13113,6 +13149,11 @@ function createArcyInternals(internalOptions = {}) {
13113
13149
  welcomeMessage: text(raw?.welcomeMessage),
13114
13150
  inputPlaceholder: text(raw?.inputPlaceholder),
13115
13151
  welcomeHeadline: text(raw?.welcomeHeadline),
13152
+ // Which copy the three texts above are (ADR 0195). Shape-checked like
13153
+ // everything else read out of the bootstrap (ADR 0050), and anything
13154
+ // that is not one of the two audiences reads as the empty string, which
13155
+ // the panel treats as "not known yet" and never as a change.
13156
+ audience: raw?.audience === "identified" || raw?.audience === "anonymous" ? raw.audience : "",
13116
13157
  // Re-checked here rather than trusted: a rewritten bootstrap must not
13117
13158
  // be able to turn a camera prompt on for an operator who never did
13118
13159
  // (ADR 0050, ADR 0102).
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { DESIGN_MODE_PROTOCOL, DESIGN_MODE_EXIT, DESIGN_MODE_SCREENSHOT, DESIGN_MODE_PICK, DESIGN_MODE_READY } from './chunk-7VVKR3AO.js';
2
1
  import { FALLBACK_CHROME, resolveImageUrl, FONT_KEY_PROPERTY, isRenderableImageUrl, readViewport, POLICY_LINK_CLASS, BAR_TRAY_CLASS, ATTACHABLE_TYPES, TOOLTIP_CSS, surfaceWidth, clampOffsetX, dragTransform, carriesFiles, droppedFiles, MOBILE_MARGIN, CHAT_CONTRACT, CHAT_GLOBAL } from './chunk-DW3GUQ6J.js';
3
2
  import { createShellState, safeStore, browserSessionStorage, writeJson, browserLocalStorage, readJson, hasPendingPreview, createFlowRunState, FLOW_CONTRACT, FLOW_GLOBAL } from './chunk-FR6SJSDU.js';
4
3
  import { PICKER_CONTRACT, PICKER_GLOBAL } from './chunk-DKYMIAYF.js';
4
+ import { DESIGN_MODE_PROTOCOL, DESIGN_MODE_EXIT, DESIGN_MODE_SCREENSHOT, DESIGN_MODE_PICK, DESIGN_MODE_READY } from './chunk-GDGE3HLE.js';
5
5
  import { warn, reportCspViolations, releaseHostFocus, Z_INDEX, createShell, injectStyles } from './chunk-LGWYJSYX.js';
6
6
  import { captureEventFingerprint, containsPii } from './chunk-NY3NXM2V.js';
7
7
 
@@ -3998,6 +3998,11 @@ function createArcyInternals(internalOptions = {}) {
3998
3998
  welcomeMessage: text(raw?.welcomeMessage),
3999
3999
  inputPlaceholder: text(raw?.inputPlaceholder),
4000
4000
  welcomeHeadline: text(raw?.welcomeHeadline),
4001
+ // Which copy the three texts above are (ADR 0195). Shape-checked like
4002
+ // everything else read out of the bootstrap (ADR 0050), and anything
4003
+ // that is not one of the two audiences reads as the empty string, which
4004
+ // the panel treats as "not known yet" and never as a change.
4005
+ audience: raw?.audience === "identified" || raw?.audience === "anonymous" ? raw.audience : "",
4001
4006
  // Re-checked here rather than trusted: a rewritten bootstrap must not
4002
4007
  // be able to turn a camera prompt on for an operator who never did
4003
4008
  // (ADR 0050, ADR 0102).
@@ -4717,7 +4722,7 @@ var bundledChunks = {
4717
4722
  cdnBase: null,
4718
4723
  loadChat: (win, timeoutMs, setTimeoutImpl) => importChunk(
4719
4724
  win,
4720
- () => import('./chat-IU4IJMGO.js'),
4725
+ () => import('./chat-VOYR3S25.js'),
4721
4726
  CHAT_GLOBAL,
4722
4727
  CHAT_CONTRACT,
4723
4728
  "chat panel",
@@ -4735,7 +4740,7 @@ var bundledChunks = {
4735
4740
  ),
4736
4741
  loadPicker: (win, timeoutMs, setTimeoutImpl) => importChunk(
4737
4742
  win,
4738
- () => import('./picker-JPESE6JJ.js'),
4743
+ () => import('./picker-GPZ2GHB4.js'),
4739
4744
  PICKER_GLOBAL,
4740
4745
  PICKER_CONTRACT,
4741
4746
  "design-mode picker",
@@ -1,4 +1,5 @@
1
1
  import { PICKER_CONTRACT, PICKER_GLOBAL } from './chunk-DKYMIAYF.js';
2
+ import { SCREENSHOT_RENDER_BUDGET_MS } from './chunk-GDGE3HLE.js';
2
3
  import { createShell, injectStyles, warn, HOST_ATTRIBUTE } from './chunk-LGWYJSYX.js';
3
4
  import { matchTarget } from './chunk-NIHUDSWK.js';
4
5
  import { resolveInteractiveTarget, createTargetFingerprint, captureEventFingerprint, closestAcrossShadow, isStableId, containsPii, SELECTOR_CANDIDATES_MAX, collectElementsDeep, querySelectorAllDeep } from './chunk-NY3NXM2V.js';
@@ -1665,7 +1666,7 @@ var CROP_MAX_HEIGHT = 1200;
1665
1666
  var OUTPUT_MAX_DPR = 2;
1666
1667
  var OUTPUT_MAX_PIXELS = 26e5;
1667
1668
  var DATA_URL_SOFT_MAX = 36e5;
1668
- var RENDER_TIMEOUT_MS = 8e3;
1669
+ var RENDER_TIMEOUT_MS = SCREENSHOT_RENDER_BUDGET_MS;
1669
1670
  var PII_PATTERNS = [
1670
1671
  /[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}/g,
1671
1672
  /\b\d{3}-\d{2}-\d{4}\b/g,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "arcy.js",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "ARCY — the universal JavaScript utility for embedding an AI agent that talks to, learns from, and acts on behalf of your users.",
5
5
  "license": "MIT",
6
6
  "type": "module",