@epam/ai-dial-chat-hooks 1.1.0-dev.293 → 1.1.0-dev.296

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 (39) hide show
  1. package/catalog/entity-details.d.ts +2 -2
  2. package/catalog/entity-details.d.ts.map +1 -1
  3. package/catalog/map-deployment-limits-to-catalog.d.ts +13 -18
  4. package/catalog/map-deployment-limits-to-catalog.d.ts.map +1 -1
  5. package/catalog/map-deployment-to-catalog-item.d.ts.map +1 -1
  6. package/catalog/map-entity-details-to-catalog.d.ts.map +1 -1
  7. package/conversation/conversation-transfer/types.d.ts +0 -1
  8. package/conversation/conversation-transfer/types.d.ts.map +1 -1
  9. package/conversation/useConversationExport/useConversationExport.d.ts +2 -1
  10. package/conversation/useConversationExport/useConversationExport.d.ts.map +1 -1
  11. package/conversation/useConversationImport/useConversationImport.d.ts +2 -1
  12. package/conversation/useConversationImport/useConversationImport.d.ts.map +1 -1
  13. package/files/annotation.d.ts +1 -1
  14. package/files/annotation.d.ts.map +1 -1
  15. package/index.d.ts +8 -0
  16. package/index.d.ts.map +1 -1
  17. package/index.js +2423 -2159
  18. package/oauth/authorize-url.d.ts +16 -0
  19. package/oauth/authorize-url.d.ts.map +1 -0
  20. package/oauth/handshake.d.ts +30 -0
  21. package/oauth/handshake.d.ts.map +1 -0
  22. package/oauth/models.d.ts +74 -0
  23. package/oauth/models.d.ts.map +1 -0
  24. package/oauth/popup.d.ts +30 -0
  25. package/oauth/popup.d.ts.map +1 -0
  26. package/oauth/toolset-id.d.ts +23 -0
  27. package/oauth/toolset-id.d.ts.map +1 -0
  28. package/oauth/types.d.ts +84 -0
  29. package/oauth/types.d.ts.map +1 -0
  30. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts +54 -0
  31. package/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.d.ts.map +1 -0
  32. package/oauth/useToolsetLogin/useToolsetLogin.d.ts +72 -0
  33. package/oauth/useToolsetLogin/useToolsetLogin.d.ts.map +1 -0
  34. package/package.json +14 -14
  35. package/shared/string-utils.d.ts +0 -1
  36. package/shared/string-utils.d.ts.map +1 -1
  37. package/skill/useSkillFileActions.d.ts.map +1 -1
  38. package/useToolsMenu/useToolsMenu.d.ts +7 -16
  39. package/useToolsMenu/useToolsMenu.d.ts.map +1 -1
@@ -0,0 +1,16 @@
1
+ import { ToolsetOAuthSettings } from './models';
2
+ /**
3
+ * Resolves the OAuth callback location against the current origin. The
4
+ * callback path is supplied by the host: this module owns no application
5
+ * route.
6
+ */
7
+ export declare const getToolsetRedirectUri: (callbackPath: string) => string;
8
+ /**
9
+ * Builds the OAuth authorize URL for a given, already-generated `state`
10
+ * value. The caller owns what `state` carries — see `initiateOAuthLogin`.
11
+ * Returns `null` rather than throwing for a configuration that cannot
12
+ * produce a valid URL, including one whose authorization endpoint is not
13
+ * reachable over a secure transport.
14
+ */
15
+ export declare const buildToolsetAuthorizeUrl: (auth: ToolsetOAuthSettings, redirectUri: string, state: string) => string | null;
16
+ //# sourceMappingURL=authorize-url.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"authorize-url.d.ts","sourceRoot":"","sources":["../../src/oauth/authorize-url.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAErD;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,GAAI,cAAc,MAAM,KAAG,MACjB,CAAC;AAwB7C;;;;;;GAMG;AACH,eAAO,MAAM,wBAAwB,GACnC,MAAM,oBAAoB,EAC1B,aAAa,MAAM,EACnB,OAAO,MAAM,KACZ,MAAM,GAAG,IA0BX,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { ToolsetOAuthResult } from './models';
2
+ import { ToolsetCredentialsLevel } from './types';
3
+ /** Name of the same-origin `BroadcastChannel` shared by an OAuth flow's opener and its callback popup. */
4
+ export declare const getToolsetOAuthChannelName: (flowId: string) => string;
5
+ /** Options for {@link waitForToolsetOAuthResult}. */
6
+ export interface WaitForToolsetOAuthResultOptions {
7
+ /** Resource id echoed back in a success result. */
8
+ toolsetId: string;
9
+ /** Credentials level echoed back in a success result. */
10
+ credentialsLevel: ToolsetCredentialsLevel;
11
+ /**
12
+ * The host's callback route — the same path the flow's popup was opened
13
+ * against. The popup-URL reader treats a same-origin URL as a result only
14
+ * when its pathname equals this value, so a host serving more than one
15
+ * callback route passes whichever one it actually opened.
16
+ */
17
+ callbackPath: string;
18
+ timeoutMs?: number;
19
+ pollIntervalMs?: number;
20
+ }
21
+ /**
22
+ * Waits for the OAuth callback popup to report a result over BroadcastChannel
23
+ * or through the completion marker in its same-origin URL. A cross-origin
24
+ * provider can make the retained WindowProxy look closed even while the popup
25
+ * remains open, so cancellation is confirmed only when the initiating window
26
+ * regains focus. Reported results are acknowledged so the callback can close
27
+ * itself even when the retained WindowProxy was severed.
28
+ */
29
+ export declare const waitForToolsetOAuthResult: (popup: Window, flowId: string, { toolsetId, credentialsLevel, callbackPath, timeoutMs, pollIntervalMs, }: WaitForToolsetOAuthResultOptions) => Promise<ToolsetOAuthResult>;
30
+ //# sourceMappingURL=handshake.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handshake.d.ts","sourceRoot":"","sources":["../../src/oauth/handshake.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAA8B,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAC/E,OAAO,EACL,uBAAuB,EAKxB,MAAM,SAAS,CAAC;AAIjB,0GAA0G;AAC1G,eAAO,MAAM,0BAA0B,GAAI,QAAQ,MAAM,KAAG,MAChB,CAAC;AA4B7C,qDAAqD;AACrD,MAAM,WAAW,gCAAgC;IAC/C,mDAAmD;IACnD,SAAS,EAAE,MAAM,CAAC;IAClB,yDAAyD;IACzD,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C;;;;;OAKG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,GACpC,OAAO,MAAM,EACb,QAAQ,MAAM,EACd,2EAMG,gCAAgC,KAClC,OAAO,CAAC,kBAAkB,CAkHzB,CAAC"}
@@ -0,0 +1,74 @@
1
+ import { OAuthResourceKind, ToolsetCredentialsLevel, ToolsetOAuthChannelControlType, ToolsetOAuthFailureReason, ToolsetOAuthInitiationResultType, ToolsetOAuthResultType } from './types';
2
+ /**
3
+ * OAuth client settings needed to build an authorize URL — the narrow subset
4
+ * of a toolset's `authSettings` this module reads. Declared as its own shape
5
+ * so hosts can keep their wider editor form models app-owned and still pass
6
+ * them straight in.
7
+ */
8
+ export interface ToolsetOAuthSettings {
9
+ clientId?: string;
10
+ authorizationEndpoint?: string;
11
+ scopes?: string[];
12
+ codeChallenge?: string;
13
+ codeChallengeMethod?: string;
14
+ }
15
+ /**
16
+ * Redirect state for an OAuth login flow. The flow writes this into the
17
+ * *popup's own* `sessionStorage` before navigating it to the provider, since
18
+ * the popup and its opener do not share a `sessionStorage` partition once
19
+ * navigated cross-origin.
20
+ */
21
+ export interface ToolsetRedirectState {
22
+ toolsetId: string;
23
+ credentialsLevel?: ToolsetCredentialsLevel;
24
+ redirectUri?: string;
25
+ /** CSRF state token generated by the client before the OAuth redirect. */
26
+ state?: string;
27
+ /**
28
+ * Which sign-in endpoint the host's callback route should submit the
29
+ * authorization code to. Defaults to `Toolset` when absent so every
30
+ * existing redirect state (written before this field existed) keeps
31
+ * calling the toolset login unchanged. `ExternalService` reuses the same
32
+ * popup/BroadcastChannel machinery with `toolsetId` repurposed as an
33
+ * `{appId}::{serviceId}` composite key. `OfflineCredentials` reuses the
34
+ * same machinery again, with `toolsetId` repurposed as a fixed sentinel
35
+ * correlation id (`'offline-credentials'`) — the field carries no real
36
+ * toolset/external-service meaning there, only the opaque
37
+ * flow-correlation string the shared popup/`BroadcastChannel` utilities
38
+ * require structurally.
39
+ */
40
+ resourceKind?: OAuthResourceKind;
41
+ }
42
+ export type ToolsetOAuthInitiationResult = {
43
+ type: ToolsetOAuthInitiationResultType.Started;
44
+ popup: Window;
45
+ flowId: string;
46
+ } | {
47
+ type: ToolsetOAuthInitiationResultType.Blocked;
48
+ } | {
49
+ type: ToolsetOAuthInitiationResultType.InvalidConfig;
50
+ };
51
+ export interface ToolsetOAuthSuccessMessage {
52
+ type: ToolsetOAuthResultType.Success;
53
+ toolsetId: string;
54
+ credentialsLevel: ToolsetCredentialsLevel;
55
+ }
56
+ export interface ToolsetOAuthFailureMessage {
57
+ type: ToolsetOAuthResultType.Failure;
58
+ reason: ToolsetOAuthFailureReason;
59
+ }
60
+ /** Confirms that the initiating tab consumed the callback result. */
61
+ export interface ToolsetOAuthResultAcknowledgement {
62
+ type: ToolsetOAuthChannelControlType.ResultAcknowledged;
63
+ }
64
+ /**
65
+ * Non-secret result reported by the OAuth callback popup for one flow. Used
66
+ * unchanged by every resource kind — the callback branch only needs to signal
67
+ * success/failure, not resource details, back through the channel.
68
+ */
69
+ export type ToolsetOAuthChannelMessage = ToolsetOAuthSuccessMessage | ToolsetOAuthFailureMessage;
70
+ /** Result resolved by `waitForToolsetOAuthResult` to the tab that initiated the login. */
71
+ export type ToolsetOAuthResult = ToolsetOAuthSuccessMessage | ToolsetOAuthFailureMessage | {
72
+ type: ToolsetOAuthResultType.Cancelled;
73
+ };
74
+ //# sourceMappingURL=models.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"models.d.ts","sourceRoot":"","sources":["../../src/oauth/models.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,uBAAuB,EACvB,8BAA8B,EAC9B,yBAAyB,EACzB,gCAAgC,EAChC,sBAAsB,EACvB,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qBAAqB,CAAC,EAAE,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,0 +1,30 @@
1
+ import { ToolsetOAuthInitiationResult, ToolsetOAuthSettings } from './models';
2
+ import { OAuthResourceKind, ToolsetCredentialsLevel } from './types';
3
+ /**
4
+ * Opens a same-origin, blank popup synchronously — call this as the very
5
+ * first thing in a click (or click-derived) handler so the browser still
6
+ * treats it as user-triggered, before doing any `await`. A caller that needs
7
+ * to fetch the OAuth config first (it isn't known synchronously) opens the
8
+ * popup with this, then calls `navigateToolsetOAuthPopup` once the config has
9
+ * been fetched.
10
+ */
11
+ export declare const openToolsetOAuthPopup: () => Window | null;
12
+ /**
13
+ * Builds the OAuth authorize URL for an already-open popup and navigates it,
14
+ * closing the popup and returning `InvalidConfig` if the auth config can't
15
+ * produce a valid authorize URL. `callbackPath` is the host's own callback
16
+ * route — this module owns no application route.
17
+ */
18
+ export declare const navigateToolsetOAuthPopup: (popup: Window, auth: ToolsetOAuthSettings, toolsetId: string, callbackPath: string, credentialsLevel?: ToolsetCredentialsLevel, resourceKind?: OAuthResourceKind) => ToolsetOAuthInitiationResult;
19
+ /**
20
+ * Builds the OAuth authorize URL, opens a same-origin popup synchronously (so
21
+ * a blocked popup can be reliably detected), writes the redirect state into
22
+ * *that popup's own* `sessionStorage` while it is still same-origin
23
+ * `about:blank`, then navigates it to the provider's authorization page.
24
+ * `auth` must already be known synchronously here, so the config is validated
25
+ * *before* opening the popup — unlike `navigateToolsetOAuthPopup`, used when
26
+ * the auth config can only be fetched asynchronously after the popup is
27
+ * already open.
28
+ */
29
+ export declare const initiateOAuthLogin: (auth: ToolsetOAuthSettings, toolsetId: string, callbackPath: string, credentialsLevel?: ToolsetCredentialsLevel) => ToolsetOAuthInitiationResult;
30
+ //# sourceMappingURL=popup.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"popup.d.ts","sourceRoot":"","sources":["../../src/oauth/popup.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,4BAA4B,EAC5B,oBAAoB,EAErB,MAAM,UAAU,CAAC;AAClB,OAAO,EACL,iBAAiB,EAEjB,uBAAuB,EAExB,MAAM,SAAS,CAAC;AA+CjB;;;;;;;GAOG;AACH,eAAO,MAAM,qBAAqB,QAAO,MAAM,GAAG,IACvB,CAAC;AAE5B;;;;;GAKG;AACH,eAAO,MAAM,yBAAyB,GACpC,OAAO,MAAM,EACb,MAAM,oBAAoB,EAC1B,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,mBAAkB,uBAAsD,EACxE,eAAc,iBAA6C,KAC1D,4BAiBF,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,kBAAkB,GAC7B,MAAM,oBAAoB,EAC1B,WAAW,MAAM,EACjB,cAAc,MAAM,EACpB,mBAAkB,uBAAsD,KACvE,4BAiBF,CAAC"}
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Percent-encodes each `/`-separated segment of a toolset id so it satisfies
3
+ * the backend's `DEPLOYMENT_ID_PATTERN`/`TOOLSET_URL_PATTERN` (spaces and
4
+ * other reserved characters must already be percent-encoded — e.g. `%20`,
5
+ * not a real space — before this value is used against the toolsets API;
6
+ * `/` stays a literal path separator). Externally-sourced ids — the raw,
7
+ * human-readable id an embedded iframe sends over `postMessage`
8
+ * (e.g. `toolsets/<bucket>/My Toolset__1.0`) — arrive unencoded, unlike the
9
+ * already-encoded `id`/`toolset` field `listToolsets()`/`DialToolsetDto`
10
+ * returns. Mirrors `encodeDeploymentId` (`deployment-id.ts`), which exists
11
+ * for the identical reason on the applications side.
12
+ */
13
+ export declare const encodeToolsetId: (id: string) => string;
14
+ /**
15
+ * Inverse of `encodeToolsetId` — decodes each `/`-separated segment back to
16
+ * its raw, human-readable form. A segment that isn't valid percent-encoding
17
+ * is passed through unchanged rather than throwing, since this decodes
18
+ * externally-sourced ids (broadcast toolset-login events).
19
+ */
20
+ export declare const decodeToolsetId: (id: string) => string;
21
+ /** Whether a toolset id belongs to the `public` bucket (shared with all users), mirroring the legacy `isEntityIdPublic` check. */
22
+ export declare const isPublicToolsetId: (toolsetId: string) => boolean;
23
+ //# sourceMappingURL=toolset-id.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"toolset-id.d.ts","sourceRoot":"","sources":["../../src/oauth/toolset-id.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,MAI/B,CAAC;AAEf;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,KAAG,MAU/B,CAAC;AAEf,kIAAkI;AAClI,eAAO,MAAM,iBAAiB,GAAI,WAAW,MAAM,KAAG,OAIrD,CAAC"}
@@ -0,0 +1,84 @@
1
+ /**
2
+ * Enums and constants shared by the OAuth authorization-code popup flow and
3
+ * every host that drives it. These declarations live here (rather than being
4
+ * copied per host) because TypeScript string enums are nominal: a
5
+ * structurally identical host-side copy would not type-check against a lib
6
+ * signature that names the enum.
7
+ */
8
+ /** Authentication mechanism a toolset requires. */
9
+ export declare enum ToolsetAuthTypes {
10
+ None = "NONE",
11
+ ApiKey = "API_KEY",
12
+ OAuth = "OAUTH"
13
+ }
14
+ /** Sign-in state DIAL Core reports for one credentials level of a toolset. */
15
+ export declare enum ToolsetAuthStatus {
16
+ SignedIn = "SIGNED_IN",
17
+ SignedOut = "SIGNED_OUT",
18
+ Failed = "FAILED"
19
+ }
20
+ /** Scope the credentials submitted by a login apply to. */
21
+ export declare enum ToolsetCredentialsLevel {
22
+ Global = "GLOBAL",
23
+ User = "USER",
24
+ App = "APP"
25
+ }
26
+ /** Whether a toolset authenticates interactively, and whether its client is manually configured. */
27
+ export declare enum WithLogin {
28
+ WithLogin = "with-login",
29
+ WithoutLogin = "without-login",
30
+ WithConfig = "with-config"
31
+ }
32
+ /**
33
+ * Which kind of resource an OAuth flow is authenticating. Three kinds share
34
+ * the same popup/`BroadcastChannel` machinery, which is why this module is
35
+ * named for the concern rather than for toolsets.
36
+ */
37
+ export declare enum OAuthResourceKind {
38
+ Toolset = "toolset",
39
+ ExternalService = "external-service",
40
+ /**
41
+ * Proactive Scheduled Tasks offline-credentials consent. Unlike
42
+ * `Toolset`/`ExternalService`, this kind has no natural per-resource id —
43
+ * the shared `ToolsetRedirectState.toolsetId` slot is repurposed as a
44
+ * fixed sentinel correlation id (`'offline-credentials'`) purely for the
45
+ * popup/`BroadcastChannel` handshake, never as a real toolset/
46
+ * external-service id.
47
+ */
48
+ OfflineCredentials = "offline-credentials"
49
+ }
50
+ /** Outcome of calling `initiateOAuthLogin`. */
51
+ export declare enum ToolsetOAuthInitiationResultType {
52
+ /** The popup was opened and navigated to the provider's authorize URL. */
53
+ Started = "started",
54
+ /** The browser blocked the popup before it could be opened. */
55
+ Blocked = "blocked",
56
+ /** The toolset's OAuth configuration is missing required fields. */
57
+ InvalidConfig = "invalid-config"
58
+ }
59
+ /** Outcome reported back to the tab that initiated an OAuth login. */
60
+ export declare enum ToolsetOAuthResultType {
61
+ Success = "success",
62
+ Failure = "failure",
63
+ /** The popup was closed and focus returned to its opener, or the flow timed out. */
64
+ Cancelled = "cancelled"
65
+ }
66
+ /** Reason codes the callback popup can report for a failed OAuth login. */
67
+ export declare enum ToolsetOAuthFailureReason {
68
+ MissingCode = "missing-code",
69
+ MissingRedirectState = "missing-redirect-state",
70
+ StateMismatch = "state-mismatch",
71
+ LoginRequestFailed = "login-request-failed"
72
+ }
73
+ /** Control messages exchanged over a flow-scoped OAuth channel. */
74
+ export declare enum ToolsetOAuthChannelControlType {
75
+ ResultAcknowledged = "result-acknowledged"
76
+ }
77
+ /** Query parameters written into the callback popup URL after an OAuth flow completes. */
78
+ export declare enum ToolsetOAuthCallbackQuery {
79
+ Result = "toolsetOAuthResult",
80
+ FailureReason = "toolsetOAuthFailureReason"
81
+ }
82
+ /** `sessionStorage` key the flow writes its `ToolsetRedirectState` under, in the popup it opens. */
83
+ export declare const TOOLSET_REDIRECT_STATE_KEY = "toolset-redirect-state";
84
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/oauth/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mDAAmD;AACnD,oBAAY,gBAAgB;IAC1B,IAAI,SAAS;IACb,MAAM,YAAY;IAClB,KAAK,UAAU;CAChB;AAED,8EAA8E;AAC9E,oBAAY,iBAAiB;IAC3B,QAAQ,cAAc;IACtB,SAAS,eAAe;IACxB,MAAM,WAAW;CAClB;AAED,2DAA2D;AAC3D,oBAAY,uBAAuB;IACjC,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,GAAG,QAAQ;CACZ;AAED,oGAAoG;AACpG,oBAAY,SAAS;IACnB,SAAS,eAAe;IACxB,YAAY,kBAAkB;IAC9B,UAAU,gBAAgB;CAC3B;AAED;;;;GAIG;AACH,oBAAY,iBAAiB;IAC3B,OAAO,YAAY;IACnB,eAAe,qBAAqB;IACpC;;;;;;;OAOG;IACH,kBAAkB,wBAAwB;CAC3C;AAED,+CAA+C;AAC/C,oBAAY,gCAAgC;IAC1C,0EAA0E;IAC1E,OAAO,YAAY;IACnB,+DAA+D;IAC/D,OAAO,YAAY;IACnB,oEAAoE;IACpE,aAAa,mBAAmB;CACjC;AAED,sEAAsE;AACtE,oBAAY,sBAAsB;IAChC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,oFAAoF;IACpF,SAAS,cAAc;CACxB;AAED,2EAA2E;AAC3E,oBAAY,yBAAyB;IACnC,WAAW,iBAAiB;IAC5B,oBAAoB,2BAA2B;IAC/C,aAAa,mBAAmB;IAChC,kBAAkB,yBAAyB;CAC5C;AAED,mEAAmE;AACnE,oBAAY,8BAA8B;IACxC,kBAAkB,wBAAwB;CAC3C;AAED,0FAA0F;AAC1F,oBAAY,yBAAyB;IACnC,MAAM,uBAAuB;IAC7B,aAAa,8BAA8B;CAC5C;AAED,oGAAoG;AACpG,eAAO,MAAM,0BAA0B,2BAA2B,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { ToolsetRedirectState } from '../models';
2
+ import { ToolsetCredentialsLevel, ToolsetOAuthFailureReason } from '../types';
3
+ /** Arguments handed to the host's exchange callback. */
4
+ export interface OAuthExchangeParams {
5
+ /** One-time authorization code the provider returned. */
6
+ code: string;
7
+ /** Redirect URI the code was issued against, to be echoed back to the backend. */
8
+ redirectUri: string;
9
+ /** Credentials level resolved from the stored redirect state. */
10
+ credentialsLevel: ToolsetCredentialsLevel;
11
+ /** The full redirect state the flow stored before navigating to the provider. */
12
+ redirectState: ToolsetRedirectState;
13
+ }
14
+ /** Parameters for {@link useOAuthCallbackCompletion}. */
15
+ export interface UseOAuthCallbackCompletionParams {
16
+ /**
17
+ * Query parameters of the callback URL. Read once per mount; the hook takes
18
+ * `code` and `state` from it.
19
+ */
20
+ searchParams: URLSearchParams;
21
+ /**
22
+ * Path used to build the `redirect_uri` echoed back to the backend when the
23
+ * stored redirect state carries none — every state written by the current
24
+ * flow does, so this only covers states written before that field existed.
25
+ */
26
+ callbackPath: string;
27
+ /**
28
+ * Performs the code-for-credentials exchange. Resolving `null` reports
29
+ * success; resolving a failure reason reports that reason (for a host-side
30
+ * validation the hook cannot perform, such as an unparseable resource id);
31
+ * rejecting reports `LoginRequestFailed`.
32
+ */
33
+ exchange: (params: OAuthExchangeParams) => Promise<ToolsetOAuthFailureReason | null>;
34
+ }
35
+ /** State {@link useOAuthCallbackCompletion} exposes for the host page to render. */
36
+ export interface UseOAuthCallbackCompletionResult {
37
+ /** True until the flow has reported an outcome. */
38
+ isInProgress: boolean;
39
+ /** Reason the flow failed, or `null` while in progress or on success. */
40
+ failureReason: ToolsetOAuthFailureReason | null;
41
+ }
42
+ /**
43
+ * Completes an OAuth authorization-code flow from inside the callback popup:
44
+ * reads and clears the redirect state written into this popup's own
45
+ * `sessionStorage`, scrubs the authorization code from the visible URL before
46
+ * any request, validates the returned `state`, performs the exchange through
47
+ * the injected callback, then reports the outcome into the popup URL and over
48
+ * the flow channel until acknowledged, closing the popup afterwards. Runs its
49
+ * effect once per mount even under StrictMode double-invocation. Renders
50
+ * nothing and produces no user-visible text — the host page presents and
51
+ * announces the returned state in its own language.
52
+ */
53
+ export declare const useOAuthCallbackCompletion: ({ searchParams, callbackPath, exchange, }: UseOAuthCallbackCompletionParams) => UseOAuthCallbackCompletionResult;
54
+ //# sourceMappingURL=useOAuthCallbackCompletion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useOAuthCallbackCompletion.d.ts","sourceRoot":"","sources":["../../../src/oauth/useOAuthCallbackCompletion/useOAuthCallbackCompletion.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAGV,oBAAoB,EACrB,MAAM,WAAW,CAAC;AACnB,OAAO,EAEL,uBAAuB,EAGvB,yBAAyB,EAE1B,MAAM,UAAU,CAAC;AAIlB,wDAAwD;AACxD,MAAM,WAAW,mBAAmB;IAClC,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAC;IACpB,iEAAiE;IACjE,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,iFAAiF;IACjF,aAAa,EAAE,oBAAoB,CAAC;CACrC;AAED,yDAAyD;AACzD,MAAM,WAAW,gCAAgC;IAC/C;;;OAGG;IACH,YAAY,EAAE,eAAe,CAAC;IAC9B;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,EAAE,CACR,MAAM,EAAE,mBAAmB,KACxB,OAAO,CAAC,yBAAyB,GAAG,IAAI,CAAC,CAAC;CAChD;AAED,oFAAoF;AACpF,MAAM,WAAW,gCAAgC;IAC/C,mDAAmD;IACnD,YAAY,EAAE,OAAO,CAAC;IACtB,yEAAyE;IACzE,aAAa,EAAE,yBAAyB,GAAG,IAAI,CAAC;CACjD;AA2ED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,0BAA0B,GAAI,2CAIxC,gCAAgC,KAAG,gCAmGrC,CAAC"}
@@ -0,0 +1,72 @@
1
+ import { DialToolsetDto, ToolsetLoginBodyDto, ToolsetLogoutBodyDto } from '@epam/ai-dial-chat-api-client';
2
+ import { ToolsetOAuthSettings } from '../models';
3
+ import { ToolsetAuthTypes, ToolsetCredentialsLevel } from '../types';
4
+ /** Terminal outcome kinds `login` can resolve. */
5
+ export declare enum ToolsetLoginOutcomeType {
6
+ Success = "success",
7
+ Failure = "failure",
8
+ PopupBlocked = "popup-blocked",
9
+ Cancelled = "cancelled"
10
+ }
11
+ /** Discriminated outcome of one login attempt. */
12
+ export interface ToolsetLoginOutcome {
13
+ /** Which terminal branch the attempt resolved through. */
14
+ type: ToolsetLoginOutcomeType;
15
+ }
16
+ /** Arguments for one `login` call. */
17
+ export interface ToolsetLoginParams {
18
+ /** Already-encoded toolset id/url, as returned by `listToolsets`/`getToolset`. */
19
+ toolsetId: string;
20
+ /** Credentials level the submitted credentials apply to. */
21
+ credentialsLevel: ToolsetCredentialsLevel;
22
+ /** Authentication mechanism the toolset requires. */
23
+ authenticationType: ToolsetAuthTypes;
24
+ /** Required for `ToolsetAuthTypes.ApiKey`. */
25
+ apiKey?: string;
26
+ /** Required for `ToolsetAuthTypes.OAuth`. */
27
+ oauthSettings?: ToolsetOAuthSettings;
28
+ /**
29
+ * Whether the target level's cached status is currently `FAILED` — API key
30
+ * logins log that level out first when true. Ignored when `forceStale` is
31
+ * set, and never consulted for OAuth (OAuth does not log out before
32
+ * retrying).
33
+ */
34
+ isCurrentlyFailed?: boolean;
35
+ /**
36
+ * Always logs out the target level first (for both API key and OAuth)
37
+ * regardless of the cached status — set by callers reacting to a
38
+ * DIAL-Core-pushed `toolset/signin` event, which is proof the cached
39
+ * status may be stale even when it still reads `SIGNED_IN`.
40
+ */
41
+ forceStale?: boolean;
42
+ }
43
+ /** Parameters for {@link useToolsetLogin}. */
44
+ export interface UseToolsetLoginParams {
45
+ /**
46
+ * The host's OAuth callback route. Resolved against `window.location.origin`
47
+ * for the `redirect_uri`, and compared against the popup's pathname when
48
+ * reading a completion marker out of its URL.
49
+ */
50
+ callbackPath: string;
51
+ /** Submits credentials for one toolset at one credentials level. */
52
+ loginToolset: (toolsetId: string, body: ToolsetLoginBodyDto) => Promise<unknown>;
53
+ /** Clears stored credentials for one toolset at one credentials level. */
54
+ logoutToolset: (toolsetId: string, body: ToolsetLogoutBodyDto) => Promise<unknown>;
55
+ /** Re-reads a toolset so a reported cancellation can be checked against the backend. */
56
+ getToolset: (toolsetId: string) => Promise<DialToolsetDto>;
57
+ }
58
+ /** Result returned by {@link useToolsetLogin}. */
59
+ export interface UseToolsetLoginResult {
60
+ /** Runs one API-key or OAuth login attempt and resolves its outcome. */
61
+ login: (params: ToolsetLoginParams) => Promise<ToolsetLoginOutcome>;
62
+ }
63
+ /**
64
+ * Shared toolset API-key/OAuth login orchestration, so no two surfaces fork
65
+ * the popup/`BroadcastChannel` handshake or the stale-credential-clearing
66
+ * rule. Every backend call arrives as an injected callback: the hook
67
+ * constructs no client instance and reads no app context. It resolves an
68
+ * outcome and shows nothing itself — mapping an outcome to notifications is
69
+ * the caller's job.
70
+ */
71
+ export declare const useToolsetLogin: ({ callbackPath, loginToolset, logoutToolset, getToolset, }: UseToolsetLoginParams) => UseToolsetLoginResult;
72
+ //# sourceMappingURL=useToolsetLogin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToolsetLogin.d.ts","sourceRoot":"","sources":["../../../src/oauth/useToolsetLogin/useToolsetLogin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACrB,MAAM,+BAA+B,CAAC;AAIvC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AAMtD,OAAO,EAEL,gBAAgB,EAChB,uBAAuB,EAGxB,MAAM,UAAU,CAAC;AAElB,kDAAkD;AAClD,oBAAY,uBAAuB;IACjC,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,YAAY,kBAAkB;IAC9B,SAAS,cAAc;CACxB;AAED,kDAAkD;AAClD,MAAM,WAAW,mBAAmB;IAClC,0DAA0D;IAC1D,IAAI,EAAE,uBAAuB,CAAC;CAC/B;AAED,sCAAsC;AACtC,MAAM,WAAW,kBAAkB;IACjC,kFAAkF;IAClF,SAAS,EAAE,MAAM,CAAC;IAClB,4DAA4D;IAC5D,gBAAgB,EAAE,uBAAuB,CAAC;IAC1C,qDAAqD;IACrD,kBAAkB,EAAE,gBAAgB,CAAC;IACrC,8CAA8C;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,6CAA6C;IAC7C,aAAa,CAAC,EAAE,oBAAoB,CAAC;IACrC;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;;;OAKG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,8CAA8C;AAC9C,MAAM,WAAW,qBAAqB;IACpC;;;;OAIG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB,oEAAoE;IACpE,YAAY,EAAE,CACZ,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,mBAAmB,KACtB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,0EAA0E;IAC1E,aAAa,EAAE,CACb,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,oBAAoB,KACvB,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,wFAAwF;IACxF,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC,cAAc,CAAC,CAAC;CAC5D;AAED,kDAAkD;AAClD,MAAM,WAAW,qBAAqB;IACpC,wEAAwE;IACxE,KAAK,EAAE,CAAC,MAAM,EAAE,kBAAkB,KAAK,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACrE;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,eAAe,GAAI,4DAK7B,qBAAqB,KAAG,qBA0K1B,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@epam/ai-dial-chat-hooks",
3
3
  "description": "Framework-level React hooks extracted from AI DIAL Chat for building custom chat interfaces",
4
- "version": "1.1.0-dev.293",
4
+ "version": "1.1.0-dev.296",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./index.js",
@@ -23,20 +23,20 @@
23
23
  },
24
24
  "peerDependencies": {
25
25
  "react": "^19.2.6",
26
- "@epam/ai-dial-attachment-canvas": "1.1.0-dev.293",
27
- "@epam/ai-dial-attachment-input": "1.1.0-dev.293",
28
- "@epam/ai-dial-catalog": "1.1.0-dev.293",
29
- "@epam/ai-dial-chat-api-client": "1.1.0-dev.293",
30
- "@epam/ai-dial-chat-overlay": "1.1.0-dev.293",
31
- "@epam/ai-dial-chat-shared": "1.1.0-dev.293",
32
- "@epam/ai-dial-deployment-creation-form": "1.1.0-dev.293",
33
- "@epam/ai-dial-publish-panel": "1.1.0-dev.293",
34
- "@epam/ai-dial-quotations": "1.1.0-dev.293",
26
+ "@epam/ai-dial-attachment-canvas": "1.1.0-dev.296",
27
+ "@epam/ai-dial-attachment-input": "1.1.0-dev.296",
28
+ "@epam/ai-dial-catalog": "1.1.0-dev.296",
29
+ "@epam/ai-dial-chat-api-client": "1.1.0-dev.296",
30
+ "@epam/ai-dial-chat-overlay": "1.1.0-dev.296",
31
+ "@epam/ai-dial-chat-shared": "1.1.0-dev.296",
32
+ "@epam/ai-dial-deployment-creation-form": "1.1.0-dev.296",
33
+ "@epam/ai-dial-publish-panel": "1.1.0-dev.296",
34
+ "@epam/ai-dial-quotations": "1.1.0-dev.296",
35
35
  "@epam/ai-dial-react-file-manager": "*",
36
- "@epam/ai-dial-scheduled-tasks": "1.1.0-dev.293",
37
- "@epam/ai-dial-share": "1.1.0-dev.293",
38
- "@epam/ai-dial-skill-editor": "1.1.0-dev.293",
39
- "@epam/ai-dial-source-panel": "1.1.0-dev.293",
36
+ "@epam/ai-dial-scheduled-tasks": "1.1.0-dev.296",
37
+ "@epam/ai-dial-share": "1.1.0-dev.296",
38
+ "@epam/ai-dial-skill-editor": "1.1.0-dev.296",
39
+ "@epam/ai-dial-source-panel": "1.1.0-dev.296",
40
40
  "@epam/ai-dial-ui-kit": "*",
41
41
  "ag-grid-community": "^35.3.0",
42
42
  "fflate": "^0.8.3"
@@ -1,4 +1,3 @@
1
- export { getUtf8ByteLength, sanitizeConversationName, stripTrailingDots, PROHIBITED_CONVERSATION_NAME_CHARS_RE, } from '@epam/ai-dial-chat-shared';
2
1
  /** Case-insensitive substring match. */
3
2
  export declare const includesIgnoreCase: (str: string, query: string) => boolean;
4
3
  /** Decodes a URI-encoded path segment, returning the original string if decoding fails. */
@@ -1 +1 @@
1
- {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../src/shared/string-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,qCAAqC,GACtC,MAAM,2BAA2B,CAAC;AAEnC,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OACf,CAAC;AAElD,2FAA2F;AAC3F,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAM5C,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,SATC,MAAM,KAAG,MASM,CAAC;AAEpD,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,GAAI,MAAM,MAAM,KAAG,MACvB,CAAC"}
1
+ {"version":3,"file":"string-utils.d.ts","sourceRoot":"","sources":["../../src/shared/string-utils.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,eAAO,MAAM,kBAAkB,GAAI,KAAK,MAAM,EAAE,OAAO,MAAM,KAAG,OACf,CAAC;AAElD,2FAA2F;AAC3F,eAAO,MAAM,aAAa,GAAI,MAAM,MAAM,KAAG,MAM5C,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,sBAAsB,SATC,MAAM,KAAG,MASM,CAAC;AAEpD,+DAA+D;AAC/D,eAAO,MAAM,uBAAuB,GAAI,MAAM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AE,CAAC,CAAC,CAAC;IACxD,yEAAyE;IACzE,eAAe,EAAE,KAAK,CAAC,gBAAgB,CAAC,GAAG,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,CAAC;IACvE,mEAAmE;IACnE,cAAc,EAAE,KAAK,CAAC,gBAAgB,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IAChE,yFAAyF;IACzF,YAAY,EAAE,iBAAiB,GAAG,SAAS,CAAC;IAC5C,sDAAsD;IACtD,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,iBAAiB,GAAG,SAAS,CAAC,CAAC,CAAC;IACzE,oFAAoF;IACpF,UAAU,EAAE,OAAO,CAAC;IACpB,oEAAoE;IACpE,OAAO,EAAE,OAAO,CAAC;IACjB,0DAA0D;IAC1D,eAAe,EAAE,QAAQ,CAAC,cAAc,CAAC,MAAM,CAAC,CAAC,CAAC;IAClD,gDAAgD;IAChD,QAAQ,EAAE,wBAAwB,CAAC;CACpC;AAED,mDAAmD;AACnD,MAAM,WAAW,yBAAyB;IACxC,4FAA4F;IAC5F,WAAW,EAAE,sBAAsB,CAAC;IACpC,iFAAiF;IACjF,qBAAqB,EAAE,OAAO,CAAC;IAC/B,kFAAkF;IAClF,qBAAqB,EAAE,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI,CAAC;CACpD;AAED;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAAI,sIAWjC,yBAAyB,KAAG,yBAsL9B,CAAC"}
@@ -1,26 +1,17 @@
1
1
  import { DeploymentConfigurationSchema, ToolMenuItem } from '@epam/ai-dial-chat-shared';
2
2
  import { ReactNode } from 'react';
3
- /** Translatable strings the tools menu surfaces. */
4
- export interface ToolsMenuLabels {
5
- /** Fallback label for the deep-research tool when the schema defines no `title`. */
6
- deepResearchFallback: string;
7
- }
8
3
  /** Host-supplied inputs to {@link useToolsMenu}. */
9
4
  export interface UseToolsMenuParams {
10
- /** Operator-configured deep-research tool id, or `null` when none is configured. */
11
- deepResearchToolId: string | null;
12
5
  /** Id of the currently selected deployment, or `null` when none is selected. */
13
6
  selectedItemId: string | null;
14
7
  /** JSON-schema configuration for the selected deployment, or `null` when none. */
15
8
  selectedDeploymentConfiguration: DeploymentConfigurationSchema | null;
16
- /** Translated labels. Fields not provided fall back to English defaults. */
17
- labels?: Partial<ToolsMenuLabels>;
18
- /** Icon element rendered on the tool menu item. Defaults to `null`. */
9
+ /** Icon element rendered on every tool menu item. Defaults to `null`. */
19
10
  toolIcon?: ReactNode;
20
11
  }
21
12
  /** Result returned by {@link useToolsMenu}. */
22
13
  export type UseToolsMenuResult = {
23
- /** Derived submenu items (empty until a boolean tool property is found). */
14
+ /** One item per boolean property of the deployment configuration schema, in schema order. */
24
15
  toolsMenuItems: ToolMenuItem[];
25
16
  /** Toggles the tool with the given id; ignores unknown ids. */
26
17
  onToolToggle: (id: string) => void;
@@ -30,11 +21,11 @@ export type UseToolsMenuResult = {
30
21
  restoreToolConfiguration: (configurationValue: Record<string, unknown> | undefined) => void;
31
22
  };
32
23
  /**
33
- * Derives the tools submenu from the active deployment's configuration schema
34
- * and the operator-configured tool id. Manages toggle state locally, resets on
35
- * deployment change, and exposes a stable `toolConfigurationValue` record for
36
- * inclusion in completion requests. Headless: translation and the tool icon are
37
- * the host's responsibility, supplied via `labels` and `toolIcon`.
24
+ * Derives the tools submenu from the active deployment's configuration schema:
25
+ * every boolean property becomes a toggle. Manages toggle state locally, resets
26
+ * on deployment change, and exposes a stable `toolConfigurationValue` record for
27
+ * inclusion in completion requests. Headless: the tool icon is the host's
28
+ * responsibility, supplied via `toolIcon`.
38
29
  */
39
30
  export declare const useToolsMenu: (params: UseToolsMenuParams) => UseToolsMenuResult;
40
31
  //# sourceMappingURL=useToolsMenu.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"useToolsMenu.d.ts","sourceRoot":"","sources":["../../src/useToolsMenu/useToolsMenu.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,6B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