@origintrail-official/dkg-node-ui 10.0.20 → 10.0.22
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/api.d.ts +7 -1
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +22 -1
- package/dist/api.js.map +1 -1
- package/dist/chain-cursor-stores.d.ts +11 -108
- package/dist/chain-cursor-stores.d.ts.map +1 -1
- package/dist/chain-cursor-stores.js +11 -287
- package/dist/chain-cursor-stores.js.map +1 -1
- package/dist/chain-event-log-store.d.ts +10 -112
- package/dist/chain-event-log-store.d.ts.map +1 -1
- package/dist/chain-event-log-store.js +9 -360
- package/dist/chain-event-log-store.js.map +1 -1
- package/dist/chat-memory.d.ts +1 -0
- package/dist/chat-memory.d.ts.map +1 -1
- package/dist/chat-memory.js +31 -39
- package/dist/chat-memory.js.map +1 -1
- package/dist/chat-turn-subject.d.ts +18 -0
- package/dist/chat-turn-subject.d.ts.map +1 -0
- package/dist/chat-turn-subject.js +52 -0
- package/dist/chat-turn-subject.js.map +1 -0
- package/dist/db.d.ts +2 -143
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +9 -387
- package/dist/db.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- package/dist/metrics-collector.d.ts +11 -1
- package/dist/metrics-collector.d.ts.map +1 -1
- package/dist/metrics-collector.js +77 -39
- package/dist/metrics-collector.js.map +1 -1
- package/dist/protocol-outbox-store.d.ts +9 -64
- package/dist/protocol-outbox-store.d.ts.map +1 -1
- package/dist/protocol-outbox-store.js +11 -198
- package/dist/protocol-outbox-store.js.map +1 -1
- package/dist-ui/assets/{3d-force-graph-CehOGxux.js → 3d-force-graph-DbVwxMKf.js} +1 -1
- package/dist-ui/assets/{ActivityFeed-BE4MTD8M.js → ActivityFeed-Bfg6fmQQ.js} +1 -1
- package/dist-ui/assets/{AgentHub-CT6UhLF2.js → AgentHub-DyF5Pa70.js} +1 -1
- package/dist-ui/assets/{AgentProfilePage-ygi-GXKM.js → AgentProfilePage-BPrSuKjV.js} +1 -1
- package/dist-ui/assets/{ApproveWalletsModal-YFfDrGth.js → ApproveWalletsModal-Dd_tHLRP.js} +1 -1
- package/dist-ui/assets/{ContextGraphPrimitives-Dh-w2D_i.js → ContextGraphPrimitives-BXormriD.js} +1 -1
- package/dist-ui/assets/{ConvictionDetailView-CfRmqqDD.js → ConvictionDetailView-BsPTd17P.js} +1 -1
- package/dist-ui/assets/{MemoryLayerView-DL0zLYAQ.js → MemoryLayerView-CloJeM33.js} +2 -2
- package/dist-ui/assets/{MemoryStackView-BsV_JnOe.js → MemoryStackView-BbUJ2uiM.js} +1 -1
- package/dist-ui/assets/{Network-BkxRENe4.js → Network-BKvJttOu.js} +1 -1
- package/dist-ui/assets/{OnChainProvenanceCard-CnnkMMNI.js → OnChainProvenanceCard-BV9-G1cT.js} +1 -1
- package/dist-ui/assets/{Operations-BaWWLSUw.js → Operations-LAhUQsnj.js} +1 -1
- package/dist-ui/assets/{ProjectView-BJmZ5f62.js → ProjectView-0zCSblAV.js} +3 -3
- package/dist-ui/assets/{PublishingConviction-CKB6JBYk.js → PublishingConviction-CF6352oT.js} +1 -1
- package/dist-ui/assets/{Settings-DXGMPiJk.js → Settings-runaZqPv.js} +1 -1
- package/dist-ui/assets/{browserWalletTransaction-BdmrJpK1.js → browserWalletTransaction-CBgx0i4w.js} +3 -3
- package/dist-ui/assets/{ccip-BNYiIkjs.js → ccip-BM07w5uU.js} +1 -1
- package/dist-ui/assets/{index-DOGXDQkQ.js → index-CfVUpsfM.js} +3 -3
- package/dist-ui/assets/{index-DK8XzE3T.js → index-MQh8C4aJ.js} +90 -90
- package/dist-ui/assets/index-xKO-U_eV.css +1 -0
- package/dist-ui/assets/{jsonld-32FQRO67-Ca-KnQfb.js → jsonld-32FQRO67-DBZOBQji.js} +2 -2
- package/dist-ui/assets/{jsonld-mRC9FbFR.js → jsonld-DOX7dKpf.js} +1 -1
- package/dist-ui/assets/{renderer-3d-2EVDZII7-AEMBPIY7.js → renderer-3d-2EVDZII7-CVCpAmwB.js} +2 -2
- package/dist-ui/assets/{shikiHighlighter-CUQ07vzt.js → shikiHighlighter-CzU2U2Tx.js} +1 -1
- package/dist-ui/assets/{useEntityOnChainReceipt-C8NHlPPN.js → useEntityOnChainReceipt-BvWQ6qdT.js} +1 -1
- package/dist-ui/assets/{useProjectActivity-CVFCfbMj.js → useProjectActivity-Cxr4QGX1.js} +1 -1
- package/dist-ui/index.html +2 -2
- package/package.json +6 -4
- package/dist-ui/assets/index-BLQUVvVz.css +0 -1
|
@@ -1,67 +1,12 @@
|
|
|
1
|
-
import type Database from 'better-sqlite3';
|
|
2
|
-
import { type BoundedProtocolOutboxStore, type ProtocolOutboxStore, type ProtocolOutboxEntry, type ProtocolOutboxMetadata, type ProtocolOutboxPage, type ProtocolOutboxPageBudget, type ProtocolOutboxQueueStats } from '@origintrail-official/dkg-core';
|
|
3
1
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* The backoff ladder + max-age are NOT stored in SQL — they live
|
|
14
|
-
* on the wrapping `ProtocolOutbox` in `packages/core`, and only
|
|
15
|
-
* the resulting `next_attempt_at` and `first_failure_at` timestamps
|
|
16
|
-
* land in the table. This keeps the schema independent of policy
|
|
17
|
-
* changes: bumping the ladder doesn't require a migration.
|
|
18
|
-
*
|
|
19
|
-
* Constructor takes a `maxAgeMs` so `dropExpired` can apply it
|
|
20
|
-
* directly in SQL (avoiding a full table read).
|
|
2
|
+
* @deprecated Compatibility module. The protocol outbox store moved to
|
|
3
|
+
* `@origintrail-official/dkg-node-store`; this file only keeps the deep import
|
|
4
|
+
* path `@origintrail-official/dkg-node-ui/dist/protocol-outbox-store.js`
|
|
5
|
+
* resolving for downstream consumers that shipped against it (this package has
|
|
6
|
+
* no `exports` map, so `dist/*` is importable). First-party code imports
|
|
7
|
+
* `@origintrail-official/dkg-node-store` directly. Every runtime value and type
|
|
8
|
+
* the former module exported is forwarded, and each is the very same
|
|
9
|
+
* declaration node-store exports.
|
|
21
10
|
*/
|
|
22
|
-
export
|
|
23
|
-
/**
|
|
24
|
-
* Max age (ms) from `firstFailureAt` before `dropExpired(now)`
|
|
25
|
-
* evicts an entry. Defaults to 24h. Mirrors the wrapping
|
|
26
|
-
* `ProtocolOutbox`'s `maxAgeMs` so both layers agree.
|
|
27
|
-
*/
|
|
28
|
-
maxAgeMs?: number;
|
|
29
|
-
/**
|
|
30
|
-
* Function that returns the backoff (ms) to apply for an entry
|
|
31
|
-
* about to bump to `attempts`. The schema does NOT store the
|
|
32
|
-
* ladder; PR-2's `lifecycle.ts` wiring passes the wrapping
|
|
33
|
-
* `ProtocolOutbox`'s `backoffFor` method here so policy lives in
|
|
34
|
-
* one place. Defaults to a flat 5s backoff so the store works
|
|
35
|
-
* standalone in tests + before the wrapping outbox is wired.
|
|
36
|
-
*/
|
|
37
|
-
backoffFor?: (attempts: number) => number;
|
|
38
|
-
}
|
|
39
|
-
export declare class SqliteProtocolOutboxStore implements BoundedProtocolOutboxStore, ProtocolOutboxStore {
|
|
40
|
-
private readonly db;
|
|
41
|
-
private maxAgeMs;
|
|
42
|
-
private backoffFor;
|
|
43
|
-
constructor(dashboard: {
|
|
44
|
-
readonly db: Database.Database;
|
|
45
|
-
}, options?: SqliteProtocolOutboxStoreOptions);
|
|
46
|
-
configurePolicy(options?: SqliteProtocolOutboxStoreOptions): void;
|
|
47
|
-
enqueue(peer: string, protocol: string, messageId: string, payload: Uint8Array, error: string, now: number): ProtocolOutboxEntry;
|
|
48
|
-
markDelivered(peer: string, protocol: string, messageId: string): boolean;
|
|
49
|
-
hasEntry(peer: string, protocol: string, messageId: string): boolean;
|
|
50
|
-
hasPendingFor(peer: string): boolean;
|
|
51
|
-
pendingFor(peer: string): ProtocolOutboxEntry[];
|
|
52
|
-
due(now: number): ProtocolOutboxEntry[];
|
|
53
|
-
duePage(now: number, limit: number): ProtocolOutboxEntry[];
|
|
54
|
-
readDuePage(now: number, budget: ProtocolOutboxPageBudget): ProtocolOutboxPage;
|
|
55
|
-
listMetadata(peer?: string): ProtocolOutboxMetadata[];
|
|
56
|
-
dropExpiredMetadata(now: number): ProtocolOutboxMetadata[];
|
|
57
|
-
recordRetryFailure(peer: string, protocol: string, messageId: string, error: string, now: number): ProtocolOutboxMetadata | undefined;
|
|
58
|
-
private advanceRetryMetadata;
|
|
59
|
-
private advanceRetryEntry;
|
|
60
|
-
queueStats(now: number, maxPayloadBytes: number): ProtocolOutboxQueueStats;
|
|
61
|
-
dropExpired(now: number): ProtocolOutboxEntry[];
|
|
62
|
-
size(): number;
|
|
63
|
-
list(): ProtocolOutboxEntry[];
|
|
64
|
-
getEntry(peer: string, protocol: string, messageId: string): ProtocolOutboxEntry | undefined;
|
|
65
|
-
private static rowToEntry;
|
|
66
|
-
}
|
|
11
|
+
export { SqliteProtocolOutboxStore, type SqliteProtocolOutboxStoreOptions, } from '@origintrail-official/dkg-node-store';
|
|
67
12
|
//# sourceMappingURL=protocol-outbox-store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-outbox-store.d.ts","sourceRoot":"","sources":["../src/protocol-outbox-store.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"protocol-outbox-store.d.ts","sourceRoot":"","sources":["../src/protocol-outbox-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,EACzB,KAAK,gCAAgC,GACtC,MAAM,sCAAsC,CAAC"}
|
|
@@ -1,199 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
this.configurePolicy(options);
|
|
13
|
-
}
|
|
14
|
-
configurePolicy(options = {}) {
|
|
15
|
-
this.maxAgeMs = options.maxAgeMs ?? this.maxAgeMs;
|
|
16
|
-
this.backoffFor = options.backoffFor ?? this.backoffFor;
|
|
17
|
-
}
|
|
18
|
-
enqueue(peer, protocol, messageId, payload, error, now) {
|
|
19
|
-
const existing = this.db.prepare('SELECT attempts FROM protocol_outbox WHERE peer_id = ? AND protocol = ? AND message_id = ?').get(peer, protocol, messageId);
|
|
20
|
-
if (existing) {
|
|
21
|
-
return SqliteProtocolOutboxStore.rowToEntry(this.advanceRetryEntry(peer, protocol, messageId, existing.attempts + 1, error, now));
|
|
22
|
-
}
|
|
23
|
-
const attempts = 1;
|
|
24
|
-
const nextAttemptAt = now + this.backoffFor(attempts);
|
|
25
|
-
const blob = Buffer.from(payload);
|
|
26
|
-
this.db
|
|
27
|
-
.prepare(`INSERT INTO protocol_outbox
|
|
28
|
-
(peer_id, protocol, message_id, payload, attempts,
|
|
29
|
-
first_failure_at, last_attempt_at, next_attempt_at, last_error)
|
|
30
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)`)
|
|
31
|
-
.run(peer, protocol, messageId, blob, attempts, now, now, nextAttemptAt, error);
|
|
32
|
-
return {
|
|
33
|
-
peer,
|
|
34
|
-
protocol,
|
|
35
|
-
messageId,
|
|
36
|
-
payload: new Uint8Array(blob),
|
|
37
|
-
attempts,
|
|
38
|
-
firstFailureAt: now,
|
|
39
|
-
lastAttemptAt: now,
|
|
40
|
-
nextAttemptAt,
|
|
41
|
-
lastError: error,
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
markDelivered(peer, protocol, messageId) {
|
|
45
|
-
const result = this.db
|
|
46
|
-
.prepare(`DELETE FROM protocol_outbox
|
|
47
|
-
WHERE peer_id = ? AND protocol = ? AND message_id = ?`)
|
|
48
|
-
.run(peer, protocol, messageId);
|
|
49
|
-
return result.changes > 0;
|
|
50
|
-
}
|
|
51
|
-
hasEntry(peer, protocol, messageId) {
|
|
52
|
-
const row = this.db
|
|
53
|
-
.prepare(`SELECT 1 FROM protocol_outbox
|
|
54
|
-
WHERE peer_id = ? AND protocol = ? AND message_id = ? LIMIT 1`)
|
|
55
|
-
.get(peer, protocol, messageId);
|
|
56
|
-
return row !== undefined;
|
|
57
|
-
}
|
|
58
|
-
hasPendingFor(peer) {
|
|
59
|
-
return this.db.prepare('SELECT 1 FROM protocol_outbox WHERE peer_id = ? LIMIT 1').get(peer) !== undefined;
|
|
60
|
-
}
|
|
61
|
-
pendingFor(peer) {
|
|
62
|
-
const rows = this.db
|
|
63
|
-
.prepare(`SELECT * FROM protocol_outbox
|
|
64
|
-
WHERE peer_id = ?
|
|
65
|
-
ORDER BY first_failure_at ASC, protocol ASC, message_id ASC`)
|
|
66
|
-
.all(peer);
|
|
67
|
-
return rows.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
68
|
-
}
|
|
69
|
-
due(now) {
|
|
70
|
-
const rows = this.db
|
|
71
|
-
.prepare(`SELECT * FROM protocol_outbox
|
|
72
|
-
WHERE next_attempt_at <= ?
|
|
73
|
-
ORDER BY next_attempt_at ASC, first_failure_at ASC,
|
|
74
|
-
peer_id ASC, protocol ASC, message_id ASC`)
|
|
75
|
-
.all(now);
|
|
76
|
-
return rows.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
77
|
-
}
|
|
78
|
-
duePage(now, limit) {
|
|
79
|
-
if (!Number.isSafeInteger(limit) || limit < 0)
|
|
80
|
-
throw new RangeError('Outbox duePage limit must be a non-negative safe integer');
|
|
81
|
-
const rows = this.db
|
|
82
|
-
.prepare(`SELECT * FROM protocol_outbox
|
|
83
|
-
WHERE next_attempt_at <= ?
|
|
84
|
-
ORDER BY next_attempt_at ASC, first_failure_at ASC,
|
|
85
|
-
peer_id ASC, protocol ASC, message_id ASC
|
|
86
|
-
LIMIT ?`)
|
|
87
|
-
.all(now, limit);
|
|
88
|
-
return rows.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
89
|
-
}
|
|
90
|
-
readDuePage(now, budget) {
|
|
91
|
-
validateProtocolOutboxPageBudget(budget);
|
|
92
|
-
// SQLite length(BLOB) reads its size without returning the BLOB to JS.
|
|
93
|
-
// Select metadata first, then load only the admitted prefix. The read
|
|
94
|
-
// transaction keeps both queries on one snapshot without a durable lease:
|
|
95
|
-
// the daemon has one Messenger owner and never deletes rows on selection.
|
|
96
|
-
return this.db.transaction(() => {
|
|
97
|
-
const candidates = this.db.prepare(`SELECT ${OUTBOX_METADATA_COLUMNS} FROM protocol_outbox
|
|
98
|
-
WHERE next_attempt_at <= ? AND length(payload) <= ?
|
|
99
|
-
ORDER BY next_attempt_at, first_failure_at, peer_id, protocol, message_id
|
|
100
|
-
LIMIT ?`).all(now, budget.maxPayloadBytes, budget.maxEntries);
|
|
101
|
-
let selectedCount = 0;
|
|
102
|
-
let payloadBytes = 0;
|
|
103
|
-
let byteBudgetExhausted = false;
|
|
104
|
-
for (const candidate of candidates) {
|
|
105
|
-
if (payloadBytes + candidate.payloadBytes > budget.maxPayloadBytes) {
|
|
106
|
-
byteBudgetExhausted = true;
|
|
107
|
-
break;
|
|
108
|
-
}
|
|
109
|
-
selectedCount++;
|
|
110
|
-
payloadBytes += candidate.payloadBytes;
|
|
111
|
-
}
|
|
112
|
-
// Carry exact admitted identities and order into one payload query.
|
|
113
|
-
// JSON binds the bounded key list with one parameter regardless of size;
|
|
114
|
-
// eligibility and ordering policy belong only to the metadata pass.
|
|
115
|
-
const admittedKeys = candidates.slice(0, selectedCount)
|
|
116
|
-
.map(entry => [entry.peer, entry.protocol, entry.messageId]);
|
|
117
|
-
const rows = this.db.prepare(`SELECT CAST(admitted.key AS INTEGER) AS admitted_order, queued.* FROM json_each(?) AS admitted
|
|
118
|
-
JOIN protocol_outbox AS queued
|
|
119
|
-
ON queued.peer_id = json_extract(admitted.value, '$[0]')
|
|
120
|
-
AND queued.protocol = json_extract(admitted.value, '$[1]')
|
|
121
|
-
AND queued.message_id = json_extract(admitted.value, '$[2]')`).all(JSON.stringify(admittedKeys));
|
|
122
|
-
// Sort bounded row references here. A SQL ORDER BY on queued.* would
|
|
123
|
-
// copy the admitted BLOBs into SQLite's temporary sorter as well.
|
|
124
|
-
rows.sort((a, b) => a.admitted_order - b.admitted_order);
|
|
125
|
-
const entries = rows.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
126
|
-
const { skippedOversizedEntries } = this.db.prepare('SELECT count(*) AS skippedOversizedEntries FROM protocol_outbox WHERE next_attempt_at <= ? AND length(payload) > ?').get(now, budget.maxPayloadBytes);
|
|
127
|
-
return { entries, skippedOversizedEntries, byteBudgetExhausted };
|
|
128
|
-
})();
|
|
129
|
-
}
|
|
130
|
-
listMetadata(peer) {
|
|
131
|
-
const statement = this.db.prepare(`SELECT ${OUTBOX_METADATA_COLUMNS} FROM protocol_outbox
|
|
132
|
-
${peer === undefined ? '' : 'WHERE peer_id = ?'}
|
|
133
|
-
ORDER BY first_failure_at, peer_id, protocol, message_id`);
|
|
134
|
-
return (peer === undefined ? statement.all() : statement.all(peer));
|
|
135
|
-
}
|
|
136
|
-
dropExpiredMetadata(now) {
|
|
137
|
-
return this.db.prepare(`DELETE FROM protocol_outbox WHERE first_failure_at < ? RETURNING ${OUTBOX_METADATA_COLUMNS}`).all(now - this.maxAgeMs);
|
|
138
|
-
}
|
|
139
|
-
recordRetryFailure(peer, protocol, messageId, error, now) {
|
|
140
|
-
return this.db.transaction(() => {
|
|
141
|
-
const current = this.db.prepare('SELECT attempts FROM protocol_outbox WHERE peer_id = ? AND protocol = ? AND message_id = ?').get(peer, protocol, messageId);
|
|
142
|
-
if (!current)
|
|
143
|
-
return undefined;
|
|
144
|
-
return this.advanceRetryMetadata(peer, protocol, messageId, current.attempts + 1, error, now);
|
|
145
|
-
}).immediate();
|
|
146
|
-
}
|
|
147
|
-
advanceRetryMetadata(peer, protocol, messageId, attempts, error, now) {
|
|
148
|
-
return this.db.prepare(`UPDATE protocol_outbox SET attempts = ?, last_attempt_at = ?, next_attempt_at = ?, last_error = ?
|
|
149
|
-
WHERE peer_id = ? AND protocol = ? AND message_id = ? RETURNING ${OUTBOX_METADATA_COLUMNS}`).get(attempts, now, now + this.backoffFor(attempts), error, peer, protocol, messageId);
|
|
150
|
-
}
|
|
151
|
-
advanceRetryEntry(peer, protocol, messageId, attempts, error, now) {
|
|
152
|
-
return this.db.prepare(`UPDATE protocol_outbox SET attempts = ?, last_attempt_at = ?, next_attempt_at = ?, last_error = ?
|
|
153
|
-
WHERE peer_id = ? AND protocol = ? AND message_id = ? RETURNING *`).get(attempts, now, now + this.backoffFor(attempts), error, peer, protocol, messageId);
|
|
154
|
-
}
|
|
155
|
-
queueStats(now, maxPayloadBytes) {
|
|
156
|
-
return this.db.prepare(`SELECT count(*) AS queuedEntries, coalesce(sum(length(payload)), 0) AS queuedBytes,
|
|
157
|
-
coalesce(max(CASE WHEN next_attempt_at <= ? THEN ? - next_attempt_at END), 0) AS oldestDueAgeMs,
|
|
158
|
-
count(CASE WHEN next_attempt_at <= ? AND length(payload) > ? THEN 1 END) AS oversizedDueEntries
|
|
159
|
-
FROM protocol_outbox`).get(now, now, now, maxPayloadBytes);
|
|
160
|
-
}
|
|
161
|
-
dropExpired(now) {
|
|
162
|
-
return this.db.prepare('DELETE FROM protocol_outbox WHERE first_failure_at < ? RETURNING *').all(now - this.maxAgeMs)
|
|
163
|
-
.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
164
|
-
}
|
|
165
|
-
size() {
|
|
166
|
-
const row = this.db.prepare(`SELECT COUNT(*) as c FROM protocol_outbox`).get();
|
|
167
|
-
return row.c;
|
|
168
|
-
}
|
|
169
|
-
list() {
|
|
170
|
-
const rows = this.db
|
|
171
|
-
.prepare(`SELECT * FROM protocol_outbox ORDER BY first_failure_at ASC`)
|
|
172
|
-
.all();
|
|
173
|
-
return rows.map(SqliteProtocolOutboxStore.rowToEntry);
|
|
174
|
-
}
|
|
175
|
-
getEntry(peer, protocol, messageId) {
|
|
176
|
-
const row = this.db
|
|
177
|
-
.prepare(`SELECT * FROM protocol_outbox WHERE peer_id = ? AND protocol = ? AND message_id = ?`)
|
|
178
|
-
.get(peer, protocol, messageId);
|
|
179
|
-
if (!row)
|
|
180
|
-
return undefined;
|
|
181
|
-
return SqliteProtocolOutboxStore.rowToEntry(row);
|
|
182
|
-
}
|
|
183
|
-
static rowToEntry(row) {
|
|
184
|
-
return {
|
|
185
|
-
peer: row.peer_id,
|
|
186
|
-
protocol: row.protocol,
|
|
187
|
-
messageId: row.message_id,
|
|
188
|
-
// better-sqlite3 already owns a fresh Buffer. A view retains that backing
|
|
189
|
-
// allocation without a second full-payload copy; writes cannot affect SQL.
|
|
190
|
-
payload: new Uint8Array(row.payload.buffer, row.payload.byteOffset, row.payload.byteLength),
|
|
191
|
-
attempts: row.attempts,
|
|
192
|
-
firstFailureAt: row.first_failure_at,
|
|
193
|
-
lastAttemptAt: row.last_attempt_at,
|
|
194
|
-
nextAttemptAt: row.next_attempt_at,
|
|
195
|
-
lastError: row.last_error ?? '',
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* @deprecated Compatibility module. The protocol outbox store moved to
|
|
3
|
+
* `@origintrail-official/dkg-node-store`; this file only keeps the deep import
|
|
4
|
+
* path `@origintrail-official/dkg-node-ui/dist/protocol-outbox-store.js`
|
|
5
|
+
* resolving for downstream consumers that shipped against it (this package has
|
|
6
|
+
* no `exports` map, so `dist/*` is importable). First-party code imports
|
|
7
|
+
* `@origintrail-official/dkg-node-store` directly. Every runtime value and type
|
|
8
|
+
* the former module exported is forwarded, and each is the very same
|
|
9
|
+
* declaration node-store exports.
|
|
10
|
+
*/
|
|
11
|
+
export { SqliteProtocolOutboxStore, } from '@origintrail-official/dkg-node-store';
|
|
199
12
|
//# sourceMappingURL=protocol-outbox-store.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol-outbox-store.js","sourceRoot":"","sources":["../src/protocol-outbox-store.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"protocol-outbox-store.js","sourceRoot":"","sources":["../src/protocol-outbox-store.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EACL,yBAAyB,GAE1B,MAAM,sCAAsC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{v as Po,c8 as Lh,aG as Qe,cD as _n,cX as ce,br as bl,cY as V,aM as St,o as si,aO as kt,ct as _l,r as Dt,aQ as Uh,n as Yi,ax as cm,ae as Oh,K as Ih,l as kh,F as dm,bv as hm,ay as Gh,u as fm,cJ as pm,db as z,af as it,cm as xl,ba as cs,bo as Vh,co as Tl,dd as $h,dc as Oe,d6 as k,s as Ge,cd as Ss,aA as vt,bD as It,cZ as ze,a7 as gm,a6 as mm,B as ot,a5 as hs,T as xn,cW as Or,c_ as uo,cI as Zt,t as Ns,bt as ym,S as zh,c9 as bm,cv as vl,i as Wh,ag as _m,aw as xm,aE as Tm,cc as vm,C as Sm,A as Nm,d as Rm,b3 as wm,p as Ws,cO as ht,cr as js,cV as ds,al as st,cS as Ve,a3 as rt,e as jh,ca as Fo,cb as Do,P as Tn,Q as vn,c5 as Jt,c6 as Lo,b_ as Uo,b$ as qh,cT as Hh,cU as Xh,cQ as Sn,cR as Sl,cP as Nl,a0 as Oo,a4 as Kh,R as nn,bq as Hr,j as Em,bs as Am,aP as On,J as qs,a as pn,d3 as Un,bw as Js,d2 as Cm,_ as Rl,$ as wl,E as yu,W as lo,cn as ae,aL as ri,bn as El,aH as dc,bB as Io,d1 as Xr,d5 as Mm,d8 as co,aY as ko,q as Kr,ce as Go,aB as fs,aC as bu,b1 as Yr,b2 as Yh,b0 as xt,be as Qh,a8 as ho,aa as er,X as Zh,as as ii,aq as Al,f as Jh,b4 as ef,aF as hc,b8 as tr,d7 as Bm,cg as tf,cB as nf,bj as sf,bk as rf,bl as of,bm as af,U as uf,V as lf,cy as cf,cx as df,cz as hf,bi as ff,I as Pm,G as Fm,H as Dm,aI as pf,b7 as Nn,a_ as ks,cC as Gs,c as Vs,bb as gn,bf as gf,a9 as mf,ab as yf,Y as bf,at as _f,ar as xf,g as Tf,b5 as vf,bE as Cl,c4 as Qi,bX as Zi,bY as Ji,bZ as eo,c3 as fc,c2 as pc,bW as gc,bV as mc,c0 as _u,c1 as xu,bU as Tu,bx as vu,ci as Su,bC as fo,cl as Nu,bL as Ru,bM as wu,bN as Eu,bO as Au,bP as Cu,bQ as Mu,bR as Bu,bS as Pu,bG as Fu,bH as Du,bI as Lu,bF as Uu,bJ as Ou,bK as Iu,bT as ku,bA as Gu,ck as Vu,bz as po,cj as $u,M as Sf,aT as Lm,aV as Um,aU as Om,aW as Im,aS as km,aR as Gm,az as Vm,bu as $m,cw as zm,cq as Wm,by as jm,D as Vo,cF as Ml,cK as qm,cM as Hm,cL as Xm,a2 as go,bg as Km,ad as Ym,ac as Qm,Z as Zm,au as Jm,av as ey,h as ty,b6 as ny,O as sy,ai as ry,N as iy,ah as oy,ao as ay,cf as uy,d4 as ly,ap as cy,aN as dy,aX as hy,ch as Nf,a1 as Rf,b as fy,aZ as py,a$ as gy,aJ as mo,bd as wf,aK as Ef,m as Af,w as my,k as yy,x as by,cs as _y,bp as xy,y as yo,z as bo,cE as ia,b9 as oa,bc as Ty,bh as vy,aj as Sy,ak as Ny,L as Ry,cA as Bl,aD as wy,an as Ey,am as Ay,d9 as Cy,cu as yc,c7 as My,cp as bc,cN as By,c$ as Py,cH as Cf,cG as Fy,d0 as Dy}from"./three.module-BXIk8GZS.js";import{az as Ly}from"./index-
|
|
1
|
+
import{v as Po,c8 as Lh,aG as Qe,cD as _n,cX as ce,br as bl,cY as V,aM as St,o as si,aO as kt,ct as _l,r as Dt,aQ as Uh,n as Yi,ax as cm,ae as Oh,K as Ih,l as kh,F as dm,bv as hm,ay as Gh,u as fm,cJ as pm,db as z,af as it,cm as xl,ba as cs,bo as Vh,co as Tl,dd as $h,dc as Oe,d6 as k,s as Ge,cd as Ss,aA as vt,bD as It,cZ as ze,a7 as gm,a6 as mm,B as ot,a5 as hs,T as xn,cW as Or,c_ as uo,cI as Zt,t as Ns,bt as ym,S as zh,c9 as bm,cv as vl,i as Wh,ag as _m,aw as xm,aE as Tm,cc as vm,C as Sm,A as Nm,d as Rm,b3 as wm,p as Ws,cO as ht,cr as js,cV as ds,al as st,cS as Ve,a3 as rt,e as jh,ca as Fo,cb as Do,P as Tn,Q as vn,c5 as Jt,c6 as Lo,b_ as Uo,b$ as qh,cT as Hh,cU as Xh,cQ as Sn,cR as Sl,cP as Nl,a0 as Oo,a4 as Kh,R as nn,bq as Hr,j as Em,bs as Am,aP as On,J as qs,a as pn,d3 as Un,bw as Js,d2 as Cm,_ as Rl,$ as wl,E as yu,W as lo,cn as ae,aL as ri,bn as El,aH as dc,bB as Io,d1 as Xr,d5 as Mm,d8 as co,aY as ko,q as Kr,ce as Go,aB as fs,aC as bu,b1 as Yr,b2 as Yh,b0 as xt,be as Qh,a8 as ho,aa as er,X as Zh,as as ii,aq as Al,f as Jh,b4 as ef,aF as hc,b8 as tr,d7 as Bm,cg as tf,cB as nf,bj as sf,bk as rf,bl as of,bm as af,U as uf,V as lf,cy as cf,cx as df,cz as hf,bi as ff,I as Pm,G as Fm,H as Dm,aI as pf,b7 as Nn,a_ as ks,cC as Gs,c as Vs,bb as gn,bf as gf,a9 as mf,ab as yf,Y as bf,at as _f,ar as xf,g as Tf,b5 as vf,bE as Cl,c4 as Qi,bX as Zi,bY as Ji,bZ as eo,c3 as fc,c2 as pc,bW as gc,bV as mc,c0 as _u,c1 as xu,bU as Tu,bx as vu,ci as Su,bC as fo,cl as Nu,bL as Ru,bM as wu,bN as Eu,bO as Au,bP as Cu,bQ as Mu,bR as Bu,bS as Pu,bG as Fu,bH as Du,bI as Lu,bF as Uu,bJ as Ou,bK as Iu,bT as ku,bA as Gu,ck as Vu,bz as po,cj as $u,M as Sf,aT as Lm,aV as Um,aU as Om,aW as Im,aS as km,aR as Gm,az as Vm,bu as $m,cw as zm,cq as Wm,by as jm,D as Vo,cF as Ml,cK as qm,cM as Hm,cL as Xm,a2 as go,bg as Km,ad as Ym,ac as Qm,Z as Zm,au as Jm,av as ey,h as ty,b6 as ny,O as sy,ai as ry,N as iy,ah as oy,ao as ay,cf as uy,d4 as ly,ap as cy,aN as dy,aX as hy,ch as Nf,a1 as Rf,b as fy,aZ as py,a$ as gy,aJ as mo,bd as wf,aK as Ef,m as Af,w as my,k as yy,x as by,cs as _y,bp as xy,y as yo,z as bo,cE as ia,b9 as oa,bc as Ty,bh as vy,aj as Sy,ak as Ny,L as Ry,cA as Bl,aD as wy,an as Ey,am as Ay,d9 as Cy,cu as yc,c7 as My,cp as bc,cN as By,c$ as Py,cH as Cf,cG as Fy,d0 as Dy}from"./three.module-BXIk8GZS.js";import{az as Ly}from"./index-MQh8C4aJ.js";import{i as fe,s as Uy,e as Pl,c as Oy,d as Iy,a as ky,b as Gy,f as Vy,t as Mf,g as $y,G as zy,T as _c,E as xc}from"./index-CfVUpsfM.js";import{o as Wy,h as jy,m as qy}from"./string-DtUow4KV.js";const Hs=new bl,mn=new ce,Bf=new V,aa=new ce,to=new ce,_o=new V,zu=new V,Pf=new St,Ff=new V,Df=new V;let nt=null,qt=null;const yn=[],$n={NONE:-1,PAN:0,ROTATE:1};class Hy extends Po{constructor(e,t,n=null){super(t,n),this.objects=e,this.recursive=!0,this.transformGroup=!1,this.rotateSpeed=1,this.raycaster=new Lh,this.mouseButtons={LEFT:Qe.PAN,MIDDLE:Qe.PAN,RIGHT:Qe.ROTATE},this.touches={ONE:_n.PAN},this._onPointerMove=Xy.bind(this),this._onPointerDown=Ky.bind(this),this._onPointerCancel=Yy.bind(this),this._onContextMenu=Qy.bind(this),n!==null&&this.connect(n)}connect(e){super.connect(e),this.domElement.addEventListener("pointermove",this._onPointerMove),this.domElement.addEventListener("pointerdown",this._onPointerDown),this.domElement.addEventListener("pointerup",this._onPointerCancel),this.domElement.addEventListener("pointerleave",this._onPointerCancel),this.domElement.addEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="none"}disconnect(){this.domElement.removeEventListener("pointermove",this._onPointerMove),this.domElement.removeEventListener("pointerdown",this._onPointerDown),this.domElement.removeEventListener("pointerup",this._onPointerCancel),this.domElement.removeEventListener("pointerleave",this._onPointerCancel),this.domElement.removeEventListener("contextmenu",this._onContextMenu),this.domElement.style.touchAction="",this.domElement.style.cursor=""}dispose(){this.disconnect()}_updatePointer(e){const t=this.domElement.getBoundingClientRect();mn.x=(e.clientX-t.left)/t.width*2-1,mn.y=-(e.clientY-t.top)/t.height*2+1}_updateState(e){let t;if(e.pointerType==="touch")t=this.touches.ONE;else switch(e.button){case 0:t=this.mouseButtons.LEFT;break;case 1:t=this.mouseButtons.MIDDLE;break;case 2:t=this.mouseButtons.RIGHT;break;default:t=null}switch(t){case Qe.PAN:case _n.PAN:this.state=$n.PAN;break;case Qe.ROTATE:case _n.ROTATE:this.state=$n.ROTATE;break;default:this.state=$n.NONE}}}function Xy(i){const e=this.object,t=this.domElement,n=this.raycaster;if(this.enabled!==!1){if(this._updatePointer(i),n.setFromCamera(mn,e),nt)this.state===$n.PAN?n.ray.intersectPlane(Hs,_o)&&(nt.position.copy(_o.sub(Bf).applyMatrix4(Pf)),this.dispatchEvent({type:"drag",object:nt})):this.state===$n.ROTATE&&(aa.subVectors(mn,to).multiplyScalar(this.rotateSpeed),nt.rotateOnWorldAxis(Ff,aa.x),nt.rotateOnWorldAxis(Df.normalize(),-aa.y),this.dispatchEvent({type:"drag",object:nt})),to.copy(mn);else if(i.pointerType==="mouse"||i.pointerType==="pen")if(yn.length=0,n.setFromCamera(mn,e),n.intersectObjects(this.objects,this.recursive,yn),yn.length>0){const s=yn[0].object;Hs.setFromNormalAndCoplanarPoint(e.getWorldDirection(Hs.normal),zu.setFromMatrixPosition(s.matrixWorld)),qt!==s&&qt!==null&&(this.dispatchEvent({type:"hoveroff",object:qt}),t.style.cursor="auto",qt=null),qt!==s&&(this.dispatchEvent({type:"hoveron",object:s}),t.style.cursor="pointer",qt=s)}else qt!==null&&(this.dispatchEvent({type:"hoveroff",object:qt}),t.style.cursor="auto",qt=null);to.copy(mn)}}function Ky(i){const e=this.object,t=this.domElement,n=this.raycaster;this.enabled!==!1&&(this._updatePointer(i),this._updateState(i),yn.length=0,n.setFromCamera(mn,e),n.intersectObjects(this.objects,this.recursive,yn),yn.length>0&&(this.transformGroup===!0?nt=Lf(yn[0].object):nt=yn[0].object,Hs.setFromNormalAndCoplanarPoint(e.getWorldDirection(Hs.normal),zu.setFromMatrixPosition(nt.matrixWorld)),n.ray.intersectPlane(Hs,_o)&&(this.state===$n.PAN?(Pf.copy(nt.parent.matrixWorld).invert(),Bf.copy(_o).sub(zu.setFromMatrixPosition(nt.matrixWorld)),t.style.cursor="move",this.dispatchEvent({type:"dragstart",object:nt})):this.state===$n.ROTATE&&(Ff.set(0,1,0).applyQuaternion(e.quaternion).normalize(),Df.set(1,0,0).applyQuaternion(e.quaternion).normalize(),t.style.cursor="move",this.dispatchEvent({type:"dragstart",object:nt})))),to.copy(mn))}function Yy(){this.enabled!==!1&&(nt&&(this.dispatchEvent({type:"dragend",object:nt}),nt=null),this.domElement.style.cursor=qt?"pointer":"auto",this.state=$n.NONE)}function Qy(i){this.enabled!==!1&&i.preventDefault()}function Lf(i,e=null){return i.isGroup&&(e=i),i.parent===null?e:Lf(i.parent,e)}function Zy(i){eb(i);const e=Jy(i);return i.on=e.on,i.off=e.off,i.fire=e.fire,i}function Jy(i){let e=Object.create(null);return{on:function(t,n,s){if(typeof n!="function")throw new Error("callback is expected to be a function");let r=e[t];return r||(r=e[t]=[]),r.push({callback:n,ctx:s}),i},off:function(t,n){if(typeof t>"u")return e=Object.create(null),i;if(e[t])if(typeof n!="function")delete e[t];else{const o=e[t];for(let a=0;a<o.length;++a)o[a].callback===n&&o.splice(a,1)}return i},fire:function(t){const n=e[t];if(!n)return i;let s;arguments.length>1&&(s=Array.prototype.slice.call(arguments,1));for(let r=0;r<n.length;++r){const o=n[r];o.callback.apply(o.ctx,s)}return i}}}function eb(i){if(!i)throw new Error("Eventify cannot use falsy object as events subject");const e=["on","fire","off"];for(let t=0;t<e.length;++t)if(i.hasOwnProperty(e[t]))throw new Error("Subject cannot be eventified, since it already has property '"+e[t]+"'")}function tb(i){if(i=i||{},"uniqueLinkId"in i&&(console.warn("ngraph.graph: Starting from version 0.14 `uniqueLinkId` is deprecated.\nUse `multigraph` option instead\n",`
|
|
2
2
|
`,`Note: there is also change in default behavior: From now on each graph
|
|
3
3
|
is considered to be not a multigraph by default (each edge is unique).`),i.multigraph=i.uniqueLinkId),i.multigraph===void 0&&(i.multigraph=!1),typeof Map!="function")throw new Error("ngraph.graph requires `Map` to be defined. Please polyfill it before using ngraph");var e=new Map,t=new Map,n={},s=0,r=i.multigraph?S:T,o=[],a=F,u=F,l=F,c=F,d={version:20,addNode:g,addLink:_,removeLink:P,removeNode:y,getNode:m,getNodeCount:N,getLinkCount:R,getEdgeCount:R,getLinksCount:R,getNodesCount:N,getLinks:v,forEachNode:ve,forEachLinkedNode:se,forEachLink:re,beginUpdate:l,endUpdate:c,clear:ee,hasLink:L,hasNode:m,getLink:L,getLinkById:j};return Zy(d),h(),d;function h(){var I=d.on;d.on=H;function H(){return d.beginUpdate=l=G,d.endUpdate=c=Q,a=f,u=p,d.on=I,I.apply(d,arguments)}}function f(I,H){o.push({link:I,changeType:H})}function p(I,H){o.push({node:I,changeType:H})}function g(I,H){if(I===void 0)throw new Error("Invalid node identifier");l();var le=m(I);return le?(le.data=H,u(le,"update")):(le=new nb(I,H),u(le,"add")),e.set(I,le),c(),le}function m(I){return e.get(I)}function y(I){var H=m(I);if(!H)return!1;l();var le=H.links;return le&&(le.forEach(D),H.links=null),e.delete(I),u(H,"remove"),c(),!0}function _(I,H,le){l();var Ce=m(I)||g(I),B=m(H)||g(H),U=r(I,H,le),K=t.has(U.id);return t.set(U.id,U),Tc(Ce,U),I!==H&&Tc(B,U),a(U,K?"update":"add"),c(),U}function T(I,H,le){var Ce=hi(I,H),B=t.get(Ce);return B?(B.data=le,B):new vc(I,H,le,Ce)}function S(I,H,le){var Ce=hi(I,H),B=n.hasOwnProperty(Ce);if(B||L(I,H)){B||(n[Ce]=0);var U="@"+ ++n[Ce];Ce=hi(I+U,H+U)}return new vc(I,H,le,Ce)}function N(){return e.size}function R(){return t.size}function v(I){var H=m(I);return H?H.links:null}function P(I,H){return H!==void 0&&(I=L(I,H)),D(I)}function D(I){if(!I||!t.get(I.id))return!1;l(),t.delete(I.id);var H=m(I.fromId),le=m(I.toId);return H&&H.links.delete(I),le&&le.links.delete(I),a(I,"remove"),c(),!0}function L(I,H){if(!(I===void 0||H===void 0))return t.get(hi(I,H))}function j(I){if(I!==void 0)return t.get(I)}function ee(){l(),ve(function(I){y(I.id)}),c()}function re(I){if(typeof I=="function")for(var H=t.values(),le=H.next();!le.done;){if(I(le.value))return!0;le=H.next()}}function se(I,H,le){var Ce=m(I);if(Ce&&Ce.links&&typeof H=="function")return le?oe(Ce.links,I,H):Z(Ce.links,I,H)}function Z(I,H,le){for(var Ce,B=I.values(),U=B.next();!U.done;){var K=U.value,me=K.fromId===H?K.toId:K.fromId;if(Ce=le(e.get(me),K),Ce)return!0;U=B.next()}}function oe(I,H,le){for(var Ce,B=I.values(),U=B.next();!U.done;){var K=U.value;if(K.fromId===H&&(Ce=le(e.get(K.toId),K),Ce))return!0;U=B.next()}}function F(){}function G(){s+=1}function Q(){s-=1,s===0&&o.length>0&&(d.fire("changed",o),o.length=0)}function ve(I){if(typeof I!="function")throw new Error("Function is expected to iterate over graph nodes. You passed "+I);for(var H=e.values(),le=H.next();!le.done;){if(I(le.value))return!0;le=H.next()}}}function nb(i,e){this.id=i,this.links=null,this.data=e}function Tc(i,e){i.links?i.links.add(e):i.links=new Set([e])}function vc(i,e,t,n){this.fromId=i,this.toId=e,this.data=t,this.id=n}function hi(i,e){return i.toString()+"👉 "+e.toString()}var fi={exports:{}},Cs={exports:{}},ua,Sc;function Uf(){return Sc||(Sc=1,ua=function(e){return e===0?"x":e===1?"y":e===2?"z":"c"+(e+1)}),ua}var la,Nc;function ar(){if(Nc)return la;Nc=1;const i=Uf();return la=function(t){return n;function n(s,r){let o=r&&r.indent||0,a=r&&r.join!==void 0?r.join:`
|
|
4
4
|
`,u=Array(o+1).join(" "),l=[];for(let c=0;c<t;++c){let d=i(c),h=c===0?"":u;l.push(h+s.replace(/{var}/g,d))}return l.join(a)}},la}var Rc;function sb(){if(Rc)return Cs.exports;Rc=1;const i=ar();Cs.exports=e,Cs.exports.generateCreateBodyFunctionBody=t,Cs.exports.getVectorCode=s,Cs.exports.getBodyCode=n;function e(r,o){let a=t(r,o),{Body:u}=new Function(a)();return u}function t(r,o){return`
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Ke=Object.defineProperty;var Je=(e,t,r)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var w=(e,t,r)=>Je(e,typeof t!="symbol"?t+"":t,r);import{aL as et,bm as ke,ba as tt,bd as f,R as Z,O as Oe,be as rt,aO as d}from"./index-DK8XzE3T.js";import{u as at,b as nt,r as st}from"./useProjectActivity-CVFCfbMj.js";function ot(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function le(e,t,r=""){const o=ot(e),a=e==null?void 0:e.length;if(!o||t!==void 0){const i=r&&`"${r}" `,s="",u=o?`length=${a}`:`type=${typeof e}`,p=i+"expected Uint8Array"+s+", got "+u;throw o?new RangeError(p):new TypeError(p)}return e}function be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function it(e,t){le(e,void 0,"digestInto() output");const r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function se(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const ct=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",lt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ut(e){if(le(e),ct)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=lt[e[r]];return t}function pt(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function dt(e,t={}){const r=(a,n)=>e(n).update(a).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.canXOF=o.canXOF,r.create=a=>e(a),Object.assign(r,t),Object.freeze(r)}const ft=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function ht(e,t,r){return e&t^~e&r}function mt(e,t,r){return e&t^e&r^t&r}class gt{constructor(t,r,o,a){w(this,"blockLen");w(this,"outputLen");w(this,"canXOF",!1);w(this,"padOffset");w(this,"isLE");w(this,"buffer");w(this,"view");w(this,"finished",!1);w(this,"length",0);w(this,"pos",0);w(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=o,this.isLE=a,this.buffer=new Uint8Array(t),this.view=se(this.buffer)}update(t){be(this),le(t);const{view:r,buffer:o,blockLen:a}=this,n=t.length;for(let i=0;i<n;){const s=Math.min(a-this.pos,n-i);if(s===a){const u=se(t);for(;a<=n-i;i+=a)this.process(u,i);continue}o.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===a&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){be(this),it(t,this),this.finished=!0;const{buffer:r,view:o,blockLen:a,isLE:n}=this;let{pos:i}=this;r[i++]=128,ce(this.buffer.subarray(i)),this.padOffset>a-i&&(this.process(o,0),i=0);for(let l=i;l<a;l++)r[l]=0;o.setBigUint64(a-8,BigInt(this.length*8),n),this.process(o,0);const s=se(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=u/4,h=this.get();if(p>h.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<p;l++)s.setUint32(4*l,h[l],n)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const o=t.slice(0,r);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:o,length:a,finished:n,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=n,t.length=a,t.pos=s,a%r&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const $=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),bt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=new Uint32Array(64);class yt extends gt{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:r,C:o,D:a,E:n,F:i,G:s,H:u}=this;return[t,r,o,a,n,i,s,u]}set(t,r,o,a,n,i,s,u){this.A=t|0,this.B=r|0,this.C=o|0,this.D=a|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=u|0}process(t,r){for(let l=0;l<16;l++,r+=4)I[l]=t.getUint32(r,!1);for(let l=16;l<64;l++){const b=I[l-15],g=I[l-2],S=C(b,7)^C(b,18)^b>>>3,v=C(g,17)^C(g,19)^g>>>10;I[l]=v+I[l-7]+S+I[l-16]|0}let{A:o,B:a,C:n,D:i,E:s,F:u,G:p,H:h}=this;for(let l=0;l<64;l++){const b=C(s,6)^C(s,11)^C(s,25),g=h+b+ht(s,u,p)+bt[l]+I[l]|0,v=(C(o,2)^C(o,13)^C(o,22))+mt(o,a,n)|0;h=p,p=u,u=s,s=i+g|0,i=n,n=a,a=o,o=g+v|0}o=o+this.A|0,a=a+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,u=u+this.F|0,p=p+this.G|0,h=h+this.H|0,this.set(o,a,n,i,s,u,p,h)}roundClean(){ce(I)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ce(this.buffer)}}class wt extends yt{constructor(){super(32);w(this,"A",$[0]|0);w(this,"B",$[1]|0);w(this,"C",$[2]|0);w(this,"D",$[3]|0);w(this,"E",$[4]|0);w(this,"F",$[5]|0);w(this,"G",$[6]|0);w(this,"H",$[7]|0)}}const vt=dt(()=>new wt,ft(1));var A;(function(e){e.WorkingMemory="WM",e.SharedWorkingMemory="SWM",e.VerifiableMemory="VM"})(A||(A={}));function oe(e){switch(e){case A.WorkingMemory:return"_working_memory";case A.SharedWorkingMemory:return"_shared_memory";case A.VerifiableMemory:return"_verifiable_memory"}}var ye;(function(e){e[e.SelfAttested=0]="SelfAttested",e[e.Endorsed=1]="Endorsed",e[e.PartiallyVerified=2]="PartiallyVerified",e[e.ConsensusVerified=3]="ConsensusVerified"})(ye||(ye={}));var we;(function(e){e.CREATE="CREATE",e.UPDATE="UPDATE"})(we||(we={}));A.WorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory,A.VerifiableMemory;A.WorkingMemory,A.SharedWorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory;const At=["working-memory","shared-working-memory","verifiable-memory"],St=(1n<<72n)-1n;St.toString();oe(A.WorkingMemory),A.WorkingMemory,oe(A.SharedWorkingMemory),A.SharedWorkingMemory,oe(A.VerifiableMemory),A.VerifiableMemory;function Le(e,t){return`did:dkg:context-graph:${e}/${t}`}function $e(e){return!e||e.length===0?{valid:!1,reason:"Sub-graph name cannot be empty"}:e.startsWith("_")?{valid:!1,reason:'Sub-graph names starting with "_" are reserved for protocol graphs'}:e.includes("/")?{valid:!1,reason:'Sub-graph names cannot contain "/"'}:/[<>"{}|^`\\\s]/.test(e)?{valid:!1,reason:"Sub-graph name contains characters unsafe for IRIs"}:e==="context"||e==="assertion"||e==="draft"?{valid:!1,reason:`"${e}" is a reserved path segment`}:{valid:!0}}const Et=["string","integer","number","boolean","iri"],xt=/^[A-Za-z][A-Za-z0-9_]*$/,Ct=/^[+-]?\d+$/,Nt=/^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;function F(e){if(e==null||e==="")return[];if(!Array.isArray(e))throw new Error("Query parameters must be an array.");const t=new Set;return e.map((r,o)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Query parameter at index ${o} must be an object.`);const a=r,n=typeof a.name=="string"?a.name.trim():"";if(!xt.test(n))throw new Error(`Query parameter at index ${o} has an invalid name: ${n||"<empty>"}.`);if(t.has(n))throw new Error(`Duplicate query parameter: ${n}.`);t.add(n);const i=a.type;if(typeof i!="string"||!Et.includes(i))throw new Error(`Query parameter ${n} has an unsupported type: ${String(i)}.`);const s={name:n,type:i};typeof a.label=="string"&&a.label.trim()&&(s.label=a.label.trim()),typeof a.description=="string"&&a.description.trim()&&(s.description=a.description.trim());let u;if(a.required!==void 0){if(typeof a.required!="boolean")throw new Error(`Query parameter ${n} required must be a boolean.`);u=a.required}const p=a.defaultValue!==void 0;if(p){if(!je(a.defaultValue))throw new Error(`Query parameter ${n} has an invalid defaultValue.`);Te(s,a.defaultValue),s.defaultValue=a.defaultValue}if(u===!0&&p)throw new Error(`Required query parameter ${n} cannot declare a defaultValue.`);if(u===!1&&!p)throw new Error(`Optional query parameter ${n} must declare a defaultValue.`);return s})}function hr(e){return e.defaultValue===void 0}function Pt(e){return JSON.stringify(F(e))}function Rt(e){const t=[];for(const r of _e(e))t.includes(r.name)||t.push(r.name);return t}function Ie(e,t){const r=F(t),o=new Set(r.map(n=>n.name)),a=new Set(Rt(e));for(const n of a)if(!o.has(n))throw new Error(`SPARQL template uses undeclared query parameter: ${n}.`);for(const n of r)if(!a.has(n.name))throw new Error(`Query parameter ${n.name} is not used by the SPARQL template.`)}function kt(e,t,r){const o=F(t);Ie(e,o);const a=new Set(o.map(p=>p.name));for(const p of Object.keys(r))if(!a.has(p))throw new Error(`Unknown query parameter: ${p}.`);const n=new Map;for(const p of o){const h=r[p.name],l=ve(h)?p.defaultValue:h;if(ve(l))throw new Error(`Missing required query parameter: ${p.name}.`);if(!je(l))throw new Error(`Query parameter ${p.name} must be a string, number, or boolean.`);n.set(p.name,Te(p,l))}const i=_e(e);let s="",u=0;for(const p of i)s+=e.slice(u,p.start),s+=n.get(p.name),u=p.end;return s+e.slice(u)}function Te(e,t){switch(e.type){case"string":return ke(String(t));case"integer":{const r=String(t).trim();if(!Ct.test(r))throw new Error(`Query parameter ${e.name} must be an integer.`);return r}case"number":{const r=String(t).trim();if(!Nt.test(r))throw new Error(`Query parameter ${e.name} must be a number.`);return r}case"boolean":{if(t===!0||t==="true")return"true";if(t===!1||t==="false")return"false";throw new Error(`Query parameter ${e.name} must be true or false.`)}case"iri":{const r=String(t).trim();if(!et(r))throw new Error(`Query parameter ${e.name} must be a safe absolute IRI.`);return`<${r}>`}}}function je(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ve(e){return e==null}function _e(e){const t=[...e.matchAll(/\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/g)],r=e.replace(/\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/g,n=>"0".repeat(n.length)),o=tt(r);if(o.status!=="valid")throw new Error("SPARQL template contains invalid lexical syntax.");const a=[];for(const n of t){const i=n.index;if(o.masked[i]===" ")continue;const s=i+n[0].length,u=e[i-1],p=e[s];if(u&&/[A-Za-z0-9_?:.%~-]/.test(u)||p&&/[A-Za-z0-9_?:.%~-]/.test(p))throw new Error(`Query parameter ${n[1]} must occupy a complete SPARQL term position.`);a.push({name:n[1],start:i,end:s})}return a}const Ot=2,ue="__context_graph",mr="ui-saved-queries",gr="Saved queries",E="http://dkg.io/ontology/profile/",Ae="http://schema.org/",Se="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Lt="http://www.w3.org/2001/XMLSchema#integer";class k extends Error{constructor(r="Incompatible query-catalog daemon contract. Upgrade the daemon and retry."){super(r);w(this,"code","QUERY_CATALOG_CONTRACT_INCOMPATIBLE");this.name="QueryCatalogContractError"}}function $t(e,t){if(t===ue)return`did:dkg:context-graph:${e}`;const r=$e(t);if(!r.valid)throw new Error(`Invalid query-catalog subgraph "${t}": ${r.reason}`);return Le(e,t)}function It(e,t){const r=`did:dkg:context-graph:${e}`;if(t===r)return ue;const o=`${r}/`;if(!t.startsWith(o))throw new Error(`Query-catalog scope graph <${t}> is outside context graph "${e}".`);const a=t.slice(o.length),n=$e(a);if(!n.valid)throw new Error(`Invalid query-catalog scope graph <${t}>: ${n.reason}`);if(Le(e,a)!==t)throw new Error(`Query-catalog scope graph <${t}> is not a canonical subgraph IRI.`);return a}function br(e,t={}){return{sparql:kt(e.sparql,e.parameters,t),...e.view?{view:e.view}:{},...e.subGraph&&e.subGraph!==ue?{subGraphName:e.subGraph}:{}}}function Tt(e){return At.includes(e)?e:void 0}function jt(e){if(!e||typeof e!="object"||Array.isArray(e))throw new k;const t=e,r=t.capabilities;if(t.schemaVersion!==Ot||(r==null?void 0:r.canonicalItems)!==!0||(r==null?void 0:r.queryParameters)!==!0||(r==null?void 0:r.executionView)!==!0||(r==null?void 0:r.graphScopeIri)!==!0||!Array.isArray(t.items))throw new k;return t.items.map((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))throw new k(`Invalid query-catalog item at index ${a}.`);const n=o,i=["queryIri","catalogIri","slug","name","sparql","catalogSlug","catalogName","subGraph","scopeGraph"];for(const l of i)if(typeof n[l]!="string")throw new k(`Invalid query-catalog item ${a}: ${l} must be a string.`);if(typeof n.rank!="number"||!Number.isFinite(n.rank)||typeof n.catalogRank!="number"||!Number.isFinite(n.catalogRank))throw new k(`Invalid query-catalog item ${a}: ranks must be finite numbers.`);const s=n.view===void 0?void 0:Tt(String(n.view));if(n.view!==void 0&&s===void 0)throw new k(`Invalid query-catalog item ${a}: unsupported execution view.`);const u=n.scopeGraph,p=typeof t.contextGraphId=="string"?t.contextGraphId:void 0;if(!p)throw new k("Invalid query-catalog response: contextGraphId must be a string.");let h;try{h=It(p,u)}catch(l){throw new k(`Invalid query-catalog item ${a}: ${l instanceof Error?l.message:String(l)}`)}if(h!==n.subGraph)throw new k(`Invalid query-catalog item ${a}: scopeGraph and subGraph do not match.`);return{queryIri:n.queryIri,catalogIri:n.catalogIri,slug:n.slug,name:n.name,...typeof n.description=="string"?{description:n.description}:{},sparql:n.sparql,...typeof n.resultColumn=="string"?{resultColumn:n.resultColumn}:{},rank:n.rank,catalogSlug:n.catalogSlug,catalogName:n.catalogName,...typeof n.catalogDescription=="string"?{catalogDescription:n.catalogDescription}:{},catalogRank:n.catalogRank,subGraph:n.subGraph,scopeGraph:u,parameters:F(n.parameters),...s?{view:s}:{}}})}function _t(e){const t=new Map;for(const r of e){const o=`${r.subGraph}|${r.catalogSlug}`,a=t.get(o);if(a){if(a.name!==r.catalogName||a.description!==r.catalogDescription||a.rank!==r.catalogRank)throw new Error(`Query catalog ${r.catalogSlug} has conflicting metadata.`);a.queries.push(r);continue}t.set(o,{slug:r.catalogSlug,subGraph:r.subGraph,name:r.catalogName,description:r.catalogDescription,rank:r.catalogRank,queries:[r]})}return[...t.values()].map(r=>({...r,queries:[...r.queries].sort((o,a)=>o.rank-a.rank||o.name.localeCompare(a.name))})).sort((r,o)=>r.subGraph.localeCompare(o.subGraph)||r.rank-o.rank||r.name.localeCompare(o.name))}function Mt(e){return e.trim().toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Ee(e,t,r){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(r)}`}function Gt(e){return ut(vt(pt(e)))}function N(e){return JSON.stringify(e)}function xe(e){return`"${e}"^^<${Lt}>`}function yr(e){const t=F(e.parameters),r=JSON.stringify({subGraph:e.subGraph,catalogSlug:e.catalogSlug,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,parameters:t,view:e.view}),o=`${Mt(e.name)}-${Gt(r)}`,a=Ee(e.contextGraphId,"catalog",e.catalogSlug),n=Ee(e.contextGraphId,"query",o),i=$t(e.contextGraphId,e.subGraph);Ie(e.sparql,t);const s=[{subject:a,predicate:Se,object:`${E}QueryCatalog`,graph:""},{subject:a,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:a,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:a,predicate:`${E}displayName`,object:N(e.catalogName),graph:""},{subject:a,predicate:`${E}rank`,object:xe(e.catalogRank),graph:""},{subject:n,predicate:Se,object:`${E}SavedQuery`,graph:""},{subject:n,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:n,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:n,predicate:`${E}inCatalog`,object:a,graph:""},{subject:n,predicate:`${E}displayName`,object:N(e.name),graph:""},{subject:n,predicate:`${E}sparqlQuery`,object:N(e.sparql),graph:""},{subject:n,predicate:`${E}rank`,object:xe(e.rank),graph:""}];return e.catalogDescription&&s.push({subject:a,predicate:`${Ae}description`,object:N(e.catalogDescription),graph:""}),e.description&&s.push({subject:n,predicate:`${Ae}description`,object:N(e.description),graph:""}),e.resultColumn&&s.push({subject:n,predicate:`${E}resultColumn`,object:N(e.resultColumn),graph:""}),t.length>0&&s.push({subject:n,predicate:`${E}queryParameters`,object:N(Pt(t)),graph:""}),e.view&&s.push({subject:n,predicate:`${E}executionView`,object:N(e.view),graph:""}),{savedQuery:{queryIri:n,catalogIri:a,slug:o,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,catalogSlug:e.catalogSlug,catalogName:e.catalogName,catalogDescription:e.catalogDescription,catalogRank:e.catalogRank,subGraph:e.subGraph,scopeGraph:i,parameters:t,view:e.view,queryUri:n,catalogUri:a},quads:s}}const Ut=new Set(["meta"]),Me="__root__";function wr(e){return!Ut.has(e.name)}function G(e){const t=`did:dkg:context-graph:${e}/meta`;return`FILTER(strstarts(str(?g), ${ke(t)}))`}async function H(e,t){var o;const r=await Oe(e,{contextGraphId:t});return((o=r==null?void 0:r.result)==null?void 0:o.bindings)??[]}async function Qt(e){const t=await rt(e);return jt(t)}const P={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},Ce=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),qt={slug:Me,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},Ne=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),B="http://dkg.io/ontology/profile/";function Ge(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function m(e){const t=Ge(e);if(!t)return"";const r=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return r?r[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
1
|
+
var Ke=Object.defineProperty;var Je=(e,t,r)=>t in e?Ke(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var w=(e,t,r)=>Je(e,typeof t!="symbol"?t+"":t,r);import{aL as et,bm as ke,ba as tt,bd as f,R as Z,O as Oe,be as rt,aO as d}from"./index-MQh8C4aJ.js";import{u as at,b as nt,r as st}from"./useProjectActivity-Cxr4QGX1.js";function ot(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"&&"BYTES_PER_ELEMENT"in e&&e.BYTES_PER_ELEMENT===1}function le(e,t,r=""){const o=ot(e),a=e==null?void 0:e.length;if(!o||t!==void 0){const i=r&&`"${r}" `,s="",u=o?`length=${a}`:`type=${typeof e}`,p=i+"expected Uint8Array"+s+", got "+u;throw o?new RangeError(p):new TypeError(p)}return e}function be(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function it(e,t){le(e,void 0,"digestInto() output");const r=t.outputLen;if(e.length<r)throw new RangeError('"digestInto() output" expected to be of length >='+r)}function ce(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function se(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function C(e,t){return e<<32-t|e>>>t}const ct=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",lt=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ut(e){if(le(e),ct)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=lt[e[r]];return t}function pt(e){if(typeof e!="string")throw new TypeError("string expected");return new Uint8Array(new TextEncoder().encode(e))}function dt(e,t={}){const r=(a,n)=>e(n).update(a).digest(),o=e(void 0);return r.outputLen=o.outputLen,r.blockLen=o.blockLen,r.canXOF=o.canXOF,r.create=a=>e(a),Object.assign(r,t),Object.freeze(r)}const ft=e=>({oid:Uint8Array.from([6,9,96,134,72,1,101,3,4,2,e])});function ht(e,t,r){return e&t^~e&r}function mt(e,t,r){return e&t^e&r^t&r}class gt{constructor(t,r,o,a){w(this,"blockLen");w(this,"outputLen");w(this,"canXOF",!1);w(this,"padOffset");w(this,"isLE");w(this,"buffer");w(this,"view");w(this,"finished",!1);w(this,"length",0);w(this,"pos",0);w(this,"destroyed",!1);this.blockLen=t,this.outputLen=r,this.padOffset=o,this.isLE=a,this.buffer=new Uint8Array(t),this.view=se(this.buffer)}update(t){be(this),le(t);const{view:r,buffer:o,blockLen:a}=this,n=t.length;for(let i=0;i<n;){const s=Math.min(a-this.pos,n-i);if(s===a){const u=se(t);for(;a<=n-i;i+=a)this.process(u,i);continue}o.set(t.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===a&&(this.process(r,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){be(this),it(t,this),this.finished=!0;const{buffer:r,view:o,blockLen:a,isLE:n}=this;let{pos:i}=this;r[i++]=128,ce(this.buffer.subarray(i)),this.padOffset>a-i&&(this.process(o,0),i=0);for(let l=i;l<a;l++)r[l]=0;o.setBigUint64(a-8,BigInt(this.length*8),n),this.process(o,0);const s=se(t),u=this.outputLen;if(u%4)throw new Error("_sha2: outputLen must be aligned to 32bit");const p=u/4,h=this.get();if(p>h.length)throw new Error("_sha2: outputLen bigger than state");for(let l=0;l<p;l++)s.setUint32(4*l,h[l],n)}digest(){const{buffer:t,outputLen:r}=this;this.digestInto(t);const o=t.slice(0,r);return this.destroy(),o}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:r,buffer:o,length:a,finished:n,destroyed:i,pos:s}=this;return t.destroyed=i,t.finished=n,t.length=a,t.pos=s,a%r&&t.buffer.set(o),t}clone(){return this._cloneInto()}}const $=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),bt=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),I=new Uint32Array(64);class yt extends gt{constructor(t){super(64,t,8,!1)}get(){const{A:t,B:r,C:o,D:a,E:n,F:i,G:s,H:u}=this;return[t,r,o,a,n,i,s,u]}set(t,r,o,a,n,i,s,u){this.A=t|0,this.B=r|0,this.C=o|0,this.D=a|0,this.E=n|0,this.F=i|0,this.G=s|0,this.H=u|0}process(t,r){for(let l=0;l<16;l++,r+=4)I[l]=t.getUint32(r,!1);for(let l=16;l<64;l++){const b=I[l-15],g=I[l-2],S=C(b,7)^C(b,18)^b>>>3,v=C(g,17)^C(g,19)^g>>>10;I[l]=v+I[l-7]+S+I[l-16]|0}let{A:o,B:a,C:n,D:i,E:s,F:u,G:p,H:h}=this;for(let l=0;l<64;l++){const b=C(s,6)^C(s,11)^C(s,25),g=h+b+ht(s,u,p)+bt[l]+I[l]|0,v=(C(o,2)^C(o,13)^C(o,22))+mt(o,a,n)|0;h=p,p=u,u=s,s=i+g|0,i=n,n=a,a=o,o=g+v|0}o=o+this.A|0,a=a+this.B|0,n=n+this.C|0,i=i+this.D|0,s=s+this.E|0,u=u+this.F|0,p=p+this.G|0,h=h+this.H|0,this.set(o,a,n,i,s,u,p,h)}roundClean(){ce(I)}destroy(){this.destroyed=!0,this.set(0,0,0,0,0,0,0,0),ce(this.buffer)}}class wt extends yt{constructor(){super(32);w(this,"A",$[0]|0);w(this,"B",$[1]|0);w(this,"C",$[2]|0);w(this,"D",$[3]|0);w(this,"E",$[4]|0);w(this,"F",$[5]|0);w(this,"G",$[6]|0);w(this,"H",$[7]|0)}}const vt=dt(()=>new wt,ft(1));var A;(function(e){e.WorkingMemory="WM",e.SharedWorkingMemory="SWM",e.VerifiableMemory="VM"})(A||(A={}));function oe(e){switch(e){case A.WorkingMemory:return"_working_memory";case A.SharedWorkingMemory:return"_shared_memory";case A.VerifiableMemory:return"_verifiable_memory"}}var ye;(function(e){e[e.SelfAttested=0]="SelfAttested",e[e.Endorsed=1]="Endorsed",e[e.PartiallyVerified=2]="PartiallyVerified",e[e.ConsensusVerified=3]="ConsensusVerified"})(ye||(ye={}));var we;(function(e){e.CREATE="CREATE",e.UPDATE="UPDATE"})(we||(we={}));A.WorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory,A.VerifiableMemory;A.WorkingMemory,A.SharedWorkingMemory,A.SharedWorkingMemory,A.VerifiableMemory;const At=["working-memory","shared-working-memory","verifiable-memory"],St=(1n<<72n)-1n;St.toString();oe(A.WorkingMemory),A.WorkingMemory,oe(A.SharedWorkingMemory),A.SharedWorkingMemory,oe(A.VerifiableMemory),A.VerifiableMemory;function Le(e,t){return`did:dkg:context-graph:${e}/${t}`}function $e(e){return!e||e.length===0?{valid:!1,reason:"Sub-graph name cannot be empty"}:e.startsWith("_")?{valid:!1,reason:'Sub-graph names starting with "_" are reserved for protocol graphs'}:e.includes("/")?{valid:!1,reason:'Sub-graph names cannot contain "/"'}:/[<>"{}|^`\\\s]/.test(e)?{valid:!1,reason:"Sub-graph name contains characters unsafe for IRIs"}:e==="context"||e==="assertion"||e==="draft"?{valid:!1,reason:`"${e}" is a reserved path segment`}:{valid:!0}}const Et=["string","integer","number","boolean","iri"],xt=/^[A-Za-z][A-Za-z0-9_]*$/,Ct=/^[+-]?\d+$/,Nt=/^[+-]?(?:(?:\d+(?:\.\d*)?)|(?:\.\d+))(?:[eE][+-]?\d+)?$/;function F(e){if(e==null||e==="")return[];if(!Array.isArray(e))throw new Error("Query parameters must be an array.");const t=new Set;return e.map((r,o)=>{if(!r||typeof r!="object"||Array.isArray(r))throw new Error(`Query parameter at index ${o} must be an object.`);const a=r,n=typeof a.name=="string"?a.name.trim():"";if(!xt.test(n))throw new Error(`Query parameter at index ${o} has an invalid name: ${n||"<empty>"}.`);if(t.has(n))throw new Error(`Duplicate query parameter: ${n}.`);t.add(n);const i=a.type;if(typeof i!="string"||!Et.includes(i))throw new Error(`Query parameter ${n} has an unsupported type: ${String(i)}.`);const s={name:n,type:i};typeof a.label=="string"&&a.label.trim()&&(s.label=a.label.trim()),typeof a.description=="string"&&a.description.trim()&&(s.description=a.description.trim());let u;if(a.required!==void 0){if(typeof a.required!="boolean")throw new Error(`Query parameter ${n} required must be a boolean.`);u=a.required}const p=a.defaultValue!==void 0;if(p){if(!je(a.defaultValue))throw new Error(`Query parameter ${n} has an invalid defaultValue.`);Te(s,a.defaultValue),s.defaultValue=a.defaultValue}if(u===!0&&p)throw new Error(`Required query parameter ${n} cannot declare a defaultValue.`);if(u===!1&&!p)throw new Error(`Optional query parameter ${n} must declare a defaultValue.`);return s})}function hr(e){return e.defaultValue===void 0}function Pt(e){return JSON.stringify(F(e))}function Rt(e){const t=[];for(const r of _e(e))t.includes(r.name)||t.push(r.name);return t}function Ie(e,t){const r=F(t),o=new Set(r.map(n=>n.name)),a=new Set(Rt(e));for(const n of a)if(!o.has(n))throw new Error(`SPARQL template uses undeclared query parameter: ${n}.`);for(const n of r)if(!a.has(n.name))throw new Error(`Query parameter ${n.name} is not used by the SPARQL template.`)}function kt(e,t,r){const o=F(t);Ie(e,o);const a=new Set(o.map(p=>p.name));for(const p of Object.keys(r))if(!a.has(p))throw new Error(`Unknown query parameter: ${p}.`);const n=new Map;for(const p of o){const h=r[p.name],l=ve(h)?p.defaultValue:h;if(ve(l))throw new Error(`Missing required query parameter: ${p.name}.`);if(!je(l))throw new Error(`Query parameter ${p.name} must be a string, number, or boolean.`);n.set(p.name,Te(p,l))}const i=_e(e);let s="",u=0;for(const p of i)s+=e.slice(u,p.start),s+=n.get(p.name),u=p.end;return s+e.slice(u)}function Te(e,t){switch(e.type){case"string":return ke(String(t));case"integer":{const r=String(t).trim();if(!Ct.test(r))throw new Error(`Query parameter ${e.name} must be an integer.`);return r}case"number":{const r=String(t).trim();if(!Nt.test(r))throw new Error(`Query parameter ${e.name} must be a number.`);return r}case"boolean":{if(t===!0||t==="true")return"true";if(t===!1||t==="false")return"false";throw new Error(`Query parameter ${e.name} must be true or false.`)}case"iri":{const r=String(t).trim();if(!et(r))throw new Error(`Query parameter ${e.name} must be a safe absolute IRI.`);return`<${r}>`}}}function je(e){return typeof e=="string"||typeof e=="number"||typeof e=="boolean"}function ve(e){return e==null}function _e(e){const t=[...e.matchAll(/\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/g)],r=e.replace(/\{\{([A-Za-z][A-Za-z0-9_]*)\}\}/g,n=>"0".repeat(n.length)),o=tt(r);if(o.status!=="valid")throw new Error("SPARQL template contains invalid lexical syntax.");const a=[];for(const n of t){const i=n.index;if(o.masked[i]===" ")continue;const s=i+n[0].length,u=e[i-1],p=e[s];if(u&&/[A-Za-z0-9_?:.%~-]/.test(u)||p&&/[A-Za-z0-9_?:.%~-]/.test(p))throw new Error(`Query parameter ${n[1]} must occupy a complete SPARQL term position.`);a.push({name:n[1],start:i,end:s})}return a}const Ot=2,ue="__context_graph",mr="ui-saved-queries",gr="Saved queries",E="http://dkg.io/ontology/profile/",Ae="http://schema.org/",Se="http://www.w3.org/1999/02/22-rdf-syntax-ns#type",Lt="http://www.w3.org/2001/XMLSchema#integer";class k extends Error{constructor(r="Incompatible query-catalog daemon contract. Upgrade the daemon and retry."){super(r);w(this,"code","QUERY_CATALOG_CONTRACT_INCOMPATIBLE");this.name="QueryCatalogContractError"}}function $t(e,t){if(t===ue)return`did:dkg:context-graph:${e}`;const r=$e(t);if(!r.valid)throw new Error(`Invalid query-catalog subgraph "${t}": ${r.reason}`);return Le(e,t)}function It(e,t){const r=`did:dkg:context-graph:${e}`;if(t===r)return ue;const o=`${r}/`;if(!t.startsWith(o))throw new Error(`Query-catalog scope graph <${t}> is outside context graph "${e}".`);const a=t.slice(o.length),n=$e(a);if(!n.valid)throw new Error(`Invalid query-catalog scope graph <${t}>: ${n.reason}`);if(Le(e,a)!==t)throw new Error(`Query-catalog scope graph <${t}> is not a canonical subgraph IRI.`);return a}function br(e,t={}){return{sparql:kt(e.sparql,e.parameters,t),...e.view?{view:e.view}:{},...e.subGraph&&e.subGraph!==ue?{subGraphName:e.subGraph}:{}}}function Tt(e){return At.includes(e)?e:void 0}function jt(e){if(!e||typeof e!="object"||Array.isArray(e))throw new k;const t=e,r=t.capabilities;if(t.schemaVersion!==Ot||(r==null?void 0:r.canonicalItems)!==!0||(r==null?void 0:r.queryParameters)!==!0||(r==null?void 0:r.executionView)!==!0||(r==null?void 0:r.graphScopeIri)!==!0||!Array.isArray(t.items))throw new k;return t.items.map((o,a)=>{if(!o||typeof o!="object"||Array.isArray(o))throw new k(`Invalid query-catalog item at index ${a}.`);const n=o,i=["queryIri","catalogIri","slug","name","sparql","catalogSlug","catalogName","subGraph","scopeGraph"];for(const l of i)if(typeof n[l]!="string")throw new k(`Invalid query-catalog item ${a}: ${l} must be a string.`);if(typeof n.rank!="number"||!Number.isFinite(n.rank)||typeof n.catalogRank!="number"||!Number.isFinite(n.catalogRank))throw new k(`Invalid query-catalog item ${a}: ranks must be finite numbers.`);const s=n.view===void 0?void 0:Tt(String(n.view));if(n.view!==void 0&&s===void 0)throw new k(`Invalid query-catalog item ${a}: unsupported execution view.`);const u=n.scopeGraph,p=typeof t.contextGraphId=="string"?t.contextGraphId:void 0;if(!p)throw new k("Invalid query-catalog response: contextGraphId must be a string.");let h;try{h=It(p,u)}catch(l){throw new k(`Invalid query-catalog item ${a}: ${l instanceof Error?l.message:String(l)}`)}if(h!==n.subGraph)throw new k(`Invalid query-catalog item ${a}: scopeGraph and subGraph do not match.`);return{queryIri:n.queryIri,catalogIri:n.catalogIri,slug:n.slug,name:n.name,...typeof n.description=="string"?{description:n.description}:{},sparql:n.sparql,...typeof n.resultColumn=="string"?{resultColumn:n.resultColumn}:{},rank:n.rank,catalogSlug:n.catalogSlug,catalogName:n.catalogName,...typeof n.catalogDescription=="string"?{catalogDescription:n.catalogDescription}:{},catalogRank:n.catalogRank,subGraph:n.subGraph,scopeGraph:u,parameters:F(n.parameters),...s?{view:s}:{}}})}function _t(e){const t=new Map;for(const r of e){const o=`${r.subGraph}|${r.catalogSlug}`,a=t.get(o);if(a){if(a.name!==r.catalogName||a.description!==r.catalogDescription||a.rank!==r.catalogRank)throw new Error(`Query catalog ${r.catalogSlug} has conflicting metadata.`);a.queries.push(r);continue}t.set(o,{slug:r.catalogSlug,subGraph:r.subGraph,name:r.catalogName,description:r.catalogDescription,rank:r.catalogRank,queries:[r]})}return[...t.values()].map(r=>({...r,queries:[...r.queries].sort((o,a)=>o.rank-a.rank||o.name.localeCompare(a.name))})).sort((r,o)=>r.subGraph.localeCompare(o.subGraph)||r.rank-o.rank||r.name.localeCompare(o.name))}function Mt(e){return e.trim().toLowerCase().normalize("NFKD").replace(/[\u0300-\u036f]/g,"").replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,48)||"saved-query"}function Ee(e,t,r){return`urn:dkg:profile:${encodeURIComponent(e)}:${t}:${encodeURIComponent(r)}`}function Gt(e){return ut(vt(pt(e)))}function N(e){return JSON.stringify(e)}function xe(e){return`"${e}"^^<${Lt}>`}function yr(e){const t=F(e.parameters),r=JSON.stringify({subGraph:e.subGraph,catalogSlug:e.catalogSlug,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,parameters:t,view:e.view}),o=`${Mt(e.name)}-${Gt(r)}`,a=Ee(e.contextGraphId,"catalog",e.catalogSlug),n=Ee(e.contextGraphId,"query",o),i=$t(e.contextGraphId,e.subGraph);Ie(e.sparql,t);const s=[{subject:a,predicate:Se,object:`${E}QueryCatalog`,graph:""},{subject:a,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:a,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:a,predicate:`${E}displayName`,object:N(e.catalogName),graph:""},{subject:a,predicate:`${E}rank`,object:xe(e.catalogRank),graph:""},{subject:n,predicate:Se,object:`${E}SavedQuery`,graph:""},{subject:n,predicate:`${E}scopeGraph`,object:i,graph:""},{subject:n,predicate:`${E}forSubGraph`,object:N(e.subGraph),graph:""},{subject:n,predicate:`${E}inCatalog`,object:a,graph:""},{subject:n,predicate:`${E}displayName`,object:N(e.name),graph:""},{subject:n,predicate:`${E}sparqlQuery`,object:N(e.sparql),graph:""},{subject:n,predicate:`${E}rank`,object:xe(e.rank),graph:""}];return e.catalogDescription&&s.push({subject:a,predicate:`${Ae}description`,object:N(e.catalogDescription),graph:""}),e.description&&s.push({subject:n,predicate:`${Ae}description`,object:N(e.description),graph:""}),e.resultColumn&&s.push({subject:n,predicate:`${E}resultColumn`,object:N(e.resultColumn),graph:""}),t.length>0&&s.push({subject:n,predicate:`${E}queryParameters`,object:N(Pt(t)),graph:""}),e.view&&s.push({subject:n,predicate:`${E}executionView`,object:N(e.view),graph:""}),{savedQuery:{queryIri:n,catalogIri:a,slug:o,name:e.name,description:e.description,sparql:e.sparql,resultColumn:e.resultColumn,rank:e.rank,catalogSlug:e.catalogSlug,catalogName:e.catalogName,catalogDescription:e.catalogDescription,catalogRank:e.catalogRank,subGraph:e.subGraph,scopeGraph:i,parameters:t,view:e.view,queryUri:n,catalogUri:a},quads:s}}const Ut=new Set(["meta"]),Me="__root__";function wr(e){return!Ut.has(e.name)}function G(e){const t=`did:dkg:context-graph:${e}/meta`;return`FILTER(strstarts(str(?g), ${ke(t)}))`}async function H(e,t){var o;const r=await Oe(e,{contextGraphId:t});return((o=r==null?void 0:r.result)==null?void 0:o.bindings)??[]}async function Qt(e){const t=await rt(e);return jt(t)}const P={displayName:"Project",primaryColor:"#a855f7",accentColor:"#22c55e"},Ce=e=>({slug:e,displayName:e,icon:"•",color:"#64748b",rank:99}),qt={slug:Me,displayName:"Root",description:"Entities not in any subgraph (Context Graph root)",icon:"⊘",rank:99},Ne=e=>({typeIri:e,label:e.split(/[/#]/).pop()||e,color:"#64748b"}),B="http://dkg.io/ontology/profile/";function Ge(e){if(e==null)return"";if(typeof e=="string")return e;if(typeof e=="object"&&"value"in e){const t=e.value;return t==null?"":String(t)}return String(e)}function m(e){const t=Ge(e);if(!t)return"";const r=t.match(/^"((?:[^"\\]|\\.)*)"(?:@[\w-]+|\^\^<[^>]+>)?$/);return r?r[1].replace(/\\"/g,'"').replace(/\\n/g,`
|
|
2
2
|
`).replace(/\\\\/g,"\\"):t}function Ht(e){const t=m(e),r=parseInt(t,10);return Number.isFinite(r)?r:0}function Ft(e){return`PREFIX prof: <${B}>
|
|
3
3
|
PREFIX schema: <http://schema.org/>
|
|
4
4
|
SELECT ?profile ?name ?description ?primary ?accent
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aO as e,j as t}from"./index-
|
|
1
|
+
import{aO as e,j as t}from"./index-MQh8C4aJ.js";function n(){return e.jsxs("div",{className:"page-section",style:{display:"flex",flexDirection:"column",height:"100%",padding:0},children:[e.jsxs("div",{style:{marginBottom:20},children:[e.jsx("h1",{className:"page-title",style:{marginBottom:0},children:"Agent Hub"}),e.jsx("p",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4},children:"Bring your own agent into the node. OpenClaw chat, network peers, and integrated-agent session history live here."})]}),e.jsx("div",{style:{flex:1,minHeight:0,border:"1px solid var(--border)",borderRadius:12,overflow:"hidden",background:"var(--bg)"},children:e.jsx(t,{})})]})}export{n as AgentHubPage};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{bd as x,aO as e,bE as w,bM as P,bL as A,R as b}from"./index-
|
|
1
|
+
import{bd as x,aO as e,bE as w,bM as P,bL as A,R as b}from"./index-MQh8C4aJ.js";import{f as C,h as T,a as N,A as E,g as R,u as M,P as $,b as D}from"./ActivityFeed-Bfg6fmQQ.js";import"./useProjectActivity-Cxr4QGX1.js";const S="http://www.w3.org/ns/prov#wasAttributedTo",k=[{iri:"http://dkg.io/ontology/decisions/Decision",label:"Decisions"},{iri:"http://dkg.io/ontology/tasks/Task",label:"Tasks"},{iri:"http://dkg.io/ontology/github/PullRequest",label:"Pull Requests"},{iri:"http://dkg.io/ontology/github/Issue",label:"Issues"},{iri:"http://dkg.io/ontology/github/Commit",label:"Commits"}],B=({agentUri:a,entityList:d,onSelectEntity:u,onOpenAgent:r,onBack:j})=>{const o=C(),c=T(),s=(o==null?void 0:o.get(a))??null,p=x.useMemo(()=>{const t=new Map;for(const l of d){if(!l.connections.some(f=>f.predicate===S&&f.targetUri===a))continue;const n=k.find(f=>l.types.includes(f.iri));if(!n)continue;const y=t.get(n.iri)??[];y.push(l),t.set(n.iri,y)}return t},[d,a]),g=x.useMemo(()=>{let t=0;for(const l of p.values())t+=l.length;return t},[p]),m=s!=null&&s.operatorUri?(o==null?void 0:o.get(s.operatorUri))??null:null,[v,h]=x.useState(null);return e.jsxs("div",{className:"v10-agent-profile",children:[e.jsxs("div",{className:"v10-agent-profile-header",children:[e.jsx("button",{type:"button",className:"v10-ka-back",onClick:j,children:"← Back"}),e.jsxs("div",{className:"v10-agent-profile-head",children:[e.jsx(N,{agent:s??void 0,fallbackUri:a,size:"lg",showOperator:!0}),(s==null?void 0:s.reputation)&&e.jsx("div",{className:"v10-agent-profile-reputation",children:s.reputation})]}),e.jsxs("div",{className:"v10-agent-profile-meta",children:[(s==null?void 0:s.walletAddress)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Wallet"}),e.jsxs("span",{className:"v10-agent-profile-meta-val mono v10-agent-profile-wallet",title:s.walletAddress,children:[s.walletAddress,e.jsx("button",{type:"button",className:"v10-agent-profile-copy",onClick:t=>{var l;t.stopPropagation(),(l=navigator.clipboard)==null||l.writeText(s.walletAddress).catch(()=>{})},title:"Copy wallet address",children:"⎘"})]})]}),e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"URI"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:a})]}),(s==null?void 0:s.peerId)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Peer ID"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:s.peerId})]}),m&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Driven by"}),e.jsx("span",{className:"v10-agent-profile-meta-val",children:e.jsx(N,{agent:m,size:"sm",onOpenAgent:r})})]}),(s==null?void 0:s.framework)&&e.jsxs("div",{className:"v10-agent-profile-meta-row",children:[e.jsx("span",{className:"v10-agent-profile-meta-lbl",children:"Framework"}),e.jsx("span",{className:"v10-agent-profile-meta-val mono",children:s.framework})]})]})]}),e.jsxs("div",{className:"v10-agent-profile-stats",children:[e.jsxs("button",{type:"button",className:`v10-agent-profile-stat${v===null?" active":""}`,onClick:()=>h(null),children:[e.jsx("span",{className:"v10-agent-profile-stat-val",children:g}),e.jsx("span",{className:"v10-agent-profile-stat-lbl",children:"All activity"})]}),k.map(t=>{const l=p.get(t.iri)??[];if(l.length===0)return null;const i=c==null?void 0:c.forType(t.iri),n=(i==null?void 0:i.color)??"#a855f7";return e.jsxs("button",{type:"button",className:`v10-agent-profile-stat${v===t.iri?" active":""}`,style:{"--stat-color":n},onClick:()=>h(t.iri),children:[e.jsx("span",{className:"v10-agent-profile-stat-val",children:l.length}),e.jsx("span",{className:"v10-agent-profile-stat-lbl",children:i!=null&&i.label?i.label:t.label})]},t.iri)})]}),e.jsx(E,{entities:d,agentUri:a,typeIri:v??void 0,onSelectEntity:u,onOpenAgent:r,title:e.jsxs(e.Fragment,{children:["All activity",s&&e.jsxs("span",{className:"v10-agent-profile-feed-sub",children:[" · authored by ",s.name]})]}),emptyHint:g===0?`${(s==null?void 0:s.name)??a} hasn't authored anything in this project yet.`:"No entries match the current filter."})]})},V=({contextGraphId:a,agentUri:d})=>{const u=R(a),r=M(a),j=w(a),{openTab:o,closeTab:c,activeTabId:s}=P(),{setActiveProject:p}=A(),g=b.useCallback(t=>{p(a),o({id:`project:${a}`,label:u.displayName||a.slice(0,16),closable:!0}),window.dispatchEvent(new CustomEvent("v10:open-entity",{detail:{contextGraphId:a,entityUri:t}}))},[a,o,u.displayName,p]),m=b.useCallback(t=>{var n;const l=t.startsWith("urn:dkg:agent:")?t.slice(14):t,i=((n=r.get(t))==null?void 0:n.name)??l;o({id:`agent:${a}|${l}`,label:`@ ${i}`,closable:!0})},[a,r,o]),v=b.useCallback(()=>{s&&c(s)},[s,c]),h=b.useMemo(()=>({...r,openAgent:m}),[r,m]);return e.jsx($.Provider,{value:u,children:e.jsx(D.Provider,{value:h,children:e.jsx(B,{agentUri:d,entityList:j.entityList,onSelectEntity:g,onOpenAgent:m,onBack:v})})})};export{V as AgentProfilePage};
|