@agent-native/core 0.12.19 → 0.12.20
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/cli/create.d.ts +4 -1
- package/dist/cli/create.d.ts.map +1 -1
- package/dist/cli/create.js +19 -4
- package/dist/cli/create.js.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/workspace-dev.d.ts +1 -0
- package/dist/cli/workspace-dev.d.ts.map +1 -1
- package/dist/cli/workspace-dev.js +11 -9
- package/dist/cli/workspace-dev.js.map +1 -1
- package/dist/client/analytics.d.ts +4 -0
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +11 -2
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/resources/ResourcesPanel.d.ts.map +1 -1
- package/dist/client/resources/ResourcesPanel.js +5 -40
- package/dist/client/resources/ResourcesPanel.js.map +1 -1
- package/dist/client/settings/AutomationsSection.d.ts.map +1 -1
- package/dist/client/settings/AutomationsSection.js +3 -30
- package/dist/client/settings/AutomationsSection.js.map +1 -1
- package/dist/client/terminal/AgentTerminal.d.ts.map +1 -1
- package/dist/client/terminal/AgentTerminal.js +44 -14
- package/dist/client/terminal/AgentTerminal.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +61 -6
- package/dist/deploy/build.js.map +1 -1
- package/dist/deploy/workspace-deploy.d.ts +1 -1
- package/dist/deploy/workspace-deploy.d.ts.map +1 -1
- package/dist/deploy/workspace-deploy.js +158 -7
- package/dist/deploy/workspace-deploy.js.map +1 -1
- package/dist/server/auth.d.ts.map +1 -1
- package/dist/server/auth.js +48 -8
- package/dist/server/auth.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +4 -2
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/sentry-config.d.ts +5 -0
- package/dist/server/sentry-config.d.ts.map +1 -0
- package/dist/server/sentry-config.js +43 -0
- package/dist/server/sentry-config.js.map +1 -0
- package/dist/server/sentry-plugin.d.ts +1 -1
- package/dist/server/sentry-plugin.js +2 -2
- package/dist/server/sentry-plugin.js.map +1 -1
- package/dist/server/sentry.d.ts +4 -4
- package/dist/server/sentry.d.ts.map +1 -1
- package/dist/server/sentry.js +13 -13
- package/dist/server/sentry.js.map +1 -1
- package/dist/server/ssr-handler.d.ts.map +1 -1
- package/dist/server/ssr-handler.js +12 -2
- package/dist/server/ssr-handler.js.map +1 -1
- package/dist/templates/workspace-root/_gitignore +1 -0
- package/dist/usage/store.d.ts.map +1 -1
- package/dist/usage/store.js +5 -5
- package/dist/usage/store.js.map +1 -1
- package/docs/content/deployment.md +23 -3
- package/docs/content/multi-app-workspace.md +8 -2
- package/docs/content/observability.md +8 -8
- package/package.json +1 -1
- package/src/templates/workspace-root/_gitignore +1 -0
package/dist/server/auth.js
CHANGED
|
@@ -604,10 +604,11 @@ function createAuthGuardFn() {
|
|
|
604
604
|
const config = _authGuardConfig;
|
|
605
605
|
if (!config)
|
|
606
606
|
return;
|
|
607
|
-
const {
|
|
607
|
+
const { publicPaths } = config;
|
|
608
608
|
const url = event.node?.req?.url ?? event.path ?? "/";
|
|
609
609
|
const queryStart = url.indexOf("?");
|
|
610
610
|
const rawPath = queryStart >= 0 ? url.slice(0, queryStart) : url;
|
|
611
|
+
const loginHtml = config.getLoginHtml?.(event, rawPath) ?? config.loginHtml;
|
|
611
612
|
const p = stripAppBasePath(rawPath);
|
|
612
613
|
const normalizedUrl = queryStart >= 0 ? `${p}${url.slice(queryStart)}` : p;
|
|
613
614
|
const callbackRelay = workspaceOAuthCallbackRelayResponse(event);
|
|
@@ -939,8 +940,35 @@ function stripAppBasePath(pathname) {
|
|
|
939
940
|
// ---------------------------------------------------------------------------
|
|
940
941
|
// Login page HTML (ACCESS_TOKEN mode)
|
|
941
942
|
// ---------------------------------------------------------------------------
|
|
942
|
-
function
|
|
943
|
-
|
|
943
|
+
function inferWorkspaceBasePathFromRequest(requestPath) {
|
|
944
|
+
if (process.env.AGENT_NATIVE_WORKSPACE !== "1" &&
|
|
945
|
+
process.env.VITE_AGENT_NATIVE_WORKSPACE !== "1") {
|
|
946
|
+
return "";
|
|
947
|
+
}
|
|
948
|
+
if (!requestPath || !requestPath.startsWith("/"))
|
|
949
|
+
return "";
|
|
950
|
+
const firstSegment = requestPath.split(/[/?#]/)[1];
|
|
951
|
+
if (!firstSegment)
|
|
952
|
+
return "";
|
|
953
|
+
const reservedRootPaths = new Set([
|
|
954
|
+
"_agent-native",
|
|
955
|
+
".well-known",
|
|
956
|
+
"api",
|
|
957
|
+
"login",
|
|
958
|
+
"signup",
|
|
959
|
+
"apps",
|
|
960
|
+
"new-app",
|
|
961
|
+
"approval",
|
|
962
|
+
"extensions",
|
|
963
|
+
]);
|
|
964
|
+
if (reservedRootPaths.has(firstSegment))
|
|
965
|
+
return "";
|
|
966
|
+
if (!isValidWorkspaceAppIdFormat(firstSegment))
|
|
967
|
+
return "";
|
|
968
|
+
return `/${firstSegment}`;
|
|
969
|
+
}
|
|
970
|
+
function getTokenLoginHtml(options = {}) {
|
|
971
|
+
const configuredBasePath = getAppBasePath() || inferWorkspaceBasePathFromRequest(options.requestPath);
|
|
944
972
|
return `<!DOCTYPE html>
|
|
945
973
|
<html lang="en">
|
|
946
974
|
<head>
|
|
@@ -1126,7 +1154,7 @@ function getTokenLoginHtml() {
|
|
|
1126
1154
|
<div class="card">
|
|
1127
1155
|
<div class="eyebrow">Private deployment</div>
|
|
1128
1156
|
<h1>This app is private</h1>
|
|
1129
|
-
<p class="intro">Enter the shared app access token to continue. This is the value configured for this app, not your
|
|
1157
|
+
<p class="intro">Enter the shared app access token to continue. This is the value configured for this app, not your deploy provider account token.</p>
|
|
1130
1158
|
<form id="form">
|
|
1131
1159
|
<label for="token"><span>App ACCESS_TOKEN</span><span>Required</span></label>
|
|
1132
1160
|
<div class="input-wrap">
|
|
@@ -1138,7 +1166,7 @@ function getTokenLoginHtml() {
|
|
|
1138
1166
|
</form>
|
|
1139
1167
|
<details>
|
|
1140
1168
|
<summary>Where do I find this?</summary>
|
|
1141
|
-
<p>
|
|
1169
|
+
<p>Create or copy the app's shared token from your deployment environment variables. The key should be <code>ACCESS_TOKEN</code> for one token or <code>ACCESS_TOKENS</code> for a comma-separated list. Redeploy after changing it.</p>
|
|
1142
1170
|
</details>
|
|
1143
1171
|
</div>
|
|
1144
1172
|
<script>
|
|
@@ -1214,7 +1242,7 @@ function getTokenLoginHtml() {
|
|
|
1214
1242
|
body: JSON.stringify({ token: token }),
|
|
1215
1243
|
});
|
|
1216
1244
|
if (!res.ok) {
|
|
1217
|
-
var badTokenMessage = 'That token was not accepted. Use this app\\'s shared ACCESS_TOKEN, not
|
|
1245
|
+
var badTokenMessage = 'That token was not accepted. Use this app\\'s shared ACCESS_TOKEN, not your deploy provider account token.';
|
|
1218
1246
|
if (res.status === 404) {
|
|
1219
1247
|
badTokenMessage = 'Could not reach this app\\'s auth endpoint. If this app is mounted under a path, confirm APP_BASE_PATH and VITE_APP_BASE_PATH match the deploy path.';
|
|
1220
1248
|
}
|
|
@@ -1879,7 +1907,11 @@ function mountTokenOnlyRoutes(app, accessTokens, publicPaths = []) {
|
|
|
1879
1907
|
const session = await getSession(event);
|
|
1880
1908
|
return session ?? { error: "Not authenticated" };
|
|
1881
1909
|
}));
|
|
1882
|
-
_authGuardConfig = {
|
|
1910
|
+
_authGuardConfig = {
|
|
1911
|
+
loginHtml: getTokenLoginHtml(),
|
|
1912
|
+
getLoginHtml: (_event, rawPath) => getTokenLoginHtml({ requestPath: rawPath }),
|
|
1913
|
+
publicPaths,
|
|
1914
|
+
};
|
|
1883
1915
|
const guardFn = createAuthGuardFn();
|
|
1884
1916
|
_authGuardFn = guardFn;
|
|
1885
1917
|
app.use(defineEventHandler(guardFn));
|
|
@@ -2099,7 +2131,15 @@ export async function autoMountAuth(app, options = {}) {
|
|
|
2099
2131
|
return { ok: true };
|
|
2100
2132
|
}));
|
|
2101
2133
|
const byoaLoginHtml = options.loginHtml ?? getTokenLoginHtml();
|
|
2102
|
-
_authGuardConfig = {
|
|
2134
|
+
_authGuardConfig = {
|
|
2135
|
+
loginHtml: byoaLoginHtml,
|
|
2136
|
+
...(options.loginHtml
|
|
2137
|
+
? {}
|
|
2138
|
+
: {
|
|
2139
|
+
getLoginHtml: (_event, rawPath) => getTokenLoginHtml({ requestPath: rawPath }),
|
|
2140
|
+
}),
|
|
2141
|
+
publicPaths,
|
|
2142
|
+
};
|
|
2103
2143
|
const guardFn = createAuthGuardFn();
|
|
2104
2144
|
_authGuardFn = guardFn;
|
|
2105
2145
|
app.use(defineEventHandler(guardFn));
|