@agent-native/dispatch 0.31.14 → 0.31.16
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/actions/provider-api-register.d.ts +7 -7
- package/dist/components/dispatch-control-plane.d.ts.map +1 -1
- package/dist/components/dispatch-control-plane.js +2 -2
- package/dist/components/dispatch-control-plane.js.map +1 -1
- package/dist/components/layout/Layout.d.ts +17 -4
- package/dist/components/layout/Layout.d.ts.map +1 -1
- package/dist/components/layout/Layout.js +45 -20
- package/dist/components/layout/Layout.js.map +1 -1
- package/dist/components/workspace-app-card.d.ts.map +1 -1
- package/dist/components/workspace-app-card.js +18 -1
- package/dist/components/workspace-app-card.js.map +1 -1
- package/dist/lib/catch-all-target.d.ts.map +1 -1
- package/dist/lib/catch-all-target.js +4 -2
- package/dist/lib/catch-all-target.js.map +1 -1
- package/dist/routes/pages/automations.d.ts.map +1 -1
- package/dist/routes/pages/automations.js +19 -16
- package/dist/routes/pages/automations.js.map +1 -1
- package/dist/server/lib/app-creation-store.d.ts.map +1 -1
- package/dist/server/lib/app-creation-store.js +31 -10
- package/dist/server/lib/app-creation-store.js.map +1 -1
- package/package.json +3 -3
- package/src/components/dispatch-control-plane.spec.tsx +3 -1
- package/src/components/dispatch-control-plane.tsx +2 -1
- package/src/components/layout/Layout.spec.tsx +143 -25
- package/src/components/layout/Layout.tsx +79 -47
- package/src/components/workspace-app-card.tsx +27 -1
- package/src/lib/catch-all-target.spec.ts +8 -0
- package/src/lib/catch-all-target.ts +4 -2
- package/src/routes/pages/automations.spec.tsx +240 -0
- package/src/routes/pages/automations.tsx +22 -16
- package/src/server/lib/app-creation-store.spec.ts +42 -15
- package/src/server/lib/app-creation-store.ts +36 -10
- package/src/styles/dispatch-css.spec.ts +3 -0
- package/src/styles/dispatch.css +5 -0
|
@@ -305,6 +305,13 @@ function workspaceAppUrl(appPath) {
|
|
|
305
305
|
return null;
|
|
306
306
|
}
|
|
307
307
|
}
|
|
308
|
+
function isLocalWorkspaceGateway(url) {
|
|
309
|
+
const hostname = url.hostname.replace(/^\[|\]$/g, "").toLowerCase();
|
|
310
|
+
return (hostname === "localhost" ||
|
|
311
|
+
hostname === "127.0.0.1" ||
|
|
312
|
+
hostname === "0.0.0.0" ||
|
|
313
|
+
hostname === "::1");
|
|
314
|
+
}
|
|
308
315
|
function workspaceAppLink(appPath, explicitUrl) {
|
|
309
316
|
const urlValue = typeof explicitUrl === "string" ? explicitUrl.trim() : "";
|
|
310
317
|
if (!urlValue)
|
|
@@ -1145,17 +1152,31 @@ async function readWorkspaceAppsFromGateway() {
|
|
|
1145
1152
|
...authHeaders,
|
|
1146
1153
|
};
|
|
1147
1154
|
try {
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1155
|
+
if (isLocalWorkspaceGateway(baseUrl)) {
|
|
1156
|
+
const localResponse = await fetch(gatewayUrl(WORKSPACE_APPS_GATEWAY_PATH), {
|
|
1157
|
+
headers,
|
|
1158
|
+
signal: controller.signal,
|
|
1159
|
+
});
|
|
1160
|
+
if (localResponse.ok) {
|
|
1161
|
+
return parseWorkspaceAppsManifest(
|
|
1162
|
+
// coercion-ok: malformed gateway JSON is an unavailable registry and
|
|
1163
|
+
// must fall through to the local manifest sources.
|
|
1164
|
+
await localResponse.json().catch(() => null));
|
|
1165
|
+
}
|
|
1157
1166
|
}
|
|
1158
|
-
|
|
1167
|
+
const requestOrigin = requestContext?.requestOrigin;
|
|
1168
|
+
const isSameOriginGateway = requestOrigin
|
|
1169
|
+
? (() => {
|
|
1170
|
+
try {
|
|
1171
|
+
return new URL(requestOrigin).origin === baseUrl.origin;
|
|
1172
|
+
}
|
|
1173
|
+
catch {
|
|
1174
|
+
// coercion-ok: an invalid request origin cannot prove a self-fetch.
|
|
1175
|
+
return false;
|
|
1176
|
+
}
|
|
1177
|
+
})()
|
|
1178
|
+
: false;
|
|
1179
|
+
if (isSameOriginGateway || !authHeaders.Authorization)
|
|
1159
1180
|
return null;
|
|
1160
1181
|
const actionUrl = gatewayUrl(WORKSPACE_APPS_ACTION_PATH);
|
|
1161
1182
|
actionUrl.searchParams.set("includeAgentCards", "false");
|