@konneal/engine 0.2.6 → 0.2.7
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/{ask-RX3W5JJW.js → ask-6V6AJG2V.js} +2 -2
- package/dist/{chunk-GCL73ZLT.js → chunk-7UT76RQO.js} +11 -1
- package/dist/{chunk-7K5XP4PB.js → chunk-LWEVSMH6.js} +1 -1
- package/dist/{chunk-NRC4FBDQ.js → chunk-YFDWKXEB.js} +1 -1
- package/dist/oidc.d.ts +3 -0
- package/dist/{search-OXHXXT5S.js → search-RFKT7ZZY.js} +2 -2
- package/dist/worker_public/src/index.js +5 -5
- package/package.json +1 -1
- package/workers/worker_public/src/auth.ts +11 -0
- package/workers/worker_public/src/index.ts +1 -1
- package/workers/worker_public/src/oidc.ts +4 -0
|
@@ -2294,6 +2294,7 @@ function buildAuthorizationUrl(metadata, params) {
|
|
|
2294
2294
|
url.searchParams.set("nonce", params.nonce);
|
|
2295
2295
|
url.searchParams.set("code_challenge", params.codeChallenge);
|
|
2296
2296
|
url.searchParams.set("code_challenge_method", "S256");
|
|
2297
|
+
if (params.prompt) url.searchParams.set("prompt", params.prompt);
|
|
2297
2298
|
return url.toString();
|
|
2298
2299
|
}
|
|
2299
2300
|
async function exchangeCode(metadata, params) {
|
|
@@ -2473,13 +2474,19 @@ async function handleLogin(env, req) {
|
|
|
2473
2474
|
expirationTtl: 600
|
|
2474
2475
|
}
|
|
2475
2476
|
);
|
|
2477
|
+
const silent = url0.searchParams.get("prompt") === "none";
|
|
2476
2478
|
const url = buildAuthorizationUrl(meta, {
|
|
2477
2479
|
clientId: cfg.clientId,
|
|
2478
2480
|
redirectUri: cfg.redirectUri,
|
|
2479
2481
|
scopes: "openid profile email roles",
|
|
2480
2482
|
state,
|
|
2481
2483
|
nonce,
|
|
2482
|
-
codeChallenge: pkce.challenge
|
|
2484
|
+
codeChallenge: pkce.challenge,
|
|
2485
|
+
// silent SSO: the OP answers from its existing session or errors
|
|
2486
|
+
// login_required — the callback then lands quietly, signed in or
|
|
2487
|
+
// still anonymous, and the estate session carries to this site
|
|
2488
|
+
// without a click
|
|
2489
|
+
...silent ? { prompt: "none" } : {}
|
|
2483
2490
|
});
|
|
2484
2491
|
return new Response(null, { status: 302, headers: { location: url } });
|
|
2485
2492
|
} catch (e) {
|
|
@@ -2491,6 +2498,9 @@ async function handleCallback(env, req) {
|
|
|
2491
2498
|
if (!cfg) return redirectWithError("not_configured");
|
|
2492
2499
|
const url = new URL(req.url);
|
|
2493
2500
|
const opError = url.searchParams.get("error");
|
|
2501
|
+
if (opError === "login_required") {
|
|
2502
|
+
return new Response(null, { status: 302, headers: { location: "/?auth_silent=none" } });
|
|
2503
|
+
}
|
|
2494
2504
|
if (opError) {
|
|
2495
2505
|
const msg = opError === "access_denied" ? "Sign-in was cancelled." : opError === "temporarily_unavailable" ? "The sign-in service is busy. Please try again in a moment." : "The sign-in service reported a problem. Please try again.";
|
|
2496
2506
|
return new Response(null, {
|
package/dist/oidc.d.ts
CHANGED
|
@@ -30,6 +30,9 @@ export declare function buildAuthorizationUrl(metadata: OidcMetadata, params: {
|
|
|
30
30
|
state: string;
|
|
31
31
|
nonce: string;
|
|
32
32
|
codeChallenge: string;
|
|
33
|
+
/** OIDC prompt ('none' = silent: the OP answers from its session or
|
|
34
|
+
* errors login_required — never an interaction). */
|
|
35
|
+
prompt?: string;
|
|
33
36
|
}): string;
|
|
34
37
|
export interface OidcTokenResponse {
|
|
35
38
|
id_token: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
handleSearch
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-YFDWKXEB.js";
|
|
4
4
|
import {
|
|
5
5
|
checkQuoteAnchors,
|
|
6
6
|
handleAsk,
|
|
7
7
|
handleMemories,
|
|
8
8
|
scoreJudge,
|
|
9
9
|
standardForDocNumber
|
|
10
|
-
} from "../../chunk-
|
|
10
|
+
} from "../../chunk-LWEVSMH6.js";
|
|
11
11
|
import {
|
|
12
12
|
buildMessages,
|
|
13
13
|
citations,
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
sessionFrom,
|
|
30
30
|
telemetry,
|
|
31
31
|
understandQuery
|
|
32
|
-
} from "../../chunk-
|
|
32
|
+
} from "../../chunk-7UT76RQO.js";
|
|
33
33
|
import {
|
|
34
34
|
authenticate,
|
|
35
35
|
corsHeaders,
|
|
@@ -979,7 +979,7 @@ async function handleMcp(env, ctx, req, tier, key) {
|
|
|
979
979
|
// stream:false forces the JSON lane (anon defaults to SSE)
|
|
980
980
|
body: JSON.stringify({ ...args, stream: false })
|
|
981
981
|
});
|
|
982
|
-
const res = name === "ask" ? await (await import("../../ask-
|
|
982
|
+
const res = name === "ask" ? await (await import("../../ask-6V6AJG2V.js")).handleAsk(env, ctx, inner, tier, key) : await (await import("../../search-RFKT7ZZY.js")).handleSearch(env, ctx, inner, tier, key);
|
|
983
983
|
return res.json().catch(() => ({ error: { message: "tool transport failed", status: res.status } }));
|
|
984
984
|
});
|
|
985
985
|
if (out.ok && "accepted" in out) return new Response(null, { status: 202 });
|
|
@@ -1602,7 +1602,7 @@ function permissionsCatalog() {
|
|
|
1602
1602
|
perms.push({ id: "ai.memories", description: "Personalized memory files on the assistant" });
|
|
1603
1603
|
perms.push({ id: "ai.research", description: "Deep-research multi-pass questions" });
|
|
1604
1604
|
perms.push({ id: "ai.keys.admin", description: "Create and revoke API keys" });
|
|
1605
|
-
groups.push({ id: "ai", description:
|
|
1605
|
+
groups.push({ id: "ai", description: `${P().publisher.product_name} gated capabilities`, permissions: perms });
|
|
1606
1606
|
return {
|
|
1607
1607
|
version: 1,
|
|
1608
1608
|
verbs: ["read", "write", "admin"],
|
package/package.json
CHANGED
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"@oimlsmart/oiml-pubid": "^1.2.1"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {},
|
|
37
|
-
"version": "0.2.
|
|
37
|
+
"version": "0.2.7",
|
|
38
38
|
"description": "The Konneal engine: the publisher-agnostic build pipeline and API plane for standards intelligence (retrieval, answer contract, verdicts, evaluation).",
|
|
39
39
|
"license": "BSD-3-Clause",
|
|
40
40
|
"type": "module",
|
|
@@ -85,6 +85,7 @@ export async function handleLogin(env: any, req: Request): Promise<Response> {
|
|
|
85
85
|
expirationTtl: 600,
|
|
86
86
|
},
|
|
87
87
|
);
|
|
88
|
+
const silent = url0.searchParams.get("prompt") === "none";
|
|
88
89
|
const url = buildAuthorizationUrl(meta, {
|
|
89
90
|
clientId: cfg.clientId,
|
|
90
91
|
redirectUri: cfg.redirectUri,
|
|
@@ -92,6 +93,11 @@ export async function handleLogin(env: any, req: Request): Promise<Response> {
|
|
|
92
93
|
state,
|
|
93
94
|
nonce,
|
|
94
95
|
codeChallenge: pkce.challenge,
|
|
96
|
+
// silent SSO: the OP answers from its existing session or errors
|
|
97
|
+
// login_required — the callback then lands quietly, signed in or
|
|
98
|
+
// still anonymous, and the estate session carries to this site
|
|
99
|
+
// without a click
|
|
100
|
+
...(silent ? { prompt: "none" } : {}),
|
|
95
101
|
});
|
|
96
102
|
return new Response(null, { status: 302, headers: { location: url } });
|
|
97
103
|
} catch (e) {
|
|
@@ -104,6 +110,11 @@ export async function handleCallback(env: any, req: Request): Promise<Response>
|
|
|
104
110
|
if (!cfg) return redirectWithError("not_configured");
|
|
105
111
|
const url = new URL(req.url);
|
|
106
112
|
const opError = url.searchParams.get("error");
|
|
113
|
+
if (opError === "login_required") {
|
|
114
|
+
// the silent probe found no OP session — anonymous is the honest
|
|
115
|
+
// state, never an error
|
|
116
|
+
return new Response(null, { status: 302, headers: { location: "/?auth_silent=none" } });
|
|
117
|
+
}
|
|
107
118
|
if (opError) {
|
|
108
119
|
// the OP redirected back with its own failure (user denied consent,
|
|
109
120
|
// session expired at the OP, …) — fail closed, in plain language
|
|
@@ -421,7 +421,7 @@ function permissionsCatalog(): Record<string, unknown> {
|
|
|
421
421
|
perms.push({ id: "ai.memories", description: "Personalized memory files on the assistant" });
|
|
422
422
|
perms.push({ id: "ai.research", description: "Deep-research multi-pass questions" });
|
|
423
423
|
perms.push({ id: "ai.keys.admin", description: "Create and revoke API keys" });
|
|
424
|
-
groups.push({ id: "ai", description:
|
|
424
|
+
groups.push({ id: "ai", description: `${P().publisher.product_name} gated capabilities`, permissions: perms });
|
|
425
425
|
return {
|
|
426
426
|
version: 1,
|
|
427
427
|
verbs: ["read", "write", "admin"],
|
|
@@ -131,6 +131,9 @@ export function buildAuthorizationUrl(
|
|
|
131
131
|
state: string;
|
|
132
132
|
nonce: string;
|
|
133
133
|
codeChallenge: string;
|
|
134
|
+
/** OIDC prompt ('none' = silent: the OP answers from its session or
|
|
135
|
+
* errors login_required — never an interaction). */
|
|
136
|
+
prompt?: string;
|
|
134
137
|
},
|
|
135
138
|
): string {
|
|
136
139
|
const url = new URL(metadata.authorization_endpoint);
|
|
@@ -142,6 +145,7 @@ export function buildAuthorizationUrl(
|
|
|
142
145
|
url.searchParams.set("nonce", params.nonce);
|
|
143
146
|
url.searchParams.set("code_challenge", params.codeChallenge);
|
|
144
147
|
url.searchParams.set("code_challenge_method", "S256");
|
|
148
|
+
if (params.prompt) url.searchParams.set("prompt", params.prompt);
|
|
145
149
|
return url.toString();
|
|
146
150
|
}
|
|
147
151
|
|