@burdenoff/fe-libs 2026.1112.3 → 2026.1112.5

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 (45) hide show
  1. package/dist/shared/assistant/api.d.ts +7 -0
  2. package/dist/shared/assistant/api.js +47 -45
  3. package/dist/shared/assistant/createSandboxAssistantTransport.js +2 -1
  4. package/dist/shared/assistant/gatewayClient.js +1 -0
  5. package/dist/shared/assistant/index.d.ts +4 -0
  6. package/dist/shared/assistant/keepAlive.d.ts +74 -0
  7. package/dist/shared/assistant/keepAlive.js +77 -0
  8. package/dist/shared/assistant/prewarm.d.ts +20 -0
  9. package/dist/shared/assistant/prewarm.js +25 -4
  10. package/dist/shared/assistant/runtime.d.ts +7 -2
  11. package/dist/shared/assistant/runtime.js +23 -22
  12. package/dist/shared/assistant/signInWarm.d.ts +60 -0
  13. package/dist/shared/assistant/signInWarm.js +111 -0
  14. package/dist/shared/assistant/snapshotPoller.d.ts +16 -0
  15. package/dist/shared/assistant/snapshotPoller.js +29 -22
  16. package/dist/shared/assistant/staleSession.d.ts +27 -0
  17. package/dist/shared/assistant/staleSession.js +15 -0
  18. package/dist/shared/assistant/turnProgress.d.ts +16 -0
  19. package/dist/shared/assistant/turnProgress.js +30 -4
  20. package/dist/shared/assistant/ui/AssistantChatArea.js +1286 -1271
  21. package/dist/shared/assistant/ui/AssistantOverlay.d.ts +7 -0
  22. package/dist/shared/assistant/ui/AssistantOverlay.js +256 -248
  23. package/dist/shared/assistant/usageReporting.d.ts +18 -0
  24. package/dist/shared/assistant/usageReporting.js +17 -5
  25. package/dist/shared/assistant/useAssistantHeartbeat.d.ts +24 -4
  26. package/dist/shared/assistant/useAssistantHeartbeat.js +43 -24
  27. package/dist/shared/assistant/useAssistantSignInWarm.d.ts +19 -0
  28. package/dist/shared/assistant/useAssistantSignInWarm.js +55 -0
  29. package/dist/shared/assistant/writeProposals.d.ts +9 -0
  30. package/dist/shared/components/assistantWidget/AssistantWidget.d.ts +7 -0
  31. package/dist/shared/components/assistantWidget/AssistantWidget.js +289 -285
  32. package/dist/shared/providers/shell/AuthTokenProvider.d.ts +6 -0
  33. package/dist/shared/providers/shell/AuthTokenProvider.js +4 -1
  34. package/dist/shared/providers/shell/index.d.ts +1 -1
  35. package/dist/shared-assistant.js +374 -370
  36. package/dist/shared-providers-shell.js +12 -12
  37. package/dist/storage/index.d.ts +2 -0
  38. package/dist/storage/index.js +6 -5
  39. package/dist/storage/uploadBlob.d.ts +3 -0
  40. package/dist/storage/uploadBlob.js +39 -37
  41. package/dist/storage/uploadVisibility.d.ts +3 -0
  42. package/dist/storage/uploadVisibility.js +6 -0
  43. package/dist/storage/useSaveToFiles.d.ts +3 -0
  44. package/dist/storage/useSaveToFiles.js +57 -53
  45. package/package.json +1 -1
@@ -16,15 +16,15 @@ import { FeatureGate as U } from "./shared/feature-flags/FeatureGate.js";
16
16
  import { GeographyProvider as W, useGeography as G } from "./shared/geography/GeographyProvider.js";
17
17
  import { PermissionProvider as K, SUPER_ADMIN_ACTOR_TYPE as q, SUPER_ADMIN_ROLE as J, hasMatchingPermission as Y, isSuperAdminBypass as X, matchPermission as Z, usePermission as Q, usePermissionLoading as $, usePermissions as ee, useRole as te, useSafePermissions as ne } from "./shared/providers/shell/PermissionProvider.js";
18
18
  import { EVERYTHING_SURFACE_ID as re, PersonaSurfaceProvider as ie, resolveSurfaceForRoles as ae, synthesizeSimulatedPermissionStrings as oe, usePersonaSurface as se, useSafePersonaSurface as ce } from "./shared/providers/shell/PersonaSurfaceProvider.js";
19
- import { AuthTokenProvider as le, useAuthToken as ue } from "./shared/providers/shell/AuthTokenProvider.js";
20
- import { MultiGatewayProvider as de } from "./shared/providers/shell/MultiGatewayProvider.js";
21
- import { ObservabilityProvider as fe } from "./shared/providers/shell/ObservabilityProvider.js";
22
- import { RYBBIT_TRACK_ENDPOINT as pe, buildCrashReport as me, crashReportingConsentGranted as he, createCrashReportingPipeline as ge, createRybbitCrashReporter as _e, detectCrashReportPlatform as ve, reportError as ye, setActiveCrashReportingPipeline as be } from "./shared/providers/shell/crashReporting.js";
23
- import { maskRoute as xe, scrubTelemetryText as Se } from "./shared/events/sinks/telemetryScrub.js";
24
- import { GatewayRoute as Ce, getMicrofrontendGateway as we, withGateway as Te } from "./shared/providers/shell/GatewayRouter.js";
25
- import { ProfileI18nBridge as Ee } from "./shared/providers/shell/ProfileI18nBridge.js";
26
- import { ProfileGeographyBridge as De } from "./shared/providers/shell/ProfileGeographyBridge.js";
27
- import { AppShellContextProvider as Oe, useAppShell as ke } from "./shared/providers/shell/AppShellContext.js";
28
- import { PageConversationContextProvider as Ae, usePageConversationContext as je, useRegisterPageConversationContext as Me } from "./shared/providers/shell/PageConversationContextProvider.js";
29
- import { clearWorkspaceWideSelection as Ne, isWorkspaceWideSelection as Pe, selectWorkspaceWide as Fe } from "./shared/providers/shell/WorkspaceWideSelection.js";
30
- export { O as ActiveContextProvider, Oe as AppShellContextProvider, p as AuthBridgeClient, d as AuthProvider, le as AuthTokenProvider, L as ContextManagerProvider, re as EVERYTHING_SURFACE_ID, z as FeatureFlagProvider, j as FeatureFlagsProvider, U as FeatureGate, Ce as GatewayRoute, W as GeographyProvider, N as GlobalUiProvider, n as I18nProvider, r as LOCALE_DIRECTION, de as MultiGatewayProvider, fe as ObservabilityProvider, Ae as PageConversationContextProvider, K as PermissionProvider, ie as PersonaSurfaceProvider, De as ProfileGeographyBridge, Ee as ProfileI18nBridge, v as ProfileStorage, pe as RYBBIT_TRACK_ENDPOINT, q as SUPER_ADMIN_ACTOR_TYPE, J as SUPER_ADMIN_ROLE, F as ShellUiProvider, e as ThemeProvider, me as buildCrashReport, y as clearActiveProfileId, i as clearTranslationCache, Ne as clearWorkspaceWideSelection, he as crashReportingConsentGranted, ge as createCrashReportingPipeline, _e as createRybbitCrashReporter, m as destroyAuthBridge, ve as detectCrashReportPlatform, b as getActiveContext, x as getActiveTokens, S as getActiveUser, h as getAuthBridge, we as getMicrofrontendGateway, C as getProfileLocale, Y as hasMatchingPermission, g as initAuthBridge, _ as isAuthBridgeInitialized, X as isSuperAdminBypass, a as isTranslationAttempted, Pe as isWorkspaceWideSelection, o as localeDirection, w as logoutActiveProfile, xe as maskRoute, Z as matchPermission, T as removeAllProfiles, ye as reportError, ae as resolveSurfaceForRoles, Se as scrubTelemetryText, Fe as selectWorkspaceWide, be as setActiveCrashReportingPipeline, E as setProfileLocale, D as setProfiles, oe as synthesizeSimulatedPermissionStrings, k as useActiveContext, A as useActiveContextOrNull, ke as useAppShell, f as useAuth, ue as useAuthToken, R as useContextManager, B as useFeatureFlag, V as useFeatureFlagDetails, H as useFeatureFlagValue, M as useFeatureFlags, G as useGeography, P as useGlobalUi, s as useI18n, c as useOptionalI18n, je as usePageConversationContext, Q as usePermission, $ as usePermissionLoading, ee as usePermissions, se as usePersonaSurface, Me as useRegisterPageConversationContext, te as useRole, ne as useSafePermissions, ce as useSafePersonaSurface, l as useShellLabel, u as useShellNumberFormat, I as useShellUi, t as useTheme, Te as withGateway };
19
+ import { AuthTokenProvider as le, useAuthToken as ue, useAuthTokenOrNull as de } from "./shared/providers/shell/AuthTokenProvider.js";
20
+ import { MultiGatewayProvider as fe } from "./shared/providers/shell/MultiGatewayProvider.js";
21
+ import { ObservabilityProvider as pe } from "./shared/providers/shell/ObservabilityProvider.js";
22
+ import { RYBBIT_TRACK_ENDPOINT as me, buildCrashReport as he, crashReportingConsentGranted as ge, createCrashReportingPipeline as _e, createRybbitCrashReporter as ve, detectCrashReportPlatform as ye, reportError as be, setActiveCrashReportingPipeline as xe } from "./shared/providers/shell/crashReporting.js";
23
+ import { maskRoute as Se, scrubTelemetryText as Ce } from "./shared/events/sinks/telemetryScrub.js";
24
+ import { GatewayRoute as we, getMicrofrontendGateway as Te, withGateway as Ee } from "./shared/providers/shell/GatewayRouter.js";
25
+ import { ProfileI18nBridge as De } from "./shared/providers/shell/ProfileI18nBridge.js";
26
+ import { ProfileGeographyBridge as Oe } from "./shared/providers/shell/ProfileGeographyBridge.js";
27
+ import { AppShellContextProvider as ke, useAppShell as Ae } from "./shared/providers/shell/AppShellContext.js";
28
+ import { PageConversationContextProvider as je, usePageConversationContext as Me, useRegisterPageConversationContext as Ne } from "./shared/providers/shell/PageConversationContextProvider.js";
29
+ import { clearWorkspaceWideSelection as Pe, isWorkspaceWideSelection as Fe, selectWorkspaceWide as Ie } from "./shared/providers/shell/WorkspaceWideSelection.js";
30
+ export { O as ActiveContextProvider, ke as AppShellContextProvider, p as AuthBridgeClient, d as AuthProvider, le as AuthTokenProvider, L as ContextManagerProvider, re as EVERYTHING_SURFACE_ID, z as FeatureFlagProvider, j as FeatureFlagsProvider, U as FeatureGate, we as GatewayRoute, W as GeographyProvider, N as GlobalUiProvider, n as I18nProvider, r as LOCALE_DIRECTION, fe as MultiGatewayProvider, pe as ObservabilityProvider, je as PageConversationContextProvider, K as PermissionProvider, ie as PersonaSurfaceProvider, Oe as ProfileGeographyBridge, De as ProfileI18nBridge, v as ProfileStorage, me as RYBBIT_TRACK_ENDPOINT, q as SUPER_ADMIN_ACTOR_TYPE, J as SUPER_ADMIN_ROLE, F as ShellUiProvider, e as ThemeProvider, he as buildCrashReport, y as clearActiveProfileId, i as clearTranslationCache, Pe as clearWorkspaceWideSelection, ge as crashReportingConsentGranted, _e as createCrashReportingPipeline, ve as createRybbitCrashReporter, m as destroyAuthBridge, ye as detectCrashReportPlatform, b as getActiveContext, x as getActiveTokens, S as getActiveUser, h as getAuthBridge, Te as getMicrofrontendGateway, C as getProfileLocale, Y as hasMatchingPermission, g as initAuthBridge, _ as isAuthBridgeInitialized, X as isSuperAdminBypass, a as isTranslationAttempted, Fe as isWorkspaceWideSelection, o as localeDirection, w as logoutActiveProfile, Se as maskRoute, Z as matchPermission, T as removeAllProfiles, be as reportError, ae as resolveSurfaceForRoles, Ce as scrubTelemetryText, Ie as selectWorkspaceWide, xe as setActiveCrashReportingPipeline, E as setProfileLocale, D as setProfiles, oe as synthesizeSimulatedPermissionStrings, k as useActiveContext, A as useActiveContextOrNull, Ae as useAppShell, f as useAuth, ue as useAuthToken, de as useAuthTokenOrNull, R as useContextManager, B as useFeatureFlag, V as useFeatureFlagDetails, H as useFeatureFlagValue, M as useFeatureFlags, G as useGeography, P as useGlobalUi, s as useI18n, c as useOptionalI18n, Me as usePageConversationContext, Q as usePermission, $ as usePermissionLoading, ee as usePermissions, se as usePersonaSurface, Ne as useRegisterPageConversationContext, te as useRole, ne as useSafePermissions, ce as useSafePersonaSurface, l as useShellLabel, u as useShellNumberFormat, I as useShellUi, t as useTheme, Ee as withGateway };
@@ -6,6 +6,8 @@ export { SaveToFilesDialog } from './SaveToFilesDialog';
6
6
  export { useSaveToFiles } from './useSaveToFiles';
7
7
  export type { SavedFile, UseSaveToFilesResult } from './useSaveToFiles';
8
8
  export { uploadBlobToFiles, FILES_AFTER_SAVE_REFETCH } from './uploadBlob';
9
+ export { fileUploadVisibility } from './uploadVisibility';
10
+ export type { FileUploadVisibility } from './uploadVisibility';
9
11
  export type { UploadBlobParams, UploadedFile, SaveToFilesStep, SaveToFilesRetryNotice, } from './uploadBlob';
10
12
  export { classifyFilesError, decideFilesRetry, runWithFilesRetry, COLD_START_MAX_ATTEMPTS, COLD_START_RETRY_DELAYS_MS, COLD_START_RETRY_BUDGET_MS, } from './retryPolicy';
11
13
  export type { FilesRetryKind, FilesRetryDecision, FilesRetryNotice, FilesRetryContext, } from './retryPolicy';
@@ -3,8 +3,9 @@ import { SaveToFilesButton as t } from "./SaveToFilesButton.js";
3
3
  import { SaveToFilesDialog as n } from "./SaveToFilesDialog.js";
4
4
  import { useSaveToFiles as r } from "./useSaveToFiles.js";
5
5
  import { FILES_AFTER_SAVE_REFETCH as i, uploadBlobToFiles as a } from "./uploadBlob.js";
6
- import { COLD_START_MAX_ATTEMPTS as o, COLD_START_RETRY_BUDGET_MS as s, COLD_START_RETRY_DELAYS_MS as c, classifyFilesError as l, decideFilesRetry as u, runWithFilesRetry as d } from "./retryPolicy.js";
7
- import { FILES_WARMUP_COOLDOWN_MS as f, useFilesServiceWarmup as p, warmFilesService as m } from "./warmFilesService.js";
8
- import { FILES_STORAGE_QUOTA_NAME as h, FilesPortAbortError as g, FilesPortError as _, createApolloFilesPort as v } from "./filesPort.js";
9
- import { createPinnedFilesPort as y } from "./pinnedFilesPort.js";
10
- export { o as COLD_START_MAX_ATTEMPTS, s as COLD_START_RETRY_BUDGET_MS, c as COLD_START_RETRY_DELAYS_MS, i as FILES_AFTER_SAVE_REFETCH, h as FILES_STORAGE_QUOTA_NAME, f as FILES_WARMUP_COOLDOWN_MS, g as FilesPortAbortError, _ as FilesPortError, t as SaveToFilesButton, n as SaveToFilesDialog, e as StorageFolderPicker, l as classifyFilesError, v as createApolloFilesPort, y as createPinnedFilesPort, u as decideFilesRetry, d as runWithFilesRetry, a as uploadBlobToFiles, p as useFilesServiceWarmup, r as useSaveToFiles, m as warmFilesService };
6
+ import { fileUploadVisibility as o } from "./uploadVisibility.js";
7
+ import { COLD_START_MAX_ATTEMPTS as s, COLD_START_RETRY_BUDGET_MS as c, COLD_START_RETRY_DELAYS_MS as l, classifyFilesError as u, decideFilesRetry as d, runWithFilesRetry as f } from "./retryPolicy.js";
8
+ import { FILES_WARMUP_COOLDOWN_MS as p, useFilesServiceWarmup as m, warmFilesService as h } from "./warmFilesService.js";
9
+ import { FILES_STORAGE_QUOTA_NAME as g, FilesPortAbortError as _, FilesPortError as v, createApolloFilesPort as y } from "./filesPort.js";
10
+ import { createPinnedFilesPort as b } from "./pinnedFilesPort.js";
11
+ export { s as COLD_START_MAX_ATTEMPTS, c as COLD_START_RETRY_BUDGET_MS, l as COLD_START_RETRY_DELAYS_MS, i as FILES_AFTER_SAVE_REFETCH, g as FILES_STORAGE_QUOTA_NAME, p as FILES_WARMUP_COOLDOWN_MS, _ as FilesPortAbortError, v as FilesPortError, t as SaveToFilesButton, n as SaveToFilesDialog, e as StorageFolderPicker, u as classifyFilesError, y as createApolloFilesPort, b as createPinnedFilesPort, d as decideFilesRetry, o as fileUploadVisibility, f as runWithFilesRetry, a as uploadBlobToFiles, m as useFilesServiceWarmup, r as useSaveToFiles, h as warmFilesService };
@@ -1,5 +1,6 @@
1
1
  import { ApolloClient } from '@apollo/client';
2
2
  import { extractErrorMessage, FilesRetryNotice } from './retryPolicy';
3
+ import { FileUploadVisibility } from './uploadVisibility';
3
4
  export { extractErrorMessage };
4
5
  /**
5
6
  * Apollo invalidations every "Save to Files" caller benefits from — pulled
@@ -18,6 +19,8 @@ export interface UploadBlobParams {
18
19
  filename: string;
19
20
  mimeType: string;
20
21
  folderId: string;
22
+ /** Omitted means PRIVATE. WORKSPACE is an intentional audience, never PUBLIC. */
23
+ visibility?: FileUploadVisibility;
21
24
  onProgress?: (pct: number) => void;
22
25
  /**
23
26
  * Fired before each retry wait. The upload is still running — this exists so the UI
@@ -1,7 +1,8 @@
1
1
  import { extractErrorMessage as e, runWithFilesRetry as t } from "./retryPolicy.js";
2
- import { gql as n } from "@apollo/client";
2
+ import { fileUploadVisibility as n } from "./uploadVisibility.js";
3
+ import { gql as r } from "@apollo/client";
3
4
  // src/storage/uploadBlob.ts
4
- var r = n`
5
+ var i = r`
5
6
  mutation SaveToFiles_InitiateUpload($input: InitiateUploadInput!) {
6
7
  initiateUpload(input: $input) {
7
8
  session {
@@ -10,7 +11,7 @@ var r = n`
10
11
  uploadUrl
11
12
  }
12
13
  }
13
- `, i = n`
14
+ `, a = r`
14
15
  mutation SaveToFiles_CompleteUpload($input: CompleteUploadInput!) {
15
16
  completeUpload(input: $input) {
16
17
  file {
@@ -20,27 +21,28 @@ var r = n`
20
21
  }
21
22
  }
22
23
  }
23
- `, a = [
24
+ `, o = [
24
25
  "GetFilesRootBrowsePage",
25
26
  "GetFilesFolderBrowsePage",
26
27
  "GetFilesRecentPage",
27
28
  "GetFiles"
28
29
  ];
29
- async function o(n) {
30
- let { client: o, blob: s, filename: c, mimeType: l, folderId: u, onProgress: d, onRetry: f } = n, p = c.includes(".") ? c.substring(c.lastIndexOf(".") + 1) : "", m = {
31
- ...n.now ? { now: n.now } : {},
32
- ...n.sleep ? { sleep: n.sleep } : {}
30
+ async function s(r) {
31
+ let { client: s, blob: c, filename: l, mimeType: u, folderId: d, onProgress: f, onRetry: p } = r, m = n(r.visibility), h = l.includes(".") ? l.substring(l.lastIndexOf(".") + 1) : "", g = {
32
+ ...r.now ? { now: r.now } : {},
33
+ ...r.sleep ? { sleep: r.sleep } : {}
33
34
  };
34
- d?.(0);
35
- let h = await t(async () => {
36
- let e = await o.mutate({
37
- mutation: r,
35
+ f?.(0);
36
+ let _ = await t(async () => {
37
+ let e = await s.mutate({
38
+ mutation: i,
38
39
  variables: { input: {
39
- fileName: c,
40
- fileSize: String(s.size),
41
- mimeType: l,
42
- extension: p,
43
- folderId: u
40
+ fileName: l,
41
+ fileSize: String(c.size),
42
+ mimeType: u,
43
+ extension: h,
44
+ folderId: d,
45
+ visibility: m
44
46
  } }
45
47
  }), t = e.data?.initiateUpload?.session, n = e.data?.initiateUpload?.uploadUrl;
46
48
  return t && n ? {
@@ -54,34 +56,34 @@ async function o(n) {
54
56
  error: e.error
55
57
  };
56
58
  }, {
57
- ...m,
58
- ...f ? { onRetry: (e) => f({
59
+ ...g,
60
+ ...p ? { onRetry: (e) => p({
59
61
  ...e,
60
62
  step: "initiate"
61
63
  }) } : {}
62
64
  });
63
- if (!h.value) throw Error(e(h.error) ?? "initiateUpload did not return a presigned URL");
64
- let { session: g, uploadUrl: _ } = h.value;
65
- d?.(10), await new Promise((e, t) => {
65
+ if (!_.value) throw Error(e(_.error) ?? "initiateUpload did not return a presigned URL");
66
+ let { session: v, uploadUrl: y } = _.value;
67
+ f?.(10), await new Promise((e, t) => {
66
68
  let n = new XMLHttpRequest();
67
69
  n.upload.addEventListener("progress", (e) => {
68
70
  if (e.lengthComputable) {
69
71
  let t = 10 + Math.round(e.loaded / e.total * 80);
70
- d?.(t);
72
+ f?.(t);
71
73
  }
72
74
  }), n.addEventListener("load", () => {
73
- n.status >= 200 && n.status < 300 ? (d?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
74
- }), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", _), n.setRequestHeader("Content-Type", l), n.send(s);
75
+ n.status >= 200 && n.status < 300 ? (f?.(90), e()) : t(/* @__PURE__ */ Error(`Upload PUT failed with status ${n.status}`));
76
+ }), n.addEventListener("error", () => t(/* @__PURE__ */ Error("Upload PUT network error"))), n.addEventListener("abort", () => t(/* @__PURE__ */ Error("Upload PUT aborted"))), n.open("PUT", y), n.setRequestHeader("Content-Type", u), n.send(c);
75
77
  });
76
- let v = await t(async () => {
77
- let e = await o.mutate({
78
- mutation: i,
78
+ let b = await t(async () => {
79
+ let e = await s.mutate({
80
+ mutation: a,
79
81
  variables: { input: {
80
- sessionId: g.id,
81
- fileSize: String(s.size),
82
- folderId: u
82
+ sessionId: v.id,
83
+ fileSize: String(c.size),
84
+ folderId: d
83
85
  } },
84
- refetchQueries: a
86
+ refetchQueries: o
85
87
  }), t = e.data?.completeUpload?.file;
86
88
  return t ? {
87
89
  ok: !0,
@@ -92,13 +94,13 @@ async function o(n) {
92
94
  };
93
95
  }, {
94
96
  allow: ["cold-start", "transient-blip"],
95
- ...m,
96
- ...f ? { onRetry: (e) => f({
97
+ ...g,
98
+ ...p ? { onRetry: (e) => p({
97
99
  ...e,
98
100
  step: "complete"
99
101
  }) } : {}
100
102
  });
101
- if (!v.value) throw Error(e(v.error) ?? "completeUpload did not return a file");
102
- return d?.(100), v.value;
103
+ if (!b.value) throw Error(e(b.error) ?? "completeUpload did not return a file");
104
+ return f?.(100), b.value;
103
105
  }
104
- export { a as FILES_AFTER_SAVE_REFETCH, e as extractErrorMessage, o as uploadBlobToFiles };
106
+ export { o as FILES_AFTER_SAVE_REFETCH, e as extractErrorMessage, s as uploadBlobToFiles };
@@ -0,0 +1,3 @@
1
+ /** A deliberate workspace audience is distinct from publishing a public asset. */
2
+ export type FileUploadVisibility = 'PRIVATE' | 'WORKSPACE';
3
+ export declare function fileUploadVisibility(value?: unknown): FileUploadVisibility;
@@ -0,0 +1,6 @@
1
+ // src/storage/uploadVisibility.ts
2
+ function e(e = "PRIVATE") {
3
+ if (e !== "PRIVATE" && e !== "WORKSPACE") throw Error("Upload visibility must be PRIVATE or WORKSPACE");
4
+ return e;
5
+ }
6
+ export { e as fileUploadVisibility };
@@ -1,5 +1,6 @@
1
1
  import { ApolloClient } from '@apollo/client';
2
2
  import { SaveToFilesSource } from './SaveToFilesButton';
3
+ import { FileUploadVisibility } from './uploadVisibility';
3
4
  import { SaveToFilesRetryNotice } from './uploadBlob';
4
5
  export interface SavedFile {
5
6
  id: string;
@@ -10,6 +11,8 @@ export interface UseSaveToFilesResult {
10
11
  save: (params: {
11
12
  source: SaveToFilesSource;
12
13
  folderPath: string;
14
+ /** Applies to blob uploads; sandbox copies currently support PRIVATE only. */
15
+ visibility?: FileUploadVisibility;
13
16
  /**
14
17
  * Fired before each retry wait. Purely informational — the save is still in
15
18
  * flight. Exists so a caller rendering its own chip can say why a cold start is
@@ -1,10 +1,11 @@
1
- import { extractErrorMessage as e, runWithFilesRetry as t } from "./retryPolicy.js";
2
- import { FILES_AFTER_SAVE_REFETCH as n, uploadBlobToFiles as r } from "./uploadBlob.js";
3
- import { useState as i } from "react";
4
- import { gql as a } from "@apollo/client";
5
- import { useApolloClient as o } from "@apollo/client/react";
1
+ import { fileUploadVisibility as e } from "./uploadVisibility.js";
2
+ import { extractErrorMessage as t, runWithFilesRetry as n } from "./retryPolicy.js";
3
+ import { FILES_AFTER_SAVE_REFETCH as r, uploadBlobToFiles as i } from "./uploadBlob.js";
4
+ import { useState as a } from "react";
5
+ import { gql as o } from "@apollo/client";
6
+ import { useApolloClient as s } from "@apollo/client/react";
6
7
  // src/storage/useSaveToFiles.ts
7
- var s = a`
8
+ var c = o`
8
9
  mutation SaveToFiles_EnsureFolderByPath($path: String!) {
9
10
  ensureFolderByPath(path: $path) {
10
11
  id
@@ -12,7 +13,7 @@ var s = a`
12
13
  path
13
14
  }
14
15
  }
15
- `, c = a`
16
+ `, l = o`
16
17
  mutation SaveToFiles_SaveSandboxArtifact($input: SaveSandboxArtifactInput!) {
17
18
  saveSandboxArtifactToFiles(input: $input) {
18
19
  id
@@ -21,18 +22,18 @@ var s = a`
21
22
  }
22
23
  }
23
24
  `;
24
- async function l(n, r, i = {}) {
25
- let a = await t(async () => {
26
- let e = await n.mutate({
27
- mutation: s,
25
+ async function u(e, r, i = {}) {
26
+ let a = await n(async () => {
27
+ let t = await e.mutate({
28
+ mutation: c,
28
29
  variables: { path: r }
29
- }), t = e.data?.ensureFolderByPath?.id;
30
- return t ? {
30
+ }), n = t.data?.ensureFolderByPath?.id;
31
+ return n ? {
31
32
  ok: !0,
32
- value: t
33
+ value: n
33
34
  } : {
34
35
  ok: !1,
35
- error: e.error
36
+ error: t.error
36
37
  };
37
38
  }, {
38
39
  ...i.onRetry ? { onRetry: (e) => i.onRetry?.({
@@ -43,56 +44,59 @@ async function l(n, r, i = {}) {
43
44
  ...i.sleep ? { sleep: i.sleep } : {}
44
45
  });
45
46
  if (a.value !== void 0) return a.value;
46
- throw Error(e(a.error) ?? `Could not resolve folder for path: ${r}`);
47
+ throw Error(t(a.error) ?? `Could not resolve folder for path: ${r}`);
47
48
  }
48
- function u() {
49
- let t = o(), [a, s] = i(!1), [u, d] = i(null), [f, p] = i(0), [m, h] = i(null);
49
+ function d() {
50
+ let n = s(), [o, c] = a(!1), [d, f] = a(null), [p, m] = a(0), [h, g] = a(null);
50
51
  return {
51
- save: async (i) => {
52
- s(!0), d(null), p(0), h(null);
53
- let a = (e) => {
54
- h(e), i.onRetry?.(e);
52
+ save: async (a) => {
53
+ c(!0), f(null), m(0), g(null);
54
+ let o = (e) => {
55
+ g(e), a.onRetry?.(e);
55
56
  };
56
57
  try {
57
- let o = await l(t, i.folderPath, { onRetry: a });
58
- if (h(null), i.source.kind === "sandbox-artifact") {
59
- let r = await t.mutate({
60
- mutation: c,
58
+ let s = e(a.visibility);
59
+ if (a.source.kind !== "blob" && s !== "PRIVATE") throw Error("Sandbox artifact saves do not support WORKSPACE visibility");
60
+ let c = await u(n, a.folderPath, { onRetry: o });
61
+ if (g(null), a.source.kind === "sandbox-artifact") {
62
+ let e = await n.mutate({
63
+ mutation: l,
61
64
  variables: { input: {
62
- sandboxId: i.source.sandboxId,
63
- sessionId: i.source.sessionId,
64
- path: i.source.path,
65
- folderId: o,
66
- filename: i.source.filename ?? null
65
+ sandboxId: a.source.sandboxId,
66
+ sessionId: a.source.sessionId,
67
+ path: a.source.path,
68
+ folderId: c,
69
+ filename: a.source.filename ?? null
67
70
  } },
68
- refetchQueries: n
69
- }), a = r.data?.saveSandboxArtifactToFiles;
70
- if (!a) throw Error(e(r.error) ?? "saveSandboxArtifactToFiles returned no file");
71
- return p(100), a;
71
+ refetchQueries: r
72
+ }), i = e.data?.saveSandboxArtifactToFiles;
73
+ if (!i) throw Error(t(e.error) ?? "saveSandboxArtifactToFiles returned no file");
74
+ return m(100), i;
72
75
  }
73
- let s = await i.source.getBlob();
74
- if (!s) throw Error("Cancelled: no bytes to save");
75
- let u = s.blob, d = s.filename ?? i.source.filename, f = s.mimeType ?? i.source.mimeType;
76
- return await r({
77
- client: t,
78
- blob: u,
79
- filename: d,
80
- mimeType: f,
81
- folderId: o,
82
- onProgress: p,
83
- onRetry: a
76
+ let d = await a.source.getBlob();
77
+ if (!d) throw Error("Cancelled: no bytes to save");
78
+ let f = d.blob, p = d.filename ?? a.source.filename, h = d.mimeType ?? a.source.mimeType;
79
+ return await i({
80
+ client: n,
81
+ blob: f,
82
+ filename: p,
83
+ mimeType: h,
84
+ folderId: c,
85
+ onProgress: m,
86
+ visibility: s,
87
+ onRetry: o
84
88
  });
85
89
  } catch (e) {
86
90
  let t = e instanceof Error ? e : Error(String(e));
87
- throw d(t), t;
91
+ throw f(t), t;
88
92
  } finally {
89
- s(!1), h(null);
93
+ c(!1), g(null);
90
94
  }
91
95
  },
92
- isPending: a,
93
- error: u,
94
- progress: f,
95
- retry: m
96
+ isPending: o,
97
+ error: d,
98
+ progress: p,
99
+ retry: h
96
100
  };
97
101
  }
98
- export { l as resolveFolderIdByPath, u as useSaveToFiles };
102
+ export { u as resolveFolderIdByPath, d as useSaveToFiles };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@burdenoff/fe-libs",
3
- "version": "2026.1112.3",
3
+ "version": "2026.1112.5",
4
4
  "description": "Burdenoff frontend primitives and domain libraries",
5
5
  "repository": {
6
6
  "type": "git",