@amoshydra/oktoso 0.1.4 → 0.1.6
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/README.md +10 -25
- package/dist/apps/even-g2/assets/index-mkmYJuX5.js +37 -0
- package/dist/apps/even-g2/index.html +21 -2
- package/dist/hub.js +41 -14
- package/dist/hub.js.map +1 -1
- package/dist/web/assets/{index-D2oQD3bO.js → index-CeSlSYL3.js} +2 -2
- package/dist/web/assets/{index-D2oQD3bO.js.map → index-CeSlSYL3.js.map} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/apps/even-g2/assets/index-CRXCF3g3.js +0 -35
package/dist/hub.js
CHANGED
|
@@ -21159,6 +21159,7 @@ var zAttentionSummary = external_exports.object({
|
|
|
21159
21159
|
var zAttention = external_exports.object({
|
|
21160
21160
|
id: external_exports.string(),
|
|
21161
21161
|
sessionRef: external_exports.string(),
|
|
21162
|
+
parentRef: external_exports.string().optional(),
|
|
21162
21163
|
type: zAttentionType,
|
|
21163
21164
|
priority: zAttentionPriority,
|
|
21164
21165
|
title: external_exports.string(),
|
|
@@ -21209,6 +21210,7 @@ var zSessionPage = external_exports.object({
|
|
|
21209
21210
|
});
|
|
21210
21211
|
var zSessionListQuery = external_exports.object({
|
|
21211
21212
|
provider: external_exports.string().optional(),
|
|
21213
|
+
scope: external_exports.enum(["all", "root"]).optional(),
|
|
21212
21214
|
status: zSessionStatus.optional(),
|
|
21213
21215
|
q: external_exports.string().optional(),
|
|
21214
21216
|
cursor: external_exports.string().optional(),
|
|
@@ -25855,6 +25857,7 @@ var SessionService = class {
|
|
|
25855
25857
|
const limit = clampLimit(query.limit);
|
|
25856
25858
|
const search = query.q?.trim().toLowerCase();
|
|
25857
25859
|
let data = [...this.sessions.values()];
|
|
25860
|
+
if (query.scope === "root") data = data.filter((session) => !session.parentRef);
|
|
25858
25861
|
if (query.provider) data = data.filter((session) => session.providerID === query.provider);
|
|
25859
25862
|
if (query.status) data = data.filter((session) => session.status === query.status);
|
|
25860
25863
|
if (search) {
|
|
@@ -26250,11 +26253,17 @@ var AttentionService = class {
|
|
|
26250
26253
|
}
|
|
26251
26254
|
}
|
|
26252
26255
|
}
|
|
26256
|
+
const blockingRefs = new Set(
|
|
26257
|
+
[...next.values()].filter(
|
|
26258
|
+
(item) => item.type === "permission" || item.type === "approval" || item.type === "question"
|
|
26259
|
+
).map((item) => item.sessionRef)
|
|
26260
|
+
);
|
|
26253
26261
|
const unreadSessions = sessionPage.data.filter(
|
|
26254
|
-
(session) => session.status !== "error" && session.unread && this.now() - session.updatedAt <= this.unreadWindowMs
|
|
26262
|
+
(session) => !session.parentRef && !blockingRefs.has(session.ref) && session.status !== "error" && session.unread && this.now() - session.updatedAt <= this.unreadWindowMs
|
|
26255
26263
|
).sort((left, right) => right.updatedAt - left.updatedAt).slice(0, this.maxUnread);
|
|
26256
26264
|
const unreadRefs = new Set(unreadSessions.map((session) => session.ref));
|
|
26257
26265
|
for (const session of sessionPage.data) {
|
|
26266
|
+
if (session.parentRef) continue;
|
|
26258
26267
|
if (session.status === "error") {
|
|
26259
26268
|
const item = {
|
|
26260
26269
|
id: `${session.providerID}:error:${session.nativeID}:${session.updatedAt}`,
|
|
@@ -26348,9 +26357,11 @@ var AttentionService = class {
|
|
|
26348
26357
|
}
|
|
26349
26358
|
enrichProviderItem(item, session) {
|
|
26350
26359
|
if (!session) return item;
|
|
26360
|
+
const parent = session.parentRef ? { parentRef: session.parentRef } : {};
|
|
26351
26361
|
if (item.type === "permission" || item.type === "approval") {
|
|
26352
26362
|
return {
|
|
26353
26363
|
...item,
|
|
26364
|
+
...parent,
|
|
26354
26365
|
title: session.title,
|
|
26355
26366
|
summary: item.summary || item.title
|
|
26356
26367
|
};
|
|
@@ -26358,11 +26369,12 @@ var AttentionService = class {
|
|
|
26358
26369
|
if (item.type === "question") {
|
|
26359
26370
|
return {
|
|
26360
26371
|
...item,
|
|
26372
|
+
...parent,
|
|
26361
26373
|
title: session.title,
|
|
26362
26374
|
summary: [item.title, item.summary].filter(Boolean).join(" \xB7 ")
|
|
26363
26375
|
};
|
|
26364
26376
|
}
|
|
26365
|
-
return item;
|
|
26377
|
+
return { ...item, ...parent };
|
|
26366
26378
|
}
|
|
26367
26379
|
async emitChanges(previous, next) {
|
|
26368
26380
|
for (const [id, item] of next) {
|
|
@@ -29444,7 +29456,7 @@ var IdempotencyService = class {
|
|
|
29444
29456
|
};
|
|
29445
29457
|
|
|
29446
29458
|
// package.json
|
|
29447
|
-
var version2 = "0.1.
|
|
29459
|
+
var version2 = "0.1.6";
|
|
29448
29460
|
|
|
29449
29461
|
// packages/hub/src/version.ts
|
|
29450
29462
|
var VERSION = version2;
|
|
@@ -29590,16 +29602,17 @@ function requestHost(c) {
|
|
|
29590
29602
|
}
|
|
29591
29603
|
function isSameOriginRequest(c) {
|
|
29592
29604
|
const origin = c.req.header("origin");
|
|
29605
|
+
const site = c.req.header("sec-fetch-site");
|
|
29593
29606
|
if (origin && origin !== "null") {
|
|
29594
29607
|
try {
|
|
29595
29608
|
const host = requestHost(c) ?? new URL(c.req.url).host;
|
|
29596
|
-
|
|
29609
|
+
if (new URL(origin).host === host) return true;
|
|
29597
29610
|
} catch {
|
|
29598
|
-
return false;
|
|
29599
29611
|
}
|
|
29612
|
+
return site === "same-origin" || site === "none";
|
|
29600
29613
|
}
|
|
29601
|
-
|
|
29602
|
-
return
|
|
29614
|
+
if (site) return site === "same-origin" || site === "none";
|
|
29615
|
+
return false;
|
|
29603
29616
|
}
|
|
29604
29617
|
|
|
29605
29618
|
// packages/hub/src/http/auth-cookie.ts
|
|
@@ -29944,12 +29957,13 @@ function registerPairRoutes(app, deps) {
|
|
|
29944
29957
|
});
|
|
29945
29958
|
app.post("/pair/:code", (c) => {
|
|
29946
29959
|
noStore2(c);
|
|
29947
|
-
if (
|
|
29948
|
-
|
|
29949
|
-
"
|
|
29950
|
-
|
|
29951
|
-
|
|
29952
|
-
|
|
29960
|
+
if (!isSameOriginRequest(c)) {
|
|
29961
|
+
c.get("logger").warn("pairing origin mismatch", {
|
|
29962
|
+
origin: c.req.header("origin") ?? null,
|
|
29963
|
+
host: requestHost(c) ?? null,
|
|
29964
|
+
forwardedHost: c.req.header("x-forwarded-host") ?? null,
|
|
29965
|
+
site: c.req.header("sec-fetch-site") ?? null
|
|
29966
|
+
});
|
|
29953
29967
|
}
|
|
29954
29968
|
const consumed = deps.auth.consumePairing(c.req.param("code"));
|
|
29955
29969
|
if (!consumed) {
|
|
@@ -30618,7 +30632,7 @@ function createApp(deps) {
|
|
|
30618
30632
|
app.onError((error62, c) => {
|
|
30619
30633
|
const requestId = c.get("requestId");
|
|
30620
30634
|
const logger = c.get("logger") ?? deps.logger;
|
|
30621
|
-
const appError =
|
|
30635
|
+
const appError = appErrorFor(error62);
|
|
30622
30636
|
logger.error("request failed", {
|
|
30623
30637
|
code: appError.code,
|
|
30624
30638
|
status: appError.status,
|
|
@@ -30640,6 +30654,19 @@ function createApp(deps) {
|
|
|
30640
30654
|
});
|
|
30641
30655
|
return app;
|
|
30642
30656
|
}
|
|
30657
|
+
function isTimeoutError(error62) {
|
|
30658
|
+
return error62 instanceof Error && (error62.name === "TimeoutError" || error62.name === "AbortError");
|
|
30659
|
+
}
|
|
30660
|
+
function appErrorFor(error62) {
|
|
30661
|
+
if (error62 instanceof AppError) return error62;
|
|
30662
|
+
if (error62 instanceof ProviderError) return providerAppError(error62);
|
|
30663
|
+
if (isTimeoutError(error62)) {
|
|
30664
|
+
return new AppError("timeout", "The hub request timed out", 504, {
|
|
30665
|
+
retryable: true
|
|
30666
|
+
});
|
|
30667
|
+
}
|
|
30668
|
+
return new AppError("internal", "Internal server error", 500);
|
|
30669
|
+
}
|
|
30643
30670
|
function providerAppError(error62) {
|
|
30644
30671
|
const status = error62.code === "not_found" ? 404 : error62.code === "conflict" ? 409 : error62.code === "rate_limited" ? 429 : error62.code === "invalid_request" ? 400 : error62.code === "unsupported" ? 501 : 502;
|
|
30645
30672
|
return new AppError(error62.code, error62.message, status, {
|