@ai4b-team/fsaos-gateway-sdk 3.26.0 → 3.26.1
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/iife/gateway.js +3 -3
- package/dist/iife/gateway.js.map +3 -3
- package/dist/iife/ui.js +1 -1
- package/dist/index.cjs +59 -9
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +16 -1
- package/dist/index.d.ts +16 -1
- package/dist/index.js +59 -10
- package/dist/index.js.map +1 -1
- package/package.json +3 -2
package/dist/iife/ui.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-
|
|
1
|
+
/* @fsaos/ui v2.0.0 — FSAOS UI Primitives — 2026-09-04T03:02:59.993Z */
|
|
2
2
|
"use strict";var __FSAOS_UI__=(()=>{var m=Object.create;var r=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var y=(e,i)=>()=>(i||e((i={exports:{}}).exports,i),i.exports),N=(e,i)=>{for(var a in i)r(e,a,{get:i[a],enumerable:!0})},s=(e,i,a,l)=>{if(i&&typeof i=="object"||typeof i=="function")for(let t of u(i))!h.call(e,t)&&t!==a&&r(e,t,{get:()=>i[t],enumerable:!(l=g(i,t))||l.enumerable});return e};var x=(e,i,a)=>(a=e!=null?m(f(e)):{},s(i||!e||!e.__esModule?r(a,"default",{value:e,enumerable:!0}):a,e)),b=e=>s(r({},"__esModule",{value:!0}),e);var d=y((V,c)=>{c.exports=React});var P={};N(P,{Badge:()=>z,Breadcrumbs:()=>A,Button:()=>D,Card:()=>w,DataView:()=>R,Detail:()=>_,Empty:()=>I,FilePreview:()=>O,Form:()=>F,Grid:()=>k,Image:()=>G,Link:()=>E,Page:()=>v,Router:()=>T,Sidebar:()=>S,Spinner:()=>B,Stack:()=>C,Table:()=>j,Tabs:()=>W,Video:()=>H});var n=x(d(),1);function o(){return(typeof window<"u"&&window.__FSAOS_CONFIG__||{}).edgeBaseUrl||""}function v(e){return(0,n.createElement)("div",{style:{minHeight:"100vh",display:"flex",flexDirection:"column"},className:e.className||""},e.children)}function C(e){let i=e.direction||"vertical";return(0,n.createElement)("div",{style:{display:"flex",flexDirection:i==="horizontal"?"row":"column",gap:e.gap||"0.5rem",padding:e.padding||"0",alignItems:e.align||"stretch",justifyContent:e.justify||"flex-start",flex:e.flex||"initial"},className:e.className||""},e.children)}function k(e){return(0,n.createElement)("div",{style:{display:"grid",gridTemplateColumns:"repeat("+(e.columns||3)+", 1fr)",gap:e.gap||"1rem",padding:e.padding||"0"},className:e.className||""},e.children)}function S(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"row",minHeight:"100vh"},className:e.className||""},e.children)}function w(e){return(0,n.createElement)("div",{style:{border:"1px solid var(--color-border, #e5e7eb)",borderRadius:"var(--border-radius, 0.5rem)",padding:e.padding||"1rem",background:"var(--color-surface, #fff)"},className:e.className||"",onClick:e.onClick},e.children)}function z(e){return(0,n.createElement)("span",{style:{display:"inline-flex",alignItems:"center",padding:"0.125rem 0.5rem",fontSize:"0.75rem",fontWeight:"500",borderRadius:"9999px",background:e.color||"#e5e7eb",color:e.textColor||"#374151"},className:e.className||""},e.children||e.label)}function B(e){let i=e.size||"1.5rem";return(0,n.createElement)("div",{style:{width:i,height:i,border:"2px solid #e5e7eb",borderTopColor:"var(--color-primary, #3b82f6)",borderRadius:"50%",animation:"fsaos-spin 0.6s linear infinite"}})}function D(e){return(0,n.createElement)("button",{style:{display:"inline-flex",alignItems:"center",justifyContent:"center",padding:"0.5rem 1rem",fontSize:"0.875rem",fontWeight:"500",borderRadius:"var(--border-radius, 0.375rem)",border:e.variant==="outline"?"1px solid var(--color-border, #d1d5db)":"none",background:e.variant==="outline"||e.variant==="ghost"?"transparent":"var(--color-primary, #3b82f6)",color:e.variant==="outline"||e.variant==="ghost"?"var(--color-text, #1a1a1a)":"#fff",cursor:e.disabled?"not-allowed":"pointer",opacity:e.disabled?"0.5":"1",gap:"0.5rem"},className:e.className||"",onClick:e.onClick,disabled:e.disabled},e.children||e.label)}function I(e){return(0,n.createElement)("div",{style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"3rem",color:"var(--color-text-secondary, #6b7280)",textAlign:"center"}},e.icon?(0,n.createElement)("div",{style:{fontSize:"2rem",marginBottom:"0.5rem"}},e.icon):null,(0,n.createElement)("div",{style:{fontWeight:500,marginBottom:"0.25rem"}},e.title||e.message||e.children||"No items"),e.description?(0,n.createElement)("div",{style:{fontSize:"0.875rem",opacity:.7}},e.description):null)}function R(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function j(e){return(0,n.createElement)("table",{className:e.className||""},e.children)}function F(e){return(0,n.createElement)("form",{className:e.className||"",onSubmit:e.onSubmit},e.children)}function _(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function T(e){return(0,n.createElement)("div",null,e.children)}function E(e){return(0,n.createElement)("a",{href:e.href||e.to,className:e.className||"",onClick:e.onClick},e.children)}function W(e){return(0,n.createElement)("div",{className:e.className||""},e.children)}function A(e){return(0,n.createElement)("nav",{className:e.className||""},e.children)}function G(e){return(0,n.createElement)("img",{src:e.src||(e.path?o()+e.path:""),alt:e.alt||"",className:e.className||"",style:e.style})}function H(e){return(0,n.createElement)("video",{src:e.src||(e.path?o()+e.path:""),controls:!0,className:e.className||""})}function O(e){return(0,n.createElement)("div",{className:e.className||""},e.children||"File preview")}return b(P);})();
|
|
3
3
|
//# sourceMappingURL=ui.js.map
|
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
ComponentRenderer: () => ComponentRenderer,
|
|
44
44
|
EnforcementDeniedError: () => EnforcementDeniedError,
|
|
45
45
|
FormSubmissionError: () => FormSubmissionError,
|
|
46
|
+
GatewayRequestError: () => GatewayRequestError,
|
|
46
47
|
InteractionTrackingError: () => InteractionTrackingError,
|
|
47
48
|
KernelProvider: () => KernelProvider,
|
|
48
49
|
QueryClientProvider: () => reactQuery.QueryClientProvider,
|
|
@@ -793,6 +794,26 @@ var ANCHOR_INDEPENDENT_METHODS = /* @__PURE__ */ new Set([
|
|
|
793
794
|
"list-memberships",
|
|
794
795
|
"init"
|
|
795
796
|
]);
|
|
797
|
+
var GatewayRequestError = class extends Error {
|
|
798
|
+
name = "GatewayRequestError";
|
|
799
|
+
method;
|
|
800
|
+
status;
|
|
801
|
+
statusText;
|
|
802
|
+
payload;
|
|
803
|
+
responseBody;
|
|
804
|
+
constructor(options) {
|
|
805
|
+
const code = typeof options.payload?.error === "string" ? options.payload.error.trim() : "";
|
|
806
|
+
const detail = typeof options.payload?.message === "string" ? options.payload.message.trim() : "";
|
|
807
|
+
const fallback = options.responseBody.trim() || `Gateway HTTP error: ${options.status} ${options.statusText}`.trim();
|
|
808
|
+
const message = code && detail ? `${code}: ${detail}` : detail || code || fallback;
|
|
809
|
+
super(message);
|
|
810
|
+
this.method = options.method;
|
|
811
|
+
this.status = options.status;
|
|
812
|
+
this.statusText = options.statusText;
|
|
813
|
+
this.payload = options.payload;
|
|
814
|
+
this.responseBody = options.responseBody;
|
|
815
|
+
}
|
|
816
|
+
};
|
|
796
817
|
async function gatewayCall(method, params = {}) {
|
|
797
818
|
const hostname = getHostname();
|
|
798
819
|
const url = `${GATEWAY_URL}/d/${hostname}`;
|
|
@@ -820,24 +841,52 @@ async function gatewayCall(method, params = {}) {
|
|
|
820
841
|
headers,
|
|
821
842
|
body: JSON.stringify({ method, params: enrichedParams })
|
|
822
843
|
});
|
|
823
|
-
|
|
824
|
-
|
|
844
|
+
const responseBody = await response.text();
|
|
845
|
+
let json = null;
|
|
846
|
+
if (responseBody) {
|
|
847
|
+
try {
|
|
848
|
+
json = JSON.parse(responseBody);
|
|
849
|
+
} catch {
|
|
850
|
+
}
|
|
851
|
+
}
|
|
852
|
+
if (!response.ok || !json) {
|
|
853
|
+
throw new GatewayRequestError({
|
|
854
|
+
method,
|
|
855
|
+
status: response.status,
|
|
856
|
+
statusText: response.statusText,
|
|
857
|
+
payload: json,
|
|
858
|
+
responseBody
|
|
859
|
+
});
|
|
825
860
|
}
|
|
826
|
-
const json = await response.json();
|
|
827
861
|
if (json.success === false) {
|
|
828
862
|
const err = json.error || "";
|
|
829
863
|
const deniedBy = json.denied_by || json.error_type || "";
|
|
830
864
|
if (deniedBy === "rule" || deniedBy === "access" || deniedBy === "entitlement" || err === "RULE_DENIED" || err === "ACCESS_DENIED" || err === "PERMISSION_DENIED" || err === "ENTITLEMENT_REQUIRED") {
|
|
831
865
|
throw new EnforcementDeniedError(json);
|
|
832
866
|
}
|
|
833
|
-
throw new
|
|
834
|
-
|
|
835
|
-
|
|
867
|
+
throw new GatewayRequestError({
|
|
868
|
+
method,
|
|
869
|
+
status: response.status,
|
|
870
|
+
statusText: response.statusText,
|
|
871
|
+
payload: json,
|
|
872
|
+
responseBody
|
|
873
|
+
});
|
|
836
874
|
}
|
|
837
875
|
return json;
|
|
838
876
|
}
|
|
839
877
|
|
|
840
878
|
// src/execution-control.ts
|
|
879
|
+
async function executionControlCall(params) {
|
|
880
|
+
try {
|
|
881
|
+
return await gatewayCall("execution-control-transition", params);
|
|
882
|
+
} catch (error) {
|
|
883
|
+
if (!(error instanceof GatewayRequestError) || error.status < 500) {
|
|
884
|
+
throw error;
|
|
885
|
+
}
|
|
886
|
+
await new Promise((resolve) => setTimeout(resolve, 250));
|
|
887
|
+
return gatewayCall("execution-control-transition", params);
|
|
888
|
+
}
|
|
889
|
+
}
|
|
841
890
|
function withConversationAnchor(response) {
|
|
842
891
|
const anchor = response.conversation_anchor_item_id ?? response.conversation_root_id;
|
|
843
892
|
if (!anchor) return response;
|
|
@@ -860,7 +909,7 @@ async function cancelTurn(requestMessageId, options = {}) {
|
|
|
860
909
|
if (idempotencyKey.length > 128) {
|
|
861
910
|
throw new TypeError("cancelTurn idempotency key must be 128 characters or fewer");
|
|
862
911
|
}
|
|
863
|
-
const response = await
|
|
912
|
+
const response = await executionControlCall({
|
|
864
913
|
op: "request",
|
|
865
914
|
command: "cancel",
|
|
866
915
|
delivery: "immediate",
|
|
@@ -890,7 +939,7 @@ async function steerTurn(requestMessageId, selectedQueueEntryId, options = {}) {
|
|
|
890
939
|
if (idempotencyKey.length > 128) {
|
|
891
940
|
throw new TypeError("steerTurn idempotency key must be 128 characters or fewer");
|
|
892
941
|
}
|
|
893
|
-
const response = await
|
|
942
|
+
const response = await executionControlCall({
|
|
894
943
|
op: "request",
|
|
895
944
|
command: "steer",
|
|
896
945
|
delivery: "immediate",
|
|
@@ -914,7 +963,7 @@ async function cancelQueuedTurn(queueEntryId, options = {}) {
|
|
|
914
963
|
if (idempotencyKey.length > 128) {
|
|
915
964
|
throw new TypeError("cancelQueuedTurn idempotency key must be 128 characters or fewer");
|
|
916
965
|
}
|
|
917
|
-
const response = await
|
|
966
|
+
const response = await executionControlCall({
|
|
918
967
|
op: "cancel_queue_entry",
|
|
919
968
|
queue_entry_id: target,
|
|
920
969
|
idempotency_key: idempotencyKey,
|
|
@@ -4674,6 +4723,7 @@ Object.defineProperty(exports, "QueryClientProvider", {
|
|
|
4674
4723
|
exports.ComponentRenderer = ComponentRenderer;
|
|
4675
4724
|
exports.EnforcementDeniedError = EnforcementDeniedError;
|
|
4676
4725
|
exports.FormSubmissionError = FormSubmissionError;
|
|
4726
|
+
exports.GatewayRequestError = GatewayRequestError;
|
|
4677
4727
|
exports.InteractionTrackingError = InteractionTrackingError;
|
|
4678
4728
|
exports.KernelProvider = KernelProvider;
|
|
4679
4729
|
exports.auth = auth;
|