@sixb/app 0.1.15 → 0.1.17

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 (125) hide show
  1. package/README.md +8 -0
  2. package/dist/agent/agent-chat.d.ts +8 -1
  3. package/dist/agent/agent-chat.d.ts.map +1 -1
  4. package/dist/agent/agent-panel.d.ts +8 -1
  5. package/dist/agent/agent-panel.d.ts.map +1 -1
  6. package/dist/agent/agent-surface.d.ts +8 -1
  7. package/dist/agent/agent-surface.d.ts.map +1 -1
  8. package/dist/agent/approvals.d.ts +1 -4
  9. package/dist/agent/approvals.d.ts.map +1 -1
  10. package/dist/agent/artifact-panel.d.ts +21 -2
  11. package/dist/agent/artifact-panel.d.ts.map +1 -1
  12. package/dist/agent/components/activity-status.d.ts +1 -1
  13. package/dist/agent/components/activity-status.d.ts.map +1 -1
  14. package/dist/agent/components/agent-threads.d.ts +15 -0
  15. package/dist/agent/components/agent-threads.d.ts.map +1 -0
  16. package/dist/agent/components/approval-card.d.ts +4 -4
  17. package/dist/agent/components/approval-card.d.ts.map +1 -1
  18. package/dist/agent/components/approval-mode-chip.d.ts +4 -6
  19. package/dist/agent/components/approval-mode-chip.d.ts.map +1 -1
  20. package/dist/agent/components/auto-model-chip.d.ts +2 -3
  21. package/dist/agent/components/auto-model-chip.d.ts.map +1 -1
  22. package/dist/agent/components/composer-menu.d.ts +42 -0
  23. package/dist/agent/components/composer-menu.d.ts.map +1 -0
  24. package/dist/agent/components/composer.d.ts +8 -5
  25. package/dist/agent/components/composer.d.ts.map +1 -1
  26. package/dist/agent/components/conversation-panel.d.ts +3 -12
  27. package/dist/agent/components/conversation-panel.d.ts.map +1 -1
  28. package/dist/agent/components/dictation-bar.d.ts +13 -0
  29. package/dist/agent/components/dictation-bar.d.ts.map +1 -0
  30. package/dist/agent/components/message-parts.d.ts.map +1 -1
  31. package/dist/agent/components/message-view.d.ts +3 -1
  32. package/dist/agent/components/message-view.d.ts.map +1 -1
  33. package/dist/agent/components/model-controls.d.ts +15 -0
  34. package/dist/agent/components/model-controls.d.ts.map +1 -1
  35. package/dist/agent/components/model-picker-row.d.ts +9 -2
  36. package/dist/agent/components/model-picker-row.d.ts.map +1 -1
  37. package/dist/agent/components/participant-input.d.ts +7 -6
  38. package/dist/agent/components/participant-input.d.ts.map +1 -1
  39. package/dist/agent/components/thread-people.d.ts +4 -4
  40. package/dist/agent/components/thread-people.d.ts.map +1 -1
  41. package/dist/agent/components/threads-button.d.ts +14 -0
  42. package/dist/agent/components/threads-button.d.ts.map +1 -0
  43. package/dist/agent/conversation.d.ts +3 -1
  44. package/dist/agent/conversation.d.ts.map +1 -1
  45. package/dist/agent/delegation/child-card.d.ts +24 -11
  46. package/dist/agent/delegation/child-card.d.ts.map +1 -1
  47. package/dist/agent/delegation/child-cards.d.ts +2 -2
  48. package/dist/agent/delegation/child-cards.d.ts.map +1 -1
  49. package/dist/agent/delegation/child-group.d.ts +5 -4
  50. package/dist/agent/delegation/child-group.d.ts.map +1 -1
  51. package/dist/agent/delegation/child-parts.d.ts +17 -18
  52. package/dist/agent/delegation/child-parts.d.ts.map +1 -1
  53. package/dist/agent/delegation/child-work.d.ts +0 -13
  54. package/dist/agent/delegation/child-work.d.ts.map +1 -1
  55. package/dist/agent/delegation/interpret.d.ts +0 -5
  56. package/dist/agent/delegation/interpret.d.ts.map +1 -1
  57. package/dist/agent/delegation/model.d.ts +12 -6
  58. package/dist/agent/delegation/model.d.ts.map +1 -1
  59. package/dist/agent/dictation.d.ts +16 -0
  60. package/dist/agent/dictation.d.ts.map +1 -0
  61. package/dist/agent/hooks/use-agent-conversation.d.ts +3 -270
  62. package/dist/agent/hooks/use-agent-conversation.d.ts.map +1 -1
  63. package/dist/agent/hooks/use-people-suggestions.d.ts +21 -0
  64. package/dist/agent/hooks/use-people-suggestions.d.ts.map +1 -0
  65. package/dist/agent/hooks/use-thread-lists.d.ts +220 -0
  66. package/dist/agent/hooks/use-thread-lists.d.ts.map +1 -0
  67. package/dist/agent/i18n/en.d.ts +47 -36
  68. package/dist/agent/i18n/en.d.ts.map +1 -1
  69. package/dist/agent/i18n/fr.d.ts.map +1 -1
  70. package/dist/agent/i18n/index.d.ts +84 -72
  71. package/dist/agent/i18n/index.d.ts.map +1 -1
  72. package/dist/agent/react-router.d.ts +9 -0
  73. package/dist/agent/react-router.d.ts.map +1 -1
  74. package/dist/agent/run-presentation.d.ts +4 -1
  75. package/dist/agent/run-presentation.d.ts.map +1 -1
  76. package/dist/agent/thread-navigation.d.ts +8 -0
  77. package/dist/agent/thread-navigation.d.ts.map +1 -1
  78. package/dist/agent/thread-pages.d.ts +11 -0
  79. package/dist/agent/thread-pages.d.ts.map +1 -0
  80. package/dist/artifacts/person-avatar.d.ts +2 -2
  81. package/dist/{chunk-twjs2sb9.js → chunk-12v6y89k.js} +1661 -1485
  82. package/dist/{chunk-twjs2sb9.js.map → chunk-12v6y89k.js.map} +10 -8
  83. package/dist/{chunk-qh1panvd.js → chunk-2a69ge8h.js} +1 -1
  84. package/dist/{chunk-736c9akn.js → chunk-bpj9mg5c.js} +1 -1
  85. package/dist/{chunk-n0cxwvej.js → chunk-hzy2g13h.js} +1 -1
  86. package/dist/codegen.d.ts.map +1 -1
  87. package/dist/createCustomApp.d.ts.map +1 -1
  88. package/dist/frame-origins.d.ts +10 -0
  89. package/dist/frame-origins.d.ts.map +1 -0
  90. package/dist/index.d.ts +2 -1
  91. package/dist/index.d.ts.map +1 -1
  92. package/dist/index.js +6 -2
  93. package/dist/index.js.map +4 -4
  94. package/dist/pages/home.d.ts.map +1 -1
  95. package/dist/pages/observability/ai-usage/calls.d.ts.map +1 -1
  96. package/dist/pages/settings/memory-history.d.ts.map +1 -1
  97. package/dist/pages/settings/messages.d.ts.map +1 -1
  98. package/dist/pages/values.d.ts +5 -0
  99. package/dist/pages/values.d.ts.map +1 -1
  100. package/dist/pages.d.ts +1 -1
  101. package/dist/pages.d.ts.map +1 -1
  102. package/dist/pages.js +2 -2
  103. package/dist/server.js +97 -22
  104. package/dist/server.js.map +6 -5
  105. package/dist/shell/agent-dock.d.ts.map +1 -1
  106. package/package.json +4 -4
  107. package/src/agent/agent-chat.tsx +11 -1
  108. package/src/agent/agent-panel.tsx +7 -0
  109. package/src/agent/agent-surface.tsx +7 -0
  110. package/src/agent/components/composer.tsx +143 -73
  111. package/src/agent/components/dictation-bar.tsx +110 -0
  112. package/src/agent/dictation.ts +48 -0
  113. package/src/agent/hooks/use-agent-conversation.ts +3 -0
  114. package/src/agent/i18n/en.ts +4 -0
  115. package/src/agent/i18n/fr.ts +4 -0
  116. package/src/codegen.ts +44 -0
  117. package/src/createCustomApp.ts +53 -26
  118. package/src/frame-origins.ts +61 -0
  119. package/dist/agent/agents-page.d.ts +0 -4
  120. package/dist/agent/agents-page.d.ts.map +0 -1
  121. package/dist/agent/components/agent-thread-switcher.d.ts +0 -37
  122. package/dist/agent/components/agent-thread-switcher.d.ts.map +0 -1
  123. /package/dist/{chunk-qh1panvd.js.map → chunk-2a69ge8h.js.map} +0 -0
  124. /package/dist/{chunk-736c9akn.js.map → chunk-bpj9mg5c.js.map} +0 -0
  125. /package/dist/{chunk-n0cxwvej.js.map → chunk-hzy2g13h.js.map} +0 -0
package/src/codegen.ts CHANGED
@@ -717,6 +717,49 @@ function InternalLinkInterceptor({ basename }: { readonly basename?: string }) {
717
717
  return null
718
718
  }
719
719
 
720
+ // The page frames only the API and the sites SIXB_APP_FRAME_ORIGINS lists. The browser logs a
721
+ // refused <iframe> without saying where that list lives: name it, once per site. A site counts
722
+ // only when an <iframe> asked for it: an artifact frame that navigates elsewhere keeps the API's
723
+ // address as its src, and the list is no place for wherever its code tried to go.
724
+ function RefusedFrameReporter() {
725
+ // Subscribed before the browser can report a frame rendered in the same commit.
726
+ React.useLayoutEffect(() => {
727
+ const reported = new Set<string>()
728
+
729
+ function onViolation(event: SecurityPolicyViolationEvent) {
730
+ if (event.effectiveDirective !== "frame-src") return
731
+
732
+ const origin = originOf(event.blockedURI)
733
+ if (!origin || reported.has(origin)) return
734
+
735
+ const frames = Array.from(document.querySelectorAll("iframe"))
736
+ if (!frames.some((frame) => originOf(frame.src) === origin)) return
737
+
738
+ reported.add(origin)
739
+ console.warn(
740
+ "[SixbApp] The app refused to frame " +
741
+ origin +
742
+ ". Add each site a frame loads, redirects included, to SIXB_APP_FRAME_ORIGINS on the " +
743
+ "app server."
744
+ )
745
+ }
746
+
747
+ document.addEventListener("securitypolicyviolation", onViolation)
748
+ return () => document.removeEventListener("securitypolicyviolation", onViolation)
749
+ }, [])
750
+
751
+ return null
752
+ }
753
+
754
+ function originOf(url: string): string | null {
755
+ try {
756
+ const { origin } = new URL(url)
757
+ return origin === "null" ? null : origin
758
+ } catch {
759
+ return null
760
+ }
761
+ }
762
+
720
763
  function pathInsideApp(pathname: string, basename: string | undefined): string {
721
764
  if (
722
765
  basename &&
@@ -987,6 +1030,7 @@ function App({ basename }: StartAppOptions) {
987
1030
  ${sectionsStart}
988
1031
  <BrowserRouter basename={basename}>
989
1032
  <ActivityPageView />
1033
+ <RefusedFrameReporter />
990
1034
  <SharedDocumentLinkInterceptor basename={basename} />
991
1035
  <InternalLinkInterceptor basename={basename} />
992
1036
  {basename ? (
@@ -20,6 +20,7 @@ import {
20
20
  generateRouteManifest,
21
21
  } from "./codegen"
22
22
  import { devReloadResponse } from "./dev-reload"
23
+ import { readAppFrameOrigins } from "./frame-origins"
23
24
  import { collectPublicEnv, renderCustomAppRuntimeScript } from "./runtime"
24
25
  import { type PageRoute, routePatternKey, scanAppRoutes } from "./scanner"
25
26
  import { sectionCatalog } from "./sections/catalog"
@@ -354,6 +355,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
354
355
 
355
356
  async dev(devOptions: CustomAppDevOptions = {}) {
356
357
  const publicEnv = collectPublicEnv()
358
+ const frameOrigins = readAppFrameOrigins(process.env)
357
359
  const withRuntime = (html: string) =>
358
360
  injectRuntimeConfig(html, { apiBaseUrl, authEnabled, publicEnv })
359
361
  const host = devOptions.host ?? "0.0.0.0"
@@ -397,17 +399,20 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
397
399
  authEnabled: false,
398
400
  publicEnv,
399
401
  }),
400
- apiBaseUrl
402
+ apiBaseUrl,
403
+ frameOrigins
401
404
  ),
402
405
  "/": spaHtmlRoute(() => internalOrigin, {
403
406
  shellRoute: privateAppShellRoute,
404
407
  transformHtml: withRuntime,
405
408
  apiBaseUrl,
409
+ frameOrigins,
406
410
  }),
407
411
  "/*": spaHtmlRoute(() => internalOrigin, {
408
412
  shellRoute: privateAppShellRoute,
409
413
  transformHtml: withRuntime,
410
414
  apiBaseUrl,
415
+ frameOrigins,
411
416
  }),
412
417
  },
413
418
  }) as Parameters<typeof Bun.serve>[0]
@@ -577,6 +582,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
577
582
 
578
583
  async start(startOptions: CustomAppStartOptions = {}) {
579
584
  const publicEnv = collectPublicEnv()
585
+ const frameOrigins = readAppFrameOrigins(process.env)
580
586
  const host = startOptions.host ?? "0.0.0.0"
581
587
  const port = startOptions.port ?? 3000
582
588
  const outdir = resolve(rootDir, startOptions.outdir ?? join(".sixb", "dist", "app"))
@@ -629,7 +635,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
629
635
  if (isAssetRequest(url.pathname)) {
630
636
  return notFoundResponse()
631
637
  }
632
- return sharedHtmlResponse(req, sharedIndexHtml, runtimeApiBaseUrl)
638
+ return sharedHtmlResponse(req, sharedIndexHtml, runtimeApiBaseUrl, frameOrigins)
633
639
  }
634
640
 
635
641
  if (isSharedNamespace(url.pathname)) {
@@ -637,7 +643,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
637
643
  }
638
644
 
639
645
  if (url.pathname === "/" || url.pathname === "") {
640
- return htmlResponse(req, indexHtml, runtimeApiBaseUrl)
646
+ return htmlResponse(req, indexHtml, runtimeApiBaseUrl, frameOrigins)
641
647
  }
642
648
 
643
649
  const resolvedPath = resolveStaticPath(outdir, url.pathname)
@@ -648,7 +654,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
648
654
  const directFile = Bun.file(resolvedPath)
649
655
  if (await directFile.exists()) {
650
656
  if (resolvedPath === indexPath) {
651
- return htmlResponse(req, indexHtml, runtimeApiBaseUrl)
657
+ return htmlResponse(req, indexHtml, runtimeApiBaseUrl, frameOrigins)
652
658
  }
653
659
  return staticFileResponse(req, resolvedPath, staticAssetHeaders(url.pathname))
654
660
  }
@@ -660,7 +666,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
660
666
  const htmlFile = Bun.file(`${resolvedPath}.html`)
661
667
  if (await htmlFile.exists()) {
662
668
  if (`${resolvedPath}.html` === indexPath) {
663
- return htmlResponse(req, indexHtml, runtimeApiBaseUrl)
669
+ return htmlResponse(req, indexHtml, runtimeApiBaseUrl, frameOrigins)
664
670
  }
665
671
  return fileResponse(req, htmlFile)
666
672
  }
@@ -670,7 +676,7 @@ export async function createCustomApp(options: CreateCustomAppOptions): Promise<
670
676
  return fileResponse(req, nestedIndexFile)
671
677
  }
672
678
 
673
- return htmlResponse(req, indexHtml, runtimeApiBaseUrl)
679
+ return htmlResponse(req, indexHtml, runtimeApiBaseUrl, frameOrigins)
674
680
  },
675
681
  })
676
682
 
@@ -885,7 +891,8 @@ function reservedSixbRoutes(): BunServeRoutes {
885
891
 
886
892
  function sharedAppDevRoutes(
887
893
  html: () => string | Promise<string>,
888
- apiBaseUrl: string | undefined
894
+ apiBaseUrl: string | undefined,
895
+ frameOrigins: readonly string[]
889
896
  ): BunServeRoutes {
890
897
  const reject = () => notFoundResponse()
891
898
  const guardedHandler = async (request: Request) => {
@@ -893,7 +900,7 @@ function sharedAppDevRoutes(
893
900
  if (!isSharedAppRoute(pathname) || isAssetRequest(pathname)) {
894
901
  return notFoundResponse()
895
902
  }
896
- return sharedHtmlResponse(request, await html(), apiBaseUrl)
903
+ return sharedHtmlResponse(request, await html(), apiBaseUrl, frameOrigins)
897
904
  }
898
905
 
899
906
  return {
@@ -1061,33 +1068,51 @@ function injectRuntimeConfig(
1061
1068
  return `${script}\n${html}`
1062
1069
  }
1063
1070
 
1064
- function htmlResponse(request: Request, html: string, apiBaseUrl: string | undefined): Response {
1071
+ function htmlResponse(
1072
+ request: Request,
1073
+ html: string,
1074
+ apiBaseUrl: string | undefined,
1075
+ frameOrigins: readonly string[]
1076
+ ): Response {
1065
1077
  return new Response(request.method === "HEAD" ? null : html, {
1066
1078
  headers: {
1067
1079
  "content-type": "text/html; charset=utf-8",
1068
1080
  "cache-control": "no-store",
1069
- "content-security-policy": appContentSecurityPolicy(request, apiBaseUrl),
1081
+ "content-security-policy": appContentSecurityPolicy(request, apiBaseUrl, frameOrigins),
1070
1082
  },
1071
1083
  })
1072
1084
  }
1073
1085
 
1074
1086
  /**
1075
- * The policy of the app's own page: it frames only what the API serves, its artifacts' frames.
1076
- * A page in one reads its queries' rows as the reader; its frame opens no window, and the frame's
1077
- * policy keeps what it loads to its files and a few CDNs. This keeps the frame's navigations on the
1078
- * API's origin too, so a page's code cannot send what it reads to another site in an address.
1087
+ * The policy of the app's own page: it frames what the API serves, its artifacts' frames, and the
1088
+ * sites `SIXB_APP_FRAME_ORIGINS` lists. A page in an artifact frame reads its queries' rows as the
1089
+ * reader; its frame opens no window, and the frame's policy keeps what it loads to its files and a
1090
+ * few CDNs. This keeps the frame's navigations on those origins too, so a page's code cannot send
1091
+ * what it reads to any other site in an address.
1079
1092
  *
1080
1093
  * It is the only directive: what a project's own pages load is theirs, but a frame they embed from
1081
- * another site is refused too.
1094
+ * a site the list leaves out is refused too.
1082
1095
  */
1083
- function appContentSecurityPolicy(request: Request, apiBaseUrl: string | undefined): string {
1084
- return `frame-src ${frameSource(request, apiBaseUrl)}`
1096
+ function appContentSecurityPolicy(
1097
+ request: Request,
1098
+ apiBaseUrl: string | undefined,
1099
+ frameOrigins: readonly string[]
1100
+ ): string {
1101
+ return `frame-src ${frameSources(request, apiBaseUrl, frameOrigins)}`
1085
1102
  }
1086
1103
 
1087
- /** Where an artifact frame comes from: the API's origin, `'self'` when it is the page's own. */
1088
- function frameSource(request: Request, apiBaseUrl: string | undefined): string {
1104
+ /**
1105
+ * Where the page's frames may come from: the API's origin, `'self'` when it is the page's own, then
1106
+ * the listed sites.
1107
+ */
1108
+ function frameSources(
1109
+ request: Request,
1110
+ apiBaseUrl: string | undefined,
1111
+ frameOrigins: readonly string[]
1112
+ ): string {
1089
1113
  const { requestOrigin, apiOrigin } = resolveOrigins(request, apiBaseUrl)
1090
- return apiOrigin === requestOrigin ? "'self'" : apiOrigin
1114
+ const api = apiOrigin === requestOrigin ? "'self'" : apiOrigin
1115
+ return [api, ...frameOrigins.filter((origin) => origin !== apiOrigin)].join(" ")
1091
1116
  }
1092
1117
 
1093
1118
  function resolveOrigins(
@@ -1106,9 +1131,10 @@ function resolveOrigins(
1106
1131
  function sharedHtmlResponse(
1107
1132
  request: Request,
1108
1133
  html: string,
1109
- apiBaseUrl: string | undefined
1134
+ apiBaseUrl: string | undefined,
1135
+ frameOrigins: readonly string[]
1110
1136
  ): Response {
1111
- const secured = secureSharedHtml(html, request, { apiBaseUrl })
1137
+ const secured = secureSharedHtml(html, request, { apiBaseUrl, frameOrigins })
1112
1138
  return new Response(request.method === "HEAD" ? null : secured.html, {
1113
1139
  headers: {
1114
1140
  "content-type": "text/html; charset=utf-8",
@@ -1120,7 +1146,7 @@ function sharedHtmlResponse(
1120
1146
  function secureSharedHtml(
1121
1147
  html: string,
1122
1148
  request: Request,
1123
- options: { readonly apiBaseUrl?: string }
1149
+ options: { readonly apiBaseUrl?: string; readonly frameOrigins: readonly string[] }
1124
1150
  ): { readonly html: string; readonly headers: Record<string, string> } {
1125
1151
  const nonce = randomBytes(18).toString("base64url")
1126
1152
  const { requestOrigin, apiOrigin } = resolveOrigins(request, options.apiBaseUrl)
@@ -1143,7 +1169,7 @@ function secureSharedHtml(
1143
1169
  `media-src ${fileSources.join(" ")}`,
1144
1170
  "font-src 'self' data: https:",
1145
1171
  `connect-src ${connectSources.join(" ")}`,
1146
- `frame-src ${frameSource(request, options.apiBaseUrl)}`,
1172
+ `frame-src ${frameSources(request, options.apiBaseUrl, options.frameOrigins)}`,
1147
1173
  "manifest-src 'none'",
1148
1174
  ].join("; ")
1149
1175
 
@@ -1324,7 +1350,8 @@ function spaHtmlRoute(
1324
1350
  readonly shellRoute?: string
1325
1351
  readonly transformHtml?: (html: string) => string
1326
1352
  readonly apiBaseUrl?: string
1327
- } = {}
1353
+ readonly frameOrigins: readonly string[]
1354
+ }
1328
1355
  ): BunServeRoute {
1329
1356
  return getHeadRoute(async (request) => {
1330
1357
  const publicUrl = new URL(request.url)
@@ -1359,7 +1386,7 @@ function spaHtmlRoute(
1359
1386
  responseHeaders.delete("etag")
1360
1387
  responseHeaders.set(
1361
1388
  "content-security-policy",
1362
- appContentSecurityPolicy(request, options.apiBaseUrl)
1389
+ appContentSecurityPolicy(request, options.apiBaseUrl, options.frameOrigins)
1363
1390
  )
1364
1391
  if (request.method === "HEAD") {
1365
1392
  return new Response(null, {
@@ -0,0 +1,61 @@
1
+ const APP_FRAME_ORIGINS_ENV = "SIXB_APP_FRAME_ORIGINS"
2
+
3
+ // A CSP host: labels of letters, digits and hyphens. `URL` keeps `*`, `;` and quotes in a host, and
4
+ // any of them would rewrite the policy instead of naming a site.
5
+ const CSP_HOST = /^[a-z0-9-]+(?:\.[a-z0-9-]+)*$/
6
+
7
+ /**
8
+ * The sites besides the API that the app's pages may show in an `<iframe>`, from a comma-separated
9
+ * list such as `https://www.youtube-nocookie.com,https://contoso.sharepoint.com`.
10
+ *
11
+ * They join the `frame-src` that keeps artifact frames on the API's origin, and a frame may navigate
12
+ * itself to any site the policy allows: an artifact page could send what it reads to a site listed
13
+ * here. Each entry is therefore one exact origin, never a wildcard, a scheme, or a keyword.
14
+ */
15
+ export function readAppFrameOrigins(
16
+ env: Readonly<Record<string, string | undefined>>
17
+ ): readonly string[] {
18
+ const entries = (env[APP_FRAME_ORIGINS_ENV] ?? "")
19
+ .split(",")
20
+ .map((entry) => entry.trim())
21
+ .filter((entry) => entry !== "")
22
+
23
+ return [...new Set(entries.map(frameOrigin))]
24
+ }
25
+
26
+ function frameOrigin(entry: string): string {
27
+ if (entry.includes("*")) {
28
+ throw new Error(
29
+ `[SixbCustomApp] ${APP_FRAME_ORIGINS_ENV}: '${entry}' is a wildcard. List each site, such as ` +
30
+ "https://contoso.sharepoint.com: an artifact's frame can navigate to any site this " +
31
+ "variable allows."
32
+ )
33
+ }
34
+
35
+ let url: URL
36
+ try {
37
+ url = new URL(entry)
38
+ } catch {
39
+ throw notAnOrigin(entry)
40
+ }
41
+
42
+ const exact =
43
+ (url.protocol === "https:" || url.protocol === "http:") &&
44
+ CSP_HOST.test(url.hostname) &&
45
+ !url.username &&
46
+ !url.password &&
47
+ url.pathname === "/" &&
48
+ !url.search &&
49
+ !url.hash
50
+
51
+ if (!exact) throw notAnOrigin(entry)
52
+
53
+ return url.origin
54
+ }
55
+
56
+ function notAnOrigin(entry: string): Error {
57
+ return new Error(
58
+ `[SixbCustomApp] ${APP_FRAME_ORIGINS_ENV}: '${entry}' is not an origin. Give the scheme, host ` +
59
+ "and optional port of each site, such as https://contoso.sharepoint.com."
60
+ )
61
+ }
@@ -1,4 +0,0 @@
1
- import { type AgentChatPageProps } from "./react-router";
2
- /** The framework's `/agents` routes: the project's conversations, full page. */
3
- export declare function AgentsPage(props: Omit<AgentChatPageProps, "routeBase">): import("react").FunctionComponentElement<AgentChatPageProps>;
4
- //# sourceMappingURL=agents-page.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agents-page.d.ts","sourceRoot":"","sources":["../../src/agent/agents-page.ts"],"names":[],"mappings":"AACA,OAAO,EAAiB,KAAK,kBAAkB,EAAE,MAAM,gBAAgB,CAAA;AAEvE,gFAAgF;AAChF,wBAAgB,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,kBAAkB,EAAE,WAAW,CAAC,gEAEtE"}
@@ -1,37 +0,0 @@
1
- import type { AgentThread } from "../types";
2
- /** The conversations other people shared with the reader, paged like their own. */
3
- export interface SharedThreadList {
4
- readonly threads: readonly AgentThread[];
5
- /** All of them, beyond the pages read so far. */
6
- readonly total: number;
7
- readonly error?: string | null;
8
- readonly hasMore?: boolean;
9
- readonly loadingMore?: boolean;
10
- readonly loadMoreError?: boolean;
11
- readonly onLoadMore?: () => void;
12
- }
13
- export interface AgentThreadSwitcherProps {
14
- readonly agentName: string;
15
- readonly currentThread: AgentThread | null;
16
- readonly threads: readonly AgentThread[];
17
- /**
18
- * Conversations other people shared with the reader, listed apart from their own. Omitted
19
- * where nothing can be shared, without a signed-in user.
20
- */
21
- readonly sharedThreads?: SharedThreadList;
22
- readonly runningThreadCount?: number;
23
- /**
24
- * The threads where a call waits for the reader's approval: they open the list, each row says so,
25
- * and the button counts them.
26
- */
27
- readonly waitingThreadIds?: ReadonlySet<string>;
28
- readonly threadsError?: string | null;
29
- readonly hasMoreThreads?: boolean;
30
- readonly loadingMoreThreads?: boolean;
31
- readonly loadMoreThreadsError?: boolean;
32
- readonly onLoadMoreThreads?: () => void;
33
- readonly onSelectThread: (threadId: string) => void;
34
- readonly onNewThread?: () => void;
35
- }
36
- export declare function AgentThreadSwitcher({ agentName, currentThread, threads, sharedThreads, runningThreadCount, waitingThreadIds, threadsError, hasMoreThreads, loadingMoreThreads, loadMoreThreadsError, onLoadMoreThreads, onSelectThread, onNewThread, }: AgentThreadSwitcherProps): import("react").JSX.Element;
37
- //# sourceMappingURL=agent-thread-switcher.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"agent-thread-switcher.d.ts","sourceRoot":"","sources":["../../../src/agent/components/agent-thread-switcher.tsx"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,mFAAmF;AACnF,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;IACxC,iDAAiD;IACjD,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAA;IACtB,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC9B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAA;IAC1B,QAAQ,CAAC,WAAW,CAAC,EAAE,OAAO,CAAA;IAC9B,QAAQ,CAAC,aAAa,CAAC,EAAE,OAAO,CAAA;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,IAAI,CAAA;CACjC;AAKD,MAAM,WAAW,wBAAwB;IACvC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,aAAa,EAAE,WAAW,GAAG,IAAI,CAAA;IAC1C,QAAQ,CAAC,OAAO,EAAE,SAAS,WAAW,EAAE,CAAA;IACxC;;;OAGG;IACH,QAAQ,CAAC,aAAa,CAAC,EAAE,gBAAgB,CAAA;IACzC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;IACpC;;;OAGG;IACH,QAAQ,CAAC,gBAAgB,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAA;IAC/C,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrC,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAA;IACjC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,OAAO,CAAA;IACrC,QAAQ,CAAC,oBAAoB,CAAC,EAAE,OAAO,CAAA;IACvC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,MAAM,IAAI,CAAA;IACvC,QAAQ,CAAC,cAAc,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,IAAI,CAAA;CAClC;AAED,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,aAAa,EACb,OAAO,EACP,aAAa,EACb,kBAAsB,EACtB,gBAAqC,EACrC,YAAY,EACZ,cAAc,EACd,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,cAAc,EACd,WAAW,GACZ,EAAE,wBAAwB,+BA0S1B"}