@agent-receipts/dashboard 0.3.2 → 0.4.0
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/package.json +1 -1
- package/standalone/apps/web/.next/BUILD_ID +1 -1
- package/standalone/apps/web/.next/app-build-manifest.json +54 -54
- package/standalone/apps/web/.next/app-path-routes-manifest.json +13 -13
- package/standalone/apps/web/.next/build-manifest.json +2 -2
- package/standalone/apps/web/.next/prerender-manifest.json +34 -34
- package/standalone/apps/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/_not-found.html +2 -2
- package/standalone/apps/web/.next/server/app/_not-found.rsc +1 -1
- package/standalone/apps/web/.next/server/app/agents/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/agents/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/agents.html +2 -2
- package/standalone/apps/web/.next/server/app/agents.rsc +1 -1
- package/standalone/apps/web/.next/server/app/api/agents/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/chains/[id]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/cleanup/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/config/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/invoices/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/judgments/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/audit/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/entities/[id]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/entities/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/forget/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/observe/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/provenance/[obsId]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/memory/recall/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/receipts/[id]/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/receipts/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/search/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/stats/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/api/verify/route_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/chains/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/chains/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/chains.html +2 -2
- package/standalone/apps/web/.next/server/app/chains.rsc +1 -1
- package/standalone/apps/web/.next/server/app/constraints/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/constraints.html +2 -2
- package/standalone/apps/web/.next/server/app/constraints.rsc +1 -1
- package/standalone/apps/web/.next/server/app/get-started/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/get-started.html +2 -2
- package/standalone/apps/web/.next/server/app/get-started.rsc +1 -1
- package/standalone/apps/web/.next/server/app/how-it-works/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/how-it-works.html +2 -2
- package/standalone/apps/web/.next/server/app/how-it-works.rsc +1 -1
- package/standalone/apps/web/.next/server/app/index.html +2 -2
- package/standalone/apps/web/.next/server/app/index.rsc +1 -1
- package/standalone/apps/web/.next/server/app/invoices/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/invoices.html +3 -3
- package/standalone/apps/web/.next/server/app/invoices.rsc +1 -1
- package/standalone/apps/web/.next/server/app/judgments/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/judgments.html +2 -2
- package/standalone/apps/web/.next/server/app/judgments.rsc +1 -1
- package/standalone/apps/web/.next/server/app/memory/[entityId]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/memory/audit/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/memory/audit.html +2 -2
- package/standalone/apps/web/.next/server/app/memory/audit.rsc +1 -1
- package/standalone/apps/web/.next/server/app/memory/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/memory.html +2 -2
- package/standalone/apps/web/.next/server/app/memory.rsc +1 -1
- package/standalone/apps/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/receipts/[id]/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/receipts/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/receipts.html +2 -2
- package/standalone/apps/web/.next/server/app/receipts.rsc +1 -1
- package/standalone/apps/web/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/settings.html +2 -2
- package/standalone/apps/web/.next/server/app/settings.rsc +1 -1
- package/standalone/apps/web/.next/server/app/verify/page_client-reference-manifest.js +1 -1
- package/standalone/apps/web/.next/server/app/verify.html +2 -2
- package/standalone/apps/web/.next/server/app/verify.rsc +1 -1
- package/standalone/apps/web/.next/server/app-paths-manifest.json +13 -13
- package/standalone/apps/web/.next/server/chunks/6803.js +26 -26
- package/standalone/apps/web/.next/server/chunks/808.js +1 -1
- package/standalone/apps/web/.next/server/pages/404.html +2 -2
- package/standalone/apps/web/.next/server/pages/500.html +1 -1
- package/standalone/apps/web/.next/server/pages-manifest.json +1 -1
- package/standalone/packages/crypto/package.json +1 -1
- package/standalone/packages/mcp-server/dist/index.js +163 -26
- package/standalone/packages/mcp-server/package.json +1 -1
- /package/standalone/apps/web/.next/static/{4imcQFGwcLOgYedAyPG7i → bPnZEfk42BH5O3uBqRDmu}/_buildManifest.js +0 -0
- /package/standalone/apps/web/.next/static/{4imcQFGwcLOgYedAyPG7i → bPnZEfk42BH5O3uBqRDmu}/_ssgManifest.js +0 -0
|
@@ -1784,25 +1784,28 @@ var MemoryEngine = class {
|
|
|
1784
1784
|
page: 1
|
|
1785
1785
|
};
|
|
1786
1786
|
const result = this.memoryStore.recall(memoryQuery);
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1787
|
+
let receipt = null;
|
|
1788
|
+
if (params.audited) {
|
|
1789
|
+
receipt = await this.receiptEngine.create({
|
|
1790
|
+
action: "memory.recall",
|
|
1791
|
+
receipt_type: "memory",
|
|
1792
|
+
input_hash: hashData({ query: params.query, entityType: params.entityType, entityId: params.entityId }),
|
|
1793
|
+
output_hash: hashData({ entities: result.entities.length, observations: result.observations.length }),
|
|
1794
|
+
status: "completed",
|
|
1795
|
+
metadata: {
|
|
1796
|
+
memory: {
|
|
1797
|
+
memory_operation: "recall",
|
|
1798
|
+
entity_id: params.entityId ?? null,
|
|
1799
|
+
observation_id: null,
|
|
1800
|
+
relationship_id: null,
|
|
1801
|
+
scope: params.scope ?? "agent",
|
|
1802
|
+
query: params.query ?? null,
|
|
1803
|
+
results_count: result.total,
|
|
1804
|
+
confidence: null
|
|
1805
|
+
}
|
|
1803
1806
|
}
|
|
1804
|
-
}
|
|
1805
|
-
}
|
|
1807
|
+
});
|
|
1808
|
+
}
|
|
1806
1809
|
return {
|
|
1807
1810
|
entities: result.entities,
|
|
1808
1811
|
observations: result.observations,
|
|
@@ -1929,26 +1932,160 @@ var MemoryEngine = class {
|
|
|
1929
1932
|
const relationships = this.memoryStore.getActiveRelationships(50);
|
|
1930
1933
|
const preferences = this.memoryStore.getPreferenceObservations(20);
|
|
1931
1934
|
const stats = this.memoryStore.getContextStats();
|
|
1935
|
+
let receipt = null;
|
|
1936
|
+
if (params.audited) {
|
|
1937
|
+
receipt = await this.receiptEngine.create({
|
|
1938
|
+
action: "memory.context",
|
|
1939
|
+
receipt_type: "memory",
|
|
1940
|
+
input_hash: hashData({ scope: params.scope, maxEntities, maxObservations }),
|
|
1941
|
+
output_hash: hashData({ entities: entities.length, observations: recent_observations.length }),
|
|
1942
|
+
status: "completed",
|
|
1943
|
+
metadata: {
|
|
1944
|
+
memory: {
|
|
1945
|
+
memory_operation: "recall",
|
|
1946
|
+
entity_id: null,
|
|
1947
|
+
observation_id: null,
|
|
1948
|
+
relationship_id: null,
|
|
1949
|
+
scope: params.scope ?? "agent",
|
|
1950
|
+
query: null,
|
|
1951
|
+
results_count: entities.length + recent_observations.length,
|
|
1952
|
+
confidence: null
|
|
1953
|
+
}
|
|
1954
|
+
}
|
|
1955
|
+
});
|
|
1956
|
+
}
|
|
1957
|
+
return { entities, recent_observations, relationships, preferences, stats, receipt };
|
|
1958
|
+
}
|
|
1959
|
+
async exportBundle(params) {
|
|
1960
|
+
const { entityIds, includeReceipts = true, includeForgotten = false, description = null } = params ?? {};
|
|
1961
|
+
const entityResult = entityIds ? entityIds.map((id) => this.memoryStore.getEntity(id)).filter((e) => e !== null) : this.memoryStore.findEntities({ include_forgotten: includeForgotten, limit: 100, page: 1 }).data;
|
|
1962
|
+
const observations = [];
|
|
1963
|
+
for (const entity of entityResult) {
|
|
1964
|
+
const obs = this.memoryStore.getObservations(entity.entity_id, includeForgotten);
|
|
1965
|
+
observations.push(...obs);
|
|
1966
|
+
}
|
|
1967
|
+
const seenRelIds = /* @__PURE__ */ new Set();
|
|
1968
|
+
const relationships = [];
|
|
1969
|
+
for (const entity of entityResult) {
|
|
1970
|
+
const rels = this.memoryStore.getRelationships(entity.entity_id);
|
|
1971
|
+
for (const rel of rels) {
|
|
1972
|
+
if (!seenRelIds.has(rel.relationship_id)) {
|
|
1973
|
+
seenRelIds.add(rel.relationship_id);
|
|
1974
|
+
relationships.push(rel);
|
|
1975
|
+
}
|
|
1976
|
+
}
|
|
1977
|
+
}
|
|
1978
|
+
let receipts = [];
|
|
1979
|
+
if (includeReceipts) {
|
|
1980
|
+
const receiptIds = /* @__PURE__ */ new Set();
|
|
1981
|
+
for (const obs of observations) receiptIds.add(obs.source_receipt_id);
|
|
1982
|
+
for (const entity of entityResult) receiptIds.add(entity.created_by_receipt);
|
|
1983
|
+
for (const rel of relationships) receiptIds.add(rel.source_receipt_id);
|
|
1984
|
+
for (const id of receiptIds) {
|
|
1985
|
+
const receipt = await this.receiptEngine.get(id);
|
|
1986
|
+
if (receipt) receipts.push(receipt);
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
const checksumPayload = JSON.stringify({
|
|
1990
|
+
entities: [...entityResult].sort((a, b) => a.entity_id.localeCompare(b.entity_id)),
|
|
1991
|
+
observations: [...observations].sort((a, b) => a.observation_id.localeCompare(b.observation_id)),
|
|
1992
|
+
relationships: [...relationships].sort((a, b) => a.relationship_id.localeCompare(b.relationship_id))
|
|
1993
|
+
});
|
|
1994
|
+
const checksum = hashData(checksumPayload);
|
|
1995
|
+
const publicKey = this.receiptEngine.getPublicKey();
|
|
1996
|
+
const allAgents = /* @__PURE__ */ new Set();
|
|
1997
|
+
observations.forEach((o) => allAgents.add(o.source_agent_id));
|
|
1998
|
+
const timestamps = observations.map((o) => o.observed_at).sort();
|
|
1999
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
2000
|
+
return {
|
|
2001
|
+
bundle_id: `bndl_${nanoid2(12)}`,
|
|
2002
|
+
bundle_version: "1.0",
|
|
2003
|
+
created_at: now,
|
|
2004
|
+
created_by_agent: "system",
|
|
2005
|
+
description,
|
|
2006
|
+
public_key: publicKey,
|
|
2007
|
+
entities: entityResult,
|
|
2008
|
+
observations,
|
|
2009
|
+
relationships,
|
|
2010
|
+
receipts,
|
|
2011
|
+
checksum,
|
|
2012
|
+
stats: {
|
|
2013
|
+
entity_count: entityResult.length,
|
|
2014
|
+
observation_count: observations.length,
|
|
2015
|
+
relationship_count: relationships.length,
|
|
2016
|
+
receipt_count: receipts.length,
|
|
2017
|
+
agents: Array.from(allAgents),
|
|
2018
|
+
date_range: {
|
|
2019
|
+
earliest: timestamps[0] ?? now,
|
|
2020
|
+
latest: timestamps[timestamps.length - 1] ?? now
|
|
2021
|
+
}
|
|
2022
|
+
}
|
|
2023
|
+
};
|
|
2024
|
+
}
|
|
2025
|
+
async importBundle(bundle, params) {
|
|
2026
|
+
const { skipExisting = true } = params ?? {};
|
|
2027
|
+
const checksumPayload = JSON.stringify({
|
|
2028
|
+
entities: [...bundle.entities].sort((a, b) => a.entity_id.localeCompare(b.entity_id)),
|
|
2029
|
+
observations: [...bundle.observations].sort((a, b) => a.observation_id.localeCompare(b.observation_id)),
|
|
2030
|
+
relationships: [...bundle.relationships].sort((a, b) => a.relationship_id.localeCompare(b.relationship_id))
|
|
2031
|
+
});
|
|
2032
|
+
const computedChecksum = hashData(checksumPayload);
|
|
2033
|
+
if (computedChecksum !== bundle.checksum) {
|
|
2034
|
+
throw new Error("Bundle checksum mismatch \u2014 data may have been tampered with");
|
|
2035
|
+
}
|
|
2036
|
+
const imported = { entities: 0, observations: 0, relationships: 0 };
|
|
2037
|
+
const skipped = { entities: 0, observations: 0, relationships: 0 };
|
|
2038
|
+
for (const entity of bundle.entities) {
|
|
2039
|
+
const existing = this.memoryStore.getEntity(entity.entity_id);
|
|
2040
|
+
if (existing && skipExisting) {
|
|
2041
|
+
skipped.entities++;
|
|
2042
|
+
continue;
|
|
2043
|
+
}
|
|
2044
|
+
if (!existing) {
|
|
2045
|
+
this.memoryStore.createEntity(entity);
|
|
2046
|
+
imported.entities++;
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
for (const obs of bundle.observations) {
|
|
2050
|
+
const existing = this.memoryStore.getObservation(obs.observation_id);
|
|
2051
|
+
if (existing && skipExisting) {
|
|
2052
|
+
skipped.observations++;
|
|
2053
|
+
continue;
|
|
2054
|
+
}
|
|
2055
|
+
if (!existing) {
|
|
2056
|
+
this.memoryStore.addObservation(obs);
|
|
2057
|
+
imported.observations++;
|
|
2058
|
+
}
|
|
2059
|
+
}
|
|
2060
|
+
for (const rel of bundle.relationships) {
|
|
2061
|
+
try {
|
|
2062
|
+
this.memoryStore.addRelationship(rel);
|
|
2063
|
+
imported.relationships++;
|
|
2064
|
+
} catch {
|
|
2065
|
+
skipped.relationships++;
|
|
2066
|
+
}
|
|
2067
|
+
}
|
|
1932
2068
|
const receipt = await this.receiptEngine.create({
|
|
1933
|
-
action: "memory.
|
|
2069
|
+
action: "memory.import_bundle",
|
|
1934
2070
|
receipt_type: "memory",
|
|
1935
|
-
input_hash: hashData({
|
|
1936
|
-
output_hash: hashData(
|
|
2071
|
+
input_hash: hashData({ bundle_id: bundle.bundle_id }),
|
|
2072
|
+
output_hash: hashData(imported),
|
|
1937
2073
|
status: "completed",
|
|
1938
2074
|
metadata: {
|
|
1939
2075
|
memory: {
|
|
1940
|
-
memory_operation: "
|
|
2076
|
+
memory_operation: "create",
|
|
1941
2077
|
entity_id: null,
|
|
1942
2078
|
observation_id: null,
|
|
1943
2079
|
relationship_id: null,
|
|
1944
|
-
scope:
|
|
2080
|
+
scope: "user",
|
|
1945
2081
|
query: null,
|
|
1946
|
-
results_count: entities.
|
|
2082
|
+
results_count: imported.entities + imported.observations + imported.relationships,
|
|
1947
2083
|
confidence: null
|
|
1948
|
-
}
|
|
2084
|
+
},
|
|
2085
|
+
bundle_id: bundle.bundle_id
|
|
1949
2086
|
}
|
|
1950
2087
|
});
|
|
1951
|
-
return {
|
|
2088
|
+
return { imported, skipped, receipt };
|
|
1952
2089
|
}
|
|
1953
2090
|
};
|
|
1954
2091
|
|
|
File without changes
|
|
File without changes
|