@opengeni/ogtool 2.0.1 → 2.0.2-canary.38789554071001
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/bin/ogtool.cjs +73 -14
- package/package.json +3 -3
package/dist/bin/ogtool.cjs
CHANGED
|
@@ -14389,7 +14389,8 @@ var Permission = /* @__PURE__ */ defineSchema(() => exports_external.enum([
|
|
|
14389
14389
|
|
|
14390
14390
|
// ../contracts/src/site-session-http.ts
|
|
14391
14391
|
var SITE_WORKSPACE_PREFIX = "/v1/workspaces/site-host";
|
|
14392
|
-
var SITE_DATA_PATH = /^\/v1\/workspaces\/site-host\/published-artifacts\/([^/]+)\/(?:data|files)(?:\/|$)/u;
|
|
14392
|
+
var SITE_DATA_PATH = /^\/v1\/workspaces\/site-host\/published-artifacts\/([^/]+)\/(?:data|files|sql)(?:\/|$)/u;
|
|
14393
|
+
var SITE_NO_ORIGIN_ID = "00000000-0000-0000-0000-000000000000";
|
|
14393
14394
|
class SiteSessionPathError extends Error {
|
|
14394
14395
|
code = "site_session_path_unsupported";
|
|
14395
14396
|
constructor() {
|
|
@@ -14405,31 +14406,89 @@ class SiteDataUnsupportedError extends Error {
|
|
|
14405
14406
|
this.name = "SiteDataUnsupportedError";
|
|
14406
14407
|
}
|
|
14407
14408
|
}
|
|
14408
|
-
function
|
|
14409
|
+
function unsafePathname(pathname) {
|
|
14410
|
+
return /[%\\#\u0000-\u0020\u007f]/u.test(pathname) || pathname.split("/").some((part) => part === "." || part === "..");
|
|
14411
|
+
}
|
|
14412
|
+
function hostWorkspacePath(path, workspaceId) {
|
|
14413
|
+
return path.replace("/workspaces/site-host", `/workspaces/${encodeURIComponent(workspaceId)}`);
|
|
14414
|
+
}
|
|
14415
|
+
function siteDataPath(path, rewritten, workspaceId, siteId) {
|
|
14416
|
+
if (workspaceId === "site-host")
|
|
14417
|
+
return path;
|
|
14418
|
+
if (!siteId)
|
|
14419
|
+
throw new SiteDataUnsupportedError;
|
|
14420
|
+
return rewritten.replace("/published-artifacts/current/", `/published-artifacts/${encodeURIComponent(siteId)}/`);
|
|
14421
|
+
}
|
|
14422
|
+
function siteHostWorkspacePath(path, workspaceId) {
|
|
14409
14423
|
const pathname = path.split("?")[0];
|
|
14410
14424
|
const workspace = pathname === SITE_WORKSPACE_PREFIX || pathname.startsWith(`${SITE_WORKSPACE_PREFIX}/`);
|
|
14411
|
-
|
|
14412
|
-
if (!workspace && !context || /[%\\#\u0000-\u0020\u007f]/u.test(pathname) || pathname.split("/").some((p) => p === "." || p === "..")) {
|
|
14425
|
+
if (!workspace && pathname !== "/v1/config/client" || unsafePathname(pathname))
|
|
14413
14426
|
throw new SiteSessionPathError;
|
|
14414
|
-
|
|
14415
|
-
const rewritten = path.replace("/workspaces/site-host", `/workspaces/${encodeURIComponent(workspaceId)}`);
|
|
14427
|
+
const rewritten = hostWorkspacePath(path, workspaceId);
|
|
14416
14428
|
const data = SITE_DATA_PATH.exec(pathname);
|
|
14417
14429
|
if (data) {
|
|
14418
14430
|
if (data[1] !== "current")
|
|
14419
14431
|
throw new SiteSessionPathError;
|
|
14420
|
-
|
|
14421
|
-
return path;
|
|
14422
|
-
if (!siteId)
|
|
14423
|
-
throw new SiteDataUnsupportedError;
|
|
14424
|
-
return rewritten.replace("/published-artifacts/current/", `/published-artifacts/${encodeURIComponent(siteId)}/`);
|
|
14432
|
+
return siteDataPath(path, rewritten, workspaceId);
|
|
14425
14433
|
}
|
|
14426
14434
|
const url2 = new URL(rewritten, "http://site.invalid");
|
|
14427
14435
|
if (url2.searchParams.get("originSiteId") === "current" && workspaceId !== "site-host") {
|
|
14428
|
-
url2.searchParams.set("originSiteId",
|
|
14436
|
+
url2.searchParams.set("originSiteId", SITE_NO_ORIGIN_ID);
|
|
14429
14437
|
return url2.pathname + url2.search;
|
|
14430
14438
|
}
|
|
14431
14439
|
return rewritten;
|
|
14432
14440
|
}
|
|
14441
|
+
var SITE_FRAME_MESSAGE_FIELDS = [
|
|
14442
|
+
"text",
|
|
14443
|
+
"annotations",
|
|
14444
|
+
"model",
|
|
14445
|
+
"reasoningEffort",
|
|
14446
|
+
"latencyMode",
|
|
14447
|
+
"controlEtag",
|
|
14448
|
+
"expectedDraftRevision"
|
|
14449
|
+
];
|
|
14450
|
+
var SITE_FRAME_BODY_FIELDS = Object.freeze({
|
|
14451
|
+
"sessions.send": ["type", "payload", "clientEventId"],
|
|
14452
|
+
"sessions.steer": [...SITE_FRAME_MESSAGE_FIELDS, "clientEventId"],
|
|
14453
|
+
"sessions.control": ["action", "reason", "clientEventId", "expectedControlEtag"],
|
|
14454
|
+
"sessions.composerDraft.put": [
|
|
14455
|
+
"text",
|
|
14456
|
+
"annotations",
|
|
14457
|
+
"resources",
|
|
14458
|
+
"model",
|
|
14459
|
+
"reasoningEffort",
|
|
14460
|
+
"latencyMode",
|
|
14461
|
+
"expectedRevision"
|
|
14462
|
+
],
|
|
14463
|
+
"sessions.composerDraft.submit": [
|
|
14464
|
+
...SITE_FRAME_MESSAGE_FIELDS,
|
|
14465
|
+
"resources",
|
|
14466
|
+
"connectionAccounts",
|
|
14467
|
+
"clientEventId",
|
|
14468
|
+
"delivery"
|
|
14469
|
+
],
|
|
14470
|
+
"sessions.queue.move": ["clientEventId", "expectedQueueVersion", "beforeTurnId"],
|
|
14471
|
+
"sessions.queue.edit": [
|
|
14472
|
+
"clientEventId",
|
|
14473
|
+
"expectedTurnVersion",
|
|
14474
|
+
"expectedDraftRevision",
|
|
14475
|
+
"replaceDraft"
|
|
14476
|
+
],
|
|
14477
|
+
"sessions.queue.steer": ["clientEventId", "expectedTurnVersion", "controlEtag"],
|
|
14478
|
+
"sessions.queue.delete": ["clientEventId", "expectedTurnVersion", "reason"]
|
|
14479
|
+
});
|
|
14480
|
+
var SITE_FRAME_EMPTY_ONLY_FIELDS = new Set(["resources", "connectionAccounts"]);
|
|
14481
|
+
var SITE_FRAME_SESSION_CREATE_FIELDS = Object.freeze([
|
|
14482
|
+
"initialMessage",
|
|
14483
|
+
"requestedSessionId",
|
|
14484
|
+
"idempotencyKey",
|
|
14485
|
+
"clientEventId",
|
|
14486
|
+
"model",
|
|
14487
|
+
"reasoningEffort",
|
|
14488
|
+
"latencyMode",
|
|
14489
|
+
"startMode",
|
|
14490
|
+
"metadata"
|
|
14491
|
+
]);
|
|
14433
14492
|
|
|
14434
14493
|
// ../contracts/src/tool-catalog.ts
|
|
14435
14494
|
var ATTEMPT_TOOL_CATALOG_VERSION = 1;
|
|
@@ -15365,7 +15424,7 @@ class CodemodeClient {
|
|
|
15365
15424
|
});
|
|
15366
15425
|
}
|
|
15367
15426
|
async sessionRequest(path, init) {
|
|
15368
|
-
|
|
15427
|
+
siteHostWorkspacePath(path, "site-host");
|
|
15369
15428
|
return this.request(`/sdk${path}`, init, false);
|
|
15370
15429
|
}
|
|
15371
15430
|
async request(path, init, throwOnError = true) {
|
|
@@ -15531,7 +15590,7 @@ async function abortableDelay(delayMs, signal) {
|
|
|
15531
15590
|
// package.json
|
|
15532
15591
|
var package_default = {
|
|
15533
15592
|
name: "@opengeni/ogtool",
|
|
15534
|
-
version: "2.0.
|
|
15593
|
+
version: "2.0.2-canary.38789554071001",
|
|
15535
15594
|
description: "Codemode CLI and typed client entrypoint for an Opengeni execution attempt.",
|
|
15536
15595
|
license: "Apache-2.0",
|
|
15537
15596
|
repository: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@opengeni/ogtool",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.2-canary.38789554071001",
|
|
4
4
|
"description": "Codemode CLI and typed client entrypoint for an Opengeni execution attempt.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -37,8 +37,8 @@
|
|
|
37
37
|
"prepublishOnly": "bash ../../scripts/prepublish-guard"
|
|
38
38
|
},
|
|
39
39
|
"dependencies": {
|
|
40
|
-
"@opengeni/codemode": "2.0.
|
|
41
|
-
"@opengeni/contracts": "2.0.
|
|
40
|
+
"@opengeni/codemode": "2.0.2-canary.38789554071001",
|
|
41
|
+
"@opengeni/contracts": "2.0.2-canary.38789554071001"
|
|
42
42
|
},
|
|
43
43
|
"engines": {
|
|
44
44
|
"node": ">=18"
|