@arcadialdev/arcality 4.1.1 → 4.1.3
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/package.json
CHANGED
package/scripts/gen-and-run.mjs
CHANGED
|
@@ -657,6 +657,23 @@ async function waitForEnter(message = 'Presiona Enter para continuar...', option
|
|
|
657
657
|
});
|
|
658
658
|
}
|
|
659
659
|
|
|
660
|
+
function getSingleEmptyQueryParamName(urlString) {
|
|
661
|
+
if (!urlString) return null;
|
|
662
|
+
|
|
663
|
+
try {
|
|
664
|
+
const parsed = new URL(String(urlString));
|
|
665
|
+
const emptyParams = [];
|
|
666
|
+
|
|
667
|
+
for (const [key, value] of parsed.searchParams.entries()) {
|
|
668
|
+
if (!String(value || '').trim()) emptyParams.push(key);
|
|
669
|
+
}
|
|
670
|
+
|
|
671
|
+
return emptyParams.length === 1 ? emptyParams[0] : null;
|
|
672
|
+
} catch {
|
|
673
|
+
return null;
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
|
|
660
677
|
function getMissionStartPath(missionSpec, collectionMeta = null, fallbackPath = '') {
|
|
661
678
|
return missionSpec.startAt || missionSpec.page || missionSpec.pagePath || collectionMeta?.defaultPagePath || fallbackPath;
|
|
662
679
|
}
|
|
@@ -1322,7 +1339,7 @@ async function arcalityChat(messages) {
|
|
|
1322
1339
|
system: systemMessage ? systemMessage.content : undefined,
|
|
1323
1340
|
messages: userMessages,
|
|
1324
1341
|
max_tokens: 4000,
|
|
1325
|
-
temperature: 0.3
|
|
1342
|
+
...(!isProxyMode ? { temperature: 0.3 } : {})
|
|
1326
1343
|
})
|
|
1327
1344
|
});
|
|
1328
1345
|
|
|
@@ -1909,8 +1926,9 @@ async function main() {
|
|
|
1909
1926
|
|
|
1910
1927
|
if (!discoverPath) {
|
|
1911
1928
|
const knownBaseUrl = projectConfig?.project?.baseUrl || process.env.BASE_URL;
|
|
1929
|
+
const emptyQueryParamName = getSingleEmptyQueryParamName(knownBaseUrl);
|
|
1912
1930
|
const promptMsg = knownBaseUrl
|
|
1913
|
-
? `🌐 URL Completa de Navegación (relative to ${knownBaseUrl}):`
|
|
1931
|
+
? `🌐 URL Completa de Navegación (relative to ${knownBaseUrl}). Deja vacío para usarla tal cual${emptyQueryParamName ? ` o escribe solo el valor de "${emptyQueryParamName}"` : ''}:`
|
|
1914
1932
|
: '🌐 URL Completa de Navegación (ej., http://localhost:3000/):';
|
|
1915
1933
|
|
|
1916
1934
|
const d = await text({
|
|
@@ -1929,7 +1947,7 @@ async function main() {
|
|
|
1929
1947
|
skipMenu = false;
|
|
1930
1948
|
continue;
|
|
1931
1949
|
}
|
|
1932
|
-
discoverPath = d;
|
|
1950
|
+
discoverPath = typeof d === 'string' ? d.trim() : d;
|
|
1933
1951
|
}
|
|
1934
1952
|
}
|
|
1935
1953
|
|
|
@@ -2080,7 +2098,11 @@ async function main() {
|
|
|
2080
2098
|
}
|
|
2081
2099
|
|
|
2082
2100
|
// ── Start Mission ──
|
|
2083
|
-
const
|
|
2101
|
+
const effectiveBaseUrl = projectConfig?.project?.baseUrl || dotEnv.BASE_URL || process.env.BASE_URL || '';
|
|
2102
|
+
const missionTargetUrl = discoverPath === '' && effectiveBaseUrl
|
|
2103
|
+
? effectiveBaseUrl
|
|
2104
|
+
: (discoverPath || '/');
|
|
2105
|
+
const mission = await requestMission(prompt, missionTargetUrl);
|
|
2084
2106
|
if (!mission.allowed) {
|
|
2085
2107
|
if (mission.error === 'mission_limit_exceeded') {
|
|
2086
2108
|
note(
|
|
@@ -2235,7 +2257,7 @@ async function main() {
|
|
|
2235
2257
|
CONTEXT_DIR: process.env.CONTEXT_DIR,
|
|
2236
2258
|
REPORTS_DIR: process.env.REPORTS_DIR,
|
|
2237
2259
|
SMART_PROMPT: prompt,
|
|
2238
|
-
TARGET_PATH: discoverPath
|
|
2260
|
+
TARGET_PATH: discoverPath ?? '/',
|
|
2239
2261
|
ARCALITY_DB_VALIDATIONS_JSON: missionDbValidations.length > 0 ? JSON.stringify(missionDbValidations) : (process.env.ARCALITY_DB_VALIDATIONS_JSON || process.env.ARCALITY_DB_VALIDATIONS || '')
|
|
2240
2262
|
};
|
|
2241
2263
|
|
|
@@ -2711,4 +2733,4 @@ async function main() {
|
|
|
2711
2733
|
main().catch(err => {
|
|
2712
2734
|
console.error(err);
|
|
2713
2735
|
process.exit(1);
|
|
2714
|
-
});
|
|
2736
|
+
});
|
|
@@ -3646,7 +3646,7 @@ ${relevantFailures.map((m) => `- ${m.prompt}`).join("\n")}
|
|
|
3646
3646
|
${JSON.stringify(diagnosticPayload, null, 2)}`
|
|
3647
3647
|
}
|
|
3648
3648
|
],
|
|
3649
|
-
temperature: 0
|
|
3649
|
+
...!isProxyMode ? { temperature: 0 } : {}
|
|
3650
3650
|
})
|
|
3651
3651
|
});
|
|
3652
3652
|
if (!response.ok)
|
|
@@ -4268,7 +4268,7 @@ ${history.slice(-25).join("\n") || "None"}`
|
|
|
4268
4268
|
system: systemPromptBlocks,
|
|
4269
4269
|
tools: anthropicTools,
|
|
4270
4270
|
messages: anthropicMessages,
|
|
4271
|
-
temperature: 0.2
|
|
4271
|
+
...!isProxyMode ? { temperature: 0.2 } : {}
|
|
4272
4272
|
})
|
|
4273
4273
|
});
|
|
4274
4274
|
} catch (fetchErr) {
|
|
@@ -5171,7 +5171,7 @@ Starting URL: ${startUrl}
|
|
|
5171
5171
|
Execution history:
|
|
5172
5172
|
${historyStr}` }
|
|
5173
5173
|
],
|
|
5174
|
-
temperature: 0.1
|
|
5174
|
+
...!isProxyMode ? { temperature: 0.1 } : {}
|
|
5175
5175
|
})
|
|
5176
5176
|
});
|
|
5177
5177
|
const data = await response.json();
|
|
@@ -5350,6 +5350,25 @@ async function readHiddenPortalResult(page) {
|
|
|
5350
5350
|
}
|
|
5351
5351
|
return null;
|
|
5352
5352
|
}
|
|
5353
|
+
function tryResolveQueryParamValue(baseUrl, targetPath) {
|
|
5354
|
+
const normalizedTarget = targetPath.trim();
|
|
5355
|
+
if (!normalizedTarget || /[/?#&=]/.test(normalizedTarget))
|
|
5356
|
+
return null;
|
|
5357
|
+
try {
|
|
5358
|
+
const parsedBase = new URL(baseUrl);
|
|
5359
|
+
const emptyParams = [];
|
|
5360
|
+
for (const [key, value] of parsedBase.searchParams.entries()) {
|
|
5361
|
+
if (!String(value || "").trim())
|
|
5362
|
+
emptyParams.push(key);
|
|
5363
|
+
}
|
|
5364
|
+
if (emptyParams.length !== 1)
|
|
5365
|
+
return null;
|
|
5366
|
+
parsedBase.searchParams.set(emptyParams[0], normalizedTarget);
|
|
5367
|
+
return parsedBase.toString();
|
|
5368
|
+
} catch {
|
|
5369
|
+
return null;
|
|
5370
|
+
}
|
|
5371
|
+
}
|
|
5353
5372
|
function resolveTargetUrl(baseUrl, currentUrl, targetPath) {
|
|
5354
5373
|
if (!targetPath)
|
|
5355
5374
|
return currentUrl || baseUrl;
|
|
@@ -5363,6 +5382,9 @@ function resolveTargetUrl(baseUrl, currentUrl, targetPath) {
|
|
|
5363
5382
|
if (normalizedTarget.startsWith("?") || normalizedTarget.startsWith("#")) {
|
|
5364
5383
|
return new URL(normalizedTarget, parsedReference).toString();
|
|
5365
5384
|
}
|
|
5385
|
+
const queryParamUrl = tryResolveQueryParamValue(parsedBase.toString(), normalizedTarget);
|
|
5386
|
+
if (queryParamUrl)
|
|
5387
|
+
return queryParamUrl;
|
|
5366
5388
|
if (normalizedTarget.startsWith("/")) {
|
|
5367
5389
|
const targetAlreadyIncludesBase = basePath && (normalizedTarget === basePath || normalizedTarget.startsWith(`${basePath}/`));
|
|
5368
5390
|
const combinedPath = targetAlreadyIncludesBase ? normalizedTarget : `${basePath}${normalizedTarget}`.replace(/\/{2,}/g, "/");
|
|
@@ -5763,7 +5785,7 @@ function writeBatchMissionResult(payload) {
|
|
|
5763
5785
|
console.log(`
|
|
5764
5786
|
\u{1F916} [ARCALITY] Iniciando misi\xF3n: "${prompt}"`);
|
|
5765
5787
|
const base = process.env.BASE_URL || "";
|
|
5766
|
-
const target = process.env.TARGET_PATH
|
|
5788
|
+
const target = process.env.TARGET_PATH ?? "/";
|
|
5767
5789
|
if (process.env.LOGIN_USER && process.env.LOGIN_PASSWORD) {
|
|
5768
5790
|
console.log(">>ARCALITY_STATUS>> \u{1F511} Realizando login autom\xE1tico...");
|
|
5769
5791
|
const loginUrl = base + "/login";
|