shieldcortex 3.4.8 → 3.4.10
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/dashboard/.next/standalone/dashboard/.next/BUILD_ID +1 -1
- package/dashboard/.next/standalone/dashboard/.next/build-manifest.json +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_full.segment.rsc +3 -3
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_head.segment.rsc +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_index.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/index.segments/_tree.segment.rsc +2 -2
- package/dashboard/.next/standalone/dashboard/.next/server/app/page_client-reference-manifest.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/chunks/ssr/dashboard_3051539d._.js +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/404.html +1 -1
- package/dashboard/.next/standalone/dashboard/.next/server/pages/500.html +2 -2
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/1c4b5a3cb7ba11e1.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/4f54cadaf07fdfca.js +1 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/85bef03426f93c44.css +3 -0
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/961e337de05e4fa9.js +9 -0
- package/dist/api/routes/admin.js +9 -28
- package/dist/api/routes/system.js +35 -3
- package/dist/defence/iron-dome/gateway.js +5 -2
- package/dist/defence/iron-dome/index.js +10 -1
- package/dist/defence/quarantine/review.d.ts +17 -0
- package/dist/defence/quarantine/review.js +118 -0
- package/dist/server.js +14 -28
- package/package.json +1 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/3a705374b80737ef.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/98e2c181d5c4349f.js +0 -1
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/a173868b874afd35.js +0 -9
- package/dashboard/.next/standalone/dashboard/.next/static/chunks/f20820dedea01774.css +0 -3
- /package/dashboard/.next/standalone/dashboard/.next/static/{_Mm1rWcOt1g-KkQYxul0S → 3rqbU2WvGcK3njOAQuxsW}/_buildManifest.js +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{_Mm1rWcOt1g-KkQYxul0S → 3rqbU2WvGcK3njOAQuxsW}/_clientMiddlewareManifest.json +0 -0
- /package/dashboard/.next/standalone/dashboard/.next/static/{_Mm1rWcOt1g-KkQYxul0S → 3rqbU2WvGcK3njOAQuxsW}/_ssgManifest.js +0 -0
package/dist/api/routes/admin.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getDatabase } from '../../database/init.js';
|
|
2
2
|
import { getCloudConfig } from '../../cloud/config.js';
|
|
3
3
|
import { queryAgentOperations, queryAgentRegistry, queryAgentTimeline, queryAuditLogs, getAuditStats } from '../../defence/audit/queries.js';
|
|
4
|
+
import { approveQuarantineItem, approveQuarantineItems, rejectQuarantineItem, rejectQuarantineItems, } from '../../defence/quarantine/review.js';
|
|
4
5
|
import { getLicense, activateLicense, deactivateLicense } from '../../license/store.js';
|
|
5
6
|
import { listFeatures } from '../../license/gate.js';
|
|
6
7
|
import { validateOnceNow } from '../../license/validate.js';
|
|
@@ -107,14 +108,13 @@ export function registerAdminRoutes(app, deps) {
|
|
|
107
108
|
enforceAmber: true,
|
|
108
109
|
}), (req, res) => {
|
|
109
110
|
try {
|
|
110
|
-
const db = getDatabase();
|
|
111
111
|
const id = parseInt(req.params.id, 10);
|
|
112
112
|
const reviewedBy = req.body?.reviewedBy ?? 'api';
|
|
113
|
-
const result =
|
|
114
|
-
if (result
|
|
113
|
+
const result = approveQuarantineItem(id, reviewedBy);
|
|
114
|
+
if (!result) {
|
|
115
115
|
return res.status(404).json({ error: 'Quarantine entry not found or already reviewed' });
|
|
116
116
|
}
|
|
117
|
-
res.json({ success: true,
|
|
117
|
+
res.json({ success: true, ...result });
|
|
118
118
|
}
|
|
119
119
|
catch (error) {
|
|
120
120
|
res.status(500).json({ error: error.message });
|
|
@@ -127,14 +127,13 @@ export function registerAdminRoutes(app, deps) {
|
|
|
127
127
|
enforceAmber: true,
|
|
128
128
|
}), (req, res) => {
|
|
129
129
|
try {
|
|
130
|
-
const db = getDatabase();
|
|
131
130
|
const id = parseInt(req.params.id, 10);
|
|
132
131
|
const reviewedBy = req.body?.reviewedBy ?? 'api';
|
|
133
|
-
const result =
|
|
134
|
-
if (result
|
|
132
|
+
const result = rejectQuarantineItem(id, reviewedBy);
|
|
133
|
+
if (!result) {
|
|
135
134
|
return res.status(404).json({ error: 'Quarantine entry not found or already reviewed' });
|
|
136
135
|
}
|
|
137
|
-
res.json({ success: true,
|
|
136
|
+
res.json({ success: true, ...result });
|
|
138
137
|
}
|
|
139
138
|
catch (error) {
|
|
140
139
|
res.status(500).json({ error: error.message });
|
|
@@ -147,21 +146,12 @@ export function registerAdminRoutes(app, deps) {
|
|
|
147
146
|
enforceAmber: true,
|
|
148
147
|
}), (req, res) => {
|
|
149
148
|
try {
|
|
150
|
-
const db = getDatabase();
|
|
151
149
|
const ids = req.body?.ids;
|
|
152
150
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
153
151
|
return res.status(400).json({ error: 'ids must be a non-empty array of numbers' });
|
|
154
152
|
}
|
|
155
153
|
const reviewedBy = req.body?.reviewedBy ?? 'dashboard';
|
|
156
|
-
|
|
157
|
-
const stmt = db.prepare('UPDATE quarantine SET status = ?, reviewed_at = ?, reviewed_by = ? WHERE id = ? AND status = ?');
|
|
158
|
-
let updated = 0;
|
|
159
|
-
db.transaction(() => {
|
|
160
|
-
for (const id of ids) {
|
|
161
|
-
updated += stmt.run('approved', now, reviewedBy, id, 'pending').changes;
|
|
162
|
-
}
|
|
163
|
-
})();
|
|
164
|
-
res.json({ success: true, updated, total: ids.length });
|
|
154
|
+
res.json(approveQuarantineItems(ids, reviewedBy));
|
|
165
155
|
}
|
|
166
156
|
catch (error) {
|
|
167
157
|
res.status(500).json({ error: error.message });
|
|
@@ -174,21 +164,12 @@ export function registerAdminRoutes(app, deps) {
|
|
|
174
164
|
enforceAmber: true,
|
|
175
165
|
}), (req, res) => {
|
|
176
166
|
try {
|
|
177
|
-
const db = getDatabase();
|
|
178
167
|
const ids = req.body?.ids;
|
|
179
168
|
if (!Array.isArray(ids) || ids.length === 0) {
|
|
180
169
|
return res.status(400).json({ error: 'ids must be a non-empty array of numbers' });
|
|
181
170
|
}
|
|
182
171
|
const reviewedBy = req.body?.reviewedBy ?? 'dashboard';
|
|
183
|
-
|
|
184
|
-
const stmt = db.prepare('UPDATE quarantine SET status = ?, reviewed_at = ?, reviewed_by = ? WHERE id = ? AND status = ?');
|
|
185
|
-
let updated = 0;
|
|
186
|
-
db.transaction(() => {
|
|
187
|
-
for (const id of ids) {
|
|
188
|
-
updated += stmt.run('rejected', now, reviewedBy, id, 'pending').changes;
|
|
189
|
-
}
|
|
190
|
-
})();
|
|
191
|
-
res.json({ success: true, updated, total: ids.length });
|
|
172
|
+
res.json(rejectQuarantineItems(ids, reviewedBy));
|
|
192
173
|
}
|
|
193
174
|
catch (error) {
|
|
194
175
|
res.status(500).json({ error: error.message });
|
|
@@ -61,7 +61,17 @@ export function registerSystemRoutes(app, deps) {
|
|
|
61
61
|
enforceAmber: true,
|
|
62
62
|
}), (req, res) => {
|
|
63
63
|
try {
|
|
64
|
+
const existingConfig = getCloudConfig();
|
|
64
65
|
const { cloudApiKey, cloudEnabled, cloudBaseUrl, cloudSyncProjectMode, cloudSyncProjects, cloudSyncContentMode, cloudSyncExcludeSensitive, openclawAutoMemory, openclawAutoMemoryDedupe, openclawAutoMemoryNoveltyThreshold, openclawAutoMemoryMaxRecent, } = req.body;
|
|
66
|
+
if (cloudApiKey !== undefined && typeof cloudApiKey !== 'string') {
|
|
67
|
+
return res.status(400).json({ error: 'cloudApiKey must be a string' });
|
|
68
|
+
}
|
|
69
|
+
if (cloudEnabled !== undefined && typeof cloudEnabled !== 'boolean') {
|
|
70
|
+
return res.status(400).json({ error: 'cloudEnabled must be a boolean' });
|
|
71
|
+
}
|
|
72
|
+
if (cloudBaseUrl !== undefined && typeof cloudBaseUrl !== 'string') {
|
|
73
|
+
return res.status(400).json({ error: 'cloudBaseUrl must be a string' });
|
|
74
|
+
}
|
|
65
75
|
if (openclawAutoMemory !== undefined && typeof openclawAutoMemory !== 'boolean') {
|
|
66
76
|
return res.status(400).json({ error: 'openclawAutoMemory must be a boolean' });
|
|
67
77
|
}
|
|
@@ -95,14 +105,36 @@ export function registerSystemRoutes(app, deps) {
|
|
|
95
105
|
(!Array.isArray(cloudSyncProjects) || cloudSyncProjects.some((value) => typeof value !== 'string'))) {
|
|
96
106
|
return res.status(400).json({ error: 'cloudSyncProjects must be an array of strings' });
|
|
97
107
|
}
|
|
108
|
+
const normalizedApiKey = cloudApiKey !== undefined
|
|
109
|
+
? cloudApiKey.trim()
|
|
110
|
+
: existingConfig.cloudApiKey;
|
|
111
|
+
const normalizedBaseUrl = cloudBaseUrl !== undefined
|
|
112
|
+
? cloudBaseUrl.trim()
|
|
113
|
+
: existingConfig.cloudBaseUrl;
|
|
114
|
+
let normalizedProjects;
|
|
115
|
+
if (cloudSyncProjects !== undefined) {
|
|
116
|
+
const projectValues = cloudSyncProjects;
|
|
117
|
+
normalizedProjects = Array.from(new Set(projectValues
|
|
118
|
+
.map((value) => value.trim())
|
|
119
|
+
.filter((value) => value.length > 0))).sort((a, b) => a.localeCompare(b));
|
|
120
|
+
}
|
|
121
|
+
if (cloudEnabled === true && !normalizedApiKey) {
|
|
122
|
+
return res.status(400).json({ error: 'Cloud API key required before enabling cloud sync' });
|
|
123
|
+
}
|
|
124
|
+
try {
|
|
125
|
+
new URL(normalizedBaseUrl);
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return res.status(400).json({ error: 'cloudBaseUrl must be a valid absolute URL' });
|
|
129
|
+
}
|
|
98
130
|
setCloudConfig({
|
|
99
|
-
...(cloudApiKey !== undefined && { cloudApiKey }),
|
|
131
|
+
...(cloudApiKey !== undefined && { cloudApiKey: normalizedApiKey }),
|
|
100
132
|
...(cloudEnabled !== undefined && { cloudEnabled }),
|
|
101
|
-
...(cloudBaseUrl !== undefined && { cloudBaseUrl }),
|
|
133
|
+
...(cloudBaseUrl !== undefined && { cloudBaseUrl: normalizedBaseUrl }),
|
|
102
134
|
});
|
|
103
135
|
setCloudSyncControls({
|
|
104
136
|
...(cloudSyncProjectMode !== undefined && { projectMode: cloudSyncProjectMode }),
|
|
105
|
-
...(
|
|
137
|
+
...(normalizedProjects !== undefined && { projects: normalizedProjects }),
|
|
106
138
|
...(cloudSyncContentMode !== undefined && { contentMode: cloudSyncContentMode }),
|
|
107
139
|
...(cloudSyncExcludeSensitive !== undefined && { excludeSensitive: cloudSyncExcludeSensitive }),
|
|
108
140
|
});
|
|
@@ -11,7 +11,10 @@ import { logIronDomeAudit } from './audit.js';
|
|
|
11
11
|
export function isChannelTrusted(channel, config) {
|
|
12
12
|
if (!config.enabled)
|
|
13
13
|
return true;
|
|
14
|
-
|
|
14
|
+
const normalized = channel.toLowerCase();
|
|
15
|
+
if (normalized === 'dashboard')
|
|
16
|
+
return true;
|
|
17
|
+
return config.trustedChannels.includes(normalized);
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* Validate an instruction through the gateway.
|
|
@@ -27,7 +30,7 @@ export function validateGateway(channel, instruction, config, source) {
|
|
|
27
30
|
};
|
|
28
31
|
}
|
|
29
32
|
const normChannel = channel.toLowerCase();
|
|
30
|
-
const trusted = config.trustedChannels.includes(normChannel);
|
|
33
|
+
const trusted = normChannel === 'dashboard' || config.trustedChannels.includes(normChannel);
|
|
31
34
|
const result = {
|
|
32
35
|
allowed: trusted,
|
|
33
36
|
channel: normChannel,
|
|
@@ -72,7 +72,16 @@ function loadConfig() {
|
|
|
72
72
|
const db = getDatabase();
|
|
73
73
|
const row = db.prepare('SELECT value FROM iron_dome_config WHERE key = ?').get('config');
|
|
74
74
|
if (row) {
|
|
75
|
-
|
|
75
|
+
const parsed = JSON.parse(row.value);
|
|
76
|
+
const normalized = normalizeConfig(parsed);
|
|
77
|
+
if (JSON.stringify(parsed) !== JSON.stringify(normalized)) {
|
|
78
|
+
db.prepare(`
|
|
79
|
+
UPDATE iron_dome_config
|
|
80
|
+
SET value = ?, updated_at = datetime('now')
|
|
81
|
+
WHERE key = 'config'
|
|
82
|
+
`).run(JSON.stringify(normalized));
|
|
83
|
+
}
|
|
84
|
+
activeConfig = normalized;
|
|
76
85
|
return activeConfig;
|
|
77
86
|
}
|
|
78
87
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface QuarantineReviewResult {
|
|
2
|
+
id: number;
|
|
3
|
+
status: 'approved' | 'rejected';
|
|
4
|
+
memoryId?: number;
|
|
5
|
+
}
|
|
6
|
+
export interface QuarantineBulkReviewResult {
|
|
7
|
+
success: boolean;
|
|
8
|
+
updated: number;
|
|
9
|
+
total: number;
|
|
10
|
+
promoted: number;
|
|
11
|
+
items: QuarantineReviewResult[];
|
|
12
|
+
}
|
|
13
|
+
export declare function approveQuarantineItem(id: number, reviewedBy?: string): QuarantineReviewResult | null;
|
|
14
|
+
export declare function rejectQuarantineItem(id: number, reviewedBy?: string): QuarantineReviewResult | null;
|
|
15
|
+
export declare function approveQuarantineItems(ids: number[], reviewedBy?: string): QuarantineBulkReviewResult;
|
|
16
|
+
export declare function rejectQuarantineItems(ids: number[], reviewedBy?: string): QuarantineBulkReviewResult;
|
|
17
|
+
export declare function approveQuarantineItemsBySource(sourceIdentifier: string, reviewedBy?: string): QuarantineBulkReviewResult;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { getDatabase, withTransaction } from '../../database/init.js';
|
|
2
|
+
import { addMemory } from '../../memory/store.js';
|
|
3
|
+
function getPendingQuarantineRow(id) {
|
|
4
|
+
const db = getDatabase();
|
|
5
|
+
const row = db.prepare(`SELECT id, original_title, original_content, project, source_type, source_identifier, reason
|
|
6
|
+
FROM quarantine
|
|
7
|
+
WHERE id = ? AND status = 'pending'`).get(id);
|
|
8
|
+
return row ?? null;
|
|
9
|
+
}
|
|
10
|
+
function normalizeSourceKind(sourceType) {
|
|
11
|
+
switch (sourceType) {
|
|
12
|
+
case 'cli':
|
|
13
|
+
case 'hook':
|
|
14
|
+
case 'plugin':
|
|
15
|
+
case 'agent':
|
|
16
|
+
case 'import':
|
|
17
|
+
case 'cloud':
|
|
18
|
+
case 'api':
|
|
19
|
+
return sourceType;
|
|
20
|
+
default:
|
|
21
|
+
return 'system';
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
function promoteApprovedQuarantineRow(row, reviewedBy) {
|
|
25
|
+
return addMemory({
|
|
26
|
+
title: row.original_title?.trim() || `Recovered quarantined memory ${row.id}`,
|
|
27
|
+
content: row.original_content,
|
|
28
|
+
project: row.project ?? undefined,
|
|
29
|
+
tags: ['quarantine-approved'],
|
|
30
|
+
metadata: {
|
|
31
|
+
approvedFromQuarantine: true,
|
|
32
|
+
quarantineId: row.id,
|
|
33
|
+
quarantineReason: row.reason ?? null,
|
|
34
|
+
originalSourceType: row.source_type ?? null,
|
|
35
|
+
originalSourceIdentifier: row.source_identifier ?? null,
|
|
36
|
+
},
|
|
37
|
+
captureMethod: 'review',
|
|
38
|
+
reviewedBy,
|
|
39
|
+
sourceKind: normalizeSourceKind(row.source_type),
|
|
40
|
+
source: row.source_type && row.source_identifier
|
|
41
|
+
? `${row.source_type}:${row.source_identifier}`
|
|
42
|
+
: 'quarantine:review',
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function approveExistingPendingRow(row, reviewedBy) {
|
|
46
|
+
const db = getDatabase();
|
|
47
|
+
const memory = promoteApprovedQuarantineRow(row, reviewedBy);
|
|
48
|
+
const reviewedAt = new Date().toISOString();
|
|
49
|
+
const result = db.prepare('UPDATE quarantine SET status = ?, reviewed_at = ?, reviewed_by = ? WHERE id = ? AND status = ?').run('approved', reviewedAt, reviewedBy, row.id, 'pending');
|
|
50
|
+
if (result.changes === 0) {
|
|
51
|
+
throw new Error('Quarantine entry not found or already reviewed');
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
id: row.id,
|
|
55
|
+
status: 'approved',
|
|
56
|
+
memoryId: memory.id,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function rejectPendingQuarantineRow(id, reviewedBy) {
|
|
60
|
+
const db = getDatabase();
|
|
61
|
+
const reviewedAt = new Date().toISOString();
|
|
62
|
+
const result = db.prepare('UPDATE quarantine SET status = ?, reviewed_at = ?, reviewed_by = ? WHERE id = ? AND status = ?').run('rejected', reviewedAt, reviewedBy, id, 'pending');
|
|
63
|
+
if (result.changes === 0) {
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
return { id, status: 'rejected' };
|
|
67
|
+
}
|
|
68
|
+
export function approveQuarantineItem(id, reviewedBy = 'dashboard') {
|
|
69
|
+
return withTransaction(() => {
|
|
70
|
+
const row = getPendingQuarantineRow(id);
|
|
71
|
+
if (!row)
|
|
72
|
+
return null;
|
|
73
|
+
return approveExistingPendingRow(row, reviewedBy);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
export function rejectQuarantineItem(id, reviewedBy = 'dashboard') {
|
|
77
|
+
return withTransaction(() => rejectPendingQuarantineRow(id, reviewedBy));
|
|
78
|
+
}
|
|
79
|
+
export function approveQuarantineItems(ids, reviewedBy = 'dashboard') {
|
|
80
|
+
return withTransaction(() => {
|
|
81
|
+
const items = [];
|
|
82
|
+
for (const id of ids) {
|
|
83
|
+
const row = getPendingQuarantineRow(id);
|
|
84
|
+
if (!row)
|
|
85
|
+
continue;
|
|
86
|
+
items.push(approveExistingPendingRow(row, reviewedBy));
|
|
87
|
+
}
|
|
88
|
+
return {
|
|
89
|
+
success: true,
|
|
90
|
+
updated: items.length,
|
|
91
|
+
total: ids.length,
|
|
92
|
+
promoted: items.filter((item) => item.memoryId).length,
|
|
93
|
+
items,
|
|
94
|
+
};
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
export function rejectQuarantineItems(ids, reviewedBy = 'dashboard') {
|
|
98
|
+
return withTransaction(() => {
|
|
99
|
+
const items = [];
|
|
100
|
+
for (const id of ids) {
|
|
101
|
+
const result = rejectPendingQuarantineRow(id, reviewedBy);
|
|
102
|
+
if (result)
|
|
103
|
+
items.push(result);
|
|
104
|
+
}
|
|
105
|
+
return {
|
|
106
|
+
success: true,
|
|
107
|
+
updated: items.length,
|
|
108
|
+
total: ids.length,
|
|
109
|
+
promoted: 0,
|
|
110
|
+
items,
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
export function approveQuarantineItemsBySource(sourceIdentifier, reviewedBy = 'dashboard') {
|
|
115
|
+
const db = getDatabase();
|
|
116
|
+
const ids = db.prepare("SELECT id FROM quarantine WHERE status = 'pending' AND source_identifier = ? ORDER BY created_at ASC").all(sourceIdentifier);
|
|
117
|
+
return approveQuarantineItems(ids.map((item) => item.id), reviewedBy);
|
|
118
|
+
}
|
package/dist/server.js
CHANGED
|
@@ -584,42 +584,28 @@ but you can use this tool to check for new contradictions at any time.`, {
|
|
|
584
584
|
return { content: [{ type: 'text', text }] };
|
|
585
585
|
}
|
|
586
586
|
else if (args.action === 'approve' && args.quarantineId) {
|
|
587
|
-
|
|
588
|
-
const
|
|
589
|
-
if (
|
|
590
|
-
|
|
591
|
-
try {
|
|
592
|
-
add({ title: q.original_title, content: q.original_content, project: q.project });
|
|
593
|
-
}
|
|
594
|
-
catch { /* may fail defence */ }
|
|
587
|
+
const { approveQuarantineItem } = await import('./defence/quarantine/review.js');
|
|
588
|
+
const result = approveQuarantineItem(args.quarantineId, args.notes || 'mcp');
|
|
589
|
+
if (!result) {
|
|
590
|
+
return { content: [{ type: 'text', text: `Quarantine item ${args.quarantineId} was not pending or no longer exists.` }] };
|
|
595
591
|
}
|
|
596
|
-
return { content: [{ type: 'text', text: `Quarantine item ${args.quarantineId} approved.` }] };
|
|
592
|
+
return { content: [{ type: 'text', text: `Quarantine item ${args.quarantineId} approved${result.memoryId ? ` and promoted to memory ${result.memoryId}` : ''}.` }] };
|
|
597
593
|
}
|
|
598
594
|
else if (args.action === 'reject' && args.quarantineId) {
|
|
599
|
-
|
|
595
|
+
const { rejectQuarantineItem } = await import('./defence/quarantine/review.js');
|
|
596
|
+
const result = rejectQuarantineItem(args.quarantineId, args.notes || 'mcp');
|
|
597
|
+
if (!result) {
|
|
598
|
+
return { content: [{ type: 'text', text: `Quarantine item ${args.quarantineId} was not pending or no longer exists.` }] };
|
|
599
|
+
}
|
|
600
600
|
return { content: [{ type: 'text', text: `Quarantine item ${args.quarantineId} rejected.` }] };
|
|
601
601
|
}
|
|
602
602
|
else if (args.action === 'approve_by_source' && args.sourceIdentifier) {
|
|
603
|
-
const
|
|
604
|
-
|
|
603
|
+
const { approveQuarantineItemsBySource } = await import('./defence/quarantine/review.js');
|
|
604
|
+
const result = approveQuarantineItemsBySource(args.sourceIdentifier, args.notes || 'batch-approve');
|
|
605
|
+
if (result.total === 0) {
|
|
605
606
|
return { content: [{ type: 'text', text: `No pending quarantine items from source "${args.sourceIdentifier}".` }] };
|
|
606
607
|
}
|
|
607
|
-
|
|
608
|
-
.run('approved', args.notes || 'batch-approve', 'pending', args.sourceIdentifier);
|
|
609
|
-
// Promote each to memory
|
|
610
|
-
const { addMemory: add } = await import('./memory/store.js');
|
|
611
|
-
let promoted = 0;
|
|
612
|
-
for (const item of items) {
|
|
613
|
-
const q = db.prepare('SELECT * FROM quarantine WHERE id = ?').get(item.id);
|
|
614
|
-
if (q) {
|
|
615
|
-
try {
|
|
616
|
-
add({ title: q.original_title, content: q.original_content, project: q.project });
|
|
617
|
-
promoted++;
|
|
618
|
-
}
|
|
619
|
-
catch { /* may fail defence */ }
|
|
620
|
-
}
|
|
621
|
-
}
|
|
622
|
-
return { content: [{ type: 'text', text: `Batch approved ${items.length} items from "${args.sourceIdentifier}" (${promoted} promoted to memory).` }] };
|
|
608
|
+
return { content: [{ type: 'text', text: `Batch approved ${result.updated} of ${result.total} items from "${args.sourceIdentifier}" (${result.promoted} promoted to memory).` }] };
|
|
623
609
|
}
|
|
624
610
|
return { content: [{ type: 'text', text: 'Invalid action or missing required parameters.' }] };
|
|
625
611
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shieldcortex",
|
|
3
|
-
"version": "3.4.
|
|
3
|
+
"version": "3.4.10",
|
|
4
4
|
"description": "Trustworthy memory and security for AI agents. Recall debugging, review queue, OpenClaw session capture, and memory poisoning defence for Claude Code, Codex, OpenClaw, LangChain, and MCP agents.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,88069,45688,71921,94156,e=>{"use strict";let t;var r=e.i(22534),s=e.i(11919),i=e.i(79736),n=e.i(96099),a=e.i(70207),o=e.i(32446),u=e.i(60904),c=e.i(62422),l=class extends a.Subscribable{constructor(e,t){super(),this.options=t,this.#e=e,this.#t=null,this.#r=(0,o.pendingThenable)(),this.bindMethods(),this.setOptions(t)}#e;#s=void 0;#i=void 0;#n=void 0;#a;#o;#r;#t;#u;#c;#l;#h;#d;#y;#f=new Set;bindMethods(){this.refetch=this.refetch.bind(this)}onSubscribe(){1===this.listeners.size&&(this.#s.addObserver(this),h(this.#s,this.options)?this.#p():this.updateResult(),this.#m())}onUnsubscribe(){this.hasListeners()||this.destroy()}shouldFetchOnReconnect(){return d(this.#s,this.options,this.options.refetchOnReconnect)}shouldFetchOnWindowFocus(){return d(this.#s,this.options,this.options.refetchOnWindowFocus)}destroy(){this.listeners=new Set,this.#v(),this.#b(),this.#s.removeObserver(this)}setOptions(e){let t=this.options,r=this.#s;if(this.options=this.#e.defaultQueryOptions(e),void 0!==this.options.enabled&&"boolean"!=typeof this.options.enabled&&"function"!=typeof this.options.enabled&&"boolean"!=typeof(0,u.resolveEnabled)(this.options.enabled,this.#s))throw Error("Expected enabled to be a boolean or a callback that returns a boolean");this.#S(),this.#s.setOptions(this.options),t._defaulted&&!(0,u.shallowEqualObjects)(this.options,t)&&this.#e.getQueryCache().notify({type:"observerOptionsUpdated",query:this.#s,observer:this});let s=this.hasListeners();s&&y(this.#s,r,this.options,t)&&this.#p(),this.updateResult(),s&&(this.#s!==r||(0,u.resolveEnabled)(this.options.enabled,this.#s)!==(0,u.resolveEnabled)(t.enabled,this.#s)||(0,u.resolveStaleTime)(this.options.staleTime,this.#s)!==(0,u.resolveStaleTime)(t.staleTime,this.#s))&&this.#F();let i=this.#g();s&&(this.#s!==r||(0,u.resolveEnabled)(this.options.enabled,this.#s)!==(0,u.resolveEnabled)(t.enabled,this.#s)||i!==this.#y)&&this.#w(i)}getOptimisticResult(e){var t,r;let s=this.#e.getQueryCache().build(this.#e,e),i=this.createResult(s,e);return t=this,r=i,(0,u.shallowEqualObjects)(t.getCurrentResult(),r)||(this.#n=i,this.#o=this.options,this.#a=this.#s.state),i}getCurrentResult(){return this.#n}trackResult(e,t){return new Proxy(e,{get:(e,r)=>(this.trackProp(r),t?.(r),"promise"===r&&(this.trackProp("data"),this.options.experimental_prefetchInRender||"pending"!==this.#r.status||this.#r.reject(Error("experimental_prefetchInRender feature flag is not enabled"))),Reflect.get(e,r))})}trackProp(e){this.#f.add(e)}getCurrentQuery(){return this.#s}refetch({...e}={}){return this.fetch({...e})}fetchOptimistic(e){let t=this.#e.defaultQueryOptions(e),r=this.#e.getQueryCache().build(this.#e,t);return r.fetch().then(()=>this.createResult(r,t))}fetch(e){return this.#p({...e,cancelRefetch:e.cancelRefetch??!0}).then(()=>(this.updateResult(),this.#n))}#p(e){this.#S();let t=this.#s.fetch(this.options,e);return e?.throwOnError||(t=t.catch(u.noop)),t}#F(){this.#v();let e=(0,u.resolveStaleTime)(this.options.staleTime,this.#s);if(u.isServer||this.#n.isStale||!(0,u.isValidTimeout)(e))return;let t=(0,u.timeUntilStale)(this.#n.dataUpdatedAt,e);this.#h=c.timeoutManager.setTimeout(()=>{this.#n.isStale||this.updateResult()},t+1)}#g(){return("function"==typeof this.options.refetchInterval?this.options.refetchInterval(this.#s):this.options.refetchInterval)??!1}#w(e){this.#b(),this.#y=e,!u.isServer&&!1!==(0,u.resolveEnabled)(this.options.enabled,this.#s)&&(0,u.isValidTimeout)(this.#y)&&0!==this.#y&&(this.#d=c.timeoutManager.setInterval(()=>{(this.options.refetchIntervalInBackground||s.focusManager.isFocused())&&this.#p()},this.#y))}#m(){this.#F(),this.#w(this.#g())}#v(){this.#h&&(c.timeoutManager.clearTimeout(this.#h),this.#h=void 0)}#b(){this.#d&&(c.timeoutManager.clearInterval(this.#d),this.#d=void 0)}createResult(e,t){let r,s=this.#s,i=this.options,a=this.#n,c=this.#a,l=this.#o,d=e!==s?e.state:this.#i,{state:p}=e,m={...p},v=!1;if(t._optimisticResults){let r=this.hasListeners(),a=!r&&h(e,t),o=r&&y(e,s,t,i);(a||o)&&(m={...m,...(0,n.fetchState)(p.data,e.options)}),"isRestoring"===t._optimisticResults&&(m.fetchStatus="idle")}let{error:b,errorUpdatedAt:S,status:F}=m;r=m.data;let g=!1;if(void 0!==t.placeholderData&&void 0===r&&"pending"===F){let e;a?.isPlaceholderData&&t.placeholderData===l?.placeholderData?(e=a.data,g=!0):e="function"==typeof t.placeholderData?t.placeholderData(this.#l?.state.data,this.#l):t.placeholderData,void 0!==e&&(F="success",r=(0,u.replaceData)(a?.data,e,t),v=!0)}if(t.select&&void 0!==r&&!g)if(a&&r===c?.data&&t.select===this.#u)r=this.#c;else try{this.#u=t.select,r=t.select(r),r=(0,u.replaceData)(a?.data,r,t),this.#c=r,this.#t=null}catch(e){this.#t=e}this.#t&&(b=this.#t,r=this.#c,S=Date.now(),F="error");let w="fetching"===m.fetchStatus,Q="pending"===F,R="error"===F,E=Q&&w,q=void 0!==r,C={status:F,fetchStatus:m.fetchStatus,isPending:Q,isSuccess:"success"===F,isError:R,isInitialLoading:E,isLoading:E,data:r,dataUpdatedAt:m.dataUpdatedAt,error:b,errorUpdatedAt:S,failureCount:m.fetchFailureCount,failureReason:m.fetchFailureReason,errorUpdateCount:m.errorUpdateCount,isFetched:m.dataUpdateCount>0||m.errorUpdateCount>0,isFetchedAfterMount:m.dataUpdateCount>d.dataUpdateCount||m.errorUpdateCount>d.errorUpdateCount,isFetching:w,isRefetching:w&&!Q,isLoadingError:R&&!q,isPaused:"paused"===m.fetchStatus,isPlaceholderData:v,isRefetchError:R&&q,isStale:f(e,t),refetch:this.refetch,promise:this.#r,isEnabled:!1!==(0,u.resolveEnabled)(t.enabled,e)};if(this.options.experimental_prefetchInRender){let t=void 0!==C.data,r="error"===C.status&&!t,i=e=>{r?e.reject(C.error):t&&e.resolve(C.data)},n=()=>{i(this.#r=C.promise=(0,o.pendingThenable)())},a=this.#r;switch(a.status){case"pending":e.queryHash===s.queryHash&&i(a);break;case"fulfilled":(r||C.data!==a.value)&&n();break;case"rejected":r&&C.error===a.reason||n()}}return C}updateResult(){let e=this.#n,t=this.createResult(this.#s,this.options);if(this.#a=this.#s.state,this.#o=this.options,void 0!==this.#a.data&&(this.#l=this.#s),(0,u.shallowEqualObjects)(t,e))return;this.#n=t;let r=()=>{if(!e)return!0;let{notifyOnChangeProps:t}=this.options,r="function"==typeof t?t():t;if("all"===r||!r&&!this.#f.size)return!0;let s=new Set(r??this.#f);return this.options.throwOnError&&s.add("error"),Object.keys(this.#n).some(t=>this.#n[t]!==e[t]&&s.has(t))};this.#Q({listeners:r()})}#S(){let e=this.#e.getQueryCache().build(this.#e,this.options);if(e===this.#s)return;let t=this.#s;this.#s=e,this.#i=e.state,this.hasListeners()&&(t?.removeObserver(this),e.addObserver(this))}onQueryUpdate(){this.updateResult(),this.hasListeners()&&this.#m()}#Q(e){i.notifyManager.batch(()=>{e.listeners&&this.listeners.forEach(e=>{e(this.#n)}),this.#e.getQueryCache().notify({query:this.#s,type:"observerResultsUpdated"})})}};function h(e,t){return!1!==(0,u.resolveEnabled)(t.enabled,e)&&void 0===e.state.data&&("error"!==e.state.status||!1!==t.retryOnMount)||void 0!==e.state.data&&d(e,t,t.refetchOnMount)}function d(e,t,r){if(!1!==(0,u.resolveEnabled)(t.enabled,e)&&"static"!==(0,u.resolveStaleTime)(t.staleTime,e)){let s="function"==typeof r?r(e):r;return"always"===s||!1!==s&&f(e,t)}return!1}function y(e,t,r,s){return(e!==t||!1===(0,u.resolveEnabled)(s.enabled,e))&&(!r.suspense||"error"!==e.state.status)&&f(e,r)}function f(e,t){return!1!==(0,u.resolveEnabled)(t.enabled,e)&&e.isStaleByTime((0,u.resolveStaleTime)(t.staleTime,e))}var p=e.i(4),m=e.i(1235);e.i(27493);var v=p.createContext((t=!1,{clearReset:()=>{t=!1},reset:()=>{t=!0},isReset:()=>t})),b=p.createContext(!1);b.Provider;var S=(e,t,r)=>t.fetchOptimistic(e).catch(()=>{r.clearReset()});function F(e,t){return function(e,t,r){let s,n=p.useContext(b),a=p.useContext(v),o=(0,m.useQueryClient)(r),c=o.defaultQueryOptions(e);o.getDefaultOptions().queries?._experimental_beforeQuery?.(c);let l=o.getQueryCache().get(c.queryHash);if(c._optimisticResults=n?"isRestoring":"optimistic",c.suspense){let e=e=>"static"===e?e:Math.max(e??1e3,1e3),t=c.staleTime;c.staleTime="function"==typeof t?(...r)=>e(t(...r)):e(t),"number"==typeof c.gcTime&&(c.gcTime=Math.max(c.gcTime,1e3))}s=l?.state.error&&"function"==typeof c.throwOnError?(0,u.shouldThrowError)(c.throwOnError,[l.state.error,l]):c.throwOnError,(c.suspense||c.experimental_prefetchInRender||s)&&!a.isReset()&&(c.retryOnMount=!1),p.useEffect(()=>{a.clearReset()},[a]);let h=!o.getQueryCache().get(c.queryHash),[d]=p.useState(()=>new t(o,c)),y=d.getOptimisticResult(c),f=!n&&!1!==e.subscribed;if(p.useSyncExternalStore(p.useCallback(e=>{let t=f?d.subscribe(i.notifyManager.batchCalls(e)):u.noop;return d.updateResult(),t},[d,f]),()=>d.getCurrentResult(),()=>d.getCurrentResult()),p.useEffect(()=>{d.setOptions(c)},[c,d]),c?.suspense&&y.isPending)throw S(c,d,a);if((({result:e,errorResetBoundary:t,throwOnError:r,query:s,suspense:i})=>e.isError&&!t.isReset()&&!e.isFetching&&s&&(i&&void 0===e.data||(0,u.shouldThrowError)(r,[e.error,s])))({result:y,errorResetBoundary:a,throwOnError:c.throwOnError,query:l,suspense:c.suspense}))throw y.error;if(o.getDefaultOptions().queries?._experimental_afterQuery?.(c,y),c.experimental_prefetchInRender&&!u.isServer&&y.isLoading&&y.isFetching&&!n){let e=h?S(c,d,a):l?.promise;e?.catch(u.noop).finally(()=>{d.updateResult()})}return c.notifyOnChangeProps?y:d.trackResult(y)}(e,l,t)}e.s(["useQuery",()=>F],45688);var g=e.i(21230),w=a,Q=class extends w.Subscribable{#e;#n=void 0;#R;#E;constructor(e,t){super(),this.#e=e,this.setOptions(t),this.bindMethods(),this.#q()}bindMethods(){this.mutate=this.mutate.bind(this),this.reset=this.reset.bind(this)}setOptions(e){let t=this.options;this.options=this.#e.defaultMutationOptions(e),(0,u.shallowEqualObjects)(this.options,t)||this.#e.getMutationCache().notify({type:"observerOptionsUpdated",mutation:this.#R,observer:this}),t?.mutationKey&&this.options.mutationKey&&(0,u.hashKey)(t.mutationKey)!==(0,u.hashKey)(this.options.mutationKey)?this.reset():this.#R?.state.status==="pending"&&this.#R.setOptions(this.options)}onUnsubscribe(){this.hasListeners()||this.#R?.removeObserver(this)}onMutationUpdate(e){this.#q(),this.#Q(e)}getCurrentResult(){return this.#n}reset(){this.#R?.removeObserver(this),this.#R=void 0,this.#q(),this.#Q()}mutate(e,t){return this.#E=t,this.#R?.removeObserver(this),this.#R=this.#e.getMutationCache().build(this.#e,this.options),this.#R.addObserver(this),this.#R.execute(e)}#q(){let e=this.#R?.state??(0,g.getDefaultState)();this.#n={...e,isPending:"pending"===e.status,isSuccess:"success"===e.status,isError:"error"===e.status,isIdle:"idle"===e.status,mutate:this.mutate,reset:this.reset}}#Q(e){i.notifyManager.batch(()=>{if(this.#E&&this.hasListeners()){let t=this.#n.variables,r=this.#n.context,s={client:this.#e,meta:this.options.meta,mutationKey:this.options.mutationKey};if(e?.type==="success"){try{this.#E.onSuccess?.(e.data,t,r,s)}catch(e){Promise.reject(e)}try{this.#E.onSettled?.(e.data,null,t,r,s)}catch(e){Promise.reject(e)}}else if(e?.type==="error"){try{this.#E.onError?.(e.error,t,r,s)}catch(e){Promise.reject(e)}try{this.#E.onSettled?.(void 0,e.error,t,r,s)}catch(e){Promise.reject(e)}}}this.listeners.forEach(e=>{e(this.#n)})})}};function R(e,t){let r=(0,m.useQueryClient)(t),[s]=p.useState(()=>new Q(r,e));p.useEffect(()=>{s.setOptions(e)},[s,e]);let n=p.useSyncExternalStore(p.useCallback(e=>s.subscribe(i.notifyManager.batchCalls(e)),[s]),()=>s.getCurrentResult(),()=>s.getCurrentResult()),a=p.useCallback((e,t)=>{s.mutate(e,t).catch(u.noop)},[s]);if(n.error&&(0,u.shouldThrowError)(s.options.throwOnError,[n.error]))throw n.error;return{...n,mutate:a,mutateAsync:n.mutate}}e.s(["useMutation",()=>R],71921);var E=e.i(88969);let q=r.default.env.NEXT_PUBLIC_WS_URL||"ws://localhost:3001/ws/events";function C(e={}){let{enabled:t=!0,onMessage:r}=e,s=(0,m.useQueryClient)(),i=(0,p.useRef)(null),n=(0,p.useRef)(null),a=(0,p.useRef)(0),o=(0,p.useRef)(1e3),u=(0,p.useRef)(()=>{}),[c,l]=(0,p.useState)(!1),[h,d]=(0,p.useState)(null),y=(0,p.useRef)(r);(0,p.useEffect)(()=>{y.current=r},[r]);let f=(0,p.useCallback)(async()=>{if(t&&i.current?.readyState!==WebSocket.OPEN){n.current&&(clearTimeout(n.current),n.current=null);try{let e=await (0,E.getApiToken)(),r=`${q}?token=${encodeURIComponent(e)}`,c=new WebSocket(r);i.current=c,c.onopen=()=>{l(!0),a.current=0,o.current=1e3,console.log("[WebSocket] Connected to memory server")},c.onmessage=e=>{try{let t=JSON.parse(e.data);switch(d({type:t.type,data:t.data,timestamp:t.timestamp||new Date().toISOString()}),y.current?.(t),t.type){case"initial_state":case"consolidation_complete":case"predictive_consolidation":s.invalidateQueries({queryKey:["memories"]}),s.invalidateQueries({queryKey:["stats"]}),s.invalidateQueries({queryKey:["links"]});break;case"memory_created":case"memory_updated":case"memory_deleted":s.invalidateQueries({queryKey:["memories"]}),s.invalidateQueries({queryKey:["stats"]});break;case"decay_tick":case"worker_light_tick":case"worker_medium_tick":break;case"link_discovered":s.invalidateQueries({queryKey:["links"]});break;case"defence_event":s.invalidateQueries({queryKey:["agents"]}),s.invalidateQueries({queryKey:["agent-timeline"]}),s.invalidateQueries({queryKey:["audit-logs"]}),s.invalidateQueries({queryKey:["audit-stats"]});break;case"kill_switch_activated":case"kill_switch_deactivated":s.invalidateQueries({queryKey:["control-status"]}),s.invalidateQueries({queryKey:["iron-dome-status"]}),s.invalidateQueries({queryKey:["iron-dome-audit"]});break;case"update_started":case"update_complete":case"update_failed":"update_complete"===t.type&&(s.invalidateQueries({queryKey:["version"]}),s.invalidateQueries({queryKey:["version-check"]}));break;case"server_restarting":console.log("[WebSocket] Server restarting, will reconnect shortly...")}}catch(e){console.error("[WebSocket] Failed to parse message:",e)}},c.onerror=()=>{console.warn("[WebSocket] Connection failed - is the API server running?")},c.onclose=()=>{if(l(!1),console.log("[WebSocket] Disconnected"),t&&a.current<10){let e=o.current;a.current++,o.current=Math.min(2*o.current,3e4),console.log(`[WebSocket] Reconnecting in ${e}ms (attempt ${a.current}/10)...`),n.current=setTimeout(()=>{u.current()},e)}else a.current>=10&&console.error("[WebSocket] Max reconnection attempts reached. Use reconnect() to try again.")}}catch(e){console.error("[WebSocket] Failed to connect:",e)}}},[t,s]);return(0,p.useEffect)(()=>{u.current=f}),(0,p.useEffect)(()=>(t&&f(),()=>{n.current&&clearTimeout(n.current),i.current&&(i.current.close(),i.current=null)}),[t,f]),{isConnected:c,lastEvent:h,reconnect:(0,p.useCallback)(()=>{a.current=0,o.current=1e3,f()},[f])}}e.s(["useMemoryWebSocket",()=>C],94156);let O=r.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function k(e){let t=new URLSearchParams;e?.project&&t.set("project",e.project),e?.type&&t.set("type",e.type),e?.category&&t.set("category",e.category),e?.limit&&t.set("limit",e.limit.toString()),e?.offset&&t.set("offset",e.offset.toString()),e?.mode&&t.set("mode",e.mode),e?.query&&t.set("query",e.query);let r=await (0,E.authFetch)(`${O}/api/memories?${t}`);if(!r.ok)throw Error("Failed to fetch memories");return r.json()}async function T(e){let t=e?`?project=${e}`:"",r=await (0,E.authFetch)(`${O}/api/stats${t}`);if(!r.ok)throw Error("Failed to fetch stats");return r.json()}async function j(e){let t=e?`?project=${e}`:"",r=await (0,E.authFetch)(`${O}/api/links${t}`);if(!r.ok)throw Error("Failed to fetch links");return r.json()}async function M(){let e=await (0,E.authFetch)(`${O}/api/projects`);if(!e.ok)throw Error("Failed to fetch projects");return e.json()}async function I(){let e=await (0,E.authFetch)(`${O}/api/capture/openclaw/sessions`);if(!e.ok)throw Error("Failed to fetch OpenClaw sessions");return e.json()}async function P(e){let t=await (0,E.authFetch)(`${O}/api/memories/${e}/access`,{method:"POST"});if(!t.ok)throw Error("Failed to access memory");return t.json()}async function K(){let e=await (0,E.authFetch)(`${O}/api/consolidate`,{method:"POST"});if(!e.ok)throw Error("Failed to consolidate");return e.json()}function $(e){return F({queryKey:["stats",e],queryFn:()=>T(e),refetchInterval:3e4})}function _(e){return F({queryKey:["links",e],queryFn:()=>j(e),refetchInterval:6e4})}function x(){return F({queryKey:["projects"],queryFn:M,refetchInterval:6e4})}function D(){return F({queryKey:["openclaw-sessions"],queryFn:I,staleTime:3e4})}function U(e){let t,r=C();return{...{...t=F({queryKey:["memories",e],queryFn:()=>k(e),refetchInterval:3e4}),data:t.data?.memories,pagination:t.data?.pagination},isConnected:r.isConnected,lastEvent:r.lastEvent}}function L(){let e=(0,m.useQueryClient)();return R({mutationFn:P,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function B(){let e=(0,m.useQueryClient)();return R({mutationFn:K,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}async function A(){let e=await (0,E.authFetch)(`${O}/api/control/status`);if(!e.ok)throw Error("Failed to fetch control status");return e.json()}async function W(){let e=await (0,E.authFetch)(`${O}/api/control/pause`,{method:"POST"});if(!e.ok)throw Error("Failed to pause");return e.json()}async function z(){let e=await (0,E.authFetch)(`${O}/api/control/resume`,{method:"POST"});if(!e.ok)throw Error("Failed to resume");return e.json()}function N(){return F({queryKey:["control-status"],queryFn:A,refetchInterval:1e4})}function V(){let e=(0,m.useQueryClient)();return R({mutationFn:W,onSuccess:()=>{e.invalidateQueries({queryKey:["control-status"]})}})}function J(){let e=(0,m.useQueryClient)();return R({mutationFn:z,onSuccess:()=>{e.invalidateQueries({queryKey:["control-status"]})}})}async function H(){let e=await (0,E.authFetch)(`${O}/api/version`);if(!e.ok)throw Error("Failed to fetch version");return e.json()}function X(){return F({queryKey:["version"],queryFn:H,refetchInterval:6e4,staleTime:3e4})}async function G(e){let t=e?`?project=${e}`:"",r=await (0,E.authFetch)(`${O}/api/memories/quality${t}`);if(!r.ok)throw Error("Failed to fetch quality");return r.json()}function Y(e){return F({queryKey:["quality",e],queryFn:()=>G(e),staleTime:3e5})}async function Z(e){let t=e?`?project=${e}`:"",r=await (0,E.authFetch)(`${O}/api/contradictions${t}`);if(!r.ok)throw Error("Failed to fetch contradictions");return r.json()}function ee(e){return F({queryKey:["contradictions",e],queryFn:()=>Z(e),staleTime:3e5})}async function et(e){let t=await (0,E.authFetch)(`${O}/api/memories/${e}/boost`,{method:"POST"});if(!t.ok)throw Error("Failed to boost memory");return t.json()}async function er(e){let t=await (0,E.authFetch)(`${O}/api/memories/${e}/demote`,{method:"POST"});if(!t.ok)throw Error("Failed to demote memory");return t.json()}async function es(e){let t=await (0,E.authFetch)(`${O}/api/memories/${e}/promote`,{method:"POST"});if(!t.ok)throw Error("Failed to promote memory");return t.json()}async function ei(e,t){let r=await (0,E.authFetch)(`${O}/api/memories/${e}`,{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});if(!r.ok)throw Error("Failed to edit memory");return r.json()}async function en(e){let t=await (0,E.authFetch)(`${O}/api/memories/${e}`,{method:"DELETE"});if(!t.ok)throw Error("Failed to delete memory");return t.json()}async function ea(e,t){let r=await (0,E.authFetch)(`${O}/api/memories/${e}/quarantine`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reason:t})});if(!r.ok)throw Error("Failed to quarantine memory");return r.json()}async function eo(){let e=await (0,E.authFetch)(`${O}/api/worker/status`);if(!e.ok)throw Error("Failed to fetch worker status");return e.json()}function eu(){let e=(0,m.useQueryClient)();return R({mutationFn:et,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function ec(){let e=(0,m.useQueryClient)();return R({mutationFn:er,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function el(){let e=(0,m.useQueryClient)();return R({mutationFn:es,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function eh(){let e=(0,m.useQueryClient)();return R({mutationFn:({id:e,updates:t})=>ei(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function ed(){let e=(0,m.useQueryClient)();return R({mutationFn:en,onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]}),e.invalidateQueries({queryKey:["links"]})}})}function ey(){let e=(0,m.useQueryClient)();return R({mutationFn:({id:e,reason:t})=>ea(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:["memories"]}),e.invalidateQueries({queryKey:["stats"]})}})}function ef(){return F({queryKey:["worker-status"],queryFn:eo,refetchInterval:15e3})}e.s(["useAccessMemory",()=>L,"useBoostMemory",()=>eu,"useConsolidate",()=>B,"useContradictions",()=>ee,"useControlStatus",()=>N,"useDeleteMemory",()=>ed,"useDemoteMemory",()=>ec,"useEditMemory",()=>eh,"useMemoriesWithRealtime",()=>U,"useMemoryLinks",()=>_,"useOpenClawSessions",()=>D,"usePauseMemory",()=>V,"useProjects",()=>x,"usePromoteMemory",()=>el,"useQuality",()=>Y,"useQuarantineMemory",()=>ey,"useResumeMemory",()=>J,"useStats",()=>$,"useVersion",()=>X,"useWorkerStatus",()=>ef],88069)},42098,92618,e=>{"use strict";let t;var r=e.i(4);let s=e=>{let t,r=new Set,s=(e,s)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=s?s:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,n={setState:s,getState:i,getInitialState:()=>a,subscribe:e=>(r.add(e),()=>r.delete(e))},a=t=e(s,i,n);return n},i=e=>e?s(e):s;e.s(["createStore",()=>i],92618);let n=e=>{let t=i(e),s=e=>(function(e,t=e=>e){let s=r.default.useSyncExternalStore(e.subscribe,r.default.useCallback(()=>t(e.getState()),[e,t]),r.default.useCallback(()=>t(e.getInitialState()),[e,t]));return r.default.useDebugValue(s),s})(t,e);return Object.assign(s,t),s},a=(t=e=>({selectedMemory:null,setSelectedMemory:t=>e({selectedMemory:t}),selectedAuditEntry:null,setSelectedAuditEntry:t=>e({selectedAuditEntry:t}),viewMode:"overview",setViewMode:t=>e({viewMode:t}),typeFilter:null,categoryFilter:null,projectFilter:null,setTypeFilter:t=>e({typeFilter:t}),setCategoryFilter:t=>e({categoryFilter:t}),setProjectFilter:t=>e({projectFilter:t}),reviewFocus:null,setReviewFocus:t=>e({reviewFocus:t}),recentEvents:[],addEvent:t=>e(e=>({recentEvents:[t,...e.recentEvents].slice(0,50)})),clearEvents:()=>e({recentEvents:[]}),cameraPosition:[0,0,12],setCameraPosition:t=>e({cameraPosition:t}),showLeftSidebar:!0,showRightSidebar:!0,toggleLeftSidebar:()=>e(e=>({showLeftSidebar:!e.showLeftSidebar})),toggleRightSidebar:()=>e(e=>({showRightSidebar:!e.showRightSidebar})),searchQuery:"",setSearchQuery:t=>e({searchQuery:t})}))?n(t):n;e.s(["useDashboardStore",0,a],42098)},97358,33368,e=>{"use strict";let t={architecture:"#FFD700",pattern:"#FFB347",preference:"#FFA500",error:"#FF6B6B",context:"#FFC080",learning:"#FFE4B5",todo:"#FF8C00",note:"#FFCC66",relationship:"#00D4FF",custom:"#FFB347"},r={short_term:"#FFD700",episodic:"#FFB347",long_term:"#FF8C00"};function s(e){return t[e]||t.custom}function i(e){return r[e]||r.short_term}e.s(["CATEGORY_COLORS",0,{architecture:"#3B82F6",pattern:"#8B5CF6",preference:"#EC4899",error:"#EF4444",context:"#10B981",learning:"#F59E0B",todo:"#F97316",note:"#6B7280",relationship:"#06B6D4",custom:"#A855F7"},"getCategoryColor",()=>s,"getTypeColor",()=>i],97358);let n={architecture:{basePosition:{x:0,y:1.2,z:2.2},spread:1},pattern:{basePosition:{x:0,y:.3,z:-2.2},spread:.9},preference:{basePosition:{x:1.6,y:-.3,z:0},spread:.7},error:{basePosition:{x:-1.6,y:-.3,z:.3},spread:.8},context:{basePosition:{x:0,y:1.8,z:0},spread:1.2},learning:{basePosition:{x:0,y:-.3,z:0},spread:.8},todo:{basePosition:{x:.6,y:.8,z:1.8},spread:.7},note:{basePosition:{x:1.8,y:0,z:-.3},spread:1},relationship:{basePosition:{x:-1.8,y:.3,z:-.3},spread:.9},custom:{basePosition:{x:0,y:0,z:0},spread:1.5}},a={short_term:.6,episodic:0,long_term:-.4};function o(e){let t=43758.5453*Math.sin(12.9898*e);return t-Math.floor(t)}function u(e){let t=n[e.category]||n.custom,r=a[e.type]||0,s=o(e.id),i=o(e.id+1e3),u=o(e.id+2e3),c=t.spread,l=s*Math.PI*2,h=(i-.5)*Math.PI,d=u*c*.7+.3*c,y=d*Math.cos(h)*Math.cos(l),f=d*Math.sin(h)*.6,p=d*Math.cos(h)*Math.sin(l),m=t.basePosition.x+y,v=t.basePosition.y+f,b=t.basePosition.z+p+r,S=.4*e.salience,F=Math.sqrt(m*m+v*v+b*b);if(F>.1){let e=(F+S)/F;m*=e,v*=e,b*=e}let g=Math.sqrt((m/3.2)**2+(v/2.5)**2+(b/3.5)**2);if(g>.95){let e=.95/g;m*=e,v*=e,b*=e}return{x:m,y:v,z:b}}function c(e){if(!e.lastAccessed)return 1;let t=Date.now(),r=new Date(e.lastAccessed).getTime();return Math.pow({short_term:.995,long_term:.9995,episodic:.998}[e.type]||.995,(t-r)/36e5)}e.s(["calculateDecayFactor",()=>c,"calculateMemoryPosition",()=>u],33368)},87353,e=>{"use strict";var t=e.i(22534),r=e.i(45688),s=e.i(71921),i=e.i(1235),n=e.i(88969);let a=t.default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001";async function o(e){let t=new URLSearchParams;e?.startTime&&t.set("startTime",e.startTime),e?.endTime&&t.set("endTime",e.endTime),e?.source&&t.set("source",e.source),e?.firewallResult&&t.set("firewallResult",e.firewallResult),e?.project&&t.set("project",e.project),e?.limit&&t.set("limit",e.limit.toString());let r=await (0,n.authFetch)(`${a}/api/v1/audit?${t}`);if(!r.ok)throw Error("Failed to fetch audit logs");return r.json()}async function u(e,t){let r=new URLSearchParams({timeRange:e});t&&r.set("project",t);let s=await (0,n.authFetch)(`${a}/api/v1/audit/stats?${r}`);if(!s.ok)throw Error("Failed to fetch audit stats");return s.json()}async function c(e="pending",t=50,r){let s=new URLSearchParams({status:e,limit:t.toString()});r&&s.set("project",r);let i=await (0,n.authFetch)(`${a}/api/v1/quarantine?${s}`);if(!i.ok)throw Error("Failed to fetch quarantine");return i.json()}async function l(e){let t=await (0,n.authFetch)(`${a}/api/v1/quarantine/${e}/approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard"})});if(!t.ok)throw Error("Failed to approve");return t.json()}async function h(e,t){let r=await (0,n.authFetch)(`${a}/api/v1/quarantine/${e}/reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({reviewedBy:"dashboard",notes:t})});if(!r.ok)throw Error("Failed to reject");return r.json()}async function d(e){let t=await (0,n.authFetch)(`${a}/api/v1/quarantine/bulk-approve`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e,reviewedBy:"dashboard"})});if(!t.ok)throw Error("Failed to bulk approve");return t.json()}async function y(e){let t=await (0,n.authFetch)(`${a}/api/v1/quarantine/bulk-reject`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({ids:e,reviewedBy:"dashboard"})});if(!t.ok)throw Error("Failed to bulk reject");return t.json()}function f(e){return(0,r.useQuery)({queryKey:["audit-logs",e],queryFn:()=>o(e),refetchInterval:3e4,retry:2})}function p(e="24h",t){return(0,r.useQuery)({queryKey:["audit-stats",e,t],queryFn:()=>u(e,t),refetchInterval:3e4,retry:2})}function m(e="pending",t=50,s){return(0,r.useQuery)({queryKey:["quarantine",e,t,s],queryFn:()=>c(e,t,s),refetchInterval:3e4,retry:2})}function v(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:l,onSuccess:()=>{e.invalidateQueries({queryKey:["quarantine"]}),e.invalidateQueries({queryKey:["audit-stats"]})}})}function b(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:({id:e,notes:t})=>h(e,t),onSuccess:()=>{e.invalidateQueries({queryKey:["quarantine"]}),e.invalidateQueries({queryKey:["audit-stats"]})}})}function S(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:d,onSuccess:()=>{e.invalidateQueries({queryKey:["quarantine"]}),e.invalidateQueries({queryKey:["audit-stats"]})}})}function F(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:y,onSuccess:()=>{e.invalidateQueries({queryKey:["quarantine"]}),e.invalidateQueries({queryKey:["audit-stats"]})}})}function g(){return(0,r.useQuery)({queryKey:["defence-config"],queryFn:()=>(0,n.authFetch)(`${a}/api/defence/config`).then(e=>e.json())})}function w(){let e=(0,i.useQueryClient)();return(0,s.useMutation)({mutationFn:e=>(0,n.authFetch)(`${a}/api/defence/config`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({mode:e})}).then(e=>e.json()),onSuccess:()=>{e.invalidateQueries({queryKey:["defence-config"]})}})}e.s(["useApproveQuarantine",()=>v,"useAuditLogs",()=>f,"useAuditStats",()=>p,"useBulkApproveQuarantine",()=>S,"useBulkRejectQuarantine",()=>F,"useDefenceConfig",()=>g,"useQuarantine",()=>m,"useRejectQuarantine",()=>b,"useSetDefenceMode",()=>w])},5960,(e,t,r)=>{"use strict";var s=e.r(4),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},n=s.useState,a=s.useEffect,o=s.useLayoutEffect,u=s.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var l="u"<typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),s=n({inst:{value:r,getSnapshot:t}}),i=s[0].inst,l=s[1];return o(function(){i.value=r,i.getSnapshot=t,c(i)&&l({inst:i})},[e,r,t]),a(function(){return c(i)&&l({inst:i}),e(function(){c(i)&&l({inst:i})})},[e]),u(r),r};r.useSyncExternalStore=void 0!==s.useSyncExternalStore?s.useSyncExternalStore:l},89782,(e,t,r)=>{"use strict";t.exports=e.r(5960)},75812,(e,t,r)=>{"use strict";var s=e.r(4),i=e.r(89782),n="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},a=i.useSyncExternalStore,o=s.useRef,u=s.useEffect,c=s.useMemo,l=s.useDebugValue;r.useSyncExternalStoreWithSelector=function(e,t,r,s,i){var h=o(null);if(null===h.current){var d={hasValue:!1,value:null};h.current=d}else d=h.current;var y=a(e,(h=c(function(){function e(e){if(!u){if(u=!0,a=e,e=s(e),void 0!==i&&d.hasValue){var t=d.value;if(i(t,e))return o=t}return o=e}if(t=o,n(a,e))return t;var r=s(e);return void 0!==i&&i(t,r)?(a=e,t):(a=e,o=r)}var a,o,u=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,s,i]))[0],h[1]);return u(function(){d.hasValue=!0,d.value=y},[y]),l(y),y}},27688,(e,t,r)=>{"use strict";t.exports=e.r(75812)}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,88969,e=>{"use strict";let t=e.i(22534).default.env.NEXT_PUBLIC_API_URL||"http://localhost:3001",r=null,n=null;async function a(){if(r)return r;if(n)return n;n=(async()=>{let e=await fetch(`${t}/api/auth/session-token`);if(!e.ok)throw Error((await e.json().catch(()=>({}))).error||"Failed to fetch session token");let{token:n}=await e.json();return r=n,n})();try{return await n}finally{n=null}}async function i(e,t){let r=await a(),n=new Headers(t?.headers);return n.set("Authorization",`Bearer ${r}`),fetch(e,{...t,headers:n})}class o extends Error{feature;requiredTier;constructor(e,t){super(`Feature locked: ${e}`),this.name="FeatureLockedError",this.feature=e,this.requiredTier=t}}async function l(e,t){let r=await i(e,t);if(403===r.status){let e=await r.json().catch(()=>({}));if("FEATURE_GATED"===e.code)throw new o(e.feature,e.requiredTier)}return r}e.s(["FeatureLockedError",()=>o,"authFetch",()=>i,"gatedFetch",()=>l,"getApiToken",()=>a])},25903,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"BailoutToCSR",{enumerable:!0,get:function(){return a}});let n=e.r(40909);function a({reason:e,children:t}){if("u"<typeof window)throw Object.defineProperty(new n.BailoutToCSRError(e),"__NEXT_ERROR_CODE",{value:"E394",enumerable:!1,configurable:!0});return t}},27601,(e,t,r)=>{"use strict";function n(e){return e.split("/").map(e=>encodeURIComponent(e)).join("/")}Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"encodeURIPath",{enumerable:!0,get:function(){return n}})},54220,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"PreloadChunks",{enumerable:!0,get:function(){return s}});let n=e.r(27493),a=e.r(9854),i=e.r(13595),o=e.r(27601),l=e.r(54218);function s({moduleIds:e}){if("u">typeof window)return null;let t=i.workAsyncStorage.getStore();if(void 0===t)return null;let r=[];if(t.reactLoadableManifest&&e){let n=t.reactLoadableManifest;for(let t of e){if(!n[t])continue;let e=n[t].files;r.push(...e)}}if(0===r.length)return null;let s=(0,l.getDeploymentIdQueryOrEmptyString)();return(0,n.jsx)(n.Fragment,{children:r.map(e=>{let r=`${t.assetPrefix}/_next/${(0,o.encodeURIPath)(e)}${s}`;return e.endsWith(".css")?(0,n.jsx)("link",{precedence:"dynamic",href:r,rel:"stylesheet",as:"style",nonce:t.nonce},e):((0,a.preload)(r,{as:"script",fetchPriority:"low",nonce:t.nonce}),null)})})}},73735,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return u}});let n=e.r(27493),a=e.r(4),i=e.r(25903),o=e.r(54220);function l(e){return{default:e&&"default"in e?e.default:e}}let s={loader:()=>Promise.resolve(l(()=>null)),loading:null,ssr:!0},u=function(e){let t={...s,...e},r=(0,a.lazy)(()=>t.loader().then(l)),u=t.loading;function f(e){let l=u?(0,n.jsx)(u,{isLoading:!0,pastDelay:!0,error:null}):null,s=!t.ssr||!!t.loading,f=s?a.Suspense:a.Fragment,c=t.ssr?(0,n.jsxs)(n.Fragment,{children:["u"<typeof window?(0,n.jsx)(o.PreloadChunks,{moduleIds:t.modules}):null,(0,n.jsx)(r,{...e})]}):(0,n.jsx)(i.BailoutToCSR,{reason:"next/dynamic",children:(0,n.jsx)(r,{...e})});return(0,n.jsx)(f,{...s?{fallback:l}:{},children:c})}return f.displayName="LoadableComponent",f}},13132,(e,t,r)=>{"use strict";Object.defineProperty(r,"__esModule",{value:!0}),Object.defineProperty(r,"default",{enumerable:!0,get:function(){return a}});let n=e.r(77637)._(e.r(73735));function a(e,t){let r={};"function"==typeof e&&(r.loader=e);let a={...r,...t};return(0,n.default)({...a,modules:a.loadableGenerated?.modules})}("function"==typeof r.default||"object"==typeof r.default&&null!==r.default)&&void 0===r.default.__esModule&&(Object.defineProperty(r.default,"__esModule",{value:!0}),Object.assign(r.default,r),t.exports=r.default)},6847,24929,17278,e=>{"use strict";var t=e.i(4);let r=e=>{let t=e.replace(/^([A-Z])|[\s-_]+(\w)/g,(e,t,r)=>r?r.toUpperCase():t.toLowerCase());return t.charAt(0).toUpperCase()+t.slice(1)},n=(...e)=>e.filter((e,t,r)=>!!e&&""!==e.trim()&&r.indexOf(e)===t).join(" ").trim();var a={xmlns:"http://www.w3.org/2000/svg",width:24,height:24,viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"};let i=(0,t.forwardRef)(({color:e="currentColor",size:r=24,strokeWidth:i=2,absoluteStrokeWidth:o,className:l="",children:s,iconNode:u,...f},c)=>(0,t.createElement)("svg",{ref:c,...a,width:r,height:r,stroke:e,strokeWidth:o?24*Number(i)/Number(r):i,className:n("lucide",l),...!s&&!(e=>{for(let t in e)if(t.startsWith("aria-")||"role"===t||"title"===t)return!0})(f)&&{"aria-hidden":"true"},...f},[...u.map(([e,r])=>(0,t.createElement)(e,r)),...Array.isArray(s)?s:[s]])),o=(e,a)=>{let o=(0,t.forwardRef)(({className:o,...l},s)=>(0,t.createElement)(i,{ref:s,iconNode:a,className:n(`lucide-${r(e).replace(/([a-z0-9])([A-Z])/g,"$1-$2").toLowerCase()}`,`lucide-${e}`,o),...l}));return o.displayName=r(e),o};e.s(["default",()=>o],24929);let l=o("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]]);e.s(["Search",()=>l],6847);let s=o("x",[["path",{d:"M18 6 6 18",key:"1bl5f8"}],["path",{d:"m6 6 12 12",key:"d8bk6v"}]]);e.s(["X",()=>s],17278)},13808,e=>{"use strict";let t=(0,e.i(24929).default)("sparkles",[["path",{d:"M11.017 2.814a1 1 0 0 1 1.966 0l1.051 5.558a2 2 0 0 0 1.594 1.594l5.558 1.051a1 1 0 0 1 0 1.966l-5.558 1.051a2 2 0 0 0-1.594 1.594l-1.051 5.558a1 1 0 0 1-1.966 0l-1.051-5.558a2 2 0 0 0-1.594-1.594l-5.558-1.051a1 1 0 0 1 0-1.966l5.558-1.051a2 2 0 0 0 1.594-1.594z",key:"1s2grr"}],["path",{d:"M20 2v4",key:"1rf3ol"}],["path",{d:"M22 4h-4",key:"gwowj6"}],["circle",{cx:"4",cy:"20",r:"2",key:"6kqj1y"}]]);e.s(["Sparkles",()=>t],13808)},22934,e=>{"use strict";let t=(0,e.i(24929).default)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]]);e.s(["ChevronRight",()=>t],22934)},17603,e=>{"use strict";function t(e,t){switch(arguments.length){case 0:break;case 1:this.range(e);break;default:this.range(t).domain(e)}return this}function r(e,t){switch(arguments.length){case 0:break;case 1:"function"==typeof e?this.interpolator(e):this.range(e);break;default:this.domain(e),"function"==typeof t?this.interpolator(t):this.range(t)}return this}e.s(["initInterpolator",()=>r,"initRange",()=>t])},294,e=>{"use strict";class t extends Map{constructor(e,t=n){if(super(),Object.defineProperties(this,{_intern:{value:new Map},_key:{value:t}}),null!=e)for(const[t,r]of e)this.set(t,r)}get(e){return super.get(r(this,e))}has(e){return super.has(r(this,e))}set(e,t){return super.set(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):(e.set(n,r),r)}(this,e),t)}delete(e){return super.delete(function({_intern:e,_key:t},r){let n=t(r);return e.has(n)&&(r=e.get(n),e.delete(n)),r}(this,e))}}function r({_intern:e,_key:t},r){let n=t(r);return e.has(n)?e.get(n):r}function n(e){return null!==e&&"object"==typeof e?e.valueOf():e}e.s(["InternMap",()=>t])},11276,e=>{"use strict";var t=e.i(294),r=e.i(17603);let n=Symbol("implicit");e.s(["default",()=>function e(){var a=new t.InternMap,i=[],o=[],l=n;function s(e){let t=a.get(e);if(void 0===t){if(l!==n)return l;a.set(e,t=i.push(e)-1)}return o[t%o.length]}return s.domain=function(e){if(!arguments.length)return i.slice();for(let r of(i=[],a=new t.InternMap,e))a.has(r)||a.set(r,i.push(r)-1);return s},s.range=function(e){return arguments.length?(o=Array.from(e),s):o.slice()},s.unknown=function(e){return arguments.length?(l=e,s):l},s.copy=function(){return e(i,o).unknown(l)},r.initRange.apply(s,arguments),s},"implicit",0,n])},82938,2441,e=>{"use strict";function t(e,t,r){e.prototype=t.prototype=r,r.constructor=e}function r(e,t){var r=Object.create(e.prototype);for(var n in t)r[n]=t[n];return r}function n(){}var a="\\s*([+-]?\\d+)\\s*",i="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)\\s*",o="\\s*([+-]?(?:\\d*\\.)?\\d+(?:[eE][+-]?\\d+)?)%\\s*",l=/^#([0-9a-f]{3,8})$/,s=RegExp(`^rgb\\(${a},${a},${a}\\)$`),u=RegExp(`^rgb\\(${o},${o},${o}\\)$`),f=RegExp(`^rgba\\(${a},${a},${a},${i}\\)$`),c=RegExp(`^rgba\\(${o},${o},${o},${i}\\)$`),d=RegExp(`^hsl\\(${i},${o},${o}\\)$`),h=RegExp(`^hsla\\(${i},${o},${o},${i}\\)$`),g={aliceblue:0xf0f8ff,antiquewhite:0xfaebd7,aqua:65535,aquamarine:8388564,azure:0xf0ffff,beige:0xf5f5dc,bisque:0xffe4c4,black:0,blanchedalmond:0xffebcd,blue:255,blueviolet:9055202,brown:0xa52a2a,burlywood:0xdeb887,cadetblue:6266528,chartreuse:8388352,chocolate:0xd2691e,coral:0xff7f50,cornflowerblue:6591981,cornsilk:0xfff8dc,crimson:0xdc143c,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:0xb8860b,darkgray:0xa9a9a9,darkgreen:25600,darkgrey:0xa9a9a9,darkkhaki:0xbdb76b,darkmagenta:9109643,darkolivegreen:5597999,darkorange:0xff8c00,darkorchid:0x9932cc,darkred:9109504,darksalmon:0xe9967a,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:0xff1493,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:0xb22222,floralwhite:0xfffaf0,forestgreen:2263842,fuchsia:0xff00ff,gainsboro:0xdcdcdc,ghostwhite:0xf8f8ff,gold:0xffd700,goldenrod:0xdaa520,gray:8421504,green:32768,greenyellow:0xadff2f,grey:8421504,honeydew:0xf0fff0,hotpink:0xff69b4,indianred:0xcd5c5c,indigo:4915330,ivory:0xfffff0,khaki:0xf0e68c,lavender:0xe6e6fa,lavenderblush:0xfff0f5,lawngreen:8190976,lemonchiffon:0xfffacd,lightblue:0xadd8e6,lightcoral:0xf08080,lightcyan:0xe0ffff,lightgoldenrodyellow:0xfafad2,lightgray:0xd3d3d3,lightgreen:9498256,lightgrey:0xd3d3d3,lightpink:0xffb6c1,lightsalmon:0xffa07a,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:0xb0c4de,lightyellow:0xffffe0,lime:65280,limegreen:3329330,linen:0xfaf0e6,magenta:0xff00ff,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:0xba55d3,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:0xc71585,midnightblue:1644912,mintcream:0xf5fffa,mistyrose:0xffe4e1,moccasin:0xffe4b5,navajowhite:0xffdead,navy:128,oldlace:0xfdf5e6,olive:8421376,olivedrab:7048739,orange:0xffa500,orangered:0xff4500,orchid:0xda70d6,palegoldenrod:0xeee8aa,palegreen:0x98fb98,paleturquoise:0xafeeee,palevioletred:0xdb7093,papayawhip:0xffefd5,peachpuff:0xffdab9,peru:0xcd853f,pink:0xffc0cb,plum:0xdda0dd,powderblue:0xb0e0e6,purple:8388736,rebeccapurple:6697881,red:0xff0000,rosybrown:0xbc8f8f,royalblue:4286945,saddlebrown:9127187,salmon:0xfa8072,sandybrown:0xf4a460,seagreen:3050327,seashell:0xfff5ee,sienna:0xa0522d,silver:0xc0c0c0,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:0xfffafa,springgreen:65407,steelblue:4620980,tan:0xd2b48c,teal:32896,thistle:0xd8bfd8,tomato:0xff6347,turquoise:4251856,violet:0xee82ee,wheat:0xf5deb3,white:0xffffff,whitesmoke:0xf5f5f5,yellow:0xffff00,yellowgreen:0x9acd32};function p(){return this.rgb().formatHex()}function b(){return this.rgb().formatRgb()}function x(e){var t,r;return e=(e+"").trim().toLowerCase(),(t=l.exec(e))?(r=t[1].length,t=parseInt(t[1],16),6===r?y(t):3===r?new k(t>>8&15|t>>4&240,t>>4&15|240&t,(15&t)<<4|15&t,1):8===r?m(t>>24&255,t>>16&255,t>>8&255,(255&t)/255):4===r?m(t>>12&15|t>>8&240,t>>8&15|t>>4&240,t>>4&15|240&t,((15&t)<<4|15&t)/255):null):(t=s.exec(e))?new k(t[1],t[2],t[3],1):(t=u.exec(e))?new k(255*t[1]/100,255*t[2]/100,255*t[3]/100,1):(t=f.exec(e))?m(t[1],t[2],t[3],t[4]):(t=c.exec(e))?m(255*t[1]/100,255*t[2]/100,255*t[3]/100,t[4]):(t=d.exec(e))?R(t[1],t[2]/100,t[3]/100,1):(t=h.exec(e))?R(t[1],t[2]/100,t[3]/100,t[4]):g.hasOwnProperty(e)?y(g[e]):"transparent"===e?new k(NaN,NaN,NaN,0):null}function y(e){return new k(e>>16&255,e>>8&255,255&e,1)}function m(e,t,r,n){return n<=0&&(e=t=r=NaN),new k(e,t,r,n)}function w(e,t,r,a){var i;return 1==arguments.length?((i=e)instanceof n||(i=x(i)),i)?new k((i=i.rgb()).r,i.g,i.b,i.opacity):new k:new k(e,t,r,null==a?1:a)}function k(e,t,r,n){this.r=+e,this.g=+t,this.b=+r,this.opacity=+n}function v(){return`#${M(this.r)}${M(this.g)}${M(this.b)}`}function $(){let e=j(this.opacity);return`${1===e?"rgb(":"rgba("}${N(this.r)}, ${N(this.g)}, ${N(this.b)}${1===e?")":`, ${e})`}`}function j(e){return isNaN(e)?1:Math.max(0,Math.min(1,e))}function N(e){return Math.max(0,Math.min(255,Math.round(e)||0))}function M(e){return((e=N(e))<16?"0":"")+e.toString(16)}function R(e,t,r,n){return n<=0?e=t=r=NaN:r<=0||r>=1?e=t=NaN:t<=0&&(e=NaN),new P(e,t,r,n)}function E(e){if(e instanceof P)return new P(e.h,e.s,e.l,e.opacity);if(e instanceof n||(e=x(e)),!e)return new P;if(e instanceof P)return e;var t=(e=e.rgb()).r/255,r=e.g/255,a=e.b/255,i=Math.min(t,r,a),o=Math.max(t,r,a),l=NaN,s=o-i,u=(o+i)/2;return s?(l=t===o?(r-a)/s+(r<a)*6:r===o?(a-t)/s+2:(t-r)/s+4,s/=u<.5?o+i:2-o-i,l*=60):s=u>0&&u<1?0:l,new P(l,s,u,e.opacity)}function P(e,t,r,n){this.h=+e,this.s=+t,this.l=+r,this.opacity=+n}function _(e){return(e=(e||0)%360)<0?e+360:e}function O(e){return Math.max(0,Math.min(1,e||0))}function C(e,t,r){return(e<60?t+(r-t)*e/60:e<180?r:e<240?t+(r-t)*(240-e)/60:t)*255}t(n,x,{copy(e){return Object.assign(new this.constructor,this,e)},displayable(){return this.rgb().displayable()},hex:p,formatHex:p,formatHex8:function(){return this.rgb().formatHex8()},formatHsl:function(){return E(this).formatHsl()},formatRgb:b,toString:b}),t(k,w,r(n,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new k(this.r*e,this.g*e,this.b*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new k(this.r*e,this.g*e,this.b*e,this.opacity)},rgb(){return this},clamp(){return new k(N(this.r),N(this.g),N(this.b),j(this.opacity))},displayable(){return -.5<=this.r&&this.r<255.5&&-.5<=this.g&&this.g<255.5&&-.5<=this.b&&this.b<255.5&&0<=this.opacity&&this.opacity<=1},hex:v,formatHex:v,formatHex8:function(){return`#${M(this.r)}${M(this.g)}${M(this.b)}${M((isNaN(this.opacity)?1:this.opacity)*255)}`},formatRgb:$,toString:$})),t(P,function(e,t,r,n){return 1==arguments.length?E(e):new P(e,t,r,null==n?1:n)},r(n,{brighter(e){return e=null==e?1.4285714285714286:Math.pow(1.4285714285714286,e),new P(this.h,this.s,this.l*e,this.opacity)},darker(e){return e=null==e?.7:Math.pow(.7,e),new P(this.h,this.s,this.l*e,this.opacity)},rgb(){var e=this.h%360+(this.h<0)*360,t=isNaN(e)||isNaN(this.s)?0:this.s,r=this.l,n=r+(r<.5?r:1-r)*t,a=2*r-n;return new k(C(e>=240?e-240:e+120,a,n),C(e,a,n),C(e<120?e+240:e-120,a,n),this.opacity)},clamp(){return new P(_(this.h),O(this.s),O(this.l),j(this.opacity))},displayable(){return(0<=this.s&&this.s<=1||isNaN(this.s))&&0<=this.l&&this.l<=1&&0<=this.opacity&&this.opacity<=1},formatHsl(){let e=j(this.opacity);return`${1===e?"hsl(":"hsla("}${_(this.h)}, ${100*O(this.s)}%, ${100*O(this.l)}%${1===e?")":`, ${e})`}`}})),e.s(["default",()=>x,"rgb",()=>w],2441),e.s(["color",()=>x],82938)},208,44936,e=>{"use strict";var t=e.i(2441);function r(e,t,r,n,a){var i=e*e,o=i*e;return((1-3*e+3*i-o)*t+(4-6*i+3*o)*r+(1+3*e+3*i-3*o)*n+o*a)/6}let n=e=>()=>e;function a(e,t){var r=t-e;return r?function(t){return e+t*r}:n(isNaN(e)?t:e)}e.s(["default",0,n],44936);let i=function e(r){var i,o=1==(i=+r)?a:function(e,t){var r,a,o;return t-e?(r=e,a=t,r=Math.pow(r,o=i),a=Math.pow(a,o)-r,o=1/o,function(e){return Math.pow(r+e*a,o)}):n(isNaN(e)?t:e)};function l(e,r){var n=o((e=(0,t.rgb)(e)).r,(r=(0,t.rgb)(r)).r),i=o(e.g,r.g),l=o(e.b,r.b),s=a(e.opacity,r.opacity);return function(t){return e.r=n(t),e.g=i(t),e.b=l(t),e.opacity=s(t),e+""}}return l.gamma=e,l}(1);function o(e){return function(r){var n,a,i=r.length,o=Array(i),l=Array(i),s=Array(i);for(n=0;n<i;++n)a=(0,t.rgb)(r[n]),o[n]=a.r||0,l[n]=a.g||0,s[n]=a.b||0;return o=e(o),l=e(l),s=e(s),a.opacity=1,function(e){return a.r=o(e),a.g=l(e),a.b=s(e),a+""}}}o(function(e){var t=e.length-1;return function(n){var a=n<=0?n=0:n>=1?(n=1,t-1):Math.floor(n*t),i=e[a],o=e[a+1],l=a>0?e[a-1]:2*i-o,s=a<t-1?e[a+2]:2*o-i;return r((n-a/t)*t,l,i,o,s)}}),o(function(e){var t=e.length;return function(n){var a=Math.floor(((n%=1)<0?++n:n)*t),i=e[(a+t-1)%t],o=e[a%t],l=e[(a+1)%t],s=e[(a+2)%t];return r((n-a/t)*t,i,o,l,s)}}),e.s(["default",0,i],208)},6272,e=>{"use strict";e.s(["default",0,function(e,t){return e*=1,t*=1,function(r){return e*(1-r)+t*r}}])},11930,e=>{"use strict";var t=e.i(6272),r=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,n=RegExp(r.source,"g");e.s(["default",0,function(e,a){var i,o,l,s,u,f=r.lastIndex=n.lastIndex=0,c=-1,d=[],h=[];for(e+="",a+="";(l=r.exec(e))&&(s=n.exec(a));)(u=s.index)>f&&(u=a.slice(f,u),d[c]?d[c]+=u:d[++c]=u),(l=l[0])===(s=s[0])?d[c]?d[c]+=s:d[++c]=s:(d[++c]=null,h.push({i:c,x:(0,t.default)(l,s)})),f=n.lastIndex;return f<a.length&&(u=a.slice(f),d[c]?d[c]+=u:d[++c]=u),d.length<2?h[0]?(i=h[0].x,function(e){return i(e)+""}):(o=a,function(){return o}):(a=h.length,function(e){for(var t,r=0;r<a;++r)d[(t=h[r]).i]=t.x(e);return d.join("")})}])},25223,e=>{"use strict";var t=e.i(6272);e.s(["interpolateNumber",()=>t.default])},96509,e=>{"use strict";function t(e,t){let r;if(void 0===t)for(let t of e)null!=t&&(r<t||void 0===r&&t>=t)&&(r=t);else{let n=-1;for(let a of e)null!=(a=t(a,++n,e))&&(r<a||void 0===r&&a>=a)&&(r=a)}return r}e.s(["default",()=>t])},45583,e=>{"use strict";function t(e,t){let r;if(void 0===t)for(let t of e)null!=t&&(r>t||void 0===r&&t>=t)&&(r=t);else{let n=-1;for(let a of e)null!=(a=t(a,++n,e))&&(r>a||void 0===r&&a>=a)&&(r=a)}return r}e.s(["default",()=>t])},9070,e=>{e.v(t=>Promise.all(["static/chunks/9232a2d99b47b21f.js"].map(t=>e.l(t))).then(()=>t(13213)))},62838,e=>{e.v(t=>Promise.all(["static/chunks/39e59c45c12073c2.js"].map(t=>e.l(t))).then(()=>t(41740)))}]);
|