@columenlabs/lumen-ai 0.1.79 → 0.1.81
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.
|
@@ -11,7 +11,7 @@ export declare const CHATGPT_RESOURCE = "https://api.openai.com/v1";
|
|
|
11
11
|
export declare const CHATGPT_REDIRECT = "http://127.0.0.1:1455/auth/callback";
|
|
12
12
|
/** The app's registration with OpenAI for one person, kept across sign-outs. */
|
|
13
13
|
export interface ChatgptRegistration {
|
|
14
|
-
/**
|
|
14
|
+
/** This app's host id for this person (`urn:uuid:<uuid>`), the same on every sign-in. */
|
|
15
15
|
host_id: string;
|
|
16
16
|
/** The client id OpenAI issued on the first sign-in. */
|
|
17
17
|
client_id?: string;
|
|
@@ -21,6 +21,7 @@ const b64url = (bytes) => btoa(String.fromCharCode(...new Uint8Array(bytes)))
|
|
|
21
21
|
.replace(/\+/g, '-')
|
|
22
22
|
.replace(/\//g, '_')
|
|
23
23
|
.replace(/=+$/, '');
|
|
24
|
+
const HOST_ID = /^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
24
25
|
const random = (n = 32) => b64url(crypto.getRandomValues(new Uint8Array(n)));
|
|
25
26
|
export class SigninError extends Error {
|
|
26
27
|
}
|
|
@@ -28,7 +29,14 @@ export class SigninError extends Error {
|
|
|
28
29
|
export async function startChatgpt(reg, appName) {
|
|
29
30
|
const pending = { state: random(), nonce: random(), verifier: random(48), at: Date.now() };
|
|
30
31
|
const challenge = b64url(await crypto.subtle.digest('SHA-256', new TextEncoder().encode(pending.verifier)));
|
|
31
|
-
|
|
32
|
+
// OpenAI refuses any other host id shape (`invalid_authorize_request`, param ext_agent_host_id),
|
|
33
|
+
// so a registration made before this shape gets a new one; it never finished, so has no client id.
|
|
34
|
+
const kept = reg && HOST_ID.test(reg.host_id) ? reg : null;
|
|
35
|
+
const next = {
|
|
36
|
+
...kept,
|
|
37
|
+
host_id: kept?.host_id ?? `urn:uuid:${crypto.randomUUID()}`,
|
|
38
|
+
pending,
|
|
39
|
+
};
|
|
32
40
|
const q = new URLSearchParams({
|
|
33
41
|
client_id: next.client_id ?? 'dynamic_agent_client',
|
|
34
42
|
...(next.client_id ? {} : { agent_name_hint: appName }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@columenlabs/lumen-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.81",
|
|
4
4
|
"description": "Lumen's assistant and agent parts: a chat assistant's server (Claude tiers, tools over MCP, the web, hand off, spend caps), serving an MCP server from a Worker, read-only tool sets and metered tool calls.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -41,8 +41,8 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@anthropic-ai/sdk": "0.133.0",
|
|
44
|
-
"@columenlabs/lumen-ops": "0.1.
|
|
45
|
-
"@columenlabs/lumen-ui-types": "0.1.
|
|
44
|
+
"@columenlabs/lumen-ops": "0.1.81",
|
|
45
|
+
"@columenlabs/lumen-ui-types": "0.1.81",
|
|
46
46
|
"openai": "7.32.0",
|
|
47
47
|
"zod": "^4.3.6"
|
|
48
48
|
},
|