@myrialabs/clopen 0.4.39 → 0.4.41
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/.env.example +1 -1
- package/backend/artifacts/detect.ts +15 -3
- package/backend/artifacts/generate.ts +2 -2
- package/backend/artifacts/index.ts +12 -4
- package/backend/artifacts/markers.ts +24 -1
- package/backend/artifacts/matrix.ts +47 -3
- package/backend/artifacts/sync.test.ts +3 -3
- package/backend/artifacts/sync.ts +8 -20
- package/backend/artifacts/types.ts +9 -3
- package/backend/auth/permissions.ts +29 -11
- package/backend/auth/session-cleanup.ts +10 -1
- package/backend/auth/tokens.ts +9 -1
- package/backend/chat/stream-manager.ts +42 -0
- package/backend/database/crypto/secret-columns.ts +5 -1
- package/backend/database/migrations/078_create_worktree_branch_tables.ts +158 -0
- package/backend/database/migrations/079_merge_commands_into_skills.ts +222 -0
- package/backend/database/migrations/080_create_file_shares.ts +111 -0
- package/backend/database/migrations/081_create_push_subscriptions.ts +32 -0
- package/backend/database/migrations/index.ts +28 -0
- package/backend/database/queries/file-share-queries.ts +163 -0
- package/backend/database/queries/index.ts +12 -4
- package/backend/database/queries/profile-queries.ts +5 -3
- package/backend/database/queries/push-subscription-queries.test.ts +90 -0
- package/backend/database/queries/push-subscription-queries.ts +99 -0
- package/backend/database/queries/skill-queries.ts +96 -18
- package/backend/database/queries/worktree-branch-queries.ts +331 -0
- package/backend/db-client/cloning.test.ts +161 -0
- package/backend/db-client/cloning.ts +672 -0
- package/backend/db-client/connection-url.test.ts +117 -0
- package/backend/db-client/connection-url.ts +126 -0
- package/backend/db-client/drivers/mongodb.ts +2 -14
- package/backend/db-client/drivers/mysql.ts +2 -8
- package/backend/db-client/drivers/postgres.ts +10 -13
- package/backend/db-client/drivers/redis.ts +2 -6
- package/backend/db-client/env/detect.ts +438 -0
- package/backend/db-client/env/diff.ts +94 -0
- package/backend/db-client/env/env.test.ts +574 -0
- package/backend/db-client/env/index.ts +15 -0
- package/backend/db-client/env/naming.ts +202 -0
- package/backend/db-client/env/service.ts +487 -0
- package/backend/db-client/integrations/index.ts +7 -0
- package/backend/db-client/integrations/links.ts +41 -10
- package/backend/db-client/providers/neon/adapter.ts +522 -0
- package/backend/db-client/providers/neon/api-types.ts +182 -0
- package/backend/db-client/providers/neon/client.ts +298 -0
- package/backend/db-client/providers/neon/endpoints.test.ts +201 -0
- package/backend/db-client/providers/neon/endpoints.ts +314 -0
- package/backend/db-client/providers/neon/list.test.ts +181 -0
- package/backend/db-client/providers/supabase/adapter.ts +25 -2
- package/backend/db-client/providers/types.ts +57 -0
- package/backend/engine/adapters/claude/stream.ts +2 -1
- package/backend/engine/adapters/cline/stream.ts +3 -3
- package/backend/engine/adapters/codex/stream.ts +3 -3
- package/backend/engine/adapters/copilot/stream.ts +3 -3
- package/backend/engine/adapters/cursor/stream.ts +25 -3
- package/backend/engine/adapters/opencode/stream.ts +4 -6
- package/backend/engine/adapters/pi/stream.ts +2 -2
- package/backend/engine/adapters/qwen/stream.ts +2 -2
- package/backend/engine/artifact-sync.ts +26 -20
- package/backend/engine/docs/artifacts.md +81 -22
- package/backend/engine/docs/quick-reference.md +2 -1
- package/backend/engine/resolve-model.test.ts +108 -0
- package/backend/engine/resolve-model.ts +53 -10
- package/backend/engine/structured-helpers.ts +22 -0
- package/backend/env-files/discovery.ts +48 -0
- package/backend/env-files/edit.ts +213 -0
- package/backend/env-files/env-files.test.ts +515 -0
- package/backend/env-files/git.ts +27 -0
- package/backend/env-files/index.ts +44 -0
- package/backend/env-files/keys.ts +69 -0
- package/backend/env-files/parse.ts +157 -0
- package/backend/env-files/write.ts +229 -0
- package/backend/files/file-shares.ts +369 -0
- package/backend/files/path-browsing.ts +27 -21
- package/backend/http/files-shared.test.ts +505 -0
- package/backend/http/files-shared.ts +351 -0
- package/backend/http/push.ts +150 -0
- package/backend/index.ts +8 -0
- package/backend/instructions/index.ts +1 -1
- package/backend/instructions/sync.ts +30 -6
- package/backend/integrations/health.ts +18 -4
- package/backend/integrations/projections/types.ts +9 -2
- package/backend/integrations/registry/index.ts +3 -0
- package/backend/integrations/registry/providers/context7.ts +1 -0
- package/backend/integrations/registry/providers/firecrawl.ts +1 -0
- package/backend/integrations/registry/providers/github.ts +1 -0
- package/backend/integrations/registry/providers/neon.ts +55 -0
- package/backend/integrations/registry/providers/supabase.ts +1 -0
- package/backend/integrations/registry/providers/vercel.ts +1 -0
- package/backend/integrations/registry/types.ts +2 -0
- package/backend/memory/compose.ts +2 -2
- package/backend/memory/consolidate.ts +2 -2
- package/backend/memory/extract/episodic.ts +2 -2
- package/backend/memory/judge.ts +2 -2
- package/backend/profiles/service.ts +7 -6
- package/backend/push/sender.ts +172 -0
- package/backend/push/tags.ts +25 -0
- package/backend/push/vapid-keys.ts +77 -0
- package/backend/push/webpush-crypto.test.ts +200 -0
- package/backend/push/webpush-crypto.ts +231 -0
- package/backend/skills/detect.ts +28 -0
- package/backend/skills/index.ts +22 -4
- package/backend/skills/invoke.test.ts +114 -0
- package/backend/skills/invoke.ts +222 -0
- package/backend/skills/service.ts +194 -44
- package/backend/skills/spec.ts +35 -0
- package/backend/skills/sync.ts +85 -55
- package/backend/subagents/detect.ts +2 -3
- package/backend/subagents/sync.ts +15 -8
- package/backend/work/pull-requests.ts +2 -2
- package/backend/work/start-work.ts +4 -0
- package/backend/worktrees/branching/engine.ts +557 -0
- package/backend/worktrees/branching/index.ts +56 -0
- package/backend/worktrees/branching/naming.test.ts +118 -0
- package/backend/worktrees/branching/naming.ts +97 -0
- package/backend/worktrees/branching/projector.test.ts +229 -0
- package/backend/worktrees/branching/projector.ts +139 -0
- package/backend/worktrees/branching/providers/neon.ts +220 -0
- package/backend/worktrees/branching/registry.ts +27 -0
- package/backend/worktrees/branching/service.ts +620 -0
- package/backend/worktrees/branching/suggest.test.ts +154 -0
- package/backend/worktrees/branching/suggest.ts +202 -0
- package/backend/worktrees/branching/types.ts +88 -0
- package/backend/worktrees/index.ts +7 -0
- package/backend/worktrees/service.ts +48 -1
- package/backend/ws/chat/stream.ts +100 -8
- package/backend/ws/db-client/env.ts +142 -0
- package/backend/ws/db-client/index.ts +2 -0
- package/backend/ws/files/index.ts +4 -0
- package/backend/ws/files/share.ts +95 -0
- package/backend/ws/git/branch-name.ts +2 -2
- package/backend/ws/git/commit-message.ts +2 -2
- package/backend/ws/index.ts +3 -4
- package/backend/ws/profiles/crud.ts +2 -3
- package/backend/ws/projects/index.ts +6 -1
- package/backend/ws/projects/info.ts +70 -6
- package/backend/ws/projects/overview.test.ts +108 -0
- package/backend/ws/projects/overview.ts +300 -0
- package/backend/ws/skills/catalog.ts +5 -1
- package/backend/ws/skills/crud.ts +128 -22
- package/backend/ws/skills/index.ts +4 -1
- package/backend/ws/system/device-info.ts +307 -76
- package/backend/ws/user/crud.ts +12 -3
- package/backend/ws/worktrees/branching.ts +212 -0
- package/backend/ws/worktrees/crud.ts +33 -7
- package/backend/ws/worktrees/index.ts +14 -0
- package/dist/assets/{index-C8Gi-b6U.js → index-CeNKKSDR.js} +1 -1
- package/dist/assets/{index-BrF6nqld.js → index-DW89566K.js} +1 -1
- package/dist/assets/main-Cy5DXWPT.js +1207 -0
- package/dist/assets/main-DJKj_4By.css +1 -0
- package/dist/index.html +7 -2
- package/dist/sw.js +112 -0
- package/package.json +1 -1
- package/shared/constants/engine-tools.ts +31 -6
- package/shared/constants/notification-messages.ts +142 -0
- package/shared/constants/tool-icons.ts +6 -2
- package/shared/types/db-client/env.ts +192 -0
- package/shared/types/db-client/index.ts +1 -0
- package/shared/types/db-client/integrations.ts +30 -0
- package/shared/types/integrations.ts +9 -0
- package/shared/types/unified/stream.ts +7 -0
- package/shared/types/worktree-branching.ts +315 -0
- package/shared/utils/logger.ts +1 -0
- package/backend/commands/detect.ts +0 -25
- package/backend/commands/index.ts +0 -9
- package/backend/commands/service.ts +0 -178
- package/backend/commands/store.ts +0 -45
- package/backend/commands/sync.ts +0 -94
- package/backend/database/queries/command-queries.ts +0 -82
- package/backend/ws/commands/crud.ts +0 -157
- package/backend/ws/commands/index.ts +0 -8
- package/dist/assets/main-Bd3gb79F.css +0 -1
- package/dist/assets/main-Bo1hD7mt.js +0 -1191
|
@@ -0,0 +1,351 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public single-file download route for "Share Link…" links.
|
|
3
|
+
*
|
|
4
|
+
* `GET /api/files/shared?share=<token>` — the counterpart to the
|
|
5
|
+
* authenticated `/api/files/download`. No session is required: the token
|
|
6
|
+
* itself is the credential, and it resolves to exactly one file. The
|
|
7
|
+
* file path is taken from the stored share entry, never from a
|
|
8
|
+
* caller-supplied parameter, so a link cannot be retargeted at another file.
|
|
9
|
+
*
|
|
10
|
+
* A one-time link (the default) is consumed by its first successful open, and
|
|
11
|
+
* any later full open of it (copy-paste, reopen, rescan) answers 410.
|
|
12
|
+
* Byte-range requests (`Range: bytes=…` → 206) keep working briefly after the
|
|
13
|
+
* burn so an already-open video/audio player can buffer, seek and replay — a
|
|
14
|
+
* media player issues many such requests for a single viewing. That
|
|
15
|
+
* continuation window is bound to the client that burned the link (IP + user
|
|
16
|
+
* agent), so a leaked URL cannot be range-read by anyone else inside it.
|
|
17
|
+
*
|
|
18
|
+
* A reusable link skips the burn entirely and serves until its deadline (or
|
|
19
|
+
* until it is revoked), counting each open so the management list can report
|
|
20
|
+
* whether anybody has actually used it.
|
|
21
|
+
*
|
|
22
|
+
* Responses carry `Cache-Control: no-store` so a browser never re-serves the
|
|
23
|
+
* file from its own cache after the link has died server-side.
|
|
24
|
+
*
|
|
25
|
+
* Served `inline` (not `attachment`) with the real `Content-Type` so "Open
|
|
26
|
+
* Link" previews images, PDFs and text directly in the receiving browser —
|
|
27
|
+
* desktop, macOS, Android and iOS alike — while other types still download.
|
|
28
|
+
* `Content-Length` is always set so progress reporting works.
|
|
29
|
+
*/
|
|
30
|
+
|
|
31
|
+
import { Elysia } from 'elysia';
|
|
32
|
+
import { stat } from 'node:fs/promises';
|
|
33
|
+
import { basename, extname } from 'node:path';
|
|
34
|
+
|
|
35
|
+
import { debug } from '$shared/utils/logger';
|
|
36
|
+
import { fileAuditLogQueries } from '../database/queries';
|
|
37
|
+
import { findContainingProjectId } from '../ws/files/path-access';
|
|
38
|
+
import {
|
|
39
|
+
consumeFileShareLink,
|
|
40
|
+
consumerFingerprint,
|
|
41
|
+
peekFileShare,
|
|
42
|
+
recordFileShareOpen
|
|
43
|
+
} from '../files/file-shares';
|
|
44
|
+
import { clientIpFromRequest } from '../utils/client-ip';
|
|
45
|
+
import { ws } from '../utils/ws';
|
|
46
|
+
|
|
47
|
+
/** Message shown when a link is opened after its single use (or its TTL). */
|
|
48
|
+
export const FILE_SHARE_GONE_MESSAGE = 'This link has already been used or has expired';
|
|
49
|
+
|
|
50
|
+
/** Extension fallback when Bun cannot sniff a MIME type (keeps video playable). */
|
|
51
|
+
const EXTENSION_MIME: Record<string, string> = {
|
|
52
|
+
mp4: 'video/mp4',
|
|
53
|
+
m4v: 'video/x-m4v',
|
|
54
|
+
webm: 'video/webm',
|
|
55
|
+
ogv: 'video/ogg',
|
|
56
|
+
mov: 'video/quicktime',
|
|
57
|
+
mkv: 'video/x-matroska',
|
|
58
|
+
mp3: 'audio/mpeg',
|
|
59
|
+
wav: 'audio/wav',
|
|
60
|
+
ogg: 'audio/ogg',
|
|
61
|
+
oga: 'audio/ogg',
|
|
62
|
+
pdf: 'application/pdf'
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
function contentTypeFor(filePath: string, sniffed: string): string {
|
|
66
|
+
if (sniffed) return sniffed;
|
|
67
|
+
// `extname` (not split('.')) so a dotted DIRECTORY on the way down —
|
|
68
|
+
// `C:\build.v2\README`, `/srv/site.old/LICENSE` — is not mistaken for the
|
|
69
|
+
// file's extension on any platform.
|
|
70
|
+
const ext = extname(filePath).slice(1).toLowerCase();
|
|
71
|
+
return EXTENSION_MIME[ext] ?? 'application/octet-stream';
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
interface ByteRange {
|
|
75
|
+
start: number;
|
|
76
|
+
end: number;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Parse a single `Range: bytes=start-end` header (RFC 9110 §14.2).
|
|
81
|
+
* Returns null for "not a range request" (absent/unparseable/multiple —
|
|
82
|
+
* the caller then serves the full body), or 'unsatisfiable' for a
|
|
83
|
+
* well-formed but out-of-bounds range (caller answers 416).
|
|
84
|
+
*/
|
|
85
|
+
function parseByteRange(header: string | null, size: number): ByteRange | 'unsatisfiable' | null {
|
|
86
|
+
if (!header) return null;
|
|
87
|
+
const match = /^bytes=(\d*)-(\d*)$/.exec(header.trim());
|
|
88
|
+
if (!match) return null;
|
|
89
|
+
const [, startStr, endStr] = match;
|
|
90
|
+
if (startStr === '' && endStr === '') return null;
|
|
91
|
+
|
|
92
|
+
if (startStr === '') {
|
|
93
|
+
// Suffix range: the last N bytes.
|
|
94
|
+
const suffix = Number(endStr);
|
|
95
|
+
if (!Number.isSafeInteger(suffix) || suffix <= 0 || size === 0) return 'unsatisfiable';
|
|
96
|
+
const start = Math.max(0, size - suffix);
|
|
97
|
+
return { start, end: size - 1 };
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const start = Number(startStr);
|
|
101
|
+
if (!Number.isSafeInteger(start) || start < 0 || start >= size) return 'unsatisfiable';
|
|
102
|
+
const end = endStr === '' ? size - 1 : Math.min(Number(endStr), size - 1);
|
|
103
|
+
if (!Number.isSafeInteger(end) || end < start) return 'unsatisfiable';
|
|
104
|
+
return { start, end };
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Tell every open management view that the list moved.
|
|
109
|
+
*
|
|
110
|
+
* This route is HTTP, not WebSocket, and the person triggering it is not
|
|
111
|
+
* signed in — so the broadcast goes out globally and each client re-reads its
|
|
112
|
+
* own role-scoped list. A "something changed" ping carries nothing to leak.
|
|
113
|
+
*/
|
|
114
|
+
function notifyShareChanged(): void {
|
|
115
|
+
try {
|
|
116
|
+
ws.emit.global('files:shares-changed', { kind: 'opened' });
|
|
117
|
+
} catch {
|
|
118
|
+
/* a broken socket must never affect the download */
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Standalone HTML page for a link that no longer serves anything.
|
|
124
|
+
*
|
|
125
|
+
* This is the only screen the receiving person ever sees from Clopen, on a
|
|
126
|
+
* device that has never signed in and may never have heard of the app — so it
|
|
127
|
+
* explains what happened and what to do, follows the system colour scheme, and
|
|
128
|
+
* carries its own styles. No asset, font or script is referenced: the response
|
|
129
|
+
* has to render identically on a phone with no network left to fetch them.
|
|
130
|
+
*/
|
|
131
|
+
function goneResponse(): Response {
|
|
132
|
+
const body = `<!doctype html>
|
|
133
|
+
<html lang="en">
|
|
134
|
+
<head>
|
|
135
|
+
<meta charset="utf-8">
|
|
136
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
137
|
+
<title>Link no longer valid</title>
|
|
138
|
+
<style>
|
|
139
|
+
:root { color-scheme: light dark; --bg:#f8fafc; --card:#ffffff; --border:#e2e8f0; --title:#0f172a; --text:#475569; --muted:#94a3b8; --accent:#7c3aed; --accent-bg:#ede9fe; }
|
|
140
|
+
@media (prefers-color-scheme: dark) {
|
|
141
|
+
:root { --bg:#0b1120; --card:#111827; --border:#1f2937; --title:#f1f5f9; --text:#94a3b8; --muted:#64748b; --accent:#a78bfa; --accent-bg:#2e1065; }
|
|
142
|
+
}
|
|
143
|
+
* { box-sizing: border-box; }
|
|
144
|
+
body { margin:0; min-height:100vh; display:flex; align-items:center; justify-content:center; padding:24px;
|
|
145
|
+
background:var(--bg); color:var(--text);
|
|
146
|
+
font-family:system-ui,-apple-system,"Segoe UI",Roboto,"Helvetica Neue",Arial,sans-serif; }
|
|
147
|
+
.card { width:100%; max-width:26rem; padding:32px 28px; text-align:center;
|
|
148
|
+
background:var(--card); border:1px solid var(--border); border-radius:16px; }
|
|
149
|
+
.badge { width:56px; height:56px; margin:0 auto 20px; display:flex; align-items:center; justify-content:center;
|
|
150
|
+
background:var(--accent-bg); border-radius:50%; }
|
|
151
|
+
.badge svg { width:26px; height:26px; stroke:var(--accent); fill:none; stroke-width:2; stroke-linecap:round; stroke-linejoin:round; }
|
|
152
|
+
h1 { margin:0 0 10px; font-size:1.125rem; line-height:1.4; font-weight:600; color:var(--title); }
|
|
153
|
+
p { margin:0; font-size:0.9375rem; line-height:1.6; }
|
|
154
|
+
.hint { margin-top:18px; padding-top:18px; border-top:1px solid var(--border); font-size:0.8125rem; color:var(--muted); }
|
|
155
|
+
</style>
|
|
156
|
+
</head>
|
|
157
|
+
<body>
|
|
158
|
+
<main class="card">
|
|
159
|
+
<div class="badge" aria-hidden="true">
|
|
160
|
+
<svg viewBox="0 0 24 24"><path d="M9 17H7A5 5 0 0 1 7 7h2"/><path d="M15 7h2a5 5 0 0 1 4 8"/><line x1="2" y1="2" x2="22" y2="22"/></svg>
|
|
161
|
+
</div>
|
|
162
|
+
<h1>${FILE_SHARE_GONE_MESSAGE}</h1>
|
|
163
|
+
<p>File links open a single file, and most are meant to be used once and then die on their own.</p>
|
|
164
|
+
<p class="hint">Ask whoever sent it to share the file again.</p>
|
|
165
|
+
</main>
|
|
166
|
+
</body>
|
|
167
|
+
</html>`;
|
|
168
|
+
return new Response(body, {
|
|
169
|
+
status: 410,
|
|
170
|
+
headers: { 'Content-Type': 'text/html; charset=utf-8', 'Cache-Control': 'no-store' }
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export const filesSharedRoute = new Elysia().get('/api/files/shared', async ({ request, query, server }) => {
|
|
175
|
+
const share = typeof query.share === 'string' ? query.share : '';
|
|
176
|
+
if (!share) {
|
|
177
|
+
return new Response('Missing required query parameter: share', { status: 400 });
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
const ipAddress = clientIpFromRequest(request, server);
|
|
181
|
+
const userAgent = request.headers.get('user-agent') ?? undefined;
|
|
182
|
+
const fingerprint = consumerFingerprint(ipAddress, userAgent);
|
|
183
|
+
|
|
184
|
+
let filePath: string;
|
|
185
|
+
let createdBy: string;
|
|
186
|
+
let oneTime = true;
|
|
187
|
+
// True once a one-time link is burned: only byte-range continuations from
|
|
188
|
+
// the client that burned it are still servable, never a full reopen.
|
|
189
|
+
let consumed = false;
|
|
190
|
+
try {
|
|
191
|
+
// Peek only: the token is consumed below, and only once the file is
|
|
192
|
+
// confirmed servable — a missing file must not burn the single use.
|
|
193
|
+
const entry = await peekFileShare(share, fingerprint);
|
|
194
|
+
filePath = entry.filePath;
|
|
195
|
+
createdBy = entry.createdBy;
|
|
196
|
+
oneTime = entry.oneTime;
|
|
197
|
+
consumed = entry.draining;
|
|
198
|
+
} catch {
|
|
199
|
+
return goneResponse();
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const projectId = await findContainingProjectId(filePath).catch(() => null);
|
|
203
|
+
|
|
204
|
+
const logFailure = (message: string, size: number | null = null) => {
|
|
205
|
+
try {
|
|
206
|
+
fileAuditLogQueries.logOperation({
|
|
207
|
+
userId: createdBy,
|
|
208
|
+
projectId,
|
|
209
|
+
action: 'download',
|
|
210
|
+
filePath,
|
|
211
|
+
fileSize: size,
|
|
212
|
+
ipAddress,
|
|
213
|
+
userAgent,
|
|
214
|
+
success: false,
|
|
215
|
+
errorMessage: message
|
|
216
|
+
});
|
|
217
|
+
} catch {
|
|
218
|
+
/* audit logging must never break the response */
|
|
219
|
+
}
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
try {
|
|
223
|
+
const stats = await stat(filePath).catch(() => null);
|
|
224
|
+
if (!stats || stats.isDirectory()) {
|
|
225
|
+
logFailure('File not found');
|
|
226
|
+
return new Response('File not found', { status: 404 });
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const file = Bun.file(filePath);
|
|
230
|
+
const name = basename(filePath);
|
|
231
|
+
const contentType = contentTypeFor(filePath, file.type);
|
|
232
|
+
const disposition = `inline; filename*=UTF-8''${encodeURIComponent(name)}`;
|
|
233
|
+
|
|
234
|
+
// HEAD reaches this GET handler (the router maps it here), so it is
|
|
235
|
+
// answered explicitly: metadata only, no body, no burn. Without this
|
|
236
|
+
// branch a preflight would be handed the streamed body below and would
|
|
237
|
+
// spend the single use.
|
|
238
|
+
if (request.method === 'HEAD') {
|
|
239
|
+
// No `Content-Length` here: the body is empty, and the runtime
|
|
240
|
+
// derives the header from it — advertising the file's size would
|
|
241
|
+
// not survive the response anyway.
|
|
242
|
+
return new Response(null, {
|
|
243
|
+
headers: {
|
|
244
|
+
'Content-Type': contentType,
|
|
245
|
+
'Content-Disposition': disposition,
|
|
246
|
+
'Accept-Ranges': 'bytes',
|
|
247
|
+
'Cache-Control': 'no-store'
|
|
248
|
+
}
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
// One-time use: burn the token exactly when the file is about to be
|
|
253
|
+
// served. A media player issues many requests for one viewing
|
|
254
|
+
// (initial load, buffering, seek, replay) as byte ranges against the
|
|
255
|
+
// same URL, so ranges are the continuation channel: a range is served
|
|
256
|
+
// on a live token (burning it, like any first open) and keeps being
|
|
257
|
+
// served while draining. A full GET after the burn — copy-paste,
|
|
258
|
+
// reopen, rescan, reload — always fails closed with the gone message.
|
|
259
|
+
const range = parseByteRange(request.headers.get('range'), stats.size);
|
|
260
|
+
if (range === 'unsatisfiable') {
|
|
261
|
+
return new Response('Requested range not satisfiable', {
|
|
262
|
+
status: 416,
|
|
263
|
+
headers: {
|
|
264
|
+
'Content-Range': `bytes */${stats.size}`,
|
|
265
|
+
'Accept-Ranges': 'bytes',
|
|
266
|
+
'Cache-Control': 'no-store'
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
if (oneTime) {
|
|
272
|
+
if (consumed && !range) {
|
|
273
|
+
// A full reopen of a burned link — never the file again.
|
|
274
|
+
return goneResponse();
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
if (!consumed && !consumeFileShareLink(share, fingerprint)) {
|
|
278
|
+
// Lost a race with a concurrent first open from this same client
|
|
279
|
+
// (a player firing several requests at once): a range continuation
|
|
280
|
+
// still wins, anything else is gone. A stranger never reaches here
|
|
281
|
+
// — the peek above already rejected a foreign fingerprint.
|
|
282
|
+
const stillServable = range
|
|
283
|
+
? await peekFileShare(share, fingerprint).then((entry) => entry.draining).catch(() => false)
|
|
284
|
+
: false;
|
|
285
|
+
if (!stillServable) {
|
|
286
|
+
logFailure('Share link already used');
|
|
287
|
+
return goneResponse();
|
|
288
|
+
}
|
|
289
|
+
notifyShareChanged();
|
|
290
|
+
} else if (!consumed) {
|
|
291
|
+
notifyShareChanged();
|
|
292
|
+
}
|
|
293
|
+
} else if (!range) {
|
|
294
|
+
// Reusable link: nothing to burn, but a full open still counts — it
|
|
295
|
+
// is the only way the list can say "somebody has opened this". Range
|
|
296
|
+
// requests are excluded so one viewing is not reported as forty.
|
|
297
|
+
recordFileShareOpen(share);
|
|
298
|
+
notifyShareChanged();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
if (range) {
|
|
302
|
+
const length = range.end - range.start + 1;
|
|
303
|
+
return new Response(file.slice(range.start, range.end + 1), {
|
|
304
|
+
status: 206,
|
|
305
|
+
headers: {
|
|
306
|
+
'Content-Type': contentType,
|
|
307
|
+
'Content-Range': `bytes ${range.start}-${range.end}/${stats.size}`,
|
|
308
|
+
'Content-Length': String(length),
|
|
309
|
+
'Content-Disposition': disposition,
|
|
310
|
+
'Accept-Ranges': 'bytes',
|
|
311
|
+
'Cache-Control': 'no-store'
|
|
312
|
+
}
|
|
313
|
+
});
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
try {
|
|
317
|
+
fileAuditLogQueries.logOperation({
|
|
318
|
+
userId: createdBy,
|
|
319
|
+
projectId,
|
|
320
|
+
action: 'download',
|
|
321
|
+
filePath,
|
|
322
|
+
fileSize: stats.size,
|
|
323
|
+
ipAddress,
|
|
324
|
+
userAgent
|
|
325
|
+
});
|
|
326
|
+
} catch {
|
|
327
|
+
/* ignore */
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
// Streamed straight from disk, like the authenticated download route.
|
|
331
|
+
// `inline` lets the receiving browser preview (images, PDF, text) on
|
|
332
|
+
// any OS; anything it cannot render still downloads as a file.
|
|
333
|
+
// `Accept-Ranges` is what makes video/audio seekable and replayable;
|
|
334
|
+
// `no-store` is load-bearing for one-time links: without it a browser
|
|
335
|
+
// could re-display the file from its own cache after the link died.
|
|
336
|
+
return new Response(file.stream(), {
|
|
337
|
+
headers: {
|
|
338
|
+
'Content-Type': contentType,
|
|
339
|
+
'Content-Length': String(stats.size),
|
|
340
|
+
'Content-Disposition': disposition,
|
|
341
|
+
'Accept-Ranges': 'bytes',
|
|
342
|
+
'Cache-Control': 'no-store'
|
|
343
|
+
}
|
|
344
|
+
});
|
|
345
|
+
} catch (error) {
|
|
346
|
+
debug.error('file', 'Shared download error:', error);
|
|
347
|
+
const message = error instanceof Error ? error.message : 'Download failed';
|
|
348
|
+
logFailure(message);
|
|
349
|
+
return new Response(message, { status: 500 });
|
|
350
|
+
}
|
|
351
|
+
});
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* HTTP routes for Web Push subscriptions (mobile background notifications).
|
|
3
|
+
*
|
|
4
|
+
* A subscription is one (user, device) pair: the browser's PushManager mints
|
|
5
|
+
* an endpoint + keys, the frontend POSTs them here, and the server fans chat
|
|
6
|
+
* completions out to every registered device — including when Chrome is
|
|
7
|
+
* closed, which the page-local notification path can never do.
|
|
8
|
+
*
|
|
9
|
+
* Auth: `Authorization: Bearer <session-token>` (same token as auth:login).
|
|
10
|
+
* Every route resolves the user from the token; a user can only touch their
|
|
11
|
+
* own subscriptions.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
import { Elysia } from 'elysia';
|
|
15
|
+
|
|
16
|
+
import { debug } from '$shared/utils/logger';
|
|
17
|
+
import { pushSubscriptionQueries } from '../database/queries/push-subscription-queries';
|
|
18
|
+
import { getVapidKeys } from '../push/vapid-keys';
|
|
19
|
+
import { isValidSubscriptionKeys, sendPushToUser } from '../push/sender';
|
|
20
|
+
import { uniquePushTag } from '../push/tags';
|
|
21
|
+
import { authenticateRequest, type AuthIdentity } from './bearer-auth';
|
|
22
|
+
import { TEST_PUSH_MESSAGES } from '$shared/constants/notification-messages';
|
|
23
|
+
|
|
24
|
+
function unauthorized(error: unknown): Response {
|
|
25
|
+
const status = (error as { status?: number }).status ?? 401;
|
|
26
|
+
const message = error instanceof Error ? error.message : 'Unauthorized';
|
|
27
|
+
return new Response(message, { status });
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const pushRoute = new Elysia()
|
|
31
|
+
.get('/api/push/vapid-public-key', async ({ request }) => {
|
|
32
|
+
try {
|
|
33
|
+
authenticateRequest(request);
|
|
34
|
+
} catch (error) {
|
|
35
|
+
return unauthorized(error);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
try {
|
|
39
|
+
const keys = await getVapidKeys();
|
|
40
|
+
return Response.json({ publicKey: keys.publicKey });
|
|
41
|
+
} catch (error) {
|
|
42
|
+
debug.error('notification', 'Failed to resolve VAPID keys:', error);
|
|
43
|
+
return new Response('Failed to resolve push identity', { status: 500 });
|
|
44
|
+
}
|
|
45
|
+
})
|
|
46
|
+
.post('/api/push/subscriptions', async ({ request }) => {
|
|
47
|
+
let identity: AuthIdentity;
|
|
48
|
+
try {
|
|
49
|
+
identity = authenticateRequest(request);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
return unauthorized(error);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
let body: {
|
|
55
|
+
endpoint?: unknown;
|
|
56
|
+
keys?: { p256dh?: unknown; auth?: unknown };
|
|
57
|
+
userAgent?: unknown;
|
|
58
|
+
};
|
|
59
|
+
try {
|
|
60
|
+
body = (await request.json()) as typeof body;
|
|
61
|
+
} catch {
|
|
62
|
+
return new Response('Invalid JSON body', { status: 400 });
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
const endpoint = typeof body.endpoint === 'string' ? body.endpoint.trim() : '';
|
|
66
|
+
const p256dh = body.keys?.p256dh;
|
|
67
|
+
const auth = body.keys?.auth;
|
|
68
|
+
if (!endpoint.startsWith('https://') || !isValidSubscriptionKeys(p256dh, auth)) {
|
|
69
|
+
return new Response('Invalid subscription (endpoint must be https + valid p256dh/auth keys)', {
|
|
70
|
+
status: 400
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
try {
|
|
75
|
+
const subscription = pushSubscriptionQueries.upsert({
|
|
76
|
+
userId: identity.userId,
|
|
77
|
+
endpoint,
|
|
78
|
+
p256dh: p256dh as string,
|
|
79
|
+
auth: auth as string,
|
|
80
|
+
userAgent: typeof body.userAgent === 'string' ? body.userAgent.slice(0, 300) : undefined
|
|
81
|
+
});
|
|
82
|
+
return Response.json({ id: subscription.id });
|
|
83
|
+
} catch (error) {
|
|
84
|
+
debug.error('notification', 'Failed to store subscription:', error);
|
|
85
|
+
return new Response('Failed to store subscription', { status: 500 });
|
|
86
|
+
}
|
|
87
|
+
})
|
|
88
|
+
.delete('/api/push/subscriptions', async ({ request }) => {
|
|
89
|
+
let identity: AuthIdentity;
|
|
90
|
+
try {
|
|
91
|
+
identity = authenticateRequest(request);
|
|
92
|
+
} catch (error) {
|
|
93
|
+
return unauthorized(error);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
let body: { endpoint?: unknown; all?: unknown };
|
|
97
|
+
try {
|
|
98
|
+
body = (await request.json()) as typeof body;
|
|
99
|
+
} catch {
|
|
100
|
+
// A device that never registered has no endpoint to send; an empty
|
|
101
|
+
// body is a valid "purge whatever I have" request.
|
|
102
|
+
body = {};
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// `all` is what the settings toggle sends. The push setting is one
|
|
106
|
+
// per-user value, so switching it off on a laptop that holds no
|
|
107
|
+
// subscription still has to silence the phone that does.
|
|
108
|
+
const removeAll = body.all === true;
|
|
109
|
+
const endpoint = typeof body.endpoint === 'string' ? body.endpoint : '';
|
|
110
|
+
if (!removeAll && !endpoint) {
|
|
111
|
+
return new Response('Missing endpoint', { status: 400 });
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
try {
|
|
115
|
+
const removed = removeAll
|
|
116
|
+
? pushSubscriptionQueries.deleteAllByUser(identity.userId)
|
|
117
|
+
: Number(pushSubscriptionQueries.deleteByEndpoint(identity.userId, endpoint));
|
|
118
|
+
return Response.json({ removed });
|
|
119
|
+
} catch (error) {
|
|
120
|
+
debug.error('notification', 'Failed to remove subscription:', error);
|
|
121
|
+
return new Response('Failed to remove subscription', { status: 500 });
|
|
122
|
+
}
|
|
123
|
+
})
|
|
124
|
+
.post('/api/push/test', async ({ request }) => {
|
|
125
|
+
let identity: AuthIdentity;
|
|
126
|
+
try {
|
|
127
|
+
identity = authenticateRequest(request);
|
|
128
|
+
} catch (error) {
|
|
129
|
+
return unauthorized(error);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
let body: { tag?: unknown };
|
|
133
|
+
try {
|
|
134
|
+
body = (await request.json()) as typeof body;
|
|
135
|
+
} catch {
|
|
136
|
+
body = {};
|
|
137
|
+
}
|
|
138
|
+
const tag =
|
|
139
|
+
typeof body.tag === 'string' && body.tag.length > 0 && body.tag.length <= 120
|
|
140
|
+
? body.tag
|
|
141
|
+
: uniquePushTag('test');
|
|
142
|
+
|
|
143
|
+
// This goes through the real server→push-service→device path, so a
|
|
144
|
+
// passing test proves background delivery — not just a local toast.
|
|
145
|
+
const sent = await sendPushToUser(identity.userId, {
|
|
146
|
+
...TEST_PUSH_MESSAGES.background,
|
|
147
|
+
tag
|
|
148
|
+
});
|
|
149
|
+
return Response.json({ sent, tag });
|
|
150
|
+
});
|
package/backend/index.ts
CHANGED
|
@@ -45,10 +45,14 @@ import { wsRouter } from './ws';
|
|
|
45
45
|
// binary transfers with `write EPIPE`. See backend/http/files-upload.ts.
|
|
46
46
|
import { filesUploadRoute } from './http/files-upload';
|
|
47
47
|
import { filesDownloadRoute } from './http/files-download';
|
|
48
|
+
import { filesSharedRoute } from './http/files-shared';
|
|
48
49
|
|
|
49
50
|
// HTTP routes for per-user notification sounds (upload / serve / delete).
|
|
50
51
|
import { audioRoute } from './http/audio';
|
|
51
52
|
|
|
53
|
+
// HTTP routes for Web Push subscriptions + test (mobile background notifications).
|
|
54
|
+
import { pushRoute } from './http/push';
|
|
55
|
+
|
|
52
56
|
// HTTP routes for SFTP transfer — same reason as the file upload route above.
|
|
53
57
|
import { sshSftpRoute } from './http/ssh-sftp';
|
|
54
58
|
import { notesImagesRoute } from './http/notes-images';
|
|
@@ -194,10 +198,14 @@ const app = new Elysia()
|
|
|
194
198
|
// on the HTTP path through the Vite dev proxy.
|
|
195
199
|
.use(filesUploadRoute)
|
|
196
200
|
.use(filesDownloadRoute)
|
|
201
|
+
.use(filesSharedRoute)
|
|
197
202
|
|
|
198
203
|
// Per-user notification sound upload/serve/delete.
|
|
199
204
|
.use(audioRoute)
|
|
200
205
|
|
|
206
|
+
// Web Push subscriptions + test (mobile background notifications).
|
|
207
|
+
.use(pushRoute)
|
|
208
|
+
|
|
201
209
|
// SSH file transfer (SFTP download/upload).
|
|
202
210
|
.use(sshSftpRoute)
|
|
203
211
|
|
|
@@ -14,10 +14,27 @@
|
|
|
14
14
|
|
|
15
15
|
import { instructionQueries } from '$backend/database/queries';
|
|
16
16
|
import { debug } from '$shared/utils/logger';
|
|
17
|
-
import { resolveArtifact, writeManagedBlock, markersFor, type ArtifactEngine } from '$backend/artifacts';
|
|
17
|
+
import { resolveArtifact, writeManagedBlock, markersFor, readsGlobalMemoryFile, type ArtifactEngine } from '$backend/artifacts';
|
|
18
18
|
|
|
19
19
|
const MARKERS = markersFor('INSTRUCTIONS');
|
|
20
20
|
|
|
21
|
+
/**
|
|
22
|
+
* The global instruction block for PER-SESSION injection into the prompt of an
|
|
23
|
+
* engine that reads no memory file (Cline, Cursor — in-process SDKs that build
|
|
24
|
+
* their own system prompt from the workspace).
|
|
25
|
+
*
|
|
26
|
+
* Those engines used to get the block written to an `AGENTS.md` inside their
|
|
27
|
+
* isolated config dir, which nothing ever opened: Instructions simply did not
|
|
28
|
+
* apply there. Returns '' when there is no enabled global block.
|
|
29
|
+
*/
|
|
30
|
+
export function buildInstructionsPromptContext(): string {
|
|
31
|
+
const row = instructionQueries.getGlobal();
|
|
32
|
+
if (!row || row.is_enabled !== 1) return '';
|
|
33
|
+
const content = row.content.trim();
|
|
34
|
+
if (!content) return '';
|
|
35
|
+
return ['# Project Instructions', '', 'Always-on directives from this Clopen instance:', '', content].join('\n');
|
|
36
|
+
}
|
|
37
|
+
|
|
21
38
|
/**
|
|
22
39
|
* Sync the global (and, when a project is provided, project) instruction block
|
|
23
40
|
* into one engine's memory file(s).
|
|
@@ -27,11 +44,18 @@ export async function syncInstructions(
|
|
|
27
44
|
project?: { id: string; path: string }
|
|
28
45
|
): Promise<void> {
|
|
29
46
|
try {
|
|
30
|
-
// Global scope → engine's isolated global memory file
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
47
|
+
// Global scope → engine's isolated global memory file, but ONLY for engines
|
|
48
|
+
// that actually read one. Writing `AGENTS.md` into Cline's or Cursor's
|
|
49
|
+
// config dir produced a file no runtime opens, which is worse than doing
|
|
50
|
+
// nothing: it looked like Instructions were applied when they were not.
|
|
51
|
+
// Those engines receive the block through the prompt instead (see
|
|
52
|
+
// {@link buildInstructionsPromptContext}).
|
|
53
|
+
if (readsGlobalMemoryFile(engine)) {
|
|
54
|
+
const global = instructionQueries.getGlobal();
|
|
55
|
+
const globalTarget = resolveArtifact('instruction', { engine, scope: 'global' }).locateEffective({ engine, scope: 'global' });
|
|
56
|
+
const globalBlock = global && global.is_enabled === 1 ? global.content : '';
|
|
57
|
+
if (globalTarget) await writeManagedBlock(globalTarget, globalBlock, MARKERS);
|
|
58
|
+
}
|
|
35
59
|
|
|
36
60
|
// Project scope → repo memory file (touches the working tree).
|
|
37
61
|
if (project) {
|
|
@@ -38,11 +38,26 @@ export type AccountProbe = (
|
|
|
38
38
|
projectId: string | null
|
|
39
39
|
) => Promise<{ status: IntegrationStatus; detail: string | null } | null>;
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
/**
|
|
42
|
+
* Probes per provider, in registration order.
|
|
43
|
+
*
|
|
44
|
+
* A LIST rather than one entry, because a provider can serve more than one
|
|
45
|
+
* surface: Neon offers `database` to DB Client and `worktree-branching` to the
|
|
46
|
+
* worktree manager, and each surface registers the probe that speaks for its
|
|
47
|
+
* own capability. A map would have let whichever module loaded last silently
|
|
48
|
+
* replace the other's, so an account using only the losing capability would
|
|
49
|
+
* report on something it had switched off.
|
|
50
|
+
*
|
|
51
|
+
* They are tried in order and the first non-null answer wins, which is exactly
|
|
52
|
+
* what the "returns null when it has nothing to say" contract was written for.
|
|
53
|
+
*/
|
|
54
|
+
const providerProbes = new Map<string, AccountProbe[]>();
|
|
42
55
|
|
|
43
56
|
/** Register a provider-specific probe. Called at module load by the surface. */
|
|
44
57
|
export function registerAccountProbe(provider: string, probe: AccountProbe): void {
|
|
45
|
-
providerProbes.
|
|
58
|
+
const existing = providerProbes.get(provider);
|
|
59
|
+
if (existing) existing.push(probe);
|
|
60
|
+
else providerProbes.set(provider, [probe]);
|
|
46
61
|
}
|
|
47
62
|
|
|
48
63
|
/**
|
|
@@ -66,8 +81,7 @@ export async function checkAccountHealth(accountId: string): Promise<{ status: I
|
|
|
66
81
|
// A surface probe is the more specific answer when there is one: it talks to
|
|
67
82
|
// the API the credential was issued for, rather than to an MCP server that
|
|
68
83
|
// happens to accept the same token.
|
|
69
|
-
const providerProbe
|
|
70
|
-
if (providerProbe) {
|
|
84
|
+
for (const providerProbe of providerProbes.get(account.provider) ?? []) {
|
|
71
85
|
try {
|
|
72
86
|
const result = await providerProbe(accountId, account.project_id);
|
|
73
87
|
if (result) {
|
|
@@ -7,8 +7,15 @@
|
|
|
7
7
|
*
|
|
8
8
|
* One projector per capability — but ONLY for capabilities whose surface owns a
|
|
9
9
|
* table to write into. `agent-tools` writes an `mcp_servers` row, `database`
|
|
10
|
-
* writes `db_client_connections` ones,
|
|
11
|
-
*
|
|
10
|
+
* writes `db_client_connections` ones, `worktree-branching` writes them too —
|
|
11
|
+
* one per live worktree branch, from `worktree_branches` — and `notifications`
|
|
12
|
+
* is registered by the task that builds that surface.
|
|
13
|
+
*
|
|
14
|
+
* TWO CAPABILITIES CAN TARGET THE SAME TABLE, and one account can carry both: a
|
|
15
|
+
* Neon account owns a connection for the project it linked AND one per worktree
|
|
16
|
+
* branch it cut. That works only because migration 077 widened the projection
|
|
17
|
+
* key with `target_id`; releasing by capability alone would tear down the
|
|
18
|
+
* other's rows on every pass.
|
|
12
19
|
*
|
|
13
20
|
* A projector returns a LIST. Agent tools happens to produce exactly one row
|
|
14
21
|
* per account, but that is a fact about MCP presets rather than about
|
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
import context7 from './providers/context7';
|
|
11
11
|
import firecrawl from './providers/firecrawl';
|
|
12
12
|
import github from './providers/github';
|
|
13
|
+
import neon from './providers/neon';
|
|
13
14
|
import supabase from './providers/supabase';
|
|
14
15
|
import vercel from './providers/vercel';
|
|
15
16
|
import type { IntegrationProvider } from './types';
|
|
@@ -23,6 +24,7 @@ export const PROVIDERS: readonly IntegrationProvider[] = [
|
|
|
23
24
|
context7,
|
|
24
25
|
firecrawl,
|
|
25
26
|
github,
|
|
27
|
+
neon,
|
|
26
28
|
supabase,
|
|
27
29
|
vercel
|
|
28
30
|
];
|
|
@@ -46,6 +48,7 @@ export function toProviderInfo(provider: IntegrationProvider): IntegrationProvid
|
|
|
46
48
|
category: provider.category,
|
|
47
49
|
description: provider.description,
|
|
48
50
|
docsUrl: provider.docsUrl,
|
|
51
|
+
consoleUrl: provider.consoleUrl,
|
|
49
52
|
authMethod: provider.authMethod,
|
|
50
53
|
credentialFields: provider.credentialFields,
|
|
51
54
|
capabilities: [...provider.capabilities],
|
|
@@ -16,6 +16,7 @@ export default defineProvider({
|
|
|
16
16
|
description:
|
|
17
17
|
'Pulls current, version-accurate documentation for a library straight into the session, so the agent stops writing against the API it remembers.',
|
|
18
18
|
docsUrl: 'https://context7.com',
|
|
19
|
+
consoleUrl: 'https://context7.com',
|
|
19
20
|
authMethod: 'api-key',
|
|
20
21
|
capabilities: ['agent-tools'],
|
|
21
22
|
credentialFields: [
|