agent-pager 0.1.0 → 0.1.1
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 +35 -129
- package/dist/src/cli.js +6 -4
- package/dist/src/local-config.js +1 -1
- package/dist/src/mcp.js +1 -1
- package/package.json +13 -9
- package/web/app.js +11 -2
- package/web/index.html +4 -4
- package/dist/src/hosted-http.js +0 -849
- package/dist/src/hosted-service.js +0 -1038
- package/dist/src/hosted-vercel.js +0 -51
- package/dist/src/supabase.js +0 -32
- package/dist/src/supabase.types.js +0 -13
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
import { createHostedHttpHandlerFromEnv } from "./hosted-http.js";
|
|
2
|
-
let cachedHandler;
|
|
3
|
-
export async function handleVercelNodeRequest(req, res) {
|
|
4
|
-
try {
|
|
5
|
-
const handler = cachedHandler || (cachedHandler = createHostedHttpHandlerFromEnv());
|
|
6
|
-
const bodyText = await readBody(req);
|
|
7
|
-
const request = new Request(requestUrl(req), {
|
|
8
|
-
method: req.method || "GET",
|
|
9
|
-
headers: headersFromIncoming(req.headers),
|
|
10
|
-
body: allowsBody(req.method || "GET") ? bodyText : undefined
|
|
11
|
-
});
|
|
12
|
-
const response = await handler.handle(request);
|
|
13
|
-
res.statusCode = response.status;
|
|
14
|
-
response.headers.forEach((value, key) => res.setHeader(key, value));
|
|
15
|
-
res.end(Buffer.from(await response.arrayBuffer()));
|
|
16
|
-
}
|
|
17
|
-
catch (error) {
|
|
18
|
-
res.statusCode = 500;
|
|
19
|
-
res.setHeader("content-type", "application/json; charset=utf-8");
|
|
20
|
-
res.end(JSON.stringify({ error: error instanceof Error ? error.message : "request failed" }));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
function requestUrl(req) {
|
|
24
|
-
const host = req.headers.host || "localhost";
|
|
25
|
-
const forwardedProto = req.headers["x-forwarded-proto"];
|
|
26
|
-
const proto = Array.isArray(forwardedProto) ? forwardedProto[0] : forwardedProto || "https";
|
|
27
|
-
return new URL(req.url || "/", `${proto}://${host}`).toString();
|
|
28
|
-
}
|
|
29
|
-
function headersFromIncoming(headers) {
|
|
30
|
-
const out = new Headers();
|
|
31
|
-
for (const [key, value] of Object.entries(headers)) {
|
|
32
|
-
if (Array.isArray(value)) {
|
|
33
|
-
for (const child of value)
|
|
34
|
-
out.append(key, child);
|
|
35
|
-
}
|
|
36
|
-
else if (value !== undefined) {
|
|
37
|
-
out.set(key, value);
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
return out;
|
|
41
|
-
}
|
|
42
|
-
async function readBody(req) {
|
|
43
|
-
const chunks = [];
|
|
44
|
-
for await (const chunk of req) {
|
|
45
|
-
chunks.push(Buffer.isBuffer(chunk) ? chunk : Buffer.from(chunk));
|
|
46
|
-
}
|
|
47
|
-
return Buffer.concat(chunks).toString("utf8");
|
|
48
|
-
}
|
|
49
|
-
function allowsBody(method) {
|
|
50
|
-
return !["GET", "HEAD"].includes(method.toUpperCase());
|
|
51
|
-
}
|
package/dist/src/supabase.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { createClient } from "@supabase/supabase-js";
|
|
2
|
-
export function loadSupabaseRuntimeConfig(env = process.env) {
|
|
3
|
-
const url = env.NEXT_PUBLIC_SUPABASE_URL || env.SUPABASE_URL || "";
|
|
4
|
-
const anonKey = env.NEXT_PUBLIC_SUPABASE_ANON_KEY || env.SUPABASE_ANON_KEY || "";
|
|
5
|
-
if (!url || !anonKey) {
|
|
6
|
-
throw new Error("Missing NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY.");
|
|
7
|
-
}
|
|
8
|
-
return {
|
|
9
|
-
url,
|
|
10
|
-
anonKey,
|
|
11
|
-
serviceRoleKey: env.SUPABASE_SERVICE_ROLE_KEY
|
|
12
|
-
};
|
|
13
|
-
}
|
|
14
|
-
export function createSupabaseUserClient(config = loadSupabaseRuntimeConfig()) {
|
|
15
|
-
return createClient(config.url, config.anonKey, {
|
|
16
|
-
auth: {
|
|
17
|
-
persistSession: false,
|
|
18
|
-
autoRefreshToken: false
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
export function createSupabaseServiceClient(config = loadSupabaseRuntimeConfig()) {
|
|
23
|
-
if (!config.serviceRoleKey) {
|
|
24
|
-
throw new Error("Missing SUPABASE_SERVICE_ROLE_KEY.");
|
|
25
|
-
}
|
|
26
|
-
return createClient(config.url, config.serviceRoleKey, {
|
|
27
|
-
auth: {
|
|
28
|
-
persistSession: false,
|
|
29
|
-
autoRefreshToken: false
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export const Constants = {
|
|
2
|
-
graphql_public: {
|
|
3
|
-
Enums: {},
|
|
4
|
-
},
|
|
5
|
-
public: {
|
|
6
|
-
Enums: {
|
|
7
|
-
delivery_status: ["pending", "delivered", "acked", "failed"],
|
|
8
|
-
friend_request_status: ["pending", "approved", "denied", "canceled"],
|
|
9
|
-
page_urgency: ["gentle", "normal", "firm", "professionally-dramatic"],
|
|
10
|
-
user_status: ["online", "busy", "muted", "offline"],
|
|
11
|
-
},
|
|
12
|
-
},
|
|
13
|
-
};
|